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

File: [local] / OpenXM / src / kan96xx / trans / yymain_polymake.c (download)

Revision 1.4, Thu Jul 15 07:50:40 2004 UTC (19 years, 11 months ago) by takayama
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, RELEASE_1_2_3, KNOPPIX_2006, DEB_REL_1_2_3-9
Changes since 1.3: +2 -1 lines

polymake2tfb accepts an extended grammer of polymake data files.
It is a preparation of a new polymake interface for Grobner fan.
Example:
$ ./polymake2tfb
F
[ -1 : 3 ]
{{0 1} {0 2} {1 2}}

returns

polymake.data(polymake.F([polymake._bracket(polymake._colon([-1],[3])),polymake._set([polymake._set([0,1]),[polymake._set([0,2]),polymake._set([1,2])]])]))

/* $OpenXM: OpenXM/src/kan96xx/trans/yymain_polymake.c,v 1.4 2004/07/15 07:50:40 takayama Exp $ */
#include <stdio.h>
#include "yylex_polymake.h"
#include "yy_polymake.tab.h"


char *SS=NULL;
main_t() {
  int c,type;
  pmPutstr(-1);
  while ((c=getchar()) != EOF) {
	pmPutstr(c);
  }
  pmPutstr('\n');
  SS = pmPutstr(0);
  printf("%s\n",SS);
  pmSetS(SS);
  pmPreprocess();
  printf("--------------------------\n");
  printf("%s\n",SS);
  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;
  
  pmPutstr(-1);
  while ((c=getchar()) != EOF) {
	pmPutstr(c);
  }
  pmPutstr('\n');
  SS = pmPutstr(0);
#ifdef DEBUG
  printf("%s\n",SS);
#endif
  pmSetS(SS);
  pmPreprocess();
#ifdef DEBUG
  printf("--------------------------\n");
  printf("%s\n",SS);
  printf("--------------------------\n");
#endif
  PMparse();
}

sGC_malloc(int n) {
  return GC_malloc(n);
}

PMerror() {
  fprintf(stderr,"Parse error. cf. yylex_polymake.c: PM_debug=1;\n");
}