[libsbml/f21: 25/26] Patches for bindings

Zbigniew Jędrzejewski-Szmek zbyszek at fedoraproject.org
Fri Feb 20 04:08:27 UTC 2015


commit 1473b648362df1eec29ef5b33d5e2912e889621b
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Feb 19 17:18:47 2015 -0500

    Patches for bindings

 ...nts-to-easily-distinguish-the-ones-to-be-.patch | 975 +++++++++++++++++++++
 ...bml-these-typemaps-do-not-apply-to-java-C.patch |  24 +
 libsbml.spec                                       |   6 +-
 3 files changed, 1003 insertions(+), 2 deletions(-)
---
diff --git a/libsbml-mark-arguments-to-easily-distinguish-the-ones-to-be-.patch b/libsbml-mark-arguments-to-easily-distinguish-the-ones-to-be-.patch
new file mode 100644
index 0000000..49ba5e2
--- /dev/null
+++ b/libsbml-mark-arguments-to-easily-distinguish-the-ones-to-be-.patch
@@ -0,0 +1,975 @@
+diff --git a/src/bindings/javascript/local.i b/src/bindings/javascript/local.i
+index 88af17d03b..b2f97590cf 100644
+--- a/src/bindings/javascript/local.i
++++ b/src/bindings/javascript/local.i
+@@ -213,53 +213,9 @@ namespace std
+ }
+ 
+ 
+-// ----------------------------------------------------------------------
+-// takeover ownership
+-// ----------------------------------------------------------------------
+-
+-/**
+- * - void ListOf::appendAndOwn(SBase* item)
+- */
+-%apply SWIGTYPE *DISOWN {SBase* item};
+-%apply SWIGTYPE * {const SBase* item};
+-
+-/**
+- * - void ASTNode::addChild (ASTNode* child)
+- * - void ASTNode::prependChild (ASTNode* child)
+- */
+-%apply SWIGTYPE *DISOWN {ASTNode* child};
+-%apply SWIGTYPE * {const ASTNode* child};
+-
+-/**
+- * - void ASTNode::insertChild  (unsigned int n, ASTNode* newChild)
+- * - void ASTNode::replaceChild (unsigned int n, ASTNode* newChild)
+- */
+-%apply SWIGTYPE *DISOWN {ASTNode* newChild};
+-%apply SWIGTYPE * {const ASTNode* newChild};
+-
+-/**
+- * - void ASTNode::addSemanticsAnnotation (XMLNode* sAnnotation);
+- */
+-%apply SWIGTYPE *DISOWN {XMLNode* sAnnotation};
+-%apply SWIGTYPE * {const XMLNode* sAnnotation};
+-
+-
+ /**
+  * Wraps the SBMLConstructorException
+  *
+- * The SBMLConstructorException (C++ class) is wrapped as the 
+- * SBMLConsturctorException (Ruby class) which is derived from
+- * the built-in ArgumentError class (Ruby class).
+- *
+- * For example, the exception can be catched in Ruby code as follows:
+- *
+- * -------------------------------------------------
+- *  begin
+- *    s = LibSBML::Compartment.new(level,version)
+- *  rescue SBMLConstructorException
+- *    errmsg = $! 
+- *  end
+- * -------------------------------------------------
+  */
+ 
+ %exceptionclass SBMLConstructorException;
+diff --git a/src/bindings/perl/local.i b/src/bindings/perl/local.i
+index 1c30b096b6..f60ef82cf1 100644
+--- a/src/bindings/perl/local.i
++++ b/src/bindings/perl/local.i
+@@ -68,72 +68,6 @@
+ }
+ 
+ /**
+- * The features directives below override the default SWIG generated
+- * code for certain methods.  The idea is to tell SWIG to disown the
+- * passed-in object.  The containing object will takeover ownership
+- * and delete the object as appropriate.  This avoids a deadly
+- * double-delete which can result in a segmentation fault.  For
+- * example, each SBase that is appended to a ListOf is subsequently
+- * owned by that ListOf.
+- */
+-
+-// ----------------------------------------------------------------------
+-// ListOf
+-// ----------------------------------------------------------------------
+-
+-%feature("shadow") ListOf::appendAndOwn(SBase*)
+-%{
+-  sub appendAndOwn {
+-    $_[1]->DISOWN() if defined $_[1];
+-    return LibSBMLc::ListOf_appendAndOwn(@_);
+-  }
+-%}
+-
+-// ----------------------------------------------------------------------
+-// ASTNode
+-// ----------------------------------------------------------------------
+-
+-%feature("shadow") ASTNode::addChild(ASTNode*)
+-%{
+-  sub addChild {
+-    $_[1]->DISOWN() if defined $_[1];
+-    return LibSBMLc::ASTNode_addChild(@_);
+-  }
+-%}
+-
+-%feature("shadow") ASTNode::prependChild(ASTNode*)
+-%{
+-  sub prependChild {
+-    $_[1]->DISOWN() if defined $_[1];
+-    return LibSBMLc::ASTNode_prependChild(@_);
+-  }
+-%}
+-
+-%feature("shadow") ASTNode::insertChild(unsigned int, ASTNode*)
+-%{
+-  sub insertChild {
+-    $_[2]->DISOWN() if defined $_[2];
+-    return LibSBMLc::ASTNode_insertChild(@_);
+-  }
+-%}
+-
+-%feature("shadow") ASTNode::replaceChild(unsigned int, ASTNode*)
+-%{
+-  sub replaceChild {
+-    $_[2]->DISOWN() if defined $_[2];
+-    return LibSBMLc::ASTNode_replaceChild(@_);
+-  }
+-%}
+-
+-%feature("shadow") ASTNode::addSemanticsAnnotation(XMLNode*)
+-%{
+-  sub addSemanticsAnnotation {
+-    $_[1]->DISOWN() if defined $_[1];
+-    return LibSBMLc::ASTNode_addSemanticsAnnotation(@_);
+-  }
+-%}
+-
+-/**
+  * Wraps standard output streams
+  */
+ 
+diff --git a/src/bindings/python/local.i b/src/bindings/python/local.i
+index d2a6182c0f..435faf6330 100644
+--- a/src/bindings/python/local.i
++++ b/src/bindings/python/local.i
+@@ -365,51 +365,6 @@ SWIGPYTHON__CMP__(XMLError)
+ SWIGPYTHON__CMP__(XMLErrorLog)
+ SWIGPYTHON__CMP__(XMLOutputStream)
+ 
+-/**
+- * The features directives below override the default SWIG generated
+- * code for certain methods.  The idea is to tell SWIG to disown the
+- * passed-in object.  The containing object will takeover ownership
+- * and delete the object as appropriate.  This avoids a deadly
+- * double-delete which can result in a segmentation fault.  For
+- * example, each SBase that is appended to a ListOf is subsequently
+- * owned by that ListOf.
+- */
+-
+-%define TAKEOVER_OWNERSHIP(METHOD_NAME,ARG_INDEX)
+-%feature("pythonprepend")
+-METHOD_NAME
+-%{
+-        if args[ARG_INDEX] is not None: args[ARG_INDEX].thisown = 0
+-%}
+-%enddef
+-
+-// ----------------------------------------------------------------------
+-// ListOf
+-// ----------------------------------------------------------------------
+-
+-#if SWIG_VERSION > 0x010336
+-TAKEOVER_OWNERSHIP(ListOf::appendAndOwn(SBase*),0)
+-#else
+-TAKEOVER_OWNERSHIP(ListOf::appendAndOwn(SBase*),1)
+-#endif
+-
+-// ----------------------------------------------------------------------
+-// ASTNode
+-// ----------------------------------------------------------------------
+-
+-#if SWIG_VERSION > 0x010336
+-TAKEOVER_OWNERSHIP(ASTNode::addChild(ASTNode*),0)
+-TAKEOVER_OWNERSHIP(ASTNode::prependChild(ASTNode*),0)
+-TAKEOVER_OWNERSHIP(ASTNode::insertChild(unsigned int, ASTNode*),1)
+-TAKEOVER_OWNERSHIP(ASTNode::replaceChild(unsigned int, ASTNode*),1)
+-TAKEOVER_OWNERSHIP(ASTNode::addSemanticsAnnotation(XMLNode*),0)
+-#else
+-TAKEOVER_OWNERSHIP(ASTNode::addChild(ASTNode*),1)
+-TAKEOVER_OWNERSHIP(ASTNode::prependChild(ASTNode*),1)
+-TAKEOVER_OWNERSHIP(ASTNode::insertChild(unsigned int, ASTNode*),2)
+-TAKEOVER_OWNERSHIP(ASTNode::replaceChild(unsigned int, ASTNode*),2)
+-TAKEOVER_OWNERSHIP(ASTNode::addSemanticsAnnotation(XMLNode*),1)
+-#endif
+ 
+ /**
+  *
+diff --git a/src/bindings/r/local.i b/src/bindings/r/local.i
+index 4a05db46cc..a87602d544 100644
+--- a/src/bindings/r/local.i
++++ b/src/bindings/r/local.i
+@@ -205,53 +205,8 @@ namespace std
+ }
+ 
+ 
+-// ----------------------------------------------------------------------
+-// takeover ownership
+-// ----------------------------------------------------------------------
+-
+-/**
+- * - void ListOf::appendAndOwn(SBase* item)
+- */
+-%apply SWIGTYPE *DISOWN {SBase* item};
+-%apply SWIGTYPE * {const SBase* item};
+-
+-/**
+- * - void ASTNode::addChild (ASTNode* child)
+- * - void ASTNode::prependChild (ASTNode* child)
+- */
+-%apply SWIGTYPE *DISOWN {ASTNode* child};
+-%apply SWIGTYPE * {const ASTNode* child};
+-
+-/**
+- * - void ASTNode::insertChild  (unsigned int n, ASTNode* newChild)
+- * - void ASTNode::replaceChild (unsigned int n, ASTNode* newChild)
+- */
+-%apply SWIGTYPE *DISOWN {ASTNode* newChild};
+-%apply SWIGTYPE * {const ASTNode* newChild};
+-
+-/**
+- * - void ASTNode::addSemanticsAnnotation (XMLNode* sAnnotation);
+- */
+-%apply SWIGTYPE *DISOWN {XMLNode* sAnnotation};
+-%apply SWIGTYPE * {const XMLNode* sAnnotation};
+-
+-
+ /**
+  * Wraps the SBMLConstructorException
+- *
+- * The SBMLConstructorException (C++ class) is wrapped as the 
+- * SBMLConsturctorException (Ruby class) which is derived from
+- * the built-in ArgumentError class (Ruby class).
+- *
+- * For example, the exception can be catched in Ruby code as follows:
+- *
+- * -------------------------------------------------
+- *  begin
+- *    s = LibSBML::Compartment.new(level,version)
+- *  rescue SBMLConstructorException
+- *    errmsg = $! 
+- *  end
+- * -------------------------------------------------
+  */
+ 
+ %exceptionclass SBMLConstructorException;
+diff --git a/src/bindings/ruby/local.i b/src/bindings/ruby/local.i
+index 39b3efe576..0f59a641fd 100644
+--- a/src/bindings/ruby/local.i
++++ b/src/bindings/ruby/local.i
+@@ -230,37 +230,6 @@ namespace std
+ }
+ 
+ 
+-// ----------------------------------------------------------------------
+-// takeover ownership
+-// ----------------------------------------------------------------------
+-
+-/**
+- * - void ListOf::appendAndOwn(SBase* item)
+- */
+-%apply SWIGTYPE *DISOWN {SBase* item};
+-%apply SWIGTYPE * {const SBase* item};
+-
+-/**
+- * - void ASTNode::addChild (ASTNode* child)
+- * - void ASTNode::prependChild (ASTNode* child)
+- */
+-%apply SWIGTYPE *DISOWN {ASTNode* child};
+-%apply SWIGTYPE * {const ASTNode* child};
+-
+-/**
+- * - void ASTNode::insertChild  (unsigned int n, ASTNode* newChild)
+- * - void ASTNode::replaceChild (unsigned int n, ASTNode* newChild)
+- */
+-%apply SWIGTYPE *DISOWN {ASTNode* newChild};
+-%apply SWIGTYPE * {const ASTNode* newChild};
+-
+-/**
+- * - void ASTNode::addSemanticsAnnotation (XMLNode* sAnnotation);
+- */
+-%apply SWIGTYPE *DISOWN {XMLNode* sAnnotation};
+-%apply SWIGTYPE * {const XMLNode* sAnnotation};
+-
+-
+ /**
+  * Wraps the SBMLConstructorException
+  *
+diff --git a/src/bindings/swig/libsbml.i b/src/bindings/swig/libsbml.i
+index 30261421c8..27d6fedbdb 100644
+--- a/src/bindings/swig/libsbml.i
++++ b/src/bindings/swig/libsbml.i
+@@ -40,6 +40,17 @@
+ 
+ #pragma SWIG nowarn=473,401,844
+ 
++// apply typemaps for items we manage manually
++%include "typemaps.i"
++
++%apply SWIGTYPE *DISOWN { SBase* disownedItem };
++%apply SWIGTYPE *DISOWN { SBase_t* disownedItem };
++%apply SWIGTYPE *DISOWN { XMLNode* disownedAnnotation };
++%apply SWIGTYPE *DISOWN { XMLNode_t* disownedAnnotation };
++%apply SWIGTYPE *DISOWN { ASTNode* disownedChild };
++%apply SWIGTYPE *DISOWN { ASTNode_t* disownedChild };
++%apply SWIGTYPE *DISOWN { SBMLNamespaces* disownedNs };
++
+ %pragma(java) moduleclassmodifiers="
+ /**
+   * Wrapper class for global methods and constants defined by libSBML.
+diff --git a/src/sbml/ListOf.h b/src/sbml/ListOf.h
+index 830e9d21a8..838337b603 100644
+--- a/src/sbml/ListOf.h
++++ b/src/sbml/ListOf.h
+@@ -194,7 +194,7 @@ public:
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+    * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
+    *
+-   * @see appendAndOwn(SBase* item)
++   * @see appendAndOwn(SBase* disownedItem)
+    * @see appendFrom(const ListOf* list)
+    */
+   int append (const SBase* item);
+@@ -203,12 +203,12 @@ public:
+   /**
+    * Adds an item to the end of this ListOf's list of items.
+    *
+-   * This method does not clone the @p item handed to it; instead, it assumes
++   * This method does not clone the @p disownedItem handed to it; instead, it assumes
+    * ownership of it.  This means that when the ListOf is destroyed, the item
+    * will be destroyed along with it.  For a method with an alternative
+    * ownership behavior, see the ListOf::append(SBase* item) method.
+    *
+-   * @param item the item to be added to the list.
++   * @param disownedItem the item to be added to the list.
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -217,7 +217,7 @@ public:
+    * @see append(const SBase* item)
+    * @see appendFrom(const ListOf* list)
+    */
+-  int appendAndOwn (SBase* item);
++  int appendAndOwn (SBase* disownedItem);
+ 
+ 
+   /**
+@@ -233,7 +233,7 @@ public:
+    * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
+    *
+    * @see append(const SBase* item)
+-   * @see appendAndOwn(SBase* item)
++   * @see appendAndOwn(SBase* disownedItem)
+    */
+   virtual int appendFrom (const ListOf* list);
+ 
+@@ -260,12 +260,12 @@ public:
+   /**
+    * Inserts an item at a given position in this ListOf's list of items.
+    *
+-   * This variant of the method makes a clone of the @p item handed to it.
++   * This variant of the method does not make a clone of the @p disownedItem handed to it.
+    * This means that when the ListOf is destroyed, the original @p item
+    * <em>will</em> be destroyed.
+    *
+    * @param location the location where to insert the item
+-   * @param item the item to be inserted to the list
++   * @param disownedItem the item to be inserted to the list
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -273,7 +273,7 @@ public:
+    *
+    * @see insert(int location, const SBase* item)
+    */
+-  int insertAndOwn(int location, SBase* item);
++  int insertAndOwn(int location, SBase* disownedItem);
+ 
+ 
+   /**
+@@ -674,10 +674,10 @@ ListOf_append (ListOf_t *lo, const SBase_t *item);
+ /**
+  * Adds the given item to the end of a ListOf_t list.
+  *
+- * @param lo the ListOf_t structure to which the @p item should be appended.
+- * @param item the item to append to the list.
++ * @param lo the ListOf_t structure to which the @p disownedItem should be appended.
++ * @param disownedItem the item to append to the list.
+  *
+- * Unlike ListOf_append(), this function does not copy the @p item.
++ * Unlike ListOf_append(), this function does not copy the @p disownedItem.
+  * The given @p lo list will contain the original item.
+  *
+  * @copydetails doc_returns_success_code
+@@ -690,7 +690,7 @@ ListOf_append (ListOf_t *lo, const SBase_t *item);
+  */
+ LIBSBML_EXTERN
+ int
+-ListOf_appendAndOwn (ListOf_t *lo, SBase_t *item);
++ListOf_appendAndOwn (ListOf_t *lo, SBase_t *disownedItem);
+ 
+ 
+ /**
+@@ -731,12 +731,12 @@ ListOf_insert (ListOf_t *lo, int location, const SBase_t *item);
+ /**
+  * Inserts an item into a ListOf_t list at a given position.
+  *
+- * Unlike ListOf_insert(), this function does not clone @p item before
++ * Unlike ListOf_insert(), this function does not clone @p disownedItem before
+  * inserting it into @p lo, which means that @p lo becomes the owner.
+  *
+- * @param lo the list into which @p item will be inserted.
+- * @param location the starting index for the @p item in the @p lo list.
+- * @param item the item to append to insert into @p lo.
++ * @param lo the list into which @p disownedItem will be inserted.
++ * @param location the starting index for the @p disownedItem in the @p lo list.
++ * @param disownedItem the item to append to insert into @p lo.
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -746,7 +746,7 @@ ListOf_insert (ListOf_t *lo, int location, const SBase_t *item);
+  */
+ LIBSBML_EXTERN
+ int
+-ListOf_insertAndOwn (ListOf_t *lo, int location, SBase_t *item);
++ListOf_insertAndOwn (ListOf_t *lo, int location, SBase_t *disownedItem);
+ 
+ 
+ /**
+diff --git a/src/sbml/SBase.h b/src/sbml/SBase.h
+index e84e6c7927..32979a43d4 100644
+--- a/src/sbml/SBase.h
++++ b/src/sbml/SBase.h
+@@ -3042,7 +3042,7 @@ newModel.addSpecies(s1);
+   int setSBMLNamespaces(SBMLNamespaces * sbmlns);
+ 
+   /* sets the SBMLNamaepaces and owns the given object - internal use only */
+-  void setSBMLNamespacesAndOwn(SBMLNamespaces * sbmlns);
++  void setSBMLNamespacesAndOwn(SBMLNamespaces * disownedNs);
+   /** @endcond */
+ 
+ 
+diff --git a/src/sbml/math-legacy/ASTNode.h b/src/sbml/math-legacy/ASTNode.h
+index 901026569a..3de70313ff 100644
+--- a/src/sbml/math-legacy/ASTNode.h
++++ b/src/sbml/math-legacy/ASTNode.h
+@@ -389,7 +389,7 @@ public:
+    *
+    * Child nodes are added in-order, from left to right.
+    *
+-   * @param child the ASTNode instance to add
++   * @param disownedChild the ASTNode instance to add
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -397,21 +397,21 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see prependChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    * @see isWellFormedASTNode()
+    */
+   LIBSBML_EXTERN
+-  int addChild (ASTNode* child, bool inRead = false);
++  int addChild (ASTNode* disownedChild, bool inRead = false);
+ 
+ 
+   /**
+    * Adds the given node as a child of this ASTNode.  This method adds
+    * child nodes from right to left.
+    *
+-   * @param child the ASTNode instance to add
++   * @param disownedChild the ASTNode instance to add
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -419,13 +419,13 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    */
+   LIBSBML_EXTERN
+-  int prependChild (ASTNode* child);
++  int prependChild (ASTNode* disownedChild);
+ 
+ 
+   /**
+@@ -439,10 +439,10 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see prependChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    */
+   LIBSBML_EXTERN
+   int removeChild(unsigned int n);
+@@ -452,7 +452,7 @@ public:
+    * Replaces and optionally deletes the nth child of this ASTNode with the given ASTNode.
+    *
+    * @param n unsigned int the index of the child to replace
+-   * @param newChild ASTNode to replace the nth child
++   * @param disownedChild ASTNode to replace the nth child
+    * @param delreplaced boolean indicating whether to delete the replaced child.
+    *
+    * @copydetails doc_returns_success_code
+@@ -462,13 +462,13 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see prependChild(ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    */
+   LIBSBML_EXTERN
+-  int replaceChild(unsigned int n, ASTNode *newChild, bool delreplaced=false);
++  int replaceChild(unsigned int n, ASTNode *disownedChild, bool delreplaced=false);
+ 
+ 
+   /**
+@@ -476,7 +476,7 @@ public:
+    * of this ASTNode.
+    *
+    * @param n unsigned int the index of the ASTNode being added
+-   * @param newChild ASTNode to insert as the nth child
++   * @param disownedChild ASTNode to insert as the nth child
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -485,13 +485,13 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see prependChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    */
+   LIBSBML_EXTERN
+-  int insertChild(unsigned int n, ASTNode *newChild);
++  int insertChild(unsigned int n, ASTNode *disownedChild);
+ 
+ 
+   /**
+@@ -571,7 +571,7 @@ getChild( getNumChildren() - 1 );
+    *
+    * @htmlinclude about-semantic-annotations.html
+    *
+-   * @param sAnnotation the annotation to add.
++   * @param disownedAnnotation the annotation to add.
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -589,7 +589,7 @@ getChild( getNumChildren() - 1 );
+    * href="http://sbml.org/Forums">sbml-interoperability&#64;caltech.edu</a>.
+    */
+   LIBSBML_EXTERN
+-  int addSemanticsAnnotation (XMLNode* sAnnotation);
++  int addSemanticsAnnotation (XMLNode* disownedAnnotation);
+ 
+ 
+   /**
+@@ -599,7 +599,7 @@ getChild( getNumChildren() - 1 );
+    * 
+    * @return the number of annotations of this ASTNode.
+    *
+-   * @see ASTNode::addSemanticsAnnotation(XMLNode* sAnnotation)
++   * @see ASTNode::addSemanticsAnnotation(XMLNode* disownedAnnotation)
+    */
+   LIBSBML_EXTERN
+   unsigned int getNumSemanticsAnnotations () const;
+@@ -615,7 +615,7 @@ getChild( getNumChildren() - 1 );
+    * @if clike getNumSemanticsAnnotations()@else ASTNode::getNumSemanticsAnnotations()@endif@~
+    * <code>- 1</code>).
+    *
+-   * @see ASTNode::addSemanticsAnnotation(XMLNode* sAnnotation)
++   * @see ASTNode::addSemanticsAnnotation(XMLNode* disownedAnnotation)
+    */
+   LIBSBML_EXTERN
+   XMLNode* getSemanticsAnnotation (unsigned int n) const;
+@@ -2043,7 +2043,7 @@ ASTNode_canonicalize (ASTNode_t *node);
+  * Child nodes are added in order from "left-to-right".
+  *
+  * @param node the node which will get the new child node
+- * @param child the ASTNode_t instance to add
++ * @param disownedChild the ASTNode_t instance to add
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -2062,7 +2062,7 @@ ASTNode_canonicalize (ASTNode_t *node);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_addChild (ASTNode_t *node, ASTNode_t *child);
++ASTNode_addChild (ASTNode_t *node, ASTNode_t *disownedChild);
+ 
+ 
+ /**
+@@ -2071,7 +2071,7 @@ ASTNode_addChild (ASTNode_t *node, ASTNode_t *child);
+  * This method adds child nodes from right to left.
+  *
+  * @param node the node that will receive the given child node.
+- * @param child the ASTNode_t instance to add.
++ * @param disownedChild the ASTNode_t instance to add.
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -2089,7 +2089,7 @@ ASTNode_addChild (ASTNode_t *node, ASTNode_t *child);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_prependChild (ASTNode_t *node, ASTNode_t *child);
++ASTNode_prependChild (ASTNode_t *node, ASTNode_t *disownedChild);
+ 
+ 
+ /**
+@@ -2123,7 +2123,7 @@ ASTNode_removeChild(ASTNode_t* node, unsigned int n);
+  *
+  * @param node the ASTNode_t node to modify
+  * @param n unsigned int the index of the child to replace
+- * @param newChild ASTNode_t structure to replace the nth child
++ * @param disownedChild ASTNode_t structure to replace the nth child
+  *
+  * @return integer value indicating success/failure of the
+  * function.  The possible values returned by this function are:
+@@ -2143,7 +2143,7 @@ ASTNode_removeChild(ASTNode_t* node, unsigned int n);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
++ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
+ 
+ 
+ /**
+@@ -2151,7 +2151,7 @@ ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
+  *
+  * @param node the ASTNode_t node to modify
+  * @param n unsigned int the index of the child to replace
+- * @param newChild ASTNode_t structure to replace the nth child
++ * @param disownedChild ASTNode_t structure to replace the nth child
+  *
+  * @return integer value indicating success/failure of the
+  * function.  The possible values returned by this function are:
+@@ -2171,7 +2171,7 @@ ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
++ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
+ 
+ 
+ /**
+@@ -2179,9 +2179,9 @@ ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * newCh
+  * node.
+  *
+  * @param node the ASTNode_t structure to modify.
+- * @param n unsigned int the index of the location where the @p newChild is
++ * @param n unsigned int the index of the location where the @p disownedChild is
+  * to be added.
+- * @param newChild ASTNode_t structure to insert as the nth child.
++ * @param disownedChild ASTNode_t structure to insert as the nth child.
+  *
+  * @return integer value indicating success/failure of the
+  * function.  The possible values returned by this function are:
+@@ -2200,7 +2200,7 @@ ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * newCh
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_insertChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
++ASTNode_insertChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
+ 
+ 
+ /**
+@@ -3568,7 +3568,7 @@ ASTNode_unsetParentSBMLObject(ASTNode_t* node);
+  * @htmlinclude about-semantic-annotations.html
+  *
+  * @param node the node to modify
+- * @param annotation the annotation to add
++ * @param disownedAnnotation the annotation to add
+  *
+  * @return integer value indicating success/failure of the
+  * function.  The possible values returned by this function are:
+@@ -3591,7 +3591,7 @@ ASTNode_unsetParentSBMLObject(ASTNode_t* node);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_addSemanticsAnnotation(ASTNode_t* node, XMLNode_t * annotation);
++ASTNode_addSemanticsAnnotation(ASTNode_t* node, XMLNode_t * disownedAnnotation);
+ 
+ 
+ /**
+diff --git a/src/sbml/math/ASTNode.h b/src/sbml/math/ASTNode.h
+index 8fb9f77b9b..1c18ca28c0 100644
+--- a/src/sbml/math/ASTNode.h
++++ b/src/sbml/math/ASTNode.h
+@@ -307,7 +307,7 @@ public:
+    *
+    * Child nodes are added in-order, from left to right.
+    *
+-   * @param child the ASTNode instance to add
++   * @param disownedChild the ASTNode instance to add
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -315,13 +315,13 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see prependChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    * @see isWellFormedASTNode()
+    */
+-  int addChild (ASTNode* child);
++  int addChild (ASTNode* disownedChild);
+ 
+ 
+   /**
+@@ -329,7 +329,7 @@ public:
+    *
+    * This method adds child nodes from right to left.
+    *
+-   * @param child the ASTNode instance to add
++   * @param disownedChild the ASTNode instance to add
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -337,12 +337,12 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    */
+-  int prependChild (ASTNode* child);
++  int prependChild (ASTNode* disownedChild);
+ 
+ 
+   /**
+@@ -356,10 +356,10 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see prependChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    */
+   int removeChild(unsigned int n);
+ 
+@@ -368,7 +368,7 @@ public:
+    * Replaces the nth child of this ASTNode with the given ASTNode.
+    *
+    * @param n unsigned int the index of the child to replace
+-   * @param newChild ASTNode to replace the nth child
++   * @param disownedChild ASTNode to replace the nth child
+    * @param delreplaced boolean indicating whether to delete the replaced child.
+    *
+    * @copydetails doc_returns_success_code
+@@ -378,12 +378,12 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see prependChild(ASTNode* child)
+-   * @see insertChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see insertChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    */
+-  int replaceChild(unsigned int n, ASTNode *newChild, bool delreplaced=false);
++  int replaceChild(unsigned int n, ASTNode *disownedChild, bool delreplaced=false);
+ 
+ 
+   /**
+@@ -391,7 +391,7 @@ public:
+    * list of children.
+    *
+    * @param n unsigned int the index of the ASTNode being added
+-   * @param newChild ASTNode to insert as the nth child
++   * @param disownedChild ASTNode to insert as the nth child
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -400,12 +400,12 @@ public:
+    *
+    * @copydetails doc_warning_modifying_structure
+    *
+-   * @see addChild(ASTNode* child)
+-   * @see prependChild(ASTNode* child)
+-   * @see replaceChild(unsigned int n, ASTNode* child)
++   * @see addChild(ASTNode* disownedChild)
++   * @see prependChild(ASTNode* disownedChild)
++   * @see replaceChild(unsigned int n, ASTNode* disownedChild)
+    * @see removeChild(unsigned int n)
+    */
+-  int insertChild(unsigned int n, ASTNode *newChild);
++  int insertChild(unsigned int n, ASTNode *disownedChild);
+ 
+ 
+   /**
+@@ -481,7 +481,7 @@ getChild( getNumChildren() - 1 );
+    *
+    * @copydetails doc_about_mathml_semantic_annotations
+    *
+-   * @param sAnnotation the annotation to add.
++   * @param disownedAnnotation the annotation to add.
+    *
+    * @copydetails doc_returns_success_code
+    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
+@@ -492,7 +492,7 @@ getChild( getNumChildren() - 1 );
+    * @see ASTNode::getNumSemanticsAnnotations()
+    * @see ASTNode::getSemanticsAnnotation(@if java unsigned int at endif)
+    */
+-  int addSemanticsAnnotation (XMLNode* sAnnotation);
++  int addSemanticsAnnotation (XMLNode* disownedAnnotation);
+ 
+ 
+   /**
+@@ -2123,7 +2123,7 @@ ASTNode_canonicalize (ASTNode_t *node);
+  * Child nodes are added in order from "left-to-right".
+  *
+  * @param node the node which will get the new child node
+- * @param child the ASTNode_t instance to add
++ * @param disownedChild the ASTNode_t instance to add
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
+@@ -2142,7 +2142,7 @@ ASTNode_canonicalize (ASTNode_t *node);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_addChild (ASTNode_t *node, ASTNode_t *child);
++ASTNode_addChild (ASTNode_t *node, ASTNode_t *disownedChild);
+ 
+ 
+ /**
+@@ -2151,7 +2151,7 @@ ASTNode_addChild (ASTNode_t *node, ASTNode_t *child);
+  * This method adds child nodes from right to left.
+  *
+  * @param node the node that will receive the given child node.
+- * @param child the ASTNode_t instance to add.
++ * @param disownedChild the ASTNode_t instance to add.
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
+@@ -2169,7 +2169,7 @@ ASTNode_addChild (ASTNode_t *node, ASTNode_t *child);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_prependChild (ASTNode_t *node, ASTNode_t *child);
++ASTNode_prependChild (ASTNode_t *node, ASTNode_t *disownedChild);
+ 
+ 
+ /**
+@@ -2202,7 +2202,7 @@ ASTNode_removeChild(ASTNode_t* node, unsigned int n);
+  *
+  * @param node the ASTNode_t node to modify
+  * @param n unsigned int the index of the child to replace
+- * @param newChild ASTNode_t structure to replace the nth child
++ * @param disownedChild ASTNode_t structure to replace the nth child
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
+@@ -2221,7 +2221,7 @@ ASTNode_removeChild(ASTNode_t* node, unsigned int n);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
++ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
+ 
+ 
+ /**
+@@ -2229,7 +2229,7 @@ ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
+  *
+  * @param node the ASTNode_t node to modify
+  * @param n unsigned int the index of the child to replace
+- * @param newChild ASTNode_t structure to replace the nth child
++ * @param disownedChild ASTNode_t structure to replace the nth child
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
+@@ -2248,7 +2248,7 @@ ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
++ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
+ 
+ 
+ /**
+@@ -2256,9 +2256,9 @@ ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * newCh
+  * node.
+  *
+  * @param node the ASTNode_t structure to modify.
+- * @param n unsigned int the index of the location where the @p newChild is
++ * @param n unsigned int the index of the location where the @p disownedChild is
+  * to be added.
+- * @param newChild ASTNode_t structure to insert as the nth child.
++ * @param disownedChild ASTNode_t structure to insert as the nth child.
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
+@@ -2276,7 +2276,7 @@ ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * newCh
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_insertChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
++ASTNode_insertChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
+ 
+ 
+ /**
+@@ -3695,7 +3695,7 @@ ASTNode_unsetParentSBMLObject(ASTNode_t* node);
+  * @copydetails doc_about_mathml_semantic_annotations
+  *
+  * @param node the node to modify
+- * @param annotation the annotation to add
++ * @param disownedAnnotation the annotation to add
+  *
+  * @copydetails doc_returns_success_code
+  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
+@@ -3708,7 +3708,7 @@ ASTNode_unsetParentSBMLObject(ASTNode_t* node);
+  */
+ LIBSBML_EXTERN
+ int
+-ASTNode_addSemanticsAnnotation(ASTNode_t* node, XMLNode_t * annotation);
++ASTNode_addSemanticsAnnotation(ASTNode_t* node, XMLNode_t * disownedAnnotation);
+ 
+ 
+ /**
+-- 
+2.1.0
+
diff --git a/libsbml-these-typemaps-do-not-apply-to-java-C.patch b/libsbml-these-typemaps-do-not-apply-to-java-C.patch
new file mode 100644
index 0000000..77bc84a
--- /dev/null
+++ b/libsbml-these-typemaps-do-not-apply-to-java-C.patch
@@ -0,0 +1,24 @@
+diff --git a/src/bindings/swig/libsbml.i b/src/bindings/swig/libsbml.i
+index 27d6fedbdb..409450098c 100644
+--- a/src/bindings/swig/libsbml.i
++++ b/src/bindings/swig/libsbml.i
+@@ -40,6 +40,7 @@
+ 
+ #pragma SWIG nowarn=473,401,844
+ 
++#if (!defined (SWIGJAVA) && !defined(SWIGCSHARP))
+ // apply typemaps for items we manage manually
+ %include "typemaps.i"
+ 
+@@ -51,6 +52,8 @@
+ %apply SWIGTYPE *DISOWN { ASTNode_t* disownedChild };
+ %apply SWIGTYPE *DISOWN { SBMLNamespaces* disownedNs };
+ 
++#endif 
++
+ %pragma(java) moduleclassmodifiers="
+ /**
+   * Wrapper class for global methods and constants defined by libSBML.
+-- 
+2.1.0
+
diff --git a/libsbml.spec b/libsbml.spec
index 672831d..02a9976 100644
--- a/libsbml.spec
+++ b/libsbml.spec
@@ -45,6 +45,10 @@ Patch2:         libsbml_csharp-unexpected_symbol_error.patch
 Patch3:         libsbml-fix_install_libpaths.patch
 ## https://sourceforge.net/p/sbml/libsbml/393/
 Patch4:         libsbml-arm-fix.patch
+## https://sourceforge.net/p/sbml/libsbml/399/
+## https://sourceforge.net/p/sbml/libsbml/401/
+Patch5:         libsbml-mark-arguments-to-easily-distinguish-the-ones-to-be-.patch
+Patch6:         libsbml-these-typemaps-do-not-apply-to-java-C.patch
 
 BuildRequires:  cmake
 BuildRequires:  zlib-devel
@@ -330,8 +334,6 @@ ctest -V %{?_smp_mflags}
 popd
 %endif
 pushd build
-# https://sourceforge.net/p/sbml/libsbml/399/
-sed -i '3i GC.disable' src/bindings/ruby/test/test.rb
 ctest -V %{?_smp_mflags}
 popd
 %endif


More information about the scm-commits mailing list