MODULE; <* PRAGMA LL *> IMPORT Algorithm, AlgorithmClass, CodeView, Rd, Thread, VBT, View, ViewClass, Wr, Zeus, ZeusClass; REVEAL View.T <: ViewClass.TT; REVEAL T = Public BRANDED OBJECT tc: CARDINAL; OVERRIDES isCompat := IsCompat; startrun := Startrun; END; PROCEDURE ZeusCodeView IsCompat (v: T; alg: ZeusClass.T): BOOLEAN = <* LL = arbitrary *> BEGIN RETURN v.tc = TYPECODE(alg) END IsCompat; PROCEDUREStartrun (v: T) = <* LL = {} *> BEGIN LOCK VBT.mu DO v.cv.exitAll () END; View.T.startrun (v); END Startrun; PROCEDURENew (name : TEXT; source : Rd.T; alg : Algorithm.T; errorWr: Wr.T := NIL; READONLY 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. The alg argument is the algorithm for which this is a code view. *) VAR v := NEW(T, name := name, cv := CodeView.New(source, errorWr, fontName, paneOffset, background), tc := TYPECODE(alg)); BEGIN RETURN v.init(v.cv); END New; PROCEDUREEnter (alg: Algorithm.T; procedureName: TEXT; pauseTime := -1) RAISES {Thread.Alerted} = <* LL = {} *> BEGIN Event (alg, 0, pauseTime, procedureName); END Enter; PROCEDUREExit (alg: Algorithm.T; pauseTime := -1) RAISES {Thread.Alerted} = <* LL = {} *> BEGIN Event (alg, -1, pauseTime, NIL); END Exit; PROCEDUREAt (alg: Algorithm.T; highlight := 0; pauseTime := -1) RAISES {Thread.Alerted} = <* LL = {} *> BEGIN Event (alg, highlight, pauseTime, NIL); END At; PROCEDUREEvent (initiator : Algorithm.T; highlight := 0; pauseTime := -1; procedureName: TEXT := NIL ) RAISES {Thread.Alerted} = <* LL = {} *> <* FATAL Zeus.Error, Zeus.Locked *> (* 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.