Annotation of OpenXM/src/polymake/fake/fake-polymake.c, Revision 1.3
1.3 ! takayama 1: /* $OpenXM: OpenXM/src/polymake/fake/fake-polymake.c,v 1.2 2004/07/29 02:50:52 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;
1.3 ! takayama 21: FILE *rfp;
! 22: int c,i;
1.1 takayama 23: char cube[1024*2];
24: char *home;
25: if (argc < 3) {
1.3 ! takayama 26: fprintf(stderr,"This is a fake polymake\n");
1.1 takayama 27: fprintf(stderr,"Usage: polymake filename action\n");
1.3 ! takayama 28: fprintf(stderr,"Remove files you do not use in tmp/ \n");
1.1 takayama 29: exit(3);
30: }
31: fp = fopen(argv[1],"w");
32: fprintf(fp,"_This is an output of a fake polymake.\n");
33: home = (char *)getenv("OpenXM_HOME");
1.3 ! takayama 34: for (i=0; i<1; i++) {
! 35: if (strcmp(argv[2],"FACET")==0 || strcmp(argv[2],"FACETS")==0) {
! 36: sprintf(cube,"%s/src/polymake/fake/tmp/facet.poly",home);
! 37: if ((rfp = fopen(cube,"r")) != NULL) {
! 38: fclose(rfp); break;
! 39: }
! 40: sprintf(cube,"%s/src/polymake/fake/tmp/ineq2.poly",home);
! 41: if ((rfp = fopen(cube,"r")) != NULL) {
! 42: fclose(rfp);
! 43: printf("FACETS\n");
! 44: printf("0 0 1 1\n");
! 45: printf("0 0 1 1\n");
! 46: printf("0 0 1 1\n");
! 47: printf("0 1 1 0\n");
! 48: printf("0 1 -1 0\n");
! 49: printf("0 0 0 1\n");
! 50: break;
! 51: }
! 52: }else if (strcmp(argv[2],"FACE_LATTICE")==0) {
! 53: sprintf(cube,"%s/src/polymake/fake/tmp/facelat.poly",home);
! 54: if ((rfp = fopen(cube,"r")) != NULL) {
! 55: fclose(rfp);
! 56: printf("FACE_LATTICE\n\n");
! 57: printf("[ -1 : 3 ]\n");
! 58: printf("{{0 1} {0 2} {1 2}}\n\n");
! 59: printf("[ -2 : 3 ]\n");
! 60: printf("{{0} {1} {2}}\n");
! 61: }
! 62: }else{
! 63: fprintf(stderr,"fake-polymake: ERROR: Unknown method, property, or label\n");
! 64: fprintf(stderr,"facet1.poly FACET\n");
! 65: fprintf(stderr,"facelat1.poly FACE_LATTICE\n");
! 66: fclose(fp);
! 67: exit(1);
! 68: }
1.1 takayama 69: }
70: fp2 = fopen(cube,"r");
71: if (fp2 == NULL) {
1.3 ! takayama 72: fprintf(stderr,"fake-polymake: ERROR: no data file is found.\n");
! 73: exit(1);
1.1 takayama 74: }
75: while ((c=fgetc(fp2)) != EOF) {
76: fputc(c,fp);
77: }
78: fclose(fp);
79:
80: }
81:
82:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>