# Compiler options and equations

A rich set of XDS compiler options allows you to control the source language, the generated code, and the internal limits and settings. We distinguish between boolean options (or just options) and equations. An option can be set ON (TRUE) or OFF (FALSE), while an equation value is a string.

- Options
- Options reference
- Equations
- Equations reference
- Error message format specification
- The system module COMPILER

## Options

Options control the process of compilation, including language extensions, run-time checks and code generation. An option can be set ON (TRUE) or OFF (FALSE).

A compiler setup directive (See Options) is used to set the option value or to declare a new option.

Options may be set in a configuration file, on the command line, in a project file). or in the source text (See Source code directives). At any point of operation, the last value of an option is in effect.

Alphabetical list of all options along with their descriptions may be found in the section Options reference.

Table 1. Run-time checks

Option | Meaning
ASSERT | enable ASSERT generation
CHECKDINDEX | check of dynamic array bounds
CHECKDIV | check for a positive divisor
| (DIV and MOD)
CHECKINDEX | check of static array bounds
CHECKNIL | NIL pointer dereference check
CHECKPROC | check of a formal procedure call
CHECKRANGE | range checks
| (range types and enumerations)
CHECKSET | range check of set operations
CHECKTYPE | dynamic type guards (Oberon-2 only)
COVERFLOW | cardinal overflow check
IOVERFLOW | integer overflow check

Table 2. Source language control options

Option | Meaning
M2ADDTYPES | add SHORT and LONG types
M2BASE16 | use 16-bits basic types in Modula-2
M2CMPSYM | compare symbol files in Modula-2
M2EXTENSIONS | enable Modula-2 extensions
O2ADDKWD | enable additonal keywords in Oberon-2
O2EXTENSIONS | enable Oberon-2 extensions
O2ISOPRAGMA | enable ISO Modula-2 pragmas in Oberon
O2NUMEXT | enable Oberon-2 scientific extensions
STORAGE | enable default memory management in Modula-2
??? | enable Topspeed Modula-2-compatible extensions

Table 3. Code generator control options

Option | Meaning
__GEN_C__ | ANSI C code generation
__GEN_X86__ | code generation for 386/486/Pentium/PentiumPro
DBGNESTEDPROC | generate information about procedure nesting
DBGQUALIDS | generate qualified identifiers in debug info
DEFLIBS | put the default library names into object files
DOREORDER | perform instruction scheduling
GENASM | generate assembly text
GENCPREF | generate underscore prefixes
GENDEBUG | generate code in the debug mode
GENFRAME | always generate a procedure frame
GENHISTORY | enable postmorten history
GENPTRINIT | generate a local pointer initialization
LINENO | generate line numbers in object files
NOHEADER | disable generation of a header file
NOOPTIMIZE | disable machine-independent opimizations
NOPTRALIAS | ignore pointer aliasing
ONECODESEG | generate one code segment
PROCINLINE | enable in-line procedure expansion
SPACE | favor code size over speed
VERSIONKEY | append version key to the module initialization
VOLATILE | declare variables as volatile

Table 4. Miscellaneous options

Option | Meaning
BSCLOSURE | browse control option
BSREDEFINE | browse control option
CHANGESYM | permission to change a symbol file
FATFS | limit file names to 8.3
GCAUTO | enables implicit call of the garbage collector
LONGNAME | use long names in batch files
M2 | force the Modula-2 compiler
MAIN | mark an Oberon-2 main module
MAKEDEF | generate definition
MAKEFILE | generate makefile
O2 | forces the Oberon-2 compiler
OVERWRITE | create a file, always overwrites the old one
VERBOSE | produce verbose messages
WERR | treat warnings as errors
WOFF | suppress warning messages
XCOMMENTS | preserve exported comments

## Options reference

This section lists all options in alphabetical order. Those options that may be arbitrarily placed in the source code are marked as inline options (See also Source code directives). There are also options which can be placed in a source file, but only in a module header (i.e. before any of the keywords `"DEFINITION"`, `"IMPLEMENTATION"`, and `"MODULE"`) These options are marked as header. If an option is not marked either as header or inline, then the result of setting it in the source text is undefined.

Operation modes in which an option has effect are listed in square brackets ([]) after the option name; the character '*' stands for all operation modes. For example, [browse] means that the option is used by the compiler in the BROWSE operation mode only.

Note: in the MAKE and PROJECT modes the compiler switches to the COMPILE mode to compile each module.

Run-time check options are ON by default. If not explicitly specified, other options are OFF (FALSE) by default.

- __GEN_X86__ - code generation for 386/486/Pentium/PentiumPro
- __GEN_C__ - ANSI C code generation
- ASSERT - enable ASSERT generation
- BSCLOSURE - browse control option
- BSREDEFINE - browse control option
- CHANGESYM - permission to change a symbol file
- CHECKDINDEX - check of dynamic array bounds
- CHECKDIV - check for a positive divisor (DIV and MOD)
- CHECKINDEX - check of static array bounds
- CHECKNIL - NIL pointer dereference check
- CHECKPROC - check of a formal procedure call
- CHECKRANGE - range checks (range types and enumerations)
- CHECKSET - range check of set operations
- CHECKTYPE - dynamic type guards (Oberon-2 only)
- COVERFLOW - cardinal overflow check
- DBGNESTEDPROC - generate information about procedure nesting
- DBGQUALIDS - generate qualified identifiers in debug info
- DEFLIBS - put the default library names into object files
- DOREORDER - perform instruction scheduling
- FATFS - limit file names to 8.3
- GCAUTO - enables implicit call of the garbage collector
- GENASM - generate assembly text
- GENCPREF - generate underscore prefixes
- GENDEBUG - generate code in the debug mode
- GENFRAME - always generate a procedure frame
- GENHISTORY - enable postmortem history
- GENPTRINIT - generate a local pointer initialization
- IOVERFLOW - integer overflow check
- LINENO - generate line numbers
- LONGNAME - use long names in batch files
- M2 - force the Modula-2 compiler
- M2ADDTYPES - add SHORT and LONG types
- M2BASE16 - use 16-bits basic types in Modula-2
- M2CMPSYM - compare symbol files in Modula-2
- M2EXTENSIONS - enable Modula-2 extensions
- MAIN - mark an Oberon-2 main module
- MAKEDEF - generate definition
- MAKEFILE - generate makefile
- NOHEADER - disable generation of a header file
- NOOPTIMIZE - disable machine-independent opimizations
- NOPTRALIAS - ignore pointer aliasing
- O2 - force the Oberon-2 compiler
- O2ADDKWD - enable additonal keywords in Oberon-2
- O2EXTENSIONS - enable Oberon-2 extensions
- O2ISOPRAGMA - enable ISO Modula-2 pragmas in Oberon
- O2NUMEXT - enable Oberon-2 scientific extensions
- ONECODESEG - generate one code segment
- OVERWRITE - create a file, always overwrites the old one
- PROCINLINE - enable in-line procedure expansion
- SPACE - favor code size over speed
- STORAGE - enable the default memory management in Modula-2
- VERBOSE - produce verbose messages
- VERSIONKEY - append version key to the module initialization
- VOLATILE - declare variables as volatile
- WERR - treat warningns as errors
- WOFF - suppress warning messages
- XCOMMENTS - preserve exported comments

### __GEN_X86__ - code generation for 386/486/Pentium/PentiumPro

Modes: COMPILE

The compiler sets this option ON, if the code generation for 386/486/Pentium/PentiumPro is in operation.

The option can be used for compiling different text fragments for different targets. See also Conditional compilation.

### __GEN_C__ - ANSI C code generation

Modes: COMPILE

The compiler sets this option ON, if the C code generation is in operation.

The option can be used for compiling different text fragments for different targets. See also Conditional compilation.

### ASSERT - enable ASSERT generation

Modes: COMPILE (inline)

If the option is OFF, the compiler ignores all calls of the standard procedure `ASSERT`.

Warning: Ensure that all `ASSERT` calls in your program do not have side effects (i.e. do not contain calls of other function procedures) before setting this option OFF.

The option is ON by default.

### BSCLOSURE - browse control option

Modes: BROWSE

Include all visible methods.

If the option is set ON, the browser includes all defined and inherited type-bound procedure declarations with all record declarations when creating a pseudo-definition module. See also Creating a definition.

### BSREDEFINE - browse control option

Modes: BROWSE

Include all redefined methods.

If the option is set ON, the browser includes original definitions of any overwritten type-bound procedures with record declarations. See also Creating a definition.

### CHANGESYM - permission to change a symbol file

Modes: COMPILE (header)

Permission to change a module interface (a symbol file).

The Oberon-2 compiler creates a temporary symbol file every time an Oberon-2 module is compiled, compares this symbol file with the existing one and overwrites it with the new one if necessary. When the option is OFF (by default), the compiler reports an error if interface of a module (and, hence, its symbol file) has been changed and does not replace the old symbol file.

Note: if the M2CMPSYM option is set, the same is valid for compilation of a Modula-2 definition module, i.e., the CHANGESYM option should be set ON for the compilation to succeed if a module interface has been changed.

### CHECKDINDEX - check of dynamic array bounds

Modes: COMPILE (inline)

A check of dynamic array bounds.

If the option is set ON, the compiler generates index checks for dynamic arrays (`POINTER TO ARRAY OF T`).

The option is ON by default.

