dynamic arrays in a record ? 
Author Message
 dynamic arrays in a record ?

Is there any easy way to put a dynamic array in a record?

I plan to create the array elsewhere based on user input, but I would
like a "placeholder" in the record for it...

...or is this craziness altogether?

SNIP------------------------------------

type board_array is array (positive range <>, positive range <>) of
integer range -1..1;

        type board is record
                aboard: board_array; -- this is junk!
                userscore : integer;
                compscore : integer;
     end record;

----------------------------------------



Mon, 08 Aug 2005 12:57:27 GMT  
 dynamic arrays in a record ?
Quote:
> Is there any easy way to put a dynamic array in a record?

Do you mean something like:

procedure testbb is
  subtype board_sizes is integer range 1 .. 10;
  type cells is range -1 .. 1;

  type board_array is array (board_sizes range <>, board_sizes range <>)
  of cells;

  type boarda(ew, ns : board_sizes) is record
    aboard: board_array(1 .. ew, 1 .. ns);
    userscore : integer;
    compscore : integer;
  end record;

  type boardb(ew, ns : board_sizes := 1) is record
    aboard: board_array(1 .. ew, 1 .. ns);
    userscore : integer;
    compscore : integer;
  end record;

  a : boarda(4,5);
  b : boardb(2,3);
  c : boardb;
  east, north : board_sizes;
begin
  east := 1;  -- get these from user
  north := 2;
  c := (ew=>east, ns => north,
        aboard=>(1 .. east=>(1 .. north=> -1)),
        userscore=>7,compscore=>8);
end testbb;



Mon, 08 Aug 2005 14:28:58 GMT  
 dynamic arrays in a record ?
Quote:
> type board_array is array (positive range <>, positive range <>) of
> integer range -1..1;

>    type board (First, Second: Positive) is record
>            aboard: board_array (1..First,1..Second);
>            userscore : integer;
>            compscore : integer;
>      end record;



Mon, 08 Aug 2005 14:20:26 GMT  
 dynamic arrays in a record ?
worked great... thanks guys !


Tue, 09 Aug 2005 00:44:32 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. An array of records within an array of records (Still a problem)

2. an array of records within an array of records

3. Dynamic Array of Record

4. Help: Dynamic-size arrays using record discriminant.

5. Dynamic Record Structure

6. Question about dynamic types of record types

7. Dynamic discrimants in variant records?

8. dynamic arrays

9. Dynamic Array?

10. Dynamic arrays question

11. Dynamic array dimensioning

12. Dynamic Arrays in PBU's PB 3.2

 

 
Powered by phpBB® Forum Software