[Oberon] FPGA - Pictures.Mod composition
Tomas Kral
thomas.kral at email.cz
Mon Oct 2 12:37:02 CEST 2017
On Sun, 1 Oct 2017 20:23:21 +0200
August Karlstrom <fusionfile at gmail.com> wrote:
> common approach is to separate memory allocation
> and initialization
Hi,
I would know the reason for separating. As FPGA { Oberon-07, V5 } is
about building system from scratch while making it simple, we could
possibly also experiment with new tricks here. I have therefore merged
these procedures into one.
> PROCEDURE Bitmaps.New(w, h, dpt) : Bitmaps;
> PROCEDURE Bitmaps.New2(B: Bitmap; w, h, dpt) : Bitmaps;
PROCEDURE New*(B: Bitmap; w, h, dpt: INTEGER) : Bitmap;
BEGIN
IF B = NIL THEN NEW(B) END; (* create itself *)
IF B # NIL THEN (* initialise itself *)
(* ... *) (* allocate itself *)
END
RETURN B END New;
VAR b: Bitmap; p: Picture
b := Bitmaps.New(NIL, w, h, 1); (* creating bitmap *)
NEW(b); Bitmaps.New(b, w, h, 1); (* also creating bitmap *)
NEW(p); b := Bitmaps.New(p, w, h, 1); (* creating picture *)
Seems simple, does the job, bad idea?
--
Tomas Kral <thomas.kral at email.cz>
More information about the Oberon
mailing list