help type updated & improved 05/19105/13
Samuel GOUGEON [Mon, 13 Feb 2017 20:58:25 +0000 (21:58 +0100)]
 * type 11 was still in ja, pt and ru pages
 * type 0 and type(:) changes are now documented
 * 128 as type(Xcos block) added
 * section dedicated to type cast in main binary operations added
 * examples: now one example for each type
 * See also extended
 * History section added

Change-Id: I615974defa36599fdbd9bfd31603643e16259a6f

scilab/CHANGES.md
scilab/modules/data_structures/help/en_US/type.xml
scilab/modules/data_structures/help/fr_FR/type.xml
scilab/modules/data_structures/help/ja_JP/type.xml
scilab/modules/data_structures/help/pt_BR/type.xml
scilab/modules/data_structures/help/ru_RU/type.xml

index 4d40c98..fe7e7ec 100644 (file)
@@ -183,6 +183,7 @@ input and output arguments.
 * `pdiv`: Returns a matrix of type 'constant' when all the rank are 0.
 * `assert_checkalmostequal` can now work with polynomials.
 * `test_run` can now take `[]` as argument to be used on console; for instance: `test_run string [] no_check_ref`.
+* `type(:)` now returns `129` instead of `1`.
 * `typeof(:)` and `typeof(n:$)` now return `"implicitlist"` instead of respectively `"constant"` and `"size implicit"`.
 * `linspace(a, b, n<=0)` now returns `[]` instead of b.
 * `strange([])` now returns `%nan` instead of `[]`, as all other functions for statistical dispersion.
index a5b25e5..316cf76 100644 (file)
@@ -1,12 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="type">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA
+ * Copyright (C) 2017 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+    xml:lang="en" xml:id="type">
     <refnamediv>
         <refname>type</refname>
-        <refpurpose>returns the type of a variable</refpurpose>
+        <refpurpose>returns the type of a Scilab object</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>[i]=type(x)</synopsis>
+        <synopsis>i = type(x)</synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Arguments</title>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>a Scilab object.</para>
+                    <para>a Scilab object: a variable or valid expression.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>i</term>
                 <listitem>
-                    <para>an integer.</para>
+                    <para>
+                        integer code identiying the type of <varname>x</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Description</title>
         <para>
-            <code>type(x)</code>  returns an integer which is the type of <varname>x</varname> as following:
+            <code>type(x)</code>  returns an integer which is the type of <varname>x</varname>,
+            defined as following:
         </para>
         <variablelist>
             <varlistentry>
                 <term>1</term>
-                <listitem>
-                    <para>a real or complex matrix of double.</para>
+                <listitem>decimal or complex numbers
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>2</term>
                 <listitem>
-                    <para>
-                        a <link linkend="poly">polynomial matrix</link>.
-                    </para>
+                    <link linkend="poly">polynomials</link> with real or complex coefficients
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>4</term>
                 <listitem>
-                    <para>
-                        a <link linkend="matrices">boolean matrix</link>.
-                    </para>
+                    booleans
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>5</term>
                 <listitem>
-                    <para>
-                        a <link linkend="sparse">sparse matrix</link>.
-                    </para>
+                    a <link linkend="sparse">sparse matrix</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>6</term>
                 <listitem>
-                    <para>
-                        a <link linkend="sparse">sparse boolean matrix</link>.
-                    </para>
+                    a <link linkend="sparse">sparse boolean matrix</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>7</term>
                 <listitem>
-                    <para>Matlab sparse matrix</para>
+                    Matlab sparse matrix
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>8</term>
                 <listitem>
-                    <para>
-                        a matrix of <link linkend="int8">integers</link> stored on 1 (<literal>int8</literal>), 2 (<literal>int16</literal>), 4 (<literal>int32</literal>), or 8 (<literal>int64</literal>) bytes.
-                    </para>
+                    <link linkend="int8">integers</link> stored on 1 (<literal>int8</literal>), 2 (<literal>int16</literal>), 4 (<literal>int32</literal>), or 8 (<literal>int64</literal>) bytes.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>9</term>
                 <listitem>
-                    <para>
-                        a matrix of <link linkend="graphics_entities">graphic handles</link>.
-                    </para>
+                    <link linkend="graphics_entities">graphic handles</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>10</term>
                 <listitem>
-                    <para>
-                        a matrix of <link linkend="strings">character strings</link>.
-                    </para>
+                    <link linkend="strings">text objects</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>13</term>
                 <listitem>
-                    <para>
-                        a compiled <link linkend="function">function</link> (Scilab code).
-                    </para>
+                    a compiled <link linkend="function">function</link> in Scilab code.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>14</term>
                 <listitem>
-                    <para>
-                        a function <link linkend="library">library</link>.
-                    </para>
+                    <link linkend="library">library</link> of compiled Scilab functions.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>15</term>
                 <listitem>
-                    <para>
-                        a <link linkend="list">list</link>.
-                    </para>
+                    a simple <link linkend="list">list</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>16</term>
                 <listitem>
-                    <para>
-                        a typed list (<link linkend="tlist">tlist</link>).
-                    </para>
+                    a typed list (<link linkend="tlist">tlist</link>).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>17</term>
                 <listitem>
-                    <para>
-                        a matrix oriented typed list (<link linkend="mlist">mlist</link>).
-                    </para>
+                    a matrix-oriented typed list (<link linkend="mlist">mlist</link>).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>128</term>
                 <listitem>
-                    <para>
-                        a pointer (Use case: <link linkend="lufact">lufact</link>).
-                    </para>
+                    an identifier of a Xcos block, of a <link linkend="lufact">lufact</link>()'s result,
+                    etc.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>129</term>
                 <listitem>
-                    <para>a size implicit polynomial used for indexing.</para>
+                    a size implicit polynomial used for indexing.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>130</term>
                 <listitem>
-                    <para>
-                        a built-in Scilab function, called also <emphasis role="italic">gateway</emphasis> (C, C++ or Fortran code).
-                    </para>
+                    a built-in Scilab function, aka <emphasis role="italic">gateway</emphasis> (C, C++ or Fortran code).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>0</term>
                 <listitem>
-                    <para>a null variable. It is mainly used internally by
-                        Scilab. If a function has no declared returned argument
-                        like <function>disp</function> when it is called it returns
-                        a null variable. If a function is called with an omitted
-                        argument in the argument list like
-                        <code>foo(a,,b)</code> the missing argument is
-                        assigned to a null variable.
-                    </para>
-                    <para>
-                        <note>
-                            Note that if a null variable is assigned to a name, it is removed.
-                            <code>x=disp(1)</code> deletes <varname>x</varname>.
-                        </note>
-                    </para>
+                    An undefined component of a simple list. Such a component may be met as
+                    an omitted input argument when calling Scilab function like in
+                    <literal>foo(a,,b)</literal>: From within the function, the missing
+                    argument is defined but is of null type. Defining
+                    <literal>L=list(%pi,,%i,,,%z)</literal> creates L(2) of type 0; etc.
+                    For these objects, <code>isdef()</code> returns <literal>%T</literal>,
+                    but their null type can be tested with <literal>type()</literal>
                 </listitem>
             </varlistentry>
         </variablelist>
-        <para>
-            <note>
-                Please note that, for some variables, <function>type</function> will return <literal>tlist</literal>
-                or <literal>mlist</literal> due to the internal data structure. This is the case of
-                <emphasis role="italic">rational</emphasis> and <emphasis role="italic">state-space</emphasis> matrices,
-                <emphasis role="italic">uitree</emphasis> and <emphasis role="italic">struct</emphasis>.
-                Please considering the use of <link linkend="typeof">typeof</link> instead.
-            </note>
-        </para>
+        <refsect2>
+            <title>Remarks</title>
+            <para>
+                Some data may be stored in custom containers defined as typed lists of type 16
+                (tlist) or 17 (matrix-oriented typed mlist). This is also the case for embedded
+                types like (<emphasis role="italic">rationals</emphasis>), structures
+                (<emphasis role="italic">struct</emphasis>),
+                <emphasis role="italic">state-space</emphasis>, interactive trees
+                (<emphasis role="italic">uitree</emphasis>), etc, for which
+                <literal>type(..)</literal> will return 16 or 17. One will use
+                <link linkend="typeof">typeof</link> to get more information about their actual
+                (sub)type.
+            </para>
+            <para>
+                <emphasis role="bold">Type conversion in mixed operations</emphasis>:
+            </para>
+            <para>
+                When a binary operator (like the multiplication) or an n-ary iterated one
+                (like the concatenation) is applied between two operands of distinct but
+                compatible types, usually the type of one of both is implicitly converted,
+                and the other operand sets the type of the result to its own type.
+                <para>
+                    Examples with the <link linkend="brackets">concatenation</link> :
+                    <literal>[%t, 3.124]</literal>, <literal>[int8(5), 3.124]</literal>, etc.
+                </para>
+                <para>
+                For the concatenation, addition, substraction, multiplication, division,
+                and the power operation, the hierarchy between operands types is as follows
+                (read "A &lt; B": B imposes its type to A) :
+                <simplelist>
+                    <member>
+                        boolean &lt; (decimal number, complex encoded number)
+                    </member>
+                    <member>
+                        <warning>
+                            (decimal number, complex-encoded number) &lt; encoded integer.
+                        </warning>
+                    </member>
+                    <member>
+                        polynomial (real | complex) &lt; rational (real | complex)
+                    </member>
+                </simplelist>
+                </para>
+            </para>
+        </refsect2>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-a=42;
-type(a)
+// (Select some lines, right-click and choose "Execute.." to run the selection)
+L = list(%pi,,"abc");
+type(L(2))                  // undefined component of a list
 
-b=%t;
-type(b)
+type(42)                    // decimal numbers
+type(%nan)
+type(%inf)
 
-c="foo"
-type(c)
+type(1+%i)                  // complex numbers
 
-d=sparse([1,2;4,5;3,10],[1,2,3]);
-type(d)
+s = sparse([1,2;4,5;3,10],[1,2,3]);
+type(s)                     // sparse-encoded decimal or complex numbers
 
-e = tlist(["listtype","field1","field2"], [], []);
-type(e)
+type(%t)                    // booleans
 
-f=poly(0,"s");
-type(f)
+type(s>2)                   // sparse-encoded booleans
 
-g=int8([1 -120 127 312]);
+g = int8([1 -120 127 312]); // encoded integers
 type(g)
+type(1.23 * int8(4))
+
+type(1-%z+%z^2)             // polynomials
 
-h=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
-type(h)
+type(gdf())                 // graphic handles
 
-l = list(1,["a" "b"]);
+type("foo")                 // texts
+
+deff('[x] = mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']);
+type(mymacro)               // Scilab functions
+
+type(disp)                  // Built-in functions
+
+l = list(1,["a" "b"]);      // simple lists
 type(l)
 
-deff('[x]=mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']);
-type(mymacro)
+e = tlist(["listtype","field1","field2"], [], []);
+type(e)                     // Typed list
+
+h = mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
+type(h)                     // Typed matrix-oriented list
+
+clear s, s.r = %pi          // structures
+type(s)
+
+c = {%t %pi %i %z "abc" s}  // cells
+type(c)
 
+r = [%z/(1-%z) (1-%z)/%z^2]
+type(r)                     // rational fractions
 ]]></programlisting>
     </refsection>
     <refsection role="see also">
@@ -235,6 +276,48 @@ type(mymacro)
             <member>
                 <link linkend="inttype">inttype</link>
             </member>
+            <member>
+                <link linkend="isreal">isreal</link>
+            </member>
+            <member>
+                <link linkend="brackets">brackets</link>
+            </member>
+            <member>
+                <link linkend="overloading">overloading</link>
+            </member>
+            <member>
+                <link linkend="poly">poly</link>
+            </member>
+            <member>
+                <link linkend="rational">rational</link>
+            </member>
+            <member>
+                <link linkend="mlist">tlist</link>
+            </member>
+            <member>
+                <link linkend="mlist">mlist</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>
+                <simplelist>
+                    <member>
+                       The type 11 is removed. It was used for uncompiled Scilab functions.
+                    </member>
+                    <member>
+                       <literal>type(:)</literal> now returns 129 instead of 1.
+                    </member>
+                    <member>
+                       Assigning an object of type 0 to a variable no longer deletes this one.
+                    </member>
+                </simplelist>
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index b6196b3..e75faf0 100644 (file)
@@ -1,28 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="type">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA
+ * Copyright (C) 2017 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+    xml:lang="fr" xml:id="type">
     <refnamediv>
         <refname>type</refname>
-        <refpurpose>Retourne le type d'une variable  </refpurpose>
+        <refpurpose>Retourne le type d'un objet Scilab</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Séquence d'appel</title>
-        <synopsis> i =type(x)</synopsis>
+        <synopsis>i = type(x)</synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Paramètres</title>
         <variablelist>
             <varlistentry>
-                <term>x  </term>
+                <term>x</term>
                 <listitem>
                     <para>
-                        objet Scilab
+                        Objet Scilab quelconque : variable, ou expression valide.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>i  </term>
+                <term>i</term>
                 <listitem>
-                    <para>entier
+                    <para>Code numérique entier identifiant le type de <varname>x</varname>.
                     </para>
                 </listitem>
             </varlistentry>
     <refsection>
         <title>Description</title>
         <para>
-            <literal>type(x)</literal> renvoie un entier donnant le code
-            numérique du type de <literal>x</literal> définit comme suit
-            :
+            <literal>type(x)</literal> renvoie le code numérique entier du type de l'objet
+            <literal>x</literal>, défini comme suit :
         </para>
         <variablelist>
             <varlistentry>
                 <term>1</term>
                 <listitem>
-                    <para>matrice réelle ou complexe..</para>
+                    nombres décimaux ou complexes.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>2</term>
                 <listitem>
-                    <para>
-                        <link linkend="poly">matrice polynomiale</link>.
-                    </para>
+                    <link linkend="poly">polynômes</link> à coefficients réels ou complexes.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>4</term>
                 <listitem>
-                    <para>
-                        <link linkend="matrices">matrice booléenne</link>.
-                    </para>
+                    booléens
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>5</term>
                 <listitem>
-                    <para>
-                        <link linkend="sparse">matrice creuse</link>.
-                    </para>
+                    <link linkend="sparse">matrice creuse numérique à valeurs réelles ou complexes</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>6</term>
                 <listitem>
-                    <para>
-                        <link linkend="sparse">matrice creuse booléenne</link>.
-                    </para>
+                    <link linkend="sparse">matrice creuse booléenne</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>7</term>
                 <listitem>
-                    <para>matrice creuse au format Matlab</para>
+                    matrice creuse au format Matlab
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>8</term>
                 <listitem>
-                    <para>
-                        matrice d'<link linkend="int8">entiers</link> codés
-                        sur 1 (int8), 2 (int16), 4 (int32) ou 8 (int64) octets.
-                    </para>
+                    <link linkend="int8">entiers</link> encodés
+                    sur 1 octet (int8, uint8), 2 octets (int16, uint16), 4 octets (int32, uint32),
+                    ou 8 octets (int64, uint64).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>9</term>
                 <listitem>
-                    <para>
-                        matrice de "<link linkend="graphics_entities">handle</link>" sur les objets
-                        graphiques.
-                    </para>
+                    <link linkend="graphics_entities">identifiants d'objets graphiques</link>
+                    ("handles").
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>10</term>
                 <listitem>
-                    <para>
-                        matrice de <link linkend="strings">chaînes de caractères</link>.
-                    </para>
+                    <link linkend="strings">textes</link>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>13</term>
                 <listitem>
-                    <para>
-                        <link linkend="function">fonction</link> compilée (code Scilab).
-                    </para>
+                    <link linkend="function">Fonction</link> en langage Scilab compilé.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>14</term>
                 <listitem>
-                    <para>bibliothèque de fonctions.</para>
+                    Bibliothèque de fonctions compilées en langage Scilab.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>15</term>
                 <listitem>
-                    <para>
-                        <link linkend="list">liste</link>.
-                    </para>
+                    <link linkend="list">Liste</link> simple.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>16</term>
                 <listitem>
-                    <para>
-                        Liste typée (<link linkend="tlist">tlist</link>).
-                    </para>
+                    Liste typée (<link linkend="tlist">tlist</link>).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>17</term>
                 <listitem>
-                    <para>
-                        liste typée orientée matrice (<link linkend="mlist">mlist</link>).
-                    </para>
+                    Liste typée matricielle (<link linkend="mlist">mlist</link>).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>128</term>
                 <listitem>
-                    <para>
-                        pointeur (Use case: <link linkend="lufact">lufact</link>).
-                    </para>
+                    Identifiant d'un bloc Xcos, d'un résultat de
+                  <link linkend="lufact">lufact</link>(), etc.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>129</term>
                 <listitem>
-                    <para>polynôme implicite utilisé pour indexer.</para>
+                    Polynôme implicite utilisé pour indexer.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>130</term>
                 <listitem>
-                    <para>
-                        Fonction interne Scilab, aussi appellé <emphasis role="italic">primitive</emphasis> (Code C, C++ ou
-                        Fortran).
-                    </para>
+                    Fonction interne Scilab, aussi appellé <emphasis role="italic">primitive</emphasis> (Code C, C++ ou Fortran).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>0</term>
                 <listitem>
-                    <para>
-                        <emphasis role="italic"> variable
-                            nulle
-                        </emphasis>
-                        .Ce type est principalement utilisé en
-                        interne par Scilab. Si une fonction n'a pas pas d'argument
-                        de retour déclaré comme <literal>disp</literal>, quand
-                        elle est appelée elle retourne une <emphasis role="italic"> variable nulle</emphasis>. Si une fonction
-                        est appellée avec un argument de la liste des arguments
-                        d'entrée omis comme <literal>foo(a,,b)</literal>
-                        l'argument manquant est assigné à la <emphasis role="italic"> variable nulle</emphasis>.
-                    </para>
-                    <para>
-                        Note: Si une <emphasis role="italic"> variable
-                            nulle
-                        </emphasis>
-                        est affectée à un nom, ce nom est
-                        supprimé de la liste des variables définies.
-                        <literal>x=disp(1)</literal> détruit
-                        <literal>x</literal>.
-                    </para>
+                    Elément d'une liste simple non défini. Il peut par exemple s'agir d'un
+                    argument d'entrée omis lors de l'appel d'une fonction Scilab tel que
+                    <literal>foo(a,,b)</literal> ; ou omis lors de la création d'une liste à
+                    trous telle que <literal>list(%pi,,%i,,,%z)</literal>, etc. Pour tester
+                    l'état de ces objets, <code>isdef()</code> répond <literal>%T</literal>,
+                    mais on pourra vérifier que leur type est nul.
                 </listitem>
             </varlistentry>
         </variablelist>
-        <para>Note: pour certaines variables, à cause de la représentation
-            interne, <emphasis role="italic">type(x)</emphasis> retournera
-            tlist (16) ou mlist (17). C'est le cas de <emphasis role="italic">rational</emphasis>, <emphasis role="italic">state-space</emphasis>,
-            <emphasis role="italic">uitree</emphasis> et <emphasis role="italic">struct</emphasis>.
-            Merci de considérer l'utilisation
-            de <link linkend="typeof">typeof</link> à la place.
-        </para>
+        <refsect2>
+        <title>Remarques</title>
+            <para>
+                Certaines données structurées sont stockées dans des listes typées de types 16 (tlist)
+                ou 17 (mlist). C'est le cas pour les fractions rationnelles
+                (<emphasis role="italic">rational</emphasis>), les structures
+                (<emphasis role="italic">struct</emphasis>),
+                les <emphasis role="italic">state-space</emphasis>, les arbres interactifs
+                (<emphasis role="italic">uitree</emphasis>), etc, pour lesquelles
+                <literal>type(..)</literal> répondra 16 ou 17. On utilisera alors
+                <link linkend="typeof">typeof</link> pour distinguer leurs types plus précisément.
+            </para>
+            <para>
+                <emphasis role="bold">Conversion de type lors d'opérations mixtes</emphasis> :
+            </para>
+            <para>
+                Lorsqu'un opérateur binaire -- telle que la multiplication -- ou n-aire i.e.
+                binaire itéré -- telle que la concaténation -- agit sur deux opérandes de types
+                différents mais compatibles, en général le type de l'un d'eux est implicitement
+                converti, et l'autre opérande donne son type au résultat.
+                <para>
+                    Exemples pour la  <link linkend="brackets">concaténation</link> :
+                    <literal>[%t, 3.124]</literal>, <literal>[int8(5), 3.124]</literal>, etc.
+                </para>
+                <para>
+                Pour la concaténation, l'addition, la soustraction, la multiplication, la division,
+                et la puissance, la hiérarchie des types est la suivante (lire "A &lt; B" :
+                B impose son type à A) :
+                <simplelist>
+                    <member>
+                        booléen &lt; (nombre décimal, nombre encodé complexe)
+                    </member>
+                    <member>
+                        <warning>
+                            (nombre décimal, nombre encodé complexe) &lt; entier encodé.
+                        </warning>
+                    </member>
+                    <member>
+                        polynôme (réel | complexe) &lt; fraction rationnelle (réelle | complexe)
+                    </member>
+                </simplelist>
+                </para>
+            </para>
+        </refsect2>
     </refsection>
     <refsection>
         <title>Exemples</title>
         <programlisting role="example"><![CDATA[
-a=42;
-type(a)
+// (Sélectionner des lignes, cliquer droit et choisir "Exécuter.." pour les exécuter dans la console)
+L = list(%pi,,"abc");
+type(L(2))                  // Element non défini dans une liste
 
-b=%t;
-type(b)
+type(42)                    // Nombres décimaux
+type(%nan)
+type(%inf)
 
-c="foo"
-type(c)
+type(1+%i)                  // Nombres complexes
 
-d=sparse([1,2;4,5;3,10],[1,2,3]);
-type(d)
+s = sparse([1,2;4,5;3,10],[1,2,3]);
+type(s)                     // Matrice creuse numérique, à valeurs réelles ou complexes
 
-e = tlist(["listtype","field1","field2"], [], []);
-type(e)
+type(%t)                    // Booléens
 
-f=poly(0,"s");
-type(f)
+type(s>2)                   // Matrice booléenne creuse
 
-g=int8([1 -120 127 312]);
+g = int8([1 -120 127 312]); // Entiers encodés
 type(g)
+type(1.23 * int8(4))
+
+type(1-%z+%z^2)             // Polynômes
+
+type(gdf())                 // Identifiants graphiques
+
+type("foo")                 // Textes et caractères
+
+deff('[x] = mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']);
+type(mymacro)               // Functions en langage Scilab
 
-h=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
-type(h)
+type(disp)                  // Fonctions compilées en langage externe
 
-l = list(1,["a" "b"]);
+l = list(1,["a" "b"]);      // Lists simples
 type(l)
 
-deff('[x]=mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']);
-type(mymacro)
+e = tlist(["listtype","field1","field2"], [], []);
+type(e)                     // Listes typées
+
+h = mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
+type(h)                     // Listes typées matricielles
 
+clear s, s.r = %pi          // Structures
+type(s)
+
+c = {%t %pi %i %z "abc" s}  // cells
+type(c)
+
+r = [%z/(1-%z) (1-%z)/%z^2]
+type(r)                     // Fractions polynomiales (rationnelles)
 ]]></programlisting>
     </refsection>
     <refsection role="see also">
@@ -246,6 +279,50 @@ type(mymacro)
             <member>
                 <link linkend="inttype">inttype</link>
             </member>
+            <member>
+                <link linkend="isreal">isreal</link>
+            </member>
+            <member>
+                <link linkend="brackets">brackets</link>
+            </member>
+            <member>
+                <link linkend="overloading">overloading</link>
+            </member>
+            <member>
+                <link linkend="poly">poly</link>
+            </member>
+            <member>
+                <link linkend="rational">rational</link>
+            </member>
+            <member>
+                <link linkend="mlist">tlist</link>
+            </member>
+            <member>
+                <link linkend="mlist">mlist</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>
+                    <simplelist>
+                        <member>
+                            Le type 11 est supprimé. Il était utilisé pour les fonctions Scilab non
+                            compilées.
+                        </member>
+                        <member>
+                           <literal>type(:)</literal> vaut désormais 129 au lieu de 1.
+                        </member>
+                        <member>
+                            L'affectation d'un objet de type 0 à une variable ne détruit plus celle-ci.
+                        </member>
+                    </simplelist>
+
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index f785b31..5750464 100644 (file)
@@ -1,5 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="type">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA
+ * Copyright (C) 2017 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+    xml:lang="ja" xml:id="type">
     <refnamediv>
         <refname>type</refname>
         <refpurpose>変数の型を返す</refpurpose>
             :  文字列の行列.
         </para>
         <para>
-            11
-            :  コンパイル前の関数 (Scilab コード).
-        </para>
-        <para>
             13
             :  コンパイル済みの関数 (Scilab コード).
         </para>
         </para>
         <para>
             128
-            : ポインタ (<link linkend="lufact">lufact</link>参照).
+            : Xcosブロックへのポインタ(参照)、<link linkend="lufact">lufact</link>()の結果へのポインタな.
         </para>
         <para>
             129
             130
             : Scilab 内部コード (C または Fortran コード).
         </para>
+        <para>0 :
+            An undefined component of a simple list. Such a component may be met as
+            an omitted input argument when calling Scilab function like in
+            <literal>foo(a,,b)</literal>: From within the function, the missing
+            argument is defined but is of null type. Defining
+            <literal>L=list(%pi,,%i,,,%z)</literal> creates L(2) of type 0; etc.
+            For these objects, <code>isdef()</code> returns <literal>%T</literal>,
+            but their null type can be tested with <literal>type()</literal>
+        </para>
+        <refsect2>
+            <title>Remarks</title>
+            <para>
+                Some data may be stored in custom containers defined as typed lists of type 16
+                (tlist) or 17 (matrix-oriented typed mlist). This is also the case for embedded
+                types like (<emphasis role="italic">rationals</emphasis>), structures
+                (<emphasis role="italic">struct</emphasis>),
+                <emphasis role="italic">state-space</emphasis>, interactive trees
+                (<emphasis role="italic">uitree</emphasis>), etc, for which
+                <literal>type(..)</literal> will return 16 or 17. One will use
+                <link linkend="typeof">typeof</link> to get more information about their actual
+                (sub)type.
+            </para>
+            <para>
+                <emphasis role="bold">Type conversion in mixed operations</emphasis>:
+            </para>
+            <para>
+                When a binary operator (like the multiplication) or an n-ary iterated one
+                (like the concatenation) is applied beween two operands of distinct but
+                compatible types, usually the type of one of both is implicitely converted,
+                and the other operand sets the type of the result to its own type.
+                <para>
+                    Examples with the <link linkend="brackets">concatenation</link> :
+                    <literal>[%t, 3.124]</literal>, <literal>[int8(5), 3.124]</literal>, etc.
+                </para>
+                <para>
+                For the concatenation, addition, substraction, multiplication, division,
+                and the power operation, the hierarchy between operands types is as follows
+                (read "A &lt; B": B imposes its type to A) :
+                <simplelist>
+                    <member>
+                        boolean &lt; (decimal number, complex encoded number)
+                    </member>
+                    <member>
+                        <warning>
+                            (decimal number, complex-encoded number) &lt; encoded integer.
+                        </warning>
+                    </member>
+                    <member>
+                        polynomial (real | complex) &lt; rational (real | complex)
+                    </member>
+                </simplelist>
+                </para>
+            </para>
+        </refsect2>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example"><![CDATA[
+// (Select some lines, right-click and choose "Execute.." to run the selection)
+L = list(%pi,,"abc");
+type(L(2))                  // undefined component of a list
+
+type(42)                    // decimal numbers
+type(%nan)
+type(%inf)
+
+type(1+%i)                  // complex numbers
+
+s = sparse([1,2;4,5;3,10],[1,2,3]);
+type(s)                     // sparse-encoded decimal or complex numbers
+
+type(%t)                    // booleans
+
+type(s>2)                   // sparse-encoded booleans
+
+g = int8([1 -120 127 312]); // encoded integers
+type(g)
+type(1.23 * int8(4))
+
+type(1-%z+%z^2)             // polynomials
+
+type(gdf())                 // graphic handles
+
+type("foo")                 // texts
+
+deff('[x] = mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']);
+type(mymacro)               // Scilab functions
+
+type(disp)                  // Built-in functions
+
+l = list(1,["a" "b"]);      // simple lists
+type(l)
+
+e = tlist(["listtype","field1","field2"], [], []);
+type(e)                     // Typed list
+
+h = mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
+type(h)                     // Typed matrix-oriented list
+
+clear s, s.r = %pi          // structures
+type(s)
+
+c = {%t %pi %i %z "abc" s}  // cells
+type(c)
+
+r = [%z/(1-%z) (1-%z)/%z^2]
+type(r)                     // rational fractions
+]]></programlisting>
     </refsection>
     <refsection role="see also">
         <title>参照</title>
             <member>
                 <link linkend="typeof">typeof</link>
             </member>
+            <member>
+                <link linkend="inttype">inttype</link>
+            </member>
+            <member>
+                <link linkend="isreal">isreal</link>
+            </member>
+            <member>
+                <link linkend="brackets">brackets</link>
+            </member>
+            <member>
+                <link linkend="overloading">overloading</link>
+            </member>
+            <member>
+                <link linkend="poly">poly</link>
+            </member>
+            <member>
+                <link linkend="rational">rational</link>
+            </member>
+            <member>
+                <link linkend="mlist">tlist</link>
+            </member>
+            <member>
+                <link linkend="mlist">mlist</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>
+                <simplelist>
+                    <member>
+                       The type 11 is removed. It was used for uncompiled Scilab functions.
+                    </member>
+                    <member>
+                       <literal>type(:)</literal> now returns 129 instead of 1.
+                    </member>
+                    <member>
+                       Assigning an object of type 0 to a variable no longer deletes this one.
+                    </member>
+                </simplelist>
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index dd39fa0..ca4e42e 100644 (file)
@@ -1,15 +1,33 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="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="type" xml:lang="pt">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA
+ * Copyright (C) 2017 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="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="type" xml:lang="pt">
     <refnamediv>
         <refname>type</refname>
-        <refpurpose>tipo de variável</refpurpose>
+        <refpurpose>tipo de variável</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title> Seqüência de Chamamento </title>
+        <title> Seqüência de Chamamento </title>
         <synopsis>[i]=type(x)</synopsis>
     </refsynopsisdiv>
     <refsection>
-        <title>Parâmetros</title>
+        <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
         </variablelist>
     </refsection>
     <refsection>
-        <title>Descrição</title>
+        <title>Descrição</title>
         <para>
             <literal>type(x)</literal>retorna um inteiro que indica o tipo de
             <literal>x </literal>como segue:
         </para>
         <para> 1 : uma matriz constante de reais ou complexos;</para>
-        <para> 2 : uma matriz de polinômios;</para>
+        <para> 2 : uma matriz de polinômios;</para>
         <para> 4 : uma matriz de valores booleanos;</para>
         <para> 5 : uma matriz esparsa;</para>
         <para> 6 : uma matriz de valores booleanos esparsa;</para>
         <para> 7 : uma matriz esparsa do Matlab.</para>
         <para> 8 : uma matriz de inteiros armazenados em 1, 2, 4 ou 8 bytes;</para>
-        <para> 9 : uma matriz de manipuladores gráficos;</para>
+        <para> 9 : uma matriz de manipuladores gráficos;</para>
         <para> 10 : uma matriz de strings;</para>
-        <para> 11 : uma função não-compilada (código Scilab);</para>
-        <para> 13 : uma função compilada (código Scilab);</para>
-        <para> 14 : uma biblioteca de funções;</para>
+        <para> 13 : uma função compilada (código Scilab);</para>
+        <para> 14 : uma biblioteca de funções;</para>
         <para> 15 : uma lista;</para>
         <para> 16 : uma lista com tipo ("typed list" ou "tlist");</para>
         <para> 17 : uma lista com tipo orientada matricialmente (mlist);</para>
         <para>
-            128 : um ponteiro (ver <link linkend="lufact">lufact</link>).
+            128 : um ponteiro (identificador) para um bloco Xcos, para um resultado de
+             <link linkend="lufact">lufact</link>(), etc.
         </para>
-        <para>129 : polinômio de tamanho implícito, usado para indexação.</para>
-        <para>130 : intrínseco do Scilab (código C ou Fortran).</para>
+        <para>129 : polinômio de tamanho implícito, usado para indexação.</para>
+        <para>130 : intrínseco do Scilab (código C ou Fortran).</para>
+        <para>0 :
+            An undefined component of a simple list. Such a component may be met as
+            an omitted input argument when calling Scilab function like in
+            <literal>foo(a,,b)</literal>: From within the function, the missing
+            argument is defined but is of null type. Defining
+            <literal>L=list(%pi,,%i,,,%z)</literal> creates L(2) of type 0; etc.
+            For these objects, <code>isdef()</code> returns <literal>%T</literal>,
+            but their null type can be tested with <literal>type()</literal>
+        </para>
+        <refsect2>
+            <title>Remarks</title>
+            <para>
+                Some data may be stored in custom containers defined as typed lists of type 16
+                (tlist) or 17 (matrix-oriented typed mlist). This is also the case for embedded
+                types like (<emphasis role="italic">rationals</emphasis>), structures
+                (<emphasis role="italic">struct</emphasis>),
+                <emphasis role="italic">state-space</emphasis>, interactive trees
+                (<emphasis role="italic">uitree</emphasis>), etc, for which
+                <literal>type(..)</literal> will return 16 or 17. One will use
+                <link linkend="typeof">typeof</link> to get more information about their actual
+                (sub)type.
+            </para>
+            <para>
+                <emphasis role="bold">Type conversion in mixed operations</emphasis>:
+            </para>
+            <para>
+                When a binary operator (like the multiplication) or an n-ary iterated one
+                (like the concatenation) is applied beween two operands of distinct but
+                compatible types, usually the type of one of both is implicitely converted,
+                and the other operand sets the type of the result to its own type.
+                <para>
+                    Examples with the <link linkend="brackets">concatenation</link> :
+                    <literal>[%t, 3.124]</literal>, <literal>[int8(5), 3.124]</literal>, etc.
+                </para>
+                <para>
+                For the concatenation, addition, substraction, multiplication, division,
+                and the power operation, the hierarchy between operands types is as follows
+                (read "A &lt; B": B imposes its type to A) :
+                <simplelist>
+                    <member>
+                        boolean &lt; (decimal number, complex encoded number)
+                    </member>
+                    <member>
+                        <warning>
+                            (decimal number, complex-encoded number) &lt; encoded integer.
+                        </warning>
+                    </member>
+                    <member>
+                        polynomial (real | complex) &lt; rational (real | complex)
+                    </member>
+                </simplelist>
+                </para>
+            </para>
+        </refsect2>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example"><![CDATA[
+// (Select some lines, right-click and choose "Execute.." to run the selection)
+L = list(%pi,,"abc");
+type(L(2))                  // undefined component of a list
+
+type(42)                    // decimal numbers
+type(%nan)
+type(%inf)
+
+type(1+%i)                  // complex numbers
+
+s = sparse([1,2;4,5;3,10],[1,2,3]);
+type(s)                     // sparse-encoded decimal or complex numbers
+
+type(%t)                    // booleans
+
+type(s>2)                   // sparse-encoded booleans
+
+g = int8([1 -120 127 312]); // encoded integers
+type(g)
+type(1.23 * int8(4))
+
+type(1-%z+%z^2)             // polynomials
+
+type(gdf())                 // graphic handles
+
+type("foo")                 // texts
+
+deff('[x] = mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']);
+type(mymacro)               // Scilab functions
+
+type(disp)                  // Built-in functions
+
+l = list(1,["a" "b"]);      // simple lists
+type(l)
+
+e = tlist(["listtype","field1","field2"], [], []);
+type(e)                     // Typed list
+
+h = mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
+type(h)                     // Typed matrix-oriented list
+
+clear s, s.r = %pi          // structures
+type(s)
+
+c = {%t %pi %i %z "abc" s}  // cells
+type(c)
+
+r = [%z/(1-%z) (1-%z)/%z^2]
+type(r)                     // rational fractions
+]]></programlisting>
     </refsection>
     <refsection>
-        <title> Ver Também </title>
+        <title> Ver Também </title>
         <simplelist type="inline">
             <member>
                 <link linkend="typeof">typeof</link>
             <member>
                 <link linkend="inttype">inttype</link>
             </member>
