1
2 #line 3 "<stdout>"
3
4 #define YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define yy_create_buffer perf_pmu__create_buffer
9 #define yy_delete_buffer perf_pmu__delete_buffer
10 #define yy_flex_debug perf_pmu__flex_debug
11 #define yy_init_buffer perf_pmu__init_buffer
12 #define yy_flush_buffer perf_pmu__flush_buffer
13 #define yy_load_buffer_state perf_pmu__load_buffer_state
14 #define yy_switch_to_buffer perf_pmu__switch_to_buffer
15 #define yyin perf_pmu_in
16 #define yyleng perf_pmu_leng
17 #define yylex perf_pmu_lex
18 #define yylineno perf_pmu_lineno
19 #define yyout perf_pmu_out
20 #define yyrestart perf_pmu_restart
21 #define yytext perf_pmu_text
22 #define yywrap perf_pmu_wrap
23 #define yyalloc perf_pmu_alloc
24 #define yyrealloc perf_pmu_realloc
25 #define yyfree perf_pmu_free
26
27 #define FLEX_SCANNER
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 5
30 #define YY_FLEX_SUBMINOR_VERSION 35
31 #if YY_FLEX_SUBMINOR_VERSION > 0
32 #define FLEX_BETA
33 #endif
34
35 /* First, we deal with platform-specific or compiler-specific issues. */
36
37 /* begin standard C headers. */
38 #include <stdio.h>
39 #include <string.h>
40 #include <errno.h>
41 #include <stdlib.h>
42
43 /* end standard C headers. */
44
45 /* flex integer type definitions */
46
47 #ifndef FLEXINT_H
48 #define FLEXINT_H
49
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
51
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
53
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
56 */
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
59 #endif
60
61 #include <inttypes.h>
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
68 #else
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
75
76 /* Limits of integral types. */
77 #ifndef INT8_MIN
78 #define INT8_MIN (-128)
79 #endif
80 #ifndef INT16_MIN
81 #define INT16_MIN (-32767-1)
82 #endif
83 #ifndef INT32_MIN
84 #define INT32_MIN (-2147483647-1)
85 #endif
86 #ifndef INT8_MAX
87 #define INT8_MAX (127)
88 #endif
89 #ifndef INT16_MAX
90 #define INT16_MAX (32767)
91 #endif
92 #ifndef INT32_MAX
93 #define INT32_MAX (2147483647)
94 #endif
95 #ifndef UINT8_MAX
96 #define UINT8_MAX (255U)
97 #endif
98 #ifndef UINT16_MAX
99 #define UINT16_MAX (65535U)
100 #endif
101 #ifndef UINT32_MAX
102 #define UINT32_MAX (4294967295U)
103 #endif
104
105 #endif /* ! C99 */
106
107 #endif /* ! FLEXINT_H */
108
109 #ifdef __cplusplus
110
111 /* The "const" storage-class-modifier is valid. */
112 #define YY_USE_CONST
113
114 #else /* ! __cplusplus */
115
116 /* C99 requires __STDC__ to be defined as 1. */
117 #if defined (__STDC__)
118
119 #define YY_USE_CONST
120
121 #endif /* defined (__STDC__) */
122 #endif /* ! __cplusplus */
123
124 #ifdef YY_USE_CONST
125 #define yyconst const
126 #else
127 #define yyconst
128 #endif
129
130 /* Returned upon end-of-file. */
131 #define YY_NULL 0
132
133 /* Promotes a possibly negative, possibly signed char to an unsigned
134 * integer for use as an array index. If the signed char is negative,
135 * we want to instead treat it as an 8-bit unsigned char, hence the
136 * double cast.
137 */
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139
140 /* Enter a start condition. This macro really ought to take a parameter,
141 * but we do it the disgusting crufty way forced on us by the ()-less
142 * definition of BEGIN.
143 */
144 #define BEGIN (yy_start) = 1 + 2 *
145
146 /* Translate the current start state into a value that can be later handed
147 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 * compatibility.
149 */
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
152
153 /* Action number for EOF rule of a given start state. */
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155
156 /* Special action meaning "start processing a new file". */
157 #define YY_NEW_FILE perf_pmu_restart(perf_pmu_in )
158
159 #define YY_END_OF_BUFFER_CHAR 0
160
161 /* Size of default input buffer. */
162 #ifndef YY_BUF_SIZE
163 #ifdef __ia64__
164 /* On IA-64, the buffer size is 16k, not 8k.
165 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
166 * Ditto for the __ia64__ case accordingly.
167 */
168 #define YY_BUF_SIZE 32768
169 #else
170 #define YY_BUF_SIZE 16384
171 #endif /* __ia64__ */
172 #endif
173
174 /* The state buf must be large enough to hold one state per character in the main buffer.
175 */
176 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
177
178 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
179 #define YY_TYPEDEF_YY_BUFFER_STATE
180 typedef struct yy_buffer_state *YY_BUFFER_STATE;
181 #endif
182
183 extern int perf_pmu_leng;
184
185 extern FILE *perf_pmu_in, *perf_pmu_out;
186
187 #define EOB_ACT_CONTINUE_SCAN 0
188 #define EOB_ACT_END_OF_FILE 1
189 #define EOB_ACT_LAST_MATCH 2
190
191 #define YY_LESS_LINENO(n)
192
193 /* Return all but the first "n" matched characters back to the input stream. */
194 #define yyless(n) \
195 do \
196 { \
197 /* Undo effects of setting up perf_pmu_text. */ \
198 int yyless_macro_arg = (n); \
199 YY_LESS_LINENO(yyless_macro_arg);\
200 *yy_cp = (yy_hold_char); \
201 YY_RESTORE_YY_MORE_OFFSET \
202 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
203 YY_DO_BEFORE_ACTION; /* set up perf_pmu_text again */ \
204 } \
205 while ( 0 )
206
207 #define unput(c) yyunput( c, (yytext_ptr) )
208
209 #ifndef YY_TYPEDEF_YY_SIZE_T
210 #define YY_TYPEDEF_YY_SIZE_T
211 typedef size_t yy_size_t;
212 #endif
213
214 #ifndef YY_STRUCT_YY_BUFFER_STATE
215 #define YY_STRUCT_YY_BUFFER_STATE
216 struct yy_buffer_state
217 {
218 FILE *yy_input_file;
219
220 char *yy_ch_buf; /* input buffer */
221 char *yy_buf_pos; /* current position in input buffer */
222
223 /* Size of input buffer in bytes, not including room for EOB
224 * characters.
225 */
226 yy_size_t yy_buf_size;
227
228 /* Number of characters read into yy_ch_buf, not including EOB
229 * characters.
230 */
231 int yy_n_chars;
232
233 /* Whether we "own" the buffer - i.e., we know we created it,
234 * and can realloc() it to grow it, and should free() it to
235 * delete it.
236 */
237 int yy_is_our_buffer;
238
239 /* Whether this is an "interactive" input source; if so, and
240 * if we're using stdio for input, then we want to use getc()
241 * instead of fread(), to make sure we stop fetching input after
242 * each newline.
243 */
244 int yy_is_interactive;
245
246 /* Whether we're considered to be at the beginning of a line.
247 * If so, '^' rules will be active on the next match, otherwise
248 * not.
249 */
250 int yy_at_bol;
251
252 int yy_bs_lineno; /**< The line count. */
253 int yy_bs_column; /**< The column count. */
254
255 /* Whether to try to fill the input buffer when we reach the
256 * end of it.
257 */
258 int yy_fill_buffer;
259
260 int yy_buffer_status;
261
262 #define YY_BUFFER_NEW 0
263 #define YY_BUFFER_NORMAL 1
264 /* When an EOF's been seen but there's still some text to process
265 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
266 * shouldn't try reading from the input source any more. We might
267 * still have a bunch of tokens to match, though, because of
268 * possible backing-up.
269 *
270 * When we actually see the EOF, we change the status to "new"
271 * (via perf_pmu_restart()), so that the user can continue scanning by
272 * just pointing perf_pmu_in at a new input file.
273 */
274 #define YY_BUFFER_EOF_PENDING 2
275
276 };
277 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
278
279 /* Stack of input buffers. */
280 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
281 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
282 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
283
284 /* We provide macros for accessing buffer states in case in the
285 * future we want to put the buffer states in a more general
286 * "scanner state".
287 *
288 * Returns the top of the stack, or NULL.
289 */
290 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
291 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
292 : NULL)
293
294 /* Same as previous macro, but useful when we know that the buffer stack is not
295 * NULL or when we need an lvalue. For internal use only.
296 */
297 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
298
299 /* yy_hold_char holds the character lost when perf_pmu_text is formed. */
300 static char yy_hold_char;
301 static int yy_n_chars; /* number of characters read into yy_ch_buf */
302 int perf_pmu_leng;
303
304 /* Points to current character in buffer. */
305 static char *yy_c_buf_p = (char *) 0;
306 static int yy_init = 0; /* whether we need to initialize */
307 static int yy_start = 0; /* start state number */
308
309 /* Flag which is used to allow perf_pmu_wrap()'s to do buffer switches
310 * instead of setting up a fresh perf_pmu_in. A bit of a hack ...
311 */
312 static int yy_did_buffer_switch_on_eof;
313
314 void perf_pmu_restart (FILE *input_file );
315 void perf_pmu__switch_to_buffer (YY_BUFFER_STATE new_buffer );
316 YY_BUFFER_STATE perf_pmu__create_buffer (FILE *file,int size );
317 void perf_pmu__delete_buffer (YY_BUFFER_STATE b );
318 void perf_pmu__flush_buffer (YY_BUFFER_STATE b );
319 void perf_pmu_push_buffer_state (YY_BUFFER_STATE new_buffer );
320 void perf_pmu_pop_buffer_state (void );
321
322 static void perf_pmu_ensure_buffer_stack (void );
323 static void perf_pmu__load_buffer_state (void );
324 static void perf_pmu__init_buffer (YY_BUFFER_STATE b,FILE *file );
325
326 #define YY_FLUSH_BUFFER perf_pmu__flush_buffer(YY_CURRENT_BUFFER )
327
328 YY_BUFFER_STATE perf_pmu__scan_buffer (char *base,yy_size_t size );
329 YY_BUFFER_STATE perf_pmu__scan_string (yyconst char *yy_str );
330 YY_BUFFER_STATE perf_pmu__scan_bytes (yyconst char *bytes,int len );
331
332 void *perf_pmu_alloc (yy_size_t );
333 void *perf_pmu_realloc (void *,yy_size_t );
334 void perf_pmu_free (void * );
335
336 #define yy_new_buffer perf_pmu__create_buffer
337
338 #define yy_set_interactive(is_interactive) \
339 { \
340 if ( ! YY_CURRENT_BUFFER ){ \
341 perf_pmu_ensure_buffer_stack (); \
342 YY_CURRENT_BUFFER_LVALUE = \
343 perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE ); \
344 } \
345 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
346 }
347
348 #define yy_set_bol(at_bol) \
349 { \
350 if ( ! YY_CURRENT_BUFFER ){\
351 perf_pmu_ensure_buffer_stack (); \
352 YY_CURRENT_BUFFER_LVALUE = \
353 perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE ); \
354 } \
355 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
356 }
357
358 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
359
360 /* Begin user sect3 */
361
362 typedef unsigned char YY_CHAR;
363
364 FILE *perf_pmu_in = (FILE *) 0, *perf_pmu_out = (FILE *) 0;
365
366 typedef int yy_state_type;
367
368 extern int perf_pmu_lineno;
369
370 int perf_pmu_lineno = 1;
371
372 extern char *perf_pmu_text;
373 #define yytext_ptr perf_pmu_text
374
375 static yy_state_type yy_get_previous_state (void );
376 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
377 static int yy_get_next_buffer (void );
378 static void yy_fatal_error (yyconst char msg[] );
379
380 /* Done after the current pattern has been matched and before the
381 * corresponding action - sets up perf_pmu_text.
382 */
383 #define YY_DO_BEFORE_ACTION \
384 (yytext_ptr) = yy_bp; \
385 perf_pmu_leng = (size_t) (yy_cp - yy_bp); \
386 (yy_hold_char) = *yy_cp; \
387 *yy_cp = '\0'; \
388 (yy_c_buf_p) = yy_cp;
389
390 #define YY_NUM_RULES 10
391 #define YY_END_OF_BUFFER 11
392 /* This struct is not used in this scanner,
393 but its presence is necessary. */
394 struct yy_trans_info
395 {
396 flex_int32_t yy_verify;
397 flex_int32_t yy_nxt;
398 };
399 static yyconst flex_int16_t yy_accept[20] =
400 { 0,
401 0, 0, 11, 8, 9, 7, 5, 1, 6, 8,
402 1, 0, 0, 0, 0, 2, 3, 4, 0
403 } ;
404
405 static yyconst flex_int32_t yy_ec[256] =
406 { 0,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 3, 4, 1, 1, 5, 6, 7,
412 5, 5, 5, 5, 5, 5, 5, 8, 1, 1,
413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1, 1, 1, 1, 9, 1,
417
418 1, 10, 11, 1, 12, 1, 1, 1, 1, 13,
419 14, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
433 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 1, 1, 1, 1, 1
435 } ;
436
437 static yyconst flex_int32_t yy_meta[15] =
438 { 0,
439 1, 1, 1, 1, 2, 2, 2, 1, 1, 1,
440 1, 1, 1, 1
441 } ;
442
443 static yyconst flex_int16_t yy_base[21] =
444 { 0,
445 0, 0, 23, 24, 24, 24, 24, 0, 24, 8,
446 0, 8, 10, 7, 7, 9, 24, 24, 24, 15
447 } ;
448
449 static yyconst flex_int16_t yy_def[21] =
450 { 0,
451 19, 1, 19, 19, 19, 19, 19, 20, 19, 19,
452 20, 19, 19, 19, 19, 19, 19, 19, 0, 19
453 } ;
454
455 static yyconst flex_int16_t yy_nxt[39] =
456 { 0,
457 4, 5, 6, 7, 8, 8, 8, 9, 10, 4,
458 4, 4, 4, 4, 17, 18, 11, 16, 15, 14,
459 13, 12, 19, 3, 19, 19, 19, 19, 19, 19,
460 19, 19, 19, 19, 19, 19, 19, 19
461 } ;
462
463 static yyconst flex_int16_t yy_chk[39] =
464 { 0,
465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
466 1, 1, 1, 1, 16, 16, 20, 15, 14, 13,
467 12, 10, 3, 19, 19, 19, 19, 19, 19, 19,
468 19, 19, 19, 19, 19, 19, 19, 19
469 } ;
470
471 static yy_state_type yy_last_accepting_state;
472 static char *yy_last_accepting_cpos;
473
474 extern int perf_pmu__flex_debug;
475 int perf_pmu__flex_debug = 0;
476
477 /* The intent behind this definition is that it'll catch
478 * any uses of REJECT which flex missed.
479 */
480 #define REJECT reject_used_but_not_detected
481 #define yymore() yymore_used_but_not_detected
482 #define YY_MORE_ADJ 0
483 #define YY_RESTORE_YY_MORE_OFFSET
484 char *perf_pmu_text;
485 #line 1 "util/pmu.l"
486 #line 4 "util/pmu.l"
487 #include <stdlib.h>
488 #include <linux/bitops.h>
489 #include "pmu.h"
490 #include "pmu-bison.h"
491
value(int base)492 static int value(int base)
493 {
494 long num;
495
496 errno = 0;
497 num = strtoul(perf_pmu_text, NULL, base);
498 if (errno)
499 return PP_ERROR;
500
501 perf_pmu_lval.num = num;
502 return PP_VALUE;
503 }
504
505 #line 506 "<stdout>"
506
507 #define INITIAL 0
508
509 #ifndef YY_NO_UNISTD_H
510 /* Special case for "unistd.h", since it is non-ANSI. We include it way
511 * down here because we want the user's section 1 to have been scanned first.
512 * The user has a chance to override it with an option.
513 */
514 #include <unistd.h>
515 #endif
516
517 #ifndef YY_EXTRA_TYPE
518 #define YY_EXTRA_TYPE void *
519 #endif
520
521 static int yy_init_globals (void );
522
523 /* Accessor methods to globals.
524 These are made visible to non-reentrant scanners for convenience. */
525
526 int perf_pmu_lex_destroy (void );
527
528 int perf_pmu_get_debug (void );
529
530 void perf_pmu_set_debug (int debug_flag );
531
532 YY_EXTRA_TYPE perf_pmu_get_extra (void );
533
534 void perf_pmu_set_extra (YY_EXTRA_TYPE user_defined );
535
536 FILE *perf_pmu_get_in (void );
537
538 void perf_pmu_set_in (FILE * in_str );
539
540 FILE *perf_pmu_get_out (void );
541
542 void perf_pmu_set_out (FILE * out_str );
543
544 int perf_pmu_get_leng (void );
545
546 char *perf_pmu_get_text (void );
547
548 int perf_pmu_get_lineno (void );
549
550 void perf_pmu_set_lineno (int line_number );
551
552 /* Macros after this point can all be overridden by user definitions in
553 * section 1.
554 */
555
556 #ifndef YY_SKIP_YYWRAP
557 #ifdef __cplusplus
558 extern "C" int perf_pmu_wrap (void );
559 #else
560 extern int perf_pmu_wrap (void );
561 #endif
562 #endif
563
564 static void yyunput (int c,char *buf_ptr );
565
566 #ifndef yytext_ptr
567 static void yy_flex_strncpy (char *,yyconst char *,int );
568 #endif
569
570 #ifdef YY_NEED_STRLEN
571 static int yy_flex_strlen (yyconst char * );
572 #endif
573
574 #ifndef YY_NO_INPUT
575
576 #ifdef __cplusplus
577 static int yyinput (void );
578 #else
579 static int input (void );
580 #endif
581
582 #endif
583
584 /* Amount of stuff to slurp up with each read. */
585 #ifndef YY_READ_BUF_SIZE
586 #ifdef __ia64__
587 /* On IA-64, the buffer size is 16k, not 8k */
588 #define YY_READ_BUF_SIZE 16384
589 #else
590 #define YY_READ_BUF_SIZE 8192
591 #endif /* __ia64__ */
592 #endif
593
594 /* Copy whatever the last rule matched to the standard output. */
595 #ifndef ECHO
596 /* This used to be an fputs(), but since the string might contain NUL's,
597 * we now use fwrite().
598 */
599 #define ECHO do { if (fwrite( perf_pmu_text, perf_pmu_leng, 1, perf_pmu_out )) {} } while (0)
600 #endif
601
602 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
603 * is returned in "result".
604 */
605 #ifndef YY_INPUT
606 #define YY_INPUT(buf,result,max_size) \
607 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
608 { \
609 int c = '*'; \
610 size_t n; \
611 for ( n = 0; n < max_size && \
612 (c = getc( perf_pmu_in )) != EOF && c != '\n'; ++n ) \
613 buf[n] = (char) c; \
614 if ( c == '\n' ) \
615 buf[n++] = (char) c; \
616 if ( c == EOF && ferror( perf_pmu_in ) ) \
617 YY_FATAL_ERROR( "input in flex scanner failed" ); \
618 result = n; \
619 } \
620 else \
621 { \
622 errno=0; \
623 while ( (result = fread(buf, 1, max_size, perf_pmu_in))==0 && ferror(perf_pmu_in)) \
624 { \
625 if( errno != EINTR) \
626 { \
627 YY_FATAL_ERROR( "input in flex scanner failed" ); \
628 break; \
629 } \
630 errno=0; \
631 clearerr(perf_pmu_in); \
632 } \
633 }\
634 \
635
636 #endif
637
638 /* No semi-colon after return; correct usage is to write "yyterminate();" -
639 * we don't want an extra ';' after the "return" because that will cause
640 * some compilers to complain about unreachable statements.
641 */
642 #ifndef yyterminate
643 #define yyterminate() return YY_NULL
644 #endif
645
646 /* Number of entries by which start-condition stack grows. */
647 #ifndef YY_START_STACK_INCR
648 #define YY_START_STACK_INCR 25
649 #endif
650
651 /* Report a fatal error. */
652 #ifndef YY_FATAL_ERROR
653 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
654 #endif
655
656 /* end tables serialization structures and prototypes */
657
658 /* Default declaration of generated scanner - a define so the user can
659 * easily add parameters.
660 */
661 #ifndef YY_DECL
662 #define YY_DECL_IS_OURS 1
663
664 extern int perf_pmu_lex (void);
665
666 #define YY_DECL int perf_pmu_lex (void)
667 #endif /* !YY_DECL */
668
669 /* Code executed at the beginning of each rule, after perf_pmu_text and perf_pmu_leng
670 * have been set up.
671 */
672 #ifndef YY_USER_ACTION
673 #define YY_USER_ACTION
674 #endif
675
676 /* Code executed at the end of each rule. */
677 #ifndef YY_BREAK
678 #define YY_BREAK break;
679 #endif
680
681 #define YY_RULE_SETUP \
682 YY_USER_ACTION
683
684 /** The main scanner function which does all the work.
685 */
686 YY_DECL
687 {
688 register yy_state_type yy_current_state;
689 register char *yy_cp, *yy_bp;
690 register int yy_act;
691
692 #line 26 "util/pmu.l"
693
694
695 #line 696 "<stdout>"
696
697 if ( !(yy_init) )
698 {
699 (yy_init) = 1;
700
701 #ifdef YY_USER_INIT
702 YY_USER_INIT;
703 #endif
704
705 if ( ! (yy_start) )
706 (yy_start) = 1; /* first start state */
707
708 if ( ! perf_pmu_in )
709 perf_pmu_in = stdin;
710
711 if ( ! perf_pmu_out )
712 perf_pmu_out = stdout;
713
714 if ( ! YY_CURRENT_BUFFER ) {
715 perf_pmu_ensure_buffer_stack ();
716 YY_CURRENT_BUFFER_LVALUE =
717 perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE );
718 }
719
720 perf_pmu__load_buffer_state( );
721 }
722
723 while ( 1 ) /* loops until end-of-file is reached */
724 {
725 yy_cp = (yy_c_buf_p);
726
727 /* Support of perf_pmu_text. */
728 *yy_cp = (yy_hold_char);
729
730 /* yy_bp points to the position in yy_ch_buf of the start of
731 * the current run.
732 */
733 yy_bp = yy_cp;
734
735 yy_current_state = (yy_start);
736 yy_match:
737 do
738 {
739 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
740 if ( yy_accept[yy_current_state] )
741 {
742 (yy_last_accepting_state) = yy_current_state;
743 (yy_last_accepting_cpos) = yy_cp;
744 }
745 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
746 {
747 yy_current_state = (int) yy_def[yy_current_state];
748 if ( yy_current_state >= 20 )
749 yy_c = yy_meta[(unsigned int) yy_c];
750 }
751 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
752 ++yy_cp;
753 }
754 while ( yy_base[yy_current_state] != 24 );
755
756 yy_find_action:
757 yy_act = yy_accept[yy_current_state];
758 if ( yy_act == 0 )
759 { /* have to back up */
760 yy_cp = (yy_last_accepting_cpos);
761 yy_current_state = (yy_last_accepting_state);
762 yy_act = yy_accept[yy_current_state];
763 }
764
765 YY_DO_BEFORE_ACTION;
766
767 do_action: /* This label is used only to access EOF actions. */
768
769 switch ( yy_act )
770 { /* beginning of action switch */
771 case 0: /* must back up */
772 /* undo the effects of YY_DO_BEFORE_ACTION */
773 *yy_cp = (yy_hold_char);
774 yy_cp = (yy_last_accepting_cpos);
775 yy_current_state = (yy_last_accepting_state);
776 goto yy_find_action;
777
778 case 1:
779 YY_RULE_SETUP
780 #line 28 "util/pmu.l"
781 { return value(10); }
782 YY_BREAK
783 case 2:
784 YY_RULE_SETUP
785 #line 29 "util/pmu.l"
786 { return PP_CONFIG; }
787 YY_BREAK
788 case 3:
789 YY_RULE_SETUP
790 #line 30 "util/pmu.l"
791 { return PP_CONFIG1; }
792 YY_BREAK
793 case 4:
794 YY_RULE_SETUP
795 #line 31 "util/pmu.l"
796 { return PP_CONFIG2; }
797 YY_BREAK
798 case 5:
799 YY_RULE_SETUP
800 #line 32 "util/pmu.l"
801 { return '-'; }
802 YY_BREAK
803 case 6:
804 YY_RULE_SETUP
805 #line 33 "util/pmu.l"
806 { return ':'; }
807 YY_BREAK
808 case 7:
809 YY_RULE_SETUP
810 #line 34 "util/pmu.l"
811 { return ','; }
812 YY_BREAK
813 case 8:
814 YY_RULE_SETUP
815 #line 35 "util/pmu.l"
816 { ; }
817 YY_BREAK
818 case 9:
819 /* rule 9 can match eol */
820 YY_RULE_SETUP
821 #line 36 "util/pmu.l"
822 { ; }
823 YY_BREAK
824 case 10:
825 YY_RULE_SETUP
826 #line 38 "util/pmu.l"
827 ECHO;
828 YY_BREAK
829 #line 830 "<stdout>"
830 case YY_STATE_EOF(INITIAL):
831 yyterminate();
832
833 case YY_END_OF_BUFFER:
834 {
835 /* Amount of text matched not including the EOB char. */
836 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
837
838 /* Undo the effects of YY_DO_BEFORE_ACTION. */
839 *yy_cp = (yy_hold_char);
840 YY_RESTORE_YY_MORE_OFFSET
841
842 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
843 {
844 /* We're scanning a new file or input source. It's
845 * possible that this happened because the user
846 * just pointed perf_pmu_in at a new source and called
847 * perf_pmu_lex(). If so, then we have to assure
848 * consistency between YY_CURRENT_BUFFER and our
849 * globals. Here is the right place to do so, because
850 * this is the first action (other than possibly a
851 * back-up) that will match for the new input source.
852 */
853 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
854 YY_CURRENT_BUFFER_LVALUE->yy_input_file = perf_pmu_in;
855 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
856 }
857
858 /* Note that here we test for yy_c_buf_p "<=" to the position
859 * of the first EOB in the buffer, since yy_c_buf_p will
860 * already have been incremented past the NUL character
861 * (since all states make transitions on EOB to the
862 * end-of-buffer state). Contrast this with the test
863 * in input().
864 */
865 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
866 { /* This was really a NUL. */
867 yy_state_type yy_next_state;
868
869 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
870
871 yy_current_state = yy_get_previous_state( );
872
873 /* Okay, we're now positioned to make the NUL
874 * transition. We couldn't have
875 * yy_get_previous_state() go ahead and do it
876 * for us because it doesn't know how to deal
877 * with the possibility of jamming (and we don't
878 * want to build jamming into it because then it
879 * will run more slowly).
880 */
881
882 yy_next_state = yy_try_NUL_trans( yy_current_state );
883
884 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
885
886 if ( yy_next_state )
887 {
888 /* Consume the NUL. */
889 yy_cp = ++(yy_c_buf_p);
890 yy_current_state = yy_next_state;
891 goto yy_match;
892 }
893
894 else
895 {
896 yy_cp = (yy_c_buf_p);
897 goto yy_find_action;
898 }
899 }
900
901 else switch ( yy_get_next_buffer( ) )
902 {
903 case EOB_ACT_END_OF_FILE:
904 {
905 (yy_did_buffer_switch_on_eof) = 0;
906
907 if ( perf_pmu_wrap( ) )
908 {
909 /* Note: because we've taken care in
910 * yy_get_next_buffer() to have set up
911 * perf_pmu_text, we can now set up
912 * yy_c_buf_p so that if some total
913 * hoser (like flex itself) wants to
914 * call the scanner after we return the
915 * YY_NULL, it'll still work - another
916 * YY_NULL will get returned.
917 */
918 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
919
920 yy_act = YY_STATE_EOF(YY_START);
921 goto do_action;
922 }
923
924 else
925 {
926 if ( ! (yy_did_buffer_switch_on_eof) )
927 YY_NEW_FILE;
928 }
929 break;
930 }
931
932 case EOB_ACT_CONTINUE_SCAN:
933 (yy_c_buf_p) =
934 (yytext_ptr) + yy_amount_of_matched_text;
935
936 yy_current_state = yy_get_previous_state( );
937
938 yy_cp = (yy_c_buf_p);
939 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
940 goto yy_match;
941
942 case EOB_ACT_LAST_MATCH:
943 (yy_c_buf_p) =
944 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
945
946 yy_current_state = yy_get_previous_state( );
947
948 yy_cp = (yy_c_buf_p);
949 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
950 goto yy_find_action;
951 }
952 break;
953 }
954
955 default:
956 YY_FATAL_ERROR(
957 "fatal flex scanner internal error--no action found" );
958 } /* end of action switch */
959 } /* end of scanning one token */
960 } /* end of perf_pmu_lex */
961
962 /* yy_get_next_buffer - try to read in a new buffer
963 *
964 * Returns a code representing an action:
965 * EOB_ACT_LAST_MATCH -
966 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
967 * EOB_ACT_END_OF_FILE - end of file
968 */
yy_get_next_buffer(void)969 static int yy_get_next_buffer (void)
970 {
971 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
972 register char *source = (yytext_ptr);
973 register int number_to_move, i;
974 int ret_val;
975
976 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
977 YY_FATAL_ERROR(
978 "fatal flex scanner internal error--end of buffer missed" );
979
980 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
981 { /* Don't try to fill the buffer, so this is an EOF. */
982 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
983 {
984 /* We matched a single character, the EOB, so
985 * treat this as a final EOF.
986 */
987 return EOB_ACT_END_OF_FILE;
988 }
989
990 else
991 {
992 /* We matched some text prior to the EOB, first
993 * process it.
994 */
995 return EOB_ACT_LAST_MATCH;
996 }
997 }
998
999 /* Try to read more data. */
1000
1001 /* First move last chars to start of buffer. */
1002 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1003
1004 for ( i = 0; i < number_to_move; ++i )
1005 *(dest++) = *(source++);
1006
1007 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1008 /* don't do the read, it's not guaranteed to return an EOF,
1009 * just force an EOF
1010 */
1011 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1012
1013 else
1014 {
1015 int num_to_read =
1016 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1017
1018 while ( num_to_read <= 0 )
1019 { /* Not enough room in the buffer - grow it. */
1020
1021 /* just a shorter name for the current buffer */
1022 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1023
1024 int yy_c_buf_p_offset =
1025 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1026
1027 if ( b->yy_is_our_buffer )
1028 {
1029 int new_size = b->yy_buf_size * 2;
1030
1031 if ( new_size <= 0 )
1032 b->yy_buf_size += b->yy_buf_size / 8;
1033 else
1034 b->yy_buf_size *= 2;
1035
1036 b->yy_ch_buf = (char *)
1037 /* Include room in for 2 EOB chars. */
1038 perf_pmu_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1039 }
1040 else
1041 /* Can't grow it, we don't own it. */
1042 b->yy_ch_buf = 0;
1043
1044 if ( ! b->yy_ch_buf )
1045 YY_FATAL_ERROR(
1046 "fatal error - scanner input buffer overflow" );
1047
1048 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1049
1050 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1051 number_to_move - 1;
1052
1053 }
1054
1055 if ( num_to_read > YY_READ_BUF_SIZE )
1056 num_to_read = YY_READ_BUF_SIZE;
1057
1058 /* Read in more data. */
1059 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1060 (yy_n_chars), (size_t) num_to_read );
1061
1062 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1063 }
1064
1065 if ( (yy_n_chars) == 0 )
1066 {
1067 if ( number_to_move == YY_MORE_ADJ )
1068 {
1069 ret_val = EOB_ACT_END_OF_FILE;
1070 perf_pmu_restart(perf_pmu_in );
1071 }
1072
1073 else
1074 {
1075 ret_val = EOB_ACT_LAST_MATCH;
1076 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1077 YY_BUFFER_EOF_PENDING;
1078 }
1079 }
1080
1081 else
1082 ret_val = EOB_ACT_CONTINUE_SCAN;
1083
1084 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1085 /* Extend the array by 50%, plus the number we really need. */
1086 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1087 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) perf_pmu_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1088 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1089 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1090 }
1091
1092 (yy_n_chars) += number_to_move;
1093 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1094 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1095
1096 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1097
1098 return ret_val;
1099 }
1100
1101 /* yy_get_previous_state - get the state just before the EOB char was reached */
1102
yy_get_previous_state(void)1103 static yy_state_type yy_get_previous_state (void)
1104 {
1105 register yy_state_type yy_current_state;
1106 register char *yy_cp;
1107
1108 yy_current_state = (yy_start);
1109
1110 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1111 {
1112 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1113 if ( yy_accept[yy_current_state] )
1114 {
1115 (yy_last_accepting_state) = yy_current_state;
1116 (yy_last_accepting_cpos) = yy_cp;
1117 }
1118 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1119 {
1120 yy_current_state = (int) yy_def[yy_current_state];
1121 if ( yy_current_state >= 20 )
1122 yy_c = yy_meta[(unsigned int) yy_c];
1123 }
1124 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1125 }
1126
1127 return yy_current_state;
1128 }
1129
1130 /* yy_try_NUL_trans - try to make a transition on the NUL character
1131 *
1132 * synopsis
1133 * next_state = yy_try_NUL_trans( current_state );
1134 */
yy_try_NUL_trans(yy_state_type yy_current_state)1135 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1136 {
1137 register int yy_is_jam;
1138 register char *yy_cp = (yy_c_buf_p);
1139
1140 register YY_CHAR yy_c = 1;
1141 if ( yy_accept[yy_current_state] )
1142 {
1143 (yy_last_accepting_state) = yy_current_state;
1144 (yy_last_accepting_cpos) = yy_cp;
1145 }
1146 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1147 {
1148 yy_current_state = (int) yy_def[yy_current_state];
1149 if ( yy_current_state >= 20 )
1150 yy_c = yy_meta[(unsigned int) yy_c];
1151 }
1152 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1153 yy_is_jam = (yy_current_state == 19);
1154
1155 return yy_is_jam ? 0 : yy_current_state;
1156 }
1157
yyunput(int c,register char * yy_bp)1158 static void yyunput (int c, register char * yy_bp )
1159 {
1160 register char *yy_cp;
1161
1162 yy_cp = (yy_c_buf_p);
1163
1164 /* undo effects of setting up perf_pmu_text */
1165 *yy_cp = (yy_hold_char);
1166
1167 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1168 { /* need to shift things up to make room */
1169 /* +2 for EOB chars. */
1170 register int number_to_move = (yy_n_chars) + 2;
1171 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1172 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1173 register char *source =
1174 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1175
1176 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1177 *--dest = *--source;
1178
1179 yy_cp += (int) (dest - source);
1180 yy_bp += (int) (dest - source);
1181 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1182 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1183
1184 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1185 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1186 }
1187
1188 *--yy_cp = (char) c;
1189
1190 (yytext_ptr) = yy_bp;
1191 (yy_hold_char) = *yy_cp;
1192 (yy_c_buf_p) = yy_cp;
1193 }
1194
1195 #ifndef YY_NO_INPUT
1196 #ifdef __cplusplus
yyinput(void)1197 static int yyinput (void)
1198 #else
1199 static int input (void)
1200 #endif
1201
1202 {
1203 int c;
1204
1205 *(yy_c_buf_p) = (yy_hold_char);
1206
1207 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1208 {
1209 /* yy_c_buf_p now points to the character we want to return.
1210 * If this occurs *before* the EOB characters, then it's a
1211 * valid NUL; if not, then we've hit the end of the buffer.
1212 */
1213 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1214 /* This was really a NUL. */
1215 *(yy_c_buf_p) = '\0';
1216
1217 else
1218 { /* need more input */
1219 int offset = (yy_c_buf_p) - (yytext_ptr);
1220 ++(yy_c_buf_p);
1221
1222 switch ( yy_get_next_buffer( ) )
1223 {
1224 case EOB_ACT_LAST_MATCH:
1225 /* This happens because yy_g_n_b()
1226 * sees that we've accumulated a
1227 * token and flags that we need to
1228 * try matching the token before
1229 * proceeding. But for input(),
1230 * there's no matching to consider.
1231 * So convert the EOB_ACT_LAST_MATCH
1232 * to EOB_ACT_END_OF_FILE.
1233 */
1234
1235 /* Reset buffer status. */
1236 perf_pmu_restart(perf_pmu_in );
1237
1238 /*FALLTHROUGH*/
1239
1240 case EOB_ACT_END_OF_FILE:
1241 {
1242 if ( perf_pmu_wrap( ) )
1243 return EOF;
1244
1245 if ( ! (yy_did_buffer_switch_on_eof) )
1246 YY_NEW_FILE;
1247 #ifdef __cplusplus
1248 return yyinput();
1249 #else
1250 return input();
1251 #endif
1252 }
1253
1254 case EOB_ACT_CONTINUE_SCAN:
1255 (yy_c_buf_p) = (yytext_ptr) + offset;
1256 break;
1257 }
1258 }
1259 }
1260
1261 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1262 *(yy_c_buf_p) = '\0'; /* preserve perf_pmu_text */
1263 (yy_hold_char) = *++(yy_c_buf_p);
1264
1265 return c;
1266 }
1267 #endif /* ifndef YY_NO_INPUT */
1268
1269 /** Immediately switch to a different input stream.
1270 * @param input_file A readable stream.
1271 *
1272 * @note This function does not reset the start condition to @c INITIAL .
1273 */
perf_pmu_restart(FILE * input_file)1274 void perf_pmu_restart (FILE * input_file )
1275 {
1276
1277 if ( ! YY_CURRENT_BUFFER ){
1278 perf_pmu_ensure_buffer_stack ();
1279 YY_CURRENT_BUFFER_LVALUE =
1280 perf_pmu__create_buffer(perf_pmu_in,YY_BUF_SIZE );
1281 }
1282
1283 perf_pmu__init_buffer(YY_CURRENT_BUFFER,input_file );
1284 perf_pmu__load_buffer_state( );
1285 }
1286
1287 /** Switch to a different input buffer.
1288 * @param new_buffer The new input buffer.
1289 *
1290 */
perf_pmu__switch_to_buffer(YY_BUFFER_STATE new_buffer)1291 void perf_pmu__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1292 {
1293
1294 /* TODO. We should be able to replace this entire function body
1295 * with
1296 * perf_pmu_pop_buffer_state();
1297 * perf_pmu_push_buffer_state(new_buffer);
1298 */
1299 perf_pmu_ensure_buffer_stack ();
1300 if ( YY_CURRENT_BUFFER == new_buffer )
1301 return;
1302
1303 if ( YY_CURRENT_BUFFER )
1304 {
1305 /* Flush out information for old buffer. */
1306 *(yy_c_buf_p) = (yy_hold_char);
1307 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1308 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1309 }
1310
1311 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1312 perf_pmu__load_buffer_state( );
1313
1314 /* We don't actually know whether we did this switch during
1315 * EOF (perf_pmu_wrap()) processing, but the only time this flag
1316 * is looked at is after perf_pmu_wrap() is called, so it's safe
1317 * to go ahead and always set it.
1318 */
1319 (yy_did_buffer_switch_on_eof) = 1;
1320 }
1321
perf_pmu__load_buffer_state(void)1322 static void perf_pmu__load_buffer_state (void)
1323 {
1324 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1325 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1326 perf_pmu_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1327 (yy_hold_char) = *(yy_c_buf_p);
1328 }
1329
1330 /** Allocate and initialize an input buffer state.
1331 * @param file A readable stream.
1332 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1333 *
1334 * @return the allocated buffer state.
1335 */
perf_pmu__create_buffer(FILE * file,int size)1336 YY_BUFFER_STATE perf_pmu__create_buffer (FILE * file, int size )
1337 {
1338 YY_BUFFER_STATE b;
1339
1340 b = (YY_BUFFER_STATE) perf_pmu_alloc(sizeof( struct yy_buffer_state ) );
1341 if ( ! b )
1342 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__create_buffer()" );
1343
1344 b->yy_buf_size = size;
1345
1346 /* yy_ch_buf has to be 2 characters longer than the size given because
1347 * we need to put in 2 end-of-buffer characters.
1348 */
1349 b->yy_ch_buf = (char *) perf_pmu_alloc(b->yy_buf_size + 2 );
1350 if ( ! b->yy_ch_buf )
1351 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__create_buffer()" );
1352
1353 b->yy_is_our_buffer = 1;
1354
1355 perf_pmu__init_buffer(b,file );
1356
1357 return b;
1358 }
1359
1360 /** Destroy the buffer.
1361 * @param b a buffer created with perf_pmu__create_buffer()
1362 *
1363 */
perf_pmu__delete_buffer(YY_BUFFER_STATE b)1364 void perf_pmu__delete_buffer (YY_BUFFER_STATE b )
1365 {
1366
1367 if ( ! b )
1368 return;
1369
1370 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1371 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1372
1373 if ( b->yy_is_our_buffer )
1374 perf_pmu_free((void *) b->yy_ch_buf );
1375
1376 perf_pmu_free((void *) b );
1377 }
1378
1379 #ifndef __cplusplus
1380 extern int isatty (int );
1381 #endif /* __cplusplus */
1382
1383 /* Initializes or reinitializes a buffer.
1384 * This function is sometimes called more than once on the same buffer,
1385 * such as during a perf_pmu_restart() or at EOF.
1386 */
perf_pmu__init_buffer(YY_BUFFER_STATE b,FILE * file)1387 static void perf_pmu__init_buffer (YY_BUFFER_STATE b, FILE * file )
1388
1389 {
1390 int oerrno = errno;
1391
1392 perf_pmu__flush_buffer(b );
1393
1394 b->yy_input_file = file;
1395 b->yy_fill_buffer = 1;
1396
1397 /* If b is the current buffer, then perf_pmu__init_buffer was _probably_
1398 * called from perf_pmu_restart() or through yy_get_next_buffer.
1399 * In that case, we don't want to reset the lineno or column.
1400 */
1401 if (b != YY_CURRENT_BUFFER){
1402 b->yy_bs_lineno = 1;
1403 b->yy_bs_column = 0;
1404 }
1405
1406 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1407
1408 errno = oerrno;
1409 }
1410
1411 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1412 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1413 *
1414 */
perf_pmu__flush_buffer(YY_BUFFER_STATE b)1415 void perf_pmu__flush_buffer (YY_BUFFER_STATE b )
1416 {
1417 if ( ! b )
1418 return;
1419
1420 b->yy_n_chars = 0;
1421
1422 /* We always need two end-of-buffer characters. The first causes
1423 * a transition to the end-of-buffer state. The second causes
1424 * a jam in that state.
1425 */
1426 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1427 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1428
1429 b->yy_buf_pos = &b->yy_ch_buf[0];
1430
1431 b->yy_at_bol = 1;
1432 b->yy_buffer_status = YY_BUFFER_NEW;
1433
1434 if ( b == YY_CURRENT_BUFFER )
1435 perf_pmu__load_buffer_state( );
1436 }
1437
1438 /** Pushes the new state onto the stack. The new state becomes
1439 * the current state. This function will allocate the stack
1440 * if necessary.
1441 * @param new_buffer The new state.
1442 *
1443 */
perf_pmu_push_buffer_state(YY_BUFFER_STATE new_buffer)1444 void perf_pmu_push_buffer_state (YY_BUFFER_STATE new_buffer )
1445 {
1446 if (new_buffer == NULL)
1447 return;
1448
1449 perf_pmu_ensure_buffer_stack();
1450
1451 /* This block is copied from perf_pmu__switch_to_buffer. */
1452 if ( YY_CURRENT_BUFFER )
1453 {
1454 /* Flush out information for old buffer. */
1455 *(yy_c_buf_p) = (yy_hold_char);
1456 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1457 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1458 }
1459
1460 /* Only push if top exists. Otherwise, replace top. */
1461 if (YY_CURRENT_BUFFER)
1462 (yy_buffer_stack_top)++;
1463 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1464
1465 /* copied from perf_pmu__switch_to_buffer. */
1466 perf_pmu__load_buffer_state( );
1467 (yy_did_buffer_switch_on_eof) = 1;
1468 }
1469
1470 /** Removes and deletes the top of the stack, if present.
1471 * The next element becomes the new top.
1472 *
1473 */
perf_pmu_pop_buffer_state(void)1474 void perf_pmu_pop_buffer_state (void)
1475 {
1476 if (!YY_CURRENT_BUFFER)
1477 return;
1478
1479 perf_pmu__delete_buffer(YY_CURRENT_BUFFER );
1480 YY_CURRENT_BUFFER_LVALUE = NULL;
1481 if ((yy_buffer_stack_top) > 0)
1482 --(yy_buffer_stack_top);
1483
1484 if (YY_CURRENT_BUFFER) {
1485 perf_pmu__load_buffer_state( );
1486 (yy_did_buffer_switch_on_eof) = 1;
1487 }
1488 }
1489
1490 /* Allocates the stack if it does not exist.
1491 * Guarantees space for at least one push.
1492 */
perf_pmu_ensure_buffer_stack(void)1493 static void perf_pmu_ensure_buffer_stack (void)
1494 {
1495 int num_to_alloc;
1496
1497 if (!(yy_buffer_stack)) {
1498
1499 /* First allocation is just for 2 elements, since we don't know if this
1500 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1501 * immediate realloc on the next call.
1502 */
1503 num_to_alloc = 1;
1504 (yy_buffer_stack) = (struct yy_buffer_state**)perf_pmu_alloc
1505 (num_to_alloc * sizeof(struct yy_buffer_state*)
1506 );
1507 if ( ! (yy_buffer_stack) )
1508 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu_ensure_buffer_stack()" );
1509
1510 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1511
1512 (yy_buffer_stack_max) = num_to_alloc;
1513 (yy_buffer_stack_top) = 0;
1514 return;
1515 }
1516
1517 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1518
1519 /* Increase the buffer to prepare for a possible push. */
1520 int grow_size = 8 /* arbitrary grow size */;
1521
1522 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1523 (yy_buffer_stack) = (struct yy_buffer_state**)perf_pmu_realloc
1524 ((yy_buffer_stack),
1525 num_to_alloc * sizeof(struct yy_buffer_state*)
1526 );
1527 if ( ! (yy_buffer_stack) )
1528 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu_ensure_buffer_stack()" );
1529
1530 /* zero only the new slots.*/
1531 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1532 (yy_buffer_stack_max) = num_to_alloc;
1533 }
1534 }
1535
1536 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1537 * @param base the character buffer
1538 * @param size the size in bytes of the character buffer
1539 *
1540 * @return the newly allocated buffer state object.
1541 */
perf_pmu__scan_buffer(char * base,yy_size_t size)1542 YY_BUFFER_STATE perf_pmu__scan_buffer (char * base, yy_size_t size )
1543 {
1544 YY_BUFFER_STATE b;
1545
1546 if ( size < 2 ||
1547 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1548 base[size-1] != YY_END_OF_BUFFER_CHAR )
1549 /* They forgot to leave room for the EOB's. */
1550 return 0;
1551
1552 b = (YY_BUFFER_STATE) perf_pmu_alloc(sizeof( struct yy_buffer_state ) );
1553 if ( ! b )
1554 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__scan_buffer()" );
1555
1556 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1557 b->yy_buf_pos = b->yy_ch_buf = base;
1558 b->yy_is_our_buffer = 0;
1559 b->yy_input_file = 0;
1560 b->yy_n_chars = b->yy_buf_size;
1561 b->yy_is_interactive = 0;
1562 b->yy_at_bol = 1;
1563 b->yy_fill_buffer = 0;
1564 b->yy_buffer_status = YY_BUFFER_NEW;
1565
1566 perf_pmu__switch_to_buffer(b );
1567
1568 return b;
1569 }
1570
1571 /** Setup the input buffer state to scan a string. The next call to perf_pmu_lex() will
1572 * scan from a @e copy of @a str.
1573 * @param yystr a NUL-terminated string to scan
1574 *
1575 * @return the newly allocated buffer state object.
1576 * @note If you want to scan bytes that may contain NUL values, then use
1577 * perf_pmu__scan_bytes() instead.
1578 */
perf_pmu__scan_string(yyconst char * yystr)1579 YY_BUFFER_STATE perf_pmu__scan_string (yyconst char * yystr )
1580 {
1581
1582 return perf_pmu__scan_bytes(yystr,strlen(yystr) );
1583 }
1584
1585 /** Setup the input buffer state to scan the given bytes. The next call to perf_pmu_lex() will
1586 * scan from a @e copy of @a bytes.
1587 * @param yybytes the byte buffer to scan
1588 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1589 *
1590 * @return the newly allocated buffer state object.
1591 */
perf_pmu__scan_bytes(yyconst char * yybytes,int _yybytes_len)1592 YY_BUFFER_STATE perf_pmu__scan_bytes (yyconst char * yybytes, int _yybytes_len )
1593 {
1594 YY_BUFFER_STATE b;
1595 char *buf;
1596 yy_size_t n;
1597 int i;
1598
1599 /* Get memory for full buffer, including space for trailing EOB's. */
1600 n = _yybytes_len + 2;
1601 buf = (char *) perf_pmu_alloc(n );
1602 if ( ! buf )
1603 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__scan_bytes()" );
1604
1605 for ( i = 0; i < _yybytes_len; ++i )
1606 buf[i] = yybytes[i];
1607
1608 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1609
1610 b = perf_pmu__scan_buffer(buf,n );
1611 if ( ! b )
1612 YY_FATAL_ERROR( "bad buffer in perf_pmu__scan_bytes()" );
1613
1614 /* It's okay to grow etc. this buffer, and we should throw it
1615 * away when we're done.
1616 */
1617 b->yy_is_our_buffer = 1;
1618
1619 return b;
1620 }
1621
1622 #ifndef YY_EXIT_FAILURE
1623 #define YY_EXIT_FAILURE 2
1624 #endif
1625
yy_fatal_error(yyconst char * msg)1626 static void yy_fatal_error (yyconst char* msg )
1627 {
1628 (void) fprintf( stderr, "%s\n", msg );
1629 exit( YY_EXIT_FAILURE );
1630 }
1631
1632 /* Redefine yyless() so it works in section 3 code. */
1633
1634 #undef yyless
1635 #define yyless(n) \
1636 do \
1637 { \
1638 /* Undo effects of setting up perf_pmu_text. */ \
1639 int yyless_macro_arg = (n); \
1640 YY_LESS_LINENO(yyless_macro_arg);\
1641 perf_pmu_text[perf_pmu_leng] = (yy_hold_char); \
1642 (yy_c_buf_p) = perf_pmu_text + yyless_macro_arg; \
1643 (yy_hold_char) = *(yy_c_buf_p); \
1644 *(yy_c_buf_p) = '\0'; \
1645 perf_pmu_leng = yyless_macro_arg; \
1646 } \
1647 while ( 0 )
1648
1649 /* Accessor methods (get/set functions) to struct members. */
1650
1651 /** Get the current line number.
1652 *
1653 */
perf_pmu_get_lineno(void)1654 int perf_pmu_get_lineno (void)
1655 {
1656
1657 return perf_pmu_lineno;
1658 }
1659
1660 /** Get the input stream.
1661 *
1662 */
perf_pmu_get_in(void)1663 FILE *perf_pmu_get_in (void)
1664 {
1665 return perf_pmu_in;
1666 }
1667
1668 /** Get the output stream.
1669 *
1670 */
perf_pmu_get_out(void)1671 FILE *perf_pmu_get_out (void)
1672 {
1673 return perf_pmu_out;
1674 }
1675
1676 /** Get the length of the current token.
1677 *
1678 */
perf_pmu_get_leng(void)1679 int perf_pmu_get_leng (void)
1680 {
1681 return perf_pmu_leng;
1682 }
1683
1684 /** Get the current token.
1685 *
1686 */
1687
perf_pmu_get_text(void)1688 char *perf_pmu_get_text (void)
1689 {
1690 return perf_pmu_text;
1691 }
1692
1693 /** Set the current line number.
1694 * @param line_number
1695 *
1696 */
perf_pmu_set_lineno(int line_number)1697 void perf_pmu_set_lineno (int line_number )
1698 {
1699
1700 perf_pmu_lineno = line_number;
1701 }
1702
1703 /** Set the input stream. This does not discard the current
1704 * input buffer.
1705 * @param in_str A readable stream.
1706 *
1707 * @see perf_pmu__switch_to_buffer
1708 */
perf_pmu_set_in(FILE * in_str)1709 void perf_pmu_set_in (FILE * in_str )
1710 {
1711 perf_pmu_in = in_str ;
1712 }
1713
perf_pmu_set_out(FILE * out_str)1714 void perf_pmu_set_out (FILE * out_str )
1715 {
1716 perf_pmu_out = out_str ;
1717 }
1718
perf_pmu_get_debug(void)1719 int perf_pmu_get_debug (void)
1720 {
1721 return perf_pmu__flex_debug;
1722 }
1723
perf_pmu_set_debug(int bdebug)1724 void perf_pmu_set_debug (int bdebug )
1725 {
1726 perf_pmu__flex_debug = bdebug ;
1727 }
1728
yy_init_globals(void)1729 static int yy_init_globals (void)
1730 {
1731 /* Initialization is the same as for the non-reentrant scanner.
1732 * This function is called from perf_pmu_lex_destroy(), so don't allocate here.
1733 */
1734
1735 (yy_buffer_stack) = 0;
1736 (yy_buffer_stack_top) = 0;
1737 (yy_buffer_stack_max) = 0;
1738 (yy_c_buf_p) = (char *) 0;
1739 (yy_init) = 0;
1740 (yy_start) = 0;
1741
1742 /* Defined in main.c */
1743 #ifdef YY_STDINIT
1744 perf_pmu_in = stdin;
1745 perf_pmu_out = stdout;
1746 #else
1747 perf_pmu_in = (FILE *) 0;
1748 perf_pmu_out = (FILE *) 0;
1749 #endif
1750
1751 /* For future reference: Set errno on error, since we are called by
1752 * perf_pmu_lex_init()
1753 */
1754 return 0;
1755 }
1756
1757 /* perf_pmu_lex_destroy is for both reentrant and non-reentrant scanners. */
perf_pmu_lex_destroy(void)1758 int perf_pmu_lex_destroy (void)
1759 {
1760
1761 /* Pop the buffer stack, destroying each element. */
1762 while(YY_CURRENT_BUFFER){
1763 perf_pmu__delete_buffer(YY_CURRENT_BUFFER );
1764 YY_CURRENT_BUFFER_LVALUE = NULL;
1765 perf_pmu_pop_buffer_state();
1766 }
1767
1768 /* Destroy the stack itself. */
1769 perf_pmu_free((yy_buffer_stack) );
1770 (yy_buffer_stack) = NULL;
1771
1772 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1773 * perf_pmu_lex() is called, initialization will occur. */
1774 yy_init_globals( );
1775
1776 return 0;
1777 }
1778
1779 /*
1780 * Internal utility routines.
1781 */
1782
1783 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,yyconst char * s2,int n)1784 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1785 {
1786 register int i;
1787 for ( i = 0; i < n; ++i )
1788 s1[i] = s2[i];
1789 }
1790 #endif
1791
1792 #ifdef YY_NEED_STRLEN
yy_flex_strlen(yyconst char * s)1793 static int yy_flex_strlen (yyconst char * s )
1794 {
1795 register int n;
1796 for ( n = 0; s[n]; ++n )
1797 ;
1798
1799 return n;
1800 }
1801 #endif
1802
perf_pmu_alloc(yy_size_t size)1803 void *perf_pmu_alloc (yy_size_t size )
1804 {
1805 return (void *) malloc( size );
1806 }
1807
perf_pmu_realloc(void * ptr,yy_size_t size)1808 void *perf_pmu_realloc (void * ptr, yy_size_t size )
1809 {
1810 /* The cast to (char *) in the following accommodates both
1811 * implementations that use char* generic pointers, and those
1812 * that use void* generic pointers. It works with the latter
1813 * because both ANSI C and C++ allow castless assignment from
1814 * any pointer type to void*, and deal with argument conversions
1815 * as though doing an assignment.
1816 */
1817 return (void *) realloc( (char *) ptr, size );
1818 }
1819
perf_pmu_free(void * ptr)1820 void perf_pmu_free (void * ptr )
1821 {
1822 free( (char *) ptr ); /* see perf_pmu_realloc() for (char *) cast */
1823 }
1824
1825 #define YYTABLES_NAME "yytables"
1826
1827 #line 38 "util/pmu.l"
1828
1829
1830
perf_pmu_wrap(void)1831 int perf_pmu_wrap(void)
1832 {
1833 return 1;
1834 }
1835
1836