next up previous contents index
Next: DEFINE_INTEGER define Up: TOP, MODELLER scripting language Previous: The source file   Contents   Index

TOP Commands

There are `flow control' and `performing' commands. If general, the `performing' commands have the following syntax:

ACTION [ASSIGNMENT, ASSIGNMENT, ..., ASSIGNMENT]

ACTION specifies what action to take. ASSIGNMENT sets the variable to the specified value. The values assigned in this way are kept until the next assignment. For example, CALL ROUTINE = 'routine_name', IVAR = 3 sets the integer variable IVAR to 3 and then calls routine routine_name; if IVAR is not changed in the routine, its value will remain to be 3 after the call to the routine.

There can be any number of assignments in a command. They must be separated by commas. The assignment is of the form:

$\langle{\tt variable:0}\rangle$ = [-] $\langle{\tt quantity:0}\rangle$

The `=' character is optional (can be replaced with a blank).

$\langle{\tt integer:1}\rangle$ and $\langle{\tt real:1}\rangle$ can be assigned to each other. When a real number is assigned to an integer variable, the decimal places are ignored. That is, the result is the same as if the FORTRAN function IFIX() was used. There must be no space between the optional $-$ and $\langle{\tt quantity:0}\rangle$. If a vector variable is assigned to a variable, all its elements are used.

Real, integer, and logical variables can also be assigned to a string variable. The conversion of a real variable to a string value is guided by the TOP variable NUMBER_PLACES which is of type $\langle{\tt integer:2}\rangle$. The first element of NUMBER_PLACES sets the number of places before the decimal point, and the second element the number of places after the decimal point. If the latter is $-1$, an integer number without a decimal point is obtained, if 0 there is a decimal point without any decimal places.

Assignments can follow any command, except DO, END_DO, GO_TO, LABEL, STOP, and END_SUBROUTINE.



Subsections
next up previous contents index
Next: DEFINE_INTEGER define Up: TOP, MODELLER scripting language Previous: The source file   Contents   Index
Ben Webb 2004-04-20