mentor/derived/CPAlgClass.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:48:22 PST 1995 by kalsow  
      modified on Wed Feb 17 16:46:18 PST 1993 by johnh   
      modified on Thu Sep 24 10:59:20 PDT 1992 by mhb     

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

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


MODULE CPAlgClass;

<*NOWARN*> IMPORT Rd, ZeusClass, R2, Fmt, Algorithm, Wr, ZeusPanel;
<*NOWARN*> IMPORT FormsVBT, VBT, Text, ZeusUtil;

<* PRAGMA LL *>
Fix any FormsVBT errors; don't handle exceptions for them.
<* FATAL FormsVBT.Error, FormsVBT.Unimplemented *>

REVEAL
  T = Public BRANDED OBJECT
      OVERRIDES
        <* LL = VBT.mu *>
        init := CPDefaultInit;
        snapshot := CPDefaultSnapshot;
        restore := CPDefaultRestore;
        updateEventCounts := CPDefaultUpdateCts;
      END;

PROCEDURE CPDefaultInit (v: T): Algorithm.T =
  <* LL = VBT.mu *>
  PROCEDURE Attach (id: TEXT; proc: FormsVBT.Proc) =
    BEGIN
      FormsVBT.AttachProc(v.eventData, id, proc, v);
    END Attach;
  BEGIN
    v.eventData := ZeusPanel.NewForm("CPEventData.fv");
    Attach("stopatCodeEvents", CPDoIt);
    Attach("waitatCodeEvents", CPDoIt);
    Attach("eventCounts", CPRefreshCts);
    Attach("stopAtSetup", CPDoIt);
    Attach("waitAtSetup", CPDoIt);
    Attach("stopAtAddPoint", CPDoIt);
    Attach("waitAtAddPoint", CPDoIt);
    Attach("stopAtNotProcessed", CPDoIt);
    Attach("waitAtNotProcessed", CPDoIt);
    Attach("stopAtRemoveNotProcessed", CPDoIt);
    Attach("waitAtRemoveNotProcessed", CPDoIt);
    Attach("stopAtActiveR", CPDoIt);
    Attach("waitAtActiveR", CPDoIt);
    Attach("stopAtRemoveActiveR", CPDoIt);
    Attach("waitAtRemoveActiveR", CPDoIt);
    Attach("stopAtCloseR", CPDoIt);
    Attach("waitAtCloseR", CPDoIt);
    Attach("stopAtRemoveCloseR", CPDoIt);
    Attach("waitAtRemoveCloseR", CPDoIt);
    Attach("stopAtSplit", CPDoIt);
    Attach("waitAtSplit", CPDoIt);
    Attach("stopAtSplitRemove", CPDoIt);
    Attach("waitAtSplitRemove", CPDoIt);
    Attach("stopAtNewMin", CPDoIt);
    Attach("waitAtNewMin", CPDoIt);
    Attach("stopAtNoChangeMin", CPDoIt);
    Attach("waitAtNoChangeMin", CPDoIt);
    Attach("stopAtSelectTrialPoint", CPDoIt);
    Attach("waitAtSelectTrialPoint", CPDoIt);
    Attach("stopAtDeselectTrialPoint", CPDoIt);
    Attach("waitAtDeselectTrialPoint", CPDoIt);
    Attach("stopAtSelectTargetPoint", CPDoIt);
    Attach("waitAtSelectTargetPoint", CPDoIt);
    Attach("stopAtDeselectTargetPoint", CPDoIt);
    Attach("waitAtDeselectTargetPoint", CPDoIt);
    Attach("stopAtDrawBar", CPDoIt);
    Attach("waitAtDrawBar", CPDoIt);
    Attach("stopAtRemoveBar", CPDoIt);
    Attach("waitAtRemoveBar", CPDoIt);
    FromFV (v.eventData, v);    (* Get FV and internal data in sync *)
    RETURN Algorithm.T.init(v);
  END CPDefaultInit;

PROCEDURE CPDoIt (           fv : FormsVBT.T;
                           e  : TEXT;
                           arg: REFANY;
                <*UNUSED*> t  : VBT.TimeStamp) =
  <* LL = VBT.mu *>
  BEGIN
    IF Text.Equal(e, "stopatCodeEvents") THEN
      NARROW(arg, T).stopatCodeEvents :=
          FormsVBT.GetBoolean(fv, "stopatCodeEvents");
    END;
    IF Text.Equal(e, "waitatCodeEvents") THEN
      NARROW(arg, T).waitatCodeEvents :=
          FormsVBT.GetInteger(fv, "waitatCodeEvents");
    END;
    IF Text.Equal(e, "stopAtSetup") THEN
      NARROW(arg, T).eventDataRec.stopAtSetup :=
          FormsVBT.GetBoolean(fv, "stopAtSetup");
    END;
    IF Text.Equal(e, "waitAtSetup") THEN
      NARROW(arg, T).eventDataRec.waitAtSetup :=
          FormsVBT.GetInteger(fv, "waitAtSetup");
    END;
    IF Text.Equal(e, "stopAtAddPoint") THEN
      NARROW(arg, T).eventDataRec.stopAtAddPoint :=
          FormsVBT.GetBoolean(fv, "stopAtAddPoint");
    END;
    IF Text.Equal(e, "waitAtAddPoint") THEN
      NARROW(arg, T).eventDataRec.waitAtAddPoint :=
          FormsVBT.GetInteger(fv, "waitAtAddPoint");
    END;
    IF Text.Equal(e, "stopAtNotProcessed") THEN
      NARROW(arg, T).eventDataRec.stopAtNotProcessed :=
          FormsVBT.GetBoolean(fv, "stopAtNotProcessed");
    END;
    IF Text.Equal(e, "waitAtNotProcessed") THEN
      NARROW(arg, T).eventDataRec.waitAtNotProcessed :=
          FormsVBT.GetInteger(fv, "waitAtNotProcessed");
    END;
    IF Text.Equal(e, "stopAtRemoveNotProcessed") THEN
      NARROW(arg, T).eventDataRec.stopAtRemoveNotProcessed :=
          FormsVBT.GetBoolean(fv, "stopAtRemoveNotProcessed");
    END;
    IF Text.Equal(e, "waitAtRemoveNotProcessed") THEN
      NARROW(arg, T).eventDataRec.waitAtRemoveNotProcessed :=
          FormsVBT.GetInteger(fv, "waitAtRemoveNotProcessed");
    END;
    IF Text.Equal(e, "stopAtActiveR") THEN
      NARROW(arg, T).eventDataRec.stopAtActiveR :=
          FormsVBT.GetBoolean(fv, "stopAtActiveR");
    END;
    IF Text.Equal(e, "waitAtActiveR") THEN
      NARROW(arg, T).eventDataRec.waitAtActiveR :=
          FormsVBT.GetInteger(fv, "waitAtActiveR");
    END;
    IF Text.Equal(e, "stopAtRemoveActiveR") THEN
      NARROW(arg, T).eventDataRec.stopAtRemoveActiveR :=
          FormsVBT.GetBoolean(fv, "stopAtRemoveActiveR");
    END;
    IF Text.Equal(e, "waitAtRemoveActiveR") THEN
      NARROW(arg, T).eventDataRec.waitAtRemoveActiveR :=
          FormsVBT.GetInteger(fv, "waitAtRemoveActiveR");
    END;
    IF Text.Equal(e, "stopAtCloseR") THEN
      NARROW(arg, T).eventDataRec.stopAtCloseR :=
          FormsVBT.GetBoolean(fv, "stopAtCloseR");
    END;
    IF Text.Equal(e, "waitAtCloseR") THEN
      NARROW(arg, T).eventDataRec.waitAtCloseR :=
          FormsVBT.GetInteger(fv, "waitAtCloseR");
    END;
    IF Text.Equal(e, "stopAtRemoveCloseR") THEN
      NARROW(arg, T).eventDataRec.stopAtRemoveCloseR :=
          FormsVBT.GetBoolean(fv, "stopAtRemoveCloseR");
    END;
    IF Text.Equal(e, "waitAtRemoveCloseR") THEN
      NARROW(arg, T).eventDataRec.waitAtRemoveCloseR :=
          FormsVBT.GetInteger(fv, "waitAtRemoveCloseR");
    END;
    IF Text.Equal(e, "stopAtSplit") THEN
      NARROW(arg, T).eventDataRec.stopAtSplit :=
          FormsVBT.GetBoolean(fv, "stopAtSplit");
    END;
    IF Text.Equal(e, "waitAtSplit") THEN
      NARROW(arg, T).eventDataRec.waitAtSplit :=
          FormsVBT.GetInteger(fv, "waitAtSplit");
    END;
    IF Text.Equal(e, "stopAtSplitRemove") THEN
      NARROW(arg, T).eventDataRec.stopAtSplitRemove :=
          FormsVBT.GetBoolean(fv, "stopAtSplitRemove");
    END;
    IF Text.Equal(e, "waitAtSplitRemove") THEN
      NARROW(arg, T).eventDataRec.waitAtSplitRemove :=
          FormsVBT.GetInteger(fv, "waitAtSplitRemove");
    END;
    IF Text.Equal(e, "stopAtNewMin") THEN
      NARROW(arg, T).eventDataRec.stopAtNewMin :=
          FormsVBT.GetBoolean(fv, "stopAtNewMin");
    END;
    IF Text.Equal(e, "waitAtNewMin") THEN
      NARROW(arg, T).eventDataRec.waitAtNewMin :=
          FormsVBT.GetInteger(fv, "waitAtNewMin");
    END;
    IF Text.Equal(e, "stopAtNoChangeMin") THEN
      NARROW(arg, T).eventDataRec.stopAtNoChangeMin :=
          FormsVBT.GetBoolean(fv, "stopAtNoChangeMin");
    END;
    IF Text.Equal(e, "waitAtNoChangeMin") THEN
      NARROW(arg, T).eventDataRec.waitAtNoChangeMin :=
          FormsVBT.GetInteger(fv, "waitAtNoChangeMin");
    END;
    IF Text.Equal(e, "stopAtSelectTrialPoint") THEN
      NARROW(arg, T).eventDataRec.stopAtSelectTrialPoint :=
          FormsVBT.GetBoolean(fv, "stopAtSelectTrialPoint");
    END;
    IF Text.Equal(e, "waitAtSelectTrialPoint") THEN
      NARROW(arg, T).eventDataRec.waitAtSelectTrialPoint :=
          FormsVBT.GetInteger(fv, "waitAtSelectTrialPoint");
    END;
    IF Text.Equal(e, "stopAtDeselectTrialPoint") THEN
      NARROW(arg, T).eventDataRec.stopAtDeselectTrialPoint :=
          FormsVBT.GetBoolean(fv, "stopAtDeselectTrialPoint");
    END;
    IF Text.Equal(e, "waitAtDeselectTrialPoint") THEN
      NARROW(arg, T).eventDataRec.waitAtDeselectTrialPoint :=
          FormsVBT.GetInteger(fv, "waitAtDeselectTrialPoint");
    END;
    IF Text.Equal(e, "stopAtSelectTargetPoint") THEN
      NARROW(arg, T).eventDataRec.stopAtSelectTargetPoint :=
          FormsVBT.GetBoolean(fv, "stopAtSelectTargetPoint");
    END;
    IF Text.Equal(e, "waitAtSelectTargetPoint") THEN
      NARROW(arg, T).eventDataRec.waitAtSelectTargetPoint :=
          FormsVBT.GetInteger(fv, "waitAtSelectTargetPoint");
    END;
    IF Text.Equal(e, "stopAtDeselectTargetPoint") THEN
      NARROW(arg, T).eventDataRec.stopAtDeselectTargetPoint :=
          FormsVBT.GetBoolean(fv, "stopAtDeselectTargetPoint");
    END;
    IF Text.Equal(e, "waitAtDeselectTargetPoint") THEN
      NARROW(arg, T).eventDataRec.waitAtDeselectTargetPoint :=
          FormsVBT.GetInteger(fv, "waitAtDeselectTargetPoint");
    END;
    IF Text.Equal(e, "stopAtDrawBar") THEN
      NARROW(arg, T).eventDataRec.stopAtDrawBar :=
          FormsVBT.GetBoolean(fv, "stopAtDrawBar");
    END;
    IF Text.Equal(e, "waitAtDrawBar") THEN
      NARROW(arg, T).eventDataRec.waitAtDrawBar :=
          FormsVBT.GetInteger(fv, "waitAtDrawBar");
    END;
    IF Text.Equal(e, "stopAtRemoveBar") THEN
      NARROW(arg, T).eventDataRec.stopAtRemoveBar :=
          FormsVBT.GetBoolean(fv, "stopAtRemoveBar");
    END;
    IF Text.Equal(e, "waitAtRemoveBar") THEN
      NARROW(arg, T).eventDataRec.waitAtRemoveBar :=
          FormsVBT.GetInteger(fv, "waitAtRemoveBar");
    END;
  END CPDoIt;

PROCEDURE CPRefreshCts (
                <*UNUSED*> fv  : FormsVBT.T;
                <*UNUSED*> e   : TEXT;
                           arg : REFANY;
                <*UNUSED*> t   : VBT.TimeStamp) =
  <* LL = VBT.mu *>
  BEGIN
    NARROW(arg, T).updateEventCounts(FALSE);
  END CPRefreshCts;

PROCEDURE FromFV (fv : FormsVBT.T; alg: T) =
  <* LL = VBT.mu *>
  BEGIN
    alg.stopatCodeEvents :=
        FormsVBT.GetBoolean(fv, "stopatCodeEvents");
    alg.waitatCodeEvents :=
        FormsVBT.GetInteger(fv, "waitatCodeEvents");
    alg.eventDataRec.stopAtSetup :=
        FormsVBT.GetBoolean(fv, "stopAtSetup");
    alg.eventDataRec.waitAtSetup :=
        FormsVBT.GetInteger(fv, "waitAtSetup");
    alg.eventDataRec.stopAtAddPoint :=
        FormsVBT.GetBoolean(fv, "stopAtAddPoint");
    alg.eventDataRec.waitAtAddPoint :=
        FormsVBT.GetInteger(fv, "waitAtAddPoint");
    alg.eventDataRec.stopAtNotProcessed :=
        FormsVBT.GetBoolean(fv, "stopAtNotProcessed");
    alg.eventDataRec.waitAtNotProcessed :=
        FormsVBT.GetInteger(fv, "waitAtNotProcessed");
    alg.eventDataRec.stopAtRemoveNotProcessed :=
        FormsVBT.GetBoolean(fv, "stopAtRemoveNotProcessed");
    alg.eventDataRec.waitAtRemoveNotProcessed :=
        FormsVBT.GetInteger(fv, "waitAtRemoveNotProcessed");
    alg.eventDataRec.stopAtActiveR :=
        FormsVBT.GetBoolean(fv, "stopAtActiveR");
    alg.eventDataRec.waitAtActiveR :=
        FormsVBT.GetInteger(fv, "waitAtActiveR");
    alg.eventDataRec.stopAtRemoveActiveR :=
        FormsVBT.GetBoolean(fv, "stopAtRemoveActiveR");
    alg.eventDataRec.waitAtRemoveActiveR :=
        FormsVBT.GetInteger(fv, "waitAtRemoveActiveR");
    alg.eventDataRec.stopAtCloseR :=
        FormsVBT.GetBoolean(fv, "stopAtCloseR");
    alg.eventDataRec.waitAtCloseR :=
        FormsVBT.GetInteger(fv, "waitAtCloseR");
    alg.eventDataRec.stopAtRemoveCloseR :=
        FormsVBT.GetBoolean(fv, "stopAtRemoveCloseR");
    alg.eventDataRec.waitAtRemoveCloseR :=
        FormsVBT.GetInteger(fv, "waitAtRemoveCloseR");
    alg.eventDataRec.stopAtSplit :=
        FormsVBT.GetBoolean(fv, "stopAtSplit");
    alg.eventDataRec.waitAtSplit :=
        FormsVBT.GetInteger(fv, "waitAtSplit");
    alg.eventDataRec.stopAtSplitRemove :=
        FormsVBT.GetBoolean(fv, "stopAtSplitRemove");
    alg.eventDataRec.waitAtSplitRemove :=
        FormsVBT.GetInteger(fv, "waitAtSplitRemove");
    alg.eventDataRec.stopAtNewMin :=
        FormsVBT.GetBoolean(fv, "stopAtNewMin");
    alg.eventDataRec.waitAtNewMin :=
        FormsVBT.GetInteger(fv, "waitAtNewMin");
    alg.eventDataRec.stopAtNoChangeMin :=
        FormsVBT.GetBoolean(fv, "stopAtNoChangeMin");
    alg.eventDataRec.waitAtNoChangeMin :=
        FormsVBT.GetInteger(fv, "waitAtNoChangeMin");
    alg.eventDataRec.stopAtSelectTrialPoint :=
        FormsVBT.GetBoolean(fv, "stopAtSelectTrialPoint");
    alg.eventDataRec.waitAtSelectTrialPoint :=
        FormsVBT.GetInteger(fv, "waitAtSelectTrialPoint");
    alg.eventDataRec.stopAtDeselectTrialPoint :=
        FormsVBT.GetBoolean(fv, "stopAtDeselectTrialPoint");
    alg.eventDataRec.waitAtDeselectTrialPoint :=
        FormsVBT.GetInteger(fv, "waitAtDeselectTrialPoint");
    alg.eventDataRec.stopAtSelectTargetPoint :=
        FormsVBT.GetBoolean(fv, "stopAtSelectTargetPoint");
    alg.eventDataRec.waitAtSelectTargetPoint :=
        FormsVBT.GetInteger(fv, "waitAtSelectTargetPoint");
    alg.eventDataRec.stopAtDeselectTargetPoint :=
        FormsVBT.GetBoolean(fv, "stopAtDeselectTargetPoint");
    alg.eventDataRec.waitAtDeselectTargetPoint :=
        FormsVBT.GetInteger(fv, "waitAtDeselectTargetPoint");
    alg.eventDataRec.stopAtDrawBar :=
        FormsVBT.GetBoolean(fv, "stopAtDrawBar");
    alg.eventDataRec.waitAtDrawBar :=
        FormsVBT.GetInteger(fv, "waitAtDrawBar");
    alg.eventDataRec.stopAtRemoveBar :=
        FormsVBT.GetBoolean(fv, "stopAtRemoveBar");
    alg.eventDataRec.waitAtRemoveBar :=
        FormsVBT.GetInteger(fv, "waitAtRemoveBar");
  END FromFV;

<*UNUSED*>
PROCEDURE ToFV (fv : FormsVBT.T; alg: T) =
  <* LL = VBT.mu *>
  BEGIN
    FormsVBT.PutBoolean(fv, "stopatCodeEvents", alg.stopatCodeEvents);
    FormsVBT.PutInteger(fv, "waitatCodeEvents", alg.waitatCodeEvents);
    FormsVBT.PutBoolean(fv, "stopAtSetup",
                        alg.eventDataRec.stopAtSetup);
    FormsVBT.PutInteger(fv, "waitAtSetup",
                        alg.eventDataRec.waitAtSetup);
    FormsVBT.PutBoolean(fv, "stopAtAddPoint",
                        alg.eventDataRec.stopAtAddPoint);
    FormsVBT.PutInteger(fv, "waitAtAddPoint",
                        alg.eventDataRec.waitAtAddPoint);
    FormsVBT.PutBoolean(fv, "stopAtNotProcessed",
                        alg.eventDataRec.stopAtNotProcessed);
    FormsVBT.PutInteger(fv, "waitAtNotProcessed",
                        alg.eventDataRec.waitAtNotProcessed);
    FormsVBT.PutBoolean(fv, "stopAtRemoveNotProcessed",
                        alg.eventDataRec.stopAtRemoveNotProcessed);
    FormsVBT.PutInteger(fv, "waitAtRemoveNotProcessed",
                        alg.eventDataRec.waitAtRemoveNotProcessed);
    FormsVBT.PutBoolean(fv, "stopAtActiveR",
                        alg.eventDataRec.stopAtActiveR);
    FormsVBT.PutInteger(fv, "waitAtActiveR",
                        alg.eventDataRec.waitAtActiveR);
    FormsVBT.PutBoolean(fv, "stopAtRemoveActiveR",
                        alg.eventDataRec.stopAtRemoveActiveR);
    FormsVBT.PutInteger(fv, "waitAtRemoveActiveR",
                        alg.eventDataRec.waitAtRemoveActiveR);
    FormsVBT.PutBoolean(fv, "stopAtCloseR",
                        alg.eventDataRec.stopAtCloseR);
    FormsVBT.PutInteger(fv, "waitAtCloseR",
                        alg.eventDataRec.waitAtCloseR);
    FormsVBT.PutBoolean(fv, "stopAtRemoveCloseR",
                        alg.eventDataRec.stopAtRemoveCloseR);
    FormsVBT.PutInteger(fv, "waitAtRemoveCloseR",
                        alg.eventDataRec.waitAtRemoveCloseR);
    FormsVBT.PutBoolean(fv, "stopAtSplit",
                        alg.eventDataRec.stopAtSplit);
    FormsVBT.PutInteger(fv, "waitAtSplit",
                        alg.eventDataRec.waitAtSplit);
    FormsVBT.PutBoolean(fv, "stopAtSplitRemove",
                        alg.eventDataRec.stopAtSplitRemove);
    FormsVBT.PutInteger(fv, "waitAtSplitRemove",
                        alg.eventDataRec.waitAtSplitRemove);
    FormsVBT.PutBoolean(fv, "stopAtNewMin",
                        alg.eventDataRec.stopAtNewMin);
    FormsVBT.PutInteger(fv, "waitAtNewMin",
                        alg.eventDataRec.waitAtNewMin);
    FormsVBT.PutBoolean(fv, "stopAtNoChangeMin",
                        alg.eventDataRec.stopAtNoChangeMin);
    FormsVBT.PutInteger(fv, "waitAtNoChangeMin",
                        alg.eventDataRec.waitAtNoChangeMin);
    FormsVBT.PutBoolean(fv, "stopAtSelectTrialPoint",
                        alg.eventDataRec.stopAtSelectTrialPoint);
    FormsVBT.PutInteger(fv, "waitAtSelectTrialPoint",
                        alg.eventDataRec.waitAtSelectTrialPoint);
    FormsVBT.PutBoolean(fv, "stopAtDeselectTrialPoint",
                        alg.eventDataRec.stopAtDeselectTrialPoint);
    FormsVBT.PutInteger(fv, "waitAtDeselectTrialPoint",
                        alg.eventDataRec.waitAtDeselectTrialPoint);
    FormsVBT.PutBoolean(fv, "stopAtSelectTargetPoint",
                        alg.eventDataRec.stopAtSelectTargetPoint);
    FormsVBT.PutInteger(fv, "waitAtSelectTargetPoint",
                        alg.eventDataRec.waitAtSelectTargetPoint);
    FormsVBT.PutBoolean(fv, "stopAtDeselectTargetPoint",
                        alg.eventDataRec.stopAtDeselectTargetPoint);
    FormsVBT.PutInteger(fv, "waitAtDeselectTargetPoint",
                        alg.eventDataRec.waitAtDeselectTargetPoint);
    FormsVBT.PutBoolean(fv, "stopAtDrawBar",
                        alg.eventDataRec.stopAtDrawBar);
    FormsVBT.PutInteger(fv, "waitAtDrawBar",
                        alg.eventDataRec.waitAtDrawBar);
    FormsVBT.PutBoolean(fv, "stopAtRemoveBar",
                        alg.eventDataRec.stopAtRemoveBar);
    FormsVBT.PutInteger(fv, "waitAtRemoveBar",
                        alg.eventDataRec.waitAtRemoveBar);
    CountsToFV (fv, alg);
  END ToFV;

PROCEDURE CountsToFV (fv : FormsVBT.T; alg: T) =
  <* LL = VBT.mu *>
  BEGIN
    FormsVBT.PutText(fv, "ctOfSetup",
                        Fmt.Int(alg.eventDataRec.ctOfSetup));
    FormsVBT.PutText(fv, "ctOfAddPoint",
                        Fmt.Int(alg.eventDataRec.ctOfAddPoint));
    FormsVBT.PutText(fv, "ctOfNotProcessed",
                        Fmt.Int(alg.eventDataRec.ctOfNotProcessed));
    FormsVBT.PutText(fv, "ctOfRemoveNotProcessed",
                        Fmt.Int(alg.eventDataRec.ctOfRemoveNotProcessed));
    FormsVBT.PutText(fv, "ctOfActiveR",
                        Fmt.Int(alg.eventDataRec.ctOfActiveR));
    FormsVBT.PutText(fv, "ctOfRemoveActiveR",
                        Fmt.Int(alg.eventDataRec.ctOfRemoveActiveR));
    FormsVBT.PutText(fv, "ctOfCloseR",
                        Fmt.Int(alg.eventDataRec.ctOfCloseR));
    FormsVBT.PutText(fv, "ctOfRemoveCloseR",
                        Fmt.Int(alg.eventDataRec.ctOfRemoveCloseR));
    FormsVBT.PutText(fv, "ctOfSplit",
                        Fmt.Int(alg.eventDataRec.ctOfSplit));
    FormsVBT.PutText(fv, "ctOfSplitRemove",
                        Fmt.Int(alg.eventDataRec.ctOfSplitRemove));
    FormsVBT.PutText(fv, "ctOfNewMin",
                        Fmt.Int(alg.eventDataRec.ctOfNewMin));
    FormsVBT.PutText(fv, "ctOfNoChangeMin",
                        Fmt.Int(alg.eventDataRec.ctOfNoChangeMin));
    FormsVBT.PutText(fv, "ctOfSelectTrialPoint",
                        Fmt.Int(alg.eventDataRec.ctOfSelectTrialPoint));
    FormsVBT.PutText(fv, "ctOfDeselectTrialPoint",
                        Fmt.Int(alg.eventDataRec.ctOfDeselectTrialPoint));
    FormsVBT.PutText(fv, "ctOfSelectTargetPoint",
                        Fmt.Int(alg.eventDataRec.ctOfSelectTargetPoint));
    FormsVBT.PutText(fv, "ctOfDeselectTargetPoint",
                        Fmt.Int(alg.eventDataRec.ctOfDeselectTargetPoint));
    FormsVBT.PutText(fv, "ctOfDrawBar",
                        Fmt.Int(alg.eventDataRec.ctOfDrawBar));
    FormsVBT.PutText(fv, "ctOfRemoveBar",
                        Fmt.Int(alg.eventDataRec.ctOfRemoveBar));
  END CountsToFV;

PROCEDURE CPDefaultUpdateCts ( v: T; reset: BOOLEAN) =
  <* LL = VBT.mu *>
  BEGIN
    IF reset THEN
      v.eventDataRec.ctOfSetup := 0;
      v.eventDataRec.ctOfAddPoint := 0;
      v.eventDataRec.ctOfNotProcessed := 0;
      v.eventDataRec.ctOfRemoveNotProcessed := 0;
      v.eventDataRec.ctOfActiveR := 0;
      v.eventDataRec.ctOfRemoveActiveR := 0;
      v.eventDataRec.ctOfCloseR := 0;
      v.eventDataRec.ctOfRemoveCloseR := 0;
      v.eventDataRec.ctOfSplit := 0;
      v.eventDataRec.ctOfSplitRemove := 0;
      v.eventDataRec.ctOfNewMin := 0;
      v.eventDataRec.ctOfNoChangeMin := 0;
      v.eventDataRec.ctOfSelectTrialPoint := 0;
      v.eventDataRec.ctOfDeselectTrialPoint := 0;
      v.eventDataRec.ctOfSelectTargetPoint := 0;
      v.eventDataRec.ctOfDeselectTargetPoint := 0;
      v.eventDataRec.ctOfDrawBar := 0;
      v.eventDataRec.ctOfRemoveBar := 0;
    END;
    CountsToFV (v.eventData, v);
  END CPDefaultUpdateCts;

PROCEDURE CPDefaultSnapshot (v: T; wr: Wr.T)
  RAISES {ZeusClass.Error} =
  <* LL = VBT.mu *>
  BEGIN
    TRY
      Wr.PutChar(wr, '(')
    EXCEPT
    ELSE
      RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultSnapshot write error");
    END;
    IF v.eventData = NIL THEN
      RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultSnapshot: " &
          "eventData not set!");
    END;
    TRY
      v.eventData.snapshot(wr)
    EXCEPT
      FormsVBT.Error (msg) =>
        RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultSnapshot FV error: "
          & msg);
    ELSE
      RAISE ZeusClass.Error(
        "CPAlgClass.CPDefaultSnapshot error");
    END;
    Algorithm.T.snapshot(v, wr);
    TRY
      Wr.PutChar(wr, ')')
    EXCEPT
    ELSE
      RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultSnapshot write error");
    END;
  END CPDefaultSnapshot;

PROCEDURE CPDefaultRestore (v: T; rd: Rd.T)
  RAISES {ZeusClass.Error} =
  <* LL = VBT.mu *>
  BEGIN
    IF rd = NIL THEN RETURN END;
    IF NOT ZeusUtil.EatChar(rd, '(') THEN
      RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultRestore read error");
    END;
    IF v.eventData = NIL THEN
      RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultRestore: " &
          "eventData not set!");
    END;
    TRY
      v.eventData.restore(rd);
      v.updateEventCounts(FALSE);
      FromFV(v.eventData, v);
    EXCEPT
    ELSE
      RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultRestore error");
    END;
    Algorithm.T.restore(v, rd);
    IF NOT ZeusUtil.EatChar(rd, ')') THEN
      RAISE ZeusClass.Error(
          "CPAlgClass.CPDefaultRestore read error");
    END;
  END CPDefaultRestore;

BEGIN
END CPAlgClass.