comp.lang.ada
 help / color / mirror / Atom feed
From: Mike Werner <mwerner@wvu.edu>
Subject: Re: Big-endian vs little-endian
Date: 1999/02/06
Date: 1999-02-06T00:00:00+00:00	[thread overview]
Message-ID: <36BB9A6E.D472A709@wvu.edu> (raw)
In-Reply-To: 7982p9$nll$3@plug.news.pipex.net

Nick Roberts wrote:
> 
> I can think of two possible solutions:
> 
> (a) declare a type derived from Interfaces.Integer_8/16/32 etc. (RM95 B.2),
> and then apply a Bit_Order representation clause (RM95 13.5.3) to this type;
> 
> (b) use Text_IO instead of Sequential_IO, and input and output the data in
> the form of text.

I wish I could use (b) - unfortunately this program was for class and we
had to use the data file provided by the instructor.  I looked at RM
13.5.3 as pointed out in (a) but really did not understand it.  I'm very
new at Ada, and that LRM is quite a ways over my head.  But I'll take a
stab and see if I've got the general idea.

Here's the relevant data structure:

   type Sys_type is (Zarya, Unity, PMA1, PMA2);
   type Subsys_type is (CDH, CT, ECLSS, EPS, GNC, SM);
   subtype Desc_type is String(1..256);
   subtype Dur_Min_Type is Integer;
   subtype Dur_Sec_type is Integer;
   type Apm_Rec is 
      record
	 Description : Desc_Type;      
	 System : Sys_Type;
	 Subsystem : Subsys_Type;
	 Dur_Min : Dur_Min_Type;
	 Dur_Sec : Dur_Sec_Type;  
      end record;

The problematic parts were the Apm_Rec.Dur_Min and the Apm_Rec.Dur_Sec -
all the others read in just fine.  If I'm understanding all this, should
I have changed

   subtype Dur_Min_Type is Integer;
   subtype Dur_Sec_type is Integer;

to

   subtype Dur_Min_Type is Integer(S'Bit_Order=>Low_Order_First);
   subtype Dur_Sec_type is Integer(S'Bit_Order=>Low_Order_First);

or perhaps High_Order_First - haven't got everything handy at the
moment.  But the main question is do I have the right syntax and usage? 
Or am I completely off here?

Really the main reason I'm concerned with this is I much prefer to do my
assignments on my own computer as opposed to telnetting into the
school's server - that telnet connection lags badly enough that most any
task requires much patience.  If it weren't for that, I probably
wouldn't worry about it.  I can work around this for future projects
(hopefully) the same way I did for this project - I'm just looking for
an easier way.  And I do appreciate all the pointers so far - I'm
reading the LRM as I have the opportunity.  Just the slight problem of
most of it being well beyond my knowledge level.  But I'm working on it.
-- 
Mike Werner  KA8YSD           |  "Where do you want to go today?"
ICQ# 12934898                 |  "As far from Redmond as possible!"
'91 GS500E                    |
Morgantown WV                 |

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GU d-@ s:+ a- C++>$ UL++ P+ L+++ E W++ N++ !o w--- O- !M V-- PS+ PE+
 Y+ R+ !tv b+++(++++) DI+ D--- G e*>++ h! r++ y++++
------END GEEK CODE BLOCK------





  parent reply	other threads:[~1999-02-06  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-29  0:00 Big-endian vs little-endian Mike Werner
1999-02-02  0:00 ` Nick Roberts
1999-02-03  0:00   ` Mark A Biggar
1999-02-06  0:00     ` Samuel T. Harris
1999-02-08  0:00       ` dennison
1999-02-08  0:00         ` Samuel T. Harris
1999-02-04  0:00   ` Richard D Riehle
1999-02-06  0:00   ` Mike Werner [this message]
1999-02-07  0:00     ` Matthew Heaney
1999-02-09  0:00     ` Stephen Leake
1999-02-10  0:00     ` Mike Werner
replies disabled

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