adapt determination of git HEAD to recent git versions
[barvinok.git] / barvinok_count.c
blob1088fb18dbc003951013f3354130312c562d5cce
1 #include <unistd.h>
2 #include <stdlib.h>
3 #include <polylib/polylibgmp.h>
4 #include <barvinok/util.h>
5 #include <barvinok/barvinok.h>
6 #include "config.h"
8 #ifdef HAVE_GROWING_CHERNIKOVA
9 #define MAXRAYS POL_NO_DUAL
10 #else
11 #define MAXRAYS 600
12 #endif
14 #ifndef HAVE_GETOPT_H
15 #define getopt_long(a,b,c,d,e) getopt(a,b,c)
16 #else
17 #include <getopt.h>
18 struct option options[] = {
19 { "version", no_argument, 0, 'V' },
20 { 0, 0, 0, 0 }
22 #endif
24 int main(int argc, char **argv)
26 Value cb;
27 Polyhedron *A;
28 Matrix *M;
29 int c, ind = 0;
31 while ((c = getopt_long(argc, argv, "V", options, &ind)) != -1) {
32 switch (c) {
33 case 'V':
34 printf(barvinok_version());
35 exit(0);
36 break;
40 M = Matrix_Read();
41 A = Constraints2Polyhedron(M, MAXRAYS);
42 Matrix_Free(M);
43 value_init(cb);
44 Polyhedron_Print(stdout, P_VALUE_FMT, A);
45 barvinok_count(A, &cb, MAXRAYS);
46 value_print(stdout, P_VALUE_FMT, cb);
47 puts("");
48 value_clear(cb);
49 Polyhedron_Free(A);
50 return 0;