gap-system / gap

Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra
https://www.gap-system.org
GNU General Public License v2.0
810 stars 160 forks source link

HPC-GAP: IO Cleanups #88

Open stevelinton opened 9 years ago

stevelinton commented 9 years ago

This is a note of a discussion about how to produce a usable UI for HPCGAP Beta.

  1. GNU readline is not supported for now. It may be possible, but will be a lot of work and is not urgent.
  2. The existing hooks used by the command-line editor which call bits of GAP "out of band" should be removed (or reduced to noops) and replaced by much simpler calls "in-band" from the input thread.
  3. The input and output threads should provide some simple customisation mechanism for colouring etc.
  4. Existing colourisation mechanisms should be mapped to this or cleanly ignored.
  5. The input and output threads should cooperate to maintain a "normal" division of the terminal between one line for input, one for status and the rest for output. Input is echoed in the input area as you type and copied into the output stream when the foreground thread reads it.
    • It would be nice for the status line to include a report of which, if any, threads have pending output.
  6. If input lines are pending (so they have been typed, the user has hit return and they have not yet been delivered to the foreground thread, and the next line is an ! command that changes foreground thread, then the lines before that are delivered to the OLD foreground thread, while the ones after it are delivered to the NEW foreground thread.
  7. A Thread which needs complete control of the terminal (eg to run an external process) can have it. While it has it, all other output is buffered, any thread that wants input is blocked, as is any other thread trying to establish this mode, and no input is delivered to the input thread.
  8. We should add !h[elp] and document the mechanism for installing new ! functions
stevelinton commented 9 years ago

It's an interesting question whether lines beginning ? should be passed to the foreground thread or dealt with by the input thread in some way.

markuspf commented 9 years ago

I would like to add on this matter that I really liked @fingolfin's suggestion of a IRC-client like interface with a command line (per thread), a status window etc.

If we decouple the HPC-GAP computations process from the frontend this would open up a wealth of possibilities, like emacs modes, GUIs (I believe a basic PyQT GUI would be a matter of hours for me to write) and so on.

If I understand the current setup correctly this decoupling is not too far away from what is happening right now anyway.

stevelinton commented 9 years ago

The one element of decoupling which is potentially tricky is handling the output from a thread as anything nicer than a sequence of lines -- for instance knowing which lines (or parts of lines) are input echo, command line results, user printing, info statements, help text, etc. etc. At the moment everything goes through the Pr function in the kernel at which point all trace of its provenance is lost.