MODULE MentorBundle;
Generated by m3bundle; see its manpage.
IMPORT Bundle, BundleRep, Text;
IMPORT Thread, Wr, TextWr;
TYPE T = Bundle.T OBJECT OVERRIDES
get := LookUp;
getNames := GetNames;
END;
TYPE Texts = REF ARRAY OF TEXT;
VAR
bundle: T := NIL;
names : Texts := NIL;
PROCEDURE Get(): Bundle.T =
BEGIN
IF (bundle = NIL) THEN bundle := NEW (T) END;
RETURN bundle;
END Get;
PROCEDURE GetNames (<*UNUSED*> self: T): Texts =
BEGIN
IF names = NIL THEN
names := NEW (Texts, NUMBER (Names));
names^ := Names;
END;
RETURN names;
END GetNames;
PROCEDURE LookUp (<*UNUSED*> self: T; element: TEXT): TEXT =
BEGIN
FOR i := 0 TO LAST (Names)-1 DO
IF Text.Equal (Names[i], element) THEN
IF Elements[i] = NIL THEN Elements[i] := GetElt (i) END;
RETURN Elements[i];
END;
END;
RETURN NIL;
END LookUp;
CONST Names = ARRAY [0..126] OF TEXT {
"binpackprompt.fv",
"ShortestPathTranscriptView.fv",
"DGraphTranscriptView.fv",
"A_RecDescent.code",
"ZPaperTranscriptView.fv",
"EuclidTranscriptView.fv",
"dgraph.data",
"zviewframe.fv",
"proof",
"MatchEventData.fv",
"SPGraph.obl",
"Insertion.m3",
"AverageDepth.obl",
"stringsearchautoview.fv",
"CPEventData.fv",
"PacketStep.obl",
"WheelerTranscriptView.fv",
"maxflowinput.fv",
"CPCode.cc",
"data.simple",
"HullEventData.fv",
"logoEventData.fv",
"Warshall.m3.cv",
"HashEventData.fv",
"hashinput.fv",
"Compress.obl",
"RedBlack.pseudo",
"ManyPacketsMove.obl",
"binpackFFvar.fv",
"A_BottomUp.code",
"StringSearchTranscriptView.fv",
"BigTree.obl",
"CPinput.fv",
"ViewGameTreeB.obl",
"data.big",
"WrapAlg.m3.cv",
"myview.obl",
"WarshallVar.fv",
"BresenhamEventData.fv",
"InsertionVar.fv",
"MaxflowEventData.fv",
"maxflowcode.m3",
"AlgGreedy.fv",
"binpackinput.fv",
"ShortestPathEventData.fv",
"DGraphEventData.fv",
"NodeDepth.obl",
"Parse.fv",
"ZPaperEventData.fv",
"EuclidEventData.fv",
"PacketRoute.obl",
"graph.sx",
"DFSTC.m3.cv",
"BinpackTranscriptView.fv",
"zdata.fv",
"SubtypeTranscriptView.fv",
"SearchTreeTranscriptView.fv",
"alg_m3.code",
"SearchTree.fv",
"ParseTranscriptView.fv",
"UnionFindTranscriptView.fv",
"MinimaxTranscriptView.fv",
"SortData.fv",
"stringsearchtextview.fv",
"UnionFind.fv",
"MinimaxInput.fv",
"WheelerEventData.fv",
"CPCode.m3c",
"view1.obl",
"data.fin",
"WheelerInput.fv",
"PacketTrace.obl",
"SortTranscriptView.fv",
"DGraphinput.fv",
"Tree.obl",
"ViewGameTreeA.obl",
"PQueueTranscriptView.fv",
"HashVar.fv",
"pqueueinput.fv",
"PktRouteTranscriptView.fv",
"Unbalanced.m3",
"alg.c",
"WhyDecompressWorks.obl",
"A_TopDown.code",
"StringSearchEventData.fv",
"data.backedge",
"ChangeParent.obl",
"hullinput.fv",
"QueueSizes.obl",
"MatchTranscriptView.fv",
"Insertion.pas",
"CPTranscriptView.fv",
"maxflowdata.fv",
"CPCode.pasc",
"HullTranscriptView.fv",
"logoTranscriptView.fv",
"DFS.m3.cv",
"HashTranscriptView.fv",
"BinpackEventData.fv",
"SubtypeEventData.fv",
"logoinput.fv",
"PacketMove.obl",
"hashstats.fv",
"SearchTreeEventData.fv",
"subtypeinput.fv",
"RedBlack.m3",
"ParseEventData.fv",
"UnionFindEventData.fv",
"MinimaxEventData.fv",
"stringsearchinput.fv",
"CPVar.fv",
"data.big2",
"Decompress.pcode",
"Decompress.obl",
"SortEventData.fv",
"DFSVar.fv",
"ManyPacketsStep.obl",
"BresenhamTranscriptView.fv",
"MaxflowTranscriptView.fv",
"PQueueEventData.fv",
"bresenhaminput.fv",
"pqueueAlgs.m3",
"FindLength.obl",
"ViewColorScale.obl",
"PktRouteEventData.fv",
"Unbalanced.pseudo",
NIL
};
VAR Elements := ARRAY [0..126] OF TEXT {
E0,
E1,
E2,
E3,
E4,
E5,
E6,
E7,
NIL (* E8 .. E8_0 *),
NIL (* E9 .. E9_0 *),
NIL (* E10 .. E10_3 *),
E11,
NIL (* E12 .. E12_3 *),
E13,
NIL (* E14 .. E14_5 *),
NIL (* E15 .. E15_3 *),
E16,
E17,
E18,
E19,
NIL (* E20 .. E20_4 *),
NIL (* E21 .. E21_1 *),
E22,
NIL (* E23 .. E23_2 *),
NIL (* E24 .. E24_0 *),
NIL (* E25 .. E25_5 *),
NIL (* E26 .. E26_0 *),
NIL (* E27 .. E27_3 *),
E28,
E29,
E30,
NIL (* E31 .. E31_7 *),
E32,
NIL (* E33 .. E33_3 *),
E34,
NIL (* E35 .. E35_2 *),
E36,
E37,
NIL (* E38 .. E38_2 *),
E39,
NIL (* E40 .. E40_1 *),
E41,
NIL (* E42 .. E42_0 *),
E43,
NIL (* E44 .. E44_1 *),
NIL (* E45 .. E45_2 *),
NIL (* E46 .. E46_3 *),
E47,
NIL (* E48 .. E48_0 *),
NIL (* E49 .. E49_3 *),
NIL (* E50 .. E50_6 *),
E51,
E52,
E53,
E54,
E55,
E56,
E57,
E58,
E59,
E60,
E61,
E62,
E63,
E64,
E65,
NIL (* E66 .. E66_7 *),
E67,
NIL (* E68 .. E68_6 *),
E69,
E70,
NIL (* E71 .. E71_6 *),
E72,
E73,
NIL (* E74 .. E74_7 *),
NIL (* E75 .. E75_3 *),
E76,
E77,
E78,
E79,
NIL (* E80 .. E80_0 *),
E81,
NIL (* E82 .. E82_5 *),
E83,
NIL (* E84 .. E84_2 *),
E85,
NIL (* E86 .. E86_2 *),
E87,
NIL (* E88 .. E88_7 *),
E89,
E90,
E91,
E92,
E93,
E94,
E95,
E96,
E97,
NIL (* E98 .. E98_1 *),
NIL (* E99 .. E99_5 *),
E100,
NIL (* E101 .. E101_2 *),
E102,
NIL (* E103 .. E103_3 *),
E104,
NIL (* E105 .. E105_1 *),
NIL (* E106 .. E106_2 *),
NIL (* E107 .. E107_4 *),
NIL (* E108 .. E108_2 *),
E109,
E110,
E111,
E112,
NIL (* E113 .. E113_6 *),
NIL (* E114 .. E114_0 *),
E115,
NIL (* E116 .. E116_5 *),
E117,
E118,
NIL (* E119 .. E119_2 *),
E120,
E121,
NIL (* E122 .. E122_2 *),
E123,
NIL (* E124 .. E124_3 *),
E125,
NIL
};
PROCEDURE GetElt (n: INTEGER): TEXT =
<*FATAL Thread.Alerted, Wr.Failure *>
VAR wr := TextWr.New ();
BEGIN
CASE n OF
| 8 =>
Wr.PutText (wr, E8);
Wr.PutText (wr, E8_0);
| 9 =>
Wr.PutText (wr, E9);
Wr.PutText (wr, E9_0);
| 10 =>
Wr.PutText (wr, E10);
Wr.PutText (wr, E10_0);
Wr.PutText (wr, E10_1);
Wr.PutText (wr, E10_2);
Wr.PutText (wr, E10_3);
| 12 =>
Wr.PutText (wr, E12);
Wr.PutText (wr, E12_0);
Wr.PutText (wr, E12_1);
Wr.PutText (wr, E12_2);
Wr.PutText (wr, E12_3);
| 14 =>
Wr.PutText (wr, E14);
Wr.PutText (wr, E14_0);
Wr.PutText (wr, E14_1);
Wr.PutText (wr, E14_2);
Wr.PutText (wr, E14_3);
Wr.PutText (wr, E14_4);
Wr.PutText (wr, E14_5);
| 15 =>
Wr.PutText (wr, E15);
Wr.PutText (wr, E15_0);
Wr.PutText (wr, E15_1);
Wr.PutText (wr, E15_2);
Wr.PutText (wr, E15_3);
| 20 =>
Wr.PutText (wr, E20);
Wr.PutText (wr, E20_0);
Wr.PutText (wr, E20_1);
Wr.PutText (wr, E20_2);
Wr.PutText (wr, E20_3);
Wr.PutText (wr, E20_4);
| 21 =>
Wr.PutText (wr, E21);
Wr.PutText (wr, E21_0);
Wr.PutText (wr, E21_1);
| 23 =>
Wr.PutText (wr, E23);
Wr.PutText (wr, E23_0);
Wr.PutText (wr, E23_1);
Wr.PutText (wr, E23_2);
| 24 =>
Wr.PutText (wr, E24);
Wr.PutText (wr, E24_0);
| 25 =>
Wr.PutText (wr, E25);
Wr.PutText (wr, E25_0);
Wr.PutText (wr, E25_1);
Wr.PutText (wr, E25_2);
Wr.PutText (wr, E25_3);
Wr.PutText (wr, E25_4);
Wr.PutText (wr, E25_5);
| 26 =>
Wr.PutText (wr, E26);
Wr.PutText (wr, E26_0);
| 27 =>
Wr.PutText (wr, E27);
Wr.PutText (wr, E27_0);
Wr.PutText (wr, E27_1);
Wr.PutText (wr, E27_2);
Wr.PutText (wr, E27_3);
| 31 =>
Wr.PutText (wr, E31);
Wr.PutText (wr, E31_0);
Wr.PutText (wr, E31_1);
Wr.PutText (wr, E31_2);
Wr.PutText (wr, E31_3);
Wr.PutText (wr, E31_4);
Wr.PutText (wr, E31_5);
Wr.PutText (wr, E31_6);
Wr.PutText (wr, E31_7);
| 33 =>
Wr.PutText (wr, E33);
Wr.PutText (wr, E33_0);
Wr.PutText (wr, E33_1);
Wr.PutText (wr, E33_2);
Wr.PutText (wr, E33_3);
| 35 =>
Wr.PutText (wr, E35);
Wr.PutText (wr, E35_0);
Wr.PutText (wr, E35_1);
Wr.PutText (wr, E35_2);
| 38 =>
Wr.PutText (wr, E38);
Wr.PutText (wr, E38_0);
Wr.PutText (wr, E38_1);
Wr.PutText (wr, E38_2);
| 40 =>
Wr.PutText (wr, E40);
Wr.PutText (wr, E40_0);
Wr.PutText (wr, E40_1);
| 42 =>
Wr.PutText (wr, E42);
Wr.PutText (wr, E42_0);
| 44 =>
Wr.PutText (wr, E44);
Wr.PutText (wr, E44_0);
Wr.PutText (wr, E44_1);
| 45 =>
Wr.PutText (wr, E45);
Wr.PutText (wr, E45_0);
Wr.PutText (wr, E45_1);
Wr.PutText (wr, E45_2);
| 46 =>
Wr.PutText (wr, E46);
Wr.PutText (wr, E46_0);
Wr.PutText (wr, E46_1);
Wr.PutText (wr, E46_2);
Wr.PutText (wr, E46_3);
| 48 =>
Wr.PutText (wr, E48);
Wr.PutText (wr, E48_0);
| 49 =>
Wr.PutText (wr, E49);
Wr.PutText (wr, E49_0);
Wr.PutText (wr, E49_1);
Wr.PutText (wr, E49_2);
Wr.PutText (wr, E49_3);
| 50 =>
Wr.PutText (wr, E50);
Wr.PutText (wr, E50_0);
Wr.PutText (wr, E50_1);
Wr.PutText (wr, E50_2);
Wr.PutText (wr, E50_3);
Wr.PutText (wr, E50_4);
Wr.PutText (wr, E50_5);
Wr.PutText (wr, E50_6);
| 66 =>
Wr.PutText (wr, E66);
Wr.PutText (wr, E66_0);
Wr.PutText (wr, E66_1);
Wr.PutText (wr, E66_2);
Wr.PutText (wr, E66_3);
Wr.PutText (wr, E66_4);
Wr.PutText (wr, E66_5);
Wr.PutText (wr, E66_6);
Wr.PutText (wr, E66_7);
| 68 =>
Wr.PutText (wr, E68);
Wr.PutText (wr, E68_0);
Wr.PutText (wr, E68_1);
Wr.PutText (wr, E68_2);
Wr.PutText (wr, E68_3);
Wr.PutText (wr, E68_4);
Wr.PutText (wr, E68_5);
Wr.PutText (wr, E68_6);
| 71 =>
Wr.PutText (wr, E71);
Wr.PutText (wr, E71_0);
Wr.PutText (wr, E71_1);
Wr.PutText (wr, E71_2);
Wr.PutText (wr, E71_3);
Wr.PutText (wr, E71_4);
Wr.PutText (wr, E71_5);
Wr.PutText (wr, E71_6);
| 74 =>
Wr.PutText (wr, E74);
Wr.PutText (wr, E74_0);
Wr.PutText (wr, E74_1);
Wr.PutText (wr, E74_2);
Wr.PutText (wr, E74_3);
Wr.PutText (wr, E74_4);
Wr.PutText (wr, E74_5);
Wr.PutText (wr, E74_6);
Wr.PutText (wr, E74_7);
| 75 =>
Wr.PutText (wr, E75);
Wr.PutText (wr, E75_0);
Wr.PutText (wr, E75_1);
Wr.PutText (wr, E75_2);
Wr.PutText (wr, E75_3);
| 80 =>
Wr.PutText (wr, E80);
Wr.PutText (wr, E80_0);
| 82 =>
Wr.PutText (wr, E82);
Wr.PutText (wr, E82_0);
Wr.PutText (wr, E82_1);
Wr.PutText (wr, E82_2);
Wr.PutText (wr, E82_3);
Wr.PutText (wr, E82_4);
Wr.PutText (wr, E82_5);
| 84 =>
Wr.PutText (wr, E84);
Wr.PutText (wr, E84_0);
Wr.PutText (wr, E84_1);
Wr.PutText (wr, E84_2);
| 86 =>
Wr.PutText (wr, E86);
Wr.PutText (wr, E86_0);
Wr.PutText (wr, E86_1);
Wr.PutText (wr, E86_2);
| 88 =>
Wr.PutText (wr, E88);
Wr.PutText (wr, E88_0);
Wr.PutText (wr, E88_1);
Wr.PutText (wr, E88_2);
Wr.PutText (wr, E88_3);
Wr.PutText (wr, E88_4);
Wr.PutText (wr, E88_5);
Wr.PutText (wr, E88_6);
Wr.PutText (wr, E88_7);
| 98 =>
Wr.PutText (wr, E98);
Wr.PutText (wr, E98_0);
Wr.PutText (wr, E98_1);
| 99 =>
Wr.PutText (wr, E99);
Wr.PutText (wr, E99_0);
Wr.PutText (wr, E99_1);
Wr.PutText (wr, E99_2);
Wr.PutText (wr, E99_3);
Wr.PutText (wr, E99_4);
Wr.PutText (wr, E99_5);
| 101 =>
Wr.PutText (wr, E101);
Wr.PutText (wr, E101_0);
Wr.PutText (wr, E101_1);
Wr.PutText (wr, E101_2);
| 103 =>
Wr.PutText (wr, E103);
Wr.PutText (wr, E103_0);
Wr.PutText (wr, E103_1);
Wr.PutText (wr, E103_2);
Wr.PutText (wr, E103_3);
| 105 =>
Wr.PutText (wr, E105);
Wr.PutText (wr, E105_0);
Wr.PutText (wr, E105_1);
| 106 =>
Wr.PutText (wr, E106);
Wr.PutText (wr, E106_0);
Wr.PutText (wr, E106_1);
Wr.PutText (wr, E106_2);
| 107 =>
Wr.PutText (wr, E107);
Wr.PutText (wr, E107_0);
Wr.PutText (wr, E107_1);
Wr.PutText (wr, E107_2);
Wr.PutText (wr, E107_3);
Wr.PutText (wr, E107_4);
| 108 =>
Wr.PutText (wr, E108);
Wr.PutText (wr, E108_0);
Wr.PutText (wr, E108_1);
Wr.PutText (wr, E108_2);
| 113 =>
Wr.PutText (wr, E113);
Wr.PutText (wr, E113_0);
Wr.PutText (wr, E113_1);
Wr.PutText (wr, E113_2);
Wr.PutText (wr, E113_3);
Wr.PutText (wr, E113_4);
Wr.PutText (wr, E113_5);
Wr.PutText (wr, E113_6);
| 114 =>
Wr.PutText (wr, E114);
Wr.PutText (wr, E114_0);
| 116 =>
Wr.PutText (wr, E116);
Wr.PutText (wr, E116_0);
Wr.PutText (wr, E116_1);
Wr.PutText (wr, E116_2);
Wr.PutText (wr, E116_3);
Wr.PutText (wr, E116_4);
Wr.PutText (wr, E116_5);
| 119 =>
Wr.PutText (wr, E119);
Wr.PutText (wr, E119_0);
Wr.PutText (wr, E119_1);
Wr.PutText (wr, E119_2);
| 122 =>
Wr.PutText (wr, E122);
Wr.PutText (wr, E122_0);
Wr.PutText (wr, E122_1);
Wr.PutText (wr, E122_2);
| 124 =>
Wr.PutText (wr, E124);
Wr.PutText (wr, E124_0);
Wr.PutText (wr, E124_1);
Wr.PutText (wr, E124_2);
Wr.PutText (wr, E124_3);
ELSE (*skip*)
END;
RETURN TextWr.ToText (wr);
END GetElt;
CONST E0 =
"; Copyright (C) 1994, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Filter\n (M"
& "acro Label BOA (text) `(Shape (Width 120) (Text RightAlign ,text)))\n "
& "(Macro Line BOA (label expr) `(HBox (Label ,label) ,expr Fill))\n (TSp"
& "lit\n =0\n %opts\n (Text %ch0 \n (BgColor \"VeryLightGree"
& "n\") \"Press GO or STEP to start algorithm...\")\n (Filter\n %c"
& "h1\n (BgColor \"VeryLightBlue\")\n (HBox\n (Button %go"
& "tMaxes \" OK \")\n (VBox\n (Line \"Number of bins: \""
& " (Numeric (Min 1) (Max 1000) %B =26))\n (Glue 10)\n ("
& "Line \"Number of weights: \" (Numeric (Min 1) (Max 1000) %N =10)))))\n "
& " (Filter\n %ch2\n (BgColor \"VeryLightRed\")\n (VBox\n"
& " Fill\n (VBox\n (Text LeftAlign \"New weight [0."
& "0 .. 1.0]:\")\n (Frame Lowered (TypeIn %new)))\n Fill))"
& "))\n";
CONST E1 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Shor"
& "testPath.evt.\n;*******************************************************"
& "*************\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Gl"
& "ue 4) (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n "
& " (Glue 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"A"
& "lgorithm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Ze"
& "us events\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display a"
& "rgs to events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (H"
& "eight 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E2 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file DGra"
& "ph.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) "
& "(Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue"
& " 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorit"
& "hm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus eve"
& "nts\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to"
& " events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height "
& "200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E3 =
"\n@Parse\nPROCEDURE Parse ()@\n @1 token := Scan ()@\n @2 Program ("
& ")@\n\nPROCEDURE Match (s)\n IF (token # s) THEN ERROR END\n token :"
& "= Scan ()\n@Parse\n\n@Program\nPROCEDURE Program ()@\n LOOP\n @1 "
& "Stmt ()@\n @2 IF (token # \';\') THEN EXIT END@\n @3 Match (\';"
& "\')@\n END\n @4 Match (<EOF>)@\n@Program\n\n@Stmt\nPROCEDURE Stmt ("
& ")@\n @1 Match (<ID>)@\n @2 Match (\'=\')@\n @3 Expr ()@\n@Stmt\n\n"
& "@Expr\nPROCEDURE Expr ()@\n @1 Term ()@\n @2 WHILE (token = \'+\') "
& "DO@\n @3 Match (\'+\')@\n @4 Term ()@\n END\n@Expr\n\n@Term\n"
& "PROCEDURE Term ()@\n @1 Factor ()@\n @2 WHILE (token = \'*\') DO@\n"
& " @3 Match (\'*\')@\n @4 Factor ()@\n END\n@Term\n\n@Factor\nP"
& "ROCEDURE Factor ()@\n @1 IF (token = <ID>) THEN@\n @2 Match (<ID"
& ">)@\n @3 ELSE@\n @4 Match (\'(\')@\n @5 Expr ()@\n @6 "
& "Match (\')\')@\n END\n@Factor\n\n\n";
CONST E4 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file ZPap"
& "er.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) "
& "(Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue"
& " 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorit"
& "hm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus eve"
& "nts\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to"
& " events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height "
& "200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E5 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Eucl"
& "id.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) "
& "(Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue"
& " 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorit"
& "hm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus eve"
& "nts\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to"
& " events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height "
& "200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E6 =
"(\n (A B C D E F G H I J K L M)\n ((0.1 0.1)\n (0.2 0.5)\n (0.35 0.5)"
& "\n (0.2 0.6)\n (0.35 0.6)\n (0.1 0.9)\n (0.5 0.5)\n (0.7 0.3)\n ("
& "0.9 0.3)\n (0.7 0.6)\n (0.9 0.6)\n (0.7 0.8)\n (0.9 0.8))\n ((A B) "
& "(A F) (A G)\n (C A)\n (D F)\n (E D)\n (F E) \n (G C) (G E) (G J)\n (H I"
& ") (H G)\n (I H)\n (J K) (J L) (J M)\n (L M) (L G)\n (M L)))\n";
CONST E7 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n\n(Border (Sh"
& "ape (Width 750 - 600 + INF) (Height 500 - 400 + INF)\n (BgColor \"Whit"
& "e\")\n (Macro B () \n `(Bar 1))\n (Macro G (name)\n `(Rim (Pen "
& "3) (Shape (Width 0 + INF) (Height 0 + INF) (Generic %,name))))\n (VBox"
& "\n (Shape (Height 0) (Width 0 + INF) (Numeric %cells =6))\n (HBox"
& " (G (name v1)) (B) (G (name v2)) (B) (G (name v3)))\n (B)\n (HBox"
& " (G (name v4)) (B) (G (name v5)) (B) (G (name v6))))))\n";
CONST E8 =
" @Proposition Proposition 47\n@\n In right-angled trian"
& "gles the square \n on the side subtending the right\n angle is equa"
& "l to the squares on the \n sides containing the right angle.\n @Pro"
& "position\n \n @Figure @\n Let @1 ABC@ be a right-angled triangle@"
& " \n having the angle BAC right;\n \n I say that \n @2 the squ"
& "are on BC@\n is equal to \n @3 the squares on BA, AC@.\n @Fig"
& "ure\n \n @Squares @\n For let there be described on BC the\n @1"
& "1 square BDEC@, and on BA, AC the\n @12 squares BAGF, ACKH@;\n @Squ"
& "ares\n \n @LineAL @\n Through A let @21 AL@ be drawn \n paralle"
& "l to either @22 BD or CE@.\n @LineAL\n \n @Shear1 @\n Now the @"
& "31 triangle ABF@ is equal \n to the @32 triangle CBF@, for they\n h"
& "ave the same @33 base BF@, and are \n in the same @34 parallels BF, G"
& "C@.\n @Shear1\n \n @Angles @\n And, since the @51 angle DBC@ is"
& " equal\n to the @52 angle FBA@: for each is right:\n \n Let the @"
& "53 angle ABC@ be added to each;\n \n Therefore the whole @54 angle "
& "FBC@ is\n equal to the whole @55 angle ABD@.\n @Angles\n \n @Si"
& "des @\n Now the @41 side BF@ is equal to the\n @42 side BA@; and th"
& "e @43 side BC@ is equal\n to the @44 side BD@;\n @Sides\n \n @R"
& "otate @\n Therefore @61 triangle FBC@ is equal\n to @62 triangle AB"
& "D@.\n @Rotate\n \n @Shear2 @\n And again the @71 triangle ABD@ "
& "is \n equal to the @72 triangle BDL@, for they\n have the same @73 "
& "base BD@, and are \n in the same @74 parallels BD, AL@.\n @Shear2\n"
& " \n @End1 @\n Thus we have shown that @81 triangle ABF@\n is eq"
& "ual to the @82 triangle BDL@. And\n therefore, the @83 square GB@ is"
& " equal\n to the @84 rectangle BL@.\n @End1\n \n @Symmetry @\n "
& " And by the same argument, the \n @91 triangle CAK@ is equal to the\n"
& " @92 triangle CEL@.\n \n And the @93 square HC@ is equal to the\n"
& " @94 rectangle CL@.\n @Symmetry\n \n @Rehash @\n@100 And ther"
& "efore the square \n on the side subtending the right\n angle is equ"
& "al to the squares on the";
CONST E8_0 =
" \n sides containing the right angle. "
& " @\n \n@101 Which is what was to be proved. "
& " @\n @Rehash\n";
CONST E9 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Matc"
& "h.evt.\n;**************************************************************"
& "******\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 +"
& " Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Init: Stop? \") \n (Boolean %stopAtInit =TRUE \""
& "\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtInit =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heigh"
& "t 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"SetState: Stop? \") \n "
& " (Boolean %stopAtSetState =TRUE \"\")\n (Glue 1"
& "0)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtSetState =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n )\n (Glue 4)\n (VBox\n "
& " ";
CONST E9_0 =
" (Glue 5)\n (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n "
& " (Button %eventCounts\n (VBox\n ("
& "Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) "
& "\n (Text %ctOfInit \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height "
& "16 + 0) \n (Text %ctOfSetState \"0\"))"
& ")\n (Glue 3))))\n Fill\n (Glue 4 + Inf"
& ")\n )\n )\n )\n )\n)\n";
CONST E10 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n\n\nlet RingSize = [0.15, 0.10, 0.05];\nl"
& "et RingColor = [color_named(\"darkred\"), color_named(\"darkgreen\"),\n"
& " color_named(\"darkblue\")];\nlet GraphEdgeColor = colo"
& "r_named(\"gray\");\nlet FlickerColor = color_named(\"verylightgray\");\n"
& "let HighColor = color_named(\"black\");\nlet HighBorder = 0.01;\n\nlet "
& "PathColor = color_named(\"red\");\nlet PromoteColor = RingColor;\nlet C"
& "andidateColor = [GraphEdgeColor, color_named(\"lightred\"),\n "
& " color_named(\"lightgreen\"), color_named(\"lightblue\")];\n"
& "let BackgroundColor = color_named(\"darkslategray\");\nlet EdgeWidth = "
& "[0.00575, 0.00375, 0.00375, 0.00375];\nlet SourceColor = RingColor[0];\n"
& "let DestColor = RingColor[2];\n \nlet Graphic = {\n go => ok, ("
& "* the graphical object *)\n up => ok, (* the predecessor Graphic"
& " *)\n bottom => ok, (* the lowest element *)\n\n newAbove"
& " => meth(self, obj)\n var res = clone(self);\n res.go"
& " := obj;\n self.up := res;\n var lift = res;\n "
& " loop\n if lift is ok then exit end;\n graph_se"
& "tObjectLayer(lift.go, 0);\n lift := lift.up\n end;\n"
& " res\n end,\n \n down => meth(self)\n "
& " var p = self.bottom;\n loop\n if p is ok th"
& "en exit end;\n if p.up is self then exit end;\n p"
& " := p.up\n end;\n p\n end,\n\n newBelow"
& " => meth(self, obj)\n self.down.newAbove(obj)\n end,\n\n"
& " remove => meth(self)\n var p = self.down;\n i"
& "f not (p is ok) then p.up := self.up end;\n self.go\n e"
& "nd\n};\n\nlet Edge = {\n t => ok,\n sourceV => ok,\n sourceN => -1,\n"
& " destV => ok,\n destN => -1,\n gr => ok,\n ctls => ok,\n sex => ok"
& ",\n\n create => meth(self, t";
CONST E10_0 =
", fromV, fromN, toV, toN, sex)\n let invisible = proc(pt)\n let"
& " res = graph_newVertex(t.g);\n graph_setVertexSize(res, 0.0, 0.0);"
& "\n graph_moveVertex(res, pt[0], pt[1], false);\n res\n end"
& ";\n let +++ = proc(p, q)\n [ p[0] + q[0], p[1] + q[1] ]\n en"
& "d;\n let --- = proc(p, q)\n [ p[0] - q[0], p[1] - q[1] ]\n e"
& "nd;\n let *** = proc(p, q)\n [ (p[0] * q[0]) - (p[1] * q[1]),\n"
& " (p[0] * q[1]) + (p[1] * q[0]) ]\n end;\n let rel = proc(z"
& ", w) \n w[0] +++ (z *** (w[1] --- w[0]))\n end;\n self.gr :="
& " [ok, ok];\n self.t := t;\n self.sex := sex;\n self.sourceV :="
& " fromV;\n self.sourceN := fromN;\n self.destV := toV;\n self.d"
& "estN := toN;\n let spos = fromV.pos;\n let dpos = toV.pos;\n v"
& "ar skew = float(fromN + 1) / (0.0 - 10.0);\n if sex is \"L\" then sk"
& "ew := 0.0 - skew end;\n var mid = [0.5, skew] rel [spos, dpos];\n "
& " var s2 = [0.33, skew] rel [spos, dpos];\n var s1 = [0.5, skew / 4.0"
& "] rel [spos, s2];\n var d2 = [0.67, skew] rel [spos, dpos];\n var"
& " d1 = [0.5, skew / 4.0] rel [d2, dpos];\n var midpt = invisible(mid)"
& ";\n var s1pt = invisible(s1);\n var s2pt = invisible(s2);\n va"
& "r d1pt = invisible(d1);\n var d2pt = invisible(d2);\n self.ctls :"
& "= [midpt, s1pt, s2pt, d1pt, d2pt];\n var sedge = graph_newEdge(fromV"
& ".graphic(fromN).go, midpt);\n graph_moveEdgeBezier(sedge, fromV.grap"
& "hic(fromN).go, midpt,\n s1pt, s2pt, false);\n "
& " self.gr[0] := fromV.graphic(fromN).newBelow(sedge);\n var dedge = "
& "graph_newEdge(midpt, toV.graphic(toN).go);\n graph_moveEdgeBezier(de"
& "dge, midpt, toV.graphic(toN).go,\n d2pt, d1pt, "
& "false);\n self.gr[1] := toV.graphic(toN).newBelow(dedge);\n graph"
& "_setEdgeColor(sedge, CandidateColor[fromN+1]);\n graph_setEdgeColor("
& "dedge, CandidateColor[fromN+1]);\n graph_setEdgeWidth(sedge, EdgeWid"
& "th[fromN+1]);\n graph_setEdgeWidth(dedge, EdgeWidth[fromN+1]);\n "
& "graph_setEdgeArrows(dedge, false, true);\n if toN >= 0 then toV.se";
CONST E10_1 =
"tInEdge(toN, self) end;\n self\n end,\n\n midpt => meth(self) self"
& ".ctls[0] end,\n\n demote => meth(self)\n foreach g in self.gr do\n "
& " if not (g is ok) then\n graph_removeEdge(g.remove)\n e"
& "nd\n end;\n foreach g in self.ctls do\n if not (g is ok) the"
& "n graph_removeVertex(g) end\n end;\n if (self.destN + 1) < #(Ring"
& "Color) then\n self.create(self.t, self.sourceV, self.sourceN, self"
& ".destV, \n self.destN + 1)\n end\n end,\n\n highl"
& "ight => meth(self, clr)\n foreach g in self.gr do\n graph_setEd"
& "geColor(g.go, clr);\n end\n end,\n};\n \nlet Vertex = {\n positio"
& "n => ok,\n t => ok,\n gr => ok,\n incEdge => ok,\n\n pos => meth(se"
& "lf) self.position end,\n\n graphic => meth(self, i)\n if (i+1) < #("
& "self.gr) then self.gr[i+1] else self.t.bottom end end,\n\n inEdge => m"
& "eth(self, i) self.incEdge[i] end,\n\n setInEdge => meth(self, i, e) se"
& "lf.incEdge[i] := e end,\n\n highlight => meth(self, i, clr)\n graph"
& "_setVertexColor(self.graphic(i).go, clr)\n end,\n\n create => meth(sel"
& "f, t, x, y, name)\n self.gr := [ok, ok, ok, ok];\n self.incEdge :"
& "= [ok, ok, ok];\n var stack = t.bottom;\n self.position := [x, y]"
& ";\n self.t := t;\n for i = 0 to 2 do\n var v = graph_newVert"
& "ex(t.g);\n graph_moveVertex(v, x, y, false);\n graph_setVerte"
& "xShape(v, \"ellipse\");\n graph_setVertexSize(v, RingSize[i], Ring"
& "Size[i]);\n graph_setVertexLabel(v, name);\n graph_setVertexC"
& "olor(v, CandidateColor[3-i]);\n stack := stack.newAbove(v);\n "
& " self.gr[3-i] := stack\n end;\n self.gr[0] := self.gr[3];\n se"
& "lf\n end,\n};\n\nlet view = {\n graphvbt => graph_new(),\n g => meth ("
& "self) self.graphvbt end,\n\n bottom => clone(Graphic),\n spotlight => {"
& "current => ok, curIndex => 0, spot =>ok},\n \n vtable => ok,\n etable ="
& "> [ ],\n\n vertex => meth(self, name)\n var res = ok;\n for i = 0 t"
& "o #(self.vtable)-1 do\n if self.vtable[i].name is name then\n "
& " res := self.vtable[i].vertex;\n exit\n end\n end;\n res\n"
& " end,\n \n edge => meth(self, n";
CONST E10_2 =
"ame)\n var res = ok;\n for i = 0 to #(self.etable)-1 do\n if se"
& "lf.etable[i].name is name then\n res := self.etable[i].edge;\n "
& " exit\n end\n end;\n res\n end,\n \n NewVertex => meth (self"
& ", name, x, y)\n if self.vtable is ok then\n self.bottom.bottom :="
& " self.bottom;\n self.vtable := [ ];\n graph_setAspect(self.g, 1"
& ".0);\n graph_setWorld(self.g, 0.0, 1.0, 1.0, 0.0);\n let bg = g"
& "raph_newVertex(self.g);\n graph_moveVertex(bg, 0.5, 0.5, false);\n "
& " graph_setVertexColor(bg, BackgroundColor);\n graph_setVertexSiz"
& "e(bg, 1.0, 1.0);\n end;\n self.vtable :=\n self.vtable @\n "
& " [{name => name,\n vertex => clone(Vertex).create(self, x, y, "
& "name)}];\n graph_redisplay(self.g)\n end,\n\n NewEdge => meth (self, "
& "name, frompt, topt, orientation)\n self.etable :=\n self.etable @"
& "\n [{name => name,\n edge => clone(Edge).create(self, sel"
& "f.vertex(frompt),\n -1, self.vertex("
& "topt), -1, orientation)}];\n graph_redisplay(self.g)\n end,\n\n Start"
& "Find => meth (self, frompt, topt)\n self.vertex(frompt).highlight(0, "
& "SourceColor);\n self.spotlight.current := self.vertex(frompt);\n se"
& "lf.spotlight.curIndex := 0;\n self.spotlight.spot :=\n self.spotl"
& "ight.current.graphic(1).newAbove(\n graph_newVertexHiLi(self.spot"
& "light.current.graphic(0).go));\n graph_setVertexHiLiBorder(self.spotl"
& "ight.spot.go, HighBorder, HighBorder);\n graph_setVertexHiLiColor(sel"
& "f.spotlight.spot.go, HighColor);\n(* self.vertex(topt).highlight(2, Des"
& "tColor); *)\n graph_redisplay(self.g)\n end,\n\n Promote => meth (sel"
& "f, edge, sIndex, dIndex)\n let dest = self.edge(edge).destV;\n let "
& "mid = graph_newVertex(self.g);\n let spot = self.spotlight.spot.go;\n"
& " let size = (* (RingSize[2-dIndex] + RingSize[2-self.spotlight.curInd"
& "ex])/2.0; *) 0.0;\n graph_setVertexSize(mid, size, size);\n graph_s"
& "etVertexColor(mid, BackgroundColor);\n graph_setVertexShape(mid, \"el"
& "lipse\");\n graph_moveVertex(mid,\n (self.spotlight.current.pos[0"
& "] +";
CONST E10_3 =
" dest.pos[0]) / 2.0,\n (self.spotlight.current.pos[1] + dest.pos[1]"
& ") / 2.0, false);\n graph_moveVertexHiLi(spot, mid, true);\n zeus_an"
& "imate(self.g, 0.0, 0.5);\n self.spotlight.spot.remove;\n self.spotl"
& "ight.spot := dest.graphic(dIndex+1).newAbove(spot);\n self.spotlight."
& "curIndex := dIndex;\n graph_moveVertexHiLi(spot, dest.graphic(dIndex)"
& ".go, true);\n zeus_animate(self.g, 0.5, 1.0);\n graph_removeVertex("
& "mid);\n self.spotlight.current := dest;\n dest.inEdge(dIndex).highl"
& "ight(CandidateColor[sIndex+1]);\n graph_redisplay(self.g);\n dest.i"
& "nEdge(dIndex).highlight(PromoteColor[sIndex]);\n graph_redisplay(self"
& ".g);\n dest.inEdge(dIndex).highlight(CandidateColor[sIndex+1]);\n g"
& "raph_redisplay(self.g);\n dest.inEdge(dIndex).highlight(PromoteColor["
& "sIndex]);\n graph_redisplay(self.g);\n self.edge(edge).destV.highli"
& "ght(dIndex, RingColor[dIndex]);\n graph_redisplay(self.g)\n end,\n\n "
& "Consider => meth (self, edge, sIndex, dIndex)\n let e = self.edge(edg"
& "e);\n let s = e.sourceV;\n let d = e.destV;\n for t = 1 to 4 do\n"
& " e.highlight(CandidateColor[sIndex+1]);\n graph_redisplay(self."
& "g);\n e.highlight(GraphEdgeColor);\n graph_redisplay(self.g);\n"
& " end;\n if dIndex >= 0 then\n var i = #(d.incEdge)-1;\n loo"
& "p\n let inP = d.inEdge(i);\n if not (inP is ok) then inP.de"
& "mote() end;\n if i is dIndex then exit end;\n i := i - 1\n "
& " end;\n clone(Edge).create(self, s, sIndex, d, dIndex, e.sex)\n "
& " end;\n graph_redisplay(self.g)\n end,\n\n Traceback => meth (self, "
& "edge, sIndex, dIndex)\n(* self.edge(edge).destV.inEdge(dIndex).highli"
& "ght(PathColor);\n graph_redisplay(self.g) *)\n ok\n end,\n};\n\n";
CONST E11 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* All"
& " rights reserved. *)\n(* See the f"
& "ile COPYRIGHT for a full description. *)\n\n@Insertion\nPROC"
& "EDURE InsertionSort (a: ARRAY OF INTEGER) @=\n VAR j: CARDINAL; v: INT"
& "EGER;\n BEGIN\n @1 FOR i := 2 TO LAST(a) DO@\n @2 v := a[i];@\n"
& " @3 j := i;@\n @4 WHILE a[j - 1] > v DO@ \n @5 a[j] :="
& " a[j - 1];@\n @6 DEC (j);@\n END;\n @7 a[j] := v;@\n "
& " END\n END InsertionRun;\n@Insertion\n";
CONST E12 =
"(* Copyright (C) 1994, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* AverageDepth.obl - view of a"
& "verage node depths. *)\n(* Last modified on M"
& "on Jan 9 12:04:03 PST 1995 by najork *)\n(* mod"
& "ified on Wed Jul 27 11:24:28 PDT 1994 by shillner *)\n\n"
& "(* Screen dimensions. *)\nlet North: Real = 1.0;\nlet South: Real = 0.0"
& ";\nlet West: Real = 0.0;\nlet East: Real = 1.0;\nlet Margin: Real = 5.0"
& ";\n\n(* Caption stuff. *)\nlet CaptionHeight = 0.1;\nlet BackgroundCo"
& "lor = color_named(\"white\");\nlet FontSz = 0.07;\n\n(* Bar se"
& "ttings. *)\nlet BarColor = color_named(\"magenta\");\nlet BorderColo"
& "r = color_named(\"black\");\nlet BorderWidth = 0.005;\nlet TextColor "
& "= color_named(\"black\");\nlet BarGap = 0.1; (* Fraction of bar w"
& "idth. *)\nvar g = ok;\nvar labelFont = ok;\n\n(* Node Object =========="
& "=================================================== *)\n\nlet Node = {\n"
& " parent: Node => ok,\n children: Node => ok,\n next: Node => ok, "
& " (* Siblings. *)\n prev: Node => ok,\n\n (* Adds child as a child of"
& " parent, inserted to the right of \n the child \"rightOf\", which m"
& "ust be a child of parent, or as\n the leftmost child if rightOf is "
& "ok *)\n addChild => meth(parent, rightOf, child: Node)\n if rightOf"
& " is ok then\n child.next := parent.children;\n child.prev := "
& "ok;\n if child.next isnot ok then child.next.prev := child; end;\n"
& " parent.children := child;\n else\n child.prev := rightOf;"
& "\n child.next := rightOf.next;\n if child.next isnot ok then "
& "child.next.prev := child; end;\n rightOf.next := child;\n end;\n"
& " end,\n\n (* removes child from parent, which must be its parent *)\n"
& " removeChild => meth(parent, child: Node)\n if child.prev isnot ok\n"
& " ";
CONST E12_0 =
" then child.prev.next := child.next;\n else parent.children := ch"
& "ild.next;\n end;\n if child.next isnot ok then child.next.prev :="
& " child.prev; end;\n child.prev := ok;\n child.next := ok;\n end,"
& "\n\n walk => meth(node: Node, level: Int)\n var ch = node.children;"
& "\n var acc = 0;\n var count = 0;\n loop\n if ch is ok the"
& "n exit end;\n let res = ch.walk(level + 1);\n acc := acc + re"
& "s.acc;\n count := count + res.count;\n ch := ch.next;\n en"
& "d;\n {acc => acc + level, count => count + 1};\n end,\n\n};\n\n\n(*"
& " Bar Object ==========================================================="
& "=== *)\n\nlet Bar = {\n size: Float => ok,\n next: Bar => ok,\n col:"
& " Int => ok,\n v: Vertex => ok,\n\n init => meth(self: Bar, col: Int, "
& "size: Float): Bar,\n self.size := size;\n self.col := col;\n s"
& "elf.next := ok;\n if self.col >= 0 then\n self.v := graph_newVe"
& "rtex(g);\n graph_setVertexColor(self.v, BarColor);\n graph_se"
& "tVertexBorderColor(self.v, BorderColor);\n(* graph_setVertexBorder"
& "(self.v, BorderWidth);*)\n graph_setVertexSize(self.v, 1.0, 0.0);\n"
& "(* graph_setVertexLabelColor(self.v, TextColor);\n graph_setV"
& "ertexFont(self.v, labelFont);*)\n graph_moveVertex(self.v, float(s"
& "elf.col), 0.0, true);\n end;\n self;\n end,\n\n clear => meth(s"
& "elf: Bar)\n self.size := 0.0;\n if self.next isnot ok then self.n"
& "ext.clear() end;\n end,\n\n update => meth(self: Bar, maxHeight: Floa"
& "t, maxCols: Int,\n barGraph: BarGraph): ok,\n let he"
& "ight = if self.size > maxHeight then self.size else maxHeight end;\n "
& " let cols = if self.size isnot 0.0 then self.col else maxCols end;\n\n "
& " if self.next isnot ok then self.next.update(height, cols, barGraph)\n"
& " else barGraph.barCounts(height, cols + 1) end;\n\n let shape = b"
& "arGraph.barShape(self.size, self.col);\n graph_setVertexSize(self.v,"
& " shape.w, shape.h);\n graph_moveVertex(self.v, shape.x, shape.y, fal"
& "se);\n(* graph_setVertexLabel(self.v, fmt_real(self.size));*)\n end"
& ",\n};\n\n";
CONST E12_1 =
"(* BarGraph Object ===================================================="
& "===== *)\n\nlet BarGraph = {\n west: Float => ok,\n east: Float => ok"
& ",\n north: Float => ok,\n south: Float => ok,\n height: Float => ok,"
& "\n width: Float => ok,\n bar: Bar => ok,\n lastBar: Bar => ok,\n co"
& "lWidth: Float => ok,\n unitHeight: Float => ok,\n baseCol: Float => o"
& "k,\n barWidth: Float => ok,\n tallest: Float => ok,\n\n init => meth"
& "(self: BarGraph, west, east, north, south: Float,\n bar: "
& "Bar): BarGraph,\n self.west := west;\n self.east := east;\n se"
& "lf.north := north;\n self.south := south;\n self.height := north "
& "- south;\n self.width := east - west;\n self.bar := bar;\n sel"
& "f.lastBar := bar;\n self;\n end,\n\n barCounts => meth(self: BarGr"
& "aph, height: Float, cols: Int): ok,\n self.colWidth := self.width / "
& "float(cols);\n self.unitHeight := if height is 0.0 then 0.0\n "
& " else self.height / height end;\n self.baseCol := sel"
& "f.west + (0.5 * self.colWidth);\n self.barWidth := self.colWidth (*-"
& " (self.colWidth * BarGap)*);\n self.tallest := height;\n end,\n\n "
& "barShape => meth(self: BarGraph, size: Float, col: Int): Shape,\n va"
& "r shape = {w => ok, h => ok, x => ok, y => ok};\n\n shape.w := self."
& "barWidth;\n shape.h := size * self.unitHeight;\n shape.x := self."
& "baseCol + (self.colWidth * float(col));\n shape.y := self.south + (0"
& ".5 * shape.h);\n shape;\n end,\n\n update => meth(self: BarGraph, "
& "avg: Float): Float,\n self.lastBar.next := clone(Bar).init(self.last"
& "Bar.col + 1, avg);\n self.lastBar := self.lastBar.next;\n self.ba"
& "r.next.update(0.0, 0, self);\n self.tallest;\n end,\n \n};\n\n\n(*"
& " View Object =========================================================="
& "=== *)\n\nlet view = {\n\n graphvbt => graph_new(),\n counts => ok,\n"
& " numSets => 0,\n node => ok,\n root: Node => ok,\n bar: Bar => ok,\n"
& " barGraph: BarGraph => ok,\n height: Int => ok,\n width: Int => ok,\n"
& " caption: Vertex => ok,\n\n FinishedSets => meth(self: View, numSets:"
& " Int, usesRan";
CONST E12_2 =
"ks: Bool)\n g := self.graphvbt; (* Must be done before Bar.init(). "
& "*)\n self.numSets := numSets;\n self.root := clone(Node);\n se"
& "lf.bar := clone(Bar).init(-1, 0.0);\n self.barGraph := clone(BarGrap"
& "h).init(West, East, North,\n S"
& "outh + CaptionHeight, self.bar);\n self.node := array_new(numSets, o"
& "k);\n labelFont := graph_newFont(self.graphvbt, \"Helvetica\", FontS"
& "z,\n \"Roman\", \"bold\", \"*\");\n\n "
& "for i=0 to numSets-1 do\n var node = clone(Node);\n self.root"
& ".addChild(ok, node);\n self.node[i] := node;\n end;\n\n grap"
& "h_setWorld(self.graphvbt, West, East, North, South);\n graph_setMarg"
& "in(self.graphvbt, Margin);\n self.caption := graph_newVertex(self.gr"
& "aphvbt);\n graph_moveVertex(self.caption, (West + East) / 2.0,\n "
& " South + (CaptionHeight / 2.0), false);\n graph_setV"
& "ertexSize(self.caption, East - West, CaptionHeight);\n graph_setVert"
& "exColor(self.caption, BackgroundColor);\n graph_setVertexFont(self.c"
& "aption, labelFont);\n graph_setVertexLabel(self.caption, \"\");\n "
& " graph_setVertexLabelColor(self.caption, TextColor);\n(* self.update"
& "();*)\n end,\n\n update => meth(self: View): ok,\n let res = self."
& "root.walk(-1);\n let avg = float(res.acc + 1) / float(self.numSets);"
& "\n let tallest = self.barGraph.update(avg);\n graph_setVertexLabe"
& "l(self.caption,\n \"Scale: \" &\n "
& " text_replaceAll(\"d\", \"0\",\n "
& " text_sub(fmt_real(tallest), 0, 4)));\n graph_redisplay"
& "(self.graphvbt);\n(* zeus_animate(self.graphvbt, 0.0, 0.0);*)\n end"
& ",\n\n ChangeParent => meth(self: View, childId, parentId, rootId: Int)"
& "\n let parent = self.node[parentId];\n let child = self.node[chil"
& "dId];\n let root = self.node[rootId];\n \n parent.removeChild("
& "child);\n root.addChild(ok, child);\n\n self.update();\n ok;\n"
& " end,\n\n Unite => meth(self: View, childId, parentId, pRank: Int)\n "
& " let paren";
CONST E12_3 =
"t = self.node[parentId];\n let child = self.node[childId];\n\n se"
& "lf.root.removeChild(child);\n parent.addChild(ok, child);\n\n sel"
& "f.update();\n ok;\n end,\n\n};\n\n";
CONST E13 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Rim\n (Pen "
& "0)\n (HBox\n (VBox\n (Shape\n (BgColor \"White\")\n "
& " (LightShadow \"White\")\n (DarkShadow \"White\")\n (W"
& "idth 300 + inf)\n (Height 100 + inf)\n (PageButton (For p"
& "arms) (Generic %g)))\n (TSplit\n %parms\n Flex\n "
& " Circular\n (Shape (Width + Inf) (Generic))\n (Rim\n "
& " (Pen 5)\n (HBox\n (VBox\n (HBo"
& "x\n (Fill)\n (Shape (Width + 0) (Height +"
& " 0) \"Bezier parameters \")\n (Fill))\n (Gl"
& "ue 6)\n (HBox\n (VBox\n (H"
& "Box \"px\")\n (Glue 2)\n (Numeric %px"
& " =25 (Min 0) (Max 100)))\n (Glue 10)\n (V"
& "Box\n (HBox \"py\")\n (Glue 2)\n "
& " (Numeric %py =25 (Min 0) (Max 100)))\n (Glu"
& "e 10)\n (VBox\n (HBox \"Control points "
& "size\")\n (Glue 2)\n (Numeric %cpsize"
& " =0 (Min 0) (Max 10)))))\n (Fill)))))))\n";
CONST E14 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file CP.e"
& "vt.\n;*****************************************************************"
& "***\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 + In"
& "f)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n (B"
& "oolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox F"
& "ill (Shape (Width + 0) (Height + 0) \n \""
& "Setup: Stop? \") \n (Boolean %stopAtSetup =TRUE \""
& "\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heig"
& "ht 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n"
& " \"AddPoint: Stop? \") \n "
& " (Boolean %stopAtAddPoint =TRUE \"\")\n (Glue "
& "10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtAddPoint =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fi";
CONST E14_0 =
"ll (Shape (Width + 0) (Height + 0) \n \""
& "NotProcessed: Stop? \") \n (Boolean %stopAtNotProc"
& "essed =TRUE \"\")\n (Glue 10)\n ("
& "Shape (Width + 0) (Height + 0) \"Weight: \")\n (Shap"
& "e (Width 80) (Numeric %waitAtNotProcessed =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width"
& " + 0) (Height + 0) \n \"RemoveNotProcess"
& "ed: Stop? \") \n (Boolean %stopAtRemoveNotProcesse"
& "d =TRUE \"\")\n (Glue 10)\n (Shap"
& "e (Width + 0) (Height + 0) \"Weight: \")\n (Shape (W"
& "idth 80) (Numeric %waitAtRemoveNotProcessed =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Wid"
& "th + 0) (Height + 0) \n \"ActiveR: Sto"
& "p? \") \n (Boolean %stopAtActiveR =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Heigh"
& "t + 0) \"Weight: \")\n (Shape (Width 80) (Numeric %w"
& "aitAtActiveR =1 \n (Min 0"
& ") (Max 100)))))\n (Glue 6)\n (Shape (Height 16 + "
& "0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"RemoveActiveR: Stop? \") \n "
& " (Boolean %stopAtRemoveActiveR =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtRemoveActiveR "
& "=1 \n (Min 0) (Max 100)))"
& "))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"CloseR: Stop? \") \n (Boolean %stopAt"
& "Close";
CONST E14_1 =
"R =TRUE \"\")\n (Glue 10)\n (Shap"
& "e (Width + 0) (Height + 0) \"Weight: \")\n (Shape (W"
& "idth 80) (Numeric %waitAtCloseR =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n ("
& "Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Hei"
& "ght + 0) \n \"RemoveCloseR: Stop? \") "
& "\n (Boolean %stopAtRemoveCloseR =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtRemoveCloseR =1 \n (Mi"
& "n 0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16"
& " + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Split: Stop? \") \n ("
& "Boolean %stopAtSplit =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtSplit =1 \n "
& " (Min 0) (Max 100)))))\n (Glue"
& " 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Shap"
& "e (Width + 0) (Height + 0) \n \"SplitRem"
& "ove: Stop? \") \n (Boolean %stopAtSplitRemove =TRU"
& "E \"\")\n (Glue 10)\n (Shape (Wid"
& "th + 0) (Height + 0) \"Weight: \")\n (Shape (Width 8"
& "0) (Numeric %waitAtSplitRemove =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (S"
& "hape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Heig"
& "ht + 0) \n \"NewMin: Stop? \") \n "
& " (Boolean %stopAtNewMin =TRUE \"\")\n "
& "(Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight"
& ": \")\n (Shape (Width 80) (Numeric %waitAtNewMin =1 "
& "\n ";
CONST E14_2 =
" (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox F"
& "ill (Shape (Width + 0) (Height + 0) \n \""
& "NoChangeMin: Stop? \") \n (Boolean %stopAtNoChange"
& "Min =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtNoChangeMin =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + "
& "0) (Height + 0) \n \"SelectTrialPoint: "
& " Stop? \") \n (Boolean %stopAtSelectTrialPoint =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtSelectTrialPoint =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) ("
& "Height + 0) \n \"DeselectTrialPoint: S"
& "top? \") \n (Boolean %stopAtDeselectTrialPoint =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtDeselectTrialPoint =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0)"
& " (Height + 0) \n \"SelectTargetPoint: "
& "Stop? \") \n (Boolean %stopAtSelectTargetPoint =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtSelectTargetPoint =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " ";
CONST E14_3 =
" (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (H"
& "eight + 0) \n \"DeselectTargetPoint: S"
& "top? \") \n (Boolean %stopAtDeselectTargetPoint =TRU"
& "E \"\")\n (Glue 10)\n (Shape (Wid"
& "th + 0) (Height + 0) \"Weight: \")\n (Shape (Width 8"
& "0) (Numeric %waitAtDeselectTargetPoint =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + "
& "0) (Height + 0) \n \"DrawBar: Stop? \""
& ") \n (Boolean %stopAtDrawBar =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0"
& ") \"Weight: \")\n (Shape (Width 80) (Numeric %waitAt"
& "DrawBar =1 \n (Min 0) (Ma"
& "x 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"RemoveBar: Stop? \") \n (Bool"
& "ean %stopAtRemoveBar =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtRemoveBar =1 \n "
& " (Min 0) (Max 100)))))\n ("
& "Glue 6)\n )\n (Glue 4)\n (VBox\n "
& "(Glue 5)\n (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n "
& " (Button %eventCounts\n (VBox\n (Gl"
& "ue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfSetup \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 1"
& "6 + 0) \n (Text %ctOfAddPoint \"0\")))"
& "\n (Glue 6)\n (HBox Fill (Shape (Width + "
& "0) (Height 16 + 0) \n (Text %ctOfNotPr"
& "ocessed";
CONST E14_4 =
" \"0\")))\n (Glue 6)\n (HBox Fill (Shape "
& "(Width + 0) (Height 16 + 0) \n (Text %"
& "ctOfRemoveNotProcessed \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfActiveR \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfRemoveActiveR \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 1"
& "6 + 0) \n (Text %ctOfCloseR \"0\")))\n"
& " (Glue 6)\n (HBox Fill (Shape (Width + 0)"
& " (Height 16 + 0) \n (Text %ctOfRemoveC"
& "loseR \"0\")))\n (Glue 6)\n (HBox Fill (S"
& "hape (Width + 0) (Height 16 + 0) \n (T"
& "ext %ctOfSplit \"0\")))\n (Glue 6)\n (HBo"
& "x Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSplitRemove \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewMin \"0\")))\n (Glue"
& " 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNoChangeMin \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Heig"
& "ht 16 + 0) \n (Text %ctOfSelectTrialPo"
& "int \"0\")))\n (Glue 6)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height 16 + 0) \n (Tex"
& "t %ctOfDeselectTrialPoint \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSelectTargetPoint \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + "
& "0) \n (Text %ctOfDeselectTargetPoint \""
& "0\")))\n";
CONST E14_5 =
" (Glue 6)\n (HBox Fill (Shape (Width + 0)"
& " (Height 16 + 0) \n (Text %ctOfDrawBar"
& " \"0\")))\n (Glue 6)\n (HBox Fill (Shape "
& "(Width + 0) (Height 16 + 0) \n (Text %"
& "ctOfRemoveBar \"0\")))\n (Glue 3))))\n Fill\n "
& " (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E15 =
"(* Copyright 1993 Digital Equipment Corporation. "
& " *)\n(* Distributed only by permission. "
& " *)\n(* "
& " *)\n(* Last modified on Thu Oct 14 17:08:38 P"
& "DT 1993 by heydon *)\n(* modified on Thu Aug 5 "
& "09:58:52 PDT 1993 by rsanchez *)\n\n(* This view shows "
& "the total number of steps that each packet needs to\n traverse to go "
& "from its source to its destination node. *)\n\nlet moveColor = color_na"
& "med(\"Green\");\nlet blockedColor = color_named(\"Red\");\nlet nomoveCo"
& "lor = color_named(\"Yellow\");\nlet finishedColor = color_named(\"Black"
& "\");\nlet labelColor = color_named(\"Black\");\nlet backgroundColor = c"
& "olor_named(\"White\");\nlet edgeColor = color_named(\"Black\");\n\nlet "
& "view =\n {\n graphvbt => graph_new(),\n g => meth (self) self.gr"
& "aphvbt end,\n vertexFont => ok,\n pktCnt => ok,\n steps => 0,\n"
& " maxSteps => ok,\n hopsT => [],\n border => ok,\n fntVSize "
& "=> ok,\n yLab1 => ok,\n yLab2 => ok,\n east => ok,\n west ="
& "> ok,\n north => ok,\n south => ok,\n\n\n StartGraph => meth ("
& "self, nodeCnt, maxQS, bounded, xMax, yMax)\n ok;\n end,\n\n "
& "NewNode => meth (self, id, x, y)\n ok;\n end,\n\n NewStraigh"
& "tEdge => meth (self, id1, id2)\n ok;\n end,\n\n NewCurvedEdg"
& "e => meth (self, id1, id2, x1, y1, x2, y2)\n ok;\n end,\n\n "
& "NewLabel => meth (self, label, x, y)\n ok;\n end,\n\n EndGra"
& "ph => meth (self)\n ok;\n end,\n\n StartPackets => meth (sel"
& "f, pktCnt)\n self.east := ~1.0;\n self.west := float(pktCnt);"
& "\n self.north := 11.0;\n self.south := ~2.0;\n self.maxS"
& "teps := 10;\n self.border := 0.0;\n self.fntVSize := 1.0;\n "
& " self.yLab1 := ~0.5;\n self.yLab2 := ~1.5;\n\n graph_setWo"
& "rld(self.graphvbt,\n\t self.east, self.west, self.north, se"
& "lf.south);\n self.vertexFont := \n\t graph_newFont(self.graphvbt, "
& "\"Helvetica\", 0.2, \"Roman\", \"bo";
CONST E15_0 =
"ld\",\"*\");\n\n self.pktCnt := pktCnt;\n for i = 0 to pktCnt"
& "-1 do\n let vtx1 = graph_newVertex(self.graphvbt);\n let "
& "vtx2 = graph_newVertex(self.graphvbt);\n let vtx3 = graph_newVer"
& "tex(self.graphvbt);\n\tself.hopsT :=\n\t self.hopsT @\n\t\t[{minNumH"
& "ops => 0,\n\t\t congested => 0.0,\n\t\t moved => false,\n\t\t blocke"
& "d => false,\n\t\t progress => true,\n\t\t finished => false,\n\t\t s"
& "rc => ok,\n\t\t dst => ok,\n\t\t vmove => vtx1,\n\t\t vlastnomove =>"
& " ok,\n\t\t nomovecnt => 0,\n\t\t vlastblocked => ok,\n\t\t blockedcn"
& "t => 0,\n\t\t vlab1 => vtx2,\n\t\t vlab2 => vtx3}];\n graph_ve"
& "rtexToBack(vtx1);\n\tgraph_setVertexBorder(vtx1, self.border);\n\tgraph"
& "_setVertexBorderColor(vtx1, color_rgb(0.0, 0.0, 0.0)); \n\tgraph_setVer"
& "texColor(vtx1, moveColor);\n\tgraph_moveVertex(vtx1, float(i), self.bor"
& "der/2.0, false);\n\tgraph_setVertexSize(vtx1, 0.95, self.border);\n\n\t"
& "graph_setVertexFont(vtx2, self.vertexFont);\n\tgraph_setVertexColor(vtx"
& "2, backgroundColor);\n\tgraph_setVertexLabelColor(vtx2, labelColor);\n\t"
& "graph_moveVertex(vtx2, float(i), self.yLab1, false);\n\tgraph_setVertex"
& "Size(vtx2, 0.95, self.fntVSize);\n\n\tgraph_setVertexLabel(vtx3, \"0%\""
& ");\n\tgraph_setVertexFont(vtx3, self.vertexFont);\n\tgraph_setVertexCol"
& "or(vtx3, backgroundColor);\n graph_setVertexLabelColor(vtx3, lab"
& "elColor);\n\tgraph_moveVertex(vtx3, float(i), self.yLab2, false);\n\tgr"
& "aph_setVertexSize(vtx3, 0.95, self.fntVSize);\n end;\n end,\n\n"
& " NewPacket => meth (self, id, source, dest, fewestHops, name)\n "
& " self.hopsT[id].minNumHops := fewestHops;\n self.hopsT[id].src := "
& "source;\n self.hopsT[id].dst := dest;\n graph_setVertexLabel("
& "self.hopsT[id].vlab1, name);\n end,\n\n EndPackets => meth (self)"
& "\n graph_redisplay(self.graphvbt);\n end,\n\n Blocked => met"
& "h(self, id, fromN, toN)\n self.hopsT[id].blocked := true;\n end"
& ",\n\n MovePacket => meth(self, id, fromN, toN) \n self.hopsT[id"
& "].moved := true;\n end,\n\n Absorb => meth(self, id, node)\n "
& " self.hopsT[id].progress := false;\n end,\n\n QueueSize";
CONST E15_1 =
"s => meth(self, queueSizes)\n ok;\n end,\n\n Step => meth (s"
& "elf)\n let fmtReal = proc (txt, dec)\n\tvar auxtxt = txt;\n\tlet i"
& "ndex = text_findFirstChar(\'.\', txt, 0);\n\tif index isnot ~1 then\n\t"
& " auxtxt := text_sub(txt, 0, index+dec);\n end;\n\tauxtxt\n "
& " end;\n\n self.steps := self.steps + 1;\n if self.steps >self"
& ".maxSteps then\n self.maxSteps := self.maxSteps * 2;\n se"
& "lf.north := self.north * 2.0;\n\tself.south := self.south * 2.0;\n\tsel"
& "f.fntVSize := self.fntVSize * 2.0;\n\tself.border := self.border * 2.0;"
& "\n\tself.yLab1 := self.yLab1 * 2.0;\n\tself.yLab2 := self.yLab2 * 2.0;\n"
& "\n graph_setWorld(self.graphvbt,\n\t\t self.east, self.wes"
& "t, self.north, self.south);\n\n for i = 0 to self.pktCnt-1 do\n "
& " graph_moveVertex(self.hopsT[i].vlab1,\n\t\t\t float(i), self"
& ".yLab1, false);\n\t graph_setVertexSize(self.hopsT[i].vlab1,\n\t\t\t "
& " 0.95, self.fntVSize);\n graph_moveVertex(self.hopsT[i].vla"
& "b2,\n\t float(i), self.yLab2, false);\n grap"
& "h_setVertexSize(self.hopsT[i].vlab2,\n\t 0.95, sel"
& "f.fntVSize);\n end;\n end;\n\n for i = 0 to self.pktCn"
& "t-1 do\n\tif self.hopsT[i].finished is false then\n if self.ho"
& "psT[i].moved is false then\n if self.hopsT[i].blocked is tru"
& "e then\n\t self.hopsT[i].blocked := false;\n self.hop"
& "sT[i].congested := self.hopsT[i].congested + 1.0;\n\t if self.hops"
& "T[i].vlastnomove isnot ok then\n\t\tself.hopsT[i].vlastnomove := ok;\n\t"
& "\tself.hopsT[i].nomovecnt := 0;\n end;\n\t if self.ho"
& "psT[i].vlastblocked is ok then\n\t let vblocked = graph_newVerte"
& "x(self.graphvbt);\n graph_setVertexBorder(vblocked, self"
& ".border);\n\t\tgraph_setVertexBorderColor(vblocked, color_rgb(0.0, 0.0,"
& " 0.0));\n graph_setVertexColor(vblocked, blockedColor);\n"
& "\t\tgraph_moveVertex(vblocked, \n\t\t\t\t float(i), float(self.steps) "
& "- 0.5, false);\n graph_setVertexSize(vblocked, 0.95, 1."
& "0);\n\t\tself.hopsT[i].vlastblocked:=";
CONST E15_2 =
" vblocked;\n\t\tself.hopsT[i].blockedcnt := 1;\n else\n "
& " self.hopsT[i].blockedcnt := self.hopsT[i].blockedcnt + 1;\n"
& "\t\tgraph_moveVertex(self.hopsT[i].vblocked,\n\t\t\t\t float(i),\n\t\t"
& "\t\t float(self.steps) -\n\t\t\t\t (float(self.hopsT[i].blockedcnt)"
& "/2.0),\n false);\n grap"
& "h_setVertexSize(self.hopsT[i].vlastblocked,\n\t\t\t\t 0.95, float(s"
& "elf.hopsT[i].blockedcnt));\n\n\t end;\n else\n\t i"
& "f self.hopsT[i].vlastblocked isnot ok then\n\t\tself.hopsT[i].vlastbloc"
& "ked := ok;\n\t\tself.hopsT[i].blockedcnt := 0;\n end;\n\t "
& " if self.hopsT[i].vlastnomove is ok then\n\t let vnomove = g"
& "raph_newVertex(self.graphvbt);\n\t graph_setVertexBorder(vnomove"
& ", self.border);\n\t graph_setVertexBorderColor(vnomove, color_rg"
& "b(0.0, 0.0, 0.0)); \n\t graph_setVertexColor(vnomove, nomoveColo"
& "r);\n\t graph_moveVertex(vnomove, float(i), \n\t\t\t flo"
& "at(self.steps) - 0.5, false);\n graph_setVertexSize(vnom"
& "ove, 0.95, 1.0); \n\t self.hopsT[i].vlastnomove := vnomove;\n\t "
& " else\n\t self.hopsT[i].nomovecnt := self.ho"
& "psT[i].nomovecnt + 1;\n graph_moveVertex(self.hopsT[i].v"
& "lastnomove,\n\t\t\t float(i), \n\t\t\t float(self.step"
& "s) - \n\t\t\t\t (float(self.hopsT[i].nomovecnt)/2.0),\n\t\t\t "
& " false);\n graph_setVertexSize(self.hopsT[i].vlastnomo"
& "ve, \n\t\t\t\t 0.95, float(self.hopsT[i].nomovecnt));\n "
& " end;\n\t end;\n else\n\t self.hopsT[i].moved := false;\n"
& "\t self.hopsT[i].vlastnomove := ok;\n\t self.hopsT[i].nomovecnt :"
& "= 0;\n\t self.hopsT[i].vlastblocked := ok;\n\t self.hopsT[i].bloc"
& "kedcnt := 0;\n graph_moveVertex( self.hopsT[i].vmove, \n\t\t"
& "\t float(i), float(self.steps)/2.0, false);\n graph_set"
& "VertexSize( self.hopsT[i].vmove, 0.95, float(self.steps));\n e"
& "nd;\n graph_setVertexLabel( self.hopsT[i].vlab2,\n "
& " fmtReal(\n\t fmt_real( 100.0 * self.hopsT[i";
CONST E15_3 =
"].congested /\n\t float(self.steps)), 2) & \"%\" );\n "
& " if self.hopsT[i].progress isnot true then\n\t self.hopsT[i].finish"
& "ed := true;\n let vtx = graph_newVertex(self.graphvbt);\n "
& " graph_setVertexColor(vtx, finishedColor);\n\t graph_moveVer"
& "tex(vtx, float(i),\n\t\t\t float(self.steps+1) - 0.75, false);\n "
& " graph_setVertexSize(vtx, 0.96, 0.5);\n end;\n\tend;\n"
& " end;\n graph_redisplay(self.graphvbt);\n end,\n\n };\n";
CONST E16 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Whee"
& "ler.evt.\n;************************************************************"
& "********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4)"
& " (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glu"
& "e 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algori"
& "thm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus ev"
& "ents\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args t"
& "o events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height"
& " 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E17 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(VBox \n (Gl"
& "ue 10)\n (HBox \n (Shape (Width + 0) \"Capacity for new edges: \") "
& "\n (Border (TypeIn %capacity =\"3.0\"))\n (Glue 20))\n (Glue 10)"
& "\n (HBox\n (Shape (Width + 0) \"Label prefix for new vertex: \") \n"
& " (Border (TypeIn %vertexname =\"\"))\n (Glue 20))\n (Glue 10) (B"
& "ar) (Glue 10)\n (HBox\n (Shape (Width + 0) \"Create edge between ve"
& "rtex: \") \n (Border (TypeIn %vertex0))\n (Glue 20))\n (Glue 10)"
& "\n (HBox\n (Shape (Width + 0) \" and vertex: \") \n (Border (T"
& "ypeIn %vertex1))\n (Glue 20)\n (Button %DoEdge \" DO IT \")\n "
& "(Glue 20))\n (Glue 10) (Bar) (Glue 10)\n (Filter Dormant (HBox\n ("
& "Glue 10)\n (Button %Save \"Save/use Pkl file\")\n (Glue 10)\n "
& "(Border (TypeIn %filename =\"\"))\n (Glue 20) Fill))\n (Glue 10)\n "
& " (VBox\n (Shape (Height + 0) (Text LeftAlign \"Canned data files:\")"
& ")\n (Border (Shape (Height 100 + Inf)\n (Browser =0 %asciifilen"
& "ame \n (Items \"data.backedge\" \"data.big\" \"data.big2\" \"dat"
& "a.fin\" \"data.simple\")\n ))))\n (Glue 10)\n)\n";
CONST E18 =
"#include <algorithm.h>\n#include <R2.h>\n#include <Math.h>\n\n#define M"
& "axDistance 1.0E30\n\ntypedef Link = struct Linkstruct {\n Point p;\n"
& " Link next;\n } * ;\n\nfloat min = 100.0;\nLink h,z;\nint N = 0"
& ".0;\n\n@CheckforMin\ncheck_for_min (p1, p2)@\npoint p1,p2;\n{\n@5 if"
& " (dist(p1,p2) < min)@\n@10 update_min(p1,p2);@\n}\n@CheckforMin\n\n"
& "@FindClosestPair\nlink find_closest_pair (c,N)@\nlink c;\nint N;\n{\n "
& "link a, b, t1, t2;\n int i;\n real middle_xcoord;\n point p1, p2, p3"
& ", p4;\n\n@5 a = c;@\n@10 b = middle_of_list(c,N);@\n@15 middle_xc"
& "oord = b -> p.x;@\n\n@20 t1 = find_closest_pair(a, N div 2);@\n@25 "
& "t2 = find_closest_pair(b, N - (N div 2));@\n\n@30 c = merge_lists(t1,"
& " t2);@\n\n@35 a = c;@\n repeat\n {\n@40 if ((abs(a -> p.x - mid"
& "dle_xcoord) < min) && (p1 != z -> p)) @\n {\n@45 check_for_m"
& "in(a -> p, p1);@\n@50 check_for_min(a -> p, p2);@\n@55 chec"
& "k_for_min(a -> p, p3);@\n@60 check_for_min(a -> p, p4);@\n@65 "
& " p1 = p2; p2 = p3; p3 = p4; p4 = a -> p;@\n }\n@70 a = a -> "
& "next;@\n }\n@75 until a = z;@\n@80 return c;@\n}\n@FindClosestPair"
& "\n \n@Main\nmain() /* Main program: computes closest pair in given set"
& " of points */@\n{\n@5 initialize_list_of_points(h,&N);@\n@10 sort_by_"
& "X(h, N);@\n@15 find_closest_pair(h, N);@\n}\n@Main\n";
CONST E19 =
"Source 100 500\nV2 300 500\nV3 500 500\nSink 700 500\nV4 200 350\nV5 40"
& "0 350\nV6 400 650\nV7 600 650\nSource -> V2 1.9\nV2 -> V3 2.4\nV3 -> Si"
& "nk 1.1\nSource -> V4 3.2\nV4 -> V5 2.3\nV5 -> V3 1.7\nV2 -> V6 2.88\nV6"
& " -> V7 3.12\nV7 -> Sink 1.98\n.\n";
CONST E20 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Hull"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 + "
& "Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& "(Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (H"
& "eight 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0)"
& " \n \"SetHalfPlane: Stop? \") \n "
& " (Boolean %stopAtSetHalfPlane =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"W"
& "eight: \")\n (Shape (Width 80) (Numeric %waitAtSetHa"
& "lfPlane =1 \n (Min 0) (Ma"
& "x 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " ";
CONST E20_0 =
" (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"ClearHead: Stop? \") \n (Boolean %st"
& "opAtClearHead =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtClearHead =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)"
& "\n (Shape (Height 16 + 0)\n (HBox Fill (Shape ("
& "Width + 0) (Height + 0) \n \"TestSite: "
& " Stop? \") \n (Boolean %stopAtTestSite =TRUE \"\")\n"
& " (Glue 10)\n (Shape (Width + 0) ("
& "Height + 0) \"Weight: \")\n (Shape (Width 80) (Numer"
& "ic %waitAtTestSite =1 \n "
& "(Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Height"
& " 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"ClearTest: Stop? \") \n "
& " (Boolean %stopAtClearTest =TRUE \"\")\n (Glue "
& "10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtClearTest =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"SetTail: Stop? \") \n (Boolean %stopAtSetTai"
& "l =TRUE \"\")\n (Glue 10)\n (Shap"
& "e (Width + 0) (Height + 0) \"Weight: \")\n (Shape (W"
& "idth 80) (Numeric %waitAtSetTail =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& "(Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (He"
& "ight + 0) \n \"ClearTail: Stop? \") \n"
& " (Boolean %stopAtClearTail =TRUE \"\")\n "
& " ";
CONST E20_1 =
" (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weigh"
& "t: \")\n (Shape (Width 80) (Numeric %waitAtClearTail"
& " =1 \n (Min 0) (Max 100))"
& ")))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"MoveHalfPlane: Stop? \") \n (Boolean"
& " %stopAtMoveHalfPlane =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtMoveHalfPlane =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox F"
& "ill (Shape (Width + 0) (Height + 0) \n \""
& "Confirm: Stop? \") \n (Boolean %stopAtConfirm =TRU"
& "E \"\")\n (Glue 10)\n (Shape (Wid"
& "th + 0) (Height + 0) \"Weight: \")\n (Shape (Width 8"
& "0) (Numeric %waitAtConfirm =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"Deny: Stop? \") \n "
& " (Boolean %stopAtDeny =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtDeny =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height + 0) \n \""
& "Swap: Stop? \") \n (Boolean %stopAtSwap =TRUE \"\""
& ")\n (Glue 10)\n (Shape (Width + 0"
& ") (Height + 0) \"Weight: \")\n (Shape (Width 80) (Nu"
& "meric %waitAtSwap =1 \n ("
& "Min 0";
CONST E20_2 =
") (Max 100)))))\n (Glue 6)\n (Shape (Height 16 + "
& "0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Sentinel: Stop? \") \n ("
& "Boolean %stopAtSentinel =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtSentinel =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fill"
& " (Shape (Width + 0) (Height + 0) \n \"Re"
& "Order: Stop? \") \n (Boolean %stopAtReOrder =TRUE "
& "\"\")\n (Glue 10)\n (Shape (Width"
& " + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80)"
& " (Numeric %waitAtReOrder =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape ("
& "Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0"
& ") \n \"Stretch: Stop? \") \n "
& " (Boolean %stopAtStretch =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtStretch =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n ("
& "HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Snap: Stop? \") \n (Boolean %stopAtSnap =TR"
& "UE \"\")\n (Glue 10)\n (Shape (Wi"
& "dth + 0) (Height + 0) \"Weight: \")\n (Shape (Width "
& "80) (Numeric %waitAtSnap =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape ("
& "Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0"
& ") \n \"Shuffle: Stop? \") \n "
& " ";
CONST E20_3 =
" (Boolean %stopAtShuffle =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtShuffle =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n )\n (Glue 4)\n (VBox\n "
& " (Glue 5)\n (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n"
& " (Button %eventCounts\n (VBox\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfSetup \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Heigh"
& "t 16 + 0) \n (Text %ctOfSetHalfPlane \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + 0) (Height 16 + 0) \n (Text %ctO"
& "fClearHead \"0\")))\n (Glue 6)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfTestSite \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfClearTest \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetTail \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0"
& ") \n (Text %ctOfClearTail \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) ("
& "Height 16 + 0) \n (Text %ctOfMoveHalfP"
& "lane \"0\")))\n (Glue 6)\n (HBox Fill (Sh"
& "ape (Width + 0) (Height 16 + 0) \n (Te"
& "xt %ctOfConfirm \"0\")))\n (Glue 6)\n (HB"
& "ox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfDeny \"0\")))\n (Glue 6)\n "
& " (HBo";
CONST E20_4 =
"x Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSwap \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSentinel \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfReOrder \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0"
& ") \n (Text %ctOfStretch \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (He"
& "ight 16 + 0) \n (Text %ctOfSnap \"0\")"
& "))\n (Glue 6)\n (HBox Fill (Shape (Width "
& "+ 0) (Height 16 + 0) \n (Text %ctOfShu"
& "ffle \"0\")))\n (Glue 3))))\n Fill\n ("
& "Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E21 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file logo"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 + "
& "Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& "(Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Init: Stop? \") \n (Boolean %stopAtInit =TRUE \""
& "\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtInit =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heigh"
& "t 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"RandomStep: Stop? \") \n "
& " (Boolean %stopAtRandomStep =TRUE \"\")\n (Gl"
& "ue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtRandomStep =1 "
& "\n (Min 0) (Max 100)))))\n"
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HB";
CONST E21_0 =
"ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Shift: Stop? \") \n (Boolean %stopAtShift =TR"
& "UE \"\")\n (Glue 10)\n (Shape (Wi"
& "dth + 0) (Height + 0) \"Weight: \")\n (Shape (Width "
& "80) (Numeric %waitAtShift =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape "
& "(Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + "
& "0) \n \"Marquee: Stop? \") \n "
& " (Boolean %stopAtMarquee =TRUE \"\")\n (Gl"
& "ue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtMarquee =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n ("
& "HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"MarqueeSpots: Stop? \") \n (Boolean %stopAt"
& "MarqueeSpots =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtMarqueeSpots =1 \n "
& " (Min 0) (Max 100)))))\n (Glue "
& "6)\n )\n (Glue 4)\n (VBox\n (Glue"
& " 5)\n (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n "
& " (Button %eventCounts\n (VBox\n (Glue 6)"
& "\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfInit \"0\")))\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfRandomStep \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) ("
& "Height 16 + 0) \n (Text %ctOfShift \"0"
& "\")))\n (Glue 6)\n (HBox Fill (Shape (Wid"
& "th + 0) (";
CONST E21_1 =
"Height 16 + 0) \n (Text %ctOfMarquee \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + 0) (Height 16 + 0) \n (Text %ctO"
& "fMarqueeSpots \"0\")))\n (Glue 3))))\n Fill\n "
& " (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E22 =
"@Warshall\nPROCEDURE Warshall(a: ARRAY OF ARRAY OF BOOLEAN; V: INTEGER)"
& " @=\n BEGIN\n @1 FOR y := 0 TO V-1 DO@\n @2 FOR x := 0 TO V-1 DO@\n"
& " @3 IF a[x, y] THEN @\n @4 FOR j := 0 TO V-1 DO @\n "
& " @5 IF a[y, j] THEN @ @6 a[x, j] := TRUE @ END; (* if *) "
& " \n END; (* for j *)\n END; (* if *)\n END; (* "
& "for x *)\n END; (* for y *)\n END Warshall;\n@Warshall\n";
CONST E23 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Hash"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 + "
& "Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& "(Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (H"
& "eight 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0)"
& " \n \"Insert: Stop? \") \n "
& " (Boolean %stopAtInsert =TRUE \"\")\n (Glue 1"
& "0)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtInsert =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (";
CONST E23_0 =
"Shape (Width + 0) (Height + 0) \n \"Find"
& ": Stop? \") \n (Boolean %stopAtFind =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (H"
& "eight + 0) \"Weight: \")\n (Shape (Width 80) (Numeri"
& "c %waitAtFind =1 \n (Min "
& "0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16 +"
& " 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Delete: Stop? \") \n (B"
& "oolean %stopAtDelete =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtDelete =1 \n "
& " (Min 0) (Max 100)))))\n (Glu"
& "e 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height + 0) \n \"Compare"
& ": Stop? \") \n (Boolean %stopAtCompare =TRUE \"\")"
& "\n (Glue 10)\n (Shape (Width + 0)"
& " (Height + 0) \"Weight: \")\n (Shape (Width 80) (Num"
& "eric %waitAtCompare =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heigh"
& "t 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"CheckDeletable: Stop? \") \n "
& " (Boolean %stopAtCheckDeletable =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"W"
& "eight: \")\n (Shape (Width 80) (Numeric %waitAtCheck"
& "Deletable =1 \n (Min 0) ("
& "Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"CheckHashPosition: Stop? \") \n "
& " (Boolean %stopAtCheckHashPosition =TRUE \"\")\n "
& "(Glue 1";
CONST E23_1 =
"0)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtCheckHashPosition"
& " =1 \n (Min 0) (Max 100))"
& ")))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"AddToBucket: Stop? \") \n (Boolean %"
& "stopAtAddToBucket =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtAddToBucket =1 \n "
& " (Min 0) (Max 100)))))\n (G"
& "lue 6)\n (Shape (Height 16 + 0)\n (HBox Fill (S"
& "hape (Width + 0) (Height + 0) \n \"Delet"
& "eFromBucket: Stop? \") \n (Boolean %stopAtDeleteFr"
& "omBucket =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n (S"
& "hape (Width 80) (Numeric %waitAtDeleteFromBucket =1 \n "
& " (Min 0) (Max 100)))))\n (Glue "
& "6)\n )\n (Glue 4)\n (VBox\n (Glue"
& " 5)\n (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n "
& " (Button %eventCounts\n (VBox\n (Glue 6)"
& "\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0"
& ") \n (Text %ctOfInsert \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Hei"
& "ght 16 + 0) \n (Text %ctOfFind \"0\"))"
& ")\n (Glue 6)\n (HBox Fill (Shape (Width +"
& " 0) (Height 16 + 0) \n (Text %ctOfDele"
& "te \"0\")))\n (Glue 6)\n (HBox Fill (Shap"
& "e (Width";
CONST E23_2 =
" + 0) (Height 16 + 0) \n (Text %ctOfCo"
& "mpare \"0\")))\n (Glue 6)\n (HBox Fill (S"
& "hape (Width + 0) (Height 16 + 0) \n (T"
& "ext %ctOfCheckDeletable \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfCheckHashPosition \"0\")))\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfAddToBucket \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) "
& "(Height 16 + 0) \n (Text %ctOfDeleteFr"
& "omBucket \"0\")))\n (Glue 3))))\n Fill\n "
& " (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E24 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Shape\n (Wi"
& "dth + Inf)\n (Rim\n (Pen 8)\n (Macro Fixed BOA (child) `(Shape ("
& "Width + 0) (Height + 0) ,child))\n (Macro\n Divider\n BOA\n"
& " (name str)\n `(PageButton\n (ShadowSize 0.0)\n "
& " (For ,name)\n (Boolean\n (ShadowSize 1.5)\n "
& " (HBox\n (VBox Fill Bar Fill)\n (Shape (Widt"
& "h + 0) (Height + 0) ,str)\n (VBox Fill Bar Fill)))))\n ("
& "Macro\n Dividee\n BOA\n (name child)\n `(TSplit Fle"
& "x =0 %,name Circular (Generic) ,child))\n (VBox\n (Glue 4 + 0)\n"
& " (HBox\n (Shape (Width + 0) \"Number of buckets: \")\n "
& " (Numeric (Min 1) (Max 1000) %Buckets =29)\n Fill)\n (Glu"
& "e 4 + 0)\n (HBox\n (Boolean %PauseOnDeletes =FALSE (Text Le"
& "ftAlign \" Pause On Deletes\"))\n Fill)\n (Glue 4 + 0)\n "
& " (HBox\n (Shape (Width + 0) \"Number of operations: \")\n "
& " (Numeric (Min 1) (Max 10000) %Ops =100)\n Fill)\n (Glue"
& " 4 + 0)\n (Shape (Height + 0) (Text LeftAlign \"Key generation:\")"
& ")\n (HBox\n (Radio\n (VBox\n (Choice %R"
& "andom =FALSE (Text LeftAlign \" Random\"))\n (Choice %Conse"
& "q =TRUE (Text LeftAlign \" Consequtive\"))))\n Fill)\n (HB"
& "ox\n (Shape (Width + 0) \"Number of initial inserts: \")\n "
& " (Numeric (Min 0) (Max 10000) %InitInserts =29)\n Fill)\n "
& "(HBox\n (Shape (Width + 0) \"Number of initial deletes: \")\n "
& " (Numeric (Min 0) (Max 10000) %InitDeletes =10)\n Fill)\n "
& " (HBox\n (Shape (Width + 0) \"Percentage of inserts: \")\n "
& " (Numeric (Min 0) (Max 100) %Inserts =20)\n Fill)\n (HBo"
& "x\n (Shape (Width + 0) \"Percentage of deletes: \")\n (Nu"
& "meric (Min 0) (Max 100) %Deletes =20)\n Fill)\n (HBox\n "
& " (Shape (Width + 0) \"Percentage of successful finds: \")\n ("
& "Numeric (Min 0) (Max 100) %Su";
CONST E24_0 =
"ccFinds =5)\n Fill)\n (HBox\n (Shape (Width + 0) \"F"
& "ixed ``Random\'\' Sequence: \")\n (Boolean %FixedRandom =FALSE \""
& "\")\n Fill)\n (Glue 10)\n (Divider viewFormT \"Input f"
& "or view\")\n (Dividee\n viewFormT\n (HBox\n "
& " (Fill)\n (Shape\n (Width + 0)\n (VBox\n"
& " (HBox\n (Shape (Width + 0) \"Normal Color:"
& " \")\n (TypeIn %NormalColor =\"QuiteLightBlue\"))\n "
& " (HBox\n (Shape (Width + 0) \"Nil Color: \")\n "
& " (TypeIn %NilColor =\"QuiteLightYellow\"))\n "
& "(HBox\n (Shape (Width + 0) \"Empty Color: \")\n "
& " (TypeIn %EmptyColor =\"QuiteLightBrown\"))\n (HBox\n"
& " (Shape (Width + 0) \"Compare Color: \")\n "
& " (TypeIn %CompareColor =\"LightOrange\"))\n (HBox\n "
& " (Shape (Width + 0) \"New Color: \")\n (TypeIn "
& "%NewColor =\"QuiteLightGreen\"))\n (HBox\n "
& "(Shape (Width + 0) \"Check Deletable Color: \")\n (TypeI"
& "n %CheckDeletableColor =\"QuiteLightMagenta\"))\n (HBox\n "
& " (Shape (Width + 0) \"Check Hash Position Color: \")\n "
& " (TypeIn %CheckHashPositionColor =\"QuiteLightCyan\"))\n "
& " (HBox\n (Shape (Width + 0) \"Operation Highli"
& "ght Color: \")\n (TypeIn %OperationHighlightColor =\"Vio"
& "let\"))\n (HBox\n (Shape (Width + 0) \"Item"
& " Color: \")\n (TypeIn %ItemColor =\"QuiteLightGreenishBl"
& "ue\"))))\n (Fill))))))";
CONST E25 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* Last modified on Mon Jan 9 "
& "12:13:42 PST 1995 by najork *)\n(* modified on W"
& "ed Oct 13 19:41:11 PDT 1993 by mann *)\n(* mod"
& "ified on Thu Jul 22 14:27:15 PDT 1993 by perl *)\n\n"
& "let stringColor = color_named(\"Pink\");\nlet stringLabelColor = color_"
& "named(\"Black\");\nlet matrixColor = color_named(\"QuiteLightSlightlyGr"
& "eenishVividBlue\");\nlet matrixLabelColor = color_named(\"Black\");\nle"
& "t rowIndexColor = stringColor;\nlet rowIndexLabelColor = stringLabelCol"
& "or;\nlet otherIndexColor = color_named(\"White\");\nlet otherIndexLabel"
& "Color = color_named(\"DarkGray\");\nlet shadowColor = color_named(\"Lig"
& "htGray\");\nlet shadowLabelColor = color_named(\"Black\");\nlet alphaCo"
& "lor = color_named(\"LightYellow\");\nlet alphaLabelColor = color_named("
& "\"Black\");\nlet permutedColor = alphaColor;\nlet permutedLabelColor = "
& "alphaLabelColor;\nlet codesColor = color_named(\"White\");\nlet codesLa"
& "belColor = color_named(\"Black\");\nlet codesHiliteLabelColor = color_n"
& "amed(\"DarkRed\");\nlet arrowColor = color_named(\"DarkRed\");\nlet dup"
& "lColor = color_named(\"LightGray\");\nlet duplLabelColor = color_named("
& "\"VeryDarkGray\");\n\nlet makeDippingPath = proc(startX, endX, y, dip)\n"
& " proc(t)\n [ (startX * (1.0 - t)) + (endX * t),\n\t y + (dip"
& " * (0.25 - ((t - 0.5) * (t - 0.5))))]\n end\nend;\n\nlet view =\n {"
& "\n graphvbt => graph_new(),\n vertexFont => ok,\n n => ok,\n "
& " string => {chars => ok, vtx => ok},\n xlast => {chars => ok, vtx ="
& "> ok},\n alphalen => ok,\n matrix => ok,\n rowIndex => ok,\n "
& " rowIndexVtx => ok,\n rowIndexGhostVtx => ok,\n codes => {array "
& "=> ok, vtx => ok},\n codeSearchArrow => ok,\n rowIndices => ok,\n"
& "\n StartPermute => me";
CONST E25_0 =
"th(self, string, alpha)\n (* Start of first phase of compression, in"
& " which we permute the\n original string.\n *)\n self.v"
& "ertexFont := graph_newFont(self.graphvbt, \"Helvetica\",\n "
& " 0.5, \"Roman\", \"bold\", \"*\");\n "
& "self.n := text_length(string);\n\tself.alphalen := text_length(alpha);\n"
& "\n\tself.string.chars := string;\n\tself.xlast.chars := alpha;\n\n\tsel"
& "f.codes.array := array_new(self.n, ok);\n self.codes.vtx := arra"
& "y_new(self.n, ok);\n\n\tlet north = ~3.0,\n south = float(se"
& "lf.n) + 4.25,\n west = -(float(self.alphalen) + 1.0),\n "
& " east = float(self.n) + 1.0;\n\tgraph_setWorld(self.graphvbt, wes"
& "t, east, north, south);\n\tgraph_setAspect(self.graphvbt, (south - nort"
& "h) / (east - west));\n\tgraph_setPixelSizeDivisor(self.graphvbt,\n "
& " round(east - west),\n\t\t\t round"
& "(south - north));\n\n self.xlast.vtx := array_new(self.alphalen "
& "+ self.n, ok);\n for i = 0 to self.alphalen - 1 do\n "
& "let v = graph_newVertex(self.graphvbt);\n self.xlast.vtx[i] "
& ":= v;\n\t graph_setVertexSize(v, 0.0, 0.0); (*invisible for now*)\n "
& " graph_setVertexLabel(v, text_sub(self.xlast.chars, i, 1));\n"
& " graph_setVertexFont(v, self.vertexFont);\n graph"
& "_setVertexColor(v, alphaColor);\n graph_setVertexLabelColor("
& "v, alphaLabelColor);\n graph_setVertexBorder(v, 0.05);\n "
& " graph_moveVertex(v, float(i - (2 * self.alphalen)) - 4.0,\n "
& " float(self.n + 1), false);\n end;\n\n"
& " self.string.vtx := array_new(self.n, ok);\n for i = 0 to"
& " self.n - 1 do\n let v = graph_newVertex(self.graphvbt);\n "
& " self.string.vtx[i] := v;\n graph_setVertexLabel(v,"
& " text_sub(string, i, 1));\n graph_setVertexFont(v, self.vert"
& "exFont);\n graph_setVertexColor(v, stringColor);\n "
& " graph_setVertexLabelColor(v, stringLabelColor);\n graph_se"
& "tVerte";
CONST E25_1 =
"xBorder(v, 0.05);\n graph_moveVertex(v, float(i), ~2.0, fals"
& "e);\n\t graph_setVertexSize(v, 0.95, 0.95);\n end;\n\n\tgraph"
& "_redisplay(self.graphvbt);\n\n self.matrix := array_new(self.n, "
& "ok);\n\tself.rowIndices := array_new(self.n, ok);\n end,\n\n Next"
& "Rotation => meth(self, i, string)\n (* Forming the matrix of rotatio"
& "ns. The ith row of the matrix is string.\n The 0th row does caus"
& "e an event, with string equal to the initial\n string.\n *)\n\n"
& " self.matrix[i] := { vtx => array_new(self.n, ok),\n "
& " chars => string };\n for j = 0 to self.n - 1 do\n"
& " let v = graph_newVertex(self.graphvbt);\n self.m"
& "atrix[i].vtx[j] := v;\n graph_setVertexLabel(v, text_sub(str"
& "ing, j, 1));\n graph_setVertexFont(v, self.vertexFont);\n "
& " graph_setVertexBorder(v, 0.05);\n\t if i is 0 then\n \t "
& " graph_setVertexColor(v, stringColor);\n graph_setVe"
& "rtexLabelColor(v, stringLabelColor);\n graph_moveVertex("
& "v, float(j), ~2.0, false);\n graph_moveVertex(v, float(j"
& "), 0.0, true);\n\t else\n \t graph_setVertexColor(v, matrixC"
& "olor);\n graph_setVertexLabelColor(v, matrixLabelColor);"
& "\n graph_moveVertex(v, float((j+1) % self.n),\n "
& " float(i-1), false);\n graph_m"
& "oveVertex(v, float(((j+1) % self.n) - 1),\n "
& " float(i), true);\n\t end;\n\t graph_setVertexSize(v, 0.95"
& ", 0.95);\n end;\n\n\tif i is 0 then\n \t zeus_animate(self."
& "graphvbt, 0.0, 1.0);\n\telse\n \t zeus_animate(self.graphvbt, 0.0,"
& " 0.75);\n\t graph_moveVertexOnPath(self.matrix[i].vtx[self.n - 1],\n"
& "\t\t \t makeDippingPath(~1.0, float(self.n - 1),\n "
& " float(i), 2.0));\n\t zeus"
& "_animate(self.graphvbt, 0.75, 1.0);\n\tend;\n\n\tlet v = graph_newVerte"
& "x(self.graphvbt);\n\tself.rowIndices[i] := v;\n\tgraph_setVertexLabel(v"
& ", fmt_int(i));";
CONST E25_2 =
"\n\tgraph_setVertexFont(v, self.vertexFont);\n\tgraph_setVertexColor(v,"
& " otherIndexColor);\n\tgraph_setVertexLabelColor(v, otherIndexLabelColor"
& ");\n\tgraph_moveVertex(v, float(self.n), float(i), false);\n\tgraph_set"
& "VertexSize(v, 0.95, 0.95);\n\tgraph_redisplay(self.graphvbt);\n end,"
& "\n\n RotationsSorted => meth(self, rotations, rowIndex)\n (* The "
& "matrix of rotations, in sorted order; rowIndex is the index\n whe"
& "re the original string landed.\n *)\n let moved = array_new(s"
& "elf.n, false),\n newMatrix = array_new(self.n, ok);\n\n "
& " for i = 0 to self.n-1 do\n for j = 0 to self.n-1 do\n "
& " if not(moved[j]) and\n text_equal(rotatio"
& "ns[i],\n self.matrix[j].chars)\n "
& " then\n\t\t newMatrix[i] := self.matrix[j];\n\t\t moved[j] :"
& "= true;\n\t\t for k = 0 to self.n-1 do\n\t\t\tlet v = newMatrix[i].v"
& "tx[k];\n\t\t\tif j > i then\n\t\t\t graph_vertexToBack(v);\n "
& " else\n graph_vertexToFront(v"
& ");\n\t\t end;\n\t\t\tgraph_moveVertex(v, float(k), float(i), tru"
& "e);\n\t end;\n\t\t exit;\n\t\tend;\n\t end;\n\tend;\n\n"
& "\tself.matrix := newMatrix;\n\tzeus_animate(self.graphvbt, 0.0, 2.0);\n"
& "\n\tself.rowIndex := rowIndex;\n\tlet v = graph_newVertex(self.graphvbt"
& ");\n\tself.rowIndexVtx := v;\n\tgraph_setVertexShape(v, \"ellipse\");\n"
& "\tgraph_setVertexLabel(v, fmt_int(self.rowIndex));\n\tgraph_setVertexFo"
& "nt(v, self.vertexFont);\n\tgraph_setVertexColor(v, rowIndexColor);\n\tg"
& "raph_setVertexLabelColor(v, rowIndexLabelColor);\n\tgraph_setVertexBord"
& "er(v, 0.05);\n\tgraph_moveVertex(v, float(self.n), float(rowIndex), fal"
& "se);\n\tgraph_setVertexSize(v, 0.95, 0.95);\n\tgraph_redisplay(self.gra"
& "phvbt);\t\n end,\n\n PermuteDone => meth(self, lastchars, rowInde"
& "x)\n (* Done with first phase of compression. The permuted string ("
& "last column\n of the sorted matrix of rotations) is lastchars. T"
& "he row index of the\n original string in the matrix is rowIndex.\n"
& " *)\n\n\tself.xlast.chars := self.xlast.chars & ";
CONST E25_3 =
"lastchars;\n\tfor ii = 0 to self.n - 1 do\n\t let i = (self.n - 1) -"
& " ii;\n let v = graph_newVertex(self.graphvbt),\n\t w "
& "= self.matrix[i].vtx[self.n-1];\n\n\t graph_vertexToBack(v);\n "
& " graph_setVertexLabel(v, text_sub(lastchars, i, 1));\n "
& "graph_setVertexFont(v, self.vertexFont);\n graph_setVertexCo"
& "lor(v, duplColor);\n graph_setVertexLabelColor(v, duplLabelC"
& "olor);\n graph_setVertexBorder(v, 0.05);\n graph_"
& "moveVertex(v, float(self.n - 1), float(i), false);\n\t graph_setVert"
& "exSize(v, 0.95, 0.95);\n\n\t graph_vertexToFront(w);\n gr"
& "aph_moveVertex(w, float(i), float(self.n + 1), true);\n\n se"
& "lf.xlast.vtx[i+self.alphalen] := w;\n self.matrix[i].vtx[sel"
& "f.n - 1] := v;\n\tend;\n\n \tzeus_animate(self.graphvbt, 0.0, 2.0 (*"
& "!!*));\n end,\n\n StartEncode => meth(self, alphabet)\n (* Rea"
& "dy to start encoding the permuted string using alphabet.\n *)\n "
& " for i = 0 to self.alphalen - 1 do\n\t graph_setVertexSize(self.xl"
& "ast.vtx[i], 0.95, 0.95);\n graph_moveVertex(self.xlast.vtx[i"
& "],\n float(i - self.alphalen),\n "
& " float(self.n + 1), true);\n\tend;\n\n\tzeus_animate(s"
& "elf.graphvbt, 0.0, 1.0);\n\n\tfor i = 0 to self.n - 1 do\n\t let v ="
& " self.xlast.vtx[i + self.alphalen];\n graph_setVertexColor(v"
& ", alphaColor);\n graph_setVertexLabelColor(v, alphaLabelColo"
& "r);\n\tend;\n\tgraph_redisplay(self.graphvbt);\n end,\n\n EncodeN"
& "extChar => meth(self, i, c)\n (* About to find the code for characte"
& "r number i in the permuted string.\n The character value is c.\n "
& " *)\n\tlet v = graph_newVertex(self.graphvbt);\n\tself.codeSearchArro"
& "w := v;\n\tgraph_setVertexFont(v, self.vertexFont);\n\tgraph_setVertexC"
& "olor(v, duplColor);\n\tgraph_setVertexLabelColor(v, duplLabelColor);\n\t"
& "graph_setVertexBorder(v, 0.05);\n\tgraph_setVertexSize(v, 0.95, 0.95);\n"
& "\tgraph_setVertexLabel(self.codeSearchArrow, text_new(1, c));\n \tgrap"
& "h_moveVertex(self.co";
CONST E25_4 =
"deSearchArrow, float(i),\n float(self.n + 1), f"
& "alse);\n \tgraph_moveVertex(self.codeSearchArrow, float(i),\n "
& " float(self.n + 2), true);\n\tzeus_animate(self.graphvbt"
& ", 0.0, 1.0);\n\n let v = graph_newVertex(self.graphvbt);\n "
& " self.codes.vtx[i] := v;\n graph_setVertexFont(v, self.vertexFo"
& "nt);\n graph_setVertexColor(v, codesColor);\n graph_setVe"
& "rtexLabelColor(v, codesHiliteLabelColor);\n graph_setVertexBorde"
& "r(v, 0.12);\n graph_moveVertex(v, float(i), float(self.n) + 3.25"
& ", false);\n graph_setVertexLabel(v, \"0\");\n\tgraph_setVertexSi"
& "ze(v, 0.95, 0.95);\n\tgraph_redisplay(self.graphvbt);\n end,\n\n "
& "EncodeDistinctCount => meth(self, i, k, n, c)\n (* Found another dis"
& "tinct character at position k in (alphabet & string) \n while com"
& "puting the code corresponding to character i in (string). The \n "
& " number of distinct characters found so far is n. The character value\n"
& " is c.\n *)\n \tgraph_moveVertex(self.codeSearchArrow, float("
& "k - self.alphalen),\n float(self.n + 2), true);"
& "\n\tzeus_animate(self.graphvbt, 0.0, 1.0);\n\tgraph_setVertexLabel(self"
& ".codes.vtx[i], fmt_int(n));\n graph_redisplay(self.graphvbt);\n "
& " end,\n\n EncodeFoundCode => meth(self, i, k, code, c)\n (* Fou"
& "nd that the code for character i in (string) is code; the closest\n "
& " previous occurrence of the same character was at position k in\n "
& " (alphabet & string). The character value is c. \n *)\n \tgraph_"
& "moveVertex(self.codeSearchArrow, float(k - self.alphalen),\n "
& " float(self.n + 2), true);\n\tzeus_animate(self.graphvbt, "
& "0.0, 0.75);\n\tgraph_moveVertex(self.codeSearchArrow, float(k - self.al"
& "phalen),\n\t\t\t float(self.n + 1), true);\n\tzeus_animate(self.graphvb"
& "t, 0.75, 1.0);\n\tgraph_removeVertex(self.xlast.vtx[k]);\n\tself.xlast."
& "vtx[k] := self.codeSearchArrow;\n\n\tself.codeSearchArrow := ok;\n\n\tl"
& "et w = self.codes.vtx[i];\n\tgraph_setVertexLabelColor(w, codesLabelCol"
& "or);\n\tgra";
CONST E25_5 =
"ph_setVertexBorder(w, 0.05);\n\n\tself.codes.array[i] := code;\n\n\tgra"
& "ph_redisplay(self.graphvbt);\t\n end,\n\n EncodeDone => meth(self"
& ", alphabet, codes, rowIndex)\n (* End of encode phase; (codes, rowIn"
& "dex) are now ready to be compressed\n by Huffman coding, arithmet"
& "ic coding, or whatever; not shown in this\n animation. \n *)\n"
& "\tlet v = graph_newVertex(self.graphvbt);\n\tself.rowIndexGhostVtx := v"
& ";\n\tgraph_setVertexShape(v, \"ellipse\");\n\tgraph_setVertexLabel(v, f"
& "mt_int(self.rowIndex));\n\tgraph_setVertexFont(v, self.vertexFont);\n\t"
& "graph_setVertexColor(v, duplColor);\n\tgraph_setVertexLabelColor(v, dup"
& "lLabelColor);\n\tgraph_setVertexBorder(v, 0.05);\n\tgraph_moveVertex(v,"
& " float(self.n), float(rowIndex), false);\n\tgraph_setVertexSize(v, 0.95"
& ", 0.95);\n\n\tlet w = self.rowIndexVtx;\n\tgraph_moveVertex(w, float(se"
& "lf.n), float(self.n) + 3.25, true);\n\n\tzeus_animate(self.graphvbt, 0."
& "0, 1.0);\n end,\n\n };\n";
CONST E26 =
"@RedBlackTest\nRedBlackTest(Keys)@\n @1 create a new, empty tree T@\n "
& " @2 foreach k in Keys do@\n @3 create a new node n with key k@\n "
& "@4 RedBlackInsert(T, n)@\n end\nend\n@RedBlackTest\n\n@Insert\nInsert("
& "T, n)@\n @4 curr := root(T)@\n @5 while curr is not the place to atta"
& "ch n do@\n @7 if key(n) < key(curr)@\n then @8 curr <- left(cur"
& "r)@\n else @9 curr <- right(curr)@\n end\n end\n @11 if T has"
& " no root@\n then @12 make n the new root of T@\n else @13 make n "
& "the proper child of curr@\n end\nend\n@Insert\n\n@RedBlackInsert\nRedB"
& "lackInsert(T, n)@\n @1 Insert(T, n)@\n @2 type(n) <- Red@\n @3 while"
& " n # root(T) and type(n) = Red@ do\n @4 side <- side of parent(n) w."
& "r.t. parent(parent(n))@\n @7 other <- opposite side from \"side\"@\n"
& " @8 y <- n\'s uncle@\n @9 if type(y) # Black@ then\n @10 han"
& "dle Case 1@\n else\n @14 if the line from parent(parent(n)) to "
& "n is zig-zag@ then\n @15 handle Case 2 (including Rotate(side))@"
& "\n end\n @17 handle Case 3 (including Rotate(other))@\n en"
& "d\n end\n @20 type(root(T)) <- Black@\nend\n@RedBlackInsert\n\n@Searc"
& "h\nSearch(T, k)@\n @1 n <- root(T)@\n @2 while key(n) # k do@\n @3"
& " if key(n) < k@\n then @4 n <- left(n)@\n else @5 n <- right("
& "n)@\n end\n end\n @6 return n@\nend\n@Search\n\n@RedBlackDelete\nR"
& "edBlackDelete(T, n)@\n @1 if n has < 2 children@\n then @2 splice <"
& "- n@\n else @3 splice <- FindMin(right(n))@\n end\n @4 splice_chil"
& "d <- SpliceOut(t, splice)@\n @5 if splice # n@ then\n @6 copy conte"
& "nts of splice node into n@\n end\n @7 if type(splice) = Black@ then\n"
& " @8 RedBlackFixUp(T, splice_child)@\n end\nend\n@RedBlackDelete\n\n"
& "@FindMin\nFindMin(n)@\n @1 while left(n) # NIL do@\n @2 n <- left(n"
& ")@\n end\n @3 return n@\nend\n@FindMin\n\n@SpliceOut\nSpliceOut(T, n)"
& "@\n @1 ch <- \"a child of n, or NIL if n has no children\"@\n @4 pare"
& "nt(ch) <- parent(n)@\n @6 if n = root(T)@ then\n @7 root(T) <- ch@\n"
& " else\n @8 make appropriate \"down\" pointer of parent(n) point to "
& "ch@\n end\n @11 return ch@\nend\n@SpliceO";
CONST E26_0 =
"ut\n\n@RedBlackFixUp\nRedBlackFixUp(T, n)@\nend\n@RedBlackFixUp\n";
CONST E27 =
"(* Copyright 1993 Digital Equipment Corporation. "
& " *)\n(* Distributed only by permission. "
& " *)\n(* "
& " *)\n(* Last modified on Thu Oct 14 17:07:55 P"
& "DT 1993 by heydon *)\n(* modified on Tue Jul 27 "
& "16:25:00 PDT 1993 by rsanchez *)\n\n(* This view shows "
& "the total number of hops that each packet needs to traverse\n to go f"
& "rom its source to its destination node. It is designed to show the\n "
& "performance of the network on between 10 to 100 packets. *) \n\nlet Ba"
& "ckGroundColor = color_named(\"White\");\nlet MinHopsColor = color_named"
& "(\"Pink\");\nlet CurrHopsColor = color_named(\"Yellow\");\nlet LabelCol"
& "or = color_named(\"Black\");\nlet CapColor = LabelColor;\nlet BorderCol"
& "or = LabelColor;\n\nlet BarWidth = 0.40;\nlet CapFactor = 0.025;\nlet G"
& "ap = 0.05;\nlet SouthInit = ~3.0;\nlet BorderSize = 0.05;\nlet ScaleFac"
& "tor = 1.5;\n\nlet XValR = proc(i) float(i) + (Gap+BarWidth)/2.0 end;\nl"
& "et XValL = proc(i) float(i) - (Gap+BarWidth)/2.0 end;\n\nlet StatString"
& "1 = \" finished using shortest path\";\nlet StatString2 = \" average sh"
& "ortest path utilization\";\n\nlet FontFromSize =\n proc(g, sz)\n gr"
& "aph_newFont(g, \"Helvetica\", sz, \"Roman\", \"bold\", \"*\")\n end;\n"
& "\nlet MoveTextVertex =\n proc(vtx, font, x, y, width, height)\n gra"
& "ph_setVertexFont(vtx, font);\n graph_moveVertex(vtx, x, y, false);\n"
& " graph_setVertexSize(vtx, width, height);\n end;\n\nlet MakeTextVer"
& "tex =\n proc(vtx, font, x, y, width, height)\n graph_setVertexColor"
& "(vtx, BackGroundColor);\n graph_setVertexLabelColor(vtx, LabelColor)"
& ";\n MoveTextVertex(vtx, font, x, y, width, height)\n end;\n\nlet Mo"
& "veBarVertex =\n proc(vtx, width, height, x)\n graph_setVertexSize(v"
& "tx, width, height);\n graph_moveVertex(vtx, x, height/2.0, false);\n"
& " end;\n \nlet MakeBarVertex =\n proc(vtx, clr, width, height, x)\n"
& " graph_setVertexBorder(vtx, BorderSize);\n graph_setVertexBorderC"
& "olor(vtx, BorderCol";
CONST E27_0 =
"or); \n graph_setVertexColor(vtx, clr);\n MoveBarVertex(vtx, widt"
& "h, height, x)\n end;\n\nlet MoveCapVertex =\n proc(vtx, (*int*) x, (*"
& "int*) y, (*real*) height)\n graph_setVertexSize(vtx, BarWidth, heigh"
& "t);\n graph_moveVertex(vtx, XValR(x), float(y)+(height/2.0), false);"
& "\n end;\n\nlet MakeCapVertex =\n proc(vw, (*int*) x, (*int*) y, (*rea"
& "l*) height)\n let vtx = graph_newVertex(vw.graphvbt);\n graph_set"
& "VertexBorder(vtx, BorderSize);\n graph_setVertexBorderColor(vtx, Bor"
& "derColor);\n graph_setVertexColor(vtx, CapColor);\n MoveCapVertex"
& "(vtx, x, y, height);\n vtx\n end;\n\nlet view =\n {\n graphvbt "
& "=> graph_new(),\n pktCnt => ok,\t(* total number of packets (from \""
& "StartPackets\") *)\n maxHops => 0.0,\t(* current max number of hops "
& "(related to \"north\" *)\n hopsT => ok,\t(* array of packets *)\n "
& " caps => ok,\t\t(* array of caps *)\n someDone => false,\t(* did any"
& " packets get absorbed this step? *)\n doneMinCnt => 0,\t(* number do"
& "ne using shortest paths *)\n doneCnt => 0,\t(* number of done packet"
& "s (= # of caps) *)\n doneUtilSum => 0.0,\t(* sum of utilization rati"
& "os of absorbed packets *)\n rescale => false,\t(* should world coord"
& "inates be scaled vertically? *)\n fontSz => 0.55,\t(* label font siz"
& "e *)\n vtxFont => ok,\t(* font used to display two rows of labels *)"
& "\n labH => 1.0,\t(* vertical size of label vertex *)\n yLab1 => ~"
& "1.0,\t(* \"y\" coordinate of first row of labels *)\n yLab2 => ~2.0,"
& "\t(* \"y\" coordinate of second row of labels *)\n label1 => ok,\t(*"
& " first text label *)\n label2 => ok,\t(* second text label *)\n ("
& "* world coordinates *)\n west => ~1.0,\t(* readonly *)\n south =>"
& " SouthInit,\n east => meth(self) float(self.pktCnt) end,\n north"
& " => meth(self) self.maxHops+self.capH + (self.south/SouthInit) end,\n "
& " capH => meth(self) CapFactor * self.maxHops end,\n mid => meth("
& "self) (self.west + self.east) / 2.0 end,\n width => meth(self) self."
& "east - self.west end,\n\n StartGraph => meth (self, nodeCnt, maxQS, "
& "bounded, xMax, y";
CONST E27_1 =
"Max)\n (* initialize graph window to be over empty space *)\n "
& " graph_setWorld(self.graphvbt, ~10.0, ~9.0, 1.0, 0.0)\n end,\n\n "
& "StartPackets => meth (self, pktCnt)\n self.pktCnt := pktCnt;\n "
& " self.vtxFont := FontFromSize(self.graphvbt, self.fontSz);\n\n (*"
& " create packet bars *)\n self.hopsT := array_new(pktCnt, ok);\n "
& " self.caps := array_new(pktCnt, ok);\n for i = 0 to pktCnt-1 do\n"
& " let vtx1 = graph_newVertex(self.graphvbt);\n\tMakeBarVertex(vtx"
& "1, CurrHopsColor, BarWidth, BorderSize, XValR(i));\n\n\tself.hopsT[i] :"
& "= {\n\t minNumHops => ok,\t(* length of shortest path for this packet "
& "*)\n\t curNumHops => 0,\t(* number of times this packet has moved *)\n"
& "\t vmin => vtx1,\t\t(* vertex that grows each time packet moves *)\n\t"
& "}\n end;\n\n (* create labels *)\n self.label1 := graph_"
& "newVertex(self.graphvbt);\n MakeTextVertex(self.label1, self.vtxFo"
& "nt,\n self.mid, self.yLab1, self.width, self.labH);\n graph"
& "_setVertexLabel(self.label1, \"0%\" & StatString1);\n\n self.label"
& "2 := graph_newVertex(self.graphvbt);\n MakeTextVertex(self.label2,"
& " self.vtxFont,\n self.mid, self.yLab2, self.width, self.labH);\n"
& " graph_setVertexLabel(self.label2, \"0%\" & StatString2);\n end"
& ",\n\n NewPacket => meth (self, id, source, dest, fewestHops, name)\n"
& " let pkt = self.hopsT[id];\n pkt.minNumHops := fewestHops;\n "
& " if float(fewestHops) > self.maxHops then\n self.maxHops := "
& "float(fewestHops)\n end;\n let vtx = graph_newVertex(self.gra"
& "phvbt);\n MakeBarVertex(vtx, MinHopsColor, BarWidth, float(fewestH"
& "ops), XValL(id))\n end,\n\n EndPackets => meth (self)\n grap"
& "h_setWorld(self.graphvbt,\n\tself.west, self.east, self.north, self.sou"
& "th);\n graph_redisplay(self.graphvbt)\n end,\n\n MovePacket "
& "=> meth(self, id, fromN, toN) \n let pkt = self.hopsT[id];\n "
& "pkt.curNumHops := pkt.curNumHops + 1;\n MoveBarVertex(pkt.vmin, Ba"
& "rWidth, float(pkt.curNumHops), XValR(id));\n if float(pkt.curNumHo"
& "ps) > self";
CONST E27_2 =
".maxHops then\n\tself.rescale := true;\n end\n end,\n\n Abso"
& "rb => meth(self, id, (*unused*) dest)\n let pkt = self.hopsT[id];\n"
& " let v = MakeCapVertex(self, id, pkt.curNumHops, self.capH());\n "
& " self.caps[self.doneCnt] := { vtx => v, id => id };\n self.done"
& "Cnt := self.doneCnt + 1;\n if pkt.minNumHops is pkt.curNumHops the"
& "n\n self.doneMinCnt := self.doneMinCnt + 1\n end;\n se"
& "lf.doneUtilSum := self.doneUtilSum +\n (float(pkt.curNumHops) / "
& "float(pkt.minNumHops));\n self.someDone := true\n end,\n\n S"
& "tep => meth (self)\n let Percent = proc((*real*) num, (*int*) deno"
& "m)\n\tfmt_int(round((100.0 * num) / float(denom))) & \"%\"\n end;\n"
& "\n (* update stats if necessary *)\n if self.someDone then\n "
& " self.someDone := false;\n let val = Percent(float(self.do"
& "neMinCnt), self.doneCnt);\n graph_setVertexLabel(self.label1, va"
& "l & StatString1);\n let val = Percent(self.doneUtilSum, self.don"
& "eCnt);\n graph_setVertexLabel(self.label2, val & StatString2);\n"
& " end;\n\n if self.rescale then\n\tself.rescale := false;\n\ts"
& "elf.maxHops := self.maxHops * ScaleFactor;\n\tself.south := self.sout"
& "h * ScaleFactor;\n\tself.fontSz := self.fontSz * ScaleFactor;\n\tse"
& "lf.labH := self.labH * ScaleFactor;\n\tself.yLab1 := self.yLab1"
& " * ScaleFactor;\n\tself.yLab2 := self.yLab2 * ScaleFactor;\n\n "
& " (* reposition labels and caps *)\n self.vtxFont := FontFrom"
& "Size(self.graphvbt, self.fontSz);\n\tMoveTextVertex(self.label1, self.v"
& "txFont,\n self.mid, self.yLab1, self.width, self.labH);\n "
& " MoveTextVertex(self.label2, self.vtxFont,\n self.mid, self."
& "yLab2, self.width, self.labH);\n for i = 0 to self.doneCnt - 1 d"
& "o\n\t let obj = self.caps[i];\n let id = obj.id;\n l"
& "et y = self.hopsT[id].curNumHops;\n MoveCapVertex(obj.vtx, id,"
& " y, self.capH())\n end;\n\n (* double height of world coo"
& "rdinates *)\n graph_setWorld(self.graphvbt, \n\t self.west, sel"
& "f.east, s";
CONST E27_3 =
"elf.north, self.south);\n end;\n\n graph_redisplay(self.graph"
& "vbt)\n end\n };\n";
CONST E28 =
"; Copyright (C) 1994, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Scale\n (HS"
& "cale 1)\n (VScale 1)\n (Rim\n (Pen 10)\n (HBox\n (Shape (W"
& "idth + 0) (VBox\n (Text RightAlign \"# of bins: \")\n (Te"
& "xt RightAlign \"# of items: \")\n (Text RightAlign \"current wei"
& "ght: \")\n (Text RightAlign \"probing bin #: \")\n (Text "
& "RightAlign \"total missing weights: \")))\n (Shape (Width 50) (VBo"
& "x\n (Text %B \"\")\n (Text %N \"\")\n (Text %wt \""
& "\")\n (Text %bin \"\")\n (Text %lost \"\"))))))\n";
CONST E29 =
"@Parse\nPROCEDURE Parse ()@\n\n @1 state := <initial state>@\n @2"
& " token := Scan ()@\n LOOP\n @3 CASE LookUp (state, token) OF@\n"
& " @4 | Action.Shift (new_state) =>@\n @5 PUSH state@\n "
& " @6 state := new_state@\n @7 token := Scan ()@\n\n "
& " @8 | Action.Goto (new_state) =>@\n @9 PUSH state@\n "
& " @10 state := new_state@\n\n @11 | Action.Reduce (p) =>@\n "
& " where p is \"lhs -> x0 x1 ... xn\"\n @12 POP n stat"
& "es@\n @13 (GOTO, state) := LookUp (top_of_stack, p.lhs)@\n "
& " @14 PUSH state@\n\n @15 | Action.Accept =>@\n "
& " @16 EXIT@\n\n @17 | Action.Error =>@\n @18 ERROR@\n"
& " @19 EXIT@\n END;\n END;\n @20 END Parse@\n\n@Parse"
& "\n\n";
CONST E30 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Stri"
& "ngSearch.evt.\n;*******************************************************"
& "*************\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Gl"
& "ue 4) (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n "
& " (Glue 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"A"
& "lgorithm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Ze"
& "us events\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display a"
& "rgs to events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (H"
& "eight 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E31 =
"(* Copyright (C) 1994, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* Last modified on Mon Jan 9 "
& "12:04:09 PST 1995 by najork *)\n(* modified on F"
& "ri Aug 19 15:40:47 PDT 1994 by heydon *)\n\n(* BigTre"
& "e.obl -- tree view for Union-Find designed for showing large trees *)\n"
& "\nlet NodeBgColor = color_named(\"Green\");\nlet NodeFgColor "
& " = color_named(\"Black\");\nlet NormalEdgeColor = color_named(\"Blac"
& "k\");\nlet HiliteEdgeColor = color_named(\"Red\");\nlet RankBarBgColo"
& "r = color_named(\"Red\");\nlet RankBarFgColor = color_named(\"Bla"
& "ck\");\n\n(* Hilite colors *)\nlet SelectHiLiColor = color_named(\"Or"
& "ange\");\nlet FoundHiLiColor = color_named(\"Blue\");\nlet NodeHilit"
& "eBgColor = color_named(\"Red\");\n\nlet NodeSz = 1.0;\nlet Margin = 5"
& ".0; (* in mm *)\nlet VGap = NodeSz * 1.0; (* vertical gap"
& " between levels *)\nlet HGap = NodeSz * 0.2; (* horizontal gap betw"
& "een siblings *)\nlet RankH = NodeSz * 0.25; (* height of rank bars *)"
& "\nlet RankW = NodeSz * 1.0; (* width of each rank unit *)\nlet RankG"
& "ap = NodeSz * 0.25; (* gap between root and rank bars *)\nlet RankY ="
& " RankGap + ((NodeSz + RankH)/ 2.0);\n\n(* The \"VGap\" is the distance "
& "between the bottoms of nodes on level \"i\"\n and the tops of nodes o"
& "n level \"i+1\". The \"HGap\" is the gap between the\n right edge of "
& "a node and the left edge of its right sibling. *)\n\nlet BorderWidth "
& "= NodeSz * 0.05;\nlet ThinEdgeWidth = NodeSz * 0.05;\nlet FatEdgeWidth "
& " = NodeSz * 0.2;\nlet FoundHiLiSz = NodeSz * 0.08;\nlet SelectHiLiSz "
& " = NodeSz * 0.20;\n\n(* Node Object (to be cloned) ===================="
& "========================= *)\n\nlet Node = {\n v: Vertex => ok, "
& " (* The Vertex *)\n e: Edge => ok, \t (* The Edge to the parent"
& " *)\n parent";
CONST E31_0 =
": Node => ok, (* parent node *)\n children: Node => ok, (* leftm"
& "ost child node *)\n height: Int => 0, \t (* height of tree rooted at "
& "this node *)\n x: Real => ok, (* x-coordinate of this node *)"
& "\n next => ok, \t (* ids of next and previous siblings *)\n pr"
& "ev => ok,\n rank: Int => 0,\n rankBar: Vertex => ok, (* the vertex o"
& "f this node\'s rank bar (if any) *)\n\n lastChild => meth(parent: Node"
& "): Node,\n (* Returns the rightmost child of \"parent\", or \"ok\" if "
& "\"parent\"\n is a leaf. *)\n var curr: Node = parent.children;\n"
& " if curr isnot ok then\n loop\n if curr.next is ok then "
& "exit end;\n curr := curr.next\n end;\n curr\n else\n"
& " ok\n end\n end,\n\n incHeightToRoot => meth(parent, child: N"
& "ode): Ok,\n (* the \"child\" of \"parent\" has just grown in height; g"
& "row \"parent\" and\n all nodes on the path from it to the root of t"
& "he tree in height as\n necessary. *)\n if (child.height + 1) > p"
& "arent.height then\n parent.height := (child.height + 1);\n if"
& " parent.parent isnot ok then\n parent.parent.incHeightToRoot(par"
& "ent)\n end\n end;\n ok\n end,\n\n addChild => meth(parent,"
& " rightOf, child: Node): Ok,\n (* Adds child as a child of parent, inse"
& "rted to the right of \n the child \"rightOf\", which must be a chil"
& "d of parent, or as\n the leftmost child if rightOf is ok *)\n if"
& " rightOf is ok then\n child.next := parent.children;\n child."
& "prev := ok;\n if child.next isnot ok then child.next.prev := child"
& " end;\n parent.children := child;\n else\n child.prev := r"
& "ightOf;\n child.next := rightOf.next;\n if (child.next isnot "
& "ok) then child.next.prev := child end;\n rightOf.next := child;\n "
& " end;\n child.parent := parent;\n parent.incHeightToRoot(child)"
& ";\n ok\n end,\n\n updateHeight => meth(parent: Node): Ok,\n (* up"
& "date the height of \"parent\" to be one greater than the maximum height"
& "s\n of its children, or 0 if it has no children. *)\n var maxHt:"
& " Int = ~1;\n var ";
CONST E31_1 =
"ch: Node = parent.children;\n loop\n if ch is ok then exit end;"
& "\n if ch.height > maxHt then maxHt := ch.height end;\n ch := "
& "ch.next\n end;\n parent.height := (maxHt + 1);\n ok\n end,\n\n"
& " decHeightToRoot => meth(parent: Node, oldChHeight: Int): Ok,\n (* so"
& "me child of \"parent\" has just decreased in height from \"oldChHeight\""
& ",\n so update the height of the \"parent\" if necessary and those o"
& "f all\n nodes on the path to the root. *)\n if parent.height is "
& "(oldChHeight + 1) then\n var oldParHeight: Int = parent.height;\n "
& " parent.updateHeight();\n if (parent.height < oldParHeight) an"
& "d (parent.parent isnot ok) then\n parent.parent.decHeightToRoot("
& "oldParHeight)\n end\n end;\n ok\n end,\n\n removeChild => "
& "meth(parent, child: Node): Ok,\n (* removes child from parent, which m"
& "ust be its parent *)\n if child.prev isnot ok\n then child.prev"
& ".next := child.next;\n else parent.children := child.next\n end"
& ";\n if child.next isnot ok then\n child.next.prev := child.prev"
& "\n end;\n child.prev := ok;\n child.next := ok;\n parent.de"
& "cHeightToRoot(child.height);\n ok\n end,\n\n isRightOf => meth(sel"
& "f, n: Node): Bool,\n (* Returns \"true\" iff \"self\" is a right sibli"
& "ng of \"n\". *)\n var curr: Node = n.next;\n loop\n if (curr"
& " is self) or (curr is ok) then exit end;\n curr := curr.next\n "
& "end;\n (curr is self)\n end,\n\n subtreeWidth => meth(self: Node):"
& " Real,\n (* Returns the width of the subtree rooted at \"self\". *)\n "
& " if self.children is ok then\n NodeSz\n else\n var res: "
& "Real = 0.0;\n var ch: Node = self.children;\n loop\n r"
& "es := res + ch.subtreeWidth();\n if ch.next is ok then exit end;"
& "\n res := res + HGap;\n ch := ch.next\n end;\n "
& "res\n end\n end,\n\n position => meth(self: Node, level: Int, offs"
& "et: Real): Ok,\n let depth: Real = - float(level) * (NodeSz + VGap);"
& "\n graph_moveVertex(self.v, offset, depth, true);\n self.x := off"
& "set;\n ok\n end,\n\n ";
CONST E31_2 =
"positionChildren => meth(self: Node, level: Int, offset: Real): Real,\n"
& " var ch: Node = self.children;\n var res: Real = offset;\n loo"
& "p\n if ch is ok then exit; end;\n res := ch.positionSubtree(l"
& "evel, res);\n if ch.next isnot ok then res := res + HGap; end;\n "
& " ch := ch.next;\n end;\n res;\n end,\n\n positionSubtree => "
& "meth(self: Node, level: Int, offset: Real): Real,\n (* Reposition all "
& "nodes in the subtree rooted at \"self\", with the leftmost\n descen"
& "dant at \"offset\", and the root at vertical position \"level\".\n "
& "Returns the x-coordinate of the rightmost descendant. *)\n var res ="
& " offset;\n if self.children is ok\n then res := res + NodeSz;\n"
& " else res := self.positionChildren(level+1, res);\n end;\n s"
& "elf.position(level, (res + offset) / 2.0);\n res;\n end,\n};\n\n(* "
& "EdgeList Object ======================================================="
& "= *)\n\nlet EdgeList = {\n e: Edge => ok,\n next: EdgeList => ok,\n};"
& "\n\n(* View Object ===================================================="
& "======== *)\n\nlet view: View = {\n\n (* Data members ----------------"
& "----------------------------------------- *)\n\n graphvbt => graph_new"
& "(),\n graphW: Real => ok, (* the width of the graphvbt *)\n "
& "usesRanks: Bool => ok, (* \"usesRanks\" arg to \"Setup\" event *)"
& "\n nodeCnt: Int => ok, (* number of nodes (not counting root)"
& " *)\n height: Int => ok, (* height of window *)\n root: Nod"
& "e => ok,\n last: Node => ok,\n node: [Node] => ok, (* array "
& "of nodes *)\n newEdge: Edge => ok, (* Edge added during a unit"
& "e method *)\n bothRoots: Bool => ok, (* are both nodes to \"Unio"
& "n\" roots? *)\n upEdges: EdgeList => ok, (* list of \"StepUp\" edg"
& "es *)\n seenStepDown: Bool => ok, (* any \"StepDown\" events after "
& "\"Found\"? *)\n findVh: VertexHiLi => ok,\n unionVh1: VertexHiLi => o"
& "k,\n unionVh2: VertexHiLi => ok,\n foundVh: VertexHiLi => ok,\n firs"
& "tRootVh: VertexHiLi => ok,\n\n (* The \"height\" field is the height o"
& "f the largest tree";
CONST E31_3 =
" that can fit in the\n window; it is only ever increased. For \"vie"
& "w: View\", the system maintains\n the invariant: \"view.root.height"
& " <= view.height\". *)\n\n (* Layout method ---------------------------"
& "----------------------------- *)\n\n repositionAll => meth(self: View)"
& ": Ok,\n (* Layout all nodes of the tree rooted at the virtual root nod"
& "e\n \"self.root\". *)\n if self.root.children isnot ok then\n "
& " var childrenW: Real = 0.0;\n var numCh: Int = 0;\n var ch:"
& " Node = self.root.children;\n loop\n childrenW := childrenW"
& " + ch.subtreeWidth();\n numCh := numCh + 1;\n if ch.next "
& "is ok then exit end;\n ch := ch.next\n end;\n var gap:"
& " Real = 0.0;\n if numCh > 1 then\n gap := (self.graphW - ch"
& "ildrenW) / float(numCh - 1)\n end;\n ch := self.root.children"
& ";\n var res: Real = - (NodeSz / 2.0);\n loop\n \tif ch i"
& "s ok then exit end;\n \tres := ch.positionSubtree(0, res);\n "
& "\tif ch.next isnot ok then res := res + gap end;\n \tch := ch.next"
& "\n end\n end;\n ok\n end,\n\n repositionRanks => meth(self"
& ": View): Ok,\n (* Reposition the rank bar vertices of those nodes that"
& " are children of\n \"self.root\". This procedure just moves the nec"
& "essary vertices; it doesn\'t\n animate them. *)\n var ch = self."
& "root.children;\n loop\n if (ch is ok) then exit end;\n let"
& " rankX = graph_getVertexPosition(ch.rankBar)[0];\n if (ch.x isnot "
& "rankX) then\n graph_moveVertex(ch.rankBar, ch.x, RankY, true)\n "
& " end;\n ch := ch.next\n end;\n ok\n end,\n\n setWorld "
& "=> meth(self: View): Ok,\n let rad: Real = NodeSz / 2.0;\n let ht"
& ": Real = (float(self.height) * (NodeSz + VGap)) - VGap;\n var north:"
& " Real = rad;\n if self.usesRanks then north := north + RankGap + Ran"
& "kH end;\n graph_setWorld(self.graphvbt,\n (* east = *) - rad, ("
& "* west = *) (- rad) + self.graphW,\n (* north= *) north, (* south="
& " *) rad + (- ht));\n ok\n end,\n\n (* Setup ----------------------"
& "----------------";
CONST E31_4 =
"-------------------------- *)\n\n Setup => meth(self: View): Ok,\n "
& "graph_setMargin(self.graphvbt, Margin);\n self.nodeCnt := 0;\n se"
& "lf.root := clone(Node);\n self.last := ok;\n ok\n end,\n\n NewS"
& "et => meth(self: View, (*UNUSED*) nm: Text): Ok,\n let v = graph_new"
& "Vertex(self.graphvbt);\n graph_setVertexShape(v, \"ellipse\");\n "
& "graph_setVertexSize(v, NodeSz, NodeSz);\n graph_setVertexLabelColor("
& "v, NodeFgColor);\n graph_setVertexBorder(v, BorderWidth);\n graph"
& "_setVertexColor(v, NodeBgColor);\n var n: Node = clone(Node);\n s"
& "elf.nodeCnt := self.nodeCnt + 1;\n n.v := v;\n self.root.addChild"
& "(self.last, n);\n self.last := n;\n ok\n end,\n\n FinishedSets "
& "=> meth(self: View, numSets: Int, usesRanks: Bool): Ok,\n (* initial"
& "ize coordinate system *)\n self.height := real_ceiling(math_log(floa"
& "t(numSets))) + 1;\n self.graphW := (float(numSets) * (NodeSz + HGap)"
& ") - HGap;\n self.usesRanks := usesRanks;\n self.setWorld();\n\n "
& " (* initialize nodes *)\n self.node := array_new(numSets, ok);\n "
& " var curr: Node = self.root.children;\n for i = 0 to numSets - 1 do\n"
& " self.node[i] := curr;\n curr := curr.next\n end;\n sel"
& "f.repositionAll();\n\n (* initialize rank bars *)\n if usesRanks "
& "then\n for i = 0 to numSets - 1 do\n let node = self.node[i"
& "];\n let v = graph_newVertex(self.graphvbt);\n node.rankB"
& "ar := v;\n \tgraph_setVertexShape(v, \"rectangle\");\n \tgrap"
& "h_setVertexSize(v, RankW * 0.1, RankH);\n \tgraph_setVertexBorderC"
& "olor(v, RankBarFgColor);\n \tgraph_setVertexBorder(v, BorderWidth)"
& ";\n \tgraph_setVertexColor(v, RankBarBgColor);\n graph_move"
& "Vertex(v, node.x, RankY, false);\n end\n end;\n zeus_animate"
& "(self.graphvbt, 0.0, 0.0);\n ok\n end,\n\n (* Find events --------"
& "-------------------------------------------------- *)\n\n StartFind =>"
& " meth(self: View, id: Int): Ok,\n self.findVh := graph_newVertexHiLi"
& "(self.node[id].v);\n graph_setVertexHiLiColor(self.findVh, SelectHiL"
& "iColor);\n ";
CONST E31_5 =
" graph_setVertexHiLiBorder(self.findVh, SelectHiLiSz, SelectHiLiSz);\n "
& " graph_redisplay(self.graphvbt);\n ok\n end,\n\n EndFind => meth"
& "(self: View, id: Int): Ok,\n graph_removeVertexHiLi(self.findVh);\n "
& " graph_removeVertexHiLi(self.foundVh);\n graph_redisplay(self.grap"
& "hvbt);\n ok\n end,\n\n (* DoFind events --------------------------"
& "------------------------------ *)\n\n StartDoFind => meth(self, id): O"
& "k,\n ok\n end,\n\n StepUp => meth(self, child, parent): Ok,\n ("
& "* make edge thick *)\n let upEdge: Edge = self.node[child].e;\n g"
& "raph_setEdgeWidth(upEdge, FatEdgeWidth);\n\n (* add edge to up-edge "
& "list *)\n var el: EdgeList = clone(EdgeList);\n el.e := upEdge;\n"
& " el.next := self.upEdges;\n self.upEdges := el;\n ok\n end,\n"
& "\n Found => meth(self, root): Ok,\n self.foundVh := graph_newVertex"
& "HiLi(self.node[root].v);\n graph_setVertexHiLiColor(self.foundVh, Fo"
& "undHiLiColor);\n graph_setVertexHiLiBorder(self.foundVh, FoundHiLiSz"
& ", FoundHiLiSz);\n graph_redisplay(self.graphvbt);\n self.seenStep"
& "Down := false;\n ok\n end,\n\n StepDown => meth(self: View, childI"
& "d, parentId: Int): Ok,\n let child: Node = self.node[childId];\n "
& "self.seenStepDown := true;\n graph_setEdgeWidth(child.e, ThinEdgeWid"
& "th);\n ok\n end,\n\n ChangeParent => meth(self: View, childId, par"
& "entId, rootId: Int): Ok,\n let child: Node = self.node[childId];\n "
& " let parent: Node = self.node[parentId];\n let root: Node = self.no"
& "de[rootId];\n\n (* change tree structure *)\n var rightOf: Node ="
& " parent;\n if parent.children is child then rightOf := rightOf.prev "
& "end;\n parent.removeChild(child);\n root.addChild(rightOf, child)"
& ";\n\n (* move the edge and subtree *)\n graph_moveEdge(child.e, c"
& "hild.v, root.v, true);\n self.repositionAll();\n if self.usesRank"
& "s then self.repositionRanks() end;\n zeus_animate(self.graphvbt, 0.0"
& ", 1.0);\n ok\n end,\n\n EndDoFind => meth(self, id): Ok,\n if n"
& "ot(self.seenStepDown) then\n var curr: EdgeList = self.upEdges;\n "
& " loop\n";
CONST E31_6 =
" if curr is ok then exit end;\n graph_setEdgeWidth(curr.e"
& ", ThinEdgeWidth);\n curr := curr.next\n end\n end;\n "
& "graph_redisplay(self.graphvbt);\n ok\n end,\n\n (* Union events --"
& "------------------------------------------------------- *)\n\n StartUn"
& "ion => meth(self: View, id1, id2: Int, bothRoots: Bool): Ok,\n self."
& "bothRoots := bothRoots;\n self.unionVh1 := graph_newVertexHiLi(self."
& "node[id1].v);\n self.unionVh2 := graph_newVertexHiLi(self.node[id2]."
& "v);\n graph_setVertexHiLiColor(self.unionVh1, SelectHiLiColor);\n "
& " graph_setVertexHiLiColor(self.unionVh2, SelectHiLiColor);\n graph_s"
& "etVertexHiLiBorder(self.unionVh1, SelectHiLiSz, SelectHiLiSz);\n gra"
& "ph_setVertexHiLiBorder(self.unionVh2, SelectHiLiSz, SelectHiLiSz);\n "
& " graph_redisplay(self.graphvbt);\n self.newEdge := ok;\n ok\n en"
& "d,\n\n FoundFirst => meth(self: View, root1: Int): Ok,\n self.first"
& "RootVh := self.foundVh;\n ok\n end,\n\n CompareRanks => meth(self:"
& " View, id1, id2: Int): Ok,\n ok\n end,\n\n Unite => meth(self: Vie"
& "w, childId, parentId, pRank: Int): Ok,\n let child: Node = self.node"
& "[childId];\n let parent: Node = self.node[parentId];\n\n (* creat"
& "e and animate the new edge *)\n self.newEdge := graph_newEdge(child."
& "v, parent.v);\n child.e := self.newEdge;\n graph_setEdgeWidth(sel"
& "f.newEdge, FatEdgeWidth);\n graph_setEdgeColor(self.newEdge, HiliteE"
& "dgeColor);\n\n (* update the graph structure *)\n var rightOf: No"
& "de = ok;\n if child.isRightOf(parent)\n then rightOf := parent."
& "lastChild()\n else rightOf := ok\n end;\n self.root.removeCh"
& "ild(child);\n parent.addChild(rightOf, child);\n\n (* make coordi"
& "nate system larger if necessary *)\n if self.root.height > self.heig"
& "ht then\n self.height := self.root.height;\n self.setWorld();"
& "\n graph_redisplay(self.graphvbt)\n end;\n\n (* animate the "
& "subtree motion *)\n self.repositionAll();\n if self.usesRanks the"
& "n\n graph_removeVertex(child.rankBar);\n graph_setVertexSize("
& "pare";
CONST E31_7 =
"nt.rankBar, float(pRank) * RankW, RankH);\n self.repositionRanks()"
& "\n end;\n zeus_animate(self.graphvbt, 0.0, 1.0);\n ok\n end,\n"
& "\n EndUnion => meth(self): Ok,\n if self.newEdge isnot ok then\n "
& " graph_setEdgeWidth(self.newEdge, ThinEdgeWidth);\n graph_setEdg"
& "eColor(self.newEdge, NormalEdgeColor);\n end;\n graph_removeVerte"
& "xHiLi(self.unionVh1);\n graph_removeVertexHiLi(self.unionVh2);\n "
& "if not(self.bothRoots) then\n graph_removeVertexHiLi(self.foundVh)"
& ";\n graph_removeVertexHiLi(self.firstRootVh);\n end;\n graph"
& "_redisplay(self.graphvbt);\n ok\n end,\n};\n";
CONST E32 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n\n(Scale\n ("
& "HScale 1)\n (VScale 1)\n (Rim\n (Pen 10)\n (VBox\n (Radio\n"
& " %data\n (VBox\n Fill\n (Border\n "
& " (Pen 1)\n (VBox\n (Choice %random (Text \""
& "random\"))\n (Glue 2)\n (Text \"sample size\""
& ")\n (Glue 2)\n (HBox (Glue 2) (Numeric %N (Mi"
& "n 4) (Max 80) =16) (Glue 2))\n (Glue 2)))\n Fill\n"
& " (Glue 5)\n (Border\n (Pen 1)\n "
& " (VBox\n (Choice %selected =TRUE (Text \"selected\"))\n "
& " (Glue 5)\n (Radio\n %selectedsiz"
& "e\n (HBox\n (Glue 7)\n "
& " (Choice %selectedsmall =TRUE (Text \"small\"))\n (Cho"
& "ice %selectedlarge (Text \"large\"))))\n (Glue 2)))\n "
& " Fill)))))\n";
CONST E33 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n\n\nlet view = {\n graphvbt => graph_new"
& "(),\n\n myPlayer => ok,\n\n activePlayer => ok,\n\n makeNodeProc => "
& "proc (graphvbt, rawBoard)\n { objects => \n ( var res = [[(let v ="
& " graph_newVertex(graphvbt);\n graph_setVertexSize(v"
& ", 1.0, 1.0);\n graph_setVertexColor(v, color_rgb(1."
& "0, 1.0 , 1.0));\n graph_setVertexBorder(v, 0.125);\n"
& " graph_setVertexBorderColor(v, color_rgb(0.0, 0.0, "
& "0.0));\n v),\n 0.0,\n "
& " 0.0\n ]];\n for cellNum = 0 to 8 do\n "
& " if rawBoard[cellNum] isnot 2 then\n let piece = grap"
& "h_newVertex(graphvbt);\n graph_setVertexSize(piece, 0.25"
& ", 0.25);\n if rawBoard[cellNum] is 0 then\n "
& " graph_setVertexColor(piece, color_rgb(0.0, 1.0, 0.0));\n "
& " else\n graph_setVertexColor(piece, color_rgb(0"
& ".0, 0.0, 1.0));\n end;\n res := res @ [[p"
& "iece, float((cellNum/3)-1) * 0.25, \n "
& " float((cellNum % 3)-1) * 0.25]]\n end;\n end;\n "
& " res;\n ),\n Move => \n meth(self, Xbase, Ybase, animat"
& "e)\n foreach object in self.objects do\n graph_moveV"
& "ertex(object[0], Xbase + object[1], Ybase + object[2],\n "
& " animate);\n end;\n end,\n\n SetValue =>\n meth "
& "(self, newValue)\n graph_setVertexBorderColor( self.objects[0]["
& "0],\n color_hsv( ((float(newValue+10)) / 21.0) * 0.7, 1.0, "
& "1.0));\n end,\n }\n end,\n\n treeDisplayParams => ok,\n\n make"
& "TreeNode =>\n meth(self, dparams, initNode, NodeWidth, initX, initY"
& ", myKey, board)\n let newNode =\n {\n key => m";
CONST E33_0 =
"yKey,\n displayParameters => dparams,\n node => i"
& "nitNode(dparams.graphvbt, board),\n nodeWidth => NodeWidth,\n"
& " width => NodeWidth,\n leftx => initX,\n "
& " depth => 0,\n vertex => ( let v = graph_newVertex(dparams"
& ".graphvbt);\n graph_setVertexSize(v, 0.0, 0.0 );"
& "\n v ),\n children => [],\n "
& " childWidth => 0.0,\n parent => ok,\n\n xPos => "
& "initX + (NodeWidth / 2.0),\n yPos => initY,\n\n A"
& "ddChild =>\n meth(self, child)\n self.child"
& "ren := self.children @ [child];\n child.parent := self;\n"
& " child.depth := self.depth + 1;\n(*** WAS: child.y"
& "Pos := self.displayParameters.depth2Y()(self.depth+1);*)\n "
& " let d2Y = self.displayParameters.depth2Y;\n child.yPo"
& "s := d2Y(self.depth+1);\n if #(self.children) > 1 then\n"
& " self.childWidth := self.childWidth +\n "
& " self.displayParameters.spacer;\n end;\n "
& " child.SetLeftX(self.leftx + self.childWidth);\n se"
& "lf.childWidth := self.childWidth + child.width;\n let e "
& "= graph_newEdge(self.vertex, child.vertex);\n graph_setE"
& "dgeWidth(e, self.displayParameters.edgeWidth);\n if self"
& ".childWidth > self.nodeWidth then\n self.width := self"
& ".childWidth;\n if self.parent isnot ok then\n "
& " self.parent.ChildWidthChange(self);\n end;"
& "\n self.xPos := self.leftx + (self.width / 2.0);\n "
& " self.MoveMe();\n end; \n end,"
& "\n\n MoveMe =>\n meth(self)\n var"
& " reSizeWorld = false;\n if (self.xPos > self.displayParam"
& "eters.WorldE) then\n self.displayParameters.WorldE := "
& "\n self.displayParameters.WorldE + \n ";
CONST E33_1 =
" self.displayParameters.WorldStep;\n "
& " reSizeWorld := true;\n end;\n if (self.y"
& "Pos > self.displayParameters.WorldS) then\n self.displ"
& "ayParameters.WorldS := \n self.displayParameters.W"
& "orldS + \n self.displayParameters.WorldStep;\n "
& " reSizeWorld := true;\n end;\n "
& " if reSizeWorld then\n graph_setWorld(self.displayPara"
& "meters.graphvbt, 0.0, \n self.displayParameters.Wor"
& "ldE, 0.0, \n self.displayParameters.WorldS);\n "
& " graph_setAspect(self.displayParameters.graphvbt,\n "
& " self.displayParameters.WorldS /\n se"
& "lf.displayParameters.WorldE);\n graph_redisplay(self.d"
& "isplayParameters.graphvbt);\n end;\n graph_"
& "moveVertex(self.vertex, self.xPos, self.yPos, true);\n se"
& "lf.node.Move(self.xPos, self.yPos, true);\n end,\n\n "
& " SetLeftX =>\n meth(self, newLeftX)\n s"
& "elf.leftx := newLeftX;\n var childX = self.leftx;\n "
& " foreach child in self.children do\n child.Set"
& "LeftX(childX);\n childX := childX + child.width + \n "
& " self.displayParameters.spacer;\n end"
& ";\n self.xPos := self.leftx + (self.width / 2.0);\n "
& " self.MoveMe()\n end,\n\n ChildWidthCha"
& "nge =>\n meth(self, guiltyChild)\n var chil"
& "dX = self.leftx;\n foreach child in self.children do\n "
& " if child.leftx isnot childX then\n "
& " child.SetLeftX(childX);\n end;\n "
& "childX := childX + child.width +\n self.displayPar"
& "ameters.spacer;\n end;\n self.childWidth "
& ":= childX - (self.leftx +\n self.displa";
CONST E33_2 =
"yParameters.spacer);\n if self.childWidth > self.nodeWid"
& "th then\n self.width := self.childWidth;\n "
& " if self.parent isnot ok then\n self.parent.C"
& "hildWidthChange(self);\n end;\n self."
& "xPos := self.leftx + (self.width / 2.0);\n self.MoveMe"
& "();\n end;\n end, \n "
& " };\n graph_moveVertex(newNode.vertex, newNode.xPos, newNo"
& "de.yPos, false);\n newNode.node.Move(newNode.xPos, newNode.yPos,"
& " false);\n graph_redisplay(self.graphvbt);\n newNode;\n "
& " end,\n\n lastBoard => ok,\n\n Init => \n meth (self, player)\n "
& " self.myPlayer := player;\n self;\n end,\n\n Setup =>\n "
& " meth (self)\n graph_setWorld(self.graphvbt, 0.0, 10.0, 0.0, 10.0)"
& ";\n graph_setAspect(self.graphvbt, 1.0);\n self.treeDisplayPa"
& "rams := { graphvbt => self.graphvbt,\n "
& " depth2Y => proc (depth)\n "
& " float((2*depth)+1)\n end,"
& "\n edgeWidth => 0.1,\n "
& " spacer => 0.25,\n Wo"
& "rldE => 10.0,\n WorldS => 10.0,\n "
& " WorldStep => 3.0};\n self.lastBoard :"
& "= ok;\n end,\n\n EvaluateNode =>\n meth (self, boardData)\n "
& " if self.activePlayer is self.myPlayer then\n var newNode = ok;\n"
& " if self.lastBoard is ok then\n newNode := self.makeTre"
& "eNode(self.treeDisplayParams, \n self.makeNodeProc, 1.0, 0.0,"
& " 1.0, boardData[0], boardData[1]);\n else\n var parent ="
& " self.lastBoard;\n newNode := self.makeTreeNode(self.treeDisp"
& "layParams, \n self.makeNodeProc, 1.0, self.lastBoard.xPos - "
& "0.5, \n self.lastBoard.yPos, boardData[0], boardData[1]);\n "
& " self.lastBoard.AddChild(newNode);\n end;\n sel";
CONST E33_3 =
"f.lastBoard := newNode;\n zeus_animate(self.graphvbt, 0.0, 1.0);\n"
& " end;\n end,\n\n PlayerThinking =>\n meth (self, player, bo"
& "ardData)\n self.activePlayer := player;\n if self.activePla"
& "yer is self.myPlayer then\n graph_clear(self.graphvbt);\n "
& " self.treeDisplayParams.WorldE := 10.0;\n self.treeDisplayPar"
& "ams.WorldS := 10.0;\n graph_setWorld(self.graphvbt, 0.0, 10.0, "
& "0.0, 10.0);\n graph_setAspect(self.graphvbt, 1.0);\n se"
& "lf.lastBoard := ok;\n end;\n end,\n\n FinishedEvalNode =>\n "
& " meth (self, boardkey)\n if self.activePlayer is self.myPlayer"
& " then\n self.lastBoard := self.lastBoard.parent;\n end;\n"
& " end,\n\n BoardValueUpdated =>\n meth (self, boardkey, newVal"
& "ue)\n if self.activePlayer is self.myPlayer then\n self.l"
& "astBoard.node.SetValue(newValue);\n graph_redisplay(self.graphv"
& "bt);\n end;\n end,\n\n }.Init(1);\n";
CONST E34 =
"Source 100 50\nV11 100 150\nV12 100 250\nV13 100 350\nV14 100 450\nV15 "
& "100 550\nV16 100 650\nV17 100 750\nV18 100 850\nV19 100 950\nV20 200 50"
& "\nV21 200 150\nV22 200 250\nV23 200 350\nV24 200 450\nV25 200 550\nV26 "
& "200 650\nV27 200 750\nV28 200 850\nV29 200 950\nV30 300 50\nV31 300 150"
& "\nV32 300 250\nV33 300 350\nV34 300 450\nV35 300 550\nV36 300 650\nV37 "
& "300 750\nV38 300 850\nV39 300 950\nV40 400 50\nV41 400 150\nV42 400 250"
& "\nV43 400 350\nV44 400 450\nV45 400 550\nV46 400 650\nV47 400 750\nV48 "
& "400 850\nV49 400 950\nV50 500 50\nV51 500 150\nV52 500 250\nV53 500 350"
& "\nV54 500 450\nV55 500 550\nV56 500 650\nV57 500 750\nV58 500 850\nV59 "
& "500 950\nV60 600 50\nV61 600 150\nV62 600 250\nV63 600 350\nV64 600 450"
& "\nV65 600 550\nV66 600 650\nV67 600 750\nV68 600 850\nV69 600 950\nV70 "
& "700 50\nV71 700 150\nV72 700 250\nV73 700 350\nV74 700 450\nV75 700 550"
& "\nV76 700 650\nV77 700 750\nV78 700 850\nV79 700 950\nV80 800 50\nV81 8"
& "00 150\nV82 800 250\nV83 800 350\nV84 800 450\nV85 800 550\nV86 800 650"
& "\nV87 800 750\nV88 800 850\nV89 800 950\nV90 900 50\nV91 900 150\nV92 9"
& "00 250\nV93 900 350\nV94 900 450\nV95 900 550\nV96 900 650\nV97 900 750"
& "\nV98 900 850\nSink 900 950\n.\n";
CONST E35 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* A"
& "ll rights reserved. *)\n(* See t"
& "he file COPYRIGHT for a full description. *)\n\nMODULE Hul"
& "lAlgs;\n\nTYPE Point = RECORD x, y: INTEGER END;\n\nVAR p: REF ARRAY OF"
& " Point;\n N: INTEGER;\n(* The input points are p[1] through p[N], wh"
& "ere N >= 1. \n We are allowed to use p[0] to hold a sentinel.\n\n "
& "Our task is to compute M, the number of vertices of the convex \n hul"
& "l, and to permute the array p[1..N] to make p[1..M] be the hull \n ve"
& "rtices in counterclockwise order, starting somewhere. \n\n The input "
& "may include pairs of coincident points and triples of \n collinear po"
& "ints. Of two points that coincide, at most one is \n a hull vertex. "
& " Of three distinct, collinear points, the middle \n one is never a hu"
& "ll vertex. \n \n If the input points all coincide, M is 1. If the "
& "input points \n are all collinear but do not all coincide, M is 2. *)"
& " \n\nTYPE AB = {Above, Below, Left, Right, On};\n\nPROCEDURE TestAB"
& "(old, new: Point): AB =\n(* Classify the point \"new\" with respect to "
& "a horizontal line\n through the point \"old\". *)\n BEGIN\n IF "
& " new.y < old.y THEN RETURN AB.Below\n ELSIF new.y > old.y THEN RETUR"
& "N AB.Above\n ELSIF new.x < old.x THEN RETURN AB.Left\n ELSIF new."
& "x > old.x THEN RETURN AB.Right\n ELSE RETURN AB.On\n END;\n END "
& "TestAB;\n\n (* The three points: "
& " *)\nTYPE LR = {Left, Right, (* form a triangle. "
& " *)\n Back, Shaft, Front, (* collinear, but distinct. *)"
& " \n Tail, Head, DegenOff, (* 2 coincide, but not all 3. *)\n"
& " DegenOn}; (* all 3 points coincide. *)\n\nP"
& "ROCEDURE TestLR(tail, head, new: Point): LR =\n(* Compute the relative "
& "orientation of a triple of points, from among \n the nine possibiliti"
& "es. In the seven cases where \"tail\" and \"head\" \n do not coincid"
& "e, we classify \"new\" with respect to a vector from \n \"tail\" to \""
& "he";
CONST E35_0 =
"ad\". In the remaining two cases, we merely check \n whether or not "
& "\"new\" coincides with the common value of \"head\" \n and \"tail\". "
& "*) \n VAR area: INTEGER := (head.x - tail.x) * (new.y - tail.y)\n "
& " - (head.y - tail.y) * (new.x - tail.x);\n (* T"
& "he signed area of the parallelogram spanned by the vectors \n f"
& "rom \"tail\" to \"head\" and from \"tail\" to \"new\"; you can \n "
& " think of it either as a 3-by-3 determinant or as the norm \n "
& " of a vector cross product. *) \n BEGIN\n IF area > 0 THEN RETU"
& "RN LR.Left\n ELSIF area < 0 THEN RETURN LR.Right\n ELSE\n VA"
& "R (* The following are Manhattan distances. *)\n distTailHead: I"
& "NTEGER:=ABS(head.x - tail.x) + ABS(head.y - tail.y);\n distTailN"
& "ew: INTEGER := ABS(new.x - tail.x) + ABS(new.y - tail.y);\n dist"
& "HeadNew: INTEGER := ABS(new.x - head.x) + ABS(new.y - head.y);\n "
& " max: INTEGER := MAX(MAX(distTailHead, distTailNew), distHeadNew);\n "
& " BEGIN\n IF max = 0 THEN RETURN LR.DegenOn\n "
& " ELSIF distTailHead = 0 THEN RETURN LR.DegenOff\n ELSIF dis"
& "tTailNew = 0 THEN RETURN LR.Tail\n ELSIF distHeadNew = 0 T"
& "HEN RETURN LR.Head\n ELSIF max = distTailHead THEN RETURN LR.Sha"
& "ft\n ELSIF max = distTailNew THEN RETURN LR.Front\n ELSI"
& "F max = distHeadNew THEN RETURN LR.Back\n END;\n END;\n "
& " END;\n END TestLR;\n\nPROCEDURE Swap(VAR p, q: Point) =\n VAR t: Poi"
& "nt; BEGIN t := p; p := q; q := t END Swap;\n \n@PackageWrap\nPROC Wrap"
& "(p: REF ARRAY[1..N] OF Point): INT@ =\nVAR grn: INT; BEGIN\n @1 grn :="
& " 1;@\n @2 FOR blu := 2 TO N DO@\n @3 CASE TestAB(p[grn], p[blu]) OF"
& "@\n | @4 AB.Below@, @5 AB.Right@ => @6 grn := blu@\n | @7 AB.Abov"
& "e@, @8 AB.Left@, @9 AB.On@ => \n END;\n @99 END; (* p[grn] is right"
& "most of lowest. *)@\n @10 FOR purp := 1 TO N DO@\n @11 Swap(p[grn],"
& " p[purp]);@\n @98 (* p[1..purp] is prefix of the hull. *)@\n @12 "
& "grn := 1;@\n @13 FOR blu := purp + 1 TO N DO@\n @14 CASE TestLR"
& "(p[pu";
CONST E35_1 =
"rp], p[grn], p[blu]) OF@\n | @15 Right@, @16 Front@, @17 DegenOff@"
& " => @18 grn := blu@\n | @19 Left@, @20 Tail@, @21 Shaft@, @22 Head"
& "@, @23 DegenOn@ => \n END;\n @97 END; (* p[grn] is furthest clo"
& "ckwise. *)@\n @24 IF grn = 1@ THEN @25 RETURN purp@ END;\n END;\n "
& "@26 RETURN 0;@\n@27 END Wrap;@\n@PackageWrap\n\nPROCEDURE LessEq(s, t: "
& "Point): BOOLEAN =\n(* Using polar coordinates centered at p[0], the poi"
& "nt \"s\" is less \n than or equal to the point \"t\" when either \n "
& " theta(s) < theta(t) or \n theta(s) = theta(t) and r(s) <="
& " r(t).\n By fiat, the point p[0], which has r(p[0]) = 0 and theta(p[0"
& "]) \n undefined, is less than any other point. \n\n Every point q "
& " passed to this procedure with theta(q) defined,\n that is, with r"
& "(q) > 0, will satisfy\n 0 <= theta(q) < 180,\n and the followin"
& "g implementation depends on that. *)\n BEGIN\n CASE TestLR(p[0], s"
& ", t) OF\n | LR.Left, LR.Front, LR.Head => RETURN TRUE\n | LR.Rig"
& "ht, LR.Shaft, LR.Tail => RETURN FALSE\n | LR.DegenOn, LR.DegenOff "
& " => RETURN TRUE\n END; (* LR.Back can\'t happen. *)\n END LessEq;\n"
& "\n@GrahamScan\nPROCEDURE GrahamScan(): INTEGER@ =\n VAR min, M: INTEGE"
& "R;\n BEGIN\n @1 min := 1;@\n @2 FOR i := 2 TO N DO@\n @3 CA"
& "SE TestAB(p[min], p[i]) OF@\n | @4 AB.Below@, @5 AB.Left@ "
& "=> @6 min := i@\n | @7 AB.Above@, @8 AB.Right@, @9 AB.On@ => \n "
& " END;\n END;\n @10 p[0] := p[min];@ (* p[0] is a copy of the le"
& "ftmost of the lowest. *)\n @11 Sort();@\n (* The segment p[1..N] "
& "consists of one or more copies of p[0] \n followed by all points "
& "distinct from p[0], sorted by theta \n from p[0] and, for equal t"
& "heta, sorted by r. *) \n @12 M := 1;@\n @13 FOR i := 2 TO N DO@\n"
& " @14 LOOP@ \n @15 CASE TestLR(p[M-1], p[M], p[i]) OF@\n "
& " | @16 LR.Right@ => @17 DEC(M);@\n | @18"
& " LR.Left@, @19 LR.DegenOff@ => @20 EXIT;@\n | @21 LR.Fr"
& "ont@, @22 LR.Head@, @23 LR.DegenOn@ => @24 DEC(M);@ @25 EXIT;@\n ";
CONST E35_2 =
" END; (* LR.Back, LR.Tail, and LR.Shaft can\'t happen; LR.DegenOn *)"
& "\n END; (* and LR.DegenOff happen only at the start, when M = 1."
& " *)\n @26 INC(M);@ @27 Swap(p[i], p[M]);@\n (* p[1..M] is "
& "the convex hull of p[1..i]. *)\n END;\n @28 RETURN M;@\n END Gra"
& "hamScan;\n@GrahamScan\n\nPROCEDURE Sort() =\n(* Sort the array p[1..N] "
& "into \"LessEq\" order. This implementation\n uses ShellSort. *)\n V"
& "AR h: INTEGER := 1; j: INTEGER; v: Point;\n BEGIN\n REPEAT h := 3"
& " * h + 1 UNTIL h > N;\n REPEAT\n h := h DIV 3;\n FOR i := "
& "h + 1 TO N DO\n v := p[i]; j := i;\n WHILE j - h >= 1 AN"
& "D NOT LessEq(p[j - h], v) DO\n p[j] := p[j - h]; DEC(j, h);\n"
& " END;\n p[j] := v;\n END;\n UNTIL h = 1;\n END S"
& "ort;\n\nBEGIN\nEND HullAlgs.\n";
CONST E36 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* All rights "
& "reserved. *)\n(* See the file COPYRIGHT fo"
& "r a full description. *)\n\nlet view = { \n\tgraphvbt => graph_new()"
& ",\n\tfont => ok,\n\tbinWidth => ok,\n nBins => ok,\n\tcurrWt => "
& "ok,\n\tcurrVertex => ok,\n\n \tSetup => meth (self, nBins, nWts)\n\t "
& "graph_setWorld(self.graphvbt, \n\t ~2.0, float(nBins), 1.0, 0.0);\n"
& "\t graph_setMargin(self.graphvbt, 2.0);\n\t if (self.font is ok) th"
& "en\n\t self.font := graph_newFont (self.graphvbt, \n\t \"Hel"
& "vetica\", 0.5, \"Roman\", \"Bold\", \"*\") end;\n\t end,\n\n\tNewWeig"
& "ht => meth (self, id, wt) \n\t let v = graph_newVertex (self.graphvbt"
& ");\n\t graph_setVertexSize(v, 1.0, wt);\n\t graph_moveVertex(v, ~1."
& "0, 0.5, false);\n\t graph_setVertexFont(v, self.font);\n\t graph_se"
& "tVertexBorder(v, 0.01);\n\t graph_setVertexLabel(v, fmt_int(id));\n\t"
& " graph_setVertexColor(v, color_rgb(0.5, 1.0, 0.5));\n\t graph_setVe"
& "rtexLabelColor(v, color_rgb(0.0, 0.0, 0.0));\n\t graph_redisplay(self"
& ".graphvbt);\n \t self.currVertex := v;\n\t self.currWt := wt;\n\t "
& " end,\n\n\tProbe => meth (self, id, wt) \n\t ok;\n\t end,\n\n\tPac"
& "k => meth (self, bin, total) \n\t let xpos = 0.5 + float(bin);\n\t "
& "let ypos = total - (float(self.currWt) / 2.0);\n\t graph_moveVertex(s"
& "elf.currVertex, xpos, ypos, true);\n\t graph_animate(self.graphvbt, 0"
& ".0, 1.0);\n\t end,\n};\n";
CONST E37 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Scale\n (HS"
& "cale 1)\n (VScale 1)\n (BgColor \"White\")\n (Rim\n (Pen 10)\n "
& " (HBox \n (VBox\n (Text (Color \"Red\") RightAlign \"y"
& ": \")\n (Text (Color \"Green\") RightAlign \"x: \")\n (Te"
& "xt (Color \"Blue\") RightAlign \"j: \"))\n (VBox\n (Text Ri"
& "ghtAlign %y \"\")\n (Text RightAlign %x \"\")\n (Text Rig"
& "htAlign %j \"\")))))\n";
CONST E38 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Bres"
& "enham.evt.\n;**********************************************************"
& "**********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - "
& "25 + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)"
& "\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue "
& "10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n ("
& "HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup ="
& "TRUE \"\")\n (Glue 10)\n (Shape ("
& "Width + 0) (Height + 0) \"Weight: \")\n (Shape (Widt"
& "h 80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shap"
& "e (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height "
& "+ 0) \n \"NewLine: Stop? \") \n "
& " (Boolean %stopAtNewLine =TRUE \"\")\n ("
& "Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight:"
& " \")\n (Shape (Width 80) (Numeric %waitAtNewLine =1 "
& "\n (Min 0) (Max 100)))))\n"
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBo";
CONST E38_0 =
"x Fill (Shape (Width + 0) (Height + 0) \n "
& " \"ErrorInit: Stop? \") \n (Boolean %stopAtErrorI"
& "nit =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtErrorInit =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0)"
& " (Height + 0) \n \"ShowPixel: Stop? \""
& ") \n (Boolean %stopAtShowPixel =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height +"
& " 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wait"
& "AtShowPixel =1 \n (Min 0)"
& " (Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0"
& ")\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"FindError: Stop? \") \n ("
& "Boolean %stopAtFindError =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtFindError =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height + 0) \n \""
& "ChangeError: Stop? \") \n (Boolean %stopAtChangeEr"
& "ror =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtChangeError =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + "
& "0) (Height + 0) \n \"CompareError: Sto"
& "p? \") \n (Boolean %stopAtCompareError =TRUE \"\")\n"
& " ";
CONST E38_1 =
" (Glue 10)\n (Shape (Width + 0) (Height +"
& " 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wait"
& "AtCompareError =1 \n (Min"
& " 0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16 "
& "+ 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"ShowNextPixel: Stop? \") \n "
& " (Boolean %stopAtShowNextPixel =TRUE \"\")\n (G"
& "lue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: "
& "\")\n (Shape (Width 80) (Numeric %waitAtShowNextPixe"
& "l =1 \n (Min 0) (Max 100)"
& "))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Move: Stop? \") \n (Boolean %stopAt"
& "Move =TRUE \"\")\n (Glue 10)\n (S"
& "hape (Width + 0) (Height + 0) \"Weight: \")\n (Shape"
& " (Width 80) (Numeric %waitAtMove =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n )\n"
& " (Glue 4)\n (VBox\n (Glue 5)\n "
& "(Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (Button %even"
& "tCounts\n (VBox\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewLine \"0\")))\n (Glue"
& " 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfErrorInit \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height"
& " 16 + 0) \n (Text %ctOfShowPixel \"0\""
& ")))\n (Glue 6)\n (HBox Fill (Shape (Width"
& " + 0) (";
CONST E38_2 =
"Height 16 + 0) \n (Text %ctOfFindError"
& " \"0\")))\n (Glue 6)\n (HBox Fill (Shape "
& "(Width + 0) (Height 16 + 0) \n (Text %"
& "ctOfChangeError \"0\")))\n (Glue 6)\n (HB"
& "ox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfCompareError \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfShowNextPixel \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 "
& "+ 0) \n (Text %ctOfMove \"0\")))\n "
& " (Glue 3))))\n Fill\n (Glue 4 + Inf)\n "
& " )\n )\n )\n )\n)\n";
CONST E39 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Scale\n (HS"
& "cale 1)\n (VScale 1)\n (Rim\n (Pen 10)\n (Shape\n (Width 4"
& "50 + Infinity)\n (VBox\n (HBox\n (HBox (Text \"i ="
& " \") (TextEdit ReadOnly (TurnMargin 0) %i))\n (HBox (Text \"j "
& "= \") (TextEdit ReadOnly (TurnMargin 0) %j)))\n (HBox\n "
& " (HBox (Text \"v = \") (TextEdit ReadOnly (TurnMargin 0) %v))\n "
& " (HBox (Text \"N = \") (TextEdit ReadOnly (TurnMargin 0) %N)))\n "
& " (HBox (Text \"a = \") (TextEdit ReadOnly (TurnMargin 0) %a))))))\n";
CONST E40 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Maxf"
& "low.evt.\n;************************************************************"
& "********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25"
& " + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"HighlightPath: Stop? \") \n "
& " (Boolean %stopAtHighlightPath =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0"
& ") \"Weight: \")\n (Shape (Width 80) (Numeric %waitAt"
& "HighlightPath =1 \n (Min "
& "0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16 +"
& " 0)\n ";
CONST E40_0 =
" (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"IncFlow: Stop? \") \n (Boolean"
& " %stopAtIncFlow =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtIncFlow =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)"
& "\n (Shape (Height 16 + 0)\n (HBox Fill (Shape ("
& "Width + 0) (Height + 0) \n \"DecFlow: "
& "Stop? \") \n (Boolean %stopAtDecFlow =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (He"
& "ight + 0) \"Weight: \")\n (Shape (Width 80) (Numeric"
& " %waitAtDecFlow =1 \n (Mi"
& "n 0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16"
& " + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"ShowEdge: Stop? \") \n "
& " (Boolean %stopAtShowEdge =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtShowEdge =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox F"
& "ill (Shape (Width + 0) (Height + 0) \n \""
& "RemoveHighlight: Stop? \") \n (Boolean %stopAtRemo"
& "veHighlight =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtRemoveHighlight =1 \n "
& " (Min 0) (Max 100)))))\n (Glu"
& "e 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height + 0) \n \"FinalRe"
& "sult: Stop? \") \n (Boolean %stopAtFinalResult =TR"
& "UE \"";
CONST E40_1 =
"\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtFinalResult =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n )\n "
& " (Glue 4)\n (VBox\n (Glue 5)\n (Shap"
& "e (Width + 0) (Height 16 + 0) \"Cts:\")\n (Button %eventCoun"
& "ts\n (VBox\n (Glue 6)\n (HBo"
& "x Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfHighlightPath \"0\")))\n (Glu"
& "e 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfIncFlow \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height "
& "16 + 0) \n (Text %ctOfDecFlow \"0\")))"
& "\n (Glue 6)\n (HBox Fill (Shape (Width + "
& "0) (Height 16 + 0) \n (Text %ctOfShowE"
& "dge \"0\")))\n (Glue 6)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height 16 + 0) \n (Tex"
& "t %ctOfRemoveHighlight \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfFinalResult \"0\")))\n (Glue 3"
& "))))\n Fill\n (Glue 4 + Inf)\n )\n )\n "
& " )\n )\n)\n";
CONST E41 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* All"
& " rights reserved. *)\n(* See the f"
& "ile COPYRIGHT for a full description. *)\n\n@Maxflow\nPROCED"
& "URE Maxflow =@\n\n BEGIN\n@1 WHILE there is an augmenting path DO @\n"
& "@2 p := FindPath (flowChange); @\n@3 currentVertex := source; @\n"
& "@4 WHILE p # NIL DO @\n@5 edge := List.Pop(p); @\n@6 IF e"
& "dge.from = currentVertex (* forward edge *) THEN @\n@7 edge.flow"
& " := edge.flow + flowChange; @\n@8 currentVertex := edge.to; @\n@"
& "9 ELSE (* back edge *) @\n@10 edge.flow := edge.flow - flowC"
& "hange; @\n@11 currentVertex := edge.from; @\n END;\n "
& "END;\n END;\n END Maxflow;\n\n\nPROCEDURE FindPath (VAR flowChange:"
& " REAL) : List.T ;\n\n(* returns a list of edges which when undirected f"
& "orm a \n path from the source to the sink. Every forward edge\n on "
& "this path has nonzero residual capacity \n (i.e. capacity > flow),\n "
& " and every back edge on this path has positive flow.\n Such a path i"
& "s called an augmenting path.\n flowChange :=\n minimun ( minimum"
& " residual capacity on forward edges,\n minimum flow on b"
& "ack edges )\n*)\n\n@Maxflow\n";
CONST E42 =
"#| Copyright 1993 Digital Equipment Corporation. "
& " |#\n#| Distributed only by permission. "
& " |#\n#| "
& " |#\n#| Last modified on Sat Jul 17 14:45:54 P"
& "DT 1993 by heydon |#\n#| "
& " |#\n#| Input form for the"
& " greedy packet-routing algorithm. |#\n\n(Rim (Pen"
& " 4)\n (Macro Field BOA (name)\n `(VBox\n (Shape (Height + 0) "
& "(Text LeftAlign ,name))\n (Glue 2)))\n (Macro NamedChoice BOA (l"
& "abel var (init FALSE))\n `(Choice %,var =,init CheckBox\n (Tex"
& "t LeftAlign ,label)))\n (Macro Value BOA (label var init (fill Fill) ("
& "min 1))\n `(HBox ,fill\n (Shape (Width + 0) (Text RightAlign "
& ",label))\n (Numeric %,var =,init (Min ,min))))\n (Macro Divider"
& " BOA ((g 4) (b 2))\n `(VBox (Glue ,g) (Bar ,b) (Glue ,g)))\n (Macro"
& " Bool BOA (label boolVar (init FALSE))\n `(Boolean %,boolVar =,init "
& "(Text LeftAlign ,label)))\n (VBox\n (VBox\n (Field \"Network T"
& "opology:\")\n (Radio %topology (VBox\n (HBox\n (Na"
& "medChoice \"Grid:\" grid TRUE) Fill\n (Value \"W =\" gWidth "
& "4)\n (Value \" H =\" gHeight 5 (Glue 0))\n )\n ("
& "HBox\n (NamedChoice \"Torus:\" torus FALSE)\n (Value "
& " \"W =\" tWidth 4)\n (Value \" H =\" tHeight 5 (Glue 0))\n "
& " )\n (HBox\n (NamedChoice \"Butterfly:\" butterfly "
& "FALSE)\n (Value \"Dimension =\" butDim 3)\n )\n "
& " (Glue 2)\n (HBox\n (NamedChoice \"From File:\" networ"
& "kFromFile FALSE)\n (HBox\n (Text RightAlign \"Name "
& "=\")\n (Frame Lowered (TypeIn ExpandOnDemand %networkFilenam"
& "e (BgColor \"White\")))\n )\n )\n )) \n )\n "
& "(Divider)\n (VBox\n (Field \"Queue Size:\")\n (HBox\n "
& " (Bool \"Bounded?\" bounded TRUE)\n (Value \"Maximum Size =\" "
& "maxQueueSize 3)\n )\n ";
CONST E42_0 =
" )\n (Divider)\n (VBox\n (Field \"Packet Sources:\")\n "
& "(Radio %pktSources (VBox\n (HBox\n (NamedChoice \"Rando"
& "m:\" randomSrc TRUE)\n (Value \"Total =\" pktsTotal 10)\n "
& " )\n (HBox\n (NamedChoice \"Constant:\" constantSrc)\n"
& " (Value \"Per Node =\" pktsPerNode 1)\n )\n (Glu"
& "e 2)\n (HBox\n (NamedChoice \"From File:\" pktsFromFile"
& ")\n (HBox\n (Text RightAlign \"Name =\")\n "
& " (Frame Lowered (TypeIn ExpandOnDemand %pktsFilename (BgColor \"White"
& "\")))\n )\n )\n ))\n )\n (Divider)\n (VBo"
& "x\n (Field \"Outgoing Tie Resolution Heuristic:\")\n (Radio %"
& "tieRes (VBox\n (NamedChoice \"First Match\" firstMatch TRUE)\n "
& " (NamedChoice \"Random\" randomMatch FALSE)\n ))\n )\n "
& "(Divider)\n (VBox\n (Field \"Contention Resolution Heuristic:\""
& ")\n (Radio %contentionRes (VBox\n (NamedChoice \"Furthest F"
& "irst\" furthestFirst TRUE)\n (NamedChoice \"Random\" randomFirst"
& ")\n ))\n )\n (Divider)\n (VBox\n (Field \"Random Num"
& "bers:\")\n (Bool \"Use Fixed Seed?\" fixed)\n )\n )\n)\n";
CONST E43 =
"; Copyright (C) 1994, Digital Equipment Corporation \n; All rights r"
& "eserved. \n; See the file COPYRIGHT for"
& " a full description. \n\n; provides for a single integer number w"
& "hose name is N \n\n(VBox\n (Macro Label BOA (text) `(Shape (Width 120)"
& " (Text RightAlign ,text)))\n (Macro Line BOA (label expr) `(HBox (Labe"
& "l ,label) ,expr Fill))\n (Glue 10)\n (Line \"Number of weights: \" (N"
& "umeric (Min 1) (Max 1000) %N =26))\n (Glue 10)\n (Line \"Number of bi"
& "ns: \" (Numeric (Min 1) (Max 100) %B =10))\n (Glue 10)\n (Filter %run"
& "timeOpts Dormant\n (Frame Chiseled\n (VBox\n (Glue 10)\n"
& " (Line\n \"Bin to empty: \"\n (Filter (Numeric"
& " (Min 0) (Max 1000) %toEmpty AllowEmpty)))\n (Glue 10)\n "
& "(Line\n \"Delete a weight: \"\n (Filter (Numeric (Min"
& " 0) (Max 1000) %toDelete AllowEmpty)))\n (Glue 10))))\n (Glue 1"
& "0))\n";
CONST E44 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Shor"
& "testPath.evt.\n;*******************************************************"
& "*************\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75"
& " - 25 + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n"
& " (VBox\n (Glue 6)\n (Shape (Height 16 + "
& "0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitatCodeEvents =1 "
& "\n (Min 0) (Max 100)))))\n"
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"NewVertex: Stop? \") \n (Boolean %stopAtN"
& "ewVertex =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n (S"
& "hape (Width 80) (Numeric %waitAtNewVertex =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width"
& " + 0) (Height + 0) \n \"NewEdge: Stop?"
& " \") \n (Boolean %stopAtNewEdge =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtNewEdge =1 \n (Min 0) "
& "(Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)"
& "\n ";
CONST E44_0 =
" (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"StartFind: Stop? \") \n (Boolea"
& "n %stopAtStartFind =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtStartFind =1 \n "
& " (Min 0) (Max 100)))))\n (Gl"
& "ue 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Sh"
& "ape (Width + 0) (Height + 0) \n \"Promot"
& "e: Stop? \") \n (Boolean %stopAtPromote =TRUE \"\""
& ")\n (Glue 10)\n (Shape (Width + 0"
& ") (Height + 0) \"Weight: \")\n (Shape (Width 80) (Nu"
& "meric %waitAtPromote =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heig"
& "ht 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n"
& " \"Consider: Stop? \") \n "
& " (Boolean %stopAtConsider =TRUE \"\")\n (Glue "
& "10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtConsider =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Traceback: Stop? \") \n (Boolean %stopAtTrace"
& "back =TRUE \"\")\n (Glue 10)\n (S"
& "hape (Width + 0) (Height + 0) \"Weight: \")\n (Shape"
& " (Width 80) (Numeric %waitAtTraceback =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " )\n (Glue 4)\n (VBox\n (Glue 5)\n "
& " (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (Button"
& " %eventCounts\n (VBox\n (Glue 6)\n "
& " (H";
CONST E44_1 =
"Box Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewVertex \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewEdge \"0\")))\n (Glu"
& "e 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfStartFind \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Heigh"
& "t 16 + 0) \n (Text %ctOfPromote \"0\")"
& "))\n (Glue 6)\n (HBox Fill (Shape (Width "
& "+ 0) (Height 16 + 0) \n (Text %ctOfCon"
& "sider \"0\")))\n (Glue 6)\n (HBox Fill (S"
& "hape (Width + 0) (Height 16 + 0) \n (T"
& "ext %ctOfTraceback \"0\")))\n (Glue 3))))\n Fil"
& "l\n (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E45 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file DGra"
& "ph.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 "
& "+ Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)"
& "\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =TR"
& "UE \"\")\n (Glue 10)\n (Shape (Wi"
& "dth + 0) (Height + 0) \"Weight: \")\n (Shape (Width "
& "80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape "
& "(Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + "
& "0) \n \"AddEdge: Stop? \") \n "
& " (Boolean %stopAtAddEdge =TRUE \"\")\n (Gl"
& "ue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtAddEdge =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n ("
& "HBox F";
CONST E45_0 =
"ill (Shape (Width + 0) (Height + 0) \n \""
& "MarkEdge: Stop? \") \n (Boolean %stopAtMarkEdge =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtMarkEdge =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Sh"
& "ape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Heigh"
& "t + 0) \n \"UnMarkEdge: Stop? \") \n "
& " (Boolean %stopAtUnMarkEdge =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \""
& "Weight: \")\n (Shape (Width 80) (Numeric %waitAtUnMa"
& "rkEdge =1 \n (Min 0) (Max"
& " 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"MarkVertex: Stop? \") \n (Bool"
& "ean %stopAtMarkVertex =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtMarkVertex =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fill"
& " (Shape (Width + 0) (Height + 0) \n \"Un"
& "MarkVertex: Stop? \") \n (Boolean %stopAtUnMarkVer"
& "tex =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtUnMarkVertex =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width +"
& " 0) (Height + 0) \n \"NewTree: Stop? \""
& ") \n (Boolean %stopAtNewTree =TRUE \"\")\n "
& " ";
CONST E45_1 =
" (Glue 10)\n (Shape (Width + 0) (Height + 0) \"W"
& "eight: \")\n (Shape (Width 80) (Numeric %waitAtNewTr"
& "ee =1 \n (Min 0) (Max 100"
& ")))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Highlight: Stop? \") \n (Boolean %"
& "stopAtHighlight =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtHighlight =1 \n "
& " (Min 0) (Max 100)))))\n (Glue "
& "6)\n (Shape (Height 16 + 0)\n (HBox Fill (Shape"
& " (Width + 0) (Height + 0) \n \"AddChild:"
& " Stop? \") \n (Boolean %stopAtAddChild =TRUE \"\")"
& "\n (Glue 10)\n (Shape (Width + 0)"
& " (Height + 0) \"Weight: \")\n (Shape (Width 80) (Num"
& "eric %waitAtAddChild =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heig"
& "ht 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n"
& " \"RemoveChild: Stop? \") \n "
& " (Boolean %stopAtRemoveChild =TRUE \"\")\n "
& "(Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight"
& ": \")\n (Shape (Width 80) (Numeric %waitAtRemoveChil"
& "d =1 \n (Min 0) (Max 100)"
& "))))\n (Glue 6)\n )\n (Glue 4)\n "
& "(VBox\n (Glue 5)\n (Shape (Width + 0) (Height 16 "
& "+ 0) \"Cts:\")\n (Button %eventCounts\n (VBox\n"
& " (Glue 6)\n (HBox Fill (Shape (Width + 0)"
& " (Height 16 + 0) \n (Text %ctOfSetup \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + 0";
CONST E45_2 =
") (Height 16 + 0) \n (Text %ctOfAddEdg"
& "e \"0\")))\n (Glue 6)\n (HBox Fill (Shape"
& " (Width + 0) (Height 16 + 0) \n (Text "
& "%ctOfMarkEdge \"0\")))\n (Glue 6)\n (HBox"
& " Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfUnMarkEdge \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfMarkVertex \"0\")))\n (Gl"
& "ue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfUnMarkVertex \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (H"
& "eight 16 + 0) \n (Text %ctOfNewTree \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + 0) (Height 16 + 0) \n (Text %ctO"
& "fHighlight \"0\")))\n (Glue 6)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfAddChild \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfRemoveChild \"0\")))\n (Glue 3"
& "))))\n Fill\n (Glue 4 + Inf)\n )\n )\n "
& " )\n )\n)\n";
CONST E46 =
"(* Copyright (C) 1994, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* NodeDepth.obl - view of node"
& " depths. *)\n(* Last modified on M"
& "on Jan 9 12:04:28 PST 1995 by najork *)\n(* mod"
& "ified on Fri Aug 19 16:17:40 PDT 1994 by heydon *)\n("
& "* modified on Thu Jul 28 10:50:11 PDT 1994 by shillner "
& " *)\n\n(* Screen dimensions. *)\nlet North: Real = 1.0;\nlet South:"
& " Real = 0.0;\nlet West: Real = 0.0;\nlet East: Real = 1.0;\nlet Margin:"
& " Real = 5.0;\n\n(* Caption stuff. *)\nlet CaptionHeight = 0.1;\nlet B"
& "ackgroundColor = color_named(\"white\");\nlet FontSz = 0.07;\n"
& "\n(* Bar settings. *)\nlet BarColor = color_named(\"magenta\");\nlet"
& " BorderColor = color_named(\"black\");\nlet BorderWidth = 0.005;\nlet T"
& "extColor = color_named(\"black\");\nlet BarGap = 0.02;\nlet Axis"
& "LabelHeight = 0.1;\nvar g = ok;\nvar labelFont = ok;\n\n(* Node Object "
& "============================================================= *)\n\nlet"
& " Node = {\n parent: Node => ok,\n children: Node => ok,\n next: Node"
& " => ok, (* Siblings. *)\n prev: Node => ok,\n\n (* Adds child as"
& " a child of parent, inserted to the right of \n the child \"rightOf"
& "\", which must be a child of parent, or as\n the leftmost child if "
& "rightOf is ok *)\n addChild => meth(parent, rightOf, child: Node)\n "
& " if rightOf is ok then\n child.next := parent.children;\n chi"
& "ld.prev := ok;\n if child.next isnot ok then child.next.prev := ch"
& "ild; end;\n parent.children := child;\n else\n child.prev "
& ":= rightOf;\n child.next := rightOf.next;\n if child.next isn"
& "ot ok then child.next.prev := child; end;\n rightOf.next := child;"
& "\n end;\n end,\n\n (* removes child from parent, which must be its"
& " parent";
CONST E46_0 =
" *)\n removeChild => meth(parent, child: Node)\n if child.prev isno"
& "t ok\n then child.prev.next := child.next;\n else parent.chil"
& "dren := child.next;\n end;\n if child.next isnot ok then child.ne"
& "xt.prev := child.prev; end;\n child.prev := ok;\n child.next := o"
& "k;\n end,\n\n walk => meth(node: Node, bar: Bar)\n bar.size := bar"
& ".size + 1.0;\n var ch = node.children;\n if bar.next is ok then\n"
& " bar.next := clone(bar).init(bar.col + 1);\n end;\n var acc "
& "= 0;\n var count = 0;\n loop\n if ch is ok then exit end;\n "
& " let res = ch.walk(bar.next);\n acc := acc + res.acc;\n c"
& "ount := count + res.count;\n ch := ch.next;\n end;\n {acc =>"
& " acc + bar.col, count => count + 1};\n end,\n\n};\n\n\n(* Bar Object ="
& "============================================================= *)\n\nlet"
& " Bar = {\n size: Float => ok,\n next: Bar => ok,\n col: Int => ok,\n"
& " v: Vertex => ok,\n axisLabel: Vertex => ok,\n\n init => meth(self: "
& "Bar, col: Int): Bar,\n self.size := 0.0;\n self.col := col;\n "
& "self.next := ok;\n if self.col >= 0 then\n self.v := graph_newV"
& "ertex(g);\n graph_setVertexColor(self.v, BarColor);\n graph_s"
& "etVertexBorderColor(self.v, BorderColor);\n graph_setVertexBorder("
& "self.v, BorderWidth);\n graph_setVertexSize(self.v, 1.0, 0.0);\n "
& " graph_setVertexLabelColor(self.v, TextColor);\n graph_setVerte"
& "xFont(self.v, labelFont);\n graph_moveVertex(self.v, float(self.co"
& "l), 0.0, true);\n\n self.axisLabel := graph_newVertex(g);\n g"
& "raph_setVertexColor(self.axisLabel, BackgroundColor);\n graph_setV"
& "ertexBorder(self.axisLabel, 0.0);\n graph_setVertexLabelColor(self"
& ".axisLabel, TextColor);\n graph_setVertexFont(self.axisLabel, labe"
& "lFont);\n end;\n self;\n end,\n\n clear => meth(self: Bar)\n "
& " self.size := 0.0;\n if self.next isnot ok then self.next.clear() en"
& "d;\n end,\n\n update => meth(self: Bar, maxHeight: Float, maxCols: In"
& "t,\n barGraph: BarGraph): ok,\n let height = if self"
& ".size > maxH";
CONST E46_1 =
"eight then self.size else maxHeight end;\n let cols = if self.size i"
& "snot 0.0 then self.col else maxCols end;\n\n if self.next isnot ok t"
& "hen self.next.update(height, cols, barGraph)\n else barGraph.barCoun"
& "ts(height, cols + 1) end;\n\n let shape = barGraph.barShape(math_sqr"
& "t(self.size), self.col);\n if shape.h > 0.0 then\n graph_setVer"
& "texSize(self.v, shape.w, shape.h);\n graph_moveVertex(self.v, shap"
& "e.x, shape.y, false);\n graph_setVertexLabel(self.v, fmt_int(round"
& "(self.size)));\n\n graph_setVertexSize(self.axisLabel, shape.w, Ax"
& "isLabelHeight);\n graph_moveVertex(self.axisLabel, shape.x, \n "
& " (shape.y - (0.5 * shape.h)) - (0.5 * AxisLabelHeight"
& "),\n false);\n graph_setVertexLabel(self.axi"
& "sLabel, fmt_int(self.col));\n else\n graph_setVertexSize(self.v"
& ", 0.0, 0.0);\n graph_setVertexSize(self.axisLabel, 0.0, 0.0);\n "
& " end;\n end,\n};\n\n(* BarGraph Object ==============================="
& "========================== *)\n\nlet BarGraph = {\n west: Float => ok,"
& "\n east: Float => ok,\n north: Float => ok,\n south: Float => ok,\n "
& " height: Float => ok,\n width: Float => ok,\n bar: Bar => ok,\n colW"
& "idth: Float => ok,\n unitHeight: Float => ok,\n baseCol: Float => ok,"
& "\n barWidth: Float => ok,\n\n init => meth(self: BarGraph, west, east"
& ", north, south: Float,\n bar: Bar): BarGraph,\n self.w"
& "est := west;\n self.east := east;\n self.north := north;\n sel"
& "f.south := south;\n self.height := north - south;\n self.width :="
& " east - west;\n self.bar := bar;\n self;\n end,\n\n barCounts ="
& "> meth(self: BarGraph, height: Float, cols: Int): ok,\n self.colWidt"
& "h := self.width / float(cols);\n self.unitHeight := (self.height - A"
& "xisLabelHeight) / math_sqrt(height);\n self.baseCol := self.west + ("
& "0.5 * self.colWidth);\n self.barWidth := self.colWidth - BarGap;\n "
& "end,\n\n barShape => meth(self: BarGraph, size: Float, col: Int): Shap"
& "e,\n var shape = {w => ok, h => ok, x => ok, y => ok};\n\n shape."
& "w ";
CONST E46_2 =
":= self.barWidth;\n shape.h := size * self.unitHeight;\n shape.x "
& ":= self.baseCol + (self.colWidth * float(col));\n shape.y := self.so"
& "uth + AxisLabelHeight + (0.5 * shape.h);\n shape;\n end,\n\n updat"
& "e => meth(self: BarGraph)\n self.bar.next.update(0.0, 0, self);\n e"
& "nd,\n \n};\n\n\n(* View Object ======================================="
& "====================== *)\n\nlet view = {\n\n graphvbt => graph_new(),"
& "\n counts => ok,\n numSets => 0,\n node => ok,\n root: Node => ok,\n"
& " bar: Bar => ok,\n barGraph: BarGraph => ok,\n height: Int => ok,\n "
& " width: Int => ok,\n caption: Vertex => ok,\n\n FinishedSets => meth("
& "self: View, numSets: Int, usesRanks: Bool)\n g := self.graphvbt; (*"
& " Must be done before Bar.init(). *)\n self.numSets := numSets;\n "
& "self.root := clone(Node);\n self.bar := clone(Bar).init(-1);\n se"
& "lf.barGraph := clone(BarGraph).init(West, East, North,\n "
& " South + CaptionHeight, self.bar);\n self."
& "node := array_new(numSets, ok);\n labelFont := graph_newFont(self.gr"
& "aphvbt, \"Helvetica\", FontSz,\n \"Roman\""
& ", \"bold\", \"*\");\n\n for i=0 to numSets-1 do\n var node = cl"
& "one(Node);\n self.root.addChild(ok, node);\n self.node[i] := "
& "node;\n end;\n\n graph_setWorld(self.graphvbt, West, East, North,"
& " South);\n graph_setMargin(self.graphvbt, Margin);\n self.caption"
& " := graph_newVertex(self.graphvbt);\n graph_moveVertex(self.caption,"
& " (West + East) / 2.0,\n South + (CaptionHeight / 2."
& "0), false);\n graph_setVertexSize(self.caption, East - West, Caption"
& "Height);\n graph_setVertexColor(self.caption, BackgroundColor);\n "
& " graph_setVertexFont(self.caption, labelFont);\n graph_setVertexLabe"
& "l(self.caption, \"\");\n graph_setVertexLabelColor(self.caption, Tex"
& "tColor);\n self.update();\n end,\n\n update => meth(self: View): o"
& "k,\n self.bar.clear();\n let res = self.root.walk(self.bar);\n "
& " let avg = float(res.acc + 1) / float(self.numSets);\n self.barGraph"
& ".update();\n ";
CONST E46_3 =
" graph_setVertexLabel(self.caption,\n \"Avera"
& "ge Node Depth: \" &\n text_replaceAll(\"d\", \""
& "0\",\n text_sub(fmt_real(avg),"
& " 0, 4)));\n graph_redisplay(self.graphvbt);\n end,\n\n ChangeParen"
& "t => meth(self: View, childId, parentId, rootId: Int)\n let parent ="
& " self.node[parentId];\n let child = self.node[childId];\n let roo"
& "t = self.node[rootId];\n \n parent.removeChild(child);\n root."
& "addChild(ok, child);\n\n self.update();\n ok;\n end,\n\n Unite "
& "=> meth(self: View, childId, parentId, pRank: Int)\n let parent = se"
& "lf.node[parentId];\n let child = self.node[childId];\n\n self.roo"
& "t.removeChild(child);\n parent.addChild(ok, child);\n\n self.upda"
& "te();\n ok;\n end,\n\n};\n";
CONST E47 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(VBox\n (Glu"
& "e 10)\n (Rim\n (Pen 10)\n (HBox\n (VBox (Shape (Width + 0)("
& "Height + 0) \"Input: \") Fill)\n (Border\n (Shape\n "
& " (Width 180) (Height 50)\n (TextEdit %input =\"zeus = able + "
& "baker * (cat + dog)\")))\n Fill))\n (Glue 10))\n";
CONST E48 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file ZPap"
& "er.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 "
& "+ Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)"
& "\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Init: Stop? \") \n (Boolean %stopAtInit =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtInit =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (He"
& "ight 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) "
& "\n \"Set: Stop? \") \n "
& " (Boolean %stopAtSet =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtSet =1 \n "
& " (Min 0) (Max 100)))))\n (Glu"
& "e 6)\n )\n (Glue 4)\n (VBox\n (Gl"
& "ue 5)\n ";
CONST E48_0 =
" (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (But"
& "ton %eventCounts\n (VBox\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfInit \"0\")))\n (Glue 6)"
& "\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSet \"0\")))\n ("
& "Glue 3))))\n Fill\n (Glue 4 + Inf)\n )\n "
& ")\n )\n )\n)\n";
CONST E49 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Eucl"
& "id.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 "
& "+ Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)"
& "\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"SetupTriangle: Stop? \") \n (Boolean %stopAtS"
& "etupTriangle =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtSetupTriangle =1 \n "
& " (Min 0) (Max 100)))))\n (Glue"
& " 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Shap"
& "e (Width + 0) (Height + 0) \n \"SetupSqu"
& "are: Stop? \") \n (Boolean %stopAtSetupSquare =TRU"
& "E \"\")\n (Glue 10)\n (Shape (Wid"
& "th + 0) (Height + 0) \"Weight: \")\n (Shape (Width 8"
& "0) (Numeric %waitAtSetupSquare =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (S"
& "hape (";
CONST E49_0 =
"Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0"
& ") \n \"LineAL: Stop? \") \n "
& " (Boolean %stopAtLineAL =TRUE \"\")\n (Glue "
& "10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtLineAL =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Triangle: Stop? \") \n (Boolean %stopAtTriangle"
& " =TRUE \"\")\n (Glue 10)\n (Shape"
& " (Width + 0) (Height + 0) \"Weight: \")\n (Shape (Wi"
& "dth 80) (Numeric %waitAtTriangle =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& "(Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (He"
& "ight + 0) \n \"Quad: Stop? \") \n "
& " (Boolean %stopAtQuad =TRUE \"\")\n (G"
& "lue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: "
& "\")\n (Shape (Width 80) (Numeric %waitAtQuad =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Shear: Stop? \") \n (Boolean %stopAtShear =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtShear =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"RotateTriangle: Stop? \") \n "
& " (Boolean %stopAtRotateTriangle =TRUE \"\")\n "
& " ";
CONST E49_1 =
" (Glue 10)\n (Shape (Width + 0) (Height + 0) \"We"
& "ight: \")\n (Shape (Width 80) (Numeric %waitAtRotate"
& "Triangle =1 \n (Min 0) (M"
& "ax 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"RotateLine: Stop? \") \n (Bo"
& "olean %stopAtRotateLine =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtRotateLine =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height + 0) \n \""
& "RotateAngle: Stop? \") \n (Boolean %stopAtRotateAn"
& "gle =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtRotateAngle =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + "
& "0) (Height + 0) \n \"HighlightLine: St"
& "op? \") \n (Boolean %stopAtHighlightLine =TRUE \"\")"
& "\n (Glue 10)\n (Shape (Width + 0)"
& " (Height + 0) \"Weight: \")\n (Shape (Width 80) (Num"
& "eric %waitAtHighlightLine =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape "
& "(Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + "
& "0) \n \"HighlightAngle: Stop? \") \n "
& " (Boolean %stopAtHighlightAngle =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + "
& "0) \"Weight: \")\n (Shape (Width 80) (Numeric %waitA"
& "tHigh";
CONST E49_2 =
"lightAngle =1 \n (Min 0) "
& "(Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)"
& "\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Remove: Stop? \") \n (Bool"
& "ean %stopAtRemove =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtRemove =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6"
& ")\n (Shape (Height 16 + 0)\n (HBox Fill (Shape "
& "(Width + 0) (Height + 0) \n \"Step: St"
& "op? \") \n (Boolean %stopAtStep =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtStep =1 \n (Min 0) (Ma"
& "x 100)))))\n (Glue 6)\n )\n (Glue 4)\n "
& " (VBox\n (Glue 5)\n (Shape (Width + 0) (Heig"
& "ht 16 + 0) \"Cts:\")\n (Button %eventCounts\n ("
& "VBox\n (Glue 6)\n (HBox Fill (Shape (Widt"
& "h + 0) (Height 16 + 0) \n (Text %ctOfS"
& "etupTriangle \"0\")))\n (Glue 6)\n (HBox "
& "Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetupSquare \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfLineAL \"0\")))\n (Glue 6"
& ")\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfTriangle \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16"
& " + 0) \n (Text %ctOfQuad \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (H"
& "eight 16 ";
CONST E49_3 =
"+ 0) \n (Text %ctOfShear \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (H"
& "eight 16 + 0) \n (Text %ctOfRotateTria"
& "ngle \"0\")))\n (Glue 6)\n (HBox Fill (Sh"
& "ape (Width + 0) (Height 16 + 0) \n (Te"
& "xt %ctOfRotateLine \"0\")))\n (Glue 6)\n "
& "(HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfRotateAngle \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfHighlightLine \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 1"
& "6 + 0) \n (Text %ctOfHighlightAngle \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + 0) (Height 16 + 0) \n (Text %ctO"
& "fRemove \"0\")))\n (Glue 6)\n (HBox Fill "
& "(Shape (Width + 0) (Height 16 + 0) \n "
& "(Text %ctOfStep \"0\")))\n (Glue 3))))\n Fill\n"
& " (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E50 =
"(* Copyright 1993 Digital Equipment Corporation. "
& " *)\n(* Distributed only by permission. "
& " *)\n(* "
& " *)\n(* Last modified on Sat Oct 23 17:53:45 P"
& "DT 1993 by heydon *)\n(* modified on Tue Jul 27 "
& "16:25:00 PDT 1993 by rsanchez *)\n\n(* This view shows "
& "the packets flowing along the edges. *)\n\nlet nodeColor = [color_named"
& "(\"yellow\"), color_named(\"red\")];\nlet edgeColor = [color_named(\"Bl"
& "ue\"), color_named(\"Orange\")];\nlet packetColor = [color_named(\"Very"
& "LightGreen\"), \n color_named(\"VeryDarkGreen\")];\nl"
& "et labelColor = color_named(\"Black\");\nlet packetDiscardColor = color"
& "_named(\"DarkRed\");\nlet borderColor = color_named(\"Black\");\nlet ba"
& "ckgroundColor = color_named(\"White\");\n\nlet normal = 0;\nlet congest"
& "ed = 1;\n\nlet one = 0;\nlet two = 0;\nlet twoplus = 1;\n\nlet edgeWidt"
& "h = 0.1;\nlet borderWidth = 0.1;\n\nlet invisibleCP = proc(g, pt)\n le"
& "t vtx = graph_newVertex(g);\n graph_setVertexSize(vtx, 0.0, 0.0);\n g"
& "raph_moveVertex(vtx, pt[0], pt[1], false);\n vtx\nend;\n\nlet abs = pr"
& "oc (r) if r < 0.0 then 0.0-r else r end end;\n\nlet MakeBezierPathProc "
& "= proc (cpp)\n let x000 = cpp[0][0], y000 = cpp[0][1],\n x001 = "
& "cpp[1][0], y001 = cpp[1][1],\n x011 = cpp[2][0], y011 = cpp[2][1"
& "],\n x111 = cpp[3][0], y111 = cpp[3][1];\n proc (t)\n let s ="
& " 1.0-t;\n let sss = s*s*s,\n sst = s*s*t*3.0,\n stt = "
& "s*t*t*3.0,\n ttt = t*t*t;\n [(sss*x000) + (sst*x001) + (stt*x"
& "011) + (ttt*x111),\n (sss*y000) + (sst*y001) + (stt*y011) + (ttt*y1"
& "11)]\n end;\nend;\n\nlet Interp = proc (t,a,b) let s = 1.0-t; (a*s)+(b"
& "*t) end;\n\nlet MoveOnCurvedEdge = proc (vtx, cpp)\n for i = 0 to 3 do"
& "\n let j = if i > 0 then i-1 else 0 end;\n let t = float(i)/3.0;\n"
& " graph_moveVertexOnPath(vtx, MakeBezierPathProc(\n [[Interp(t,c"
& "pp[0][0],cpp[0][0]),Interp(t,cpp[0][1],cpp[0][1])],\n [Interp(t,c"
& "pp[0][0],cpp[1][0]),";
CONST E50_0 =
"Interp(t,cpp[0][1],cpp[1][1])],\n [Interp(t,cpp[i][0],cpp[j][0]),"
& "Interp(t,cpp[i][1],cpp[j][1])],\n [Interp(t,cpp[i][0],cpp[i][0]),"
& "Interp(t,cpp[i][1],cpp[i][1])]]\n ));\n end;\nend;\n\n\nlet HashEnt"
& "ry =\n {\n key1 => ok,\n key2 => ok,\n value => ok,\n next => "
& "ok,\n };\n\nlet HashTable =\n {\n num => ok,\n size => ok,\n "
& " table => ok,\n\n curindex => ok,\n curentry => ok,\n\n creat"
& "e => meth(self, num)\n self.num := num;\n self.size := real_r"
& "ound(float(num)*math_log(float(num)));\n self.table := array_new(s"
& "elf.size, ok);\n self;\n end,\n\n getfirst => meth(self)\n "
& " self.curindex := 0;\n self.curentry := ok;\n loop\n "
& " if self.curindex is self.size then\n exit;\n else\n "
& " if self.table[self.curindex] isnot ok then\n self.cu"
& "rentry := self.table[self.curindex];\n exit;\n end;"
& "\n self.curindex := self.curindex + 1;\n end;\n en"
& "d;\n if self.curentry isnot ok then\n self.curentry.value;\n"
& " else\n ok;\n end;\n end,\n\n getnext => meth(se"
& "lf)\n if self.curentry isnot ok then\n self.curentry := sel"
& "f.curentry.next;\n loop\n if self.curentry isnot ok the"
& "n\n exit;\n else\n self.curindex := self"
& ".curindex + 1;\n if self.curindex < self.size then\n "
& " self.curentry := self.table[self.curindex];\n else\n "
& " exit;\n end;\n end;\n end;\n "
& " if self.curentry isnot ok then\n self.curentry.value;\n "
& " else\n ok;\n end;\n else\n ok;\n "
& "end;\n end,\n\n lookup => meth(self, key1, key2)\n let index"
& " = ((key1 * self.size) + key2) % self.num;\n if self.table[index] "
& "isnot ok then\n var entry = self.table[index];\n loop\n"
& " if (entry is ok) orif\n ((entry.key1 is key1) a"
& "nd (entry.key2 is key2)) then\n exit;\n else\n "
& " entry := entry.ne";
CONST E50_1 =
"xt;\n end;\n end;\n if entry isnot ok then\n "
& " entry.value;\n else\n ok;\n end;\n "
& " else\n ok;\n end;\n end,\n\n insert => meth(self"
& ", key1, key2, value)\n let index = ((key1 * self.size) + key2) % s"
& "elf.num;\n var newentry = clone(HashEntry);\n newentry.key1 :"
& "= key1;\n newentry.key2 := key2;\n newentry.value := value;\n"
& " newentry.next := ok;\n\n if self.table[index] isnot ok then\n"
& " var entry = self.table[index];\n loop\n if entr"
& "y.next is ok then\n entry.next := newentry;\n exi"
& "t;\n else\n entry := entry.next;\n end;\n "
& " end;\n else\n self.table[index] := newentry;\n "
& "end;\n end,\n };\n\nlet StraightEdge =\n {\n g => ok,\n e =>"
& " ok,\n v1 => ok,\n v2 => ok,\n\n create => meth (self, t, v1, "
& "v2)\n self.g := t.g;\n self.v1 := v1;\n self.v2 := v2;\n"
& " self.e := graph_newEdge(v1.v, v2.v);\n graph_moveEdge(self.e"
& ", v1.v, v2.v, false);\n graph_setEdgeColor(self.e, edgeColor[norma"
& "l]);\n self\n end,\n\n initialWidth => meth(self, size)\n "
& " graph_setEdgeWidth(self.e, size/10.0);\n end,\n\n movePktAlong"
& "Edge => meth(self, fromN, pkt)\n if fromN is self.v1.id then\n "
& " graph_moveVertex(pkt, self.v2.pos[0], self.v2.pos[1], true);\n "
& " else\n graph_moveVertex(pkt, self.v1.pos[0], self.v1.pos[1], tr"
& "ue);\n end;\n end,\n\n };\n\nlet CurvedEdge =\n {\n g => o"
& "k,\n e => ok,\n v1 => ok,\n v2 => ok,\n cvv12 => [[ok,ok],["
& "ok,ok],[ok,ok],[ok,ok]],\n cpp12 => [[ok,ok],[ok,ok],[ok,ok],[ok,ok]"
& "],\n cvv21 => [[ok,ok],[ok,ok],[ok,ok],[ok,ok]],\n cpp21 => [[ok,"
& "ok],[ok,ok],[ok,ok],[ok,ok]],\n\n create => meth (self, t, v1, v2, x"
& "1, y1, x2, y2)\n self.g := t.g;\n self.v1 := v1;\n self."
& "v2 := v2;\n let cpt1 = [x1, y1];\n let cpt2 = [x2, y2];\n "
& " self.cpp12 := [v1.pos, [x1,y1], [x2,y2], v2.pos];\n self.cpp21 :"
& "= [v2.pos, [x2,y2], [x1,y1";
CONST E50_2 =
"], v1.pos];\n var cpt1v = invisibleCP(self.g, [x1, y1]);\n va"
& "r cpt2v = invisibleCP(self.g, [x2, y2]);\n self.cvv12 := [v1.v, cp"
& "t1v, cpt2v, v2.v];\n self.cvv21 := [v2.v, cpt2v, cpt1v, v1.v];\n "
& " self.e := graph_newEdge(v1.v, v2.v);\n graph_moveEdgeBezier(se"
& "lf.e, v1.v, v2.v, cpt1v, cpt2v, false);\n graph_setEdgeColor(self."
& "e, edgeColor[normal]);\n self\n end,\n\n initialWidth => met"
& "h(self, size)\n graph_setEdgeWidth(self.e, size/10.0);\n end,\n"
& "\n movePktAlongEdge => meth(self, fromN, pkt)\n if fromN is sel"
& "f.v1.id then\n MoveOnCurvedEdge(pkt, self.cpp12);\n else\n "
& " MoveOnCurvedEdge(pkt, self.cpp21);\n end;\n ok\n en"
& "d,\n\n };\n\nlet Node =\n {\n g => ok,\n v => ok,\n qs => 0,"
& "\n id => ok,\n maxQS => ok,\n bounded => ok,\n pos => ok,\n"
& " vpkts => ok,\n pktsSize => ok,\n pktsPos => ok,\n\n pktOut"
& "Lst => [],\n pktInLst => [],\n\n incQS => meth(self)\n self."
& "qs := self.qs + 1;\n end,\n\n decQS => meth(self)\n self.qs "
& ":= self.qs - 1;\n end,\n\n updQS => meth(self, qs)\n self.q"
& "s := qs;\n end,\n\n getQS => meth(self) self.qs end,\n\n creat"
& "e => meth(self, t, id, x, y)\n self.g := t.g;\n self.id := id"
& ";\n self.maxQS := t.maxQS;\n self.bounded := t.bounded;\n "
& " self.pos := [x, y];\n self.v := graph_newVertex(self.g);\n "
& "graph_moveVertex(self.v, x, y, false); \n graph_setVertexShape(sel"
& "f.v, \"ellipse\");\n graph_setVertexColor(self.v, nodeColor[normal"
& "]); \n self\n end,\n\n initialSize => meth(self, size)\n "
& " graph_setVertexSize(self.v, size, size);\n graph_setVertexBorder"
& "(self.v, size/10.0);\n graph_setVertexBorderColor(self.v, borderCo"
& "lor);\n self.vpkts := graph_newVertex(self.g);\n self.pktsSiz"
& "e := size/3.0;\n self.pktsPos := [self.pos[0] - (size/9.0),\n\t\t "
& " self.pos[1] + (size/9.0)];\n graph_moveVertex( self.vpkts, s"
& "elf.pktsPos[0], \n self.pktsPos[1], false);\n "
& " graph_setVertexSize(s";
CONST E50_3 =
"elf.vpkts, 0.0, 0.0);\n graph_setVertexBorder(self.vpkts, self.pkt"
& "sSize/5.0);\n graph_setVertexBorderColor(self.vpkts, borderColor);"
& "\n end,\n\n updateNodeState => meth(self)\n if (self.qs is 0"
& ") or (self.qs is 1) then\n graph_setVertexColor(self.v, nodeColo"
& "r[normal]);\n\tgraph_setVertexSize(self.vpkts, 0.0, 0.0);\n else\n"
& " if (self.qs >= self.maxQS) and self.bounded then\n gra"
& "ph_setVertexColor(self.v, nodeColor[congested]);\n else\n "
& " graph_setVertexColor(self.v, nodeColor[normal]);\n end;\n "
& " graph_setVertexSize(self.vpkts, self.pktsSize, self.pktsSize);\n\ti"
& "f self.qs is 2 then\n\t graph_setVertexColor(self.vpkts, packetColor[t"
& "wo]);\n else\n\t graph_setVertexColor(self.vpkts, packetColor[t"
& "woplus]);\n end;\n end;\n end,\n\n pktOut => meth(sel"
& "f, pkt, edge)\n self.pktOutLst := self.pktOutLst @\n [{pk"
& "t => pkt, edge => edge}];\n end,\n\n pktIn => meth(self, pkt, edg"
& "e)\n self.pktInLst := self.pktInLst @\n [{pkt => pkt, edg"
& "e => edge}];\n end,\n };\n\nlet Packet =\n {\n g => ok,\n v "
& "=> ok,\n src => ok,\n dst => ok,\n pktPos => ok,\n discardF"
& "lag => false,\n\n create => meth(self, t, src, dst, name)\n sel"
& "f.g := t.g;\n self.src := src;\n self.dst := dst;\n self"
& ".v := graph_newVertex(self.g);\n self.pktPos := [t.node(src).pos[0"
& "],\n\t\t t.node(src).pos[1]];\n graph_moveVertex( self.v, sel"
& "f.pktPos[0], self.pktPos[1], false);\n graph_setVertexSize(self.v,"
& " t.nodeSize/3.0, t.nodeSize/3.0);\n graph_setVertexBorder(self.v, "
& "(t.nodeSize/3.0)/5.0);\n graph_setVertexBorderColor(self.v, border"
& "Color);\n graph_setVertexColor(self.v, packetColor[one]);\n "
& "t.node(src).incQS();\n self\n end,\n\n move => meth(self, t,"
& " fromN, toN)\n let edge = t.edge(fromN, toN);\n t.node(fromN)"
& ".pktOut(self, edge);\n t.node(toN).pktIn(self, edge);\n graph"
& "_vertexToFront(self.v);\n end,\n\n setDiscardReady => meth(self)\n"
& " graph_se";
CONST E50_4 =
"tVertexColor(self.v, packetDiscardColor);\n graph_vertexToFront(se"
& "lf.v);\n self.discardFlag := true\n end,\n\n discard => meth"
& "(self, vw)\n vw.node(self.dst).decQS();\n graph_removeVertex("
& "self.v);\n end,\n\n };\n\nlet view =\n {\n graphvbt => graph_ne"
& "w(),\n g => meth (self) self.graphvbt end,\n\n nodeCnt => ok,\n "
& " maxQS => ok,\n bounded => ok,\n\n nodeSize => 0.0,\n\n verte"
& "xFont => ok,\n\n nodeT => [],\n edgeT => [],\n pktT => [],\n\n"
& " node => meth(self, id)\n self.nodeT[id];\n end,\n\n edge"
& " => meth(self, id1, id2)\n var res = self.edgeT.lookup(id1, id2);\n"
& " if res is ok then\n res := self.edgeT.lookup(id2, id1);\n "
& " end;\n res\n end,\n\n packet => meth(self, id)\n s"
& "elf.pktT[id];\n end,\n\n StartGraph => meth (self, nodeCnt, maxQS"
& ", bounded, xMax, yMax)\n (* Set the World *)\n graph_setWorld"
& "(self.graphvbt, 0.0, xMax, yMax, 0.0);\n self.vertexFont := graph_"
& "newFont(\n self.graphvbt, \"Helvetica\", 0.5, \"Roman\", \"bold"
& "\", \"*\");\n\n (* Initialize some variables *)\n self.nodeCn"
& "t := nodeCnt;\n self.maxQS := maxQS;\n self.bounded := bounde"
& "d;\n self.nodeT := array_new(nodeCnt, ok);\n self.edgeT := Ha"
& "shTable.create(nodeCnt);\n end,\n \n NewNode => meth (self, id, x"
& ", y)\n self.nodeT[id] :=\n clone(Node).create(self, id, x"
& ", y);\n end,\n\n NewStraightEdge => meth (self, id1, id2)\n "
& "self.edgeT.insert(id1, id2,\n clone(StraightEdge"
& ").create( self,\n se"
& "lf.node(id1),\n self"
& ".node(id2)));\n end,\n\n\n NewCurvedEdge => meth (self, id1, id2,"
& " x1, y1, x2, y2)\n self.edgeT.insert(id1, id2,\n "
& " clone(CurvedEdge).create( self,\n "
& " self.node(id1),\n "
& " self.node(id2),\n "
& " x1, y1, x2, y2)";
CONST E50_5 =
");\n end,\n\n NewLabel => meth (self, label, x, y)\n let vl "
& "= graph_newVertex(self.graphvbt);\n graph_setVertexFont(vl, self.v"
& "ertexFont);\n graph_setVertexSize(vl, 0.5, 0.5);\n graph_setV"
& "ertexColor(vl, backgroundColor);\n graph_moveVertex(vl, x, y, fals"
& "e);\n graph_setVertexLabel(vl, label);\n graph_setVertexLabel"
& "Color(vl, labelColor);\n end,\n\n EndGraph => meth (self)\n "
& "let distance = proc(pt1, pt2)\n let dx = pt2[1] - pt1[1], dy = p"
& "t2[0] - pt1[0];\n (dx * dx) + (dy * dy)\n end;\n var m"
& "inDst = ok;\n if #(self.nodeT) > 1 then\n\tminDst := distance(self"
& ".nodeT[0].pos, self.nodeT[1].pos);\n\tfor i = 0 to #(self.nodeT) - 1 do"
& "\n\t let pos1 = self.nodeT[i].pos;\n\t for j = (i + 1) to #(self.node"
& "T) - 1 do\n\t let curDst = distance(pos1, self.nodeT[j].pos);\n\t "
& " if curDst < minDst then minDst := curDst end\n\t end\n\tend;\n\tminDs"
& "t := math_sqrt(minDst);\n else\n\tminDst := 1.0\n end;\n "
& " self.nodeSize := minDst/1.5;\n for i = 0 to #(self.nodeT) - 1 do\n"
& " self.nodeT[i].initialSize(self.nodeSize);\n end;\n va"
& "r edge = self.edgeT.getfirst();\n if edge isnot ok then\n e"
& "dge.initialWidth(self.nodeSize);\n loop\n edge := self."
& "edgeT.getnext();\n if edge is ok then\n exit;\n "
& " else\n edge.initialWidth(self.nodeSize);\n en"
& "d;\n end;\n end;\n end,\n\n StartPackets => meth (sel"
& "f, pktCnt)\n self.pktT := array_new(pktCnt, ok);\n end,\n\n "
& "NewPacket => meth (self, id, source, dest, fewestHops, name)\n sel"
& "f.pktT[id] :=\n clone(Packet).create(self, source, dest, name)"
& ";\n end,\n\n EndPackets => meth (self)\n for i = 0 to #(self"
& ".nodeT) - 1 do\n self.nodeT[i].updateNodeState();\n end;\n "
& " graph_redisplay(self.graphvbt);\n end,\n\n MovePacket => met"
& "h (self, id, fromN, toN)\n self.packet(id).move(self, fromN, toN);"
& "\n end,\n\n QueueSizes => meth (self, queueSizes)\n for i = "
& "0 to #(self.nodeT) - ";
CONST E50_6 =
"1 do\n self.nodeT[i].updQS(queueSizes[i]);\n if #(self.no"
& "deT[i].pktOutLst) isnot 0 then\n self.nodeT[i].updateNodeState"
& "();\n end;\n end;\n graph_redisplay(self.graphvbt);\n "
& " for i = 0 to #(self.nodeT) - 1 do\n for j = 0 to #(self.nod"
& "eT[i].pktOutLst) - 1 do\n self.nodeT[i].pktOutLst[j].edge.move"
& "PktAlongEdge(\n i, self.nodeT[i].pktOutLst[j].pkt.v);"
& "\n end;\n self.nodeT[i].pktOutLst := [];\n end;\n "
& " zeus_animate(self.graphvbt, 0.0, 1.0);\n end,\n\n Absorb => me"
& "th(self, pktID, nodeID)\n let pkt = self.packet(pktID);\n pkt"
& ".setDiscardReady();\n end,\n\n Step => meth(self)\n graph_re"
& "display(self.graphvbt);\n for i = 0 to #(self.nodeT) - 1 do\n "
& " let pktIns = self.nodeT[i].pktInLst;\n\tfor j = 0 to #(pktIns) - 1 d"
& "o\n let pkt = pktIns[j].pkt;\n\t if pkt.discardFlag is true t"
& "hen\n\t pkt.discard(self)\n end\n end;\n self"
& ".nodeT[i].updateNodeState();\n self.nodeT[i].pktInLst := [];\n "
& " end;\n graph_redisplay(self.graphvbt);\n end, \n\n };"
& "\n";
CONST E51 =
" (Vertex a 0.2 0.5)\n (Vertex b 0.5 0.8)\n (Vertex c 0.8 0.5) \n (V"
& "ertex d 0.2 0.2)\n (Vertex e 0.8 0.2) \n (Edge ba b a R)\n (Edge cb "
& "c b R)\n (Edge ac a c R)\n (Edge ad a d R)\n (Edge de d e R) \n (Ed"
& "ge ec e c R)\n (Edge dc d c R) \n (Find a e 2)\n";
CONST E52 =
"@DFSTC\nPROCEDURE DFSTC(a: ARRAY OF ARRAY OF BOOLEAN; V: INTEGER) @=\n "
& " VAR now: INTEGER := -1;\n val := NEW(REF ARRAY OF INTEGER, V);\n "
& " current: INTEGER;\n\n BEGIN\n @7 FOR k := 0 TO V-1 DO @\n @"
& "8 now := -1; current := k; @\n @9 FOR j := V-1 DO val[j] := -1 E"
& "ND; @\n @10 Visit(k) @\n END;\n END;\n END DFSTC;"
& "\n@DFSTC\n\n @VISIT\n PROCEDURE Visit(k: INTEGER) @=\n BEGIN\n "
& "@1 INC(now); val[k] := now;@\n @2 a[current, t] := TRUE; @\n @3 F"
& "OR t := 0 TO V-1 DO @\n @4 IF a[k, t] THEN @\n @5 IF val[t] <"
& " 0 THEN @\n @6 Visit(t); @\n END;\n END;\n "
& " END;\n END Visit;\n @VISIT\n\n";
CONST E53 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Binp"
& "ack.evt.\n;************************************************************"
& "********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4)"
& " (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glu"
& "e 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algori"
& "thm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus ev"
& "ents\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args t"
& "o events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height"
& " 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E54 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n\n(VBox \n ("
& "Macro TB BOA (text)\n `(Shape (Width 60) (Text RightAlign ,text)))\n"
& " (Glue 10)\n (HBox (TB \"N: \") (Numeric (Min 1) (Max 1000) %N =50) F"
& "ill)\n (Glue 10)\n (HBox (TB \"k: \") (Numeric (Min 1) (Max 1000) %k "
& "=5) Fill)\n (Glue 10))\n";
CONST E55 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Subt"
& "ype.evt.\n;************************************************************"
& "********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4)"
& " (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glu"
& "e 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algori"
& "thm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus ev"
& "ents\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args t"
& "o events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height"
& " 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E56 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Sear"
& "chTree.evt.\n;*********************************************************"
& "***********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue"
& " 4) (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n ("
& "Glue 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Alg"
& "orithm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus"
& " events\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display arg"
& "s to events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Hei"
& "ght 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E57 =
" TYPE\n Type = OBJECT END;\n TypeBot = Type BRANDED OBJECT END;\n"
& " TypeTop = Type BRANDED OBJECT END;\n TypeFun = Type BRANDED OBJE"
& "CT dom,rng: Type END;\n\n VAR \n trail: ARRAY [0..1000] OF RECORD l"
& "ft,rht: Type END;\n top: INTEGER := -1;\n\n PROCEDURE Notice(lft, r"
& "ht: Type) =\n BEGIN\n INC(top);\n trail[top].lft := lft;\n tr"
& "ail[top].rht := rht;\n END Notice;\n\n PROCEDURE Seen(lft, rht: Type)"
& ": BOOLEAN =\n BEGIN\n FOR i:=0 TO top DO\n IF (trail[i].lft=lf"
& "t) AND (trail[i].rht=rht) THEN RETURN TRUE END;\n END;\n RETURN F"
& "ALSE;\n END Seen;\n\n@In\n PROCEDURE In(lft, rht: Type): BOOLEAN = @\n"
& " BEGIN\n@1 IF Seen(lft, rht) @ THEN @12 RETURN TRUE @ END;\n@2 N"
& "otice(lft, rht); @\n@3 TYPECASE lft OF @\n@4 | TypeBot => RETURN "
& "TRUE; @\n@5 | TypeTop => RETURN ISTYPE(rht, TypeTop); @\n@6 | Typ"
& "eFun(lftFun) =>\n TYPECASE rht OF @\n@7 | TypeBot => RETUR"
& "N FALSE; @\n@8 | TypeTop => RETURN TRUE; @\n | TypeFun(rht"
& "Fun) =>\n RETURN \n@10 In(rhtFun.dom, lftFun.dom) "
& "@ AND\n@11 In(lftFun.rng, rhtFun.rng); @\n END;\n "
& "END;\n END In;\n@In\n";
CONST E58 =
"; Copyright (C) 1992, Digital Equipment Corporation "
& " \n; All rights reserved. "
& " \n; See the file COPYRIGHT for a full description. "
& " \n; "
& " \n; Last modified on Wed Jun 15 13:18:19 PDT "
& "1994 by heydon \n\n(Shape\n (Width + 0)\n (Height +"
& " 0)\n (VBox\n (Glue 10)\n (HBox\n Fill\n (Shape (Width"
& " + 0) \"Number of Nodes: \")\n (Numeric %nodeCnt =10 (Min 1) (Max "
& "1000)))\n (Glue 4)\n (Ridge 2)\n (Glue 4)\n (VBox\n (H"
& "Box Fill \"Insertion Order:\" Fill)\n (Glue 4)\n (Radio\n "
& " %inputtype\n =rand\n (HBox\n Fill\n "
& " (Choice %rand \"Random\")\n (Glue 6)\n (Choice %inc "
& "\"Increasing\")\n (Glue 6)\n (Choice %dec \"Decreasin"
& "g\")\n Fill)))\n (Glue 4)\n (Ridge 2)\n (Glue 4)\n "
& " (VBox\n (HBox Fill \"Deletion Order:\" Fill)\n (Glue 4)\n "
& " (Radio\n %deletetype\n =del_rand\n (HBox\n "
& " Fill\n (Choice %del_rand \"Random\")\n (Glue 6)\n"
& " (Choice %del_inc \"Increasing\")\n (Glue 6)\n "
& " (Choice %del_dec \"Decreasing\")\n Fill)))\n (Glue 4)\n "
& " (Ridge 2)\n (Glue 4)\n (VBox\n (HBox Fill \"Random Sequen"
& "ce:\" Fill)\n (Glue 4)\n (Radio\n =randomRand\n "
& " (HBox\n Fill\n (Choice %randomRand \"Random\")\n "
& " (Glue 6)\n (Choice %fixedRand \"Fixed\")\n Fill"
& ")))\n (Glue 10)))\n \n";
CONST E59 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Pars"
& "e.evt.\n;**************************************************************"
& "******\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) ("
& "Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue "
& "4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorith"
& "m events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus even"
& "ts\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to "
& "events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height 2"
& "00 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E60 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Unio"
& "nFind.evt.\n;**********************************************************"
& "**********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue "
& "4) (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (G"
& "lue 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algo"
& "rithm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus "
& "events\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args"
& " to events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Heig"
& "ht 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E61 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Mini"
& "max.evt.\n;************************************************************"
& "********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4)"
& " (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glu"
& "e 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algori"
& "thm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus ev"
& "ents\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args t"
& "o events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height"
& " 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E62 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Rim\n (Pen "
& "20)\n (VBox\n (HBox (Shape (Width + 0) \"How many elements to sort?"
& "\") (Numeric %data))\n (Glue 5)\n (HBox\n (Glue 24)\n ("
& "Radio\n (VBox\n (Choice %random =TRUE (Text LeftAlign \""
& "Random\"))\n (Choice %increasing (Text LeftAlign \"Increasing\""
& "))\n (Choice %decreasing (Text LeftAlign \"Decreasing\"))))\n "
& " Fill)))";
CONST E63 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(VBox\n (HBo"
& "x\n (Shape (Width + 0) (Height + 0) \"Probes: \")\n (Shape (Width"
& " 60) (Numeric HideButtons (Max 500000) %probeCount =0))\n (Glue 6) "
& "\n (Shape (Width + 0) (Height + 0) \" Pattern: \")\n (TextEdi"
& "t ReadOnly (Font \"-*-courier-bold-r-*-*-*-180-*-*-*-*-*-*\")\n %p"
& "attern =\"\")\n Fill)\n (Shape (Height 100 + Inf) (Width 250 + Inf)"
& "\n (TextEdit ReadOnly (Font \"-*-courier-bold-r-*-*-*-180-*-*-*-*-*"
& "-*\")\n %text =\"\")))\n";
CONST E64 =
"; Copyright (C) 1994, Digital Equipment Corporation "
& " \n; All rights reserved. "
& " \n; See the file COPYRIGHT for a full description. "
& " \n; "
& " \n; Last modified on Thu Aug 18 14:08:09 PDT "
& "1994 by heydon \n\n(Rim (Pen 10)\n (VBox\n (HBox\n"
& " (Text RightAlign \"Input:\")\n (Glue 3)\n (Radio %input"
& "From =randomInput\n (HBox (ShadowSize 0)\n (LinkButton "
& "(For randomPage)\n (Choice (ShadowSize 1.5) %randomInput \"R"
& "andom\"))\n (Glue 3)\n (LinkButton (For filePage)\n "
& " (Choice (ShadowSize 1.5) %fileInput \"From File\"))\n "
& ")\n )\n Fill\n )\n (Glue 5)\n (TSplit %tsplit Flex ("
& "Which randomPage)\n (VBox %randomPage\n \t(HBox\n \t (VBox\n \t"
& " (Text RightAlign \"# of Sets:\")\n \t (Glue 2)\n \t (Text R"
& "ightAlign \"# of Unions:\")\n \t )\n \t (Glue 2)\n \t (VBox\n \t"
& " (Numeric %setCnt (Min 2) =20)\n \t (Glue 2)\n \t (Numeric %"
& "unionCnt (Min 0) =20)\n \t )\n \t Fill\n \t)\n \t(Glue 5)\n \tRi"
& "dge\n \t(Glue 5)\n \t(HBox\n \t Fill\n \t (Boolean %fixedSeed \"U"
& "se fixed random seed?\")\n \t Fill\n \t)\n )\n (VBox %file"
& "Page\n \t(DirMenu %dirMenu (For browser))\n \t(Glue 4)\n \t(Shape (H"
& "eight 60 + Inf)\n \t (Frame Lowered (BgColor \"White\")\n \t (Fil"
& "eBrowser %browser ReadOnly (Suffixes \"sx\"))\n \t )\n \t)\n \t(Glu"
& "e 4)\n \t(HBox\n \t \"File:\"\n \t (Frame Lowered (BgColor \"White"
& "\")\n \t (Helper (For browser) FirstFocus)\n \t )\n \t)\n )"
& " \n )\n )\n)\n";
CONST E65 =
"; Copyright (C) 1993, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(VBox\n (Bar)"
& "\n (HBox\n (Glue 5)\n (VBox\n (Glue 5)\n (Text Center \"Pla"
& "yer A\")\n (Glue 5)\n (Radio %AHumanComp =AHuman\n (VBox\n"
& " (Choice %AHuman (Text LeftAlign \"Human\"))\n (Choice"
& " %AMinimax (Text LeftAlign \"Minimax\"))\n (HBox (Glue 30)\n "
& " (VBox\n (HBox (Text \"Depth:\") (Glue 5)\n "
& " (Numeric (Min 1) (Max 10) %ADepth =3))\n (VBox (Tex"
& "t LeftAlign \"Heuristic:\")\n (HBox (Glue 10)\n "
& " (Radio %AHexpawn =AHPTrivial\n (VBox\n "
& " (Choice %AHPTrivial (Text LeftAlign \"Trivial\"))\n "
& " (Choice %AHPSmart (Text LeftAlign \"Smart\"))\n "
& " Fill\n )\n "
& " )\n )\n )\n )\n "
& " )\n )\n )\n )\n (Glue 5) \n (Bar)\n "
& "(Glue 5)\n(HBox\n (VBox\n (Glue 5)\n (Text Center \"Player B\""
& ")\n (Glue 5)\n (Radio %BHumanComp =BHuman\n (VBox\n "
& " (Choice %BHuman (Text LeftAlign \"Human\"))\n (Choice %BMin"
& "imax (Text LeftAlign \"Minimax\"))\n (HBox (Glue 30)\n "
& " (VBox\n (HBox (Text \"Depth:\") (Glue 5)\n "
& " (Numeric (Min 1) (Max 10) %BDepth =3))\n (VBox (Tex"
& "t LeftAlign \"Heuristic:\")\n (HBox (Glue 10)\n "
& " (Radio %BHexpawn =BHPTrivial\n (VBox\n "
& " (Choice %BHPTrivial (Text LeftAlign \"Trivial\"))\n"
& " (Choice %BHPSmart (Text LeftAlign \"Smart\"))\n"
& " Fill\n )\n "
& " )\n )\n ))\n )\n "
& " )\n )\n )\n ) \n(Glue 5)\n))\n\n";
CONST E66 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Whee"
& "ler.evt.\n;************************************************************"
& "********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25"
& " + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"StartPermute: Stop? \") \n (Boolean %stopAtS"
& "tartPermute =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtStartPermute =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6"
& ")\n (Shape (Height 16 + 0)\n (HBox Fill (Shape "
& "(Width + 0) (Height + 0) \n \"NextRotati"
& "on: Stop? \") \n (Boolean %stopAtNextRotation =TRU"
& "E \"\")\n (Glue 10)\n (Shape (Wid"
& "th + 0) (Height + 0) \"Weight: \")\n (Shape (Width 8"
& "0) (Numeric %waitAtNextRotation =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n ("
& "Shape ";
CONST E66_0 =
"(Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + "
& "0) \n \"RotationsSorted: Stop? \") \n "
& " (Boolean %stopAtRotationsSorted =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtRotationsSorted =1 \n "
& "(Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Height"
& " 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"PermuteDone: Stop? \") \n "
& " (Boolean %stopAtPermuteDone =TRUE \"\")\n (G"
& "lue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: "
& "\")\n (Shape (Width 80) (Numeric %waitAtPermuteDone "
& "=1 \n (Min 0) (Max 100)))"
& "))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"StartEncode: Stop? \") \n (Boolean %s"
& "topAtStartEncode =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtStartEncode =1 \n "
& " (Min 0) (Max 100)))))\n (Gl"
& "ue 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Sh"
& "ape (Width + 0) (Height + 0) \n \"Encode"
& "NextChar: Stop? \") \n (Boolean %stopAtEncodeNextC"
& "har =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtEncodeNextChar =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width"
& " + 0) (Height + 0) \n \"EncodeDistinctCo"
& "unt:";
CONST E66_1 =
" Stop? \") \n (Boolean %stopAtEncodeDistinctCount "
& "=TRUE \"\")\n (Glue 10)\n (Shape "
& "(Width + 0) (Height + 0) \"Weight: \")\n (Shape (Wid"
& "th 80) (Numeric %waitAtEncodeDistinctCount =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Widt"
& "h + 0) (Height + 0) \n \"EncodeFoundCode"
& ": Stop? \") \n (Boolean %stopAtEncodeFoundCode =TR"
& "UE \"\")\n (Glue 10)\n (Shape (Wi"
& "dth + 0) (Height + 0) \"Weight: \")\n (Shape (Width "
& "80) (Numeric %waitAtEncodeFoundCode =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) "
& "(Height + 0) \n \"EncodeDone: Stop? \""
& ") \n (Boolean %stopAtEncodeDone =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtEncodeDone =1 \n (Min "
& "0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16 +"
& " 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"InitDecode: Stop? \") \n "
& " (Boolean %stopAtInitDecode =TRUE \"\")\n (Glue 10)"
& "\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtInitDecode =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"StartDecode: Stop? \") \n (Boolean %stopAtSta"
& "rtDecode =TRUE \"\")\n (Glue 10)\n "
& " (Shap";
CONST E66_2 =
"e (Width + 0) (Height + 0) \"Weight: \")\n (Shape (W"
& "idth 80) (Numeric %waitAtStartDecode =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0)"
& " (Height + 0) \n \"DecodeNextCode: Sto"
& "p? \") \n (Boolean %stopAtDecodeNextCode =TRUE \"\")"
& "\n (Glue 10)\n (Shape (Width + 0)"
& " (Height + 0) \"Weight: \")\n (Shape (Width 80) (Num"
& "eric %waitAtDecodeNextCode =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"DecodeDistinctCount: Stop? \""
& ") \n (Boolean %stopAtDecodeDistinctCount =TRUE \"\")"
& "\n (Glue 10)\n (Shape (Width + 0)"
& " (Height + 0) \"Weight: \")\n (Shape (Width 80) (Num"
& "eric %waitAtDecodeDistinctCount =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n ("
& "Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Hei"
& "ght + 0) \n \"DecodeFoundChar: Stop? \""
& ") \n (Boolean %stopAtDecodeFoundChar =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (He"
& "ight + 0) \"Weight: \")\n (Shape (Width 80) (Numeric"
& " %waitAtDecodeFoundChar =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (H"
& "eight 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0)"
& " \n \"DecodeDone: Stop? \") \n "
& " (Boolean %stopAtDecodeDone =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weigh"
& "t: \")\n (Shape (Width 80) (Numeric %waitAtDecodeDon"
& "e =";
CONST E66_3 =
"1 \n (Min 0) (Max 100))))"
& ")\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"StartReconstruct: Stop? \") \n (Boolea"
& "n %stopAtStartReconstruct =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtStartReconstruct =1 \n"
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& "(HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"FirstChars: Stop? \") \n (Boolean %stopAtF"
& "irstChars =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n ("
& "Shape (Width 80) (Numeric %waitAtFirstChars =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Wid"
& "th + 0) (Height + 0) \n \"ConsiderChar: "
& " Stop? \") \n (Boolean %stopAtConsiderChar =TRUE \""
& "\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtConsiderChar =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shap"
& "e (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height "
& "+ 0) \n \"EqualChars: Stop? \") \n "
& " (Boolean %stopAtEqualChars =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"W"
& "eight: \")\n (Shape (Width 80) (Numeric %waitAtEqual"
& "Chars =1 \n (Min 0) (Max "
& "100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " ";
CONST E66_4 =
" (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"FinishCharRun: Stop? \") \n (Boolean"
& " %stopAtFinishCharRun =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtFinishCharRun =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox F"
& "ill (Shape (Width + 0) (Height + 0) \n \""
& "StartResult: Stop? \") \n (Boolean %stopAtStartRes"
& "ult =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtStartResult =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + "
& "0) (Height + 0) \n \"ResultNextChar: S"
& "top? \") \n (Boolean %stopAtResultNextChar =TRUE \"\""
& ")\n (Glue 10)\n (Shape (Width + 0"
& ") (Height + 0) \"Weight: \")\n (Shape (Width 80) (Nu"
& "meric %waitAtResultNextChar =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shap"
& "e (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height "
& "+ 0) \n \"EndResult: Stop? \") \n "
& " (Boolean %stopAtEndResult =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Wei"
& "ght: \")\n (Shape (Width 80) (Numeric %waitAtEndResu"
& "lt =1 \n (Min 0) (Max 100"
& ")))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Reveal: Stop? \") \n (Boolean %sto"
& "pAt";
CONST E66_5 =
"Reveal =TRUE \"\")\n (Glue 10)\n "
& "(Shape (Width + 0) (Height + 0) \"Weight: \")\n (Sha"
& "pe (Width 80) (Numeric %waitAtReveal =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " )\n (Glue 4)\n (VBox\n (Glue 5)\n "
& " (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (Button "
& "%eventCounts\n (VBox\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfStartPermute \"0\")))\n (Glu"
& "e 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNextRotation \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (He"
& "ight 16 + 0) \n (Text %ctOfRotationsSo"
& "rted \"0\")))\n (Glue 6)\n (HBox Fill (Sh"
& "ape (Width + 0) (Height 16 + 0) \n (Te"
& "xt %ctOfPermuteDone \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfStartEncode \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfEncodeNextChar \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height"
& " 16 + 0) \n (Text %ctOfEncodeDistinctC"
& "ount \"0\")))\n (Glue 6)\n (HBox Fill (Sh"
& "ape (Width + 0) (Height 16 + 0) \n (Te"
& "xt %ctOfEncodeFoundCode \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfEncodeDone \"0\")))\n (Glue 6"
& ")\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfInitDecode \"0\")))\n "
& " (Gl";
CONST E66_6 =
"ue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfStartDecode \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (He"
& "ight 16 + 0) \n (Text %ctOfDecodeNextC"
& "ode \"0\")))\n (Glue 6)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height 16 + 0) \n (Tex"
& "t %ctOfDecodeDistinctCount \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfDecodeFoundChar \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0"
& ") \n (Text %ctOfDecodeDone \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) "
& "(Height 16 + 0) \n (Text %ctOfStartRec"
& "onstruct \"0\")))\n (Glue 6)\n (HBox Fill"
& " (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfFirstChars \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfConsiderChar \"0\")))\n (Glue "
& "6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfEqualChars \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height"
& " 16 + 0) \n (Text %ctOfFinishCharRun \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + 0) (Height 16 + 0) \n (Text %ctO"
& "fStartResult \"0\")))\n (Glue 6)\n (HBox "
& "Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfResultNextChar \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfEndResult \"0\")))\n ("
& "Glue ";
CONST E66_7 =
"6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfReveal \"0\")))\n "
& " (Glue 3))))\n Fill\n (Glue 4 + Inf)\n )\n "
& " )\n )\n )\n)\n";
CONST E67 =
"MODULE CPAlgorithm;\n\nIMPORT Algorithm, CPAlgClass, R2, Math;\n\nTYPE "
& "\n Link = REF RECORD\n p:R2.T;\n next: Link;\nEND;\n\nCONST MaxD"
& "istance = 1.0E30;\nVAR\n min : REAL := 100.0;\n h,z : Lin"
& "k;\n N: INTEGER := 0;\n\n@CheckforMin\nPROCEDURE CheckForMin (READONL"
& "Y p1, p2: R2.T) =@\n BEGIN\n@5 IF (Dist(p1,p2) < min) THEN @\n@10 "
& " UpdateMin(p1,p2) @\n END\n END CheckForMin;\n@CheckforMin\n\n"
& "\n@FindClosestPair\nPROCEDURE FindClosestPair(VAR c: Link; N: INTEGER):"
& " Link =@\n VAR\n a, b, t1, t2: Link;\n midX : REAL;\n p1, p2,"
& " p3, p4: R2.T;\n\n BEGIN\n@5 a := c;@\n@10 b := MiddleOfList(c"
& ",N);@\n@15 midX := b.p.x;@\n\n@20 t1 := FindClosestPair(a, N DI"
& "V 2);@\n@25 t2 := FindClosestPair(b, N - (N DIV 2));@\n\n@30 c "
& ":= Merge(t1, t2);@\n\n@35 a := c;@\n REPEAT\n@40 IF ((ABS("
& "a.p.x - midX) < min) AND (p1 # z.p)) THEN@\n@45 CheckForMin(a.p"
& ", p1);@\n@50 CheckForMin(a.p, p2);@\n@55 CheckForMin(a."
& "p, p3);@\n@60 CheckForMin(a.p, p4);@\n@65 p1 := p2; p2 "
& ":= p3; p3 := p4; p4 := a.p;@\n END (* IF *);\n@70 a := a.n"
& "ext;@\n@75 UNTIL a = z;@\n\n@80 RETURN c;@\n END FindClosestPa"
& "ir;\n@FindClosestPair\n\n@Main\nBEGIN (* main module: computes closest "
& "pair in given set of points *) @\n@5 InitializeListofPoints(h, N);@\n@"
& "10 SortByX(h, N);@\n@15 FindClosestPair(h, N);@\nEND CPAlgorithm.\n@M"
& "ain\n";
CONST E68 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n\n\n(*\nlet SHOW =\n proc(t, x)\n sys"
& "_printText(t & \" = \"); \n sys_print(x, 10); \n sys_printText(\""
& "\\n\"); \n sys_printFlush();\n end;\n*)\n\ntype Point = [2*Real];\n"
& "\n let makeBezierPathProc = proc (cpp:[4*Point]):(Real)->Point,\n "
& " (*------------------------------------------------------------\n "
& " cpp = array of four control points [x,y]\n Return a "
& "parametric procedure that traces the bezier curve\n from cpp["
& "0] to cpp[3] with control points cpp[1] and cpp[2].\n ----------"
& "--------------------------------------------------*)\n let x000 "
& "= cpp[0][0], y000 = cpp[0][1],\n x001 = cpp[1][0], y001 = "
& "cpp[1][1],\n x011 = cpp[2][0], y011 = cpp[2][1],\n "
& " x111 = cpp[3][0], y111 = cpp[3][1];\n proc (t)\n "
& "let s = 1.0-t;\n let sss = s*s*s,\n sst = s*s"
& "*t*3.0,\n stt = s*t*t*3.0,\n ttt = t*t*t;"
& "\n [\n (sss*x000) + (sst*x001) + (stt*x011) +"
& " (ttt*x111),\n (sss*y000) + (sst*y001) + (stt*y011) + (t"
& "tt*y111)\n ]\n end;\n end;\n\nlet max : (Int,Int)-"
& ">Int =\n proc(n, m)\n if n > m then n else m end\n end;\n\nlet abs"
& " : (Real)->Real = \n proc(x) \n if x > 0.0 then x else -x end \n e"
& "nd;\n\nlet rec exp : (Int,Int)->Int =\n proc(n, m)\n if m<=0 then 1"
& " else n * exp(n, m-1) end\n end;\n\ntype Node = \n Option typeBot:Ver"
& "tex, typeTop:Vertex, typeFun:Vertex end;\n\nlet nodeVertex : (Node) -> "
& "Vertex =\n proc(node)\n case node of\n typeBot(bot) => bot,\n"
& " typeTop(top) => top,\n typeFun(fun) => fun\n end;\n end;"
& "\n\nlet edgeBezier: (Graph, Edge, Vertex, Vertex, Real, Bool)->Ok =\n "
& "proc(g, e, v1, v2, scale, rightward)\n let c1 = graph_newVertex(g);\n"
& " let c2 = gr";
CONST E68_0 =
"aph_newVertex(g);\n let v1p = graph_getVertexPosition(v1);\n let "
& "v2p = graph_getVertexPosition(v2);\n\n let v1x = v1p[0], v1y = v1p[1"
& "];\n let v2x = v2p[0], v2y = v2p[1];\n\n let dx = abs(v2x-v1x)*sc"
& "ale;\n let dy = abs(v1y-v2y)*scale;\n\n if rightward\n then\n "
& " if v1x > v2x then\n graph_moveVertex(c1, v1x+dx, v1y+dy, fa"
& "lse);\n graph_moveVertex(c2, v2x+(dy-dx), v2y-dy, false);\n "
& " else\n graph_moveVertex(c1, v1x+(dy-dx), v1y+dy, false);\n "
& " graph_moveVertex(c2, v2x+dx, v2y-dy, false);\n end;\n else \n"
& " if v1x > v2x then\n graph_moveVertex(c1, v1x-(dy-dx), v1y+"
& "dy, false);\n graph_moveVertex(c2, v2x-dx, v2y-dy, false);\n "
& " else\n graph_moveVertex(c1, v1x-dx, v1y+dy, false);\n g"
& "raph_moveVertex(c2, v2x-(dy-dx), v2y-dy, false);\n end;\n end;\n"
& " graph_moveEdgeBezier(e, v1, v2, c1, c2, false);\n end;\n \nlet tr"
& "avTrail: [Int] = array_new(100, -1);\nvar travTop: Int = -1;\n\nlet tra"
& "vNotice: (Int)->Ok =\n proc(index)\n travTop := travTop+1;\n tra"
& "vTrail[travTop] := index;\n end;\n\nlet travSeen: (Int)->Bool =\n pro"
& "c(index)\n var found = false;\n for i = 0 to travTop do\n if"
& " travTrail[i] is index then found:=true; exit end\n end;\n found;"
& "\n end;\n\nlet rec depth1: (EvtObj, Int)->Int =\n proc(s, nodeIndex)\n"
& " if travSeen(nodeIndex) then 1\n else\n travNotice(nodeIndex"
& ");\n case s.nodes[nodeIndex] of\n typeBot(bot) => 1,\n "
& " typeTop(top) => 1,\n typeFun(fun) => \n let domDepth"
& " = depth1(s, s.doms[nodeIndex]);\n let rngDepth = depth1(s, s."
& "rngs[nodeIndex]);\n 1 + max(domDepth, rngDepth);\n end\n "
& " end \n end;\n\nlet depth =\n proc(s:EvtObj, nodeIndex:Int):Int,\n "
& " travTop := -1;\n depth1(s, nodeIndex);\n end;\n\nlet rec layout1"
& " =\n proc(s, nodeIndex, x, y, n, exp2n)\n if travSeen(nodeIndex) th"
& "en ok\n else\n travNotice(nodeIndex);\n let size = 1.0/flo"
& "at(s.depth);\n case s.nodes[nodeIndex] of\n typeBot(bot) "
& "=> \n gr";
CONST E68_1 =
"aph_setVertexSize(bot, size, size);\n graph_moveVertex(bot, x/"
& "exp2n, y, false),\n typeTop(top) => \n graph_setVertexS"
& "ize(top, size, size);\n graph_moveVertex(top, x/exp2n, y, fals"
& "e),\n typeFun(fun) => \n graph_setVertexSize(fun, size,"
& " size);\n graph_moveVertex(fun, x/exp2n, y, false);\n "
& " let displ = float(exp(2,n-2));\n layout1(s, s.doms[nodeIndex]"
& ", x-displ, y+1.0, n-1, exp2n);\n layout1(s, s.rngs[nodeIndex],"
& " x+displ, y+1.0, n-1, exp2n);\n let vDom = nodeVertex(s.nodes["
& "s.doms[nodeIndex]]);\n let vRng = nodeVertex(s.nodes[s.rngs[no"
& "deIndex]]);\n let eDom = s.edges[s.domEdges[nodeIndex]];\n "
& " let eRng = s.edges[s.rngEdges[nodeIndex]];\n graph_moveE"
& "dge(eDom, fun, vDom, false);\n graph_moveEdge(eRng, fun, vRng,"
& " false);\n if nodeIndex > s.doms[nodeIndex] then (* back dom e"
& "dge *)\n (* --- edgeBezier(s.graphvbt, eDom, fun, vDom, 0.75"
& ", false) *)\n edgeBezier(s.graphvbt, eDom, fun, vDom, 5.0*si"
& "ze, false);\n elsif nodeIndex is s.doms[nodeIndex] then (* sel"
& "f-loop dom edge *)\n let vDom1 = graph_newVertex(s.graphvbt)"
& ";\n let vDomXY = graph_getVertexPosition(vDom);\n "
& " graph_moveVertex(vDom1, \n vDomXY[0]-(size/16.0), vDomXY["
& "1]+(size/16.0), false);\n edgeBezier(s.graphvbt, eDom, vDom1"
& ", fun, 175.0*size, false);\n end;\n if nodeIndex > s."
& "rngs[nodeIndex] then (* back rng edge *)\n (* --- edgeBezier"
& "(s.graphvbt, eRng, fun, vRng, 0.75, true) *)\n edgeBezier(s."
& "graphvbt, eRng, fun, vRng, 5.0*size, true);\n elsif nodeIndex "
& "is s.rngs[nodeIndex] then (* self-loop rng edge *)\n let vRn"
& "g1 = graph_newVertex(s.graphvbt);\n let vRngXY = graph_getVe"
& "rtexPosition(vRng);\n graph_moveVertex(vRng1, \n "
& " vRngXY[0]+(size/16.0), vRngXY[1]+(size/16.0), false);\n ed"
& "geBezier(s.graphvbt, eRng, vRng1, fun, 175.0*si";
CONST E68_2 =
"ze, true);\n end;\n end\n end \n end;\n\nlet layout ="
& "\n proc(s, nodeIndex, x, y, n, exp2n)\n travTop := -1;\n layout1"
& "(s, nodeIndex, x, y, n, exp2n);\n end;\n\nlet moveVToVI =\n proc(s, v"
& ", vIndex)\n let vTo = nodeVertex(s.nodes[vIndex]);\n let vToXY = "
& "graph_getVertexPosition(vTo);\n graph_moveVertex(v, vToXY[0], vToXY["
& "1], true);\n end; \n\nlet moveVAlongEI =\n proc(s, v, eIndex, vInde"
& "x, forward)\n if eIndex<0 then moveVToVI(s, v, vIndex);\n else\n "
& " let e = s.edges[eIndex];\n let eCtrl = graph_getEdgeControls("
& "e);\n if #(eCtrl) is 0 then\n\tif forward then moveVToVI(s, v, vIn"
& "dex)\n\telse\n let eVert = graph_getEdgeVertices(e);\n "
& " let vTo = eVert[0];\n let vToXY = graph_getVertexPosition(vT"
& "o);\n graph_moveVertex(v, vToXY[0], vToXY[1], true);\n\tend;\n"
& " else\n\tlet tail = if forward then 0 else 1 end;\n\tlet head = if"
& " forward then 1 else 0 end;\n let eVert = graph_getEdgeVertices("
& "e);\n\tlet vTailXY = graph_getVertexPosition(eVert[tail]);\n\tlet vHead"
& "XY = graph_getVertexPosition(eVert[head]);\n\tlet cTailXY = graph_getVe"
& "rtexPosition(eCtrl[tail]);\n\tlet cHeadXY = graph_getVertexPosition(eCt"
& "rl[head]);\n\tlet p = makeBezierPathProc([vTailXY,cTailXY,cHeadXY,vHead"
& "XY]);\n graph_moveVertexOnPath(v, p);\n end\n end\n end"
& ";\n\nlet variance =\n proc(s, subIndex, supIndex)\n let xSub = floa"
& "t(s.depth)/6.0;\n let xSup = float(s.depth)/10.0;\n let y = ~1.5/"
& "float(s.depth);\n let yLo = ~1.0/float(s.depth);\n let yHi = ~2.0"
& "/float(s.depth);\n if subIndex < supIndex then (* covariant *)\n "
& " graph_moveVertex(s.varianceNW, -xSub, y, true);\n graph_moveVert"
& "ex(s.varianceSW, -xSub, y, true);\n graph_moveVertex(s.varianceNE,"
& " xSup, yHi, true);\n graph_moveVertex(s.varianceSE, xSup, yLo, tru"
& "e);\n else (* contravariant *)\n graph_moveVertex(s.varianceNW,"
& " -xSup, yHi, true);\n graph_moveVertex(s.varianceSW, -xSup, yLo, t"
& "rue);\n graph_moveVertex(s.varianceNE, xSub, y, true);\n grap"
& "h_moveVertex(s";
CONST E68_3 =
".varianceSE, xSub, y, true);\n end;\n end;\n\nlet hiLiPair =\n pro"
& "c(s, subIndex, supIndex, subLeadingEdgeIndex, supLeadingEdgeIndex,\n "
& " forward)\n if subIndex < supIndex then (* covariant *)\n mov"
& "eVAlongEI(s, s.cursorW, subLeadingEdgeIndex, subIndex, forward);\n "
& " moveVAlongEI(s, s.cursorE, supLeadingEdgeIndex, supIndex, forward);\n "
& " graph_animate(s.graphvbt, 0.0, 2.0);\n else (* contravariant *)"
& "\n moveVAlongEI(s, s.cursorE, subLeadingEdgeIndex, subIndex, forwa"
& "rd);\n moveVAlongEI(s, s.cursorW, supLeadingEdgeIndex, supIndex, f"
& "orward);\n graph_animate(s.graphvbt, 0.0, 2.0);\n end;\n end;\n"
& " \nlet hiLiPairColor =\n proc(s, subIndex, supIndex, clr)\n varian"
& "ce(s, subIndex, supIndex);\n let c = color_named(clr);\n graph_se"
& "tEdgeColor(s.cursorStem, c);\n graph_setVertexHiLiColor(s.cursorWHiL"
& "i, c);\n graph_setVertexHiLiColor(s.cursorEHiLi, c);\n graph_anim"
& "ate(s.graphvbt, 0.0, 0.0);\n graph_redisplay(s.graphvbt);\n end;\n\n"
& "let view =\n\n{\ngraphvbt => graph_new(),\n\nnodes => array_new(50, ok)"
& ",\nedges => array_new(50, ok),\n\ndoms => array_new(50, -1),\nrngs => "
& " array_new(50, -1),\ndomEdges => array_new(50, -1),\nrngEdges => arra"
& "y_new(50, -1),\n\ncursorW => ok,\ncursorWHiLi => ok,\ncursorE => ok,\nc"
& "ursorEHiLi => ok,\ncursorStem => ok,\n\nvarianceNW => ok,\nvarianceNE ="
& "> ok,\nvarianceSW => ok,\nvarianceSE => ok,\nvarianceP => ok,\n\ndepth "
& "=> 0,\n\nSetup => meth (s)\n s.cursorW := graph_newVertex(s.graphvbt);"
& "\n graph_setVertexShape(s.cursorW, \"ellipse\");\n s.cursorWHiLi := g"
& "raph_newVertexHiLi(s.cursorW);\n s.cursorE := graph_newVertex(s.graphv"
& "bt);\n graph_setVertexShape(s.cursorE, \"ellipse\");\n s.cursorEHiLi "
& ":= graph_newVertexHiLi(s.cursorE);\n s.cursorStem := graph_newEdge(s.c"
& "ursorW,s.cursorE);\n graph_setEdgeColor(s.cursorStem, color_named(\"cy"
& "an\"));\n s.varianceNW := graph_newVertex(s.graphvbt);\n s.varianceNE"
& " := graph_newVertex(s.graphvbt);\n s.varianceSW := graph_newVertex(s.g"
& "raphvbt);\n s.varianceSE := graph_newVertex(s.graphvbt);\n s.variance"
& "P := graph_new";
CONST E68_4 =
"Polygon([s.varianceNE,s.varianceNW,s.varianceSW,s.varianceSE]);\n grap"
& "h_setPolygonColor(s.varianceP, color_named(\"cyan\"));\nend,\n\nBegin ="
& "> meth (s, lftRoot, rhtRoot)\n let lftDepth = depth(s, lftRoot);\n le"
& "t rhtDepth = depth(s, rhtRoot);\n let n = max(lftDepth, rhtDepth);\n "
& "let halfWidth = float(exp(2, n-1));\n let width = 2.0*halfWidth;\n le"
& "t margin = 3.0/float(n);\n graph_setWorld(s.graphvbt, -(float(n)+margi"
& "n), float(n)+margin,\n -margin, float(n-1)+margin);\n s.depth := n;"
& "\n graph_setVertexSize(s.cursorW, 0.15/float(n), 0.15/float(n));\n gr"
& "aph_setVertexSize(s.cursorE, 0.15/float(n), 0.15/float(n));\n graph_se"
& "tVertexHiLiBorder(s.cursorWHiLi, 0.8/float(n), 0.8/float(n));\n graph_"
& "setVertexHiLiBorder(s.cursorEHiLi, 0.8/float(n), 0.8/float(n));\n grap"
& "h_setVertexHiLiColor(s.cursorWHiLi, color_named(\"cyan\"));\n graph_se"
& "tVertexHiLiColor(s.cursorEHiLi, color_named(\"cyan\"));\n graph_setEdg"
& "eWidth(s.cursorStem, (1.0/float(n))*0.6);\n layout(s, lftRoot, -halfWi"
& "dth, 0.0, n, width/float(n));\n layout(s, rhtRoot, halfWidth, 0.0, n, "
& "width/float(n));\n graph_redisplay(s.graphvbt);\nend,\n\nNewBot => met"
& "h (s, index)\n let v = graph_newVertex(s.graphvbt);\n graph_setVertex"
& "Shape(v, \"ellipse\");\n graph_setVertexColor(v, color_named(\"PaleBlu"
& "eViolet\"));\n graph_setVertexLabel(v, \"Bot\");\n graph_setVertexLab"
& "elColor(v, color_named(\"black\"));\n s.nodes[index] := option typeBot"
& " => v end;\nend,\n\nNewTop => meth (s, index)\n let v = graph_newVerte"
& "x(s.graphvbt);\n graph_setVertexShape(v, \"ellipse\");\n graph_setVer"
& "texColor(v, color_named(\"PaleVioletRed\"));\n graph_setVertexLabel(v,"
& " \"Top\");\n graph_setVertexLabelColor(v, color_named(\"black\"));\n "
& "s.nodes[index] := option typeTop => v end;\nend,\n\nNewFun => meth (s, "
& "index, domEdgeIndex, rngEdgeIndex)\n let v = graph_newVertex(s.graphvb"
& "t);\n graph_setVertexShape(v, \"ellipse\");\n graph_setVertexColor(v,"
& " color_named(\"PaleGreen\"));\n graph_setVertexLabel(v, \"->\");\n gr"
& "aph_setVertexLabelColor(v, color_named(\"black\"));\n s.nodes[index] :"
& "= option typeFun => v";
CONST E68_5 =
" end;\n\n let eDom = graph_newEdge(v, v);\n let eRng = graph_newEdge("
& "v, v);\n graph_setEdgeColor(eDom, color_named(\"CadetBlue\"));\n grap"
& "h_setEdgeColor(eRng, color_named(\"CadetBlue\"));\n s.edges[domEdgeInd"
& "ex] := eDom;\n s.edges[rngEdgeIndex] := eRng;\n s.domEdges[index] := "
& "domEdgeIndex;\n s.rngEdges[index] := rngEdgeIndex;\nend,\n\nNewDomRng "
& "=> meth (s, index, domIndex, rngIndex)\n let v = nodeVertex(s.nodes[in"
& "dex]);\n s.doms[index] := domIndex;\n s.rngs[index] := rngIndex;\nend"
& ",\n\nNewLoop => meth (s, fromIndex, toIndex)\n ok\nend,\n\nEnter => \n"
& " meth (s, subIndex, supIndex, subLeadingEdgeIndex, supLeadingEdgeIndex"
& ")\n hiLiPairColor(s, subIndex, supIndex, \"cyan\");\n hiLiPair(s,"
& " subIndex, supIndex, subLeadingEdgeIndex, supLeadingEdgeIndex, true);\n"
& " end,\n\nExit => \n meth (s, subIndex, supIndex, subLeadingEdgeIndex,"
& " supLeadingEdgeIndex, result)\n if result then\n hiLiPairColor("
& "s, subIndex, supIndex, \"green\");\n else\n hiLiPairColor(s, su"
& "bIndex, supIndex, \"red\");\n end;\n hiLiPairColor(s, subIndex, s"
& "upIndex, \"VeryPaleCyan\");\n hiLiPair(s, subIndex, supIndex, subLea"
& "dingEdgeIndex, supLeadingEdgeIndex, false);\n end,\n\nBotLessAnyOK => "
& "\n meth (s, subIndex, supIndex, subLeadingEdgeIndex, supLeadingEdgeInd"
& "ex)\n hiLiPairColor(s, subIndex, supIndex, \"green\");\n end,\n\nTo"
& "pLessTopOK => \n meth (s, subIndex, supIndex, subLeadingEdgeIndex, sup"
& "LeadingEdgeIndex)\n hiLiPairColor(s, subIndex, supIndex, \"green\");"
& "\n end,\n\nTopLessNonTopKO => \n meth (s, subIndex, supIndex, subLead"
& "ingEdgeIndex, supLeadingEdgeIndex)\n hiLiPairColor(s, subIndex, supI"
& "ndex, \"red\");\n end,\n\nFunLessBotKO => \n meth (s, subIndex, supIn"
& "dex, subLeadingEdgeIndex, supLeadingEdgeIndex)\n hiLiPairColor(s, su"
& "bIndex, supIndex, \"red\");\n end,\n\nFunLessTopOK => \n meth (s, sub"
& "Index, supIndex, subLeadingEdgeIndex, supLeadingEdgeIndex)\n hiLiPai"
& "rColor(s, subIndex, supIndex, \"green\");\n end,\n\nFunLessFun => \n "
& "meth (s, subIndex, supIndex, subLeadingEdgeIndex, supLeadingEdgeIndex)\n"
& " ok\n end,\n\nSeenOK => \n ";
CONST E68_6 =
"meth (s, subIndex, supIndex)\n hiLiPairColor(s, subIndex, supIndex, "
& "\"Yellow\");\n end,\n\nNotice => \n meth (s, subIndex, supIndex)\n "
& " hiLiPairColor(s, subIndex, supIndex, \"BluishCyan\");\n end,\n\nOK =>"
& " \n meth (s, subIndex, supIndex, subLeadingEdgeIndex, supLeadingEdgeIn"
& "dex)\n graph_setPolygonColor(s.varianceP, color_named(\"DarkGreen\")"
& ");\n hiLiPairColor(s, subIndex, supIndex, \"DarkGreen\");\n end,\n\n"
& "KO => \n meth (s, subIndex, supIndex, subLeadingEdgeIndex, supLeadingE"
& "dgeIndex)\n graph_setPolygonColor(s.varianceP, color_named(\"DarkRed"
& "\"));\n hiLiPairColor(s, subIndex, supIndex, \"DarkRed\");\n end,\n"
& "\n};\n\n";
CONST E69 =
"Source 500 500\nSink 500 500\n0 500 500\n1 500 500\n2 500 500\n3 500 50"
& "0\n4 500 500\n5 500 500\n6 500 500\n7 500 500\n8 500 500\n9 500 500\n10"
& " 500 500\n0 -> 1 1.0\n1 -> 2 1.0\n1 -> 3 1.0\n3 -> 4 1.0\n5 -> 6 1.0\n7"
& " -> 8 1.0\n8 -> 9 1.0\n9 -> 10 1.0\n.\n";
CONST E70 =
"; Copyright (C) 1993, Digital Equipment Corporation \n; All rights rese"
& "rved. \n; See the file COPYRIGHT for a ful"
& "l description. \n\n(Shape\n (Height + 0)\n (VBox\n (HBox\n "
& " (Shape (Width + 0) (Text LeftAlign \"String to compress: \"))\n ("
& "Frame Lowered (TypeIn %string =\"abraca\")))\n (Glue 2)\n (HBox\n"
& " (Shape (Width + 0) (Text LeftAlign \"Alphabet: \"))\n (Frame"
& " Lowered (TypeIn %alphabet =\"abcr\")))\n (Glue 2)\n (HBox\n "
& " (Shape (Width + 999) (Boolean\n %pause\n (Text LeftAlign"
& " \"Pause after each phase\"))))\n (Glue 2)\n (HBox\n (Shape "
& "(Width + 999) (Boolean\n %finalOnly\n (Text LeftAlign \"F"
& "inal decompress phase only\"))))))\n";
CONST E71 =
"(* Copyright 1993 Digital Equipment Corporation. "
& " *)\n(* Distributed only by permission. "
& " *)\n(* "
& " *)\n(* Last modified on Sat Oct 23 17:55:06 P"
& "DT 1993 by heydon *)\n\n(* View that traces the path "
& "of each packet. *)\n\nlet NormalNodeColor = color_named(\"lightgray\");"
& "\nlet FullNodeColor = color_named(\"red\");\nlet BorderColor = color_na"
& "med(\"black\");\nlet EdgeColor = color_named(\"blue\");\nlet Background"
& "Color = color_named(\"white\");\nlet LabelColor = BorderColor;\n\nlet M"
& "axNumColors = 6;\nlet Color = [\n color_named(\"red\"), color_named(\""
& "yellow\"), color_named(\"blue\"),\n color_named(\"purple\"), color_name"
& "d(\"darkgreen\"), color_named(\"brightorange\")];\n\nlet CantorPair =\n"
& " proc((*int*) i, (*int*) j) (* : int *)\n var m = i, n = j;\n if"
& " i > j then m := j; n := i end;\n let k = m + n;\n m + ((k * (k+1"
& ")) / 2)\n end;\n\nlet MakeBezierPathProc = proc (cpp)\n(* ------------"
& "--------------------------\n cpp = array of four control points [x,y]"
& "\n\n Return a parametric procedure that traces the bezier curve from "
& "cpp[0] to\n cpp[3] with control points cpp[1] and cpp[2].\n --------"
& "----------------------------- *)\n let x000 = cpp[0][0], y000 = cpp[0"
& "][1],\n x001 = cpp[1][0], y001 = cpp[1][1],\n x011 = cpp[2]["
& "0], y011 = cpp[2][1],\n x111 = cpp[3][0], y111 = cpp[3][1];\n p"
& "roc (t)\n let s = 1.0 - t;\n let ss = s * s, tt = t * t;\n "
& " let sss = s * ss,\n sst = ss * t * 3.0,\n stt = s "
& "* tt * 3.0,\n ttt = t * tt;\n [(sss * x000) + (sst * x001"
& ") + (stt * x011) + (ttt * x111),\n (sss * y000) + (sst * y001) + "
& "(stt * y011) + (ttt * y111)]\n end\nend;\n\nlet Interp = proc ((*real*"
& ") t, (*R2.T*) a,b) (* : R2.T *)\n(* Return the point a \"t\" fraction o"
& "f the way from \"a\" to \"b\". *)\n let s = 1.0 - t;\n let Interp1 = "
& "proc((*real*) r1, r2) (* : real *) (r1*s)+(r2*t) end;\n [Interp1(a[0],"
& " b[0]), Interp1(a[1], ";
CONST E71_0 =
"b[1])]\nend;\n\nlet AnimateBezierEdge = proc(vv,cpp)\n(* --------------"
& "------------------------\n vv = array of three vertexes\n cpp = arr"
& "ay of four control points [x,y]\n\n Assuming there is an edge from so"
& "me vertex to v[2] with control points v[0]\n and v[1], this routine a"
& "nimates v[0]..v[2] so that the edge appears to draw\n the bezier curv"
& "e given by the control points cpp. At time 0.0 the edge is a\n dot at"
& " cpp[0]. At time 1.0 the edge is a bezier curve from cpp[0] to cpp[3]\n"
& " with control points cpp[1] and cpp[2]. \n -------------------------"
& "------------ *)\n for i = 1 to 3 do\n let j = i - 1;\n let t"
& " = float(i)/3.0;\n graph_moveVertexOnPath(vv[j],MakeBezierPathProc"
& "(\n [cpp[0], Interp(t, cpp[0], cpp[1]), Interp(t, cpp[i], cpp[j]"
& "), cpp[i]]\n ))\n end\nend;\n\nlet Node = {\n (*int*) id => ok,\t"
& "\t(* this node\'s unique id *)\n (*GraphVBT.Vertex*) v => ok,\t(* the "
& "vertex for this graph node *)\n (*R2.T*) pos => ok,\t\t(* node locatio"
& "n *)\n\n init =>\n meth(self, (*graphvbt*) g, (*int*) id, (*real*) "
& "x, (*real*) y)\n let vtx = graph_newVertex(g);\n graph_setVer"
& "texShape(vtx, \"ellipse\");\n graph_setVertexColor(vtx, NormalNode"
& "Color);\n graph_setVertexBorderColor(vtx, BorderColor);\n gra"
& "ph_moveVertex(vtx, x, y, false);\n self.id := id;\n self.v :="
& " vtx;\n self.pos := [x, y];\n self\n end,\n\n setSize =>\n"
& " meth(self, (*real*) size, (*real*) borderSz)\n graph_setVertex"
& "Size(self.v, size, size);\n graph_setVertexBorder(self.v, borderSz"
& ")\n end\n}; (* Node *)\n\nlet Pkt = {\n (*GraphVBT.Vertex*) v => ok"
& ",\t(* the vertex for this packet *)\n\n init =>\n meth(self, (*grap"
& "hvbt*) g, (*int*) level, (*R2.T*) pos)\n let vtx = graph_newVertex"
& "(g);\n graph_setVertexShape(vtx, \"ellipse\");\n graph_setVer"
& "texColor(vtx, Color[level]);\n graph_setVertexBorderColor(vtx, Bor"
& "derColor);\n graph_moveVertex(vtx, pos[0], pos[1], false);\n "
& "self.v := vtx;\n self\n end,\n\n setSize =>\n meth(self, (*"
& "real*) size, ";
CONST E71_1 =
"(*real*) borderSz)\n graph_setVertexSize(self.v, size, size);\n "
& " graph_setVertexBorder(self.v, borderSz)\n end\n}; (* Pkt *)\n\nle"
& "t Edge = {\n (*R2.T*) startPos => ok,\t(* location of start point *)\n"
& " (*Vertex*) endPt => ok,\t(* moved end point*)\n (*Vertex*) c1 => ok,"
& "\t\t(* dummy control point 1 *)\n (*Vertex*) c2 => ok,\t\t(* dummy con"
& "trol point 2 *)\n (*Edge*) e => ok,\t\t(* the GraphVBT object for this"
& " edge *)\n\n init =>\n meth(self, (*graphvbt*) g, (*int*) level, (*"
& "Node*) src, (*bool*) bezier)\n let NewV = proc() (* : Vertex *)\n "
& " let res = graph_newVertex(g);\n graph_setVertexSize(res, "
& "0.0, 0.0);\n graph_moveVertex(res, src.pos[0], src.pos[1], false"
& ");\n res\n end;\n self.startPos := src.pos;\n sel"
& "f.endPt := NewV();\n self.e := graph_newEdge(src.v, self.endPt);\n"
& " if bezier then\n self.c1 := NewV();\n self.c2 := Ne"
& "wV();\n graph_moveEdgeBezier(self.e, src.v,self.endPt, self.c1,s"
& "elf.c2, false)\n end;\n graph_setEdgeColor(self.e, Color[leve"
& "l]);\n self\n end,\n\n setSize =>\n meth(self, (*real*) wid"
& "th)\n graph_setEdgeWidth(self.e, width)\n end,\n\n grow =>\n "
& " meth(self, (*R2.T*) endPos)\n graph_moveVertex(self.endPt, endPo"
& "s[0], endPos[1], true)\n end,\n\n growBezier =>\n meth(self, (*R"
& "2.T*) endPos, (*R2.T*) c1Pos, c2Pos)\n AnimateBezierEdge(\n "
& " [self.c1, self.c2, self.endPt],\n [self.startPos, c1Pos, c2Pos,"
& " endPos])\n end\n}; (* Edge *)\n\nlet EdgeEntry = {\n (*int*) id =>"
& " ok,\t\t(* unique identifier for this edge *)\n (*Node*) end1 => ok,\t"
& "\t(* edge endpoint 1 *)\n (*Node*) end2 => ok,\t\t(* edge endpoint 2 *"
& ")\n (*Vertex*) c1 => ok,\t\t(* control point 1 (or \"ok\" if straight "
& "edge *)\n (*Vertex*) c2 => ok,\t\t(* control point 2 (or \"ok\" if str"
& "aight edge *)\n (*GraphVBT.Edge*) e => ok,\t(* the (thin blue) graph e"
& "dge *)\n (*[Edge]*) edge => ok,\t(* array of NumColors Edge objects *)"
& "\n (*EdgeEntry*) next => ok,\t(* pointer to next entry in hash table *"
& ")\n\n init =>\n meth(sel";
CONST E71_2 =
"f, (*int*) id, (*Node*) src, dest, (*Vertex*) c1, c2)\n self.id :="
& " id;\n self.end1 := src;\n self.end2 := dest;\n self.e :"
& "= graph_newEdge(src.v, dest.v);\n if (c1 isnot ok) andif (c2 isnot"
& " ok) then\n self.c1 := c1; self.c2 := c2;\n graph_moveEdg"
& "eBezier(self.e, src.v, dest.v, c1, c2, false)\n end;\n graph_"
& "setEdgeColor(self.e, EdgeColor);\n self.edge := array_new(MaxNumCo"
& "lors, ok);\n self\n end,\n\n addEdge =>\n meth(self, (*grap"
& "hvbt*) g, (*int*) level, (*Node*) src, (*bool*) bezier)\n (* If ther"
& "e is already an edge in this entry at level \"level\", then return\n "
& " \"ok\". Otherwise, create a new edge, install it in the entry, and "
& "return\n it. *)\n var res = self.edge[level];\n if res "
& "is ok then\n (* no edge on this level yet; create new Edge and a"
& "nimate it *)\n res := clone(Edge).init(g, level, src, bezier);\n"
& " self.edge[level] := res;\n (* bring any other edges to f"
& "ront in reverse order *)\n var i = (level - 1);\n loop\n "
& " if i < 0 then exit end;\n if self.edge[i] isnot ok th"
& "en\n graph_edgeToFront(self.edge[i].e)\n end;\n "
& " i := i - 1\n end;\n res\n else\n ok\n "
& " end\n end\n}; (* EdgeEntry *)\n\nlet TableSize = 109;\n\nlet Tab"
& "leIterator = {\n (*int*) bkt => ok,\t\t(* current bucket *)\n (*[Edge"
& "Entry]*) bucket => ok,\t(* array of buckets *)\n (*EdgeEntry*) entry ="
& "> ok,\t(* current entry *)\n\n init => meth(self, (*[EdgeEntry]*) buck"
& "et)\n self.bkt := -1;\n self.bucket := bucket;\n self.entry :="
& " ok;\n self\n end,\n\n next =>\n meth(self) (* : EdgeEntry *)\n"
& " (* Return the next EdgeEntry in the table, or \"ok\" if there are n"
& "one. *)\n if self.entry isnot ok then self.entry := self.entry.nex"
& "t end;\n loop\n if self.entry isnot ok then exit end;\n "
& " self.bkt := self.bkt + 1;\n if self.bkt >= TableSize then ex"
& "it end;\n self.entry := self.bucket[self.bkt]\n end;\n "
& " self.entry\n ";
CONST E71_3 =
" end\n}; (* TableIterator *)\n\nlet EdgeTable = {\n (*[EdgeEntry] *) b"
& "ucket => ok,\t(* array of buckets *)\n\n init => meth(self) self.bucke"
& "t := array_new(TableSize, ok); self end,\n hash => meth(self, (*int*) "
& "val) val % TableSize end,\n\n addEntry =>\n meth(self, (*Node*) src"
& ", dest, (*Vertex*) c1, c2) (* : EdgeEntry *)\n (* Create and initial"
& "ize a new EdgeEntry and add it to \"self\"; return\n the new Edge"
& "Entry. *)\n let id = CantorPair(src.id, dest.id);\n let bkt ="
& " self.hash(id);\n var (*EdgeEntry*) entry = clone(EdgeEntry).init("
& "id, src, dest, c1, c2);\n entry.next := self.bucket[bkt];\n s"
& "elf.bucket[bkt] := entry;\n entry\n end,\n\n findEntry =>\n "
& " meth(self, (*int*) id) (* : EdgeEntry *)\n (* Returns the EdgeEntry"
& " with identifier \"id\", or \"ok\" if\n there is no such entry. *"
& ")\n var (*EdgeEntry*) entry = self.bucket[self.hash(id)];\n l"
& "oop\n if (entry is ok) orif (entry.id is id) then exit end;\n "
& " entry := entry.next\n end;\n entry\n end,\n\n iterat"
& "e =>\n meth(self) (* : TableIterator *)\n clone(TableIterator)."
& "init(self.bucket)\n end\n}; (* EdgeTable *)\n\nlet view = {\n graph"
& "vbt => graph_new(),\n (*bool*) bounded => false,\t(* bounded queue siz"
& "e?, set by StartGraph *)\n (*[Node]*) node => ok,\t(* allocated by Sta"
& "rtGraph *)\n (*font*) vertexFont => ok,\t(* set by StartGraph *)\n (*"
& "real*) maxNodeSize => ok,\t(* set by EndGraph *)\n (*real*) borderSize"
& " => ok,\t(* set by EndGraph *)\n (*real*) minPktSize => ok,\t(* smalle"
& "st packet, set by StartPackets *)\n (*real*) deltaPktSize => ok,\t(* p"
& "acket delta, set by StartPackets *)\n (*int*) numColors => ok,\t(* num"
& "ber of colors, set by StartPackets *)\n (*[Pkt]*) pkt => ok,\t\t(* all"
& "ocated by StartPackets *)\n (*bool*) pktsMoved => false,\t(* did any p"
& "ackets move this step? *)\n\n pktSize =>\n meth(self, (*int*) level"
& ")\n self.minPktSize + (float(level) * self.deltaPktSize)\n end,"
& "\n\n StartGraph =>\n meth(self, nodeCnt, unused, bounded, (*real*) "
& "xMax, (*real*) yM";
CONST E71_4 =
"ax)\n self.vertexFont := graph_newFont(self.graphvbt,\n \"H"
& "elvetica\", 0.5, \"Roman\", \"bold\", \"*\");\n graph_setWorld(sel"
& "f.graphvbt, 0.0, xMax, yMax, 0.0);\n graph_setAspect(self.graphvbt"
& ", yMax / xMax);\n self.bounded := bounded;\n self.node := arr"
& "ay_new(nodeCnt, ok);\n EdgeTable.init()\n end,\n\n NewNode =>\n"
& " meth(self, id, (*real*) x, (*real*) y)\n self.node[id] := clon"
& "e(Node).init(self.graphvbt, id, x, y)\n end,\n\n NewStraightEdge =>"
& "\n meth(self, (*int*) id1, id2)\n EdgeTable.addEntry(self.node["
& "id1], self.node[id2], ok, ok)\n end,\n\n NewCurvedEdge =>\n meth"
& "(self, (*int*) id1, id2, (*real*) x1, y1, x2, y2)\n let NewControl"
& " = proc((*real*) x, y)\n let res = graph_newVertex(self.graphvbt"
& ");\n graph_setVertexSize(res, 0.0, 0.0);\n graph_moveVert"
& "ex(res, x, y, false);\n res\n end;\n let c1 = NewContr"
& "ol(x1, y1);\n let c2 = NewControl(x2, y2);\n EdgeTable.addEnt"
& "ry(self.node[id1], self.node[id2], c1, c2)\n end,\n\n NewLabel => m"
& "eth (self, label, x, y)\n let vl = graph_newVertex(self.graphvbt);\n"
& " graph_setVertexFont(vl, self.vertexFont);\n graph_setVertexSize("
& "vl, 0.5, 0.5);\n graph_setVertexColor(vl, BackgroundColor);\n gra"
& "ph_moveVertex(vl, x, y, false);\n graph_setVertexLabel(vl, label);\n"
& " graph_setVertexLabelColor(vl, LabelColor);\n end,\n\n EndGraph =>"
& "\n meth(self)\n let distance = proc(pt1, pt2)\n let dx ="
& " pt2[1] - pt1[1], dy = pt2[0] - pt1[0];\n (dx * dx) + (dy * dy)\n"
& " end;\n (* set \"minDst\" to minimum distance between nodes *"
& ")\n var minDst = ok;\n minDst := distance(self.node[0].pos, s"
& "elf.node[1].pos);\n for i = 0 to #(self.node) - 1 do\n\tlet pos1 ="
& " self.node[i].pos;\n\tfor j = (i + 1) to #(self.node) - 1 do\n\t let c"
& "urDst = distance(pos1, self.node[j].pos);\n\t if curDst < minDst then "
& "minDst := curDst end\n\tend\n end;\n minDst := math_sqrt(minD"
& "st);\n (* set \"maxNodeSize\", \"borderSize\", \"deltaPktSize\", \""
& "minPktSize\" *)\n ";
CONST E71_5 =
" self.maxNodeSize := minDst * 0.7;\n self.borderSize := self.maxNo"
& "deSize / 20.0;\n (* set node sizes *)\n for i = 0 to #(self.n"
& "ode) - 1 do\n\tself.node[i].setSize(self.maxNodeSize, self.borderSize *"
& " 1.5);\n end;\n end,\n\n StartPackets =>\n meth(self, numPk"
& "ts)\n let min = proc(i, j) if i < j then i else j end end;\n "
& "self.numColors := min(MaxNumColors, numPkts);\n self.deltaPktSize "
& ":= self.maxNodeSize / (float(self.numColors)+3.0);\n self.minPktSi"
& "ze := 1.5 * self.deltaPktSize;\n self.pkt := array_new(numPkts, ok"
& ");\n (* set edge widths *)\n var it = EdgeTable.iterate();\t("
& "* table iterator *)\n var entry = ok;\t\t\t(* edge entry *)\n "
& " let edgeWidth = self.minPktSize / 2.0;\n loop\n entry := i"
& "t.next();\n if entry is ok then exit end;\n graph_setEdge"
& "Width(entry.e, edgeWidth)\n end\n end,\n\n NewPacket =>\n m"
& "eth(self, (*int*) id, (*int*) src, (*int*) dest, unused1, unused2)\n "
& " let level = id % self.numColors;\n let pkt = clone(Pkt).init(se"
& "lf.graphvbt, level, self.node[src].pos);\n pkt.setSize(self.pktSiz"
& "e(level), self.borderSize);\n self.pkt[id] := pkt\n end,\n\n E"
& "ndPackets =>\n meth(self)\n (* stack the packets from back to f"
& "ront *)\n let n = #(self.pkt);\n for i = 0 to self.numColors "
& "- 1 do\n var j = (self.numColors - 1) - i;\n loop\n "
& " if j >= n then exit end;\n graph_vertexToFront(self.pkt[j]"
& ".v);\n j := j + self.numColors\n end\n end;\n "
& " graph_redisplay(self.graphvbt)\n end,\n\n MovePacket =>\n meth("
& "self, (*int*) id, (*int*) src, dest)\n let pos = self.node[dest].p"
& "os;\n let level = id % self.numColors;\n self.pktsMoved := tr"
& "ue;\n let entry = EdgeTable.findEntry(CantorPair(src, dest));\n "
& " let bezier = (entry.c1 isnot ok) and (entry.c2 isnot ok);\n let"
& " edge = entry.addEdge(self.graphvbt, level, self.node[src], bezier);\n "
& " if edge isnot ok then\n edge.setSize(self.pktSize(level));\n"
& " ";
CONST E71_6 =
" if not(bezier) then\n graph_moveVertex(self.pkt[id].v, pos"
& "[0], pos[1], true);\n edge.grow(pos)\n else\n "
& "var c1 = entry.c1, c2 = entry.c2, t = ok;\n if src isnot entry"
& ".end1.id then\n t := c1; c1 := c2; c2 := t\n end;\n"
& " let c1Pos = graph_getVertexPosition(c1);\n let c2Pos"
& " = graph_getVertexPosition(c2);\n graph_moveVertexOnPath(self."
& "pkt[id].v, MakeBezierPathProc(\n [self.node[src].pos, c1Pos,"
& " c2Pos, pos]));\n edge.growBezier(pos, c1Pos, c2Pos)\n "
& "end\n end\n end,\n\n QueueSizes =>\n meth(self, (*UNUSED*) "
& "queueSizes)\n if self.pktsMoved then\n self.pktsMoved := fa"
& "lse;\n zeus_animate(self.graphvbt, 0.0, 1.0)\n end\n end"
& "\n};\n";
CONST E72 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Sort"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) (S"
& "hape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue 4"
& ")\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorithm"
& " events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus event"
& "s\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to e"
& "vents\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height 20"
& "0 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E73 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Rim (Pen 10)"
& " \n (Radio =fromSample (VBox \n (Choice %fromSample (Text LeftAlign"
& " \"Sample data file\"))\n (Glue 10)\n (Choice %fromFile (Text L"
& "eftAlign \"Select data file:\"))\n (Glue 5) \n (Border (Shape (He"
& "ight 100) (FileBrowser %graphdata))))))\n";
CONST E74 =
"(* Copyright (C) 1994, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* Last modified on Mon Jan 9 "
& "12:04:37 PST 1995 by najork *)\n(* modified on F"
& "ri Aug 19 15:37:51 PDT 1994 by heydon *)\n(* mod"
& "ified on Tue Jun 14 12:28:51 PDT 1994 by shillner *)\n\n"
& "(* Tree.obl -- tree view for Union-Find *)\n\nlet NodeBgColor = c"
& "olor_named(\"Green\");\nlet NodeFgColor = color_named(\"Black\");"
& "\nlet NormalEdgeColor = color_named(\"Black\");\nlet HiliteEdgeColor "
& " = color_named(\"Red\");\nlet RankBarBgColor = color_named(\"Red\")"
& ";\nlet RankBarFgColor = color_named(\"Black\");\n\n(* Hilite colors "
& "*)\nlet SelectHiLiColor = color_named(\"Orange\");\nlet DoFindUpHiLiC"
& "olor = color_named(\"Red\");\nlet DoFindDnHiLiColor = color_named(\"Pur"
& "ple\");\nlet FoundHiLiColor = color_named(\"Blue\");\nlet NodeHilite"
& "BgColor = color_named(\"Red\");\n\nlet NodeSz = 1.0;\nlet FontSz = 0."
& "4;\nlet Margin = 5.0; (* in mm *)\nlet VGap = NodeSz * 1."
& "0; (* vertical gap between levels *)\nlet HGap = NodeSz * 0.2; (* "
& "horizontal gap between siblings *)\nlet RankH = NodeSz * 0.25; (* hei"
& "ght of rank bars *)\nlet RankW = NodeSz * 1.0; (* width of each rank"
& " unit *)\nlet RankGap = NodeSz * 0.25; (* gap between root and rank bar"
& "s *)\nlet RankY = RankGap + ((NodeSz + RankH)/ 2.0);\n\n(* The \"VGap"
& "\" is the distance between the bottoms of nodes on level \"i\"\n and "
& "the tops of nodes on level \"i+1\". The \"HGap\" is the gap between the"
& "\n right edge of a node and the left edge of its right sibling. *)\n\n"
& "let BorderWidth = NodeSz * 0.05;\nlet ThinEdgeWidth = NodeSz * 0.05;\n"
& "let FatEdgeWidth = NodeSz * 0.2;\nlet FoundHiLiSz = NodeSz * 0.08;\n"
& "let FindHiLiSz = NodeSz * 0.14;\nlet SelectHiLiSz = NodeSz * 0.20;\n"
& "\n(* Node Ob";
CONST E74_0 =
"ject (to be cloned) ============================================= *)\n\n"
& "let Node = {\n v: Vertex => ok, (* The Vertex *)\n e: Edge => "
& "ok, \t (* The Edge to the parent *)\n parent: Node => ok, ("
& "* parent node *)\n children: Node => ok, (* leftmost child node *)\n"
& " height: Int => 0, \t (* height of tree rooted at this node *)\n x: "
& "Real => ok, (* x-coordinate of this node *)\n next => ok, "
& " \t (* ids of next and previous siblings *)\n prev => ok,\n rank: "
& "Int => 0,\n rankBar: Vertex => ok, (* the vertex of this node\'s rank"
& " bar (if any) *)\n\n lastChild => meth(parent: Node): Node,\n (* Retu"
& "rns the rightmost child of \"parent\", or \"ok\" if \"parent\"\n is"
& " a leaf. *)\n var curr: Node = parent.children;\n if curr isnot o"
& "k then\n loop\n if curr.next is ok then exit end;\n "
& "curr := curr.next\n end;\n curr\n else\n ok\n end\n"
& " end,\n\n incHeightToRoot => meth(parent, child: Node): Ok,\n (* the"
& " \"child\" of \"parent\" has just grown in height; grow \"parent\" and\n"
& " all nodes on the path from it to the root of the tree in height as"
& "\n necessary. *)\n if (child.height + 1) > parent.height then\n "
& " parent.height := (child.height + 1);\n if parent.parent isnot"
& " ok then\n parent.parent.incHeightToRoot(parent)\n end\n "
& " end;\n ok\n end,\n\n addChild => meth(parent, rightOf, child: Nod"
& "e): Ok,\n (* Adds child as a child of parent, inserted to the right of"
& " \n the child \"rightOf\", which must be a child of parent, or as\n"
& " the leftmost child if rightOf is ok *)\n if rightOf is ok then\n"
& " child.next := parent.children;\n child.prev := ok;\n if"
& " child.next isnot ok then child.next.prev := child end;\n parent.c"
& "hildren := child;\n else\n child.prev := rightOf;\n child."
& "next := rightOf.next;\n if (child.next isnot ok) then child.next.p"
& "rev := child end;\n rightOf.next := child;\n end;\n child.pa"
& "rent := parent;\n parent.incHeightToRoot(child);\n ok\n end,\n\n"
& " updateHeight =>";
CONST E74_1 =
" meth(parent: Node): Ok,\n (* update the height of \"parent\" to be on"
& "e greater than the maximum heights\n of its children, or 0 if it ha"
& "s no children. *)\n var maxHt: Int = ~1;\n var ch: Node = parent."
& "children;\n loop\n if ch is ok then exit end;\n if ch.heig"
& "ht > maxHt then maxHt := ch.height end;\n ch := ch.next\n end;\n"
& " parent.height := (maxHt + 1);\n ok\n end,\n\n decHeightToRoot "
& "=> meth(parent: Node, oldChHeight: Int): Ok,\n (* some child of \"pare"
& "nt\" has just decreased in height from \"oldChHeight\",\n so update"
& " the height of the \"parent\" if necessary and those of all\n nodes"
& " on the path to the root. *)\n if parent.height is (oldChHeight + 1)"
& " then\n var oldParHeight: Int = parent.height;\n parent.updat"
& "eHeight();\n if (parent.height < oldParHeight) and (parent.parent "
& "isnot ok) then\n parent.parent.decHeightToRoot(oldParHeight)\n "
& " end\n end;\n ok\n end,\n\n removeChild => meth(parent, chil"
& "d: Node): Ok,\n (* removes child from parent, which must be its parent"
& " *)\n if child.prev isnot ok\n then child.prev.next := child.ne"
& "xt;\n else parent.children := child.next\n end;\n if child.n"
& "ext isnot ok then\n child.next.prev := child.prev\n end;\n c"
& "hild.prev := ok;\n child.next := ok;\n parent.decHeightToRoot(chi"
& "ld.height);\n ok\n end,\n\n isRightOf => meth(self, n: Node): Bool"
& ",\n (* Returns \"true\" iff \"self\" is a right sibling of \"n\". *)\n"
& " var curr: Node = n.next;\n loop\n if (curr is self) or (cur"
& "r is ok) then exit end;\n curr := curr.next\n end;\n (curr i"
& "s self)\n end,\n\n subtreeWidth => meth(self: Node): Real,\n (* Retu"
& "rns the width of the subtree rooted at \"self\". *)\n if self.childr"
& "en is ok then\n NodeSz\n else\n var res: Real = 0.0;\n "
& " var ch: Node = self.children;\n loop\n res := res + ch.su"
& "btreeWidth();\n if ch.next is ok then exit end;\n res := "
& "res + HGap;\n ch := ch.next\n end;\n res\n end\n e"
& "nd,\n\n position => meth(";
CONST E74_2 =
"self: Node, level: Int, offset: Real): Ok,\n let depth: Real = - flo"
& "at(level) * (NodeSz + VGap);\n graph_moveVertex(self.v, offset, dept"
& "h, true);\n self.x := offset;\n ok\n end,\n\n positionChildren "
& "=> meth(self: Node, level: Int, offset: Real): Real,\n var ch: Node "
& "= self.children;\n var res: Real = offset;\n loop\n if ch is"
& " ok then exit; end;\n res := ch.positionSubtree(level, res);\n "
& " if ch.next isnot ok then res := res + HGap; end;\n ch := ch.next"
& ";\n end;\n res;\n end,\n\n positionSubtree => meth(self: Node, "
& "level: Int, offset: Real): Real,\n (* Reposition all nodes in the subt"
& "ree rooted at \"self\", with the leftmost\n descendant at \"offset\""
& ", and the root at vertical position \"level\".\n Returns the x-coor"
& "dinate of the rightmost descendant. *)\n var res = offset;\n if s"
& "elf.children is ok\n then res := res + NodeSz;\n else res := "
& "self.positionChildren(level+1, res);\n end;\n self.position(level"
& ", (res + offset) / 2.0);\n res;\n end,\n};\n\n(* EdgeList Object =="
& "====================================================== *)\n\nlet EdgeLi"
& "st = {\n e: Edge => ok,\n next: EdgeList => ok,\n};\n\n(* View Object"
& " ============================================================ *)\n\nlet"
& " view: View = {\n\n (* Data members ----------------------------------"
& "----------------------- *)\n\n graphvbt => graph_new(),\n graphW: Rea"
& "l => ok, (* the width of the graphvbt *)\n usesRanks: Bool =>"
& " ok, (* \"usesRanks\" arg to \"Setup\" event *)\n nodeCnt: Int ="
& "> ok, (* number of nodes (not counting root) *)\n height: Int"
& " => ok, (* height of window *)\n root: Node => ok,\n last: "
& "Node => ok,\n node: [Node] => ok, (* array of nodes *)\n new"
& "Edge: Edge => ok, (* Edge added during a unite method *)\n bot"
& "hRoots: Bool => ok, (* are both nodes to \"Union\" roots? *)\n l"
& "abelFont: Font => ok, (* font for node labels *)\n upEdges: Edge"
& "List => ok, (* list of \"StepUp\" edges *)\n seenStepDown: Bool =>"
& " ok, (* a";
CONST E74_3 =
"ny \"StepDown\" events after \"Found\"? *)\n findVh: VertexHiLi => ok,"
& "\n doFindVh: VertexHiLi => ok,\n unionVh1: VertexHiLi => ok,\n union"
& "Vh2: VertexHiLi => ok,\n foundVh: VertexHiLi => ok,\n firstRootVh: Ve"
& "rtexHiLi => ok,\n\n (* The \"height\" field is the height of the large"
& "st tree that can fit in the\n window; it is only ever increased. Fo"
& "r \"view: View\", the system maintains\n the invariant: \"view.root"
& ".height <= view.height\". *)\n\n (* Layout method --------------------"
& "------------------------------------ *)\n\n repositionAll => meth(self"
& ": View): Ok,\n (* Layout all nodes of the tree rooted at the virtual r"
& "oot node\n \"self.root\". *)\n if self.root.children isnot ok th"
& "en\n var childrenW: Real = 0.0;\n var numCh: Int = 0;\n "
& "var ch: Node = self.root.children;\n loop\n childrenW := ch"
& "ildrenW + ch.subtreeWidth();\n numCh := numCh + 1;\n if c"
& "h.next is ok then exit end;\n ch := ch.next\n end;\n v"
& "ar gap: Real = 0.0;\n if numCh > 1 then\n gap := (self.grap"
& "hW - childrenW) / float(numCh - 1)\n end;\n ch := self.root.c"
& "hildren;\n var res: Real = - (NodeSz / 2.0);\n loop\n \t"
& "if ch is ok then exit end;\n \tres := ch.positionSubtree(0, res);\n"
& " \tif ch.next isnot ok then res := res + gap end;\n \tch := c"
& "h.next\n end\n end;\n ok\n end,\n\n repositionRanks => met"
& "h(self: View): Ok,\n (* Reposition the rank bar vertices of those node"
& "s that are children of\n \"self.root\". This procedure just moves t"
& "he necessary vertices; it doesn\'t\n animate them. *)\n var ch ="
& " self.root.children;\n loop\n if (ch is ok) then exit end;\n "
& " let rankX = graph_getVertexPosition(ch.rankBar)[0];\n if (ch.x "
& "isnot rankX) then\n graph_moveVertex(ch.rankBar, ch.x, RankY, tr"
& "ue)\n end;\n ch := ch.next\n end;\n ok\n end,\n\n set"
& "World => meth(self: View): Ok,\n let rad: Real = NodeSz / 2.0;\n "
& "let ht: Real = (float(self.height) * (NodeSz + VGap)) - VGap;\n var "
& "north: Real = rad;\n ";
CONST E74_4 =
" if self.usesRanks then north := north + RankGap + RankH end;\n gra"
& "ph_setWorld(self.graphvbt,\n (* east = *) - rad, (* west = *) (- r"
& "ad) + self.graphW,\n (* north= *) north, (* south= *) rad + (- ht)"
& ");\n ok\n end,\n\n (* Setup --------------------------------------"
& "-------------------------- *)\n\n Setup => meth(self: View): Ok,\n "
& "graph_setMargin(self.graphvbt, Margin);\n self.nodeCnt := 0;\n se"
& "lf.root := clone(Node);\n self.last := ok;\n self.labelFont := gr"
& "aph_newFont(self.graphvbt, \"Helvetica\", FontSz,\n \"Roman\", \"b"
& "old\", \"*\");\n ok\n end,\n\n NewSet => meth(self: View, nm: Text"
& "): Ok,\n let v = graph_newVertex(self.graphvbt);\n graph_setVerte"
& "xShape(v, \"ellipse\");\n graph_setVertexSize(v, NodeSz, NodeSz);\n "
& " graph_setVertexFont(v, self.labelFont);\n graph_setVertexLabel(v,"
& " nm);\n graph_setVertexLabelColor(v, NodeFgColor);\n graph_setVer"
& "texBorder(v, BorderWidth);\n graph_setVertexColor(v, NodeBgColor);\n"
& " var n: Node = clone(Node);\n self.nodeCnt := self.nodeCnt + 1;\n"
& " n.v := v;\n self.root.addChild(self.last, n);\n self.last := "
& "n;\n ok\n end,\n\n FinishedSets => meth(self: View, numSets: Int, "
& "usesRanks: Bool): Ok,\n (* initialize coordinate system *)\n self"
& ".height := real_ceiling(math_log(float(numSets))) + 1;\n self.graphW"
& " := (float(numSets) * (NodeSz + HGap)) - HGap;\n self.usesRanks := u"
& "sesRanks;\n self.setWorld();\n\n (* initialize nodes *)\n self"
& ".node := array_new(numSets, ok);\n var curr: Node = self.root.childr"
& "en;\n for i = 0 to numSets - 1 do\n self.node[i] := curr;\n "
& " curr := curr.next\n end;\n self.repositionAll();\n\n (* init"
& "ialize rank bars *)\n if usesRanks then\n for i = 0 to numSets "
& "- 1 do\n let node = self.node[i];\n let v = graph_newVert"
& "ex(self.graphvbt);\n node.rankBar := v;\n \tgraph_setVertex"
& "Shape(v, \"rectangle\");\n \tgraph_setVertexSize(v, RankW * 0.1, R"
& "ankH);\n \tgraph_setVertexBorderColor(v, RankBarFgColor);\n \t"
& "graph_setVertexBo";
CONST E74_5 =
"rder(v, BorderWidth);\n \tgraph_setVertexColor(v, RankBarBgColor);"
& "\n graph_moveVertex(v, node.x, RankY, false);\n end\n en"
& "d;\n zeus_animate(self.graphvbt, 0.0, 0.0);\n ok\n end,\n\n (* "
& "Find events ---------------------------------------------------------- "
& "*)\n\n StartFind => meth(self: View, id: Int): Ok,\n self.findVh :="
& " graph_newVertexHiLi(self.node[id].v);\n graph_setVertexHiLiColor(se"
& "lf.findVh, SelectHiLiColor);\n graph_setVertexHiLiBorder(self.findVh"
& ", SelectHiLiSz, SelectHiLiSz);\n ok\n end,\n\n EndFind => meth(sel"
& "f: View, id: Int): Ok,\n graph_removeVertexHiLi(self.findVh);\n g"
& "raph_removeVertexHiLi(self.foundVh);\n graph_redisplay(self.graphvbt"
& ");\n ok\n end,\n\n (* DoFind events ------------------------------"
& "-------------------------- *)\n\n StartDoFind => meth(self, id): Ok,\n"
& " self.doFindVh := graph_newVertexHiLi(self.node[id].v);\n graph_s"
& "etVertexHiLiColor(self.doFindVh, DoFindUpHiLiColor);\n graph_setVert"
& "exHiLiBorder(self.doFindVh, FindHiLiSz, FindHiLiSz);\n graph_redispl"
& "ay(self.graphvbt);\n self.upEdges := ok;\n ok\n end,\n\n StepUp"
& " => meth(self, child, parent): Ok,\n (* move vertex hilite up *)\n "
& " graph_moveVertexHiLi(self.doFindVh, self.node[parent].v, true);\n "
& "zeus_animate(self.graphvbt, 0.0, 1.0);\n\n (* make edge thick *)\n "
& " let upEdge = self.node[child].e;\n graph_setEdgeWidth(upEdge, FatE"
& "dgeWidth);\n graph_redisplay(self.graphvbt);\n\n (* add edge to u"
& "p-edge list *)\n var el: EdgeList = clone(EdgeList);\n el.e := up"
& "Edge;\n el.next := self.upEdges;\n self.upEdges := el;\n ok\n "
& " end,\n\n Found => meth(self, root): Ok,\n self.foundVh := graph_ne"
& "wVertexHiLi(self.node[root].v);\n graph_setVertexHiLiColor(self.foun"
& "dVh, FoundHiLiColor);\n graph_setVertexHiLiBorder(self.foundVh, Foun"
& "dHiLiSz, FoundHiLiSz);\n graph_redisplay(self.graphvbt);\n self.s"
& "eenStepDown := false;\n ok\n end,\n\n StepDown => meth(self: View,"
& " childId, parentId: Int): Ok,\n let child: Node = self.node[childId]"
& ";\n\n ";
CONST E74_6 =
" (* change hili color if necessary *)\n if not(self.seenStepDown) th"
& "en\n self.seenStepDown := true;\n graph_setVertexHiLiColor(se"
& "lf.doFindVh, DoFindDnHiLiColor);\n end;\n\n (* move hilight down "
& "*)\n graph_moveVertexHiLi(self.doFindVh, child.v, true);\n zeus_a"
& "nimate(self.graphvbt, 0.0, 1.0);\n\n (* make edge thin again *)\n "
& " graph_setEdgeWidth(child.e, ThinEdgeWidth);\n graph_redisplay(self."
& "graphvbt);\n ok\n end,\n\n ChangeParent => meth(self: View, childI"
& "d, parentId, rootId: Int): Ok,\n let child: Node = self.node[childId"
& "];\n let parent: Node = self.node[parentId];\n let root: Node = s"
& "elf.node[rootId];\n\n (* change tree structure *)\n var rightOf: "
& "Node = parent;\n if parent.children is child then rightOf := rightOf"
& ".prev end;\n parent.removeChild(child);\n root.addChild(rightOf, "
& "child);\n\n (* move the edge and subtree *)\n graph_moveEdge(chil"
& "d.e, child.v, root.v, true);\n self.repositionAll();\n if self.us"
& "esRanks then self.repositionRanks() end;\n zeus_animate(self.graphvb"
& "t, 0.0, 1.0);\n ok\n end,\n\n EndDoFind => meth(self, id): Ok,\n "
& " if not(self.seenStepDown) then\n var curr: EdgeList = self.upEdg"
& "es;\n loop\n if curr is ok then exit end;\n graph_se"
& "tEdgeWidth(curr.e, ThinEdgeWidth);\n curr := curr.next\n en"
& "d\n end;\n graph_removeVertexHiLi(self.doFindVh);\n graph_redi"
& "splay(self.graphvbt);\n ok\n end,\n\n (* Union events ------------"
& "--------------------------------------------- *)\n\n StartUnion => met"
& "h(self: View, id1, id2: Int, bothRoots: Bool): Ok,\n self.bothRoots "
& ":= bothRoots;\n self.unionVh1 := graph_newVertexHiLi(self.node[id1]."
& "v);\n self.unionVh2 := graph_newVertexHiLi(self.node[id2].v);\n g"
& "raph_setVertexHiLiColor(self.unionVh1, SelectHiLiColor);\n graph_set"
& "VertexHiLiColor(self.unionVh2, SelectHiLiColor);\n graph_setVertexHi"
& "LiBorder(self.unionVh1, SelectHiLiSz, SelectHiLiSz);\n graph_setVert"
& "exHiLiBorder(self.unionVh2, SelectHiLiSz, SelectHiLiSz);\n graph_red";
CONST E74_7 =
"isplay(self.graphvbt);\n self.newEdge := ok;\n ok\n end,\n\n Fo"
& "undFirst => meth(self: View, root1: Int): Ok,\n self.firstRootVh := "
& "self.foundVh;\n ok\n end,\n\n CompareRanks => meth(self: View, id1"
& ", id2: Int): Ok,\n ok\n end,\n\n Unite => meth(self: View, childId"
& ", parentId, pRank: Int): Ok,\n let child: Node = self.node[childId];"
& "\n let parent: Node = self.node[parentId];\n\n (* create and anim"
& "ate the new edge *)\n self.newEdge := graph_newEdge(child.v, parent."
& "v);\n child.e := self.newEdge;\n graph_setEdgeWidth(self.newEdge,"
& " FatEdgeWidth);\n graph_setEdgeColor(self.newEdge, HiliteEdgeColor);"
& "\n\n (* update the graph structure *)\n var rightOf: Node = ok;\n"
& " if child.isRightOf(parent)\n then rightOf := parent.lastChild("
& ")\n else rightOf := ok\n end;\n self.root.removeChild(child)"
& ";\n parent.addChild(rightOf, child);\n\n (* make coordinate syste"
& "m larger if necessary *)\n if self.root.height > self.height then\n "
& " self.height := self.root.height;\n self.setWorld();\n gr"
& "aph_redisplay(self.graphvbt)\n end;\n\n (* animate the subtree mo"
& "tion *)\n self.repositionAll();\n if self.usesRanks then\n g"
& "raph_removeVertex(child.rankBar);\n graph_setVertexSize(parent.ran"
& "kBar, float(pRank) * RankW, RankH);\n self.repositionRanks()\n "
& "end;\n zeus_animate(self.graphvbt, 0.0, 1.0);\n ok\n end,\n\n E"
& "ndUnion => meth(self): Ok,\n if self.newEdge isnot ok then\n gr"
& "aph_setEdgeWidth(self.newEdge, ThinEdgeWidth);\n graph_setEdgeColo"
& "r(self.newEdge, NormalEdgeColor);\n end;\n graph_removeVertexHiLi"
& "(self.unionVh1);\n graph_removeVertexHiLi(self.unionVh2);\n if no"
& "t(self.bothRoots) then\n graph_removeVertexHiLi(self.foundVh);\n "
& " graph_removeVertexHiLi(self.firstRootVh);\n end;\n graph_redi"
& "splay(self.graphvbt);\n ok\n end,\n};\n";
CONST E75 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n\n\nlet view = {\n graphvbt => graph_new"
& "(),\n\n myPlayer => ok,\n\n activePlayer => ok,\n\n makeNodeProc => "
& "proc (graphvbt, rawBoard)\n { objects => \n ( var res = [[(let v ="
& " graph_newVertex(graphvbt);\n graph_setVertexSize(v"
& ", 1.0, 1.0);\n graph_setVertexColor(v, color_rgb(1."
& "0, 1.0 , 1.0));\n graph_setVertexBorder(v, 0.125);\n"
& " graph_setVertexBorderColor(v, color_rgb(0.0, 0.0, "
& "0.0));\n v),\n 0.0,\n "
& " 0.0\n ]];\n for cellNum = 0 to 8 do\n "
& " if rawBoard[cellNum] isnot 2 then\n let piece = grap"
& "h_newVertex(graphvbt);\n graph_setVertexSize(piece, 0.25"
& ", 0.25);\n if rawBoard[cellNum] is 0 then\n "
& " graph_setVertexColor(piece, color_rgb(0.0, 1.0, 0.0));\n "
& " else\n graph_setVertexColor(piece, color_rgb(0"
& ".0, 0.0, 1.0));\n end;\n res := res @ [[p"
& "iece, float((cellNum / 3)-1) * 0.25, \n "
& " float((cellNum % 3)-1) * 0.25]]\n end;\n end;\n "
& " res;\n ),\n Move => \n meth(self, Xbase, Ybase, anim"
& "ate)\n foreach object in self.objects do\n graph_mov"
& "eVertex(object[0], Xbase + object[1], Ybase + object[2],\n "
& " animate);\n end;\n end,\n\n SetValue =>\n met"
& "h (self, newValue)\n graph_setVertexBorderColor( self.objects[0"
& "][0],\n color_hsv( ((float(newValue+10)) / 21.0) * 0.7, 1.0"
& ", 1.0));\n end,\n }\n end,\n\n treeDisplayParams => ok,\n\n ma"
& "keTreeNode =>\n meth(self, dparams, initNode, NodeWidth, initX, ini"
& "tY, myKey, board)\n let newNode =\n {\n key =>";
CONST E75_0 =
" myKey,\n displayParameters => dparams,\n node =>"
& " initNode(dparams.graphvbt, board),\n nodeWidth => NodeWidth"
& ",\n width => NodeWidth,\n leftx => initX,\n "
& " depth => 0,\n vertex => ( let v = graph_newVertex(dpar"
& "ams.graphvbt);\n graph_setVertexSize(v, 0.0, 0.0"
& " );\n v ),\n children => [],\n "
& " childWidth => 0.0,\n parent => ok,\n\n xPos "
& "=> initX + (NodeWidth /2.0),\n yPos => initY,\n\n "
& " AddChild =>\n meth(self, child)\n self.chi"
& "ldren := self.children @ [child];\n child.parent := self"
& ";\n child.depth := self.depth + 1;\n(*** WAS: chil"
& "d.yPos := self.displayParameters.depth2Y()(self.depth+1);*)\n "
& " let d2Y = self.displayParameters.depth2Y;\n child."
& "yPos := d2Y(self.depth+1);\n if #(self.children) > 1 the"
& "n\n self.childWidth := self.childWidth +\n "
& " self.displayParameters.spacer;\n end;\n "
& " child.SetLeftX(self.leftx + self.childWidth);\n "
& " self.childWidth := self.childWidth + child.width;\n let"
& " e = graph_newEdge(self.vertex, child.vertex);\n graph_s"
& "etEdgeWidth(e, self.displayParameters.edgeWidth);\n if s"
& "elf.childWidth > self.nodeWidth then\n self.width := s"
& "elf.childWidth;\n if self.parent isnot ok then\n "
& " self.parent.ChildWidthChange(self);\n e"
& "nd;\n self.xPos := self.leftx + (self.width / 2.0);\n "
& " self.MoveMe();\n end; \n e"
& "nd,\n\n MoveMe =>\n meth(self)\n "
& "var reSizeWorld = false;\n if (self.xPos > self.displayPa"
& "rameters.WorldE) then\n self.displayParameters.WorldE "
& ":= \n self.displayParameters.WorldE + \n";
CONST E75_1 =
" self.displayParameters.WorldStep;\n "
& " reSizeWorld := true;\n end;\n if (self."
& "yPos > self.displayParameters.WorldS) then\n self.disp"
& "layParameters.WorldS := \n self.displayParameters."
& "WorldS + \n self.displayParameters.WorldStep;\n "
& " reSizeWorld := true;\n end;\n "
& " if reSizeWorld then\n graph_setWorld(self.displayPar"
& "ameters.graphvbt, 0.0, \n self.displayParameters.Wo"
& "rldE, 0.0, \n self.displayParameters.WorldS);\n "
& " graph_setAspect(self.displayParameters.graphvbt,\n "
& " self.displayParameters.WorldS/\n se"
& "lf.displayParameters.WorldE);\n graph_redisplay(self.d"
& "isplayParameters.graphvbt);\n end;\n graph_"
& "moveVertex(self.vertex, self.xPos, self.yPos, true);\n se"
& "lf.node.Move(self.xPos, self.yPos, true);\n end,\n\n "
& " SetLeftX =>\n meth(self, newLeftX)\n s"
& "elf.leftx := newLeftX;\n var childX = self.leftx;\n "
& " foreach child in self.children do\n child.Set"
& "LeftX(childX);\n childX := childX + child.width + \n "
& " self.displayParameters.spacer;\n end"
& ";\n self.xPos := self.leftx + (self.width / 2.0);\n "
& " self.MoveMe()\n end,\n\n ChildWidthCha"
& "nge =>\n meth(self, guiltyChild)\n var chil"
& "dX = self.leftx;\n foreach child in self.children do\n "
& " if child.leftx isnot childX then\n "
& " child.SetLeftX(childX);\n end;\n "
& "childX := childX + child.width +\n self.displayPar"
& "ameters.spacer;\n end;\n self.childWidth "
& ":= childX - (self.leftx +\n self.displa";
CONST E75_2 =
"yParameters.spacer);\n if self.childWidth > self.nodeWid"
& "th then\n self.width := self.childWidth;\n "
& " if self.parent isnot ok then\n self.parent.C"
& "hildWidthChange(self);\n end;\n self."
& "xPos := self.leftx + (self.width / 2.0);\n self.MoveMe"
& "();\n end;\n end, \n "
& " };\n graph_moveVertex(newNode.vertex, newNode.xPos, newNo"
& "de.yPos, false);\n newNode.node.Move(newNode.xPos, newNode.yPos,"
& " false);\n graph_redisplay(self.graphvbt);\n newNode;\n "
& " end,\n\n lastBoard => ok,\n\n Init => \n meth (self, player)\n "
& " self.myPlayer := player;\n self;\n end,\n\n Setup =>\n "
& " meth (self)\n graph_setWorld(self.graphvbt, 0.0, 10.0, 0.0, 10.0)"
& ";\n graph_setAspect(self.graphvbt, 1.0);\n self.treeDisplayPa"
& "rams := { graphvbt => self.graphvbt,\n "
& " depth2Y => proc (depth)\n "
& " float((2*depth)+1)\n end,"
& "\n edgeWidth => 0.1,\n "
& " spacer => 0.25,\n Wo"
& "rldE => 10.0,\n WorldS => 10.0,\n "
& " WorldStep => 3.0};\n self.lastBoard :"
& "= ok;\n end,\n\n EvaluateNode =>\n meth (self, boardData)\n "
& " if self.activePlayer is self.myPlayer then\n var newNode = ok;\n"
& " if self.lastBoard is ok then\n newNode := self.makeTre"
& "eNode(self.treeDisplayParams, \n self.makeNodeProc, 1.0, 0.0,"
& " 1.0, boardData[0], boardData[1]);\n else\n var parent ="
& " self.lastBoard;\n newNode := self.makeTreeNode(self.treeDisp"
& "layParams, \n self.makeNodeProc, 1.0, self.lastBoard.xPos - "
& "0.5, \n self.lastBoard.yPos, boardData[0], boardData[1]);\n "
& " self.lastBoard.AddChild(newNode);\n end;\n sel";
CONST E75_3 =
"f.lastBoard := newNode;\n zeus_animate(self.graphvbt, 0.0, 1.0);\n"
& " end;\n end,\n\n PlayerThinking =>\n meth (self, player, bo"
& "ardData)\n self.activePlayer := player;\n if self.activePla"
& "yer is self.myPlayer then\n graph_clear(self.graphvbt);\n "
& " self.treeDisplayParams.WorldE := 10.0;\n self.treeDisplayPar"
& "ams.WorldS := 10.0;\n graph_setWorld(self.graphvbt, 0.0, 10.0, "
& "0.0, 10.0);\n graph_setAspect(self.graphvbt, 1.0);\n se"
& "lf.lastBoard := ok;\n end;\n end,\n\n FinishedEvalNode =>\n "
& " meth (self, boardkey)\n if self.activePlayer is self.myPlayer"
& " then\n self.lastBoard := self.lastBoard.parent;\n end;\n"
& " end,\n\n BoardValueUpdated =>\n meth (self, boardkey, newVal"
& "ue)\n if self.activePlayer is self.myPlayer then\n self.l"
& "astBoard.node.SetValue(newValue);\n graph_redisplay(self.graphv"
& "bt);\n end;\n end,\n\n }.Init(0);\n\n";
CONST E76 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file PQue"
& "ue.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) "
& "(Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue"
& " 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorit"
& "hm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus eve"
& "nts\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to"
& " events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height "
& "200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E77 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Scale\n (HS"
& "cale 1)\n (VScale 1)\n (Rim\n (Pen 10)\n (HBox\n (VBox\n "
& " (Text RightAlign \"# of buckets: \")\n (Text RightAlign \""
& "current item: \")\n (Text RightAlign \"comparing bucket #: \"))\n"
& " (VBox\n (Frame Chiseled (Text %NBuckets \"\"))\n (F"
& "rame Chiseled (Text %item \"\"))\n (Frame Chiseled (Text %bucket"
& " \"\"))))))";
CONST E78 =
"; Copyright (C) 1994, Digital Equipment Corporation "
& " \n; All rights reserved. "
& " \n; See the file COPYRIGHT for a full description. "
& " \n\n(Radio\n (VBox\n (Glue 6)\n (HBox\n "
& "(Glue 10)\n Fill\n (Choice %sort =TRUE \"Sorting\")\n Fi"
& "ll)\n (Glue 6)\n (HBox\n (Glue 10)\n (Shape (Width + 0)"
& " \"Number of items: \")\n (Glue 5)\n (Numeric (Min 1) (Max 10"
& "00) %N =15)\n (Glue 10))\n (Glue 8)\n (Bar)\n (Glue 8)\n "
& " (HBox\n (Glue 10)\n Fill\n (Choice %queue =FALSE \"Pr"
& "iority Queue\")\n Fill)\n (Glue 6)\n (HBox\n (Glue 10)\n"
& " (Shape (Width + 0) \"Maximum queue size: \")\n (Glue 5)\n "
& " (Numeric (Min 1) (Max 1000) %qSize =15)\n (Glue 10)\n Fill"
& ")\n (Glue 6)\n (HBox\n (Glue 10)\n (Shape (Width 60 + 0"
& " - 0) (Button %insert \"Insert\"))\n (Glue 10)\n (Numeric (Mi"
& "n 10) (Max 100) %inselt =20)\n Fill)\n (Glue 6)\n (HBox (Glu"
& "e 10) (Shape (Width 60 + 0 - 0) (Button %remove \"Remove\")) Fill)\n "
& " (Glue 6)))\n";
CONST E79 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file PktR"
& "oute.evt.\n;***********************************************************"
& "*********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4"
& ") (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Gl"
& "ue 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algor"
& "ithm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus e"
& "vents\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args "
& "to events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Heigh"
& "t 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E80 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* All"
& " rights reserved. *)\n(* See the f"
& "ile COPYRIGHT for a full description. *)\n\n@UnbalancedTest\n"
& "PROCEDURE UnbalancedTest(insKey, delKey: ARRAY OF Key)@ =\n VAR t: Tre"
& "e; n: Node; BEGIN\n (* Insert \"insKey\" keys *)\n @1 t.root := N"
& "IL@;\n @2 FOR i := FIRST(insKey^) TO LAST(insKey^) DO@\n @3 n :"
& "= NEW(Node, key := insKey[i])@;\n @4 Insert(t, n)@\n END;\n\n "
& " (* Delete \"delKey\" keys *)\n @5 FOR i := FIRST(delKey^) TO LAST("
& "delKey^) DO@\n @6 n := Search(alg, delKey[i])@;\n @7 Delete(a"
& "lg, n)@\n END;\n END UnbalancedTest;\n@UnbalancedTest\n\n@Insert\nP"
& "ROCEDURE Insert(t: Tree; n: Node)@ =\n VAR temp, curr: Node; BEGIN\n "
& " @3 temp := t.root;@\n @4 curr := NIL;@\n @5 WHILE temp # NIL DO"
& "@\n @6 curr := temp;@\n @7 IF n.key < curr.key@\n THEN"
& " @8 temp := curr.left@\n ELSE @9 temp := curr.right@\n END\n"
& " END;\n @10 n.parent := curr;@\n @11 IF curr = NIL@ THEN @12 t"
& ".root := n@ ELSE\n @13 IF n.key < curr.key@\n THEN @14 curr"
& ".left := n@\n ELSE @15 curr.right := n@\n END\n END\n E"
& "ND Insert;\n@Insert\n\n@Search\nPROCEDURE Search(t: Tree; k: Key): Node"
& "@ =\n VAR n: Node; BEGIN\n @1 n := t.root@;\n @2 WHILE n # NIL A"
& "ND n.key # key DO@\n @3 IF key < n.key@\n THEN @4 n := n.le"
& "ft@\n ELSE @5 n := n.right@\n END\n END;\n @6 RETURN "
& "n@\n END Search;\n@Search\n\n@Delete\nPROCEDURE Delete(t: Tree; n: Nod"
& "e)@ =\n VAR splice: Node; BEGIN\n (* Set \"splice\" to the node to "
& "splice out *)\n @1 IF n.left = NIL OR n.right = NIL@\n THEN @2 "
& "splice := n@\n ELSE @3 splice := FindMin(n.right)@\n END;\n\n "
& " (* Splice out \"splice\" node *)\n @4 SpliceOut(t, splice)@;\n\n "
& " (* Replace \"n\" by \"splice\" if necessary *)\n @5 IF splice # n@"
& " THEN\n @6 n.key := splice.key@\n (* << copy other node field"
& "s here >> *)\n END\n END Delete;\n@Delete\n\n@FindMin\nPROCEDURE Fi"
& "ndMin(n: Node): Node@ =\n BEGI";
CONST E80_0 =
"N\n @1 WHILE n.left # NIL DO@\n @2 n := n.left2@\n END;\n "
& " @3 RETURN n@\n END FindMin;\n@FindMin\n\n@SpliceOut\nPROCEDURE Splice"
& "Out(t: Tree; n: Node)@ =\n VAR ch: Node; BEGIN\n (* Set \"ch\" to c"
& "hild of \"n\" or NIL *)\n @1 IF n.left # NIL@\n THEN @2 ch := n"
& ".left@\n ELSE @3 ch := n.right@\n END;\n\n (* Update \"up\" "
& "pointer *)\n @4 IF ch # NIL@ THEN\n @5 ch.parent := n.parent@\n"
& " END;\n\n (* Update \"down\" pointers *)\n @6 IF n.parent = NI"
& "L@ THEN\n @7 t.root := ch@\n ELSE\n @8 IF n = n.parent.lef"
& "t@\n THEN @9 n.parent.left := ch@\n ELSE @10 n.parent.rig"
& "ht := ch@\n END\n END\n END SpliceOut;\n@SpliceOut\n";
CONST E81 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* A"
& "ll rights reserved. *)\n(* See t"
& "he file COPYRIGHT for a full description. *)\n\n@FirstFit\n"
& "void first_fit (B, N)@\nint B, N;\n{\n int i, b, bin;\n float wei"
& "ght, *bins, lost = 0.0;\n\n @1 bins = (float *) malloc(B * sizeof (f"
& "loat));@\n @2 for (b = 0; b < B; b++) bins[b] := 0.0;@\n @3 for ("
& "i = 0; i < N; i++) {@\n @4 weight = random_float () / 2.0;@\n "
& " for (@5 bin = 0@; \n @6 (bin < B) && (bins[bin] + weig"
& "ht > 1.0)@; \n @7 bin++@) /*EMPTY*/;\n @8 if (bin = "
& "B) @\n @9 lost += weight;@\n else\n @10 bi"
& "ns[bin] += weight;@\n }\n}\n@FirstFit\n";
CONST E82 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* Last modified on Mon Jan 9 "
& "12:22:11 PST 1995 by najork *)\n(* modified on W"
& "ed Oct 13 19:41:07 PDT 1993 by mann *)\n(* mod"
& "ified on Mon Jul 19 11:59:36 PDT 1993 by perl *)\n\n"
& "let codesColor = color_named(\"White\");\nlet codesLabelColor = color_n"
& "amed(\"Black\");\nlet codesHiliteLabelColor = color_named(\"DarkRed\");"
& "\nlet arrowColor = color_named(\"DarkRed\");\nlet rowIndexColor = color"
& "_named(\"Pink\");\nlet rowIndexLabelColor = color_named(\"Black\");\nle"
& "t otherIndexColor = color_named(\"White\");\nlet otherIndexLabelColor ="
& " color_named(\"DarkGray\");\nlet alphaColor = color_named(\"LightYellow"
& "\");\nlet alphaLabelColor = color_named(\"Black\");\nlet initialColor ="
& " color_named(\"DarkGray\");\nlet initialLabelColor = color_named(\"Blac"
& "k\");\nlet shadowColor = color_named(\"VerySlightlyLightGray\");\nlet s"
& "hadowLabelColor = color_named(\"Black\");\nlet ghostColor = color_named"
& "(\"White\");\nlet ghostLabelColor = color_named(\"Gray\");\nlet duplCol"
& "or = color_named(\"LightGray\");\nlet duplLabelColor = color_named(\"Ve"
& "ryDarkGray\");\n(*let matrixColor = color_named(\"VeryVeryLightGray\");"
& "*)\nlet matrixColor = color_named(\"White\");\nlet matrixLabelColor = c"
& "olor_named(\"RatherDarkGray\");\n\nlet charColorNames = [\"VerySlightly"
& "LightQuiteVividRed\",\n \"VerySlightlyDarkVividGre"
& "en\",\n \"SlightlyLightVividBlue\",\n "
& " \"ReddishVividOrange\",\n \"VerySlightlyL"
& "ightPurple\",\n \"VerySlightlyDarkVeryVividYellow\""
& "];\n\nlet charColors = foreach c in charColorNames map color_named(c) e"
& "nd;\n\nlet makeDippingPath = proc(startX, endX, y, dip)\n proc(t)\n "
& " [ (startX * (1.0 - t)) + (e";
CONST E82_0 =
"ndX * t),\n\t y + (dip * (0.25 - ((t - 0.5) * (t - 0.5))))]\n end\n"
& "end;\n\nlet interMatrixGap = 0.5;\nlet decodedY = ~2.0;\n\nlet view =\n"
& " {\n graphvbt => graph_new(),\n vertexFont => ok,\n last => {"
& "chars => ok, vtx => ok},\n first => {chars => ok, vtx => ok},\n p"
& "endingMoves => ok,\n n => 0,\n colorIndex => -1,\n rowIndices "
& "=> ok,\n rowIndex => ok,\n rowIndexVtx => ok,\n matrix1 => ok,"
& "\n matrix2 => ok,\n m1X => ok,\n rotations => ok,\n\n Rotat"
& "ionsSorted => meth(self, rotations, rowIndex)\n (* The matrix of rot"
& "ations, in sorted order; rowIndex is the index\n where the origin"
& "al string landed.\n *)\n\tself.rotations := rotations;\n self"
& ".n := #(rotations);\n\tself.m1X := -(float(self.n) + interMatrixGap);\n"
& "\tself.rowIndex := rowIndex;\n\n\tlet north = decodedY - 1.0,\n "
& " south = float(self.n),\n west = self.m1X - 1.0,\n "
& " east = float(self.n) + 1.0;\n\tgraph_setWorld(self.graphvbt, west,"
& " east, north, south);\n\tgraph_setAspect(self.graphvbt, (south - north)"
& " / (east - west));\n\tgraph_setPixelSizeDivisor(self.graphvbt,\n "
& " round(east - west),\n\t\t\t round(s"
& "outh - north));\n\n self.vertexFont := graph_newFont(self.graphv"
& "bt, \"Helvetica\",\n 0.5, \"Rom"
& "an\", \"bold\", \"*\");\n end, \n\n DecodeDone => meth(self, t"
& ", rowIndex)\n\t(* Create gray copies of sorted matrix but don\'t displa"
& "y yet *)\n\tself.matrix1 := array_new(self.n, ok);\n\tself.matrix2 := a"
& "rray_new(self.n, ok);\n\tfor i = 0 to self.n - 1 do\n\t self.matrix1"
& "[i] := array_new(self.n, ok);\n\t self.matrix2[i] := array_new(self."
& "n, ok);\n\t let t = self.rotations[i];\n\t for j = 0 to self.n - "
& "1 do\n\t\tlet v1 = graph_newVertex(self.graphvbt);\n\t\tgraph_setVertex"
& "Label(v1, text_sub(t, j, 1));\n\t\tgraph_setVertexFont(v1, self.vertexF"
& "ont);\n\t\tgraph_setVertexColor(v1, matrixColor);\n\t\tgraph_setVertexL"
& "abelColor(v1, matrixLabelColor);\n\t\tgraph_setVertexBorder(v1, 0.05);\n"
& "\n\t\tlet v2 = graph_newVertex(self.graphvbt);";
CONST E82_1 =
"\n\t\tgraph_setVertexLabel(v2, text_sub(t, j, 1));\n\t\tgraph_setVertex"
& "Font(v2, self.vertexFont);\n\t\tgraph_setVertexColor(v2, matrixColor);\n"
& "\t\tgraph_setVertexLabelColor(v2, matrixLabelColor);\n\t\tgraph_setVert"
& "exBorder(v2, 0.05);\n\t graph_vertexToBack(v2);\n\n\t\tgraph_mov"
& "eVertex(v1, self.m1X + float(j), float(i), false);\n\t\tgraph_moveVerte"
& "x(v2, float(j), float(i), false);\n\t\tgraph_setVertexSize(v1, 0.0, 0.0"
& ");\n\t\tgraph_setVertexSize(v2, 0.0, 0.0);\n\n\t\tself.matrix1[i][j] :="
& " v1;\n\t\tself.matrix2[i][j] := v2;\n\t end;\n end;\n\n\t(* C"
& "reate and display decoded lastchars *)\n self.last.chars := t;\n"
& " self.last.vtx := array_new(self.n, ok);\n for i = 0 to s"
& "elf.n - 1 do\n let v = graph_newVertex(self.graphvbt);\n "
& " self.last.vtx[i] := v;\n graph_setVertexLabel(v, tex"
& "t_sub(t, i, 1));\n graph_setVertexFont(v, self.vertexFont);\n"
& " graph_setVertexColor(v, initialColor);\n graph_s"
& "etVertexLabelColor(v, initialLabelColor);\n graph_setVertexB"
& "order(v, 0.05);\n graph_moveVertex(v, float(i), decodedY, fa"
& "lse);\n\t graph_setVertexSize(v, 0.95, 0.95);\n end;\n\tgraph"
& "_redisplay(self.graphvbt);\n end,\n\n StartReconstruct => meth(se"
& "lf, lastchars, rowIndex)\n (* Start of phase where we reconstruct th"
& "e original string from\n lastchars and rowIndex.\n *)\n\t(* M"
& "ove lastchars into a column *)\n for i = 0 to self.n - 1 do\n "
& " let v = self.last.vtx[i];\n\t graph_setVertexColor(self.las"
& "t.vtx[i], initialColor);\n\t graph_setVertexLabelColor(self.last.vtx"
& "[i], initialLabelColor);\n graph_moveVertex(v, self.m1X + fl"
& "oat(self.n - 1), float(i), true);\n\t let old = self.matrix1[i][self"
& ".n - 1];\n\t self.matrix1[i][self.n - 1] := v;\n(****\n\t let w ="
& " graph_newVertex(self.graphvbt);\n graph_moveVertex(w, float"
& "(i), decodedY, false);\n\t graph_setVertexLabel(w, text_sub(self.las"
& "t.chars, i, 1));\n\t graph_setVertexSize(w, 0.95, 0.95);\n\t grap"
& "h_setVertexColor(w, ghostCo";
CONST E82_2 =
"lor);\n graph_setVertexLabelColor(w, ghostLabelColor);\n "
& " graph_setVertexFont(w, self.vertexFont);\n graph_set"
& "VertexBorder(w, 0.05);\n****)\n\n zeus_animate(self.graphvbt"
& ", float(i)/float(self.n),\n (float(i)+1.0)/floa"
& "t(self.n));\n\t graph_removeVertex(old);\n end;\n end,\n\n"
& " Reveal => meth(self, which)\n (* Reveal one gray copy of sor"
& "ted matrix *)\n\tfor i = 0 to self.n - 1 do\n\t for j = 0 to self.n "
& "- 1 do\n\t\tif which is 1 then\n\t\t graph_setVertexSize(self.matrix"
& "1[i][j], 0.95, 0.95);\n\t\telse\n\t\t graph_setVertexSize(self.matri"
& "x2[i][j], 0.95, 0.95);\n\t end;\n\t end;\n\tend;\n\tgraph_red"
& "isplay(self.graphvbt);\n end,\n\n FirstChars => meth(self, t)\n "
& " (* Declare sorted firstchars array. *)\n\tself.first.chars := t;\n\ts"
& "elf.first.vtx := array_new(self.n, ok);\n self.pendingMoves := ["
& "];\n let tmp = array_new(self.n, ok);\n for i = 0 to self"
& ".n-1 do\n let v = graph_newVertex(self.graphvbt);\n "
& " graph_moveVertex(v, self.m1X + float(self.n-1), float(i), false);\n\t"
& " graph_setVertexLabel(v, text_sub(self.last.chars, i, 1));\n\t gr"
& "aph_setVertexSize(v, 0.95, 0.95);\n\t graph_setVertexColor(v, initia"
& "lColor);\n graph_setVertexLabelColor(v, initialLabelColor);\n"
& " graph_setVertexFont(v, self.vertexFont);\n graph"
& "_setVertexBorder(v, 0.05);\n graph_setVertexColor(self.last."
& "vtx[i], shadowColor);\n graph_setVertexLabelColor(self.last."
& "vtx[i], shadowLabelColor);\n tmp[i] := v;\n end;\n "
& " let moved = array_new(self.n, false);\n for i = 0 to sel"
& "f.n-1 do\n for j = 0 to self.n-1 do\n if no"
& "t(moved[j]) and\n (text_char(t, i) is text_char(self"
& ".last.chars, j))\n then\n graph_ver"
& "texToFront(tmp[j]);\n graph_moveVertex(tmp[j], 0.0,"
& " float(i), true);\n\t\t let old = self.matrix2[i][0];\n "
& " self.m";
CONST E82_3 =
"atrix2[i][0] := tmp[j];\n\t\t self.first.vtx[i] := tmp[j];\n "
& " moved[j] := true;\n zeus_animate(self"
& ".graphvbt,\n (float(i)) / 2.0,\n "
& " (float(i)+1.0) / 2.0 );\n\t\t graph_removeVertex(old);\n "
& " exit;\n end;\n end;\n "
& " end;\n end,\n\n ConsiderChar => meth(self, i)\n (* Abou"
& "t to look for match for element i for firstchars *)\n\tself.colorIndex "
& ":= (self.colorIndex + 1) % #(charColors);\n\tlet c = charColors[self.co"
& "lorIndex];\n\n\tfor m = 0 to self.n - 1 do\n\t let v = self.matrix2["
& "i][m];\n\t if m is 0 then\n\t\tgraph_setVertexColor(v, c);\n\t el"
& "se\n\t\tgraph_setVertexLabelColor(v, c);\n\t end;\n\tend;\n\tgraph_r"
& "edisplay(self.graphvbt);\n end,\n\n EqualChars => meth(self, i, j"
& ")\n (* Decided element i of firstchars matches element j of lastchar"
& "s. *)\n\tlet c = charColors[self.colorIndex];\n\n\tfor m = 0 to self.n "
& "- 1 do\n\t let v = self.matrix1[j][m];\n\t if m is self.n - 1 the"
& "n\n\t\tgraph_setVertexColor(v, c);\n\t else\n\t\tgraph_setVertexLabe"
& "lColor(v, c);\n\t end;\n\tend;\n\tgraph_redisplay(self.graphvbt);\n "
& " end,\n\n FinishCharRun => meth(self)\n (* Done with a run of i"
& "dentical chars in firstchar column. *)\n\tfor i = 0 to self.n - 1 do\n\t"
& " for m = 0 to self.n - 2 do\n\t\tgraph_setVertexLabelColor(self.matr"
& "ix1[i][m],\n\t\t\t\t\t matrixLabelColor);\n\t\tgraph_setVertexLabelCol"
& "or(self.matrix2[i][(self.n - 1) - m],\n\t\t \t\t matrixLabelC"
& "olor);\n\t end;\n\tend;\n\tgraph_redisplay(self.graphvbt);\n end,"
& "\n\n StartResult => meth(self)\n (* Setup to pick off result char"
& "s. *)\n (* Hide gray sorted matrices *)\n\tfor i = 0 to self.n -"
& " 1 do\n\t for j = 0 to self.n - 2 do\n\t\tgraph_removeVertex(self.ma"
& "trix1[i][j]);\n\t\tgraph_removeVertex(self.matrix2[i][(self.n - 1) - j]"
& ");\n\t end;\n\tend;\n\tzeus_animate(self.graphvbt, 0.0, 0.5);\n\n "
& " (* Put in row indices *)\n\tself.rowIndices := array_new(self.n, f"
& "alse);\n\tfor i = 0 to self.n - 1 do\n\t let v = graph_newVertex(se";
CONST E82_4 =
"lf.graphvbt);\n\t self.rowIndices[i] := v;\n\t graph_setVertexLab"
& "el(v, fmt_int(i));\n\t graph_setVertexFont(v, self.vertexFont);\n\t "
& " graph_setVertexColor(v, otherIndexColor);\n\t graph_setVertexLabe"
& "lColor(v, otherIndexLabelColor);\n\t graph_moveVertex(v, ~2.0 - inte"
& "rMatrixGap, float(i), false);\n\t graph_setVertexSize(v, 0.95, 0.95)"
& ";\n\tend;\n\tzeus_animate(self.graphvbt, 0.5, 1.0);\n\n\t(* Mark the re"
& "membered one *)\n let v = graph_newVertex(self.graphvbt);\n\tsel"
& "f.rowIndexVtx := v;\n\tgraph_setVertexLabel(v, fmt_int(self.rowIndex));"
& "\n\tgraph_setVertexFont(v, self.vertexFont);\n\tgraph_setVertexColor(v,"
& " rowIndexColor);\n\tgraph_setVertexLabelColor(v, rowIndexLabelColor);\n"
& "\tgraph_setVertexShape(v, \"ellipse\");\n\tgraph_setVertexBorder(v, 0.0"
& "5);\n\tgraph_moveVertex(v, ~2.0 - interMatrixGap,\n\t f"
& "loat(self.rowIndex), false);\n\tgraph_vertexToFront(v);\n\tgraph_setVer"
& "texSize(v, 0.95, 0.95);\n\tzeus_animate(self.graphvbt, 1.0, 1.5);\n "
& "end,\n\n ResultNextChar => meth(self, pos, k)\n (* Pick off the p"
& "os\'th element of firstchars and put into the\n k\'th position in"
& " the result string. *)\n if pos is self.rowIndex then\n\t (* J"
& "ust gray out the extra copy of the last character *)\n \t let v ="
& " self.last.vtx[self.rowIndex];\n\t graph_setVertexColor(v, ghostColo"
& "r);\n\t graph_setVertexLabelColor(v, ghostLabelColor);\n else\n"
& " let sv1 = self.last.vtx[pos];\n self.last.vtx[pos]"
& " := graph_newVertex(self.graphvbt);\n let sv2 = self.first.vt"
& "x[pos];\n self.first.vtx[pos] := graph_newVertex(self.graphvb"
& "t);\n graph_moveVertex(self.last.vtx[pos], ~1.0 - interMatrix"
& "Gap,\n float(pos), false);\n graph"
& "_setVertexLabel(self.last.vtx[pos],\n te"
& "xt_sub(self.last.chars, pos, 1));\n graph_setVertexSize(self."
& "last.vtx[pos], 0.95, 0.95);\n graph_setVertexColor(self.last."
& "vtx[pos], ghostColor);\n graph_setVertexLabelColor(self.last."
& "vtx[pos], ghostL";
CONST E82_5 =
"abelColor);\n graph_setVertexFont(self.last.vtx[pos], self.ve"
& "rtexFont);\n graph_setVertexBorder(self.last.vtx[pos], 0.05);"
& "\n graph_moveVertex(self.first.vtx[pos], 0.0, float(pos), fal"
& "se);\n graph_setVertexLabel(self.first.vtx[pos],\n "
& " text_sub(self.first.chars, pos, 1));\n g"
& "raph_setVertexSize(self.first.vtx[pos], 0.95, 0.95);\n graph_"
& "setVertexColor(self.first.vtx[pos], ghostColor);\n graph_setV"
& "ertexLabelColor(self.first.vtx[pos], ghostLabelColor);\n grap"
& "h_setVertexFont(self.first.vtx[pos], self.vertexFont);\n grap"
& "h_setVertexBorder(self.first.vtx[pos], 0.05);\n\n graph_verte"
& "xToFront(sv1);\n graph_vertexToFront(sv2);\n graph_"
& "moveVertex(sv1, float(k-1), float(self.rowIndex),\n "
& " true);\n graph_moveVertex(sv2, float(k), float(self.r"
& "owIndex),\n true);\n end;\n zeus"
& "_animate(self.graphvbt, 0.0, 1.0);\n end,\n\n EndResult => meth(s"
& "elf)\n (* Done. *)\n (* Put last character into place. *)\n\t"
& "for i = 0 to self.n - 1 do\n\t graph_setVertexColor(self.rowIndices["
& "i], ghostColor);\n \t graph_setVertexLabelColor(self.rowIndices[i]"
& ", ghostLabelColor);\n end;\n\tgraph_setVertexColor(self.rowIndex"
& "Vtx, ghostColor);\n\tgraph_setVertexLabelColor(self.rowIndexVtx, ghostL"
& "abelColor);\n\tgraph_redisplay(self.graphvbt);\n end\n\n };\n";
CONST E83 =
"@Parse\nPROCEDURE Parse ()@\n\n @1 PUSH <start symbol>@\n @2 token :="
& " Scan ()@\n\n @13 WHILE stack not empty DO@\n @3 stack_top := Pop "
& "()@\n @4 IF (stack_top is a terminal) THEN@\n @5 IF (stack_t"
& "op = token)@\n @6 THEN token := Scan ()@\n @7 ELSE "
& "ERROR@\n END\n @8 ELSE@\n @9 p := LookUp (token, stac"
& "k_top)@\n where p is \"stack_top ::= x1 x2 ... Xn\"\n @"
& "10 IF (p # NIL)@\n @11 THEN PUSH xn ... x2 x1@\n "
& "@12 ELSE ERROR@\n END\n END\n END\n@Parse\n\n\n\n";
CONST E84 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Stri"
& "ngSearch.evt.\n;*******************************************************"
& "*************\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75"
& " - 25 + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n"
& " (VBox\n (Glue 6)\n (Shape (Height 16 + "
& "0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitatCodeEvents =1 "
& "\n (Min 0) (Max 100)))))\n"
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup"
& " =TRUE \"\")\n (Glue 10)\n (Shape"
& " (Width + 0) (Height + 0) \"Weight: \")\n (Shape (Wi"
& "dth 80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Sh"
& "ape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Heigh"
& "t + 0) \n \"Probe: Stop? \") \n "
& " (Boolean %stopAtProbe =TRUE \"\")\n (Gl"
& "ue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtProbe =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox F";
CONST E84_0 =
"ill (Shape (Width + 0) (Height + 0) \n \""
& "Result: Stop? \") \n (Boolean %stopAtResult =TRUE "
& "\"\")\n (Glue 10)\n (Shape (Width"
& " + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80)"
& " (Numeric %waitAtResult =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (H"
& "eight 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0)"
& " \n \"PartialMatch: Stop? \") \n "
& " (Boolean %stopAtPartialMatch =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"W"
& "eight: \")\n (Shape (Width 80) (Numeric %waitAtParti"
& "alMatch =1 \n (Min 0) (Ma"
& "x 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"PartialMatchClear: Stop? \") \n "
& " (Boolean %stopAtPartialMatchClear =TRUE \"\")\n ("
& "Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight:"
& " \")\n (Shape (Width 80) (Numeric %waitAtPartialMatc"
& "hClear =1 \n (Min 0) (Max"
& " 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"CompleteMatch: Stop? \") \n (B"
& "oolean %stopAtCompleteMatch =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtCompleteMatch =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"SlideTo: Stop? \") \n (Boolean %stopAtSlideT"
& "o =";
CONST E84_1 =
"TRUE \"\")\n (Glue 10)\n (Shape ("
& "Width + 0) (Height + 0) \"Weight: \")\n (Shape (Widt"
& "h 80) (Numeric %waitAtSlideTo =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Sh"
& "ape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Heigh"
& "t + 0) \n \"KMPSetup: Stop? \") \n "
& " (Boolean %stopAtKMPSetup =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Wei"
& "ght: \")\n (Shape (Width 80) (Numeric %waitAtKMPSetu"
& "p =1 \n (Min 0) (Max 100)"
& "))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"AddEdge: Stop? \") \n (Boolean %sto"
& "pAtAddEdge =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& "(Shape (Width 80) (Numeric %waitAtAddEdge =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " )\n (Glue 4)\n (VBox\n (Glue 5)\n "
& " (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (Bu"
& "tton %eventCounts\n (VBox\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n (Glue "
& "6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfProbe \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 +"
& " 0) \n (Text %ctOfResult \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (H"
& "eight 16 + 0) \n (Text %ctOfPartialMat"
& "ch \"0\")))\n (Glue 6)\n (HBox Fill (Shap"
& "e (Width + ";
CONST E84_2 =
"0) (Height 16 + 0) \n (Text %ctOfParti"
& "alMatchClear \"0\")))\n (Glue 6)\n (HBox "
& "Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfCompleteMatch \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSlideTo \"0\")))\n (Glu"
& "e 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfKMPSetup \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height"
& " 16 + 0) \n (Text %ctOfAddEdge \"0\"))"
& ")\n (Glue 3))))\n Fill\n (Glue 4 + Inf"
& ")\n )\n )\n )\n )\n)\n";
CONST E85 =
"Source 50 500\nV2 400 500\nV3 700 500\nSink 950 500\nV4 250 300\nV5 550"
& " 300\nV6 550 700\nV7 850 700\nSource -> V2 1.9\nV2 -> V3 2.4\nV3 -> Sin"
& "k 1.1\nSource -> V4 3.2\nV4 -> V5 2.3\nV5 -> V3 1.7\nV2 -> V6 2.88\nV6 "
& "-> V7 3.12\nV7 -> Sink 1.98\n.\n";
CONST E86 =
"(* Copyright (C) 1994, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* Last modified on Mon Jan 9 "
& "12:04:15 PST 1995 by najork *)\n(* modified on F"
& "ri Aug 19 12:49:52 PDT 1994 by heydon *)\n\n(* Change"
& "Parent.obl -- histogram of grouped \"ChangeParent\" operations. *)\n\nl"
& "et Margin = 5.0; (* in mm *)\nlet InitMaxX = 4;\nlet InitMa"
& "xY = 4.0;\n\nlet BarColor = color_named(\"yellow\");\nlet BorderColo"
& "r = color_named(\"black\");\nlet BorderWidth = 0.05;\nlet TextColor ="
& " color_named(\"black\");\nlet FontSz = 0.6;\nlet Lab1Y = ~0."
& "5;\nlet Lab2Y = ~1.5;\nlet MinY = ~2.0;\n\n(* Bar Object ="
& "============================================================ *)\n\nlet "
& "Bar = {\n slot: Int => ok,\n count: Int => 0,\n v: Vertex => ok,\n\n"
& " barHeight => meth(self: Bar): Real,\n math_sqrt(float(self.count))"
& "\n end,\n\n updateVertex => meth(self): Ok,\n let ht = self.barHei"
& "ght();\n graph_setVertexSize(self.v, 0.9, ht);\n graph_moveVertex"
& "(self.v, 0.5 + float(self.slot), ht / 2.0, false);\n ok\n end,\n\n "
& " updateLabel => meth(self): Ok,\n graph_setVertexLabel(self.v, fmt_i"
& "nt(self.count));\n ok\n end,\n\n new => meth(self: Bar, g: Graph, "
& "f: Font, slot: Int): Bar,\n self.slot := slot;\n self.v := graph_"
& "newVertex(g);\n graph_setVertexColor(self.v, BarColor);\n graph_s"
& "etVertexBorderColor(self.v, BorderColor);\n graph_setVertexBorder(se"
& "lf.v, BorderWidth);\n graph_setVertexFont(self.v, f);\n graph_set"
& "VertexLabelColor(self.v, TextColor);\n graph_setVertexLabel(self.v, "
& "\"\");\n self.updateVertex();\n let v = graph_newVertex(g);\n "
& "graph_vertexToBack(v);\n graph_setVertexColor(v, color_named(\"white"
& "\"));\n graph_setVertexFont(v, f);\n graph_setVertexLabelColor(v,"
& " TextColor);";
CONST E86_0 =
"\n graph_setVertexLabel(v, fmt_int(slot+1));\n graph_setVertexSiz"
& "e(v, 1.0, 1.0);\n graph_moveVertex(v, 0.5 + float(slot), Lab1Y, fals"
& "e);\n self\n end,\n\n inc => meth(self: Bar): Ok,\n (* increment "
& "the count of the bar \"self\", and update its vertex\n to reflect t"
& "he change. *)\n self.count := self.count + 1;\n self.updateVertex"
& "();\n self.updateLabel();\n ok\n end,\n};\n\n(* View Object ===="
& "======================================================== *)\n\nlet view"
& ": View = {\n\n (* Data members ---------------------------------------"
& "------------------ *)\n\n graphvbt => graph_new(),\n bar: [Bar] => ok"
& ",\n maxX: Int => InitMaxX, (* slots [0..maxX-1] *)\n maxY: Real ="
& "> InitMaxY, (* values [0..maxY] *)\n currLen: Int => ok,\n labelFo"
& "nt: Font => ok,\n total: Int => 0,\n count: Int => 0,\n totalV: Vert"
& "ex => ok,\n\n setWorld => meth(self: View): Ok,\n graph_setWorld(se"
& "lf.graphvbt,\n 0.0, float(self.maxX), self.maxY + 2.0, MinY);\n "
& " ok\n end,\n\n updateTotal => meth(self: View): Ok,\n let txt = \""
& "Total = \" & fmt_int(self.total) & \" Average = \" &\n if self.co"
& "unt is 0 then \"0.00\" else\n text_replaceAll(\"d\", \"0\",\n "
& " text_sub(fmt_real(float(self.total)/float(self.cou"
& "nt)),\n 0, 4));\n end;\n graph_"
& "setVertexLabel(self.totalV, txt);\n ok\n end,\n\n moveTotalLabel ="
& "> meth(self: View): Ok,\n graph_moveVertex(self.totalV, float(self.m"
& "axX)/2.0, Lab2Y, true);\n ok\n end,\n\n (* Setup -----------------"
& "----------------------------------------------- *)\n\n Setup => meth(s"
& "elf: View): Ok,\n self.labelFont := graph_newFont(self.graphvbt, \"H"
& "elvetica\", FontSz,\n \"Roman\", \"bold\", \"*\");\n graph_setM"
& "argin(self.graphvbt, Margin);\n self.setWorld();\n ok\n end,\n\n"
& " NewSet => meth(self: View, nm: Text): Ok,\n ok\n end,\n\n Finish"
& "edSets => meth(self: View, numSets: Int, usesRanks: Bool): Ok,\n sel"
& "f.totalV := graph_newVertex(self.graphvbt);\n graph_vertexToBack(sel"
& "f.totalV);\n graph_setVertexFo";
CONST E86_1 =
"nt(self.totalV, self.labelFont);\n graph_setVertexLabelColor(self.to"
& "talV, TextColor);\n graph_setVertexColor(self.totalV, color_named(\""
& "white\"));\n graph_setVertexSize(self.totalV, 200.0, 1.0);\n self"
& ".updateTotal(); self.moveTotalLabel();\n\n self.bar := array_new(sel"
& "f.maxX, ok);\n for i = 0 to self.maxX - 1 do\n self.bar[i] := c"
& "lone(Bar).new(self.graphvbt, self.labelFont, i)\n end;\n zeus_ani"
& "mate(self.graphvbt, 0.0, 0.0);\n ok\n end,\n\n (* DoFind events --"
& "------------------------------------------------------ *)\n\n StartDoF"
& "ind => meth(self, id): Ok,\n ok\n end,\n\n StepUp => meth(self, ch"
& "ild, parent): Ok,\n ok\n end,\n\n Found => meth(self, root): Ok,\n"
& " ok\n end,\n\n StepDown => meth(self: View, childId, parentId: Int"
& "): Ok,\n ok\n end,\n\n ChangeParent => meth(self: View, childId, p"
& "arentId, rootId: Int): Ok,\n self.currLen := self.currLen + 1;\n "
& "ok\n end,\n\n EndDoFind => meth(self, id): Ok,\n ok\n end,\n\n ("
& "* Find events ---------------------------------------------------------"
& "- *)\n\n StartFind => meth(self: View, id: Int): Ok,\n ok\n end,\n"
& "\n EndFind => meth(self: View, id: Int): Ok,\n ok\n end,\n\n (* U"
& "nion events --------------------------------------------------------- *"
& ")\n\n StartUnion => meth(self: View, id1, id2: Int, bothRoots: Bool): "
& "Ok,\n ok\n end,\n\n FoundFirst => meth(self: View, root1: Int): Ok"
& ",\n ok\n end,\n\n CompareRanks => meth(self: View, id1, id2: Int):"
& " Ok,\n ok\n end,\n\n Unite => meth(self: View, childId, parentId, "
& "pRank: Int): Ok,\n self.currLen := 0;\n ok\n end,\n\n EndUnion "
& "=> meth(self): Ok,\n var rescale: Bool = false;\n if self.currLen"
& " >= self.maxX then\n var sz: Int = (self.currLen - self.maxX) + 1;"
& "\n var new: [Bar] = array_new(sz, ok);\n for i = 0 to sz - 1 "
& "do\n new[i] := clone(Bar).new(self.graphvbt, self.labelFont, sel"
& "f.maxX + i)\n end;\n self.bar := self.bar @ new;\n self."
& "maxX := self.currLen + 1;\n self.moveTotalLabel();\n rescale "
& ":= true\n end;\n if ";
CONST E86_2 =
"self.bar[self.currLen].barHeight() >= self.maxY then\n self.maxY :"
& "= 1.5 * self.maxY;\n rescale := true\n end;\n if rescale the"
& "n\n self.setWorld();\n graph_redisplay(self.graphvbt)\n en"
& "d;\n self.bar[self.currLen].inc();\n self.total := self.total + s"
& "elf.currLen + 1;\n self.count := self.count + 1;\n self.updateTot"
& "al();\n zeus_animate(self.graphvbt, 0.0, 0.0);\n ok\n end,\n};\n"
;
CONST E87 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Rim\n (Pen "
& "10)\n (HBox\n (Radio\n %InStyle\n =Random\n (VBox\n "
& " (HBox\n (Choice %Random \"Random points:\")\n "
& "(Numeric (Min 3) (Max 99) %N =10)\n (Glue 10)\n (Bool"
& "ean %UsePrev (Value FALSE) \"Prev. seed\")\n Fill)\n (G"
& "lue 10)\n (HBox\n (Choice %File \"From file:\")\n "
& " (Border\n (Shape\n (Width 120 + 200)\n "
& " (Height 60 + 75)\n (FileBrowser (Suffixes \"pt\" "
& "\"\") %Name))))))))\n";
CONST E88 =
"(* Copyright 1993 Digital Equipment Corporation. "
& " *)\n(* Distributed only by permission. "
& " *)\n(* "
& " *)\n(* Last modified on Thu Oct 14 18:45:31 P"
& "DT 1993 by heydon *)\n(* modified on Tue Aug 10 "
& "22:14:21 PDT 1993 by rsanchez *)\n\n(* View that shows "
& "each node as a circle whose radius is proportional to the\n number of"
& " packets queued up that that node. *)\n\nlet nodeColor = [color_named(\""
& "yellow\"), color_named(\"red\")];\nlet edgeColor = color_named(\"Blue\""
& ");\nlet labelColor = color_named(\"Black\");\nlet borderColor = color_n"
& "amed(\"Black\");\nlet backgroundColor = color_named(\"White\");\n\nlet "
& "moveEdgeColor = color_named(\"DarkGreen\");\nlet blockedEdgeColor = col"
& "or_named(\"Red\");\n\nlet normal = 0;\nlet congested = 1;\n\nlet edgeWi"
& "dth = 0.1;\nlet borderWidth = 0.1;\n\nlet angle = proc(p1, p2)\n var a"
& "ng = ok;\n if p1[0] is p2[0] then \n if p1[1] < p2[1] then \n "
& " ang := 90.0;\n else\n ang := 270.0;\n end;\n elsif p1[1] i"
& "s p2[1] then\n if p1[0] < p2[0] then\n ang := 0.0;\n else\n "
& " ang := ~180.0;\n end;\n else\n ang := math_atan((p2[1] - p1"
& "[1])/(p2[0] - p1[0]))/math_degree;\n if (p2[0] - p1[0]) < 0.0 then\n"
& " if (p2[1] - p1[1]) > 0.0 then\n ang := ang + 180.0;\n "
& " else\n ang := ang - 180.0;\n end;\n end;\n end;\n ang"
& "\nend;\n\nlet getStraightEdgeCP = proc(p1,p2,r)\n var cp = [[ok,ok],[o"
& "k,ok]];\n let ang = angle(p1,p2);\n cp[0][0] := p1[0] + (r * math_cos"
& "((ang - 90.)*math_degree));\n cp[0][1] := p1[1] + (r * math_sin((ang -"
& " 90.)*math_degree));\n cp[1][0] := p2[0] + (r * math_cos((ang - 90.)*m"
& "ath_degree));\n cp[1][1] := p2[1] + (r * math_sin((ang - 90.)*math_deg"
& "ree));\n cp\nend;\n\nlet getCurvedEdgeCP = proc(p1,p2,cp1,cp2,r)\n le"
& "t avg = proc(a, b)\n let avgreal = proc(r1, r2) (r1 + r2)/2.0 end;\n"
& " [ avgreal(a[0],b[0]), avgreal(a[1], b[1]) ]\n end;\n let aux1 = g"
& "etStraightEdgeCP(p1, c";
CONST E88_0 =
"p1, r);\n let aux2 = getStraightEdgeCP(cp2, p2, r);\n let aux3 = getS"
& "traightEdgeCP(cp1, cp2, r);\n [ aux1[0], avg(aux1[1], aux3[0]), avg(au"
& "x3[1], aux2[0]), aux2[1] ]\nend;\n\nlet invisibleCP = proc(g, pt)\n le"
& "t vtx = graph_newVertex(g);\n graph_setVertexSize(vtx, 0.0, 0.0);\n g"
& "raph_moveVertex(vtx, pt[0], pt[1], false);\n vtx\nend; \n\nlet Ha"
& "shEntry = \n {\n key1 => ok,\n key2 => ok,\n value => ok,\n ne"
& "xt => ok,\n };\n\nlet HashTable = \n {\n num => ok,\n size => "
& "ok,\n table => ok,\n\n curindex => ok,\n curentry => ok,\n\n "
& " create => meth(self, num)\n self.num := num;\n self.size :="
& " real_round(float(num)*math_log(float(num)));\n self.table := arra"
& "y_new(self.size, ok);\n self;\n end,\n\n getfirst => meth(se"
& "lf)\n self.curindex := 0;\n self.curentry := ok;\n loop\n"
& "\tif self.curindex is self.size then\n\t exit;\n else\n\t if s"
& "elf.table[self.curindex] isnot ok then\n self.curentry := se"
& "lf.table[self.curindex];\n\t exit;\n\t end;\n\t self.curindex := s"
& "elf.curindex + 1;\n end;\n end;\n if self.curentry isn"
& "ot ok then\n\tself.curentry.value;\n else\n\tok;\n end;\n "
& "end,\n\n getnext => meth(self)\n if self.curentry isnot ok then"
& "\n self.curentry := self.curentry.next;\n loop\n\t if se"
& "lf.curentry isnot ok then\n\t exit;\n else\n\t self.curi"
& "ndex := self.curindex + 1;\n\t if self.curindex < self.size then\n\t"
& " self.curentry := self.table[self.curindex];\n else\n\t"
& " exit;\n end;\n end;\n end;\n if"
& " self.curentry isnot ok then\n\t self.curentry.value;\n else\n\t"
& " ok;\n end;\n else\n\tok;\n end;\n end,\n\n loo"
& "kup => meth(self, key1, key2)\n let index = ((key1 * self.size) + "
& "key2) % self.num;\n if self.table[index] isnot ok then\n v"
& "ar entry = self.table[index];\n\t loop\n if (entry is ok) ori"
& "f\n\t ((entry.key1 is key1) and (entry.key2 is key2)) then\n\t "
& " exit;\n else\n\t entry := entry.next;";
CONST E88_1 =
"\n end;\n\t end;\n if entry isnot ok then\n\t entry"
& ".value;\n else\n\t ok;\n end;\n else\n\tok;\n "
& " end;\n end,\n\n insert => meth(self, key1, key2, value)\n "
& " let index = ((key1 * self.size) + key2) % self.num;\n var newentr"
& "y = clone(HashEntry);\n newentry.key1 := key1;\n newentry.key"
& "2 := key2;\n newentry.value := value;\n newentry.next := ok;\n"
& "\n if self.table[index] isnot ok then\n var entry = self.ta"
& "ble[index];\n\tloop\n\t if entry.next is ok then\n entry.ne"
& "xt := newentry;\n\t exit;\n\t else\n\t entry := entry.next;\n "
& " end;\n end;\n else\n\tself.table[index] := newentry;"
& "\n end;\n end,\n };\n\nlet StraightEdge =\n {\n g => ok,\n"
& " e => ok,\n v1 => ok,\n v2 => ok,\n cEdge12 => ok,\n cEd"
& "ge21 => ok,\n tag12 => false,\n tag21 => false,\n \n edge ="
& "> meth(self) self.e end,\n\n create => meth (self, t, v1, v2)\n "
& " self.g := t.g;\n self.v1 := v1;\n self.v2 := v2;\n self"
& ".e := graph_newEdge(v1.v, v2.v);\n graph_moveEdge(self.e, v1.v, v2"
& ".v, false);\n graph_setEdgeColor(self.e, edgeColor);\n self\n"
& " end,\n\n initialWidth => meth(self, maxSize, size)\n let ge"
& "tCondEdge = proc(pt1, pt2)\n let vp1 = invisibleCP(self.g, pt1);"
& "\n let vp2 = invisibleCP(self.g, pt2);\n let cEdge = grap"
& "h_newEdge(vp1, vp2);\n graph_edgeToBack(cEdge);\n graph_s"
& "etEdgeColor(cEdge, backgroundColor);\n graph_setEdgeWidth(cEdge,"
& " size/1.5);\n cEdge\n end;\n graph_setEdgeWidth(self.e"
& "dge, size/3.0);\n let cp12 = getStraightEdgeCP(self.v1.pos, self.v"
& "2.pos, maxSize/10.0);\n let cp21 = getStraightEdgeCP(self.v2.pos, "
& "self.v1.pos, maxSize/10.0);\n self.cEdge12 := getCondEdge(cp12[0],"
& " cp12[1]);\n self.cEdge21 := getCondEdge(cp21[0], cp21[1]); \n "
& "end,\n\n showMoveCondEdge => meth(self, fromN, toN)\n if fromN "
& "is self.v1.id then\n graph_setEdgeColor(self.cEdge12, moveEdgeCo"
& "lor);\n graph_edgeToFro";
CONST E88_2 =
"nt(self.cEdge12);\n self.tag12 := true;\n else\n gra"
& "ph_setEdgeColor(self.cEdge21, moveEdgeColor);\n graph_edgeToFron"
& "t(self.cEdge21);\n self.tag21 := true;\n end; \n end,\n\n"
& " showBlockedCondEdge => meth(self, fromN, toN)\n if fromN is se"
& "lf.v1.id then\n graph_setEdgeColor(self.cEdge12, blockedEdgeColo"
& "r);\n graph_edgeToFront(self.cEdge12);\n self.tag12 := tr"
& "ue;\n else\n graph_setEdgeColor(self.cEdge21, blockedEdgeCo"
& "lor);\n graph_edgeToFront(self.cEdge21);\n self.tag21 := "
& "true; \n end;\n end,\n\n hideCondEdge => meth(self)\n i"
& "f self.tag12 then\n graph_setEdgeColor(self.cEdge12, backgroundC"
& "olor);\n graph_edgeToBack(self.cEdge12);\n self.tag12 := "
& "false;\n end;\n if self.tag21 then\n graph_setEdgeColo"
& "r(self.cEdge21, backgroundColor);\n graph_edgeToBack(self.cEdge2"
& "1);\n self.tag21 := false;\n end;\n end,\n\n};\n\n\nlet "
& "CurvedEdge =\n {\n g => ok,\n e => ok,\n v1 => ok,\n v2 =>"
& " ok,\n ctls => ok,\n cEdge12 => ok,\n cEdge21 => ok,\n tag1"
& "2 => false,\n tag21 => false,\n\n edge => meth(self) self.e end,\n"
& "\n create => meth (self, t, v1, v2, x1, y1, x2, y2)\n self.g :="
& " t.g;\n self.v1 := v1;\n self.v2 := v2;\n let cpt1 = [x1"
& ", y1];\n let cpt2 = [x2, y2];\n var cpt1v = invisibleCP(self."
& "g, cpt1);\n var cpt2v = invisibleCP(self.g, cpt2);\n self.ctl"
& "s := [cpt1, cpt2]; \n self.e := graph_newEdge(v1.v, v2.v);\n "
& "graph_moveEdgeBezier(self.e, v1.v, v2.v, cpt1v, cpt2v, false);\n g"
& "raph_setEdgeColor(self.e, edgeColor);\n graph_setEdgeWidth(self.e,"
& " edgeWidth);\n self\n end,\n\n initialWidth => meth(self, ma"
& "xSize, size)\n let getCondEdge = proc(pt1, cpt1, cpt2, pt2)\n "
& " let vp1 = invisibleCP(self.g, pt1);\n let vp2 = invisibleCP(s"
& "elf.g, pt2);\n let vcp1 = invisibleCP(self.g, cpt1);\n le"
& "t vcp2 = invisibleCP(self.g, cpt2);\n let cEdge = graph_newEdge("
& "vp1, vp2);\n ";
CONST E88_3 =
" graph_edgeToBack(cEdge);\n graph_moveEdgeBezier(cEdge, vp"
& "1, vp2, vcp1, vcp2, false);\n graph_setEdgeColor(cEdge, backgrou"
& "ndColor);\n graph_setEdgeWidth(cEdge, size/1.5);\n cEdge "
& "\n end;\n graph_setEdgeWidth(self.edge, size/3.0);\n let"
& " cp12 = getCurvedEdgeCP(self.v1.pos, self.v2.pos,\n "
& " self.ctls[0], self.ctls[1], maxSize/10.0);\n let cp21"
& " = getCurvedEdgeCP(self.v2.pos, self.v1.pos,\n "
& " self.ctls[1], self.ctls[0], maxSize/10.0);\n self.cEdge12 "
& ":= getCondEdge(cp12[0], cp12[1], cp12[2], cp12[3]);\n self.cEdge21"
& " := getCondEdge(cp21[0], cp21[1], cp21[2], cp21[3]);\n end,\n\n s"
& "howMoveCondEdge => meth(self, fromN, toN)\n if fromN is self.v1.id"
& " then\n graph_setEdgeColor(self.cEdge12, moveEdgeColor);\n "
& " graph_edgeToFront(self.cEdge12);\n self.tag12 := true;\n "
& "else\n graph_setEdgeColor(self.cEdge21, moveEdgeColor);\n "
& " graph_edgeToFront(self.cEdge21);\n self.tag21 := true;\n e"
& "nd;\n end,\n\n showBlockedCondEdge => meth(self, fromN, toN)\n "
& " if fromN is self.v1.id then\n graph_setEdgeColor(self.cEdge12"
& ", blockedEdgeColor);\n graph_edgeToFront(self.cEdge12);\n "
& " self.tag12 := true;\n else\n graph_setEdgeColor(self.cEdge"
& "21, blockedEdgeColor);\n graph_edgeToFront(self.cEdge21);\n "
& " self.tag21 := true; \n end;\n end,\n\n hideCondEdge => me"
& "th(self)\n if self.tag12 then\n graph_setEdgeColor(self.cEd"
& "ge12, backgroundColor);\n graph_edgeToBack(self.cEdge12);\n "
& " self.tag12 := false;\n end;\n if self.tag21 then\n "
& "graph_setEdgeColor(self.cEdge21, backgroundColor);\n graph_edgeT"
& "oBack(self.cEdge21);\n self.tag21 := false;\n end;\n end"
& ",\n\n};\n\n\nlet Node =\n {\n g => ok,\n v => ok,\n pos => ok"
& ",\n qs => 0,\n id => ok,\n\n incQS => meth(self) self.qs := se"
& "lf.qs + 1 end,\n\n create => meth(self, t, id, x, y)\n self.g :"
& "= t.g;\n";
CONST E88_4 =
" self.id := id;\n self.pos := [x, y];\n self.v := graph_"
& "newVertex(self.g);\n graph_moveVertex(self.v, x, y, false); \n "
& " graph_setVertexShape(self.v, \"ellipse\");\n graph_setVertexColo"
& "r(self.v, nodeColor[normal]); \n graph_setVertexBorderColor(self.v"
& ", borderColor);\n self\n end,\n\n initialSize => meth(self, "
& "size)\n graph_setVertexSize(self.v, size, size);\n graph_setV"
& "ertexBorder(self.v, size/3.0);\n end,\n};\n\nlet view =\n{\n graphv"
& "bt => graph_new(),\n g => meth (self) self.graphvbt end,\n\n nodeCnt "
& "=> ok,\n maxQS => ok,\n bounded => ok,\n\n minNodeSize => 0.0,\n ma"
& "xNodeSize => ok,\n\n changed => ok,\t\t(* array of verteces whose size"
& " has changed *)\n\n vertexFont => ok,\n\n nodeT => ok,\n edgeT => ok"
& ",\n\n condEdges => [],\n\n node => meth(self, id)\n self.nodeT[id]"
& ";\n end,\n\n edge => meth(self, id1, id2)\n var res = self.edgeT.l"
& "ookup(id1, id2);\n if res is ok then\n res := self.edgeT.lookup"
& "(id2, id1);\n end;\n res\n end,\n\n StartGraph => meth (self, n"
& "odeCnt, maxQS, bounded, xMax, yMax)\n graph_setWorld(self.graphvbt, "
& "0.0, xMax, yMax, 0.0);\n self.changed := array_new(nodeCnt, ok);\n "
& " self.vertexFont := graph_newFont(self.graphvbt, \"Helvetica\",\n "
& " 0.5, \"Roman\", \"bold\", \"*\")"
& ";\n self.nodeCnt := nodeCnt;\n self.maxQS := maxQS;\n self.bou"
& "nded := bounded;\n self.nodeT := array_new(nodeCnt, ok);\n self.e"
& "dgeT := HashTable.create(nodeCnt);\n end,\n\n NewNode => meth (self, "
& "id, x, y)\n self.nodeT[id] :=\n clone(Node).create(self, id, "
& "x, y);\n end,\n\n NewStraightEdge => meth (self, id1, id2)\n self."
& "edgeT.insert(id1, id2,\n \t clone(StraightEdge).create( sel"
& "f, \n \t\t\t self.node(id1), \n \t\t\t "
& " self.node(id2)));\n end,\n\n\n NewCurvedEdge => meth "
& "(self, id1, id2, x1, y1, x2, y2)\n self.edgeT.insert(id1, id2,\n "
& " \t clone(CurvedEdge).create( self,\n \t\t\t\t\t self.nod"
& "e(id1),\n \t\t\t\t\t self.node(id2),\n ";
CONST E88_5 =
"\t\t\t\t\t x1, y1, x2, y2));\n end,\n\n NewLabel => meth (self, labe"
& "l, x, y)\n let vl = graph_newVertex(self.graphvbt);\n graph_setVe"
& "rtexFont(vl, self.vertexFont);\n graph_setVertexSize(vl, 0.5, 0.5);\n"
& " graph_setVertexColor(vl, backgroundColor);\n graph_moveVertex(vl"
& ", x, y, false);\n graph_setVertexLabel(vl, label);\n graph_setVer"
& "texLabelColor(vl, labelColor);\n end,\n\n EndGraph => meth (self)\n "
& " let distance = proc(pt1, pt2)\n let dx = pt2[1] - pt1[1], dy = p"
& "t2[0] - pt1[0];\n (dx * dx) + (dy * dy)\n end;\n var minDst "
& "= ok;\n if #(self.nodeT) > 1 then\n minDst := distance(self.nod"
& "eT[0].pos, self.nodeT[1].pos);\n for i = 0 to #(self.nodeT) - 1 do"
& "\n\tlet pos1 = self.nodeT[i].pos;\n\tfor j = i+1 to #(self.nodeT) - 1 d"
& "o\n\t let curDst = distance(pos1, self.nodeT[j].pos);\n\t if curDst <"
& " minDst then\n\t minDst := curDst\n\t end\n\tend\n end;\n "
& " minDst := math_sqrt(minDst);\n else\n minDst := 1.0\n end;\n"
& " self.maxNodeSize := minDst * 0.9;\n self.minNodeSize := self.max"
& "NodeSize/6.0; \n for i = 0 to #(self.nodeT) - 1 do\n self.nodeT"
& "[i].initialSize(self.minNodeSize);\n end;\n var edge = self.edgeT"
& ".getfirst();\n if edge isnot ok then\n edge.initialWidth(self.m"
& "axNodeSize, self.minNodeSize);\n loop\n edge := self.edgeT."
& "getnext();\n if edge is ok then\n exit;\n else\n"
& " edge.initialWidth(self.maxNodeSize, self.minNodeSize);\n "
& " end;\n end;\n end;\n end,\n\n NewPacket => meth (self, id,"
& " source, dest, fewestHops, name)\n self.node(source).incQS();\n end"
& ",\n\n EndPackets => meth (self)\n let nsize = proc(qsize)\n le"
& "t ns = (float(qsize) * \n ((self.maxNodeSize - self.minNod"
& "eSize) /\n float(self.maxQS))) + self.minNodeSize;\n "
& " ns\n end;\n if self.bounded is true then\n for i = 0 to #("
& "self.nodeT) - 1 do\n if self.nodeT[i].qs >= self.maxQS then\n "
& " self.nodeT[i].qs := self.maxQS;\n graph_setVertexColor"
& "( self.nodeT[i].v, ";
CONST E88_6 =
"nodeColor[congested]);\n else\n graph_setVertexColor( s"
& "elf.nodeT[i].v, nodeColor[normal]);\n end;\n let size = n"
& "size(self.nodeT[i].qs);\n graph_setVertexSize(self.nodeT[i].v, s"
& "ize, size);\n end;\n else\n for i = 0 to #(self.nodeT) - 1"
& " do\n graph_setVertexColor( self.nodeT[i].v, nodeColor[normal]);"
& "\n let size = nsize(self.nodeT[i].qs);\n graph_setVertexS"
& "ize(self.nodeT[i].v, size, size);\n end;\n end;\n graph_redi"
& "splay(self.graphvbt);\n end,\n\n MovePacket => meth (self, id, fromN,"
& " toN)\n self.condEdges := self.condEdges @\n [self.edge(fr"
& "omN, toN)];\n self.edge(fromN, toN).showMoveCondEdge(fromN, toN);\n "
& " end,\n\n Blocked => meth(self, id, fromN, toN)\n self.condEdges :="
& " self.condEdges @\n [self.edge(fromN, toN)];\n self.edge(f"
& "romN, toN).showBlockedCondEdge(fromN, toN);\n end,\n\n QueueSizes => "
& "meth (self, queueSizes)\n let nsize = proc(qsize)\n let factor "
& "= float(qsize) / float(self.maxQS);\n let delta = self.maxNodeSize"
& " - self.minNodeSize;\n self.minNodeSize + (factor * delta)\n en"
& "d;\n var cnt = 0;\n graph_redisplay(self.graphvbt);\n for i = "
& "0 to #(self.nodeT) - 1 do\n if self.nodeT[i].qs isnot queueSizes[i"
& "] then\n self.nodeT[i].qs := queueSizes[i];\n self.change"
& "d[cnt] := i;\n cnt := cnt + 1\n end\n end;\n if self."
& "bounded then\n for i = 0 to cnt - 1 do\n\tlet node = self.nodeT[se"
& "lf.changed[i]];\n\tif node.qs isnot self.maxQS then\n\t graph_setVerte"
& "xColor(node.v, nodeColor[normal]);\n\tend\n end\n end;\n gra"
& "ph_redisplay(self.graphvbt);\n for i = 0 to cnt - 1 do\n let no"
& "de = self.nodeT[self.changed[i]];\n let size = nsize(node.qs);\n "
& " sys_call(\"VertexSizeAnim.Linear\", [node.v, size, size]);\n end"
& ";\n zeus_animate(self.graphvbt, 0.0, 1.0);\n if self.bounded then"
& "\n for i = 0 to cnt - 1 do\n\tlet node = self.nodeT[self.changed[i"
& "]];\n\tif node.qs is self.maxQS then\n\t graph_setVertexColor(node.v, "
& "nodeColor[con";
CONST E88_7 =
"gested]);\n\tend\n end\n end;\n graph_redisplay(self.graphvb"
& "t);\n end,\n\n Absorb => meth(self, pktID, node)\n let nsize = pro"
& "c(qsize)\n let ns = (float(qsize) * \n ((self.maxNode"
& "Size - self.minNodeSize) /\n float(self.maxQS))) + self."
& "minNodeSize;\n ns\n end;\n if (self.nodeT[node].qs is self.m"
& "axQS) and self.bounded then\n graph_setVertexColor(self.nodeT[node"
& "].v,\n \t\t nodeColor[normal]);\n end;\n self.nodeT[node"
& "].qs := self.nodeT[node].qs - 1;\n graph_setVertexSize(self.nodeT[no"
& "de].v,\n \t\t nsize(self.nodeT[node].qs),\n \t\t nsize(self"
& ".nodeT[node].qs));\n end,\n\n Step => meth(self)\n for i = 0 to #("
& "self.condEdges) - 1 do\n self.condEdges[i].hideCondEdge();\n en"
& "d;\n self.condEdges := [];\n graph_redisplay(self.graphvbt);\n e"
& "nd,\n};\n";
CONST E89 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Matc"
& "h.evt.\n;**************************************************************"
& "******\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) ("
& "Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue "
& "4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorith"
& "m events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus even"
& "ts\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to "
& "events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height 2"
& "00 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E90 =
"@Insertion\nprocedure insertion;@\n var v: integer;\n begin\n @1 for"
& " i := 2 to N do@\n begin\n @2 v := a[i];@ @3 j := i;@\n @4 whi"
& "le a[j-1] > v do@\n begin @5 a[j] := a[j - 1];@ @6 j := j - 1@ end"
& ";\n end;\n @7 a[j] := v;@\n end;\n@Insertion\n";
CONST E91 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file CP.e"
& "vt.\n;*****************************************************************"
& "***\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) (Sha"
& "pe (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue 4)\n"
& " (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorithm ev"
& "ents\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus events\""
& "))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to even"
& "ts\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height 200 +"
& " INF) (TextEdit ReadOnly %transcript)))\n";
CONST E92 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Scale\n (HS"
& "cale 1)\n (VScale 1)\n (Rim\n (Pen 10)\n (HBox\n (VBox\n "
& " (Text RightAlign \"current flow: \")\n (Text RightAlign \""
& "capacity: \"))\n (VBox\n (Shape (Width 100) (TextEdit ReadO"
& "nly %tflow))\n (Shape (Width 100) (TextEdit ReadOnly %tcapacity)"
& ")))))\n";
CONST E93 =
"Program CPAlgorithm(Input, Output);\n\nTYPE \n Cell = RECORD\n "
& " p: POINT;\n next: ^Cell;\n END;\n Link = ^Cel"
& "l;\n\nCONST MaxDistance = 1.0E30;\n\nVAR\n min : REAL;\n h,z :"
& " Link;\n N: INTEGER;\n\n@CheckforMin\nPROCEDURE CheckforMin (p1, p2: "
& "Point) =@\n VAR dist: REAL;\n BEGIN\n@5 IF (dist(p1,p2) < min) TH"
& "EN @\n@10 updatemin(p1,p2); @\n END;\n@CheckforMin\n\n\n@FindClo"
& "sestPair\nPROCEDURE FindClosestPair(VAR c: Link; N: INTEGER): Link =@\n"
& " VAR\n a, b, t1, t2 : Link;\n middle_xcoord : REAL;\n p1, p2"
& ", p3, p4: Point;\n\n BEGIN\n@5 a := c;@\n@10 b := MiddleofList(c,"
& "N);@\n@15 middle_xcoord := b^.p.x;@\n\n@20 t1 := FindClosestPair(a,"
& " N DIV 2);@\n@25 t2 := FindClosestPair(b, N - (N DIV 2));@\n\n@30 c"
& " := Merge(t1, t2);@\n\n@35 a := c;@\n REPEAT\n@40 IF ((ABS(a"
& "^.p.x - middle_xcoord) < min) AND (p1 <> z^.p)) THEN@\n BEGIN\n@"
& "45 CheckforMin(a^.p, p1);@\n@50 CheckforMin(a^.p, p2);@\n@5"
& "5 CheckforMin(a^.p, p3);@\n@60 CheckforMin(a^.p, p4);@\n@65"
& " p1 := p2; p2 := p3; p3 := p4; p4 := a^.p;@\n END { IF };\n"
& "@70 a := a^.next;@\n@75 UNTIL a = z;@\n\n@80 RETURN c;@\n END;\n"
& "@FindClosestPair\n\n\n@Main\nBEGIN {main module: computes closest pair "
& "in given set of points} @\n\n@5 InitializeListofPoints(h,N);@\n\n@10 "
& " h := Sort_byXcoordinate(h, N);@\n\n@15 h := FindClosestPair(h, N);@\n"
& "\nEND.\n@Main\n";
CONST E94 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Hull"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) (S"
& "hape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue 4"
& ")\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorithm"
& " events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus event"
& "s\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to e"
& "vents\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height 20"
& "0 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E95 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file logo"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) (S"
& "hape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue 4"
& ")\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorithm"
& " events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus event"
& "s\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to e"
& "vents\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height 20"
& "0 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E96 =
"@DFS\nPROCEDURE DepthFirstSearch(a: ARRAY OF ARRAY OF BOOLEAN; V: INTEG"
& "ER) @=\n VAR now: INTEGER := -1;\n val := NEW(REF ARRAY OF INTEGE"
& "R, V);\n\n BEGIN\n @6 FOR k := V-1 DO val[k] := -1 END; @\n @7 F"
& "OR k := 0 TO V-1 DO @\n @8 IF val[k] < 0 THEN @\n @9 Visit("
& "k) @\n END;\n END;\n @10 END DepthFirstSearch; @\n@DFS\n"
& "\n@VISIT\nPROCEDURE Visit(k: INTEGER) @=\n BEGIN\n@1 INC(now); val[k]"
& " := now;@\n@2 FOR t := 0 TO V-1 DO @\n@3 IF a[k, t] THEN @\n@4 "
& " IF val[t] < 0 THEN @\n@5 Visit(t); @\n END;\n END;\n E"
& "ND;\nEND Visit;\n @VISIT\n";
CONST E97 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Hash"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4) (S"
& "hape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glue 4"
& ")\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algorithm"
& " events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus event"
& "s\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args to e"
& "vents\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height 20"
& "0 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E98 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Binp"
& "ack.evt.\n;************************************************************"
& "********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25"
& " + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"NewWeight: Stop? \") \n "
& " (Boolean %stopAtNewWeight =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weig"
& "ht: \")\n (Shape (Width 80) (Numeric %waitAtNewWeigh"
& "t =1 \n (Min 0) (Max 100)"
& "))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " ";
CONST E98_0 =
"(HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Pack: Stop? \") \n (Boolean %stopAtPack =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtPack =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape "
& "(Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + "
& "0) \n \"Ignore: Stop? \") \n "
& " (Boolean %stopAtIgnore =TRUE \"\")\n (Glue"
& " 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")"
& "\n (Shape (Width 80) (Numeric %waitAtIgnore =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Probe: Stop? \") \n (Boolean %stopAtProbe =TR"
& "UE \"\")\n (Glue 10)\n (Shape (Wi"
& "dth + 0) (Height + 0) \"Weight: \")\n (Shape (Width "
& "80) (Numeric %waitAtProbe =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n )\n "
& " (Glue 4)\n (VBox\n (Glue 5)\n (Shape"
& " (Width + 0) (Height 16 + 0) \"Cts:\")\n (Button %eventCount"
& "s\n (VBox\n (Glue 6)\n (HBox"
& " Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewWeight \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfPack \"0\")))\n (G"
& "lue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " ";
CONST E98_1 =
" (Text %ctOfIgnore \"0\")))\n (G"
& "lue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfProbe \"0\")))\n "
& " (Glue 3))))\n Fill\n (Glue 4 + Inf)\n )\n"
& " )\n )\n )\n)\n";
CONST E99 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Subt"
& "ype.evt.\n;************************************************************"
& "********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25"
& " + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"Begin: Stop? \") \n "
& " (Boolean %stopAtBegin =TRUE \"\")\n (Glue "
& "10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitAtBegin =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox "
& "Fill (";
CONST E99_0 =
"Shape (Width + 0) (Height + 0) \n \"NewB"
& "ot: Stop? \") \n (Boolean %stopAtNewBot =TRUE \"\""
& ")\n (Glue 10)\n (Shape (Width + 0"
& ") (Height + 0) \"Weight: \")\n (Shape (Width 80) (Nu"
& "meric %waitAtNewBot =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heigh"
& "t 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"NewTop: Stop? \") \n "
& " (Boolean %stopAtNewTop =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtNewTop =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fil"
& "l (Shape (Width + 0) (Height + 0) \n \"N"
& "ewFun: Stop? \") \n (Boolean %stopAtNewFun =TRUE \""
& "\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtNewFun =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Hei"
& "ght 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n"
& " \"NewDomRng: Stop? \") \n "
& " (Boolean %stopAtNewDomRng =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtNewDomRng =1 \n"
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& "(HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"NewLoop: Stop? \") \n (Boolean %stopAtNewL"
& "oop =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (W";
CONST E99_1 =
"idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtNewLoop =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Sha"
& "pe (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height"
& " + 0) \n \"Enter: Stop? \") \n "
& " (Boolean %stopAtEnter =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtEnter =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Exit: Stop? \") \n (Boolean %stopAtExit =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtExit =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (He"
& "ight 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) "
& "\n \"SeenOK: Stop? \") \n "
& " (Boolean %stopAtSeenOK =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtSeenOK =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox "
& "Fill (Shape (Width + 0) (Height + 0) \n "
& "\"Notice: Stop? \") \n (Boolean %stopAtNotice =TRU"
& "E \"\")\n (Glue 10)\n (Shape (Wid"
& "th + 0) (Height + 0) \"Weight: \")\n (Shape (Width 8"
& "0) (Numeric %waitAtNotice =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape "
& "(Height";
CONST E99_2 =
" 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"BotLessAnyOK: Stop? \") \n "
& " (Boolean %stopAtBotLessAnyOK =TRUE \"\")\n "
& "(Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight"
& ": \")\n (Shape (Width 80) (Numeric %waitAtBotLessAny"
& "OK =1 \n (Min 0) (Max 100"
& ")))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"TopLessTopOK: Stop? \") \n (Boolea"
& "n %stopAtTopLessTopOK =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtTopLessTopOK =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height + 0) \n \""
& "TopLessNonTopKO: Stop? \") \n (Boolean %stopAtTopL"
& "essNonTopKO =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtTopLessNonTopKO =1 \n "
& " (Min 0) (Max 100)))))\n (Glu"
& "e 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height + 0) \n \"FunLess"
& "BotKO: Stop? \") \n (Boolean %stopAtFunLessBotKO ="
& "TRUE \"\")\n (Glue 10)\n (Shape ("
& "Width + 0) (Height + 0) \"Weight: \")\n (Shape (Widt"
& "h 80) (Numeric %waitAtFunLessBotKO =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) ("
& "Height + 0) \n \"FunLessTopOK: Stop? \""
& ") \n ";
CONST E99_3 =
" (Boolean %stopAtFunLessTopOK =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0"
& ") \"Weight: \")\n (Shape (Width 80) (Numeric %waitAt"
& "FunLessTopOK =1 \n (Min 0"
& ") (Max 100)))))\n (Glue 6)\n (Shape (Height 16 + "
& "0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"FunLessFun: Stop? \") \n "
& " (Boolean %stopAtFunLessFun =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtFunLessFun =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"OK: Stop? \") \n (Boolean %stopAtOK =TRUE \"\")"
& "\n (Glue 10)\n (Shape (Width + 0)"
& " (Height + 0) \"Weight: \")\n (Shape (Width 80) (Num"
& "eric %waitAtOK =1 \n (Min"
& " 0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16 "
& "+ 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"KO: Stop? \") \n (Bool"
& "ean %stopAtKO =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtKO =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " )\n (Glue 4)\n (VBox\n (Glue 5)\n "
& " (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (Butt"
& "on %eventCounts\n (VBox\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n (Glue 6)"
& "\n ";
CONST E99_4 =
" (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfBegin \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewBot \"0\")))\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfNewTop \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Heig"
& "ht 16 + 0) \n (Text %ctOfNewFun \"0\")"
& "))\n (Glue 6)\n (HBox Fill (Shape (Width "
& "+ 0) (Height 16 + 0) \n (Text %ctOfNew"
& "DomRng \"0\")))\n (Glue 6)\n (HBox Fill ("
& "Shape (Width + 0) (Height 16 + 0) \n ("
& "Text %ctOfNewLoop \"0\")))\n (Glue 6)\n ("
& "HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfEnter \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfExit \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSeenOK \"0\")))\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfNotice \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Heig"
& "ht 16 + 0) \n (Text %ctOfBotLessAnyOK "
& "\"0\")))\n (Glue 6)\n (HBox Fill (Shape ("
& "Width + 0) (Height 16 + 0) \n (Text %c"
& "tOfTopLessTopOK \"0\")))\n (Glue 6)\n (HB"
& "ox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfTopLessNonTopKO \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " ";
CONST E99_5 =
" (Text %ctOfFunLessBotKO \"0\")))\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfFunLessTopOK \"0\")))\n"
& " (Glue 6)\n (HBox Fill (Shape (Width + 0)"
& " (Height 16 + 0) \n (Text %ctOfFunLess"
& "Fun \"0\")))\n (Glue 6)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height 16 + 0) \n (Tex"
& "t %ctOfOK \"0\")))\n (Glue 6)\n (HBox Fil"
& "l (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfKO \"0\")))\n (Glue 3))))\n Fill\n"
& " (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E100 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Rim (Pen 5) "
& "\n (Frame Lowered \n (Shape (Width 100) (Height 30) \n (TextEd"
& "it %text (Value \"MENTOR\")))))\n";
CONST E101 =
"(* Copyright 1993 Digital Equipment Corporation. "
& " *)\n(* Distributed only by permission. "
& " *)\n(* "
& " *)\n(* Last modified on Thu Oct 14 17:07:36 P"
& "DT 1993 by heydon *)\n(* modified on Tue Jul 27 "
& "16:25:00 PDT 1993 by rsanchez *)\n\n(* This view shows "
& "the total number of hops that each packet needs to traverse\n to go f"
& "rom its source to its destination node. *) \n\nlet BackGroundColor = co"
& "lor_named(\"White\");\nlet MinHopsColor = color_named(\"Pink\");\nlet C"
& "urrHopsColor = color_named(\"Yellow\");\nlet LabelColor = color_named(\""
& "Black\");\nlet CapColor = LabelColor;\nlet BorderColor = LabelColor;\n\n"
& "let BarWidth = 0.40;\nlet CapFactor = 0.025;\nlet Gap = 0.05;\nlet Sout"
& "hInit = ~3.0;\nlet BorderSize = 0.05;\nlet ScaleFactor = 1.5;\n\nlet XV"
& "alR = proc(i) float(i) + (Gap+BarWidth)/2.0 end;\nlet XValL = proc(i) f"
& "loat(i) - (Gap+BarWidth)/2.0 end;\n\nlet FontFromSize =\n proc(g, sz)\n"
& " graph_newFont(g, \"Helvetica\", sz, \"Roman\", \"bold\", \"*\")\n "
& "end;\n\nlet MoveTextVertex =\n proc(vtx, font, x, y, height)\n grap"
& "h_setVertexFont(vtx, font);\n graph_moveVertex(vtx, x, y, false);\n "
& " graph_setVertexSize(vtx, 1.0, height);\n end;\n\nlet MakeTextVertex"
& " =\n proc(vtx, font, x, y, height)\n graph_setVertexColor(vtx, Back"
& "GroundColor);\n graph_setVertexLabelColor(vtx, LabelColor);\n Mov"
& "eTextVertex(vtx, font, x, y, height)\n end;\n\nlet MoveBarVertex =\n "
& "proc(vtx, width, height, x)\n graph_setVertexSize(vtx, width, height"
& ");\n graph_moveVertex(vtx, x, height/2.0, false);\n end;\n \nlet"
& " MakeBarVertex =\n proc(vtx, clr, width, height, x)\n graph_setVert"
& "exBorder(vtx, BorderSize);\n graph_setVertexBorderColor(vtx, BorderC"
& "olor); \n graph_setVertexColor(vtx, clr);\n MoveBarVertex(vtx, wi"
& "dth, height, x)\n end;\n\nlet MoveCapVertex =\n proc(vtx, (*int*) x, "
& "(*int*) y, (*real*) height)\n graph_setVertexSize(vtx, BarWidth, hei"
& "ght);\n graph";
CONST E101_0 =
"_moveVertex(vtx, XValR(x), float(y)+(height/2.0), false);\n end;\n\nle"
& "t MakeCapVertex =\n proc(vw, (*int*) x, (*int*) y, (*real*) height)\n "
& " let vtx = graph_newVertex(vw.graphvbt);\n graph_setVertexBorder(v"
& "tx, BorderSize);\n graph_setVertexBorderColor(vtx, BorderColor);\n "
& " graph_setVertexColor(vtx, CapColor);\n MoveCapVertex(vtx, x, y, he"
& "ight);\n vtx\n end;\n\nlet view =\n {\n graphvbt => graph_new()"
& ",\n pktCnt => ok,\t(* total number of packets (from \"StartPackets\""
& ") *)\n maxHops => 0.0,\t(* current max number of hops (related to \""
& "north\" *)\n hopsT => ok,\t(* array of packets *)\n caps => ok,\t"
& "\t(* array of caps *)\n capCnt => 0,\t(* number of caps *)\n resc"
& "ale => false,\t(* should world coordinates be scaled vertically? *)\n "
& " fontSz => 0.5,\t(* label font size *)\n vtxFont => ok,\t(* font us"
& "ed to display two rows of labels *)\n labH => 1.0,\t(* vertical size"
& " of label vertex *)\n yLab1 => ~1.0,\t(* \"y\" coordinate of first r"
& "ow of labels *)\n yLab2 => ~2.0,\t(* \"y\" coordinate of second row "
& "of labels *)\n (* world coordinates *)\n west => ~1.0,\t(* readon"
& "ly *)\n south => SouthInit,\n east => ok,\t\t(* depends on pktCnt"
& " *)\n north => meth(self) self.maxHops+self.capH + (self.south/South"
& "Init) end,\n capH => meth(self) CapFactor * self.maxHops end,\n\n "
& " StartGraph => meth (self, nodeCnt, maxQS, bounded, xMax, yMax)\n "
& " (* initialize graph window to be over empty space *)\n graph_setW"
& "orld(self.graphvbt, ~10.0, ~9.0, 1.0, 0.0)\n end,\n\n StartPacket"
& "s => meth (self, pktCnt)\n self.pktCnt := pktCnt;\n self.east"
& " := float(pktCnt);\n self.vtxFont := FontFromSize(self.graphvbt, s"
& "elf.fontSz);\n\n self.hopsT := array_new(pktCnt, ok);\n self."
& "caps := array_new(pktCnt, ok);\n for i = 0 to pktCnt-1 do\n "
& " let vtx1 = graph_newVertex(self.graphvbt);\n\tMakeBarVertex(vtx1, Curr"
& "HopsColor, BarWidth, BorderSize, XValR(i));\n\n\tlet vtx2 = graph_newVe"
& "rtex(self.graphvbt);\n\tMakeTextVertex(vtx2, self.vtxFont, float(i), se"
& "lf.yLab1, self.lab";
CONST E101_1 =
"H);\n\n\tlet vtx3 = graph_newVertex(self.graphvbt);\n\tMakeTextVertex(v"
& "tx3, self.vtxFont, float(i), self.yLab2, self.labH);\n\tgraph_setVertex"
& "Label(vtx3, \"0%\");\n\n\tself.hopsT[i] := {\n\t minNumHops => ok,\t(*"
& " length of shortest path for this packet *)\n\t curNumHops => 0,\t(* n"
& "umber of times this packet has moved *)\n\t vmin => vtx1,\t\t(* vertex"
& " that grows each time packet moves *)\n\t vlab1 => vtx2,\t(* packet na"
& "me label *)\n\t vlab2 => vtx3,\t(* percentage label *)\n\t}\n end"
& "\n end,\n\n NewPacket => meth (self, id, source, dest, fewestHops"
& ", name)\n let pkt = self.hopsT[id];\n pkt.minNumHops := fewes"
& "tHops;\n if float(fewestHops) > self.maxHops then\n self.ma"
& "xHops := float(fewestHops)\n end;\n graph_setVertexLabel(pkt."
& "vlab1, name);\n let vtx = graph_newVertex(self.graphvbt);\n M"
& "akeBarVertex(vtx, MinHopsColor, BarWidth, float(fewestHops), XValL(id))"
& "\n end,\n\n EndPackets => meth (self)\n graph_setWorld(self."
& "graphvbt,\n\tself.west, self.east, self.north, self.south);\n grap"
& "h_redisplay(self.graphvbt)\n end,\n\n MovePacket => meth(self, id"
& ", fromN, toN) \n let Percent = proc(pkt)\n let num = 100.0 "
& "* float(pkt.curNumHops);\n let denom = float(pkt.minNumHops);\n\t"
& "fmt_int(round(num / denom)) & \"%\"\n end;\n\n let pkt = self"
& ".hopsT[id];\n pkt.curNumHops := pkt.curNumHops + 1;\n MoveBar"
& "Vertex(pkt.vmin, BarWidth, float(pkt.curNumHops), XValR(id));\n gr"
& "aph_setVertexLabel(pkt.vlab2, Percent(pkt));\n if float(pkt.curNum"
& "Hops) > self.maxHops then\n\tself.rescale := true;\n end\n end,"
& "\n\n Absorb => meth(self, id, (*unused*) dest)\n let v = MakeCa"
& "pVertex(self, id, self.hopsT[id].curNumHops, self.capH());\n self."
& "caps[self.capCnt] := { vtx => v, id => id };\n self.capCnt := self"
& ".capCnt + 1\n end,\n\n Step => meth (self)\n if self.rescale"
& " then\n\tself.rescale := false;\n\tself.maxHops := self.maxHops * Scale"
& "Factor;\n\tself.south := self.south * ScaleFactor;\n\tself.fontSz "
& ":= self.fontSz * ScaleFact";
CONST E101_2 =
"or;\n\tself.labH := self.labH * ScaleFactor;\n\tself.yLab1 := s"
& "elf.yLab1 * ScaleFactor;\n\tself.yLab2 := self.yLab2 * ScaleFacto"
& "r;\n\n (* reposition labels and caps *)\n self.vtxFont :="
& " FontFromSize(self.graphvbt, self.fontSz);\n for i = 0 to self.p"
& "ktCnt-1 do\n let pkt = self.hopsT[i];\n\t MoveTextVertex(pkt."
& "vlab1, self.vtxFont,\n float(i), self.yLab1, self.labH);\n\t"
& " MoveTextVertex(pkt.vlab2, self.vtxFont,\n float(i), self.y"
& "Lab2, self.labH)\n end;\n for i = 0 to self.capCnt - 1 do"
& "\n\t let obj = self.caps[i];\n let id = obj.id;\n le"
& "t y = self.hopsT[id].curNumHops;\n MoveCapVertex(obj.vtx, id, "
& "y, self.capH())\n end;\n\n (* double height of world coor"
& "dinates *)\n graph_setWorld(self.graphvbt, \n\t self.west, self"
& ".east, self.north, self.south);\n end;\n\n graph_redisplay(se"
& "lf.graphvbt)\n end\n };\n";
CONST E102 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Rim\n (Pen "
& "10)\n (VBox\n (LabelFont (Family \"helvetica\") (WeightName \"bold\""
& ") (PointSize 240))\n (Font \"-adobe-helvetica-bold-r-normal--34-240-"
& "*-*-p-182-iso8859-1\")\n (HBox\n (Text LeftAlign \"Ops: \""
& ")\n (Shape (Width 100) (Numeric %Operations)))\n (Glue 10)\n "
& " (HBox\n (Text LeftAlign \"Run time: \")\n (Shape (Width 1"
& "00) (Numeric %Runtime)))))";
CONST E103 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Sear"
& "chTree.evt.\n;*********************************************************"
& "***********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 -"
& " 25 + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0"
& ")\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue"
& " 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")"
& "\n (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n"
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& "(HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"NewNode: Stop? \") \n (Boolean %stopAtNewN"
& "ode =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtNewNode =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) ("
& "Height + 0) \n \"CompareKeys: Stop? \""
& ") \n (Boolean %stopAtCompareKeys =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height"
& " + 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wa"
& "itAtCompareKeys =1 \n (Mi"
& "n 0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16"
& " + 0)";
CONST E103_0 =
"\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"AddLeaf: Stop? \") \n (Boo"
& "lean %stopAtAddLeaf =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtAddLeaf =1 \n "
& " (Min 0) (Max 100)))))\n (Glu"
& "e 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height + 0) \n \"NewSear"
& "chKey: Stop? \") \n (Boolean %stopAtNewSearchKey ="
& "TRUE \"\")\n (Glue 10)\n (Shape ("
& "Width + 0) (Height + 0) \"Weight: \")\n (Shape (Widt"
& "h 80) (Numeric %waitAtNewSearchKey =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) ("
& "Height + 0) \n \"SearchEnd: Stop? \") "
& "\n (Boolean %stopAtSearchEnd =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0"
& ") \"Weight: \")\n (Shape (Width 80) (Numeric %waitAt"
& "SearchEnd =1 \n (Min 0) ("
& "Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"GoLeft: Stop? \") \n (Boolea"
& "n %stopAtGoLeft =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtGoLeft =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n"
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Wi"
& "dth + 0) (Height + 0) \n \"SpliceOut: "
& "Stop? \") \n (Boolean %stopAtSpliceOut =TRUE \"\")\n"
& " ";
CONST E103_1 =
" (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtSpliceOut =1 \n (Min 0"
& ") (Max 100)))))\n (Glue 6)\n (Shape (Height 16 + "
& "0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Copy: Stop? \") \n (Bool"
& "ean %stopAtCopy =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtCopy =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Wid"
& "th + 0) (Height + 0) \n \"CurrentNode: "
& " Stop? \") \n (Boolean %stopAtCurrentNode =TRUE \"\""
& ")\n (Glue 10)\n (Shape (Width + 0"
& ") (Height + 0) \"Weight: \")\n (Shape (Width 80) (Nu"
& "meric %waitAtCurrentNode =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape ("
& "Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0"
& ") \n \"SetType: Stop? \") \n "
& " (Boolean %stopAtSetType =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtSetType =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n ("
& "HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"RedRedClash: Stop? \") \n (Boolean %stopAtR"
& "edRedClash =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& "(Shape (Width 80) (Numeric %waitAtRedRedClash =1 \n "
& " ";
CONST E103_2 =
" (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width +"
& " 0) (Height + 0) \n \"CheckUncle: Stop"
& "? \") \n (Boolean %stopAtCheckUncle =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Hei"
& "ght + 0) \"Weight: \")\n (Shape (Width 80) (Numeric "
& "%waitAtCheckUncle =1 \n ("
& "Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Height "
& "16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Rotate: Stop? \") \n "
& " (Boolean %stopAtRotate =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtRotate =1 \n "
& " (Min 0) (Max 100)))))\n "
& "(Glue 6)\n )\n (Glue 4)\n (VBox\n "
& " (Glue 5)\n (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n "
& " (Button %eventCounts\n (VBox\n (G"
& "lue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfNewNode \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height"
& " 16 + 0) \n (Text %ctOfCompareKeys \"0"
& "\")))\n (Glue 6)\n (HBox Fill (Shape (Wid"
& "th + 0) (Height 16 + 0) \n (Text %ctOf"
& "AddLeaf \"0\")))\n (Glue 6)\n (HBox Fill "
& "(Shape (Width + 0) (Height 16 + 0) \n "
& "(Text %ctOfNewSearchKey \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSearchEnd \"0\")))\n (Glue 6)"
& "\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " ";
CONST E103_3 =
" (Text %ctOfGoLeft \"0\")))\n (Glue "
& "6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSpliceOut \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height "
& "16 + 0) \n (Text %ctOfCopy \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) "
& "(Height 16 + 0) \n (Text %ctOfCurrentN"
& "ode \"0\")))\n (Glue 6)\n (HBox Fill (Sha"
& "pe (Width + 0) (Height 16 + 0) \n (Tex"
& "t %ctOfSetType \"0\")))\n (Glue 6)\n (HBo"
& "x Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfRedRedClash \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfCheckUncle \"0\")))\n ("
& "Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) "
& "\n (Text %ctOfRotate \"0\")))\n "
& " (Glue 3))))\n Fill\n (Glue 4 + Inf)\n "
& " )\n )\n )\n )\n)\n";
CONST E104 =
"#| Copyright 1993 Digital Equipment Corporation. |#\n#| Distributed onl"
& "y by permission. |#\n#| Last modified on Tue Sep 21 14:51:34 PDT 1993 b"
& "y hania |#\n#| modified on Wed Jul 14 23:01:32 PDT 1993 by mhb |#\n"
& "\n(Rim (Pen 5) (Shape (Width + 300)\n (VBox\n (HBox \n (Menu \"C"
& "anned Examples\"\n (VBox \n (MButton %ex1 \"Example 1\") \n"
& " (MButton %ex2 \"Example 2\")\n (MButton %ex3 \"Example 3"
& "\") \n (MButton %ex4 \"Example 4\")\n (MButton %ex5 \"Exa"
& "mple 5\") \n (MButton %ex6 \"Example 6\")\n (MButton %ex7"
& " \"Example 7\") \n (MButton %ex8 \"Example 8\")\n (MButto"
& "n %ex9 \"Example 9\") \n (MButton %ex10 \"Example 10\")\n "
& " ))\n (Glue 10)\n (Menu \"Canned Non-Examples\"\n (VBox \n "
& " (MButton %nonex1 \"Example 1\") \n (MButton %nonex2 \"Exam"
& "ple 2\")\n (MButton %nonex3 \"Example 3\") \n (MButton %n"
& "onex4 \"Example 4\")\n (MButton %nonex5 \"Example 5\") \n "
& " (MButton %nonex6 \"Example 6\")\n (MButton %nonex7 \"Example 7\""
& ") \n (MButton %nonex8 \"Example 8\")\n (MButton %nonex9 \""
& "Example 9\") \n (MButton %nonex10 \"Example 10\")\n )) Fi"
& "ll )\n (Glue 10)\n (HBox \n (Text \"Left type: \") \n (Border"
& " (Rim (TypeIn %typeleft))))\n (Glue 10)\n (HBox \n (Text \"Right t"
& "ype: \") \n (Border (Rim (TypeIn %typeright)))))))\n\n\n";
CONST E105 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* All"
& " rights reserved. *)\n(* See the f"
& "ile COPYRIGHT for a full description. *)\n\n@RedBlackTest\nP"
& "ROCEDURE RedBlackTest(insKey, delKey: ARRAY OF Key)@\n VAR t: Tree; n:"
& " Node; BEGIN\n @1 t.root := NIL@;\n @2 FOR i := FIRST(insKey^) TO"
& " LAST(insKey^) DO@\n @3 n := NEW(Node, key := insKey[i])@;\n "
& "@4 RedBlackInsert(t, n)@\n END\n\n (* Delete \"delKey\" keys *)\n"
& " @5 FOR i := FIRST(delKey^) TO LAST(delKey^) DO@\n @6 n := Sear"
& "ch(alg, delKey[i])@;\n @7 RedBlackDelete(alg, n)@\n END;\n END"
& " RedBlackTest;\n@RedBlackTest\n\n@Insert\nPROCEDURE Insert(t: Tree; n: "
& "Node)@ =\n VAR temp, curr: Node; BEGIN\n @3 temp := t.root;@\n @"
& "4 curr := NIL;@\n @5 WHILE temp # NIL DO@\n @6 curr := temp;@\n"
& " @7 IF n.key < curr.key@\n THEN @8 temp := curr.left@\n "
& " ELSE @9 temp := curr.right@\n END\n END;\n @10 n.parent "
& ":= curr;@\n @11 IF curr = NIL@ THEN @12 t.root := n@ ELSE\n @13"
& " IF n.key < curr.key@\n THEN @14 curr.left := n@\n ELSE @"
& "15 curr.right := n@\n END\n END\n END Insert;\n@Insert\n\n@Red"
& "BlackInsert\nPROCEDURE RedBlackInsert(t: Tree; n: Node)@ =\n VAR side,"
& " other: Side; BEGIN\n @1 Insert(t, n)@;\n @2 n.type := NodeType.R"
& "ed@;\n @3 WHILE n.parent # NIL AND n.parent.type = NodeType.Red@ DO\n"
& " <* ASSERT n.parent.parent # NIL *>\n @4 IF n.parent = n.pare"
& "nt.parent.left@\n THEN @5 side := BSTAlg.Side.Left@;\n EL"
& "SE @6 side := BSTAlg.Side.Right;@\n END;\n @7 other := BSTAlg"
& ".OtherSide[side]@;\n @8 y := GetChild(n.parent.parent, other)@;\n "
& " @9 IF y # NIL AND y.type = NodeType.Red@ THEN\n (* Case 1 *"
& ")\n @10 n.parent.type := NodeType.Black@;\n @11 y.type :="
& " NodeType.Black@;\n @12 n.parent.parent.type := NodeType.Red@;\n"
& " @13 n := n.parent.parent@\n ELSE\n @14 IF n = BSTAl"
& "g.GetChild(n.parent, other)@ THEN\n (* Case 2 *)\n @1"
& "5 n := ";
CONST E105_0 =
"n.parent@;\n @16 BSTAlg.Rotate(tree, n, side)@\n END;\n"
& " (* Case 3 *)\n @17 n.parent.type := NodeType.Black@;\n "
& " @18 n.parent.parent.type := NodeType.Red@;\n @19 Rotate(tr"
& "ee, n.parent.parent, other)@\n END;\n END;\n <* ASSERT tree."
& "root # NIL *>\n @20 IF tree.root.type # NodeType.Black THEN\n @"
& "21 tree.root.type := NodeType.Black@\n END\n END RedBlackInsert;\n@"
& "RedBlackInsert\n\n@Search\nPROCEDURE Search(t: Tree; k: Key): Node@ =\n"
& " VAR n: Node; BEGIN\n @1 n := t.root@;\n @2 WHILE n # t.nil AND "
& "n.key # key DO@\n @3 IF key < n.key@\n THEN @4 n := n.left@"
& "\n ELSE @5 n := n.right@\n END\n END;\n @6 RETURN n@\n"
& " END Search;\n@Search\n\n@RedBlackDelete\nPROCEDURE RedBlackDelete(t: "
& "Tree; n: Node)@ =\n VAR splice, splice_ch: Node; BEGIN\n (* Set \"s"
& "plice\" to the node to splice out *)\n @1 IF n.left = t.nil OR n.rig"
& "ht = t.nil@\n THEN @2 splice := n@\n ELSE @3 splice := FindMi"
& "n(n.right)@\n END;\n\n (* Splice out \"splice\" node *)\n @4 s"
& "plice_ch := SpliceOut(t, splice)@;\n\n (* Replace \"n\" by \"splice\""
& " if necessary *)\n @5 IF splice # n@ THEN\n @6 n.key := splice."
& "key@\n (* << copy other node fields here >> *)\n END\n\n (* "
& "Fix up tree if there is potential for double-black *)\n @7 IF splice"
& ".type = NodeType.Black@ THEN\n @8 RedBlackFixUp(t, splice_ch)@\n "
& "END RedBlackDelete;\n@RedBlackDelete\n\n@FindMin\nPROCEDURE FindMin(n: "
& "Node): Node@ =\n BEGIN\n @1 WHILE n.left # NIL DO@\n @2 n := n"
& ".left2@\n END;\n @3 RETURN n@\n END FindMin;\n@FindMin\n\n@Splic"
& "eOut\nPROCEDURE SpliceOut(t: Tree; n: Node)@ =\n VAR ch: Node; BEGIN\n"
& " (* Set \"ch\" to child of \"n\" or NIL *)\n @1 IF n.left # NIL@\n"
& " THEN @2 ch := n.left@\n ELSE @3 ch := n.right@\n END;\n\n"
& " (* Update \"up\" pointer *)\n @4 IF ch # NIL@ THEN\n @5 ch."
& "parent := n.parent@\n END;\n\n (* Update \"down\" pointers *)\n "
& " @6 IF n.parent = NIL@ THEN\n @7 t.root := ch@\n ELSE\n @"
& "8 IF n = n.parent.left@\n THEN";
CONST E105_1 =
" @9 n.parent.left := ch@\n ELSE @10 n.parent.right := ch@\n "
& " END\n END;\n @11 RETURN ch@\n END SpliceOut;\n@SpliceOut\n\n@Re"
& "dBlackFixUp\nPROCEDURE RedBlackFixUp(t: Tree; n: Node)@ =\n VAR siblin"
& "g: Node; side, other: Side BEGIN\n @1 WHILE n # t.root AND n.type = "
& "NodeType.Black DO@\n @2 IF n = n.parent.left@\n THEN @3 sid"
& "e := Side.Left; other := side.Right@;\n ELSE @4 side := Side.Ri"
& "ght; other := side.Left@;\n END;\n @5 sibling := GetChild(n.p"
& "arent, other)@;\n @6 IF sibling.type = NodeType.Red@ THEN\n "
& " (* Case 1 *)\n @7 sibling.type := NodeType.Black@;\n @8 "
& "n.parent.type := NodeType.Red@;\n @9 Rotate(t, n.parent, side)@;"
& "\n @10 sibling := GetChild(n.parent, other)@\n END;\n "
& "@11 IF sibling.left.type = NodeType.Black\n AND sibling.right.t"
& "ype = NodeType.Black@ THEN\n (* Case 2 *)\n @12 sibling.t"
& "ype := NodeType.Red@;\n @13 n := n.parent@\n ELSE\n "
& "@14 IF GetChild(sibling, other).type = NodeType.Black@ THEN\n "
& "@15 GetChild(sibling, side).type := NodeType.Black@;\n @16 sib"
& "ling.type := NodeType.Red@;\n @17 Rotate(t, sibling, other)@;\n"
& " @18 sibling := GetChild(n.parent, other)@\n END;\n "
& " (* Case 4 *)\n @19 sibling.type := n.parent.type@;\n "
& "@20 n.parent.type := NodeType.Black@;\n @21 GetChild(sibling, ot"
& "her).type := NodeType.Black@;\n @22 Rotate(t, n.parent, side)@;\n"
& " @23 n := t.root@\n END\n END;\n @24 IF n.type # Node"
& "Type.Black@ THEN\n @25 n.type := NodeType.Black@\n END\n END R"
& "edBlackFixUp\n@RedBlackFixUp\n";
CONST E106 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Pars"
& "e.evt.\n;**************************************************************"
& "******\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 +"
& " Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (H"
& "eight 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0)"
& " \n \"Push: Stop? \") \n "
& " (Boolean %stopAtPush =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtPush =1 \n "
& " (Min 0) (Max 100)))))\n "
& "(Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fill "
& "(Shape";
CONST E106_0 =
" (Width + 0) (Height + 0) \n \"Pop: St"
& "op? \") \n (Boolean %stopAtPop =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height +"
& " 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wait"
& "AtPop =1 \n (Min 0) (Max "
& "100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Scan: Stop? \") \n (Boolean %st"
& "opAtScan =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n (S"
& "hape (Width 80) (Numeric %waitAtScan =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0)"
& " (Height + 0) \n \"NoteError: Stop? \""
& ") \n (Boolean %stopAtNoteError =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height +"
& " 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wait"
& "AtNoteError =1 \n (Min 0)"
& " (Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0"
& ")\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Goto: Stop? \") \n (Boole"
& "an %stopAtGoto =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtGoto =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Widt"
& "h + 0) (Height + 0) \n \"NewNode: Stop"
& "? \") \n (Boolean %stopAtNewNode =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height"
& " + 0) \"We";
CONST E106_1 =
"ight: \")\n (Shape (Width 80) (Numeric %waitAtNewNod"
& "e =1 \n (Min 0) (Max 100)"
& "))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"NewTerm: Stop? \") \n (Boolean %sto"
& "pAtNewTerm =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& "(Shape (Width 80) (Numeric %waitAtNewTerm =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width"
& " + 0) (Height + 0) \n \"NewEdge: Stop?"
& " \") \n (Boolean %stopAtNewEdge =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtNewEdge =1 \n (Min 0) "
& "(Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)"
& "\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"DeleteLeaf: Stop? \") \n ("
& "Boolean %stopAtDeleteLeaf =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtDeleteLeaf =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox "
& "Fill (Shape (Width + 0) (Height + 0) \n "
& "\"UpdateDone: Stop? \") \n (Boolean %stopAtUpdateD"
& "one =TRUE \"\")\n (Glue 10)\n (Sh"
& "ape (Width + 0) (Height + 0) \"Weight: \")\n (Shape "
& "(Width 80) (Numeric %waitAtUpdateDone =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " )\n ";
CONST E106_2 =
" (Glue 4)\n (VBox\n (Glue 5)\n ("
& "Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (Button %event"
& "Counts\n (VBox\n (Glue 6)\n "
& "(HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfPush \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfPop \"0\")))\n (Gl"
& "ue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfScan \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16"
& " + 0) \n (Text %ctOfNoteError \"0\")))"
& "\n (Glue 6)\n (HBox Fill (Shape (Width + "
& "0) (Height 16 + 0) \n (Text %ctOfGoto "
& "\"0\")))\n (Glue 6)\n (HBox Fill (Shape ("
& "Width + 0) (Height 16 + 0) \n (Text %c"
& "tOfNewNode \"0\")))\n (Glue 6)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewTerm \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewEdge \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfDeleteLeaf \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + "
& "0) \n (Text %ctOfUpdateDone \"0\")))\n"
& " (Glue 3))))\n Fill\n (Glue 4 + Inf)\n"
& " )\n )\n )\n )\n)\n";
CONST E107 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Unio"
& "nFind.evt.\n;**********************************************************"
& "**********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - "
& "25 + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)"
& "\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue "
& "10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n"
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n ("
& "HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup ="
& "TRUE \"\")\n (Glue 10)\n (Shape ("
& "Width + 0) (Height + 0) \"Weight: \")\n (Shape (Widt"
& "h 80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shap"
& "e (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height "
& "+ 0) \n \"NewSet: Stop? \") \n "
& " (Boolean %stopAtNewSet =TRUE \"\")\n (Gl"
& "ue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtNewSet =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box F";
CONST E107_0 =
"ill (Shape (Width + 0) (Height + 0) \n \""
& "FinishedSets: Stop? \") \n (Boolean %stopAtFinishe"
& "dSets =TRUE \"\")\n (Glue 10)\n ("
& "Shape (Width + 0) (Height + 0) \"Weight: \")\n (Shap"
& "e (Width 80) (Numeric %waitAtFinishedSets =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width"
& " + 0) (Height + 0) \n \"StartFind: Sto"
& "p? \") \n (Boolean %stopAtStartFind =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Hei"
& "ght + 0) \"Weight: \")\n (Shape (Width 80) (Numeric "
& "%waitAtStartFind =1 \n (M"
& "in 0) (Max 100)))))\n (Glue 6)\n (Shape (Height 1"
& "6 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"EndFind: Stop? \") \n "
& " (Boolean %stopAtEndFind =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtEndFind =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fil"
& "l (Shape (Width + 0) (Height + 0) \n \"S"
& "tartDoFind: Stop? \") \n (Boolean %stopAtStartDoFi"
& "nd =TRUE \"\")\n (Glue 10)\n (Sha"
& "pe (Width + 0) (Height + 0) \"Weight: \")\n (Shape ("
& "Width 80) (Numeric %waitAtStartDoFind =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0"
& ") (Height + 0) \n \"StepUp: Stop? \") "
& "\n (Boolean %stopAtStepUp =TRUE \"\")\n "
& " ";
CONST E107_1 =
"(Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight"
& ": \")\n (Shape (Width 80) (Numeric %waitAtStepUp =1 "
& "\n (Min 0) (Max 100)))))\n"
& " (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Found: Stop? \") \n (Boolean %stopAtFound"
& " =TRUE \"\")\n (Glue 10)\n (Shape"
& " (Width + 0) (Height + 0) \"Weight: \")\n (Shape (Wi"
& "dth 80) (Numeric %waitAtFound =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Sh"
& "ape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Heigh"
& "t + 0) \n \"StepDown: Stop? \") \n "
& " (Boolean %stopAtStepDown =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Wei"
& "ght: \")\n (Shape (Width 80) (Numeric %waitAtStepDow"
& "n =1 \n (Min 0) (Max 100)"
& "))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"ChangeParent: Stop? \") \n (Boolean"
& " %stopAtChangeParent =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtChangeParent =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fil"
& "l (Shape (Width + 0) (Height + 0) \n \"E"
& "ndDoFind: Stop? \") \n (Boolean %stopAtEndDoFind ="
& "TRUE \"\")\n (Glue 10)\n (Shape ("
& "Width + 0) (Height + 0) \"Weight: \")\n (Shape (Widt"
& "h 80) (Numeric %waitAtEndDoFind =1 \n "
& " ";
CONST E107_2 =
" (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"StartUnion: Stop? \") \n "
& " (Boolean %stopAtStartUnion =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"We"
& "ight: \")\n (Shape (Width 80) (Numeric %waitAtStartU"
& "nion =1 \n (Min 0) (Max 1"
& "00)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"FoundFirst: Stop? \") \n (Boolea"
& "n %stopAtFoundFirst =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtFoundFirst =1 \n "
& " (Min 0) (Max 100)))))\n ("
& "Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fill ("
& "Shape (Width + 0) (Height + 0) \n \"Comp"
& "areRanks: Stop? \") \n (Boolean %stopAtCompareRank"
& "s =TRUE \"\")\n (Glue 10)\n (Shap"
& "e (Width + 0) (Height + 0) \"Weight: \")\n (Shape (W"
& "idth 80) (Numeric %waitAtCompareRanks =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width + 0"
& ") (Height + 0) \n \"Unite: Stop? \") \n"
& " (Boolean %stopAtUnite =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"We"
& "ight: \")\n (Shape (Width 80) (Numeric %waitAtUnite "
& "=1 \n (Min 0) (Max 100)))"
& "))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " ";
CONST E107_3 =
" \"EndUnion: Stop? \") \n (Boolean %stopAtEn"
& "dUnion =TRUE \"\")\n (Glue 10)\n "
& "(Shape (Width + 0) (Height + 0) \"Weight: \")\n (Sha"
& "pe (Width 80) (Numeric %waitAtEndUnion =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " )\n (Glue 4)\n (VBox\n (Glue 5)\n "
& " (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n (Butto"
& "n %eventCounts\n (VBox\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfSetup \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewSet \"0\")))\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfFinishedSets \"0\")))\n"
& " (Glue 6)\n (HBox Fill (Shape (Width + 0)"
& " (Height 16 + 0) \n (Text %ctOfStartFi"
& "nd \"0\")))\n (Glue 6)\n (HBox Fill (Shap"
& "e (Width + 0) (Height 16 + 0) \n (Text"
& " %ctOfEndFind \"0\")))\n (Glue 6)\n (HBox"
& " Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfStartDoFind \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfStepUp \"0\")))\n (Glue "
& "6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfFound \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 +"
& " 0) \n (Text %ctOfStepDown \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) "
& "(Height 16 + 0) \n (Text %ctOfChangePa"
& "rent \"0\")";
CONST E107_4 =
"))\n (Glue 6)\n (HBox Fill (Shape (Width "
& "+ 0) (Height 16 + 0) \n (Text %ctOfEnd"
& "DoFind \"0\")))\n (Glue 6)\n (HBox Fill ("
& "Shape (Width + 0) (Height 16 + 0) \n ("
& "Text %ctOfStartUnion \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfFoundFirst \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfCompareRanks \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 1"
& "6 + 0) \n (Text %ctOfUnite \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) "
& "(Height 16 + 0) \n (Text %ctOfEndUnion"
& " \"0\")))\n (Glue 3))))\n Fill\n (Glue"
& " 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E108 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Mini"
& "max.evt.\n;************************************************************"
& "********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25"
& " + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"PlayerMove: Stop? \") \n "
& " (Boolean %stopAtPlayerMove =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"We"
& "ight: \")\n (Shape (Width 80) (Numeric %waitAtPlayer"
& "Move =1 \n (Min 0) (Max 1"
& "00)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " ";
CONST E108_0 =
" (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Finished: Stop? \") \n (Boolean %stopAt"
& "Finished =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n (S"
& "hape (Width 80) (Numeric %waitAtFinished =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width "
& "+ 0) (Height + 0) \n \"EvaluateNode: S"
& "top? \") \n (Boolean %stopAtEvaluateNode =TRUE \"\")"
& "\n (Glue 10)\n (Shape (Width + 0)"
& " (Height + 0) \"Weight: \")\n (Shape (Width 80) (Num"
& "eric %waitAtEvaluateNode =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape ("
& "Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0"
& ") \n \"PlayerThinking: Stop? \") \n "
& " (Boolean %stopAtPlayerThinking =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0"
& ") \"Weight: \")\n (Shape (Width 80) (Numeric %waitAt"
& "PlayerThinking =1 \n (Min"
& " 0) (Max 100)))))\n (Glue 6)\n (Shape (Height 16 "
& "+ 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"FinishedEvalNode: Stop? \") \n "
& " (Boolean %stopAtFinishedEvalNode =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"We"
& "ight: \")\n (Shape (Width 80) (Numeric %waitAtFinish"
& "edEvalNode =1 \n (Min 0) "
& "(Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)"
& "\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"BoardValueUpdated: Stop? \") \n "
& " ";
CONST E108_1 =
" (Boolean %stopAtBoardValueUpdated =TRUE \"\")\n (Gl"
& "ue 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtBoardValueUpda"
& "ted =1 \n (Min 0) (Max 10"
& "0)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"HumanCellSelected: Stop? \") \n ("
& "Boolean %stopAtHumanCellSelected =TRUE \"\")\n (Glue"
& " 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \")"
& "\n (Shape (Width 80) (Numeric %waitAtHumanCellSelect"
& "ed =1 \n (Min 0) (Max 100"
& ")))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"HumanIllegalMove: Stop? \") \n (Bo"
& "olean %stopAtHumanIllegalMove =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtHumanIllegalMove ="
& "1 \n (Min 0) (Max 100))))"
& ")\n (Glue 6)\n )\n (Glue 4)\n (VB"
& "ox\n (Glue 5)\n (Shape (Width + 0) (Height 16 + 0"
& ") \"Cts:\")\n (Button %eventCounts\n (VBox\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (H"
& "eight 16 + 0) \n (Text %ctOfSetup \"0\""
& ")))\n (Glue 6)\n (HBox Fill (Shape (Width"
& " + 0) (Height 16 + 0) \n (Text %ctOfPl"
& "ayerMove \"0\")))\n (Glue 6)\n (HBox Fill"
& " (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfFinished \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " ";
CONST E108_2 =
" (Text %ctOfEvaluateNode \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfPlayerThinking \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16"
& " + 0) \n (Text %ctOfFinishedEvalNode \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + 0) (Height 16 + 0) \n (Text %ctO"
& "fBoardValueUpdated \"0\")))\n (Glue 6)\n "
& "(HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfHumanCellSelected \"0\")))\n (Glue"
& " 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfHumanIllegalMove \"0\")))\n "
& " (Glue 3))))\n Fill\n (Glue 4 + Inf)\n "
& " )\n )\n )\n )\n)\n";
CONST E109 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Rim\n (Pen "
& "10)\n (VBox\n (Text LeftAlign \"Search pattern: \")\n (Frame Low"
& "ered (TypeIn ExpandOnDemand (BgColor \"White\") %pattern =\"abra\"))\n "
& " (Glue 10)\n (Text LeftAlign \"Text to search in: \")\n (Frame "
& "Lowered (TypeIn ExpandOnDemand (BgColor \"White\") %text =\"abracadabra"
& "\"))))";
CONST E110 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Scale\n (HS"
& "cale 1)\n (VScale 1)\n (Rim\n (Pen 10)\n (VBox\n (HBox\n "
& " (Text RightAlign \"Number of Points: \")\n Fill\n ("
& "Text LeftAlign %N \"\")\n Fill)\n (Glue 10)\n (HBox\n "
& " (Text RightAlign \"Min length: \")\n Fill\n (Text "
& "LeftAlign %min \"\")\n Fill))))\n";
CONST E111 =
"Source 100 50\nV12 100 250\nV14 100 450\nV16 100 650\nV30 300 50\nV32 3"
& "00 250\nV34 250 500\nV35 350 450\nV36 300 650\nV50 500 50\nV52 500 250\n"
& "V54 500 450\nV56 500 650\nV58 500 850\nV70 700 50\nV72 700 250\nV74 700"
& " 450\nV76 700 650\nV78 700 850\nV94 900 450\nV96 900 650\nSink 900 850\n"
& "Source -> V32 0.94\nV32 -> V54 3.3\nV54 -> V76 0.94\nV76 -> Sink 1.2\nS"
& "ource -> V52 1.9\nV52 -> V74 2.5\nV74 -> Sink 0.9\nSource -> V34 0.56\n"
& "V34 -> V56 2.3\nV56 -> Sink 0.56\nSource -> V30 2.22\nV30 -> V50 2.89\n"
& "V50 -> V74 1.1\nV52 -> V70 2.5\nV70 -> V72 1.89\nV72 -> V94 2.56\nV94 -"
& "> V96 2.22\nV96 -> Sink 3.1\nSource -> V12 2.19\nV12 -> V35 2.67\nV35 -"
& "> V54 1.1\nV32 -> V14 1.14\nV14 -> V36 2.3\nV36 -> V56 1.3\nV34 -> V16 "
& "1.7\nV16 -> V58 1.0\nV58 -> V78 1.234\nV78 -> Sink 2.013\n.\n";
CONST E112 =
"@Decompress\nPROCEDURE Decompress(input, alphabet) =@\n @1 (* uncomp"
& "ress input to get codes array, pos *)@\n @2 (* decode codes array (u"
& "sing alphabet) to get lastchars array *)@\n @3 (* recompute original"
& " string using lastchars, pos *)@\n @4 (* sort lastchars array t"
& "o get firstchars array *)@\n @5 (* for each character in firstc"
& "hars, find corresponding\n character in lastchars *)@\n "
& " @6 (* starting with char in firstchars[pos], reconstruct\n "
& " original string *)@\n@Decompress\n";
CONST E113 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* Last modified on Mon Jan 9 "
& "12:14:14 PST 1995 by najork *)\n(* modified on W"
& "ed Oct 13 19:41:10 PDT 1993 by mann *)\n(* mod"
& "ified on Mon Jul 19 11:59:36 PDT 1993 by perl *)\n\n"
& "let codesColor = color_named(\"White\");\nlet codesLabelColor = color_n"
& "amed(\"Black\");\nlet codesHiliteLabelColor = color_named(\"DarkRed\");"
& "\nlet arrowColor = color_named(\"DarkRed\");\nlet rowIndexColor = color"
& "_named(\"Pink\");\nlet rowIndexLabelColor = color_named(\"Black\");\nle"
& "t otherIndexColor = color_named(\"White\");\nlet otherIndexLabelColor ="
& " color_named(\"DarkGray\");\nlet alphaColor = color_named(\"LightYellow"
& "\");\nlet alphaLabelColor = color_named(\"Black\");\nlet initialColor ="
& " color_named(\"DarkGray\");\nlet initialLabelColor = color_named(\"Blac"
& "k\");\n(*!! let shadowColor = color_named(\"LightGray\");*)\nlet shadow"
& "Color = color_named(\"VerySlightlyLightGray\");\nlet shadowLabelColor ="
& " color_named(\"Black\");\nlet ghostColor = color_named(\"White\");\nlet"
& " ghostLabelColor = color_named(\"Gray\");\nlet duplColor = color_named("
& "\"LightGray\");\nlet duplLabelColor = color_named(\"VeryDarkGray\");\n\n"
& "(***\nlet charColorNames = [\"LightVividBlue\",\n "
& "\"VerySlightlyLightQuiteVividRed\",\n \"VerySlight"
& "lyLightVividGreen\",\n \"Yellow\",\n "
& " \"VerySlightlyLightPurple\",\n \"VividRedd"
& "ishOrange\"];\n***)\nlet charColorNames = [\"VerySlightlyLightQuiteVivi"
& "dRed\",\n \"VerySlightlyDarkVividGreen\",\n "
& " \"SlightlyLightVividBlue\",\n \"Red"
& "dishVividOrange\",\n \"VerySlightlyLightPurple\",\n"
& " \"VerySlightlyDark";
CONST E113_0 =
"VeryVividYellow\"];\n\nlet charColors = foreach c in charColorNames map"
& " color_named(c) end;\n\nlet makeDippingPath = proc(startX, endX, y, dip"
& ")\n proc(t)\n [ (startX * (1.0 - t)) + (endX * t),\n\t y + ("
& "dip * (0.25 - ((t - 0.5) * (t - 0.5))))]\n end\nend;\n\nlet view =\n"
& " {\n graphvbt => graph_new(),\n vertexFont => ok,\n codes => "
& "{array => ok, vtx => ok},\n last => {chars => ok, vtx => ok},\n x"
& "last => {chars => ok, vtx => ok},\n first => {chars => ok, vtx => ok"
& ", vtxColor => ok, pendingMoves => ok},\n n => 0,\n alphalen => 0,"
& "\n colorIndex => -1,\n rowIndices => ok,\n rowIndex => ok,\n "
& " rowIndexVtx => ok,\n codeSearchArrow => ok,\n\n InitDecode => m"
& "eth(self, alpha, codes, rowIndex)\n (* Start of phase where we recon"
& "struct lastchars from codes. *)\n self.n := #(codes);\n\tself.xl"
& "ast.chars := alpha;\n\tself.alphalen := text_length(alpha);\n se"
& "lf.vertexFont := graph_newFont(self.graphvbt, \"Helvetica\",\n "
& " 0.5, \"Roman\", \"bold\", \"*\");\n\tle"
& "t north = ~5.25,\n south = float(self.n),\n west "
& "= -(float(self.alphalen) + 1.0),\n east = float(self.n) + 1."
& "0;\n\tgraph_setWorld(self.graphvbt, west, east, north, south);\n\tgraph"
& "_setAspect(self.graphvbt, (south - north) / (east - west));\n\tgraph_se"
& "tPixelSizeDivisor(self.graphvbt,\n rou"
& "nd(east - west),\n\t\t\t round(south - north));\n\n sel"
& "f.xlast.vtx := array_new(self.alphalen + self.n, ok);\n for i = "
& "0 to self.alphalen - 1 do\n let v = graph_newVertex(self.gra"
& "phvbt);\n self.xlast.vtx[i] := v;\n\t graph_setVertexSize"
& "(v, 0.0, 0.0); (*avoid glitches*)\n graph_setVertexLabel(v, "
& "text_sub(self.xlast.chars, i, 1));\n graph_setVertexFont(v, "
& "self.vertexFont);\n graph_setVertexColor(v, alphaColor);\n "
& " graph_setVertexLabelColor(v, alphaLabelColor);\n g"
& "raph_setVertexBorder(v, 0.05);\n graph_moveVertex(v, float(i"
& " - (2 * self.al";
CONST E113_1 =
"phalen)) - 4.0, ~2.0,\n false);\n en"
& "d;\n\n self.codes.array := codes;\n self.codes.vtx := arr"
& "ay_new(self.n, ok);\n for i = 0 to self.n - 1 do\n le"
& "t v = graph_newVertex(self.graphvbt);\n self.codes.vtx[i] :="
& " v;\n graph_setVertexLabel(v, fmt_int(codes[i]));\n "
& " graph_setVertexFont(v, self.vertexFont);\n graph_setVerte"
& "xColor(v, codesColor);\n graph_setVertexLabelColor(v, codesL"
& "abelColor);\n graph_setVertexBorder(v, 0.05);\n g"
& "raph_moveVertex(v, float(i), ~4.25, false);\n\t graph_setVertexSize("
& "v, 0.95, 0.95);\n end;\n\n\tlet v = graph_newVertex(self.graphvb"
& "t);\n\tself.rowIndex := rowIndex;\n\tself.rowIndexVtx := v;\n\tgraph_se"
& "tVertexShape(v, \"ellipse\");\n\tgraph_setVertexLabel(v, fmt_int(self.r"
& "owIndex));\n\tgraph_setVertexFont(v, self.vertexFont);\n\tgraph_setVert"
& "exColor(v, rowIndexColor);\n\tgraph_setVertexLabelColor(v, rowIndexLabe"
& "lColor);\n\tgraph_setVertexBorder(v, 0.05);\n\tgraph_moveVertex(v, floa"
& "t(self.n), ~4.25, false);\n\tgraph_setVertexSize(v, 0.95, 0.95);\n\n "
& " graph_redisplay(self.graphvbt);\n end,\n\t\n StartDecode => "
& "meth(self)\n for i = 0 to self.alphalen - 1 do\n\t graph_setV"
& "ertexSize(self.xlast.vtx[i], 0.95, 0.95);\n graph_moveVertex"
& "(self.xlast.vtx[i],\n float(i - self.alphal"
& "en), ~2.0, true);\n\tend;\n\n\tzeus_animate(self.graphvbt, 0.0, 1.0);\n"
& "\n\tself.rowIndices := array_new(self.n, ok);\n end,\n\n DecodeNe"
& "xtCode => meth(self, i)\n (* Looking at i\'th code, before starting "
& "to find its corresponding\n character.\n *)\n\tlet v = self.c"
& "odes.vtx[i];\n\tgraph_setVertexLabelColor(v, codesHiliteLabelColor);\n\t"
& "graph_setVertexBorder(v, 0.12);\n\n\tlet v = graph_newVertex(self.graph"
& "vbt);\n\tself.codeSearchArrow := v;\n\tgraph_setVertexFont(v, self.vert"
& "exFont);\n\tgraph_setVertexColor(v, codesColor);\n\tgraph_setVertexLabe"
& "lColor(v, codesHiliteLabelColor);\n\tgraph_setVertexBorder(v, 0.12);\n\t"
& "graph_setVertexSize(v, 0.95,";
CONST E113_2 =
" 0.95);\n\tgraph_setVertexLabel(self.codeSearchArrow, \"0\");\n \tgrap"
& "h_moveVertex(self.codeSearchArrow, float(i), ~3.0, false);\n gra"
& "ph_redisplay(self.graphvbt);\n end,\n\n DecodeDistinctCount => me"
& "th(self, i, k, n)\n (* Found another distinct character at position "
& "k in xchars while looking \n for the character corresponding to c"
& "ode i. The number of distinct \n characters found so far is n. *)"
& "\n\n \tgraph_moveVertex(self.codeSearchArrow, float(k - self.alphalen)"
& ",\n ~3.0, true);\n\tzeus_animate(self.graphvbt,"
& " 0.0, 1.0);\n\tgraph_setVertexLabel(self.codeSearchArrow, fmt_int(n));\n"
& " graph_redisplay(self.graphvbt);\n end,\n\n DecodeFoundCha"
& "r => meth(self, i, k, c)\n (* Found that the character for code i is"
& " at position k in the\n concatenated alphabet and current string "
& "and its value is c. *)\n\n \tgraph_moveVertex(self.codeSearchArrow, fl"
& "oat(k - self.alphalen),\n ~3.0, true);\n\tzeus_"
& "animate(self.graphvbt, 0.0, 1.0);\n\n self.xlast.chars := self.x"
& "last.chars &\n text_sub(self.xlast.chars, k,"
& " 1);\n let v = graph_newVertex(self.graphvbt);\n self.xla"
& "st.vtx[i + self.alphalen] := v;\n graph_setVertexLabel(v, text_s"
& "ub(self.xlast.chars, k, 1));\n\tgraph_setVertexFont(v, self.vertexFont)"
& ";\n\tgraph_setVertexSize(v, 0.95, 0.95);\n\tgraph_setVertexBorder(v, 0."
& "05);\n graph_vertexToFront(v);\n \tgraph_setVertexColor(v, alph"
& "aColor);\n \tgraph_setVertexLabelColor(v, alphaLabelColor);\n\n "
& " graph_setVertexColor(self.xlast.vtx[k], duplColor);\n graph_set"
& "VertexLabelColor(self.xlast.vtx[k], duplLabelColor);\n\n\tlet pathfunc "
& "= makeDippingPath(float(k - self.alphalen),\n "
& " float(i), ~2.0, 2.0);\n\tgraph_moveVertexOnPath(v, pathfun"
& "c);\n zeus_animate(self.graphvbt, 1.0, 2.0);\n\tgraph_removeVert"
& "ex(self.codeSearchArrow);\n self.codeSearchArrow := ok;\n\tlet v"
& " = self.codes.vtx[i];\n \tgraph_setVertexColor(v, ghostColor);\n \tgr"
& "aph_setVe";
CONST E113_3 =
"rtexLabelColor(v, ghostLabelColor);\n\tgraph_setVertexBorder(v, 0.05);\n"
& "\tgraph_redisplay(self.graphvbt);\n end,\n\n DecodeDone => meth(s"
& "elf, t, rowIndex)\n (* Declare computed lastchars array. *)\n "
& " self.last.chars := t;\n self.last.vtx := array_sub(self.xlast.v"
& "tx, self.alphalen, self.n);\n\n(*****\n for m = 0 to self.alphal"
& "en-1 do\n\t graph_moveVertex(self.xlast.vtx[m],\n "
& " float(m - (2 *self.alphalen)) - 4.0,\n\t\t\t ~2.0, true);"
& "\n end;\n*****)\n (* ghost alpha vertices *)\n for"
& " m = 0 to self.alphalen-1 do\n\t graph_setVertexColor(self.xlast.vtx"
& "[m], ghostColor);\n\t graph_setVertexLabelColor(self.xlast.vtx[m], g"
& "hostLabelColor);\n end;\n\tzeus_animate(self.graphvbt, 0.0, 2.0 "
& "(*!!*));\n(****\n for m = 0 to self.alphalen-1 do\n g"
& "raph_removeVertex(self.xlast.vtx[m]);\n end;\n****)\n\tgraph_red"
& "isplay(self.graphvbt);\n end,\n\n StartReconstruct => meth(self, "
& "lastchars, rowIndex)\n (* Start of phase where we reconstruct the or"
& "iginal string from\n lastchars and rowIndex.\n *)\n fo"
& "r i = 0 to self.n-1 do\n let v = self.last.vtx[i];\n\t gr"
& "aph_setVertexColor(self.last.vtx[i], initialColor);\n\t graph_setVer"
& "texLabelColor(self.last.vtx[i], initialLabelColor);\n graph_"
& "moveVertex(v, ~1.0, float(i), true);\n\n\t let w = graph_newVertex(s"
& "elf.graphvbt);\n graph_moveVertex(w, float(i), ~2.0, false);"
& "\n\t graph_setVertexLabel(w, text_sub(self.last.chars, i, 1));\n\t "
& " graph_setVertexSize(w, 0.95, 0.95);\n\t graph_setVertexColor(w, gh"
& "ostColor);\n graph_setVertexLabelColor(w, ghostLabelColor);\n"
& " graph_setVertexFont(w, self.vertexFont);\n graph"
& "_setVertexBorder(w, 0.05);\n\n zeus_animate(self.graphvbt, f"
& "loat(i)/float(self.n),\n (float(i)+1.0)/float(s"
& "elf.n));\n end;\n end,\n\n FirstChars => meth(self, t)\n "
& " (* Declare sorted firstchars array. *)\n self.first.vtx := arr"
& "ay_new(self.";
CONST E113_4 =
"n, ok);\n self.first.pendingMoves := [];\n self.first.vtx"
& "Color := array_new(self.n, ok);\n self.first.chars := t;\n "
& " let tmp = array_new(self.n, ok);\n for i = 0 to self.n-1 do\n "
& " let v = graph_newVertex(self.graphvbt);\n graph_m"
& "oveVertex(v, ~1.0, float(i), false);\n\t graph_setVertexLabel(v, tex"
& "t_sub(self.last.chars, i, 1));\n\t graph_setVertexShape(v, \"rectang"
& "le\");\n\t graph_setVertexSize(v, 0.95, 0.95);\n\t graph_setVerte"
& "xColor(v, initialColor);\n graph_setVertexLabelColor(v, init"
& "ialLabelColor);\n graph_setVertexFont(v, self.vertexFont);\n"
& " graph_setVertexBorder(v, 0.05);\n graph_setVerte"
& "xColor(self.last.vtx[i], shadowColor);\n graph_setVertexLabe"
& "lColor(self.last.vtx[i], shadowLabelColor);\n tmp[i] := v;\n"
& " end;\n let moved = array_new(self.n, false);\n "
& " for i = 0 to self.n-1 do\n for j = 0 to self.n-1 do\n "
& " if not(moved[j]) and\n (text_char(self.f"
& "irst.chars, i) is\n text_char(self.last.chars, j))"
& "\n then\n graph_vertexToFront(tmp[j"
& "]);\n graph_moveVertex(tmp[j], 0.0, float(i), true)"
& ";\n self.first.vtx[i] := tmp[j];\n "
& " moved[j] := true;\n zeus_animate(self.graphvbt,"
& "\n (float(i)) / 2.0,\n "
& "(float(i)+1.0) / 2.0 );\n exit;\n e"
& "nd;\n end;\n end;\n end,\n\n ConsiderChar => "
& "meth(self, i)\n (* About to look for match for element i for firstch"
& "ars *)\n\tself.colorIndex := (self.colorIndex + 1) % #(charColors);\n\t"
& "let c = charColors[self.colorIndex];\n\tlet v = self.first.vtx[i];\n\tg"
& "raph_setVertexColor(v, c);\n\tgraph_redisplay(self.graphvbt);\n end,"
& "\n\n\n EqualChars => meth(self, i, j)\n (* Decided element i of f"
& "irstchars matches element j of lastchars. *)\n\tlet c = charColors[self"
& ".col";
CONST E113_5 =
"orIndex];\n\tlet v = self.last.vtx[j];\n\tgraph_setVertexColor(v, c);\n"
& " graph_redisplay(self.graphvbt);\n end,\n\n FinishCharRun "
& "=> meth(self)\n (* Done with a run of identical chars in firstchar c"
& "olumn. *)\n\tok\n end,\n\n StartResult => meth(self)\n (* Setu"
& "p to pick off result chars. *)\n\tfor i = 0 to self.n - 1 do\n\t let"
& " v = graph_newVertex(self.graphvbt);\n\t self.rowIndices[i] := v;\n\t"
& " graph_setVertexLabel(v, fmt_int(i));\n\t graph_setVertexFont(v, "
& "self.vertexFont);\n\t graph_setVertexColor(v, otherIndexColor);\n\t "
& " graph_setVertexLabelColor(v, otherIndexLabelColor);\n\t graph_mov"
& "eVertex(v, ~2.0, float(i), false);\n\t graph_setVertexSize(v, 0.95, "
& "0.95);\n\tend;\n\tgraph_redisplay(self.graphvbt);\n\n let v = gr"
& "aph_newVertex(self.graphvbt);\n\tgraph_setVertexLabel(v, fmt_int(self.r"
& "owIndex));\n\tgraph_setVertexFont(v, self.vertexFont);\n\tgraph_setVert"
& "exColor(v, ghostColor);\n\tgraph_setVertexLabelColor(v, ghostLabelColor"
& ");\n\tgraph_setVertexShape(v, \"ellipse\");\n\tgraph_moveVertex(v, floa"
& "t(self.n), ~4.25, false);\n\tgraph_setVertexBorder(v, 0.05);\n\tgraph_v"
& "ertexToFront(self.rowIndexVtx);\n\tgraph_setVertexSize(v, 0.95, 0.95);\n"
& "\tgraph_moveVertex(self.rowIndexVtx, ~2.0, float(self.rowIndex), true);"
& "\n\tzeus_animate(self.graphvbt, 0.0, 1.0);\n end,\n\n ResultNextC"
& "har => meth(self, pos, k)\n (* Pick off the pos\'th element of first"
& "chars and put into the\n k\'th position in the result string. *)\n"
& " if pos is self.rowIndex then\n\t (* Just gray out the extra c"
& "opy of the last character *)\n \t let v = self.last.vtx[self.rowI"
& "ndex];\n\t graph_setVertexColor(v, ghostColor);\n\t graph_setVert"
& "exLabelColor(v, ghostLabelColor);\n else\n let sv1 = se"
& "lf.last.vtx[pos];\n self.last.vtx[pos] := graph_newVertex(sel"
& "f.graphvbt);\n let sv2 = self.first.vtx[pos];\n sel"
& "f.first.vtx[pos] := graph_newVertex(self.graphvbt);\n graph_m"
& "oveVertex(self.last.vtx[pos], ~1.0, float(pos), false);\n gra"
& "ph_setVertexLabel(self.l";
CONST E113_6 =
"ast.vtx[pos],\n text_sub(self.last.chars"
& ", pos, 1));\n graph_setVertexSize(self.last.vtx[pos], 0.95, 0"
& ".95);\n graph_setVertexColor(self.last.vtx[pos], ghostColor);"
& "\n graph_setVertexLabelColor(self.last.vtx[pos], ghostLabelCo"
& "lor);\n graph_setVertexFont(self.last.vtx[pos], self.vertexFo"
& "nt);\n graph_setVertexBorder(self.last.vtx[pos], 0.05);\n "
& " graph_moveVertex(self.first.vtx[pos], 0.0, float(pos), false);\n"
& " graph_setVertexLabel(self.first.vtx[pos],\n "
& " text_sub(self.first.chars, pos, 1));\n graph_s"
& "etVertexSize(self.first.vtx[pos], 0.95, 0.95);\n graph_setVer"
& "texColor(self.first.vtx[pos], ghostColor);\n graph_setVertexL"
& "abelColor(self.first.vtx[pos], ghostLabelColor);\n graph_setV"
& "ertexFont(self.first.vtx[pos], self.vertexFont);\n graph_setV"
& "ertexBorder(self.first.vtx[pos], 0.05);\n\n graph_vertexToFro"
& "nt(sv1);\n graph_vertexToFront(sv2);\n graph_moveVe"
& "rtex(sv1, float(k-1), float(self.rowIndex),\n "
& " true);\n graph_moveVertex(sv2, float(k), float(self.rowInde"
& "x),\n true);\n end;\n zeus_anima"
& "te(self.graphvbt, 0.0, 1.0);\n end,\n\n EndResult => meth(self)\n"
& " (* Done *)\n\tfor i = 0 to self.n - 1 do\n\t graph_setVertexColo"
& "r(self.rowIndices[i], ghostColor);\n \t graph_setVertexLabelColor("
& "self.rowIndices[i], ghostLabelColor);\n end;\n\tgraph_setVertexC"
& "olor(self.rowIndexVtx, ghostColor);\n\tgraph_setVertexLabelColor(self.r"
& "owIndexVtx, ghostLabelColor);\n\tgraph_redisplay(self.graphvbt);\n e"
& "nd\n\n };\n";
CONST E114 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Sort"
& ".evt.\n;***************************************************************"
& "*****\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 + "
& "Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& "(Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Init: Stop? \") \n (Boolean %stopAtInit =TRUE \""
& "\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtInit =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Heigh"
& "t 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"SetVal: Stop? \") \n "
& " (Boolean %stopAtSetVal =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtSetVal =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fil"
& "l (Sha";
CONST E114_0 =
"pe (Width + 0) (Height + 0) \n \"SwapElt"
& "s: Stop? \") \n (Boolean %stopAtSwapElts =TRUE \"\""
& ")\n (Glue 10)\n (Shape (Width + 0"
& ") (Height + 0) \"Weight: \")\n (Shape (Width 80) (Nu"
& "meric %waitAtSwapElts =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape (Hei"
& "ght 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n"
& " \"StartPass: Stop? \") \n "
& " (Boolean %stopAtStartPass =TRUE \"\")\n (Glu"
& "e 10)\n (Shape (Width + 0) (Height + 0) \"Weight: \""
& ")\n (Shape (Width 80) (Numeric %waitAtStartPass =1 \n"
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n )\n (Glue 4)\n (VBox\n"
& " (Glue 5)\n (Shape (Width + 0) (Height 16 + 0) \""
& "Cts:\")\n (Button %eventCounts\n (VBox\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Heigh"
& "t 16 + 0) \n (Text %ctOfInit \"0\")))\n"
& " (Glue 6)\n (HBox Fill (Shape (Width + 0)"
& " (Height 16 + 0) \n (Text %ctOfSetVal "
& "\"0\")))\n (Glue 6)\n (HBox Fill (Shape ("
& "Width + 0) (Height 16 + 0) \n (Text %c"
& "tOfSwapElts \"0\")))\n (Glue 6)\n (HBox F"
& "ill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfStartPass \"0\")))\n (Glue 3))))\n "
& " Fill\n (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E115 =
"; Copyright (C) 1992, Digital Equipment Corporation\n; All rights reser"
& "ved.\n; See the file COPYRIGHT for a full description.\n\n(Scale\n (HS"
& "cale 1)\n (VScale 1)\n (LabelFont (Family \"Courier\"))\n (Rim\n "
& "(Pen 10)\n (VBox\n (Shape\n (Height + 0)\n (HBox\n"
& " (Shape\n (Width + 0)\n (HBox\n "
& " (VBox (Text \"Vertex: \") (Text RightAlign \"val: \"))\n "
& " (VBox\n (Font (Family \"Courier\"))\n "
& " (Text\n LeftAlign\n \"A B C D E F G "
& "H I J K L M\")\n (Text\n LeftAlign\n "
& " %val\n \"* * * * * * * * * * * * *\")))"
& ")\n Fill))\n Fill)))\n";
CONST E116 =
"(* Copyright 1993 Digital Equipment Corporation. "
& " *)\n(* Distributed only by permission. "
& " *)\n(* "
& " *)\n(* Last modified on Thu Oct 14 17:06:57 P"
& "DT 1993 by heydon *)\n(* modified on Tue Aug 10 "
& "23:56:52 PDT 1993 by rsanchez *)\n\n(* This view shows "
& "the total number of steps that each packet needs *)\n(* to traverse to "
& "go from its source to its destination node. *)\n(* (Condensed Ver"
& "sion). *)\n\nlet MoveColor "
& "= color_named(\"Green\");\nlet NoMoveColor = color_named(\"Yellow\");\n"
& "let BlockedColor = color_named(\"Red\");\nlet InitialColor = color_name"
& "d(\"Black\");\nlet FinishedColor = color_named(\"Black\");\nlet LabelCo"
& "lor = color_named(\"Black\");\nlet BackgroundColor = color_named(\"Whit"
& "e\");\nlet EdgeColor = color_named(\"Black\");\nlet BorderColor = color"
& "_named(\"Black\");\n\nlet CondColor = [MoveColor, NoMoveColor, BlockedC"
& "olor];\n\nlet moveIndx = 0;\nlet noMoveIndx = 1;\nlet blockedIndx = 2;\n"
& "\nlet BarWidth = 0.40;\nlet Gap = 0.05;\nlet SouthInit = ~3.0;\nlet Bor"
& "derSize = 0.0;\nlet ScaleFactor = 1.5;\n\nlet PartialColumns = 3;\nlet "
& "TotalColumnIndex = 3;\nlet LabelColumns = 4;\n\nlet FontFromSize =\n p"
& "roc(g, sz)\n graph_newFont(g, \"Helvetica\", sz, \"Roman\", \"bold"
& "\", \"*\")\n end;\n\nlet MoveTextVertex =\n proc(vtx, font, width, he"
& "ight, x, y)\n graph_setVertexFont(vtx, font);\n graph_moveVertex("
& "vtx, x, y, false);\n graph_setVertexSize(vtx, width, height);\n end"
& ";\n\nlet MakeTextVertex =\n proc(vtx, font, width, height, x, y)\n "
& "graph_setVertexColor(vtx, BackgroundColor);\n graph_setVertexLabelCo"
& "lor(vtx, LabelColor);\n MoveTextVertex(vtx, font, width, height, x, "
& "y)\n end;\n\nlet MoveBlockVertex =\n proc(vtx, width, height, x, y)\n"
& " graph_setVertexSize(vtx, width, height);\n graph_moveVertex(vtx,"
& " x, y, false);\n end;\n \nlet MakeBlockVertex =\n proc(vtx, clr, w"
& "idth, height, x, y)\n grap";
CONST E116_0 =
"h_setVertexBorder(vtx, 0.05);\n graph_setVertexBorderColor(vtx, Bord"
& "erColor); \n graph_setVertexColor(vtx, clr);\n MoveBlockVertex(vt"
& "x, width, height, x, y)\n end;\n\nlet view =\n {\n graphvbt => gra"
& "ph_new(),\n pktCnt => ok,\n steps => 0,\n maxSteps => ok,\n "
& " hopsT => ok,\n vtxFont => ok,\n fontSize => 0.5,\n border => "
& "BorderSize,\n labelH => 1.0,\n yLabels1 => ok,\n yLabels2 => o"
& "k,\n yLabels3 => ok,\n labels1 => ok,\n labels2 => ok,\n la"
& "bels3 => ok,\n totalMove => 0,\n totalNoMove => 0,\n totalBloc"
& "ked => 0,\n east => ok,\n west => ok,\n north => ok,\n sout"
& "h => ok,\n labelW => meth(self) (self.east - self.west) / float(Labe"
& "lColumns+2) end,\n\n xLoc => meth(self, index)\n self.west + ("
& "self.labelW * float(index+1))\n end,\n\n StartPackets => meth (se"
& "lf, pktCnt)\n self.west := ~1.0;\n self.east := float(pktCnt)"
& ";\n self.north := 11.0;\n self.south := ~4.0;\n self.max"
& "Steps := 10.0;\n self.fontSize := 1.0;\n self.yLabels1 := ~1."
& "0;\n self.yLabels2 := ~2.0;\n self.yLabels3 := ~3.0;\n g"
& "raph_setWorld(self.graphvbt, \n self.west, self.eas"
& "t, self.north, self.south);\n self.vtxFont := FontFromSize(self.gr"
& "aphvbt, self.fontSize);\n\n self.pktCnt := pktCnt;\n\n self.h"
& "opsT := array_new(pktCnt, ok);\n self.labels1 := array_new(LabelCo"
& "lumns, ok);\n self.labels2 := array_new(LabelColumns, ok);\n "
& "self.labels3 := array_new(LabelColumns, ok);\n\n for i = 0 to pktC"
& "nt-1 do\n let vtx1 = graph_newVertex(self.graphvbt);\n gr"
& "aph_vertexToBack(vtx1);\n\tgraph_setVertexBorder(vtx1, self.border);\n\t"
& "graph_setVertexBorderColor(vtx1, BackgroundColor); \n\tgraph_setVertexC"
& "olor(vtx1, MoveColor);\n\tgraph_moveVertex(vtx1, float(i), self.border/"
& "2.0, false);\n\tgraph_setVertexSize(vtx1, 0.95, self.border);\n\tself.h"
& "opsT[i] := {\n minNumHops => 0,\n\t moved => false,\n\t bloc"
& "ked => false,\n\t progress => true,\n\t finished => false,\n\t src ="
& "> ok,\n\t dst => ok,\n\t ";
CONST E116_1 =
" vmove => vtx1,\n\t vlastblocked => ok,\n\t blockedTempCnt => 0,\n\t "
& " vlastnomove => ok,\n\t noMoveTempCnt => 0\n };\n end;\n "
& " for i = 0 to PartialColumns - 1 do\n self.labels1[i] := grap"
& "h_newVertex(self.graphvbt); \n MakeBlockVertex(self.labels1[i], "
& "CondColor[i], \n self.labelW, self.labelH,\n "
& " self.xLoc(i), self.yLabels1);\n end;\n\n "
& "self.labels1[TotalColumnIndex] := graph_newVertex(self.graphvbt);\n\n "
& " MakeTextVertex(self.labels1[TotalColumnIndex], self.vtxFont, \n "
& " self.labelW * 2.0, self.labelH,\n "
& "self.xLoc(TotalColumnIndex+1), self.yLabels1);\n\n graph_setVertex"
& "Label(self.labels1[TotalColumnIndex], \"Total:\");\n\n for i = 0 t"
& "o PartialColumns - 1 do \n self.labels2[i"
& "] := graph_newVertex(self.graphvbt);\n MakeTextVertex(self.label"
& "s2[i], self.vtxFont, \n self.labelW, self.labelH"
& ",\n self.xLoc(i), self.yLabels2);\n graph"
& "_setVertexLabel(self.labels2[i], \"0\");\n\n self.labels3[i] := "
& "graph_newVertex(self.graphvbt);\n MakeTextVertex(self.labels3[i]"
& ", self.vtxFont, \n self.labelW, self.labelH,\n "
& " self.xLoc(i), self.yLabels3);\n graph_setV"
& "ertexLabel(self.labels3[i], \"0%\");\n end;\n\n self.labels2["
& "TotalColumnIndex] := graph_newVertex(self.graphvbt);\n MakeTextVer"
& "tex(self.labels2[TotalColumnIndex], self.vtxFont, \n "
& " self.labelW, self.labelH,\n self.xLoc(TotalColu"
& "mnIndex+1), self.yLabels2);\n graph_setVertexLabel(self.labels2[To"
& "talColumnIndex], \"0\");\n\n self.labels3[TotalColumnIndex] := gra"
& "ph_newVertex(self.graphvbt);\n MakeTextVertex(self.labels3[TotalCo"
& "lumnIndex], self.vtxFont, \n self.labelW * 2.0, se"
& "lf.labelH,\n self.xLoc(TotalColumnIndex+1), self.y"
& "Labels3);\n graph_setVertexLabel(self.labels3[TotalColumnIndex], ";
CONST E116_2 =
"\"0 Step(s)\");\n\n end,\n\n NewPacket => meth (self, id, source,"
& " dest, fewestHops, name)\n self.hopsT[id].minNumHops := fewestHops"
& ";\n self.hopsT[id].src := source;\n self.hopsT[id].dst := des"
& "t;\n end,\n\n EndPackets => meth (self)\n graph_redisplay(se"
& "lf.graphvbt);\n end,\n\n Blocked => meth(self, id, fromN, toN)\n "
& " self.hopsT[id].blocked := true;\n self.totalBlocked := self.t"
& "otalBlocked + 1;\n end,\n\n MovePacket => meth(self, id, fromN, t"
& "oN) \n self.hopsT[id].moved := true;\n self.totalMove := self"
& ".totalMove + 1; \n end,\n\n Absorb => meth(self, id, node)\n "
& " self.hopsT[id].progress := false;\n end,\n\n Step => meth (self)"
& "\n let Percent = proc(num, denom)\n fmt_int(round((100.0 * "
& "float(num)) / float(denom))) & \"%\"\n end;\n\n self.steps :="
& " self.steps + 1;\n if float(self.steps) > self.maxSteps then\n "
& " self.maxSteps := self.maxSteps * ScaleFactor;\n self.north :"
& "= self.north * ScaleFactor;\n\tself.south := self.south * ScaleFactor;\n"
& "\tself.fontSize := self.fontSize * ScaleFactor;\n\tself.border := self."
& "border * ScaleFactor;\n\tself.labelH := self.labelH * ScaleFactor;\n "
& " self.yLabels1 := self.yLabels1 * ScaleFactor;\n self.yLabel"
& "s2 := self.yLabels2 * ScaleFactor;\n self.yLabels3 := self.yLabe"
& "ls3 * ScaleFactor;\n\n var index = ok, width = ok;\n\tfor i = 0 "
& "to LabelColumns - 1 do\n\t index := i; width := self.labelW;\n "
& " if i is TotalColumnIndex then\n index := index + 1;\n "
& " width := width * 2.0\n end;\n\t MoveBlockVertex(self.l"
& "abels1[i], \n\t width, self.labelH, self.xLoc(index), self.yLabels1)"
& ";\n MoveTextVertex(self.labels2[i], self.vtxFont,\n "
& " width, self.labelH, self.xLoc(index), self.yLabels2);\n MoveT"
& "extVertex(self.labels3[i], self.vtxFont,\n width, self.label"
& "H, self.xLoc(index), self.yLabels3);\n\tend;\n\n graph_setWorld("
& "self.graphvbt, \n self.west, self.east, self.north, self.south"
& ");\n end;\n";
CONST E116_3 =
"\n for i = 0 to self.pktCnt-1 do\n\tif self.hopsT[i].finished is f"
& "alse then\n if self.hopsT[i].moved is false then\n "
& "if self.hopsT[i].blocked is true then\n\t self.hopsT[i].blocked :="
& " false;\n\t if self.hopsT[i].vlastnomove isnot ok then\n\t\tself.h"
& "opsT[i].vlastnomove := ok;\n\t\tself.hopsT[i].noMoveTempCnt := 0;\n "
& " end;\n\t if self.hopsT[i].vlastblocked is ok then\n\t\tl"
& "et vblocked = graph_newVertex(self.graphvbt);\n\t\tgraph_setVertexBorde"
& "r(vblocked, self.border);\n\t\tgraph_setVertexBorderColor(vblocked, col"
& "or_rgb(0.0, 0.0, 0.0));\n\t\tgraph_setVertexColor(vblocked, BlockedColo"
& "r);\n\t\tgraph_moveVertex(vblocked,\n\t\t\t\t float(i), float(self.ste"
& "ps) - 0.5, false);\n graph_setVertexSize(vblocked, 0.95"
& ", 1.0);\n\t\tself.hopsT[i].vlastblocked:= vblocked;\n\t\tself.hopsT[i]."
& "blockedTempCnt := 1;\n else\n\t\tself.hopsT[i].blockedTemp"
& "Cnt := \n self.hopsT[i].blockedTempC"
& "nt + 1;\n\t\tgraph_moveVertex(self.hopsT[i].vlastblocked,\n\t\t "
& " float(i),\n\t\t float(self.steps) -\n\t\t "
& " (float(self.hopsT[i].blockedTempCnt)/2.0),\n\t\t "
& " false);\n graph_setVertexSize(self.hopsT[i].vla"
& "stblocked,\n\t\t\t\t 0.95, float(self.hopsT[i].blockedTempCnt));\n "
& " end;\n else\n\t if self.hopsT[i].vlastblock"
& "ed isnot ok then\n\t\tself.hopsT[i].vlastblocked := ok;\n\t\tself.hopsT"
& "[i].blockedTempCnt := 0;\n\t end;\n self.totalNoMove "
& ":= self.totalNoMove + 1;\n\t if self.hopsT[i].vlastnomove is ok th"
& "en\n\t let vnomove = graph_newVertex(self.graphvbt);\n\t "
& "graph_setVertexBorder(vnomove, self.border);\n\t graph_setVertex"
& "BorderColor(vnomove, color_rgb(0.0, 0.0, 0.0)); \n\t graph_setVe"
& "rtexColor(vnomove, NoMoveColor);\n\t graph_moveVertex(vnomove, \n"
& "\t\t\t float(i), float(self.steps) - 0.5, false);\n "
& " graph_setVertexSize(vnomove, 0.95, 1.0); \n\t self.hopsT[i].vl"
& "astnomove := vnomove;\n\t self.hopsT[i";
CONST E116_4 =
"].noMoveTempCnt := 1;\n else\n\t self.hopsT[i].noMo"
& "veTempCnt := self.hopsT[i].noMoveTempCnt + 1;\n graph_mo"
& "veVertex(self.hopsT[i].vlastnomove,\n\t\t float(i), \n\t\t float(sel"
& "f.steps)-(float(self.hopsT[i].noMoveTempCnt)/2.0),\n\t false);"
& "\n graph_setVertexSize(self.hopsT[i].vlastnomove, \n\t\t"
& "\t\t 0.95, float(self.hopsT[i].noMoveTempCnt));\n end;\n "
& " end;\n else\n\t self.hopsT[i].moved := false;\n\t"
& " self.hopsT[i].vlastnomove := ok;\n\t self.hopsT[i].noMoveTempCnt"
& " := 0;\n\t self.hopsT[i].vlastblocked := ok;\n\t self.hopsT[i].bl"
& "ockedTempCnt := 0;\n graph_moveVertex(self.hopsT[i].vmove, f"
& "loat(i),\n\t float(self.steps)/2.0, false);\n "
& " graph_setVertexSize(self.hopsT[i].vmove, 0.95, float(self.steps))"
& ";\n end;\n\n if self.hopsT[i].progress isnot true the"
& "n\n\t self.hopsT[i].finished := true;\n\t let vtx = graph_newVert"
& "ex(self.graphvbt);\n\t graph_setVertexColor(vtx, FinishedColor);\n\t"
& " graph_moveVertex(vtx, float(i),\n\t\t\t float(self.steps+1) - 0"
& ".75, false);\n graph_setVertexSize(vtx, 0.96, 0.5);\n "
& " end;\n\n\tend;\n end;\n\n graph_setVertexLabel(self.labels"
& "2[0], fmt_int(self.totalMove));\n graph_setVertexLabel(self.labels"
& "2[1], fmt_int(self.totalNoMove));\n graph_setVertexLabel(self.labe"
& "ls2[2], fmt_int(self.totalBlocked));\n\n let sum = self.totalMove "
& "+ self.totalNoMove + self.totalBlocked;\n graph_setVertexLabel(sel"
& "f.labels2[3], fmt_int(sum));\n\n let sum = self.totalMove + self.t"
& "otalNoMove + self.totalBlocked;\n graph_setVertexLabel(self.labels"
& "3[0],\n Percent(self.totalMove, sum));\n "
& " graph_setVertexLabel(self.labels3[1],\n Perc"
& "ent(self.totalNoMove, sum));\n graph_setVertexLabel(self.labels3[2"
& "],\n Percent(self.totalBlocked, sum));\n "
& " graph_setVertexLabel(self.labels3[3], fmt_int(self.steps) & \" Step(s)"
& "\");\n\n gr";
CONST E116_5 =
"aph_redisplay(self.graphvbt);\n end\n };\n";
CONST E117 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Bres"
& "enham.evt.\n;**********************************************************"
& "**********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue "
& "4) (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (G"
& "lue 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algo"
& "rithm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus "
& "events\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args"
& " to events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Heig"
& "ht 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E118 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:37:06 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file Maxf"
& "low.evt.\n;************************************************************"
& "********\n\n(VBox\n (Rim\n (Pen 2)\n (HBox\n (VBox (Glue 4)"
& " (Shape (Height + Inf) (Button %clear \"CLEAR\")) (Glue 4))\n (Glu"
& "e 4)\n (VBox\n (Boolean =TRUE %alg (Text LeftAlign \"Algori"
& "thm events\"))\n (Boolean =FALSE %zeus (Text LeftAlign \"Zeus ev"
& "ents\"))\n (Boolean =TRUE %args (Text LeftAlign \"Display args t"
& "o events\")))\n Fill))\n (Bar 1)\n (Shape (ShadowSize 0) (Height"
& " 200 + INF) (TextEdit ReadOnly %transcript)))\n";
CONST E119 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file PQue"
& "ue.evt.\n;*************************************************************"
& "*******\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 25 "
& "+ Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10)"
& "\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HB"
& "ox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Setup: Stop? \") \n (Boolean %stopAtSetup =TR"
& "UE \"\")\n (Glue 10)\n (Shape (Wi"
& "dth + 0) (Height + 0) \"Weight: \")\n (Shape (Width "
& "80) (Numeric %waitAtSetup =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape "
& "(Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + "
& "0) \n \"InitSort: Stop? \") \n "
& " (Boolean %stopAtInitSort =TRUE \"\")\n ("
& "Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight:"
& " \")\n (Shape (Width 80) (Numeric %waitAtInitSort =1"
& " \n (Min 0) (Max 100)))))"
& "\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBo";
CONST E119_0 =
"x Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Insert: Stop? \") \n (Boolean %stopAtInsert =T"
& "RUE \"\")\n (Glue 10)\n (Shape (W"
& "idth + 0) (Height + 0) \"Weight: \")\n (Shape (Width"
& " 80) (Numeric %waitAtInsert =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shap"
& "e (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height "
& "+ 0) \n \"HeapOpInit: Stop? \") \n "
& " (Boolean %stopAtHeapOpInit =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"W"
& "eight: \")\n (Shape (Width 80) (Numeric %waitAtHeapO"
& "pInit =1 \n (Min 0) (Max "
& "100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"UpHeapStep: Stop? \") \n (Boole"
& "an %stopAtUpHeapStep =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtUpHeapStep =1 \n "
& " (Min 0) (Max 100)))))\n "
& "(Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fill "
& "(Shape (Width + 0) (Height + 0) \n \"Hea"
& "pStep: Stop? \") \n (Boolean %stopAtHeapStep =TRUE"
& " \"\")\n (Glue 10)\n (Shape (Widt"
& "h + 0) (Height + 0) \"Weight: \")\n (Shape (Width 80"
& ") (Numeric %waitAtHeapStep =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"PlaceElement: Stop? \") \n "
& " (Boolean %stopAtPlaceElement =TRUE \"\")\n "
& " ";
CONST E119_1 =
"(Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weight"
& ": \")\n (Shape (Width 80) (Numeric %waitAtPlaceEleme"
& "nt =1 \n (Min 0) (Max 100"
& ")))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Remove: Stop? \") \n (Boolean %sto"
& "pAtRemove =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n ("
& "Shape (Width 80) (Numeric %waitAtRemove =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width +"
& " 0) (Height + 0) \n \"Compare: Stop? \""
& ") \n (Boolean %stopAtCompare =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0"
& ") \"Weight: \")\n (Shape (Width 80) (Numeric %waitAt"
& "Compare =1 \n (Min 0) (Ma"
& "x 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Pause: Stop? \") \n (Boolean "
& "%stopAtPause =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtPause =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width"
& " + 0) (Height + 0) \n \"SortStep: Stop"
& "? \") \n (Boolean %stopAtSortStep =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Heigh"
& "t + 0) \"Weight: \")\n (Shape (Width 80) (Numeric %w"
& "aitAtSortStep =1 \n (Min "
& "0) (M";
CONST E119_2 =
"ax 100)))))\n (Glue 6)\n )\n (Glue 4)\n "
& " (VBox\n (Glue 5)\n (Shape (Width + 0) (Hei"
& "ght 16 + 0) \"Cts:\")\n (Button %eventCounts\n "
& "(VBox\n (Glue 6)\n (HBox Fill (Shape (Wid"
& "th + 0) (Height 16 + 0) \n (Text %ctOf"
& "Setup \"0\")))\n (Glue 6)\n (HBox Fill (S"
& "hape (Width + 0) (Height 16 + 0) \n (T"
& "ext %ctOfInitSort \"0\")))\n (Glue 6)\n ("
& "HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfInsert \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfHeapOpInit \"0\")))\n (Gl"
& "ue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfUpHeapStep \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Hei"
& "ght 16 + 0) \n (Text %ctOfHeapStep \"0"
& "\")))\n (Glue 6)\n (HBox Fill (Shape (Wid"
& "th + 0) (Height 16 + 0) \n (Text %ctOf"
& "PlaceElement \"0\")))\n (Glue 6)\n (HBox "
& "Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfRemove \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfCompare \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfPause \"0\")))\n (G"
& "lue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n"
& " (Text %ctOfSortStep \"0\")))\n "
& " (Glue 3))))\n Fill\n (Glue 4 + Inf)\n "
& " )\n )\n )\n )\n)\n";
CONST E120 =
"#| Copyright 1993 Digital Equipment Corporation. |#\n#| Distributed onl"
& "y by permission. |#\n#| Last modified on Tue Jul 13 19:31:37 PDT 1993 b"
& "y comba |#\n#| modified on Sun Jul 11 23:10:48 PDT 1993 by mhb |#\n"
& "\n(VBox\n (Glue 5)\n (HBox (Boolean %E \"Show Errors\") Fill) (Glue 5"
& "))\n\n";
CONST E121 =
"(* Copyright (C) 1994, Digital Equipment Corporation *)\n(* All"
& " rights reserved. *)\n(* See the f"
& "ile COPYRIGHT for a full description. *)\n\nTYPE PriorityQue"
& "ue = RECORD\n size: INTEGER;\n heap: REF ARRAY OF INTEGER\n END;\n"
& "\n@Insert\nPROCEDURE Insert(pq: PriorityQueue; v: INTEGER) RAISES {}= @"
& "\n BEGIN\n@101 INC(pq.size); pq.heap[size] := v; UpHeap(size) @\n "
& " END Insert;\n@Insert\n\n@UpHeap\nPROCEDURE UpHeap(pq: PriorityQueue; k"
& ":INTEGER) RAISES {}=@\n VAR v: INTEGER;\n BEGIN\n@201 v := pq.hea"
& "p[k]; pq.heap[0] := LAST(INTEGER); @\n@202 WHILE pq.heap[k DIV 2] <"
& "= v DO\n pq.heap[k] := pq.heap[k DIV 2]; k := k DIV 2 \n END;@\n"
& "@204 pq.heap[k] := v;@\n END UpHeap;\n@UpHeap\n\n@Remove\nPROCEDUR"
& "E Remove(pq: PriorityQueue): INTEGER RAISES {}=@\n VAR outVal: INTEGER"
& ";\n BEGIN\n@301 outVal := pq.heap[1];\n pq.heap[1] := pq.heap[p"
& "q.size]; DEC(pq.size); @\n@302 DownHeap(pq, 1);@\n@303 RETURN ou"
& "tVal;@\n END Remove;\n@Remove\n\n@DownHeap \nPROCEDURE DownHeap(pq: Pr"
& "iorityQueue; k: INTEGER) RAISES {} = @\n VAR i, j, v: INTEGER;\n BEGI"
& "N\n@401 v := pq.heap[k];@\n WHILE k <= pq.size DIV 2 DO\n@402 "
& " j := k+k;\n IF j < pq.size THEN\n IF pq.heap[j] < pq.he"
& "ap[j+1] THEN\n INC(j)\n END;\n END;@\n@406 I"
& "F v >= pq.heap[j] THEN\n EXIT;\n END;@\n@408 pq.heap["
& "k] := pq.heap[j]; k := j;@\n END;\n@409 pq.heap[k] := v;@\n END"
& " DownHeap;\n@DownHeap\n\n\n@HeapSort\nPROCEDURE HeapSort(pq: PriorityQu"
& "eue) RAISES {} = @\n VAR t: INTEGER;\n BEGIN\n@501 FOR k := pq.si"
& "ze DIV 2 TO 1 BY -1 DO @\n@502 DownHeap(pq, k); @\n END; \n@50"
& "3 (* array is now a heap *)@\n REPEAT \n@504 t := pq.heap["
& "1]; pq.heap[1] := pq.heap[pq.size];\n pq.heap[pq.size] := t;\n "
& " DEC[pq.size];@\n@505 DownHeap(pq, 1);@\n UNTIL pq.size <= 1;"
& "\n END HeapSort;\n@HeapSort\n\n";
CONST E122 =
"(* Copyright (C) 1994, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n(* "
& " *)\n(* Last modified on Mon Jan 9 "
& "12:04:21 PST 1995 by najork *)\n(* modified on T"
& "ue Aug 16 18:56:37 PDT 1994 by heydon *)\n(* mod"
& "ified on Wed Jul 27 12:22:30 PDT 1994 by shillner *)\n\n"
& "(* FindLength.obl -- histogram of path lengths to root on \"Find\" oper"
& "ations *)\n\nlet Margin = 5.0; (* in mm *)\nlet InitMaxX = "
& "4;\nlet InitMaxY = 5.0;\n\nlet BarColor = color_named(\"red\");\nlet"
& " BorderColor = color_named(\"black\");\nlet BorderWidth = 0.05;\nlet Te"
& "xtColor = color_named(\"black\");\nlet FontSz = 0.6;\nlet Lab1Y "
& " = ~0.5;\nlet Lab2Y = ~1.5;\nlet MinY = ~2.0;\n\n(* B"
& "ar Object ============================================================="
& " *)\n\nlet Bar = {\n slot: Int => ok,\n count: Int => 0,\n v: Vertex"
& " => ok,\n\n barHeight => meth(self: Bar): Real,\n math_sqrt(float(s"
& "elf.count))\n end,\n\n updateVertex => meth(self): Ok,\n let ht = "
& "self.barHeight();\n graph_setVertexSize(self.v, 0.9, ht);\n graph"
& "_moveVertex(self.v, 0.5 + float(self.slot), ht / 2.0, false);\n ok\n"
& " end,\n\n updateLabel => meth(self): Ok,\n graph_setVertexLabel(se"
& "lf.v, fmt_int(self.count));\n ok\n end,\n\n new => meth(self: Bar,"
& " g: Graph, f: Font, slot: Int): Bar,\n self.slot := slot;\n self."
& "v := graph_newVertex(g);\n graph_setVertexColor(self.v, BarColor);\n"
& " graph_setVertexBorderColor(self.v, BorderColor);\n graph_setVert"
& "exBorder(self.v, BorderWidth);\n graph_setVertexFont(self.v, f);\n "
& " graph_setVertexLabelColor(self.v, TextColor);\n graph_setVertexLab"
& "el(self.v, \"\");\n self.updateVertex();\n let v = graph_newVerte"
& "x(g);\n graph_vertexToBack(v);\n graph_setVertexColor(v, color_na"
& "med(\"whi";
CONST E122_0 =
"te\"));\n graph_setVertexFont(v, f);\n graph_setVertexLabelColor("
& "v, TextColor);\n graph_setVertexLabel(v, fmt_int(slot));\n graph_"
& "setVertexSize(v, 1.0, 1.0);\n graph_moveVertex(v, 0.5 + float(slot),"
& " Lab1Y, false);\n self\n end,\n\n inc => meth(self: Bar): Ok,\n ("
& "* increment the count of the bar \"self\", and update its vertex\n "
& "to reflect the change. *)\n self.count := self.count + 1;\n self."
& "updateVertex();\n self.updateLabel();\n ok\n end,\n};\n\n(* View"
& " Object ============================================================ *)"
& "\n\nlet view: View = {\n\n (* Data members ---------------------------"
& "------------------------------ *)\n\n graphvbt => graph_new(),\n bar:"
& " [Bar] => ok,\n maxX: Int => InitMaxX, (* slots [0..maxX-1] *)\n m"
& "axY: Real => InitMaxY, (* values [0..maxY] *)\n currLen: Int => ok,"
& "\n labelFont: Font => ok,\n total: Int => 0,\n count: Int => 0,\n t"
& "otalV: Vertex => ok,\n\n setWorld => meth(self: View): Ok,\n graph_"
& "setWorld(self.graphvbt,\n 0.0, float(self.maxX), self.maxY + 2.0, "
& "MinY);\n ok\n end,\n\n updateTotal => meth(self: View): Ok,\n l"
& "et txt = \"Total = \" & fmt_int(self.total) & \" Average = \" &\n "
& " if self.count is 0 then \"0.00\" else\n text_replaceAll(\"d\", "
& "\"0\",\n text_sub(fmt_real(float(self.total)/flo"
& "at(self.count)),\n 0, 4));\n end;\n"
& " graph_setVertexLabel(self.totalV, txt);\n ok\n end,\n\n moveTo"
& "talLabel => meth(self: View): Ok,\n graph_moveVertex(self.totalV, fl"
& "oat(self.maxX)/2.0, Lab2Y, true);\n ok\n end,\n\n (* Setup -------"
& "--------------------------------------------------------- *)\n\n Setup"
& " => meth(self: View): Ok,\n self.labelFont := graph_newFont(self.gra"
& "phvbt, \"Helvetica\", FontSz,\n \"Roman\", \"bold\", \"*\");\n "
& "graph_setMargin(self.graphvbt, Margin);\n self.setWorld();\n ok\n"
& " end,\n\n NewSet => meth(self: View, nm: Text): Ok,\n ok\n end,\n"
& "\n FinishedSets => meth(self: View, numSets: Int, usesRanks: Bool): Ok"
& ",\n self.totalV := graph_newVe";
CONST E122_1 =
"rtex(self.graphvbt);\n graph_vertexToBack(self.totalV);\n graph_s"
& "etVertexFont(self.totalV, self.labelFont);\n graph_setVertexLabelCol"
& "or(self.totalV, TextColor);\n graph_setVertexColor(self.totalV, colo"
& "r_named(\"white\"));\n graph_setVertexSize(self.totalV, 200.0, 1.0);"
& "\n self.updateTotal(); self.moveTotalLabel();\n\n self.bar := arr"
& "ay_new(self.maxX, ok);\n for i = 0 to self.maxX - 1 do\n self.b"
& "ar[i] := clone(Bar).new(self.graphvbt, self.labelFont, i)\n end;\n "
& " zeus_animate(self.graphvbt, 0.0, 0.0);\n ok\n end,\n\n (* DoFind"
& " events -------------------------------------------------------- *)\n\n"
& " StartDoFind => meth(self, id): Ok,\n self.currLen := 0;\n ok\n "
& " end,\n\n StepUp => meth(self, child, parent): Ok,\n self.currLen :"
& "= self.currLen + 1;\n ok\n end,\n\n Found => meth(self, root): Ok,"
& "\n var rescale: Bool = false;\n if self.currLen >= self.maxX then"
& "\n var sz: Int = (self.currLen - self.maxX) + 1;\n var new: ["
& "Bar] = array_new(sz, ok);\n for i = 0 to sz - 1 do\n new[i]"
& " := clone(Bar).new(self.graphvbt, self.labelFont, self.maxX + i)\n "
& " end;\n self.bar := self.bar @ new;\n self.maxX := self.currL"
& "en + 1;\n self.moveTotalLabel();\n rescale := true\n end;\n"
& " if self.bar[self.currLen].barHeight() >= self.maxY then\n self"
& ".maxY := 1.5 * self.maxY;\n rescale := true\n end;\n if resc"
& "ale then\n self.setWorld();\n graph_redisplay(self.graphvbt)\n"
& " end;\n self.bar[self.currLen].inc();\n self.total := self.tot"
& "al + self.currLen;\n self.count := self.count + 1;\n self.updateT"
& "otal();\n zeus_animate(self.graphvbt, 0.0, 0.0);\n ok\n end,\n\n"
& " StepDown => meth(self: View, childId, parentId: Int): Ok,\n ok\n "
& "end,\n\n ChangeParent => meth(self: View, childId, parentId, rootId: I"
& "nt): Ok,\n ok\n end,\n\n EndDoFind => meth(self, id): Ok,\n ok\n"
& " end,\n\n (* Find events --------------------------------------------"
& "-------------- *)\n\n StartFind => meth(self: View, id: Int): Ok,\n "
& " ok\n end,\n\n";
CONST E122_2 =
" EndFind => meth(self: View, id: Int): Ok,\n ok\n end,\n\n (* Uni"
& "on events --------------------------------------------------------- *)\n"
& "\n StartUnion => meth(self: View, id1, id2: Int, bothRoots: Bool): Ok,"
& "\n ok\n end,\n\n FoundFirst => meth(self: View, root1: Int): Ok,\n"
& " ok\n end,\n\n CompareRanks => meth(self: View, id1, id2: Int): Ok"
& ",\n ok\n end,\n\n Unite => meth(self: View, childId, parentId, pRa"
& "nk: Int): Ok,\n ok\n end,\n\n EndUnion => meth(self): Ok,\n ok\n"
& " end,\n};\n";
CONST E123 =
"(* Copyright (C) 1993, Digital Equipment Corporation "
& " *)\n(* All rights reserved. "
& " *)\n(* See the file COPYRIGHT for a full description. "
& " *)\n\n\nlet view = {\n graphvbt => graph_new"
& "(),\n\n Setup =>\n meth (self)\n graph_setWorld(self.graphvbt,"
& " ~11.0, 11.0, 0.0, 2.0);\n graph_setAspect(self.graphvbt, 2.0 / 23"
& ".0);\n for c = -10 to 10 do\n (let v = graph_newVertex(self"
& ".graphvbt);\n graph_setVertexSize(v, 1.0, 1.0);\n graph"
& "_setVertexColor(v, \n color_hsv(((float(c+10)) / 21.0) * 0."
& "7, 1.0, 1.0));\n graph_setVertexBorder(v, 0.0);\n graph"
& "_moveVertex(v, float(c), 1.0, false);)\n end;\n graph_redispl"
& "ay(self.graphvbt);\n end,\n };\n";
CONST E124 =
"; Copyright (C) 1995, Digital Equipment Corporation.\n; All rights rese"
& "rved.\n; See the file COPYRIGHT for a full description.\n;\n; Last modi"
& "fied on Wed Feb 8 15:29:09 PST 1995 by kalsow\n\n;********************"
& "************************************************\n; NOTE: This file is"
& " generated automatically from the event \n; definition file PktR"
& "oute.evt.\n;***********************************************************"
& "*********\n\n(VBox\n (Border (Pen 1)\n (Shape\n (Height 75 - 2"
& "5 + Inf)\n (Viewport\n (HBox\n (Glue 4 + Inf)\n "
& " (VBox\n (Glue 6)\n (Shape (Height 16 + 0)\n"
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Code View events: Stop? \") \n "
& " (Boolean %stopatCodeEvents =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitatCodeEvents =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (H"
& "Box Fill (Shape (Width + 0) (Height + 0) \n "
& " \"StartGraph: Stop? \") \n (Boolean %stopAtSta"
& "rtGraph =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n (Sh"
& "ape (Width 80) (Numeric %waitAtStartGraph =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Width"
& " + 0) (Height + 0) \n \"NewNode: Stop?"
& " \") \n (Boolean %stopAtNewNode =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height "
& "+ 0) \"Weight: \")\n (Shape (Width 80) (Numeric %wai"
& "tAtNewNode =1 \n (Min 0) "
& "(Max 100)))))\n (Glue 6)\n (Shape (Height 16 + 0)"
& "\n ";
CONST E124_0 =
" (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"NewStraightEdge: Stop? \") \n (B"
& "oolean %stopAtNewStraightEdge =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtNewStraightEdge =1"
& " \n (Min 0) (Max 100)))))"
& "\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"NewCurvedEdge: Stop? \") \n (Boolean %s"
& "topAtNewCurvedEdge =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtNewCurvedEdge =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox Fill"
& " (Shape (Width + 0) (Height + 0) \n \"Ne"
& "wLabel: Stop? \") \n (Boolean %stopAtNewLabel =TRU"
& "E \"\")\n (Glue 10)\n (Shape (Wid"
& "th + 0) (Height + 0) \"Weight: \")\n (Shape (Width 8"
& "0) (Numeric %waitAtNewLabel =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shap"
& "e (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height "
& "+ 0) \n \"EndGraph: Stop? \") \n "
& " (Boolean %stopAtEndGraph =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weigh"
& "t: \")\n (Shape (Width 80) (Numeric %waitAtEndGraph "
& "=1 \n (Min 0) (Max 100)))"
& "))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"StartPackets: Stop? \") \n (Boolean %"
& "stopA";
CONST E124_1 =
"tStartPackets =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtStartPackets =1 \n "
& " (Min 0) (Max 100)))))\n (Glue"
& " 6)\n (Shape (Height 16 + 0)\n (HBox Fill (Shap"
& "e (Width + 0) (Height + 0) \n \"NewPacke"
& "t: Stop? \") \n (Boolean %stopAtNewPacket =TRUE \""
& "\")\n (Glue 10)\n (Shape (Width +"
& " 0) (Height + 0) \"Weight: \")\n (Shape (Width 80) ("
& "Numeric %waitAtNewPacket =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape ("
& "Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height + 0"
& ") \n \"EndPackets: Stop? \") \n "
& " (Boolean %stopAtEndPackets =TRUE \"\")\n "
& " (Glue 10)\n (Shape (Width + 0) (Height + 0) \"Weig"
& "ht: \")\n (Shape (Width 80) (Numeric %waitAtEndPacke"
& "ts =1 \n (Min 0) (Max 100"
& ")))))\n (Glue 6)\n (Shape (Height 16 + 0)\n "
& " (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Blocked: Stop? \") \n (Boolean %st"
& "opAtBlocked =TRUE \"\")\n (Glue 10)\n "
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtBlocked =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n "
& " (Shape (Height 16 + 0)\n (HBox Fill (Shape (Widt"
& "h + 0) (Height + 0) \n \"MovePacket: S"
& "top? \") \n (Boolean %stopAtMovePacket =TRUE \"\")\n"
& " (Glue 10)\n (Shape (Width + 0) ("
& "Height + 0) \"Weight: \")\n (Shape (Width 80) (Numer"
& "ic %wait";
CONST E124_2 =
"AtMovePacket =1 \n (Min 0"
& ") (Max 100)))))\n (Glue 6)\n (Shape (Height 16 + "
& "0)\n (HBox Fill (Shape (Width + 0) (Height + 0) \n "
& " \"QueueSizes: Stop? \") \n "
& " (Boolean %stopAtQueueSizes =TRUE \"\")\n (Glue 10)\n"
& " (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtQueueSizes =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n (Shape (Height 16 + 0)\n (HBox"
& " Fill (Shape (Width + 0) (Height + 0) \n "
& " \"Absorb: Stop? \") \n (Boolean %stopAtAbsorb =TR"
& "UE \"\")\n (Glue 10)\n (Shape (Wi"
& "dth + 0) (Height + 0) \"Weight: \")\n (Shape (Width "
& "80) (Numeric %waitAtAbsorb =1 \n "
& " (Min 0) (Max 100)))))\n (Glue 6)\n (Shape"
& " (Height 16 + 0)\n (HBox Fill (Shape (Width + 0) (Height +"
& " 0) \n \"Step: Stop? \") \n "
& " (Boolean %stopAtStep =TRUE \"\")\n (Glue 10"
& ")\n (Shape (Width + 0) (Height + 0) \"Weight: \")\n "
& " (Shape (Width 80) (Numeric %waitAtStep =1 \n "
& " (Min 0) (Max 100)))))\n "
& " (Glue 6)\n )\n (Glue 4)\n (VBox\n "
& " (Glue 5)\n (Shape (Width + 0) (Height 16 + 0) \"Cts:\")\n"
& " (Button %eventCounts\n (VBox\n "
& "(Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0)"
& " \n (Text %ctOfStartGraph \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) ("
& "Height 16 + 0) \n (Text %ctOfNewNode \""
& "0\")))\n (Glue 6)\n (HBox Fill (Shape (Wi"
& "dth + ";
CONST E124_3 =
"0) (Height 16 + 0) \n (Text %ctOfNewSt"
& "raightEdge \"0\")))\n (Glue 6)\n (HBox Fi"
& "ll (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewCurvedEdge \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfNewLabel \"0\")))\n (Glue"
& " 6)\n (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfEndGraph \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height "
& "16 + 0) \n (Text %ctOfStartPackets \"0"
& "\")))\n (Glue 6)\n (HBox Fill (Shape (Wid"
& "th + 0) (Height 16 + 0) \n (Text %ctOf"
& "NewPacket \"0\")))\n (Glue 6)\n (HBox Fil"
& "l (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfEndPackets \"0\")))\n (Glue 6)\n "
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfBlocked \"0\")))\n (Glue 6)\n"
& " (HBox Fill (Shape (Width + 0) (Height 16 + 0) \n "
& " (Text %ctOfMovePacket \"0\")))\n "
& " (Glue 6)\n (HBox Fill (Shape (Width + 0) (Height 16 "
& "+ 0) \n (Text %ctOfQueueSizes \"0\")))"
& "\n (Glue 6)\n (HBox Fill (Shape (Width + "
& "0) (Height 16 + 0) \n (Text %ctOfAbsor"
& "b \"0\")))\n (Glue 6)\n (HBox Fill (Shape"
& " (Width + 0) (Height 16 + 0) \n (Text "
& "%ctOfStep \"0\")))\n (Glue 3))))\n Fill\n "
& " (Glue 4 + Inf)\n )\n )\n )\n )\n)\n";
CONST E125 =
"@UnbalancedTest\nUnbalancedTest(InsKeys, DelKeys)@\n @1 create a new, "
& "empty tree T@\n @2 foreach k in InsKeys do@\n @3 create a new node "
& "n with key k@\n @4 Insert(T, n)@\n end\n @5 foreach k in DelKeys d"
& "o@\n @6 n <- Search(T, k)@\n @7 Delete(T, n)@\n end\nend\n@Unbal"
& "ancedTest\n\n@Insert\nInsert(T, n)@\n @4 curr := root(T)@\n @5 while "
& "curr is not the place to attach n do@\n @7 if key(n) < key(curr)@\n "
& " then @8 curr <- left(curr)@\n else @9 curr <- right(curr)@\n "
& " end\n end\n @11 if T has no root@\n then @12 make n the new roo"
& "t of T@\n else @13 make n the proper child of curr@\n end\nend\n@In"
& "sert\n\n@Search\nSearch(T, k)@\n @1 n <- root(T)@\n @2 while key(n) #"
& " k do@\n @3 if key(n) < k@\n then @4 n <- left(n)@\n else "
& "@5 n <- right(n)@\n end\n end\n @6 return n@\nend\n@Search\n\n@Del"
& "ete\nDelete(T, n)@\n @1 if n has < 2 children@\n then @2 splice <- "
& "n@\n else @3 splice <- FindMin(right(n))@\n end\n @4 SpliceOut(t, "
& "splice)@\n @5 if splice # n@ then\n @6 copy contents of splice node"
& " into n@\n end\nend\n@Delete\n\n@FindMin\nFindMin(n)@\n @1 while left"
& "(n) # NIL do@\n @2 n <- left(n)@\n end\n @3 return n@\nend\n@FindM"
& "in\n\n@SpliceOut\nSpliceOut(T, n)@\n @1 ch <- \"a child of n, or NIL i"
& "f n has no children\"@\n @4 parent(ch) <- parent(n)@\n @6 if n = root"
& "(T)@ then\n @7 root(T) <- ch@\n else\n @8 make appropriate \"dow"
& "n\" pointer of parent(n) point to ch@\n end\nend\n@SpliceOut\n";
BEGIN
END MentorBundle.