The shell user interface provides the user with the option to control threads by commands prefixed with an exclamation mark ("!"). Those commands are listed below.
For ease of use, users only need to type as many letters of each commands so that it can be unambiguously selected. Thus, the shell will recognize !l as an abbreviation for !list.
Starts a new shell thread and switches to it. Optionally, a name for the thread can be provided.
Starts a new background shell thread. Optionally, a name for the thread can be provided.
List all current threads that are interacting with the user. This does not list threads created with CreateThread() that have not entered a break loop.
Give the thread with the numerical identifier or name <id> the name name.
Provide information about the thread with the numerical identifier or name <id>.
Hide output from the thread with the numerical identifier or name <id> when it is not the foreground thread. If no thread is specified, make this the default behavior for future threads.
Show output from the thread with the numerical identifier or name <id> even when it is not the foreground thread. If no thread is specified, make this the default behavior for future threads.
Keep <num> lines of output from the specified thread. If no thread was specified, make this the default.
Set the prompt for the specified thread (or for all newly created threads if * was specified) to be <string>. If the string contains the pattern %id%, it is replaced with the numerical id of the thread; if it contains the pattern %name%, it is replaced with the name of the thread; if the thread has no name, the numerical id is displayed instead.
Prefix the output from the specified thread (or for all newly created threads if * was specified) wiht <string>. The same substitution rules as for the !prompt command apply.
Make the specified thread the foreground thread.
Make the next thread in numerical order the foreground thread.
Make the previous thread in numerical order the foreground thread.
Display the last <num> lines of output of the specified thread. If no thread was specified, display the last <num> lines of the current foreground thread.
!<id> is a shortcut for !select <id>.
Read commands from file <file>.
!!<file> is shortcut for !source <file>.
Create an alias. After defining the alias, !<shortcut> <rest of line> will be replaced with !<expansion> <rest of line>.
Removes the specified alias.
Evaluates <gap code> as a command.
Calls the function with name <function>, passing it the single argument <string> as a GAP string.
Note: These functions currently aren't available due to some necessary internal reorganization.
There are several functions to access the basic functionality of the shell user interface. Other than ShellUIRegisterCommand, they can only be called from within a registered command.
Threads can be specified either by their numerical identifier or by their name (as a string). The empty string can be used to specify the current foreground thread.
Registers the command !name with the shell UI. It will call <func> with the rest of the command line passed as a string argument when typed.
Returns the numerical identifier of the current foreground thread.
Returns the name of the current foreground thread or fail if the current foreground thread has no name.
Makes id the current foreground thread. Returns true or false to indicate success.
Returns the last count lines of the thread specified by id (which can be a numerical identifier or a name). Returns fail if there is no such thread.
Retain length lines of output history from thread id.
By default, retain length lines of output history from each thread.
ShellUIAtomicRegion is a global variable to be used for synchronization when one wishes to perform multiple operations on the shell UI as one atomic step, as in:
atomic ShellUIAtomicRegion do ... od;
Creates a new shell thread. Here, foreground is a boolean variable specifying whether it should be made the new foreground thread and name is the name of the thread. The empty string can be used to leave the thread without a name.