VARKON Version 1.15 1997-10-24

> ### MODULE, keywords and identifiers

> The MODULE is obviousley of major importance in the VARKON system. Lets have a closer look at the rules for creating MODULE's in MBS.
> A module is defined by:
> [module_attribute] [module_type] MODULE identifier(
> [parameter_declarations]);
> module_body
> where module_body is defined by:
> declarations
> BEGINMODULE
> statements
> ENDMODULE
> Words in square brackets like [module_attribute] are optional and may be excluded if the default value is satisfactory. Words in capital letters are MBS keywords and may not be used in any other situation. Here is the complete list of keywords:

> AND

FILE

NOT

> BASIC

FLOET

OR

> BEGINMODULE

FOR

PI

> CONSTANT

GEOMETRY

REF

> DRAWING

GLOBAL

STRING

> DO

GOTO

STEP

> ELIF

IF

THEN

> ELSE

INT

TO

> ENDFOR

LOCAL

VAR

> ENDIF

MODULE

VECTOR

> ENDMODULE

MACRO

> Identifiers are used for things that have names like the name of a module, a parameter, a constant, a variable, a function, a procedure and so on. Identifiers may consist of any number of characters but only 31 are significant. The following characters may be used but the first character of an identifier should always be a letter, not a digit or underscore.
> Letters:
> A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Ä Ö
> a b c d e f g h i j k l m n o p q r s t u v w x y z å ä ö
> Digits:
> 0 1 2 3 4 5 6 7 8 9
> Underscore:
> -
> Here are some valid identifiers:
> D2 wheel_size A12345B_cdefg99
> Lower and upper case letters are treated as the same letter when used in identifiers. A76BB is thus the same as a76BB or a76bb or A76bB etc. A special restriction applies for the identifier used as the name of a module since this is also the name of the file that holds the module. Module names must conform with the rules for filenames that goes for the operating system being used. UNIX for example treats upper and lower case letters differently while Microsoft Windows makes no difference. Some operating systems may also impose restrictions on the maximum number of characters used in a file name. A safe approach is not to use module names longer than 8 characters and never rely on the fact that upper and lower case are different characters.
> Module_attribute is either LOCAL, GLOBAL, BASIC or MACRO. If no module_attribute is specified a default of LOCAL will be used. A LOCAL module needs a coordinate system specified when called using the part-statement and will use this coordinate system as its global system. A GLOBAL or BASIC module should not be called with a coordinate system. A GLOBAL module automatically inherits the global system of the caller and a BASIC module uses the basic system. A MACRO module can only be called by another MACRO and is typically used for non modeling purposes like user interfaces, analysis programs, machine control etc.
> Module_type is either DRAWING or GEOMETRY. DRAWING means 2D and implies that only 2D constructs may be used in the module. GEOMETRY means 3D.

VARKON Homepage | Index