comp.lang.ada
 help / color / mirror / Atom feed
* And
@ 1998-07-21  0:00 Scott Sheffield
  1998-07-22  0:00 ` And Anonymous
  1998-07-22  0:00 ` And Jerry van Dijk
  0 siblings, 2 replies; 3+ messages in thread
From: Scott Sheffield @ 1998-07-21  0:00 UTC (permalink / raw)


I have a function that I am trying to convert for use on my PC using
adagide :

  function "and" (l,r : in system.unsigned_word)
	return system.unsigned_word
	renames system."and";

I do not have access to the system package that this code is trying to
call, but I have looked at the adagide system package and cannot find
the definition of unsigned_word. I understand I am overloading the
reserved word "and" but I am not clear as to the results. If I say tmp:=
a_unsigned_word and another_unsigned_word will I get a composite of
these two words or is this a boolean?I am new to Ada so forgive me if do
not seem very knowlegable but I'm trying.




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

* Re: And
  1998-07-21  0:00 And Scott Sheffield
@ 1998-07-22  0:00 ` Anonymous
  1998-07-22  0:00 ` And Jerry van Dijk
  1 sibling, 0 replies; 3+ messages in thread
From: Anonymous @ 1998-07-22  0:00 UTC (permalink / raw)


On Tue, 21 Jul 1998 14:29:43 -0500, Scott Sheffield
<sheffieldsy@lmtas.lmco.com> wrote:

> I have a function that I am trying to convert for use on my PC using
> adagide :
> 
>   function "and" (l,r : in system.unsigned_word)
> 	return system.unsigned_word
> 	renames system."and";
> ...

This looks like Ada 83. Ada 83 did not have much in the way of support
for unsigned integer types and bitwise Boolean operations on integer
types, so this compiler vendor supplied one or more
implementation-defined unsigned type in System, with bitwise Boolean
operations on it/them.

Ada (95) now provides for modular (unsigned) types with bitwise Boolean
operations defined for them. You may replace System.Unsigned_Word with
your own modular type; however, if you need a type that relates in some
way to the underlying hardware, you might want to use the types in
Interfaces, called Unsigned_n. Most compilers will define Unsigned_8,
Unsigned_16, and Unsigned_32 if such types make sense for the hardware.

As a wild guess, the above is probably equivalent to:

function "and" (L, R : Interfaces.Unsigned_16)
return Interfaces.Unsigned_16 renames Interfaces."and";

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"I fart in your general direction."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/





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

* Re: And
  1998-07-21  0:00 And Scott Sheffield
  1998-07-22  0:00 ` And Anonymous
@ 1998-07-22  0:00 ` Jerry van Dijk
  1 sibling, 0 replies; 3+ messages in thread
From: Jerry van Dijk @ 1998-07-22  0:00 UTC (permalink / raw)


Scott Sheffield (sheffieldsy@lmtas.lmco.com) wrote:

: I have a function that I am trying to convert for use on my PC using
: adagide :

:   function "and" (l,r : in system.unsigned_word)
: 	return system.unsigned_word
: 	renames system."and";

If you want to 'and' two 16-bit values use the unsigned type defined
in the Interfaces package (unsigned_32, unsigned16, unsigned_8)
than the 'and' operator is predefined for you.

or define them yourself, like

	type Unsigned_Word is mod 2 ** 16;
	for Unsigned_Word'Size use 16;

and also have the and operator thrown in for free.

Jerry.

-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk




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

end of thread, other threads:[~1998-07-22  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-21  0:00 And Scott Sheffield
1998-07-22  0:00 ` And Anonymous
1998-07-22  0:00 ` And Jerry van Dijk

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