<html><head><title>[ref] 3 Running GAP</title></head> <body text="#000000" bgcolor="#ffffff"> [<a href="../index.htm">Top</a>] [<a href = "chapters.htm">Up</a>] [<a href ="CHAP002.htm">Previous</a>] [<a href ="CHAP004.htm">Next</a>] [<a href = "theindex.htm">Index</a>] <h1>3 Running GAP</h1><p> <P> <H3>Sections</H3> <oL> <li> <A HREF="CHAP003.htm#SECT001">Command Line Options</a> <li> <A HREF="CHAP003.htm#SECT002">Advanced Features of GAP</a> <li> <A HREF="CHAP003.htm#SECT003">Running GAP under MacOS</a> <li> <A HREF="CHAP003.htm#SECT004">The .gaprc file</a> <li> <A HREF="CHAP003.htm#SECT005">Completion Files</a> <li> <A HREF="CHAP003.htm#SECT006">Testing for the System Architecture</a> <li> <A HREF="CHAP003.htm#SECT007">The Compiler</a> <li> <A HREF="CHAP003.htm#SECT008">Suitability for Compilation</a> <li> <A HREF="CHAP003.htm#SECT009">Compiling Library Code</a> <li> <A HREF="CHAP003.htm#SECT010">CRC Numbers</a> <li> <A HREF="CHAP003.htm#SECT011">Saving and Loading a Workspace</a> <li> <A HREF="CHAP003.htm#SECT012">Coloring the Prompt and Input</a> </ol><p> <p> <a name = "I0"></a> This chapter informs about command line options for <font face="Gill Sans,Helvetica,Arial">GAP</font> under UNIX and OS X (see <a href="CHAP003.htm#SECT001">Command Line Options</a>, <a href="CHAP003.htm#SECT002">Advanced Features of GAP</a>), and features of <font face="Gill Sans,Helvetica,Arial">GAP</font> on the Macintosh (see <a href="CHAP003.htm#SECT003">Running GAP under MacOS</a>), the <code>.gaprc</code> file (see <a href="CHAP003.htm#SECT004">The .gaprc file</a>), completion files (see <a href="CHAP003.htm#SECT005">Completion Files</a>), the <font face="Gill Sans,Helvetica,Arial">GAP</font> compiler (see <a href="CHAP003.htm#SECT007">The Compiler</a>, <a href="CHAP003.htm#SECT008">Suitability for Compilation</a>, <a href="CHAP003.htm#SECT009">Compiling Library Code</a>), and how to save and load a <font face="Gill Sans,Helvetica,Arial">GAP</font> workspace (see <a href="CHAP003.htm#SECT011">Saving and Loading a Workspace</a>). <p> <p> <h2><a name="SECT001">3.1 Command Line Options</a></h2> <p><p> <a name = "I1"></a> <a name = "I2"></a> <a name = "I3"></a> <a name = "I4"></a> When you start <font face="Gill Sans,Helvetica,Arial">GAP</font> under UNIX, you may specify a number of options on the command-line to change the default behaviour of <font face="Gill Sans,Helvetica,Arial">GAP</font>. All these options start with a hyphen <code>-</code>, followed by a single letter. Options must not be grouped, e.g., <code>gap -gq</code> is illegal, use <code>gap -g -q</code> instead. Some options require an argument, this must follow the option and must be separated by a <var>space</var>, e.g., <code>gap -m 256k</code>, it is not correct to say <code>gap -m256k</code> instead. Certain Boolean options (b, q, e, r, A, D, M, N, T, X, Y) toggle the current value so that <code>gap -b -b</code> is equivalent to <code>gap</code> and to <code>gap -b -q -b -q</code> etc. <p> <font face="Gill Sans,Helvetica,Arial">GAP</font> for UNIX will distinguish between upper and lower case options. <p> As is described in Chapter <a href="CHAP073.htm">Installing GAP</a> (see <a href="CHAP073.htm">Installing GAP</a>), usually you will not execute <font face="Gill Sans,Helvetica,Arial">GAP</font> directly. Instead you will call a shell script, with the name <code>gap</code>, which in turn executes <font face="Gill Sans,Helvetica,Arial">GAP</font>. This shell script sets some options which are necessary to make <font face="Gill Sans,Helvetica,Arial">GAP</font> work on your system. This means that the default settings mentioned below may not be what you experience when you execute <font face="Gill Sans,Helvetica,Arial">GAP</font> on your system. <p> <p> <dl compact> <p> <a name = "I5"></a> <dt><code>-h</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to print a summary of all available options (<code>-h</code> is mnemonic for ``help''). <font face="Gill Sans,Helvetica,Arial">GAP</font> exits after printing the summary, all other options are ignored. <p> <a name = "I6"></a> <dt><code>-b</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to suppress the banner. That means that <font face="Gill Sans,Helvetica,Arial">GAP</font> immediately prints the prompt. This is useful when, after a while, you get tired of the banner. This option can be repeated to enable the banner; each <code>-b</code> toggles the state of banner display. <p> <a name = "I7"></a> <dt><code>-q</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to be quiet. This means that <font face="Gill Sans,Helvetica,Arial">GAP</font> displays neither the banner nor the prompt <code>gap></code>. This is useful if you want to run <font face="Gill Sans,Helvetica,Arial">GAP</font> as a filter with input and output redirection and want to avoid the banner and the prompts appearing in the output file. This option may be repeated to disable quiet mode; each <code>-q</code> toggles quiet mode. <p> <a name = "I8"></a> <dt><code>-e</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> not to quit when receiving a <code></code><var>ctr</var><code>-D</code> on an empty input line (see <a href="CHAP006.htm#SSEC004.1">quit</a>). This option should not be used when the input is a file or pipe. This option may be repeated to toggle this behavior on and off. <p> <a name = "I9"></a> <dt><code>-f</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to enable the line editing and history (see <a href="CHAP006.htm#SECT009">Line Editing</a>). <p> <dt><dd> In general line editing will be enabled if the input is connected to a terminal. There are rare circumstances, for example when using a remote session with a corrupted telnet implementation, when this detection fails. Try using <code>-f</code> in this case to enable line editing. This option does not toggle; you must use <code>-n</code> to disable line editing. <p> <a name = "I10"></a> <dt><code>-n</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to disable the line editing and history (see <a href="CHAP006.htm#SECT009">Line Editing</a>). <p> <dt><dd> You may want to do this if the command line editing is incompatible with another program that is used to run <font face="Gill Sans,Helvetica,Arial">GAP</font>. For example if <font face="Gill Sans,Helvetica,Arial">GAP</font> is run from inside a GNU Emacs shell window, <code>-n</code> should be used since otherwise every input line will be echoed twice, once by Emacs and once by <font face="Gill Sans,Helvetica,Arial">GAP</font>. This option does not toggle; you must use <code>-f</code> to enable line editing. <p> <a name = "I11"></a> <dt><code>-x </code><var>length</var><code></code> <dd> With this option you can tell <font face="Gill Sans,Helvetica,Arial">GAP</font> how long lines are. <font face="Gill Sans,Helvetica,Arial">GAP</font> uses this value to decide when to split long lines. After starting <font face="Gill Sans,Helvetica,Arial">GAP</font> you may use <code>SizeScreen</code> (see <a href="CHAP006.htm#SSEC012.1">SizeScreen</a>) to alter the line length. <p> <dt><dd> The default value is 80, unless another value can be obtained from the Operating System, which is the right value if you have a standard ASCII terminal. If you have a larger monitor, or use a smaller font, or redirect the output to a printer, you may want to increase this value. <p> <a name = "I12"></a> <dt><code>-y </code><var>length</var><code></code> <dd> With this option you can tell <font face="Gill Sans,Helvetica,Arial">GAP</font> how many lines your screen has. <font face="Gill Sans,Helvetica,Arial">GAP</font> uses this value to decide after how many lines of on-line help it should wait. After starting <font face="Gill Sans,Helvetica,Arial">GAP</font> you may use <code>SizeScreen</code> (see <a href="CHAP006.htm#SSEC012.1">SizeScreen</a>) to alter the number of lines. <p> <dt><dd> The default value is 24, unless another value can be obtained from the Operating System, which is the right value if you have a standard ASCII terminal. If you have a larger monitor, or use a smaller font, or redirect the output to a printer, you may want to increase this value. <p> <a name = "I13"></a> <dt><code>-g</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to print a information message every time a full garbage collection is performed. <p> <pre> #G FULL 44580/2479kb live 57304/4392kb dead 734/4096kb free </pre> <p> <dt><dd> For example, this tells you that there are 44580 live objects that survived a full garbage collection, that 57304 unused objects were reclaimed by it, and that 734 KBytes from a total allocated memory of 4096 KBytes are available afterwards. <p> <a name = "I14"></a> <dt><code>-g -g</code> <dd> If you give the option <code>-g</code> twice, <font face="Gill Sans,Helvetica,Arial">GAP</font> prints a information message every time a partial or full garbage collection is performed. The message, <p> <pre> #G PART 9405/961kb+live 7525/1324kb+dead 2541/4096kb free </pre> <p> <dt><dd> for example, tells you that 9405 objects survived the partial garbage collection and 7525 objects were reclaimed, and that 2541 KBytes from a total allocated memory of 4096 KBytes are available afterwards. <p> <a name = "I15"></a> <dt><code>-m </code><var>memory</var><code></code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to allocate <var>memory</var> bytes at startup time. If the last character of <var>memory</var> is <code>k</code> or <code>K</code> it is taken as KBytes, if the last character is <code>m</code> or <code>M</code> <var>memory</var> is taken as MBytes and if it is 'g' or 'G' it is taken as Gigabytes. <p> <dt><dd> Under UNIX the default amount of memory allocated by <font face="Gill Sans,Helvetica,Arial">GAP</font> is 24 MBytes. The amount of memory should be large enough so that computations do not require too many garbage collections. On the other hand, if <font face="Gill Sans,Helvetica,Arial">GAP</font> allocates more virtual memory than is physically available, it will spend most of the time paging. <p> <a name = "I16"></a> <dt><code>-o </code><var>memory</var><code></code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to allocate at most <var>memory</var> bytes. If the last character of <var>memory</var> is <code>k</code> or <code>K</code> it is taken as KBytes, if the last character is <code>m</code> or <code>M</code> <var>memory</var> is taken as MBytes and if it is 'g' or 'G' it is taken as Gigabytes. <p> <dt><dd> Under UNIX the default amount is 256 MBytes. If more than this amount is required during the <font face="Gill Sans,Helvetica,Arial">GAP</font> session, <font face="Gill Sans,Helvetica,Arial">GAP</font> prints an error messages and enters a break loop. <p> <a name = "I17"></a> <dt><code>-K </code><var>memory</var><code></code> <dd> is like <code>-o</code> above. But while the latter actually allocates more memory if the system allows it and then prints a warning inside a break loop the <code>-K</code> options tells <font face="Gill Sans,Helvetica,Arial">GAP</font> not even to try to allocate more memory. Instead <font face="Gill Sans,Helvetica,Arial">GAP</font> just exits with an appropriate message. The default is that this feature is switched off. You have to set it explicitly when you want to enable it. <p> <a name = "I18"></a> <dt><code>-l </code><var>path_list</var><code></code> <dd> can be used to modify <font face="Gill Sans,Helvetica,Arial">GAP</font>'s list of root directories (see <a href="CHAP009.htm#SECT002">GAP Root Directory</a>). Before the option <code>-l</code> is used for the first time, the only root directory is <code>./</code>, i.e., <font face="Gill Sans,Helvetica,Arial">GAP</font> has only one root directory which is the current directory. Usually this option is used inside a startup script to specify where <font face="Gill Sans,Helvetica,Arial">GAP</font> is installed on the system. The <code>-l</code> option can also be used by individual users to tell <font face="Gill Sans,Helvetica,Arial">GAP</font> about privately installed modifications of the library, additional <font face="Gill Sans,Helvetica,Arial">GAP</font> packages and so on. Section <a href="CHAP009.htm#SECT002">GAP Root Directory</a> explains how several root paths can be used to do this. <p> <a name = "I19"></a> <dt><dd> <var>path_list</var> should be a list of directories separated by semicolons. No whitespace is permitted before or after a semicolon. Each directory name should end with a pathname separator, i.e., <code>/</code>, but <font face="Gill Sans,Helvetica,Arial">GAP</font> will silently add one if it is missing. If <var>path_list</var> does not start or end with a semicolon, then <var>path_list</var> replaces the existing list of root directories. If <var>path_list</var> starts with a semicolon, then <var>path_list</var> is appended to the existing list of root directories. If <var>path_list</var> ends with a semicolon (and does not start with one), then the new list of root directories is the concatenation of <var>path_list</var> and the existing list of root directories. After <font face="Gill Sans,Helvetica,Arial">GAP</font> has completed its startup procedure and displays the prompt, the list of root directories can be viewed in the variable <code>GAPInfo.RootPaths</code>. <p> <dt><dd> <font face="Gill Sans,Helvetica,Arial">GAP</font> will attempt to read the file <code></code><var>root_dir</var><code>/lib/init.g</code> during startup where <var>root_dir</var> is one of the directories in its list of root directories. If <font face="Gill Sans,Helvetica,Arial">GAP</font> cannot find <code>init.g</code> it will print the following warning <p> <pre> gap: hmm, I cannot find 'lib/init.g' maybe use option '-l <gaproot>'? </pre> <p> <dt><dd> It is not possible to use <font face="Gill Sans,Helvetica,Arial">GAP</font> without the library files, so you must not ignore this warning. You should leave <font face="Gill Sans,Helvetica,Arial">GAP</font> and start it again, specifying the correct root path using the <code>-l</code> option. <p> <a name = "I20"></a> <dt><code>-r</code> <dd> The option <code>-r</code> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> not to read the user supplied <code> /.gaprc</code> files. This option may be repeated to enable reading again; each use of <code>-r</code> toggles whether to read the file. <p> <a name = "I21"></a> <dt><code>-L </code><var>filename</var><code></code> <dd> The option <code>-L</code> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to load a saved workspace. See section <a href="CHAP003.htm#SECT011">Saving and Loading a Workspace</a>. <p> <a name = "I22"></a> <dt><code>-R</code> <dd> The option <code>-R</code> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> not to load a saved workspace previously specified via the <code>-L</code> option. This option does not toggle. <p> <a name = "I23"></a> <dt><code></code><var>filename</var><code> ...</code> <dd> Further arguments are taken as filenames of files that are read by <font face="Gill Sans,Helvetica,Arial">GAP</font> during startup, after the system and private init files are read, but before the first prompt is printed. The files are read in the order in which they appear on the command line. <font face="Gill Sans,Helvetica,Arial">GAP</font> only accepts 14 filenames on the command line. If a file cannot be opened <font face="Gill Sans,Helvetica,Arial">GAP</font> will print an error message and will abort. <p> </dl> <p> <p> <h2><a name="SECT002">3.2 Advanced Features of GAP</a></h2> <p><p> The following options are in general not needed for the normal operation of <font face="Gill Sans,Helvetica,Arial">GAP</font>. They are mostly used for debugging. <p> <p> <dl compact> <p> <a name = "I24"></a> <dt><code>-a </code><var>memory</var><code></code> <dd> GASMAN, the storage manager of <font face="Gill Sans,Helvetica,Arial">GAP</font> uses <code>sbrk</code> to get blocks of memory from (certain) operating systems and it is required that subsequent calls to <code>sbrk</code> produce adjacent blocks of memory in this case because <font face="Gill Sans,Helvetica,Arial">GAP</font> only wants to deal with one large block of memory. If the C function <code>malloc</code> is called for whatever reason, it is likely that <code>sbrk</code> will no longer produce adjacent blocks, therefore <font face="Gill Sans,Helvetica,Arial">GAP</font> does not use <code>malloc</code> itself. <p> <dt><dd> However some operating systems insist on calling <code>malloc</code> to create a buffer when a file is opened, or for some other reason. In order to catch these cases <font face="Gill Sans,Helvetica,Arial">GAP</font> preallocates a block of memory with <code>malloc</code> which is immediately freed. The amount preallocated can be controlled with the <code>-a</code> option. If the last character of <var>memory</var> is <code>k</code> or <code>K</code> it is taken as KBytes and if the last character is <code>m</code> or <code>M</code> <var>memory</var> is taken as MBytes. <p> <a name = "I25"></a> <dt><code>-A</code> <dd> By default, some <font face="Gill Sans,Helvetica,Arial">GAP</font> packages (see <a href="CHAP074.htm">GAP Packages</a>) are loaded, if present, into the <font face="Gill Sans,Helvetica,Arial">GAP</font> session when it starts. This option disables (actually toggles) this behaviour, which can be useful for debugging or testing. <p> <a name = "I26"></a> <dt><code>-B </code><var>architecture</var><code></code> <dd> Executable binary files that form part of <font face="Gill Sans,Helvetica,Arial">GAP</font> or of a <font face="Gill Sans,Helvetica,Arial">GAP</font> package are kept in a subdirectory of the <code>bin</code> directory with in the <font face="Gill Sans,Helvetica,Arial">GAP</font> or package root directory. The subdirectory name is determined from the operating system, processor and compiler details when <font face="Gill Sans,Helvetica,Arial">GAP</font> (resp. the package) is installed. Under rare circumstances, it may be necessary to override this name, and this can be done using the <code>-B</code> option. <p> <a name = "I27"></a> <dt><code>-D</code> <dd> The <code>-D</code> option tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to print short messages when it is reading or completing files or loading modules. This option may be repeated to toggle this behavior on and off. The message, <p> <pre> #I READ_GAP_ROOT: loading 'lib/kernel.g' as GAP file </pre> <p> <dt><dd> tells you that <font face="Gill Sans,Helvetica,Arial">GAP</font> has started to read the library file <code>lib/kernel.g</code>. <p> <pre> #I READ_GAP_ROOT: loading 'lib/kernel.g' statically </pre> <p> <dt><dd> tells you that <font face="Gill Sans,Helvetica,Arial">GAP</font> has used the compiled version of the library file <code>lib/kernel.g</code>. This compiled module was statically linked to the <font face="Gill Sans,Helvetica,Arial">GAP</font> kernel at the time the kernel was created. <p> <pre> #I READ_GAP_ROOT: loading 'lib/kernel.g' dynamically </pre> <p> <dt><dd> tells you that <font face="Gill Sans,Helvetica,Arial">GAP</font> has loaded the compiled version of the library file <code>lib/kernel.g</code>. This compiled module was dynamically loaded to the <font face="Gill Sans,Helvetica,Arial">GAP</font> kernel at runtime from a corresponding <code>.so</code> file. <p> <pre> #I completing 'lib/domain.gd' </pre> <p> <dt><dd> tells you that <font face="Gill Sans,Helvetica,Arial">GAP</font> has completed the file <code>lib/domain.gd</code>. See <a href="CHAP003.htm#SECT005">Completion Files</a> for more information about completion of files. <p> <a name = "I28"></a> <dt><code>-M</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> not to check for, nor to use, compiled versions of library files. This option may be repeated to toggle this behavior on and off. <p> <a name = "I29"></a> <dt><code>-N</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> not to check for, nor to use, completion files, see <a href="CHAP003.htm#SECT005">Completion Files</a>. This option may be repeated to toggle this behavior on and off. <p> <a name = "I30"></a> <dt><code>-O</code> <dd> enables a <font face="Gill Sans,Helvetica,Arial">GAP</font> 3 compatibility mode, in which (for instance) the values <code>false</code> and <code>fail</code> are identified. Use of this mode is not recommended other than as a transitional step in porting <font face="Gill Sans,Helvetica,Arial">GAP</font> 3 code to <font face="Gill Sans,Helvetica,Arial">GAP</font> 4, because the <font face="Gill Sans,Helvetica,Arial">GAP</font> 4 library may not work reliably in this mode. Without the <code>-A</code> option, some packages may give errors on startup. The <code>-O</code> option may be repeated to toggle this behavior on and off. <p> <a name = "I31"></a> <dt><code>-T</code> <dd> suppresses the usual break loop behaviour of <font face="Gill Sans,Helvetica,Arial">GAP</font>. With this option <font face="Gill Sans,Helvetica,Arial">GAP</font> behaves as if the user <code>quit</code> immediately from every break loop. This is intended for automated testing of <font face="Gill Sans,Helvetica,Arial">GAP</font>. This option may be repeated to toggle this behavior on and off. <p> <a name = "I32"></a> <dt><code>-X</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to do a consistency check of the library file and the corresponding completion file when reading the completion file. This option may be repeated to toggle this behavior on and off. <p> <a name = "I33"></a> <dt><code>-Y</code> <dd> tells <font face="Gill Sans,Helvetica,Arial">GAP</font> to do a consistency check of the library file and the corresponding completion file when completing the library file. This option may be repeated to toggle this behavior on and off. <p> <a name = "I34"></a> <dt><code>-i </code><var>filename</var><code></code> <dd> changes the name of the init file from the default <code>init.g</code> to <var>filename</var>. <p> </dl> <p> <a name = "I35"></a> <a name = "I36"></a> <a name = "I36"></a> <a name = "I37"></a> <a name = "I36"></a> <a name = "I37"></a> <a name = "I38"></a> <a name = "I36"></a> <a name = "I37"></a> <a name = "I38"></a> <a name = "I39"></a> <a name = "I36"></a> <a name = "I37"></a> <a name = "I38"></a> <a name = "I39"></a> <a name = "I40"></a> <a name = "I36"></a> <a name = "I37"></a> <a name = "I38"></a> <a name = "I39"></a> <a name = "I40"></a> <a name = "I41"></a> Additional options, <code>-C</code>, <code>-U</code>, <code>-P</code>, <code>-W</code>, <code>-p</code> and <code>-z</code> are used internally in the <font face="Gill Sans,Helvetica,Arial">GAP</font> compiler and/or on specific operating systems. <p> <p> <h2><a name="SECT003">3.3 Running GAP under MacOS</a></h2> <p><p> This sections describes the features of <font face="Gill Sans,Helvetica,Arial">GAP</font> for MacOS that differ from those described earlier in this chapter. <p> Since you cannot enter command line options directly when you launch the <font face="Gill Sans,Helvetica,Arial">GAP</font> application on a Macintosh, another mechanism is being used: Hold down any of the command (apple), option, control or shift keys or space bar when launching the <font face="Gill Sans,Helvetica,Arial">GAP</font> application, e.g., by double-clicking on its icon. Please note that some keys have side effects (e.g., pressing the option key usually closes Findeer windows), and that System X behaves slightly differently from other systems. <p> A dialog box will open, into which you can enter the desired <font face="Gill Sans,Helvetica,Arial">GAP</font> command line options. as described in <a href="CHAP003.htm#SECT001">Command Line Options</a>. For example, if you want <font face="Gill Sans,Helvetica,Arial">GAP</font> to start with a workspace of 32 megabytes, the dialog box should contain the following text: <p> <pre> -m 32m </pre> <p> Note that the dialog box may already contain settings which you have previously saved. The <code>OK</code> button accepts the command line for the current <font face="Gill Sans,Helvetica,Arial">GAP</font> session, and the <code>Save</code> button can be used to save these options for subsequent <font face="Gill Sans,Helvetica,Arial">GAP</font> sessions. The command line options will be saved in a text file called <code>GAP options</code> in the <code>Preferences</code> folder in the system folder. You may also modify the file <code>GAP options</code> directly; note that changes only take effect the next time you launch <font face="Gill Sans,Helvetica,Arial">GAP</font>. <p> There are three additional command line option on the Mac. <p> <p> <dl compact> <p> <a name = "I42"></a> <dt><code>-z </code><var>n</var><code></code> <dd> sets the time between checks for events (keystrokes, mouse clicks etc.) to <i>n</i>/60 second. Lower values make <font face="Gill Sans,Helvetica,Arial">GAP</font> more responsive but computations are somewhat slower. A value greater than 60 is not recommended, the default value for <i>n</i> is 6. <p> <a name = "I43"></a> <dt><code>-P </code><var>m</var><code></code> <dd> sets the amount of memory required for printing. The reason is that printer drivers may require quite a bit of memory, and may even crash if not enough is found. To prevent this, <font face="Gill Sans,Helvetica,Arial">GAP</font> will not print unless at least the specified amount of memory is available. The default value is 64 Kilobytes, which is enough for the Apple LaserWriter printer driver. Setting the printing memory to 0 disables printing altogether. <p> <a name = "I44"></a> <dt><code>-W </code><var>m</var><code></code> <dd> sets the size of the log window to <var>m</var> bytes. This means that if the text in the log window exceeds this amount, then lines at the beginning of the log are deleted. The default value is 32 Kilobytes. <p> </dl> <p> The following command line options work differently on the Mac. <p> <p> <dl compact> <p> <a name = "I45"></a> <dt><code>-a</code> <dd> On the Mac, the <code>-a</code> option has a different meaning from the one described in <a href="CHAP003.htm#SECT002">Advanced Features of GAP</a>. On the Mac, it must be used to reserve memory for loading dynamic libraries into <font face="Gill Sans,Helvetica,Arial">GAP</font>. See <a href="CHAP003.htm#SECT007">The Compiler</a> for details about dynamic libraries (and note that the PPC version of <font face="Gill Sans,Helvetica,Arial">GAP</font> for MacOS <strong>can</strong> use dynamic libraries). <p> <a name = "I46"></a> <a name = "I46"></a> <a name = "I47"></a> <dt><code>-f</code>, <code>-n</code> <dd> The <code>-f</code> and <code>-n</code> command line options do not have any effect on the Mac. <p> <a name = "I48"></a> <dt><code>-e</code> <dd> The <code>-e</code> command line option enables <code></code><var>ctr</var><code>-D</code>. <p> <a name = "I49"></a> <dt><code>-o</code> <dd> The <code>-o</code> command line option should not normally be used on the Mac. The value set by the <code>-o</code> option is only used if it is lower than the size of the workspace that would normally be available for <font face="Gill Sans,Helvetica,Arial">GAP</font>. <p> </dl> <p> <a name = "I50"></a> The file called <code>.gaprc</code> on UNIX systems (see <a href="CHAP003.htm#SECT004">The .gaprc file</a>) is called <code>gap.rc</code> on the Mac; it must be in the same folder as the <font face="Gill Sans,Helvetica,Arial">GAP</font> application. <p> All interaction between <font face="Gill Sans,Helvetica,Arial">GAP</font> and you takes place via the <code>GAP log</code> window: this is where <font face="Gill Sans,Helvetica,Arial">GAP</font> prints its messages and waits for your input. The amount of text in this window is limited (see the <code>-W</code> command line option above), so don't be surprised if old <font face="Gill Sans,Helvetica,Arial">GAP</font> messages are deleted from the beginning of the text when this limit is reached. The reason for deleting old lines is that otherwise <font face="Gill Sans,Helvetica,Arial">GAP</font> may run out of memory just because of the messages it has printed. <p> <font face="Gill Sans,Helvetica,Arial">GAP</font> for the Mac now remembers the font and text size (which can be set choosing <code>Format...</code> in the <code>Edit</code> menu) as well as the window position of the <font face="Gill Sans,Helvetica,Arial">GAP</font> log window from one session to the next. <p> Almost all of the <font face="Gill Sans,Helvetica,Arial">GAP</font> editing keys described in Section <a href="CHAP006.htm#SECT009">Line Editing</a> work on the Mac. In addition, <font face="Gill Sans,Helvetica,Arial">GAP</font> for MacOS also supports the usual editing keys on the Mac, such as Copy and Paste, Undo, arrow keys (also with <code></code><var>shift</var><code></code>, <code></code><var>option</var><code></code> and <code></code><var>command</var><code></code>. Note that you can also move forward and backward in the command line history by pressing <code></code><var>ctrl</var><code>-</code><var>arrow down</var><code></code> and <code></code><var>ctrl</var><code>-</code><var>arrow up</var><code></code>. <p> Note that <code>Quit</code> in <font face="Gill Sans,Helvetica,Arial">GAP</font>'s file menu works differently from the <code>quit</code> <font face="Gill Sans,Helvetica,Arial">GAP</font> command (see <a href="CHAP006.htm#SSEC004.1">quit</a>): <code>Quit</code> in the file menu always quits the <font face="Gill Sans,Helvetica,Arial">GAP</font> application, it cannot be used to quit from a break loop. <p> <font face="Gill Sans,Helvetica,Arial">GAP</font> for MacOS also contains a simple built-in text editor, which is mainly intended to create <font face="Gill Sans,Helvetica,Arial">GAP</font> files. <code>New</code>, <code>Open...</code>, <code>Save</code> and <code>Close</code> from the <code>File</code> menu work in the usual way. <p> The <code>Read...</code> and <code>LogTo</code> commands in the <code>File</code> menu work basically like the corresponding <font face="Gill Sans,Helvetica,Arial">GAP</font> commands (see <a href="CHAP009.htm#SECT007">File Operations</a>). The only difference is that <font face="Gill Sans,Helvetica,Arial">GAP</font> will prompt you for the file with a standard Mac file opening dialog, so you do not have to enter the path name yourself. (You will see the file's path name in the log window afterwards). Note that if a file you want to read is open in <font face="Gill Sans,Helvetica,Arial">GAP</font>'s built-in editor, then <font face="Gill Sans,Helvetica,Arial">GAP</font> will read the file from the edit window, not from the disk. <p> If you press the shift key while choosing <code>Read...</code> from the <code>File</code> menu, the menu item will change to <code>Reread...</code> which will then use the GAP command <code>Reread</code> (see <a href="CHAP009.htm#SSEC007.13">Reread</a>) to read the chosen file. <p> The <code>Read...</code> command in the <code>File</code> menu changes to <code>Read</code> if the front window belongs to a file in <font face="Gill Sans,Helvetica,Arial">GAP</font>'s built-in editor -- choosing <code>Read</code> then makes <font face="Gill Sans,Helvetica,Arial">GAP</font> read that file -- and while the file is being read, the <code>File</code> menu item changes to <code>Abort Read</code>. You cannot close the file's window while it is being read by <font face="Gill Sans,Helvetica,Arial">GAP</font> -- choose <code>Abort Read</code> first. <p> Garbage collection messages, which are switched on and off by the <code>-g</code> command line option (see <a href="CHAP003.htm#SECT001">Command Line Options</a>) can also be switched on and off by choosing <code>Show garbage collections</code> and <code>Show partial collections</code> from the <code>Window</code> menu. <p> If <code>Always scroll to printout</code> is selected in the <code>Window</code> menu, <font face="Gill Sans,Helvetica,Arial">GAP</font> will always scroll the <code>GAP log</code> window so that you can see what <font face="Gill Sans,Helvetica,Arial">GAP</font> is currently printing. Otherwise, the <font face="Gill Sans,Helvetica,Arial">GAP</font> log window is only scrolled to the current print position when <font face="Gill Sans,Helvetica,Arial">GAP</font> prints its prompt and waits for you to enter a command. Note that you may see text lines disappear even if <code>Always scroll to printout</code> is off -- this happens if you are viewing the text at the beginning of the log window and some lines are just being deleted from the log because it has exceeded its 32000 character limit. <p> The contents of the <code>Help</code> menu should be quite self-explanatory. Note that, unlike in <font face="Gill Sans,Helvetica,Arial">GAP</font> 3 for the Mac, the online help is not displayed in a separate window, nor is the online help available while <font face="Gill Sans,Helvetica,Arial">GAP</font> is computing. <p> Holding down the Command (Apple) key while selecting text does the same as selecting the text and choosing <code>Find selection in table of contents</code> from the <code>Help</code> menu, holding down both Command and Option keys while selecting tries to find the selection in the index. <p> When you want to refer to files or folders in <font face="Gill Sans,Helvetica,Arial">GAP</font> (for example in the <code>Read</code>, <code>PrintTo</code>, <code>AppendTo</code>, <code>LogTo</code> commands), or have to specify files or folders for a command line option, these files must be identified by UNIX style path names. (Presently, <font face="Gill Sans,Helvetica,Arial">GAP</font> for MacOS also supports Mac path names, but this may change in the future.) <p> Users who are familiar with UNIX path names may skip the rest of this section, noting that the working directory (i.e., folder) is the one in which the <font face="Gill Sans,Helvetica,Arial">GAP</font> application resides, and that file names on the Mac are <strong>not</strong> case sensitive. <p> Paths are strings used to describe where a file is stored on a hard disk. There are two ways for specifying UNIX path names: absolute and relative paths. An absolute path starts with a <code>/</code>, then the name of the disk where the file is located, another <code>/</code>, then a list of folders, each containing the next one, separated by <code>/</code>, and finally the name of the file, which resides in the last folder in the list. For instance, if your hard disk is called <code>My HD</code>, and your file <code>program.g</code> resides (or should be created) in the folder <code>programs</code> in the folder <code>documents</code> on <code>My HD</code>, the absolute path name to that file is <p> <pre> /My HD/documents/programs/program.g </pre> <p> Relative path names work similarly, except that the starting point is not a disk but the folder in which the <font face="Gill Sans,Helvetica,Arial">GAP</font> application program resides. Relative path names are formed like absolute ones, except that they do not start with a <code>/</code>. Thus, if you want to access the file <code>temp.g</code> in the folder <code>tmp</code> in the <font face="Gill Sans,Helvetica,Arial">GAP</font> folder, you may use the following path name: <code>tmp/temp.g</code>. It is also possible to move upward to a parent folder: suppose that the folder containing <font face="Gill Sans,Helvetica,Arial">GAP</font> is called <code>applications</code>, which contains a folder <code>editor</code> which in turn contains the file 'program.g', then you could access this file by the path <code>../editor/program.g</code>. The path <code>./</code> refers to the <font face="Gill Sans,Helvetica,Arial">GAP</font> folder itself, and <code>../</code> refers to ``the folder above''. <p> Note also that <font face="Gill Sans,Helvetica,Arial">GAP</font> for the Mac follows (resolves) aliases to folders and files. <p> <p> <h2><a name="SECT004">3.4 The .gaprc file</a></h2> <p><p> <a name = "I51"></a> <a name = "I51"></a> <a name = "I52"></a> When you start <font face="Gill Sans,Helvetica,Arial">GAP</font>, it looks for the file with the name <code>.gaprc</code> in your home directory (on UNIX systems). On a Macintosh or a Windows system the equivalent to the <code>.gaprc</code> file is <code>gap.rc</code>, and for it to be read it must be in the same folder as the <font face="Gill Sans,Helvetica,Arial">GAP</font> application. (Note that the file must be called <code>gap.rc</code>. If you use a Windows text editor, in particular if your default is not to show file suffixes, you might accidentaly create a file <code>gap.rc.txt</code> or <code>gap.rc.doc</code> which GAP will not recognize.) <p> If such a file is found it is read after <code></code><var>libname</var><code>/init.g</code>, but before any of the files mentioned on the command line are read. You can use this file for your private customizations. For example, if you have a file containing functions or data that you always need, you could read this from <code>.gaprc</code>. Or if you find some of the names in the library too long, you could define abbreviations for those names in <code>.gaprc</code>. The following sample <code>.gaprc</code> file does both. <p> <pre> Read("/usr/you/dat/mygroups.grp"); Ac := Action; AcHom := ActionHomomorphism; RepAc := RepresentativeAction; </pre> <p> <a name = "I53"></a> If you have already a <code>.gaprc</code> file for <font face="Gill Sans,Helvetica,Arial">GAP</font> 3, its settings might not be compatible with <font face="Gill Sans,Helvetica,Arial">GAP</font> 4. In this case it has to be removed. On UNIX Systems the following <code>.gaprc</code> file can be used to load alternatively a <code>.gap3rc</code> or a <code>.gap4rc</code> file from your home directory. <p> <pre> if IsBound(Permutations) then # GAP 3 Exec("echo \"READ(\\\"`pwd ~`/.gap3rc\\\");\" > /tmp/jJj"); else # GAP 4 Exec("echo \"READ(\\\"`pwd ~`/.gap4rc\\\");\" > /tmp/jJj"); fi; Read("/tmp/jJj"); </pre> <p> <p> <h2><a name="SECT005">3.5 Completion Files</a></h2> <p><p> The standard distribution of <font face="Gill Sans,Helvetica,Arial">GAP</font> already contains completion files so in general <strong>you do not need to create these files by yourself</strong>. <p> When starting, <font face="Gill Sans,Helvetica,Arial">GAP</font> reads in the whole library. As this takes some time, library files are normally condensed into completion files. These completion files contain the basic skeleton of the library but not the function bodies. When a function body is required, for example because you want to execute the corresponding function, the library file containing the function body is completed. <p> Completion files reduce the startup time of <font face="Gill Sans,Helvetica,Arial">GAP</font> drastically. However, this technique also means that the information stored in the completion files and the library must be consistent. If you change a library file without recreating the completion files disaster is bound to happen. <p> Bugfixes distributed for <font face="Gill Sans,Helvetica,Arial">GAP</font> will also update the completion files. Therefore you only need to update them if you have changed the library by yourself. <p> However, if you are modifying a library file a more convenient way is to use the <code>-X</code> option (see <a href="CHAP003.htm#SECT001">Command Line Options</a>) that allows you (in most cases) to use the completion files for the unchanged parts of library files and avoids using the completion files for the changed parts. After you have finished modifying the library files you can recreate the completion files using: <p> <a name = "SSEC005.1"></a> <li><code>CreateCompletionFiles( ) F</code> <li><code>CreateCompletionFiles( </code><var>path</var><code> ) F</code> <p> To create completion files you must have write permissions to <code></code><var>path</var><code></code>, which defaults to the first root directory. Start <font face="Gill Sans,Helvetica,Arial">GAP</font> with the <code>-N</code> option (to suppress the reading of any existing completion files), then execute the command <code>CreateCompletionFiles( </code><var>path</var><code> );</code>, where <var>path</var> is a string giving a path to the home directory of <font face="Gill Sans,Helvetica,Arial">GAP</font> (the directory containing the <code>lib</code> directory). <p> This produces, in addition to lots of informational output, the completion files. <p> <pre> $ gap4 -N gap> CreateCompletionFiles(); #I converting "gap4/lib/read2.g" to "gap4/lib/read2.co" #I parsing "gap4/lib/process.gd" #I parsing "gap4/lib/listcoef.gi" ... </pre> <p> <p> <h2><a name="SECT006">3.6 Testing for the System Architecture</a></h2> <p><p> <a name = "SSEC006.1"></a> <li><code>ARCH_IS_UNIX( ) F</code> <p> tests whether <font face="Gill Sans,Helvetica,Arial">GAP</font> is running on a UNIX system. <p> <a name = "SSEC006.2"></a> <li><code>ARCH_IS_MAC( ) F</code> <p> tests whether <font face="Gill Sans,Helvetica,Arial">GAP</font> is running on a Macintosh under MacOS <p> <a name = "SSEC006.3"></a> <li><code>ARCH_IS_WINDOWS( ) F</code> <p> tests whether <font face="Gill Sans,Helvetica,Arial">GAP</font> is running on a Windows system. <p> <p> <h2><a name="SECT007">3.7 The Compiler</a></h2> <p><p> <a name = "I54"></a> The <font face="Gill Sans,Helvetica,Arial">GAP</font> compiler <font face="Gill Sans,Helvetica,Arial">GAC</font> creates C code from <font face="Gill Sans,Helvetica,Arial">GAP</font> code and then calls the system's C compiler to produce machine code from it. This can result in a speedup (see section <a href="CHAP003.htm#SECT008">Suitability for Compilation</a> for more details). <p> To use the compiler to produce dynamically loadable modules, call it with the <code>-d</code> option: <pre> M193 /home/ahulpke > gap4/bin/i386-ibm-linux-gcc2/gac -d test.g gap4/bin/i386-ibm-linux-gcc2/gap -C /tmp/5827_test.c test.g Init_Dynamic gcc -fpic -ansi -Wall -O2 -o /tmp/5827_test.o -I gap4/bin/i386-ibm-linux-gcc2/../../src -c /tmp/5827_test.c ld -Bshareable -x -o test.so /tmp/5827_test.o rm -f /tmp/5827_test.o rm -f /tmp/5827_test.c </pre> This produces a file <code></code><var>file</var><code>.so</code>. <p> <a name = "SSEC007.1"></a> <li><code>LoadDynamicModule( </code><var>filename</var><code> ) F</code> <li><code>LoadDynamicModule( </code><var>filename</var><code>, </code><var>crc</var><code> ) F</code> <p> To load a compiled file, the command <code>LoadDynamicModule</code> is used. This command loads <var>filename</var> as module. If given, the CRC checksum <var>crc</var> must match the value of the module (see <a href="CHAP003.htm#SECT010">CRC Numbers</a>). <p> <pre> gap> LoadDynamicModule("./test.so"); gap> CrcFile("test.g"); 2906458206 gap> LoadDynamicModule("./test.so",1); Error, <crc> mismatch (or no support for dynamic loading) called from <function>( <arguments> ) called from read-eval-loop Entering break read-eval-print loop ... you can 'quit;' to quit to outer loop, or you can 'return;' to continue brk> quit; gap> LoadDynamicModule("./test.so",2906458206); </pre> <p> If you want to see or modify the intermediate C code, you can also instruct the compiler to produce only the C files by using the option <code>-C</code> instead of <code>-d</code>. <p> There are some known problems with C code produced with the GAP compiler on 32 bit architectures and used on 64 bit architectures (and vice versa). <p> On some operating systems, once you have loaded a dynamic module with a certain filename, loading another with the same filename will have no effect, even if the file on disk has changed. <p> <p> <h2><a name="SECT008">3.8 Suitability for Compilation</a></h2> <p><p> Typically algorithms spend large parts of their runtime only in small parts of the code. The design of <font face="Gill Sans,Helvetica,Arial">GAP</font> reflects this situation with kernel methods for many time critical calculations such as matrix or permutation arithmetic. <p> Compiling an algorithm whose time critical parts are already in the kernel of course will give disappointing results: Compilation will only speed up the parts that are not already in the kernel and if they make us a small part of the runtime, the overall gain is small. <p> Routines that benefit from compilation are those which do extensive operations with basic data types, such as lists or small integers. <p> <p> <h2><a name="SECT009">3.9 Compiling Library Code</a></h2> <p><p> The most tempting code to compile is probably the library. This section describes the mechanism used to make <font face="Gill Sans,Helvetica,Arial">GAP</font> recognize compiled versions of library files. Note however that there is no point in compiling the whole library as typically only few functions benefit from compilation as described in Section <a href="CHAP003.htm#SECT008">Suitability for Compilation</a>. <p> All files that come with <font face="Gill Sans,Helvetica,Arial">GAP</font> are read using the internal function <code>READ_GAP_ROOT</code>. This function then checks whether a compiled version of the file exists and if its CRC number (see <a href="CHAP003.htm#SECT010">CRC Numbers</a>) matches the file. If it does, the compiled version is loaded. Otherwise the file is read. You can start <font face="Gill Sans,Helvetica,Arial">GAP</font> with the <code>-D -N</code> option to see information printed about this process. <p> To make <font face="Gill Sans,Helvetica,Arial">GAP</font> find the compiled versions, they must be put in the <code>bin/</code><var>systemname</var><code>/compiled</code> directory (<var>systemname</var> is the name you gave for compilation, for example <code>i386-ibm-linux-gcc2</code>). They have to be called according to the following scheme: Suppose the file is <code>humpty/dumpty.gi</code> in the <font face="Gill Sans,Helvetica,Arial">GAP</font> home directory. Then the compiled version will be <code>bin/</code><var>systemname</var><code>/compiled/humpty/gi/dumpty.so</code>. That is, the directory hierarchy is mirrored under the <code>compiled</code> directory. A further directory level is added for the suffix of the file, and the suffix of the compiled version of the file is set to <code>.so</code> (as produced by the compiler). <p> For example we show how to compile the <code>combinat.gi</code> file on a Linux machine. Suppose we are in the home directory of the gap distribution. <p> <pre> bin/i386-ibm-linux-gcc2/gac -d lib/combinat.gi </pre> <p> creates a file <code>combinat.so</code>. We now put it in the right place, creating also the necessary directories: <p> <pre> mkdir bin/i386-ibm-linux-gcc2/compiled mkdir bin/i386-ibm-linux-gcc2/compiled/lib mkdir bin/i386-ibm-linux-gcc2/compiled/lib/gi mv combinat.so bin/i386-ibm-linux-gcc2/compiled/lib/gi </pre> <p> If you now start <font face="Gill Sans,Helvetica,Arial">GAP</font> and look, for example, at the function <code>Binomial</code>, defined in <code>combinat.gi</code>, you see it is indeed compiled: <pre> gap> Print(Binomial); function ( <<arg-1>>, <<arg-2>> ) <<compiled code>> end </pre> <p> The command line option <code>-M</code> disables the loading of compiled modules and always reads code from the library. <p> <p> <h2><a name="SECT010">3.10 CRC Numbers</a></h2> <p><p> <a name = "I55"></a> <a name = "I55"></a> <a name = "I56"></a> CRC (cyclic redundancy check) numbers provide a certain method of doing checksums. They are used by <font face="Gill Sans,Helvetica,Arial">GAP</font> to check whether files have changed. Whenever files are ``condensed'' -- for example for completion files (see Section <a href="CHAP003.htm#SECT005">Completion Files</a>) or when compiling files (see Section <a href="CHAP003.htm#SECT007">The compiler</a>) -- such a checksum is computed implicitly and stored within the condensed file. <p> When reading a condensed version of the file instead of the original one, the CRC checksum, which is computed via <code>CrcFile</code> (see <a href="CHAP009.htm#SSEC007.11">CrcFile</a>), can be used to check whether the original has been changed in the meantime, e.g. <p> <pre> gap> CrcFile("lib/morpheus.gi"); 2705743645 </pre> <p> <p> <h2><a name="SECT011">3.11 Saving and Loading a Workspace</a></h2> <p><p> <a name = "I57"></a> <a name = "SSEC011.1"></a> <li><code>SaveWorkspace( </code><var>filename</var><code> ) F</code> <p> will save a ``snapshot'' image of the current <font face="Gill Sans,Helvetica,Arial">GAP</font> workspace in the file <var>filename</var>. This image then can be loaded by another copy of <font face="Gill Sans,Helvetica,Arial">GAP</font> which then will behave as at the point when <code>SaveWorkspace</code> was called. <p> <pre> gap> a:=1; gap> SaveWorkspace("savefile"); true gap> quit; </pre> <p> <code>SaveWorkspace</code> can only be used at the main <code>gap></code> prompt. It cannot be included in the body of a loop or function, or called from a break loop. <p> <a name = "SSEC011.2"></a> <li><code>-L </code><var>filename</var><code></code> <p> A saved workspace can be loaded by starting <font face="Gill Sans,Helvetica,Arial">GAP</font> with the option <code>-L</code> (see <a href="CHAP003.htm#SECT001">Command Line Options</a>). This will start <font face="Gill Sans,Helvetica,Arial">GAP</font> and load the workspace. <p> <pre> you@unix> gap -L savefile gap> a; 1 </pre> <p> Please note that paths to workspaces have to be given in full, expansion of the tilde to denote a home directory will <strong>not</strong> work. <p> Under UNIX, it is possible to compress savefiles using <code>gzip</code>. Compression typically reduces the size of a workspace by a factor 3 or 4. If <font face="Gill Sans,Helvetica,Arial">GAP</font> is started with a compressed savefile (omit the <code>.gz</code> ending), it will try to locate <code>gzip</code> on the system and uncompress the file automatically while reading it. <pre> you@unix> gzip -9 savefile you@unix> gap -L savefile gap> a; 1 </pre> <p> We cannot guarantee that saved workspaces are portable between different system architectures or over different versions of <font face="Gill Sans,Helvetica,Arial">GAP</font> or its library. <p> If compiled modules had been loaded into <font face="Gill Sans,Helvetica,Arial">GAP</font> before the workspace was saved, they will be loaded into the new <font face="Gill Sans,Helvetica,Arial">GAP</font> session during the workspace loading process. If they are not available then the load will fail. Additional compiled modules will <strong>not</strong> be used, even if they are available, although they may be loaded later using <code>Reread</code> (see <a href="CHAP009.htm#SSEC007.13">Reread</a>). <code>SaveWorkspace</code> may sometimes produce warning messages, as in <p> <pre> gap> SaveWorkspace("b5"); #W bad bag id 4 found, 0 saved #W bad bag id 20 found, 0 saved true </pre> <p> A small number of such messages can probably be ignored (they arise because the garbage collector may not always collect all dead objects, and dead objects may contain data that <code>SaveWorkspace</code> does not know how to process). <p> <font face="Gill Sans,Helvetica,Arial">GAP</font> packages which had been loaded before the workspace was saved are loaded also when the workspace is loaded. Packages which had been available but not loaded before the workspace was saved are available also when the workspace is loaded, provided these packages have not been upgraded. Packages which have been newly installed <strong>after</strong> the workspace was saved are <strong>not</strong> available when the workspace is loaded. <p> <p> <h2><a name="SECT012">3.12 Coloring the Prompt and Input</a></h2> <p><p> <font face="Gill Sans,Helvetica,Arial">GAP</font> provides hooks for functions which are called when the prompt is to be printed and when an input line is finished. <p> An example of using this feature is the following function. <p> <a name = "SSEC012.1"></a> <li><code>ColorPrompt( </code><var>bool</var><code> ) F</code> <p> With <code>ColorPrompt(true);</code> <font face="Gill Sans,Helvetica,Arial">GAP</font> changes its user interface: The prompts and the user input are displayed in different colors. It also sets the variable <code>ANSI_COLORS</code> to <code>true</code> (which has the side effect that some help pages are also displayed with color markup. Switch the colored prompts off with <code>ColorPrompt(false);</code>. <p> Note that this will only work if your terminal emulation in which you run <font face="Gill Sans,Helvetica,Arial">GAP</font> understands the so called ANSI color escape sequences - almost all terminal emulations on current UNIX/Linux (<code>xterm</code>, <code>rxvt</code>, <code>konsole</code>, ...) systems do so. <p> The colors shown depend on the terminal configuration and cannot be forced from an application. If your terminal follows the ANSI conventions you see the standard prompt in bold blue and the break loop prompt in bold red, as well as your input in red. <p> If it works for you and you like it, put the line <code>ColorPrompt(true);</code> in your <code>.gaprc</code> file (see <a href="CHAP003.htm#SECT004">The .gaprc file</a>). <p> <p> [<a href="../index.htm">Top</a>] [<a href = "chapters.htm">Up</a>] [<a href ="CHAP002.htm">Previous</a>] [<a href ="CHAP004.htm">Next</a>] [<a href = "theindex.htm">Index</a>] <P> <font face="Gill Sans,Helvetica,Arial">GAP 4 manual<br>December 2008 </font></body></html>