Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
modified atoi to strtol when getting route ends in all models
[simgrid.git] / src / surf / surfxml.l
1 /* Validating XML processor for surf/surfxml.dtd.
2  * Generated 2007/11/29 14:32:38.
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.61 2006/09/13 16:34:33 wdowling 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.38 2006/09/12 18:05:45 wdowling Exp $";
53 const char rcs_surfxml_flexml[] =
54  "$" "Id: flexml.pl,v 1.61 2006/09/13 16:34:33 wdowling Exp $";
55
56 /* ANSI headers. */
57 #include <unistd.h>
58 #include <stdio.h>
59 #include <string.h>
60 #include <assert.h>
61 #include <stdarg.h>
62 #include <ctype.h>
63
64 #ifndef FLEXML_INDEXSTACKSIZE
65 #define FLEXML_INDEXSTACKSIZE 1000
66 #endif
67
68 /* Generated definitions. */
69 #define FLEXML_yylineno
70 #ifndef FLEXML_BUFFERSTACKSIZE
71 #define FLEXML_BUFFERSTACKSIZE 1000000
72 #endif
73 #define FLEXML_NEED_BUFFERLIT
74
75 /* XML processor api. */
76 /* FleXML-provided data. */
77 int surfxml_pcdata_ix;
78 extern char *surfxml_bufferstack;
79 #define surfxml_pcdata (surfxml_bufferstack + surfxml_pcdata_ix)
80 AT_surfxml_random_generator AX_surfxml_random_generator;
81 #define A_surfxml_random_generator AX_surfxml_random_generator
82 AT_surfxml_prop_id AX_surfxml_prop_id;
83 #define A_surfxml_prop_id (surfxml_bufferstack + AX_surfxml_prop_id)
84 AT_surfxml_host_interference_recv AX_surfxml_host_interference_recv;
85 #define A_surfxml_host_interference_recv (surfxml_bufferstack + AX_surfxml_host_interference_recv)
86 AT_surfxml_host_id AX_surfxml_host_id;
87 #define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id)
88 AT_surfxml_set_id AX_surfxml_set_id;
89 #define A_surfxml_set_id (surfxml_bufferstack + AX_surfxml_set_id)
90 AT_surfxml_link_latency_file AX_surfxml_link_latency_file;
91 #define A_surfxml_link_latency_file (surfxml_bufferstack + AX_surfxml_link_latency_file)
92 AT_surfxml_host_state AX_surfxml_host_state;
93 #define A_surfxml_host_state AX_surfxml_host_state
94 AT_surfxml_host_interference_send_recv AX_surfxml_host_interference_send_recv;
95 #define A_surfxml_host_interference_send_recv (surfxml_bufferstack + AX_surfxml_host_interference_send_recv)
96 AT_surfxml_host_interference_send AX_surfxml_host_interference_send;
97 #define A_surfxml_host_interference_send (surfxml_bufferstack + AX_surfxml_host_interference_send)
98 AT_surfxml_set_suffix AX_surfxml_set_suffix;
99 #define A_surfxml_set_suffix (surfxml_bufferstack + AX_surfxml_set_suffix)
100 AT_surfxml_route_impact_on_dst AX_surfxml_route_impact_on_dst;
101 #define A_surfxml_route_impact_on_dst (surfxml_bufferstack + AX_surfxml_route_impact_on_dst)
102 AT_surfxml_host_power AX_surfxml_host_power;
103 #define A_surfxml_host_power (surfxml_bufferstack + AX_surfxml_host_power)
104 AT_surfxml_router_id AX_surfxml_router_id;
105 #define A_surfxml_router_id (surfxml_bufferstack + AX_surfxml_router_id)
106 AT_surfxml_process_start_time AX_surfxml_process_start_time;
107 #define A_surfxml_process_start_time (surfxml_bufferstack + AX_surfxml_process_start_time)
108 AT_surfxml_cluster_suffix AX_surfxml_cluster_suffix;
109 #define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix)
110 AT_surfxml_platform_xmlns_c_route AX_surfxml_platform_xmlns_c_route;
111 #define A_surfxml_platform_xmlns_c_route (surfxml_bufferstack + AX_surfxml_platform_xmlns_c_route)
112 AT_surfxml_cluster_prefix AX_surfxml_cluster_prefix;
113 #define A_surfxml_cluster_prefix (surfxml_bufferstack + AX_surfxml_cluster_prefix)
114 AT_surfxml_trace_file AX_surfxml_trace_file;
115 #define A_surfxml_trace_file (surfxml_bufferstack + AX_surfxml_trace_file)
116 AT_surfxml_route_action AX_surfxml_route_action;
117 #define A_surfxml_route_action AX_surfxml_route_action
118 AT_surfxml_link_sharing_policy AX_surfxml_link_sharing_policy;
119 #define A_surfxml_link_sharing_policy AX_surfxml_link_sharing_policy
120 AT_surfxml_random_min AX_surfxml_random_min;
121 #define A_surfxml_random_min (surfxml_bufferstack + AX_surfxml_random_min)
122 AT_surfxml_process_kill_time AX_surfxml_process_kill_time;
123 #define A_surfxml_process_kill_time (surfxml_bufferstack + AX_surfxml_process_kill_time)
124 AT_surfxml_cluster_bb_bw AX_surfxml_cluster_bb_bw;
125 #define A_surfxml_cluster_bb_bw (surfxml_bufferstack + AX_surfxml_cluster_bb_bw)
126 AT_surfxml_trace_c_connect_element AX_surfxml_trace_c_connect_element;
127 #define A_surfxml_trace_c_connect_element AX_surfxml_trace_c_connect_element
128 AT_surfxml_argument_value AX_surfxml_argument_value;
129 #define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value)
130 AT_surfxml_link_state AX_surfxml_link_state;
131 #define A_surfxml_link_state AX_surfxml_link_state
132 AT_surfxml_route_impact_on_src AX_surfxml_route_impact_on_src;
133 #define A_surfxml_route_impact_on_src (surfxml_bufferstack + AX_surfxml_route_impact_on_src)
134 AT_surfxml_link_bandwidth AX_surfxml_link_bandwidth;
135 #define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth)
136 AT_surfxml_cluster_id AX_surfxml_cluster_id;
137 #define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id)
138 AT_surfxml_random_mean AX_surfxml_random_mean;
139 #define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean)
140 AT_surfxml_cluster_bb_lat AX_surfxml_cluster_bb_lat;
141 #define A_surfxml_cluster_bb_lat (surfxml_bufferstack + AX_surfxml_cluster_bb_lat)
142 AT_surfxml_link_latency AX_surfxml_link_latency;
143 #define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency)
144 AT_surfxml_trace_c_connect_trace_id AX_surfxml_trace_c_connect_trace_id;
145 #define A_surfxml_trace_c_connect_trace_id (surfxml_bufferstack + AX_surfxml_trace_c_connect_trace_id)
146 AT_surfxml_platform_xmlns_c_link AX_surfxml_platform_xmlns_c_link;
147 #define A_surfxml_platform_xmlns_c_link (surfxml_bufferstack + AX_surfxml_platform_xmlns_c_link)
148 AT_surfxml_link_bandwidth_file AX_surfxml_link_bandwidth_file;
149 #define A_surfxml_link_bandwidth_file (surfxml_bufferstack + AX_surfxml_link_bandwidth_file)
150 AT_surfxml_random_id AX_surfxml_random_id;
151 #define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id)
152 AT_surfxml_set_radical AX_surfxml_set_radical;
153 #define A_surfxml_set_radical (surfxml_bufferstack + AX_surfxml_set_radical)
154 AT_surfxml_random_max AX_surfxml_random_max;
155 #define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max)
156 AT_surfxml_link_id AX_surfxml_link_id;
157 #define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id)
158 AT_surfxml_process_host AX_surfxml_process_host;
159 #define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host)
160 AT_surfxml_host_availability_file AX_surfxml_host_availability_file;
161 #define A_surfxml_host_availability_file (surfxml_bufferstack + AX_surfxml_host_availability_file)
162 AT_surfxml_cluster_lat AX_surfxml_cluster_lat;
163 #define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat)
164 AT_surfxml_trace_periodicity AX_surfxml_trace_periodicity;
165 #define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity)
166 AT_surfxml_foreach_set_id AX_surfxml_foreach_set_id;
167 #define A_surfxml_foreach_set_id (surfxml_bufferstack + AX_surfxml_foreach_set_id)
168 AT_surfxml_route_impact_on_dst_with_other_send AX_surfxml_route_impact_on_dst_with_other_send;
169 #define A_surfxml_route_impact_on_dst_with_other_send (surfxml_bufferstack + AX_surfxml_route_impact_on_dst_with_other_send)
170 AT_surfxml_prop_value AX_surfxml_prop_value;
171 #define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value)
172 AT_surfxml_route_impact_on_src_with_other_recv AX_surfxml_route_impact_on_src_with_other_recv;
173 #define A_surfxml_route_impact_on_src_with_other_recv (surfxml_bufferstack + AX_surfxml_route_impact_on_src_with_other_recv)
174 AT_surfxml_link_state_file AX_surfxml_link_state_file;
175 #define A_surfxml_link_state_file (surfxml_bufferstack + AX_surfxml_link_state_file)
176 AT_surfxml_set_prefix AX_surfxml_set_prefix;
177 #define A_surfxml_set_prefix (surfxml_bufferstack + AX_surfxml_set_prefix)
178 AT_surfxml_cluster_power AX_surfxml_cluster_power;
179 #define A_surfxml_cluster_power (surfxml_bufferstack + AX_surfxml_cluster_power)
180 AT_surfxml_process_function AX_surfxml_process_function;
181 #define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function)
182 AT_surfxml_host_max_outgoing_rate AX_surfxml_host_max_outgoing_rate;
183 #define A_surfxml_host_max_outgoing_rate (surfxml_bufferstack + AX_surfxml_host_max_outgoing_rate)
184 AT_surfxml_link_c_ctn_id AX_surfxml_link_c_ctn_id;
185 #define A_surfxml_link_c_ctn_id (surfxml_bufferstack + AX_surfxml_link_c_ctn_id)
186 AT_surfxml_host_availability AX_surfxml_host_availability;
187 #define A_surfxml_host_availability (surfxml_bufferstack + AX_surfxml_host_availability)
188 AT_surfxml_route_src AX_surfxml_route_src;
189 #define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src)
190 AT_surfxml_route_c_multi_src AX_surfxml_route_c_multi_src;
191 #define A_surfxml_route_c_multi_src (surfxml_bufferstack + AX_surfxml_route_c_multi_src)
192 AT_surfxml_route_c_multi_action AX_surfxml_route_c_multi_action;
193 #define A_surfxml_route_c_multi_action AX_surfxml_route_c_multi_action
194 AT_surfxml_trace_id AX_surfxml_trace_id;
195 #define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id)
196 AT_surfxml_cluster_radical AX_surfxml_cluster_radical;
197 #define A_surfxml_cluster_radical (surfxml_bufferstack + AX_surfxml_cluster_radical)
198 AT_surfxml_include_file AX_surfxml_include_file;
199 #define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file)
200 AT_surfxml_random_std_deviation AX_surfxml_random_std_deviation;
201 #define A_surfxml_random_std_deviation (surfxml_bufferstack + AX_surfxml_random_std_deviation)
202 AT_surfxml_trace_c_connect_kind AX_surfxml_trace_c_connect_kind;
203 #define A_surfxml_trace_c_connect_kind AX_surfxml_trace_c_connect_kind
204 AT_surfxml_trace_c_connect_connector_id AX_surfxml_trace_c_connect_connector_id;
205 #define A_surfxml_trace_c_connect_connector_id (surfxml_bufferstack + AX_surfxml_trace_c_connect_connector_id)
206 AT_surfxml_route_c_multi_dst AX_surfxml_route_c_multi_dst;
207 #define A_surfxml_route_c_multi_dst (surfxml_bufferstack + AX_surfxml_route_c_multi_dst)
208 AT_surfxml_host_state_file AX_surfxml_host_state_file;
209 #define A_surfxml_host_state_file (surfxml_bufferstack + AX_surfxml_host_state_file)
210 AT_surfxml_route_c_multi_symmetric AX_surfxml_route_c_multi_symmetric;
211 #define A_surfxml_route_c_multi_symmetric AX_surfxml_route_c_multi_symmetric
212 AT_surfxml_route_dst AX_surfxml_route_dst;
213 #define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst)
214 AT_surfxml_cluster_bw AX_surfxml_cluster_bw;
215 #define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw)
216 AT_surfxml_platform_version AX_surfxml_platform_version;
217 #define A_surfxml_platform_version (surfxml_bufferstack + AX_surfxml_platform_version)
218
219 /* XML state. */
220 #ifdef FLEX_DEBUG
221 # define ENTER(state)   debug_enter(state,#state)
222 # define LEAVE          debug_leave()
223 # define SET(state)     debug_set(state,#state)
224   static void debug_enter(int, const char*);
225   static void debug_leave(void);
226   static void debug_set(int, const char*);
227 #else
228 # define ENTER(state)   (yy_push_state(state))
229 # define LEAVE          (yy_pop_state())
230 # define SET(state)     BEGIN(state)
231 #endif
232
233 /* Generic actions. */
234 #define SKIP    /*skip*/
235 #define SUCCEED        CLEANUP; return 0
236
237 #define FAIL    return fail
238 static int fail(const char*, ...);
239
240 enum {flexml_max_err_msg_size = 512};
241 static char flexml_err_msg[flexml_max_err_msg_size];
242 const char * surfxml_parse_err_msg()
243 {
244     return flexml_err_msg;
245 }
246 static void reset_surfxml_parse_err_msg()
247 {
248     flexml_err_msg[0] = '\0';
249 }
250
251 /* Cleanup */
252 static void cleanup(void);
253 #define CLEANUP  cleanup()
254
255 /* Text buffer stack handling. */
256 char *surfxml_bufferstack = NULL;
257 static int blimit = FLEXML_BUFFERSTACKSIZE;
258 static int bnext = 1;
259
260 static int *indexstack = NULL;
261 static int ilimit = FLEXML_INDEXSTACKSIZE;
262 static int inext = 1;
263
264 #define BUFFERSET(P)  (P = bnext)
265 #define BUFFERPUTC(C) (ck_blimit(), surfxml_bufferstack[bnext++] = (C))
266 #define BUFFERDONE    (BUFFERPUTC('\0'))
267
268 #define BUFFERLITERAL(C, P) surfxml_bufferliteral(C, &(P), yytext)
269
270 /* after this is called, there are at least 2 slots left in the stack */
271 static int ck_blimit()
272 {
273      if (bnext >= blimit) {
274          blimit += FLEXML_BUFFERSTACKSIZE + 2;
275          {
276              char *temp = (char *) realloc(surfxml_bufferstack, blimit);
277              assert(temp);
278              surfxml_bufferstack = temp;
279          }
280      }
281      return 0;
282 }
283
284 /* after this is called, there are at least 2 slots left in the stack */
285 static int ck_ilimit()
286 {
287      if (inext >= ilimit) {
288          ilimit += FLEXML_INDEXSTACKSIZE + 2;
289          {
290              int *temp = (int *) realloc(indexstack, ilimit);
291              assert(temp);
292              indexstack = temp;
293          }
294      }
295      return 0;
296 }
297
298 #ifdef FLEXML_NEED_BUFFERLIT
299 static void surfxml_bufferliteral(char c, int* pp, const char* text)
300 {
301   const char *s = (c ? strchr(text,c) : text-1), *e = strrchr(text,c);
302   assert(s <= e); BUFFERSET(*pp);
303   while (++s<e) {
304     if (isspace(*s) && c) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
305     else BUFFERPUTC(*s);
306   }
307   BUFFERDONE;
308 }
309 #endif
310
311 static void pushbuffer(int p)
312 {
313     ck_ilimit();
314     indexstack[inext++] = p;
315     indexstack[inext++] = bnext;    
316 }
317
318 static int popbuffer(void)
319 {
320     assert(inext >= 2);
321     bnext = indexstack[--inext];
322     return indexstack[--inext];
323 }
324
325 /* General internal entities are `unput' back onto the input stream... */
326 #define ENTITYTEXT(T) \
327   { char *s = (T), *e = s+strlen(s);\
328     while (--e >= s) { unput(*e); }}
329
330
331 %}
332
333 /* Flex standard options. */
334 %option stack
335 %option noyy_top_state
336 %option noinput
337 %option noreject
338 %option noyymore
339 %option noyywrap
340
341 /* Flex user-requested options. */
342 %option yylineno
343 %option nounput
344
345 /* XML character classes (currently restricted to ASCII). */
346
347 /* "Common syntactic structures." */
348 S               [ \t\n\r\f]+
349 s               [ \t\n\r\f]*
350
351 /* "Names and Tokens." */
352 NameChar        [A-Za-z0-9.:_-]
353 Name            [A-Za-z_:]{NameChar}*
354 Names           {Name}({S}{Name})*
355 Nmtoken         ({NameChar})+
356 Nmtokens        {Nmtoken}({S}{Nmtoken})*
357
358 /* Miscellaneous. */
359 VersionNum      [a-zA-Z0-9_.:-]+
360 Eq              {s}"="{s}
361 Literal         \'[^'']*\'|\"[^""]*\"
362
363 /* Parser states (flex `exclusive start conditions'):
364  *
365  * PROLOG       the XML prolog of the document before <?xml...>
366  * DOCTYPE      the XML prolog of the document after <?xml...>
367  * EPILOG       after the root element
368  * INCOMMENT    inside an XML comment <!--....-->
369  * INPI         inside an XML PI <?...?>
370  * VALUE1       inside a '...'-delimited literal
371  * VALUE2       inside a "..."-delimited literal
372  * CDATA        inside a <![CDATA[...] ]> section.
373  * ROOT_<tag>   expect root element <tag>
374  * AL_<tag>     inside the attribute list for <tag>
375  * IN_<tag>     inside a <tag> with element contents (ready for end tag)
376  * IMPOSSIBLE   dummy to permit disabling rules; must be last
377  */
378 %x PROLOG DOCTYPE EPILOG INCOMMENT INPI VALUE1 VALUE2 CDATA
379 %x ROOT_surfxml_platform AL_surfxml_platform S_surfxml_platform S_surfxml_platform_1 S_surfxml_platform_2 S_surfxml_platform_3 S_surfxml_platform_4 S_surfxml_platform_5 E_surfxml_platform
380 %x AL_surfxml_include E_surfxml_include
381 %x AL_surfxml_trace IN_trace
382 %x AL_surfxml_random S_surfxml_random S_surfxml_random_1 S_surfxml_random_2 E_surfxml_random
383 %x AL_surfxml_trace_c_connect E_surfxml_trace_c_connect
384 %x AL_surfxml_set E_surfxml_set
385 %x AL_surfxml_foreach S_surfxml_foreach S_surfxml_foreach_1 E_surfxml_foreach
386 %x AL_surfxml_host S_surfxml_host S_surfxml_host_1 S_surfxml_host_2 E_surfxml_host
387 %x AL_surfxml_prop E_surfxml_prop
388 %x AL_surfxml_cluster E_surfxml_cluster
389 %x AL_surfxml_router E_surfxml_router
390 %x AL_surfxml_link S_surfxml_link S_surfxml_link_1 S_surfxml_link_2 E_surfxml_link
391 %x AL_surfxml_route_c_multi S_surfxml_route_c_multi S_surfxml_route_c_multi_1 S_surfxml_route_c_multi_2 E_surfxml_route_c_multi
392 %x AL_surfxml_route S_surfxml_route S_surfxml_route_1 S_surfxml_route_2 E_surfxml_route
393 %x AL_surfxml_link_c_ctn E_surfxml_link_c_ctn
394 %x AL_surfxml_process S_surfxml_process S_surfxml_process_1 S_surfxml_process_2 E_surfxml_process
395 %x AL_surfxml_argument E_surfxml_argument
396 %x IMPOSSIBLE
397
398 %{
399 /* State names. */
400 const char* *surfxml_statenames=NULL;
401 %}
402
403 %%
404
405  /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
406  SET(PROLOG);
407  reset_surfxml_parse_err_msg();
408  surfxml_bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
409  assert(surfxml_bufferstack);
410  #ifdef FLEX_DEBUG
411  {
412      int i;
413      for (i = 0; i < blimit; i++) {
414          surfxml_bufferstack[i] = '\377';
415      }
416  }
417  #endif
418  surfxml_bufferstack[0] = '\0';
419  indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
420  assert(indexstack);
421  indexstack[0] = 0;
422
423   /* FleXML_init */
424   bnext = inext = 1;
425   surfxml_bufferliteral('\0', &bnext, "0.0");
426   surfxml_bufferliteral('\0', &bnext, "http://simgrid.gforge.inria.fr/");
427   surfxml_bufferliteral('\0', &bnext, "http://simgrid.gforge.inria.fr/");
428   surfxml_bufferliteral('\0', &bnext, "1.0");
429   surfxml_bufferliteral('\0', &bnext, "1.0");
430   surfxml_bufferliteral('\0', &bnext, "1.0");
431   surfxml_bufferliteral('\0', &bnext, "1.0");
432   surfxml_bufferliteral('\0', &bnext, "-1.0");
433   surfxml_bufferliteral('\0', &bnext, "0.0");
434   surfxml_bufferliteral('\0', &bnext, "0.0");
435   surfxml_bufferliteral('\0', &bnext, "0.0");
436   surfxml_bufferliteral('\0', &bnext, "0.0");
437   surfxml_bufferliteral('\0', &bnext, "0.0");
438   surfxml_bufferliteral('\0', &bnext, "-1.0");
439   surfxml_bufferliteral('\0', &bnext, "-1.0");
440   if(!surfxml_statenames) {surfxml_statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
441   surfxml_statenames[PROLOG] = NULL;
442   surfxml_statenames[DOCTYPE] = NULL;
443   surfxml_statenames[EPILOG] = NULL;
444   surfxml_statenames[INCOMMENT] = NULL;
445   surfxml_statenames[INPI] = NULL;
446   surfxml_statenames[VALUE1] = NULL;
447   surfxml_statenames[VALUE2] = NULL;
448   surfxml_statenames[CDATA] = NULL;
449   surfxml_statenames[ROOT_surfxml_platform] = NULL;
450   surfxml_statenames[AL_surfxml_platform] = NULL;
451   surfxml_statenames[S_surfxml_platform] = "platform";
452   surfxml_statenames[S_surfxml_platform_1] = "platform";
453   surfxml_statenames[S_surfxml_platform_2] = "platform";
454   surfxml_statenames[S_surfxml_platform_3] = "platform";
455   surfxml_statenames[S_surfxml_platform_4] = "platform";
456   surfxml_statenames[S_surfxml_platform_5] = "platform";
457   surfxml_statenames[E_surfxml_platform] = "platform";
458   surfxml_statenames[AL_surfxml_include] = NULL;
459   surfxml_statenames[E_surfxml_include] = "include";
460   surfxml_statenames[AL_surfxml_trace] = NULL;
461   surfxml_statenames[IN_trace] = "trace";
462   surfxml_statenames[AL_surfxml_random] = NULL;
463   surfxml_statenames[S_surfxml_random] = "random";
464   surfxml_statenames[S_surfxml_random_1] = "random";
465   surfxml_statenames[S_surfxml_random_2] = "random";
466   surfxml_statenames[E_surfxml_random] = "random";
467   surfxml_statenames[AL_surfxml_trace_c_connect] = NULL;
468   surfxml_statenames[E_surfxml_trace_c_connect] = "trace:connect";
469   surfxml_statenames[AL_surfxml_set] = NULL;
470   surfxml_statenames[E_surfxml_set] = "set";
471   surfxml_statenames[AL_surfxml_foreach] = NULL;
472   surfxml_statenames[S_surfxml_foreach] = "foreach";
473   surfxml_statenames[S_surfxml_foreach_1] = "foreach";
474   surfxml_statenames[E_surfxml_foreach] = "foreach";
475   surfxml_statenames[AL_surfxml_host] = NULL;
476   surfxml_statenames[S_surfxml_host] = "host";
477   surfxml_statenames[S_surfxml_host_1] = "host";
478   surfxml_statenames[S_surfxml_host_2] = "host";
479   surfxml_statenames[E_surfxml_host] = "host";
480   surfxml_statenames[AL_surfxml_prop] = NULL;
481   surfxml_statenames[E_surfxml_prop] = "prop";
482   surfxml_statenames[AL_surfxml_cluster] = NULL;
483   surfxml_statenames[E_surfxml_cluster] = "cluster";
484   surfxml_statenames[AL_surfxml_router] = NULL;
485   surfxml_statenames[E_surfxml_router] = "router";
486   surfxml_statenames[AL_surfxml_link] = NULL;
487   surfxml_statenames[S_surfxml_link] = "link";
488   surfxml_statenames[S_surfxml_link_1] = "link";
489   surfxml_statenames[S_surfxml_link_2] = "link";
490   surfxml_statenames[E_surfxml_link] = "link";
491   surfxml_statenames[AL_surfxml_route_c_multi] = NULL;
492   surfxml_statenames[S_surfxml_route_c_multi] = "route:multi";
493   surfxml_statenames[S_surfxml_route_c_multi_1] = "route:multi";
494   surfxml_statenames[S_surfxml_route_c_multi_2] = "route:multi";
495   surfxml_statenames[E_surfxml_route_c_multi] = "route:multi";
496   surfxml_statenames[AL_surfxml_route] = NULL;
497   surfxml_statenames[S_surfxml_route] = "route";
498   surfxml_statenames[S_surfxml_route_1] = "route";
499   surfxml_statenames[S_surfxml_route_2] = "route";
500   surfxml_statenames[E_surfxml_route] = "route";
501   surfxml_statenames[AL_surfxml_link_c_ctn] = NULL;
502   surfxml_statenames[E_surfxml_link_c_ctn] = "link:ctn";
503   surfxml_statenames[AL_surfxml_process] = NULL;
504   surfxml_statenames[S_surfxml_process] = "process";
505   surfxml_statenames[S_surfxml_process_1] = "process";
506   surfxml_statenames[S_surfxml_process_2] = "process";
507   surfxml_statenames[E_surfxml_process] = "process";
508   surfxml_statenames[AL_surfxml_argument] = NULL;
509   surfxml_statenames[E_surfxml_argument] = "argument";
510   }
511
512  /* COMMENTS and PIs: handled uniformly for efficiency. */
513
514 <ROOT_surfxml_platform,AL_surfxml_platform,S_surfxml_platform,S_surfxml_platform_1,S_surfxml_platform_2,S_surfxml_platform_3,S_surfxml_platform_4,S_surfxml_platform_5,E_surfxml_platform,AL_surfxml_include,E_surfxml_include,AL_surfxml_trace,IN_trace,AL_surfxml_random,S_surfxml_random,S_surfxml_random_1,S_surfxml_random_2,E_surfxml_random,AL_surfxml_trace_c_connect,E_surfxml_trace_c_connect,AL_surfxml_set,E_surfxml_set,AL_surfxml_foreach,S_surfxml_foreach,S_surfxml_foreach_1,E_surfxml_foreach,AL_surfxml_host,S_surfxml_host,S_surfxml_host_1,S_surfxml_host_2,E_surfxml_host,AL_surfxml_prop,E_surfxml_prop,AL_surfxml_cluster,E_surfxml_cluster,AL_surfxml_router,E_surfxml_router,AL_surfxml_link,S_surfxml_link,S_surfxml_link_1,S_surfxml_link_2,E_surfxml_link,AL_surfxml_route_c_multi,S_surfxml_route_c_multi,S_surfxml_route_c_multi_1,S_surfxml_route_c_multi_2,E_surfxml_route_c_multi,AL_surfxml_route,S_surfxml_route,S_surfxml_route_1,S_surfxml_route_2,E_surfxml_route,AL_surfxml_link_c_ctn,E_surfxml_link_c_ctn,AL_surfxml_process,S_surfxml_process,S_surfxml_process_1,S_surfxml_process_2,E_surfxml_process,AL_surfxml_argument,E_surfxml_argument,PROLOG,DOCTYPE,EPILOG>{
515  "<!--" ENTER(INCOMMENT);
516  "<?" ENTER(INPI);
517 }
518 <INCOMMENT>{
519  "-->"          LEAVE;
520  "--"           |
521  .              |
522  \n             SKIP;
523  <<EOF>>        FAIL("EOF in comment.");
524 }
525 <INPI>{
526  "?>"           LEAVE;
527  .              |
528  \n             SKIP;
529  <<EOF>>        FAIL("EOF in PI (processing instruction).");
530 }
531
532  /* SPACES: skipped uniformly */
533
534 <ROOT_surfxml_platform,AL_surfxml_platform,S_surfxml_platform,S_surfxml_platform_1,S_surfxml_platform_2,S_surfxml_platform_3,S_surfxml_platform_4,S_surfxml_platform_5,E_surfxml_platform,AL_surfxml_include,E_surfxml_include,AL_surfxml_trace,AL_surfxml_random,S_surfxml_random,S_surfxml_random_1,S_surfxml_random_2,E_surfxml_random,AL_surfxml_trace_c_connect,E_surfxml_trace_c_connect,AL_surfxml_set,E_surfxml_set,AL_surfxml_foreach,S_surfxml_foreach,S_surfxml_foreach_1,E_surfxml_foreach,AL_surfxml_host,S_surfxml_host,S_surfxml_host_1,S_surfxml_host_2,E_surfxml_host,AL_surfxml_prop,E_surfxml_prop,AL_surfxml_cluster,E_surfxml_cluster,AL_surfxml_router,E_surfxml_router,AL_surfxml_link,S_surfxml_link,S_surfxml_link_1,S_surfxml_link_2,E_surfxml_link,AL_surfxml_route_c_multi,S_surfxml_route_c_multi,S_surfxml_route_c_multi_1,S_surfxml_route_c_multi_2,E_surfxml_route_c_multi,AL_surfxml_route,S_surfxml_route,S_surfxml_route_1,S_surfxml_route_2,E_surfxml_route,AL_surfxml_link_c_ctn,E_surfxml_link_c_ctn,AL_surfxml_process,S_surfxml_process,S_surfxml_process_1,S_surfxml_process_2,E_surfxml_process,AL_surfxml_argument,E_surfxml_argument,PROLOG,DOCTYPE,EPILOG>{S} SKIP;
535
536  /* PROLOG: determine root element and process it. */
537
538 <PROLOG>{
539  "<?xml"({S}version{Eq}(\'{VersionNum}\'|\"{VersionNum}\"))?({S}encoding{Eq}(\'[^']*\'|\"[^"]*\"))?"?>" SET(DOCTYPE); 
540  "<?xml"[^>]*">" FAIL("Bad declaration %s.",yytext);
541 }
542
543 <PROLOG,DOCTYPE>{
544  "<!DOCTYPE"{S}"platform"{S}SYSTEM{S}("'surfxml.dtd'"|"\"surfxml.dtd\""){s}">" SET(ROOT_surfxml_platform);
545  "<!"[^>-][^>]*">" FAIL("Bad declaration %s.",yytext);
546  .              FAIL("Unexpected character `%c' in prolog.", yytext[0]);
547  <<EOF>>        FAIL("EOF in prolog.");
548 }
549
550  /* RULES DERIVED FROM DTD. */
551
552  /* <!-- Small DTD for SURF based tools. -->  */
553
554 <ROOT_surfxml_platform>"<platform"{s} {
555   AX_surfxml_platform_version = 1;
556   AX_surfxml_platform_xmlns_c_link = 5;
557   AX_surfxml_platform_xmlns_c_route = 37;
558   ENTER(AL_surfxml_platform); pushbuffer(0);
559   }
560
561 <AL_surfxml_platform>{
562  "version"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_platform_version);
563  "version"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_platform_version);
564
565  "xmlns:link"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_platform_xmlns_c_link);
566  "xmlns:link"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_platform_xmlns_c_link);
567
568  "xmlns:route"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_platform_xmlns_c_route);
569  "xmlns:route"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_platform_xmlns_c_route);
570
571  ">" {
572   LEAVE; STag_surfxml_platform();surfxml_pcdata_ix = 0; ENTER(S_surfxml_platform);
573  }
574  "/>" {
575   LEAVE; STag_surfxml_platform(); surfxml_pcdata_ix = 0; ETag_surfxml_platform(); popbuffer(); /* attribute */
576   switch (YY_START) {
577    case ROOT_surfxml_platform: SET(EPILOG); break;
578   }
579  }
580  .       FAIL("Unexpected character `%c' in attribute list of platform element.", yytext[0]);
581  {Name} FAIL("Bad attribute `%s' in `platform' element start tag.",yytext);
582  <<EOF>> FAIL("EOF in attribute list of `platform' element.");
583 }
584
585 <S_surfxml_platform_5,S_surfxml_platform_1,S_surfxml_platform_3,S_surfxml_platform,E_surfxml_platform>{
586  "</platform"{s}">" {
587   LEAVE;
588   ETag_surfxml_platform();
589   popbuffer(); /* attribute */
590   switch (YY_START) {
591    case ROOT_surfxml_platform: SET(EPILOG); break;
592   }
593  }
594  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</platform>' expected.",yytext);
595  .       FAIL("Unexpected character `%c': `</platform>' expected.",yytext[0]);
596  <<EOF>> FAIL("Premature EOF: `</platform>' expected.");
597 }
598
599 <S_surfxml_platform_5,S_surfxml_platform_2,S_surfxml_platform_1,S_surfxml_platform_3,S_surfxml_platform,S_surfxml_platform_4>"<include"{s} {
600   AX_surfxml_include_file = 0;
601   ENTER(AL_surfxml_include); pushbuffer(0);
602   }
603
604 <AL_surfxml_include>{
605  "file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_include_file);
606  "file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_include_file);
607
608  ">" {
609   if (!AX_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
610   LEAVE; STag_surfxml_include();surfxml_pcdata_ix = 0; ENTER(E_surfxml_include);
611  }
612  "/>" {
613   if (!AX_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
614   LEAVE; STag_surfxml_include(); surfxml_pcdata_ix = 0; ETag_surfxml_include(); popbuffer(); /* attribute */
615   switch (YY_START) {
616    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
617    case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
618   }
619  }
620  .       FAIL("Unexpected character `%c' in attribute list of include element.", yytext[0]);
621  {Name} FAIL("Bad attribute `%s' in `include' element start tag.",yytext);
622  <<EOF>> FAIL("EOF in attribute list of `include' element.");
623 }
624
625 <E_surfxml_include>{
626  "</include"{s}">" {
627   LEAVE;
628   ETag_surfxml_include();
629   popbuffer(); /* attribute */
630   switch (YY_START) {
631    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
632    case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
633   }
634  }
635  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</include>' expected.",yytext);
636  .       FAIL("Unexpected character `%c': `</include>' expected.",yytext[0]);
637  <<EOF>> FAIL("Premature EOF: `</include>' expected.");
638 }
639
640 <S_surfxml_platform_2,S_surfxml_platform_3,S_surfxml_platform>"<trace"{s} {
641   AX_surfxml_trace_id = 0;
642   AX_surfxml_trace_file = 0;
643   AX_surfxml_trace_periodicity = 0;
644   ENTER(AL_surfxml_trace); pushbuffer(0);
645   }
646
647 <AL_surfxml_trace>{
648  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_id);
649  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_id);
650
651  "file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_file);
652  "file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_file);
653
654  "periodicity"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_periodicity);
655  "periodicity"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_periodicity);
656
657  ">" {
658   if (!AX_surfxml_trace_id) FAIL("Required attribute `id' not set for `trace' element.");
659   if (!AX_surfxml_trace_periodicity) FAIL("Required attribute `periodicity' not set for `trace' element.");
660   LEAVE; STag_surfxml_trace();pushbuffer(surfxml_pcdata_ix); BUFFERSET(surfxml_pcdata_ix);; ENTER(IN_trace);
661  }
662  "/>" {
663   if (!AX_surfxml_trace_id) FAIL("Required attribute `id' not set for `trace' element.");
664   if (!AX_surfxml_trace_periodicity) FAIL("Required attribute `periodicity' not set for `trace' element.");
665   LEAVE; STag_surfxml_trace(); surfxml_pcdata_ix = 0; ETag_surfxml_trace(); popbuffer(); /* attribute */
666   switch (YY_START) {
667    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
668   }
669  }
670  .       FAIL("Unexpected character `%c' in attribute list of trace element.", yytext[0]);
671  {Name} FAIL("Bad attribute `%s' in `trace' element start tag.",yytext);
672  <<EOF>> FAIL("EOF in attribute list of `trace' element.");
673 }
674
675 <IN_trace>{
676  "</trace"{s}">" {
677   LEAVE;
678   BUFFERDONE;
679   ETag_surfxml_trace();
680   surfxml_pcdata_ix = popbuffer();
681   popbuffer(); /* attribute */
682   switch (YY_START) {
683    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
684   }
685  }
686  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</trace>' expected.",yytext);
687  <<EOF>> FAIL("Premature EOF: `</trace>' expected.");
688 }
689
690 <S_surfxml_platform_2,S_surfxml_platform_3,S_surfxml_platform>"<random"{s} {
691   AX_surfxml_random_id = 0;
692   AX_surfxml_random_min = 0;
693   AX_surfxml_random_max = 0;
694   AX_surfxml_random_mean = 0;
695   AX_surfxml_random_std_deviation = 0;
696   AX_surfxml_random_generator = A_surfxml_random_generator_DRAND48;
697   ENTER(AL_surfxml_random); pushbuffer(0);
698   }
699
700 <AL_surfxml_random>{
701  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_random_id);
702  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_random_id);
703
704  "min"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_random_min);
705  "min"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_random_min);
706
707  "max"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_random_max);
708  "max"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_random_max);
709
710  "mean"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_random_mean);
711  "mean"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_random_mean);
712
713  "std_deviation"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_random_std_deviation);
714  "std_deviation"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_random_std_deviation);
715
716  "generator"{Eq}"'DRAND48'" |
717  "generator"{Eq}"\"DRAND48\"" A_surfxml_random_generator = A_surfxml_random_generator_DRAND48;
718  "generator"{Eq}"'RAND'" |
719  "generator"{Eq}"\"RAND\"" A_surfxml_random_generator = A_surfxml_random_generator_RAND;
720
721  ">" {
722   if (!AX_surfxml_random_id) FAIL("Required attribute `id' not set for `random' element.");
723   if (!AX_surfxml_random_min) FAIL("Required attribute `min' not set for `random' element.");
724   if (!AX_surfxml_random_max) FAIL("Required attribute `max' not set for `random' element.");
725   if (!AX_surfxml_random_mean) FAIL("Required attribute `mean' not set for `random' element.");
726   if (!AX_surfxml_random_std_deviation) FAIL("Required attribute `std_deviation' not set for `random' element.");
727   LEAVE; STag_surfxml_random();surfxml_pcdata_ix = 0; ENTER(S_surfxml_random);
728  }
729  "/>" {
730   if (!AX_surfxml_random_id) FAIL("Required attribute `id' not set for `random' element.");
731   if (!AX_surfxml_random_min) FAIL("Required attribute `min' not set for `random' element.");
732   if (!AX_surfxml_random_max) FAIL("Required attribute `max' not set for `random' element.");
733   if (!AX_surfxml_random_mean) FAIL("Required attribute `mean' not set for `random' element.");
734   if (!AX_surfxml_random_std_deviation) FAIL("Required attribute `std_deviation' not set for `random' element.");
735   LEAVE; STag_surfxml_random(); surfxml_pcdata_ix = 0; ETag_surfxml_random(); popbuffer(); /* attribute */
736   switch (YY_START) {
737    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
738   }
739  }
740  .       FAIL("Unexpected character `%c' in attribute list of random element.", yytext[0]);
741  {Name} FAIL("Bad attribute `%s' in `random' element start tag.",yytext);
742  <<EOF>> FAIL("EOF in attribute list of `random' element.");
743 }
744
745 <S_surfxml_random_2,S_surfxml_random,E_surfxml_random>{
746  "</random"{s}">" {
747   LEAVE;
748   ETag_surfxml_random();
749   popbuffer(); /* attribute */
750   switch (YY_START) {
751    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
752   }
753  }
754  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</random>' expected.",yytext);
755  .       FAIL("Unexpected character `%c': `</random>' expected.",yytext[0]);
756  <<EOF>> FAIL("Premature EOF: `</random>' expected.");
757 }
758
759 <S_surfxml_platform_5,S_surfxml_platform_2,S_surfxml_platform_1,S_surfxml_platform_3,S_surfxml_platform,S_surfxml_platform_4>"<trace:connect"{s} {
760   AX_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_AVAILABILITY;
761   AX_surfxml_trace_c_connect_trace_id = 0;
762   AX_surfxml_trace_c_connect_element = A_surfxml_trace_c_connect_element_HOST;
763   AX_surfxml_trace_c_connect_connector_id = 0;
764   ENTER(AL_surfxml_trace_c_connect); pushbuffer(0);
765   }
766
767 <AL_surfxml_trace_c_connect>{
768  "kind"{Eq}"'AVAILABILITY'" |
769  "kind"{Eq}"\"AVAILABILITY\"" A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_AVAILABILITY;
770  "kind"{Eq}"'BANDWIDTH'" |
771  "kind"{Eq}"\"BANDWIDTH\"" A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_BANDWIDTH;
772  "kind"{Eq}"'LATENCY'" |
773  "kind"{Eq}"\"LATENCY\"" A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_LATENCY;
774  "kind"{Eq}"'POWER'" |
775  "kind"{Eq}"\"POWER\"" A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_POWER;
776
777  "trace_id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_c_connect_trace_id);
778  "trace_id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_c_connect_trace_id);
779
780  "element"{Eq}"'HOST'" |
781  "element"{Eq}"\"HOST\"" A_surfxml_trace_c_connect_element = A_surfxml_trace_c_connect_element_HOST;
782  "element"{Eq}"'LINK'" |
783  "element"{Eq}"\"LINK\"" A_surfxml_trace_c_connect_element = A_surfxml_trace_c_connect_element_LINK;
784
785  "connector_id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_c_connect_connector_id);
786  "connector_id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_c_connect_connector_id);
787
788  ">" {
789   if (!AX_surfxml_trace_c_connect_trace_id) FAIL("Required attribute `trace_id' not set for `trace:connect' element.");
790   if (!AX_surfxml_trace_c_connect_connector_id) FAIL("Required attribute `connector_id' not set for `trace:connect' element.");
791   LEAVE; STag_surfxml_trace_c_connect();surfxml_pcdata_ix = 0; ENTER(E_surfxml_trace_c_connect);
792  }
793  "/>" {
794   if (!AX_surfxml_trace_c_connect_trace_id) FAIL("Required attribute `trace_id' not set for `trace:connect' element.");
795   if (!AX_surfxml_trace_c_connect_connector_id) FAIL("Required attribute `connector_id' not set for `trace:connect' element.");
796   LEAVE; STag_surfxml_trace_c_connect(); surfxml_pcdata_ix = 0; ETag_surfxml_trace_c_connect(); popbuffer(); /* attribute */
797   switch (YY_START) {
798    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
799    case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
800   }
801  }
802  .       FAIL("Unexpected character `%c' in attribute list of trace:connect element.", yytext[0]);
803  {Name} FAIL("Bad attribute `%s' in `trace:connect' element start tag.",yytext);
804  <<EOF>> FAIL("EOF in attribute list of `trace:connect' element.");
805 }
806
807 <E_surfxml_trace_c_connect>{
808  "</trace:connect"{s}">" {
809   LEAVE;
810   ETag_surfxml_trace_c_connect();
811   popbuffer(); /* attribute */
812   switch (YY_START) {
813    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
814    case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
815   }
816  }
817  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</trace:connect>' expected.",yytext);
818  .       FAIL("Unexpected character `%c': `</trace:connect>' expected.",yytext[0]);
819  <<EOF>> FAIL("Premature EOF: `</trace:connect>' expected.");
820 }
821
822 <S_surfxml_platform_2,S_surfxml_platform_3,S_surfxml_platform>"<set"{s} {
823   AX_surfxml_set_id = 0;
824   AX_surfxml_set_prefix = 0;
825   AX_surfxml_set_suffix = 0;
826   AX_surfxml_set_radical = 0;
827   ENTER(AL_surfxml_set); pushbuffer(0);
828   }
829
830 <AL_surfxml_set>{
831  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_set_id);
832  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_set_id);
833
834  "prefix"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_set_prefix);
835  "prefix"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_set_prefix);
836
837  "suffix"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_set_suffix);
838  "suffix"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_set_suffix);
839
840  "radical"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_set_radical);
841  "radical"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_set_radical);
842
843  ">" {
844   if (!AX_surfxml_set_id) FAIL("Required attribute `id' not set for `set' element.");
845   if (!AX_surfxml_set_prefix) FAIL("Required attribute `prefix' not set for `set' element.");
846   if (!AX_surfxml_set_suffix) FAIL("Required attribute `suffix' not set for `set' element.");
847   if (!AX_surfxml_set_radical) FAIL("Required attribute `radical' not set for `set' element.");
848   LEAVE; STag_surfxml_set();surfxml_pcdata_ix = 0; ENTER(E_surfxml_set);
849  }
850  "/>" {
851   if (!AX_surfxml_set_id) FAIL("Required attribute `id' not set for `set' element.");
852   if (!AX_surfxml_set_prefix) FAIL("Required attribute `prefix' not set for `set' element.");
853   if (!AX_surfxml_set_suffix) FAIL("Required attribute `suffix' not set for `set' element.");
854   if (!AX_surfxml_set_radical) FAIL("Required attribute `radical' not set for `set' element.");
855   LEAVE; STag_surfxml_set(); surfxml_pcdata_ix = 0; ETag_surfxml_set(); popbuffer(); /* attribute */
856   switch (YY_START) {
857    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
858   }
859  }
860  .       FAIL("Unexpected character `%c' in attribute list of set element.", yytext[0]);
861  {Name} FAIL("Bad attribute `%s' in `set' element start tag.",yytext);
862  <<EOF>> FAIL("EOF in attribute list of `set' element.");
863 }
864
865 <E_surfxml_set>{
866  "</set"{s}">" {
867   LEAVE;
868   ETag_surfxml_set();
869   popbuffer(); /* attribute */
870   switch (YY_START) {
871    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
872   }
873  }
874  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</set>' expected.",yytext);
875  .       FAIL("Unexpected character `%c': `</set>' expected.",yytext[0]);
876  <<EOF>> FAIL("Premature EOF: `</set>' expected.");
877 }
878
879 <S_surfxml_platform_2,S_surfxml_platform_3,S_surfxml_platform>"<foreach"{s} {
880   AX_surfxml_foreach_set_id = 0;
881   ENTER(AL_surfxml_foreach); pushbuffer(0);
882   }
883
884 <AL_surfxml_foreach>{
885  "set_id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_foreach_set_id);
886  "set_id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_foreach_set_id);
887
888  ">" {
889   if (!AX_surfxml_foreach_set_id) FAIL("Required attribute `set_id' not set for `foreach' element.");
890   LEAVE; STag_surfxml_foreach();surfxml_pcdata_ix = 0; ENTER(S_surfxml_foreach);
891  }
892  "/>" FAIL("`foreach' element cannot be empty.");
893  .       FAIL("Unexpected character `%c' in attribute list of foreach element.", yytext[0]);
894  {Name} FAIL("Bad attribute `%s' in `foreach' element start tag.",yytext);
895  <<EOF>> FAIL("EOF in attribute list of `foreach' element.");
896 }
897
898 <E_surfxml_foreach>{
899  "</foreach"{s}">" {
900   LEAVE;
901   ETag_surfxml_foreach();
902   popbuffer(); /* attribute */
903   switch (YY_START) {
904    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
905   }
906  }
907  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</foreach>' expected.",yytext);
908  .       FAIL("Unexpected character `%c': `</foreach>' expected.",yytext[0]);
909  <<EOF>> FAIL("Premature EOF: `</foreach>' expected.");
910 }
911
912 <S_surfxml_foreach,S_surfxml_platform_2,S_surfxml_platform_3,S_surfxml_platform>"<host"{s} {
913   AX_surfxml_host_id = 0;
914   AX_surfxml_host_power = 0;
915   AX_surfxml_host_availability = 69;
916   AX_surfxml_host_availability_file = 0;
917   AX_surfxml_host_state = A_surfxml_host_state_ON;
918   AX_surfxml_host_state_file = 0;
919   AX_surfxml_host_interference_send = 73;
920   AX_surfxml_host_interference_recv = 77;
921   AX_surfxml_host_interference_send_recv = 81;
922   AX_surfxml_host_max_outgoing_rate = 85;
923   ENTER(AL_surfxml_host); pushbuffer(0);
924   }
925
926 <AL_surfxml_host>{
927  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_id);
928  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_id);
929
930  "power"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_power);
931  "power"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_power);
932
933  "availability"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_availability);
934  "availability"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_availability);
935
936  "availability_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_availability_file);
937  "availability_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_availability_file);
938
939  "state"{Eq}"'ON'" |
940  "state"{Eq}"\"ON\"" A_surfxml_host_state = A_surfxml_host_state_ON;
941  "state"{Eq}"'OFF'" |
942  "state"{Eq}"\"OFF\"" A_surfxml_host_state = A_surfxml_host_state_OFF;
943
944  "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_state_file);
945  "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_state_file);
946
947  "interference_send"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_interference_send);
948  "interference_send"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_interference_send);
949
950  "interference_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_interference_recv);
951  "interference_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_interference_recv);
952
953  "interference_send_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_interference_send_recv);
954  "interference_send_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_interference_send_recv);
955
956  "max_outgoing_rate"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_host_max_outgoing_rate);
957  "max_outgoing_rate"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_host_max_outgoing_rate);
958
959  ">" {
960   if (!AX_surfxml_host_id) FAIL("Required attribute `id' not set for `host' element.");
961   if (!AX_surfxml_host_power) FAIL("Required attribute `power' not set for `host' element.");
962   LEAVE; STag_surfxml_host();surfxml_pcdata_ix = 0; ENTER(S_surfxml_host);
963  }
964  "/>" {
965   if (!AX_surfxml_host_id) FAIL("Required attribute `id' not set for `host' element.");
966   if (!AX_surfxml_host_power) FAIL("Required attribute `power' not set for `host' element.");
967   LEAVE; STag_surfxml_host(); surfxml_pcdata_ix = 0; ETag_surfxml_host(); popbuffer(); /* attribute */
968   switch (YY_START) {
969    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
970    case S_surfxml_foreach: SET(S_surfxml_foreach_1); break;
971   }
972  }
973  .       FAIL("Unexpected character `%c' in attribute list of host element.", yytext[0]);
974  {Name} FAIL("Bad attribute `%s' in `host' element start tag.",yytext);
975  <<EOF>> FAIL("EOF in attribute list of `host' element.");
976 }
977
978 <S_surfxml_host,E_surfxml_host,S_surfxml_host_2>{
979  "</host"{s}">" {
980   LEAVE;
981   ETag_surfxml_host();
982   popbuffer(); /* attribute */
983   switch (YY_START) {
984    case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
985    case S_surfxml_foreach: SET(S_surfxml_foreach_1); break;
986   }
987  }
988  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</host>' expected.",yytext);
989  .       FAIL("Unexpected character `%c': `</host>' expected.",yytext[0]);
990  <<EOF>> FAIL("Premature EOF: `</host>' expected.");
991 }
992
993 <S_surfxml_host,S_surfxml_link_1,S_surfxml_link_2,S_surfxml_random,S_surfxml_random_2,S_surfxml_link,S_surfxml_host_1,S_surfxml_random_1,S_surfxml_process_1,S_surfxml_process,S_surfxml_process_2,S_surfxml_host_2>"<prop"{s} {
994   AX_surfxml_prop_id = 0;
995   AX_surfxml_prop_value = 0;
996   ENTER(AL_surfxml_prop); pushbuffer(0);
997   }
998
999 <AL_surfxml_prop>{
1000  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_prop_id);
1001  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_prop_id);
1002
1003  "value"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_prop_value);
1004  "value"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_prop_value);
1005
1006  ">" {
1007   if (!AX_surfxml_prop_id) FAIL("Required attribute `id' not set for `prop' element.");
1008   if (!AX_surfxml_prop_value) FAIL("Required attribute `value' not set for `prop' element.");
1009   LEAVE; STag_surfxml_prop();surfxml_pcdata_ix = 0; ENTER(E_surfxml_prop);
1010  }
1011  "/>" {
1012   if (!AX_surfxml_prop_id) FAIL("Required attribute `id' not set for `prop' element.");
1013   if (!AX_surfxml_prop_value) FAIL("Required attribute `value' not set for `prop' element.");
1014   LEAVE; STag_surfxml_prop(); surfxml_pcdata_ix = 0; ETag_surfxml_prop(); popbuffer(); /* attribute */
1015   switch (YY_START) {
1016    case S_surfxml_random: case S_surfxml_random_2: case S_surfxml_random_1: SET(S_surfxml_random_2); break;
1017    case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
1018    case S_surfxml_host: case S_surfxml_host_1: case S_surfxml_host_2: SET(S_surfxml_host_2); break;
1019    case S_surfxml_link_1: case S_surfxml_link_2: case S_surfxml_link: SET(S_surfxml_link_2); break;
1020   }
1021  }
1022  .       FAIL("Unexpected character `%c' in attribute list of prop element.", yytext[0]);
1023  {Name} FAIL("Bad attribute `%s' in `prop' element start tag.",yytext);
1024  <<EOF>> FAIL("EOF in attribute list of `prop' element.");
1025 }
1026
1027 <E_surfxml_prop>{
1028  "</prop"{s}">" {
1029   LEAVE;
1030   ETag_surfxml_prop();
1031   popbuffer(); /* attribute */
1032   switch (YY_START) {
1033    case S_surfxml_random: case S_surfxml_random_2: case S_surfxml_random_1: SET(S_surfxml_random_2); break;
1034    case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
1035    case S_surfxml_host: case S_surfxml_host_1: case S_surfxml_host_2: SET(S_surfxml_host_2); break;
1036    case S_surfxml_link_1: case S_surfxml_link_2: case S_surfxml_link: SET(S_surfxml_link_2); break;
1037   }
1038  }
1039  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</prop>' expected.",yytext);
1040  .       FAIL("Unexpected character `%c': `</prop>' expected.",yytext[0]);
1041  <<EOF>> FAIL("Premature EOF: `</prop>' expected.");
1042 }
1043
1044 <S_surfxml_platform_2,S_surfxml_platform,S_surfxml_platform_3>"<cluster"{s} {
1045   AX_surfxml_cluster_id = 0;
1046   AX_surfxml_cluster_prefix = 0;
1047   AX_surfxml_cluster_suffix = 0;
1048   AX_surfxml_cluster_radical = 0;
1049   AX_surfxml_cluster_power = 0;
1050   AX_surfxml_cluster_bw = 0;
1051   AX_surfxml_cluster_lat = 0;
1052   AX_surfxml_cluster_bb_bw = 0;
1053   AX_surfxml_cluster_bb_lat = 0;
1054   ENTER(AL_surfxml_cluster); pushbuffer(0);
1055   }
1056
1057 <AL_surfxml_cluster>{
1058  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_id);
1059  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_id);
1060
1061  "prefix"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_prefix);
1062  "prefix"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_prefix);
1063
1064  "suffix"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_suffix);
1065  "suffix"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_suffix);
1066
1067  "radical"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_radical);
1068  "radical"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_radical);
1069
1070  "power"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_power);
1071  "power"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_power);
1072
1073  "bw"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_bw);
1074  "bw"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_bw);
1075
1076  "lat"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_lat);
1077  "lat"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_lat);
1078
1079  "bb_bw"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_bb_bw);
1080  "bb_bw"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_bb_bw);
1081
1082  "bb_lat"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_bb_lat);
1083  "bb_lat"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_bb_lat);
1084
1085  ">" {
1086   if (!AX_surfxml_cluster_id) FAIL("Required attribute `id' not set for `cluster' element.");
1087   if (!AX_surfxml_cluster_prefix) FAIL("Required attribute `prefix' not set for `cluster' element.");
1088   if (!AX_surfxml_cluster_suffix) FAIL("Required attribute `suffix' not set for `cluster' element.");
1089   if (!AX_surfxml_cluster_radical) FAIL("Required attribute `radical' not set for `cluster' element.");
1090   if (!AX_surfxml_cluster_power) FAIL("Required attribute `power' not set for `cluster' element.");
1091   if (!AX_surfxml_cluster_bw) FAIL("Required attribute `bw' not set for `cluster' element.");
1092   if (!AX_surfxml_cluster_lat) FAIL("Required attribute `lat' not set for `cluster' element.");
1093   if (!AX_surfxml_cluster_bb_bw) FAIL("Required attribute `bb_bw' not set for `cluster' element.");
1094   if (!AX_surfxml_cluster_bb_lat) FAIL("Required attribute `bb_lat' not set for `cluster' element.");
1095   LEAVE; STag_surfxml_cluster();surfxml_pcdata_ix = 0; ENTER(E_surfxml_cluster);
1096  }
1097  "/>" {
1098   if (!AX_surfxml_cluster_id) FAIL("Required attribute `id' not set for `cluster' element.");
1099   if (!AX_surfxml_cluster_prefix) FAIL("Required attribute `prefix' not set for `cluster' element.");
1100   if (!AX_surfxml_cluster_suffix) FAIL("Required attribute `suffix' not set for `cluster' element.");
1101   if (!AX_surfxml_cluster_radical) FAIL("Required attribute `radical' not set for `cluster' element.");
1102   if (!AX_surfxml_cluster_power) FAIL("Required attribute `power' not set for `cluster' element.");
1103   if (!AX_surfxml_cluster_bw) FAIL("Required attribute `bw' not set for `cluster' element.");
1104   if (!AX_surfxml_cluster_lat) FAIL("Required attribute `lat' not set for `cluster' element.");
1105   if (!AX_surfxml_cluster_bb_bw) FAIL("Required attribute `bb_bw' not set for `cluster' element.");
1106   if (!AX_surfxml_cluster_bb_lat) FAIL("Required attribute `bb_lat' not set for `cluster' element.");
1107   LEAVE; STag_surfxml_cluster(); surfxml_pcdata_ix = 0; ETag_surfxml_cluster(); popbuffer(); /* attribute */
1108   switch (YY_START) {
1109    case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
1110   }
1111  }
1112  .       FAIL("Unexpected character `%c' in attribute list of cluster element.", yytext[0]);
1113  {Name} FAIL("Bad attribute `%s' in `cluster' element start tag.",yytext);
1114  <<EOF>> FAIL("EOF in attribute list of `cluster' element.");
1115 }
1116
1117 <E_surfxml_cluster>{
1118  "</cluster"{s}">" {
1119   LEAVE;
1120   ETag_surfxml_cluster();
1121   popbuffer(); /* attribute */
1122   switch (YY_START) {
1123    case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
1124   }
1125  }
1126  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</cluster>' expected.",yytext);
1127  .       FAIL("Unexpected character `%c': `</cluster>' expected.",yytext[0]);
1128  <<EOF>> FAIL("Premature EOF: `</cluster>' expected.");
1129 }
1130
1131 <S_surfxml_platform_2,S_surfxml_platform,S_surfxml_platform_3>"<router"{s} {
1132   AX_surfxml_router_id = 0;
1133   ENTER(AL_surfxml_router); pushbuffer(0);
1134   }
1135
1136 <AL_surfxml_router>{
1137  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_router_id);
1138  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_router_id);
1139
1140  ">" {
1141   if (!AX_surfxml_router_id) FAIL("Required attribute `id' not set for `router' element.");
1142   LEAVE; STag_surfxml_router();surfxml_pcdata_ix = 0; ENTER(E_surfxml_router);
1143  }
1144  "/>" {
1145   if (!AX_surfxml_router_id) FAIL("Required attribute `id' not set for `router' element.");
1146   LEAVE; STag_surfxml_router(); surfxml_pcdata_ix = 0; ETag_surfxml_router(); popbuffer(); /* attribute */
1147   switch (YY_START) {
1148    case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
1149   }
1150  }
1151  .       FAIL("Unexpected character `%c' in attribute list of router element.", yytext[0]);
1152  {Name} FAIL("Bad attribute `%s' in `router' element start tag.",yytext);
1153  <<EOF>> FAIL("EOF in attribute list of `router' element.");
1154 }
1155
1156 <E_surfxml_router>{
1157  "</router"{s}">" {
1158   LEAVE;
1159   ETag_surfxml_router();
1160   popbuffer(); /* attribute */
1161   switch (YY_START) {
1162    case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
1163   }
1164  }
1165  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</router>' expected.",yytext);
1166  .       FAIL("Unexpected character `%c': `</router>' expected.",yytext[0]);
1167  <<EOF>> FAIL("Premature EOF: `</router>' expected.");
1168 }
1169
1170 <S_surfxml_foreach,S_surfxml_platform_2,S_surfxml_platform,S_surfxml_foreach_1,S_surfxml_platform_3>"<link"{s} {
1171   AX_surfxml_link_id = 0;
1172   AX_surfxml_link_bandwidth = 0;
1173   AX_surfxml_link_bandwidth_file = 0;
1174   AX_surfxml_link_latency = 90;
1175   AX_surfxml_link_latency_file = 0;
1176   AX_surfxml_link_state = A_surfxml_link_state_ON;
1177   AX_surfxml_link_state_file = 0;
1178   AX_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
1179   ENTER(AL_surfxml_link); pushbuffer(0);
1180   }
1181
1182 <AL_surfxml_link>{
1183  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_link_id);
1184  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_link_id);
1185
1186  "bandwidth"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_link_bandwidth);
1187  "bandwidth"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_link_bandwidth);
1188
1189  "bandwidth_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_link_bandwidth_file);
1190  "bandwidth_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_link_bandwidth_file);
1191
1192  "latency"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_link_latency);
1193  "latency"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_link_latency);
1194
1195  "latency_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_link_latency_file);
1196  "latency_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_link_latency_file);
1197
1198  "state"{Eq}"'ON'" |
1199  "state"{Eq}"\"ON\"" A_surfxml_link_state = A_surfxml_link_state_ON;
1200  "state"{Eq}"'OFF'" |
1201  "state"{Eq}"\"OFF\"" A_surfxml_link_state = A_surfxml_link_state_OFF;
1202
1203  "state_file"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_link_state_file);
1204  "state_file"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_link_state_file);
1205
1206  "sharing_policy"{Eq}"'SHARED'" |
1207  "sharing_policy"{Eq}"\"SHARED\"" A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
1208  "sharing_policy"{Eq}"'FATPIPE'" |
1209  "sharing_policy"{Eq}"\"FATPIPE\"" A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;
1210
1211  ">" {
1212   if (!AX_surfxml_link_id) FAIL("Required attribute `id' not set for `link' element.");
1213   if (!AX_surfxml_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `link' element.");
1214   LEAVE; STag_surfxml_link();surfxml_pcdata_ix = 0; ENTER(S_surfxml_link);
1215  }
1216  "/>" {
1217   if (!AX_surfxml_link_id) FAIL("Required attribute `id' not set for `link' element.");
1218   if (!AX_surfxml_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `link' element.");
1219   LEAVE; STag_surfxml_link(); surfxml_pcdata_ix = 0; ETag_surfxml_link(); popbuffer(); /* attribute */
1220   switch (YY_START) {
1221    case S_surfxml_foreach: case S_surfxml_foreach_1: SET(E_surfxml_foreach); break;
1222    case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
1223   }
1224  }
1225  .       FAIL("Unexpected character `%c' in attribute list of link element.", yytext[0]);
1226  {Name} FAIL("Bad attribute `%s' in `link' element start tag.",yytext);
1227  <<EOF>> FAIL("EOF in attribute list of `link' element.");
1228 }
1229
1230 <S_surfxml_link_2,E_surfxml_link,S_surfxml_link>{
1231  "</link"{s}">" {
1232   LEAVE;
1233   ETag_surfxml_link();
1234   popbuffer(); /* attribute */
1235   switch (YY_START) {
1236    case S_surfxml_foreach: case S_surfxml_foreach_1: SET(E_surfxml_foreach); break;
1237    case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
1238   }
1239  }
1240  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</link>' expected.",yytext);
1241  .       FAIL("Unexpected character `%c': `</link>' expected.",yytext[0]);
1242  <<EOF>> FAIL("Premature EOF: `</link>' expected.");
1243 }
1244
1245 <S_surfxml_platform_5,S_surfxml_platform_1,S_surfxml_platform,S_surfxml_platform_3,S_surfxml_platform_4>"<route:multi"{s} {
1246   AX_surfxml_route_c_multi_src = 0;
1247   AX_surfxml_route_c_multi_dst = 0;
1248   AX_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_POSTPEND;
1249   AX_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_YES;
1250   ENTER(AL_surfxml_route_c_multi); pushbuffer(0);
1251   }
1252
1253 <AL_surfxml_route_c_multi>{
1254  "src"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_c_multi_src);
1255  "src"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_c_multi_src);
1256
1257  "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_c_multi_dst);
1258  "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_c_multi_dst);
1259
1260  "action"{Eq}"'POSTPEND'" |
1261  "action"{Eq}"\"POSTPEND\"" A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_POSTPEND;
1262  "action"{Eq}"'PREPEND'" |
1263  "action"{Eq}"\"PREPEND\"" A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_PREPEND;
1264  "action"{Eq}"'OVERRIDE'" |
1265  "action"{Eq}"\"OVERRIDE\"" A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_OVERRIDE;
1266
1267  "symmetric"{Eq}"'YES'" |
1268  "symmetric"{Eq}"\"YES\"" A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_YES;
1269  "symmetric"{Eq}"'NO'" |
1270  "symmetric"{Eq}"\"NO\"" A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_NO;
1271
1272  ">" {
1273   if (!AX_surfxml_route_c_multi_src) FAIL("Required attribute `src' not set for `route:multi' element.");
1274   if (!AX_surfxml_route_c_multi_dst) FAIL("Required attribute `dst' not set for `route:multi' element.");
1275   LEAVE; STag_surfxml_route_c_multi();surfxml_pcdata_ix = 0; ENTER(S_surfxml_route_c_multi);
1276  }
1277  "/>" FAIL("`route:multi' element cannot be empty.");
1278  .       FAIL("Unexpected character `%c' in attribute list of route:multi element.", yytext[0]);
1279  {Name} FAIL("Bad attribute `%s' in `route:multi' element start tag.",yytext);
1280  <<EOF>> FAIL("EOF in attribute list of `route:multi' element.");
1281 }
1282
1283 <S_surfxml_route_c_multi_2,E_surfxml_route_c_multi>{
1284  "</route:multi"{s}">" {
1285   LEAVE;
1286   ETag_surfxml_route_c_multi();
1287   popbuffer(); /* attribute */
1288   switch (YY_START) {
1289    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
1290   }
1291  }
1292  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route:multi>' expected.",yytext);
1293  .       FAIL("Unexpected character `%c': `</route:multi>' expected.",yytext[0]);
1294  <<EOF>> FAIL("Premature EOF: `</route:multi>' expected.");
1295 }
1296
1297 <S_surfxml_platform_5,S_surfxml_platform_1,S_surfxml_platform,S_surfxml_platform_3,S_surfxml_platform_4>"<route"{s} {
1298   AX_surfxml_route_src = 0;
1299   AX_surfxml_route_dst = 0;
1300   AX_surfxml_route_impact_on_src = 94;
1301   AX_surfxml_route_impact_on_dst = 98;
1302   AX_surfxml_route_impact_on_src_with_other_recv = 102;
1303   AX_surfxml_route_impact_on_dst_with_other_send = 106;
1304   AX_surfxml_route_action = A_surfxml_route_action_POSTPEND;
1305   ENTER(AL_surfxml_route); pushbuffer(0);
1306   }
1307
1308 <AL_surfxml_route>{
1309  "src"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_src);
1310  "src"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_src);
1311
1312  "dst"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_dst);
1313  "dst"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_dst);
1314
1315  "impact_on_src"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_src);
1316  "impact_on_src"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_src);
1317
1318  "impact_on_dst"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_dst);
1319  "impact_on_dst"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_dst);
1320
1321  "impact_on_src_with_other_recv"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
1322  "impact_on_src_with_other_recv"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
1323
1324  "impact_on_dst_with_other_send"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
1325  "impact_on_dst_with_other_send"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
1326
1327  "action"{Eq}"'POSTPEND'" |
1328  "action"{Eq}"\"POSTPEND\"" A_surfxml_route_action = A_surfxml_route_action_POSTPEND;
1329  "action"{Eq}"'PREPEND'" |
1330  "action"{Eq}"\"PREPEND\"" A_surfxml_route_action = A_surfxml_route_action_PREPEND;
1331  "action"{Eq}"'OVERRIDE'" |
1332  "action"{Eq}"\"OVERRIDE\"" A_surfxml_route_action = A_surfxml_route_action_OVERRIDE;
1333
1334  ">" {
1335   if (!AX_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
1336   if (!AX_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
1337   LEAVE; STag_surfxml_route();surfxml_pcdata_ix = 0; ENTER(S_surfxml_route);
1338  }
1339  "/>" {
1340   if (!AX_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
1341   if (!AX_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
1342   LEAVE; STag_surfxml_route(); surfxml_pcdata_ix = 0; ETag_surfxml_route(); popbuffer(); /* attribute */
1343   switch (YY_START) {
1344    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
1345   }
1346  }
1347  .       FAIL("Unexpected character `%c' in attribute list of route element.", yytext[0]);
1348  {Name} FAIL("Bad attribute `%s' in `route' element start tag.",yytext);
1349  <<EOF>> FAIL("EOF in attribute list of `route' element.");
1350 }
1351
1352 <S_surfxml_route,S_surfxml_route_2,E_surfxml_route>{
1353  "</route"{s}">" {
1354   LEAVE;
1355   ETag_surfxml_route();
1356   popbuffer(); /* attribute */
1357   switch (YY_START) {
1358    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
1359   }
1360  }
1361  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</route>' expected.",yytext);
1362  .       FAIL("Unexpected character `%c': `</route>' expected.",yytext[0]);
1363  <<EOF>> FAIL("Premature EOF: `</route>' expected.");
1364 }
1365
1366 <S_surfxml_route_1,S_surfxml_route,S_surfxml_route_2,S_surfxml_route_c_multi_2,S_surfxml_route_c_multi_1,S_surfxml_route_c_multi>"<link:ctn"{s} {
1367   AX_surfxml_link_c_ctn_id = 0;
1368   ENTER(AL_surfxml_link_c_ctn); pushbuffer(0);
1369   }
1370
1371 <AL_surfxml_link_c_ctn>{
1372  "id"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_link_c_ctn_id);
1373  "id"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_link_c_ctn_id);
1374
1375  ">" {
1376   if (!AX_surfxml_link_c_ctn_id) FAIL("Required attribute `id' not set for `link:ctn' element.");
1377   LEAVE; STag_surfxml_link_c_ctn();surfxml_pcdata_ix = 0; ENTER(E_surfxml_link_c_ctn);
1378  }
1379  "/>" {
1380   if (!AX_surfxml_link_c_ctn_id) FAIL("Required attribute `id' not set for `link:ctn' element.");
1381   LEAVE; STag_surfxml_link_c_ctn(); surfxml_pcdata_ix = 0; ETag_surfxml_link_c_ctn(); popbuffer(); /* attribute */
1382   switch (YY_START) {
1383    case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
1384    case S_surfxml_route_c_multi_2: case S_surfxml_route_c_multi_1: case S_surfxml_route_c_multi: SET(S_surfxml_route_c_multi_2); break;
1385   }
1386  }
1387  .       FAIL("Unexpected character `%c' in attribute list of link:ctn element.", yytext[0]);
1388  {Name} FAIL("Bad attribute `%s' in `link:ctn' element start tag.",yytext);
1389  <<EOF>> FAIL("EOF in attribute list of `link:ctn' element.");
1390 }
1391
1392 <E_surfxml_link_c_ctn>{
1393  "</link:ctn"{s}">" {
1394   LEAVE;
1395   ETag_surfxml_link_c_ctn();
1396   popbuffer(); /* attribute */
1397   switch (YY_START) {
1398    case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
1399    case S_surfxml_route_c_multi_2: case S_surfxml_route_c_multi_1: case S_surfxml_route_c_multi: SET(S_surfxml_route_c_multi_2); break;
1400   }
1401  }
1402  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</link:ctn>' expected.",yytext);
1403  .       FAIL("Unexpected character `%c': `</link:ctn>' expected.",yytext[0]);
1404  <<EOF>> FAIL("Premature EOF: `</link:ctn>' expected.");
1405 }
1406
1407 <S_surfxml_platform_5,S_surfxml_platform_1,S_surfxml_platform,S_surfxml_platform_3,S_surfxml_platform_4>"<process"{s} {
1408   AX_surfxml_process_host = 0;
1409   AX_surfxml_process_function = 0;
1410   AX_surfxml_process_start_time = 110;
1411   AX_surfxml_process_kill_time = 115;
1412   ENTER(AL_surfxml_process); pushbuffer(0);
1413   }
1414
1415 <AL_surfxml_process>{
1416  "host"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_host);
1417  "host"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_host);
1418
1419  "function"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_function);
1420  "function"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_function);
1421
1422  "start_time"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_start_time);
1423  "start_time"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_start_time);
1424
1425  "kill_time"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_process_kill_time);
1426  "kill_time"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_process_kill_time);
1427
1428  ">" {
1429   if (!AX_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
1430   if (!AX_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
1431   LEAVE; STag_surfxml_process();surfxml_pcdata_ix = 0; ENTER(S_surfxml_process);
1432  }
1433  "/>" {
1434   if (!AX_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
1435   if (!AX_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
1436   LEAVE; STag_surfxml_process(); surfxml_pcdata_ix = 0; ETag_surfxml_process(); popbuffer(); /* attribute */
1437   switch (YY_START) {
1438    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
1439   }
1440  }
1441  .       FAIL("Unexpected character `%c' in attribute list of process element.", yytext[0]);
1442  {Name} FAIL("Bad attribute `%s' in `process' element start tag.",yytext);
1443  <<EOF>> FAIL("EOF in attribute list of `process' element.");
1444 }
1445
1446 <S_surfxml_process,E_surfxml_process,S_surfxml_process_2>{
1447  "</process"{s}">" {
1448   LEAVE;
1449   ETag_surfxml_process();
1450   popbuffer(); /* attribute */
1451   switch (YY_START) {
1452    case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
1453   }
1454  }
1455  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</process>' expected.",yytext);
1456  .       FAIL("Unexpected character `%c': `</process>' expected.",yytext[0]);
1457  <<EOF>> FAIL("Premature EOF: `</process>' expected.");
1458 }
1459
1460 <S_surfxml_process_1,S_surfxml_process,S_surfxml_process_2>"<argument"{s} {
1461   AX_surfxml_argument_value = 0;
1462   ENTER(AL_surfxml_argument); pushbuffer(0);
1463   }
1464
1465 <AL_surfxml_argument>{
1466  "value"{Eq}\' ENTER(VALUE1); BUFFERSET(AX_surfxml_argument_value);
1467  "value"{Eq}\" ENTER(VALUE2); BUFFERSET(AX_surfxml_argument_value);
1468
1469  ">" {
1470   if (!AX_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
1471   LEAVE; STag_surfxml_argument();surfxml_pcdata_ix = 0; ENTER(E_surfxml_argument);
1472  }
1473  "/>" {
1474   if (!AX_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
1475   LEAVE; STag_surfxml_argument(); surfxml_pcdata_ix = 0; ETag_surfxml_argument(); popbuffer(); /* attribute */
1476   switch (YY_START) {
1477    case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
1478   }
1479  }
1480  .       FAIL("Unexpected character `%c' in attribute list of argument element.", yytext[0]);
1481  {Name} FAIL("Bad attribute `%s' in `argument' element start tag.",yytext);
1482  <<EOF>> FAIL("EOF in attribute list of `argument' element.");
1483 }
1484
1485 <E_surfxml_argument>{
1486  "</argument"{s}">" {
1487   LEAVE;
1488   ETag_surfxml_argument();
1489   popbuffer(); /* attribute */
1490   switch (YY_START) {
1491    case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
1492   }
1493  }
1494  "</"{Name}{s}">" FAIL("Unexpected end-tag `%s': `</argument>' expected.",yytext);
1495  .       FAIL("Unexpected character `%c': `</argument>' expected.",yytext[0]);
1496  <<EOF>> FAIL("Premature EOF: `</argument>' expected.");
1497 }
1498
1499  /* EPILOG: after the root element. */
1500
1501 <EPILOG>{
1502  . {SET(PROLOG); yyless(0); CLEANUP; return -1;}
1503  <<EOF>>        SUCCEED;
1504 }
1505
1506  /* CHARACTER DATA. */
1507
1508 <IN_trace,VALUE1,VALUE2>{
1509  /* Non-defined standard entities... */
1510 "&amp;"  BUFFERPUTC('&');
1511 "&lt;"   BUFFERPUTC('<');
1512 "&gt;"   BUFFERPUTC('>');
1513 "&apos;" BUFFERPUTC('\'');
1514 "&quot;" BUFFERPUTC('"');
1515
1516  /* Character entities. */
1517  "&#"[[:digit:]]+";"    BUFFERPUTC((unsigned char)atoi(yytext+2));
1518  "&#x"[[:xdigit:]]+";"  BUFFERPUTC((unsigned char)strtol(yytext+3,NULL,16));
1519 }
1520
1521 <IN_trace,VALUE1,VALUE2,CDATA>{
1522  "\n"           |
1523  "\r"           |
1524  "\r\n"         |
1525  "\n\r"         BUFFERPUTC('\n');
1526 }
1527
1528 <IN_trace>{
1529  "<![CDATA["    ENTER(CDATA);
1530  "]""]>"                FAIL("Unexpected `]""]>' in character data.");
1531 }
1532
1533 <VALUE1>{
1534  \'             BUFFERDONE; LEAVE;
1535  <<EOF>>        FAIL("EOF in literal (\"'\" expected).");
1536 }
1537
1538 <VALUE2>{
1539  \"             BUFFERDONE; LEAVE;
1540  <<EOF>>        FAIL("EOF in literal (`\"' expected).");
1541 }
1542
1543 <IN_trace,VALUE1,VALUE2>{
1544  [^<&]          BUFFERPUTC(yytext[0]);
1545  [<&]           FAIL("Spurious `%c' in character data.",yytext[0]);
1546 }
1547
1548 <CDATA>{
1549  "]""]>"                LEAVE;
1550  /* "]""]"              BUFFERPUTC(yytext[0]); BUFFERPUTC(yytext[1]); */
1551  .              BUFFERPUTC(yytext[0]);
1552  <<EOF>>        FAIL("EOF in CDATA section.");
1553 }
1554
1555  /* Impossible rules to avoid warnings from flex(1). */
1556  /* Ideally, this should be replaced by code in flexml.pl that
1557     generates just the states not covered by other rules. */
1558 <*>{
1559  .|[\n] FAIL("Syntax error on character `%c'.", yytext[0]);
1560 }
1561
1562 %%
1563
1564 /* Element context stack lookup. */
1565 int surfxml_element_context(int i)
1566 {
1567   return (0<i && i<yy_start_stack_depth
1568           ? yy_start_stack[yy_start_stack_ptr - i]
1569           : 0);
1570 }
1571
1572 #ifdef FLEX_DEBUG
1573 void print_yy_stack(char* fmt, ...)
1574 {
1575   int i = 0; va_list ap; va_start(ap, fmt);
1576   vfprintf(stderr, fmt, ap);
1577   if (surfxml_statenames) {
1578       for (i=1; i<yy_start_stack_ptr; i++) {
1579           fprintf(stderr, "%s/", surfxml_statenames[yy_start_stack[i] ]);
1580       }
1581       fprintf(stderr,"%s\n", surfxml_statenames[YY_START]);
1582   }
1583   va_end(ap);
1584 }
1585
1586 void print_surfxml_bufferstack()
1587 {
1588     int i;
1589     fputs("Buffer: ", stderr);
1590     for (i = 0; i < blimit; i++) {
1591        if ( surfxml_bufferstack[i] == '\377' ) break;
1592          putc(surfxml_bufferstack[i], stderr);
1593     }
1594     putc('\n', stderr);
1595 }
1596
1597 static void debug_enter(int state, const char* statename) {
1598   yy_push_state(state);
1599   if (yy_flex_debug) {
1600        print_yy_stack("--ENTER(%s) : ",statename);
1601        print_surfxml_bufferstack();
1602   }
1603 }
1604
1605 static void debug_leave(void) {
1606     if (yy_flex_debug) {
1607         print_yy_stack("--LEAVE : ");
1608         print_surfxml_bufferstack();
1609     }
1610   yy_pop_state();
1611 }
1612
1613 static void debug_set(int state, const char* statename) {
1614   BEGIN(state);
1615   if (yy_flex_debug) print_yy_stack("--SET(%s) : ",statename);
1616 }
1617 #endif
1618
1619
1620 static void cleanup(void)
1621 {
1622     if (surfxml_statenames) {
1623         free(surfxml_statenames);
1624         surfxml_statenames = NULL;
1625     }
1626     free(surfxml_bufferstack);
1627     surfxml_bufferstack = NULL;
1628
1629     free(indexstack);
1630     indexstack = NULL;
1631 }
1632
1633
1634 static int fail(const char* fmt, ...)
1635 {
1636     int chars_left, used;
1637     va_list ap; va_start(ap, fmt);
1638 #ifdef FLEXML_yylineno
1639     used = sprintf(flexml_err_msg,
1640                    "Invalid XML (XML input line %d, state %d): ",
1641                    yylineno, YY_START);
1642 #else
1643     used = sprintf(flexml_err_msg,
1644                    "Invalid XML (state %d): ",
1645                    YY_START);
1646 #endif
1647     chars_left = flexml_max_err_msg_size - used - 1;
1648     vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
1649     va_end(ap);
1650
1651 #ifndef FLEXML_quiet_parser
1652     /* print directly to sdterr */
1653     fprintf(stderr, "%s\n", flexml_err_msg);
1654     flexml_err_msg[0] = '\0';
1655 #endif
1656
1657     cleanup();
1658
1659     return 1;
1660 }