mentor/derived/CPIE.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 CP.evt.
      ********************************************************************


<* PRAGMA LL *>

MODULE CPIE;

<*NOWARN*> IMPORT CPViewClass, CPAlgClass, ZeusClass, Zeus, R2;
<*NOWARN*> IMPORT Algorithm, View, Thread, AlgorithmClass;

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

TYPE
  SetupArgs = BRANDED REF RECORD
  END;

  AddPointArgs = BRANDED REF RECORD
    p: R2.T;
    N: INTEGER;
    big: BOOLEAN;
  END;

  NotProcessedArgs = BRANDED REF RECORD
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  END;

  RemoveNotProcessedArgs = BRANDED REF RECORD
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  END;

  ActiveRArgs = BRANDED REF RECORD
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  END;

  RemoveActiveRArgs = BRANDED REF RECORD
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  END;

  CloseRArgs = BRANDED REF RECORD
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  END;

  RemoveCloseRArgs = BRANDED REF RECORD
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  END;

  SplitArgs = BRANDED REF RECORD
    x: REAL;
    big: BOOLEAN;
  END;

  SplitRemoveArgs = BRANDED REF RECORD
    x: REAL;
    big: BOOLEAN;
  END;

  NewMinArgs = BRANDED REF RECORD
    p1: R2.T;
    p2: R2.T;
    c1: R2.T;
    c2: R2.T;
    big: BOOLEAN;
  END;

  NoChangeMinArgs = BRANDED REF RECORD
    p1: R2.T;
    p2: R2.T;
    c1: R2.T;
    c2: R2.T;
    big: BOOLEAN;
  END;

  SelectTrialPointArgs = BRANDED REF RECORD
    x: R2.T;
    big: BOOLEAN;
  END;

  DeselectTrialPointArgs = BRANDED REF RECORD
    x: R2.T;
    big: BOOLEAN;
  END;

  SelectTargetPointArgs = BRANDED REF RECORD
    trialp: R2.T;
    targp: R2.T;
    big: BOOLEAN;
  END;

  DeselectTargetPointArgs = BRANDED REF RECORD
    trialp: R2.T;
    targp: R2.T;
    big: BOOLEAN;
  END;

  DrawBarArgs = BRANDED REF RECORD
    y: REAL;
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  END;

  RemoveBarArgs = BRANDED REF RECORD
    y: REAL;
    x1: REAL;
    x2: REAL;
    big: BOOLEAN;
  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
    | CPViewClass.T (view) => <*NOWARN*>
      TYPECASE evt OF
      | SetupArgs(varSetupArgs) => <*NOWARN*>
          view.oeSetup (
              )
      | AddPointArgs(varAddPointArgs) => <*NOWARN*>
          view.oeAddPoint (
              varAddPointArgs.p
                ,
              varAddPointArgs.N
                ,
              varAddPointArgs.big
              )
      | NotProcessedArgs(varNotProcessedArgs) => <*NOWARN*>
          view.oeNotProcessed (
              varNotProcessedArgs.x1
                ,
              varNotProcessedArgs.x2
                ,
              varNotProcessedArgs.big
              )
      | RemoveNotProcessedArgs(varRemoveNotProcessedArgs) => <*NOWARN*>
          view.oeRemoveNotProcessed (
              varRemoveNotProcessedArgs.x1
                ,
              varRemoveNotProcessedArgs.x2
                ,
              varRemoveNotProcessedArgs.big
              )
      | ActiveRArgs(varActiveRArgs) => <*NOWARN*>
          view.oeActiveR (
              varActiveRArgs.x1
                ,
              varActiveRArgs.x2
                ,
              varActiveRArgs.big
              )
      | RemoveActiveRArgs(varRemoveActiveRArgs) => <*NOWARN*>
          view.oeRemoveActiveR (
              varRemoveActiveRArgs.x1
                ,
              varRemoveActiveRArgs.x2
                ,
              varRemoveActiveRArgs.big
              )
      | CloseRArgs(varCloseRArgs) => <*NOWARN*>
          view.oeCloseR (
              varCloseRArgs.x1
                ,
              varCloseRArgs.x2
                ,
              varCloseRArgs.big
              )
      | RemoveCloseRArgs(varRemoveCloseRArgs) => <*NOWARN*>
          view.oeRemoveCloseR (
              varRemoveCloseRArgs.x1
                ,
              varRemoveCloseRArgs.x2
                ,
              varRemoveCloseRArgs.big
              )
      | SplitArgs(varSplitArgs) => <*NOWARN*>
          view.oeSplit (
              varSplitArgs.x
                ,
              varSplitArgs.big
              )
      | SplitRemoveArgs(varSplitRemoveArgs) => <*NOWARN*>
          view.oeSplitRemove (
              varSplitRemoveArgs.x
                ,
              varSplitRemoveArgs.big
              )
      | NewMinArgs(varNewMinArgs) => <*NOWARN*>
          view.oeNewMin (
              varNewMinArgs.p1
                ,
              varNewMinArgs.p2
                ,
              varNewMinArgs.c1
                ,
              varNewMinArgs.c2
                ,
              varNewMinArgs.big
              )
      | NoChangeMinArgs(varNoChangeMinArgs) => <*NOWARN*>
          view.oeNoChangeMin (
              varNoChangeMinArgs.p1
                ,
              varNoChangeMinArgs.p2
                ,
              varNoChangeMinArgs.c1
                ,
              varNoChangeMinArgs.c2
                ,
              varNoChangeMinArgs.big
              )
      | SelectTrialPointArgs(varSelectTrialPointArgs) => <*NOWARN*>
          view.oeSelectTrialPoint (
              varSelectTrialPointArgs.x
                ,
              varSelectTrialPointArgs.big
              )
      | DeselectTrialPointArgs(varDeselectTrialPointArgs) => <*NOWARN*>
          view.oeDeselectTrialPoint (
              varDeselectTrialPointArgs.x
                ,
              varDeselectTrialPointArgs.big
              )
      | SelectTargetPointArgs(varSelectTargetPointArgs) => <*NOWARN*>
          view.oeSelectTargetPoint (
              varSelectTargetPointArgs.trialp
                ,
              varSelectTargetPointArgs.targp
                ,
              varSelectTargetPointArgs.big
              )
      | DeselectTargetPointArgs(varDeselectTargetPointArgs) => <*NOWARN*>
          view.oeDeselectTargetPoint (
              varDeselectTargetPointArgs.trialp
                ,
              varDeselectTargetPointArgs.targp
                ,
              varDeselectTargetPointArgs.big
              )
      | DrawBarArgs(varDrawBarArgs) => <*NOWARN*>
          view.oeDrawBar (
              varDrawBarArgs.y
                ,
              varDrawBarArgs.x1
                ,
              varDrawBarArgs.x2
                ,
              varDrawBarArgs.big
              )
      | RemoveBarArgs(varRemoveBarArgs) => <*NOWARN*>
          view.oeRemoveBar (
              varRemoveBarArgs.y
                ,
              varRemoveBarArgs.x1
                ,
              varRemoveBarArgs.x2
                ,
              varRemoveBarArgs.big
              )
      ELSE <* ASSERT FALSE *>
      END;
    ELSE (* this view isn't a CPViewClass, so just ignore *)
    END
  END OEDispatcher;

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

PROCEDURE Setup (
      initiator: Algorithm.T;

    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SetupArgs
      );
      alg := NARROW(initiator, CPAlgClass.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 AddPoint (
      initiator: Algorithm.T;
       p: R2.T; N: INTEGER; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(AddPointArgs
               , p := p
               , N := N
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfAddPoint);
      alg.stopAtEvent := alg.eventDataRec.stopAtAddPoint;
      alg.waitAtEvent := alg.eventDataRec.waitAtAddPoint;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "AddPoint", OEDispatcher, zumeArgRec);
    END;
  END AddPoint;

PROCEDURE NotProcessed (
      initiator: Algorithm.T;
       x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(NotProcessedArgs
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfNotProcessed);
      alg.stopAtEvent := alg.eventDataRec.stopAtNotProcessed;
      alg.waitAtEvent := alg.eventDataRec.waitAtNotProcessed;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "NotProcessed", OEDispatcher, zumeArgRec);
    END;
  END NotProcessed;

PROCEDURE RemoveNotProcessed (
      initiator: Algorithm.T;
       x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(RemoveNotProcessedArgs
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfRemoveNotProcessed);
      alg.stopAtEvent := alg.eventDataRec.stopAtRemoveNotProcessed;
      alg.waitAtEvent := alg.eventDataRec.waitAtRemoveNotProcessed;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "RemoveNotProcessed", OEDispatcher, zumeArgRec);
    END;
  END RemoveNotProcessed;

PROCEDURE ActiveR (
      initiator: Algorithm.T;
       x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ActiveRArgs
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfActiveR);
      alg.stopAtEvent := alg.eventDataRec.stopAtActiveR;
      alg.waitAtEvent := alg.eventDataRec.waitAtActiveR;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "ActiveR", OEDispatcher, zumeArgRec);
    END;
  END ActiveR;

PROCEDURE RemoveActiveR (
      initiator: Algorithm.T;
       x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(RemoveActiveRArgs
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfRemoveActiveR);
      alg.stopAtEvent := alg.eventDataRec.stopAtRemoveActiveR;
      alg.waitAtEvent := alg.eventDataRec.waitAtRemoveActiveR;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "RemoveActiveR", OEDispatcher, zumeArgRec);
    END;
  END RemoveActiveR;

PROCEDURE CloseR (
      initiator: Algorithm.T;
       x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(CloseRArgs
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfCloseR);
      alg.stopAtEvent := alg.eventDataRec.stopAtCloseR;
      alg.waitAtEvent := alg.eventDataRec.waitAtCloseR;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "CloseR", OEDispatcher, zumeArgRec);
    END;
  END CloseR;

PROCEDURE RemoveCloseR (
      initiator: Algorithm.T;
       x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(RemoveCloseRArgs
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfRemoveCloseR);
      alg.stopAtEvent := alg.eventDataRec.stopAtRemoveCloseR;
      alg.waitAtEvent := alg.eventDataRec.waitAtRemoveCloseR;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "RemoveCloseR", OEDispatcher, zumeArgRec);
    END;
  END RemoveCloseR;

PROCEDURE Split (
      initiator: Algorithm.T;
       x: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SplitArgs
               , x := x
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSplit);
      alg.stopAtEvent := alg.eventDataRec.stopAtSplit;
      alg.waitAtEvent := alg.eventDataRec.waitAtSplit;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Split", OEDispatcher, zumeArgRec);
    END;
  END Split;

PROCEDURE SplitRemove (
      initiator: Algorithm.T;
       x: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SplitRemoveArgs
               , x := x
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSplitRemove);
      alg.stopAtEvent := alg.eventDataRec.stopAtSplitRemove;
      alg.waitAtEvent := alg.eventDataRec.waitAtSplitRemove;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "SplitRemove", OEDispatcher, zumeArgRec);
    END;
  END SplitRemove;

PROCEDURE NewMin (
      initiator: Algorithm.T;
       p1, p2, c1, c2: R2.T; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(NewMinArgs
               , p1 := p1
               , p2 := p2
               , c1 := c1
               , c2 := c2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfNewMin);
      alg.stopAtEvent := alg.eventDataRec.stopAtNewMin;
      alg.waitAtEvent := alg.eventDataRec.waitAtNewMin;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "NewMin", OEDispatcher, zumeArgRec);
    END;
  END NewMin;

PROCEDURE NoChangeMin (
      initiator: Algorithm.T;
       p1, p2, c1, c2: R2.T; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(NoChangeMinArgs
               , p1 := p1
               , p2 := p2
               , c1 := c1
               , c2 := c2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfNoChangeMin);
      alg.stopAtEvent := alg.eventDataRec.stopAtNoChangeMin;
      alg.waitAtEvent := alg.eventDataRec.waitAtNoChangeMin;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "NoChangeMin", OEDispatcher, zumeArgRec);
    END;
  END NoChangeMin;

PROCEDURE SelectTrialPoint (
      initiator: Algorithm.T;
       x: R2.T; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SelectTrialPointArgs
               , x := x
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSelectTrialPoint);
      alg.stopAtEvent := alg.eventDataRec.stopAtSelectTrialPoint;
      alg.waitAtEvent := alg.eventDataRec.waitAtSelectTrialPoint;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "SelectTrialPoint", OEDispatcher, zumeArgRec);
    END;
  END SelectTrialPoint;

PROCEDURE DeselectTrialPoint (
      initiator: Algorithm.T;
       x: R2.T; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(DeselectTrialPointArgs
               , x := x
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfDeselectTrialPoint);
      alg.stopAtEvent := alg.eventDataRec.stopAtDeselectTrialPoint;
      alg.waitAtEvent := alg.eventDataRec.waitAtDeselectTrialPoint;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "DeselectTrialPoint", OEDispatcher, zumeArgRec);
    END;
  END DeselectTrialPoint;

PROCEDURE SelectTargetPoint (
      initiator: Algorithm.T;
       trialp, targp: R2.T; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SelectTargetPointArgs
               , trialp := trialp
               , targp := targp
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfSelectTargetPoint);
      alg.stopAtEvent := alg.eventDataRec.stopAtSelectTargetPoint;
      alg.waitAtEvent := alg.eventDataRec.waitAtSelectTargetPoint;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "SelectTargetPoint", OEDispatcher, zumeArgRec);
    END;
  END SelectTargetPoint;

PROCEDURE DeselectTargetPoint (
      initiator: Algorithm.T;
       trialp, targp: R2.T; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(DeselectTargetPointArgs
               , trialp := trialp
               , targp := targp
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfDeselectTargetPoint);
      alg.stopAtEvent := alg.eventDataRec.stopAtDeselectTargetPoint;
      alg.waitAtEvent := alg.eventDataRec.waitAtDeselectTargetPoint;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "DeselectTargetPoint", OEDispatcher, zumeArgRec);
    END;
  END DeselectTargetPoint;

PROCEDURE DrawBar (
      initiator: Algorithm.T;
       y, x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(DrawBarArgs
               , y := y
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfDrawBar);
      alg.stopAtEvent := alg.eventDataRec.stopAtDrawBar;
      alg.waitAtEvent := alg.eventDataRec.waitAtDrawBar;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "DrawBar", OEDispatcher, zumeArgRec);
    END;
  END DrawBar;

PROCEDURE RemoveBar (
      initiator: Algorithm.T;
       y, x1, x2: REAL; big: BOOLEAN
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(RemoveBarArgs
               , y := y
               , x1 := x1
               , x2 := x2
               , big := big
      );
      alg := NARROW(initiator, CPAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfRemoveBar);
      alg.stopAtEvent := alg.eventDataRec.stopAtRemoveBar;
      alg.waitAtEvent := alg.eventDataRec.waitAtRemoveBar;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "RemoveBar", OEDispatcher, zumeArgRec);
    END;
  END RemoveBar;

BEGIN
END CPIE.

interface View is in: