comp.lang.ada
 help / color / mirror / Atom feed
* socket, pipe
@ 2003-11-04 14:45 ghostie
  2003-11-04 15:14 ` Ole-Hjalmar Kristensen
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: ghostie @ 2003-11-04 14:45 UTC (permalink / raw)


I'm quite the Ada newbie.  I'm really a C++ programmer.  But I've been
tasked with making a change to an Ada application that we have, and
would appreciate some help getting started.  Please be patient.

We want our Ada application, while running, to share a lot of binary
information with a different application, this one written in Matlab. 
Each applicaton will produce output data which will be used by the
other application. Both applications will run on Win2K PCs, and they
may or may not be on the same computer.

Is this possible?  What would be the best way to do it?  I've tried
looking up some information but to be honest, I don't understand the
difference between pipes and sockets and Overlapped I/O and whatever
else is available, let alone if it is possible to do these things in
Ada.  All the information I'm finding is either Unix-oriented, or else
it assumes a moderate level of knowledge (which I don't have).
My Ada compiler is DACS 4.7.15d.

TIA



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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
@ 2003-11-04 15:14 ` Ole-Hjalmar Kristensen
  2003-11-04 15:33 ` Marius Amado Alves
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 22+ messages in thread
From: Ole-Hjalmar Kristensen @ 2003-11-04 15:14 UTC (permalink / raw)


>>>>> "g" == ghostie  <eieio@coastalnet.com> writes:

    g> I'm quite the Ada newbie.  I'm really a C++ programmer.  But I've been
    g> tasked with making a change to an Ada application that we have, and
    g> would appreciate some help getting started.  Please be patient.

    g> We want our Ada application, while running, to share a lot of binary
    g> information with a different application, this one written in Matlab. 
    g> Each applicaton will produce output data which will be used by the
    g> other application. Both applications will run on Win2K PCs, and they
    g> may or may not be on the same computer.

    g> Is this possible?  What would be the best way to do it?  I've tried
    g> looking up some information but to be honest, I don't understand the
    g> difference between pipes and sockets and Overlapped I/O and whatever
    g> else is available, let alone if it is possible to do these things in
    g> Ada.  All the information I'm finding is either Unix-oriented, or else
    g> it assumes a moderate level of knowledge (which I don't have).
    g> My Ada compiler is DACS 4.7.15d.

    g> TIA

First, you can call any C function from Ada by importing it, so you
can always solve the problem the same way you would approach it in C.

Probably the toughest decision is how to actually share the binary
data between Matlab and Ada (or C). If you can get your applications
to read and write a common format, this can be used for sharing,
either via files or the network.
What about simply writing tha data to file and share the files?

The Distributed Systems Annex can be used for sharing data between Ada
applications running on different computers if you have an
implementation of it for your compiler. Otherwise, you can exchange
your data with sockets or COM/DCOM. The AdaSockets package makes it
relatively easy to build Ada applications which use sockets. Don't
know if it works with your compiler, though.

-- 
Strange attractors stole my wife



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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
  2003-11-04 15:14 ` Ole-Hjalmar Kristensen
@ 2003-11-04 15:33 ` Marius Amado Alves
  2003-11-04 17:45   ` Warren W. Gay VE3WWG
  2003-11-04 18:48 ` John Woodruff
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Marius Amado Alves @ 2003-11-04 15:33 UTC (permalink / raw)
  To: comp.lang.ada

Pipes and sockets are often used for inter-application communication.
There are Ada libraries for sockets. Alternatively, you can use the
Distributed Systems Annex of Ada--if you compiler supports it. 





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

* Re: socket, pipe
  2003-11-04 15:33 ` Marius Amado Alves
