User Tools

Site Tools


CIGAL Reference Manual, Chapter 1 (Topics): syntax

Syntax -- CIGAL Command Syntax

CIGAL processes instructions one command line at a time. Command lines can be entered interactively at the keyboard, either by typing the command directly or by selecting a predefined command line from one of GIGAL's menu options. Command lines can also be read from macro programs, which are disk files containing a sequence of CIGAL commands (see MACROS(1)). Commands can be read from either compiled or uncompiled macro programs (see COMPILER(1)). Regardless of the source, all CIGAL command lines are processed in essentially the same way and therefore share the same rules regarding syntax.

CIGAL Commands

Generally, CIGAL commands consist of a command word followed by a number of optional arguments. Arguments are terms separated from the command word, and each other, by spaces or tabs. The standard command looks something like:

           command argument1 argument2 argument3 ...

Arguments can be CIGAL reserved words, numbers, character strings, or any other type of data variable, depending on the command. Command arguments can also be entered in parentheses directly after the command name as:


In this case, the arguments are separated by commas which allow spaces within the arguments to be ignored. Both syntaxes for commands work equally well, but usually the first form is simpler, since spaces are easier to type than commas and parentheses.

If a command line contains a semicolon, ';', then the semicolon and everything after it on the line is ignored. The semicolon can therefore be used to put comments on your commands.

Command Arguments

The meaning of each argument is defined by the particular command, and is usually based on the argument's position on the command line. For example, the first argument to the LIST command (which prints text files on the screen) is interpreted as the name of the file to be listed, the second argument indicates whether to print page headers or not, the third argument indicates whether to number the lines, and so on. Although some commands require that you enter one or two arguments, for most commands all arguments are optional; any missing arguments are automatically assigned standard default values. The purpose of the command arguments is not to make you specify exactly what you want the command to do, but to give the option of modifying the command's default action if you so choose. The order of arguments is important, so if you want to specify one argument but use default values for the others, you must indicate how many unchanged arguments precede the one you want to specify. To do this use the special null argument '-' as a place saver. (If you use parentheses and separate arguments by commas then the '-' is not needed, the commas are sufficient to indicate argument position.) The following are all valid examples using the LIST command:

     list junk.txt                 ; list file JUNK.TXT
     list 'junk.txt'               ; list file JUNK.TXT
     list junk.txt - - 4           ; start listing on page 4
     list junk.txt - 1             ; include line numbers
     list junk.txt - 1 - 2         ; only list 2 pages, with line numbers
     list(junk.txt,,1,,2)          ; only list 2 pages, with line numbers

The obvious problem with specifying command arguments by position is remembering which argument is in which position. The user's manual indicates the position and meaning of the arguments recognized by each command (see HELP(2)). For most commands you can also use the preprocessor function, USAGE, to get a quick reminder of the argument syntax. For example, if you want to find the correct order for LIST's arguments, typing:

           usage list

prints the one-line reminder:

           usage: list Fnam [Phdr LFlg Pag0 Npag PLng LLng LMarg HdrStr EndStr PgStr]

Arithmetic Expressions

CIGAL command lines can also contain arithmetic expressions. In general, anywhere that a number or data variable is expected as a command argument, you can use an arithmetic expression instead. Arithmetic expressions are entered in standard mathematical notation and can contain numbers, data variables, functions, and arithmetic operators (see ARITHMETIC(1)). When an expression is used as a command line argument, it is important that terms are not separated by spaces, since a space would be interpreted as the end of the argument. The following are examples of using expressions as command arguments:

           list junk.txt - - n m-n+1
           type j+2 sqrt(a)

If a command line begins with a number, data variable, function, or arithmetic operator then the whole line is assumed to be a single arithmetic expression. In this case there are no arguments to keep track of so you are allowed to put as many spaces between individual terms as you wish and blank spaces are simply ignored

See Also:
CIGAL Home, CIGAL Manual, Topics List, Manual Help

jvs/cigal/manual/chapter1/syntax.txt · Last modified: 2023/02/23 18:43 (external edit)