4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
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
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
35 /* First, we deal with platform-specific or compiler-specific issues. */
37 /* begin standard C headers. */
43 /* end standard C headers. */
45 /* flex integer type definitions */
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
77 /* Limits of integral types. */
79 #define INT8_MIN (-128)
82 #define INT16_MIN (-32767-1)
85 #define INT32_MIN (-2147483647-1)
88 #define INT8_MAX (127)
91 #define INT16_MAX (32767)
94 #define INT32_MAX (2147483647)
97 #define UINT8_MAX (255U)
100 #define UINT16_MAX (65535U)
103 #define UINT32_MAX (4294967295U)
106 #endif /* ! FLEXINT_H */
110 /* The "const" storage-class-modifier is valid. */
113 #else /* ! __cplusplus */
115 /* C99 requires __STDC__ to be defined as 1. */
116 #if defined (__STDC__)
120 #endif /* defined (__STDC__) */
121 #endif /* ! __cplusplus */
124 #define yyconst const
129 /* Returned upon end-of-file. */
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
137 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
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.
143 #define BEGIN (yy_start) = 1 + 2 *
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
149 #define YY_START (((yy_start) - 1) / 2)
150 #define YYSTATE YY_START
152 /* Action number for EOF rule of a given start state. */
153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155 /* Special action meaning "start processing a new file". */
156 #define YY_NEW_FILE perf_pmu_restart(perf_pmu_in )
158 #define YY_END_OF_BUFFER_CHAR 0
160 /* Size of default input buffer. */
162 #define YY_BUF_SIZE 16384
165 /* The state buf must be large enough to hold one state per character in the main buffer.
167 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
169 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
170 #define YY_TYPEDEF_YY_BUFFER_STATE
171 typedef struct yy_buffer_state *YY_BUFFER_STATE;
174 extern int perf_pmu_leng;
176 extern FILE *perf_pmu_in, *perf_pmu_out;
178 #define EOB_ACT_CONTINUE_SCAN 0
179 #define EOB_ACT_END_OF_FILE 1
180 #define EOB_ACT_LAST_MATCH 2
182 #define YY_LESS_LINENO(n)
184 /* Return all but the first "n" matched characters back to the input stream. */
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 */ \
198 #define unput(c) yyunput( c, (yytext_ptr) )
200 #ifndef YY_TYPEDEF_YY_SIZE_T
201 #define YY_TYPEDEF_YY_SIZE_T
202 typedef size_t yy_size_t;
205 #ifndef YY_STRUCT_YY_BUFFER_STATE
206 #define YY_STRUCT_YY_BUFFER_STATE
207 struct yy_buffer_state
211 char *yy_ch_buf; /* input buffer */
212 char *yy_buf_pos; /* current position in input buffer */
214 /* Size of input buffer in bytes, not including room for EOB
217 yy_size_t yy_buf_size;
219 /* Number of characters read into yy_ch_buf, not including EOB
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
228 int yy_is_our_buffer;
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
235 int yy_is_interactive;
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
243 int yy_bs_lineno; /**< The line count. */
244 int yy_bs_column; /**< The column count. */
246 /* Whether to try to fill the input buffer when we reach the
251 int yy_buffer_status;
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.
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.
265 #define YY_BUFFER_EOF_PENDING 2
268 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
270 /* Stack of input buffers. */
271 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
272 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
273 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
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
279 * Returns the top of the stack, or NULL.
281 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
282 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
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.
288 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
290 /* yy_hold_char holds the character lost when perf_pmu_text is formed. */
291 static char yy_hold_char;
292 static int yy_n_chars; /* number of characters read into yy_ch_buf */
295 /* Points to current character in buffer. */
296 static char *yy_c_buf_p = (char *) 0;
297 static int yy_init = 0; /* whether we need to initialize */
298 static int yy_start = 0; /* start state number */
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 ...
303 static int yy_did_buffer_switch_on_eof;
305 void perf_pmu_restart (FILE *input_file );
306 void perf_pmu__switch_to_buffer (YY_BUFFER_STATE new_buffer );
307 YY_BUFFER_STATE perf_pmu__create_buffer (FILE *file,int size );
308 void perf_pmu__delete_buffer (YY_BUFFER_STATE b );
309 void perf_pmu__flush_buffer (YY_BUFFER_STATE b );
310 void perf_pmu_push_buffer_state (YY_BUFFER_STATE new_buffer );
311 void perf_pmu_pop_buffer_state (void );
313 static void perf_pmu_ensure_buffer_stack (void );
314 static void perf_pmu__load_buffer_state (void );
315 static void perf_pmu__init_buffer (YY_BUFFER_STATE b,FILE *file );
317 #define YY_FLUSH_BUFFER perf_pmu__flush_buffer(YY_CURRENT_BUFFER )
319 YY_BUFFER_STATE perf_pmu__scan_buffer (char *base,yy_size_t size );
320 YY_BUFFER_STATE perf_pmu__scan_string (yyconst char *yy_str );
321 YY_BUFFER_STATE perf_pmu__scan_bytes (yyconst char *bytes,int len );
323 void *perf_pmu_alloc (yy_size_t );
324 void *perf_pmu_realloc (void *,yy_size_t );
325 void perf_pmu_free (void * );
327 #define yy_new_buffer perf_pmu__create_buffer
329 #define yy_set_interactive(is_interactive) \
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 ); \
336 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
339 #define yy_set_bol(at_bol) \
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 ); \
346 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
349 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
351 /* Begin user sect3 */
353 typedef unsigned char YY_CHAR;
355 FILE *perf_pmu_in = (FILE *) 0, *perf_pmu_out = (FILE *) 0;
357 typedef int yy_state_type;
359 extern int perf_pmu_lineno;
361 int perf_pmu_lineno = 1;
363 extern char *perf_pmu_text;
364 #define yytext_ptr perf_pmu_text
366 static yy_state_type yy_get_previous_state (void );
367 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
368 static int yy_get_next_buffer (void );
369 static void yy_fatal_error (yyconst char msg[] );
371 /* Done after the current pattern has been matched and before the
372 * corresponding action - sets up perf_pmu_text.
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; \
379 (yy_c_buf_p) = yy_cp;
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. */
387 flex_int32_t yy_verify;
390 static yyconst flex_int16_t yy_accept[20] =
392 0, 0, 11, 8, 9, 7, 5, 1, 6, 8,
393 1, 0, 0, 0, 0, 2, 3, 4, 0
396 static yyconst flex_int32_t yy_ec[256] =
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,
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,
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,
428 static yyconst flex_int32_t yy_meta[15] =
430 1, 1, 1, 1, 2, 2, 2, 1, 1, 1,
434 static yyconst flex_int16_t yy_base[21] =
436 0, 0, 23, 24, 24, 24, 24, 0, 24, 8,
437 0, 8, 10, 7, 7, 9, 24, 24, 24, 15
440 static yyconst flex_int16_t yy_def[21] =
442 19, 1, 19, 19, 19, 19, 19, 20, 19, 19,
443 20, 19, 19, 19, 19, 19, 19, 19, 0, 19
446 static yyconst flex_int16_t yy_nxt[39] =
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
454 static yyconst flex_int16_t yy_chk[39] =
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
462 static yy_state_type yy_last_accepting_state;
463 static char *yy_last_accepting_cpos;
465 extern int perf_pmu__flex_debug;
466 int perf_pmu__flex_debug = 0;
468 /* The intent behind this definition is that it'll catch
469 * any uses of REJECT which flex missed.
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
479 #include <linux/bitops.h>
481 #include "pmu-bison.h"
483 static int value(int base)
488 num = strtoul(perf_pmu_text, NULL, base);
492 perf_pmu_lval.num = num;
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.
508 #ifndef YY_EXTRA_TYPE
509 #define YY_EXTRA_TYPE void *
512 static int yy_init_globals (void );
514 /* Accessor methods to globals.
515 These are made visible to non-reentrant scanners for convenience. */
517 int perf_pmu_lex_destroy (void );
519 int perf_pmu_get_debug (void );
521 void perf_pmu_set_debug (int debug_flag );
523 YY_EXTRA_TYPE perf_pmu_get_extra (void );
525 void perf_pmu_set_extra (YY_EXTRA_TYPE user_defined );
527 FILE *perf_pmu_get_in (void );
529 void perf_pmu_set_in (FILE * in_str );
531 FILE *perf_pmu_get_out (void );
533 void perf_pmu_set_out (FILE * out_str );
535 int perf_pmu_get_leng (void );
537 char *perf_pmu_get_text (void );
539 int perf_pmu_get_lineno (void );
541 void perf_pmu_set_lineno (int line_number );
543 /* Macros after this point can all be overridden by user definitions in
547 #ifndef YY_SKIP_YYWRAP
549 extern "C" int perf_pmu_wrap (void );
551 extern int perf_pmu_wrap (void );
555 static void yyunput (int c,char *buf_ptr );
558 static void yy_flex_strncpy (char *,yyconst char *,int );
561 #ifdef YY_NEED_STRLEN
562 static int yy_flex_strlen (yyconst char * );
568 static int yyinput (void );
570 static int input (void );
575 /* Amount of stuff to slurp up with each read. */
576 #ifndef YY_READ_BUF_SIZE
577 #define YY_READ_BUF_SIZE 8192
580 /* Copy whatever the last rule matched to the standard output. */
582 /* This used to be an fputs(), but since the string might contain NUL's,
583 * we now use fwrite().
585 #define ECHO do { if (fwrite( perf_pmu_text, perf_pmu_leng, 1, perf_pmu_out )) {} } while (0)
588 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
589 * is returned in "result".
592 #define YY_INPUT(buf,result,max_size) \
593 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
597 for ( n = 0; n < max_size && \
598 (c = getc( perf_pmu_in )) != EOF && c != '\n'; ++n ) \
601 buf[n++] = (char) c; \
602 if ( c == EOF && ferror( perf_pmu_in ) ) \
603 YY_FATAL_ERROR( "input in flex scanner failed" ); \
609 while ( (result = fread(buf, 1, max_size, perf_pmu_in))==0 && ferror(perf_pmu_in)) \
611 if( errno != EINTR) \
613 YY_FATAL_ERROR( "input in flex scanner failed" ); \
617 clearerr(perf_pmu_in); \
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.
629 #define yyterminate() return YY_NULL
632 /* Number of entries by which start-condition stack grows. */
633 #ifndef YY_START_STACK_INCR
634 #define YY_START_STACK_INCR 25
637 /* Report a fatal error. */
638 #ifndef YY_FATAL_ERROR
639 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
642 /* end tables serialization structures and prototypes */
644 /* Default declaration of generated scanner - a define so the user can
645 * easily add parameters.
648 #define YY_DECL_IS_OURS 1
650 extern int perf_pmu_lex (void);
652 #define YY_DECL int perf_pmu_lex (void)
653 #endif /* !YY_DECL */
655 /* Code executed at the beginning of each rule, after perf_pmu_text and perf_pmu_leng
658 #ifndef YY_USER_ACTION
659 #define YY_USER_ACTION
662 /* Code executed at the end of each rule. */
664 #define YY_BREAK break;
667 #define YY_RULE_SETUP \
670 /** The main scanner function which does all the work.
674 register yy_state_type yy_current_state;
675 register char *yy_cp, *yy_bp;
678 #line 26 "util/pmu.l"
692 (yy_start) = 1; /* first start state */
697 if ( ! perf_pmu_out )
698 perf_pmu_out = stdout;
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 );
706 perf_pmu__load_buffer_state( );
709 while ( 1 ) /* loops until end-of-file is reached */
711 yy_cp = (yy_c_buf_p);
713 /* Support of perf_pmu_text. */
714 *yy_cp = (yy_hold_char);
716 /* yy_bp points to the position in yy_ch_buf of the start of
721 yy_current_state = (yy_start);
725 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
726 if ( yy_accept[yy_current_state] )
728 (yy_last_accepting_state) = yy_current_state;
729 (yy_last_accepting_cpos) = yy_cp;
731 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
737 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
740 while ( yy_base[yy_current_state] != 24 );
743 yy_act = yy_accept[yy_current_state];
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];
753 do_action: /* This label is used only to access EOF actions. */
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);
766 #line 28 "util/pmu.l"
767 { return value(10); }
771 #line 29 "util/pmu.l"
772 { return PP_CONFIG; }
776 #line 30 "util/pmu.l"
777 { return PP_CONFIG1; }
781 #line 31 "util/pmu.l"
782 { return PP_CONFIG2; }
786 #line 32 "util/pmu.l"
791 #line 33 "util/pmu.l"
796 #line 34 "util/pmu.l"
801 #line 35 "util/pmu.l"
805 /* rule 9 can match eol */
807 #line 36 "util/pmu.l"
812 #line 38 "util/pmu.l"
816 case YY_STATE_EOF(INITIAL):
819 case YY_END_OF_BUFFER:
821 /* Amount of text matched not including the EOB char. */
822 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
824 /* Undo the effects of YY_DO_BEFORE_ACTION. */
825 *yy_cp = (yy_hold_char);
826 YY_RESTORE_YY_MORE_OFFSET
828 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
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.
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;
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
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;
855 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
857 yy_current_state = yy_get_previous_state( );
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).
868 yy_next_state = yy_try_NUL_trans( yy_current_state );
870 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
874 /* Consume the NUL. */
875 yy_cp = ++(yy_c_buf_p);
876 yy_current_state = yy_next_state;
882 yy_cp = (yy_c_buf_p);
887 else switch ( yy_get_next_buffer( ) )
889 case EOB_ACT_END_OF_FILE:
891 (yy_did_buffer_switch_on_eof) = 0;
893 if ( perf_pmu_wrap( ) )
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.
904 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
906 yy_act = YY_STATE_EOF(YY_START);
912 if ( ! (yy_did_buffer_switch_on_eof) )
918 case EOB_ACT_CONTINUE_SCAN:
920 (yytext_ptr) + yy_amount_of_matched_text;
922 yy_current_state = yy_get_previous_state( );
924 yy_cp = (yy_c_buf_p);
925 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
928 case EOB_ACT_LAST_MATCH:
930 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
932 yy_current_state = yy_get_previous_state( );
934 yy_cp = (yy_c_buf_p);
935 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
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 */
948 /* yy_get_next_buffer - try to read in a new buffer
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
955 static int yy_get_next_buffer (void)
957 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
958 register char *source = (yytext_ptr);
959 register int number_to_move, i;
962 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
964 "fatal flex scanner internal error--end of buffer missed" );
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 )
970 /* We matched a single character, the EOB, so
971 * treat this as a final EOF.
973 return EOB_ACT_END_OF_FILE;
978 /* We matched some text prior to the EOB, first
981 return EOB_ACT_LAST_MATCH;
985 /* Try to read more data. */
987 /* First move last chars to start of buffer. */
988 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
990 for ( i = 0; i < number_to_move; ++i )
991 *(dest++) = *(source++);
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,
997 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1002 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1004 while ( num_to_read <= 0 )
1005 { /* Not enough room in the buffer - grow it. */
1007 /* just a shorter name for the current buffer */
1008 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1010 int yy_c_buf_p_offset =
1011 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1013 if ( b->yy_is_our_buffer )
1015 int new_size = b->yy_buf_size * 2;
1017 if ( new_size <= 0 )
1018 b->yy_buf_size += b->yy_buf_size / 8;
1020 b->yy_buf_size *= 2;
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 );
1027 /* Can't grow it, we don't own it. */
1030 if ( ! b->yy_ch_buf )
1032 "fatal error - scanner input buffer overflow" );
1034 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1036 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1041 if ( num_to_read > YY_READ_BUF_SIZE )
1042 num_to_read = YY_READ_BUF_SIZE;
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 );
1048 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1051 if ( (yy_n_chars) == 0 )
1053 if ( number_to_move == YY_MORE_ADJ )
1055 ret_val = EOB_ACT_END_OF_FILE;
1056 perf_pmu_restart(perf_pmu_in );
1061 ret_val = EOB_ACT_LAST_MATCH;
1062 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1063 YY_BUFFER_EOF_PENDING;
1068 ret_val = EOB_ACT_CONTINUE_SCAN;
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()" );
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;
1082 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1087 /* yy_get_previous_state - get the state just before the EOB char was reached */
1089 static yy_state_type yy_get_previous_state (void)
1091 register yy_state_type yy_current_state;
1092 register char *yy_cp;
1094 yy_current_state = (yy_start);
1096 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1098 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1099 if ( yy_accept[yy_current_state] )
1101 (yy_last_accepting_state) = yy_current_state;
1102 (yy_last_accepting_cpos) = yy_cp;
1104 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
1110 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1113 return yy_current_state;
1116 /* yy_try_NUL_trans - try to make a transition on the NUL character
1119 * next_state = yy_try_NUL_trans( current_state );
1121 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1123 register int yy_is_jam;
1124 register char *yy_cp = (yy_c_buf_p);
1126 register YY_CHAR yy_c = 1;
1127 if ( yy_accept[yy_current_state] )
1129 (yy_last_accepting_state) = yy_current_state;
1130 (yy_last_accepting_cpos) = yy_cp;
1132 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
1138 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1139 yy_is_jam = (yy_current_state == 19);
1141 return yy_is_jam ? 0 : yy_current_state;
1144 static void yyunput (int c, register char * yy_bp )
1146 register char *yy_cp;
1148 yy_cp = (yy_c_buf_p);
1150 /* undo effects of setting up perf_pmu_text */
1151 *yy_cp = (yy_hold_char);
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];
1162 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1163 *--dest = *--source;
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;
1170 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1171 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1174 *--yy_cp = (char) c;
1176 (yytext_ptr) = yy_bp;
1177 (yy_hold_char) = *yy_cp;
1178 (yy_c_buf_p) = yy_cp;
1183 static int yyinput (void)
1185 static int input (void)
1191 *(yy_c_buf_p) = (yy_hold_char);
1193 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
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.
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';
1204 { /* need more input */
1205 int offset = (yy_c_buf_p) - (yytext_ptr);
1208 switch ( yy_get_next_buffer( ) )
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.
1221 /* Reset buffer status. */
1222 perf_pmu_restart(perf_pmu_in );
1226 case EOB_ACT_END_OF_FILE:
1228 if ( perf_pmu_wrap( ) )
1231 if ( ! (yy_did_buffer_switch_on_eof) )
1240 case EOB_ACT_CONTINUE_SCAN:
1241 (yy_c_buf_p) = (yytext_ptr) + offset;
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);
1253 #endif /* ifndef YY_NO_INPUT */
1255 /** Immediately switch to a different input stream.
1256 * @param input_file A readable stream.
1258 * @note This function does not reset the start condition to @c INITIAL .
1260 void perf_pmu_restart (FILE * input_file )
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 );
1269 perf_pmu__init_buffer(YY_CURRENT_BUFFER,input_file );
1270 perf_pmu__load_buffer_state( );
1273 /** Switch to a different input buffer.
1274 * @param new_buffer The new input buffer.
1277 void perf_pmu__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1280 /* TODO. We should be able to replace this entire function body
1282 * perf_pmu_pop_buffer_state();
1283 * perf_pmu_push_buffer_state(new_buffer);
1285 perf_pmu_ensure_buffer_stack ();
1286 if ( YY_CURRENT_BUFFER == new_buffer )
1289 if ( YY_CURRENT_BUFFER )
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);
1297 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1298 perf_pmu__load_buffer_state( );
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.
1305 (yy_did_buffer_switch_on_eof) = 1;
1308 static void perf_pmu__load_buffer_state (void)
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);
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.
1320 * @return the allocated buffer state.
1322 YY_BUFFER_STATE perf_pmu__create_buffer (FILE * file, int size )
1326 b = (YY_BUFFER_STATE) perf_pmu_alloc(sizeof( struct yy_buffer_state ) );
1328 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__create_buffer()" );
1330 b->yy_buf_size = size;
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.
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()" );
1339 b->yy_is_our_buffer = 1;
1341 perf_pmu__init_buffer(b,file );
1346 /** Destroy the buffer.
1347 * @param b a buffer created with perf_pmu__create_buffer()
1350 void perf_pmu__delete_buffer (YY_BUFFER_STATE b )
1356 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1357 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1359 if ( b->yy_is_our_buffer )
1360 perf_pmu_free((void *) b->yy_ch_buf );
1362 perf_pmu_free((void *) b );
1366 extern int isatty (int );
1367 #endif /* __cplusplus */
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.
1373 static void perf_pmu__init_buffer (YY_BUFFER_STATE b, FILE * file )
1378 perf_pmu__flush_buffer(b );
1380 b->yy_input_file = file;
1381 b->yy_fill_buffer = 1;
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.
1387 if (b != YY_CURRENT_BUFFER){
1388 b->yy_bs_lineno = 1;
1389 b->yy_bs_column = 0;
1392 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
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.
1401 void perf_pmu__flush_buffer (YY_BUFFER_STATE b )
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.
1412 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1413 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1415 b->yy_buf_pos = &b->yy_ch_buf[0];
1418 b->yy_buffer_status = YY_BUFFER_NEW;
1420 if ( b == YY_CURRENT_BUFFER )
1421 perf_pmu__load_buffer_state( );
1424 /** Pushes the new state onto the stack. The new state becomes
1425 * the current state. This function will allocate the stack
1427 * @param new_buffer The new state.
1430 void perf_pmu_push_buffer_state (YY_BUFFER_STATE new_buffer )
1432 if (new_buffer == NULL)
1435 perf_pmu_ensure_buffer_stack();
1437 /* This block is copied from perf_pmu__switch_to_buffer. */
1438 if ( YY_CURRENT_BUFFER )
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);
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;
1451 /* copied from perf_pmu__switch_to_buffer. */
1452 perf_pmu__load_buffer_state( );
1453 (yy_did_buffer_switch_on_eof) = 1;
1456 /** Removes and deletes the top of the stack, if present.
1457 * The next element becomes the new top.
1460 void perf_pmu_pop_buffer_state (void)
1462 if (!YY_CURRENT_BUFFER)
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);
1470 if (YY_CURRENT_BUFFER) {
1471 perf_pmu__load_buffer_state( );
1472 (yy_did_buffer_switch_on_eof) = 1;
1476 /* Allocates the stack if it does not exist.
1477 * Guarantees space for at least one push.
1479 static void perf_pmu_ensure_buffer_stack (void)
1483 if (!(yy_buffer_stack)) {
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.
1490 (yy_buffer_stack) = (struct yy_buffer_state**)perf_pmu_alloc
1491 (num_to_alloc * sizeof(struct yy_buffer_state*)
1493 if ( ! (yy_buffer_stack) )
1494 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu_ensure_buffer_stack()" );
1496 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1498 (yy_buffer_stack_max) = num_to_alloc;
1499 (yy_buffer_stack_top) = 0;
1503 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1505 /* Increase the buffer to prepare for a possible push. */
1506 int grow_size = 8 /* arbitrary grow size */;
1508 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1509 (yy_buffer_stack) = (struct yy_buffer_state**)perf_pmu_realloc
1511 num_to_alloc * sizeof(struct yy_buffer_state*)
1513 if ( ! (yy_buffer_stack) )
1514 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu_ensure_buffer_stack()" );
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;
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
1526 * @return the newly allocated buffer state object.
1528 YY_BUFFER_STATE perf_pmu__scan_buffer (char * base, yy_size_t size )
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. */
1538 b = (YY_BUFFER_STATE) perf_pmu_alloc(sizeof( struct yy_buffer_state ) );
1540 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__scan_buffer()" );
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;
1549 b->yy_fill_buffer = 0;
1550 b->yy_buffer_status = YY_BUFFER_NEW;
1552 perf_pmu__switch_to_buffer(b );
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
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.
1565 YY_BUFFER_STATE perf_pmu__scan_string (yyconst char * yystr )
1568 return perf_pmu__scan_bytes(yystr,strlen(yystr) );
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.
1576 * @return the newly allocated buffer state object.
1578 YY_BUFFER_STATE perf_pmu__scan_bytes (yyconst char * yybytes, int _yybytes_len )
1585 /* Get memory for full buffer, including space for trailing EOB's. */
1586 n = _yybytes_len + 2;
1587 buf = (char *) perf_pmu_alloc(n );
1589 YY_FATAL_ERROR( "out of dynamic memory in perf_pmu__scan_bytes()" );
1591 for ( i = 0; i < _yybytes_len; ++i )
1592 buf[i] = yybytes[i];
1594 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1596 b = perf_pmu__scan_buffer(buf,n );
1598 YY_FATAL_ERROR( "bad buffer in perf_pmu__scan_bytes()" );
1600 /* It's okay to grow etc. this buffer, and we should throw it
1601 * away when we're done.
1603 b->yy_is_our_buffer = 1;
1608 #ifndef YY_EXIT_FAILURE
1609 #define YY_EXIT_FAILURE 2
1612 static void yy_fatal_error (yyconst char* msg )
1614 (void) fprintf( stderr, "%s\n", msg );
1615 exit( YY_EXIT_FAILURE );
1618 /* Redefine yyless() so it works in section 3 code. */
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; \
1635 /* Accessor methods (get/set functions) to struct members. */
1637 /** Get the current line number.
1640 int perf_pmu_get_lineno (void)
1643 return perf_pmu_lineno;
1646 /** Get the input stream.
1649 FILE *perf_pmu_get_in (void)
1654 /** Get the output stream.
1657 FILE *perf_pmu_get_out (void)
1659 return perf_pmu_out;
1662 /** Get the length of the current token.
1665 int perf_pmu_get_leng (void)
1667 return perf_pmu_leng;
1670 /** Get the current token.
1674 char *perf_pmu_get_text (void)
1676 return perf_pmu_text;
1679 /** Set the current line number.
1680 * @param line_number
1683 void perf_pmu_set_lineno (int line_number )
1686 perf_pmu_lineno = line_number;
1689 /** Set the input stream. This does not discard the current
1691 * @param in_str A readable stream.
1693 * @see perf_pmu__switch_to_buffer
1695 void perf_pmu_set_in (FILE * in_str )
1697 perf_pmu_in = in_str ;
1700 void perf_pmu_set_out (FILE * out_str )
1702 perf_pmu_out = out_str ;
1705 int perf_pmu_get_debug (void)
1707 return perf_pmu__flex_debug;
1710 void perf_pmu_set_debug (int bdebug )
1712 perf_pmu__flex_debug = bdebug ;
1715 static int yy_init_globals (void)
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.
1721 (yy_buffer_stack) = 0;
1722 (yy_buffer_stack_top) = 0;
1723 (yy_buffer_stack_max) = 0;
1724 (yy_c_buf_p) = (char *) 0;
1728 /* Defined in main.c */
1730 perf_pmu_in = stdin;
1731 perf_pmu_out = stdout;
1733 perf_pmu_in = (FILE *) 0;
1734 perf_pmu_out = (FILE *) 0;
1737 /* For future reference: Set errno on error, since we are called by
1738 * perf_pmu_lex_init()
1743 /* perf_pmu_lex_destroy is for both reentrant and non-reentrant scanners. */
1744 int perf_pmu_lex_destroy (void)
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();
1754 /* Destroy the stack itself. */
1755 perf_pmu_free((yy_buffer_stack) );
1756 (yy_buffer_stack) = NULL;
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. */
1766 * Internal utility routines.
1770 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1773 for ( i = 0; i < n; ++i )
1778 #ifdef YY_NEED_STRLEN
1779 static int yy_flex_strlen (yyconst char * s )
1782 for ( n = 0; s[n]; ++n )
1789 void *perf_pmu_alloc (yy_size_t size )
1791 return (void *) malloc( size );
1794 void *perf_pmu_realloc (void * ptr, yy_size_t size )
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.
1803 return (void *) realloc( (char *) ptr, size );
1806 void perf_pmu_free (void * ptr )
1808 free( (char *) ptr ); /* see perf_pmu_realloc() for (char *) cast */
1811 #define YYTABLES_NAME "yytables"
1813 #line 38 "util/pmu.l"
1817 int perf_pmu_wrap(void)