Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ask for version 1. Default is version 0.
[simgrid.git] / src / surf / surfxml.l
index c414b99..c9f1a1e 100644 (file)
@@ -1,12 +1,21 @@
 /* Validating XML processor for surfxml.dtd.
- * Generated 2005/01/09 15:25:17.
+ * Generated 2006/05/29 23:03:05.
  *
- * This program was generated with the FleXML XML processor generator,
- * (Id: flexml.pl,v 1.35 2005/01/05 06:29:58 legranda Exp).
- * Copyright © 1999 Kristoffer Rose.  All rights reserved.
+ * 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.48 2006/03/21 13:09:12 mquinson Exp).
+ * 
+ * There are two, intertwined parts to this program, part A and part B.
  *
- * You can redistribute and/or modify this program provided the following
- * two conditions hold:
+ * Part A
+ * ------
+ * 
+ * Some parts, here collectively called "Part A", are found in the 
+ * FleXML package.  They are Copyright © 1999-2005 Kristoffer Rose. 
+ * All rights reserved.
+ *
+ * You can redistribute, use, perform, display and/or modify "Part A"
+ * provided the following two conditions hold:
  *
  * 1. The program is distributed WITHOUT ANY WARRANTY from the author of
  *    FleXML; without even the implied warranty of MERCHANTABILITY or
  * Notice that these are explicit rights granted to you for files
  * generated by the FleXML system.  For your rights in connection with
  * the FleXML system itself please consult the GNU General Public License.
+ * 
+ * Part B
+ * ------
+ * 
+ * The other parts, here collectively called "Part B", and which came 
+ * from the DTD used by FleXML to generate this program, can be 
+ * distributed (or not, as the case may be) under the terms of whoever
+ * wrote them, provided these terms respect and obey the two conditions 
+ * above under the heading "Part A".
+ *
+ * The author of and contributors to FleXML specifically disclaim
+ * any copyright interest in "Part B", unless "Part B" was written 
+ * by the author of or contributors to FleXML.
+ * 
  */
 
 %{
 
 /* Version strings. */
-const char rcs_flexml_skeleton[] =
- "$" "Id: skel,v 1.19 2005/01/05 18:49:27 legranda Exp $";
-const char rcs_flexml[] =
- "$" "Id: flexml.pl,v 1.35 2005/01/05 06:29:58 legranda Exp $";
+const char rcs_surfxml_flexml_skeleton[] =
+ "$" "Id: skel,v 1.28 2006/03/21 12:04:13 legranda Exp $";
+const char rcs_surfxml_flexml[] =
+ "$" "Id: flexml.pl,v 1.48 2006/03/21 13:09:12 mquinson Exp $";
 
 /* ANSI headers. */
 #include <unistd.h>
@@ -39,40 +62,43 @@ const char rcs_flexml[] =
 
 /* Generated definitions. */
 #define FLEXML_yylineno
-#define FLEXML_BUFFERSTACKSIZE 10000000
+#define FLEXML_BUFFERSTACKSIZE 1000000
 
 /* XML processor api. */
-#include "surfxml.h"
-
 /* FleXML-provided data. */
-const char* pcdata;
-AT_network_link_bandwidth A_network_link_bandwidth;
-AT_cpu_name A_cpu_name;
-AT_network_link_state A_network_link_state;
-AT_argument_value A_argument_value;
-AT_cpu_availability_file A_cpu_availability_file;
-AT_process_host A_process_host;
-AT_route_impact_on_src A_route_impact_on_src;
-AT_route_src A_route_src;
-AT_network_link_latency_file A_network_link_latency_file;
-AT_route_impact_on_dst_with_other_send A_route_impact_on_dst_with_other_send;
-AT_cpu_interference_send_recv A_cpu_interference_send_recv;
-AT_cpu_availability A_cpu_availability;
-AT_route_impact_on_dst A_route_impact_on_dst;
-AT_cpu_interference_recv A_cpu_interference_recv;
-AT_route_impact_on_src_with_other_recv A_route_impact_on_src_with_other_recv;
-AT_network_link_name A_network_link_name;
-AT_route_element_name A_route_element_name;
-AT_cpu_power A_cpu_power;
-AT_include_file A_include_file;
-AT_process_function A_process_function;
-AT_route_dst A_route_dst;
-AT_cpu_state A_cpu_state;
-AT_network_link_latency A_network_link_latency;
-AT_network_link_state_file A_network_link_state_file;
-AT_cpu_interference_send A_cpu_interference_send;
-AT_cpu_state_file A_cpu_state_file;
-AT_network_link_bandwidth_file A_network_link_bandwidth_file;
+const char* surfxml_pcdata;
+AT_surfxml_network_link_bandwidth A_surfxml_network_link_bandwidth;
+AT_surfxml_process_host A_surfxml_process_host;
+AT_surfxml_network_link_latency_file A_surfxml_network_link_latency_file;
+AT_surfxml_route_impact_on_dst_with_other_send A_surfxml_route_impact_on_dst_with_other_send;
+AT_surfxml_cpu_interference_send_recv A_surfxml_cpu_interference_send_recv;
+AT_surfxml_route_impact_on_dst A_surfxml_route_impact_on_dst;
+AT_surfxml_platform_description_version A_surfxml_platform_description_version;
+AT_surfxml_route_impact_on_src_with_other_recv A_surfxml_route_impact_on_src_with_other_recv;
+AT_surfxml_route_element_name A_surfxml_route_element_name;
+AT_surfxml_process_start_time A_surfxml_process_start_time;
+AT_surfxml_process_function A_surfxml_process_function;
+AT_surfxml_cpu_state A_surfxml_cpu_state;
+AT_surfxml_cpu_interference_send A_surfxml_cpu_interference_send;
+AT_surfxml_network_link_bandwidth_file A_surfxml_network_link_bandwidth_file;
+AT_surfxml_cpu_name A_surfxml_cpu_name;
+AT_surfxml_process_kill_time A_surfxml_process_kill_time;
+AT_surfxml_network_link_state A_surfxml_network_link_state;
+AT_surfxml_cpu_availability_file A_surfxml_cpu_availability_file;
+AT_surfxml_argument_value A_surfxml_argument_value;
+AT_surfxml_route_src A_surfxml_route_src;
+AT_surfxml_route_impact_on_src A_surfxml_route_impact_on_src;
+AT_surfxml_cpu_max_outgoing_rate A_surfxml_cpu_max_outgoing_rate;
+AT_surfxml_cpu_availability A_surfxml_cpu_availability;
+AT_surfxml_cpu_interference_recv A_surfxml_cpu_interference_recv;
+AT_surfxml_network_link_name A_surfxml_network_link_name;
+AT_surfxml_cpu_power A_surfxml_cpu_power;
+AT_surfxml_include_file A_surfxml_include_file;
+AT_surfxml_network_link_sharing_policy A_surfxml_network_link_sharing_policy;
+AT_surfxml_route_dst A_surfxml_route_dst;
+AT_surfxml_network_link_latency A_surfxml_network_link_latency;
+AT_surfxml_cpu_state_file A_surfxml_cpu_state_file;
+AT_surfxml_network_link_state_file A_surfxml_network_link_state_file;
 
 /* XML state. */
 #ifdef FLEX_DEBUG
@@ -90,19 +116,26 @@ AT_network_link_bandwidth_file A_network_link_bandwidth_file;
 
 /* Generic actions. */
 #define SKIP   /*skip*/
-#define SUCCEED        return 0
+#define SUCCEED        CLEANUP; return 0
 
 #define FAIL   return fail
 static int fail(const char*, ...);
+const char * surfxml_parse_err_msg(void);
+
+/* Cleanup */
+static void cleanup(void);
+#define CLEANUP  cleanup()
 
 /* Text buffer stack handling. */
-char bufferstack[FLEXML_BUFFERSTACKSIZE];
-char* limit = bufferstack + FLEXML_BUFFERSTACKSIZE;
+static char bufferstack[FLEXML_BUFFERSTACKSIZE];
+static char* limit = bufferstack + FLEXML_BUFFERSTACKSIZE;
 typedef struct BufferLast_s {
-  struct BufferLast_s *old; char* saved; char new[1];
+  struct BufferLast_s *old; char* saved; char new1[1];
 } BufferLast;
-BufferLast* last = (BufferLast*)0;
-char* next = bufferstack;
+#ifdef FLEXML_HasMixed
+static BufferLast* last = (BufferLast*)0;
+#endif
+static char* next = bufferstack;
 
 #define BUFFERSET(P)  (P = next)
 #define BUFFERPUTC(C) (assert(next<limit), *(next++) = (C))
@@ -116,7 +149,7 @@ static void bufferliteral(char c, const char** pp, char* text)
   while (++s<e) {
     if (isspace(*s)) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
     else BUFFERPUTC(*s);
-  } 
+  }
   BUFFERDONE;
 }
 
@@ -127,7 +160,7 @@ static void pushbuffer(char* p)
   assert(next < limit);
   l->old = last;
   l->saved = p;
-  next = l->new;
+  next = l->new1;
   last = l;
 }
 
@@ -186,82 +219,84 @@ Literal           \'[^'']*\'|\"[^""]*\"
  * INPI                inside an XML PI <?...?>
  * VALUE1      inside a '...'-delimited literal
  * VALUE2      inside a "..."-delimited literal
- * CDATA       inside a <![CDATA[...]]> section.
+ * CDATA       inside a <![CDATA[...] ]> section.
  * ROOT_<tag>  expect root element <tag>
  * AL_<tag>    inside the attribute list for <tag>
  * IN_<tag>    inside a <tag> with element contents (ready for end tag)
  * IMPOSSIBLE  dummy to permit disabling rules; must be last
  */
 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
-%x ROOT_platform_description AL_platform_description S_platform_description S_platform_description_1 S_platform_description_2 E_platform_description
-%x ROOT_include AL_include S_include S_include_1 S_include_2 E_include
-%x ROOT_cpu AL_cpu E_cpu
-%x ROOT_network_link AL_network_link E_network_link
-%x ROOT_route AL_route S_route S_route_1 S_route_2 E_route
-%x ROOT_route_element AL_route_element E_route_element
-%x ROOT_process AL_process S_process S_process_1 S_process_2 E_process
-%x ROOT_argument AL_argument E_argument
+%x ROOT_surfxml_platform_description AL_surfxml_platform_description S_surfxml_platform_description S_surfxml_platform_description_1 S_surfxml_platform_description_2 E_surfxml_platform_description
+%x ROOT_surfxml_include AL_surfxml_include S_surfxml_include S_surfxml_include_1 S_surfxml_include_2 E_surfxml_include
+%x ROOT_surfxml_cpu AL_surfxml_cpu E_surfxml_cpu
+%x ROOT_surfxml_network_link AL_surfxml_network_link E_surfxml_network_link
+%x ROOT_surfxml_route AL_surfxml_route S_surfxml_route S_surfxml_route_1 S_surfxml_route_2 E_surfxml_route
+%x ROOT_surfxml_route_element AL_surfxml_route_element E_surfxml_route_element
+%x ROOT_surfxml_process AL_surfxml_process S_surfxml_process S_surfxml_process_1 S_surfxml_process_2 E_surfxml_process
+%x ROOT_surfxml_argument AL_surfxml_argument E_surfxml_argument
 %x IMPOSSIBLE
 
 %{
 /* State names. */
-const char* *statenames=NULL;
+const char* *surfxml_statenames=NULL;
 %}
 
 %%
 
  /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
- SET(PROLOG); 
+ SET(PROLOG);
   /* FleXML_init */
-  if(!statenames) statenames=calloc(IMPOSSIBLE,sizeof(char*));
-  statenames[PROLOG] = NULL;
-  statenames[DOCTYPE] = NULL;
-  statenames[EPILOG] = NULL;
-  statenames[INCOMMENT] = NULL;
-  statenames[INPI] = NULL;
-  statenames[VALUE1] = NULL;
-  statenames[VALUE2] = NULL;
-  statenames[CDATA] = NULL;
-  statenames[ROOT_platform_description] = NULL;
-  statenames[AL_platform_description] = NULL;
-  statenames[S_platform_description] = "platform_description";
-  statenames[S_platform_description_1] = "platform_description";
-  statenames[S_platform_description_2] = "platform_description";
-  statenames[E_platform_description] = "platform_description";
-  statenames[ROOT_include] = NULL;
-  statenames[AL_include] = NULL;
-  statenames[S_include] = "include";
-  statenames[S_include_1] = "include";
-  statenames[S_include_2] = "include";
-  statenames[E_include] = "include";
-  statenames[ROOT_cpu] = NULL;
-  statenames[AL_cpu] = NULL;
-  statenames[E_cpu] = "cpu";
-  statenames[ROOT_network_link] = NULL;
-  statenames[AL_network_link] = NULL;
-  statenames[E_network_link] = "network_link";
-  statenames[ROOT_route] = NULL;
-  statenames[AL_route] = NULL;
-  statenames[S_route] = "route";
-  statenames[S_route_1] = "route";
-  statenames[S_route_2] = "route";
-  statenames[E_route] = "route";
-  statenames[ROOT_route_element] = NULL;
-  statenames[AL_route_element] = NULL;
-  statenames[E_route_element] = "route_element";
-  statenames[ROOT_process] = NULL;
-  statenames[AL_process] = NULL;
-  statenames[S_process] = "process";
-  statenames[S_process_1] = "process";
-  statenames[S_process_2] = "process";
-  statenames[E_process] = "process";
-  statenames[ROOT_argument] = NULL;
-  statenames[AL_argument] = NULL;
-  statenames[E_argument] = "argument";
+  next = bufferstack;
+  if(!surfxml_statenames) {surfxml_statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
+  surfxml_statenames[PROLOG] = NULL;
+  surfxml_statenames[DOCTYPE] = NULL;
+  surfxml_statenames[EPILOG] = NULL;
+  surfxml_statenames[INCOMMENT] = NULL;
+  surfxml_statenames[INPI] = NULL;
+  surfxml_statenames[VALUE1] = NULL;
+  surfxml_statenames[VALUE2] = NULL;
+  surfxml_statenames[CDATA] = NULL;
+  surfxml_statenames[ROOT_surfxml_platform_description] = NULL;
+  surfxml_statenames[AL_surfxml_platform_description] = NULL;
+  surfxml_statenames[S_surfxml_platform_description] = "platform_description";
+  surfxml_statenames[S_surfxml_platform_description_1] = "platform_description";
+  surfxml_statenames[S_surfxml_platform_description_2] = "platform_description";
+  surfxml_statenames[E_surfxml_platform_description] = "platform_description";
+  surfxml_statenames[ROOT_surfxml_include] = NULL;
+  surfxml_statenames[AL_surfxml_include] = NULL;
+  surfxml_statenames[S_surfxml_include] = "include";
+  surfxml_statenames[S_surfxml_include_1] = "include";
+  surfxml_statenames[S_surfxml_include_2] = "include";
+  surfxml_statenames[E_surfxml_include] = "include";
+  surfxml_statenames[ROOT_surfxml_cpu] = NULL;
+  surfxml_statenames[AL_surfxml_cpu] = NULL;
+  surfxml_statenames[E_surfxml_cpu] = "cpu";
+  surfxml_statenames[ROOT_surfxml_network_link] = NULL;
+  surfxml_statenames[AL_surfxml_network_link] = NULL;
+  surfxml_statenames[E_surfxml_network_link] = "network_link";
+  surfxml_statenames[ROOT_surfxml_route] = NULL;
+  surfxml_statenames[AL_surfxml_route] = NULL;
+  surfxml_statenames[S_surfxml_route] = "route";
+  surfxml_statenames[S_surfxml_route_1] = "route";
+  surfxml_statenames[S_surfxml_route_2] = "route";
+  surfxml_statenames[E_surfxml_route] = "route";
+  surfxml_statenames[ROOT_surfxml_route_element] = NULL;
+  surfxml_statenames[AL_surfxml_route_element] = NULL;
+  surfxml_statenames[E_surfxml_route_element] = "route_element";
+  surfxml_statenames[ROOT_surfxml_process] = NULL;
+  surfxml_statenames[AL_surfxml_process] = NULL;
+  surfxml_statenames[S_surfxml_process] = "process";
+  surfxml_statenames[S_surfxml_process_1] = "process";
+  surfxml_statenames[S_surfxml_process_2] = "process";
+  surfxml_statenames[E_surfxml_process] = "process";
+  surfxml_statenames[ROOT_surfxml_argument] = NULL;
+  surfxml_statenames[AL_surfxml_argument] = NULL;
+  surfxml_statenames[E_surfxml_argument] = "argument";
+  }
 
  /* COMMENTS and PIs: handled uniformly for efficiency. */
 
-<ROOT_platform_description,AL_platform_description,S_platform_description,S_platform_description_1,S_platform_description_2,E_platform_description,ROOT_include,AL_include,S_include,S_include_1,S_include_2,E_include,ROOT_cpu,AL_cpu,E_cpu,ROOT_network_link,AL_network_link,E_network_link,ROOT_route,AL_route,S_route,S_route_1,S_route_2,E_route,ROOT_route_element,AL_route_element,E_route_element,ROOT_process,AL_process,S_process,S_process_1,S_process_2,E_process,ROOT_argument,AL_argument,E_argument,PROLOG,DOCTYPE,EPILOG>{
+<ROOT_surfxml_platform_description,AL_surfxml_platform_description,S_surfxml_platform_description,S_surfxml_platform_description_1,S_surfxml_platform_description_2,E_surfxml_platform_description,ROOT_surfxml_include,AL_surfxml_include,S_surfxml_include,S_surfxml_include_1,S_surfxml_include_2,E_surfxml_include,ROOT_surfxml_cpu,AL_surfxml_cpu,E_surfxml_cpu,ROOT_surfxml_network_link,AL_surfxml_network_link,E_surfxml_network_link,ROOT_surfxml_route,AL_surfxml_route,S_surfxml_route,S_surfxml_route_1,S_surfxml_route_2,E_surfxml_route,ROOT_surfxml_route_element,AL_surfxml_route_element,E_surfxml_route_element,ROOT_surfxml_process,AL_surfxml_process,S_surfxml_process,S_surfxml_process_1,S_surfxml_process_2,E_surfxml_process,ROOT_surfxml_argument,AL_surfxml_argument,E_surfxml_argument,PROLOG,DOCTYPE,EPILOG>{
  "<!--" ENTER(INCOMMENT);
  "<?" ENTER(INPI);
 }
@@ -281,24 +316,24 @@ const char* *statenames=NULL;
 
  /* SPACES: skipped uniformly */
 
-<ROOT_platform_description,AL_platform_description,S_platform_description,S_platform_description_1,S_platform_description_2,E_platform_description,ROOT_include,AL_include,S_include,S_include_1,S_include_2,E_include,ROOT_cpu,AL_cpu,E_cpu,ROOT_network_link,AL_network_link,E_network_link,ROOT_route,AL_route,S_route,S_route_1,S_route_2,E_route,ROOT_route_element,AL_route_element,E_route_element,ROOT_process,AL_process,S_process,S_process_1,S_process_2,E_process,ROOT_argument,AL_argument,E_argument,PROLOG,DOCTYPE,EPILOG>{S} SKIP;
+<ROOT_surfxml_platform_description,AL_surfxml_platform_description,S_surfxml_platform_description,S_surfxml_platform_description_1,S_surfxml_platform_description_2,E_surfxml_platform_description,ROOT_surfxml_include,AL_surfxml_include,S_surfxml_include,S_surfxml_include_1,S_surfxml_include_2,E_surfxml_include,ROOT_surfxml_cpu,AL_surfxml_cpu,E_surfxml_cpu,ROOT_surfxml_network_link,AL_surfxml_network_link,E_surfxml_network_link,ROOT_surfxml_route,AL_surfxml_route,S_surfxml_route,S_surfxml_route_1,S_surfxml_route_2,E_surfxml_route,ROOT_surfxml_route_element,AL_surfxml_route_element,E_surfxml_route_element,ROOT_surfxml_process,AL_surfxml_process,S_surfxml_process,S_surfxml_process_1,S_surfxml_process_2,E_surfxml_process,ROOT_surfxml_argument,AL_surfxml_argument,E_surfxml_argument,PROLOG,DOCTYPE,EPILOG>{S} SKIP;
 
  /* PROLOG: determine root element and process it. */
 
 <PROLOG>{
- "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?"?>" SET(DOCTYPE);
+ "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?({S}encoding{Eq}(\'[^']*\'|\"[^"]*\"))?"?>" SET(DOCTYPE); 
  "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
 }
 
 <PROLOG,DOCTYPE>{
- "<!DOCTYPE"{S}"argument"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_argument);
- "<!DOCTYPE"{S}"route_element"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route_element);
- "<!DOCTYPE"{S}"cpu"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_cpu);
- "<!DOCTYPE"{S}"include"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_include);
- "<!DOCTYPE"{S}"route"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route);
- "<!DOCTYPE"{S}"platform_description"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_platform_description);
- "<!DOCTYPE"{S}"network_link"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_network_link);
- "<!DOCTYPE"{S}"process"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_process);
+ "<!DOCTYPE"{S}"argument"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_argument);
+ "<!DOCTYPE"{S}"route_element"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_route_element);
+ "<!DOCTYPE"{S}"cpu"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_cpu);
+ "<!DOCTYPE"{S}"include"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_include);
+ "<!DOCTYPE"{S}"route"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_route);
+ "<!DOCTYPE"{S}"platform_description"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_platform_description);
+ "<!DOCTYPE"{S}"network_link"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_network_link);
+ "<!DOCTYPE"{S}"process"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_process);
  "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
  .             FAIL("Unexpected character `%c' in prolog.", yytext[0]);
  <<EOF>>       FAIL("EOF in prolog.");
@@ -308,18 +343,22 @@ const char* *statenames=NULL;
 
  /* <!-- Small DTD for SURF based tools. -->  */
 
