SiroccoPrivate.Mesa
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
Bhargava, August 9, 1986 1:52:41 pm PDT
Demers, January 5, 1987 1:23:53 am PST
Bill Jackson (bj) August 25, 1987 6:57:33 pm PDT
DIRECTORY
IO USING [ STREAM ],
PriorityQueue USING [ Ref, SortPred ],
Rope USING [ ROPE ],
SiroccoCGDef USING [ Generic, ItemKind, ValueKind ],
RefTab USING [ Ref ],
SymTab USING [ Ref ];
SiroccoPrivate: CEDAR DEFINITIONS ~ {
ROPE: TYPE ~ Rope.ROPE;
Version: READONLY ROPE;
Types
TypeGraph: TYPE ~ REF GraphRep;
GraphRep: TYPE ~ RECORD [
context: CONTEXT,
reftab: RefTab.Ref -- table of TypeGraphNode
];
CONTEXT: TYPE ~ REF ContextRep;
ContextRep: TYPE ~ RECORD [
rib: RIB,
scope: SCOPE
];
RIB: TYPE ~ SymTab.Ref; -- SCOPES keyed by id
SCOPE: TYPE ~ REF ScopeRep;
ScopeRep: TYPE ~ RECORD [
id: ROPE,
pgm: CARD,
version: CARD,
items: SymTab.Ref,
tables: TABLES -- this should die!
];
PQItem: TYPE ~ RECORD [
position: CARD,
element: REF
];
PQFirst: PriorityQueue.SortPred;
GraphTraversalState: TYPE ~ { unvisited, inprogress, completed };
ITEM: TYPE ~ REF ItemRep;
ItemRep: TYPE ~ RECORD [
name: ROPE,
position: CARD,
kind: SiroccoCGDef.ItemKind,
type: TypeGraphNode,
value: AbstractValue,
state: GraphTraversalState
];
TypeGraphNode: TYPE ~ REF;
NodeRep: TYPE ~ RECORD [
kind: TGNKind ← generic, -- indirect => specifics will be a TypeGraphNode
class: SiroccoCGDef.Generic ← unspec,
subtype: TypeGraphNode ← NIL,
specifics: REFNIL
];
TGNKind: TYPE ~ { indirect, generic, internal };
AbstractValue: TYPE ~ REF;
AbstractValueObject: TYPE ~ RECORD [
kind: TGNKind ← generic, -- indirect => specifics will be a TypeGraphNode
class: SiroccoCGDef.ValueKind ← null,
bool: BOOLFALSE,
card: CARD32 ← 0,
string: ROPENIL,
tag: ROPENIL,
subtype: AbstractValue ← NIL,
specifics: REFNIL
];
Signals
AquireState: SIGNAL RETURNS [Handle];
EndItAll: ERROR;
Operations
DumpTypeGraph: PROC [graph: TypeGraph];
Old Stuff
InterfaceItem: TYPE ~ RECORD [
name: ROPE,
type: ROPE,
constant: ROPE,
functions: LIST OF ROPE,
value: Constant
];
These are really ConstantNode, TypeNode...
Constant: TYPE ~ REF;
Type: TYPE ~ REF;
CTypeForName: PROC [interface, item: ROPE] RETURNS [ctype: CType ← NIL];
CTypeForPrimitive: PROC [SiroccoCGDef.Generic] RETURNS [ctype: CType ← NIL];
CTypeForArray: PROC [cons: Constant, etype: CType] RETURNS [ctype: CType ← NIL];
CTypeForEnum: PROC [enum: REF] RETURNS [ctype: CType ← NIL];
CTypeForFields: PROC [fields: REF] RETURNS [ctype: CType ← NIL];
CTypeForProc: PROC [args, results: REF, errors: REF] RETURNS [ctype: CType ← NIL];
CTypeForChoice: PROC [stype: CType, union: REF] RETURNS [ctype: CType ← NIL];
CType: TYPE ~ REF CTypeBody;
CTypeBody: TYPE ~ RECORD [
bound: CARD,
children: CComponent,
class: SiroccoCGDef.Generic
];
CComponent: TYPE ~ REF CComponentBody;
CComponentBody: TYPE ~ RECORD [
name: ROPE,
sibling: CComponent,
type: ROPE,
val: CARD
];
FunctionList: TYPE ~ LIST OF ROPE;
Tree: TYPE ~ REF ANY;
TABLES: TYPE ~ REF TablesBody;
TablesBody: TYPE ~ RECORD [
condensedTypeTable: SymTab.Ref,
directory: SymTab.Ref,
errors: SymTab.Ref,
functionTable: SymTab.Ref,
globalTable: SymTab.Ref,
index: PriorityQueue.Ref,
localTable: SymTab.Ref,
procedures: SymTab.Ref,
typeTable: SymTab.Ref,
unresolvedConstantTable: SymTab.Ref,
unresolvedTypeTable: SymTab.Ref,
workTable: SymTab.Ref
];
UnresolvedConstantTableEntry: TYPE ~ RECORD [
constant: Constant,
type: Type
];
Handle: TYPE ~ REF Object;
Object: TYPE ~ RECORD [
allTheTables: TABLES,
defStream: IO.STREAM,
defRope: ROPE,
initStream: IO.STREAM,
initfile: ROPE,
programName: ROPE,
programNo: NAT,
programKey: ROPE,
programKeyWD: ROPE,
uniqueNo: NAT,
uniqueName: ROPE,
versionNo: NAT
];
Procs
SiroccoPrivateImpl
Nest: PROC [in: ROPE, level: NAT] RETURNS [out: ROPE];
Append newline and level tabs to in.
Sort: PROC [list: CComponent] RETURNS [comp: CComponent];
Sort (list of) CComponents by the .val field
MakeUpName: PROC [base: ROPE, suffix: ROPE, tables: TABLES]
RETURNS [madeUpName: ROPE];
MadeUpName: PROC [base: ROPE, suffix: ROPE]
RETURNS [madeUpName: ROPE];
UnDo: PROC [in: ROPE, programKey: ROPE] RETURNS [key: ROPE];
Strip unnecessary qualification (by current program key) from beginning of in — e.g. UnDo["FooP1V2.Bar", "FooP1V2"] = "Bar".
UnDoable: PROC [in: ROPE, programKey: ROPE] RETURNS [out: ROPE, yes: BOOLEAN];
Like UnDo, also returns yes~TRUE iff qualification was deleted.
UMProcNameProc: TYPE ~ PROC [h: Handle, type: CType, typeName: ROPE]
RETURNS [procName: ROPE];
Returns name of special (un)marshalling proc to be used, or NIL if none.
GetUProcName: UMProcNameProc;
GetMProcName: UMProcNameProc;
GenerateUMProcs: PROC [h: Handle, s: IO.STREAM, level: NAT];
Marshal: PROC [h: Handle, s: IO.STREAM, varName: ROPE, type: CType, typeName: ROPE, getProcName: UMProcNameProc, useProc: BOOL, level: NAT];
UnMarshal: PROC [h: Handle, s: IO.STREAM, varName: ROPE, type: CType, typeName: ROPE, getProcName: UMProcNameProc, useProc: BOOL, level: NAT];
ConstExp: PROC [h: Handle, const: ROPE, type: CType, typeName: ROPE, level: NAT]
RETURNS [constExp: ROPE, setup: LIST OF ROPE, runtime: BOOL];
TypeExp: PROC [h: Handle, type: CType, typeName: ROPE, level: NAT]
RETURNS [typeExp: ROPE, objTypeDecls: LIST OF ROPE];
FileHeader: PROC [out: IO.STREAM, filename: ROPE];
ParserPrivate1Impl
Collapse: PROC;
Generate Things
GenDefs: PROC;
GenAuxDefs: PROC;
GenAuxImpl: PROC;
GenCImpl: PROC;
GenSImpl: PROC;
}.