********************************************************************
* NOTE: This file is generated automatically from the event * definition file StringSearch.evt. ********************************************************************<* PRAGMA LL *> MODULE; <*NOWARN*> IMPORT ZeusClass, Zeus, Algorithm, View, Thread; <*NOWARN*> IMPORT AlgorithmClass, StringSearchViewClass; <*NOWARN*> IMPORT StringSearchAlgClass; <* FATAL Zeus.Error, Zeus.Locked *> StringSearchIE If you get either of these errors, contact a Zeus implementor.TYPE SetupArgs = BRANDED REF RECORD p: TEXT; s: TEXT; END; ProbeArgs = BRANDED REF RECORD i: CARDINAL; j: CARDINAL; END; ResultArgs = BRANDED REF RECORD res: BOOLEAN; END; PartialMatchArgs = BRANDED REF RECORD i: CARDINAL; j: CARDINAL; len: CARDINAL; END; PartialMatchClearArgs = BRANDED REF RECORD END; CompleteMatchArgs = BRANDED REF RECORD j: CARDINAL; END; SlideToArgs = BRANDED REF RECORD j: CARDINAL; END; KMPSetupArgs = BRANDED REF RECORD p: TEXT; END; AddEdgeArgs = BRANDED REF RECORD f: CARDINAL; t: CARDINAL; 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 | StringSearchViewClass.T (view) => <*NOWARN*> TYPECASE evt OF | SetupArgs(varSetupArgs) => <*NOWARN*> view.oeSetup ( varSetupArgs.p , varSetupArgs.s ) | ProbeArgs(varProbeArgs) => <*NOWARN*> view.oeProbe ( varProbeArgs.i , varProbeArgs.j ) | ResultArgs(varResultArgs) => <*NOWARN*> view.oeResult ( varResultArgs.res ) | PartialMatchArgs(varPartialMatchArgs) => <*NOWARN*> view.oePartialMatch ( varPartialMatchArgs.i , varPartialMatchArgs.j , varPartialMatchArgs.len ) | PartialMatchClearArgs(varPartialMatchClearArgs) => <*NOWARN*> view.oePartialMatchClear ( ) | CompleteMatchArgs(varCompleteMatchArgs) => <*NOWARN*> view.oeCompleteMatch ( varCompleteMatchArgs.j ) | SlideToArgs(varSlideToArgs) => <*NOWARN*> view.oeSlideTo ( varSlideToArgs.j ) | KMPSetupArgs(varKMPSetupArgs) => <*NOWARN*> view.oeKMPSetup ( varKMPSetupArgs.p ) | AddEdgeArgs(varAddEdgeArgs) => <*NOWARN*> view.oeAddEdge ( varAddEdgeArgs.f , varAddEdgeArgs.t ) ELSE <* ASSERT FALSE *> END; ELSE (* this view isn't a StringSearchViewClass, so just ignore *) END END OEDispatcher; <*NOWARN*> PROCEDUREFEDispatcher (v: ZeusClass.T; evt: REFANY) = <* LL = VBT.mu *> BEGIN TYPECASE v OF | StringSearchAlgClass.T (alg) => <*NOWARN*> TYPECASE evt OF ELSE <* ASSERT FALSE *> END; ELSE (* this alg isn't a StringSearchAlgClass, so just ignore *) END END FEDispatcher; PROCEDURESetup ( initiator: Algorithm.T; p, s: TEXT ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SetupArgs , p := p , s := s ); alg := NARROW(initiator, StringSearchAlgClass.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; PROCEDUREProbe ( initiator: Algorithm.T; i, j: CARDINAL ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(ProbeArgs , i := i , j := j ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfProbe); alg.stopAtEvent := alg.eventDataRec.stopAtProbe; alg.waitAtEvent := alg.eventDataRec.waitAtProbe; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Probe", OEDispatcher, zumeArgRec); END; END Probe; PROCEDUREResult ( initiator: Algorithm.T; res: BOOLEAN ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(ResultArgs , res := res ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfResult); alg.stopAtEvent := alg.eventDataRec.stopAtResult; alg.waitAtEvent := alg.eventDataRec.waitAtResult; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Result", OEDispatcher, zumeArgRec); END; END Result; PROCEDUREPartialMatch ( initiator: Algorithm.T; i, j, len: CARDINAL ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(PartialMatchArgs , i := i , j := j , len := len ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfPartialMatch); alg.stopAtEvent := alg.eventDataRec.stopAtPartialMatch; alg.waitAtEvent := alg.eventDataRec.waitAtPartialMatch; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "PartialMatch", OEDispatcher, zumeArgRec); END; END PartialMatch; PROCEDUREPartialMatchClear ( initiator: Algorithm.T; ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(PartialMatchClearArgs ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfPartialMatchClear); alg.stopAtEvent := alg.eventDataRec.stopAtPartialMatchClear; alg.waitAtEvent := alg.eventDataRec.waitAtPartialMatchClear; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "PartialMatchClear", OEDispatcher, zumeArgRec); END; END PartialMatchClear; PROCEDURECompleteMatch ( initiator: Algorithm.T; j: CARDINAL ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(CompleteMatchArgs , j := j ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfCompleteMatch); alg.stopAtEvent := alg.eventDataRec.stopAtCompleteMatch; alg.waitAtEvent := alg.eventDataRec.waitAtCompleteMatch; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "CompleteMatch", OEDispatcher, zumeArgRec); END; END CompleteMatch; PROCEDURESlideTo ( initiator: Algorithm.T; j: CARDINAL ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SlideToArgs , j := j ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfSlideTo); alg.stopAtEvent := alg.eventDataRec.stopAtSlideTo; alg.waitAtEvent := alg.eventDataRec.waitAtSlideTo; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "SlideTo", OEDispatcher, zumeArgRec); END; END SlideTo; PROCEDUREKMPSetup ( initiator: Algorithm.T; p: TEXT ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(KMPSetupArgs , p := p ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfKMPSetup); alg.stopAtEvent := alg.eventDataRec.stopAtKMPSetup; alg.waitAtEvent := alg.eventDataRec.waitAtKMPSetup; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "KMPSetup", OEDispatcher, zumeArgRec); END; END KMPSetup; PROCEDUREAddEdge ( initiator: Algorithm.T; f, t: CARDINAL ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(AddEdgeArgs , f := f , t := t ); alg := NARROW(initiator, StringSearchAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfAddEdge); alg.stopAtEvent := alg.eventDataRec.stopAtAddEdge; alg.waitAtEvent := alg.eventDataRec.waitAtAddEdge; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "AddEdge", OEDispatcher, zumeArgRec); END; END AddEdge; BEGIN END StringSearchIE.