ReminderUtilImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited by: Pier, May 8, 1985 9:49:07 am PDT
Rick Beach, April 4, 1985 5:42:26 pm PST
DIRECTORY
BasicTime USING [Update],
Commander USING [CommandProc, Register],
IO USING[PutRope, STREAM],
Remember,
RememberPrivate USING [itIsNow, EnterEventMinder],
Rope USING[ROPE, Equal, Cat, Substr, Concat, Find],
Tempus USING [defaultTime, MakeRope, Packed, Parse, Unintelligible];
RememberUtilImpl: CEDAR MONITOR
IMPORTS BasicTime, Commander, IO, Rope, Tempus, RememberPrivate
SHARES RememberPrivate = BEGIN
ShowReminders: Commander.CommandProc = TRUSTED {
earlyRope, lateRope, err: Rope.ROPE;
earlyIndex: INT;
early, late: Tempus.Packed;
IF (earlyIndex ← Rope.Find[s1: cmd.commandLine, s2: "UpTo", case: FALSE])#-1 THEN {
earlyRope ← Rope.Substr[base: cmd.commandLine, len: earlyIndex];
lateRope ← Rope.Substr[base: cmd.commandLine, start: earlyIndex];
}
ELSE err ← "Syntax: ShowReminders <earliestTime> UpTo <latestTime>";
IF err=NIL THEN {
early ← Tempus.Parse[earlyRope, RememberPrivate.itIsNow !
Tempus.Unintelligible => {
err ← SELECT ec FROM
invalid => "Invalid",
tooVague => "Too Vague",
overConstrained => "Over Constrained",
nothingSpecified => "Not a time",
notImplemented => "Not Implemented",
ENDCASE => ERROR;
IF vicinity # -1 THEN err ← Rope.Cat[
err,
": ",
Rope.Substr[base: rope, len: vicinity],
"<>",
Rope.Substr[base: rope, start: vicinity]
];
CONTINUE;
};
].time;
late ← Tempus.Parse[lateRope, RememberPrivate.itIsNow !
Tempus.Unintelligible => {
err ← SELECT ec FROM
invalid => "Invalid",
tooVague => "Too Vague",
overConstrained => "Over Constrained",
nothingSpecified => "Not a time",
notImplemented => "Not Implemented",
ENDCASE => ERROR;
IF vicinity # -1 THEN err ← Rope.Cat[
err,
": ",
Rope.Substr[base: rope, len: vicinity],
"<>",
Rope.Substr[base: rope, start: vicinity]
];
CONTINUE;
};
].time;
};
IF err # NIL THEN cmd.err.PutRope[Rope.Concat[err, "\n"]]
ELSE {
RememberPrivate.EnterEventMinder[BasicTime.Update[early, 1], late]; -- + 1 so you can say remember .. at noon, then pretendits noon to see it get fired off
cmd.out.PutRope[Rope.Cat[Tempus.MakeRope[time: early, includeDayOfWeek: TRUE], " UpTo ", Tempus.MakeRope[time: late, includeDayOfWeek: TRUE], "\n"]];
};
};
PretendIts: Commander.CommandProc = TRUSTED { -- for debugging
err: Rope.ROPE;
t: Tempus.Packed;
t ← Tempus.Parse[cmd.commandLine, RememberPrivate.itIsNow !
Tempus.Unintelligible => {
err ← SELECT ec FROM
invalid => "Invalid",
tooVague => "Too Vague",
overConstrained => "Over Constrained",
nothingSpecified => "Not a time",
notImplemented => "Not Implemented",
ENDCASE => ERROR;
IF vicinity # -1 THEN err ← Rope.Cat[
err,
": ",
Rope.Substr[base: rope, len: vicinity],
"<>",
Rope.Substr[base: rope, start: vicinity]
];
CONTINUE;
};
].time;
IF err # NIL THEN cmd.err.PutRope[Rope.Concat[err, "\n"]]
ELSE {
RememberPrivate.EnterEventMinder[BasicTime.Update[t, 1]]; -- + 1 so you can say remember .. at noon, then pretendits noon to see it get fired off
cmd.out.PutRope[Rope.Concat[Tempus.MakeRope[time: t, includeDayOfWeek: TRUE], "\n"]];
};
};
ItIsNow: Commander.CommandProc = { -- for debugging
IF Rope.Equal[cmd.commandLine, "\n"] THEN {
RememberPrivate.itIsNow ← Tempus.defaultTime;
cmd.out.PutRope[Rope.Concat["{current time}", "\n"]];
}
ELSE {
t: Tempus.Packed = Tempus.Parse[cmd.commandLine, RememberPrivate.itIsNow].time;
RememberPrivate.itIsNow ← BasicTime.Update[t, 1]; -- + 1 so you can say remember .. at noon, then pretendits noon to see it get fired off
cmd.out.PutRope[Rope.Concat[Tempus.MakeRope[time: t, includeDayOfWeek: TRUE], "\n"]];
};
};
Commander.Register["PretendIts", PretendIts, "Pretend its ... for purposes of posting a reminder. (A temporary change.)"];
Commander.Register["ShowReminders", ShowReminders, "ShowReminders <earliestTime> UpTo <latestTime>"];
Commander.Register["ShowRem", ShowReminders, "ShowReminders <earliestTime> UpTo <latestTime>"];
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.
Change Log:
Edited on September 15, 1983 10:59 am, by Teitelman
changes pretendits to catch signals from tempus
changes to: PretendIts
Edited on January 6, 1984 2:08 pm, by Maxwell
changes to: DIRECTORY, IMPORTS, PretendIts, ItIsNow
Edited on January 24, 1984 8:06 pm, by Pier
changes to: DIRECTORY, PretendIts, ItIsNow
Edited on February 13, 1984 1:08:36 pm PST, by Pier
changes to: PretendIts, ItIsNow to add final CR to outputs
Edited on March 1, 1984 1:40:51 pm PST, by Pier
changes to: DIRECTORY, IMPORTS, SHARES, PretendIts, LeaveItUpForAWhile
Edited on March 13, 1984 6:15:50 pm PST, by Pier Added ShowReminders
Edited on May 8, 1985 9:39:39 am PDT, by Pier Convert to Cedar6.0. Remove Clock nonsense.