XSPEC12 uses C++ streams for I/O. Instead of performing I/O through C++ std::cin and std::out, however, it defines new streams tcin, tcout that read and write data through objects called XSstreams derived from their C++ equivalents.
In C++, stream objects read from and write to internal streambuf objects that fill or drain a character buffer. The XSstreams re-implement this buffer to point to different read/write operations. Specifically these operations can optionally be:
Reading and writing through a tcl channel (Tcl_Channel artefact)
Creating and reading from a widget, for example implemented with a tk script.
The abstract interface written for XSPEC12 is not dependent on the choice of tcl as the scripting language - one can in principle use any language that has a C language Application Programming Interface (API) that exposes the
low-level read/write capabilities to the user (although of course we have only implemented tcl).
Logging user input and program output
is implemented by having the low-level output implementation write to two channels, one of them being a text file. Degree of verbosity to either or both channels can be controlled by a chatter parameter set by the calling function.