-
Notifications
You must be signed in to change notification settings - Fork 3
/
xgap.sh.in
executable file
·256 lines (224 loc) · 8.07 KB
/
xgap.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/bin/sh
#############################################################################
##
#A xgap XGAP source Frank Celler
##
##
#Y Copyright (C) 1998, Lehrstuhl D fuer Mathematik, RWTH, Aachen, Germany
##
#############################################################################
##
## xgap.sh GAP Max Neunhoeffer
##
## This is a shell script for the UNIX operating system that starts XGAP.
## This is the place where you make all the necessary customizations.
## Then copy this file to a directory in your search path, e.g., '~/bin'.
## If you later move GAP to another location you must only change this file.
##
#############################################################################
##
## GAP_DIR . . . . . . . . . . . . . . . . . . . . directory where GAP lives
##
## Set 'GAP_DIR' to the name of the directory where you have installed GAP,
## i.e., the directory with the subdirectories 'lib', 'grp', 'doc', etc.
## The default is '@gapdir@', which is the root directory if you install
## XGAP in the default `pkg' directory.
## If you install XGAP in a private directory you have to change this.
##
if [ "x$GAP_DIR" = "x" ]; then
GAP_DIR="@gapdir@"
fi
#############################################################################
##
## GAP_PRG . . . . . . . . . . . . . . . . . name of the executable program
##
## Set 'GAP_PRG' to the name of the executable program of the GAP kernel.
##
if [ "x$GAP_PRG" = "x" ]; then
GAP_PRG=@GAPARCH@/gap
fi
#############################################################################
##
## XGAP_PRG . . . . . . . . . . . . . . . . . name of the executable program
##
## Set 'XGAP_PRG' to the name of the executable program of the XGAP kernel.
##
if [ "x$XGAP_PRG" = "x" ]; then
XGAP_PRG=@GAPARCH@/xgap
fi
#############################################################################
##
## DAEMON . . . . . . . . . . . . . . flag, whether xgap goes to background
##
## Set 'DAEMON' to "NO" if you don't want the usual behaviour, that xgap
## goes to the background directly after starting up.
##
DAEMON="YES"
#############################################################################
##
## VERBOSE . . . . . . . . . . . . . . flag, whether lots of messages appear
##
## Set 'VERBOSE' to "YES", if you want exact information about the options
## with which the xgap executable is executed. Mainly used for debugging
## purposes.
##
VERBOSE="NO"
#############################################################################
##
## STOP EDITING HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
##
## Unless you know what you are doing! This should not be necessary if you
## installed GAP and XGAP in the standard way as a share package within the
## GAP directory.
## If you really want to edit the variables below, insert additional
## definitions above, they will *not* be overwritten!
##
#############################################################################
#############################################################################
##
#F options . . . . . . . . . . . . . . . . . parse the command line options
##
## GAP accepts the following options:
##
## -b toggle banner suppression
## -q toggle quiet mode
## -e toggle quitting on <ctr>-D
## -f force line editing
## -n disable line editing
## -x <num> set line width
## -y <num> set number of lines
##
## -g toggle GASMAN messages
## -m <mem> set the initial workspace size
## -o <mem> set the maximal workspace size
## -c <mem> set the cache size value
## -a <mem> set amount to pre-malloc-ate
## postfix 'k' = *1024, 'm' = *1024*1024
## -l <paths> set the GAP root paths
## -r toggle reading of the '.gaprc' file
## -D toggle debugging the loading of library files
## -B <name> current architecture
## -M toggle loading of compiled modules
## -N toggle check for completion files
## -X toggle CRC for comp. files while reading
## -Y toggle CRC for comp. files while completing
## -i <file> change the name of the init file
##
## -L <file> restore a saved workspace
##
##
## XGAP accepts the following options:
##
## -display <dis>, --display <dis>
## set the display
##
## -geometry <geo>, --geometry <geo>
## set the geometry
##
## -normal <font>, --normal <font>
## set the normal font
##
## -huge <font>, --huge <font>
## set the huge font
##
## -large <font>, --large <font>
## set the large font
##
## -small <font>, --small <font>
## set the small font
##
## -tiny <font>, --tiny <font>
## set the tiny font
##
##
## XGAP accepts the following debug options:
##
## --debug <num>
## enter debug mode (XGAP must be compiled with DEBUG_ON)
##
## -G <exec>, --gap-exec <exec>, --gap-prg <exec>
## use another GAP executable
##
## -X <exec>, --xgap-exec <exec>, --xgap-prg <exec>
## use another XGAP executable
##
##
## this scripts accepts the following debug options:
##
## -V, --verbose
## be verbose
##
## --stay
## don't put XGAP into the backgroup
##
## we parse all options:
XP=""
GP=""
while [ $# -gt 0 ]; do
case $1 in
# GAP options
-b|-q|-e|-f|-n|-g|-r|-D|-M|-N|-X|-Y) GP="$GP $1" ;;
-x|-y|-o|-c|-a|-B|-i|-L) GP="$GP $1 $2"; shift ;;
-l|--gap-lib) GAP_DIR="$2"; shift ;;
# XGAP options
-display|--display) XP="$XP -display $2"; shift ;;
-geometry|--geometry) XP="$XP -geometry $2"; shift ;;
-huge|--huge*) XP="$XP -huge $2"; shift ;;
-large|--large*) XP="$XP -large $2"; shift ;;
-normal|--normal*) XP="$XP -normal $2"; shift ;;
-small|--small*) XP="$XP -small $2"; shift ;;
-tiny|--tiny*) XP="$XP -tiny $2"; shift ;;
# DEBUG options
--debug) XP="$XP -D $2"; shift ;;
-G|--gap-exec|--gap-prg) GAP_PRG="$2"; shift ;;
-X|--xgap-exec|--xgap-prg) XGAP_PRG="$2"; shift ;;
# script options
-V|--verbose) VERBOSE="YES" ;;
--stay) DAEMON="NO" ;;
# everything else is passed to GAP:
*) GP="$GP $1" ;;
esac
shift
done
#############################################################################
##
#V DISPLAY . . . . . . . . . . . . . . . . . . display variable must be set
##
if [ "x$DISPLAY" = "x" ]; then
echo 'sorry: xgap is a program running under the X Window System, so'
echo 'you need a graphics display.'
echo 'you must either set $DISPLAY or use "-display HOST:0.0"'
echo 'where you replace HOST by the name of your machine.'
exit 1;
fi;
#############################################################################
##
##
XGAP=@abs_top_srcdir@/bin/$XGAP_PRG
GAP=$GAP_DIR/bin/$GAP_PRG
#############################################################################
##
#F verbose . . . . . . . . . . . . . . . . . . . . . print some information
##
if [ $VERBOSE = "YES" ]; then
echo
echo "XGAP executable: $XGAP"
echo "GAP path: $GAP_DIR"
echo "GAP executable: $GAP"
echo "GAP library arg: $LIBARG"
echo "Display: $DISPLAY"
echo "XGAP parameters: $XP"
echo "GAP parameters: $GP"
echo
fi
#############################################################################
##
#F XGAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . start XGAP
##
export TERM=dumb
if [ $DAEMON = "YES" ]; then
$XGAP -G $GAP $XP -- -l "$GAP_DIR" $GP &
else
$XGAP -G $GAP $XP -- -l "$GAP_DIR" $GP
fi
exit 0