mentor/derived/HullIE.m3


 Copyright (C) 1995, Digital Equipment Corporation.       
 All rights reserved.                                     
 See the file COPYRIGHT for a full description.           
                                                          
 Last modified on Thu Feb  9 08:50:48 PST 1995 by kalsow  
      modified on Sun Jun  5 21:59:57 PDT 1994 by mhb     
      modified on Wed Feb 17 16:46:47 PST 1993 by johnh   

********************************************************************

      *  NOTE: This file is generated automatically from the event
      *        definition file Hull.evt.
      ********************************************************************


<* PRAGMA LL *>

MODULE HullIE;

<*NOWARN*> IMPORT HullFmt, HullAlgClass, IntList, ZeusClass, Zeus;
<*NOWARN*> IMPORT SiteList, Algorithm, HullViewClass, View, Thread;
<*NOWARN*> IMPORT AlgorithmClass;

<* FATAL Zeus.Error, Zeus.Locked *>
If you get either of these errors, contact a Zeus implementor.

TYPE
  SetupArgs = BRANDED REF RECORD
    trueSites: SiteList.T;
    auxSites: SiteList.T;
  END;

  SetHalfPlaneArgs = BRANDED REF RECORD
    tail: INTEGER;
    head: INTEGER;
  END;

  ClearHeadArgs = BRANDED REF RECORD
  END;

  TestSiteArgs = BRANDED REF RECORD
    i: INTEGER;
  END;

  ClearTestArgs = BRANDED REF RECORD
  END;

  SetTailArgs = BRANDED REF RECORD
    i: INTEGER;
  END;

  ClearTailArgs = BRANDED REF RECORD
  END;

  MoveHalfPlaneArgs = BRANDED REF RECORD
    tail: INTEGER;
    head: INTEGER;
  END;

  ConfirmArgs = BRANDED REF RECORD
    tail: INTEGER;
    head: INTEGER;
  END;

  DenyArgs = BRANDED REF RECORD
    tail: INTEGER;
    head: INTEGER;
  END;

  SwapArgs = BRANDED REF RECORD
    i: INTEGER;
    j: INTEGER;
  END;

  SentinelArgs = BRANDED REF RECORD
    i: INTEGER;
    j: INTEGER;
  END;

  ReOrderArgs = BRANDED REF RECORD
    l: IntList.T;
  END;

  StretchArgs = BRANDED REF RECORD
    hullSites: IntList.T;
    otherSites: IntList.T;
  END;

  SnapArgs = BRANDED REF RECORD
    hullSites: IntList.T;
    otherSites: IntList.T;
  END;

  ShuffleArgs = BRANDED REF RECORD
    hullSites: IntList.T;
    otherSites: IntList.T;
  END;
Zeus calls the following to invoke vbt v's event handler:

<*NOWARN*> PROCEDURE OEDispatcher(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
    | HullViewClass.T (view) => <*NOWARN*>
      TYPECASE evt OF
      | SetupArgs(varSetupArgs) => <*NOWARN*>
          view.oeSetup (
              varSetupArgs.trueSites
                ,
              varSetupArgs.auxSites
              )
      | SetHalfPlaneArgs(varSetHalfPlaneArgs) => <*NOWARN*>
          view.oeSetHalfPlane (
              varSetHalfPlaneArgs.tail
                ,
              varSetHalfPlaneArgs.head
              )
      | ClearHeadArgs(varClearHeadArgs) => <*NOWARN*>
          view.oeClearHead (
              )
      | TestSiteArgs(varTestSiteArgs) => <*NOWARN*>
          view.oeTestSite (
              varTestSiteArgs.i
              )
      | ClearTestArgs(varClearTestArgs) => <*NOWARN*>
          view.oeClearTest (
              )
      | SetTailArgs(varSetTailArgs) => <*NOWARN*>
          view.oeSetTail (
              varSetTailArgs.i
              )
      | ClearTailArgs(varClearTailArgs) => <*NOWARN*>
          view.oeClearTail (
              )
      | MoveHalfPlaneArgs(varMoveHalfPlaneArgs) => <*NOWARN*>
          view.oeMoveHalfPlane (
              varMoveHalfPlaneArgs.tail
                ,
              varMoveHalfPlaneArgs.head
              )
      | ConfirmArgs(varConfirmArgs) => <*NOWARN*>
          view.oeConfirm (
              varConfirmArgs.tail
                ,
              varConfirmArgs.head
              )
      | DenyArgs(varDenyArgs) => <*NOWARN*>
          view.oeDeny (
              varDenyArgs.tail
                ,
              varDenyArgs.head
              )
      | SwapArgs(varSwapArgs) => <*NOWARN*>
          view.oeSwap (
              varSwapArgs.i
                ,
              varSwapArgs.j
              )
      | SentinelArgs(varSentinelArgs) => <*NOWARN*>
          view.oeSentinel (
              varSentinelArgs.i
                ,
              varSentinelArgs.j
              )
      | ReOrderArgs(varReOrderArgs) => <*NOWARN*>
          view.oeReOrder (
              varReOrderArgs.l
              )
      | StretchArgs(varStretchArgs) => <*NOWARN*>
          view.oeStretch (
              varStretchArgs.hullSites
                ,
              varStretchArgs.otherSites
              )
      | SnapArgs(varSnapArgs) => <*NOWARN*>
          view.oeSnap (
              varSnapArgs.hullSites
                ,
              varSnapArgs.otherSites
              )
      | ShuffleArgs(varShuffleArgs) => <*NOWARN*>
          view.oeShuffle (
              varShuffleArgs.hullSites
                ,
              varShuffleArgs.otherSites
              )
      ELSE <* ASSERT FALSE *>
      END;
    ELSE (* this view isn't a HullViewClass, so just ignore *)
    END
  END OEDispatcher;

<*NOWARN*> PROCEDURE FEDispatcher(v: ZeusClass.T; evt: REFANY) =
  <* LL = VBT.mu *>
  BEGIN
    TYPECASE v OF
    | HullAlgClass.T (alg) => <*NOWARN*>
      TYPECASE evt OF
      ELSE <* ASSERT FALSE *>
      END;
    ELSE (* this alg isn't a HullAlgClass, so just ignore *)
    END
  END FEDispatcher;

PROCEDURE Setup (
      initiator: Algorithm.T;
       trueSites, auxSites: SiteList.T
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SetupArgs
               , trueSites := trueSites
               , auxSites := auxSites
      );
      alg := NARROW(initiator, HullAlgClass.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;

PROCEDURE SetHalfPlane (
      initiator: Algorithm.T;
       tail, head: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SetHalfPlaneArgs
               , tail := tail
               , head := head
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSetHalfPlane);
      alg.stopAtEvent := alg.eventDataRec.stopAtSetHalfPlane;
      alg.waitAtEvent := alg.eventDataRec.waitAtSetHalfPlane;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "SetHalfPlane", OEDispatcher, zumeArgRec);
    END;
  END SetHalfPlane;

PROCEDURE ClearHead (
      initiator: Algorithm.T;

    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ClearHeadArgs
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfClearHead);
      alg.stopAtEvent := alg.eventDataRec.stopAtClearHead;
      alg.waitAtEvent := alg.eventDataRec.waitAtClearHead;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "ClearHead", OEDispatcher, zumeArgRec);
    END;
  END ClearHead;

PROCEDURE TestSite (
      initiator: Algorithm.T;
       i: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(TestSiteArgs
               , i := i
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfTestSite);
      alg.stopAtEvent := alg.eventDataRec.stopAtTestSite;
      alg.waitAtEvent := alg.eventDataRec.waitAtTestSite;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "TestSite", OEDispatcher, zumeArgRec);
    END;
  END TestSite;

PROCEDURE ClearTest (
      initiator: Algorithm.T;

    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ClearTestArgs
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfClearTest);
      alg.stopAtEvent := alg.eventDataRec.stopAtClearTest;
      alg.waitAtEvent := alg.eventDataRec.waitAtClearTest;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "ClearTest", OEDispatcher, zumeArgRec);
    END;
  END ClearTest;

PROCEDURE SetTail (
      initiator: Algorithm.T;
       i: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SetTailArgs
               , i := i
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSetTail);
      alg.stopAtEvent := alg.eventDataRec.stopAtSetTail;
      alg.waitAtEvent := alg.eventDataRec.waitAtSetTail;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "SetTail", OEDispatcher, zumeArgRec);
    END;
  END SetTail;

