-- file ComData.Mesa
-- last modified by Satterthwaite, October 31, 1979  12:41 PM

DIRECTORY
  BcdDefs: FROM "bcddefs" USING [FrameFrag, MTRecord, SGRecord, VersionStamp],
  StreamDefs: FROM "streamdefs" USING [StreamHandle, StreamIndex],
  Symbols: FROM "symbols"
    USING [SEIndex, ISEIndex, CSEIndex, CTXIndex, BTIndex, CBTIndex],
  SymbolSegment: FROM "symbolsegment" USING [FGTEntry],
  SymbolTable: FROM "symboltable" USING [Base],
  Tree: FROM "tree" USING [Link];

ComData: PROGRAM =
 PUBLIC
  BEGIN
  OPEN Symbols;

 -- basic types (initialized in Pass1)

  typeINTEGER, typeCARDINAL: CSEIndex;
  typeBOOLEAN, typeCHARACTER, typeREAL: CSEIndex;
  typeSTRING, typeStringBody: CSEIndex;
  typeLOCK, typeCONDITION: CSEIndex;

 -- global info describing module

  definitionsOnly: BOOLEAN;
  monitored: BOOLEAN;
  stopping: BOOLEAN;
  outerCtx: CTXIndex;		-- predefined identifiers
  moduleCtx: CTXIndex;		-- module identifiers
  importCtx: CTXIndex;		-- import id context
  mainCtx: CTXIndex;		-- main program's context
  bodyRoot: BTIndex;
  mainBody: CBTIndex;
  nBodies: CARDINAL;
  nSigCodes: CARDINAL;
  defBodyLimit: INTEGER;
  linkBase: CARDINAL;		-- global control links (externals, etc)
  linkCount: CARDINAL;

 -- shared instance of SymbolTable

  ownSymbols: SymbolTable.Base;

 -- type ids (interim Cedar)

  nTypeCodes: CARDINAL;
  typeMapId: ISEIndex;
  typeMap: DESCRIPTOR FOR ARRAY OF SEIndex;

 -- type identifiers (initialized in Pass1)

  idANY: ISEIndex;
  idINTEGER, idCARDINAL, idCHARACTER, idBOOLEAN, idREAL, idSTRING: ISEIndex;
  idLOCK: ISEIndex;

 -- anonymous entry for undeclared ids

  seAnon: ISEIndex;

 -- symbolic constants

  idTRUE, idFALSE: ISEIndex;
  tC0, tC1: Tree.Link;
  idUNWIND: ISEIndex;

 -- compilation options

  switches: PACKED ARRAY CHARACTER ['a..'z] OF BOOLEAN;

 -- input

  sourceFile: STRING;
  sourceVersion: BcdDefs.VersionStamp;
  sourceStream: StreamDefs.StreamHandle;
  sourceTokens: CARDINAL;

 -- variables used for error reporting

  errorFile: STRING;
  errorStream: StreamDefs.StreamHandle;
  nErrors: CARDINAL;
  nWarnings: CARDINAL;
  bodyIndex: CBTIndex;		-- current body
  textIndex: CARDINAL;		-- start index of line with error

 -- output

  compilerVersion: BcdDefs.VersionStamp;

  objectFile: STRING;
  objectStream: StreamDefs.StreamHandle;
  netNumber: CARDINAL;
  objectVersion: BcdDefs.VersionStamp;

  objectBytes, objectFrameSize: CARDINAL;

  fgTable: DESCRIPTOR FOR ARRAY OF SymbolSegment.FGTEntry;

  codeSeg, symSeg: BcdDefs.SGRecord;
  mtRoot: BcdDefs.MTRecord;
  MTRootSize: CARDINAL = SIZE[BcdDefs.MTRecord]-SIZE[BcdDefs.FrameFrag];
  fixupLoc: StreamDefs.StreamIndex;

  END.