Add C++17 documentation chapter
This commit is contained in:
parent
192aa2892c
commit
066c396ad6
39 changed files with 1131 additions and 1112 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<body bgcolor="#ffffff">
|
||||
|
||||
<H1><a name="Scilab">39 SWIG and Scilab</a></H1>
|
||||
<H1><a name="Scilab">40 SWIG and Scilab</a></H1>
|
||||
<!-- INDEX -->
|
||||
<div class="sectiontoc">
|
||||
<ul>
|
||||
|
|
@ -88,7 +88,7 @@ This chapter explains how to use SWIG for Scilab. After this introduction, you s
|
|||
</p>
|
||||
|
||||
|
||||
<H2><a name="Scilab_preliminaries">39.1 Preliminaries</a></H2>
|
||||
<H2><a name="Scilab_preliminaries">40.1 Preliminaries</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -105,7 +105,7 @@ SWIG for Scilab supports C language. C++ is partially supported. See <a href="#S
|
|||
</p>
|
||||
|
||||
|
||||
<H2><a name="Scilab_running_swig">39.2 Running SWIG</a></H2>
|
||||
<H2><a name="Scilab_running_swig">40.2 Running SWIG</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -139,7 +139,7 @@ Note: a code in an <tt>%inline</tt> section is both parsed and wrapped by SWIG,
|
|||
</p>
|
||||
|
||||
|
||||
<H3><a name="Scilab_running_swig_generating_module">39.2.1 Generating the module</a></H3>
|
||||
<H3><a name="Scilab_running_swig_generating_module">40.2.1 Generating the module</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -182,7 +182,7 @@ The <tt>swig</tt> executable has several other command line options you can use.
|
|||
</p>
|
||||
|
||||
|
||||
<H3><a name="Scilab_running_swig_building_module">39.2.2 Building the module</a></H3>
|
||||
<H3><a name="Scilab_running_swig_building_module">40.2.2 Building the module</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -202,7 +202,7 @@ $ gcc -shared example_wrap.o -o libexample.so
|
|||
Note: we supposed in this example that the path to the Scilab include directory is <tt>/usr/local/include/scilab</tt> (which is the case in a Debian environment), this should be changed for another environment.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_running_swig_loading_module">39.2.3 Loading the module</a></H3>
|
||||
<H3><a name="Scilab_running_swig_loading_module">40.2.3 Loading the module</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -226,7 +226,7 @@ Link done.
|
|||
which means that Scilab has successfully loaded the shared library. The module functions and other symbols are now available in Scilab.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_running_swig_using_module">39.2.4 Using the module</a></H3>
|
||||
<H3><a name="Scilab_running_swig_using_module">40.2.4 Using the module</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -260,7 +260,7 @@ ans =
|
|||
Note: for conciseness, we assume in the subsequent Scilab code examples that the modules have been beforehand built and loaded in Scilab.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_running_swig_options">39.2.5 Scilab command line options</a></H3>
|
||||
<H3><a name="Scilab_running_swig_options">40.2.5 Scilab command line options</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -320,10 +320,10 @@ $ swig -scilab -help
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H2><a name="Scilab_wrapping">39.3 A basic tour of C/C++ wrapping</a></H2>
|
||||
<H2><a name="Scilab_wrapping">40.3 A basic tour of C/C++ wrapping</a></H2>
|
||||
|
||||
|
||||
<H3><a name="Scilab_wrapping_overview">39.3.1 Overview</a></H3>
|
||||
<H3><a name="Scilab_wrapping_overview">40.3.1 Overview</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -332,7 +332,7 @@ This means that functions, structs, classes, variables, etc... are interfaced th
|
|||
There are a few exceptions, such as constants and enumerations, which can be wrapped directly as Scilab variables.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_wrapping_identifiers">39.3.2 Identifiers</a></H3>
|
||||
<H3><a name="Scilab_wrapping_identifiers">40.3.2 Identifiers</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -347,7 +347,7 @@ In these cases, the <a href="SWIG.html#SWIG_rename_ignore">%rename directive</a>
|
|||
Note: truncations can be disabled by specifying the target version 6 of Scilab in the <tt>targetversion</tt> argument (i.e. <tt>-targetversion 6</tt>).
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_wrapping_functions">39.3.3 Functions</a></H3>
|
||||
<H3><a name="Scilab_wrapping_functions">40.3.3 Functions</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -378,7 +378,7 @@ ans =
|
|||
24.
|
||||
</pre></div>
|
||||
|
||||
<H4><a name="Scilab_nn13">39.3.3.1 Argument passing</a></H4>
|
||||
<H4><a name="Scilab_nn13">40.3.3.1 Argument passing</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -431,7 +431,7 @@ In Scilab, parameters are passed by value. The output (and inout) parameters are
|
|||
7.
|
||||
</pre></div>
|
||||
|
||||
<H4><a name="Scilab_nn14">39.3.3.2 Multiple output arguments</a></H4>
|
||||
<H4><a name="Scilab_nn14">40.3.3.2 Multiple output arguments</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -480,7 +480,7 @@ int divide(int n, int d, int *OUTPUT, int *OUTPUT);
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H3><a name="Scilab_wrapping_global_variables">39.3.4 Global variables</a></H3>
|
||||
<H3><a name="Scilab_wrapping_global_variables">40.3.4 Global variables</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -549,10 +549,10 @@ It works the same:</p>
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H3><a name="Scilab_wrapping_constants_and_enums">39.3.5 Constants and enumerations</a></H3>
|
||||
<H3><a name="Scilab_wrapping_constants_and_enums">40.3.5 Constants and enumerations</a></H3>
|
||||
|
||||
|
||||
<H4><a name="Scilab_wrapping_constants">39.3.5.1 Constants</a></H4>
|
||||
<H4><a name="Scilab_wrapping_constants">40.3.5.1 Constants</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -693,7 +693,7 @@ are mapped to Scilab variables, with the same name:
|
|||
3.14
|
||||
</pre></div>
|
||||
|
||||
<H4><a name="Scilab_wrapping_enums">39.3.5.2 Enumerations</a></H4>
|
||||
<H4><a name="Scilab_wrapping_enums">40.3.5.2 Enumerations</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -758,7 +758,7 @@ typedef enum { RED, BLUE, GREEN } color;
|
|||
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="Scilab_wrapping_pointers">39.3.6 Pointers</a></H3>
|
||||
<H3><a name="Scilab_wrapping_pointers">40.3.6 Pointers</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -820,7 +820,7 @@ Note: the type name <tt>_p_FILE</tt> which means "pointer to FILE".
|
|||
The user of a pointer is responsible for freeing it or, like in the example, closing any resources associated with it (just as is required in a C program).
|
||||
</p>
|
||||
|
||||
<H4><a name="Scilab_wrapping_pointers_pointer_adresses">39.3.6.1 Utility functions</a></H4>
|
||||
<H4><a name="Scilab_wrapping_pointers_pointer_adresses">40.3.6.1 Utility functions</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -861,7 +861,7 @@ ans =
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H4><a name="Scilab_wrapping_pointers_null_pointers">39.3.6.2 Null pointers:</a></H4>
|
||||
<H4><a name="Scilab_wrapping_pointers_null_pointers">40.3.6.2 Null pointers:</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -877,7 +877,7 @@ Using the previous <tt>SWIG_this()</tt> and <tt>SWIG_ptr()</tt>, it is possible
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H3><a name="Scilab_wrapping_structs">39.3.7 Structures</a></H3>
|
||||
<H3><a name="Scilab_wrapping_structs">40.3.7 Structures</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -986,7 +986,7 @@ Note: the pointer to the struct works as described in <a href="Scilab_wrapping_p
|
|||
--> delete_Bar(b);
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_classes">39.3.8 C++ classes</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_classes">40.3.8 C++ classes</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1054,7 +1054,7 @@ Note: like structs, class pointers are mapped as described in <a href="Scilab_wr
|
|||
--> delete_Point(p);
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_inheritance">39.3.9 C++ inheritance</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_inheritance">40.3.9 C++ inheritance</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1129,7 +1129,7 @@ But we can use either use the <tt>get_perimeter()</tt> function of the parent cl
|
|||
18.84
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_overloading">39.3.10 C++ overloading</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_overloading">40.3.10 C++ overloading</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1169,7 +1169,7 @@ void magnify(Circle *circle, double factor) {
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H3><a name="Scilab_wrapping_pointers_references_values_arrays">39.3.11 Pointers, references, values, and arrays</a></H3>
|
||||
<H3><a name="Scilab_wrapping_pointers_references_values_arrays">40.3.11 Pointers, references, values, and arrays</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1227,7 +1227,7 @@ All these functions will return a pointer to an instance of <tt>Foo</tt>.
|
|||
As the function <tt>spam7</tt> returns a value, new instance of <tt>Foo</tt> has to be allocated, and a pointer on this instance is returned.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_templates">39.3.12 C++ templates</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_templates">40.3.12 C++ templates</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1286,7 +1286,7 @@ Then in Scilab:
|
|||
More details on template support can be found in the <a href="SWIGPlus.html#SWIGPlus_nn30">templates</a> documentation.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_operators">39.3.13 C++ operators</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_operators">40.3.13 C++ operators</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1339,7 +1339,7 @@ private:
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_namespaces">39.3.14 C++ namespaces</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_namespaces">40.3.14 C++ namespaces</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1417,7 +1417,7 @@ Note: the <a href="SWIGPlus.html#SWIGPlus_nspace">nspace</a> feature is not supp
|
|||
</p>
|
||||
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_exceptions">39.3.15 C++ exceptions</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_exceptions">40.3.15 C++ exceptions</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1500,17 +1500,17 @@ More complex or custom exception types require specific exception typemaps to be
|
|||
See the <a href="SWIGPlus.html#SWIGPlus">SWIG C++ documentation</a> for more details.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_wrapping_cpp_stl">39.3.16 C++ STL</a></H3>
|
||||
<H3><a name="Scilab_wrapping_cpp_stl">40.3.16 C++ STL</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
The Standard Template Library (STL) is partially supported. See <a href="#Scilab_typemaps_stl">STL</a> for more details.
|
||||
</p>
|
||||
|
||||
<H2><a name="Scilab_typemaps">39.4 Type mappings and libraries</a></H2>
|
||||
<H2><a name="Scilab_typemaps">40.4 Type mappings and libraries</a></H2>
|
||||
|
||||
|
||||
<H3><a name="Scilab_typemaps_primitive_types">39.4.1 Default primitive type mappings</a></H3>
|
||||
<H3><a name="Scilab_typemaps_primitive_types">40.4.1 Default primitive type mappings</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1561,7 +1561,7 @@ The default behaviour is for SWIG to generate code that will give a runtime erro
|
|||
|
||||
|
||||
|
||||
<H3><a name="Scilab_typemaps_arrays">39.4.2 Arrays</a></H3>
|
||||
<H3><a name="Scilab_typemaps_arrays">40.4.2 Arrays</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1616,7 +1616,7 @@ void printArray(int values[], int len) {
|
|||
[ 0 1 2 3 ]
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="Scilab_typemaps_pointer-to-pointers">39.4.3 Pointer-to-pointers</a></H3>
|
||||
<H3><a name="Scilab_typemaps_pointer-to-pointers">40.4.3 Pointer-to-pointers</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1689,7 +1689,7 @@ void print_matrix(double **M, int nbRows, int nbCols) {
|
|||
</pre></div>
|
||||
|
||||
|
||||
<H3><a name="Scilab_typemaps_matrices">39.4.4 Matrices</a></H3>
|
||||
<H3><a name="Scilab_typemaps_matrices">40.4.4 Matrices</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1782,7 +1782,7 @@ The remarks made earlier for arrays also apply here:
|
|||
<li>There is no control while converting <tt>double</tt> values to integers, <tt>double</tt> values are truncated without any checking or warning.</li>
|
||||
</ul>
|
||||
|
||||
<H3><a name="Scilab_typemaps_stl">39.4.5 STL</a></H3>
|
||||
<H3><a name="Scilab_typemaps_stl">40.4.5 STL</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -1982,7 +1982,7 @@ ans =
|
|||
--> delete_PersonPtrSet(p);
|
||||
</pre></div>
|
||||
|
||||
<H2><a name="Scilab_module_initialization">39.5 Module initialization</a></H2>
|
||||
<H2><a name="Scilab_module_initialization">40.5 Module initialization</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -2006,7 +2006,7 @@ For example, to initialize the module <tt>example</tt>:
|
|||
--> example_Init();
|
||||
</pre></div>
|
||||
|
||||
<H2><a name="Scilab_building_modes">39.6 Building modes</a></H2>
|
||||
<H2><a name="Scilab_building_modes">40.6 Building modes</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -2021,7 +2021,7 @@ To produce a dynamic module, when generating the wrapper, there are two possibil
|
|||
<li>the <tt>builder</tt> mode. In this mode, Scilab is responsible of building.
|
||||
</ul>
|
||||
|
||||
<H3><a name="Scilab_building_modes_nobuilder_mode">39.6.1 No-builder mode</a></H3>
|
||||
<H3><a name="Scilab_building_modes_nobuilder_mode">40.6.1 No-builder mode</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -2034,7 +2034,7 @@ This mode is the best option to use when you have to integrate the module build
|
|||
</p>
|
||||
|
||||
|
||||
<H3><a name="Scilab_building_modes_builder_mode">39.6.2 Builder mode</a></H3>
|
||||
<H3><a name="Scilab_building_modes_builder_mode">40.6.2 Builder mode</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -2074,14 +2074,14 @@ The command is:
|
|||
$ swig -scilab -builder -buildercflags -I/opt/foo/include -builderldflags "-L/opt/foo/lib -lfoo" -buildersources baa1.cxx, baa2.cxx example.i
|
||||
</pre></div>
|
||||
|
||||
<H2><a name="Scilab_generated_scripts">39.7 Generated scripts</a></H2>
|
||||
<H2><a name="Scilab_generated_scripts">40.7 Generated scripts</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
In this part we give some details about the generated Scilab scripts.
|
||||
</p>
|
||||
|
||||
<H3><a name="Scilab_generated_scripts_builder_script">39.7.1 Builder script</a></H3>
|
||||
<H3><a name="Scilab_generated_scripts_builder_script">40.7.1 Builder script</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -2106,7 +2106,7 @@ ilib_build(ilib_name, table, files, libs);
|
|||
<li><tt><b>table</b></tt>: two column string matrix containing a table of pairs of 'scilab function name', 'C function name'.</li>
|
||||
</ul>
|
||||
|
||||
<H3><a name="Scilab_generated_scripts_loader_script">39.7.2 Loader script</a></H3>
|
||||
<H3><a name="Scilab_generated_scripts_loader_script">40.7.2 Loader script</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
@ -2145,7 +2145,7 @@ clear get_file_path;
|
|||
</ul>
|
||||
|
||||
|
||||
<H2><a name="Scilab_other_resources">39.8 Other resources</a></H2>
|
||||
<H2><a name="Scilab_other_resources">40.8 Other resources</a></H2>
|
||||
|
||||
|
||||
<ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue