🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3388

Really big Arrays with max 64k data objects

#3388
From: Mike Watterson
Date: Mon, 18 Mar 1996 15:04
21 lines
1389 bytes
What I do for really big arrays is create a opaque type or class
VIZ:

TYPE
   BIG = ARRAY[0..MAX(CARDINAL)-1] OF BYTE;
   DYNCOL = POINTER TO DYNDATA;
   DYNDATA= RECORD
      currentSize:CARDINAL;
      data : POINTER TO BIG;
   END; 
   DYNARRAY= ARRAY[0..LASTROW] OF DYNCOL;

In use you use ALLOCATE not NEW to set the actual size of the 
data part in DYNADATA and make sure to save the currentSize to be 
able to DEALLOCATE, Rows not used are NIL. You can of course use 
any types suitable for BIG as long as:
1) it is no more than 64K
2) you supply all the procedures and functions in the MODULE too, 
the implementation of DYNA0RRAY (the opaque type ) must be 
private as this is dangerous. Be carefull writing rountines to 
read or write DYNARRAY. 
Technical Details
Message-ID: <4iju22$8tu@nuacht.iol.ie>
Path: arc1-ca.pugleaf.net!tank.news.pipex.net!pipex!iol!usenet
References: <31402188.A79@sinex.demon.co.uk> <4i2bia$f9e@seagoon.newcastle.edu.au> <826881124snz@nezumi.demon.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!tank.news.pipex.net!pipex!iol!usenet
From: Mike Watterson <dbcomp@iol.ie>
Newsgroups: comp.lang.modula2
Subject: Really big Arrays with max 64k data objects
Date: 18 Mar 1996 15:04:34 GMT
Organization: Ireland On-Line
Message-ID: <4iju22$8tu@nuacht.iol.ie>
References: <31402188.A79@sinex.demon.co.uk> <4i2bia$f9e@seagoon.newcastle.edu.au> <826881124snz@nezumi.demon.co.uk>
NNTP-Posting-Host: dialup-004.limerick.iol.ie
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.22KIT (Windows; I; 16bit)
To: Martin@nezumi.demon.co.uk