* Using Streams in conjunction with Spawn and Gnat.Expect
@ 2015-02-09 16:38 Jean François Martinez
2015-02-09 18:17 ` Dmitry A. Kazakov
0 siblings, 1 reply; 2+ messages in thread
From: Jean François Martinez @ 2015-02-09 16:38 UTC (permalink / raw)
Problem is: I have a program that spawns another (Non_Blocking_Spawn in Gnat.Expect) and communicates with it by sending it variable length strings preceeding by a token telling the son what to do with it. I would like they did it by exchanging objects through the 'Output and 'Input atribute.
Problem is: Non_Blocking_Spawn works with Process_Descriptors from them you can get a File_Descriptor (from Gnat.Os_Lib.File_Descriptor) but I have been unable to find a way for mapping a Stream on a File_Descriptor.
Any ideas?
Jean François Martinez
PS: I could resort to forget about Objects and Streams and just parse input in son, in fact that is what I did in a previous version but that is sooo crude and unelegant. That is why I would like to use Objects and Streamas.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Using Streams in conjunction with Spawn and Gnat.Expect
2015-02-09 16:38 Using Streams in conjunction with Spawn and Gnat.Expect Jean François Martinez
@ 2015-02-09 18:17 ` Dmitry A. Kazakov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry A. Kazakov @ 2015-02-09 18:17 UTC (permalink / raw)
On Mon, 9 Feb 2015 08:38:27 -0800 (PST), Jean François Martinez wrote:
> Problem is: I have a program that spawns another (Non_Blocking_Spawn in
> Gnat.Expect) and communicates with it by sending it variable length
> strings preceeding by a token telling the son what to do with it. I would
> like they did it by exchanging objects through the 'Output and 'Input
> atribute.
>
> Problem is: Non_Blocking_Spawn works with Process_Descriptors from them
> you can get a File_Descriptor (from Gnat.Os_Lib.File_Descriptor) but I
> have been unable to find a way for mapping a Stream on a File_Descriptor.
You could possibly convert file descriptor to Ada's file using
GNAT-specific libraries and then get a stream to it. Or else use low-level
I/O on the descriptor and then use a custom stream or else a memory-mapped
stream object to fed with data.
> Any ideas?
I am using GTK's Glib facilities which are more comfortable. The Ada
bindings has Input/Output/Error calls for data exchange.
It might be difficult to use 'Input 'Output attributes from concurrent
tasks if you wanted run it as proper pipes.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-09 18:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-09 16:38 Using Streams in conjunction with Spawn and Gnat.Expect Jean François Martinez
2015-02-09 18:17 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox