-- file Code.mesa
-- last modified by Sweet, 14-Dec-81  9:17:53
-- last modified by Satterthwaite, December 16, 1982 8:54 am

DIRECTORY
  CodeDefs: TYPE USING [CaseCVState, CCIndex, EnableIndex, LabelCCIndex, Lexeme],
  CompilerUtil: TYPE USING [],
  P5: TYPE USING [Module],
  Symbols: TYPE USING [ContextLevel, CTXIndex, ISEIndex, RecordSEIndex, CCBTIndex];

Code: PROGRAM 
    IMPORTS P5 
    EXPORTS CompilerUtil =
  PUBLIC BEGIN OPEN CodeDefs;

 -- the following variables are shared among the code generation modules

  curctxlvl: Symbols.ContextLevel;
  codeStart, codeptr: CCIndex;
  bodyRetLabel, bodyComRetLabel: LabelCCIndex;
  bodyRecurLabel: LabelCCIndex;
  bodyInRecord, bodyOutRecord: Symbols.RecordSEIndex;
  bodyFileIndex: CARDINAL;
  mainBody: BOOL;
  ZEROlexeme: Lexeme.literal.word;
  tailJumpOK: BOOL;
  caseCVState: CaseCVState;
  mwCaseCV: Lexeme;
  fileindex, inlineFileIndex: CARDINAL;
  tempcontext: Symbols.CTXIndex;
  firstTemp, tempstart, framesz: CARDINAL;
  xtracting: BOOL;
  xtractlex: Lexeme;
  xtractsei: Symbols.ISEIndex;
  warnStackOverflow: BOOL;
  
  inlineRetErrorLabel, inlineRetErrorListLabel: LabelCCIndex;
  catchcount: CARDINAL;
  catchoutrecord: Symbols.RecordSEIndex;
  actenable: Symbols.CCBTIndex;
  enableLevel: CARDINAL;
  enableList: ARRAY [0..15] OF EnableIndex;

  StackNotEmptyAtStatement: SIGNAL = CODE;
  CodeNotImplemented: SIGNAL = CODE;
  CodePassInconsistency: SIGNAL = CODE;


  P5module: PROC =
    BEGIN -- starts the code generation pass
    P5.Module[];
    END;

  END.