Inquisitor
Data Statement and Data Variable
The DATA_STATEMENT is a much simpler structure than the RECORD_STATEMENT. It is the sort of assignment statement you are likely to find in any computer language. As shown in the syntax table, the statement has the following sort of structure:
DATA_ID := LOG_EXPR | ARITH_EXPR | STRING_EXPR
where DATA_ID = is the internal program variable name for the data item; LOG_EXPR = a logical expression; ARITH_EXPR = an arithmetic expression; STRING_EXPR = a string expression.
The expression part can be a simple literal to a complex expression, and can include record field expressions. Thus, a DATA_STATEMENT might look something like:
#FRED := (27.0)
where #FRED = is the variable name that contains the value. This must start with a # to signify a data variable (and distinguish it from a record variable which starts with a $), but the name FRED is entirely your choice. Note that if you have a record variable $FRED you can still have a data variable #FRED, but this is not recommended because it could be confusing; := is the assignment operator; (27.0) = a simple arithmetic expression. All expressions must be surrounded by brackets (....).
A more complicated statement would be:
#THICKNESS := ($ROCK_SECT[PREVIOUS]:BASE - $ROCK_SECT:BASE)
where record fields are being used in an arithmetic expression. It could get more complicated still and include more and more components; for example,:
#STRIP_RATIO := (((#TOPO_RL-$ROCK_SECT:BASE) - #ACCUM_THICK) / (($ROCK_SECT[PREVIOUS]:BASE - $ROCK_SECT:BASE) * #REL_DENSITY))As with the record variable, the name has no practical limit in length, and can be upper or lower case (Inquisitor is case sensitive). The expression must always be surrounded by brackets (....), even a simple expression like a number.
When a variable is assigned a value for the first time this sets the variable type (in the cases above with floating point numbers). After this the variable may not be assigned with data of any other type, and attempting to do so will cause an error. For example,
#FRED := (27.0) #FRED := ('Hello World')is illegal and will generate an error while being parsed.
There are four data types available in Inquisitor. These are:
- CHARACTER
Holds character strings consisting of any number of ASCII characters. - INTEGER
Holds integer numbers between INT_MIN and INT_MAX. - FLOAT
Holds positive or negative double precision floating point numbers with absolute values between DBL_MIN and DBL_MAX. - LOGICAL
Holds logical values (these are just simple binaries, which evaluate to.TRUE. or.FALSE.).
Refer to the limits.h file in /usr/include of your machine to determine the values of INT_MIN, INT_MAX, DBL_MIN, and DBL_MAX.