INCLAN: Variables

From CYANA Wiki
Jump to navigation Jump to search

The command line interpreter allows the use of variables in two different ways:

  • Similar to shell-variables in the UNIX operating system as variables whose value can be substituted into the command line. In this case, the value of a variable is a general character string and has no particular type.
  • As variables in Fortran-style numerical, logical or character string expressions. In this case, the value of a variable must be an integer, real, complex, logical or character constant, according to the rules of Fortran-77. In particular, character strings must be delimited with single quotes.

Variables can be used in both ways simultaneously which makes them a powerful tool of the command language.

A variable name starts with a letter and consists of up to 32 letters, digits, or underscore characters “_”. The value of a variable is always stored as a character string with a maximal length of 512 characters. It is temporarily to an integer, real, or complex number during the evaluation of an expression. There are several types of variables:

Local variables

Local variables exist only within the macro where they are declared, and in macros called from this macro. With the exception of the command line parameters of a macro, which are always local, local variables must be declared in var or syntax statements. Local variables exist until they are removed with unset or the end of the macro in which they are declared is reached.

Global variables

Global variables are always visible, except when they are hidden by local variables with the same name. Variables that are not local are global. The user can introduce new global variables simply by using a variable with a new name. Global variables exist until they are removed with unset.

Special INCLAN variables

The following special variables can be created and used by the user but have also a special meaning to the command interpreter.

System variables

System variables are used and, possibly, set by the program (not exclusively by the user). They thus allow the user and INCLAN macros to access and change internal data of the underlying program. System variables are always global.