comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: From 16 bit to 32
Date: Mon, 14 Jan 2013 12:52:49 -0800 (PST)
Date: 2013-01-14T12:52:49-08:00	[thread overview]
Message-ID: <d3fc4db9-a940-47c2-91c3-84b457d733a4@googlegroups.com> (raw)
In-Reply-To: <c1d91828-3baf-4ed0-bef2-b3df1f49a824@googlegroups.com>

On Monday, January 14, 2013 12:21:38 PM UTC-8, Scott Loyd wrote:
> Hi all, 
> 
> This is probably a silly question but I have to ask. I have a large legacy application written primarily in Ada with some machine code for interfacing with an old 16 bit 1750A processor. I would like to take this code and execute it on 32 bit linux. I know that the machine code must be replaced. My question is for references to address types in the Ada code, is there a way to get around manually fixing all the record layout specifications and the like using a compiler configuration or pragma or (other)? Can I save a little work or do I need to brute force recode everything?
> 
> 
> 
> type A is record
>    Address : System.Address;
> end record;
> 
> for type A use record
>    -- Change this???
>    --Address at 0 range 0..15;
>    Address at 0 range 0..31
> end record;

I don't think you'll be able to get around changing everything.  If you give a representation clause for a record component that isn't big enough to hold the component, the program won't compile.  Maybe there's an Ada compiler with an option to ignore representation clauses, but I don't know of any.

The question I think you should ask, though, is: why do you need a representation clause?  Representation clauses are useful if the type will be communicated with the "outside" world--e.g. if it will be passed to a library routine not written in Ada, or perhaps written to a file where the format of the file is dictated by some other specification.  But if your program is doing that, then changing from a 16- to a 32-bit address type will cause other problems, since you'll be violating the specifications or the expectations of other programs or libraries that look at that record.  If those other programs or libraries, or outside specifications, have also changed, then it shouldn't be surprising that you'd need to change all the representation clauses.

On the other hand, if there aren't any "outside" programs or libraries or specifications dictating the format of the record, then maybe there's no good reason to have a representation clause, and you should consider just deleting them instead of changing them.  I really don't know.  I'd have to know more about the application, and I could have missed some reasons why a representation clause might be needed.

                         -- Adam 






  reply	other threads:[~2013-01-14 20:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 20:21 From 16 bit to 32 Scott Loyd
2013-01-14 20:52 ` Adam Beneschan [this message]
2013-01-14 21:09   ` Scott Loyd
2013-01-15 22:27     ` Stephen Leake
2013-01-15  0:14   ` Georg Bauhaus
2013-01-15  0:34     ` Adam Beneschan
2013-01-15  2:40       ` Jeffrey Carter
2013-01-15  0:44   ` Randy Brukardt
2013-01-15 14:40     ` Robert A Duff
2013-01-15 15:47       ` Scott Loyd
2013-01-15 19:12         ` J-P. Rosen
replies disabled

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