comp.lang.ada
 help / color / mirror / Atom feed
From: mdisea!uw-coco!nwnexus!emagnuso@uunet.uu.net  (Erik Magnuson)
Subject: Re: changing the system package in VAX Ada
Date: 24 Jul 93 21:10:03 GMT	[thread overview]
Message-ID: <22s8fb$9vm@nwfocus.wa.com> (raw)

In article <1993Jul22.072929.1@perky.dasd.honeywell.com> tsorense@perky.dasd.ho
neywell.com (Todd A Sorensen) writes:
>Does anyone know how to get away with changing the system package in VAX
>Ada?  I want to make system.address an integer to make it compatible with
>our cross compiler for the i960 for documentation purposes (I need the
>analysis files for SCA).  -- 

Well, its probably too late now, but why perpetuate the distinctly
non-portable notion that an address <=> integer anyway? (It's obvious
that you're not using a 960MX if this is true for your 960 compiler!)
Make an (almost) abstract data type of System.Address. You can then
just change the body of the package to use the appropriate System or
compiler intrinsics (or fake the operations not provided by default.)
With inlining and optimization, there is no performance overhead.

Ours looks something like this:

with System;
package Address_Arithmetic is
   subtype Address_Type is System.Address;

   function "+" (Left : in Address_Type; Right : in Integer) 
	return Address_Type;

   -- etc, etc.

end Address_Arithmetic;

The only price you pay is an extra "with" here and there.
Now I won't claim this is the best wrapper you can design (should
address be derived?), but I've found that assuming that addresses are
integer types is one of the hardest issues to reconcile when porting
code to several different compilers/architectures.

>------------------------------------------------------------------------------
>Todd A Sorensen               Honeywell Defense Avionics Systems Division
>505-828-5611                  internet: tsorense@dasd.honeywell.com
>                              internet: tas@dasd.honeywell.com
>------------------------------------------------------------------------------
 
-- 
Erik

                 reply	other threads:[~1993-07-24 21:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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