comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: question re Ada equivalent of C function
Date: 1998/02/21
Date: 1998-02-21T00:00:00+00:00	[thread overview]
Message-ID: <dewar.888117126@merv> (raw)
In-Reply-To: 34EEFF9C.1D01FA5D@stellar1.com


David Fisher says

<<Sorry if this is a bit basic, but learning Ada on one's own can be, er,
challenging.

What are the Ada equivalents of the C functions, inp and outp, used to
read a byte from or send one to a memory address?

Thanks!

David Fisher
Fisher Research Corporation
>>


First there are no such functions in the C language. They are not even
standard Unix functions, but rather some idiosyncratic library functions
from DOS-like systems.

Second, they do not read and write to/from a memory address, but rather
they access ports on DOS-like systems that allow such port access (ports
are quite different from memory addresses, since they are defined int
the IO space of the machine, rather than the memory space).

Third, if you are on one of these systems and are writing Ada, and want
to do similar highly non-portable target dependent operations, then
there are two approaches:

1. Issue the necessary In/Out instructions directly using either package
Machine code, or, preferable if your compiler supports them, machine
language intrinsics (GNAT supports both styles, see GNAT manual for
details of use).

2. Simpler probably, though less efficient, just interface to the inp and
outp routines using the usual pragma Import (C, ...) mechanism.






  parent reply	other threads:[~1998-02-21  0:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-21  0:00 question re Ada equivalent of C function David Fisher
1998-02-21  0:00 ` Brian Rogoff
1998-02-21  0:00   ` Jerry van Dijk
1998-02-21  0:00     ` David Fisher
1998-02-22  0:00       ` Simon Wright
1998-02-22  0:00         ` Simon Wright
1998-02-22  0:00       ` Jerry van Dijk
1998-02-22  0:00         ` Robert Dewar
1998-02-22  0:00           ` Andi Kleen
1998-02-21  0:00   ` Robert Dewar
1998-02-22  0:00     ` Brian Rogoff
1998-02-22  0:00   ` Nick Roberts
1998-02-22  0:00     ` frc
1998-02-21  0:00 ` Corey Ashford
1998-02-22  0:00   ` Nick Roberts
1998-02-21  0:00 ` Robert Dewar [this message]
1998-02-22  0:00 ` Larry Kilgallen
1998-02-22  0:00   ` frc
1998-02-22  0:00     ` Linux/POSIX packages for GNAT Markus Kuhn
1998-02-22  0:00       ` Andi Kleen
1998-02-22  0:00         ` Markus Kuhn
1998-02-22  0:00           ` Robert Dewar
1998-02-22  0:00         ` Samuel Tardieu
1998-02-23  0:00           ` Nick Roberts
1998-02-23  0:00             ` Samuel Tardieu
1998-03-05  0:00             ` Testing exception handlers James M. Darlack
1998-02-22  0:00       ` Linux/POSIX packages for GNAT Robert Dewar
1998-02-23  0:00         ` Andi Kleen
1998-02-22  0:00           ` Robert Dewar
1998-02-23  0:00             ` Markus Kuhn
1998-02-23  0:00               ` Robert Dewar
1998-02-23  0:00         ` Markus Kuhn
1998-02-23  0:00           ` Robert Dewar
1998-02-23  0:00             ` Markus Kuhn
1998-02-24  0:00               ` question re Ada equivalent of C function Dale Stanbrough
1998-02-22  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