[Oberon] FPGA - OberonV4 Dialogs
Tomas Kral
thomas.kral at email.cz
Thu Nov 29 19:53:52 CET 2018
On Thu, 29 Nov 2018 14:49:16 +0100
Tomas Kral <thomas.kral at email.cz> wrote:
> how to
> get to their pointers at run time?
How about this?
MODULE TLoader; (* TK 29.11.2018 RISC type init loader *)
IMPORT In, Out, Modules;
TYPE
Object* = POINTER TO ObjDesc;
ObjDesc* = RECORD
i, j, k: INTEGER;
END;
VAR o: Object; (* scratch variable *)
PROCEDURE Run*;
VAR name: Modules.ModuleName; module: Modules.Module; Init: PROCEDURE;
BEGIN In.Open; In.Name(name);
WHILE In.Done DO
Out.String(name); Out.String(" loading ");
Modules.Load(name, module);
Init := Modules.ThisCommand(module, "Init");
IF Modules.res = 0 THEN Init() END ;
In.Name(name); Out.Ln
END;
END Run;
PROCEDURE SetObjPtr*(obj: Object);
BEGIN o := obj
END SetObjPtr;
BEGIN
END TLoader.
TLoader.Run M0 M1 ~
MODULE M0;
IMPORT TLoader, Out;
TYPE
Item = POINTER TO ItemDesc;
ItemDesc = RECORD(TLoader.ObjDesc)
x, y, z: BYTE;
END;
VAR it0: Item;
PROCEDURE Init*;
BEGIN Out.String("Item0"); NEW(it0); TLoader.SetObjPtr(it0)
END Init;
BEGIN
END M0.
MODULE M1;
IMPORT TLoader, M0, Out;
TYPE
Item = POINTER TO ItemDesc;
ItemDesc = RECORD(TLoader.ObjDesc)
a, b, c: CHAR;
END;
VAR it1: Item;
PROCEDURE Init*;
BEGIN Out.String("Item1"); NEW(it1); TLoader.SetObjPtr(it1)
END Init;
BEGIN
END M1.
--
Tomas Kral <thomas.kral at email.cz>
More information about the Oberon
mailing list