OK, I got inspired by Gil's symposium presentation yesterday and have
started working on an implementation on this. I created a sandbox version
of 5.0.0 at url
https://svn.code.sf.net/p/oorexx/code-0/sandbox/rick/addresswith
This is very much a work in progress now that won't even build yet, but I'm
starting to put the pieces together.
The difficult part of this was always the redirection of the command io
streams and the handling reading and writing. Since Gil has figured that
out for Windows at least, we can start moving forward on this.
Here are my thoughts on implementing this.
1) The command will support STEM stemname., STREAM streamname, and USING
(expr).
The USING option will dynamically figure out how to use the evaluated
expression as a source or target. For INPUT, I'm looking at the following:
a) Value is a string. This will be a single line written to the input
stream.
b) Value is a stem object. Handled like the STEM option above.
c) Value is an InputStream object. The stream object is used for input
but no explicit open is
performed.
d) We attempt a makearray conversion on the object as is done with do
over and write the results as lines.
for OUTPUT,
a) Value is a stem, handle like the STEM object.
b) Value is an output stream. Handled like the STREAM option but no
explicit open is performed.
c) Value is an instance of OrderedCollection, append is used to to add
the items. Again, no APPEND/REPLACE support here.
These are not cast in concrete by any means, but that is my initial stab at
this.
2) Command handlers in ooRexx are done using a special interface to
implement different address environments. Currently, they are only passed
the name of the environment and the fully resolved command expression. I'm
working on creating a new type of interface for command handlers that can
participate in I/O redirection. This version will be passed an additional
C++ object that will act as an interface between the handler and the
interpreter. This object will have methods to check which types of I/O are
being redirected and also methods to read from the input source and write
to the output and error sources. All the processing I described above is
hidden from the command handler.
3) For Gil, the existing command handler for Windows system commands can be
found in the file interpreter\platform\windows\SystemCommands.cpp. The code
in there that launches the shell looks a lot like the code you described in
your talk yesterday, so I think it would be fairly easy for you to add the
redirection hookups.
Rick
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel