CedarOtherPureTypes.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Sturgis, July 14, 1989 1:11:38 pm PDT
Last changed by Theimer on July 16, 1989 4:12:29 pm PDT
Last tweaked by Mike Spreitzer on May 15, 1991 7:07 am PDT
DIRECTORY
CirioTypes USING[BasicTypeInfo, CompilerContext, Mem, Node, Type],
CirioSyntacticOperations USING[ParseTree],
Rope USING[ROPE];
CedarOtherPureTypes: CEDAR DEFINITIONS =
BEGIN
ROPE: TYPE ~ Rope.ROPE;
CC: TYPE = CirioTypes.CompilerContext;
Type: TYPE = CirioTypes.Type;
Mem: TYPE = CirioTypes.Mem;
Node: TYPE = CirioTypes.Node;
BasicTypeInfo: TYPE = CirioTypes.BasicTypeInfo;
Each of the following types has only a single instance. These create routines will return that instance if it has already been created.
CreateBooleanType: PROC[cc: CC, bti: BasicTypeInfo] RETURNS[Type];
implemented in CedarOtherPureTypesImpl
CirioCode.GetTypeClass[type] = $Boolean
CCTypes.GetTypeRepresentation will return bti.
CreateCharType: PROC[cc: CC, bti: BasicTypeInfo] RETURNS[Type];
implemented in CedarOtherPureTypesImpl
CirioCode.GetTypeClass[type] = $char
CCTypes.GetTypeRepresentation will return bti.
There are more than one instance of the following types
Internal error types
CreateUnknownType: PROC[cc: CC, explanation: ROPENIL] RETURNS[Type];
CirioCode.GetTypeClass[type] = $unknown
CCTypes.GetTypeRepresentation will return the ROPE.
CreateTransparentType: PROC[cc: CC, tti: TransparentTypeInfo] RETURNS[Type];
CirioCode.GetTypeClass[type] = $transparent
CCTypes.GetTypeRepresentation will return tti.
TransparentTypeInfo: TYPE ~ REF TransparentTypeInfoBody;
TransparentTypeInfoBody: TYPE ~ RECORD [
createIndirectNode: PROC [tti: TransparentTypeInfo, cc: CC, indirectType, targetType: Type, mem: Mem] RETURNS [Node],
intro: ROPE,
bits: INT,
data: REF ANY];
Enumerated types
at some point, we have to collect the pure types into a single interface. For the moment, Enumerated types are here.
EnumeratedTypeProcs: TYPE = RECORD[
createIndirectNode: PROC [procsData: REF ANY, cc: CC, indirectType, targetType: Type, mem: Mem] RETURNS [Node],
getBitSize: PROC[procsData: REF ANY, cc: CC, indirectType, targetType: Type] RETURNS[CARD],
getPaint: PROC[procsData: REF ANY] RETURNS[REF ANY],
comparePaint: PROC[procsData: REF ANY, otherPaint: REF ANY] RETURNS[BOOLEAN],
idToIndex: PROC[id: ROPE, procsData: REF ANY] RETURNS[INT],
indexToId: PROC[index: INT, procsData: REF ANY] RETURNS[ROPE]];
index belongs to [0..nValues)
CreateEnumeratedType: PROC[nValues: INT, procs: REF EnumeratedTypeProcs, procsData: REF ANY, cc: CC] RETURNS[Type];
exported from CedarOtherPureTypesImpl
Supports CCTypes.GetTypeRepresentation[type, cc], which returns procsData.
CirioCode.GetTypeClass[type] = $enumerated
CreateEnumeratedSubtype: PROC[baseType: Type, bottomIndex, topIndex: INT, cc: CC] RETURNS[Type];
exported from CedarOtherPureTypesImpl
Supports CCTypes.GetTypeRepresentation[type, cc], which returns CCTypes.GetTypeRepresentation[baseType, cc].
CirioCode.GetTypeClass[type] = $enumerated
We include Rope types here, because they behave somewhat like pure types. On the other hand, we might also consider them to be a special case of Refs, or even not treat them as specific Cirio types at all, but rather by some sort of trap mechanism that would include other types implemented out of ordinary types. Like Boolean types etc, tehre is a single instance of this type. This create routine will return that instance if it has already been created.
CreateRopeType: PROC[cc: CC, bti: BasicTypeInfo] RETURNS[Type];
implemented in CedarOtherPureTypesImpl
CirioCode.GetTypeClass[type] = $rope
CCTypes.GetTypeRepresentation will return NIL.
We have the following node creation routines
CreateBooleanNode: PROC[val: BOOLEAN, cc: CC] RETURNS[Node];
exported from CedarOtherPureTypesImpl. CedarCode.GetNodeRepresentation returns a REF BOOLEAN, where the BOOLEAN is equal to val.
CreateCharNode: PROC[val: CHAR, cc: CC] RETURNS[Node];
exported from CedarOtherPureTypesImpl. CedarCode.GetNodeRepresentation returns a REF CHAR, where the CHAR is equal to val.
CreateUnknownTypeNode: PROC[type: Type, explanation: ROPE, cc: CC] RETURNS[Node];
CreateIndirectToAnUnknownType: PROC[type: Type, explanation: ROPE, cc: CC] RETURNS[Node];
CreateTransparentTypeNode: PROC[type: Type, tni: TransparentNodeInfo, cc: CC] RETURNS[Node];
CedarCode.GetNodeRepresentation returns the TNI.
TransparentNodeInfo: TYPE ~ REF TransparentNodeInfoBody;
TransparentNodeInfoBody: TYPE ~ RECORD [val: ROPE, lpad, rpad: INT];
We abuse the ROPE type here to hold a sequence of bytes.
lpad+rpad+type.bits = val.Length*8.
CreateEnumeratedTypeNode: PROC[type: Type, id: ROPE, cc: CC] RETURNS[Node];
exported from CedarOtherPureTypesImpl.
CedarCode.GetNodeRepresentation returns a REF CARD, where the CARD is equal to the index of the value.
CreateEnumeratedTypeNodeFromIndex: PROC[type: Type, index: CARD, cc: CC] RETURNS[Node];
exported from CedarOtherPureTypesImpl.
CedarCode.GetNodeRepresentation returns a REF CARD, where the CARD is equal to index.
CreateParseTreeNode: PROC[parseTree: CirioSyntacticOperations.ParseTree, cc: CC] RETURNS[Node];
exported from CedarOtherPureTypesImpl
CreateRopeNode: PROC[val: ROPE, cc: CC, addr: REF ANYNIL] RETURNS[Node];
exported from CedarOtherPureTypesImpl
CedarCode.GetNodeRepresentation returns the supplied val and address as a REF RopeInfo.
RopeInfo: TYPE ~ RECORD [val: ROPE, addr: REF ANY];
addr=NIL means doesn't exist (yet) in target world.
END..