comp.lang.ada
 help / color / mirror / Atom feed
* Re: MMAP in ADA?
  1999-11-05  0:00 MMAP in ADA? Robert Jordan
@ 1999-11-04  0:00 ` David C. Hoos, Sr.
  1999-11-08  0:00   ` Nick Roberts
  1999-11-05  0:00 ` Robert Dewar
  1999-11-05  0:00 ` Samuel Tardieu
  2 siblings, 1 reply; 8+ messages in thread
From: David C. Hoos, Sr. @ 1999-11-04  0:00 UTC (permalink / raw)



Robert Jordan <robert.l.jordan@boeing.com> wrote in message
news:38223922.7763122E@boeing.com...
> Does ADA95 have anything equivalent to the Unix mmap() function?  I
> would like to create a simple cross process memory region to interface a
> tk gui (with a c front end) to a much larger ADA process for displaying
> screen oriented status and for issuing stringified commands to the ADA
> process.  I would like to use a filename as the common point so that
> each process can avoid any common knowledge of each other.
>
> And yes... I know I could just pragma import the unix mmap function, but
> I'm trying to avoid all imports in my ADA code (Per instruction).
>
> Thanks for any info,
> Robert

Well.... if you read your compiler's library code, you'll find they import
lots of stuff from the C runtime libraries.

I've done mmap in Ada83 on IRIX (4.01 through 6.2) with no problems, except
once
SGI changed some #defines in a header file, and we didn't have an automated
way to do the header translation, so we missed it.

The way we do it today is to use the IEEE-standard POSIX/Ada95 bindings
provided by Florida State University and supported by ACT.
Perhaps if it's genuine POSIX, and meets the requirements of the
IEEE-standard,
maybe the fact that underneath it's really imported will be acceptable to
your "instructor."








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

* Re: MMAP in ADA?
  1999-11-05  0:00 ` Robert Dewar
@ 1999-11-05  0:00   ` Robert Jordan
  1999-11-06  0:00     ` Robert Dewar
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Jordan @ 1999-11-05  0:00 UTC (permalink / raw)


I just found that out.  Apex doesn't implement Annex E and that's a
shame since I'm tasked with using Apex only.  

Robert Dewar wrote:

> In any case, GNAT is the only Ada 95 implementation that
> contains a full implementation of Annex E, so in practice
> you will be *more* portable using mmap directly here, not less.
> (also I don't think the GNAT implementation is what you want
> here in any case).
> 
> Robert Dewar
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

* MMAP in ADA?
@ 1999-11-05  0:00 Robert Jordan
  1999-11-04  0:00 ` David C. Hoos, Sr.
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Robert Jordan @ 1999-11-05  0:00 UTC (permalink / raw)


Does ADA95 have anything equivalent to the Unix mmap() function?  I
would like to create a simple cross process memory region to interface a
tk gui (with a c front end) to a much larger ADA process for displaying
screen oriented status and for issuing stringified commands to the ADA
process.  I would like to use a filename as the common point so that
each process can avoid any common knowledge of each other.

And yes... I know I could just pragma import the unix mmap function, but
I'm trying to avoid all imports in my ADA code (Per instruction).

Thanks for any info,
Robert




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

* Re: MMAP in ADA?
  1999-11-05  0:00 MMAP in ADA? Robert Jordan
  1999-11-04  0:00 ` David C. Hoos, Sr.
@ 1999-11-05  0:00 ` Robert Dewar
  1999-11-05  0:00   ` Robert Jordan
  1999-11-05  0:00 ` Samuel Tardieu
  2 siblings, 1 reply; 8+ messages in thread
From: Robert Dewar @ 1999-11-05  0:00 UTC (permalink / raw)


In article <38223922.7763122E@boeing.com>,
  Robert Jordan <robert.l.jordan@boeing.com> wrote:
> And yes... I know I could just pragma import the unix mmap
> function, but I'm trying to avoid all imports in my ADA code
> (Per instruction).

Obviously a function like mmap cannot be part of the Ada
language per se, since it is clearly not type safe. So you
are looking for a library function in any case.

I think you should interpret the ("per instruction") to mean
that if there is an Ada function that does what you want, you
should use it instead of importing something from C (everyone
in fact will agree with this, e.g. use an Ada protected type,
rather than import some target dependent operating systems
functions for doing low level locks, as you would have to
in C or C++).

But in a case like this, where you are talking about a facility
which is not going to be in *any* language (it is certainly not
part of C or C++), then you have to import it from a library
anyway. At that stage, it should make no difference to you or
to whomever is issuing your "instruction" whether the library
from which you are importing it is written in C, or whatever
other language.

Now there *is* a facility in Ada that *might* do some of what
mmap does in *certain* cases on *some* implementations, and
that is passive partitions. GNAT fully implements passive
partitions in a way that provides program to program
communication and persistance, but it does not use a shared
memory mechanism to do this.

In any case, GNAT is the only Ada 95 implementation that
contains a full implementation of Annex E, so in practice
you will be *more* portable using mmap directly here, not less.
(also I don't think the GNAT implementation is what you want
here in any case).

Robert Dewar


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: MMAP in ADA?
  1999-11-05  0:00 MMAP in ADA? Robert Jordan
  1999-11-04  0:00 ` David C. Hoos, Sr.
  1999-11-05  0:00 ` Robert Dewar
@ 1999-11-05  0:00 ` Samuel Tardieu
  2 siblings, 0 replies; 8+ messages in thread
From: Samuel Tardieu @ 1999-11-05  0:00 UTC (permalink / raw)
  To: Robert Jordan

>>>>> "Robert" == Robert Jordan <robert.l.jordan@boeing.com> writes:

Robert> And yes... I know I could just pragma import the unix mmap
Robert> function, but I'm trying to avoid all imports in my ADA code
Robert> (Per instruction).

How do you do this in C then? You cannot mmap() without leaving the C
language as you are using a library function and mmap() does not
belong to the C standard.

According to my Debian manpage, mmap() belongs to:

CONFORMING TO
       SVr4, POSIX.1b (formerly POSIX.4), 4.4BSD.  Svr4 documents
       additional error codes ENXIO and ENODEV.

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




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

* Re: MMAP in ADA?
  1999-11-05  0:00   ` Robert Jordan
@ 1999-11-06  0:00     ` Robert Dewar
  1999-11-08  0:00       ` Samuel T. Harris
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Dewar @ 1999-11-06  0:00 UTC (permalink / raw)


In article <382356F2.4E6FA7C9@boeing.com>,
  Robert Jordan <robert.l.jordan@boeing.com> wrote:
> I just found that out.  Apex doesn't implement Annex E and
> that's a shame since I'm tasked with using Apex only.

Well you could always use Apex with GNAT :-)

Actually as far as I know it is (surprisingly) the case that
GNAT is still the only Ada 95 compilation system to implement
the full Ada 95 language, and in particular, the only Ada 95
compilation system to implement Annex E.

That is why I indicated that this approach may not in practice
be portable to other compilers.

Robert Dewar
Ada Core Technologies


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: MMAP in ADA?
  1999-11-06  0:00     ` Robert Dewar
@ 1999-11-08  0:00       ` Samuel T. Harris
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel T. Harris @ 1999-11-08  0:00 UTC (permalink / raw)


Robert Dewar wrote:
> 
> In article <382356F2.4E6FA7C9@boeing.com>,
>   Robert Jordan <robert.l.jordan@boeing.com> wrote:
> > I just found that out.  Apex doesn't implement Annex E and
> > that's a shame since I'm tasked with using Apex only.
> 
> Well you could always use Apex with GNAT :-)
> 
> Actually as far as I know it is (surprisingly) the case that
> GNAT is still the only Ada 95 compilation system to implement
> the full Ada 95 language, and in particular, the only Ada 95
> compilation system to implement Annex E.
> 
> That is why I indicated that this approach may not in practice
> be portable to other compilers.
> 
> Robert Dewar
> Ada Core Technologies
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

Yes, the Apex RCI (Remote Compilation Integrator) is
powerful enough at incorporating the idiosyncracies
of other compilers that the choice of development
compiler is orthogonal to the choice of target compiler(s).

With Apex, you can support as many target compilers as
needed with a single development environment. This frees
the development group to pick target compilers based on
target needs (performance, customer preference, etc.).

-- 
Samuel T. Harris, Principal Engineer
Raytheon, Scientific and Technical Systems
"If you can make it, We can fake it!"




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

* Re: MMAP in ADA?
  1999-11-04  0:00 ` David C. Hoos, Sr.
@ 1999-11-08  0:00   ` Nick Roberts
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Roberts @ 1999-11-08  0:00 UTC (permalink / raw)


"David C. Hoos, Sr." wrote:
> ...
> The way we do it today is to use the IEEE-standard POSIX/Ada95 bindings
> provided by Florida State University and supported by ACT.
> Perhaps if it's genuine POSIX, and meets the requirements of the
> IEEE-standard,
> maybe the fact that underneath it's really imported will be acceptable to
> your "instructor."

Nevertheless, appease your 'instructor' (and Do The Right Thing) by
wrapping the imported 'mmap' function (and maybe other associated
functions) in a package.

Then, please, publish the specification (and preferably the body too) of
this package, so that those of us who will be implementing an Ada which
won't have recourse to UNIX functions can know how best to provide the
same functionality directly in Ada.

-- 
Nick Roberts
Computer Consultant (UK)
http://www.callnetuk.com/home/nickroberts
http://www.adapower.com/lab/adaos






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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-05  0:00 MMAP in ADA? Robert Jordan
1999-11-04  0:00 ` David C. Hoos, Sr.
1999-11-08  0:00   ` Nick Roberts
1999-11-05  0:00 ` Robert Dewar
1999-11-05  0:00   ` Robert Jordan
1999-11-06  0:00     ` Robert Dewar
1999-11-08  0:00       ` Samuel T. Harris
1999-11-05  0:00 ` Samuel Tardieu

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