PROCEDURE ClearTail (
      initiator: Algorithm.T;

    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ClearTailArgs
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfClearTail);
      alg.stopAtEvent := alg.eventDataRec.stopAtClearTail;
      alg.waitAtEvent := alg.eventDataRec.waitAtClearTail;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "ClearTail", OEDispatcher, zumeArgRec);
    END;
  END ClearTail;

PROCEDURE MoveHalfPlane (
      initiator: Algorithm.T;
       tail, head: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(MoveHalfPlaneArgs
               , tail := tail
               , head := head
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfMoveHalfPlane);
      alg.stopAtEvent := alg.eventDataRec.stopAtMoveHalfPlane;
      alg.waitAtEvent := alg.eventDataRec.waitAtMoveHalfPlane;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "MoveHalfPlane", OEDispatcher, zumeArgRec);
    END;
  END MoveHalfPlane;

PROCEDURE Confirm (
      initiator: Algorithm.T;
       tail, head: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ConfirmArgs
               , tail := tail
               , head := head
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfConfirm);
      alg.stopAtEvent := alg.eventDataRec.stopAtConfirm;
      alg.waitAtEvent := alg.eventDataRec.waitAtConfirm;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Confirm", OEDispatcher, zumeArgRec);
    END;
  END Confirm;

PROCEDURE Deny (
      initiator: Algorithm.T;
       tail, head: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(DenyArgs
               , tail := tail
               , head := head
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfDeny);
      alg.stopAtEvent := alg.eventDataRec.stopAtDeny;
      alg.waitAtEvent := alg.eventDataRec.waitAtDeny;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Deny", OEDispatcher, zumeArgRec);
    END;
  END Deny;

PROCEDURE Swap (
      initiator: Algorithm.T;
       i, j: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SwapArgs
               , i := i
               , j := j
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSwap);
      alg.stopAtEvent := alg.eventDataRec.stopAtSwap;
      alg.waitAtEvent := alg.eventDataRec.waitAtSwap;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Swap", OEDispatcher, zumeArgRec);
    END;
  END Swap;

PROCEDURE Sentinel (
      initiator: Algorithm.T;
       i, j: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SentinelArgs
               , i := i
               , j := j
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSentinel);
      alg.stopAtEvent := alg.eventDataRec.stopAtSentinel;
      alg.waitAtEvent := alg.eventDataRec.waitAtSentinel;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Sentinel", OEDispatcher, zumeArgRec);
    END;
  END Sentinel;

PROCEDURE ReOrder (
      initiator: Algorithm.T;
       l: IntList.T
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ReOrderArgs
               , l := l
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfReOrder);
      alg.stopAtEvent := alg.eventDataRec.stopAtReOrder;
      alg.waitAtEvent := alg.eventDataRec.waitAtReOrder;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "ReOrder", OEDispatcher, zumeArgRec);
    END;
  END ReOrder;

PROCEDURE Stretch (
      initiator: Algorithm.T;
       hullSites, otherSites: IntList.T
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(StretchArgs
               , hullSites := hullSites
               , otherSites := otherSites
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfStretch);
      alg.stopAtEvent := alg.eventDataRec.stopAtStretch;
      alg.waitAtEvent := alg.eventDataRec.waitAtStretch;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Stretch", OEDispatcher, zumeArgRec);
    END;
  END Stretch;

PROCEDURE Snap (
      initiator: Algorithm.T;
       hullSites, otherSites: IntList.T
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SnapArgs
               , hullSites := hullSites
               , otherSites := otherSites
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSnap);
      alg.stopAtEvent := alg.eventDataRec.stopAtSnap;
      alg.waitAtEvent := alg.eventDataRec.waitAtSnap;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Snap", OEDispatcher, zumeArgRec);
    END;
  END Snap;

PROCEDURE Shuffle (
      initiator: Algorithm.T;
       hullSites, otherSites: IntList.T
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ShuffleArgs
               , hullSites := hullSites
               , otherSites := otherSites
      );
      alg := NARROW(initiator, HullAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfShuffle);
      alg.stopAtEvent := alg.eventDataRec.stopAtShuffle;
      alg.waitAtEvent := alg.eventDataRec.waitAtShuffle;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Shuffle", OEDispatcher, zumeArgRec);
    END;
  END Shuffle;

BEGIN
END HullIE.

interface View is in: