INCLAN: Expressions

From CYANA Wiki
Jump to navigation Jump to search

The command interpreter can evaluate general Fortran-77 integer, real, complex, logical and character expressions. Expressions can appear in eval statements, as conditions of if statements, as command parameters when a numeric value is expected, and as substring and element index expressions.

An expression is built according to the rules of Fortran-77 from constants, variables, and function calls. These basic items can be combined by operators (“+”, “–”, “*”, “/”, “**”, “.eq.”, “.ne.”, “.lt.”, “.le.”, “.ge.”, “.gt.”, “.and.”, “.or.”, “.not.”, “.eqv.”, “.neqv.”, “==”, “!=”, “<”, “<=”, “>=”, “>”) and grouped by parentheses.

There are the following differences to the rules of Fortran-77:

  • The data type “double precision” is not supported.
  • The data type “logical” is represented by the integer values 0 (false) and 1 (true). Any integer expression can be used in place of a logical expression, with 0 representing “false”, and all other values representing “true”.
  • Variable, function and operator names are case sensitive. The names of logical operators and intrinsic functions must be written in lower case.
  • The logical operators “==”, “!=”, “<”, “<=”, “>=”, “>”, “&&”, “||”, and “!” can be used in place of its respective FORTRAN-77 equivalents “.eq.”, “.ne.”, “.lt.”, “.le.”, “.ge.”, “.gt.”, “.and.”, “.or.”, and “.not.”.
  • All Fortran-77 intrinsic functions (except “dble”, “dprod”, “lge”, “lgt”, “lle” and “llt”) are available by their generic names but not under special names. For example, the absolute value function is known by the name “abs” but not by the special names “iabs” or “cabs”.
  • There are additional intrinsic functions.
  • Blanks can only appear at “reasonable” places but not within numbers, variable names, etc. There must be no blanks between the name of a function and the opening parenthesis of its parameter list.