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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dfb1becd7014a395 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-01 18:49:31 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!border1.nntp.ash.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 01 Mar 2004 20:49:30 -0600 Date: Mon, 01 Mar 2004 21:49:30 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: allocation of an array References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <38qdnRRBtNuna97d4p2dnA@comcast.com> NNTP-Posting-Host: 24.147.77.160 X-Trace: sv3-HlNazDXSk4grTUJVvD5HBPP/jUZD6tjunsbx4rfOsXrrU7VtNzu7vSZ9CpJdXPpvJ2n3/XBzgzLsOPo!RI4VuFHl3tS0Rj7L0EmQ1KWLEmk+C2wAiCs00Hm12Sp8+va7FrH5IBPl8HrFWg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:5998 Date: 2004-03-01T21:49:30-05:00 List-Id: Davide wrote: > My machine is a Power-PC with 32-bit alignment. My compiler is AdaMulti. > I must download long messages composed of 16-bit integers items from a FIFO > memory device. > In my implementation I store them into arrays of 16 bit-integers. > Then I have to filter those buffered messages, extracting a subset of items. > I chosen to use a constant array of offsets for each message (an offset > index for each item to extract). > Then I go through the array extracting items at the specified indexes. > This is my solution, but now I'm wondering if I could have done better if I > had "mapped" a record > to each of those arrays, with 16-bit fields corresponding to the message > items and copying the relevant items to "filtered" records. > That's why I was asking about the array allocation, that is therefore > essential to this solution. If I understand what you are saying. You have messages which consist of some number of 16-bit chunks. You need to map some? templates on to the received messages and extract data from some of those fields. I think I will answer by pointing you to the Ada.Streams package. If you can use it for the streams you are dealing with it will make things much easier. The real magic occurs with 'Read and 'Write in the next section. (And if you have multiple message formats that depend on information in one or more header words, S'Output and S'Input.) With luck you should be able to declare your messages as a single variant record type, and use 'Input to read those messages. > I still hope that the first solution could be preferable...since I have done > a lot of code... :-) ...what do you think, also in terms of portability and > reusability (i.e independence from platform and compiler, which I like to > take into account)? -- Robert I. Eachus "The only thing necessary for the triumph of evil is for good men to do nothing." --Edmund Burke