mentor/derived/ParseIE.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 Parse.evt.
      ********************************************************************


<* PRAGMA LL *>

MODULE ParseIE;

<*NOWARN*> IMPORT ParseViewClass, ZeusClass, Zeus, Algorithm;
<*NOWARN*> IMPORT Parse, View, Thread, AlgorithmClass;
<*NOWARN*> IMPORT ParseAlgClass;

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

TYPE
  SetupArgs = BRANDED REF RECORD
    s: Parse.State;
  END;

  PushArgs = BRANDED REF RECORD
    id: INTEGER;
    tag: TEXT;
  END;

  PopArgs = BRANDED REF RECORD
    id: INTEGER;
  END;

  ScanArgs = BRANDED REF RECORD
    token: TEXT;
  END;

  NoteErrorArgs = BRANDED REF RECORD
  END;

  GotoArgs = BRANDED REF RECORD
    state: INTEGER;
  END;

  NewNodeArgs = BRANDED REF RECORD
    id: INTEGER;
    op: TEXT;
  END;

  NewTermArgs = BRANDED REF RECORD
    id: INTEGER;
    op: TEXT;
  END;

  NewEdgeArgs = BRANDED REF RECORD
    child: INTEGER;
    parent: INTEGER;
  END;

  DeleteLeafArgs = BRANDED REF RECORD
    id: INTEGER;
  END;

  UpdateDoneArgs = BRANDED REF RECORD
  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
    | ParseViewClass.T (view) => <*NOWARN*>
      TYPECASE evt OF
      | SetupArgs(varSetupArgs) => <*NOWARN*>
          view.oeSetup (
              varSetupArgs.s
              )
      | PushArgs(varPushArgs) => <*NOWARN*>
          view.oePush (
              varPushArgs.id
                ,
              varPushArgs.tag
              )
      | PopArgs(varPopArgs) => <*NOWARN*>
          view.oePop (
              varPopArgs.id
              )
      | ScanArgs(varScanArgs) => <*NOWARN*>
          view.oeScan (
              varScanArgs.token
              )
      | NoteErrorArgs(varNoteErrorArgs) => <*NOWARN*>
          view.oeNoteError (
              )
      | GotoArgs(varGotoArgs) => <*NOWARN*>
          view.oeGoto (
              varGotoArgs.state
              )
      | NewNodeArgs(varNewNodeArgs) => <*NOWARN*>
          view.oeNewNode (
              varNewNodeArgs.id
                ,
              varNewNodeArgs.op
              )
      | NewTermArgs(varNewTermArgs) => <*NOWARN*>
          view.oeNewTerm (
              varNewTermArgs.id
                ,
              varNewTermArgs.op
              )
      | NewEdgeArgs(varNewEdgeArgs) => <*NOWARN*>
          view.oeNewEdge (
              varNewEdgeArgs.child
                ,
              varNewEdgeArgs.parent
              )
      | DeleteLeafArgs(varDeleteLeafArgs) => <*NOWARN*>
          view.oeDeleteLeaf (
              varDeleteLeafArgs.id
              )
      | UpdateDoneArgs(varUpdateDoneArgs) => <*NOWARN*>
          view.oeUpdateDone (
              )
      ELSE <* ASSERT FALSE *>
      END;
    ELSE (* this view isn't a ParseViewClass, so just ignore *)
    END
  END OEDispatcher;

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

PROCEDURE Setup (
      initiator: Algorithm.T;
       s: Parse.State
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(SetupArgs
               , s := s
      );
      alg := NARROW(initiator, ParseAlgClass.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 Push (
      initiator: Algorithm.T;
       id: INTEGER; tag: TEXT
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(PushArgs
               , id := id
               , tag := tag
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfPush);
      alg.stopAtEvent := alg.eventDataRec.stopAtPush;
      alg.waitAtEvent := alg.eventDataRec.waitAtPush;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Push", OEDispatcher, zumeArgRec);
    END;
  END Push;

PROCEDURE Pop (
      initiator: Algorithm.T;
       id: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(PopArgs
               , id := id
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfPop);
      alg.stopAtEvent := alg.eventDataRec.stopAtPop;
      alg.waitAtEvent := alg.eventDataRec.waitAtPop;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Pop", OEDispatcher, zumeArgRec);
    END;
  END Pop;

PROCEDURE Scan (
      initiator: Algorithm.T;
       token: TEXT
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(ScanArgs
               , token := token
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfScan);
      alg.stopAtEvent := alg.eventDataRec.stopAtScan;
      alg.waitAtEvent := alg.eventDataRec.waitAtScan;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Scan", OEDispatcher, zumeArgRec);
    END;
  END Scan;

PROCEDURE NoteError (
      initiator: Algorithm.T;

    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(NoteErrorArgs
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfNoteError);
      alg.stopAtEvent := alg.eventDataRec.stopAtNoteError;
      alg.waitAtEvent := alg.eventDataRec.waitAtNoteError;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "NoteError", OEDispatcher, zumeArgRec);
    END;
  END NoteError;

PROCEDURE Goto (
      initiator: Algorithm.T;
       state: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(GotoArgs
               , state := state
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfGoto);
      alg.stopAtEvent := alg.eventDataRec.stopAtGoto;
      alg.waitAtEvent := alg.eventDataRec.waitAtGoto;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "Goto", OEDispatcher, zumeArgRec);
    END;
  END Goto;

PROCEDURE NewNode (
      initiator: Algorithm.T;
       id: INTEGER; op: TEXT
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(NewNodeArgs
               , id := id
               , op := op
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfNewNode);
      alg.stopAtEvent := alg.eventDataRec.stopAtNewNode;
      alg.waitAtEvent := alg.eventDataRec.waitAtNewNode;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "NewNode", OEDispatcher, zumeArgRec);
    END;
  END NewNode;

PROCEDURE NewTerm (
      initiator: Algorithm.T;
       id: INTEGER; op: TEXT
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(NewTermArgs
               , id := id
               , op := op
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfNewTerm);
      alg.stopAtEvent := alg.eventDataRec.stopAtNewTerm;
      alg.waitAtEvent := alg.eventDataRec.waitAtNewTerm;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "NewTerm", OEDispatcher, zumeArgRec);
    END;
  END NewTerm;

PROCEDURE NewEdge (
      initiator: Algorithm.T;
       child, parent: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(NewEdgeArgs
               , child := child
               , parent := parent
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfNewEdge);
      alg.stopAtEvent := alg.eventDataRec.stopAtNewEdge;
      alg.waitAtEvent := alg.eventDataRec.waitAtNewEdge;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "NewEdge", OEDispatcher, zumeArgRec);
    END;
  END NewEdge;

PROCEDURE DeleteLeaf (
      initiator: Algorithm.T;
       id: INTEGER
    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(DeleteLeafArgs
               , id := id
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfDeleteLeaf);
      alg.stopAtEvent := alg.eventDataRec.stopAtDeleteLeaf;
      alg.waitAtEvent := alg.eventDataRec.waitAtDeleteLeaf;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "DeleteLeaf", OEDispatcher, zumeArgRec);
    END;
  END DeleteLeaf;

PROCEDURE UpdateDone (
      initiator: Algorithm.T;

    ) RAISES {Thread.Alerted} =
  <* LL = {} *>
  VAR zumeArgRec := NEW(UpdateDoneArgs
      );
      alg := NARROW(initiator, ParseAlgClass.T);
  BEGIN
    LOCK alg.evtMu DO
      INC(alg.eventDataRec.ctOfUpdateDone);
      alg.stopAtEvent := alg.eventDataRec.stopAtUpdateDone;
      alg.waitAtEvent := alg.eventDataRec.waitAtUpdateDone;
      Zeus.Dispatch(initiator, Zeus.EventStyle.Output, 1,
                    "UpdateDone", OEDispatcher, zumeArgRec);
    END;
  END UpdateDone;

BEGIN
END ParseIE.

interface Parse is in:


interface View is in: