Article View: comp.lang.visual
Article #24dataflow shell
From: Wayne Throop
Date: Sat, 18 Nov 1989 21:36
Date: Sat, 18 Nov 1989 21:36
64 lines
3503 bytes
3503 bytes
> 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
Technical Details
Message-ID:
<0207@sheol.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!xanth!mcnc!rti!sheol!throopwReferences:
<13770@orstcs.CS.ORST.EDU> <7000@ficc.uu.net> <1989Nov17.040858.22886@rpi.edu> <3907@celit.fps.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!xanth!mcnc!rti!sheol!throopw From: throopw@sheol.UUCP (Wayne Throop) Newsgroups: comp.lang.visual,comp.lang.misc Subject: dataflow shell Summary: it already exists... sort of Message-ID: <0207@sheol.UUCP> Date: 18 Nov 89 21:36:42 GMT References: <13770@orstcs.CS.ORST.EDU> <7000@ficc.uu.net> <1989Nov17.040858.22886@rpi.edu> <3907@celit.fps.com> Lines: 65