Mavscript start parameters


The call java -jar mavscript*.jar --help displays a list of the available start parameters. This output is shown below.


            Welcome to Mavscript
            Copyright (c) A. Vontobel, 2004-2016
            Version 2.0

Usage:
java -jar mavscript*.jar [OPTIONS] [-A] [-D ControlChar] 
                         [-y | -b | -j | -p Port [-s Server]] 
                         [-z Name_in_ZIP] [-i InitFile] 
                         [-o OutputFile]  
                         [TemplateFile] 

-v, --verbose               Verbose output
-q, --quiet                 No messages to stdout
-l, --language              Language (i.e. en)
-h, --help                  Usage information; this help screen
-V, --version               Display version
-y, --yacas                 Yacas algebra (Standard)
-b, --beanshell             BeanShell java interpreter
-j, --jasymca               Jasymca (Octave mode)
-p, --port Port             Port (i.e. 9734)
-s, --server Server         Server name (default: 127.0.0.1)
-z, --name_in_zip Name      File name within ZIP
-i  --init InitFile         First processes the commands of this file.
-H, --HTML                  Accepts HTML special characters (like >)
-L, --leavetags             Does not remove xml tags in office files.
-A, --ascii                 Converts unicode chars to a ascii representation.
-C, --charset Encoding      Charset name (default: UTF-8)
                            examples: ISO-8859-1, system 
-D, --controlchar §-repl.   Sets the control character(s) (default: §). 
-x, --extract               Writes the commands to the OutputFile. 
                            No calculation is done. 
-o  --outfile OutputFile    OutputFile name (default: out-InputFileName)
                            Output to stdout: - 
TemplateFile                TemplateFile. If omitted reads from stdin.

OpenOffice-Writer files (suffix .odt) are detected automatically.
The option "-H -z content.xml" therefore can be omitted.
The standard engine is the computer-algebra-system Yacas. The java-
interpreter BeanShell or Jasymca may be used instead. The last option is
to connect to a port (on localhost or on a remote server).

Examples:
java -jar mavscript*.jar template.txt    Writes the file out-template.txt
java -jar mavscript*.jar template.odt    Writes the file out-template.odt
java -jar mavscript*.jar -D$ oldTemplate.txt
java -jar mavscript*.jar --init StdFunctions.ys template.odt
java -jar mavscript*.jar -o result.odt template.odt


Instead of typing java -jar mavscript*.jar (the * stands for the version number) you can type mavscript (Windows) resp. ./mavscript (Linux, Mac). Example: mavscript --help .

Below the parameters are explained in detail.

--verbose, -v

Makes the program verbose: While mavscript is running, information is displayed telling what the program is actually doing. In particular each math command read from the input file is shown. Immediately after the command, the answer coming from the computer-algebra-system is shown. This mode is useful when the input file in not processed as expected.

--quiet, -q

If this option is called, Mavscript will not write messages to standard output (stdout). The option is selected automatically if the result will be written to stdout.

-- language, -l

Example: --language en

--yacas, -y

If this option is called, Mavscript will use the built-in Computer-Algebra-System Yacas. This is the default behaviour.

--beanshell, -b

If this option is called, Mavscript will use the built-in java interpreter BeanShell.

--jasymca, -j

If this option is called, Mavscript will use the built-in Computer-Algebra-System Jasymca (Octave mode).

--port, -p

Example: --port 9734

If this option is called, Mavscript will use an external application to evaluate the mathematical expression. The connection between mavscript and the computer-algebra-system is done using a port, similar to a connection to the internet. Mavscript sends the commands as text and receives the answers as text.
Both programs must use the same port number. The external application (on localhost or on a remote computer) must listen to the port when you run Mavscript.
Example: Start the C-Version of Yacas using the command yacas --server 9734 , then run mavscript --port 9734 ./vorlage.txt

--server, -s

Example: --server localhost
If not specified: --server 127.0.0.1

