comp.lang.ada
 help / color / mirror / Atom feed
From: Alfred Hilscher <Alfred.Hilscher@icn.siemens.de>
Subject: Re: unconstrainted arrays
Date: Wed, 17 Oct 2001 18:28:32 +0200
Date: 2001-10-17T18:28:32+02:00	[thread overview]
Message-ID: <3BCDB1B0.52D3B04C@icn.siemens.de> (raw)
In-Reply-To: slrn9sr99u.jv.lutz@taranis.iks-jena.de

Sorry, the description of my problem was bad. I try to make it clearer.

My current problem is to define the record in such a way, that I can
declare different variables like

PTs_1 : s(10);
PTs_2 : s(16);
PTs_3 : s(24);
PTs_4 : s(58);

whereby the data must be always stored in the order X, Y, A(1), A(2) ..
A(n). A trailing discriminant would be no problem, but nevertheeless
should be avoided (if possible). The component "Len" is not really
needed (I think I could obtain the length of "A" by A'Length, but I do
not need it).


 Lutz Donnerhacke wrote:
 >  
 > * Alfred Hilscher wrote:
 > >type s (len : integer) is record
 > >            X,Y : Integer;
 > >            A : My_Array (1..Len);
 > >     end record;
 > >
 > >PTs : s (10);
 > >
 > >But this would add one extra component to the record (Len). Is there
a
 > >way to avoid this extra component ? Maybe a pragma or rep-specs? Its
 > >encapsulated within a package body for HW handling where the extra
 > >component is unwanted.
 > 
 > type hw_s10 is record
 >     X,Y : Integer;
 >     A : My_Array (1..10);
 > end record;
 > for hw_s10 use record
 >    x at 0 range 0 .. 15;
 >    y at 2 range 0 .. 15;
 >    a at 4 range 0 .. 159;
 > end record;
 > 
 > If you are requireing a special layout, describe it directly. If the
 > discriminant occurs in the record at an other place: No problem:
 > 
 > type pascal_len is range 0 .. 255;
 > type pascal_string (len : pascal_len) is record
 >    value : String (1 .. len);
 > end record;
 > for pascal_string use record
 >    len at 0 range 0 .. 7;
 > end record;
 > pragma Pack (pascal_string);



  reply	other threads:[~2001-10-17 16:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-17 15:18 unconstrainted arrays Alfred Hilscher
2001-10-17 15:35 ` Lutz Donnerhacke
2001-10-17 16:28   ` Alfred Hilscher [this message]
2001-10-18  7:42     ` Lutz Donnerhacke
2001-10-18 11:03       ` Rep spec still not possible Petter Fryklund
2001-10-18 12:44         ` Lutz Donnerhacke
2001-10-18 17:10           ` Jeffrey Carter
2001-10-19 13:52             ` Exactly the prblem, how do we make a known constant value static? Petter Fryklund
2001-10-20  0:04               ` James Rogers
2001-10-20  2:53               ` Jeffrey Carter
2001-10-22  8:11                 ` We still don't know how to make a " Petter Fryklund
2001-10-17 16:09 ` unconstrainted arrays Claude SIMON
replies disabled

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