Browse Source

scanner Reset: NEW(buf[i]) typed alloc (BufBlock needs a descriptor header under V3's open-array ABI)

Eric Streit 2 weeks ago
parent
commit
af392e1ac6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      compiler/src/scanner.frm

+ 2 - 1
compiler/src/scanner.frm

@@ -3,6 +3,7 @@ IMPLEMENTATION MODULE -->modulename;
 (* Scanner generated by Coco/R - using the FileIO library supplied with this project. *)
 (* Scanner generated by Coco/R - using the FileIO library supplied with this project. *)
 
 
 IMPORT FileIO, Storage;
 IMPORT FileIO, Storage;
+FROM Storage IMPORT ALLOCATE;  (* gm2 needs this for NEW substitution *)
 
 
 CONST
 CONST
   noSYMB  = -->unknownsym; (*error token code*)
   noSYMB  = -->unknownsym; (*error token code*)
@@ -146,7 +147,7 @@ PROCEDURE Reset;
   BEGIN (*assert: src has been opened*)
   BEGIN (*assert: src has been opened*)
     i := 0; inputLen := 0;
     i := 0; inputLen := 0;
     REPEAT
     REPEAT
-      Storage.ALLOCATE(buf[i], BlkSize);
+      NEW(buf[i]);   (* typed alloc: sets the block descriptor's count *)
       read := BlkSize; FileIO.ReadBytes(src, buf[i]^, read);
       read := BlkSize; FileIO.ReadBytes(src, buf[i]^, read);
       INC(i); INC(inputLen, VAL(INT32, read))
       INC(i); INC(inputLen, VAL(INT32, read))
     UNTIL read # BlkSize;
     UNTIL read # BlkSize;