
<<SMOps.mesa>>
<<Copyright  1985 by Xerox Corporation.  All rights reserved.>>
<<last edit by Satterthwaite, May 12, 1986 11:46:33 am PDT>>
<<>>
<<object state for each instance of the Cedar modeller>>

DIRECTORY
IO: TYPE USING [STREAM],
Rope: TYPE USING [ROPE],
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 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 REFs
wDir: Rope.ROPE_NIL,                -- working directory for files
<<>>
loc: Tree.Info,                    -- location in source
errors: BOOL_FALSE,            -- cumulative error flag
debugFlag: BOOL_FALSE,
<<>>
tree: Tree.Link_NIL,            -- the root of the (source) parse tree
val: Tree.Link_NIL,                -- the root of the evaluated tree
patches: PatchList_NIL,         -- patches to leaf nodes (for file updates)

<<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
];

PatchItem: TYPE~RECORD[old, new: Tree.Link];
PatchList: TYPE~LIST OF PatchItem;

<<procedures>>
NewModel: PROC[in, out, msgout: IO.STREAM] RETURNS[m: MS];

}.

