[Oberon] FPGA - DIY Dialogs

Tomas Kral thomas.kral at email.cz
Mon Jan 14 09:40:25 CET 2019


On Sun, 13 Jan 2019 10:32:52 +0100
Tomas Kral <thomas.kral at email.cz> wrote:

> When storing dialog objects,

I need to maintain a sort of object visual hierarchy.
Some objects are topmost, some are at the back. As the order of drawing
objects is opposite to order in which there are stored. Not sure if
good idea at all, but I coded double linked list at the expense of one
VAR and one IF.

  PROCEDURE Insert*(o: Object);
  BEGIN INC(cnt); o.id := cnt;
    IF first # NIL THEN first.prev := o ELSE last := o END ;
    o.next := first; first := o; o.prev := NIL
  END Insert; (*LinkObj*)

  PROCEDURE Draw*(y: INTEGER);
    VAR o: Object;
  BEGIN o := first;
    WHILE o # NIL DO o.do.draw(o, y); o := o.next END
  END Draw;

  PROCEDURE Store*(VAR r: Files.Rider);
    VAR o: Object;
  BEGIN o := last;
    WHILE o # NIL DO Files.WriteString(r, o.mod); (*TODO use id*)
      Files.WriteInt(r, o.x); Files.WriteInt(r, o.y); Files.WriteInt(r, o.w); Files.WriteInt(r, o.h);
      o.do.store(o, r); o := o.prev
    END
  END Store;

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list