[comp.lang.visual] dataflow shell

throopw@sheol.UUCP (Wayne Throop) (11/19/89)

> dave@fps.com (Dave Smith)
> Unix pipe programs are one dimensional because they're limited by the shells
> to be one dimensional.   [...]
> I'd prefer to [..do something like..]:
>				    /-awk 'control string 1' > x1
>	producer_prog | sed | grep <
>				    \-awk 'control string 2' > x2

This particular trick can actually be done with the bourne shell as it
currently exists.  Of course, just arbitrarily drawing two dataflows out
of the grep doesn't make the program capable of producing two
datastreams.  We would have to get used to more "pipe fitting" programs
or switches to existing programs.  I'll ignore that, and produce just
the example above:

   producer_prog|sed|(grep|awk 's1' >x1&) 3>&1 | awk 's2' >x2

(This is, of course, asuming that "grep" produces one datastream
 on descriptor 1, and another on descriptor 3.)

> The other thing that would be quite nice would be to have more than one
> input to a program be a pipe [..like..]
>	pipe1 -\
>		> diff
>	pipe2 -/

This, too, is possible in the bourne shell off-the-shelf.  Again, it is
necessary to suppose that diff can take two input streams, and so this
would require a variant of diff, or an additional switch to diff.  But
be that as it may:

      pipe1 | (pipe2 | diff) 3<&0

(This is assuming that "diff" will take an additional input on f.d. 3.)

> Once you've got this dataflow shell, scaling it up and adding features to it
> to make it a full-fledged language wouldn't be too hard.  One of these days...

Well, ugly as the bourne shell syntax for these things is, and limited
as it is (it can't for example produce two dataflows between just two
processes, nor a circular dataflow, nor many others), it IS ALREADY a
start.  Why not start using it, and expand on it by writing pipe
fittings as needed, like the "split" option of grep, or the "join"
option of diff, and others? Then, when a fancy graphical user interface
with allows for multiple data flows into and out of programs occurs, the
primitives necessary to using it will already exist. 

(Another very interesting "pipe fitting" program is one that will
 produce named pipes in the file system.  That way, programs which
 require filenames (such as diff) can be put into a pipe.  The above
 examples might be done like so with two primitives:
         ... |psplit "grep e1|awk 's1' >x1" "grep e2|awk 's2' >x2"
         pjoin f1 "pipe1" f2 "pipe2" "diff $f1 $f2" | ...
 Once you've written psplit and pjoin, you can do a lot, fairly nicely.
 Further, a graphical dataflow program could be trained to use them to
 produce the various fittings in the dataflow, while using existing
 unix tools as the nodes. )

In any event, if one really wants to exploit complicated pipe dataflows,
the thing to do is just go ahead and do it something like the way outlined
above.  Waiting for neat graphical-oriented dataflow shells to become
widely available just hasn't worked for me in the past... this has.
--
Wayne Throop <backbone>!mcnc!rti!sheol!throopw or sheol!throopw@rti.rti.org

dave@fps.com (Dave Smith) (11/21/89)

In article <0207@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes:
 >
 >Well, ugly as the bourne shell syntax for these things is, and limited
 >as it is (it can't for example produce two dataflows between just two
 >processes, nor a circular dataflow, nor many others), it IS ALREADY a
 >start.  Why not start using it, and expand on it by writing pipe
 >fittings as needed, like the "split" option of grep, or the "join"
 >option of diff, and others? 

Because writing the spiffy graphical interface is a whole lot more fun
than writing dataflow Bourne shell scripts.  :-)

--
David L. Smith
FPS Computing, San Diego
ucsd!celerity!dave or dave@fps.com
"I'm trying to think, but nothing happens!" - Curly Fine