Update section numbering
This commit is contained in:
parent
24682a7243
commit
940e32477d
20 changed files with 810 additions and 1017 deletions
|
|
@ -7,7 +7,7 @@
|
|||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
<H1><a name="Ocaml">33 SWIG and Ocaml</a></H1>
|
||||
<H1><a name="Ocaml">28 SWIG and Ocaml</a></H1>
|
||||
<!-- INDEX -->
|
||||
<div class="sectiontoc">
|
||||
<ul>
|
||||
|
|
@ -88,7 +88,7 @@ If you're not familiar with the Objective Caml language, you can visit
|
|||
<a href="http://ocaml.org/">The Ocaml Website</a>.
|
||||
</p>
|
||||
|
||||
<H2><a name="Ocaml_nn2">33.1 Preliminaries</a></H2>
|
||||
<H2><a name="Ocaml_nn2">28.1 Preliminaries</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -106,7 +106,7 @@ file Examples/Makefile illustrate how to compile and link SWIG modules that
|
|||
will be loaded dynamically. This has only been tested on Linux so far.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn3">33.1.1 Running SWIG</a></H3>
|
||||
<H3><a name="Ocaml_nn3">28.1.1 Running SWIG</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -129,7 +129,7 @@ you will compile the file <tt>example_wrap.c</tt> with <tt>ocamlc</tt> or
|
|||
the resulting .ml and .mli files as well, and do the final link with -custom
|
||||
(not needed for native link).</p>
|
||||
|
||||
<H3><a name="Ocaml_nn4">33.1.2 Compiling the code</a></H3>
|
||||
<H3><a name="Ocaml_nn4">28.1.2 Compiling the code</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -166,7 +166,7 @@ in C++ mode, you must:</p>
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
<H3><a name="Ocaml_nn5">33.1.3 The camlp4 module</a></H3>
|
||||
<H3><a name="Ocaml_nn5">28.1.3 The camlp4 module</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -242,7 +242,7 @@ let b = C_string (getenv "PATH")
|
|||
</td></tr>
|
||||
</table>
|
||||
|
||||
<H3><a name="Ocaml_nn6">33.1.4 Using your module</a></H3>
|
||||
<H3><a name="Ocaml_nn6">28.1.4 Using your module</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -256,7 +256,7 @@ option to build your functions into the primitive list. This
|
|||
option is not needed when you build native code.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn7">33.1.5 Compilation problems and compiling with C++</a></H3>
|
||||
<H3><a name="Ocaml_nn7">28.1.5 Compilation problems and compiling with C++</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -267,7 +267,7 @@ liberal with pointer types may not compile under the C++ compiler.
|
|||
Most code meant to be compiled as C++ will not have problems.
|
||||
</p>
|
||||
|
||||
<H2><a name="Ocaml_nn8">33.2 The low-level Ocaml/C interface</a></H2>
|
||||
<H2><a name="Ocaml_nn8">28.2 The low-level Ocaml/C interface</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -367,7 +367,7 @@ value items pass through directly, but you must make your own type
|
|||
signature for a function that uses value in this way.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn9">33.2.1 The generated module</a></H3>
|
||||
<H3><a name="Ocaml_nn9">28.2.1 The generated module</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -401,7 +401,7 @@ it describes the output SWIG will generate for class definitions.
|
|||
</td></tr>
|
||||
</table>
|
||||
|
||||
<H3><a name="Ocaml_nn10">33.2.2 Enums</a></H3>
|
||||
<H3><a name="Ocaml_nn10">28.2.2 Enums</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -464,7 +464,7 @@ val x : Enum_test.c_obj = C_enum `a
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
<H4><a name="Ocaml_nn11">33.2.2.1 Enum typing in Ocaml</a></H4>
|
||||
<H4><a name="Ocaml_nn11">28.2.2.1 Enum typing in Ocaml</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -477,10 +477,10 @@ functions imported from different modules. You must convert values to master
|
|||
values using the swig_val function before sharing them with another module.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn12">33.2.3 Arrays</a></H3>
|
||||
<H3><a name="Ocaml_nn12">28.2.3 Arrays</a></H3>
|
||||
|
||||
|
||||
<H4><a name="Ocaml_nn13">33.2.3.1 Simple types of bounded arrays</a></H4>
|
||||
<H4><a name="Ocaml_nn13">28.2.3.1 Simple types of bounded arrays</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -501,7 +501,7 @@ arrays of simple types with known bounds in your code, but this only works
|
|||
for arrays whose bounds are completely specified.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn14">33.2.3.2 Complex and unbounded arrays</a></H4>
|
||||
<H4><a name="Ocaml_nn14">28.2.3.2 Complex and unbounded arrays</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -514,7 +514,7 @@ SWIG can't predict which of these methods will be used in the array,
|
|||
so you have to specify it for yourself in the form of a typemap.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn15">33.2.3.3 Using an object</a></H4>
|
||||
<H4><a name="Ocaml_nn15">28.2.3.3 Using an object</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -528,7 +528,7 @@ Consider writing an object when the ending condition of your array is complex,
|
|||
such as using a required sentinel, etc.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn16">33.2.3.4 Example typemap for a function taking float * and int</a></H4>
|
||||
<H4><a name="Ocaml_nn16">28.2.3.4 Example typemap for a function taking float * and int</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -579,7 +579,7 @@ void printfloats( float *tab, int len );
|
|||
</pre></td></tr></table>
|
||||
|
||||
|
||||
<H3><a name="Ocaml_nn17">33.2.4 C++ Classes</a></H3>
|
||||
<H3><a name="Ocaml_nn17">28.2.4 C++ Classes</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -622,7 +622,7 @@ the underlying pointer, so using create_[x]_from_ptr alters the
|
|||
returned value for the same object.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn18">33.2.4.1 STL vector and string Example</a></H4>
|
||||
<H4><a name="Ocaml_nn18">28.2.4.1 STL vector and string Example</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -702,7 +702,7 @@ baz
|
|||
#
|
||||
</pre></div>
|
||||
|
||||
<H4><a name="Ocaml_nn19">33.2.4.2 C++ Class Example</a></H4>
|
||||
<H4><a name="Ocaml_nn19">28.2.4.2 C++ Class Example</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -732,7 +732,7 @@ public:
|
|||
};
|
||||
</pre></td></tr></table>
|
||||
|
||||
<H4><a name="Ocaml_nn20">33.2.4.3 Compiling the example</a></H4>
|
||||
<H4><a name="Ocaml_nn20">28.2.4.3 Compiling the example</a></H4>
|
||||
|
||||
|
||||
<div class="code"><pre>
|
||||
|
|
@ -750,7 +750,7 @@ bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
|
|||
-L$QTPATH/lib -cclib -lqt
|
||||
</pre></div>
|
||||
|
||||
<H4><a name="Ocaml_nn21">33.2.4.4 Sample Session</a></H4>
|
||||
<H4><a name="Ocaml_nn21">28.2.4.4 Sample Session</a></H4>
|
||||
|
||||
|
||||
<div class="code"><pre>
|
||||
|
|
@ -777,10 +777,10 @@ Assuming you have a working installation of QT, you will see a window
|
|||
containing the string "hi" in a button.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn22">33.2.5 Director Classes</a></H3>
|
||||
<H3><a name="Ocaml_nn22">28.2.5 Director Classes</a></H3>
|
||||
|
||||
|
||||
<H4><a name="Ocaml_nn23">33.2.5.1 Director Introduction</a></H4>
|
||||
<H4><a name="Ocaml_nn23">28.2.5.1 Director Introduction</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -807,7 +807,7 @@ class foo {
|
|||
};
|
||||
</pre></div>
|
||||
|
||||
<H4><a name="Ocaml_nn24">33.2.5.2 Overriding Methods in Ocaml</a></H4>
|
||||
<H4><a name="Ocaml_nn24">28.2.5.2 Overriding Methods in Ocaml</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -835,7 +835,7 @@ In this example, I'll examine the objective caml code involved in providing
|
|||
an overloaded class. This example is contained in Examples/ocaml/shapes.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn25">33.2.5.3 Director Usage Example</a></H4>
|
||||
<H4><a name="Ocaml_nn25">28.2.5.3 Director Usage Example</a></H4>
|
||||
|
||||
|
||||
<table border="1" bgcolor="#dddddd" summary="Director usage example">
|
||||
|
|
@ -896,7 +896,7 @@ in a more effortless style in ocaml, while leaving the "engine" part of the
|
|||
program in C++.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn26">33.2.5.4 Creating director objects</a></H4>
|
||||
<H4><a name="Ocaml_nn26">28.2.5.4 Creating director objects</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -937,7 +937,7 @@ object from causing a core dump, as long as the object is destroyed
|
|||
properly.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn27">33.2.5.5 Typemaps for directors, directorin, directorout, directorargout</a></H4>
|
||||
<H4><a name="Ocaml_nn27">28.2.5.5 Typemaps for directors, directorin, directorout, directorargout</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -948,7 +948,7 @@ well as a function return value in the same way you provide function arguments,
|
|||
and to receive arguments the same way you normally receive function returns.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn28">33.2.5.6 typemap</a></H4>
|
||||
<H4><a name="Ocaml_nn28">28.2.5.6 typemap</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -959,7 +959,7 @@ code receives when you are called. In general, a simple <tt>directorin</tt> typ
|
|||
can use the same body as a simple <tt>out</tt> typemap.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn29">33.2.5.7 directorout typemap</a></H4>
|
||||
<H4><a name="Ocaml_nn29">28.2.5.7 directorout typemap</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -970,7 +970,7 @@ for the same type, except when there are special requirements for object
|
|||
ownership, etc.
|
||||
</p>
|
||||
|
||||
<H4><a name="Ocaml_nn30">33.2.5.8 directorargout typemap</a></H4>
|
||||
<H4><a name="Ocaml_nn30">28.2.5.8 directorargout typemap</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -987,7 +987,7 @@ In the event that you don't specify all of the necessary values, integral
|
|||
values will read zero, and struct or object returns have undefined results.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn31">33.2.6 Exceptions</a></H3>
|
||||
<H3><a name="Ocaml_nn31">28.2.6 Exceptions</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -996,7 +996,7 @@ but not too useful example is provided by the throw_exception testcase in
|
|||
Examples/test-suite. You can provide your own exceptions, too.
|
||||
</p>
|
||||
|
||||
<H2><a name="Ocaml_nn32">33.3 Documentation Features</a></H2>
|
||||
<H2><a name="Ocaml_nn32">28.3 Documentation Features</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1005,7 +1005,7 @@ comments (colloquially referred to as "docstrings") that can be read by
|
|||
<a href="https://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html">OCamldoc</a>.
|
||||
</p>
|
||||
|
||||
<H3><a name="Ocaml_nn33">33.3.1 Module docstring</a></H3>
|
||||
<H3><a name="Ocaml_nn33">28.3.1 Module docstring</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue