Enumerated Types—Predefined ConstantsA variable or return value of a function is considered of enumerated type if it may take a restricted number of discrete values. For example, a variable that represents a day of the week may have only seven values, Sunday through Saturday.
DGL does not directly support enumerated types. The way to deal with variables of such a type is to declare them as INTEGER, and to define constants that are equal to the specific possible values. In order to make the template clearer, you may use meaningful names for these constants. For instance, you may define constants for the days of the week: SUNDAY:= 1, MONDAY:= 2, and so on.
The Documentor has several sets of predefined constants used as enumerated types. The names for these constants always begin with the prefix stm_.
For example, a very useful enumerated type is Element Type. The possible values for this type are stm_state, stm_event, etc; each of these identifiers has a unique integer value.
You may use predefined constants in your template without even knowing their numerical values. However, you must make sure that variables that are to be assigned enumerated values are declared as INTEGER.
For example, another widely used predefined enumerated type is the function return status code (see Documentor Functions). Status codes have a restricted number of values, each value denoting some information about the operation of the function being used.
For example, stm_success, denoting the successful completion of the function operation, corresponds to the value 0. You do not have to explicitly use the value 0 when writing this status code into your template; for instance, you can write:
VARIABLE
INTEGER status ;
.
.
md_id := stm_r_md (’M1’ , status);
IF status = stm_success THEN
.
.Predefined enumerated types are listed in their relevant sections.
For instance, an enumerated type that is returned by a certain function is listed in the description of that function.