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