-- SMOps.mesa
-- last edit by Schmidt, May 17, 1983 4:35 pm
-- last edit by Satterthwaite, July 25, 1983 12:07 pm
-- object record for Cedar modeller

DIRECTORY
  IO: TYPE USING [STREAM],
  SMCommentTableOps: TYPE USING [CommentM],
  SMLDriver: TYPE USING [LS],
  SMTree: TYPE Tree USING [Info, Link],
  SMTreeOps: TYPE --TreeOps-- USING [TM];
	
SMOps: CEDAR DEFINITIONS ~ {
  OPEN Tree~~SMTree, TreeOps~~SMTreeOps;
  
 -- A ModelState object contains the global state of an instance of a modeller.
 -- In addition to this record, other modules with global state use monitors to 
 -- protect multiple use.
 -- Examples:
 --    SMReaderImpl (protects SMParserImpl, SMScannerImpl, SMTreeBuildImpl),
 --    SMCompImpl (protects compiler)
 --    SMFIImpl, SMProjImpl (protect caches)

 -- this object cannot hold things that are not compatible with multiple
 -- levels of models for an instance of the modeller, e.g. the source file input stream

  MS: TYPE~REF ModelState;

  ModelState: TYPE~RECORD[
    in: IO.STREAM←NIL,		-- input stream for typeScript
    out: IO.STREAM←NIL,		-- output stream for typeScript
    msgOut: IO.STREAM←NIL,	-- output stream for compiler progress messages
   --
    z: ZONE←NIL,			-- use this zone to allocate all REF's
   --
    loc: Tree.Info,			-- location in source
    errors: BOOL←FALSE,		-- cumulative error flag
    debugFlag: BOOL←FALSE,
   --
    tree: Tree.Link←NIL,		-- the root node of the (source) parse tree
    val: Tree.Link←NIL,		-- the root node of the evaluated tree
   -- state information used by SMTreeImpl
    tm: TreeOps.TM←NIL,
   -- state information used by SMCommentTableImpl
    comments: SMCommentTableOps.CommentM←NIL,
   -- state information used by the modeller loader 
    ls: SMLDriver.LS←NIL
    ];
	
-- procedures
  NewModel: PROC[in, out, msgout: IO.STREAM] RETURNS[m: MS];

  }.