2 4ti2 -- A software package for algebraic, geometric and combinatorial
3 problems on linear spaces.
5 Copyright (C) 2006 4ti2 team.
6 Main author(s): Matthias Walter.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
32 #ifdef __GNU_LIBRARY__
42 extern bool ORightHandSide
;
44 extern int BaseLength
;
45 extern char *BaseName
;
51 void printUsage(char *program
)
55 puts(FORTY_TWO_BANNER
);
58 if (OHilbert
) { printf("hilbert"); }
59 else if (OGraver
) { printf("graver"); }
60 else { printf("zsolve"); }
61 printf(" [options] PROJECT\n\n");
63 printf("[Basic options]\n");
64 // printf(" -f, --force computation regardless of existing PROJECT.(in)hom\n");
65 printf(" -i, --ignore system is homogeneous, regardless of PROJECT.rhs\n");
67 printf("\n[Logging options]\n");
68 printf(" -n, --logging=0 no logging (default)\n");
69 printf(" -l, --logging[=1] simple logging to PROJECT.log\n");
70 printf(" -ll, --logging=2 verbose logging to PROJECT.log\n");
71 printf(" -lll, --logging=3 very verbose logging to PROJECT.log\n");
73 printf("\n[Output options]\n");
74 printf(" -q, --quiet, --verbose=0 quiet mode\n");
75 printf(" -v, --verbose[=1] simple output (default)\n");
76 printf(" -vv, --verbose=2 verbose output\n");
77 printf(" -vvv, --verbose=3 very verbose output\n");
79 printf("\n[Backup options]\n");
80 printf(" -b[FREQ], --backup[=FREQ] frequently backup status to PROJECT.backup,\n where FREQ must be \"[1-9][0-9]*[mhd]\" for mins,\n hours or days. default is 1h\n");
81 printf(" -r, --resume resume from a backup like PROJECT.backup\n");
83 printf("\n[Other options]\n");
84 printf(" -h, --help display this help and exit\n");
86 printf("\n[Used files]\n\n");
87 printf("PROJECT.mat matrix\n");
88 printf("PROJECT.rhs right hand side (optional)\n");
89 //printf("PROJECT.rel relations (<, >, =, p)\n");
90 printf("PROJECT.rel relations (<, >, =)\n");
91 printf("PROJECT.sign sign of columns (optional)\n");
92 printf("PROJECT.lb lower bounds columns (optional)\n");
93 printf("PROJECT.ub upper bounds columns (optional)\n");
94 printf("PROJECT.backup backup file\n");
95 printf("PROJECT.zinhom inhomogeneous part of the solution\n");
96 printf("PROJECT.zhom homogeneous part of the solution\n");
97 printf("PROJECT.zfree free part of the solution\n");
104 void getopts(int argc
, char **argv
)
109 #ifdef __GNU_LIBRARY__
110 static struct option long_options
[] =
112 { "backup", optional_argument
, NULL
, 'b'},
113 { "data", no_argument
, NULL
, 'd'},
114 { "force", no_argument
, NULL
, 'f'},
115 { "help", no_argument
, NULL
, 'h'},
116 { "ignore", no_argument
, NULL
, 'i'},
117 { "logging", optional_argument
, NULL
, 'l'},
118 { "quiet", no_argument
, NULL
, 'q'},
119 { "resume", no_argument
, NULL
, 'r'},
120 { "verbose", optional_argument
, NULL
, 'v'},
121 { "hilbert", no_argument
, NULL
, 'H'},
122 { "graver", no_argument
, NULL
, 'G'}
130 ORightHandSide
= true;
135 #ifdef __GNU_LIBRARY__
136 while ((c
= getopt_long(argc
, argv
, "b::d::fhinl::qrv::VHG", long_options
, NULL
)) != -1)
138 while ((c
= getopt(argc
, argv
, "b::d::fhinl::qrv::VHG")) != -1)
141 if (optarg
!=NULL
&& optarg
[0]=='=')
149 ORightHandSide
= false;
165 if (sscanf(optarg
, "%d%c", &OBackup
, &d
)==2)
175 printf("%s: invalid backup modifier %c\n", argv
[0], d
);
181 printf("%s: invalid backup argument -b%s\n", argv
[0], optarg
);
190 if (optarg
==NULL
|| !strcmp(optarg
, "1"))
192 else if (!strcmp(optarg
, "2") || !strcmp(optarg
, "v"))
194 else if (!strcmp(optarg
, "3") || !strcmp(optarg
, "vv"))
196 else if (!strcmp(optarg
, "0"))
200 printf("%s: invalid verbose argument -v%s\n", argv
[0], optarg
);
208 if (optarg
==NULL
|| !strcmp(optarg
, "1"))
210 else if (!strcmp(optarg
, "2") || !strcmp(optarg
, "l"))
212 else if (!strcmp(optarg
, "3") || !strcmp(optarg
, "ll"))
214 else if (!strcmp(optarg
, "0"))
218 printf("%s: invalid verbose argument -v%s\n", argv
[0], optarg
);
229 printf("c = %c, optarg = %s\n", c
, optarg
);
235 if (OHilbert
&& OGraver
)
237 printf("Input Error: A combination of --hilbert and --graver is not allowed!\n");
245 printf("Input Error: Only one project file is possible: You specified '%s' and '%s'!\n\n", argv
[optind
], argv
[optind
+1]);
249 BaseLength
= strlen(argv
[optind
]);
250 BaseName
= (char *)malloc((BaseLength
+10)*sizeof(char));
253 fprintf(stderr
, "Fatal Error (%s/%d): Could not allocate memory for BaseName!\n", __FILE__
, __LINE__
);
256 strcpy(BaseName
, argv
[optind
]);