7 #include <barvinok/evalue.h>
8 #include <barvinok/barvinok.h>
10 /* gcc -shared -g collect_polytopes.c -rdynamic -o libcollect.so -ldl -lc -lgmp */
12 evalue
* barvinok_enumerate_e(Polyhedron
*P
,
13 unsigned exist
, unsigned nparam
, unsigned MaxRays
)
15 static evalue
*(*orig
)(Polyhedron
*, unsigned, unsigned, unsigned) = NULL
;
16 static char *prefix
= NULL
;
18 static int recurse
= 0;
19 static int counter
= 0;
22 void *handle
= dlopen("libbarvinok.so", RTLD_LAZY
);
24 orig
= dlsym(handle
, "barvinok_enumerate_e");
28 prefix
= getenv("POLYTOPE_PREFIX");
30 prefix
= strdup(prefix
);
33 if (prefix
&& !recurse
) {
39 snprintf(path
, PATH_MAX
, "%s%05d", prefix
, counter
++);
41 fprintf(f
, "%d %d\n", nr
=P
->NbConstraints
, nc
=P
->Dimension
+2);
42 for (i
=0; i
< nr
; i
++) {
43 for (j
=0; j
< nc
; j
++) {
44 value_print(f
," "P_VALUE_FMT
" ", P
->Constraint
[i
][j
]);
48 fprintf(f
, "\nE %d\nP %d\n", exist
, nparam
);
53 res
= orig(P
, exist
, nparam
, MaxRays
);