InterpImpl.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Demers, January 29, 1990 1:39:51 pm PST
Willie-s, January 7, 1992 2:02 pm PST
DIRECTORY
Commander,
CStrings,
InterpGlue,
IO,
Rope,
UXStrings
;
InterpImpl: CEDAR PROGRAM
IMPORTS Commander, InterpGlue, IO, Rope, UXStrings
EXPORTS
~ {
InterpCommandProc: Commander.CommandProc -- [cmd] RETURNS [result, msg] -- ~ {
ih: InterpGlue.Handle;
rawCmdRope: Rope.ROPE;
rawCmdString: CStrings.CString;
ans: INT;
PutIt: InterpGlue.PutProc -- [msg] -- ~ {
IO.PutRope[cmd.out, UXStrings.ToRope[msg]];
};
ih ¬ cmd.procData.clientData;
rawCmdRope ¬ Rope.Concat["← ", cmd.commandLine];
rawCmdString ¬ UXStrings.Create[rawCmdRope];
ans ¬ InterpGlue.Interp[ih, 0, PutIt, 0, rawCmdString];
RETURN [IF ans >= 0 THEN $Success ELSE $Failure, NIL];
};
RegisterInterp: PROC ~ {
ih: InterpGlue.Handle ¬ InterpGlue.MakeInterpHandle[];
doc: Rope.ROPE ¬ "Interp expression ; ...\n Interpret prefix expressions";
Commander.Register["Interp", InterpCommandProc, doc, ih, FALSE];
};
Main line code:
RegisterInterp[];
}.