@ 2003-11-04 17:45   ` Warren W. Gay VE3WWG
  0 siblings, 0 replies; 22+ messages in thread
From: Warren W. Gay VE3WWG @ 2003-11-04 17:45 UTC (permalink / raw)


Marius Amado Alves wrote:

> Pipes and sockets are often used for inter-application communication.
> There are Ada libraries for sockets. Alternatively, you can use the
> Distributed Systems Annex of Ada--if you compiler supports it. 

The solution you end up with may also depend upon some other
factors:

  - What compiler you are using? GNAT/Other?
  - Can FLORIST be used?
  - How portable must the solution be?

-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
  2003-11-04 15:14 ` Ole-Hjalmar Kristensen
  2003-11-04 15:33 ` Marius Amado Alves
@ 2003-11-04 18:48 ` John Woodruff
  2003-11-05  3:27 ` Steve
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 22+ messages in thread
From: John Woodruff @ 2003-11-04 18:48 UTC (permalink / raw)


eieio@coastalnet.com (ghostie) wrote in message news:<56a4b188.0311040645.64f825f7@posting.google.com>...
> I'm quite the Ada newbie.  I'm really a C++ programmer.  But I've been
> tasked with making a change to an Ada application that we have, and
> would appreciate some help getting started.  Please be patient.
> 
> We want our Ada application, while running, to share a lot of binary
> information with a different application, this one written in Matlab. 
> Each applicaton will produce output data which will be used by the
> other application. Both applications will run on Win2K PCs, and they
> may or may not be on the same computer.


The issue I would decide first is whether data transport through a
file is adequate.  If yes, life will be much easier, since each
application stands alone and the intermediate file can be examined
carefully to assure that the interface is met.  However, this will be
somewhat slower, so might not meet performance req's.

If file transport is OK, then Ada IO using sequential_io should be
fairly straightforward.

However if the communication is bi-directional, or "real" time linkage
is required, then you will have to communicate between the processes. 
What is the interface that the Matlab app defines?  The incoming data
structure defined by the Matlab program can be described in Ada using
"representation clauses" to assure that the parameters sent by Ada to
Matlab conform to the spec.

One more prospect:  could the Matlab app be encapsulated into a
CORBA-compliant program?  If so, then you could define the interface
in CORBA IDL, and let the IDL-generated interface *in each language*
solve the issue of parameter types.

In my opinion, using the direct connection through pipes (for example)
is the most demanding because of the difficulty of matching the
calling conventions of the two language compilers *exactly*.  (Failing
to match exactly will cause obscure crashes in the invoked program; 
the practical fix for this is long hours at the debugger and
painstaking care with representation clauses.)

Best
John



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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
                   ` (2 preceding siblings ...)
  2003-11-04 18:48 ` John Woodruff
@ 2003-11-05  3:27 ` Steve
  2003-11-05  5:24   ` tmoran
  2003-11-05  9:44 ` Pascal Obry
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Steve @ 2003-11-05  3:27 UTC (permalink / raw)


In anser to the big questions: Is it possible?  Absolutely.

We have Ada applications running in industrial automation applications with
multiple applications exchanging information using TCP/IP sockets.  In our
system, some applications are written in Ada 95, some are written in
Borland's Delphi, some are written in MS Visual C++, some are written in
EPascal running under VAX ELN on a VAX workstation, we even have some
written in C running under VxWorks on a motorola 68k processor.

There is obviously more than one approach you could take for your
application.  We chose to use TCP/IP sockets for our application since we
are operating in a heterogeneous environment (not all systems are running
windows), and TCP/IP is standard across platforms.

Since you are only dealing with windows you might also choose to use pipes
or DCOM.  I don't have any experience with DCOM, but I know that it stands
for "Distributed Common Object Model" and provides a mechanism for
seamlessly sharing information across networsk.  If you want to look into
using DCOM go to www.adapower.com and look into GNATCOM.

If you choose to use sockets, things will work pretty much the way the
documentation for Unix describes, but you'll need to add a call to
"WSAStartup" before you try any of the other calls or nothing will work.
When your application shuts down there is a similar call (I think its
WSAShutdown).

In our application we use streaming sockets.  With streaming sockets the
underlying protocol handles retransmission and out of order delivery to make
things look nice and simple for our application.  The data just looks like a
stream of bytes.

One gotcha's that caught me is the operation of "send" and "recv".  Since
we're using sockets in "blocking" mode I expected the "recv" function to
wait until all of the characters I asked for showed up.  That is NOT the way
it works.  When you issue a recv call asking for a number of characters, the
recv function may return before all of the characters have been read.  The
recv call returns how many characters were actually read.  You have to keep
calling recv until you get all of the data you're looking for.  The same
principle applies to the "send".

Other than these few stumbling blocks, getting sockets to work was pretty
easy.

I haven't really answered your question about the "best" way to do it, but
hopefully I've helped in describing one way.

Steve
(The Duck)

"ghostie" <eieio@coastalnet.com> wrote in message
news:56a4b188.0311040645.64f825f7@posting.google.com...
> I'm quite the Ada newbie.  I'm really a C++ programmer.  But I've been
> tasked with making a change to an Ada application that we have, and
> would appreciate some help getting started.  Please be patient.
>
> We want our Ada application, while running, to share a lot of binary
> information with a different application, this one written in Matlab.
> Each applicaton will produce output data which will be used by the
> other application. Both applications will run on Win2K PCs, and they
> may or may not be on the same computer.
>
> Is this possible?  What would be the best way to do it?  I've tried
> looking up some information but to be honest, I don't understand the
> difference between pipes and sockets and Overlapped I/O and whatever
> else is available, let alone if it is possible to do these things in
> Ada.  All the information I'm finding is either Unix-oriented, or else
> it assumes a moderate level of knowledge (which I don't have).
> My Ada compiler is DACS 4.7.15d.
>
> TIA





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

* Re: socket, pipe
  2003-11-05  3:27 ` Steve
@ 2003-11-05  5:24   ` tmoran
  0 siblings, 0 replies; 22+ messages in thread
From: tmoran @ 2003-11-05  5:24 UTC (permalink / raw)


>documentation for Unix describes, but you'll need to add a call to
>"WSAStartup" before you try any of the other calls or nothing will work.
>When your application shuts down there is a similar call (I think its
>WSAShutdown).
  If you're using Windows you could use Claw-style sockets (either the
version that comes with the $0 Claw, or the version that doesn't need Claw
at all).  It uses a hidden controlled type to automagically do WSAStartup
and WSACleanup.

>One gotcha's that caught me is the operation of "send" and "recv".  Since
>we're using sockets in "blocking" mode I expected the "recv" function to
>wait until all of the characters I asked for showed up.  That is NOT the way
  Claw lets you read/write with Strings, or Ada.Streams style, or by
instantiating a generic with a record (like Sequential_IO), or mixtures.



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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
                   ` (3 preceding siblings ...)
  2003-11-05  3:27 ` Steve
@ 2003-11-05  9:44 ` Pascal Obry
  2003-11-05 12:31 ` Marin David Condic
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 22+ messages in thread
From: Pascal Obry @ 2003-11-05  9:44 UTC (permalink / raw)



eieio@coastalnet.com (ghostie) writes:

> Is this possible?  

Yes.

> What would be the best way to do it?

It depends on the support on both sides. If Mathlab does support SOAP Web
Services you could use AWS on the Ada side for example.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
                   ` (4 preceding siblings ...)
  2003-11-05  9:44 ` Pascal Obry
@ 2003-11-05 12:31 ` Marin David Condic
  2003-11-05 14:50   ` Steve
  2003-11-05 15:19   ` Steve
  2003-11-05 13:45 ` ghostie
  2003-11-05 13:54 ` ghostie
  7 siblings, 2 replies; 22+ messages in thread
From: Marin David Condic @ 2003-11-05 12:31 UTC (permalink / raw)


First, it always helps if you can identify your compiler & OS version 
since not all features are present in all places.

For dealing with raw binary data, you probably want to investigate 
Ada.Streams. See your Ada Reference Manual or textbook on that. (Plenty 
of resources on-line) Its the way Ada tends to like to deal with raw 
arrays of bytes and you get plenty of facilities for getting 
"structured" data in and out of them. Streams can be connected up to 
pipes or sockets and there are ways of reading/writing files as well, so 
  they give you lots of choices.

As for the communication link, as other observe, you have lots of 
options. Some compilers have an interface called Win32Ada which will 
give you access to all of the OS calls you'd need to work with Windows. 
If you're already a Windows programmer, it will all look familiar. From 
there, you could use pipes or sockets or any of the usual Windows 
mechanisms. If you don't want to go to that low level (who would?) there 
are lots of packages (mentioned elsewhere, but none of them "Standard" 
as part of Ada) to do things like provide a clean interface to sockets 
or DCOM or whatever you're most familiar with. Depending on exactly what 
you're trying to accomplish, there would be advantages and disadvantages 
for any given approach. I tend to favor sockets because it means you can 
run the apps on any machines you have and the TCP/IP thing tends to be 
portable. Other approaches might be equally (or reasonably) portable, 
but it depends a lot on what you have at the other end.

If you're looking for resources to get the job done, keep asking here 
and someone can likely point you at some freebie (or low cost) code that 
will do what you need. Check the Ada websites for libraries and 
textbooks/tutorials. Lots of help is available at no cost. (Two big ones 
are: http://www.adapower.com/ and http://www.adaworld.com/)

MDC


ghostie wrote:
> I'm quite the Ada newbie.  I'm really a C++ programmer.  But I've been
> tasked with making a change to an Ada application that we have, and
> would appreciate some help getting started.  Please be patient.
> 
> We want our Ada application, while running, to share a lot of binary
> information with a different application, this one written in Matlab. 
> Each applicaton will produce output data which will be used by the
> other application. Both applications will run on Win2K PCs, and they
> may or may not be on the same computer.
> 
> Is this possible?  What would be the best way to do it?  I've tried
> looking up some information but to be honest, I don't understand the
> difference between pipes and sockets and Overlapped I/O and whatever
> else is available, let alone if it is possible to do these things in
> Ada.  All the information I'm finding is either Unix-oriented, or else
> it assumes a moderate level of knowledge (which I don't have).
> My Ada compiler is DACS 4.7.15d.
> 
> TIA


-- 
======================================================================
Marin David Condic
I work for: http://www.belcan.com/
My project is: http://www.jsf.mil/NSFrames.htm

Send Replies To: m   o   d   c @ a   m   o   g
                    c   n   i       c   .   r

     "So if I understand 'The Matrix Reloaded' correctly, the Matrix is
     basically a Microsoft operating system - it runs for a while and
     then crashes and reboots. By design, no less. Neo is just a
     memory leak that's too hard to fix, so they left him in... The
     users don't complain because they're packed in slush and kept
     sedated"

         --  Marin D. Condic
======================================================================




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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
                   ` (5 preceding siblings ...)
  2003-11-05 12:31 ` Marin David Condic
@ 2003-11-05 13:45 ` ghostie
  2003-11-05 18:54   ` ghostie
  2003-11-05 20:18   ` Martin Dowie
  2003-11-05 13:54 ` ghostie
  7 siblings, 2 replies; 22+ messages in thread
From: ghostie @ 2003-11-05 13:45 UTC (permalink / raw)


eieio@coastalnet.com (ghostie) wrote in message news:<56a4b188.0311040645.64f825f7@posting.google.com>...
> We want our Ada application, while running, to share a lot of binary
> information with a different application, this one written in Matlab. 
> Each applicaton will produce output data which will be used by the
> other application. Both applications will run on Win2K PCs, and they
> may or may not be on the same computer.
>

Thanks for all the help.
What I've decided to try is to have one application write a file to
disk, and the other application will read the file from the disk.  I
want the file to be written and closed by the first app before the
other app tries to read it.  A method I've seen done before for this
uses two separate directories; after a file is ready to read, its
filename gets placed in a separate directory as a zero-length file. 
So, if you find a file name in this 2nd directory, you know that same
filename is ready for you to read in the 1st directory.

So the next thing I'm stuck on is how to do a directory listing from
Ada.  I guess either calling a system call or if there's actually an
Ada call for this, but I need to be able to use the results in order
to know what files are in a directory.

Thanks again



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

* Re: socket, pipe
  2003-11-04 14:45 socket, pipe ghostie
                   ` (6 preceding siblings ...)
  2003-11-05 13:45 ` ghostie
@ 2003-11-05 13:54 ` ghostie
  2003-11-05 14:26   ` Marius Amado Alves
  2003-11-05 23:55   ` Jacob Sparre Andersen
  7 siblings, 2 replies; 22+ messages in thread
