[Oberon] Static variable overflow (bug?)
chris at cfbsoftware.com
Mon Feb 24 02:15:56 CET 2020
If I were you I would have started by looking at the newer graphics examples
supplied with Project Oberon 2013 as a basis for porting the Fern example to
the newer system. The bitmap in the original XYPlane code appears to have
been used for dot-drawing optimisation that is no longer used (necessary?).
From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of Hans
Sent: Monday, 24 February 2020 10:45 AM
To: ETH Oberon and related systems
Subject: [Oberon] Static variable overflow (bug?)
Recently I tried to implement XYplane.Mod from the book of Reiser & Wirth
'Programming in Oberon' for Project Oberon. Within Peter de Wachter's RISC
emulator I ran into an overflow problem (leading to the remaining empty of
the menu line of a viewer) that appears to be dependent on which disk image
Otherwise my port works fine (produces the IFS fractal fern as expected).
For those interested I will post it to my github repository.
A minimal module that can reproduce this menu problem can be found below.
When starting the emulator in macOS as follows this problem occurs:
$ ./risc --fullscreen DiskImage/Oberon-2019-01-21.dsk
But the problem does NOT occur when starting thus:
$ ./risc --fullscreen DiskImage/Oberon-2016-08-02.dsk
I do understand that there is a limit to the use of static variables within
the PO version of Oberon, but I would not expect this limit to be reached
this easily, and I would not expect it to appear in newer versions of the
software and not in older.
Does anyone have a clue where to look for the cause of this happening?
(* Test of the menu line of a viewer *)
IMPORT Display, Viewers, Oberon, MenuViewers, TextFrames;
max = 16377; (* If max >= 16367 the frame name disappears; If max >=
16377 the whole menu line disappears! *)
menu = "System.Close System.Copy System.Grow";
XYframe = POINTER TO XYframeDesc;
XYframeDesc = RECORD (Display.FrameDesc) END;
VAR bitmap: ARRAY max OF SET; (* with this variable present the menu may
remain empty! *)
PROCEDURE Restore(F: XYframe);
Oberon.RemoveMarks(F.X, F.Y, F.W, F.H);
Display.ReplConst(Display.black, F.X, F.Y, F.W, F.H, Display.replace);
(* clear *)
PROCEDURE Handle(F: Display.Frame; VAR M: Display.FrameMsg);
VAR F1: XYframe;
CASE F OF XYframe:
CASE M OF
IF M.id <http://M.id> = Oberon.track THEN
Oberon.DrawMouseArrow(M.X, M.Y) END |
Oberon.RemoveMarks(F.X, F.Y, F.W, F.H); NEW(F1); F1^ := F^;
M.F := F1 |
IF (M.Y # F.Y) OR (M.H # F.H) THEN F.Y := M.Y; F.H := M.H;
VAR F: XYframe; V: Viewers.Viewer; x, y: INTEGER;
NEW(F); F.handle := Handle;
Oberon.AllocateUserViewer(Oberon.Par.vwr.X, x, y);
V := MenuViewers.New(TextFrames.NewMenu("MyViewer", menu), F,
TextFrames.menuH, x, y)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon