1 /* Validating XML processor for surfxml.dtd.
2 * Generated 2005/02/10 12:28:10.
4 * This program was generated with the FleXML XML processor generator,
5 * (Id: flexml.pl,v 1.38 2005/02/10 11:13:51 mquinson 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.22 2005/02/10 11:18:26 mquinson Exp $";
29 const char rcs_flexml[] =
30 "$" "Id: flexml.pl,v 1.38 2005/02/10 11:13:51 mquinson Exp $";
40 /* Generated definitions. */
41 #define FLEXML_yylineno
42 #define FLEXML_BUFFERSTACKSIZE 100000
44 /* XML processor api. */
45 /* FleXML-provided data. */
47 AT_network_link_bandwidth A_network_link_bandwidth;
48 AT_cpu_name A_cpu_name;
49 AT_network_link_state A_network_link_state;
50 AT_argument_value A_argument_value;
51 AT_cpu_availability_file A_cpu_availability_file;
52 AT_process_host A_process_host;
53 AT_route_impact_on_src A_route_impact_on_src;
54 AT_route_src A_route_src;
55 AT_network_link_latency_file A_network_link_latency_file;
56 AT_cpu_max_outgoing_rate A_cpu_max_outgoing_rate;
57 AT_route_impact_on_dst_with_other_send A_route_impact_on_dst_with_other_send;
58 AT_cpu_interference_send_recv A_cpu_interference_send_recv;
59 AT_cpu_availability A_cpu_availability;
60 AT_route_impact_on_dst A_route_impact_on_dst;
61 AT_cpu_interference_recv A_cpu_interference_recv;
62 AT_route_impact_on_src_with_other_recv A_route_impact_on_src_with_other_recv;
63 AT_network_link_name A_network_link_name;
64 AT_route_element_name A_route_element_name;
65 AT_cpu_power A_cpu_power;
66 AT_include_file A_include_file;
67 AT_process_function A_process_function;
68 AT_route_dst A_route_dst;
69 AT_cpu_state A_cpu_state;
70 AT_network_link_latency A_network_link_latency;
71 AT_network_link_state_file A_network_link_state_file;
72 AT_cpu_interference_send A_cpu_interference_send;
73 AT_cpu_state_file A_cpu_state_file;
74 AT_network_link_bandwidth_file A_network_link_bandwidth_file;
78 # define ENTER(state) debug_enter(state,#state)
79 # define LEAVE debug_leave()
80 # define SET(state) debug_set(state,#state)
81 static void debug_enter(int, const char*);
82 static void debug_leave(void);
83 static void debug_set(int, const char*);
85 # define ENTER(state) (yy_push_state(state))
86 # define LEAVE (yy_pop_state())
87 # define SET(state) BEGIN(state)
90 /* Generic actions. */
92 #define SUCCEED return 0
94 #define FAIL return fail
95 static int fail(const char*, ...);
96 const char * parse_err_msg(void);
98 /* Text buffer stack handling. */
99 char bufferstack[FLEXML_BUFFERSTACKSIZE];
100 char* limit = bufferstack + FLEXML_BUFFERSTACKSIZE;
101 typedef struct BufferLast_s {
102 struct BufferLast_s *old; char* saved; char new1[1];
104 BufferLast* last = (BufferLast*)0;
105 char* next = bufferstack;
107 #define BUFFERSET(P) (P = next)
108 #define BUFFERPUTC(C) (assert(next<limit), *(next++) = (C))
109 #define BUFFERDONE (BUFFERPUTC('\0'))
111 #define BUFFERLITERAL(C,P) bufferliteral(C,&(P),yytext)
112 static void bufferliteral(char c, const char** pp, char* text)
114 char *s = strchr(text,c), *e = strrchr(text,c);
115 assert(s <= e); BUFFERSET(*pp);
117 if (isspace(*s)) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
123 #ifdef FLEXML_HasMixed
124 static void pushbuffer(char* p)
126 BufferLast* l = (BufferLast*)next;
127 assert(next < limit);
134 static char* popbuffer(void)
136 BufferLast* l = last;
137 assert(last != (BufferLast*)0);
144 /* General internal entities are `unput' back onto the input stream... */
145 #define ENTITYTEXT(T) \
146 { char *s = (T), *e = s+strlen(s);\
147 while (--e >= s) { unput(*e); }}
150 /* Flex standard options. */
152 %option noyy_top_state
158 /* Flex user-requested options. */
162 /* XML character classes (currently restricted to ASCII). */
164 /* "Common syntactic structures." */
168 /* "Names and Tokens." */
169 NameChar [A-Za-z0-9.:_-]
170 Name [A-Za-z_:]{NameChar}*
171 Names {Name}({S}{Name})*
172 Nmtoken ({NameChar})+
173 Nmtokens {Nmtoken}({S}{Nmtoken})*
176 VersionNum [a-zA-Z0-9_.:-]+
178 Literal \'[^'']*\'|\"[^""]*\"
180 /* Parser states (flex `exclusive start conditions'):
182 * PROLOG the XML prolog of the document before <?xml...>
183 * DOCTYPE the XML prolog of the document after <?xml...>
184 * EPILOG after the root element
185 * INCOMMENT inside an XML comment <!--....-->
186 * INPI inside an XML PI <?...?>
187 * VALUE1 inside a '...'-delimited literal
188 * VALUE2 inside a "..."-delimited literal
189 * CDATA inside a <![CDATA[...]]> section.
190 * ROOT_<tag> expect root element <tag>
191 * AL_<tag> inside the attribute list for <tag>
192 * IN_<tag> inside a <tag> with element contents (ready for end tag)
193 * IMPOSSIBLE dummy to permit disabling rules; must be last
195 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
196 %x ROOT_platform_description AL_platform_description S_platform_description S_platform_description_1 S_platform_description_2 E_platform_description
197 %x ROOT_include AL_include S_include S_include_1 S_include_2 E_include
198 %x ROOT_cpu AL_cpu E_cpu
199 %x ROOT_network_link AL_network_link E_network_link
200 %x ROOT_route AL_route S_route S_route_1 S_route_2 E_route
201 %x ROOT_route_element AL_route_element E_route_element
202 %x ROOT_process AL_process S_process S_process_1 S_process_2 E_process
203 %x ROOT_argument AL_argument E_argument
208 const char* *statenames=NULL;
213 /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
216 if(!statenames) statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
217 statenames[PROLOG] = NULL;
218 statenames[DOCTYPE] = NULL;
219 statenames[EPILOG] = NULL;
220 statenames[INCOMMENT] = NULL;
221 statenames[INPI] = NULL;
222 statenames[VALUE1] = NULL;
223 statenames[VALUE2] = NULL;
224 statenames[CDATA] = NULL;
225 statenames[ROOT_platform_description] = NULL;
226 statenames[AL_platform_description] = NULL;
227 statenames[S_platform_description] = "platform_description";
228 statenames[S_platform_description_1] = "platform_description";
229 statenames[S_platform_description_2] = "platform_description";
230 statenames[E_platform_description] = "platform_description";
231 statenames[ROOT_include] = NULL;
232 statenames[AL_include] = NULL;
233 statenames[S_include] = "include";
234 statenames[S_include_1] = "include";
235 statenames[S_include_2] = "include";
236 statenames[E_include] = "include";
237 statenames[ROOT_cpu] = NULL;
238 statenames[AL_cpu] = NULL;
239 statenames[E_cpu] = "cpu";
240 statenames[ROOT_network_link] = NULL;
241 statenames[AL_network_link] = NULL;
242 statenames[E_network_link] = "network_link";
243 statenames[ROOT_route] = NULL;
244 statenames[AL_route] = NULL;
245 statenames[S_route] = "route";
246 statenames[S_route_1] = "route";
247 statenames[S_route_2] = "route";
248 statenames[E_route] = "route";
249 statenames[ROOT_route_element] = NULL;
250 statenames[AL_route_element] = NULL;
251 statenames[E_route_element] = "route_element";
252 statenames[ROOT_process] = NULL;
253 statenames[AL_process] = NULL;
254 statenames[S_process] = "process";
255 statenames[S_process_1] = "process";
256 statenames[S_process_2] = "process";
257 statenames[E_process] = "process";
258 statenames[ROOT_argument] = NULL;
259 statenames[AL_argument] = NULL;
260 statenames[E_argument] = "argument";
262 /* COMMENTS and PIs: handled uniformly for efficiency. */
264 <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>{
265 "<!--" ENTER(INCOMMENT);
273 <<EOF>> FAIL("EOF in comment.");
279 <<EOF>> FAIL("EOF in PI (processing instruction).");
282 /* SPACES: skipped uniformly */
284 <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;
286 /* PROLOG: determine root element and process it. */
289 "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?({S}encoding{Eq}(\'[^']*\'|\"[^"]*\"))?"?>" SET(DOCTYPE);
290 "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
294 "<!DOCTYPE"{S}"argument"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_argument);
295 "<!DOCTYPE"{S}"route_element"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route_element);
296 "<!DOCTYPE"{S}"cpu"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_cpu);
297 "<!DOCTYPE"{S}"include"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_include);
298 "<!DOCTYPE"{S}"route"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_route);
299 "<!DOCTYPE"{S}"platform_description"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_platform_description);
300 "<!DOCTYPE"{S}"network_link"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_network_link);
301 "<!DOCTYPE"{S}"process"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_process);
302 "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
303 . FAIL("Unexpected character `%c' in prolog.", yytext[0]);
304 <<EOF>> FAIL("EOF in prolog.");
307 /* RULES DERIVED FROM DTD. */
309 /* <!-- Small DTD for SURF based tools. --> */
311 <ROOT_platform_description>"<platform_description"{s} {
312 ENTER(AL_platform_description);
315 <AL_platform_description>{
317 LEAVE; STag_platform_description();pcdata = NULL; ENTER(S_platform_description);
320 LEAVE; STag_platform_description(); pcdata = NULL; ETag_platform_description();
322 case ROOT_platform_description: SET(EPILOG); break;
325 . FAIL("Unexpected character `%c' in attribute list of platform_description element.", yytext[0]);
326 {Name} FAIL("Bad attribute `%s' in `platform_description' element start tag.",yytext);
327 <<EOF>> FAIL("EOF in attribute list of `platform_description' element.");
330 <E_platform_description,S_platform_description_2,S_platform_description>{
331 "</platform_description"{s}">" {
333 ETag_platform_description();
335 case ROOT_platform_description: SET(EPILOG); break;
338 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</platform_description>' expected.",yytext);
339 . FAIL("Unexpected character `%c': `</platform_description>' expected.",yytext[0]);
340 <<EOF>> FAIL("Premature EOF: `</platform_description>' expected.");
343 <ROOT_include,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<include"{s} {
344 A_include_file = NULL;
349 "file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_include_file);
350 "file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_include_file);
353 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
354 LEAVE; STag_include();pcdata = NULL; ENTER(S_include);
357 if (!A_include_file) FAIL("Required attribute `file' not set for `include' element.");
358 LEAVE; STag_include(); pcdata = NULL; ETag_include();
360 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
361 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
362 case ROOT_include: SET(EPILOG); break;
365 . FAIL("Unexpected character `%c' in attribute list of include element.", yytext[0]);
366 {Name} FAIL("Bad attribute `%s' in `include' element start tag.",yytext);
367 <<EOF>> FAIL("EOF in attribute list of `include' element.");
370 <E_include,S_include,S_include_2>{
375 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
376 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
377 case ROOT_include: SET(EPILOG); break;
380 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</include>' expected.",yytext);
381 . FAIL("Unexpected character `%c': `</include>' expected.",yytext[0]);
382 <<EOF>> FAIL("Premature EOF: `</include>' expected.");
385 <ROOT_cpu,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<cpu"{s} {
388 A_cpu_availability = "1.0";
389 A_cpu_availability_file = NULL;
390 A_cpu_state = A_cpu_state_ON;
391 A_cpu_state_file = NULL;
392 A_cpu_interference_send = "1.0";
393 A_cpu_interference_recv = "1.0";
394 A_cpu_interference_send_recv = "1.0";
395 A_cpu_max_outgoing_rate = "-1.0";
400 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_name);
401 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_name);
403 "power"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_power);
404 "power"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_power);
406 "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability);
407 "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability);
409 "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_availability_file);
410 "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_availability_file);
413 "state"{Eq}"\"ON\"" A_cpu_state = A_cpu_state_ON;
415 "state"{Eq}"\"OFF\"" A_cpu_state = A_cpu_state_OFF;
417 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_state_file);
418 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_state_file);
420 "interference_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send);
421 "interference_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send);
423 "interference_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_recv);
424 "interference_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_recv);
426 "interference_send_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_interference_send_recv);
427 "interference_send_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_interference_send_recv);
429 "max_outgoing_rate"{Eq}\' ENTER(VALUE1); BUFFERSET(A_cpu_max_outgoing_rate);
430 "max_outgoing_rate"{Eq}\" ENTER(VALUE2); BUFFERSET(A_cpu_max_outgoing_rate);
433 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
434 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
435 LEAVE; STag_cpu();pcdata = NULL; ENTER(E_cpu);
438 if (!A_cpu_name) FAIL("Required attribute `name' not set for `cpu' element.");
439 if (!A_cpu_power) FAIL("Required attribute `power' not set for `cpu' element.");
440 LEAVE; STag_cpu(); pcdata = NULL; ETag_cpu();
442 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
443 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
444 case ROOT_cpu: SET(EPILOG); break;
447 . FAIL("Unexpected character `%c' in attribute list of cpu element.", yytext[0]);
448 {Name} FAIL("Bad attribute `%s' in `cpu' element start tag.",yytext);
449 <<EOF>> FAIL("EOF in attribute list of `cpu' element.");
457 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
458 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
459 case ROOT_cpu: SET(EPILOG); break;
462 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</cpu>' expected.",yytext);
463 . FAIL("Unexpected character `%c': `</cpu>' expected.",yytext[0]);
464 <<EOF>> FAIL("Premature EOF: `</cpu>' expected.");
467 <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} {
468 A_network_link_name = NULL;
469 A_network_link_bandwidth = NULL;
470 A_network_link_bandwidth_file = NULL;
471 A_network_link_latency = "0.0";
472 A_network_link_latency_file = NULL;
473 A_network_link_state = A_network_link_state_ON;
474 A_network_link_state_file = NULL;
475 ENTER(AL_network_link);
479 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_name);
480 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_name);
482 "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth);
483 "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth);
485 "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_bandwidth_file);
486 "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_bandwidth_file);
488 "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency);
489 "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency);
491 "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_latency_file);
492 "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_latency_file);
495 "state"{Eq}"\"ON\"" A_network_link_state = A_network_link_state_ON;
497 "state"{Eq}"\"OFF\"" A_network_link_state = A_network_link_state_OFF;
499 "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(A_network_link_state_file);
500 "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(A_network_link_state_file);
503 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
504 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
505 LEAVE; STag_network_link();pcdata = NULL; ENTER(E_network_link);
508 if (!A_network_link_name) FAIL("Required attribute `name' not set for `network_link' element.");
509 if (!A_network_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `network_link' element.");
510 LEAVE; STag_network_link(); pcdata = NULL; ETag_network_link();
512 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
513 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
514 case ROOT_network_link: SET(EPILOG); break;
517 . FAIL("Unexpected character `%c' in attribute list of network_link element.", yytext[0]);
518 {Name} FAIL("Bad attribute `%s' in `network_link' element start tag.",yytext);
519 <<EOF>> FAIL("EOF in attribute list of `network_link' element.");
523 "</network_link"{s}">" {
527 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
528 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
529 case ROOT_network_link: SET(EPILOG); break;
532 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</network_link>' expected.",yytext);
533 . FAIL("Unexpected character `%c': `</network_link>' expected.",yytext[0]);
534 <<EOF>> FAIL("Premature EOF: `</network_link>' expected.");
537 <ROOT_route,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<route"{s} {
540 A_route_impact_on_src = "0.0";
541 A_route_impact_on_dst = "0.0";
542 A_route_impact_on_src_with_other_recv = "0.0";
543 A_route_impact_on_dst_with_other_send = "0.0";
548 "src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_src);
549 "src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_src);
551 "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_dst);
552 "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_dst);
554 "impact_on_src"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src);
555 "impact_on_src"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src);
557 "impact_on_dst"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst);
558 "impact_on_dst"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst);
560 "impact_on_src_with_other_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_src_with_other_recv);
561 "impact_on_src_with_other_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_src_with_other_recv);
563 "impact_on_dst_with_other_send"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_impact_on_dst_with_other_send);
564 "impact_on_dst_with_other_send"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_impact_on_dst_with_other_send);
567 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
568 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
569 LEAVE; STag_route();pcdata = NULL; ENTER(S_route);
572 if (!A_route_src) FAIL("Required attribute `src' not set for `route' element.");
573 if (!A_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
574 LEAVE; STag_route(); pcdata = NULL; ETag_route();
576 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
577 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
578 case ROOT_route: SET(EPILOG); break;
581 . FAIL("Unexpected character `%c' in attribute list of route element.", yytext[0]);
582 {Name} FAIL("Bad attribute `%s' in `route' element start tag.",yytext);
583 <<EOF>> FAIL("EOF in attribute list of `route' element.");
586 <S_route,S_route_2,E_route>{
591 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
592 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
593 case ROOT_route: SET(EPILOG); break;
596 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route>' expected.",yytext);
597 . FAIL("Unexpected character `%c': `</route>' expected.",yytext[0]);
598 <<EOF>> FAIL("Premature EOF: `</route>' expected.");
601 <ROOT_route_element,S_route_1,S_route,S_route_2>"<route_element"{s} {
602 A_route_element_name = NULL;
603 ENTER(AL_route_element);
607 "name"{Eq}\' ENTER(VALUE1); BUFFERSET(A_route_element_name);
608 "name"{Eq}\" ENTER(VALUE2); BUFFERSET(A_route_element_name);
611 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
612 LEAVE; STag_route_element();pcdata = NULL; ENTER(E_route_element);
615 if (!A_route_element_name) FAIL("Required attribute `name' not set for `route_element' element.");
616 LEAVE; STag_route_element(); pcdata = NULL; ETag_route_element();
618 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
619 case ROOT_route_element: SET(EPILOG); break;
622 . FAIL("Unexpected character `%c' in attribute list of route_element element.", yytext[0]);
623 {Name} FAIL("Bad attribute `%s' in `route_element' element start tag.",yytext);
624 <<EOF>> FAIL("EOF in attribute list of `route_element' element.");
628 "</route_element"{s}">" {
630 ETag_route_element();
632 case S_route_1: case S_route: case S_route_2: SET(S_route_2); break;
633 case ROOT_route_element: SET(EPILOG); break;
636 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route_element>' expected.",yytext);
637 . FAIL("Unexpected character `%c': `</route_element>' expected.",yytext[0]);
638 <<EOF>> FAIL("Premature EOF: `</route_element>' expected.");
641 <ROOT_process,S_platform_description_2,S_include,S_include_2,S_platform_description_1,S_include_1,S_platform_description>"<process"{s} {
642 A_process_host = NULL;
643 A_process_function = NULL;
648 "host"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_host);
649 "host"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_host);
651 "function"{Eq}\' ENTER(VALUE1); BUFFERSET(A_process_function);
652 "function"{Eq}\" ENTER(VALUE2); BUFFERSET(A_process_function);
655 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
656 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
657 LEAVE; STag_process();pcdata = NULL; ENTER(S_process);
660 if (!A_process_host) FAIL("Required attribute `host' not set for `process' element.");
661 if (!A_process_function) FAIL("Required attribute `function' not set for `process' element.");
662 LEAVE; STag_process(); pcdata = NULL; ETag_process();
664 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
665 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
666 case ROOT_process: SET(EPILOG); break;
669 . FAIL("Unexpected character `%c' in attribute list of process element.", yytext[0]);
670 {Name} FAIL("Bad attribute `%s' in `process' element start tag.",yytext);
671 <<EOF>> FAIL("EOF in attribute list of `process' element.");
674 <S_process,E_process,S_process_2>{
679 case S_platform_description_2: case S_platform_description_1: case S_platform_description: SET(S_platform_description_2); break;
680 case S_include: case S_include_2: case S_include_1: SET(S_include_2); break;
681 case ROOT_process: SET(EPILOG); break;
684 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</process>' expected.",yytext);
685 . FAIL("Unexpected character `%c': `</process>' expected.",yytext[0]);
686 <<EOF>> FAIL("Premature EOF: `</process>' expected.");
689 <ROOT_argument,S_process_1,S_process,S_process_2>"<argument"{s} {
690 A_argument_value = NULL;
695 "value"{Eq}\' ENTER(VALUE1); BUFFERSET(A_argument_value);
696 "value"{Eq}\" ENTER(VALUE2); BUFFERSET(A_argument_value);
699 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
700 LEAVE; STag_argument();pcdata = NULL; ENTER(E_argument);
703 if (!A_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
704 LEAVE; STag_argument(); pcdata = NULL; ETag_argument();
706 case ROOT_argument: SET(EPILOG); break;
707 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
710 . FAIL("Unexpected character `%c' in attribute list of argument element.", yytext[0]);
711 {Name} FAIL("Bad attribute `%s' in `argument' element start tag.",yytext);
712 <<EOF>> FAIL("EOF in attribute list of `argument' element.");
720 case ROOT_argument: SET(EPILOG); break;
721 case S_process_1: case S_process: case S_process_2: SET(S_process_2); break;
724 "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</argument>' expected.",yytext);
725 . FAIL("Unexpected character `%c': `</argument>' expected.",yytext[0]);
726 <<EOF>> FAIL("Premature EOF: `</argument>' expected.");
729 /* EPILOG: after the root element. */
732 . {SET(PROLOG); yyless(0); return -1;}
736 /* CHARACTER DATA. */
738 <IMPOSSIBLE,VALUE1,VALUE2>{
739 /* Non-defined standard entities... */
740 "&" BUFFERPUTC('&');
741 "<" BUFFERPUTC('<');
742 ">" BUFFERPUTC('>');
743 "'" BUFFERPUTC('\'');
744 """ BUFFERPUTC('"');
746 /* Character entities. */
747 "&#"[[:digit:]]+";" BUFFERPUTC((unsigned char)atoi(yytext+2));
748 "&#x"[[:xdigit:]]+";" BUFFERPUTC((unsigned char)strtol(yytext+3,NULL,16));
751 <IMPOSSIBLE,VALUE1,VALUE2,CDATA>{
755 "\n\r" BUFFERPUTC('\n');
759 "<![CDATA[" ENTER(CDATA);
760 "]""]>" FAIL("Unexpected `]""]>' in character data.");
764 \' BUFFERDONE; LEAVE;
765 <<EOF>> FAIL("EOF in literal (\"'\" expected).");
769 \" BUFFERDONE; LEAVE;
770 <<EOF>> FAIL("EOF in literal (`\"' expected).");
773 <IMPOSSIBLE,VALUE1,VALUE2>{
774 [^<&] BUFFERPUTC(yytext[0]);
775 [<&] FAIL("Spurious `%c' in character data.",yytext[0]);
780 /* "]""]" BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]); */
781 . BUFFERPUTC(yytext[0]);
782 <<EOF>> FAIL("EOF in CDATA section.");
785 /* Impossible rules to avoid warnings from flex(1). */
786 /* Ideally, this should be replaced by code in flexml.pl that
787 generates just the states not covered by other rules. */
789 .|[\n] FAIL("Syntax error on character `%c'.", yytext[0]);
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);
829 enum {flexml_max_err_msg_size = 512};
831 static char flexml_err_msg[flexml_max_err_msg_size];
832 const char * parse_err_msg()
834 return flexml_err_msg;
837 static void reset_parse_err_msg()
839 flexml_err_msg[0] = '\0';
843 static int fail(const char* fmt, ...)
845 int chars_left, used;
846 va_list ap; va_start(ap, fmt);
847 #ifdef FLEXML_yylineno
848 used = sprintf(flexml_err_msg,
849 "Invalid XML (XML input line %d, state %d): ",
852 used = sprintf(flexml_err_msg,
853 "Invalid XML (state %d): ",
856 chars_left = flexml_max_err_msg_size - used - 1;
857 vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
860 #ifndef FLEXML_quiet_parser
861 /* print directly to sdterr */
862 fprintf(stderr, "%s", flexml_err_msg);
863 flexml_err_msg[0] = '\0';