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