Copyright (C) 1994, Digital Equipment Corp.
RTType provides access to the runtime type system.
\index{runtime type}
\index{type!runtime}
Each reference type is assigned a unique typecode. A typecode is
``proper'' if it lies in the range [0..MaxTypecode()]. The proper
typecodes include all those that correspond to actual types in the
running Modula-3 program. Other typecodes, proper and improper, may
be used internally by the runtime system and garbage collector.
Although the language requires that typecodes exist only for object
types and for traced reference types (including NULL), the
implementation of RTType also provides typecodes for untraced
reference types.
The values returned by the builtin operation TYPECODE correspond
to (a subset of) the proper typecodes.
INTERFACERTType ; IMPORT RT0; TYPE Typecode = RT0.Typecode; CONST NoSuchType: Typecode = LAST(Typecode);
A reserved typecode that represents unknown types.
PROCEDURE MaxTypecode(): Typecode;
Return the largest proper typecode.
PROCEDURE IsSubtype(a, b: Typecode): BOOLEAN;
ReturnTRUEiff the type corresponding toais a subtype of the type corresponding tob. It is a checked runtime error if eitheraorbis not a proper typecode.
PROCEDURE Supertype(tc: Typecode): Typecode;
Return the typecode of the declared supertype of the object type corresponding totc. Iftccorresponds toROOT,UNTRACED ROOTor a non-object reference type, returnNoSuchType. It is a checked runtime error iftcis not a proper typecode.
PROCEDURE IsTraced(tc: Typecode): BOOLEAN;
ReturnTRUEiff the type corresponding totcis traced.
PROCEDURE Get(tc: Typecode): RT0.TypeDefn;
Return a pointer to the typecell with typecode tc. It is a
checked runtime error to pass an improper typecode. PROCEDURE GetNDimensions(tc: Typecode): CARDINAL;
Return the number of open dimensions of the open array type that corresponds totc's referent. Iftc's referent is not an open array, return0.
END RTType.