Annotation of OpenXM/src/polymake/fake/fake-polymake.c, Revision 1.2
1.2 ! takayama 1: /* $OpenXM: OpenXM/src/polymake/fake/fake-polymake.c,v 1.1 2004/07/15 05:39:08 takayama Exp $ */
1.1 takayama 2: /* This is a fake polymake which works as follows
3: (1) By using oxhttpd (OpenXM http service), it calls the real polymake
4: and gets an answer.
5: [Not implemented]
6: or
7: (2) It only returns stored answers of polymake, i.e., it does not make
8: any computation and returns fixed answer no matter the input is.
9: */
10:
11: /* Note for takayama.
12: cf. misc-2003/11/polymake, misc-2004/07/polymake
13: orange2:this04/polymake
14: */
15:
16: #include <stdio.h>
17:
18: main(int argc,char *argv[]) {
19: FILE *fp;
20: FILE *fp2;
21: int c;
22: char cube[1024*2];
23: char *home;
24: if (argc < 3) {
25: fprintf(stderr,"This is a fake polymake\n");
26: fprintf(stderr,"Usage: polymake filename action\n");
27: exit(3);
28: }
29: fp = fopen(argv[1],"w");
30: fprintf(fp,"_This is an output of a fake polymake.\n");
31: home = (char *)getenv("OpenXM_HOME");
32: if (strcmp(argv[2],"FACET")==0 || strcmp(argv[2],"FACETS")==0) {
33: sprintf(cube,"%s/src/polymake/fake/tmp/facet.poly",home);
34: }else if (strcmp(argv[2],"FACE_LATTICE")==0) {
35: sprintf(cube,"%s/src/polymake/fake/tmp/facelat.poly",home);
1.2 ! takayama 36: printf("FACE_LATTICE\n\n");
! 37: printf("[ -1 : 3 ]\n");
! 38: printf("{{0 1} {0 2} {1 2}}\n\n");
! 39: printf("[ -2 : 3 ]\n");
! 40: printf("{{0} {1} {2}}\n");
1.1 takayama 41: }else{
42: fprintf(stderr,"fake-polymake: ERROR: Unknown method, property, or label\n");
43: fprintf(stderr,"facet1.poly FACET\n");
44: fprintf(stderr,"facelat1.poly FACE_LATTICE\n");
45: fclose(fp);
46: exit(1);
47: }
48: fp2 = fopen(cube,"r");
49: if (fp2 == NULL) {
50: fprintf(stderr,"fake-polymake: ERROR: no data file is found.\n");
51: exit(1);
52: }
53: while ((c=fgetc(fp2)) != EOF) {
54: fputc(c,fp);
55: }
56: fclose(fp);
57:
58: }
59:
60:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>