verify.c: turn off continue_on_error by default
[barvinok.git] / verify.c
blob7bb64311f524d76c600ab66fa00d0f51f00190a8
1 #include <stdlib.h>
2 #include "verify.h"
4 /* RANGE : normal range for evalutations (-RANGE -> RANGE) */
5 #define RANGE 50
7 /* SRANGE : small range for evalutations */
8 #define SRANGE 15
10 /* if dimension >= BIDDIM, use SRANGE */
11 #define BIGDIM 5
13 /* VSRANGE : very small range for evalutations */
14 #define VSRANGE 5
16 /* if dimension >= VBIDDIM, use VSRANGE */
17 #define VBIGDIM 8
19 static struct argp_option argp_options[] = {
20 { "verify", 'T', 0, 0 },
21 { "print-all", 'A', 0, 0 },
22 { "continue-on-error", 'C', 0, 0 },
23 { "min", 'm', "int", 0 },
24 { "max", 'M', "int", 0 },
25 { "range", 'r', "int", 0 },
26 { 0 }
29 static error_t parse_opt(int key, char *arg, struct argp_state *state)
31 struct verify_options *options = state->input;
33 switch (key) {
34 case ARGP_KEY_INIT:
35 options->verify = 0;
36 options->print_all = 0;
37 options->continue_on_error = 0;
38 options->m = INT_MAX;
39 options->M = INT_MIN;
40 break;
41 case ARGP_KEY_FINI:
42 break;
43 case 'T':
44 options->verify = 1;
45 break;
46 case 'A':
47 options->print_all = 1;
48 break;
49 case 'C':
50 options->continue_on_error = 1;
51 break;
52 case 'm':
53 options->m = atoi(arg);
54 options->verify = 1;
55 break;
56 case 'M':
57 options->M = atoi(arg);
58 options->verify = 1;
59 break;
60 case 'r':
61 options->M = atoi(arg);
62 options->m = -options->M;
63 options->verify = 1;
64 break;
65 default:
66 return ARGP_ERR_UNKNOWN;
68 return 0;
71 void verify_options_set_range(struct verify_options *options, Polyhedron *P)
73 int r;
75 if (P->Dimension >= VBIGDIM)
76 r = VSRANGE;
77 else if (P->Dimension >= BIGDIM)
78 r = SRANGE;
79 else
80 r = RANGE;
81 if (options->M == INT_MIN)
82 options->M = r;
83 if (options->m == INT_MAX)
84 options->m = -r;
86 if (options->verify && options->m > options->M) {
87 fprintf(stderr,"Nothing to do: min > max !\n");
88 exit(0);
92 struct argp verify_argp = {
93 argp_options, parse_opt, 0, 0