********************************************************************
* NOTE: This file is generated automatically from the event * definition file Minimax.evt. ********************************************************************<* PRAGMA LL *> MODULE; <*NOWARN*> IMPORT ZeusClass, Zeus, TypeFmt, Minimax; <*NOWARN*> IMPORT MinimaxAlgClass, MinimaxViewClass, Algorithm; <*NOWARN*> IMPORT GameBoard, View, Thread, AlgorithmClass; <* FATAL Zeus.Error, Zeus.Locked *> MinimaxIE If you get either of these errors, contact a Zeus implementor.TYPE SetupArgs = BRANDED REF RECORD END; PlayerMoveArgs = BRANDED REF RECORD player: INTEGER; fromx: INTEGER; fromy: INTEGER; tox: INTEGER; toy: INTEGER; END; FinishedArgs = BRANDED REF RECORD winner: INTEGER; END; EvaluateNodeArgs = BRANDED REF RECORD board: GameBoard.T; END; PlayerThinkingArgs = BRANDED REF RECORD player: INTEGER; board: GameBoard.T; END; FinishedEvalNodeArgs = BRANDED REF RECORD board: GameBoard.T; END; BoardValueUpdatedArgs = BRANDED REF RECORD board: GameBoard.T; newValue: Minimax.BoardValue; END; HumanSelectionArgs = BRANDED REF RECORD xCoord: INTEGER; yCoord: INTEGER; END; HumanCellSelectedArgs = BRANDED REF RECORD xCoord: INTEGER; yCoord: INTEGER; END; HumanIllegalMoveArgs = BRANDED REF RECORD 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 | MinimaxViewClass.T (view) => <*NOWARN*> TYPECASE evt OF | SetupArgs(varSetupArgs) => <*NOWARN*> view.oeSetup ( ) | PlayerMoveArgs(varPlayerMoveArgs) => <*NOWARN*> view.oePlayerMove ( varPlayerMoveArgs.player , varPlayerMoveArgs.fromx , varPlayerMoveArgs.fromy , varPlayerMoveArgs.tox , varPlayerMoveArgs.toy ) | FinishedArgs(varFinishedArgs) => <*NOWARN*> view.oeFinished ( varFinishedArgs.winner ) | EvaluateNodeArgs(varEvaluateNodeArgs) => <*NOWARN*> view.oeEvaluateNode ( varEvaluateNodeArgs.board ) | PlayerThinkingArgs(varPlayerThinkingArgs) => <*NOWARN*> view.oePlayerThinking ( varPlayerThinkingArgs.player , varPlayerThinkingArgs.board ) | FinishedEvalNodeArgs(varFinishedEvalNodeArgs) => <*NOWARN*> view.oeFinishedEvalNode ( varFinishedEvalNodeArgs.board ) | BoardValueUpdatedArgs(varBoardValueUpdatedArgs) => <*NOWARN*> view.oeBoardValueUpdated ( varBoardValueUpdatedArgs.board , varBoardValueUpdatedArgs.newValue ) | HumanCellSelectedArgs(varHumanCellSelectedArgs) => <*NOWARN*> view.oeHumanCellSelected ( varHumanCellSelectedArgs.xCoord , varHumanCellSelectedArgs.yCoord ) | HumanIllegalMoveArgs(varHumanIllegalMoveArgs) => <*NOWARN*> view.oeHumanIllegalMove ( ) ELSE <* ASSERT FALSE *> END; ELSE (* this view isn't a MinimaxViewClass, so just ignore *) END END OEDispatcher; <*NOWARN*> PROCEDUREFEDispatcher (v: ZeusClass.T; evt: REFANY) = <* LL = VBT.mu *> BEGIN TYPECASE v OF | MinimaxAlgClass.T (alg) => <*NOWARN*> TYPECASE evt OF | HumanSelectionArgs(varHumanSelectionArgs) => <*NOWARN*> alg.feHumanSelection ( varHumanSelectionArgs.xCoord , varHumanSelectionArgs.yCoord ) ELSE <* ASSERT FALSE *> END; ELSE (* this alg isn't a MinimaxAlgClass, so just ignore *) END END FEDispatcher; PROCEDURESetup ( initiator: Algorithm.T; ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SetupArgs ); alg := NARROW(initiator, MinimaxAlgClass.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; PROCEDUREPlayerMove ( initiator: Algorithm.T; player: INTEGER; fromx, fromy, tox, toy: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(PlayerMoveArgs , player := player , fromx := fromx , fromy := fromy , tox := tox , toy := toy ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfPlayerMove); alg.stopAtEvent := alg.eventDataRec.stopAtPlayerMove; alg.waitAtEvent := alg.eventDataRec.waitAtPlayerMove; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "PlayerMove", OEDispatcher, zumeArgRec); END; END PlayerMove; PROCEDUREFinished ( initiator: Algorithm.T; winner: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(FinishedArgs , winner := winner ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfFinished); alg.stopAtEvent := alg.eventDataRec.stopAtFinished; alg.waitAtEvent := alg.eventDataRec.waitAtFinished; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Finished", OEDispatcher, zumeArgRec); END; END Finished; PROCEDUREEvaluateNode ( initiator: Algorithm.T; board: GameBoard.T ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(EvaluateNodeArgs , board := board ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfEvaluateNode); alg.stopAtEvent := alg.eventDataRec.stopAtEvaluateNode; alg.waitAtEvent := alg.eventDataRec.waitAtEvaluateNode; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "EvaluateNode", OEDispatcher, zumeArgRec); END; END EvaluateNode; PROCEDUREPlayerThinking ( initiator: Algorithm.T; player: INTEGER; board: GameBoard.T ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(PlayerThinkingArgs , player := player , board := board ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfPlayerThinking); alg.stopAtEvent := alg.eventDataRec.stopAtPlayerThinking; alg.waitAtEvent := alg.eventDataRec.waitAtPlayerThinking; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "PlayerThinking", OEDispatcher, zumeArgRec); END; END PlayerThinking; PROCEDUREFinishedEvalNode ( initiator: Algorithm.T; board: GameBoard.T ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(FinishedEvalNodeArgs , board := board ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfFinishedEvalNode); alg.stopAtEvent := alg.eventDataRec.stopAtFinishedEvalNode; alg.waitAtEvent := alg.eventDataRec.waitAtFinishedEvalNode; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "FinishedEvalNode", OEDispatcher, zumeArgRec); END; END FinishedEvalNode; PROCEDUREBoardValueUpdated ( initiator: Algorithm.T; board: GameBoard.T; newValue: Minimax.BoardValue ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(BoardValueUpdatedArgs , board := board , newValue := newValue ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfBoardValueUpdated); alg.stopAtEvent := alg.eventDataRec.stopAtBoardValueUpdated; alg.waitAtEvent := alg.eventDataRec.waitAtBoardValueUpdated; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "BoardValueUpdated", OEDispatcher, zumeArgRec); END; END BoardValueUpdated; PROCEDUREHumanCellSelected ( initiator: Algorithm.T; xCoord, yCoord: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(HumanCellSelectedArgs , xCoord := xCoord , yCoord := yCoord ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfHumanCellSelected); alg.stopAtEvent := alg.eventDataRec.stopAtHumanCellSelected; alg.waitAtEvent := alg.eventDataRec.waitAtHumanCellSelected; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "HumanCellSelected", OEDispatcher, zumeArgRec); END; END HumanCellSelected; PROCEDUREHumanIllegalMove ( initiator: Algorithm.T; ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(HumanIllegalMoveArgs ); alg := NARROW(initiator, MinimaxAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfHumanIllegalMove); alg.stopAtEvent := alg.eventDataRec.stopAtHumanIllegalMove; alg.waitAtEvent := alg.eventDataRec.waitAtHumanIllegalMove; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "HumanIllegalMove", OEDispatcher, zumeArgRec); END; END HumanIllegalMove; PROCEDUREHumanSelection ( initiator: View.T; xCoord, yCoord: INTEGER ) RAISES {Thread.Alerted} = <* LL = VBT.mu *> VAR zumeArgRec := NEW(HumanSelectionArgs , xCoord := xCoord , yCoord := yCoord ); BEGIN Zeus.Dispatch(initiator, Zeus.EventStyle.Notify, 1, "HumanSelection", FEDispatcher, zumeArgRec); END HumanSelection; BEGIN END MinimaxIE.