ðjSyntax10.Scn.Fnt |ÿÿÿp°­VersionElemsAllocBeg#Syntax10.Scn.FntWindows PowerMacWindowsWindows PowerMac$Syntax10m.Scn.Fnt (*PowerMac*)Syntax10m.Scn.Fnt p°­VersionElemsAllocEnd õÿÿÿpdðIStampElemsAlloc14 Dec 98ÐÃþÿÿ€8ÀÔFoldElemsNewCSyntax10.Scn.Fnt¦Syntax10b.Scn.FntQû VAR beg, end, delta: LONGINT; BEGIN delta := 200; LOOP beg := F.org; end := TextFrames.Pos(F, F.X + F.W, F.Y); IF (beg <= pos) & (pos < end) OR (delta = 0) THEN EXIT END ; TextFrames.Show(F, pos - delta); delta := delta DIV 2 END END ShowPos; ÿÿÿÿ€8ÀÔX¯þÿÿ€8ÀÔ#Syntax10.Scn.Fnt// VAR V: MenuViewers.Viewer; F, M: TextFrames.Frame; x, y: INTEGER; BEGIN F := TextFrames.NewText(T, org); Oberon.AllocateUserViewer(Oberon.Mouse.X, x, y); M := TextFrames.NewMenu(name, "^Edit.Menu.Text"); V := MenuViewers.New(M, F, TextFrames.menuH, x, y); ShowPos(F, org); RETURN F END NewView; ÿÿÿÿ€8ÀÔA­ýÿÿ€8ÀÔ#Syntax10.Scn.Fnt11 VAR x: INTEGER; v: Viewers.Viewer; menu: Texts.Text; S: Texts.Scanner; BEGIN x := 0; WHILE x < Display.Width DO v := Viewers.This(x, 0); WHILE v.state > 1 DO IF (v IS MenuViewers.Viewer) & (v.dsc IS TextFrames.Frame) THEN (* check for trap viewer *) menu := v.dsc(TextFrames.Frame).text; IF menu.len > 0 THEN Texts.OpenScanner(S, menu, 0); Texts.Scan(S); IF S.s = name THEN RETURN v.dsc.next(TextFrames.Frame) END END END; v := Viewers.Next(v) END; x := x + v.W END; RETURN NIL END GetFrameByName; ÿÿÿÿ€8ÀÔ8ƒÿÿÿ€8ÀÔ#Syntax10.Scn.Fnt[[ BEGIN Oberon.PassFocus(Viewers.This(F.X, F.Y)); TextFrames.SetCaret(F, pos) END SetCaret; ÿÿÿÿ€8ÀÔ@güÿÿ€8ÀÔ#Syntax10.Scn.Fntww VAR text: Texts.Text; oldNotifier: Texts.Notifier; r: Texts.Reader; fold, twin: FoldElems.Elem; pos: LONGINT; BEGIN text := f.text; oldNotifier := text.notify; text.notify := NIL; FoldElems.ExpandAll(text, 0, TRUE); Texts.OpenReader (r, text, thePos); Texts.ReadPrevElem (r); WHILE r.elem # NIL DO IF r.elem IS FoldElems.Elem THEN fold := r.elem(FoldElems.Elem); twin := FoldElems.Twin(fold); IF fold.mode = FoldElems.tempLeft THEN IF Texts.ElemPos(twin) < thePos THEN pos := Texts.ElemPos(twin); FoldElems.Switch (twin); DEC(thePos, pos - Texts.ElemPos(twin)) ELSE fold.mode := FoldElems.expLeft END END END ; Texts.ReadPrevElem (r) END; FoldElems.CollapseAll(text, {FoldElems.tempLeft}); text.notify := oldNotifier; text.notify(text, Texts.replace, 0, text.len); ShowPos (f, thePos); SetCaret(f, thePos) END InternalLocate; ÿÿÿÿ€8ÀÔ6_þÿÿ€8ÀÔ#Syntax10.Scn.Fnt VAR R: Texts.Reader; m: Modules.Module; type, dynType: Types.Type; BEGIN m := Modules.ThisMod("Folds"); type := Types.This(m, "ErrElemDesc"); Texts.OpenReader(R, t, pos); Texts.ReadElem(R); IF ~R.eot & (R.elem # NIL) & (Texts.ElemPos(R.elem) = pos) THEN dynType := Types.TypeOf (R.elem); IF dynType = type THEN Texts.Delete(t, pos, pos+1) END END END RemoveErrElem; ÿÿÿÿ€8ÀÔ Syntax10b.Scn.Fntÿÿÿÿ€8ÀÔˆïýÿÿp°­#Syntax10.Scn.FntWindows PowerMacWindowsWindows PowerMacƒSyntax10.Scn.Fntáþÿÿ€8ÀÔFoldElemsNew#Syntax10.Scn.Fntýý REPEAT Texts.Scan(S); IF S.class = Texts.Name THEN beg := Texts.Pos(S); COPY(S.s, mod); Texts.Scan(S); end := Texts.Pos(S); IF S.class = Texts.Int THEN INC(intDepth) END END UNTIL (S.eot) OR (intDepth > depth);Syntax10i.Scn.Fnt8ÿÿÿÿ€8ÀÔ:search the correct position in the trap viewer -PowerMac<þÿÿ€8ÀÔCSyntax10.Scn.Fnt^Syntax10i.Scn.Fnt‚ REPEAT Texts.Scan(S); IF (S.class = Texts.Name) & (S.s # "Rel.") & (S.s # "$") THEN (* procedure name *) COPY(S.s, mod) ELSE IF (S.class = Texts.Name) & (S.s = "Rel.") THEN INC(intDepth); END END UNTIL (S.eot) OR ((S.class = Texts.Name) & (S.s = "Rel.") & (intDepth > depth)); Texts.Scan(S); beg := Texts.Pos(S);Texts.Scan(S);end := Texts.Pos(S); Syntax10i.Scn.Fnt8ÿÿÿÿ€8ÀÔp°­³þÿÿ€8ÀÔ#Syntax10.Scn.Fnt++Strings.Delete(mod, Strings.Pos(".", mod, 0), Strings.Length(mod)); Strings.Append(".Mod", mod); source := GetFrameByName(mod); IF source = NIL THEN T := TextFrames.Text(mod); source := NewView(mod, T, 0); END; x := source.X + (source.W DIV 2); y := source.Y + (source.H DIV 2); ÿÿÿÿ€8ÀÔiÿÿÿ€8ÀÔ#Syntax10.Scn.FntuuShowPos(v.dsc.next(TextFrames.Frame), beg+1); TextFrames.SetSelection(v.dsc.next(TextFrames.Frame), beg+1, end-1); /ÿÿÿÿ€8ÀÔëþÿÿ€8ÀÔCSyntax10.Scn.Fnt³Syntax10i.Scn.FntÓT := TextFrames.Text(""); Texts.WriteString(w, " * \f"); Texts.Append(T, w.buf); par.text := T; par.pos := 0; par.vwr := v; par.frame := GetFrameByName("System.Log"); (* temp. set to system log *) ÿÿÿÿ€8ÀÔÏÏûÿÿ€8ÀÔJSyntax10i.Scn.Fnt1Syntax10.Scn.Fnt•è(* file compiled, now search the text position *) REPEAT Texts.Scan(S) UNTIL S.eot OR ((S.class = Texts.Name) & (S.s = "pos")); IF S.eot THEN RETURN END; oldLine := S.line; loc := FALSE; REPEAT IF (S.class = Texts.Name) & (S.s = "pos") THEN Texts.Scan(S); IF S.class = Texts.Int THEN pcPos := S.i END; Texts.Scan(S); IF (S.class = Texts.Name) & (S.s = "pc") THEN Texts.Scan(S); IF (S.class = Texts.Name) & (S.s = "not") THEN (* pc manually changed, not found *) Out.String("position of error not found. PC may have been changed manually.$"); RETURN END; InternalLocate(source, pcPos); loc := TRUE; ELSE (* warning or error found *) RemoveErrElem(source.text, pcPos); WHILE oldLine = S.line DO Texts.Scan(S) END; oldLine := S.line; END ELSE Out.String("Module contains errors, trap search not possible.$"); loc := TRUE END UNTIL loc; INC(depth) )ÿÿÿÿ€8ÀÔ $Œÿÿÿÿ€8ÀÔ ¸ÿÿÿ€8ÀÔ#Syntax10.Scn.Fnt&& BEGIN depth := 0; Step END Locate; ÿÿÿÿ€8ÀÔ  ¼ÿÿÿ€8ÀÔ#Syntax10.Scn.Fnt"" BEGIN depth := 0 END StepReset; ÿÿÿÿ€8ÀÔ7MODULE Trap; (*Windows*) (* SC -  *) IMPORT Viewers, Display, Texts, TextFrames, Out, MenuViewers, Strings, Oberon, FoldElems, Types, Modules; VAR depth: INTEGER; w: Texts.Writer; PROCEDURE ShowPos (F: TextFrames.Frame; pos: LONGINT); PROCEDURE NewView (name: ARRAY OF CHAR; T: Texts.Text; org: LONGINT): TextFrames.Frame; PROCEDURE GetFrameByName(name: ARRAY OF CHAR): TextFrames.Frame; PROCEDURE SetCaret (F: TextFrames.Frame; pos: LONGINT); PROCEDURE InternalLocate(f: TextFrames.Frame; thePos: LONGINT); PROCEDURE RemoveErrElem(t: Texts.Text; pos: LONGINT); PROCEDURE Step*; VAR v: Viewers.Viewer; T, t: Texts.Text; S: Texts.Scanner; beg, end, pcPos: LONGINT; mod: ARRAY 64 OF CHAR; source: TextFrames.Frame; x, y, res, intDepth, oldLine: INTEGER; par: Oberon.ParList; loc: BOOLEAN; BEGIN intDepth := 0; NEW(par); (* := Oberon.Par;*) v := Oberon.Par.vwr; IF v # NIL THEN T := v.dsc.next(TextFrames.Frame).text; Texts.OpenScanner(S, T, 0); search the correct position in the trap viewer - Windows open and mark source file show and select trap information in trap viewer build parameter list t := Oberon.Log; (* save Oberon log text *) Oberon.Log := TextFrames.Text(""); Oberon.DrawCursor(Oberon.Pointer, Oberon.Star, x, y); Oberon.Call("Folds.Compile", par, FALSE, res); Texts.OpenScanner(S, Oberon.Log, 0); Oberon.Log := t; (* restore Oberon log text *) IF (res = 0) THEN search the position found by the compiler ELSE (* compiler didn't work correctly *) Out.F("Error: Compiler returned with error code #.$", res); END ELSE Out.String("Error: Trap viewer is not open.$") END END Step;  PROCEDURE Locate*; PROCEDURE StepReset*; BEGIN StepReset; Texts.OpenWriter(w) END Trap.Locate