Inno Setup Preprocessor: #pragma

Syntax

pragma-directive: <pragma-option>
<pragma-itokens>
<pragma-msg>
<pragma-verblev>
<pragma-include>
<pragma-spansymb>
pragma-option: pragma (option | parseroption) - <letter> (+ | -) [- <letter> (+ | -) ]...
pragma-itokens: pragma (inlinestart | inlineend) <expr>
pragma-msg: pragma (message | warning | error) <expr>
pragma-verblev: pragma verboselevel <expr>
pragma-include: pragma include <expr>
pragma-spansymb: pragma spansymbol <expr>

Description

pragma is a special directive. Please note that if ISPP fails to parse parameters of this directive (because of typo or wrong syntax), no error will occur – only a warning will be issued; this is done for compatibility with other preprocessors, which can have their own syntax of pragma directive.

First syntax of pragma directive controls the options, which ISPP uses to read the source. There are two groups of options. Each group consists of 26 flags (not all of them are meaningful and used by ISPP, though). Each flag has an assigned latin letter. You specify options by typing group name (option or parseroption), then the letter following the dash. After a letter, a plus or minus sign shall be specified. Plus sign to turn the option on, minus to turn it off. Unrestricted number of options can be specified at once (see syntax). The list of options is provided at the end of this topic.

The first group of options (option) controls the general options, while the second group (parseroption) controls options specific to parser. The list of options is provided at the end of this topic.

Second syntax is used to specify inline directive terminators: starting and ending, respectively. After the token description keyword (inlinestart or inlineend) a string type expression must follow. It must not evaluate to an empty string. Only first seven symbols from the string are taken. It is allowed to specify the same token for both starting and ending terminators. By default, {# (opening brace and a number sign) and } (closing brace) are assumed.

Third syntax of pragma directive issues a message of the type specified by the keyword following the directive name. Messages and warnings are sent to the messages window of the compiler. Errors are shown (by the compiler) using message boxes. Expression must be of type string. Also see the error directive.

Fourth syntax turns on verbose mode and sets the level of verbosity which controls the importance of messages (see below). Least important messages will show up only when highest verbose level is set.

Fifth syntax sets the include path. Expression may specify multiple paths delimited with semicolons. The list of these directories is used when ISPP tries to find a file, mentioned in include directive.

The last syntax sets the symbol used to span multiple lines together. Expression must not evaluate to an empty string. Only first symbol in string is taken.

ISPP options

c Indicates that the preprocessor output should be sent to the compiler after preprocessing is done. Default state: on.
e Specifies whether empty lines or lines with only whitespace should be emitted to the preprocessor output. Default state: on.
v Turns on/off the verbose mode. Default state: off.

Parser options

b Short-circuit boolean evaluation. Default state: on.
m Short-circuit multiplication evaluation. (In "0 * A", A will not be evaluated, since the result of expression is known to be zero.) Default state: off.
p Pascal-style string literals. In off state, uses C-style string literals (with escape sequences). Default state: on.
u Allow undeclared identifiers. If an undefined identifier is encountered, ISPP will raise an error unless this option is turned on, in which case a standalone identifier (the one that does not look like a function call) will be considered void value. Default state: off.

Verbose levels

0 Verbosity level messages
1 Messages about any temporary files created by #file
2 #insert and #append messages
4 #dim, #define and #undef messages
6 Conditional inclusion messages
8 #emit messages
9 Macro and functions call messages
10 Local macro array allocation messages

Examples

#pragma parseroption -b- -u+
#pragma option -c-
#pragma warning "Variable value is: " + Str(MyVar)
#pragma option -v+
#pragma verboselevel 9
#pragma inlinestart "$("
#pragma inlineend ")"
#pragma include __INCLUDE__ + ";D:\INCLUDE"
#pragma spansymbol "_"

See also

Message, Warning, Error.