Contents

The Object Icon preprocessor.

Introduction

Object Icon inherits a textual preprocessor from Icon. The following directives are recognised.

$line n [[filename] encoding]

Set the line number and optionally filename and encoding. These values are passed to the lexical analyzer (by way of a special comment in the output).

$include filename

Include the given file.

$load identifier filename

Load the contents of the given file as a string literal, and set those contents as the value of the given macro variable. For example, if a particular text file contained the single line “testing 1 2 3”, and a newline, then

$load STR "file.txt"

would be equivalent to

$define STR "testing 1 2 3\n"

This directive is particularly useful for compiling image files, such as PNG icons, into the object file.

$uload identifier filename

This is like $load, except that the resulting string is a ucs literal. The contents of the file must therefore be in UTF-8 format.

$define identifier text

Set the given variable to a value.

$undef identifier

Clear the given variable.

$if expression

Include or exclude a block of text based on the given boolean expression. The expression may be a combination of the following symbols :-

The usual operator precedence applies - & has higher precedence than |.

For example :-

$if _LINUX | _DARWIN
...

$elsif expression

Following a $if or $elsif, this can be used to provide a further conditional expression and associated block.

$else

Following a $if or $elsif, this can be used to include a block of text if the condition was false.

$endif

This ends a conditional statement block.

$encoding name

Set the encoding of the file. This is passed to the lexical analyzer (by way of a special comment in the output). Allowed values of name are :-

$error [text]

Signal an explicit error message.

Contents