MakeDo.Mesa
Last Edited by: Spreitzer, May 9, 1986 8:37:53 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;
RefTable: 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;
New Types & Stuff:
NodeList: TYPE = LIST OF Node;
Node: TYPE = REF NodeRep; NodeRep: TYPE;
ActionList: TYPE = LIST OF Action;
Action: TYPE = REF ActionRep; ActionRep: TYPE;
Warning: SIGNAL [message: ROPE];
IsNode: PROC [REF ANY] RETURNS [BOOL];
NarrowToNode: PROC [REF ANY] RETURNS [Node];
IsAction: PROC [REF ANY] RETURNS [BOOL];
NarrowToAction: PROC [REF ANY] RETURNS [Action];
For deriving dependecies and ensuring consistency:
Ensure: PROC [goals: RefTable, modifiabilitySpec: ModifiabilitySpec, parent: Commander.Handle] RETURNS [okGoalCount, nonOKGoalCount, nSteps: NAT, failedSteps: ActionList, nonOKGoalList: NodeList];
Ensure that given goal nodes are current.
ModifiabilitySpec: TYPE = RefTable;
NIL means guess, #NIL means modifiable iff in Table.
Modifiability: TYPE = {yes, guess, no, uninitialized};
Explain: PROC [ch: Commander.Handle, nodes: RefTable];
List edges of the nodes, and give status of their producers.
GetActions: PROC [goals: RefTable, modifiabilitySpec: ModifiabilitySpec, report: ReportSpec] RETURNS [actions: ActionList];
Recursively explores graph to leaves.
Returns some actions, according to report.
The order of those actions is: actions to do later appear earlier.
ReportSpec: TYPE = {none, toBeDone, all};
DestructivelyReverseActionList: PROC [ActionList] RETURNS [ActionList];
It is recommended that you not try to interrupt the following:
SuspectNodeChange: PROC [n: Node];
UncurrentNode: PROC [n: Node];
UncurrentProducer: PROC [n: Node];
ForAll: PROC [suspectChange, uncurrent: BOOL];
DestroyGraph: PROC;
RetryToProduce: PROC [Node];
If it has no producer (other than leaf), try (again) to get one.
MakeRefTable: PROC RETURNS [table: RefTable];
AddToRefTable: PROC [ra: REF ANY, t: RefTable];
EnsureRefInTable: PROC [ra: REF ANY, t: RefTable];
DeleteFromRefTable: PROC [ra: REF ANY, t: RefTable] RETURNS [found: REF ANY];
AnalyzeDFFile: PROC [dfName: ROPE, goals: RefTable, modifiable: ModifiabilitySpec, doToVerifyGoals, doToOthers: DoToFile];
DoToFile: TYPE = {ignore, makeGoal, makeModifiable};
FindNode: PROC [someName: ROPE, class: NodeClass] RETURNS [node: Node];
class may not be NIL.
LookupNodeClass: PROC [className: ROPE] RETURNS [class: NodeClass];
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, cmdFrom: NodeList, from: From, cmd: ROPE, class: ActionClass, foundData: REF ANY];
From: TYPE = RECORD [mustHave, optional: NodeList];
ActionClass: TYPE = REF ActionClassRep;
ActionClassRep: TYPE = RECORD [
CheckConsistency: ConsistencyChecker,
Rederive: RederiveProc,
classData: REF ANYNIL];
ConsistencyChecker: TYPE = PROC [a: Action, result: Node] RETURNS [consistent: BOOL, reason: ROPE];
Missing inputs necessitate any result being consistent; but then, this won't be called if there are missing inputs.
RederiveProc: TYPE = PROC [a: Action] RETURNS [from: From, cmd: ROPE];
GetNode: PROC [someName: ROPE, class: NodeClass, mayAdd: BOOLTRUE] RETURNS [node: Node];
class may not be NIL.
name will first be canonized.
NodeClass: TYPE = REF NodeClassRep;
NodeClassRep: TYPE;
IsNodeClass: PROC [REF ANY] RETURNS [BOOL];
NarrowToNodeClass: PROC [REF ANY] RETURNS [NodeClass];
DeclareNodeClass
:
PROC [
name: ROPE,
CanonizeName: PROC [ROPE] RETURNS [ROPE],
GetTime: GetTimeProc
]
RETURNS [nodeClass: NodeClass];
GetTimeProc: TYPE = PROC [n: Node] RETURNS [created: Time];
fileClass: NodeClass;
PublicPartsOfNode: PROC [n: Node] RETURNS [name: ROPE, class: NodeClass];
PublicPartsOfNodeClass: PROC [nc: NodeClass] RETURNS [name: ROPE, CanonizeName: PROC [ROPE] RETURNS [ROPE], GetTime: GetTimeProc];
DescribeNode: PROC [n: Node] RETURNS [ROPE];
GetProp: PROC [n: Node, prop: REF ANY] RETURNS [val: REF ANY];
SetProp: PROC [n: Node, prop, val: REF ANY];
GetProducer: PROC [n: Node] RETURNS [producer: Action];
InnerGetCreated: PROC [n: Node] RETURNS [t: Time];
InnerExists: PROC [n: Node] RETURNS [exists: BOOL];
= {exists ← InnerGetCreated[n] # notExistTime}
PublicPartsOfAction: PROC [a: Action] RETURNS [cmd: ROPE, foundData: REF ANY];
InnerEnumerateSources: PROC [a: Action, which: ActionDep, to: PROC [n: Node, which: ActionDep, optional: BOOL]];
Should only be used from inside ActionClass procs only when called from MakeDo impl.
ActionDep: TYPE = {cmd, data};
FmtTime: PROC [Time] RETURNS [ROPE];
For Extracting the Dependency Graph:
GetCreated: PROC [n: Node] RETURNS [t: Time];
Exists: PROC [n: Node] RETURNS [exists: BOOL];
= {exists ← GetCreated[n] # notExistTime}
EnumerateConsumers: PROC [n: Node, which: ActionDep, to: PROC [Action, ActionDep]];
EnumerateResults: PROC [a: Action, to: PROC [Node]];
EnumerateSources: PROC [a: Action, which: ActionDep, to: PROC [n: Node, which: ActionDep, optional: BOOL]];
END.