VariantRecords.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Sturgis, November 20, 1988
Sturgis, December 12, 1988 3:50:07 pm PST
Last changed by Theimer on July 16, 1989 4:36:43 pm PDT
Spreitze, May 21, 1991 8:38 am PDT
Laurie Horton, January 29, 1992 9:42 am PST
DIRECTORY
CirioTypes USING[CompilerContext, Mem, Node, Type],
Rope USING[ROPE];
VariantRecords: CEDAR DEFINITIONS =
BEGIN
Type: TYPE = CirioTypes.Type;
Mem: TYPE = CirioTypes.Mem;
Node: TYPE = CirioTypes.Node;
CC: TYPE = CirioTypes.CompilerContext;
The preamble type is expected to behave like a FieldList type.
The tag type is expected to be an Enumerated type.
The tail types are expected to be Record or VariantRecord types.
index is in [0..nTailTypes)
CreateVariantRecordType: PROC[preamble: Type, tailName: Rope.ROPE, tagName: Rope.ROPE, tagType: Type, nTailTypes: INT, controlled: BOOL, details: VariantRecordTypeDetails, cc: CC, procData: REF ANY] RETURNS[Type];
CCTypes.GetTypeRepresentation will return procData.
VariantRecordTypeDetails: TYPE ~ REF VariantRecordTypeDetailsRec;
VariantRecordTypeDetailsRec: TYPE ~ RECORD [
createIndirectNode: PROC [cc: CC, procData: REF ANY, indirectType, targetType: Type, mem: Mem] RETURNS [Node],
getBitSize: PROC[indirectType: Type, cc: CC, procData: REF ANY] RETURNS[CARD],
getTailType: PROC[index: INT, procData: REF ANY] RETURNS[Type]
];
maybe this should be a CRTypes object action?
GetVRVariant: PROC[vrType: Type, index: INT, cc: CC] RETURNS[Type];
IndirectVRNodeProcs: TYPE = RECORD[
selectPreamble: PROC[procsData: REF ANY, cc: CC] RETURNS[Node],
readVariantIndex: PROC[procsData: REF ANY, cc: CC] RETURNS[INT],
selectTag: PROC[procsData: REF ANY, cc: CC] RETURNS[Node],
selectTailBody: PROC[procsData: REF ANY, cc: CC] RETURNS[Node],
getPointer: PROC[procsData: REF ANY, cc: CC] RETURNS[Node]];
VariantRecordNodeProcs: TYPE = RECORD[
extractPreamble: PROC[procsData: REF ANY, cc: CC] RETURNS[Node],
variantIndex: PROC[procsData: REF ANY, cc: CC] RETURNS[INT],
extractTag: PROC[procsData: REF ANY, cc: CC] RETURNS[Node],
extractTailBody: PROC[procsData: REF ANY, cc: CC] RETURNS[Node]];
CreateIndirectVariantRecordNode: PROC[vrType: Type, procs: REF IndirectVRNodeProcs, procsData: REF ANY, cc: CC] RETURNS[Node];
CreateVariantRecordNode: PROC[type: Type, procs: REF VariantRecordNodeProcs, procsData: REF ANY, cc: CC, alreadyLoaded: BOOLEAN ¬ FALSE] RETURNS[Node];
END..