CedarBaseType:
CEDAR
DEFINITIONS ~ {
idNode: TYPE ~ SaffronGenericDef.idNode;
TypeGraph
A TypeGraph contains four parts: a set of Paint's, a set S of TypeIndex's, a map from S to TypeNode, and a map from S to Size.
TypeGraph: TYPE ~ REF TypeGraphRep;
TypeGraphRep: TYPE;
PrintTypeGraph: PROC [TypeGraph, IO.STREAM] RETURNS [BOOLEAN];
CreateTypeGraph: PROC [] RETURNS [TypeGraph];
XTypeGraph:
PROC [TypeGraph]
RETURNS [TypeGraph];
The identity fcn . . . needed to keep Casaba happy.
AddType:
PROC [TypeGraph, TypeNode]
RETURNS [TypeGraph, TypeIndex];
A new TypeIndex is added to the TypeGraph, the pair <TypeIndex, TypeNode> is added to the TypeNode map, and the pair <TypeIndex, BuildUnknownSize[]> is added to the Size map.
SetType:
PROC [TypeGraph, TypeNode, TypeIndex]
RETURNS [TypeGraph];
Updates the TypeNode map.
RawFetchType:
PROC [TypeGraph, TypeIndex]
RETURNS [TypeNode];
Gives the value of the TypeNode map at TypeIndex.
NewPaint:
PROC [TypeGraph]
RETURNS [TypeGraph, Paint];
Allocates a new Paint.
TypeIndex
A TypeIndex is used as the range of maps in a TypeGraph. The UndefinedTypeIndex is used as special value for various silly reasons.
TypeIndex: TYPE ~ REF TypeIndexRep;
TypeIndexRep: TYPE;
PrintTypeIndex: PROC [TypeIndex, IO.STREAM] RETURNS [BOOLEAN];
UndefinedTypeIndex: PROC [] RETURNS [TypeIndex];
IsUndefinedTypeIndex: PUBLIC PROC [TypeIndex] RETURNS [BOOLEAN];
XTypeIndex: PROC [TypeIndex] RETURNS [TypeIndex];
TypeNode
TypeNode: TYPE ~ REF TypeNodeRep;
TypeNodeRep: TYPE;
PrintTypeNode: PROC [TypeNode, IO.STREAM] RETURNS [BOOLEAN];
GetPaint: PROC [TypeNode] RETURNS [Paint];
GetTypeBounds: PROC [TypeNode] RETURNS [TypeBounds];
BuildSuspendedType: PROC [REF] RETURNS [TypeNode];
IsSuspendedType: PROC [TypeNode] RETURNS [BOOLEAN];
GetTypeDecl:
PROC [TypeNode]
RETURNS [
REF
ANY];
A type whose declaration has not yet been examined.
BuildInaccessibleType: PROC [] RETURNS [TypeNode];
IsInaccessibleType:
PROC [TypeNode]
RETURNS [
BOOLEAN];
A type whose declaration is currently being examined. If you bump into one of these, you have detected an illegal type circularity.
BuildRecordType: PROC [FieldList] RETURNS [TypeNode];
BuildEnumType: PROC [Paint, EltList] RETURNS [TypeNode];
IsEnumType: PROC [TypeNode] RETURNS [BOOLEAN];
EnumTypeEltList: PROC [TypeNode] RETURNS [EltList];
BuildSubrangeType: PROC [TypeNode, TypeBounds] RETURNS [TypeNode];
BuildRefType: PROC [TypeIndex] RETURNS [TypeNode];
IsRefType: PROC [TypeNode] RETURNS [BOOLEAN];
GetReferentType: PROC [TypeNode] RETURNS [TypeIndex];
Paint
Paint is used to distinguish types. Types that are unpainted have Undefined Paint.
Paint: TYPE ~ RECORD [val: INT, paint: RECORD[] ← NULL]; -- a painted type
PaintEqual: PROC [Paint, Paint] RETURNS [BOOLEAN];
BuildUndefinedPaint: PROC RETURNS [Paint];
IsUndefinedPaint: PROC [Paint] RETURNS [BOOLEAN];
TypeBounds
TypeBound's represent restrictions put on types via subrange constructors. A subrange constructor doesn't create a new type . . . it creates an identical TypeNode, except for the TypeBounds component.
TypeBounds: TYPE ~ REF TypeBoundsRep;
TypeBoundsRep: TYPE;
BuildUndefinedTypeBounds: PROC RETURNS [TypeBounds];
IsUndefinedTypeBounds: PROC [TypeBounds] RETURNS [BOOLEAN];
BuildTypeBounds: PROC [OrdinalValue, OrdinalValue, BOOLEAN, BOOLEAN] RETURNS [TypeBounds];
FieldList
Used for records . . . its either named or unnnamed.
FieldList: TYPE ~ REF FieldListRep;
FieldListRep: TYPE;
BuildNullFieldList: PROC [] RETURNS [FieldList];
BuildNamedFieldList: PROC [NamedFieldList] RETURNS [FieldList];
BuildUnnamedFieldList: PROC [UnnamedFieldList] RETURNS [FieldList];
NamedFieldList
NamedFieldList: TYPE ~ REF NamedFieldListRep;
NamedFieldListRep: TYPE;
CreateNamedFieldList: PROC [] RETURNS [NamedFieldList];
AddNamedField: PROC [NamedFieldList, idNode, FieldDescriptor] RETURNS [NamedFieldList, BOOLEAN];
UnnamedFieldList
UnnamedFieldList: TYPE ~ REF UnnamedFieldListRep;
UnnamedFieldListRep: TYPE;
CreateUnnamedFieldList: PROC [] RETURNS [UnnamedFieldList];
AddUnnamedField: PROC [UnnamedFieldList, FieldDescriptor] RETURNS [UnnamedFieldList];
FieldDescriptor
FieldDescriptor: TYPE ~ REF FieldDescriptorRep;
FieldDescriptorRep: TYPE;
BuildFieldDescriptor: PROC [TypeIndex] RETURNS [FieldDescriptor];
GetFieldType: PROC [FieldDescriptor] RETURNS [TypeIndex];
EltList
EltList: TYPE ~ REF EltListRep;
EltListRep: TYPE;
BuildEmptyEltList: PROC [] RETURNS [EltList];
EltListInsert: PROC [EltList, idNode] RETURNS [EltList, BOOLEAN];
EltListLookup: PROC [EltList, idNode] RETURNS [OrdinalValue];
OrdinalValue
OrdinalValue: TYPE ~ REF OrdinalValueRep;
OrdinalValueRep: TYPE;
PrintOrdinalValue: PROC [OrdinalValue, IO.STREAM] RETURNS [BOOLEAN];
IsUndefinedOrdinalValue: PROC [OrdinalValue] RETURNS [BOOLEAN];
BuildOrdinalValue: PROC [INT] RETURNS [OrdinalValue];
BuildUndefinedOrdinalValue: PROC [] RETURNS [OrdinalValue];
Size
Represents the storage requirements for objects of a given type.
Size: TYPE ~ REF SizeRep;
SizeRep: TYPE;
BuildUnknownSize: PROC [] RETURNS [Size];
IsUnknownSize:
PROC [Size]
RETURNS [
BOOLEAN];
Associated with TypeIndex's whose size calculation has not been performed.
BuildInaccessibleSize: PROC [] RETURNS [Size];
IsInaccessibleSize:
PROC [Size]
RETURNS [
BOOLEAN];
Associated with TypeIndex's whose size calculation is in progress . . . if you bump into one of these, you have discovered an illegal circular type.
BuildKnownSize: PROC [INT] RETURNS [Size];
IsKnownSize:
PROC [Size]
RETURNS [
BOOLEAN];
Associated with TypeIndex's whose size calculation is complete.
}...