1 /* Validating XML processor for surfxml.dtd.
2 * Generated 2005/01/27 07:41:02.
4 * This program was generated with the FleXML XML processor generator,
5 * (Id: flexml.pl,v 1.35 2005/01/05 06:29:58 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.19 2005/01/05 18:49:27 legranda Exp $";
29 const char rcs_flexml[] =
30 "$" "Id: flexml.pl,v 1.35 2005/01/05 06:29:58 legranda Exp $";
40 /* Generated definitions. */
41 #define FLEXML_yylineno
42 #define FLEXML_BUFFERSTACKSIZE 10000000
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*, ...);
99 /* Text buffer stack handling. */
100 char bufferstack[FLEXML_BUFFERSTACKSIZE];
101 char* limit = bufferstack + FLEXML_BUFFERSTACKSIZE;
102 typedef struct BufferLast_s {
103 struct BufferLast_s *old; char* saved; char new[1];
105 BufferLast* last = (BufferLast*)0;
106 char* next = bufferstack;
108 #define BUFFERSET(P) (P = next)
109 #define BUFFERPUTC(C) (assert(next<limit), *(next++) = (C))
110 #define BUFFERDONE (BUFFERPUTC('\0'))
112 #define BUFFERLITERAL(C,P) bufferliteral(C,&(P),yytext)
113 static void bufferliteral(char c, const char** pp, char* text)
115 char *s = strchr(text,c), *e = strrchr(text,c);
116 assert(s <= e); BUFFERSET(*pp);
118 if (isspace(*s)) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
124 #ifdef FLEXML_HasMixed
125 static void pushbuffer(char* p)
127 BufferLast* l = (BufferLast*)next;
128 assert(next < limit);
135 static char* popbuffer(void)
137 BufferLast* l = last;
138 assert(last != (BufferLast*)0);
145 /* General internal entities are `unput' back onto the input stream... */
146 #define ENTITYTEXT(T) \
147 { char *s = (T), *e = s+strlen(s);\
148 while (--e >= s) { unput(*e); }}
151 /* Flex standard options. */
153 %option noyy_top_state
159 /* Flex user-requested options. */
163 /* XML character classes (currently restricted to ASCII). */
165 /* "Common syntactic structures." */
169 /* "Names and Tokens." */
170 NameChar [A-Za-z0-9.:_-]
171 Name [A-Za-z_:]{NameChar}*
172 Names {Name}({S}{Name})*
173 Nmtoken ({NameChar})+
174 Nmtokens {Nmtoken}({S}{Nmtoken})*
177 VersionNum [a-zA-Z0-9_.:-]+
179 Literal \'[^'']*\'|\"[^""]*\"
181 /* Parser states (flex `exclusive start conditions'):
183 * PROLOG the XML prolog of the document before <?xml...>
184 * DOCTYPE the XML prolog of the document after <?xml...>
185 * EPILOG after the root element
186 * INCOMMENT inside an XML comment <!--....-->
187 * INPI inside an XML PI <?...?>
188 * VALUE1 inside a '...'-delimited literal
189 * VALUE2 inside a "..."-delimited literal
190 * CDATA inside a <![CDATA[...]]> section.
191 * ROOT_<tag> expect root element <tag>
192 * AL_<tag> inside the attribute list for <tag>
193 * IN_<tag> inside a <tag> with element contents (ready for end tag)
194 * IMPOSSIBLE dummy to permit disabling rules; must be last
196 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
197 %x ROOT_platform_description AL_platform_description S_platform_description S_platform_description_1 S_platform_description_2 E_platform_description
198 %x ROOT_include AL_include S_include S_include_1 S_include_2 E_include
199 %x ROOT_cpu AL_cpu E_cpu
200 %x ROOT_network_link AL_network_link E_network_link
201 %x ROOT_route AL_route S_route S_route_1 S_route_2 E_route
202 %x ROOT_route_element AL_route_element E_route_element
203 %x ROOT_process AL_process S_process S_process_1 S_process_2 E_process
204 %x ROOT_argument AL_argument E_argument
209 const char* *statenames=NULL;
214 /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
217 if(!statenames) statenames=calloc(IMPOSSIBLE,sizeof(char*));
218 statenames[PROLOG] = NULL;
219 statenames[DOCTYPE] = NULL;
220 statenames[EPILOG] = NULL;
221 statenames[INCOMMENT] = NULL;
222 statenames[INPI] = NULL;
223 statenames[VALUE1] = NULL;
224 statenames[VALUE2] = NULL;
225 statenames[CDATA] = NULL;
226 statenames[ROOT_platform_description] = NULL;
227 statenames[AL_platform_description] = NULL;
228 statenames[S_platform_description] = "platform_description";
229 statenames[S_platform_description_1] = "platform_description";
230 statenames[S_platform_description_2] = "platform_description";
231 statenames[E_platform_description] = "platform_description";
232 statenames[ROOT_include] = NULL;
233 statenames[AL_include] = NULL;
234 statenames[S_include] = "include";
235 statenames[S_include_1] = "include";
236 statenames[S_include_2] = "include";
237 statenames[E_include] = "include";
238 statenames[ROOT_cpu] = NULL;
239 statenames[AL_cpu] = NULL;
240 statenames[E_cpu] = "cpu";
241 statenames[ROOT_network_link] = NULL;
242 statenames[AL_network_link] = NULL;
243 statenames[E_network_link] = "network_link";
244 statenames[ROOT_route] = NULL;
245 statenames[AL_route] = NULL;
246 statenames[S_route] = "route";
247 statenames[S_route_1] = "route";
248 statenames[S_route_2] = "route";
249 statenames[E_route] = "route";
250 statenames[ROOT_route_element] = NULL;
251 statenames[AL_route_element] = NULL;
252 statenames[E_route_element] = "route_element";
253 statenames[ROOT_process] = NULL;
254 statenames[AL_process] = NULL;
255 statenames[S_process] = "process";
256 statenames[S_process_1] = "process";
257 statenames[S_process_2] = "process";
258 statenames[E_process] = "process";
259 statenames[ROOT_argument] = NULL;
260 statenames[AL_argument] = NULL;
261 statenames[E_argument] = "argument";
263 /* COMMENTS and PIs: handled uniformly for efficiency. */
265 <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>{
266 "<!--" ENTER(INCOMMENT);
274 <<EOF>> FAIL("EOF in comment.");
280 <<EOF>> FAIL("EOF in PI (processing instruction).");
283 /* SPACES: skipped uniformly */
285 <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;
287 /* PROLOG: determine root element and process it. */
290 "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?"?>" SET(DOCTYPE);
291 "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
295 "<!DOCTYPE"{S}"argument"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_argument);
296 "<!DOCTYPE"{S}"route_element"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route_element);
297 "<!DOCTYPE"{S}"cpu"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_cpu);
298 "<!DOCTYPE"{S}"include"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_include);
299 "<!DOCTYPE"{S}"route"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route);
300 "<!DOCTYPE"{S}"platform_description"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_platform_description);
301 "<!DOCTYPE"{S}"network_link"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_network_link);
302 "<!DOCTYPE"{S}"process"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_process);
303 "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
304 . FAIL("Unexpected character `%c' in prolog.", yytext[0]);
305 <<EOF>> FAIL("EOF in prolog.");
308 /* RULES DERIVED FROM DTD. */
310 /* <!-- Small DTD for SURF based tools. --> */
312 <ROOT_platform_description>"<platform_description"{s} {
313 ENTER(AL_platform_description);
316 <AL_platform_description>{
318 LEAVE; STag_platform_description();pcdata = NULL; ENTER(S_platform_description);
321 LEAVE; STag_platform_description(); pcdata = NULL; ETag_platform_description();
323 case ROOT_platform_description: SET(EPILOG); break;
326 . FAIL("Unexpected character `%c' in attribute list of platform_description element.", yytext[0]);
327 {Name} FAIL("Bad attribute `%s' in `platform_description' element start tag.",yytext);
328 <<EOF>> FAIL("EOF in attribute list of `platform_description' element.");
331 <E_platform_description,S_platform_description_2,S_platform_description>{
332 "</platform_description"{s}">" {
334 ETag_platform_description();
336 case ROOT_platform_description: SET(EPILOG); break;
339 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</platform_description>' expected.",yytext);
340 . FAIL("Unexpected character `%c': `</platform_description>' expected.",yytext[0]);
341 <<EOF>> FAIL("Premature EOF: `</platform_description>' expected.");
344 <ROOT_include,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<include"{s} {
345 A_include_file = NULL;
350 "file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_include_file);
351 "file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_include_file);
354 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
355 LEAVE; STag_include();pcdata = NULL; ENTER(S_include);
358 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
359 LEAVE; STag_include(); pcdata = NULL; ETag_include();
361 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
362 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
363 case ROOT_include: SET(EPILOG); break;
366 . FAIL("Unexpected character `%c' in attribute list of include element.", yytext[0]);
367 {Name} FAIL("Bad attribute `%s' in `include' element start tag.",yytext);
368 <<EOF>> FAIL("EOF in attribute list of `include' element.");
371 <E_include,S_include,S_include_2>{
376 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
377 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
378 case ROOT_include: SET(EPILOG); break;
381 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</include>' expected.",yytext);
382 . FAIL("Unexpected character `%c': `</include>' expected.",yytext[0]);
383 <<EOF>> FAIL("Premature EOF: `</include>' expected.");
386 <ROOT_cpu,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<cpu"{s} {
389 A_cpu_availability = "1.0";
390 A_cpu_availability_file = NULL;
391 A_cpu_state = A_cpu_state_ON;
392 A_cpu_state_file = NULL;
393 A_cpu_interference_send = "1.0";
394 A_cpu_interference_recv = "1.0";
395 A_cpu_interference_send_recv = "1.0";
396 A_cpu_max_outgoing_rate = "-1.0";
401 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_name);
402 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_name);
404 "power"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_power);
405 "power"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_power);
407 "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability);
408 "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability);
410 "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability_file);
411 "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability_file);
414 "state"{Eq}"\"ON\"" A_cpu_state = A_cpu_state_ON;
416 "state"{Eq}"\"OFF\"" A_cpu_state = A_cpu_state_OFF;
418 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_state_file);
419 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_state_file);
421 "interference_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send);
422 "interference_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send);
424 "interference_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_recv);
425 "interference_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_recv);
427 "interference_send_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send_recv);
428 "interference_send_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send_recv);
430 "max_outgoing_rate"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_max_outgoing_rate);
431 "max_outgoing_rate"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_max_outgoing_rate);
434 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
435 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
436 LEAVE; STag_cpu();pcdata = NULL; ENTER(E_cpu);
439 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
440 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
441 LEAVE; STag_cpu(); pcdata = NULL; ETag_cpu();
443 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
444 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
445 case ROOT_cpu: SET(EPILOG); break;
448 . FAIL("Unexpected character `%c' in attribute list of cpu element.", yytext[0]);
449 {Name} FAIL("Bad attribute `%s' in `cpu' element start tag.",yytext);
450 <<EOF>> FAIL("EOF in attribute list of `cpu' element.");
458 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
459 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
460 case ROOT_cpu: SET(EPILOG); break;
463 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</cpu>' expected.",yytext);
464 . FAIL("Unexpected character `%c': `</cpu>' expected.",yytext[0]);
465 <<EOF>> FAIL("Premature EOF: `</cpu>' expected.");
468 <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} {
469 A_network_link_name = NULL;
470 A_network_link_bandwidth = NULL;
471 A_network_link_bandwidth_file = NULL;
472 A_network_link_latency = "0.0";
473 A_network_link_latency_file = NULL;
474 A_network_link_state = A_network_link_state_ON;
475 A_network_link_state_file = NULL;
476 ENTER(AL_network_link);
480 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_name);
481 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_name);
483 "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth);
484 "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth);
486 "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth_file);
487 "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth_file);
489 "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency);
490 "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency);
492 "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency_file);
493 "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency_file);
496 "state"{Eq}"\"ON\"" A_network_link_state = A_network_link_state_ON;
498 "state"{Eq}"\"OFF\"" A_network_link_state = A_network_link_state_OFF;
500 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_state_file);
501 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_state_file);
504 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
505 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
506 LEAVE; STag_network_link();pcdata = NULL; ENTER(E_network_link);
509 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
510 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
511 LEAVE; STag_network_link(); pcdata = NULL; ETag_network_link();
513 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
514 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
515 case ROOT_network_link: SET(EPILOG); break;
518 . FAIL("Unexpected character `%c' in attribute list of network_link element.", yytext[0]);
519 {Name} FAIL("Bad attribute `%s' in `network_link' element start tag.",yytext);
520 <<EOF>> FAIL("EOF in attribute list of `network_link' element.");
524 "</network_link"{s}">" {
528 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
529 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
530 case ROOT_network_link: SET(EPILOG); break;
533 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</network_link>' expected.",yytext);
534 . FAIL("Unexpected character `%c': `</network_link>' expected.",yytext[0]);
535 <<EOF>> FAIL("Premature EOF: `</network_link>' expected.");
538 <ROOT_route,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<route"{s} {
541 A_route_impact_on_src = "0.0";
542 A_route_impact_on_dst = "0.0";
543 A_route_impact_on_src_with_other_recv = "0.0";
544 A_route_impact_on_dst_with_other_send = "0.0";
549 "src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_src);
550 "src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_src);
552 "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_dst);
553 "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_dst);
555 "impact_on_src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src);
556 "impact_on_src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src);
558 "impact_on_dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst);
559 "impact_on_dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst);
561 "impact_on_src_with_other_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src_with_other_recv);
562 "impact_on_src_with_other_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src_with_other_recv);
564 "impact_on_dst_with_other_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst_with_other_send);
565 "impact_on_dst_with_other_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst_with_other_send);
568 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
569 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
570 LEAVE; STag_route();pcdata = NULL; ENTER(S_route);
573 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
574 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
575 LEAVE; STag_route(); pcdata = NULL; ETag_route();
577 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
578 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
579 case ROOT_route: SET(EPILOG); break;
582 . FAIL("Unexpected character `%c' in attribute list of route element.", yytext[0]);
583 {Name} FAIL("Bad attribute `%s' in `route' element start tag.",yytext);
584 <<EOF>> FAIL("EOF in attribute list of `route' element.");
587 <S_route,S_route_2,E_route>{
592 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
593 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
594 case ROOT_route: SET(EPILOG); break;
597 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route>' expected.",yytext);
598 . FAIL("Unexpected character `%c': `</route>' expected.",yytext[0]);
599 <<EOF>> FAIL("Premature EOF: `</route>' expected.");
602 <ROOT_route_element,S_route_1,S_route,S_route_2>"<route_element"{s} {
603 A_route_element_name = NULL;
604 ENTER(AL_route_element);
608 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_element_name);
609 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_element_name);
612 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
613 LEAVE; STag_route_element();pcdata = NULL; ENTER(E_route_element);
616 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
617 LEAVE; STag_route_element(); pcdata = NULL; ETag_route_element();
619 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
620 case ROOT_route_element: SET(EPILOG); break;
623 . FAIL("Unexpected character `%c' in attribute list of route_element element.", yytext[0]);
624 {Name} FAIL("Bad attribute `%s' in `route_element' element start tag.",yytext);
625 <<EOF>> FAIL("EOF in attribute list of `route_element' element.");
629 "</route_element"{s}">" {
631 ETag_route_element();
633 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
634 case ROOT_route_element: SET(EPILOG); break;
637 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route_element>' expected.",yytext);
638 . FAIL("Unexpected character `%c': `</route_element>' expected.",yytext[0]);
639 <<EOF>> FAIL("Premature EOF: `</route_element>' expected.");
642 <ROOT_process,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<process"{s} {
643 A_process_host = NULL;
644 A_process_function = NULL;
649 "host"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_host);
650 "host"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_host);
652 "function"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_function);
653 "function"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_function);
656 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
657 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
658 LEAVE; STag_process();pcdata = NULL; ENTER(S_process);
661 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
662 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
663 LEAVE; STag_process(); pcdata = NULL; ETag_process();
665 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
666 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
667 case ROOT_process: SET(EPILOG); break;
670 . FAIL("Unexpected character `%c' in attribute list of process element.", yytext[0]);
671 {Name} FAIL("Bad attribute `%s' in `process' element start tag.",yytext);
672 <<EOF>> FAIL("EOF in attribute list of `process' element.");
675 <S_process,E_process,S_process_2>{
680 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
681 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
682 case ROOT_process: SET(EPILOG); break;
685 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</process>' expected.",yytext);
686 . FAIL("Unexpected character `%c': `</process>' expected.",yytext[0]);
687 <<EOF>> FAIL("Premature EOF: `</process>' expected.");
690 <ROOT_argument,S_process_1,S_process,S_process_2>"<argument"{s} {
691 A_argument_value = NULL;
696 "value"{Eq}\' ENTER(VALUE1); BUFFERSET(A_argument_value);
697 "value"{Eq}\" ENTER(VALUE2); BUFFERSET(A_argument_value);
700 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
701 LEAVE; STag_argument();pcdata = NULL; ENTER(E_argument);
704 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
705 LEAVE; STag_argument(); pcdata = NULL; ETag_argument();
707 case ROOT_argument: SET(EPILOG); break;
708 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
711 . FAIL("Unexpected character `%c' in attribute list of argument element.", yytext[0]);
712 {Name} FAIL("Bad attribute `%s' in `argument' element start tag.",yytext);
713 <<EOF>> FAIL("EOF in attribute list of `argument' element.");
721 case ROOT_argument: SET(EPILOG); break;
722 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
725 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</argument>' expected.",yytext);
726 . FAIL("Unexpected character `%c': `</argument>' expected.",yytext[0]);
727 <<EOF>> FAIL("Premature EOF: `</argument>' expected.");
730 /* EPILOG: after the root element. */
733 . FAIL("Unexpected character `%c' after document.", yytext[0]);
737 /* CHARACTER DATA. */
739 <IMPOSSIBLE,VALUE1,VALUE2>{
740 /* Non-defined standard entities... */
741 "&" BUFFERPUTC('&');
742 "<" BUFFERPUTC('<');
743 ">" BUFFERPUTC('>');
744 "'" BUFFERPUTC('\'');
745 """ BUFFERPUTC('"');
747 /* Character entities. */
748 "&#"[[:digit:]]+";" BUFFERPUTC((unsigned char)atoi(yytext+2));
749 "&#x"[[:xdigit:]]+";" BUFFERPUTC((unsigned char)strtol(yytext+3,NULL,16));
752 <IMPOSSIBLE,VALUE1,VALUE2,CDATA>{
756 "\n\r" BUFFERPUTC('\n');
760 "<![CDATA[" ENTER(CDATA);
761 "]""]>" FAIL("Unexpected `]""]>' in character data.");
765 \' BUFFERDONE; LEAVE;
766 <<EOF>> FAIL("EOF in literal (\"'\" expected).");
770 \" BUFFERDONE; LEAVE;
771 <<EOF>> FAIL("EOF in literal (`\"' expected).");
774 <IMPOSSIBLE,VALUE1,VALUE2>{
775 [^<&] BUFFERPUTC(yytext[0]);
776 [<&] FAIL("Spurious `%c' in character data.",yytext[0]);
781 "]""]" BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]);
782 . BUFFERPUTC(yytext[0]);
783 <<EOF>> FAIL("EOF in CDATA section.");
786 /* Impossible rules to avoid warnings from flex(1). */
788 <INITIAL,IMPOSSIBLE>{
789 .|[\n] FAIL("The Impossible Happened: INITIAL or IMPOSSIBLE state entered?");
794 /* Element context stack lookup. */
795 int element_context(int i)
797 return (0<i && i<yy_start_stack_depth
798 ? yy_start_stack[yy_start_stack_ptr - i]
803 void print_yy_stack(char* fmt, ...)
805 int i = 0; va_list ap; va_start(ap, fmt);
806 vfprintf(stderr, fmt, ap);
807 for (i=1; i<yy_start_stack_ptr; i++)
808 fprintf(stderr, "%s/", statenames[yy_start_stack[i] ]);
809 fprintf(stderr,"%s\n", statenames[YY_START]);
813 static void debug_enter(int state, const char* statename) {
814 yy_push_state(state);
815 if (yy_flex_debug) print_yy_stack("--ENTER(%s) : ",statename);
818 static void debug_leave(void) {
819 if (yy_flex_debug) print_yy_stack("--LEAVE : ");
823 static void debug_set(int state, const char* statename) {
825 if (yy_flex_debug) print_yy_stack("--SET(%s) : ",statename);
830 static int fail(const char* fmt, ...)
832 va_list ap; va_start(ap, fmt);
833 #ifdef FLEXML_yylineno
834 fprintf(stderr, "Invalid XML (XML input line %d, state %d): ", yylineno, YY_START);
836 fprintf(stderr, "Invalid XML (state %d): ",YY_START);
838 vfprintf(stderr, fmt, ap);
839 fprintf(stderr, "\n");