********************************************************************
* NOTE: This file is generated automatically from the event * definition file PQueue.evt. ********************************************************************<* PRAGMA LL *> MODULE; <*NOWARN*> IMPORT PQueue, ZeusClass, Zeus, Algorithm; <*NOWARN*> IMPORT PQueueAlgClass, View, Thread, PQueueViewClass; <*NOWARN*> IMPORT AlgorithmClass; <* FATAL Zeus.Error, Zeus.Locked *> PQueueIE If you get either of these errors, contact a Zeus implementor.TYPE SetupArgs = BRANDED REF RECORD size: INTEGER; doSort: BOOLEAN; END; InitSortArgs = BRANDED REF RECORD vals: PQueue.Array; END; InsertArgs = BRANDED REF RECORD el: INTEGER; END; HeapOpInitArgs = BRANDED REF RECORD k: INTEGER; END; UpHeapStepArgs = BRANDED REF RECORD k: INTEGER; END; HeapStepArgs = BRANDED REF RECORD k: INTEGER; n: INTEGER; down: BOOLEAN; END; PlaceElementArgs = BRANDED REF RECORD k: INTEGER; END; RemoveArgs = BRANDED REF RECORD END; CompareArgs = BRANDED REF RECORD k: INTEGER; n: INTEGER; END; PauseArgs = BRANDED REF RECORD END; SortStepArgs = BRANDED REF RECORD k: INTEGER; END;Zeus calls the following to invoke vbt v's event handler:<*NOWARN*> PROCEDUREOEDispatcher (v: ZeusClass.T; evt: REFANY) RAISES {Thread.Alerted} = <* LL <= VBT.mu *> (* LL = {} if event style is output, LL = VBT.mu if event style is update. *) BEGIN TYPECASE v OF | PQueueViewClass.T (view) => <*NOWARN*> TYPECASE evt OF | SetupArgs(varSetupArgs) => <*NOWARN*> view.oeSetup ( varSetupArgs.size , varSetupArgs.doSort ) | InitSortArgs(varInitSortArgs) => <*NOWARN*> view.oeInitSort ( varInitSortArgs.vals ) | InsertArgs(varInsertArgs) => <*NOWARN*> view.oeInsert ( varInsertArgs.el ) | HeapOpInitArgs(varHeapOpInitArgs) => <*NOWARN*> view.oeHeapOpInit ( varHeapOpInitArgs.k ) | UpHeapStepArgs(varUpHeapStepArgs) => <*NOWARN*> view.oeUpHeapStep ( varUpHeapStepArgs.k ) | HeapStepArgs(varHeapStepArgs) => <*NOWARN*> view.oeHeapStep ( varHeapStepArgs.k , varHeapStepArgs.n , varHeapStepArgs.down ) | PlaceElementArgs(varPlaceElementArgs) => <*NOWARN*> view.oePlaceElement ( varPlaceElementArgs.k ) | RemoveArgs(varRemoveArgs) => <*NOWARN*> view.oeRemove ( ) | CompareArgs(varCompareArgs) => <*NOWARN*> view.oeCompare ( varCompareArgs.k , varCompareArgs.n ) | PauseArgs(varPauseArgs) => <*NOWARN*> view.oePause ( ) | SortStepArgs(varSortStepArgs) => <*NOWARN*> view.oeSortStep ( varSortStepArgs.k ) ELSE <* ASSERT FALSE *> END; ELSE (* this view isn't a PQueueViewClass, so just ignore *) END END OEDispatcher; <*NOWARN*> PROCEDUREFEDispatcher (v: ZeusClass.T; evt: REFANY) = <* LL = VBT.mu *> BEGIN TYPECASE v OF | PQueueAlgClass.T (alg) => <*NOWARN*> TYPECASE evt OF ELSE <* ASSERT FALSE *> END; ELSE (* this alg isn't a PQueueAlgClass, so just ignore *) END END FEDispatcher; PROCEDURESetup ( initiator: Algorithm.T; size: INTEGER; doSort: BOOLEAN ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SetupArgs , size := size , doSort := doSort ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfSetup); alg.stopAtEvent := alg.eventDataRec.stopAtSetup; alg.waitAtEvent := alg.eventDataRec.waitAtSetup; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Setup", OEDispatcher, zumeArgRec); END; END Setup; PROCEDUREInitSort ( initiator: Algorithm.T; vals: PQueue.Array ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(InitSortArgs , vals := vals ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfInitSort); alg.stopAtEvent := alg.eventDataRec.stopAtInitSort; alg.waitAtEvent := alg.eventDataRec.waitAtInitSort; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "InitSort", OEDispatcher, zumeArgRec); END; END InitSort; PROCEDUREInsert ( initiator: Algorithm.T; el: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(InsertArgs , el := el ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfInsert); alg.stopAtEvent := alg.eventDataRec.stopAtInsert; alg.waitAtEvent := alg.eventDataRec.waitAtInsert; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Insert", OEDispatcher, zumeArgRec); END; END Insert; PROCEDUREHeapOpInit ( initiator: Algorithm.T; k: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(HeapOpInitArgs , k := k ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfHeapOpInit); alg.stopAtEvent := alg.eventDataRec.stopAtHeapOpInit; alg.waitAtEvent := alg.eventDataRec.waitAtHeapOpInit; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "HeapOpInit", OEDispatcher, zumeArgRec); END; END HeapOpInit; PROCEDUREUpHeapStep ( initiator: Algorithm.T; k: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(UpHeapStepArgs , k := k ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfUpHeapStep); alg.stopAtEvent := alg.eventDataRec.stopAtUpHeapStep; alg.waitAtEvent := alg.eventDataRec.waitAtUpHeapStep; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "UpHeapStep", OEDispatcher, zumeArgRec); END; END UpHeapStep; PROCEDUREHeapStep ( initiator: Algorithm.T; k, n: INTEGER; down: BOOLEAN ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(HeapStepArgs , k := k , n := n , down := down ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfHeapStep); alg.stopAtEvent := alg.eventDataRec.stopAtHeapStep; alg.waitAtEvent := alg.eventDataRec.waitAtHeapStep; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "HeapStep", OEDispatcher, zumeArgRec); END; END HeapStep; PROCEDUREPlaceElement ( initiator: Algorithm.T; k: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(PlaceElementArgs , k := k ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfPlaceElement); alg.stopAtEvent := alg.eventDataRec.stopAtPlaceElement; alg.waitAtEvent := alg.eventDataRec.waitAtPlaceElement; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "PlaceElement", OEDispatcher, zumeArgRec); END; END PlaceElement; PROCEDURERemove ( initiator: Algorithm.T; ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(RemoveArgs ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfRemove); alg.stopAtEvent := alg.eventDataRec.stopAtRemove; alg.waitAtEvent := alg.eventDataRec.waitAtRemove; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Remove", OEDispatcher, zumeArgRec); END; END Remove; PROCEDURECompare ( initiator: Algorithm.T; k: INTEGER; n: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(CompareArgs , k := k , n := n ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfCompare); alg.stopAtEvent := alg.eventDataRec.stopAtCompare; alg.waitAtEvent := alg.eventDataRec.waitAtCompare; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Compare", OEDispatcher, zumeArgRec); END; END Compare; PROCEDUREPause ( initiator: Algorithm.T; ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(PauseArgs ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfPause); alg.stopAtEvent := alg.eventDataRec.stopAtPause; alg.waitAtEvent := alg.eventDataRec.waitAtPause; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Pause", OEDispatcher, zumeArgRec); END; END Pause; PROCEDURESortStep ( initiator: Algorithm.T; k: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SortStepArgs , k := k ); alg := NARROW(initiator, PQueueAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfSortStep); alg.stopAtEvent := alg.eventDataRec.stopAtSortStep; alg.waitAtEvent := alg.eventDataRec.waitAtSortStep; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "SortStep", OEDispatcher, zumeArgRec); END; END SortStep; BEGIN END PQueueIE.