comp.lang.ada
 help / color / mirror / Atom feed
* Universal Integer in TO_ADDRESS call
@ 1999-05-29  0:00 David Akister
  1999-05-29  0:00 ` Robert Dewar
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: David Akister @ 1999-05-29  0:00 UTC (permalink / raw)


I am trying to do a TO_ADDRESS type conversion while using XDADA. The two
parameter types supported by the compiler are {universal integer} and
ADDRESS_INT.

ADDRESS_INT is too short to be used and universal integer relies on  the
parameter being a named-number.

The existing code uses named numbers as constants without types in the
declaration. They of course adopt the universal integer and everything is
fine.

I need to modify the code and add offsets taken from an array to this value
and the compiler doesn't like it because the parameter is no longer of type
universal-integer. The way I understand it is that universal integer applies
to named-numbers only. Is it possible to declare any array of constants
which will adopt the universal integer type ? Or can anyone help with an
alternative ?

Any help much appreciated
Dave Akister







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

* Re: Universal Integer in TO_ADDRESS call
  1999-05-29  0:00 Universal Integer in TO_ADDRESS call David Akister
@ 1999-05-29  0:00 ` Robert Dewar
  1999-05-30  0:00 ` Vincent P. Amiot
  1999-06-06  0:00 ` Matthew Heaney
  2 siblings, 0 replies; 7+ messages in thread
From: Robert Dewar @ 1999-05-29  0:00 UTC (permalink / raw)


In article <375004b1@news.compd.com>,
  "David Akister" <dakister@compd.com> wrote:
> I am trying to do a TO_ADDRESS type conversion while using
> XDADA. The two parameter types supported by the compiler are
> {universal integer} and ADDRESS_INT.

Note that the use of universal integer here is a language
extension. In my opinion, a significant enough one that I
would hesitate to sign a declaration of conformance (it is
one place where GNAT refused to be exactly DEC Ada compatible)

> ADDRESS_INT is too short to be used and universal integer
> relies on  the parameter being a named-number.
>
> The existing code uses named numbers as constants without
> types in the declaration. They of course adopt the universal
> integer and everything is fine.
>
> I need to modify the code and add offsets taken from an array
> to this value and the compiler doesn't like it because the
> parameter is no longer of type universal-integer.

There is absolutely no way to solve this problem. Are you sure
that there is not another version of To_Address that takes a
longer integer? That is certainly the way it works on DEC Ada
83. The universal integer bogosity is there only to allow
unqualified constants to be used without causing ambiguities.

If you have a compiler where the ONLY form with full range is
universal integer, then that is a rather bad limitation I
would say, since as you have found out, there is no way around
it. Universal integer is not a first class citizen in the type
structure of Ada!


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

* Re: Universal Integer in TO_ADDRESS call
  1999-05-29  0:00 Universal Integer in TO_ADDRESS call David Akister
  1999-05-29  0:00 ` Robert Dewar
@ 1999-05-30  0:00 ` Vincent P. Amiot
  1999-05-30  0:00   ` Robert Dewar
  1999-06-06  0:00 ` Matthew Heaney
  2 siblings, 1 reply; 7+ messages in thread
From: Vincent P. Amiot @ 1999-05-30  0:00 UTC (permalink / raw)


the 'conversion' to universal integer is as follows:

	Integer'Pos (X)

Hope it pulls the trick for you ;-) ...

Regards

Vincent Amiot / Aonix
David Akister <dakister@compd.com> wrote in article
<375004b1@news.compd.com>...
> I am trying to do a TO_ADDRESS type conversion while using XDADA. The two
> parameter types supported by the compiler are {universal integer} and
> ADDRESS_INT.
> 
> ADDRESS_INT is too short to be used and universal integer relies on  the
> parameter being a named-number.
> 
> The existing code uses named numbers as constants without types in the
> declaration. They of course adopt the universal integer and everything is
> fine.
> 
> I need to modify the code and add offsets taken from an array to this
value
> and the compiler doesn't like it because the parameter is no longer of
type
> universal-integer. The way I understand it is that universal integer
applies
> to named-numbers only. Is it possible to declare any array of constants
> which will adopt the universal integer type ? Or can anyone help with an
> alternative ?
> 
> Any help much appreciated
> Dave Akister
> 
> 
> 
> 




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

* Re: Universal Integer in TO_ADDRESS call
  1999-05-30  0:00 ` Vincent P. Amiot
@ 1999-05-30  0:00   ` Robert Dewar
  1999-05-30  0:00     ` David Akister
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Dewar @ 1999-05-30  0:00 UTC (permalink / raw)


In article <01beaa3e$0e05fbc0$9b2bb6c7@alesia>,
  "Vincent P. Amiot" <godzilla@mozilla.com> wrote:
> the 'conversion' to universal integer is as follows:
>
> 	Integer'Pos (X)
>
> Hope it pulls the trick for you ;-) ...
>
> Regards
>
> Vincent Amiot / Aonix

Right, I missed this possibility, but Vincent is absolutely
right, this should work. It is very peculiar code, hard to
imagine any normal Ada situation where one would want this
conversion, but here it may be just the ticket. Note that
you can do this with any integer type.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

* Re: Universal Integer in TO_ADDRESS call
  1999-05-30  0:00   ` Robert Dewar