The computer-algebra-system does not need to run on the local computer. Mavscript can connect to the server (the algebra program) on a remote computer using its internet address.

--name_in_zip, -z

Example: --name_in_zip content.xml

Mavscript can process input files that are packed (and compressed) in a zip-archive. The archive may contain more than one file, therefore the name of the input file within the archive must be specified. Mavscript then creates a new zip-archive that contains the processed input file and all the other files that are packed in the input archive.
An important example are OpenOffice-Writer files (suffix .sxw or .odt). They are normal zip files containing the text (in the file content.xml) and other files: embedded pictures, format information, etc. Because of the fact that this is a convenient format to use together with mavscript, mavscript recognizes it automatically. Therefore the option -z content.xml can be omitted.

--init, -i

Example: --init lib/init.ys

This option is useful when some functions are used all the time. The functions can be saved i a separate InitFile and mavscript then can be called using the option --init InitFile .
The commands of the InitFile get executed before the template is processed. The InitFile remains unchanged.

If Mavscript runs in --yacas (default), --beanshell or --jasymca mode, then the InitFile is loaded by Yacas / BeanShell / Jasymca itself. The syntax therefore is the one of the interpreter. Mavscript control characters (§m, §i, etc.) must not be used.

If Mavscript runs in --port mode, it sends the commands contained in this InitFile to the computer-algebra-system. In the InitFile each line is a command. Mavscript control characters (§m, §i, etc.) are not used. Lines starting with the characters #, // or /* are comments and will not be sent to the algebra program. Empty lines are allowed.

--HTML, -H

This option tells Mavscript to convert some HTML special characters (like &gt; &lt; &quot; &amp;) in their real equivalent (> < " &) before sending the command to the computer-algebra-system. The option is selected automatically for template files with the suffix .odt , .sxw and .html .

--leavetags, -L

Does not remove xml tags in office files. (Behaviour until version 0.17.)
Useful in combination with --extract.

--ascii, -A

This option allows the use of Unicode chars (i.e. Greek letters) inside commands, even if the computer-algebra-system (like Yacas until 1.3.6) limits input to ASCII chars. It is not needed if the engine supports unicode, as BeanShell does.
It tells Mavscript to convert Non-ASCII chars inside commands to a hexadecimal format (i.e. ω to escu03c9) before being sent to the Computer-Algebra-System. The answer will be converted back when inserted in the text.

--charset, -C

Example: --charset ISO-8859-1
If not specified: --charset UTF-8
The standard charset is Unicode UTF-8. If some characters like Greek letters are displayed wrongly, the charset may be changed. Mavscript uses the same charset for reading and writing, therefore even a wrong charset may work, i.e. ISO-8889-1 (western European) instead of CP1253 (Greek). Setting the parameter --charset system the system's default charset will be used.
This setting has no direct influence on the communication between mavscript and the computer-algebra-system.

--controlchar, -D

Example: --controlchar %
If not specified: --controlchar §

Mavscript finds commands for the computer-algebra-system, if they are placed between the control characters §m and §i, §io or §n. Instead of the §-sign, an other sign (or a character string) may be used. The parameter -D % tells Mavscript to expect the control characters %m, %i, %io, %o and %n.

--extract, -x

If this option is set, the commands of the template are extracted and written to the OutputFile. No calculation is done. This is useful for debugging.
If the option --outfile is not specified, the OutputFile will be out-TemplateFileName.ys (mode --yacas), out-TemplateFileName.bsh (mode --beanshell), out-TemplateFileName.m (mode --jasymca) or out-TemplateFileName.txt

--outfile, -o

Example: --outfile result.odt
If not specified: --outfile out-TemplateFileName

The option --outfile -  writes to standard output (stdout). If input comes from standard input (stdin) and no other indication is given, output is written to standard output.
Example: cat TemplateFile.txt | mavscript > output.txt