VARKON Version 1.15 1997-10-24
Statements
Statements are the things that actually do the job in a module. There are 5 basic types of statements in MBS. Assignment, if, for, goto, and procedure call. An assignment
has the following form:
variable:=expression;
where expression is any valid expression for the type of variable to recieve its value.
An if statement has the following form:
IF condition THEN
statements
[ELIF condition THEN
statements]
[ELSE
statements]
ENDIF;
The ELIF and ELSE keywords are optional. A condition is a logical expression including relational operators and keywords AND, OR and NOT.
Here is an example:
IF a < min OR a > max THEN
statements
ELSE
statements
ENDIF;
A for statement has the following form:
FOR loop_variable:=start TO stop [STEP increment] DO
statements
ENDFOR;
The loop_variable is an ordinary INT variable while start, stop and increment are any integer expressions. Evaluation of these is done only once before the loop is entered and their values can not be altered from within the loop. The STEP value may be positive or negative.
A sample for loop:
FOR i:=1 to 10 DO
poi_free(#1,vec(i,0)); ! 10 Points on a row
ENDFOR;
A goto statement is used to jump to a label as in the following example:
IF a > max then
GOTO error;
ENDIF;
error:
As you see from this example a label is just an identifier followed by a colon.
There are four kinds of procedures in MBS with different syntax in their calls. Ordinary procedures are called as follows:
identifier([expressions]);
A call to a geometric procedure has the following form:
identifier(#integer, [expressions] [:attributes]);
The #integer is something like #1 or #2 or #15000 but not more than #32768. It is used to give an identity to the entity created. Attributes have names and values, see below.
The part procedure has two forms:
part(#integer, part_name([parameters]) [,reference_expression] [:attributes]);
or
part(#integer, string_expression, ([parameters]) [,reference_expression]);
In the first form the part name is a constant while the other form accepts an expression.
The last kind of procedure call is used when calling the set and set_basic procedures.
set(attributes); and set_basic(attributes);
Attributes are things like LEVEL=1, TFONT=0 or LDASHL=10/s. More than one attribute may be specified in one call by separating them with commas.
set(LEVEL=1, TFONT=0, LDASHL=10/s);
For a complete list of attributes see the set procedure.