********************************************************************
* NOTE: This file is generated automatically from the event * definition file Hash.evt. ********************************************************************<* PRAGMA LL *> MODULE; <*NOWARN*> IMPORT HashViewClass, HashAlgClass, IntList, ZeusClass; <*NOWARN*> IMPORT Zeus, Algorithm, HashFmt, FormsVBT, View, Thread; <*NOWARN*> IMPORT AlgorithmClass; <* FATAL Zeus.Error, Zeus.Locked *> HashIE If you get either of these errors, contact a Zeus implementor.TYPE SetupArgs = BRANDED REF RECORD data: FormsVBT.T; nBuckets: INTEGER; END; InsertArgs = BRANDED REF RECORD key: TEXT; END; FindArgs = BRANDED REF RECORD key: TEXT; END; DeleteArgs = BRANDED REF RECORD key: TEXT; END; CompareArgs = BRANDED REF RECORD bucket: INTEGER; END; CheckDeletableArgs = BRANDED REF RECORD bucket: INTEGER; END; CheckHashPositionArgs = BRANDED REF RECORD bucket: INTEGER; END; AddToBucketArgs = BRANDED REF RECORD key: TEXT; bucket: INTEGER; END; DeleteFromBucketArgs = BRANDED REF RECORD key: TEXT; bucket: INTEGER; markEmpty: BOOLEAN; END; ReportFindArgs = BRANDED REF RECORD item: TEXT; END; FindReportArgs = BRANDED REF RECORD buckets: IntList.T; END; StopReportFindArgs = BRANDED REF RECORD END; StopFindReportArgs = 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 | HashViewClass.T (view) => <*NOWARN*> TYPECASE evt OF | SetupArgs(varSetupArgs) => <*NOWARN*> view.oeSetup ( varSetupArgs.data , varSetupArgs.nBuckets ) | InsertArgs(varInsertArgs) => <*NOWARN*> view.oeInsert ( varInsertArgs.key ) | FindArgs(varFindArgs) => <*NOWARN*> view.oeFind ( varFindArgs.key ) | DeleteArgs(varDeleteArgs) => <*NOWARN*> view.oeDelete ( varDeleteArgs.key ) | CompareArgs(varCompareArgs) => <*NOWARN*> view.oeCompare ( varCompareArgs.bucket ) | CheckDeletableArgs(varCheckDeletableArgs) => <*NOWARN*> view.oeCheckDeletable ( varCheckDeletableArgs.bucket ) | CheckHashPositionArgs(varCheckHashPositionArgs) => <*NOWARN*> view.oeCheckHashPosition ( varCheckHashPositionArgs.bucket ) | AddToBucketArgs(varAddToBucketArgs) => <*NOWARN*> view.oeAddToBucket ( varAddToBucketArgs.key , varAddToBucketArgs.bucket ) | DeleteFromBucketArgs(varDeleteFromBucketArgs) => <*NOWARN*> view.oeDeleteFromBucket ( varDeleteFromBucketArgs.key , varDeleteFromBucketArgs.bucket , varDeleteFromBucketArgs.markEmpty ) | FindReportArgs(varFindReportArgs) => <*NOWARN*> view.ueFindReport ( varFindReportArgs.buckets ) | StopFindReportArgs(varStopFindReportArgs) => <*NOWARN*> view.ueStopFindReport ( ) ELSE <* ASSERT FALSE *> END; ELSE (* this view isn't a HashViewClass, so just ignore *) END END OEDispatcher; <*NOWARN*> PROCEDUREFEDispatcher (v: ZeusClass.T; evt: REFANY) = <* LL = VBT.mu *> BEGIN TYPECASE v OF | HashAlgClass.T (alg) => <*NOWARN*> TYPECASE evt OF | ReportFindArgs(varReportFindArgs) => <*NOWARN*> alg.feReportFind ( varReportFindArgs.item ) | StopReportFindArgs(varStopReportFindArgs) => <*NOWARN*> alg.feStopReportFind ( ) ELSE <* ASSERT FALSE *> END; ELSE (* this alg isn't a HashAlgClass, so just ignore *) END END FEDispatcher; PROCEDURESetup ( initiator: Algorithm.T; data: FormsVBT.T; nBuckets: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(SetupArgs , data := data , nBuckets := nBuckets ); alg := NARROW(initiator, HashAlgClass.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; PROCEDUREInsert ( initiator: Algorithm.T; key: TEXT ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(InsertArgs , key := key ); alg := NARROW(initiator, HashAlgClass.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; PROCEDUREFind ( initiator: Algorithm.T; key: TEXT ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(FindArgs , key := key ); alg := NARROW(initiator, HashAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfFind); alg.stopAtEvent := alg.eventDataRec.stopAtFind; alg.waitAtEvent := alg.eventDataRec.waitAtFind; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Find", OEDispatcher, zumeArgRec); END; END Find; PROCEDUREDelete ( initiator: Algorithm.T; key: TEXT ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(DeleteArgs , key := key ); alg := NARROW(initiator, HashAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfDelete); alg.stopAtEvent := alg.eventDataRec.stopAtDelete; alg.waitAtEvent := alg.eventDataRec.waitAtDelete; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "Delete", OEDispatcher, zumeArgRec); END; END Delete; PROCEDURECompare ( initiator: Algorithm.T; bucket: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(CompareArgs , bucket := bucket ); alg := NARROW(initiator, HashAlgClass.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; PROCEDURECheckDeletable ( initiator: Algorithm.T; bucket: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(CheckDeletableArgs , bucket := bucket ); alg := NARROW(initiator, HashAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfCheckDeletable); alg.stopAtEvent := alg.eventDataRec.stopAtCheckDeletable; alg.waitAtEvent := alg.eventDataRec.waitAtCheckDeletable; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "CheckDeletable", OEDispatcher, zumeArgRec); END; END CheckDeletable; PROCEDURECheckHashPosition ( initiator: Algorithm.T; bucket: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(CheckHashPositionArgs , bucket := bucket ); alg := NARROW(initiator, HashAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfCheckHashPosition); alg.stopAtEvent := alg.eventDataRec.stopAtCheckHashPosition; alg.waitAtEvent := alg.eventDataRec.waitAtCheckHashPosition; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "CheckHashPosition", OEDispatcher, zumeArgRec); END; END CheckHashPosition; PROCEDUREAddToBucket ( initiator: Algorithm.T; key: TEXT; bucket: INTEGER ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(AddToBucketArgs , key := key , bucket := bucket ); alg := NARROW(initiator, HashAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfAddToBucket); alg.stopAtEvent := alg.eventDataRec.stopAtAddToBucket; alg.waitAtEvent := alg.eventDataRec.waitAtAddToBucket; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "AddToBucket", OEDispatcher, zumeArgRec); END; END AddToBucket; PROCEDUREDeleteFromBucket ( initiator: Algorithm.T; key: TEXT; bucket: INTEGER; markEmpty: BOOLEAN ) RAISES {Thread.Alerted} = <* LL = {} *> VAR zumeArgRec := NEW(DeleteFromBucketArgs , key := key , bucket := bucket , markEmpty := markEmpty ); alg := NARROW(initiator, HashAlgClass.T); BEGIN LOCK alg.evtMu DO INC(alg.eventDataRec.ctOfDeleteFromBucket); alg.stopAtEvent := alg.eventDataRec.stopAtDeleteFromBucket; alg.waitAtEvent := alg.eventDataRec.waitAtDeleteFromBucket; Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1, "DeleteFromBucket", OEDispatcher, zumeArgRec); END; END DeleteFromBucket; PROCEDUREFindReport ( initiator: Algorithm.T; buckets: IntList.T ) RAISES {Thread.Alerted} = <* LL = VBT.mu *> VAR zumeArgRec := NEW(FindReportArgs , buckets := buckets ); BEGIN Zeus.Dispatch(initiator, Zeus.EventStyle.Update, 1, "FindReport", OEDispatcher, zumeArgRec); END FindReport; PROCEDUREStopFindReport ( initiator: Algorithm.T; ) RAISES {Thread.Alerted} = <* LL = VBT.mu *> VAR zumeArgRec := NEW(StopFindReportArgs ); BEGIN Zeus.Dispatch(initiator, Zeus.EventStyle.Update, 1, "StopFindReport", OEDispatcher, zumeArgRec); END StopFindReport; PROCEDUREReportFind ( initiator: View.T; item: TEXT ) RAISES {Thread.Alerted} = <* LL = VBT.mu *> VAR zumeArgRec := NEW(ReportFindArgs , item := item ); BEGIN Zeus.Dispatch(initiator, Zeus.EventStyle.Notify, 1, "ReportFind", FEDispatcher, zumeArgRec); END ReportFind; PROCEDUREStopReportFind ( initiator: View.T; ) RAISES {Thread.Alerted} = <* LL = VBT.mu *> VAR zumeArgRec := NEW(StopReportFindArgs ); BEGIN Zeus.Dispatch(initiator, Zeus.EventStyle.Notify, 1, "StopReportFind", FEDispatcher, zumeArgRec); END StopReportFind; BEGIN END HashIE.