Massive indent of all codes:
[scilab.git] / scilab / modules / api_scilab / help / ja_JP / optionals / getOptionals.xml
1         <?xml version="1.0" encoding="UTF-8"?>
2     
3     <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getOptionals" xml:lang="ja">
4         
5         <refnamediv>
6             
7             <refname>オプション引数を取得 (Scilabゲートウェイ)</refname>
8             
9         </refnamediv>
10         
11         <refsynopsisdiv>
12             
13             <title>呼び出し手順</title>
14             
15             <synopsis>int getOptionals(void* _pvCtx, char* fname, rhs_opts opts[])</synopsis>
16             
17         </refsynopsisdiv>
18         
19         <refsection>
20             
21             <title>引数</title>
22             
23             <variablelist>
24                 
25                 <varlistentry>
26                     
27                     <term>_pvCtx</term>
28                     
29                     <listitem>
30                         
31                         <para>
32                             
33                             Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定.
34                             
35                         </para>
36                         
37                     </listitem>
38                     
39                 </varlistentry>
40                 
41                 <varlistentry>
42                     
43                     <term>fname</term>
44                     
45                     <listitem>
46                         
47                         <para>
48                             
49                             コールする関数の名前.
50                             
51                         </para>
52                         
53                     </listitem>
54                     
55                 </varlistentry>
56                 
57                 <varlistentry>
58                     
59                     <term>opts</term>
60                     
61                     <listitem>
62                         
63                         <para>オプション引数の構造体配列</para>
64                         
65                     </listitem>
66                     
67                 </varlistentry>
68                 
69             </variablelist>
70             
71         </refsection>
72         
73         <refsection>
74             
75             <title>説明</title>
76             
77             <para>
78                 
79                 オプション引数を使用するCゲートウェイ関数.
80                 
81             </para>
82             
83         </refsection>
84         
85         <refsection>
86             
87             <title>例</title>
88             
89             <para>
90                 
91                 この例では, Cインターフェイス関数は
92                 
93                 複数のオプション引数をとり,
94                 
95                 その次元を取得します.
96                 
97             </para>
98             
99             <programlisting role="example">
100                 
101                 <![CDATA[ 
102 #include "api_scilab.h"
103 #include "sciprint.h"
104 #include "sciprint.h"
105 #include "sciprint.h"
106
107 int sci_use_optional(char * fname)
108 {
109     SciErr sciErr;
110
111     char* pstName = NULL;
112     int iAge = 0;
113     int iDL = 0;
114
115     static rhs_opts opts[] =
116     {
117         { -1, "age", -1, 0, 0, NULL},
118         { -1, "drivinglicense", -1, 0, 0, NULL},
119         { -1, "name", -1, 0, 0, NULL},
120         { -1, NULL, -1, 0, 0, NULL}
121     };
122
123     int nopt = NumOpt();
124
125     CheckInputArgument(pvApiCtx, 0, nopt);
126     CheckOutputArgument(pvApiCtx, 0, 1);
127
128     if (getOptionals(pvApiCtx, fname, opts) == 0)
129     {
130         //Error
131         return 1;
132     }
133
134     if (opts[0].iPos != -1)
135     {//age
136         double dblAge = 0;
137         getScalarDouble(pvApiCtx, opts[0].piAddr, &dblAge);
138         iAge = (int)dblAge;
139     }
140     else
141     {
142         iAge = 77;
143     }
144
145     if (opts[1].iPos != -1)
146     {//drivinglicense
147         getScalarBoolean(pvApiCtx, opts[1].piAddr, &iDL);
148     }
149     else
150     {
151         iDL = 0;
152     }
153
154     if (opts[2].iPos != -1)
155     {//名前
156         getAllocatedSingleString(pvApiCtx, opts[2].piAddr, &pstName);
157     }
158     else
159     {
160         pstName = strdup("John Doe");
161     }
162
163
164
165
166     sciprint("Read information: \n");
167     sciprint("\tName: \t\t\t%s\n", pstName);
168     sciprint("\tAge: \t\t\t%d\n", iAge);
169     sciprint("\tDriving licence: \t%s\n", iDL ? "Yes" : "No");
170     //戻り値なし
171     AssignOutputVariable(pvApiCtx, 0) = 1;
172     return 0;
173 }
174  ]]>
175                 
176             </programlisting>
177             
178         </refsection>
179         
180         <refsection>
181             
182             <title>Scilab テストスクリプト</title>
183             
184             <programlisting role="code_scilab">
185                 
186                 <![CDATA[ 
187 use_optional();
188 use_optional(name = "M. Puffin");
189 use_optional(age = 25, name = "M. Puffin");
190 use_optional(drivinglicense = %t, age = 25, name = "M. Puffin");
191  ]]>
192                 
193             </programlisting>
194             
195         </refsection>
196         
197         <title>履歴</title>
198         
199         <revhistory>
200             
201             <revision>
202                 
203                 <revnumber>5.5.0</revnumber>
204                 
205                 <revremark>この関数は Scilab 5.5.0で追加されました</revremark>
206                 
207             </revision>
208             
209         </revhistory>
210         
211     </refentry>
212