From: joseph_kwan@greenlime.com (Joseph Kwan)
Subject: Re: How to convert record?
Date: 28 Oct 2001 17:42:41 -0800
Date: 2001-10-29T01:42:42+00:00 [thread overview]
Message-ID: <80d2e34.0110281742.1bf0bfa7@posting.google.com> (raw)
In-Reply-To: mailman.1004014002.9071.comp.lang.ada@ada.eu.org
"David C. Hoos" <david.c.hoos.sr@ada95.com> wrote in message news:<mailman.1004014002.9071.comp.lang.ada@ada.eu.org>...
> Presumably, you know the size of the record. In your original post
> you showed a record with 8 bytes.
>
> So, you would declare a constrained string subtype of the correct size
> e.g., subtype Record_String is POSIX.POSIX_String (1 .. 8);
>
> Now you can instantiate Unchecked_Conversion from the Record to
> Record_String, because Record_String is constrained.
>
> A Record_String is a valid buffer to pass to POSIX.IO.Read.
So, it must be a constrained type/subtype. This solve my problems.
Thanks.
OTOH, I read about 13.13.2 Stream-Oriented Attributes in LRM. Can I
use 'Read and 'Write or 'Input and 'Output for [this] purpose?
Can someone please explain in details (an example of the
implementation will be of great help) how to implement these
attributes? Please forgive my stupidity because I can't find a good
examples of such implementation in books and LRM and certainly am
unable to figure it out.
Thank you.
> >
> > I thought that would work too but theoretically,
> > Ada.Unchecked_Conversion will not work in converting record to
> > POSIX.IO.IO_Buffer which is a string of characters (See spec in
> > florist's implementation).
> >
> > Anyhow I tried to do Unchecked_Conversion and gnat gave me error
> > message:
> >
> > "unchecked conversion to unconstrained array not allowed".
next prev parent reply other threads:[~2001-10-29 1:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-21 9:56 How to convert record? Joseph Kwan
2001-10-22 11:30 ` John McCabe
2001-10-25 11:40 ` Joseph Kwan
2001-10-25 12:38 ` sk
2001-10-25 17:12 ` Jeffrey L. Susanj
2001-10-25 12:48 ` David C. Hoos
2001-10-29 1:42 ` Joseph Kwan [this message]
2001-10-29 13:35 ` Marc A. Criley
2001-10-25 12:48 ` Marc A. Criley
2001-10-25 12:54 ` sk
2001-10-25 15:41 ` Ted Dennison
2001-10-26 3:21 ` Smark
2001-10-26 5:45 ` James Rogers
2001-10-26 17:46 ` Smark
2001-10-26 14:30 ` Ted Dennison
2001-10-26 17:42 ` Smark
2001-10-26 20:02 ` Ted Dennison
2001-10-26 23:10 ` Jeffrey Carter
-- strict thread matches above, loose matches on Subject: below --
2001-10-29 18:16 Beard, Frank
2001-10-30 1:17 ` Adrian Hoe
2001-10-30 19:05 Beard, Frank
2001-10-31 4:10 ` Adrian Hoe
2001-10-31 19:40 Beard, Frank
2001-11-01 2:13 ` Adrian Hoe
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox