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-Thread: a07f3367d7,c98f618755b0ddcc X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!gegeweb.org!aioe.org!news.tornevall.net!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Thinking of using Ada for a job at home. Couple of questions first. Date: Wed, 03 Mar 2010 11:22:33 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: NNTP-Posting-Host: dec796c062f98b9a408a9bdbd95b5ff3 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 18f3ddfb51a4c2c736bbcbeb8fbbc091 X-Complaints-To: abuse@tornevall.net X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-Validate-Post: http://news.tornevall.net/validate.php?trace=18f3ddfb51a4c2c736bbcbeb8fbbc091 X-SpeedUI: 1738 X-Complaints-Italiano: Parlo la lingua non � italiano User-Agent: Thunderbird 2.0.0.23 (X11/20090817) X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news1.google.com comp.lang.ada:9377 Date: 2010-03-03T11:22:33-07:00 List-Id: John McCabe wrote: > > The second question is related to the implementation of the System > Exclusive messages. Basically this is part of the reason I thought Ada > would be good for this task. The SysEx messages basically consist of a > smallish header and a variety of different structures that are > differentiated by the "Function" type in the header. Now I seem to > remember from when I did use Ada that it's possible to define the > record representation of a variant record such that the discriminant > is held within the body of the record. This would mean (I think) that > I could read a block of data from the synthesizer straight in to a > buffer that overlaid the variant record and essentially automatically > created a record that could be read as the particular variant related > to the incoming data. However I also seem to remember that's not quite > a 'recommended' way of doing that sort of thing. The other thing that > guided me in Ada's direction is that the structure of the SysEx > messages requires a lot of bit-fields and I'm well aware that Ada's > representation clauses are fantastic for that sort of thing. > > So, in principle, would that be the way to do this, or would you be > able to suggest a better mechanism? That is the way I would approach this, though I might keep the buffer and record separate and use Unchecked_Conversion. I can't tell you whether the tagged approach would work, because programming by extension is a bad idea, and I avoid it whenever possible. -- Jeff Carter "Clear? Why, a 4-yr-old child could understand this report. Run out and find me a 4-yr-old child. I can't make head or tail out of it." Duck Soup 94