From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeed1.swip.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Using Streams in conjunction with Spawn and Gnat.Expect Date: Mon, 9 Feb 2015 19:17:28 +0100 Organization: cbb software GmbH Message-ID: <9uwbt2juvxx7$.1n9wtt51n62cm$.dlg@40tude.net> References: <8a15f2d4-e27b-4de2-953c-c91499bb0362@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: O5wBfA8x5QTLTrmrCnAc2g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.giganews.com comp.lang.ada:192234 Date: 2015-02-09T19:17:28+01:00 List-Id: 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