Skip to main content

Due to the lapse in federal government funding, NASA is not updating this website. We sincerely regret this inconvenience.

HEASoft and XSPEC are now available as conda packages. See details ....


User Interfaces
Redesign Home Scripting Interfaces

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.

Implication: The object of this somewhat more sophisticated I/O architecture is to provide the ability for XSPEC12 to implement either a command-line interface (as, we expect, many experienced users will continue to prefer) or a GUI interface with a console prompt. Switching between the two is achieved by setting a single boolean flag. Because the command driver functions are separated from the Problem Domain code (the Model layer) we can also, with the same Model layer code, set up a different set of commands at startup that implement a widget based interface. This allows the GUI, to provide whatever operations the widget set supports, without therefore tying the widgets to acting simply as a "better looking command prompt."

Although the planned GUI has not yet been developed, the concept of user interface switching described above has already been successfully demonstrated.

[Redesign Home]
[Design]
[Problem]
[Scripting]
[Compatibility]