From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: question re Ada equivalent of C function
Date: 1998/02/22
Date: 1998-02-22T00:00:00+00:00 [thread overview]
Message-ID: <01bd3f16$5006df60$LocalHost@xhv46.dial.pipex.com> (raw)
In-Reply-To: Pine.BSF.3.96.980221115827.17781A-100000@shell5.ba.best.com
In addition, if your Ada compiler supports machine code insertions, you
should be able to use these to provide the input/output functions you
require. Consult your compiler's documentation.
Note, however, that many processors these days enable normal (user
application) programs to be prevented from executing 'privileged'
instructions. With such a processor, the operating system may well decide
to stop your program from executing input/output instructions: in this
case, you will have to investigate your operating system's and/or
compiler's provisions for writing device drivers.
Also, of course, even if your program can't be stopped from executing
input/output instructions, executing them in the wrong circumstances could
interact badly with the operating system (or other software), unless you're
running on a 'bare' machine.
== Nick Roberts ================================================
== Croydon, UK ===========================
== ================
== Proprietor, ThoughtWing Software ==========
== Independent Software Development Consultant ======
== Nick.Roberts@dial.pipex.com ====
== Voicemail & Fax +44 181-405 1124 ===
== ==
== I live not in myself, but I become ==
=== Portion of that around me; and to me ==
==== High mountains are a feeling, but the hum ==
======= Of human cities torture.
=========== -- Byron [Childe Harold]
Brian Rogoff <bpr@shell5.ba.best.com> wrote in article
<Pine.BSF.3.96.980221115827.17781A-100000@shell5.ba.best.com>...
> On Sat, 21 Feb 1998, David Fisher wrote:
> > Sorry if this is a bit basic, but learning Ada on one's own can be, er,
> > challenging.
>
> You're never alone on comp.lang.ada! :-)
>
> > 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?
>
> Well, that depends. If you just want to reuse some C routines, I'd
suggest
> that you use Interfaces.C and just reuse them. Otherwise, you'll want to
> look at the System and System.Storage_Elements packages for what you
want.
> If you want to access a Character at some memory address, say
> 16#CAFEBABE#, you'd do something like this (boilerplate omitted)
>
> ...
> Mem_Addr : constant Address := To_Address(16#CAFEBABE#);
> Mem_Mapped_Char : Character;
> for Mem_Mapped_Char'Address use Mem_Addr;
> ...
>
> which is surprisingly self-explanatory.
next prev parent reply other threads:[~1998-02-22 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 ` Robert Dewar
1998-02-21 0:00 ` Corey Ashford
1998-02-22 0:00 ` Nick Roberts
1998-02-21 0:00 ` Brian Rogoff
1998-02-21 0:00 ` Robert Dewar
1998-02-22 0:00 ` Brian Rogoff
1998-02-21 0:00 ` Jerry van Dijk
1998-02-21 0:00 ` David Fisher
1998-02-22 0:00 ` Jerry van Dijk
1998-02-22 0:00 ` Robert Dewar
1998-02-22 0:00 ` Andi Kleen
1998-02-22 0:00 ` Simon Wright
1998-02-22 0:00 ` Simon Wright
1998-02-22 0:00 ` Nick Roberts [this message]
1998-02-22 0:00 ` frc
1998-02-22 0:00 ` Larry Kilgallen
1998-02-22 0:00 ` Robert Dewar
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 ` 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 Markus Kuhn
1998-02-22 0:00 ` Robert Dewar
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-24 0:00 ` question re Ada equivalent of C function Dale Stanbrough
1998-02-23 0:00 ` Linux/POSIX packages for GNAT Andi Kleen
1998-02-22 0:00 ` Robert Dewar
1998-02-23 0:00 ` Markus Kuhn
1998-02-23 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