### CHECKDIV - check for a positive divisor (DIV and MOD)

Modes: COMPILE (inline)

If the option is set ON, the compiler generates a check if a divisor is positive in `DIV` and `MOD` operators.

The option is ON by default.

### CHECKINDEX - check of static array bounds

Modes: COMPILE (inline)

A check of static array bounds.

If the option is set ON, the compiler generates index checks for all arrays except dynamic (See the CHECKDINDEX option).

The option is ON by default.

### CHECKNIL - NIL pointer dereference check

Modes: COMPILE (inline)

If the option is set ON, the compiler generates NIL checks on all pointer dereferences.

The option is ON by default.

### CHECKPROC - check of a formal procedure call

Modes: COMPILE (inline)

If the option is set ON, the compiler generates a NIL check when calling a procedure variable.

The option is ON by default.

### CHECKRANGE - range checks (range types and enumerations)

Modes: COMPILE (inline)

If the option is set ON, the compiler generates range checks for range types and enumerations.

The option is ON by default.

### CHECKSET - range check of set operations

Modes: COMPILE (inline)

If the option is set ON, the compiler generates range checks for set operations (`INCL`, `EXCL`, set aggregates).

The option is ON by default.

### CHECKTYPE - dynamic type guards (Oberon-2 only)

Modes: COMPILE, Oberon-2 only (inline)

If the option is set ON, the compiler generates dynamic type guards.

The option is ON by default.

### COVERFLOW - cardinal overflow check

Modes: COMPILE (inline)

If the option is set ON, the compiler generates overflow checks for all cardinal (unsigned) arithmetic operators.

The option is ON by default.

### DBGNESTEDPROC - generate information about procedure nesting

Modes: COMPILE

If this option is set ON, the compiler includes procedure nesting data into debug information (CodeView and HLL formats only, see the DBGFMT equation).

This is a non-standard feature, so a third party debugger would not work correctly with an executable compiled with DBGNESTEDPROC ON. For instance, MSVC does not display local variables of nested procedures.

This option is OFF by default.

### DBGQUALIDS - generate qualified identifiers in debug info

Modes: COMPILE

If the option is set ON, the compiler prefixes names of Modula-2/Oberon-2 global variable with the name of the respective module and underscore in debug information. This feature may help you distingushing identically named exported variables from different modules in third-party debuggers that do not support Modula-2/Oberon-2.

This option is OFF by default.

### DEFLIBS - put the default library names into object files

Modes: COMPILE

If the option is set ON, the compiler writes the default library names to the generated object files.

The option is ON by default.

### DOREORDER - perform instruction scheduling

Modes: COMPILE (header)

Setting this option ON enables the instruction scheduling mechanism of the x86 code generator. It reorders CPU instructions so that independent instructions can be executed simultaneously whenever possible.

Note: this optimization significantly slows down the compiler, but results in a code perfomance gain of 5-15%.

### FATFS - limit file names to 8.3

Modes: *

Forces the compiler to limit file names to FAT "8.3" convention.

### GCAUTO - enables implicit call of the garbage collector

Modes: COMPILE,top-level module only (header)

Enables implicit calls of the garbage collector in the generated program. The option is ignored for all modules except the top-level module of the program. We recommend to set the option in the project or configuration file.

See also Memory management.

### GENASM - generate assembly text

Modes: COMPILE (header)

If this option is set ON, the compiler generates text in the assembly language instead of object files. The only assembler supported in the current version is GNU Assembler.

### GENCPREF - generate underscore prefixes

Modes: COMPILE (header)

If the option is set ON, the compiler uses underscore as a prefix for all public names in object files.

### GENDEBUG - generate code in the debug mode

Modes: COMPILE (header)

If the option is set ON, the compiler puts debug information into an object file.

In some cases, switching the option ON may reduce code quality.

See also the DBGFMT equation.

### GENFRAME - always generate a procedure frame

Modes: COMPILE (header)

If the option is set ON, the compiler always generates a stack frame. It may be necessary to simplify debugging.

### GENHISTORY - enable postmortem history

Modes: COMPILE (header)

If the option is set ON, the run-time system prints a stack of procedure calls (a file name and a line number) on abnormal termination of your program. It should be set when compiling a main module of the program. In this case the required part of the run-time system will be added to the program. The option LINENO should be set for all modules in the program.

See Debugging a program for an example.

Note: In some cases the printed list may contain incorrect lines, i.e. procedures that were not called in the given context (See Postmortem history).

### GENPTRINIT - generate a local pointer initialization

Modes: COMPILE, Oberon-2 only (header)

If the option is set ON, the compiler generates code for initialization of all local pointers, including variables, record fields and array elements. Values of all non-pointer record fields and array elements are undefined.

The option is ON by default.

