comp.lang.ada
 help / color / mirror / Atom feed
* Re: Record rep-clauses
       [not found] <30F1418B.33CB@kiemw.ericsson.se>
@ 1996-01-08  0:00 ` Robert A Duff
  1996-01-08  0:00   ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Robert A Duff @ 1996-01-08  0:00 UTC (permalink / raw)


In article <30F1418B.33CB@kiemw.ericsson.se>,
Magnus Ericson  <emwmei@kiemw.ericsson.se> wrote:
>I believe I have seen a paper (or article) about how to best write 
>record-rep clauses when you need to port your software between little- 
>and big-endian system but I don't know where!

Sorry, I don't know of the article.  But one technique for Ada 83 is to
define a bunch of subtypes representing the ranges (e.g. all possible
subranges of 0..31), and write all your rep clauses in terms of those.
Then, when you switch to a machine with different endian-ness, change
the subtypes, but not the rep clauses.  (I.e. keep two different
versions of the same package, defining all the subtypes.)  It's a lot of
subtypes, but if you're writing many rep clauses, it might be worth it.

>I am not using Ada 95 but information about how to solve it with this
>revision of the language is also of interest (at least in order to plan
>for transitioning the software we are writing now to Ada 95 later on).

Look at RM95-13.5.3, "Bit Ordering".

- Bob




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Record rep-clauses
  1996-01-08  0:00 ` Record rep-clauses Robert A Duff
@ 1996-01-08  0:00   ` Robert Dewar
  1996-01-09  0:00     ` Magnus Ericson
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Dewar @ 1996-01-08  0:00 UTC (permalink / raw)


Magnus asked:

>I believe I have seen a paper (or article) about how to best write
>record-rep clauses when you need to port your software between little-
>and big-endian system but I don't know where!

This is too vague, these endian questions can be very confusing, and there
are at least three quite different problems that the above question might
be referring to. Magnus, can you be very precise in exactly what you are
trying to do, and we will try to help!





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Record rep-clauses
  1996-01-08  0:00   ` Robert Dewar
@ 1996-01-09  0:00     ` Magnus Ericson
  0 siblings, 0 replies; 3+ messages in thread
From: Magnus Ericson @ 1996-01-09  0:00 UTC (permalink / raw)
  Cc: emwmei

Robert Dewar wrote:
> This is too vague, these endian questions can be very confusing, and there
> are at least three quite different problems that the above question might
> be referring to. Magnus, can you be very precise in exactly what you are
> trying to do, and we will try to help!

I am working in a project where we need to define a protocol on two
machines, one of them is a Motorola 68040 and the other is a Pentium PC. We
have started to write rep-clauses for the Motorola machine and realized how
difficult it will be to make and maintain a parallell package with
declarations and rep-specs with all bits reversed etc for the Intel 
machine. The questions are what coding-techniques that can be used to make
this as "painles" as possible. 

Can you please elaborate on what "three" problems that you are thinking about?
Since the protocol is packed tightly (possibly crossing storage unit
boundaries) I (unfortunatly) suspect that all of them might apply...

One posibility for us (that I actually like a lot) is to describe the messages
of the protocol in for instance a relational data base and then write a piece 
of code that auto-generate the record declarations and rep-specs for both the
Intel and Motorola machine from this description.
In this case no measures need to be taken to simplify the maintanence of
the two parallell packages but other language issues might still apply!

Hope this is specific enough, I am trying to learn a bit more about this
issue before finding the problems "the hard way"...

When it comes to Ada 95 I am not sure if all of the new pragmas about 
bit-ordering are informational only or if it actually is possible to select
what bit-numbering scheme that is used by the copmiler when interpreting
rep-clauses? 

Regards
Magnus Ericson  
-- 
Magnus Ericson M.Sc, Ericsson Microwave Systems
Torshamnsgatan 32C, S-164 84 STOCKHOLM
Tel: +46 8 757 35 38 Fax: +46 8 750 74 42
Disclaimer: "The opinions expressed here are my own,
             and not those of my employer."




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-01-09  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <30F1418B.33CB@kiemw.ericsson.se>
1996-01-08  0:00 ` Record rep-clauses Robert A Duff
1996-01-08  0:00   ` Robert Dewar
1996-01-09  0:00     ` Magnus Ericson

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