comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Thinking of using Ada for a job at home. Couple of questions first.
Date: Wed, 03 Mar 2010 11:22:33 -0700
Date: 2010-03-03T11:22:33-07:00	[thread overview]
Message-ID: <hmm9h9$ggo$1@tornado.tornevall.net> (raw)
In-Reply-To: <au1to5966sjtka244r3ce5dujj2j4ijfjt@4ax.com>

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



  reply	other threads:[~2010-03-03 18:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03 16:19 Thinking of using Ada for a job at home. Couple of questions first John McCabe
2010-03-03 18:22 ` Jeffrey R. Carter [this message]
2010-03-03 20:09   ` John McCabe
2010-03-03 21:00     ` Simon Wright
2010-03-03 18:58 ` Hibou57 (Yannick Duchêne)
2010-03-03 20:17   ` John McCabe
2010-03-04  6:22     ` Hibou57 (Yannick Duchêne)
2010-03-04 11:39       ` John McCabe
2010-03-09 14:49         ` Warren Gay
2010-03-09 15:33           ` Jacob Sparre Andersen
2010-03-09 20:22           ` jonathan
2010-03-09 21:57             ` Charmed Snark
2010-03-09 22:54               ` jonathan
2010-03-10 17:46                 ` Charmed Snark
2010-03-10 19:12                   ` jonathan
2010-03-10 20:41                     ` Simon Wright
2010-03-10 21:00                       ` Pascal Obry
2010-03-09 20:32           ` Simon Wright
2010-03-10  6:42           ` J-P. Rosen
2010-03-03 19:17 ` Dmitry A. Kazakov
2010-03-03 20:38   ` John McCabe
2010-03-03 20:56     ` Simon Wright
2010-03-03 21:00       ` John McCabe
2010-03-03 21:10         ` John McCabe
2010-03-04  6:39         ` Hibou57 (Yannick Duchêne)
2010-03-03 21:35       ` tmoran
2010-03-04  6:43         ` Hibou57 (Yannick Duchêne)
2010-03-03 22:20     ` Dmitry A. Kazakov
2010-03-03 19:52 ` Gautier write-only
2010-03-03 20:57   ` John McCabe
replies disabled

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