New C API for Scilab gateways (once again ...)
[scilab.git] / scilab / modules / api_scilab / help / en_US / F_integer.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2015  - Scilab Enterprises - Antoine ELIAS
5  *
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at
10  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="api_integer" xml:lang="en">
14     <refnamediv>
15         <refname>API integer functions</refname>
16         <para>This page lists all the functions to manipulate Scilab native objects containing integers</para>
17         <para></para>
18     </refnamediv>
19     <refsynopsisdiv>
20         <refsection id="api_integer_scilab_getIntegerPrecision">
21             <literal><link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_getIntegerPrecision</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)</literal>
22             <para>Return precision of an integer variable <varname>var</varname>.</para>
23         </refsection>
24         <refsection id="api_integer_scilab_isInt">
25             <literallayout>
26 int <varname>scilab_isInt8</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
27 int <varname>scilab_isInt16</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
28 int <varname>scilab_isInt32</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
29 int <varname>scilab_isInt64</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
30 int <varname>scilab_isUnsignedInt8</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
31 int <varname>scilab_isUnsignedInt16</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
32 int <varname>scilab_isUnsignedInt32</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
33 int <varname>scilab_isUnsignedInt64</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var)
34             </literallayout>
35             <para>Return 1 if variable <varname>val</varname> is an integer otherwise 0. Precision is specified in function name.</para>
36         </refsection>
37         <refsection id="api_integer_scilab_createInteger">
38             <literallayout>
39 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger8</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, char val)
40 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger16</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, short val)
41 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger32</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int val)
42 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger64</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, long long val)
43 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger8</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, unsigned char val)
44 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger16</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, unsigned short val)
45 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger32</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, unsigned int val)
46 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger64</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, unsigned long long val)
47             </literallayout>
48             <para>Create a scalar integer from <varname>val</varname>. Precision is specified in function name.</para>
49         </refsection>
50         <refsection id="api_integer_scilab_createIntegerMatrix">
51             <literal><link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createIntegerMatrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)</literal>
52             <para>Create an integer matrix with <varname>dim</varname> dimensions (<varname>dims</varname>[0], <varname>dims</varname>[1], ..., <varname>dims</varname>[<varname>dim</varname>-1]).</para>
53             <para><varname>prec</varname> parameter give precision of integer :</para>
54             <variablelist>
55                 <varlistentry>
56                     <term>SCI_INT8</term>
57                     <listitem><para>integer 8-bits</para></listitem>
58                 </varlistentry>
59                 <varlistentry>
60                     <term>SCI_INT16</term>
61                     <listitem><para>Integer 16-bits</para></listitem>
62                 </varlistentry>
63                 <varlistentry>
64                     <term>SCI_INT32</term>
65                      <listitem><para>Integer 32-bits</para></listitem>
66                 </varlistentry>
67                 <varlistentry>
68                     <term>SCI_INT64</term>
69                      <listitem><para>Integer 64-bits</para></listitem>
70                 </varlistentry>
71                 <varlistentry>
72                     <term>SCI_UINT8</term>
73                     <listitem><para>Unsigned integer 8-bits</para></listitem>
74                 </varlistentry>
75                 <varlistentry>
76                     <term>SCI_UINT16</term>
77                     <listitem><para>Unsigned integer 16-bits</para></listitem>
78                 </varlistentry>
79                 <varlistentry>
80                     <term>SCI_UINT32</term>
81                     <listitem><para>Unsigned integer 32-bits</para></listitem>
82                 </varlistentry>
83                 <varlistentry>
84                     <term>SCI_UINT64</term>
85                     <listitem><para>Unsigned integer 64-bits</para></listitem>
86                 </varlistentry>
87             </variablelist>
88         </refsection>
89         <refsection id="api_integer_scilab_createIntegerMatrix">
90             <literallayout>
91 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger8Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
92 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger16Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
93 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger32Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
94 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger64Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
95 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger8Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
96 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger16Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
97 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger32Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
98 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger64Matrix</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)
99             </literallayout>
100             <para>Create an integer matrix with <varname>dim</varname> dimensions (<varname>dims</varname>[0], <varname>dims</varname>[1], ..., <varname>dims</varname>[<varname>dim</varname>-1]). Precision is specified in function name.</para>
101         </refsection>
102         <refsection id="api_integer_scilab_createIntegerMatrix">
103             <literal><link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createIntegerMatrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int prec, int dim, const int* dims)</literal>
104             <para>Create an integer matrix with 2 dimensions (<varname>row</varname>, <varname>col</varname>).</para>
105             <para><varname>prec</varname> parameter give precision.</para>
106         </refsection>
107         <refsection id="api_integer_scilab_createIntegerMatrix2d">
108             <literallayout>
109 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger8Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
110 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger16Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
111 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger32Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
112 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createInteger64Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
113 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger8Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
114 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger16Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
115 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger32Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
116 <link linkend="api_types_scilabVar"><command>scilabVar</command></link> <varname>scilab_createUnsignedInteger64Matrix2d</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, int row, int col)
117             </literallayout>
118             <para>Create an integer matrix with 2 dimensions (<varname>row</varname>, <varname>col</varname>). Precision is specified in function name.</para>
119         </refsection>
120         <refsection id="api_integer_scilab_getInteger">
121             <literallayout>
122 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger8</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, char* vals)
123 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger16</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, short* vals)
124 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger32</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, int* vals)
125 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger64</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, long long* vals)
126 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger8</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, unsigned char* vals)
127 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger16</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, unsigned short* vals)
128 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger32</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, unsigned int* vals)
129 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger64</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, unsigned long long* vals)
130             </literallayout>
131             <para>Get integer value from an scalar integer variable. Precision is specified in function name.</para>
132             <para>precision of output must match with precision of <varname>var</varname>.</para>
133         </refsection>
134         <refsection id="api_integer_scilab_getIntegerArray">
135             <literallayout>
136 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getIntegerArray</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const void** vals)
137 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger8Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const char** vals)
138 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger16Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const short** vals)
139 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger32Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const int** vals)
140 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getInteger64Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const long long** vals)
141 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger8Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned char** vals)
142 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger16Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned short** vals)
143 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger32Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned int** vals)
144 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_getUnsignedInteger64Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned long long** vals)
145             </literallayout>
146             <para>Get pointer on internal array of integer of <varname>var</varname>.</para>
147         </refsection>
148         <refsection id="api_integer_scilab_setIntegerArray">
149             <literallayout>
150 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setIntegerArray</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const void* vals);
151 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setInteger8Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const char* vals);
152 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setInteger16Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const short* vals);
153 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setInteger32Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const int* vals);
154 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setInteger64Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const long long* vals);
155 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setUnsignedInteger8Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned char* vals);
156 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setUnsignedInteger16Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned short* vals);
157 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setUnsignedInteger32Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned int* vals);
158 <link linkend="api_types_scilabStatus"><command>scilabStatus</command></link> <varname>scilab_setUnsignedInteger64Array</varname>(<link linkend="api_types_scilabEnv"><command>scilabEnv</command></link> env, <link linkend="api_types_scilabVar"><command>scilabVar</command></link> var, const unsigned long long* vals);
159             </literallayout>
160             <para>Set values of integer variable <varname>var</varname>.</para>
161         </refsection>
162     </refsynopsisdiv>
163     <refsection>
164         <title>Examples</title>
165         <programlisting role="code_gateway">
166             <![CDATA[
167 #include "api_scilab.h"
168 #include "Scierror.h"
169 #include "localization.h"
170 #include "sciprint.h"
171 #include "sci_malloc.h"
172
173 const char fname[] = "int_test";
174
175 int sci_int_test(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt opt, int nout, scilabVar* out)
176 {
177     int i = 0;
178     int inr1 = 0;
179     int inc1 = 0;
180     int size1 = 0;
181     int* in1 = NULL;
182
183     int in2 = 0;
184
185     int* out1 = NULL;
186
187     int* out2dims = NULL;
188     int* out2 = NULL;
189
190     int out3 = 0;
191
192     if (nin != 2)
193     {
194         Scierror(999, _("%s: Wrong number of input arguments: %d expected.\n"), fname, 2);
195         return SCILAB_ERROR;
196     }
197
198     if (nout != 3)
199     {
200         Scierror(999, _("%s: Wrong number of output arguments: %d expected.\n"), fname, 3);
201         return SCILAB_ERROR;
202     }
203
204     //in[0] : matrix 2d of int32
205     if (scilab_isInt32(env, in[0]) == 0 || scilab_isMatrix(env, in[0]) == 0)
206     {
207         Scierror(999, _("%s: Wrong type for input argument #%d: A int32 matrix expected.\n"), fname, 1);
208         return SCILAB_ERROR;
209     }
210
211     size1 = scilab_getDim2d(env, in[0], &inr1, &inc1);
212     scilab_getInteger32Array(env, in[0], &in1);
213
214     //in[1] : int
215     if (scilab_isInt32(env, in[1]) == 0 || scilab_isScalar(env, in[1]) == 0)
216     {
217         Scierror(999, _("%s: Wrong type for input argument #%d: A int expected.\n"), fname, 2);
218         return SCILAB_ERROR;
219     }
220
221     scilab_getInteger32(env, in[1], &in2);
222
223     //out1 : matrix 2d of int with same size of in[0]
224     out[0] = scilab_createIntegerMatrix2d32(env, inr1, inc1);
225     scilab_getInteger32Array(env, out[0], &out1);
226
227     for (i = 0; i < size1; ++i)
228     {
229         out1[i] = in1[i] * 10;
230     }
231
232     //out2 : 3d matrix of int
233     out2dims = (int*)MALLOC(3 * sizeof(int));
234     out2dims[0] = inr1;
235     out2dims[1] = inc1;
236     out2dims[2] = 2;
237
238     out[1] = scilab_createIntegerMatrix32(env, 3, out2dims, 0);
239     scilab_getInteger32Array(env, out[1], &out2);
240
241     for (i = 0; i < size1; ++i)
242     {
243         out2[i] = in1[i] * 10;
244         out2[i + size1] = in1[i] * 100;
245     }
246
247     //out3 : int
248     out[2] = scilab_createInteger32(env, in2 * 1000);
249     return SCIALB_OK;
250 }
251             ]]>
252         </programlisting>
253     </refsection>
254     <refsection>
255         <title>Scilab test script</title>
256         <programlisting role="code_scilab">
257             <![CDATA[
258 mkdir(pathconvert(TMPDIR+"/api_c/"));
259 cd(pathconvert(TMPDIR+"/api_c/"));
260 copyfile(SCI+"/modules/api_scilab/tests/unit_tests/api_c/int_test.c",pathconvert(TMPDIR+"/api_c/int_test.c",%F));
261
262 ilib_build("libint",["int_test","sci_int_test", "csci6"],"int_test.c",[],"","","");
263 exec("loader.sce");
264
265 in1 = int32(rand(3,4) *1000);
266 in2 = int32(rand() * 1000);
267
268 [out1, out2, out3] = int_test(in1, in2);
269
270 assert_checkequal(out1, in1 * 10);
271 ref(:,:, 1) = in1 * 10;
272 ref(:,:, 2) = in1 * 100;
273 assert_checkequal(out2, ref);
274 assert_checkequal(out3, in2 * 1000);
275 disp("OK");
276             ]]>
277         </programlisting>
278     </refsection>
279 </refentry>