[BACK]Return to yylex_polymake.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Diff for /OpenXM/src/kan96xx/Kan/Attic/yylex_polymake.c between version 1.2 and 1.3

version 1.2, 2003/11/20 03:25:08 version 1.3, 2003/11/20 06:04:04
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/yylex_polymake.c,v 1.1 2003/11/20 00:06:07 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/yylex_polymake.c,v 1.2 2003/11/20 03:25:08 takayama Exp $ */
 /* parser for polymake output */  /* parser for polymake output */
 /* This program requires  /* This program requires
   
Line 9 
Line 9 
 #include "yylex_polymake.h"  #include "yylex_polymake.h"
 #include "yy_polymake.tab.h"  #include "yy_polymake.tab.h"
   
 /* #define mymalloc(n) sGC_malloc(n) */  #define mymalloc(n) sGC_malloc(n)
   /*
 #define mymalloc(n) malloc(n)  #define mymalloc(n) malloc(n)
   */
 /* pm = PolyMake */  /* pm = PolyMake */
 #define PM_emptyLineCode 1  #define PM_emptyLineCode 1
   
Line 23  static int PMdebug = 0;
Line 25  static int PMdebug = 0;
   
 /* char *PMlval; */  /* char *PMlval; */
   
   /* The function putstr() uses static variables inside,
     so if it is under use, it must not be initialized.
     The function putstr2() is for the second use and is identical
     function with putstr().
   */
 static char *putstr(int c);  static char *putstr(int c);
   static char *putstr2(int c);
   
   char *pmPutstr(int c) {
     return putstr(c);
   }
   
   pmSetS(char *s) {
     S = s;
     return 0;
   }
   
 int PMlex() {  int PMlex() {
   int type;    int type;
   type = PMlex_aux();    type = PMlex_aux();
Line 97  static char *putstr(int c) {
Line 114  static char *putstr(int c) {
         return putstr(c);          return putstr(c);
   }    }
 }  }
   static char *putstr2(int c) {
     static char *s=NULL;
     static int pt=0;
     static int limit=0;
     int i;
     char *old;
     if (c < 0) {
           s = (char *)mymalloc(PUTSTR_INIT);
           if (s == NULL) {fprintf(stderr,"No more memory.\n"); exit(10);}
           limit = PUTSTR_INIT;
           pt = 0; s[pt] = 0;
           return s;
     }
     if (s == NULL) putstr(-1);
     if (pt < limit-1) {
           s[pt++]=c; s[pt]=0;
           return s;
     }else{
           old = s;
           limit = 2*limit;
           s = (char *)mymalloc(limit);
           if (s == NULL) {fprintf(stderr,"No more memory.\n"); exit(10);}
           for (i=0; i<=pt; i++) {
             s[i] = old[i];
           }
           return putstr(c);
     }
   }
   
 pmPreprocess() {  pmPreprocess() {
   int newp,oldp;    int newp,oldp;
Line 326  void pmPrintObject(FILE *fp,pmObjectp p) {
Line 371  void pmPrintObject(FILE *fp,pmObjectp p) {
         /* sleep(100);  to call debugger. */          /* sleep(100);  to call debugger. */
         break;          break;
   }    }
 }  
   
 main_t() {  
   int c,type;  
   putstr(-1);  
   while ((c=getchar()) != EOF) {  
         putstr(c);  
   }  
   S = putstr(0);  
   printf("%s\n",S);  
   pmPreprocess(S);  
   printf("--------------------------\n");  
   printf("%s\n",S);  
   printf("--------------------------\n");  
   while ((type=PMlex()) != PM_noToken) {  
         printf("type=%d ",type);  
         if ((type == PM_number) || (type == PM_keyword)) {  
           printf("value="); pmPrintObject(stdout,PMlval);  
         }  
         printf("\n");  
   }  
 }  
   
 main() {  
   int c,type;  
   
   
   putstr(-1);  
   while ((c=getchar()) != EOF) {  
         putstr(c);  
   }  
   S = putstr(0);  
   printf("%s\n",S);  
   pmPreprocess(S);  
   printf("--------------------------\n");  
   printf("%s\n",S);  
   printf("--------------------------\n");  
   PMparse();  
 }  }
   
 PMerror() {  PMerror() {

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

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