<> <> <> DIRECTORY AMModel USING [Context], AMTypes USING [TV], Interpreter USING [AbortClosure], IO USING [STREAM], PPTree USING [Link], Rope USING [ROPE], SafeStorage USING [nullType, Type], SymTab USING [Ref], WorldVM USING [World]; InterpreterOps: CEDAR DEFINITIONS = BEGIN OPEN AMTypes, Rope, SafeStorage; <<>> <> Eval: PROC[tree: Tree, head: EvalHead, target: Type _ nullType] RETURNS [TV]; <> <> <> <> ParseExpr: PROC [expr: ROPE, errout: IO.STREAM _ NIL] RETURNS [Tree]; <> <> TreeToName: PROC [t: Tree] RETURNS [name: ROPE]; <> GetArg: PROC [tree: Tree, which: NAT] RETURNS [son: InterpreterOps.Tree _ NIL]; <> <<>> <> Tree: TYPE = PPTree.Link; EvalHead: TYPE = REF EvalHeadRep; EvalHeadRep: TYPE = RECORD [context: AMModel.Context, <> <> <<= one of: world, prog(global frame), interface(ir), proc(local frame)>> specials: SymTab.Ref, abortClosure: AbortClosure, helpFatalClosure: HelpFatalClosure, helpWrongTypeClosure: HelpWrongTypeClosure, helpIdClosure: HelpIdClosure, helpSelectorClosure: HelpSelectorClosure, helpDefaultClosure: HelpDefaultClosure ]; AbortClosure: TYPE = Interpreter.AbortClosure; <> <> <> <<>> <> <<>> HelpFatalClosure: TYPE = RECORD[proc: HelpFatal, data: REF _ NIL]; HelpFatal: TYPE = PROC [data: REF, head: EvalHead, parent: Tree, msg: ROPE]; <> <> HelpWrongTypeClosure: TYPE = RECORD[proc: HelpWrongType, data: REF _ NIL]; HelpWrongType: TYPE = PROC [data: REF, head: EvalHead, parent: Tree, value: TV, target: Type, msg: ROPE] RETURNS [correct: RopeOrTV]; <> <> <> <> <<(this occurs for msg = "not applicable", for example)>> <> HelpIdClosure: TYPE = RECORD[proc: HelpId, data: REF _ NIL]; HelpId: TYPE = PROC [data: REF, head: EvalHead, parent: Tree, id: ROPE, context: Type, target: Type, msg: ROPE] RETURNS [correct: RopeOrTV]; <> <> <> <> <> <<(this may occur for msg = "undefined", for example)>> <> HelpSelectorClosure: TYPE = RECORD[proc: HelpSelector, data: REF _ NIL]; HelpSelector: TYPE = PROC [data: REF, head: EvalHead, parent: Tree, id: ROPE, context: TV, target: Type, msg: ROPE] RETURNS [correct: RopeOrTV]; <> <<(note that the context is a TV)>> <> <> <> <> HelpDefaultClosure: TYPE = RECORD[proc: HelpDefault, data: REF _ NIL]; HelpDefault: TYPE = PROC [data: REF, head: EvalHead, parent: Tree, type: Type, index: CARDINAL, msg: ROPE] RETURNS [correct: RopeOrTV]; <> <> < 0, then the default is missing for that component of type>> <> <> RopeOrTV: TYPE = RECORD[ SELECT tag: * FROM rope => [rope: ROPE], tv => [tv: TV], both => [rope: ROPE, tv: TV], fail => [fail: ROPE], ENDCASE ] _ [fail[NIL]]; <<>> <> <<>> NewEvalHead: PROC [context: AMModel.Context, <> <> <<= one of: world, prog(global frame), interface(ir), proc(local frame)>> specials: SymTab.Ref, -- non-NIL abortClosure: AbortClosure _ [NIL, NIL], helpFatalClosure: HelpFatalClosure _ [NIL, NIL], helpWrongTypeClosure: HelpWrongTypeClosure _ [NIL, NIL], helpIdClosure: HelpIdClosure _ [NIL, NIL], helpSelectorClosure: HelpSelectorClosure _ [NIL, NIL], helpDefaultClosure: HelpDefaultClosure _ [NIL, NIL] ] RETURNS [EvalHead]; <> <> <> WorldFromHead: PROC [head: EvalHead] RETURNS [WorldVM.World]; <<>> <> <<>> EnumerateSymbols: PROC [proc: Ruminant, data: REF _ NIL, symTab: SymTab.Ref _ NIL] RETURNS [stopped: BOOL]; <> Ruminant: TYPE = PROC [name: ROPE, help: ROPE, tv: TV, data: REF] RETURNS [stop: BOOL]; RegisterTV: PROC [name: ROPE, tv: TV, help: ROPE _ NIL, symTab: SymTab.Ref]; <> END.