********************************************************************
* NOTE: This file is generated automatically from the event * definition file Sort.evt. ********************************************************************<* PRAGMA LL *> MODULE; <*NOWARN*> IMPORT ZeusClass, Zeus, SortViewClass, Algorithm, Sort; <*NOWARN*> IMPORT SortAlgClass, View, Thread, AlgorithmClass; <* FATAL Zeus.Error, Zeus.Locked *> SortIE If you get either of these errors, contact a Zeus implementor.TYPE InitArgs = BRANDED REF RECORD N: CARDINAL; passes: CARDINAL; END; SetValArgs = BRANDED REF RECORD i: CARDINAL; val: Sort.Key; END; SwapEltsArgs = BRANDED REF RECORD i: CARDINAL; j: CARDINAL; END; StartPassArgs = BRANDED REF RECORD END; UpdateValArgs = BRANDED REF RECORD i: CARDINAL; val: Sort.Key; END; ChangeValArgs = BRANDED REF RECORD i: CARDINAL; new: Sort.Key; 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 | SortViewClass.T (view) => <*NOWARN*> TYPECASE evt OF | InitArgs(varInitArgs) => <*NOWARN*> view.oeInit ( varInitArgs.N , varInitArgs.passes ) | SetValArgs(varSetValArgs) => <*NOWARN*> view.oeSetVal ( varSetValArgs.i , varSetValArgs.val ) | SwapEltsArgs(varSwapEltsArgs) => <*NOWARN*> view.oeSwapElts ( varSwapEltsArgs.i , varSwapEltsArgs.j ) | StartPassArgs(varStartPassArgs) => <*NOWARN*> view.oeStartPass ( ) | UpdateValArgs(varUpdateValArgs) => <*NOWARN*> view.ueUpdateVal ( varUpdateValArgs.i , varUpdateValArgs.val ) ELSE <* ASSERT FALSE *> END; ELSE (* this view isn't a SortViewClass, so just ignore *) END END OEDispatcher; <*NOWARN*> PROCEDUREFEDispatcher (v: ZeusClass.T; evt: REFANY) = <* LL = VBT.mu *> BEGIN TYPECASE v OF | SortAlgClass.T (alg) => <*NOWARN*> TYPECASE evt OF | ChangeValArgs(varChangeValArgs) => <*NOWARN*> alg.feChangeVal ( varChangeValArgs.i , varChangeValArgs.new ) ELSE <* ASSERT FALSE *> END; ELSE (* this alg isn't a SortAlgClass, so just ignore *) END END FEDispatcher; PROCEDUREInit ( initiator: Algorithm.T; N: CARDINAL; passes: CARDINAL ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(InitArgs , N := N , passes := passes ); alg := NARROW(initiator, SortAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfInit); alg.stopAtEvent := alg.eventDataRec.stopAtInit; alg.waitAtEvent := alg.eventDataRec.waitAtInit; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Init", OEDispatcher, zumeArgRec); END; END Init; PROCEDURESetVal ( initiator: Algorithm.T; i: CARDINAL; val: Sort.Key ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SetValArgs , i := i , val := val ); alg := NARROW(initiator, SortAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfSetVal); alg.stopAtEvent := alg.eventDataRec.stopAtSetVal; alg.waitAtEvent := alg.eventDataRec.waitAtSetVal; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "SetVal", OEDispatcher, zumeArgRec); END; END SetVal; PROCEDURESwapElts ( initiator: Algorithm.T; i, j: CARDINAL ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SwapEltsArgs , i := i , j := j ); alg := NARROW(initiator, SortAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfSwapElts); alg.stopAtEvent := alg.eventDataRec.stopAtSwapElts; alg.waitAtEvent := alg.eventDataRec.waitAtSwapElts; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "SwapElts", OEDispatcher, zumeArgRec); END; END SwapElts; PROCEDUREStartPass ( initiator: Algorithm.T; ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(StartPassArgs ); alg := NARROW(initiator, SortAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfStartPass); alg.stopAtEvent := alg.eventDataRec.stopAtStartPass; alg.waitAtEvent := alg.eventDataRec.waitAtStartPass; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "StartPass", OEDispatcher, zumeArgRec); END; END StartPass; PROCEDUREUpdateVal ( initiator: Algorithm.T; i: CARDINAL; val: Sort.Key ) RAISES {Thread.Alerted} = <* LL = VBT.mu *> VAR zumeArgRec := NEW(UpdateValArgs , i := i , val := val ); BEGIN Zeus.Dispatch(initiator, Zeus.EventStyle.Update, 1, "UpdateVal", OEDispatcher, zumeArgRec); END UpdateVal; PROCEDUREChangeVal ( initiator: View.T; i: CARDINAL; new: Sort.Key ) RAISES {Thread.Alerted} = <* LL = VBT.mu *> VAR zumeArgRec := NEW(ChangeValArgs , i := i , new := new ); BEGIN Zeus.Dispatch(initiator, Zeus.EventStyle.Notify, 1, "ChangeVal", FEDispatcher, zumeArgRec); END ChangeVal; BEGIN END SortIE.