Contents

Translating, linking and running programs

Translating

Translation from Object Icon source files to intermediate .u files is done by the program oit.

Input source files should have the suffix .icn (but see the -A option below). To translate one or more files, invoke oit as follows :-

oit -c file1.icn file2.icn ...

This will produce file1.u, file2.u etc.

Linking

The oit program is also used to link .u files together to form an executable file that can be run :-

oit -o prog file1.u file2.u ...

You can also go directly from the source file to the executable if you wish. In this case the intermediate .u files are deleted. For example :-

oit myprog.icn

Translates and links myprog.icn into an executable myprog.

Command line options

oit accepts the following command-line options :-

Invocable options

oit will try to remove unused parts of a program before generating an output file. This obviously reduces the output file’s size, and also helps improve the resulting program’s startup time and memory usage.

By default, oit will remove unused globals (procedures, records and classes), as well as unused methods. The latter are determined simply by checking whether a method’s name is referenced via a field name anywhere in the program. Globals are removed completely from the resulting program; removed methods are replaced by a stub method which, if it is somehow invoked, raises a runtime error.

Sometimes it is desirable to override this default behaviour because occasionally a global symbol or method may still be used, even if it is not explicitly referenced anywhere in a program. For example :-

To deal with these sort of situations the invocable declaration can be used to change the default behaviour just described.

Two command line options to oit are also provided. -f is equivalent to using invocable all, whilst -g is equivalent to invocable methods.

Running

The runtime system is contained in the program oix. It is not normally necessary to run that directly because the executable built by oit invokes it automatically.

oix can be invoked by oit by appending -x to the command line (followed by any desired runtime arguments). For example

oit myprog.icn -x

translates, links and runs myprog.icn. The executable file myprog is not deleted after completion (unlike the intermediate .u file).

Runtime environment variables

Several environment variables affect the behaviour of the interpreter, as shown in the following table.

Variable name Description Default value
OI_MAX_LEVEL The initial value of the &maxlevel keyword, which controls the level of invocation depth before a runtime error is signalled. 500
OI_STRING_SIZE The initial size of the string region. Based on the amount of system memory, up to a maximum of 20MB.
OI_BLOCK_SIZE The initial size of the block region. Based on the amount of system memory, up to a maximum of 40MB (20MB on 32-bit systems).
OI_MEM_CUSHION A percentage parameter to the garbage collector to prevent excessive numbers of collections occuring; see ralc.r for more details. 10%
OI_MEM_GROWTH A percentage parameter to the garbage collector to indicate the size of a new region relative to the previous one. 200%; in other words new regions are double the size of their predecessor.
OI_STACK_LIMIT A parameter to the garbage collector. Should the amount of “stack memory” (memory used in the invocation frames of co-expressions) exceed this amount, a collection occurs. Half the initial size of the initial block region’s size.
OI_STACK_CUSHION A percentage parameter to the garbage collector to prevent excessive numbers of collections occuring due to stack usage. After a collection triggered by the stack limit, the remaining uncollected stack usage is calculated, and multiplied by the stack cushion. The stack limit is then increased to that value if necessary. 150%
OI_CORE Indicates whether to call the C abort() function on an error exit. 0 means no, 1 means yes, but only on a system error, 2 means yes, on any error. 1
TRACE The initial value of the keyword &trace. 0
Contents