From: ghostie @ 2003-11-05 13:54 UTC (permalink / raw)


I should have added that I've found posts indicating how to do a
directory listing using GNAT libraries, but I don't use GNAT.  I use
DACS.



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

* Re: socket, pipe
  2003-11-05 13:54 ` ghostie
@ 2003-11-05 14:26   ` Marius Amado Alves
  2003-11-05 23:55   ` Jacob Sparre Andersen
  1 sibling, 0 replies; 22+ messages in thread
From: Marius Amado Alves @ 2003-11-05 14:26 UTC (permalink / raw)
  To: comp.lang.ada

On Wed, 2003-11-05 at 13:54, ghostie wrote:
> I should have added that I've found posts indicating how to do a
> directory listing using GNAT libraries, but I don't use GNAT.  I use
> DACS.

If DACS does not have directory operations, you can always use a file in
the place of a directory (i.e. a file which lists the filenames and
whose name all applications know beforehand).

Note that with any kind of directory operations (provided by DACS or by
your self) you may run into concurrency problems.




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

* Re: socket, pipe
  2003-11-05 12:31 ` Marin David Condic
@ 2003-11-05 14:50   ` Steve
  2003-11-05 15:19   ` Steve
  1 sibling, 0 replies; 22+ messages in thread
From: Steve @ 2003-11-05 14:50 UTC (permalink / raw)


"Marin David Condic" <nobody@noplace.com> wrote in message
news:3FA8ED93.9040607@noplace.com...
> First, it always helps if you can identify your compiler & OS version
> since not all features are present in all places.
>

It also helps if you read the original post responding.  The original post
indicates:

  "Both applications will run on Win2K PCs"
  -and-
  "My Ada compiler is DACS 4.7.15d."

Steve
(The Duck)

[snip]





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

* Re: socket, pipe
  2003-11-05 12:31 ` Marin David Condic
  2003-11-05 14:50   ` Steve
@ 2003-11-05 15:19   ` Steve
  1 sibling, 0 replies; 22+ messages in thread
From: Steve @ 2003-11-05 15:19 UTC (permalink / raw)


"Marin David Condic" <nobody@noplace.com> wrote in message
news:3FA8ED93.9040607@noplace.com...
> First, it always helps if you can identify your compiler & OS version
> since not all features are present in all places.
>

It also helps if you read the original post responding.  The original post
indicates:

  "Both applications will run on Win2K PCs"
  -and-
  "My Ada compiler is DACS 4.7.15d."

Steve
(The Duck)

[snip]





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

* RE: socket, pipe
@ 2003-11-05 18:49 Beard, Frank Randolph CIV
  0 siblings, 0 replies; 22+ messages in thread
From: Beard, Frank Randolph CIV @ 2003-11-05 18:49 UTC (permalink / raw)
  To: ghostie, comp.lang.ada

Since the source is available for GNAT, you could always
look at it to see how it's done.

Another option is to use Pascal Obry's Windows 32 POSIX
packages.  You can find them under Software for Reuse
at www.adapower.com (though I can't seem to get to right
now).  And again, if you don't want to use the POSIX
approach.  Just look at the code to see how it's done.
It's in the body of POSIX_Files.  The procedure is called
For_Every_Directory_Entry.

Frank


-----Original Message-----
From: ghostie [mailto:eieio@coastalnet.com]

I should have added that I've found posts indicating how to do a
directory listing using GNAT libraries, but I don't use GNAT.  I use
DACS.



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

* Re: socket, pipe
  2003-11-05 13:45 ` ghostie
@ 2003-11-05 18:54   ` ghostie
  2003-11-05 20:41     ` Robert Spooner
  2003-11-05 20:18   ` Martin Dowie
  1 sibling, 1 reply; 22+ messages in thread
From: ghostie @ 2003-11-05 18:54 UTC (permalink / raw)


Could it be that these solutions require Ada 95, and I only have Ada
83?  For instance, I don't seem to have a "pragma import" that I can
use for a C call. It's not in documentation and I get these errors
when I try to use it:
*** 50W-8: Pragma IMPORT is unknown to the current implementation
*** 34W-8: Pragma IMPORT ignored

I've also found some sample files that I can't even come close to
getting to compile, I wonder if it's the same problem (old version)? 
For instance, my compiler won't even accept this:
with Ada.Text_IO;



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

* RE: socket, pipe
@ 2003-11-05 19:43 Beard, Frank Randolph CIV
  2003-11-05 21:14 ` tmoran
  0 siblings, 1 reply; 22+ messages in thread
