[Oberon] Allocation of dynamic open arrays using NEW(p, len)

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Wed Aug 29 16:46:57 CEST 2018


An enhanced FPGA Oberon 2013 compiler is now available at:


   https://github.com/andreaspirklbauer/Oberon-enhanced-FPGA-Oberon07-compiler


Among other things it contains a dynamic heap allocation procedure NEW(p, len)
for open arrays:


MODULE Test;
  TYPE Record = RECORD a, b: INTEGER END ;
    Array1 = ARRAY OF Record;   (*open array*)
    Array2 = ARRAY 20 OF Record;   (*fixed-length array*)
    Pointer1 = POINTER TO Array1;
    Pointer2 = POINTER TO Array2;

  VAR a1: Pointer1;
    a2: Pointer2;

  PROCEDURE New1*;
  BEGIN NEW(a1, 100);   a1[53].b := 7
  END New1;

  PROCEDURE New2*;
  BEGIN NEW(a2);   a2[3].b := 7
  END New2;

END Test.

ORP.Compile Test.Mod/s ~
Test.New1  Test.New2




More information about the Oberon mailing list