CommanderSysDImpl.mesa
Copyright Ó 1990, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, February 10, 1990 5:03:15 pm PST
DIRECTORY IO, BasicTime, Process, RuntimeError, CommanderSys, Rope;
CommanderSysDImpl: CEDAR PROGRAM
IMPORTS IO, BasicTime, Process, RuntimeError
EXPORTS CommanderSys
~ BEGIN OPEN CommanderSys, Rope;
ExtendedNow: PUBLIC PROC RETURNS [EGMT] = {
RETURN [[BasicTime.Now[], 0]]
};
GetEnv: PUBLIC PROC [key: ROPE] RETURNS [ROPE] = {
RETURN [NIL]
};
CurrentProcess: PUBLIC PROC RETURNS [PROCESS] = TRUSTED {
RETURN [LOOPHOLE[Process.GetCurrent[]]];
};
AbortProcess: PUBLIC PROC [process: PROCESS] = TRUSTED {
Process.Abort[process];
};
UNCAUGHTProtect: PUBLIC PROC [inner: PROC, rejectP: PROC [ROPE] RETURNS [BOOL]] RETURNS [ok: BOOL ¬ TRUE] = {
inner[! RuntimeError.UNCAUGHT => IF rejectP[SigToRope[LOOPHOLE[signal]]] THEN REJECT ELSE {ok ¬ FALSE; CONTINUE}];
};
SigToRope: PROC [sig: SIGNAL ANY RETURNS ANY] RETURNS [ROPE] = {
ref: REF SIGNAL ANY RETURNS ANY = NEW[SIGNAL ANY RETURNS ANY ¬ sig];
RETURN [IO.PutFR1["%g", [refAny[ref]]]]
};
END.