| 1 |
</body> |
| 2 |
</html> |
| 3 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 4 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 5 |
<html> |
| 6 |
<head><title>The GAP Shell User Interface</title></head> |
| 7 |
<body> |
| 8 |
<h1>The GAP Shell User Interface</h1> |
| 9 |
|
| 10 |
<h2 id="s1.">1. Shell UI commands</h2> |
| 11 |
|
| 12 |
<p>The shell user interface provides the user with the option to control |
| 13 |
threads by commands prefixed with an exclamation mark ("!"). |
| 14 |
Those commands are listed below.</p> |
| 15 |
|
| 16 |
<p>For ease of use, users only need to type as many letters of each |
| 17 |
commands so that it can be unambiguously selected. Thus, the shell will |
| 18 |
recognize <tt>!l</tt> as an abbreviation for <tt>!list</tt>.</p> |
| 19 |
|
| 20 |
<h3 id="s1.1">1.1 !shell [<name>]</h3> |
| 21 |
|
| 22 |
<p>Starts a new shell thread and switches to it. Optionally, a name for |
| 23 |
the thread can be provided.</p> |
| 24 |
|
| 25 |
<h3 id="s1.2">1.2 !fork [<name>]</h3> |
| 26 |
|
| 27 |
<p>Starts a new background shell thread. Optionally, a name for the |
| 28 |
thread can be provided.</p> |
| 29 |
|
| 30 |
<h3 id="s1.3">1.3 !list</h3> |
| 31 |
|
| 32 |
<p>List all current threads that are interacting with the user. This |
| 33 |
does not list threads created with <tt>CreateThread()</tt> that have not |
| 34 |
entered a break loop.</p> |
| 35 |
|
| 36 |
<h3 id="s1.4">1.4 !name [<id>] <name></h3> |
| 37 |
|
| 38 |
<p>Give the thread with the numerical identifier or name |
| 39 |
<tt><id></tt> the name name.</p> |
| 40 |
|
| 41 |
<h3 id="s1.5">1.5 !info <id></h3> |
| 42 |
|
| 43 |
<p>Provide information about the thread with the numerical identifier or |
| 44 |
name <tt><id></tt>.</p> |
| 45 |
|
| 46 |
<h3 id="s1.6">1.6 !hide [<id>|*]</h3> |
| 47 |
|
| 48 |
<p>Hide output from the thread with the numerical identifier or name |
| 49 |
<tt><id></tt> when it is not the foreground thread. If no thread |
| 50 |
is specified, make this the default behavior for future threads.</p> |
| 51 |
|
| 52 |
<h3 id="s1.7">1.7 !show [<id>|*]</h3> |
| 53 |
|
| 54 |
<p>Show output from the thread with the numerical identifier or name |
| 55 |
<tt><id></tt> even when it is not the foreground thread. If no |
| 56 |
thread is specified, make this the default behavior for future |
| 57 |
threads.</p> |
| 58 |
|
| 59 |
<h3 id="s1.8">1.8 !keep [<id>] <num></h3> |
| 60 |
|
| 61 |
<p>Keep <tt><num></tt> lines of output from the specified thread. |
| 62 |
If no thread was specified, make this the default.</p> |
| 63 |
|
| 64 |
<h3 id="s1.9">1.9 !prompt (<id>|*) <string></h3> |
| 65 |
|
| 66 |
<p>Set the prompt for the specified thread (or for all newly created |
| 67 |
threads if <tt>*</tt> was specified) to be <tt><string></tt>. If |
| 68 |
the string contains the pattern <tt>%id%</tt>, it is replaced with the |
| 69 |
numerical id of the thread; if it contains the pattern <tt>%name%</tt>, |
| 70 |
it is replaced with the name of the thread; if the thread has no name, |
| 71 |
the numerical id is displayed instead.</p> |
| 72 |
|
| 73 |
<h3 id="s1.10">1.10 !prefix ([<id>]|*) <string></h3> |
| 74 |
|
| 75 |
<p>Prefix the output from the specified thread (or for all newly created |
| 76 |
threads if <tt>*</tt> was specified) wiht <tt><string></tt>. The |
| 77 |
same substitution rules as for the <tt>!prompt</tt> command apply.</p> |
| 78 |
|
| 79 |
<h3 id="s1.11">1.11 !select <id></h3> |
| 80 |
|
| 81 |
<p>Make the specified thread the foreground thread.</p> |
| 82 |
|
| 83 |
<h3 id="s1.12">1.12 !next</h3> |
| 84 |
|
| 85 |
<p>Make the next thread in numerical order the foreground thread.</p> |
| 86 |
|
| 87 |
<h3 id="s1.13">1.13 !previous</h3> |
| 88 |
|
| 89 |
<p>Make the previous thread in numerical order the foreground |
| 90 |
thread.</p> |
| 91 |
|
| 92 |
<h3 id="s1.14">1.14 !replay <num> [<id>]</h3> |
| 93 |
|
| 94 |
<p>Display the last <tt><num></tt> lines of output of the |
| 95 |
specified thread. If no thread was specified, display the last |
| 96 |
<tt><num></tt> lines of the current foreground thread.</p> |
| 97 |
|
| 98 |
<h3 id="s1.15">1.15 !<id></h3> |
| 99 |
|
| 100 |
<p><tt>!<id></tt> is a shortcut for <tt>!select |
| 101 |
<id></tt>.</p> |
| 102 |
|
| 103 |
<h3 id="s1.16">1.16 !source <file></h3> |
| 104 |
|
| 105 |
<p>Read commands from file <tt><file></tt>.</p> |
| 106 |
|
| 107 |
<h3 id="s1.17">1.17 !!<file></h3> |
| 108 |
|
| 109 |
<p><tt>!!<file></tt> is shortcut for <tt>!source |
| 110 |
<file></tt>.</p> |
| 111 |
|
| 112 |
<h3 id="s1.18">1.18 !alias <shortcut> <expansion></h3> |
| 113 |
|
| 114 |
<p>Create an alias. After defining the alias, <tt>!<shortcut> |
| 115 |
<rest of line></tt> will be replaced with <tt>!<expansion> |
| 116 |
<rest of line></tt>.</p> |
| 117 |
|
| 118 |
<h3 id="s1.19">1.19 !unalias <shortcut></h3> |
| 119 |
|
| 120 |
<p>Removes the specified alias.</p> |
| 121 |
|
| 122 |
<h3 id="s1.20">1.20 !eval <gap code></h3> |
| 123 |
|
| 124 |
<p>Evaluates <tt><gap code></tt> as a command.</p> |
| 125 |
|
| 126 |
<h3 id="s1.21">1.21 !run <function> <string></h3> |
| 127 |
|
| 128 |
<p>Calls the function with name <tt><function></tt>, passing it |
| 129 |
the single argument <tt><string></tt> as a GAP string.</p> |
| 130 |
|
| 131 |
<hr> |
| 132 |
<h2 id="s2.">2. GAP functions to access the Shell UI</h2> |
| 133 |
|
| 134 |
<p><em>Note: These functions currently aren't available due to some |
| 135 |
necessary internal reorganization.</em></p> |
| 136 |
|
| 137 |
<p>There are several functions to access the basic functionality of the |
| 138 |
shell user interface. Other than <tt><a |
| 139 |
href="#s2.1">ShellUIRegisterCommand</a></tt>, they can only be called |
| 140 |
from within a registered command.</p> |
| 141 |
|
| 142 |
<p>Threads can be specified either by their numerical identifier or by |
| 143 |
their name (as a string). The empty string can be used to specify the |
| 144 |
current foreground thread.</p> |
| 145 |
|
| 146 |
<h3 id="s2.1">2.1 ShellUIRegisterCommand(name, func)</h3> |
| 147 |
|
| 148 |
<p>Registers the command <tt>!name</tt> with the shell UI. It will call |
| 149 |
<func> with the rest of the command line passed as a string |
| 150 |
argument when typed.</p> |
| 151 |
|
| 152 |
<h3 id="s2.2">2.2 ShellUIForegroundThread()</h3> |
| 153 |
|
| 154 |
<p>Returns the numerical identifier of the current foreground |
| 155 |
thread.</p> |
| 156 |
|
| 157 |
<h3 id="s2.3">2.3 ShellUIForegroundThreadName()</h3> |
| 158 |
|
| 159 |
<p>Returns the name of the current foreground thread or <tt>fail</tt> if |
| 160 |
the current foreground thread has no name.</p> |
| 161 |
|
| 162 |
<h3 id="s2.4">2.4 ShellUISelectThread(id)</h3> |
| 163 |
|
| 164 |
<p>Makes <tt>id</tt> the current foreground thread. Returns |
| 165 |
<tt>true</tt> or <tt>false</tt> to indicate success.</p> |
| 166 |
|
| 167 |
<h3 id="s2.5">2.5 ShellUIOutputHistory(id, count)</h3> |
| 168 |
|
| 169 |
<p>Returns the last <tt>count</tt> lines of the thread specified by |
| 170 |
<tt>id</tt> (which can be a numerical identifier or a name). Returns |
| 171 |
<tt>fail</tt> if there is no such thread.</p> |
| 172 |
|
| 173 |
<h3 id="s2.6">2.6 ShellUIOutputHistoryLength(id, length)</h3> |
| 174 |
|
| 175 |
<p>Retain <tt>length</tt> lines of output history from thread |
| 176 |
<tt>id</tt>.</p> |
| 177 |
|
| 178 |
<h3 id="s2.7">2.7 ShellUIOutputHistoryDefaultLength(length)</h3> |
| 179 |
|
| 180 |
<p>By default, retain <tt>length</tt> lines of output history from each |
| 181 |
thread.</p> |
| 182 |
|
| 183 |
<h3 id="s2.8">2.8 ShellUIAtomicRegion</h3> |
| 184 |
|
| 185 |
<p><tt>ShellUIAtomicRegion</tt> is a global variable to be used for |
| 186 |
synchronization when one wishes to perform multiple operations on the |
| 187 |
shell UI as one atomic step, as in:</p> |
| 188 |
|
| 189 |
<pre> |
| 190 |
atomic ShellUIAtomicRegion do |
| 191 |
... |
| 192 |
od; |
| 193 |
</pre> |
| 194 |
|
| 195 |
<h3 id="s2.9">2.9 ShellUINewSession(foreground, name)</h3> |
| 196 |
|
| 197 |
<p>Creates a new shell thread. Here, <tt>foreground</tt> is a boolean |
| 198 |
variable specifying whether it should be made the new foreground thread |
| 199 |
and <tt>name</tt> is the name of the thread. The empty string can be |
| 200 |
used to leave the thread without a name.</p> |
| 201 |
|