yield equivalent in C/JavaScript?
Robin Becker
robin at jessikat.fsnet.co.uk
Sat Jun 29 14:12:46 EDT 2002
Is there any way to do yielding easily in C? I have a bunch of programs
which are normally connected together using unix pipes. I would like to
merge them and the problem is then how to get them to communicate nicely
using a single process.
the typical process currently looks like
initialise();
while((c=getc(stdin))>=0){
process(c);
putc(c,stdout);
}
so if the inputs are reasonable I could just run each to completion
before proceeding with the next by replacing the file streams with
memory ones. That could get messy if the inputs are large.
Is there a neat way to simulate the yield idea? In C I can just about
consider doing some longjump madness, but that wont wash in the other
possible environment which has JavaScript for implementation.
--
Robin Becker
More information about the Python-list
mailing list