License Header change: Removed the LICENSE_END before beta
[scilab.git] / scilab / modules / api_scilab / help / ja_JP / legacy / list_management / list_boolean_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_boolean_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         <synopsis>SciErr createMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool)</synopsis>
30         <para>名前指定変数プロファイル:</para>
31         <synopsis>SciErr createMatrixOfBooleanInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piBool)</synopsis>
32     </refsynopsisdiv>
33     <refsection>
34         <title>引数</title>
35         <variablelist>
36             <varlistentry>
37                 <term>_pvCtx</term>
38                 <listitem>
39                     <para>
40                         Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定.
41                     </para>
42                 </listitem>
43             </varlistentry>
44             <varlistentry>
45                 <term>_iVar</term>
46                 <listitem>
47                     <para>
48                         変数を保存するScilabメモリの位置.
49                     </para>
50                 </listitem>
51             </varlistentry>
52             <varlistentry>
53                 <term>_pstName</term>
54                 <listitem>
55                     <para>
56                         "名前指定" 関数の場合の変数名.
57                     </para>
58                 </listitem>
59             </varlistentry>
60             <varlistentry>
61                 <term>_piParent</term>
62                 <listitem>
63                     <para>
64                         新規アイテムの親のアドレス.
65                     </para>
66                 </listitem>
67             </varlistentry>
68             <varlistentry>
69                 <term>_iItemPos</term>
70                 <listitem>
71                     <para>
72                         リスト中の新規アイテムの位置.
73                     </para>
74                 </listitem>
75             </varlistentry>
76             <varlistentry>
77                 <term>_iRows</term>
78                 <listitem>
79                     <para>
80                         新規変数の行数.
81                     </para>
82                 </listitem>
83             </varlistentry>
84             <varlistentry>
85                 <term>_iCols</term>
86                 <listitem>
87                     <para>
88                         新規変数の列数.
89                     </para>
90                 </listitem>
91             </varlistentry>
92             <varlistentry>
93                 <term>_piBool</term>
94                 <listitem>
95                     <para>
96                         データ配列のアドレス (大きさ: _iRows * _iCols).
97                     </para>
98                 </listitem>
99             </varlistentry>
100             <varlistentry>
101                 <term>SciErr</term>
102                 <listitem>
103                     <para>
104                         エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体.
105                     </para>
106                 </listitem>
107             </varlistentry>
108         </variablelist>
109     </refsection>
110     <refsynopsisdiv>
111         <refsection>
112             Scilabメモリに直接書き込む.
113         </refsection>
114         <title>呼び出し手順</title>
115         <para>入力引数プロファイル:</para>
116         <synopsis>SciErr allocMatrixOfBooleanInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, int** _piBool)</synopsis>
117     </refsynopsisdiv>
118     <refsection>
119         <title>引数</title>
120         <variablelist>
121             <varlistentry>
122                 <term>_pvCtx</term>
123                 <listitem>
124                     <para>
125                         Scilab環境ポインタ, api_scilab.hで提供される"pvApiCtx"を指定.
126                     </para>
127                 </listitem>
128             </varlistentry>
129             <varlistentry>
130                 <term>_iVar</term>
131                 <listitem>
132                     <para>
133                         変数を保存するScilabメモリの位置.
134                     </para>
135                 </listitem>
136             </varlistentry>
137             <varlistentry>
138                 <term>_piParent</term>
139                 <listitem>
140                     <para>
141                         新規アイテムの親のアドレス.
142                     </para>
143                 </listitem>
144             </varlistentry>
145             <varlistentry>
146                 <term>_iItemPos</term>
147                 <listitem>
148                     <para>
149                         リスト中の新規アイテムの位置.
150                     </para>
151                 </listitem>
152             </varlistentry>
153             <varlistentry>
154                 <term>_iRows</term>
155                 <listitem>
156                     <para>
157                         新規変数の行数.
158                     </para>
159                 </listitem>
160             </varlistentry>
161             <varlistentry>
162                 <term>_iCols</term>
163                 <listitem>
164                     <para>
165                         新規変数の列数.
166                     </para>
167                 </listitem>
168             </varlistentry>
169             <varlistentry>
170                 <term>_piBool</term>
171                 <listitem>
172                     <para>
173                         データ配列のアドレスを返す (大きさ: _iRows * _iCols).
174                     </para>
175                 </listitem>
176             </varlistentry>
177             <varlistentry>
178                 <term>SciErr</term>
179                 <listitem>
180                     <para>
181                         エラーメッセージの履歴と最初のエラー番号を保存するエラー構造体.
182                     </para>
183                 </listitem>
184             </varlistentry>
185         </variablelist>
186     </refsection>
187     <refsection>
188         <title>説明</title>
189         <para>このヘルプはリスト中に論理値行列を追加する手順を示します.</para>
190     </refsection>
191     <refsection>
192         <!--File_gateway: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.c-->
193         <!--File_scilab: SCI/modules/api_scilab/tests/unit_tests/list_createlist_api.tst-->
194         <!--Lib_name: list_createlist-->
195         <!--Func_list: list_createlist-->
196         <title>ゲートウェイのソース</title>
197         <programlisting role="code_gateway"><![CDATA[ 
198 #include "api_scilab.h"
199 int list_createlist(char *fname,void* pvApiCtx)
200 {
201         SciErr sciErr;
202         int *piAddr             = NULL;
203         int* piChild            = NULL;
204         double pdblData1[]      = {1,3,5,2,4,6};
205         double pdblData2[]      = {6,4,2,5,3,1};
206         char *pstData[]         = {"may","be","the","with","puffin","you"};
207         short psData[]          = {1,4,2,5,3,6};
208         double pdblPoly1[]      = {1};
209         double pdblPoly2[]      = {-2,-1};
210         double pdblPoly3[]      = {1,2,3};
211         double pdblPoly4[]      = {-4,-3,-2,-1};
212         double pdblPoly5[]      = {1,2,3,4,5};
213         double pdblPoly6[]      = {-6,-5,-4,-3,-2,-1};
214         double *pdblPoly[]      = {pdblPoly1, pdblPoly3, pdblPoly5, pdblPoly2, pdblPoly4, pdblPoly6};
215         int piCoef[]            = {1,3,5,2,4,6};
216         int piNbItemRow[]       = {1,2,1};
217         int piColPos[]          = {8,4,7,2};
218         double pdblSReal[]      = {1,2,3,4};
219         double pdblSImg[]       = {4,3,2,1};
220         int piBool[]            = {1,0,1,0,1,0,1,0,1};
221         double* pdblDataPtr     = NULL;
222         sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr);
223         if(sciErr.iErr)
224         {
225                 printError(&sciErr, 0);
226                 return 0;
227         }
228         sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2);
229         if(sciErr.iErr)
230         {
231                 printError(&sciErr, 0);
232                 return 0;
233         }
234         sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData);
235         if(sciErr.iErr)
236         {
237                 printError(&sciErr, 0);
238                 return 0;
239         }
240         sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData);
241         if(sciErr.iErr)
242         {
243                 printError(&sciErr, 0);
244                 return 0;
245         }
246         sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly);
247         if(sciErr.iErr)
248         {
249                 printError(&sciErr, 0);
250                 return 0;
251         }
252         sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg);
253         if(sciErr.iErr)
254         {
255                 printError(&sciErr, 0);
256                 return 0;
257         }
258         sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool);
259         if(sciErr.iErr)
260         {
261                 printError(&sciErr, 0);
262                 return 0;
263         }
264         sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos);
265         if(sciErr.iErr)
266         {
267                 printError(&sciErr, 0);
268                 return 0;
269         }
270         //add list in list
271         sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild);
272         if(sciErr.iErr)
273         {
274                 printError(&sciErr, 0);
275                 return 0;
276         }
277         sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1);
278         if(sciErr.iErr)
279         {
280                 printError(&sciErr, 0);
281                 return 0;
282         }
283         sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal);
284         if(sciErr.iErr)
285         {
286                 printError(&sciErr, 0);
287                 return 0;
288         }
289         pdblDataPtr     = (double*)malloc(sizeof(double) * 4);
290         pdblDataPtr[0]  = 1;
291         pdblDataPtr[1]  = 2;
292         pdblDataPtr[2]  = 3;
293         pdblDataPtr[3]  = 4;
294         sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr);
295         if(sciErr.iErr)
296         {
297                 printError(&sciErr, 0);
298                 return 0;
299         }
300         AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
301         return 0;
302 }
303  ]]></programlisting>
304     </refsection>
305     <refsection>
306         <title>Scilab テストスクリプト</title>
307         <programlisting role="code_scilab"><![CDATA[ 
308 size_ref    = 8;
309 type_ref    = ["constant","string","int16","polynomial", "sparse", "boolean", "boolean sparse", "list"];
310 dim_ref     = list([3,2],[2,3],[2,3],[3,2],[3,10],[3,3],[3,10],3);
311 l = list_createlist();
312 if size(l) <> size_ref then error("failed"), end
313 for i = 1 : size_ref
314     if typeof(l(i)) <> type_ref(i) then error("failed"), end
315     if size(l(i)) <> dim_ref(i) then error("failed"), end
316 end
317  ]]></programlisting>
318     </refsection>
319 </refentry>