comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Using Streams in conjunction with Spawn and Gnat.Expect
Date: Mon, 9 Feb 2015 19:17:28 +0100
Date: 2015-02-09T19:17:28+01:00	[thread overview]
Message-ID: <9uwbt2juvxx7$.1n9wtt51n62cm$.dlg@40tude.net> (raw)
In-Reply-To: 8a15f2d4-e27b-4de2-953c-c91499bb0362@googlegroups.com

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


      reply	other threads:[~2015-02-09 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
replies disabled

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