Module Interface RT0

SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST

# RT0

Proxy module for the run-time system. This module is used to pull in the executable code of the run-time system, and to mark the place of the run-time system's header files. This module's directory is added to the include path of the C compiler, so that ``__oo2c.h`', ``__typemap.h`', and so on, are picked up from here.

The compiler implicitly adds an import for this module to every module. A program may import this module directly, for example to gain access to meta data embedded by the compiler into a module's object file. Please note that this module should be considered a part of the compiler, not of the standard library. As such, it may differ across different compiler implementations, and for a given compiler its interface might change without prior notice.

Note: The math library ``libm`' is always linked in for the sake of the predefined function ENTIER.

Class List
Module |
Struct |

Class Summary: Module [Detail]
      +--RT0.Module
Field Summary
name-: Name Name of the module.
typeDescriptors-: POINTER TO ARRAY OF Struct All type descriptors of this module that correspond to named types defined on the top level.
Constructor Summary
ThisModule(ARRAY OF CHAR): Module Returns the module descriptor for the module name.

Class Summary: Struct [Detail]
      +--RT0.Struct
Field Summary
baseTypes-: POINTER TO ARRAY OF Struct Array element type, pointer base type, or list of record base types.
form-: SHORTINT Identifies which kind of type constructor variant is used.
len-: LONGINT Holds the length of an array, the number of open dimensions of an open array, or the extension level of a record.
module-: Module The module that defines this type descriptor.
name-: Name Type name.
size-: LONGINT Size of the data type in bytes.
tbProcs-: POINTER TO ARRAY OF PTR Table of type-bound procedures of a record type.
Constructor Summary
ThisType(Module, ARRAY OF CHAR): Struct Returns the type descriptor for the type name of module mid.
TypeOf(PTR): Struct Returns the type of the record pointer ptr.

Type Summary
Name = POINTER TO ARRAY OF CHAR

Procedure Summary
CollectGarbage() Explicitly trigger a full, world-stop garbage collection.
ErrorAssertionFailed(Module, LONGINT, LONGINT)
ErrorDerefOfNil(Module, LONGINT)
ErrorFailedCase(Module, LONGINT, LONGINT)
ErrorFailedFunction(Module, LONGINT)
ErrorFailedTypeAssert(Module, LONGINT)
ErrorFailedTypeGuard(Module, LONGINT, Struct)
ErrorFailedWith(Module, LONGINT, Struct)
ErrorIndexOutOfRange(Module, LONGINT, LONGINT, LONGINT)
FreeBlock(PTR) Frees a block of memory allocated with NewBlock.
GetEnv(ARRAY OF CHAR, VAR ARRAY OF CHAR): BOOLEAN If an environment variable name exists, copy its value into value and return TRUE.
Halt(LONGINT)
NewBlock(LONGINT): PTR Allocates a memory block on the heap with a size of at least bytes bytes.
NewObject(Struct): PTR Allocates a new array or record variable on the heap, using the type descriptor td.
RegisterModule(Module) Registers the module descriptor with the run-time system.

Variable Summary
argc-: LONGINT
argv-: POINTER TO ARRAY OF POINTER TO ARRAY OF CHAR
boolean-: StructDesc
byte-: StructDesc
char-: StructDesc
integer-: StructDesc
longchar-: StructDesc
longint-: StructDesc
longreal-: StructDesc
poisonHeap: LONGINT If set to a non-negative value, then memory allocated through NewObject and NewBlock is filled with this byte value.
ptr-: StructDesc
real-: StructDesc
set32-: StructDesc
shortint-: StructDesc
ucs4char-: StructDesc

Constant Summary
strArray An array definition with a fixed length, as in ``ARRAY 123 OF CHAR`'.
strBoolean
strByte
strChar
strInteger
strLongchar
strLongint
strLongreal
strOpenArray An array definition with an unspecified length, as in ``ARRAY OF CHAR`'.
strPointer A pointer definition of the form ``POINTER TO T`'.
strPtr
strReal
strRecord A record, either in its C struct or union variant.
strSet32
strShortint
strUCS4Char

Class Detail: Module

Field Detail

### name

    FIELD name-: Name

> Name of the module.

### typeDescriptors

    FIELD typeDescriptors-: POINTER TO ARRAY OF Struct

> All type descriptors of this module that correspond to named types defined on the top level. Descriptors are listed in no particular order. The last element of the array has the value NIL.

Constructor Detail

### ThisModule

    PROCEDURE ThisModule(name: ARRAY OF CHAR): Module

> Returns the module descriptor for the module name. Result is NIL if no module of this name has been registered.

Class Detail: Struct

Field Detail

### baseTypes

    FIELD baseTypes-: POINTER TO ARRAY OF Struct

> Array element type, pointer base type, or list of record base types. For predefined scalar types this field is NIL.

### form

    FIELD form-: SHORTINT

> Identifies which kind of type constructor variant is used.

### len

    FIELD len-: LONGINT

> Holds the length of an array, the number of open dimensions of an open array, or the extension level of a record.

### module

    FIELD module-: Module

