# 55.7 Installation of GAP for MS-DOS

Installation of GAP on IBM PC compatibles is fairly easy. As already mentioned above, GAP must be installed on a harddisk, because it is too large to be run from floppy disks.

First go to a directory where you want to install GAP, e.g., `c:\`. GAP will be installed in a subdirectory `gap3r4p4\` of this directory. You can later move GAP to another location, for example you can first install it in `d:\tmp\` and once it works move it to `c:\`. In the following example we assume that you want to install GAP in `c:\`. Note that certain parts of the output in the examples should only be taken as rough outline, especially file sizes and file dates are not to be taken literally.

Get the GAP distribution onto your IBM PC compatible. One usual way would be to get the distribution with `ftp` onto some UNIX workstation and to download it from there onto your IBM PC compatible, for example with `kermit`. Remember that the distribution consists of binary files and that you must transmit them in binary mode. Another possibility is that you got a set of floppy disks.

If you get the distribution via `ftp`, you must get the distribution `gap3r4p4.zoo`, the zoo archive extractor `unzoo-ibm-i386-msdos.exe`, which is in the subdirectory `util` and which you should rename to `unzoo.exe`, and the executable `bin3r4p4-ibm-i386-msdos.zoo`, which is in the subdirectory `bin` and which you should rename to `bin3r4p4.zoo`. You may have to get the latter 2 files from `ftp.math.rwth-aachen.de`, because some `ftp` servers may not keep it. We recommend that you use `unzoo` even if you already have `zoo` on your system, because `unzoo` automatically translates text files to the appropriate local format.

If you got the distribution via `ftp` unpack the executable and the distribution with the following commands

```    C: > unzoo -x bin3r4p4.zoo
gap3r4p4\bin\gap.bat     -- extracted as text
gap3r4p4\bin\gapdjg.exe  -- extracted as binary
C: > unzoo -x gap3r4p4.zoo
gap3r4p4\bin\gap.sh      -- extracted as text
gap3r4p4\doc\aggroup.tex         -- extracted as text
gap3r4p4\two\twogpd8.grp         -- extracted as text
C: > ```

If you got the executable and the distribution on disks, you must unpack each of the zoo files separately with commands such as the following (assuming that your disk drive is `A:`)

```   C: > rem Insert the 1. disk.
C: > copy a:\unzoo.exe .
C: > unzoo -x a:\bin3r4p4.zoo
gap3r4p4\bin\gap.bat     -- extracted as text
gap3r4p4\bin\gapdjg.exe  -- extracted as binary
C: > unzoo -x a:\etc3r4p4.zoo
C: > unzoo -x a:\grp3r4p4.zoo
gap3r4p4\grp\basic.grp   -- extracted as text
C: > unzoo -x a:\lib3r4p4.zoo
gap3r4p4\lib\abattoir.g  -- extracted as text
C: > rem Insert the 2. disk.
C: > unzoo -x a:\doc3r4p4.zoo
C: > unzoo -x a:\two3r4p4.zoo
gap3r4p4\two\twogp.grp
C: > unzoo -x a:\thr3r4p4.zoo
gap3r4p4\thr\thrgp.grp
C: > rem Insert the 3. disk.
C: > unzoo -x a:\tbl3r4x1.zoo
gap3r4p4\tbl\ctbalter.tbl
C: > rem Insert the 4. disk.
C: > unzoo -x a:\tbl3r4x2.zoo
gap3r4p4\tbl\ctomonst.tbl
C: > unzoo -x a:\tom3r4p4.zoo
gap3r4p4\tom\tmaltern.tom
C: > unzoo -x a:\src3r4p4.zoo
gap3r4p4\src\Makefile    -- extracted as text
C: > rem Insert the 5. disk.
C: > unzoo -x a:\pkg3r4p4.zoo
gap3r4p4\pkg\anupq\MakeLibrary\MakeLibray -- extracted as text
C: > ```

Instead of using the executable that we provide in `bin3r4p4.zoo` you can compile GAP yourself if you have the DJGPP compiler installed. To do this change into the source directory `gap3r4p4\src` and compile GAP with the commands

```    C: > chdir gap3r4p4\src
C:\GAP3R4P4\SRC > make ibm-i386-msdos-djgpp
gcc -DSYS_IS_MSDOS_DJGPP -DSYS_HAS_STRING_PROTO -DSYS_HAS_STDIO_PROTO\
-DSYS_HAS_MISC_PROTO -c system.c
gcc -O2 -c gap.c
C:\GAP3R4P4\SRC > copy gapdjg.exe ..\bin
C:\GAP3R4P4\SRC > chdir ..\..
C: > ```

Change into the directory `gap3r4p4\bin\` and edit the script `gap.bat`, which starts GAP, according to the instructions in this file. Then copy this script to a directory in your search path, e.g., `c:\bin\`, with the commands

```    C: > chdir gap3r4p4\bin
C:\GAP3R4P4\BIN > edit gap.bat
# edit the script 'gap.bat'
C:\GAP3R4P4\BIN > copy gap.bat c:\bin\gap.bat
C:\GAP3R4P4\BIN > chdir ..\..
C: > ```

When you later move GAP to another location you must only edit this script.

An alternative possibility is to compile a version of GAP for use under MS-DOS, on a UNIX system, using a cross-compiler. Cross-compiling versions of `gcc` can be found on some FTP archives, or compiled according to the instructions supplied with the `gcc` source distribution.

GAP must sometimes open more than 8 files at once. MS-DOS disallows this, unless you add the following line to the file `config.sys` on your boot drive. You must then reboot for this change to take effect.

` files=32 `

Start GAP and try a few things. Note that GAP has to read most of the library for the fourth statement below, so this takes quite a while. Subsequent definitions of groups will be much faster.

```    C: > gap -b
gap> 2 * 3 + 4;
10
gap> Factorial( 30 );
265252859812191058636308480000000
gap> Factors( 10^42 + 1 );
[ 29, 101, 281, 9901, 226549, 121499449, 4458192223320340849 ]
gap> m11 := Group((1,2,3,4,5,6,7,8,9,10,11),(3,7,11,8)(4,10,5,6));;
gap> Size( m11 );
7920
gap> Factors( 7920 );
[ 2, 2, 2, 2, 3, 3, 5, 11 ]
gap> Number( ConjugacyClasses( m11 ) );
10 ```

Especially try the command line editing and history facilities, because the are probably the most machine dependent feature of GAP. Enter a few commands and then make sure that ctr-`P` redisplays the last command, that ctr-`E` moves the cursor to the end of the line, that ctr-`B` moves the cursor back one character, and that ctr-`D` deletes single characters. So after entering the above three commands typing
ctr-`P` ctr-`P` ctr-`E` ctr-`B` ctr-`B` ctr-`B` ctr-`B` ctr-`D` `1`
should give the following line.

```    gap> Factors( 7921 );
[ 89, 89 ] ```

If you have a big version of LaTeX available you may now want to make a printed copy of the manual. Change into the directory `gap3r4p4\doc\` and run LaTeX twice on the source. The first pass with LaTeX produces the `.aux` files, which resolve all the cross references. The second pass produces the final formatted dvi file `manual.dvi`. This will take quite a while, since the manual is large. Then print the dvi file. How you actually print the `dvi` file produced by LaTeX depends on the printer you have, the version of LaTeX you have, and whether you use a TeX-shell or not, so we will not attempt to describe it here.

```    C: > chdir gap3r4p4\doc
C:\GAP3R4P4\DOC > latex manual
C:\GAP3R4P4\DOC > latex manual
# there should be no warnings this time
C:\GAP3R4P4\DOC > dir manual.dvi
-a---   4591132 Nov 13 23:29 manual.dvi
C:\GAP3R4P4\DOC > chdir ..\..
C: > ```

Note that because of the large number of cross references in the manual you need a big LaTeX to format the GAP manual. If you see the error message `TeX capacity exceeded`, you do not have a big LaTeX. In this case you may also obtain the already formatted dvi file `manual.dvi` from the same place where you obtained the rest of the GAP distribution.

Note that, apart from the `*.tex` files and the file `manual.bib` (bibliography database), which you absolutely need, we supply also the files `manual.toc` (table of contents), `manual.ind` (unsorted index), `manual.idx` (sorted index), and `manual.bbl` (bibliography). If those files are missing, or if you prefer to do everything yourself, here is what you will have to do. After the first pass with LaTeX, you will have preliminary `manual.toc` and `manual.ind` files. All the page numbers are still incorrect, because the do not account for the pages used by the table of contents itself. Now `bibtex manual` will create `manual.bbl` from `manual.bib`. After the second pass with LaTeX you will have a correct `manual.toc` and `manual.ind`. `makeindex` now produces the sorted index `manual.idx` from `manual.ind`. The third pass with LaTeX incorporates this index into the manual.

```    C: > chdir gap3r4p4\doc
C:\GAP3R4P4\DOC > bibtex manual
# 'bibtex' prints the name of each file it is scanning
C:\GAP3R4P4\DOC > latex manual
# still some messages about undefined citations
C:\GAP3R4P4\DOC > makeindex manual
# 'makeindex' prints some diagnostic output
C:\GAP3R4P4\DOC > latex manual
# there should be no warnings this time
C:\GAP3R4P4\DOC > chdir ..\..
C: > ```

The full manual is, to put it mildly, now rather long (almost 1600 pages). For this reason, it may be more convenient just to print selected chapters. This can be done using the `\includeonly` LaTeX command, which is present in `manual.tex` (around line 240), but commented out. To use this, you must first LaTeX the whole manual as normal, to obtain the complete set of `.aux` files and determine the pages and numbers of all the chapters and sections. After that, you can edit `manual.tex` to uncomment the `\includeonly` command and select the chapters you want. A good start can be to include only the first chapter, from the file `aboutgap.tex`, by editing the line to read `\includeonly{aboutgap}`. The next step is to LaTeX the manual again. This time only the selected chapter(s) and the table of contents and indices will be processed, producing a shorter `dvi` file that you can print by whatever means applies locally.

```    C:\GAP3R4P4\DOC > latex manual
# many messages about undefined references, 1600 pages output
C:\GAP3R4P4\DOC > edit manual.tex
# edit line 241 to include only 'aboutgap'
C:\GAP3R4P4\DOC > latex manual
# pages 0-196 and 1503-1553 only output no warnings
C:\GAP3R4P4\DOC > dir manual.dvi
-a---   1291132 Nov 13 23:29 manual.dvi
C:\GAP3R4P4\DOC >
# now print the DVI file in whatever way is appropriate
```

Thats all, finally you are done. We hope that you will enjoy using GAP. If you have problems, do not hesitate to contact us.

GAP 3.4.4
April 1997