1 /* Validating XML processor for surfxml.dtd.
2 * Generated 2005/02/13 20:04:21.
4 * This program was generated with the FleXML XML processor generator,
5 * (Id: flexml.pl,v 1.39 2005/02/13 18:12:19 legranda Exp).
6 * Copyright © 1999 Kristoffer Rose. All rights reserved.
8 * You can redistribute and/or modify this program provided the following
11 * 1. The program is distributed WITHOUT ANY WARRANTY from the author of
12 * FleXML; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.
15 * 2. The program distribution conditions do not in any way affect the
16 * distribution conditions of the FleXML system used to generate this
17 * file or any version of FleXML derived from that system.
19 * Notice that these are explicit rights granted to you for files
20 * generated by the FleXML system. For your rights in connection with
21 * the FleXML system itself please consult the GNU General Public License.
26 /* Version strings. */
27 const char rcs_flexml_skeleton[] =
28 "$" "Id: skel,v 1.24 2005/02/10 11:42:39 mquinson Exp $";
29 const char rcs_flexml[] =
30 "$" "Id: flexml.pl,v 1.39 2005/02/13 18:12:19 legranda Exp $";
40 /* Generated definitions. */
41 #define FLEXML_yylineno
42 #define FLEXML_BUFFERSTACKSIZE 1000000
44 /* XML processor api. */
45 #include "surf/surfxml.h"
47 /* FleXML-provided data. */
49 AT_network_link_bandwidth A_network_link_bandwidth;
50 AT_cpu_name A_cpu_name;
51 AT_network_link_state A_network_link_state;
52 AT_argument_value A_argument_value;
53 AT_cpu_availability_file A_cpu_availability_file;
54 AT_process_host A_process_host;
55 AT_route_impact_on_src A_route_impact_on_src;
56 AT_route_src A_route_src;
57 AT_network_link_latency_file A_network_link_latency_file;
58 AT_cpu_max_outgoing_rate A_cpu_max_outgoing_rate;
59 AT_route_impact_on_dst_with_other_send A_route_impact_on_dst_with_other_send;
60 AT_cpu_interference_send_recv A_cpu_interference_send_recv;
61 AT_cpu_availability A_cpu_availability;
62 AT_route_impact_on_dst A_route_impact_on_dst;
63 AT_cpu_interference_recv A_cpu_interference_recv;
64 AT_route_impact_on_src_with_other_recv A_route_impact_on_src_with_other_recv;
65 AT_network_link_name A_network_link_name;
66 AT_route_element_name A_route_element_name;
67 AT_cpu_power A_cpu_power;
68 AT_include_file A_include_file;
69 AT_process_function A_process_function;
70 AT_route_dst A_route_dst;
71 AT_cpu_state A_cpu_state;
72 AT_network_link_latency A_network_link_latency;
73 AT_network_link_state_file A_network_link_state_file;
74 AT_cpu_interference_send A_cpu_interference_send;
75 AT_cpu_state_file A_cpu_state_file;
76 AT_network_link_bandwidth_file A_network_link_bandwidth_file;
80 # define ENTER(state) debug_enter(state,#state)
81 # define LEAVE debug_leave()
82 # define SET(state) debug_set(state,#state)
83 static void debug_enter(int, const char*);
84 static void debug_leave(void);
85 static void debug_set(int, const char*);
87 # define ENTER(state) (yy_push_state(state))
88 # define LEAVE (yy_pop_state())
89 # define SET(state) BEGIN(state)
92 /* Generic actions. */
94 #define SUCCEED return 0
96 #define FAIL return fail
97 static int fail(const char*, ...);
98 const char * parse_err_msg(void);
100 /* Text buffer stack handling. */
101 char bufferstack[FLEXML_BUFFERSTACKSIZE];
102 char* limit = bufferstack + FLEXML_BUFFERSTACKSIZE;
103 typedef struct BufferLast_s {
104 struct BufferLast_s *old; char* saved; char new1[1];
106 BufferLast* last = (BufferLast*)0;
107 char* next = bufferstack;
109 #define BUFFERSET(P) (P = next)
110 #define BUFFERPUTC(C) (assert(next<limit), *(next++) = (C))
111 #define BUFFERDONE (BUFFERPUTC('\0'))
113 #define BUFFERLITERAL(C,P) bufferliteral(C,&(P),yytext)
114 static void bufferliteral(char c, const char** pp, char* text)
116 char *s = strchr(text,c), *e = strrchr(text,c);
117 assert(s <= e); BUFFERSET(*pp);
119 if (isspace(*s)) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
125 #ifdef FLEXML_HasMixed
126 static void pushbuffer(char* p)
128 BufferLast* l = (BufferLast*)next;
129 assert(next < limit);
136 static char* popbuffer(void)
138 BufferLast* l = last;
139 assert(last != (BufferLast*)0);
146 /* General internal entities are `unput' back onto the input stream... */
147 #define ENTITYTEXT(T) \
148 { char *s = (T), *e = s+strlen(s);\
149 while (--e >= s) { unput(*e); }}
152 /* Flex standard options. */
154 %option noyy_top_state
160 /* Flex user-requested options. */
164 /* XML character classes (currently restricted to ASCII). */
166 /* "Common syntactic structures." */
170 /* "Names and Tokens." */
171 NameChar [A-Za-z0-9.:_-]
172 Name [A-Za-z_:]{NameChar}*
173 Names {Name}({S}{Name})*
174 Nmtoken ({NameChar})+
175 Nmtokens {Nmtoken}({S}{Nmtoken})*
178 VersionNum [a-zA-Z0-9_.:-]+
180 Literal \'[^'']*\'|\"[^""]*\"
182 /* Parser states (flex `exclusive start conditions'):
184 * PROLOG the XML prolog of the document before <?xml...>
185 * DOCTYPE the XML prolog of the document after <?xml...>
186 * EPILOG after the root element
187 * INCOMMENT inside an XML comment <!--....-->
188 * INPI inside an XML PI <?...?>
189 * VALUE1 inside a '...'-delimited literal
190 * VALUE2 inside a "..."-delimited literal
191 * CDATA inside a <![CDATA[...]]> section.
192 * ROOT_<tag> expect root element <tag>
193 * AL_<tag> inside the attribute list for <tag>
194 * IN_<tag> inside a <tag> with element contents (ready for end tag)
195 * IMPOSSIBLE dummy to permit disabling rules; must be last
197 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
198 %x ROOT_platform_description AL_platform_description S_platform_description S_platform_description_1 S_platform_description_2 E_platform_description
199 %x ROOT_include AL_include S_include S_include_1 S_include_2 E_include
200 %x ROOT_cpu AL_cpu E_cpu
201 %x ROOT_network_link AL_network_link E_network_link
202 %x ROOT_route AL_route S_route S_route_1 S_route_2 E_route
203 %x ROOT_route_element AL_route_element E_route_element
204 %x ROOT_process AL_process S_process S_process_1 S_process_2 E_process
205 %x ROOT_argument AL_argument E_argument
210 const char* *statenames=NULL;
215 /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
219 if(!statenames) {statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
220 statenames[PROLOG] = NULL;
221 statenames[DOCTYPE] = NULL;
222 statenames[EPILOG] = NULL;
223 statenames[INCOMMENT] = NULL;
224 statenames[INPI] = NULL;
225 statenames[VALUE1] = NULL;
226 statenames[VALUE2] = NULL;
227 statenames[CDATA] = NULL;
228 statenames[ROOT_platform_description] = NULL;
229 statenames[AL_platform_description] = NULL;
230 statenames[S_platform_description] = "platform_description";
231 statenames[S_platform_description_1] = "platform_description";
232 statenames[S_platform_description_2] = "platform_description";
233 statenames[E_platform_description] = "platform_description";
234 statenames[ROOT_include] = NULL;
235 statenames[AL_include] = NULL;
236 statenames[S_include] = "include";
237 statenames[S_include_1] = "include";
238 statenames[S_include_2] = "include";
239 statenames[E_include] = "include";
240 statenames[ROOT_cpu] = NULL;
241 statenames[AL_cpu] = NULL;
242 statenames[E_cpu] = "cpu";
243 statenames[ROOT_network_link] = NULL;
244 statenames[AL_network_link] = NULL;
245 statenames[E_network_link] = "network_link";
246 statenames[ROOT_route] = NULL;
247 statenames[AL_route] = NULL;
248 statenames[S_route] = "route";
249 statenames[S_route_1] = "route";
250 statenames[S_route_2] = "route";
251 statenames[E_route] = "route";
252 statenames[ROOT_route_element] = NULL;
253 statenames[AL_route_element] = NULL;
254 statenames[E_route_element] = "route_element";
255 statenames[ROOT_process] = NULL;
256 statenames[AL_process] = NULL;
257 statenames[S_process] = "process";
258 statenames[S_process_1] = "process";
259 statenames[S_process_2] = "process";
260 statenames[E_process] = "process";
261 statenames[ROOT_argument] = NULL;
262 statenames[AL_argument] = NULL;
263 statenames[E_argument] = "argument";
265 /* COMMENTS and PIs: handled uniformly for efficiency. */
267 <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>{
268 "<!--" ENTER(INCOMMENT);
276 <<EOF>> FAIL("EOF in comment.");
282 <<EOF>> FAIL("EOF in PI (processing instruction).");
285 /* SPACES: skipped uniformly */
287 <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;
289 /* PROLOG: determine root element and process it. */
292 "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?({S}encoding{Eq}(\'[^']*\'|\"[^"]*\"))?"?>" SET(DOCTYPE);
293 "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
297 "<!DOCTYPE"{S}"argument"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_argument);
298 "<!DOCTYPE"{S}"route_element"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route_element);
299 "<!DOCTYPE"{S}"cpu"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_cpu);
300 "<!DOCTYPE"{S}"include"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_include);
301 "<!DOCTYPE"{S}"route"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route);
302 "<!DOCTYPE"{S}"platform_description"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_platform_description);
303 "<!DOCTYPE"{S}"network_link"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_network_link);
304 "<!DOCTYPE"{S}"process"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_process);
305 "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
306 . FAIL("Unexpected character `%c' in prolog.", yytext[0]);
307 <<EOF>> FAIL("EOF in prolog.");
310 /* RULES DERIVED FROM DTD. */
312 /* <!-- Small DTD for SURF based tools. --> */
314 <ROOT_platform_description>"<platform_description"{s} {
315 ENTER(AL_platform_description);
318 <AL_platform_description>{
320 LEAVE; STag_platform_description();pcdata = NULL; ENTER(S_platform_description);
323 LEAVE; STag_platform_description(); pcdata = NULL; ETag_platform_description();
325 case ROOT_platform_description: SET(EPILOG); break;
328 . FAIL("Unexpected character `%c' in attribute list of platform_description element.", yytext[0]);
329 {Name} FAIL("Bad attribute `%s' in `platform_description' element start tag.",yytext);
330 <<EOF>> FAIL("EOF in attribute list of `platform_description' element.");
333 <E_platform_description,S_platform_description_2,S_platform_description>{
334 "</platform_description"{s}">" {
336 ETag_platform_description();
338 case ROOT_platform_description: SET(EPILOG); break;
341 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</platform_description>' expected.",yytext);
342 . FAIL("Unexpected character `%c': `</platform_description>' expected.",yytext[0]);
343 <<EOF>> FAIL("Premature EOF: `</platform_description>' expected.");
346 <ROOT_include,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<include"{s} {
347 A_include_file = NULL;
352 "file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_include_file);
353 "file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_include_file);
356 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
357 LEAVE; STag_include();pcdata = NULL; ENTER(S_include);
360 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
361 LEAVE; STag_include(); pcdata = NULL; ETag_include();
363 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
364 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
365 case ROOT_include: SET(EPILOG); break;
368 . FAIL("Unexpected character `%c' in attribute list of include element.", yytext[0]);
369 {Name} FAIL("Bad attribute `%s' in `include' element start tag.",yytext);
370 <<EOF>> FAIL("EOF in attribute list of `include' element.");
373 <E_include,S_include,S_include_2>{
378 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
379 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
380 case ROOT_include: SET(EPILOG); break;
383 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</include>' expected.",yytext);
384 . FAIL("Unexpected character `%c': `</include>' expected.",yytext[0]);
385 <<EOF>> FAIL("Premature EOF: `</include>' expected.");
388 <ROOT_cpu,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<cpu"{s} {
391 A_cpu_availability = "1.0";
392 A_cpu_availability_file = NULL;
393 A_cpu_state = A_cpu_state_ON;
394 A_cpu_state_file = NULL;
395 A_cpu_interference_send = "1.0";
396 A_cpu_interference_recv = "1.0";
397 A_cpu_interference_send_recv = "1.0";
398 A_cpu_max_outgoing_rate = "-1.0";
403 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_name);
404 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_name);
406 "power"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_power);
407 "power"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_power);
409 "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability);
410 "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability);
412 "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability_file);
413 "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability_file);
416 "state"{Eq}"\"ON\"" A_cpu_state = A_cpu_state_ON;
418 "state"{Eq}"\"OFF\"" A_cpu_state = A_cpu_state_OFF;
420 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_state_file);
421 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_state_file);
423 "interference_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send);
424 "interference_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send);
426 "interference_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_recv);
427 "interference_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_recv);
429 "interference_send_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send_recv);
430 "interference_send_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send_recv);
432 "max_outgoing_rate"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_max_outgoing_rate);
433 "max_outgoing_rate"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_max_outgoing_rate);
436 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
437 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
438 LEAVE; STag_cpu();pcdata = NULL; ENTER(E_cpu);
441 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
442 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
443 LEAVE; STag_cpu(); pcdata = NULL; ETag_cpu();
445 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
446 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
447 case ROOT_cpu: SET(EPILOG); break;
450 . FAIL("Unexpected character `%c' in attribute list of cpu element.", yytext[0]);
451 {Name} FAIL("Bad attribute `%s' in `cpu' element start tag.",yytext);
452 <<EOF>> FAIL("EOF in attribute list of `cpu' element.");
460 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
461 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
462 case ROOT_cpu: SET(EPILOG); break;
465 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</cpu>' expected.",yytext);
466 . FAIL("Unexpected character `%c': `</cpu>' expected.",yytext[0]);
467 <<EOF>> FAIL("Premature EOF: `</cpu>' expected.");
470 <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} {
471 A_network_link_name = NULL;
472 A_network_link_bandwidth = NULL;
473 A_network_link_bandwidth_file = NULL;
474 A_network_link_latency = "0.0";
475 A_network_link_latency_file = NULL;
476 A_network_link_state = A_network_link_state_ON;
477 A_network_link_state_file = NULL;
478 ENTER(AL_network_link);
482 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_name);
483 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_name);
485 "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth);
486 "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth);
488 "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth_file);
489 "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth_file);
491 "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency);
492 "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency);
494 "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency_file);
495 "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency_file);
498 "state"{Eq}"\"ON\"" A_network_link_state = A_network_link_state_ON;
500 "state"{Eq}"\"OFF\"" A_network_link_state = A_network_link_state_OFF;
502 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_state_file);
503 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_state_file);
506 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
507 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
508 LEAVE; STag_network_link();pcdata = NULL; ENTER(E_network_link);
511 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
512 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
513 LEAVE; STag_network_link(); pcdata = NULL; ETag_network_link();
515 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
516 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
517 case ROOT_network_link: SET(EPILOG); break;
520 . FAIL("Unexpected character `%c' in attribute list of network_link element.", yytext[0]);
521 {Name} FAIL("Bad attribute `%s' in `network_link' element start tag.",yytext);
522 <<EOF>> FAIL("EOF in attribute list of `network_link' element.");
526 "</network_link"{s}">" {
530 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
531 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
532 case ROOT_network_link: SET(EPILOG); break;
535 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</network_link>' expected.",yytext);
536 . FAIL("Unexpected character `%c': `</network_link>' expected.",yytext[0]);
537 <<EOF>> FAIL("Premature EOF: `</network_link>' expected.");
540 <ROOT_route,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<route"{s} {
543 A_route_impact_on_src = "0.0";
544 A_route_impact_on_dst = "0.0";
545 A_route_impact_on_src_with_other_recv = "0.0";
546 A_route_impact_on_dst_with_other_send = "0.0";
551 "src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_src);
552 "src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_src);
554 "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_dst);
555 "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_dst);
557 "impact_on_src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src);
558 "impact_on_src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src);
560 "impact_on_dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst);
561 "impact_on_dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst);
563 "impact_on_src_with_other_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src_with_other_recv);
564 "impact_on_src_with_other_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src_with_other_recv);
566 "impact_on_dst_with_other_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst_with_other_send);
567 "impact_on_dst_with_other_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst_with_other_send);
570 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
571 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
572 LEAVE; STag_route();pcdata = NULL; ENTER(S_route);
575 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
576 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
577 LEAVE; STag_route(); pcdata = NULL; ETag_route();
579 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
580 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
581 case ROOT_route: SET(EPILOG); break;
584 . FAIL("Unexpected character `%c' in attribute list of route element.", yytext[0]);
585 {Name} FAIL("Bad attribute `%s' in `route' element start tag.",yytext);
586 <<EOF>> FAIL("EOF in attribute list of `route' element.");
589 <S_route,S_route_2,E_route>{
594 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
595 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
596 case ROOT_route: SET(EPILOG); break;
599 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route>' expected.",yytext);
600 . FAIL("Unexpected character `%c': `</route>' expected.",yytext[0]);
601 <<EOF>> FAIL("Premature EOF: `</route>' expected.");
604 <ROOT_route_element,S_route_1,S_route,S_route_2>"<route_element"{s} {
605 A_route_element_name = NULL;
606 ENTER(AL_route_element);
610 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_element_name);
611 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_element_name);
614 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
615 LEAVE; STag_route_element();pcdata = NULL; ENTER(E_route_element);
618 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
619 LEAVE; STag_route_element(); pcdata = NULL; ETag_route_element();
621 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
622 case ROOT_route_element: SET(EPILOG); break;
625 . FAIL("Unexpected character `%c' in attribute list of route_element element.", yytext[0]);
626 {Name} FAIL("Bad attribute `%s' in `route_element' element start tag.",yytext);
627 <<EOF>> FAIL("EOF in attribute list of `route_element' element.");
631 "</route_element"{s}">" {
633 ETag_route_element();
635 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
636 case ROOT_route_element: SET(EPILOG); break;
639 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route_element>' expected.",yytext);
640 . FAIL("Unexpected character `%c': `</route_element>' expected.",yytext[0]);
641 <<EOF>> FAIL("Premature EOF: `</route_element>' expected.");
644 <ROOT_process,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<process"{s} {
645 A_process_host = NULL;
646 A_process_function = NULL;
651 "host"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_host);
652 "host"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_host);
654 "function"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_function);
655 "function"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_function);
658 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
659 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
660 LEAVE; STag_process();pcdata = NULL; ENTER(S_process);
663 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
664 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
665 LEAVE; STag_process(); pcdata = NULL; ETag_process();
667 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
668 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
669 case ROOT_process: SET(EPILOG); break;
672 . FAIL("Unexpected character `%c' in attribute list of process element.", yytext[0]);
673 {Name} FAIL("Bad attribute `%s' in `process' element start tag.",yytext);
674 <<EOF>> FAIL("EOF in attribute list of `process' element.");
677 <S_process,E_process,S_process_2>{
682 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
683 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
684 case ROOT_process: SET(EPILOG); break;
687 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</process>' expected.",yytext);
688 . FAIL("Unexpected character `%c': `</process>' expected.",yytext[0]);
689 <<EOF>> FAIL("Premature EOF: `</process>' expected.");
692 <ROOT_argument,S_process_1,S_process,S_process_2>"<argument"{s} {
693 A_argument_value = NULL;
698 "value"{Eq}\' ENTER(VALUE1); BUFFERSET(A_argument_value);
699 "value"{Eq}\" ENTER(VALUE2); BUFFERSET(A_argument_value);
702 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
703 LEAVE; STag_argument();pcdata = NULL; ENTER(E_argument);
706 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
707 LEAVE; STag_argument(); pcdata = NULL; ETag_argument();
709 case ROOT_argument: SET(EPILOG); break;
710 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
713 . FAIL("Unexpected character `%c' in attribute list of argument element.", yytext[0]);
714 {Name} FAIL("Bad attribute `%s' in `argument' element start tag.",yytext);
715 <<EOF>> FAIL("EOF in attribute list of `argument' element.");
723 case ROOT_argument: SET(EPILOG); break;
724 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
727 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</argument>' expected.",yytext);
728 . FAIL("Unexpected character `%c': `</argument>' expected.",yytext[0]);
729 <<EOF>> FAIL("Premature EOF: `</argument>' expected.");
732 /* EPILOG: after the root element. */
735 . {SET(PROLOG); yyless(0); return -1;}
739 /* CHARACTER DATA. */
741 <IMPOSSIBLE,VALUE1,VALUE2>{
742 /* Non-defined standard entities... */
743 "&" BUFFERPUTC('&');
744 "<" BUFFERPUTC('<');
745 ">" BUFFERPUTC('>');
746 "'" BUFFERPUTC('\'');
747 """ BUFFERPUTC('"');
749 /* Character entities. */
750 "&#"[[:digit:]]+";" BUFFERPUTC((unsigned char)atoi(yytext+2));
751 "&#x"[[:xdigit:]]+";" BUFFERPUTC((unsigned char)strtol(yytext+3,NULL,16));
754 <IMPOSSIBLE,VALUE1,VALUE2,CDATA>{
758 "\n\r" BUFFERPUTC('\n');
762 "<![CDATA[" ENTER(CDATA);
763 "]""]>" FAIL("Unexpected `]""]>' in character data.");
767 \' BUFFERDONE; LEAVE;
768 <<EOF>> FAIL("EOF in literal (\"'\" expected).");
772 \" BUFFERDONE; LEAVE;
773 <<EOF>> FAIL("EOF in literal (`\"' expected).");
776 <IMPOSSIBLE,VALUE1,VALUE2>{
777 [^<&] BUFFERPUTC(yytext[0]);
778 [<&] FAIL("Spurious `%c' in character data.",yytext[0]);
783 /* "]""]" BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]); */
784 . BUFFERPUTC(yytext[0]);
785 <<EOF>> FAIL("EOF in CDATA section.");
788 /* Impossible rules to avoid warnings from flex(1). */
789 /* Ideally, this should be replaced by code in flexml.pl that
790 generates just the states not covered by other rules. */
792 .|[\n] FAIL("Syntax error on character `%c'.", yytext[0]);
797 /* Element context stack lookup. */
798 int element_context(int i)
800 return (0<i && i<yy_start_stack_depth
801 ? yy_start_stack[yy_start_stack_ptr - i]
806 void print_yy_stack(char* fmt, ...)
808 int i = 0; va_list ap; va_start(ap, fmt);
809 vfprintf(stderr, fmt, ap);
810 for (i=1; i<yy_start_stack_ptr; i++)
811 fprintf(stderr, "%s/", statenames[yy_start_stack[i] ]);
812 fprintf(stderr,"%s\n", statenames[YY_START]);
816 static void debug_enter(int state, const char* statename) {
817 yy_push_state(state);
818 if (yy_flex_debug) print_yy_stack("--ENTER(%s) : ",statename);
821 static void debug_leave(void) {
822 if (yy_flex_debug) print_yy_stack("--LEAVE : ");
826 static void debug_set(int state, const char* statename) {
828 if (yy_flex_debug) print_yy_stack("--SET(%s) : ",statename);
832 enum {flexml_max_err_msg_size = 512};
834 static char flexml_err_msg[flexml_max_err_msg_size];
835 const char * parse_err_msg()
837 return flexml_err_msg;
840 static void reset_parse_err_msg()
842 flexml_err_msg[0] = '\0';
846 static int fail(const char* fmt, ...)
848 int chars_left, used;
849 va_list ap; va_start(ap, fmt);
850 #ifdef FLEXML_yylineno
851 used = sprintf(flexml_err_msg,
852 "Invalid XML (XML input line %d, state %d): ",
855 used = sprintf(flexml_err_msg,
856 "Invalid XML (state %d): ",
859 chars_left = flexml_max_err_msg_size - used - 1;
860 vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
863 #ifndef FLEXML_quiet_parser
864 /* print directly to sdterr */
865 fprintf(stderr, "%s\n", flexml_err_msg);
866 flexml_err_msg[0] = '\0';