[TransWarp] input-driven application

alexander smishlajev alex at ank-sia.com
Fri May 16 11:12:20 EDT 2003

Phillip J. Eby wrote:
> Okay, I've checked in fixes for the bugs.  Once I fixed them, your 
> example ran fine for me.  Please let me know whether it works as you 
> expect.

it does.  thank you!

> Keep in mind that for this to work, each of your filter objects needs to 
> be a "real" ICmdLineApp in the sense that it uses only its stdin and 
> stdout, OR, you must run each filter one after the other, with the 
> intervening pipes having sufficient space to hold the results until 
> you're ready to run the next filter.

i am not sure if i understood you right.  if you meant that each of the 
filters may do it's work in a whole before passing result to the next 
one, then it's not the case.  the application is meant to _continuously_ 
receive data from one device (connected to tty or tcp socket), transform 
it in some way and pass to another device.

on the other hand, i cannot say that each "filter" uses only stdin and 
stdout; some of them should operate with 3 streams: input, output and 
output or input and input, output.  the whole assembly may look like this:

   DA1 => ILC => T => OLC => DA2
       <=                 <=

where DA is device adaptor (abstracting socket, tty or disk file), ILC - 
input link control, T - transformation layer, OLC - output link control.

in this scheme, T is classic filter by all means, but ILC and OLC are 
not.  ILC has it's stdin and stdout on the left side and additional 
file-like object (pipe input) on the right side.  OLC has it's stdin and 
stdout on the right side and additional file-like object (pipe output) 
on the left side.

i am not sure yet how to describe the third stream for link control 
components.  if you have something to suggest, i would highly appreciate it.

> Note, by the way, that for an I/O driven system like this, you may not 
> want to use periodic tasks, but instead have each filter register as a 
> reader and writer with the 'IBasicReactor' utility's "select" loop.  As 
> you say, though, this won't work on windows except for sockets.  You 
> could perhaps use localhost sockets, though, connecting to yourself, as 
> a crude sort of pipe.  :)

... or write my own select() loop, as you did in running.tests.

somehow i do not like both of these approaches.

best wishes,

More information about the PEAK mailing list