### IOVERFLOW - integer overflow check

Modes: COMPILE (inline)

If the option is set ON, the compiler generates overflow checks of all integer (signed) arithmetic operators.

The option is ON by default.

### LINENO - generate line numbers

Modes: COMPILE (header)

If the option is set ON, the compiler inserts line number information into object files. This option should be set ON to get the postmortem history (See the GENHISTORY option) and for debugging.

### LONGNAME - use long names in batch files

Modes: MAKE,PROJECT

Use long names.

If the option is set ON, the compiler uses full path as a prefix for all module names in the generated batch files. See also BATCH submode.

### M2 - force the Modula-2 compiler

Modes: COMPILE

Force the Modula-2 compiler.

If the option is set ON, the Modula-2 compiler is invoked regardless of file extension. The option is ignored in MAKE and PROJECT modes.

### M2ADDTYPES - add SHORT and LONG types

Modes: COMPILE,Modula-2 only (header)

Add short and long modifications of whole types.

If the option is set ON, the compiler recognizes the types `SHORTINT`, `LONGINT`, `SHORTCARD` and `LONGCARD` as pervasive identifiers .

Warning: Usage of additional types may cause problems with the software portability to other compilers.

### M2BASE16 - use 16-bits basic types in Modula-2

Modes: COMPILE,Modula-2 only (header)

If the option is set ON, the basic types `INTEGER`, `CARDINAL`, and `BITSET` are 16 bits wide in Modula-2. By default, they are 32 bits wide.

### M2CMPSYM - compare symbol files in Modula-2

Modes: COMPILE,Modula-2 only

If the option is set ON, the Modula-2 compiler compares the symbol file generated for a definition module with the old version exactly as the Oberon-2 compiler does. If the symbol files are equal, the old one is preserved, otherwise the compiler overwrites symbol file, but only if the CHANGESYM option is set ON.

### M2EXTENSIONS - enable Modula-2 extensions

Modes: COMPILE,Modula-2 only (header)

If the option is set ON, the compiler allows XDS Modula-2 language extensions, such as line comment ("`--`"), read-only parameters, etc., to be used in the source code.

Warning: Extensions usage may cause problems with porting to third-party compilers.

### MAIN - mark an Oberon-2 main module

Modes: COMPILE, Oberon-2 only (header)

Mark the Oberon-2 main module.

