Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

563665 views
1
#include"typedef.h"
2
/***** This file contains some routines for input/output *****/
3
4
5
/*****************************************************\
6
| gets the options from the command line
7
\*****************************************************/
8
void getflags(fl, options)
9
flagstruct *fl;
10
int *options;
11
{
12
int i;
13
14
/* depth for the scalar product combinations */
15
fl->DEPTH = 0;
16
/* only the point stabilizer of the first STAB basis-vectors will be computed */
17
fl->STAB = 0;
18
/* flag that Bacher-polynomials will be used */
19
fl->BACH[0] = 0;
20
/* flag that the depth for the Bacher-polynomials is given as an argument,
21
default is 1 */
22
fl->BACH[1] = 0;
23
/* depth for the Bacher-polynomials */
24
fl->BACHDEP = 0;
25
/* flag that the scalar product for the Bacher-polynomials is given as an
26
argument, default is 1/2*norm of the vector */
27
fl->BACH[2] = 0;
28
/* scalar product for the Bacher-polynomials */
29
fl->BACHSCP = 0;
30
/* flag that generators will be read */
31
fl->GEN = 0;
32
/* flag that every new generator is immediately written on the file
33
AUTO.tmp */
34
fl->PRINT = 0;
35
/* flag that the vectors will be read instead of calculated by the program */
36
fl->VEC = 0;
37
/* flag for the output-style: 0 means ASCII, 1 GAP-format, 2 MAGMA-format */
38
fl->OUTPUT = 0;
39
/* scan through the arguments */
40
for (i = 1; i < argc; ++i)
41
{
42
/* every option should start with a '-' */
43
if ((str = strchr(argv[i], '-')) != NULL)
44
{
45
if (strlen(str) <= 1)
46
fprintf(stderr, "unknown option %s: ignored\n", str);
47
else if (str[1] == 'D')
48
/* option -Dn where n is some non-negative integer for depth of
49
scalar product combinations */
50
{
51
if (strlen(str) <= 2 || strcspn(str+2, "0123456789") > 0)
52
{
53
fprintf(stderr, "Error: no non-negative integer specified with -D option\n");
54
exit (3);
55
}
56
else
57
fl->DEPTH = atoi(str+2);
58
}
59
else if (str[1] == 'S')
60
/* option -Sn where n is some non-negative integer for
61
n-point stabilizer */
62
{
63
if (strlen(str) <= 2 || strcspn(str+2, "0123456789") > 0)
64
{
65
fprintf(stderr, "Error: no non-negative integer specified with -S option\n");
66
exit (3);
67
}
68
else
69
fl->STAB = atoi(str+2);
70
}
71
else if (strlen(str) >= 3 && strncmp(str, "-BD", 3) == 0)
72
/* option -BDn where n is some non-negative integer for depth of
73
Bacher-polynomials */
74
{
75
if (strlen(str) <= 3 || strcspn(str+3, "0123456789") > 0)
76
{
77
fprintf(stderr, "Error: no non-negative integer specified with -BD option\n");
78
exit (3);
79
}
80
else
81
{
82
fl->BACHDEP = atoi(str+3);
83
fl->BACH[0] = 1;
84
fl->BACH[1] = 1;
85
}
86
}
87
else if (strlen(str) >= 3 && strncmp(str, "-BS", 3) == 0)
88
/* option -BSn where n is some integer for scalar product of
89
Bacher-polynomials */
90
{
91
if (strlen(str) <= 3 || strcspn(str+3, "-0123456789") > 0)
92
{
93
fprintf(stderr, "Error: no integer specified with -BS option\n");
94
exit (3);
95
}
96
else
97
{
98
fl->BACHSCP = atoi(str+3);
99
fl->BACH[0] = 1;
100
fl->BACH[2] = 1;
101
}
102
}
103
else if (strlen(str) == 2 && str[1] == 'B')
104
/* option -B indicates that Bacher-polynomials will be used */
105
fl->BACH[0] = 1;
106
else if (strlen(str) == 2 && str[1] == 'G')
107
/* option -G indicates that some generators can be read from the
108
input stream */
109
fl->GEN = 1;
110
else if (strlen(str) == 3 && str[1] == 'V')
111
/* option -V1 indicates that the short vectors for the first lattice
112
are read from the input stream, option -V2 that the short vectors
113
for the second lattice are read and option -V3 that the short
114
vectors for both lattices are read
115
(-V2 only makes sense in the isometry-program) */
116
{
117
if (strpbrk(str+2, "123") == NULL)
118
{
119
fprintf(stderr, "Error: no integer between 1 and 3 specified with -V option\n");
120
exit (3);
121
}
122
else
123
fl->VEC = atoi(str+2);
124
}
125
else if (strlen(str) == 2 && str[1] == 'V')
126
/* option -V indicates that the short vectors are read from the
127
input stream */
128
{
129
if (fl->VEC == 0)
130
fl->VEC = 3;
131
}
132
else if (strlen(str) == 2 && str[1] == 'P')
133
/* option -P indicates that new generators will be written
134
to the file AUTO.tmp immediately */
135
fl->PRINT = 1;
136
else if (strlen(str) == 3 && str[1] == 'O')
137
/* option -OG indicates that the output is converted to GAP-format,
138
-OM that it is converted to MAGMA-format */
139
{
140
if (strpbrk(str+2, "GM") == NULL)
141
{
142
fprintf(stderr, "Error: can only convert to GAP (-OG) or MAGMA (-OM)\n");
143
exit (3);
144
}
145
else if (str[2] == 'G')
146
fl->OUTPUT = 1;
147
else if (str[2] == 'M')
148
fl->OUTPUT = 2;
149
}
150
else
151
fprintf(stderr, "unknown option %s: ignored\n", str);
152
}
153
}
154
/* if Bacher-polynomials are to be used and no depth is given it is set to
155
the default-value 1 */
156
if (fl->BACH[0] == 1 && fl->BACH[1] == 0)
157
fl->BACHDEP = 1;
158
}
159
160