MakeDo.Mesa
Last Edited by: Spreitzer, September 4, 1985 10:57:37 pm PDT
Carl Hauser, April 11, 1985 3:34:27 pm PST
DIRECTORY BasicTime, Commander, IO, List, RedBlackTree, Rope, TimeStamp;
MakeDo: CEDAR DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
RopeList: TYPE = LIST OF ROPE;
Table: TYPE = RedBlackTree.Table;
PropList: TYPE = List.AList;
Time: TYPE = BasicTime.GMT;
notExistTime: Time = BasicTime.nullGMT;
unknownTime: Time = LOOPHOLE[FIRST[LONG CARDINAL]];
Stamp: TYPE = TimeStamp.Stamp;
notExistStamp: Stamp = [255, 255, LAST[LONG CARDINAL]];
unknownStamp: Stamp = TimeStamp.Null;
NodeList: TYPE = LIST OF Node;
Node: TYPE = REF NodeRep; NodeRep: TYPE;
CommandList: TYPE = LIST OF Command;
Command: TYPE = REF CommandRep; CommandRep: TYPE;
Warning: SIGNAL [message: ROPE];
For deriving dependecies and ensuring consistency:
Ensure: PROC [ch: Commander.Handle, goals, modifiable: Table, guessBoundary, assumeAllInconsistent, suspectAll, do, record: BOOL] RETURNS [nFailed, nSucceeded, nSteps: NAT, failedSteps: CommandList, cmds: ROPE];
Ensure that given derived files are up-to-date; recursively explores sources.
IFF NOT do, THEN don't actually execute the commands to bring things up-to-date.
IFF record THEN return in cmds the commands ELSE cmds is returned empty.
Setting suspectAll cancels incrementality.
Explain: PROC [ch: Commander.Handle, nodes: Table, verbosely: BOOL];
List edges of the nodes, and give status of their producers.
It is recommended that you not try to interrupt the following:
DestroyGraph: PROC;
SuspectAll: PROC [change, remake: BOOL];
NodeMayNeedRemaking: PROC [n: Node, stack: Table];
SuspectProducer: PROC [n: Node, stack: Table];
RetryToProduce: PROC [Node];
If it has no producer, try (again) to get one.
MakeNodeTable: PROC RETURNS [table: Table];
AddNodeToTable: PROC [n: Node, t: Table];
FindNode: PROC [someName: ROPE, class: NodeClass] RETURNS [node: Node];
For controlling concurrency:
SetProcessAllocation: PROC [n: NAT];
For Stating dependency rules:
AddFinder: PROC [finder: Finder, end: End];
End: TYPE = {front, back};
Finder: TYPE = RECORD [name: ROPE, finderProc: FinderProc, finderData: REF ANYNIL];
FinderProc: TYPE = PROC [resultName: ROPE, finderData: REF ANY] RETURNS [found: BOOLEAN, sought: Node, makes: NodeList, from, cmdFrom: From, cmd: ROPE, class: CommandClass, foundData: REF ANY];
From: TYPE = RECORD [mustHave, optional: NodeList];
CommandClass: TYPE = REF CommandClassRep;
CommandClassRep: TYPE = RECORD [
NotCurrent: NotCurrentProc,
Rederive: RederiveProc,
Explain: ExplainProc,
classData: REF ANYNIL];
NotCurrentProc: TYPE = PROC [c: Command, Needed: PROC [Node] RETURNS [BOOL]] RETURNS [whyNotCurrent: ROPE--NIL means all outputs up-to-date--];
RederiveProc: TYPE = PROC [c: Command] RETURNS [from: From, cmd: ROPE];
ExplainProc: TYPE = PROC [c: Command, to: IO.STREAM];
GetNode: PROC [someName: ROPE, class: NodeClass, mayAdd: BOOLTRUE] RETURNS [node: Node];
name will first be canonized, if class#NIL, otherwise it must already be canonical
NodeClass: TYPE = REF NodeClassRep;
NodeClassRep: TYPE = RECORD [
CanonizeName: PROC [ROPE] RETURNS [ROPE],
GetTime: GetTimeProc
];
GetTimeProc: TYPE = PROC [n: Node] RETURNS [created: Time];
fileClass: NodeClass;
PublicPartsOfNode: PROC [n: Node] RETURNS [name: ROPE, class: NodeClass];
GetProp: PROC [n: Node, prop: REF ANY] RETURNS [val: REF ANY];
SetProp: PROC [n: Node, prop, val: REF ANY];
EnumerateConsumers: PROC [n: Node, which: CmdDep, to: PROC [Command, CmdDep]];
GetCreated: PROC [n: Node] RETURNS [t: Time];
Exists: PROC [n: Node] RETURNS [exists: BOOL];
= {exists ← GetCreated[n] # notExistTime}
PublicPartsOfCommand: PROC [c: Command] RETURNS [cmd: ROPE, foundData: REF ANY, failed: BOOL, reasonWhyLastDone: ROPE];
EnumerateResults: PROC [c: Command, to: PROC [Node]];
InnerEnumerateSources: PROC [c: Command, which: CmdDep, to: PROC [n: Node, which: CmdDep, optional: BOOL]];
Should only be used from inside CommandClass procs only when called from MakeDo impl.
CmdDep: TYPE = {cmd, data};
FmtTime: PROC [Time] RETURNS [ROPE];
For extracting Dependency graph:
EnumerateSources: PROC [c: Command, which: CmdDep, to: PROC [n: Node, which: CmdDep, optional: BOOL]];
GetProducer: PROC [n: Node] RETURNS [producer: Command];
For Implementing Node classes:
SuspectNodeChange: PROC [n: Node, stack: Table--of Nodes & Commands, for dependency cycle detection--];
NewRefTable: PROC RETURNS [Table--of REF ANYs, identified by address--];
END.