scilab: document struct array member
This commit is contained in:
parent
0bf11ef2d6
commit
aefdcd65e1
1 changed files with 15 additions and 7 deletions
|
|
@ -608,7 +608,7 @@ For example of a struct with two members:
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int arr[4];
|
||||||
} Foo;
|
} Foo;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
@ -618,8 +618,8 @@ typedef struct {
|
||||||
Several functions are generated:
|
Several functions are generated:
|
||||||
<ul>
|
<ul>
|
||||||
<li>a creation function <tt>new_Foo()</tt> which returns a pointer to a new created struct <tt>Foo</tt>.</li>
|
<li>a creation function <tt>new_Foo()</tt> which returns a pointer to a new created struct <tt>Foo</tt>.</li>
|
||||||
<li>the two getter functions <tt>Foo_x_get()</tt>, <tt>Foo_y_get()</tt>, to get the values of <tt>x</tt> and <tt>y</tt> for the struct pointer given in parameter</li>
|
<li>the two getter functions <tt>Foo_x_get()</tt>, <tt>Foo_arr_get()</tt>, to get the values of <tt>x</tt> and <tt>y</tt> for the struct pointer given in parameter</li>
|
||||||
<li>the two setter functions <tt>Foo_x_set()</tt>, <tt>Foo_y_set()</tt>, to set the values of <tt>x</tt> and <tt>y</tt> for the struct pointer given in parameter.</li>
|
<li>the two setter functions <tt>Foo_x_set()</tt>, <tt>Foo_arr_set()</tt>, to set the values of <tt>x</tt> and <tt>y</tt> for the struct pointer given in parameter.</li>
|
||||||
<li>a destruction function <tt>delete_Foo()</tt> to release the struct pointer.</li>
|
<li>a destruction function <tt>delete_Foo()</tt> to release the struct pointer.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -629,16 +629,23 @@ Following is an example of use:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang"><pre>
|
<div class="targetlang"><pre>
|
||||||
--> a = new_Foo();
|
--> f = new_Foo();
|
||||||
--> Foo_x_set(a, 100);
|
--> Foo_x_set(f, 100);
|
||||||
--> Foo_x_get(a)
|
--> Foo_x_get(f)
|
||||||
ans =
|
ans =
|
||||||
|
|
||||||
100.
|
100.
|
||||||
|
|
||||||
--> delete_Foo(a);
|
--> Foo_arr_set(f, [0:3]);
|
||||||
|
--> Foo_arr_get(f)
|
||||||
|
ans =
|
||||||
|
|
||||||
|
0. 1. 2. 3.
|
||||||
|
|
||||||
|
--> delete_Foo(f);
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Members of a structure that itself are a structure are also accepted and wrapped as a pointer:</p>
|
Members of a structure that itself are a structure are also accepted and wrapped as a pointer:</p>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -866,6 +873,7 @@ The default mapped type for C/C++ non-primitive types is the Scilab pointer. Tha
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Typemaps are available by default for arrays. Primitive type arrays are automatically converted from/to Scilab matrices.
|
Typemaps are available by default for arrays. Primitive type arrays are automatically converted from/to Scilab matrices.
|
||||||
|
Conversion is done also for arrays that are member of a structure or a class.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue