|##########| |#MAGIC #|CLABLNCM |#PROJECT #|"ImportHelp" |#PATHS #|"StdProject" |#FLAGS #|xx-x-x--x----xx----------------- |#USERSW #|-------------------------------- |#USERMASK#|-------------------------------- |#SWITCHES#|xx---xxxxx------ |##########| DEFINITION MODULE DynamicArrays; EXCEPTION BadSubscript : "Bad subscript"; DEFINITION MODULE DynamicArray(type : ANYPTR); TYPE Array = RECORD data : ARRAY [256] OF POINTER TO ARRAY [256] OF type; first, last : CARDINAL; END; PROCEDURE Init(VAR a : Array); PROCEDURE Destruct(VAR a : Array); PROCEDURE Delete(VAR a : Array); PROCEDURE Put(VAR a : Array;index : CARDINAL;data : type); PROCEDURE Get(REF a : Array;index : CARDINAL):type; PROCEDURE Next(REF a : Array;old : CARDINAL):CARDINAL; PROCEDURE Prev(REF a : Array;old : CARDINAL):CARDINAL; END DynamicArray; DEFINITION MODULE DynamicArray2(type : ANYPTR); TYPE Array = RECORD data : ARRAY [16],[16] OF POINTER TO ARRAY [16],[16] OF POINTER TO ARRAY [16],[16] OF POINTER TO ARRAY [16],[16] OF type; firstX, firstY, lastX, lastY : CARDINAL; END; PROCEDURE Init(VAR a : Array); PROCEDURE Destruct(VAR a : Array); PROCEDURE Delete(VAR a : Array); PROCEDURE Put(VAR a : Array;x,y : CARDINAL;data : type); PROCEDURE Get(REF a : Array;x,y : CARDINAL):type; PROCEDURE FirstXatY(REF a : Array;y : CARDINAL):CARDINAL; PROCEDURE LastXatY(REF a : Array;y : CARDINAL):CARDINAL; PROCEDURE FirstYatX(REF a : Array;x : CARDINAL):CARDINAL; PROCEDURE LastYatX(REF a : Array;x : CARDINAL):CARDINAL; PROCEDURE NextX(REF a : Array;x,y : CARDINAL):CARDINAL; PROCEDURE NextY(REF a : Array;x,y : CARDINAL):CARDINAL; PROCEDURE PrevX(REF a : Array;x,y : CARDINAL):CARDINAL; PROCEDURE PrevY(REF a : Array;x,y : CARDINAL):CARDINAL; END DynamicArray2; END DynamicArrays.