diff options
author | Roozbeh Pournader <roozbeh@sharif.edu> | 2006-05-25 21:55:05 +0000 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@sharif.edu> | 2006-05-25 21:55:05 +0000 |
commit | 0a2ec794f03837e374b38c4952e23aa352461cf9 (patch) | |
tree | c979be67e9d2a0b857b0611a863a2b97040f406d /Build/source/texk | |
parent | bc96f890c4e188f096421c4ca79872f087a98372 (diff) |
various updates and fixes to otp and ocp handling code
git-svn-id: svn://tug.org/texlive/trunk@1594 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/web2c/otps/ChangeLog | 37 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/bugs.txt | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/lex.yy.c-dist | 1488 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp.h | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp.l | 13 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp.y | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp2ocp.c | 39 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/outocp.c | 36 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/routines.c | 66 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/routines.h | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/y_tab.c-dist | 901 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/y_tab.h-dist | 4 |
12 files changed, 1273 insertions, 1340 deletions
diff --git a/Build/source/texk/web2c/otps/ChangeLog b/Build/source/texk/web2c/otps/ChangeLog index 6cc4795582b..3355aa36a1e 100644 --- a/Build/source/texk/web2c/otps/ChangeLog +++ b/Build/source/texk/web2c/otps/ChangeLog @@ -1,10 +1,41 @@ -2002-11-18 Roozbeh Pournader <roozbeh@sharif.edu> +2006-05-25 Roozbeh Pournader <roozbeh@farsiweb.info> + + + * routines.c: fixed a bogus error message, made sure PLUSLEFT's + argument and the first argument of COMPLETELEFT are non-zero, + added comments, optimized DOUBLELEFT a little. + + * routines.h: added comments. increased ARRAY_SIZE. + + * bugs.txt: added. + + * otp.h, otp.l, routines.c, routines.h, outocp.c: Made a few things #defined + constants. + + * otp.l, otp.y: fixed the copyright comment to not appear on the + generated file. + + * otp.y: added syntax for exact number of occurences in + "OneCompleteLeft" and also for changing to the initial state + without using the special "INITIAL" name. + + * otp2ocp.c: removed support for suffixes other than ".otp", since + kpathsea won't find them anyway, small fixes in error messages. + + * otp2ocp.c, outocp.c, routines.c: made better use of kpathsea + features. + + * lex.yy.c-dist, y_tab.c-dist, y_tab.h-dist: regenerated. + + * ChangeLog: updated own email address. + +2002-11-18 Roozbeh Pournader <roozbeh@farsiweb.info> * otp2ocp.c: fixed a bug in detecting the '.otp' suffix (patch by Behdad Esfahbod). * ChangeLog: some cleanup; -2002-10-23 Roozbeh Pournader <roozbeh@sharif.edu> +2002-10-23 Roozbeh Pournader <roozbeh@farsiweb.info> * otp2ocp.c: added two copyright lines. * otp.l: fixed a buffer overflow bug, now accepts all end of line @@ -13,7 +44,7 @@ * otp.h: changed '#define's to 'enum' (patch by Behdad Esfahbod). * lex.yy.c-dist: rebuilt. -2002-10-15 Roozbeh Pournader <roozbeh@sharif.edu> +2002-10-15 Roozbeh Pournader <roozbeh@farsiweb.info> * otp2ocp.c: fixed some '.ocp' writing bugs; otp2ocp now fails with a non-zero return value if parsing the input fails (patch by diff --git a/Build/source/texk/web2c/otps/bugs.txt b/Build/source/texk/web2c/otps/bugs.txt new file mode 100644 index 00000000000..0a878a5bc06 --- /dev/null +++ b/Build/source/texk/web2c/otps/bugs.txt @@ -0,0 +1,9 @@ +[20050814-1] (otp2ocp) + Choices may include CompleteLefts, but only through aliases. + This should be tested. If it's working properly, choices should be + extended to allow them without aliases. If it's not working, + it should be fixed or removed. +[20050814-2] (otp2ocp) + Implement star (*) regexps, using <0,>. otp2ocp should fail when + it's the only thing on left side, since it would match the empty + string. diff --git a/Build/source/texk/web2c/otps/lex.yy.c-dist b/Build/source/texk/web2c/otps/lex.yy.c-dist index ad8394f92ec..7211b4da704 100644 --- a/Build/source/texk/web2c/otps/lex.yy.c-dist +++ b/Build/source/texk/web2c/otps/lex.yy.c-dist @@ -1,85 +1,32 @@ +/* A lexical scanner generated by flex*/ -#line 3 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ + */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 31 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ #include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H +#include <unistd.h> -/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -#include <inttypes.h> -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus #endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ #ifdef __cplusplus +#include <stdlib.h> + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -87,17 +34,34 @@ typedef unsigned int flex_uint32_t; #if __STDC__ +#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include <io.h> +#include <stdlib.h> +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -112,84 +76,80 @@ typedef unsigned int flex_uint32_t; * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN (yy_start) = 1 + 2 * +#define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START (((yy_start) - 1) / 2) +#define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ -#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 -#endif -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif extern int yyleng; - extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ + *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, (yytext_ptr) ) +#define unput(c) yyunput( c, yytext_ptr ) + +/* Some routines like yy_flex_realloc() are emitted as static but are + not called by all lexers. This generates warnings in some compilers, + notably GCC. Arrange to suppress these. */ +#ifdef __GNUC__ +#define YY_MAY_BE_UNUSED __attribute__((unused)) +#else +#define YY_MAY_BE_UNUSED +#endif /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; -#endif -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state { FILE *yy_input_file; @@ -226,16 +186,12 @@ struct yy_buffer_state */ int yy_at_bol; - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; - #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -249,33 +205,23 @@ struct yy_buffer_state * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". - * - * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) +#define YY_CURRENT_BUFFER yy_current_buffer -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; + static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + int yyleng; /* Points to current character in buffer. */ @@ -288,98 +234,77 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); +void yyrestart YY_PROTO(( FILE *input_file )); -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED; +static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) -/* Begin user sect3 */ +#define YY_USES_REJECT typedef unsigned char YY_CHAR; - FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - typedef int yy_state_type; - #define YY_FLEX_LEX_COMPAT extern int yylineno; - int yylineno = 1; - extern char yytext[]; -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ - if ( yyleng + (yy_more_offset) >= YYLMAX ) \ + if ( yyleng + yy_more_offset >= YYLMAX ) \ YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ - yy_flex_strncpy( &yytext[(yy_more_offset)], (yytext_ptr), yyleng + 1 ); \ - yyleng += (yy_more_offset); \ - (yy_prev_more_offset) = (yy_more_offset); \ - (yy_more_offset) = 0; \ - (yy_c_buf_p) = yy_cp; + yy_flex_strncpy( &yytext[yy_more_offset], yytext_ptr, yyleng + 1 ); \ + yyleng += yy_more_offset; \ + yy_prev_more_offset = yy_more_offset; \ + yy_more_offset = 0; \ + yy_c_buf_p = yy_cp; #define YY_NUM_RULES 25 #define YY_END_OF_BUFFER 26 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_acclist[130] = +static yyconst short int yy_acclist[130] = { 0, 26, 24, 25, 1, 24, 25, 3, 25, 3, 24, 25, 24, 25, 24, 25, 6, 24, 25, 24, 25, @@ -397,7 +322,7 @@ static yyconst flex_int16_t yy_acclist[130] = 13, 15, 16, 14, 8, 8, 8, 8, 17 } ; -static yyconst flex_int16_t yy_accept[103] = +static yyconst short int yy_accept[103] = { 0, 1, 1, 1, 2, 4, 7, 9, 12, 14, 16, 19, 21, 23, 25, 28, 30, 33, 36, 39, 42, @@ -413,7 +338,7 @@ static yyconst flex_int16_t yy_accept[103] = 130, 130 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -445,7 +370,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[39] = +static yyconst int yy_meta[39] = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 3, 4, 4, 2, @@ -453,7 +378,7 @@ static yyconst flex_int32_t yy_meta[39] = 4, 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst flex_int16_t yy_base[107] = +static yyconst short int yy_base[107] = { 0, 0, 0, 130, 131, 131, 131, 126, 121, 124, 29, 112, 110, 34, 0, 0, 96, 99, 95, 12, 91, @@ -469,7 +394,7 @@ static yyconst flex_int16_t yy_base[107] = 131, 50, 54, 56, 59, 44 } ; -static yyconst flex_int16_t yy_def[107] = +static yyconst short int yy_def[107] = { 0, 101, 1, 101, 101, 101, 101, 101, 102, 103, 101, 101, 101, 101, 104, 105, 104, 104, 104, 104, 104, @@ -485,7 +410,7 @@ static yyconst flex_int16_t yy_def[107] = 0, 101, 101, 101, 101, 101 } ; -static yyconst flex_int16_t yy_nxt[170] = +static yyconst short int yy_nxt[170] = { 0, 4, 5, 6, 7, 5, 4, 8, 9, 4, 10, 10, 4, 11, 12, 4, 13, 14, 14, 4, 15, @@ -507,7 +432,7 @@ static yyconst flex_int16_t yy_nxt[170] = 101, 101, 101, 101, 101, 101, 101, 101, 101 } ; -static yyconst flex_int16_t yy_chk[170] = +static yyconst short int yy_chk[170] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -529,35 +454,25 @@ static yyconst flex_int16_t yy_chk[170] = 101, 101, 101, 101, 101, 101, 101, 101, 101 } ; -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[26] = - { 0, -0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, }; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; +static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; static char *yy_full_match; static int yy_lp; #define REJECT \ { \ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \ -yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ -++(yy_lp); \ +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ +yy_cp = yy_full_match; /* restore poss. backed-over text */ \ +++yy_lp; \ goto find_rule; \ } - static int yy_more_offset = 0; static int yy_prev_more_offset = 0; -#define yymore() ((yy_more_offset) = yy_flex_strlen( yytext )) +#define yymore() (yy_more_offset = yy_flex_strlen( yytext )) #define YY_NEED_STRLEN #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET \ { \ - (yy_more_offset) = (yy_prev_more_offset); \ - yyleng -= (yy_more_offset); \ + yy_more_offset = yy_prev_more_offset; \ + yyleng -= yy_more_offset; \ } #ifndef YYLMAX #define YYLMAX 8192 @@ -566,7 +481,7 @@ static int yy_prev_more_offset = 0; char yytext[YYLMAX]; char *yytext_ptr; #line 1 "./otp.l" -#line 2 "./otp.l" +#define INITIAL 0 /* otp.l: Lexical analysis for OTP files This file is part of Omega, @@ -574,7 +489,7 @@ which is based on the web2c distribution of TeX, Copyright (c) 1994--2001 John Plaice and Yannis Haralambous Copyright (c) 2002 Behdad Esfahbod -Copyright (c) 2002 Roozbeh Pournader +Copyright (C) 2002, 2005, 2006 Roozbeh Pournader Omega is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -591,29 +506,16 @@ along with Omega; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ - +#line 27 "./otp.l" #include "routines.h" #include "yystype.h" #include "y_tab.h" #define YY_NO_UNPUT +#define OTP_MAXCODE 0xFFFF int line_number = 1; int i,j,last; extern YYSTYPE yylval; -#line 603 "lex.yy.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include <unistd.h> -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif +#line 519 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -621,30 +523,65 @@ extern YYSTYPE yylval; #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (void ); +extern "C" int yywrap YY_PROTO(( void )); #else -extern int yywrap (void ); +extern int yywrap YY_PROTO(( void )); #endif #endif - static void yyunput (int c,char *buf_ptr ); - +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + #else -static int input (void ); +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 #endif +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include <stdlib.h> +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -653,6 +590,7 @@ static int input (void ); #endif /* Copy whatever the last rule matched to the standard output. */ + #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -665,10 +603,9 @@ static int input (void ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + if ( yy_current_buffer->yy_is_interactive ) \ { \ - int c = '*'; \ - size_t n; \ + int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -678,22 +615,9 @@ static int input (void ); YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -714,18 +638,12 @@ static int input (void ); #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif -/* end tables serialization structures and prototypes */ - /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ +#define YY_DECL int yylex YY_PROTO(( void )) +#endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. @@ -742,31 +660,26 @@ extern int yylex (void); #define YY_RULE_SETUP \ YY_USER_ACTION -/** The main scanner function which does all the work. - */ YY_DECL -{ + { register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; + register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; - -#line 43 "./otp.l" -#line 756 "lex.yy.c" +#line 44 "./otp.l" + +#line 672 "lex.yy.c" - if ( (yy_init) ) + if ( yy_init ) { - (yy_init) = 0; + yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! (yy_state_buf) ) - (yy_state_buf) = (yy_state_type *)yyalloc(YY_BUF_SIZE + 2 ); - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; @@ -774,32 +687,28 @@ YY_DECL if ( ! yyout ) yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state( ); + yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = (yy_c_buf_p); + yy_cp = yy_c_buf_p; /* Support of yytext. */ - *yy_cp = (yy_hold_char); + *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = (yy_start); - - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; yy_match: do { @@ -811,66 +720,63 @@ yy_match: yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; + *yy_state_ptr++ = yy_current_state; ++yy_cp; } while ( yy_base[yy_current_state] != 131 ); yy_find_action: - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; find_rule: /* we branch to this label when backing up */ for ( ; ; ) /* until we find what rule we matched */ { - if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) + if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) { - yy_act = yy_acclist[(yy_lp)]; + yy_act = yy_acclist[yy_lp]; { - (yy_full_match) = yy_cp; + yy_full_match = yy_cp; break; } } --yy_cp; - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + if ( yy_act != YY_END_OF_BUFFER ) { int yyl; - for ( yyl = (yy_prev_more_offset); yyl < yyleng; ++yyl ) + for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) - - yylineno++; -; + ++yylineno; } do_action: /* This label is used only to access EOF actions. */ + switch ( yy_act ) { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 44 "./otp.l" +#line 45 "./otp.l" {} YY_BREAK case 2: -/* rule 2 can match eol */ YY_RULE_SETUP -#line 45 "./otp.l" +#line 46 "./otp.l" { line_number++;} YY_BREAK case 3: -/* rule 3 can match eol */ YY_RULE_SETUP -#line 46 "./otp.l" +#line 47 "./otp.l" { line_number++;} YY_BREAK case 4: YY_RULE_SETUP -#line 47 "./otp.l" +#line 48 "./otp.l" { yylval.yint=0; for (i=2; i<yyleng; i++) { @@ -882,7 +788,7 @@ YY_RULE_SETUP } else { /* ((j>='A') && (j>='F')) */ yylval.yint = (yylval.yint*16)+(j-'A'+10); } - if (yylval.yint>65535) { + if (yylval.yint>OTP_MAXCODE) { fprintf(stderr, "line %d: value too large (%x)\n", line_number, yylval.yint); exit(1); @@ -893,13 +799,13 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 66 "./otp.l" +#line 67 "./otp.l" { yylval.yint=0; for (i=2; i<yyleng; i++) { j = yytext[i]; yylval.yint = (yylval.yint*8)+(j-'0'); - if (yylval.yint>65535) { + if (yylval.yint>OTP_MAXCODE) { fprintf(stderr, "line %d: value too large (%o)\n", line_number, yylval.yint); exit(1); @@ -910,13 +816,13 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 79 "./otp.l" +#line 80 "./otp.l" { yylval.yint=0; for (i=0; i<yyleng; i++) { j = yytext[i]; yylval.yint = (yylval.yint*10)+(j-'0'); - if (yylval.yint>65535) { + if (yylval.yint>OTP_MAXCODE) { fprintf(stderr, "line %d: value too large (%d)\n", line_number, yylval.yint); exit(1); @@ -927,21 +833,20 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 92 "./otp.l" +#line 93 "./otp.l" { yylval.yint=yytext[1]; return(NUMBER); -} + } YY_BREAK case 8: YY_RULE_SETUP -#line 96 "./otp.l" +#line 97 "./otp.l" { yylval.ystring=xstrdup(yytext); return(ID); } YY_BREAK case 9: -/* rule 9 can match eol */ YY_RULE_SETUP -#line 97 "./otp.l" +#line 98 "./otp.l" { char *newtext; last=yyleng-2; @@ -960,111 +865,111 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 112 "./otp.l" +#line 113 "./otp.l" return(RIGHTARROW); YY_BREAK case 11: YY_RULE_SETUP -#line 113 "./otp.l" +#line 114 "./otp.l" return(LEFTARROW); YY_BREAK case 12: YY_RULE_SETUP -#line 114 "./otp.l" +#line 115 "./otp.l" return(INPUT); YY_BREAK case 13: YY_RULE_SETUP -#line 115 "./otp.l" +#line 116 "./otp.l" return(OUTPUT); YY_BREAK case 14: YY_RULE_SETUP -#line 116 "./otp.l" +#line 117 "./otp.l" return(ALIASES); YY_BREAK case 15: YY_RULE_SETUP -#line 117 "./otp.l" +#line 118 "./otp.l" return(STATES); YY_BREAK case 16: YY_RULE_SETUP -#line 118 "./otp.l" +#line 119 "./otp.l" return(TABLES); YY_BREAK case 17: YY_RULE_SETUP -#line 119 "./otp.l" +#line 120 "./otp.l" return(EXPRESSIONS); YY_BREAK case 18: YY_RULE_SETUP -#line 120 "./otp.l" +#line 121 "./otp.l" return(PUSH); YY_BREAK case 19: YY_RULE_SETUP -#line 121 "./otp.l" +#line 122 "./otp.l" return(POP); YY_BREAK case 20: YY_RULE_SETUP -#line 122 "./otp.l" +#line 123 "./otp.l" return(DIV); YY_BREAK case 21: YY_RULE_SETUP -#line 123 "./otp.l" +#line 124 "./otp.l" return(MOD); YY_BREAK case 22: YY_RULE_SETUP -#line 124 "./otp.l" +#line 125 "./otp.l" return(BEG); YY_BREAK case 23: YY_RULE_SETUP -#line 125 "./otp.l" +#line 126 "./otp.l" return(END); YY_BREAK case 24: YY_RULE_SETUP -#line 126 "./otp.l" +#line 127 "./otp.l" return(yytext[0]); YY_BREAK case 25: YY_RULE_SETUP -#line 128 "./otp.l" +#line 129 "./otp.l" ECHO; YY_BREAK -#line 1042 "lex.yy.c" +#line 947 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); + *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our + * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -1074,13 +979,13 @@ ECHO; * end-of-buffer state). Contrast this with the test * in input(). */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state( ); + yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -1093,30 +998,30 @@ ECHO; yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); + yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = (yy_c_buf_p); + yy_cp = yy_c_buf_p; goto yy_find_action; } } - else switch ( yy_get_next_buffer( ) ) + else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { - (yy_did_buffer_switch_on_eof) = 0; + yy_did_buffer_switch_on_eof = 0; - if ( yywrap( ) ) + if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1127,7 +1032,7 @@ ECHO; * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1135,30 +1040,30 @@ ECHO; else { - if ( ! (yy_did_buffer_switch_on_eof) ) + if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state( ); + yy_current_state = yy_get_previous_state(); - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state( ); + yy_current_state = yy_get_previous_state(); - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; @@ -1169,7 +1074,8 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of yylex */ + } /* end of yylex */ + /* yy_get_next_buffer - try to read in a new buffer * @@ -1178,20 +1084,21 @@ ECHO; * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; register int number_to_move, i; int ret_val; - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1211,52 +1118,86 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { - size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ - +#ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + yy_current_buffer->yy_n_chars = yy_n_chars; } - if ( (yy_n_chars) == 0 ) + if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); + yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1264,28 +1205,28 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; -} + } + /* yy_get_previous_state - get the state just before the EOB char was reached */ - static yy_state_type yy_get_previous_state (void) -{ +static yy_state_type yy_get_previous_state() + { register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = (yy_start); - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) @@ -1295,21 +1236,28 @@ static int yy_get_next_buffer (void) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *(yy_state_ptr)++ = yy_current_state; + *yy_state_ptr++ = yy_current_state; } return yy_current_state; -} + } + /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { register int yy_is_jam; - + register YY_CHAR yy_c = 1; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1320,80 +1268,86 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 101); if ( ! yy_is_jam ) - *(yy_state_ptr)++ = yy_current_state; + *yy_state_ptr++ = yy_current_state; return yy_is_jam ? 0 : yy_current_state; -} + } - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); + *yy_cp = yy_hold_char; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; - if ( c == '\n' ){ - --yylineno; - } + if ( c == '\n' ) + --yylineno; + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} #ifndef YY_NO_INPUT #ifdef __cplusplus - static int yyinput (void) +static int yyinput() #else - static int input (void) +static int input() #endif - -{ + { int c; - - *(yy_c_buf_p) = (yy_hold_char); - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; + *yy_c_buf_p = '\0'; else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; - switch ( yy_get_next_buffer( ) ) + switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1407,16 +1361,16 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart(yyin ); + yyrestart( yyin ); - /*FALLTHROUGH*/ + /* fall through */ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) + if ( yywrap() ) return EOF; - if ( ! (yy_did_buffer_switch_on_eof) ) + if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1426,97 +1380,92 @@ static int yy_get_next_buffer (void) } case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; + yy_c_buf_p = yytext_ptr + offset; break; } } } - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; if ( c == '\n' ) - - yylineno++; -; + ++yylineno; return c; -} -#endif /* ifndef YY_NO_INPUT */ + } +#endif /* YY_NO_INPUT */ -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) return; - if ( YY_CURRENT_BUFFER ) + if ( yy_current_buffer ) { /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; } - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + yy_current_buffer = new_buffer; + yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - (yy_did_buffer_switch_on_eof) = 1; -} + yy_did_buffer_switch_on_eof = 1; + } -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1525,75 +1474,75 @@ static void yy_load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; -} + } -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { if ( ! b ) return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); + yy_flex_free( (void *) b->yy_ch_buf ); - yyfree((void *) b ); -} + yy_flex_free( (void *) b ); + } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) -{ - int oerrno = errno; - - yy_flush_buffer(b ); + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) return; b->yy_n_chars = 0; @@ -1610,121 +1559,29 @@ extern int isatty (int ); b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; + if ( b == yy_current_buffer ) + yy_load_buffer_state(); } - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); @@ -1738,42 +1595,47 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; -} + } +#endif -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) -{ - - return yy_scan_bytes(yy_str,strlen(yy_str) ); -} -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) -{ +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; - buf = (char *) yyalloc(n ); + buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); @@ -1782,7 +1644,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -1792,166 +1654,148 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) b->yy_is_our_buffer = 1; return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 + } #endif -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} -/* Redefine yyless() so it works in section 3 code. */ +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - 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 ) + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); -/* Accessor methods (get/set functions) to struct members. */ + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} + yy_start_stack[yy_start_stack_ptr++] = YY_START; -/** Get the current token. - * - */ + BEGIN(new_state); + } +#endif -char *yyget_text (void) -{ - return yytext; -} -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} -int yyget_debug (void) -{ - return yy_flex_debug; -} +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - yyfree ( (yy_state_buf) ); - return 0; -} +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) -/* - * Internal utility routines. - */ + +/* Internal utility routines. */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { register int i; - for ( i = 0; i < n; ++i ) + for ( i = 0; i < n; ++i ) s1[i] = s2[i]; -} + } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { register int n; - for ( n = 0; s[n]; ++n ) + for ( n = 0; s[n]; ++n ) ; return n; -} + } #endif -void *yyalloc (yy_size_t size ) -{ + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { return (void *) malloc( size ); -} + } -void *yyrealloc (void * ptr, yy_size_t size ) -{ +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1960,29 +1804,25 @@ void *yyrealloc (void * ptr, yy_size_t size ) * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef yytext_ptr -#undef YY_DO_BEFORE_ACTION + } -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; #endif -#line 128 "./otp.l" - + { + free( ptr ); + } +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 129 "./otp.l" diff --git a/Build/source/texk/web2c/otps/otp.h b/Build/source/texk/web2c/otps/otp.h index 5e8433fea50..8d56f5ae9d5 100644 --- a/Build/source/texk/web2c/otps/otp.h +++ b/Build/source/texk/web2c/otps/otp.h @@ -71,3 +71,8 @@ enum { #define OTP_PBACK_OFFSET (OTP_PBACK_OUTPUT - OTP_RIGHT_OUTPUT) +#define OTP_MAXCODE 0xFFFF + +#define OTP_MAXSTATES 100 +#define OTP_MAXTABLES 100 +#define OTP_MAXALIASES 1000 diff --git a/Build/source/texk/web2c/otps/otp.l b/Build/source/texk/web2c/otps/otp.l index b80cce902bf..9e4057d412a 100644 --- a/Build/source/texk/web2c/otps/otp.l +++ b/Build/source/texk/web2c/otps/otp.l @@ -1,4 +1,3 @@ -%{ /* otp.l: Lexical analysis for OTP files This file is part of Omega, @@ -6,7 +5,7 @@ which is based on the web2c distribution of TeX, Copyright (c) 1994--2001 John Plaice and Yannis Haralambous Copyright (c) 2002 Behdad Esfahbod -Copyright (c) 2002 Roozbeh Pournader +Copyright (C) 2002, 2005, 2006 Roozbeh Pournader Omega is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,10 +23,12 @@ along with Omega; if not, write to the Free Software Foundation, Inc., */ +%{ #include "routines.h" #include "yystype.h" #include "y_tab.h" #define YY_NO_UNPUT +#define OTP_MAXCODE 0xFFFF int line_number = 1; int i,j,last; extern YYSTYPE yylval; @@ -55,7 +56,7 @@ string \"([^\"]|\"\")*\" } else { /* ((j>='A') && (j>='F')) */ yylval.yint = (yylval.yint*16)+(j-'A'+10); } - if (yylval.yint>65535) { + if (yylval.yint>OTP_MAXCODE) { fprintf(stderr, "line %d: value too large (%x)\n", line_number, yylval.yint); exit(1); @@ -68,7 +69,7 @@ string \"([^\"]|\"\")*\" for (i=2; i<yyleng; i++) { j = yytext[i]; yylval.yint = (yylval.yint*8)+(j-'0'); - if (yylval.yint>65535) { + if (yylval.yint>OTP_MAXCODE) { fprintf(stderr, "line %d: value too large (%o)\n", line_number, yylval.yint); exit(1); @@ -81,7 +82,7 @@ string \"([^\"]|\"\")*\" for (i=0; i<yyleng; i++) { j = yytext[i]; yylval.yint = (yylval.yint*10)+(j-'0'); - if (yylval.yint>65535) { + if (yylval.yint>OTP_MAXCODE) { fprintf(stderr, "line %d: value too large (%d)\n", line_number, yylval.yint); exit(1); @@ -92,7 +93,7 @@ string \"([^\"]|\"\")*\" "`"[\x20-\x7e]"'" { yylval.yint=yytext[1]; return(NUMBER); -} + } {id} { yylval.ystring=xstrdup(yytext); return(ID); } {string} { char *newtext; diff --git a/Build/source/texk/web2c/otps/otp.y b/Build/source/texk/web2c/otps/otp.y index ec1095eba6d..a67c6a1c06d 100644 --- a/Build/source/texk/web2c/otps/otp.y +++ b/Build/source/texk/web2c/otps/otp.y @@ -1,10 +1,10 @@ -%{ /* otp.y: Grammar for OTP files. This file is part of Omega, -which is based on the web2c distribution of TeX, +which is based on the web2c distribution of TeX. Copyright (c) 1994--2001 John Plaice and Yannis Haralambous +Copyright (C) 2005, 2006 Roozbeh Pournader Omega is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ along with Omega; if not, write to the Free Software Foundation, Inc., */ +%{ #include "otp.h" #include "routines.h" #include "yystype.h" @@ -141,6 +142,8 @@ OneCompleteLeft : { $$.yleft = CompleteLeft($1.yleft, $3.yint, $5.yint); } | OneLeft '<' NUMBER ',' '>' { $$.yleft = PlusLeft($1.yleft, $3.yint); } + | OneLeft '<' NUMBER '>' + { $$.yleft = CompleteLeft($1.yleft, $3.yint, $3.yint); } | OneLeft { $$.yleft = $1.yleft; } ; @@ -315,6 +318,8 @@ OneRightExpr : RightState : /* Empty */ + | '<' '>' + { out_int(OTP_STATE_CHANGE, 0); } | '<' ID '>' { out_int(OTP_STATE_CHANGE, lookup_state($2.ystring)); } | '<' PUSH ID '>' diff --git a/Build/source/texk/web2c/otps/otp2ocp.c b/Build/source/texk/web2c/otps/otp2ocp.c index bb1e41b1148..d9b7ef10ab4 100644 --- a/Build/source/texk/web2c/otps/otp2ocp.c +++ b/Build/source/texk/web2c/otps/otp2ocp.c @@ -5,7 +5,7 @@ which is based on the web2c distribution of TeX, Copyright (c) 1994--2001 John Plaice and Yannis Haralambous Copyright (c) 2002 Behdad Esfahbod -Copyright (c) 2002 Roozbeh Pournader +Copyright (C) 2002, 2005, 2006 Roozbeh Pournader Omega is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -124,49 +124,28 @@ P2C (int, argc, string *, argv) string input_name, full_input_name; string output_name; - kpse_set_progname (argv[0]); + kpse_set_program_name (argv[0], "otp2ocp"); switch (argc) { case 1: - fprintf (stderr, "otp2ocp: No file given\n"); - return EXIT_FAILURE; + FATAL ("No command line arguments given"); case 2: - { - int len; - input_name = argv[1]; - len = strlen (input_name); - output_name = malloc (len + 5); - if (!output_name) - { - fprintf (stderr, "otp2ocp: Memory exhausted\n"); - return EXIT_FAILURE; - } - strcpy (output_name, xbasename (input_name)); - len = strlen (output_name); - if (len > 4 && 0 == strcmp (output_name + len - 4, ".otp")) - { - strcpy (output_name + len - 4, ".ocp"); - } - else - { - strcat (output_name, ".ocp"); - } - break; - } + input_name = argv[1]; + output_name = make_suffix (xbasename (input_name), "ocp"); + break; case 3: input_name = argv[1]; output_name = argv[2]; break; default: - fprintf (stderr, "otp2ocp: Too many arguments\n"); - return EXIT_FAILURE; + FATAL ("Too many command line arguments"); } full_input_name = kpse_find_file (input_name, kpse_otp_format, true); if (!full_input_name) { - fprintf (stderr, "otp2ocp: %s not found\n", input_name); - return EXIT_FAILURE; + FATAL1 ("File '%s' not found", input_name); } + otp_read (full_input_name, output_name); return EXIT_SUCCESS; diff --git a/Build/source/texk/web2c/otps/outocp.c b/Build/source/texk/web2c/otps/outocp.c index 4adc01255b1..9e8afd6913b 100644 --- a/Build/source/texk/web2c/otps/outocp.c +++ b/Build/source/texk/web2c/otps/outocp.c @@ -1,9 +1,10 @@ /* outocp.c: ASCII output for OCP files, mainly for debugging purposes. This file is part of Omega, -which is based on the web2c distribution of TeX, +which is based on the web2c distribution of TeX. Copyright (c) 1994--2001 John Plaice and Yannis Haralambous +Copyright (C) 2005 Roozbeh Pournader Omega is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,13 +71,6 @@ char *otp_names[] = { }; -void ctp_abort -P1C (string, s) -{ - fprintf (stderr, s); - exit (EXIT_FAILURE); -} - int no_words_read = 0; int ctp_get @@ -86,7 +80,7 @@ P1C (FILE *, input_file) ctpchar = getc (input_file); if (ctpchar == EOF) { - ctp_abort ("Unexpected end of file\n"); + FATAL ("Unexpected end of file"); } return ctpchar; } @@ -99,7 +93,7 @@ P1C (FILE *, input_file) ctpword = ctp_get (input_file); if (ctpword > 127) { - ctp_abort ("first octet > 127"); + FATAL ("First octet > 127"); } ctpword = ctpword * 256 + ctp_get (input_file); ctpword = ctpword * 256 + ctp_get (input_file); @@ -113,7 +107,7 @@ P1C (FILE *, input_file) int i, j, arg, entry, instruction; int ctp_length, real_ctp_length, ctp_input, ctp_output, ctp_no_tables, ctp_room_tables, ctp_no_states, ctp_room_states; - int room_tables[100], room_states[100]; + int room_tables[OTP_MAXTABLES], room_states[OTP_MAXSTATES]; ctp_length = ctp_read (input_file); fprintf (stdout, "ctp_length : %3x(%3d)\n", ctp_length, ctp_length); @@ -136,13 +130,13 @@ P1C (FILE *, input_file) ctp_room_states = ctp_read (input_file); fprintf (stdout, "ctp_room_states: %3x(%3d)\n\n", ctp_room_states, ctp_room_states); - if (ctp_no_tables >= 100) + if (ctp_no_tables >= OTP_MAXTABLES) { - ctp_abort ("Too many tables\n"); + FATAL ("Too many tables"); } - if (ctp_no_states >= 100) + if (ctp_no_states >= OTP_MAXSTATES) { - ctp_abort ("Too many states\n"); + FATAL ("Too many states"); } if (ctp_no_tables != 0) { @@ -203,26 +197,24 @@ P2C (int, argc, string *, argv) string input_name, full_input_name; FILE *input_file; - kpse_set_progname (argv[0]); + kpse_set_program_name (argv[0], "outocp"); switch (argc) { case 1: - fprintf (stderr, "outocp: No file given\n"); - return EXIT_FAILURE; + FATAL ("No file given"); case 2: input_name = argv[1]; break; default: - fprintf (stderr, "outocp: Too many arguments\n"); - return EXIT_FAILURE; + FATAL ("Too many arguments"); } full_input_name = kpse_find_file (input_name, kpse_ocp_format, true); if (!full_input_name) { - fprintf (stderr, "outocp: %s not found\n", input_name); - return EXIT_FAILURE; + FATAL1 ("%s not found", input_name); } input_file = xfopen (full_input_name, FOPEN_RBIN_MODE); ctp_explain (input_file); + return EXIT_SUCCESS; } diff --git a/Build/source/texk/web2c/otps/routines.c b/Build/source/texk/web2c/otps/routines.c index 4dcc8b66f9e..6ee5d54188d 100644 --- a/Build/source/texk/web2c/otps/routines.c +++ b/Build/source/texk/web2c/otps/routines.c @@ -1,9 +1,10 @@ /* routines.c: Generating the finite state automaton. This file is part of Omega, -which is based on the web2c distribution of TeX, +which is based on the web2c distribution of TeX. Copyright (c) 1994--2001 John Plaice and Yannis Haralambous +Copyright (C) 2005, 2006 Roozbeh Pournader Omega is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,16 +42,17 @@ int output_bytes; int no_states = 0; int cur_state = 0; int room_for_states = 0; -state_type states[100]; +state_type states[OTP_MAXSTATES]; int no_tables = 0; int cur_table = 0; int room_for_tables = 0; -table_type tables[100]; +table_type tables[OTP_MAXTABLES]; int no_aliases = 0; -alias_pair aliases[1000]; +alias_pair aliases[OTP_MAXALIASES]; +/* cons = [x] + L */ list cons P2C(int, x, list, L) { @@ -61,6 +63,7 @@ temp->ptr = L; return temp; } +/* list1 = [x] */ list list1 P1C(int, x) { @@ -71,6 +74,7 @@ temp->ptr = nil; return temp; } +/* list2 = [x, y] */ list list2 P2C(int, x, int, y) { @@ -84,6 +88,7 @@ temp1->ptr = nil; return temp; } +/* append = copy(K) + L */ list append P2C(list, K, list, L) { @@ -91,12 +96,14 @@ if (K==nil) return L; return cons(K->val, append(K->ptr, L)); } +/* append1 = copy(L) + [x] */ list append1 P2C(list, L, int, x) { return (append(L,list1(x))); } +/* lcons = [x] + L */ llist lcons P2C(left, x, llist, L) { @@ -107,6 +114,7 @@ temp->ptr = L; return temp; } +/* llist1 = [x] */ llist llist1 P1C(left, x) { @@ -117,6 +125,7 @@ temp->ptr = nil; return temp; } +/* llist2 = [x, y] */ llist llist2 P2C(left, x, left, y) { @@ -130,6 +139,7 @@ temp1->ptr = nil; return temp; } +/* lappend = copy(K) + L */ llist lappend P2C(llist, K, llist, L) { @@ -137,6 +147,7 @@ if (K==nil) return L; return lcons(K->val, lappend(K->ptr, L)); } +/* lappend1 = copy(L) + [x] */ llist lappend1 P2C(llist, L, left, x) { @@ -207,6 +218,7 @@ left PlusLeft P2C(left, l, int, n) { left temp; +if (n == 0) { FATAL ("plusleft's argument must be non-zero"); } temp = (left) malloc(sizeof(lft_cell)); temp->kind=PLUSLEFT; temp->one_left=l; @@ -218,6 +230,7 @@ left CompleteLeft P3C(left, l, int, n, int, m) { left temp; +if (n == 0) { FATAL ("completeleft's first argument must be non-zero"); } temp = (left) malloc(sizeof(lft_cell)); temp->kind=COMPLETELEFT; temp->one_left=l; @@ -274,12 +287,18 @@ case SINGLELEFT: out_int(0, 0); return list1(out_ptr-1); case DOUBLELEFT: - out_int(OTP_GOTO_LT, arg->val1); - out_int(0, 0); - save_ptr = out_ptr; - out_int(OTP_GOTO_GT, arg->val2); - out_int(0, 0); - return list2(save_ptr-1, out_ptr-1); + holes = nil; + if (arg->val1 > 0) { + out_int(OTP_GOTO_LT, arg->val1); + out_int(0, 0); + holes = list1(out_ptr-1); + } + if (arg->val2 < 0xFFFF) { + out_int(OTP_GOTO_GT, arg->val2); + out_int(0, 0); + holes = cons(out_ptr-1, holes); + } + return holes; case CHOICELEFT: true_holes=nil; false_holes=nil; @@ -373,8 +392,7 @@ case ENDLEFT: fill_in(true_holes); return false_holes; default: - fprintf(stderr, "Unrecognized left: %d\n", arg->kind); - exit(EXIT_FAILURE); + FATAL1 ("unrecognized left: %d", arg->kind); } } @@ -384,8 +402,7 @@ store_alias P2C(string, str, left, l) int i; for (i=0; i<no_aliases; i++) { if (!strcmp(str,aliases[i].str)) { - fprintf(stderr, "alias %s already defined\n", str); - exit(1); + FATAL1 ("alias %s already defined", str); } } aliases[i].str=xstrdup(str); @@ -402,8 +419,7 @@ for (i=0; i<no_aliases; i++) { return aliases[i].left_val; } } -fprintf(stderr, "state %s not defined\n", str); -exit(EXIT_FAILURE); +FATAL1 ("alias %s not defined", str); } void @@ -459,8 +475,7 @@ void out_int P2C(int, instr, int, val) { if (val>=(1<<24)) { - fprintf(stderr, "Argument (%d) of instruction too big\n", val); - exit(EXIT_FAILURE); + FATAL1 ("Argument (%d) of instruction too big", val); } add_to_state((instr<<24)+val); } @@ -471,8 +486,7 @@ store_state P1C(string, str) int i; for (i=0; i<no_states; i++) { if (!strcmp(str,states[i].str)) { - fprintf(stderr, "state %s already defined\n", str); - exit(EXIT_FAILURE); + FATAL1 ("state %s already defined", str); } } states[i].str=xstrdup(str); @@ -491,8 +505,7 @@ for (i=0; i<no_states; i++) { return i; } } -fprintf(stderr, "state %s not defined\n", str); -exit(EXIT_FAILURE); +FATAL1 ("state %s not defined", str); } void @@ -502,8 +515,7 @@ int len; len = states[cur_state].length; if (len > ARRAY_SIZE) { char * str = states[cur_state].str; - fprintf(stderr, "%s state has too many instructions\n", str); - exit(EXIT_FAILURE); + FATAL2 ("%s state has too many instructions: %d", str, len); } (states[cur_state].instrs)[len] = x; states[cur_state].length = len+1; @@ -515,8 +527,7 @@ store_table P2C(string, str, int, len) int i; for (i=0; i<no_tables; i++) { if (!strcmp(str,tables[i].str)) { - fprintf(stderr, "table %s already defined\n", str); - exit(EXIT_FAILURE); + FATAL1 ("table %s already defined", str); } } tables[i].str=xstrdup(str); @@ -543,7 +554,6 @@ for (i=0; i<no_tables; i++) { return i; } } -fprintf(stderr, "table %s not defined\n", str); -exit(EXIT_FAILURE); +FATAL1 ("table %s not defined", str); } diff --git a/Build/source/texk/web2c/otps/routines.h b/Build/source/texk/web2c/otps/routines.h index 2e4a7ee8d93..7ecaa7e5a0e 100644 --- a/Build/source/texk/web2c/otps/routines.h +++ b/Build/source/texk/web2c/otps/routines.h @@ -4,6 +4,7 @@ This file is part of Omega, which is based on the web2c distribution of TeX, Copyright (c) 1994--2001 John Plaice and Yannis Haralambous +Copyright (C) 2005 Roozbeh Pournader Omega is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,6 +56,8 @@ extern int yyparse(); extern int yylex(); extern int line_number; + +/* linked list of ints */ typedef struct cell_struct {struct cell_struct *ptr; int val; } cell; typedef cell *list; @@ -68,6 +71,7 @@ typedef struct left_cell { } lft_cell; typedef lft_cell *left; +/* linked list of lefts */ typedef struct lcell_struct {struct lcell_struct *ptr; left val; } lcell; typedef lcell *llist; @@ -102,7 +106,7 @@ extern int no_lefts; extern void store_alias P2H(string, left); extern left lookup_alias P1H(string); -#define ARRAY_SIZE 10000 +#define ARRAY_SIZE 50000 typedef struct { int length; char * str; diff --git a/Build/source/texk/web2c/otps/y_tab.c-dist b/Build/source/texk/web2c/otps/y_tab.c-dist index 675596f95e3..c221ac08b61 100644 --- a/Build/source/texk/web2c/otps/y_tab.c-dist +++ b/Build/source/texk/web2c/otps/y_tab.c-dist @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875a. */ +/* A Bison parser, made by GNU Bison 2.0. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -94,30 +94,7 @@ /* Copy the first part of user declarations. */ -#line 1 "./otp.y" - -/* otp.y: Grammar for OTP files. - -This file is part of Omega, -which is based on the web2c distribution of TeX, - -Copyright (c) 1994--2001 John Plaice and Yannis Haralambous - -Omega is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -Omega is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Omega; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - -*/ +#line 25 "./otp.y" #include "otp.h" #include "routines.h" @@ -155,23 +132,26 @@ typedef int YYSTYPE; /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 160 "y.tab.c" +/* Line 213 of yacc.c. */ +#line 137 "y.tab.c" #if ! defined (yyoverflow) || YYERROR_VERBOSE +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + /* The parser invokes alloca or malloc; define the necessary symbols. */ -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca # else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif +# define YYSTACK_ALLOC alloca # endif # endif # endif @@ -184,20 +164,20 @@ typedef int YYSTYPE; # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ - || (YYSTYPE_IS_TRIVIAL))) + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + short int yyss; YYSTYPE yyvs; }; @@ -207,13 +187,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if 1 < __GNUC__ +# if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -249,22 +229,22 @@ union yyalloc #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short yysigned_char; + typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 177 +#define YYLAST 173 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 40 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 36 /* YYNRULES -- Number of rules. */ -#define YYNRULES 85 +#define YYNRULES 87 /* YYNRULES -- Number of states. */ -#define YYNSTATES 159 +#define YYNSTATES 161 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -309,17 +289,17 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 10, 11, 15, 16, 20, 21, 24, 26, 29, 30, 41, 42, 44, 46, 50, 51, 55, 57, 61, 62, 65, 67, 70, 75, 77, 84, 90, - 92, 94, 98, 100, 105, 109, 113, 115, 119, 122, - 124, 127, 128, 129, 130, 141, 142, 145, 146, 150, - 154, 157, 158, 160, 161, 163, 165, 168, 169, 172, - 174, 176, 179, 182, 189, 192, 199, 206, 215, 218, - 220, 224, 228, 232, 236, 240, 241, 247, 249, 252, - 255, 262, 266, 267, 271, 276 + 95, 97, 99, 103, 105, 110, 114, 118, 120, 124, + 127, 129, 132, 133, 134, 135, 146, 147, 150, 151, + 155, 159, 162, 163, 165, 166, 168, 170, 173, 174, + 177, 179, 181, 184, 187, 194, 197, 204, 211, 220, + 223, 225, 229, 233, 237, 241, 245, 246, 252, 254, + 257, 260, 267, 271, 272, 275, 279, 284 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -334,39 +314,40 @@ static const yysigned_char yyrhs[] = -1, -1, 10, 53, -1, 54, -1, 53, 54, -1, 4, 26, 55, 23, -1, 5, -1, 56, 30, 3, 29, 3, 31, -1, 56, 30, 3, 29, 31, -1, - 56, -1, 3, -1, 3, 21, 3, -1, 32, -1, - 33, 34, 57, 35, -1, 34, 57, 35, -1, 27, - 4, 28, -1, 56, -1, 57, 36, 56, -1, 13, - 59, -1, 60, -1, 59, 60, -1, -1, -1, -1, - 65, 61, 66, 62, 7, 70, 63, 64, 75, 23, - -1, -1, 6, 70, -1, -1, 30, 4, 31, -1, - 67, 69, 68, -1, 67, 68, -1, -1, 18, -1, - -1, 19, -1, 55, -1, 69, 55, -1, -1, 70, - 71, -1, 5, -1, 3, -1, 37, 3, -1, 37, - 38, -1, 37, 34, 38, 21, 3, 35, -1, 37, - 22, -1, 37, 34, 22, 20, 3, 35, -1, 37, - 34, 22, 21, 3, 35, -1, 37, 34, 22, 20, - 3, 21, 3, 35, -1, 39, 74, -1, 74, -1, - 72, 20, 74, -1, 72, 21, 74, -1, 72, 22, - 74, -1, 72, 16, 74, -1, 72, 17, 74, -1, - -1, 4, 73, 24, 72, 25, -1, 3, -1, 37, - 3, -1, 37, 38, -1, 37, 34, 38, 21, 3, - 35, -1, 34, 72, 35, -1, -1, 30, 4, 31, - -1, 30, 14, 4, 31, -1, 30, 15, 31, -1 + 56, 30, 3, 31, -1, 56, -1, 3, -1, 3, + 21, 3, -1, 32, -1, 33, 34, 57, 35, -1, + 34, 57, 35, -1, 27, 4, 28, -1, 56, -1, + 57, 36, 56, -1, 13, 59, -1, 60, -1, 59, + 60, -1, -1, -1, -1, 65, 61, 66, 62, 7, + 70, 63, 64, 75, 23, -1, -1, 6, 70, -1, + -1, 30, 4, 31, -1, 67, 69, 68, -1, 67, + 68, -1, -1, 18, -1, -1, 19, -1, 55, -1, + 69, 55, -1, -1, 70, 71, -1, 5, -1, 3, + -1, 37, 3, -1, 37, 38, -1, 37, 34, 38, + 21, 3, 35, -1, 37, 22, -1, 37, 34, 22, + 20, 3, 35, -1, 37, 34, 22, 21, 3, 35, + -1, 37, 34, 22, 20, 3, 21, 3, 35, -1, + 39, 74, -1, 74, -1, 72, 20, 74, -1, 72, + 21, 74, -1, 72, 22, 74, -1, 72, 16, 74, + -1, 72, 17, 74, -1, -1, 4, 73, 24, 72, + 25, -1, 3, -1, 37, 3, -1, 37, 38, -1, + 37, 34, 38, 21, 3, 35, -1, 34, 72, 35, + -1, -1, 30, 31, -1, 30, 4, 31, -1, 30, + 14, 4, 31, -1, 30, 15, 31, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = +static const unsigned short int yyrline[] = { - 0, 60, 60, 70, 71, 77, 78, 82, 84, 88, - 89, 94, 93, 98, 100, 104, 106, 110, 112, 116, - 118, 122, 124, 128, 129, 133, 138, 140, 142, 144, - 149, 151, 153, 155, 157, 159, 164, 166, 171, 186, - 187, 192, 194, 196, 191, 201, 203, 208, 209, 214, - 216, 222, 223, 229, 230, 235, 237, 241, 243, 247, - 254, 256, 258, 260, 262, 267, 272, 277, 282, 287, - 288, 290, 292, 294, 296, 299, 298, 305, 307, 309, - 311, 313, 316, 318, 320, 322 + 0, 61, 61, 71, 72, 78, 79, 83, 85, 89, + 90, 95, 94, 99, 101, 105, 107, 111, 113, 117, + 119, 123, 125, 129, 130, 134, 139, 141, 143, 145, + 147, 152, 154, 156, 158, 160, 162, 167, 169, 174, + 189, 190, 195, 197, 199, 194, 204, 206, 211, 212, + 217, 219, 225, 226, 232, 233, 238, 240, 244, 246, + 250, 257, 259, 261, 263, 265, 270, 275, 280, 285, + 290, 291, 293, 295, 297, 299, 302, 301, 308, 310, + 312, 314, 316, 319, 321, 323, 325, 327 }; #endif @@ -375,25 +356,24 @@ static const unsigned short yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "NUMBER", "ID", "STRING", "LEFTARROW", - "RIGHTARROW", "INPUT", "OUTPUT", "ALIASES", "STATES", "TABLES", - "EXPRESSIONS", "PUSH", "POP", "DIV", "MOD", "BEG", "END", "'+'", "'-'", - "'*'", "';'", "'['", "']'", "'='", "'{'", "'}'", "','", "'<'", "'>'", - "'.'", "'^'", "'('", "')'", "'|'", "'\\\\'", "'$'", "'#'", "$accept", - "File", "Input", "Output", "Tables", "MoreTables", "OneTable", "@1", - "Numbers", "MoreNumbers", "States", "MoreStates", "Aliases", - "MoreAliases", "OneAlias", "OneCompleteLeft", "OneLeft", "ChoiceLeft", - "Expressions", "MoreExpressions", "OneExpr", "@2", "@3", "@4", - "PushBack", "LeftState", "TotalLeft", "BegLeft", "EndLeft", "Left", - "Right", "OneRight", "RestRightExpr", "@5", "OneRightExpr", - "RightState", 0 + "$end", "error", "$undefined", "NUMBER", "ID", "STRING", "LEFTARROW", + "RIGHTARROW", "INPUT", "OUTPUT", "ALIASES", "STATES", "TABLES", + "EXPRESSIONS", "PUSH", "POP", "DIV", "MOD", "BEG", "END", "'+'", "'-'", + "'*'", "';'", "'['", "']'", "'='", "'{'", "'}'", "','", "'<'", "'>'", + "'.'", "'^'", "'('", "')'", "'|'", "'\\\\'", "'$'", "'#'", "$accept", + "File", "Input", "Output", "Tables", "MoreTables", "OneTable", "@1", + "Numbers", "MoreNumbers", "States", "MoreStates", "Aliases", + "MoreAliases", "OneAlias", "OneCompleteLeft", "OneLeft", "ChoiceLeft", + "Expressions", "MoreExpressions", "OneExpr", "@2", "@3", "@4", + "PushBack", "LeftState", "TotalLeft", "BegLeft", "EndLeft", "Left", + "Right", "OneRight", "RestRightExpr", "@5", "OneRightExpr", "RightState", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -408,12 +388,12 @@ static const unsigned char yyr1[] = 0, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 47, 46, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 55, 55, - 56, 56, 56, 56, 56, 56, 57, 57, 58, 59, - 59, 61, 62, 63, 60, 64, 64, 65, 65, 66, - 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 72, - 72, 72, 72, 72, 72, 73, 72, 74, 74, 74, - 74, 74, 75, 75, 75, 75 + 55, 56, 56, 56, 56, 56, 56, 57, 57, 58, + 59, 59, 61, 62, 63, 60, 64, 64, 65, 65, + 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 72, 72, 72, 72, 72, 72, 73, 72, 74, 74, + 74, 74, 74, 75, 75, 75, 75, 75 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -421,13 +401,13 @@ static const unsigned char yyr2[] = { 0, 2, 6, 0, 3, 0, 3, 0, 2, 1, 2, 0, 10, 0, 1, 1, 3, 0, 3, 1, - 3, 0, 2, 1, 2, 4, 1, 6, 5, 1, - 1, 3, 1, 4, 3, 3, 1, 3, 2, 1, - 2, 0, 0, 0, 10, 0, 2, 0, 3, 3, - 2, 0, 1, 0, 1, 1, 2, 0, 2, 1, - 1, 2, 2, 6, 2, 6, 6, 8, 2, 1, - 3, 3, 3, 3, 3, 0, 5, 1, 2, 2, - 6, 3, 0, 3, 4, 3 + 3, 0, 2, 1, 2, 4, 1, 6, 5, 4, + 1, 1, 3, 1, 4, 3, 3, 1, 3, 2, + 1, 2, 0, 0, 0, 10, 0, 2, 0, 3, + 3, 2, 0, 1, 0, 1, 1, 2, 0, 2, + 1, 1, 2, 2, 6, 2, 6, 6, 8, 2, + 1, 3, 3, 3, 3, 3, 0, 5, 1, 2, + 2, 6, 3, 0, 2, 3, 4, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -438,19 +418,20 @@ static const unsigned char yydefact[] = 3, 0, 0, 5, 0, 1, 0, 7, 4, 0, 0, 17, 6, 0, 8, 9, 0, 21, 0, 10, 19, 0, 0, 0, 0, 18, 0, 0, 22, 23, - 47, 2, 11, 20, 0, 24, 0, 47, 39, 41, - 0, 30, 26, 0, 32, 0, 0, 0, 29, 0, - 40, 51, 0, 0, 0, 0, 36, 0, 25, 0, - 48, 52, 42, 53, 13, 31, 35, 0, 34, 0, - 0, 0, 54, 55, 50, 53, 15, 0, 14, 33, - 37, 0, 57, 56, 49, 0, 0, 0, 28, 43, - 12, 16, 27, 60, 59, 0, 0, 45, 58, 61, - 64, 0, 62, 77, 0, 0, 68, 57, 82, 0, - 0, 75, 0, 69, 78, 0, 79, 46, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, - 0, 0, 0, 0, 44, 0, 0, 0, 0, 73, - 74, 70, 71, 72, 0, 83, 0, 85, 0, 65, - 66, 63, 0, 0, 84, 0, 76, 80, 67 + 48, 2, 11, 20, 0, 24, 0, 48, 40, 42, + 0, 31, 26, 0, 33, 0, 0, 0, 30, 0, + 41, 52, 0, 0, 0, 0, 37, 0, 25, 0, + 49, 53, 43, 54, 13, 32, 36, 0, 35, 0, + 0, 0, 55, 56, 51, 54, 15, 0, 14, 34, + 38, 0, 29, 58, 57, 50, 0, 0, 0, 28, + 44, 12, 16, 27, 61, 60, 0, 0, 46, 59, + 62, 65, 0, 63, 78, 0, 0, 69, 58, 83, + 0, 0, 76, 0, 70, 79, 0, 80, 47, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 82, 0, 0, 0, 0, 84, 45, 0, 0, 0, + 0, 74, 75, 71, 72, 73, 0, 85, 0, 87, + 0, 66, 67, 64, 0, 0, 86, 0, 77, 81, + 68 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -458,89 +439,90 @@ static const yysigned_char yydefgoto[] = { -1, 2, 3, 7, 11, 14, 15, 40, 77, 78, 17, 21, 23, 28, 29, 47, 48, 57, 31, 37, - 38, 51, 71, 97, 108, 39, 62, 63, 74, 75, - 89, 98, 112, 123, 113, 119 + 38, 51, 71, 98, 109, 39, 62, 63, 74, 75, + 90, 99, 113, 124, 114, 120 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -96 -static const yysigned_char yypact[] = +#define YYPACT_NINF -97 +static const short int yypact[] = { - 0, 10, 18, 11, 44, -96, 54, 53, -96, 48, - 81, 75, -96, 64, 81, -96, 85, 80, 88, -96, - -96, 43, 89, 79, 69, -96, 91, 70, 89, -96, - 67, -96, -96, -96, 22, -96, 94, 17, -96, -96, - 73, 82, -96, 96, -96, 68, 41, 78, 74, 76, - -96, 87, 83, 103, 84, 41, -96, -20, -96, 105, - -96, -96, -96, 19, 106, -96, -96, 34, -96, 41, - 86, 104, -96, -96, -96, 19, -96, 90, 92, -96, - -96, 45, -96, -96, -96, 93, 110, 95, -96, -3, - -96, -96, -96, -96, -96, 1, 8, 108, -96, -96, - -96, -17, -96, -96, 6, 3, -96, -96, 97, 60, - 98, -96, 42, -96, -96, 99, -96, -3, 46, 100, - 114, 117, 119, 101, 8, 8, 8, 8, 8, -96, - 107, 102, 120, 109, -96, -7, 111, 112, 6, -96, - -96, -96, -96, -96, 126, -96, 113, -96, 127, -96, - -96, -96, 62, 115, -96, 116, -96, -96, -96 + 0, 13, 18, 11, 34, -97, 69, 66, -97, 65, + 85, 79, -97, 67, 85, -97, 88, 83, 91, -97, + -97, 56, 92, 82, 72, -97, 94, 73, 92, -97, + 70, -97, -97, -97, 22, -97, 97, 17, -97, -97, + 76, 84, -97, 99, -97, 74, 41, 81, 77, 75, + -97, 93, 86, 106, 87, 41, -97, 47, -97, 107, + -97, -97, -97, 19, 109, -97, -97, 51, -97, 41, + -16, 110, -97, -97, -97, 19, -97, 90, 95, -97, + -97, 45, -97, -97, -97, -97, 96, 111, 89, -97, + -3, -97, -97, -97, -97, -97, 1, 8, 115, -97, + -97, -97, -17, -97, -97, 6, 3, -97, -97, 98, + 60, 101, -97, 49, -97, -97, 78, -97, -3, 46, + 100, 122, 123, 124, 105, 8, 8, 8, 8, 8, + -97, 112, 103, 126, 104, -97, -97, -7, 102, 108, + 6, -97, -97, -97, -97, -97, 128, -97, 113, -97, + 129, -97, -97, -97, 42, 114, -97, 116, -97, -97, + -97 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { - -96, -96, -96, -96, -96, -96, 118, -96, -96, -96, - -96, -96, -96, -96, 121, -56, -43, 122, -96, -96, - 123, -96, -96, -96, -96, -96, -96, -96, 56, -96, - 27, -96, -2, -96, -95, -96 + -97, -97, -97, -97, -97, -97, 125, -97, -97, -97, + -97, -97, -97, -97, 117, -56, -43, 118, -97, -97, + 119, -97, -97, -97, -97, -97, -97, -97, 61, -97, + 30, -97, 2, -97, -96, -97 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -39 -static const short yytable[] = +#define YYTABLE_NINF -40 +static const short int yytable[] = { - 93, 106, 94, 56, 99, 109, 114, 73, 1, 103, - 111, 103, 56, 4, 148, 68, 69, -38, 5, 83, - 6, 110, 41, 100, 42, 41, 80, 42, 149, 139, - 140, 141, 142, 143, 95, 101, 96, 115, 72, 102, - 104, 116, 104, 105, 41, 105, 43, 36, 87, 43, - 131, 44, 45, 46, 44, 45, 46, 9, 124, 125, - 132, 133, 126, 127, 128, 10, 25, 8, 43, 79, - 69, 12, 26, 44, 45, 46, 88, 129, 124, 125, - 120, 121, 126, 127, 128, 13, 16, 156, 18, 20, - 22, 24, 30, 27, 32, 33, 34, 36, 49, 52, - 54, 58, 55, 53, 59, 61, 65, 60, 70, 76, - 64, 82, 66, 91, 107, 81, 90, 135, 85, 122, - 136, 86, 137, 134, 146, 138, 92, 118, 144, 153, - 155, 84, 19, 145, 117, 0, 152, 130, 0, 0, - 147, 0, 0, 0, 154, 0, 150, 151, 0, 35, - 157, 158, 0, 0, 0, 0, 0, 0, 0, 0, - 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 67 + 94, 107, 95, 56, 100, 110, 115, 73, 1, 104, + 112, 104, 56, 81, 150, 82, 4, -39, 5, 84, + 6, 111, 41, 101, 42, 41, 80, 42, 151, 141, + 142, 143, 144, 145, 96, 102, 97, 116, 72, 103, + 105, 117, 105, 106, 41, 106, 43, 36, 88, 43, + 132, 44, 45, 46, 44, 45, 46, 8, 125, 126, + 133, 134, 127, 128, 129, 125, 126, 158, 43, 127, + 128, 129, 9, 44, 45, 46, 89, 135, 10, 25, + 121, 122, 68, 69, 130, 26, 79, 69, 12, 13, + 16, 18, 20, 22, 24, 30, 27, 32, 33, 34, + 36, 49, 52, 54, 58, 53, 60, 59, 55, 65, + 70, 61, 76, 64, 92, 66, 131, 83, 86, 91, + 93, 108, 123, 136, 87, 137, 138, 139, 119, 140, + 148, 155, 157, 146, 147, 149, 85, 152, 118, 19, + 0, 0, 154, 153, 156, 35, 0, 0, 0, 159, + 0, 160, 0, 0, 0, 0, 50, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 67 }; -static const short yycheck[] = +static const short int yycheck[] = { - 3, 96, 5, 46, 3, 22, 3, 63, 8, 3, - 4, 3, 55, 3, 21, 35, 36, 0, 0, 75, - 9, 38, 3, 22, 5, 3, 69, 5, 35, 124, - 125, 126, 127, 128, 37, 34, 39, 34, 19, 38, + 3, 97, 5, 46, 3, 22, 3, 63, 8, 3, + 4, 3, 55, 29, 21, 31, 3, 0, 0, 75, + 9, 38, 3, 22, 5, 3, 69, 5, 35, 125, + 126, 127, 128, 129, 37, 34, 39, 34, 19, 38, 34, 38, 34, 37, 3, 37, 27, 30, 3, 27, - 4, 32, 33, 34, 32, 33, 34, 3, 16, 17, - 14, 15, 20, 21, 22, 12, 23, 23, 27, 35, - 36, 23, 29, 32, 33, 34, 31, 35, 16, 17, - 20, 21, 20, 21, 22, 4, 11, 25, 24, 4, - 10, 3, 13, 4, 25, 4, 26, 30, 4, 26, - 4, 23, 34, 21, 30, 18, 3, 31, 3, 3, - 27, 7, 28, 3, 6, 29, 23, 3, 28, 21, - 3, 29, 3, 23, 4, 24, 31, 30, 21, 3, - 3, 75, 14, 31, 107, -1, 138, 38, -1, -1, - 31, -1, -1, -1, 31, -1, 35, 35, -1, 28, - 35, 35, -1, -1, -1, -1, -1, -1, -1, -1, - 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 55 + 4, 32, 33, 34, 32, 33, 34, 23, 16, 17, + 14, 15, 20, 21, 22, 16, 17, 25, 27, 20, + 21, 22, 3, 32, 33, 34, 31, 31, 12, 23, + 20, 21, 35, 36, 35, 29, 35, 36, 23, 4, + 11, 24, 4, 10, 3, 13, 4, 25, 4, 26, + 30, 4, 26, 4, 23, 21, 31, 30, 34, 3, + 3, 18, 3, 27, 3, 28, 38, 7, 28, 23, + 31, 6, 21, 23, 29, 3, 3, 3, 30, 24, + 4, 3, 3, 21, 31, 31, 75, 35, 108, 14, + -1, -1, 140, 35, 31, 28, -1, -1, -1, 35, + -1, 35, -1, -1, -1, -1, 37, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 55 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -555,14 +537,15 @@ static const unsigned char yystos[] = 60, 61, 26, 21, 4, 34, 56, 57, 23, 30, 31, 18, 66, 67, 27, 3, 28, 57, 35, 36, 3, 62, 19, 55, 68, 69, 3, 48, 49, 35, - 56, 29, 7, 55, 68, 28, 29, 3, 31, 70, - 23, 3, 31, 3, 5, 37, 39, 63, 71, 3, - 22, 34, 38, 3, 34, 37, 74, 6, 64, 22, - 38, 4, 72, 74, 3, 34, 38, 70, 30, 75, - 20, 21, 21, 73, 16, 17, 20, 21, 22, 35, - 38, 4, 14, 15, 23, 3, 3, 3, 24, 74, - 74, 74, 74, 74, 21, 31, 4, 31, 21, 35, - 35, 35, 72, 3, 31, 3, 25, 35, 35 + 56, 29, 31, 7, 55, 68, 28, 29, 3, 31, + 70, 23, 3, 31, 3, 5, 37, 39, 63, 71, + 3, 22, 34, 38, 3, 34, 37, 74, 6, 64, + 22, 38, 4, 72, 74, 3, 34, 38, 70, 30, + 75, 20, 21, 21, 73, 16, 17, 20, 21, 22, + 35, 38, 4, 14, 15, 31, 23, 3, 3, 3, + 24, 74, 74, 74, 74, 74, 21, 31, 4, 31, + 21, 35, 35, 35, 72, 3, 31, 3, 25, 35, + 35 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -588,7 +571,7 @@ static const unsigned char yystos[] = #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 +#define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily @@ -616,20 +599,53 @@ do \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.first_line = Rhs[1].first_line; \ - Current.first_column = Rhs[1].first_column; \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif #endif + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -652,36 +668,30 @@ do { \ YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ - Token, Value); \ + Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (cinluded). | +| TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -711,9 +721,9 @@ yy_reduce_print (yyrule) #endif { int yyi; - unsigned int yylineno = yyrline[yyrule]; + unsigned int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylineno); + yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); @@ -731,8 +741,7 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -750,10 +759,6 @@ int yydebug; SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -835,15 +840,15 @@ yysymprint (yyoutput, yytype, yyvaluep) (void) yyvaluep; if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { default: @@ -859,10 +864,11 @@ yysymprint (yyoutput, yytype, yyvaluep) #if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif @@ -870,6 +876,10 @@ yydestruct (yytype, yyvaluep) /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + switch (yytype) { @@ -897,10 +907,10 @@ int yyparse (); -/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -936,7 +946,7 @@ yyparse () int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -948,9 +958,9 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -987,6 +997,9 @@ yyparse () yyssp = yyss; yyvsp = yyvs; + + yyvsp[0] = yylval; + goto yysetstate; /*------------------------------------------------------------. @@ -1012,7 +1025,7 @@ yyparse () these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the @@ -1040,7 +1053,7 @@ yyparse () yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) @@ -1076,18 +1089,18 @@ yyparse () yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1102,7 +1115,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1122,8 +1135,8 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1173,117 +1186,122 @@ yyreduce: switch (yyn) { case 3: -#line 70 "./otp.y" +#line 71 "./otp.y" { input_bytes=2; } break; case 4: -#line 72 "./otp.y" - { input_bytes=yyvsp[-1].yint; } +#line 73 "./otp.y" + { input_bytes=(yyvsp[-1]).yint; } break; case 5: -#line 77 "./otp.y" +#line 78 "./otp.y" { output_bytes=2; } break; case 6: -#line 79 "./otp.y" - { output_bytes=yyvsp[-1].yint; } +#line 80 "./otp.y" + { output_bytes=(yyvsp[-1]).yint; } break; case 11: -#line 94 "./otp.y" - { store_table(yyvsp[-3].ystring, yyvsp[-1].yint); } +#line 95 "./otp.y" + { store_table((yyvsp[-3]).ystring, (yyvsp[-1]).yint); } break; case 15: -#line 105 "./otp.y" - { add_to_table(yyvsp[0].yint); } +#line 106 "./otp.y" + { add_to_table((yyvsp[0]).yint); } break; case 16: -#line 107 "./otp.y" - { add_to_table(yyvsp[0].yint); } +#line 108 "./otp.y" + { add_to_table((yyvsp[0]).yint); } break; case 19: -#line 117 "./otp.y" - { store_state(yyvsp[0].ystring); } +#line 118 "./otp.y" + { store_state((yyvsp[0]).ystring); } break; case 20: -#line 119 "./otp.y" - { store_state(yyvsp[0].ystring); } +#line 120 "./otp.y" + { store_state((yyvsp[0]).ystring); } break; case 25: -#line 134 "./otp.y" - { store_alias(yyvsp[-3].ystring, yyvsp[-1].yleft); } +#line 135 "./otp.y" + { store_alias((yyvsp[-3]).ystring, (yyvsp[-1]).yleft); } break; case 26: -#line 139 "./otp.y" - { yyval.yleft = StringLeft(yyvsp[0].ystring); } +#line 140 "./otp.y" + { (yyval).yleft = StringLeft((yyvsp[0]).ystring); } break; case 27: -#line 141 "./otp.y" - { yyval.yleft = CompleteLeft(yyvsp[-5].yleft, yyvsp[-3].yint, yyvsp[-1].yint); } +#line 142 "./otp.y" + { (yyval).yleft = CompleteLeft((yyvsp[-5]).yleft, (yyvsp[-3]).yint, (yyvsp[-1]).yint); } break; case 28: -#line 143 "./otp.y" - { yyval.yleft = PlusLeft(yyvsp[-4].yleft, yyvsp[-2].yint); } +#line 144 "./otp.y" + { (yyval).yleft = PlusLeft((yyvsp[-4]).yleft, (yyvsp[-2]).yint); } break; case 29: -#line 145 "./otp.y" - { yyval.yleft = yyvsp[0].yleft; } +#line 146 "./otp.y" + { (yyval).yleft = CompleteLeft((yyvsp[-3]).yleft, (yyvsp[-1]).yint, (yyvsp[-1]).yint); } break; case 30: -#line 150 "./otp.y" - { yyval.yleft = SingleLeft(yyvsp[0].yint); } +#line 148 "./otp.y" + { (yyval).yleft = (yyvsp[0]).yleft; } break; case 31: -#line 152 "./otp.y" - { yyval.yleft = DoubleLeft(yyvsp[-2].yint, yyvsp[0].yint); } +#line 153 "./otp.y" + { (yyval).yleft = SingleLeft((yyvsp[0]).yint); } break; case 32: -#line 154 "./otp.y" - { yyval.yleft = WildCard(); } +#line 155 "./otp.y" + { (yyval).yleft = DoubleLeft((yyvsp[-2]).yint, (yyvsp[0]).yint); } break; case 33: -#line 156 "./otp.y" - { yyval.yleft = NotChoiceLeft(yyvsp[-1].ylleft); } +#line 157 "./otp.y" + { (yyval).yleft = WildCard(); } break; case 34: -#line 158 "./otp.y" - { yyval.yleft = ChoiceLeft(yyvsp[-1].ylleft); } +#line 159 "./otp.y" + { (yyval).yleft = NotChoiceLeft((yyvsp[-1]).ylleft); } break; case 35: -#line 160 "./otp.y" - { yyval.yleft = lookup_alias(yyvsp[-1].ystring); } +#line 161 "./otp.y" + { (yyval).yleft = ChoiceLeft((yyvsp[-1]).ylleft); } break; case 36: -#line 165 "./otp.y" - { yyval.ylleft = llist1(yyvsp[0].yleft); } +#line 163 "./otp.y" + { (yyval).yleft = lookup_alias((yyvsp[-1]).ystring); } break; case 37: -#line 167 "./otp.y" - { yyval.ylleft = lappend1(yyvsp[-2].ylleft, yyvsp[0].yleft); } +#line 168 "./otp.y" + { (yyval).ylleft = llist1((yyvsp[0]).yleft); } break; case 38: -#line 172 "./otp.y" +#line 170 "./otp.y" + { (yyval).ylleft = lappend1((yyvsp[-2]).ylleft, (yyvsp[0]).yleft); } + break; + + case 39: +#line 175 "./otp.y" { for(cur_state=0; cur_state<no_states; cur_state++) { if ((states[cur_state].no_exprs)==0) { @@ -1297,218 +1315,223 @@ yyreduce: } break; - case 41: -#line 192 "./otp.y" - { states[cur_state].no_exprs++; } - break; - case 42: -#line 194 "./otp.y" - { out_left(yyvsp[0].ylleft); right_offset=0; } +#line 195 "./otp.y" + { states[cur_state].no_exprs++; } break; case 43: -#line 196 "./otp.y" - { right_offset=OTP_PBACK_OFFSET; } +#line 197 "./otp.y" + { out_left((yyvsp[0]).ylleft); right_offset=0; } break; case 44: -#line 198 "./otp.y" - { fill_in_left(); } +#line 199 "./otp.y" + { right_offset=OTP_PBACK_OFFSET; } break; - case 47: -#line 208 "./otp.y" - { cur_state = 0; } + case 45: +#line 201 "./otp.y" + { fill_in_left(); } break; case 48: -#line 210 "./otp.y" - { cur_state = lookup_state(yyvsp[-1].ystring); } +#line 211 "./otp.y" + { cur_state = 0; } break; case 49: -#line 215 "./otp.y" - { yyval.ylleft = lappend(yyvsp[-2].ylleft, lappend(yyvsp[-1].ylleft, yyvsp[0].ylleft)); } +#line 213 "./otp.y" + { cur_state = lookup_state((yyvsp[-1]).ystring); } break; case 50: -#line 217 "./otp.y" - { yyval.ylleft = lappend(yyvsp[-1].ylleft, yyvsp[0].ylleft); } +#line 218 "./otp.y" + { (yyval).ylleft = lappend((yyvsp[-2]).ylleft, lappend((yyvsp[-1]).ylleft, (yyvsp[0]).ylleft)); } break; case 51: -#line 222 "./otp.y" - { yyval.ylleft = nil; } +#line 220 "./otp.y" + { (yyval).ylleft = lappend((yyvsp[-1]).ylleft, (yyvsp[0]).ylleft); } break; case 52: -#line 224 "./otp.y" - { yyval.ylleft = llist1(BeginningLeft()); } +#line 225 "./otp.y" + { (yyval).ylleft = nil; } break; case 53: -#line 229 "./otp.y" - { yyval.ylleft = nil; } +#line 227 "./otp.y" + { (yyval).ylleft = llist1(BeginningLeft()); } break; case 54: -#line 231 "./otp.y" - { yyval.ylleft = llist1(EndLeft()); } +#line 232 "./otp.y" + { (yyval).ylleft = nil; } break; case 55: -#line 236 "./otp.y" - { yyval.ylleft = llist1(yyvsp[0].yleft); } +#line 234 "./otp.y" + { (yyval).ylleft = llist1(EndLeft()); } break; case 56: -#line 238 "./otp.y" - { yyval.ylleft = lappend1(yyvsp[-1].ylleft, yyvsp[0].yleft); } +#line 239 "./otp.y" + { (yyval).ylleft = llist1((yyvsp[0]).yleft); } + break; + + case 57: +#line 241 "./otp.y" + { (yyval).ylleft = lappend1((yyvsp[-1]).ylleft, (yyvsp[0]).yleft); } break; - case 59: -#line 248 "./otp.y" + case 60: +#line 251 "./otp.y" { - len=strlen(yyvsp[0].ystring); + len=strlen((yyvsp[0]).ystring); for (k=0; k<len; k++) { - out_right(OTP_RIGHT_NUM, (yyvsp[0].ystring)[k]); + out_right(OTP_RIGHT_NUM, ((yyvsp[0]).ystring)[k]); } } break; - case 60: -#line 255 "./otp.y" - { out_right(OTP_RIGHT_NUM, yyvsp[0].yint); } - break; - case 61: -#line 257 "./otp.y" - { out_right(OTP_RIGHT_CHAR, yyvsp[0].yint); } +#line 258 "./otp.y" + { out_right(OTP_RIGHT_NUM, (yyvsp[0]).yint); } break; case 62: -#line 259 "./otp.y" - { out_right(OTP_RIGHT_LCHAR, 0); } +#line 260 "./otp.y" + { out_right(OTP_RIGHT_CHAR, (yyvsp[0]).yint); } break; case 63: -#line 261 "./otp.y" - { out_right(OTP_RIGHT_LCHAR, yyvsp[-1].yint); } +#line 262 "./otp.y" + { out_right(OTP_RIGHT_LCHAR, 0); } break; case 64: -#line 263 "./otp.y" +#line 264 "./otp.y" + { out_right(OTP_RIGHT_LCHAR, (yyvsp[-1]).yint); } + break; + + case 65: +#line 266 "./otp.y" { out_right(OTP_RIGHT_SOME, 0); out_int(0,0); } break; - case 65: -#line 268 "./otp.y" + case 66: +#line 271 "./otp.y" { - out_right(OTP_RIGHT_SOME, yyvsp[-1].yint); + out_right(OTP_RIGHT_SOME, (yyvsp[-1]).yint); out_int(0, 0); } break; - case 66: -#line 273 "./otp.y" + case 67: +#line 276 "./otp.y" { out_right(OTP_RIGHT_SOME, 0); - out_int(0, yyvsp[-1].yint); + out_int(0, (yyvsp[-1]).yint); } break; - case 67: -#line 278 "./otp.y" + case 68: +#line 281 "./otp.y" { - out_right(OTP_RIGHT_SOME, yyvsp[-3].yint); - out_int(0, yyvsp[-1].yint); + out_right(OTP_RIGHT_SOME, (yyvsp[-3]).yint); + out_int(0, (yyvsp[-1]).yint); } break; - case 68: -#line 283 "./otp.y" + case 69: +#line 286 "./otp.y" { out_right(OTP_RIGHT_OUTPUT, 0); } break; - case 70: -#line 289 "./otp.y" - { out_int(OTP_ADD, 0); } - break; - case 71: -#line 291 "./otp.y" - { out_int(OTP_SUB, 0); } +#line 292 "./otp.y" + { out_int(OTP_ADD, 0); } break; case 72: -#line 293 "./otp.y" - { out_int(OTP_MULT, 0); } +#line 294 "./otp.y" + { out_int(OTP_SUB, 0); } break; case 73: -#line 295 "./otp.y" - { out_int(OTP_DIV, 0); } +#line 296 "./otp.y" + { out_int(OTP_MULT, 0); } break; case 74: -#line 297 "./otp.y" - { out_int(OTP_MOD, 0); } +#line 298 "./otp.y" + { out_int(OTP_DIV, 0); } break; case 75: -#line 299 "./otp.y" - { out_int(OTP_PUSH_NUM, lookup_table(yyvsp[0].ystring)); } +#line 300 "./otp.y" + { out_int(OTP_MOD, 0); } break; case 76: -#line 301 "./otp.y" - { out_int(OTP_LOOKUP, 0); } +#line 302 "./otp.y" + { out_int(OTP_PUSH_NUM, lookup_table((yyvsp[0]).ystring)); } break; case 77: -#line 306 "./otp.y" - { out_int(OTP_PUSH_NUM, yyvsp[0].yint); } +#line 304 "./otp.y" + { out_int(OTP_LOOKUP, 0); } break; case 78: -#line 308 "./otp.y" - { out_int(OTP_PUSH_CHAR, yyvsp[0].yint); } +#line 309 "./otp.y" + { out_int(OTP_PUSH_NUM, (yyvsp[0]).yint); } break; case 79: -#line 310 "./otp.y" - { out_int(OTP_PUSH_LCHAR, 0); } +#line 311 "./otp.y" + { out_int(OTP_PUSH_CHAR, (yyvsp[0]).yint); } break; case 80: -#line 312 "./otp.y" - { out_int(OTP_PUSH_LCHAR, yyvsp[-1].yint); } +#line 313 "./otp.y" + { out_int(OTP_PUSH_LCHAR, 0); } break; - case 83: -#line 319 "./otp.y" - { out_int(OTP_STATE_CHANGE, lookup_state(yyvsp[-1].ystring)); } + case 81: +#line 315 "./otp.y" + { out_int(OTP_PUSH_LCHAR, (yyvsp[-1]).yint); } break; case 84: -#line 321 "./otp.y" - { out_int(OTP_STATE_PUSH, lookup_state(yyvsp[-1].ystring)); } +#line 322 "./otp.y" + { out_int(OTP_STATE_CHANGE, 0); } break; case 85: -#line 323 "./otp.y" +#line 324 "./otp.y" + { out_int(OTP_STATE_CHANGE, lookup_state((yyvsp[-1]).ystring)); } + break; + + case 86: +#line 326 "./otp.y" + { out_int(OTP_STATE_PUSH, lookup_state((yyvsp[-1]).ystring)); } + break; + + case 87: +#line 328 "./otp.y" { out_int(OTP_STATE_POP, 0); } break; } -/* Line 999 of yacc.c. */ -#line 1512 "y.tab.c" +/* Line 1037 of yacc.c. */ +#line 1535 "y.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -1549,18 +1572,33 @@ yyerrlab: { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); + const char* yyprefix; char *yymsg; - int yyx, yycount; + int yyx; - yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("syntax error, unexpected ") + 1; - yysize += yystrlen (yytname[yytype]); + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { @@ -1569,16 +1607,13 @@ yyerrlab: if (yycount < 5) { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yyprefix); yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; + yyprefix = " or "; } } yyerror (yymsg); @@ -1596,38 +1631,57 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ - /* Return failure if at end of input. */ - if (yychar == YYEOF) + if (yychar <= YYEOF) { - /* Pop the error token. */ - YYPOPSTACK; - /* Pop the rest of the stack. */ - while (yyss < yyssp) - { - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - YYPOPSTACK; - } - YYABORT; + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + yydestruct ("Error: popping", + yystos[*yyssp], yyvsp); + } } - - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); - yychar = YYEMPTY; - + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; -/*----------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action. | -`----------------------------------------------------*/ +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + +yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ @@ -1649,22 +1703,22 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); - yyvsp--; - yystate = *--yyssp; + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -1680,6 +1734,9 @@ yyacceptlab: | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: + yydestruct ("Error: discarding lookahead", + yytoken, &yylval); + yychar = YYEMPTY; yyresult = 1; goto yyreturn; @@ -1702,6 +1759,6 @@ yyreturn: } -#line 325 "./otp.y" +#line 330 "./otp.y" diff --git a/Build/source/texk/web2c/otps/y_tab.h-dist b/Build/source/texk/web2c/otps/y_tab.h-dist index bfe9285131f..098d5627349 100644 --- a/Build/source/texk/web2c/otps/y_tab.h-dist +++ b/Build/source/texk/web2c/otps/y_tab.h-dist @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875a. */ +/* A Bison parser, made by GNU Bison 2.0. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |