Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
"new ruby host method"
[simgrid.git] / src / xbt / graphxml.l
index 423adbc..373da6d 100644 (file)
@@ -1,9 +1,10 @@
-/* Validating XML processor for graphxml.dtd.
- * Generated 2006/03/21 12:59:33.
+/* Validating XML processor for xbt/graphxml.dtd.
+ * Generated 2007/12/19 15:09:56.
  *
  * This program was generated with the FleXML XML processor generator.
- * FleXML is Copyright © 1999-2005 Kristoffer Rose.  All rights reserved.
- * (Id: flexml.pl,v 1.46 2006/03/21 08:24:12 legranda Exp).
+ * FleXML is Copyright (C) 1999-2005 Kristoffer Rose.  All rights reserved.
+ * FleXML is Copyright (C) 2003-2006 Martin Quinson.  All rights reserved.
+ * (Id: flexml.pl,v 1.63 2007/10/11 14:46:08 mquinson Exp).
  * 
  * There are two, intertwined parts to this program, part A and part B.
  *
@@ -11,8 +12,8 @@
  * ------
  * 
  * Some parts, here collectively called "Part A", are found in the 
- * FleXML package.  They are Copyright © 1999-2005 Kristoffer Rose. 
- * All rights reserved.
+ * FleXML package.  They are Copyright (C) 1999-2005 Kristoffer Rose
+ * and Copyright (C) 2003-2006 Martin Quinson. All rights reserved.
  *
  * You can redistribute, use, perform, display and/or modify "Part A"
  * provided the following two conditions hold:
 
 /* Version strings. */
 const char rcs_graphxml_flexml_skeleton[] =
- "$" "Id: skel,v 1.27 2006/03/21 08:24:12 legranda Exp $";
+ "$" "Id: skel,v 1.40 2007/10/11 09:57:24 mquinson Exp $";
 const char rcs_graphxml_flexml[] =
- "$" "Id: flexml.pl,v 1.46 2006/03/21 08:24:12 legranda Exp $";
+ "$" "Id: flexml.pl,v 1.63 2007/10/11 14:46:08 mquinson Exp $";
 
 /* ANSI headers. */
-#include <unistd.h>
+#include <stdlib.h> /* for realloc() -- needed here when using flex 2.5.4 */
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
 #include <stdarg.h>
 #include <ctype.h>
+     
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
+# ifndef __STRICT_ANSI__
+#  include <io.h>
+#  include <process.h>
+# endif
+#else
+# include <unistd.h>
+#endif
+     
+#ifndef FLEXML_INDEXSTACKSIZE
+#define FLEXML_INDEXSTACKSIZE 1000
+#endif
 
 /* Generated definitions. */
 #define FLEXML_yylineno
+#ifndef FLEXML_BUFFERSTACKSIZE
 #define FLEXML_BUFFERSTACKSIZE 1000000
+#endif
+#define FLEXML_NEED_BUFFERLIT
 
 /* XML processor api. */
 /* FleXML-provided data. */
-const char* pcdata;
-AT_graphxml_edge_target A_graphxml_edge_target;
-AT_graphxml_node_name A_graphxml_node_name;
-AT_graphxml_node_label A_graphxml_node_label;
-AT_graphxml_edge_label A_graphxml_edge_label;
-AT_graphxml_edge_source A_graphxml_edge_source;
-AT_graphxml_edge_isDirected A_graphxml_edge_isDirected;
-AT_graphxml_edge_name A_graphxml_edge_name;
+int graphxml_pcdata_ix;
+extern char *graphxml_bufferstack;
+#define graphxml_pcdata (graphxml_bufferstack + graphxml_pcdata_ix)
+AT_graphxml_node_name AX_graphxml_node_name;
+#define A_graphxml_node_name (graphxml_bufferstack + AX_graphxml_node_name)
+AT_graphxml_edge_source AX_graphxml_edge_source;
+#define A_graphxml_edge_source (graphxml_bufferstack + AX_graphxml_edge_source)
+AT_graphxml_node_position_y AX_graphxml_node_position_y;
+#define A_graphxml_node_position_y (graphxml_bufferstack + AX_graphxml_node_position_y)
+AT_graphxml_node_position_x AX_graphxml_node_position_x;
+#define A_graphxml_node_position_x (graphxml_bufferstack + AX_graphxml_node_position_x)
+AT_graphxml_edge_data AX_graphxml_edge_data;
+#define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data)
+AT_graphxml_edge_target AX_graphxml_edge_target;
+#define A_graphxml_edge_target (graphxml_bufferstack + AX_graphxml_edge_target)
+AT_graphxml_graph_isDirected AX_graphxml_graph_isDirected;
+#define A_graphxml_graph_isDirected AX_graphxml_graph_isDirected
+AT_graphxml_node_label AX_graphxml_node_label;
+#define A_graphxml_node_label (graphxml_bufferstack + AX_graphxml_node_label)
+AT_graphxml_node_data AX_graphxml_node_data;
+#define A_graphxml_node_data (graphxml_bufferstack + AX_graphxml_node_data)
+AT_graphxml_edge_label AX_graphxml_edge_label;
+#define A_graphxml_edge_label (graphxml_bufferstack + AX_graphxml_edge_label)
+AT_graphxml_edge_length AX_graphxml_edge_length;
+#define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length)
+AT_graphxml_edge_name AX_graphxml_edge_name;
+#define A_graphxml_edge_name (graphxml_bufferstack + AX_graphxml_edge_name)
 
 /* XML state. */
 #ifdef FLEX_DEBUG
@@ -95,64 +131,98 @@ AT_graphxml_edge_name A_graphxml_edge_name;
 
 #define FAIL   return fail
 static int fail(const char*, ...);
-const char * graphxml_parse_err_msg(void);
+
+enum {flexml_max_err_msg_size = 512};
+static char flexml_err_msg[flexml_max_err_msg_size];
+const char * graphxml_parse_err_msg()
+{
+    return flexml_err_msg;
+}
+static void reset_graphxml_parse_err_msg()
+{
+    flexml_err_msg[0] = '\0';
+}
 
 /* Cleanup */
 static void cleanup(void);
 #define CLEANUP  cleanup()
 
 /* Text buffer stack handling. */
-char bufferstack[FLEXML_BUFFERSTACKSIZE];
-static char* limit = bufferstack + FLEXML_BUFFERSTACKSIZE;
-typedef struct BufferLast_s {
-  struct BufferLast_s *old; char* saved; char new1[1];
-} BufferLast;
-#ifdef FLEXML_HasMixed
-static BufferLast* last = (BufferLast*)0;
-#endif
-static char* next = bufferstack;
+char *graphxml_bufferstack = NULL;
+static int blimit = FLEXML_BUFFERSTACKSIZE;
+static int bnext = 1;
 
-#define BUFFERSET(P)  (P = next)
-#define BUFFERPUTC(C) (assert(next<limit), *(next++) = (C))
+static int *indexstack = NULL;
+static int ilimit = FLEXML_INDEXSTACKSIZE;
+static int inext = 1;
+
+#define BUFFERSET(P)  (P = bnext)
+#define BUFFERPUTC(C) (ck_blimit(), graphxml_bufferstack[bnext++] = (C))
 #define BUFFERDONE    (BUFFERPUTC('\0'))
 
-#define BUFFERLITERAL(C,P) bufferliteral(C,&(P),yytext)
-static void bufferliteral(char c, const char** pp, char* text)
+#define BUFFERLITERAL(C, P) graphxml_bufferliteral(C, &(P), yytext)
+
+/* after this is called, there are at least 2 slots left in the stack */
+static int ck_blimit()
+{
+     if (bnext >= blimit) {
+        blimit += FLEXML_BUFFERSTACKSIZE + 2;
+        {
+            char *temp = (char *) realloc(graphxml_bufferstack, blimit);
+            assert(temp);
+            graphxml_bufferstack = temp;
+        }
+     }
+     return 0;
+}
+
+/* after this is called, there are at least 2 slots left in the stack */
+static int ck_ilimit()
+{
+     if (inext >= ilimit) {
+        ilimit += FLEXML_INDEXSTACKSIZE + 2;
+        {
+            int *temp = (int *) realloc(indexstack, ilimit);
+            assert(temp);
+            indexstack = temp;
+        }
+     }
+     return 0;
+}
+
+#ifdef FLEXML_NEED_BUFFERLIT
+static void graphxml_bufferliteral(char c, int* pp, const char* text)
 {
-  char *s = strchr(text,c), *e = strrchr(text,c);
+  const char *s = (c ? strchr(text,c) : text-1), *e = strrchr(text,c);
   assert(s <= e); BUFFERSET(*pp);
   while (++s<e) {
-    if (isspace(*s)) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
+    if (isspace(*s) && c) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
     else BUFFERPUTC(*s);
   }
   BUFFERDONE;
 }
+#endif
 
-#ifdef FLEXML_HasMixed
-static void pushbuffer(char* p)
+static void pushbuffer(int p)
 {
-  BufferLast* l = (BufferLast*)next;
-  assert(next < limit);
-  l->old = last;
-  l->saved = p;
-  next = l->new1;
-  last = l;
+    ck_ilimit();
+    indexstack[inext++] = p;
+    indexstack[inext++] = bnext;    
 }
 
-static char* popbuffer(void)
+static int popbuffer(void)
 {
-  BufferLast* l = last;
-  assert(last != (BufferLast*)0);
-  last = l->old;
-  next = (char*)l;
-  return l->saved;
+    assert(inext >= 2);
+    bnext = indexstack[--inext];
+    return indexstack[--inext];
 }
-#endif
 
 /* General internal entities are `unput' back onto the input stream... */
 #define ENTITYTEXT(T) \
   { char *s = (T), *e = s+strlen(s);\
     while (--e >= s) { unput(*e); }}
+
+
 %}
 
 /* Flex standard options. */
@@ -215,8 +285,27 @@ const char* *graphxml_statenames=NULL;
 
  /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
  SET(PROLOG);
+ reset_graphxml_parse_err_msg();
+ graphxml_bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
+ assert(graphxml_bufferstack);
+ #ifdef FLEX_DEBUG
+ {
+     int i;
+     for (i = 0; i < blimit; i++) {
+         graphxml_bufferstack[i] = '\377';
+     }
+ }
+ #endif
+ graphxml_bufferstack[0] = '\0';
+ indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
+ assert(indexstack);
+ indexstack[0] = 0;
+
   /* FleXML_init */
-  next = bufferstack;
+  bnext = inext = 1;
+  graphxml_bufferliteral('\0', &bnext, "-1.0");
+  graphxml_bufferliteral('\0', &bnext, "-1.0");
+  graphxml_bufferliteral('\0', &bnext, "-1.0");
   if(!graphxml_statenames) {graphxml_statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
   graphxml_statenames[PROLOG] = NULL;
   graphxml_statenames[DOCTYPE] = NULL;
@@ -287,16 +376,27 @@ const char* *graphxml_statenames=NULL;
 
  /* <!-- Small DTD for xbt graphs. -->  */
 
+ /*     isDirected (true|false) "true"
+  * >  */
+
+<S_graphxml_graph,S_graphxml_graph_3,S_graphxml_graph_1,S_graphxml_graph_5,S_graphxml_graph_2,S_graphxml_graph_4,E_graphxml_graph>"<graph"{s} FAIL("Starting tag <graph> is not allowed here.");
+
 <ROOT_graphxml_graph>"<graph"{s} {
-  ENTER(AL_graphxml_graph);
+  AX_graphxml_graph_isDirected = A_graphxml_graph_isDirected_true;
+  ENTER(AL_graphxml_graph); pushbuffer(0);
   }
 
 <AL_graphxml_graph>{
+ "isDirected"{Eq}"'true'" |
+ "isDirected"{Eq}"\"true\"" A_graphxml_graph_isDirected = A_graphxml_graph_isDirected_true;
+ "isDirected"{Eq}"'false'" |
+ "isDirected"{Eq}"\"false\"" A_graphxml_graph_isDirected = A_graphxml_graph_isDirected_false;
+
  ">" {
-  LEAVE; STag_graphxml_graph();pcdata = NULL; ENTER(S_graphxml_graph);
+  LEAVE; STag_graphxml_graph();graphxml_pcdata_ix = 0; ENTER(S_graphxml_graph);
  }
  "/>" {
-  LEAVE; STag_graphxml_graph(); pcdata = NULL; ETag_graphxml_graph();
+  LEAVE; STag_graphxml_graph(); graphxml_pcdata_ix = 0; ETag_graphxml_graph(); popbuffer(); /* attribute */
   switch (YY_START) {
    case ROOT_graphxml_graph: SET(EPILOG); break;
   }
@@ -310,6 +410,7 @@ const char* *graphxml_statenames=NULL;
  "</graph"{s}">" {
   LEAVE;
   ETag_graphxml_graph();
+  popbuffer(); /* attribute */
   switch (YY_START) {
    case ROOT_graphxml_graph: SET(EPILOG); break;
   }
@@ -321,28 +422,45 @@ const char* *graphxml_statenames=NULL;
 
  /*     label           CDATA                ""
   *     name            CDATA                #REQUIRED
+  *     data            CDATA                ""
+  *     position_x         CDATA                "-1.0"
+  *     position_y         CDATA                "-1.0"
   * >  */
 
+<S_graphxml_graph_1,S_graphxml_graph_5,S_graphxml_graph_4,E_graphxml_graph>"<node"{s} FAIL("Starting tag <node> is not allowed here.");
+
 <ROOT_graphxml_node,S_graphxml_graph_2,S_graphxml_graph_3,S_graphxml_graph>"<node"{s} {
-  A_graphxml_node_label = NULL;
-  A_graphxml_node_name = NULL;
-  ENTER(AL_graphxml_node);
+  AX_graphxml_node_label = 0;
+  AX_graphxml_node_name = 0;
+  AX_graphxml_node_data = 0;
+  AX_graphxml_node_position_x = 1;
+  AX_graphxml_node_position_y = 6;
+  ENTER(AL_graphxml_node); pushbuffer(0);
   }
 
 <AL_graphxml_node>{
- "label"{Eq}\' ENTER(VALUE1); BUFFERSET(A_graphxml_node_label);
- "label"{Eq}\" ENTER(VALUE2); BUFFERSET(A_graphxml_node_label);
+ "label"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_node_label);
+ "label"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_node_label);
+
+ "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_node_name);
+ "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_node_name);
+
+ "data"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_node_data);
+ "data"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_node_data);
 
- "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_graphxml_node_name);
- "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_graphxml_node_name);
+ "position_x"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_node_position_x);
+ "position_x"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_node_position_x);
+
+ "position_y"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_node_position_y);
+ "position_y"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_node_position_y);
 
  ">" {
-  if (!A_graphxml_node_name) FAIL("Required attribute `name' not set for `node' element.");
-  LEAVE; STag_graphxml_node();pcdata = NULL; ENTER(E_graphxml_node);
+  if (!AX_graphxml_node_name) FAIL("Required attribute `name' not set for `node' element.");
+  LEAVE; STag_graphxml_node();graphxml_pcdata_ix = 0; ENTER(E_graphxml_node);
  }
  "/>" {
-  if (!A_graphxml_node_name) FAIL("Required attribute `name' not set for `node' element.");
-  LEAVE; STag_graphxml_node(); pcdata = NULL; ETag_graphxml_node();
+  if (!AX_graphxml_node_name) FAIL("Required attribute `name' not set for `node' element.");
+  LEAVE; STag_graphxml_node(); graphxml_pcdata_ix = 0; ETag_graphxml_node(); popbuffer(); /* attribute */
   switch (YY_START) {
    case S_graphxml_graph_2: case S_graphxml_graph_3: case S_graphxml_graph: SET(S_graphxml_graph_3); break;
    case ROOT_graphxml_node: SET(EPILOG); break;
@@ -357,6 +475,7 @@ const char* *graphxml_statenames=NULL;
  "</node"{s}">" {
   LEAVE;
   ETag_graphxml_node();
+  popbuffer(); /* attribute */
   switch (YY_START) {
    case S_graphxml_graph_2: case S_graphxml_graph_3: case S_graphxml_graph: SET(S_graphxml_graph_3); break;
    case ROOT_graphxml_node: SET(EPILOG); break;
@@ -368,48 +487,53 @@ const char* *graphxml_statenames=NULL;
 }
 
  /*     label           CDATA                ""
-  *     name       CDATA        #IMPLIED
-  *     source     CDATA        #REQUIRED
-  *     target     CDATA        #REQUIRED
-  *     isDirected (true|false) "true"
+  *     name            CDATA               #IMPLIED
+  *     source          CDATA               #REQUIRED
+  *     target          CDATA               #REQUIRED
+  *     length          CDATA               "-1.0"
+  *     data            CDATA               ""
   * >  */
 
+<S_graphxml_graph_2,E_graphxml_graph>"<edge"{s} FAIL("Starting tag <edge> is not allowed here.");
+
 <ROOT_graphxml_edge,S_graphxml_graph_1,S_graphxml_graph_3,S_graphxml_graph_5,S_graphxml_graph_4,S_graphxml_graph>"<edge"{s} {
-  A_graphxml_edge_label = NULL;
-  A_graphxml_edge_name = NULL;
-  A_graphxml_edge_source = NULL;
-  A_graphxml_edge_target = NULL;
-  A_graphxml_edge_isDirected = A_graphxml_edge_isDirected_true;
-  ENTER(AL_graphxml_edge);
+  AX_graphxml_edge_label = 0;
+  AX_graphxml_edge_name = 0;
+  AX_graphxml_edge_source = 0;
+  AX_graphxml_edge_target = 0;
+  AX_graphxml_edge_length = 11;
+  AX_graphxml_edge_data = 0;
+  ENTER(AL_graphxml_edge); pushbuffer(0);
   }
 
 <AL_graphxml_edge>{
- "label"{Eq}\' ENTER(VALUE1); BUFFERSET(A_graphxml_edge_label);
- "label"{Eq}\" ENTER(VALUE2); BUFFERSET(A_graphxml_edge_label);
+ "label"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_label);
+ "label"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_label);
 
- "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_graphxml_edge_name);
- "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_graphxml_edge_name);
+ "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_name);
+ "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_name);
 
- "source"{Eq}\' ENTER(VALUE1); BUFFERSET(A_graphxml_edge_source);
- "source"{Eq}\" ENTER(VALUE2); BUFFERSET(A_graphxml_edge_source);
+ "source"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_source);
+ "source"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_source);
 
- "target"{Eq}\' ENTER(VALUE1); BUFFERSET(A_graphxml_edge_target);
- "target"{Eq}\" ENTER(VALUE2); BUFFERSET(A_graphxml_edge_target);
+ "target"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_target);
+ "target"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_target);
 
- "isDirected"{Eq}"'true'" |
- "isDirected"{Eq}"\"true\"" A_graphxml_edge_isDirected = A_graphxml_edge_isDirected_true;
- "isDirected"{Eq}"'false'" |
- "isDirected"{Eq}"\"false\"" A_graphxml_edge_isDirected = A_graphxml_edge_isDirected_false;
+ "length"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_length);
+ "length"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_length);
+
+ "data"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_data);
+ "data"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_data);
 
  ">" {
-  if (!A_graphxml_edge_source) FAIL("Required attribute `source' not set for `edge' element.");
-  if (!A_graphxml_edge_target) FAIL("Required attribute `target' not set for `edge' element.");
-  LEAVE; STag_graphxml_edge();pcdata = NULL; ENTER(E_graphxml_edge);
+  if (!AX_graphxml_edge_source) FAIL("Required attribute `source' not set for `edge' element.");
+  if (!AX_graphxml_edge_target) FAIL("Required attribute `target' not set for `edge' element.");
+  LEAVE; STag_graphxml_edge();graphxml_pcdata_ix = 0; ENTER(E_graphxml_edge);
  }
  "/>" {
-  if (!A_graphxml_edge_source) FAIL("Required attribute `source' not set for `edge' element.");
-  if (!A_graphxml_edge_target) FAIL("Required attribute `target' not set for `edge' element.");
-  LEAVE; STag_graphxml_edge(); pcdata = NULL; ETag_graphxml_edge();
+  if (!AX_graphxml_edge_source) FAIL("Required attribute `source' not set for `edge' element.");
+  if (!AX_graphxml_edge_target) FAIL("Required attribute `target' not set for `edge' element.");
+  LEAVE; STag_graphxml_edge(); graphxml_pcdata_ix = 0; ETag_graphxml_edge(); popbuffer(); /* attribute */
   switch (YY_START) {
    case S_graphxml_graph_1: case S_graphxml_graph_3: case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph: SET(S_graphxml_graph_5); break;
    case ROOT_graphxml_edge: SET(EPILOG); break;
@@ -424,6 +548,7 @@ const char* *graphxml_statenames=NULL;
  "</edge"{s}">" {
   LEAVE;
   ETag_graphxml_edge();
+  popbuffer(); /* attribute */
   switch (YY_START) {
    case S_graphxml_graph_1: case S_graphxml_graph_3: case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph: SET(S_graphxml_graph_5); break;
    case ROOT_graphxml_edge: SET(EPILOG); break;
@@ -512,19 +637,39 @@ void print_yy_stack(char* fmt, ...)
 {
   int i = 0; va_list ap; va_start(ap, fmt);
   vfprintf(stderr, fmt, ap);
-  for (i=1; i<yy_start_stack_ptr; i++)
-    fprintf(stderr, "%s/", graphxml_statenames[yy_start_stack[i] ]);
-  fprintf(stderr,"%s\n", graphxml_statenames[YY_START]);
+  if (graphxml_statenames) {
+      for (i=1; i<yy_start_stack_ptr; i++) {
+          fprintf(stderr, "%s/", graphxml_statenames[yy_start_stack[i] ]);
+      }
+      fprintf(stderr,"%s\n", graphxml_statenames[YY_START]);
+  }
   va_end(ap);
 }
 
+void print_graphxml_bufferstack()
+{
+    int i;
+    fputs("Buffer: ", stderr);
+    for (i = 0; i < blimit; i++) {
+       if ( graphxml_bufferstack[i] == '\377' ) break;
+         putc(graphxml_bufferstack[i], stderr);
+    }
+    putc('\n', stderr);
+}
+
 static void debug_enter(int state, const char* statename) {
   yy_push_state(state);
-  if (yy_flex_debug) print_yy_stack("--ENTER(%s) : ",statename);
+  if (yy_flex_debug) {
+       print_yy_stack("--ENTER(%s) : ",statename);
+       print_graphxml_bufferstack();
+  }
 }
 
 static void debug_leave(void) {
-  if (yy_flex_debug) print_yy_stack("--LEAVE : ");
+    if (yy_flex_debug) {
+        print_yy_stack("--LEAVE : ");
+       print_graphxml_bufferstack();
+    }
   yy_pop_state();
 }
 
@@ -534,19 +679,6 @@ static void debug_set(int state, const char* statename) {
 }
 #endif
 
-enum {flexml_max_err_msg_size = 512};
-
-static char flexml_err_msg[flexml_max_err_msg_size];
-const char * graphxml_parse_err_msg()
-{
-    return flexml_err_msg;
-}
-
-static void reset_graphxml_parse_err_msg()
-{
-    flexml_err_msg[0] = '\0';
-}
-
 
 static void cleanup(void)
 {
@@ -554,6 +686,11 @@ static void cleanup(void)
         free(graphxml_statenames);
        graphxml_statenames = NULL;
     }
+    free(graphxml_bufferstack);
+    graphxml_bufferstack = NULL;
+
+    free(indexstack);
+    indexstack = NULL;
 }