From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5fae12a81834f90 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-23 07:18:08 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!isdnet!news-fra.pop.de!news-FFM2.ecrc.net!news.iks-jena.de!lutz From: lutz@iks-jena.de (Lutz Donnerhacke) Newsgroups: comp.lang.ada Subject: Re: AdaYY wish list from current projects Date: 23 Feb 2001 15:15:35 GMT Organization: IKS GmbH Jena Distribution: world Message-ID: References: <96ulad$r9e$1@belenus.iks-jena.de> <87u25nnfer.fsf@deneb.enyo.de> <87elwp3fw4.fsf@deneb.enyo.de> <87lmqx1p47.fsf@deneb.enyo.de> <87zofdzbii.fsf@deneb.enyo.de> NNTP-Posting-Host: taranis.iks-jena.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: slrn/0.9.6.3 (Linux) Xref: supernews.google.com comp.lang.ada:5476 Date: 2001-02-23T15:15:35+00:00 List-Id: * 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/