1
1
<?xml version="1.0" encoding="UTF-8"?>
2
2
<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" version="5.0-subset Scilab" xml:lang="en" xml:id="exec">
4
<refname>exec</refname>
5
<refpurpose> script file execution</refpurpose>
8
<title>Calling Sequence</title>
9
<synopsis>exec(path [,mode])
11
ierr=exec(path,'errcatch' [,mode])
12
ierr=exec(fun,'errcatch' [,mode])
16
<title>Arguments</title>
21
<para>a string, the path of the script file</para>
27
<para>an integer scalar, the execution mode (see below)</para>
33
<para>a scilab function</para>
39
<para>integer, 0 or error number</para>
45
<title>Description</title>
47
<literal>exec(path [,mode])</literal> executes sequentialy the scilab instructions
48
contained in the file given by <literal>path</literal> with an optional
49
execution mode <literal>mode</literal> .
52
The different cases for <literal>mode</literal> are :
64
: echo of each command line
68
: prompt <literal>--></literal> is printed
76
: stops before each prompt. Execution resumes after a carriage return.
80
: stops + prompts + echoes : useful mode for demos.
83
<literal>exec(fun [,mode])</literal> executes function <literal>fun</literal> as a script: no
84
input nor output argument nor specific variable environment. This form
85
is more efficient, because script code may be pre-compiled (see comp). This method for script evaluation allows to store scripts as
86
function in libraries.
89
If an error is encountered while executing, if 'errcatch' flag is
90
present <literal>exec</literal> issues no error message, aborts execution of the
91
instructions and resumes with <literal>ierr</literal> equal to the error
92
number. If 'errcatch' flag is not present, standard error handling
97
<title>Remarks</title>
99
<literal>exec</literal> files may now be used to define functions using the inline function definition syntax (see function).
102
<literal>exec</literal> supports files encoded as ANSI/ASCII and UTF-8.
104
<para>length of each line in a file is limited to 4096 characters.</para>
107
<title>Examples</title>
108
<programlisting role="example"><![CDATA[
4
<refname>exec</refname>
5
<refpurpose> script file execution</refpurpose>
8
<title>Calling Sequence</title>
9
<synopsis>exec(path [,mode])
11
ierr=exec(path,'errcatch' [,mode])
12
ierr=exec(fun,'errcatch' [,mode])
16
<title>Arguments</title>
21
<para>a string, the path of the script file</para>
27
<para>an integer scalar, the execution mode (see below)</para>
33
<para>a scilab function</para>
39
<para>integer, 0 or error number</para>
45
<title>Description</title>
47
<literal>exec(path [,mode])</literal> executes sequentialy the scilab instructions
48
contained in the file given by <literal>path</literal> with an optional
49
execution mode <literal>mode</literal> .
52
The different cases for <literal>mode</literal> are :
64
: echo of each command line
68
: prompt <literal>--></literal> is printed
76
: stops before each prompt. Execution resumes after a carriage return.
80
: stops + prompts + echoes : useful mode for demos.
83
<literal>exec(fun [,mode])</literal> executes function <literal>fun</literal> as a script: no
84
input nor output argument nor specific variable environment. This form
85
is more efficient, because script code may be pre-compiled (see comp). This method for script evaluation allows to store scripts as
86
function in libraries.
89
If an error is encountered while executing, if 'errcatch' flag is
90
present <literal>exec</literal> issues no error message, aborts execution of the
91
instructions and resumes with <literal>ierr</literal> equal to the error
92
number. If 'errcatch' flag is not present, standard error handling
97
<title>Remarks</title>
99
<literal>exec</literal> files may now be used to define functions using the inline function definition syntax (see function).
102
<literal>exec</literal> supports files encoded as ANSI/ASCII and UTF-8.
104
<para>length of each line in a file is limited to 4096 characters.</para>
107
<title>Examples</title>
108
<programlisting role="example"><![CDATA[
109
109
// create a script file
110
110
mputl('a=1;b=2',TMPDIR+'/myscript')
128
128
// a and y are created in the current environment
130
130
]]></programlisting>
132
<refsection role="see also">
133
<title>See Also</title>
134
<simplelist type="inline">
136
<link linkend="execstr">execstr</link>
139
<link linkend="evstr">evstr</link>
142
<link linkend="comp">comp</link>
145
<link linkend="mode">mode</link>
148
<link linkend="chdir">chdir</link>
151
<link linkend="pwd">pwd</link>
132
<refsection role="see also">
133
<title>See Also</title>
134
<simplelist type="inline">
136
<link linkend="execstr">execstr</link>
139
<link linkend="evstr">evstr</link>
142
<link linkend="comp">comp</link>
145
<link linkend="mode">mode</link>
148
<link linkend="chdir">chdir</link>
151
<link linkend="pwd">pwd</link>