MakeDoUpCmds.Mesa
Last Edited by: Spreitzer, September 3, 1985 2:14:26 pm PDT
DIRECTORY Basics, FSBackdoor, IO, MakeDo, MakeDoPrivate, PrincOpsUtils, Process, RedBlackTree, Rope, ViewerClasses, ViewerIO;
MakeDoUpCmds: CEDAR MONITOR
LOCKS c.up USING c: Command
IMPORTS IO, MakeDo, MakeDoPrivate, RedBlackTree
EXPORTS MakeDo, MakeDoPrivate
=
INVARIANT
Data described in MakeDoPrivate are consistent.
BEGIN OPEN MakeDo, MakeDoPrivate;
NodeRep: PUBLIC TYPE = MakeDoPrivate.NodeRep;
CommandRep: PUBLIC TYPE = MakeDoPrivate.CommandRep;
EnumerateResults: PUBLIC PROC [c: Command, to: PROC [Node]] = {
x: BOOLFALSE;
x ← x;
FOR e: Edge ← c.makes.first, e.cNext WHILE e # NIL DO
IF e.c # c THEN ERROR;
to[e.n];
ENDLOOP;
x ← x;
};
remakeMsgs: ARRAY CmdDep OF ROPE = [
cmd: "%g may need rederiving",
data: "%g may need reexecution"];
CmdMayNeedRemaking: PUBLIC PROC [c: Command, which: CmdDep, stack: Table] = {
RemakeNode: PROC [n: Node] =
{NodeMayNeedRemaking[n, stack]};
Inner: ENTRY PROC [c: Command, which: CmdDep] = {
ENABLE UNWIND => {};
IF c.suspect[which] THEN RETURN;
c.suspect[which] ← TRUE;
IF debugging THEN Log[0, remakeMsgs[which], IO.rope[c.cmd]];
EnumerateResults[c, RemakeNode];
which ← which;
};
IF stack.Lookup[c] # NIL THEN RETURN;
stack.Insert[c, c];
{ENABLE UNWIND => [] ← stack.Delete[c];
Inner[c, which];
IF which = cmd THEN Inner[c, data];
};
[] ← stack.Delete[c];
};
ShouldRemakeCmd: PUBLIC ENTRY PROC [c: Command, which: CmdDep, callerPromisesToDoIt: BOOL] RETURNS [should: BOOL] = {
should ← c.suspect[which];
IF should AND callerPromisesToDoIt THEN c.suspect[which] ← FALSE;
};
END.