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
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
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">
15 <refname>macro</refname>
16 <refpurpose>Scilab procedure and Scilab object</refpurpose>
19 <title>Description</title>
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 <function>exec</function> or through
27 They can also be defined on-line (see <link linkend="deff">deff</link>).
28 A file which contains a macro must begin as follows:
30 <programlisting role='no-scilab-exec'><![CDATA[
31 function [y1,...,yn]=foo(x1,...,xm)
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, <code>z=%rmr(x,y)</code> is equivalent
42 to <code>z=x*y</code> when <varname>x</varname> and <varname>z</varname> are rationals
43 (i.e. <code>x=list('r',n,d,[])</code> with <varname>n</varname> and <varname>d</varname> polynomials).
46 <refsection role="see also">
47 <title>See Also</title>
48 <simplelist type="inline">
50 <link linkend="deff">deff</link>
53 <link linkend="exec">exec</link>
56 <link linkend="comp">comp</link>
59 <link linkend="lib">lib</link>