From: Beard, Frank Randolph CIV @ 2003-11-05 19:43 UTC (permalink / raw)
  To: ghostie, comp.lang.ada

Yep, that's a problem.  Most of what you're going to find is,
or has been updated to, Ada 95.  Ada 95 is, for the most part,
backwards compatible with Ada 83, and of course Ada 83 will not
recognize the additions to the language.  Hierarchical library
units were added to Ada 95.  Pragma Import replaced Pragma
Interface.

You could take the Win32 bindings, take only the part you need
from it, retrofit it to Ada 83, and then put it in your own small
binding package.

Frank

-----Original Message-----
From: ghostie [mailto:eieio@coastalnet.com]
Sent: Wednesday, November 05, 2003 13:54
To: comp.lang.ada@ada-france.org
Subject: Re: socket, pipe


Could it be that these solutions require Ada 95, and I only have Ada
83?  For instance, I don't seem to have a "pragma import" that I can
use for a C call. It's not in documentation and I get these errors
when I try to use it:
*** 50W-8: Pragma IMPORT is unknown to the current implementation
*** 34W-8: Pragma IMPORT ignored

I've also found some sample files that I can't even come close to
getting to compile, I wonder if it's the same problem (old version)? 
For instance, my compiler won't even accept this:
with Ada.Text_IO;
_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada-france.org
http://www.ada-france.org/mailman/listinfo/comp.lang.ada



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

* Re: socket, pipe
  2003-11-05 13:45 ` ghostie
  2003-11-05 18:54   ` ghostie
@ 2003-11-05 20:18   ` Martin Dowie
  2003-11-05 20:23     ` Martin Dowie
  1 sibling, 1 reply; 22+ messages in thread
From: Martin Dowie @ 2003-11-05 20:18 UTC (permalink / raw)


"ghostie" <eieio@coastalnet.com> wrote in message
news:56a4b188.0311050545.77dc9cdf@posting.google.com...
> Thanks for all the help.
> What I've decided to try is to have one application write a file to
> disk, and the other application will read the file from the disk.  I
> want the file to be written and closed by the first app before the
> other app tries to read it.  A method I've seen done before for this
> uses two separate directories; after a file is ready to read, its
> filename gets placed in a separate directory as a zero-length file.
> So, if you find a file name in this 2nd directory, you know that same
> filename is ready for you to read in the 1st directory.
>
> So the next thing I'm stuck on is how to do a directory listing from
> Ada.  I guess either calling a system call or if there's actually an
> Ada call for this, but I need to be able to use the results in order
> to know what files are in a directory.

The "Ada.Directories" package is being added for the next revision
(nearly...).
You can pick up a version of this at my web site (using an "Ada0Y" root). It
was developed on WinXP and has also been tested on WinNT. It should do
all you need.

www.martin.dowie.btinternet.co.uk

-- Martin





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

* Re: socket, pipe
  2003-11-05 20:18   ` Martin Dowie
@ 2003-11-05 20:23     ` Martin Dowie
  0 siblings, 0 replies; 22+ messages in thread
From: Martin Dowie @ 2003-11-05 20:23 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@btopenworld.com> wrote in message
news:boblvh$bqs$1@sparta.btinternet.com...
> > So the next thing I'm stuck on is how to do a directory listing from
> > Ada.  I guess either calling a system call or if there's actually an
> > Ada call for this, but I need to be able to use the results in order
> > to know what files are in a directory.
>
> The "Ada.Directories" package is being added for the next revision

Ah, rats - just saw your other post about the DACS compiler...

Don't suppose there is any chance you could get a "new" compiler? ;-)





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

* Re: socket, pipe
  2003-11-05 18:54   ` ghostie
@ 2003-11-05 20:41     ` Robert Spooner
  0 siblings, 0 replies; 22+ messages in thread
