pmu-flex.c 46 KB

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