4 #include <barvinok/util.h>
5 #include <barvinok/barvinok.h>
9 #define PRINT_STATS (BV_OPT_LAST+1)
11 struct argp_option argp_options
[] = {
12 { "print-stats", PRINT_STATS
, 0, 0 },
17 struct barvinok_options
*options
;
21 error_t
parse_opt(int key
, char *arg
, struct argp_state
*state
)
23 struct arguments
*arguments
= state
->input
;
27 state
->child_inputs
[0] = arguments
->options
;
30 arguments
->print_stats
= 1;
33 return ARGP_ERR_UNKNOWN
;
38 int main(int argc
, char **argv
)
42 struct arguments arguments
;
43 static struct argp_child argp_children
[] = {
44 { &barvinok_argp
, 0, 0, 0 },
47 static struct argp argp
= { argp_options
, parse_opt
, 0, 0, argp_children
};
48 struct barvinok_options
*options
= barvinok_options_new_with_defaults();
50 arguments
.print_stats
= 0;
51 arguments
.options
= options
;
53 set_program_name(argv
[0]);
54 argp_parse(&argp
, argc
, argv
, 0, 0, &arguments
);
56 A
= Polyhedron_Read(options
->MaxRays
);
58 Polyhedron_Print(stdout
, P_VALUE_FMT
, A
);
59 barvinok_count_with_options(A
, &cb
, options
);
60 value_print(stdout
, P_VALUE_FMT
, cb
);
62 if (arguments
.print_stats
)
63 barvinok_stats_print(options
->stats
, stdout
);
66 barvinok_options_free(options
);