4 compiler pragmas, 1 compiler directives, 1 #define – ElmoMC SimplIQ Software Manual User Manual
Page 77: 4 compiler pragmas -15, Compiler directives -15
SimplIQ
Software Manual
Program Development and Execution
MAN-SIMSW (Ver. 1.4)
6-15
Checks the conditions of #if, #elseif, #else, #ifdef and #ifndef directives and –
depending on the results – removes or retains the corresponding processing statements
in the code.
6.4
Compiler Pragmas
6.4.1
Compiler Directives
6.4.1.1 #define
The #define directive may be used to assign a name to a literal string, in a manner similar to
that of the C language.
Syntax:
#define identifier token_string
The #define directive substitutes token_string for all subsequent occurrences of an identifier
in the source file. The identifier is replaced only when it forms a token. For instance, identifier
is not replaced if it appears in a comment, within a string or as part of a longer identifier.
The #define directive without identifier is illegal.
A #define without a token_string is not replaced. The identifier remains defined and can be
tested using the #ifdef and #ifndef directives.
The token_string argument consists of a series of tokens, such as keywords, constants or
complete statements. One or more space characters must separate token_string from identifier.
The legal identifier name may consist of a maximum of 32 characters. A valid name consists
only of letters, underscores and numbers (not leading). The name is case sensitive, although
uppercase identifiers are accepted.
The maximum admissible number of #define directives in the
SimplIQ
drive is 100.
When evaluating the token_string (refer to s
), if the evaluation is successful, the
identifier is replaced with the obtained value; otherwise, every appearance of the identifier is
replaced with the token_string as a string.
The syntax that defines Compiler directives in the
SimplIQ
language differs from the C
language in a number of ways. The redefinition of #define with the same identifier is illegal
unless the second definition of #define appears after the first definition is removed with the
#undef directive.
The token_string may contain identifiers of other #define directives as part of the
expression. When such an expression is successfully evaluated, every occurrence of
this identifier is replaced with the evaluation result even if the identifiers that are part
of its token_string were removed with an #undef directive (described in Example 6
following).