> Basically, what I would like is to be able to re-dimension an array
within
> a subroutine (proc/fn) BY PASSING THE SUBROUTINE THE ARRAY
> AS A PARAMETER.
>
> For example, I have an array f$ (10,10) and a variable 'mycount%'
> which contains the last element of the array that is filled in.
>
> From time to time, a new element of the array must be fileld in, and
> mycount% makes sure that I use an, up to now, unused element of the
> array for that - and also that I don't go over the top of the array.
> Since I do that with several arrays, whenever I fill in an element
in the
> array, I'd like to use some sort of procedure, which could be as
follows:
Indeed I have, and needed this sort of solution in Launchpad for the
arrays in Launchpad which hold the icon and program details - if the
number expanded beyond a certain reasonable point I needed to expand
the arrays, and it needed to be a recursive routine due to the
key-sorted lists when sorting or ordering was involved, plus th eneed
to allow users some flexibility in menus etc, that is, they could put
as many or as little in each menu that they needed without having to
carry the overhead of a separate array of maximum size for each menu.

In practice, I gave up, I had tried many approaches, many of which
have been mentioned in replies to this thread, and none worked
perfectly.

My "solution" was simply to define all arrays to maximum size and
place a limit on the number of definable items irrespective of memory
available, machine type etc. In other words, back to basics. The only
approached which worked was using temporary arrays to copy data from
the old array into the new one, then redimensioned to minimum
afterwrds to reduce memory overheads.

I wasted a great deal of time on this, it was a major problem as far
as I was concerned. I ended up with what I thought was an unacceptable
compromise.

The only way I could think of doing it was with a Turbo compiler
feature (forget its name) whereby if you DIMension an array which
already exists to different dimensions, the content opf the old array
was copied into the new array automatically as far as permitted by the
dimensions of the array. DIM of an array to the same size cleared the
array.

--
Dilwyn Jones

Reply via email to