[futurebasic] 2D structuring of a memory block

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2001 : Group Archive : Group : All Groups

From: Herbie Gluender <H.Gluender@...>
Date: Mon, 24 Dec 2001 00:09:19 +0100
Dear experts,

here is a problem that may be solved in C but I've no idea of how to solve it
in FB^3:

1. Given a non empty memory block of known total length
2. Given the data in this memory block are LONGs that actually form a 2D-array
3. Given the number of columns of the array that may _vary_ (not a constant)
4. How can the data be accessed through a proper 2D-array?


An example with: totalLength& = 100

numbColumns& = 5
=> numbRows& = 100/5

The symbolically DIMed 2D-array: myArray&(20,5)

or:

numbColumns& = 50
=> numbRows& = 100/50

The symbolically DIMed 2D-array: myArray&(2,50)



This problem were easy to solve, if XREF would allow a variable (numbColumns&)
as parameter.

(Please note that the problem here is not memory allocation but giving the
block the proper structure according to the _current_ number of columns.)

One possible solution may consist in a 1D-array of 1D-arrays, but this means a
rather inconvenient syntax.


Any suggestions?

Have a pleasant holiday!

Best,

Herbie
*************************************************
H.Glu@...