Put the chapters back in order after erroneously incorrectly reordering them in last checkin
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10294 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9d4fe6576d
commit
c99fe90574
35 changed files with 1572 additions and 1571 deletions
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<body bgcolor="#ffffff">
|
||||
|
||||
<H1><a name="Octave"></a>18 SWIG and Octave</H1>
|
||||
<H1><a name="Octave"></a>26 SWIG and Octave</H1>
|
||||
<!-- INDEX -->
|
||||
<div class="sectiontoc">
|
||||
<ul>
|
||||
|
|
@ -63,14 +63,14 @@ For now, the best way to find information about how to use the Octave module is
|
|||
The bulk of the Octave-specific wrapper generator code is in Source/Modules/octave.cxx. The runtime components are in Lib/octave, and in particular Lib/octave/octrun.swg.
|
||||
</p>
|
||||
|
||||
<H2><a name="Octave_nn2"></a>18.1 Preliminaries</H2>
|
||||
<H2><a name="Octave_nn2"></a>26.1 Preliminaries</H2>
|
||||
|
||||
|
||||
<p>
|
||||
The current SWIG implemention is based on Octave 2.9.12. Support for other versions (in particular the recent 3.0) has not been tested, nor has support for any OS other than Linux.
|
||||
</p>
|
||||
|
||||
<H2><a name="Octave_nn3"></a>18.2 Running SWIG</H2>
|
||||
<H2><a name="Octave_nn3"></a>26.2 Running SWIG</H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -102,7 +102,7 @@ This creates a C/C++ source file <tt>example_wrap.cxx</tt>. The generated C++ so
|
|||
The swig command line has a number of options you can use, like to redirect it's output. Use <tt>swig --help</tt> to learn about these.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn5"></a>18.2.1 Compiling a dynamic module</H3>
|
||||
<H3><a name="Octave_nn5"></a>26.2.1 Compiling a dynamic module</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -134,7 +134,7 @@ $ mkoctfile example_wrap.cxx example.c
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<H3><a name="Octave_nn6"></a>18.2.2 Using your module</H3>
|
||||
<H3><a name="Octave_nn6"></a>26.2.2 Using your module</H3>
|
||||
|
||||
|
||||
</p>
|
||||
|
|
@ -156,10 +156,10 @@ octave:5> example.cvar.Foo
|
|||
ans = 4 </pre></div>
|
||||
</p>
|
||||
|
||||
<H2><a name="Octave_nn7"></a>18.3 A tour of basic C/C++ wrapping</H2>
|
||||
<H2><a name="Octave_nn7"></a>26.3 A tour of basic C/C++ wrapping</H2>
|
||||
|
||||
|
||||
<H3><a name="Octave_nn8"></a>18.3.1 Modules</H3>
|
||||
<H3><a name="Octave_nn8"></a>26.3.1 Modules</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -207,7 +207,7 @@ octave:1> some_vars = cvar;
|
|||
</div></pre>
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn9"></a>18.3.2 Functions</H3>
|
||||
<H3><a name="Octave_nn9"></a>26.3.2 Functions</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -229,7 +229,7 @@ int fact(int n); </pre></div>
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<H3><a name="Octave_nn10"></a>18.3.3 Global variables</H3>
|
||||
<H3><a name="Octave_nn10"></a>26.3.3 Global variables</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -292,7 +292,7 @@ octave:3> example.PI
|
|||
ans = 3.1420 </pre></div>
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn11"></a>18.3.4 Constants and enums</H3>
|
||||
<H3><a name="Octave_nn11"></a>26.3.4 Constants and enums</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -319,7 +319,7 @@ example.SUNDAY=0
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<H3><a name="Octave_nn12"></a>18.3.5 Pointers</H3>
|
||||
<H3><a name="Octave_nn12"></a>26.3.5 Pointers</H3>
|
||||
|
||||
|
||||
</p>
|
||||
|
|
@ -376,7 +376,7 @@ error: value on right hand side of assignment is undefined
|
|||
error: evaluating assignment expression near line 2, column 2 </pre></div>
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn13"></a>18.3.6 Structures</H3>
|
||||
<H3><a name="Octave_nn13"></a>26.3.6 Structures</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -406,21 +406,21 @@ ans = 5
|
|||
</pre></div>
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn14"></a>18.3.7 C++ classes</H3>
|
||||
<H3><a name="Octave_nn14"></a>26.3.7 C++ classes</H3>
|
||||
|
||||
|
||||
<p>
|
||||
C++ classes are handled in a way identical to other modules.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn15"></a>18.3.8 C++ inheritance</H3>
|
||||
<H3><a name="Octave_nn15"></a>26.3.8 C++ inheritance</H3>
|
||||
|
||||
|
||||
<p>
|
||||
Inheritance is handled in a way identical to other modules.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn16"></a>18.3.9 Pointers, references, values, and arrays</H3>
|
||||
<H3><a name="Octave_nn16"></a>26.3.9 Pointers, references, values, and arrays</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -430,14 +430,14 @@ Pointers, references, values, and arrays are handled in the same way as other mo
|
|||
There are still some failing tests relating to global arrays.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn17"></a>18.3.10 C++ overloaded functions</H3>
|
||||
<H3><a name="Octave_nn17"></a>26.3.10 C++ overloaded functions</H3>
|
||||
|
||||
|
||||
<p>
|
||||
Overloaded functions are supported, and handled as in other modules.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn18"></a>18.3.11 C++ operators</H3>
|
||||
<H3><a name="Octave_nn18"></a>26.3.11 C++ operators</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -547,7 +547,7 @@ On the C++ side, the default mappings are as follows:
|
|||
%rename(__brace) *::operator[];
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="Octave_nn19"></a>18.3.12 Class extension with %extend</H3>
|
||||
<H3><a name="Octave_nn19"></a>26.3.12 Class extension with %extend</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -581,21 +581,21 @@ octave:4> a.__str()
|
|||
4
|
||||
</pre></div>
|
||||
</p>
|
||||
<H3><a name="Octave_nn20"></a>18.3.13 C++ templates</H3>
|
||||
<H3><a name="Octave_nn20"></a>26.3.13 C++ templates</H3>
|
||||
|
||||
|
||||
<p>
|
||||
C++ templates are fully supported, as in other modules.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn21"></a>18.3.14 C++ Smart Pointers</H3>
|
||||
<H3><a name="Octave_nn21"></a>26.3.14 C++ Smart Pointers</H3>
|
||||
|
||||
|
||||
<p>
|
||||
C++ smart pointers are fully supported, as in other modules.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn22"></a>18.3.15 Directors (calling Octave from C++ code)</H3>
|
||||
<H3><a name="Octave_nn22"></a>26.3.15 Directors (calling Octave from C++ code)</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -687,14 +687,14 @@ octave-side routine called
|
|||
</pre></div>
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn23"></a>18.3.16 Threads</H3>
|
||||
<H3><a name="Octave_nn23"></a>26.3.16 Threads</H3>
|
||||
|
||||
|
||||
<p>
|
||||
The use of threads in wrapped Director code is not supported; i.e., an Octave-side implementation of a C++ class must be called from the Octave interpreter's thread. Anything fancier (apartment/queue model, whatever) is left to the user. Without anything fancier, this amounts to the limitation that Octave must drive the module... like, for example, an optimization package that calls Octave to evaluate an objective function.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn24"></a>18.3.17 Memory management</H3>
|
||||
<H3><a name="Octave_nn24"></a>26.3.17 Memory management</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -729,14 +729,14 @@ A destructing
|
|||
In the case where one wishes for the C++ side to own an object that was created in Octave (especially a Director object), one can use the __disown() method to invert this logic. Then letting the Octave reference count go to zero will not destroy the object, but destroying the object will invalidate the Octave-side object if it still exists (and call destructors of other C++ bases in the case of multiple inheritance/<tt>subclass()</tt>'ing).
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn25"></a>18.3.18 STL support</H3>
|
||||
<H3><a name="Octave_nn25"></a>26.3.18 STL support</H3>
|
||||
|
||||
|
||||
<p>
|
||||
This is some skeleton support for various STL containers, but this work is not finished.
|
||||
</p>
|
||||
|
||||
<H3><a name="Octave_nn26"></a>18.3.19 Matrix typemaps</H3>
|
||||
<H3><a name="Octave_nn26"></a>26.3.19 Matrix typemaps</H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue