mentor/derived/HullTranscriptView.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:56:02 PST 1995 by kalsow  
      modified on Mon Jun  6 03:18:55 PDT 1994 by mhb   
      modified on Tue Feb 16 16:31:40 PST 1993 by johnh 

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

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


<* PRAGMA LL *>

MODULE HullTranscriptView;

<*NOWARN*> IMPORT HullFmt, TextPort, Rd, IntList, ZeusClass;
<*NOWARN*> IMPORT Filter, TextEditVBT, Fmt, SiteList, ZFmt, Wr;
<*NOWARN*> IMPORT ZeusPanel, FormsVBT, HullViewClass, VBT, View;

<* FATAL FormsVBT.Error, FormsVBT.Unimplemented *>

REVEAL
  T = Public BRANDED OBJECT
    fv: FormsVBT.T := NIL;
    te: TextEditVBT.T := NIL;
  OVERRIDES
    init       := TViewInit;
    install    := TViewInstall;
    delete     := TViewDelete;
    snapshot   := TViewSnapshot;
    restore    := TViewRestore;
    config     := TViewConfig;
    reactivity := TViewReactivity;
    startrun   := TViewStartrun;
    endrun     := TViewEndrun;
    oeSetup := Setup;
    oeSetHalfPlane := SetHalfPlane;
    oeClearHead := ClearHead;
    oeTestSite := TestSite;
    oeClearTest := ClearTest;
    oeSetTail := SetTail;
    oeClearTail := ClearTail;
    oeMoveHalfPlane := MoveHalfPlane;
    oeConfirm := Confirm;
    oeDeny := Deny;
    oeSwap := Swap;
    oeSentinel := Sentinel;
    oeReOrder := ReOrder;
    oeStretch := Stretch;
    oeSnap := Snap;
    oeShuffle := Shuffle;
  END;

PROCEDURE TViewInit (view: T): T =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "init");
    RETURN HullViewClass.T.init (view, NIL);
  END TViewInit;

PROCEDURE Clear (<* UNUSED *> fv  : FormsVBT.T;
                 <* UNUSED *> name: TEXT;
                              cl  : REFANY;
                 <* UNUSED *> time: VBT.TimeStamp) =
  BEGIN
    TextPort.SetText(NARROW(cl, T).te.tp, "")
  END Clear;

PROCEDURE TViewInstall (view: T) =
  <* LL = VBT.mu *>
  BEGIN
    view.fv := ZeusPanel.NewForm("HullTranscriptView.fv");
    view.te := FormsVBT.GetVBT(view.fv, "transcript");
    TViewZTrace (view, "install");
    FormsVBT.AttachProc(view.fv, "clear", Clear, view);
    EVAL Filter.Replace (view, view.fv);
    HullViewClass.T.install (view);
  END TViewInstall;

PROCEDURE TViewDelete (view: T) =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "delete");
    HullViewClass.T.delete (view);
   END TViewDelete;

PROCEDURE TViewSnapshot (view: T; wr: Wr.T) RAISES {ZeusClass.Error} =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "snapshot");
    HullViewClass.T.snapshot (view, wr);
   END TViewSnapshot;

PROCEDURE TViewRestore (view: T; rd: Rd.T) RAISES {ZeusClass.Error} =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "restore");
    HullViewClass.T.restore (view, rd);
   END TViewRestore;

PROCEDURE TViewConfig (
    view: T;
    state: ZeusClass.StateChange;
    o: ZeusClass.T) =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace (view, "config");
    HullViewClass.T.config (view, state, o);
   END TViewConfig;

PROCEDURE TViewReactivity (view: T; <*UNUSED*> on: BOOLEAN) =
  <* LL = VBT.mu *>
  BEGIN
    TViewZTrace(view, "reactivity");
    HullViewClass.T.reactivity (view, TRUE);
  END TViewReactivity;

PROCEDURE TViewStartrun (view: T) =
  <* LL = {} *>
  BEGIN
    TViewZTrace (view, "startrun");
    HullViewClass.T.startrun (view);
   END TViewStartrun;

PROCEDURE TViewEndrun (view: T) =
  <* LL = {} *>
  BEGIN
    TViewZTrace (view, "endrun");
    HullViewClass.T.endrun (view);
  END TViewEndrun;
event handling methods:

PROCEDURE Setup (view: T;  trueSites, auxSites: SiteList.T) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Setup ...")
       ELSE
          TViewTrace (view, "Setup "
          & HullFmt.SiteList(trueSites)
          & " "
          & HullFmt.SiteList(auxSites)
          )
       END
    END
    END
  END Setup;

PROCEDURE SetHalfPlane (view: T;  tail, head: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "SetHalfPlane ...")
       ELSE
          TViewTrace (view, "SetHalfPlane "
          & Fmt.Int(tail)
          & " "
          & Fmt.Int(head)
          )
       END
    END
    END
  END SetHalfPlane;

PROCEDURE ClearHead (view: T;  ) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "ClearHead ...")
       ELSE
          TViewTrace (view, "ClearHead "
          )
       END
    END
    END
  END ClearHead;

PROCEDURE TestSite (view: T;  i: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "TestSite ...")
       ELSE
          TViewTrace (view, "TestSite "
          & Fmt.Int(i)
          )
       END
    END
    END
  END TestSite;

PROCEDURE ClearTest (view: T;  ) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "ClearTest ...")
       ELSE
          TViewTrace (view, "ClearTest "
          )
       END
    END
    END
  END ClearTest;

PROCEDURE SetTail (view: T;  i: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "SetTail ...")
       ELSE
          TViewTrace (view, "SetTail "
          & Fmt.Int(i)
          )
       END
    END
    END
  END SetTail;

PROCEDURE ClearTail (view: T;  ) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "ClearTail ...")
       ELSE
          TViewTrace (view, "ClearTail "
          )
       END
    END
    END
  END ClearTail;

PROCEDURE MoveHalfPlane (view: T;  tail, head: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "MoveHalfPlane ...")
       ELSE
          TViewTrace (view, "MoveHalfPlane "
          & Fmt.Int(tail)
          & " "
          & Fmt.Int(head)
          )
       END
    END
    END
  END MoveHalfPlane;

PROCEDURE Confirm (view: T;  tail, head: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Confirm ...")
       ELSE
          TViewTrace (view, "Confirm "
          & Fmt.Int(tail)
          & " "
          & Fmt.Int(head)
          )
       END
    END
    END
  END Confirm;

PROCEDURE Deny (view: T;  tail, head: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Deny ...")
       ELSE
          TViewTrace (view, "Deny "
          & Fmt.Int(tail)
          & " "
          & Fmt.Int(head)
          )
       END
    END
    END
  END Deny;

PROCEDURE Swap (view: T;  i, j: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Swap ...")
       ELSE
          TViewTrace (view, "Swap "
          & Fmt.Int(i)
          & " "
          & Fmt.Int(j)
          )
       END
    END
    END
  END Swap;

PROCEDURE Sentinel (view: T;  i, j: INTEGER) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Sentinel ...")
       ELSE
          TViewTrace (view, "Sentinel "
          & Fmt.Int(i)
          & " "
          & Fmt.Int(j)
          )
       END
    END
    END
  END Sentinel;

PROCEDURE ReOrder (view: T;  l: IntList.T) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "ReOrder ...")
       ELSE
          TViewTrace (view, "ReOrder "
          & HullFmt.IntList(l)
          )
       END
    END
    END
  END ReOrder;

PROCEDURE Stretch (view: T;  hullSites, otherSites: IntList.T) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Stretch ...")
       ELSE
          TViewTrace (view, "Stretch "
          & HullFmt.IntList(hullSites)
          & " "
          & HullFmt.IntList(otherSites)
          )
       END
    END
    END
  END Stretch;

PROCEDURE Snap (view: T;  hullSites, otherSites: IntList.T) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Snap ...")
       ELSE
          TViewTrace (view, "Snap "
          & HullFmt.IntList(hullSites)
          & " "
          & HullFmt.IntList(otherSites)
          )
       END
    END
    END
  END Snap;

PROCEDURE Shuffle (view: T;  hullSites, otherSites: IntList.T) =
  <* LL = {} *>
  BEGIN
    LOCK VBT.mu DO
    IF FormsVBT.GetBoolean(view.fv, "alg") THEN
       IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN
          TViewTrace (view, "Shuffle ...")
       ELSE
          TViewTrace (view, "Shuffle "
          & HullFmt.IntList(hullSites)
          & " "
          & HullFmt.IntList(otherSites)
          )
       END
    END
    END
  END Shuffle;

PROCEDURE TViewZTrace (view: T; t: TEXT) =
  BEGIN
    IF view.fv # NIL THEN
      IF FormsVBT.GetBoolean(view.fv, "zeus") THEN
        TextPort.PutText(view.te.tp, "**zeus:  " & t & "\n");
        TextPort.Normalize(view.te.tp, LAST(INTEGER))
      END
    END
  END TViewZTrace;

PROCEDURE TViewTrace (view: T; t: TEXT) =
  BEGIN
    TextPort.PutText(view.te.tp, "--event: " & t & "\n");
    TextPort.Normalize(view.te.tp, LAST(INTEGER))
  END TViewTrace;

PROCEDURE TViewNew (): View.T =
  BEGIN
    RETURN NEW(T).init()
  END TViewNew;

BEGIN
  ZeusPanel.RegisterView
      (TViewNew, "Hull Transcript View", "Hull");
END HullTranscriptView.

interface View is in: