-- File [Ivy]<Nelson>Lupine>LupineSymbolTable.mesa. -- Last edited by BZM on 2-May-82 22:47:03. DIRECTORY File USING [Capability], Strings USING [String], Symbols USING [SEIndex, SENull, ISEIndex, ISENull], SymbolTable USING [Base], System USING [GreenwichMeanTime], TimeStamp USING [Stamp]; LupineSymbolTable: DEFINITIONS = BEGIN -- This is a FRAME handle for all symbol table variables and procedures. STBase: PRIVATE TYPE = SymbolTable.Base ← NIL | NULL; -- This is a nonRope string alternative suitable for SDD. String: TYPE = Strings.String ← StringNIL | NULL; StringNIL: String = NIL; -- Need nonNIL symbol so INLINEs compile OK. GMT: TYPE = System.GreenwichMeanTime; VersionStamp: TYPE = TimeStamp.Stamp; -- Interface file operations. OpenInterface: PROCEDURE [ interfaceFilename: String, interfaceCapability: File.Capability ]; -- ! OpenError[...]. OpenError: ERROR [fileOrModuleName: String, why: OpenErrorCode]; -- This ERROR can come back from OpenError or EnumerateXXX. OpenErrorCode: TYPE = {badFileFormat, badFileName, badFileVersion, notInterfaceModule}; CloseInterface: PROCEDURE; InterfaceInfo: TYPE = RECORD [ types, variables: BOOLEAN←FALSE, transfers: PACKED ARRAY TransferTypes OF BOOLEAN ← ALL[FALSE] ]; GetInterfaceInfo: PROCEDURE [ moduleNameString, fileNameString: String←StringNIL ] RETURNS [ contents: InterfaceInfo, moduleName, fileName: String, moduleVersion: VersionStamp, moduleCreateTime, sourceCreateTime: GMT ]; MaxVersionStampStringLength: INTEGER = 19; VersionStampString: PROCEDURE [stamp: VersionStamp, string: String] RETURNS [stampString: String]; -- Symbols, types, and their enumerators. SymbolHandle: TYPE = PRIVATE RECORD [ base: STBase, symbol: Symbols.ISEIndex] ← SymbolHandleNIL | NULL; SymbolHandleNIL: SymbolHandle = [NIL, Symbols.ISENull]; TypeHandle: TYPE = PRIVATE RECORD [ base: STBase, type: Symbols.SEIndex] ← TypeHandleNIL | NULL; TypeHandleNIL: TypeHandle = [NIL, Symbols.SENull]; Index: TYPE = INTEGER[0..LAST[INTEGER]]; -- Meaningful user origin is 1. -- All enumerators can raise OpenError[...] when an implicitly -- referenced module is not found. Be sure to ENABLE! DirectoryProcedure: TYPE = PROCEDURE [ moduleName, fileName: String, imported: BOOLEAN, directoryIndex: Index ] RETURNS [stop: BOOLEAN←FALSE]; EnumerateDirectory: PROCEDURE [proc: DirectoryProcedure] RETURNS [stopped: BOOLEAN←FALSE]; TransferProcedure: TYPE = PROCEDURE [ transfer: SymbolHandle, transferType: TypeHandle, kind: TransferTypes, argumentRecordType, resultRecordType: TypeHandle, transferIndex: Index] RETURNS [stop: BOOLEAN←FALSE]; EnumerateTransfers: PROCEDURE [ proc: TransferProcedure, all, procs, signals, errors: BOOLEAN ← FALSE] RETURNS [stopped: BOOLEAN←FALSE]; ComponentProcedure: TYPE = PROCEDURE [ component: SymbolHandle, componentType: TypeHandle, componentIndex: Index] RETURNS [stop: BOOLEAN←FALSE]; EnumerateRecord: PROCEDURE [ recordType: TypeHandle, proc: ComponentProcedure] RETURNS [stopped: BOOLEAN←FALSE]; VariantProcedure: TYPE = PROCEDURE [ variantTag: SymbolHandle, variantNumber: INTEGER[0..LAST[INTEGER]], -- Assigned by compiler. variantRecordType: TypeHandle, variantIndex: Index ] RETURNS [stop: BOOLEAN←FALSE]; EnumerateVariants: PROCEDURE [ variantPartType: TypeHandle, proc: VariantProcedure] RETURNS [stopped: BOOLEAN←FALSE]; -- Declarations of detailed type information. Types: TYPE = { Definition, Basic, Transfer, Record, VariantPart, Pointer, Ref, Any, List, RelativePtr, Text, String, StringBody, Rope, Atom, Array, Descriptor, Sequence, Zone, Opaque, Null, Other}; TransferTypes: TYPE = { Procedure, Error, Signal, Port, Program, Process, Other}; BasicTypes: TYPE = { Unspecified, Integer, Cardinal, Nat, Word, Character, Boolean, Real, Subrange, Enumeration, Other}; ParamPassingMethod: TYPE = {standard, var, value, result, handle}; TypeInfo: TYPE = RECORD [ self: TypeHandle, long: BOOLEAN ← FALSE, readonly: BOOLEAN ← FALSE, passingMethod: ParamPassingMethod ← standard, info: SELECT type: Types FROM Null => [], -- Empty parameter records are Null. Definition => [], -- Not needed or implemented. Basic => [ kind: BasicTypes, origin: LONG INTEGER, -- Incorrect for Real. cardinality: LONG INTEGER], -- Incorrect for LONG INT & CARD, Real. Transfer => [ kind: TransferTypes, safe: BOOLEAN, argumentType, resultType: TypeHandle], Record => [ paramRecord, painted, monitored: BOOLEAN, uniField, hasVariants, hasSequences: BOOLEAN], VariantPart => [ tag: SELECT kind: * FROM Computed => [], Star => [name: SymbolHandle], Named => [name: SymbolHandle, type: TypeHandle], ENDCASE], Text => [], String => [], StringBody => [], Rope => [--Rope.ROPE--], Atom => [], Pointer => [referentType: TypeHandle], Ref => [referentType: TypeHandle], Any => [], List => [firstType, restType: TypeHandle], RelativePtr => [baseType, offsetType, resultType: TypeHandle], Array => [ packed: BOOLEAN, indexType, elementType: TypeHandle], Descriptor => [ packed: BOOLEAN, indexType, elementType: TypeHandle], Sequence => [ packed: BOOLEAN, indexType, elementType: TypeHandle, tagName: SELECT kind: * FROM Computed => [], Named => [name: SymbolHandle], ENDCASE], Zone => [ allocation: {Counted, Uncounted}, mdsZone: BOOLEAN ], Opaque => [lengthKnown: BOOLEAN], Other => [] ENDCASE ← Other[] ]; -- Type and symbol operations. SymbolName: PROCEDURE [symbol: SymbolHandle, nameString: String] RETURNS [name: String]; IsAnonymous: PROCEDURE [symbol: SymbolHandle] RETURNS [yes: BOOLEAN]; -- If TRUE, SymbolName will return a null string. SymbolType: PROCEDURE [symbol: SymbolHandle] RETURNS [type: TypeHandle]; SymbolUniqueID: PROCEDURE [symbol: SymbolHandle] RETURNS [uniqueID: SymbolID]; SymbolID: TYPE = LONG CARDINAL; GetTypeInfo: PROCEDURE [type: TypeHandle] RETURNS [info: TypeInfo]; PutTypeName: PROCEDURE [ putProc: PROC[CHARACTER], type: TypeHandle, includeReadonly: BOOLEAN←TRUE, rootInterfaceOpenName: String←StringNIL ]; FullTypeName: TYPE = RECORD [module, name: String]; -- module.name. SearchTypeDefinition: PROCEDURE [ rootDef: TypeHandle, candidateDefs: LONG DESCRIPTOR FOR READONLY ARRAY OF FullTypeName ] RETURNS [indexOfMatch: INTEGER ← -1 --No match--]; -- Size returns the compiler's size for a type. For variant records, -- it is size of the largest variant. For sequences, the size is zero. -- For sequence-containing records, the record's size assumes a sequence -- of zero size. For these sequences cases, and for descriptor bodies -- with bounded index types, use ComputeArraySize. Words: TYPE = LONG INTEGER; Size: PROCEDURE [type: TypeHandle] RETURNS [size: Words]; ComputeArraySize: PROCEDURE [index, elements: TypeHandle, packed: BOOLEAN] RETURNS [size: Words]; END. -- LupineSymbolTable.