Merge branch 'master' into directorargout_and_java_typemaps
This commit is contained in:
commit
b9cdc3c5e1
83 changed files with 1602 additions and 946 deletions
|
|
@ -162,9 +162,6 @@ matrix:
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
os: osx
|
os: osx
|
||||||
env: SWIGLANG=go
|
env: SWIGLANG=go
|
||||||
- compiler: clang
|
|
||||||
os: osx
|
|
||||||
env: SWIGLANG=guile
|
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
os: osx
|
os: osx
|
||||||
env: SWIGLANG=java
|
env: SWIGLANG=java
|
||||||
|
|
@ -199,6 +196,10 @@ matrix:
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
os: linux
|
os: linux
|
||||||
env: SWIGLANG=python SWIG_FEATURES=-O
|
env: SWIGLANG=python SWIG_FEATURES=-O
|
||||||
|
# brew install guile fails on Travis as OSX 10.9 is too old now, default osx_image needs changing
|
||||||
|
- compiler: clang
|
||||||
|
os: osx
|
||||||
|
env: SWIGLANG=guile
|
||||||
before_install:
|
before_install:
|
||||||
- date -u
|
- date -u
|
||||||
- uname -a
|
- uname -a
|
||||||
|
|
|
||||||
114
CHANGES.current
114
CHANGES.current
|
|
@ -5,6 +5,120 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 3.0.11 (in progress)
|
Version 3.0.11 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2016-09-29: wsfulton
|
||||||
|
[Allegrocl, CFFI, GO, Javascript, Ocaml, R, Scilab]
|
||||||
|
Add missing support for the "ret" typemap in a few target languages.
|
||||||
|
The documentation also now has info on the "ret" typemap.
|
||||||
|
|
||||||
|
2016-09-27: ahmed-usman
|
||||||
|
[xml] Handle template parameters correctly.
|
||||||
|
|
||||||
|
2016-09-27: dontpanic92
|
||||||
|
[Go] Fix argument names in inherited functions taking more than 8
|
||||||
|
parameters. Fixes #795.
|
||||||
|
|
||||||
|
2016-09-26: smarchetto
|
||||||
|
[Scilab] mlists that map pointers can be given a custom type name.
|
||||||
|
|
||||||
|
2016-09-25: wsfulton
|
||||||
|
Patch #793 from q-p to expand exception handling to include std::bad_cast
|
||||||
|
in std_except.i.
|
||||||
|
|
||||||
|
2016-09-24: olly
|
||||||
|
[PHP] Fix code generated for feature("director:except") -
|
||||||
|
previously the return value of call_user_function() was ignored and
|
||||||
|
we checked an uninitialised value instead. Fixes #627. Based on
|
||||||
|
patch from Sergey Seroshtan.
|
||||||
|
|
||||||
|
2016-09-22: wsfulton
|
||||||
|
[Python] More flexible python builtin slots for overloaded C++ function.
|
||||||
|
|
||||||
|
The closure names used for builtin slots are mangled with their functype so
|
||||||
|
that overloaded C++ method names can be used for multiple slots.
|
||||||
|
For example:
|
||||||
|
|
||||||
|
%feature("python:slot", "mp_subscript", functype="binaryfunc") SimpleArray::__getitem__;
|
||||||
|
%feature("python:slot", "sq_item", functype="ssizeargfunc") SimpleArray::__getitem__(Py_ssize_t n);
|
||||||
|
|
||||||
|
will generate closures:
|
||||||
|
|
||||||
|
SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___ssizeargfunc_closure */
|
||||||
|
SWIGPY_BINARYFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___binaryfunc_closure */
|
||||||
|
|
||||||
|
Previously only one name was defined: _wrap_SimpleArray___getitem___closure.
|
||||||
|
Hence the overloaded __getitem__ method can be used to support both mp_subscript and sq_item slots.
|
||||||
|
|
||||||
|
2016-09-17: wsfulton
|
||||||
|
[Python] Fix iterators for containers of NULL pointers (or Python None) when using
|
||||||
|
-builtin. Previously iteration would stop at the first element that was NULL.
|
||||||
|
|
||||||
|
2016-09-16: olly
|
||||||
|
[Javascript] Fix SWIG_exception() macro to return from the current
|
||||||
|
function. Fixes #789, reported by Julien Dutriaux.
|
||||||
|
|
||||||
|
2016-09-16: olly
|
||||||
|
[PHP] Fix SWIG_exception() macro to return from the current function.
|
||||||
|
Fixes #240, reported by Sergey Seroshtan.
|
||||||
|
|
||||||
|
2016-09-12: xypron
|
||||||
|
[C#] Patch #786 Keyword rename to be CLS compliant by adding an underscore
|
||||||
|
suffix instead of an underscore suffix to the C symbol name. Please use an explicit
|
||||||
|
%rename to rename the symbol with a _ prefix if you want the old symbol name.
|
||||||
|
|
||||||
|
*** POTENTIAL INCOMPATIBILITY ***
|
||||||
|
|
||||||
|
2016-09-09: olly
|
||||||
|
[Python] Fix import handling for Python 2.6 to work in a frozen
|
||||||
|
application. Fixes #145, reported by Thomas Kluyver.
|
||||||
|
|
||||||
|
2016-09-02: smarchetto
|
||||||
|
[Scilab] Pointers are mapped to mlist instead of tlist
|
||||||
|
(mlist better for scilab overloading)
|
||||||
|
|
||||||
|
2016-09-02: olly
|
||||||
|
[PHP] Fix "out" typemap for member function pointers and "in"
|
||||||
|
typemap for char INPUT[ANY].
|
||||||
|
|
||||||
|
2016-09-01: wsfulton
|
||||||
|
[Python] More efficient Python slicing.
|
||||||
|
Call reserve for container types that support it to avoid repeated
|
||||||
|
memory reallocations for new slices or slices that grow in size.
|
||||||
|
|
||||||
|
2016-09-01: wsfulton
|
||||||
|
[Python] #771 - Make builtin types hashable by default.
|
||||||
|
Default hash is the underlying C/C++ pointer. This matches up with testing for
|
||||||
|
equivalence (Py_EQ in SwigPyObject_richcompare) which compares the pointers.
|
||||||
|
|
||||||
|
2016-08-22: wsfulton
|
||||||
|
[Python] The following builtin slots can be customized like other slots via the
|
||||||
|
"python:<x>" and "python:slot" features where <x> is the appropriate slot name:
|
||||||
|
tp_allocs
|
||||||
|
tp_bases
|
||||||
|
tp_basicsize
|
||||||
|
tp_cache
|
||||||
|
tp_del
|
||||||
|
tp_dealloc
|
||||||
|
tp_flags
|
||||||
|
tp_frees
|
||||||
|
tp_getset
|
||||||
|
tp_is_gc
|
||||||
|
tp_maxalloc
|
||||||
|
tp_methods
|
||||||
|
tp_mro
|
||||||
|
tp_new
|
||||||
|
tp_next
|
||||||
|
tp_prev
|
||||||
|
tp_richcompare
|
||||||
|
tp_subclasses
|
||||||
|
tp_weaklist
|
||||||
|
was_sq_ass_slice
|
||||||
|
was_sq_slice
|
||||||
|
|
||||||
|
A few documentation improvements for slot customization.
|
||||||
|
|
||||||
|
2016-08-09: joequant
|
||||||
|
[R] Patch #765 Fix extern "C" header includes for C++ code.
|
||||||
|
|
||||||
2016-08-05: olly
|
2016-08-05: olly
|
||||||
[xml] Fix how the output filename is built to avoid problems when
|
[xml] Fix how the output filename is built to avoid problems when
|
||||||
it contains the embedded strings ".c", ".cpp" or ".cxx".
|
it contains the embedded strings ".c", ".cpp" or ".cxx".
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@
|
||||||
<li><a href="CPlusPlus11.html#CPlusPlus11_general_purpose_smart_pointers">General-purpose smart pointers</a>
|
<li><a href="CPlusPlus11.html#CPlusPlus11_general_purpose_smart_pointers">General-purpose smart pointers</a>
|
||||||
<li><a href="CPlusPlus11.html#CPlusPlus11_extensible_random_number_facility">Extensible random number facility</a>
|
<li><a href="CPlusPlus11.html#CPlusPlus11_extensible_random_number_facility">Extensible random number facility</a>
|
||||||
<li><a href="CPlusPlus11.html#CPlusPlus11_wrapper_reference">Wrapper reference</a>
|
<li><a href="CPlusPlus11.html#CPlusPlus11_wrapper_reference">Wrapper reference</a>
|
||||||
<li><a href="CPlusPlus11.html#CPlusPlus11_polymorphous_wrappers_for_function_objects">Polymorphous wrappers for function objects</a>
|
<li><a href="CPlusPlus11.html#CPlusPlus11_polymorphous_wrappers_for_function_objects">Polymorphic wrappers for function objects</a>
|
||||||
<li><a href="CPlusPlus11.html#CPlusPlus11_type_traits_for_metaprogramming">Type traits for metaprogramming</a>
|
<li><a href="CPlusPlus11.html#CPlusPlus11_type_traits_for_metaprogramming">Type traits for metaprogramming</a>
|
||||||
<li><a href="CPlusPlus11.html#CPlusPlus11_uniform_method_for_computing_return_type_of_function_objects">Uniform method for computing return type of function objects</a>
|
<li><a href="CPlusPlus11.html#CPlusPlus11_uniform_method_for_computing_return_type_of_function_objects">Uniform method for computing return type of function objects</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -457,6 +457,7 @@
|
||||||
<li><a href="Typemaps.html#Typemaps_nn32">"argout" typemap</a>
|
<li><a href="Typemaps.html#Typemaps_nn32">"argout" typemap</a>
|
||||||
<li><a href="Typemaps.html#Typemaps_nn33">"freearg" typemap</a>
|
<li><a href="Typemaps.html#Typemaps_nn33">"freearg" typemap</a>
|
||||||
<li><a href="Typemaps.html#Typemaps_nn34">"newfree" typemap</a>
|
<li><a href="Typemaps.html#Typemaps_nn34">"newfree" typemap</a>
|
||||||
|
<li><a href="Typemaps.html#Typemaps_ret">"ret" typemap</a>
|
||||||
<li><a href="Typemaps.html#Typemaps_nn35">"memberin" typemap</a>
|
<li><a href="Typemaps.html#Typemaps_nn35">"memberin" typemap</a>
|
||||||
<li><a href="Typemaps.html#Typemaps_nn36">"varin" typemap</a>
|
<li><a href="Typemaps.html#Typemaps_nn36">"varin" typemap</a>
|
||||||
<li><a href="Typemaps.html#Typemaps_nn37">"varout" typemap</a>
|
<li><a href="Typemaps.html#Typemaps_nn37">"varout" typemap</a>
|
||||||
|
|
@ -1529,7 +1530,7 @@
|
||||||
<li><a href="Python.html#Python_builtin_types">Built-in Types</a>
|
<li><a href="Python.html#Python_builtin_types">Built-in Types</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="Python.html#Python_builtin_limitations">Limitations</a>
|
<li><a href="Python.html#Python_builtin_limitations">Limitations</a>
|
||||||
<li><a href="Python.html#Python_builtin_overloads">Operator overloads -- use them!</a>
|
<li><a href="Python.html#Python_builtin_overloads">Operator overloads and slots -- use them!</a>
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="Python.html#Python_nn30">Memory management</a>
|
<li><a href="Python.html#Python_nn30">Memory management</a>
|
||||||
<li><a href="Python.html#Python_nn31">Python 2.2 and classic classes</a>
|
<li><a href="Python.html#Python_nn31">Python 2.2 and classic classes</a>
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
<li><a href="#Python_builtin_types">Built-in Types</a>
|
<li><a href="#Python_builtin_types">Built-in Types</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#Python_builtin_limitations">Limitations</a>
|
<li><a href="#Python_builtin_limitations">Limitations</a>
|
||||||
<li><a href="#Python_builtin_overloads">Operator overloads -- use them!</a>
|
<li><a href="#Python_builtin_overloads">Operator overloads and slots -- use them!</a>
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="#Python_nn30">Memory management</a>
|
<li><a href="#Python_nn30">Memory management</a>
|
||||||
<li><a href="#Python_nn31">Python 2.2 and classic classes</a>
|
<li><a href="#Python_nn31">Python 2.2 and classic classes</a>
|
||||||
|
|
@ -2442,7 +2442,7 @@ assert(issubclass(B.Derived, A.Base))
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<H4><a name="Python_builtin_overloads">36.4.2.2 Operator overloads -- use them!</a></H4>
|
<H4><a name="Python_builtin_overloads">36.4.2.2 Operator overloads and slots -- use them!</a></H4>
|
||||||
|
|
||||||
|
|
||||||
<p>The entire justification for the <tt>-builtin</tt> option is improved
|
<p>The entire justification for the <tt>-builtin</tt> option is improved
|
||||||
|
|
@ -2494,52 +2494,110 @@ automatically converted to python slot operators, refer to the file
|
||||||
<tt>python/pyopers.swig</tt> in the SWIG library.
|
<tt>python/pyopers.swig</tt> in the SWIG library.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>There are other very useful python slots that you
|
|
||||||
may explicitly define using <tt>%feature</tt> directives. For example,
|
<p>
|
||||||
suppose you want to use instances of a wrapped class as keys in a native python
|
Read about all of the available python slots here:
|
||||||
<tt>dict</tt>. That will work as long as you define a hash function for
|
<a href="http://docs.python.org/c-api/typeobj.html">http://docs.python.org/c-api/typeobj.html</a></p>
|
||||||
instances of your class, and use it to define the python <tt>tp_hash</tt>
|
|
||||||
slot:
|
<p>
|
||||||
|
There are two ways to define a python slot function: dispatch to a
|
||||||
|
statically defined function; or dispatch to a method defined on the
|
||||||
|
operand.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
To dispatch to a statically defined function, use %feature("python:<slot>"),
|
||||||
|
where <slot> is the name of a field in a <tt>PyTypeObject, PyNumberMethods,
|
||||||
|
PyMappingMethods, PySequenceMethods</tt> or <tt>PyBufferProcs</tt>.
|
||||||
|
You may override (almost) all of these slots.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Let's consider an example setting the <tt>tp_hash</tt> slot for the <tt>MyClass</tt> type.
|
||||||
|
This is akin to providing a <tt>__hash__</tt> method (for non-builtin types) to make a type hashable.
|
||||||
|
The hashable type can then for example be added to a Python <tt>dict</tt>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<pre>
|
<pre>
|
||||||
%feature("python:slot", "tp_hash", functype="hashfunc") Cheese::cheeseHashFunc;
|
%feature("python:tp_hash") MyClass "myHashFunc";
|
||||||
|
|
||||||
class Cheese {
|
class MyClass {
|
||||||
public:
|
public:
|
||||||
Cheese (const char *name);
|
long field1;
|
||||||
long cheeseHashFunc () const;
|
long field2;
|
||||||
|
...
|
||||||
|
};
|
||||||
|
|
||||||
|
%{
|
||||||
|
#if PY_VERSION_HEX >= 0x03020000
|
||||||
|
static Py_hash_t myHashFunc(PyObject *pyobj)
|
||||||
|
#else
|
||||||
|
static long myHashFunc(PyObject *pyobj)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
MyClass *cobj;
|
||||||
|
// Convert pyobj to cobj
|
||||||
|
return (cobj->field1 * (cobj->field2 << 7));
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you examine the generated code, the supplied hash function will now be
|
||||||
|
the function callback in the tp_hash slot for the builtin type for <tt>MyClass</tt>:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
static PyHeapTypeObject SwigPyBuiltin__MyClass_type = {
|
||||||
|
...
|
||||||
|
(hashfunc) myHashFunc, /* tp_hash */
|
||||||
|
...
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
NOTE: It is the responsibility of the programmer (that's you!) to ensure
|
||||||
|
that a statically defined slot function has the correct signature, the <tt>hashfunc</tt>
|
||||||
|
typedef in this case.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If, instead, you want to dispatch to an instance method, you can
|
||||||
|
use %feature("python:slot"). For example:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%feature("python:slot", "tp_hash", functype="hashfunc") MyClass::myHashFunc;
|
||||||
|
|
||||||
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
|
#define Py_hash_t long
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class MyClass {
|
||||||
|
public:
|
||||||
|
Py_hash_t myHashFunc() const;
|
||||||
|
...
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>This will allow you to write python code like this:</p>
|
<p>
|
||||||
|
NOTE: Some python slots use a method signature which does not
|
||||||
|
match the signature of SWIG-wrapped methods. For those slots,
|
||||||
|
SWIG will automatically generate a "closure" function to re-marshal
|
||||||
|
the arguments before dispatching to the wrapped method. Setting
|
||||||
|
the "functype" attribute of the feature enables SWIG to generate
|
||||||
|
the chosen closure function.
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="targetlang">
|
<p>
|
||||||
<pre>
|
There is further information on <tt>%feature("python:slot")</tt>
|
||||||
from my MyPackage import Cheese
|
|
||||||
|
|
||||||
inventory = {
|
|
||||||
Cheese("cheddar") : 0,
|
|
||||||
Cheese("gouda") : 0,
|
|
||||||
Cheese("camembert") : 0
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>Because you defined the <tt>tp_hash</tt> slot, <tt>Cheese</tt> objects may
|
|
||||||
be used as hash keys; and when the <tt>cheeseHashFunc</tt> method is invoked
|
|
||||||
by a python <tt>dict</tt>, it will <b>not</b> go through named method dispatch.
|
|
||||||
A more detailed discussion about <tt>%feature("python:slot")</tt> can be found
|
|
||||||
in the file <tt>python/pyopers.swig</tt> in the SWIG library.
|
in the file <tt>python/pyopers.swig</tt> in the SWIG library.
|
||||||
You can read about all of the available python slots here:</p>
|
|
||||||
|
|
||||||
<p><a href="http://docs.python.org/c-api/typeobj.html">http://docs.python.org/c-api/typeobj.html</a></p>
|
|
||||||
|
|
||||||
<p>You may override (almost) all of the slots defined in the <tt>PyTypeObject,
|
|
||||||
PyNumberMethods, PyMappingMethods, PySequenceMethods</tt>, and <tt>PyBufferProcs</tt>
|
|
||||||
structs.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1123,7 +1123,7 @@ But we can use either use the <tt>get_perimeter()</tt> function of the parent cl
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
As explained in <a href="http://www.swig.org/Doc3.0/SWIGPlus.html#SWIGPlus_overloaded_methods">6.15</a> SWIG provides support for overloaded functions and constructors.
|
As explained in <a href="SWIGPlus.html#SWIGPlus_overloaded_methods">6.15</a> SWIG provides support for overloaded functions and constructors.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>As SWIG knows pointer types, the overloading works also with pointer types, here is is an example with a function <tt>magnify</tt> overloaded for the previous classes <tt>Shape</tt> and <tt>Circle</tt>:
|
<p>As SWIG knows pointer types, the overloading works also with pointer types, here is is an example with a function <tt>magnify</tt> overloaded for the previous classes <tt>Shape</tt> and <tt>Circle</tt>:
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@
|
||||||
<li><a href="#Typemaps_nn32">"argout" typemap</a>
|
<li><a href="#Typemaps_nn32">"argout" typemap</a>
|
||||||
<li><a href="#Typemaps_nn33">"freearg" typemap</a>
|
<li><a href="#Typemaps_nn33">"freearg" typemap</a>
|
||||||
<li><a href="#Typemaps_nn34">"newfree" typemap</a>
|
<li><a href="#Typemaps_nn34">"newfree" typemap</a>
|
||||||
|
<li><a href="#Typemaps_ret">"ret" typemap</a>
|
||||||
<li><a href="#Typemaps_nn35">"memberin" typemap</a>
|
<li><a href="#Typemaps_nn35">"memberin" typemap</a>
|
||||||
<li><a href="#Typemaps_nn36">"varin" typemap</a>
|
<li><a href="#Typemaps_nn36">"varin" typemap</a>
|
||||||
<li><a href="#Typemaps_nn37">"varout" typemap</a>
|
<li><a href="#Typemaps_nn37">"varout" typemap</a>
|
||||||
|
|
@ -2802,7 +2803,46 @@ string *foo();
|
||||||
See <a href="Customization.html#Customization_ownership">Object ownership and %newobject</a> for further details.
|
See <a href="Customization.html#Customization_ownership">Object ownership and %newobject</a> for further details.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H3><a name="Typemaps_nn35">11.5.10 "memberin" typemap</a></H3>
|
<H3><a name="Typemaps_ret">11.5.10 "ret" typemap</a></H3>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The "ret" typemap is not used very often, but can be useful for anything associated with
|
||||||
|
the return type, such as resource management, return value error checking, etc.
|
||||||
|
Usually this can all be done in the "out" typemap, but sometimes it is handy to use the
|
||||||
|
"out" typemap code untouched and add to the generated code using the code in the "ret" typemap.
|
||||||
|
One such case is memory clean up. For example, a <tt>stringheap_t</tt> type is defined indicating
|
||||||
|
that the returned memory must be deleted and a <tt>string_t</tt> type is defined indicating
|
||||||
|
that the returned memory must not be deleted.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%typemap(ret) stringheap_t %{
|
||||||
|
free($1);
|
||||||
|
%}
|
||||||
|
|
||||||
|
typedef char * string_t;
|
||||||
|
typedef char * stringheap_t;
|
||||||
|
|
||||||
|
string_t MakeString1();
|
||||||
|
stringheap_t MakeString2();
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The "ret" typemap above will only be used for <tt>MakeString2</tt>, but both functions
|
||||||
|
will use the default "out" typemap for <tt>char *</tt> provided by SWIG.
|
||||||
|
The code above would ensure the appropriate memory is freed in all target languages as the need
|
||||||
|
to provide custom "out" typemaps (which involve target language specific code) is not necessary.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This approach is an alternative to using the "newfree" typemap and <tt>%newobject</tt> as there
|
||||||
|
is no need to list all the functions that require the memory cleanup, it is purely done on types.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<H3><a name="Typemaps_nn35">11.5.11 "memberin" typemap</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -2824,7 +2864,7 @@ It is rarely necessary to write "memberin" typemaps---SWIG already provides
|
||||||
a default implementation for arrays, strings, and other objects.
|
a default implementation for arrays, strings, and other objects.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H3><a name="Typemaps_nn36">11.5.11 "varin" typemap</a></H3>
|
<H3><a name="Typemaps_nn36">11.5.12 "varin" typemap</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -2832,7 +2872,7 @@ The "varin" typemap is used to convert objects in the target language to C for t
|
||||||
purposes of assigning to a C/C++ global variable. This is implementation specific.
|
purposes of assigning to a C/C++ global variable. This is implementation specific.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H3><a name="Typemaps_nn37">11.5.12 "varout" typemap</a></H3>
|
<H3><a name="Typemaps_nn37">11.5.13 "varout" typemap</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -2840,7 +2880,7 @@ The "varout" typemap is used to convert a C/C++ object to an object in the targe
|
||||||
language when reading a C/C++ global variable. This is implementation specific.
|
language when reading a C/C++ global variable. This is implementation specific.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H3><a name="throws_typemap">11.5.13 "throws" typemap</a></H3>
|
<H3><a name="throws_typemap">11.5.14 "throws" typemap</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -389,6 +389,7 @@ CPP_TEST_CASES += \
|
||||||
string_constants \
|
string_constants \
|
||||||
struct_initialization_cpp \
|
struct_initialization_cpp \
|
||||||
struct_value \
|
struct_value \
|
||||||
|
swig_exception \
|
||||||
symbol_clash \
|
symbol_clash \
|
||||||
template_arg_replace \
|
template_arg_replace \
|
||||||
template_arg_scope \
|
template_arg_scope \
|
||||||
|
|
@ -519,6 +520,7 @@ CPP_TEST_CASES += \
|
||||||
valuewrapper_opaque \
|
valuewrapper_opaque \
|
||||||
varargs \
|
varargs \
|
||||||
varargs_overload \
|
varargs_overload \
|
||||||
|
variable_replacement \
|
||||||
virtual_destructor \
|
virtual_destructor \
|
||||||
virtual_poly \
|
virtual_poly \
|
||||||
virtual_vs_nonvirtual_base \
|
virtual_vs_nonvirtual_base \
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ public class li_std_except_runme {
|
||||||
|
|
||||||
public static void Main() {
|
public static void Main() {
|
||||||
Test test = new Test();
|
Test test = new Test();
|
||||||
|
try { test.throw_bad_cast(); throw new Exception("throw_bad_cast failed"); } catch (InvalidCastException) {}
|
||||||
try { test.throw_bad_exception(); throw new Exception("throw_bad_exception failed"); } catch (ApplicationException) {}
|
try { test.throw_bad_exception(); throw new Exception("throw_bad_exception failed"); } catch (ApplicationException) {}
|
||||||
try { test.throw_domain_error(); throw new Exception("throw_domain_error failed"); } catch (ApplicationException) {}
|
try { test.throw_domain_error(); throw new Exception("throw_domain_error failed"); } catch (ApplicationException) {}
|
||||||
try { test.throw_exception(); throw new Exception("throw_exception failed"); } catch (ApplicationException) {}
|
try { test.throw_exception(); throw new Exception("throw_exception failed"); } catch (ApplicationException) {}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,21 @@ class DirectorMethodException: public Swig::DirectorException {};
|
||||||
|
|
||||||
%include "std_string.i"
|
%include "std_string.i"
|
||||||
|
|
||||||
|
#ifdef SWIGPHP
|
||||||
|
|
||||||
|
%feature("director:except") {
|
||||||
|
if ($error == FAILURE) {
|
||||||
|
throw Swig::DirectorMethodException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%exception {
|
||||||
|
try { $action }
|
||||||
|
catch (Swig::DirectorException &) { SWIG_fail; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SWIGPYTHON
|
#ifdef SWIGPYTHON
|
||||||
|
|
||||||
%feature("director:except") {
|
%feature("director:except") {
|
||||||
|
|
|
||||||
30
Examples/test-suite/javascript/swig_exception_runme.js
Normal file
30
Examples/test-suite/javascript/swig_exception_runme.js
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
var swig_exception = require("swig_exception");
|
||||||
|
|
||||||
|
var c = new swig_exception.Circle(10);
|
||||||
|
var s = new swig_exception.Square(10);
|
||||||
|
|
||||||
|
if (swig_exception.Shape.nshapes != 2) {
|
||||||
|
throw "Shape.nshapes should be 2, actually " + swig_exception.Shape.nshapes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----- Throw exception -----
|
||||||
|
try {
|
||||||
|
c.throwException();
|
||||||
|
throw "Exception wasn't thrown";
|
||||||
|
} catch (e) {
|
||||||
|
if (e.message != "OK") {
|
||||||
|
throw "Exception message should be \"OK\", actually \"" + e.message + "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----- Delete everything -----
|
||||||
|
|
||||||
|
c = null;
|
||||||
|
s = null;
|
||||||
|
e = null;
|
||||||
|
|
||||||
|
/* FIXME: Garbage collection needs to happen before this check will work.
|
||||||
|
if (swig_exception.Shape.nshapes != 0) {
|
||||||
|
throw "Shape.nshapes should be 0, actually " + swig_exception.Shape.nshapes;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
int foo3() throw(E1) { return 0; }
|
int foo3() throw(E1) { return 0; }
|
||||||
int foo4() throw(E2) { return 0; }
|
int foo4() throw(E2) { return 0; }
|
||||||
// all the STL exceptions...
|
// all the STL exceptions...
|
||||||
|
void throw_bad_cast() throw(std::bad_cast) { throw std::bad_cast(); }
|
||||||
void throw_bad_exception() throw(std::bad_exception) { throw std::bad_exception(); }
|
void throw_bad_exception() throw(std::bad_exception) { throw std::bad_exception(); }
|
||||||
void throw_domain_error() throw(std::domain_error) { throw std::domain_error("oops"); }
|
void throw_domain_error() throw(std::domain_error) { throw std::domain_error("oops"); }
|
||||||
void throw_exception() throw(std::exception) { throw std::exception(); }
|
void throw_exception() throw(std::exception) { throw std::exception(); }
|
||||||
|
|
|
||||||
20
Examples/test-suite/php/cpp_basic_runme.php
Normal file
20
Examples/test-suite/php/cpp_basic_runme.php
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require "tests.php";
|
||||||
|
require "cpp_basic.php";
|
||||||
|
|
||||||
|
// New functions
|
||||||
|
check::functions(array(foo_func1,foo_func2,foo___str__,foosubsub___str__,bar_test,bar_testfoo,get_func1_ptr,get_func2_ptr,test_func_ptr,fl_window_show));
|
||||||
|
// New classes
|
||||||
|
check::classes(array(cpp_basic,Foo,FooSub,FooSubSub,Bar,Fl_Window));
|
||||||
|
// New vars
|
||||||
|
check::globals(array(foo_num,foo_func_ptr,bar_fptr,bar_fref,bar_fval,bar_cint,bar_global_fptr,bar_global_fref,bar_global_fval));
|
||||||
|
|
||||||
|
$f = new Foo(3);
|
||||||
|
$f->func_ptr = get_func1_ptr();
|
||||||
|
check::equal(test_func_ptr($f, 7), 2*7*3, "get_func1_ptr() didn't work");
|
||||||
|
$f->func_ptr = get_func2_ptr();
|
||||||
|
check::equal(test_func_ptr($f, 7), -7*3, "get_func2_ptr() didn't work");
|
||||||
|
|
||||||
|
check::done();
|
||||||
|
?>
|
||||||
33
Examples/test-suite/php/swig_exception_runme.php
Normal file
33
Examples/test-suite/php/swig_exception_runme.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require("swig_exception.php");
|
||||||
|
require("tests.php");
|
||||||
|
|
||||||
|
$c = new Circle(10);
|
||||||
|
$s = new Square(10);
|
||||||
|
|
||||||
|
if (Shape::nshapes() != 2) {
|
||||||
|
check::fail("Shape::nshapes() should be 2, actually ".Shape::nshapes());
|
||||||
|
}
|
||||||
|
|
||||||
|
# ----- Throw exception -----
|
||||||
|
try {
|
||||||
|
$c->throwException();
|
||||||
|
check::fail("Exception wasn't thrown");
|
||||||
|
} catch (Exception $e) {
|
||||||
|
if ($e->getMessage() != "OK") {
|
||||||
|
check::fail("Exception getMessage() should be \"OK\", actually \"".$e->getMessage()."\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ----- Delete everything -----
|
||||||
|
|
||||||
|
$c = NULL;
|
||||||
|
$s = NULL;
|
||||||
|
$e = NULL;
|
||||||
|
|
||||||
|
if (Shape::nshapes() != 0) {
|
||||||
|
check::fail("Shape::nshapes() should be 0, actually ".Shape::nshapes());
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -35,8 +35,9 @@ class check {
|
||||||
foreach($_original_functions[internal] as $func) unset($df[$func]);
|
foreach($_original_functions[internal] as $func) unset($df[$func]);
|
||||||
// Now chop out any get/set accessors
|
// Now chop out any get/set accessors
|
||||||
foreach(array_keys($df) as $func)
|
foreach(array_keys($df) as $func)
|
||||||
if ((GETSET && ereg('_[gs]et$',$func)) || ereg('^new_', $func)
|
if ((GETSET && preg_match('/_[gs]et$/', $func)) ||
|
||||||
|| ereg('_(alter|get)_newobject$', $func))
|
preg_match('/^new_/', $func) ||
|
||||||
|
preg_match('/_(alter|get)_newobject$/', $func))
|
||||||
$extrags[]=$func;
|
$extrags[]=$func;
|
||||||
else $extra[]=$func;
|
else $extra[]=$func;
|
||||||
// $extra=array_keys($df);
|
// $extra=array_keys($df);
|
||||||
|
|
@ -52,7 +53,8 @@ class check {
|
||||||
if (GETSET) {
|
if (GETSET) {
|
||||||
$_extra=array();
|
$_extra=array();
|
||||||
foreach(check::get_extra_functions(false,1) as $global) {
|
foreach(check::get_extra_functions(false,1) as $global) {
|
||||||
if (ereg('^(.*)_[sg]et$',$global,$match)) $_extra[$match[1]]=1;
|
if (preg_match('/^(.*)_[sg]et$/', $global, $match))
|
||||||
|
$_extra[$match[1]] = 1;
|
||||||
}
|
}
|
||||||
$extra=array_keys($_extra);
|
$extra=array_keys($_extra);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -61,7 +63,8 @@ class check {
|
||||||
$df=array_flip(array_keys($GLOBALS));
|
$df=array_flip(array_keys($GLOBALS));
|
||||||
foreach($_original_globals as $func) unset($df[$func]);
|
foreach($_original_globals as $func) unset($df[$func]);
|
||||||
// MASK xxxx_LOADED__ variables
|
// MASK xxxx_LOADED__ variables
|
||||||
foreach(array_keys($df) as $func) if (ereg('_LOADED__$',$func)) unset($df[$func]);
|
foreach(array_keys($df) as $func)
|
||||||
|
if (preg_match('/_LOADED__$/', $func)) unset($df[$func]);
|
||||||
$extra=array_keys($df);
|
$extra=array_keys($df);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +188,8 @@ class check {
|
||||||
}
|
}
|
||||||
|
|
||||||
function functionref($a,$type,$message) {
|
function functionref($a,$type,$message) {
|
||||||
if (! eregi("^_[a-f0-9]+$type$",$a)) return check::fail($message);
|
if (! preg_match("/^_[a-f0-9]+$type$/i", $a))
|
||||||
|
return check::fail($message);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,7 +200,8 @@ class check {
|
||||||
|
|
||||||
function resource($a,$b,$message) {
|
function resource($a,$b,$message) {
|
||||||
$resource=trim(check::var_dump($a));
|
$resource=trim(check::var_dump($a));
|
||||||
if (! eregi("^resource\([0-9]+\) of type \($b\)",$resource)) return check::fail($message);
|
if (! preg_match("/^resource\([0-9]+\) of type \($b\)/i", $resource))
|
||||||
|
return check::fail($message);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ CPP_TEST_CASES += \
|
||||||
primitive_types \
|
primitive_types \
|
||||||
python_abstractbase \
|
python_abstractbase \
|
||||||
python_append \
|
python_append \
|
||||||
|
python_builtin \
|
||||||
python_destructor_exception \
|
python_destructor_exception \
|
||||||
python_director \
|
python_director \
|
||||||
python_docstring \
|
python_docstring \
|
||||||
|
|
|
||||||
|
|
@ -36,3 +36,21 @@ try:
|
||||||
raise RuntimeError("missed exception")
|
raise RuntimeError("missed exception")
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
b111 = makeB(111)
|
||||||
|
bNones = BPtrVector([None, b111, None])
|
||||||
|
|
||||||
|
bCount = 0
|
||||||
|
noneCount = 0
|
||||||
|
for b in bNones:
|
||||||
|
if b == None:
|
||||||
|
noneCount = noneCount + 1
|
||||||
|
else:
|
||||||
|
if b.val != 111:
|
||||||
|
raise RuntimeError("b.val is wrong")
|
||||||
|
bCount = bCount + 1
|
||||||
|
|
||||||
|
if bCount != 1:
|
||||||
|
raise RuntimeError("bCount wrong")
|
||||||
|
if noneCount != 2:
|
||||||
|
raise RuntimeError("noneCount wrong")
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,9 @@ from li_std_vector import *
|
||||||
|
|
||||||
if typedef_test(101) != 101:
|
if typedef_test(101) != 101:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
try:
|
||||||
|
sv = StructVector([None, None])
|
||||||
|
raise RuntimeError("Using None should result in a TypeError")
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
|
||||||
94
Examples/test-suite/python/python_builtin_runme.py
Normal file
94
Examples/test-suite/python/python_builtin_runme.py
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
from python_builtin import *
|
||||||
|
|
||||||
|
if is_python_builtin():
|
||||||
|
# Test 0 for default tp_hash
|
||||||
|
vs = ValueStruct(1234)
|
||||||
|
h = hash(vs)
|
||||||
|
d = dict()
|
||||||
|
d[h] = "hi"
|
||||||
|
if h not in d:
|
||||||
|
raise RuntimeError("h should be in d")
|
||||||
|
h2 = hash(ValueStruct.inout(vs))
|
||||||
|
if h != h2:
|
||||||
|
raise RuntimeError("default tp_hash not working")
|
||||||
|
|
||||||
|
# Test 1 for tp_hash
|
||||||
|
if hash(SimpleValue(222)) != 222:
|
||||||
|
raise RuntimeError("tp_hash not working")
|
||||||
|
|
||||||
|
# Test 2 for tp_hash
|
||||||
|
try:
|
||||||
|
# Was incorrectly raising: SystemError: error return without exception set
|
||||||
|
h = hash(BadHashFunctionReturnType())
|
||||||
|
raise RuntimeError("Missing TypeError")
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Test 3 for tp_hash
|
||||||
|
passed = False
|
||||||
|
try:
|
||||||
|
h = hash(ExceptionHashFunction())
|
||||||
|
except RuntimeError, e:
|
||||||
|
passed = str(e).find("oops") != -1
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not passed:
|
||||||
|
raise RuntimeError("did not catch exception in hash()")
|
||||||
|
|
||||||
|
# Test 4 for tp_dealloc (which is handled differently to other slots in the SWIG source)
|
||||||
|
d = Dealloc1()
|
||||||
|
if cvar.Dealloc1CalledCount != 0:
|
||||||
|
raise RuntimeError("count should be 0")
|
||||||
|
del d
|
||||||
|
if cvar.Dealloc1CalledCount != 1:
|
||||||
|
raise RuntimeError("count should be 1")
|
||||||
|
|
||||||
|
d = Dealloc2()
|
||||||
|
if cvar.Dealloc2CalledCount != 0:
|
||||||
|
raise RuntimeError("count should be 0")
|
||||||
|
del d
|
||||||
|
if cvar.Dealloc2CalledCount != 1:
|
||||||
|
raise RuntimeError("count should be 1")
|
||||||
|
|
||||||
|
d = Dealloc3()
|
||||||
|
if cvar.Dealloc3CalledCount != 0:
|
||||||
|
raise RuntimeError("count should be 0")
|
||||||
|
del d
|
||||||
|
if cvar.Dealloc3CalledCount != 1:
|
||||||
|
raise RuntimeError("count should be 1")
|
||||||
|
|
||||||
|
# Test 5 for python:compare feature
|
||||||
|
m10 = MyClass(10)
|
||||||
|
m20 = MyClass(20)
|
||||||
|
m15 = MyClass(15)
|
||||||
|
|
||||||
|
if not m10 < m15:
|
||||||
|
raise RuntimeError("m10 < m15")
|
||||||
|
if not m10 < m20:
|
||||||
|
raise RuntimeError("m10 < m20")
|
||||||
|
if not m15 < m20:
|
||||||
|
raise RuntimeError("m15 < m20")
|
||||||
|
|
||||||
|
if m10 > m15:
|
||||||
|
raise RuntimeError("m10 > m15")
|
||||||
|
if m10 > m20:
|
||||||
|
raise RuntimeError("m10 > m20")
|
||||||
|
if m15 > m20:
|
||||||
|
raise RuntimeError("m15 > m20")
|
||||||
|
|
||||||
|
if MyClass.less_than_counts != 6:
|
||||||
|
raise RuntimeError("python:compare feature not working")
|
||||||
|
|
||||||
|
sa = SimpleArray(5)
|
||||||
|
elements = [x for x in sa]
|
||||||
|
if elements != [0, 10, 20, 30, 40]:
|
||||||
|
raise RuntimeError("Iteration not working")
|
||||||
|
if len(sa) != 5:
|
||||||
|
raise RuntimeError("len not working")
|
||||||
|
for i in range(5):
|
||||||
|
if sa[i] != i*10:
|
||||||
|
raise RuntimeError("indexing not working")
|
||||||
|
subslice = sa[1:3]
|
||||||
|
elements = [x for x in subslice]
|
||||||
|
if elements != [10, 20]:
|
||||||
|
raise RuntimeError("slice not working")
|
||||||
201
Examples/test-suite/python_builtin.i
Normal file
201
Examples/test-suite/python_builtin.i
Normal file
|
|
@ -0,0 +1,201 @@
|
||||||
|
// Test customizing slots when using the -builtin option
|
||||||
|
|
||||||
|
%module python_builtin
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
#ifdef SWIGPYTHON_BUILTIN
|
||||||
|
bool is_python_builtin() { return true; }
|
||||||
|
#else
|
||||||
|
bool is_python_builtin() { return false; }
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
|
// Test 0 for default tp_hash
|
||||||
|
%inline %{
|
||||||
|
struct ValueStruct {
|
||||||
|
int value;
|
||||||
|
ValueStruct(int value) : value(value) {}
|
||||||
|
static ValueStruct *inout(ValueStruct *v) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
// Test 1 for tp_hash
|
||||||
|
#if defined(SWIGPYTHON_BUILTIN)
|
||||||
|
%feature("python:tp_hash") SimpleValue "SimpleValueHashFunction"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
struct SimpleValue {
|
||||||
|
int value;
|
||||||
|
SimpleValue(int value) : value(value) {}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
%{
|
||||||
|
#if PY_VERSION_HEX >= 0x03020000
|
||||||
|
Py_hash_t SimpleValueHashFunction(PyObject *v)
|
||||||
|
#else
|
||||||
|
long SimpleValueHashFunction(PyObject *v)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||||
|
SimpleValue *p = (SimpleValue *)sobj->ptr;
|
||||||
|
return p->value;
|
||||||
|
}
|
||||||
|
hashfunc test_hashfunc_cast() {
|
||||||
|
return SimpleValueHashFunction;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
// Test 2 for tp_hash
|
||||||
|
#if defined(SWIGPYTHON_BUILTIN)
|
||||||
|
%feature("python:slot", "tp_hash", functype="hashfunc") BadHashFunctionReturnType::bad_hash_function;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
struct BadHashFunctionReturnType {
|
||||||
|
static const char * bad_hash_function() {
|
||||||
|
return "bad hash function";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
// Test 3 for tp_hash
|
||||||
|
#if defined(SWIGPYTHON_BUILTIN)
|
||||||
|
%feature("python:slot", "tp_hash", functype="hashfunc") ExceptionHashFunction::exception_hash_function;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
%catches(const char *) exception_hash_function;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
|
#define Py_hash_t long
|
||||||
|
#endif
|
||||||
|
struct ExceptionHashFunction {
|
||||||
|
static Py_hash_t exception_hash_function() {
|
||||||
|
throw "oops";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
// Test 4 for tp_dealloc (which is handled differently to other slots in the SWIG source)
|
||||||
|
#if defined(SWIGPYTHON_BUILTIN)
|
||||||
|
%feature("python:tp_dealloc") Dealloc1 "Dealloc1Destroyer"
|
||||||
|
%feature("python:tp_dealloc") Dealloc2 "Dealloc2Destroyer"
|
||||||
|
%feature("python:slot", "tp_dealloc", functype="destructor") Dealloc3::Destroyer;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
static int Dealloc1CalledCount = 0;
|
||||||
|
static int Dealloc2CalledCount = 0;
|
||||||
|
static int Dealloc3CalledCount = 0;
|
||||||
|
|
||||||
|
struct Dealloc1 {
|
||||||
|
};
|
||||||
|
struct Dealloc2 {
|
||||||
|
~Dealloc2() {}
|
||||||
|
};
|
||||||
|
struct Dealloc3 {
|
||||||
|
void Destroyer() {
|
||||||
|
Dealloc3CalledCount++;
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
%{
|
||||||
|
void Dealloc1Destroyer(PyObject *v) {
|
||||||
|
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||||
|
Dealloc1 *p = (Dealloc1 *)sobj->ptr;
|
||||||
|
delete p;
|
||||||
|
Dealloc1CalledCount++;
|
||||||
|
}
|
||||||
|
void Dealloc2Destroyer(PyObject *v) {
|
||||||
|
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||||
|
Dealloc2 *p = (Dealloc2 *)sobj->ptr;
|
||||||
|
delete p;
|
||||||
|
Dealloc2CalledCount++;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
// Test 5 for python:compare feature
|
||||||
|
%feature("python:compare", "Py_LT") MyClass::lessThan;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
class MyClass {
|
||||||
|
public:
|
||||||
|
MyClass(int val = 0) : val(val) {}
|
||||||
|
bool lessThan(const MyClass& other) const {
|
||||||
|
less_than_counts++;
|
||||||
|
return val < other.val;
|
||||||
|
}
|
||||||
|
int val;
|
||||||
|
static int less_than_counts;
|
||||||
|
};
|
||||||
|
int MyClass::less_than_counts = 0;
|
||||||
|
%}
|
||||||
|
|
||||||
|
// Test 6 add in container __getitem__ to support basic sequence protocol
|
||||||
|
// Tests overloaded functions being used for more than one slot (mp_subscript and sq_item)
|
||||||
|
%include <exception.i>
|
||||||
|
%include <std_except.i>
|
||||||
|
%apply int {Py_ssize_t}
|
||||||
|
%typemap(in) PySliceObject * {
|
||||||
|
if (!PySlice_Check($input))
|
||||||
|
SWIG_exception(SWIG_TypeError, "in method '$symname', argument $argnum of type '$type'");
|
||||||
|
$1 = (PySliceObject *)$input;
|
||||||
|
}
|
||||||
|
%typemap(typecheck,precedence=300) PySliceObject* {
|
||||||
|
$1 = PySlice_Check($input);
|
||||||
|
}
|
||||||
|
|
||||||
|
%feature("python:slot", "mp_subscript", functype="binaryfunc") SimpleArray::__getitem__(PySliceObject *slice);
|
||||||
|
%feature("python:slot", "sq_item", functype="ssizeargfunc") SimpleArray::__getitem__(Py_ssize_t n);
|
||||||
|
%feature("python:slot", "sq_length", functype="lenfunc") SimpleArray::__len__;
|
||||||
|
%inline %{
|
||||||
|
class SimpleArray {
|
||||||
|
size_t size;
|
||||||
|
int numbers[5];
|
||||||
|
public:
|
||||||
|
SimpleArray(size_t size) : size(size) {
|
||||||
|
for (size_t x = 0; x<size; ++x)
|
||||||
|
numbers[x] = x*10;
|
||||||
|
}
|
||||||
|
|
||||||
|
Py_ssize_t __len__() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __getitem__(Py_ssize_t n) throw (std::out_of_range) {
|
||||||
|
if (n >= (int)size)
|
||||||
|
throw std::out_of_range("Index too large");
|
||||||
|
return numbers[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleArray __getitem__(PySliceObject *slice) throw (std::out_of_range, std::invalid_argument) {
|
||||||
|
if (!PySlice_Check(slice))
|
||||||
|
throw std::invalid_argument("Slice object expected");
|
||||||
|
Py_ssize_t i, j, step;
|
||||||
|
#if PY_VERSION_HEX >= 0x03020000
|
||||||
|
PySlice_GetIndices((PyObject *)slice, size, &i, &j, &step);
|
||||||
|
#else
|
||||||
|
PySlice_GetIndices((PySliceObject *)slice, size, &i, &j, &step);
|
||||||
|
#endif
|
||||||
|
if (step != 1)
|
||||||
|
throw std::invalid_argument("Only a step size of 1 is implemented");
|
||||||
|
|
||||||
|
{
|
||||||
|
Py_ssize_t ii = i<0 ? 0 : i>=size ? size-1 : i;
|
||||||
|
Py_ssize_t jj = j<0 ? 0 : j>=size ? size-1 : j;
|
||||||
|
if (ii > jj)
|
||||||
|
throw std::invalid_argument("getitem i should not be larger than j");
|
||||||
|
SimpleArray n(jj-ii);
|
||||||
|
for (size_t x = 0; x<size; ++x)
|
||||||
|
n.numbers[x] = numbers[x+ii];
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
91
Examples/test-suite/swig_exception.i
Normal file
91
Examples/test-suite/swig_exception.i
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
/* File : swig_exception.i
|
||||||
|
* Test SWIG_exception().
|
||||||
|
*/
|
||||||
|
%module swig_exception
|
||||||
|
|
||||||
|
%include exception.i
|
||||||
|
|
||||||
|
%exception {
|
||||||
|
try {
|
||||||
|
$action
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
SWIG_exception(SWIG_SystemError, e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
class Value {
|
||||||
|
int a_;
|
||||||
|
int b_;
|
||||||
|
public:
|
||||||
|
Value(int a, int b) : a_(a), b_(b) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Shape {
|
||||||
|
public:
|
||||||
|
Shape() {
|
||||||
|
nshapes++;
|
||||||
|
}
|
||||||
|
virtual ~Shape() {
|
||||||
|
nshapes--;
|
||||||
|
}
|
||||||
|
double x, y;
|
||||||
|
void move(double dx, double dy);
|
||||||
|
virtual double area() = 0;
|
||||||
|
virtual double perimeter() = 0;
|
||||||
|
virtual Value throwException();
|
||||||
|
static int nshapes;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Circle : public Shape {
|
||||||
|
private:
|
||||||
|
double radius;
|
||||||
|
public:
|
||||||
|
Circle(double r) : radius(r) { }
|
||||||
|
virtual double area();
|
||||||
|
virtual double perimeter();
|
||||||
|
};
|
||||||
|
|
||||||
|
class Square : public Shape {
|
||||||
|
private:
|
||||||
|
double width;
|
||||||
|
public:
|
||||||
|
Square(double w) : width(w) { }
|
||||||
|
virtual double area();
|
||||||
|
virtual double perimeter();
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
%{
|
||||||
|
#define PI 3.14159265358979323846
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
/* Move the shape to a new location */
|
||||||
|
void Shape::move(double dx, double dy) {
|
||||||
|
x += dx;
|
||||||
|
y += dy;
|
||||||
|
}
|
||||||
|
|
||||||
|
Value Shape::throwException() {
|
||||||
|
throw std::logic_error("OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
int Shape::nshapes = 0;
|
||||||
|
|
||||||
|
double Circle::area() {
|
||||||
|
return PI*radius*radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Circle::perimeter() {
|
||||||
|
return 2*PI*radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Square::area() {
|
||||||
|
return width*width;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Square::perimeter() {
|
||||||
|
return 4*width;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
@ -25,23 +25,33 @@ void foo1(Foo<int> f, const Foo<int>& ff) {}
|
||||||
void foo2(Foo<short> f, const Foo<short>& ff) {}
|
void foo2(Foo<short> f, const Foo<short>& ff) {}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
#ifdef SWIGUTL
|
// Check "ret" typemap is implemented
|
||||||
%typemap(ret) int Bar1::foo() { /* hello1 */ };
|
%{
|
||||||
%typemap(ret) int Bar2::foo() { /* hello2 */ };
|
template<typename T> struct NeededForTest {};
|
||||||
%typemap(ret) int foo() {/* hello3 */ };
|
%}
|
||||||
#endif
|
%fragment("NeededForTest", "header") %{
|
||||||
|
template<> struct NeededForTest<short> { NeededForTest(short) {} };
|
||||||
|
%}
|
||||||
|
|
||||||
|
%typemap(ret) short "_ret_typemap_for_short_no_compile"
|
||||||
|
%typemap(ret, fragment="NeededForTest") short Bar1::foofunction() { /* ret typemap for short */ NeededForTest<short> needed($1); };
|
||||||
|
%typemap(ret, fragment="NeededForTest") short globalfoofunction() { /* ret typemap for short */ NeededForTest<short> needed($1); };
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
struct Bar1 {
|
struct Bar1 {
|
||||||
int foo() { return 1;}
|
short foofunction() { return 1;}
|
||||||
};
|
|
||||||
|
|
||||||
struct Bar2 {
|
|
||||||
int foo() { return 1;}
|
|
||||||
};
|
};
|
||||||
|
short globalfoofunction() { return 1;}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%{
|
||||||
|
void CheckRetTypemapUsed() {
|
||||||
|
// If the "ret" typemap is not used, the NeededForTest template specialization will not have been
|
||||||
|
// generated and so the following code will result in a compile failure
|
||||||
|
NeededForTest<short> needed(111);
|
||||||
|
(void)needed;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
%newobject FFoo::Bar(bool) const ;
|
%newobject FFoo::Bar(bool) const ;
|
||||||
%typemap(newfree) char* Bar(bool) {
|
%typemap(newfree) char* Bar(bool) {
|
||||||
|
|
@ -62,7 +72,7 @@ void foo2(Foo<short> f, const Foo<short>& ff) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Test obscure bug where named typemaps where not being applied when symbol name contained a number
|
// Test obscure bug where named typemaps where not being applied when symbol name contained a number
|
||||||
%typemap(out) double "_typemap_for_double_no_compile_"
|
%typemap(out) double "_out_typemap_for_double_no_compile_"
|
||||||
%typemap(out) double ABCD::meth {$1 = 0.0; TYPEMAP_OUT_INIT}
|
%typemap(out) double ABCD::meth {$1 = 0.0; TYPEMAP_OUT_INIT}
|
||||||
%typemap(out) double ABCD::m1 {$1 = 0.0; TYPEMAP_OUT_INIT}
|
%typemap(out) double ABCD::m1 {$1 = 0.0; TYPEMAP_OUT_INIT}
|
||||||
%typemap(out) double ABCD::_x2 {$1 = 0.0; TYPEMAP_OUT_INIT}
|
%typemap(out) double ABCD::_x2 {$1 = 0.0; TYPEMAP_OUT_INIT}
|
||||||
|
|
|
||||||
16
Examples/test-suite/variable_replacement.i
Normal file
16
Examples/test-suite/variable_replacement.i
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
%module variable_replacement
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
class A {
|
||||||
|
public:
|
||||||
|
int a(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class B : public A {
|
||||||
|
};
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
#define CSHARP_CSHARPKW_SWG_
|
#define CSHARP_CSHARPKW_SWG_
|
||||||
|
|
||||||
/* Warnings for C# keywords */
|
/* Warnings for C# keywords */
|
||||||
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '_" `x` "'",rename="_%s") `x`
|
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '" `x` "_'",rename="%s_") `x`
|
||||||
|
|
||||||
#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '_" `x` "'",%$isclass,rename="_%s") `x`
|
#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '" `x` "_'",%$isclass,rename="%s_") `x`
|
||||||
|
|
||||||
/*
|
/*
|
||||||
from
|
from
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -16,6 +17,7 @@ namespace std
|
||||||
struct exception {};
|
struct exception {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(throws, canthrow=1) std::bad_cast "SWIG_CSharpSetPendingException(SWIG_CSharpInvalidCastException, $1.what());\n return $null;"
|
||||||
%typemap(throws, canthrow=1) std::bad_exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
%typemap(throws, canthrow=1) std::bad_exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
%typemap(throws, canthrow=1) std::domain_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
%typemap(throws, canthrow=1) std::domain_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
%typemap(throws, canthrow=1) std::exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
%typemap(throws, canthrow=1) std::exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -16,6 +17,7 @@ namespace std
|
||||||
struct exception {};
|
struct exception {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(throws, canthrow=1) std::bad_cast "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||||
%typemap(throws, canthrow=1) std::bad_exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
%typemap(throws, canthrow=1) std::bad_exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||||
%typemap(throws, canthrow=1) std::domain_error "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
%typemap(throws, canthrow=1) std::domain_error "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||||
%typemap(throws, canthrow=1) std::exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
%typemap(throws, canthrow=1) std::exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#ifdef SWIGPHP
|
#ifdef SWIGPHP
|
||||||
%{
|
%{
|
||||||
#include "zend_exceptions.h"
|
#include "zend_exceptions.h"
|
||||||
#define SWIG_exception(code, msg) zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC)
|
#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC); goto thrown; } while (0)
|
||||||
%}
|
%}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -258,6 +258,7 @@ SWIGINTERN void SWIG_DThrowException(int code, const char *msg) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
%define SWIG_CATCH_STDEXCEPT
|
%define SWIG_CATCH_STDEXCEPT
|
||||||
|
|
@ -274,6 +275,8 @@ SWIGINTERN void SWIG_DThrowException(int code, const char *msg) {
|
||||||
SWIG_exception(SWIG_IndexError, e.what() );
|
SWIG_exception(SWIG_IndexError, e.what() );
|
||||||
} catch (std::runtime_error& e) {
|
} catch (std::runtime_error& e) {
|
||||||
SWIG_exception(SWIG_RuntimeError, e.what() );
|
SWIG_exception(SWIG_RuntimeError, e.what() );
|
||||||
|
} catch (std::bad_cast& e) {
|
||||||
|
SWIG_exception(SWIG_TypeError, e.what() );
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
SWIG_exception(SWIG_SystemError, e.what() );
|
SWIG_exception(SWIG_SystemError, e.what() );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -16,6 +17,7 @@ namespace std
|
||||||
struct exception {};
|
struct exception {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(throws) std::bad_cast %{_swig_gopanic($1.what());%}
|
||||||
%typemap(throws) std::bad_exception %{_swig_gopanic($1.what());%}
|
%typemap(throws) std::bad_exception %{_swig_gopanic($1.what());%}
|
||||||
%typemap(throws) std::domain_error %{_swig_gopanic($1.what());%}
|
%typemap(throws) std::domain_error %{_swig_gopanic($1.what());%}
|
||||||
%typemap(throws) std::exception %{_swig_gopanic($1.what());%}
|
%typemap(throws) std::exception %{_swig_gopanic($1.what());%}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// TODO: STL exception handling
|
// TODO: STL exception handling
|
||||||
// Note that the generic std_except.i file did not work
|
// Note that the generic std_except.i file did not work
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -16,6 +17,7 @@ namespace std
|
||||||
struct exception {};
|
struct exception {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(throws) std::bad_cast "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
%typemap(throws) std::bad_exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
%typemap(throws) std::bad_exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
%typemap(throws) std::domain_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
%typemap(throws) std::domain_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
%typemap(throws) std::exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
%typemap(throws) std::exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject,
|
||||||
size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
size_t argc, const JSValueRef argv[], JSValueRef* exception)
|
||||||
{
|
{
|
||||||
SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated");
|
SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated");
|
||||||
|
fail:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ SWIGINTERN bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObjec
|
||||||
} else {
|
} else {
|
||||||
SWIG_exception(SWIG_ERROR, msg);
|
SWIG_exception(SWIG_ERROR, msg);
|
||||||
}
|
}
|
||||||
|
fail:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* ---------------------------------------------------------------------------*/
|
* ---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define SWIG_Error(code, msg) SWIG_JSC_exception(context, exception, code, msg)
|
#define SWIG_Error(code, msg) SWIG_JSC_exception(context, exception, code, msg)
|
||||||
#define SWIG_exception(code, msg) SWIG_JSC_exception(context, exception, code, msg)
|
#define SWIG_exception(code, msg) do { SWIG_JSC_exception(context, exception, code, msg); SWIG_fail; } while (0)
|
||||||
#define SWIG_fail goto fail
|
#define SWIG_fail goto fail
|
||||||
|
|
||||||
SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) {
|
SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
|
||||||
SWIGV8_HANDLESCOPE();
|
SWIGV8_HANDLESCOPE();
|
||||||
|
|
||||||
SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated");
|
SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated");
|
||||||
|
fail:
|
||||||
SWIGV8_RETURN(SWIGV8_UNDEFINED());
|
SWIGV8_RETURN(SWIGV8_UNDEFINED());
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<
|
||||||
} else {
|
} else {
|
||||||
SWIG_exception(SWIG_ERROR, msg);
|
SWIG_exception(SWIG_ERROR, msg);
|
||||||
}
|
}
|
||||||
|
fail: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
%} // v8_helper_functions
|
%} // v8_helper_functions
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
|
||||||
* ---------------------------------------------------------------------------*/
|
* ---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg)
|
#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg)
|
||||||
#define SWIG_exception(code, msg) SWIGV8_ErrorHandler.error(code, msg)
|
#define SWIG_exception(code, msg) do { SWIGV8_ErrorHandler.error(code, msg); SWIG_fail; } while (0)
|
||||||
#define SWIG_fail goto fail
|
#define SWIG_fail goto fail
|
||||||
#define SWIGV8_OVERLOAD false
|
#define SWIGV8_OVERLOAD false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
%include <exception.i>
|
%include <exception.i>
|
||||||
|
|
@ -27,6 +28,7 @@ namespace std
|
||||||
// normally objects which are thrown are returned to the interpreter as errors
|
// normally objects which are thrown are returned to the interpreter as errors
|
||||||
// (which potentially may have problems if they are not copied)
|
// (which potentially may have problems if they are not copied)
|
||||||
// therefore all classes based upon std::exception are converted to their strings & returned as errors
|
// therefore all classes based upon std::exception are converted to their strings & returned as errors
|
||||||
|
%typemap(throws) std::bad_cast "SWIG_exception(SWIG_TypeError, $1.what());"
|
||||||
%typemap(throws) std::bad_exception "SWIG_exception(SWIG_RuntimeError, $1.what());"
|
%typemap(throws) std::bad_exception "SWIG_exception(SWIG_RuntimeError, $1.what());"
|
||||||
%typemap(throws) std::domain_error "SWIG_exception(SWIG_ValueError, $1.what());"
|
%typemap(throws) std::domain_error "SWIG_exception(SWIG_ValueError, $1.what());"
|
||||||
%typemap(throws) std::exception "SWIG_exception(SWIG_SystemError, $1.what());"
|
%typemap(throws) std::exception "SWIG_exception(SWIG_SystemError, $1.what());"
|
||||||
|
|
|
||||||
|
|
@ -393,11 +393,7 @@
|
||||||
{
|
{
|
||||||
void * p = emalloc(sizeof($1));
|
void * p = emalloc(sizeof($1));
|
||||||
memcpy(p, &$1, sizeof($1));
|
memcpy(p, &$1, sizeof($1));
|
||||||
zval * resource;
|
ZEND_REGISTER_RESOURCE(return_value, p, swig_member_ptr);
|
||||||
MAKE_STD_ZVAL(resource);
|
|
||||||
ZEND_REGISTER_RESOURCE(resource, p, swig_member_ptr);
|
|
||||||
|
|
||||||
SWIG_SetPointerZval(return_value, (void *)&$1, $1_descriptor, $owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
%typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||||
|
|
|
||||||
|
|
@ -93,9 +93,6 @@ typedef struct {
|
||||||
int newobject;
|
int newobject;
|
||||||
} swig_object_wrapper;
|
} swig_object_wrapper;
|
||||||
|
|
||||||
/* empty zend destructor for types without one */
|
|
||||||
static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; }
|
|
||||||
|
|
||||||
#define SWIG_SetPointerZval(a,b,c,d) SWIG_ZTS_SetPointerZval(a,b,c,d TSRMLS_CC)
|
#define SWIG_SetPointerZval(a,b,c,d) SWIG_ZTS_SetPointerZval(a,b,c,d TSRMLS_CC)
|
||||||
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
|
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ INT_TYPEMAP(unsigned long long);
|
||||||
%typemap(in) char INPUT[ANY] ( char temp[$1_dim0] )
|
%typemap(in) char INPUT[ANY] ( char temp[$1_dim0] )
|
||||||
%{
|
%{
|
||||||
convert_to_string_ex($input);
|
convert_to_string_ex($input);
|
||||||
strncpy(temp,Z_LVAL_PP($input),$1_dim0);
|
strncpy(temp,Z_STRVAL_PP($input),$1_dim0);
|
||||||
$1 = temp;
|
$1 = temp;
|
||||||
%}
|
%}
|
||||||
%typemap(in,numinputs=0) char OUTPUT[ANY] ( char temp[$1_dim0] )
|
%typemap(in,numinputs=0) char OUTPUT[ANY] ( char temp[$1_dim0] )
|
||||||
|
|
|
||||||
|
|
@ -1,220 +1,29 @@
|
||||||
#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a) { \
|
|
||||||
return wrapper(a, NULL); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN void \
|
|
||||||
wrapper##_closure(PyObject *a) { \
|
|
||||||
SwigPyObject *sobj; \
|
|
||||||
sobj = (SwigPyObject *)a; \
|
|
||||||
Py_XDECREF(sobj->dict); \
|
|
||||||
if (sobj->own) { \
|
|
||||||
PyObject *o; \
|
|
||||||
PyObject *val = 0, *type = 0, *tb = 0; \
|
|
||||||
PyErr_Fetch(&val, &type, &tb); \
|
|
||||||
o = wrapper(a, NULL); \
|
|
||||||
if (!o) { \
|
|
||||||
PyObject *deallocname = PyString_FromString(#wrapper); \
|
|
||||||
PyErr_WriteUnraisable(deallocname); \
|
|
||||||
Py_DECREF(deallocname); \
|
|
||||||
} \
|
|
||||||
PyErr_Restore(val, type, tb); \
|
|
||||||
Py_XDECREF(o); \
|
|
||||||
} \
|
|
||||||
if (PyType_IS_GC(a->ob_type)) { \
|
|
||||||
PyObject_GC_Del(a); \
|
|
||||||
} else { \
|
|
||||||
PyObject_Del(a); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_INQUIRY_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN int \
|
|
||||||
wrapper##_closure(PyObject *a) { \
|
|
||||||
PyObject *pyresult; \
|
|
||||||
int result; \
|
|
||||||
pyresult = wrapper(a, NULL); \
|
|
||||||
result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; \
|
|
||||||
Py_XDECREF(pyresult); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a, PyObject *b) { \
|
|
||||||
PyObject *tuple, *result; \
|
|
||||||
tuple = PyTuple_New(1); \
|
|
||||||
assert(tuple); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
|
||||||
Py_XINCREF(b); \
|
|
||||||
result = wrapper(a, tuple); \
|
|
||||||
Py_DECREF(tuple); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef ternaryfunc ternarycallfunc;
|
|
||||||
|
|
||||||
#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
|
||||||
PyObject *tuple, *result; \
|
|
||||||
tuple = PyTuple_New(2); \
|
|
||||||
assert(tuple); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 1, c); \
|
|
||||||
Py_XINCREF(b); \
|
|
||||||
Py_XINCREF(c); \
|
|
||||||
result = wrapper(a, tuple); \
|
|
||||||
Py_DECREF(tuple); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *callable_object, PyObject *args, PyObject *) { \
|
|
||||||
return wrapper(callable_object, args); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_LENFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN Py_ssize_t \
|
|
||||||
wrapper##_closure(PyObject *a) { \
|
|
||||||
PyObject *resultobj; \
|
|
||||||
Py_ssize_t result; \
|
|
||||||
resultobj = wrapper(a, NULL); \
|
|
||||||
result = PyNumber_AsSsize_t(resultobj, NULL); \
|
|
||||||
Py_DECREF(resultobj); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \
|
|
||||||
PyObject *tuple, *result; \
|
|
||||||
tuple = PyTuple_New(2); \
|
|
||||||
assert(tuple); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); \
|
|
||||||
result = wrapper(a, tuple); \
|
|
||||||
Py_DECREF(tuple); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN int \
|
|
||||||
wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \
|
|
||||||
PyObject *tuple, *resultobj; \
|
|
||||||
int result; \
|
|
||||||
tuple = PyTuple_New(d ? 3 : 2); \
|
|
||||||
assert(tuple); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); \
|
|
||||||
if (d) { \
|
|
||||||
PyTuple_SET_ITEM(tuple, 2, d); \
|
|
||||||
Py_INCREF(d); \
|
|
||||||
} \
|
|
||||||
resultobj = wrapper(a, tuple); \
|
|
||||||
result = resultobj ? 0 : -1; \
|
|
||||||
Py_DECREF(tuple); \
|
|
||||||
Py_XDECREF(resultobj); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
|
||||||
PyObject *tuple, *result; \
|
|
||||||
tuple = PyTuple_New(1); \
|
|
||||||
assert(tuple); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
|
||||||
result = wrapper(a, tuple); \
|
|
||||||
Py_DECREF(tuple); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
|
||||||
PyObject *arg, *result; \
|
|
||||||
arg = _PyLong_FromSsize_t(b); \
|
|
||||||
result = wrapper(a, arg); \
|
|
||||||
Py_DECREF(arg); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN int \
|
|
||||||
wrapper##_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \
|
|
||||||
PyObject *tuple, *resultobj; \
|
|
||||||
int result; \
|
|
||||||
tuple = PyTuple_New(2); \
|
|
||||||
assert(tuple); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 1, c); \
|
|
||||||
Py_XINCREF(c); \
|
|
||||||
resultobj = wrapper(a, tuple); \
|
|
||||||
result = resultobj ? 0 : -1; \
|
|
||||||
Py_XDECREF(resultobj); \
|
|
||||||
Py_DECREF(tuple); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN int \
|
|
||||||
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
|
||||||
PyObject *tuple, *resultobj; \
|
|
||||||
int result; \
|
|
||||||
tuple = PyTuple_New(c ? 2 : 1); \
|
|
||||||
assert(tuple); \
|
|
||||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
|
||||||
Py_XINCREF(b); \
|
|
||||||
if (c) { \
|
|
||||||
PyTuple_SET_ITEM(tuple, 1, c); \
|
|
||||||
Py_XINCREF(c); \
|
|
||||||
} \
|
|
||||||
resultobj = wrapper(a, tuple); \
|
|
||||||
result = resultobj ? 0 : -1; \
|
|
||||||
Py_XDECREF(resultobj); \
|
|
||||||
Py_DECREF(tuple); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a) { \
|
|
||||||
return wrapper(a, NULL); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN long \
|
|
||||||
wrapper##_closure(PyObject *a) { \
|
|
||||||
PyObject *pyresult; \
|
|
||||||
long result; \
|
|
||||||
pyresult = wrapper(a, NULL); \
|
|
||||||
if (!pyresult || !PyLong_Check(pyresult)) \
|
|
||||||
return -1; \
|
|
||||||
result = PyLong_AsLong(pyresult); \
|
|
||||||
Py_DECREF(pyresult); \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIGPY_ITERNEXT_CLOSURE(wrapper) \
|
|
||||||
SWIGINTERN PyObject * \
|
|
||||||
wrapper##_closure(PyObject *a) { \
|
|
||||||
PyObject *result; \
|
|
||||||
result = wrapper(a, NULL); \
|
|
||||||
if (result && result == Py_None) { \
|
|
||||||
Py_DECREF(result); \
|
|
||||||
result = NULL; \
|
|
||||||
} \
|
|
||||||
return result; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SWIGINTERN Py_hash_t
|
||||||
|
SwigPyObject_hash(PyObject *obj) {
|
||||||
|
SwigPyObject *sobj = (SwigPyObject *)obj;
|
||||||
|
void *ptr = sobj->ptr;
|
||||||
|
return (Py_hash_t)ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
SWIGINTERN Py_hash_t
|
||||||
|
SWIG_PyNumber_AsPyHash(PyObject *obj) {
|
||||||
|
Py_hash_t result = -1;
|
||||||
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
|
if (PyLong_Check(obj))
|
||||||
|
result = PyLong_AsLong(obj);
|
||||||
|
#else
|
||||||
|
if (PyNumber_Check(obj))
|
||||||
|
result = PyNumber_AsSsize_t(obj, NULL);
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
PyErr_Format(PyExc_TypeError, "Wrong type for hash function");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) {
|
SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) {
|
||||||
PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name);
|
PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name);
|
||||||
|
|
@ -222,11 +31,10 @@ SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN void
|
SWIGINTERN void
|
||||||
SwigPyBuiltin_BadDealloc(PyObject *pyobj) {
|
SwigPyBuiltin_BadDealloc(PyObject *obj) {
|
||||||
SwigPyObject *sobj;
|
SwigPyObject *sobj = (SwigPyObject *)obj;
|
||||||
sobj = (SwigPyObject *)pyobj;
|
|
||||||
if (sobj->own) {
|
if (sobj->own) {
|
||||||
PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", pyobj->ob_type->tp_name);
|
PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -387,16 +195,15 @@ SwigPyStaticVar_Type(void) {
|
||||||
static int type_init = 0;
|
static int type_init = 0;
|
||||||
if (!type_init) {
|
if (!type_init) {
|
||||||
const PyTypeObject tmp = {
|
const PyTypeObject tmp = {
|
||||||
/* PyObject header changed in Python 3 */
|
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||||
#else
|
#else
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0,
|
0, /* ob_size */
|
||||||
#endif
|
#endif
|
||||||
"swig_static_var_getset_descriptor",
|
"swig_static_var_getset_descriptor", /* tp_name */
|
||||||
sizeof(PyGetSetDescrObject),
|
sizeof(PyGetSetDescrObject), /* tp_basicsize */
|
||||||
0,
|
0, /* tp_itemsize */
|
||||||
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
|
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
|
||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
0, /* tp_getattr */
|
0, /* tp_getattr */
|
||||||
|
|
@ -527,6 +334,295 @@ SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Start of callback function macros for use in PyTypeObject */
|
||||||
|
|
||||||
|
typedef PyObject *(*SwigPyWrapperFunction)(PyObject *, PyObject *);
|
||||||
|
|
||||||
|
#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_unaryfunc_closure(PyObject *a) { \
|
||||||
|
return SwigPyBuiltin_unaryfunc_closure(wrapper, a); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_unaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||||
|
return wrapper(a, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN void \
|
||||||
|
wrapper##_destructor_closure(PyObject *a) { \
|
||||||
|
SwigPyBuiltin_destructor_closure(wrapper, #wrapper, a); \
|
||||||
|
}
|
||||||
|
SWIGINTERN void
|
||||||
|
SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) {
|
||||||
|
SwigPyObject *sobj;
|
||||||
|
sobj = (SwigPyObject *)a;
|
||||||
|
Py_XDECREF(sobj->dict);
|
||||||
|
if (sobj->own) {
|
||||||
|
PyObject *o;
|
||||||
|
PyObject *val = 0, *type = 0, *tb = 0;
|
||||||
|
PyErr_Fetch(&val, &type, &tb);
|
||||||
|
o = wrapper(a, NULL);
|
||||||
|
if (!o) {
|
||||||
|
PyObject *deallocname = PyString_FromString(wrappername);
|
||||||
|
PyErr_WriteUnraisable(deallocname);
|
||||||
|
Py_DECREF(deallocname);
|
||||||
|
}
|
||||||
|
PyErr_Restore(val, type, tb);
|
||||||
|
Py_XDECREF(o);
|
||||||
|
}
|
||||||
|
if (PyType_IS_GC(a->ob_type)) {
|
||||||
|
PyObject_GC_Del(a);
|
||||||
|
} else {
|
||||||
|
PyObject_Del(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_INQUIRY_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN int \
|
||||||
|
wrapper##_inquiry_closure(PyObject *a) { \
|
||||||
|
return SwigPyBuiltin_inquiry_closure(wrapper, a); \
|
||||||
|
}
|
||||||
|
SWIGINTERN int
|
||||||
|
SwigPyBuiltin_inquiry_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||||
|
PyObject *pyresult;
|
||||||
|
int result;
|
||||||
|
pyresult = wrapper(a, NULL);
|
||||||
|
result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0;
|
||||||
|
Py_XDECREF(pyresult);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_GETITERFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_getiterfunc_closure(PyObject *a) { \
|
||||||
|
return SwigPyBuiltin_getiterfunc_closure(wrapper, a); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_getiterfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||||
|
return wrapper(a, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_binaryfunc_closure(PyObject *a, PyObject *b) { \
|
||||||
|
return SwigPyBuiltin_binaryfunc_closure(wrapper, a, b); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_binaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) {
|
||||||
|
PyObject *tuple, *result;
|
||||||
|
tuple = PyTuple_New(1);
|
||||||
|
assert(tuple);
|
||||||
|
PyTuple_SET_ITEM(tuple, 0, b);
|
||||||
|
Py_XINCREF(b);
|
||||||
|
result = wrapper(a, tuple);
|
||||||
|
Py_DECREF(tuple);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef ternaryfunc ternarycallfunc;
|
||||||
|
|
||||||
|
#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_ternaryfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||||
|
return SwigPyBuiltin_ternaryfunc_closure(wrapper, a, b, c); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
|
||||||
|
PyObject *tuple, *result;
|
||||||
|
tuple = PyTuple_New(2);
|
||||||
|
assert(tuple);
|
||||||
|
PyTuple_SET_ITEM(tuple, 0, b);
|
||||||
|
PyTuple_SET_ITEM(tuple, 1, c);
|
||||||
|
Py_XINCREF(b);
|
||||||
|
Py_XINCREF(c);
|
||||||
|
result = wrapper(a, tuple);
|
||||||
|
Py_DECREF(tuple);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_ternarycallfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||||
|
return SwigPyBuiltin_ternarycallfunc_closure(wrapper, a, b, c); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_ternarycallfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
|
||||||
|
(void) c;
|
||||||
|
return wrapper(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_LENFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN Py_ssize_t \
|
||||||
|
wrapper##_lenfunc_closure(PyObject *a) { \
|
||||||
|
return SwigPyBuiltin_lenfunc_closure(wrapper, a); \
|
||||||
|
}
|
||||||
|
SWIGINTERN Py_ssize_t
|
||||||
|
SwigPyBuiltin_lenfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||||
|
PyObject *resultobj;
|
||||||
|
Py_ssize_t result;
|
||||||
|
resultobj = wrapper(a, NULL);
|
||||||
|
result = PyNumber_AsSsize_t(resultobj, NULL);
|
||||||
|
Py_DECREF(resultobj);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_ssizessizeargfunc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \
|
||||||
|
return SwigPyBuiltin_ssizessizeargfunc_closure(wrapper, a, b, c); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_ssizessizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c) {
|
||||||
|
PyObject *tuple, *result;
|
||||||
|
tuple = PyTuple_New(2);
|
||||||
|
assert(tuple);
|
||||||
|
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||||
|
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c));
|
||||||
|
result = wrapper(a, tuple);
|
||||||
|
Py_DECREF(tuple);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN int \
|
||||||
|
wrapper##_ssizessizeobjargproc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \
|
||||||
|
return SwigPyBuiltin_ssizessizeobjargproc_closure(wrapper, a, b, c, d); \
|
||||||
|
}
|
||||||
|
SWIGINTERN int
|
||||||
|
SwigPyBuiltin_ssizessizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) {
|
||||||
|
PyObject *tuple, *resultobj;
|
||||||
|
int result;
|
||||||
|
tuple = PyTuple_New(d ? 3 : 2);
|
||||||
|
assert(tuple);
|
||||||
|
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||||
|
PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c));
|
||||||
|
if (d) {
|
||||||
|
PyTuple_SET_ITEM(tuple, 2, d);
|
||||||
|
Py_INCREF(d);
|
||||||
|
}
|
||||||
|
resultobj = wrapper(a, tuple);
|
||||||
|
result = resultobj ? 0 : -1;
|
||||||
|
Py_DECREF(tuple);
|
||||||
|
Py_XDECREF(resultobj);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \
|
||||||
|
return SwigPyBuiltin_funpack_ssizeargfunc_closure(wrapper, a, b); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_funpack_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) {
|
||||||
|
PyObject *tuple, *result;
|
||||||
|
tuple = PyTuple_New(1);
|
||||||
|
assert(tuple);
|
||||||
|
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||||
|
result = wrapper(a, tuple);
|
||||||
|
Py_DECREF(tuple);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \
|
||||||
|
return SwigPyBuiltin_ssizeargfunc_closure(wrapper, a, b); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) {
|
||||||
|
PyObject *arg, *result;
|
||||||
|
arg = _PyLong_FromSsize_t(b);
|
||||||
|
result = wrapper(a, arg);
|
||||||
|
Py_DECREF(arg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN int \
|
||||||
|
wrapper##_ssizeobjargproc_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \
|
||||||
|
return SwigPyBuiltin_ssizeobjargproc_closure(wrapper, a, b, c); \
|
||||||
|
}
|
||||||
|
SWIGINTERN int
|
||||||
|
SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, PyObject *c) {
|
||||||
|
PyObject *tuple, *resultobj;
|
||||||
|
int result;
|
||||||
|
tuple = PyTuple_New(2);
|
||||||
|
assert(tuple);
|
||||||
|
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
|
||||||
|
PyTuple_SET_ITEM(tuple, 1, c);
|
||||||
|
Py_XINCREF(c);
|
||||||
|
resultobj = wrapper(a, tuple);
|
||||||
|
result = resultobj ? 0 : -1;
|
||||||
|
Py_XDECREF(resultobj);
|
||||||
|
Py_DECREF(tuple);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN int \
|
||||||
|
wrapper##_objobjargproc_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||||
|
return SwigPyBuiltin_objobjargproc_closure(wrapper, a, b, c); \
|
||||||
|
}
|
||||||
|
SWIGINTERN int
|
||||||
|
SwigPyBuiltin_objobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
|
||||||
|
PyObject *tuple, *resultobj;
|
||||||
|
int result;
|
||||||
|
tuple = PyTuple_New(c ? 2 : 1);
|
||||||
|
assert(tuple);
|
||||||
|
PyTuple_SET_ITEM(tuple, 0, b);
|
||||||
|
Py_XINCREF(b);
|
||||||
|
if (c) {
|
||||||
|
PyTuple_SET_ITEM(tuple, 1, c);
|
||||||
|
Py_XINCREF(c);
|
||||||
|
}
|
||||||
|
resultobj = wrapper(a, tuple);
|
||||||
|
result = resultobj ? 0 : -1;
|
||||||
|
Py_XDECREF(resultobj);
|
||||||
|
Py_DECREF(tuple);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_reprfunc_closure(PyObject *a) { \
|
||||||
|
return SwigPyBuiltin_reprfunc_closure(wrapper, a); \
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_reprfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||||
|
return wrapper(a, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN Py_hash_t \
|
||||||
|
wrapper##_hashfunc_closure(PyObject *a) { \
|
||||||
|
return SwigPyBuiltin_hashfunc_closure(wrapper, a); \
|
||||||
|
}
|
||||||
|
SWIGINTERN Py_hash_t
|
||||||
|
SwigPyBuiltin_hashfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||||
|
PyObject *pyresult;
|
||||||
|
Py_hash_t result;
|
||||||
|
pyresult = wrapper(a, NULL);
|
||||||
|
if (!pyresult)
|
||||||
|
return -1;
|
||||||
|
result = SWIG_PyNumber_AsPyHash(pyresult);
|
||||||
|
Py_DECREF(pyresult);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIGPY_ITERNEXTFUNC_CLOSURE(wrapper) \
|
||||||
|
SWIGINTERN PyObject * \
|
||||||
|
wrapper##_iternextfunc_closure(PyObject *a) { \
|
||||||
|
return SwigPyBuiltin_iternextfunc_closure(wrapper, a);\
|
||||||
|
}
|
||||||
|
SWIGINTERN PyObject *
|
||||||
|
SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
|
||||||
|
return wrapper(a, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of callback function macros for use in PyTypeObject */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ namespace swig {
|
||||||
if (step == 0) {
|
if (step == 0) {
|
||||||
throw std::invalid_argument("slice step cannot be zero");
|
throw std::invalid_argument("slice step cannot be zero");
|
||||||
} else if (step > 0) {
|
} else if (step > 0) {
|
||||||
// Required range: 0 <= i < size, 0 <= j < size
|
// Required range: 0 <= i < size, 0 <= j < size, i <= j
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
ii = 0;
|
ii = 0;
|
||||||
} else if (i < (Difference)size) {
|
} else if (i < (Difference)size) {
|
||||||
|
|
@ -219,8 +219,10 @@ namespace swig {
|
||||||
} else {
|
} else {
|
||||||
jj = (j < (Difference)size) ? j : (Difference)size;
|
jj = (j < (Difference)size) ? j : (Difference)size;
|
||||||
}
|
}
|
||||||
|
if (jj < ii)
|
||||||
|
jj = ii;
|
||||||
} else {
|
} else {
|
||||||
// Required range: -1 <= i < size-1, -1 <= j < size-1
|
// Required range: -1 <= i < size-1, -1 <= j < size-1, i >= j
|
||||||
if (i < -1) {
|
if (i < -1) {
|
||||||
ii = -1;
|
ii = -1;
|
||||||
} else if (i < (Difference) size) {
|
} else if (i < (Difference) size) {
|
||||||
|
|
@ -233,6 +235,8 @@ namespace swig {
|
||||||
} else {
|
} else {
|
||||||
jj = (j < (Difference)size ) ? j : (Difference)(size-1);
|
jj = (j < (Difference)size ) ? j : (Difference)(size-1);
|
||||||
}
|
}
|
||||||
|
if (ii < jj)
|
||||||
|
ii = jj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,6 +262,13 @@ namespace swig {
|
||||||
seq->erase(position);
|
seq->erase(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class Sequence>
|
||||||
|
struct traits_reserve {
|
||||||
|
static void reserve(Sequence & /*seq*/, typename Sequence::size_type /*n*/) {
|
||||||
|
// This should be specialized for types that support reserve
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class Sequence, class Difference>
|
template <class Sequence, class Difference>
|
||||||
inline Sequence*
|
inline Sequence*
|
||||||
getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) {
|
getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) {
|
||||||
|
|
@ -275,6 +286,7 @@ namespace swig {
|
||||||
return new Sequence(sb, se);
|
return new Sequence(sb, se);
|
||||||
} else {
|
} else {
|
||||||
Sequence *sequence = new Sequence();
|
Sequence *sequence = new Sequence();
|
||||||
|
swig::traits_reserve<Sequence>::reserve(*sequence, (jj - ii + step - 1) / step);
|
||||||
typename Sequence::const_iterator it = sb;
|
typename Sequence::const_iterator it = sb;
|
||||||
while (it!=se) {
|
while (it!=se) {
|
||||||
sequence->push_back(*it);
|
sequence->push_back(*it);
|
||||||
|
|
@ -285,7 +297,7 @@ namespace swig {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Sequence *sequence = new Sequence();
|
Sequence *sequence = new Sequence();
|
||||||
if (ii > jj) {
|
swig::traits_reserve<Sequence>::reserve(*sequence, (ii - jj - step - 1) / -step);
|
||||||
typename Sequence::const_reverse_iterator sb = self->rbegin();
|
typename Sequence::const_reverse_iterator sb = self->rbegin();
|
||||||
typename Sequence::const_reverse_iterator se = self->rbegin();
|
typename Sequence::const_reverse_iterator se = self->rbegin();
|
||||||
std::advance(sb,size-ii-1);
|
std::advance(sb,size-ii-1);
|
||||||
|
|
@ -296,7 +308,6 @@ namespace swig {
|
||||||
for (Py_ssize_t c=0; c<-step && it!=se; ++c)
|
for (Py_ssize_t c=0; c<-step && it!=se; ++c)
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return sequence;
|
return sequence;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -309,12 +320,11 @@ namespace swig {
|
||||||
Difference jj = 0;
|
Difference jj = 0;
|
||||||
swig::slice_adjust(i, j, step, size, ii, jj, true);
|
swig::slice_adjust(i, j, step, size, ii, jj, true);
|
||||||
if (step > 0) {
|
if (step > 0) {
|
||||||
if (jj < ii)
|
|
||||||
jj = ii;
|
|
||||||
if (step == 1) {
|
if (step == 1) {
|
||||||
size_t ssize = jj - ii;
|
size_t ssize = jj - ii;
|
||||||
if (ssize <= is.size()) {
|
if (ssize <= is.size()) {
|
||||||
// expanding/staying the same size
|
// expanding/staying the same size
|
||||||
|
swig::traits_reserve<Sequence>::reserve(*self, self->size() - ssize + is.size());
|
||||||
typename Sequence::iterator sb = self->begin();
|
typename Sequence::iterator sb = self->begin();
|
||||||
typename InputSeq::const_iterator isit = is.begin();
|
typename InputSeq::const_iterator isit = is.begin();
|
||||||
std::advance(sb,ii);
|
std::advance(sb,ii);
|
||||||
|
|
@ -348,8 +358,6 @@ namespace swig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (jj > ii)
|
|
||||||
jj = ii;
|
|
||||||
size_t replacecount = (ii - jj - step - 1) / -step;
|
size_t replacecount = (ii - jj - step - 1) / -step;
|
||||||
if (is.size() != replacecount) {
|
if (is.size() != replacecount) {
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
|
|
@ -375,7 +383,6 @@ namespace swig {
|
||||||
Difference jj = 0;
|
Difference jj = 0;
|
||||||
swig::slice_adjust(i, j, step, size, ii, jj, true);
|
swig::slice_adjust(i, j, step, size, ii, jj, true);
|
||||||
if (step > 0) {
|
if (step > 0) {
|
||||||
if (jj > ii) {
|
|
||||||
typename Sequence::iterator sb = self->begin();
|
typename Sequence::iterator sb = self->begin();
|
||||||
std::advance(sb,ii);
|
std::advance(sb,ii);
|
||||||
if (step == 1) {
|
if (step == 1) {
|
||||||
|
|
@ -392,9 +399,7 @@ namespace swig {
|
||||||
delcount--;
|
delcount--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (ii > jj) {
|
|
||||||
typename Sequence::reverse_iterator sb = self->rbegin();
|
typename Sequence::reverse_iterator sb = self->rbegin();
|
||||||
std::advance(sb,size-ii-1);
|
std::advance(sb,size-ii-1);
|
||||||
typename Sequence::reverse_iterator it = sb;
|
typename Sequence::reverse_iterator it = sb;
|
||||||
|
|
@ -409,7 +414,6 @@ namespace swig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
%fragment("SwigPySequence_Cont","header",
|
%fragment("SwigPySequence_Cont","header",
|
||||||
fragment="StdTraits",
|
fragment="StdTraits",
|
||||||
|
|
|
||||||
|
|
@ -211,4 +211,5 @@ typedef destructor freefunc;
|
||||||
#if PY_VERSION_HEX < 0x03020000
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
||||||
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
||||||
|
#define Py_hash_t long
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,6 @@ swig_varlink_type(void) {
|
||||||
static int type_init = 0;
|
static int type_init = 0;
|
||||||
if (!type_init) {
|
if (!type_init) {
|
||||||
const PyTypeObject tmp = {
|
const PyTypeObject tmp = {
|
||||||
/* PyObject header changed in Python 3 */
|
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -18,32 +18,36 @@
|
||||||
where <slot> is the name of a field in a PyTypeObject, PyNumberMethods,
|
where <slot> is the name of a field in a PyTypeObject, PyNumberMethods,
|
||||||
PyMappingMethods, PySequenceMethods, or PyBufferProcs. For example:
|
PyMappingMethods, PySequenceMethods, or PyBufferProcs. For example:
|
||||||
|
|
||||||
%{
|
%feature("python:tp_hash") MyClass "myHashFunc";
|
||||||
|
|
||||||
static long myHashFunc (PyObject *pyobj) {
|
class MyClass {
|
||||||
|
public:
|
||||||
|
...
|
||||||
|
};
|
||||||
|
|
||||||
|
%{
|
||||||
|
// Note: Py_hash_t was introduced in Python 3.2
|
||||||
|
static Py_hash_t myHashFunc(PyObject *pyobj) {
|
||||||
MyClass *cobj;
|
MyClass *cobj;
|
||||||
// Convert pyobj to cobj
|
// Convert pyobj to cobj
|
||||||
return (cobj->field1 * (cobj->field2 << 7));
|
return (cobj->field1 * (cobj->field2 << 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%feature("python:tp_hash") MyClass "myHashFunc";
|
|
||||||
|
|
||||||
NOTE: It is the responsibility of the programmer (that's you) to ensure
|
NOTE: It is the responsibility of the programmer (that's you) to ensure
|
||||||
that a statically defined slot function has the correct signature.
|
that a statically defined slot function has the correct signature.
|
||||||
|
|
||||||
If, instead, you want to dispatch to an instance method, you can
|
If, instead, you want to dispatch to an instance method, you can
|
||||||
use %feature("python:slot"). For example:
|
use %feature("python:slot"). For example:
|
||||||
|
|
||||||
|
%feature("python:slot", "tp_hash", functype="hashfunc") MyClass::myHashFunc;
|
||||||
|
|
||||||
class MyClass {
|
class MyClass {
|
||||||
public:
|
public:
|
||||||
long myHashFunc () const;
|
Py_hash_t myHashFunc () const;
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
|
|
||||||
%feature("python:slot", "tp_hash", functype="hashfunc") MyClass::myHashFunc;
|
|
||||||
|
|
||||||
NOTE: Some python slots use a method signature which does not
|
NOTE: Some python slots use a method signature which does not
|
||||||
match the signature of SWIG-wrapped methods. For those slots,
|
match the signature of SWIG-wrapped methods. For those slots,
|
||||||
SWIG will automatically generate a "closure" function to re-marshall
|
SWIG will automatically generate a "closure" function to re-marshall
|
||||||
|
|
@ -58,20 +62,21 @@
|
||||||
operator overloads for comparison (operator==, operator<, etc.), they
|
operator overloads for comparison (operator==, operator<, etc.), they
|
||||||
will be called from the generated rich compare function. If you
|
will be called from the generated rich compare function. If you
|
||||||
want to explicitly choose a method to handle a certain comparison
|
want to explicitly choose a method to handle a certain comparison
|
||||||
operation, you may use %feature("python:slot") like this:
|
operation, you may use a different feature, %feature("python:compare")
|
||||||
|
like this:
|
||||||
|
|
||||||
|
%feature("python:compare", "Py_LT") MyClass::lessThan;
|
||||||
|
|
||||||
class MyClass {
|
class MyClass {
|
||||||
public:
|
public:
|
||||||
bool lessThan (const MyClass& x) const;
|
bool lessThan(const MyClass& other) const;
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
|
|
||||||
%feature("python:slot", "Py_LT") MyClass::lessThan;
|
|
||||||
|
|
||||||
... where "Py_LT" is one of the rich comparison opcodes defined in the
|
... where "Py_LT" is one of the rich comparison opcodes defined in the
|
||||||
python header file object.h.
|
python header file object.h.
|
||||||
|
|
||||||
If there's no method defined to handle a particular comparsion operation,
|
If there's no method defined to handle a particular comparison operation,
|
||||||
the default behavior is to compare pointer values of the wrapped
|
the default behavior is to compare pointer values of the wrapped
|
||||||
C++ objects.
|
C++ objects.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ SWIG_AsVal_dec(double)(PyObject *obj, double *val)
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
%#if PY_VERSION_HEX < 0x03000000
|
%#if PY_VERSION_HEX < 0x03000000
|
||||||
} else if (PyInt_Check(obj)) {
|
} else if (PyInt_Check(obj)) {
|
||||||
if (val) *val = PyInt_AsLong(obj);
|
if (val) *val = (double) PyInt_AsLong(obj);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
%#endif
|
%#endif
|
||||||
} else if (PyLong_Check(obj)) {
|
} else if (PyLong_Check(obj)) {
|
||||||
|
|
|
||||||
|
|
@ -758,7 +758,6 @@ SwigPyObject_TypeOnce(void) {
|
||||||
static int type_init = 0;
|
static int type_init = 0;
|
||||||
if (!type_init) {
|
if (!type_init) {
|
||||||
const PyTypeObject tmp = {
|
const PyTypeObject tmp = {
|
||||||
/* PyObject header changed in Python 3 */
|
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
#else
|
#else
|
||||||
|
|
@ -950,7 +949,6 @@ SwigPyPacked_TypeOnce(void) {
|
||||||
static int type_init = 0;
|
static int type_init = 0;
|
||||||
if (!type_init) {
|
if (!type_init) {
|
||||||
const PyTypeObject tmp = {
|
const PyTypeObject tmp = {
|
||||||
/* PyObject header changed in Python 3 */
|
|
||||||
#if PY_VERSION_HEX>=0x03000000
|
#if PY_VERSION_HEX>=0x03000000
|
||||||
PyVarObject_HEAD_INIT(NULL, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class K, class T>
|
||||||
|
struct traits_reserve<std::unordered_map<K,T> > {
|
||||||
|
static void reserve(std::unordered_map<K,T> &seq, typename std::unordered_map<K,T>::size_type n) {
|
||||||
|
seq.reserve(n);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class K, class T>
|
template <class K, class T>
|
||||||
struct traits_asptr<std::unordered_map<K,T> > {
|
struct traits_asptr<std::unordered_map<K,T> > {
|
||||||
typedef std::unordered_map<K,T> unordered_map_type;
|
typedef std::unordered_map<K,T> unordered_map_type;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class K, class T>
|
||||||
|
struct traits_reserve<std::unordered_multimap<K,T> > {
|
||||||
|
static void reserve(std::unordered_multimap<K,T> &seq, typename std::unordered_multimap<K,T>::size_type n) {
|
||||||
|
seq.reserve(n);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class K, class T>
|
template <class K, class T>
|
||||||
struct traits_asptr<std::unordered_multimap<K,T> > {
|
struct traits_asptr<std::unordered_multimap<K,T> > {
|
||||||
typedef std::unordered_multimap<K,T> unordered_multimap_type;
|
typedef std::unordered_multimap<K,T> unordered_multimap_type;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct traits_reserve<std::unordered_multiset<T> > {
|
||||||
|
static void reserve(std::unordered_multiset<T> &seq, typename std::unordered_multiset<T>::size_type n) {
|
||||||
|
seq.reserve(n);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct traits_asptr<std::unordered_multiset<T> > {
|
struct traits_asptr<std::unordered_multiset<T> > {
|
||||||
static int asptr(PyObject *obj, std::unordered_multiset<T> **m) {
|
static int asptr(PyObject *obj, std::unordered_multiset<T> **m) {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct traits_reserve<std::unordered_set<T> > {
|
||||||
|
static void reserve(std::unordered_set<T> &seq, typename std::unordered_set<T>::size_type n) {
|
||||||
|
seq.reserve(n);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct traits_asptr<std::unordered_set<T> > {
|
struct traits_asptr<std::unordered_set<T> > {
|
||||||
static int asptr(PyObject *obj, std::unordered_set<T> **s) {
|
static int asptr(PyObject *obj, std::unordered_set<T> **s) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,13 @@
|
||||||
%fragment("StdVectorTraits","header",fragment="StdSequenceTraits")
|
%fragment("StdVectorTraits","header",fragment="StdSequenceTraits")
|
||||||
%{
|
%{
|
||||||
namespace swig {
|
namespace swig {
|
||||||
|
template <class T>
|
||||||
|
struct traits_reserve<std::vector<T> > {
|
||||||
|
static void reserve(std::vector<T> &seq, typename std::vector<T>::size_type n) {
|
||||||
|
seq.reserve(n);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct traits_asptr<std::vector<T> > {
|
struct traits_asptr<std::vector<T> > {
|
||||||
static int asptr(PyObject *obj, std::vector<T> **vec) {
|
static int asptr(PyObject *obj, std::vector<T> **vec) {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,4 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#include <exception>
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* for raw pointer */
|
|
||||||
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
|
||||||
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
|
||||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags)
|
|
||||||
|
|
||||||
|
|
||||||
/* Remove global namespace pollution */
|
/* Remove global namespace pollution */
|
||||||
#if !defined(SWIG_NO_R_NO_REMAP)
|
#if !defined(SWIG_NO_R_NO_REMAP)
|
||||||
# define R_NO_REMAP
|
# define R_NO_REMAP
|
||||||
|
|
@ -20,6 +9,17 @@ extern "C" {
|
||||||
|
|
||||||
#include <Rdefines.h>
|
#include <Rdefines.h>
|
||||||
#include <Rversion.h>
|
#include <Rversion.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <exception>
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* for raw pointer */
|
||||||
|
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||||
|
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||||
|
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags)
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,6 @@ SWIG_SciBoolean_AsIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBooleanType(pvApiCtx, piAddrVar)) {
|
if (isBooleanType(pvApiCtx, piAddrVar)) {
|
||||||
int i;
|
|
||||||
sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVar, iRows, iCols, piValue);
|
sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVar, iRows, iCols, piValue);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
%fragment("SWIG_NewPointerObj", "header") {
|
%fragment("SWIG_NewPointerObj", "header") {
|
||||||
#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, flags)
|
#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, flags, NULL)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
%fragment("SWIG_NewFunctionPtrObj", "header") {
|
%fragment("SWIG_NewFunctionPtrObj", "header") {
|
||||||
#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, 0)
|
#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, 0, NULL)
|
||||||
}
|
}
|
||||||
// No fragment used here, the functions "SwigScilabPtrToObject" and "SwigScilabPtrFromObject" are defined in sciruntime.swg
|
// No fragment used here, the functions "SwigScilabPtrToObject" and "SwigScilabPtrFromObject" are defined in sciruntime.swg
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,83 @@ SWIG_Scilab_SetOutput(void *pvApiCtx, SwigSciObject output) {
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Error functions */
|
||||||
|
|
||||||
|
#define SCILAB_API_ARGUMENT_ERROR 999
|
||||||
|
|
||||||
|
SWIGINTERN const char*
|
||||||
|
SWIG_Scilab_ErrorType(int code) {
|
||||||
|
switch(code) {
|
||||||
|
case SWIG_MemoryError:
|
||||||
|
return "MemoryError";
|
||||||
|
case SWIG_IOError:
|
||||||
|
return "IOError";
|
||||||
|
case SWIG_RuntimeError:
|
||||||
|
return "RuntimeError";
|
||||||
|
case SWIG_IndexError:
|
||||||
|
return "IndexError";
|
||||||
|
case SWIG_TypeError:
|
||||||
|
return "TypeError";
|
||||||
|
case SWIG_DivisionByZero:
|
||||||
|
return "ZeroDivisionError";
|
||||||
|
case SWIG_OverflowError:
|
||||||
|
return "OverflowError";
|
||||||
|
case SWIG_SyntaxError:
|
||||||
|
return "SyntaxError";
|
||||||
|
case SWIG_ValueError:
|
||||||
|
return "ValueError";
|
||||||
|
case SWIG_SystemError:
|
||||||
|
return "SystemError";
|
||||||
|
case SWIG_AttributeError:
|
||||||
|
return "AttributeError";
|
||||||
|
default:
|
||||||
|
return "RuntimeError";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code)
|
||||||
|
|
||||||
|
#ifndef SWIG_SCILAB_ERROR
|
||||||
|
#define SWIG_SCILAB_ERROR 20000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SWIGINTERN void
|
||||||
|
SWIG_Scilab_Error(int code, const char *msg) {
|
||||||
|
Scierror(SWIG_SCILAB_ERROR - code, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg)
|
||||||
|
|
||||||
|
#define SWIG_fail return SWIG_ERROR;
|
||||||
|
|
||||||
|
SWIGRUNTIME void
|
||||||
|
SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) {
|
||||||
|
if (type) {
|
||||||
|
if (obj)
|
||||||
|
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj);
|
||||||
|
else
|
||||||
|
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SWIGRUNTIME void
|
||||||
|
SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) {
|
||||||
|
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Module initialization */
|
||||||
|
|
||||||
|
static int swig_module_initialized = 0;
|
||||||
|
|
||||||
|
SWIGRUNTIME int
|
||||||
|
SWIG_Module_Initialized() {
|
||||||
|
return swig_module_initialized;
|
||||||
|
}
|
||||||
|
|
||||||
/* Pointer conversion functions */
|
/* Pointer conversion functions */
|
||||||
|
|
||||||
|
SWIGRUNTIME swig_type_info *
|
||||||
|
SWIG_Scilab_TypeQuery(const char *name);
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *fname) {
|
SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *fname) {
|
||||||
SciErr sciErr;
|
SciErr sciErr;
|
||||||
|
|
@ -120,7 +195,7 @@ SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *f
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iType == sci_tlist) {
|
if (iType == sci_mlist) {
|
||||||
int iItemCount = 0;
|
int iItemCount = 0;
|
||||||
void *pvTypeinfo = NULL;
|
void *pvTypeinfo = NULL;
|
||||||
|
|
||||||
|
|
@ -171,7 +246,7 @@ SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *de
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iType == sci_tlist) {
|
if (iType == sci_mlist) {
|
||||||
int iItemCount = 0;
|
int iItemCount = 0;
|
||||||
void *pvTypeinfo = NULL;
|
void *pvTypeinfo = NULL;
|
||||||
|
|
||||||
|
|
@ -232,34 +307,36 @@ SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *de
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIMEINLINE int
|
SWIGRUNTIMEINLINE int
|
||||||
SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info *descriptor, int flags) {
|
SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info *descriptor, int flags, const char *pstTypeName) {
|
||||||
SciErr sciErr;
|
SciErr sciErr;
|
||||||
|
|
||||||
if (descriptor) {
|
if (descriptor) {
|
||||||
int *piTListAddr = NULL;
|
int *piMListAddr = NULL;
|
||||||
const char *pstString;
|
|
||||||
|
|
||||||
sciErr = createTList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 3, &piTListAddr);
|
sciErr = createMList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 3, &piMListAddr);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
pstString = SWIG_TypeName(descriptor);
|
if (pstTypeName == NULL) {
|
||||||
sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piTListAddr, 1, 1, 1, &pstString);
|
pstTypeName = SWIG_TypeName(descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 1, 1, 1, &pstTypeName);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piTListAddr, 2, descriptor);
|
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 2, descriptor);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piTListAddr, 3, pvObj);
|
sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 3, pvObj);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
|
@ -342,69 +419,7 @@ SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_ty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Error functions */
|
|
||||||
|
|
||||||
#define SCILAB_API_ARGUMENT_ERROR 999
|
|
||||||
|
|
||||||
SWIGINTERN const char*
|
|
||||||
SWIG_Scilab_ErrorType(int code) {
|
|
||||||
switch(code) {
|
|
||||||
case SWIG_MemoryError:
|
|
||||||
return "MemoryError";
|
|
||||||
case SWIG_IOError:
|
|
||||||
return "IOError";
|
|
||||||
case SWIG_RuntimeError:
|
|
||||||
return "RuntimeError";
|
|
||||||
case SWIG_IndexError:
|
|
||||||
return "IndexError";
|
|
||||||
case SWIG_TypeError:
|
|
||||||
return "TypeError";
|
|
||||||
case SWIG_DivisionByZero:
|
|
||||||
return "ZeroDivisionError";
|
|
||||||
case SWIG_OverflowError:
|
|
||||||
return "OverflowError";
|
|
||||||
case SWIG_SyntaxError:
|
|
||||||
return "SyntaxError";
|
|
||||||
case SWIG_ValueError:
|
|
||||||
return "ValueError";
|
|
||||||
case SWIG_SystemError:
|
|
||||||
return "SystemError";
|
|
||||||
case SWIG_AttributeError:
|
|
||||||
return "AttributeError";
|
|
||||||
default:
|
|
||||||
return "RuntimeError";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code)
|
|
||||||
|
|
||||||
#ifndef SWIG_SCILAB_ERROR
|
|
||||||
#define SWIG_SCILAB_ERROR 20000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SWIGINTERN void
|
|
||||||
SWIG_Scilab_Error(int code, const char *msg)
|
|
||||||
{
|
|
||||||
Scierror(SWIG_SCILAB_ERROR - code, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg)
|
|
||||||
|
|
||||||
#define SWIG_fail return SWIG_ERROR;
|
|
||||||
|
|
||||||
SWIGRUNTIME void
|
|
||||||
SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) {
|
|
||||||
if (type) {
|
|
||||||
if (obj)
|
|
||||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj);
|
|
||||||
else
|
|
||||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SWIGRUNTIME void
|
|
||||||
SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) {
|
|
||||||
Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pointer utility functions
|
* Pointer utility functions
|
||||||
|
|
@ -451,7 +466,7 @@ int SWIG_ptr(SWIG_GatewayParameters) {
|
||||||
}
|
}
|
||||||
SWIG_Scilab_SetOutputPosition(1);
|
SWIG_Scilab_SetOutputPosition(1);
|
||||||
return SWIG_Scilab_SetOutput(pvApiCtx,
|
return SWIG_Scilab_SetOutput(pvApiCtx,
|
||||||
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0));
|
SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0, NULL));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,45 @@
|
||||||
%insert(runtime) "swigrun.swg";
|
%insert(runtime) "swigrun.swg";
|
||||||
%insert(runtime) "swigerrors.swg";
|
%insert(runtime) "swigerrors.swg";
|
||||||
|
|
||||||
#define %scilabcode %insert("scilab")
|
|
||||||
|
|
||||||
%insert(runtime) "scirun.swg";
|
%insert(runtime) "scirun.swg";
|
||||||
|
|
||||||
%init %{
|
%insert(init) %{
|
||||||
|
/* Module management functions */
|
||||||
|
|
||||||
#define SWIG_GetModule(clientdata) SWIG_Scilab_GetModule()
|
#define SWIG_GetModule(clientdata) SWIG_Scilab_GetModule()
|
||||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Scilab_SetModule(pointer)
|
#define SWIG_SetModule(clientdata, pointer) SWIG_Scilab_SetModule(pointer)
|
||||||
|
|
||||||
SWIGRUNTIME swig_module_info*
|
SWIGRUNTIME swig_module_info*
|
||||||
SWIG_Scilab_GetModule(void)
|
SWIG_Scilab_GetModule(void) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME void
|
SWIGRUNTIME void
|
||||||
SWIG_Scilab_SetModule(swig_module_info *swig_module)
|
SWIG_Scilab_SetModule(swig_module_info *swig_module) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%insert(init) "swiginit.swg"
|
%insert(init) "swiginit.swg"
|
||||||
|
|
||||||
%init %{
|
%insert(init) %{
|
||||||
|
SWIGRUNTIME swig_type_info *
|
||||||
|
SWIG_Scilab_TypeQuery(const char *name) {
|
||||||
|
if (SWIG_Module_Initialized()) {
|
||||||
|
return SWIG_TypeQuery(name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SWIG_Error(SWIG_RuntimeError, "the module is not initialized");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%insert(init) %{
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
int <module>_Init(SWIG_GatewayParameters) {
|
int <module>_Init(SWIG_GatewayParameters) {
|
||||||
SWIG_InitializeModule(NULL);
|
SWIG_InitializeModule(NULL);
|
||||||
SWIG_CreateScilabVariables(pvApiCtx);
|
SWIG_CreateScilabVariables(pvApiCtx);
|
||||||
|
swig_module_initialized = 1;
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ SWIG_FromSet_Sequence_dec(bool)(int size, int *pSequence) {
|
||||||
|
|
||||||
SWIGINTERN bool
|
SWIGINTERN bool
|
||||||
SWIG_AsVal_SequenceItem_dec(bool)(SwigSciObject obj, int *pSequence, int iItemIndex) {
|
SWIG_AsVal_SequenceItem_dec(bool)(SwigSciObject obj, int *pSequence, int iItemIndex) {
|
||||||
return pSequence[iItemIndex];
|
return (bool) pSequence[iItemIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
*char
|
*
|
||||||
* Scilab matrix of string <-> C++ std::string container
|
* Scilab matrix of string <-> C++ std::string container
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -88,7 +88,7 @@ SWIG_AsVal_SequenceItem_dec(std::string)(SwigSciObject obj, char **pSequence, in
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_From_SequenceItem_dec(std::string)(char **pSequence, int iItemIndex, std::string itemValue) {
|
SWIG_From_SequenceItem_dec(std::string)(char **pSequence, int iItemIndex, std::string itemValue) {
|
||||||
char *pChar = new char(itemValue.size() + 1);
|
char *pChar = new char((int) itemValue.size() + 1);
|
||||||
strcpy(pChar, itemValue.c_str());
|
strcpy(pChar, itemValue.c_str());
|
||||||
pSequence[iItemIndex] = pChar;
|
pSequence[iItemIndex] = pChar;
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@
|
||||||
// to use a pointer to the smart pointer of the type, rather than the usual pointer to the underlying type.
|
// to use a pointer to the smart pointer of the type, rather than the usual pointer to the underlying type.
|
||||||
// So for some type T, shared_ptr<T> * is used rather than T *.
|
// So for some type T, shared_ptr<T> * is used rather than T *.
|
||||||
|
|
||||||
|
// Another key part of the implementation is the smartptr feature:
|
||||||
|
// %feature("smartptr") T { shared_ptr<T> }
|
||||||
|
// This feature marks the class T as having a smartptr to it (the shared_ptr<T> type). This is then used to
|
||||||
|
// support smart pointers and inheritance. Say class D derives from base B, then shared_ptr<D> is marked
|
||||||
|
// with a fake inheritance from shared_ptr<B> in the type system if the "smartptr" feature is used on both
|
||||||
|
// B and D. This is to emulate the conversion of shared_ptr<D> to shared_ptr<B> in the target language.
|
||||||
|
|
||||||
// shared_ptr namespaces could be boost or std or std::tr1
|
// shared_ptr namespaces could be boost or std or std::tr1
|
||||||
// For example for std::tr1, use:
|
// For example for std::tr1, use:
|
||||||
// #define SWIG_SHARED_PTR_NAMESPACE std
|
// #define SWIG_SHARED_PTR_NAMESPACE std
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -15,6 +16,10 @@ namespace std {
|
||||||
virtual const char* what() const throw();
|
virtual const char* what() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct bad_cast : exception
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
struct bad_exception : exception
|
struct bad_exception : exception
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <typeinfo>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -40,6 +41,7 @@
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
%std_exception_map(bad_cast, SWIG_TypeError);
|
||||||
%std_exception_map(bad_exception, SWIG_SystemError);
|
%std_exception_map(bad_exception, SWIG_SystemError);
|
||||||
%std_exception_map(domain_error, SWIG_ValueError);
|
%std_exception_map(domain_error, SWIG_ValueError);
|
||||||
%std_exception_map(exception, SWIG_SystemError);
|
%std_exception_map(exception, SWIG_SystemError);
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@
|
||||||
* This macro is used to return Character data along with a size
|
* This macro is used to return Character data along with a size
|
||||||
* parameter.
|
* parameter.
|
||||||
*
|
*
|
||||||
* %cstring_output_maxsize(Char *outx, int *max) {
|
* %cstring_output_withsize(Char *outx, int *max) {
|
||||||
* void foo(Char *outx, int *max) {
|
* void foo(Char *outx, int *max) {
|
||||||
* sprintf(outx,"blah blah\n");
|
* sprintf(outx,"blah blah\n");
|
||||||
* *max = strlen(outx);
|
* *max = strlen(outx);
|
||||||
|
|
@ -236,7 +236,7 @@
|
||||||
* This macro is used to return Character data that was
|
* This macro is used to return Character data that was
|
||||||
* allocated with new or malloc.
|
* allocated with new or malloc.
|
||||||
*
|
*
|
||||||
* %cstring_output_allocated(Char **outx, free($1));
|
* %cstring_output_allocate(Char **outx, free($1));
|
||||||
* void foo(Char **outx) {
|
* void foo(Char **outx) {
|
||||||
* *outx = (Char *) malloc(512);
|
* *outx = (Char *) malloc(512);
|
||||||
* sprintf(outx,"blah blah\n");
|
* sprintf(outx,"blah blah\n");
|
||||||
|
|
@ -263,7 +263,7 @@
|
||||||
* This macro is used to return Character data that was
|
* This macro is used to return Character data that was
|
||||||
* allocated with new or malloc.
|
* allocated with new or malloc.
|
||||||
*
|
*
|
||||||
* %cstring_output_allocated(Char **outx, int *sz, free($1));
|
* %cstring_output_allocate_size(Char **outx, int *sz, free($1));
|
||||||
* void foo(Char **outx, int *sz) {
|
* void foo(Char **outx, int *sz) {
|
||||||
* *outx = (Char *) malloc(512);
|
* *outx = (Char *) malloc(512);
|
||||||
* sprintf(outx,"blah blah\n");
|
* sprintf(outx,"blah blah\n");
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
%std_exception_map(bad_cast, SWIG_TypeError);
|
||||||
%std_exception_map(bad_exception, SWIG_SystemError);
|
%std_exception_map(bad_exception, SWIG_SystemError);
|
||||||
%std_exception_map(domain_error, SWIG_ValueError);
|
%std_exception_map(domain_error, SWIG_ValueError);
|
||||||
%std_exception_map(exception, SWIG_SystemError);
|
%std_exception_map(exception, SWIG_SystemError);
|
||||||
|
|
|
||||||
|
|
@ -2722,6 +2722,13 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See if there is any return cleanup code */
|
||||||
|
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||||
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
|
Printf(f->code, "%s\n", tm);
|
||||||
|
Delete(tm);
|
||||||
|
}
|
||||||
|
|
||||||
emit_return_variable(n, t, f);
|
emit_return_variable(n, t, f);
|
||||||
|
|
||||||
if (CPlusPlus) {
|
if (CPlusPlus) {
|
||||||
|
|
|
||||||
|
|
@ -543,6 +543,14 @@ int CFFI::functionWrapper(Node *n) {
|
||||||
|
|
||||||
cleanupFunction(n, f, parms);
|
cleanupFunction(n, f, parms);
|
||||||
|
|
||||||
|
/* See if there is any return cleanup code */
|
||||||
|
String *tm = 0;
|
||||||
|
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||||
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
|
Printf(f->code, "%s\n", tm);
|
||||||
|
Delete(tm);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_void_return) {
|
if (!is_void_return) {
|
||||||
Printf(f->code, " return lresult;\n");
|
Printf(f->code, " return lresult;\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2445,7 +2445,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
String *code = Copy(Getattr(n, "wrap:action"));
|
String *code = Copy(Getattr(n, "wrap:action"));
|
||||||
Replaceall(code, Getattr(parms, "lname"), current);
|
Replace(code, Getattr(parms, "lname"), current, DOH_REPLACE_ANY | DOH_REPLACE_ID);
|
||||||
|
Delete(current);
|
||||||
Printv(actioncode, code, "\n", NULL);
|
Printv(actioncode, code, "\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2598,6 +2599,14 @@ private:
|
||||||
Replaceall(f->code, "$cleanup", cleanup);
|
Replaceall(f->code, "$cleanup", cleanup);
|
||||||
Delete(cleanup);
|
Delete(cleanup);
|
||||||
|
|
||||||
|
/* See if there is any return cleanup code */
|
||||||
|
String *tm;
|
||||||
|
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||||
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
|
Printf(f->code, "%s\n", tm);
|
||||||
|
Delete(tm);
|
||||||
|
}
|
||||||
|
|
||||||
Replaceall(f->code, "$symname", Getattr(n, "sym:name"));
|
Replaceall(f->code, "$symname", Getattr(n, "sym:name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1354,6 +1354,11 @@ void JSEmitter::emitCleanupCode(Node *n, Wrapper *wrapper, ParmList *params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See if there is any return cleanup code */
|
||||||
|
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||||
|
Printf(wrapper->code, "%s\n", tm);
|
||||||
|
Delete(tm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int JSEmitter::switchNamespace(Node *n) {
|
int JSEmitter::switchNamespace(Node *n) {
|
||||||
|
|
|
||||||
|
|
@ -676,6 +676,14 @@ public:
|
||||||
Printv(f->code, tm, "\n", NIL);
|
Printv(f->code, tm, "\n", NIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See if there is any return cleanup code */
|
||||||
|
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||||
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
|
Printf(f->code, "%s\n", tm);
|
||||||
|
Delete(tm);
|
||||||
|
}
|
||||||
|
|
||||||
// Free any memory allocated by the function being wrapped..
|
// Free any memory allocated by the function being wrapped..
|
||||||
|
|
||||||
if ((tm = Swig_typemap_lookup("swig_result", n, Swig_cresult_name(), 0))) {
|
if ((tm = Swig_typemap_lookup("swig_result", n, Swig_cresult_name(), 0))) {
|
||||||
|
|
|
||||||
|
|
@ -1000,6 +1000,7 @@ public:
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Printf(f->code, "thrown:\n");
|
||||||
Printf(f->code, "return;\n");
|
Printf(f->code, "return;\n");
|
||||||
|
|
||||||
/* Error handling code */
|
/* Error handling code */
|
||||||
|
|
@ -2356,6 +2357,7 @@ done:
|
||||||
Append(f->code, actioncode);
|
Append(f->code, actioncode);
|
||||||
Delete(actioncode);
|
Delete(actioncode);
|
||||||
|
|
||||||
|
Printf(f->code, "thrown:\n");
|
||||||
Append(f->code, "return;\n");
|
Append(f->code, "return;\n");
|
||||||
Append(f->code, "fail:\n");
|
Append(f->code, "fail:\n");
|
||||||
Append(f->code, "SWIG_FAIL(TSRMLS_C);\n");
|
Append(f->code, "SWIG_FAIL(TSRMLS_C);\n");
|
||||||
|
|
@ -2623,6 +2625,7 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exception handling */
|
/* exception handling */
|
||||||
|
bool error_used_in_typemap = false;
|
||||||
tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
|
tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
|
||||||
if (!tm) {
|
if (!tm) {
|
||||||
tm = Getattr(n, "feature:director:except");
|
tm = Getattr(n, "feature:director:except");
|
||||||
|
|
@ -2632,6 +2635,7 @@ done:
|
||||||
if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) {
|
if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) {
|
||||||
if (Replaceall(tm, "$error", "error")) {
|
if (Replaceall(tm, "$error", "error")) {
|
||||||
/* Only declare error if it is used by the typemap. */
|
/* Only declare error if it is used by the typemap. */
|
||||||
|
error_used_in_typemap = true;
|
||||||
Append(w->code, "int error;\n");
|
Append(w->code, "int error;\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2655,6 +2659,9 @@ done:
|
||||||
/* wrap complex arguments to zvals */
|
/* wrap complex arguments to zvals */
|
||||||
Printv(w->code, wrap_args, NIL);
|
Printv(w->code, wrap_args, NIL);
|
||||||
|
|
||||||
|
if (error_used_in_typemap) {
|
||||||
|
Append(w->code, "error = ");
|
||||||
|
}
|
||||||
Append(w->code, "call_user_function(EG(function_table), (zval**)&swig_self, &funcname,");
|
Append(w->code, "call_user_function(EG(function_table), (zval**)&swig_self, &funcname,");
|
||||||
Printf(w->code, " %s, %d, args TSRMLS_CC);\n", Swig_cresult_name(), idx);
|
Printf(w->code, " %s, %d, args TSRMLS_CC);\n", Swig_cresult_name(), idx);
|
||||||
|
|
||||||
|
|
@ -2715,6 +2722,7 @@ done:
|
||||||
Delete(outarg);
|
Delete(outarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Append(w->code, "thrown:\n");
|
||||||
if (!is_void) {
|
if (!is_void) {
|
||||||
if (!(ignored_method && !pure_virtual)) {
|
if (!(ignored_method && !pure_virtual)) {
|
||||||
String *rettype = SwigType_str(returntype, 0);
|
String *rettype = SwigType_str(returntype, 0);
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,13 @@ static Hash *f_shadow_imports = 0;
|
||||||
static String *f_shadow_builtin_imports = 0;
|
static String *f_shadow_builtin_imports = 0;
|
||||||
static String *f_shadow_stubs = 0;
|
static String *f_shadow_stubs = 0;
|
||||||
static Hash *builtin_getset = 0;
|
static Hash *builtin_getset = 0;
|
||||||
|
static Hash *builtin_closures = 0;
|
||||||
static Hash *class_members = 0;
|
static Hash *class_members = 0;
|
||||||
static File *f_builtins = 0;
|
static File *f_builtins = 0;
|
||||||
static String *builtin_tp_init = 0;
|
static String *builtin_tp_init = 0;
|
||||||
static String *builtin_methods = 0;
|
static String *builtin_methods = 0;
|
||||||
static String *builtin_default_unref = 0;
|
static String *builtin_default_unref = 0;
|
||||||
|
static String *builtin_closures_code = 0;
|
||||||
|
|
||||||
static String *methods;
|
static String *methods;
|
||||||
static String *class_name;
|
static String *class_name;
|
||||||
|
|
@ -167,18 +169,18 @@ static const char *usage3 = "\
|
||||||
Function annotation \n\
|
Function annotation \n\
|
||||||
\n";
|
\n";
|
||||||
|
|
||||||
static String *getSlot(Node *n = NULL, const char *key = NULL) {
|
static String *getSlot(Node *n = NULL, const char *key = NULL, String *default_slot = NULL) {
|
||||||
static String *slot_default = NewString("0");
|
static String *zero = NewString("0");
|
||||||
String *val = key && *key ? Getattr(n, key) : NULL;
|
String *val = n && key && *key ? Getattr(n, key) : NULL;
|
||||||
return val ? val : slot_default;
|
return val ? val : default_slot ? default_slot : zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printSlot(File *f, const String *slotval, const char *slotname, const char *functype = NULL) {
|
static void printSlot(File *f, String *slotval, const char *slotname, const char *functype = NULL) {
|
||||||
String *slotval_override = functype ? NewStringf("(%s) %s", functype, slotval) : 0;
|
String *slotval_override = 0;
|
||||||
if (slotval_override)
|
if (functype)
|
||||||
slotval = slotval_override;
|
slotval = slotval_override = NewStringf("(%s) %s", functype, slotval);
|
||||||
int len = Len(slotval);
|
int len = Len(slotval);
|
||||||
int fieldwidth = len > 40 ? 0 : 40 - len;
|
int fieldwidth = len > 41 ? (len > 61 ? 0 : 61 - len) : 41 - len;
|
||||||
Printf(f, " %s,%*s/* %s */\n", slotval, fieldwidth, "", slotname);
|
Printf(f, " %s,%*s/* %s */\n", slotval, fieldwidth, "", slotname);
|
||||||
Delete(slotval_override);
|
Delete(slotval_override);
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +190,7 @@ static String *getClosure(String *functype, String *wrapper, int funpack = 0) {
|
||||||
"unaryfunc", "SWIGPY_UNARYFUNC_CLOSURE",
|
"unaryfunc", "SWIGPY_UNARYFUNC_CLOSURE",
|
||||||
"destructor", "SWIGPY_DESTRUCTOR_CLOSURE",
|
"destructor", "SWIGPY_DESTRUCTOR_CLOSURE",
|
||||||
"inquiry", "SWIGPY_INQUIRY_CLOSURE",
|
"inquiry", "SWIGPY_INQUIRY_CLOSURE",
|
||||||
"getiterfunc", "SWIGPY_UNARYFUNC_CLOSURE",
|
"getiterfunc", "SWIGPY_GETITERFUNC_CLOSURE",
|
||||||
"binaryfunc", "SWIGPY_BINARYFUNC_CLOSURE",
|
"binaryfunc", "SWIGPY_BINARYFUNC_CLOSURE",
|
||||||
"ternaryfunc", "SWIGPY_TERNARYFUNC_CLOSURE",
|
"ternaryfunc", "SWIGPY_TERNARYFUNC_CLOSURE",
|
||||||
"ternarycallfunc", "SWIGPY_TERNARYCALLFUNC_CLOSURE",
|
"ternarycallfunc", "SWIGPY_TERNARYCALLFUNC_CLOSURE",
|
||||||
|
|
@ -200,7 +202,7 @@ static String *getClosure(String *functype, String *wrapper, int funpack = 0) {
|
||||||
"objobjargproc", "SWIGPY_OBJOBJARGPROC_CLOSURE",
|
"objobjargproc", "SWIGPY_OBJOBJARGPROC_CLOSURE",
|
||||||
"reprfunc", "SWIGPY_REPRFUNC_CLOSURE",
|
"reprfunc", "SWIGPY_REPRFUNC_CLOSURE",
|
||||||
"hashfunc", "SWIGPY_HASHFUNC_CLOSURE",
|
"hashfunc", "SWIGPY_HASHFUNC_CLOSURE",
|
||||||
"iternextfunc", "SWIGPY_ITERNEXT_CLOSURE",
|
"iternextfunc", "SWIGPY_ITERNEXTFUNC_CLOSURE",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -208,7 +210,7 @@ static String *getClosure(String *functype, String *wrapper, int funpack = 0) {
|
||||||
"unaryfunc", "SWIGPY_UNARYFUNC_CLOSURE",
|
"unaryfunc", "SWIGPY_UNARYFUNC_CLOSURE",
|
||||||
"destructor", "SWIGPY_DESTRUCTOR_CLOSURE",
|
"destructor", "SWIGPY_DESTRUCTOR_CLOSURE",
|
||||||
"inquiry", "SWIGPY_INQUIRY_CLOSURE",
|
"inquiry", "SWIGPY_INQUIRY_CLOSURE",
|
||||||
"getiterfunc", "SWIGPY_UNARYFUNC_CLOSURE",
|
"getiterfunc", "SWIGPY_GETITERFUNC_CLOSURE",
|
||||||
"ternaryfunc", "SWIGPY_TERNARYFUNC_CLOSURE",
|
"ternaryfunc", "SWIGPY_TERNARYFUNC_CLOSURE",
|
||||||
"ternarycallfunc", "SWIGPY_TERNARYCALLFUNC_CLOSURE",
|
"ternarycallfunc", "SWIGPY_TERNARYCALLFUNC_CLOSURE",
|
||||||
"lenfunc", "SWIGPY_LENFUNC_CLOSURE",
|
"lenfunc", "SWIGPY_LENFUNC_CLOSURE",
|
||||||
|
|
@ -219,7 +221,7 @@ static String *getClosure(String *functype, String *wrapper, int funpack = 0) {
|
||||||
"objobjargproc", "SWIGPY_OBJOBJARGPROC_CLOSURE",
|
"objobjargproc", "SWIGPY_OBJOBJARGPROC_CLOSURE",
|
||||||
"reprfunc", "SWIGPY_REPRFUNC_CLOSURE",
|
"reprfunc", "SWIGPY_REPRFUNC_CLOSURE",
|
||||||
"hashfunc", "SWIGPY_HASHFUNC_CLOSURE",
|
"hashfunc", "SWIGPY_HASHFUNC_CLOSURE",
|
||||||
"iternextfunc", "SWIGPY_ITERNEXT_CLOSURE",
|
"iternextfunc", "SWIGPY_ITERNEXTFUNC_CLOSURE",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -626,6 +628,8 @@ public:
|
||||||
f_directors_h = NewString("");
|
f_directors_h = NewString("");
|
||||||
f_directors = NewString("");
|
f_directors = NewString("");
|
||||||
builtin_getset = NewHash();
|
builtin_getset = NewHash();
|
||||||
|
builtin_closures = NewHash();
|
||||||
|
builtin_closures_code = NewString("");
|
||||||
class_members = NewHash();
|
class_members = NewHash();
|
||||||
builtin_methods = NewString("");
|
builtin_methods = NewString("");
|
||||||
builtin_default_unref = NewString("delete $self;");
|
builtin_default_unref = NewString("delete $self;");
|
||||||
|
|
@ -861,12 +865,13 @@ public:
|
||||||
/* At here, the module may already loaded, so simply import it. */
|
/* At here, the module may already loaded, so simply import it. */
|
||||||
Printf(f_shadow, tab4 tab8 "import %s\n", module);
|
Printf(f_shadow, tab4 tab8 "import %s\n", module);
|
||||||
Printf(f_shadow, tab4 tab8 "return %s\n", module);
|
Printf(f_shadow, tab4 tab8 "return %s\n", module);
|
||||||
Printv(f_shadow, tab8 "if fp is not None:\n", NULL);
|
Printv(f_shadow, tab8 "try:\n", NULL);
|
||||||
Printv(f_shadow, tab4 tab8 "try:\n", NULL);
|
/* imp.load_module() handles fp being None. */
|
||||||
Printf(f_shadow, tab8 tab8 "_mod = imp.load_module('%s', fp, pathname, description)\n", module);
|
Printf(f_shadow, tab4 tab8 "_mod = imp.load_module('%s', fp, pathname, description)\n", module);
|
||||||
Printv(f_shadow, tab4 tab8, "finally:\n", NULL);
|
Printv(f_shadow, tab8, "finally:\n", NULL);
|
||||||
|
Printv(f_shadow, tab4 tab8 "if fp is not None:\n", NULL);
|
||||||
Printv(f_shadow, tab8 tab8, "fp.close()\n", NULL);
|
Printv(f_shadow, tab8 tab8, "fp.close()\n", NULL);
|
||||||
Printv(f_shadow, tab4 tab8, "return _mod\n", NULL);
|
Printv(f_shadow, tab8, "return _mod\n", NULL);
|
||||||
Printf(f_shadow, tab4 "%s = swig_import_helper()\n", module);
|
Printf(f_shadow, tab4 "%s = swig_import_helper()\n", module);
|
||||||
Printv(f_shadow, tab4, "del swig_import_helper\n", NULL);
|
Printv(f_shadow, tab4, "del swig_import_helper\n", NULL);
|
||||||
Printv(f_shadow, "else:\n", NULL);
|
Printv(f_shadow, "else:\n", NULL);
|
||||||
|
|
@ -3321,17 +3326,18 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_class && builtin) {
|
if (in_class && builtin) {
|
||||||
/* Handle operator overloads overloads for builtin types */
|
/* Handle operator overloads for builtin types */
|
||||||
String *slot = Getattr(n, "feature:python:slot");
|
String *slot = Getattr(n, "feature:python:slot");
|
||||||
if (slot) {
|
if (slot) {
|
||||||
String *func_type = Getattr(n, "feature:python:slot:functype");
|
String *func_type = Getattr(n, "feature:python:slot:functype");
|
||||||
String *closure_decl = getClosure(func_type, wrapper_name, overname ? 0 : funpack);
|
String *closure_decl = getClosure(func_type, wrapper_name, overname ? 0 : funpack);
|
||||||
String *feature_name = NewStringf("feature:python:%s", slot);
|
String *feature_name = NewStringf("feature:python:%s", slot);
|
||||||
String *closure_name = Copy(wrapper_name);
|
String *closure_name = 0;
|
||||||
if (closure_decl) {
|
if (closure_decl) {
|
||||||
if (!Getattr(n, "sym:overloaded") || !Getattr(n, "sym:nextSibling"))
|
closure_name = NewStringf("%s_%s_closure", wrapper_name, func_type);
|
||||||
Printv(f_wrappers, closure_decl, "\n\n", NIL);
|
if (!GetFlag(builtin_closures, closure_name))
|
||||||
Append(closure_name, "_closure");
|
Printf(builtin_closures_code, "%s /* defines %s */\n\n", closure_decl, closure_name);
|
||||||
|
SetFlag(builtin_closures, closure_name);
|
||||||
Delete(closure_decl);
|
Delete(closure_decl);
|
||||||
}
|
}
|
||||||
if (func_type) {
|
if (func_type) {
|
||||||
|
|
@ -3919,7 +3925,6 @@ public:
|
||||||
int funpack = modernargs && fastunpack;
|
int funpack = modernargs && fastunpack;
|
||||||
|
|
||||||
Printv(f_init, " SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);\n", NIL);
|
Printv(f_init, " SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);\n", NIL);
|
||||||
Printf(f_init, " builtin_pytype->tp_new = PyType_GenericNew;\n");
|
|
||||||
Printv(f_init, " builtin_base_count = 0;\n", NIL);
|
Printv(f_init, " builtin_base_count = 0;\n", NIL);
|
||||||
List *baselist = Getattr(n, "bases");
|
List *baselist = Getattr(n, "bases");
|
||||||
if (baselist) {
|
if (baselist) {
|
||||||
|
|
@ -3956,13 +3961,7 @@ public:
|
||||||
// Check for non-public destructor, in which case tp_dealloc will issue
|
// Check for non-public destructor, in which case tp_dealloc will issue
|
||||||
// a warning and allow the memory to leak. Any class that doesn't explicitly
|
// a warning and allow the memory to leak. Any class that doesn't explicitly
|
||||||
// have a private/protected destructor has an implicit public destructor.
|
// have a private/protected destructor has an implicit public destructor.
|
||||||
String *tp_dealloc = Getattr(n, "feature:python:tp_dealloc");
|
static String *tp_dealloc_bad = NewString("SwigPyBuiltin_BadDealloc");
|
||||||
if (tp_dealloc) {
|
|
||||||
Printf(f, "SWIGPY_DESTRUCTOR_CLOSURE(%s)\n", tp_dealloc);
|
|
||||||
tp_dealloc = NewStringf("%s_closure", tp_dealloc);
|
|
||||||
} else {
|
|
||||||
tp_dealloc = NewString("SwigPyBuiltin_BadDealloc");
|
|
||||||
}
|
|
||||||
|
|
||||||
String *getset_name = NewStringf("%s_getset", templ);
|
String *getset_name = NewStringf("%s_getset", templ);
|
||||||
String *methods_name = NewStringf("%s_methods", templ);
|
String *methods_name = NewStringf("%s_methods", templ);
|
||||||
|
|
@ -4057,10 +4056,18 @@ public:
|
||||||
quoted_symname = NewStringf("\"%s\"", symname);
|
quoted_symname = NewStringf("\"%s\"", symname);
|
||||||
}
|
}
|
||||||
String *quoted_tp_doc_str = NewStringf("\"%s\"", getSlot(n, "feature:python:tp_doc"));
|
String *quoted_tp_doc_str = NewStringf("\"%s\"", getSlot(n, "feature:python:tp_doc"));
|
||||||
char const *tp_init = builtin_tp_init ? Char(builtin_tp_init) : Swig_directorclass(n) ? "0" : "SwigPyBuiltin_BadInit";
|
String *tp_init = NewString(builtin_tp_init ? Char(builtin_tp_init) : Swig_directorclass(n) ? "0" : "SwigPyBuiltin_BadInit");
|
||||||
String *tp_flags = NewString("Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES");
|
String *tp_flags = NewString("Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES");
|
||||||
String *py3_tp_flags = NewString("Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE");
|
String *tp_flags_py3 = NewString("Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE");
|
||||||
|
|
||||||
|
static String *tp_basicsize = NewStringf("sizeof(SwigPyObject)");
|
||||||
|
static String *tp_dictoffset_default = NewString("offsetof(SwigPyObject, dict)");
|
||||||
|
static String *tp_new = NewString("PyType_GenericNew");
|
||||||
|
static String *tp_hash = NewString("SwigPyObject_hash");
|
||||||
|
String *tp_as_number = NewStringf("&%s_type.as_number", templ);
|
||||||
|
String *tp_as_sequence = NewStringf("&%s_type.as_sequence", templ);
|
||||||
|
String *tp_as_mapping = NewStringf("&%s_type.as_mapping", templ);
|
||||||
|
String *tp_as_buffer = NewStringf("&%s_type.as_buffer", templ);
|
||||||
|
|
||||||
Printf(f, "static PyHeapTypeObject %s_type = {\n", templ);
|
Printf(f, "static PyHeapTypeObject %s_type = {\n", templ);
|
||||||
|
|
||||||
|
|
@ -4073,9 +4080,9 @@ public:
|
||||||
printSlot(f, getSlot(), "ob_size");
|
printSlot(f, getSlot(), "ob_size");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
printSlot(f, quoted_symname, "tp_name");
|
printSlot(f, quoted_symname, "tp_name");
|
||||||
printSlot(f, "sizeof(SwigPyObject)", "tp_basicsize");
|
printSlot(f, getSlot(n, "feature:python:tp_basicsize", tp_basicsize), "tp_basicsize");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_itemsize"), "tp_itemsize");
|
printSlot(f, getSlot(n, "feature:python:tp_itemsize"), "tp_itemsize");
|
||||||
printSlot(f, tp_dealloc, "tp_dealloc", "destructor");
|
printSlot(f, getSlot(n, "feature:python:tp_dealloc", tp_dealloc_bad), "tp_dealloc", "destructor");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_print"), "tp_print", "printfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_print"), "tp_print", "printfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_getattr"), "tp_getattr", "getattrfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_getattr"), "tp_getattr", "getattrfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_setattr"), "tp_setattr", "setattrfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_setattr"), "tp_setattr", "setattrfunc");
|
||||||
|
|
@ -4085,46 +4092,46 @@ public:
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_compare"), "tp_compare", "cmpfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_compare"), "tp_compare", "cmpfunc");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_repr"), "tp_repr", "reprfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_repr"), "tp_repr", "reprfunc");
|
||||||
Printf(f, " &%s_type.as_number, /* tp_as_number */\n", templ);
|
printSlot(f, getSlot(n, "feature:python:tp_as_number", tp_as_number), "tp_as_number");
|
||||||
Printf(f, " &%s_type.as_sequence, /* tp_as_sequence */\n", templ);
|
printSlot(f, getSlot(n, "feature:python:tp_as_sequence", tp_as_sequence), "tp_as_sequence");
|
||||||
Printf(f, " &%s_type.as_mapping, /* tp_as_mapping */\n", templ);
|
printSlot(f, getSlot(n, "feature:python:tp_as_mapping", tp_as_mapping), "tp_as_mapping");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_hash"), "tp_hash", "hashfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_hash", tp_hash), "tp_hash", "hashfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_call"), "tp_call", "ternaryfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_call"), "tp_call", "ternaryfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_str"), "tp_str", "reprfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_str"), "tp_str", "reprfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_getattro"), "tp_getattro", "getattrofunc");
|
printSlot(f, getSlot(n, "feature:python:tp_getattro"), "tp_getattro", "getattrofunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_setattro"), "tp_setattro", "setattrofunc");
|
printSlot(f, getSlot(n, "feature:python:tp_setattro"), "tp_setattro", "setattrofunc");
|
||||||
Printf(f, " &%s_type.as_buffer, /* tp_as_buffer */\n", templ);
|
printSlot(f, getSlot(n, "feature:python:tp_as_buffer", tp_as_buffer), "tp_as_buffer");
|
||||||
Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL);
|
Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL);
|
||||||
printSlot(f, py3_tp_flags, "tp_flags");
|
printSlot(f, getSlot(n, "feature:python:tp_flags", tp_flags_py3), "tp_flags");
|
||||||
Printv(f, "#else\n", NIL);
|
Printv(f, "#else\n", NIL);
|
||||||
printSlot(f, tp_flags, "tp_flags");
|
printSlot(f, getSlot(n, "feature:python:tp_flags", tp_flags), "tp_flags");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
printSlot(f, quoted_tp_doc_str, "tp_doc");
|
printSlot(f, quoted_tp_doc_str, "tp_doc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_traverse"), "tp_traverse", "traverseproc");
|
printSlot(f, getSlot(n, "feature:python:tp_traverse"), "tp_traverse", "traverseproc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_clear"), "tp_clear", "inquiry");
|
printSlot(f, getSlot(n, "feature:python:tp_clear"), "tp_clear", "inquiry");
|
||||||
printSlot(f, richcompare_func, "feature:python:tp_richcompare", "richcmpfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_richcompare", richcompare_func), "tp_richcompare", "richcmpfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_weaklistoffset"), "tp_weaklistoffset");
|
printSlot(f, getSlot(n, "feature:python:tp_weaklistoffset"), "tp_weaklistoffset");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_iter"), "tp_iter", "getiterfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_iter"), "tp_iter", "getiterfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_iternext"), "tp_iternext", "iternextfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_iternext"), "tp_iternext", "iternextfunc");
|
||||||
printSlot(f, methods_name, "tp_methods");
|
printSlot(f, getSlot(n, "feature:python:tp_methods", methods_name), "tp_methods");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_members"), "tp_members");
|
printSlot(f, getSlot(n, "feature:python:tp_members"), "tp_members");
|
||||||
printSlot(f, getset_name, "tp_getset");
|
printSlot(f, getSlot(n, "feature:python:tp_getset", getset_name), "tp_getset");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_base"), "tp_base");
|
printSlot(f, getSlot(n, "feature:python:tp_base"), "tp_base");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_dict"), "tp_dict");
|
printSlot(f, getSlot(n, "feature:python:tp_dict"), "tp_dict");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_descr_get"), "tp_descr_get", "descrgetfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_descr_get"), "tp_descr_get", "descrgetfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_descr_set"), "tp_descr_set", "descrsetfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_descr_set"), "tp_descr_set", "descrsetfunc");
|
||||||
Printf(f, " (Py_ssize_t)offsetof(SwigPyObject, dict), /* tp_dictoffset */\n");
|
printSlot(f, getSlot(n, "feature:python:tp_dictoffset", tp_dictoffset_default), "tp_dictoffset", "Py_ssize_t");
|
||||||
printSlot(f, tp_init, "tp_init", "initproc");
|
printSlot(f, getSlot(n, "feature:python:tp_init", tp_init), "tp_init", "initproc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_alloc"), "tp_alloc", "allocfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_alloc"), "tp_alloc", "allocfunc");
|
||||||
printSlot(f, "0", "tp_new", "newfunc");
|
printSlot(f, getSlot(n, "feature:python:tp_new", tp_new), "tp_new", "newfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_free"), "tp_free", "freefunc");
|
printSlot(f, getSlot(n, "feature:python:tp_free"), "tp_free", "freefunc");
|
||||||
printSlot(f, getSlot(), "tp_is_gc", "inquiry");
|
printSlot(f, getSlot(n, "feature:python:tp_is_gc"), "tp_is_gc", "inquiry");
|
||||||
printSlot(f, getSlot(), "tp_bases", "PyObject*");
|
printSlot(f, getSlot(n, "feature:python:tp_bases"), "tp_bases", "PyObject *");
|
||||||
printSlot(f, getSlot(), "tp_mro", "PyObject*");
|
printSlot(f, getSlot(n, "feature:python:tp_mro"), "tp_mro", "PyObject *");
|
||||||
printSlot(f, getSlot(), "tp_cache", "PyObject*");
|
printSlot(f, getSlot(n, "feature:python:tp_cache"), "tp_cache", "PyObject *");
|
||||||
printSlot(f, getSlot(), "tp_subclasses", "PyObject*");
|
printSlot(f, getSlot(n, "feature:python:tp_subclasses"), "tp_subclasses", "PyObject *");
|
||||||
printSlot(f, getSlot(), "tp_weaklist", "PyObject*");
|
printSlot(f, getSlot(n, "feature:python:tp_weaklist"), "tp_weaklist", "PyObject *");
|
||||||
printSlot(f, getSlot(), "tp_del", "destructor");
|
printSlot(f, getSlot(n, "feature:python:tp_del"), "tp_del", "destructor");
|
||||||
Printv(f, "#if PY_VERSION_HEX >= 0x02060000\n", NIL);
|
Printv(f, "#if PY_VERSION_HEX >= 0x02060000\n", NIL);
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_version_tag"), "tp_version_tag", "int");
|
printSlot(f, getSlot(n, "feature:python:tp_version_tag"), "tp_version_tag", "int");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
|
|
@ -4132,13 +4139,13 @@ public:
|
||||||
printSlot(f, getSlot(n, "feature:python:tp_finalize"), "tp_finalize", "destructor");
|
printSlot(f, getSlot(n, "feature:python:tp_finalize"), "tp_finalize", "destructor");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
Printv(f, "#ifdef COUNT_ALLOCS\n", NIL);
|
Printv(f, "#ifdef COUNT_ALLOCS\n", NIL);
|
||||||
printSlot(f, getSlot(), "tp_allocs", "Py_ssize_t");
|
printSlot(f, getSlot(n, "feature:python:tp_allocs"), "tp_allocs", "Py_ssize_t");
|
||||||
printSlot(f, getSlot(), "tp_frees", "Py_ssize_t");
|
printSlot(f, getSlot(n, "feature:python:tp_frees"), "tp_frees", "Py_ssize_t");
|
||||||
printSlot(f, getSlot(), "tp_maxalloc", "Py_ssize_t");
|
printSlot(f, getSlot(n, "feature:python:tp_maxalloc"), "tp_maxalloc", "Py_ssize_t");
|
||||||
Printv(f, "#if PY_VERSION_HEX >= 0x02050000\n", NIL);
|
Printv(f, "#if PY_VERSION_HEX >= 0x02050000\n", NIL);
|
||||||
printSlot(f, getSlot(), "tp_prev", "struct _typeobject*");
|
printSlot(f, getSlot(n, "feature:python:tp_prev"), "tp_prev");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
printSlot(f, getSlot(), "tp_next", "struct _typeobject*");
|
printSlot(f, getSlot(n, "feature:python:tp_next"), "tp_next");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
Printf(f, " },\n");
|
Printf(f, " },\n");
|
||||||
|
|
||||||
|
|
@ -4226,13 +4233,13 @@ public:
|
||||||
printSlot(f, getSlot(n, "feature:python:sq_repeat"), "sq_repeat", "ssizeargfunc");
|
printSlot(f, getSlot(n, "feature:python:sq_repeat"), "sq_repeat", "ssizeargfunc");
|
||||||
printSlot(f, getSlot(n, "feature:python:sq_item"), "sq_item", "ssizeargfunc");
|
printSlot(f, getSlot(n, "feature:python:sq_item"), "sq_item", "ssizeargfunc");
|
||||||
Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL);
|
Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL);
|
||||||
printSlot(f, getSlot(n, "feature:was_sq_slice"), "was_sq_slice", "void*");
|
printSlot(f, getSlot(n, "feature:python:was_sq_slice"), "was_sq_slice", "void *");
|
||||||
Printv(f, "#else\n", NIL);
|
Printv(f, "#else\n", NIL);
|
||||||
printSlot(f, getSlot(n, "feature:python:sq_slice"), "sq_slice", "ssizessizeargfunc");
|
printSlot(f, getSlot(n, "feature:python:sq_slice"), "sq_slice", "ssizessizeargfunc");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
printSlot(f, getSlot(n, "feature:python:sq_ass_item"), "sq_ass_item", "ssizeobjargproc");
|
printSlot(f, getSlot(n, "feature:python:sq_ass_item"), "sq_ass_item", "ssizeobjargproc");
|
||||||
Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL);
|
Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL);
|
||||||
printSlot(f, getSlot(n, "feature:was_sq_ass_slice"), "was_sq_ass_slice", "void*");
|
printSlot(f, getSlot(n, "feature:python:was_sq_ass_slice"), "was_sq_ass_slice", "void *");
|
||||||
Printv(f, "#else\n", NIL);
|
Printv(f, "#else\n", NIL);
|
||||||
printSlot(f, getSlot(n, "feature:python:sq_ass_slice"), "sq_ass_slice", "ssizessizeobjargproc");
|
printSlot(f, getSlot(n, "feature:python:sq_ass_slice"), "sq_ass_slice", "ssizessizeobjargproc");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
|
|
@ -4262,7 +4269,7 @@ public:
|
||||||
printSlot(f, getSlot(n, "feature:python:ht_qualname"), "ht_qualname", "PyObject *");
|
printSlot(f, getSlot(n, "feature:python:ht_qualname"), "ht_qualname", "PyObject *");
|
||||||
|
|
||||||
// struct _dictkeysobject *ht_cached_keys;
|
// struct _dictkeysobject *ht_cached_keys;
|
||||||
printSlot(f, getSlot(n, "feature:python:ht_cached_keys"), "ht_cached_keys", "struct _dictkeysobject*");
|
printSlot(f, getSlot(n, "feature:python:ht_cached_keys"), "ht_cached_keys");
|
||||||
Printv(f, "#endif\n", NIL);
|
Printv(f, "#endif\n", NIL);
|
||||||
Printf(f, "};\n\n");
|
Printf(f, "};\n\n");
|
||||||
|
|
||||||
|
|
@ -4306,11 +4313,15 @@ public:
|
||||||
Delete(mname);
|
Delete(mname);
|
||||||
Delete(pmname);
|
Delete(pmname);
|
||||||
Delete(templ);
|
Delete(templ);
|
||||||
Delete(tp_dealloc);
|
|
||||||
Delete(tp_flags);
|
Delete(tp_flags);
|
||||||
Delete(py3_tp_flags);
|
Delete(tp_flags_py3);
|
||||||
|
Delete(tp_as_buffer);
|
||||||
|
Delete(tp_as_mapping);
|
||||||
|
Delete(tp_as_sequence);
|
||||||
|
Delete(tp_as_number);
|
||||||
Delete(quoted_symname);
|
Delete(quoted_symname);
|
||||||
Delete(quoted_tp_doc_str);
|
Delete(quoted_tp_doc_str);
|
||||||
|
Delete(tp_init);
|
||||||
Delete(clientdata_klass);
|
Delete(clientdata_klass);
|
||||||
Delete(richcompare_func);
|
Delete(richcompare_func);
|
||||||
Delete(getset_name);
|
Delete(getset_name);
|
||||||
|
|
@ -4505,7 +4516,12 @@ public:
|
||||||
SwigType *realct = Copy(real_classname);
|
SwigType *realct = Copy(real_classname);
|
||||||
SwigType_add_pointer(realct);
|
SwigType_add_pointer(realct);
|
||||||
SwigType_remember(realct);
|
SwigType_remember(realct);
|
||||||
if (!builtin) {
|
if (builtin) {
|
||||||
|
Printv(f_wrappers, builtin_closures_code, NIL);
|
||||||
|
Delete(builtin_closures_code);
|
||||||
|
builtin_closures_code = NewString("");
|
||||||
|
Clear(builtin_closures);
|
||||||
|
} else {
|
||||||
Printv(f_wrappers, "SWIGINTERN PyObject *", class_name, "_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL);
|
Printv(f_wrappers, "SWIGINTERN PyObject *", class_name, "_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL);
|
||||||
Printv(f_wrappers, " PyObject *obj;\n", NIL);
|
Printv(f_wrappers, " PyObject *obj;\n", NIL);
|
||||||
if (modernargs) {
|
if (modernargs) {
|
||||||
|
|
@ -4967,12 +4983,10 @@ public:
|
||||||
|
|
||||||
if (builtin && in_class) {
|
if (builtin && in_class) {
|
||||||
Node *cls = Swig_methodclass(n);
|
Node *cls = Swig_methodclass(n);
|
||||||
|
// Use the destructor for the tp_dealloc slot unless a user overrides it with another method
|
||||||
if (!Getattr(cls, "feature:python:tp_dealloc")) {
|
if (!Getattr(cls, "feature:python:tp_dealloc")) {
|
||||||
String *dealloc = Swig_name_destroy(NSPACE_TODO, symname);
|
Setattr(n, "feature:python:slot", "tp_dealloc");
|
||||||
String *wdealloc = Swig_name_wrapper(dealloc);
|
Setattr(n, "feature:python:slot:functype", "destructor");
|
||||||
Setattr(cls, "feature:python:tp_dealloc", wdealloc);
|
|
||||||
Delete(wdealloc);
|
|
||||||
Delete(dealloc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2097,6 +2097,13 @@ int R::functionWrapper(Node *n) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See if there is any return cleanup code */
|
||||||
|
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||||
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
|
Printf(f->code, "%s\n", tm);
|
||||||
|
Delete(tm);
|
||||||
|
}
|
||||||
|
|
||||||
Printv(f->code, UnProtectWrapupCode, NIL);
|
Printv(f->code, UnProtectWrapupCode, NIL);
|
||||||
|
|
||||||
/*If the user gave us something to convert the result in */
|
/*If the user gave us something to convert the result in */
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,7 @@ public:
|
||||||
emit_return_variable(node, functionReturnType, wrapper);
|
emit_return_variable(node, functionReturnType, wrapper);
|
||||||
|
|
||||||
/* Return the function value if necessary */
|
/* Return the function value if necessary */
|
||||||
String *functionReturnTypemap = Swig_typemap_lookup_out("out", node, "result", wrapper, functionActionCode);
|
String *functionReturnTypemap = Swig_typemap_lookup_out("out", node, Swig_cresult_name(), wrapper, functionActionCode);
|
||||||
if (functionReturnTypemap) {
|
if (functionReturnTypemap) {
|
||||||
// Result is actually the position of output value on stack
|
// Result is actually the position of output value on stack
|
||||||
if (Len(functionReturnTypemap) > 0) {
|
if (Len(functionReturnTypemap) > 0) {
|
||||||
|
|
@ -471,6 +471,13 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See if there is any return cleanup code */
|
||||||
|
String *tm;
|
||||||
|
if ((tm = Swig_typemap_lookup("ret", node, Swig_cresult_name(), 0))) {
|
||||||
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
|
Printf(wrapper->code, "%s\n", tm);
|
||||||
|
Delete(tm);
|
||||||
|
}
|
||||||
|
|
||||||
/* Close the function(ok) */
|
/* Close the function(ok) */
|
||||||
Printv(wrapper->code, "return SWIG_OK;\n", NIL);
|
Printv(wrapper->code, "return SWIG_OK;\n", NIL);
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,8 @@ public:
|
||||||
Xml_print_kwargs(Getattr(obj, k));
|
Xml_print_kwargs(Getattr(obj, k));
|
||||||
} else if (Cmp(k, "parms") == 0 || Cmp(k, "pattern") == 0) {
|
} else if (Cmp(k, "parms") == 0 || Cmp(k, "pattern") == 0) {
|
||||||
Xml_print_parmlist(Getattr(obj, k));
|
Xml_print_parmlist(Getattr(obj, k));
|
||||||
} else if (Cmp(k, "catchlist") == 0) {
|
} else if (Cmp(k, "catchlist") == 0 || Cmp(k, "templateparms") == 0) {
|
||||||
Xml_print_parmlist(Getattr(obj, k), "catchlist");
|
Xml_print_parmlist(Getattr(obj, k), Char(k));
|
||||||
} else {
|
} else {
|
||||||
DOH *o;
|
DOH *o;
|
||||||
print_indent(0);
|
print_indent(0);
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,6 @@ outdir = os.path.basename(os.getcwd()) + "/" + dirname + "/"
|
||||||
print "Grabbing tagged release git repository using 'git archive' into " + outdir
|
print "Grabbing tagged release git repository using 'git archive' into " + outdir
|
||||||
os.system("(cd .. && git archive --prefix=" + outdir + " " + tag + " . | tar -xf -)") == 0 or failed()
|
os.system("(cd .. && git archive --prefix=" + outdir + " " + tag + " . | tar -xf -)") == 0 or failed()
|
||||||
|
|
||||||
# Remove the debian directory -- it's not official
|
|
||||||
|
|
||||||
os.system("rm -Rf "+dirname+"/debian") == 0 or failed()
|
|
||||||
|
|
||||||
# Go build the system
|
# Go build the system
|
||||||
|
|
||||||
print "Building system"
|
print "Building system"
|
||||||
|
|
|
||||||
20
debian/README
vendored
20
debian/README
vendored
|
|
@ -1,20 +0,0 @@
|
||||||
The Debian Package swig1.3
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
This is SWIG 1.3 (Simplified Wrapper and Interface Generator)
|
|
||||||
packaged for Debian GNU/Linux.
|
|
||||||
|
|
||||||
SWIG 1.3 is not fully compatible with SWIG 1.1. It is a re-development
|
|
||||||
effort of SWIG 1.1 (which was written in C++) in ANSI C. The 1.3
|
|
||||||
series is in "alpha" state. Release 1.3a5 was rather stable, and it
|
|
||||||
should be used for new projects rather than the ancient release
|
|
||||||
1.1p5. See the file `NEW' for information on the new features of the
|
|
||||||
1.3 series.
|
|
||||||
|
|
||||||
This Debian package derives from the release 1.3a5 and corresponds to
|
|
||||||
the "mkoeppe-1-3-a5-patches" branch of the SWIG CVS repository. It
|
|
||||||
fixes several bugs and enhances several language backends. See the
|
|
||||||
top of the file `CHANGES' for details.
|
|
||||||
|
|
||||||
|
|
||||||
Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de>, Mon, 28 May 2001 15:08:55 +0200
|
|
||||||
66
debian/changelog
vendored
66
debian/changelog
vendored
|
|
@ -1,66 +0,0 @@
|
||||||
swig1.3 (1.3.pnet) unstable; urgency=low
|
|
||||||
|
|
||||||
* Support for dotgnu pnet under debian
|
|
||||||
|
|
||||||
-- James Michael DuPont <mdupont777@yahoo.com> Wed, 12 Mar 2003 20:55:53 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-9) unstable; urgency=low
|
|
||||||
|
|
||||||
* New upstream version
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Wed, 6 Jun 2001 16:11:41 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-8) unstable; urgency=low
|
|
||||||
|
|
||||||
* New upstream version
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Wed, 6 Jun 2001 14:06:51 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-7) unstable; urgency=low
|
|
||||||
|
|
||||||
* New upstream version
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Wed, 6 Jun 2001 13:34:44 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-6) unstable; urgency=low
|
|
||||||
|
|
||||||
* New upstream version
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Tue, 5 Jun 2001 14:11:52 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-5) unstable; urgency=low
|
|
||||||
|
|
||||||
* New upstream version.
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Fri, 1 Jun 2001 18:48:59 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-4) unstable; urgency=low
|
|
||||||
|
|
||||||
* Fix hard-coded location of swig library. Added build-dependency on
|
|
||||||
tcl-dev.
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Fri, 1 Jun 2001 13:32:34 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-3) unstable; urgency=low
|
|
||||||
|
|
||||||
* New upstream version
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Thu, 31 May 2001 13:15:20 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-2) unstable; urgency=low
|
|
||||||
|
|
||||||
* Binary and manpage now include version number, to improve
|
|
||||||
cooperation with the "swig" package.
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@rotehorn.math.uni-magdeburg.de> Tue, 29 May 2001 15:15:07 +0200
|
|
||||||
|
|
||||||
swig1.3 (1.3.a5+patches-1) unstable; urgency=low
|
|
||||||
|
|
||||||
* First release.
|
|
||||||
|
|
||||||
-- Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de> Sat, 20 Nov 1999 01:09:11 +0100
|
|
||||||
|
|
||||||
Local variables:
|
|
||||||
mode: debian-changelog
|
|
||||||
add-log-mailing-address: "mkoeppe@mail.math.uni-magdeburg.de"
|
|
||||||
End:
|
|
||||||
18
debian/control
vendored
18
debian/control
vendored
|
|
@ -1,18 +0,0 @@
|
||||||
Source: swig1.3
|
|
||||||
Section: interpreters
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de>
|
|
||||||
Build-Depends: debhelper (>> 3.0.0), libguile-dev, python-dev, perl,
|
|
||||||
ruby-dev, ruby, tcl8.0-dev
|
|
||||||
Standards-Version: 3.5.2
|
|
||||||
|
|
||||||
Package: swig1.3
|
|
||||||
Architecture: any
|
|
||||||
Depends: ${shlibs:Depends}
|
|
||||||
Description: Generate scripting interfaces to C/C++ code
|
|
||||||
SWIG (Simplified Wrapper and Interface Generator) is a system for
|
|
||||||
automatically generating wrapper/glue code for several languages
|
|
||||||
(Tcl, Python, Perl, Ruby, MzScheme, Guile, Java) from annotated C or
|
|
||||||
C++ header files.
|
|
||||||
This package represents some point in the SWIG 1.3 development
|
|
||||||
series. It is not fully compatible with the SWIG 1.1 release.
|
|
||||||
83
debian/copyright
vendored
83
debian/copyright
vendored
|
|
@ -1,83 +0,0 @@
|
||||||
This is SWIG, written and maintained by:
|
|
||||||
|
|
||||||
Dave Beazley (beazley@cs.uchicago.edu) (SWIG core)
|
|
||||||
Loic Dachary (loic@ceic.com) (Perl5)
|
|
||||||
Harco de Hilster (Harco.de.Hilster@ATComputing.nl) (Java)
|
|
||||||
Thien-Thi Nguyen (ttn@glug.org) (Testing/Misc)
|
|
||||||
Masaki Fukushima (fukusima@goto.info.waseda.ac.jp) (Ruby)
|
|
||||||
Matthias Koeppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile/MzScheme)
|
|
||||||
|
|
||||||
Past contributors:
|
|
||||||
|
|
||||||
Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran Kovuk, Gary Holt,
|
|
||||||
David Fletcher, Oleg Tolmatcev.
|
|
||||||
|
|
||||||
SWIG can be obtained by anonymous CVS:
|
|
||||||
|
|
||||||
cvs -d :pserver:cvs@swig.cs.uchicago.edu:/cvsroot co SWIG
|
|
||||||
|
|
||||||
SWIG is distributed under the following terms:
|
|
||||||
|
|
||||||
I.
|
|
||||||
|
|
||||||
Copyright (C) 1998-2000
|
|
||||||
The University of Chicago
|
|
||||||
|
|
||||||
Permission is hereby granted, without written agreement and without
|
|
||||||
license or royalty fees, to use, copy, modify, and distribute this
|
|
||||||
software and its documentation for any purpose, provided that
|
|
||||||
(1) The above copyright notice and the following two paragraphs
|
|
||||||
appear in all copies of the source code and (2) redistributions
|
|
||||||
including binaries reproduces these notices in the supporting
|
|
||||||
documentation. Substantial modifications to this software may be
|
|
||||||
copyrighted by their authors and need not follow the licensing terms
|
|
||||||
described here, provided that the new terms are clearly indicated in
|
|
||||||
all files where they apply.
|
|
||||||
|
|
||||||
IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CHICAGO, OR
|
|
||||||
DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT,
|
|
||||||
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
|
|
||||||
THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS OR
|
|
||||||
ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGE.
|
|
||||||
|
|
||||||
THE AUTHOR AND THE UNIVERSITY OF CHICAGO SPECIFICALLY DISCLAIM ANY
|
|
||||||
WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
|
|
||||||
PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS AND
|
|
||||||
DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
|
|
||||||
UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
||||||
|
|
||||||
|
|
||||||
II.
|
|
||||||
|
|
||||||
Copyright (c) 1995-1998
|
|
||||||
The University of Utah and the Regents of the University of California
|
|
||||||
All Rights Reserved
|
|
||||||
|
|
||||||
Permission is hereby granted, without written agreement and without
|
|
||||||
license or royalty fees, to use, copy, modify, and distribute this
|
|
||||||
software and its documentation for any purpose, provided that
|
|
||||||
(1) The above copyright notice and the following two paragraphs
|
|
||||||
appear in all copies of the source code and (2) redistributions
|
|
||||||
including binaries reproduces these notices in the supporting
|
|
||||||
documentation. Substantial modifications to this software may be
|
|
||||||
copyrighted by their authors and need not follow the licensing terms
|
|
||||||
described here, provided that the new terms are clearly indicated in
|
|
||||||
all files where they apply.
|
|
||||||
|
|
||||||
IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE
|
|
||||||
UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
|
|
||||||
PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
|
|
||||||
DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
|
|
||||||
EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
|
|
||||||
THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH
|
|
||||||
SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
|
|
||||||
THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
|
|
||||||
SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
||||||
|
|
||||||
|
|
||||||
4
debian/dirs
vendored
4
debian/dirs
vendored
|
|
@ -1,4 +0,0 @@
|
||||||
usr/bin
|
|
||||||
usr/lib
|
|
||||||
#usr/share/swig1.3-pnet
|
|
||||||
#usr/share/doc/swig1.3-pnet
|
|
||||||
47
debian/docs
vendored
47
debian/docs
vendored
|
|
@ -1,47 +0,0 @@
|
||||||
README
|
|
||||||
TODO
|
|
||||||
ANNOUNCE
|
|
||||||
CHANGES
|
|
||||||
NEW
|
|
||||||
Doc/Devel/engineering.html
|
|
||||||
Doc/Devel/index.html
|
|
||||||
Doc/Devel/internals.html
|
|
||||||
Doc/Devel/migrate.txt
|
|
||||||
Doc/README
|
|
||||||
Doc/Manual/About.html
|
|
||||||
Doc/Manual/Advanced.html
|
|
||||||
Doc/Manual/Arguments.html
|
|
||||||
Doc/Manual/Chicken.html
|
|
||||||
Doc/Manual/Contents.html
|
|
||||||
Doc/Manual/Copyright.html
|
|
||||||
Doc/Manual/Customization.html
|
|
||||||
Doc/Manual/Documentation.html
|
|
||||||
Doc/Manual/Extending.html
|
|
||||||
Doc/Manual/Guile.html
|
|
||||||
Doc/Manual/Introduction.html
|
|
||||||
Doc/Manual/Java.html
|
|
||||||
Doc/Manual/Library.html
|
|
||||||
Doc/Manual/Ocaml.html
|
|
||||||
Doc/Manual/Perl5.html
|
|
||||||
Doc/Manual/Php.html
|
|
||||||
Doc/Manual/Preface.html
|
|
||||||
Doc/Manual/Preprocessor.html
|
|
||||||
Doc/Manual/Python.html
|
|
||||||
Doc/Manual/README
|
|
||||||
Doc/Manual/Ruby.html
|
|
||||||
Doc/Manual/SWIG.html
|
|
||||||
Doc/Manual/SWIGPlus.html
|
|
||||||
Doc/Manual/Scripting.html
|
|
||||||
Doc/Manual/Tcl.html
|
|
||||||
Doc/Manual/Typemaps.html
|
|
||||||
Doc/Manual/Varargs.html
|
|
||||||
Doc/Manual/Warnings.html
|
|
||||||
Doc/Manual/Windows.html
|
|
||||||
Doc/Manual/ch11.1.png
|
|
||||||
Doc/Manual/ch11.2.png
|
|
||||||
Doc/Manual/ch11.3.png
|
|
||||||
Doc/Manual/ch12.1.png
|
|
||||||
Doc/Manual/ch2.1.png
|
|
||||||
Doc/Manual/ch9.table.2.png
|
|
||||||
Doc/Manual/chapters
|
|
||||||
Doc/Manual/index.html
|
|
||||||
45
debian/postinst
vendored
45
debian/postinst
vendored
|
|
@ -1,45 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
# postinst script for swig1.3
|
|
||||||
#
|
|
||||||
# see: dh_installdeb(1)
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# summary of how this script can be called:
|
|
||||||
# * <postinst> `configure' <most-recently-configured-version>
|
|
||||||
# * <old-postinst> `abort-upgrade' <new version>
|
|
||||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
|
||||||
# <new-version>
|
|
||||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
|
||||||
# <failed-install-package> <version> `removing'
|
|
||||||
# <conflicting-package> <version>
|
|
||||||
# for details, see /usr/share/doc/packaging-manual/
|
|
||||||
#
|
|
||||||
# quoting from the policy:
|
|
||||||
# Any necessary prompting should almost always be confined to the
|
|
||||||
# post-installation script, and should be protected with a conditional
|
|
||||||
# so that unnecessary prompting doesn't happen if a package's
|
|
||||||
# installation fails and the `postinst' is called with `abort-upgrade',
|
|
||||||
# `abort-remove' or `abort-deconfigure'.
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
configure)
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
abort-upgrade|abort-remove|abort-deconfigure)
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "postinst called with unknown argument \`$1'" >&2
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# dh_installdeb will replace this with shell code automatically
|
|
||||||
# generated by other debhelper scripts.
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
76
debian/rules
vendored
76
debian/rules
vendored
|
|
@ -1,76 +0,0 @@
|
||||||
#!/usr/bin/make -f
|
|
||||||
# Sample debian/rules that uses debhelper.
|
|
||||||
# GNU copyright 1997 to 1999 by Joey Hess.
|
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
|
||||||
export DH_VERBOSE=1
|
|
||||||
|
|
||||||
# This is the debhelper compatability version to use.
|
|
||||||
export DH_COMPAT=3
|
|
||||||
|
|
||||||
configure: configure-stamp
|
|
||||||
configure-stamp:
|
|
||||||
dh_testdir
|
|
||||||
./autogen-debian.sh
|
|
||||||
./configure --prefix=/usr --mandir=/usr/share/man --with-swiglibdir=/usr/share/swig1.3 --program-suffix=-1.3
|
|
||||||
touch configure-stamp
|
|
||||||
|
|
||||||
build: configure-stamp build-stamp
|
|
||||||
build-stamp:
|
|
||||||
dh_testdir
|
|
||||||
$(MAKE)
|
|
||||||
$(MAKE) runtime
|
|
||||||
touch build-stamp
|
|
||||||
|
|
||||||
clean:
|
|
||||||
dh_testdir
|
|
||||||
dh_testroot
|
|
||||||
rm -f build-stamp configure-stamp
|
|
||||||
|
|
||||||
-$(MAKE) clean
|
|
||||||
|
|
||||||
dh_clean
|
|
||||||
|
|
||||||
install: build
|
|
||||||
dh_testdir
|
|
||||||
dh_testroot
|
|
||||||
dh_clean -k
|
|
||||||
dh_installdirs
|
|
||||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/swig1.3
|
|
||||||
|
|
||||||
# Build architecture-independent files here.
|
|
||||||
binary-indep: build install
|
|
||||||
# We have nothing to do by default.
|
|
||||||
|
|
||||||
# Build architecture-dependent files here.
|
|
||||||
binary-arch: build install
|
|
||||||
dh_testdir
|
|
||||||
dh_testroot
|
|
||||||
# dh_installdebconf
|
|
||||||
dh_installdocs
|
|
||||||
dh_installexamples
|
|
||||||
dh_installmenu
|
|
||||||
# dh_installlogrotate
|
|
||||||
# dh_installemacsen
|
|
||||||
# dh_installpam
|
|
||||||
# dh_installmime
|
|
||||||
# dh_installinit
|
|
||||||
# dh_installcron
|
|
||||||
dh_installman
|
|
||||||
dh_installinfo
|
|
||||||
dh_undocumented swig-1.3.1
|
|
||||||
# dh_installchangelogs CHANGES
|
|
||||||
dh_link
|
|
||||||
dh_strip
|
|
||||||
dh_compress
|
|
||||||
dh_fixperms
|
|
||||||
dh_makeshlibs
|
|
||||||
dh_installdeb
|
|
||||||
# dh_perl
|
|
||||||
dh_shlibdeps
|
|
||||||
dh_gencontrol
|
|
||||||
dh_md5sums
|
|
||||||
dh_builddeb
|
|
||||||
|
|
||||||
binary: binary-indep binary-arch
|
|
||||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
|
||||||
1
debian/substvars
vendored
1
debian/substvars
vendored
|
|
@ -1 +0,0 @@
|
||||||
shlibs:Depends=libc6 (>= 2.2.3-1), libstdc++2.10-glibc2.2
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue