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

Annotation of OpenXM/src/polymake/fake/fake-polymake.c, Revision 1.1

1.1     ! takayama    1: /* $OpenXM$ */
        !             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);
        !            36:   }else{
        !            37:        fprintf(stderr,"fake-polymake: ERROR: Unknown method, property, or label\n");
        !            38:        fprintf(stderr,"facet1.poly  FACET\n");
        !            39:        fprintf(stderr,"facelat1.poly  FACE_LATTICE\n");
        !            40:        fclose(fp);
        !            41:        exit(1);
        !            42:   }
        !            43:   fp2 = fopen(cube,"r");
        !            44:   if (fp2 == NULL) {
        !            45:        fprintf(stderr,"fake-polymake: ERROR: no data file is found.\n");
        !            46:        exit(1);
        !            47:   }
        !            48:   while ((c=fgetc(fp2)) != EOF) {
        !            49:      fputc(c,fp);
        !            50:   }
        !            51:   fclose(fp);
        !            52:
        !            53: }
        !            54:
        !            55:

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