[Oberon] FPGA - DIY Dialogs

Tomas Kral thomas.kral at email.cz
Sun Jan 13 10:32:52 CET 2019


Hi,

When storing dialog objects, I somehow wish to compress the object name
strings. One idea coming to my mind, store a unique name list first,
and then store only object ids with reference to the list. So there are
no names duplicated in files, this may reduce file storage size?
Any better idea?

    ObjName = ARRAY 32 OF CHAR;

    ObjDesc* = RECORD
      do*: Methods;
      x*, y*, w*, h*: INTEGER;
      next: Object;
      id*: INTEGER;
      mod*: ObjName (*take out to its own module list*)
    END;

  PROCEDURE Store*(VAR r: Files.Rider);
    VAR o: Object;
  BEGIN o := first;
    (*TODO store unique names list first*)
    WHILE o # NIL DO Files.WriteString(r, o.mod); (* TODO write ids only*)
      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.next
    END
  END Store;

  PROCEDURE LinkObj*(o: Object); (*link at runtime*)
  BEGIN o.next := first; first := o;
    INC(cnt); o.id := cnt
  END LinkObj;

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


More information about the Oberon mailing list