+            <member>
+                <link linkend="isreal">isreal</link>
+            </member>
+            <member>
+                <link linkend="brackets">brackets</link>
+            </member>
+            <member>
+                <link linkend="overloading">overloading</link>
+            </member>
+            <member>
+                <link linkend="poly">poly</link>
+            </member>
+            <member>
+                <link linkend="rational">rational</link>
+            </member>
+            <member>
+                <link linkend="mlist">tlist</link>
+            </member>
+            <member>
+                <link linkend="mlist">mlist</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>
+                <simplelist>
+                    <member>
+                       The type 11 is removed. It was used for uncompiled Scilab functions.
+                    </member>
+                    <member>
+                       <literal>type(:)</literal> now returns 129 instead of 1.
+                    </member>
+                    <member>
+                       Assigning an object of type 0 to a variable no longer deletes this one.
+                    </member>
+                </simplelist>
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 577ef6b..d0cd9ab 100644 (file)
@@ -1,12 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="type">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA
+ * Copyright (C) 2017 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<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:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+    xml:lang="ru" xml:id="type">
     <refnamediv>
         <refname>type</refname>
         <refpurpose>возвращает тип переменной</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Синтаксис</title>
-        <synopsis>[i]=type(x)</synopsis>
+        <synopsis>i = type(x)</synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Аргументы</title>
             <varlistentry>
                 <term>1</term>
                 <listitem>
-                    <para>матрица вещественных или комплексных значений удвоенной точности (double).</para>
+                    матрица вещественных или комплексных значений удвоенной точности (double).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>2</term>
                 <listitem>
-                    <para>
-                        матрица <link linkend="poly">полиномов</link>.
-                    </para>
+                    матрица <link linkend="poly">полиномов</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>4</term>
                 <listitem>
-                    <para>
-                        матрица <link linkend="matrices">логических</link> значений.
-                    </para>
+                    матрица <link linkend="matrices">логических</link> значений.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>5</term>
                 <listitem>
-                    <para>
-                        <link linkend="sparse">разрежённая</link> матрица.
-                    </para>
+                    <link linkend="sparse">разрежённая</link> матрица.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>6</term>
                 <listitem>
-                    <para>
-                        <link linkend="sparse">разрежённая</link> матрица логических значений.
-                    </para>
+                    <link linkend="sparse">разрежённая</link> матрица логических значений.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>7</term>
                 <listitem>
-                    <para>разрежённая матрица Matlab'а.</para>
+                    разрежённая матрица Matlab'а.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>8</term>
                 <listitem>
-                    <para>
-                        матрица <link linkend="int8">целочисленных</link> значений, хранимых в 1 (<literal>int8</literal>), 2 (<literal>int16</literal>) , 4 (<literal>int32</literal>) или 8 (<literal>int64</literal>) байтах.
-                    </para>
+                    матрица <link linkend="int8">целочисленных</link> значений, хранимых в 1
+                    (<literal>int8</literal>), 2 (<literal>int16</literal>) ,
+                    4 (<literal>int32</literal>) или 8 (<literal>int64</literal>) байтах.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>9</term>
                 <listitem>
-                    <para>
-                        матрица <link linkend="graphics_entities">графических дескрипторов</link>.
-                    </para>
+                    матрица <link linkend="graphics_entities">графических дескрипторов</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>10</term>
                 <listitem>
-                    <para>
-                        матрица <link linkend="strings">символьных строк</link>.
-                    </para>
+                    матрица <link linkend="strings">символьных строк</link>.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>13</term>
                 <listitem>
-                    <para>
-                        компилированная <link linkend="function">функция</link> (Scilab code).
-                    </para>
+                    компилированная <link linkend="function">функция</link> (Scilab code).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>14</term>
                 <listitem>
-                    <para>
-                        <link linkend="library">библиотека</link> функций.
-                    </para>
+                    <link linkend="library">библиотека</link> функций.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>15</term>
                 <listitem>
-                    <para>
-                        список (<link linkend="list">list</link>).
-                    </para>
+                    список (<link linkend="list">list</link>).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>16</term>
                 <listitem>
-                    <para>
-                        типизированный список (<link linkend="tlist">tlist</link>).
-                    </para>
+                    типизированный список (<link linkend="tlist">tlist</link>).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>17</term>
                 <listitem>
-                    <para>
-                        матричноориентированный типизированный список (<link linkend="mlist">mlist</link>).
-                    </para>
+                    матричноориентированный типизированный список (<link linkend="mlist">mlist</link>).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>128</term>
                 <listitem>
-                    <para>
-                        указатель (используется в <link linkend="lufact">lufact</link>).
-                    </para>
+                    идентификатор блока Xcos, результата <link linkend="lufact">lufact</link>() и т. д.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>129</term>
                 <listitem>
-                    <para>
-                        размер неявного многочлена, используемый для индексации.
-                    </para>
+                    размер неявного многочлена, используемый для индексации.
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>130</term>
                 <listitem>
-                    <para>
-                        встроенная функция Scilab'а, называемая также <emphasis role="italic">шлюзом</emphasis> (код C, C++ или Fortran).
-                    </para>
+                    встроенная функция Scilab'а, называемая также <emphasis role="italic">шлюзом</emphasis> (код C, C++ или Fortran).
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>0</term>
                 <listitem>
-                    <para>
-                        нуль-переменная. Она главным образом используется внутри Scilab'а. Если функция не имеет объявленных возвращаемых аргументов, как например <function>disp</function>, то, когда она вызывается, она возвращает нуль-переменную. Если функция вызвана с опущенным аргументом в списке аргументов, как например <code>foo(a,,b)</code>, то пропущенный аргумент назначается нуль-переменной.
-                    </para>
-                    <para>
-                        <note>
-                            Заметьте, что, если нуль-переменная назначается имени, то оно удаляется.
-                            <code>x=disp(1)</code> удаляет <varname>x</varname>.
-                        </note>
-                    </para>
+                    Неопределённый компонент  простого списка. Такой компонент может быть в качестве
+                    опущенного входного аргумента при вызове Scilab-функции, как, например, в <literal>foo(a,,b)</literal>:
+                    внутри функции отсутствующий аргумент определён, но он нулевого типа. Определение
+                    <literal>L=list(%pi,,%i,,,%z)</literal> создаёт <literal>L(2)</literal> типа 0, и т.д.
+                    Для этих объектов <code>isdef()</code> возвращает <literal>%T</literal>, но
+                    их нулевой тип может быть проверен с помощью <literal>type()</literal>.
                 </listitem>
             </varlistentry>
         </variablelist>
