comp.lang.ada
 help / color / mirror / Atom feed
From: Stuart Palin <stuart.palin@gecm.com>
To: Alan,Paterson,<paterson@dial.eunet.ch>
Subject: Re: DECAda/VMS - calling GETJPI
Date: 1996/06/03
Date: 1996-06-03T00:00:00+00:00	[thread overview]
Message-ID: <4ouo97$pe8@gcsin3.geccs.gecm.com> (raw)
In-Reply-To: 31B2AF74.668E@dial.eunet.ch



I've no specific experience of using DEC Ada with GETJPI but this looks very similar to the 
general problem Ada 83 has with unsigned integers.  Basically an unsigned type must be bound 
 by an integer range constraint (LRM 3.5.4 (3)). An unsigned longword usually creates a 
problem since the base type integer is also usally longword based.  This means the upper 
constarint on unsigned_longword is 2**32-1 which is not a valid integer expression 
(integer'last = 2**31-1).  Many implementations (certainly the version of DEC Ada I am 
using) gets around this by defining the unsigned_longword as:

   unsigned_longword is range -2**31..2**31-1;  -- or something equivalent

This creates all sorts of problems for defining values in the upper range (16#80000000# .. 
16#FFFFFFFF#) since they map on to negative values (but the bit image is correct!!).

A reasonable way of accessing these values is to define a constant:

    Hex_80000000 : constant unsigned_longword(-16#80000000#);

Now you can do things such as:

     ulong := Hex_80000000 + 16#456789AB#;

Now for your -1 value what you need to use is 16#FFFFFFFF#; (which is the bit image 
equivalent of the longword integer representation of -1); this could be defined as a 
constant:

    Hex_FFFFFFFF : constant unsigned_longword(-1);

though you will probably want to use a name more appropriate to your application.

-- 
Stuart Palin            |  GEC Marconi Avionics Ltd
Consultant Engineer     |  Airport Works
Flight Systems Division |  Rochester
G-NET 791 4197          |  Kent.  ME1 2XX






  reply	other threads:[~1996-06-03  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-03  0:00 DECAda/VMS - calling GETJPI Alan Paterson
1996-06-03  0:00 ` Stuart Palin [this message]
1996-06-03  0:00   ` Michael F Brenner
1996-06-03  0:00     ` Robert Dewar
1996-06-04  0:00       ` Ken Garlington
1996-06-06  0:00         ` Robert Dewar
1996-06-04  0:00       ` Michael F Brenner
1996-06-04  0:00         ` Robert Dewar
1996-06-04  0:00           ` Michael F Brenner
1996-06-04  0:00             ` Robert Dewar
1996-06-04  0:00             ` Robert Dewar
1996-06-05  0:00               ` Wraparound on modular conversion (was: DECAda/VMS - calling GETJPI) Tucker Taft
1996-06-05  0:00                 ` Robert Dewar
1996-06-05  0:00               ` DECAda/VMS - calling GETJPI Robert A Duff
1996-06-05  0:00                 ` Robert Dewar
1996-06-05  0:00               ` Fergus Henderson
1996-06-05  0:00                 ` Robert A Duff
1996-06-05  0:00             ` Adam Beneschan
1996-06-07  0:00               ` Norman H. Cohen
1996-06-11  0:00                 ` Adam Beneschan
1996-06-03  0:00 ` Mats Weber
1996-06-03  0:00 ` Ken Garlington
  -- strict thread matches above, loose matches on Subject: below --
1996-06-06  0:00 George Haddad
1996-06-07  0:00 ` Robert Dewar
replies disabled

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