[BACK]Return to fake-polymake.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / polymake / fake

Diff for /OpenXM/src/polymake/fake/fake-polymake.c between version 1.2 and 1.3

version 1.2, 2004/07/29 02:50:52 version 1.3, 2004/08/21 00:27:56
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/polymake/fake/fake-polymake.c,v 1.1 2004/07/15 05:39:08 takayama Exp $ */  /* $OpenXM: OpenXM/src/polymake/fake/fake-polymake.c,v 1.2 2004/07/29 02:50:52 takayama Exp $ */
 /* This is a fake polymake which works as follows  /* This is a fake polymake which works as follows
    (1) By using oxhttpd (OpenXM http service), it calls the real polymake     (1) By using oxhttpd (OpenXM http service), it calls the real polymake
        and gets an answer.         and gets an answer.
Line 18  or
Line 18  or
 main(int argc,char *argv[]) {  main(int argc,char *argv[]) {
   FILE *fp;    FILE *fp;
   FILE *fp2;    FILE *fp2;
   int c;    FILE *rfp;
     int c,i;
   char cube[1024*2];    char cube[1024*2];
   char *home;    char *home;
   if (argc < 3) {    if (argc < 3) {
         fprintf(stderr,"This is a fake polymake\n");      fprintf(stderr,"This is a fake polymake\n");
     fprintf(stderr,"Usage: polymake filename action\n");      fprintf(stderr,"Usage: polymake filename action\n");
       fprintf(stderr,"Remove files you do not use in tmp/ \n");
     exit(3);      exit(3);
   }    }
   fp = fopen(argv[1],"w");    fp = fopen(argv[1],"w");
   fprintf(fp,"_This is an output of a fake polymake.\n");    fprintf(fp,"_This is an output of a fake polymake.\n");
   home = (char *)getenv("OpenXM_HOME");    home = (char *)getenv("OpenXM_HOME");
   if (strcmp(argv[2],"FACET")==0 || strcmp(argv[2],"FACETS")==0) {    for (i=0; i<1; i++) {
         sprintf(cube,"%s/src/polymake/fake/tmp/facet.poly",home);      if (strcmp(argv[2],"FACET")==0 || strcmp(argv[2],"FACETS")==0) {
   }else if (strcmp(argv[2],"FACE_LATTICE")==0) {        sprintf(cube,"%s/src/polymake/fake/tmp/facet.poly",home);
         sprintf(cube,"%s/src/polymake/fake/tmp/facelat.poly",home);        if ((rfp = fopen(cube,"r")) != NULL) {
         printf("FACE_LATTICE\n\n");          fclose(rfp); break;
         printf("[ -1 : 3 ]\n");        }
         printf("{{0 1} {0 2} {1 2}}\n\n");        sprintf(cube,"%s/src/polymake/fake/tmp/ineq2.poly",home);
         printf("[ -2 : 3 ]\n");        if ((rfp = fopen(cube,"r")) != NULL) {
         printf("{{0} {1} {2}}\n");          fclose(rfp);
   }else{          printf("FACETS\n");
         fprintf(stderr,"fake-polymake: ERROR: Unknown method, property, or label\n");          printf("0 0 1 1\n");
         fprintf(stderr,"facet1.poly  FACET\n");          printf("0 0 1 1\n");
         fprintf(stderr,"facelat1.poly  FACE_LATTICE\n");          printf("0 0 1 1\n");
         fclose(fp);          printf("0 1 1 0\n");
         exit(1);          printf("0 1 -1 0\n");
           printf("0 0 0 1\n");
                   break;
         }
       }else if (strcmp(argv[2],"FACE_LATTICE")==0) {
         sprintf(cube,"%s/src/polymake/fake/tmp/facelat.poly",home);
         if ((rfp = fopen(cube,"r")) != NULL) {
           fclose(rfp);
           printf("FACE_LATTICE\n\n");
           printf("[ -1 : 3 ]\n");
           printf("{{0 1} {0 2} {1 2}}\n\n");
           printf("[ -2 : 3 ]\n");
           printf("{{0} {1} {2}}\n");
         }
       }else{
         fprintf(stderr,"fake-polymake: ERROR: Unknown method, property, or label\n");
         fprintf(stderr,"facet1.poly  FACET\n");
         fprintf(stderr,"facelat1.poly  FACE_LATTICE\n");
         fclose(fp);
         exit(1);
       }
   }    }
   fp2 = fopen(cube,"r");    fp2 = fopen(cube,"r");
   if (fp2 == NULL) {    if (fp2 == NULL) {
         fprintf(stderr,"fake-polymake: ERROR: no data file is found.\n");      fprintf(stderr,"fake-polymake: ERROR: no data file is found.\n");
         exit(1);      exit(1);
   }    }
   while ((c=fgetc(fp2)) != EOF) {    while ((c=fgetc(fp2)) != EOF) {
      fputc(c,fp);       fputc(c,fp);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>