Each TOP program or include file is stored in a file named 'program.top'. The .top extension is mandatory.
The TOP program consists of a series of commands. The order of commands is important. An example of the TOP program that writes integers 1 to 10 to the output file is:
# Define a variable: DEFINE_INTEGER VARIABLES = IVAR # Open a file for appending OPEN IO_UNIT = 21, OBJECTS_FILE = 'output.file', FILE_ACCESS = 'APPEND' # Loop from 1 to 10: DO IVAR = 1, 10, 1 # Append IVAR to the output file: WRITE IO_UNIT = 21, OBJECTS = IVAR END_DO # Close a file CLOSE IO_UNIT = 11 # Exit: STOP
There can be at most one command per line. Each command or line can be at most LENACT (2000) characters long. The command can extend over several lines if a continuation character `;' is used to indicate the end of the current line. Everything on that line after the continuation character is ignored.
A comment character `#' can be used anywhere on the line to ignore everything that occurs after the comment character.
Blank lines are allowed. They are ignored.
TAB characters are replaced by blank characters.
TOP converts all commands to upper case, except for the string constants that are quoted in single quotes '. Thus, TOP is case insensitive, except for the quoted strings.
There are two groups of commands: flow control commands and commands that perform certain tasks. The next two sections describe the flow control commands and those `performing' commands that are an integral part of TOP. There are also additional commands specific to each application of TOP, such as MODELLER and ASGL, which are described elsewhere.
The usual UNIX conventions are used for typesetting the rules. Table 4.1 explains the shorthand used to describe different variables and constants:
All the variables are formally vectors. When a variable is referred to in a scalar context its first element is used. All elements of one vector are of the same type. All variables, including a vector of the variable length, must have at least one element.
There are four different variable types: integer, real, string and logical.
The real constant is (FORTRAN real number representation):
[+|-][digits][.][digits][{e|E|d|D}{+|-}digits]
The integer constant is (FORTRAN integer number representation):
[+|-][digits]
The logical constant can be either on or off (case insensitive).
The string constant can contain any character except for a prime '. It can be optionally enclosed in primes. If it is not quoted it is converted to upper case and its extent is determined by the position of the blanks on each side of the contiguous string of non-blank characters.