[REBOL] Pipe
From: al:bri:xtra at: 13-Nov-2000 20:31
In Rebol, it should be possible to write a 'Pipe function, that can be used
like this:
Publish: [
Flow-Text
Smart-eText
HTML
]
Pipe %Test.html Publish %Test.txt
Which would read %Test.txt, and "pump" the text through the "filters" in
the 'Publish block and write the file %Test.html. Any needed parameters that
the filters need, for example:
...
Rebol-Server-Page (now)
Spell-Check %NZ-English.dic
...
Could be appended after the word naming the filter.
Pipe could process the block, executing the words in the block according to
the filter objects it has access to, and parsing the parameters between
words to the initialisation functions of the filter objects. Then it could
put the file to the first filter and return the result of the filter pipe.
Each filter word!, like Spell-Check, could refer to an object!, like
'Spell-Check!, that contains the filter functions. The object! would be in a
file of the same name, like %Spell-Check.r, and would be stored in %Pipe/
subdirectory of the directory where %Pipe.r is stored. Necessary files for
the filter "plug-ins", could be stored in deeper sub-directories matching
the name of their user, so %NZ-English.dic would be in %Pipe/Spell-Check/.
Filter objects could be statically loaded all at once as 'Pipe loads, or
could be dynamically loaded as calls to Pipe require, then unloaded (garbage
collected).
Equivalents to Unix commands, perhaps like tee, grep and sed, could then be
implemented, along with other unique and interesting filters.
So, my question is, has anyone made anything like this yet? Or should I go
ahead and make it?
Andrew Martin
Rebol plumber...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/