Provide replacement for new PolyLib function Param_Polyhedron_Scale_Integer
[barvinok.git] / verify.c
blobb1806ccb70de70c6c4c8f08c1b05bb2f6db79c49
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 { "min", 'm', "int", 0 },
23 { "max", 'M', "int", 0 },
24 { "range", 'r', "int", 0 },
25 { 0 }
28 static error_t parse_opt(int key, char *arg, struct argp_state *state)
30 struct verify_options *options = state->input;
32 switch (key) {
33 case ARGP_KEY_INIT:
34 options->verify = 0;
35 options->print_all = 0;
36 options->m = INT_MAX;
37 options->M = INT_MIN;
38 break;
39 case ARGP_KEY_FINI:
40 break;
41 case 'T':
42 options->verify = 1;
43 break;
44 case 'A':
45 options->print_all = 1;
46 break;
47 case 'm':
48 options->m = atoi(arg);
49 options->verify = 1;
50 break;
51 case 'M':
52 options->M = atoi(arg);
53 options->verify = 1;
54 break;
55 case 'r':
56 options->M = atoi(arg);
57 options->m = -options->M;
58 options->verify = 1;
59 break;
60 default:
61 return ARGP_ERR_UNKNOWN;
63 return 0;
66 void verify_options_set_range(struct verify_options *options, Polyhedron *P)
68 int r;
70 if (P->Dimension >= VBIGDIM)
71 r = VSRANGE;
72 else if (P->Dimension >= BIGDIM)
73 r = SRANGE;
74 else
75 r = RANGE;
76 if (options->M == INT_MIN)
77 options->M = r;
78 if (options->m == INT_MAX)
79 options->m = -r;
81 if (options->verify && options->m > options->M) {
82 fprintf(stderr,"Nothing to do: min > max !\n");
83 exit(0);
87 struct argp verify_argp = {
88 argp_options, parse_opt, 0, 0