If the option is set ON, the compiler generates a program entry point (`main' function) for the Oberon-2 module (See Program structure). Recommended to be used in a module header.

### MAKEDEF - generate definition

Modes: COMPILE,Oberon-2 only

Forces the Oberon-2 compiler to generate a (pseudo-) definition module after successful compilation of an Oberon-2 module. The compiler preserves the so-called exported comments (i.e. comments started with ``(**`') if the XCOMMENTS option is set ON.

See Creating a definition.

### MAKEFILE - generate makefile

Modes: PROJECT

Forces the compiler to generate a makefile after successful compilation of a project. See also GEN mode and Template files.

### NOHEADER - disable generation of a header file

Modes: COMPILE,MAKE,PROJECT (header)

This option is used by translators to C. Native code compilers recognize but ignore it.

### NOOPTIMIZE - disable machine-independent opimizations

Modes: COMPILE If this option is set OFF (default), the machine-independent optimizer is invoked before code generation. Setting it ON causes less optimized, but still not straightforward code to be produced.

### NOPTRALIAS - ignore pointer aliasing

Modes: COMPILE (header)

If the option is set ON, the compiler assumes that there is no pointer aliasing, i.e. there are no pointers bounded to non-structure variables. The only way to get a pointer to a variable is to use the low-level facilities from the module SYSTEM. We recommend to turn this option ON for all modules except low-level ones. Note: the code quality is better if the option is ON.

### O2 - force the Oberon-2 compiler

Modes: COMPILE

Force Oberon-2 compiler.

If the option is set ON, the Oberon-2 compiler is invoked regardless of the file extension. The option is ignored in MAKE and PROJECT modes.

### O2ADDKWD - enable additonal keywords in Oberon-2

Modes: COMPILE,Oberon-2 only (header)

Allows Modula-2 exceptions and finalization to be used in Oberon-2 programs, adding keywords `EXCEPT`, `RETRY`, and `FINALLY`.

Warning: Usage of this extension will prevent your program from porting to other Oberon-2 compilers.

### O2EXTENSIONS - enable Oberon-2 extensions

Modes: COMPILE,Oberon-2 only (header)

If the option is set ON, the compiler allows Oberon-2 language extensions to be used (See Language extensions).

Warning: Extensions usage will affect portability to third-party Oberon-2 compilers.

### O2ISOPRAGMA - enable ISO Modula-2 pragmas in Oberon

Modes: COMPILE,Oberon-2 only

If the option is set ON, the compiler allows the ISO Modula-2 style pragmas `<* *>` to be used in Oberon-2. See Source code directives and Source code directives.

Warning: Usage of ISO Modula-2 pragmas may cause problems when porting source code to third-party Oberon-2 compilers.

### O2NUMEXT - enable Oberon-2 scientific extensions

Modes: COMPILE,Oberon-2 only (header)

If the option is set ON, the compiler allows the Oberon-2 scientific language extensions to be used (See Language extensions), including `COMPLEX` and `LONGCOMPLEX` types and the in-line exponentiation operator.

Warning: Usage of additional types may cause problems with portability to other compilers.

### ONECODESEG - generate one code segment

Modes: COMPILE

If the option is ON, the compiler produces only one code segment which contains all code of a module, otherwise it generates a separate code segment for each procedure.

Warning: Setting this option ON disables smart linking.

### OVERWRITE - create a file, always overwrites the old one

Modes: *

The option changes the way the compiler selects a directory for output files. If the option is OFF, the compiler always creates a file in the directory which appears first in the search path list correspondent to a pattern matching the file name. Otherwise, the compiler overwrites the old file, if it does exist in any directory of that list. See also Redirection file.

### PROCINLINE - enable in-line procedure expansion

Modes: COMPILE

If the option is ON, the compiler tries to expand procedures in-line. In-line expansion of a procedure eliminates the overhead produced by a procedure call, parameter passing, register saving, etc. In addition, more optimizations become possible because the optimizer may process the actual parameters used in a particular call.

A procedure is not expanded in-line under the following circumstances:

- the procedure is deemed too complex or too large by the compiler.
- there are too many calls of the procedure.
- the procedure is recursive.

### SPACE - favor code size over speed

Modes: COMPILE

If the option is set ON, the compiler performs optimizations to produce smaller code, otherwise (by default) to produce faster code.

### STORAGE - enable the default memory management in Modula-2

Modes: COMPILE, Modula-2 only (header)

If the option is set ON, the compiler uses the default memory allocation and deallocation procedures for the standard procedures `NEW` and `DISPOSE`.

Warning: Usage of this option may cause problems with software portability to other compilers.

### VERBOSE - produce verbose messages

Modes: MAKE,PROJECT

If the option is set ON, the compiler will report a reason for each module (re)compilation (See Smart recompilation).

### VERSIONKEY - append version key to the module initialization

Modes: COMPILE

This option may be used to perform version checks at link time. If the option is set ON, the compiler generates a name of a module body as composition of

- a module name
- a string "`_BEGIN_`"
- a time stamp

If a Modula-2 definition module or an Oberon-2 module imported by different compilation units has the same version, the same name is generated for each call of the module body. In all other cases unresolved references will be reported at link time.

If the option is OFF, the compiler generates module body names in a form: `<module_name>_BEGIN`.

Note: the option should be set when compiling a Modula-2 definition module or an Oberon-2 module.

### VOLATILE - declare variables as volatile

Modes: COMPILE (inline)

If this option appears to be switched ON during compilation of a variable definition, the compiler will assumes that references to that variable may have side effects or that the value of the variable may change in a way that can not be determined at compile time. As a result, the optimizer will not eliminate any operation involving that variable, and changes to the value of the variable will be stored immediately.

### WERR - treat warningns as errors

Modes: * (inline)

When the option `WERRnnn` (e.g. `WERR301`) is set ON, the compiler treats the warning `nnn` (301 in the above example) as error. See the xc.msg file for warning texts and numbers.

`-WERR+` forces the compiler to treat all warnings as errors.

### WOFF - suppress warning messages

Modes: * (inline)

When the option `WOFFnnn` (e.g. `WOFF301`) is set ON, the compiler does not report the warning `nnn` (301 in the above example). See the xc.msg file for warning texts and numbers.

`-WOFF+` disables all warnings.

### XCOMMENTS - preserve exported comments

Modes: COMPILE,Oberon-2 only

If the option is set ON, the browser includes so-called exported comments (i.e. comments which start with "`(**`") into a generated pseudo definition module.

See also Creating a definition.

## Equations

An equation is a pair (`name`,`value`), where `value` is in general case an arbitrary string. Some equations have a limited set of valid values, some may not have the empty string as a value.

A compiler setup directive (See Options) is used to set an equation value or to declare a new equation.

Equations may be set in a configuration file, on the command line and in a project file). Some equations may be set in the source text, at an arbitrary position (marked as inline in the reference), or only in the module header (marked as header). At any point of operation, the most recent value of an equation is in effect.

Alphabetical list of all equations may be found in the section Equations reference.

Table 5. File extensions

