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