A script consists of command lines, each containing one or more syntactically complete statements. Lines may be continued by adding a backslash character at the end of the line, which ``hides'' the return character. Parentheses are used as delimiters to enforce execution order, and to enclose arguments to functions. Arrays of up to three dimensions are supported, with the array indices separated by commas and enclosed in square brackets. Array names are taken as addresses, and may be passed to functions, and used in arithmetic expressions. There are no address or pointer operators, however a pointer mechanism does exist.
If a line begins with the pound sign `#' the line will be ignored by the parser, unless the line contains a ``preprocessor'' directive, described in 13.5. Preprocessor directives can be used to comment out blocks of lines.
The parser will parse the opening clause of a line, and if there is additional text, the parser will continue reading, until all text on the line has been processed.
Note: This behavior was different in release 2.5.35 and before. In those releases, the script parser, when reading the following constructs, would assume that the construct occupies the rest of the current line of text. That is, the parser would stop reading after reading the construct, and anything that follows on the line would be ignored. However, this behavior could be modified if a semicolon (`;') followed the construct. In that case, the parser would continue reading after the semicolon, as if reading a new line.goto labelIn addition ``preprocessor'' lines (#ifdef, #define, etc.) and comments have the same property, but any trailing semicolon is ignored.
statement
end
break [n]
continue [n]
return [statement]
function xxx(...)
endfunc
static ...
global ...
In the current release, the parser will continue reading after most of these constructs, whether or not a semicolon is present. Thus, with a couple of exceptions, an entire script can be given on a single line. This is not recommended, as line-numbered error messages would not mean much, and the debugger would be useless, however this facilitates creating complicated macros with the ``#define'' preprocessor directive, which must always expand to a single line.
The two exceptions are:
A semicolon will explicitly terminate a construct, and may be needed in rare cases where the parser has trouble interpreting the syntax. The only place where a semicolon is required is to terminate the static and global declaration lists, if further command text follows on the line.
Scripts can interact with forms in HTML documents so that the form can be used as input for Xic scripts. This is often more convenient than issuing a sequence of prompts to the user for input. The forms interface makes use of the HTML viewer used with the help system.
There is an expanding library of internal functions which can be called from scripts, described in D.1.1. The parser also supports user-defined functions.