diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
commit | 487ca4806cc046076293cf6cc5fbba0db282bac7 (patch) | |
tree | 847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/web2c/otps | |
parent | a3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff) |
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/otps')
-rw-r--r-- | Build/source/texk/web2c/otps/ChangeLog | 21 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/Makefile.in | 52 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/depend.mak | 67 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/depend.mk | 53 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/lex.yy.c-dist | 1988 | ||||
-rwxr-xr-x | Build/source/texk/web2c/otps/mkocp | 6 | ||||
-rwxr-xr-x | Build/source/texk/web2c/otps/mkofm | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp.h | 73 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp.l | 129 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp.y | 325 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/otp2ocp.c | 173 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/outocp.c | 228 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/routines.c | 549 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/routines.h | 148 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/win32.mak | 70 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/y_tab.c-dist | 1707 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/y_tab.h-dist | 82 | ||||
-rw-r--r-- | Build/source/texk/web2c/otps/yystype.h | 31 |
18 files changed, 5705 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/otps/ChangeLog b/Build/source/texk/web2c/otps/ChangeLog new file mode 100644 index 00000000000..6cc4795582b --- /dev/null +++ b/Build/source/texk/web2c/otps/ChangeLog @@ -0,0 +1,21 @@ +2002-11-18 Roozbeh Pournader <roozbeh@sharif.edu> + + * 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> + + * otp2ocp.c: added two copyright lines. + * otp.l: fixed a buffer overflow bug, now accepts all end of line + formats, fixed error reports on numbers greater than 65535 (patch + by Behdad Esfahbod). + * otp.h: changed '#define's to 'enum' (patch by Behdad Esfahbod). + * lex.yy.c-dist: rebuilt. + +2002-10-15 Roozbeh Pournader <roozbeh@sharif.edu> + + * otp2ocp.c: fixed some '.ocp' writing bugs; otp2ocp now fails with + a non-zero return value if parsing the input fails (patch by + Behdad Esfahbod <omega@behdad.org>). + * otp2ocp.c, outocp.c: 'indent'-ed. diff --git a/Build/source/texk/web2c/otps/Makefile.in b/Build/source/texk/web2c/otps/Makefile.in new file mode 100644 index 00000000000..5351bcc279f --- /dev/null +++ b/Build/source/texk/web2c/otps/Makefile.in @@ -0,0 +1,52 @@ +# Makefile for TeX-project WEB sources to C conversion programs. + +# These get expanded from the parent directory, not this one. +kpse_include ../make/common.mk +kpse_include ../make/programs.mk +kpse_include ../make/paths.mk +kpse_include kpathsea.mk + +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +YACC = @YACC@ + +proglib = ../lib/lib.a +programs = otp2ocp outocp +scripts = mkocp mkofm + +otp2ocp_objects = otp2ocp.o routines.o y_tab.o $(LEX_OUTPUT_ROOT).o +all: $(programs) +otp2ocp: $(otp2ocp_objects) + $(kpathsea_link) $(otp2ocp_objects) $(LEXLIB) $(LOADLIBES) + +otp2ocp.o: otp2ocp.c y_tab.h +y_tab.c y_tab.h: otp.y + $(YACC) -d -v $(srcdir)/otp.y + -test -f y.tab.c && mv -f y.tab.c y_tab.c + -test -f y.tab.h && mv -f y.tab.h y_tab.h +$(LEX_OUTPUT_ROOT).o: otp.h +$(LEX_OUTPUT_ROOT).c: otp.l + $(LEX) $(srcdir)/otp.l + +outocp: outocp.o + $(kpathsea_link) outocp.o $(LOADLIBES) + +$(programs): $(proglib) $(kpathsea) + +install-programs: $(programs) + $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) + for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done + for p in $(scripts); do $(INSTALL_SCRIPT) $(srcdir)/$$p $(scriptdir); done + +Makefile: Makefile.in ../config.status + cd .. && $(SHELL) config.status + +kpse_include ../make/tkpathsea.mk +kpse_include ../make/clean.mk + +clean:: + rm -f y_tab.c y_tab.h y.out* yacc.* $(LEX_OUTPUT_ROOT).c + +kpse_include ../make/rdepend.mk +kpse_include otps/depend.mk diff --git a/Build/source/texk/web2c/otps/depend.mak b/Build/source/texk/web2c/otps/depend.mak new file mode 100644 index 00000000000..fcd8a570a6c --- /dev/null +++ b/Build/source/texk/web2c/otps/depend.mak @@ -0,0 +1,67 @@ +$(objdir)/otp2ocp.obj: \ + $(kpathseadir)/config.h \ + $(kpathseadir)/c-auto.h \ + $(kpathseadir)/c-std.h \ + $(kpathseadir)/c-unistd.h \ + $(kpathseadir)/systypes.h \ + $(kpathseadir)/c-memstr.h \ + $(kpathseadir)/c-errno.h \ + $(kpathseadir)/c-minmax.h \ + $(kpathseadir)/c-limits.h \ + $(kpathseadir)/c-proto.h \ + $(gnuw32dir)/win32lib.h \ + $(kpathseadir)/debug.h \ + $(kpathseadir)/types.h \ + $(kpathseadir)/lib.h \ + $(kpathseadir)/progname.h \ + $(kpathseadir)/c-fopen.h \ + $(kpathseadir)/tex-file.h \ + $(kpathseadir)/c-vararg.h \ + routines.h \ + ../config.h \ + $(kpathseadir)/../web2c/c-auto.h + +$(objdir)/routines.obj: \ + $(kpathseadir)/config.h \ + $(kpathseadir)/c-auto.h \ + $(kpathseadir)/c-std.h \ + $(kpathseadir)/c-unistd.h \ + $(kpathseadir)/systypes.h \ + $(kpathseadir)/c-memstr.h \ + $(kpathseadir)/c-errno.h \ + $(kpathseadir)/c-minmax.h \ + $(kpathseadir)/c-limits.h \ + $(kpathseadir)/c-proto.h \ + $(gnuw32dir)/win32lib.h \ + $(kpathseadir)/debug.h \ + $(kpathseadir)/types.h \ + $(kpathseadir)/lib.h \ + $(kpathseadir)/progname.h \ + routines.h \ + ../config.h \ + $(kpathseadir)/../web2c/c-auto.h \ + $(kpathseadir)/c-vararg.h \ + $(kpathseadir)/c-fopen.h \ + otp.h + +$(objdir)/outocp.obj: \ + $(kpathseadir)/config.h \ + $(kpathseadir)/c-auto.h \ + $(kpathseadir)/c-std.h \ + $(kpathseadir)/c-unistd.h \ + $(kpathseadir)/systypes.h \ + $(kpathseadir)/c-memstr.h \ + $(kpathseadir)/c-errno.h \ + $(kpathseadir)/c-minmax.h \ + $(kpathseadir)/c-limits.h \ + $(kpathseadir)/c-proto.h \ + $(gnuw32dir)/win32lib.h \ + $(kpathseadir)/debug.h \ + $(kpathseadir)/types.h \ + $(kpathseadir)/lib.h \ + $(kpathseadir)/progname.h \ + $(kpathseadir)/c-fopen.h \ + $(kpathseadir)/tex-file.h \ + $(kpathseadir)/c-vararg.h \ + otp.h + diff --git a/Build/source/texk/web2c/otps/depend.mk b/Build/source/texk/web2c/otps/depend.mk new file mode 100644 index 00000000000..81ba667227c --- /dev/null +++ b/Build/source/texk/web2c/otps/depend.mk @@ -0,0 +1,53 @@ +$(LEX_OUTPUT_ROOT).o: $(LEX_OUTPUT_ROOT).c \ + routines.h ../config.h $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + yystype.h y_tab.h +otp2ocp.o: otp2ocp.c $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h routines.h \ + ../config.h ../../web2c/c-auto.h +outocp.o: outocp.c $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + $(kpathsea_srcdir)/c-fopen.h \ + $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h otp.h +routines.o: routines.c $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \ + $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + routines.h ../config.h ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h \ + $(kpathsea_srcdir)/c-fopen.h \ + otp.h +y_tab.o: y_tab.c otp.h routines.h ../config.h $(kpathsea_srcdir)/config.h \ + $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \ + $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ + $(kpathsea_srcdir)/c-memstr.h \ + $(kpathsea_srcdir)/c-errno.h \ + $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \ + $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ + $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \ + ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \ + yystype.h diff --git a/Build/source/texk/web2c/otps/lex.yy.c-dist b/Build/source/texk/web2c/otps/lex.yy.c-dist new file mode 100644 index 00000000000..ad8394f92ec --- /dev/null +++ b/Build/source/texk/web2c/otps/lex.yy.c-dist @@ -0,0 +1,1988 @@ + +#line 3 "lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#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 + +/* 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) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#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 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_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. */ +#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_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +/* 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; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + 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 + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * 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. */ + +/* 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) + +/* 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. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +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 ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +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 * ); + +#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; \ + } + +#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; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +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[] ); + +/* 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; \ + *yy_cp = '\0'; \ + 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; + +#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] = + { 0, + 26, 24, 25, 1, 24, 25, 3, 25, 3, 24, + 25, 24, 25, 24, 25, 6, 24, 25, 24, 25, + 24, 25, 24, 25, 8, 24, 25, 24, 25, 8, + 24, 25, 8, 24, 25, 8, 24, 25, 8, 24, + 25, 8, 24, 25, 8, 24, 25, 8, 24, 25, + 8, 24, 25, 8, 24, 25, 8, 24, 25, 3, + 9, 2, 6, 11, 10, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 4, 5, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 22, 20, 23, 8, 8, 21, + + 8, 19, 8, 8, 8, 8, 8, 8, 8, 18, + 8, 8, 8, 8, 12, 8, 8, 8, 8, 8, + 13, 15, 16, 14, 8, 8, 8, 8, 17 + } ; + +static yyconst flex_int16_t yy_accept[103] = + { 0, + 1, 1, 1, 2, 4, 7, 9, 12, 14, 16, + 19, 21, 23, 25, 28, 30, 33, 36, 39, 42, + 45, 48, 51, 54, 57, 60, 61, 61, 62, 62, + 63, 64, 65, 66, 66, 66, 67, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + + 130, 130 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 5, 6, 7, 6, 6, 8, 6, 9, 6, + 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, + 10, 10, 10, 10, 10, 11, 11, 12, 6, 13, + 14, 15, 6, 16, 17, 17, 17, 17, 17, 17, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 6, 6, 6, 6, 19, 20, 21, 22, 17, 23, + + 24, 17, 25, 26, 27, 18, 18, 28, 29, 30, + 31, 32, 18, 33, 34, 35, 36, 37, 18, 38, + 18, 18, 6, 6, 6, 6, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[39] = + { 0, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, + 3, 2, 2, 2, 2, 2, 3, 4, 4, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4 + } ; + +static yyconst flex_int16_t yy_base[107] = + { 0, + 0, 0, 130, 131, 131, 131, 126, 121, 124, 29, + 112, 110, 34, 0, 0, 96, 99, 95, 12, 91, + 89, 83, 13, 83, 96, 131, 109, 108, 111, 131, + 35, 131, 131, 0, 103, 0, 103, 84, 85, 72, + 85, 75, 74, 82, 69, 71, 68, 80, 78, 0, + 89, 131, 77, 85, 84, 83, 61, 57, 80, 59, + 78, 63, 53, 59, 52, 131, 131, 131, 61, 49, + 131, 47, 131, 70, 57, 56, 55, 44, 65, 41, + 131, 41, 40, 39, 38, 131, 59, 58, 57, 56, + 40, 131, 131, 131, 131, 35, 35, 30, 36, 131, + + 131, 50, 54, 56, 59, 44 + } ; + +static yyconst flex_int16_t yy_def[107] = + { 0, + 101, 1, 101, 101, 101, 101, 101, 102, 103, 101, + 101, 101, 101, 104, 105, 104, 104, 104, 104, 104, + 104, 104, 104, 104, 104, 101, 102, 101, 103, 101, + 101, 101, 101, 106, 101, 104, 101, 104, 104, 104, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 106, + 101, 101, 104, 104, 104, 104, 104, 104, 104, 104, + 104, 104, 104, 104, 104, 101, 101, 101, 104, 104, + 101, 104, 101, 104, 104, 104, 104, 104, 104, 104, + 101, 104, 104, 104, 104, 101, 104, 104, 104, 104, + 104, 101, 101, 101, 101, 104, 104, 104, 104, 101, + + 0, 101, 101, 101, 101, 101 + } ; + +static yyconst flex_int16_t yy_nxt[170] = + { 0, + 4, 5, 6, 7, 5, 4, 8, 9, 4, 10, + 10, 4, 11, 12, 4, 13, 14, 14, 4, 15, + 16, 17, 18, 19, 14, 14, 20, 14, 21, 14, + 22, 23, 14, 24, 25, 14, 14, 14, 31, 31, + 34, 41, 35, 46, 31, 31, 50, 100, 47, 42, + 27, 27, 27, 27, 29, 29, 29, 29, 36, 36, + 37, 37, 37, 99, 98, 97, 96, 95, 94, 93, + 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, + 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, + 72, 71, 70, 69, 68, 67, 66, 65, 51, 64, + + 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, + 53, 52, 51, 30, 27, 28, 49, 48, 45, 44, + 43, 40, 39, 38, 33, 32, 30, 28, 26, 101, + 3, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101 + } ; + +static yyconst flex_int16_t yy_chk[170] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, + 13, 19, 13, 23, 31, 31, 106, 99, 23, 19, + 102, 102, 102, 102, 103, 103, 103, 103, 104, 104, + 105, 105, 105, 98, 97, 96, 91, 90, 89, 88, + 87, 85, 84, 83, 82, 80, 79, 78, 77, 76, + 75, 74, 72, 70, 69, 65, 64, 63, 62, 61, + 60, 59, 58, 57, 56, 55, 54, 53, 51, 49, + + 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, + 38, 37, 35, 29, 28, 27, 25, 24, 22, 21, + 20, 18, 17, 16, 12, 11, 9, 8, 7, 3, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 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 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); \ +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 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); \ + } +#ifndef YYLMAX +#define YYLMAX 8192 +#endif + +char yytext[YYLMAX]; +char *yytext_ptr; +#line 1 "./otp.l" +#line 2 "./otp.l" +/* otp.l: Lexical analysis 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 +Copyright (c) 2002 Behdad Esfahbod +Copyright (c) 2002 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 +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. + +*/ + +#include "routines.h" +#include "yystype.h" +#include "y_tab.h" +#define YY_NO_UNPUT +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 + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#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(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + 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); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#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 */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#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 int yy_act; + +#line 43 "./otp.l" + +#line 756 "lex.yy.c" + + if ( (yy_init) ) + { + (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 ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *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_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 102 ) + 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_cp; + } + while ( yy_base[yy_current_state] != 131 ); + +yy_find_action: + 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] ) + { + yy_act = yy_acclist[(yy_lp)]; + { + (yy_full_match) = yy_cp; + break; + } + } + --yy_cp; + 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] ) + { + int yyl; + for ( yyl = (yy_prev_more_offset); yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + 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" +{} + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 45 "./otp.l" +{ line_number++;} + YY_BREAK +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +#line 46 "./otp.l" +{ line_number++;} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 47 "./otp.l" +{ + yylval.yint=0; + for (i=2; i<yyleng; i++) { + j = yytext[i]; + if ((j>='0')&&(j<='9')) { + yylval.yint = (yylval.yint*16)+(j-'0'); + } else if ((j>='a')&&(j<='f')) { + yylval.yint = (yylval.yint*16)+(j-'a'+10); + } else { /* ((j>='A') && (j>='F')) */ + yylval.yint = (yylval.yint*16)+(j-'A'+10); + } + if (yylval.yint>65535) { + fprintf(stderr, "line %d: value too large (%x)\n", + line_number, yylval.yint); + exit(1); + } + } + return(NUMBER); + } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 66 "./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) { + fprintf(stderr, "line %d: value too large (%o)\n", + line_number, yylval.yint); + exit(1); + } + } + return(NUMBER); + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 79 "./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) { + fprintf(stderr, "line %d: value too large (%d)\n", + line_number, yylval.yint); + exit(1); + } + } + return(NUMBER); + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 92 "./otp.l" +{ + yylval.yint=yytext[1]; + return(NUMBER); +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 96 "./otp.l" +{ yylval.ystring=xstrdup(yytext); return(ID); } + YY_BREAK +case 9: +/* rule 9 can match eol */ +YY_RULE_SETUP +#line 97 "./otp.l" +{ + char *newtext; + last=yyleng-2; + i=0; + j=1; + newtext=yylval.ystring=xstrdup(yytext); + while (j<=last) { + newtext[i]=yytext[j]; + if ((yytext[j]=='"') && (yytext[j+1]=='"')) j=j+2; + else j++; + i++; + } + newtext[i]='\0'; + return(STRING); + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 112 "./otp.l" +return(RIGHTARROW); + YY_BREAK +case 11: +YY_RULE_SETUP +#line 113 "./otp.l" +return(LEFTARROW); + YY_BREAK +case 12: +YY_RULE_SETUP +#line 114 "./otp.l" +return(INPUT); + YY_BREAK +case 13: +YY_RULE_SETUP +#line 115 "./otp.l" +return(OUTPUT); + YY_BREAK +case 14: +YY_RULE_SETUP +#line 116 "./otp.l" +return(ALIASES); + YY_BREAK +case 15: +YY_RULE_SETUP +#line 117 "./otp.l" +return(STATES); + YY_BREAK +case 16: +YY_RULE_SETUP +#line 118 "./otp.l" +return(TABLES); + YY_BREAK +case 17: +YY_RULE_SETUP +#line 119 "./otp.l" +return(EXPRESSIONS); + YY_BREAK +case 18: +YY_RULE_SETUP +#line 120 "./otp.l" +return(PUSH); + YY_BREAK +case 19: +YY_RULE_SETUP +#line 121 "./otp.l" +return(POP); + YY_BREAK +case 20: +YY_RULE_SETUP +#line 122 "./otp.l" +return(DIV); + YY_BREAK +case 21: +YY_RULE_SETUP +#line 123 "./otp.l" +return(MOD); + YY_BREAK +case 22: +YY_RULE_SETUP +#line 124 "./otp.l" +return(BEG); + YY_BREAK +case 23: +YY_RULE_SETUP +#line 125 "./otp.l" +return(END); + YY_BREAK +case 24: +YY_RULE_SETUP +#line 126 "./otp.l" +return(yytext[0]); + YY_BREAK +case 25: +YY_RULE_SETUP +#line 128 "./otp.l" +ECHO; + YY_BREAK +#line 1042 "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; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->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 + * 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; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * 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)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + 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_current_state = yy_get_previous_state( ); + + 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_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * 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); + 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] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->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 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + 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 ) + /* 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; + + else + { + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + + } + + 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_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + 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; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->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) +{ + 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; + + 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 ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 102 ) + 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; + } + + 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 ) +{ + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 102 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + 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; + + 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); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->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 char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->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; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; + } + + (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) +#else + static int input (void) +#endif + +{ + int c; + + *(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)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (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); + + if ( c == '\n' ) + + yylineno++; +; + + return c; +} +#endif /* ifndef 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 ); + } + + 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 ) + return; + + 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_CURRENT_BUFFER_LVALUE = 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; +} + +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 ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* 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 ); + 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 ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + 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_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((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 ); + + 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; +} + +/** 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 ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + 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 ((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 ) +{ + 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 ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** 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 ) +{ + 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 ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + 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. */ + +#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 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** 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 ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +/* 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(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + yyfree ( (yy_state_buf) ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* 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 + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * 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 +#endif +#line 128 "./otp.l" + + + + diff --git a/Build/source/texk/web2c/otps/mkocp b/Build/source/texk/web2c/otps/mkocp new file mode 100755 index 00000000000..41ffead8bf1 --- /dev/null +++ b/Build/source/texk/web2c/otps/mkocp @@ -0,0 +1,6 @@ +#!/bin/sh +# Initial definition. Will leave the .ocp file in the local directory. +( +otp2ocp `basename "$1" .ocp` || exit 1 +) 1>&2 </dev/null +echo `basename "$1" .ocp`.ocp diff --git a/Build/source/texk/web2c/otps/mkofm b/Build/source/texk/web2c/otps/mkofm new file mode 100755 index 00000000000..ef820171f08 --- /dev/null +++ b/Build/source/texk/web2c/otps/mkofm @@ -0,0 +1,3 @@ +#!/bin/sh +# Initial definition. For the moment only makes .tfm files. +mktextfm $* diff --git a/Build/source/texk/web2c/otps/otp.h b/Build/source/texk/web2c/otps/otp.h new file mode 100644 index 00000000000..5e8433fea50 --- /dev/null +++ b/Build/source/texk/web2c/otps/otp.h @@ -0,0 +1,73 @@ +/* otp.h: Instructions found in OCP 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 +Copyright (c) 2002 Behdad Esfahbod +Copyright (c) 2002 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 +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. + +*/ + +enum { + OTP_START_TOKENS = 256, + OTP_RIGHT_OUTPUT, + OTP_RIGHT_NUM, + OTP_RIGHT_CHAR, + OTP_RIGHT_LCHAR, + OTP_RIGHT_SOME, + + OTP_PBACK_OUTPUT, + OTP_PBACK_NUM, + OTP_PBACK_CHAR, + OTP_PBACK_LCHAR, + OTP_PBACK_SOME, + + OTP_ADD, + OTP_SUB, + OTP_MULT, + OTP_DIV, + OTP_MOD, + OTP_LOOKUP, + OTP_PUSH_NUM, + OTP_PUSH_CHAR, + OTP_PUSH_LCHAR, + + OTP_STATE_CHANGE, + OTP_STATE_PUSH, + OTP_STATE_POP, + + OTP_LEFT_START, + OTP_LEFT_RETURN, + OTP_LEFT_BACKUP, + + OTP_GOTO, + OTP_GOTO_NE, + OTP_GOTO_EQ, + OTP_GOTO_LT, + OTP_GOTO_LE, + OTP_GOTO_GT, + OTP_GOTO_GE, + OTP_GOTO_NO_ADVANCE, + OTP_GOTO_BEG, + OTP_GOTO_END, + + OTP_STOP, +}; + +#define OTP_PBACK_OFFSET (OTP_PBACK_OUTPUT - OTP_RIGHT_OUTPUT) + diff --git a/Build/source/texk/web2c/otps/otp.l b/Build/source/texk/web2c/otps/otp.l new file mode 100644 index 00000000000..b80cce902bf --- /dev/null +++ b/Build/source/texk/web2c/otps/otp.l @@ -0,0 +1,129 @@ +%{ +/* otp.l: Lexical analysis 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 +Copyright (c) 2002 Behdad Esfahbod +Copyright (c) 2002 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 +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. + +*/ + +#include "routines.h" +#include "yystype.h" +#include "y_tab.h" +#define YY_NO_UNPUT +int line_number = 1; +int i,j,last; +extern YYSTYPE yylval; +%} + + +hexnumber @\"[a-fA-F0-9]+ +octnumber @'[0-7]+ +decnumber [0-9]+ +id ([a-zA-Z][_a-zA-Z0-9]*) +string \"([^\"]|\"\")*\" + +%% +[ \t] {} +"%".*\n { line_number++;} +\r\n|\n|\r { line_number++;} +{hexnumber} { + yylval.yint=0; + for (i=2; i<yyleng; i++) { + j = yytext[i]; + if ((j>='0')&&(j<='9')) { + yylval.yint = (yylval.yint*16)+(j-'0'); + } else if ((j>='a')&&(j<='f')) { + yylval.yint = (yylval.yint*16)+(j-'a'+10); + } else { /* ((j>='A') && (j>='F')) */ + yylval.yint = (yylval.yint*16)+(j-'A'+10); + } + if (yylval.yint>65535) { + fprintf(stderr, "line %d: value too large (%x)\n", + line_number, yylval.yint); + exit(1); + } + } + return(NUMBER); + } +{octnumber} { + yylval.yint=0; + for (i=2; i<yyleng; i++) { + j = yytext[i]; + yylval.yint = (yylval.yint*8)+(j-'0'); + if (yylval.yint>65535) { + fprintf(stderr, "line %d: value too large (%o)\n", + line_number, yylval.yint); + exit(1); + } + } + return(NUMBER); + } +{decnumber} { + yylval.yint=0; + for (i=0; i<yyleng; i++) { + j = yytext[i]; + yylval.yint = (yylval.yint*10)+(j-'0'); + if (yylval.yint>65535) { + fprintf(stderr, "line %d: value too large (%d)\n", + line_number, yylval.yint); + exit(1); + } + } + return(NUMBER); + } +"`"[\x20-\x7e]"'" { + yylval.yint=yytext[1]; + return(NUMBER); +} +{id} { yylval.ystring=xstrdup(yytext); return(ID); } +{string} { + char *newtext; + last=yyleng-2; + i=0; + j=1; + newtext=yylval.ystring=xstrdup(yytext); + while (j<=last) { + newtext[i]=yytext[j]; + if ((yytext[j]=='"') && (yytext[j+1]=='"')) j=j+2; + else j++; + i++; + } + newtext[i]='\0'; + return(STRING); + } +=> return(RIGHTARROW); +"<"= return(LEFTARROW); +input: return(INPUT); +output: return(OUTPUT); +aliases: return(ALIASES); +states: return(STATES); +tables: return(TABLES); +expressions: return(EXPRESSIONS); +push: return(PUSH); +pop: return(POP); +div: return(DIV); +mod: return(MOD); +beg: return(BEG); +end: return(END); +. return(yytext[0]); + +%% + diff --git a/Build/source/texk/web2c/otps/otp.y b/Build/source/texk/web2c/otps/otp.y new file mode 100644 index 00000000000..ec1095eba6d --- /dev/null +++ b/Build/source/texk/web2c/otps/otp.y @@ -0,0 +1,325 @@ +%{ +/* 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. + +*/ + +#include "otp.h" +#include "routines.h" +#include "yystype.h" +int k, len; + +void yyerror(char * msg) +{ +fprintf(stderr, "line %d: %s\n", line_number, msg); +} +%} + +%token NUMBER +%token ID +%token STRING +%token LEFTARROW +%token RIGHTARROW +%token INPUT +%token OUTPUT +%token ALIASES +%token STATES +%token TABLES +%token EXPRESSIONS +%token PUSH +%token POP +%token DIV +%token MOD +%token BEG +%token END + +%left '+' '-' +%left '*' DIV MOD + +%% + +File : + Input + Output + Tables + States + Aliases + Expressions + ; + +Input : + /* Empty */ + { input_bytes=2; } + | INPUT NUMBER ';' + { input_bytes=$2.yint; } + ; + +Output : + /* Empty */ + { output_bytes=2; } + | OUTPUT NUMBER ';' + { output_bytes=$2.yint; } + ; + +Tables : + /* Empty */ + | TABLES MoreTables + ; + +MoreTables : + OneTable + | MoreTables OneTable + ; + +OneTable : + ID '[' NUMBER ']' + { store_table($1.ystring, $3.yint); } + '=' '{' Numbers '}' ';' + ; + +Numbers : + /* Empty */ + | MoreNumbers + ; + +MoreNumbers : + NUMBER + { add_to_table($1.yint); } + | MoreNumbers ',' NUMBER + { add_to_table($3.yint); } + ; + +States : + /* Empty */ + | STATES MoreStates ';' + ; + +MoreStates : + ID + { store_state($1.ystring); } + | MoreStates ',' ID + { store_state($3.ystring); } + ; + +Aliases : + /* Empty */ + | ALIASES MoreAliases + ; + +MoreAliases : + OneAlias + | MoreAliases OneAlias + ; + +OneAlias : + ID '=' OneCompleteLeft ';' + { store_alias($1.ystring, $3.yleft); } + ; + +OneCompleteLeft : + STRING + { $$.yleft = StringLeft($1.ystring); } + | OneLeft '<' NUMBER ',' NUMBER '>' + { $$.yleft = CompleteLeft($1.yleft, $3.yint, $5.yint); } + | OneLeft '<' NUMBER ',' '>' + { $$.yleft = PlusLeft($1.yleft, $3.yint); } + | OneLeft + { $$.yleft = $1.yleft; } + ; + +OneLeft : + NUMBER + { $$.yleft = SingleLeft($1.yint); } + | NUMBER '-' NUMBER + { $$.yleft = DoubleLeft($1.yint, $3.yint); } + | '.' + { $$.yleft = WildCard(); } + | '^' '(' ChoiceLeft ')' + { $$.yleft = NotChoiceLeft($3.ylleft); } + | '(' ChoiceLeft ')' + { $$.yleft = ChoiceLeft($2.ylleft); } + | '{' ID '}' + { $$.yleft = lookup_alias($2.ystring); } + ; + +ChoiceLeft : + OneLeft + { $$.ylleft = llist1($1.yleft); } + | ChoiceLeft '|' OneLeft + { $$.ylleft = lappend1($1.ylleft, $3.yleft); } + ; + +Expressions : + EXPRESSIONS MoreExpressions + { + for(cur_state=0; cur_state<no_states; cur_state++) { + if ((states[cur_state].no_exprs)==0) { + out_int(OTP_LEFT_START, 0); + } else { + out_int(OTP_LEFT_RETURN, 0); + } + out_int(OTP_RIGHT_CHAR, 1); + out_int(OTP_STOP, 0); + } + } + ; + +MoreExpressions : + OneExpr + | MoreExpressions OneExpr + ; + +OneExpr : + LeftState + { states[cur_state].no_exprs++; } + TotalLeft + { out_left($3.ylleft); right_offset=0; } + RIGHTARROW Right + { right_offset=OTP_PBACK_OFFSET; } + PushBack RightState ';' + { fill_in_left(); } + ; + +PushBack : + /* Empty */ + | LEFTARROW Right + ; + +LeftState : + /* Empty */ + { cur_state = 0; } + | '<' ID '>' + { cur_state = lookup_state($2.ystring); } + ; + +TotalLeft : + BegLeft Left EndLeft + { $$.ylleft = lappend($1.ylleft, lappend($2.ylleft, $3.ylleft)); } +| BegLeft EndLeft + { $$.ylleft = lappend($1.ylleft, $2.ylleft); } + ; + +BegLeft : + /* Empty */ + { $$.ylleft = nil; } + | BEG + { $$.ylleft = llist1(BeginningLeft()); } + ; + +EndLeft : + /* Empty */ + { $$.ylleft = nil; } + | END + { $$.ylleft = llist1(EndLeft()); } + ; + +Left : + OneCompleteLeft + { $$.ylleft = llist1($1.yleft); } + | Left OneCompleteLeft + { $$.ylleft = lappend1($1.ylleft, $2.yleft); } + ; + +Right : + /* Empty */ + | Right OneRight + ; + +OneRight : + STRING + { + len=strlen($1.ystring); + for (k=0; k<len; k++) { + out_right(OTP_RIGHT_NUM, ($1.ystring)[k]); + } + } + | NUMBER + { out_right(OTP_RIGHT_NUM, $1.yint); } + | '\\' NUMBER + { out_right(OTP_RIGHT_CHAR, $2.yint); } + | '\\' '$' + { out_right(OTP_RIGHT_LCHAR, 0); } + | '\\' '(' '$' '-' NUMBER ')' + { out_right(OTP_RIGHT_LCHAR, $5.yint); } + | '\\' '*' + { + out_right(OTP_RIGHT_SOME, 0); + out_int(0,0); + } + | '\\' '(' '*' '+' NUMBER ')' + { + out_right(OTP_RIGHT_SOME, $5.yint); + out_int(0, 0); + } + | '\\' '(' '*' '-' NUMBER ')' + { + out_right(OTP_RIGHT_SOME, 0); + out_int(0, $5.yint); + } + | '\\' '(' '*' '+' NUMBER '-' NUMBER ')' + { + out_right(OTP_RIGHT_SOME, $5.yint); + out_int(0, $7.yint); + } + | '#' OneRightExpr + { out_right(OTP_RIGHT_OUTPUT, 0); } + ; + +RestRightExpr : + OneRightExpr + | RestRightExpr '+' OneRightExpr + { out_int(OTP_ADD, 0); } + | RestRightExpr '-' OneRightExpr + { out_int(OTP_SUB, 0); } + | RestRightExpr '*' OneRightExpr + { out_int(OTP_MULT, 0); } + | RestRightExpr DIV OneRightExpr + { out_int(OTP_DIV, 0); } + | RestRightExpr MOD OneRightExpr + { out_int(OTP_MOD, 0); } + | ID + { out_int(OTP_PUSH_NUM, lookup_table($1.ystring)); } + '[' RestRightExpr ']' + { out_int(OTP_LOOKUP, 0); } + ; + +OneRightExpr : + NUMBER + { out_int(OTP_PUSH_NUM, $1.yint); } + | '\\' NUMBER + { out_int(OTP_PUSH_CHAR, $2.yint); } + | '\\' '$' + { out_int(OTP_PUSH_LCHAR, 0); } + | '\\' '(' '$' '-' NUMBER ')' + { out_int(OTP_PUSH_LCHAR, $5.yint); } + | '(' RestRightExpr ')' + ; + +RightState : + /* Empty */ + | '<' ID '>' + { out_int(OTP_STATE_CHANGE, lookup_state($2.ystring)); } + | '<' PUSH ID '>' + { out_int(OTP_STATE_PUSH, lookup_state($3.ystring)); } + | '<' POP '>' + { out_int(OTP_STATE_POP, 0); } + ; +%% diff --git a/Build/source/texk/web2c/otps/otp2ocp.c b/Build/source/texk/web2c/otps/otp2ocp.c new file mode 100644 index 00000000000..bb1e41b1148 --- /dev/null +++ b/Build/source/texk/web2c/otps/otp2ocp.c @@ -0,0 +1,173 @@ +/* otp2ocp.c: Main program for transforming OTP files into OCP 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 +Copyright (c) 2002 Behdad Esfahbod +Copyright (c) 2002 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 +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. + +*/ + +#include <kpathsea/config.h> +#include <kpathsea/types.h> +#include <kpathsea/c-proto.h> +#include <kpathsea/c-std.h> +#include <kpathsea/c-fopen.h> +#include <kpathsea/tex-file.h> +#include "routines.h" + +extern FILE *yyin; +int yywrap +P1H (void) +{ + return 1; +} + +void output +P2C (FILE *, output_file, int, i) +{ +/* make sure output is in big-endian form */ + char j; + int k; + k = i; + j = k >> 24; + fwrite (&j, 1, 1, output_file); + k = k & 0xffffff; + j = k >> 16; + fwrite (&j, 1, 1, output_file); + k = k & 0xffff; + j = k >> 8; + fwrite (&j, 1, 1, output_file); + j = k & 0xff; + fwrite (&j, 1, 1, output_file); +} + +void otp_read +P2C (string, input_name, string, output_name) +{ + int i, j, len, no_words; + int *table, *instrs; + FILE *input_file, *output_file; + + input_file = xfopen (input_name, FOPEN_R_MODE); + store_state ("INITIAL"); + yyin = input_file; + if (yyparse ()) + exit (EXIT_FAILURE); + output_file = xfopen (output_name, FOPEN_WBIN_MODE); + room_for_tables = 0; + for (i = 0; i < no_tables; i++) + { + room_for_tables = room_for_tables + tables[i].length; + } + room_for_states = 0; + for (i = 0; i < no_states; i++) + { + room_for_states = room_for_states + states[i].length; + } + no_words = no_tables + room_for_tables + no_states + room_for_states + 7; + output (output_file, no_words); + output (output_file, input_bytes); + output (output_file, output_bytes); + output (output_file, no_tables); + output (output_file, room_for_tables); + output (output_file, no_states); + output (output_file, room_for_states); + for (i = 0; i < no_tables; i++) + { + len = tables[i].length; + output (output_file, len); + } + for (i = 0; i < no_tables; i++) + { + len = tables[i].length; + table = tables[i].table; + for (j = 0; j < len; j++) + { + output (output_file, table[j]); + } + } + for (i = 0; i < no_states; i++) + { + len = states[i].length; + output (output_file, len); + } + for (i = 0; i < no_states; i++) + { + len = states[i].length; + instrs = states[i].instrs; + for (j = 0; j < len; j++) + { + output (output_file, instrs[j]); + } + } +} + +int main +P2C (int, argc, string *, argv) +{ + string input_name, full_input_name; + string output_name; + + kpse_set_progname (argv[0]); + switch (argc) + { + case 1: + fprintf (stderr, "otp2ocp: No file given\n"); + return EXIT_FAILURE; + 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; + } + case 3: + input_name = argv[1]; + output_name = argv[2]; + break; + default: + fprintf (stderr, "otp2ocp: Too many arguments\n"); + return EXIT_FAILURE; + } + 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; + } + 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 new file mode 100644 index 00000000000..4adc01255b1 --- /dev/null +++ b/Build/source/texk/web2c/otps/outocp.c @@ -0,0 +1,228 @@ +/* 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, + +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. + +*/ + +#include <kpathsea/config.h> +#include <kpathsea/types.h> +#include <kpathsea/c-proto.h> +#include <kpathsea/c-std.h> +#include <kpathsea/c-fopen.h> +#include <kpathsea/tex-file.h> +#include "otp.h" + +char *otp_names[] = { + " ", + "OTP_RIGHT_OUTPUT ", + "OTP_RIGHT_NUM ", + "OTP_RIGHT_CHAR ", + "OTP_RIGHT_LCHAR ", + "OTP_RIGHT_SOME ", + "OTP_PBACK_OUTPUT ", + "OTP_PBACK_NUM ", + "OTP_PBACK_CHAR ", + "OTP_PBACK_LCHAR ", + "OTP_PBACK_SOME ", + "OTP_ADD ", + "OTP_SUB ", + "OTP_MULT ", + "OTP_DIV ", + "OTP_MOD ", + "OTP_LOOKUP ", + "OTP_PUSH_NUM ", + "OTP_PUSH_CHAR ", + "OTP_PUSH_LCHAR ", + "OTP_STATE_CHANGE ", + "OTP_STATE_PUSH ", + "OTP_STATE_POP ", + "OTP_LEFT_START ", + "OTP_LEFT_RETURN ", + "OTP_LEFT_BACKUP ", + "OTP_GOTO ", + "OTP_GOTO_NE ", + "OTP_GOTO_EQ ", + "OTP_GOTO_LT ", + "OTP_GOTO_LE ", + "OTP_GOTO_GT ", + "OTP_GOTO_GE ", + "OTP_GOTO_NO_ADVANCE", + "OTP_GOTO_BEG ", + "OTP_GOTO_END ", + "OTP_STOP " +}; + + +void ctp_abort +P1C (string, s) +{ + fprintf (stderr, s); + exit (EXIT_FAILURE); +} + +int no_words_read = 0; + +int ctp_get +P1C (FILE *, input_file) +{ + int ctpchar; + ctpchar = getc (input_file); + if (ctpchar == EOF) + { + ctp_abort ("Unexpected end of file\n"); + } + return ctpchar; +} + +int ctp_read +P1C (FILE *, input_file) +{ + int ctpword; + no_words_read++; + ctpword = ctp_get (input_file); + if (ctpword > 127) + { + ctp_abort ("first octet > 127"); + } + ctpword = ctpword * 256 + ctp_get (input_file); + ctpword = ctpword * 256 + ctp_get (input_file); + ctpword = ctpword * 256 + ctp_get (input_file); + return ctpword; +} + +void ctp_explain +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]; + + ctp_length = ctp_read (input_file); + fprintf (stdout, "ctp_length : %3x(%3d)\n", ctp_length, ctp_length); + real_ctp_length = ctp_length - 7; + fprintf (stdout, "real_ctp_length: %3x(%3d)\n", + real_ctp_length, real_ctp_length); + ctp_input = ctp_read (input_file); + fprintf (stdout, "ctp_input : %3x(%3d)\n", ctp_input, ctp_input); + ctp_output = ctp_read (input_file); + fprintf (stdout, "ctp_output : %3x(%3d)\n", ctp_output, ctp_output); + ctp_no_tables = ctp_read (input_file); + fprintf (stdout, "ctp_no_tables : %3x(%3d)\n", + ctp_no_tables, ctp_no_tables); + ctp_room_tables = ctp_read (input_file); + fprintf (stdout, "ctp_room_tables: %3x(%3d)\n", + ctp_room_tables, ctp_room_tables); + ctp_no_states = ctp_read (input_file); + fprintf (stdout, "ctp_no_states : %3x(%3d)\n", + ctp_no_states, ctp_no_states); + 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) + { + ctp_abort ("Too many tables\n"); + } + if (ctp_no_states >= 100) + { + ctp_abort ("Too many states\n"); + } + if (ctp_no_tables != 0) + { + for (i = 0; i < ctp_no_tables; i++) + { + room_tables[i] = ctp_read (input_file); + fprintf (stdout, "Table %2x(%2d): %3x(%3d)entries\n", + i, i, room_tables[i], room_tables[i]); + } + fprintf (stdout, "\n"); + for (i = 0; i < ctp_no_tables; i++) + { + for (j = 0; j < room_tables[i]; j++) + { + entry = ctp_read (input_file); + fprintf (stdout, "Table %2x(%2d), entry %3x(%3d): %2x(%3d)\n", + i, i, j, j, entry, entry); + } + } + fprintf (stdout, "\n"); + } + if (ctp_no_states != 0) + { + for (i = 0; i < ctp_no_states; i++) + { + room_states[i] = ctp_read (input_file); + fprintf (stdout, "State %2x(%2d): %3x(%3d) entries\n", + i, i, room_states[i], room_states[i]); + } + fprintf (stdout, "\n"); + for (i = 0; i < ctp_no_states; i++) + { + for (j = 0; j < room_states[i]; j++) + { + instruction = ctp_read (input_file); + arg = instruction & 0xffffff; + if ((arg >= 32) && (arg < 127)) + fprintf (stdout, + "State %2x(%2d), entry %3x(%3d): %s %2x(%3d,`%c')\n", + i, i, j, j, otp_names[instruction >> 24], + arg, arg, arg); + else + fprintf (stdout, + "State %2x(%2d), entry %3x(%3d): %s %2x(%3d)\n", + i, i, j, j, otp_names[instruction >> 24], arg, arg); + } + } + } + fprintf (stdout, "\nfile length should be: %3x(%3d)\n", + ctp_length, ctp_length); + fprintf (stdout, "number words read : %3x(%3d)\n", + no_words_read, no_words_read); +} + +int main +P2C (int, argc, string *, argv) +{ + string input_name, full_input_name; + FILE *input_file; + + kpse_set_progname (argv[0]); + switch (argc) + { + case 1: + fprintf (stderr, "outocp: No file given\n"); + return EXIT_FAILURE; + case 2: + input_name = argv[1]; + break; + default: + fprintf (stderr, "outocp: Too many arguments\n"); + return EXIT_FAILURE; + } + 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; + } + 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 new file mode 100644 index 00000000000..4dcc8b66f9e --- /dev/null +++ b/Build/source/texk/web2c/otps/routines.c @@ -0,0 +1,549 @@ +/* routines.c: Generating the finite state automaton. + +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. + +*/ + +#include <kpathsea/config.h> +#include <kpathsea/types.h> +#include <kpathsea/c-proto.h> +#include <kpathsea/c-std.h> +#include "routines.h" +#include "otp.h" + +#define out_ptr (states[cur_state].length) +#define out_array (states[cur_state].instrs) + +list left_false_holes; + +int left_state; +int right_offset; +int input_bytes; +int output_bytes; + +int no_states = 0; +int cur_state = 0; +int room_for_states = 0; +state_type states[100]; + +int no_tables = 0; +int cur_table = 0; +int room_for_tables = 0; +table_type tables[100]; + +int no_aliases = 0; +alias_pair aliases[1000]; + +list +cons P2C(int, x, list, L) +{ +list temp; +temp = (list) malloc(sizeof(cell)); +temp->val = x; +temp->ptr = L; +return temp; +} + +list +list1 P1C(int, x) +{ +list temp; +temp = (list) malloc(sizeof(cell)); +temp->val = x; +temp->ptr = nil; +return temp; +} + +list +list2 P2C(int, x, int, y) +{ +list temp, temp1; +temp = (list) malloc(sizeof(cell)); +temp1 = (list) malloc(sizeof(cell)); +temp->val = x; +temp->ptr = temp1; +temp1->val = y; +temp1->ptr = nil; +return temp; +} + +list +append P2C(list, K, list, L) +{ +if (K==nil) return L; +return cons(K->val, append(K->ptr, L)); +} + +list +append1 P2C(list, L, int, x) +{ +return (append(L,list1(x))); +} + +llist +lcons P2C(left, x, llist, L) +{ +llist temp; +temp = (llist) malloc(sizeof(lcell)); +temp->val = x; +temp->ptr = L; +return temp; +} + +llist +llist1 P1C(left, x) +{ +llist temp; +temp = (llist) malloc(sizeof(lcell)); +temp->val = x; +temp->ptr = nil; +return temp; +} + +llist +llist2 P2C(left, x, left, y) +{ +llist temp, temp1; +temp = (llist) malloc(sizeof(lcell)); +temp1 = (llist) malloc(sizeof(lcell)); +temp->val = x; +temp->ptr = temp1; +temp1->val = y; +temp1->ptr = nil; +return temp; +} + +llist +lappend P2C(llist, K, llist, L) +{ +if (K==nil) return L; +return lcons(K->val, lappend(K->ptr, L)); +} + +llist +lappend1 P2C(llist, L, left, x) +{ +return (lappend(L,llist1(x))); +} + +left +WildCard P1H(void) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=WILDCARD; +return temp; +} + +left +StringLeft P1C(char *, x) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=STRINGLEFT; +temp->valstr=x; +return temp; +} + +left +SingleLeft P1C(int, x) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=SINGLELEFT; +temp->val1=x; +return temp; +} + +left +DoubleLeft P2C(int, x, int, y) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=DOUBLELEFT; +temp->val1=x; +temp->val2=y; +return temp; +} + +left +ChoiceLeft P1C(llist, L) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=CHOICELEFT; +temp->more_lefts=L; +return temp; +} + +left +NotChoiceLeft P1C(llist, L) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=NOTCHOICELEFT; +temp->more_lefts=L; +return temp; +} + +left +PlusLeft P2C(left, l, int, n) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=PLUSLEFT; +temp->one_left=l; +temp->val1=n; +return temp; +} + +left +CompleteLeft P3C(left, l, int, n, int, m) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=COMPLETELEFT; +temp->one_left=l; +temp->val1=n; +temp->val2=m; +return temp; +} + +left +BeginningLeft P1H(void) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=BEGINNINGLEFT; +return temp; +} + +left +EndLeft P1H(void) +{ +left temp; +temp = (left) malloc(sizeof(lft_cell)); +temp->kind=ENDLEFT; +return temp; +} + +list +gen_left P1C(left, arg) +{ +int save_ptr, k; +list holes, false_holes, true_holes, backup_holes; +char *runner; +llist p; + +switch(arg->kind) { +case WILDCARD: + return nil; +case STRINGLEFT: + runner=arg->valstr; + holes=nil; + while (*runner) { + out_int(OTP_GOTO_NE, *runner); + out_int(0, 0); + holes=cons(out_ptr-1,holes); + runner++; + if (*runner) { + out_int(OTP_GOTO_NO_ADVANCE, 0); + holes = cons(out_ptr-1, holes); + } + } + return holes; +case SINGLELEFT: + out_int(OTP_GOTO_NE, arg->val1); + 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); +case CHOICELEFT: + true_holes=nil; + false_holes=nil; + p=arg->more_lefts; + while (p!=nil) { + false_holes = gen_left(p->val); + if (p->ptr) { + out_int(OTP_GOTO, 0); + true_holes=cons(out_ptr-1, true_holes); + fill_in(false_holes); + } + p=p->ptr; + } + fill_in(true_holes); + return false_holes; +case NOTCHOICELEFT: + true_holes=nil; + p=arg->more_lefts; + while (p!=nil) { + false_holes = gen_left(p->val); + out_int(OTP_GOTO, 0); + true_holes=cons(out_ptr-1, true_holes); + fill_in(false_holes); + p=p->ptr; + } + return true_holes; +case PLUSLEFT: + false_holes=nil; + true_holes=nil; + backup_holes=nil; + k=1; + while (k<arg->val1) { + holes = gen_left(arg->one_left); + false_holes = append(false_holes, holes); + out_int(OTP_GOTO_NO_ADVANCE, 0); + false_holes = cons(out_ptr-1, false_holes); + k++; + } + holes=gen_left(arg->one_left); + false_holes = append(false_holes, holes); + save_ptr = out_ptr; + out_int(OTP_GOTO_NO_ADVANCE, 0); + true_holes=cons(out_ptr-1, true_holes); + backup_holes=gen_left(arg->one_left); + out_int(OTP_GOTO, save_ptr); + fill_in(backup_holes); + out_int(OTP_LEFT_BACKUP, 0); + fill_in(true_holes); + return false_holes; +case COMPLETELEFT: + false_holes=nil; + true_holes=nil; + backup_holes=nil; + k=1; + if (arg->val1 > arg->val2) { + return nil; + } + while (k<=arg->val1) { + holes = gen_left(arg->one_left); + false_holes = append(false_holes, holes); + out_int(OTP_GOTO_NO_ADVANCE, 0); + false_holes = cons(out_ptr-1, false_holes); + k++; + } + while (k<arg->val2) { + holes = gen_left(arg->one_left); + true_holes = append(true_holes, holes); + out_int(OTP_GOTO_NO_ADVANCE, 0); + backup_holes = cons(out_ptr-1, backup_holes); + k++; + } + holes = gen_left(arg->one_left); + true_holes = append(true_holes, holes); + out_int(OTP_GOTO, out_ptr+2); + fill_in(true_holes); + out_int(OTP_LEFT_BACKUP, 0); + fill_in(backup_holes); + return false_holes; +case BEGINNINGLEFT: + out_int(OTP_GOTO_BEG, 0); + true_holes=list1(out_ptr-1); + out_int(OTP_GOTO, 0); + false_holes=list1(out_ptr-1); + fill_in(true_holes); + return false_holes; +case ENDLEFT: + out_int(OTP_GOTO_END, 0); + true_holes=list1(out_ptr-1); + out_int(OTP_GOTO, 0); + false_holes=list1(out_ptr-1); + fill_in(true_holes); + return false_holes; +default: + fprintf(stderr, "Unrecognized left: %d\n", arg->kind); + exit(EXIT_FAILURE); +} +} + +void +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); + } +} +aliases[i].str=xstrdup(str); +aliases[i].left_val=l; +no_aliases++; +} + +left +lookup_alias P1C(string, str) +{ +int i; +for (i=0; i<no_aliases; i++) { + if (!strcmp(str,aliases[i].str)) { + return aliases[i].left_val; + } +} +fprintf(stderr, "state %s not defined\n", str); +exit(EXIT_FAILURE); +} + +void +out_left P1C(llist, L) +{ +llist p; +list holes; +if ((states[cur_state].no_exprs)==1) { + out_int(OTP_LEFT_START, 0); +} else { + out_int(OTP_LEFT_RETURN, 0); +} +p=L; +left_false_holes=nil; +while (p!=nil) { + holes = gen_left(p->val); + if ((p->ptr != nil) && + ((p->val)->kind !=BEGINNINGLEFT) && + (((p->ptr)->val)->kind !=ENDLEFT)) { + out_int(OTP_GOTO_NO_ADVANCE, 0); + left_false_holes = cons(out_ptr-1,left_false_holes); + } + left_false_holes = append(left_false_holes, holes); + p=p->ptr; +} +} + +void +fill_in_left P1H(void) +{ + out_int(OTP_STOP, 0); + fill_in(left_false_holes); +} + +void +fill_in P1C(list, L) +{ +list p; +p=L; +while (p!=0) { + out_array[p->val] = out_array[p->val] + out_ptr; + p=p->ptr; +} +} + +void +out_right P2C(int, instr, int, val) +{ +out_int(instr+right_offset, val); +} + +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); +} +add_to_state((instr<<24)+val); +} + +void +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); + } +} +states[i].str=xstrdup(str); +states[i].length=0; +states[i].no_exprs=0; +cur_state=i; +no_states++; +} + +int +lookup_state P1C(string, str) +{ +int i; +for (i=0; i<no_states; i++) { + if (!strcmp(str,states[i].str)) { + return i; + } +} +fprintf(stderr, "state %s not defined\n", str); +exit(EXIT_FAILURE); +} + +void +add_to_state P1C(int, x) +{ +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); +} +(states[cur_state].instrs)[len] = x; +states[cur_state].length = len+1; +} + +void +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); + } +} +tables[i].str=xstrdup(str); +tables[i].length=0; +cur_table=i; +no_tables++; +} + +void +add_to_table P1C(int, x) +{ +int len; +len = tables[cur_table].length; +(tables[cur_table].table)[len] = x; +tables[cur_table].length = len+1; +} + +int +lookup_table P1C(string, str) +{ +int i; +for (i=0; i<no_tables; i++) { + if (!strcmp(str,tables[i].str)) { + return i; + } +} +fprintf(stderr, "table %s not defined\n", str); +exit(EXIT_FAILURE); +} + diff --git a/Build/source/texk/web2c/otps/routines.h b/Build/source/texk/web2c/otps/routines.h new file mode 100644 index 00000000000..2e4a7ee8d93 --- /dev/null +++ b/Build/source/texk/web2c/otps/routines.h @@ -0,0 +1,148 @@ +/* routines.h: Generating the finite state automaton + +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. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#ifdef KPATHSEA +#include <kpathsea/config.h> +#include <kpathsea/c-memstr.h> +#include <kpathsea/c-std.h> +#else /* !KPATHSEA */ +#include <stdio.h> +#include <string.h> +#ifdef __STDC__ +#include <stdlib.h> +#else +extern void exit(); +#endif +#endif /* KPATHSEA */ + +#define nil 0 + +#define WILDCARD 0 +#define STRINGLEFT 1 +#define SINGLELEFT 2 +#define DOUBLELEFT 3 +#define CHOICELEFT 4 +#define NOTCHOICELEFT 5 +#define PLUSLEFT 6 +#define COMPLETELEFT 7 +#define BEGINNINGLEFT 8 +#define ENDLEFT 9 + +extern int yyparse(); +extern int yylex(); + +extern int line_number; +typedef struct cell_struct {struct cell_struct *ptr; + int val; } cell; +typedef cell *list; + +typedef struct left_cell { + int kind; + int val1, val2; + char *valstr; + struct lcell_struct *more_lefts; + struct left_cell *one_left; +} lft_cell; +typedef lft_cell *left; + +typedef struct lcell_struct {struct lcell_struct *ptr; + left val; } lcell; +typedef lcell *llist; + +extern list cons(); +extern list list1(); +extern list list2(); +extern list append(); +extern list append1(); + +extern llist lcons(); +extern llist llist1 P1H(left); +extern llist llist2(); +extern llist lappend P2H(llist,llist); +extern llist lappend1 P2H(llist,left); + +extern left WildCard(); +extern left SingleLeft P1H(int); +extern left StringLeft P1H(char *); +extern left DoubleLeft P2H(int,int); +extern left ChoiceLeft P1H(llist); +extern left NotChoiceLeft P1H(llist); +extern left PlusLeft P2H(left,int); +extern left CompleteLeft P3H(left,int,int); +extern left BeginningLeft(); +extern left EndLeft(); +extern list gen_left(); +extern void fill_in_left(); +extern void out_left P1H(llist); +extern int no_lefts; + +extern void store_alias P2H(string, left); +extern left lookup_alias P1H(string); + +#define ARRAY_SIZE 10000 +typedef struct { + int length; + char * str; + int table[ARRAY_SIZE]; +} table_type; + +extern int no_tables; +extern int cur_table; +extern int room_for_tables; +extern table_type tables[]; +extern void add_to_table P1H(int); + +typedef struct { + int length; + char * str; + int no_exprs; + int instrs[ARRAY_SIZE]; +} state_type; + +extern int no_states; +extern int cur_state; +extern int room_for_states; +extern state_type states[]; +extern void add_to_state P1H(int); + +extern void fill_in P1H(list); +extern void right_int(); +extern void out_int P2H(int,int); +extern void out_right P2H(int,int); + +extern void store_state P1H(string); +extern int lookup_state P1H(string); +extern void store_table P2H(string, int); +extern int lookup_table P1H(string); + +typedef struct { char * str; left left_val; } alias_pair; + +extern alias_pair aliases[]; + +extern int right_offset; +extern int input_bytes; +extern int output_bytes; + diff --git a/Build/source/texk/web2c/otps/win32.mak b/Build/source/texk/web2c/otps/win32.mak new file mode 100644 index 00000000000..b8269f57ed2 --- /dev/null +++ b/Build/source/texk/web2c/otps/win32.mak @@ -0,0 +1,70 @@ +################################################################################ +# +# Makefile : Web2C / Omega / otps +# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr> +# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources +# Time-stamp: <04/01/07 11:11:21 popineau> +# +################################################################################ +root_srcdir = ..\..\.. +!ifdef DEVELOPMENT +INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development +!else +INCLUDE=$(INCLUDE);$(root_srcdir)\texk +!endif + +USE_KPATHSEA = 1 +USE_GNUW32 = 1 + +# These get expanded from the parent directory, not this one. +!include <msvc/common.mak> + +DEFS = -I.. $(DEFS) -DHAVE_CONFIG_H + +LEX_OUTPUT_ROOT = lex_yy + +proglib = ..\lib\$(objdir)\lib.lib +programs = $(objdir)\otp2ocp.exe $(objdir)\outocp.exe + +otp2ocp_objects = $(objdir)\otp2ocp.obj $(objdir)\routines.obj \ + $(objdir)\y_tab.obj $(objdir)\$(LEX_OUTPUT_ROOT).obj + +default: all + +all: $(objdir) $(programs) + +$(objdir)\otp2ocp.exe: $(otp2ocp_objects) $(kpathsealib) # $(proglib) + $(link) $(otp2ocp_objects) $(kpathsealib) $(conlibs) + +$(objdir)\otp2ocp.obj: otp2ocp.c y_tab.h + +y_tab.c y_tab.h: otp.y + $(yacc) -d -v otp.y -o y_tab.c + +$(objdir)\$(LEX_OUTPUT_ROOT).obj: otp.h + +$(LEX_OUTPUT_ROOT).c: otp.l + $(lex) -t otp.l | sed "/^extern int isatty YY/d" > $(LEX_OUTPUT_ROOT).c + +$(objdir)\outocp.exe: $(objdir)\outocp.obj $(kpathsealib) # $(proglib) + $(link) $(objdir)\outocp.obj $(kpathsealib) $(conlibs) + +!include <msvc/config.mak> +!include <msvc/install.mak> + +install install-programs:: install-exec + +!include <msvc/clean.mak> + +clean:: + -@echo $(verbose) & ( \ + for %%i in (y_tab.c y_tab.h y.output yacc.* $(LEX_OUTPUT_ROOT).c) do $(del) %%i $(redir_stderr) \ + ) + +!include <msvc/rdepend.mak> +!include "./depend.mak" + +# +# Local Variables: +# mode: makefile +# End: diff --git a/Build/source/texk/web2c/otps/y_tab.c-dist b/Build/source/texk/web2c/otps/y_tab.c-dist new file mode 100644 index 00000000000..675596f95e3 --- /dev/null +++ b/Build/source/texk/web2c/otps/y_tab.c-dist @@ -0,0 +1,1707 @@ +/* A Bison parser, made by GNU Bison 1.875a. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NUMBER = 258, + ID = 259, + STRING = 260, + LEFTARROW = 261, + RIGHTARROW = 262, + INPUT = 263, + OUTPUT = 264, + ALIASES = 265, + STATES = 266, + TABLES = 267, + EXPRESSIONS = 268, + PUSH = 269, + POP = 270, + DIV = 271, + MOD = 272, + BEG = 273, + END = 274 + }; +#endif +#define NUMBER 258 +#define ID 259 +#define STRING 260 +#define LEFTARROW 261 +#define RIGHTARROW 262 +#define INPUT 263 +#define OUTPUT 264 +#define ALIASES 265 +#define STATES 266 +#define TABLES 267 +#define EXPRESSIONS 268 +#define PUSH 269 +#define POP 270 +#define DIV 271 +#define MOD 272 +#define BEG 273 +#define END 274 + + + + +/* 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. + +*/ + +#include "otp.h" +#include "routines.h" +#include "yystype.h" +int k, len; + +void yyerror(char * msg) +{ +fprintf(stderr, "line %d: %s\n", line_number, msg); +} + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 214 of yacc.c. */ +#line 160 "y.tab.c" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* 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 +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* 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)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 5 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 177 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 40 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 36 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 85 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 159 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 274 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 39, 38, 2, 2, 2, + 34, 35, 22, 20, 29, 21, 32, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 23, + 30, 26, 31, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 24, 37, 25, 33, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 27, 36, 28, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short 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 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 41, 0, -1, 42, 43, 44, 50, 52, 58, -1, + -1, 8, 3, 23, -1, -1, 9, 3, 23, -1, + -1, 12, 45, -1, 46, -1, 45, 46, -1, -1, + 4, 24, 3, 25, 47, 26, 27, 48, 28, 23, + -1, -1, 49, -1, 3, -1, 49, 29, 3, -1, + -1, 11, 51, 23, -1, 4, -1, 51, 29, 4, + -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 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short 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 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + 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 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 43, 45, 42, 59, 91, 93, 61, 123, 125, 44, + 60, 62, 46, 94, 40, 41, 124, 92, 36, 35 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +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 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +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 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +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 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +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 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -96 +static const yysigned_char 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 +}; + +/* 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 +}; + +/* 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[] = +{ + 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 +}; + +static const short 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, + 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 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 8, 41, 42, 3, 0, 9, 43, 23, 3, + 12, 44, 23, 4, 45, 46, 11, 50, 24, 46, + 4, 51, 10, 52, 3, 23, 29, 4, 53, 54, + 13, 58, 25, 4, 26, 54, 30, 59, 60, 65, + 47, 3, 5, 27, 32, 33, 34, 55, 56, 4, + 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 +}; + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ + +#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; +#endif + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (cinluded). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short *bottom, short *top) +#else +static void +yy_stack_print (bottom, top) + short *bottom; + short *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylineno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylineno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#if YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# endif +# endif + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ + + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + + + +#define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; + + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: +#line 70 "./otp.y" + { input_bytes=2; } + break; + + case 4: +#line 72 "./otp.y" + { input_bytes=yyvsp[-1].yint; } + break; + + case 5: +#line 77 "./otp.y" + { output_bytes=2; } + break; + + case 6: +#line 79 "./otp.y" + { output_bytes=yyvsp[-1].yint; } + break; + + case 11: +#line 94 "./otp.y" + { store_table(yyvsp[-3].ystring, yyvsp[-1].yint); } + break; + + case 15: +#line 105 "./otp.y" + { add_to_table(yyvsp[0].yint); } + break; + + case 16: +#line 107 "./otp.y" + { add_to_table(yyvsp[0].yint); } + break; + + case 19: +#line 117 "./otp.y" + { store_state(yyvsp[0].ystring); } + break; + + case 20: +#line 119 "./otp.y" + { store_state(yyvsp[0].ystring); } + break; + + case 25: +#line 134 "./otp.y" + { store_alias(yyvsp[-3].ystring, yyvsp[-1].yleft); } + break; + + case 26: +#line 139 "./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); } + break; + + case 28: +#line 143 "./otp.y" + { yyval.yleft = PlusLeft(yyvsp[-4].yleft, yyvsp[-2].yint); } + break; + + case 29: +#line 145 "./otp.y" + { yyval.yleft = yyvsp[0].yleft; } + break; + + case 30: +#line 150 "./otp.y" + { yyval.yleft = SingleLeft(yyvsp[0].yint); } + break; + + case 31: +#line 152 "./otp.y" + { yyval.yleft = DoubleLeft(yyvsp[-2].yint, yyvsp[0].yint); } + break; + + case 32: +#line 154 "./otp.y" + { yyval.yleft = WildCard(); } + break; + + case 33: +#line 156 "./otp.y" + { yyval.yleft = NotChoiceLeft(yyvsp[-1].ylleft); } + break; + + case 34: +#line 158 "./otp.y" + { yyval.yleft = ChoiceLeft(yyvsp[-1].ylleft); } + break; + + case 35: +#line 160 "./otp.y" + { yyval.yleft = lookup_alias(yyvsp[-1].ystring); } + break; + + case 36: +#line 165 "./otp.y" + { yyval.ylleft = llist1(yyvsp[0].yleft); } + break; + + case 37: +#line 167 "./otp.y" + { yyval.ylleft = lappend1(yyvsp[-2].ylleft, yyvsp[0].yleft); } + break; + + case 38: +#line 172 "./otp.y" + { + for(cur_state=0; cur_state<no_states; cur_state++) { + if ((states[cur_state].no_exprs)==0) { + out_int(OTP_LEFT_START, 0); + } else { + out_int(OTP_LEFT_RETURN, 0); + } + out_int(OTP_RIGHT_CHAR, 1); + out_int(OTP_STOP, 0); + } + } + 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; } + break; + + case 43: +#line 196 "./otp.y" + { right_offset=OTP_PBACK_OFFSET; } + break; + + case 44: +#line 198 "./otp.y" + { fill_in_left(); } + break; + + case 47: +#line 208 "./otp.y" + { cur_state = 0; } + break; + + case 48: +#line 210 "./otp.y" + { cur_state = lookup_state(yyvsp[-1].ystring); } + break; + + case 49: +#line 215 "./otp.y" + { yyval.ylleft = lappend(yyvsp[-2].ylleft, lappend(yyvsp[-1].ylleft, yyvsp[0].ylleft)); } + break; + + case 50: +#line 217 "./otp.y" + { yyval.ylleft = lappend(yyvsp[-1].ylleft, yyvsp[0].ylleft); } + break; + + case 51: +#line 222 "./otp.y" + { yyval.ylleft = nil; } + break; + + case 52: +#line 224 "./otp.y" + { yyval.ylleft = llist1(BeginningLeft()); } + break; + + case 53: +#line 229 "./otp.y" + { yyval.ylleft = nil; } + break; + + case 54: +#line 231 "./otp.y" + { yyval.ylleft = llist1(EndLeft()); } + break; + + case 55: +#line 236 "./otp.y" + { yyval.ylleft = llist1(yyvsp[0].yleft); } + break; + + case 56: +#line 238 "./otp.y" + { yyval.ylleft = lappend1(yyvsp[-1].ylleft, yyvsp[0].yleft); } + break; + + case 59: +#line 248 "./otp.y" + { + len=strlen(yyvsp[0].ystring); + for (k=0; k<len; 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); } + break; + + case 62: +#line 259 "./otp.y" + { out_right(OTP_RIGHT_LCHAR, 0); } + break; + + case 63: +#line 261 "./otp.y" + { out_right(OTP_RIGHT_LCHAR, yyvsp[-1].yint); } + break; + + case 64: +#line 263 "./otp.y" + { + out_right(OTP_RIGHT_SOME, 0); + out_int(0,0); + } + break; + + case 65: +#line 268 "./otp.y" + { + out_right(OTP_RIGHT_SOME, yyvsp[-1].yint); + out_int(0, 0); + } + break; + + case 66: +#line 273 "./otp.y" + { + out_right(OTP_RIGHT_SOME, 0); + out_int(0, yyvsp[-1].yint); + } + break; + + case 67: +#line 278 "./otp.y" + { + out_right(OTP_RIGHT_SOME, yyvsp[-3].yint); + out_int(0, yyvsp[-1].yint); + } + break; + + case 68: +#line 283 "./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); } + break; + + case 72: +#line 293 "./otp.y" + { out_int(OTP_MULT, 0); } + break; + + case 73: +#line 295 "./otp.y" + { out_int(OTP_DIV, 0); } + break; + + case 74: +#line 297 "./otp.y" + { out_int(OTP_MOD, 0); } + break; + + case 75: +#line 299 "./otp.y" + { out_int(OTP_PUSH_NUM, lookup_table(yyvsp[0].ystring)); } + break; + + case 76: +#line 301 "./otp.y" + { out_int(OTP_LOOKUP, 0); } + break; + + case 77: +#line 306 "./otp.y" + { out_int(OTP_PUSH_NUM, yyvsp[0].yint); } + break; + + case 78: +#line 308 "./otp.y" + { out_int(OTP_PUSH_CHAR, yyvsp[0].yint); } + break; + + case 79: +#line 310 "./otp.y" + { out_int(OTP_PUSH_LCHAR, 0); } + break; + + case 80: +#line 312 "./otp.y" + { out_int(OTP_PUSH_LCHAR, yyvsp[-1].yint); } + break; + + case 83: +#line 319 "./otp.y" + { out_int(OTP_STATE_CHANGE, lookup_state(yyvsp[-1].ystring)); } + break; + + case 84: +#line 321 "./otp.y" + { out_int(OTP_STATE_PUSH, lookup_state(yyvsp[-1].ystring)); } + break; + + case 85: +#line 323 "./otp.y" + { out_int(OTP_STATE_POP, 0); } + break; + + + } + +/* Line 999 of yacc.c. */ +#line 1512 "y.tab.c" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + char *yymsg; + int yyx, yycount; + + 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++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("syntax error, unexpected ") + 1; + yysize += yystrlen (yytname[yytype]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + /* Return failure if at end of input. */ + 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; + } + + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; + + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; + + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; + + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} + + +#line 325 "./otp.y" + + diff --git a/Build/source/texk/web2c/otps/y_tab.h-dist b/Build/source/texk/web2c/otps/y_tab.h-dist new file mode 100644 index 00000000000..bfe9285131f --- /dev/null +++ b/Build/source/texk/web2c/otps/y_tab.h-dist @@ -0,0 +1,82 @@ +/* A Bison parser, made by GNU Bison 1.875a. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NUMBER = 258, + ID = 259, + STRING = 260, + LEFTARROW = 261, + RIGHTARROW = 262, + INPUT = 263, + OUTPUT = 264, + ALIASES = 265, + STATES = 266, + TABLES = 267, + EXPRESSIONS = 268, + PUSH = 269, + POP = 270, + DIV = 271, + MOD = 272, + BEG = 273, + END = 274 + }; +#endif +#define NUMBER 258 +#define ID 259 +#define STRING 260 +#define LEFTARROW 261 +#define RIGHTARROW 262 +#define INPUT 263 +#define OUTPUT 264 +#define ALIASES 265 +#define STATES 266 +#define TABLES 267 +#define EXPRESSIONS 268 +#define PUSH 269 +#define POP 270 +#define DIV 271 +#define MOD 272 +#define BEG 273 +#define END 274 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +extern YYSTYPE yylval; + + + diff --git a/Build/source/texk/web2c/otps/yystype.h b/Build/source/texk/web2c/otps/yystype.h new file mode 100644 index 00000000000..ef9eefc60da --- /dev/null +++ b/Build/source/texk/web2c/otps/yystype.h @@ -0,0 +1,31 @@ +/* yystype.h: Type declarations for the parser. + +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. + +*/ + +#define YYSTYPE yystype +typedef union { + int yint; + char* ystring ; + list ylist; + left yleft; + llist ylleft; +} yystype; |