(* Copyright 1992 Digital Equipment Corporation. *) (* Distributed only by permission. *) (* Last modified on Wed Sep 23 13:31:20 PDT 1992 by mhb *) (* modified on Wed Aug 19 17:25:06 PDT 1992 by sclafani *) (* modified on Tue Jul 28 23:36:52 PDT 1992 by johnh *) MODULE ZeusCodeView; <* PRAGMA LL *> IMPORT Algorithm, AlgorithmClass, CodeView, Rd, Thread, VBT, View, ViewClass, Wr, Zeus; REVEAL View.T <: ViewClass.T; REVEAL T = Public BRANDED OBJECT OVERRIDES startrun := Startrun; END; PROCEDURE Startrun (v: T) = <* LL = {} *> BEGIN LOCK VBT.mu DO v.cv.exitAll () END; View.T.startrun (v); END Startrun; PROCEDURE New (name : TEXT; source : Rd.T; errorWr : Wr.T := NIL; fontName := CodeView.DefaultFont; paneOffset: CARDINAL := 20; background: VBT.T := NIL ): T = <* LL = VBT.mu *> (* Creates and returns an initialized T with the given name, using CodeView.New with the trailing arguments to create the cv field. *) VAR v := NEW (T, name := name, cv := CodeView.New (source, errorWr, fontName, paneOffset, background)); BEGIN RETURN v.init (v.cv); END New; PROCEDURE Enter (alg: Algorithm.T; procedureName: TEXT; pauseTime := -1) RAISES {Thread.Alerted} = <* LL = {} *> BEGIN Event (alg, 0, pauseTime, procedureName); END Enter; PROCEDURE Exit (alg: Algorithm.T; pauseTime := -1) RAISES {Thread.Alerted} = <* LL = {} *> BEGIN Event (alg, -1, pauseTime, NIL); END Exit; PROCEDURE At (alg: Algorithm.T; highlight := 0; pauseTime := -1) RAISES {Thread.Alerted} = <* LL = {} *> BEGIN Event (alg, highlight, pauseTime, NIL); END At; PROCEDURE Event (initiator : Algorithm.T; highlight := 0; pauseTime := -1; procedureName: TEXT := NIL ) RAISES {Thread.Alerted} = <* LL = {} *> (* Call this to create a code view event for alg "initiator". *) VAR r := NEW (Arg, highlight := highlight, pauseTime := pauseTime, procedureName := procedureName); BEGIN initiator.stopAtEvent := initiator.stopatCodeEvents; initiator.waitAtEvent := initiator.waitatCodeEvents; (* Arguably, waitAtEvent should always be 0, and panel.delayTime should control the pause. *) IF initiator.waitAtEvent = 0 THEN r.pauseTime := 0 END; Zeus.Dispatch (initiator, Zeus.EventStyle.Code, 1, "CodeView", NIL, r); END Event; BEGIN END ZeusCodeView.