1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
5 * Copyright (C) 2015 - 2016 - Samuel GOUGEON
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
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.
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml"
18 xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19 xmlns:scilab="http://www.scilab.org" xml:id="typeof" xml:lang="pt">
21 <refname>typeof</refname>
22 <refpurpose>tipo do objeto</refpurpose>
25 <title>Seqüência de Chamamento</title>
28 oc = typeof(object, "overload")
31 <refsection role="arguments">
32 <title>Parâmetros</title>
37 <para>objeto Scilab</para>
44 a string (may have spaces): the name of the type of <varname>object</varname>
51 <para>a string (without spaces): the name of the overloading code for the
52 <varname>object</varname>.
58 <refsection role="description">
59 <title>Descrição</title>
61 <literal>t = typeof(object)</literal> retorna um dos seguintes
67 <emphasis role="bold">string</emphasis>
70 <varname>object</varname> é uma matriz ou hipermatriz de
71 <link linkend="strings">caracteres</link> e/o textos.
76 <emphasis role="bold">boolean</emphasis>
79 <varname>object</varname> é uma matriz ou hipermatriz de valores
84 <emphasis role="bold">int8</emphasis> ou
85 <emphasis role="bold">int16</emphasis> ou
86 <emphasis role="bold">int32</emphasis> ou
87 <emphasis role="bold">int64</emphasis> ou
88 <emphasis role="bold">uint8</emphasis> ou
89 <emphasis role="bold">uint16</emphasis> ou
90 <emphasis role="bold">uint32</emphasis> ou
91 <emphasis role="bold">uint64</emphasis>
97 <varname>object</varname> is a matrix or hypermatrix of [unsigned]
99 on 8, 16, 32 or 64 bits. (see <link linkend="inttype">inttype</link>)
104 <emphasis role="bold">constant</emphasis>
107 <varname>object</varname> é uma matriz ou hipermatriz
108 de números reais ou complexos
113 <emphasis role="bold">polynomial</emphasis>
116 <varname>object</varname> é uma matriz ou hipermatriz de
117 <link linkend="poly">polinômios</link>
118 com coeficientes reais ou complexos.
123 <emphasis role="bold">rational</emphasis>
126 <varname>object</varname> é uma matriz ou hipermatriz de
127 <link linkend="rational">razões </link>
128 de polinômios (matriz de transferência), com coeficientes
134 <emphasis role="bold">handle</emphasis>
137 <varname>object</varname> is a graphics
138 <link linkend="graphics_entities">handle</link>.
139 The subtype of graphics handles (Figure, Axes, Polyline,
140 Compound, etc) is available in their <literal>.type</literal>
141 property. See examples below.
146 <emphasis role="bold">list</emphasis>
149 <varname>object</varname> é uma
150 <link linkend="list">lista</link>.
155 <emphasis role="bold">st</emphasis>
158 <varname>object</varname> é uma
159 <link linkend="struct">estrutura</link> ou
160 um nD-array de estruturas.
165 <emphasis role="bold">ce</emphasis>
168 <varname>object</varname> é uma célula
169 ou um nD-array de <link linkend="cell">células</link>.
174 <emphasis role="bold">boolean sparse</emphasis>
177 <varname>object</varname> é uma matriz de valores
178 <link linkend="sparse">booleanos esparsa</link>.
179 <warning>Sparse boolean hypermatrices are not supported.
185 <emphasis role="bold">sparse</emphasis>
188 <varname>object</varname> é uma matriz
189 <link linkend="sparse">esparsa</link> de números
191 <warning>Sparse numerical hypermatrices are not supported.</warning>
195 <td style="white-space:nowrap">
196 <emphasis role="bold">"Matlab sparse"</emphasis>
199 <varname>object</varname> is a Matlab-like-encoded sparse
200 matrix (see <link linkend="mtlb_sparse">mtlb_sparse()</link>).
205 <emphasis role="bold">fptr</emphasis>
208 <varname>object</varname> is a built-in Scilab function,
209 called also <emphasis role="italic">gateway</emphasis>
210 (C, C++ or Fortran code), a.k.a. a primitive.
215 <emphasis role="bold">function</emphasis>
218 <varname>object</varname> is a <link linkend="function">function</link>
219 (Scilab code). See also <link linkend="deff">deff</link>.
224 <emphasis role="bold">library</emphasis>
227 <varname>object</varname> is a
228 <link linkend="library">library</link>
229 of functions in Scilab language.
234 <emphasis role="bold">pointer</emphasis>
237 <varname>object</varname> é um ponteiro (ver
238 <link linkend="lufact">lufact</link>).
243 <emphasis role="bold">implicitlist</emphasis>
246 <varname>object</varname> é um polinômio de tamanho
247 implícito para indexação.
248 Ver <link linkend="dollar">n:$</link> e
249 <link linkend="colon">: (colon)</link>
254 <emphasis role="bold">listdelete</emphasis>
259 typeof(<literal>null()</literal>)
262 See <link linkend="null">null()</link>.
267 <emphasis role="bold">void</emphasis>
269 <td>is the typeof undefined elements in lists.
273 <td colspan="2"></td>
276 <emphasis role="bold italic">Typed T-Lists or M-Lists:</emphasis>
280 Note that if the <varname>object</varname> is a
281 <link linkend="tlist">tlist</link>
282 or a <link linkend="mlist">mlist</link>, <function>typeof</function>
283 will return the corresponding customized type stored in as a
284 string in the first list entry.
288 <td colspan="2"></td>
291 <emphasis role="bold italic">Reserved T-List or M-List types
292 predefined in Scilab:
298 <emphasis role="bold">dir</emphasis>
301 <varname>object</varname> is the result of a
302 <link linkend="dir">dir()</link>
303 instruction, with fields <literal>name</literal>, <literal>date</literal>,
304 <literal>bytes</literal>, and <literal>isdir</literal>.
309 <emphasis role="bold">state-space</emphasis>
312 <varname>object</varname> is a state-space model
313 (see <link linkend="syslin">syslin</link>).
318 <emphasis role="bold">program</emphasis>
321 <varname>object</varname> is a list describing the internal code of a function
322 (see <link linkend="macr2tree">macr2tree</link>).
327 <emphasis role="bold">cblock</emphasis>
330 <varname>object</varname> is a block of columns of same
331 heights but of different data types, as returned by
332 <link linkend="mfscanf">mfscanf</link>.
337 <emphasis role="bold">XMLDoc</emphasis>
340 <varname>object</varname> is an XML Document created with
341 <link linkend="xmlRead">xmlRead</link>,
342 <link linkend="xmlReadStr">xmlReadStr</link>,
343 <link linkend="htmlRead">htmlRead</link>, or
344 <link linkend="htmlReadStr">htmlReadStr</link>.
345 Additional XML typeof are defined.
350 <emphasis role="bold">H5Object</emphasis>
353 <varname>object</varname> is the id of an HDF5 file opened
354 with <link linkend="h5open">h5open</link>.
355 Additional HDF5 typeof are defined:
356 See <link linkend="h5objects">HDF5 Objects</link>.
361 <emphasis role="bold">uitree</emphasis>
364 <varname>object</varname> is a tree, a branch or a leaf as created with a
365 uitree feature. See for instance <link linkend="uiCreateNode">uiCreateNode</link>.
370 <emphasis role="bold italic">Reserved T-list types used in Xcos</emphasis> :
375 <link linkend="scicos_block"><emphasis role="bold">Block</emphasis></link>
377 <td><varname>object</varname> is a Xcos block.
382 <link linkend="scicos_cpr"><emphasis role="bold">cpr</emphasis></link>
385 <varname>object</varname> is a tlist containing the compilation results of a Xcos diagram.
390 <link linkend="scicos_diagram"><emphasis role="bold">diagram</emphasis></link>
393 <varname>object</varname> is a tlist defining a Xcos diagram: initial parameters,
394 set of blocks, of links between blocks, and of Text labels belonging to the diagram.
399 <link linkend="scicos_graphics"><emphasis role="bold">graphics</emphasis></link>
402 <varname>object</varname> is a tlist assigned to the <literal>.graphics</literal>
408 <link linkend="scicos_link"><emphasis role="bold">Link</emphasis></link>
411 <varname>object</varname> is a tlist defining and configuring a link between 2 blocks.
416 <link linkend="scicos_model"><emphasis role="bold">model</emphasis></link>
419 <varname>object</varname> is a tlist assigned to the <literal>.model</literal> field
425 <link linkend="scicos_params"><emphasis role="bold">params</emphasis></link>
428 <varname>object</varname> is a tlist containing some configuration parameters of a
434 <emphasis role="bold">scsopt</emphasis>
437 <varname>object</varname> is a tlist containing the graphical options of the Xcos
443 <link linkend="scicos_sim"><emphasis role="bold">scs</emphasis></link>
446 <varname>object</varname> is a tlist containing static results of the compilation of
452 <link linkend="scicos_state"><emphasis role="bold">xcs</emphasis></link>
455 <varname>object</varname> is a tlist containing dynamical results during a Xcos
461 <emphasis role="bold">Text</emphasis>
464 <varname>object</varname> is a tlist defining a text label in a Xcos diagram.
469 <refsection role="examples">
470 <title>Exemplos</title>
471 <programlisting role="no-scilab-exec"><![CDATA[
472 // Characters and texts
473 t = ["a" "Hello" "à é è ï ô û ñ"
474 "1" "Bonjour" "указывает тип объекта"
475 ";" "Chao" "オブジェクトの型"
482 hm = grand(2,2,2,"uin",0,9)<5
486 [ typeof(uint8(%pi)) typeof(int8(-%pi))
487 typeof(uint16(%pi)) typeof(int16(-%pi))
488 typeof(uint32(%pi)) typeof(int32(-%pi))
489 typeof(uint64(%pi)) typeof(int64(-%pi))
495 hm = grand(2,2,2,"uin",0,9)
503 n = [%i 1-%i %pi - 3*%i]
506 // Special "constant"
507 typeof([]) // empty matrix
512 n = [ 3*%i + %z (1-%i*%z)^2]
515 // Rational fractions
516 r = [%s/(1-%s) (1+%s)^2/(1-%s)] // with real coefficients
518 r = [%s/(%i-%s) (%i+%s)^2/(1-%s)] // with complex coefficients
523 w = sprand(100,100,0.001)
525 typeof(w==w) // boolean sparse
526 //x = mtlb_sparse(sprand(10,10,0.1));
529 // Functions and libraries
530 // -----------------------
531 deff('y=f(x)','y=2*x'); // Function in Scilab language
534 typeof(cosd) // written in Scilab
536 typeof(corelib) // Library of functions in Scilab language
538 typeof(sin) // Built-in function (non-editable)
547 // The subtype of the handle is in the "type" property:
557 L = list(%pi, %t, %z, %s/(1-%s), "Bonjour", sin, cosd, list("list_in_list", 432));
561 C = {%pi, %t, %z ; %s/(1-%s), "Bonjour", list("list_in_list", 432) }
564 // (Array of) Structure
570 // Special generic indexing expressions
571 // ------------------------------------
573 typeof(:) // "eye()" equivalent (all elements)
576 // Typeof for deletion or undefined elements:
577 // -----------------------------------------
578 typeof([]) // empty matrix
580 L = list(%pi, ,"hey!")
581 typeof(L(2)) // undefined element
583 // Customized typeof of T-Lists:
584 // ----------------------------
585 L = tlist(['myLongTypeOf','a','b'], 18, 'Scilab');
588 // Reserved T-List typeof
589 // ----------------------
590 typeof(dir()) // Files directory
592 c = macr2tree(sind); // Internal code of a Scilab macro
597 doc = xmlReadStr("<root><a att=""foo"">Hello</a></root>");
602 save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones
603 a = h5open(TMPDIR + "/x.sod");
608 <refsection role="see also">
609 <title>Ver Também</title>
610 <simplelist type="inline">
612 <link linkend="type">type</link>
615 <link linkend="inttype">inttype</link>
618 <link linkend="overloading">overloading</link>
621 <link linkend="isreal">isreal</link>
624 <link linkend="strings">strings</link>
627 <link linkend="poly">poly</link>
630 <link linkend="rlist">rlist</link>
633 <link linkend="null">null</link>
636 <link linkend="sparse">sparse</link>
639 <link linkend="issparse">issparse</link>
642 <link linkend="mtlb_sparse">mtlb_sparse</link>
645 <link linkend="syslin">syslin</link>
648 <link linkend="dir">dir</link>
651 <link linkend="XMLObjects">XML Objects</link>
654 <link linkend="h5objects">HDF5 Objects</link>
658 <refsection role="history">
659 <title>Histórico</title>
662 <revnumber>6.0</revnumber>
665 <listitem>"overload" keyword added. </listitem>
666 <listitem>typeof "uint64" and "int64" added. </listitem>
667 <listitem>typeof "hypermat" removed. Hypermatrices of any homogeneous type are now
670 <listitem>typeof "listdelete" added (as returned by null()).</listitem>
671 <listitem>typeof() can now be used for any undefined element of a list.
672 It then returns the new "void" typeof.
674 <listitem>The typeof of T-lists and M-lists were limited to 8 characters.
675 They may be longer now.
678 typeof "size implicit" renamed "implicitlist" (<literal>1:$</literal>)
680 <listitem>Help page reviewed.</listitem>