CDStarter.mesa (part of ChipNDale)
Copyright © 1983, 1986 by Xerox Corporation. All rights reserved.
by Christian Jacobi, November 7, 1983 5:39 pm
Last Edited by: Jacobi July 24, 1986 10:32:07 am PDT
DIRECTORY
Commander,
CommandTool,
IO,
Process,
Rope,
TerminalIO,
UserProfile;
CDStarter: CEDAR PROGRAM
IMPORTS Commander, CommandTool, IO, Rope, TerminalIO, UserProfile, Process =
BEGIN
StartPrograms: PROC[] =
BEGIN
runList: LIST OF Rope.ROPE = UserProfile.ListOfTokens[key: "ChipNDale.RunPrograms"];
FOR l: LIST OF Rope.ROPE ← runList, l.rest WHILE l#NIL DO
IF NOT Rope.IsEmpty[l.first] THEN {
msg: Rope.ROPE = CommandTool.Run[bcdName: l.first].errMsg;
IF msg#NIL THEN TerminalIO.WriteRope[msg];
}
ENDLOOP;
END;
TrojanHorse: PROC[] =
BEGIN
-- This is typically commented out in released versions
-- but active in private or pre-released versions
trojanHorse: Rope.ROPE = "/ivy/jacobi/cd23/CDTroja23";
TRUSTED {Process.SetPriority[Process.priorityBackground]};
[] ← CommandTool.Run[bcdName: trojanHorse];
END;
Load: Commander.CommandProc = {
IO.PutRope[cmd.out, "ChipNDale loaded\n"];
};
Quiet: Commander.CommandProc = {};
BeQuiet: Commander.CommandProc =
BEGIN
FOR ls: LIST OF Rope.ROPE ← CommandTool.ParseToList[cmd].list, ls.rest WHILE ls#NIL DO
IF ~Rope.IsEmpty[ls.first] AND Commander.Lookup[ls.first]=NIL THEN {
Commander.Register[key: ls.first, proc: Quiet, doc: "command made quiet"];
IF Rope.Fetch[ls.first, 0]#'/ AND Rope.Fetch[ls.first, 0]#'[ THEN {
r: Rope.ROPE ← Rope.Concat["///Commands/", ls.first];
IF Commander.Lookup[r]=NIL THEN
Commander.Register[key: r, proc: Quiet, doc: "command made quiet"];
};
};
ENDLOOP;
END;
StartPrograms[];
TRUSTED {Process.Detach[FORK TrojanHorse[]]};
Commander.Register[
key: "///Commands/ChipNDale",
proc: Load,
doc: "loads technology independent ChipNDale"
];
Commander.Register[
key: "///Commands/BeQuiet",
proc: BeQuiet,
doc: "makes this load file beeing quiet"
];
END.