Ran the chapter-renumbering thing.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5308 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ffdac1fcc4
commit
dc02c4655c
14 changed files with 601 additions and 550 deletions
|
|
@ -530,4 +530,4 @@ CHICKEN_HOME=/usr/local/share/chicken</pre>
|
|||
<li>No exception handling.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -53,27 +53,29 @@
|
|||
<li><a href="Windows.html#n2">Installation on Windows</a>
|
||||
<ul>
|
||||
<li><a href="Windows.html#n3">Windows Executable</a>
|
||||
<li><a href="Windows.html#n4">Runtime Libraries</a>
|
||||
</ul>
|
||||
<li><a href="Windows.html#n4">SWIG Windows Examples</a>
|
||||
<li><a href="Windows.html#n5">SWIG Windows Examples</a>
|
||||
<ul>
|
||||
<li><a href="Windows.html#n5">Instructions for using the Examples with Visual C++</a>
|
||||
<li><a href="Windows.html#n6">Instructions for using the Examples with Visual C++</a>
|
||||
<ul>
|
||||
<li><a href="Windows.html#n6">Python</a>
|
||||
<li><a href="Windows.html#n7">TCL</a>
|
||||
<li><a href="Windows.html#n8">Perl</a>
|
||||
<li><a href="Windows.html#n9">Java</a>
|
||||
<li><a href="Windows.html#n10">Ruby</a>
|
||||
<li><a href="Windows.html#n7">Python</a>
|
||||
<li><a href="Windows.html#n8">TCL</a>
|
||||
<li><a href="Windows.html#n9">Perl</a>
|
||||
<li><a href="Windows.html#n10">Java</a>
|
||||
<li><a href="Windows.html#n11">Ruby</a>
|
||||
</ul>
|
||||
<li><a href="Windows.html#n11">Instructions for using the Examples with other compilers</a>
|
||||
<li><a href="Windows.html#n12">Instructions for using the Examples with other compilers</a>
|
||||
</ul>
|
||||
<li><a href="Windows.html#n12">SWIG on Cygwin and Mingw</a>
|
||||
<li><a href="Windows.html#n13">SWIG on Cygwin and MinGW</a>
|
||||
<ul>
|
||||
<li><a href="Windows.html#n13">Building swig.exe on Windows</a>
|
||||
<li><a href="Windows.html#n14">Building swig.exe on Windows</a>
|
||||
<ul>
|
||||
<li><a href="Windows.html#n14">Building swig.exe using Cygwin and Mingw</a>
|
||||
<li><a href="Windows.html#n15">Building swig.exe alternatives</a>
|
||||
<li><a href="Windows.html#n15">Building swig.exe using MinGW and MSYS</a>
|
||||
<li><a href="Windows.html#n16">Building swig.exe using Cygwin</a>
|
||||
<li><a href="Windows.html#n17">Building swig.exe alternatives</a>
|
||||
</ul>
|
||||
<li><a href="Windows.html#n16">Running the examples on Windows using Cygwin</a>
|
||||
<li><a href="Windows.html#n18">Running the examples on Windows using Cygwin</a>
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
|
@ -181,39 +183,46 @@
|
|||
<li><a href="SWIGPlus.html#n6">Simple C++ wrapping</a>
|
||||
<ul>
|
||||
<li><a href="SWIGPlus.html#n7">Constructors and destructors</a>
|
||||
<li><a href="SWIGPlus.html#n8">Copy constructors</a>
|
||||
<li><a href="SWIGPlus.html#n9">Member functions</a>
|
||||
<li><a href="SWIGPlus.html#n10">Static members</a>
|
||||
<li><a href="SWIGPlus.html#n11">Member functions and default arguments</a>
|
||||
<li><a href="SWIGPlus.html#n12">Member data</a>
|
||||
<li><a href="SWIGPlus.html#n8">Default constructors</a>
|
||||
<li><a href="SWIGPlus.html#n9">When constructor wrappers aren't created</a>
|
||||
<li><a href="SWIGPlus.html#n10">Copy constructors</a>
|
||||
<li><a href="SWIGPlus.html#n11">Member functions</a>
|
||||
<li><a href="SWIGPlus.html#n12">Static members</a>
|
||||
<li><a href="SWIGPlus.html#n13">Member functions and default arguments</a>
|
||||
<li><a href="SWIGPlus.html#n14">Member data</a>
|
||||
</ul>
|
||||
<li><a href="SWIGPlus.html#n13">Protection</a>
|
||||
<li><a href="SWIGPlus.html#n14">Enums and constants</a>
|
||||
<li><a href="SWIGPlus.html#n15">Friends</a>
|
||||
<li><a href="SWIGPlus.html#n16">References and pointers</a>
|
||||
<li><a href="SWIGPlus.html#n17">Pass and return by value</a>
|
||||
<li><a href="SWIGPlus.html#n18">Inheritance</a>
|
||||
<li><a href="SWIGPlus.html#n19">A brief discussion of multiple inheritance, pointers, and type checking</a>
|
||||
<li><a href="SWIGPlus.html#n20">Renaming</a>
|
||||
<li><a href="SWIGPlus.html#n21">Wrapping Overloaded Functions and Methods</a>
|
||||
<li><a href="SWIGPlus.html#n15">Protection</a>
|
||||
<li><a href="SWIGPlus.html#n16">Enums and constants</a>
|
||||
<li><a href="SWIGPlus.html#n17">Friends</a>
|
||||
<li><a href="SWIGPlus.html#n18">References and pointers</a>
|
||||
<li><a href="SWIGPlus.html#n19">Pass and return by value</a>
|
||||
<li><a href="SWIGPlus.html#n20">Inheritance</a>
|
||||
<li><a href="SWIGPlus.html#n21">A brief discussion of multiple inheritance, pointers, and type checking</a>
|
||||
<li><a href="SWIGPlus.html#n22">Renaming</a>
|
||||
<li><a href="SWIGPlus.html#n23">Wrapping Overloaded Functions and Methods</a>
|
||||
<ul>
|
||||
<li><a href="SWIGPlus.html#n22">Dispatch function generation</a>
|
||||
<li><a href="SWIGPlus.html#n23">Ambiguity in Overloading</a>
|
||||
<li><a href="SWIGPlus.html#n24">Ambiguity resolution and renaming</a>
|
||||
<li><a href="SWIGPlus.html#n25">Comments on overloading</a>
|
||||
<li><a href="SWIGPlus.html#n24">Dispatch function generation</a>
|
||||
<li><a href="SWIGPlus.html#n25">Ambiguity in Overloading</a>
|
||||
<li><a href="SWIGPlus.html#n26">Ambiguity resolution and renaming</a>
|
||||
<li><a href="SWIGPlus.html#n27">Comments on overloading</a>
|
||||
</ul>
|
||||
<li><a href="SWIGPlus.html#n26">Wrapping overloaded operators</a>
|
||||
<li><a href="SWIGPlus.html#n27">Class extension</a>
|
||||
<li><a href="SWIGPlus.html#n28">Templates</a>
|
||||
<li><a href="SWIGPlus.html#n29">Namespaces</a>
|
||||
<li><a href="SWIGPlus.html#n30">Exception specifiers</a>
|
||||
<li><a href="SWIGPlus.html#n31">Pointers to Members</a>
|
||||
<li><a href="SWIGPlus.html#n32">Smart pointers and operator->()</a>
|
||||
<li><a href="SWIGPlus.html#n33">Using declarations and inheritance</a>
|
||||
<li><a href="SWIGPlus.html#n34">Partial class definitions</a>
|
||||
<li><a href="SWIGPlus.html#n35">A brief rant about const-correctness</a>
|
||||
<li><a href="SWIGPlus.html#n36">Proxy classes</a>
|
||||
<li><a href="SWIGPlus.html#n37">Where to go for more information</a>
|
||||
<li><a href="SWIGPlus.html#n28">Wrapping overloaded operators</a>
|
||||
<li><a href="SWIGPlus.html#n29">Class extension</a>
|
||||
<li><a href="SWIGPlus.html#n30">Templates</a>
|
||||
<li><a href="SWIGPlus.html#n31">Namespaces</a>
|
||||
<li><a href="SWIGPlus.html#n32">Exception specifiers</a>
|
||||
<li><a href="SWIGPlus.html#n33">Pointers to Members</a>
|
||||
<li><a href="SWIGPlus.html#n34">Smart pointers and operator->()</a>
|
||||
<li><a href="SWIGPlus.html#n35">Using declarations and inheritance</a>
|
||||
<li><a href="SWIGPlus.html#n36">Partial class definitions</a>
|
||||
<li><a href="SWIGPlus.html#n37">A brief rant about const-correctness</a>
|
||||
<li><a href="SWIGPlus.html#n38">Proxy classes</a>
|
||||
<ul>
|
||||
<li><a href="SWIGPlus.html#n39">Construction of proxy classes</a>
|
||||
<li><a href="SWIGPlus.html#n40">Resource management in proxies</a>
|
||||
<li><a href="SWIGPlus.html#n41">Language specific details</a>
|
||||
</ul>
|
||||
<li><a href="SWIGPlus.html#n42">Where to go for more information</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -226,7 +235,7 @@
|
|||
<li><a href="Preprocessor.html#n4">Conditional Compilation</a>
|
||||
<li><a href="Preprocessor.html#n5">Macro Expansion</a>
|
||||
<li><a href="Preprocessor.html#n6">SWIG Macros</a>
|
||||
<li><a href="Preprocessor.html#n7">C99 Extensions</a>
|
||||
<li><a href="Preprocessor.html#n7">C99 and GNU Extensions</a>
|
||||
<li><a href="Preprocessor.html#n8">Preprocessing and %{ ... %} blocks</a>
|
||||
<li><a href="Preprocessor.html#n9">Preprocessing and { ... }</a>
|
||||
</ul>
|
||||
|
|
@ -291,30 +300,30 @@
|
|||
<li><a href="Typemaps.html#n25">Common typemap methods</a>
|
||||
<ul>
|
||||
<li><a href="Typemaps.html#n26">"in" typemap</a>
|
||||
<li><a href="Typemaps.html#n27">"out" typemap</a>
|
||||
<li><a href="Typemaps.html#n28">"arginit" typemap</a>
|
||||
<li><a href="Typemaps.html#n29">"default" typemap</a>
|
||||
<li><a href="Typemaps.html#n30">"check" typemap</a>
|
||||
<li><a href="Typemaps.html#n31">"argout" typemap</a>
|
||||
<li><a href="Typemaps.html#n32">"freearg" typemap</a>
|
||||
<li><a href="Typemaps.html#n33">"newfree" typemap</a>
|
||||
<li><a href="Typemaps.html#n34">"memberin" typemap</a>
|
||||
<li><a href="Typemaps.html#n35">"varin" typemap</a>
|
||||
<li><a href="Typemaps.html#n36">"varout" typemap</a>
|
||||
<li><a href="Typemaps.html#n27">"typecheck" typemap</a>
|
||||
<li><a href="Typemaps.html#n28">"out" typemap</a>
|
||||
<li><a href="Typemaps.html#n29">"arginit" typemap</a>
|
||||
<li><a href="Typemaps.html#n30">"default" typemap</a>
|
||||
<li><a href="Typemaps.html#n31">"check" typemap</a>
|
||||
<li><a href="Typemaps.html#n32">"argout" typemap</a>
|
||||
<li><a href="Typemaps.html#n33">"freearg" typemap</a>
|
||||
<li><a href="Typemaps.html#n34">"newfree" typemap</a>
|
||||
<li><a href="Typemaps.html#n35">"memberin" typemap</a>
|
||||
<li><a href="Typemaps.html#n36">"varin" typemap</a>
|
||||
<li><a href="Typemaps.html#n37">"varout" typemap</a>
|
||||
</ul>
|
||||
<li><a href="Typemaps.html#n37">Some typemap examples</a>
|
||||
<li><a href="Typemaps.html#n38">Some typemap examples</a>
|
||||
<ul>
|
||||
<li><a href="Typemaps.html#n38">Typemaps for arrays</a>
|
||||
<li><a href="Typemaps.html#n39">Implementing constraints with typemaps</a>
|
||||
<li><a href="Typemaps.html#n39">Typemaps for arrays</a>
|
||||
<li><a href="Typemaps.html#n40">Implementing constraints with typemaps</a>
|
||||
</ul>
|
||||
<li><a href="Typemaps.html#n40">Multi-argument typemaps</a>
|
||||
<li><a href="Typemaps.html#n41">The run-time type checker</a>
|
||||
<li><a href="Typemaps.html#n42">More about <tt>%apply</tt> and <tt>%clear</tt></a>
|
||||
<li><a href="Typemaps.html#n43">Reducing wrapper code size</a>
|
||||
<ul>
|
||||
<li><a href="Typemaps.html#n44">Passing data between typemaps</a>
|
||||
</ul>
|
||||
<li><a href="Typemaps.html#n45">Where to go for more information?</a>
|
||||
<li><a href="Typemaps.html#n41">Multi-argument typemaps</a>
|
||||
<li><a href="Typemaps.html#n42">The run-time type checker</a>
|
||||
<li><a href="Typemaps.html#n43">Typemaps and overloading</a>
|
||||
<li><a href="Typemaps.html#n44">More about <tt>%apply</tt> and <tt>%clear</tt></a>
|
||||
<li><a href="Typemaps.html#n45">Reducing wrapper code size</a>
|
||||
<li><a href="Typemaps.html#n46">Passing data between typemaps</a>
|
||||
<li><a href="Typemaps.html#n47">Where to go for more information?</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -328,11 +337,10 @@
|
|||
<li><a href="Customization.html#n4">Exception handling with longjmp()</a>
|
||||
<li><a href="Customization.html#n5">Handling C++ exceptions</a>
|
||||
<li><a href="Customization.html#n6">Defining different exception handlers</a>
|
||||
<li><a href="Customization.html#n7">Applying exception handlers to specific datatypes.</a>
|
||||
<li><a href="Customization.html#n8">Using The SWIG exception library</a>
|
||||
<li><a href="Customization.html#n7">Using The SWIG exception library</a>
|
||||
</ul>
|
||||
<li><a href="Customization.html#n9">Object ownership and %newobject</a>
|
||||
<li><a href="Customization.html#n10">Features and the %feature directive</a>
|
||||
<li><a href="Customization.html#n8">Object ownership and %newobject</a>
|
||||
<li><a href="Customization.html#n9">Features and the %feature directive</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -433,21 +441,32 @@
|
|||
<!-- INDEX -->
|
||||
<ul>
|
||||
<li><a href="Guile.html#n2">Meaning of "Module"</a>
|
||||
<li><a href="Guile.html#n3">Linkage</a>
|
||||
<li><a href="Guile.html#n3">Using the SCM or GH Guile API</a>
|
||||
<li><a href="Guile.html#n4">Linkage</a>
|
||||
<ul>
|
||||
<li><a href="Guile.html#n4">Simple Linkage</a>
|
||||
<li><a href="Guile.html#n5">Passive Linkage</a>
|
||||
<li><a href="Guile.html#n6">Native Guile Module Linkage</a>
|
||||
<li><a href="Guile.html#n7">Old Auto-Loading Guile Module Linkage</a>
|
||||
<li><a href="Guile.html#n8">Hobbit4D Linkage</a>
|
||||
<li><a href="Guile.html#n9">General Remarks on Multiple SWIG Modules</a>
|
||||
<li><a href="Guile.html#n5">Simple Linkage</a>
|
||||
<li><a href="Guile.html#n6">Passive Linkage</a>
|
||||
<li><a href="Guile.html#n7">Native Guile Module Linkage</a>
|
||||
<li><a href="Guile.html#n8">Old Auto-Loading Guile Module Linkage</a>
|
||||
<li><a href="Guile.html#n9">Hobbit4D Linkage</a>
|
||||
<li><a href="Guile.html#n10">General Remarks on Multiple SWIG Modules</a>
|
||||
</ul>
|
||||
<li><a href="Guile.html#n11">Underscore Folding</a>
|
||||
<li><a href="Guile.html#n12">Typemaps</a>
|
||||
<li><a href="Guile.html#n13">Representation of pointers as smobs</a>
|
||||
<ul>
|
||||
<li><a href="Guile.html#n14">GH Smobs</a>
|
||||
<li><a href="Guile.html#n15">SCM Smobs</a>
|
||||
<li><a href="Guile.html#n16">Garbage Collection</a>
|
||||
</ul>
|
||||
<li><a href="Guile.html#n17">Exception Handling</a>
|
||||
<li><a href="Guile.html#n18">Procedure documentation</a>
|
||||
<li><a href="Guile.html#n19">Procedures with setters</a>
|
||||
<li><a href="Guile.html#n20">GOOPS Shadow Classes</a>
|
||||
<ul>
|
||||
<li><a href="Guile.html#n21">Naming Issues</a>
|
||||
<li><a href="Guile.html#n22">Linking</a>
|
||||
</ul>
|
||||
<li><a href="Guile.html#n10">Underscore Folding</a>
|
||||
<li><a href="Guile.html#n11">Typemaps</a>
|
||||
<li><a href="Guile.html#n12">Smobs</a>
|
||||
<li><a href="Guile.html#n13">Exception Handling</a>
|
||||
<li><a href="Guile.html#n14">Procedure documentation</a>
|
||||
<li><a href="Guile.html#n15">Procedures with setters</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -455,100 +474,110 @@
|
|||
|
||||
<!-- INDEX -->
|
||||
<ul>
|
||||
<li><a href="Java.html#n2">Preliminaries</a>
|
||||
<li><a href="Java.html#n2">Overview</a>
|
||||
<li><a href="Java.html#n3">Preliminaries</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n3">Running SWIG</a>
|
||||
<li><a href="Java.html#n4">Additional Commandline Options</a>
|
||||
<li><a href="Java.html#n5">Getting the right header files</a>
|
||||
<li><a href="Java.html#n6">Compiling a dynamic module</a>
|
||||
<li><a href="Java.html#n7">Using your module</a>
|
||||
<li><a href="Java.html#n8">Compilation problems and compiling with C++</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n9">Building Java Extensions under Windows</a>
|
||||
<li><a href="Java.html#n4">Running SWIG</a>
|
||||
<li><a href="Java.html#n5">Additional Commandline Options</a>
|
||||
<li><a href="Java.html#n6">Getting the right header files</a>
|
||||
<li><a href="Java.html#n7">Compiling a dynamic module</a>
|
||||
<li><a href="Java.html#n8">Using your module</a>
|
||||
<li><a href="Java.html#n9">Dynamic linking problems</a>
|
||||
<li><a href="Java.html#n10">Compilation problems and compiling with C++</a>
|
||||
<li><a href="Java.html#n11">Building on Windows</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n10">Running SWIG from Developer Studio</a>
|
||||
<li><a href="Java.html#n11">Using NMAKE</a>
|
||||
<li><a href="Java.html#n12">Running SWIG from Visual Studio</a>
|
||||
<li><a href="Java.html#n13">Using NMAKE</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n12">A tour of basic C/C++ wrapping</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n14">A tour of basic C/C++ wrapping</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n13">Modules, packages and generated Java classes</a>
|
||||
<li><a href="Java.html#n14">Functions</a>
|
||||
<li><a href="Java.html#n15">Global variables</a>
|
||||
<li><a href="Java.html#n16">Constants</a>
|
||||
<li><a href="Java.html#n17">Enumerations</a>
|
||||
<li><a href="Java.html#n18">Pointers</a>
|
||||
<li><a href="Java.html#n19">Structures</a>
|
||||
<li><a href="Java.html#n20">C++ classes</a>
|
||||
<li><a href="Java.html#n21">C++ inheritance</a>
|
||||
<li><a href="Java.html#n22">Pointers, references, arrays and pass by value</a>
|
||||
<li><a href="Java.html#n15">Modules, packages and generated Java classes</a>
|
||||
<li><a href="Java.html#n16">Functions</a>
|
||||
<li><a href="Java.html#n17">Global variables</a>
|
||||
<li><a href="Java.html#n18">Constants</a>
|
||||
<li><a href="Java.html#n19">Enumerations</a>
|
||||
<li><a href="Java.html#n20">Pointers</a>
|
||||
<li><a href="Java.html#n21">Structures</a>
|
||||
<li><a href="Java.html#n22">C++ classes</a>
|
||||
<li><a href="Java.html#n23">C++ inheritance</a>
|
||||
<li><a href="Java.html#n24">Pointers, references, arrays and pass by value</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n23">Null pointers</a>
|
||||
<li><a href="Java.html#n25">Null pointers</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n24">C++ overloaded functions</a>
|
||||
<li><a href="Java.html#n25">C++ namespaces</a>
|
||||
<li><a href="Java.html#n26">C++ templates</a>
|
||||
<li><a href="Java.html#n27">C++ Smart Pointers</a>
|
||||
<li><a href="Java.html#n26">C++ overloaded functions</a>
|
||||
<li><a href="Java.html#n27">C++ namespaces</a>
|
||||
<li><a href="Java.html#n28">C++ templates</a>
|
||||
<li><a href="Java.html#n29">C++ Smart Pointers</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n28">Further details on the generated Java classes</a>
|
||||
<li><a href="Java.html#n30">Further details on the generated Java classes</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n29">The JNI class</a>
|
||||
<li><a href="Java.html#n31">The intermediary JNI class</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n30">The JNI class pragmas</a>
|
||||
<li><a href="Java.html#n32">The intermediary JNI class pragmas</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n31">The Java module class</a>
|
||||
<li><a href="Java.html#n33">The Java module class</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n32">The Java module class pragmas</a>
|
||||
<li><a href="Java.html#n34">The Java module class pragmas</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n33">Java proxy classes</a>
|
||||
<li><a href="Java.html#n35">Java proxy classes</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n34">Memory management</a>
|
||||
<li><a href="Java.html#n35">Inheritance</a>
|
||||
<li><a href="Java.html#n36">Proxy classes and garbage collection</a>
|
||||
<li><a href="Java.html#n36">Memory management</a>
|
||||
<li><a href="Java.html#n37">Inheritance</a>
|
||||
<li><a href="Java.html#n38">Proxy classes and garbage collection</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n37">Type wrapper classes</a>
|
||||
<li><a href="Java.html#n39">Type wrapper classes</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n38">Common customization features</a>
|
||||
<li><a href="Java.html#n40">Cross language polymorphism using directors (experimental)</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n39">C/C++ helper functions</a>
|
||||
<li><a href="Java.html#n40">Class extension with %extend</a>
|
||||
<li><a href="Java.html#n41">Exception handling with %exception</a>
|
||||
<li><a href="Java.html#n42">Method access with %javamethodmodifiers</a>
|
||||
<li><a href="Java.html#n41">Enabling directors</a>
|
||||
<li><a href="Java.html#n42">Director classes</a>
|
||||
<li><a href="Java.html#n43">Overhead and code bloat</a>
|
||||
<li><a href="Java.html#n44">Simple directors example</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n43">Tips and techniques</a>
|
||||
<li><a href="Java.html#n45">Common customization features</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n44">Input and output parameters using primitive pointers and references</a>
|
||||
<li><a href="Java.html#n45">Simple pointers</a>
|
||||
<li><a href="Java.html#n46">Wrapping C arrays with Java arrays</a>
|
||||
<li><a href="Java.html#n47">Unbounded C Arrays</a>
|
||||
<li><a href="Java.html#n46">C/C++ helper functions</a>
|
||||
<li><a href="Java.html#n47">Class extension with %extend</a>
|
||||
<li><a href="Java.html#n48">Exception handling with %exception</a>
|
||||
<li><a href="Java.html#n49">Method access with %javamethodmodifiers</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n48">Java typemaps</a>
|
||||
<li><a href="Java.html#n50">Tips and techniques</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n49">Default primitive type mappings</a>
|
||||
<li><a href="Java.html#n50">Sixty four bit JVMs</a>
|
||||
<li><a href="Java.html#n51">What is a typemap?</a>
|
||||
<li><a href="Java.html#n52">Typemaps for mapping C/C++ types to Java types</a>
|
||||
<li><a href="Java.html#n53">Java special variables</a>
|
||||
<li><a href="Java.html#n54">Typemaps for both C and C++ compilation</a>
|
||||
<li><a href="Java.html#n55">Java code typemaps</a>
|
||||
<li><a href="Java.html#n51">Input and output parameters using primitive pointers and references</a>
|
||||
<li><a href="Java.html#n52">Simple pointers</a>
|
||||
<li><a href="Java.html#n53">Wrapping C arrays with Java arrays</a>
|
||||
<li><a href="Java.html#n54">Unbounded C Arrays</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n56">Typemap Examples</a>
|
||||
<li><a href="Java.html#n55">Java typemaps</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n57">Converting Java String arrays to char ** </a>
|
||||
<li><a href="Java.html#n58">Expanding a Java object to multiple arguments</a>
|
||||
<li><a href="Java.html#n59">Using typemaps to return arguments</a>
|
||||
<li><a href="Java.html#n60">Adding Java downcasts to polymorphic return types</a>
|
||||
<li><a href="Java.html#n61">Adding an equals method to the Java classes</a>
|
||||
<li><a href="Java.html#n62">Void pointers and a common Java base class</a>
|
||||
<li><a href="Java.html#n56">Default primitive type mappings</a>
|
||||
<li><a href="Java.html#n57">Sixty four bit JVMs</a>
|
||||
<li><a href="Java.html#n58">What is a typemap?</a>
|
||||
<li><a href="Java.html#n59">Typemaps for mapping C/C++ types to Java types</a>
|
||||
<li><a href="Java.html#n60">Java special variables</a>
|
||||
<li><a href="Java.html#n61">Typemaps for both C and C++ compilation</a>
|
||||
<li><a href="Java.html#n62">Java code typemaps</a>
|
||||
<li><a href="Java.html#n63">Director specific typemaps</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n63">Odds and ends</a>
|
||||
<li><a href="Java.html#n64">Typemap Examples</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n64">JavaDoc comments</a>
|
||||
<li><a href="Java.html#n65">Functional interface without proxy classes</a>
|
||||
<li><a href="Java.html#n66">Dynamic linking problems</a>
|
||||
<li><a href="Java.html#n67">Using your own JNI functions</a>
|
||||
<li><a href="Java.html#n68">Performance concerns and hints</a>
|
||||
<li><a href="Java.html#n65">Converting Java String arrays to char ** </a>
|
||||
<li><a href="Java.html#n66">Expanding a Java object to multiple arguments</a>
|
||||
<li><a href="Java.html#n67">Using typemaps to return arguments</a>
|
||||
<li><a href="Java.html#n68">Adding Java downcasts to polymorphic return types</a>
|
||||
<li><a href="Java.html#n69">Adding an equals method to the Java classes</a>
|
||||
<li><a href="Java.html#n70">Void pointers and a common Java base class</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n69">Examples</a>
|
||||
<li><a href="Java.html#n71">Living with Java Directors</a>
|
||||
<li><a href="Java.html#n72">Odds and ends</a>
|
||||
<ul>
|
||||
<li><a href="Java.html#n73">JavaDoc comments</a>
|
||||
<li><a href="Java.html#n74">Functional interface without proxy classes</a>
|
||||
<li><a href="Java.html#n75">Using your own JNI functions</a>
|
||||
<li><a href="Java.html#n76">Performance concerns and hints</a>
|
||||
</ul>
|
||||
<li><a href="Java.html#n77">Examples</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -559,25 +588,41 @@
|
|||
<li><a href="Ocaml.html#n2">Preliminaries</a>
|
||||
<ul>
|
||||
<li><a href="Ocaml.html#n3">Running SWIG</a>
|
||||
<li><a href="Ocaml.html#n4">Getting the right header files</a>
|
||||
<li><a href="Ocaml.html#n5">Compiling the code</a>
|
||||
<li><a href="Ocaml.html#n6">The camlp4 module</a>
|
||||
<li><a href="Ocaml.html#n7">Current thoughts on best practice for Ocaml</a>
|
||||
<li><a href="Ocaml.html#n8">Using your module</a>
|
||||
<li><a href="Ocaml.html#n9">Compilation problems and compiling with C++</a>
|
||||
<li><a href="Ocaml.html#n4">Compiling the code</a>
|
||||
<li><a href="Ocaml.html#n5">The camlp4 module</a>
|
||||
<li><a href="Ocaml.html#n6">Using your module</a>
|
||||
<li><a href="Ocaml.html#n7">Compilation problems and compiling with C++</a>
|
||||
</ul>
|
||||
<li><a href="Ocaml.html#n10">The low-level Ocaml/C interface</a>
|
||||
<li><a href="Ocaml.html#n8">The low-level Ocaml/C interface</a>
|
||||
<ul>
|
||||
<li><a href="Ocaml.html#n11">The generated module</a>
|
||||
<li><a href="Ocaml.html#n12">Enums</a>
|
||||
<li><a href="Ocaml.html#n13">C++ Classes</a>
|
||||
<li><a href="Ocaml.html#n9">The generated module</a>
|
||||
<li><a href="Ocaml.html#n10">Enums</a>
|
||||
<li><a href="Ocaml.html#n11">Arrays</a>
|
||||
<ul>
|
||||
<li><a href="Ocaml.html#n14">STL vector and string Example</a>
|
||||
<li><a href="Ocaml.html#n15">C++ Class Example</a>
|
||||
<li><a href="Ocaml.html#n16">Compiling the example</a>
|
||||
<li><a href="Ocaml.html#n17">Sample Session</a>
|
||||
<li><a href="Ocaml.html#n12">Simple types of bounded arrays</a>
|
||||
<li><a href="Ocaml.html#n13">Complex and unbounded arrays</a>
|
||||
<li><a href="Ocaml.html#n14">Using an object</a>
|
||||
<li><a href="Ocaml.html#n15">Example typemap for a function taking float * and int</a>
|
||||
</ul>
|
||||
<li><a href="Ocaml.html#n18">Exceptions</a>
|
||||
<li><a href="Ocaml.html#n16">C++ Classes</a>
|
||||
<ul>
|
||||
<li><a href="Ocaml.html#n17">STL vector and string Example</a>
|
||||
<li><a href="Ocaml.html#n18">C++ Class Example</a>
|
||||
<li><a href="Ocaml.html#n19">Compiling the example</a>
|
||||
<li><a href="Ocaml.html#n20">Sample Session</a>
|
||||
</ul>
|
||||
<li><a href="Ocaml.html#n21">Director Classes</a>
|
||||
<ul>
|
||||
<li><a href="Ocaml.html#n22">Director Introduction</a>
|
||||
<li><a href="Ocaml.html#n23">Overriding Methods in Ocaml</a>
|
||||
<li><a href="Ocaml.html#n24">Director Usage Example</a>
|
||||
<li><a href="Ocaml.html#n25">Creating director objects</a>
|
||||
<li><a href="Ocaml.html#n26">Typemaps for directors, <tt>directorin, directorout, directorargout</tt></a>
|
||||
<li><a href="Ocaml.html#n27"><tt>directorin</tt> typemap</a>
|
||||
<li><a href="Ocaml.html#n28"><tt>directorout</tt> typemap</a>
|
||||
<li><a href="Ocaml.html#n29"><tt>directorargout</tt> typemap</a>
|
||||
</ul>
|
||||
<li><a href="Ocaml.html#n30">Exceptions</a>
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
|
@ -780,41 +825,43 @@
|
|||
<li><a href="Ruby.html#n16">Pointers</a>
|
||||
<li><a href="Ruby.html#n17">Structures</a>
|
||||
<li><a href="Ruby.html#n18">C++ classes</a>
|
||||
<li><a href="Ruby.html#n19">C++ inheritance</a>
|
||||
<li><a href="Ruby.html#n20">C++ overloaded functions</a>
|
||||
<li><a href="Ruby.html#n19">C++ Inheritance</a>
|
||||
<li><a href="Ruby.html#n20">C++ Overloaded Functions</a>
|
||||
<li><a href="Ruby.html#n21">C++ Operators</a>
|
||||
<li><a href="Ruby.html#n22">C++ namespaces</a>
|
||||
<li><a href="Ruby.html#n23">C++ templates</a>
|
||||
<li><a href="Ruby.html#n24">C++ Smart Pointers</a>
|
||||
</ul>
|
||||
<li><a href="Ruby.html#n25">Input and output parameters</a>
|
||||
<li><a href="Ruby.html#n26">Simple exception handling </a>
|
||||
<li><a href="Ruby.html#n27">Typemaps</a>
|
||||
<li><a href="Ruby.html#n25">Cross-Language Polymorphism</a>
|
||||
<ul>
|
||||
<li><a href="Ruby.html#n28">What is a typemap?</a>
|
||||
<li><a href="Ruby.html#n29">Ruby typemaps</a>
|
||||
<li><a href="Ruby.html#n30">Typemap variables</a>
|
||||
<li><a href="Ruby.html#n31">Useful Functions</a>
|
||||
<ul>
|
||||
<li><a href="Ruby.html#n32">C Datatypes to Ruby Objects</a>
|
||||
<li><a href="Ruby.html#n33">Ruby Objects to C Datatypes</a>
|
||||
<li><a href="Ruby.html#n34">Macros for VALUE</a>
|
||||
<li><a href="Ruby.html#n35">Exceptions</a>
|
||||
<li><a href="Ruby.html#n36">Iterators</a>
|
||||
</ul>
|
||||
<li><a href="Ruby.html#n37">Typemap Examples</a>
|
||||
<li><a href="Ruby.html#n38">Converting a Ruby array to a char **</a>
|
||||
<li><a href="Ruby.html#n39">Collecting arguments in a hash</a>
|
||||
<li><a href="Ruby.html#n40">Pointer handling</a>
|
||||
<ul>
|
||||
<li><a href="Ruby.html#n41">Ruby Datatype Wrapping</a>
|
||||
<li><a href="Ruby.html#n26">Exception Unrolling</a>
|
||||
</ul>
|
||||
</ul>
|
||||
<li><a href="Ruby.html#n42">Operator overloading</a>
|
||||
<li><a href="Ruby.html#n27">Input and output parameters</a>
|
||||
<li><a href="Ruby.html#n28">Simple exception handling </a>
|
||||
<li><a href="Ruby.html#n29">Typemaps</a>
|
||||
<ul>
|
||||
<li><a href="Ruby.html#n43">An example (putting everything together)</a>
|
||||
<li><a href="Ruby.html#n44">Expanding the example</a>
|
||||
<li><a href="Ruby.html#n45">STL Vector to Ruby Array</a>
|
||||
<li><a href="Ruby.html#n30">What is a typemap?</a>
|
||||
<li><a href="Ruby.html#n31">Ruby typemaps</a>
|
||||
<li><a href="Ruby.html#n32">Typemap variables</a>
|
||||
<li><a href="Ruby.html#n33">Useful Functions</a>
|
||||
<ul>
|
||||
<li><a href="Ruby.html#n34">C Datatypes to Ruby Objects</a>
|
||||
<li><a href="Ruby.html#n35">Ruby Objects to C Datatypes</a>
|
||||
<li><a href="Ruby.html#n36">Macros for VALUE</a>
|
||||
<li><a href="Ruby.html#n37">Exceptions</a>
|
||||
<li><a href="Ruby.html#n38">Iterators</a>
|
||||
</ul>
|
||||
<li><a href="Ruby.html#n39">Typemap Examples</a>
|
||||
<li><a href="Ruby.html#n40">Converting a Ruby array to a char **</a>
|
||||
<li><a href="Ruby.html#n41">Collecting arguments in a hash</a>
|
||||
<li><a href="Ruby.html#n42">Pointer handling</a>
|
||||
<ul>
|
||||
<li><a href="Ruby.html#n43">Ruby Datatype Wrapping</a>
|
||||
</ul>
|
||||
</ul>
|
||||
<li><a href="Ruby.html#n44">Operator overloading</a>
|
||||
<ul>
|
||||
<li><a href="Ruby.html#n45">Example: STL Vector to Ruby Array</a>
|
||||
</ul>
|
||||
<li><a href="Ruby.html#n46">Advanced Topics</a>
|
||||
<ul>
|
||||
|
|
@ -942,40 +989,41 @@
|
|||
<li><a href="Extending.html#n16">Hashes</a>
|
||||
<li><a href="Extending.html#n17">Lists</a>
|
||||
<li><a href="Extending.html#n18">Common operations</a>
|
||||
<li><a href="Extending.html#n19">I/O</a>
|
||||
<li><a href="Extending.html#n19">Iterating over Lists and Hashes</a>
|
||||
<li><a href="Extending.html#n20">I/O</a>
|
||||
</ul>
|
||||
<li><a href="Extending.html#n20">Navigating and manipulating parse trees</a>
|
||||
<li><a href="Extending.html#n21">Working with attributes</a>
|
||||
<li><a href="Extending.html#n22">Type system</a>
|
||||
<li><a href="Extending.html#n21">Navigating and manipulating parse trees</a>
|
||||
<li><a href="Extending.html#n22">Working with attributes</a>
|
||||
<li><a href="Extending.html#n23">Type system</a>
|
||||
<ul>
|
||||
<li><a href="Extending.html#n23">String encoding of types</a>
|
||||
<li><a href="Extending.html#n24">Type construction</a>
|
||||
<li><a href="Extending.html#n25">Type tests</a>
|
||||
<li><a href="Extending.html#n26">Typedef and inheritance</a>
|
||||
<li><a href="Extending.html#n27">Lvalues</a>
|
||||
<li><a href="Extending.html#n28">Output functions</a>
|
||||
<li><a href="Extending.html#n24">String encoding of types</a>
|
||||
<li><a href="Extending.html#n25">Type construction</a>
|
||||
<li><a href="Extending.html#n26">Type tests</a>
|
||||
<li><a href="Extending.html#n27">Typedef and inheritance</a>
|
||||
<li><a href="Extending.html#n28">Lvalues</a>
|
||||
<li><a href="Extending.html#n29">Output functions</a>
|
||||
</ul>
|
||||
<li><a href="Extending.html#n29">Parameters</a>
|
||||
<li><a href="Extending.html#n30">Writing a Language Module</a>
|
||||
<li><a href="Extending.html#n30">Parameters</a>
|
||||
<li><a href="Extending.html#n31">Writing a Language Module</a>
|
||||
<ul>
|
||||
<li><a href="Extending.html#n31">Execution model</a>
|
||||
<li><a href="Extending.html#n32">Starting out</a>
|
||||
<li><a href="Extending.html#n33">Command line options</a>
|
||||
<li><a href="Extending.html#n34">Configuration and preprocessing</a>
|
||||
<li><a href="Extending.html#n35">Entry point to code generation</a>
|
||||
<li><a href="Extending.html#n36">Module I/O and wrapper skeleton</a>
|
||||
<li><a href="Extending.html#n37">Low-level code generators</a>
|
||||
<li><a href="Extending.html#n38">Configuration files</a>
|
||||
<li><a href="Extending.html#n39">Runtime support</a>
|
||||
<li><a href="Extending.html#n40">Standard library files</a>
|
||||
<li><a href="Extending.html#n41">Examples and test cases</a>
|
||||
<li><a href="Extending.html#n42">Documentation</a>
|
||||
<li><a href="Extending.html#n32">Execution model</a>
|
||||
<li><a href="Extending.html#n33">Starting out</a>
|
||||
<li><a href="Extending.html#n34">Command line options</a>
|
||||
<li><a href="Extending.html#n35">Configuration and preprocessing</a>
|
||||
<li><a href="Extending.html#n36">Entry point to code generation</a>
|
||||
<li><a href="Extending.html#n37">Module I/O and wrapper skeleton</a>
|
||||
<li><a href="Extending.html#n38">Low-level code generators</a>
|
||||
<li><a href="Extending.html#n39">Configuration files</a>
|
||||
<li><a href="Extending.html#n40">Runtime support</a>
|
||||
<li><a href="Extending.html#n41">Standard library files</a>
|
||||
<li><a href="Extending.html#n42">Examples and test cases</a>
|
||||
<li><a href="Extending.html#n43">Documentation</a>
|
||||
</ul>
|
||||
<li><a href="Extending.html#n43">Typemaps</a>
|
||||
<li><a href="Extending.html#n44">Typemaps</a>
|
||||
<ul>
|
||||
<li><a href="Extending.html#n44">Proxy classes</a>
|
||||
<li><a href="Extending.html#n45">Proxy classes</a>
|
||||
</ul>
|
||||
<li><a href="Extending.html#n45">Guide to parse tree nodes</a>
|
||||
<li><a href="Extending.html#n46">Guide to parse tree nodes</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
<li><a href="#n4">Exception handling with longjmp()</a>
|
||||
<li><a href="#n5">Handling C++ exceptions</a>
|
||||
<li><a href="#n6">Defining different exception handlers</a>
|
||||
<li><a href="#n8">Using The SWIG exception library</a>
|
||||
<li><a href="#n7">Using The SWIG exception library</a>
|
||||
</ul>
|
||||
<li><a href="#n9">Object ownership and %newobject</a>
|
||||
<li><a href="#n10">Features and the %feature directive</a>
|
||||
<li><a href="#n8">Object ownership and %newobject</a>
|
||||
<li><a href="#n9">Features and the %feature directive</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ was intended to be a mechanism for pinpointing specific
|
|||
declarations. However, it never really worked that well and the new
|
||||
%exception directive is much better.
|
||||
|
||||
<a name="n8"></a><H3>9.1.6 Using The SWIG exception library</H3>
|
||||
<a name="n7"></a><H3>9.1.5 Using The SWIG exception library</H3>
|
||||
|
||||
|
||||
The <tt>exception.i</tt> library file provides support for creating
|
||||
|
|
@ -396,7 +396,7 @@ Since the <tt>SWIG_exception()</tt> function is defined at the C-level
|
|||
it can be used elsewhere in SWIG. This includes typemaps and helper
|
||||
functions.
|
||||
|
||||
<a name="n9"></a><H2>9.2 Object ownership and %newobject</H2>
|
||||
<a name="n8"></a><H2>9.2 Object ownership and %newobject</H2>
|
||||
|
||||
|
||||
A common problem in some applications is managing proper ownership of objects. For
|
||||
|
|
@ -491,7 +491,7 @@ char *strdup(const char *s);
|
|||
The results might not be what you expect.
|
||||
|
||||
<a name="features"></a>
|
||||
<a name="n10"></a><H2>9.3 Features and the %feature directive</H2>
|
||||
<a name="n9"></a><H2>9.3 Features and the %feature directive</H2>
|
||||
|
||||
|
||||
Both <tt>%exception</tt> and <tt>%newobject</tt> are examples of a
|
||||
|
|
@ -602,4 +602,4 @@ use will be described in the documentation for specific language modules.
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : June 1, 2003</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -28,40 +28,41 @@
|
|||
<li><a href="#n16">Hashes</a>
|
||||
<li><a href="#n17">Lists</a>
|
||||
<li><a href="#n18">Common operations</a>
|
||||
<li><a href="#n19">I/O</a>
|
||||
<li><a href="#n19">Iterating over Lists and Hashes</a>
|
||||
<li><a href="#n20">I/O</a>
|
||||
</ul>
|
||||
<li><a href="#n20">Navigating and manipulating parse trees</a>
|
||||
<li><a href="#n21">Working with attributes</a>
|
||||
<li><a href="#n22">Type system</a>
|
||||
<li><a href="#n21">Navigating and manipulating parse trees</a>
|
||||
<li><a href="#n22">Working with attributes</a>
|
||||
<li><a href="#n23">Type system</a>
|
||||
<ul>
|
||||
<li><a href="#n23">String encoding of types</a>
|
||||
<li><a href="#n24">Type construction</a>
|
||||
<li><a href="#n25">Type tests</a>
|
||||
<li><a href="#n26">Typedef and inheritance</a>
|
||||
<li><a href="#n27">Lvalues</a>
|
||||
<li><a href="#n28">Output functions</a>
|
||||
<li><a href="#n24">String encoding of types</a>
|
||||
<li><a href="#n25">Type construction</a>
|
||||
<li><a href="#n26">Type tests</a>
|
||||
<li><a href="#n27">Typedef and inheritance</a>
|
||||
<li><a href="#n28">Lvalues</a>
|
||||
<li><a href="#n29">Output functions</a>
|
||||
</ul>
|
||||
<li><a href="#n29">Parameters</a>
|
||||
<li><a href="#n30">Writing a Language Module</a>
|
||||
<li><a href="#n30">Parameters</a>
|
||||
<li><a href="#n31">Writing a Language Module</a>
|
||||
<ul>
|
||||
<li><a href="#n31">Execution model</a>
|
||||
<li><a href="#n32">Starting out</a>
|
||||
<li><a href="#n33">Command line options</a>
|
||||
<li><a href="#n34">Configuration and preprocessing</a>
|
||||
<li><a href="#n35">Entry point to code generation</a>
|
||||
<li><a href="#n36">Module I/O and wrapper skeleton</a>
|
||||
<li><a href="#n37">Low-level code generators</a>
|
||||
<li><a href="#n38">Configuration files</a>
|
||||
<li><a href="#n39">Runtime support</a>
|
||||
<li><a href="#n40">Standard library files</a>
|
||||
<li><a href="#n41">Examples and test cases</a>
|
||||
<li><a href="#n42">Documentation</a>
|
||||
<li><a href="#n32">Execution model</a>
|
||||
<li><a href="#n33">Starting out</a>
|
||||
<li><a href="#n34">Command line options</a>
|
||||
<li><a href="#n35">Configuration and preprocessing</a>
|
||||
<li><a href="#n36">Entry point to code generation</a>
|
||||
<li><a href="#n37">Module I/O and wrapper skeleton</a>
|
||||
<li><a href="#n38">Low-level code generators</a>
|
||||
<li><a href="#n39">Configuration files</a>
|
||||
<li><a href="#n40">Runtime support</a>
|
||||
<li><a href="#n41">Standard library files</a>
|
||||
<li><a href="#n42">Examples and test cases</a>
|
||||
<li><a href="#n43">Documentation</a>
|
||||
</ul>
|
||||
<li><a href="#n43">Typemaps</a>
|
||||
<li><a href="#n44">Typemaps</a>
|
||||
<ul>
|
||||
<li><a href="#n44">Proxy classes</a>
|
||||
<li><a href="#n45">Proxy classes</a>
|
||||
</ul>
|
||||
<li><a href="#n45">Guide to parse tree nodes</a>
|
||||
<li><a href="#n46">Guide to parse tree nodes</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -1175,7 +1176,8 @@ objects and report errors.
|
|||
Gets the line number associated with <tt>x</tt>.
|
||||
</blockquote>
|
||||
|
||||
<H3>Iterating over Lists and Hashes</h3>
|
||||
<a name="n19"></a><H3>23.5.5 Iterating over Lists and Hashes</H3>
|
||||
|
||||
|
||||
To iterate over the elements of a list or a hash table, the following functions are used:
|
||||
|
||||
|
|
@ -1214,7 +1216,7 @@ for (j = First(j); j.item; j= Next(j)) {
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n19"></a><H3>23.5.5 I/O</H3>
|
||||
<a name="n20"></a><H3>23.5.6 I/O</H3>
|
||||
|
||||
|
||||
Special I/O functions are used for all internal I/O. These operations
|
||||
|
|
@ -1321,7 +1323,7 @@ Printf(f, "%s\n", s);
|
|||
|
||||
Similarly, the preprocessor and parser all operate on string-files.
|
||||
|
||||
<a name="n20"></a><H2>23.6 Navigating and manipulating parse trees</H2>
|
||||
<a name="n21"></a><H2>23.6 Navigating and manipulating parse trees</H2>
|
||||
|
||||
|
||||
Parse trees are built as collections of hash tables. Each node is a hash table in which
|
||||
|
|
@ -1423,7 +1425,7 @@ Deletes a node from the parse tree. Deletion reconnects siblings and properly u
|
|||
the parent so that sibling nodes are unaffected.
|
||||
</blockquote>
|
||||
|
||||
<a name="n21"></a><H2>23.7 Working with attributes</H2>
|
||||
<a name="n22"></a><H2>23.7 Working with attributes</H2>
|
||||
|
||||
|
||||
Since parse tree nodes are just hash tables, attributes are accessed using the <tt>Getattr()</tt>,
|
||||
|
|
@ -1522,14 +1524,14 @@ the attribute is optional. <tt>Swig_restore()</tt> must always be called after
|
|||
function.
|
||||
</blockquote>
|
||||
|
||||
<a name="n22"></a><H2>23.8 Type system</H2>
|
||||
<a name="n23"></a><H2>23.8 Type system</H2>
|
||||
|
||||
|
||||
SWIG implements the complete C++ type system including typedef, inheritance,
|
||||
pointers, references, and pointers to members. A detailed discussion of
|
||||
type theory is impossible here. However, let's cover the highlights.
|
||||
|
||||
<a name="n23"></a><H3>23.8.1 String encoding of types</H3>
|
||||
<a name="n24"></a><H3>23.8.1 String encoding of types</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1617,7 +1619,7 @@ is processed in a few pieces. In this case, you have the base type
|
|||
make the final type, the two parts are just joined together using
|
||||
string concatenation.
|
||||
|
||||
<a name="n24"></a><H3>23.8.2 Type construction</H3>
|
||||
<a name="n25"></a><H3>23.8.2 Type construction</H3>
|
||||
|
||||
|
||||
The following functions are used to construct types. You should use
|
||||
|
|
@ -1724,7 +1726,7 @@ Returns the prefix of a type. For example, if <tt>ty</tt> is
|
|||
<tt>ty</tt> is unmodified.
|
||||
</blockquote>
|
||||
|
||||
<a name="n25"></a><H3>23.8.3 Type tests</H3>
|
||||
<a name="n26"></a><H3>23.8.3 Type tests</H3>
|
||||
|
||||
|
||||
The following functions can be used to test properties of a datatype.
|
||||
|
|
@ -1789,7 +1791,7 @@ Checks if <tt>ty</tt> is a varargs type.
|
|||
Checks if <tt>ty</tt> is a templatized type.
|
||||
</blockquote>
|
||||
|
||||
<a name="n26"></a><H3>23.8.4 Typedef and inheritance</H3>
|
||||
<a name="n27"></a><H3>23.8.4 Typedef and inheritance</H3>
|
||||
|
||||
|
||||
The behavior of <tt>typedef</tt> declaration is to introduce a type alias.
|
||||
|
|
@ -1874,7 +1876,7 @@ Fully reduces <tt>ty</tt> according to typedef rules. Resulting datatype
|
|||
will consist only of primitive typenames.
|
||||
</blockquote>
|
||||
|
||||
<a name="n27"></a><H3>23.8.5 Lvalues</H3>
|
||||
<a name="n28"></a><H3>23.8.5 Lvalues</H3>
|
||||
|
||||
|
||||
When generating wrapper code, it is necessary to emit datatypes that can
|
||||
|
|
@ -1905,7 +1907,7 @@ Literal y; // type = 'Literal', ltype='p.char'
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n28"></a><H3>23.8.6 Output functions</H3>
|
||||
<a name="n29"></a><H3>23.8.6 Output functions</H3>
|
||||
|
||||
|
||||
The following functions produce strings that are suitable for output.
|
||||
|
|
@ -1955,7 +1957,7 @@ SWIG, but is most commonly associated with type-descriptor objects
|
|||
that appear in wrappers (e.g., <tt>SWIGTYPE_p_double</tt>).
|
||||
</blockquote>
|
||||
|
||||
<a name="n29"></a><H2>23.9 Parameters</H2>
|
||||
<a name="n30"></a><H2>23.9 Parameters</H2>
|
||||
|
||||
|
||||
Several type-related functions involve parameter lists. These include
|
||||
|
|
@ -2034,7 +2036,7 @@ included. Used to emit prototypes.
|
|||
Returns the number of required (non-optional) arguments in <tt>p</tt>.
|
||||
</blockquote>
|
||||
|
||||
<a name="n30"></a><H2>23.10 Writing a Language Module</H2>
|
||||
<a name="n31"></a><H2>23.10 Writing a Language Module</H2>
|
||||
|
||||
|
||||
This section briefly outlines the steps needed to create a bare-bones
|
||||
|
|
@ -2043,7 +2045,7 @@ of existing modules. Since the code is relatively easy to read, this section
|
|||
describes the creation of a minimal Python module. You should be able to extrapolate
|
||||
this to other languages.
|
||||
|
||||
<a name="n31"></a><H3>23.10.1 Execution model</H3>
|
||||
<a name="n32"></a><H3>23.10.1 Execution model</H3>
|
||||
|
||||
|
||||
Code generation modules are defined by inheriting from the <tt>Language</tt> class,
|
||||
|
|
@ -2051,7 +2053,7 @@ currently defined in the <tt>Source/Modules1.1</tt> directory of SWIG. Starting
|
|||
the parsing of command line options, all aspects of code generation are controlled by
|
||||
different methods of the <tt>Language</tt> that must be defined by your module.
|
||||
|
||||
<a name="n32"></a><H3>23.10.2 Starting out</H3>
|
||||
<a name="n33"></a><H3>23.10.2 Starting out</H3>
|
||||
|
||||
|
||||
To define a new language module, first create a minimal implementation using
|
||||
|
|
@ -2143,7 +2145,7 @@ Once it finishes compiling, try running SWIG with the command-line option
|
|||
that activates your module. For example, <tt>swig -python foo.i</tt>. The
|
||||
messages from your new module should appear.
|
||||
|
||||
<a name="n33"></a><H3>23.10.3 Command line options</H3>
|
||||
<a name="n34"></a><H3>23.10.3 Command line options</H3>
|
||||
|
||||
|
||||
When SWIG starts, the command line options are passed to your language module. This occurs
|
||||
|
|
@ -2197,7 +2199,7 @@ If a module recognizes an option, it should always call <tt>Swig_mark_arg()</tt>
|
|||
to mark the option as valid. If you forget to do this, SWIG will terminate with an
|
||||
unrecognized command line option error.
|
||||
|
||||
<a name="n34"></a><H3>23.10.4 Configuration and preprocessing</H3>
|
||||
<a name="n35"></a><H3>23.10.4 Configuration and preprocessing</H3>
|
||||
|
||||
|
||||
In addition to looking at command line options, the <tt>main()</tt> method is responsible
|
||||
|
|
@ -2240,7 +2242,7 @@ Just to review, your language module should now consist of two files--
|
|||
an implementation file <tt>python.cxx</tt> and a configuration file
|
||||
<tt>python.swg</tt>.
|
||||
|
||||
<a name="n35"></a><H3>23.10.5 Entry point to code generation</H3>
|
||||
<a name="n36"></a><H3>23.10.5 Entry point to code generation</H3>
|
||||
|
||||
|
||||
SWIG is a multi-pass compiler. Once the <tt>main()</tt> method has
|
||||
|
|
@ -2294,13 +2296,13 @@ int Python::top(Node *n) {
|
|||
</blockquote>
|
||||
</pre>
|
||||
|
||||
<a name="n36"></a><H3>23.10.6 Module I/O and wrapper skeleton</H3>
|
||||
<a name="n37"></a><H3>23.10.6 Module I/O and wrapper skeleton</H3>
|
||||
|
||||
|
||||
<a name="n37"></a><H3>23.10.7 Low-level code generators</H3>
|
||||
<a name="n38"></a><H3>23.10.7 Low-level code generators</H3>
|
||||
|
||||
|
||||
<a name="n38"></a><H3>23.10.8 Configuration files</H3>
|
||||
<a name="n39"></a><H3>23.10.8 Configuration files</H3>
|
||||
|
||||
|
||||
<!-- please report bugs in this section to ttn -->
|
||||
|
|
@ -2426,14 +2428,14 @@ to handle some of these configuration tasks, but that point is now
|
|||
long past. If you are interested in working on that, feel free to
|
||||
raise the issue in the context of a next-generation clean-slate SWIG.<p>
|
||||
|
||||
<a name="n39"></a><H3>23.10.9 Runtime support</H3>
|
||||
<a name="n40"></a><H3>23.10.9 Runtime support</H3>
|
||||
|
||||
|
||||
Discuss the kinds of functions typically needed for SWIG runtime support (e.g.
|
||||
<tt>SWIG_ConvertPtr()</tt> and <tt>SWIG_NewPointerObj()</tt>) and the names of
|
||||
the SWIG files that implement those functions.
|
||||
|
||||
<a name="n40"></a><H3>23.10.10 Standard library files</H3>
|
||||
<a name="n41"></a><H3>23.10.10 Standard library files</H3>
|
||||
|
||||
|
||||
Discuss the standard library files that most language modules provide, e.g.
|
||||
|
|
@ -2444,7 +2446,7 @@ Discuss the standard library files that most language modules provide, e.g.
|
|||
<li> stl.i </li>
|
||||
</ul>
|
||||
|
||||
<a name="n41"></a><H3>23.10.11 Examples and test cases</H3>
|
||||
<a name="n42"></a><H3>23.10.11 Examples and test cases</H3>
|
||||
|
||||
|
||||
Each of the language modules provides one or more examples. These examples
|
||||
|
|
@ -2465,7 +2467,7 @@ By default, all of the examples are built and run when the user types
|
|||
during this process, see the section on <a href="#n37a">configuration
|
||||
files</a>.
|
||||
|
||||
<a name="n42"></a><H3>23.10.12 Documentation</H3>
|
||||
<a name="n43"></a><H3>23.10.12 Documentation</H3>
|
||||
|
||||
|
||||
Don't forget to write end-user documentation for your language module. Currently,
|
||||
|
|
@ -2492,13 +2494,13 @@ Some topics that you'll want to be sure to address include:
|
|||
if available.
|
||||
</ul>
|
||||
|
||||
<a name="n43"></a><H2>23.11 Typemaps</H2>
|
||||
<a name="n44"></a><H2>23.11 Typemaps</H2>
|
||||
|
||||
|
||||
<a name="n44"></a><H3>23.11.1 Proxy classes</H3>
|
||||
<a name="n45"></a><H3>23.11.1 Proxy classes</H3>
|
||||
|
||||
|
||||
<a name="n45"></a><H2>23.12 Guide to parse tree nodes</H2>
|
||||
<a name="n46"></a><H2>23.12 Guide to parse tree nodes</H2>
|
||||
|
||||
|
||||
This section describes the different parse tree nodes and their attributes.
|
||||
|
|
@ -2815,4 +2817,4 @@ extern "X" { ... } declaration.
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : January 22, 2002</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -25,14 +25,14 @@
|
|||
<li><a href="#n12">Typemaps</a>
|
||||
<li><a href="#n13">Representation of pointers as smobs</a>
|
||||
<ul>
|
||||
<li><a href="#n14">GH API</a>
|
||||
<li><a href="#n15">SCM API</a>
|
||||
<li><a href="#n14">GH Smobs</a>
|
||||
<li><a href="#n15">SCM Smobs</a>
|
||||
<li><a href="#n16">Garbage Collection</a>
|
||||
</ul>
|
||||
<li><a href="#n17">Exception Handling</a>
|
||||
<li><a href="#n18">Procedure documentation</a>
|
||||
<li><a href="#n19">Procedures with setters</a>
|
||||
<li><a href="#n20">GOOPS support</a>
|
||||
<li><a href="#n20">GOOPS Shadow Classes</a>
|
||||
<ul>
|
||||
<li><a href="#n21">Naming Issues</a>
|
||||
<li><a href="#n22">Linking</a>
|
||||
|
|
@ -57,6 +57,7 @@ we explicitly prefix the context, e.g., "guile-module".
|
|||
|
||||
<a name="n3"></a><H2>14.2 Using the SCM or GH Guile API</H2>
|
||||
|
||||
|
||||
<p>The guile module can currently export wrapper files that use the guile GH interface or the
|
||||
SCM interface. This is controlled by an argument passed to swig. The "-gh" argument causes swig
|
||||
to output GH code, and the "-scm" argument causes swig to output SCM code. Right now the "-gh" argument
|
||||
|
|
@ -391,6 +392,7 @@ See also the "multivalue" example.
|
|||
|
||||
<a name="n13"></a><H2>14.6 Representation of pointers as smobs</H2>
|
||||
|
||||
|
||||
<p>
|
||||
For pointer types, SWIG uses Guile smobs. SWIG smobs print
|
||||
like this: <code>#<swig struct xyzzy * 0x1234affe></code> Two of
|
||||
|
|
@ -411,6 +413,7 @@ pointer, a <code>wrong-type-arg</code> exception is raised.
|
|||
|
||||
<a name="n14"></a><H3>14.6.1 GH Smobs</H3>
|
||||
|
||||
|
||||
<p>
|
||||
In earlier versions of SWIG, C pointers were represented as Scheme
|
||||
strings containing a hexadecimal rendering of the pointer value and a
|
||||
|
|
@ -429,6 +432,7 @@ are appended. The CDR stores the pointer value.
|
|||
|
||||
<a name="n15"></a><H3>14.6.2 SCM Smobs</H3>
|
||||
|
||||
|
||||
<p>The SCM interface (using the "-scm" argument to swig) uses common.swg.
|
||||
The whole type system, when it is first initialized, creates two smobs named "swig" and "collected_swig".
|
||||
The swig smob is used for non-garbage collected smobs, while the collected_swig smob is used as described
|
||||
|
|
@ -443,6 +447,7 @@ GOOPS class.</p>
|
|||
|
||||
<a name="n16"></a><H3>14.6.3 Garbage Collection</H3>
|
||||
|
||||
|
||||
<p>Garbage collection is a feature of the new SCM interface, and it is automatically included
|
||||
if you pass the "-scm" flag to swig. Thus the swig garbage collection support requires guile >1.6.
|
||||
Garbage collection works like this. Every swig_type_info structure stores in its clientdata field a pointer
|
||||
|
|
@ -455,6 +460,8 @@ Section 9.2 Object ownership and %newobject</a> in the SWIG manual. All typemap
|
|||
the guile module replaces $owner with 0 or 1 depending on feature:new.</p>
|
||||
|
||||
<a name="n17"></a><H2>14.7 Exception Handling</H2>
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
<p>
|
||||
|
|
@ -479,6 +486,8 @@ The default when not specified here is to use "swig-error".
|
|||
See Lib/exception.i for details.
|
||||
|
||||
<a name="n18"></a><H2>14.8 Procedure documentation</H2>
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
<p>If invoked with the command-line option <code>-procdoc
|
||||
|
|
@ -541,7 +550,9 @@ struct members, the procedures <code>(<var>struct</var>-<var>member</var>-get
|
|||
pointer)</code> and <code>(<var>struct-member</var>-set pointer
|
||||
value)</code> are <em>not</em> generated.
|
||||
|
||||
<a name="n20"></a><h2>14.10 GOOPS Shadow Classes</h2>
|
||||
<a name="n20"></a><H2>14.10 GOOPS Shadow Classes</H2>
|
||||
|
||||
|
||||
<p>SWIG can also generate classes and generic functions for use with
|
||||
Guile's Object-Oriented Programming System (GOOPS). GOOPS is a
|
||||
sophisticated object system in the spirit of the Common Lisp Object
|
||||
|
|
@ -662,7 +673,9 @@ before the definition of <Foo>. The generated GOOPS file would look like
|
|||
Notice that <Foo> is used before it is defined. The fix is to just put the
|
||||
<code>%import "foo.h"</code> before the <code>%inline</code> block.
|
||||
|
||||
<a name="n21"></a><h3>14.10.1 Naming Issues</h3>
|
||||
<a name="n21"></a><H3>14.10.1 Naming Issues</H3>
|
||||
|
||||
|
||||
<p>As you can see in the example above, there are potential naming conflicts. The default exported
|
||||
accessor for the <code>Foo::a</code> variable is named <code>a</code>. The name of the wrapper global
|
||||
function is <code>getFooPlus</code>.
|
||||
|
|
@ -698,7 +711,9 @@ guile-modules. For example,</p>
|
|||
|
||||
<p>TODO: Renaming class name prefixes?</p>
|
||||
|
||||
<a name="n22"></a><h3>14.10.2 Linking</h3>
|
||||
<a name="n22"></a><H3>14.10.2 Linking</H3>
|
||||
|
||||
|
||||
<p>The guile-modules generated above all need to be linked together. GOOPS support requires
|
||||
either passive or module linkage. The exported GOOPS guile-module will be the name of the swig-module
|
||||
and should be located in a file called <i>Module</i>.scm. This should be installed on the autoload
|
||||
|
|
@ -793,4 +808,4 @@ directive of <code>mod2</code>. Maybe in the future SWIG can detect dependencie
|
|||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -68,49 +68,49 @@
|
|||
<li><a href="#n43">Overhead and code bloat</a>
|
||||
<li><a href="#n44">Simple directors example</a>
|
||||
</ul>
|
||||
<li><a href="#n46">Common customization features</a>
|
||||
<li><a href="#n45">Common customization features</a>
|
||||
<ul>
|
||||
<li><a href="#n47">C/C++ helper functions</a>
|
||||
<li><a href="#n48">Class extension with %extend</a>
|
||||
<li><a href="#n49">Exception handling with %exception</a>
|
||||
<li><a href="#n50">Method access with %javamethodmodifiers</a>
|
||||
<li><a href="#n46">C/C++ helper functions</a>
|
||||
<li><a href="#n47">Class extension with %extend</a>
|
||||
<li><a href="#n48">Exception handling with %exception</a>
|
||||
<li><a href="#n49">Method access with %javamethodmodifiers</a>
|
||||
</ul>
|
||||
<li><a href="#n51">Tips and techniques</a>
|
||||
<li><a href="#n50">Tips and techniques</a>
|
||||
<ul>
|
||||
<li><a href="#n52">Input and output parameters using primitive pointers and references</a>
|
||||
<li><a href="#n53">Simple pointers</a>
|
||||
<li><a href="#n54">Wrapping C arrays with Java arrays</a>
|
||||
<li><a href="#n55">Unbounded C Arrays</a>
|
||||
<li><a href="#n51">Input and output parameters using primitive pointers and references</a>
|
||||
<li><a href="#n52">Simple pointers</a>
|
||||
<li><a href="#n53">Wrapping C arrays with Java arrays</a>
|
||||
<li><a href="#n54">Unbounded C Arrays</a>
|
||||
</ul>
|
||||
<li><a href="#n56">Java typemaps</a>
|
||||
<li><a href="#n55">Java typemaps</a>
|
||||
<ul>
|
||||
<li><a href="#n57">Default primitive type mappings</a>
|
||||
<li><a href="#n58">Sixty four bit JVMs</a>
|
||||
<li><a href="#n59">What is a typemap?</a>
|
||||
<li><a href="#n60">Typemaps for mapping C/C++ types to Java types</a>
|
||||
<li><a href="#n61">Java special variables</a>
|
||||
<li><a href="#n62">Typemaps for both C and C++ compilation</a>
|
||||
<li><a href="#n63">Java code typemaps</a>
|
||||
<li><a href="#n64">Director specific typemaps</a>
|
||||
<li><a href="#n56">Default primitive type mappings</a>
|
||||
<li><a href="#n57">Sixty four bit JVMs</a>
|
||||
<li><a href="#n58">What is a typemap?</a>
|
||||
<li><a href="#n59">Typemaps for mapping C/C++ types to Java types</a>
|
||||
<li><a href="#n60">Java special variables</a>
|
||||
<li><a href="#n61">Typemaps for both C and C++ compilation</a>
|
||||
<li><a href="#n62">Java code typemaps</a>
|
||||
<li><a href="#n63">Director specific typemaps</a>
|
||||
</ul>
|
||||
<li><a href="#n65">Typemap Examples</a>
|
||||
<li><a href="#n64">Typemap Examples</a>
|
||||
<ul>
|
||||
<li><a href="#n66">Converting Java String arrays to char ** </a>
|
||||
<li><a href="#n67">Expanding a Java object to multiple arguments</a>
|
||||
<li><a href="#n68">Using typemaps to return arguments</a>
|
||||
<li><a href="#n69">Adding Java downcasts to polymorphic return types</a>
|
||||
<li><a href="#n70">Adding an equals method to the Java classes</a>
|
||||
<li><a href="#n71">Void pointers and a common Java base class</a>
|
||||
<li><a href="#n65">Converting Java String arrays to char ** </a>
|
||||
<li><a href="#n66">Expanding a Java object to multiple arguments</a>
|
||||
<li><a href="#n67">Using typemaps to return arguments</a>
|
||||
<li><a href="#n68">Adding Java downcasts to polymorphic return types</a>
|
||||
<li><a href="#n69">Adding an equals method to the Java classes</a>
|
||||
<li><a href="#n70">Void pointers and a common Java base class</a>
|
||||
</ul>
|
||||
<li><a href="#n72">Living with Java Directors</a>
|
||||
<li><a href="#n73">Odds and ends</a>
|
||||
<li><a href="#n71">Living with Java Directors</a>
|
||||
<li><a href="#n72">Odds and ends</a>
|
||||
<ul>
|
||||
<li><a href="#n74">JavaDoc comments</a>
|
||||
<li><a href="#n75">Functional interface without proxy classes</a>
|
||||
<li><a href="#n76">Using your own JNI functions</a>
|
||||
<li><a href="#n77">Performance concerns and hints</a>
|
||||
<li><a href="#n73">JavaDoc comments</a>
|
||||
<li><a href="#n74">Functional interface without proxy classes</a>
|
||||
<li><a href="#n75">Using your own JNI functions</a>
|
||||
<li><a href="#n76">Performance concerns and hints</a>
|
||||
</ul>
|
||||
<li><a href="#n78">Examples</a>
|
||||
<li><a href="#n77">Examples</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -2354,7 +2354,7 @@ directorDerived::upcall_method() invoked.
|
|||
</blockquote>
|
||||
|
||||
<a name="common_customization"></a>
|
||||
<a name="n46"></a><H2>15.6 Common customization features</H2>
|
||||
<a name="n45"></a><H2>15.6 Common customization features</H2>
|
||||
|
||||
|
||||
An earlier section presented the absolute basics of C/C++ wrapping. If you do nothing
|
||||
|
|
@ -2365,7 +2365,7 @@ be awkward. This section describes some common SWIG features that are used
|
|||
to improve the interface to existing C/C++ code.
|
||||
|
||||
<a name="helper_functions"></a>
|
||||
<a name="n47"></a><H3>15.6.1 C/C++ helper functions</H3>
|
||||
<a name="n46"></a><H3>15.6.1 C/C++ helper functions</H3>
|
||||
|
||||
|
||||
Sometimes when you create a module, it is missing certain bits of functionality. For
|
||||
|
|
@ -2424,7 +2424,7 @@ hard to implement. It is possible to improve on this using Java code, typemaps,
|
|||
customization features as covered in later sections, but sometimes helper functions are a quick and easy solution to difficult cases.
|
||||
|
||||
<a name="class_extension"></a>
|
||||
<a name="n48"></a><H3>15.6.2 Class extension with %extend</H3>
|
||||
<a name="n47"></a><H3>15.6.2 Class extension with %extend</H3>
|
||||
|
||||
|
||||
One of the more interesting features of SWIG is that it can extend
|
||||
|
|
@ -2479,7 +2479,7 @@ Vector(2,3,4)
|
|||
in any way---the extensions only show up in the Java interface.
|
||||
|
||||
<a name="exception_handling"></a>
|
||||
<a name="n49"></a><H3>15.6.3 Exception handling with %exception</H3>
|
||||
<a name="n48"></a><H3>15.6.3 Exception handling with %exception</H3>
|
||||
|
||||
|
||||
If a C or C++ function throws an error, you may want to convert that error into a Java
|
||||
|
|
@ -2579,7 +2579,7 @@ The language-independent <tt>exception.i</tt> library file can also be used
|
|||
to raise exceptions. See the <a href="Library.html">SWIG Library</a> chapter.
|
||||
|
||||
<a name="method_access"></a>
|
||||
<a name="n50"></a><H3>15.6.4 Method access with %javamethodmodifiers</H3>
|
||||
<a name="n49"></a><H3>15.6.4 Method access with %javamethodmodifiers</H3>
|
||||
|
||||
|
||||
A Java feature called <tt>%javamethodmodifiers</tt> can be used to change the method modifiers from the default <tt>public</tt>. It applies to both module class methods and proxy class methods. For example:
|
||||
|
|
@ -2602,7 +2602,7 @@ protected static void protect_me() {
|
|||
</blockquote>
|
||||
|
||||
<a name="tips_techniques"></a>
|
||||
<a name="n51"></a><H2>15.7 Tips and techniques</H2>
|
||||
<a name="n50"></a><H2>15.7 Tips and techniques</H2>
|
||||
|
||||
|
||||
Although SWIG is largely automatic, there are certain types of wrapping problems that
|
||||
|
|
@ -2611,7 +2611,7 @@ strings and arrays. This chapter discusses the common techniques for
|
|||
solving these problems.
|
||||
|
||||
<a name="input_output_parameters"></a>
|
||||
<a name="n52"></a><H3>15.7.1 Input and output parameters using primitive pointers and references</H3>
|
||||
<a name="n51"></a><H3>15.7.1 Input and output parameters using primitive pointers and references</H3>
|
||||
|
||||
|
||||
A common problem in some C programs is handling parameters passed as simple pointers or references. For
|
||||
|
|
@ -2754,7 +2754,7 @@ void foo(Bar *OUTPUT);
|
|||
will not have the intended effect since <tt>typemaps.i</tt> does not define an OUTPUT rule for <tt>Bar</tt>.
|
||||
|
||||
<a name="simple_pointers"></a>
|
||||
<a name="n53"></a><H3>15.7.2 Simple pointers</H3>
|
||||
<a name="n52"></a><H3>15.7.2 Simple pointers</H3>
|
||||
|
||||
|
||||
If you must work with simple pointers such as <tt>int *</tt> or <tt>double *</tt> another approach to using
|
||||
|
|
@ -2808,7 +2808,7 @@ System.out.println("3 + 4 = " + result);
|
|||
See the <a href="Library.html">SWIG Library</a> chapter for further details.
|
||||
|
||||
<a name="c_arrays"></a>
|
||||
<a name="n54"></a><H3>15.7.3 Wrapping C arrays with Java arrays</H3>
|
||||
<a name="n53"></a><H3>15.7.3 Wrapping C arrays with Java arrays</H3>
|
||||
|
||||
|
||||
SWIG can wrap arrays in a more natural Java manner than the default by using the <tt>arrays_java.i</tt> library file.
|
||||
|
|
@ -2866,7 +2866,7 @@ Please be aware that the typemaps in this library are not efficient as all the e
|
|||
There is an alternative approach using the SWIG array library and this is covered in the next.
|
||||
|
||||
<a name="unbounded_c_arrays"></a>
|
||||
<a name="n55"></a><H3>15.7.4 Unbounded C Arrays</H3>
|
||||
<a name="n54"></a><H3>15.7.4 Unbounded C Arrays</H3>
|
||||
|
||||
|
||||
Sometimes a C function expects an array to be passed as a pointer. For example,
|
||||
|
|
@ -2992,7 +2992,7 @@ well suited for applications in which you need to create buffers,
|
|||
package binary data, etc.
|
||||
|
||||
<a name="java_typemaps"></a>
|
||||
<a name="n56"></a><H2>15.8 Java typemaps</H2>
|
||||
<a name="n55"></a><H2>15.8 Java typemaps</H2>
|
||||
|
||||
|
||||
This section describes how you can modify SWIG's default wrapping behavior
|
||||
|
|
@ -3012,7 +3012,7 @@ part of using SWIG---the default wrapping behavior is enough in most cases.
|
|||
Typemaps are only used if you want to change some aspect of the generated code.
|
||||
|
||||
<a name="default_primitive_type_mappings"></a>
|
||||
<a name="n57"></a><H3>15.8.1 Default primitive type mappings</H3>
|
||||
<a name="n56"></a><H3>15.8.1 Default primitive type mappings</H3>
|
||||
|
||||
|
||||
The following table lists the default type mapping from Java to C/C++.<p>
|
||||
|
|
@ -3144,7 +3144,7 @@ However, the mappings allow the full range of values for each C type from Java.
|
|||
<p>
|
||||
|
||||
<a name="jvm64"></a>
|
||||
<a name="n58"></a><H3>15.8.2 Sixty four bit JVMs</H3>
|
||||
<a name="n57"></a><H3>15.8.2 Sixty four bit JVMs</H3>
|
||||
|
||||
|
||||
If you are using a 64 bit JVM you may have to override the C long, but probably not C int default mappings.
|
||||
|
|
@ -3156,7 +3156,7 @@ Unfortunately it won't of course hold true for JNI code.
|
|||
|
||||
|
||||
<a name="what_is_typemap"></a>
|
||||
<a name="n59"></a><H3>15.8.3 What is a typemap?</H3>
|
||||
<a name="n58"></a><H3>15.8.3 What is a typemap?</H3>
|
||||
|
||||
|
||||
A typemap is nothing more than a code generation rule that is attached to
|
||||
|
|
@ -3257,7 +3257,7 @@ int c = example.count('e',"Hello World");
|
|||
</blockquote>
|
||||
|
||||
<a name="typemaps_c_to_java_types"></a>
|
||||
<a name="n60"></a><H3>15.8.4 Typemaps for mapping C/C++ types to Java types</H3>
|
||||
<a name="n59"></a><H3>15.8.4 Typemaps for mapping C/C++ types to Java types</H3>
|
||||
|
||||
|
||||
The typemaps available to the Java module include the common typemaps listed in the main typemaps section.
|
||||
|
|
@ -3441,7 +3441,7 @@ These are listed below:
|
|||
</table>
|
||||
|
||||
<a name="special_variables"></a>
|
||||
<a name="n61"></a><H3>15.8.5 Java special variables</H3>
|
||||
<a name="n60"></a><H3>15.8.5 Java special variables</H3>
|
||||
|
||||
|
||||
The standard SWIG special variables are available for use within typemaps as described in the <a href=Typemaps.html>Typemaps documentation</a>, for example <tt>$1</tt>, <tt>$input</tt>,<tt>$result</tt> etc.
|
||||
|
|
@ -3544,7 +3544,7 @@ public static Class bar(Class cls, int ush) {
|
|||
These special variables used in the directors typemaps. See <a href="#java_directors_typemaps">Director specific typemaps</a> for details.
|
||||
|
||||
<a name="typemaps_for_c_and_c++"></a>
|
||||
<a name="n62"></a><H3>15.8.6 Typemaps for both C and C++ compilation</H3>
|
||||
<a name="n61"></a><H3>15.8.6 Typemaps for both C and C++ compilation</H3>
|
||||
|
||||
|
||||
JNI calls must be written differently depending on whether the code is being compiled as C or C++.
|
||||
|
|
@ -3575,7 +3575,7 @@ If you do not intend your code to be targeting both C and C++ then your typemaps
|
|||
|
||||
|
||||
<a name="java_code_typemaps"></a>
|
||||
<a name="n63"></a><H3>15.8.7 Java code typemaps</H3>
|
||||
<a name="n62"></a><H3>15.8.7 Java code typemaps</H3>
|
||||
|
||||
|
||||
Most of SWIG's typemaps are used for the generation of C/C++ code.
|
||||
|
|
@ -3705,7 +3705,7 @@ Note that <tt>SWIGTYPE</tt> will target all proxy classes, but not all type wrap
|
|||
<p>
|
||||
|
||||
<a name="java_directors_typemaps"></a>
|
||||
<a name="n64"></a><H3>15.8.8 Director specific typemaps</H3>
|
||||
<a name="n63"></a><H3>15.8.8 Director specific typemaps</H3>
|
||||
|
||||
|
||||
The Java directors feature requires the "javadirectorin", "javadirectorout" and the "directorin" typemaps in order to work properly.
|
||||
|
|
@ -3858,7 +3858,7 @@ The basic strategy here is to provide a default package typemap for the majority
|
|||
</blockquote>
|
||||
|
||||
<a name="typemap_examples"></a>
|
||||
<a name="n65"></a><H2>15.9 Typemap Examples</H2>
|
||||
<a name="n64"></a><H2>15.9 Typemap Examples</H2>
|
||||
|
||||
|
||||
This section includes a few examples of typemaps. For more examples, you
|
||||
|
|
@ -3867,7 +3867,7 @@ the SWIG library.
|
|||
|
||||
|
||||
<a name="converting_java_string_arrays"></a>
|
||||
<a name="n66"></a><H3>15.9.1 Converting Java String arrays to char ** </H3>
|
||||
<a name="n65"></a><H3>15.9.1 Converting Java String arrays to char ** </H3>
|
||||
|
||||
|
||||
A common problem in many C programs is the processing of command line arguments, which are usually passed in an array of NULL terminated strings.
|
||||
|
|
@ -4000,7 +4000,7 @@ Lastly the "jni", "jtype" and "jstype" typemaps are also required to specify
|
|||
what Java types to use.
|
||||
|
||||
<a name="expanding_java_object"></a>
|
||||
<a name="n67"></a><H3>15.9.2 Expanding a Java object to multiple arguments</H3>
|
||||
<a name="n66"></a><H3>15.9.2 Expanding a Java object to multiple arguments</H3>
|
||||
|
||||
|
||||
Suppose that you had a collection of C functions with arguments
|
||||
|
|
@ -4074,7 +4074,7 @@ example.foo(new String[]{"red", "green", "blue", "white"});
|
|||
|
||||
|
||||
<a name="using_typemaps_return_arguments"></a>
|
||||
<a name="n68"></a><H3>15.9.3 Using typemaps to return arguments</H3>
|
||||
<a name="n67"></a><H3>15.9.3 Using typemaps to return arguments</H3>
|
||||
|
||||
|
||||
A common problem in some C programs is that values may be returned in function parameters rather than in the return value of a function.
|
||||
|
|
@ -4175,7 +4175,7 @@ $ java main
|
|||
</pre></blockquote>
|
||||
|
||||
<a name="adding_downcasts"></a>
|
||||
<a name="n69"></a><H3>15.9.4 Adding Java downcasts to polymorphic return types</H3>
|
||||
<a name="n68"></a><H3>15.9.4 Adding Java downcasts to polymorphic return types</H3>
|
||||
|
||||
|
||||
SWIG support for polymorphism works in that the appropriate virtual function is called. However, the default generated code does not allow for downcasting.
|
||||
|
|
@ -4359,7 +4359,7 @@ SWIG usually generates code which constructs the proxy classes using Java code a
|
|||
Note that the JNI code above uses a number of string lookups to call a constructor, whereas this would not occur using byte compiled Java code.
|
||||
|
||||
<a name="adding_equals_method"></a>
|
||||
<a name="n70"></a><H3>15.9.5 Adding an equals method to the Java classes</H3>
|
||||
<a name="n69"></a><H3>15.9.5 Adding an equals method to the Java classes</H3>
|
||||
|
||||
|
||||
When a pointer is returned from a JNI function, it is wrapped using a new Java proxy class or type wrapper class.
|
||||
|
|
@ -4395,7 +4395,7 @@ System.out.println("foo1? " + foo1.equals(foo2));
|
|||
|
||||
|
||||
<a name="void_pointers"></a>
|
||||
<a name="n71"></a><H3>15.9.6 Void pointers and a common Java base class</H3>
|
||||
<a name="n70"></a><H3>15.9.6 Void pointers and a common Java base class</H3>
|
||||
|
||||
|
||||
One might wonder why the common code that SWIG emits for the proxy and type wrapper classes is not pushed into a base class.
|
||||
|
|
@ -4447,7 +4447,7 @@ This example contains some useful functionality which you may want in your code.
|
|||
</ul>
|
||||
|
||||
<a name="java_directors_faq"></a>
|
||||
<a name="n72"></a><H2>15.10 Living with Java Directors</H2>
|
||||
<a name="n71"></a><H2>15.10 Living with Java Directors</H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -4613,11 +4613,11 @@ public abstract class UserVisibleFoo extends Foo {
|
|||
</ol>
|
||||
|
||||
<a name="odds_ends"></a>
|
||||
<a name="n73"></a><H2>15.11 Odds and ends</H2>
|
||||
<a name="n72"></a><H2>15.11 Odds and ends</H2>
|
||||
|
||||
|
||||
<a name="javadoc_comments"></a>
|
||||
<a name="n74"></a><H3>15.11.1 JavaDoc comments</H3>
|
||||
<a name="n73"></a><H3>15.11.1 JavaDoc comments</H3>
|
||||
|
||||
|
||||
The SWIG documentation system is currently deprecated.
|
||||
|
|
@ -4669,7 +4669,7 @@ public class Barmy {
|
|||
|
||||
|
||||
<a name="functional_interface"></a>
|
||||
<a name="n75"></a><H3>15.11.2 Functional interface without proxy classes</H3>
|
||||
<a name="n74"></a><H3>15.11.2 Functional interface without proxy classes</H3>
|
||||
|
||||
|
||||
It is possible to run SWIG in a mode that does not produce proxy classes by using the -noproxy commandline option.
|
||||
|
|
@ -4721,7 +4721,7 @@ All destructors have to be called manually for example the <tt>delete_Foo(foo)</
|
|||
|
||||
|
||||
<a name="using_own_jni_functions"></a>
|
||||
<a name="n76"></a><H3>15.11.3 Using your own JNI functions</H3>
|
||||
<a name="n75"></a><H3>15.11.3 Using your own JNI functions</H3>
|
||||
|
||||
|
||||
You may have some hand written JNI functions that you want to use in addition to the SWIG generated JNI functions.
|
||||
|
|
@ -4762,7 +4762,7 @@ This directive is only really useful if you want to mix your own hand crafted JN
|
|||
|
||||
|
||||
<a name="performance"></a>
|
||||
<a name="n77"></a><H3>15.11.4 Performance concerns and hints</H3>
|
||||
<a name="n76"></a><H3>15.11.4 Performance concerns and hints</H3>
|
||||
|
||||
|
||||
If you're directly manipulating huge arrays of complex objects from Java, performance may suffer greatly when using the array functions in <tt>arrays_java.i</tt>.
|
||||
|
|
@ -4780,7 +4780,7 @@ This method calls the C++ destructor or <tt>free()</tt> for C code.
|
|||
|
||||
|
||||
<a name="java_examples"></a>
|
||||
<a name="n78"></a><H2>15.12 Examples</H2>
|
||||
<a name="n77"></a><H2>15.12 Examples</H2>
|
||||
|
||||
|
||||
The directory Examples/java has a number of further examples.
|
||||
|
|
@ -4790,4 +4790,4 @@ If your SWIG installation went well Unix users should be able to type <tt>make</
|
|||
For the benefit of Windows users, there are also Visual C++ project files in a couple of the <a href="Windows.html#examples">Windows Examples</a>.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<li><a href="#n4">Conditional Compilation</a>
|
||||
<li><a href="#n5">Macro Expansion</a>
|
||||
<li><a href="#n6">SWIG Macros</a>
|
||||
<li><a href="#n7">C99 Extensions</a>
|
||||
<li><a href="#n7">C99 and GNU Extensions</a>
|
||||
<li><a href="#n8">Preprocessing and %{ ... %} blocks</a>
|
||||
<li><a href="#n9">Preprocessing and { ... }</a>
|
||||
</ul>
|
||||
|
|
@ -316,4 +316,4 @@ SWIG will strip the extra <tt>%</tt> and leave the preprocessor directive in the
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : March 9, 2003</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -3645,4 +3645,4 @@ class object (if applicable).
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : August 7, 2002</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -66,16 +66,15 @@
|
|||
</ul>
|
||||
<li><a href="#n44">Operator overloading</a>
|
||||
<ul>
|
||||
<li><a href="#n45">An example (putting everything together)</a>
|
||||
<li><a href="#n47">STL Vector to Ruby Array</a>
|
||||
<li><a href="#n45">Example: STL Vector to Ruby Array</a>
|
||||
</ul>
|
||||
<li><a href="#n48">Advanced Topics</a>
|
||||
<li><a href="#n46">Advanced Topics</a>
|
||||
<ul>
|
||||
<li><a href="#n49">Creating Multi-Module Packages</a>
|
||||
<li><a href="#n50">Defining Aliases</a>
|
||||
<li><a href="#n51">Predicate Methods</a>
|
||||
<li><a href="#n52">Specifying Mixin Modules</a>
|
||||
<li><a href="#n53">Interacting with Ruby's Garbage Collector</a>
|
||||
<li><a href="#n47">Creating Multi-Module Packages</a>
|
||||
<li><a href="#n48">Defining Aliases</a>
|
||||
<li><a href="#n49">Predicate Methods</a>
|
||||
<li><a href="#n50">Specifying Mixin Modules</a>
|
||||
<li><a href="#n51">Interacting with Ruby's Garbage Collector</a>
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
|
@ -1075,6 +1074,7 @@ For example:
|
|||
<blockquote>
|
||||
<pre>
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include "pair.h"
|
||||
%}
|
||||
|
|
@ -1109,9 +1109,36 @@ irb(main):004:0> <b>p.second</b>
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
Obviously, there is more to template wrapping than shown in this example.
|
||||
More details can be found in the <a href="SWIGPlus.html">SWIG and C++</a> chapter. Some more complicated
|
||||
examples will appear later.
|
||||
On a related note, the standard SWIG library contains a number of modules that
|
||||
provide typemaps for standard C++ library classes (such as <tt>std::pair</tt>, <tt>std::string</tt>
|
||||
and <tt>std::vector</tt>). These library modules don't provide wrappers around the templates
|
||||
themselves, but they do make it convenient for users of your extension module to pass
|
||||
Ruby objects (such as arrays and strings) to wrapped C++ code that expects instances
|
||||
of standard C++ templates. For example, suppose the C++ library you're wrapping has a
|
||||
function that expects a vector of floats:
|
||||
|
||||
<blockquote><pre>
|
||||
%module example
|
||||
|
||||
float sum(const std::vector<float>& values);
|
||||
</pre></blockquote>
|
||||
|
||||
Rather than go through the hassle of writing an "in" typemap to convert an array of Ruby
|
||||
numbers into a std::vector<float>, you can just use the <tt>std_vector.i</tt> module
|
||||
from the standard SWIG library:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
%module example
|
||||
|
||||
<b>%include std_vector.i</b>
|
||||
|
||||
float sum(const std::vector<float>& values);
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
Obviously, there is a lot more to template wrapping than shown in these examples.
|
||||
More details can be found in the <a href="SWIGPlus.html">SWIG and C++</a> chapter.
|
||||
|
||||
<a name="n24"></a><H3>20.3.13 C++ Smart Pointers</H3>
|
||||
|
||||
|
|
@ -2353,68 +2380,10 @@ __ge__ - >=
|
|||
|
||||
Note that although SWIG supports the <tt>__eq__</tt> magic method name for defining an equivalence operator, there is no separate method for handling <i>inequality</i> since Ruby parses the expression <i>a != b</i> as <i>!(a == b)</i>.
|
||||
|
||||
<a name="n45"></a><H3>20.7.1 Example: Using Standard SWIG Library Modules</H3>
|
||||
<a name="n45"></a><H3>20.7.1 Example: STL Vector to Ruby Array</H3>
|
||||
|
||||
The following example illustrates how to use two of the standard SWIG library modules
|
||||
(the <tt>std_string.i</tt> and <tt>std_vector.i</tt> modules).
|
||||
|
||||
<p>
|
||||
<blockquote><pre>
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
#include <vector>
|
||||
%}
|
||||
|
||||
%include std_string.i
|
||||
%include std_vector.i
|
||||
|
||||
%template(StringVector) std::vector<string>;
|
||||
%template(IntVector) std::vector<int>;
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
An IRB session using this extension might go like this:
|
||||
<blockquote><pre>
|
||||
$ <b>irb</b>
|
||||
irb(main):001:0> <b>require 'Example'</b>
|
||||
=> true
|
||||
irb(main):002:0> <b>i_list = Example::IntVector.new</b>
|
||||
=> #<Example::IntVector:0x2ab9a18>
|
||||
irb(main):003:0> <b>i_list.push(1)</b>
|
||||
=> nil
|
||||
irb(main):004:0> <b>i_list.push(2)</b>
|
||||
=> nil
|
||||
irb(main):005:0> <b>i_list.each { |i| puts i }</b>
|
||||
1
|
||||
2
|
||||
=> nil
|
||||
irb(main):006:0> <b>i_list.length</b>
|
||||
=> 2
|
||||
irb(main):007:0> <b>s_list = Example::StringVector.new</b>
|
||||
=> #<Example::IntVector:0x2aa9c98>
|
||||
irb(main):008:0> <b>s_list.push("Hello")</b>
|
||||
=> nil
|
||||
irb(main):009:0> <b>s_list.push("There")</b>
|
||||
=> nil
|
||||
irb(main):010:0> <b>s_list.each { |s| puts s }</b>
|
||||
Hello
|
||||
There
|
||||
=> nil
|
||||
irb(main):011:0> <b>s_list.length</b>
|
||||
=> 2
|
||||
irb(main):012:0> <b>s_list[0]</b>
|
||||
=> "Hello"
|
||||
irb(main):013:0> <b>s_list[0] = "New Entry"</b>
|
||||
=> "New Entry"
|
||||
irb(main):014:0> <b>s_list[0]</b>
|
||||
=> "New Entry"
|
||||
</pre></blockquote>
|
||||
<p>
|
||||
|
||||
<a name="n47"></a><H3>20.7.3 Example: STL Vector to Ruby Array</H3>
|
||||
|
||||
<em><b>FIXME: This example is out of place here!</b></em><p>
|
||||
|
||||
Another use for macros and type maps is to create a Ruby array from a STL
|
||||
vector of pointers. In essence, copy of all the pointers in the vector into a Ruby
|
||||
|
|
@ -2500,10 +2469,10 @@ It is also possible to create a Ruby array from a vector of static data types:
|
|||
</pre></blockquote>
|
||||
|
||||
|
||||
<a name="n48"></a><H2>20.8 Advanced Topics</H2>
|
||||
<a name="n46"></a><H2>20.8 Advanced Topics</H2>
|
||||
|
||||
|
||||
<a name="n49"></a><H3>20.8.1 Creating Multi-Module Packages</H3>
|
||||
<a name="n47"></a><H3>20.8.1 Creating Multi-Module Packages</H3>
|
||||
|
||||
|
||||
The chapter on <a href="Advanced.html">Advanced Topics</a> discusses the basics
|
||||
|
|
@ -2628,7 +2597,7 @@ irb(main):005:0> <b>c.getX()</b>
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n50"></a><H3>20.8.2 Defining Aliases</H3>
|
||||
<a name="n48"></a><H3>20.8.2 Defining Aliases</H3>
|
||||
|
||||
|
||||
It's a fairly common practice in the Ruby built-ins and standard library to
|
||||
|
|
@ -2696,7 +2665,7 @@ mechanism and so the same name matching rules used for other kinds of features
|
|||
apply (see the chapter on <a href="Customization.html">"Customization Features"</a>)
|
||||
for more details).
|
||||
|
||||
<a name="n51"></a><H3>20.8.3 Predicate Methods</H3>
|
||||
<a name="n49"></a><H3>20.8.3 Predicate Methods</H3>
|
||||
|
||||
|
||||
Predicate methods in Ruby are those which return either <tt>true</tt> or
|
||||
|
|
@ -2747,7 +2716,7 @@ Note that the <tt>%predicate</tt> directive is implemented using SWIG's
|
|||
of features apply (see the chapter on <a href="Customization.html">"Customization
|
||||
Features"</a>) for more details).
|
||||
|
||||
<a name="n52"></a><H3>20.8.4 Specifying Mixin Modules</H3>
|
||||
<a name="n50"></a><H3>20.8.4 Specifying Mixin Modules</H3>
|
||||
|
||||
|
||||
The Ruby language doesn't support multiple inheritance, but it does allow you
|
||||
|
|
@ -2819,7 +2788,7 @@ Note that the <tt>%mixin</tt> directive is implemented using SWIG's
|
|||
of features apply (see the chapter on <a href="Customization.html">"Customization
|
||||
Features"</a>) for more details).
|
||||
|
||||
<a name="n53"></a><H3>20.8.5 Interacting with Ruby's Garbage Collector</H3>
|
||||
<a name="n51"></a><H3>20.8.5 Interacting with Ruby's Garbage Collector</H3>
|
||||
|
||||
|
||||
<b>This section is still unfinished!</b><p>
|
||||
|
|
@ -2988,4 +2957,4 @@ for more details).
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : $Date$</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -2655,4 +2655,4 @@ The bottom line: don't do this.
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : August 7, 2003</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -15,39 +15,46 @@
|
|||
<li><a href="#n6">Simple C++ wrapping</a>
|
||||
<ul>
|
||||
<li><a href="#n7">Constructors and destructors</a>
|
||||
<li><a href="#n8">Copy constructors</a>
|
||||
<li><a href="#n9">Member functions</a>
|
||||
<li><a href="#n10">Static members</a>
|
||||
<li><a href="#n11">Member functions and default arguments</a>
|
||||
<li><a href="#n12">Member data</a>
|
||||
<li><a href="#n8">Default constructors</a>
|
||||
<li><a href="#n9">When constructor wrappers aren't created</a>
|
||||
<li><a href="#n10">Copy constructors</a>
|
||||
<li><a href="#n11">Member functions</a>
|
||||
<li><a href="#n12">Static members</a>
|
||||
<li><a href="#n13">Member functions and default arguments</a>
|
||||
<li><a href="#n14">Member data</a>
|
||||
</ul>
|
||||
<li><a href="#n13">Protection</a>
|
||||
<li><a href="#n14">Enums and constants</a>
|
||||
<li><a href="#n15">Friends</a>
|
||||
<li><a href="#n16">References and pointers</a>
|
||||
<li><a href="#n17">Pass and return by value</a>
|
||||
<li><a href="#n18">Inheritance</a>
|
||||
<li><a href="#n19">A brief discussion of multiple inheritance, pointers, and type checking</a>
|
||||
<li><a href="#n20">Renaming</a>
|
||||
<li><a href="#n21">Wrapping Overloaded Functions and Methods</a>
|
||||
<li><a href="#n15">Protection</a>
|
||||
<li><a href="#n16">Enums and constants</a>
|
||||
<li><a href="#n17">Friends</a>
|
||||
<li><a href="#n18">References and pointers</a>
|
||||
<li><a href="#n19">Pass and return by value</a>
|
||||
<li><a href="#n20">Inheritance</a>
|
||||
<li><a href="#n21">A brief discussion of multiple inheritance, pointers, and type checking</a>
|
||||
<li><a href="#n22">Renaming</a>
|
||||
<li><a href="#n23">Wrapping Overloaded Functions and Methods</a>
|
||||
<ul>
|
||||
<li><a href="#n22">Dispatch function generation</a>
|
||||
<li><a href="#n23">Ambiguity in Overloading</a>
|
||||
<li><a href="#n24">Ambiguity resolution and renaming</a>
|
||||
<li><a href="#n25">Comments on overloading</a>
|
||||
<li><a href="#n24">Dispatch function generation</a>
|
||||
<li><a href="#n25">Ambiguity in Overloading</a>
|
||||
<li><a href="#n26">Ambiguity resolution and renaming</a>
|
||||
<li><a href="#n27">Comments on overloading</a>
|
||||
</ul>
|
||||
<li><a href="#n26">Wrapping overloaded operators</a>
|
||||
<li><a href="#n27">Class extension</a>
|
||||
<li><a href="#n28">Templates</a>
|
||||
<li><a href="#n29">Namespaces</a>
|
||||
<li><a href="#n30">Exception specifiers</a>
|
||||
<li><a href="#n31">Pointers to Members</a>
|
||||
<li><a href="#n32">Smart pointers and operator->()</a>
|
||||
<li><a href="#n33">Using declarations and inheritance</a>
|
||||
<li><a href="#n34">Partial class definitions</a>
|
||||
<li><a href="#n35">A brief rant about const-correctness</a>
|
||||
<li><a href="#n36">Proxy classes</a>
|
||||
<li><a href="#n37">Where to go for more information</a>
|
||||
<li><a href="#n28">Wrapping overloaded operators</a>
|
||||
<li><a href="#n29">Class extension</a>
|
||||
<li><a href="#n30">Templates</a>
|
||||
<li><a href="#n31">Namespaces</a>
|
||||
<li><a href="#n32">Exception specifiers</a>
|
||||
<li><a href="#n33">Pointers to Members</a>
|
||||
<li><a href="#n34">Smart pointers and operator->()</a>
|
||||
<li><a href="#n35">Using declarations and inheritance</a>
|
||||
<li><a href="#n36">Partial class definitions</a>
|
||||
<li><a href="#n37">A brief rant about const-correctness</a>
|
||||
<li><a href="#n38">Proxy classes</a>
|
||||
<ul>
|
||||
<li><a href="#n39">Construction of proxy classes</a>
|
||||
<li><a href="#n40">Resource management in proxies</a>
|
||||
<li><a href="#n41">Language specific details</a>
|
||||
</ul>
|
||||
<li><a href="#n42">Where to go for more information</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -228,6 +235,7 @@ level interface based on proxy classes.
|
|||
|
||||
<a name="n7"></a><H3>5.5.1 Constructors and destructors</H3>
|
||||
|
||||
|
||||
C++ constructors and destructors are translated into accessor
|
||||
functions such as the following :<p>
|
||||
|
||||
|
|
@ -241,7 +249,8 @@ void delete_List(List *l) {
|
|||
|
||||
</pre></blockquote>
|
||||
|
||||
<h3>Default constructors</h3>
|
||||
<a name="n8"></a><H3>5.5.2 Default constructors</H3>
|
||||
|
||||
|
||||
If a C++ class does not define any public constructors or
|
||||
destructors, SWIG will automatically create a default constructor or
|
||||
|
|
@ -305,7 +314,8 @@ However, this removal may now cause SWIG to erroneously generate constructors
|
|||
for classes that define a constructor in those sections. Consider restoring
|
||||
those sections in the interface or using <tt>%nodefault</tt> to fix the problem.
|
||||
|
||||
<h3>When constructor wrappers aren't created</h3>
|
||||
<a name="n9"></a><H3>5.5.3 When constructor wrappers aren't created</H3>
|
||||
|
||||
|
||||
If a class defines a constructor, SWIG normally tries to generate a wrapper for it. However, SWIG will
|
||||
not generate a constructor wrapper if it thinks that it will result in illegal wrapper code. There are really
|
||||
|
|
@ -370,7 +380,8 @@ public:
|
|||
|
||||
More information about <tt>%feature</tt> can be found in the <a href="Customization.html">Customization features</a> chapter.
|
||||
|
||||
<a name="n8"></a><H3>5.5.2 Copy constructors</H3>
|
||||
<a name="n10"></a><H3>5.5.4 Copy constructors</H3>
|
||||
|
||||
|
||||
If a class defines more than one constructor, its behavior depends on the capabilities of the
|
||||
target language. If overloading is supported, the copy constructor is accessible using
|
||||
|
|
@ -443,7 +454,7 @@ renamed. For instance, in the above example, the name of the
|
|||
constructor is set to <tt>new_CopyFoo()</tt>. This is the same as in
|
||||
older versions.
|
||||
|
||||
<a name="n9"></a><H3>5.5.3 Member functions</H3>
|
||||
<a name="n11"></a><H3>5.5.5 Member functions</H3>
|
||||
|
||||
|
||||
All member functions are roughly translated into accessor functions like this :<p>
|
||||
|
|
@ -464,7 +475,7 @@ function in the code it generates. Instead, member access such as
|
|||
wrapper functions. However, the name and calling convention of the
|
||||
wrappers match the accessor function prototype described above.
|
||||
|
||||
<a name="n10"></a><H3>5.5.4 Static members</H3>
|
||||
<a name="n12"></a><H3>5.5.6 Static members</H3>
|
||||
|
||||
|
||||
Static member functions are called directly without making any special
|
||||
|
|
@ -476,7 +487,7 @@ in the generated wrapper code.
|
|||
Usually, static members are accessed as functions with names in which the class name has been
|
||||
prepended with an underscore. For example, <tt>List_print</tt>.
|
||||
|
||||
<a name="n11"></a><H3>5.5.5 Member functions and default arguments</H3>
|
||||
<a name="n13"></a><H3>5.5.7 Member functions and default arguments</H3>
|
||||
|
||||
|
||||
SWIG allows member functions to accept default arguments. For example:
|
||||
|
|
@ -528,7 +539,7 @@ There are several somewhat clumsy ways to work around this problem
|
|||
reconsider your design--is it really <em>that</em> critical to make
|
||||
the default argument private?
|
||||
|
||||
<a name="n12"></a><H3>5.5.6 Member data</H3>
|
||||
<a name="n14"></a><H3>5.5.8 Member data</H3>
|
||||
|
||||
|
||||
Member data is handled in exactly the same manner as for C
|
||||
|
|
@ -635,7 +646,7 @@ involving <tt>size_t</tt>. This change is subtle, but it smooths over
|
|||
a few problems related to structure wrapping and some of SWIG's
|
||||
customization features.
|
||||
|
||||
<a name="n13"></a><H2>5.6 Protection</H2>
|
||||
<a name="n15"></a><H2>5.6 Protection</H2>
|
||||
|
||||
|
||||
SWIG can only wrap class members that are declared public. Anything
|
||||
|
|
@ -652,7 +663,7 @@ the same convention used by C++).<p>
|
|||
A subtle access problem relates to default values of member functions. Specifically,
|
||||
default values must be public. Please go back to the section on default arguments for further details.
|
||||
|
||||
<a name="n14"></a><H2>5.7 Enums and constants</H2>
|
||||
<a name="n16"></a><H2>5.7 Enums and constants</H2>
|
||||
|
||||
|
||||
Enumerations and constants placed in a class definition are mapped
|
||||
|
|
@ -675,7 +686,7 @@ Swig_STOUT = Swig::STOUT
|
|||
|
||||
Members declared as <tt>const</tt> are wrapped as read-only members and do not create constants.
|
||||
|
||||
<a name="n15"></a><H2>5.8 Friends</H2>
|
||||
<a name="n17"></a><H2>5.8 Friends</H2>
|
||||
|
||||
|
||||
Friend declarations are ignored by SWIG. For example, if you have this code:
|
||||
|
|
@ -712,7 +723,7 @@ declaration does not define a method that operates on an instance of
|
|||
an object nor does it define a declaration in the scope of the class.
|
||||
Therefore, it would make no sense for SWIG to create wrappers as such.
|
||||
|
||||
<a name="n16"></a><H2>5.9 References and pointers</H2>
|
||||
<a name="n18"></a><H2>5.9 References and pointers</H2>
|
||||
|
||||
|
||||
C++ references are supported, but SWIG transforms them back into pointers. For example,
|
||||
|
|
@ -791,7 +802,7 @@ cause your program to crash.
|
|||
more seamless integration with more advanced C++ wrapping applications---especially related to
|
||||
templates and the STL. This was first added in SWIG-1.3.12.
|
||||
|
||||
<a name="n17"></a><H2>5.10 Pass and return by value</H2>
|
||||
<a name="n19"></a><H2>5.10 Pass and return by value</H2>
|
||||
|
||||
|
||||
Occasionally, a C++ program will pass and return class objects by value. For example, a function
|
||||
|
|
@ -862,7 +873,7 @@ It is not used for C++ pointers or references.
|
|||
<b>Note:</b> The performance of pass-by-value is especially bad for large objects and should be avoided
|
||||
if possible (consider using references instead).
|
||||
|
||||
<a name="n18"></a><H2>5.11 Inheritance</H2>
|
||||
<a name="n20"></a><H2>5.11 Inheritance</H2>
|
||||
|
||||
|
||||
SWIG supports C++ public inheritance of classes and allows both
|
||||
|
|
@ -1026,7 +1037,7 @@ when advanced features like proxy classes are used. Future versions
|
|||
of SWIG may apply further optimizations such as not regenerating
|
||||
wrapper functions for virtual members that are already defined in a base class.
|
||||
|
||||
<a name="n19"></a><H2>5.12 A brief discussion of multiple inheritance, pointers, and type checking</H2>
|
||||
<a name="n21"></a><H2>5.12 A brief discussion of multiple inheritance, pointers, and type checking</H2>
|
||||
|
||||
|
||||
When a target scripting language refers to a C++ object, it normally
|
||||
|
|
@ -1133,7 +1144,7 @@ more virtual functions).
|
|||
<p>
|
||||
The bottom line: learn to live with type-tagged pointers.
|
||||
|
||||
<a name="n20"></a><H2>5.13 Renaming</H2>
|
||||
<a name="n22"></a><H2>5.13 Renaming</H2>
|
||||
|
||||
|
||||
C++ member functions and data can be renamed with the <tt>%name</tt>
|
||||
|
|
@ -1176,7 +1187,7 @@ overloaded methods, it really doesn't work very well because it
|
|||
requires a lot of additional markup in your interface. Keep reading
|
||||
for a better solution.
|
||||
|
||||
<a name="n21"></a><H2>5.14 Wrapping Overloaded Functions and Methods</H2>
|
||||
<a name="n23"></a><H2>5.14 Wrapping Overloaded Functions and Methods</H2>
|
||||
|
||||
|
||||
In many language modules, SWIG provides partial support for overloaded functions, methods, and
|
||||
|
|
@ -1231,7 +1242,7 @@ it might be used like this
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n22"></a><H3>5.14.1 Dispatch function generation</H3>
|
||||
<a name="n24"></a><H3>5.14.1 Dispatch function generation</H3>
|
||||
|
||||
|
||||
The implementation of overloaded functions and methods is somewhat
|
||||
|
|
@ -1338,7 +1349,7 @@ checked in the same order as they appear in this ranking.
|
|||
<p>
|
||||
If you're still confused, don't worry about it---SWIG is probably doing the right thing.
|
||||
|
||||
<a name="n23"></a><H3>5.14.2 Ambiguity in Overloading</H3>
|
||||
<a name="n25"></a><H3>5.14.2 Ambiguity in Overloading</H3>
|
||||
|
||||
|
||||
Regrettably, SWIG is not able to support every possible use of valid C++ overloading. Consider
|
||||
|
|
@ -1425,7 +1436,7 @@ foo.i:5. Previous declaration is Spam::foo(int )
|
|||
it means that the target language module has not yet implemented support for overloaded
|
||||
functions and methods. The only way to fix the problem is to read the next section.
|
||||
|
||||
<a name="n24"></a><H3>5.14.3 Ambiguity resolution and renaming</H3>
|
||||
<a name="n26"></a><H3>5.14.3 Ambiguity resolution and renaming</H3>
|
||||
|
||||
|
||||
If an ambiguity in overload resolution occurs or if a module doesn't
|
||||
|
|
@ -1701,7 +1712,7 @@ above:
|
|||
</blockquote>
|
||||
</ul>
|
||||
|
||||
<a name="n25"></a><H3>5.14.4 Comments on overloading</H3>
|
||||
<a name="n27"></a><H3>5.14.4 Comments on overloading</H3>
|
||||
|
||||
|
||||
Support for overloaded methods was first added in SWIG-1.3.14. The implementation
|
||||
|
|
@ -1715,7 +1726,7 @@ module. Therefore, the degree of overloading support may vary from language to
|
|||
As a general rule, statically typed languages like Java are able to provide more support
|
||||
than dynamically typed languages like Perl, Python, Ruby, and Tcl.
|
||||
|
||||
<a name="n26"></a><H2>5.15 Wrapping overloaded operators</H2>
|
||||
<a name="n28"></a><H2>5.15 Wrapping overloaded operators</H2>
|
||||
|
||||
|
||||
Starting in SWIG-1.3.10, C++ overloaded operator declarations can be wrapped.
|
||||
|
|
@ -1877,7 +1888,7 @@ are ignored as well as conversion operators.
|
|||
<li>The semantics of certain C++ operators may not match those in the target language.
|
||||
</ul>
|
||||
|
||||
<a name="n27"></a><H2>5.16 Class extension</H2>
|
||||
<a name="n29"></a><H2>5.16 Class extension</H2>
|
||||
|
||||
|
||||
New methods can be added to a class using the <tt>%extend</tt>
|
||||
|
|
@ -1934,7 +1945,7 @@ name for the <tt>%addmethods</tt> directive. Since <tt>%addmethods</tt> could
|
|||
be used to extend a structure with more than just methods, a more suitable
|
||||
directive name has been chosen.
|
||||
|
||||
<a name="n28"></a><H2>5.17 Templates</H2>
|
||||
<a name="n30"></a><H2>5.17 Templates</H2>
|
||||
|
||||
|
||||
In all versions of SWIG, template type names may appear anywhere a type
|
||||
|
|
@ -2581,7 +2592,7 @@ as the class name. For example:
|
|||
|
||||
Similar changes apply to typemaps and other customization features.
|
||||
|
||||
<a name="n29"></a><H2>5.18 Namespaces</H2>
|
||||
<a name="n31"></a><H2>5.18 Namespaces</H2>
|
||||
|
||||
|
||||
Support for C++ namespaces is a relatively late addition to SWIG,
|
||||
|
|
@ -2960,7 +2971,7 @@ with any namespace awareness. In the future, language modules may or may not p
|
|||
more advanced namespace support.
|
||||
|
||||
|
||||
<a name="n30"></a><H2>5.19 Exception specifiers</H2>
|
||||
<a name="n32"></a><H2>5.19 Exception specifiers</H2>
|
||||
|
||||
|
||||
When C++ programs utilize exceptions, exceptional behavior is sometimes specified as
|
||||
|
|
@ -3001,7 +3012,7 @@ Since exception specifiers are sometimes only used sparingly, this alone may not
|
|||
properly handle C++ exceptions. To do that, a different set of special SWIG directives are used.
|
||||
Consult the "<a href="Customization.html">Customization features</a>" chapter for details.
|
||||
|
||||
<a name="n31"></a><H2>5.20 Pointers to Members</H2>
|
||||
<a name="n33"></a><H2>5.20 Pointers to Members</H2>
|
||||
|
||||
|
||||
Starting with SWIG1.3.7, there is limited parsing support for pointers to C++ class members.
|
||||
|
|
@ -3043,7 +3054,7 @@ member pointers. Normally SWIG tries to keep track of inheritance
|
|||
when checking types. However, no such support is currently provided
|
||||
for member pointers.
|
||||
|
||||
<a name="n32"></a><H2>5.21 Smart pointers and operator->()</H2>
|
||||
<a name="n34"></a><H2>5.21 Smart pointers and operator->()</H2>
|
||||
|
||||
|
||||
In some C++ programs, objects are often encapsulated by smart-pointers
|
||||
|
|
@ -3231,7 +3242,7 @@ p = f.__deref__() # Raw pointer from operator->
|
|||
<b>Note:</b> Smart pointer support was first added in SWIG-1.3.14.
|
||||
|
||||
|
||||
<a name="n33"></a><H2>5.22 Using declarations and inheritance</H2>
|
||||
<a name="n35"></a><H2>5.22 Using declarations and inheritance</H2>
|
||||
|
||||
|
||||
<tt>using</tt> declarations are sometimes used to adjust access to members of
|
||||
|
|
@ -3379,7 +3390,7 @@ public:
|
|||
</blockquote>
|
||||
</ul>
|
||||
|
||||
<a name="n34"></a><H2>5.23 Partial class definitions</H2>
|
||||
<a name="n36"></a><H2>5.23 Partial class definitions</H2>
|
||||
|
||||
|
||||
Since SWIG is still limited in its support of C++, it may be necessary
|
||||
|
|
@ -3409,7 +3420,7 @@ public:
|
|||
Also, as a rule of thumb, SWIG should not be used on raw C++ source
|
||||
files.
|
||||
|
||||
<a name="n35"></a><H2>5.24 A brief rant about const-correctness</H2>
|
||||
<a name="n37"></a><H2>5.24 A brief rant about const-correctness</H2>
|
||||
|
||||
|
||||
A common issue when working with C++ programs is dealing with all
|
||||
|
|
@ -3459,7 +3470,8 @@ for most SWIG projects. Of course, you might want to consider
|
|||
using another tool if maintaining constness is the most important part
|
||||
of your project.
|
||||
|
||||
<a name="n36"></a><H2>5.25 Proxy classes</H2>
|
||||
<a name="n38"></a><H2>5.25 Proxy classes</H2>
|
||||
|
||||
|
||||
In order to provide a more natural API, many of SWIG's target
|
||||
languages also wrap C++ classes with special proxy classes. These
|
||||
|
|
@ -3468,7 +3480,8 @@ For example, if you're building a Python module, each C++ class is
|
|||
wrapped with Python class. Or if you're building a Java module, each
|
||||
C++ class is wrapped by a Java class.
|
||||
|
||||
<h3>Construction of proxy classes</h3>
|
||||
<a name="n39"></a><H3>5.25.1 Construction of proxy classes</H3>
|
||||
|
||||
|
||||
Proxy classes are always constructed as an extra layer of wrapping that uses the low-level
|
||||
accessor functions described in the previous section. To illustrate, suppose you had a
|
||||
|
|
@ -3543,7 +3556,8 @@ proxy classes.
|
|||
Whenever possible, proxies try to take advantage of language features that are similar to C++. This
|
||||
might include operator overloading, exception handling, and other features.
|
||||
|
||||
<h3>Resource management in proxies</h3>
|
||||
<a name="n40"></a><H3>5.25.2 Resource management in proxies</H3>
|
||||
|
||||
|
||||
A major issue with proxies concerns the memory management of wrapped objects. Consider the following
|
||||
C++ code:
|
||||
|
|
@ -3683,12 +3697,13 @@ Given the tricky nature of C++ memory management, it is impossible for proxy cla
|
|||
every possible memory management problem. However, proxies do provide a mechanism for manual control that
|
||||
can be used (if necessary) to address some of the more tricky memory management problems.
|
||||
|
||||
<h3>Language specific details</h3>
|
||||
<a name="n41"></a><H3>5.25.3 Language specific details</H3>
|
||||
|
||||
|
||||
Language specific details on proxy classes are contained the chapters describing each target language. This
|
||||
chapter has merely introduced the topic in a very general way.
|
||||
|
||||
<a name="n37"></a><H2>5.26 Where to go for more information</H2>
|
||||
<a name="n42"></a><H2>5.26 Where to go for more information</H2>
|
||||
|
||||
|
||||
If you're wrapping serious C++ code, you might want to pick up a copy
|
||||
|
|
|
|||
|
|
@ -41,30 +41,30 @@
|
|||
<li><a href="#n25">Common typemap methods</a>
|
||||
<ul>
|
||||
<li><a href="#n26">"in" typemap</a>
|
||||
<li><a href="#n27">"out" typemap</a>
|
||||
<li><a href="#n28">"arginit" typemap</a>
|
||||
<li><a href="#n29">"default" typemap</a>
|
||||
<li><a href="#n30">"check" typemap</a>
|
||||
<li><a href="#n31">"argout" typemap</a>
|
||||
<li><a href="#n32">"freearg" typemap</a>
|
||||
<li><a href="#n33">"newfree" typemap</a>
|
||||
<li><a href="#n34">"memberin" typemap</a>
|
||||
<li><a href="#n35">"varin" typemap</a>
|
||||
<li><a href="#n36">"varout" typemap</a>
|
||||
<li><a href="#n27">"typecheck" typemap</a>
|
||||
<li><a href="#n28">"out" typemap</a>
|
||||
<li><a href="#n29">"arginit" typemap</a>
|
||||
<li><a href="#n30">"default" typemap</a>
|
||||
<li><a href="#n31">"check" typemap</a>
|
||||
<li><a href="#n32">"argout" typemap</a>
|
||||
<li><a href="#n33">"freearg" typemap</a>
|
||||
<li><a href="#n34">"newfree" typemap</a>
|
||||
<li><a href="#n35">"memberin" typemap</a>
|
||||
<li><a href="#n36">"varin" typemap</a>
|
||||
<li><a href="#n37">"varout" typemap</a>
|
||||
</ul>
|
||||
<li><a href="#n37">Some typemap examples</a>
|
||||
<li><a href="#n38">Some typemap examples</a>
|
||||
<ul>
|
||||
<li><a href="#n38">Typemaps for arrays</a>
|
||||
<li><a href="#n39">Implementing constraints with typemaps</a>
|
||||
<li><a href="#n39">Typemaps for arrays</a>
|
||||
<li><a href="#n40">Implementing constraints with typemaps</a>
|
||||
</ul>
|
||||
<li><a href="#n40">Multi-argument typemaps</a>
|
||||
<li><a href="#n41">The run-time type checker</a>
|
||||
<li><a href="#n42">More about <tt>%apply</tt> and <tt>%clear</tt></a>
|
||||
<li><a href="#n43">Reducing wrapper code size</a>
|
||||
<ul>
|
||||
<li><a href="#n44">Passing data between typemaps</a>
|
||||
</ul>
|
||||
<li><a href="#n45">Where to go for more information?</a>
|
||||
<li><a href="#n41">Multi-argument typemaps</a>
|
||||
<li><a href="#n42">The run-time type checker</a>
|
||||
<li><a href="#n43">Typemaps and overloading</a>
|
||||
<li><a href="#n44">More about <tt>%apply</tt> and <tt>%clear</tt></a>
|
||||
<li><a href="#n45">Reducing wrapper code size</a>
|
||||
<li><a href="#n46">Passing data between typemaps</a>
|
||||
<li><a href="#n47">Where to go for more information?</a>
|
||||
</ul>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
|
@ -1653,7 +1653,8 @@ At this time, only zero or one arguments may be converted.
|
|||
<b>Compatibility note: </b> Specifying <tt>numinputs=0</tt>
|
||||
is the same as the old "ignore" typemap.
|
||||
|
||||
<h3>"typecheck" typemap</h3>
|
||||
<a name="n27"></a><H3>8.5.2 "typecheck" typemap</H3>
|
||||
|
||||
|
||||
The "typecheck" typemap is used to support overloaded functions and methods. It merely checks an argument
|
||||
to see whether or not it matches a specific type. For example:
|
||||
|
|
@ -1673,7 +1674,7 @@ the input argument is the correct type.
|
|||
If you define new "in" typemaps <em>and</em> your program uses overloaded methods, you should also define a collection of
|
||||
"typecheck" typemaps. More details about this follow in a later section on "Typemaps and Overloading."
|
||||
|
||||
<a name="n27"></a><H3>8.5.2 "out" typemap</H3>
|
||||
<a name="n28"></a><H3>8.5.3 "out" typemap</H3>
|
||||
|
||||
|
||||
The "out" typemap is used to convert function/method return values from C
|
||||
|
|
@ -1695,7 +1696,7 @@ $symname - Name of function/method being wrapped
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n28"></a><H3>8.5.3 "arginit" typemap</H3>
|
||||
<a name="n29"></a><H3>8.5.4 "arginit" typemap</H3>
|
||||
|
||||
|
||||
The "arginit" typemap is used to set the initial value of a function
|
||||
|
|
@ -1712,7 +1713,7 @@ For example:
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n29"></a><H3>8.5.4 "default" typemap</H3>
|
||||
<a name="n30"></a><H3>8.5.5 "default" typemap</H3>
|
||||
|
||||
|
||||
The "default" typemap is used to turn an argument into a default
|
||||
|
|
@ -1736,7 +1737,7 @@ they aren't supported (like C).
|
|||
Once a default typemap has been applied to an argument, all arguments
|
||||
that follow must have default values.
|
||||
|
||||
<a name="n30"></a><H3>8.5.5 "check" typemap</H3>
|
||||
<a name="n31"></a><H3>8.5.6 "check" typemap</H3>
|
||||
|
||||
|
||||
The "check" typemap is used to supply value checking code during argument
|
||||
|
|
@ -1753,7 +1754,7 @@ converted. For example:
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n31"></a><H3>8.5.6 "argout" typemap</H3>
|
||||
<a name="n32"></a><H3>8.5.7 "argout" typemap</H3>
|
||||
|
||||
|
||||
The "argout" typemap is used to return values from arguments. This
|
||||
|
|
@ -1791,7 +1792,7 @@ return values are often appended to return value of the function.
|
|||
<p>
|
||||
See the <tt>typemaps.i</tt> library for examples.
|
||||
|
||||
<a name="n32"></a><H3>8.5.7 "freearg" typemap</H3>
|
||||
<a name="n33"></a><H3>8.5.8 "freearg" typemap</H3>
|
||||
|
||||
|
||||
The "freearg" typemap is used to cleanup argument data. It is only
|
||||
|
|
@ -1820,7 +1821,7 @@ code is also placed into a special variable <tt>$cleanup</tt> that may
|
|||
be used in other typemaps whenever a wrapper function needs to abort
|
||||
prematurely.
|
||||
|
||||
<a name="n33"></a><H3>8.5.8 "newfree" typemap</H3>
|
||||
<a name="n34"></a><H3>8.5.9 "newfree" typemap</H3>
|
||||
|
||||
|
||||
The "newfree" typemap is used in conjunction with the <tt>%newobject</tt>
|
||||
|
|
@ -1843,7 +1844,7 @@ string *foo();
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n34"></a><H3>8.5.9 "memberin" typemap</H3>
|
||||
<a name="n35"></a><H3>8.5.10 "memberin" typemap</H3>
|
||||
|
||||
|
||||
The "memberin" typemap is used to copy data from <em>an already converted input value</em>
|
||||
|
|
@ -1861,26 +1862,26 @@ cases. For example:
|
|||
It is rarely necessary to write "memberin" typemaps---SWIG already provides
|
||||
a default implementation for arrays, strings, and other objects.
|
||||
|
||||
<a name="n35"></a><H3>8.5.10 "varin" typemap</H3>
|
||||
<a name="n36"></a><H3>8.5.11 "varin" typemap</H3>
|
||||
|
||||
|
||||
The "varin" typemap is used to convert objects in the target language to C for the
|
||||
purposes of assigning to a C/C++ global variable. This is implementation specific.
|
||||
|
||||
<a name="n36"></a><H3>8.5.11 "varout" typemap</H3>
|
||||
<a name="n37"></a><H3>8.5.12 "varout" typemap</H3>
|
||||
|
||||
|
||||
The "varout" typemap is used to convert a C/C++ object to an object in the target
|
||||
language when reading a C/C++ global variable. This is implementation specific.
|
||||
|
||||
|
||||
<a name="n37"></a><H2>8.6 Some typemap examples</H2>
|
||||
<a name="n38"></a><H2>8.6 Some typemap examples</H2>
|
||||
|
||||
|
||||
This section contains a few examples. Consult language module documentation
|
||||
for more examples.
|
||||
|
||||
<a name="n38"></a><H3>8.6.1 Typemaps for arrays</H3>
|
||||
<a name="n39"></a><H3>8.6.1 Typemaps for arrays</H3>
|
||||
|
||||
|
||||
A common use of typemaps is to provide support for C arrays appearing both as
|
||||
|
|
@ -2110,7 +2111,7 @@ Now, you will find that member access is quite nice:
|
|||
<b>Compatibility Note:</b> SWIG1.1 used to provide a special "memberout" typemap. However, it was mostly
|
||||
useless and has since been eliminated. To return structure members, simply use the "out" typemap.
|
||||
|
||||
<a name="n39"></a><H3>8.6.2 Implementing constraints with typemaps</H3>
|
||||
<a name="n40"></a><H3>8.6.2 Implementing constraints with typemaps</H3>
|
||||
|
||||
|
||||
One particularly interesting application of typemaps is the
|
||||
|
|
@ -2156,7 +2157,7 @@ rather than blindly passing values to the underlying C/C++ program.<p>
|
|||
<p>
|
||||
Note: A more advanced constraint checking system is in development. Stay tuned.
|
||||
|
||||
<a name="n40"></a><H2>8.7 Multi-argument typemaps</H2>
|
||||
<a name="n41"></a><H2>8.7 Multi-argument typemaps</H2>
|
||||
|
||||
|
||||
So far, the typemaps presented have focused on the problem of dealing with
|
||||
|
|
@ -2392,7 +2393,7 @@ Numeric Python. However, it should also be stressed that some care is in order.
|
|||
when crossing languages you may need to worry about issues such as row-major vs. column-major
|
||||
ordering (and perform conversions if needed).
|
||||
|
||||
<a name="n41"></a><H2>8.8 The run-time type checker</H2>
|
||||
<a name="n42"></a><H2>8.8 The run-time type checker</H2>
|
||||
|
||||
|
||||
A critical part of SWIG's operation is that of its run-time type checker.
|
||||
|
|
@ -2584,7 +2585,8 @@ type-checking. This code is also included in every generated wrapped file so yo
|
|||
probably just look at the output of SWIG to get a better sense for how types are
|
||||
managed.
|
||||
|
||||
<h2>Typemaps and overloading</h2>
|
||||
<a name="n43"></a><H2>8.9 Typemaps and overloading</H2>
|
||||
|
||||
|
||||
In many target languages, SWIG fully supports C++ overloaded methods and functions. For example,
|
||||
if you have a collection of functions like this:
|
||||
|
|
@ -2867,7 +2869,7 @@ Subsequent "in" typemaps would then perform more extensive type-checking.
|
|||
<Li>Make sure you read the section on overloading in the "<a href="SWIGPlus.html">SWIG and C++</a>" chapter.
|
||||
</ul>
|
||||
|
||||
<a name="n42"></a><H2>8.9 More about <tt>%apply</tt> and <tt>%clear</tt></H2>
|
||||
<a name="n44"></a><H2>8.10 More about <tt>%apply</tt> and <tt>%clear</tt></H2>
|
||||
|
||||
|
||||
In order to implement certain kinds of program behavior, it is sometimes necessary to
|
||||
|
|
@ -2940,7 +2942,7 @@ example:
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n43"></a><H2>8.10 Reducing wrapper code size</H2>
|
||||
<a name="n45"></a><H2>8.11 Reducing wrapper code size</H2>
|
||||
|
||||
|
||||
Since the code supplied to a typemap is inlined directly into wrapper functions, typemaps can result
|
||||
|
|
@ -3016,7 +3018,7 @@ convert_float_array(PyObject *input, int size) {
|
|||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<a name="n44"></a><H2>8.10.1 Passing data between typemaps</H2>
|
||||
<a name="n46"></a><H2>8.12 Passing data between typemaps</H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -3050,7 +3052,7 @@ in this manner should probably be avoided. At the very least, you should make
|
|||
sure that the typemaps sharing information have exactly the same types and names.
|
||||
|
||||
|
||||
<a name="n45"></a><H2>8.11 Where to go for more information?</H2>
|
||||
<a name="n47"></a><H2>8.13 Where to go for more information?</H2>
|
||||
|
||||
|
||||
The
|
||||
|
|
@ -3066,4 +3068,4 @@ for how to define typemaps of your own.
|
|||
|
||||
<address>SWIG 1.3 - Last Modified : June 1 , 2003</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -413,4 +413,4 @@ The ability to control warning messages was first added to SWIG-1.3.12.
|
|||
<p><hr>
|
||||
<address>SWIG 1.3 - Last Modified : June 28, 2003</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -221,4 +221,4 @@ Follow the Unix instructions in the README file in the SWIG root directory to bu
|
|||
<p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue