1 #line 19 "./src/cppi.l"
2 /* config.h must precede flex's inclusion of <stdio.h>
3 in order for its _GNU_SOURCE definition to take effect. */
4 #include "config.h"
5 #include "system.h"
6
7
8
9 #line 10 "lex.yy.c"
10
11 #define YY_INT_ALIGNED short int
12
13 /* A lexical scanner generated by flex */
14
15 #define FLEX_SCANNER
16 #define YY_FLEX_MAJOR_VERSION 2
17 #define YY_FLEX_MINOR_VERSION 5
18 #define YY_FLEX_SUBMINOR_VERSION 36
19 #if YY_FLEX_SUBMINOR_VERSION > 0
20 #define FLEX_BETA
21 #endif
22
23 /* First, we deal with platform-specific or compiler-specific issues. */
24
25 /* begin standard C headers. */
26 #include <stdio.h>
27 #include <string.h>
28 #include <errno.h>
29 #include <stdlib.h>
30
31 /* end standard C headers. */
32
33 /* flex integer type definitions */
34
35 #ifndef FLEXINT_H
36 #define FLEXINT_H
37
38 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
39
40 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
41
42 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
43 * if you want the limit (max/min) macros for int types.
44 */
45 #ifndef __STDC_LIMIT_MACROS
46 #define __STDC_LIMIT_MACROS 1
47 #endif
48
49 #include <inttypes.h>
50 typedef int8_t flex_int8_t;
51 typedef uint8_t flex_uint8_t;
52 typedef int16_t flex_int16_t;
53 typedef uint16_t flex_uint16_t;
54 typedef int32_t flex_int32_t;
55 typedef uint32_t flex_uint32_t;
56 #else
57 typedef signed char flex_int8_t;
58 typedef short int flex_int16_t;
59 typedef int flex_int32_t;
60 typedef unsigned char flex_uint8_t;
61 typedef unsigned short int flex_uint16_t;
62 typedef unsigned int flex_uint32_t;
63
64 /* Limits of integral types. */
65 #ifndef INT8_MIN
66 #define INT8_MIN (-128)
67 #endif
68 #ifndef INT16_MIN
69 #define INT16_MIN (-32767-1)
70 #endif
71 #ifndef INT32_MIN
72 #define INT32_MIN (-2147483647-1)
73 #endif
74 #ifndef INT8_MAX
75 #define INT8_MAX (127)
76 #endif
77 #ifndef INT16_MAX
78 #define INT16_MAX (32767)
79 #endif
80 #ifndef INT32_MAX
81 #define INT32_MAX (2147483647)
82 #endif
83 #ifndef UINT8_MAX
84 #define UINT8_MAX (255U)
85 #endif
86 #ifndef UINT16_MAX
87 #define UINT16_MAX (65535U)
88 #endif
89 #ifndef UINT32_MAX
90 #define UINT32_MAX (4294967295U)
91 #endif
92
93 #endif /* ! C99 */
94
95 #endif /* ! FLEXINT_H */
96
97 #ifdef __cplusplus
98
99 /* The "const" storage-class-modifier is valid. */
100 #define YY_USE_CONST
101
102 #else /* ! __cplusplus */
103
104 /* C99 requires __STDC__ to be defined as 1. */
105 #if defined (__STDC__)
106
107 #define YY_USE_CONST
108
109 #endif /* defined (__STDC__) */
110 #endif /* ! __cplusplus */
111
112 #ifdef YY_USE_CONST
113 #define yyconst const
114 #else
115 #define yyconst
116 #endif
117
118 /* Returned upon end-of-file. */
119 #define YY_NULL 0
120
121 /* Promotes a possibly negative, possibly signed char to an unsigned
122 * integer for use as an array index. If the signed char is negative,
123 * we want to instead treat it as an 8-bit unsigned char, hence the
124 * double cast.
125 */
126 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
127
128 /* Enter a start condition. This macro really ought to take a parameter,
129 * but we do it the disgusting crufty way forced on us by the ()-less
130 * definition of BEGIN.
131 */
132 #define BEGIN (yy_start) = 1 + 2 *
133
134 /* Translate the current start state into a value that can be later handed
135 * to BEGIN to return to the state. The YYSTATE alias is for lex
136 * compatibility.
137 */
138 #define YY_START (((yy_start) - 1) / 2)
139 #define YYSTATE YY_START
140
141 /* Action number for EOF rule of a given start state. */
142 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
143
144 /* Special action meaning "start processing a new file". */
145 #define YY_NEW_FILE yyrestart(yyin )
146
147 #define YY_END_OF_BUFFER_CHAR 0
148
149 /* Size of default input buffer. */
150 #ifndef YY_BUF_SIZE
151 #define YY_BUF_SIZE 16384
152 #endif
153
154 /* The state buf must be large enough to hold one state per character in the main buffer.
155 */
156 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
157
158 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
159 #define YY_TYPEDEF_YY_BUFFER_STATE
160 typedef struct yy_buffer_state *YY_BUFFER_STATE;
161 #endif
162
163 #ifndef YY_TYPEDEF_YY_SIZE_T
164 #define YY_TYPEDEF_YY_SIZE_T
165 typedef size_t yy_size_t;
166 #endif
167
168 extern yy_size_t yyleng;
169
170 extern FILE *yyin, *yyout;
171
172 #define EOB_ACT_CONTINUE_SCAN 0
173 #define EOB_ACT_END_OF_FILE 1
174 #define EOB_ACT_LAST_MATCH 2
175
176 #define YY_LESS_LINENO(n)
177
178 /* Return all but the first "n" matched characters back to the input stream. */
179 #define yyless(n) \
180 do \
181 { \
182 /* Undo effects of setting up yytext. */ \
183 int yyless_macro_arg = (n); \
184 YY_LESS_LINENO(yyless_macro_arg);\
185 *yy_cp = (yy_hold_char); \
186 YY_RESTORE_YY_MORE_OFFSET \
187 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
188 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
189 } \
190 while ( 0 )
191
192 #define unput(c) yyunput( c, (yytext_ptr) )
193
194 #ifndef YY_STRUCT_YY_BUFFER_STATE
195 #define YY_STRUCT_YY_BUFFER_STATE
196 struct yy_buffer_state
197 {
198 FILE *yy_input_file;
199
200 char *yy_ch_buf; /* input buffer */
201 char *yy_buf_pos; /* current position in input buffer */
202
203 /* Size of input buffer in bytes, not including room for EOB
204 * characters.
205 */
206 yy_size_t yy_buf_size;
207
208 /* Number of characters read into yy_ch_buf, not including EOB
209 * characters.
210 */
211 yy_size_t yy_n_chars;
212
213 /* Whether we "own" the buffer - i.e., we know we created it,
214 * and can realloc() it to grow it, and should free() it to
215 * delete it.
216 */
217 int yy_is_our_buffer;
218
219 /* Whether this is an "interactive" input source; if so, and
220 * if we're using stdio for input, then we want to use getc()
221 * instead of fread(), to make sure we stop fetching input after
222 * each newline.
223 */
224 int yy_is_interactive;
225
226 /* Whether we're considered to be at the beginning of a line.
227 * If so, '^' rules will be active on the next match, otherwise
228 * not.
229 */
230 int yy_at_bol;
231
232 int yy_bs_lineno; /**< The line count. */
233 int yy_bs_column; /**< The column count. */
234
235 /* Whether to try to fill the input buffer when we reach the
236 * end of it.
237 */
238 int yy_fill_buffer;
239
240 int yy_buffer_status;
241
242 #define YY_BUFFER_NEW 0
243 #define YY_BUFFER_NORMAL 1
244 /* When an EOF's been seen but there's still some text to process
245 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
246 * shouldn't try reading from the input source any more. We might
247 * still have a bunch of tokens to match, though, because of
248 * possible backing-up.
249 *
250 * When we actually see the EOF, we change the status to "new"
251 * (via yyrestart()), so that the user can continue scanning by
252 * just pointing yyin at a new input file.
253 */
254 #define YY_BUFFER_EOF_PENDING 2
255
256 };
257 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
258
259 /* Stack of input buffers. */
260 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
261 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
262 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
263
264 /* We provide macros for accessing buffer states in case in the
265 * future we want to put the buffer states in a more general
266 * "scanner state".
267 *
268 * Returns the top of the stack, or NULL.
269 */
270 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
271 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
272 : NULL)
273
274 /* Same as previous macro, but useful when we know that the buffer stack is not
275 * NULL or when we need an lvalue. For internal use only.
276 */
277 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
278
279 /* yy_hold_char holds the character lost when yytext is formed. */
280 static char yy_hold_char;
281 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
282 yy_size_t yyleng;
283
284 /* Points to current character in buffer. */
285 static char *yy_c_buf_p = (char *) 0;
286 static int yy_init = 0; /* whether we need to initialize */
287 static int yy_start = 0; /* start state number */
288
289 /* Flag which is used to allow yywrap()'s to do buffer switches
290 * instead of setting up a fresh yyin. A bit of a hack ...
291 */
292 static int yy_did_buffer_switch_on_eof;
293
294 void yyrestart (FILE *input_file );
295 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
296 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
297 void yy_delete_buffer (YY_BUFFER_STATE b );
298 void yy_flush_buffer (YY_BUFFER_STATE b );
299 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
300 void yypop_buffer_state (void );
301
302 static void yyensure_buffer_stack (void );
303 static void yy_load_buffer_state (void );
304 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
305
306 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
307
308 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
309 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
310 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
311
312 void *yyalloc (yy_size_t );
313 void *yyrealloc (void *,yy_size_t );
314 void yyfree (void * );
315
316 #define yy_new_buffer yy_create_buffer
317
318 #define yy_set_interactive(is_interactive) \
319 { \
320 if ( ! YY_CURRENT_BUFFER ){ \
321 yyensure_buffer_stack (); \
322 YY_CURRENT_BUFFER_LVALUE = \
323 yy_create_buffer(yyin,YY_BUF_SIZE ); \
324 } \
325 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
326 }
327
328 #define yy_set_bol(at_bol) \
329 { \
330 if ( ! YY_CURRENT_BUFFER ){\
331 yyensure_buffer_stack (); \
332 YY_CURRENT_BUFFER_LVALUE = \
333 yy_create_buffer(yyin,YY_BUF_SIZE ); \
334 } \
335 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
336 }
337
338 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
339
340 /* Begin user sect3 */
341
342 #define yywrap() 1
343 #define YY_SKIP_YYWRAP
344
345 typedef unsigned char YY_CHAR;
346
347 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
348
349 typedef int yy_state_type;
350
351 extern int yylineno;
352
353 int yylineno = 1;
354
355 extern char *yytext;
356 #define yytext_ptr yytext
357 static yyconst flex_int16_t yy_nxt[][256] =
358 {
359 {
360 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
361 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
362 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
363 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
366 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
368 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
370
371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
372 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
374 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
376 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
377 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
378 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
379 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
380 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
381
382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
383 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
384 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
385 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
387 0, 0, 0, 0, 0, 0
388 },
389
390 {
391 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
392 5, 4, 4, 4, 4, 4, 4, 4, 4, 4,
393 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
394 4, 4, 4, 4, 6, 4, 4, 4, 4, 7,
395
396 4, 4, 4, 4, 4, 4, 4, 8, 4, 4,
397 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
398 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
399 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
400 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
401 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
402 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
403 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
404 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
405 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
406
407 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
408 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
409 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
410 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
411 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
412 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
413 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
414 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
415 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
416 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
417
418 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
419 4, 4, 4, 4, 4, 4
420 },
421
422 {
423 3, 4, 4, 4, 4, 4, 4, 4, 4, 9,
424 5, 4, 4, 4, 4, 4, 4, 4, 4, 4,
425 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
426 4, 4, 9, 4, 6, 10, 4, 4, 4, 7,
427 4, 4, 4, 4, 4, 4, 4, 8, 4, 4,
428 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
429 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
430 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
431
432 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
433 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
434 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
435 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
436 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
437 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
438 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
439 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
440 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
441 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
442
443 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
444 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
445 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
446 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
447 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
448 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
449 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
450 4, 4, 4, 4, 4, 4
451 },
452
453 {
454 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
455 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
456
457 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
458 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
459 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
460 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
461 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
462 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
463 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
464 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
465 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
466 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
467
468 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
469 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
470 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
471 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
472 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
473 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
474 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
475 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
476 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
477 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
478
479 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
480 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
481 -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
482 -3, -3, -3, -3, -3, -3
483 },
484
485 {
486 3, -4, -4, -4, -4, -4, -4, -4, -4, -4,
487 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
488 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
489 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
490 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
491 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
492
493 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
494 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
495 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
496 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
497 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
498 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
499 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
500 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
501 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
502 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
503
504 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
505 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
506 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
507 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
508 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
509 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
510 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
511 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
512 -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
513 -4, -4, -4, -4, -4, -4
514
515 },
516
517 {
518 3, -5, -5, -5, -5, -5, -5, -5, -5, -5,
519 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
520 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
521 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
522 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
523 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
524 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
525 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
526 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
527 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
528
529 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
530 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
531 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
532 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
533 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
534 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
535 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
536 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
537 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
538 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
539
540 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
541 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
542 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
543 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
544 -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
545 -5, -5, -5, -5, -5, -5
546 },
547
548 {
549 3, -6, -6, -6, -6, -6, -6, -6, -6, -6,
550 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
551 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
552 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
553
554 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
555 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
556 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
557 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
558 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
559 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
560 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
561 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
562 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
563 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
564
565 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
566 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
567 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
568 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
569 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
570 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
571 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
572 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
573 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
574 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
575
576 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
577 -6, -6, -6, -6, -6, -6
578 },
579
580 {
581 3, -7, -7, -7, -7, -7, -7, -7, -7, -7,
582 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
583 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
584 -7, -7, -7, -7, 11, -7, -7, -7, -7, -7,
585 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
586 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
587 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
588 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
589
590 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
591 -7, -7, 12, -7, -7, -7, -7, -7, -7, -7,
592 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
593 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
594 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
595 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
596 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
597 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
598 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
599 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
600
601 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
602 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
603 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
604 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
605 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
606 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
607 -7, -7, -7, -7, -7, -7, -7, -7, -7, -7,
608 -7, -7, -7, -7, -7, -7
609 },
610
611 {
612 3, -8, -8, -8, -8, -8, -8, -8, -8, -8,
613 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
614
615 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
616 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
617 -8, -8, 13, -8, -8, -8, -8, 14, -8, -8,
618 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
619 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
620 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
621 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
622 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
623 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
624 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
625
626 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
627 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
628 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
629 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
630 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
631 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
632 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
633 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
634 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
635 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
636
637 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
638 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
639 -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,
640 -8, -8, -8, -8, -8, -8
641 },
642
643 {
644 3, -9, -9, -9, -9, -9, -9, -9, -9, 15,
645 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
646 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
647 -9, -9, 15, -9, -9, 16, -9, -9, -9, -9,
648 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
649 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
650
651 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
652 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
653 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
654 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
655 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
656 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
657 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
658 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
659 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
660 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
661
662 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
663 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
664 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
665 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
666 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
667 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
668 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
669 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
670 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
671 -9, -9, -9, -9, -9, -9
672
673 },
674
675 {
676 3, -10, -10, -10, -10, -10, -10, -10, -10, 17,
677 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
678 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
679 -10, -10, 17, -10, -10, -10, -10, -10, -10, -10,
680 -10, -10, -10, -10, -10, -10, -10, -10, 18, 18,
681 18, 18, 18, 18, 18, 18, 18, 18, -10, -10,
682 -10, -10, -10, -10, -10, 18, 18, 18, 18, 18,
683 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
684 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
685 18, -10, -10, -10, -10, 18, -10, 18, 18, 18,
686
687 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
688 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
689 18, 18, 18, -10, -10, -10, -10, -10, -10, -10,
690 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
691 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
692 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
693 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
694 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
695 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
696 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
697
698 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
699 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
700 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
701 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
702 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
703 -10, -10, -10, -10, -10, -10
704 },
705
706 {
707 3, -11, -11, -11, -11, -11, -11, -11, -11, -11,
708 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
709 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
710 -11, -11, -11, -11, -11, -11, -11, -11, -11, 19,
711
712 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
713 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
714 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
715 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
716 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
717 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
718 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
719 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
720 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
721 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
722
723 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
724 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
725 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
726 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
727 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
728 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
729 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
730 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
731 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
732 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
733
734 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
735 -11, -11, -11, -11, -11, -11
736 },
737
738 {
739 3, -12, -12, -12, -12, -12, -12, -12, -12, -12,
740 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
741 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
742 -12, -12, -12, -12, 20, -12, -12, -12, -12, -12,
743 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
744 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
745 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
746 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
747
748 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
749 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
750 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
751 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
752 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
753 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
754 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
755 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
756 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
757 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
758
759 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
760 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
761 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
762 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
763 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
764 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
765 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
766 -12, -12, -12, -12, -12, -12
767 },
768
769 {
770 3, -13, -13, -13, -13, -13, -13, -13, -13, -13,
771 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
772
773 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
774 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
775 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
776 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
777 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
778 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
779 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
780 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
781 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
782 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
783
784 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
785 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
786 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
787 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
788 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
789 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
790 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
791 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
792 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
793 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
794
795 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
796 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
797 -13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
798 -13, -13, -13, -13, -13, -13
799 },
800
801 {
802 3, -14, -14, -14, -14, -14, -14, -14, -14, -14,
803 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
804 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
805 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
806 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
807 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
808
809 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
810 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
811 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
812 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
813 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
814 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
815 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
816 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
817 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
818 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
819
820 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
821 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
822 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
823 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
824 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
825 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
826 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
827 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
828 -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
829 -14, -14, -14, -14, -14, -14
830
831 },
832
833 {
834 3, -15, -15, -15, -15, -15, -15, -15, -15, 15,
835 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
836 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
837 -15, -15, 15, -15, -15, 16, -15, -15, -15, -15,
838 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
839 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
840 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
841 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
842 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
843 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
844
845 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
846 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
847 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
848 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
849 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
850 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
851 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
852 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
853 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
854 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
855
856 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
857 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
858 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
859 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
860 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
861 -15, -15, -15, -15, -15, -15
862 },
863
864 {
865 3, -16, -16, -16, -16, -16, -16, -16, -16, 17,
866 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
867 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
868 -16, -16, 17, -16, -16, -16, -16, -16, -16, -16,
869
870 -16, -16, -16, -16, -16, -16, -16, -16, 18, 18,
871 18, 18, 18, 18, 18, 18, 18, 18, -16, -16,
872 -16, -16, -16, -16, -16, 18, 18, 18, 18, 18,
873 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
874 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
875 18, -16, -16, -16, -16, 18, -16, 18, 18, 18,
876 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
877 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
878 18, 18, 18, -16, -16, -16, -16, -16, -16, -16,
879 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
880
881 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
882 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
883 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
884 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
885 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
886 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
887 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
888 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
889 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
890 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
891
892 -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
893 -16, -16, -16, -16, -16, -16
894 },
895
896 {
897 3, -17, -17, -17, -17, -17, -17, -17, -17, 17,
898 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
899 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
900 -17, -17, 17, -17, -17, -17, -17, -17, -17, -17,
901 -17, -17, -17, -17, -17, -17, -17, -17, 18, 18,
902 18, 18, 18, 18, 18, 18, 18, 18, -17, -17,
903 -17, -17, -17, -17, -17, 18, 18, 18, 18, 18,
904 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
905
906 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
907 18, -17, -17, -17, -17, 18, -17, 18, 18, 18,
908 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
909 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
910 18, 18, 18, -17, -17, -17, -17, -17, -17, -17,
911 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
912 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
913 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
914 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
915 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
916
917 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
918 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
919 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
920 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
921 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
922 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
923 -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
924 -17, -17, -17, -17, -17, -17
925 },
926
927 {
928 3, -18, -18, -18, -18, -18, -18, -18, -18, -18,
929 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
930
931 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
932 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
933 -18, -18, -18, -18, -18, -18, -18, -18, 18, 18,
934 18, 18, 18, 18, 18, 18, 18, 18, -18, -18,
935 -18, -18, -18, -18, -18, 18, 18, 18, 18, 18,
936 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
937 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
938 18, -18, -18, -18, -18, 18, -18, 18, 18, 18,
939 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
940 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
941
942 18, 18, 18, -18, -18, -18, -18, -18, -18, -18,
943 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
944 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
945 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
946 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
947 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
948 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
949 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
950 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
951 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
952
953 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
954 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
955 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
956 -18, -18, -18, -18, -18, -18
957 },
958
959 {
960 3, -19, -19, -19, -19, -19, -19, -19, -19, -19,
961 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
962 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
963 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
964 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
965 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
966
967 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
968 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
969 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
970 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
971 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
972 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
973 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
974 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
975 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
976 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
977
978 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
979 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
980 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
981 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
982 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
983 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
984 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
985 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
986 -19, -19, -19, -19, -19, -19, -19, -19, -19, -19,
987 -19, -19, -19, -19, -19, -19
988
989 },
990
991 {
992 3, -20, -20, -20, -20, -20, -20, -20, -20, -20,
993 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
994 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
995 -20, -20, -20, -20, -20, -20, -20, -20, -20, 19,
996 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
997 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
998 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
999 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1000 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1001 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1002
1003 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1004 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1005 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1006 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1007 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1008 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1009 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1010 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1011 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1012 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1013
1014 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1015 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1016 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1017 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1018 -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
1019 -20, -20, -20, -20, -20, -20
1020 },
1021
1022 } ;
1023
1024 static yy_state_type yy_get_previous_state (void );
1025 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
1026 static int yy_get_next_buffer (void );
1027 static void yy_fatal_error (yyconst char msg[] );
1028
1029 /* Done after the current pattern has been matched and before the
1030 * corresponding action - sets up yytext.
1031 */
1032 #define YY_DO_BEFORE_ACTION \
1033 (yytext_ptr) = yy_bp; \
1034 yyleng = (size_t) (yy_cp - yy_bp); \
1035 (yy_hold_char) = *yy_cp; \
1036 *yy_cp = '\0'; \
1037 (yy_c_buf_p) = yy_cp;
1038
1039 #define YY_NUM_RULES 13
1040 #define YY_END_OF_BUFFER 14
1041 /* This struct is not used in this scanner,
1042 but its presence is necessary. */
1043 struct yy_trans_info
1044 {
1045 flex_int32_t yy_verify;
1046 flex_int32_t yy_nxt;
1047 };
1048 static yyconst flex_int16_t yy_accept[21] =
1049 { 0,
1050 0, 10, 14, 12, 11, 7, 12, 12, 10, 9,
1051 6, 5, 1, 2, 10, 9, 9, 8, 3, 4
1052 } ;
1053
1054 static yyconst yy_state_type yy_NUL_trans[21] =
1055 { 0,
1056 4, 4, 0, 0, 0, 0, 0, 0, 0, 0,
1057 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
1058 } ;
1059
1060 extern int yy_flex_debug;
1061 int yy_flex_debug = 0;
1062
1063 /* The intent behind this definition is that it'll catch
1064 * any uses of REJECT which flex missed.
1065 */
1066 #define REJECT reject_used_but_not_detected
1067 #define yymore() yymore_used_but_not_detected
1068 #define YY_MORE_ADJ 0
1069 #define YY_RESTORE_YY_MORE_OFFSET
1070 char *yytext;
1071 #line 1 "./src/cppi.l"
1072 /* flex-lexer for cppi
1073 Copyright (C) 1997-2013 Free Software Foundation, Inc.
1074
1075 This program is free software: you can redistribute it and/or modify
1076 it under the terms of the GNU General Public License as published by
1077 the Free Software Foundation, either version 3 of the License, or
1078 (at your option) any later version.
1079
1080 This program is distributed in the hope that it will be useful,
1081 but WITHOUT ANY WARRANTY; without even the implied warranty of
1082 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1083 GNU General Public License for more details.
1084
1085 You should have received a copy of the GNU General Public License
1086 along with this program. If not, see <http://www.gnu.org/licenses/>. */
1087
1088 #line 26 "./src/cppi.l"
1089
1090 /* When output is inhibited, exit with status:
1091 0 if all's ok
1092 1 if indentation is wrong, or if text follows #else/#endif
1093 2 if #if/#endif mismatch
1094 3 if file error
1095 */
1096
1097 #ifndef FLEX_SCANNER
1098 # error This scanner must be made using flex, not lex.
1099 #endif
1100
1101 #include <assert.h>
1102
1103 #include <sys/types.h>
1104 #include <getopt.h>
1105
1106 #define _(msgid) gettext (msgid)
1107 #define N_(msgid) msgid
1108
1109 #include "cpp.h"
1110 #include "error.h"
1111 #include "obstack.h"
1112 #include "xstrtol.h"
1113
1114 /* The official name of this program (e.g., no `g' prefix). */
1115 #define PROGRAM_NAME "cppi"
1116
1117 #define AUTHORS "Jim Meyering"
1118
1119 #define obstack_chunk_alloc malloc
1120 #define obstack_chunk_free free
1121
1122 #ifdef MY_DEBUG
1123 # define PUT2(x,y) do { putchar (x); putchar (y); } while (0)
1124 #else
1125 # define PUT2(x,y) /* empty */
1126 #endif
1127
1128 #undef YY_DECL
1129 #define YY_DECL static int cpp_i (const char *in_file)
1130
1131 #undef isblank
1132 #define isblank(c) ((c) == ' ' || (c) == '\t')
1133
1134 #define MY_ECHO do { if (!inhibit_output) ECHO; } while (0)
1135
1136 #define OPENER_STACK_HEIGHT \
1137 (obstack_object_size (&opener_stack) / sizeof (struct KL_pair))
1138
1139 /* An entry on the stack of opener (keyword/line_number) specs. */
1140 struct KL_pair
1141 {
1142 /* The type of cpp directive opening a block: one of
1143 EIC_IF, EIC_IFDEF, EIC_IFNDEF. */
1144 enum Eic_type opener_type;
1145
1146 /* The line number of the directive. */
1147 unsigned int line_number;
1148 };
1149
1150 enum
1151 {
1152 EXIT_NOT_PROPERLY_INDENTED = 1,
1153 EXIT_STRING_TOO_LONG = 1,
1154 EXIT_LEX_ERROR = 2,
1155 EXIT_FILE_ERROR = 3
1156 };
1157
1158 /* A stack of cpp-opener-directive-spec/line-number pairs.
1159 This lets us report the line numbers of any unmatched #if,
1160 #ifdef, or #ifndef directives. */
1161 static struct obstack opener_stack;
1162
1163 /* Current nesting level. */
1164 static int i_depth;
1165
1166 /* Initial indentation nesting depth. May be negative.
1167 Use a value of -1 to cause code (usually header files) to be indented
1168 one level less than otherwise. This is useful if you don't want file-
1169 enclosing ifdefs (e.g., #ifdef FOO_H/#define FOO_H/ ... #endif) to
1170 cause every enclosed cpp directive to have at least one space between
1171 the `#' and the cpp keyword. */
1172 static int initial_i_depth;
1173
1174 /* Nonzero means don't generate diagnostics about indentation, and print
1175 to stdout only the names of files that aren't properly indented. */
1176 static int list_files_only;
1177
1178 /* Set to non-zero to enable ANSI-conformance check
1179 (text after #else or #endif is non-ANSI). */
1180 static int ansi_check = 0;
1181
1182 /* Set to non-zero to inhibit non-error output. */
1183 static int inhibit_output = 0;
1184
1185 /* The maximum length of a double-quoted string. Set to zero
1186 to indicate there is no limit. */
1187 static unsigned long int max_string_length = 0;
1188
1189 static char *default_file_list[] = {(char *) "-", NULL};
1190
1191 static struct option const long_options[] =
1192 {
1193 {"ansi", no_argument, NULL, 'a'},
1194 {"check", no_argument, NULL, 'c'},
1195 {"list-files-only", no_argument, NULL, 'l'},
1196 {"max-string-length", required_argument, NULL, 'm'},
1197 {GETOPT_HELP_OPTION_DECL},
1198 {GETOPT_VERSION_OPTION_DECL},
1199 {NULL, 0, NULL, 0}
1200 };
1201
1202 static void gobble_define (unsigned int *);
1203 static void gobble_c_comment (const char *, unsigned int *);
1204 static void gobble_line (unsigned int *);
1205
1206 /* Include gperf-generated hash function. */
1207 #include "cpp-cond.c"
1208
1209 #if __GNUC__ && ! __STRICT_ANSI__
1210 /* this use of a statement-expression works only with gcc. */
1211 # define INPUT_AND_ECHO() \
1212 ({ \
1213 int _c_ = input (); \
1214 if (_c_ != EOF && !inhibit_output) \
1215 fputc (_c_, yyout); \
1216 _c_; \
1217 })
1218 #else
1219 /* Although the above is a macro, this function definition must
1220 follow the declaration of inhibit_output, above. */
1221 static int input (void);
1222 static int
INPUT_AND_ECHO(void)1223 INPUT_AND_ECHO (void)
1224 {
1225 int _c_ = input ();
1226 if (_c_ != EOF && !inhibit_output)
1227 fputc (_c_, yyout);
1228 return _c_;
1229 }
1230 #endif
1231
1232 /* PREFIX is the cpp line from beginning of line to end of the keyword
1233 following the `#'. */
1234
1235 static enum Eic_type
lookup_cpp_keyword(const char * prefix,size_t len,const char ** kw)1236 lookup_cpp_keyword (const char *prefix, size_t len, const char **kw)
1237 {
1238 /* Find the beginning of the keyword. */
1239 const char *p;
1240 for (p = prefix; ; ++p, --len)
1241 {
1242 switch (*p)
1243 {
1244 case '#':
1245 case ' ':
1246 case '\t':
1247 break;
1248
1249 default:
1250 {
1251 struct KW const *ent = cpp_cond_lookup (p, len);
1252 *kw = p;
1253 return (ent ? ent->code : EIC_OTHER);
1254 }
1255 }
1256 assert (len > 0);
1257 }
1258 }
1259
1260 static inline struct KL_pair
kth_entry(unsigned int k)1261 kth_entry (unsigned int k)
1262 {
1263 struct KL_pair *s = (struct KL_pair *) obstack_base (&opener_stack);
1264 assert (k < OPENER_STACK_HEIGHT);
1265 return s[k];
1266 }
1267
1268 static inline void
pop(void)1269 pop (void)
1270 {
1271 int pair_size = sizeof (struct KL_pair);
1272 assert (OPENER_STACK_HEIGHT > 0);
1273 obstack_blank (&opener_stack, -pair_size);
1274 }
1275
1276 static inline void
push(enum Eic_type opener_type,unsigned int line_number)1277 push (enum Eic_type opener_type, unsigned int line_number)
1278 {
1279 struct KL_pair pair;
1280 pair.opener_type = opener_type;
1281 pair.line_number = line_number;
1282
1283 obstack_grow (&opener_stack, &pair, sizeof (struct KL_pair));
1284 }
1285
1286 static int
emit_or_check(enum Eic_type type,const char * text,const char * other)1287 emit_or_check (enum Eic_type type, const char *text, const char *other)
1288 {
1289 int fail = 1;
1290
1291 if (inhibit_output)
1292 {
1293 int n;
1294 int depth = (i_depth < 0 ? 0 : i_depth);
1295 if ((text[0] == '#'
1296 && (n = strspn (text + 1, " ")) == depth
1297 && !isblank (text[1 + n]))
1298 /* This allows pragmas to have exactly one space before the `#'.
1299 E.g., ` #pragma alloca' or ` # pragma alloca' . */
1300 || (text[0] == ' '
1301 && text[1] == '#'
1302 && type == EIC_PRAGMA
1303 && (n = strspn (text + 2, " ")) == depth - 1
1304 && text[n + 2] == 'p'))
1305 {
1306 fail = 0;
1307 }
1308 }
1309 else
1310 {
1311 int i;
1312 const char *dir = (type == EIC_OTHER ? other : directive[type]);
1313 int space_first = (type == EIC_PRAGMA && text[0] == ' ');
1314
1315 if (space_first)
1316 {
1317 fputc (' ', yyout);
1318 fputc ('#', yyout);
1319 for (i = 0; i < i_depth - 1; i++)
1320 fputc (' ', yyout);
1321 }
1322 else
1323 {
1324 fputc ('#', yyout);
1325 for (i = 0; i < i_depth; i++)
1326 fputc (' ', yyout);
1327 }
1328
1329 fputs (dir, yyout);
1330
1331 fail = 0;
1332 }
1333
1334 return fail;
1335 }
1336
1337 static enum Eic_type
emit_indented_cpp(char const * in_file,unsigned int line_number,char const * text,size_t len,int * fail)1338 emit_indented_cpp (char const *in_file, unsigned int line_number,
1339 char const *text, size_t len, int *fail)
1340 {
1341 const char *keyword;
1342 enum Eic_type t = lookup_cpp_keyword (text, len, &keyword);
1343
1344 *fail = 0;
1345
1346 switch (t)
1347 {
1348 case EIC_IF:
1349 case EIC_IFDEF:
1350 case EIC_IFNDEF:
1351 /* Maintain a stack of (keyword, line number) pairs to better
1352 report any `unterminated #if...' errors. Put a new pair
1353 on the stack. */
1354 push (t, line_number);
1355
1356 *fail = emit_or_check (t, yytext, keyword);
1357 ++i_depth;
1358 break;
1359
1360 case EIC_ELSE:
1361 case EIC_ELIF:
1362 if (i_depth <= initial_i_depth)
1363 {
1364 if (!list_files_only)
1365 {
1366 error (0, 0, _("%s: line %d: found #%s without matching #if"),
1367 in_file, line_number, directive[t]);
1368 }
1369 i_depth = 0;
1370 emit_or_check (t, yytext, keyword);
1371 *fail = 2;
1372 }
1373 else
1374 {
1375 --i_depth;
1376 *fail = emit_or_check (t, yytext, keyword);
1377 ++i_depth;
1378 }
1379 break;
1380
1381 case EIC_ENDIF:
1382 if (i_depth <= initial_i_depth)
1383 {
1384 if (!list_files_only)
1385 {
1386 error (0, 0, _("%s: line %d: found #%s without matching #if"),
1387 in_file, line_number, directive[t]);
1388 }
1389 i_depth = initial_i_depth + 1;
1390 *fail = 2;
1391 }
1392 else
1393 {
1394 /* We've just found an #endif. Pop off and discard the
1395 keyword,line-number pair that's on the top of the stack.
1396 That pair identifies the matching #if, #ifdef, or #ifndef. */
1397 pop ();
1398 }
1399
1400 --i_depth;
1401 {
1402 int tf = emit_or_check (t, yytext, keyword);
1403 if (tf > *fail)
1404 *fail = tf;
1405 }
1406 break;
1407
1408 case EIC_PRAGMA:
1409 case EIC_DEFINE:
1410 case EIC_OTHER:
1411 *fail = emit_or_check (t, yytext, keyword);
1412 break;
1413
1414 case EIC_INVALID:
1415 default:
1416 abort ();
1417 }
1418
1419 if (*fail == EXIT_NOT_PROPERLY_INDENTED)
1420 {
1421 if (!list_files_only)
1422 error (0, 0, _("%s: line %d: not properly indented"),
1423 in_file, line_number);
1424 }
1425
1426 return t;
1427 }
1428
1429 #line 1430 "lex.yy.c"
1430
1431 #define INITIAL 0
1432
1433 #ifndef YY_NO_UNISTD_H
1434 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1435 * down here because we want the user's section 1 to have been scanned first.
1436 * The user has a chance to override it with an option.
1437 */
1438 #include <unistd.h>
1439 #endif
1440
1441 #ifndef YY_EXTRA_TYPE
1442 #define YY_EXTRA_TYPE void *
1443 #endif
1444
1445 static int yy_init_globals (void );
1446
1447 /* Accessor methods to globals.
1448 These are made visible to non-reentrant scanners for convenience. */
1449
1450 int yylex_destroy (void );
1451
1452 int yyget_debug (void );
1453
1454 void yyset_debug (int debug_flag );
1455
1456 YY_EXTRA_TYPE yyget_extra (void );
1457
1458 void yyset_extra (YY_EXTRA_TYPE user_defined );
1459
1460 FILE *yyget_in (void );
1461
1462 void yyset_in (FILE * in_str );
1463
1464 FILE *yyget_out (void );
1465
1466 void yyset_out (FILE * out_str );
1467
1468 yy_size_t yyget_leng (void );
1469
1470 char *yyget_text (void );
1471
1472 int yyget_lineno (void );
1473
1474 void yyset_lineno (int line_number );
1475
1476 /* Macros after this point can all be overridden by user definitions in
1477 * section 1.
1478 */
1479
1480 #ifndef YY_SKIP_YYWRAP
1481 #ifdef __cplusplus
1482 extern "C" int yywrap (void );
1483 #else
1484 extern int yywrap (void );
1485 #endif
1486 #endif
1487
1488 static void yyunput (int c,char *buf_ptr );
1489
1490 #ifndef yytext_ptr
1491 static void yy_flex_strncpy (char *,yyconst char *,int );
1492 #endif
1493
1494 #ifdef YY_NEED_STRLEN
1495 static int yy_flex_strlen (yyconst char * );
1496 #endif
1497
1498 #ifndef YY_NO_INPUT
1499
1500 #ifdef __cplusplus
1501 static int yyinput (void );
1502 #else
1503 static int input (void );
1504 #endif
1505
1506 #endif
1507
1508 /* Amount of stuff to slurp up with each read. */
1509 #ifndef YY_READ_BUF_SIZE
1510 #define YY_READ_BUF_SIZE 8192
1511 #endif
1512
1513 /* Copy whatever the last rule matched to the standard output. */
1514 #ifndef ECHO
1515 /* This used to be an fputs(), but since the string might contain NUL's,
1516 * we now use fwrite().
1517 */
1518 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
1519 #endif
1520
1521 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1522 * is returned in "result".
1523 */
1524 #ifndef YY_INPUT
1525 #define YY_INPUT(buf,result,max_size) \
1526 errno=0; \
1527 while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
1528 { \
1529 if( errno != EINTR) \
1530 { \
1531 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1532 break; \
1533 } \
1534 errno=0; \
1535 clearerr(yyin); \
1536 }\
1537 \
1538
1539 #endif
1540
1541 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1542 * we don't want an extra ';' after the "return" because that will cause
1543 * some compilers to complain about unreachable statements.
1544 */
1545 #ifndef yyterminate
1546 #define yyterminate() return YY_NULL
1547 #endif
1548
1549 /* Number of entries by which start-condition stack grows. */
1550 #ifndef YY_START_STACK_INCR
1551 #define YY_START_STACK_INCR 25
1552 #endif
1553
1554 /* Report a fatal error. */
1555 #ifndef YY_FATAL_ERROR
1556 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1557 #endif
1558
1559 /* end tables serialization structures and prototypes */
1560
1561 /* Default declaration of generated scanner - a define so the user can
1562 * easily add parameters.
1563 */
1564 #ifndef YY_DECL
1565 #define YY_DECL_IS_OURS 1
1566
1567 extern int yylex (void);
1568
1569 #define YY_DECL int yylex (void)
1570 #endif /* !YY_DECL */
1571
1572 /* Code executed at the beginning of each rule, after yytext and yyleng
1573 * have been set up.
1574 */
1575 #ifndef YY_USER_ACTION
1576 #define YY_USER_ACTION
1577 #endif
1578
1579 /* Code executed at the end of each rule. */
1580 #ifndef YY_BREAK
1581 #define YY_BREAK break;
1582 #endif
1583
1584 #define YY_RULE_SETUP \
1585 if ( yyleng > 0 ) \
1586 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1587 (yytext[yyleng - 1] == '\n'); \
1588 YY_USER_ACTION
1589
1590 /** The main scanner function which does all the work.
1591 */
1592 YY_DECL
1593 {
1594 register yy_state_type yy_current_state;
1595 register char *yy_cp, *yy_bp;
1596 register int yy_act;
1597
1598 #line 371 "./src/cppi.l"
1599
1600
1601
1602 /* This section contains dcls and code that is local to the
1603 scanning routine. */
1604
1605 /* Current line number -- for diagnostics and errors. */
1606 unsigned int lineno = 1;
1607
1608 int lex_fail = 0;
1609
1610 obstack_init (&opener_stack);
1611
1612 initial_i_depth = 0;
1613 i_depth = initial_i_depth;
1614
1615
1616
1617 #line 1618 "lex.yy.c"
1618
1619 if ( !(yy_init) )
1620 {
1621 (yy_init) = 1;
1622
1623 #ifdef YY_USER_INIT
1624 YY_USER_INIT;
1625 #endif
1626
1627 if ( ! (yy_start) )
1628 (yy_start) = 1; /* first start state */
1629
1630 if ( ! yyin )
1631 yyin = stdin;
1632
1633 if ( ! yyout )
1634 yyout = stdout;
1635
1636 if ( ! YY_CURRENT_BUFFER ) {
1637 yyensure_buffer_stack ();
1638 YY_CURRENT_BUFFER_LVALUE =
1639 yy_create_buffer(yyin,YY_BUF_SIZE );
1640 }
1641
1642 yy_load_buffer_state( );
1643 }
1644
1645 while ( 1 ) /* loops until end-of-file is reached */
1646 {
1647 yy_cp = (yy_c_buf_p);
1648
1649 /* Support of yytext. */
1650 *yy_cp = (yy_hold_char);
1651
1652 /* yy_bp points to the position in yy_ch_buf of the start of
1653 * the current run.
1654 */
1655 yy_bp = yy_cp;
1656
1657 yy_current_state = (yy_start);
1658 yy_current_state += YY_AT_BOL();
1659 yy_match:
1660 while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 )
1661 ++yy_cp;
1662
1663 yy_current_state = -yy_current_state;
1664
1665 yy_find_action:
1666 yy_act = yy_accept[yy_current_state];
1667
1668 YY_DO_BEFORE_ACTION;
1669
1670 do_action: /* This label is used only to access EOF actions. */
1671
1672 switch ( yy_act )
1673 { /* beginning of action switch */
1674 case 1:
1675 YY_RULE_SETUP
1676 #line 389 "./src/cppi.l"
1677 {
1678 PUT2 ('[', '\0');
1679 MY_ECHO;
1680 gobble_c_comment (in_file, &lineno);
1681 PUT2 ('\0', ']');
1682 }
1683 YY_BREAK
1684 case 2:
1685 YY_RULE_SETUP
1686 #line 396 "./src/cppi.l"
1687 {
1688 MY_ECHO;
1689 gobble_line (&lineno);
1690 }
1691 YY_BREAK
1692 case 3:
1693 YY_RULE_SETUP
1694 #line 401 "./src/cppi.l"
1695 {
1696 /* We need this rule so that the double quote in the character literal,
1697 '"' (also written as '\"'), is not interpreted as a string opener. */
1698 MY_ECHO;
1699 }
1700 YY_BREAK
1701 case 4:
1702 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1703 (yy_c_buf_p) = yy_cp = yy_bp + 2;
1704 YY_DO_BEFORE_ACTION; /* set up yytext again */
1705 YY_RULE_SETUP
1706 #line 407 "./src/cppi.l"
1707 {
1708 /* This rule is included to make flex's scanner more efficient
1709 by avoiding backup states. */
1710 MY_ECHO;
1711 }
1712 YY_BREAK
1713 case 5:
1714 YY_RULE_SETUP
1715 #line 412 "./src/cppi.l"
1716 { /* Likewise. */ MY_ECHO;}
1717 YY_BREAK
1718 case 6:
1719 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1720 (yy_c_buf_p) = yy_cp = yy_bp + 1;
1721 YY_DO_BEFORE_ACTION; /* set up yytext again */
1722 YY_RULE_SETUP
1723 #line 413 "./src/cppi.l"
1724 { /* Likewise. */ MY_ECHO; }
1725 YY_BREAK
1726 case 7:
1727 YY_RULE_SETUP
1728 #line 415 "./src/cppi.l"
1729 {
1730 register int c;
1731 int start_lineno = lineno;
1732
1733 /* Count consecutive backslashes. We'll need this number when
1734 a string of them immediately precedes a double quote. */
1735 size_t n_backslashes = 0;
1736 size_t string_length = 0;
1737 int fail = 0;
1738
1739 PUT2 ('[', '\0');
1740 MY_ECHO;
1741
1742 while (1)
1743 {
1744 c = INPUT_AND_ECHO ();
1745
1746 if (c == EOF)
1747 {
1748 error (0, 0, _("%s: line %d: EOF in string"),
1749 in_file, start_lineno);
1750 fail = EXIT_LEX_ERROR;
1751 break;
1752 }
1753
1754 /* If the number of preceding backslashes is even, then this is
1755 an unescaped double quote, and it marks the end of the string. */
1756 if (c == '"' && n_backslashes % 2 == 0)
1757 break;
1758
1759 n_backslashes = (c == '\\' ? n_backslashes + 1 : 0);
1760
1761 /* Some compilers (irix4's cc) impose a limit on the length of a
1762 double quoted string. It's probably a limit on the length of
1763 the actual value of the string, rather than on the number of
1764 bytes between `"'s in the source, but I'm not sure it's worth
1765 the trouble of computing the former. */
1766 ++string_length;
1767
1768 if (c == '\n')
1769 ++lineno;
1770 }
1771
1772 PUT2 ('\0', ']');
1773
1774 if (0 < max_string_length && max_string_length < string_length)
1775 {
1776 error (0, 0, _("%s: line %d: string (%lu) longer than maximum of %lu"),
1777 in_file, start_lineno, (unsigned long) string_length,
1778 (unsigned long) max_string_length);
1779 if (fail == 0)
1780 lex_fail = EXIT_STRING_TOO_LONG;
1781 }
1782
1783 if (fail)
1784 lex_fail = 1;
1785 }
1786 YY_BREAK
1787 case 8:
1788 YY_RULE_SETUP
1789 #line 473 "./src/cppi.l"
1790 {
1791 enum Eic_type t;
1792 int fail;
1793
1794 t = emit_indented_cpp (in_file, lineno, yytext, yyleng, &fail);
1795
1796 if (t == EIC_IF || t == EIC_IFNDEF || t == EIC_ELIF || t == EIC_DEFINE)
1797 {
1798 int c;
1799 if (inhibit_output)
1800 {
1801 /* Make sure there's exactly one space after this directive. */
1802 c = input ();
1803 if (c != ' ' || ((c = input ()) == ' ' || c == '\t' || c == EOF))
1804 {
1805 if (!list_files_only)
1806 {
1807 error (0, 0, _("%s: line %d: not properly formatted;\n\
1808 there must be exactly one SPACE character after each\n\
1809 #if, #elif, and #define directive"),
1810 in_file, lineno);
1811 }
1812 if (fail < 1)
1813 fail = 1;
1814 }
1815 }
1816 else
1817 {
1818 /* Squeeze multiple spaces and tabs after an #if or #elif
1819 directive to a single space. */
1820 fputc (' ', yyout);
1821 while ((c = input ()) == ' ' || c == '\t')
1822 {
1823 /* empty */
1824 }
1825 }
1826 unput (c);
1827 if (t == EIC_DEFINE)
1828 {
1829 gobble_define (&lineno);
1830 }
1831 }
1832 else if (ansi_check && (t == EIC_ELSE || t == EIC_ENDIF))
1833 {
1834 /* If requested, make sure there's nothing after an #else or #endif. */
1835 int found_non_ansi = 0;
1836 int cpp_directive_lineno = lineno;
1837 int c;
1838 while ((c = INPUT_AND_ECHO ()) != EOF)
1839 {
1840 if (isblank (c))
1841 continue;
1842 if (c == '/')
1843 {
1844 c = INPUT_AND_ECHO ();
1845 if (c == EOF)
1846 break;
1847 if (c == '*')
1848 {
1849 gobble_c_comment (in_file, &lineno);
1850 continue;
1851 }
1852 if (c == '/')
1853 {
1854 gobble_line (&lineno);
1855 break;
1856 }
1857
1858 /* else, fall through to next if-stmt */
1859 }
1860
1861 if (c == '\n')
1862 {
1863 ++lineno;
1864 break;
1865 }
1866
1867 /* We've found a token after an #else or #endif.
1868 Continue reading to end of line. */
1869 found_non_ansi = 1;
1870 }
1871
1872 if (found_non_ansi)
1873 {
1874 if (!list_files_only)
1875 error (0, 0,
1876 _("%s: line %d: text following `#%s' violates ANSI standard"),
1877 in_file, cpp_directive_lineno,
1878 (t == EIC_ELSE ? "else" : "endif"));
1879 if (fail < 1)
1880 fail = 1;
1881 }
1882 }
1883
1884 if (fail > lex_fail)
1885 lex_fail = fail;
1886 }
1887 YY_BREAK
1888 case 9:
1889 YY_RULE_SETUP
1890 #line 570 "./src/cppi.l"
1891 { MY_ECHO; }
1892 YY_BREAK
1893 case 10:
1894 YY_RULE_SETUP
1895 #line 571 "./src/cppi.l"
1896 { MY_ECHO; }
1897 YY_BREAK
1898 case 11:
1899 /* rule 11 can match eol */
1900 YY_RULE_SETUP
1901 #line 573 "./src/cppi.l"
1902 { MY_ECHO; ++lineno; }
1903 YY_BREAK
1904 case 12:
1905 YY_RULE_SETUP
1906 #line 574 "./src/cppi.l"
1907 { MY_ECHO; }
1908 YY_BREAK
1909 case YY_STATE_EOF(INITIAL):
1910 #line 576 "./src/cppi.l"
1911 {
1912 if (i_depth != initial_i_depth)
1913 {
1914 if (!list_files_only)
1915 {
1916 /* Iterate the opener stack from bottom to top, giving a
1917 diagnostic per unterminated #if* directive.
1918 Torture this code with a command like this:
1919 $ yes '#if FOO' |head -600 |cppi -c */
1920 unsigned int i;
1921 for (i = 0; i < OPENER_STACK_HEIGHT; i++)
1922 {
1923 struct KL_pair x = kth_entry (i);
1924 error (0, 0, _("%s: line %d: unterminated #%s"),
1925 in_file, x.line_number, directive[x.opener_type]);
1926 }
1927 }
1928
1929 lex_fail = EXIT_LEX_ERROR;
1930 }
1931
1932 return lex_fail;
1933 }
1934 YY_BREAK
1935 case 13:
1936 YY_RULE_SETUP
1937 #line 600 "./src/cppi.l"
1938 ECHO;
1939 YY_BREAK
1940 #line 1941 "lex.yy.c"
1941
1942 case YY_END_OF_BUFFER:
1943 {
1944 /* Amount of text matched not including the EOB char. */
1945 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1946
1947 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1948 *yy_cp = (yy_hold_char);
1949 YY_RESTORE_YY_MORE_OFFSET
1950
1951 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1952 {
1953 /* We're scanning a new file or input source. It's
1954 * possible that this happened because the user
1955 * just pointed yyin at a new source and called
1956 * yylex(). If so, then we have to assure
1957 * consistency between YY_CURRENT_BUFFER and our
1958 * globals. Here is the right place to do so, because
1959 * this is the first action (other than possibly a
1960 * back-up) that will match for the new input source.
1961 */
1962 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1963 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1964 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1965 }
1966
1967 /* Note that here we test for yy_c_buf_p "<=" to the position
1968 * of the first EOB in the buffer, since yy_c_buf_p will
1969 * already have been incremented past the NUL character
1970 * (since all states make transitions on EOB to the
1971 * end-of-buffer state). Contrast this with the test
1972 * in input().
1973 */
1974 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1975 { /* This was really a NUL. */
1976 yy_state_type yy_next_state;
1977
1978 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1979
1980 yy_current_state = yy_get_previous_state( );
1981
1982 /* Okay, we're now positioned to make the NUL
1983 * transition. We couldn't have
1984 * yy_get_previous_state() go ahead and do it
1985 * for us because it doesn't know how to deal
1986 * with the possibility of jamming (and we don't
1987 * want to build jamming into it because then it
1988 * will run more slowly).
1989 */
1990
1991 yy_next_state = yy_try_NUL_trans( yy_current_state );
1992
1993 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1994
1995 if ( yy_next_state )
1996 {
1997 /* Consume the NUL. */
1998 yy_cp = ++(yy_c_buf_p);
1999 yy_current_state = yy_next_state;
2000 goto yy_match;
2001 }
2002
2003 else
2004 {
2005 yy_cp = (yy_c_buf_p);
2006 goto yy_find_action;
2007 }
2008 }
2009
2010 else switch ( yy_get_next_buffer( ) )
2011 {
2012 case EOB_ACT_END_OF_FILE:
2013 {
2014 (yy_did_buffer_switch_on_eof) = 0;
2015
2016 if ( yywrap( ) )
2017 {
2018 /* Note: because we've taken care in
2019 * yy_get_next_buffer() to have set up
2020 * yytext, we can now set up
2021 * yy_c_buf_p so that if some total
2022 * hoser (like flex itself) wants to
2023 * call the scanner after we return the
2024 * YY_NULL, it'll still work - another
2025 * YY_NULL will get returned.
2026 */
2027 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2028
2029 yy_act = YY_STATE_EOF(YY_START);
2030 goto do_action;
2031 }
2032
2033 else
2034 {
2035 if ( ! (yy_did_buffer_switch_on_eof) )
2036 YY_NEW_FILE;
2037 }
2038 break;
2039 }
2040
2041 case EOB_ACT_CONTINUE_SCAN:
2042 (yy_c_buf_p) =
2043 (yytext_ptr) + yy_amount_of_matched_text;
2044
2045 yy_current_state = yy_get_previous_state( );
2046
2047 yy_cp = (yy_c_buf_p);
2048 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2049 goto yy_match;
2050
2051 case EOB_ACT_LAST_MATCH:
2052 (yy_c_buf_p) =
2053 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2054
2055 yy_current_state = yy_get_previous_state( );
2056
2057 yy_cp = (yy_c_buf_p);
2058 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2059 goto yy_find_action;
2060 }
2061 break;
2062 }
2063
2064 default:
2065 YY_FATAL_ERROR(
2066 "fatal flex scanner internal error--no action found" );
2067 } /* end of action switch */
2068 } /* end of scanning one token */
2069 } /* end of yylex */
2070
2071 /* yy_get_next_buffer - try to read in a new buffer
2072 *
2073 * Returns a code representing an action:
2074 * EOB_ACT_LAST_MATCH -
2075 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2076 * EOB_ACT_END_OF_FILE - end of file
2077 */
yy_get_next_buffer(void)2078 static int yy_get_next_buffer (void)
2079 {
2080 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2081 register char *source = (yytext_ptr);
2082 register int number_to_move, i;
2083 int ret_val;
2084
2085 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2086 YY_FATAL_ERROR(
2087 "fatal flex scanner internal error--end of buffer missed" );
2088
2089 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2090 { /* Don't try to fill the buffer, so this is an EOF. */
2091 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2092 {
2093 /* We matched a single character, the EOB, so
2094 * treat this as a final EOF.
2095 */
2096 return EOB_ACT_END_OF_FILE;
2097 }
2098
2099 else
2100 {
2101 /* We matched some text prior to the EOB, first
2102 * process it.
2103 */
2104 return EOB_ACT_LAST_MATCH;
2105 }
2106 }
2107
2108 /* Try to read more data. */
2109
2110 /* First move last chars to start of buffer. */
2111 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2112
2113 for ( i = 0; i < number_to_move; ++i )
2114 *(dest++) = *(source++);
2115
2116 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2117 /* don't do the read, it's not guaranteed to return an EOF,
2118 * just force an EOF
2119 */
2120 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2121
2122 else
2123 {
2124 yy_size_t num_to_read =
2125 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2126
2127 while ( num_to_read <= 0 )
2128 { /* Not enough room in the buffer - grow it. */
2129
2130 /* just a shorter name for the current buffer */
2131 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
2132
2133 int yy_c_buf_p_offset =
2134 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2135
2136 if ( b->yy_is_our_buffer )
2137 {
2138 yy_size_t new_size = b->yy_buf_size * 2;
2139
2140 if ( new_size <= 0 )
2141 b->yy_buf_size += b->yy_buf_size / 8;
2142 else
2143 b->yy_buf_size *= 2;
2144
2145 b->yy_ch_buf = (char *)
2146 /* Include room in for 2 EOB chars. */
2147 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
2148 }
2149 else
2150 /* Can't grow it, we don't own it. */
2151 b->yy_ch_buf = 0;
2152
2153 if ( ! b->yy_ch_buf )
2154 YY_FATAL_ERROR(
2155 "fatal error - scanner input buffer overflow" );
2156
2157 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2158
2159 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2160 number_to_move - 1;
2161
2162 }
2163
2164 if ( num_to_read > YY_READ_BUF_SIZE )
2165 num_to_read = YY_READ_BUF_SIZE;
2166
2167 /* Read in more data. */
2168 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2169 (yy_n_chars), num_to_read );
2170
2171 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2172 }
2173
2174 if ( (yy_n_chars) == 0 )
2175 {
2176 if ( number_to_move == YY_MORE_ADJ )
2177 {
2178 ret_val = EOB_ACT_END_OF_FILE;
2179 yyrestart(yyin );
2180 }
2181
2182 else
2183 {
2184 ret_val = EOB_ACT_LAST_MATCH;
2185 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2186 YY_BUFFER_EOF_PENDING;
2187 }
2188 }
2189
2190 else
2191 ret_val = EOB_ACT_CONTINUE_SCAN;
2192
2193 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2194 /* Extend the array by 50%, plus the number we really need. */
2195 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2196 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
2197 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2198 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2199 }
2200
2201 (yy_n_chars) += number_to_move;
2202 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2203 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2204
2205 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2206
2207 return ret_val;
2208 }
2209
2210 /* yy_get_previous_state - get the state just before the EOB char was reached */
2211
yy_get_previous_state(void)2212 static yy_state_type yy_get_previous_state (void)
2213 {
2214 register yy_state_type yy_current_state;
2215 register char *yy_cp;
2216
2217 yy_current_state = (yy_start);
2218 yy_current_state += YY_AT_BOL();
2219
2220 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2221 {
2222 if ( *yy_cp )
2223 {
2224 yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)];
2225 }
2226 else
2227 yy_current_state = yy_NUL_trans[yy_current_state];
2228 }
2229
2230 return yy_current_state;
2231 }
2232
2233 /* yy_try_NUL_trans - try to make a transition on the NUL character
2234 *
2235 * synopsis
2236 * next_state = yy_try_NUL_trans( current_state );
2237 */
yy_try_NUL_trans(yy_state_type yy_current_state)2238 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
2239 {
2240 register int yy_is_jam;
2241
2242 yy_current_state = yy_NUL_trans[yy_current_state];
2243 yy_is_jam = (yy_current_state == 0);
2244
2245 return yy_is_jam ? 0 : yy_current_state;
2246 }
2247
yyunput(int c,register char * yy_bp)2248 static void yyunput (int c, register char * yy_bp )
2249 {
2250 register char *yy_cp;
2251
2252 yy_cp = (yy_c_buf_p);
2253
2254 /* undo effects of setting up yytext */
2255 *yy_cp = (yy_hold_char);
2256
2257 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2258 { /* need to shift things up to make room */
2259 /* +2 for EOB chars. */
2260 register yy_size_t number_to_move = (yy_n_chars) + 2;
2261 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2262 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2263 register char *source =
2264 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2265
2266 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2267 *--dest = *--source;
2268
2269 yy_cp += (int) (dest - source);
2270 yy_bp += (int) (dest - source);
2271 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2272 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2273
2274 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2275 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2276 }
2277
2278 *--yy_cp = (char) c;
2279
2280 (yytext_ptr) = yy_bp;
2281 (yy_hold_char) = *yy_cp;
2282 (yy_c_buf_p) = yy_cp;
2283 }
2284
2285 #ifndef YY_NO_INPUT
2286 #ifdef __cplusplus
yyinput(void)2287 static int yyinput (void)
2288 #else
2289 static int input (void)
2290 #endif
2291
2292 {
2293 int c;
2294
2295 *(yy_c_buf_p) = (yy_hold_char);
2296
2297 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2298 {
2299 /* yy_c_buf_p now points to the character we want to return.
2300 * If this occurs *before* the EOB characters, then it's a
2301 * valid NUL; if not, then we've hit the end of the buffer.
2302 */
2303 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2304 /* This was really a NUL. */
2305 *(yy_c_buf_p) = '\0';
2306
2307 else
2308 { /* need more input */
2309 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
2310 ++(yy_c_buf_p);
2311
2312 switch ( yy_get_next_buffer( ) )
2313 {
2314 case EOB_ACT_LAST_MATCH:
2315 /* This happens because yy_g_n_b()
2316 * sees that we've accumulated a
2317 * token and flags that we need to
2318 * try matching the token before
2319 * proceeding. But for input(),
2320 * there's no matching to consider.
2321 * So convert the EOB_ACT_LAST_MATCH
2322 * to EOB_ACT_END_OF_FILE.
2323 */
2324
2325 /* Reset buffer status. */
2326 yyrestart(yyin );
2327
2328 /*FALLTHROUGH*/
2329
2330 case EOB_ACT_END_OF_FILE:
2331 {
2332 if ( yywrap( ) )
2333 return EOF;
2334
2335 if ( ! (yy_did_buffer_switch_on_eof) )
2336 YY_NEW_FILE;
2337 #ifdef __cplusplus
2338 return yyinput();
2339 #else
2340 return input();
2341 #endif
2342 }
2343
2344 case EOB_ACT_CONTINUE_SCAN:
2345 (yy_c_buf_p) = (yytext_ptr) + offset;
2346 break;
2347 }
2348 }
2349 }
2350
2351 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
2352 *(yy_c_buf_p) = '\0'; /* preserve yytext */
2353 (yy_hold_char) = *++(yy_c_buf_p);
2354
2355 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
2356
2357 return c;
2358 }
2359 #endif /* ifndef YY_NO_INPUT */
2360
2361 /** Immediately switch to a different input stream.
2362 * @param input_file A readable stream.
2363 *
2364 * @note This function does not reset the start condition to @c INITIAL .
2365 */
yyrestart(FILE * input_file)2366 void yyrestart (FILE * input_file )
2367 {
2368
2369 if ( ! YY_CURRENT_BUFFER ){
2370 yyensure_buffer_stack ();
2371 YY_CURRENT_BUFFER_LVALUE =
2372 yy_create_buffer(yyin,YY_BUF_SIZE );
2373 }
2374
2375 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
2376 yy_load_buffer_state( );
2377 }
2378
2379 /** Switch to a different input buffer.
2380 * @param new_buffer The new input buffer.
2381 *
2382 */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)2383 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
2384 {
2385
2386 /* TODO. We should be able to replace this entire function body
2387 * with
2388 * yypop_buffer_state();
2389 * yypush_buffer_state(new_buffer);
2390 */
2391 yyensure_buffer_stack ();
2392 if ( YY_CURRENT_BUFFER == new_buffer )
2393 return;
2394
2395 if ( YY_CURRENT_BUFFER )
2396 {
2397 /* Flush out information for old buffer. */
2398 *(yy_c_buf_p) = (yy_hold_char);
2399 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2400 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2401 }
2402
2403 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2404 yy_load_buffer_state( );
2405
2406 /* We don't actually know whether we did this switch during
2407 * EOF (yywrap()) processing, but the only time this flag
2408 * is looked at is after yywrap() is called, so it's safe
2409 * to go ahead and always set it.
2410 */
2411 (yy_did_buffer_switch_on_eof) = 1;
2412 }
2413
yy_load_buffer_state(void)2414 static void yy_load_buffer_state (void)
2415 {
2416 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2417 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2418 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2419 (yy_hold_char) = *(yy_c_buf_p);
2420 }
2421
2422 /** Allocate and initialize an input buffer state.
2423 * @param file A readable stream.
2424 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2425 *
2426 * @return the allocated buffer state.
2427 */
yy_create_buffer(FILE * file,int size)2428 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
2429 {
2430 YY_BUFFER_STATE b;
2431
2432 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
2433 if ( ! b )
2434 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2435
2436 b->yy_buf_size = size;
2437
2438 /* yy_ch_buf has to be 2 characters longer than the size given because
2439 * we need to put in 2 end-of-buffer characters.
2440 */
2441 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
2442 if ( ! b->yy_ch_buf )
2443 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2444
2445 b->yy_is_our_buffer = 1;
2446
2447 yy_init_buffer(b,file );
2448
2449 return b;
2450 }
2451
2452 /** Destroy the buffer.
2453 * @param b a buffer created with yy_create_buffer()
2454 *
2455 */
yy_delete_buffer(YY_BUFFER_STATE b)2456 void yy_delete_buffer (YY_BUFFER_STATE b )
2457 {
2458
2459 if ( ! b )
2460 return;
2461
2462 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2463 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2464
2465 if ( b->yy_is_our_buffer )
2466 yyfree((void *) b->yy_ch_buf );
2467
2468 yyfree((void *) b );
2469 }
2470
2471 /* Initializes or reinitializes a buffer.
2472 * This function is sometimes called more than once on the same buffer,
2473 * such as during a yyrestart() or at EOF.
2474 */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)2475 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
2476
2477 {
2478 int oerrno = errno;
2479
2480 yy_flush_buffer(b );
2481
2482 b->yy_input_file = file;
2483 b->yy_fill_buffer = 1;
2484
2485 /* If b is the current buffer, then yy_init_buffer was _probably_
2486 * called from yyrestart() or through yy_get_next_buffer.
2487 * In that case, we don't want to reset the lineno or column.
2488 */
2489 if (b != YY_CURRENT_BUFFER){
2490 b->yy_bs_lineno = 1;
2491 b->yy_bs_column = 0;
2492 }
2493
2494 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2495
2496 errno = oerrno;
2497 }
2498
2499 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2500 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2501 *
2502 */
yy_flush_buffer(YY_BUFFER_STATE b)2503 void yy_flush_buffer (YY_BUFFER_STATE b )
2504 {
2505 if ( ! b )
2506 return;
2507
2508 b->yy_n_chars = 0;
2509
2510 /* We always need two end-of-buffer characters. The first causes
2511 * a transition to the end-of-buffer state. The second causes
2512 * a jam in that state.
2513 */
2514 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2515 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2516
2517 b->yy_buf_pos = &b->yy_ch_buf[0];
2518
2519 b->yy_at_bol = 1;
2520 b->yy_buffer_status = YY_BUFFER_NEW;
2521
2522 if ( b == YY_CURRENT_BUFFER )
2523 yy_load_buffer_state( );
2524 }
2525
2526 /** Pushes the new state onto the stack. The new state becomes
2527 * the current state. This function will allocate the stack
2528 * if necessary.
2529 * @param new_buffer The new state.
2530 *
2531 */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)2532 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
2533 {
2534 if (new_buffer == NULL)
2535 return;
2536
2537 yyensure_buffer_stack();
2538
2539 /* This block is copied from yy_switch_to_buffer. */
2540 if ( YY_CURRENT_BUFFER )
2541 {
2542 /* Flush out information for old buffer. */
2543 *(yy_c_buf_p) = (yy_hold_char);
2544 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2545 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2546 }
2547
2548 /* Only push if top exists. Otherwise, replace top. */
2549 if (YY_CURRENT_BUFFER)
2550 (yy_buffer_stack_top)++;
2551 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2552
2553 /* copied from yy_switch_to_buffer. */
2554 yy_load_buffer_state( );
2555 (yy_did_buffer_switch_on_eof) = 1;
2556 }
2557
2558 /** Removes and deletes the top of the stack, if present.
2559 * The next element becomes the new top.
2560 *
2561 */
yypop_buffer_state(void)2562 void yypop_buffer_state (void)
2563 {
2564 if (!YY_CURRENT_BUFFER)
2565 return;
2566
2567 yy_delete_buffer(YY_CURRENT_BUFFER );
2568 YY_CURRENT_BUFFER_LVALUE = NULL;
2569 if ((yy_buffer_stack_top) > 0)
2570 --(yy_buffer_stack_top);
2571
2572 if (YY_CURRENT_BUFFER) {
2573 yy_load_buffer_state( );
2574 (yy_did_buffer_switch_on_eof) = 1;
2575 }
2576 }
2577
2578 /* Allocates the stack if it does not exist.
2579 * Guarantees space for at least one push.
2580 */
yyensure_buffer_stack(void)2581 static void yyensure_buffer_stack (void)
2582 {
2583 yy_size_t num_to_alloc;
2584
2585 if (!(yy_buffer_stack)) {
2586
2587 /* First allocation is just for 2 elements, since we don't know if this
2588 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2589 * immediate realloc on the next call.
2590 */
2591 num_to_alloc = 1;
2592 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2593 (num_to_alloc * sizeof(struct yy_buffer_state*)
2594 );
2595 if ( ! (yy_buffer_stack) )
2596 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2597
2598 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2599
2600 (yy_buffer_stack_max) = num_to_alloc;
2601 (yy_buffer_stack_top) = 0;
2602 return;
2603 }
2604
2605 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2606
2607 /* Increase the buffer to prepare for a possible push. */
2608 int grow_size = 8 /* arbitrary grow size */;
2609
2610 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2611 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2612 ((yy_buffer_stack),
2613 num_to_alloc * sizeof(struct yy_buffer_state*)
2614 );
2615 if ( ! (yy_buffer_stack) )
2616 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2617
2618 /* zero only the new slots.*/
2619 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2620 (yy_buffer_stack_max) = num_to_alloc;
2621 }
2622 }
2623
2624 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2625 * @param base the character buffer
2626 * @param size the size in bytes of the character buffer
2627 *
2628 * @return the newly allocated buffer state object.
2629 */
yy_scan_buffer(char * base,yy_size_t size)2630 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
2631 {
2632 YY_BUFFER_STATE b;
2633
2634 if ( size < 2 ||
2635 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2636 base[size-1] != YY_END_OF_BUFFER_CHAR )
2637 /* They forgot to leave room for the EOB's. */
2638 return 0;
2639
2640 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
2641 if ( ! b )
2642 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2643
2644 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2645 b->yy_buf_pos = b->yy_ch_buf = base;
2646 b->yy_is_our_buffer = 0;
2647 b->yy_input_file = 0;
2648 b->yy_n_chars = b->yy_buf_size;
2649 b->yy_is_interactive = 0;
2650 b->yy_at_bol = 1;
2651 b->yy_fill_buffer = 0;
2652 b->yy_buffer_status = YY_BUFFER_NEW;
2653
2654 yy_switch_to_buffer(b );
2655
2656 return b;
2657 }
2658
2659 /** Setup the input buffer state to scan a string. The next call to yylex() will
2660 * scan from a @e copy of @a str.
2661 * @param yystr a NUL-terminated string to scan
2662 *
2663 * @return the newly allocated buffer state object.
2664 * @note If you want to scan bytes that may contain NUL values, then use
2665 * yy_scan_bytes() instead.
2666 */
yy_scan_string(yyconst char * yystr)2667 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
2668 {
2669
2670 return yy_scan_bytes(yystr,strlen(yystr) );
2671 }
2672
2673 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2674 * scan from a @e copy of @a bytes.
2675 * @param yybytes the byte buffer to scan
2676 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2677 *
2678 * @return the newly allocated buffer state object.
2679 */
yy_scan_bytes(yyconst char * yybytes,yy_size_t _yybytes_len)2680 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
2681 {
2682 YY_BUFFER_STATE b;
2683 char *buf;
2684 yy_size_t n;
2685 int i;
2686
2687 /* Get memory for full buffer, including space for trailing EOB's. */
2688 n = _yybytes_len + 2;
2689 buf = (char *) yyalloc(n );
2690 if ( ! buf )
2691 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2692
2693 for ( i = 0; i < _yybytes_len; ++i )
2694 buf[i] = yybytes[i];
2695
2696 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2697
2698 b = yy_scan_buffer(buf,n );
2699 if ( ! b )
2700 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2701
2702 /* It's okay to grow etc. this buffer, and we should throw it
2703 * away when we're done.
2704 */
2705 b->yy_is_our_buffer = 1;
2706
2707 return b;
2708 }
2709
2710 #ifndef YY_EXIT_FAILURE
2711 #define YY_EXIT_FAILURE 2
2712 #endif
2713
yy_fatal_error(yyconst char * msg)2714 static void yy_fatal_error (yyconst char* msg )
2715 {
2716 (void) fprintf( stderr, "%s\n", msg );
2717 exit( YY_EXIT_FAILURE );
2718 }
2719
2720 /* Redefine yyless() so it works in section 3 code. */
2721
2722 #undef yyless
2723 #define yyless(n) \
2724 do \
2725 { \
2726 /* Undo effects of setting up yytext. */ \
2727 int yyless_macro_arg = (n); \
2728 YY_LESS_LINENO(yyless_macro_arg);\
2729 yytext[yyleng] = (yy_hold_char); \
2730 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2731 (yy_hold_char) = *(yy_c_buf_p); \
2732 *(yy_c_buf_p) = '\0'; \
2733 yyleng = yyless_macro_arg; \
2734 } \
2735 while ( 0 )
2736
2737 /* Accessor methods (get/set functions) to struct members. */
2738
2739 /** Get the current line number.
2740 *
2741 */
yyget_lineno(void)2742 int yyget_lineno (void)
2743 {
2744
2745 return yylineno;
2746 }
2747
2748 /** Get the input stream.
2749 *
2750 */
yyget_in(void)2751 FILE *yyget_in (void)
2752 {
2753 return yyin;
2754 }
2755
2756 /** Get the output stream.
2757 *
2758 */
yyget_out(void)2759 FILE *yyget_out (void)
2760 {
2761 return yyout;
2762 }
2763
2764 /** Get the length of the current token.
2765 *
2766 */
yyget_leng(void)2767 yy_size_t yyget_leng (void)
2768 {
2769 return yyleng;
2770 }
2771
2772 /** Get the current token.
2773 *
2774 */
2775
yyget_text(void)2776 char *yyget_text (void)
2777 {
2778 return yytext;
2779 }
2780
2781 /** Set the current line number.
2782 * @param line_number
2783 *
2784 */
yyset_lineno(int line_number)2785 void yyset_lineno (int line_number )
2786 {
2787
2788 yylineno = line_number;
2789 }
2790
2791 /** Set the input stream. This does not discard the current
2792 * input buffer.
2793 * @param in_str A readable stream.
2794 *
2795 * @see yy_switch_to_buffer
2796 */
yyset_in(FILE * in_str)2797 void yyset_in (FILE * in_str )
2798 {
2799 yyin = in_str ;
2800 }
2801
yyset_out(FILE * out_str)2802 void yyset_out (FILE * out_str )
2803 {
2804 yyout = out_str ;
2805 }
2806
yyget_debug(void)2807 int yyget_debug (void)
2808 {
2809 return yy_flex_debug;
2810 }
2811
yyset_debug(int bdebug)2812 void yyset_debug (int bdebug )
2813 {
2814 yy_flex_debug = bdebug ;
2815 }
2816
yy_init_globals(void)2817 static int yy_init_globals (void)
2818 {
2819 /* Initialization is the same as for the non-reentrant scanner.
2820 * This function is called from yylex_destroy(), so don't allocate here.
2821 */
2822
2823 (yy_buffer_stack) = 0;
2824 (yy_buffer_stack_top) = 0;
2825 (yy_buffer_stack_max) = 0;
2826 (yy_c_buf_p) = (char *) 0;
2827 (yy_init) = 0;
2828 (yy_start) = 0;
2829
2830 /* Defined in main.c */
2831 #ifdef YY_STDINIT
2832 yyin = stdin;
2833 yyout = stdout;
2834 #else
2835 yyin = (FILE *) 0;
2836 yyout = (FILE *) 0;
2837 #endif
2838
2839 /* For future reference: Set errno on error, since we are called by
2840 * yylex_init()
2841 */
2842 return 0;
2843 }
2844
2845 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(void)2846 int yylex_destroy (void)
2847 {
2848
2849 /* Pop the buffer stack, destroying each element. */
2850 while(YY_CURRENT_BUFFER){
2851 yy_delete_buffer(YY_CURRENT_BUFFER );
2852 YY_CURRENT_BUFFER_LVALUE = NULL;
2853 yypop_buffer_state();
2854 }
2855
2856 /* Destroy the stack itself. */
2857 yyfree((yy_buffer_stack) );
2858 (yy_buffer_stack) = NULL;
2859
2860 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2861 * yylex() is called, initialization will occur. */
2862 yy_init_globals( );
2863
2864 return 0;
2865 }
2866
2867 /*
2868 * Internal utility routines.
2869 */
2870
2871 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,yyconst char * s2,int n)2872 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2873 {
2874 register int i;
2875 for ( i = 0; i < n; ++i )
2876 s1[i] = s2[i];
2877 }
2878 #endif
2879
2880 #ifdef YY_NEED_STRLEN
yy_flex_strlen(yyconst char * s)2881 static int yy_flex_strlen (yyconst char * s )
2882 {
2883 register int n;
2884 for ( n = 0; s[n]; ++n )
2885 ;
2886
2887 return n;
2888 }
2889 #endif
2890
yyalloc(yy_size_t size)2891 void *yyalloc (yy_size_t size )
2892 {
2893 return (void *) malloc( size );
2894 }
2895
yyrealloc(void * ptr,yy_size_t size)2896 void *yyrealloc (void * ptr, yy_size_t size )
2897 {
2898 /* The cast to (char *) in the following accommodates both
2899 * implementations that use char* generic pointers, and those
2900 * that use void* generic pointers. It works with the latter
2901 * because both ANSI C and C++ allow castless assignment from
2902 * any pointer type to void*, and deal with argument conversions
2903 * as though doing an assignment.
2904 */
2905 return (void *) realloc( (char *) ptr, size );
2906 }
2907
yyfree(void * ptr)2908 void yyfree (void * ptr )
2909 {
2910 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2911 }
2912
2913 #define YYTABLES_NAME "yytables"
2914
2915 #line 600 "./src/cppi.l"
2916
2917
2918
2919 static int
cpp_indent(const char * in_file)2920 cpp_indent (const char *in_file)
2921 {
2922 FILE *in = NULL;
2923 int fail;
2924
2925 if (STREQ (in_file, "-"))
2926 {
2927 yyin = stdin;
2928 in_file = "standard input";
2929 }
2930 else
2931 {
2932 if ((in = fopen (in_file, "r")) == NULL)
2933 {
2934 error (EXIT_FILE_ERROR, errno, "%s", in_file);
2935 }
2936 yyin = in;
2937 }
2938
2939 fail = cpp_i (in_file);
2940
2941 obstack_free (&opener_stack, NULL);
2942
2943 if (in && fclose (in) == EOF)
2944 error (EXIT_FILE_ERROR, errno, "%s", in_file);
2945
2946 return fail;
2947 }
2948
2949 static void usage (int status) ATTRIBUTE_NORETURN;
2950 static void
usage(int status)2951 usage (int status)
2952 {
2953 if (status != 0)
2954 {
2955 fprintf (stderr, "Try `%s --help' for more information.\n",
2956 program_name);
2957 }
2958 else
2959 {
2960 printf (_("\
2961 Usage: %s [FILE]\n\
2962 or: %s -c [OPTION] [FILE]...\n\
2963 "), program_name, program_name);
2964 fputs (_("\
2965 \n\
2966 Indent the C preprocessor directives in FILE to reflect their nesting\n\
2967 and ensure that there is exactly one space character between each #if,\n\
2968 #elif, #define directive and the following token, and write the result\n\
2969 "), stdout);
2970 fputs (_("\
2971 to standard output. The number of spaces between the `#' and the following\n\
2972 directive must correspond to the level of nesting of that directive.\n\
2973 With no FILE, or when FILE is -, read standard input.\n\
2974 "), stdout);
2975 fputs (_("\
2976 \n\
2977 -a, --ansi when checking, fail if text follows #else or #endif\n\
2978 -c, --check set exit code, but don't produce any output\n\
2979 -l, --list-files-only don't generate diagnostics about indentation;\n\
2980 print to stdout only the names of files that\n\
2981 are not properly indented\n\
2982 "), stdout);
2983 fputs (_("\
2984 -m, --max-string-length=LENGTH\n\
2985 fail if there is a double-quoted string longer\n\
2986 than LENGTH; if LENGTH is 0 (the default),\n\
2987 then there is no limit\n\
2988 "), stdout);
2989 fputs (HELP_OPTION_DESCRIPTION, stdout);
2990 fputs (VERSION_OPTION_DESCRIPTION, stdout);
2991 fputs (_("\n\
2992 With the -c option, don't write to stdout. Instead, check the\n\
2993 indentation of the specified files giving diagnostics for preprocessor\n\
2994 lines that aren't properly indented or are otherwise invalid.\n\
2995 "), stdout);
2996 fputs (_("\
2997 \n\
2998 Note that --ansi without --check does not correct the problem of\n\
2999 non-ANSI text following #else and #endif directives.\n\
3000 "), stdout);
3001 fputs (_("\
3002 \n\
3003 The exit code will be one of these:\n\
3004 0 all directives properly indented\n\
3005 1 some cpp directive(s) improperly indented, or\n\
3006 text follows #else/#endif (enabled with --check --ansi), or\n\
3007 a double-quoted string is longer than the specified maximum\n\
3008 2 #if/#endif mismatch, EOF in comment or string\n\
3009 3 file (e.g. open/read/write) error\n\
3010 "), stdout);
3011 fputs (_("\
3012 \n\
3013 A pragma directive may have its `#' indented.\n\
3014 "), stdout);
3015 printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
3016 }
3017 exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
3018 }
3019
3020 /* Read the body of a #define directive (echoing or not, as appropriate).
3021 That is, read up to and including the first unescaped newline (or EOF).
3022 This is necessary because otherwise, we could mistakenly interpret the
3023 stringification of a macro argument as a cpp directive. */
3024
3025 static void
gobble_define(unsigned int * line_number)3026 gobble_define (unsigned int *line_number)
3027 {
3028 int c;
3029 int backslash_count = 0;
3030 while ((c = INPUT_AND_ECHO ()) != EOF)
3031 {
3032 if (c == '\n')
3033 {
3034 ++(*line_number);
3035 if (backslash_count % 2 == 0)
3036 break;
3037 }
3038
3039 if (c == '\\')
3040 ++backslash_count;
3041 else
3042 backslash_count = 0;
3043 }
3044 }
3045
3046 /* We've read the C comment opener. Read up to and including
3047 the closing delimiter. */
3048
3049 static void
gobble_c_comment(const char * in_file,unsigned int * line_number)3050 gobble_c_comment (const char *in_file, unsigned int *line_number)
3051 {
3052 int start_lineno = *line_number;
3053 for ( ; ; )
3054 {
3055 int c;
3056 while ((c = INPUT_AND_ECHO ()) != '*' && c != EOF)
3057 {
3058 if (c == '\n')
3059 ++(*line_number);
3060 }
3061
3062 if (c == '*')
3063 {
3064 while ((c = INPUT_AND_ECHO ()) == '*')
3065 ;
3066 if (c == '/')
3067 break; /* found the end */
3068 if (c == '\n')
3069 ++(*line_number);
3070 }
3071
3072 if (c == EOF)
3073 {
3074 error (EXIT_LEX_ERROR, 0, _("%s: line %d: EOF in comment"),
3075 in_file, start_lineno);
3076 break;
3077 }
3078 }
3079 }
3080
3081 /* Read up to and including any newline. */
3082
3083 static void
gobble_line(unsigned int * line_number)3084 gobble_line (unsigned int *line_number)
3085 {
3086 int c;
3087 while ((c = INPUT_AND_ECHO ()) != EOF)
3088 {
3089 if (c == '\n')
3090 {
3091 ++(*line_number);
3092 break;
3093 }
3094 }
3095 }
3096
3097 int
main(int argc,char ** argv)3098 main (int argc, char **argv)
3099 {
3100 int i;
3101 int max_err;
3102 char **file_list;
3103 int c;
3104 int fail = 0;
3105
3106 set_program_name (argv[0]);
3107 setlocale (LC_ALL, "");
3108 bindtextdomain (PACKAGE, LOCALEDIR);
3109 textdomain (PACKAGE);
3110
3111 atexit (close_stdout);
3112
3113 while ((c = getopt_long (argc, argv, "aclm:", long_options, NULL)) != -1)
3114 {
3115 switch (c)
3116 {
3117 case 0:
3118 break;
3119
3120 case 'a':
3121 ansi_check = 1;
3122 break;
3123
3124 case 'c':
3125 inhibit_output = 1;
3126 break;
3127
3128 case 'l':
3129 inhibit_output = 1;
3130 list_files_only = 1;
3131 break;
3132
3133 case 'm':
3134 if (xstrtoul (optarg, NULL, 0, &max_string_length, NULL)
3135 != LONGINT_OK)
3136 {
3137 error (0, 0, _("invalid maximum string length %s"), optarg);
3138 fail = 1;
3139 }
3140 break;
3141
3142 case_GETOPT_HELP_CHAR;
3143
3144 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
3145
3146 default:
3147 usage (EXIT_LEX_ERROR);
3148 break;
3149 }
3150 }
3151
3152 if (fail)
3153 exit (EXIT_FAILURE);
3154
3155 if (!inhibit_output && argc - optind > 2)
3156 {
3157 error (0, 0, _("too many arguments"));
3158 usage (EXIT_FAILURE);
3159 }
3160
3161 file_list = (optind == argc ? default_file_list : argv + optind);
3162
3163 max_err = 0;
3164 for (i = 0; file_list[i]; i++)
3165 {
3166 int err;
3167
3168 err = cpp_indent (file_list[i]);
3169 if (err > max_err)
3170 max_err = err;
3171
3172 if (err && list_files_only)
3173 puts (file_list[i]);
3174 }
3175
3176 exit (max_err);
3177 }
3178
3179 /*
3180 Local Variables:
3181 mode: c
3182 End:
3183 */
3184
3185