Streaming IO in Newlisp (fgets) and command intepreters..

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Streaming IO in Newlisp (fgets) and command intepreters..

Post by newdep »

Hi Lutz,

newLISP uses fgets for command IO, now there Is 1 specific problem
on every OS that uses newLISP together with 'process.

When you do a (process "cmd") or (process "sh") there is always a mixup
between the two command intepreters.

The problem is probably the use of 'fgets in all of them together with the
fgets in newlisp.c..

Now I was wondering if newLISP could fix this problem on its side?

I think its a matter of intepreting a "newline" or "eof" in newlisp..
(differenty from how a i.e. "cmd" or "sh" or "bsh" does...) while there is a fgets action in newlisp...

But im not yet sure how this could be fixed.. perhpas you have an idea? If you test the 'process above you will see the behaviour..

Regards, Norman.
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

If newLISP starts a process stdout of both processes go to the same window and they share stdin too. You can avoid this by assigning different I/O channels to the process you are starting using the pipe parameters in the 'process' command. See the 'process' command in the manual:
http://newlisp.org/downloads/newlisp_ma ... ml#process

The bc calculator example in the manual and pjot's gtk-server are examples of this procedure. Also runtk here:

http://newlisp.org/index.cgi?page=Tk_and_newLISP

does the same think with the Tcl/Tk shell.



Lutz

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

yes thats correct... I thought that changing the 'fgets way of intepreting
IO could help ..but I dont think thats a solution..

Thanks!
-- (define? (Cornflakes))

Locked