comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: dynamic arrays in a record ?
Date: Thu, 20 Feb 2003 06:28:58 GMT
Date: 2003-02-20T06:28:58+00:00	[thread overview]
Message-ID: <KA_4a.185668$be.174334@rwcrnsc53> (raw)
In-Reply-To: a5589416.0302192057.45e8c413@posting.google.com

> 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;



  reply	other threads:[~2003-02-20  6:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20  4:57 dynamic arrays in a record ? Chris
2003-02-20  6:28 ` tmoran [this message]
2003-02-20 16:44   ` Chris
  -- strict thread matches above, loose matches on Subject: below --
2003-02-20  6:20 Grein, Christoph
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox