comp.lang.ada
 help / color / mirror / Atom feed
From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: AdaYY wish list from current projects
Date: 23 Feb 2001 15:15:35 GMT
Date: 2001-02-23T15:15:35+00:00	[thread overview]
Message-ID: <slrn99cvfa.ju.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: 87zofdzbii.fsf@deneb.enyo.de

* Florian Weimer wrote:
>I still have to see some code which shows that record representation
>clauses are practicall even if the components occupy multiple storage
>elements. ;-)

Try to map an ARP packet. Have fun.
Try to map an Pascal String with a 16bit length field.

>lutz@iks-jena.de (Lutz Donnerhacke) writes:
>> procedure t is
>>    type pstring(len : Integer) is record
>>       data : String (1 .. len);
>>    end record;
>>    pragma Pack (pstring); --  record representation clause not possible
>>    
>>    ex : pstring;  --  Won't work;
>>    for ex'Address use 16#00000#;
>> begin
>>    Put_Line (Integer'Image (ex.len) & " => " & ex.data);
>> end t;
>
>Perhaps you want to use a constrained integer type in conjunction with
>a record discriminant with a default expression?

  ex : pstring(x); for ex'Address use 16#00000#;
will compile, but ex.len is always x and not correlated to (16#00000#).

>>>> The problem escaped from a 'multiprotocol router'. Please try to
>>>> map a IPv4 header incl. payload and IP-header options.
>>>
>>>Ah.  Well, obviously, you can't use a single record in this case.
>>
>> So I'm stuck to implement gather-scatter from the beginning. ;-/
>
>Why that?  You can still have the records in consecutive storage
>locations, but you have to do some manual address calculations.

And than store those results in some meta data records called 'Packet.IP.v4'.
http://www.iks-jena.de/mitarb/lutz/ada/net/



  reply	other threads:[~2001-02-23 15:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-20 20:50 AdaYY wish list from current projects Lutz Donnerhacke
2001-02-22 11:08 ` Florian Weimer
2001-02-22 13:02   ` Lutz Donnerhacke
2001-02-23  9:30     ` Florian Weimer
2001-02-23 10:12       ` Lutz Donnerhacke
2001-02-23 13:54         ` Florian Weimer
2001-02-23 14:16           ` Lutz Donnerhacke
2001-02-23 15:04             ` Florian Weimer
2001-02-23 15:15               ` Lutz Donnerhacke [this message]
2001-02-23 16:21                 ` Florian Weimer
2001-02-23 16:31                   ` Lutz Donnerhacke
2001-02-23 17:25                     ` Florian Weimer
2001-02-26 11:22                       ` Lutz Donnerhacke
2001-02-23 19:06             ` tmoran
2001-02-26 11:20               ` Lutz Donnerhacke
2001-02-23 19:06         ` tmoran
2001-02-26 11:21           ` Lutz Donnerhacke
replies disabled

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