ReminderImpl.mesa. See Reminder.Tioga for documentation and examples of how to use the new reminder package.
Last Edited by: Teitelman, May 27, 1983 12:41 pm
DIRECTORY
Commander USING [CommandProc, Register],
IO USING[PutRope, STREAM],
MyClock USING [curPacked, PaintMe],
Process USING [Detach, Pause, SecondsToTicks],
ReminderDefs,
ReminderDefsPrivate USING [itIsNow, EnterEventMinder],
Rope USING[ROPE, Equal],
Runtime USING [IsBound],
Tempus USING [defaultTime, MakeRope, Packed, Parse]
;
ReminderUtilImpl: CEDAR MONITOR
IMPORTS Commander, IO, Runtime, Process, Rope, Tempus, ReminderDefsPrivate, MyClock
SHARES ReminderDefsPrivate, MyClock
= BEGIN
PretendIts: Commander.CommandProc = TRUSTED { -- for debugging
t: Tempus.Packed = Tempus.Parse[cmd.commandLine, ReminderDefsPrivate.itIsNow].time;
IF Runtime.IsBound[MyClock.PaintMe] THEN MyClock.curPacked ← t;
ReminderDefsPrivate.EnterEventMinder[[t + 1]]; -- + 1 so you can say remember .. at noon, then pretendits noon to see it get fired off
IF Runtime.IsBound[MyClock.PaintMe] THEN Process.Detach[FORK LeaveItUpForAWhile[]];
cmd.out.PutRope[Tempus.MakeRope[time: t, includeDayOfWeek: TRUE]];
};
howLong: LONG CARDINAL ← 5;
LeaveItUpForAWhile: PROCEDURE = TRUSTED {
Process.Pause[Process.SecondsToTicks[howLong]];
MyClock.curPacked ← Tempus.defaultTime;
};
ItIsNow: Commander.CommandProc = { -- for debugging
IF Rope.Equal[cmd.commandLine, "\n"] THEN {
ReminderDefsPrivate.itIsNow ← Tempus.defaultTime;
cmd.out.PutRope["{current time}"];
}
ELSE {
t: Tempus.Packed = Tempus.Parse[cmd.commandLine, ReminderDefsPrivate.itIsNow].time;
ReminderDefsPrivate.itIsNow ← [t + 1]; -- + 1 so you can say remember .. at noon, then pretendits noon to see it get fired off
cmd.out.PutRope[Tempus.MakeRope[time: t, includeDayOfWeek: TRUE]];
};
};
Commander.Register["PretendIts", PretendIts, "Pretend its ... for purposes of posting a reminder. (A temporary change.)"];
Commander.Register["ItIsNow", ItIsNow, "Pretend its ... for purposes of registration as well as posting a reminder. (A permanent change, i.e. must explicitly be restored by typing ItIsNow{cr})"];
END.