-<ROOT_platform_description>"<platform_description"{s} {
-  ENTER(AL_platform_description);
+<ROOT_surfxml_platform_description>"<platform_description"{s} {
+  A_surfxml_platform_description_version = "0.0";
+  ENTER(AL_surfxml_platform_description);
   }
 
-<AL_platform_description>{
+<AL_surfxml_platform_description>{
+ "version"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_platform_description_version);
+ "version"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_platform_description_version);
+
  ">" {
-  LEAVE; STag_platform_description();pcdata = NULL; ENTER(S_platform_description);
+  LEAVE; STag_surfxml_platform_description();surfxml_pcdata = NULL; ENTER(S_surfxml_platform_description);
  }
  "/>" {
-  LEAVE; STag_platform_description(); pcdata = NULL; ETag_platform_description();
+  LEAVE; STag_surfxml_platform_description(); surfxml_pcdata = NULL; ETag_surfxml_platform_description();
   switch (YY_START) {
-   case ROOT_platform_description: SET(EPILOG); break;
+   case ROOT_surfxml_platform_description: SET(EPILOG); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of platform_description element.", yytext[0]);
@@ -327,12 +366,12 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `platform_description' element.");
 }
 
-<E_platform_description,S_platform_description_2,S_platform_description>{
+<E_surfxml_platform_description,S_surfxml_platform_description_2,S_surfxml_platform_description>{
  "</platform_description"{s}">" {
   LEAVE;
-  ETag_platform_description();
+  ETag_surfxml_platform_description();
   switch (YY_START) {
-   case ROOT_platform_description: SET(EPILOG); break;
+   case ROOT_surfxml_platform_description: SET(EPILOG); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</platform_description>' expected.",yytext);
@@ -340,26 +379,26 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("Premature EOF: `</platform_description>' expected.");
 }
 
-<ROOT_include,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<include"{s} {
-  A_include_file = NULL;
-  ENTER(AL_include);
+<ROOT_surfxml_include,S_surfxml_platform_description_2,S_surfxml_include,S_surfxml_include_2,S_surfxml_platform_description_1,S_surfxml_include_1,S_surfxml_platform_description>"<include"{s} {
+  A_surfxml_include_file = NULL;
+  ENTER(AL_surfxml_include);
   }
 
-<AL_include>{
- "file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_include_file);
- "file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_include_file);
+<AL_surfxml_include>{
+ "file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_include_file);
+ "file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_include_file);
 
  ">" {
-  if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
-  LEAVE; STag_include();pcdata = NULL; ENTER(S_include);
+  if (!A_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
+  LEAVE; STag_surfxml_include();surfxml_pcdata = NULL; ENTER(S_surfxml_include);
  }
  "/>" {
-  if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
-  LEAVE; STag_include(); pcdata = NULL; ETag_include();
+  if (!A_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
+  LEAVE; STag_surfxml_include(); surfxml_pcdata = NULL; ETag_surfxml_include();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_include: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_include: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of include element.", yytext[0]);
@@ -367,14 +406,14 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `include' element.");
 }
 
-<E_include,S_include,S_include_2>{
+<E_surfxml_include,S_surfxml_include,S_surfxml_include_2>{
  "</include"{s}">" {
   LEAVE;
-  ETag_include();
+  ETag_surfxml_include();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_include: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_include: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</include>' expected.",yytext);
@@ -382,62 +421,66 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("Premature EOF: `</include>' expected.");
 }
 
-<ROOT_cpu,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<cpu"{s} {
-  A_cpu_name = NULL;
-  A_cpu_power = NULL;
-  A_cpu_availability = "1.0";
-  A_cpu_availability_file = NULL;
-  A_cpu_state = A_cpu_state_ON;
-  A_cpu_state_file = NULL;
-  A_cpu_interference_send = "1.0";
-  A_cpu_interference_recv = "1.0";
-  A_cpu_interference_send_recv = "1.0";
-  ENTER(AL_cpu);
+<ROOT_surfxml_cpu,S_surfxml_platform_description_2,S_surfxml_include,S_surfxml_include_2,S_surfxml_platform_description_1,S_surfxml_include_1,S_surfxml_platform_description>"<cpu"{s} {
+  A_surfxml_cpu_name = NULL;
+  A_surfxml_cpu_power = NULL;
+  A_surfxml_cpu_availability = "1.0";
+  A_surfxml_cpu_availability_file = NULL;
+  A_surfxml_cpu_state = A_surfxml_cpu_state_ON;
+  A_surfxml_cpu_state_file = NULL;
+  A_surfxml_cpu_interference_send = "1.0";
+  A_surfxml_cpu_interference_recv = "1.0";
+  A_surfxml_cpu_interference_send_recv = "1.0";
+  A_surfxml_cpu_max_outgoing_rate = "-1.0";
+  ENTER(AL_surfxml_cpu);
   }
 
-<AL_cpu>{
- "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_name);
- "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_name);
+<AL_surfxml_cpu>{
+ "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_name);
+ "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_name);
 
- "power"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_power);
- "power"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_power);
+ "power"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_power);
+ "power"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_power);
 
- "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability);
- "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability);
+ "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_availability);
+ "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_availability);
 
- "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability_file);
- "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability_file);
+ "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_availability_file);
+ "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_availability_file);
 
  "state"{Eq}"'ON'" |
- "state"{Eq}"\"ON\"" A_cpu_state = A_cpu_state_ON;
+ "state"{Eq}"\"ON\"" A_surfxml_cpu_state = A_surfxml_cpu_state_ON;
  "state"{Eq}"'OFF'" |
- "state"{Eq}"\"OFF\"" A_cpu_state = A_cpu_state_OFF;
+ "state"{Eq}"\"OFF\"" A_surfxml_cpu_state = A_surfxml_cpu_state_OFF;
+
+ "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_state_file);
+ "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_state_file);
 
- "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_state_file);
- "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_state_file);
+ "interference_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_interference_send);
+ "interference_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_interference_send);
 
- "interference_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send);
- "interference_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send);
+ "interference_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_interference_recv);
+ "interference_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_interference_recv);
 
- "interference_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_recv);
- "interference_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_recv);
+ "interference_send_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_interference_send_recv);
+ "interference_send_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_interference_send_recv);
 
- "interference_send_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send_recv);
- "interference_send_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send_recv);
+ "max_outgoing_rate"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_cpu_max_outgoing_rate);
+ "max_outgoing_rate"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_cpu_max_outgoing_rate);
 
  ">" {
-  if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
-  if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
-  LEAVE; STag_cpu();pcdata = NULL; ENTER(E_cpu);
+  if (!A_surfxml_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
+  if (!A_surfxml_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
+  LEAVE; STag_surfxml_cpu();surfxml_pcdata = NULL; ENTER(E_surfxml_cpu);
  }
  "/>" {
-  if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
-  if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
-  LEAVE; STag_cpu(); pcdata = NULL; ETag_cpu();
+  if (!A_surfxml_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
+  if (!A_surfxml_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
+  LEAVE; STag_surfxml_cpu(); surfxml_pcdata = NULL; ETag_surfxml_cpu();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_cpu: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_cpu: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of cpu element.", yytext[0]);
@@ -445,14 +488,14 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `cpu' element.");
 }
 
-<E_cpu>{
+<E_surfxml_cpu>{
  "</cpu"{s}">" {
   LEAVE;
-  ETag_cpu();
+  ETag_surfxml_cpu();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_cpu: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_cpu: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</cpu>' expected.",yytext);
@@ -460,54 +503,60 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("Premature EOF: `</cpu>' expected.");
 }
 
-<ROOT_network_link,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<network_link"{s} {
-  A_network_link_name = NULL;
-  A_network_link_bandwidth = NULL;
-  A_network_link_bandwidth_file = NULL;
-  A_network_link_latency = "0.0";
-  A_network_link_latency_file = NULL;
-  A_network_link_state = A_network_link_state_ON;
-  A_network_link_state_file = NULL;
-  ENTER(AL_network_link);
+<ROOT_surfxml_network_link,S_surfxml_platform_description_2,S_surfxml_include,S_surfxml_include_2,S_surfxml_platform_description_1,S_surfxml_include_1,S_surfxml_platform_description>"<network_link"{s} {
+  A_surfxml_network_link_name = NULL;
+  A_surfxml_network_link_bandwidth = NULL;
+  A_surfxml_network_link_bandwidth_file = NULL;
+  A_surfxml_network_link_latency = "0.0";
+  A_surfxml_network_link_latency_file = NULL;
+  A_surfxml_network_link_state = A_surfxml_network_link_state_ON;
+  A_surfxml_network_link_state_file = NULL;
+  A_surfxml_network_link_sharing_policy = A_surfxml_network_link_sharing_policy_SHARED;
+  ENTER(AL_surfxml_network_link);
   }
 
-<AL_network_link>{
- "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_name);
- "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_name);
+<AL_surfxml_network_link>{
+ "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_network_link_name);
+ "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_network_link_name);
 
- "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth);
- "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth);
+ "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_network_link_bandwidth);
+ "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_network_link_bandwidth);
 
- "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth_file);
- "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth_file);
+ "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_network_link_bandwidth_file);
+ "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_network_link_bandwidth_file);
 
- "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency);
- "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency);
+ "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_network_link_latency);
+ "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_network_link_latency);
 
- "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency_file);
- "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency_file);
+ "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_network_link_latency_file);
+ "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_network_link_latency_file);
 
  "state"{Eq}"'ON'" |
- "state"{Eq}"\"ON\"" A_network_link_state = A_network_link_state_ON;
+ "state"{Eq}"\"ON\"" A_surfxml_network_link_state = A_surfxml_network_link_state_ON;
  "state"{Eq}"'OFF'" |
- "state"{Eq}"\"OFF\"" A_network_link_state = A_network_link_state_OFF;
+ "state"{Eq}"\"OFF\"" A_surfxml_network_link_state = A_surfxml_network_link_state_OFF;
 
- "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_state_file);
- "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_state_file);
+ "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_network_link_state_file);
+ "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_network_link_state_file);
+
+ "sharing_policy"{Eq}"'SHARED'" |
+ "sharing_policy"{Eq}"\"SHARED\"" A_surfxml_network_link_sharing_policy = A_surfxml_network_link_sharing_policy_SHARED;
+ "sharing_policy"{Eq}"'FATPIPE'" |
+ "sharing_policy"{Eq}"\"FATPIPE\"" A_surfxml_network_link_sharing_policy = A_surfxml_network_link_sharing_policy_FATPIPE;
 
  ">" {
-  if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
-  if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
-  LEAVE; STag_network_link();pcdata = NULL; ENTER(E_network_link);
+  if (!A_surfxml_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
+  if (!A_surfxml_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
+  LEAVE; STag_surfxml_network_link();surfxml_pcdata = NULL; ENTER(E_surfxml_network_link);
  }
  "/>" {
-  if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
-  if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
-  LEAVE; STag_network_link(); pcdata = NULL; ETag_network_link();
+  if (!A_surfxml_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
+  if (!A_surfxml_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
+  LEAVE; STag_surfxml_network_link(); surfxml_pcdata = NULL; ETag_surfxml_network_link();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_network_link: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_network_link: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of network_link element.", yytext[0]);
@@ -515,14 +564,14 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `network_link' element.");
 }
 
-<E_network_link>{
+<E_surfxml_network_link>{
  "</network_link"{s}">" {
   LEAVE;
-  ETag_network_link();
+  ETag_surfxml_network_link();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_network_link: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_network_link: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</network_link>' expected.",yytext);
@@ -530,48 +579,48 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("Premature EOF: `</network_link>' expected.");
 }
 
-<ROOT_route,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<route"{s} {
-  A_route_src = NULL;
-  A_route_dst = NULL;
-  A_route_impact_on_src = "0.0";
-  A_route_impact_on_dst = "0.0";
-  A_route_impact_on_src_with_other_recv = "0.0";
-  A_route_impact_on_dst_with_other_send = "0.0";
-  ENTER(AL_route);
+<ROOT_surfxml_route,S_surfxml_platform_description_2,S_surfxml_include,S_surfxml_include_2,S_surfxml_platform_description_1,S_surfxml_include_1,S_surfxml_platform_description>"<route"{s} {
+  A_surfxml_route_src = NULL;
+  A_surfxml_route_dst = NULL;
+  A_surfxml_route_impact_on_src = "0.0";
+  A_surfxml_route_impact_on_dst = "0.0";
+  A_surfxml_route_impact_on_src_with_other_recv = "0.0";
+  A_surfxml_route_impact_on_dst_with_other_send = "0.0";
+  ENTER(AL_surfxml_route);
   }
 
-<AL_route>{
- "src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_src);
- "src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_src);
+<AL_surfxml_route>{
+ "src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_route_src);
+ "src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_route_src);
 
- "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_dst);
- "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_dst);
+ "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_route_dst);
+ "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_route_dst);
 
- "impact_on_src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src);
- "impact_on_src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src);
+ "impact_on_src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_route_impact_on_src);
+ "impact_on_src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_route_impact_on_src);
 
- "impact_on_dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst);
- "impact_on_dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst);
+ "impact_on_dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_route_impact_on_dst);
+ "impact_on_dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_route_impact_on_dst);
 
- "impact_on_src_with_other_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src_with_other_recv);
- "impact_on_src_with_other_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src_with_other_recv);
+ "impact_on_src_with_other_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_route_impact_on_src_with_other_recv);
+ "impact_on_src_with_other_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_route_impact_on_src_with_other_recv);
 
- "impact_on_dst_with_other_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst_with_other_send);
- "impact_on_dst_with_other_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst_with_other_send);
+ "impact_on_dst_with_other_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_route_impact_on_dst_with_other_send);
+ "impact_on_dst_with_other_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_route_impact_on_dst_with_other_send);
 
  ">" {
-  if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
-  if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
-  LEAVE; STag_route();pcdata = NULL; ENTER(S_route);
+  if (!A_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
+  if (!A_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
+  LEAVE; STag_surfxml_route();surfxml_pcdata = NULL; ENTER(S_surfxml_route);
  }
  "/>" {
-  if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
-  if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
-  LEAVE; STag_route(); pcdata = NULL; ETag_route();
+  if (!A_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
+  if (!A_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
+  LEAVE; STag_surfxml_route(); surfxml_pcdata = NULL; ETag_surfxml_route();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_route: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_route: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of route element.", yytext[0]);
@@ -579,14 +628,14 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `route' element.");
 }
 
-<S_route,S_route_2,E_route>{
+<S_surfxml_route,S_surfxml_route_2,E_surfxml_route>{
  "</route"{s}">" {
   LEAVE;
-  ETag_route();
+  ETag_surfxml_route();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_route: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_route: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route>' expected.",yytext);
@@ -594,25 +643,25 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("Premature EOF: `</route>' expected.");
 }
 
-<ROOT_route_element,S_route_1,S_route,S_route_2>"<route_element"{s} {
-  A_route_element_name = NULL;
-  ENTER(AL_route_element);
+<ROOT_surfxml_route_element,S_surfxml_route_1,S_surfxml_route,S_surfxml_route_2>"<route_element"{s} {
+  A_surfxml_route_element_name = NULL;
+  ENTER(AL_surfxml_route_element);
   }
 
-<AL_route_element>{
- "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_element_name);
- "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_element_name);
+<AL_surfxml_route_element>{
+ "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_route_element_name);
+ "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_route_element_name);
 
  ">" {
-  if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
-  LEAVE; STag_route_element();pcdata = NULL; ENTER(E_route_element);
+  if (!A_surfxml_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
+  LEAVE; STag_surfxml_route_element();surfxml_pcdata = NULL; ENTER(E_surfxml_route_element);
  }
  "/>" {
-  if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
-  LEAVE; STag_route_element(); pcdata = NULL; ETag_route_element();
+  if (!A_surfxml_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
+  LEAVE; STag_surfxml_route_element(); surfxml_pcdata = NULL; ETag_surfxml_route_element();
   switch (YY_START) {
-   case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
-   case ROOT_route_element: SET(EPILOG); break;
+   case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
+   case ROOT_surfxml_route_element: SET(EPILOG); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of route_element element.", yytext[0]);
@@ -620,13 +669,13 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `route_element' element.");
 }
 
-<E_route_element>{
+<E_surfxml_route_element>{
  "</route_element"{s}">" {
   LEAVE;
-  ETag_route_element();
+  ETag_surfxml_route_element();
   switch (YY_START) {
-   case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
-   case ROOT_route_element: SET(EPILOG); break;
+   case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
+   case ROOT_surfxml_route_element: SET(EPILOG); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route_element>' expected.",yytext);
@@ -634,32 +683,40 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("Premature EOF: `</route_element>' expected.");
 }
 
-<ROOT_process,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<process"{s} {
-  A_process_host = NULL;
-  A_process_function = NULL;
-  ENTER(AL_process);
+<ROOT_surfxml_process,S_surfxml_platform_description_2,S_surfxml_include,S_surfxml_include_2,S_surfxml_platform_description_1,S_surfxml_include_1,S_surfxml_platform_description>"<process"{s} {
+  A_surfxml_process_host = NULL;
+  A_surfxml_process_function = NULL;
+  A_surfxml_process_start_time = "-1.0";
+  A_surfxml_process_kill_time = "-1.0";
+  ENTER(AL_surfxml_process);
   }
 
-<AL_process>{
- "host"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_host);
- "host"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_host);
+<AL_surfxml_process>{
+ "host"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_process_host);
+ "host"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_process_host);
+
+ "function"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_process_function);
+ "function"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_process_function);
 
- "function"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_function);
- "function"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_function);
+ "start_time"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_process_start_time);
+ "start_time"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_process_start_time);
+
+ "kill_time"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_process_kill_time);
+ "kill_time"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_process_kill_time);
 
  ">" {
-  if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
-  if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
-  LEAVE; STag_process();pcdata = NULL; ENTER(S_process);
+  if (!A_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
+  if (!A_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
+  LEAVE; STag_surfxml_process();surfxml_pcdata = NULL; ENTER(S_surfxml_process);
  }
  "/>" {
-  if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
-  if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
-  LEAVE; STag_process(); pcdata = NULL; ETag_process();
+  if (!A_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
+  if (!A_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
+  LEAVE; STag_surfxml_process(); surfxml_pcdata = NULL; ETag_surfxml_process();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_process: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_process: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of process element.", yytext[0]);
@@ -667,14 +724,14 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `process' element.");
 }
 
-<S_process,E_process,S_process_2>{
+<S_surfxml_process,E_surfxml_process,S_surfxml_process_2>{
  "</process"{s}">" {
   LEAVE;
-  ETag_process();
+  ETag_surfxml_process();
   switch (YY_START) {
-   case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
-   case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
-   case ROOT_process: SET(EPILOG); break;
+   case S_surfxml_platform_description_2: case S_surfxml_platform_description_1: case S_surfxml_platform_description: SET(S_surfxml_platform_description_2); break;
+   case ROOT_surfxml_process: SET(EPILOG); break;
+   case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</process>' expected.",yytext);
@@ -682,25 +739,25 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("Premature EOF: `</process>' expected.");
 }
 
-<ROOT_argument,S_process_1,S_process,S_process_2>"<argument"{s} {
-  A_argument_value = NULL;
-  ENTER(AL_argument);
+<ROOT_surfxml_argument,S_surfxml_process_1,S_surfxml_process,S_surfxml_process_2>"<argument"{s} {
+  A_surfxml_argument_value = NULL;
+  ENTER(AL_surfxml_argument);
   }
 
-<AL_argument>{
- "value"{Eq}\' ENTER(VALUE1); BUFFERSET(A_argument_value);
- "value"{Eq}\" ENTER(VALUE2); BUFFERSET(A_argument_value);
+<AL_surfxml_argument>{
+ "value"{Eq}\' ENTER(VALUE1); BUFFERSET(A_surfxml_argument_value);
+ "value"{Eq}\" ENTER(VALUE2); BUFFERSET(A_surfxml_argument_value);
 
  ">" {
-  if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
-  LEAVE; STag_argument();pcdata = NULL; ENTER(E_argument);
+  if (!A_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
+  LEAVE; STag_surfxml_argument();surfxml_pcdata = NULL; ENTER(E_surfxml_argument);
  }
  "/>" {
-  if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
-  LEAVE; STag_argument(); pcdata = NULL; ETag_argument();
+  if (!A_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
+  LEAVE; STag_surfxml_argument(); surfxml_pcdata = NULL; ETag_surfxml_argument();
   switch (YY_START) {
-   case ROOT_argument: SET(EPILOG); break;
-   case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
+   case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
+   case ROOT_surfxml_argument: SET(EPILOG); break;
   }
  }
  .       FAIL("Unexpected character `%c' in attribute list of argument element.", yytext[0]);
@@ -708,13 +765,13 @@ const char* *statenames=NULL;
  <<EOF>> FAIL("EOF in attribute list of `argument' element.");
 }
 
-<E_argument>{
+<E_surfxml_argument>{
  "</argument"{s}">" {
   LEAVE;
-  ETag_argument();
+  ETag_surfxml_argument();
   switch (YY_START) {
-   case ROOT_argument: SET(EPILOG); break;
-   case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
+   case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
+   case ROOT_surfxml_argument: SET(EPILOG); break;
   }
  }
  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</argument>' expected.",yytext);
@@ -725,7 +782,7 @@ const char* *statenames=NULL;
  /* EPILOG: after the root element. */
 
 <EPILOG>{
- .             FAIL("Unexpected character `%c' after document.", yytext[0]);
+ . {SET(PROLOG); yyless(0); CLEANUP; return -1;}
  <<EOF>>       SUCCEED;
 }
 
@@ -773,21 +830,22 @@ const char* *statenames=NULL;
 
 <CDATA>{
  "]""]>"               LEAVE;
- "]""]"                BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]);
+ /* "]""]"             BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]); */
  .             BUFFERPUTC(yytext[0]);
  <<EOF>>       FAIL("EOF in CDATA section.");
 }
 
  /* Impossible rules to avoid warnings from flex(1). */
-
-<INITIAL,IMPOSSIBLE>{
- .|[\n] FAIL("The Impossible Happened: INITIAL or IMPOSSIBLE state entered?");
+ /* Ideally, this should be replaced by code in flexml.pl that
+    generates just the states not covered by other rules. */
+<*>{
+ .|[\n] FAIL("Syntax error on character `%c'.", yytext[0]);
 }
 
 %%
 
 /* Element context stack lookup. */
-int element_context(int i)
+int surfxml_element_context(int i)
 {
   return (0<i && i<yy_start_stack_depth
          ? yy_start_stack[yy_start_stack_ptr - i]
@@ -800,8 +858,8 @@ 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/", statenames[yy_start_stack[i] ]);
-  fprintf(stderr,"%s\n", statenames[YY_START]);
+    fprintf(stderr, "%s/", surfxml_statenames[yy_start_stack[i] ]);
+  fprintf(stderr,"%s\n", surfxml_statenames[YY_START]);
   va_end(ap);
 }
 
@@ -821,17 +879,53 @@ 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 * surfxml_parse_err_msg()
+{
+    return flexml_err_msg;
+}
+
+static void reset_surfxml_parse_err_msg()
+{
+    flexml_err_msg[0] = '\0';
+}
+
+
+static void cleanup(void)
+{
+    if (surfxml_statenames) {
+        free(surfxml_statenames);
+       surfxml_statenames = NULL;
+    }
+}
+
 
 static int fail(const char* fmt, ...)
 {
-  va_list ap; va_start(ap, fmt);
+    int chars_left, used;
+    va_list ap; va_start(ap, fmt);
 #ifdef FLEXML_yylineno
-  fprintf(stderr, "Invalid XML (XML input line %d, state %d): ", yylineno, YY_START);
+    used = sprintf(flexml_err_msg,
+                  "Invalid XML (XML input line %d, state %d): ",
+                  yylineno, YY_START);
 #else
-  fprintf(stderr, "Invalid XML (state %d): ",YY_START);
+    used = sprintf(flexml_err_msg,
+                  "Invalid XML (state %d): ",
+                  YY_START);
 #endif
-  vfprintf(stderr, fmt, ap);
-  fprintf(stderr, "\n");
-  va_end(ap);
-  return 1;
+    chars_left = flexml_max_err_msg_size - used - 1;
+    vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
+    va_end(ap);
+
+#ifndef FLEXML_quiet_parser
+    /* print directly to sdterr */
+    fprintf(stderr, "%s\n", flexml_err_msg);
+    flexml_err_msg[0] = '\0';
+#endif
+
+    cleanup();
+
+    return 1;
 }