-        <para>
-            <note>
-                Пожалуйста, заметьте, что для некоторых переменных <function>type</function> вернёт <literal>tlist</literal>
-                или <literal>mlist</literal> в зависимости от внутренней структуры данных. Это так же для случая матрицы с
-                <emphasis role="italic">рациональными</emphasis> значениями, матрицы с элементами <emphasis role="italic">пространства состояний</emphasis>, <emphasis role="italic">гиперматрицы</emphasis> и <emphasis role="italic">структуры</emphasis>. Пожалуйста, используйте  вместо этого <link linkend="typeof">typeof</link>.
-            </note>
-        </para>
+        <refsect2>
+            <title>Примечания</title>
+            <para>
+               Некоторые данные могут быть сохранены в настраиваемых контейнерах, определённых как
+               типовые списки типа 16 (tlist) или 17 (матрично-ориентированный типизированный список
+               mlist). Это также и случай для встроенных типов, как например (<emphasis role="italic">рациональные числа</emphasis>),
+               (<emphasis role="italic">структуры</emphasis>), пространство состояний
+               <emphasis role="italic">state-space</emphasis>, интерактивные деревья
+               (<emphasis role="italic">uitree</emphasis>), и т.д., для которых
+               <literal>type(..)</literal> вернёт 16 или 17. Нужно использовать <link linkend="typeof">typeof</link>
+               для получения более детальной информации об их действительном (под)типе.
+            </para>
+            <para>
+                <emphasis role="bold">Преобразование типов в смешанных операциях</emphasis>:
+            </para>
+            <para>
+                Когда бинарный оператор (например, умножение) или n-арный итерационный оператор
+                (например, конкатенация) применяется межжду двумя операндами различных, но совместных
+                типов, обычно тип одного из двух неявно конвертируется, а другой операнд устанавливает
+                тип результата к своему собственному типу.
+                <para>
+                    Примеры с <link linkend="brackets">конкатенацией</link> :
+                    <code>[%t, 3.124]</code>, <code>[int8(5), 3.124]</code>, и т.д.
+                </para>
+                <para>
+                  Для конкатенации, сложения, вычитания, умножения, деления и возведения в степень
+                  иерархия между типами операндов следующая
+                (читай "A &lt; B": B устанавливает свой тип для A) :
+                <simplelist>
+                    <member>
+                        логическое &lt; (десятичное значение, комплекснозначное)
+                    </member>
+                    <member>
+                        <warning>
+                            (десятичное число, комплекснозначное число) &lt; кодированное целое.
+                        </warning>
+                    </member>
+                    <member>
+                        полиномиальное значение (вещественное | комплексное) &lt; рациональное
+                        значение (вещественное | комплексное)
+                    </member>
+                </simplelist>
+                </para>
+            </para>
+        </refsect2>
     </refsection>
     <refsection>
         <title>Примеры</title>
         <programlisting role="example"><![CDATA[
-a=42;
-type(a)
+// Выберите строки, щелкните их правой кнопкой мыши и выберите «Execute ..», чтобы запустить их
+L = list(%pi,,"abc");
+type(L(2))                  // неопределённый компонент списка
 
-b=%t;
-type(b)
+type(42)                    // десятичные числа
+type(%nan)
+type(%inf)
 
-c="foo"
-type(c)
+type(1+%i)                  // комплекснные числа
 
-d=sparse([1,2;4,5;3,10],[1,2,3]);
-type(d)
+s = sparse([1,2;4,5;3,10],[1,2,3]);
+type(s)                     // разрежённые десятичные или комплексные числа
 
-e = tlist(["listtype","field1","field2"], [], []);
-type(e)
+type(%t)                    // логические значения
 
-f=poly(0,"s");
-type(f)
+type(s>2)                   // разрежённые логические значения
 
-g=int8([1 -120 127 312]);
+g = int8([1 -120 127 312]); // кодированные целые числа
 type(g)
+type(1.23 * int8(4))
+
+type(1-%z+%z^2)             // полиномиальные значения
+
+type(gdf())                 // указатели на графические окна
+
+type("foo")                 // текстовые значения
+
+deff('[x] = mymacro(y,z)',['a=3*y+1'; 'x=a*z+y']);
+type(mymacro)               // функции Scilab
 
-h=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
-type(h)
+type(disp)                  // Встроенные фукнции
 
-l = list(1,["a" "b"]);
+l = list(1,["a" "b"]);      // простые списки
 type(l)
 
+e = tlist(["listtype","field1","field2"], [], []);
+type(e)                     // типизированный список
+
+h = mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
+type(h)                     // типизированный матрично-ориентированный список
+
+clear s, s.r = %pi          // структуры
+type(s)
+
+c = {%t %pi %i %z "abc" s}  // cell-массивы
+type(c)
+
+r = [%z/(1-%z) (1-%z)/%z^2]
+type(r)                     // рациональные дроби
 ]]></programlisting>
     </refsection>
     <refsection role="see also">
@@ -227,7 +274,49 @@ type(l)
             <member>
                 <link linkend="inttype">inttype</link>
             </member>
+            <member>
+                <link linkend="isreal">isreal</link>
+            </member>
+            <member>
+                <link linkend="brackets">квадратные скобки</link>
+            </member>
+            <member>
+                <link linkend="overloading">перегрузка</link>
+            </member>
+            <member>
+                <link linkend="poly">poly</link>
+            </member>
+            <member>
+                <link linkend="rational">rational</link>
+            </member>
+            <member>
+                <link linkend="mlist">tlist</link>
+            </member>
+            <member>
+                <link linkend="mlist">mlist</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>
+                <simplelist>
+                    <member>
+                       Тип 11 был удалён. Он использовался для некомпилировнных Scilab-функций.
+                    </member>
+                    <member>
+                       <literal>type(:)</literal> теперь возвращает 129 вместо 1.
+                    </member>
+                    <member>
+                       Назначение объекта типа 0 переменной больше не удаляет её.
+                    </member>
+                </simplelist>
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>