Name | Default | File type
BATEXT | `.bat` | recompilation batch file
BSDEF | `.odf` | pseudo-definition file created by browser
CODE | `.o` | object file
DEF | `.def` | Modula-2 definition module
MKFEXT | `.mkf` | makefile
MOD | `.mod` | Modula-2 implementation or main module
OBERON | `.ob2` | Oberon-2 module
OBJEXT | `.o` | object file
PRJEXT | `.prj` | project file
SYM | `.sym` | symbol file

Table 6. Code generator equations

Name | Default | Meaning
ALIGNMENT | `4` | data alignment (please read details below)
CC | `GCC` | C compiler compatibility
CODENAME | `_TEXT` | Code segment name
CPU | `GENERIC` | CPU to optimize for
DATANAME | `_DATA` | data segment name
DBGFMT | see desc. | debug information format
ENUMSIZE | `4` | default size of enumeration types
GCTHRESHOLD |  | garbage collector threshold (obsolete)
HEAPLIMIT | `0` | generated program heap limit
MINCPU | `386` | CPU required for execution
OBJFMT | `ELF` | object file format
SETSIZE | `4` | default size of small set types
STACKLIMIT | `0` | generated program stack limit

Table 7. Miscellaneous equations

Name | Default | Meaning
ATTENTION | `!` | attention character in template files
BATNAME | `out` | batch file name
BATWIDTH | `128` | maximum line width in a batch file
BSTYLE | `DEF` | browse style (See Creating a definition)
COMPILERHEAP |  | heap limit of the compiler
COMPILERTHRES |  | compiler's garbage collector threshold (obsolete)
DECOR | `hrtp` | control of compiler messages
ERRFMT | See Error message format specification | error message format
ERRLIM | `16` | maximum number of errors
FILE |  | name of the file being compiled
LINK |  | linker command line
LOOKUP |  | lookup directive
MKFNAME |  | makefile name
MODULE |  | name of the module being compiled
PRJ |  | project file name
PROJECT |  | project name
TABSTOP | `8` | tabulation alignment
TEMPLATE |  | template name (for makefile)

## Equations reference

Operation modes in which an equation has effect are enclosed in square brackets ([]) after the equation name; the character '*' stands for all operation modes. For example [browse] means that the equation is used by the compiler in the BROWSE operation mode only. Note: the compiler switches from the MAKE and PROJECT mode to the COMPILE mode to compile a module.

- ALIGNMENT - data alignment
- ATTENTION - attention character in template files
- BATEXT - recompilation batch file extension
- BATNAME - batch file name
- BATWIDTH - maximum line width in a batch file
- BSDEF - pseudo-definition file created by browser extension
- BSTYLE - browse style
- CC - C compiler compatibility
- CODE - object file extension
- CODENAME - Code segment name
- COMPILERTHRES - compiler's garbage collector threshold (obsolete)
- COMPILERHEAP - heap limit of the compiler
- CPU - CPU to optimize for
- DATANAME - Data segment name
- DBGFMT - debug information format
- DECOR - control of compiler messages
- DEF - Modula-2 definition module extension
- ENUMSIZE - default size of enumeration types
- ENV_HOST - host platform
- ENV_TARGET - target platform
- ERRFMT - error message format
- ERRLIM - maximum number of errors
- FILE - name of the file being compiled
- GCTHRESHOLD - garbage collector threshold (obsolete)
- HEAPLIMIT - generated program heap limit
- LINK - linker command line
- LOOKUP - lookup directive
- MINCPU - minimal CPU required for execution
- MKFEXT - makefile extension
- MKFNAME - makefile name
- MOD - Modula-2 implementation or main module extension
- MODULE - name of the module being compiled
- OBERON - Oberon-2 module extension
- OBJEXT - object file extension
- OBJFMT - object file format
- PRJ - project file name
- PRJEXT - project file extension
- PROJECT - project name
- SETSIZE - default size of small set types
- STACKLIMIT - generated program stack limit
- SYM - symbol file extension
- TABSTOP - tabulation alignment
- TEMPLATE - template name (for makefile)

### ALIGNMENT - data alignment

Modes: COMPILE (inline)

This equation sets the data alignment. Valid values are: 1,2,4, or 8. See Record types for further details.

Warning: Since XDS libraries are built through GCC which uses 4 byte alignment, you should always keep ALIGNMENT set to 4, unless you exactly know what you are doing. See Configuring XDS for a C Compiler for more details.

### ATTENTION - attention character in template files

Modes: PROJECT,GEN

The equation defines an attention character which is used in template files ("!" by default). See Template files.

### BATEXT - recompilation batch file extension

Modes: MAKE,PROJECT,batch submode

Sets the file extension for recompilation batch files (by default .bat). See BATCH submode.

### BATNAME - batch file name

