[Oberon] FPGA - DIY Dialogs

Jörg Straube joerg.straube at iaeth.ch
Mon Jan 14 11:26:27 CET 2019


I try to answer both your questions in one mail.

Basically, you have TWO kind of „objects“, you want to store: 1) the object itself (and all its possible extensions)  and 2) the list of those objects.

First, try to determine a) what elements of an object change from instance to instance and b) what elements are constant.
The elements b) should be part of the object, the elements a) are part of the list.

Eg I could imagine that the id will not change but also the width and the height will not change. if so, the width and the height should only be stored once to have a small compressed file. But it depends on your case.

So while storing the list, first store the constant object elements if the object is not stored already (so you have to remember whether you stored an object’s instance already) and then store the list elements.

br
Jörg

> Am 14.01.2019 um 09:40 schrieb Tomas Kral <thomas.kral at email.cz>:
> 
> 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>
> --
> 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