CommanderSysPImpl.mesa
Copyright Ó 1990, 1991, 1992, 1993 by Xerox Corporation. All rights reserved.
Michael Plass, February 18, 1992 4:44 pm PST
JKF, March 2, 1990 3:51:36 pm PST
Christian Jacobi, March 25, 1993 2:49 pm PST
DIRECTORY BasicTime, Commander, CommanderSys, EnvironmentVariables, IO, PreDebug, Process, Rope, SafeStorage, Termination;
CommanderSysPImpl: CEDAR PROGRAM
IMPORTS BasicTime, Commander, EnvironmentVariables, IO, PreDebug, Process, SafeStorage, Termination
EXPORTS CommanderSys
~ BEGIN OPEN CommanderSys, Rope;
ExtendedNow: PUBLIC PROC RETURNS [EGMT] = {
now: BasicTime.ExtendedGMT = BasicTime.ExtendedNow[];
RETURN [[now.gmt, now.usecs]]
};
GetEnv: PUBLIC PROC [key: ROPE] RETURNS [ROPE] = {
RETURN [EnvironmentVariables.Get[key]]
};
CurrentProcess: PUBLIC PROC RETURNS [PROCESS] = {
RETURN [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] = {
RETURN [PreDebug.Protect[inner, rejectP]]
};
To allow packaged worlds to quit pcr cleanly
ExitWorldCommand: Commander.CommandProc = {
Termination.QuitWorld[userMsg: cmd.commandLine, interceptable: FALSE];
RETURN[NIL, NIL];
};
To allow interception of interceptable termination
InterceptTerminationCommand: Commander.CommandProc = {
Termination.SetDebuggingMode[];
RETURN[NIL, NIL];
};
to help packaged world performance
GCollect: Commander.CommandProc = {
SafeStorage.ReclaimCollectibleObjects[];
RETURN[NIL, NIL];
};
to help debugging
ShowCirioPortCommand: Commander.CommandProc = {
GetPortNum: PROC RETURNS[CARD] = TRUSTED MACHINE CODE
{"CirioNubLocalGetPort"};
IO.PutF1[cmd.out, "%g\N", [cardinal[GetPortNum[]]]];
};
Commander.Register[key: "ExitWorld", proc: ExitWorldCommand, doc: "Exit the PCR world", clientData: NIL];
Commander.Register[key: "ExitWorld!", proc: ExitWorldCommand, doc: "Same as ExitWorld, defeats command abbreviation danger", clientData: NIL];
Commander.Register[key: "InterceptTermination", proc: InterceptTerminationCommand, doc: "From now on interceptable termination will enter debugger instead of exiting the PCR world", clientData: NIL];
Commander.Register[key: "GCollect", proc: GCollect, doc: "force a garbage collect", clientData: NIL];
Commander.Register["ShowCirioPort", ShowCirioPortCommand, "shows current Cirio Port, so long as exactly one DebugNub has been loaded and it has been started"];
END.