Modes: MAKE,PROJECT,batch submode

Sets the batch file name.

The name of the project file will be used if no batch file name is explicitly specified. See BATCH submode.

### BATWIDTH - maximum line width in a batch file

Modes: MAKE,PROJECT,batch submode

Sets the maximum width of a line in a generated batch file (by default 128). See BATCH submode.

### BSDEF - pseudo-definition file created by browser extension

Modes: BROWSE

Sets the file extension for pseudo-definition modules created by the browser (by default .odf). See BROWSE mode.

### BSTYLE - browse style

Modes: BROWSE

Sets the style of generated pseudo-definition modules. See Creating a definition.

### CC - C compiler compatibility

Modes: COMPILE

Sets the C compiler compatibility mode. The correspondent calling and naming conventions will be used for procedures and variables declared as `["C"]`.

Currently the only valid value on Linux is "GCC".

If the value of the equation is undefined, "GCC" is assumed.

See Configuring XDS for a C Compiler for more details.

### CODE - object file extension

Modes: *

Sets the file extension for code files generated by the compiler (by default .o).

### CODENAME - Code segment name

Modes: COMPILE (header)

Sets name for a code segment.

### COMPILERTHRES - compiler's garbage collector threshold (obsolete)

Modes: *

This equation is left for compatibility; it is ignored by the compiler. In versions prior to 2.50, it was used to fine tune the compiler's garbage collector.

See also XDS memory usage.

### COMPILERHEAP - heap limit of the compiler

Modes: *

Sets the maximum amount of heap memory (in bytes), that can be used by the compiler. For systems with virtual memory, we recommend to use a value which is less than the amount of physical memory.

Setting this equation to zero forces adaptive compiler heap size adjustment according to system load.

### CPU - CPU to optimize for

Modes: COMPILE

Specifies on which Intel x86 family representative the resulting program will be executed optimally.

Valid values: "386", "486", "PENTIUM", and "PENTIUMPRO". The value must be "greater of equal" than the value of the MINCPU equation.

There is also the special value "GENERIC", which means that the optimizer should not perform code transformations that may significantly reduce performance on a particular CPU.

### DATANAME - Data segment name

Modes: COMPILE (header)

Sets name for a data segment.

### DBGFMT - debug information format

Modes: COMPILE

Sets debug information format for output object files. Valid values are "CodeView" and "HLL".

### DECOR - control of compiler messages

Modes: *

The equation controls output of the xc utility. The value of equation is a string that contains any combination of letters "h", "t", "r", "p" (capital letters are also allowed). Each character turns on output of

h
  header line, which contains the name and version of the compiler's front-end and back-end
p
  progress messages
r
  compiler report: number of errors, lines, etc.
t
  the summary of compilation of multiple files

By default, the equation value is "hrt".

### DEF - Modula-2 definition module extension

Modes: *

Sets the file extension for Modula-2 definition modules (by default .def).

### ENUMSIZE - default size of enumeration types

Modes: COMPILE(inline)

Sets the default size for enumeration types in bytes (1,2, or 4). If an enumeration type does not fit in the current default size, the smallest suitable size will be taken.

### ENV_HOST - host platform

Modes: *

A symbolic name of the host platform.

### ENV_TARGET - target platform

Modes: *

This equation is always set to a symbolic name of the target platform (CPU/operating system).

### ERRFMT - error message format

Modes: *

Sets the error message format. See Error message format specification for details.

### ERRLIM - maximum number of errors

Modes: *

Sets the maximum number of errors allowed for one compilation unit (by default 16).

### FILE - name of the file being compiled

Modes: COMPILE

The compiler sets this equation to the name of the currently compiled file. See also the MODULE equation.

### GCTHRESHOLD - garbage collector threshold (obsolete)

Modes: COMPILE,top-level module only

This equation is left for compatibility; it is ignored by the compiler. In versions prior to 2.50, it was used to fine tune the garbage collector.

See also Memory management.

### HEAPLIMIT - generated program heap limit

Modes: COMPILE,top-level module only

Sets the maximum amount of heap memory, that can be allocated by the generated program. The value is set in bytes.

Setting this equation to zero enables the run-time system to dynamically adjust heap size according to application's memory demands and system load.

The equation should be set when the top-level module of the program is compiled. We recommend to set it in a project file or the configuration file.

See also Memory management.

### LINK - linker command line

Modes: PROJECT

Defines a command line, which will be executed after a successful completion of a project. As a rule, the equation is used for calling a linker or make utility.

See Building a program for examples.

### LOOKUP - lookup directive

Modes: *

Syntax:

`-LOOKUP = pattern = directory {";" directory }`

The equation can be used for defining additional search paths that would complement those set in the redirection file. A configuration or project file may contain several LOOKUP equations; they are also permitted on the command line.