From: Robert Spooner @ 2003-11-05 20:41 UTC (permalink / raw)
  To: ghostie

Look at pragma interface for Ada 83, or better yet, download the free 
GNAT Ada 95 compiler for Windows 2K.

Bob

ghostie wrote:
> Could it be that these solutions require Ada 95, and I only have Ada
> 83?  For instance, I don't seem to have a "pragma import" that I can
> use for a C call. It's not in documentation and I get these errors
> when I try to use it:
> *** 50W-8: Pragma IMPORT is unknown to the current implementation
> *** 34W-8: Pragma IMPORT ignored
> 
> I've also found some sample files that I can't even come close to
> getting to compile, I wonder if it's the same problem (old version)? 
> For instance, my compiler won't even accept this:
> with Ada.Text_IO;

-- 
                             Robert L. Spooner
                      Registered Professional Engineer
                        Associate Research Engineer
                   Intelligent Control Systems Department

          Applied Research Laboratory        Phone: (814) 863-4120
          The Pennsylvania State University  FAX:   (814) 863-7841
          P. O. Box 30
          State College, PA 16804-0030       rls19@psu.edu




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

* RE: socket, pipe
  2003-11-05 19:43 Beard, Frank Randolph CIV
@ 2003-11-05 21:14 ` tmoran
  0 siblings, 0 replies; 22+ messages in thread
From: tmoran @ 2003-11-05 21:14 UTC (permalink / raw)


>You could take the Win32 bindings, take only the part you need
>from it, retrofit it to Ada 83,
  If disk files will do the job, they are certainly the easiest,
and probably easiest to debug, way to go.  Program A can create a
file with known name, eg "from_A_to_B", and program B can periodically
check if there's a file by that name by simply attempting to open it.



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

* Re: socket, pipe
  2003-11-05 13:54 ` ghostie
  2003-11-05 14:26   ` Marius Amado Alves
@ 2003-11-05 23:55   ` Jacob Sparre Andersen
  1 sibling, 0 replies; 22+ messages in thread
From: Jacob Sparre Andersen @ 2003-11-05 23:55 UTC (permalink / raw)


ghostie wrote:

> I should have added that I've found posts indicating how to do a
> directory listing using GNAT libraries, but I don't use GNAT.  I use
> DACS.

If DACS supports interfacing to C, then there is a fair chance that you 
can get GNAT.OS_Lib to work with it.

Using a POSIX library implementation such as Florist is an alternative, 
which might be considered more portable. - At least POSIX is an ISO 
standard.

Jacob
-- 
"I am an old man now, and when I die and go to Heaven there are two
  matters on which I hope enlightenment. One is quantum electro-dynamics
  and the other is turbulence of fluids. About the former, I am rather
  optimistic." -- Sir Horace Lamb.




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

end of thread, other threads:[~2003-11-05 23:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-04 14:45 socket, pipe ghostie
2003-11-04 15:14 ` Ole-Hjalmar Kristensen
2003-11-04 15:33 ` Marius Amado Alves
2003-11-04 17:45   ` Warren W. Gay VE3WWG
2003-11-04 18:48 ` John Woodruff
2003-11-05  3:27 ` Steve
2003-11-05  5:24   ` tmoran
2003-11-05  9:44 ` Pascal Obry
2003-11-05 12:31 ` Marin David Condic
2003-11-05 14:50   ` Steve
2003-11-05 15:19   ` Steve
2003-11-05 13:45 ` ghostie
2003-11-05 18:54   ` ghostie
2003-11-05 20:41     ` Robert Spooner
2003-11-05 20:18   ` Martin Dowie
2003-11-05 20:23     ` Martin Dowie
2003-11-05 13:54 ` ghostie
2003-11-05 14:26   ` Marius Amado Alves
2003-11-05 23:55   ` Jacob Sparre Andersen
  -- strict thread matches above, loose matches on Subject: below --
2003-11-05 18:49 Beard, Frank Randolph CIV
2003-11-05 19:43 Beard, Frank Randolph CIV
2003-11-05 21:14 ` tmoran

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