-- Runtime.mesa (last edited by: Levin on: August 24, 1982 5:10 pm)

DIRECTORY
  File USING [Capability, PageCount],
  Mopcodes USING [zKFCB],
  SDDefs USING [sCallDebugger, sInterrupt, sUnNew],
  System USING [GreenwichMeanTime];

Runtime: DEFINITIONS =
  BEGIN -- Global Frame management
  GlobalFrame: PROC [link: UNSPECIFIED] RETURNS [PROGRAM];
  LoadConfig: PROC [
    file: File.Capability, offset: File.PageCount, codeLinks: BOOLEAN ← FALSE]
    RETURNS [PROGRAM];
  NewConfig: PROC [
    file: File.Capability, offset: File.PageCount, codeLinks: BOOLEAN ← FALSE];
  RunConfig: PROC [
    file: File.Capability, offset: File.PageCount, codeLinks: BOOLEAN ← FALSE];
  UnNewConfig: PROC [link: UNSPECIFIED];
  UnNew: PROC [frame: PROGRAM] = MACHINE CODE
    BEGIN Mopcodes.zKFCB, SDDefs.sUnNew END;

  SelfDestruct: PROC;
  NullProgram: PROGRAM = LOOPHOLE[0]; -- Frame validation
  ValidateGlobalFrame: PROC [frame: UNSPECIFIED];
  InvalidGlobalFrame: ERROR [frame: UNSPECIFIED];
  ValidateFrame: PROC [frame: UNSPECIFIED];
  InvalidFrame: ERROR [frame: UNSPECIFIED]; -- Debugger interface
  CallDebugger: PROC [STRING] = MACHINE CODE
    BEGIN Mopcodes.zKFCB, SDDefs.sCallDebugger END;

  Interrupt: PROC = MACHINE CODE BEGIN Mopcodes.zKFCB, SDDefs.sInterrupt END;
  
  -- Version information

  GetBcdTime: SAFE PROC RETURNS [System.GreenwichMeanTime];
  GetBuildTime: SAFE PROC RETURNS [System.GreenwichMeanTime]; -- Debugging information
  GetCaller: SAFE PROC RETURNS [PROGRAM]; -- Access to compiled tables, etc
  GetTableBase: PROC [frame: PROGRAM] RETURNS [LONG POINTER];
  -- Conditional loading information
  IsBound: PROC [link: UNSPECIFIED] RETURNS [BOOLEAN];
  -- Signals and errors generated by the Pilot Mesa System and of interest to Mesa programmers
  BoundsFault: ERROR;
  ConfigError: ERROR [type: ConfigErrorType];
  ConfigErrorType: TYPE = {
    badCode, invalidConfig, missingCode, versionMismatch, unknown};
  ControlFault: SIGNAL [source: UNSPECIFIED --ControlLink--]
    RETURNS [UNSPECIFIED --ControlLink--];
  DivideCheck: SAFE SIGNAL;
  LinkageFault: ERROR;
  PointerFault: ERROR;
  PortFault: ERROR;
  StartFault: SIGNAL [dest: PROGRAM];
  StackError: ERROR;
  UnboundProcedure: SIGNAL [dest: UNSPECIFIED --ControlLink--]
    RETURNS [UNSPECIFIED --ControlLink--];
  ZeroDivisor: SAFE SIGNAL;
  END.
LOG
(For earlier log entries see Pilot 4.0 archive version.)
Time: April 17, 1980  10:20 AM	By: Luniewski	Action: Added NullProgram.
Time: July 18, 1980  6:22 PM	By: Forrest	Action: Added LoadConfig.
Time: August 5, 1980  10:41 AM	By: McJones	Action: Added GetBcdTime, Interrupt.
Time: September 4, 1980  4:37 PM	By: Johnsson	Action: Added codeLinks parameters for loading.
TIme: August 24, 1982 5:10 pm  By: Levin  Action:  Make things SAFE, make BoundsFault and PointerFault be ERRORs.