SELECT (class ← TypeClass[type])
FROM
$definition => ERROR;
$enumerated => {
SELECT
LOOPHOLE[TypeContext[type],
CARDINAL]
FROM
4 =>
This is the special common case for BOOLEAN
AppendCode[boolean];
ENDCASE => {
WITH x: stb.seb[
LOOPHOLE[type, Symbols.CSEIndex]]
SELECT
FROM
enumerated => {
p: LONG POINTER TO enumerated cons Symbols.SERecord ← @x;
IF p.unpainted
THEN {
RRA: Unpainted enumeration types are identified by their name/value pairs
AppendCode[enumerated];
AppendCode[leftParen];
FOR iSei: ISEIndex ← stb.FirstCtxSe[TypeContext[type]], stb.NextSe[iSei]
WHILE iSei#ISENull
DO
AppendName[stb.NameForSe[iSei]];
AppendCardinal[stb.seb[iSei].idValue];
ENDLOOP;
AppendCode[rightParen];
}
ELSE {
Painted enumeration types are identified by their paint alone
AppendCode[paint];
AppendPaint[type];
};
};
ENDCASE => ERROR;
};
};
$record => {
There are a few special records. Other records are painted.
SELECT
LOOPHOLE[TypeContext[type],
CARDINAL]
FROM
6 => AppendCode[text];
8 => AppendCode[stringBody];
10 => AppendCode[condition];
12 => AppendCode[lock];
ENDCASE => {AppendCode[paint]; AppendPaint[type]};
};
$structure => {
A structure is an unpainted record. To uniquely identify it we must put out the name and type for each field in order.
ctx: CTXIndex = TypeContext[type];
WITH c~~stb.ctxb[ctx]
SELECT
FROM
included => IF ~c.complete THEN ERROR;
ENDCASE;
AppendCode[leftParen];
FOR iSei: ISEIndex ← stb.FirstCtxSe[ctx], stb.NextSe[iSei]
WHILE iSei#ISENull
DO
AppendField[iSei];
ENDLOOP;
AppendCode[rightParen];
};
$union => {
RRA: unfortunately, all unions are painted, which means that unions within unpainted records could cause bogus differences! Some day this may be fixed.
AppendCode[union];
AppendPaint[type];
};
$array => {
IF Packed[type] THEN AppendCode[packed];
AppendCode[array];
AppendTypeString[Domain[type]];
AppendTypeString[Range[type]]};
$sequence => {
IF Packed[type] THEN AppendCode[packed];
AppendCode[sequence];
AppendField[Tag[type]];
AppendTypeString[Range[type]]};
$subrange => {
-- 10 bytes
AppendCode[subrange];
AppendTypeString[Ground[type]];
AppendLongCardinal[First[type]];
AppendLongCardinal[Last[type]];
};
$opaque => {
csei: CSEIndex = LOOPHOLE[type];
WITH t~~stb.seb[csei]
SELECT
FROM
opaque =>
IF stb.seb[t.id].idCtx IN StandardContext THEN AppendCode[atomRec]
ELSE {AppendCode[opaque]; AppendPaint[type]};
ENDCASE => ERROR;
};
$countedZone, $uncountedZone => {
IF Mds[type] THEN AppendCode[mds];
AppendCode[class];
};
$list => {
list = REF RECORD[cdr]
IF Ordered[type] THEN AppendCode[ordered];
IF ReadOnly[type] THEN AppendCode[readOnly];
AppendCode[list];
AppendTypeString[ListArg[type]];
};
$relativeRef => {
AppendCode[relativeRef];
AppendTypeString[Base[type]];
AppendTypeString[Range[type]];
};
$ref => {
IF ReadOnly[type] THEN AppendCode[readOnly];
IF TypeClass[Range[type]] = $any
THEN AppendCode[refAny]
ELSE {AppendCode[ref]; AppendTypeString[Range[type]]};
};
$var => {
IF ReadOnly[type] THEN AppendCode[readOnly];
AppendCode[var];
AppendTypeString[Range[type]];
};
$pointer, $longPointer => {
IF Ordered[type] THEN AppendCode[ordered];
IF ReadOnly[type] THEN AppendCode[readOnly];
AppendCode[class];
AppendTypeString[Range[type]];
};
$descriptor, $longDescriptor => {
IF ReadOnly[type] THEN AppendCode[readOnly];
AppendCode[class];
AppendTypeString[Range[type]];
};
$procedure, $safeProc => {
AppendCode[class];
AppendTypeString[Domain[type]];
AppendTypeString[Range[type]];
};
$port, $program, $signal, $error => {
IF Safe[type] THEN AppendCode[safe];
AppendCode[class];
AppendTypeString[Domain[type]];
AppendTypeString[Range[type]];
};
$process => {
IF Safe[type] THEN AppendCode[safe];
AppendCode[process];
AppendTypeString[Range[type]];
};
$nil => {AppendCode[leftParen]; AppendCode[rightParen]};
$cardinal, $integer, $character, $longInteger, $longCardinal, $real, $type, $any, $unspecified, $longUnspecified =>
AppendCode[class];
$globalFrame, $localFrame => ERROR;
ENDCASE => ERROR;