DFN.mesa
Peter Kessler, February 21, 1986 2:49:03 pm PST
static char sccsid[] = "@(#)c 5.1 (Berkeley) 6/4/85";
DIRECTORY
BasicTime USING [Pulses, GetClockPulses, PulsesToSeconds],
IO USING [PutF],
ViewerIO USING [CreateViewerStreams, STREAM];
-- Rope USING [ROPE, Equal], --
DFN: -- CEDAR -- PROGRAM
IMPORTS IO, ViewerIO, BasicTime --, Rope--
= {
nlType: TYPE = -- a node (an entry in the namelist)
RECORD[
name: INT,
for identification
children: arcTypeRef ← NIL,
list of arcs to children
cyclehead: nlTypeRef ← NIL,
pointer to the head of this cycle, or pointer to self
cnext: nlTypeRef ← NIL,
pointer to next member of cycle
nlnext: nlTypeRef ← NIL,
chain of all the nl entries
toporder: dfnNumber ← DFNNaN
topological ordering number
];
nlTypeRef: TYPE = LONG POINTER TO nlType;
arcType: TYPE = -- an arc
RECORD[
arcChildp: nlTypeRef ← NIL,
pointer to the child of this arc
arcChildlist: arcTypeRef ← NIL
chain of children of this parent
];
arcTypeRef: TYPE = LONG POINTER TO arcType;
dfnNumber: TYPE = INT ← DFNNaN;
DFNNaN: dfnNumber = 0;
used to mark depth first numbers that aren't set yet.
DFNBusy: dfnNumber = -1;
used to mark depth-first numbers that are being set.
dfnstruct: TYPE = RECORD[
elements of the depth first numbering stack.
nlentryp: nlTypeRef,
cycletop: INT];
dfntype: TYPE = dfnstruct;
what is it about C that requires this separate type declaration?
not wanting to type `struct dfnstruct' as a type.
DFNMaxDepth: INT = 100;
the maximum depth of the depth first numbering stack.
dfnStack: ARRAY [0 .. DFNMaxDepth) OF dfntype;
dfnDepth: INT ← 0;
dfnCounter: dfnNumber ← DFNNaN;
DFNDEBUG: BOOL = FALSE;
set this to TRUE for debugging PutF's
nlMax: INT = 101;
nlAvail: INT [0 .. nlMax) ← 0;
nlZone: ARRAY [0 .. nlMax) OF nlType;
arcMax: INT = 600;
arcAvail: INT [0 .. arcMax) ← 0;
arcZone: ARRAY [0 .. arcMax) OF arcType;
out: ViewerIO.STREAMNIL;
DepthFirstNumber: PUBLIC PROCEDURE [parentp: nlTypeRef] RETURNS [BOOL] = {
given this parent, depth first number its children.
IF DFNDEBUG THEN {
IO.PutF[out, "[dfn] dfn[%g]\n", [integer[printname[parentp]]]];
};
IF dfnNumbered[childp: parentp] THEN {
if we're already numbered, no need to look any furthur.
RETURN [TRUE];
};
IF dfnBusy[childp: parentp] THEN {
if we're already busy, must be a cycle
RETURN [dfnFindcycle[parentp]];
};
visit yourself before your children
IF NOT dfnPreVisit[parentp: parentp] THEN {
RETURN [FALSE];
};
visit children
FOR arcp: arcTypeRef ← parentp^.children, arcp^.arcChildlist WHILE arcp # NIL DO
IF NOT DepthFirstNumber[parentp: arcp^.arcChildp] THEN {
RETURN [FALSE];
};
ENDLOOP;
visit yourself after your children
IF NOT dfnPostVisit[parentp: parentp] THEN {
RETURN [FALSE];
};
RETURN [TRUE];
};
dfnPreVisit: PROCEDURE [parentp: nlTypeRef] RETURNS [BOOL] = {
push a parent onto the stack and mark it busy
dfnDepth ← dfnDepth + 1;
IF dfnDepth >= DFNMaxDepth THEN {
IO.PutF[out, "[dfn] out of my depth [dfnStack overflow]\n"];
RETURN [FALSE];
};
dfnStack[dfnDepth].nlentryp ← parentp;
dfnStack[dfnDepth].cycletop ← dfnDepth;
parentp^.toporder ← DFNBusy;
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnPreVisit]\t\t%g: %g\n" , [integer[dfnDepth]], [integer[printname[parentp]]]];
};
RETURN [TRUE];
};
dfnNumbered: PROCEDURE [childp: nlTypeRef] RETURNS [BOOL] = {
are we already numbered?
RETURN [childp^.toporder # DFNNaN AND childp^.toporder # DFNBusy];
};
dfnBusy: PROCEDURE [childp: nlTypeRef] RETURNS [BOOL] = {
are we already busy?
RETURN [childp^.toporder # DFNNaN];
};
dfnFindcycle: PROCEDURE [childp: nlTypeRef] RETURNS [result: BOOL] = {
MISSING: an explanation
cycletop: INT;
cycleheadp: nlTypeRef;
tailp: nlTypeRef;
FOR cycletop DECREASING IN (0 .. dfnDepth] DO
cycleheadp ← dfnStack[cycletop].nlentryp;
IF childp = cycleheadp THEN {
EXIT;
};
IF childp^.cyclehead # childp AND childp^.cyclehead = cycleheadp THEN {
EXIT;
};
ENDLOOP;
IF cycletop <= 0 THEN {
IO.PutF[out, "[dfnFindcycle] couldn't find head of cycle\n"];
RETURN [FALSE];
};
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnFindcycle] dfnDepth %g cycletop %g %g\n",
[integer[dfnDepth]], [integer[cycletop]], [integer[printname[cycleheadp]]]];
};
IF cycletop = dfnDepth
THEN {
this is previous function, e.g. this calls itself: sort of boring
result ← dfnSelfCycle[childp];
}
ELSE {
glom intervening functions that aren't already glommed into this cycle.
things have been glommed when their cyclehead field points to the head of the cycle they are glommed into.
FOR tailp ← cycleheadp, tailp^.cnext WHILE tailp^.cnext # NIL DO
NULL;
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnFindcycle] tail %g\n", [integer[printname[tailp]]]];
};
ENDLOOP;
if what we think is the top of the cycle has a cyclehead field, then it's not really the head of the cycle, which is really what we want
IF cycleheadp^.cyclehead # cycleheadp THEN {
cycleheadp ← cycleheadp^.cyclehead;
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnFindcycle] new cyclehead %g\n", [integer[printname[cycleheadp]]]];
};
};
FOR index: INT IN [cycletop + 1 .. dfnDepth] DO
childp ← dfnStack[index].nlentryp;
IF childp^.cyclehead = childp
THEN {
not yet glommed anywhere, glom it
and fix any children it has glommed
tailp^.cnext ← childp;
childp^.cyclehead ← cycleheadp;
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnFindcycle] glomming %g onto %g\n",
[integer[printname[childp]]], [integer[printname[cycleheadp]]]];
};
FOR tailp ← childp, tailp^.cnext WHILE tailp^.cnext # NIL DO
tailp^.cnext^.cyclehead ← cycleheadp;
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnFindcycle] and its tail %g onto %g\n", [integer[printname[tailp^.cnext]]], [integer[printname[cycleheadp]]]];
};
ENDLOOP;
}
ELSE {
IF childp^.cyclehead # cycleheadp -- firewall -- THEN {
IO.PutF[out, "[dfnBusy] glommed, but not to cyclehead\n"];
};
};
ENDLOOP;
result ← TRUE;
};
};
dfnSelfCycle: PROCEDURE [parentp: nlTypeRef] RETURNS [BOOL] = {
deal with self-cycles
since we are taking out self-cycles elsewhere no need for the special case, here.
NULL;
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnSelfCycle] %g \n", [integer[printname[parentp]]]];
};
RETURN [TRUE];
};
dfnPostVisit: PROCEDURE [parentp: nlTypeRef] RETURNS [BOOL] = {
visit a node after all its children and pop it off the stack
[MISSING: an explanation]
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnPostVisit]\t%g: %g\n" , [integer[dfnDepth]], [integer[printname[parentp]]]];
};
number functions and things in their cycles unless the function is itself part of a cycle
IF parentp^.cyclehead = parentp
THEN {
dfnCounter ← dfnCounter + 1;
FOR memberp: nlTypeRef ← parentp, memberp^.cnext WHILE memberp # NIL DO
memberp^.toporder ← dfnCounter;
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnPostVisit]\t\tmember %g^.toporder ← %g\n",
[integer[printname[memberp]]], [integer[dfnCounter]]];
};
ENDLOOP;
}
ELSE {
IF DFNDEBUG THEN {
IO.PutF[out, "[dfnPostVisit]\t\tis part of a cycle\n"];
};
};
dfnDepth ← dfnDepth - 1;
RETURN [TRUE];
};
printname: PROCEDURE [nlentryp: nlTypeRef] RETURNS [INT] = {
RETURN [nlentryp^.name];
};
*** stuff for using the interpreter to run this ***
nodeWorld: nlTypeRef ← NIL;
AddNode: PROCEDURE [name: INT] RETURNS [nlTypeRef] = {
node: nlTypeRef ← @nlZone[nlAvail];
nlAvail ← nlAvail + 1;
node^.name ← name;
node^.nlnext ← nodeWorld;
node^.cyclehead ← node;
nodeWorld ← node;
RETURN [node];
};
NodeLookup: PROCEDURE [name: INT] RETURNS [nlTypeRef] = {
FOR nodep: nlTypeRef ← nodeWorld, nodep^.nlnext WHILE nodep # NIL DO
IF name = nodep^.name THEN
RETURN [nodep];
ENDLOOP;
RETURN [NIL];
};
AddArc: PROCEDURE [from: INT, to: INT] RETURNS [arcTypeRef] = {
fromNode: nlTypeRef ← NodeLookup[from];
toNode: nlTypeRef ← NodeLookup[to];
IF fromNode # NIL AND toNode # NIL THEN {
arcp: arcTypeRef ← @arcZone[arcAvail];
arcAvail ← arcAvail + 1;
arcp^.arcChildp ← toNode;
arcp^.arcChildlist ← fromNode^.children;
fromNode^.children ← arcp;
RETURN [arcp];
};
RETURN [NIL];
};
PrintNode: PROCEDURE [nodep: nlTypeRef] RETURNS [] = {
IO.PutF[out, "%g: %g\n", [integer[nodep^.name]], [integer[nodep^.toporder]]];
};
PrintNodeWorld: PROCEDURE [] RETURNS [] = {
FOR nodep: nlTypeRef ← nodeWorld, nodep^.nlnext WHILE nodep # NIL DO
PrintNode[nodep];
ENDLOOP;
};
DoIt: PROCEDURE [] RETURNS [result: BOOL] = {
startPulses: BasicTime.Pulses;
Build the world
BuildWorld: PROC = {
[] ← AddNode[1];
[] ← AddNode[2];
[] ← AddNode[3];
[] ← AddNode[4];
[] ← AddNode[5];
[] ← AddNode[6];
[] ← AddNode[7];
[] ← AddNode[8];
[] ← AddNode[9];
[] ← AddNode[10];
[] ← AddNode[11];
[] ← AddNode[12];
[] ← AddNode[13];
[] ← AddNode[14];
[] ← AddNode[15];
[] ← AddNode[16];
[] ← AddNode[17];
[] ← AddNode[18];
[] ← AddNode[19];
[] ← AddNode[20];
[] ← AddNode[21];
[] ← AddNode[22];
[] ← AddNode[23];
[] ← AddNode[24];
[] ← AddNode[25];
[] ← AddNode[26];
[] ← AddNode[27];
[] ← AddNode[28];
[] ← AddNode[29];
[] ← AddNode[30];
[] ← AddNode[31];
[] ← AddNode[32];
[] ← AddNode[33];
[] ← AddNode[34];
[] ← AddNode[35];
[] ← AddNode[36];
[] ← AddNode[37];
[] ← AddNode[38];
[] ← AddNode[39];
[] ← AddNode[40];
[] ← AddNode[41];
[] ← AddNode[42];
[] ← AddNode[43];
[] ← AddNode[44];
[] ← AddNode[45];
[] ← AddNode[46];
[] ← AddNode[47];
[] ← AddNode[48];
[] ← AddNode[49];
[] ← AddNode[50];
[] ← AddNode[51];
[] ← AddNode[52];
[] ← AddNode[53];
[] ← AddNode[54];
[] ← AddNode[55];
[] ← AddNode[56];
[] ← AddNode[57];
[] ← AddNode[58];
[] ← AddNode[59];
[] ← AddNode[60];
[] ← AddNode[61];
[] ← AddNode[62];
[] ← AddNode[63];
[] ← AddNode[64];
[] ← AddNode[65];
[] ← AddNode[66];
[] ← AddNode[67];
[] ← AddNode[68];
[] ← AddNode[69];
[] ← AddNode[70];
[] ← AddNode[71];
[] ← AddNode[72];
[] ← AddNode[73];
[] ← AddNode[74];
[] ← AddNode[75];
[] ← AddNode[76];
[] ← AddNode[77];
[] ← AddNode[78];
[] ← AddNode[79];
[] ← AddNode[80];
[] ← AddNode[81];
[] ← AddNode[82];
[] ← AddNode[83];
[] ← AddNode[84];
[] ← AddNode[85];
[] ← AddNode[86];
[] ← AddNode[87];
[] ← AddNode[88];
[] ← AddNode[89];
[] ← AddNode[90];
[] ← AddNode[91];
[] ← AddNode[92];
[] ← AddNode[93];
[] ← AddNode[94];
[] ← AddNode[95];
[] ← AddNode[96];
[] ← AddNode[97];
[] ← AddNode[98];
[] ← AddNode[99];
[] ← AddNode[100];
};
Set up the arcs
ConnectWorld: PROC = {
[] ← AddArc[ 1, 2];
[] ← AddArc[ 1, 3];
[] ← AddArc[ 1, 4];
[] ← AddArc[ 1, 5];
[] ← AddArc[ 2, 6];
[] ← AddArc[ 2, 7];
[] ← AddArc[ 4, 8];
[] ← AddArc[ 4, 9];
[] ← AddArc[ 4, 10];
[] ← AddArc[ 4, 11];
[] ← AddArc[ 5, 12];
[] ← AddArc[ 5, 12];
[] ← AddArc[ 5, 13];
[] ← AddArc[ 5, 14];
[] ← AddArc[ 5, 15];
[] ← AddArc[ 6, 16];
[] ← AddArc[ 6, 17];
[] ← AddArc[ 7, 18];
[] ← AddArc[ 7, 4];
[] ← AddArc[ 8, 19];
[] ← AddArc[ 8, 20];
[] ← AddArc[ 8, 13];
[] ← AddArc[ 8, 21];
[] ← AddArc[ 8, 22];
[] ← AddArc[ 9, 23];
[] ← AddArc[ 9, 6];
[] ← AddArc[ 10, 24];
[] ← AddArc[ 10, 25];
[] ← AddArc[ 10, 26];
[] ← AddArc[ 10, 27];
[] ← AddArc[ 10, 4];
[] ← AddArc[ 11, 21];
[] ← AddArc[ 11, 27];
[] ← AddArc[ 11, 9];
[] ← AddArc[ 12, 28];
[] ← AddArc[ 12, 29];
[] ← AddArc[ 12, 30];
[] ← AddArc[ 12, 31];
[] ← AddArc[ 13, 32];
[] ← AddArc[ 13, 33];
[] ← AddArc[ 13, 34];
[] ← AddArc[ 13, 35];
[] ← AddArc[ 13, 36];
[] ← AddArc[ 15, 7];
[] ← AddArc[ 16, 37];
[] ← AddArc[ 16, 33];
[] ← AddArc[ 16, 38];
[] ← AddArc[ 16, 39];
[] ← AddArc[ 17, 40];
[] ← AddArc[ 17, 41];
[] ← AddArc[ 18, 24];
[] ← AddArc[ 18, 42];
[] ← AddArc[ 19, 43];
[] ← AddArc[ 19, 20];
[] ← AddArc[ 19, 25];
[] ← AddArc[ 19, 44];
[] ← AddArc[ 20, 45];
[] ← AddArc[ 20, 46];
[] ← AddArc[ 20, 26];
[] ← AddArc[ 22, 40];
[] ← AddArc[ 22, 47];
[] ← AddArc[ 22, 34];
[] ← AddArc[ 22, 48];
[] ← AddArc[ 22, 49];
[] ← AddArc[ 22, 12];
[] ← AddArc[ 23, 33];
[] ← AddArc[ 23, 50];
[] ← AddArc[ 23, 41];
[] ← AddArc[ 24, 51];
[] ← AddArc[ 24, 52];
[] ← AddArc[ 24, 53];
[] ← AddArc[ 24, 11];
[] ← AddArc[ 25, 4];
[] ← AddArc[ 26, 29];
[] ← AddArc[ 26, 54];
[] ← AddArc[ 26, 12];
[] ← AddArc[ 27, 55];
[] ← AddArc[ 27, 56];
[] ← AddArc[ 27, 57];
[] ← AddArc[ 28, 58];
[] ← AddArc[ 28, 38];
[] ← AddArc[ 28, 59];
[] ← AddArc[ 28, 52];
[] ← AddArc[ 29, 32];
[] ← AddArc[ 29, 60];
[] ← AddArc[ 29, 47];
[] ← AddArc[ 29, 61];
[] ← AddArc[ 29, 50];
[] ← AddArc[ 29, 21];
[] ← AddArc[ 30, 62];
[] ← AddArc[ 30, 63];
[] ← AddArc[ 30, 64];
[] ← AddArc[ 31, 33];
[] ← AddArc[ 31, 65];
[] ← AddArc[ 31, 46];
[] ← AddArc[ 31, 63];
[] ← AddArc[ 31, 40];
[] ← AddArc[ 31, 8];
[] ← AddArc[ 32, 45];
[] ← AddArc[ 32, 66];
[] ← AddArc[ 32, 20];
[] ← AddArc[ 33, 53];
[] ← AddArc[ 33, 67];
[] ← AddArc[ 33, 28];
[] ← AddArc[ 34, 47];
[] ← AddArc[ 34, 39];
[] ← AddArc[ 34, 38];
[] ← AddArc[ 34, 57];
[] ← AddArc[ 34, 68];
[] ← AddArc[ 35, 69];
[] ← AddArc[ 35, 45];
[] ← AddArc[ 35, 40];
[] ← AddArc[ 35, 70];
[] ← AddArc[ 35, 71];
[] ← AddArc[ 36, 42];
[] ← AddArc[ 36, 64];
[] ← AddArc[ 36, 61];
[] ← AddArc[ 36, 48];
[] ← AddArc[ 36, 63];
[] ← AddArc[ 36, 13];
[] ← AddArc[ 37, 72];
[] ← AddArc[ 37, 45];
[] ← AddArc[ 37, 16];
[] ← AddArc[ 38, 23];
[] ← AddArc[ 39, 73];
[] ← AddArc[ 39, 74];
[] ← AddArc[ 39, 75];
[] ← AddArc[ 39, 76];
[] ← AddArc[ 40, 44];
[] ← AddArc[ 40, 53];
[] ← AddArc[ 40, 63];
[] ← AddArc[ 40, 77];
[] ← AddArc[ 42, 78];
[] ← AddArc[ 42, 79];
[] ← AddArc[ 42, 80];
[] ← AddArc[ 43, 81];
[] ← AddArc[ 43, 50];
[] ← AddArc[ 43, 66];
[] ← AddArc[ 43, 50];
[] ← AddArc[ 43, 82];
[] ← AddArc[ 44, 49];
[] ← AddArc[ 44, 73];
[] ← AddArc[ 44, 57];
[] ← AddArc[ 44, 76];
[] ← AddArc[ 44, 81];
[] ← AddArc[ 44, 10];
[] ← AddArc[ 45, 11];
[] ← AddArc[ 46, 83];
[] ← AddArc[ 46, 2];
[] ← AddArc[ 47, 79];
[] ← AddArc[ 47, 84];
[] ← AddArc[ 47, 73];
[] ← AddArc[ 48, 61];
[] ← AddArc[ 48, 85];
[] ← AddArc[ 48, 69];
[] ← AddArc[ 48, 35];
[] ← AddArc[ 49, 44];
[] ← AddArc[ 50, 21];
[] ← AddArc[ 52, 71];
[] ← AddArc[ 52, 86];
[] ← AddArc[ 54, 87];
[] ← AddArc[ 54, 84];
[] ← AddArc[ 54, 68];
[] ← AddArc[ 54, 83];
[] ← AddArc[ 54, 71];
[] ← AddArc[ 55, 63];
[] ← AddArc[ 55, 88];
[] ← AddArc[ 55, 69];
[] ← AddArc[ 56, 82];
[] ← AddArc[ 56, 89];
[] ← AddArc[ 56, 38];
[] ← AddArc[ 57, 78];
[] ← AddArc[ 57, 84];
[] ← AddArc[ 57, 20];
[] ← AddArc[ 59, 90];
[] ← AddArc[ 59, 91];
[] ← AddArc[ 60, 92];
[] ← AddArc[ 61, 86];
[] ← AddArc[ 62, 65];
[] ← AddArc[ 62, 86];
[] ← AddArc[ 62, 20];
[] ← AddArc[ 63, 80];
[] ← AddArc[ 63, 22];
[] ← AddArc[ 64, 88];
[] ← AddArc[ 65, 93];
[] ← AddArc[ 65, 75];
[] ← AddArc[ 65, 69];
[] ← AddArc[ 65, 67];
[] ← AddArc[ 65, 85];
[] ← AddArc[ 65, 13];
[] ← AddArc[ 66, 72];
[] ← AddArc[ 66, 49];
[] ← AddArc[ 67, 83];
[] ← AddArc[ 67, 90];
[] ← AddArc[ 67, 94];
[] ← AddArc[ 67, 91];
[] ← AddArc[ 67, 20];
[] ← AddArc[ 68, 92];
[] ← AddArc[ 68, 79];
[] ← AddArc[ 68, 69];
[] ← AddArc[ 68, 73];
[] ← AddArc[ 68, 95];
[] ← AddArc[ 68, 19];
[] ← AddArc[ 69, 79];
[] ← AddArc[ 70, 88];
[] ← AddArc[ 70, 61];
[] ← AddArc[ 71, 95];
[] ← AddArc[ 71, 2];
[] ← AddArc[ 72, 61];
[] ← AddArc[ 73, 75];
[] ← AddArc[ 73, 67];
[] ← AddArc[ 74, 93];
[] ← AddArc[ 74, 88];
[] ← AddArc[ 74, 90];
[] ← AddArc[ 75, 85];
[] ← AddArc[ 75, 96];
[] ← AddArc[ 75, 96];
[] ← AddArc[ 75, 29];
[] ← AddArc[ 76, 49];
[] ← AddArc[ 77, 97];
[] ← AddArc[ 77, 95];
[] ← AddArc[ 77, 94];
[] ← AddArc[ 77, 83];
[] ← AddArc[ 77, 76];
[] ← AddArc[ 78, 95];
[] ← AddArc[ 78, 92];
[] ← AddArc[ 78, 85];
[] ← AddArc[ 78, 93];
[] ← AddArc[ 79, 89];
[] ← AddArc[ 79, 80];
[] ← AddArc[ 80, 91];
[] ← AddArc[ 80, 83];
[] ← AddArc[ 83, 98];
[] ← AddArc[ 83, 93];
[] ← AddArc[ 84, 91];
[] ← AddArc[ 84, 87];
[] ← AddArc[ 84, 97];
[] ← AddArc[ 84, 94];
[] ← AddArc[ 85, 96];
[] ← AddArc[ 86, 91];
[] ← AddArc[ 86, 96];
[] ← AddArc[ 86, 88];
[] ← AddArc[ 86, 97];
[] ← AddArc[ 86, 92];
[] ← AddArc[ 87, 98];
[] ← AddArc[ 87, 95];
[] ← AddArc[ 87, 99];
[] ← AddArc[ 87, 95];
[] ← AddArc[ 87, 22];
[] ← AddArc[ 88, 22];
[] ← AddArc[ 89, 99];
[] ← AddArc[ 89, 90];
[] ← AddArc[ 89, 96];
[] ← AddArc[ 89, 92];
[] ← AddArc[ 89, 93];
[] ← AddArc[ 90, 92];
[] ← AddArc[ 91, 2];
[] ← AddArc[ 92, 32];
[] ← AddArc[ 93, 96];
[] ← AddArc[ 93, 96];
[] ← AddArc[ 93, 97];
[] ← AddArc[ 93, 97];
[] ← AddArc[ 93, 95];
[] ← AddArc[ 94, 99];
[] ← AddArc[ 94, 97];
[] ← AddArc[ 94, 100];
[] ← AddArc[ 94, 95];
[] ← AddArc[ 94, 98];
[] ← AddArc[ 95, 96];
[] ← AddArc[ 95, 97];
[] ← AddArc[ 95, 98];
[] ← AddArc[ 95, 8];
[] ← AddArc[ 96, 99];
[] ← AddArc[ 96, 97];
[] ← AddArc[ 96, 33];
[] ← AddArc[ 97, 99];
[] ← AddArc[ 97, 53];
[] ← AddArc[ 98, 99];
[] ← AddArc[ 99, 86];
[] ← AddArc[100, 37];
};
out ← ViewerIO.CreateViewerStreams[name: "DFN.log"].out;
BuildWorld[];
ConnectWorld[];
Number the nodes
startPulses ← BasicTime.GetClockPulses[];
result ← DepthFirstNumber[NodeLookup[1 -- foo --]];
IO.PutF[out, "elapsed user time: %g secs\n",
[real[BasicTime.PulsesToSeconds[BasicTime.GetClockPulses[] - startPulses]]]];
And check the result
PrintNodeWorld;
};
}.