StartUserExec.mesa
Last Edited by Teitelman April 19, 1983 12:13 pm
DIRECTORY
IO USING [PutF, PutSignal],
MessageWindow USING [Append, Blink],
Rope USING [Cat, Concat, Find, ROPE],
UserExec USING [DoIt, ExecHandle, HistoryEvent, CreateUserExecutive, StartListening],
UserExecExtras USING [CreateEvent],
UserExecPrivate USING [CaptionForExec, ExecPrivateRecord, w],
UserProfile USING [Token, GetErrorLog]
;
StartUserExec: CEDAR PROGRAM
IMPORTS IO, MessageWindow, Rope, UserExecPrivate, UserExec, UserExecExtras, UserProfile
EXPORTS UserExec
SHARES UserProfile
= BEGIN
ExecPrivateRecord: PUBLIC TYPE = UserExecPrivate.ExecPrivateRecord;
exec: UserExec.ExecHandle = UserExec.CreateUserExecutive[paint: FALSE, startListening: FALSE, iconic: TRUE];
private: REF ExecPrivateRecord = exec.privateStuff;
Start: PROC = {
event: UserExec.HistoryEvent ← UserExecExtras.CreateEvent[exec, r];
event.dontCorrect ← TRUE;
IF r # NIL THEN UserExec.DoIt[input: r, exec: exec, partOf: event ! ANY => {
private.out.PutF["*n*e"];
private.out.PutSignal[];
CONTINUE;
};
]; -- start up won't be finished until this is executed.
UserExec.StartListening[exec];
};
commandsFrom, errorLog, errorRope, r: Rope.ROPE;
UserExecPrivate.w ← private.execDotW; -- to give default value if somebody just runs a program which refers to Exec.w before the first registered command is executed.
commandsFrom ← UserProfile.Token["CommandsFrom"];
errorLog ← UserProfile.GetErrorLog[];
IF errorLog # NIL THEN TRUSTED {
errorRope ← Rope.Concat["Some problems were encountered in your user profile, see ", errorLog];
MessageWindow.Append[Rope.Concat[errorRope, " ... "]];
MessageWindow.Blink[];
};
IF commandsFrom # NIL THEN {
IF Rope.Find[commandsFrom, "\n"] = -1 AND Rope.Find[commandsFrom, " "] = -1 -- commandsFrom is name of file
THEN r ← Rope.Cat["@", commandsFrom, "; "]
ELSE r ← Rope.Concat[commandsFrom, "\n"];
};
IF r # NIL OR errorRope # NIL THEN r ← Rope.Cat[r, "Herald ", errorRope, "\n"];
[] ← UserExecPrivate.CaptionForExec[exec: exec, paint: TRUE];
-- EndOps.Register[-- Start[];
END. -- of StartUserExec
Edited on March 1, 1983 11:55 pm, by Teitelman
arranged so that commandsFrom not executed until startup complete, and that Ready not posted until commandsFrom finished.
changes to: Start, DIRECTORY, IMPORTS, errorLog, EndOp
Edited on March 3, 1983 2:02 pm, by Teitelman
changes to: Start
Edited on March 10, 1983 3:10 am, by Teitelman
changes to: DIRECTORY, IMPORTS
Edited on April 19, 1983 12:13 pm, by Teitelman
changes to: DIRECTORY, IMPORTS, Start