7feb6a6f3ba29bce0e8231d631666aec0f58c13e
[scilab.git] / scilab / modules / functions / help / en_US / macro.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  *
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at
10  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11  *
12  -->
13 <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="macro">
14     <refnamediv>
15         <refname>macro</refname>
16         <refpurpose>Scilab procedure and Scilab object</refpurpose>
17     </refnamediv>
18     <refsection>
19         <title>Description</title>
20         <para>
21             Macros are Scilab procedures ("macro", "function" and "procedure"
22             have the save meaning). Usually, they are defined 
23             in files with an editor and loaded into Scilab by <literal>exec</literal> or through
24             a library.
25         </para>
26         <para>
27             They can also be defined on-line (see <literal>deff</literal>). 
28             A file which contains a macro must begin as follows:
29         </para>
30         <programlisting><![CDATA[ 
31 function [y1,...,yn]=foo(x1,...,xm)
32  ]]></programlisting>
33         <para>
34             The <literal>yi</literal> are output variables calculated as functions of
35             input variables and variables existing in Scilab
36             when the macro is executed.
37             A macro can be compiled for faster execution. Collections
38             of macros can be collected in libraries.
39             Macros which begin with <literal>%</literal> sign (e.g. <literal>%foo</literal>) and whose
40             arguments are lists are used to perform specific 
41             operations: for example, <literal>z=%rmr(x,y)</literal> is equivalent
42             to <literal>z=x*y</literal> when <literal>x</literal> and <literal>z</literal> are rationals 
43             (i.e. <literal>x=list('r',n,d,[])</literal> with <literal>n</literal> and <literal>d</literal> polynomials).
44         </para>
45     </refsection>
46     <refsection role="see also">
47         <title>See Also</title>
48         <simplelist type="inline">
49             <member>
50                 <link linkend="deff">deff</link>
51             </member>
52             <member>
53                 <link linkend="exec">exec</link>
54             </member>
55             <member>
56                 <link linkend="comp">comp</link>
57             </member>
58             <member>
59                 <link linkend="lib">lib</link>
60             </member>
61         </simplelist>
62     </refsection>
63 </refentry>