Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
32a5ed4688bad2b3829e1184514ff9b0a00696bf
[simgrid.git] / src / surf / surfxml.l
1 /* Validating XML processor for surf/surfxml.dtd.
2  * Generated 2007/10/12 10:23:15.
3  *
4  * This program was generated with the FleXML XML processor generator.
5  * FleXML is Copyright (C) 1999-2005 Kristoffer Rose.  All rights reserved.
6  * FleXML is Copyright (C) 2003-2006 Martin Quinson.  All rights reserved.
7  * (Id: flexml.pl,v 1.62 2007/10/11 10:00:14 mquinson Exp).
8  * 
9  * There are two, intertwined parts to this program, part A and part B.
10  *
11  * Part A
12  * ------
13  * 
14  * Some parts, here collectively called "Part A", are found in the 
15  * FleXML package.  They are Copyright (C) 1999-2005 Kristoffer Rose
16  * and Copyright (C) 2003-2006 Martin Quinson. All rights reserved.
17  *
18  * You can redistribute, use, perform, display and/or modify "Part A"
19  * provided the following two conditions hold:
20  *
21  * 1. The program is distributed WITHOUT ANY WARRANTY from the author of
22  *    FleXML; without even the implied warranty of MERCHANTABILITY or
23  *    FITNESS FOR A PARTICULAR PURPOSE.
24  *
25  * 2. The program distribution conditions do not in any way affect the
26  *    distribution conditions of the FleXML system used to generate this
27  *    file or any version of FleXML derived from that system.
28  *
29  * Notice that these are explicit rights granted to you for files
30  * generated by the FleXML system.  For your rights in connection with
31  * the FleXML system itself please consult the GNU General Public License.
32  * 
33  * Part B
34  * ------
35  * 
36  * The other parts, here collectively called "Part B", and which came 
37  * from the DTD used by FleXML to generate this program, can be 
38  * distributed (or not, as the case may be) under the terms of whoever
39  * wrote them, provided these terms respect and obey the two conditions 
40  * above under the heading "Part A".
41  *
42  * The author of and contributors to FleXML specifically disclaim
43  * any copyright interest in "Part B", unless "Part B" was written 
44  * by the author of or contributors to FleXML.
45  * 
46  */
47
48 %{
49
50 /* Version strings. */
51 const char rcs_surfxml_flexml_skeleton[] =
52  "$" "Id: skel,v 1.40 2007/10/11 09:57:24 mquinson Exp $";
53 const char rcs_surfxml_flexml[] =
54  "$" "Id: flexml.pl,v 1.62 2007/10/11 10:00:14 mquinson Exp $";
55
56 /* ANSI headers. */
57 #include <stdlib.h> /* for realloc() -- needed here when using flex 2.5.4 */
58 #include <stdio.h>
59 #include <string.h>
60 #include <assert.h>
61 #include <stdarg.h>
62 #include <ctype.h>
63      
64 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
65 # ifndef __STRICT_ANSI__
66 #  include <io.h>
67 #  include <process.h>
68 # endif
69 #else
70 # include <unistd.h>
71 #endif
72      
73 #ifndef FLEXML_INDEXSTACKSIZE
74 #define FLEXML_INDEXSTACKSIZE 1000
75 #endif
76
77 /* Generated definitions. */
78 #define FLEXML_yylineno
79 #ifndef FLEXML_BUFFERSTACKSIZE
80 #define FLEXML_BUFFERSTACKSIZE 1000000
81 #endif
82 #define FLEXML_NEED_BUFFERLIT
83
84 /* XML processor api. */
85 /* FleXML-provided data. */
86 int surfxml_pcdata_ix;
87 extern char *surfxml_bufferstack;
88 #define surfxml_pcdata (surfxml_bufferstack + surfxml_pcdata_ix)
89 AT_surfxml_network_link_bandwidth AX_surfxml_network_link_bandwidth;
90 #define A_surfxml_network_link_bandwidth (surfxml_bufferstack + AX_surfxml_network_link_bandwidth)
91 AT_surfxml_router_name AX_surfxml_router_name;
92 #define A_surfxml_router_name (surfxml_bufferstack + AX_surfxml_router_name)
93 AT_surfxml_process_host AX_surfxml_process_host;
94 #define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host)
95 AT_surfxml_network_link_latency_file AX_surfxml_network_link_latency_file;
96 #define A_surfxml_network_link_latency_file (surfxml_bufferstack + AX_surfxml_network_link_latency_file)
97 AT_surfxml_route_impact_on_dst_with_other_send AX_surfxml_route_impact_on_dst_with_other_send;
98 #define A_surfxml_route_impact_on_dst_with_other_send (surfxml_bufferstack + AX_surfxml_route_impact_on_dst_with_other_send)
99 AT_surfxml_cpu_interference_send_recv AX_surfxml_cpu_interference_send_recv;
100 #define A_surfxml_cpu_interference_send_recv (surfxml_bufferstack + AX_surfxml_cpu_interference_send_recv)
101 AT_surfxml_route_impact_on_dst AX_surfxml_route_impact_on_dst;
102 #define A_surfxml_route_impact_on_dst (surfxml_bufferstack + AX_surfxml_route_impact_on_dst)
103 AT_surfxml_platform_description_version AX_surfxml_platform_description_version;
104 #define A_surfxml_platform_description_version (surfxml_bufferstack + AX_surfxml_platform_description_version)
105 AT_surfxml_route_impact_on_src_with_other_recv AX_surfxml_route_impact_on_src_with_other_recv;
106 #define A_surfxml_route_impact_on_src_with_other_recv (surfxml_bufferstack + AX_surfxml_route_impact_on_src_with_other_recv)
107 AT_surfxml_route_element_name AX_surfxml_route_element_name;
108 #define A_surfxml_route_element_name (surfxml_bufferstack + AX_surfxml_route_element_name)
109 AT_surfxml_process_start_time AX_surfxml_process_start_time;
110 #define A_surfxml_process_start_time (surfxml_bufferstack + AX_surfxml_process_start_time)
111 AT_surfxml_process_function AX_surfxml_process_function;
112 #define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function)
113 AT_surfxml_cpu_state AX_surfxml_cpu_state;
114 #define A_surfxml_cpu_state AX_surfxml_cpu_state
115 AT_surfxml_cpu_interference_send AX_surfxml_cpu_interference_send;
116 #define A_surfxml_cpu_interference_send (surfxml_bufferstack + AX_surfxml_cpu_interference_send)
117 AT_surfxml_network_link_bandwidth_file AX_surfxml_network_link_bandwidth_file;
118 #define A_surfxml_network_link_bandwidth_file (surfxml_bufferstack + AX_surfxml_network_link_bandwidth_file)
119 AT_surfxml_cpu_name AX_surfxml_cpu_name;
120 #define A_surfxml_cpu_name (surfxml_bufferstack + AX_surfxml_cpu_name)
121 AT_surfxml_process_kill_time AX_surfxml_process_kill_time;
122 #define A_surfxml_process_kill_time (surfxml_bufferstack + AX_surfxml_process_kill_time)
123 AT_surfxml_network_link_state AX_surfxml_network_link_state;
124 #define A_surfxml_network_link_state AX_surfxml_network_link_state
125 AT_surfxml_cpu_availability_file AX_surfxml_cpu_availability_file;
126 #define A_surfxml_cpu_availability_file (surfxml_bufferstack + AX_surfxml_cpu_availability_file)
127 AT_surfxml_argument_value AX_surfxml_argument_value;
128 #define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value)
129 AT_surfxml_route_src AX_surfxml_route_src;
130 #define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src)
131 AT_surfxml_route_impact_on_src AX_surfxml_route_impact_on_src;
132 #define A_surfxml_route_impact_on_src (surfxml_bufferstack + AX_surfxml_route_impact_on_src)
133 AT_surfxml_cpu_max_outgoing_rate AX_surfxml_cpu_max_outgoing_rate;
134 #define A_surfxml_cpu_max_outgoing_rate (surfxml_bufferstack + AX_surfxml_cpu_max_outgoing_rate)
135 AT_surfxml_cpu_availability AX_surfxml_cpu_availability;
136 #define A_surfxml_cpu_availability (surfxml_bufferstack + AX_surfxml_cpu_availability)
137 AT_surfxml_cpu_interference_recv AX_surfxml_cpu_interference_recv;
138 #define A_surfxml_cpu_interference_recv (surfxml_bufferstack + AX_surfxml_cpu_interference_recv)
139 AT_surfxml_network_link_name AX_surfxml_network_link_name;
140 #define A_surfxml_network_link_name (surfxml_bufferstack + AX_surfxml_network_link_name)
141 AT_surfxml_cpu_power AX_surfxml_cpu_power;
142 #define A_surfxml_cpu_power (surfxml_bufferstack + AX_surfxml_cpu_power)
143 AT_surfxml_include_file AX_surfxml_include_file;
144 #define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file)
145 AT_surfxml_network_link_sharing_policy AX_surfxml_network_link_sharing_policy;
146 #define A_surfxml_network_link_sharing_policy AX_surfxml_network_link_sharing_policy
147 AT_surfxml_route_dst AX_surfxml_route_dst;
148 #define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst)
149 AT_surfxml_network_link_latency AX_surfxml_network_link_latency;
150 #define A_surfxml_network_link_latency (surfxml_bufferstack + AX_surfxml_network_link_latency)
151 AT_surfxml_cpu_state_file AX_surfxml_cpu_state_file;
152 #define A_surfxml_cpu_state_file (surfxml_bufferstack + AX_surfxml_cpu_state_file)
153 AT_surfxml_network_link_state_file AX_surfxml_network_link_state_file;
154 #define A_surfxml_network_link_state_file (surfxml_bufferstack + AX_surfxml_network_link_state_file)
155
156 /* XML state. */
157 #ifdef FLEX_DEBUG
158 # define ENTER(state)   debug_enter(state,#state)
159 # define LEAVE          debug_leave()
160 # define SET(state)     debug_set(state,#state)
161   static void debug_enter(int, const char*);
162   static void debug_leave(void);
163   static void debug_set(int, const char*);
164 #else
165 # define ENTER(state)   (yy_push_state(state))
166 # define LEAVE          (yy_pop_state())
167 # define SET(state)     BEGIN(state)
168 #endif
169
170 /* Generic actions. */
171 #define SKIP    /*skip*/
172 #define SUCCEED        CLEANUP; return 0
173
174 #define FAIL    return fail
175 static int fail(const char*, ...);
176
177 enum {flexml_max_err_msg_size = 512};
178 static char flexml_err_msg[flexml_max_err_msg_size];
179 const char * surfxml_parse_err_msg()
180 {
181     return flexml_err_msg;
182 }
183 static void reset_surfxml_parse_err_msg()
184 {
185     flexml_err_msg[0] = '\0';
186 }
187
188 /* Cleanup */
189 static void cleanup(void);
190 #define CLEANUP  cleanup()
191
192 /* Text buffer stack handling. */
193 char *surfxml_bufferstack = NULL;
194 static int blimit = FLEXML_BUFFERSTACKSIZE;
195 static int bnext = 1;
196
197 static int *indexstack = NULL;
198 static int ilimit = FLEXML_INDEXSTACKSIZE;
199 static int inext = 1;
200
201 #define BUFFERSET(P)  (P = bnext)
202 #define BUFFERPUTC(C) (ck_blimit(), surfxml_bufferstack[bnext++] = (C))
203 #define BUFFERDONE    (BUFFERPUTC('\0'))
204
205 #define BUFFERLITERAL(C, P) surfxml_bufferliteral(C, &(P), yytext)
206
207 /* after this is called, there are at least 2 slots left in the stack */
208 static int ck_blimit()
209 {
210      if (bnext >= blimit) {
211          blimit += FLEXML_BUFFERSTACKSIZE + 2;
212          {
213              char *temp = (char *) realloc(surfxml_bufferstack, blimit);
214              assert(temp);
215              surfxml_bufferstack = temp;
216          }
217      }
218      return 0;
219 }
220
221 /* after this is called, there are at least 2 slots left in the stack */
222 static int ck_ilimit()
223 {
224      if (inext >= ilimit) {
225          ilimit += FLEXML_INDEXSTACKSIZE + 2;
226          {
227              int *temp = (int *) realloc(indexstack, ilimit);
228              assert(temp);
229              indexstack = temp;
230          }
231      }
232      return 0;
233 }
234
235 #ifdef FLEXML_NEED_BUFFERLIT
236 static void surfxml_bufferliteral(char c, int* pp, const char* text)
237 {
238   const char *s = (c ? strchr(text,c) : text-1), *e = strrchr(text,c);
239   assert(s <= e); BUFFERSET(*pp);
240   while (++s<e) {
241     if (isspace(*s) && c) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
242     else BUFFERPUTC(*s);
243   }
244   BUFFERDONE;
245 }
246 #endif
247
248 static void pushbuffer(int p)
249 {
250     ck_ilimit();
251     indexstack[inext++] = p;
252     indexstack[inext++] = bnext;    
253 }
254
255 static int popbuffer(void)
256 {
257     assert(inext >= 2);
258     bnext = indexstack[--inext];
259     return indexstack[--inext];
260 }
261
262 /* General internal entities are `unput' back onto the input stream... */
263 #define ENTITYTEXT(T) \
264   { char *s = (T), *e = s+strlen(s);\
265     while (--e >= s) { unput(*e); }}
266
267
268 %}
269
270 /* Flex standard options. */
271 %option stack
272 %option noyy_top_state
273 %option noinput
274 %option noreject
275 %option noyymore
276 %option noyywrap
277
278 /* Flex user-requested options. */
279 %option yylineno
280 %option nounput
281
282 /* XML character classes (currently restricted to ASCII). */
283
284 /* "Common syntactic structures." */
285 S               [ \t\n\r\f]+
286 s               [ \t\n\r\f]*
287
288 /* "Names and Tokens." */
289 NameChar        [A-Za-z0-9.:_-]
290 Name            [A-Za-z_:]{NameChar}*
291 Names           {Name}({S}{Name})*
292 Nmtoken         ({NameChar})+
293 Nmtokens        {Nmtoken}({S}{Nmtoken})*
294
295 /* Miscellaneous. */
296 VersionNum      [a-zA-Z0-9_.:-]+
297 Eq              {s}"="{s}
298 Literal         \'[^'']*\'|\"[^""]*\"
299
300 /* Parser states (flex `exclusive start conditions'):
301  *
302  * PROLOG       the XML prolog of the document before <?xml...>
303  * DOCTYPE      the XML prolog of the document after <?xml...>
304  * EPILOG       after the root element
305  * INCOMMENT    inside an XML comment <!--....-->
306  * INPI         inside an XML PI <?...?>
307  * VALUE1       inside a '...'-delimited literal
308  * VALUE2       inside a "..."-delimited literal
309  * CDATA        inside a <![CDATA[...] ]> section.
310  * ROOT_<tag>   expect root element <tag>
311  * AL_<tag>     inside the attribute list for <tag>
312  * IN_<tag>     inside a <tag> with element contents (ready for end tag)
313  * IMPOSSIBLE   dummy to permit disabling rules; must be last
314  */
315 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
316 %x ROOT_surfxml_platform_description AL_surfxml_platform_description S_surfxml_platform_description S_surfxml_platform_description_1 S_surfxml_platform_description_2 S_surfxml_platform_description_3 S_surfxml_platform_description_4 S_surfxml_platform_description_5 E_surfxml_platform_description
317 %x ROOT_surfxml_include AL_surfxml_include E_surfxml_include
318 %x ROOT_surfxml_cpu AL_surfxml_cpu E_surfxml_cpu
319 %x ROOT_surfxml_router AL_surfxml_router E_surfxml_router
320 %x ROOT_surfxml_network_link AL_surfxml_network_link E_surfxml_network_link
321 %x ROOT_surfxml_route AL_surfxml_route S_surfxml_route S_surfxml_route_1 S_surfxml_route_2 E_surfxml_route
322 %x ROOT_surfxml_route_element AL_surfxml_route_element E_surfxml_route_element
323 %x ROOT_surfxml_process AL_surfxml_process S_surfxml_process S_surfxml_process_1 S_surfxml_process_2 E_surfxml_process
324 %x ROOT_surfxml_argument AL_surfxml_argument E_surfxml_argument
325 %x IMPOSSIBLE
326
327 %{
328 /* State names. */
329 const char* *surfxml_statenames=NULL;
330 %}
331
332 %%
333
334  /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
335  SET(PROLOG);
336  reset_surfxml_parse_err_msg();
337  surfxml_bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
338  assert(surfxml_bufferstack);
339  #ifdef FLEX_DEBUG
340  {
341      int i;
342      for (i = 0; i < blimit; i++) {
343          surfxml_bufferstack[i] = '\377';
344      }
345  }
346  #endif
347  surfxml_bufferstack[0] = '\0';
348  indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
349  assert(indexstack);
350  indexstack[0] = 0;
351
352   /* FleXML_init */
353   bnext = inext = 1;
354   surfxml_bufferliteral('\0', &bnext, "0.0");
355   surfxml_bufferliteral('\0', &bnext, "1.0");
356   surfxml_bufferliteral('\0', &bnext, "1.0");
357   surfxml_bufferliteral('\0', &bnext, "1.0");
358   surfxml_bufferliteral('\0', &bnext, "1.0");
359   surfxml_bufferliteral('\0', &bnext, "-1.0");
360   surfxml_bufferliteral('\0', &bnext, "0.0");
361   surfxml_bufferliteral('\0', &bnext, "0.0");
362   surfxml_bufferliteral('\0', &bnext, "0.0");
363   surfxml_bufferliteral('\0', &bnext, "0.0");
364   surfxml_bufferliteral('\0', &bnext, "0.0");
365   surfxml_bufferliteral('\0', &bnext, "-1.0");
366   surfxml_bufferliteral('\0', &bnext, "-1.0");
367   if(!surfxml_statenames) {surfxml_statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
368   surfxml_statenames[PROLOG] = NULL;
369   surfxml_statenames[DOCTYPE] = NULL;
370   surfxml_statenames[EPILOG] = NULL;
371   surfxml_statenames[INCOMMENT] = NULL;
372   surfxml_statenames[INPI] = NULL;
373   surfxml_statenames[VALUE1] = NULL;
374   surfxml_statenames[VALUE2] = NULL;
375   surfxml_statenames[CDATA] = NULL;
376   surfxml_statenames[ROOT_surfxml_platform_description] = NULL;
377   surfxml_statenames[AL_surfxml_platform_description] = NULL;
378   surfxml_statenames[S_surfxml_platform_description] = "platform_description";
379   surfxml_statenames[S_surfxml_platform_description_1] = "platform_description";
380   surfxml_statenames[S_surfxml_platform_description_2] = "platform_description";
381   surfxml_statenames[S_surfxml_platform_description_3] = "platform_description";
382   surfxml_statenames[S_surfxml_platform_description_4] = "platform_description";
383   surfxml_statenames[S_surfxml_platform_description_5] = "platform_description";
384   surfxml_statenames[E_surfxml_platform_description] = "platform_description";
385   surfxml_statenames[ROOT_surfxml_include] = NULL;
386   surfxml_statenames[AL_surfxml_include] = NULL;
387   surfxml_statenames[E_surfxml_include] = "include";
388   surfxml_statenames[ROOT_surfxml_cpu] = NULL;
389   surfxml_statenames[AL_surfxml_cpu] = NULL;
390   surfxml_statenames[E_surfxml_cpu] = "cpu";
391   surfxml_statenames[ROOT_surfxml_router] = NULL;
392   surfxml_statenames[AL_surfxml_router] = NULL;
393   surfxml_statenames[E_surfxml_router] = "router";
394   surfxml_statenames[ROOT_surfxml_network_link] = NULL;
395   surfxml_statenames[AL_surfxml_network_link] = NULL;
396   surfxml_statenames[E_surfxml_network_link] = "network_link";
397   surfxml_statenames[ROOT_surfxml_route] = NULL;
398   surfxml_statenames[AL_surfxml_route] = NULL;
399   surfxml_statenames[S_surfxml_route] = "route";
400   surfxml_statenames[S_surfxml_route_1] = "route";
401   surfxml_statenames[S_surfxml_route_2] = "route";
402   surfxml_statenames[E_surfxml_route] = "route";
403   surfxml_statenames[ROOT_surfxml_route_element] = NULL;
404   surfxml_statenames[AL_surfxml_route_element] = NULL;
405   surfxml_statenames[E_surfxml_route_element] = "route_element";
406   surfxml_statenames[ROOT_surfxml_process] = NULL;
407   surfxml_statenames[AL_surfxml_process] = NULL;
408   surfxml_statenames[S_surfxml_process] = "process";
409   surfxml_statenames[S_surfxml_process_1] = "process";
410   surfxml_statenames[S_surfxml_process_2] = "process";
411   surfxml_statenames[E_surfxml_process] = "process";
412   surfxml_statenames[ROOT_surfxml_argument] = NULL;
413   surfxml_statenames[AL_surfxml_argument] = NULL;
414   surfxml_statenames[E_surfxml_argument] = "argument";
415   }
416
417  /* COMMENTS and PIs: handled uniformly for efficiency. */
418
419 <ROOT_surfxml_platform_description,AL_surfxml_platform_description,S_surfxml_platform_description,S_surfxml_platform_description_1,S_surfxml_platform_description_2,S_surfxml_platform_description_3,S_surfxml_platform_description_4,S_surfxml_platform_description_5,E_surfxml_platform_description,ROOT_surfxml_include,AL_surfxml_include,E_surfxml_include,ROOT_surfxml_cpu,AL_surfxml_cpu,E_surfxml_cpu,ROOT_surfxml_router,AL_surfxml_router,E_surfxml_router,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>{
420  "<!--" ENTER(INCOMMENT);
421  "<?" ENTER(INPI);
422 }
423 <INCOMMENT>{
424  "-->"          LEAVE;
425  "--"           |
426  .              |
427  \n             SKIP;
428  <<EOF>>        FAIL("EOF in comment.");
429 }
430 <INPI>{
431  "?>"           LEAVE;
432  .              |
433  \n             SKIP;
434  <<EOF>>        FAIL("EOF in PI (processing instruction).");
435 }
436
437  /* SPACES: skipped uniformly */
438
439 <ROOT_surfxml_platform_description,AL_surfxml_platform_description,S_surfxml_platform_description,S_surfxml_platform_description_1,S_surfxml_platform_description_2,S_surfxml_platform_description_3,S_surfxml_platform_description_4,S_surfxml_platform_description_5,E_surfxml_platform_description,ROOT_surfxml_include,AL_surfxml_include,E_surfxml_include,ROOT_surfxml_cpu,AL_surfxml_cpu,E_surfxml_cpu,ROOT_surfxml_router,AL_surfxml_router,E_surfxml_router,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;
440
441  /* PROLOG: determine root element and process it. */
442
443 <PROLOG>{
444  "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?({S}encoding{Eq}(\'[^']*\'|\"[^"]*\"))?"?>" SET(DOCTYPE); 
445  "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
446 }
447
448 <PROLOG,DOCTYPE>{
449  "<!DOCTYPE"{S}"cpu"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_cpu);
450  "<!DOCTYPE"{S}"include"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_include);
451  "<!DOCTYPE"{S}"route"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_route);
452  "<!DOCTYPE"{S}"network_link"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_network_link);
453  "<!DOCTYPE"{S}"process"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_process);
454  "<!DOCTYPE"{S}"router"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_router);
455  "<!DOCTYPE"{S}"argument"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_argument);
456  "<!DOCTYPE"{S}"route_element"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_route_element);
457  "<!DOCTYPE"{S}"platform_description"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_platform_description);
458  "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
459  .              FAIL("Unexpected character `%c' in prolog.", yytext[0]);
460  <<EOF>>        FAIL("EOF in prolog.");
461 }
462
463  /* RULES DERIVED FROM DTD. */
464
465  /* <!-- Small DTD for SURF based tools. -->  */
466
467 <S_surfxml_platform_description_4,E_surfxml_process,S_surfxml_platform_description_5,S_surfxml_process,S_surfxml_route_2,S_surfxml_platform_description_3,E_surfxml_route,S_surfxml_platform_description,S_surfxml_route_1,S_surfxml_platform_description_1,S_surfxml_process_1,E_surfxml_platform_description,S_surfxml_platform_description_2,S_surfxml_process_2,S_surfxml_route>"<platform_description"{s} FAIL("Starting tag <platform_description> is not allowed here.");
468
469 <ROOT_surfxml_platform_description>"<platform_description"{s} {
470   AX_surfxml_platform_description_version = 1;
471   ENTER(AL_surfxml_platform_description); pushbuffer(0);
472   }
473
474 <AL_surfxml_platform_description>{
475  "version"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_platform_description_version);
476  "version"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_platform_description_version);
477
478  ">" {
479   LEAVE; STag_surfxml_platform_description();surfxml_pcdata_ix = 0; ENTER(S_surfxml_platform_description);
480  }
481  "/>" {
482   LEAVE; STag_surfxml_platform_description(); surfxml_pcdata_ix = 0; ETag_surfxml_platform_description(); popbuffer(); /* attribute */
483   switch (YY_START) {
484    case ROOT_surfxml_platform_description: SET(EPILOG); break;
485   }
486  }
487  .       FAIL("Unexpected character `%c' in attribute list of platform_description element.", yytext[0]);
488  {Name} FAIL("Bad attribute `%s' in `platform_description' element start tag.",yytext);
489  <<EOF>> FAIL("EOF in attribute list of `platform_description' element.");
490 }
491
492 <E_surfxml_platform_description,S_surfxml_platform_description_5,S_surfxml_platform_description_3,S_surfxml_platform_description_1,S_surfxml_platform_description>{
493  "</platform_description"{s}">" {
494   LEAVE;
495   ETag_surfxml_platform_description();
496   popbuffer(); /* attribute */
497   switch (YY_START) {
498    case ROOT_surfxml_platform_description: SET(EPILOG); break;
499   }
500  }
501  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</platform_description>' expected.",yytext);
502  .       FAIL("Unexpected character `%c': `</platform_description>' expected.",yytext[0]);
503  <<EOF>> FAIL("Premature EOF: `</platform_description>' expected.");
504 }
505
506 <E_surfxml_process,S_surfxml_process,S_surfxml_route_2,E_surfxml_route,S_surfxml_route_1,S_surfxml_process_1,E_surfxml_platform_description,S_surfxml_process_2,S_surfxml_route>"<include"{s} FAIL("Starting tag <include> is not allowed here.");
507
508 <ROOT_surfxml_include,S_surfxml_platform_description_2,S_surfxml_platform_description_5,S_surfxml_platform_description_3,S_surfxml_platform_description_1,S_surfxml_platform_description,S_surfxml_platform_description_4>"<include"{s} {
509   AX_surfxml_include_file = 0;
510   ENTER(AL_surfxml_include); pushbuffer(0);
511   }
512
513 <AL_surfxml_include>{
514  "file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_include_file);
515  "file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_include_file);
516
517  ">" {
518   if (!AX_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
519   LEAVE; STag_surfxml_include();surfxml_pcdata_ix = 0; ENTER(E_surfxml_include);
520  }
521  "/>" {
522   if (!AX_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
523   LEAVE; STag_surfxml_include(); surfxml_pcdata_ix = 0; ETag_surfxml_include(); popbuffer(); /* attribute */
524   switch (YY_START) {
525    case S_surfxml_platform_description_2: SET(S_surfxml_platform_description_3); break;
526    case ROOT_surfxml_include: SET(EPILOG); break;
527    case S_surfxml_platform_description_5: case S_surfxml_platform_description_3: case S_surfxml_platform_description_1: case S_surfxml_platform_description: case S_surfxml_platform_description_4: SET(S_surfxml_platform_description_5); break;
528   }
529  }
530  .       FAIL("Unexpected character `%c' in attribute list of include element.", yytext[0]);
531  {Name} FAIL("Bad attribute `%s' in `include' element start tag.",yytext);
532  <<EOF>> FAIL("EOF in attribute list of `include' element.");
533 }
534
535 <E_surfxml_include>{
536  "</include"{s}">" {
537   LEAVE;
538   ETag_surfxml_include();
539   popbuffer(); /* attribute */
540   switch (YY_START) {
541    case S_surfxml_platform_description_2: SET(S_surfxml_platform_description_3); break;
542    case ROOT_surfxml_include: SET(EPILOG); break;
543    case S_surfxml_platform_description_5: case S_surfxml_platform_description_3: case S_surfxml_platform_description_1: case S_surfxml_platform_description: case S_surfxml_platform_description_4: SET(S_surfxml_platform_description_5); break;
544   }
545  }
546  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</include>' expected.",yytext);
547  .       FAIL("Unexpected character `%c': `</include>' expected.",yytext[0]);
548  <<EOF>> FAIL("Premature EOF: `</include>' expected.");
549 }
550
551 <S_surfxml_platform_description_4,E_surfxml_process,S_surfxml_platform_description_5,S_surfxml_process,S_surfxml_route_2,E_surfxml_route,S_surfxml_route_1,S_surfxml_process_1,S_surfxml_platform_description_1,E_surfxml_platform_description,S_surfxml_process_2,S_surfxml_route>"<cpu"{s} FAIL("Starting tag <cpu> is not allowed here.");
552
553 <ROOT_surfxml_cpu,S_surfxml_platform_description_2,S_surfxml_platform_description_3,S_surfxml_platform_description>"<cpu"{s} {
554   AX_surfxml_cpu_name = 0;
555   AX_surfxml_cpu_power = 0;
556   AX_surfxml_cpu_availability = 5;
557   AX_surfxml_cpu_availability_file = 0;
558   AX_surfxml_cpu_state = A_surfxml_cpu_state_ON;
559   AX_surfxml_cpu_state_file = 0;
560   AX_surfxml_cpu_interference_send = 9;
561   AX_surfxml_cpu_interference_recv = 13;
562   AX_surfxml_cpu_interference_send_recv = 17;
563   AX_surfxml_cpu_max_outgoing_rate = 21;
564   ENTER(AL_surfxml_cpu); pushbuffer(0);
565   }
566
567 <AL_surfxml_cpu>{
568  "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_name);
569  "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_name);
570
571  "power"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_power);
572  "power"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_power);
573
574  "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_availability);
575  "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_availability);
576
577  "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_availability_file);
578  "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_availability_file);
579
580  "state"{Eq}"'ON'" |
581  "state"{Eq}"\"ON\"" A_surfxml_cpu_state = A_surfxml_cpu_state_ON;
582  "state"{Eq}"'OFF'" |
583  "state"{Eq}"\"OFF\"" A_surfxml_cpu_state = A_surfxml_cpu_state_OFF;
584
585  "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_state_file);
586  "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_state_file);
587
588  "interference_send"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_interference_send);
589  "interference_send"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_interference_send);
590
591  "interference_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_interference_recv);
592  "interference_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_interference_recv);
593
594  "interference_send_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_interference_send_recv);
595  "interference_send_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_interference_send_recv);
596
597  "max_outgoing_rate"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cpu_max_outgoing_rate);
598  "max_outgoing_rate"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cpu_max_outgoing_rate);
599
600  ">" {
601   if (!AX_surfxml_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
602   if (!AX_surfxml_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
603   LEAVE; STag_surfxml_cpu();surfxml_pcdata_ix = 0; ENTER(E_surfxml_cpu);
604  }
605  "/>" {
606   if (!AX_surfxml_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
607   if (!AX_surfxml_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
608   LEAVE; STag_surfxml_cpu(); surfxml_pcdata_ix = 0; ETag_surfxml_cpu(); popbuffer(); /* attribute */
609   switch (YY_START) {
610    case S_surfxml_platform_description_2: case S_surfxml_platform_description_3: case S_surfxml_platform_description: SET(S_surfxml_platform_description_3); break;
611    case ROOT_surfxml_cpu: SET(EPILOG); break;
612   }
613  }
614  .       FAIL("Unexpected character `%c' in attribute list of cpu element.", yytext[0]);
615  {Name} FAIL("Bad attribute `%s' in `cpu' element start tag.",yytext);
616  <<EOF>> FAIL("EOF in attribute list of `cpu' element.");
617 }
618
619 <E_surfxml_cpu>{
620  "</cpu"{s}">" {
621   LEAVE;
622   ETag_surfxml_cpu();
623   popbuffer(); /* attribute */
624   switch (YY_START) {
625    case S_surfxml_platform_description_2: case S_surfxml_platform_description_3: case S_surfxml_platform_description: SET(S_surfxml_platform_description_3); break;
626    case ROOT_surfxml_cpu: SET(EPILOG); break;
627   }
628  }
629  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</cpu>' expected.",yytext);
630  .       FAIL("Unexpected character `%c': `</cpu>' expected.",yytext[0]);
631  <<EOF>> FAIL("Premature EOF: `</cpu>' expected.");
632 }
633
634 <S_surfxml_platform_description_4,E_surfxml_process,S_surfxml_platform_description_5,S_surfxml_process,S_surfxml_route_2,E_surfxml_route,S_surfxml_route_1,S_surfxml_process_1,S_surfxml_platform_description_1,E_surfxml_platform_description,S_surfxml_process_2,S_surfxml_route>"<router"{s} FAIL("Starting tag <router> is not allowed here.");
635
636 <ROOT_surfxml_router,S_surfxml_platform_description_2,S_surfxml_platform_description_3,S_surfxml_platform_description>"<router"{s} {
637   AX_surfxml_router_name = 0;
638   ENTER(AL_surfxml_router); pushbuffer(0);
639   }
640
641 <AL_surfxml_router>{
642  "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_router_name);
643  "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_router_name);
644
645  ">" {
646   if (!AX_surfxml_router_name) FAIL("Required attribute `name' not set for `router' element.");
647   LEAVE; STag_surfxml_router();surfxml_pcdata_ix = 0; ENTER(E_surfxml_router);
648  }
649  "/>" {
650   if (!AX_surfxml_router_name) FAIL("Required attribute `name' not set for `router' element.");
651   LEAVE; STag_surfxml_router(); surfxml_pcdata_ix = 0; ETag_surfxml_router(); popbuffer(); /* attribute */
652   switch (YY_START) {
653    case S_surfxml_platform_description_2: case S_surfxml_platform_description_3: case S_surfxml_platform_description: SET(S_surfxml_platform_description_3); break;
654    case ROOT_surfxml_router: SET(EPILOG); break;
655   }
656  }
657  .       FAIL("Unexpected character `%c' in attribute list of router element.", yytext[0]);
658  {Name} FAIL("Bad attribute `%s' in `router' element start tag.",yytext);
659  <<EOF>> FAIL("EOF in attribute list of `router' element.");
660 }
661
662 <E_surfxml_router>{
663  "</router"{s}">" {
664   LEAVE;
665   ETag_surfxml_router();
666   popbuffer(); /* attribute */
667   switch (YY_START) {
668    case S_surfxml_platform_description_2: case S_surfxml_platform_description_3: case S_surfxml_platform_description: SET(S_surfxml_platform_description_3); break;
669    case ROOT_surfxml_router: SET(EPILOG); break;
670   }
671  }
672  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</router>' expected.",yytext);
673  .       FAIL("Unexpected character `%c': `</router>' expected.",yytext[0]);
674  <<EOF>> FAIL("Premature EOF: `</router>' expected.");
675 }
676
677 <S_surfxml_platform_description_4,E_surfxml_process,S_surfxml_platform_description_5,S_surfxml_process,S_surfxml_route_2,E_surfxml_route,S_surfxml_route_1,S_surfxml_process_1,S_surfxml_platform_description_1,E_surfxml_platform_description,S_surfxml_process_2,S_surfxml_route>"<network_link"{s} FAIL("Starting tag <network_link> is not allowed here.");
678
679 <ROOT_surfxml_network_link,S_surfxml_platform_description_2,S_surfxml_platform_description_3,S_surfxml_platform_description>"<network_link"{s} {
680   AX_surfxml_network_link_name = 0;
681   AX_surfxml_network_link_bandwidth = 0;
682   AX_surfxml_network_link_bandwidth_file = 0;
683   AX_surfxml_network_link_latency = 26;
684   AX_surfxml_network_link_latency_file = 0;
685   AX_surfxml_network_link_state = A_surfxml_network_link_state_ON;
686   AX_surfxml_network_link_state_file = 0;
687   AX_surfxml_network_link_sharing_policy = A_surfxml_network_link_sharing_policy_SHARED;
688   ENTER(AL_surfxml_network_link); pushbuffer(0);
689   }
690
691 <AL_surfxml_network_link>{
692  "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_network_link_name);
693  "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_network_link_name);
694
695  "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_network_link_bandwidth);
696  "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_network_link_bandwidth);
697
698  "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_network_link_bandwidth_file);
699  "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_network_link_bandwidth_file);
700
701  "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_network_link_latency);
702  "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_network_link_latency);
703
704  "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_network_link_latency_file);
705  "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_network_link_latency_file);
706
707  "state"{Eq}"'ON'" |
708  "state"{Eq}"\"ON\"" A_surfxml_network_link_state = A_surfxml_network_link_state_ON;
709  "state"{Eq}"'OFF'" |
710  "state"{Eq}"\"OFF\"" A_surfxml_network_link_state = A_surfxml_network_link_state_OFF;
711
712  "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_network_link_state_file);
713  "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_network_link_state_file);
714
715  "sharing_policy"{Eq}"'SHARED'" |
716  "sharing_policy"{Eq}"\"SHARED\"" A_surfxml_network_link_sharing_policy = A_surfxml_network_link_sharing_policy_SHARED;
717  "sharing_policy"{Eq}"'FATPIPE'" |
718  "sharing_policy"{Eq}"\"FATPIPE\"" A_surfxml_network_link_sharing_policy = A_surfxml_network_link_sharing_policy_FATPIPE;
719
720  ">" {
721   if (!AX_surfxml_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
722   if (!AX_surfxml_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
723   LEAVE; STag_surfxml_network_link();surfxml_pcdata_ix = 0; ENTER(E_surfxml_network_link);
724  }
725  "/>" {
726   if (!AX_surfxml_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
727   if (!AX_surfxml_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
728   LEAVE; STag_surfxml_network_link(); surfxml_pcdata_ix = 0; ETag_surfxml_network_link(); popbuffer(); /* attribute */
729   switch (YY_START) {
730    case S_surfxml_platform_description_2: case S_surfxml_platform_description_3: case S_surfxml_platform_description: SET(S_surfxml_platform_description_3); break;
731    case ROOT_surfxml_network_link: SET(EPILOG); break;
732   }
733  }
734  .       FAIL("Unexpected character `%c' in attribute list of network_link element.", yytext[0]);
735  {Name} FAIL("Bad attribute `%s' in `network_link' element start tag.",yytext);
736  <<EOF>> FAIL("EOF in attribute list of `network_link' element.");
737 }
738
739 <E_surfxml_network_link>{
740  "</network_link"{s}">" {
741   LEAVE;
742   ETag_surfxml_network_link();
743   popbuffer(); /* attribute */
744   switch (YY_START) {
745    case S_surfxml_platform_description_2: case S_surfxml_platform_description_3: case S_surfxml_platform_description: SET(S_surfxml_platform_description_3); break;
746    case ROOT_surfxml_network_link: SET(EPILOG); break;
747   }
748  }
749  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</network_link>' expected.",yytext);
750  .       FAIL("Unexpected character `%c': `</network_link>' expected.",yytext[0]);
751  <<EOF>> FAIL("Premature EOF: `</network_link>' expected.");
752 }
753
754 <E_surfxml_process,S_surfxml_process,S_surfxml_route_2,E_surfxml_route,S_surfxml_route_1,S_surfxml_process_1,E_surfxml_platform_description,S_surfxml_process_2,S_surfxml_platform_description_2,S_surfxml_route>"<route"{s} FAIL("Starting tag <route> is not allowed here.");
755
756 <ROOT_surfxml_route,S_surfxml_platform_description_5,S_surfxml_platform_description_3,S_surfxml_platform_description_1,S_surfxml_platform_description,S_surfxml_platform_description_4>"<route"{s} {
757   AX_surfxml_route_src = 0;
758   AX_surfxml_route_dst = 0;
759   AX_surfxml_route_impact_on_src = 30;
760   AX_surfxml_route_impact_on_dst = 34;
761   AX_surfxml_route_impact_on_src_with_other_recv = 38;
762   AX_surfxml_route_impact_on_dst_with_other_send = 42;
763   ENTER(AL_surfxml_route); pushbuffer(0);
764   }
765
766 <AL_surfxml_route>{
767  "src"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_src);
768  "src"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_src);
769
770  "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_dst);
771  "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_dst);
772
773  "impact_on_src"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_src);
774  "impact_on_src"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_src);
775
776  "impact_on_dst"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_dst);
777  "impact_on_dst"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_dst);
778
779  "impact_on_src_with_other_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
780  "impact_on_src_with_other_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
781
782  "impact_on_dst_with_other_send"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
783  "impact_on_dst_with_other_send"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
784
785  ">" {
786   if (!AX_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
787   if (!AX_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
788   LEAVE; STag_surfxml_route();surfxml_pcdata_ix = 0; ENTER(S_surfxml_route);
789  }
790  "/>" {
791   if (!AX_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
792   if (!AX_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
793   LEAVE; STag_surfxml_route(); surfxml_pcdata_ix = 0; ETag_surfxml_route(); popbuffer(); /* attribute */
794   switch (YY_START) {
795    case S_surfxml_platform_description_5: case S_surfxml_platform_description_3: case S_surfxml_platform_description_1: case S_surfxml_platform_description: case S_surfxml_platform_description_4: SET(S_surfxml_platform_description_5); break;
796    case ROOT_surfxml_route: SET(EPILOG); break;
797   }
798  }
799  .       FAIL("Unexpected character `%c' in attribute list of route element.", yytext[0]);
800  {Name} FAIL("Bad attribute `%s' in `route' element start tag.",yytext);
801  <<EOF>> FAIL("EOF in attribute list of `route' element.");
802 }
803
804 <S_surfxml_route,S_surfxml_route_2,E_surfxml_route>{
805  "</route"{s}">" {
806   LEAVE;
807   ETag_surfxml_route();
808   popbuffer(); /* attribute */
809   switch (YY_START) {
810    case S_surfxml_platform_description_5: case S_surfxml_platform_description_3: case S_surfxml_platform_description_1: case S_surfxml_platform_description: case S_surfxml_platform_description_4: SET(S_surfxml_platform_description_5); break;
811    case ROOT_surfxml_route: SET(EPILOG); break;
812   }
813  }
814  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route>' expected.",yytext);
815  .       FAIL("Unexpected character `%c': `</route>' expected.",yytext[0]);
816  <<EOF>> FAIL("Premature EOF: `</route>' expected.");
817 }
818
819 <S_surfxml_platform_description_4,E_surfxml_process,S_surfxml_platform_description_5,S_surfxml_process,S_surfxml_platform_description_3,E_surfxml_route,S_surfxml_platform_description,S_surfxml_process_1,S_surfxml_platform_description_1,E_surfxml_platform_description,S_surfxml_process_2,S_surfxml_platform_description_2>"<route_element"{s} FAIL("Starting tag <route_element> is not allowed here.");
820
821 <ROOT_surfxml_route_element,S_surfxml_route_1,S_surfxml_route,S_surfxml_route_2>"<route_element"{s} {
822   AX_surfxml_route_element_name = 0;
823   ENTER(AL_surfxml_route_element); pushbuffer(0);
824   }
825
826 <AL_surfxml_route_element>{
827  "name"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_element_name);
828  "name"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_element_name);
829
830  ">" {
831   if (!AX_surfxml_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
832   LEAVE; STag_surfxml_route_element();surfxml_pcdata_ix = 0; ENTER(E_surfxml_route_element);
833  }
834  "/>" {
835   if (!AX_surfxml_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
836   LEAVE; STag_surfxml_route_element(); surfxml_pcdata_ix = 0; ETag_surfxml_route_element(); popbuffer(); /* attribute */
837   switch (YY_START) {
838    case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
839    case ROOT_surfxml_route_element: SET(EPILOG); break;
840   }
841  }
842  .       FAIL("Unexpected character `%c' in attribute list of route_element element.", yytext[0]);
843  {Name} FAIL("Bad attribute `%s' in `route_element' element start tag.",yytext);
844  <<EOF>> FAIL("EOF in attribute list of `route_element' element.");
845 }
846
847 <E_surfxml_route_element>{
848  "</route_element"{s}">" {
849   LEAVE;
850   ETag_surfxml_route_element();
851   popbuffer(); /* attribute */
852   switch (YY_START) {
853    case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
854    case ROOT_surfxml_route_element: SET(EPILOG); break;
855   }
856  }
857  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route_element>' expected.",yytext);
858  .       FAIL("Unexpected character `%c': `</route_element>' expected.",yytext[0]);
859  <<EOF>> FAIL("Premature EOF: `</route_element>' expected.");
860 }
861
862 <E_surfxml_process,S_surfxml_process,S_surfxml_route_2,E_surfxml_route,S_surfxml_route_1,S_surfxml_process_1,E_surfxml_platform_description,S_surfxml_process_2,S_surfxml_platform_description_2,S_surfxml_route>"<process"{s} FAIL("Starting tag <process> is not allowed here.");
863
864 <ROOT_surfxml_process,S_surfxml_platform_description_5,S_surfxml_platform_description_3,S_surfxml_platform_description_1,S_surfxml_platform_description,S_surfxml_platform_description_4>"<process"{s} {
865   AX_surfxml_process_host = 0;
866   AX_surfxml_process_function = 0;
867   AX_surfxml_process_start_time = 46;
868   AX_surfxml_process_kill_time = 51;
869   ENTER(AL_surfxml_process); pushbuffer(0);
870   }
871
872 <AL_surfxml_process>{
873  "host"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_host);
874  "host"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_host);
875
876  "function"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_function);
877  "function"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_function);
878
879  "start_time"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_start_time);
880  "start_time"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_start_time);
881
882  "kill_time"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_kill_time);
883  "kill_time"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_kill_time);
884
885  ">" {
886   if (!AX_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
887   if (!AX_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
888   LEAVE; STag_surfxml_process();surfxml_pcdata_ix = 0; ENTER(S_surfxml_process);
889  }
890  "/>" {
891   if (!AX_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
892   if (!AX_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
893   LEAVE; STag_surfxml_process(); surfxml_pcdata_ix = 0; ETag_surfxml_process(); popbuffer(); /* attribute */
894   switch (YY_START) {
895    case S_surfxml_platform_description_5: case S_surfxml_platform_description_3: case S_surfxml_platform_description_1: case S_surfxml_platform_description: case S_surfxml_platform_description_4: SET(S_surfxml_platform_description_5); break;
896    case ROOT_surfxml_process: SET(EPILOG); break;
897   }
898  }
899  .       FAIL("Unexpected character `%c' in attribute list of process element.", yytext[0]);
900  {Name} FAIL("Bad attribute `%s' in `process' element start tag.",yytext);
901  <<EOF>> FAIL("EOF in attribute list of `process' element.");
902 }
903
904 <S_surfxml_process,E_surfxml_process,S_surfxml_process_2>{
905  "</process"{s}">" {
906   LEAVE;
907   ETag_surfxml_process();
908   popbuffer(); /* attribute */
909   switch (YY_START) {
910    case S_surfxml_platform_description_5: case S_surfxml_platform_description_3: case S_surfxml_platform_description_1: case S_surfxml_platform_description: case S_surfxml_platform_description_4: SET(S_surfxml_platform_description_5); break;
911    case ROOT_surfxml_process: SET(EPILOG); break;
912   }
913  }
914  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</process>' expected.",yytext);
915  .       FAIL("Unexpected character `%c': `</process>' expected.",yytext[0]);
916  <<EOF>> FAIL("Premature EOF: `</process>' expected.");
917 }
918
919 <S_surfxml_platform_description_4,E_surfxml_process,S_surfxml_platform_description_5,S_surfxml_platform_description_3,S_surfxml_route_2,E_surfxml_route,S_surfxml_platform_description,S_surfxml_route_1,S_surfxml_platform_description_1,E_surfxml_platform_description,S_surfxml_platform_description_2,S_surfxml_route>"<argument"{s} FAIL("Starting tag <argument> is not allowed here.");
920
921 <ROOT_surfxml_argument,S_surfxml_process_1,S_surfxml_process,S_surfxml_process_2>"<argument"{s} {
922   AX_surfxml_argument_value = 0;
923   ENTER(AL_surfxml_argument); pushbuffer(0);
924   }
925
926 <AL_surfxml_argument>{
927  "value"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_argument_value);
928  "value"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_argument_value);
929
930  ">" {
931   if (!AX_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
932   LEAVE; STag_surfxml_argument();surfxml_pcdata_ix = 0; ENTER(E_surfxml_argument);
933  }
934  "/>" {
935   if (!AX_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
936   LEAVE; STag_surfxml_argument(); surfxml_pcdata_ix = 0; ETag_surfxml_argument(); popbuffer(); /* attribute */
937   switch (YY_START) {
938    case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
939    case ROOT_surfxml_argument: SET(EPILOG); break;
940   }
941  }
942  .       FAIL("Unexpected character `%c' in attribute list of argument element.", yytext[0]);
943  {Name} FAIL("Bad attribute `%s' in `argument' element start tag.",yytext);
944  <<EOF>> FAIL("EOF in attribute list of `argument' element.");
945 }
946
947 <E_surfxml_argument>{
948  "</argument"{s}">" {
949   LEAVE;
950   ETag_surfxml_argument();
951   popbuffer(); /* attribute */
952   switch (YY_START) {
953    case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
954    case ROOT_surfxml_argument: SET(EPILOG); break;
955   }
956  }
957  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</argument>' expected.",yytext);
958  .       FAIL("Unexpected character `%c': `</argument>' expected.",yytext[0]);
959  <<EOF>> FAIL("Premature EOF: `</argument>' expected.");
960 }
961
962  /* EPILOG: after the root element. */
963
964 <EPILOG>{
965  . {SET(PROLOG); yyless(0); CLEANUP; return -1;}
966  <<EOF>>        SUCCEED;
967 }
968
969  /* CHARACTER DATA. */
970
971 <IMPOSSIBLE,VALUE1,VALUE2>{
972  /* Non-defined standard entities... */
973 "&amp;"  BUFFERPUTC('&');
974 "&lt;"   BUFFERPUTC('<');
975 "&gt;"   BUFFERPUTC('>');
976 "&apos;" BUFFERPUTC('\'');
977 "&quot;" BUFFERPUTC('"');
978
979  /* Character entities. */
980  "&#"[[:digit:]]+";"    BUFFERPUTC((unsigned char)atoi(yytext+2));
981  "&#x"[[:xdigit:]]+";"  BUFFERPUTC((unsigned char)strtol(yytext+3,NULL,16));
982 }
983
984 <IMPOSSIBLE,VALUE1,VALUE2,CDATA>{
985  "\n"           |
986  "\r"           |
987  "\r\n"         |
988  "\n\r"         BUFFERPUTC('\n');
989 }
990
991 <IMPOSSIBLE>{
992  "<![CDATA["    ENTER(CDATA);
993  "]""]>"                FAIL("Unexpected `]""]>' in character data.");
994 }
995
996 <VALUE1>{
997  \'             BUFFERDONE; LEAVE;
998  <<EOF>>        FAIL("EOF in literal (\"'\" expected).");
999 }
1000
1001 <VALUE2>{
1002  \"             BUFFERDONE; LEAVE;
1003  <<EOF>>        FAIL("EOF in literal (`\"' expected).");
1004 }
1005
1006 <IMPOSSIBLE,VALUE1,VALUE2>{
1007  [^<&]          BUFFERPUTC(yytext[0]);
1008  [<&]           FAIL("Spurious `%c' in character data.",yytext[0]);
1009 }
1010
1011 <CDATA>{
1012  "]""]>"                LEAVE;
1013  /* "]""]"              BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]); */
1014  .              BUFFERPUTC(yytext[0]);
1015  <<EOF>>        FAIL("EOF in CDATA section.");
1016 }
1017
1018  /* Impossible rules to avoid warnings from flex(1). */
1019  /* Ideally, this should be replaced by code in flexml.pl that
1020     generates just the states not covered by other rules. */
1021 <*>{
1022  .|[\n] FAIL("Syntax error on character `%c'.", yytext[0]);
1023 }
1024
1025 %%
1026
1027 /* Element context stack lookup. */
1028 int surfxml_element_context(int i)
1029 {
1030   return (0<i && i<yy_start_stack_depth
1031           ? yy_start_stack[yy_start_stack_ptr - i]
1032           : 0);
1033 }
1034
1035 #ifdef FLEX_DEBUG
1036 void print_yy_stack(char* fmt, ...)
1037 {
1038   int i = 0; va_list ap; va_start(ap, fmt);
1039   vfprintf(stderr, fmt, ap);
1040   if (surfxml_statenames) {
1041       for (i=1; i<yy_start_stack_ptr; i++) {
1042           fprintf(stderr, "%s/", surfxml_statenames[yy_start_stack[i] ]);
1043       }
1044       fprintf(stderr,"%s\n", surfxml_statenames[YY_START]);
1045   }
1046   va_end(ap);
1047 }
1048
1049 void print_surfxml_bufferstack()
1050 {
1051     int i;
1052     fputs("Buffer: ", stderr);
1053     for (i = 0; i < blimit; i++) {
1054        if ( surfxml_bufferstack[i] == '\377' ) break;
1055          putc(surfxml_bufferstack[i], stderr);
1056     }
1057     putc('\n', stderr);
1058 }
1059
1060 static void debug_enter(int state, const char* statename) {
1061   yy_push_state(state);
1062   if (yy_flex_debug) {
1063        print_yy_stack("--ENTER(%s) : ",statename);
1064        print_surfxml_bufferstack();
1065   }
1066 }
1067
1068 static void debug_leave(void) {
1069     if (yy_flex_debug) {
1070         print_yy_stack("--LEAVE : ");
1071         print_surfxml_bufferstack();
1072     }
1073   yy_pop_state();
1074 }
1075
1076 static void debug_set(int state, const char* statename) {
1077   BEGIN(state);
1078   if (yy_flex_debug) print_yy_stack("--SET(%s) : ",statename);
1079 }
1080 #endif
1081
1082
1083 static void cleanup(void)
1084 {
1085     if (surfxml_statenames) {
1086         free(surfxml_statenames);
1087         surfxml_statenames = NULL;
1088     }
1089     free(surfxml_bufferstack);
1090     surfxml_bufferstack = NULL;
1091
1092     free(indexstack);
1093     indexstack = NULL;
1094 }
1095
1096
1097 static int fail(const char* fmt, ...)
1098 {
1099     int chars_left, used;
1100     va_list ap; va_start(ap, fmt);
1101 #ifdef FLEXML_yylineno
1102     used = sprintf(flexml_err_msg,
1103                    "Invalid XML (XML input line %d, state %d): ",
1104                    yylineno, YY_START);
1105 #else
1106     used = sprintf(flexml_err_msg,
1107                    "Invalid XML (state %d): ",
1108                    YY_START);
1109 #endif
1110     chars_left = flexml_max_err_msg_size - used - 1;
1111     vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
1112     va_end(ap);
1113
1114 #ifndef FLEXML_quiet_parser
1115     /* print directly to sdterr */
1116     fprintf(stderr, "%s\n", flexml_err_msg);
1117     flexml_err_msg[0] = '\0';
1118 #endif
1119
1120     cleanup();
1121
1122     return 1;
1123 }