@ 1999-05-30  0:00     ` David Akister
  1999-05-31  0:00       ` Robert Dewar
  0 siblings, 1 reply; 7+ messages in thread
From: David Akister @ 1999-05-30  0:00 UTC (permalink / raw)


Thanks very much for that chaps.
It does seem bizarre that address conversion on this XDADA compiler is
limited to an short integer type - which is too small for most applications,
and the universal type which loses it universalness (made up word!) when
manipulated in any way....
Oh well INTEGER'POS it is then. DEC ADA which is the host compiler is more
fun with its UNSIGNED_LONGWORD.
Thanks a lot
--
David Akister
Wellgate Technology Ltd
Software Development & Computer Book Specialist
Robert Dewar <robert_dewar@my-deja.com> wrote in message
news:7iqblm$30j$1@nnrp1.deja.com...
> In article <01beaa3e$0e05fbc0$9b2bb6c7@alesia>,
>   "Vincent P. Amiot" <godzilla@mozilla.com> wrote:
> > the 'conversion' to universal integer is as follows:
> >
> > Integer'Pos (X)
> >
> > Hope it pulls the trick for you ;-) ...
> >
> > Regards
> >
> > Vincent Amiot / Aonix
>
> Right, I missed this possibility, but Vincent is absolutely
> right, this should work. It is very peculiar code, hard to
> imagine any normal Ada situation where one would want this
> conversion, but here it may be just the ticket. Note that
> you can do this with any integer type.
>
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.






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

* Re: Universal Integer in TO_ADDRESS call
  1999-05-30  0:00     ` David Akister
@ 1999-05-31  0:00       ` Robert Dewar
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Dewar @ 1999-05-31  0:00 UTC (permalink / raw)


In article <7isc5p$2ql$1@lure.pipex.net>,
  "David Akister" <wellgate@dial.pipex.com> wrote:
> Thanks very much for that chaps.
> It does seem bizarre that address conversion on this XDADA
compiler is
> limited to an short integer type - which is too small for most
applications,
> and the universal type which loses it universalness (made up
word!) when
> manipulated in any way....
> Oh well INTEGER'POS it is then. DEC ADA which is the host
compiler is more
> fun with its UNSIGNED_LONGWORD.
> Thanks a lot

Sounds like the result of a rather bizarre subsetting of the
original DEC Ada 83 design. After all the only reason for
the universal_integer trick in DEC Ada 83 is to get around
the ambiguities that are introduced by having the function
defined on two different integer types.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

* Re: Universal Integer in TO_ADDRESS call
  1999-05-29  0:00 Universal Integer in TO_ADDRESS call David Akister
  1999-05-29  0:00 ` Robert Dewar
  1999-05-30  0:00 ` Vincent P. Amiot
@ 1999-06-06  0:00 ` Matthew Heaney
  2 siblings, 0 replies; 7+ messages in thread
From: Matthew Heaney @ 1999-06-06  0:00 UTC (permalink / raw)


"David Akister" <dakister@compd.com> writes:

> I am trying to do a TO_ADDRESS type conversion while using XDADA. The two
> parameter types supported by the compiler are {universal integer} and
> ADDRESS_INT.
> 
> ADDRESS_INT is too short to be used and universal integer relies on  the
> parameter being a named-number.
> 
> The existing code uses named numbers as constants without types in the
> declaration. They of course adopt the universal integer and everything is
> fine.
> 
> I need to modify the code and add offsets taken from an array to this value
> and the compiler doesn't like it because the parameter is no longer of type
> universal-integer. The way I understand it is that universal integer applies
> to named-numbers only. Is it possible to declare any array of constants
> which will adopt the universal integer type ? Or can anyone help with an
> alternative ?
> 
> Any help much appreciated


One trick I use from time to time is T'Pos, which turns a specific
integer type into universal int.  I don't know if it will help you here,
though.





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

end of thread, other threads:[~1999-06-06  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-29  0:00 Universal Integer in TO_ADDRESS call David Akister
1999-05-29  0:00 ` Robert Dewar
1999-05-30  0:00 ` Vincent P. Amiot
1999-05-30  0:00   ` Robert Dewar
1999-05-30  0:00     ` David Akister
1999-05-31  0:00       ` Robert Dewar
1999-06-06  0:00 ` Matthew Heaney

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