AbbrevExpandExtras.mesa
Copyright Ó 1989, 1991, 1992 by Xerox Corporation. All rights reserved.
Doug Wyatt, January 30, 1992 6:25 pm PST
DIRECTORY
Prop USING [PropList],
Rope USING [ROPE],
Tioga USING [Node];
AbbrevExpandExtras: CEDAR DEFINITIONS
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
FindEntryProc: TYPE ~ PROC [key: ROPE, dictAtom: ATOM, keyDeterminesDict: BOOL]
RETURNS [keyRope: ROPE ¬ NIL, node: Tioga.Node, commands: LIST OF REF ANY];
Each client-supplied FindEntryProc gets an opportunity to expand an abbreviation before Tioga invokes its standard mechanism. Return a non-NIL keyRope to indicate success.
PropList: TYPE ~ Prop.PropList;
FindEntryVal: TYPE ~ REF FindEntryProc;
Tioga keeps the registered FindEntryProcs in an immutable PropList. When expanding an abbreviation, Tioga first visits each Pair in the list in order; for each val that has the type FindEntryVal, it calls the FindEntryProc.
ChangeRegistry: PROC [change: PROC [old: PropList] RETURNS [new: PropList]];
Call this to replace the current list with a new one; remember that the old list is immutable.
A typical change proc is { RETURN[Prop.Put[old, $MyKey, NEW[FindEntryProc ← MyProc]]] }.
END.