********************************************************************
* NOTE: This file is generated automatically from the event
* definition file PQueue.evt.
********************************************************************
MODULE PQueueAlgClass ;
<*NOWARN*> IMPORT PQueue, Rd, ZeusClass, Fmt, Algorithm, Wr;
<*NOWARN*> IMPORT ZeusPanel, FormsVBT, VBT, Text, ZeusUtil;
<* PRAGMA LL *>
Fix any FormsVBT errors; don't handle exceptions for them.
<* FATAL FormsVBT.Error, FormsVBT.Unimplemented *>
REVEAL
T = Public BRANDED OBJECT
OVERRIDES
<* LL = VBT.mu *>
init := PQueueDefaultInit;
snapshot := PQueueDefaultSnapshot;
restore := PQueueDefaultRestore;
updateEventCounts := PQueueDefaultUpdateCts;
END;
PROCEDURE PQueueDefaultInit (v: T): Algorithm.T =
<* LL = VBT.mu *>
PROCEDURE Attach (id: TEXT; proc: FormsVBT.Proc) =
BEGIN
FormsVBT.AttachProc(v.eventData, id, proc, v);
END Attach;
BEGIN
v.eventData := ZeusPanel.NewForm("PQueueEventData.fv");
Attach("stopatCodeEvents", PQueueDoIt);
Attach("waitatCodeEvents", PQueueDoIt);
Attach("eventCounts", PQueueRefreshCts);
Attach("stopAtSetup", PQueueDoIt);
Attach("waitAtSetup", PQueueDoIt);
Attach("stopAtInitSort", PQueueDoIt);
Attach("waitAtInitSort", PQueueDoIt);
Attach("stopAtInsert", PQueueDoIt);
Attach("waitAtInsert", PQueueDoIt);
Attach("stopAtHeapOpInit", PQueueDoIt);
Attach("waitAtHeapOpInit", PQueueDoIt);
Attach("stopAtUpHeapStep", PQueueDoIt);
Attach("waitAtUpHeapStep", PQueueDoIt);
Attach("stopAtHeapStep", PQueueDoIt);
Attach("waitAtHeapStep", PQueueDoIt);
Attach("stopAtPlaceElement", PQueueDoIt);
Attach("waitAtPlaceElement", PQueueDoIt);
Attach("stopAtRemove", PQueueDoIt);
Attach("waitAtRemove", PQueueDoIt);
Attach("stopAtCompare", PQueueDoIt);
Attach("waitAtCompare", PQueueDoIt);
Attach("stopAtPause", PQueueDoIt);
Attach("waitAtPause", PQueueDoIt);
Attach("stopAtSortStep", PQueueDoIt);
Attach("waitAtSortStep", PQueueDoIt);
FromFV (v.eventData, v); (* Get FV and internal data in sync *)
RETURN Algorithm.T.init(v);
END PQueueDefaultInit;
PROCEDURE PQueueDoIt ( fv : FormsVBT.T;
e : TEXT;
arg: REFANY;
<*UNUSED*> t : VBT.TimeStamp) =
<* LL = VBT.mu *>
BEGIN
IF Text.Equal(e, "stopatCodeEvents") THEN
NARROW(arg, T).stopatCodeEvents :=
FormsVBT.GetBoolean(fv, "stopatCodeEvents");
END;
IF Text.Equal(e, "waitatCodeEvents") THEN
NARROW(arg, T).waitatCodeEvents :=
FormsVBT.GetInteger(fv, "waitatCodeEvents");
END;
IF Text.Equal(e, "stopAtSetup") THEN
NARROW(arg, T).eventDataRec.stopAtSetup :=
FormsVBT.GetBoolean(fv, "stopAtSetup");
END;
IF Text.Equal(e, "waitAtSetup") THEN
NARROW(arg, T).eventDataRec.waitAtSetup :=
FormsVBT.GetInteger(fv, "waitAtSetup");
END;
IF Text.Equal(e, "stopAtInitSort") THEN
NARROW(arg, T).eventDataRec.stopAtInitSort :=
FormsVBT.GetBoolean(fv, "stopAtInitSort");
END;
IF Text.Equal(e, "waitAtInitSort") THEN
NARROW(arg, T).eventDataRec.waitAtInitSort :=
FormsVBT.GetInteger(fv, "waitAtInitSort");
END;
IF Text.Equal(e, "stopAtInsert") THEN
NARROW(arg, T).eventDataRec.stopAtInsert :=
FormsVBT.GetBoolean(fv, "stopAtInsert");
END;
IF Text.Equal(e, "waitAtInsert") THEN
NARROW(arg, T).eventDataRec.waitAtInsert :=
FormsVBT.GetInteger(fv, "waitAtInsert");
END;
IF Text.Equal(e, "stopAtHeapOpInit") THEN
NARROW(arg, T).eventDataRec.stopAtHeapOpInit :=
FormsVBT.GetBoolean(fv, "stopAtHeapOpInit");
END;
IF Text.Equal(e, "waitAtHeapOpInit") THEN
NARROW(arg, T).eventDataRec.waitAtHeapOpInit :=
FormsVBT.GetInteger(fv, "waitAtHeapOpInit");
END;
IF Text.Equal(e, "stopAtUpHeapStep") THEN
NARROW(arg, T).eventDataRec.stopAtUpHeapStep :=
FormsVBT.GetBoolean(fv, "stopAtUpHeapStep");
END;
IF Text.Equal(e, "waitAtUpHeapStep") THEN
NARROW(arg, T).eventDataRec.waitAtUpHeapStep :=
FormsVBT.GetInteger(fv, "waitAtUpHeapStep");
END;
IF Text.Equal(e, "stopAtHeapStep") THEN
NARROW(arg, T).eventDataRec.stopAtHeapStep :=
FormsVBT.GetBoolean(fv, "stopAtHeapStep");
END;
IF Text.Equal(e, "waitAtHeapStep") THEN
NARROW(arg, T).eventDataRec.waitAtHeapStep :=
FormsVBT.GetInteger(fv, "waitAtHeapStep");
END;
IF Text.Equal(e, "stopAtPlaceElement") THEN
NARROW(arg, T).eventDataRec.stopAtPlaceElement :=
FormsVBT.GetBoolean(fv, "stopAtPlaceElement");
END;
IF Text.Equal(e, "waitAtPlaceElement") THEN
NARROW(arg, T).eventDataRec.waitAtPlaceElement :=
FormsVBT.GetInteger(fv, "waitAtPlaceElement");
END;
IF Text.Equal(e, "stopAtRemove") THEN
NARROW(arg, T).eventDataRec.stopAtRemove :=
FormsVBT.GetBoolean(fv, "stopAtRemove");
END;
IF Text.Equal(e, "waitAtRemove") THEN
NARROW(arg, T).eventDataRec.waitAtRemove :=
FormsVBT.GetInteger(fv, "waitAtRemove");
END;
IF Text.Equal(e, "stopAtCompare") THEN
NARROW(arg, T).eventDataRec.stopAtCompare :=
FormsVBT.GetBoolean(fv, "stopAtCompare");
END;
IF Text.Equal(e, "waitAtCompare") THEN
NARROW(arg, T).eventDataRec.waitAtCompare :=
FormsVBT.GetInteger(fv, "waitAtCompare");
END;
IF Text.Equal(e, "stopAtPause") THEN
NARROW(arg, T).eventDataRec.stopAtPause :=
FormsVBT.GetBoolean(fv, "stopAtPause");
END;
IF Text.Equal(e, "waitAtPause") THEN
NARROW(arg, T).eventDataRec.waitAtPause :=
FormsVBT.GetInteger(fv, "waitAtPause");
END;
IF Text.Equal(e, "stopAtSortStep") THEN
NARROW(arg, T).eventDataRec.stopAtSortStep :=
FormsVBT.GetBoolean(fv, "stopAtSortStep");
END;
IF Text.Equal(e, "waitAtSortStep") THEN
NARROW(arg, T).eventDataRec.waitAtSortStep :=
FormsVBT.GetInteger(fv, "waitAtSortStep");
END;
END PQueueDoIt;
PROCEDURE PQueueRefreshCts (
<*UNUSED*> fv : FormsVBT.T;
<*UNUSED*> e : TEXT;
arg : REFANY;
<*UNUSED*> t : VBT.TimeStamp) =
<* LL = VBT.mu *>
BEGIN
NARROW(arg, T).updateEventCounts(FALSE);
END PQueueRefreshCts;
PROCEDURE FromFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
alg.stopatCodeEvents :=
FormsVBT.GetBoolean(fv, "stopatCodeEvents");
alg.waitatCodeEvents :=
FormsVBT.GetInteger(fv, "waitatCodeEvents");
alg.eventDataRec.stopAtSetup :=
FormsVBT.GetBoolean(fv, "stopAtSetup");
alg.eventDataRec.waitAtSetup :=
FormsVBT.GetInteger(fv, "waitAtSetup");
alg.eventDataRec.stopAtInitSort :=
FormsVBT.GetBoolean(fv, "stopAtInitSort");
alg.eventDataRec.waitAtInitSort :=
FormsVBT.GetInteger(fv, "waitAtInitSort");
alg.eventDataRec.stopAtInsert :=
FormsVBT.GetBoolean(fv, "stopAtInsert");
alg.eventDataRec.waitAtInsert :=
FormsVBT.GetInteger(fv, "waitAtInsert");
alg.eventDataRec.stopAtHeapOpInit :=
FormsVBT.GetBoolean(fv, "stopAtHeapOpInit");
alg.eventDataRec.waitAtHeapOpInit :=
FormsVBT.GetInteger(fv, "waitAtHeapOpInit");
alg.eventDataRec.stopAtUpHeapStep :=
FormsVBT.GetBoolean(fv, "stopAtUpHeapStep");
alg.eventDataRec.waitAtUpHeapStep :=
FormsVBT.GetInteger(fv, "waitAtUpHeapStep");
alg.eventDataRec.stopAtHeapStep :=
FormsVBT.GetBoolean(fv, "stopAtHeapStep");
alg.eventDataRec.waitAtHeapStep :=
FormsVBT.GetInteger(fv, "waitAtHeapStep");
alg.eventDataRec.stopAtPlaceElement :=
FormsVBT.GetBoolean(fv, "stopAtPlaceElement");
alg.eventDataRec.waitAtPlaceElement :=
FormsVBT.GetInteger(fv, "waitAtPlaceElement");
alg.eventDataRec.stopAtRemove :=
FormsVBT.GetBoolean(fv, "stopAtRemove");
alg.eventDataRec.waitAtRemove :=
FormsVBT.GetInteger(fv, "waitAtRemove");
alg.eventDataRec.stopAtCompare :=
FormsVBT.GetBoolean(fv, "stopAtCompare");
alg.eventDataRec.waitAtCompare :=
FormsVBT.GetInteger(fv, "waitAtCompare");
alg.eventDataRec.stopAtPause :=
FormsVBT.GetBoolean(fv, "stopAtPause");
alg.eventDataRec.waitAtPause :=
FormsVBT.GetInteger(fv, "waitAtPause");
alg.eventDataRec.stopAtSortStep :=
FormsVBT.GetBoolean(fv, "stopAtSortStep");
alg.eventDataRec.waitAtSortStep :=
FormsVBT.GetInteger(fv, "waitAtSortStep");
END FromFV;
<*UNUSED*>
PROCEDURE ToFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
FormsVBT.PutBoolean(fv, "stopatCodeEvents", alg.stopatCodeEvents);
FormsVBT.PutInteger(fv, "waitatCodeEvents", alg.waitatCodeEvents);
FormsVBT.PutBoolean(fv, "stopAtSetup",
alg.eventDataRec.stopAtSetup);
FormsVBT.PutInteger(fv, "waitAtSetup",
alg.eventDataRec.waitAtSetup);
FormsVBT.PutBoolean(fv, "stopAtInitSort",
alg.eventDataRec.stopAtInitSort);
FormsVBT.PutInteger(fv, "waitAtInitSort",
alg.eventDataRec.waitAtInitSort);
FormsVBT.PutBoolean(fv, "stopAtInsert",
alg.eventDataRec.stopAtInsert);
FormsVBT.PutInteger(fv, "waitAtInsert",
alg.eventDataRec.waitAtInsert);
FormsVBT.PutBoolean(fv, "stopAtHeapOpInit",
alg.eventDataRec.stopAtHeapOpInit);
FormsVBT.PutInteger(fv, "waitAtHeapOpInit",
alg.eventDataRec.waitAtHeapOpInit);
FormsVBT.PutBoolean(fv, "stopAtUpHeapStep",
alg.eventDataRec.stopAtUpHeapStep);
FormsVBT.PutInteger(fv, "waitAtUpHeapStep",
alg.eventDataRec.waitAtUpHeapStep);
FormsVBT.PutBoolean(fv, "stopAtHeapStep",
alg.eventDataRec.stopAtHeapStep);
FormsVBT.PutInteger(fv, "waitAtHeapStep",
alg.eventDataRec.waitAtHeapStep);
FormsVBT.PutBoolean(fv, "stopAtPlaceElement",
alg.eventDataRec.stopAtPlaceElement);
FormsVBT.PutInteger(fv, "waitAtPlaceElement",
alg.eventDataRec.waitAtPlaceElement);
FormsVBT.PutBoolean(fv, "stopAtRemove",
alg.eventDataRec.stopAtRemove);
FormsVBT.PutInteger(fv, "waitAtRemove",
alg.eventDataRec.waitAtRemove);
FormsVBT.PutBoolean(fv, "stopAtCompare",
alg.eventDataRec.stopAtCompare);
FormsVBT.PutInteger(fv, "waitAtCompare",
alg.eventDataRec.waitAtCompare);
FormsVBT.PutBoolean(fv, "stopAtPause",
alg.eventDataRec.stopAtPause);
FormsVBT.PutInteger(fv, "waitAtPause",
alg.eventDataRec.waitAtPause);
FormsVBT.PutBoolean(fv, "stopAtSortStep",
alg.eventDataRec.stopAtSortStep);
FormsVBT.PutInteger(fv, "waitAtSortStep",
alg.eventDataRec.waitAtSortStep);
CountsToFV (fv, alg);
END ToFV;
PROCEDURE CountsToFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
FormsVBT.PutText(fv, "ctOfSetup",
Fmt.Int(alg.eventDataRec.ctOfSetup));
FormsVBT.PutText(fv, "ctOfInitSort",
Fmt.Int(alg.eventDataRec.ctOfInitSort));
FormsVBT.PutText(fv, "ctOfInsert",
Fmt.Int(alg.eventDataRec.ctOfInsert));
FormsVBT.PutText(fv, "ctOfHeapOpInit",
Fmt.Int(alg.eventDataRec.ctOfHeapOpInit));
FormsVBT.PutText(fv, "ctOfUpHeapStep",
Fmt.Int(alg.eventDataRec.ctOfUpHeapStep));
FormsVBT.PutText(fv, "ctOfHeapStep",
Fmt.Int(alg.eventDataRec.ctOfHeapStep));
FormsVBT.PutText(fv, "ctOfPlaceElement",
Fmt.Int(alg.eventDataRec.ctOfPlaceElement));
FormsVBT.PutText(fv, "ctOfRemove",
Fmt.Int(alg.eventDataRec.ctOfRemove));
FormsVBT.PutText(fv, "ctOfCompare",
Fmt.Int(alg.eventDataRec.ctOfCompare));
FormsVBT.PutText(fv, "ctOfPause",
Fmt.Int(alg.eventDataRec.ctOfPause));
FormsVBT.PutText(fv, "ctOfSortStep",
Fmt.Int(alg.eventDataRec.ctOfSortStep));
END CountsToFV;
PROCEDURE PQueueDefaultUpdateCts ( v: T; reset: BOOLEAN) =
<* LL = VBT.mu *>
BEGIN
IF reset THEN
v.eventDataRec.ctOfSetup := 0;
v.eventDataRec.ctOfInitSort := 0;
v.eventDataRec.ctOfInsert := 0;
v.eventDataRec.ctOfHeapOpInit := 0;
v.eventDataRec.ctOfUpHeapStep := 0;
v.eventDataRec.ctOfHeapStep := 0;
v.eventDataRec.ctOfPlaceElement := 0;
v.eventDataRec.ctOfRemove := 0;
v.eventDataRec.ctOfCompare := 0;
v.eventDataRec.ctOfPause := 0;
v.eventDataRec.ctOfSortStep := 0;
END;
CountsToFV (v.eventData, v);
END PQueueDefaultUpdateCts;
PROCEDURE PQueueDefaultSnapshot (v: T; wr: Wr.T)
RAISES {ZeusClass.Error} =
<* LL = VBT.mu *>
BEGIN
TRY
Wr.PutChar(wr, '(')
EXCEPT
ELSE
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultSnapshot write error");
END;
IF v.eventData = NIL THEN
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultSnapshot: " &
"eventData not set!");
END;
TRY
v.eventData.snapshot(wr)
EXCEPT
FormsVBT.Error (msg) =>
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultSnapshot FV error: "
& msg);
ELSE
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultSnapshot error");
END;
Algorithm.T.snapshot(v, wr);
TRY
Wr.PutChar(wr, ')')
EXCEPT
ELSE
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultSnapshot write error");
END;
END PQueueDefaultSnapshot;
PROCEDURE PQueueDefaultRestore (v: T; rd: Rd.T)
RAISES {ZeusClass.Error} =
<* LL = VBT.mu *>
BEGIN
IF rd = NIL THEN RETURN END;
IF NOT ZeusUtil.EatChar(rd, '(') THEN
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultRestore read error");
END;
IF v.eventData = NIL THEN
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultRestore: " &
"eventData not set!");
END;
TRY
v.eventData.restore(rd);
v.updateEventCounts(FALSE);
FromFV(v.eventData, v);
EXCEPT
ELSE
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultRestore error");
END;
Algorithm.T.restore(v, rd);
IF NOT ZeusUtil.EatChar(rd, ')') THEN
RAISE ZeusClass.Error(
"PQueueAlgClass.PQueueDefaultRestore read error");
END;
END PQueueDefaultRestore;
BEGIN
END PQueueAlgClass.