Inno Setup Preprocessor: #pragma


pragma-directive: <pragma-option>
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>


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.

First group of options (option) controls the options of the whole ISPP engine, while 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 sets the level of verbosity. When the verbose mode is on (see below), this syntax controls the level of importance of messages. Least important messages will show up only when highest verbose level (9) 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 translation should be sent to the compiler after preprocessing is done. Default state: on.
e Specifies whether empty lines from the source should be emitted to the translation, as well as lines with ISPP directives should be replaced with empty lines. Default state: off.
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.


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