[doc] mv data_structures/types => core/types
[scilab.git] / scilab / modules / core / help / pt_BR / types / typeof.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * Copyright (C) 2015 - 2016 - Samuel GOUGEON
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
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">
20     <refnamediv>
21         <refname>typeof</refname>
22         <refpurpose>tipo do objeto</refpurpose>
23     </refnamediv>
24     <refsynopsisdiv>
25         <title>Seqüência de Chamamento</title>
26         <synopsis>
27             t = typeof(object)
28             oc = typeof(object, "overload")
29         </synopsis>
30     </refsynopsisdiv>
31     <refsection role="arguments">
32         <title>Parâmetros</title>
33         <variablelist>
34             <varlistentry>
35                 <term>object</term>
36                 <listitem>
37                     <para>objeto Scilab</para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>t</term>
42                 <listitem>
43                     <para>
44                         a string (may have spaces): the name of the type of <varname>object</varname>
45                     </para>
46                 </listitem>
47             </varlistentry>
48             <varlistentry>
49                 <term>oc</term>
50                 <listitem>
51                     <para>a string (without spaces): the name of the overloading code for the
52                         <varname>object</varname>.
53                     </para>
54                 </listitem>
55             </varlistentry>
56         </variablelist>
57     </refsection>
58     <refsection role="description">
59         <title>Descrição</title>
60         <para>
61             <literal>t = typeof(object)</literal> retorna um dos seguintes
62             strings:
63         </para>
64         <table>
65             <tr>
66                 <td>
67                     <emphasis role="bold">string</emphasis>
68                 </td>
69                 <td>
70                     <varname>object</varname> é uma matriz ou hipermatriz de
71                     <link linkend="strings">caracteres</link> e/o textos.
72                 </td>
73             </tr>
74             <tr>
75                 <td>
76                     <emphasis role="bold">boolean</emphasis>
77                 </td>
78                 <td>
79                     <varname>object</varname> é uma matriz ou hipermatriz de valores
80                     booleanos.
81                 </td>
82             </tr>
83             <tr><td colspan="2">
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>
92                 </td>
93             </tr>
94             <tr>
95                 <td> </td>
96                 <td>
97                     <varname>object</varname> is a matrix or hypermatrix of [unsigned]
98                     integers stored
99                     on 8, 16, 32 or 64 bits. (see <link linkend="inttype">inttype</link>)
100                 </td>
101             </tr>
102             <tr>
103                 <td>
104                     <emphasis role="bold">constant</emphasis>
105                 </td>
106                 <td>
107                     <varname>object</varname> é uma matriz ou hipermatriz
108                     de números reais ou complexos
109                 </td>
110             </tr>
111             <tr>
112                 <td>
113                     <emphasis role="bold">polynomial</emphasis>
114                 </td>
115                 <td>
116                     <varname>object</varname> é uma matriz ou hipermatriz de
117                     <link linkend="poly">polinômios</link>
118                     com coeficientes reais ou complexos.
119                 </td>
120             </tr>
121             <tr>
122                 <td>
123                     <emphasis role="bold">rational</emphasis>
124                 </td>
125                 <td>
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
129                     reais ou complexos.
130                 </td>
131             </tr>
132             <tr>
133                 <td>
134                     <emphasis role="bold">handle</emphasis>
135                 </td>
136                 <td>
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.
142                 </td>
143             </tr>
144             <tr>
145                 <td>
146                     <emphasis role="bold">list</emphasis>
147                 </td>
148                 <td>
149                     <varname>object</varname> é uma
150                     <link linkend="list">lista</link>.
151                 </td>
152             </tr>
153             <tr>
154                 <td>
155                     <emphasis role="bold">st</emphasis>
156                 </td>
157                 <td>
158                     <varname>object</varname> é uma
159                     <link linkend="struct">estrutura</link> ou
160                     um nD-array de estruturas.
161                 </td>
162             </tr>
163             <tr>
164                 <td>
165                     <emphasis role="bold">ce</emphasis>
166                 </td>
167                 <td>
168                     <varname>object</varname> é uma célula
169                     ou um nD-array de <link linkend="cell">células</link>.
170                 </td>
171             </tr>
172             <tr>
173                 <td>
174                     <emphasis role="bold">boolean sparse</emphasis>
175                 </td>
176                 <td>
177                     <varname>object</varname> é uma matriz de valores
178                     <link linkend="sparse">booleanos esparsa</link>.
179                     <warning>Sparse boolean hypermatrices are not supported.
180                     </warning>
181                 </td>
182             </tr>
183             <tr>
184                 <td>
185                     <emphasis role="bold">sparse</emphasis>
186                 </td>
187                 <td>
188                     <varname>object</varname> é uma matriz
189                     <link linkend="sparse">esparsa</link> de números
190                     reais ou complexos.
191                     <warning>Sparse numerical hypermatrices are not supported.</warning>
192                 </td>
193             </tr>
194             <tr>
195                 <td style="white-space:nowrap">
196                     <emphasis role="bold">"Matlab sparse"</emphasis>
197                 </td>
198                 <td>
199                     <varname>object</varname> is a Matlab-like-encoded sparse
200                     matrix (see <link linkend="mtlb_sparse">mtlb_sparse()</link>).
201                 </td>
202             </tr>
203             <tr>
204                 <td>
205                     <emphasis role="bold">fptr</emphasis>
206                 </td>
207                 <td>
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.
211                 </td>
212             </tr>
213             <tr>
214                 <td>
215                     <emphasis role="bold">function</emphasis>
216                 </td>
217                 <td>
218                     <varname>object</varname> is a <link linkend="function">function</link>
219                     (Scilab code). See also <link linkend="deff">deff</link>.
220                 </td>
221             </tr>
222             <tr>
223                 <td>
224                     <emphasis role="bold">library</emphasis>
225                 </td>
226                 <td>
227                     <varname>object</varname> is a
228                     <link linkend="library">library</link>
229                     of functions in Scilab language.
230                 </td>
231             </tr>
232             <tr>
233                 <td>
234                     <emphasis role="bold">pointer</emphasis>
235                 </td>
236                 <td>
237                     <varname>object</varname> é um ponteiro (ver
238                     <link linkend="lufact">lufact</link>).
239                 </td>
240             </tr>
241             <tr>
242                 <td>
243                     <emphasis role="bold">implicitlist</emphasis>
244                 </td>
245                 <td>
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>
250                 </td>
251             </tr>
252             <tr>
253                 <td>
254                     <emphasis role="bold">listdelete</emphasis>
255                 </td>
256                 <td>
257                     is returned by
258                     <function>
259                         typeof(<literal>null()</literal>)
260                     </function>
261                     .
262                     See  <link linkend="null">null()</link>.
263                 </td>
264             </tr>
265             <tr>
266                 <td>
267                     <emphasis role="bold">void</emphasis>
268                 </td>
269                 <td>is the typeof undefined elements in lists.
270                 </td>
271             </tr>
272             <tr>
273                 <td colspan="2"></td>
274             </tr>
275             <tr><td colspan="2">
276                     <emphasis role="bold italic">Typed T-Lists or M-Lists:</emphasis>
277                 </td>
278             </tr>
279             <tr><td colspan="2">
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.
285                 </td>
286             </tr>
287             <tr>
288                 <td colspan="2"></td>
289             </tr>
290             <tr><td colspan="2">
291                     <emphasis role="bold italic">Reserved T-List or M-List types
292                         predefined in Scilab:
293                     </emphasis>
294                 </td>
295             </tr>
296             <tr>
297                 <td>
298                     <emphasis role="bold">dir</emphasis>
299                 </td>
300                 <td>
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>.
305                 </td>
306             </tr>
307             <tr>
308                 <td>
309                     <emphasis role="bold">state-space</emphasis>
310                 </td>
311                 <td>
312                     <varname>object</varname> is a state-space model
313                     (see <link linkend="syslin">syslin</link>).
314                 </td>
315             </tr>
316             <tr>
317                 <td>
318                     <emphasis role="bold">program</emphasis>
319                 </td>
320                 <td>
321                     <varname>object</varname> is a list describing the internal code of a function
322                     (see <link linkend="macr2tree">macr2tree</link>).
323                 </td>
324             </tr>
325             <tr>
326                 <td>
327                     <emphasis role="bold">cblock</emphasis>
328                 </td>
329                 <td>
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>.
333                 </td>
334             </tr>
335             <tr>
336                 <td>
337                     <emphasis role="bold">XMLDoc</emphasis>
338                 </td>
339                 <td>
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.
346                 </td>
347             </tr>
348             <tr>
349                 <td>
350                     <emphasis role="bold">H5Object</emphasis>
351                 </td>
352                 <td>
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>.
357                 </td>
358             </tr>
359             <tr>
360                 <td>
361                     <emphasis role="bold">uitree</emphasis>
362                 </td>
363                 <td>
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>.
366                 </td>
367             </tr>
368             <tr>
369                 <td colspan="2">
370                   <emphasis role="bold italic">Reserved T-list types used in Xcos</emphasis> :
371                 </td>
372             </tr>
373             <tr>
374                 <td>
375                   <link linkend="scicos_block"><emphasis role="bold">Block</emphasis></link>
376                 </td>
377                 <td><varname>object</varname> is a Xcos block.
378               </td>
379             </tr>
380             <tr>
381               <td>
382                 <link linkend="scicos_cpr"><emphasis role="bold">cpr</emphasis></link>
383               </td>
384               <td>
385                 <varname>object</varname> is a tlist containing the compilation results of a Xcos diagram.
386               </td>
387             </tr>
388             <tr>
389               <td>
390                 <link linkend="scicos_diagram"><emphasis role="bold">diagram</emphasis></link>
391               </td>
392               <td>
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.
395               </td>
396             </tr>
397             <tr>
398               <td>
399                 <link linkend="scicos_graphics"><emphasis role="bold">graphics</emphasis></link>
400               </td>
401               <td>
402                 <varname>object</varname> is a tlist assigned to the <literal>.graphics</literal>
403                 field of a block.
404               </td>
405             </tr>
406             <tr>
407               <td>
408                 <link linkend="scicos_link"><emphasis role="bold">Link</emphasis></link>
409               </td>
410               <td>
411                 <varname>object</varname> is a tlist defining and configuring a link between 2 blocks.
412               </td>
413             </tr>
414             <tr>
415               <td>
416                 <link linkend="scicos_model"><emphasis role="bold">model</emphasis></link>
417               </td>
418               <td>
419                 <varname>object</varname> is a tlist assigned to the <literal>.model</literal> field
420                 of a block.
421               </td>
422             </tr>
423             <tr>
424               <td>
425                 <link linkend="scicos_params"><emphasis role="bold">params</emphasis></link>
426               </td>
427               <td>
428                 <varname>object</varname> is a tlist containing some configuration parameters of a
429                 Xcos diagram.
430               </td>
431             </tr>
432             <tr>
433               <td>
434                 <emphasis role="bold">scsopt</emphasis>
435               </td>
436               <td>
437                 <varname>object</varname> is a tlist containing the graphical options of the Xcos
438                 diagram editor.
439               </td>
440             </tr>
441             <tr>
442               <td>
443                 <link linkend="scicos_sim"><emphasis role="bold">scs</emphasis></link>
444               </td>
445               <td>
446                 <varname>object</varname> is a tlist containing static results of the compilation of
447                 a Xcos diagram.
448               </td>
449             </tr>
450             <tr>
451               <td>
452                 <link linkend="scicos_state"><emphasis role="bold">xcs</emphasis></link>
453               </td>
454               <td>
455                 <varname>object</varname> is a tlist containing dynamical results during a Xcos
456                 simulation.
457               </td>
458             </tr>
459             <tr>
460               <td>
461                 <emphasis role="bold">Text</emphasis>
462               </td>
463               <td>
464                 <varname>object</varname> is a tlist defining a text label in a Xcos diagram.
465               </td>
466             </tr>
467         </table>
468     </refsection>
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"    "オブジェクトの型"
476     ]
477 typeof(t)
478
479 // Booleans
480 typeof(%t)
481 typeof("abc"=="def")
482 hm = grand(2,2,2,"uin",0,9)<5
483 typeof(hm)
484
485 // Encoded integers
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))
490 ]
491
492 // Decimal numbers
493 n = 1:0.3:2
494 typeof(n)
495 hm = grand(2,2,2,"uin",0,9)
496 typeof(hm)
497
498 // Decimal integers
499 n = 1:7
500 typeof(n)
501
502 // Complex numbers
503 n = [%i 1-%i %pi - 3*%i]
504 typeof(n)
505
506 // Special "constant"
507 typeof([])   // empty matrix
508
509 // Polynomials
510 n = [ %z (1-%z)^2]
511 typeof(n)
512 n = [ 3*%i + %z (1-%i*%z)^2]
513 typeof(n)
514
515 // Rational fractions
516 r = [%s/(1-%s) (1+%s)^2/(1-%s)]   // with real coefficients
517 typeof(r)
518 r = [%s/(%i-%s) (%i+%s)^2/(1-%s)] // with complex coefficients
519 typeof(r)
520
521 // Sparse matrices
522 // ---------------
523 w = sprand(100,100,0.001)
524 typeof(w)     // sparse
525 typeof(w==w)  // boolean sparse
526 //x = mtlb_sparse(sprand(10,10,0.1));
527 //typeof(x)
528
529 // Functions and libraries
530 // -----------------------
531 deff('y=f(x)','y=2*x');  // Function in Scilab language
532 f(%pi)
533 typeof(f)
534 typeof(cosd)  // written in Scilab
535
536 typeof(corelib) // Library of functions in Scilab language
537
538 typeof(sin)     // Built-in function (non-editable)
539 mysin = sin;
540 mysin(%pi/2)
541
542 // Graphical handles
543 // -----------------
544 clf
545 plot2d()
546 typeof(gcf())
547 // The subtype of the handle is in the "type" property:
548 gcf().type
549 gca().type
550 gce().type
551
552 close(gcf())
553
554 // Containers
555 // ----------
556 // Simple list
557 L = list(%pi, %t, %z, %s/(1-%s), "Bonjour", sin, cosd, list("list_in_list", 432));
558 typeof(L)
559
560 // Cells array
561 C = {%pi, %t, %z ; %s/(1-%s), "Bonjour", list("list_in_list", 432) }
562 typeof(C)
563
564 // (Array of) Structure
565 S.num = %pi;
566 S.b = %t;
567 S(2).t = "Bonjour"
568 typeof(S)
569
570 // Special generic indexing expressions
571 // ------------------------------------
572 typeof($)
573 typeof(:)    // "eye()" equivalent (all elements)
574 typeof(3:$)
575
576 // Typeof for deletion or undefined elements:
577 // -----------------------------------------
578 typeof([])      // empty matrix
579 typeof(null())
580 L = list(%pi, ,"hey!")
581 typeof(L(2))   // undefined element
582
583 // Customized typeof of T-Lists:
584 // ----------------------------
585 L = tlist(['myLongTypeOf','a','b'], 18, 'Scilab');
586 typeof(L)
587
588 // Reserved T-List typeof
589 // ----------------------
590 typeof(dir())        // Files directory
591 //
592 c = macr2tree(sind); // Internal code of a Scilab macro
593 typeof(c)
594 fieldnames(c)'
595 c.name
596 //
597 doc = xmlReadStr("<root><a att=""foo"">Hello</a></root>");
598 typeof(doc)
599 xmlDelete(doc)
600 //
601 x = 1;
602 save(TMPDIR + "/x.sod", "x"); // SOD files are HDF5 ones
603 a = h5open(TMPDIR + "/x.sod");
604 typeof(a)
605 h5close(a)
606  ]]></programlisting>
607     </refsection>
608     <refsection role="see also">
609         <title>Ver Também</title>
610         <simplelist type="inline">
611             <member>
612                 <link linkend="type">type</link>
613             </member>
614             <member>
615                 <link linkend="inttype">inttype</link>
616             </member>
617             <member>
618                 <link linkend="overloading">overloading</link>
619             </member>
620             <member>
621                 <link linkend="isreal">isreal</link>
622             </member>
623             <member>
624                 <link linkend="strings">strings</link>
625             </member>
626             <member>
627                 <link linkend="poly">poly</link>
628             </member>
629             <member>
630                 <link linkend="rlist">rlist</link>
631             </member>
632             <member>
633                 <link linkend="null">null</link>
634             </member>
635             <member>
636                 <link linkend="sparse">sparse</link>
637             </member>
638             <member>
639                 <link linkend="issparse">issparse</link>
640             </member>
641             <member>
642                 <link linkend="mtlb_sparse">mtlb_sparse</link>
643             </member>
644             <member>
645                 <link linkend="syslin">syslin</link>
646             </member>
647             <member>
648                 <link linkend="dir">dir</link>
649             </member>
650             <member>
651                 <link linkend="XMLObjects">XML Objects</link>
652             </member>
653             <member>
654                 <link linkend="h5objects">HDF5 Objects</link>
655             </member>
656         </simplelist>
657     </refsection>
658     <refsection role="history">
659         <title>Histórico</title>
660         <revhistory>
661             <revision>
662                 <revnumber>6.0</revnumber>
663                 <revdescription>
664                     <itemizedlist>
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
668                             natively supported.
669                         </listitem>
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.
673                         </listitem>
674                         <listitem>The typeof of T-lists and M-lists were limited to 8 characters.
675                           They may be longer now.
676                         </listitem>
677                         <listitem>
678                             typeof "size implicit" renamed "implicitlist" (<literal>1:$</literal>)
679                         </listitem>
680                         <listitem>Help page reviewed.</listitem>
681                     </itemizedlist>
682                 </revdescription>
683             </revision>
684         </revhistory>
685     </refsection>
686 </refentry>