MakeDoPrivate.Mesa
Last Edited by: Spreitzer, February 20, 1986 6:42:53 pm PST
Carl Hauser, April 11, 1985 3:34:27 pm PST
DIRECTORY BasicTime, CedarProcess, Commander, IO, List, MakeDo, RedBlackTree, Rope, TimeStamp;
MakeDoPrivate: CEDAR DEFINITIONS =
BEGIN OPEN MakeDo;
Definitions:
Current[n] = if Leaf[n]
then true
else let a = n.producer in
CorrectlyDerived[a]
' ( iba: Current[i])
' (a.Consistent[{i:iba}, n]
( iÒa: ~i.Exists[]
( iba: Broken[i]
( a.Fails[{i:iba}])
CorrectlyDerived[a] = ia: Current[i] ' DerivedFrom[a, i] ( ia: Broken[i]
Leaf[n] = CertainlyNotModifiable[n] ( n has no producer
Current[n] Ò Broken[n] =
CertainlyModifiable[n] ' ~n.Exists[]
( ~CertainlyNotModifiable[n] ' abn: (
iba: Broken[i] ( ia: Broken[i]
( CertainlyModifiable[n] ' iÒa: ~i.Exists[]
( iÒa: i.Exists[] ' a.Fails[{i:iba}])
Basic Monitor Invariant:
(eb: ExpensiveBool H b: BOOL { eb`notComputed Ò b=eb)
~RawLeaf[node] Ò node.consistencyAsked Ò
node.consistent = node.producer.Consistent[{i:iba}, node]
node.current H Current[n]
node.created dates contents used herein
node.current=true Ò node.broken = Broken[n]
NodeSets agree with nodes
act.correctlyDerived Ò CorrectlyDerived[a]
if
act.permissionGranted ' act.queuedFailsInvalidation then a.Fails[..] unknown
else act.fails H a.Fails[..]
NodeList: TYPE = LIST OF Node;
Node: TYPE = REF NodeRep;
NodeRep: TYPE = RECORD [
name: ROPE,
class: NodeClass,
memberships: RefTable--of NodeSet--,
producer: Edge ← NIL,
props: PropList ← NIL,
to: ARRAY ActionDep OF EdgeRingHead ← ALL[emptyHead],
modifiability: Modifiability ← uninitialized,
created: Time ← unknownTime,
current: ExpensiveBool ← notComputed,
broken: BOOLFALSE,
consistencyAsked: BOOLFALSE,
consistent: BOOLFALSE,
consistencyReason: ROPENIL,
someoneWhoCares: Job ← NIL,
state: NodeState ← inactive,
waitCount: INTEGER ← 0,
waitingOnCurrent: NodeList ← NIL
];
NodeState: TYPE = {inactive, ready, working, waiting};
Action: TYPE = REF ActionRep;
ActionRep: TYPE = RECORD [
class: ActionClass,
foundData: REF ANY,
cmd: ROPE,
makes: EdgeRingHead ← emptyHead,
from: ARRAY ActionDep OF EdgeRingHead ← ALL[emptyHead],
waitingForPermission: NodeList ← NIL,
permissionGranted: BOOLFALSE,
derivedFromCurrentDeterminers: BOOLTRUE,
queuedFailsInvalidation: BOOLFALSE,
fails: ExpensiveBool ← notComputed,
reasonWhyLastDone: ROPENIL
];
ExpensiveBool: TYPE = {notComputed, false, true} ← notComputed;
Expensify: ARRAY BOOL OF ExpensiveBool = [false, true];
EdgeRingHead: TYPE = RECORD [first, last: Edge];
emptyHead: EdgeRingHead = [NIL, NIL];
Edge: TYPE = REF EdgeRep;
EdgeRep: TYPE = RECORD [
optional: BOOL,
n: Node,
a: Action,
nNext, nPrev: Edge,
aNext, aPrev: Edge
];
Job: TYPE = REF JobRep;
JobRep: TYPE = RECORD [
wDir: ROPE,
goals, processes: RefTable,
otherModifiable: ModifiabilitySpec,
nSteps: NAT ← 0,
failedSteps: ActionList ← NIL
];
NodeSet: TYPE = REF NodeSetPrivate;
NodeSetPrivate: TYPE = RECORD [
nodes: RefTable,
currents, nonCurrents: INT ← 0,
currents counts nodes with current=true; nonCurrent counts others.
broken, ok: INT ← 0
Only current nodes are counted broken or ok.
];
NodeClass: TYPE = REF NodeClassRep;
NodeClassRep: TYPE = RECORD [
name: ROPE,
CanonizeName: PROC [ROPE] RETURNS [ROPE],
GetTime: GetTimeProc
];
debugging: BOOL;
leaf: Action;
Log: PROC [fmt: ROPE, v1, v2, v3, v4, v5: IO.Value ← [null[]]];
Confirm: PROC [action: ROPE];
GetCommanderHandle: PROC RETURNS [Commander.Handle];
EnumerateFinders: PROC [to: PROC [Finder]];
IncrementStepCount: PROC [Job];
AddFailedCmd: PROC [Job, Action];
EnglishList: PROC [NodeList] RETURNS [el: ROPE, ec: CARDINAL];
NodeInRefTable: PROC [n: Node, t: RefTable] RETURNS [BOOL];
IsRootGoal: PROC [job: Job, n: Node] RETURNS [BOOL];
IsLeaf: PROC [job: Job, n: Node] RETURNS [BOOL];
In Basic monitor:
StartTime: PROC [n: Node];
In node table monitor:
EnumerateNodes: PROC [to: PROC [Node], andDestroy--table when done--: BOOL];
END.