add more help pages related to CAPI - check parameters - optional parameters
[scilab.git] / scilab / modules / core / help / en_US / capi / CheckScalar.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry version="5.0-subset Scilab" xml:id="CheckScalar" xml:lang="en"
3           xmlns="http://docbook.org/ns/docbook"
4           xmlns:xlink="http://www.w3.org/1999/xlink"
5           xmlns:svg="http://www.w3.org/2000/svg"
6           xmlns:mml="http://www.w3.org/1998/Math/MathML"
7           xmlns:html="http://www.w3.org/1999/xhtml"
8           xmlns:db="http://docbook.org/ns/docbook">
9   <refnamediv>
10     <refname>CheckScalar</refname>
11
12     <refpurpose>C interface function which checks if a parameter send to the C
13     function is a scalar or not</refpurpose>
14   </refnamediv>
15
16   <refsynopsisdiv>
17     <title>Calling Sequence</title>
18
19     <synopsis>CheckScalar(StackPos,m_var,n_var)</synopsis>
20   </refsynopsisdiv>
21
22   <refsection>
23     <title>Parameters</title>
24
25     <variablelist>
26       <varlistentry>
27         <term>StackPos</term>
28
29         <listitem>
30           <para>the position on the stack of the variable for which we want to
31           perform the check (input parameter)</para>
32         </listitem>
33       </varlistentry>
34
35       <varlistentry>
36         <term>m_var</term>
37
38         <listitem>
39           <para>the number of lines of the parameter at position StackPos on
40           the stack</para>
41         </listitem>
42       </varlistentry>
43
44       <varlistentry>
45         <term>n_var</term>
46
47         <listitem>
48           <para>the number of columns of the parameter at position StackPos on
49           the stack</para>
50         </listitem>
51       </varlistentry>
52     </variablelist>
53   </refsection>
54
55   <refsection>
56     <title>Description</title>
57
58     <para>C interface function which checks if a parameter send to the C
59     function is a scalar or not. You must include stack-c.h to benefit from
60     this function.</para>
61   </refsection>
62
63   <refsection>
64     <title>Examples</title>
65
66     <para>In this example, the C interface function takes one input parameters
67     and prints the integer corresponding to the type of the variable sent as
68     parameter in the Scilab console. If the test fails, we return from the C
69     interface and an adequate error message is printed in the Scilab
70     console.</para>
71
72     <programlisting role="example"> 
73 #include &lt;stack-c.h&gt;
74
75 int sci_check_properties(char * fname)
76 {
77   int m1, n1, l1;
78
79   CheckRhs(1,1);
80
81   GetRhsVar(1, "d", &amp;m1, &amp;n1, &amp;l1);
82
83   CheckScalar(1,m1,n1); // Check that first argument is a scalar
84
85   return 0;
86 }
87  </programlisting>
88   </refsection>
89
90   <refsection>
91     <title>See Also</title>
92
93     <simplelist type="inline">
94       <member><link linkend="CheckColumn">CheckColumn</link></member>
95       <member><link linkend="CheckDims">CheckDims</link></member>
96       <member><link linkend="CheckRow">CheckRow</link></member>
97       <member><link linkend="CheckVector">CheckVector</link></member>
98       <member><link linkend="OverLoad">CheckOverLoad</link></member>
99       <member><link linkend="CheckDimProp">CheckDimProp</link></member>
100       <member><link linkend="CheckLength">CheckLength</link></member>
101       <member><link linkend="CheckSameDims">CheckSameDims</link></member>
102       <member><link linkend="CheckSquare">CheckSquare</link></member>
103       <member><link linkend="How to check parameters">HowToCheckParameters</link></member>
104     </simplelist>
105   </refsection>
106 </refentry>