comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: Ada & Scripting
Date: Sat, 17 May 2003 09:36:04 +0200
Date: 2003-05-17T09:36:04+02:00	[thread overview]
Message-ID: <1791903.ebazZxWUSG@linux1.krischik.com> (raw)
In-Reply-To: mailman.8.1053118053.22676.comp.lang.ada@ada.eu.org

sk wrote:

> Hi,

>   > I have some C sources for 'popen' which show how this is
>   > supposed to work. Now I "only" have to map the function to Ada.

>   > I saw them. As I said 'popen' ony returns one of the
>   > pipes - so I have to program my own version of 'popen'.
> 
> ... and as I said, the method is 2 PIPES (not 'popen')

I understand that much
 
> The routine (algorithm) goes, roughly, like so ...
> 
> <algorithm>
> 
[...]
> 
> </algorithm>

Which is precicly what popen does - only popen then drops one of the pipes
and returns only the other one. Personaly I think that was very wastefull
of the original designer of popen.

> Use the "select" or "poll" system calls in the parent
> process to determine if the pipes are open, open but
> blocked or closed.
> 
> There is no difficulty in implementing this algorithm
> in Ada, but it is a very "C" way to do it. A more Ada
> solution is to use Ada tasks or protected objects, but
> there is still a 'fork' and 'exec' call involved since
> this is the way a Linux system (and Windows I think)
> implements the "pipe" concept. So, I tend to stick
> to the parent/child fork and exec method retaining the
> "C" way to do things.

I wonder if I should base my implentation use GNAT.Expect instead. 
GNAT.Expect does all of the above and I don't like to reinvent the weel
just for the fun of it.

Only I was planing for line IO and not pattern matching. Well, I'll look
into it.

Thank you for your help. It enables me to make an informed desicion - which
ist probably the most important part in programming.

With Regards

Martin

--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




      reply	other threads:[~2003-05-17  7:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-10 12:07 Ada & Scripting kat-Zygfryd
2003-05-10 13:34 ` Preben Randhol
2003-05-10 19:10 ` Bobby D. Bryant
2003-05-10 20:28   ` kat-Zygfryd
2003-05-11  1:39     ` John R. Strohm
2003-05-11 10:12       ` kat-Zygfryd
2003-05-11 10:55         ` John R. Strohm
2003-05-11 11:23           ` kat-Zygfryd
2003-05-13  4:45             ` Bobby D. Bryant
2003-05-13 16:32               ` Wesley Groleau
2003-05-20 22:19               ` Randy Brukardt
2003-05-21 11:43                 ` Georg Bauhaus
2003-05-12  8:46     ` Preben Randhol
2003-05-12 12:09       ` Frank Piron
2003-05-12 14:31         ` Preben Randhol
2003-05-13  4:47         ` Bobby D. Bryant
2003-05-13 16:33 ` Martin Krischik
2003-05-14 15:22   ` Preben Randhol
2003-05-14 17:05     ` Martin Krischik
2003-05-14 18:51       ` sk
2003-05-15 16:47         ` Martin Krischik
2003-05-16 20:57           ` sk
2003-05-17  7:36             ` Martin Krischik [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