-- BBEvalQuote.mesa
-- Russ Atkinson, November 19, 1982 12:42 pm

-- The EvalQuote facility is provided to allow users to augment the language interpreted by BugBane. The user supplies a procedure to be registered with BugBane under a given name such that the procedure will be called with the syntax tree for its invocation rather than have its arguments interpreted by BugBane.

DIRECTORY
BBEval USING [EvalHead, Tree],
Rope USING [ROPE],
RTBasic USING [nullType, TV, Type];

BBEvalQuote: CEDAR DEFINITIONS = BEGIN OPEN Rope, RTBasic;

EvalQuoteProc: TYPE = PROC
[head: BBEval.EvalHead, tree: BBEval.Tree, target: Type ← nullType, data: REFNIL]
RETURNS [return: TV];
-- this is the type of proc the user supplies to perform evalQuote functions

Register: PROC [name: ROPE, proc: EvalQuoteProc, data: REFNIL];
-- registers the EvalQuoteProc with BugBane

UnRegister: PROC [name: ROPE];
-- unregisters the name with BugBane

Lookup: PROC [name: ROPE] RETURNS [proc: EvalQuoteProc, data: REF];
-- finds the named EvalQuoteProc (if any), returns [NIL, NIL] if no such proc

Pairs: PROC [visit: VisitProc];
-- enumerates the registered procedures

VisitProc: TYPE = PROC
[name: ROPE, proc: EvalQuoteProc, data: REFNIL]
RETURNS [stop: BOOLFALSE];
-- this is the type of callback proc the user supplies to iterate over the registered commands

END.