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