> The module that defines this type descriptor. For predefined types, this is a reference to module ``RT0`'.

### name

    FIELD name-: Name

> Type name. NIL for anonymous types.

### size

    FIELD size-: LONGINT

> Size of the data type in bytes. For an open array type, which has no static size of its own, this field is size of the first element type that is not an open array.

### tbProcs

    FIELD tbProcs-: POINTER TO ARRAY OF PTR

> Table of type-bound procedures of a record type. This field is NIL for all other types.

Constructor Detail

### ThisType

    PROCEDURE ThisType(mid: Module;
                       name: ARRAY OF CHAR): Struct

> Returns the type descriptor for the type name of module mid. Result is NIL if there is not such type descriptor.

### TypeOf

    PROCEDURE TypeOf(ptr: PTR): Struct

> Returns the type of the record pointer ptr. The address ptr must be a previous result of NewObject. Result is undefined if ptr is not a reference to a record object.

Type Detail

### Name

    TYPE Name = POINTER TO ARRAY OF CHAR

Procedure Detail

### CollectGarbage

    PROCEDURE CollectGarbage()

> Explicitly trigger a full, world-stop garbage collection.

### ErrorAssertionFailed

    PROCEDURE ErrorAssertionFailed(mid: Module;
                                   pos: LONGINT;
                                   code: LONGINT)

### ErrorDerefOfNil

    PROCEDURE ErrorDerefOfNil(mid: Module;
                              pos: LONGINT)

### ErrorFailedCase

    PROCEDURE ErrorFailedCase(mid: Module;
                              pos: LONGINT;
                              select: LONGINT)

### ErrorFailedFunction

    PROCEDURE ErrorFailedFunction(mid: Module;
                                  pos: LONGINT)

### ErrorFailedTypeAssert

    PROCEDURE ErrorFailedTypeAssert(mid: Module;
                                    pos: LONGINT)

### ErrorFailedTypeGuard

    PROCEDURE ErrorFailedTypeGuard(mid: Module;
                                   pos: LONGINT;
                                   typeTag: Struct)

### ErrorFailedWith

    PROCEDURE ErrorFailedWith(mid: Module;
                              pos: LONGINT;
                              typeTag: Struct)

### ErrorIndexOutOfRange

    PROCEDURE ErrorIndexOutOfRange(mid: Module;
                                   pos: LONGINT;
                                   index: LONGINT;
                                   length: LONGINT)

### FreeBlock

    PROCEDURE FreeBlock(ptr: PTR)

> Frees a block of memory allocated with NewBlock.

### GetEnv

    PROCEDURE GetEnv(name: ARRAY OF CHAR;
                     VAR value: ARRAY OF CHAR): BOOLEAN

> If an environment variable name exists, copy its value into value and return TRUE. Otherwise, return FALSE.

### Halt

    PROCEDURE Halt(code: LONGINT)

### NewBlock

    PROCEDURE NewBlock(bytes: LONGINT): PTR

> Allocates a memory block on the heap with a size of at least bytes bytes. Pointers in the allocated block are ignored during garbage collection. That is, the block must not contain any references to objects on the heap that are not kept live by other pointers.

### NewObject

    PROCEDURE NewObject(td: Struct): PTR

> Allocates a new array or record variable on the heap, using the type descriptor td. For an open array object, the lengths of the array's dimensions are passed as second, third, and so on, parameter. They must be of type LONGINT.

### RegisterModule

    PROCEDURE RegisterModule(mid: Module)

> Registers the module descriptor with the run-time system.

Variable Detail

### argc

    VAR argc-: LONGINT

### argv

    VAR argv-: POINTER TO ARRAY OF POINTER TO ARRAY OF CHAR

### boolean

    VAR boolean-: StructDesc

### byte

    VAR byte-: StructDesc

### char

    VAR char-: StructDesc

### integer

    VAR integer-: StructDesc

### longchar

    VAR longchar-: StructDesc

### longint

    VAR longint-: StructDesc

### longreal

    VAR longreal-: StructDesc

### poisonHeap

    VAR poisonHeap: LONGINT

> If set to a non-negative value, then memory allocated through NewObject and NewBlock is filled with this byte value. Otherwise, the memory is left as provided by the used libc or libgc library. This is the default.

### ptr

    VAR ptr-: StructDesc

### real

    VAR real-: StructDesc

### set32

    VAR set32-: StructDesc

### shortint

    VAR shortint-: StructDesc

### ucs4char

    VAR ucs4char-: StructDesc

Constant Detail

### strArray

    CONST strArray

> An array definition with a fixed length, as in ``ARRAY 123 OF CHAR`'.

### strBoolean

    CONST strBoolean

### strByte

    CONST strByte

### strChar

    CONST strChar

### strInteger

    CONST strInteger

### strLongchar

    CONST strLongchar

### strLongint

    CONST strLongint

### strLongreal

    CONST strLongreal

### strOpenArray

    CONST strOpenArray

> An array definition with an unspecified length, as in ``ARRAY OF CHAR`'.

### strPointer

    CONST strPointer

> A pointer definition of the form ``POINTER TO T`'.

### strPtr

    CONST strPtr

### strReal

    CONST strReal

### strRecord

    CONST strRecord

> A record, either in its C struct or union variant.

### strSet32

    CONST strSet32

### strShortint

    CONST strShortint

### strUCS4Char

    CONST strUCS4Char