Chapter 14 User Interfaces for WHIZARD
14.1 Command Line and SINDARIN Input Files
The standard way of using WHIZARD involves a command script written in SINDARIN. This script is executed by WHIZARD by mentioning it on the command line:
You may specify several script files on the command line; they will be executed consecutively.
If there is no script file, WHIZARD will read commands from standard input. Hence, this is equivalent:
cat script-name.sin | whizard
When executed from the command line, WHIZARD accepts several options. They are given in long form, i.e., they begin with two dashes. Values that belong to options follow the option string, separated either by whitespace or by an equals sign. Hence, --prefix /usr and --prefix=/usr are equivalent. Some options are also available in short form, a single dash with a single letter. Short-form options can be concatenated, i.e., a dash followed by several option letters.
The first set of options is intended for normal operation.
The second set of options refers to the configuration. They are relevant when dealing with a relocated WHIZARD installation, e.g., on a batch systems.
The --execute and --file options allow for fine-tuning the command flow. The WHIZARD main program will concatenate all commands given in --execute commands together with all commands contained in --file options, in the order they are encountered, as a contiguous command stream that is executed before the main script (in the example above, script-name.sin).
Regarding the --execute option, commands that contain blanks must be enclosed in matching single- or double-quote characters since the individual tokens would otherwise be intepreted as separate option strings. Unfortunately, a Unix/Linux shell interpreter will strip quotes before handing the command string over to the program. In that situation, the quote-characters must be quoted themselves, or the string must be enclosed in quotes twice. Either version should work as a command line interpreted by the shell:
whizard --execute \'int my_flag = 1\' script-name.sin whizard --execute "'int my_flag = 1'" script-name.sin
14.2 WHISH – The WHIZARD Shell/Interactive mode
WHIZARD can be also run in the interactive mode using its own shell environment. This is called the WHIZARD Shell (WHISH). For this purpose, one starts with the command
/home/user$ whizard --interactive
/home/user$ whizard -i
WHIZARD will preload the Standard Model and display a command prompt:
You now can enter one or more SINDARIN commands, just as if they were contained in a script file. The commands are compiled and executed after you hit the ENTER key. When done, you get a new prompt. The WHISH can be closed by the quit command:
Obviously, each input must be self-contained: commands must be complete, and conditionals or scans must be closed on the same line.
If WHIZARD is run without options and without a script file, it also reads commands interactively, from standard input. The difference is that in this case, interactive input is multi-line, terminated by Ctrl-D, the script is then compiled and executed as a whole, and WHIZARD terminates.
In WHISH mode, each input line is compiled and executed individually. Furthermore, fatal errors are masked, so in case of error the program does not terminate but returns to the WHISH command line. (The attempt to recover may fail in some circumstances, however.)
14.3 Graphical user interface
This is still experimental.
14.4 WHIZARD as a library
This is planned, but not implemented yet.