help: scilab|scilex page fixed & improved
[scilab.git] / scilab / modules / core / help / en_US / scilab.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
3           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
4           xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
5           xmlns:scilab="http://www.scilab.org" xml:id="scilab" xml:lang="en">
6     <refnamediv xml:id="wscilex">
7     </refnamediv>
8     <refnamediv xml:id="scilex">
9     </refnamediv>
10     <refnamediv>
11         <refname>scilex | scilab</refname>
12         <refpurpose>runs Scilab in interactive or batch mode with command line options
13         </refpurpose>
14     </refnamediv>
15     <refsynopsisdiv>
16         <title>Syntax</title>
17         <synopsis>
18 #      MS Windows          |  # Linux / Unix / Mac OS X
19 wscilex     &lt;Options&gt;     |  scilab         &lt;Options&gt;
20 wscilex -nw &lt;Options&gt; |  scilab-adv-cli &lt;Options&gt;
21 scilex      &lt;Options&gt;      |  scilab-cli     &lt;Options&gt;
22         </synopsis>
23     </refsynopsisdiv>
24     <refsection role="arguments">
25         <title>Options</title>
26         <variablelist>
27             <varlistentry>
28                 <term>-args arg#1 arg#2 ..</term>
29                 <listitem>
30                     <para>
31                         This option allows to send some data to the Scilab session:
32                         <itemizedlist>
33                             <listitem>Consecutive data are separated by one or several spaces.
34                             </listitem>
35                             <listitem>An expression between double-quotes is a single data.
36                             </listitem>
37                             <listitem>To include a double-quote in a data, write <literal>\"</literal> instead of <literal>"</literal>.
38                             </listitem>
39                             <listitem>The single quote <literal>'</literal> is a regular character. It has no special meaning.
40                             </listitem>
41                         </itemizedlist>
42                     </para>
43                     <para>
44                       Inside the opened session, these data can be retrieved as separated strings with <link linkend="sciargs">sciargs()</link>.
45                      </para>
46                      <para>
47                       Example:
48                         <screen><![CDATA[C:\Users\Me> scilex -nb -args "Hello \"%USERNAME%\"" 1.2345 \"%cd%\"]]></screen>
49                         <programlisting><![CDATA[
50 // Inside the opened session:
51 a = sciargs()
52 i = find(a=="-args")
53 a(i+1)
54 evstr(a(i+2))*2
55 "This session has been launched from " + a(i+3)
56                         ]]>
57                         </programlisting>
58                         <screen><![CDATA[
59 --> // Inside the opened session:
60 --> a = sciargs()
61  a  =
62 !c:\SCIdir\bin\scilex  -nw  -nb  -noatomsautoload  -args  Hello "John"  1.2345  "C:\Users\Me" !
63
64 --> i = find(a=="-args")
65  i  =
66     5.
67
68 --> a(i+1)
69  ans  =
70  Hello "John"
71
72 --> evstr(a(i+2))*2
73  ans  =
74     2.469
75
76 --> "This session has been launched from " + a(i+3)
77  ans  =
78  This session has been launched from "C:\Users\Me"
79
80 -->
81 ]]></screen>
82                      </para>
83                      <para>
84                      <note>Using <literal>-args</literal> as the <emphasis role="italic">last</emphasis> command line option is safer.
85                      </note>
86                      </para>
87                 </listitem>
88             </varlistentry>
89             <varlistentry>
90                 <term>-display Display</term>
91                 <listitem>
92                     <para>
93                         For use under Xwindow systems only to set a specific X server
94                         display. Default display is unix:0.0.
95                     </para>
96                     <para>
97                         <literal>-display</literal> can be abbreviated by
98                         <literal>-d</literal>.
99                     </para>
100                 </listitem>
101             </varlistentry>
102             <varlistentry>
103                 <term>-e Instructions</term>
104                 <listitem>
105                     <para>
106                         At the end of the whole session startup, this option
107                         <itemizedlist>
108                             <listitem>
109                                 <para>sets the current working directory to the shell directory from which Scilab has been launched. Please see the example given here-below for the <literal>-f</literal> option. Then,
110                                 </para>
111                             </listitem>
112                             <listitem>
113                                 <para>executes Scilab <literal>Instructions</literal> provided in a string. Example:
114                                     <screen><![CDATA[ scilab-cli -e  "disp(\"Hello\"); a=%pi+%i; disp(exp(a)); exit;" -nb]]></screen>
115                                 </para>
116                             </listitem>
117                         </itemizedlist>
118                     </para>
119                     <warning>
120                         <literal>-e</literal> and <literal>-f</literal> options can't be used together.
121                     </warning>
122                 </listitem>
123             </varlistentry>
124             <varlistentry>
125                 <term>-f file</term>
126                 <listitem>
127                     <para>
128                         If this option is used, then at the beginning of the Scilab session, after the execution of the scilab and user startup files, and after the setting of user Preferences -- including the working directory ones --,
129                         <itemizedlist>
130                             <listitem>
131                                 <para>
132                                     the current Scilab working directory is set to the shell directory from which Scilab has been launched. For instance,
133                                     <screen><![CDATA[ D:\users\me\scilab\dev> C:\scilab-5.5.2\bin\scilex -f ..\test.sce]]></screen>
134                                     will do a <literal>cd("D:\users\me\scilab\dev")</literal>.
135                                 </para>
136                             </listitem>
137                             <listitem>
138                                 <para>
139                                     the Scilab script <literal>file</literal> is executed. If a relative path is used (default <literal>.\</literal>, or like <literal>..\</literal> in the sample here-above), it refers to the new Scilab working directory.
140                                 </para>
141                             </listitem>
142                         </itemizedlist>
143                     </para>
144                     <para>
145                         A file with .xcos extension will be opened by Xcos.
146                     </para>
147                 </listitem>
148             </varlistentry>
149             <varlistentry>
150                 <term>-quit</term>
151                 <listitem>
152                     <para>
153                         This option forces scilab to always exit after the instruction(s) passed with the <literal>-e</literal>
154                         option, or the script referred to by the <literal>-f</literal> option, have been executed,
155                         even in case of a runtime error. This option should always be used in batch mode.
156                         It is ignored if neither <literal>-e</literal> nor <literal>-f</literal> options are present.
157                     </para>
158                 </listitem>
159             </varlistentry>
160             <varlistentry>
161                 <term>-l lang</term>
162                 <listitem>
163                     <para>If this option is present it fixes the user language.
164                         <emphasis>lang</emphasis> can be: <emphasis>ca_ES de_DE en_US es_ES
165                             fr_FR ja_JP pt_BR ru_RU zh_CN zh_TW
166                         </emphasis> (from Scilab 5.2).
167                     </para>
168                     <para>
169                         Other possible <literal>lang</literal> values are
170                         <literal>'fr'</literal> for french and <literal>'en'</literal> for
171                         English for compatibility reasons. The default language is English.
172                         This default value is fixed the <literal>scilab.start</literal> file.
173                     </para>
174                     <para>On some systems, locales must be compiled to render correctly
175                         UTF-8 fonts.
176                     </para>
177                     <para>Scilab can be also called the following way:</para>
178                     <screen><![CDATA[ LANG=ja_JP scilab
179  # equivalent to
180  scilab -l ja_JP
181 ]]></screen>
182                 </listitem>
183             </varlistentry>
184             <varlistentry>
185                 <term>-nb</term>
186                 <listitem>
187                     <para>"no banner": Cancels the display of the Scilab's loading message.
188                     </para>
189                 </listitem>
190             </varlistentry>
191             <varlistentry>
192                 <term>-ns</term>
193                 <listitem>
194                     <para>"No Startup files": Cancels the execution of the main startup file
195                         <literal>SCI/etc/scilab.start</literal> and of the user startup files
196                         <literal>SCIHOME/.scilab</literal>,
197                         <literal>SCIHOME/scilab.ini</literal>.
198                     </para>
199                     <para>This option will disable many features in Scilab (Only use if
200                         you know what you are doing).
201                     </para>
202                 </listitem>
203             </varlistentry>
204             <varlistentry>
205                 <term>-nouserstartup</term>
206                 <listitem>
207                     <para>Cancels the execution of the user startup files
208                         <literal>SCIHOME/.scilab</literal> and
209                         <literal>SCIHOME/scilab.ini</literal>.
210                     </para>
211                 </listitem>
212             </varlistentry>
213             <varlistentry>
214                 <term>-noatomsautoload</term>
215                 <listitem>
216                     <para>Cancels the autoloading of installed ATOMS modules at startup.</para>
217                 </listitem>
218             </varlistentry>
219             <varlistentry>
220                 <term>-nw</term>
221                 <listitem>
222                     <para>If this option is present, Scilab is started as command line
223                         with advanced features still available (graphics, export, xcos, scinotes, help browser, ...).
224                     </para>
225                     <para>From Scilab 5.2:</para>
226                     <itemizedlist>
227                         <listitem>
228                             <para>pipes are enabled for all operating systems (see the
229                                 examples for further details).
230                             </para>
231                         </listitem>
232                         <listitem>
233                             <para>Scilab distribution also provides a dedicated binary which
234                                 is doing the same as <literal>-nw</literal>:
235                                 <literal>scilab-adv-cli</literal> (Scilab Advanced Command Line Interpreter).
236                             </para>
237                         </listitem>
238                     </itemizedlist>
239                 </listitem>
240             </varlistentry>
241             <varlistentry>
242                 <term>-nwni / -nogui</term>
243                 <listitem>
244                     <important>
245                         This mode prevents loading the Java Virtual Machine.
246                         It starts faster and uses less memory.
247                     </important>
248                     <para>If this option is present, Scilab is started as command line
249                         without advanced features (graphics, export, xcos, scinotes,
250                         help browser, Java module,...).
251                     </para>
252                     <para>Since Scilab 5.2:</para>
253                     <itemizedlist>
254                         <listitem>
255                             <para>pipes are enabled for all operating systems (see the
256                                 examples for further details).
257                             </para>
258                         </listitem>
259                     </itemizedlist>
260                     <itemizedlist>
261                         <listitem>
262                             <para>Scilab distribution also provides a dedicated binary which
263                                 is doing the same as <literal>-nwni</literal>:
264                                 <literal>scilab-cli</literal> (Scilab Command Line Interpreter).
265                             </para>
266                         </listitem>
267                     </itemizedlist>
268                 </listitem>
269             </varlistentry>
270             <varlistentry>
271                 <term>--texmacs</term>
272                 <listitem>
273                     <para>This option is reserved for the external TeXMacs module.
274                         This one can be priorly installed with <code>atomsInstall('texmacs')</code>.
275                     </para>
276                 </listitem>
277             </varlistentry>
278             <varlistentry>
279                 <term>-version</term>
280                 <listitem>
281                     <para>displays the Scilab's version (before the main Scilab's startup).</para>
282                 </listitem>
283             </varlistentry>
284         </variablelist>
285     </refsection>
286     <refsection role="arguments">
287         <title>Additional options for Unix/Linux and Mac OS X</title>
288         <para>Advice: use theses options on a Scilab source tree.</para>
289         <variablelist>
290             <varlistentry>
291                 <term>-debug</term>
292                 <listitem>
293                     <para>Start Scilab under the debugger gdb.</para>
294                     <para>
295                         The variable <literal>SCILAB_GDB_OPT</literal> may be set to add custom options to gdb.
296                     </para>
297                 </listitem>
298             </varlistentry>
299             <varlistentry>
300                 <term>-debug-kdbg</term>
301                 <listitem>
302                     <para>Start Scilab under kdbg.</para>
303                 </listitem>
304             </varlistentry>
305             <varlistentry>
306                 <term>-profiling</term>
307                 <listitem>
308                     <para>Start Scilab under valgrind.</para>
309                     <para>The variable SCILAB_VALGRIND_OPT may be set to add custom options
310                         to valgrind (and override the existing valgrind options).
311                     </para>
312                 </listitem>
313             </varlistentry>
314             <varlistentry>
315                 <term>-profiling-visu</term>
316                 <listitem>
317                     <para>Start Scilab under callgrind.</para>
318                     <para>The variable SCILAB_VALGRIND_OPT may be set to add custom options
319                         to callgrind (and override the existing callgrind options).
320                     </para>
321                 </listitem>
322             </varlistentry>
323             <varlistentry>
324                 <term>-electric-fence</term>
325                 <listitem>
326                     <para>Start Scilab with the Electric Fence.</para>
327                 </listitem>
328             </varlistentry>
329         </variablelist>
330     </refsection>
331     <refsection role="description">
332         <title>Environment variables</title>
333         <variablelist>
334             <varlistentry>
335                 <term>SCIVERBOSE</term>
336                 <listitem>
337                     <para>
338                         If this variable is present, Scilab startup script will show a startup debug information.
339                         Mainly used for bug report and debugging purposes.
340                     </para>
341                 </listitem>
342             </varlistentry>
343             <varlistentry>
344                 <term>JAVA_HOME</term>
345                 <listitem>
346                     <para>
347                         Specify which Java to use. For example,
348                         <literal>JAVA_HOME=/usr/lib/jvm/java-7-openjdk/ scilab</literal> will start Scilab with Java 7.
349                     </para>
350                 </listitem>
351             </varlistentry>
352             <varlistentry>
353                 <term>SCI_DISABLE_TK</term>
354                 <listitem>
355                     <para>Disable Tk (but not Tcl) features.</para>
356                 </listitem>
357             </varlistentry>
358             <varlistentry>
359                 <term>SCI_JAVA_ENABLE_HEADLESS</term>
360                 <listitem>
361                     <para>
362                         Enable Java Headless VM (i.e. without GUI features).
363                     </para>
364                 </listitem>
365             </varlistentry>
366         </variablelist>
367     </refsection>
368     <refsection role="description">
369         <title>Java Virtual Machine options</title>
370         <warning>
371             The options described here-below are useless and are cancelled if the option <literal>-nwni</literal> is used.
372         </warning>
373         <para>Starting from Scilab 5.0, the graphical user interface (GUI) and the
374             build documentation are based on Java features. In some cases, it can be
375             important to edit the JVM options (Java Virtual Machine).
376         </para>
377         <para>These options are available in the
378             <emphasis>jvm_options.xml</emphasis> file.
379         </para>
380         <para>In version 5.0.X and 5.1.X, this file is stored as
381             <emphasis>SCI/modules/jvm/etc/jvm_options.xml</emphasis>.
382         </para>
383         <para>In version &gt;= 5.2.0, the file is available in
384             <emphasis>etc/jvm_options.xml</emphasis>.
385         </para>
386         <para>
387             <emphasis>
388                 By default, the three following options are
389                 easily accessible in the configuration file:
390             </emphasis>
391         </para>
392         <variablelist>
393             <varlistentry>
394                 <term>-XmxXXXm</term>
395                 <listitem>
396                     <para>This option set the amount of memory available by the Java
397                         Virtual Machine. By default, 256M are allocated. If you change this
398                         value, check that the value does not exceed the memory available on
399                         the system.
400                     </para>
401                     <para>Since Scilab 5.4.0, this value can be changed in the preferences menu.</para>
402                 </listitem>
403             </varlistentry>
404             <varlistentry>
405                 <term>-Djava.compiler=JIT</term>
406                 <listitem>
407                     <para>
408                         This option with the argument <emphasis>JIT</emphasis> enables
409                         the Java Just In Time compiler. It is activated by default.
410                         <emphasis>NONE</emphasis> disables the JIT and decreases
411                         dramatically performances.
412                     </para>
413                 </listitem>
414             </varlistentry>
415             <varlistentry>
416                 <term>-verbose:jni / -Xcheck:jni</term>
417                 <listitem>
418                     <para>These options enable more checks and output from the JNI
419                         calls. These options are useful in case of debugging and are
420                         disabled by default since they decreases performances.
421                     </para>
422                 </listitem>
423             </varlistentry>
424         </variablelist>
425         <para>Many more options are available. They can improve the performances,
426             change look and feel, change memory managements... See: <ulink url="http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html">http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html</ulink>.
427         </para>
428     </refsection>
429     <refsection role="examples">
430         <title>Examples</title>
431         <screen><![CDATA[
432 # Let's start Scilab in profiling mode without attaching a gdb once a SIGSEGV is met.
433 # We are under Bash shell
434 export SCILAB_VALGRIND_OPT="--db-attach=no --log-file=myfile.txt"
435 scilab -profiling
436
437 # Let's start Scilab in debug mode without stopping after each SIGSEGV
438 # First, we write a small command file
439 echo "handle SIGSEGV nostop" &> debug.txt
440 # Now set the custom option
441 # We are under Bash shell
442 export SCILAB_GDB_OPT="--command=debug.txt"
443 # Start Scilab in debug mode
444 scilab -debug ]]></screen>
445         <para></para>
446         <screen><![CDATA[
447 # Under GNU/Linux, Mac OS X or Unix:
448 $ echo "disp(%pi)"|scilab-cli
449 or
450 $ echo "disp(%pi)"|scilab -nwni
451
452 # Only open the Scilab help window:
453 $ scilab-adv-cli -e "help()"
454 or
455 $ scilab -nw -e "help()"
456
457
458 # Scilab can be used for scripting aspects:
459 echo "if 1<>2 then exit(99) end"|scilab-cli
460 echo $? ]]></screen>
461     </refsection>
462     <refsection role="see also">
463         <title>See also</title>
464         <simplelist type="inline">
465             <member>
466                 <link linkend="startup">startup</link>
467             </member>
468             <member>
469                 <link linkend="sciargs">sciargs</link>
470             </member>
471             <member>
472                 <link linkend="getpid">getpid</link>
473             </member>
474             <member>
475                 <link linkend="getenv">getenv</link>
476             </member>
477             <member>
478                 <link linkend="getenv">getversion</link>
479             </member>
480             <member>
481                 <link linkend="consolebox">consolebox</link>
482             </member>
483             <member>
484                 <link linkend="exit">exit</link>
485             </member>
486         </simplelist>
487     </refsection>
488     <refsection role="history">
489         <title>History</title>
490         <revhistory>
491             <revision>
492                 <revnumber>5.4.0</revnumber>
493                 <revremark>-noatomsautoload added.</revremark>
494             </revision>
495             <revision>
496                 <revnumber>5.4.1</revnumber>
497                 <revremark>scinotes and xcos individual scripts introduced. See SEP #87.</revremark>
498             </revision>
499             <revision>
500                 <revnumber>6.0.0</revnumber>
501                 <revremark>
502                     <literal>-quit</literal> option added. <literal>-mem</literal> option removed.
503                 </revremark>
504             </revision>
505         </revhistory>
506     </refsection>
507 </refentry>