| File: | src/usr.bin/fgen/obj/fgen.c |
| Warning: | line 2934, column 7 Value stored to 'c' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | #line 2 "fgen.c" |
| 2 | |
| 3 | #line 4 "fgen.c" |
| 4 | |
| 5 | #define YY_INT_ALIGNEDshort int short int |
| 6 | |
| 7 | /* $OpenBSD: flex.skl,v 1.18 2021/11/30 15:50:06 millert Exp $ */ |
| 8 | |
| 9 | /* A lexical scanner generated by flex */ |
| 10 | |
| 11 | #define FLEX_SCANNER |
| 12 | #define YY_FLEX_MAJOR_VERSION2 2 |
| 13 | #define YY_FLEX_MINOR_VERSION5 5 |
| 14 | #define YY_FLEX_SUBMINOR_VERSION39 39 |
| 15 | #if YY_FLEX_SUBMINOR_VERSION39 > 0 |
| 16 | #define FLEX_BETA |
| 17 | #endif |
| 18 | |
| 19 | /* First, we deal with platform-specific or compiler-specific issues. */ |
| 20 | |
| 21 | /* begin standard C headers. */ |
| 22 | #include <stdio.h> |
| 23 | #include <string.h> |
| 24 | #include <errno(*__errno()).h> |
| 25 | #include <stdlib.h> |
| 26 | |
| 27 | /* end standard C headers. */ |
| 28 | |
| 29 | /* $OpenBSD: flexint.h,v 1.1 2015/11/19 19:43:40 tedu Exp $ */ |
| 30 | |
| 31 | /* flex integer type definitions */ |
| 32 | |
| 33 | #ifndef FLEXINT_H |
| 34 | #define FLEXINT_H |
| 35 | |
| 36 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
| 37 | |
| 38 | #if defined (__STDC_VERSION__201710L) && __STDC_VERSION__201710L >= 199901L |
| 39 | |
| 40 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
| 41 | * if you want the limit (max/min) macros for int types. |
| 42 | */ |
| 43 | #ifndef __STDC_LIMIT_MACROS1 |
| 44 | #define __STDC_LIMIT_MACROS1 1 |
| 45 | #endif |
| 46 | |
| 47 | #include <inttypes.h> |
| 48 | typedef int8_t flex_int8_t; |
| 49 | typedef uint8_t flex_uint8_t; |
| 50 | typedef int16_t flex_int16_t; |
| 51 | typedef uint16_t flex_uint16_t; |
| 52 | typedef int32_t flex_int32_t; |
| 53 | typedef uint32_t flex_uint32_t; |
| 54 | #else |
| 55 | typedef signed char flex_int8_t; |
| 56 | typedef short int flex_int16_t; |
| 57 | typedef int flex_int32_t; |
| 58 | typedef unsigned char flex_uint8_t; |
| 59 | typedef unsigned short int flex_uint16_t; |
| 60 | typedef unsigned int flex_uint32_t; |
| 61 | |
| 62 | /* Limits of integral types. */ |
| 63 | #ifndef INT8_MIN(-0x7f - 1) |
| 64 | #define INT8_MIN(-0x7f - 1) (-128) |
| 65 | #endif |
| 66 | #ifndef INT16_MIN(-0x7fff - 1) |
| 67 | #define INT16_MIN(-0x7fff - 1) (-32767-1) |
| 68 | #endif |
| 69 | #ifndef INT32_MIN(-0x7fffffff - 1) |
| 70 | #define INT32_MIN(-0x7fffffff - 1) (-2147483647-1) |
| 71 | #endif |
| 72 | #ifndef INT8_MAX0x7f |
| 73 | #define INT8_MAX0x7f (127) |
| 74 | #endif |
| 75 | #ifndef INT16_MAX0x7fff |
| 76 | #define INT16_MAX0x7fff (32767) |
| 77 | #endif |
| 78 | #ifndef INT32_MAX0x7fffffff |
| 79 | #define INT32_MAX0x7fffffff (2147483647) |
| 80 | #endif |
| 81 | #ifndef UINT8_MAX0xff |
| 82 | #define UINT8_MAX0xff (255U) |
| 83 | #endif |
| 84 | #ifndef UINT16_MAX0xffff |
| 85 | #define UINT16_MAX0xffff (65535U) |
| 86 | #endif |
| 87 | #ifndef UINT32_MAX0xffffffffU |
| 88 | #define UINT32_MAX0xffffffffU (4294967295U) |
| 89 | #endif |
| 90 | |
| 91 | #endif /* ! C99 */ |
| 92 | |
| 93 | #endif /* ! FLEXINT_H */ |
| 94 | |
| 95 | #ifdef __cplusplus |
| 96 | |
| 97 | /* The "const" storage-class-modifier is valid. */ |
| 98 | #define YY_USE_CONST |
| 99 | |
| 100 | #else /* ! __cplusplus */ |
| 101 | |
| 102 | /* C99 requires __STDC__ to be defined as 1. */ |
| 103 | #if defined (__STDC__1) |
| 104 | |
| 105 | #define YY_USE_CONST |
| 106 | |
| 107 | #endif /* defined (__STDC__) */ |
| 108 | #endif /* ! __cplusplus */ |
| 109 | |
| 110 | #ifdef YY_USE_CONST |
| 111 | #define yyconstconst const |
| 112 | #else |
| 113 | #define yyconstconst |
| 114 | #endif |
| 115 | |
| 116 | /* Returned upon end-of-file. */ |
| 117 | #define YY_NULL0 0 |
| 118 | |
| 119 | /* Promotes a possibly negative, possibly signed char to an unsigned |
| 120 | * integer for use as an array index. If the signed char is negative, |
| 121 | * we want to instead treat it as an 8-bit unsigned char, hence the |
| 122 | * double cast. |
| 123 | */ |
| 124 | #define YY_SC_TO_UI(c)((unsigned int) (unsigned char) c) ((unsigned int) (unsigned char) c) |
| 125 | |
| 126 | /* Enter a start condition. This macro really ought to take a parameter, |
| 127 | * but we do it the disgusting crufty way forced on us by the ()-less |
| 128 | * definition of BEGIN. |
| 129 | */ |
| 130 | #define BEGIN(yy_start) = 1 + 2 * (yy_start) = 1 + 2 * |
| 131 | |
| 132 | /* Translate the current start state into a value that can be later handed |
| 133 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
| 134 | * compatibility. |
| 135 | */ |
| 136 | #define YY_START(((yy_start) - 1) / 2) (((yy_start) - 1) / 2) |
| 137 | #define YYSTATE(((yy_start) - 1) / 2) YY_START(((yy_start) - 1) / 2) |
| 138 | |
| 139 | /* Action number for EOF rule of a given start state. */ |
| 140 | #define YY_STATE_EOF(state)(67 + state + 1) (YY_END_OF_BUFFER67 + state + 1) |
| 141 | |
| 142 | /* Special action meaning "start processing a new file". */ |
| 143 | #define YY_NEW_FILEyyrestart(yyin ) yyrestart(yyin ) |
| 144 | |
| 145 | #define YY_END_OF_BUFFER_CHAR0 0 |
| 146 | |
| 147 | /* Size of default input buffer. */ |
| 148 | #ifndef YY_BUF_SIZE16384 |
| 149 | #define YY_BUF_SIZE16384 16384 |
| 150 | #endif |
| 151 | |
| 152 | /* The state buf must be large enough to hold one state per character in the main buffer. |
| 153 | */ |
| 154 | #define YY_STATE_BUF_SIZE((16384 + 2) * sizeof(yy_state_type)) ((YY_BUF_SIZE16384 + 2) * sizeof(yy_state_type)) |
| 155 | |
| 156 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
| 157 | #define YY_TYPEDEF_YY_BUFFER_STATE |
| 158 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
| 159 | #endif |
| 160 | |
| 161 | #ifndef YY_TYPEDEF_YY_SIZE_T |
| 162 | #define YY_TYPEDEF_YY_SIZE_T |
| 163 | typedef size_t yy_size_t; |
| 164 | #endif |
| 165 | |
| 166 | extern yy_size_t yyleng; |
| 167 | |
| 168 | extern FILE *yyin, *yyout; |
| 169 | |
| 170 | #define EOB_ACT_CONTINUE_SCAN0 0 |
| 171 | #define EOB_ACT_END_OF_FILE1 1 |
| 172 | #define EOB_ACT_LAST_MATCH2 2 |
| 173 | |
| 174 | /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires |
| 175 | * access to the local variable yy_act. Since yyless() is a macro, it would break |
| 176 | * existing scanners that call yyless() from OUTSIDE yylex. |
| 177 | * One obvious solution it to make yy_act a global. I tried that, and saw |
| 178 | * a 5% performance hit in a non-yylineno scanner, because yy_act is |
| 179 | * normally declared as a register variable-- so it is not worth it. |
| 180 | */ |
| 181 | #define YY_LESS_LINENO(n)do { int yyl; for ( yyl = n; yyl < yyleng; ++yyl ) if ( yytext [yyl] == '\n' ) --yylineno; }while(0) \ |
| 182 | do { \ |
| 183 | int yyl;\ |
| 184 | for ( yyl = n; yyl < yyleng; ++yyl )\ |
| 185 | if ( yytext[yyl] == '\n' )\ |
| 186 | --yylineno;\ |
| 187 | }while(0) |
| 188 | #define YY_LINENO_REWIND_TO(dst)do { const char *p; for ( p = yy_cp-1; p >= (dst); --p) if ( *p == '\n' ) --yylineno; }while(0) \ |
| 189 | do {\ |
| 190 | const char *p;\ |
| 191 | for ( p = yy_cp-1; p >= (dst); --p)\ |
| 192 | if ( *p == '\n' )\ |
| 193 | --yylineno;\ |
| 194 | }while(0) |
| 195 | |
| 196 | /* Return all but the first "n" matched characters back to the input stream. */ |
| 197 | #define yyless(n)do { int yyless_macro_arg = (n); do { int yyl; for ( yyl = yyless_macro_arg ; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) --yylineno ; }while(0); yytext[yyleng] = (yy_hold_char); (yy_c_buf_p) = yytext + yyless_macro_arg; (yy_hold_char) = *(yy_c_buf_p); *(yy_c_buf_p ) = '\0'; yyleng = yyless_macro_arg; } while ( 0 ) \ |
| 198 | do \ |
| 199 | { \ |
| 200 | /* Undo effects of setting up yytext. */ \ |
| 201 | int yyless_macro_arg = (n); \ |
| 202 | YY_LESS_LINENO(yyless_macro_arg)do { int yyl; for ( yyl = yyless_macro_arg; yyl < yyleng; ++ yyl ) if ( yytext[yyl] == '\n' ) --yylineno; }while(0);\ |
| 203 | *yy_cp = (yy_hold_char); \ |
| 204 | YY_RESTORE_YY_MORE_OFFSET \ |
| 205 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ0; \ |
| 206 | YY_DO_BEFORE_ACTION(yytext) = yy_bp; yyleng = (size_t) (yy_cp - yy_bp); (yy_hold_char ) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp;; /* set up yytext again */ \ |
| 207 | } \ |
| 208 | while ( 0 ) |
| 209 | |
| 210 | #define unput(c)yyunput( c, (yytext) ) yyunput( c, (yytext_ptryytext) ) |
| 211 | |
| 212 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
| 213 | #define YY_STRUCT_YY_BUFFER_STATE |
| 214 | struct yy_buffer_state |
| 215 | { |
| 216 | FILE *yy_input_file; |
| 217 | |
| 218 | char *yy_ch_buf; /* input buffer */ |
| 219 | char *yy_buf_pos; /* current position in input buffer */ |
| 220 | |
| 221 | /* Size of input buffer in bytes, not including room for EOB |
| 222 | * characters. |
| 223 | */ |
| 224 | yy_size_t yy_buf_size; |
| 225 | |
| 226 | /* Number of characters read into yy_ch_buf, not including EOB |
| 227 | * characters. |
| 228 | */ |
| 229 | yy_size_t yy_n_chars; |
| 230 | |
| 231 | /* Whether we "own" the buffer - i.e., we know we created it, |
| 232 | * and can realloc() it to grow it, and should free() it to |
| 233 | * delete it. |
| 234 | */ |
| 235 | int yy_is_our_buffer; |
| 236 | |
| 237 | /* Whether this is an "interactive" input source; if so, and |
| 238 | * if we're using stdio for input, then we want to use getc() |
| 239 | * instead of fread(), to make sure we stop fetching input after |
| 240 | * each newline. |
| 241 | */ |
| 242 | int yy_is_interactive; |
| 243 | |
| 244 | /* Whether we're considered to be at the beginning of a line. |
| 245 | * If so, '^' rules will be active on the next match, otherwise |
| 246 | * not. |
| 247 | */ |
| 248 | int yy_at_bol; |
| 249 | |
| 250 | int yy_bs_lineno; /**< The line count. */ |
| 251 | int yy_bs_column; /**< The column count. */ |
| 252 | |
| 253 | /* Whether to try to fill the input buffer when we reach the |
| 254 | * end of it. |
| 255 | */ |
| 256 | int yy_fill_buffer; |
| 257 | |
| 258 | int yy_buffer_status; |
| 259 | |
| 260 | #define YY_BUFFER_NEW0 0 |
| 261 | #define YY_BUFFER_NORMAL1 1 |
| 262 | /* When an EOF's been seen but there's still some text to process |
| 263 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
| 264 | * shouldn't try reading from the input source any more. We might |
| 265 | * still have a bunch of tokens to match, though, because of |
| 266 | * possible backing-up. |
| 267 | * |
| 268 | * When we actually see the EOF, we change the status to "new" |
| 269 | * (via yyrestart()), so that the user can continue scanning by |
| 270 | * just pointing yyin at a new input file. |
| 271 | */ |
| 272 | #define YY_BUFFER_EOF_PENDING2 2 |
| 273 | |
| 274 | }; |
| 275 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
| 276 | |
| 277 | /* Stack of input buffers. */ |
| 278 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ |
| 279 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ |
| 280 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ |
| 281 | |
| 282 | /* We provide macros for accessing buffer states in case in the |
| 283 | * future we want to put the buffer states in a more general |
| 284 | * "scanner state". |
| 285 | * |
| 286 | * Returns the top of the stack, or NULL. |
| 287 | */ |
| 288 | #define YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ( (yy_buffer_stack) \ |
| 289 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ |
| 290 | : NULL((void *)0)) |
| 291 | |
| 292 | /* Same as previous macro, but useful when we know that the buffer stack is not |
| 293 | * NULL or when we need an lvalue. For internal use only. |
| 294 | */ |
| 295 | #define YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] (yy_buffer_stack)[(yy_buffer_stack_top)] |
| 296 | |
| 297 | /* yy_hold_char holds the character lost when yytext is formed. */ |
| 298 | static char yy_hold_char; |
| 299 | static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ |
| 300 | yy_size_t yyleng; |
| 301 | |
| 302 | /* Points to current character in buffer. */ |
| 303 | static char *yy_c_buf_p = (char *) 0; |
| 304 | static int yy_init = 0; /* whether we need to initialize */ |
| 305 | static int yy_start = 0; /* start state number */ |
| 306 | |
| 307 | /* Flag which is used to allow yywrap()'s to do buffer switches |
| 308 | * instead of setting up a fresh yyin. A bit of a hack ... |
| 309 | */ |
| 310 | static int yy_did_buffer_switch_on_eof; |
| 311 | |
| 312 | void yyrestart (FILE *input_file ); |
| 313 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); |
| 314 | YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); |
| 315 | void yy_delete_buffer (YY_BUFFER_STATE b ); |
| 316 | void yy_flush_buffer (YY_BUFFER_STATE b ); |
| 317 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); |
| 318 | void yypop_buffer_state (void ); |
| 319 | |
| 320 | static void yyensure_buffer_stack (void ); |
| 321 | static void yy_load_buffer_state (void ); |
| 322 | static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); |
| 323 | |
| 324 | #define YY_FLUSH_BUFFERyy_flush_buffer(( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top )] : ((void *)0)) ) yy_flush_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) |
| 325 | |
| 326 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); |
| 327 | YY_BUFFER_STATE yy_scan_string (yyconstconst char *yy_str ); |
| 328 | YY_BUFFER_STATE yy_scan_bytes (yyconstconst char *bytes,yy_size_t len ); |
| 329 | |
| 330 | void *yyalloc (yy_size_t ); |
| 331 | void *yyrealloc (void *,yy_size_t ); |
| 332 | void yyfree (void * ); |
| 333 | |
| 334 | #define yy_new_bufferyy_create_buffer yy_create_buffer |
| 335 | |
| 336 | #define yy_set_interactive(is_interactive){ if ( ! ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top )] : ((void *)0)) ){ yyensure_buffer_stack (); (yy_buffer_stack )[(yy_buffer_stack_top)] = yy_create_buffer(yyin,16384 ); } ( yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive = is_interactive; } \ |
| 337 | { \ |
| 338 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ){ \ |
| 339 | yyensure_buffer_stack (); \ |
| 340 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = \ |
| 341 | yy_create_buffer(yyin,YY_BUF_SIZE16384 ); \ |
| 342 | } \ |
| 343 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive = is_interactive; \ |
| 344 | } |
| 345 | |
| 346 | #define yy_set_bol(at_bol){ if ( ! ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top )] : ((void *)0)) ){ yyensure_buffer_stack (); (yy_buffer_stack )[(yy_buffer_stack_top)] = yy_create_buffer(yyin,16384 ); } ( yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol = at_bol ; } \ |
| 347 | { \ |
| 348 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ){\ |
| 349 | yyensure_buffer_stack (); \ |
| 350 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = \ |
| 351 | yy_create_buffer(yyin,YY_BUF_SIZE16384 ); \ |
| 352 | } \ |
| 353 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol = at_bol; \ |
| 354 | } |
| 355 | |
| 356 | #define YY_AT_BOL()((yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol) (YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol) |
| 357 | |
| 358 | /* Begin user sect3 */ |
| 359 | |
| 360 | typedef unsigned char YY_CHAR; |
| 361 | |
| 362 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; |
| 363 | |
| 364 | typedef int yy_state_type; |
| 365 | |
| 366 | extern int yylineno; |
| 367 | |
| 368 | int yylineno = 1; |
| 369 | |
| 370 | extern char *yytext; |
| 371 | #define yytext_ptryytext yytext |
| 372 | |
| 373 | static yy_state_type yy_get_previous_state (void ); |
| 374 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); |
| 375 | static int yy_get_next_buffer (void ); |
| 376 | static void yy_fatal_error (yyconstconst char msg[] ); |
| 377 | |
| 378 | /* Done after the current pattern has been matched and before the |
| 379 | * corresponding action - sets up yytext. |
| 380 | */ |
| 381 | #define YY_DO_BEFORE_ACTION(yytext) = yy_bp; yyleng = (size_t) (yy_cp - yy_bp); (yy_hold_char ) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp; \ |
| 382 | (yytext_ptryytext) = yy_bp; \ |
| 383 | yyleng = (size_t) (yy_cp - yy_bp); \ |
| 384 | (yy_hold_char) = *yy_cp; \ |
| 385 | *yy_cp = '\0'; \ |
| 386 | (yy_c_buf_p) = yy_cp; |
| 387 | |
| 388 | #define YY_NUM_RULES66 66 |
| 389 | #define YY_END_OF_BUFFER67 67 |
| 390 | /* This struct is not used in this scanner, |
| 391 | but its presence is necessary. */ |
| 392 | struct yy_trans_info |
| 393 | { |
| 394 | flex_int32_t yy_verify; |
| 395 | flex_int32_t yy_nxt; |
| 396 | }; |
| 397 | static yyconstconst flex_int16_t yy_accept[294] = |
| 398 | { 0, |
| 399 | 7, 7, 67, 65, 7, 65, 18, 15, 65, 65, |
| 400 | 6, 1, 2, 3, 4, 9, 16, 17, 65, 9, |
| 401 | 9, 9, 9, 9, 9, 65, 65, 65, 65, 65, |
| 402 | 65, 65, 65, 65, 65, 65, 65, 65, 9, 65, |
| 403 | 65, 7, 65, 0, 11, 65, 65, 0, 65, 9, |
| 404 | 5, 65, 65, 9, 65, 65, 9, 65, 65, 65, |
| 405 | 9, 65, 9, 65, 65, 29, 9, 32, 65, 65, |
| 406 | 65, 9, 65, 65, 41, 65, 45, 65, 65, 48, |
| 407 | 65, 50, 65, 65, 65, 55, 65, 65, 65, 65, |
| 408 | 65, 65, 0, 8, 65, 65, 55, 0, 11, 0, |
| 409 | |
| 410 | 11, 10, 10, 65, 0, 13, 65, 65, 0, 12, |
| 411 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 412 | 9, 9, 65, 65, 65, 65, 65, 65, 65, 44, |
| 413 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 414 | 65, 65, 21, 65, 65, 65, 11, 0, 13, 0, |
| 415 | 13, 0, 12, 0, 65, 65, 65, 65, 65, 65, |
| 416 | 65, 25, 65, 65, 65, 65, 9, 33, 34, 65, |
| 417 | 65, 65, 65, 65, 65, 65, 65, 47, 65, 65, |
| 418 | 65, 65, 54, 65, 65, 65, 65, 65, 65, 65, |
| 419 | 65, 13, 0, 65, 19, 20, 22, 23, 65, 65, |
| 420 | |
| 421 | 65, 65, 65, 31, 65, 36, 65, 65, 40, 64, |
| 422 | 65, 46, 49, 65, 65, 65, 56, 57, 65, 65, |
| 423 | 60, 65, 65, 65, 65, 65, 65, 65, 28, 65, |
| 424 | 65, 65, 65, 65, 65, 52, 53, 65, 65, 65, |
| 425 | 65, 65, 65, 0, 14, 65, 24, 65, 27, 30, |
| 426 | 35, 65, 65, 65, 65, 43, 65, 65, 65, 65, |
| 427 | 65, 65, 0, 14, 0, 14, 26, 37, 65, 65, |
| 428 | 65, 51, 58, 59, 65, 65, 65, 14, 39, 65, |
| 429 | 65, 65, 62, 65, 65, 42, 63, 61, 65, 65, |
| 430 | 65, 38, 0 |
| 431 | |
| 432 | } ; |
| 433 | |
| 434 | static yyconstconst flex_int32_t yy_ec[256] = |
| 435 | { 0, |
| 436 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
| 437 | 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, |
| 438 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 439 | 1, 2, 1, 4, 5, 1, 1, 1, 6, 7, |
| 440 | 8, 1, 9, 1, 10, 11, 1, 12, 13, 14, |
| 441 | 15, 16, 17, 18, 17, 17, 17, 19, 20, 1, |
| 442 | 1, 1, 21, 1, 22, 23, 24, 25, 26, 27, |
| 443 | 28, 29, 30, 1, 1, 31, 32, 33, 34, 35, |
| 444 | 1, 36, 37, 38, 39, 40, 41, 42, 1, 1, |
| 445 | 43, 44, 45, 1, 1, 1, 22, 46, 24, 25, |
| 446 | |
| 447 | 47, 27, 28, 29, 48, 1, 49, 31, 50, 51, |
| 448 | 52, 35, 1, 53, 37, 54, 39, 40, 41, 42, |
| 449 | 55, 56, 1, 1, 1, 1, 1, 1, 1, 1, |
| 450 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 451 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 452 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 453 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 454 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 455 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 456 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 457 | |
| 458 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 459 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 460 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 461 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 462 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 463 | 1, 1, 1, 1, 1 |
| 464 | } ; |
| 465 | |
| 466 | static yyconstconst flex_int32_t yy_meta[57] = |
| 467 | { 0, |
| 468 | 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, |
| 469 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 470 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 471 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 472 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 473 | 1, 1, 1, 1, 1, 1 |
| 474 | } ; |
| 475 | |
| 476 | static yyconstconst flex_int16_t yy_base[306] = |
| 477 | { 0, |
| 478 | 0, 0, 546, 0, 55, 57, 543, 0, 513, 90, |
| 479 | 58, 127, 0, 0, 0, 0, 0, 0, 38, 43, |
| 480 | 38, 45, 129, 42, 52, 73, 516, 130, 63, 44, |
| 481 | 34, 94, 59, 100, 513, 535, 92, 486, 128, 96, |
| 482 | 0, 116, 163, 181, 0, 184, 533, 532, 75, 0, |
| 483 | 0, 187, 190, 0, 77, 149, 128, 515, 164, 512, |
| 484 | 507, 507, 496, 162, 171, 0, 97, 0, 495, 506, |
| 485 | 161, 167, 174, 168, 0, 181, 0, 508, 170, 0, |
| 486 | 170, 502, 493, 505, 179, 0, 173, 199, 180, 184, |
| 487 | 481, 129, 522, 547, 472, 475, 473, 165, 547, 202, |
| 488 | |
| 489 | 234, 0, 547, 237, 240, 0, 245, 248, 251, 0, |
| 490 | 258, 219, 215, 499, 227, 228, 493, 238, 232, 497, |
| 491 | 235, 241, 247, 256, 251, 493, 486, 494, 490, 0, |
| 492 | 474, 478, 490, 474, 253, 238, 254, 263, 471, 266, |
| 493 | 472, 477, 0, 458, 452, 458, 278, 293, 547, 295, |
| 494 | 313, 127, 547, 299, 310, 266, 268, 467, 276, 276, |
| 495 | 284, 0, 287, 285, 288, 296, 287, 0, 0, 481, |
| 496 | 475, 294, 303, 476, 475, 306, 308, 0, 468, 309, |
| 497 | 476, 295, 0, 466, 318, 474, 315, 322, 415, 451, |
| 498 | 408, 332, 343, 454, 0, 0, 0, 0, 322, 434, |
| 499 | |
| 500 | 318, 333, 432, 0, 416, 0, 327, 442, 0, 0, |
| 501 | 326, 0, 0, 323, 328, 372, 0, 0, 344, 337, |
| 502 | 0, 400, 404, 401, 370, 428, 348, 415, 0, 410, |
| 503 | 357, 418, 365, 361, 425, 0, 0, 404, 360, 386, |
| 504 | 378, 376, 392, 398, 0, 404, 0, 359, 0, 0, |
| 505 | 0, 398, 370, 383, 384, 0, 410, 390, 411, 312, |
| 506 | 310, 224, 411, 547, 413, 416, 0, 0, 204, 386, |
| 507 | 180, 0, 0, 0, 163, 125, 115, 419, 0, 123, |
| 508 | 121, 104, 0, 90, 395, 0, 0, 0, 392, 394, |
| 509 | 82, 0, 547, 85, 463, 466, 468, 471, 474, 477, |
| 510 | |
| 511 | 480, 483, 486, 489, 492 |
| 512 | } ; |
| 513 | |
| 514 | static yyconstconst flex_int16_t yy_def[306] = |
| 515 | { 0, |
| 516 | 293, 1, 293, 294, 293, 295, 296, 294, 294, 294, |
| 517 | 294, 294, 12, 12, 12, 12, 294, 294, 294, 12, |
| 518 | 12, 12, 12, 12, 12, 294, 294, 294, 294, 294, |
| 519 | 294, 294, 294, 294, 294, 294, 297, 294, 12, 294, |
| 520 | 294, 293, 295, 298, 294, 295, 294, 293, 294, 12, |
| 521 | 12, 299, 300, 12, 294, 294, 12, 294, 294, 294, |
| 522 | 12, 294, 12, 294, 294, 294, 12, 294, 294, 294, |
| 523 | 294, 12, 294, 294, 294, 294, 294, 294, 294, 294, |
| 524 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 525 | 294, 297, 301, 293, 294, 294, 294, 298, 293, 298, |
| 526 | |
| 527 | 295, 294, 293, 299, 302, 294, 299, 300, 303, 294, |
| 528 | 300, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 529 | 12, 12, 294, 294, 294, 294, 294, 294, 294, 294, |
| 530 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 531 | 294, 294, 294, 294, 294, 294, 298, 302, 293, 302, |
| 532 | 299, 303, 293, 303, 300, 294, 294, 294, 294, 294, |
| 533 | 294, 294, 294, 294, 294, 294, 12, 294, 294, 294, |
| 534 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 535 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 536 | 294, 302, 303, 294, 294, 294, 294, 294, 294, 294, |
| 537 | |
| 538 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 539 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 540 | 294, 294, 294, 294, 304, 294, 294, 294, 294, 294, |
| 541 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 542 | 294, 294, 304, 305, 294, 304, 294, 294, 294, 294, |
| 543 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 544 | 294, 294, 305, 293, 305, 304, 294, 294, 294, 294, |
| 545 | 294, 294, 294, 294, 294, 294, 294, 305, 294, 294, |
| 546 | 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, |
| 547 | 294, 294, 0, 293, 293, 293, 293, 293, 293, 293, |
| 548 | |
| 549 | 293, 293, 293, 293, 293 |
| 550 | } ; |
| 551 | |
| 552 | static yyconstconst flex_int16_t yy_nxt[604] = |
| 553 | { 0, |
| 554 | 4, 5, 5, 6, 4, 7, 8, 4, 9, 10, |
| 555 | 11, 12, 13, 14, 15, 16, 16, 16, 17, 18, |
| 556 | 19, 20, 21, 22, 23, 24, 25, 4, 26, 27, |
| 557 | 28, 4, 4, 29, 4, 30, 31, 32, 33, 34, |
| 558 | 35, 4, 36, 37, 38, 21, 39, 27, 4, 4, |
| 559 | 4, 29, 30, 40, 4, 4, 42, 42, 44, 44, |
| 560 | 45, 52, 55, 61, 53, 57, 63, 80, 56, 83, |
| 561 | 58, 84, 69, 59, 70, 72, 62, 75, 64, 60, |
| 562 | 65, 73, 74, 71, 61, 41, 81, 84, 57, 82, |
| 563 | 83, 87, 70, 93, 94, 292, 64, 65, 76, 73, |
| 564 | |
| 565 | 46, 50, 51, 50, 50, 50, 50, 50, 79, 87, |
| 566 | 68, 50, 50, 50, 50, 50, 50, 42, 42, 76, |
| 567 | 121, 88, 85, 122, 85, 89, 79, 86, 68, 86, |
| 568 | 93, 94, 288, 66, 153, 50, 50, 54, 54, 54, |
| 569 | 54, 54, 54, 54, 54, 86, 89, 97, 54, 54, |
| 570 | 54, 54, 54, 54, 67, 78, 287, 286, 69, 285, |
| 571 | 70, 112, 68, 79, 98, 98, 45, 284, 99, 71, |
| 572 | 154, 283, 54, 54, 78, 67, 78, 96, 70, 112, |
| 573 | 68, 79, 44, 44, 99, 98, 98, 101, 105, 105, |
| 574 | 106, 109, 109, 114, 119, 78, 120, 110, 125, 127, |
| 575 | |
| 576 | 126, 128, 129, 132, 137, 147, 46, 133, 100, 282, |
| 577 | 138, 114, 119, 142, 125, 141, 281, 120, 126, 128, |
| 578 | 127, 132, 130, 133, 100, 137, 138, 46, 279, 139, |
| 579 | 107, 142, 141, 111, 140, 98, 98, 45, 148, 148, |
| 580 | 106, 105, 105, 149, 157, 100, 148, 148, 151, 152, |
| 581 | 152, 140, 109, 109, 156, 110, 159, 160, 153, 152, |
| 582 | 152, 155, 157, 162, 166, 110, 167, 169, 163, 164, |
| 583 | 277, 156, 168, 182, 159, 160, 172, 46, 181, 170, |
| 584 | 107, 99, 166, 150, 162, 164, 183, 167, 107, 171, |
| 585 | 182, 111, 184, 168, 154, 186, 149, 172, 192, 181, |
| 586 | |
| 587 | 195, 111, 193, 194, 183, 197, 153, 171, 198, 199, |
| 588 | 184, 152, 152, 186, 148, 148, 106, 110, 195, 194, |
| 589 | 201, 100, 204, 197, 200, 202, 198, 203, 208, 207, |
| 590 | 199, 211, 216, 212, 214, 149, 150, 201, 150, 204, |
| 591 | 200, 202, 154, 218, 220, 203, 207, 221, 216, 208, |
| 592 | 153, 228, 211, 111, 212, 214, 107, 226, 229, 232, |
| 593 | 235, 234, 220, 276, 218, 236, 238, 275, 221, 228, |
| 594 | 239, 244, 244, 245, 226, 150, 235, 232, 234, 229, |
| 595 | 248, 236, 251, 237, 237, 237, 154, 237, 239, 238, |
| 596 | 253, 255, 259, 263, 263, 245, 267, 256, 248, 244, |
| 597 | |
| 598 | 244, 264, 269, 251, 254, 263, 263, 266, 270, 271, |
| 599 | 259, 253, 267, 246, 264, 273, 278, 263, 263, 245, |
| 600 | 269, 280, 264, 274, 289, 290, 291, 272, 268, 270, |
| 601 | 271, 262, 261, 260, 258, 246, 273, 257, 280, 252, |
| 602 | 250, 265, 289, 290, 291, 249, 247, 246, 242, 241, |
| 603 | 240, 233, 231, 230, 265, 227, 265, 225, 224, 246, |
| 604 | 223, 222, 265, 43, 43, 43, 47, 47, 92, 92, |
| 605 | 92, 98, 98, 98, 104, 104, 104, 108, 108, 108, |
| 606 | 93, 93, 93, 148, 148, 148, 152, 152, 152, 243, |
| 607 | 243, 243, 263, 263, 263, 219, 217, 215, 213, 210, |
| 608 | |
| 609 | 209, 206, 205, 196, 191, 190, 189, 188, 187, 185, |
| 610 | 180, 179, 178, 177, 176, 175, 174, 173, 165, 161, |
| 611 | 158, 146, 145, 144, 94, 143, 136, 135, 134, 131, |
| 612 | 124, 123, 118, 117, 116, 115, 113, 103, 102, 95, |
| 613 | 91, 90, 77, 49, 48, 293, 3, 293, 293, 293, |
| 614 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 615 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 616 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 617 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 618 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 619 | |
| 620 | 293, 293, 293 |
| 621 | } ; |
| 622 | |
| 623 | static yyconstconst flex_int16_t yy_chk[604] = |
| 624 | { 0, |
| 625 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 626 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 627 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 628 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 629 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 630 | 1, 1, 1, 1, 1, 1, 5, 5, 6, 6, |
| 631 | 6, 11, 19, 21, 11, 20, 22, 29, 19, 30, |
| 632 | 20, 31, 24, 20, 24, 25, 21, 26, 22, 20, |
| 633 | 22, 25, 25, 24, 21, 294, 29, 31, 20, 29, |
| 634 | 30, 33, 24, 37, 37, 291, 22, 22, 26, 25, |
| 635 | |
| 636 | 6, 10, 10, 10, 10, 10, 10, 10, 49, 33, |
| 637 | 55, 10, 10, 10, 10, 10, 10, 42, 42, 26, |
| 638 | 67, 34, 32, 67, 40, 34, 49, 32, 55, 40, |
| 639 | 92, 92, 284, 23, 152, 10, 10, 12, 12, 12, |
| 640 | 12, 12, 12, 12, 12, 32, 34, 40, 12, 12, |
| 641 | 12, 12, 12, 12, 23, 28, 282, 281, 39, 280, |
| 642 | 39, 57, 23, 28, 43, 43, 43, 277, 98, 39, |
| 643 | 152, 276, 12, 12, 56, 23, 28, 39, 39, 57, |
| 644 | 23, 28, 44, 44, 44, 46, 46, 46, 52, 52, |
| 645 | 52, 53, 53, 59, 64, 56, 65, 53, 71, 73, |
| 646 | |
| 647 | 72, 74, 76, 79, 85, 100, 43, 81, 98, 275, |
| 648 | 87, 59, 64, 90, 71, 89, 271, 65, 72, 74, |
| 649 | 73, 79, 76, 81, 44, 85, 87, 46, 269, 88, |
| 650 | 52, 90, 89, 53, 88, 101, 101, 101, 104, 104, |
| 651 | 104, 105, 105, 105, 113, 100, 107, 107, 107, 108, |
| 652 | 108, 88, 109, 109, 112, 108, 115, 116, 109, 111, |
| 653 | 111, 111, 113, 118, 121, 111, 122, 124, 119, 119, |
| 654 | 262, 112, 123, 136, 115, 116, 125, 101, 135, 124, |
| 655 | 104, 147, 121, 105, 118, 119, 137, 122, 107, 124, |
| 656 | 136, 108, 138, 123, 109, 140, 148, 125, 150, 135, |
| 657 | |
| 658 | 157, 111, 154, 156, 137, 159, 154, 124, 160, 161, |
| 659 | 138, 155, 155, 140, 151, 151, 151, 155, 157, 156, |
| 660 | 164, 147, 167, 159, 163, 165, 160, 166, 173, 172, |
| 661 | 161, 176, 182, 177, 180, 192, 148, 164, 150, 167, |
| 662 | 163, 165, 154, 185, 187, 166, 172, 188, 182, 173, |
| 663 | 193, 201, 176, 155, 177, 180, 151, 199, 202, 207, |
| 664 | 214, 211, 187, 261, 185, 215, 219, 260, 188, 201, |
| 665 | 220, 225, 225, 225, 199, 192, 214, 207, 211, 202, |
| 666 | 227, 215, 231, 216, 216, 216, 193, 216, 220, 219, |
| 667 | 233, 234, 239, 243, 243, 243, 248, 234, 227, 244, |
| 668 | |
| 669 | 244, 244, 253, 231, 233, 246, 246, 246, 254, 255, |
| 670 | 239, 233, 248, 225, 263, 258, 265, 266, 266, 266, |
| 671 | 253, 270, 278, 259, 285, 289, 290, 257, 252, 254, |
| 672 | 255, 242, 241, 240, 238, 243, 258, 235, 270, 232, |
| 673 | 230, 244, 285, 289, 290, 228, 226, 246, 224, 223, |
| 674 | 222, 208, 205, 203, 263, 200, 265, 194, 191, 266, |
| 675 | 190, 189, 278, 295, 295, 295, 296, 296, 297, 297, |
| 676 | 297, 298, 298, 298, 299, 299, 299, 300, 300, 300, |
| 677 | 301, 301, 301, 302, 302, 302, 303, 303, 303, 304, |
| 678 | 304, 304, 305, 305, 305, 186, 184, 181, 179, 175, |
| 679 | |
| 680 | 174, 171, 170, 158, 146, 145, 144, 142, 141, 139, |
| 681 | 134, 133, 132, 131, 129, 128, 127, 126, 120, 117, |
| 682 | 114, 97, 96, 95, 93, 91, 84, 83, 82, 78, |
| 683 | 70, 69, 63, 62, 61, 60, 58, 48, 47, 38, |
| 684 | 36, 35, 27, 9, 7, 3, 293, 293, 293, 293, |
| 685 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 686 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 687 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 688 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 689 | 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, |
| 690 | |
| 691 | 293, 293, 293 |
| 692 | } ; |
| 693 | |
| 694 | /* Table of booleans, true if rule could match eol. */ |
| 695 | static yyconstconst flex_int32_t yy_rule_can_match_eol[67] = |
| 696 | { 0, |
| 697 | 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, |
| 698 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 699 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 700 | 0, 0, 0, 0, 0, 0, 0, }; |
| 701 | |
| 702 | static yy_state_type yy_last_accepting_state; |
| 703 | static char *yy_last_accepting_cpos; |
| 704 | |
| 705 | extern int yy_flex_debug; |
| 706 | int yy_flex_debug = 0; |
| 707 | |
| 708 | /* The intent behind this definition is that it'll catch |
| 709 | * any uses of REJECT which flex missed. |
| 710 | */ |
| 711 | #define REJECTreject_used_but_not_detected reject_used_but_not_detected |
| 712 | #define yymore()yymore_used_but_not_detected yymore_used_but_not_detected |
| 713 | #define YY_MORE_ADJ0 0 |
| 714 | #define YY_RESTORE_YY_MORE_OFFSET |
| 715 | char *yytext; |
| 716 | #line 1 "/usr/src/usr.bin/fgen/fgen.l" |
| 717 | #line 2 "/usr/src/usr.bin/fgen/fgen.l" |
| 718 | /* $OpenBSD: fgen.l,v 1.14 2021/12/13 18:28:40 deraadt Exp $ */ |
| 719 | /* $NetBSD: fgen.l,v 1.37 2016/03/08 20:13:44 christos Exp $ */ |
| 720 | /* FLEX input for FORTH input file scanner */ |
| 721 | /* |
| 722 | * Copyright (c) 1998 Eduardo Horvath. |
| 723 | * All rights reserved. |
| 724 | * |
| 725 | * Redistribution and use in source and binary forms, with or without |
| 726 | * modification, are permitted provided that the following conditions |
| 727 | * are met: |
| 728 | * 1. Redistributions of source code must retain the above copyright |
| 729 | * notice, this list of conditions and the following disclaimer. |
| 730 | * 2. Redistributions in binary form must reproduce the above copyright |
| 731 | * notice, this list of conditions and the following disclaimer in the |
| 732 | * documentation and/or other materials provided with the distribution. |
| 733 | * |
| 734 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 735 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 736 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 737 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 738 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 739 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 740 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 741 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 742 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 743 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 744 | */ |
| 745 | /* |
| 746 | Specifications are as follows: |
| 747 | |
| 748 | The function "yylex()" always returns a pointer to a structure: |
| 749 | |
| 750 | struct tok { |
| 751 | int type; |
| 752 | char *text; |
| 753 | } |
| 754 | #define TOKEN struct tok |
| 755 | */ |
| 756 | |
| 757 | #line 51 "/usr/src/usr.bin/fgen/fgen.l" |
| 758 | #include <sys/types.h> |
| 759 | #include <arpa/inet.h> |
| 760 | |
| 761 | #include <assert.h> |
| 762 | #include <err.h> |
| 763 | #include <errno(*__errno()).h> |
| 764 | #include <fcntl.h> |
| 765 | #include <stdarg.h> |
| 766 | #include <stdio.h> |
| 767 | #include <string.h> |
| 768 | #include <unistd.h> |
| 769 | #include <util.h> |
| 770 | |
| 771 | #include "fgen.h" |
| 772 | static TOKENstruct tok ltoken; |
| 773 | |
| 774 | /* |
| 775 | * Global variables that control the parse state. |
| 776 | */ |
| 777 | |
| 778 | static struct fcode *dictionary = NULL((void *)0); |
| 779 | static struct macro *aliases = NULL((void *)0); |
| 780 | static int outf = 1; /* stdout */ |
| 781 | static int state = 0; |
| 782 | static int nextfcode = 0x800; |
| 783 | static int numbase = TOK_HEX; |
| 784 | static long outpos; |
| 785 | static char *outbuf = NULL((void *)0); |
| 786 | static char *outfile, *infile; |
| 787 | #define BUFCLICK(1024*1024) (1024*1024) |
| 788 | static size_t outbufsiz = 0; |
| 789 | static char *myname = NULL((void *)0); |
| 790 | static int offsetsize = 8; |
| 791 | static int defining = 0; |
| 792 | static int tokenizer = 0; |
| 793 | static int need_end0 = 1; |
| 794 | |
| 795 | #define PSTKSIZ1024 1024 |
| 796 | static Cell parse_stack[PSTKSIZ1024]; |
| 797 | static int parse_stack_ptr = 0; |
| 798 | |
| 799 | static void token_err(int, const char *, const char *, const char *, ...) |
| 800 | __attribute__((__format__ (printf, 4, 5))) __dead__attribute__((__noreturn__)); |
| 801 | static YY_DECLstruct tok* yylex(void); |
| 802 | |
| 803 | static int debug = 0; |
| 804 | #define ASSERTif (debug) assert if (debug) assert |
| 805 | #define STATE(y, x)do { if (debug) printf("%lx State %s: token `%s'\n", outpos, x , y); } while (0) do { if (debug) printf("%lx State %s: token `%s'\n", outpos, x, y); } while (0) |
| 806 | static int mark_fload = 0; |
| 807 | |
| 808 | void * |
| 809 | emalloc(size_t sz) |
| 810 | { |
| 811 | void *p = malloc(sz); |
| 812 | if (p == NULL((void *)0)) |
| 813 | err(1, NULL((void *)0)); |
| 814 | return p; |
| 815 | } |
| 816 | |
| 817 | char * |
| 818 | estrdup(const char *s) |
| 819 | { |
| 820 | char *p = strdup(s); |
| 821 | if (p == NULL((void *)0)) |
| 822 | err(1, NULL((void *)0)); |
| 823 | return p; |
| 824 | } |
| 825 | |
| 826 | void * |
| 827 | erealloc(void *p, size_t sz) |
| 828 | { |
| 829 | void *q = realloc(p, sz); |
| 830 | if (q == NULL((void *)0)) |
| 831 | err(1, NULL((void *)0)); |
| 832 | return q; |
| 833 | } |
| 834 | |
| 835 | #line 836 "fgen.c" |
| 836 | |
| 837 | #define INITIAL0 0 |
| 838 | |
| 839 | #ifndef YY_NO_UNISTD_H |
| 840 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
| 841 | * down here because we want the user's section 1 to have been scanned first. |
| 842 | * The user has a chance to override it with an option. |
| 843 | */ |
| 844 | #include <unistd.h> |
| 845 | #endif |
| 846 | |
| 847 | #ifndef YY_EXTRA_TYPEvoid * |
| 848 | #define YY_EXTRA_TYPEvoid * void * |
| 849 | #endif |
| 850 | |
| 851 | static int yy_init_globals (void ); |
| 852 | |
| 853 | /* Accessor methods to globals. |
| 854 | These are made visible to non-reentrant scanners for convenience. */ |
| 855 | |
| 856 | int yylex_destroy (void ); |
| 857 | |
| 858 | int yyget_debug (void ); |
| 859 | |
| 860 | void yyset_debug (int debug_flag ); |
| 861 | |
| 862 | YY_EXTRA_TYPEvoid * yyget_extra (void ); |
| 863 | |
| 864 | void yyset_extra (YY_EXTRA_TYPEvoid * user_defined ); |
| 865 | |
| 866 | FILE *yyget_in (void ); |
| 867 | |
| 868 | void yyset_in (FILE * in_str ); |
| 869 | |
| 870 | FILE *yyget_out (void ); |
| 871 | |
| 872 | void yyset_out (FILE * out_str ); |
| 873 | |
| 874 | yy_size_t yyget_leng (void ); |
| 875 | |
| 876 | char *yyget_text (void ); |
| 877 | |
| 878 | int yyget_lineno (void ); |
| 879 | |
| 880 | void yyset_lineno (int line_number ); |
| 881 | |
| 882 | /* Macros after this point can all be overridden by user definitions in |
| 883 | * section 1. |
| 884 | */ |
| 885 | |
| 886 | #ifndef YY_SKIP_YYWRAP |
| 887 | #ifdef __cplusplus |
| 888 | extern "C" int yywrap (void ); |
| 889 | #else |
| 890 | extern int yywrap (void ); |
| 891 | #endif |
| 892 | #endif |
| 893 | |
| 894 | #ifndef yytext_ptryytext |
| 895 | static void yy_flex_strncpy (char *,yyconstconst char *,int ); |
| 896 | #endif |
| 897 | |
| 898 | #ifdef YY_NEED_STRLEN |
| 899 | static int yy_flex_strlen (yyconstconst char * ); |
| 900 | #endif |
| 901 | |
| 902 | #ifndef YY_NO_INPUT |
| 903 | |
| 904 | #ifdef __cplusplus |
| 905 | static int yyinput (void ); |
| 906 | #else |
| 907 | static int input (void ); |
| 908 | #endif |
| 909 | |
| 910 | #endif |
| 911 | |
| 912 | /* Amount of stuff to slurp up with each read. */ |
| 913 | #ifndef YY_READ_BUF_SIZE8192 |
| 914 | #define YY_READ_BUF_SIZE8192 8192 |
| 915 | #endif |
| 916 | |
| 917 | /* Copy whatever the last rule matched to the standard output. */ |
| 918 | #ifndef ECHOdo { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) |
| 919 | /* This used to be an fputs(), but since the string might contain NUL's, |
| 920 | * we now use fwrite(). |
| 921 | */ |
| 922 | #define ECHOdo { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) |
| 923 | #endif |
| 924 | |
| 925 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
| 926 | * is returned in "result". |
| 927 | */ |
| 928 | #ifndef YY_INPUT |
| 929 | #define YY_INPUT(buf,result,max_size)if ( (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) { int c = '*'; size_t n; for ( n = 0; n < max_size && (c = (!__isthreaded ? (--(yyin)->_r < 0 ? __srget(yyin ) : (int)(*(yyin)->_p++)) : (getc)(yyin))) != (-1) && c != '\n'; ++n ) buf[n] = (char) c; if ( c == '\n' ) buf[n++ ] = (char) c; if ( c == (-1) && (!__isthreaded ? (((yyin )->_flags & 0x0040) != 0) : (ferror)(yyin)) ) yy_fatal_error ( "input in flex scanner failed" ); result = n; } else { (*__errno ())=0; while ( (result = fread(buf, 1, max_size, yyin))==0 && (!__isthreaded ? (((yyin)->_flags & 0x0040) != 0) : ( ferror)(yyin))) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed" ); break; } (*__errno())=0; (!__isthreaded ? ((void)((yyin)-> _flags &= ~(0x0040|0x0020))) : (clearerr)(yyin)); } } \ |
| 930 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) \ |
| 931 | { \ |
| 932 | int c = '*'; \ |
| 933 | size_t n; \ |
| 934 | for ( n = 0; n < max_size && \ |
| 935 | (c = getc( yyin )(!__isthreaded ? (--(yyin)->_r < 0 ? __srget(yyin) : (int )(*(yyin)->_p++)) : (getc)(yyin))) != EOF(-1) && c != '\n'; ++n ) \ |
| 936 | buf[n] = (char) c; \ |
| 937 | if ( c == '\n' ) \ |
| 938 | buf[n++] = (char) c; \ |
| 939 | if ( c == EOF(-1) && ferror( yyin )(!__isthreaded ? (((yyin)->_flags & 0x0040) != 0) : (ferror )(yyin)) ) \ |
| 940 | YY_FATAL_ERROR( "input in flex scanner failed" )yy_fatal_error( "input in flex scanner failed" ); \ |
| 941 | result = n; \ |
| 942 | } \ |
| 943 | else \ |
| 944 | { \ |
| 945 | errno(*__errno())=0; \ |
| 946 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)(!__isthreaded ? (((yyin)->_flags & 0x0040) != 0) : (ferror )(yyin))) \ |
| 947 | { \ |
| 948 | if( errno(*__errno()) != EINTR4) \ |
| 949 | { \ |
| 950 | YY_FATAL_ERROR( "input in flex scanner failed" )yy_fatal_error( "input in flex scanner failed" ); \ |
| 951 | break; \ |
| 952 | } \ |
| 953 | errno(*__errno())=0; \ |
| 954 | clearerr(yyin)(!__isthreaded ? ((void)((yyin)->_flags &= ~(0x0040|0x0020 ))) : (clearerr)(yyin)); \ |
| 955 | } \ |
| 956 | }\ |
| 957 | \ |
| 958 | |
| 959 | #endif |
| 960 | |
| 961 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
| 962 | * we don't want an extra ';' after the "return" because that will cause |
| 963 | * some compilers to complain about unreachable statements. |
| 964 | */ |
| 965 | #ifndef yyterminate |
| 966 | #define yyterminate()return 0 return YY_NULL0 |
| 967 | #endif |
| 968 | |
| 969 | /* Number of entries by which start-condition stack grows. */ |
| 970 | #ifndef YY_START_STACK_INCR25 |
| 971 | #define YY_START_STACK_INCR25 25 |
| 972 | #endif |
| 973 | |
| 974 | /* Report a fatal error. */ |
| 975 | #ifndef YY_FATAL_ERROR |
| 976 | #define YY_FATAL_ERROR(msg)yy_fatal_error( msg ) yy_fatal_error( msg ) |
| 977 | #endif |
| 978 | |
| 979 | /* end tables serialization structures and prototypes */ |
| 980 | |
| 981 | /* Default declaration of generated scanner - a define so the user can |
| 982 | * easily add parameters. |
| 983 | */ |
| 984 | #ifndef YY_DECLstruct tok* yylex(void) |
| 985 | #define YY_DECL_IS_OURS 1 |
| 986 | |
| 987 | extern int yylex (void); |
| 988 | |
| 989 | #define YY_DECLstruct tok* yylex(void) int yylex (void) |
| 990 | #endif /* !YY_DECL */ |
| 991 | |
| 992 | /* Code executed at the beginning of each rule, after yytext and yyleng |
| 993 | * have been set up. |
| 994 | */ |
| 995 | #ifndef YY_USER_ACTION |
| 996 | #define YY_USER_ACTION |
| 997 | #endif |
| 998 | |
| 999 | /* Code executed at the end of each rule. */ |
| 1000 | #ifndef YY_BREAKbreak; |
| 1001 | #define YY_BREAKbreak; break; |
| 1002 | #endif |
| 1003 | |
| 1004 | #define YY_RULE_SETUP \ |
| 1005 | YY_USER_ACTION |
| 1006 | |
| 1007 | /** The main scanner function which does all the work. |
| 1008 | */ |
| 1009 | YY_DECLstruct tok* yylex(void) |
| 1010 | { |
| 1011 | yy_state_type yy_current_state; |
| 1012 | char *yy_cp, *yy_bp; |
| 1013 | int yy_act; |
| 1014 | |
| 1015 | if ( !(yy_init) ) |
| 1016 | { |
| 1017 | (yy_init) = 1; |
| 1018 | |
| 1019 | #ifdef YY_USER_INIT |
| 1020 | YY_USER_INIT; |
| 1021 | #endif |
| 1022 | |
| 1023 | if ( ! (yy_start) ) |
| 1024 | (yy_start) = 1; /* first start state */ |
| 1025 | |
| 1026 | if ( ! yyin ) { |
| 1027 | yyin = stdin(&__sF[0]); |
| 1028 | } |
| 1029 | |
| 1030 | if ( ! yyout ) { |
| 1031 | yyout = stdout(&__sF[1]); |
| 1032 | } |
| 1033 | |
| 1034 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) { |
| 1035 | yyensure_buffer_stack (); |
| 1036 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = |
| 1037 | yy_create_buffer(yyin,YY_BUF_SIZE16384 ); |
| 1038 | } |
| 1039 | |
| 1040 | yy_load_buffer_state( ); |
| 1041 | } |
| 1042 | |
| 1043 | { |
| 1044 | #line 132 "/usr/src/usr.bin/fgen/fgen.l" |
| 1045 | |
| 1046 | |
| 1047 | #line 1048 "fgen.c" |
| 1048 | |
| 1049 | while ( 1 ) /* loops until end-of-file is reached */ |
| 1050 | { |
| 1051 | yy_cp = (yy_c_buf_p); |
| 1052 | |
| 1053 | /* Support of yytext. */ |
| 1054 | *yy_cp = (yy_hold_char); |
| 1055 | |
| 1056 | /* yy_bp points to the position in yy_ch_buf of the start of |
| 1057 | * the current run. |
| 1058 | */ |
| 1059 | yy_bp = yy_cp; |
| 1060 | |
| 1061 | yy_current_state = (yy_start); |
| 1062 | yy_match: |
| 1063 | do |
| 1064 | { |
| 1065 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)((unsigned int) (unsigned char) *yy_cp)] ; |
| 1066 | if ( yy_accept[yy_current_state] ) |
| 1067 | { |
| 1068 | (yy_last_accepting_state) = yy_current_state; |
| 1069 | (yy_last_accepting_cpos) = yy_cp; |
| 1070 | } |
| 1071 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1072 | { |
| 1073 | yy_current_state = (int) yy_def[yy_current_state]; |
| 1074 | if ( yy_current_state >= 294 ) |
| 1075 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 1076 | } |
| 1077 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
| 1078 | ++yy_cp; |
| 1079 | } |
| 1080 | while ( yy_base[yy_current_state] != 547 ); |
| 1081 | |
| 1082 | yy_find_action: |
| 1083 | yy_act = yy_accept[yy_current_state]; |
| 1084 | if ( yy_act == 0 ) |
| 1085 | { /* have to back up */ |
| 1086 | yy_cp = (yy_last_accepting_cpos); |
| 1087 | yy_current_state = (yy_last_accepting_state); |
| 1088 | yy_act = yy_accept[yy_current_state]; |
| 1089 | } |
| 1090 | |
| 1091 | YY_DO_BEFORE_ACTION(yytext) = yy_bp; yyleng = (size_t) (yy_cp - yy_bp); (yy_hold_char ) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp;; |
| 1092 | |
| 1093 | if ( yy_act != YY_END_OF_BUFFER67 && yy_rule_can_match_eol[yy_act] ) |
| 1094 | { |
| 1095 | yy_size_t yyl; |
| 1096 | for ( yyl = 0; yyl < yyleng; ++yyl ) |
| 1097 | if ( yytext[yyl] == '\n' ) |
| 1098 | |
| 1099 | yylineno++; |
| 1100 | ; |
| 1101 | } |
| 1102 | |
| 1103 | do_action: /* This label is used only to access EOF actions. */ |
| 1104 | |
| 1105 | switch ( yy_act ) |
| 1106 | { /* beginning of action switch */ |
| 1107 | case 0: /* must back up */ |
| 1108 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
| 1109 | *yy_cp = (yy_hold_char); |
| 1110 | yy_cp = (yy_last_accepting_cpos); |
| 1111 | yy_current_state = (yy_last_accepting_state); |
| 1112 | goto yy_find_action; |
| 1113 | |
| 1114 | case 1: |
| 1115 | YY_RULE_SETUP |
| 1116 | #line 134 "/usr/src/usr.bin/fgen/fgen.l" |
| 1117 | { ltoken.type = TOK_OTHER; ltoken.text = yytext; return <oken; } |
| 1118 | YY_BREAKbreak; |
| 1119 | case 2: |
| 1120 | YY_RULE_SETUP |
| 1121 | #line 136 "/usr/src/usr.bin/fgen/fgen.l" |
| 1122 | { ltoken.type = TOK_OTHER; ltoken.text = yytext; return <oken; } |
| 1123 | YY_BREAKbreak; |
| 1124 | case 3: |
| 1125 | YY_RULE_SETUP |
| 1126 | #line 138 "/usr/src/usr.bin/fgen/fgen.l" |
| 1127 | { ltoken.type = TOK_OTHER; ltoken.text = yytext; return <oken; } |
| 1128 | YY_BREAKbreak; |
| 1129 | case 4: |
| 1130 | YY_RULE_SETUP |
| 1131 | #line 140 "/usr/src/usr.bin/fgen/fgen.l" |
| 1132 | { ltoken.type = TOK_OTHER; ltoken.text = yytext; return <oken; } |
| 1133 | YY_BREAKbreak; |
| 1134 | case 5: |
| 1135 | YY_RULE_SETUP |
| 1136 | #line 142 "/usr/src/usr.bin/fgen/fgen.l" |
| 1137 | { ltoken.type = TOK_OTHER; ltoken.text = yytext; return <oken; } |
| 1138 | YY_BREAKbreak; |
| 1139 | case 6: |
| 1140 | YY_RULE_SETUP |
| 1141 | #line 144 "/usr/src/usr.bin/fgen/fgen.l" |
| 1142 | { ltoken.type = TOK_OTHER; ltoken.text = yytext; return <oken; } |
| 1143 | YY_BREAKbreak; |
| 1144 | case 7: |
| 1145 | /* rule 7 can match eol */ |
| 1146 | YY_RULE_SETUP |
| 1147 | #line 146 "/usr/src/usr.bin/fgen/fgen.l" |
| 1148 | /* whitespace -- keep looping */ ; |
| 1149 | YY_BREAKbreak; |
| 1150 | case 8: |
| 1151 | /* rule 8 can match eol */ |
| 1152 | YY_RULE_SETUP |
| 1153 | #line 148 "/usr/src/usr.bin/fgen/fgen.l" |
| 1154 | /* end of line comment -- keep looping */ { STATE(yytext, "EOL comment")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "EOL comment" , yytext); } while (0); } |
| 1155 | YY_BREAKbreak; |
| 1156 | case 9: |
| 1157 | YY_RULE_SETUP |
| 1158 | #line 150 "/usr/src/usr.bin/fgen/fgen.l" |
| 1159 | { ltoken.type = TOK_NUMBER; ltoken.text = yytext; |
| 1160 | return <oken; } |
| 1161 | YY_BREAKbreak; |
| 1162 | case 10: |
| 1163 | YY_RULE_SETUP |
| 1164 | #line 153 "/usr/src/usr.bin/fgen/fgen.l" |
| 1165 | { ltoken.type = TOK_C_LIT; ltoken.text = yytext; return <oken; } |
| 1166 | YY_BREAKbreak; |
| 1167 | case 11: |
| 1168 | /* rule 11 can match eol */ |
| 1169 | YY_RULE_SETUP |
| 1170 | #line 155 "/usr/src/usr.bin/fgen/fgen.l" |
| 1171 | { ltoken.type = TOK_STRING_LIT; ltoken.text = yytext; |
| 1172 | return <oken; } /* String started by `"' or `."' */ |
| 1173 | YY_BREAKbreak; |
| 1174 | case 12: |
| 1175 | /* rule 12 can match eol */ |
| 1176 | YY_RULE_SETUP |
| 1177 | #line 158 "/usr/src/usr.bin/fgen/fgen.l" |
| 1178 | { ltoken.type = TOK_PSTRING; ltoken.text = yytext; |
| 1179 | return <oken; } /* String of type `.(.....)' */ |
| 1180 | YY_BREAKbreak; |
| 1181 | case 13: |
| 1182 | /* rule 13 can match eol */ |
| 1183 | YY_RULE_SETUP |
| 1184 | #line 161 "/usr/src/usr.bin/fgen/fgen.l" |
| 1185 | { ltoken.type = TOK_PSTRING; ltoken.text = yytext; |
| 1186 | return <oken; } |
| 1187 | YY_BREAKbreak; |
| 1188 | case 14: |
| 1189 | /* rule 14 can match eol */ |
| 1190 | YY_RULE_SETUP |
| 1191 | #line 164 "/usr/src/usr.bin/fgen/fgen.l" |
| 1192 | { ltoken.type = TOK_ABORT_S; |
| 1193 | ltoken.text = yytext; return <oken; } |
| 1194 | YY_BREAKbreak; |
| 1195 | case 15: |
| 1196 | YY_RULE_SETUP |
| 1197 | #line 167 "/usr/src/usr.bin/fgen/fgen.l" |
| 1198 | { ltoken.type = TOK_COMMENT; ltoken.text = yytext; |
| 1199 | return <oken; } |
| 1200 | YY_BREAKbreak; |
| 1201 | case 16: |
| 1202 | YY_RULE_SETUP |
| 1203 | #line 170 "/usr/src/usr.bin/fgen/fgen.l" |
| 1204 | { ltoken.type = TOK_COLON; ltoken.text = yytext; |
| 1205 | return <oken; } |
| 1206 | YY_BREAKbreak; |
| 1207 | case 17: |
| 1208 | YY_RULE_SETUP |
| 1209 | #line 173 "/usr/src/usr.bin/fgen/fgen.l" |
| 1210 | { ltoken.type = TOK_SEMICOLON; ltoken.text = yytext; |
| 1211 | return <oken; } |
| 1212 | YY_BREAKbreak; |
| 1213 | case 18: |
| 1214 | YY_RULE_SETUP |
| 1215 | #line 176 "/usr/src/usr.bin/fgen/fgen.l" |
| 1216 | { ltoken.type = TOK_TOKENIZE; ltoken.text = yytext; |
| 1217 | return <oken; } |
| 1218 | YY_BREAKbreak; |
| 1219 | case 19: |
| 1220 | YY_RULE_SETUP |
| 1221 | #line 179 "/usr/src/usr.bin/fgen/fgen.l" |
| 1222 | { ltoken.type = TOK_AGAIN; ltoken.text = yytext; |
| 1223 | return <oken; } |
| 1224 | YY_BREAKbreak; |
| 1225 | case 20: |
| 1226 | YY_RULE_SETUP |
| 1227 | #line 182 "/usr/src/usr.bin/fgen/fgen.l" |
| 1228 | { ltoken.type = TOK_ALIAS; ltoken.text = yytext; |
| 1229 | return <oken; } |
| 1230 | YY_BREAKbreak; |
| 1231 | case 21: |
| 1232 | YY_RULE_SETUP |
| 1233 | #line 185 "/usr/src/usr.bin/fgen/fgen.l" |
| 1234 | { ltoken.type = TOK_GETTOKEN; ltoken.text = yytext; |
| 1235 | return <oken; } |
| 1236 | YY_BREAKbreak; |
| 1237 | case 22: |
| 1238 | YY_RULE_SETUP |
| 1239 | #line 188 "/usr/src/usr.bin/fgen/fgen.l" |
| 1240 | { ltoken.type = TOK_ASCII; ltoken.text = yytext; |
| 1241 | return <oken; } |
| 1242 | YY_BREAKbreak; |
| 1243 | case 23: |
| 1244 | YY_RULE_SETUP |
| 1245 | #line 191 "/usr/src/usr.bin/fgen/fgen.l" |
| 1246 | { ltoken.type = TOK_BEGIN; ltoken.text = yytext; |
| 1247 | return <oken; } |
| 1248 | YY_BREAKbreak; |
| 1249 | case 24: |
| 1250 | YY_RULE_SETUP |
| 1251 | #line 194 "/usr/src/usr.bin/fgen/fgen.l" |
| 1252 | { ltoken.type = TOK_BUFFER; ltoken.text = yytext; |
| 1253 | return <oken; } |
| 1254 | YY_BREAKbreak; |
| 1255 | case 25: |
| 1256 | YY_RULE_SETUP |
| 1257 | #line 197 "/usr/src/usr.bin/fgen/fgen.l" |
| 1258 | { ltoken.type = TOK_CASE; ltoken.text = yytext; |
| 1259 | return <oken; } |
| 1260 | YY_BREAKbreak; |
| 1261 | case 26: |
| 1262 | YY_RULE_SETUP |
| 1263 | #line 200 "/usr/src/usr.bin/fgen/fgen.l" |
| 1264 | { ltoken.type = TOK_CONSTANT; ltoken.text = yytext; |
| 1265 | return <oken; } |
| 1266 | YY_BREAKbreak; |
| 1267 | case 27: |
| 1268 | YY_RULE_SETUP |
| 1269 | #line 203 "/usr/src/usr.bin/fgen/fgen.l" |
| 1270 | { ltoken.type = TOK_CONTROL; ltoken.text = yytext; |
| 1271 | return <oken; } |
| 1272 | YY_BREAKbreak; |
| 1273 | case 28: |
| 1274 | YY_RULE_SETUP |
| 1275 | #line 206 "/usr/src/usr.bin/fgen/fgen.l" |
| 1276 | { ltoken.type = TOK_CREATE; ltoken.text = yytext; |
| 1277 | return <oken; } |
| 1278 | YY_BREAKbreak; |
| 1279 | case 29: |
| 1280 | YY_RULE_SETUP |
| 1281 | #line 209 "/usr/src/usr.bin/fgen/fgen.l" |
| 1282 | { ltoken.type = TOK_DECIMAL; ltoken.text = yytext; |
| 1283 | return <oken; } |
| 1284 | YY_BREAKbreak; |
| 1285 | case 30: |
| 1286 | YY_RULE_SETUP |
| 1287 | #line 212 "/usr/src/usr.bin/fgen/fgen.l" |
| 1288 | { ltoken.type = TOK_DECIMAL; ltoken.text = yytext; |
| 1289 | return <oken; } |
| 1290 | YY_BREAKbreak; |
| 1291 | case 31: |
| 1292 | YY_RULE_SETUP |
| 1293 | #line 215 "/usr/src/usr.bin/fgen/fgen.l" |
| 1294 | { ltoken.type = TOK_DEFER; ltoken.text = yytext; |
| 1295 | return <oken; } |
| 1296 | YY_BREAKbreak; |
| 1297 | case 32: |
| 1298 | YY_RULE_SETUP |
| 1299 | #line 218 "/usr/src/usr.bin/fgen/fgen.l" |
| 1300 | { ltoken.type = TOK_DO; ltoken.text = yytext; |
| 1301 | return <oken; } |
| 1302 | YY_BREAKbreak; |
| 1303 | case 33: |
| 1304 | YY_RULE_SETUP |
| 1305 | #line 221 "/usr/src/usr.bin/fgen/fgen.l" |
| 1306 | { ltoken.type = TOK_ELSE; ltoken.text = yytext; |
| 1307 | return <oken; } |
| 1308 | YY_BREAKbreak; |
| 1309 | case 34: |
| 1310 | YY_RULE_SETUP |
| 1311 | #line 224 "/usr/src/usr.bin/fgen/fgen.l" |
| 1312 | { ltoken.type = TOK_END0; ltoken.text = yytext; |
| 1313 | return <oken; } |
| 1314 | YY_BREAKbreak; |
| 1315 | case 35: |
| 1316 | YY_RULE_SETUP |
| 1317 | #line 227 "/usr/src/usr.bin/fgen/fgen.l" |
| 1318 | { ltoken.type = TOK_ENDCASE; ltoken.text = yytext; |
| 1319 | return <oken; } |
| 1320 | YY_BREAKbreak; |
| 1321 | case 36: |
| 1322 | YY_RULE_SETUP |
| 1323 | #line 230 "/usr/src/usr.bin/fgen/fgen.l" |
| 1324 | { ltoken.type = TOK_ENDOF; ltoken.text = yytext; |
| 1325 | return <oken; } |
| 1326 | YY_BREAKbreak; |
| 1327 | case 37: |
| 1328 | YY_RULE_SETUP |
| 1329 | #line 233 "/usr/src/usr.bin/fgen/fgen.l" |
| 1330 | { ltoken.type = TOK_EXTERNAL; ltoken.text = yytext; |
| 1331 | return <oken; } |
| 1332 | YY_BREAKbreak; |
| 1333 | case 38: |
| 1334 | YY_RULE_SETUP |
| 1335 | #line 236 "/usr/src/usr.bin/fgen/fgen.l" |
| 1336 | { |
| 1337 | ltoken.type = TOK_FCODE_VERSION2; ltoken.text = yytext; |
| 1338 | return <oken; } |
| 1339 | YY_BREAKbreak; |
| 1340 | case 39: |
| 1341 | YY_RULE_SETUP |
| 1342 | #line 240 "/usr/src/usr.bin/fgen/fgen.l" |
| 1343 | { ltoken.type = TOK_FCODE_END; ltoken.text = yytext; |
| 1344 | return <oken; } |
| 1345 | YY_BREAKbreak; |
| 1346 | case 40: |
| 1347 | YY_RULE_SETUP |
| 1348 | #line 243 "/usr/src/usr.bin/fgen/fgen.l" |
| 1349 | { ltoken.type = TOK_FIELD; ltoken.text = yytext; |
| 1350 | return <oken; } |
| 1351 | YY_BREAKbreak; |
| 1352 | case 41: |
| 1353 | YY_RULE_SETUP |
| 1354 | #line 246 "/usr/src/usr.bin/fgen/fgen.l" |
| 1355 | { ltoken.type = TOK_HEX; ltoken.text = yytext; |
| 1356 | return <oken; } |
| 1357 | YY_BREAKbreak; |
| 1358 | case 42: |
| 1359 | YY_RULE_SETUP |
| 1360 | #line 249 "/usr/src/usr.bin/fgen/fgen.l" |
| 1361 | { ltoken.type = TOK_HEADERLESS; ltoken.text = yytext; |
| 1362 | return <oken; } |
| 1363 | YY_BREAKbreak; |
| 1364 | case 43: |
| 1365 | YY_RULE_SETUP |
| 1366 | #line 252 "/usr/src/usr.bin/fgen/fgen.l" |
| 1367 | { ltoken.type = TOK_HEADERS; ltoken.text = yytext; |
| 1368 | return <oken; } |
| 1369 | YY_BREAKbreak; |
| 1370 | case 44: |
| 1371 | YY_RULE_SETUP |
| 1372 | #line 255 "/usr/src/usr.bin/fgen/fgen.l" |
| 1373 | { ltoken.type = TOK_HEX; ltoken.text = yytext; |
| 1374 | return <oken; } |
| 1375 | YY_BREAKbreak; |
| 1376 | case 45: |
| 1377 | YY_RULE_SETUP |
| 1378 | #line 258 "/usr/src/usr.bin/fgen/fgen.l" |
| 1379 | { ltoken.type = TOK_IF; ltoken.text = yytext; |
| 1380 | return <oken; } |
| 1381 | YY_BREAKbreak; |
| 1382 | case 46: |
| 1383 | YY_RULE_SETUP |
| 1384 | #line 261 "/usr/src/usr.bin/fgen/fgen.l" |
| 1385 | { ltoken.type = TOK_LEAVE; ltoken.text = yytext; |
| 1386 | return <oken; } |
| 1387 | YY_BREAKbreak; |
| 1388 | case 47: |
| 1389 | YY_RULE_SETUP |
| 1390 | #line 264 "/usr/src/usr.bin/fgen/fgen.l" |
| 1391 | { ltoken.type = TOK_LOOP; ltoken.text = yytext; |
| 1392 | return <oken; } |
| 1393 | YY_BREAKbreak; |
| 1394 | case 48: |
| 1395 | YY_RULE_SETUP |
| 1396 | #line 267 "/usr/src/usr.bin/fgen/fgen.l" |
| 1397 | { ltoken.type = TOK_OCTAL; ltoken.text = yytext; |
| 1398 | return <oken; } |
| 1399 | YY_BREAKbreak; |
| 1400 | case 49: |
| 1401 | YY_RULE_SETUP |
| 1402 | #line 270 "/usr/src/usr.bin/fgen/fgen.l" |
| 1403 | { ltoken.type = TOK_OCTAL; ltoken.text = yytext; |
| 1404 | return <oken; } |
| 1405 | YY_BREAKbreak; |
| 1406 | case 50: |
| 1407 | YY_RULE_SETUP |
| 1408 | #line 273 "/usr/src/usr.bin/fgen/fgen.l" |
| 1409 | { ltoken.type = TOK_OF; ltoken.text = yytext; |
| 1410 | return <oken; } |
| 1411 | YY_BREAKbreak; |
| 1412 | case 51: |
| 1413 | YY_RULE_SETUP |
| 1414 | #line 276 "/usr/src/usr.bin/fgen/fgen.l" |
| 1415 | { ltoken.type = TOK_OFFSET16; ltoken.text = yytext; |
| 1416 | return <oken; } |
| 1417 | YY_BREAKbreak; |
| 1418 | case 52: |
| 1419 | YY_RULE_SETUP |
| 1420 | #line 279 "/usr/src/usr.bin/fgen/fgen.l" |
| 1421 | { ltoken.type = TOK_REPEAT; ltoken.text = yytext; |
| 1422 | return <oken; } |
| 1423 | YY_BREAKbreak; |
| 1424 | case 53: |
| 1425 | YY_RULE_SETUP |
| 1426 | #line 282 "/usr/src/usr.bin/fgen/fgen.l" |
| 1427 | { ltoken.type = TOK_STARTX; ltoken.text = yytext; |
| 1428 | return <oken; } |
| 1429 | YY_BREAKbreak; |
| 1430 | case 54: |
| 1431 | YY_RULE_SETUP |
| 1432 | #line 285 "/usr/src/usr.bin/fgen/fgen.l" |
| 1433 | { ltoken.type = TOK_THEN; ltoken.text = yytext; |
| 1434 | return <oken; } |
| 1435 | YY_BREAKbreak; |
| 1436 | case 55: |
| 1437 | YY_RULE_SETUP |
| 1438 | #line 288 "/usr/src/usr.bin/fgen/fgen.l" |
| 1439 | { ltoken.type = TOK_TO; ltoken.text = yytext; |
| 1440 | return <oken; } |
| 1441 | YY_BREAKbreak; |
| 1442 | case 56: |
| 1443 | YY_RULE_SETUP |
| 1444 | #line 291 "/usr/src/usr.bin/fgen/fgen.l" |
| 1445 | { ltoken.type = TOK_UNTIL; ltoken.text = yytext; |
| 1446 | return <oken; } |
| 1447 | YY_BREAKbreak; |
| 1448 | case 57: |
| 1449 | YY_RULE_SETUP |
| 1450 | #line 294 "/usr/src/usr.bin/fgen/fgen.l" |
| 1451 | { ltoken.type = TOK_VALUE; ltoken.text = yytext; |
| 1452 | return <oken; } |
| 1453 | YY_BREAKbreak; |
| 1454 | case 58: |
| 1455 | YY_RULE_SETUP |
| 1456 | #line 297 "/usr/src/usr.bin/fgen/fgen.l" |
| 1457 | { ltoken.type = TOK_VARIABLE; ltoken.text = yytext; |
| 1458 | return <oken; } |
| 1459 | YY_BREAKbreak; |
| 1460 | case 59: |
| 1461 | YY_RULE_SETUP |
| 1462 | #line 300 "/usr/src/usr.bin/fgen/fgen.l" |
| 1463 | { ltoken.type = TOK_VERSION1; ltoken.text = yytext; |
| 1464 | return <oken; } |
| 1465 | YY_BREAKbreak; |
| 1466 | case 60: |
| 1467 | YY_RULE_SETUP |
| 1468 | #line 303 "/usr/src/usr.bin/fgen/fgen.l" |
| 1469 | { ltoken.type = TOK_WHILE; ltoken.text = yytext; |
| 1470 | return <oken; } |
| 1471 | YY_BREAKbreak; |
| 1472 | case 61: |
| 1473 | YY_RULE_SETUP |
| 1474 | #line 306 "/usr/src/usr.bin/fgen/fgen.l" |
| 1475 | { ltoken.type = TOK_BEGTOK; ltoken.text = yytext; |
| 1476 | return <oken; } |
| 1477 | YY_BREAKbreak; |
| 1478 | case 62: |
| 1479 | YY_RULE_SETUP |
| 1480 | #line 309 "/usr/src/usr.bin/fgen/fgen.l" |
| 1481 | { ltoken.type = TOK_EMIT_BYTE; ltoken.text = yytext; |
| 1482 | return <oken; } |
| 1483 | YY_BREAKbreak; |
| 1484 | case 63: |
| 1485 | YY_RULE_SETUP |
| 1486 | #line 312 "/usr/src/usr.bin/fgen/fgen.l" |
| 1487 | { ltoken.type = TOK_ENDTOK; ltoken.text = yytext; |
| 1488 | return <oken; } |
| 1489 | YY_BREAKbreak; |
| 1490 | case 64: |
| 1491 | YY_RULE_SETUP |
| 1492 | #line 315 "/usr/src/usr.bin/fgen/fgen.l" |
| 1493 | { ltoken.type = TOK_FLOAD; ltoken.text = yytext; |
| 1494 | return <oken; } |
| 1495 | YY_BREAKbreak; |
| 1496 | case 65: |
| 1497 | YY_RULE_SETUP |
| 1498 | #line 319 "/usr/src/usr.bin/fgen/fgen.l" |
| 1499 | { ltoken.type = TOK_OTHER; ltoken.text = yytext; |
| 1500 | return <oken; } |
| 1501 | YY_BREAKbreak; |
| 1502 | case YY_STATE_EOF(INITIAL)(67 + 0 + 1): |
| 1503 | #line 322 "/usr/src/usr.bin/fgen/fgen.l" |
| 1504 | { return NULL((void *)0); } |
| 1505 | YY_BREAKbreak; |
| 1506 | case 66: |
| 1507 | YY_RULE_SETUP |
| 1508 | #line 323 "/usr/src/usr.bin/fgen/fgen.l" |
| 1509 | ECHOdo { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0); |
| 1510 | YY_BREAKbreak; |
| 1511 | #line 1512 "fgen.c" |
| 1512 | |
| 1513 | case YY_END_OF_BUFFER67: |
| 1514 | { |
| 1515 | /* Amount of text matched not including the EOB char. */ |
| 1516 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptryytext)) - 1; |
| 1517 | |
| 1518 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
| 1519 | *yy_cp = (yy_hold_char); |
| 1520 | YY_RESTORE_YY_MORE_OFFSET |
| 1521 | |
| 1522 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status == YY_BUFFER_NEW0 ) |
| 1523 | { |
| 1524 | /* We're scanning a new file or input source. It's |
| 1525 | * possible that this happened because the user |
| 1526 | * just pointed yyin at a new source and called |
| 1527 | * yylex(). If so, then we have to assure |
| 1528 | * consistency between YY_CURRENT_BUFFER and our |
| 1529 | * globals. Here is the right place to do so, because |
| 1530 | * this is the first action (other than possibly a |
| 1531 | * back-up) that will match for the new input source. |
| 1532 | */ |
| 1533 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars; |
| 1534 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_input_file = yyin; |
| 1535 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status = YY_BUFFER_NORMAL1; |
| 1536 | } |
| 1537 | |
| 1538 | /* Note that here we test for yy_c_buf_p "<=" to the position |
| 1539 | * of the first EOB in the buffer, since yy_c_buf_p will |
| 1540 | * already have been incremented past the NUL character |
| 1541 | * (since all states make transitions on EOB to the |
| 1542 | * end-of-buffer state). Contrast this with the test |
| 1543 | * in input(). |
| 1544 | */ |
| 1545 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] ) |
| 1546 | { /* This was really a NUL. */ |
| 1547 | yy_state_type yy_next_state; |
| 1548 | |
| 1549 | (yy_c_buf_p) = (yytext_ptryytext) + yy_amount_of_matched_text; |
| 1550 | |
| 1551 | yy_current_state = yy_get_previous_state( ); |
| 1552 | |
| 1553 | /* Okay, we're now positioned to make the NUL |
| 1554 | * transition. We couldn't have |
| 1555 | * yy_get_previous_state() go ahead and do it |
| 1556 | * for us because it doesn't know how to deal |
| 1557 | * with the possibility of jamming (and we don't |
| 1558 | * want to build jamming into it because then it |
| 1559 | * will run more slowly). |
| 1560 | */ |
| 1561 | |
| 1562 | yy_next_state = yy_try_NUL_trans( yy_current_state ); |
| 1563 | |
| 1564 | yy_bp = (yytext_ptryytext) + YY_MORE_ADJ0; |
| 1565 | |
| 1566 | if ( yy_next_state ) |
| 1567 | { |
| 1568 | /* Consume the NUL. */ |
| 1569 | yy_cp = ++(yy_c_buf_p); |
| 1570 | yy_current_state = yy_next_state; |
| 1571 | goto yy_match; |
| 1572 | } |
| 1573 | |
| 1574 | else |
| 1575 | { |
| 1576 | yy_cp = (yy_c_buf_p); |
| 1577 | goto yy_find_action; |
| 1578 | } |
| 1579 | } |
| 1580 | |
| 1581 | else switch ( yy_get_next_buffer( ) ) |
| 1582 | { |
| 1583 | case EOB_ACT_END_OF_FILE1: |
| 1584 | { |
| 1585 | (yy_did_buffer_switch_on_eof) = 0; |
| 1586 | |
| 1587 | if ( yywrap( ) ) |
| 1588 | { |
| 1589 | /* Note: because we've taken care in |
| 1590 | * yy_get_next_buffer() to have set up |
| 1591 | * yytext, we can now set up |
| 1592 | * yy_c_buf_p so that if some total |
| 1593 | * hoser (like flex itself) wants to |
| 1594 | * call the scanner after we return the |
| 1595 | * YY_NULL, it'll still work - another |
| 1596 | * YY_NULL will get returned. |
| 1597 | */ |
| 1598 | (yy_c_buf_p) = (yytext_ptryytext) + YY_MORE_ADJ0; |
| 1599 | |
| 1600 | yy_act = YY_STATE_EOF(YY_START)(67 + (((yy_start) - 1) / 2) + 1); |
| 1601 | goto do_action; |
| 1602 | } |
| 1603 | |
| 1604 | else |
| 1605 | { |
| 1606 | if ( ! (yy_did_buffer_switch_on_eof) ) |
| 1607 | YY_NEW_FILEyyrestart(yyin ); |
| 1608 | } |
| 1609 | break; |
| 1610 | } |
| 1611 | |
| 1612 | case EOB_ACT_CONTINUE_SCAN0: |
| 1613 | (yy_c_buf_p) = |
| 1614 | (yytext_ptryytext) + yy_amount_of_matched_text; |
| 1615 | |
| 1616 | yy_current_state = yy_get_previous_state( ); |
| 1617 | |
| 1618 | yy_cp = (yy_c_buf_p); |
| 1619 | yy_bp = (yytext_ptryytext) + YY_MORE_ADJ0; |
| 1620 | goto yy_match; |
| 1621 | |
| 1622 | case EOB_ACT_LAST_MATCH2: |
| 1623 | (yy_c_buf_p) = |
| 1624 | &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)]; |
| 1625 | |
| 1626 | yy_current_state = yy_get_previous_state( ); |
| 1627 | |
| 1628 | yy_cp = (yy_c_buf_p); |
| 1629 | yy_bp = (yytext_ptryytext) + YY_MORE_ADJ0; |
| 1630 | goto yy_find_action; |
| 1631 | } |
| 1632 | break; |
| 1633 | } |
| 1634 | |
| 1635 | default: |
| 1636 | YY_FATAL_ERROR(yy_fatal_error( "fatal flex scanner internal error--no action found" ) |
| 1637 | "fatal flex scanner internal error--no action found" )yy_fatal_error( "fatal flex scanner internal error--no action found" ); |
| 1638 | } /* end of action switch */ |
| 1639 | } /* end of scanning one token */ |
| 1640 | } /* end of user's declarations */ |
| 1641 | } /* end of yylex */ |
| 1642 | |
| 1643 | /* yy_get_next_buffer - try to read in a new buffer |
| 1644 | * |
| 1645 | * Returns a code representing an action: |
| 1646 | * EOB_ACT_LAST_MATCH - |
| 1647 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
| 1648 | * EOB_ACT_END_OF_FILE - end of file |
| 1649 | */ |
| 1650 | static int yy_get_next_buffer (void) |
| 1651 | { |
| 1652 | char *dest = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf; |
| 1653 | char *source = (yytext_ptryytext); |
| 1654 | int number_to_move, i; |
| 1655 | int ret_val; |
| 1656 | |
| 1657 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1] ) |
| 1658 | YY_FATAL_ERROR(yy_fatal_error( "fatal flex scanner internal error--end of buffer missed" ) |
| 1659 | "fatal flex scanner internal error--end of buffer missed" )yy_fatal_error( "fatal flex scanner internal error--end of buffer missed" ); |
| 1660 | |
| 1661 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_fill_buffer == 0 ) |
| 1662 | { /* Don't try to fill the buffer, so this is an EOF. */ |
| 1663 | if ( (yy_c_buf_p) - (yytext_ptryytext) - YY_MORE_ADJ0 == 1 ) |
| 1664 | { |
| 1665 | /* We matched a single character, the EOB, so |
| 1666 | * treat this as a final EOF. |
| 1667 | */ |
| 1668 | return EOB_ACT_END_OF_FILE1; |
| 1669 | } |
| 1670 | |
| 1671 | else |
| 1672 | { |
| 1673 | /* We matched some text prior to the EOB, first |
| 1674 | * process it. |
| 1675 | */ |
| 1676 | return EOB_ACT_LAST_MATCH2; |
| 1677 | } |
| 1678 | } |
| 1679 | |
| 1680 | /* Try to read more data. */ |
| 1681 | |
| 1682 | /* First move last chars to start of buffer. */ |
| 1683 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptryytext)) - 1; |
| 1684 | |
| 1685 | for ( i = 0; i < number_to_move; ++i ) |
| 1686 | *(dest++) = *(source++); |
| 1687 | |
| 1688 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status == YY_BUFFER_EOF_PENDING2 ) |
| 1689 | /* don't do the read, it's not guaranteed to return an EOF, |
| 1690 | * just force an EOF |
| 1691 | */ |
| 1692 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars) = 0; |
| 1693 | |
| 1694 | else |
| 1695 | { |
| 1696 | yy_size_t num_to_read = |
| 1697 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size - number_to_move - 1; |
| 1698 | |
| 1699 | while ( num_to_read <= 0 ) |
| 1700 | { /* Not enough room in the buffer - grow it. */ |
| 1701 | |
| 1702 | /* just a shorter name for the current buffer */ |
| 1703 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]; |
| 1704 | |
| 1705 | int yy_c_buf_p_offset = |
| 1706 | (int) ((yy_c_buf_p) - b->yy_ch_buf); |
| 1707 | |
| 1708 | if ( b->yy_is_our_buffer ) |
| 1709 | { |
| 1710 | yy_size_t new_size = b->yy_buf_size * 2; |
| 1711 | |
| 1712 | if ( new_size <= 0 ) |
| 1713 | b->yy_buf_size += b->yy_buf_size / 8; |
| 1714 | else |
| 1715 | b->yy_buf_size *= 2; |
| 1716 | |
| 1717 | b->yy_ch_buf = (char *) |
| 1718 | /* Include room in for 2 EOB chars. */ |
| 1719 | yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); |
| 1720 | } |
| 1721 | else |
| 1722 | /* Can't grow it, we don't own it. */ |
| 1723 | b->yy_ch_buf = 0; |
| 1724 | |
| 1725 | if ( ! b->yy_ch_buf ) |
| 1726 | YY_FATAL_ERROR(yy_fatal_error( "fatal error - scanner input buffer overflow" ) |
| 1727 | "fatal error - scanner input buffer overflow" )yy_fatal_error( "fatal error - scanner input buffer overflow" ); |
| 1728 | |
| 1729 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; |
| 1730 | |
| 1731 | num_to_read = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size - |
| 1732 | number_to_move - 1; |
| 1733 | |
| 1734 | } |
| 1735 | |
| 1736 | if ( num_to_read > YY_READ_BUF_SIZE8192 ) |
| 1737 | num_to_read = YY_READ_BUF_SIZE8192; |
| 1738 | |
| 1739 | /* Read in more data. */ |
| 1740 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),if ( (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) { int c = '*'; size_t n; for ( n = 0; n < num_to_read && (c = (!__isthreaded ? (--(yyin)->_r < 0 ? __srget(yyin ) : (int)(*(yyin)->_p++)) : (getc)(yyin))) != (-1) && c != '\n'; ++n ) (&(yy_buffer_stack)[(yy_buffer_stack_top )]->yy_ch_buf[number_to_move])[n] = (char) c; if ( c == '\n' ) (&(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf [number_to_move])[n++] = (char) c; if ( c == (-1) && ( !__isthreaded ? (((yyin)->_flags & 0x0040) != 0) : (ferror )(yyin)) ) yy_fatal_error( "input in flex scanner failed" ); ( yy_n_chars) = n; } else { (*__errno())=0; while ( ((yy_n_chars ) = fread((&(yy_buffer_stack)[(yy_buffer_stack_top)]-> yy_ch_buf[number_to_move]), 1, num_to_read, yyin))==0 && (!__isthreaded ? (((yyin)->_flags & 0x0040) != 0) : ( ferror)(yyin))) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed" ); break; } (*__errno())=0; (!__isthreaded ? ((void)((yyin)-> _flags &= ~(0x0040|0x0020))) : (clearerr)(yyin)); } } |
| 1741 | (yy_n_chars), num_to_read )if ( (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) { int c = '*'; size_t n; for ( n = 0; n < num_to_read && (c = (!__isthreaded ? (--(yyin)->_r < 0 ? __srget(yyin ) : (int)(*(yyin)->_p++)) : (getc)(yyin))) != (-1) && c != '\n'; ++n ) (&(yy_buffer_stack)[(yy_buffer_stack_top )]->yy_ch_buf[number_to_move])[n] = (char) c; if ( c == '\n' ) (&(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf [number_to_move])[n++] = (char) c; if ( c == (-1) && ( !__isthreaded ? (((yyin)->_flags & 0x0040) != 0) : (ferror )(yyin)) ) yy_fatal_error( "input in flex scanner failed" ); ( yy_n_chars) = n; } else { (*__errno())=0; while ( ((yy_n_chars ) = fread((&(yy_buffer_stack)[(yy_buffer_stack_top)]-> yy_ch_buf[number_to_move]), 1, num_to_read, yyin))==0 && (!__isthreaded ? (((yyin)->_flags & 0x0040) != 0) : ( ferror)(yyin))) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed" ); break; } (*__errno())=0; (!__isthreaded ? ((void)((yyin)-> _flags &= ~(0x0040|0x0020))) : (clearerr)(yyin)); } }; |
| 1742 | |
| 1743 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars); |
| 1744 | } |
| 1745 | |
| 1746 | if ( (yy_n_chars) == 0 ) |
| 1747 | { |
| 1748 | if ( number_to_move == YY_MORE_ADJ0 ) |
| 1749 | { |
| 1750 | ret_val = EOB_ACT_END_OF_FILE1; |
| 1751 | yyrestart(yyin ); |
| 1752 | } |
| 1753 | |
| 1754 | else |
| 1755 | { |
| 1756 | ret_val = EOB_ACT_LAST_MATCH2; |
| 1757 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status = |
| 1758 | YY_BUFFER_EOF_PENDING2; |
| 1759 | } |
| 1760 | } |
| 1761 | |
| 1762 | else |
| 1763 | ret_val = EOB_ACT_CONTINUE_SCAN0; |
| 1764 | |
| 1765 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size) { |
| 1766 | /* Extend the array by 50%, plus the number we really need. */ |
| 1767 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); |
| 1768 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf,new_size ); |
| 1769 | if ( ! YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf ) |
| 1770 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" )yy_fatal_error( "out of dynamic memory in yy_get_next_buffer()" ); |
| 1771 | /* "- 2" to take care of EOB's */ |
| 1772 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size = (int) (new_size - 2); |
| 1773 | } |
| 1774 | |
| 1775 | (yy_n_chars) += number_to_move; |
| 1776 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR0; |
| 1777 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR0; |
| 1778 | |
| 1779 | (yytext_ptryytext) = &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[0]; |
| 1780 | |
| 1781 | return ret_val; |
| 1782 | } |
| 1783 | |
| 1784 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
| 1785 | |
| 1786 | static yy_state_type yy_get_previous_state (void) |
| 1787 | { |
| 1788 | yy_state_type yy_current_state; |
| 1789 | char *yy_cp; |
| 1790 | |
| 1791 | yy_current_state = (yy_start); |
| 1792 | |
| 1793 | for ( yy_cp = (yytext_ptryytext) + YY_MORE_ADJ0; yy_cp < (yy_c_buf_p); ++yy_cp ) |
| 1794 | { |
| 1795 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)((unsigned int) (unsigned char) *yy_cp)] : 1); |
| 1796 | if ( yy_accept[yy_current_state] ) |
| 1797 | { |
| 1798 | (yy_last_accepting_state) = yy_current_state; |
| 1799 | (yy_last_accepting_cpos) = yy_cp; |
| 1800 | } |
| 1801 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1802 | { |
| 1803 | yy_current_state = (int) yy_def[yy_current_state]; |
| 1804 | if ( yy_current_state >= 294 ) |
| 1805 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 1806 | } |
| 1807 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
| 1808 | } |
| 1809 | |
| 1810 | return yy_current_state; |
| 1811 | } |
| 1812 | |
| 1813 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
| 1814 | * |
| 1815 | * synopsis |
| 1816 | * next_state = yy_try_NUL_trans( current_state ); |
| 1817 | */ |
| 1818 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) |
| 1819 | { |
| 1820 | int yy_is_jam; |
| 1821 | char *yy_cp = (yy_c_buf_p); |
| 1822 | |
| 1823 | YY_CHAR yy_c = 1; |
| 1824 | if ( yy_accept[yy_current_state] ) |
| 1825 | { |
| 1826 | (yy_last_accepting_state) = yy_current_state; |
| 1827 | (yy_last_accepting_cpos) = yy_cp; |
| 1828 | } |
| 1829 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1830 | { |
| 1831 | yy_current_state = (int) yy_def[yy_current_state]; |
| 1832 | if ( yy_current_state >= 294 ) |
| 1833 | yy_c = yy_meta[(unsigned int) yy_c]; |
| 1834 | } |
| 1835 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
| 1836 | yy_is_jam = (yy_current_state == 293); |
| 1837 | |
| 1838 | return yy_is_jam ? 0 : yy_current_state; |
| 1839 | } |
| 1840 | |
| 1841 | #ifndef YY_NO_INPUT |
| 1842 | #ifdef __cplusplus |
| 1843 | static int yyinput (void) |
| 1844 | #else |
| 1845 | static int input (void) |
| 1846 | #endif |
| 1847 | |
| 1848 | { |
| 1849 | int c; |
| 1850 | |
| 1851 | *(yy_c_buf_p) = (yy_hold_char); |
| 1852 | |
| 1853 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR0 ) |
| 1854 | { |
| 1855 | /* yy_c_buf_p now points to the character we want to return. |
| 1856 | * If this occurs *before* the EOB characters, then it's a |
| 1857 | * valid NUL; if not, then we've hit the end of the buffer. |
| 1858 | */ |
| 1859 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] ) |
| 1860 | /* This was really a NUL. */ |
| 1861 | *(yy_c_buf_p) = '\0'; |
| 1862 | |
| 1863 | else |
| 1864 | { /* need more input */ |
| 1865 | yy_size_t offset = (yy_c_buf_p) - (yytext_ptryytext); |
| 1866 | ++(yy_c_buf_p); |
| 1867 | |
| 1868 | switch ( yy_get_next_buffer( ) ) |
| 1869 | { |
| 1870 | case EOB_ACT_LAST_MATCH2: |
| 1871 | /* This happens because yy_g_n_b() |
| 1872 | * sees that we've accumulated a |
| 1873 | * token and flags that we need to |
| 1874 | * try matching the token before |
| 1875 | * proceeding. But for input(), |
| 1876 | * there's no matching to consider. |
| 1877 | * So convert the EOB_ACT_LAST_MATCH |
| 1878 | * to EOB_ACT_END_OF_FILE. |
| 1879 | */ |
| 1880 | |
| 1881 | /* Reset buffer status. */ |
| 1882 | yyrestart(yyin ); |
| 1883 | |
| 1884 | /*FALLTHROUGH*/ |
| 1885 | |
| 1886 | case EOB_ACT_END_OF_FILE1: |
| 1887 | { |
| 1888 | if ( yywrap( ) ) |
| 1889 | return EOF(-1); |
| 1890 | |
| 1891 | if ( ! (yy_did_buffer_switch_on_eof) ) |
| 1892 | YY_NEW_FILEyyrestart(yyin ); |
| 1893 | #ifdef __cplusplus |
| 1894 | return yyinput(); |
| 1895 | #else |
| 1896 | return input(); |
| 1897 | #endif |
| 1898 | } |
| 1899 | |
| 1900 | case EOB_ACT_CONTINUE_SCAN0: |
| 1901 | (yy_c_buf_p) = (yytext_ptryytext) + offset; |
| 1902 | break; |
| 1903 | } |
| 1904 | } |
| 1905 | } |
| 1906 | |
| 1907 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ |
| 1908 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ |
| 1909 | (yy_hold_char) = *++(yy_c_buf_p); |
| 1910 | |
| 1911 | if ( c == '\n' ) |
| 1912 | |
| 1913 | yylineno++; |
| 1914 | ; |
| 1915 | |
| 1916 | return c; |
| 1917 | } |
| 1918 | #endif /* ifndef YY_NO_INPUT */ |
| 1919 | |
| 1920 | /** Immediately switch to a different input stream. |
| 1921 | * @param input_file A readable stream. |
| 1922 | * |
| 1923 | * @note This function does not reset the start condition to @c INITIAL . |
| 1924 | */ |
| 1925 | void yyrestart (FILE * input_file ) |
| 1926 | { |
| 1927 | |
| 1928 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ){ |
| 1929 | yyensure_buffer_stack (); |
| 1930 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = |
| 1931 | yy_create_buffer(yyin,YY_BUF_SIZE16384 ); |
| 1932 | } |
| 1933 | |
| 1934 | yy_init_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)),input_file ); |
| 1935 | yy_load_buffer_state( ); |
| 1936 | } |
| 1937 | |
| 1938 | /** Switch to a different input buffer. |
| 1939 | * @param new_buffer The new input buffer. |
| 1940 | * |
| 1941 | */ |
| 1942 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) |
| 1943 | { |
| 1944 | |
| 1945 | /* TODO. We should be able to replace this entire function body |
| 1946 | * with |
| 1947 | * yypop_buffer_state(); |
| 1948 | * yypush_buffer_state(new_buffer); |
| 1949 | */ |
| 1950 | yyensure_buffer_stack (); |
| 1951 | if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) == new_buffer ) |
| 1952 | return; |
| 1953 | |
| 1954 | if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) |
| 1955 | { |
| 1956 | /* Flush out information for old buffer. */ |
| 1957 | *(yy_c_buf_p) = (yy_hold_char); |
| 1958 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p); |
| 1959 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars); |
| 1960 | } |
| 1961 | |
| 1962 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer; |
| 1963 | yy_load_buffer_state( ); |
| 1964 | |
| 1965 | /* We don't actually know whether we did this switch during |
| 1966 | * EOF (yywrap()) processing, but the only time this flag |
| 1967 | * is looked at is after yywrap() is called, so it's safe |
| 1968 | * to go ahead and always set it. |
| 1969 | */ |
| 1970 | (yy_did_buffer_switch_on_eof) = 1; |
| 1971 | } |
| 1972 | |
| 1973 | static void yy_load_buffer_state (void) |
| 1974 | { |
| 1975 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars; |
| 1976 | (yytext_ptryytext) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos; |
| 1977 | yyin = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_input_file; |
| 1978 | (yy_hold_char) = *(yy_c_buf_p); |
| 1979 | } |
| 1980 | |
| 1981 | /** Allocate and initialize an input buffer state. |
| 1982 | * @param file A readable stream. |
| 1983 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
| 1984 | * |
| 1985 | * @return the allocated buffer state. |
| 1986 | */ |
| 1987 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) |
| 1988 | { |
| 1989 | YY_BUFFER_STATE b; |
| 1990 | |
| 1991 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); |
| 1992 | if ( ! b ) |
| 1993 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" )yy_fatal_error( "out of dynamic memory in yy_create_buffer()" ); |
| 1994 | |
| 1995 | b->yy_buf_size = size; |
| 1996 | |
| 1997 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 1998 | * we need to put in 2 end-of-buffer characters. |
| 1999 | */ |
| 2000 | b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); |
| 2001 | if ( ! b->yy_ch_buf ) |
| 2002 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" )yy_fatal_error( "out of dynamic memory in yy_create_buffer()" ); |
| 2003 | |
| 2004 | b->yy_is_our_buffer = 1; |
| 2005 | |
| 2006 | yy_init_buffer(b,file ); |
| 2007 | |
| 2008 | return b; |
| 2009 | } |
| 2010 | |
| 2011 | /** Destroy the buffer. |
| 2012 | * @param b a buffer created with yy_create_buffer() |
| 2013 | * |
| 2014 | */ |
| 2015 | void yy_delete_buffer (YY_BUFFER_STATE b ) |
| 2016 | { |
| 2017 | |
| 2018 | if ( ! b ) |
| 2019 | return; |
| 2020 | |
| 2021 | if ( b == YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) /* Not sure if we should pop here. */ |
| 2022 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = (YY_BUFFER_STATE) 0; |
| 2023 | |
| 2024 | if ( b->yy_is_our_buffer ) |
| 2025 | yyfree((void *) b->yy_ch_buf ); |
| 2026 | |
| 2027 | yyfree((void *) b ); |
| 2028 | } |
| 2029 | |
| 2030 | /* Initializes or reinitializes a buffer. |
| 2031 | * This function is sometimes called more than once on the same buffer, |
| 2032 | * such as during a yyrestart() or at EOF. |
| 2033 | */ |
| 2034 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) |
| 2035 | |
| 2036 | { |
| 2037 | int oerrno = errno(*__errno()); |
| 2038 | |
| 2039 | yy_flush_buffer(b ); |
| 2040 | |
| 2041 | b->yy_input_file = file; |
| 2042 | b->yy_fill_buffer = 1; |
| 2043 | |
| 2044 | /* If b is the current buffer, then yy_init_buffer was _probably_ |
| 2045 | * called from yyrestart() or through yy_get_next_buffer. |
| 2046 | * In that case, we don't want to reset the lineno or column. |
| 2047 | */ |
| 2048 | if (b != YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))){ |
| 2049 | b->yy_bs_lineno = 1; |
| 2050 | b->yy_bs_column = 0; |
| 2051 | } |
| 2052 | |
| 2053 | b->yy_is_interactive = file ? (isatty( fileno(file)(!__isthreaded ? ((file)->_file) : (fileno)(file)) ) > 0) : 0; |
| 2054 | |
| 2055 | errno(*__errno()) = oerrno; |
| 2056 | } |
| 2057 | |
| 2058 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
| 2059 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
| 2060 | * |
| 2061 | */ |
| 2062 | void yy_flush_buffer (YY_BUFFER_STATE b ) |
| 2063 | { |
| 2064 | if ( ! b ) |
| 2065 | return; |
| 2066 | |
| 2067 | b->yy_n_chars = 0; |
| 2068 | |
| 2069 | /* We always need two end-of-buffer characters. The first causes |
| 2070 | * a transition to the end-of-buffer state. The second causes |
| 2071 | * a jam in that state. |
| 2072 | */ |
| 2073 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR0; |
| 2074 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR0; |
| 2075 | |
| 2076 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
| 2077 | |
| 2078 | b->yy_at_bol = 1; |
| 2079 | b->yy_buffer_status = YY_BUFFER_NEW0; |
| 2080 | |
| 2081 | if ( b == YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) |
| 2082 | yy_load_buffer_state( ); |
| 2083 | } |
| 2084 | |
| 2085 | /** Pushes the new state onto the stack. The new state becomes |
| 2086 | * the current state. This function will allocate the stack |
| 2087 | * if necessary. |
| 2088 | * @param new_buffer The new state. |
| 2089 | * |
| 2090 | */ |
| 2091 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) |
| 2092 | { |
| 2093 | if (new_buffer == NULL((void *)0)) |
| 2094 | return; |
| 2095 | |
| 2096 | yyensure_buffer_stack(); |
| 2097 | |
| 2098 | /* This block is copied from yy_switch_to_buffer. */ |
| 2099 | if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) |
| 2100 | { |
| 2101 | /* Flush out information for old buffer. */ |
| 2102 | *(yy_c_buf_p) = (yy_hold_char); |
| 2103 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p); |
| 2104 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars); |
| 2105 | } |
| 2106 | |
| 2107 | /* Only push if top exists. Otherwise, replace top. */ |
| 2108 | if (YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))) |
| 2109 | (yy_buffer_stack_top)++; |
| 2110 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer; |
| 2111 | |
| 2112 | /* copied from yy_switch_to_buffer. */ |
| 2113 | yy_load_buffer_state( ); |
| 2114 | (yy_did_buffer_switch_on_eof) = 1; |
| 2115 | } |
| 2116 | |
| 2117 | /** Removes and deletes the top of the stack, if present. |
| 2118 | * The next element becomes the new top. |
| 2119 | * |
| 2120 | */ |
| 2121 | void yypop_buffer_state (void) |
| 2122 | { |
| 2123 | if (!YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))) |
| 2124 | return; |
| 2125 | |
| 2126 | yy_delete_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ); |
| 2127 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = NULL((void *)0); |
| 2128 | if ((yy_buffer_stack_top) > 0) |
| 2129 | --(yy_buffer_stack_top); |
| 2130 | |
| 2131 | if (YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))) { |
| 2132 | yy_load_buffer_state( ); |
| 2133 | (yy_did_buffer_switch_on_eof) = 1; |
| 2134 | } |
| 2135 | } |
| 2136 | |
| 2137 | /* Allocates the stack if it does not exist. |
| 2138 | * Guarantees space for at least one push. |
| 2139 | */ |
| 2140 | static void yyensure_buffer_stack (void) |
| 2141 | { |
| 2142 | yy_size_t num_to_alloc; |
| 2143 | |
| 2144 | if (!(yy_buffer_stack)) { |
| 2145 | |
| 2146 | /* First allocation is just for 2 elements, since we don't know if this |
| 2147 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
| 2148 | * immediate realloc on the next call. |
| 2149 | */ |
| 2150 | num_to_alloc = 1; |
| 2151 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc |
| 2152 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
| 2153 | ); |
| 2154 | if ( ! (yy_buffer_stack) ) |
| 2155 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" )yy_fatal_error( "out of dynamic memory in yyensure_buffer_stack()" ); |
| 2156 | |
| 2157 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
| 2158 | |
| 2159 | (yy_buffer_stack_max) = num_to_alloc; |
| 2160 | (yy_buffer_stack_top) = 0; |
| 2161 | return; |
| 2162 | } |
| 2163 | |
| 2164 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ |
| 2165 | |
| 2166 | /* Increase the buffer to prepare for a possible push. */ |
| 2167 | int grow_size = 8 /* arbitrary grow size */; |
| 2168 | |
| 2169 | num_to_alloc = (yy_buffer_stack_max) + grow_size; |
| 2170 | (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc |
| 2171 | ((yy_buffer_stack), |
| 2172 | num_to_alloc * sizeof(struct yy_buffer_state*) |
| 2173 | ); |
| 2174 | if ( ! (yy_buffer_stack) ) |
| 2175 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" )yy_fatal_error( "out of dynamic memory in yyensure_buffer_stack()" ); |
| 2176 | |
| 2177 | /* zero only the new slots.*/ |
| 2178 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); |
| 2179 | (yy_buffer_stack_max) = num_to_alloc; |
| 2180 | } |
| 2181 | } |
| 2182 | |
| 2183 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
| 2184 | * @param base the character buffer |
| 2185 | * @param size the size in bytes of the character buffer |
| 2186 | * |
| 2187 | * @return the newly allocated buffer state object. |
| 2188 | */ |
| 2189 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) |
| 2190 | { |
| 2191 | YY_BUFFER_STATE b; |
| 2192 | |
| 2193 | if ( size < 2 || |
| 2194 | base[size-2] != YY_END_OF_BUFFER_CHAR0 || |
| 2195 | base[size-1] != YY_END_OF_BUFFER_CHAR0 ) |
| 2196 | /* They forgot to leave room for the EOB's. */ |
| 2197 | return 0; |
| 2198 | |
| 2199 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); |
| 2200 | if ( ! b ) |
| 2201 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" )yy_fatal_error( "out of dynamic memory in yy_scan_buffer()" ); |
| 2202 | |
| 2203 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
| 2204 | b->yy_buf_pos = b->yy_ch_buf = base; |
| 2205 | b->yy_is_our_buffer = 0; |
| 2206 | b->yy_input_file = 0; |
| 2207 | b->yy_n_chars = b->yy_buf_size; |
| 2208 | b->yy_is_interactive = 0; |
| 2209 | b->yy_at_bol = 1; |
| 2210 | b->yy_fill_buffer = 0; |
| 2211 | b->yy_buffer_status = YY_BUFFER_NEW0; |
| 2212 | |
| 2213 | yy_switch_to_buffer(b ); |
| 2214 | |
| 2215 | return b; |
| 2216 | } |
| 2217 | |
| 2218 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
| 2219 | * scan from a @e copy of @a str. |
| 2220 | * @param yystr a NUL-terminated string to scan |
| 2221 | * |
| 2222 | * @return the newly allocated buffer state object. |
| 2223 | * @note If you want to scan bytes that may contain NUL values, then use |
| 2224 | * yy_scan_bytes() instead. |
| 2225 | */ |
| 2226 | YY_BUFFER_STATE yy_scan_string (yyconstconst char * yystr ) |
| 2227 | { |
| 2228 | |
| 2229 | return yy_scan_bytes(yystr,strlen(yystr) ); |
| 2230 | } |
| 2231 | |
| 2232 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
| 2233 | * scan from a @e copy of @a bytes. |
| 2234 | * @param yybytes the byte buffer to scan |
| 2235 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
| 2236 | * |
| 2237 | * @return the newly allocated buffer state object. |
| 2238 | */ |
| 2239 | YY_BUFFER_STATE yy_scan_bytes (yyconstconst char * yybytes, yy_size_t _yybytes_len ) |
| 2240 | { |
| 2241 | YY_BUFFER_STATE b; |
| 2242 | char *buf; |
| 2243 | yy_size_t n; |
| 2244 | yy_size_t i; |
| 2245 | |
| 2246 | /* Get memory for full buffer, including space for trailing EOB's. */ |
| 2247 | n = _yybytes_len + 2; |
| 2248 | buf = (char *) yyalloc(n ); |
| 2249 | if ( ! buf ) |
| 2250 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" )yy_fatal_error( "out of dynamic memory in yy_scan_bytes()" ); |
| 2251 | |
| 2252 | for ( i = 0; i < _yybytes_len; ++i ) |
| 2253 | buf[i] = yybytes[i]; |
| 2254 | |
| 2255 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR0; |
| 2256 | |
| 2257 | b = yy_scan_buffer(buf,n ); |
| 2258 | if ( ! b ) |
| 2259 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" )yy_fatal_error( "bad buffer in yy_scan_bytes()" ); |
| 2260 | |
| 2261 | /* It's okay to grow etc. this buffer, and we should throw it |
| 2262 | * away when we're done. |
| 2263 | */ |
| 2264 | b->yy_is_our_buffer = 1; |
| 2265 | |
| 2266 | return b; |
| 2267 | } |
| 2268 | |
| 2269 | #ifndef YY_EXIT_FAILURE2 |
| 2270 | #define YY_EXIT_FAILURE2 2 |
| 2271 | #endif |
| 2272 | |
| 2273 | static void yy_fatal_error (yyconstconst char* msg ) |
| 2274 | { |
| 2275 | (void) fprintf( stderr(&__sF[2]), "%s\n", msg ); |
| 2276 | exit( YY_EXIT_FAILURE2 ); |
| 2277 | } |
| 2278 | |
| 2279 | /* Redefine yyless() so it works in section 3 code. */ |
| 2280 | |
| 2281 | #undef yyless |
| 2282 | #define yyless(n)do { int yyless_macro_arg = (n); do { int yyl; for ( yyl = yyless_macro_arg ; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) --yylineno ; }while(0); yytext[yyleng] = (yy_hold_char); (yy_c_buf_p) = yytext + yyless_macro_arg; (yy_hold_char) = *(yy_c_buf_p); *(yy_c_buf_p ) = '\0'; yyleng = yyless_macro_arg; } while ( 0 ) \ |
| 2283 | do \ |
| 2284 | { \ |
| 2285 | /* Undo effects of setting up yytext. */ \ |
| 2286 | int yyless_macro_arg = (n); \ |
| 2287 | YY_LESS_LINENO(yyless_macro_arg)do { int yyl; for ( yyl = yyless_macro_arg; yyl < yyleng; ++ yyl ) if ( yytext[yyl] == '\n' ) --yylineno; }while(0);\ |
| 2288 | yytext[yyleng] = (yy_hold_char); \ |
| 2289 | (yy_c_buf_p) = yytext + yyless_macro_arg; \ |
| 2290 | (yy_hold_char) = *(yy_c_buf_p); \ |
| 2291 | *(yy_c_buf_p) = '\0'; \ |
| 2292 | yyleng = yyless_macro_arg; \ |
| 2293 | } \ |
| 2294 | while ( 0 ) |
| 2295 | |
| 2296 | /* Accessor methods (get/set functions) to struct members. */ |
| 2297 | |
| 2298 | /** Get the current line number. |
| 2299 | * |
| 2300 | */ |
| 2301 | int yyget_lineno (void) |
| 2302 | { |
| 2303 | |
| 2304 | return yylineno; |
| 2305 | } |
| 2306 | |
| 2307 | /** Get the input stream. |
| 2308 | * |
| 2309 | */ |
| 2310 | FILE *yyget_in (void) |
| 2311 | { |
| 2312 | return yyin; |
| 2313 | } |
| 2314 | |
| 2315 | /** Get the output stream. |
| 2316 | * |
| 2317 | */ |
| 2318 | FILE *yyget_out (void) |
| 2319 | { |
| 2320 | return yyout; |
| 2321 | } |
| 2322 | |
| 2323 | /** Get the length of the current token. |
| 2324 | * |
| 2325 | */ |
| 2326 | yy_size_t yyget_leng (void) |
| 2327 | { |
| 2328 | return yyleng; |
| 2329 | } |
| 2330 | |
| 2331 | /** Get the current token. |
| 2332 | * |
| 2333 | */ |
| 2334 | |
| 2335 | char *yyget_text (void) |
| 2336 | { |
| 2337 | return yytext; |
| 2338 | } |
| 2339 | |
| 2340 | /** Set the current line number. |
| 2341 | * @param line_number |
| 2342 | * |
| 2343 | */ |
| 2344 | void yyset_lineno (int line_number ) |
| 2345 | { |
| 2346 | |
| 2347 | yylineno = line_number; |
| 2348 | } |
| 2349 | |
| 2350 | /** Set the input stream. This does not discard the current |
| 2351 | * input buffer. |
| 2352 | * @param in_str A readable stream. |
| 2353 | * |
| 2354 | * @see yy_switch_to_buffer |
| 2355 | */ |
| 2356 | void yyset_in (FILE * in_str ) |
| 2357 | { |
| 2358 | yyin = in_str ; |
| 2359 | } |
| 2360 | |
| 2361 | void yyset_out (FILE * out_str ) |
| 2362 | { |
| 2363 | yyout = out_str ; |
| 2364 | } |
| 2365 | |
| 2366 | int yyget_debug (void) |
| 2367 | { |
| 2368 | return yy_flex_debug; |
| 2369 | } |
| 2370 | |
| 2371 | void yyset_debug (int bdebug ) |
| 2372 | { |
| 2373 | yy_flex_debug = bdebug ; |
| 2374 | } |
| 2375 | |
| 2376 | static int yy_init_globals (void) |
| 2377 | { |
| 2378 | /* Initialization is the same as for the non-reentrant scanner. |
| 2379 | * This function is called from yylex_destroy(), so don't allocate here. |
| 2380 | */ |
| 2381 | |
| 2382 | /* We do not touch yylineno unless the option is enabled. */ |
| 2383 | yylineno = 1; |
| 2384 | |
| 2385 | (yy_buffer_stack) = 0; |
| 2386 | (yy_buffer_stack_top) = 0; |
| 2387 | (yy_buffer_stack_max) = 0; |
| 2388 | (yy_c_buf_p) = (char *) 0; |
| 2389 | (yy_init) = 0; |
| 2390 | (yy_start) = 0; |
| 2391 | |
| 2392 | /* Defined in main.c */ |
| 2393 | #ifdef YY_STDINIT |
| 2394 | yyin = stdin(&__sF[0]); |
| 2395 | yyout = stdout(&__sF[1]); |
| 2396 | #else |
| 2397 | yyin = (FILE *) 0; |
| 2398 | yyout = (FILE *) 0; |
| 2399 | #endif |
| 2400 | |
| 2401 | /* For future reference: Set errno on error, since we are called by |
| 2402 | * yylex_init() |
| 2403 | */ |
| 2404 | return 0; |
| 2405 | } |
| 2406 | |
| 2407 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
| 2408 | int yylex_destroy (void) |
| 2409 | { |
| 2410 | |
| 2411 | /* Pop the buffer stack, destroying each element. */ |
| 2412 | while(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))){ |
| 2413 | yy_delete_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ); |
| 2414 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = NULL((void *)0); |
| 2415 | yypop_buffer_state(); |
| 2416 | } |
| 2417 | |
| 2418 | /* Destroy the stack itself. */ |
| 2419 | yyfree((yy_buffer_stack) ); |
| 2420 | (yy_buffer_stack) = NULL((void *)0); |
| 2421 | |
| 2422 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
| 2423 | * yylex() is called, initialization will occur. */ |
| 2424 | yy_init_globals( ); |
| 2425 | |
| 2426 | return 0; |
| 2427 | } |
| 2428 | |
| 2429 | /* |
| 2430 | * Internal utility routines. |
| 2431 | */ |
| 2432 | |
| 2433 | #ifndef yytext_ptryytext |
| 2434 | static void yy_flex_strncpy (char* s1, yyconstconst char * s2, int n ) |
| 2435 | { |
| 2436 | int i; |
| 2437 | for ( i = 0; i < n; ++i ) |
| 2438 | s1[i] = s2[i]; |
| 2439 | } |
| 2440 | #endif |
| 2441 | |
| 2442 | #ifdef YY_NEED_STRLEN |
| 2443 | static int yy_flex_strlen (yyconstconst char * s ) |
| 2444 | { |
| 2445 | int n; |
| 2446 | for ( n = 0; s[n]; ++n ) |
| 2447 | ; |
| 2448 | |
| 2449 | return n; |
| 2450 | } |
| 2451 | #endif |
| 2452 | |
| 2453 | void *yyalloc (yy_size_t size ) |
| 2454 | { |
| 2455 | return (void *) malloc( size ); |
| 2456 | } |
| 2457 | |
| 2458 | void *yyrealloc (void * ptr, yy_size_t size ) |
| 2459 | { |
| 2460 | /* The cast to (char *) in the following accommodates both |
| 2461 | * implementations that use char* generic pointers, and those |
| 2462 | * that use void* generic pointers. It works with the latter |
| 2463 | * because both ANSI C and C++ allow castless assignment from |
| 2464 | * any pointer type to void*, and deal with argument conversions |
| 2465 | * as though doing an assignment. |
| 2466 | */ |
| 2467 | return (void *) realloc( (char *) ptr, size ); |
| 2468 | } |
| 2469 | |
| 2470 | void yyfree (void * ptr ) |
| 2471 | { |
| 2472 | free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ |
| 2473 | } |
| 2474 | |
| 2475 | #define YYTABLES_NAME"yytables" "yytables" |
| 2476 | |
| 2477 | #line 323 "/usr/src/usr.bin/fgen/fgen.l" |
| 2478 | |
| 2479 | |
| 2480 | |
| 2481 | /* Function definitions */ |
| 2482 | static void push(Cell); |
| 2483 | static Cell pop(void); |
| 2484 | static int depth(void); |
| 2485 | static int fadd(struct fcode *, struct fcode *); |
| 2486 | static struct fcode *flookup(struct fcode *, const char *); |
| 2487 | static int aadd(struct macro *, struct macro *); |
| 2488 | static struct macro *alookup(struct macro *, const char *); |
| 2489 | static void initdic(void); |
| 2490 | __dead__attribute__((__noreturn__)) static void usage(void); |
| 2491 | static void tokenize(YY_BUFFER_STATE); |
| 2492 | static int emit(const char *); |
| 2493 | static int spit(long); |
| 2494 | static int offspit(long); |
| 2495 | static void sspit(const char *); |
| 2496 | static int apply_macros(YY_BUFFER_STATE, const char *); |
| 2497 | static Cell cvt(const char *, char **, int base); |
| 2498 | |
| 2499 | /* |
| 2500 | * Standard FCode names and numbers. Includes standard |
| 2501 | * tokenizer aliases. |
| 2502 | */ |
| 2503 | static struct fcode fcodes[] = { |
| 2504 | { "end0", 0x0000, 0, NULL((void *)0), NULL((void *)0) }, |
| 2505 | { "b(lit)", 0x0010, 0, NULL((void *)0), NULL((void *)0) }, |
| 2506 | { "b(')", 0x0011, 0, NULL((void *)0), NULL((void *)0) }, |
| 2507 | { "b(\")", 0x0012, 0, NULL((void *)0), NULL((void *)0) }, |
| 2508 | { "bbranch", 0x0013, 0, NULL((void *)0), NULL((void *)0) }, |
| 2509 | { "b?branch", 0x0014, 0, NULL((void *)0), NULL((void *)0) }, |
| 2510 | { "b(loop)", 0x0015, 0, NULL((void *)0), NULL((void *)0) }, |
| 2511 | { "b(+loop)", 0x0016, 0, NULL((void *)0), NULL((void *)0) }, |
| 2512 | { "b(do)", 0x0017, 0, NULL((void *)0), NULL((void *)0) }, |
| 2513 | { "b(?do)", 0x0018, 0, NULL((void *)0), NULL((void *)0) }, |
| 2514 | { "i", 0x0019, 0, NULL((void *)0), NULL((void *)0) }, |
| 2515 | { "j", 0x001a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2516 | { "b(leave)", 0x001b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2517 | { "b(of)", 0x001c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2518 | { "execute", 0x001d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2519 | { "+", 0x001e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2520 | { "-", 0x001f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2521 | { "*", 0x0020, 0, NULL((void *)0), NULL((void *)0) }, |
| 2522 | { "/", 0x0021, 0, NULL((void *)0), NULL((void *)0) }, |
| 2523 | { "mod", 0x0022, 0, NULL((void *)0), NULL((void *)0) }, |
| 2524 | { "and", 0x0023, 0, NULL((void *)0), NULL((void *)0) }, |
| 2525 | { "or", 0x0024, 0, NULL((void *)0), NULL((void *)0) }, |
| 2526 | { "xor", 0x0025, 0, NULL((void *)0), NULL((void *)0) }, |
| 2527 | { "invert", 0x0026, 0, NULL((void *)0), NULL((void *)0) }, |
| 2528 | { "lshift", 0x0027, 0, NULL((void *)0), NULL((void *)0) }, |
| 2529 | { "rshift", 0x0028, 0, NULL((void *)0), NULL((void *)0) }, |
| 2530 | { ">>a", 0x0029, 0, NULL((void *)0), NULL((void *)0) }, |
| 2531 | { "/mod", 0x002a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2532 | { "u/mod", 0x002b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2533 | { "negate", 0x002c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2534 | { "abs", 0x002d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2535 | { "min", 0x002e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2536 | { "max", 0x002f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2537 | { ">r", 0x0030, 0, NULL((void *)0), NULL((void *)0) }, |
| 2538 | { "r>", 0x0031, 0, NULL((void *)0), NULL((void *)0) }, |
| 2539 | { "r@", 0x0032, 0, NULL((void *)0), NULL((void *)0) }, |
| 2540 | { "exit", 0x0033, 0, NULL((void *)0), NULL((void *)0) }, |
| 2541 | { "0=", 0x0034, 0, NULL((void *)0), NULL((void *)0) }, |
| 2542 | { "0<>", 0x0035, 0, NULL((void *)0), NULL((void *)0) }, |
| 2543 | { "0<", 0x0036, 0, NULL((void *)0), NULL((void *)0) }, |
| 2544 | { "0<=", 0x0037, 0, NULL((void *)0), NULL((void *)0) }, |
| 2545 | { "0>", 0x0038, 0, NULL((void *)0), NULL((void *)0) }, |
| 2546 | { "0>=", 0x0039, 0, NULL((void *)0), NULL((void *)0) }, |
| 2547 | { "<", 0x003a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2548 | { ">", 0x003b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2549 | { "=", 0x003c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2550 | { "<>", 0x003d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2551 | { "u>", 0x003e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2552 | { "u<=", 0x003f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2553 | { "u<", 0x0040, 0, NULL((void *)0), NULL((void *)0) }, |
| 2554 | { "u>=", 0x0041, 0, NULL((void *)0), NULL((void *)0) }, |
| 2555 | { ">=", 0x0042, 0, NULL((void *)0), NULL((void *)0) }, |
| 2556 | { "<=", 0x0043, 0, NULL((void *)0), NULL((void *)0) }, |
| 2557 | { "between", 0x0044, 0, NULL((void *)0), NULL((void *)0) }, |
| 2558 | { "within", 0x0045, 0, NULL((void *)0), NULL((void *)0) }, |
| 2559 | { "drop", 0x0046, 0, NULL((void *)0), NULL((void *)0) }, |
| 2560 | { "dup", 0x0047, 0, NULL((void *)0), NULL((void *)0) }, |
| 2561 | { "over", 0x0048, 0, NULL((void *)0), NULL((void *)0) }, |
| 2562 | { "swap", 0x0049, 0, NULL((void *)0), NULL((void *)0) }, |
| 2563 | { "rot", 0x004a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2564 | { "-rot", 0x004b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2565 | { "tuck", 0x004c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2566 | { "nip", 0x004d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2567 | { "pick", 0x004e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2568 | { "roll", 0x004f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2569 | { "?dup", 0x0050, 0, NULL((void *)0), NULL((void *)0) }, |
| 2570 | { "depth", 0x0051, 0, NULL((void *)0), NULL((void *)0) }, |
| 2571 | { "2drop", 0x0052, 0, NULL((void *)0), NULL((void *)0) }, |
| 2572 | { "2dup", 0x0053, 0, NULL((void *)0), NULL((void *)0) }, |
| 2573 | { "2over", 0x0054, 0, NULL((void *)0), NULL((void *)0) }, |
| 2574 | { "2swap", 0x0055, 0, NULL((void *)0), NULL((void *)0) }, |
| 2575 | { "2rot", 0x0056, 0, NULL((void *)0), NULL((void *)0) }, |
| 2576 | { "2/", 0x0057, 0, NULL((void *)0), NULL((void *)0) }, |
| 2577 | { "u2/", 0x0058, 0, NULL((void *)0), NULL((void *)0) }, |
| 2578 | { "2*", 0x0059, 0, NULL((void *)0), NULL((void *)0) }, |
| 2579 | { "/c", 0x005a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2580 | { "/w", 0x005b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2581 | { "/l", 0x005c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2582 | { "/n", 0x005d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2583 | { "ca+", 0x005e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2584 | { "wa+", 0x005f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2585 | { "la+", 0x0060, 0, NULL((void *)0), NULL((void *)0) }, |
| 2586 | { "na+", 0x0061, 0, NULL((void *)0), NULL((void *)0) }, |
| 2587 | { "char+", 0x0062, 0, NULL((void *)0), NULL((void *)0) }, |
| 2588 | { "wa1+", 0x0063, 0, NULL((void *)0), NULL((void *)0) }, |
| 2589 | { "la1+", 0x0064, 0, NULL((void *)0), NULL((void *)0) }, |
| 2590 | { "cell+", 0x0065, 0, NULL((void *)0), NULL((void *)0) }, |
| 2591 | { "chars", 0x0066, 0, NULL((void *)0), NULL((void *)0) }, |
| 2592 | { "/w*", 0x0067, 0, NULL((void *)0), NULL((void *)0) }, |
| 2593 | { "/l*", 0x0068, 0, NULL((void *)0), NULL((void *)0) }, |
| 2594 | { "cells", 0x0069, 0, NULL((void *)0), NULL((void *)0) }, |
| 2595 | { "on", 0x006a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2596 | { "off", 0x006b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2597 | { "+!", 0x006c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2598 | { "@", 0x006d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2599 | { "l@", 0x006e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2600 | { "w@", 0x006f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2601 | { "<w@", 0x0070, 0, NULL((void *)0), NULL((void *)0) }, |
| 2602 | { "c@", 0x0071, 0, NULL((void *)0), NULL((void *)0) }, |
| 2603 | { "!", 0x0072, 0, NULL((void *)0), NULL((void *)0) }, |
| 2604 | { "l!", 0x0073, 0, NULL((void *)0), NULL((void *)0) }, |
| 2605 | { "w!", 0x0074, 0, NULL((void *)0), NULL((void *)0) }, |
| 2606 | { "c!", 0x0075, 0, NULL((void *)0), NULL((void *)0) }, |
| 2607 | { "2@", 0x0076, 0, NULL((void *)0), NULL((void *)0) }, |
| 2608 | { "2!", 0x0077, 0, NULL((void *)0), NULL((void *)0) }, |
| 2609 | { "move", 0x0078, 0, NULL((void *)0), NULL((void *)0) }, |
| 2610 | { "fill", 0x0079, 0, NULL((void *)0), NULL((void *)0) }, |
| 2611 | { "comp", 0x007a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2612 | { "noop", 0x007b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2613 | { "lwsplit", 0x007c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2614 | { "wjoin", 0x007d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2615 | { "lbsplit", 0x007e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2616 | { "bljoin", 0x007f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2617 | { "wbflip", 0x0080, 0, NULL((void *)0), NULL((void *)0) }, |
| 2618 | { "upc", 0x0081, 0, NULL((void *)0), NULL((void *)0) }, |
| 2619 | { "lcc", 0x0082, 0, NULL((void *)0), NULL((void *)0) }, |
| 2620 | { "pack", 0x0083, 0, NULL((void *)0), NULL((void *)0) }, |
| 2621 | { "count", 0x0084, 0, NULL((void *)0), NULL((void *)0) }, |
| 2622 | { "body>", 0x0085, 0, NULL((void *)0), NULL((void *)0) }, |
| 2623 | { ">body", 0x0086, 0, NULL((void *)0), NULL((void *)0) }, |
| 2624 | { "fcode-revision", 0x0087, 0, NULL((void *)0), NULL((void *)0) }, |
| 2625 | { "span", 0x0088, 0, NULL((void *)0), NULL((void *)0) }, |
| 2626 | { "unloop", 0x0089, 0, NULL((void *)0), NULL((void *)0) }, |
| 2627 | { "expect", 0x008a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2628 | { "alloc-mem", 0x008b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2629 | { "free-mem", 0x008c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2630 | { "key?", 0x008d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2631 | { "key", 0x008e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2632 | { "emit", 0x008f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2633 | { "type", 0x0090, 0, NULL((void *)0), NULL((void *)0) }, |
| 2634 | { "(cr", 0x0091, 0, NULL((void *)0), NULL((void *)0) }, |
| 2635 | { "cr", 0x0092, 0, NULL((void *)0), NULL((void *)0) }, |
| 2636 | { "#out", 0x0093, 0, NULL((void *)0), NULL((void *)0) }, |
| 2637 | { "#line", 0x0094, 0, NULL((void *)0), NULL((void *)0) }, |
| 2638 | { "hold", 0x0095, 0, NULL((void *)0), NULL((void *)0) }, |
| 2639 | { "<#", 0x0096, 0, NULL((void *)0), NULL((void *)0) }, |
| 2640 | { "u#>", 0x0097, 0, NULL((void *)0), NULL((void *)0) }, |
| 2641 | { "sign", 0x0098, 0, NULL((void *)0), NULL((void *)0) }, |
| 2642 | { "u#", 0x0099, 0, NULL((void *)0), NULL((void *)0) }, |
| 2643 | { "u#s", 0x009a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2644 | { "u.", 0x009b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2645 | { "u.r", 0x009c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2646 | { ".", 0x009d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2647 | { ".r", 0x009e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2648 | { ".s", 0x009f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2649 | { "base", 0x00a0, 0, NULL((void *)0), NULL((void *)0) }, |
| 2650 | { "convert", 0x00a1, 0, NULL((void *)0), NULL((void *)0) }, |
| 2651 | { "$number", 0x00a2, 0, NULL((void *)0), NULL((void *)0) }, |
| 2652 | { "digit", 0x00a3, 0, NULL((void *)0), NULL((void *)0) }, |
| 2653 | { "-1", 0x00a4, 0, NULL((void *)0), NULL((void *)0) }, |
| 2654 | { "true", 0x00a4, 0, NULL((void *)0), NULL((void *)0) }, |
| 2655 | { "0", 0x00a5, 0, NULL((void *)0), NULL((void *)0) }, |
| 2656 | { "1", 0x00a6, 0, NULL((void *)0), NULL((void *)0) }, |
| 2657 | { "2", 0x00a7, 0, NULL((void *)0), NULL((void *)0) }, |
| 2658 | { "3", 0x00a8, 0, NULL((void *)0), NULL((void *)0) }, |
| 2659 | { "bl", 0x00a9, 0, NULL((void *)0), NULL((void *)0) }, |
| 2660 | { "bs", 0x00aa, 0, NULL((void *)0), NULL((void *)0) }, |
| 2661 | { "bell", 0x00ab, 0, NULL((void *)0), NULL((void *)0) }, |
| 2662 | { "bounds", 0x00ac, 0, NULL((void *)0), NULL((void *)0) }, |
| 2663 | { "here", 0x00ad, 0, NULL((void *)0), NULL((void *)0) }, |
| 2664 | { "aligned", 0x00ae, 0, NULL((void *)0), NULL((void *)0) }, |
| 2665 | { "wbsplit", 0x00af, 0, NULL((void *)0), NULL((void *)0) }, |
| 2666 | { "bwjoin", 0x00b0, 0, NULL((void *)0), NULL((void *)0) }, |
| 2667 | { "b(<mark)", 0x00b1, 0, NULL((void *)0), NULL((void *)0) }, |
| 2668 | { "b(>resolve)", 0x00b2, 0, NULL((void *)0), NULL((void *)0) }, |
| 2669 | { "set-token-table", 0x00b3, 0, NULL((void *)0), NULL((void *)0) }, |
| 2670 | { "set-table", 0x00b4, 0, NULL((void *)0), NULL((void *)0) }, |
| 2671 | { "new-token", 0x00b5, 0, NULL((void *)0), NULL((void *)0) }, |
| 2672 | { "named-token", 0x00b6, 0, NULL((void *)0), NULL((void *)0) }, |
| 2673 | { "b(:)", 0x00b7, 0, NULL((void *)0), NULL((void *)0) }, |
| 2674 | { "b(value)", 0x00b8, 0, NULL((void *)0), NULL((void *)0) }, |
| 2675 | { "b(variable)", 0x00b9, 0, NULL((void *)0), NULL((void *)0) }, |
| 2676 | { "b(constant)", 0x00ba, 0, NULL((void *)0), NULL((void *)0) }, |
| 2677 | { "b(create)", 0x00bb, 0, NULL((void *)0), NULL((void *)0) }, |
| 2678 | { "b(defer)", 0x00bc, 0, NULL((void *)0), NULL((void *)0) }, |
| 2679 | { "b(buffer:)", 0x00bd, 0, NULL((void *)0), NULL((void *)0) }, |
| 2680 | { "b(field)", 0x00be, 0, NULL((void *)0), NULL((void *)0) }, |
| 2681 | { "b(code)", 0x00bf, 0, NULL((void *)0), NULL((void *)0) }, |
| 2682 | { "instance", 0x00c0, 0, NULL((void *)0), NULL((void *)0) }, |
| 2683 | { "b(;)", 0x00c2, 0, NULL((void *)0), NULL((void *)0) }, |
| 2684 | { "b(to)", 0x00c3, 0, NULL((void *)0), NULL((void *)0) }, |
| 2685 | { "b(case)", 0x00c4, 0, NULL((void *)0), NULL((void *)0) }, |
| 2686 | { "b(endcase)", 0x00c5, 0, NULL((void *)0), NULL((void *)0) }, |
| 2687 | { "b(endof)", 0x00c6, 0, NULL((void *)0), NULL((void *)0) }, |
| 2688 | { "#", 0x00c7, 0, NULL((void *)0), NULL((void *)0) }, |
| 2689 | { "#s", 0x00c8, 0, NULL((void *)0), NULL((void *)0) }, |
| 2690 | { "#>", 0x00c9, 0, NULL((void *)0), NULL((void *)0) }, |
| 2691 | { "external-token", 0x00ca, 0, NULL((void *)0), NULL((void *)0) }, |
| 2692 | { "$find", 0x00cb, 0, NULL((void *)0), NULL((void *)0) }, |
| 2693 | { "offset16", 0x00cc, 0, NULL((void *)0), NULL((void *)0) }, |
| 2694 | { "evaluate", 0x00cd, 0, NULL((void *)0), NULL((void *)0) }, |
| 2695 | { "c,", 0x00d0, 0, NULL((void *)0), NULL((void *)0) }, |
| 2696 | { "w,", 0x00d1, 0, NULL((void *)0), NULL((void *)0) }, |
| 2697 | { "l,", 0x00d2, 0, NULL((void *)0), NULL((void *)0) }, |
| 2698 | { ",", 0x00d3, 0, NULL((void *)0), NULL((void *)0) }, |
| 2699 | { "um*", 0x00d4, 0, NULL((void *)0), NULL((void *)0) }, |
| 2700 | { "um/mod", 0x00d5, 0, NULL((void *)0), NULL((void *)0) }, |
| 2701 | { "d+", 0x00d8, 0, NULL((void *)0), NULL((void *)0) }, |
| 2702 | { "d-", 0x00d9, 0, NULL((void *)0), NULL((void *)0) }, |
| 2703 | { "get-token", 0x00da, 0, NULL((void *)0), NULL((void *)0) }, |
| 2704 | { "set-token", 0x00db, 0, NULL((void *)0), NULL((void *)0) }, |
| 2705 | { "state", 0x00dc, 0, NULL((void *)0), NULL((void *)0) }, |
| 2706 | { "compile,", 0x00dd, 0, NULL((void *)0), NULL((void *)0) }, |
| 2707 | { "behavior", 0x00de, 0, NULL((void *)0), NULL((void *)0) }, |
| 2708 | { "start0", 0x00f0, 0, NULL((void *)0), NULL((void *)0) }, |
| 2709 | { "start1", 0x00f1, 0, NULL((void *)0), NULL((void *)0) }, |
| 2710 | { "start2", 0x00f2, 0, NULL((void *)0), NULL((void *)0) }, |
| 2711 | { "start4", 0x00f3, 0, NULL((void *)0), NULL((void *)0) }, |
| 2712 | { "ferror", 0x00fc, 0, NULL((void *)0), NULL((void *)0) }, |
| 2713 | { "version1", 0x00fd, 0, NULL((void *)0), NULL((void *)0) }, |
| 2714 | { "4-byte-id", 0x00fe, 0, NULL((void *)0), NULL((void *)0) }, |
| 2715 | { "end1", 0x00ff, 0, NULL((void *)0), NULL((void *)0) }, |
| 2716 | { "dma-alloc", 0x0101, 0, NULL((void *)0), NULL((void *)0) }, |
| 2717 | { "my-address", 0x0102, 0, NULL((void *)0), NULL((void *)0) }, |
| 2718 | { "my-space", 0x0103, 0, NULL((void *)0), NULL((void *)0) }, |
| 2719 | { "memmap", 0x0104, 0, NULL((void *)0), NULL((void *)0) }, |
| 2720 | { "free-virtual", 0x0105, 0, NULL((void *)0), NULL((void *)0) }, |
| 2721 | { ">physical", 0x0106, 0, NULL((void *)0), NULL((void *)0) }, |
| 2722 | { "my-params", 0x010f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2723 | { "property", 0x0110, 0, NULL((void *)0), NULL((void *)0) }, |
| 2724 | { "encode-int", 0x0111, 0, NULL((void *)0), NULL((void *)0) }, |
| 2725 | { "encode+", 0x0112, 0, NULL((void *)0), NULL((void *)0) }, |
| 2726 | { "encode-phys", 0x0113, 0, NULL((void *)0), NULL((void *)0) }, |
| 2727 | { "encode-string", 0x0114, 0, NULL((void *)0), NULL((void *)0) }, |
| 2728 | { "encode-bytes", 0x0115, 0, NULL((void *)0), NULL((void *)0) }, |
| 2729 | { "reg", 0x0116, 0, NULL((void *)0), NULL((void *)0) }, |
| 2730 | { "intr", 0x0117, 0, NULL((void *)0), NULL((void *)0) }, |
| 2731 | { "driver", 0x0118, 0, NULL((void *)0), NULL((void *)0) }, |
| 2732 | { "model", 0x0119, 0, NULL((void *)0), NULL((void *)0) }, |
| 2733 | { "device-type", 0x011a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2734 | { "parse-2int", 0x011b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2735 | { "is-install", 0x011c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2736 | { "is-remove", 0x011d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2737 | { "is-selftest", 0x011e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2738 | { "new-device", 0x011f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2739 | { "diagnostic-mode?", 0x0120, 0, NULL((void *)0), NULL((void *)0) }, |
| 2740 | { "display-status", 0x0121, 0, NULL((void *)0), NULL((void *)0) }, |
| 2741 | { "memory-test-suite", 0x0122, 0, NULL((void *)0), NULL((void *)0) }, |
| 2742 | { "group-code", 0x0123, 0, NULL((void *)0), NULL((void *)0) }, |
| 2743 | { "mask", 0x0124, 0, NULL((void *)0), NULL((void *)0) }, |
| 2744 | { "get-msecs", 0x0125, 0, NULL((void *)0), NULL((void *)0) }, |
| 2745 | { "ms", 0x0126, 0, NULL((void *)0), NULL((void *)0) }, |
| 2746 | { "finish-device", 0x0127, 0, NULL((void *)0), NULL((void *)0) }, |
| 2747 | { "decode-phys", 0x0128, 0, NULL((void *)0), NULL((void *)0) }, |
| 2748 | { "map-low", 0x0130, 0, NULL((void *)0), NULL((void *)0) }, |
| 2749 | { "sbus-intr>cpu", 0x0131, 0, NULL((void *)0), NULL((void *)0) }, |
| 2750 | { "#lines", 0x0150, 0, NULL((void *)0), NULL((void *)0) }, |
| 2751 | { "#columns", 0x0151, 0, NULL((void *)0), NULL((void *)0) }, |
| 2752 | { "line#", 0x0152, 0, NULL((void *)0), NULL((void *)0) }, |
| 2753 | { "column#", 0x0153, 0, NULL((void *)0), NULL((void *)0) }, |
| 2754 | { "inverse?", 0x0154, 0, NULL((void *)0), NULL((void *)0) }, |
| 2755 | { "inverse-screen?", 0x0155, 0, NULL((void *)0), NULL((void *)0) }, |
| 2756 | { "frame-buffer-busy?", 0x0156, 0, NULL((void *)0), NULL((void *)0) }, |
| 2757 | { "draw-character", 0x0157, 0, NULL((void *)0), NULL((void *)0) }, |
| 2758 | { "reset-screen", 0x0158, 0, NULL((void *)0), NULL((void *)0) }, |
| 2759 | { "toggle-cursor", 0x0159, 0, NULL((void *)0), NULL((void *)0) }, |
| 2760 | { "erase-screen", 0x015a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2761 | { "blink-screen", 0x015b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2762 | { "invert-screen", 0x015c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2763 | { "insert-characters", 0x015d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2764 | { "delete-characters", 0x015e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2765 | { "insert-lines", 0x015f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2766 | { "delete-lines", 0x0160, 0, NULL((void *)0), NULL((void *)0) }, |
| 2767 | { "draw-logo", 0x0161, 0, NULL((void *)0), NULL((void *)0) }, |
| 2768 | { "frame-buffer-addr", 0x0162, 0, NULL((void *)0), NULL((void *)0) }, |
| 2769 | { "screen-height", 0x0163, 0, NULL((void *)0), NULL((void *)0) }, |
| 2770 | { "screen-width", 0x0164, 0, NULL((void *)0), NULL((void *)0) }, |
| 2771 | { "window-top", 0x0165, 0, NULL((void *)0), NULL((void *)0) }, |
| 2772 | { "window-left", 0x0166, 0, NULL((void *)0), NULL((void *)0) }, |
| 2773 | { "default-font", 0x016a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2774 | { "set-font", 0x016b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2775 | { "char-height", 0x016c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2776 | { "char-width", 0x016d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2777 | { ">font", 0x016e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2778 | { "fontbytes", 0x016f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2779 | { "fb8-draw-character", 0x0180, 0, NULL((void *)0), NULL((void *)0) }, |
| 2780 | { "fb8-reset-screen", 0x0181, 0, NULL((void *)0), NULL((void *)0) }, |
| 2781 | { "fb8-toggle-cursor", 0x0182, 0, NULL((void *)0), NULL((void *)0) }, |
| 2782 | { "fb8-erase-screen", 0x0183, 0, NULL((void *)0), NULL((void *)0) }, |
| 2783 | { "fb8-blink-screen", 0x0184, 0, NULL((void *)0), NULL((void *)0) }, |
| 2784 | { "fb8-invert-screen", 0x0185, 0, NULL((void *)0), NULL((void *)0) }, |
| 2785 | { "fb8-insert-characters", 0x0186, 0, NULL((void *)0), NULL((void *)0) }, |
| 2786 | { "fb8-delete-characters", 0x0187, 0, NULL((void *)0), NULL((void *)0) }, |
| 2787 | { "fb8-inisert-lines", 0x0188, 0, NULL((void *)0), NULL((void *)0) }, |
| 2788 | { "fb8-delete-lines", 0x0189, 0, NULL((void *)0), NULL((void *)0) }, |
| 2789 | { "fb8-draw-logo", 0x018a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2790 | { "fb8-install", 0x018b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2791 | { "return-buffer", 0x01a0, 0, NULL((void *)0), NULL((void *)0) }, |
| 2792 | { "xmit-packet", 0x01a1, 0, NULL((void *)0), NULL((void *)0) }, |
| 2793 | { "poll-packet", 0x01a2, 0, NULL((void *)0), NULL((void *)0) }, |
| 2794 | { "mac-address", 0x01a4, 0, NULL((void *)0), NULL((void *)0) }, |
| 2795 | { "device-name", 0x0201, 0, NULL((void *)0), NULL((void *)0) }, |
| 2796 | { "my-args", 0x0202, 0, NULL((void *)0), NULL((void *)0) }, |
| 2797 | { "my-self", 0x0203, 0, NULL((void *)0), NULL((void *)0) }, |
| 2798 | { "find-package", 0x0204, 0, NULL((void *)0), NULL((void *)0) }, |
| 2799 | { "open-package", 0x0205, 0, NULL((void *)0), NULL((void *)0) }, |
| 2800 | { "close-package", 0x0206, 0, NULL((void *)0), NULL((void *)0) }, |
| 2801 | { "find-method", 0x0207, 0, NULL((void *)0), NULL((void *)0) }, |
| 2802 | { "call-package", 0x0208, 0, NULL((void *)0), NULL((void *)0) }, |
| 2803 | { "$call-parent", 0x0209, 0, NULL((void *)0), NULL((void *)0) }, |
| 2804 | { "my-parent", 0x020a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2805 | { "ihandle>phandle", 0x020b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2806 | { "my-unit", 0x020d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2807 | { "$call-method", 0x020e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2808 | { "$open-package", 0x020f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2809 | { "processor-type", 0x0210, 0, NULL((void *)0), NULL((void *)0) }, |
| 2810 | { "firmware-version", 0x0211, 0, NULL((void *)0), NULL((void *)0) }, |
| 2811 | { "fcode-version", 0x0212, 0, NULL((void *)0), NULL((void *)0) }, |
| 2812 | { "alarm", 0x0213, 0, NULL((void *)0), NULL((void *)0) }, |
| 2813 | { "(is-user-word)", 0x0214, 0, NULL((void *)0), NULL((void *)0) }, |
| 2814 | { "suspend-fcode", 0x0215, 0, NULL((void *)0), NULL((void *)0) }, |
| 2815 | { "abort", 0x0216, 0, NULL((void *)0), NULL((void *)0) }, |
| 2816 | { "catch", 0x0217, 0, NULL((void *)0), NULL((void *)0) }, |
| 2817 | { "throw", 0x0218, 0, NULL((void *)0), NULL((void *)0) }, |
| 2818 | { "user-abort", 0x0219, 0, NULL((void *)0), NULL((void *)0) }, |
| 2819 | { "get-my-property", 0x021a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2820 | { "decode-int", 0x021b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2821 | { "decode-string", 0x021c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2822 | { "get-inherited-property", 0x021d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2823 | { "delete-property", 0x021e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2824 | { "get-package-property", 0x021f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2825 | { "cpeek", 0x0220, 0, NULL((void *)0), NULL((void *)0) }, |
| 2826 | { "wpeek", 0x0221, 0, NULL((void *)0), NULL((void *)0) }, |
| 2827 | { "lpeek", 0x0222, 0, NULL((void *)0), NULL((void *)0) }, |
| 2828 | { "cpoke", 0x0223, 0, NULL((void *)0), NULL((void *)0) }, |
| 2829 | { "wpoke", 0x0224, 0, NULL((void *)0), NULL((void *)0) }, |
| 2830 | { "lpoke", 0x0225, 0, NULL((void *)0), NULL((void *)0) }, |
| 2831 | { "lwflip", 0x0226, 0, NULL((void *)0), NULL((void *)0) }, |
| 2832 | { "lbflip", 0x0227, 0, NULL((void *)0), NULL((void *)0) }, |
| 2833 | { "lbflips", 0x0228, 0, NULL((void *)0), NULL((void *)0) }, |
| 2834 | { "adr-mask", 0x0229, 0, NULL((void *)0), NULL((void *)0) }, |
| 2835 | { "rb@", 0x0230, 0, NULL((void *)0), NULL((void *)0) }, |
| 2836 | { "rb!", 0x0231, 0, NULL((void *)0), NULL((void *)0) }, |
| 2837 | { "rw@", 0x0232, 0, NULL((void *)0), NULL((void *)0) }, |
| 2838 | { "rw!", 0x0233, 0, NULL((void *)0), NULL((void *)0) }, |
| 2839 | { "rl@", 0x0234, 0, NULL((void *)0), NULL((void *)0) }, |
| 2840 | { "rl!", 0x0235, 0, NULL((void *)0), NULL((void *)0) }, |
| 2841 | { "wbflips", 0x0236, 0, NULL((void *)0), NULL((void *)0) }, |
| 2842 | { "lwflips", 0x0237, 0, NULL((void *)0), NULL((void *)0) }, |
| 2843 | { "probe", 0x0238, 0, NULL((void *)0), NULL((void *)0) }, |
| 2844 | { "probe-virtual", 0x0239, 0, NULL((void *)0), NULL((void *)0) }, |
| 2845 | { "child", 0x023b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2846 | { "peer", 0x023c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2847 | { "next-property", 0x023d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2848 | { "byte-load", 0x023e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2849 | { "set-args", 0x023f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2850 | { "left-parse-string", 0x0240, 0, NULL((void *)0), NULL((void *)0) }, |
| 2851 | /* 64-bit FCode extensions */ |
| 2852 | { "bxjoin", 0x0241, 0, NULL((void *)0), NULL((void *)0) }, |
| 2853 | { "<l@", 0x0242, 0, NULL((void *)0), NULL((void *)0) }, |
| 2854 | { "lxjoin", 0x0243, 0, NULL((void *)0), NULL((void *)0) }, |
| 2855 | { "rx@", 0x022e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2856 | { "rx!", 0x022f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2857 | { "wxjoin", 0x0244, 0, NULL((void *)0), NULL((void *)0) }, |
| 2858 | { "x,", 0x0245, 0, NULL((void *)0), NULL((void *)0) }, |
| 2859 | { "x@", 0x0246, 0, NULL((void *)0), NULL((void *)0) }, |
| 2860 | { "x!", 0x0247, 0, NULL((void *)0), NULL((void *)0) }, |
| 2861 | { "/x", 0x0248, 0, NULL((void *)0), NULL((void *)0) }, |
| 2862 | { "/x*", 0x0249, 0, NULL((void *)0), NULL((void *)0) }, |
| 2863 | { "xa+", 0x024a, 0, NULL((void *)0), NULL((void *)0) }, |
| 2864 | { "xa1+", 0x024b, 0, NULL((void *)0), NULL((void *)0) }, |
| 2865 | { "xbflip", 0x024c, 0, NULL((void *)0), NULL((void *)0) }, |
| 2866 | { "xbflips", 0x024d, 0, NULL((void *)0), NULL((void *)0) }, |
| 2867 | { "xbsplit", 0x024e, 0, NULL((void *)0), NULL((void *)0) }, |
| 2868 | { "xlflip", 0x024f, 0, NULL((void *)0), NULL((void *)0) }, |
| 2869 | { "xlflips", 0x0250, 0, NULL((void *)0), NULL((void *)0) }, |
| 2870 | { "xlsplit", 0x0251, 0, NULL((void *)0), NULL((void *)0) }, |
| 2871 | { "xwflip", 0x0252, 0, NULL((void *)0), NULL((void *)0) }, |
| 2872 | { "xwflips", 0x0253, 0, NULL((void *)0), NULL((void *)0) }, |
| 2873 | { "xwsplit", 0x0254, 0, NULL((void *)0), NULL((void *)0) }, |
| 2874 | { NULL((void *)0), 0, 0, NULL((void *)0), NULL((void *)0) } |
| 2875 | }; |
| 2876 | |
| 2877 | /* |
| 2878 | * Default macros -- can be overridden by colon definitions. |
| 2879 | */ |
| 2880 | static struct macro macros[] = { |
| 2881 | { "eval", "evaluate", 0, NULL((void *)0), NULL((void *)0) }, /* Build a more balanced tree */ |
| 2882 | { "(.)", "dup abs <# u#s swap sign u#>", 0, NULL((void *)0), NULL((void *)0) }, |
| 2883 | { "<<", "lshift", 0, NULL((void *)0), NULL((void *)0) }, |
| 2884 | { ">>", "rshift", 0, NULL((void *)0), NULL((void *)0) }, |
| 2885 | { "?", "@ .", 0, NULL((void *)0), NULL((void *)0) }, |
| 2886 | { "1+", "1 +", 0, NULL((void *)0), NULL((void *)0) }, |
| 2887 | { "1-", "1 -", 0, NULL((void *)0), NULL((void *)0) }, |
| 2888 | { "2+", "2 +", 0, NULL((void *)0), NULL((void *)0) }, |
| 2889 | { "2-", "2 -", 0, NULL((void *)0), NULL((void *)0) }, |
| 2890 | { "abort\"", "-2 throw", 0, NULL((void *)0), NULL((void *)0) }, |
| 2891 | { "accept", "span @ -rot expect span @ swap span !", 0, NULL((void *)0), NULL((void *)0) }, |
| 2892 | { "allot", "0 max 0 ?do 0 c, loop", 0, NULL((void *)0), NULL((void *)0) }, |
| 2893 | { "blank", "bl fill", 0, NULL((void *)0), NULL((void *)0) }, |
| 2894 | { "/c*", "chars", 0, NULL((void *)0), NULL((void *)0) }, |
| 2895 | { "ca1+", "char+", 0, NULL((void *)0), NULL((void *)0) }, |
| 2896 | { "carret", "b(lit) 00 00 00 h# 0d", 0, NULL((void *)0), NULL((void *)0) }, |
| 2897 | { ".d", "base @ swap d# 0a base ! . base !", 0, NULL((void *)0), NULL((void *)0) }, |
| 2898 | { "decode-bytes", ">r over r@ + swap r@ - rot r>", 0, NULL((void *)0), NULL((void *)0) }, |
| 2899 | { "3drop", "drop 2drop", 0, NULL((void *)0), NULL((void *)0) }, |
| 2900 | { "3dup", "2 pick 2 pick 2 pick", 0, NULL((void *)0), NULL((void *)0) }, |
| 2901 | { "erase", "0 fill", 0, NULL((void *)0), NULL((void *)0) }, |
| 2902 | { "false", "0", 0, NULL((void *)0), NULL((void *)0) }, |
| 2903 | { ".h", "base @ swap d# 10 base ! . base !", 0, NULL((void *)0), NULL((void *)0) }, |
| 2904 | { "linefeed", "b(lit) 00 00 00 d# 0a", 0, NULL((void *)0), NULL((void *)0) }, |
| 2905 | { "/n*", "cells", 0, NULL((void *)0), NULL((void *)0) }, |
| 2906 | { "na1+", "cell+", 0, NULL((void *)0), NULL((void *)0) }, |
| 2907 | { "not", "invert", 0, NULL((void *)0), NULL((void *)0) }, |
| 2908 | { "s.", "(.) type space", 0, NULL((void *)0), NULL((void *)0) }, |
| 2909 | { "space", "bl emit", 0, NULL((void *)0), NULL((void *)0) }, |
| 2910 | { "spaces", "0 max 0 ?do space loop", 0, NULL((void *)0), NULL((void *)0) }, |
| 2911 | { "struct", "0", 0, NULL((void *)0), NULL((void *)0) }, |
| 2912 | { "true", "-1", 0, NULL((void *)0), NULL((void *)0) }, |
| 2913 | { "(u,)", "<# u#s u#>", 0, NULL((void *)0), NULL((void *)0) }, |
| 2914 | { NULL((void *)0), NULL((void *)0), 0, NULL((void *)0), NULL((void *)0) } |
| 2915 | }; |
| 2916 | |
| 2917 | /* |
| 2918 | * Utility functions. |
| 2919 | */ |
| 2920 | |
| 2921 | /* |
| 2922 | * ASCII -> long int converter, eats `.'s |
| 2923 | */ |
| 2924 | #define strtol(x, y, z)cvt(x, y, z) cvt(x, y, z) |
| 2925 | static Cell |
| 2926 | cvt(const char *s, char **e, int base) |
| 2927 | { |
| 2928 | Cell v = 0; |
| 2929 | int c, n = 0; |
| 2930 | |
| 2931 | c = *s; |
| 2932 | if (c == '-') { n = 1; s++; } |
| 2933 | |
| 2934 | for (c = *s; (c = *s); s++) { |
Value stored to 'c' is never read | |
| 2935 | |
| 2936 | /* Ignore `.' */ |
| 2937 | if (c == '.') |
| 2938 | continue; |
| 2939 | if (c >= '0' && c <= '9') |
| 2940 | c -= '0'; |
| 2941 | else if (c >= 'a' && c <= 'f') |
| 2942 | c += 10 - 'a'; |
| 2943 | else if (c >= 'A' && c <= 'F') |
| 2944 | c += 10 - 'A'; |
| 2945 | if (c >= base) |
| 2946 | break; |
| 2947 | v *= base; |
| 2948 | v += c; |
| 2949 | } |
| 2950 | if (e) |
| 2951 | *e = (char *)s; |
| 2952 | if (n) |
| 2953 | return (-v); |
| 2954 | return (v); |
| 2955 | } |
| 2956 | |
| 2957 | /* |
| 2958 | * Parser stack control functions. |
| 2959 | */ |
| 2960 | |
| 2961 | static void |
| 2962 | push(Cell val) |
| 2963 | { |
| 2964 | if (debug > 1) |
| 2965 | printf("push %lx\n", (long)val); |
| 2966 | parse_stack[parse_stack_ptr++] = val; |
| 2967 | if (parse_stack_ptr >= PSTKSIZ1024) |
| 2968 | errx(EXIT_FAILURE1, "Parse stack overflow"); |
| 2969 | } |
| 2970 | |
| 2971 | static Cell |
| 2972 | pop(void) |
| 2973 | { |
| 2974 | ASSERTif (debug) ((parse_stack_ptr) ? (void)0 : __assert2("/usr/src/usr.bin/fgen/fgen.l" , 819, __func__, "parse_stack_ptr"))(parse_stack_ptr); |
| 2975 | if (debug > 1) |
| 2976 | printf("pop %lx\n", (long)parse_stack[parse_stack_ptr-1]); |
| 2977 | return parse_stack[--parse_stack_ptr]; |
| 2978 | } |
| 2979 | |
| 2980 | static int |
| 2981 | depth(void) |
| 2982 | { |
| 2983 | return (parse_stack_ptr); |
| 2984 | } |
| 2985 | |
| 2986 | /* |
| 2987 | * Insert fcode into dictionary. |
| 2988 | */ |
| 2989 | static int |
| 2990 | fadd(struct fcode *dict, struct fcode *new) |
| 2991 | { |
| 2992 | int res = strcmp(dict->name, new->name); |
| 2993 | |
| 2994 | new->type = FCODE0x000FC0DE; |
| 2995 | ASSERTif (debug) ((dict->type == 0x000FC0DE) ? (void)0 : __assert2 ("/usr/src/usr.bin/fgen/fgen.l", 840, __func__, "dict->type == FCODE" ))(dict->type == FCODE); |
| 2996 | if (!res) { |
| 2997 | /* |
| 2998 | * Duplicate entry. Give the old name the new FCode |
| 2999 | * number. |
| 3000 | */ |
| 3001 | dict->num = new->num; |
| 3002 | return (0); |
| 3003 | } |
| 3004 | if (res < 0) { |
| 3005 | if (dict->l) |
| 3006 | return fadd(dict->l, new); |
| 3007 | else { |
| 3008 | if (debug > 5) |
| 3009 | printf("fadd: new FCode `%s' is %lx\n", |
| 3010 | new->name, new->num); |
| 3011 | new->l = new->r = NULL((void *)0); |
| 3012 | dict->l = new; |
| 3013 | } |
| 3014 | } else { |
| 3015 | if (dict->r) |
| 3016 | return fadd(dict->r, new); |
| 3017 | else { |
| 3018 | if (debug > 5) |
| 3019 | printf("fadd: new FCode `%s' is %lx\n", |
| 3020 | new->name, new->num); |
| 3021 | new->l = new->r = NULL((void *)0); |
| 3022 | dict->r = new; |
| 3023 | } |
| 3024 | } |
| 3025 | return (1); |
| 3026 | } |
| 3027 | |
| 3028 | /* |
| 3029 | * Look for a code in the dictionary. |
| 3030 | */ |
| 3031 | static struct fcode * |
| 3032 | flookup(struct fcode *dict, const char *str) |
| 3033 | { |
| 3034 | int res; |
| 3035 | if (!dict) return (dict); |
| 3036 | |
| 3037 | res = strcmp(dict->name, str); |
| 3038 | ASSERTif (debug) ((dict->type == 0x000FC0DE) ? (void)0 : __assert2 ("/usr/src/usr.bin/fgen/fgen.l", 883, __func__, "dict->type == FCODE" ))(dict->type == FCODE); |
| 3039 | if (debug > 5) |
| 3040 | printf("flookup: `%s' and `%s' %s match\n", |
| 3041 | str, dict->name, res?"don't":"do"); |
| 3042 | if (!res) return (dict); |
| 3043 | if (res < 0) |
| 3044 | return (flookup(dict->l, str)); |
| 3045 | else |
| 3046 | return (flookup(dict->r, str)); |
| 3047 | |
| 3048 | } |
| 3049 | |
| 3050 | /* |
| 3051 | * Insert alias into macros. |
| 3052 | */ |
| 3053 | static int |
| 3054 | aadd(struct macro *dict, struct macro *new) |
| 3055 | { |
| 3056 | int res = strcmp(dict->name, new->name); |
| 3057 | |
| 3058 | new->type = MACRO0x0000F00D; |
| 3059 | ASSERTif (debug) ((dict->type == 0x0000F00D) ? (void)0 : __assert2 ("/usr/src/usr.bin/fgen/fgen.l", 904, __func__, "dict->type == MACRO" ))(dict->type == MACRO); |
| 3060 | if (!res) { |
| 3061 | /* Duplicate name. Replace the old macro */ |
| 3062 | dict->equiv = new->equiv; |
| 3063 | /* We can't free the old equiv since it may be static data. */ |
| 3064 | return (0); |
| 3065 | } |
| 3066 | if (res < 0) { |
| 3067 | if (dict->l) |
| 3068 | return aadd(dict->l, new); |
| 3069 | else { |
| 3070 | new->l = new->r = NULL((void *)0); |
| 3071 | dict->l = new; |
| 3072 | if (debug > 5) |
| 3073 | printf("aadd: new alias `%s' to `%s'\n", |
| 3074 | new->name, new->equiv); |
| 3075 | } |
| 3076 | } else { |
| 3077 | if (dict->r) |
| 3078 | return aadd(dict->r, new); |
| 3079 | else { |
| 3080 | new->l = new->r = NULL((void *)0); |
| 3081 | dict->r = new; |
| 3082 | if (debug > 5) |
| 3083 | printf("aadd: new alias `%s' to `%s'\n", |
| 3084 | new->name, new->equiv); |
| 3085 | } |
| 3086 | } |
| 3087 | return (1); |
| 3088 | } |
| 3089 | |
| 3090 | /* |
| 3091 | * Look for a macro in the aliases. |
| 3092 | */ |
| 3093 | static struct macro * |
| 3094 | alookup(struct macro *dict, const char *str) |
| 3095 | { |
| 3096 | int res; |
| 3097 | if (!dict) return (dict); |
| 3098 | |
| 3099 | ASSERTif (debug) ((dict->type == 0x0000F00D) ? (void)0 : __assert2 ("/usr/src/usr.bin/fgen/fgen.l", 944, __func__, "dict->type == MACRO" ))(dict->type == MACRO); |
| 3100 | res = strcmp(dict->name, str); |
| 3101 | if (!res) return (dict); |
| 3102 | if (res < 0) |
| 3103 | return (alookup(dict->l, str)); |
| 3104 | else |
| 3105 | return (alookup(dict->r, str)); |
| 3106 | |
| 3107 | } |
| 3108 | |
| 3109 | /* |
| 3110 | * Bootstrap the dictionary and then install |
| 3111 | * all the standard FCodes. |
| 3112 | */ |
| 3113 | static void |
| 3114 | initdic(void) |
| 3115 | { |
| 3116 | struct fcode *code = fcodes; |
| 3117 | struct macro *alias = macros; |
| 3118 | |
| 3119 | ASSERTif (debug) ((dictionary == ((void *)0)) ? (void)0 : __assert2 ("/usr/src/usr.bin/fgen/fgen.l", 964, __func__, "dictionary == NULL" ))(dictionary == NULL); |
| 3120 | code->l = code->r = NULL((void *)0); |
| 3121 | dictionary = code; |
| 3122 | code->type = FCODE0x000FC0DE; |
| 3123 | |
| 3124 | while ((++code)->name) { |
| 3125 | if(!fadd(dictionary, code)) { |
| 3126 | warnx("%s: duplicate dictionary entry `%s'", __func__, |
| 3127 | code->name); |
| 3128 | } |
| 3129 | } |
| 3130 | |
| 3131 | ASSERTif (debug) ((aliases == ((void *)0)) ? (void)0 : __assert2("/usr/src/usr.bin/fgen/fgen.l" , 976, __func__, "aliases == NULL"))(aliases == NULL); |
| 3132 | aliases = alias; |
| 3133 | alias->l = alias->r = NULL((void *)0); |
| 3134 | alias->type = MACRO0x0000F00D; |
| 3135 | while ((++alias)->name) { |
| 3136 | if(!aadd(aliases, alias)) { |
| 3137 | warnx("%s: duplicate macro entry `%s'", __func__, |
| 3138 | alias->name); |
| 3139 | } |
| 3140 | } |
| 3141 | |
| 3142 | } |
| 3143 | |
| 3144 | static int |
| 3145 | apply_macros(YY_BUFFER_STATE yinput, const char *str) |
| 3146 | { |
| 3147 | struct macro *xform = alookup(aliases, str); |
| 3148 | |
| 3149 | if (xform) { |
| 3150 | YY_BUFFER_STATE newbuf; |
| 3151 | |
| 3152 | if (debug > 1) |
| 3153 | printf("Expanding %s to %s\n", str, xform->equiv); |
| 3154 | |
| 3155 | newbuf = yy_scan_string(xform->equiv); |
| 3156 | yy_switch_to_buffer(newbuf); |
| 3157 | tokenize(newbuf); |
| 3158 | yy_switch_to_buffer(yinput); |
| 3159 | yy_delete_buffer(newbuf); |
| 3160 | } |
| 3161 | return (xform != NULL((void *)0)); |
| 3162 | } |
| 3163 | |
| 3164 | static void |
| 3165 | usage(void) |
| 3166 | { |
| 3167 | (void)fprintf(stderr(&__sF[2]), "%s: [-d level] [-o outfile] <infile>\n", |
| 3168 | getprogname()); |
| 3169 | exit(EXIT_FAILURE1); |
| 3170 | } |
| 3171 | |
| 3172 | int |
| 3173 | main(int argc, char *argv[]) |
| 3174 | { |
| 3175 | int ch; |
| 3176 | FILE *inf; |
| 3177 | struct fcode_header *fheader; |
| 3178 | YY_BUFFER_STATE inbuf; |
| 3179 | const char *hdrtype = "version1"; |
| 3180 | int i; |
| 3181 | |
| 3182 | outf = 1; /* stdout */ |
| 3183 | |
| 3184 | while ((ch = getopt(argc, argv, "d:o:")) != -1) |
| 3185 | switch(ch) { |
| 3186 | case 'd': |
| 3187 | mark_fload = 1; |
| 3188 | debug = atol(optarg); |
| 3189 | break; |
| 3190 | case 'o': |
| 3191 | outfile = optarg; |
| 3192 | break; |
| 3193 | default: |
| 3194 | usage(); |
| 3195 | } |
| 3196 | argc -= optind; |
| 3197 | argv += optind; |
| 3198 | |
| 3199 | if (argc != 1) |
| 3200 | usage(); |
| 3201 | |
| 3202 | infile = argv[0]; |
| 3203 | |
| 3204 | /* |
| 3205 | * Initialization stuff. |
| 3206 | */ |
| 3207 | initdic(); |
| 3208 | outbufsiz = BUFCLICK(1024*1024); |
| 3209 | fheader = emalloc(outbufsiz); |
| 3210 | outbuf = (void *)fheader; |
| 3211 | outpos = 0; |
| 3212 | emit(hdrtype); |
| 3213 | outpos = sizeof(*fheader); |
| 3214 | |
| 3215 | /* |
| 3216 | * Do it. |
| 3217 | */ |
| 3218 | if ((inf = fopen(infile, "r")) == NULL((void *)0)) |
| 3219 | err(EXIT_FAILURE1, "Cannot open `%s'", infile); |
| 3220 | |
| 3221 | inbuf = yy_create_buffer(inf,YY_BUF_SIZE16384); |
| 3222 | yy_switch_to_buffer(inbuf); |
| 3223 | tokenize(inbuf); |
| 3224 | yy_delete_buffer(inbuf); |
| 3225 | fclose(inf); |
| 3226 | if (need_end0) emit("end0"); |
| 3227 | |
| 3228 | /* Now calculate length and checksum and stick them in the header */ |
| 3229 | fheader->format = 0x08; |
| 3230 | fheader->length = htonl(outpos)(__uint32_t)(__builtin_constant_p(outpos) ? (__uint32_t)(((__uint32_t )(outpos) & 0xff) << 24 | ((__uint32_t)(outpos) & 0xff00) << 8 | ((__uint32_t)(outpos) & 0xff0000) >> 8 | ((__uint32_t)(outpos) & 0xff000000) >> 24) : __swap32md (outpos)); |
| 3231 | fheader->checksum = 0; |
| 3232 | for (i = sizeof(*fheader); i<outpos; i++) |
| 3233 | fheader->checksum += (unsigned char)outbuf[i]; |
| 3234 | fheader->checksum = htons(fheader->checksum)(__uint16_t)(__builtin_constant_p(fheader->checksum) ? (__uint16_t )(((__uint16_t)(fheader->checksum) & 0xffU) << 8 | ((__uint16_t)(fheader->checksum) & 0xff00U) >> 8) : __swap16md(fheader->checksum)); |
| 3235 | |
| 3236 | if ((outf = open(outfile, O_WRONLY0x0001|O_CREAT0x0200|O_TRUNC0x0400, 0666)) == -1) |
| 3237 | err(EXIT_FAILURE1, "Cannot open `%s'", outfile); |
| 3238 | |
| 3239 | if (write(outf, outbuf, outpos) != outpos) { |
| 3240 | int serrno = errno(*__errno()); |
| 3241 | close(outf); |
| 3242 | unlink(outfile); |
| 3243 | errc(EXIT_FAILURE1, serrno, "write error"); |
| 3244 | } |
| 3245 | close(outf); |
| 3246 | return EXIT_SUCCESS0; |
| 3247 | }; |
| 3248 | |
| 3249 | /* |
| 3250 | * Tokenize one file. This is a separate function so it can |
| 3251 | * be called recursively to parse mutiple levels of include files. |
| 3252 | */ |
| 3253 | |
| 3254 | static void |
| 3255 | tokenize(YY_BUFFER_STATE yinput) |
| 3256 | { |
| 3257 | FILE *inf; |
| 3258 | YY_BUFFER_STATE inbuf; |
| 3259 | TOKENstruct tok *token; |
| 3260 | const char *last_token = ""; |
| 3261 | struct fcode *fcode; |
| 3262 | int pos, off; |
| 3263 | |
| 3264 | while ((token = yylex()) != NULL((void *)0)) { |
| 3265 | switch (token->type) { |
| 3266 | case TOK_NUMBER: |
| 3267 | STATE(token->text, "TOK_NUMBER")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_NUMBER" , token->text); } while (0); |
| 3268 | { |
| 3269 | char *end; |
| 3270 | Cell value; |
| 3271 | |
| 3272 | if (tokenizer) { |
| 3273 | push(strtol(token->text, &end, 16)cvt(token->text, &end, 16)); |
| 3274 | break; |
| 3275 | } |
| 3276 | value = strtol(token->text, &end, numbase)cvt(token->text, &end, numbase); |
| 3277 | if (*end != 0) |
| 3278 | token_err(yylineno, infile, yytext, |
| 3279 | "illegal number conversion"); |
| 3280 | |
| 3281 | /* |
| 3282 | * If this is a 64-bit value we need to store two literals |
| 3283 | * and issue a `lxjoin' to combine them. But that's a future |
| 3284 | * project. |
| 3285 | */ |
| 3286 | emit("b(lit)"); |
| 3287 | spit((value>>24)&0x0ff); |
| 3288 | spit((value>>16)&0x0ff); |
| 3289 | spit((value>>8)&0x0ff); |
| 3290 | spit(value&0x0ff); |
| 3291 | if ((value>>32) != value && (value>>32) != 0 && |
| 3292 | (value>>32) != -1) { |
| 3293 | emit("b(lit)"); |
| 3294 | spit((value>>56)&0x0ff); |
| 3295 | spit((value>>48)&0x0ff); |
| 3296 | spit((value>>40)&0x0ff); |
| 3297 | spit((value>>32)&0x0ff); |
| 3298 | emit("lxjoin"); |
| 3299 | } |
| 3300 | } |
| 3301 | break; |
| 3302 | case TOK_C_LIT: |
| 3303 | STATE(token->text, "TOK_C_LIT")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_C_LIT" , token->text); } while (0); |
| 3304 | emit("b(lit)"); |
| 3305 | spit(0); |
| 3306 | spit(0); |
| 3307 | spit(0); |
| 3308 | spit(token->text[1]); |
| 3309 | break; |
| 3310 | case TOK_STRING_LIT: |
| 3311 | STATE(token->text, "TOK_STRING_LIT:")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_STRING_LIT:" , token->text); } while (0); |
| 3312 | { |
| 3313 | size_t len; |
| 3314 | char *p = token->text; |
| 3315 | |
| 3316 | ++p; /* Skip the quote */ |
| 3317 | len = strlen(++p); /* Skip the 1st space */ |
| 3318 | |
| 3319 | #define ERR_TOOLONGtoken_err(yylineno, infile, yytext, "string length %zu too long" , len) \ |
| 3320 | token_err(yylineno, infile, yytext, "string length %zu too long", len) |
| 3321 | |
| 3322 | if (len > 255) |
| 3323 | ERR_TOOLONGtoken_err(yylineno, infile, yytext, "string length %zu too long" , len); |
| 3324 | |
| 3325 | if (p[len-1] == ')' || |
| 3326 | p[len-1] == '"') { |
| 3327 | p[len-1] = 0; |
| 3328 | } |
| 3329 | emit("b(\")"); |
| 3330 | sspit(p); |
| 3331 | } |
| 3332 | break; |
| 3333 | case TOK_PSTRING: |
| 3334 | STATE(token->text, "TOK_PSTRING:")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_PSTRING:" , token->text); } while (0); |
| 3335 | { |
| 3336 | size_t len; |
| 3337 | char *p = token->text; |
| 3338 | |
| 3339 | if (*p++ == '.') p++; /* Skip over delimiter */ |
| 3340 | p++; /* Skip over space/tab */ |
| 3341 | |
| 3342 | len = strlen(p); |
| 3343 | if (len > 255) |
| 3344 | ERR_TOOLONGtoken_err(yylineno, infile, yytext, "string length %zu too long" , len); |
| 3345 | |
| 3346 | if (p[len-1] == ')' || |
| 3347 | p[len-1] == '"') { |
| 3348 | p[len-1] = 0; |
| 3349 | } |
| 3350 | emit("b(\")"); |
| 3351 | sspit(p); |
| 3352 | emit("type"); |
| 3353 | } |
| 3354 | break; |
| 3355 | case TOK_ABORT_S: |
| 3356 | STATE(token->text, "TOK_PSTRING:")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_PSTRING:" , token->text); } while (0); |
| 3357 | { |
| 3358 | size_t len; |
| 3359 | Cell value = -2; |
| 3360 | char *p = token->text; |
| 3361 | |
| 3362 | while (*p++ != ' '); /* Skip to the string */ |
| 3363 | |
| 3364 | len = strlen(p); |
| 3365 | if (len > 255) |
| 3366 | ERR_TOOLONGtoken_err(yylineno, infile, yytext, "string length %zu too long" , len); |
| 3367 | |
| 3368 | if (p[len-1] == '"') { |
| 3369 | p[len-1] = 0; |
| 3370 | } |
| 3371 | emit("b?branch"); |
| 3372 | push(outpos); |
| 3373 | offspit(0); |
| 3374 | emit("b(\")"); |
| 3375 | sspit(p); |
| 3376 | emit("type"); |
| 3377 | emit("cr"); |
| 3378 | emit("b(lit)"); |
| 3379 | spit((value>>24)&0x0ff); |
| 3380 | spit((value>>16)&0x0ff); |
| 3381 | spit((value>>8)&0x0ff); |
| 3382 | spit(value&0x0ff); |
| 3383 | emit("throw"); |
| 3384 | emit("b(>resolve)"); |
| 3385 | pos = outpos; |
| 3386 | outpos = pop(); |
| 3387 | off = pos - outpos; |
| 3388 | offspit(off); |
| 3389 | outpos = pos; |
| 3390 | } |
| 3391 | break; |
| 3392 | |
| 3393 | case TOK_TOKENIZE: |
| 3394 | STATE(token->text, "TOK_TOKENIZE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_TOKENIZE" , token->text); } while (0); |
| 3395 | /* The next pass should tokenize the FCODE number */ |
| 3396 | emit("b(')"); |
| 3397 | break; |
| 3398 | case TOK_COMMENT: |
| 3399 | STATE(token->text, "TOK_COMMENT:")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_COMMENT:" , token->text); } while (0); |
| 3400 | do { |
| 3401 | off = input(); |
| 3402 | } while ((off != ')') && (off != '\n') && |
| 3403 | (off != EOF(-1))); |
| 3404 | break; |
| 3405 | case TOK_COLON: |
| 3406 | STATE(token->text, "TOK_COLON:")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_COLON:" , token->text); } while (0); |
| 3407 | |
| 3408 | token = yylex(); |
| 3409 | if (token == NULL((void *)0)) |
| 3410 | token_err(yylineno, infile, yytext, |
| 3411 | "EOF in colon definition"); |
| 3412 | |
| 3413 | /* Add new code to dictionary */ |
| 3414 | fcode = emalloc(sizeof(*fcode)); |
| 3415 | fcode->num = nextfcode++; |
| 3416 | fcode->name = estrdup(token->text); |
| 3417 | if (!fadd(dictionary, fcode)) { |
| 3418 | /* Duplicate definition. Free the memory. */ |
| 3419 | if (debug) |
| 3420 | printf("%s: duplicate FCode\n", |
| 3421 | token->text); |
| 3422 | free((void *)fcode->name); |
| 3423 | free(fcode); |
| 3424 | } |
| 3425 | if (debug) |
| 3426 | printf("Adding %s to dictionary\n", token->text); |
| 3427 | if (state == 0) |
| 3428 | emit("new-token"); |
| 3429 | else { |
| 3430 | if (state == TOK_EXTERNAL) |
| 3431 | emit("external-token"); |
| 3432 | else |
| 3433 | /* Here we have a choice of new-token or named-token */ |
| 3434 | emit("named-token"); |
| 3435 | sspit(token->text); |
| 3436 | } |
| 3437 | spit(fcode->num); |
| 3438 | emit("b(:)"); |
| 3439 | last_token = fcode->name; |
| 3440 | defining = 1; |
| 3441 | break; |
| 3442 | case TOK_SEMICOLON: |
| 3443 | STATE(token->text, "TOK_SEMICOLON:")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_SEMICOLON:" , token->text); } while (0); |
| 3444 | emit("b(;)"); |
| 3445 | defining = 0; |
| 3446 | if (depth()) { |
| 3447 | token_err(yylineno, infile, NULL((void *)0), |
| 3448 | "Warning: stack depth %d at end of %s\n", |
| 3449 | depth(), last_token); |
| 3450 | } |
| 3451 | last_token = ""; |
| 3452 | break; |
| 3453 | |
| 3454 | /* These are special */ |
| 3455 | case TOK_AGAIN: |
| 3456 | STATE(token->text, "TOK_AGAIN")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_AGAIN" , token->text); } while (0); |
| 3457 | emit("bbranch"); |
| 3458 | pos = pop(); |
| 3459 | pos = pos - outpos; |
| 3460 | offspit(pos); |
| 3461 | break; |
| 3462 | case TOK_ALIAS: |
| 3463 | STATE(token->text, "TOK_ALIAS")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_ALIAS" , token->text); } while (0); |
| 3464 | { |
| 3465 | struct macro *alias; |
| 3466 | |
| 3467 | token = yylex(); |
| 3468 | if (token == NULL((void *)0)) { |
| 3469 | warnx("EOF in alias definition"); |
| 3470 | return; |
| 3471 | } |
| 3472 | if (token->type != TOK_OTHER) { |
| 3473 | warnx("ENDCOMMENT aliasing weird token type %d", |
| 3474 | token->type); |
| 3475 | } |
| 3476 | alias = emalloc(sizeof(*alias)); |
| 3477 | alias->name = estrdup(token->text); |
| 3478 | token = yylex(); |
| 3479 | if (token == NULL((void *)0)) { |
| 3480 | warnx("EOF in alias definition"); |
| 3481 | free((void *)alias->name); |
| 3482 | free(alias); |
| 3483 | return; |
| 3484 | } |
| 3485 | alias->equiv = estrdup(token->text); |
| 3486 | if (!aadd(aliases, alias)) { |
| 3487 | free((void *)alias->name); |
| 3488 | free(alias); |
| 3489 | } |
| 3490 | } |
| 3491 | break; |
| 3492 | case TOK_GETTOKEN: |
| 3493 | STATE(token->text, "TOK_GETTOKEN")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_GETTOKEN" , token->text); } while (0); |
| 3494 | /* This is caused by ['] */ |
| 3495 | emit("b(')"); |
| 3496 | token = yylex(); |
| 3497 | if (token == NULL((void *)0)) { |
| 3498 | warnx("EOF in [']"); |
| 3499 | return; |
| 3500 | } |
| 3501 | if ((fcode = flookup(dictionary, token->text)) == NULL((void *)0)) |
| 3502 | errx(EXIT_FAILURE1, "[']: %s not found", |
| 3503 | token->text); |
| 3504 | spit(fcode->num); |
| 3505 | break; |
| 3506 | case TOK_ASCII: |
| 3507 | STATE(token->text, "TOK_ASCII")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_ASCII" , token->text); } while (0); |
| 3508 | token = yylex(); |
| 3509 | if (token == NULL((void *)0)) |
| 3510 | errx(EXIT_FAILURE1, "EOF after \"ascii\""); |
| 3511 | emit("b(lit)"); |
| 3512 | spit(0); |
| 3513 | spit(0); |
| 3514 | spit(0); |
| 3515 | spit(token->text[0]); |
| 3516 | break; |
| 3517 | case TOK_BEGIN: |
| 3518 | STATE(token->text, "TOK_BEGIN")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_BEGIN" , token->text); } while (0); |
| 3519 | emit("b(<mark)"); |
| 3520 | push(outpos); |
| 3521 | break; |
| 3522 | case TOK_BUFFER: |
| 3523 | STATE(token->text, "TOK_BUFFER")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_BUFFER" , token->text); } while (0); |
| 3524 | |
| 3525 | token = yylex(); |
| 3526 | if (token == NULL((void *)0)) { |
| 3527 | warnx("EOF in colon definition"); |
| 3528 | return; |
| 3529 | } |
| 3530 | |
| 3531 | /* Add new code to dictionary */ |
| 3532 | fcode = emalloc(sizeof(*fcode)); |
| 3533 | fcode->num = nextfcode++; |
| 3534 | fcode->name = estrdup(token->text); |
| 3535 | fadd(dictionary, fcode); |
| 3536 | |
| 3537 | if (state == 0) |
| 3538 | emit("new-token"); |
| 3539 | else { |
| 3540 | if (state == TOK_EXTERNAL) |
| 3541 | emit("external-token"); |
| 3542 | else |
| 3543 | /* Here we have a choice of new-token or named-token */ |
| 3544 | emit("named-token"); |
| 3545 | sspit(token->text); |
| 3546 | } |
| 3547 | spit(fcode->num); |
| 3548 | emit("b(buffer:)"); |
| 3549 | break; |
| 3550 | case TOK_CASE: |
| 3551 | STATE(token->text, "TOK_CASE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_CASE" , token->text); } while (0); |
| 3552 | emit("b(case)"); |
| 3553 | push(0); |
| 3554 | break; |
| 3555 | case TOK_CONSTANT: |
| 3556 | STATE(token->text, "TOK_CONSTANT")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_CONSTANT" , token->text); } while (0); |
| 3557 | |
| 3558 | token = yylex(); |
| 3559 | if (token == NULL((void *)0)) { |
| 3560 | warnx("EOF in constant definition"); |
| 3561 | return; |
| 3562 | } |
| 3563 | |
| 3564 | /* Add new code to dictionary */ |
| 3565 | fcode = emalloc(sizeof(*fcode)); |
| 3566 | fcode->num = nextfcode++; |
| 3567 | fcode->name = estrdup(token->text); |
| 3568 | fadd(dictionary, fcode); |
| 3569 | |
| 3570 | if (state == 0) |
| 3571 | emit("new-token"); |
| 3572 | else { |
| 3573 | if (state == TOK_EXTERNAL) |
| 3574 | emit("external-token"); |
| 3575 | else |
| 3576 | /* Here we have a choice of new-token or named-token */ |
| 3577 | emit("named-token"); |
| 3578 | sspit(token->text); |
| 3579 | } |
| 3580 | spit(fcode->num); |
| 3581 | emit("b(constant)"); |
| 3582 | break; |
| 3583 | case TOK_CONTROL: |
| 3584 | STATE(token->text, "TOK_CONTROL")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_CONTROL" , token->text); } while (0); |
| 3585 | token = yylex(); |
| 3586 | if (token == NULL((void *)0)) |
| 3587 | errx(EXIT_FAILURE1, "EOF after \"ascii\""); |
| 3588 | emit("b(lit)"); |
| 3589 | spit(0); |
| 3590 | spit(0); |
| 3591 | spit(0); |
| 3592 | spit(token->text[0]&0x1f); |
| 3593 | break; |
| 3594 | case TOK_CREATE: |
| 3595 | STATE(token->text, "TOK_CREATE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_CREATE" , token->text); } while (0); |
| 3596 | /* Don't know what this does or if it's right */ |
| 3597 | token = yylex(); |
| 3598 | if (token == NULL((void *)0)) { |
| 3599 | warnx("EOF in create definition"); |
| 3600 | return; |
| 3601 | } |
| 3602 | |
| 3603 | /* Add new code to dictionary */ |
| 3604 | fcode = emalloc(sizeof(*fcode)); |
| 3605 | fcode->num = nextfcode++; |
| 3606 | fcode->name = estrdup(token->text); |
| 3607 | fadd(dictionary, fcode); |
| 3608 | |
| 3609 | if (state == 0) |
| 3610 | emit("new-token"); |
| 3611 | else { |
| 3612 | if (state == TOK_EXTERNAL) |
| 3613 | emit("external-token"); |
| 3614 | else |
| 3615 | /* Here we have a choice of new-token or named-token */ |
| 3616 | emit("named-token"); |
| 3617 | sspit(token->text); |
| 3618 | } |
| 3619 | spit(fcode->num); |
| 3620 | emit("b(create)"); |
| 3621 | break; |
| 3622 | case TOK_DECIMAL: |
| 3623 | STATE(token->text, "TOK_DECIMAL")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_DECIMAL" , token->text); } while (0); |
| 3624 | if (token->text[1] != '#') { |
| 3625 | if (defining) { |
| 3626 | emit("b(lit)"); |
| 3627 | spit(0); |
| 3628 | spit(0); |
| 3629 | spit(0); |
| 3630 | spit(10); |
| 3631 | emit("base"); |
| 3632 | emit("!"); |
| 3633 | } else |
| 3634 | numbase = TOK_DECIMAL; |
| 3635 | } else { |
| 3636 | char *end; |
| 3637 | Cell value; |
| 3638 | |
| 3639 | token = yylex(); |
| 3640 | if (token == NULL((void *)0)) { |
| 3641 | warnx("EOF after d#"); |
| 3642 | return; |
| 3643 | } |
| 3644 | if (token->type == TOK_OTHER) { |
| 3645 | if (strcmp("-1", token->text) == 0) { |
| 3646 | emit(token->text); |
| 3647 | break; |
| 3648 | } |
| 3649 | } |
| 3650 | value = strtol(token->text, &end, 10)cvt(token->text, &end, 10); |
| 3651 | if (*end != 0) |
| 3652 | token_err(yylineno, infile, NULL((void *)0), |
| 3653 | "Illegal number conversion: %s", token->text); |
| 3654 | |
| 3655 | /* |
| 3656 | * If this is a 64-bit value we need to store two literals |
| 3657 | * and issue a `lxjoin' to combine them. But that's a future |
| 3658 | * project. |
| 3659 | */ |
| 3660 | emit("b(lit)"); |
| 3661 | spit((value>>24)&0x0ff); |
| 3662 | spit((value>>16)&0x0ff); |
| 3663 | spit((value>>8)&0x0ff); |
| 3664 | spit(value&0x0ff); |
| 3665 | if ((value>>32) != value && (value>>32) != 0) { |
| 3666 | emit("b(lit)"); |
| 3667 | spit((value>>56)&0x0ff); |
| 3668 | spit((value>>48)&0x0ff); |
| 3669 | spit((value>>40)&0x0ff); |
| 3670 | spit((value>>32)&0x0ff); |
| 3671 | emit("lxjoin"); |
| 3672 | } |
| 3673 | } |
| 3674 | break; |
| 3675 | case TOK_DEFER: |
| 3676 | STATE(token->text, "TOK_DEFER")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_DEFER" , token->text); } while (0); |
| 3677 | /* Don't know what this does or if it's right */ |
| 3678 | token = yylex(); |
| 3679 | if (token == NULL((void *)0)) { |
| 3680 | warnx("EOF in colon definition"); |
| 3681 | return; |
| 3682 | } |
| 3683 | |
| 3684 | /* Add new code to dictionary */ |
| 3685 | fcode = emalloc(sizeof(*fcode)); |
| 3686 | fcode->num = nextfcode++; |
| 3687 | fcode->name = estrdup(token->text); |
| 3688 | fadd(dictionary, fcode); |
| 3689 | |
| 3690 | if (state == 0) |
| 3691 | emit("new-token"); |
| 3692 | else { |
| 3693 | if (state == TOK_EXTERNAL) |
| 3694 | emit("external-token"); |
| 3695 | else |
| 3696 | /* Here we have a choice of new-token or named-token */ |
| 3697 | emit("named-token"); |
| 3698 | sspit(token->text); |
| 3699 | } |
| 3700 | spit(fcode->num); |
| 3701 | emit("b(defer)"); |
| 3702 | break; |
| 3703 | case TOK_DO: |
| 3704 | STATE(token->text, "TOK_DO")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_DO" , token->text); } while (0); |
| 3705 | /* |
| 3706 | * From the 1275 spec. B is branch location, T is branch target. |
| 3707 | * |
| 3708 | * b(do) offset1 ... b(loop) offset2 ... |
| 3709 | * b(do) offset1 ... b(+loop) offset2 ... |
| 3710 | * b(?do) offset1 ... b(loop) offset2 ... |
| 3711 | * b(?do) offset1 ... b(+loop) offset2 ... |
| 3712 | * ^ ^ |
| 3713 | * B1 ^ ^ T1 |
| 3714 | * T2 B2 |
| 3715 | * |
| 3716 | * How we do this is we generate the b(do) or b(?do), spit out a |
| 3717 | * zero offset while remembering b1 and t2. Then we call tokenize() |
| 3718 | * to generate the body. When tokenize() finds a b(loop) or b(+loop), |
| 3719 | * it generates the FCode and returns, with outpos at b2. We then |
| 3720 | * calculate the offsets, put them in the right slots and finishup. |
| 3721 | */ |
| 3722 | |
| 3723 | if (token->text[0] == '?') |
| 3724 | emit("b(?do)"); |
| 3725 | else |
| 3726 | emit("b(do)"); |
| 3727 | push(outpos); |
| 3728 | offspit(0); /* Place holder for later */ |
| 3729 | push(outpos); |
| 3730 | break; |
| 3731 | case TOK_END0: |
| 3732 | STATE(token->text, "TOK_END0")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_END0" , token->text); } while (0); |
| 3733 | emit("end0"); |
| 3734 | /* Remember we already generated end0 */ |
| 3735 | need_end0 = 0; |
| 3736 | break; |
| 3737 | case TOK_ELSE: |
| 3738 | STATE(token->text, "TOK_ELSE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_ELSE" , token->text); } while (0); |
| 3739 | /* Get where we need to patch */ |
| 3740 | off = pop(); |
| 3741 | emit("bbranch"); |
| 3742 | /* Save where we are now. */ |
| 3743 | push(outpos); |
| 3744 | offspit(0); /* Place holder for later */ |
| 3745 | emit("b(>resolve)"); |
| 3746 | /* Rewind and patch the if branch */ |
| 3747 | pos = outpos; |
| 3748 | outpos = off; |
| 3749 | off = pos - off; |
| 3750 | offspit(off); /* Place holder for later */ |
| 3751 | /* revert to the end */ |
| 3752 | outpos = pos; |
| 3753 | break; |
| 3754 | case TOK_ENDCASE: |
| 3755 | STATE(token->text, "TOK_ENDCASE:")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_ENDCASE:" , token->text); } while (0); |
| 3756 | emit("b(endcase)"); |
| 3757 | pos = outpos; /* Remember where we need to branch to */ |
| 3758 | |
| 3759 | /* Thread our way backwards and install proper offsets */ |
| 3760 | off = pop(); |
| 3761 | while (off) { |
| 3762 | int disp; |
| 3763 | int next; |
| 3764 | |
| 3765 | /* Move to this offset */ |
| 3766 | outpos = off; |
| 3767 | /* Load next offset to process */ |
| 3768 | disp = (signed char)(outbuf[outpos]); |
| 3769 | if (offsetsize == 16) { |
| 3770 | disp = (disp << 8) | |
| 3771 | (unsigned char)outbuf[outpos+1]; |
| 3772 | } |
| 3773 | next = outpos + disp; |
| 3774 | if (debug > -3) |
| 3775 | printf("Next endof: %x at %x\n", |
| 3776 | disp, next); |
| 3777 | |
| 3778 | /* process this offset */ |
| 3779 | off = pos - outpos; |
| 3780 | offspit(off); |
| 3781 | if ((off = disp)) |
| 3782 | off = next; |
| 3783 | } |
| 3784 | outpos = pos; |
| 3785 | break; |
| 3786 | case TOK_ENDOF: |
| 3787 | STATE(token->text, "TOK_ENDOF")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_ENDOF" , token->text); } while (0); |
| 3788 | off = pop(); |
| 3789 | emit("b(endof)"); |
| 3790 | /* |
| 3791 | * Save back pointer in the offset field so we can traverse |
| 3792 | * the linked list and patch it in the endcase. |
| 3793 | */ |
| 3794 | pos = pop(); /* get position of prev link. */ |
| 3795 | push(outpos); /* save position of this link. */ |
| 3796 | if (pos) |
| 3797 | /* save potision of prev link. */ |
| 3798 | offspit(pos - outpos); |
| 3799 | else |
| 3800 | /* This is the first statement */ |
| 3801 | offspit(0); |
| 3802 | pos = outpos; |
| 3803 | /* Now point the offset from b(of) here. */ |
| 3804 | outpos = off; |
| 3805 | off = pos - off; |
| 3806 | offspit(off); |
| 3807 | /* Restore position */ |
| 3808 | outpos = pos; |
| 3809 | break; |
| 3810 | case TOK_EXTERNAL: |
| 3811 | STATE(token->text, "TOK_EXTERNAL")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_EXTERNAL" , token->text); } while (0); |
| 3812 | state = TOK_EXTERNAL; |
| 3813 | break; |
| 3814 | case TOK_FCODE_VERSION2: |
| 3815 | /* This is actually a tokenizer directive. */ |
| 3816 | STATE(token->text, "TOK_FCODE_VERSION2")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_FCODE_VERSION2" , token->text); } while (0); |
| 3817 | offsetsize = 16; |
| 3818 | pos = outpos; |
| 3819 | outpos = 0; |
| 3820 | emit("start1"); |
| 3821 | outpos = pos; |
| 3822 | break; |
| 3823 | case TOK_FCODE_END: |
| 3824 | /* |
| 3825 | * Another tokenizer directive. |
| 3826 | * |
| 3827 | * This should generate end0 and finish filling in |
| 3828 | * the FCode header. But that's all done in main(). |
| 3829 | */ |
| 3830 | STATE(token->text, "TOK_FCODE_END")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_FCODE_END" , token->text); } while (0); |
| 3831 | return; |
| 3832 | case TOK_FIELD: |
| 3833 | STATE(token->text, "TOK_FIELD")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_FIELD" , token->text); } while (0); |
| 3834 | |
| 3835 | token = yylex(); |
| 3836 | if (token == NULL((void *)0)) { |
| 3837 | warnx("EOF in field definition"); |
| 3838 | return; |
| 3839 | } |
| 3840 | |
| 3841 | /* Add new code to dictionary */ |
| 3842 | fcode = emalloc(sizeof(*fcode)); |
| 3843 | fcode->num = nextfcode++; |
| 3844 | fcode->name = estrdup(token->text); |
| 3845 | fadd(dictionary, fcode); |
| 3846 | |
| 3847 | if (state == 0) |
| 3848 | emit("new-token"); |
| 3849 | else { |
| 3850 | if (state == TOK_EXTERNAL) |
| 3851 | emit("external-token"); |
| 3852 | else |
| 3853 | /* Here we have a choice of new-token or named-token */ |
| 3854 | emit("named-token"); |
| 3855 | sspit(token->text); |
| 3856 | } |
| 3857 | spit(fcode->num); |
| 3858 | emit("b(field)"); |
| 3859 | break; |
| 3860 | |
| 3861 | case TOK_HEX: |
| 3862 | STATE(token->text, "TOK_HEX")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_HEX" , token->text); } while (0); |
| 3863 | if (token->text[1] != '#') { |
| 3864 | if (defining) { |
| 3865 | emit("b(lit)"); |
| 3866 | spit(0); |
| 3867 | spit(0); |
| 3868 | spit(0); |
| 3869 | spit(16); |
| 3870 | emit("base"); |
| 3871 | emit("!"); |
| 3872 | } else |
| 3873 | numbase = TOK_HEX; |
| 3874 | } else { |
| 3875 | char *end; |
| 3876 | Cell value; |
| 3877 | |
| 3878 | token = yylex(); |
| 3879 | if (token == NULL((void *)0)) { |
| 3880 | warnx("EOF after h#"); |
| 3881 | return; |
| 3882 | } |
| 3883 | value = strtol(token->text, &end, 16)cvt(token->text, &end, 16); |
| 3884 | if (*end != 0) |
| 3885 | errx(EXIT_FAILURE1, "Illegal number" |
| 3886 | " conversion:%s:%d: %s\n", |
| 3887 | infile, yylineno, yytext); |
| 3888 | /* |
| 3889 | * If this is a 64-bit value we need to store two literals |
| 3890 | * and issue a `lxjoin' to combine them. But that's a future |
| 3891 | * project. |
| 3892 | */ |
| 3893 | emit("b(lit)"); |
| 3894 | spit((value>>24)&0x0ff); |
| 3895 | spit((value>>16)&0x0ff); |
| 3896 | spit((value>>8)&0x0ff); |
| 3897 | spit(value&0x0ff); |
| 3898 | if ((value>>32) != value && (value>>32) != 0) { |
| 3899 | emit("b(lit)"); |
| 3900 | spit((value>>56)&0x0ff); |
| 3901 | spit((value>>48)&0x0ff); |
| 3902 | spit((value>>40)&0x0ff); |
| 3903 | spit((value>>32)&0x0ff); |
| 3904 | emit("lxjoin"); |
| 3905 | } |
| 3906 | } |
| 3907 | break; |
| 3908 | case TOK_HEADERLESS: |
| 3909 | STATE(token->text, "TOK_HEADERLESS")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_HEADERLESS" , token->text); } while (0); |
| 3910 | state = 0; |
| 3911 | break; |
| 3912 | case TOK_HEADERS: |
| 3913 | STATE(token->text, "TOK_HEADERS")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_HEADERS" , token->text); } while (0); |
| 3914 | state = TOK_HEADERS; |
| 3915 | break; |
| 3916 | case TOK_IF: |
| 3917 | STATE(token->text, "TOK_IF")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_IF" , token->text); } while (0); |
| 3918 | /* |
| 3919 | * Similar to do but simpler since we only deal w/one branch. |
| 3920 | */ |
| 3921 | emit("b?branch"); |
| 3922 | push(outpos); |
| 3923 | offspit(0); /* Place holder for later */ |
| 3924 | break; |
| 3925 | case TOK_LEAVE: |
| 3926 | STATE(token->text, "TOK_LEAVE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_LEAVE" , token->text); } while (0); |
| 3927 | emit("b(leave)"); |
| 3928 | break; |
| 3929 | case TOK_LOOP: |
| 3930 | STATE(token->text, "TOK_LOOP")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_LOOP" , token->text); } while (0); |
| 3931 | |
| 3932 | if (token->text[0] == '+') |
| 3933 | emit("b(+loop)"); |
| 3934 | else |
| 3935 | emit("b(loop)"); |
| 3936 | /* First do backwards branch of loop */ |
| 3937 | pos = pop(); |
| 3938 | off = pos - outpos; |
| 3939 | offspit(off); |
| 3940 | /* Now do forward branch of do */ |
| 3941 | pos = outpos; |
| 3942 | outpos = pop(); |
| 3943 | off = pos - outpos; |
| 3944 | spit(off); |
| 3945 | /* Restore output position */ |
| 3946 | outpos = pos; |
| 3947 | break; |
| 3948 | case TOK_OCTAL: |
| 3949 | STATE(token->text, "TOK_OCTAL")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_OCTAL" , token->text); } while (0); |
| 3950 | if (token->text[1] != '#') { |
| 3951 | if (defining) { |
| 3952 | spit(16); |
| 3953 | emit("base"); |
| 3954 | emit("!"); |
| 3955 | } else |
| 3956 | numbase = TOK_OCTAL; |
| 3957 | } else { |
| 3958 | char *end; |
| 3959 | Cell value; |
| 3960 | |
| 3961 | token = yylex(); |
| 3962 | if (token == NULL((void *)0)) { |
| 3963 | warnx("EOF after o#"); |
| 3964 | return; |
| 3965 | } |
| 3966 | value = strtol(token->text, &end, 8)cvt(token->text, &end, 8); |
| 3967 | if (*end != 0) { |
| 3968 | errx(EXIT_FAILURE1, "Illegal number" |
| 3969 | " conversion:%s:%d: %s\n", |
| 3970 | infile, yylineno, yytext); |
| 3971 | } |
| 3972 | /* |
| 3973 | * If this is a 64-bit value we need to store two literals |
| 3974 | * and issue a `lxjoin' to combine them. But that's a future |
| 3975 | * project. |
| 3976 | */ |
| 3977 | emit("b(lit)"); |
| 3978 | spit((value>>24)&0x0ff); |
| 3979 | spit((value>>16)&0x0ff); |
| 3980 | spit((value>>8)&0x0ff); |
| 3981 | spit(value&0x0ff); |
| 3982 | if ((value>>32) != value && (value>>32) != 0) { |
| 3983 | emit("b(lit)"); |
| 3984 | spit((value>>56)&0x0ff); |
| 3985 | spit((value>>48)&0x0ff); |
| 3986 | spit((value>>40)&0x0ff); |
| 3987 | spit((value>>32)&0x0ff); |
| 3988 | emit("lxjoin"); |
| 3989 | } |
| 3990 | } |
| 3991 | break; |
| 3992 | case TOK_OF: |
| 3993 | STATE(token->text, "TOK_OF")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_OF" , token->text); } while (0); |
| 3994 | /* |
| 3995 | * Let's hope I get the semantics right. |
| 3996 | * |
| 3997 | * The `of' behaves almost the same as an |
| 3998 | * `if'. The difference is that `endof' |
| 3999 | * takes a branch offset to the associated |
| 4000 | * `endcase'. Here we will generate a temporary |
| 4001 | * offset of the `of' associated with the `endof'. |
| 4002 | * Then in `endcase' we should be pointing just |
| 4003 | * after the offset of the last `endof' so we |
| 4004 | * calculate the offset and thread our way backwards |
| 4005 | * searching for the previous `b(case)' or `b(endof)'. |
| 4006 | */ |
| 4007 | emit("b(of)"); |
| 4008 | push(outpos); |
| 4009 | offspit(0); /* Place holder for later */ |
| 4010 | break; |
| 4011 | case TOK_OFFSET16: |
| 4012 | STATE(token->text, "TOK_OFFSET16")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_OFFSET16" , token->text); } while (0); |
| 4013 | offsetsize = 16; |
| 4014 | emit("offset16"); |
| 4015 | break; |
| 4016 | case TOK_REPEAT: |
| 4017 | STATE(token->text, "TOK_REPEAT")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_REPEAT" , token->text); } while (0); |
| 4018 | emit("bbranch"); |
| 4019 | pos = pop(); |
| 4020 | off = pop(); |
| 4021 | /* First the offset for the branch back to the begin */ |
| 4022 | off -= outpos; |
| 4023 | offspit(off); |
| 4024 | emit("b(>resolve)"); |
| 4025 | /* Now point the offset of the while here. */ |
| 4026 | off = outpos; |
| 4027 | outpos = pos; |
| 4028 | pos = off - pos; |
| 4029 | offspit(pos); |
| 4030 | /* Return to the end of the output */ |
| 4031 | outpos = off; |
| 4032 | break; |
| 4033 | case TOK_STARTX: |
| 4034 | /* Put a "startX" at addr 0. */ |
| 4035 | STATE(token->text, "TOK_FCODE_VERSION2")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_FCODE_VERSION2" , token->text); } while (0); |
| 4036 | offsetsize = 16; |
| 4037 | pos = outpos; |
| 4038 | outpos = 0; |
| 4039 | emit(token->text); |
| 4040 | outpos = pos; |
| 4041 | break; |
| 4042 | case TOK_THEN: |
| 4043 | STATE(token->text, "TOK_THEN")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_THEN" , token->text); } while (0); |
| 4044 | emit("b(>resolve)"); |
| 4045 | pos = outpos; |
| 4046 | outpos = pop(); |
| 4047 | off = pos - outpos; |
| 4048 | offspit(off); |
| 4049 | outpos = pos; |
| 4050 | break; |
| 4051 | case TOK_TO: |
| 4052 | STATE(token->text, "TOK_TO")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_TO" , token->text); } while (0); |
| 4053 | /* The next pass should tokenize the FCODE number */ |
| 4054 | emit("b(to)"); |
| 4055 | break; |
| 4056 | case TOK_UNTIL: |
| 4057 | STATE(token->text, "TOK_UNTIL")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_UNTIL" , token->text); } while (0); |
| 4058 | emit("b?branch"); |
| 4059 | pos = pop(); |
| 4060 | pos -= outpos; |
| 4061 | offspit(pos); |
| 4062 | break; |
| 4063 | case TOK_VALUE: |
| 4064 | STATE(token->text, "TOK_VALUE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_VALUE" , token->text); } while (0); |
| 4065 | |
| 4066 | token = yylex(); |
| 4067 | if (token == NULL((void *)0)) { |
| 4068 | warnx("EOF in value definition"); |
| 4069 | return; |
| 4070 | } |
| 4071 | |
| 4072 | /* Add new code to dictionary */ |
| 4073 | fcode = emalloc(sizeof(*fcode)); |
| 4074 | fcode->num = nextfcode++; |
| 4075 | fcode->name = estrdup(token->text); |
| 4076 | fadd(dictionary, fcode); |
| 4077 | |
| 4078 | if (state == 0) |
| 4079 | emit("new-token"); |
| 4080 | else { |
| 4081 | if (state == TOK_EXTERNAL) |
| 4082 | emit("external-token"); |
| 4083 | else |
| 4084 | /* Here we have a choice of new-token or named-token */ |
| 4085 | emit("named-token"); |
| 4086 | sspit(token->text); |
| 4087 | } |
| 4088 | spit(fcode->num); |
| 4089 | emit("b(value)"); |
| 4090 | break; |
| 4091 | case TOK_VARIABLE: |
| 4092 | STATE(token->text, "TOK_VARIABLE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_VARIABLE" , token->text); } while (0); |
| 4093 | |
| 4094 | token = yylex(); |
| 4095 | if (token == NULL((void *)0)) { |
| 4096 | warnx("EOF in variable definition"); |
| 4097 | return; |
| 4098 | } |
| 4099 | |
| 4100 | /* Add new code to dictionary */ |
| 4101 | fcode = emalloc(sizeof(*fcode)); |
| 4102 | fcode->num = nextfcode++; |
| 4103 | fcode->name = estrdup(token->text); |
| 4104 | fadd(dictionary, fcode); |
| 4105 | |
| 4106 | if (state == 0) |
| 4107 | emit("new-token"); |
| 4108 | else { |
| 4109 | if (state == TOK_EXTERNAL) |
| 4110 | emit("external-token"); |
| 4111 | else |
| 4112 | /* Here we have a choice of new-token or named-token */ |
| 4113 | emit("named-token"); |
| 4114 | sspit(token->text); |
| 4115 | } |
| 4116 | spit(fcode->num); |
| 4117 | emit("b(variable)"); |
| 4118 | break; |
| 4119 | case TOK_VERSION1: |
| 4120 | /* This is actually a tokenizer directive. */ |
| 4121 | STATE(token->text, "TOK_FCODE_VERSION1")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_FCODE_VERSION1" , token->text); } while (0); |
| 4122 | offsetsize = 8; |
| 4123 | pos = outpos; |
| 4124 | outpos = 0; |
| 4125 | emit("version1"); |
| 4126 | outpos = pos; |
| 4127 | break; |
| 4128 | case TOK_WHILE: |
| 4129 | STATE(token->text, "TOK_WHILE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_WHILE" , token->text); } while (0); |
| 4130 | emit("b?branch"); |
| 4131 | push(outpos); |
| 4132 | offspit(0); |
| 4133 | break; |
| 4134 | |
| 4135 | /* Tokenizer directives */ |
| 4136 | case TOK_BEGTOK: |
| 4137 | STATE(token->text, "TOK_BEGTOK")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_BEGTOK" , token->text); } while (0); |
| 4138 | tokenizer = 1; |
| 4139 | break; |
| 4140 | case TOK_EMIT_BYTE: |
| 4141 | STATE(token->text, "TOK_EMIT_BYTE")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_EMIT_BYTE" , token->text); } while (0); |
| 4142 | spit(pop()); |
| 4143 | break; |
| 4144 | case TOK_ENDTOK: |
| 4145 | STATE(token->text, "TOK_ENDTOK")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_ENDTOK" , token->text); } while (0); |
| 4146 | tokenizer = 0; |
| 4147 | break; |
| 4148 | case TOK_FLOAD: |
| 4149 | { |
| 4150 | char *oldinfile = infile; |
| 4151 | |
| 4152 | STATE(token->text, "TOK_FLOAD")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_FLOAD" , token->text); } while (0); |
| 4153 | /* Parse a different file for a while */ |
| 4154 | token = yylex(); |
| 4155 | if ((inf = fopen(token->text, "r")) == NULL((void *)0)) { |
| 4156 | warn("Cannot open `%s'", token->text); |
| 4157 | break; |
| 4158 | } |
| 4159 | infile = estrdup(token->text); |
| 4160 | if (mark_fload) { |
| 4161 | /* |
| 4162 | * Insert commands to print out the |
| 4163 | * filename into the instruction |
| 4164 | * stream |
| 4165 | */ |
| 4166 | emit("b(\")"); |
| 4167 | sspit("fload-ing "); |
| 4168 | emit("type"); |
| 4169 | emit("b(\")"); |
| 4170 | sspit(infile); |
| 4171 | emit("type"); |
| 4172 | emit("cr"); |
| 4173 | emit(".s"); |
| 4174 | } |
| 4175 | inbuf = yy_create_buffer(inf,YY_BUF_SIZE16384); |
| 4176 | yy_switch_to_buffer(inbuf); |
| 4177 | |
| 4178 | printf("======= fload file %s\n", infile); |
| 4179 | tokenize(inbuf); |
| 4180 | printf("======= done file %s\n", infile); |
| 4181 | yy_switch_to_buffer(yinput); |
| 4182 | yy_delete_buffer(inbuf); |
| 4183 | fclose(inf); |
| 4184 | if (mark_fload) { |
| 4185 | /* |
| 4186 | * Insert commands to print out the |
| 4187 | * filename into the instruction |
| 4188 | * stream |
| 4189 | */ |
| 4190 | emit("b(\")"); |
| 4191 | sspit("fload-ed "); |
| 4192 | emit("type"); |
| 4193 | emit("b(\")"); |
| 4194 | sspit(infile); |
| 4195 | emit("type"); |
| 4196 | emit("cr"); |
| 4197 | emit(".s"); |
| 4198 | emit("cr"); |
| 4199 | } |
| 4200 | free(infile); |
| 4201 | infile = oldinfile; |
| 4202 | } |
| 4203 | break; |
| 4204 | case TOK_OTHER: |
| 4205 | STATE(token->text, "TOK_OTHER")do { if (debug) printf("%lx State %s: token `%s'\n", outpos, "TOK_OTHER" , token->text); } while (0); |
| 4206 | if (apply_macros(yinput, token->text)) |
| 4207 | break; |
| 4208 | if (emit(token->text)) { |
| 4209 | #if 0 |
| 4210 | /* |
| 4211 | * Call an external command |
| 4212 | * |
| 4213 | * XXXXX assumes it will always find the command |
| 4214 | */ |
| 4215 | sspit(token->text); |
| 4216 | emit("$find"); |
| 4217 | emit("drop"); |
| 4218 | emit("execute"); |
| 4219 | #else |
| 4220 | token_err(yylineno, infile, yytext, |
| 4221 | "%s: undefined token `%s'\n", |
| 4222 | myname, token->text); |
| 4223 | #endif |
| 4224 | } |
| 4225 | break; |
| 4226 | default: |
| 4227 | /* Nothing */ ; |
| 4228 | } |
| 4229 | } |
| 4230 | return; |
| 4231 | } |
| 4232 | |
| 4233 | /* |
| 4234 | * print a tokenizer error message |
| 4235 | */ |
| 4236 | static void |
| 4237 | token_err(int lineno, const char *file, const char *text, const char *fmt, ...) |
| 4238 | { |
| 4239 | va_list ap; |
| 4240 | |
| 4241 | va_start(ap, fmt)__builtin_va_start(ap, fmt); |
| 4242 | fprintf(stderr(&__sF[2]), "%s: ", getprogname()); |
| 4243 | if (file) |
| 4244 | (void)fprintf(stderr(&__sF[2]), "%s,%d: ", file, lineno); |
| 4245 | if (fmt) |
| 4246 | (void)vfprintf(stderr(&__sF[2]), fmt, ap); |
| 4247 | fputc('\n', stderr(&__sF[2])); |
| 4248 | if (text) |
| 4249 | fprintf(stderr(&__sF[2]), "\t%s", text); |
| 4250 | va_end(ap)__builtin_va_end(ap); |
| 4251 | exit(EXIT_FAILURE1); |
| 4252 | } |
| 4253 | |
| 4254 | /* |
| 4255 | * Lookup fcode string in dictionary and spit it out. |
| 4256 | * |
| 4257 | * Fcode must be in dictionary. No alias conversion done. |
| 4258 | */ |
| 4259 | static int |
| 4260 | emit(const char *str) |
| 4261 | { |
| 4262 | struct fcode *code; |
| 4263 | if ((code = flookup(dictionary, str))) |
| 4264 | spit(code->num); |
| 4265 | if (debug > 1) { |
| 4266 | if (code) |
| 4267 | printf("emitting `%s'\n", code->name); |
| 4268 | else |
| 4269 | printf("emit: not found `%s'\n", str); |
| 4270 | } |
| 4271 | return (code == NULL((void *)0)); |
| 4272 | } |
| 4273 | |
| 4274 | /* |
| 4275 | * Spit out an integral value as a series of FCodes. |
| 4276 | * |
| 4277 | * It will spit out one zero byte or as many bytes as are |
| 4278 | * non-zero. |
| 4279 | */ |
| 4280 | static int |
| 4281 | spit(long n) |
| 4282 | { |
| 4283 | int count = 1; |
| 4284 | |
| 4285 | if (n >> 8) |
| 4286 | count += spit(n >> 8); |
| 4287 | if ((size_t)outpos >= outbufsiz) { |
| 4288 | while ((size_t)outpos >= outbufsiz) outbufsiz += BUFCLICK(1024*1024); |
| 4289 | outbuf = erealloc(outbuf, outbufsiz); |
| 4290 | } |
| 4291 | if (debug > 3) printf("%lx: spitting %2.2x\n", outpos, (unsigned char)n); |
| 4292 | outbuf[outpos++] = n; |
| 4293 | return (count); |
| 4294 | } |
| 4295 | |
| 4296 | /* |
| 4297 | * Spit out an FCode string. |
| 4298 | */ |
| 4299 | static void |
| 4300 | sspit(const char *s) |
| 4301 | { |
| 4302 | int len = strlen(s); |
| 4303 | |
| 4304 | if (len > 255) { |
| 4305 | warnx("string length %d too long", len); |
| 4306 | return; |
| 4307 | } |
| 4308 | if (debug > 2) |
| 4309 | printf("sspit: len %d str `%s'\n", len, s); |
| 4310 | spit(len); |
| 4311 | while (len--) |
| 4312 | spit(*s++); |
| 4313 | } |
| 4314 | |
| 4315 | /* |
| 4316 | * Spit out an offset. Offsets can be 8 or 16 bits. |
| 4317 | * Bail if the value overflows. This is a little complicated since |
| 4318 | * offsets can be negative numbers. |
| 4319 | */ |
| 4320 | static int |
| 4321 | offspit(long n) |
| 4322 | { |
| 4323 | |
| 4324 | if (offsetsize == 16) { |
| 4325 | volatile int16_t off16 = n; |
| 4326 | |
| 4327 | if (n != off16) |
| 4328 | token_err(yylineno, infile, NULL((void *)0), |
| 4329 | "Offset16 offset overflow: %lx != %x\n", |
| 4330 | n, off16); |
| 4331 | spit((n>>8) & 0xff); |
| 4332 | return spit(n & 0xff); |
| 4333 | } else { |
| 4334 | volatile int8_t off8 = n; |
| 4335 | |
| 4336 | if (n != off8) |
| 4337 | token_err(yylineno, infile, NULL((void *)0), |
| 4338 | "Offset8 offset overflow: %lx != %x\n", |
| 4339 | n, off8); |
| 4340 | return spit(n & 0x0ffL); |
| 4341 | } |
| 4342 | } |
| 4343 | |
| 4344 | int |
| 4345 | yywrap(void) |
| 4346 | { |
| 4347 | /* Always generate EOF */ |
| 4348 | return (1); |
| 4349 | } |
| 4350 |