Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Address = SYSTEM.ADDRESS; TYPE UntracedAddress = SYSTEM.UNTRACEDADDRESS; TYPE IntAddress = LONGINT; TYPE Count = LONGINT; TYPE Size = Count; TYPE Byte = BYTE;
CONST bigEndian = 0; littleEndian = 1; CONST byteorder = bigEndian; (* machine-dependent constant *) TYPE ByteOrder = SHORTINT; (* bigEndian or littleEndian *)
TYPE Int8 = SHORTINT; TYPE Int16 = SYSTEM.INT16; TYPE Int32 = LONGINT;
TYPE Real32 = REAL; TYPE Real64 = REAL; TYPE Real128 = LONGREAL;
CONST bigEndian = 0; (* SPARC, M68K etc *) CONST littleEndian = 1; (* Intel 80x86, VAX etc *) CONST byteorder = bigEndian; (* machine-dependent constant *) TYPE ByteOrder = SHORTINT; (* bigEndian or littleEndian *)
(* relationship between SET and INTEGER *) TYPE SetInt = INTEGER; (* INTEGER type that corresponds to SET *) CONST msb = SYS.VAL(SET, MIN(SetInt)); CONST msbIsMax = SYS.VAL(SHORTINT, (msb = {MAX(SET)})); CONST msbIs0 = SYS.VAL(SHORTINT, (msb = {0})); CONST msbindex = msbIsMax * MAX(SET); CONST lsbindex = MAX(SET) - msbindex; CONST nofbits = MAX(SET) + 1;
PROCEDURE ToInt8(int: LONGINT) : Int8; PROCEDURE ToInt16(int: LONGINT) : Int16; PROCEDURE ToInt32(int: LONGINT) : Int32;
PROCEDURE ToReal32(real: LONGREAL) : Real32; PROCEDURE ToReal64(real: LONGREAL) : Real64; PROCEDURE ToReal128(real: LONGREAL) : Real128;
Count is expected to be the return type of LEN, and consequently an appropriate type for array indices. Size should be compatible to the return type of SYSTEM.SIZE. Some Oberon compilers define BYTE as standard type, others export BYTE from SYSTEM. Byte allows to avoid this compiler dependency.
The numeric types Int8 .. Real128 are expected to be defined to the best-fitting base type respectively, that is
Some constants and a type are provided to make conversions between SET and a corresponding integer type more portable. SetInt is the integer type whose size is identical to that of SET. The correspondence between set elements (ranging from 0 to MAX(SET)) and individual bits of an integer value that is represented as 2-complement depends on endianess and the discretion of the compiler writer. msbindex is the set element that corresponds to the most significant bit; likewise lsbindex designates the set element representing the least significant bit. Both constants depend on following auxiliary constants:
Oberon || Library || Module Index || Search Engine || Definition || Module