pcb 4.1.1
An interactive printed circuit board layout editor.
|
00001 00002 #line 3 "parse_l.c" 00003 00004 #define YY_INT_ALIGNED short int 00005 00006 /* A lexical scanner generated by flex */ 00007 00008 #define FLEX_SCANNER 00009 #define YY_FLEX_MAJOR_VERSION 2 00010 #define YY_FLEX_MINOR_VERSION 5 00011 #define YY_FLEX_SUBMINOR_VERSION 35 00012 #if YY_FLEX_SUBMINOR_VERSION > 0 00013 #define FLEX_BETA 00014 #endif 00015 00016 /* First, we deal with platform-specific or compiler-specific issues. */ 00017 00018 /* begin standard C headers. */ 00019 #include <stdio.h> 00020 #include <string.h> 00021 #include <errno.h> 00022 #include <stdlib.h> 00023 00024 /* end standard C headers. */ 00025 00026 /* flex integer type definitions */ 00027 00028 #ifndef FLEXINT_H 00029 #define FLEXINT_H 00030 00031 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 00032 00033 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 00034 00035 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 00036 * if you want the limit (max/min) macros for int types. 00037 */ 00038 #ifndef __STDC_LIMIT_MACROS 00039 #define __STDC_LIMIT_MACROS 1 00040 #endif 00041 00042 #include <inttypes.h> 00043 typedef int8_t flex_int8_t; 00044 typedef uint8_t flex_uint8_t; 00045 typedef int16_t flex_int16_t; 00046 typedef uint16_t flex_uint16_t; 00047 typedef int32_t flex_int32_t; 00048 typedef uint32_t flex_uint32_t; 00049 #else 00050 typedef signed char flex_int8_t; 00051 typedef short int flex_int16_t; 00052 typedef int flex_int32_t; 00053 typedef unsigned char flex_uint8_t; 00054 typedef unsigned short int flex_uint16_t; 00055 typedef unsigned int flex_uint32_t; 00056 #endif /* ! C99 */ 00057 00058 /* Limits of integral types. */ 00059 #ifndef INT8_MIN 00060 #define INT8_MIN (-128) 00061 #endif 00062 #ifndef INT16_MIN 00063 #define INT16_MIN (-32767-1) 00064 #endif 00065 #ifndef INT32_MIN 00066 #define INT32_MIN (-2147483647-1) 00067 #endif 00068 #ifndef INT8_MAX 00069 #define INT8_MAX (127) 00070 #endif 00071 #ifndef INT16_MAX 00072 #define INT16_MAX (32767) 00073 #endif 00074 #ifndef INT32_MAX 00075 #define INT32_MAX (2147483647) 00076 #endif 00077 #ifndef UINT8_MAX 00078 #define UINT8_MAX (255U) 00079 #endif 00080 #ifndef UINT16_MAX 00081 #define UINT16_MAX (65535U) 00082 #endif 00083 #ifndef UINT32_MAX 00084 #define UINT32_MAX (4294967295U) 00085 #endif 00086 00087 #endif /* ! FLEXINT_H */ 00088 00089 #ifdef __cplusplus 00090 00091 /* The "const" storage-class-modifier is valid. */ 00092 #define YY_USE_CONST 00093 00094 #else /* ! __cplusplus */ 00095 00096 /* C99 requires __STDC__ to be defined as 1. */ 00097 #if defined (__STDC__) 00098 00099 #define YY_USE_CONST 00100 00101 #endif /* defined (__STDC__) */ 00102 #endif /* ! __cplusplus */ 00103 00104 #ifdef YY_USE_CONST 00105 #define yyconst const 00106 #else 00107 #define yyconst 00108 #endif 00109 00110 /* Returned upon end-of-file. */ 00111 #define YY_NULL 0 00112 00113 /* Promotes a possibly negative, possibly signed char to an unsigned 00114 * integer for use as an array index. If the signed char is negative, 00115 * we want to instead treat it as an 8-bit unsigned char, hence the 00116 * double cast. 00117 */ 00118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 00119 00120 /* Enter a start condition. This macro really ought to take a parameter, 00121 * but we do it the disgusting crufty way forced on us by the ()-less 00122 * definition of BEGIN. 00123 */ 00124 #define BEGIN (yy_start) = 1 + 2 * 00125 00126 /* Translate the current start state into a value that can be later handed 00127 * to BEGIN to return to the state. The YYSTATE alias is for lex 00128 * compatibility. 00129 */ 00130 #define YY_START (((yy_start) - 1) / 2) 00131 #define YYSTATE YY_START 00132 00133 /* Action number for EOF rule of a given start state. */ 00134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 00135 00136 /* Special action meaning "start processing a new file". */ 00137 #define YY_NEW_FILE yyrestart(yyin ) 00138 00139 #define YY_END_OF_BUFFER_CHAR 0 00140 00141 /* Size of default input buffer. */ 00142 #ifndef YY_BUF_SIZE 00143 #define YY_BUF_SIZE 16384 00144 #endif 00145 00146 /* The state buf must be large enough to hold one state per character in the main buffer. 00147 */ 00148 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 00149 00150 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 00151 #define YY_TYPEDEF_YY_BUFFER_STATE 00152 typedef struct yy_buffer_state *YY_BUFFER_STATE; 00153 #endif 00154 00155 extern int yyleng; 00156 00157 extern FILE *yyin, *yyout; 00158 00159 #define EOB_ACT_CONTINUE_SCAN 0 00160 #define EOB_ACT_END_OF_FILE 1 00161 #define EOB_ACT_LAST_MATCH 2 00162 00163 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires 00164 * access to the local variable yy_act. Since yyless() is a macro, it would break 00165 * existing scanners that call yyless() from OUTSIDE yylex. 00166 * One obvious solution it to make yy_act a global. I tried that, and saw 00167 * a 5% performance hit in a non-yylineno scanner, because yy_act is 00168 * normally declared as a register variable-- so it is not worth it. 00169 */ 00170 #define YY_LESS_LINENO(n) \ 00171 do { \ 00172 int yyl;\ 00173 for ( yyl = n; yyl < yyleng; ++yyl )\ 00174 if ( yytext[yyl] == '\n' )\ 00175 --yylineno;\ 00176 }while(0) 00177 00178 /* Return all but the first "n" matched characters back to the input stream. */ 00179 #define yyless(n) \ 00180 do \ 00181 { \ 00182 /* Undo effects of setting up yytext. */ \ 00183 int yyless_macro_arg = (n); \ 00184 YY_LESS_LINENO(yyless_macro_arg);\ 00185 *yy_cp = (yy_hold_char); \ 00186 YY_RESTORE_YY_MORE_OFFSET \ 00187 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 00188 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 00189 } \ 00190 while ( 0 ) 00191 00192 #define unput(c) yyunput( c, (yytext_ptr) ) 00193 00194 #ifndef YY_TYPEDEF_YY_SIZE_T 00195 #define YY_TYPEDEF_YY_SIZE_T 00196 typedef size_t yy_size_t; 00197 #endif 00198 00199 #ifndef YY_STRUCT_YY_BUFFER_STATE 00200 #define YY_STRUCT_YY_BUFFER_STATE 00201 struct yy_buffer_state 00202 { 00203 FILE *yy_input_file; 00204 00205 char *yy_ch_buf; /* input buffer */ 00206 char *yy_buf_pos; /* current position in input buffer */ 00207 00208 /* Size of input buffer in bytes, not including room for EOB 00209 * characters. 00210 */ 00211 yy_size_t yy_buf_size; 00212 00213 /* Number of characters read into yy_ch_buf, not including EOB 00214 * characters. 00215 */ 00216 int yy_n_chars; 00217 00218 /* Whether we "own" the buffer - i.e., we know we created it, 00219 * and can realloc() it to grow it, and should free() it to 00220 * delete it. 00221 */ 00222 int yy_is_our_buffer; 00223 00224 /* Whether this is an "interactive" input source; if so, and 00225 * if we're using stdio for input, then we want to use getc() 00226 * instead of fread(), to make sure we stop fetching input after 00227 * each newline. 00228 */ 00229 int yy_is_interactive; 00230 00231 /* Whether we're considered to be at the beginning of a line. 00232 * If so, '^' rules will be active on the next match, otherwise 00233 * not. 00234 */ 00235 int yy_at_bol; 00236 00237 int yy_bs_lineno; 00238 int yy_bs_column; 00240 /* Whether to try to fill the input buffer when we reach the 00241 * end of it. 00242 */ 00243 int yy_fill_buffer; 00244 00245 int yy_buffer_status; 00246 00247 #define YY_BUFFER_NEW 0 00248 #define YY_BUFFER_NORMAL 1 00249 /* When an EOF's been seen but there's still some text to process 00250 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 00251 * shouldn't try reading from the input source any more. We might 00252 * still have a bunch of tokens to match, though, because of 00253 * possible backing-up. 00254 * 00255 * When we actually see the EOF, we change the status to "new" 00256 * (via yyrestart()), so that the user can continue scanning by 00257 * just pointing yyin at a new input file. 00258 */ 00259 #define YY_BUFFER_EOF_PENDING 2 00260 00261 }; 00262 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 00263 00264 /* Stack of input buffers. */ 00265 static size_t yy_buffer_stack_top = 0; 00266 static size_t yy_buffer_stack_max = 0; 00267 static YY_BUFFER_STATE * yy_buffer_stack = 0; 00269 /* We provide macros for accessing buffer states in case in the 00270 * future we want to put the buffer states in a more general 00271 * "scanner state". 00272 * 00273 * Returns the top of the stack, or NULL. 00274 */ 00275 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 00276 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 00277 : NULL) 00278 00279 /* Same as previous macro, but useful when we know that the buffer stack is not 00280 * NULL or when we need an lvalue. For internal use only. 00281 */ 00282 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 00283 00284 /* yy_hold_char holds the character lost when yytext is formed. */ 00285 static char yy_hold_char; 00286 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 00287 int yyleng; 00288 00289 /* Points to current character in buffer. */ 00290 static char *yy_c_buf_p = (char *) 0; 00291 static int yy_init = 0; /* whether we need to initialize */ 00292 static int yy_start = 0; /* start state number */ 00293 00294 /* Flag which is used to allow yywrap()'s to do buffer switches 00295 * instead of setting up a fresh yyin. A bit of a hack ... 00296 */ 00297 static int yy_did_buffer_switch_on_eof; 00298 00299 void yyrestart (FILE *input_file ); 00300 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 00301 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 00302 void yy_delete_buffer (YY_BUFFER_STATE b ); 00303 void yy_flush_buffer (YY_BUFFER_STATE b ); 00304 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 00305 void yypop_buffer_state (void ); 00306 00307 static void yyensure_buffer_stack (void ); 00308 static void yy_load_buffer_state (void ); 00309 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 00310 00311 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 00312 00313 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 00314 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 00315 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); 00316 00317 void *yyalloc (yy_size_t ); 00318 void *yyrealloc (void *,yy_size_t ); 00319 void yyfree (void * ); 00320 00321 #define yy_new_buffer yy_create_buffer 00322 00323 #define yy_set_interactive(is_interactive) \ 00324 { \ 00325 if ( ! YY_CURRENT_BUFFER ){ \ 00326 yyensure_buffer_stack (); \ 00327 YY_CURRENT_BUFFER_LVALUE = \ 00328 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 00329 } \ 00330 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 00331 } 00332 00333 #define yy_set_bol(at_bol) \ 00334 { \ 00335 if ( ! YY_CURRENT_BUFFER ){\ 00336 yyensure_buffer_stack (); \ 00337 YY_CURRENT_BUFFER_LVALUE = \ 00338 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 00339 } \ 00340 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 00341 } 00342 00343 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 00344 00345 /* Begin user sect3 */ 00346 00347 typedef unsigned char YY_CHAR; 00348 00349 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 00350 00351 typedef int yy_state_type; 00352 00353 extern int yylineno; 00354 00355 int yylineno = 1; 00356 00357 extern char *yytext; 00358 #define yytext_ptr yytext 00359 00360 static yy_state_type yy_get_previous_state (void ); 00361 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 00362 static int yy_get_next_buffer (void ); 00363 static void yy_fatal_error (yyconst char msg[] ); 00364 00365 /* Done after the current pattern has been matched and before the 00366 * corresponding action - sets up yytext. 00367 */ 00368 #define YY_DO_BEFORE_ACTION \ 00369 (yytext_ptr) = yy_bp; \ 00370 yyleng = (size_t) (yy_cp - yy_bp); \ 00371 (yy_hold_char) = *yy_cp; \ 00372 *yy_cp = '\0'; \ 00373 (yy_c_buf_p) = yy_cp; 00374 00375 #define YY_NUM_RULES 52 00376 #define YY_END_OF_BUFFER 53 00377 /* This struct is not used in this scanner, 00378 but its presence is necessary. */ 00379 struct yy_trans_info 00380 { 00381 flex_int32_t yy_verify; 00382 flex_int32_t yy_nxt; 00383 }; 00384 static yyconst flex_int16_t yy_accept[192] = 00385 { 0, 00386 0, 0, 53, 51, 48, 49, 50, 51, 47, 51, 00387 51, 43, 44, 44, 51, 51, 51, 51, 51, 51, 00388 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 00389 51, 51, 35, 51, 51, 51, 48, 0, 46, 0, 00390 47, 0, 44, 44, 43, 43, 0, 44, 0, 0, 00391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00393 0, 0, 0, 0, 40, 36, 0, 34, 32, 41, 00394 33, 42, 45, 27, 0, 0, 0, 7, 0, 0, 00395 0, 0, 0, 0, 0, 0, 0, 29, 2, 11, 00396 00397 10, 0, 14, 0, 0, 0, 0, 0, 12, 0, 00398 39, 0, 0, 0, 0, 0, 0, 0, 3, 0, 00399 26, 0, 13, 22, 0, 0, 0, 0, 0, 16, 00400 0, 38, 37, 0, 0, 0, 0, 0, 8, 0, 00401 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00402 4, 0, 0, 23, 0, 0, 0, 0, 24, 21, 00403 0, 0, 30, 19, 0, 28, 0, 25, 0, 0, 00404 5, 0, 0, 0, 0, 6, 0, 0, 31, 0, 00405 0, 0, 15, 0, 18, 0, 0, 20, 17, 1, 00406 0 00407 00408 } ; 00409 00410 static yyconst flex_int32_t yy_ec[256] = 00411 { 0, 00412 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 00413 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 00414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00415 1, 2, 1, 5, 6, 1, 1, 1, 7, 1, 00416 1, 1, 8, 1, 8, 9, 1, 10, 11, 11, 00417 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 00418 1, 1, 1, 1, 12, 13, 14, 15, 16, 17, 00419 18, 19, 1, 1, 1, 20, 21, 22, 1, 23, 00420 1, 24, 25, 26, 1, 27, 1, 1, 1, 1, 00421 1, 28, 1, 1, 1, 1, 29, 30, 31, 32, 00422 00423 33, 34, 35, 36, 37, 1, 38, 39, 40, 41, 00424 42, 43, 1, 44, 45, 46, 47, 1, 1, 48, 00425 49, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00433 00434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00439 1, 1, 1, 1, 1 00440 } ; 00441 00442 static yyconst flex_int32_t yy_meta[50] = 00443 { 0, 00444 1, 1, 2, 3, 1, 1, 1, 1, 1, 4, 00445 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 00446 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 00447 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 00448 1, 1, 1, 1, 1, 1, 1, 1, 1 00449 } ; 00450 00451 static yyconst flex_int16_t yy_base[196] = 00452 { 0, 00453 0, 0, 227, 228, 224, 228, 228, 45, 0, 0, 00454 41, 43, 46, 47, 15, 18, 201, 185, 25, 179, 00455 180, 34, 192, 187, 53, 37, 23, 41, 182, 178, 00456 176, 176, 38, 175, 166, 173, 210, 63, 228, 207, 00457 0, 203, 200, 70, 73, 75, 0, 78, 177, 161, 00458 165, 161, 190, 170, 163, 172, 55, 161, 150, 157, 00459 153, 150, 182, 162, 152, 153, 145, 159, 140, 148, 00460 139, 153, 156, 147, 228, 228, 144, 228, 228, 228, 00461 145, 228, 0, 228, 137, 139, 134, 228, 138, 144, 00462 141, 143, 127, 140, 139, 138, 132, 149, 228, 228, 00463 00464 228, 119, 228, 121, 127, 135, 118, 119, 228, 123, 00465 228, 122, 123, 126, 116, 124, 129, 110, 228, 111, 00466 228, 109, 228, 228, 115, 64, 122, 117, 107, 228, 00467 108, 228, 228, 117, 115, 101, 103, 110, 228, 97, 00468 228, 96, 96, 97, 97, 92, 97, 106, 87, 87, 00469 228, 86, 87, 228, 84, 96, 87, 92, 228, 106, 00470 86, 78, 228, 81, 78, 228, 93, 228, 82, 83, 00471 228, 86, 74, 80, 79, 228, 82, 73, 228, 80, 00472 66, 62, 228, 70, 228, 67, 57, 228, 228, 228, 00473 228, 101, 105, 109, 92 00474 00475 } ; 00476 00477 static yyconst flex_int16_t yy_def[196] = 00478 { 0, 00479 191, 1, 191, 191, 191, 191, 191, 192, 193, 194, 00480 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00481 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00482 191, 191, 191, 191, 191, 191, 191, 192, 191, 192, 00483 193, 191, 191, 191, 191, 191, 195, 191, 191, 191, 00484 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00485 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00486 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00487 191, 191, 195, 191, 191, 191, 191, 191, 191, 191, 00488 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00489 00490 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00491 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00492 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00493 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00494 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00495 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00496 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00497 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00498 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00499 0, 191, 191, 191, 191 00500 00501 } ; 00502 00503 static yyconst flex_int16_t yy_nxt[278] = 00504 { 0, 00505 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 00506 14, 15, 4, 16, 17, 18, 19, 20, 21, 22, 00507 23, 24, 25, 26, 27, 28, 29, 4, 4, 4, 00508 30, 4, 4, 4, 4, 4, 31, 32, 4, 33, 00509 34, 4, 35, 4, 4, 4, 36, 4, 4, 39, 00510 43, 44, 45, 45, 46, 46, 48, 48, 49, 51, 00511 50, 55, 59, 56, 52, 67, 63, 39, 69, 68, 00512 60, 70, 40, 71, 77, 143, 72, 78, 46, 48, 00513 48, 64, 45, 45, 45, 45, 46, 48, 48, 65, 00514 40, 92, 173, 47, 66, 83, 93, 190, 144, 189, 00515 00516 174, 38, 188, 187, 38, 41, 186, 41, 41, 42, 00517 185, 42, 42, 184, 183, 182, 181, 180, 179, 178, 00518 177, 176, 175, 172, 171, 170, 169, 168, 167, 166, 00519 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 00520 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 00521 145, 142, 141, 140, 139, 138, 137, 136, 135, 134, 00522 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 00523 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 00524 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 00525 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 00526 00527 91, 90, 89, 88, 87, 86, 85, 84, 46, 82, 00528 38, 37, 81, 80, 79, 76, 75, 74, 73, 62, 00529 61, 58, 57, 54, 53, 37, 191, 3, 191, 191, 00530 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00531 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00532 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00533 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00534 191, 191, 191, 191, 191, 191, 191 00535 } ; 00536 00537 static yyconst flex_int16_t yy_chk[278] = 00538 { 0, 00539 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00540 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00541 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00542 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00543 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 00544 11, 11, 12, 12, 13, 14, 14, 14, 15, 16, 00545 15, 19, 22, 19, 16, 26, 25, 38, 27, 26, 00546 22, 27, 8, 28, 33, 126, 28, 33, 44, 44, 00547 44, 25, 45, 45, 46, 46, 48, 48, 48, 25, 00548 38, 57, 164, 13, 25, 195, 57, 187, 126, 186, 00549 00550 164, 192, 184, 182, 192, 193, 181, 193, 193, 194, 00551 180, 194, 194, 178, 177, 175, 174, 173, 172, 170, 00552 169, 167, 165, 162, 161, 160, 158, 157, 156, 155, 00553 153, 152, 150, 149, 148, 147, 146, 145, 144, 143, 00554 142, 140, 138, 137, 136, 135, 134, 131, 129, 128, 00555 127, 125, 122, 120, 118, 117, 116, 115, 114, 113, 00556 112, 110, 108, 107, 106, 105, 104, 102, 98, 97, 00557 96, 95, 94, 93, 92, 91, 90, 89, 87, 86, 00558 85, 81, 77, 74, 73, 72, 71, 70, 69, 68, 00559 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 00560 00561 56, 55, 54, 53, 52, 51, 50, 49, 43, 42, 00562 40, 37, 36, 35, 34, 32, 31, 30, 29, 24, 00563 23, 21, 20, 18, 17, 5, 3, 191, 191, 191, 00564 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00565 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00566 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00567 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, 00568 191, 191, 191, 191, 191, 191, 191 00569 } ; 00570 00571 /* Table of booleans, true if rule could match eol. */ 00572 static yyconst flex_int32_t yy_rule_can_match_eol[53] = 00573 { 0, 00574 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00575 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00576 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, }; 00577 00578 static yy_state_type yy_last_accepting_state; 00579 static char *yy_last_accepting_cpos; 00580 00581 extern int yy_flex_debug; 00582 int yy_flex_debug = 0; 00583 00584 /* The intent behind this definition is that it'll catch 00585 * any uses of REJECT which flex missed. 00586 */ 00587 #define REJECT reject_used_but_not_detected 00588 #define yymore() yymore_used_but_not_detected 00589 #define YY_MORE_ADJ 0 00590 #define YY_RESTORE_YY_MORE_OFFSET 00591 char *yytext; 00592 #line 1 "parse_l.l" 00593 #line 2 "parse_l.l" 00594 /* 00595 * COPYRIGHT 00596 * 00597 * PCB, interactive printed circuit board design 00598 * Copyright (C) 1994,1995,1996,2006 Thomas Nau 00599 * 00600 * This program is free software; you can redistribute it and/or modify 00601 * it under the terms of the GNU General Public License as published by 00602 * the Free Software Foundation; either version 2 of the License, or 00603 * (at your option) any later version. 00604 * 00605 * This program is distributed in the hope that it will be useful, 00606 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00607 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00608 * GNU General Public License for more details. 00609 * 00610 * You should have received a copy of the GNU General Public License along 00611 * with this program; if not, write to the Free Software Foundation, Inc., 00612 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00613 * 00614 * Contact addresses for paper mail and Email: 00615 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany 00616 * Thomas.Nau@rz.uni-ulm.de 00617 * 00618 */ 00619 00620 /* lexical definitions to parse ASCII input of PCB and Element description 00621 */ 00622 00623 #ifdef HAVE_CONFIG_H 00624 #include "config.h" 00625 #endif 00626 00627 #include <stdio.h> 00628 #include <stdlib.h> 00629 #include <ctype.h> 00630 00631 #if defined(_POSIX_SOURCE) || defined(_HPUX_SOURCE) 00632 #include <unistd.h> 00633 #endif 00634 00635 #include "global.h" 00636 00637 #ifdef HAVE_LIBDMALLOC 00638 # include <dmalloc.h> /* see http://dmalloc.com */ 00639 #endif 00640 00641 #include "global.h" 00642 #include "crosshair.h" 00643 #include "data.h" 00644 #include "error.h" 00645 #include "file.h" 00646 #include "mymem.h" 00647 #include "misc.h" 00648 #include "strflags.h" 00649 #include "parse_l.h" 00650 #include "parse_y.h" 00651 #include "create.h" 00652 00653 #define YY_NO_INPUT 00654 00655 /* --------------------------------------------------------------------------- 00656 * some shared parser identifiers 00657 */ 00658 #ifdef FLEX_SCANNER 00659 00660 #define yyunput ATTRIBUTE_UNUSED yyunput 00661 #endif 00662 00663 char *yyfilename; /* in this file */ 00664 PCBType *yyPCB; /* used by parser */ 00665 DataType *yyData; 00666 ElementType *yyElement; 00667 FontType *yyFont; 00668 00669 static int parse_number (void); 00670 00671 /* --------------------------------------------------------------------------- 00672 * an external prototypes 00673 */ 00674 int yyparse(void); 00675 00676 /* --------------------------------------------------------------------------- 00677 * some local prototypes 00678 */ 00679 static int Parse(char *, char *, char *, char *); 00680 00681 #line 682 "parse_l.c" 00682 00683 #define INITIAL 0 00684 00685 #ifndef YY_NO_UNISTD_H 00686 /* Special case for "unistd.h", since it is non-ANSI. We include it way 00687 * down here because we want the user's section 1 to have been scanned first. 00688 * The user has a chance to override it with an option. 00689 */ 00690 #include <unistd.h> 00691 #endif 00692 00693 #ifndef YY_EXTRA_TYPE 00694 #define YY_EXTRA_TYPE void * 00695 #endif 00696 00697 static int yy_init_globals (void ); 00698 00699 /* Accessor methods to globals. 00700 These are made visible to non-reentrant scanners for convenience. */ 00701 00702 int yylex_destroy (void ); 00703 00704 int yyget_debug (void ); 00705 00706 void yyset_debug (int debug_flag ); 00707 00708 YY_EXTRA_TYPE yyget_extra (void ); 00709 00710 void yyset_extra (YY_EXTRA_TYPE user_defined ); 00711 00712 FILE *yyget_in (void ); 00713 00714 void yyset_in (FILE * in_str ); 00715 00716 FILE *yyget_out (void ); 00717 00718 void yyset_out (FILE * out_str ); 00719 00720 int yyget_leng (void ); 00721 00722 char *yyget_text (void ); 00723 00724 int yyget_lineno (void ); 00725 00726 void yyset_lineno (int line_number ); 00727 00728 /* Macros after this point can all be overridden by user definitions in 00729 * section 1. 00730 */ 00731 00732 #ifndef YY_SKIP_YYWRAP 00733 #ifdef __cplusplus 00734 extern "C" int yywrap (void ); 00735 #else 00736 extern int yywrap (void ); 00737 #endif 00738 #endif 00739 00740 static void yyunput (int c,char *buf_ptr ); 00741 00742 #ifndef yytext_ptr 00743 static void yy_flex_strncpy (char *,yyconst char *,int ); 00744 #endif 00745 00746 #ifdef YY_NEED_STRLEN 00747 static int yy_flex_strlen (yyconst char * ); 00748 #endif 00749 00750 #ifndef YY_NO_INPUT 00751 00752 #ifdef __cplusplus 00753 static int yyinput (void ); 00754 #else 00755 static int input (void ); 00756 #endif 00757 00758 #endif 00759 00760 /* Amount of stuff to slurp up with each read. */ 00761 #ifndef YY_READ_BUF_SIZE 00762 #define YY_READ_BUF_SIZE 8192 00763 #endif 00764 00765 /* Copy whatever the last rule matched to the standard output. */ 00766 #ifndef ECHO 00767 /* This used to be an fputs(), but since the string might contain NUL's, 00768 * we now use fwrite(). 00769 */ 00770 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 00771 #endif 00772 00773 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 00774 * is returned in "result". 00775 */ 00776 #ifndef YY_INPUT 00777 #define YY_INPUT(buf,result,max_size) \ 00778 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 00779 { \ 00780 int c = '*'; \ 00781 unsigned n; \ 00782 for ( n = 0; n < max_size && \ 00783 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 00784 buf[n] = (char) c; \ 00785 if ( c == '\n' ) \ 00786 buf[n++] = (char) c; \ 00787 if ( c == EOF && ferror( yyin ) ) \ 00788 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 00789 result = n; \ 00790 } \ 00791 else \ 00792 { \ 00793 errno=0; \ 00794 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 00795 { \ 00796 if( errno != EINTR) \ 00797 { \ 00798 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 00799 break; \ 00800 } \ 00801 errno=0; \ 00802 clearerr(yyin); \ 00803 } \ 00804 }\ 00805 \ 00806 00807 #endif 00808 00809 /* No semi-colon after return; correct usage is to write "yyterminate();" - 00810 * we don't want an extra ';' after the "return" because that will cause 00811 * some compilers to complain about unreachable statements. 00812 */ 00813 #ifndef yyterminate 00814 #define yyterminate() return YY_NULL 00815 #endif 00816 00817 /* Number of entries by which start-condition stack grows. */ 00818 #ifndef YY_START_STACK_INCR 00819 #define YY_START_STACK_INCR 25 00820 #endif 00821 00822 /* Report a fatal error. */ 00823 #ifndef YY_FATAL_ERROR 00824 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 00825 #endif 00826 00827 /* end tables serialization structures and prototypes */ 00828 00829 /* Default declaration of generated scanner - a define so the user can 00830 * easily add parameters. 00831 */ 00832 #ifndef YY_DECL 00833 #define YY_DECL_IS_OURS 1 00834 00835 extern int yylex (void); 00836 00837 #define YY_DECL int yylex (void) 00838 #endif /* !YY_DECL */ 00839 00840 /* Code executed at the beginning of each rule, after yytext and yyleng 00841 * have been set up. 00842 */ 00843 #ifndef YY_USER_ACTION 00844 #define YY_USER_ACTION 00845 #endif 00846 00847 /* Code executed at the end of each rule. */ 00848 #ifndef YY_BREAK 00849 #define YY_BREAK break; 00850 #endif 00851 00852 #define YY_RULE_SETUP \ 00853 YY_USER_ACTION 00854 00857 YY_DECL 00858 { 00859 register yy_state_type yy_current_state; 00860 register char *yy_cp, *yy_bp; 00861 register int yy_act; 00862 00863 #line 98 "parse_l.l" 00864 00865 00866 #line 867 "parse_l.c" 00867 00868 if ( !(yy_init) ) 00869 { 00870 (yy_init) = 1; 00871 00872 #ifdef YY_USER_INIT 00873 YY_USER_INIT; 00874 #endif 00875 00876 if ( ! (yy_start) ) 00877 (yy_start) = 1; /* first start state */ 00878 00879 if ( ! yyin ) 00880 yyin = stdin; 00881 00882 if ( ! yyout ) 00883 yyout = stdout; 00884 00885 if ( ! YY_CURRENT_BUFFER ) { 00886 yyensure_buffer_stack (); 00887 YY_CURRENT_BUFFER_LVALUE = 00888 yy_create_buffer(yyin,YY_BUF_SIZE ); 00889 } 00890 00891 yy_load_buffer_state( ); 00892 } 00893 00894 while ( 1 ) /* loops until end-of-file is reached */ 00895 { 00896 yy_cp = (yy_c_buf_p); 00897 00898 /* Support of yytext. */ 00899 *yy_cp = (yy_hold_char); 00900 00901 /* yy_bp points to the position in yy_ch_buf of the start of 00902 * the current run. 00903 */ 00904 yy_bp = yy_cp; 00905 00906 yy_current_state = (yy_start); 00907 yy_match: 00908 do 00909 { 00910 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 00911 if ( yy_accept[yy_current_state] ) 00912 { 00913 (yy_last_accepting_state) = yy_current_state; 00914 (yy_last_accepting_cpos) = yy_cp; 00915 } 00916 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 00917 { 00918 yy_current_state = (int) yy_def[yy_current_state]; 00919 if ( yy_current_state >= 192 ) 00920 yy_c = yy_meta[(unsigned int) yy_c]; 00921 } 00922 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 00923 ++yy_cp; 00924 } 00925 while ( yy_base[yy_current_state] != 228 ); 00926 00927 yy_find_action: 00928 yy_act = yy_accept[yy_current_state]; 00929 if ( yy_act == 0 ) 00930 { /* have to back up */ 00931 yy_cp = (yy_last_accepting_cpos); 00932 yy_current_state = (yy_last_accepting_state); 00933 yy_act = yy_accept[yy_current_state]; 00934 } 00935 00936 YY_DO_BEFORE_ACTION; 00937 00938 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 00939 { 00940 int yyl; 00941 for ( yyl = 0; yyl < yyleng; ++yyl ) 00942 if ( yytext[yyl] == '\n' ) 00943 00944 yylineno++; 00945 ; 00946 } 00947 00948 do_action: /* This label is used only to access EOF actions. */ 00949 00950 switch ( yy_act ) 00951 { /* beginning of action switch */ 00952 case 0: /* must back up */ 00953 /* undo the effects of YY_DO_BEFORE_ACTION */ 00954 *yy_cp = (yy_hold_char); 00955 yy_cp = (yy_last_accepting_cpos); 00956 yy_current_state = (yy_last_accepting_state); 00957 goto yy_find_action; 00958 00959 case 1: 00960 YY_RULE_SETUP 00961 #line 100 "parse_l.l" 00962 { return(T_FILEVERSION); } 00963 YY_BREAK 00964 case 2: 00965 YY_RULE_SETUP 00966 #line 101 "parse_l.l" 00967 { return(T_PCB); } 00968 YY_BREAK 00969 case 3: 00970 YY_RULE_SETUP 00971 #line 102 "parse_l.l" 00972 { return(T_GRID); } 00973 YY_BREAK 00974 case 4: 00975 YY_RULE_SETUP 00976 #line 103 "parse_l.l" 00977 { return(T_CURSOR); } 00978 YY_BREAK 00979 case 5: 00980 YY_RULE_SETUP 00981 #line 104 "parse_l.l" 00982 { return(T_THERMAL); } 00983 YY_BREAK 00984 case 6: 00985 YY_RULE_SETUP 00986 #line 105 "parse_l.l" 00987 { return(T_AREA); } 00988 YY_BREAK 00989 case 7: 00990 YY_RULE_SETUP 00991 #line 106 "parse_l.l" 00992 { return(T_DRC); } 00993 YY_BREAK 00994 case 8: 00995 YY_RULE_SETUP 00996 #line 107 "parse_l.l" 00997 { return(T_FLAGS); } 00998 YY_BREAK 00999 case 9: 01000 YY_RULE_SETUP 01001 #line 108 "parse_l.l" 01002 { return(T_LAYER); } 01003 YY_BREAK 01004 case 10: 01005 YY_RULE_SETUP 01006 #line 109 "parse_l.l" 01007 { return(T_PIN); } 01008 YY_BREAK 01009 case 11: 01010 YY_RULE_SETUP 01011 #line 110 "parse_l.l" 01012 { return(T_PAD); } 01013 YY_BREAK 01014 case 12: 01015 YY_RULE_SETUP 01016 #line 111 "parse_l.l" 01017 { return(T_VIA); } 01018 YY_BREAK 01019 case 13: 01020 YY_RULE_SETUP 01021 #line 112 "parse_l.l" 01022 { return(T_LINE); } 01023 YY_BREAK 01024 case 14: 01025 YY_RULE_SETUP 01026 #line 113 "parse_l.l" 01027 { return(T_RAT); } 01028 YY_BREAK 01029 case 15: 01030 YY_RULE_SETUP 01031 #line 114 "parse_l.l" 01032 { return(T_RECTANGLE); } 01033 YY_BREAK 01034 case 16: 01035 YY_RULE_SETUP 01036 #line 115 "parse_l.l" 01037 { return(T_TEXT); } 01038 YY_BREAK 01039 case 17: 01040 YY_RULE_SETUP 01041 #line 116 "parse_l.l" 01042 { return(T_ELEMENTLINE); } 01043 YY_BREAK 01044 case 18: 01045 YY_RULE_SETUP 01046 #line 117 "parse_l.l" 01047 { return(T_ELEMENTARC); } 01048 YY_BREAK 01049 case 19: 01050 YY_RULE_SETUP 01051 #line 118 "parse_l.l" 01052 { return(T_ELEMENT); } 01053 YY_BREAK 01054 case 20: 01055 YY_RULE_SETUP 01056 #line 119 "parse_l.l" 01057 { return(T_SYMBOLLINE); } 01058 YY_BREAK 01059 case 21: 01060 YY_RULE_SETUP 01061 #line 120 "parse_l.l" 01062 { return(T_SYMBOL); } 01063 YY_BREAK 01064 case 22: 01065 YY_RULE_SETUP 01066 #line 121 "parse_l.l" 01067 { return(T_MARK); } 01068 YY_BREAK 01069 case 23: 01070 YY_RULE_SETUP 01071 #line 122 "parse_l.l" 01072 { return(T_GROUPS); } 01073 YY_BREAK 01074 case 24: 01075 YY_RULE_SETUP 01076 #line 123 "parse_l.l" 01077 { return(T_STYLES); } 01078 YY_BREAK 01079 case 25: 01080 YY_RULE_SETUP 01081 #line 124 "parse_l.l" 01082 { return(T_POLYGON); } 01083 YY_BREAK 01084 case 26: 01085 YY_RULE_SETUP 01086 #line 125 "parse_l.l" 01087 { return(T_POLYGON_HOLE); } 01088 YY_BREAK 01089 case 27: 01090 YY_RULE_SETUP 01091 #line 126 "parse_l.l" 01092 { return(T_ARC); } 01093 YY_BREAK 01094 case 28: 01095 YY_RULE_SETUP 01096 #line 127 "parse_l.l" 01097 { return(T_NETLIST); } 01098 YY_BREAK 01099 case 29: 01100 YY_RULE_SETUP 01101 #line 128 "parse_l.l" 01102 { return(T_NET); } 01103 YY_BREAK 01104 case 30: 01105 YY_RULE_SETUP 01106 #line 129 "parse_l.l" 01107 { return(T_CONN); } 01108 YY_BREAK 01109 case 31: 01110 YY_RULE_SETUP 01111 #line 130 "parse_l.l" 01112 { return(T_ATTRIBUTE); } 01113 YY_BREAK 01114 case 32: 01115 YY_RULE_SETUP 01116 #line 132 "parse_l.l" 01117 { return T_NM; } 01118 YY_BREAK 01119 case 33: 01120 YY_RULE_SETUP 01121 #line 133 "parse_l.l" 01122 { return T_UM; } 01123 YY_BREAK 01124 case 34: 01125 YY_RULE_SETUP 01126 #line 134 "parse_l.l" 01127 { return T_MM; } 01128 YY_BREAK 01129 case 35: 01130 YY_RULE_SETUP 01131 #line 135 "parse_l.l" 01132 { return T_M; } 01133 YY_BREAK 01134 case 36: 01135 YY_RULE_SETUP 01136 #line 136 "parse_l.l" 01137 { return T_KM; } 01138 YY_BREAK 01139 case 37: 01140 YY_RULE_SETUP 01141 #line 137 "parse_l.l" 01142 { return T_UMIL; } 01143 YY_BREAK 01144 case 38: 01145 YY_RULE_SETUP 01146 #line 138 "parse_l.l" 01147 { return T_CMIL; } 01148 YY_BREAK 01149 case 39: 01150 YY_RULE_SETUP 01151 #line 139 "parse_l.l" 01152 { return T_MIL; } 01153 YY_BREAK 01154 case 40: 01155 YY_RULE_SETUP 01156 #line 140 "parse_l.l" 01157 { return T_IN; } 01158 YY_BREAK 01159 case 41: 01160 YY_RULE_SETUP 01161 #line 141 "parse_l.l" 01162 { return T_PX; } 01163 YY_BREAK 01164 case 42: 01165 YY_RULE_SETUP 01166 #line 143 "parse_l.l" 01167 { 01168 yylval.integer = (unsigned) *(yytext+1); 01169 return(CHAR_CONST); 01170 } 01171 YY_BREAK 01172 case 43: 01173 YY_RULE_SETUP 01174 #line 147 "parse_l.l" 01175 { return parse_number(); } 01176 YY_BREAK 01177 case 44: 01178 YY_RULE_SETUP 01179 #line 148 "parse_l.l" 01180 { yylval.integer = round (g_ascii_strtod (yytext, NULL)); return INTEGER; } 01181 YY_BREAK 01182 case 45: 01183 YY_RULE_SETUP 01184 #line 150 "parse_l.l" 01185 { unsigned n; 01186 sscanf((char *) yytext, "%x", &n); 01187 yylval.integer = n; 01188 return INTEGER; 01189 } 01190 YY_BREAK 01191 case 46: 01192 YY_RULE_SETUP 01193 #line 155 "parse_l.l" 01194 { 01195 char *p1, *p2; 01196 01197 /* return NULL on empty string */ 01198 if (yyleng == 2) 01199 { 01200 yylval.string = NULL; 01201 return(STRING); 01202 } 01203 01204 /* allocate memory and copy string; 01205 * stringlength is counted and copied without 01206 * leading and trailing '"' 01207 */ 01208 yyleng -= 2; 01209 yylval.string = (char *)calloc (yyleng+1, sizeof (char)); 01210 p1 = (char *) (yytext +1); 01211 p2 = yylval.string; 01212 while(yyleng--) 01213 { 01214 /* check for special character */ 01215 if (*p1 == '\\') 01216 { 01217 yyleng--; 01218 p1++; 01219 01220 } 01221 *p2++ = *p1++; 01222 } 01223 *p2 = '\0'; 01224 return(STRING); 01225 } 01226 YY_BREAK 01227 case 47: 01228 YY_RULE_SETUP 01229 #line 187 "parse_l.l" 01230 {} 01231 YY_BREAK 01232 case 48: 01233 YY_RULE_SETUP 01234 #line 188 "parse_l.l" 01235 {} 01236 YY_BREAK 01237 case 49: 01238 /* rule 49 can match eol */ 01239 YY_RULE_SETUP 01240 #line 189 "parse_l.l" 01241 { 01242 #ifndef FLEX_SCANNER 01243 yylineno++; 01244 #endif 01245 } 01246 YY_BREAK 01247 case 50: 01248 YY_RULE_SETUP 01249 #line 194 "parse_l.l" 01250 {} 01251 YY_BREAK 01252 case 51: 01253 YY_RULE_SETUP 01254 #line 195 "parse_l.l" 01255 { return(*yytext); } 01256 YY_BREAK 01257 case 52: 01258 YY_RULE_SETUP 01259 #line 197 "parse_l.l" 01260 ECHO; 01261 YY_BREAK 01262 #line 1263 "parse_l.c" 01263 case YY_STATE_EOF(INITIAL): 01264 yyterminate(); 01265 01266 case YY_END_OF_BUFFER: 01267 { 01268 /* Amount of text matched not including the EOB char. */ 01269 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 01270 01271 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 01272 *yy_cp = (yy_hold_char); 01273 YY_RESTORE_YY_MORE_OFFSET 01274 01275 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 01276 { 01277 /* We're scanning a new file or input source. It's 01278 * possible that this happened because the user 01279 * just pointed yyin at a new source and called 01280 * yylex(). If so, then we have to assure 01281 * consistency between YY_CURRENT_BUFFER and our 01282 * globals. Here is the right place to do so, because 01283 * this is the first action (other than possibly a 01284 * back-up) that will match for the new input source. 01285 */ 01286 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 01287 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 01288 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 01289 } 01290 01291 /* Note that here we test for yy_c_buf_p "<=" to the position 01292 * of the first EOB in the buffer, since yy_c_buf_p will 01293 * already have been incremented past the NUL character 01294 * (since all states make transitions on EOB to the 01295 * end-of-buffer state). Contrast this with the test 01296 * in input(). 01297 */ 01298 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 01299 { /* This was really a NUL. */ 01300 yy_state_type yy_next_state; 01301 01302 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 01303 01304 yy_current_state = yy_get_previous_state( ); 01305 01306 /* Okay, we're now positioned to make the NUL 01307 * transition. We couldn't have 01308 * yy_get_previous_state() go ahead and do it 01309 * for us because it doesn't know how to deal 01310 * with the possibility of jamming (and we don't 01311 * want to build jamming into it because then it 01312 * will run more slowly). 01313 */ 01314 01315 yy_next_state = yy_try_NUL_trans( yy_current_state ); 01316 01317 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 01318 01319 if ( yy_next_state ) 01320 { 01321 /* Consume the NUL. */ 01322 yy_cp = ++(yy_c_buf_p); 01323 yy_current_state = yy_next_state; 01324 goto yy_match; 01325 } 01326 01327 else 01328 { 01329 yy_cp = (yy_c_buf_p); 01330 goto yy_find_action; 01331 } 01332 } 01333 01334 else switch ( yy_get_next_buffer( ) ) 01335 { 01336 case EOB_ACT_END_OF_FILE: 01337 { 01338 (yy_did_buffer_switch_on_eof) = 0; 01339 01340 if ( yywrap( ) ) 01341 { 01342 /* Note: because we've taken care in 01343 * yy_get_next_buffer() to have set up 01344 * yytext, we can now set up 01345 * yy_c_buf_p so that if some total 01346 * hoser (like flex itself) wants to 01347 * call the scanner after we return the 01348 * YY_NULL, it'll still work - another 01349 * YY_NULL will get returned. 01350 */ 01351 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 01352 01353 yy_act = YY_STATE_EOF(YY_START); 01354 goto do_action; 01355 } 01356 01357 else 01358 { 01359 if ( ! (yy_did_buffer_switch_on_eof) ) 01360 YY_NEW_FILE; 01361 } 01362 break; 01363 } 01364 01365 case EOB_ACT_CONTINUE_SCAN: 01366 (yy_c_buf_p) = 01367 (yytext_ptr) + yy_amount_of_matched_text; 01368 01369 yy_current_state = yy_get_previous_state( ); 01370 01371 yy_cp = (yy_c_buf_p); 01372 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 01373 goto yy_match; 01374 01375 case EOB_ACT_LAST_MATCH: 01376 (yy_c_buf_p) = 01377 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 01378 01379 yy_current_state = yy_get_previous_state( ); 01380 01381 yy_cp = (yy_c_buf_p); 01382 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 01383 goto yy_find_action; 01384 } 01385 break; 01386 } 01387 01388 default: 01389 YY_FATAL_ERROR( 01390 "fatal flex scanner internal error--no action found" ); 01391 } /* end of action switch */ 01392 } /* end of scanning one token */ 01393 } /* end of yylex */ 01394 01395 /* yy_get_next_buffer - try to read in a new buffer 01396 * 01397 * Returns a code representing an action: 01398 * EOB_ACT_LAST_MATCH - 01399 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 01400 * EOB_ACT_END_OF_FILE - end of file 01401 */ 01402 static int yy_get_next_buffer (void) 01403 { 01404 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 01405 register char *source = (yytext_ptr); 01406 register int number_to_move, i; 01407 int ret_val; 01408 01409 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 01410 YY_FATAL_ERROR( 01411 "fatal flex scanner internal error--end of buffer missed" ); 01412 01413 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 01414 { /* Don't try to fill the buffer, so this is an EOF. */ 01415 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 01416 { 01417 /* We matched a single character, the EOB, so 01418 * treat this as a final EOF. 01419 */ 01420 return EOB_ACT_END_OF_FILE; 01421 } 01422 01423 else 01424 { 01425 /* We matched some text prior to the EOB, first 01426 * process it. 01427 */ 01428 return EOB_ACT_LAST_MATCH; 01429 } 01430 } 01431 01432 /* Try to read more data. */ 01433 01434 /* First move last chars to start of buffer. */ 01435 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 01436 01437 for ( i = 0; i < number_to_move; ++i ) 01438 *(dest++) = *(source++); 01439 01440 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 01441 /* don't do the read, it's not guaranteed to return an EOF, 01442 * just force an EOF 01443 */ 01444 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 01445 01446 else 01447 { 01448 int num_to_read = 01449 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 01450 01451 while ( num_to_read <= 0 ) 01452 { /* Not enough room in the buffer - grow it. */ 01453 01454 /* just a shorter name for the current buffer */ 01455 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 01456 01457 int yy_c_buf_p_offset = 01458 (int) ((yy_c_buf_p) - b->yy_ch_buf); 01459 01460 if ( b->yy_is_our_buffer ) 01461 { 01462 int new_size = b->yy_buf_size * 2; 01463 01464 if ( new_size <= 0 ) 01465 b->yy_buf_size += b->yy_buf_size / 8; 01466 else 01467 b->yy_buf_size *= 2; 01468 01469 b->yy_ch_buf = (char *) 01470 /* Include room in for 2 EOB chars. */ 01471 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 01472 } 01473 else 01474 /* Can't grow it, we don't own it. */ 01475 b->yy_ch_buf = 0; 01476 01477 if ( ! b->yy_ch_buf ) 01478 YY_FATAL_ERROR( 01479 "fatal error - scanner input buffer overflow" ); 01480 01481 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 01482 01483 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 01484 number_to_move - 1; 01485 01486 } 01487 01488 if ( num_to_read > YY_READ_BUF_SIZE ) 01489 num_to_read = YY_READ_BUF_SIZE; 01490 01491 /* Read in more data. */ 01492 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 01493 (yy_n_chars), (size_t) num_to_read ); 01494 01495 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01496 } 01497 01498 if ( (yy_n_chars) == 0 ) 01499 { 01500 if ( number_to_move == YY_MORE_ADJ ) 01501 { 01502 ret_val = EOB_ACT_END_OF_FILE; 01503 yyrestart(yyin ); 01504 } 01505 01506 else 01507 { 01508 ret_val = EOB_ACT_LAST_MATCH; 01509 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 01510 YY_BUFFER_EOF_PENDING; 01511 } 01512 } 01513 01514 else 01515 ret_val = EOB_ACT_CONTINUE_SCAN; 01516 01517 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 01518 /* Extend the array by 50%, plus the number we really need. */ 01519 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 01520 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 01521 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 01522 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 01523 } 01524 01525 (yy_n_chars) += number_to_move; 01526 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 01527 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 01528 01529 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 01530 01531 return ret_val; 01532 } 01533 01534 /* yy_get_previous_state - get the state just before the EOB char was reached */ 01535 01536 static yy_state_type yy_get_previous_state (void) 01537 { 01538 register yy_state_type yy_current_state; 01539 register char *yy_cp; 01540 01541 yy_current_state = (yy_start); 01542 01543 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 01544 { 01545 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 01546 if ( yy_accept[yy_current_state] ) 01547 { 01548 (yy_last_accepting_state) = yy_current_state; 01549 (yy_last_accepting_cpos) = yy_cp; 01550 } 01551 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01552 { 01553 yy_current_state = (int) yy_def[yy_current_state]; 01554 if ( yy_current_state >= 192 ) 01555 yy_c = yy_meta[(unsigned int) yy_c]; 01556 } 01557 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01558 } 01559 01560 return yy_current_state; 01561 } 01562 01563 /* yy_try_NUL_trans - try to make a transition on the NUL character 01564 * 01565 * synopsis 01566 * next_state = yy_try_NUL_trans( current_state ); 01567 */ 01568 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 01569 { 01570 register int yy_is_jam; 01571 register char *yy_cp = (yy_c_buf_p); 01572 01573 register YY_CHAR yy_c = 1; 01574 if ( yy_accept[yy_current_state] ) 01575 { 01576 (yy_last_accepting_state) = yy_current_state; 01577 (yy_last_accepting_cpos) = yy_cp; 01578 } 01579 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01580 { 01581 yy_current_state = (int) yy_def[yy_current_state]; 01582 if ( yy_current_state >= 192 ) 01583 yy_c = yy_meta[(unsigned int) yy_c]; 01584 } 01585 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01586 yy_is_jam = (yy_current_state == 191); 01587 01588 return yy_is_jam ? 0 : yy_current_state; 01589 } 01590 01591 static void yyunput (int c, register char * yy_bp ) 01592 { 01593 register char *yy_cp; 01594 01595 yy_cp = (yy_c_buf_p); 01596 01597 /* undo effects of setting up yytext */ 01598 *yy_cp = (yy_hold_char); 01599 01600 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 01601 { /* need to shift things up to make room */ 01602 /* +2 for EOB chars. */ 01603 register int number_to_move = (yy_n_chars) + 2; 01604 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 01605 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; 01606 register char *source = 01607 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; 01608 01609 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 01610 *--dest = *--source; 01611 01612 yy_cp += (int) (dest - source); 01613 yy_bp += (int) (dest - source); 01614 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = 01615 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; 01616 01617 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) 01618 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 01619 } 01620 01621 *--yy_cp = (char) c; 01622 01623 if ( c == '\n' ){ 01624 --yylineno; 01625 } 01626 01627 (yytext_ptr) = yy_bp; 01628 (yy_hold_char) = *yy_cp; 01629 (yy_c_buf_p) = yy_cp; 01630 } 01631 01632 #ifndef YY_NO_INPUT 01633 #ifdef __cplusplus 01634 static int yyinput (void) 01635 #else 01636 static int input (void) 01637 #endif 01638 01639 { 01640 int c; 01641 01642 *(yy_c_buf_p) = (yy_hold_char); 01643 01644 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 01645 { 01646 /* yy_c_buf_p now points to the character we want to return. 01647 * If this occurs *before* the EOB characters, then it's a 01648 * valid NUL; if not, then we've hit the end of the buffer. 01649 */ 01650 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 01651 /* This was really a NUL. */ 01652 *(yy_c_buf_p) = '\0'; 01653 01654 else 01655 { /* need more input */ 01656 int offset = (yy_c_buf_p) - (yytext_ptr); 01657 ++(yy_c_buf_p); 01658 01659 switch ( yy_get_next_buffer( ) ) 01660 { 01661 case EOB_ACT_LAST_MATCH: 01662 /* This happens because yy_g_n_b() 01663 * sees that we've accumulated a 01664 * token and flags that we need to 01665 * try matching the token before 01666 * proceeding. But for input(), 01667 * there's no matching to consider. 01668 * So convert the EOB_ACT_LAST_MATCH 01669 * to EOB_ACT_END_OF_FILE. 01670 */ 01671 01672 /* Reset buffer status. */ 01673 yyrestart(yyin ); 01674 01675 /*FALLTHROUGH*/ 01676 01677 case EOB_ACT_END_OF_FILE: 01678 { 01679 if ( yywrap( ) ) 01680 return EOF; 01681 01682 if ( ! (yy_did_buffer_switch_on_eof) ) 01683 YY_NEW_FILE; 01684 #ifdef __cplusplus 01685 return yyinput(); 01686 #else 01687 return input(); 01688 #endif 01689 } 01690 01691 case EOB_ACT_CONTINUE_SCAN: 01692 (yy_c_buf_p) = (yytext_ptr) + offset; 01693 break; 01694 } 01695 } 01696 } 01697 01698 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 01699 *(yy_c_buf_p) = '\0'; /* preserve yytext */ 01700 (yy_hold_char) = *++(yy_c_buf_p); 01701 01702 if ( c == '\n' ) 01703 01704 yylineno++; 01705 ; 01706 01707 return c; 01708 } 01709 #endif /* ifndef YY_NO_INPUT */ 01710 01716 void yyrestart (FILE * input_file ) 01717 { 01718 01719 if ( ! YY_CURRENT_BUFFER ){ 01720 yyensure_buffer_stack (); 01721 YY_CURRENT_BUFFER_LVALUE = 01722 yy_create_buffer(yyin,YY_BUF_SIZE ); 01723 } 01724 01725 yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 01726 yy_load_buffer_state( ); 01727 } 01728 01733 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 01734 { 01735 01736 /* TODO. We should be able to replace this entire function body 01737 * with 01738 * yypop_buffer_state(); 01739 * yypush_buffer_state(new_buffer); 01740 */ 01741 yyensure_buffer_stack (); 01742 if ( YY_CURRENT_BUFFER == new_buffer ) 01743 return; 01744 01745 if ( YY_CURRENT_BUFFER ) 01746 { 01747 /* Flush out information for old buffer. */ 01748 *(yy_c_buf_p) = (yy_hold_char); 01749 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 01750 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01751 } 01752 01753 YY_CURRENT_BUFFER_LVALUE = new_buffer; 01754 yy_load_buffer_state( ); 01755 01756 /* We don't actually know whether we did this switch during 01757 * EOF (yywrap()) processing, but the only time this flag 01758 * is looked at is after yywrap() is called, so it's safe 01759 * to go ahead and always set it. 01760 */ 01761 (yy_did_buffer_switch_on_eof) = 1; 01762 } 01763 01764 static void yy_load_buffer_state (void) 01765 { 01766 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 01767 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 01768 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 01769 (yy_hold_char) = *(yy_c_buf_p); 01770 } 01771 01778 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 01779 { 01780 YY_BUFFER_STATE b; 01781 01782 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 01783 if ( ! b ) 01784 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01785 01786 b->yy_buf_size = size; 01787 01788 /* yy_ch_buf has to be 2 characters longer than the size given because 01789 * we need to put in 2 end-of-buffer characters. 01790 */ 01791 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 01792 if ( ! b->yy_ch_buf ) 01793 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01794 01795 b->yy_is_our_buffer = 1; 01796 01797 yy_init_buffer(b,file ); 01798 01799 return b; 01800 } 01801 01806 void yy_delete_buffer (YY_BUFFER_STATE b ) 01807 { 01808 01809 if ( ! b ) 01810 return; 01811 01812 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 01813 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 01814 01815 if ( b->yy_is_our_buffer ) 01816 yyfree((void *) b->yy_ch_buf ); 01817 01818 yyfree((void *) b ); 01819 } 01820 01821 #ifndef __cplusplus 01822 extern int isatty (int ); 01823 #endif /* __cplusplus */ 01824 01825 /* Initializes or reinitializes a buffer. 01826 * This function is sometimes called more than once on the same buffer, 01827 * such as during a yyrestart() or at EOF. 01828 */ 01829 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 01830 01831 { 01832 int oerrno = errno; 01833 01834 yy_flush_buffer(b ); 01835 01836 b->yy_input_file = file; 01837 b->yy_fill_buffer = 1; 01838 01839 /* If b is the current buffer, then yy_init_buffer was _probably_ 01840 * called from yyrestart() or through yy_get_next_buffer. 01841 * In that case, we don't want to reset the lineno or column. 01842 */ 01843 if (b != YY_CURRENT_BUFFER){ 01844 b->yy_bs_lineno = 1; 01845 b->yy_bs_column = 0; 01846 } 01847 01848 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 01849 01850 errno = oerrno; 01851 } 01852 01857 void yy_flush_buffer (YY_BUFFER_STATE b ) 01858 { 01859 if ( ! b ) 01860 return; 01861 01862 b->yy_n_chars = 0; 01863 01864 /* We always need two end-of-buffer characters. The first causes 01865 * a transition to the end-of-buffer state. The second causes 01866 * a jam in that state. 01867 */ 01868 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 01869 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 01870 01871 b->yy_buf_pos = &b->yy_ch_buf[0]; 01872 01873 b->yy_at_bol = 1; 01874 b->yy_buffer_status = YY_BUFFER_NEW; 01875 01876 if ( b == YY_CURRENT_BUFFER ) 01877 yy_load_buffer_state( ); 01878 } 01879 01886 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 01887 { 01888 if (new_buffer == NULL) 01889 return; 01890 01891 yyensure_buffer_stack(); 01892 01893 /* This block is copied from yy_switch_to_buffer. */ 01894 if ( YY_CURRENT_BUFFER ) 01895 { 01896 /* Flush out information for old buffer. */ 01897 *(yy_c_buf_p) = (yy_hold_char); 01898 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 01899 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01900 } 01901 01902 /* Only push if top exists. Otherwise, replace top. */ 01903 if (YY_CURRENT_BUFFER) 01904 (yy_buffer_stack_top)++; 01905 YY_CURRENT_BUFFER_LVALUE = new_buffer; 01906 01907 /* copied from yy_switch_to_buffer. */ 01908 yy_load_buffer_state( ); 01909 (yy_did_buffer_switch_on_eof) = 1; 01910 } 01911 01916 void yypop_buffer_state (void) 01917 { 01918 if (!YY_CURRENT_BUFFER) 01919 return; 01920 01921 yy_delete_buffer(YY_CURRENT_BUFFER ); 01922 YY_CURRENT_BUFFER_LVALUE = NULL; 01923 if ((yy_buffer_stack_top) > 0) 01924 --(yy_buffer_stack_top); 01925 01926 if (YY_CURRENT_BUFFER) { 01927 yy_load_buffer_state( ); 01928 (yy_did_buffer_switch_on_eof) = 1; 01929 } 01930 } 01931 01932 /* Allocates the stack if it does not exist. 01933 * Guarantees space for at least one push. 01934 */ 01935 static void yyensure_buffer_stack (void) 01936 { 01937 int num_to_alloc; 01938 01939 if (!(yy_buffer_stack)) { 01940 01941 /* First allocation is just for 2 elements, since we don't know if this 01942 * scanner will even need a stack. We use 2 instead of 1 to avoid an 01943 * immediate realloc on the next call. 01944 */ 01945 num_to_alloc = 1; 01946 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 01947 (num_to_alloc * sizeof(struct yy_buffer_state*) 01948 ); 01949 if ( ! (yy_buffer_stack) ) 01950 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 01951 01952 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 01953 01954 (yy_buffer_stack_max) = num_to_alloc; 01955 (yy_buffer_stack_top) = 0; 01956 return; 01957 } 01958 01959 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 01960 01961 /* Increase the buffer to prepare for a possible push. */ 01962 int grow_size = 8 /* arbitrary grow size */; 01963 01964 num_to_alloc = (yy_buffer_stack_max) + grow_size; 01965 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 01966 ((yy_buffer_stack), 01967 num_to_alloc * sizeof(struct yy_buffer_state*) 01968 ); 01969 if ( ! (yy_buffer_stack) ) 01970 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 01971 01972 /* zero only the new slots.*/ 01973 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 01974 (yy_buffer_stack_max) = num_to_alloc; 01975 } 01976 } 01977 01984 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 01985 { 01986 YY_BUFFER_STATE b; 01987 01988 if ( size < 2 || 01989 base[size-2] != YY_END_OF_BUFFER_CHAR || 01990 base[size-1] != YY_END_OF_BUFFER_CHAR ) 01991 /* They forgot to leave room for the EOB's. */ 01992 return 0; 01993 01994 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 01995 if ( ! b ) 01996 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 01997 01998 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 01999 b->yy_buf_pos = b->yy_ch_buf = base; 02000 b->yy_is_our_buffer = 0; 02001 b->yy_input_file = 0; 02002 b->yy_n_chars = b->yy_buf_size; 02003 b->yy_is_interactive = 0; 02004 b->yy_at_bol = 1; 02005 b->yy_fill_buffer = 0; 02006 b->yy_buffer_status = YY_BUFFER_NEW; 02007 02008 yy_switch_to_buffer(b ); 02009 02010 return b; 02011 } 02012 02021 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) 02022 { 02023 02024 return yy_scan_bytes(yystr,strlen(yystr) ); 02025 } 02026 02034 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) 02035 { 02036 YY_BUFFER_STATE b; 02037 char *buf; 02038 yy_size_t n; 02039 int i; 02040 02041 /* Get memory for full buffer, including space for trailing EOB's. */ 02042 n = _yybytes_len + 2; 02043 buf = (char *) yyalloc(n ); 02044 if ( ! buf ) 02045 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 02046 02047 for ( i = 0; i < _yybytes_len; ++i ) 02048 buf[i] = yybytes[i]; 02049 02050 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 02051 02052 b = yy_scan_buffer(buf,n ); 02053 if ( ! b ) 02054 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 02055 02056 /* It's okay to grow etc. this buffer, and we should throw it 02057 * away when we're done. 02058 */ 02059 b->yy_is_our_buffer = 1; 02060 02061 return b; 02062 } 02063 02064 #ifndef YY_EXIT_FAILURE 02065 #define YY_EXIT_FAILURE 2 02066 #endif 02067 02068 static void yy_fatal_error (yyconst char* msg ) 02069 { 02070 (void) fprintf( stderr, "%s\n", msg ); 02071 exit( YY_EXIT_FAILURE ); 02072 } 02073 02074 /* Redefine yyless() so it works in section 3 code. */ 02075 02076 #undef yyless 02077 #define yyless(n) \ 02078 do \ 02079 { \ 02080 /* Undo effects of setting up yytext. */ \ 02081 int yyless_macro_arg = (n); \ 02082 YY_LESS_LINENO(yyless_macro_arg);\ 02083 yytext[yyleng] = (yy_hold_char); \ 02084 (yy_c_buf_p) = yytext + yyless_macro_arg; \ 02085 (yy_hold_char) = *(yy_c_buf_p); \ 02086 *(yy_c_buf_p) = '\0'; \ 02087 yyleng = yyless_macro_arg; \ 02088 } \ 02089 while ( 0 ) 02090 02091 /* Accessor methods (get/set functions) to struct members. */ 02092 02096 int yyget_lineno (void) 02097 { 02098 02099 return yylineno; 02100 } 02101 02105 FILE *yyget_in (void) 02106 { 02107 return yyin; 02108 } 02109 02113 FILE *yyget_out (void) 02114 { 02115 return yyout; 02116 } 02117 02121 int yyget_leng (void) 02122 { 02123 return yyleng; 02124 } 02125 02130 char *yyget_text (void) 02131 { 02132 return yytext; 02133 } 02134 02139 void yyset_lineno (int line_number ) 02140 { 02141 02142 yylineno = line_number; 02143 } 02144 02151 void yyset_in (FILE * in_str ) 02152 { 02153 yyin = in_str ; 02154 } 02155 02156 void yyset_out (FILE * out_str ) 02157 { 02158 yyout = out_str ; 02159 } 02160 02161 int yyget_debug (void) 02162 { 02163 return yy_flex_debug; 02164 } 02165 02166 void yyset_debug (int bdebug ) 02167 { 02168 yy_flex_debug = bdebug ; 02169 } 02170 02171 static int yy_init_globals (void) 02172 { 02173 /* Initialization is the same as for the non-reentrant scanner. 02174 * This function is called from yylex_destroy(), so don't allocate here. 02175 */ 02176 02177 /* We do not touch yylineno unless the option is enabled. */ 02178 yylineno = 1; 02179 02180 (yy_buffer_stack) = 0; 02181 (yy_buffer_stack_top) = 0; 02182 (yy_buffer_stack_max) = 0; 02183 (yy_c_buf_p) = (char *) 0; 02184 (yy_init) = 0; 02185 (yy_start) = 0; 02186 02187 /* Defined in main.c */ 02188 #ifdef YY_STDINIT 02189 yyin = stdin; 02190 yyout = stdout; 02191 #else 02192 yyin = (FILE *) 0; 02193 yyout = (FILE *) 0; 02194 #endif 02195 02196 /* For future reference: Set errno on error, since we are called by 02197 * yylex_init() 02198 */ 02199 return 0; 02200 } 02201 02202 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 02203 int yylex_destroy (void) 02204 { 02205 02206 /* Pop the buffer stack, destroying each element. */ 02207 while(YY_CURRENT_BUFFER){ 02208 yy_delete_buffer(YY_CURRENT_BUFFER ); 02209 YY_CURRENT_BUFFER_LVALUE = NULL; 02210 yypop_buffer_state(); 02211 } 02212 02213 /* Destroy the stack itself. */ 02214 yyfree((yy_buffer_stack) ); 02215 (yy_buffer_stack) = NULL; 02216 02217 /* Reset the globals. This is important in a non-reentrant scanner so the next time 02218 * yylex() is called, initialization will occur. */ 02219 yy_init_globals( ); 02220 02221 return 0; 02222 } 02223 02224 /* 02225 * Internal utility routines. 02226 */ 02227 02228 #ifndef yytext_ptr 02229 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 02230 { 02231 register int i; 02232 for ( i = 0; i < n; ++i ) 02233 s1[i] = s2[i]; 02234 } 02235 #endif 02236 02237 #ifdef YY_NEED_STRLEN 02238 static int yy_flex_strlen (yyconst char * s ) 02239 { 02240 register int n; 02241 for ( n = 0; s[n]; ++n ) 02242 ; 02243 02244 return n; 02245 } 02246 #endif 02247 02248 void *yyalloc (yy_size_t size ) 02249 { 02250 return (void *) malloc( size ); 02251 } 02252 02253 void *yyrealloc (void * ptr, yy_size_t size ) 02254 { 02255 /* The cast to (char *) in the following accommodates both 02256 * implementations that use char* generic pointers, and those 02257 * that use void* generic pointers. It works with the latter 02258 * because both ANSI C and C++ allow castless assignment from 02259 * any pointer type to void*, and deal with argument conversions 02260 * as though doing an assignment. 02261 */ 02262 return (void *) realloc( (char *) ptr, size ); 02263 } 02264 02265 void yyfree (void * ptr ) 02266 { 02267 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 02268 } 02269 02270 #define YYTABLES_NAME "yytables" 02271 02272 #line 197 "parse_l.l" 02273 02274 02275 02276 /* --------------------------------------------------------------------------- 02277 * sets up the preprocessor command 02278 */ 02279 static int Parse(char *Executable, char *Path, char *Filename, char *Parameter) 02280 { 02281 static char *command = NULL; 02282 int returncode; 02283 int used_popen = 0; 02284 char *tmps; 02285 size_t l; 02286 #ifdef FLEX_SCANNER 02287 static bool firsttime = true; 02288 #endif 02289 02290 if (EMPTY_STRING_P (Executable)) 02291 { 02292 l = 2; 02293 if ( Path != NULL ) 02294 l += strlen (Path); 02295 02296 l += strlen (Filename); 02297 02298 if ( (tmps = (char *) malloc ( l * sizeof (char))) == NULL) 02299 { 02300 fprintf (stderr, "Parse(): malloc failed\n"); 02301 exit (1); 02302 } 02303 02304 if ( Path != NULL && *Path != '\0') 02305 sprintf (tmps, "%s%s%s", Path, PCB_DIR_SEPARATOR_S, Filename); 02306 else 02307 sprintf (tmps, "%s", Filename); 02308 02309 yyin = fopen (tmps, "r"); 02310 if (!yyin) 02311 { 02312 /* Special case this one, we get it all the time... */ 02313 if (strcmp (tmps, "./default_font")) 02314 Message("Can't open %s for reading\n", tmps); 02315 return(1); 02316 } 02317 free (tmps); 02318 } 02319 else 02320 { 02321 used_popen = 1; 02322 /* release old command and create new from template */ 02323 free (command); 02324 command = EvaluateFilename(Executable, Path, Filename, Parameter); 02325 02326 /* open pipe to stdout of command */ 02327 if (*command == '\0' || (yyin = popen(command, "r")) == NULL) 02328 { 02329 PopenErrorMessage(command); 02330 return(1); 02331 } 02332 } 02333 02334 #ifdef FLEX_SCANNER 02335 /* reset parser if not called the first time */ 02336 if (!firsttime) 02337 yyrestart(yyin); 02338 firsttime = false; 02339 #endif 02340 02341 /* init linenumber and filename for yyerror() */ 02342 yylineno = 1; 02343 yyfilename = Filename; 02344 02345 /* We need to save the data temporarily because lex-yacc are able 02346 * to break the application if the input file has an illegal format. 02347 * It's not necessary if the system supports the call of functions 02348 * on termination. 02349 */ 02350 02351 CreateBeLenient (true); 02352 02353 #if !defined(HAS_ATEXIT) && !defined(HAS_ON_EXIT) 02354 if (PCB && PCB->Data) 02355 SaveTMPData(); 02356 returncode = yyparse(); 02357 RemoveTMPData(); 02358 #else 02359 returncode = yyparse(); 02360 #endif 02361 /* clean up parse buffer */ 02362 yy_delete_buffer(YY_CURRENT_BUFFER); 02363 02364 CreateBeLenient (false); 02365 02366 if (used_popen) 02367 return(pclose(yyin) ? 1 : returncode); 02368 return(fclose(yyin) ? 1 : returncode); 02369 } 02370 02371 /* --------------------------------------------------------------------------- 02372 * initializes LEX and calls parser for a single element file 02373 */ 02374 int 02375 ParseElementFile (DataType *Ptr, char *Filename) 02376 { 02377 yyPCB = NULL; 02378 yyData = Ptr; 02379 yyFont = &PCB->Font; 02380 yyElement = NULL; 02381 return(Parse(NULL,NULL,Filename,NULL)); 02382 } 02383 02384 /* --------------------------------------------------------------------------- 02385 * initializes LEX and calls parser for a single library entry 02386 */ 02387 int 02388 ParseLibraryEntry (DataType *Ptr, char *Template) 02389 { 02390 yyPCB = NULL; 02391 yyData = Ptr; 02392 yyFont = &PCB->Font; 02393 yyElement = NULL; 02394 return(Parse(Settings.LibraryCommand, Settings.LibraryPath, 02395 Settings.LibraryFilename, Template)); 02396 } 02397 02398 /* --------------------------------------------------------------------------- 02399 * initializes LEX and calls parser for a complete board 02400 */ 02401 int 02402 ParsePCB (PCBType *Ptr, char *Filename) 02403 { 02404 yyPCB = Ptr; 02405 yyData = NULL; 02406 yyFont = NULL; 02407 yyElement = NULL; 02408 return(Parse(Settings.FileCommand, Settings.FilePath, Filename, NULL)); 02409 } 02410 02411 /* --------------------------------------------------------------------------- 02412 * initializes LEX and calls parser for a font 02413 */ 02414 int 02415 ParseFont (FontType *Ptr, char *Filename) 02416 { 02417 int r = 0; 02418 char *path, *p; 02419 yyPCB = NULL; 02420 yyFont = Ptr; 02421 yyElement = NULL; 02422 02423 path = strdup (Settings.FontPath); 02424 02425 /* search through the font path for a font file */ 02426 for (p = strtok (path, PCB_PATH_DELIMETER); p && *p; 02427 p = strtok (NULL, PCB_PATH_DELIMETER)) 02428 { 02429 #ifdef DEBUG 02430 Message ("Looking for %s in %s\n", Filename, p); 02431 #endif 02432 r = Parse(Settings.FontCommand, p, Filename, NULL); 02433 if (r == 0) 02434 { 02435 #ifdef DEBUG 02436 Message ("Found %s in %s\n", Filename, p); 02437 #endif 02438 break; 02439 } 02440 } 02441 free (path); 02442 02443 return r; 02444 } 02445 02446 static int 02447 parse_number () 02448 { 02449 yylval.number = g_ascii_strtod ((gchar *) yytext, NULL); 02450 return FLOATING; 02451 } 02452 02453