See also Redirection file and Project files.

### MINCPU - minimal CPU required for execution

Modes: COMPILE

Specifies an Intel x86 family representative which (or higher) is requried for the resulting program to be executed.

Valid values: "GENERIC", "386", "486", "PENTIUM", and "PENTIUMPRO". For this equation, "GENERIC" is equivalent to "386". The value of the CPU equation must be "greater of equal" than the value of this equation.

### MKFEXT - makefile extension

Modes: GEN

Sets the file extension for generated makefiles (by default .mkf). See GEN mode.

### MKFNAME - makefile name

Modes: GEN

Sets the name for a generated makefile. See GEN mode.

### MOD - Modula-2 implementation or main module extension

Modes: *

Sets the file extension for Modula-2 implementation and program modules (by default .mod).

### MODULE - name of the module being compiled

Modes: COMPILE

The compiler sets this equation to the name of the currently compiled module. See also the FILE equation.

### OBERON - Oberon-2 module extension

Modes: *

Sets the file extension for Oberon-2 modules (by default .ob2).

### OBJEXT - object file extension

Modes: *

Sets the file extension for object files (by default .o).

### OBJFMT - object file format

Modes: COMPILE

Sets format for output object files. Valid values are "OMF", "COFF" and "ELF".

### PRJ - project file name

Modes: COMPILE,MAKE,PROJECT

In the COMPILE and MAKE operation modes, the equation defines a project file to read settings from. In the PROJECT mode, the compiler sets this equation to a project file name from the command line. See PROJECT mode.

### PRJEXT - project file extension

Modes: COMPILE,MAKE,PROJECT

Sets the file extension for project files (by default .prj). See PROJECT mode.

### PROJECT - project name

Modes: COMPILE,MAKE,PROJECT

If a project file name is defined, the compiler sets the equation to a project name without a file path and extension. For example, if the project file name is `prj/Work.prj`, the value of the equation is set to `Work`. The equation may be used, for instance, in a template file to set the name of the executable file.

### SETSIZE - default size of small set types

Modes: COMPILE(inline)

Sets the default size for small (16 elements or less) set types in bytes (1,2, or 4). If a set type does not fit in the current default size, the smallest suitable size will be taken.

### STACKLIMIT - generated program stack limit

Modes: COMPILE,top-level module only

Sets the maximum size of the stack in a generated program. The value is set in bytes.

The equation should be set when a top-level module of a program is compiled. We recommend to set the option in the project or configuration file.

Note: for some linkers the stack size should be also set as a linker option.

### SYM - symbol file extension

Modes: *

Sets the file extension for symbol files (by default .sym). See Files generated during compilation.

### TABSTOP - tabulation alignment

Modes: GEN

When reading text files, the compiler replaces the ASCII TAB character with the number of spaces required to align text (by default TABSTOP is equal to 8). A wrong value may cause misplaced comments in a generated pseudo-definition module, incorrect error location in an error message, etc. We recommend to set this equation to the number used in your text editor.

### TEMPLATE - template name (for makefile)

Modes: GEN

Sets a name of a template file. See Template files.

## Error message format specification

The format in which XDS reports errors is user configurable through the ERRFMT equation. Its syntax is as follows:

`{ string "," [ argument ] ";" }`

Any format specification allowed in the C procedure `printf` can be used in `string`.

Argument | Type | Meaning
line | integer | position in a source text
column | integer | position in a source text
file | string | name of a source file
module | string | module name
errmsg | string | message text
errno | integer | error code
language | string | Oberon-2 or Modula-2
mode | string | ERROR or WARNING or FAULT
utility | string | name of an utility

Argument names are not case sensitive. By default, the error message format includes the following clauses:

`"(%s",file;` | --- | a file name
`"%d",line;` | --- | a line number
`",%d",column;` | --- | a column number
`") [%.1s] ",mode;` | --- | the first letter of an error mode
`"%s\n",errmsg;` | --- | an error message

If a warning is reported for the file `test.mod` at line 5, column 6, the generated error message will look like this:

`(test.mod 5,6) [W] variable declared but never used`

## The system module COMPILER

The system module `COMPILER` provides two procedures which allow you to use compile-time values of options and equations in your Modula-2 or Oberon-2 program:

        PROCEDURE OPTION(<constant string>): BOOLEAN;
        PROCEDURE EQUATION(<constant string>): <constant string>;

Both this procedures are evaluated at compile-time and may be used in constant expressions.

Note: The `COMPILER` module is non-standard.

##### Examples

    Printf.printf("This program is optimized for the %s CPU\n",
                  COMPILER.EQUATION("CPU"));

    IF COMPILER.OPTION("__GEN_C__") THEN
      ...
    END;