License Header change: Removed the LICENSE_END before beta
[scilab.git] / scilab / modules / api_scilab / help / ja_JP / legacy / list_management / list_integer_writing_api.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) 2009  - DIGITEO - Antoine ELIAS
5  * 
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <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="list_integer_writing_API" xml:lang="ja">
17     <refnamediv>
18         <refname>整数を書き込む (Scilab ゲートウェイ)</refname>
19         <refpurpose>
20             リスト中に整数の行列を追加する方法.
21         </refpurpose>
22     </refnamediv>
23     <refsynopsisdiv>
24         <refsection>
25             既存のデータから作成.
26         </refsection>
27         <title>呼び出し手順</title>
28         <para>入力引数プロファイル:</para>
29         <para>符号あり整数 :</para>
30         <synopsis>SciErr createMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData)</synopsis>
31         <synopsis>SciErr createMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData)</synopsis>
32         <synopsis>SciErr createMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData)</synopsis>
33         <para>符号無し整数 :</para>
34         <synopsis>SciErr createMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData)</synopsis>
35         <synopsis>SciErr createMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData)</synopsis>
36         <synopsis>SciErr createMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData)</synopsis>
37         <para>名前指定変数プロファイル:</para>
38         <para>符号あり整数 :</para>
39         <synopsis>SciErr createMatrixOfInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* _pcData)</synopsis>
40         <synopsis>SciErr createMatrixOfInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const short* _psData)</synopsis>
41         <synopsis>SciErr createMatrixOfInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData)</synopsis>
42         <para>符号無し整数 :</para>
43         <synopsis>SciErr createMatrixOfUnsignedInteger8InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned char* _pucData)</synopsis>
44         <synopsis>SciErr createMatrixOfUnsignedInteger16InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned short* _pusData)</synopsis>
45         <synopsis>SciErr createMatrixOfUnsignedInteger32InNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const unsigned int* _puiData)</synopsis>
46     </refsynopsisdiv>
47     <refsection>
48         <title>引数</title>
49         <variablelist>
50             <varlistentry>
51                 <term>_pvCtx</term>
52                 <listitem>
53                     <para>
54                         Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定.
55                     </para>
56                 </listitem>
57             </varlistentry>
58             <varlistentry>
59                 <term>_iVar</term>
60                 <listitem>
61                     <para>
62                         代入する変数のScilabメモリ上の位置.
63                     </para>
64                 </listitem>
65             </varlistentry>
66             <varlistentry>
67                 <term>_pstName</term>
68                 <listitem>
69                     <para>
70                         "名前指定" 関数の変数名.
71                     </para>
72                 </listitem>
73             </varlistentry>
74             <varlistentry>
75                 <term>_piParent</term>
76                 <listitem>
77                     <para>
78                         新規要素の親のアドレス.
79                     </para>
80                 </listitem>
81             </varlistentry>
82             <varlistentry>
83                 <term>_iItemPos</term>
84                 <listitem>
85                     <para>
86                         リストにおける新規要素の位置.
87                     </para>
88                 </listitem>
89             </varlistentry>
90             <varlistentry>
91                 <term>_iRows</term>
92                 <listitem>
93                     <para>
94                         新規変数の行数.
95                     </para>
96                 </listitem>
97             </varlistentry>
98             <varlistentry>
99                 <term>_iCols</term>
100                 <listitem>
101                     <para>
102                         新規変数の列数.
103                     </para>
104                 </listitem>
105             </varlistentry>
106             <varlistentry>
107                 <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term>
108                 <listitem>
109                     <para>
110                         データ配列(大きさ: _iCols * _iRows)のアドレス.
111                     </para>
112                 </listitem>
113             </varlistentry>
114             <varlistentry>
115                 <term>SciErr</term>
116                 <listitem>
117                     <para>
118                         エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体.
119                     </para>
120                 </listitem>
121             </varlistentry>
122         </variablelist>
123     </refsection>
124     <refsynopsisdiv>
125         <refsection>
126             Scilabメモリに直接書き込む.
127         </refsection>
128         <title>呼び出し手順</title>
129         <para>入力引数プロファイル:</para>
130         <para>符号あり整数 :</para>
131         <synopsis>SciErr allocMatrixOfInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, char** _pcData)</synopsis>
132         <synopsis>SciErr allocMatrixOfInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, short** _psData)</synopsis>
133         <synopsis>SciErr allocMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piData)</synopsis>
134         <para>符号無し整数 :</para>
135         <synopsis>SciErr allocMatrixOfUnsignedInteger8InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned char** _pucData)</synopsis>
136         <synopsis>SciErr allocMatrixOfUnsignedInteger16InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned short** _pusData)</synopsis>
137         <synopsis>SciErr allocMatrixOfUnsignedInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, unsigned int** _puiData)</synopsis>
138     </refsynopsisdiv>
139     <refsection>
140         <title>引数</title>
141         <variablelist>
142             <varlistentry>
143                 <term>_pvCtx</term>
144                 <listitem>
145                     <para>
146                         Scilab環境ポインタ, api_scilab.hで定義された"pvApiCtx"で指定.
147                     </para>
148                 </listitem>
149             </varlistentry>
150             <varlistentry>
151                 <term>_iVar</term>
152                 <listitem>
153                     <para>
154                         代入する変数のScilabメモリ上の位置.
155                     </para>
156                 </listitem>
157             </varlistentry>
158             <varlistentry>
159                 <term>_piParent</term>
160                 <listitem>
161                     <para>
162                         新規要素の親のアドレス.
163                     </para>
164                 </listitem>
165             </varlistentry>
166             <varlistentry>
167                 <term>_iItemPos</term>
168                 <listitem>
169                     <para>
170                         リストにおける新規要素の位置.
171                     </para>
172                 </listitem>
173             </varlistentry>
174             <varlistentry>
175                 <term>_iRows</term>
176                 <listitem>
177                     <para>
178                         新規変数の行数.
179                     </para>
180                 </listitem>
181             </varlistentry>
182             <varlistentry>
183                 <term>_iCols</term>
184                 <listitem>
185                     <para>
186                         新規変数の列数.
187                     </para>
188                 </listitem>
189             </varlistentry>
190             <varlistentry>
191                 <term>_pcData8, _psData16, _piData32, _pucData8, _pusData16, _puiData32</term>
192                 <listitem>
193                     <para>
194                         データ配列(大きさ: _iCols * _iRows)のアドレス.
195                     </para>
196                 </listitem>
197             </varlistentry>
198             <varlistentry>
199                 <term>SciErr</term>
200                 <listitem>
201                     <para>
202                         エラーメッセージの履歴と最初のエラー番号が保存されるエラー構造体.
203                     </para>
204                 </listitem>
205             </varlistentry>
206         </variablelist>
207     </refsection>
208     <refsection>
209         <title>説明</title>
210         <para>このヘルプはリスト中に整数の行列を追加する方法を説明します.</para>
211         <para>Scilabメモリに書き込む際には2種類の関数を使用できます.</para>
212     </refsection>
213     <refsection>
214         <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c-->
215         <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst-->
216         <!--Lib_name: list_createlist-->
217         <!--Func_list: list_createlist-->
218         <title>ゲートウェイのソース</title>
219         <programlisting role="code_gateway"><![CDATA[ 
220 #include "api_scilab.h"
221 int list_createlist(char *fname,void* pvApiCtx)
222 {
223         SciErr sciErr;
224         int *piAddr             = NULL;
225         int* piChild            = NULL;
226         double pdblData1[]      = {1,3,5,2,4,6};
227         double pdblData2[]      = {6,4,2,5,3,1};
228         char *pstData[]         = {"may","be","the","with","puffin","you"};
229         short psData[]          = {1,4,2,5,3,6};
230         double pdblPoly1[]      = {1};
231         double pdblPoly2[]      = {-2,-1};
232         double pdblPoly3[]      = {1,2,3};
233         double pdblPoly4[]      = {-4,-3,-2,-1};
234         double pdblPoly5[]      = {1,2,3,4,5};
235         double pdblPoly6[]      = {-6,-5,-4,-3,-2,-1};
236         double *pdblPoly[]      = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6};
237         int piCoef[]            = {1,3,5,2,4,6};
238         int piNbItemRow[]       = {1,2,1};
239         int piColPos[]          = {8,4,7,2};
240         double pdblSReal[]      = {1,2,3,4};
241         double pdblSImg[]       = {4,3,2,1};
242         int piBool[]            = {1,0,1,0,1,0,1,0,1};
243         double* pdblDataPtr     = NULL;
244         sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr);
245         if(sciErr.iErr)
246         {
247                 printError(&sciErr, 0);
248                 return 0;
249         }
250         sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2);
251         if(sciErr.iErr)
252         {
253                 printError(&sciErr, 0);
254                 return 0;
255         }
256         sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData);
257         if(sciErr.iErr)
258         {
259                 printError(&sciErr, 0);
260                 return 0;
261         }
262         sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData);
263         if(sciErr.iErr)
264         {
265                 printError(&sciErr, 0);
266                 return 0;
267         }
268         sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly);
269         if(sciErr.iErr)
270         {
271                 printError(&sciErr, 0);
272                 return 0;
273         }
274         sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg);
275         if(sciErr.iErr)
276         {
277                 printError(&sciErr, 0);
278                 return 0;
279         }
280         sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool);
281         if(sciErr.iErr)
282         {
283                 printError(&sciErr, 0);
284                 return 0;
285         }
286         sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos);
287         if(sciErr.iErr)
288         {
289                 printError(&sciErr, 0);
290                 return 0;
291         }
292         //add list in list
293         sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild);
294         if(sciErr.iErr)
295         {
296                 printError(&sciErr, 0);
297                 return 0;
298         }
299         sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1);
300         if(sciErr.iErr)
301         {
302                 printError(&sciErr, 0);
303                 return 0;
304         }
305         sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal);
306         if(sciErr.iErr)
307         {
308                 printError(&sciErr, 0);
309                 return 0;
310         }
311         pdblDataPtr     = (double*)malloc(sizeof(double) * 4);
312         pdblDataPtr[0]  = 1;
313         pdblDataPtr[1]  = 2;
314         pdblDataPtr[2]  = 3;
315         pdblDataPtr[3]  = 4;
316         sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr);
317         if(sciErr.iErr)
318         {
319                 printError(&sciErr, 0);
320                 return 0;
321         }
322         AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
323         return 0;
324 }
325  ]]></programlisting>
326     </refsection>
327     <refsection>
328         <title>Scilab テストスクリプト</title>
329         <programlisting role="code_scilab"><![CDATA[ 
330 size_ref    = 8;
331 type_ref    = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"];
332 dim_ref     = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3);
333 l = list_createlist();
334 if size(l) <> size_ref then error("failed"), end
335 for i = 1 : size_ref
336     if typeof(l(i)) <> type_ref(i) then error("failed"), end
337     if size(l(i)) <> dim_ref(i) then error("failed"), end
338 end
339  ]]></programlisting>
340     </refsection>
341 </refentry>