[Oberon] FPGA - OberonV4 Dialogs

Jörg joerg.straube at iaeth.ch
Mon Nov 26 15:22:28 CET 2018


Hi Tomas

Every module will have its own local "method" RECORD. A pointer to it will
be copied to the "do" field after the instance creation.
Dialog Objects will initialize its "method" RECORD with the base procedures.
Dialog Texts will call the init procedure of Dialog Objects to initialize
its "method" RECORD with the base procedures. Afterwards will overwrite some
(or all) of the procedure with the own ones.

Jörg

-----Original Message-----
From: Oberon <oberon-bounces at lists.inf.ethz.ch> On Behalf Of Tomas Kral
Sent: Monday, November 26, 2018 12:10 PM
To: oberon at lists.inf.ethz.ch
Subject: Re: [Oberon] FPGA - OberonV4 Dialogs

Hi,

I am now recoding `Dialog Texts' which is one of the item type descendants
from `Dialog Objects'.

It inherits methods from Dialogs plus it adds some of its own.

IMethods* = POINTER TO IMDesc;

IMDesc* = RECORD (Dialogs.OMDesc) (*base object method descriptor*)
  (*Copy*: PROCEDURE(t: Item; VAR dup: Dialogs.Object);*) (*override*)
  GetText*: PROCEDURE(t: Item): Texts.Text;
  SetSelection*: PROCEDURE(t: Item; beg, end: LONGINT);
  RemoveSelection*: PROCEDURE(t: Item);
  (*Draw*: PROCEDURE(t: Item; x, y: INTEGER; f: Display.Frame);*)
(*override*)
  (*Print*: PROCEDURE(t: Item; x, y: INTEGER);*) (*not implemented*)
  (*Handle*: PROCEDURE(t: Item; f: Display.Frame; VAR msg:
Display.FrameMsg);*) (*override*) END;

ItemDesc* = RECORD (Dialogs.ObjectDesc)
  f: TextFrames.Frame;
END;

VAR m (*self*), m0 (*base*):  IMethods;
  t: Item; o: Object;
...

To call (base) object methods I do e.g.
t.do.GetDim (t, x, y, w, h);
t.do.Draw (t, f.X + x, f.Y + f.H + y, f);

To call (self) item specific methods I do e.g.
CASE o OF Item: t1 := o(*Item*).do(IMethods).GetText (o(*Item*)); It seems
that without `CASE' I need to do more typeguarding.

The above compiles, not sure if alright though. However, I seem unable to
clone m and initialise m0, with base methods' pointers.

Dialogs.Clone(m:(*self Dialogs.OMethods*)); Dialogs.Get(m0:(*base
Dialogs.OMethods*));

I just need `do*:' pointing to a descriptor holding base pointers plus new
methods pointers.

--
Tomas Kral <thomas.kral at email.cz>
--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list