diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-19 10:13:38 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-19 10:13:38 +0000 |
commit | 14856225739aa48b6c9cf4c17925362b2d95cea3 (patch) | |
tree | dfd38f1b654fb5bbdfc38887c1a829b658e71530 /gnu/usr.bin/perl/x2p | |
parent | 77469082517e44fe6ca347d9e8dc7dffd1583637 (diff) |
Import of Perl 5.003 into the tree. Makefile.bsd-wrapper and
config.sh.OpenBSD are the only local changes.
Diffstat (limited to 'gnu/usr.bin/perl/x2p')
-rw-r--r-- | gnu/usr.bin/perl/x2p/EXTERN.h | 17 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/INTERN.h | 17 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/Makefile.SH | 159 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/a2p.c | 2666 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/a2p.h | 426 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/a2p.man | 186 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/a2p.y | 396 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/a2py.c | 1308 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/cflags.SH | 87 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/find2perl.PL | 606 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/handy.h | 172 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/hash.c | 242 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/hash.h | 52 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/s2p.PL | 781 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/s2p.man | 95 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/str.c | 468 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/str.h | 53 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/util.c | 220 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/util.h | 33 | ||||
-rw-r--r-- | gnu/usr.bin/perl/x2p/walk.c | 2078 |
20 files changed, 10062 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/x2p/EXTERN.h b/gnu/usr.bin/perl/x2p/EXTERN.h new file mode 100644 index 00000000000..e4abe5f87b5 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/EXTERN.h @@ -0,0 +1,17 @@ +/* $RCSfile: EXTERN.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:05 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: EXTERN.h,v $ + */ + +#undef EXT +#define EXT extern + +#undef INIT +#define INIT(x) + +#undef DOINIT diff --git a/gnu/usr.bin/perl/x2p/INTERN.h b/gnu/usr.bin/perl/x2p/INTERN.h new file mode 100644 index 00000000000..aa3af58c8dc --- /dev/null +++ b/gnu/usr.bin/perl/x2p/INTERN.h @@ -0,0 +1,17 @@ +/* $RCSfile: INTERN.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:06 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: INTERN.h,v $ + */ + +#undef EXT +#define EXT + +#undef INIT +#define INIT(x) = x + +#define DOINIT diff --git a/gnu/usr.bin/perl/x2p/Makefile.SH b/gnu/usr.bin/perl/x2p/Makefile.SH new file mode 100644 index 00000000000..16e282d4970 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/Makefile.SH @@ -0,0 +1,159 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +: This forces SH files to create target in same directory as SH file. +: This is so that make depend always knows where to find SH derivatives. +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac + +echo "Extracting x2p/Makefile (with variable substitutions)" +rm -f Makefile +cat >Makefile <<!GROK!THIS! +# $RCSfile: Makefile.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:07 $ +# +# $Log: Makefile.SH,v $ + +CC = $cc +BYACC = $byacc +LDFLAGS = $ldflags +SMALL = $small +LARGE = $large $split +mallocsrc = $mallocsrc +mallocobj = $mallocobj +shellflags = $shellflags + +libs = $libs + +# These variables will be used in a future version to make +# the make file more portable to non-unix systems. +AR = $ar +EXE_EXT = $exe_ext +LIB_EXT = $lib_ext +OBJ_EXT = $obj_ext +PATH_SEP = $path_sep + +FIRSTMAKEFILE = $firstmakefile + +.SUFFIXES: .c \$(OBJ_EXT) + +!GROK!THIS! + +cat >>Makefile <<'!NO!SUBS!' + +CCCMD = `sh $(shellflags) cflags $@` + +public = a2p s2p find2perl + +private = + +manpages = a2p.man s2p.man + +util = + +sh = Makefile.SH cflags.SH +shextract = Makefile cflags + +pl = find2perl.PL s2p.PL +plextract = find2perl s2p + +addedbyconf = $(shextract) $(plextract) + +h = EXTERN.h INTERN.h ../config.h handy.h hash.h a2p.h str.h util.h + +c = hash.c $(mallocsrc) str.c util.c walk.c + +obj = hash$(OBJ_EXT) $(mallocobj) str$(OBJ_EXT) util$(OBJ_EXT) walk$(OBJ_EXT) + +lintflags = -phbvxac + +# grrr +SHELL = /bin/sh + +.c$(OBJ_EXT): + $(CCCMD) $*.c + +all: $(public) $(private) $(util) + touch all + +a2p: $(obj) a2p$(OBJ_EXT) + $(CC) $(LDFLAGS) $(obj) a2p$(OBJ_EXT) $(libs) -o a2p + +# I now supply a2p.c with the kits, so the following section is +# used only if you force byacc to run by saying +# make run_byacc + +run_byacc: FORCE + @ echo Expect many shift/reduce and reduce/reduce conflicts + $(BYACC) a2p.y + mv y.tab.c a2p.c + +# We don't want to regenerate a2p.c, but it might appear out-of-date +# after a patch is applied or a new distribution is made. +a2p.c: a2p.y + -@touch a2p.c + +a2p$(OBJ_EXT): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h + $(CCCMD) $(LARGE) a2p.c + +clean: + rm -f a2p *$(OBJ_EXT) + +realclean: clean + rm -f *.orig core $(addedbyconf) all malloc.c + rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old + +# The following lint has practically everything turned on. Unfortunately, +# you have to wade through a lot of mumbo jumbo that can't be suppressed. +# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message +# for that spot. + +lint: + lint $(lintflags) $(defs) $(c) > a2p.fuzz + +depend: $(mallocsrc) ../makedepend + sh ../makedepend + +clist: + echo $(c) | tr ' ' '\012' >.clist + +hlist: + echo $(h) | tr ' ' '\012' >.hlist + +shlist: + echo $(sh) | tr ' ' '\012' >.shlist + +# These should be automatically generated + +$(plextract): + ../miniperl -I../lib $@.PL + +malloc.c: ../malloc.c + rm -f malloc.c + sed <../malloc.c >malloc.c \ + -e 's/"perl.h"/"..\/perl.h"/' \ + -e 's/my_exit/exit/' + +# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE +$(obj): + @ echo "You haven't done a "'"make depend" yet!'; exit 1 +makedepend: depend +!NO!SUBS! +$eunicefix Makefile +case `pwd` in +*SH) + $rm -f ../Makefile + $ln Makefile ../Makefile + ;; +esac +rm -f $firstmakefile diff --git a/gnu/usr.bin/perl/x2p/a2p.c b/gnu/usr.bin/perl/x2p/a2p.c new file mode 100644 index 00000000000..c6d21e3e4de --- /dev/null +++ b/gnu/usr.bin/perl/x2p/a2p.c @@ -0,0 +1,2666 @@ +#ifndef lint +static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/91"; +#endif +#define YYBYACC 1 +#line 2 "a2p.y" +/* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: a2p.y,v $ + */ + +#include "INTERN.h" +#include "a2p.h" + +int root; +int begins = Nullop; +int ends = Nullop; + +#line 24 "y.tab.c" +#define BEGIN 257 +#define END 258 +#define REGEX 259 +#define SEMINEW 260 +#define NEWLINE 261 +#define COMMENT 262 +#define FUN1 263 +#define FUNN 264 +#define GRGR 265 +#define PRINT 266 +#define PRINTF 267 +#define SPRINTF 268 +#define SPLIT 269 +#define IF 270 +#define ELSE 271 +#define WHILE 272 +#define FOR 273 +#define IN 274 +#define EXIT 275 +#define NEXT 276 +#define BREAK 277 +#define CONTINUE 278 +#define RET 279 +#define GETLINE 280 +#define DO 281 +#define SUB 282 +#define GSUB 283 +#define MATCH 284 +#define FUNCTION 285 +#define USERFUN 286 +#define DELETE 287 +#define ASGNOP 288 +#define OROR 289 +#define ANDAND 290 +#define NUMBER 291 +#define VAR 292 +#define SUBSTR 293 +#define INDEX 294 +#define MATCHOP 295 +#define RELOP 296 +#define OR 297 +#define STRING 298 +#define UMINUS 299 +#define NOT 300 +#define INCR 301 +#define DECR 302 +#define FIELD 303 +#define VFIELD 304 +#define YYERRCODE 256 +short yylhs[] = { -1, + 0, 3, 6, 6, 2, 2, 7, 7, 7, 7, + 7, 7, 9, 8, 8, 11, 11, 11, 11, 11, + 15, 15, 15, 15, 14, 14, 14, 14, 13, 13, + 13, 13, 12, 12, 12, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 17, 17, 17, 17, 10, 10, 10, 18, 18, + 18, 1, 1, 19, 19, 19, 19, 4, 4, 20, + 20, 21, 21, 21, 21, 5, 5, 22, 22, 22, + 22, 25, 25, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 26, 26, 26, 24, + 24, 24, 24, 24, 24, 24, 24, +}; +short yylen[] = { 2, + 2, 6, 5, 2, 3, 0, 1, 5, 10, 4, + 1, 1, 1, 1, 3, 1, 1, 1, 1, 5, + 3, 4, 4, 2, 3, 3, 3, 3, 3, 3, + 1, 3, 1, 2, 3, 1, 1, 1, 3, 3, + 3, 3, 3, 3, 3, 5, 2, 2, 2, 2, + 2, 2, 3, 1, 2, 3, 4, 3, 4, 1, + 3, 4, 4, 4, 2, 8, 6, 8, 8, 6, + 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, + 8, 1, 4, 1, 2, 1, 1, 0, 4, 4, + 3, 2, 0, 1, 1, 1, 1, 2, 0, 1, + 1, 2, 2, 2, 2, 2, 0, 3, 2, 2, + 1, 1, 0, 1, 4, 2, 4, 2, 1, 1, + 1, 2, 1, 1, 2, 5, 1, 1, 1, 6, + 9, 6, 7, 10, 9, 6, 5, +}; +short yydefred[] = { 93, + 0, 0, 95, 96, 97, 94, 0, 92, 0, 0, + 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 37, 0, 0, 0, 38, 0, 0, 0, 0, + 0, 84, 0, 99, 0, 11, 0, 93, 0, 0, + 0, 17, 18, 19, 0, 0, 99, 99, 0, 0, + 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 24, 49, + 50, 0, 0, 0, 0, 0, 0, 4, 0, 99, + 0, 99, 99, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 47, 48, + 0, 0, 61, 0, 0, 0, 0, 99, 99, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 100, 101, 0, 98, 53, 32, 28, 21, + 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, + 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 62, 63, 91, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 13, 64, 83, 0, 0, 99, + 0, 0, 0, 0, 0, 0, 120, 119, 123, 0, + 99, 0, 99, 10, 99, 0, 106, 0, 111, 0, + 0, 0, 22, 59, 93, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 99, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 99, 99, 99, 99, 99, 8, 0, 0, 70, 0, + 75, 0, 74, 0, 77, 0, 76, 0, 72, 73, + 0, 67, 0, 71, 128, 127, 129, 0, 0, 0, + 0, 0, 112, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 99, 0, + 0, 0, 99, 99, 99, 0, 0, 0, 99, 69, + 68, 79, 78, 81, 80, 0, 66, 0, 0, 0, + 0, 0, 0, 126, 0, 0, 0, 132, 136, 0, + 0, 0, 9, 99, 99, 0, 133, 0, 0, 99, + 131, 135, 0, 134, +}; +short yydgoto[] = { 1, + 2, 7, 36, 73, 125, 37, 38, 39, 164, 52, + 53, 41, 42, 43, 44, 45, 46, 55, 8, 126, + 225, 187, 188, 189, 254, 248, +}; +short yysindex[] = { 0, + 0, -48, 0, 0, 0, 0, 6619, 0, -121, -110, + 0, -4, 32, 4183, 38, 30, 51, 64, 68, -260, + 70, 0, -61, 82, 83, 0, 4448, 4448, 4448, -183, + -183, 0, 4448, 0, 4448, 0, -188, 0, 3, 22, + 6884, 0, 0, 0, 34, -213, 0, 0, 2061, 4183, + 4183, 0, -49, 5612, 85, 4448, 4448, 14, 4713, 6753, + 4448, 87, 4183, 4183, 4448, 4448, -77, -77, 0, 0, + 0, 18, -192, -36, 91, 92, 95, 0, -48, 0, + 4448, 0, 0, 4448, 6980, 4448, 4448, 4448, 34, -154, + 4448, 4448, 4448, 4448, 4448, 4448, -135, 4448, 0, 0, + -192, -192, 0, 5658, 106, 5612, 11, 0, 0, 5704, + 186, 4448, 113, 5751, 115, 5805, 5885, 4183, 114, 67, + 5931, 5978, 0, 0, 4572, 0, 0, 0, 0, 0, + -192, 6032, 1964, 1964, -49, 0, 3230, 186, 186, 186, + 0, 97, 97, -77, -77, -77, -77, -183, -49, 4665, + 4765, 0, 0, 0, 1964, 1964, -131, 186, 4448, 4448, + 4448, 4448, 7026, 121, 0, 0, 0, 4448, 4448, 0, + 4183, 4183, 124, 125, 132, 4448, 0, 0, 0, 4448, + 0, -117, 0, 0, 0, 6884, 0, -44, 0, 4837, + 4448, -114, 0, 0, 0, 0, 6884, 6884, 13, 3635, + 5295, 5367, 5506, 137, 6078, 0, 5560, 6243, -192, -59, + -59, 4448, 4448, 5241, 6884, 6884, 3701, 93, -192, -192, + 0, 0, 0, 0, 0, 0, 6884, -48, 0, 7084, + 0, 4448, 0, 4448, 0, 4448, 0, 4448, 0, 0, + -119, 0, 4448, 0, 0, 0, 0, 4448, 4448, -34, + -16, 6343, 0, 123, -89, 4183, 4930, -192, -192, -192, + -192, -192, 144, 6389, 6435, 6508, 6554, 6700, 0, 6819, + 6884, 6884, 0, 0, 0, 6930, 146, 94, 0, 0, + 0, 0, 0, 0, 0, -192, 0, 3701, 3701, 3701, + 5241, -53, 4448, 0, -192, 5030, -83, 0, 0, 148, + 5241, -13, 0, 0, 0, 149, 0, 3701, 3701, 0, + 0, 0, 3701, 0, +}; +short yyrindex[] = { 0, + 0, 2015, 0, 0, 0, 0, 192, 0, 0, 0, + 0, 56, 0, 3424, 0, 2619, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2147, 0, 2195, 1676, + 3509, 0, 0, 0, 1782, 1340, 0, 0, 0, 152, + 0, 0, 0, 3829, 111, 0, 0, 381, 0, 0, + 0, 0, 152, 101, 0, 0, 564, 834, 0, 0, + 0, 436, 5102, 0, -47, 39, 42, 0, 2245, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1830, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5102, 5102, 0, 72, 0, 17, 0, 0, 0, 72, + 2718, 0, 74, 72, 74, 72, 72, 152, 0, 0, + 72, 72, 0, 0, 0, 0, 0, 0, 0, 0, + 5102, 72, 0, 0, 1882, 0, 3464, 3057, 3097, 3145, + 0, 1468, 1734, 888, 942, 1016, 1286, 2564, 1395, 0, + 0, 0, 0, 0, 0, 0, 0, 3185, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 538, 538, 0, 0, 0, 122, 0, 0, 0, 241, + 0, 0, 0, 0, 0, -41, 0, 0, 0, 0, + 0, 491, 0, 0, 0, 0, 3549, 3594, 0, 72, + 72, 72, 72, 74, 72, 0, 72, 72, 3866, 296, + 357, 0, 0, 136, -10, 169, 0, 0, 5102, 3970, + 0, 0, 0, 0, 0, 0, 3784, 2294, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -51, 0, 0, 0, 101, 0, 4038, 4135, 4235, + 4307, 4400, 74, 72, 72, 72, 72, 72, 0, 72, + 507, 553, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5102, 0, 0, 0, 0, + 155, 0, 0, 0, 4500, 0, 5195, 0, 0, 0, + 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, +}; +short yygindex[] = { 0, + -18, 0, 0, 7251, -19, 0, 0, 0, 0, -31, + 33, 2875, -14, -12, 16, 7373, 76, 147, 0, 0, + 0, 231, -205, 0, -267, -9, +}; +#define YYTABLESIZE 7645 +short yytable[] = { 114, + 82, 47, 246, 269, 127, 301, 273, 114, 253, 81, + 6, 16, 48, 81, 224, 17, 96, 114, 105, 79, + 75, 16, 76, 300, 274, 62, 81, 307, 81, 64, + 122, 119, 120, 306, 97, 49, 75, 82, 76, 40, + 82, 82, 82, 82, 82, 82, 81, 82, 122, 81, + 77, 154, 16, 229, 109, 60, 230, 16, 82, 82, + 82, 69, 82, 82, 247, 84, 77, 74, 123, 124, + 95, 50, 78, 112, 98, 93, 91, 56, 92, 16, + 94, 150, 151, 74, 81, 253, 165, 99, 100, 57, + 59, 58, 60, 82, 82, 253, 60, 60, 60, 60, + 60, 18, 60, 60, 19, 70, 71, 61, 23, 63, + 87, 190, 82, 60, 60, 60, 135, 60, 60, 32, + 33, 65, 66, 82, 82, 80, 118, 96, 109, 97, + 149, 128, 129, 95, 16, 130, 31, 141, 93, 210, + 211, 123, 124, 94, 148, 97, 153, 87, 60, 60, + 87, 87, 87, 87, 166, 87, 159, 87, 161, 167, + 199, 206, 121, 212, 213, 192, 193, 60, 87, 87, + 87, 214, 87, 87, 218, 83, 228, 239, 60, 60, + 121, 276, 277, 256, 280, 293, 294, 304, 305, 310, + 96, 1, 88, 88, 113, 113, 0, 107, 0, 257, + 0, 249, 0, 87, 87, 245, 0, 0, 97, 125, + 0, 3, 4, 5, 0, 221, 222, 223, 114, 114, + 114, 0, 87, 194, 278, 35, 0, 125, 27, 0, + 28, 16, 0, 87, 87, 82, 83, 16, 16, 82, + 83, 17, 17, 0, 250, 251, 0, 16, 16, 122, + 122, 122, 82, 83, 82, 83, 0, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 296, 0, 82, 82, + 0, 0, 82, 83, 82, 82, 83, 0, 16, 16, + 82, 124, 82, 82, 82, 82, 82, 0, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 0, 82, 124, + 82, 82, 82, 82, 82, 16, 16, 90, 292, 0, + 82, 83, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 23, 0, 60, 60, 302, 0, 18, 18, 60, + 19, 19, 32, 33, 0, 60, 116, 60, 60, 60, + 60, 60, 0, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 0, 60, 116, 60, 60, 60, 60, 60, + 16, 16, 31, 31, 0, 0, 0, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 0, 0, 87, 87, + 55, 121, 121, 121, 87, 0, 0, 0, 0, 0, + 87, 0, 87, 87, 87, 87, 87, 118, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 0, 87, 0, + 87, 87, 87, 87, 87, 118, 0, 55, 0, 0, + 55, 55, 55, 55, 55, 55, 0, 55, 125, 125, + 125, 0, 0, 0, 0, 85, 0, 0, 55, 55, + 0, 0, 55, 55, 11, 0, 0, 255, 12, 13, + 0, 0, 0, 14, 15, 0, 0, 16, 16, 0, + 0, 0, 0, 0, 0, 16, 0, 17, 18, 19, + 0, 21, 85, 55, 55, 33, 85, 85, 85, 85, + 85, 0, 85, 26, 0, 29, 30, 31, 32, 33, + 23, 0, 55, 85, 85, 33, 0, 33, 33, 0, + 124, 124, 124, 55, 55, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 297, 298, + 299, 0, 0, 0, 0, 0, 0, 23, 85, 85, + 23, 23, 23, 23, 23, 23, 0, 23, 311, 312, + 0, 0, 0, 314, 0, 0, 0, 115, 23, 23, + 23, 0, 23, 23, 0, 116, 116, 116, 85, 85, + 0, 0, 0, 52, 0, 115, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 88, 0, + 0, 0, 0, 23, 23, 0, 0, 0, 0, 0, + 0, 0, 0, 117, 0, 0, 88, 0, 0, 88, + 52, 0, 23, 33, 52, 52, 52, 52, 52, 0, + 52, 117, 0, 23, 23, 16, 118, 118, 118, 0, + 0, 52, 52, 33, 0, 33, 33, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, + 0, 0, 0, 0, 55, 0, 52, 0, 0, 0, + 55, 88, 55, 55, 55, 55, 55, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 0, 55, 0, + 55, 55, 55, 55, 55, 0, 52, 52, 0, 0, + 0, 0, 85, 85, 33, 85, 85, 85, 33, 33, + 85, 0, 0, 33, 33, 0, 0, 0, 0, 85, + 0, 0, 0, 0, 0, 33, 0, 33, 33, 33, + 85, 33, 0, 85, 33, 33, 33, 33, 33, 33, + 33, 33, 0, 33, 0, 33, 33, 33, 33, 33, + 0, 0, 0, 0, 0, 0, 0, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 0, 0, 23, 23, + 0, 0, 0, 0, 23, 0, 115, 115, 115, 0, + 23, 0, 23, 23, 23, 23, 23, 0, 23, 23, + 0, 23, 23, 23, 23, 23, 23, 0, 23, 0, + 23, 23, 23, 23, 23, 16, 16, 88, 88, 88, + 0, 0, 88, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 117, 117, 117, 0, 0, 0, 0, 0, + 52, 52, 33, 52, 52, 52, 33, 33, 52, 0, + 0, 33, 33, 51, 0, 0, 0, 52, 0, 0, + 0, 16, 16, 33, 0, 33, 33, 33, 52, 33, + 0, 52, 33, 33, 33, 33, 33, 33, 33, 33, + 0, 33, 0, 33, 33, 33, 33, 33, 0, 0, + 51, 0, 0, 33, 51, 51, 51, 51, 51, 0, + 51, 0, 0, 0, 0, 0, 0, 41, 0, 0, + 0, 51, 51, 33, 0, 33, 33, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 41, 0, 51, 33, 41, 41, + 41, 41, 41, 0, 41, 0, 0, 0, 0, 0, + 0, 42, 0, 0, 0, 41, 41, 33, 0, 33, + 33, 0, 0, 0, 0, 0, 51, 51, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, + 41, 33, 42, 42, 42, 42, 42, 0, 42, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, + 42, 33, 0, 33, 33, 0, 0, 0, 0, 0, + 41, 41, 0, 0, 0, 43, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 43, 0, 0, 33, 43, 43, 43, 43, + 43, 0, 43, 0, 42, 42, 0, 0, 0, 0, + 0, 0, 0, 43, 43, 33, 0, 33, 33, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 51, 51, 33, 51, 51, 51, 33, 33, 51, 0, + 0, 33, 33, 0, 0, 0, 0, 51, 43, 0, + 0, 0, 0, 33, 0, 33, 33, 33, 51, 33, + 0, 51, 33, 33, 33, 33, 33, 33, 33, 33, + 0, 33, 0, 33, 33, 33, 33, 33, 43, 43, + 0, 0, 0, 0, 41, 41, 33, 41, 41, 41, + 33, 33, 41, 0, 0, 33, 33, 0, 0, 0, + 0, 41, 0, 0, 0, 0, 0, 33, 0, 33, + 33, 33, 41, 33, 0, 41, 33, 33, 33, 33, + 33, 33, 33, 33, 0, 33, 0, 33, 33, 33, + 33, 33, 0, 0, 0, 0, 0, 0, 42, 42, + 33, 42, 42, 42, 33, 33, 42, 0, 0, 33, + 33, 0, 0, 0, 0, 42, 0, 0, 0, 0, + 0, 33, 0, 33, 33, 33, 42, 33, 0, 42, + 33, 33, 33, 33, 33, 33, 33, 33, 0, 33, + 0, 33, 33, 33, 33, 33, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 43, 43, 33, 43, 43, 43, 33, 33, + 43, 0, 0, 33, 33, 44, 0, 0, 0, 43, + 0, 0, 0, 0, 0, 33, 0, 33, 33, 33, + 43, 33, 0, 43, 33, 33, 33, 33, 33, 33, + 33, 33, 0, 33, 0, 33, 33, 33, 33, 33, + 0, 0, 44, 0, 0, 33, 44, 44, 44, 44, + 44, 0, 44, 0, 0, 0, 0, 0, 0, 36, + 0, 0, 0, 44, 44, 33, 0, 33, 33, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 36, 0, 44, 36, + 36, 36, 36, 36, 36, 0, 36, 0, 0, 0, + 0, 0, 0, 0, 35, 0, 0, 36, 36, 36, + 0, 36, 36, 0, 0, 0, 0, 0, 44, 44, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 35, 36, 36, 35, 35, 35, 35, 35, 35, + 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 36, 35, 35, 35, 0, 35, 0, 0, 0, + 0, 0, 36, 36, 0, 0, 0, 39, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 35, 35, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 35, 33, 39, 0, + 39, 39, 39, 0, 0, 0, 0, 35, 35, 0, + 0, 0, 0, 0, 0, 39, 39, 33, 0, 33, + 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 44, 44, 33, 44, 44, 44, 33, 33, + 44, 0, 0, 33, 33, 0, 0, 0, 0, 44, + 39, 0, 0, 0, 0, 33, 0, 33, 33, 33, + 44, 33, 0, 44, 33, 33, 33, 33, 33, 33, + 33, 33, 0, 33, 0, 33, 33, 33, 33, 33, + 39, 39, 0, 0, 0, 0, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 0, 0, 36, 36, 0, + 0, 0, 0, 36, 0, 0, 0, 0, 0, 36, + 0, 36, 36, 36, 36, 36, 0, 0, 36, 36, + 36, 36, 36, 36, 36, 36, 0, 36, 0, 36, + 0, 0, 36, 36, 0, 0, 0, 0, 0, 0, + 0, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 0, 0, 35, 35, 0, 0, 0, 0, 35, 0, + 0, 0, 0, 0, 35, 14, 35, 35, 35, 35, + 35, 0, 35, 0, 0, 35, 35, 35, 35, 35, + 35, 0, 35, 0, 35, 35, 35, 35, 35, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 0, 0, 14, 0, + 14, 0, 0, 0, 39, 39, 33, 39, 39, 39, + 33, 33, 39, 40, 14, 33, 33, 0, 0, 0, + 0, 39, 0, 0, 0, 0, 0, 33, 0, 33, + 33, 33, 39, 33, 0, 39, 33, 33, 33, 33, + 33, 33, 33, 33, 0, 33, 0, 33, 33, 33, + 33, 33, 0, 33, 40, 0, 40, 40, 40, 0, + 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 40, 40, 33, 0, 33, 33, 0, 14, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 33, 33, 0, 0, 33, 40, 0, 0, 34, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, + 33, 33, 0, 33, 33, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 40, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, + 34, 0, 0, 34, 33, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 0, 0, 34, 34, 33, + 0, 33, 33, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 33, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 15, 34, 0, 15, 0, 15, 0, 0, 0, + 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, + 15, 0, 0, 14, 14, 0, 0, 0, 0, 0, + 0, 0, 34, 34, 0, 14, 0, 14, 14, 14, + 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, + 0, 0, 0, 14, 0, 14, 14, 14, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 40, 40, 33, 40, 40, 40, 33, 33, 40, 0, + 0, 33, 33, 35, 15, 0, 27, 40, 28, 0, + 0, 0, 0, 33, 6, 33, 33, 33, 40, 33, + 0, 40, 33, 33, 33, 33, 33, 33, 33, 33, + 0, 33, 0, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 0, 0, 33, + 33, 0, 0, 0, 6, 0, 0, 6, 0, 6, + 0, 33, 0, 33, 33, 33, 33, 33, 0, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 0, 33, + 0, 33, 33, 33, 33, 33, 34, 34, 33, 34, + 34, 34, 33, 33, 34, 0, 0, 33, 33, 0, + 35, 103, 0, 27, 0, 28, 0, 0, 0, 33, + 0, 33, 33, 33, 34, 33, 0, 34, 33, 33, + 33, 33, 33, 33, 33, 33, 0, 33, 0, 33, + 33, 33, 33, 33, 0, 0, 0, 6, 15, 15, + 15, 15, 15, 15, 15, 15, 12, 0, 0, 15, + 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 15, 0, 15, 15, 15, 15, 15, 0, 0, + 0, 0, 15, 15, 15, 15, 0, 0, 0, 15, + 0, 15, 15, 15, 15, 15, 12, 0, 0, 12, + 0, 12, 0, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 11, 0, 123, 124, 12, 13, 0, 0, + 0, 14, 15, 0, 7, 0, 0, 7, 0, 7, + 0, 0, 0, 16, 5, 17, 18, 19, 0, 21, + 0, 0, 0, 7, 22, 23, 24, 25, 0, 0, + 0, 26, 0, 29, 30, 31, 32, 33, 0, 12, + 0, 6, 6, 6, 0, 0, 0, 6, 6, 0, + 0, 0, 6, 6, 5, 0, 0, 5, 0, 5, + 0, 0, 0, 2, 6, 0, 6, 6, 6, 6, + 6, 0, 0, 0, 0, 6, 6, 6, 6, 0, + 0, 0, 6, 0, 6, 6, 6, 6, 6, 11, + 0, 0, 0, 12, 13, 0, 0, 0, 14, 15, + 0, 0, 0, 2, 0, 0, 2, 0, 2, 0, + 16, 0, 17, 18, 19, 0, 21, 0, 0, 0, + 0, 22, 23, 24, 25, 0, 0, 0, 26, 0, + 29, 30, 31, 32, 33, 0, 0, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 12, 12, 12, 12, 0, 12, 12, + 12, 0, 0, 0, 12, 12, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 12, 0, 12, 12, + 12, 12, 12, 0, 0, 0, 0, 12, 12, 12, + 12, 0, 0, 0, 12, 0, 12, 12, 12, 12, + 12, 7, 7, 7, 7, 7, 7, 7, 7, 0, + 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, + 7, 0, 0, 0, 0, 7, 7, 7, 7, 0, + 0, 0, 7, 0, 7, 7, 7, 7, 7, 0, + 0, 5, 5, 5, 0, 0, 0, 5, 5, 0, + 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 0, 5, 5, 5, 5, + 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, + 0, 0, 5, 0, 5, 5, 5, 5, 5, 0, + 2, 2, 2, 0, 0, 0, 2, 2, 0, 0, + 0, 2, 2, 58, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 2, 2, 2, 2, 2, + 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, + 0, 2, 0, 2, 2, 2, 2, 2, 0, 0, + 58, 0, 0, 58, 58, 58, 58, 58, 58, 0, + 58, 0, 0, 0, 0, 0, 0, 0, 54, 0, + 0, 58, 58, 58, 0, 58, 58, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 54, 58, 58, 54, 54, + 54, 54, 54, 54, 0, 54, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 54, 54, 0, 0, + 54, 54, 0, 0, 0, 0, 58, 58, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 54, 54, 0, 0, 0, 0, 56, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 54, 54, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, 0, 0, 56, 56, + 0, 56, 0, 0, 56, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 56, 56, 56, 0, 56, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 56, 56, 0, 0, 0, 0, 0, 0, 0, 0, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 56, + 0, 58, 58, 0, 0, 0, 0, 58, 0, 0, + 56, 56, 0, 58, 0, 58, 58, 58, 58, 58, + 0, 58, 58, 58, 58, 0, 58, 58, 58, 58, + 0, 58, 0, 58, 58, 58, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 0, 0, 54, 54, 54, 0, + 0, 0, 54, 0, 0, 0, 0, 0, 54, 0, + 54, 54, 54, 54, 54, 0, 54, 54, 54, 54, + 0, 54, 54, 54, 54, 0, 54, 0, 54, 54, + 54, 0, 0, 104, 54, 106, 0, 0, 0, 0, + 110, 111, 0, 114, 116, 117, 0, 54, 54, 121, + 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 132, 0, 0, 0, 137, + 138, 139, 140, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 56, 0, 56, 56, 56, + 0, 0, 56, 0, 0, 0, 158, 0, 0, 0, + 0, 56, 54, 0, 0, 0, 0, 0, 0, 186, + 0, 0, 56, 0, 0, 56, 16, 16, 56, 56, + 56, 56, 56, 56, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 186, 186, 0, 0, 0, 197, + 198, 0, 0, 200, 201, 202, 203, 205, 0, 0, + 0, 0, 207, 208, 0, 54, 54, 0, 0, 0, + 215, 0, 0, 0, 216, 0, 25, 0, 0, 0, + 0, 0, 0, 0, 186, 227, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, + 0, 186, 0, 25, 0, 0, 27, 25, 25, 0, + 25, 0, 0, 25, 264, 0, 265, 0, 266, 0, + 267, 0, 268, 0, 25, 25, 25, 270, 25, 16, + 0, 0, 271, 272, 0, 0, 0, 0, 0, 0, + 54, 186, 0, 27, 0, 0, 0, 27, 27, 0, + 27, 0, 0, 27, 26, 0, 0, 0, 0, 25, + 25, 0, 0, 0, 27, 27, 27, 0, 27, 16, + 0, 0, 186, 186, 186, 186, 0, 0, 25, 0, + 186, 0, 0, 0, 0, 186, 0, 0, 0, 25, + 25, 26, 186, 186, 57, 26, 26, 186, 26, 27, + 27, 26, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 26, 26, 26, 0, 26, 16, 27, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, + 27, 57, 0, 0, 0, 57, 57, 0, 57, 0, + 0, 57, 0, 0, 0, 0, 0, 26, 26, 0, + 0, 0, 57, 57, 57, 0, 57, 16, 0, 0, + 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 26, 26, 35, + 0, 0, 27, 0, 28, 0, 0, 57, 57, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, + 0, 88, 0, 0, 0, 0, 57, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 57, 57, 0, + 0, 0, 0, 25, 25, 0, 25, 25, 25, 0, + 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 25, 0, 0, 25, 16, 16, 25, 25, 25, + 25, 25, 25, 27, 27, 0, 27, 27, 27, 0, + 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, + 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 27, 0, 0, 27, 16, 16, 27, 27, 27, + 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, + 0, 26, 26, 0, 26, 26, 26, 0, 0, 26, + 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, + 0, 0, 0, 88, 0, 0, 0, 0, 0, 26, + 0, 0, 26, 16, 16, 26, 26, 26, 26, 26, + 26, 57, 57, 0, 57, 57, 57, 0, 0, 57, + 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, + 88, 0, 0, 29, 88, 88, 0, 88, 0, 57, + 88, 0, 57, 16, 16, 57, 57, 57, 57, 57, + 57, 88, 88, 88, 0, 88, 88, 0, 11, 0, + 0, 0, 12, 13, 0, 0, 0, 14, 15, 0, + 29, 0, 0, 0, 29, 29, 0, 29, 16, 16, + 29, 17, 18, 19, 0, 21, 88, 88, 0, 0, + 0, 29, 29, 0, 0, 86, 16, 26, 0, 29, + 30, 31, 32, 33, 0, 88, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 16, 88, 88, 89, 16, + 16, 0, 16, 0, 0, 16, 29, 29, 0, 0, + 0, 0, 0, 0, 0, 0, 16, 16, 0, 0, + 0, 16, 0, 0, 0, 29, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 89, 29, 29, 0, 89, + 89, 0, 89, 90, 0, 89, 0, 0, 0, 0, + 0, 16, 16, 0, 0, 0, 89, 89, 0, 0, + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 90, 16, 16, 0, 90, 90, 0, 90, 0, 0, + 90, 89, 89, 0, 0, 0, 0, 0, 0, 0, + 0, 90, 90, 0, 0, 0, 16, 0, 0, 0, + 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 89, 89, 0, 35, 231, 0, 27, 232, 28, + 88, 88, 0, 88, 88, 88, 90, 90, 88, 0, + 0, 0, 0, 0, 87, 0, 88, 88, 0, 0, + 0, 0, 0, 0, 0, 90, 0, 0, 88, 0, + 0, 88, 88, 88, 0, 0, 90, 90, 88, 88, + 29, 29, 0, 29, 29, 29, 0, 0, 29, 0, + 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, + 35, 0, 0, 27, 0, 28, 0, 0, 29, 0, + 0, 29, 16, 16, 29, 29, 29, 29, 29, 185, + 0, 0, 0, 0, 0, 16, 16, 0, 16, 16, + 16, 0, 0, 16, 0, 0, 0, 0, 0, 0, + 0, 0, 16, 20, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 0, 0, 16, 16, 16, 0, + 0, 0, 0, 0, 0, 89, 89, 0, 89, 89, + 89, 0, 0, 89, 0, 0, 0, 0, 0, 0, + 20, 0, 89, 183, 20, 20, 0, 20, 86, 0, + 20, 0, 0, 89, 0, 0, 89, 16, 16, 0, + 0, 20, 20, 0, 0, 0, 16, 0, 0, 0, + 90, 90, 0, 90, 90, 90, 0, 0, 90, 0, + 0, 0, 0, 0, 0, 86, 0, 90, 0, 86, + 86, 0, 0, 0, 0, 86, 20, 20, 90, 0, + 0, 90, 16, 16, 0, 0, 86, 86, 0, 0, + 0, 16, 0, 11, 0, 20, 0, 12, 13, 0, + 0, 0, 14, 15, 0, 110, 20, 20, 110, 0, + 110, 0, 0, 0, 16, 0, 17, 18, 19, 0, + 21, 86, 86, 0, 110, 22, 23, 24, 25, 85, + 86, 0, 26, 0, 29, 30, 31, 32, 33, 0, + 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 86, 86, 0, 0, 0, 0, 0, 0, 11, + 170, 123, 124, 12, 13, 0, 171, 172, 14, 15, + 173, 0, 174, 175, 0, 176, 177, 178, 179, 180, + 16, 181, 17, 18, 19, 0, 21, 182, 110, 0, + 110, 22, 23, 24, 25, 0, 0, 0, 26, 0, + 29, 30, 31, 32, 33, 0, 0, 0, 0, 109, + 0, 0, 109, 0, 109, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 109, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 20, 20, 0, 20, 20, 20, 0, 0, 20, 0, + 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, + 0, 20, 16, 16, 0, 0, 0, 103, 0, 0, + 103, 0, 103, 0, 0, 86, 86, 0, 86, 86, + 86, 0, 109, 86, 109, 0, 103, 0, 0, 0, + 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 86, 0, 0, 86, 16, 16, 0, + 0, 0, 0, 0, 110, 110, 0, 0, 110, 110, + 0, 110, 110, 110, 110, 110, 110, 110, 110, 0, + 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 0, 110, 110, 0, 0, 0, 110, 110, 110, 110, + 103, 0, 103, 110, 0, 110, 110, 110, 110, 110, + 0, 0, 0, 0, 104, 0, 0, 104, 0, 104, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 51, 0, 0, 27, 0, 28, 109, 109, + 0, 0, 109, 109, 0, 109, 109, 109, 109, 109, + 109, 109, 109, 0, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 0, 109, 109, 104, 0, 104, + 109, 109, 109, 109, 0, 0, 0, 109, 0, 109, + 109, 109, 109, 109, 105, 0, 0, 105, 0, 105, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 105, 0, 0, 103, 103, 0, 0, + 103, 103, 0, 103, 103, 103, 103, 103, 103, 103, + 103, 0, 103, 103, 103, 103, 103, 103, 103, 103, + 103, 103, 0, 103, 103, 0, 0, 0, 103, 103, + 103, 103, 0, 0, 0, 103, 0, 103, 103, 103, + 103, 103, 0, 0, 0, 0, 102, 0, 0, 102, + 0, 102, 0, 0, 0, 0, 0, 105, 0, 105, + 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 104, 104, 0, 0, 104, 104, 0, + 104, 104, 104, 104, 104, 104, 104, 104, 0, 104, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 0, + 104, 104, 0, 0, 0, 104, 104, 104, 104, 102, + 0, 102, 104, 0, 104, 104, 104, 104, 104, 108, + 0, 11, 108, 0, 108, 12, 13, 0, 0, 0, + 14, 15, 0, 0, 0, 0, 0, 0, 108, 0, + 0, 0, 16, 0, 17, 18, 19, 0, 21, 0, + 0, 0, 0, 22, 23, 24, 25, 0, 0, 0, + 26, 0, 29, 30, 31, 32, 33, 35, 0, 0, + 27, 0, 28, 105, 105, 0, 0, 105, 105, 0, + 105, 105, 105, 105, 105, 105, 105, 105, 0, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 0, + 105, 105, 108, 0, 108, 105, 105, 105, 105, 0, + 0, 0, 105, 0, 105, 105, 105, 105, 105, 137, + 0, 0, 137, 0, 137, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 137, 0, + 0, 0, 0, 0, 0, 102, 102, 0, 0, 102, + 102, 0, 102, 102, 102, 102, 102, 102, 102, 102, + 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, + 102, 0, 102, 102, 0, 0, 0, 102, 102, 102, + 102, 0, 0, 0, 102, 0, 102, 102, 102, 102, + 102, 35, 0, 0, 27, 0, 28, 0, 0, 0, + 0, 0, 137, 0, 137, 0, 0, 0, 0, 0, + 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 108, 108, + 0, 0, 108, 108, 0, 108, 108, 108, 108, 108, + 108, 108, 108, 0, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 0, 108, 108, 0, 0, 0, + 108, 108, 108, 108, 183, 0, 184, 108, 0, 108, + 108, 108, 108, 108, 35, 0, 11, 27, 0, 28, + 12, 13, 0, 0, 0, 14, 15, 0, 0, 0, + 0, 0, 0, 185, 0, 0, 0, 16, 0, 17, + 18, 19, 0, 21, 0, 0, 0, 0, 22, 23, + 24, 25, 0, 0, 0, 26, 0, 29, 30, 31, + 32, 33, 35, 0, 0, 27, 0, 28, 137, 137, + 0, 0, 137, 137, 0, 137, 137, 137, 137, 137, + 137, 137, 137, 0, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 0, 137, 137, 183, 0, 195, + 137, 137, 137, 137, 0, 0, 0, 137, 0, 137, + 137, 137, 137, 137, 35, 0, 0, 27, 0, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 185, 0, 0, 0, 0, 0, 0, + 11, 170, 0, 0, 12, 13, 0, 171, 172, 14, + 15, 173, 0, 174, 175, 0, 176, 177, 178, 179, + 180, 16, 181, 17, 18, 19, 0, 21, 182, 0, + 0, 0, 22, 23, 24, 25, 0, 0, 0, 26, + 0, 29, 30, 31, 32, 33, 35, 0, 0, 27, + 0, 28, 0, 0, 0, 0, 0, 183, 0, 196, + 0, 0, 0, 0, 0, 185, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 11, 170, 0, 0, 12, 13, 0, + 171, 172, 14, 15, 173, 0, 174, 175, 0, 176, + 177, 178, 179, 180, 16, 181, 17, 18, 19, 0, + 21, 182, 0, 0, 0, 22, 23, 24, 25, 183, + 0, 226, 26, 0, 29, 30, 31, 32, 33, 35, + 0, 113, 27, 0, 28, 12, 13, 0, 0, 0, + 14, 15, 0, 0, 0, 0, 0, 0, 185, 0, + 0, 0, 16, 0, 17, 18, 19, 0, 21, 0, + 0, 0, 0, 22, 23, 24, 25, 0, 0, 0, + 26, 0, 29, 30, 31, 32, 33, 0, 0, 0, + 0, 0, 0, 11, 170, 0, 0, 12, 13, 0, + 171, 172, 14, 15, 173, 0, 174, 175, 0, 176, + 177, 178, 179, 180, 16, 181, 17, 18, 19, 0, + 21, 182, 183, 0, 279, 22, 23, 24, 25, 0, + 0, 0, 26, 0, 29, 30, 31, 32, 33, 35, + 0, 0, 27, 0, 28, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 185, 0, + 0, 0, 0, 0, 0, 11, 170, 0, 0, 12, + 13, 0, 171, 172, 14, 15, 173, 0, 174, 175, + 0, 176, 177, 178, 179, 180, 16, 181, 17, 18, + 19, 0, 21, 182, 0, 0, 0, 22, 23, 24, + 25, 0, 0, 0, 26, 0, 29, 30, 31, 32, + 33, 107, 0, 0, 107, 0, 107, 0, 0, 0, + 0, 0, 183, 0, 303, 0, 0, 0, 0, 0, + 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 170, + 0, 0, 12, 13, 0, 171, 172, 14, 15, 173, + 0, 174, 175, 0, 176, 177, 178, 179, 180, 16, + 181, 17, 18, 19, 0, 21, 182, 0, 0, 0, + 22, 23, 24, 25, 107, 0, 107, 26, 0, 29, + 30, 31, 32, 33, 130, 0, 0, 130, 0, 130, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 130, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 35, 0, 0, 27, 0, 28, 0, 0, 11, 170, + 0, 0, 12, 13, 0, 171, 172, 14, 15, 173, + 0, 174, 175, 0, 176, 177, 178, 179, 180, 16, + 181, 17, 18, 19, 0, 21, 182, 130, 0, 130, + 22, 23, 24, 25, 0, 0, 0, 26, 0, 29, + 30, 31, 32, 33, 35, 233, 0, 27, 234, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 87, 0, 88, 0, 0, 0, + 107, 107, 0, 0, 107, 107, 0, 107, 107, 107, + 107, 107, 0, 107, 107, 0, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 0, 107, 107, 0, + 0, 0, 107, 107, 107, 107, 0, 0, 0, 107, + 0, 107, 107, 107, 107, 107, 35, 235, 0, 27, + 236, 28, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 87, 0, 88, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 130, 130, 0, 0, 130, 130, 0, + 130, 130, 130, 130, 130, 0, 130, 130, 0, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 0, + 130, 130, 0, 0, 0, 130, 130, 130, 130, 0, + 0, 0, 130, 0, 130, 130, 130, 130, 130, 11, + 0, 0, 0, 12, 13, 0, 171, 172, 14, 15, + 0, 0, 0, 0, 0, 176, 177, 178, 179, 180, + 16, 0, 17, 18, 19, 0, 21, 182, 0, 0, + 0, 22, 23, 24, 25, 0, 0, 0, 26, 0, + 29, 30, 31, 32, 33, 35, 237, 0, 27, 238, + 28, 0, 0, 11, 0, 0, 0, 12, 13, 0, + 0, 0, 14, 15, 0, 87, 0, 88, 0, 0, + 0, 0, 0, 0, 16, 0, 17, 18, 19, 0, + 21, 0, 0, 0, 0, 22, 23, 24, 25, 85, + 86, 0, 26, 0, 29, 30, 31, 32, 33, 35, + 242, 0, 27, 243, 28, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, + 0, 88, 0, 0, 0, 11, 0, 0, 0, 12, + 13, 0, 0, 0, 14, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 16, 0, 17, 18, + 19, 35, 21, 0, 27, 108, 28, 22, 23, 24, + 25, 85, 86, 0, 26, 0, 29, 30, 31, 32, + 33, 87, 0, 88, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 35, 152, 0, + 27, 0, 28, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 87, 0, 88, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 35, 0, 0, 27, 157, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 87, 11, 88, 0, 0, 12, 13, + 0, 0, 0, 14, 15, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 16, 0, 17, 18, 19, + 35, 21, 0, 27, 160, 28, 22, 23, 24, 25, + 85, 86, 0, 26, 0, 29, 30, 31, 32, 33, + 87, 0, 88, 0, 0, 0, 0, 0, 11, 0, + 0, 0, 12, 13, 0, 0, 0, 14, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 17, 18, 19, 35, 21, 0, 27, 162, 28, + 22, 23, 24, 25, 85, 86, 0, 26, 0, 29, + 30, 31, 32, 33, 87, 0, 88, 0, 0, 0, + 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, + 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 0, 17, 18, 19, 0, 21, 0, 0, + 0, 0, 22, 23, 24, 25, 85, 86, 0, 26, + 0, 29, 30, 31, 32, 33, 11, 0, 0, 0, + 12, 13, 0, 0, 35, 14, 15, 27, 163, 28, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 17, + 18, 19, 0, 21, 87, 0, 88, 0, 22, 23, + 24, 25, 85, 86, 0, 26, 0, 29, 30, 31, + 32, 33, 11, 0, 0, 0, 12, 13, 0, 0, + 35, 14, 15, 27, 168, 28, 0, 0, 0, 0, + 0, 0, 0, 16, 0, 17, 18, 19, 0, 21, + 87, 0, 88, 0, 22, 23, 24, 25, 85, 86, + 0, 26, 0, 29, 30, 31, 32, 33, 0, 11, + 0, 0, 0, 12, 13, 0, 0, 35, 14, 15, + 27, 169, 28, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 17, 18, 19, 0, 21, 87, 0, 88, + 0, 22, 23, 24, 25, 85, 86, 0, 26, 0, + 29, 30, 31, 32, 33, 0, 0, 0, 0, 0, + 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, + 0, 35, 14, 15, 27, 0, 28, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 17, 18, 19, 191, + 21, 87, 0, 88, 0, 22, 23, 24, 25, 85, + 86, 0, 26, 0, 29, 30, 31, 32, 33, 0, + 0, 0, 0, 0, 0, 0, 0, 35, 240, 0, + 27, 0, 28, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 87, 0, 88, + 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, + 0, 0, 14, 15, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 17, 18, 19, 0, + 21, 0, 0, 0, 0, 22, 23, 24, 25, 85, + 86, 0, 26, 0, 29, 30, 31, 32, 33, 11, + 0, 0, 0, 12, 13, 0, 0, 0, 14, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 17, 18, 19, 0, 21, 0, 0, 0, + 0, 22, 23, 24, 25, 85, 86, 0, 26, 0, + 29, 30, 31, 32, 33, 0, 11, 0, 0, 0, + 12, 13, 0, 0, 0, 14, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 17, + 18, 19, 0, 21, 0, 0, 0, 0, 22, 23, + 24, 25, 85, 86, 0, 26, 0, 29, 30, 31, + 32, 33, 35, 244, 0, 27, 0, 28, 0, 0, + 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, + 15, 0, 87, 0, 88, 0, 0, 0, 0, 0, + 0, 16, 0, 17, 18, 19, 0, 21, 0, 0, + 0, 0, 22, 23, 24, 25, 85, 86, 0, 26, + 0, 29, 30, 31, 32, 33, 11, 0, 0, 0, + 12, 13, 0, 0, 0, 14, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 17, + 18, 19, 0, 21, 0, 0, 0, 0, 22, 23, + 24, 25, 85, 86, 0, 26, 0, 29, 30, 31, + 32, 33, 35, 275, 0, 27, 0, 28, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 35, 281, + 0, 27, 0, 28, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 87, 0, + 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 35, 282, 0, 27, 0, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 87, 0, 88, 0, 0, 0, + 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, + 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 17, 18, 19, 0, 21, 0, + 0, 0, 0, 22, 23, 24, 25, 85, 86, 0, + 26, 0, 29, 30, 31, 32, 33, 35, 283, 0, + 27, 0, 28, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 87, 0, 88, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 35, 284, 0, 27, 0, 28, 0, + 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, + 14, 15, 0, 87, 0, 88, 0, 0, 0, 0, + 0, 0, 16, 0, 17, 18, 19, 0, 21, 0, + 0, 0, 0, 22, 23, 24, 25, 85, 86, 0, + 26, 0, 29, 30, 31, 32, 33, 11, 0, 0, + 0, 12, 13, 0, 0, 0, 14, 15, 35, 0, + 0, 27, 0, 28, 0, 0, 0, 0, 16, 0, + 17, 18, 19, 0, 21, 0, 0, 0, 0, 22, + 23, 24, 25, 85, 86, 0, 26, 0, 29, 30, + 31, 32, 33, 11, 0, 0, 0, 12, 13, 0, + 0, 0, 14, 15, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 17, 18, 19, 0, + 21, 0, 0, 0, 0, 22, 23, 24, 25, 85, + 86, 0, 26, 0, 29, 30, 31, 32, 33, 35, + 285, 34, 27, 0, 28, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, + 0, 88, 0, 0, 0, 0, 11, 0, 0, 0, + 12, 13, 0, 0, 0, 14, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 17, + 18, 19, 35, 21, 0, 27, 0, 28, 22, 23, + 24, 25, 85, 86, 0, 26, 0, 29, 30, 31, + 32, 33, 11, 0, 0, 0, 12, 13, 0, 0, + 0, 14, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 0, 17, 18, 19, 0, 21, + 0, 0, 0, 0, 22, 23, 24, 25, 85, 86, + 0, 26, 0, 29, 30, 31, 32, 33, 35, 287, + 0, 27, 0, 28, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 9, 10, 11, 87, 0, + 88, 12, 13, 0, 0, 0, 14, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, + 17, 18, 19, 20, 21, 0, 0, 0, 0, 22, + 23, 24, 25, 0, 0, 0, 26, 0, 29, 30, + 31, 32, 33, 35, 0, 0, 27, 0, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 87, 0, 88, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, + 0, 0, 12, 13, 0, 0, 0, 14, 15, 35, + 0, 0, 27, 0, 28, 0, 0, 0, 0, 16, + 0, 17, 18, 19, 0, 21, 0, 0, 291, 0, + 22, 23, 24, 25, 85, 86, 0, 26, 0, 29, + 30, 31, 32, 33, 0, 0, 0, 0, 0, 0, + 0, 115, 0, 0, 0, 12, 13, 0, 0, 35, + 14, 15, 27, 0, 28, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 17, 18, 19, 0, 21, 0, + 0, 0, 0, 22, 23, 24, 25, 0, 0, 0, + 26, 0, 29, 30, 31, 32, 33, 0, 0, 0, + 0, 0, 0, 0, 0, 35, 0, 0, 27, 0, + 28, 0, 0, 0, 0, 0, 0, 11, 0, 0, + 0, 12, 13, 0, 0, 0, 14, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, + 17, 18, 19, 0, 21, 0, 0, 0, 0, 22, + 23, 24, 25, 85, 86, 0, 26, 0, 29, 30, + 31, 32, 33, 35, 0, 0, 27, 0, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, + 0, 14, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 0, 17, 18, 19, 0, 21, + 0, 0, 0, 0, 22, 23, 24, 25, 85, 86, + 0, 26, 0, 29, 30, 31, 32, 33, 11, 0, + 0, 0, 12, 13, 0, 0, 0, 14, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 17, 18, 19, 0, 21, 0, 0, 0, 0, + 22, 23, 24, 25, 0, 0, 0, 26, 0, 29, + 30, 31, 32, 33, 0, 0, 0, 0, 136, 0, + 0, 0, 12, 13, 0, 0, 0, 14, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 17, 18, 19, 0, 21, 0, 0, 0, 0, + 22, 23, 24, 25, 0, 0, 0, 26, 0, 29, + 30, 31, 32, 33, 204, 0, 0, 0, 12, 13, + 0, 0, 0, 14, 15, 0, 0, 101, 102, 0, + 0, 0, 0, 0, 0, 16, 0, 17, 18, 19, + 0, 21, 0, 0, 0, 0, 22, 23, 24, 25, + 0, 0, 0, 26, 0, 29, 30, 31, 32, 33, + 131, 0, 133, 134, 0, 0, 0, 0, 0, 0, + 0, 0, 263, 0, 0, 0, 12, 13, 0, 0, + 0, 14, 15, 0, 0, 0, 0, 0, 155, 156, + 0, 0, 0, 16, 0, 17, 18, 19, 0, 21, + 0, 0, 0, 0, 22, 23, 24, 25, 0, 0, + 0, 26, 0, 29, 30, 31, 32, 33, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, + 68, 0, 0, 0, 0, 72, 0, 0, 0, 0, + 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, + 209, 0, 0, 0, 0, 0, 89, 0, 0, 0, + 0, 217, 0, 219, 0, 220, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 241, 0, 0, 0, + 0, 0, 0, 142, 143, 144, 145, 146, 147, 0, + 0, 258, 259, 260, 261, 262, 89, 0, 89, 0, + 0, 0, 89, 89, 0, 0, 89, 0, 89, 89, + 0, 0, 0, 89, 89, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 89, 0, 0, 0, 0, 89, + 89, 89, 89, 0, 0, 0, 0, 0, 0, 286, + 0, 0, 0, 288, 289, 290, 0, 0, 0, 295, + 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 308, 309, 0, 0, 89, 0, + 313, 0, 0, 0, 0, 0, 0, 0, 0, 89, + 89, 0, 89, 89, 89, 89, 0, 89, 0, 89, + 89, 0, 0, 0, 0, 0, 0, 89, 89, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 89, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 89, 89, 89, 89, + 89, 0, 89, 89, 89, +}; +short yycheck[] = { 41, + 0, 123, 62, 123, 41, 59, 41, 59, 214, 63, + 59, 63, 123, 63, 59, 63, 94, 59, 50, 38, + 35, 63, 35, 291, 41, 286, 63, 41, 63, 91, + 41, 63, 64, 301, 112, 40, 51, 37, 51, 7, + 40, 41, 42, 43, 44, 45, 63, 47, 59, 63, + 35, 41, 63, 41, 44, 0, 44, 41, 58, 59, + 60, 29, 62, 63, 124, 44, 51, 35, 261, 262, + 37, 40, 261, 60, 288, 42, 43, 40, 45, 63, + 47, 101, 102, 51, 63, 291, 118, 301, 302, 60, + 40, 16, 37, 93, 94, 301, 41, 42, 43, 44, + 45, 63, 47, 40, 63, 30, 31, 40, 292, 40, + 0, 131, 112, 58, 59, 60, 84, 62, 63, 303, + 304, 40, 40, 123, 124, 123, 40, 94, 44, 112, + 98, 41, 41, 37, 63, 41, 63, 292, 42, 171, + 172, 261, 262, 47, 280, 112, 41, 37, 93, 94, + 40, 41, 42, 43, 41, 45, 44, 47, 44, 93, + 292, 41, 41, 40, 40, 133, 134, 112, 58, 59, + 60, 40, 62, 63, 292, 290, 195, 41, 123, 124, + 59, 59, 272, 91, 41, 40, 93, 271, 41, 41, + 94, 0, 41, 93, 59, 41, -1, 51, -1, 219, + -1, 211, -1, 93, 94, 265, -1, -1, 112, 41, + -1, 260, 261, 262, -1, 260, 261, 262, 260, 261, + 262, -1, 112, 148, 256, 40, -1, 59, 43, -1, + 45, 63, -1, 123, 124, 289, 290, 289, 290, 289, + 290, 289, 290, -1, 212, 213, -1, 289, 290, 260, + 261, 262, 289, 290, 289, 290, -1, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 286, -1, 268, 269, + -1, -1, 289, 290, 274, 289, 290, -1, 289, 290, + 280, 41, 282, 283, 284, 285, 286, -1, 288, 289, + 290, 291, 292, 293, 294, 295, 296, -1, 298, 59, + 300, 301, 302, 303, 304, 289, 290, 274, 276, -1, + 289, 290, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 292, -1, 268, 269, 293, -1, 289, 290, 274, + 289, 290, 303, 304, -1, 280, 41, 282, 283, 284, + 285, 286, -1, 288, 289, 290, 291, 292, 293, 294, + 295, 296, -1, 298, 59, 300, 301, 302, 303, 304, + 289, 290, 289, 290, -1, -1, -1, 257, 258, 259, + 260, 261, 262, 263, 264, 265, -1, -1, 268, 269, + 0, 260, 261, 262, 274, -1, -1, -1, -1, -1, + 280, -1, 282, 283, 284, 285, 286, 41, 288, 289, + 290, 291, 292, 293, 294, 295, 296, -1, 298, -1, + 300, 301, 302, 303, 304, 59, -1, 37, -1, -1, + 40, 41, 42, 43, 44, 45, -1, 47, 260, 261, + 262, -1, -1, -1, -1, 0, -1, -1, 58, 59, + -1, -1, 62, 63, 259, -1, -1, 217, 263, 264, + -1, -1, -1, 268, 269, -1, -1, 289, 290, -1, + -1, -1, -1, -1, -1, 280, -1, 282, 283, 284, + -1, 286, 37, 93, 94, 40, 41, 42, 43, 44, + 45, -1, 47, 298, -1, 300, 301, 302, 303, 304, + 0, -1, 112, 58, 59, 60, -1, 62, 63, -1, + 260, 261, 262, 123, 124, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 288, 289, + 290, -1, -1, -1, -1, -1, -1, 37, 93, 94, + 40, 41, 42, 43, 44, 45, -1, 47, 308, 309, + -1, -1, -1, 313, -1, -1, -1, 41, 58, 59, + 60, -1, 62, 63, -1, 260, 261, 262, 123, 124, + -1, -1, -1, 0, -1, 59, -1, -1, -1, 63, + -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, + -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, + -1, -1, -1, 41, -1, -1, 59, -1, -1, 62, + 37, -1, 112, 40, 41, 42, 43, 44, 45, -1, + 47, 59, -1, 123, 124, 63, 260, 261, 262, -1, + -1, 58, 59, 60, -1, 62, 63, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 257, 258, 259, + 260, 261, 262, 263, 264, 265, -1, -1, 268, 269, + -1, -1, -1, -1, 274, -1, 93, -1, -1, -1, + 280, 124, 282, 283, 284, 285, 286, -1, 288, 289, + 290, 291, 292, 293, 294, 295, 296, -1, 298, -1, + 300, 301, 302, 303, 304, -1, 123, 124, -1, -1, + -1, -1, 257, 258, 259, 260, 261, 262, 263, 264, + 265, -1, -1, 268, 269, -1, -1, -1, -1, 274, + -1, -1, -1, -1, -1, 280, -1, 282, 283, 284, + 285, 286, -1, 288, 289, 290, 291, 292, 293, 294, + 295, 296, -1, 298, -1, 300, 301, 302, 303, 304, + -1, -1, -1, -1, -1, -1, -1, 257, 258, 259, + 260, 261, 262, 263, 264, 265, -1, -1, 268, 269, + -1, -1, -1, -1, 274, -1, 260, 261, 262, -1, + 280, -1, 282, 283, 284, 285, 286, -1, 288, 289, + -1, 291, 292, 293, 294, 295, 296, -1, 298, -1, + 300, 301, 302, 303, 304, 289, 290, 260, 261, 262, + -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 260, 261, 262, -1, -1, -1, -1, -1, + 257, 258, 259, 260, 261, 262, 263, 264, 265, -1, + -1, 268, 269, 0, -1, -1, -1, 274, -1, -1, + -1, 289, 290, 280, -1, 282, 283, 284, 285, 286, + -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, + -1, 298, -1, 300, 301, 302, 303, 304, -1, -1, + 37, -1, -1, 40, 41, 42, 43, 44, 45, -1, + 47, -1, -1, -1, -1, -1, -1, 0, -1, -1, + -1, 58, 59, 60, -1, 62, 63, -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, 37, -1, 93, 40, 41, 42, + 43, 44, 45, -1, 47, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, 58, 59, 60, -1, 62, + 63, -1, -1, -1, -1, -1, 123, 124, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, + 93, 40, 41, 42, 43, 44, 45, -1, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, + 59, 60, -1, 62, 63, -1, -1, -1, -1, -1, + 123, 124, -1, -1, -1, 0, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 37, -1, -1, 40, 41, 42, 43, 44, + 45, -1, 47, -1, 123, 124, -1, -1, -1, -1, + -1, -1, -1, 58, 59, 60, -1, 62, 63, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 257, 258, 259, 260, 261, 262, 263, 264, 265, -1, + -1, 268, 269, -1, -1, -1, -1, 274, 93, -1, + -1, -1, -1, 280, -1, 282, 283, 284, 285, 286, + -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, + -1, 298, -1, 300, 301, 302, 303, 304, 123, 124, + -1, -1, -1, -1, 257, 258, 259, 260, 261, 262, + 263, 264, 265, -1, -1, 268, 269, -1, -1, -1, + -1, 274, -1, -1, -1, -1, -1, 280, -1, 282, + 283, 284, 285, 286, -1, 288, 289, 290, 291, 292, + 293, 294, 295, 296, -1, 298, -1, 300, 301, 302, + 303, 304, -1, -1, -1, -1, -1, -1, 257, 258, + 259, 260, 261, 262, 263, 264, 265, -1, -1, 268, + 269, -1, -1, -1, -1, 274, -1, -1, -1, -1, + -1, 280, -1, 282, 283, 284, 285, 286, -1, 288, + 289, 290, 291, 292, 293, 294, 295, 296, -1, 298, + -1, 300, 301, 302, 303, 304, -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, 257, 258, 259, 260, 261, 262, 263, 264, + 265, -1, -1, 268, 269, 0, -1, -1, -1, 274, + -1, -1, -1, -1, -1, 280, -1, 282, 283, 284, + 285, 286, -1, 288, 289, 290, 291, 292, 293, 294, + 295, 296, -1, 298, -1, 300, 301, 302, 303, 304, + -1, -1, 37, -1, -1, 40, 41, 42, 43, 44, + 45, -1, 47, -1, -1, -1, -1, -1, -1, 0, + -1, -1, -1, 58, 59, 60, -1, 62, 63, -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, 37, -1, 93, 40, + 41, 42, 43, 44, 45, -1, 47, -1, -1, -1, + -1, -1, -1, -1, 0, -1, -1, 58, 59, 60, + -1, 62, 63, -1, -1, -1, -1, -1, 123, 124, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 37, 93, 94, 40, 41, 42, 43, 44, 45, + -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 112, 58, 59, 60, -1, 62, -1, -1, -1, + -1, -1, 123, 124, -1, -1, -1, 0, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 112, 40, 41, -1, + 43, 44, 45, -1, -1, -1, -1, 123, 124, -1, + -1, -1, -1, -1, -1, 58, 59, 60, -1, 62, + 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 257, 258, 259, 260, 261, 262, 263, 264, + 265, -1, -1, 268, 269, -1, -1, -1, -1, 274, + 93, -1, -1, -1, -1, 280, -1, 282, 283, 284, + 285, 286, -1, 288, 289, 290, 291, 292, 293, 294, + 295, 296, -1, 298, -1, 300, 301, 302, 303, 304, + 123, 124, -1, -1, -1, -1, 257, 258, 259, 260, + 261, 262, 263, 264, 265, -1, -1, 268, 269, -1, + -1, -1, -1, 274, -1, -1, -1, -1, -1, 280, + -1, 282, 283, 284, 285, 286, -1, -1, 289, 290, + 291, 292, 293, 294, 295, 296, -1, 298, -1, 300, + -1, -1, 303, 304, -1, -1, -1, -1, -1, -1, + -1, 257, 258, 259, 260, 261, 262, 263, 264, 265, + -1, -1, 268, 269, -1, -1, -1, -1, 274, -1, + -1, -1, -1, -1, 280, 0, 282, 283, 284, 285, + 286, -1, 288, -1, -1, 291, 292, 293, 294, 295, + 296, -1, 298, -1, 300, 301, 302, 303, 304, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, + 45, -1, -1, -1, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 0, 59, 268, 269, -1, -1, -1, + -1, 274, -1, -1, -1, -1, -1, 280, -1, 282, + 283, 284, 285, 286, -1, 288, 289, 290, 291, 292, + 293, 294, 295, 296, -1, 298, -1, 300, 301, 302, + 303, 304, -1, 40, 41, -1, 43, 44, 45, -1, + -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 58, 59, 60, -1, 62, 63, -1, 123, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 40, 41, -1, -1, 44, 93, -1, -1, 0, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, + 59, 60, -1, 62, 63, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 123, 124, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, + 41, -1, -1, 44, 93, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, 58, 59, 60, + -1, 62, 63, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 123, 124, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 40, 93, -1, 43, -1, 45, -1, -1, -1, + -1, -1, 257, 258, 259, 260, 261, 262, 263, 264, + 59, -1, -1, 268, 269, -1, -1, -1, -1, -1, + -1, -1, 123, 124, -1, 280, -1, 282, 283, 284, + 285, 286, -1, -1, -1, -1, 291, 292, 293, 294, + -1, -1, -1, 298, -1, 300, 301, 302, 303, 304, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 257, 258, 259, 260, 261, 262, 263, 264, 265, -1, + -1, 268, 269, 40, 123, -1, 43, 274, 45, -1, + -1, -1, -1, 280, 0, 282, 283, 284, 285, 286, + -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, + -1, 298, -1, 300, 301, 302, 303, 304, 257, 258, + 259, 260, 261, 262, 263, 264, 265, -1, -1, 268, + 269, -1, -1, -1, 40, -1, -1, 43, -1, 45, + -1, 280, -1, 282, 283, 284, 285, 286, -1, 288, + 289, 290, 291, 292, 293, 294, 295, 296, -1, 298, + -1, 300, 301, 302, 303, 304, 257, 258, 259, 260, + 261, 262, 263, 264, 265, -1, -1, 268, 269, -1, + 40, 41, -1, 43, -1, 45, -1, -1, -1, 280, + -1, 282, 283, 284, 285, 286, -1, 288, 289, 290, + 291, 292, 293, 294, 295, 296, -1, 298, -1, 300, + 301, 302, 303, 304, -1, -1, -1, 123, 257, 258, + 259, 260, 261, 262, 263, 264, 0, -1, -1, 268, + 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 280, -1, 282, 283, 284, 285, 286, -1, -1, + -1, -1, 291, 292, 293, 294, -1, -1, -1, 298, + -1, 300, 301, 302, 303, 304, 40, -1, -1, 43, + -1, 45, -1, -1, 0, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 259, -1, 261, 262, 263, 264, -1, -1, + -1, 268, 269, -1, 40, -1, -1, 43, -1, 45, + -1, -1, -1, 280, 0, 282, 283, 284, -1, 286, + -1, -1, -1, 59, 291, 292, 293, 294, -1, -1, + -1, 298, -1, 300, 301, 302, 303, 304, -1, 123, + -1, 257, 258, 259, -1, -1, -1, 263, 264, -1, + -1, -1, 268, 269, 40, -1, -1, 43, -1, 45, + -1, -1, -1, 0, 280, -1, 282, 283, 284, 285, + 286, -1, -1, -1, -1, 291, 292, 293, 294, -1, + -1, -1, 298, -1, 300, 301, 302, 303, 304, 259, + -1, -1, -1, 263, 264, -1, -1, -1, 268, 269, + -1, -1, -1, 40, -1, -1, 43, -1, 45, -1, + 280, -1, 282, 283, 284, -1, 286, -1, -1, -1, + -1, 291, 292, 293, 294, -1, -1, -1, 298, -1, + 300, 301, 302, 303, 304, -1, -1, 123, -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, 257, 258, 259, 260, -1, 262, 263, + 264, -1, -1, -1, 268, 269, 123, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 280, -1, 282, 283, + 284, 285, 286, -1, -1, -1, -1, 291, 292, 293, + 294, -1, -1, -1, 298, -1, 300, 301, 302, 303, + 304, 257, 258, 259, 260, 261, 262, 263, 264, -1, + -1, -1, 268, 269, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 280, -1, 282, 283, 284, 285, + 286, -1, -1, -1, -1, 291, 292, 293, 294, -1, + -1, -1, 298, -1, 300, 301, 302, 303, 304, -1, + -1, 257, 258, 259, -1, -1, -1, 263, 264, -1, + -1, -1, 268, 269, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 280, -1, 282, 283, 284, 285, + 286, -1, -1, -1, -1, 291, 292, 293, 294, -1, + -1, -1, 298, -1, 300, 301, 302, 303, 304, -1, + 257, 258, 259, -1, -1, -1, 263, 264, -1, -1, + -1, 268, 269, 0, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 280, -1, 282, 283, 284, 285, 286, + -1, -1, -1, -1, 291, 292, 293, 294, -1, -1, + -1, 298, -1, 300, 301, 302, 303, 304, -1, -1, + 37, -1, -1, 40, 41, 42, 43, 44, 45, -1, + 47, -1, -1, -1, -1, -1, -1, -1, 0, -1, + -1, 58, 59, 60, -1, 62, 63, -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, 37, 93, 94, 40, 41, + 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 112, 58, 59, -1, -1, + 62, 63, -1, -1, -1, -1, 123, 124, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 93, 94, -1, -1, -1, -1, 0, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 123, 124, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 37, -1, -1, -1, 41, 42, + -1, 44, -1, -1, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 58, 59, 60, -1, 62, + 63, -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, + 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 112, + -1, 268, 269, -1, -1, -1, -1, 274, -1, -1, + 123, 124, -1, 280, -1, 282, 283, 284, 285, 286, + -1, 288, 289, 290, 291, -1, 293, 294, 295, 296, + -1, 298, -1, 300, 301, 302, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 257, 258, 259, 260, 261, + 262, 263, 264, 265, -1, -1, 268, 269, 14, -1, + -1, -1, 274, -1, -1, -1, -1, -1, 280, -1, + 282, 283, 284, 285, 286, -1, 288, 289, 290, 291, + -1, 293, 294, 295, 296, -1, 298, -1, 300, 301, + 302, -1, -1, 49, 50, 51, -1, -1, -1, -1, + 56, 57, -1, 59, 60, 61, -1, 63, 64, 65, + 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 81, -1, -1, -1, 85, + 86, 87, 88, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 257, 258, -1, 260, 261, 262, + -1, -1, 265, -1, -1, -1, 112, -1, -1, -1, + -1, 274, 118, -1, -1, -1, -1, -1, -1, 125, + -1, -1, 285, -1, -1, 288, 289, 290, 291, 292, + 293, 294, 295, 296, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 150, 151, -1, -1, -1, 155, + 156, -1, -1, 159, 160, 161, 162, 163, -1, -1, + -1, -1, 168, 169, -1, 171, 172, -1, -1, -1, + 176, -1, -1, -1, 180, -1, 0, -1, -1, -1, + -1, -1, -1, -1, 190, 191, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 214, -1, + -1, 217, -1, 37, -1, -1, 0, 41, 42, -1, + 44, -1, -1, 47, 230, -1, 232, -1, 234, -1, + 236, -1, 238, -1, 58, 59, 60, 243, 62, 63, + -1, -1, 248, 249, -1, -1, -1, -1, -1, -1, + 256, 257, -1, 37, -1, -1, -1, 41, 42, -1, + 44, -1, -1, 47, 0, -1, -1, -1, -1, 93, + 94, -1, -1, -1, 58, 59, 60, -1, 62, 63, + -1, -1, 288, 289, 290, 291, -1, -1, 112, -1, + 296, -1, -1, -1, -1, 301, -1, -1, -1, 123, + 124, 37, 308, 309, 0, 41, 42, 313, 44, 93, + 94, 47, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 58, 59, 60, -1, 62, 63, 112, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, + 124, 37, -1, -1, -1, 41, 42, -1, 44, -1, + -1, 47, -1, -1, -1, -1, -1, 93, 94, -1, + -1, -1, 58, 59, 60, -1, 62, 63, -1, -1, + -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 123, 124, 40, + -1, -1, 43, -1, 45, -1, -1, 93, 94, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, + -1, 62, -1, -1, -1, -1, 112, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 123, 124, -1, + -1, -1, -1, 257, 258, -1, 260, 261, 262, -1, + -1, 265, -1, -1, -1, -1, -1, -1, -1, -1, + 274, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 285, -1, -1, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 257, 258, -1, 260, 261, 262, -1, + -1, 265, -1, -1, -1, -1, -1, -1, -1, -1, + 274, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 285, -1, -1, 288, 289, 290, 291, 292, 293, + 294, 295, 296, -1, -1, -1, -1, -1, -1, -1, + -1, 257, 258, -1, 260, 261, 262, -1, -1, 265, + -1, -1, -1, -1, -1, -1, -1, -1, 274, -1, + -1, -1, -1, 0, -1, -1, -1, -1, -1, 285, + -1, -1, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 257, 258, -1, 260, 261, 262, -1, -1, 265, + -1, -1, -1, -1, -1, -1, -1, -1, 274, -1, + 37, -1, -1, 0, 41, 42, -1, 44, -1, 285, + 47, -1, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 58, 59, 60, -1, 62, 63, -1, 259, -1, + -1, -1, 263, 264, -1, -1, -1, 268, 269, -1, + 37, -1, -1, -1, 41, 42, -1, 44, 0, 280, + 47, 282, 283, 284, -1, 286, 93, 94, -1, -1, + -1, 58, 59, -1, -1, 296, 63, 298, -1, 300, + 301, 302, 303, 304, -1, 112, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 37, 123, 124, 0, 41, + 42, -1, 44, -1, -1, 47, 93, 94, -1, -1, + -1, -1, -1, -1, -1, -1, 58, 59, -1, -1, + -1, 63, -1, -1, -1, 112, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 37, 123, 124, -1, 41, + 42, -1, 44, 0, -1, 47, -1, -1, -1, -1, + -1, 93, 94, -1, -1, -1, 58, 59, -1, -1, + -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, + 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 37, 123, 124, -1, 41, 42, -1, 44, -1, -1, + 47, 93, 94, -1, -1, -1, -1, -1, -1, -1, + -1, 58, 59, -1, -1, -1, 63, -1, -1, -1, + 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 123, 124, -1, 40, 41, -1, 43, 44, 45, + 257, 258, -1, 260, 261, 262, 93, 94, 265, -1, + -1, -1, -1, -1, 60, -1, 62, 274, -1, -1, + -1, -1, -1, -1, -1, 112, -1, -1, 285, -1, + -1, 288, 289, 290, -1, -1, 123, 124, 295, 296, + 257, 258, -1, 260, 261, 262, -1, -1, 265, -1, + -1, -1, -1, -1, -1, -1, -1, 274, -1, -1, + 40, -1, -1, 43, -1, 45, -1, -1, 285, -1, + -1, 288, 289, 290, 291, 292, 293, 294, 295, 59, + -1, -1, -1, -1, -1, 257, 258, -1, 260, 261, + 262, -1, -1, 265, -1, -1, -1, -1, -1, -1, + -1, -1, 274, 0, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 285, -1, -1, 288, 289, 290, -1, + -1, -1, -1, -1, -1, 257, 258, -1, 260, 261, + 262, -1, -1, 265, -1, -1, -1, -1, -1, -1, + 37, -1, 274, 123, 41, 42, -1, 44, 0, -1, + 47, -1, -1, 285, -1, -1, 288, 289, 290, -1, + -1, 58, 59, -1, -1, -1, 63, -1, -1, -1, + 257, 258, -1, 260, 261, 262, -1, -1, 265, -1, + -1, -1, -1, -1, -1, 37, -1, 274, -1, 41, + 42, -1, -1, -1, -1, 47, 93, 94, 285, -1, + -1, 288, 289, 290, -1, -1, 58, 59, -1, -1, + -1, 63, -1, 259, -1, 112, -1, 263, 264, -1, + -1, -1, 268, 269, -1, 40, 123, 124, 43, -1, + 45, -1, -1, -1, 280, -1, 282, 283, 284, -1, + 286, 93, 94, -1, 59, 291, 292, 293, 294, 295, + 296, -1, 298, -1, 300, 301, 302, 303, 304, -1, + 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 123, 124, -1, -1, -1, -1, -1, -1, 259, + 260, 261, 262, 263, 264, -1, 266, 267, 268, 269, + 270, -1, 272, 273, -1, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, -1, 286, 287, 123, -1, + 125, 291, 292, 293, 294, -1, -1, -1, 298, -1, + 300, 301, 302, 303, 304, -1, -1, -1, -1, 40, + -1, -1, 43, -1, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 257, 258, -1, 260, 261, 262, -1, -1, 265, -1, + -1, -1, -1, -1, -1, -1, -1, 274, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 285, -1, + -1, 288, 289, 290, -1, -1, -1, 40, -1, -1, + 43, -1, 45, -1, -1, 257, 258, -1, 260, 261, + 262, -1, 123, 265, 125, -1, 59, -1, -1, -1, + -1, -1, 274, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 285, -1, -1, 288, 289, 290, -1, + -1, -1, -1, -1, 259, 260, -1, -1, 263, 264, + -1, 266, 267, 268, 269, 270, 271, 272, 273, -1, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + -1, 286, 287, -1, -1, -1, 291, 292, 293, 294, + 123, -1, 125, 298, -1, 300, 301, 302, 303, 304, + -1, -1, -1, -1, 40, -1, -1, 43, -1, 45, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 59, -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, 40, -1, -1, 43, -1, 45, 259, 260, + -1, -1, 263, 264, -1, 266, 267, 268, 269, 270, + 271, 272, 273, -1, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, -1, 286, 287, 123, -1, 125, + 291, 292, 293, 294, -1, -1, -1, 298, -1, 300, + 301, 302, 303, 304, 40, -1, -1, 43, -1, 45, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 59, -1, -1, 259, 260, -1, -1, + 263, 264, -1, 266, 267, 268, 269, 270, 271, 272, + 273, -1, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, -1, 286, 287, -1, -1, -1, 291, 292, + 293, 294, -1, -1, -1, 298, -1, 300, 301, 302, + 303, 304, -1, -1, -1, -1, 40, -1, -1, 43, + -1, 45, -1, -1, -1, -1, -1, 123, -1, 125, + -1, -1, -1, -1, -1, 59, -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, 259, 260, -1, -1, 263, 264, -1, + 266, 267, 268, 269, 270, 271, 272, 273, -1, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, -1, + 286, 287, -1, -1, -1, 291, 292, 293, 294, 123, + -1, 125, 298, -1, 300, 301, 302, 303, 304, 40, + -1, 259, 43, -1, 45, 263, 264, -1, -1, -1, + 268, 269, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, 280, -1, 282, 283, 284, -1, 286, -1, + -1, -1, -1, 291, 292, 293, 294, -1, -1, -1, + 298, -1, 300, 301, 302, 303, 304, 40, -1, -1, + 43, -1, 45, 259, 260, -1, -1, 263, 264, -1, + 266, 267, 268, 269, 270, 271, 272, 273, -1, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, -1, + 286, 287, 123, -1, 125, 291, 292, 293, 294, -1, + -1, -1, 298, -1, 300, 301, 302, 303, 304, 40, + -1, -1, 43, -1, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, -1, -1, -1, 259, 260, -1, -1, 263, + 264, -1, 266, 267, 268, 269, 270, 271, 272, 273, + -1, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, -1, 286, 287, -1, -1, -1, 291, 292, 293, + 294, -1, -1, -1, 298, -1, 300, 301, 302, 303, + 304, 40, -1, -1, 43, -1, 45, -1, -1, -1, + -1, -1, 123, -1, 125, -1, -1, -1, -1, -1, + 59, -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, 259, 260, + -1, -1, 263, 264, -1, 266, 267, 268, 269, 270, + 271, 272, 273, -1, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, -1, 286, 287, -1, -1, -1, + 291, 292, 293, 294, 123, -1, 125, 298, -1, 300, + 301, 302, 303, 304, 40, -1, 259, 43, -1, 45, + 263, 264, -1, -1, -1, 268, 269, -1, -1, -1, + -1, -1, -1, 59, -1, -1, -1, 280, -1, 282, + 283, 284, -1, 286, -1, -1, -1, -1, 291, 292, + 293, 294, -1, -1, -1, 298, -1, 300, 301, 302, + 303, 304, 40, -1, -1, 43, -1, 45, 259, 260, + -1, -1, 263, 264, -1, 266, 267, 268, 269, 270, + 271, 272, 273, -1, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, -1, 286, 287, 123, -1, 125, + 291, 292, 293, 294, -1, -1, -1, 298, -1, 300, + 301, 302, 303, 304, 40, -1, -1, 43, -1, 45, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, + 259, 260, -1, -1, 263, 264, -1, 266, 267, 268, + 269, 270, -1, 272, 273, -1, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, -1, 286, 287, -1, + -1, -1, 291, 292, 293, 294, -1, -1, -1, 298, + -1, 300, 301, 302, 303, 304, 40, -1, -1, 43, + -1, 45, -1, -1, -1, -1, -1, 123, -1, 125, + -1, -1, -1, -1, -1, 59, -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, 259, 260, -1, -1, 263, 264, -1, + 266, 267, 268, 269, 270, -1, 272, 273, -1, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, -1, + 286, 287, -1, -1, -1, 291, 292, 293, 294, 123, + -1, 125, 298, -1, 300, 301, 302, 303, 304, 40, + -1, 259, 43, -1, 45, 263, 264, -1, -1, -1, + 268, 269, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, 280, -1, 282, 283, 284, -1, 286, -1, + -1, -1, -1, 291, 292, 293, 294, -1, -1, -1, + 298, -1, 300, 301, 302, 303, 304, -1, -1, -1, + -1, -1, -1, 259, 260, -1, -1, 263, 264, -1, + 266, 267, 268, 269, 270, -1, 272, 273, -1, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, -1, + 286, 287, 123, -1, 125, 291, 292, 293, 294, -1, + -1, -1, 298, -1, 300, 301, 302, 303, 304, 40, + -1, -1, 43, -1, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, + -1, -1, -1, -1, -1, 259, 260, -1, -1, 263, + 264, -1, 266, 267, 268, 269, 270, -1, 272, 273, + -1, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, -1, 286, 287, -1, -1, -1, 291, 292, 293, + 294, -1, -1, -1, 298, -1, 300, 301, 302, 303, + 304, 40, -1, -1, 43, -1, 45, -1, -1, -1, + -1, -1, 123, -1, 125, -1, -1, -1, -1, -1, + 59, -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, 259, 260, + -1, -1, 263, 264, -1, 266, 267, 268, 269, 270, + -1, 272, 273, -1, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, -1, 286, 287, -1, -1, -1, + 291, 292, 293, 294, 123, -1, 125, 298, -1, 300, + 301, 302, 303, 304, 40, -1, -1, 43, -1, 45, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 59, -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, + 40, -1, -1, 43, -1, 45, -1, -1, 259, 260, + -1, -1, 263, 264, -1, 266, 267, 268, 269, 270, + -1, 272, 273, -1, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, -1, 286, 287, 123, -1, 125, + 291, 292, 293, 294, -1, -1, -1, 298, -1, 300, + 301, 302, 303, 304, 40, 41, -1, 43, 44, 45, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 60, -1, 62, -1, -1, -1, + 259, 260, -1, -1, 263, 264, -1, 266, 267, 268, + 269, 270, -1, 272, 273, -1, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, -1, 286, 287, -1, + -1, -1, 291, 292, 293, 294, -1, -1, -1, 298, + -1, 300, 301, 302, 303, 304, 40, 41, -1, 43, + 44, 45, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 60, -1, 62, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 259, 260, -1, -1, 263, 264, -1, + 266, 267, 268, 269, 270, -1, 272, 273, -1, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, -1, + 286, 287, -1, -1, -1, 291, 292, 293, 294, -1, + -1, -1, 298, -1, 300, 301, 302, 303, 304, 259, + -1, -1, -1, 263, 264, -1, 266, 267, 268, 269, + -1, -1, -1, -1, -1, 275, 276, 277, 278, 279, + 280, -1, 282, 283, 284, -1, 286, 287, -1, -1, + -1, 291, 292, 293, 294, -1, -1, -1, 298, -1, + 300, 301, 302, 303, 304, 40, 41, -1, 43, 44, + 45, -1, -1, 259, -1, -1, -1, 263, 264, -1, + -1, -1, 268, 269, -1, 60, -1, 62, -1, -1, + -1, -1, -1, -1, 280, -1, 282, 283, 284, -1, + 286, -1, -1, -1, -1, 291, 292, 293, 294, 295, + 296, -1, 298, -1, 300, 301, 302, 303, 304, 40, + 41, -1, 43, 44, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, + -1, 62, -1, -1, -1, 259, -1, -1, -1, 263, + 264, -1, -1, -1, 268, 269, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 280, -1, 282, 283, + 284, 40, 286, -1, 43, 44, 45, 291, 292, 293, + 294, 295, 296, -1, 298, -1, 300, 301, 302, 303, + 304, 60, -1, 62, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 40, 41, -1, + 43, -1, 45, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 60, 259, 62, -1, -1, 263, 264, + -1, -1, -1, 268, 269, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 280, -1, 282, 283, 284, + 40, 286, -1, 43, 44, 45, 291, 292, 293, 294, + 295, 296, -1, 298, -1, 300, 301, 302, 303, 304, + 60, -1, 62, -1, -1, -1, -1, -1, 259, -1, + -1, -1, 263, 264, -1, -1, -1, 268, 269, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 280, + -1, 282, 283, 284, 40, 286, -1, 43, 44, 45, + 291, 292, 293, 294, 295, 296, -1, 298, -1, 300, + 301, 302, 303, 304, 60, -1, 62, -1, -1, -1, + 259, -1, -1, -1, 263, 264, -1, -1, -1, 268, + 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 280, -1, 282, 283, 284, -1, 286, -1, -1, + -1, -1, 291, 292, 293, 294, 295, 296, -1, 298, + -1, 300, 301, 302, 303, 304, 259, -1, -1, -1, + 263, 264, -1, -1, 40, 268, 269, 43, 44, 45, + -1, -1, -1, -1, -1, -1, -1, 280, -1, 282, + 283, 284, -1, 286, 60, -1, 62, -1, 291, 292, + 293, 294, 295, 296, -1, 298, -1, 300, 301, 302, + 303, 304, 259, -1, -1, -1, 263, 264, -1, -1, + 40, 268, 269, 43, 44, 45, -1, -1, -1, -1, + -1, -1, -1, 280, -1, 282, 283, 284, -1, 286, + 60, -1, 62, -1, 291, 292, 293, 294, 295, 296, + -1, 298, -1, 300, 301, 302, 303, 304, -1, 259, + -1, -1, -1, 263, 264, -1, -1, 40, 268, 269, + 43, 44, 45, -1, -1, -1, -1, -1, -1, -1, + 280, -1, 282, 283, 284, -1, 286, 60, -1, 62, + -1, 291, 292, 293, 294, 295, 296, -1, 298, -1, + 300, 301, 302, 303, 304, -1, -1, -1, -1, -1, + -1, -1, -1, 259, -1, -1, -1, 263, 264, -1, + -1, 40, 268, 269, 43, -1, 45, -1, -1, -1, + -1, -1, -1, -1, 280, -1, 282, 283, 284, 58, + 286, 60, -1, 62, -1, 291, 292, 293, 294, 295, + 296, -1, 298, -1, 300, 301, 302, 303, 304, -1, + -1, -1, -1, -1, -1, -1, -1, 40, 41, -1, + 43, -1, 45, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, + -1, -1, -1, 259, -1, -1, -1, 263, 264, -1, + -1, -1, 268, 269, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 280, -1, 282, 283, 284, -1, + 286, -1, -1, -1, -1, 291, 292, 293, 294, 295, + 296, -1, 298, -1, 300, 301, 302, 303, 304, 259, + -1, -1, -1, 263, 264, -1, -1, -1, 268, 269, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 280, -1, 282, 283, 284, -1, 286, -1, -1, -1, + -1, 291, 292, 293, 294, 295, 296, -1, 298, -1, + 300, 301, 302, 303, 304, -1, 259, -1, -1, -1, + 263, 264, -1, -1, -1, 268, 269, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 280, -1, 282, + 283, 284, -1, 286, -1, -1, -1, -1, 291, 292, + 293, 294, 295, 296, -1, 298, -1, 300, 301, 302, + 303, 304, 40, 41, -1, 43, -1, 45, -1, -1, + 259, -1, -1, -1, 263, 264, -1, -1, -1, 268, + 269, -1, 60, -1, 62, -1, -1, -1, -1, -1, + -1, 280, -1, 282, 283, 284, -1, 286, -1, -1, + -1, -1, 291, 292, 293, 294, 295, 296, -1, 298, + -1, 300, 301, 302, 303, 304, 259, -1, -1, -1, + 263, 264, -1, -1, -1, 268, 269, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 280, -1, 282, + 283, 284, -1, 286, -1, -1, -1, -1, 291, 292, + 293, 294, 295, 296, -1, 298, -1, 300, 301, 302, + 303, 304, 40, 41, -1, 43, -1, 45, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 60, -1, 62, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, + -1, 43, -1, 45, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, + 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 40, 41, -1, 43, -1, 45, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 60, -1, 62, -1, -1, -1, + -1, 259, -1, -1, -1, 263, 264, -1, -1, -1, + 268, 269, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 280, -1, 282, 283, 284, -1, 286, -1, + -1, -1, -1, 291, 292, 293, 294, 295, 296, -1, + 298, -1, 300, 301, 302, 303, 304, 40, 41, -1, + 43, -1, 45, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 40, 41, -1, 43, -1, 45, -1, + -1, 259, -1, -1, -1, 263, 264, -1, -1, -1, + 268, 269, -1, 60, -1, 62, -1, -1, -1, -1, + -1, -1, 280, -1, 282, 283, 284, -1, 286, -1, + -1, -1, -1, 291, 292, 293, 294, 295, 296, -1, + 298, -1, 300, 301, 302, 303, 304, 259, -1, -1, + -1, 263, 264, -1, -1, -1, 268, 269, 40, -1, + -1, 43, -1, 45, -1, -1, -1, -1, 280, -1, + 282, 283, 284, -1, 286, -1, -1, -1, -1, 291, + 292, 293, 294, 295, 296, -1, 298, -1, 300, 301, + 302, 303, 304, 259, -1, -1, -1, 263, 264, -1, + -1, -1, 268, 269, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 280, -1, 282, 283, 284, -1, + 286, -1, -1, -1, -1, 291, 292, 293, 294, 295, + 296, -1, 298, -1, 300, 301, 302, 303, 304, 40, + 41, 123, 43, -1, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, + -1, 62, -1, -1, -1, -1, 259, -1, -1, -1, + 263, 264, -1, -1, -1, 268, 269, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 280, -1, 282, + 283, 284, 40, 286, -1, 43, -1, 45, 291, 292, + 293, 294, 295, 296, -1, 298, -1, 300, 301, 302, + 303, 304, 259, -1, -1, -1, 263, 264, -1, -1, + -1, 268, 269, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 280, -1, 282, 283, 284, -1, 286, + -1, -1, -1, -1, 291, 292, 293, 294, 295, 296, + -1, 298, -1, 300, 301, 302, 303, 304, 40, 41, + -1, 43, -1, 45, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 257, 258, 259, 60, -1, + 62, 263, 264, -1, -1, -1, 268, 269, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 280, -1, + 282, 283, 284, 285, 286, -1, -1, -1, -1, 291, + 292, 293, 294, -1, -1, -1, 298, -1, 300, 301, + 302, 303, 304, 40, -1, -1, 43, -1, 45, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 60, -1, 62, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 259, -1, + -1, -1, 263, 264, -1, -1, -1, 268, 269, 40, + -1, -1, 43, -1, 45, -1, -1, -1, -1, 280, + -1, 282, 283, 284, -1, 286, -1, -1, 59, -1, + 291, 292, 293, 294, 295, 296, -1, 298, -1, 300, + 301, 302, 303, 304, -1, -1, -1, -1, -1, -1, + -1, 259, -1, -1, -1, 263, 264, -1, -1, 40, + 268, 269, 43, -1, 45, -1, -1, -1, -1, -1, + -1, -1, 280, -1, 282, 283, 284, -1, 286, -1, + -1, -1, -1, 291, 292, 293, 294, -1, -1, -1, + 298, -1, 300, 301, 302, 303, 304, -1, -1, -1, + -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, + 45, -1, -1, -1, -1, -1, -1, 259, -1, -1, + -1, 263, 264, -1, -1, -1, 268, 269, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 280, -1, + 282, 283, 284, -1, 286, -1, -1, -1, -1, 291, + 292, 293, 294, 295, 296, -1, 298, -1, 300, 301, + 302, 303, 304, 40, -1, -1, 43, -1, 45, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 259, -1, -1, -1, 263, 264, -1, -1, + -1, 268, 269, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 280, -1, 282, 283, 284, -1, 286, + -1, -1, -1, -1, 291, 292, 293, 294, 295, 296, + -1, 298, -1, 300, 301, 302, 303, 304, 259, -1, + -1, -1, 263, 264, -1, -1, -1, 268, 269, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 280, + -1, 282, 283, 284, -1, 286, -1, -1, -1, -1, + 291, 292, 293, 294, -1, -1, -1, 298, -1, 300, + 301, 302, 303, 304, -1, -1, -1, -1, 259, -1, + -1, -1, 263, 264, -1, -1, -1, 268, 269, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 280, + -1, 282, 283, 284, -1, 286, -1, -1, -1, -1, + 291, 292, 293, 294, -1, -1, -1, 298, -1, 300, + 301, 302, 303, 304, 259, -1, -1, -1, 263, 264, + -1, -1, -1, 268, 269, -1, -1, 47, 48, -1, + -1, -1, -1, -1, -1, 280, -1, 282, 283, 284, + -1, 286, -1, -1, -1, -1, 291, 292, 293, 294, + -1, -1, -1, 298, -1, 300, 301, 302, 303, 304, + 80, -1, 82, 83, -1, -1, -1, -1, -1, -1, + -1, -1, 259, -1, -1, -1, 263, 264, -1, -1, + -1, 268, 269, -1, -1, -1, -1, -1, 108, 109, + -1, -1, -1, 280, -1, 282, 283, 284, -1, 286, + -1, -1, -1, -1, 291, 292, 293, 294, -1, -1, + -1, 298, -1, 300, 301, 302, 303, 304, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, + 28, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, + 170, -1, -1, -1, -1, -1, 54, -1, -1, -1, + -1, 181, -1, 183, -1, 185, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 206, -1, -1, -1, + -1, -1, -1, 91, 92, 93, 94, 95, 96, -1, + -1, 221, 222, 223, 224, 225, 104, -1, 106, -1, + -1, -1, 110, 111, -1, -1, 114, -1, 116, 117, + -1, -1, -1, 121, 122, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 132, -1, -1, -1, -1, 137, + 138, 139, 140, -1, -1, -1, -1, -1, -1, 269, + -1, -1, -1, 273, 274, 275, -1, -1, -1, 279, + 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 304, 305, -1, -1, 186, -1, + 310, -1, -1, -1, -1, -1, -1, -1, -1, 197, + 198, -1, 200, 201, 202, 203, -1, 205, -1, 207, + 208, -1, -1, -1, -1, -1, -1, 215, 216, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 252, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 264, 265, 266, 267, + 268, -1, 270, 271, 272, +}; +#define YYFINAL 1 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 304 +#if YYDEBUG +char *yyname[] = { +"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,"'%'",0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0, +"':'","';'","'<'",0,"'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'p'",0,0,0,0,0,0,0, +0,0,0,"'{'","'|'","'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"BEGIN","END","REGEX","SEMINEW", +"NEWLINE","COMMENT","FUN1","FUNN","GRGR","PRINT","PRINTF","SPRINTF","SPLIT", +"IF","ELSE","WHILE","FOR","IN","EXIT","NEXT","BREAK","CONTINUE","RET","GETLINE", +"DO","SUB","GSUB","MATCH","FUNCTION","USERFUN","DELETE","ASGNOP","OROR", +"ANDAND","NUMBER","VAR","SUBSTR","INDEX","MATCHOP","RELOP","OR","STRING", +"UMINUS","NOT","INCR","DECR","FIELD","VFIELD", +}; +char *yyrule[] = { +"$accept : program", +"program : junk hunks", +"begin : BEGIN '{' maybe states '}' junk", +"end : END '{' maybe states '}'", +"end : end NEWLINE", +"hunks : hunks hunk junk", +"hunks :", +"hunk : patpat", +"hunk : patpat '{' maybe states '}'", +"hunk : FUNCTION USERFUN '(' arg_list ')' maybe '{' maybe states '}'", +"hunk : '{' maybe states '}'", +"hunk : begin", +"hunk : end", +"arg_list : expr_list", +"patpat : cond", +"patpat : cond ',' cond", +"cond : expr", +"cond : match", +"cond : rel", +"cond : compound_cond", +"cond : cond '?' expr ':' expr", +"compound_cond : '(' compound_cond ')'", +"compound_cond : cond ANDAND maybe cond", +"compound_cond : cond OROR maybe cond", +"compound_cond : NOT cond", +"rel : expr RELOP expr", +"rel : expr '>' expr", +"rel : expr '<' expr", +"rel : '(' rel ')'", +"match : expr MATCHOP expr", +"match : expr MATCHOP REGEX", +"match : REGEX", +"match : '(' match ')'", +"expr : term", +"expr : expr term", +"expr : variable ASGNOP cond", +"term : variable", +"term : NUMBER", +"term : STRING", +"term : term '+' term", +"term : term '-' term", +"term : term '*' term", +"term : term '/' term", +"term : term '%' term", +"term : term '^' term", +"term : term IN VAR", +"term : cond '?' expr ':' expr", +"term : variable INCR", +"term : variable DECR", +"term : INCR variable", +"term : DECR variable", +"term : '-' term", +"term : '+' term", +"term : '(' cond ')'", +"term : GETLINE", +"term : GETLINE variable", +"term : GETLINE '<' expr", +"term : GETLINE variable '<' expr", +"term : term 'p' GETLINE", +"term : term 'p' GETLINE variable", +"term : FUN1", +"term : FUN1 '(' ')'", +"term : FUN1 '(' expr ')'", +"term : FUNN '(' expr_list ')'", +"term : USERFUN '(' expr_list ')'", +"term : SPRINTF expr_list", +"term : SUBSTR '(' expr ',' expr ',' expr ')'", +"term : SUBSTR '(' expr ',' expr ')'", +"term : SPLIT '(' expr ',' VAR ',' expr ')'", +"term : SPLIT '(' expr ',' VAR ',' REGEX ')'", +"term : SPLIT '(' expr ',' VAR ')'", +"term : INDEX '(' expr ',' expr ')'", +"term : MATCH '(' expr ',' REGEX ')'", +"term : MATCH '(' expr ',' expr ')'", +"term : SUB '(' expr ',' expr ')'", +"term : SUB '(' REGEX ',' expr ')'", +"term : GSUB '(' expr ',' expr ')'", +"term : GSUB '(' REGEX ',' expr ')'", +"term : SUB '(' expr ',' expr ',' expr ')'", +"term : SUB '(' REGEX ',' expr ',' expr ')'", +"term : GSUB '(' expr ',' expr ',' expr ')'", +"term : GSUB '(' REGEX ',' expr ',' expr ')'", +"variable : VAR", +"variable : VAR '[' expr_list ']'", +"variable : FIELD", +"variable : VFIELD term", +"expr_list : expr", +"expr_list : clist", +"expr_list :", +"clist : expr ',' maybe expr", +"clist : clist ',' maybe expr", +"clist : '(' clist ')'", +"junk : junk hunksep", +"junk :", +"hunksep : ';'", +"hunksep : SEMINEW", +"hunksep : NEWLINE", +"hunksep : COMMENT", +"maybe : maybe nlstuff", +"maybe :", +"nlstuff : NEWLINE", +"nlstuff : COMMENT", +"separator : ';' maybe", +"separator : SEMINEW maybe", +"separator : NEWLINE maybe", +"separator : COMMENT maybe", +"states : states statement", +"states :", +"statement : simple separator maybe", +"statement : ';' maybe", +"statement : SEMINEW maybe", +"statement : compound", +"simpnull : simple", +"simpnull :", +"simple : expr", +"simple : PRINT expr_list redir expr", +"simple : PRINT expr_list", +"simple : PRINTF expr_list redir expr", +"simple : PRINTF expr_list", +"simple : BREAK", +"simple : NEXT", +"simple : EXIT", +"simple : EXIT expr", +"simple : CONTINUE", +"simple : RET", +"simple : RET expr", +"simple : DELETE VAR '[' expr_list ']'", +"redir : '>'", +"redir : GRGR", +"redir : '|'", +"compound : IF '(' cond ')' maybe statement", +"compound : IF '(' cond ')' maybe statement ELSE maybe statement", +"compound : WHILE '(' cond ')' maybe statement", +"compound : DO maybe statement WHILE '(' cond ')'", +"compound : FOR '(' simpnull ';' cond ';' simpnull ')' maybe statement", +"compound : FOR '(' simpnull ';' ';' simpnull ')' maybe statement", +"compound : FOR '(' expr ')' maybe statement", +"compound : '{' maybe states '}' maybe", +}; +#endif +#ifndef YYSTYPE +typedef int YYSTYPE; +#endif +#define yyclearin (yychar=(-1)) +#define yyerrok (yyerrflag=0) +#ifdef YYSTACKSIZE +#ifndef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#endif +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 500 +#define YYMAXDEPTH 500 +#endif +#endif +int yydebug; +int yynerrs; +int yyerrflag; +int yychar; +short *yyssp; +YYSTYPE *yyvsp; +YYSTYPE yyval; +YYSTYPE yylval; +short yyss[YYSTACKSIZE]; +YYSTYPE yyvs[YYSTACKSIZE]; +#define yystacksize YYSTACKSIZE +#line 396 "a2p.y" +#include "a2py.c" +#line 1945 "y.tab.c" +#define YYABORT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab +int +yyparse() +{ + register int yym, yyn, yystate; +#if YYDEBUG + register char *yys; + extern char *getenv(); + + if (yys = getenv("YYDEBUG")) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } +#endif + + yynerrs = 0; + yyerrflag = 0; + yychar = (-1); + + yyssp = yyss; + yyvsp = yyvs; + *yyssp = yystate = 0; + +yyloop: + if (yyn = yydefred[yystate]) goto yyreduce; + if (yychar < 0) + { + if ((yychar = yylex()) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("yydebug: state %d, reading %d (%s)\n", yystate, + yychar, yys); + } +#endif + } + if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + { +#if YYDEBUG + if (yydebug) + printf("yydebug: state %d, shifting to state %d\n", + yystate, yytable[yyn]); +#endif + if (yyssp >= yyss + yystacksize - 1) + { + goto yyoverflow; + } + *++yyssp = yystate = yytable[yyn]; + *++yyvsp = yylval; + yychar = (-1); + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag) goto yyinrecovery; +#ifdef lint + goto yynewerror; +#endif +yynewerror: + yyerror("syntax error"); +#ifdef lint + goto yyerrlab; +#endif +yyerrlab: + ++yynerrs; +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + { +#if YYDEBUG + if (yydebug) + printf("yydebug: state %d, error recovery shifting\ + to state %d\n", *yyssp, yytable[yyn]); +#endif + if (yyssp >= yyss + yystacksize - 1) + { + goto yyoverflow; + } + *++yyssp = yystate = yytable[yyn]; + *++yyvsp = yylval; + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + printf("yydebug: error recovery discarding state %d\n", + *yyssp); +#endif + if (yyssp <= yyss) goto yyabort; + --yyssp; + --yyvsp; + } + } + } + else + { + if (yychar == 0) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("yydebug: state %d, error recovery discards token %d (%s)\n", + yystate, yychar, yys); + } +#endif + yychar = (-1); + goto yyloop; + } +yyreduce: +#if YYDEBUG + if (yydebug) + printf("yydebug: state %d, reducing by rule %d (%s)\n", + yystate, yyn, yyrule[yyn]); +#endif + yym = yylen[yyn]; + yyval = yyvsp[1-yym]; + switch (yyn) + { +case 1: +#line 51 "a2p.y" +{ root = oper4(OPROG,yyvsp[-1],begins,yyvsp[0],ends); } +break; +case 2: +#line 55 "a2p.y" +{ begins = oper4(OJUNK,begins,yyvsp[-3],yyvsp[-2],yyvsp[0]); in_begin = FALSE; + yyval = Nullop; } +break; +case 3: +#line 60 "a2p.y" +{ ends = oper3(OJUNK,ends,yyvsp[-2],yyvsp[-1]); yyval = Nullop; } +break; +case 4: +#line 62 "a2p.y" +{ yyval = yyvsp[-1]; } +break; +case 5: +#line 66 "a2p.y" +{ yyval = oper3(OHUNKS,yyvsp[-2],yyvsp[-1],yyvsp[0]); } +break; +case 6: +#line 68 "a2p.y" +{ yyval = Nullop; } +break; +case 7: +#line 72 "a2p.y" +{ yyval = oper1(OHUNK,yyvsp[0]); need_entire = TRUE; } +break; +case 8: +#line 74 "a2p.y" +{ yyval = oper2(OHUNK,yyvsp[-4],oper2(OJUNK,yyvsp[-2],yyvsp[-1])); } +break; +case 9: +#line 76 "a2p.y" +{ fixfargs(yyvsp[-8],yyvsp[-6],0); yyval = oper5(OUSERDEF,yyvsp[-8],yyvsp[-6],yyvsp[-4],yyvsp[-2],yyvsp[-1]); } +break; +case 10: +#line 78 "a2p.y" +{ yyval = oper2(OHUNK,Nullop,oper2(OJUNK,yyvsp[-2],yyvsp[-1])); } +break; +case 13: +#line 84 "a2p.y" +{ yyval = rememberargs(yyval); } +break; +case 14: +#line 88 "a2p.y" +{ yyval = oper1(OPAT,yyvsp[0]); } +break; +case 15: +#line 90 "a2p.y" +{ yyval = oper2(ORANGE,yyvsp[-2],yyvsp[0]); } +break; +case 20: +#line 98 "a2p.y" +{ yyval = oper3(OCOND,yyvsp[-4],yyvsp[-2],yyvsp[0]); } +break; +case 21: +#line 103 "a2p.y" +{ yyval = oper1(OCPAREN,yyvsp[-1]); } +break; +case 22: +#line 105 "a2p.y" +{ yyval = oper3(OCANDAND,yyvsp[-3],yyvsp[-1],yyvsp[0]); } +break; +case 23: +#line 107 "a2p.y" +{ yyval = oper3(OCOROR,yyvsp[-3],yyvsp[-1],yyvsp[0]); } +break; +case 24: +#line 109 "a2p.y" +{ yyval = oper1(OCNOT,yyvsp[0]); } +break; +case 25: +#line 113 "a2p.y" +{ yyval = oper3(ORELOP,yyvsp[-1],yyvsp[-2],yyvsp[0]); } +break; +case 26: +#line 115 "a2p.y" +{ yyval = oper3(ORELOP,string(">",1),yyvsp[-2],yyvsp[0]); } +break; +case 27: +#line 117 "a2p.y" +{ yyval = oper3(ORELOP,string("<",1),yyvsp[-2],yyvsp[0]); } +break; +case 28: +#line 119 "a2p.y" +{ yyval = oper1(ORPAREN,yyvsp[-1]); } +break; +case 29: +#line 123 "a2p.y" +{ yyval = oper3(OMATCHOP,yyvsp[-1],yyvsp[-2],yyvsp[0]); } +break; +case 30: +#line 125 "a2p.y" +{ yyval = oper3(OMATCHOP,yyvsp[-1],yyvsp[-2],oper1(OREGEX,yyvsp[0])); } +break; +case 31: +#line 127 "a2p.y" +{ yyval = oper1(OREGEX,yyvsp[0]); } +break; +case 32: +#line 129 "a2p.y" +{ yyval = oper1(OMPAREN,yyvsp[-1]); } +break; +case 33: +#line 133 "a2p.y" +{ yyval = yyvsp[0]; } +break; +case 34: +#line 135 "a2p.y" +{ yyval = oper2(OCONCAT,yyvsp[-1],yyvsp[0]); } +break; +case 35: +#line 137 "a2p.y" +{ yyval = oper3(OASSIGN,yyvsp[-1],yyvsp[-2],yyvsp[0]); + if ((ops[yyvsp[-2]].ival & 255) == OFLD) + lval_field = TRUE; + if ((ops[yyvsp[-2]].ival & 255) == OVFLD) + lval_field = TRUE; + } +break; +case 36: +#line 146 "a2p.y" +{ yyval = yyvsp[0]; } +break; +case 37: +#line 148 "a2p.y" +{ yyval = oper1(ONUM,yyvsp[0]); } +break; +case 38: +#line 150 "a2p.y" +{ yyval = oper1(OSTR,yyvsp[0]); } +break; +case 39: +#line 152 "a2p.y" +{ yyval = oper2(OADD,yyvsp[-2],yyvsp[0]); } +break; +case 40: +#line 154 "a2p.y" +{ yyval = oper2(OSUBTRACT,yyvsp[-2],yyvsp[0]); } +break; +case 41: +#line 156 "a2p.y" +{ yyval = oper2(OMULT,yyvsp[-2],yyvsp[0]); } +break; +case 42: +#line 158 "a2p.y" +{ yyval = oper2(ODIV,yyvsp[-2],yyvsp[0]); } +break; +case 43: +#line 160 "a2p.y" +{ yyval = oper2(OMOD,yyvsp[-2],yyvsp[0]); } +break; +case 44: +#line 162 "a2p.y" +{ yyval = oper2(OPOW,yyvsp[-2],yyvsp[0]); } +break; +case 45: +#line 164 "a2p.y" +{ yyval = oper2(ODEFINED,aryrefarg(yyvsp[0]),yyvsp[-2]); } +break; +case 46: +#line 166 "a2p.y" +{ yyval = oper3(OCOND,yyvsp[-4],yyvsp[-2],yyvsp[0]); } +break; +case 47: +#line 168 "a2p.y" +{ yyval = oper1(OPOSTINCR,yyvsp[-1]); } +break; +case 48: +#line 170 "a2p.y" +{ yyval = oper1(OPOSTDECR,yyvsp[-1]); } +break; +case 49: +#line 172 "a2p.y" +{ yyval = oper1(OPREINCR,yyvsp[0]); } +break; +case 50: +#line 174 "a2p.y" +{ yyval = oper1(OPREDECR,yyvsp[0]); } +break; +case 51: +#line 176 "a2p.y" +{ yyval = oper1(OUMINUS,yyvsp[0]); } +break; +case 52: +#line 178 "a2p.y" +{ yyval = oper1(OUPLUS,yyvsp[0]); } +break; +case 53: +#line 180 "a2p.y" +{ yyval = oper1(OPAREN,yyvsp[-1]); } +break; +case 54: +#line 182 "a2p.y" +{ yyval = oper0(OGETLINE); } +break; +case 55: +#line 184 "a2p.y" +{ yyval = oper1(OGETLINE,yyvsp[0]); } +break; +case 56: +#line 186 "a2p.y" +{ yyval = oper3(OGETLINE,Nullop,string("<",1),yyvsp[0]); + if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } +break; +case 57: +#line 189 "a2p.y" +{ yyval = oper3(OGETLINE,yyvsp[-2],string("<",1),yyvsp[0]); + if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } +break; +case 58: +#line 192 "a2p.y" +{ yyval = oper3(OGETLINE,Nullop,string("|",1),yyvsp[-2]); + if (ops[yyvsp[-2]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } +break; +case 59: +#line 195 "a2p.y" +{ yyval = oper3(OGETLINE,yyvsp[0],string("|",1),yyvsp[-3]); + if (ops[yyvsp[-3]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } +break; +case 60: +#line 198 "a2p.y" +{ yyval = oper0(yyvsp[0]); need_entire = do_chop = TRUE; } +break; +case 61: +#line 200 "a2p.y" +{ yyval = oper1(yyvsp[-2],Nullop); need_entire = do_chop = TRUE; } +break; +case 62: +#line 202 "a2p.y" +{ yyval = oper1(yyvsp[-3],yyvsp[-1]); } +break; +case 63: +#line 204 "a2p.y" +{ yyval = oper1(yyvsp[-3],yyvsp[-1]); } +break; +case 64: +#line 206 "a2p.y" +{ yyval = oper2(OUSERFUN,yyvsp[-3],yyvsp[-1]); } +break; +case 65: +#line 208 "a2p.y" +{ yyval = oper1(OSPRINTF,yyvsp[0]); } +break; +case 66: +#line 210 "a2p.y" +{ yyval = oper3(OSUBSTR,yyvsp[-5],yyvsp[-3],yyvsp[-1]); } +break; +case 67: +#line 212 "a2p.y" +{ yyval = oper2(OSUBSTR,yyvsp[-3],yyvsp[-1]); } +break; +case 68: +#line 214 "a2p.y" +{ yyval = oper3(OSPLIT,yyvsp[-5],aryrefarg(numary(yyvsp[-3])),yyvsp[-1]); } +break; +case 69: +#line 216 "a2p.y" +{ yyval = oper3(OSPLIT,yyvsp[-5],aryrefarg(numary(yyvsp[-3])),oper1(OREGEX,yyvsp[-1]));} +break; +case 70: +#line 218 "a2p.y" +{ yyval = oper2(OSPLIT,yyvsp[-3],aryrefarg(numary(yyvsp[-1]))); } +break; +case 71: +#line 220 "a2p.y" +{ yyval = oper2(OINDEX,yyvsp[-3],yyvsp[-1]); } +break; +case 72: +#line 222 "a2p.y" +{ yyval = oper2(OMATCH,yyvsp[-3],oper1(OREGEX,yyvsp[-1])); } +break; +case 73: +#line 224 "a2p.y" +{ yyval = oper2(OMATCH,yyvsp[-3],yyvsp[-1]); } +break; +case 74: +#line 226 "a2p.y" +{ yyval = oper2(OSUB,yyvsp[-3],yyvsp[-1]); } +break; +case 75: +#line 228 "a2p.y" +{ yyval = oper2(OSUB,oper1(OREGEX,yyvsp[-3]),yyvsp[-1]); } +break; +case 76: +#line 230 "a2p.y" +{ yyval = oper2(OGSUB,yyvsp[-3],yyvsp[-1]); } +break; +case 77: +#line 232 "a2p.y" +{ yyval = oper2(OGSUB,oper1(OREGEX,yyvsp[-3]),yyvsp[-1]); } +break; +case 78: +#line 234 "a2p.y" +{ yyval = oper3(OSUB,yyvsp[-5],yyvsp[-3],yyvsp[-1]); } +break; +case 79: +#line 236 "a2p.y" +{ yyval = oper3(OSUB,oper1(OREGEX,yyvsp[-5]),yyvsp[-3],yyvsp[-1]); } +break; +case 80: +#line 238 "a2p.y" +{ yyval = oper3(OGSUB,yyvsp[-5],yyvsp[-3],yyvsp[-1]); } +break; +case 81: +#line 240 "a2p.y" +{ yyval = oper3(OGSUB,oper1(OREGEX,yyvsp[-5]),yyvsp[-3],yyvsp[-1]); } +break; +case 82: +#line 244 "a2p.y" +{ yyval = oper1(OVAR,yyvsp[0]); } +break; +case 83: +#line 246 "a2p.y" +{ yyval = oper2(OVAR,aryrefarg(yyvsp[-3]),yyvsp[-1]); } +break; +case 84: +#line 248 "a2p.y" +{ yyval = oper1(OFLD,yyvsp[0]); } +break; +case 85: +#line 250 "a2p.y" +{ yyval = oper1(OVFLD,yyvsp[0]); } +break; +case 88: +#line 257 "a2p.y" +{ yyval = Nullop; } +break; +case 89: +#line 261 "a2p.y" +{ yyval = oper3(OCOMMA,yyvsp[-3],yyvsp[-1],yyvsp[0]); } +break; +case 90: +#line 263 "a2p.y" +{ yyval = oper3(OCOMMA,yyvsp[-3],yyvsp[-1],yyvsp[0]); } +break; +case 91: +#line 265 "a2p.y" +{ yyval = yyvsp[-1]; } +break; +case 92: +#line 269 "a2p.y" +{ yyval = oper2(OJUNK,yyvsp[-1],yyvsp[0]); } +break; +case 93: +#line 271 "a2p.y" +{ yyval = Nullop; } +break; +case 94: +#line 275 "a2p.y" +{ yyval = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); } +break; +case 95: +#line 277 "a2p.y" +{ yyval = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); } +break; +case 96: +#line 279 "a2p.y" +{ yyval = oper0(ONEWLINE); } +break; +case 97: +#line 281 "a2p.y" +{ yyval = oper1(OCOMMENT,yyvsp[0]); } +break; +case 98: +#line 285 "a2p.y" +{ yyval = oper2(OJUNK,yyvsp[-1],yyvsp[0]); } +break; +case 99: +#line 287 "a2p.y" +{ yyval = Nullop; } +break; +case 100: +#line 291 "a2p.y" +{ yyval = oper0(ONEWLINE); } +break; +case 101: +#line 293 "a2p.y" +{ yyval = oper1(OCOMMENT,yyvsp[0]); } +break; +case 102: +#line 298 "a2p.y" +{ yyval = oper2(OJUNK,oper0(OSEMICOLON),yyvsp[0]); } +break; +case 103: +#line 300 "a2p.y" +{ yyval = oper2(OJUNK,oper0(OSNEWLINE),yyvsp[0]); } +break; +case 104: +#line 302 "a2p.y" +{ yyval = oper2(OJUNK,oper0(OSNEWLINE),yyvsp[0]); } +break; +case 105: +#line 304 "a2p.y" +{ yyval = oper2(OJUNK,oper1(OSCOMMENT,yyvsp[-1]),yyvsp[0]); } +break; +case 106: +#line 308 "a2p.y" +{ yyval = oper2(OSTATES,yyvsp[-1],yyvsp[0]); } +break; +case 107: +#line 310 "a2p.y" +{ yyval = Nullop; } +break; +case 108: +#line 315 "a2p.y" +{ yyval = oper2(OJUNK,oper2(OSTATE,yyvsp[-2],yyvsp[-1]),yyvsp[0]); } +break; +case 109: +#line 317 "a2p.y" +{ yyval = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSEMICOLON),yyvsp[0])); } +break; +case 110: +#line 319 "a2p.y" +{ yyval = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSNEWLINE),yyvsp[0])); } +break; +case 113: +#line 325 "a2p.y" +{ yyval = Nullop; } +break; +case 115: +#line 331 "a2p.y" +{ yyval = oper3(OPRINT,yyvsp[-2],yyvsp[-1],yyvsp[0]); + do_opens = TRUE; + saw_ORS = saw_OFS = TRUE; + if (!yyvsp[-2]) need_entire = TRUE; + if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } +break; +case 116: +#line 337 "a2p.y" +{ yyval = oper1(OPRINT,yyvsp[0]); + if (!yyvsp[0]) need_entire = TRUE; + saw_ORS = saw_OFS = TRUE; + } +break; +case 117: +#line 342 "a2p.y" +{ yyval = oper3(OPRINTF,yyvsp[-2],yyvsp[-1],yyvsp[0]); + do_opens = TRUE; + if (!yyvsp[-2]) need_entire = TRUE; + if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } +break; +case 118: +#line 347 "a2p.y" +{ yyval = oper1(OPRINTF,yyvsp[0]); + if (!yyvsp[0]) need_entire = TRUE; + } +break; +case 119: +#line 351 "a2p.y" +{ yyval = oper0(OBREAK); } +break; +case 120: +#line 353 "a2p.y" +{ yyval = oper0(ONEXT); } +break; +case 121: +#line 355 "a2p.y" +{ yyval = oper0(OEXIT); } +break; +case 122: +#line 357 "a2p.y" +{ yyval = oper1(OEXIT,yyvsp[0]); } +break; +case 123: +#line 359 "a2p.y" +{ yyval = oper0(OCONTINUE); } +break; +case 124: +#line 361 "a2p.y" +{ yyval = oper0(ORETURN); } +break; +case 125: +#line 363 "a2p.y" +{ yyval = oper1(ORETURN,yyvsp[0]); } +break; +case 126: +#line 365 "a2p.y" +{ yyval = oper2(ODELETE,aryrefarg(yyvsp[-3]),yyvsp[-1]); } +break; +case 127: +#line 369 "a2p.y" +{ yyval = oper1(OREDIR,string(">",1)); } +break; +case 128: +#line 371 "a2p.y" +{ yyval = oper1(OREDIR,string(">>",2)); } +break; +case 129: +#line 373 "a2p.y" +{ yyval = oper1(OREDIR,string("|",1)); } +break; +case 130: +#line 378 "a2p.y" +{ yyval = oper2(OIF,yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); } +break; +case 131: +#line 380 "a2p.y" +{ yyval = oper3(OIF,yyvsp[-6],bl(yyvsp[-3],yyvsp[-4]),bl(yyvsp[0],yyvsp[-1])); } +break; +case 132: +#line 382 "a2p.y" +{ yyval = oper2(OWHILE,yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); } +break; +case 133: +#line 384 "a2p.y" +{ yyval = oper2(ODO,bl(yyvsp[-4],yyvsp[-5]),yyvsp[-1]); } +break; +case 134: +#line 386 "a2p.y" +{ yyval = oper4(OFOR,yyvsp[-7],yyvsp[-5],yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); } +break; +case 135: +#line 388 "a2p.y" +{ yyval = oper4(OFOR,yyvsp[-6],string("",0),yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); } +break; +case 136: +#line 390 "a2p.y" +{ yyval = oper2(OFORIN,yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); } +break; +case 137: +#line 392 "a2p.y" +{ yyval = oper3(OBLOCK,oper2(OJUNK,yyvsp[-3],yyvsp[-2]),Nullop,yyvsp[0]); } +break; +#line 2611 "y.tab.c" + } + yyssp -= yym; + yystate = *yyssp; + yyvsp -= yym; + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + printf("yydebug: after reduction, shifting from state 0 to\ + state %d\n", YYFINAL); +#endif + yystate = YYFINAL; + *++yyssp = YYFINAL; + *++yyvsp = yyval; + if (yychar < 0) + { + if ((yychar = yylex()) < 0) yychar = 0; +#if YYDEBUG + if (yydebug) + { + yys = 0; + if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; + if (!yys) yys = "illegal-symbol"; + printf("yydebug: state %d, reading %d (%s)\n", + YYFINAL, yychar, yys); + } +#endif + } + if (yychar == 0) goto yyaccept; + goto yyloop; + } + if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + printf("yydebug: after reduction, shifting from state %d \ +to state %d\n", *yyssp, yystate); +#endif + if (yyssp >= yyss + yystacksize - 1) + { + goto yyoverflow; + } + *++yyssp = yystate; + *++yyvsp = yyval; + goto yyloop; +yyoverflow: + yyerror("yacc stack overflow"); +yyabort: + return (1); +yyaccept: + return (0); +} diff --git a/gnu/usr.bin/perl/x2p/a2p.h b/gnu/usr.bin/perl/x2p/a2p.h new file mode 100644 index 00000000000..77d55ced7a2 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/a2p.h @@ -0,0 +1,426 @@ +/* $RCSfile: a2p.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:09 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: a2p.h,v $ + */ + +#include "../embed.h" +#define VOIDUSED 1 +#include "../config.h" + +#if defined(__STDC__) || defined(vax11c) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus) +# define STANDARD_C 1 +#endif + +/* Use all the "standard" definitions? */ +#if defined(STANDARD_C) && defined(I_STDLIB) +# include <stdlib.h> +#endif /* STANDARD_C */ + +#include <stdio.h> + +#ifdef I_MATH +#include <math.h> +#endif + +#ifdef I_SYS_TYPES +# include <sys/types.h> +#endif + + +#ifdef USE_NEXT_CTYPE +#include <appkit/NXCType.h> +#else +#include <ctype.h> +#endif + +#define MEM_SIZE Size_t + +#if defined(I_STRING) || defined(__cplusplus) +# include <string.h> +#else +# include <strings.h> +#endif + +#ifndef HAS_BCOPY +# define bcopy(s1,s2,l) memcpy(s2,s1,l) +#endif +#ifndef HAS_BZERO +# define bzero(s,l) memset(s,0,l) +#endif + +#if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr) +#define strchr index +#define strrchr rindex +#endif + + +#ifdef I_TIME +# include <time.h> +#endif + +#ifdef I_SYS_TIME +# ifdef I_SYS_TIME_KERNEL +# define KERNEL +# endif +# include <sys/time.h> +# ifdef I_SYS_TIME_KERNEL +# undef KERNEL +# endif +#endif + +#ifndef MSDOS +# if defined(HAS_TIMES) && defined(I_SYS_TIMES) +# include <sys/times.h> +# endif +#endif + +#ifdef DOSISH +# if defined(OS2) +# include "../os2ish.h" +# else +# include "../dosish.h" +# endif +#else +# if defined(VMS) +# include "../vmsish.h" +# endif +#endif + +#ifndef STANDARD_C +/* All of these are in stdlib.h or time.h for ANSI C */ +Time_t time(); +struct tm *gmtime(), *localtime(); +char *strchr(), *strrchr(); +char *strcpy(), *strcat(); +#endif /* ! STANDARD_C */ + +#include "handy.h" +#define Nullop 0 + +#define OPROG 1 +#define OJUNK 2 +#define OHUNKS 3 +#define ORANGE 4 +#define OPAT 5 +#define OHUNK 6 +#define OPPAREN 7 +#define OPANDAND 8 +#define OPOROR 9 +#define OPNOT 10 +#define OCPAREN 11 +#define OCANDAND 12 +#define OCOROR 13 +#define OCNOT 14 +#define ORELOP 15 +#define ORPAREN 16 +#define OMATCHOP 17 +#define OMPAREN 18 +#define OCONCAT 19 +#define OASSIGN 20 +#define OADD 21 +#define OSUBTRACT 22 +#define OMULT 23 +#define ODIV 24 +#define OMOD 25 +#define OPOSTINCR 26 +#define OPOSTDECR 27 +#define OPREINCR 28 +#define OPREDECR 29 +#define OUMINUS 30 +#define OUPLUS 31 +#define OPAREN 32 +#define OGETLINE 33 +#define OSPRINTF 34 +#define OSUBSTR 35 +#define OSTRING 36 +#define OSPLIT 37 +#define OSNEWLINE 38 +#define OINDEX 39 +#define ONUM 40 +#define OSTR 41 +#define OVAR 42 +#define OFLD 43 +#define ONEWLINE 44 +#define OCOMMENT 45 +#define OCOMMA 46 +#define OSEMICOLON 47 +#define OSCOMMENT 48 +#define OSTATES 49 +#define OSTATE 50 +#define OPRINT 51 +#define OPRINTF 52 +#define OBREAK 53 +#define ONEXT 54 +#define OEXIT 55 +#define OCONTINUE 56 +#define OREDIR 57 +#define OIF 58 +#define OWHILE 59 +#define OFOR 60 +#define OFORIN 61 +#define OVFLD 62 +#define OBLOCK 63 +#define OREGEX 64 +#define OLENGTH 65 +#define OLOG 66 +#define OEXP 67 +#define OSQRT 68 +#define OINT 69 +#define ODO 70 +#define OPOW 71 +#define OSUB 72 +#define OGSUB 73 +#define OMATCH 74 +#define OUSERFUN 75 +#define OUSERDEF 76 +#define OCLOSE 77 +#define OATAN2 78 +#define OSIN 79 +#define OCOS 80 +#define ORAND 81 +#define OSRAND 82 +#define ODELETE 83 +#define OSYSTEM 84 +#define OCOND 85 +#define ORETURN 86 +#define ODEFINED 87 +#define OSTAR 88 + +#ifdef DOINIT +char *opname[] = { + "0", + "PROG", + "JUNK", + "HUNKS", + "RANGE", + "PAT", + "HUNK", + "PPAREN", + "PANDAND", + "POROR", + "PNOT", + "CPAREN", + "CANDAND", + "COROR", + "CNOT", + "RELOP", + "RPAREN", + "MATCHOP", + "MPAREN", + "CONCAT", + "ASSIGN", + "ADD", + "SUBTRACT", + "MULT", + "DIV", + "MOD", + "POSTINCR", + "POSTDECR", + "PREINCR", + "PREDECR", + "UMINUS", + "UPLUS", + "PAREN", + "GETLINE", + "SPRINTF", + "SUBSTR", + "STRING", + "SPLIT", + "SNEWLINE", + "INDEX", + "NUM", + "STR", + "VAR", + "FLD", + "NEWLINE", + "COMMENT", + "COMMA", + "SEMICOLON", + "SCOMMENT", + "STATES", + "STATE", + "PRINT", + "PRINTF", + "BREAK", + "NEXT", + "EXIT", + "CONTINUE", + "REDIR", + "IF", + "WHILE", + "FOR", + "FORIN", + "VFLD", + "BLOCK", + "REGEX", + "LENGTH", + "LOG", + "EXP", + "SQRT", + "INT", + "DO", + "POW", + "SUB", + "GSUB", + "MATCH", + "USERFUN", + "USERDEF", + "CLOSE", + "ATAN2", + "SIN", + "COS", + "RAND", + "SRAND", + "DELETE", + "SYSTEM", + "COND", + "RETURN", + "DEFINED", + "STAR", + "89" +}; +#else +extern char *opname[]; +#endif + +EXT int mop INIT(1); + +union u_ops { + int ival; + char *cval; +}; +#if defined(iAPX286) || defined(M_I286) || defined(I80286) /* 80286 hack */ +#define OPSMAX (64000/sizeof(union u_ops)) /* approx. max segment size */ +#else +#define OPSMAX 50000 +#endif /* 80286 hack */ +EXT union u_ops ops[OPSMAX]; + +typedef struct string STR; +typedef struct htbl HASH; + +#include "str.h" +#include "hash.h" + + +/* A string is TRUE if not "" or "0". */ +#define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1]))) +EXT char *Yes INIT("1"); +EXT char *No INIT(""); + +#define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 ))) + +#define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%g)",Str->str_nval),buf) : "" ))) +#define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) +#define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str))) +EXT STR *Str; + +#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len) + +/* Prototypes for things in a2p.c */ +int aryrefarg _(( int arg )); +int bl _(( int arg, int maybe )); +void dump _(( int branch )); +int fixfargs _(( int name, int arg, int prevargs )); +int fixrargs _(( char *name, int arg, int prevargs )); +void fixup _(( STR *str )); +int numary _(( int arg )); +int oper0 _(( int type )); +int oper1 _(( int type, int arg1 )); +int oper2 _(( int type, int arg1, int arg2 )); +int oper3 _(( int type, int arg1, int arg2, int arg3 )); +int oper4 _(( int type, int arg1, int arg2, int arg3, int arg4 )); +int oper5 _(( int type, int arg1, int arg2, int arg3, int arg4, int arg5 )); +void putlines _(( STR *str )); +void putone _(( void )); +int rememberargs _(( int arg )); +char * scannum _(( char *s )); +char * scanpat _(( char *s )); +int string _(( char *ptr, int len )); +void yyerror _(( char *s )); +int yylex _(( void )); + +EXT int line INIT(0); + +EXT FILE *rsfp; +EXT char buf[2048]; +EXT char *bufptr INIT(buf); + +EXT STR *linestr INIT(Nullstr); + +EXT char tokenbuf[2048]; +EXT int expectterm INIT(TRUE); + +#ifdef DEBUGGING +EXT int debug INIT(0); +EXT int dlevel INIT(0); +#define YYDEBUG 1 +extern int yydebug; +#endif + +EXT STR *freestrroot INIT(Nullstr); + +EXT STR str_no; +EXT STR str_yes; + +EXT bool do_split INIT(FALSE); +EXT bool split_to_array INIT(FALSE); +EXT bool set_array_base INIT(FALSE); +EXT bool saw_RS INIT(FALSE); +EXT bool saw_OFS INIT(FALSE); +EXT bool saw_ORS INIT(FALSE); +EXT bool saw_line_op INIT(FALSE); +EXT bool in_begin INIT(TRUE); +EXT bool do_opens INIT(FALSE); +EXT bool do_fancy_opens INIT(FALSE); +EXT bool lval_field INIT(FALSE); +EXT bool do_chop INIT(FALSE); +EXT bool need_entire INIT(FALSE); +EXT bool absmaxfld INIT(FALSE); +EXT bool saw_altinput INIT(FALSE); + +EXT bool nomemok INIT(FALSE); + +EXT char const_FS INIT(0); +EXT char *namelist INIT(Nullch); +EXT char fswitch INIT(0); + +EXT int saw_FS INIT(0); +EXT int maxfld INIT(0); +EXT int arymax INIT(0); +EXT char *nameary[100]; + +EXT STR *opens; + +EXT HASH *symtab; +EXT HASH *curarghash; + +#define P_MIN 0 +#define P_LISTOP 5 +#define P_COMMA 10 +#define P_ASSIGN 15 +#define P_COND 20 +#define P_DOTDOT 25 +#define P_OROR 30 +#define P_ANDAND 35 +#define P_OR 40 +#define P_AND 45 +#define P_EQ 50 +#define P_REL 55 +#define P_UNI 60 +#define P_FILETEST 65 +#define P_SHIFT 70 +#define P_ADD 75 +#define P_MUL 80 +#define P_MATCH 85 +#define P_UNARY 90 +#define P_POW 95 +#define P_AUTO 100 +#define P_MAX 999 + +EXT int an; diff --git a/gnu/usr.bin/perl/x2p/a2p.man b/gnu/usr.bin/perl/x2p/a2p.man new file mode 100644 index 00000000000..66d8d7b1b99 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/a2p.man @@ -0,0 +1,186 @@ +.rn '' }` +''' $RCSfile: a2p.man,v $$Revision: 1.1 $$Date: 1996/08/19 10:13:34 $ +''' +''' $Log: a2p.man,v $ +''' Revision 1.1 1996/08/19 10:13:34 downsj +''' Initial revision +''' +.de Sh +.br +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp +.if t .sp .5v +.if n .sp +.. +.de Ip +.br +.ie \\n.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +''' +''' Set up \*(-- to give an unbreakable dash; +''' string Tr holds user defined translation string. +''' Bell System Logo is used as a dummy character. +''' +.tr \(*W-|\(bv\*(Tr +.ie n \{\ +.ds -- \(*W- +.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +.ds L" "" +.ds R" "" +.ds L' ' +.ds R' ' +'br\} +.el\{\ +.ds -- \(em\| +.tr \*(Tr +.ds L" `` +.ds R" '' +.ds L' ` +.ds R' ' +'br\} +.TH A2P 1 LOCAL +.SH NAME +a2p - Awk to Perl translator +.SH SYNOPSIS +.B a2p [options] filename +.SH DESCRIPTION +.I A2p +takes an awk script specified on the command line (or from standard input) +and produces a comparable +.I perl +script on the standard output. +.Sh "Options" +Options include: +.TP 5 +.B \-D<number> +sets debugging flags. +.TP 5 +.B \-F<character> +tells a2p that this awk script is always invoked with this -F switch. +.TP 5 +.B \-n<fieldlist> +specifies the names of the input fields if input does not have to be split into +an array. +If you were translating an awk script that processes the password file, you +might say: +.sp + a2p -7 -nlogin.password.uid.gid.gcos.shell.home +.sp +Any delimiter can be used to separate the field names. +.TP 5 +.B \-<number> +causes a2p to assume that input will always have that many fields. +.Sh "Considerations" +A2p cannot do as good a job translating as a human would, but it usually +does pretty well. +There are some areas where you may want to examine the perl script produced +and tweak it some. +Here are some of them, in no particular order. +.PP +There is an awk idiom of putting int() around a string expression to force +numeric interpretation, even though the argument is always integer anyway. +This is generally unneeded in perl, but a2p can't tell if the argument +is always going to be integer, so it leaves it in. +You may wish to remove it. +.PP +Perl differentiates numeric comparison from string comparison. +Awk has one operator for both that decides at run time which comparison +to do. +A2p does not try to do a complete job of awk emulation at this point. +Instead it guesses which one you want. +It's almost always right, but it can be spoofed. +All such guesses are marked with the comment \*(L"#???\*(R". +You should go through and check them. +You might want to run at least once with the \-w switch to perl, which +will warn you if you use == where you should have used eq. +.PP +Perl does not attempt to emulate the behavior of awk in which nonexistent +array elements spring into existence simply by being referenced. +If somehow you are relying on this mechanism to create null entries for +a subsequent for...in, they won't be there in perl. +.PP +If a2p makes a split line that assigns to a list of variables that looks +like (Fld1, Fld2, Fld3...) you may want +to rerun a2p using the \-n option mentioned above. +This will let you name the fields throughout the script. +If it splits to an array instead, the script is probably referring to the number +of fields somewhere. +.PP +The exit statement in awk doesn't necessarily exit; it goes to the END +block if there is one. +Awk scripts that do contortions within the END block to bypass the block under +such circumstances can be simplified by removing the conditional +in the END block and just exiting directly from the perl script. +.PP +Perl has two kinds of array, numerically-indexed and associative. +Awk arrays are usually translated to associative arrays, but if you happen +to know that the index is always going to be numeric you could change +the {...} to [...]. +Iteration over an associative array is done using the keys() function, but +iteration over a numeric array is NOT. +You might need to modify any loop that is iterating over the array in question. +.PP +Awk starts by assuming OFMT has the value %.6g. +Perl starts by assuming its equivalent, $#, to have the value %.20g. +You'll want to set $# explicitly if you use the default value of OFMT. +.PP +Near the top of the line loop will be the split operation that is implicit in +the awk script. +There are times when you can move this down past some conditionals that +test the entire record so that the split is not done as often. +.PP +For aesthetic reasons you may wish to change the array base $[ from 1 back +to perl's default of 0, but remember to change all array subscripts AND +all substr() and index() operations to match. +.PP +Cute comments that say "# Here is a workaround because awk is dumb" are passed +through unmodified. +.PP +Awk scripts are often embedded in a shell script that pipes stuff into and +out of awk. +Often the shell script wrapper can be incorporated into the perl script, since +perl can start up pipes into and out of itself, and can do other things that +awk can't do by itself. +.PP +Scripts that refer to the special variables RSTART and RLENGTH can often +be simplified by referring to the variables $`, $& and $', as long as they +are within the scope of the pattern match that sets them. +.PP +The produced perl script may have subroutines defined to deal with awk's +semantics regarding getline and print. +Since a2p usually picks correctness over efficiency. +it is almost always possible to rewrite such code to be more efficient by +discarding the semantic sugar. +.PP +For efficiency, you may wish to remove the keyword from any return statement +that is the last statement executed in a subroutine. +A2p catches the most common case, but doesn't analyze embedded blocks for +subtler cases. +.PP +ARGV[0] translates to $ARGV0, but ARGV[n] translates to $ARGV[$n]. +A loop that tries to iterate over ARGV[0] won't find it. +.SH ENVIRONMENT +A2p uses no environment variables. +.SH AUTHOR +Larry Wall <lwall@jpl-devvax.Jpl.Nasa.Gov> +.SH FILES +.SH SEE ALSO +perl The perl compiler/interpreter +.br +s2p sed to perl translator +.SH DIAGNOSTICS +.SH BUGS +It would be possible to emulate awk's behavior in selecting string versus +numeric operations at run time by inspection of the operands, but it would +be gross and inefficient. +Besides, a2p almost always guesses right. +.PP +Storage for the awk syntax tree is currently static, and can run out. +.rn }` '' diff --git a/gnu/usr.bin/perl/x2p/a2p.y b/gnu/usr.bin/perl/x2p/a2p.y new file mode 100644 index 00000000000..961e2f280f0 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/a2p.y @@ -0,0 +1,396 @@ +%{ +/* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: a2p.y,v $ + */ + +#include "INTERN.h" +#include "a2p.h" + +int root; +int begins = Nullop; +int ends = Nullop; + +%} +%token BEGIN END +%token REGEX +%token SEMINEW NEWLINE COMMENT +%token FUN1 FUNN GRGR +%token PRINT PRINTF SPRINTF SPLIT +%token IF ELSE WHILE FOR IN +%token EXIT NEXT BREAK CONTINUE RET +%token GETLINE DO SUB GSUB MATCH +%token FUNCTION USERFUN DELETE + +%right ASGNOP +%right '?' ':' +%left OROR +%left ANDAND +%left IN +%left NUMBER VAR SUBSTR INDEX +%left MATCHOP +%left RELOP '<' '>' +%left OR +%left STRING +%left '+' '-' +%left '*' '/' '%' +%right UMINUS +%left NOT +%right '^' +%left INCR DECR +%left FIELD VFIELD + +%% + +program : junk hunks + { root = oper4(OPROG,$1,begins,$2,ends); } + ; + +begin : BEGIN '{' maybe states '}' junk + { begins = oper4(OJUNK,begins,$3,$4,$6); in_begin = FALSE; + $$ = Nullop; } + ; + +end : END '{' maybe states '}' + { ends = oper3(OJUNK,ends,$3,$4); $$ = Nullop; } + | end NEWLINE + { $$ = $1; } + ; + +hunks : hunks hunk junk + { $$ = oper3(OHUNKS,$1,$2,$3); } + | /* NULL */ + { $$ = Nullop; } + ; + +hunk : patpat + { $$ = oper1(OHUNK,$1); need_entire = TRUE; } + | patpat '{' maybe states '}' + { $$ = oper2(OHUNK,$1,oper2(OJUNK,$3,$4)); } + | FUNCTION USERFUN '(' arg_list ')' maybe '{' maybe states '}' + { fixfargs($2,$4,0); $$ = oper5(OUSERDEF,$2,$4,$6,$8,$9); } + | '{' maybe states '}' + { $$ = oper2(OHUNK,Nullop,oper2(OJUNK,$2,$3)); } + | begin + | end + ; + +arg_list: expr_list + { $$ = rememberargs($$); } + ; + +patpat : cond + { $$ = oper1(OPAT,$1); } + | cond ',' cond + { $$ = oper2(ORANGE,$1,$3); } + ; + +cond : expr + | match + | rel + | compound_cond + | cond '?' expr ':' expr + { $$ = oper3(OCOND,$1,$3,$5); } + ; + +compound_cond + : '(' compound_cond ')' + { $$ = oper1(OCPAREN,$2); } + | cond ANDAND maybe cond + { $$ = oper3(OCANDAND,$1,$3,$4); } + | cond OROR maybe cond + { $$ = oper3(OCOROR,$1,$3,$4); } + | NOT cond + { $$ = oper1(OCNOT,$2); } + ; + +rel : expr RELOP expr + { $$ = oper3(ORELOP,$2,$1,$3); } + | expr '>' expr + { $$ = oper3(ORELOP,string(">",1),$1,$3); } + | expr '<' expr + { $$ = oper3(ORELOP,string("<",1),$1,$3); } + | '(' rel ')' + { $$ = oper1(ORPAREN,$2); } + ; + +match : expr MATCHOP expr + { $$ = oper3(OMATCHOP,$2,$1,$3); } + | expr MATCHOP REGEX + { $$ = oper3(OMATCHOP,$2,$1,oper1(OREGEX,$3)); } + | REGEX %prec MATCHOP + { $$ = oper1(OREGEX,$1); } + | '(' match ')' + { $$ = oper1(OMPAREN,$2); } + ; + +expr : term + { $$ = $1; } + | expr term + { $$ = oper2(OCONCAT,$1,$2); } + | variable ASGNOP cond + { $$ = oper3(OASSIGN,$2,$1,$3); + if ((ops[$1].ival & 255) == OFLD) + lval_field = TRUE; + if ((ops[$1].ival & 255) == OVFLD) + lval_field = TRUE; + } + ; + +term : variable + { $$ = $1; } + | NUMBER + { $$ = oper1(ONUM,$1); } + | STRING + { $$ = oper1(OSTR,$1); } + | term '+' term + { $$ = oper2(OADD,$1,$3); } + | term '-' term + { $$ = oper2(OSUBTRACT,$1,$3); } + | term '*' term + { $$ = oper2(OMULT,$1,$3); } + | term '/' term + { $$ = oper2(ODIV,$1,$3); } + | term '%' term + { $$ = oper2(OMOD,$1,$3); } + | term '^' term + { $$ = oper2(OPOW,$1,$3); } + | term IN VAR + { $$ = oper2(ODEFINED,aryrefarg($3),$1); } + | cond '?' expr ':' expr + { $$ = oper3(OCOND,$1,$3,$5); } + | variable INCR + { $$ = oper1(OPOSTINCR,$1); } + | variable DECR + { $$ = oper1(OPOSTDECR,$1); } + | INCR variable + { $$ = oper1(OPREINCR,$2); } + | DECR variable + { $$ = oper1(OPREDECR,$2); } + | '-' term %prec UMINUS + { $$ = oper1(OUMINUS,$2); } + | '+' term %prec UMINUS + { $$ = oper1(OUPLUS,$2); } + | '(' cond ')' + { $$ = oper1(OPAREN,$2); } + | GETLINE + { $$ = oper0(OGETLINE); } + | GETLINE variable + { $$ = oper1(OGETLINE,$2); } + | GETLINE '<' expr + { $$ = oper3(OGETLINE,Nullop,string("<",1),$3); + if (ops[$3].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } + | GETLINE variable '<' expr + { $$ = oper3(OGETLINE,$2,string("<",1),$4); + if (ops[$4].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } + | term 'p' GETLINE + { $$ = oper3(OGETLINE,Nullop,string("|",1),$1); + if (ops[$1].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } + | term 'p' GETLINE variable + { $$ = oper3(OGETLINE,$4,string("|",1),$1); + if (ops[$1].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } + | FUN1 + { $$ = oper0($1); need_entire = do_chop = TRUE; } + | FUN1 '(' ')' + { $$ = oper1($1,Nullop); need_entire = do_chop = TRUE; } + | FUN1 '(' expr ')' + { $$ = oper1($1,$3); } + | FUNN '(' expr_list ')' + { $$ = oper1($1,$3); } + | USERFUN '(' expr_list ')' + { $$ = oper2(OUSERFUN,$1,$3); } + | SPRINTF expr_list + { $$ = oper1(OSPRINTF,$2); } + | SUBSTR '(' expr ',' expr ',' expr ')' + { $$ = oper3(OSUBSTR,$3,$5,$7); } + | SUBSTR '(' expr ',' expr ')' + { $$ = oper2(OSUBSTR,$3,$5); } + | SPLIT '(' expr ',' VAR ',' expr ')' + { $$ = oper3(OSPLIT,$3,aryrefarg(numary($5)),$7); } + | SPLIT '(' expr ',' VAR ',' REGEX ')' + { $$ = oper3(OSPLIT,$3,aryrefarg(numary($5)),oper1(OREGEX,$7));} + | SPLIT '(' expr ',' VAR ')' + { $$ = oper2(OSPLIT,$3,aryrefarg(numary($5))); } + | INDEX '(' expr ',' expr ')' + { $$ = oper2(OINDEX,$3,$5); } + | MATCH '(' expr ',' REGEX ')' + { $$ = oper2(OMATCH,$3,oper1(OREGEX,$5)); } + | MATCH '(' expr ',' expr ')' + { $$ = oper2(OMATCH,$3,$5); } + | SUB '(' expr ',' expr ')' + { $$ = oper2(OSUB,$3,$5); } + | SUB '(' REGEX ',' expr ')' + { $$ = oper2(OSUB,oper1(OREGEX,$3),$5); } + | GSUB '(' expr ',' expr ')' + { $$ = oper2(OGSUB,$3,$5); } + | GSUB '(' REGEX ',' expr ')' + { $$ = oper2(OGSUB,oper1(OREGEX,$3),$5); } + | SUB '(' expr ',' expr ',' expr ')' + { $$ = oper3(OSUB,$3,$5,$7); } + | SUB '(' REGEX ',' expr ',' expr ')' + { $$ = oper3(OSUB,oper1(OREGEX,$3),$5,$7); } + | GSUB '(' expr ',' expr ',' expr ')' + { $$ = oper3(OGSUB,$3,$5,$7); } + | GSUB '(' REGEX ',' expr ',' expr ')' + { $$ = oper3(OGSUB,oper1(OREGEX,$3),$5,$7); } + ; + +variable: VAR + { $$ = oper1(OVAR,$1); } + | VAR '[' expr_list ']' + { $$ = oper2(OVAR,aryrefarg($1),$3); } + | FIELD + { $$ = oper1(OFLD,$1); } + | VFIELD term + { $$ = oper1(OVFLD,$2); } + ; + +expr_list + : expr + | clist + | /* NULL */ + { $$ = Nullop; } + ; + +clist : expr ',' maybe expr + { $$ = oper3(OCOMMA,$1,$3,$4); } + | clist ',' maybe expr + { $$ = oper3(OCOMMA,$1,$3,$4); } + | '(' clist ')' /* these parens are invisible */ + { $$ = $2; } + ; + +junk : junk hunksep + { $$ = oper2(OJUNK,$1,$2); } + | /* NULL */ + { $$ = Nullop; } + ; + +hunksep : ';' + { $$ = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); } + | SEMINEW + { $$ = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); } + | NEWLINE + { $$ = oper0(ONEWLINE); } + | COMMENT + { $$ = oper1(OCOMMENT,$1); } + ; + +maybe : maybe nlstuff + { $$ = oper2(OJUNK,$1,$2); } + | /* NULL */ + { $$ = Nullop; } + ; + +nlstuff : NEWLINE + { $$ = oper0(ONEWLINE); } + | COMMENT + { $$ = oper1(OCOMMENT,$1); } + ; + +separator + : ';' maybe + { $$ = oper2(OJUNK,oper0(OSEMICOLON),$2); } + | SEMINEW maybe + { $$ = oper2(OJUNK,oper0(OSNEWLINE),$2); } + | NEWLINE maybe + { $$ = oper2(OJUNK,oper0(OSNEWLINE),$2); } + | COMMENT maybe + { $$ = oper2(OJUNK,oper1(OSCOMMENT,$1),$2); } + ; + +states : states statement + { $$ = oper2(OSTATES,$1,$2); } + | /* NULL */ + { $$ = Nullop; } + ; + +statement + : simple separator maybe + { $$ = oper2(OJUNK,oper2(OSTATE,$1,$2),$3); } + | ';' maybe + { $$ = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSEMICOLON),$2)); } + | SEMINEW maybe + { $$ = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSNEWLINE),$2)); } + | compound + ; + +simpnull: simple + | /* NULL */ + { $$ = Nullop; } + ; + +simple + : expr + | PRINT expr_list redir expr + { $$ = oper3(OPRINT,$2,$3,$4); + do_opens = TRUE; + saw_ORS = saw_OFS = TRUE; + if (!$2) need_entire = TRUE; + if (ops[$4].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } + | PRINT expr_list + { $$ = oper1(OPRINT,$2); + if (!$2) need_entire = TRUE; + saw_ORS = saw_OFS = TRUE; + } + | PRINTF expr_list redir expr + { $$ = oper3(OPRINTF,$2,$3,$4); + do_opens = TRUE; + if (!$2) need_entire = TRUE; + if (ops[$4].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } + | PRINTF expr_list + { $$ = oper1(OPRINTF,$2); + if (!$2) need_entire = TRUE; + } + | BREAK + { $$ = oper0(OBREAK); } + | NEXT + { $$ = oper0(ONEXT); } + | EXIT + { $$ = oper0(OEXIT); } + | EXIT expr + { $$ = oper1(OEXIT,$2); } + | CONTINUE + { $$ = oper0(OCONTINUE); } + | RET + { $$ = oper0(ORETURN); } + | RET expr + { $$ = oper1(ORETURN,$2); } + | DELETE VAR '[' expr_list ']' + { $$ = oper2(ODELETE,aryrefarg($2),$4); } + ; + +redir : '>' %prec FIELD + { $$ = oper1(OREDIR,string(">",1)); } + | GRGR + { $$ = oper1(OREDIR,string(">>",2)); } + | '|' + { $$ = oper1(OREDIR,string("|",1)); } + ; + +compound + : IF '(' cond ')' maybe statement + { $$ = oper2(OIF,$3,bl($6,$5)); } + | IF '(' cond ')' maybe statement ELSE maybe statement + { $$ = oper3(OIF,$3,bl($6,$5),bl($9,$8)); } + | WHILE '(' cond ')' maybe statement + { $$ = oper2(OWHILE,$3,bl($6,$5)); } + | DO maybe statement WHILE '(' cond ')' + { $$ = oper2(ODO,bl($3,$2),$6); } + | FOR '(' simpnull ';' cond ';' simpnull ')' maybe statement + { $$ = oper4(OFOR,$3,$5,$7,bl($10,$9)); } + | FOR '(' simpnull ';' ';' simpnull ')' maybe statement + { $$ = oper4(OFOR,$3,string("",0),$6,bl($9,$8)); } + | FOR '(' expr ')' maybe statement + { $$ = oper2(OFORIN,$3,bl($6,$5)); } + | '{' maybe states '}' maybe + { $$ = oper3(OBLOCK,oper2(OJUNK,$2,$3),Nullop,$5); } + ; + +%% +#include "a2py.c" diff --git a/gnu/usr.bin/perl/x2p/a2py.c b/gnu/usr.bin/perl/x2p/a2py.c new file mode 100644 index 00000000000..454e2dc8601 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/a2py.c @@ -0,0 +1,1308 @@ +/* $RCSfile: a2py.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:14 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: a2py.c,v $ + */ + +#ifdef OS2 +#include "../patchlevel.h" +#endif +#include "util.h" + +char *filename; +char *myname; + +int checkers = 0; + +int oper0(); +int oper1(); +int oper2(); +int oper3(); +int oper4(); +int oper5(); +STR *walk(); + +#ifdef OS2 +usage() +{ + printf("\nThis is the AWK to PERL translator, version 5.0, patchlevel %d\n", PATCHLEVEL); + printf("\nUsage: %s [-D<number>] [-F<char>] [-n<fieldlist>] [-<number>] filename\n", myname); + printf("\n -D<number> sets debugging flags." + "\n -F<character> the awk script to translate is always invoked with" + "\n this -F switch." + "\n -n<fieldlist> specifies the names of the input fields if input does" + "\n not have to be split into an array." + "\n -<number> causes a2p to assume that input will always have that" + "\n many fields.\n"); + exit(1); +} +#endif +main(argc,argv,env) +register int argc; +register char **argv; +register char **env; +{ + register STR *str; + int i; + STR *tmpstr; + + myname = argv[0]; + linestr = str_new(80); + str = str_new(0); /* first used for -I flags */ + for (argc--,argv++; argc; argc--,argv++) { + if (argv[0][0] != '-' || !argv[0][1]) + break; + reswitch: + switch (argv[0][1]) { +#ifdef DEBUGGING + case 'D': + debug = atoi(argv[0]+2); +#ifdef YYDEBUG + yydebug = (debug & 1); +#endif + break; +#endif + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + maxfld = atoi(argv[0]+1); + absmaxfld = TRUE; + break; + case 'F': + fswitch = argv[0][2]; + break; + case 'n': + namelist = savestr(argv[0]+2); + break; + case '-': + argc--,argv++; + goto switch_end; + case 0: + break; + default: + fatal("Unrecognized switch: %s\n",argv[0]); +#ifdef OS2 + usage(); +#endif + } + } + switch_end: + + /* open script */ + + if (argv[0] == Nullch) { +#ifdef OS2 + if ( isatty(fileno(stdin)) ) + usage(); +#endif + argv[0] = "-"; + } + filename = savestr(argv[0]); + + filename = savestr(argv[0]); + if (strEQ(filename,"-")) + argv[0] = ""; + if (!*argv[0]) + rsfp = stdin; + else + rsfp = fopen(argv[0],"r"); + if (rsfp == Nullfp) + fatal("Awk script \"%s\" doesn't seem to exist.\n",filename); + + /* init tokener */ + + bufptr = str_get(linestr); + symtab = hnew(); + curarghash = hnew(); + + /* now parse the report spec */ + + if (yyparse()) + fatal("Translation aborted due to syntax errors.\n"); + +#ifdef DEBUGGING + if (debug & 2) { + int type, len; + + for (i=1; i<mop;) { + type = ops[i].ival; + len = type >> 8; + type &= 255; + printf("%d\t%d\t%d\t%-10s",i++,type,len,opname[type]); + if (type == OSTRING) + printf("\t\"%s\"\n",ops[i].cval),i++; + else { + while (len--) { + printf("\t%d",ops[i].ival),i++; + } + putchar('\n'); + } + } + } + if (debug & 8) + dump(root); +#endif + + /* first pass to look for numeric variables */ + + prewalk(0,0,root,&i); + + /* second pass to produce new program */ + + tmpstr = walk(0,0,root,&i,P_MIN); + str = str_make(STARTPERL); + str_cat(str, "\neval 'exec perl -S $0 \"$@\"'\n\ + if $running_under_some_shell;\n\ + # this emulates #! processing on NIH machines.\n\ + # (remove #! line above if indigestible)\n\n"); + str_cat(str, + "eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;\n"); + str_cat(str, + " # process any FOO=bar switches\n\n"); + if (do_opens && opens) { + str_scat(str,opens); + str_free(opens); + str_cat(str,"\n"); + } + str_scat(str,tmpstr); + str_free(tmpstr); +#ifdef DEBUGGING + if (!(debug & 16)) +#endif + fixup(str); + putlines(str); + if (checkers) { + fprintf(stderr, + "Please check my work on the %d line%s I've marked with \"#???\".\n", + checkers, checkers == 1 ? "" : "s" ); + fprintf(stderr, + "The operation I've selected may be wrong for the operand types.\n"); + } + exit(0); +} + +#define RETURN(retval) return (bufptr = s,retval) +#define XTERM(retval) return (expectterm = TRUE,bufptr = s,retval) +#define XOP(retval) return (expectterm = FALSE,bufptr = s,retval) +#define ID(x) return (yylval=string(x,0),expectterm = FALSE,bufptr = s,idtype) + +int idtype; + +int +yylex() +{ + register char *s = bufptr; + register char *d; + register int tmp; + + retry: +#ifdef YYDEBUG + if (yydebug) + if (strchr(s,'\n')) + fprintf(stderr,"Tokener at %s",s); + else + fprintf(stderr,"Tokener at %s\n",s); +#endif + switch (*s) { + default: + fprintf(stderr, + "Unrecognized character %c in file %s line %d--ignoring.\n", + *s++,filename,line); + goto retry; + case '\\': + s++; + if (*s && *s != '\n') { + yyerror("Ignoring spurious backslash"); + goto retry; + } + /*FALLSTHROUGH*/ + case 0: + s = str_get(linestr); + *s = '\0'; + if (!rsfp) + RETURN(0); + line++; + if ((s = str_gets(linestr, rsfp)) == Nullch) { + if (rsfp != stdin) + fclose(rsfp); + rsfp = Nullfp; + s = str_get(linestr); + RETURN(0); + } + goto retry; + case ' ': case '\t': + s++; + goto retry; + case '\n': + *s = '\0'; + XTERM(NEWLINE); + case '#': + yylval = string(s,0); + *s = '\0'; + XTERM(COMMENT); + case ';': + tmp = *s++; + if (*s == '\n') { + s++; + XTERM(SEMINEW); + } + XTERM(tmp); + case '(': + tmp = *s++; + XTERM(tmp); + case '{': + case '[': + case ')': + case ']': + case '?': + case ':': + tmp = *s++; + XOP(tmp); + case 127: + s++; + XTERM('}'); + case '}': + for (d = s + 1; isspace(*d); d++) ; + if (!*d) + s = d - 1; + *s = 127; + XTERM(';'); + case ',': + tmp = *s++; + XTERM(tmp); + case '~': + s++; + yylval = string("~",1); + XTERM(MATCHOP); + case '+': + case '-': + if (s[1] == *s) { + s++; + if (*s++ == '+') + XTERM(INCR); + else + XTERM(DECR); + } + /* FALL THROUGH */ + case '*': + case '%': + case '^': + tmp = *s++; + if (*s == '=') { + if (tmp == '^') + yylval = string("**=",3); + else + yylval = string(s-1,2); + s++; + XTERM(ASGNOP); + } + XTERM(tmp); + case '&': + s++; + tmp = *s++; + if (tmp == '&') + XTERM(ANDAND); + s--; + XTERM('&'); + case '|': + s++; + tmp = *s++; + if (tmp == '|') + XTERM(OROR); + s--; + while (*s == ' ' || *s == '\t') + s++; + if (strnEQ(s,"getline",7)) + XTERM('p'); + else + XTERM('|'); + case '=': + s++; + tmp = *s++; + if (tmp == '=') { + yylval = string("==",2); + XTERM(RELOP); + } + s--; + yylval = string("=",1); + XTERM(ASGNOP); + case '!': + s++; + tmp = *s++; + if (tmp == '=') { + yylval = string("!=",2); + XTERM(RELOP); + } + if (tmp == '~') { + yylval = string("!~",2); + XTERM(MATCHOP); + } + s--; + XTERM(NOT); + case '<': + s++; + tmp = *s++; + if (tmp == '=') { + yylval = string("<=",2); + XTERM(RELOP); + } + s--; + XTERM('<'); + case '>': + s++; + tmp = *s++; + if (tmp == '>') { + yylval = string(">>",2); + XTERM(GRGR); + } + if (tmp == '=') { + yylval = string(">=",2); + XTERM(RELOP); + } + s--; + XTERM('>'); + +#define SNARFWORD \ + d = tokenbuf; \ + while (isalpha(*s) || isdigit(*s) || *s == '_') \ + *d++ = *s++; \ + *d = '\0'; \ + d = tokenbuf; \ + if (*s == '(') \ + idtype = USERFUN; \ + else \ + idtype = VAR; + + case '$': + s++; + if (*s == '0') { + s++; + do_chop = TRUE; + need_entire = TRUE; + idtype = VAR; + ID("0"); + } + do_split = TRUE; + if (isdigit(*s)) { + for (d = s; isdigit(*s); s++) ; + yylval = string(d,s-d); + tmp = atoi(d); + if (tmp > maxfld) + maxfld = tmp; + XOP(FIELD); + } + split_to_array = set_array_base = TRUE; + XOP(VFIELD); + + case '/': /* may either be division or pattern */ + if (expectterm) { + s = scanpat(s); + XTERM(REGEX); + } + tmp = *s++; + if (*s == '=') { + yylval = string("/=",2); + s++; + XTERM(ASGNOP); + } + XTERM(tmp); + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': case '.': + s = scannum(s); + XOP(NUMBER); + case '"': + s++; + s = cpy2(tokenbuf,s,s[-1]); + if (!*s) + fatal("String not terminated:\n%s",str_get(linestr)); + s++; + yylval = string(tokenbuf,0); + XOP(STRING); + + case 'a': case 'A': + SNARFWORD; + if (strEQ(d,"ARGC")) + set_array_base = TRUE; + if (strEQ(d,"ARGV")) { + yylval=numary(string("ARGV",0)); + XOP(VAR); + } + if (strEQ(d,"atan2")) { + yylval = OATAN2; + XTERM(FUNN); + } + ID(d); + case 'b': case 'B': + SNARFWORD; + if (strEQ(d,"break")) + XTERM(BREAK); + if (strEQ(d,"BEGIN")) + XTERM(BEGIN); + ID(d); + case 'c': case 'C': + SNARFWORD; + if (strEQ(d,"continue")) + XTERM(CONTINUE); + if (strEQ(d,"cos")) { + yylval = OCOS; + XTERM(FUN1); + } + if (strEQ(d,"close")) { + do_fancy_opens = 1; + yylval = OCLOSE; + XTERM(FUN1); + } + if (strEQ(d,"chdir")) + *d = toupper(*d); + else if (strEQ(d,"crypt")) + *d = toupper(*d); + else if (strEQ(d,"chop")) + *d = toupper(*d); + else if (strEQ(d,"chmod")) + *d = toupper(*d); + else if (strEQ(d,"chown")) + *d = toupper(*d); + ID(d); + case 'd': case 'D': + SNARFWORD; + if (strEQ(d,"do")) + XTERM(DO); + if (strEQ(d,"delete")) + XTERM(DELETE); + if (strEQ(d,"die")) + *d = toupper(*d); + ID(d); + case 'e': case 'E': + SNARFWORD; + if (strEQ(d,"END")) + XTERM(END); + if (strEQ(d,"else")) + XTERM(ELSE); + if (strEQ(d,"exit")) { + saw_line_op = TRUE; + XTERM(EXIT); + } + if (strEQ(d,"exp")) { + yylval = OEXP; + XTERM(FUN1); + } + if (strEQ(d,"elsif")) + *d = toupper(*d); + else if (strEQ(d,"eq")) + *d = toupper(*d); + else if (strEQ(d,"eval")) + *d = toupper(*d); + else if (strEQ(d,"eof")) + *d = toupper(*d); + else if (strEQ(d,"each")) + *d = toupper(*d); + else if (strEQ(d,"exec")) + *d = toupper(*d); + ID(d); + case 'f': case 'F': + SNARFWORD; + if (strEQ(d,"FS")) { + saw_FS++; + if (saw_FS == 1 && in_begin) { + for (d = s; *d && isspace(*d); d++) ; + if (*d == '=') { + for (d++; *d && isspace(*d); d++) ; + if (*d == '"' && d[2] == '"') + const_FS = d[1]; + } + } + ID(tokenbuf); + } + if (strEQ(d,"for")) + XTERM(FOR); + else if (strEQ(d,"function")) + XTERM(FUNCTION); + if (strEQ(d,"FILENAME")) + d = "ARGV"; + if (strEQ(d,"foreach")) + *d = toupper(*d); + else if (strEQ(d,"format")) + *d = toupper(*d); + else if (strEQ(d,"fork")) + *d = toupper(*d); + else if (strEQ(d,"fh")) + *d = toupper(*d); + ID(d); + case 'g': case 'G': + SNARFWORD; + if (strEQ(d,"getline")) + XTERM(GETLINE); + if (strEQ(d,"gsub")) + XTERM(GSUB); + if (strEQ(d,"ge")) + *d = toupper(*d); + else if (strEQ(d,"gt")) + *d = toupper(*d); + else if (strEQ(d,"goto")) + *d = toupper(*d); + else if (strEQ(d,"gmtime")) + *d = toupper(*d); + ID(d); + case 'h': case 'H': + SNARFWORD; + if (strEQ(d,"hex")) + *d = toupper(*d); + ID(d); + case 'i': case 'I': + SNARFWORD; + if (strEQ(d,"if")) + XTERM(IF); + if (strEQ(d,"in")) + XTERM(IN); + if (strEQ(d,"index")) { + set_array_base = TRUE; + XTERM(INDEX); + } + if (strEQ(d,"int")) { + yylval = OINT; + XTERM(FUN1); + } + ID(d); + case 'j': case 'J': + SNARFWORD; + if (strEQ(d,"join")) + *d = toupper(*d); + ID(d); + case 'k': case 'K': + SNARFWORD; + if (strEQ(d,"keys")) + *d = toupper(*d); + else if (strEQ(d,"kill")) + *d = toupper(*d); + ID(d); + case 'l': case 'L': + SNARFWORD; + if (strEQ(d,"length")) { + yylval = OLENGTH; + XTERM(FUN1); + } + if (strEQ(d,"log")) { + yylval = OLOG; + XTERM(FUN1); + } + if (strEQ(d,"last")) + *d = toupper(*d); + else if (strEQ(d,"local")) + *d = toupper(*d); + else if (strEQ(d,"lt")) + *d = toupper(*d); + else if (strEQ(d,"le")) + *d = toupper(*d); + else if (strEQ(d,"locatime")) + *d = toupper(*d); + else if (strEQ(d,"link")) + *d = toupper(*d); + ID(d); + case 'm': case 'M': + SNARFWORD; + if (strEQ(d,"match")) { + set_array_base = TRUE; + XTERM(MATCH); + } + if (strEQ(d,"m")) + *d = toupper(*d); + ID(d); + case 'n': case 'N': + SNARFWORD; + if (strEQ(d,"NF")) + do_chop = do_split = split_to_array = set_array_base = TRUE; + if (strEQ(d,"next")) { + saw_line_op = TRUE; + XTERM(NEXT); + } + if (strEQ(d,"ne")) + *d = toupper(*d); + ID(d); + case 'o': case 'O': + SNARFWORD; + if (strEQ(d,"ORS")) { + saw_ORS = TRUE; + d = "\\"; + } + if (strEQ(d,"OFS")) { + saw_OFS = TRUE; + d = ","; + } + if (strEQ(d,"OFMT")) { + d = "#"; + } + if (strEQ(d,"open")) + *d = toupper(*d); + else if (strEQ(d,"ord")) + *d = toupper(*d); + else if (strEQ(d,"oct")) + *d = toupper(*d); + ID(d); + case 'p': case 'P': + SNARFWORD; + if (strEQ(d,"print")) { + XTERM(PRINT); + } + if (strEQ(d,"printf")) { + XTERM(PRINTF); + } + if (strEQ(d,"push")) + *d = toupper(*d); + else if (strEQ(d,"pop")) + *d = toupper(*d); + ID(d); + case 'q': case 'Q': + SNARFWORD; + ID(d); + case 'r': case 'R': + SNARFWORD; + if (strEQ(d,"RS")) { + d = "/"; + saw_RS = TRUE; + } + if (strEQ(d,"rand")) { + yylval = ORAND; + XTERM(FUN1); + } + if (strEQ(d,"return")) + XTERM(RET); + if (strEQ(d,"reset")) + *d = toupper(*d); + else if (strEQ(d,"redo")) + *d = toupper(*d); + else if (strEQ(d,"rename")) + *d = toupper(*d); + ID(d); + case 's': case 'S': + SNARFWORD; + if (strEQ(d,"split")) { + set_array_base = TRUE; + XOP(SPLIT); + } + if (strEQ(d,"substr")) { + set_array_base = TRUE; + XTERM(SUBSTR); + } + if (strEQ(d,"sub")) + XTERM(SUB); + if (strEQ(d,"sprintf")) + XTERM(SPRINTF); + if (strEQ(d,"sqrt")) { + yylval = OSQRT; + XTERM(FUN1); + } + if (strEQ(d,"SUBSEP")) { + d = ";"; + } + if (strEQ(d,"sin")) { + yylval = OSIN; + XTERM(FUN1); + } + if (strEQ(d,"srand")) { + yylval = OSRAND; + XTERM(FUN1); + } + if (strEQ(d,"system")) { + yylval = OSYSTEM; + XTERM(FUN1); + } + if (strEQ(d,"s")) + *d = toupper(*d); + else if (strEQ(d,"shift")) + *d = toupper(*d); + else if (strEQ(d,"select")) + *d = toupper(*d); + else if (strEQ(d,"seek")) + *d = toupper(*d); + else if (strEQ(d,"stat")) + *d = toupper(*d); + else if (strEQ(d,"study")) + *d = toupper(*d); + else if (strEQ(d,"sleep")) + *d = toupper(*d); + else if (strEQ(d,"symlink")) + *d = toupper(*d); + else if (strEQ(d,"sort")) + *d = toupper(*d); + ID(d); + case 't': case 'T': + SNARFWORD; + if (strEQ(d,"tr")) + *d = toupper(*d); + else if (strEQ(d,"tell")) + *d = toupper(*d); + else if (strEQ(d,"time")) + *d = toupper(*d); + else if (strEQ(d,"times")) + *d = toupper(*d); + ID(d); + case 'u': case 'U': + SNARFWORD; + if (strEQ(d,"until")) + *d = toupper(*d); + else if (strEQ(d,"unless")) + *d = toupper(*d); + else if (strEQ(d,"umask")) + *d = toupper(*d); + else if (strEQ(d,"unshift")) + *d = toupper(*d); + else if (strEQ(d,"unlink")) + *d = toupper(*d); + else if (strEQ(d,"utime")) + *d = toupper(*d); + ID(d); + case 'v': case 'V': + SNARFWORD; + if (strEQ(d,"values")) + *d = toupper(*d); + ID(d); + case 'w': case 'W': + SNARFWORD; + if (strEQ(d,"while")) + XTERM(WHILE); + if (strEQ(d,"write")) + *d = toupper(*d); + else if (strEQ(d,"wait")) + *d = toupper(*d); + ID(d); + case 'x': case 'X': + SNARFWORD; + if (strEQ(d,"x")) + *d = toupper(*d); + ID(d); + case 'y': case 'Y': + SNARFWORD; + if (strEQ(d,"y")) + *d = toupper(*d); + ID(d); + case 'z': case 'Z': + SNARFWORD; + ID(d); + } +} + +char * +scanpat(s) +register char *s; +{ + register char *d; + + switch (*s++) { + case '/': + break; + default: + fatal("Search pattern not found:\n%s",str_get(linestr)); + } + + d = tokenbuf; + for (; *s; s++,d++) { + if (*s == '\\') { + if (s[1] == '/') + *d++ = *s++; + else if (s[1] == '\\') + *d++ = *s++; + else if (s[1] == '[') + *d++ = *s++; + } + else if (*s == '[') { + *d++ = *s++; + do { + if (*s == '\\' && s[1]) + *d++ = *s++; + if (*s == '/' || (*s == '-' && s[1] == ']')) + *d++ = '\\'; + *d++ = *s++; + } while (*s && *s != ']'); + } + else if (*s == '/') + break; + *d = *s; + } + *d = '\0'; + + if (!*s) + fatal("Search pattern not terminated:\n%s",str_get(linestr)); + s++; + yylval = string(tokenbuf,0); + return s; +} + +void +yyerror(s) +char *s; +{ + fprintf(stderr,"%s in file %s at line %d\n", + s,filename,line); +} + +char * +scannum(s) +register char *s; +{ + register char *d; + + switch (*s) { + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': case '0' : case '.': + d = tokenbuf; + while (isdigit(*s)) { + *d++ = *s++; + } + if (*s == '.') { + if (isdigit(s[1])) { + *d++ = *s++; + while (isdigit(*s)) { + *d++ = *s++; + } + } + else + s++; + } + if (strchr("eE",*s) && strchr("+-0123456789",s[1])) { + *d++ = *s++; + if (*s == '+' || *s == '-') + *d++ = *s++; + while (isdigit(*s)) + *d++ = *s++; + } + *d = '\0'; + yylval = string(tokenbuf,0); + break; + } + return s; +} + +int +string(ptr,len) +char *ptr; +int len; +{ + int retval = mop; + + ops[mop++].ival = OSTRING + (1<<8); + if (!len) + len = strlen(ptr); + ops[mop].cval = safemalloc(len+1); + strncpy(ops[mop].cval,ptr,len); + ops[mop++].cval[len] = '\0'; + if (mop >= OPSMAX) + fatal("Recompile a2p with larger OPSMAX\n"); + return retval; +} + +int +oper0(type) +int type; +{ + int retval = mop; + + if (type > 255) + fatal("type > 255 (%d)\n",type); + ops[mop++].ival = type; + if (mop >= OPSMAX) + fatal("Recompile a2p with larger OPSMAX\n"); + return retval; +} + +int +oper1(type,arg1) +int type; +int arg1; +{ + int retval = mop; + + if (type > 255) + fatal("type > 255 (%d)\n",type); + ops[mop++].ival = type + (1<<8); + ops[mop++].ival = arg1; + if (mop >= OPSMAX) + fatal("Recompile a2p with larger OPSMAX\n"); + return retval; +} + +int +oper2(type,arg1,arg2) +int type; +int arg1; +int arg2; +{ + int retval = mop; + + if (type > 255) + fatal("type > 255 (%d)\n",type); + ops[mop++].ival = type + (2<<8); + ops[mop++].ival = arg1; + ops[mop++].ival = arg2; + if (mop >= OPSMAX) + fatal("Recompile a2p with larger OPSMAX\n"); + return retval; +} + +int +oper3(type,arg1,arg2,arg3) +int type; +int arg1; +int arg2; +int arg3; +{ + int retval = mop; + + if (type > 255) + fatal("type > 255 (%d)\n",type); + ops[mop++].ival = type + (3<<8); + ops[mop++].ival = arg1; + ops[mop++].ival = arg2; + ops[mop++].ival = arg3; + if (mop >= OPSMAX) + fatal("Recompile a2p with larger OPSMAX\n"); + return retval; +} + +int +oper4(type,arg1,arg2,arg3,arg4) +int type; +int arg1; +int arg2; +int arg3; +int arg4; +{ + int retval = mop; + + if (type > 255) + fatal("type > 255 (%d)\n",type); + ops[mop++].ival = type + (4<<8); + ops[mop++].ival = arg1; + ops[mop++].ival = arg2; + ops[mop++].ival = arg3; + ops[mop++].ival = arg4; + if (mop >= OPSMAX) + fatal("Recompile a2p with larger OPSMAX\n"); + return retval; +} + +int +oper5(type,arg1,arg2,arg3,arg4,arg5) +int type; +int arg1; +int arg2; +int arg3; +int arg4; +int arg5; +{ + int retval = mop; + + if (type > 255) + fatal("type > 255 (%d)\n",type); + ops[mop++].ival = type + (5<<8); + ops[mop++].ival = arg1; + ops[mop++].ival = arg2; + ops[mop++].ival = arg3; + ops[mop++].ival = arg4; + ops[mop++].ival = arg5; + if (mop >= OPSMAX) + fatal("Recompile a2p with larger OPSMAX\n"); + return retval; +} + +int depth = 0; + +void +dump(branch) +int branch; +{ + register int type; + register int len; + register int i; + + type = ops[branch].ival; + len = type >> 8; + type &= 255; + for (i=depth; i; i--) + printf(" "); + if (type == OSTRING) { + printf("%-5d\"%s\"\n",branch,ops[branch+1].cval); + } + else { + printf("(%-5d%s %d\n",branch,opname[type],len); + depth++; + for (i=1; i<=len; i++) + dump(ops[branch+i].ival); + depth--; + for (i=depth; i; i--) + printf(" "); + printf(")\n"); + } +} + +int +bl(arg,maybe) +int arg; +int maybe; +{ + if (!arg) + return 0; + else if ((ops[arg].ival & 255) != OBLOCK) + return oper2(OBLOCK,arg,maybe); + else if ((ops[arg].ival >> 8) < 2) + return oper2(OBLOCK,ops[arg+1].ival,maybe); + else + return arg; +} + +void +fixup(str) +STR *str; +{ + register char *s; + register char *t; + + for (s = str->str_ptr; *s; s++) { + if (*s == ';' && s[1] == ' ' && s[2] == '\n') { + strcpy(s+1,s+2); + s++; + } + else if (*s == '\n') { + for (t = s+1; isspace(*t & 127); t++) ; + t--; + while (isspace(*t & 127) && *t != '\n') t--; + if (*t == '\n' && t-s > 1) { + if (s[-1] == '{') + s--; + strcpy(s+1,t); + } + s++; + } + } +} + +void +putlines(str) +STR *str; +{ + register char *d, *s, *t, *e; + register int pos, newpos; + + d = tokenbuf; + pos = 0; + for (s = str->str_ptr; *s; s++) { + *d++ = *s; + pos++; + if (*s == '\n') { + *d = '\0'; + d = tokenbuf; + pos = 0; + putone(); + } + else if (*s == '\t') + pos += 7; + if (pos > 78) { /* split a long line? */ + *d-- = '\0'; + newpos = 0; + for (t = tokenbuf; isspace(*t & 127); t++) { + if (*t == '\t') + newpos += 8; + else + newpos += 1; + } + e = d; + while (d > tokenbuf && (*d != ' ' || d[-1] != ';')) + d--; + if (d < t+10) { + d = e; + while (d > tokenbuf && + (*d != ' ' || d[-1] != '|' || d[-2] != '|') ) + d--; + } + if (d < t+10) { + d = e; + while (d > tokenbuf && + (*d != ' ' || d[-1] != '&' || d[-2] != '&') ) + d--; + } + if (d < t+10) { + d = e; + while (d > tokenbuf && (*d != ' ' || d[-1] != ',')) + d--; + } + if (d < t+10) { + d = e; + while (d > tokenbuf && *d != ' ') + d--; + } + if (d > t+3) { + char save[2048]; + strcpy(save, d); + *d = '\n'; + d[1] = '\0'; + putone(); + putchar('\n'); + if (d[-1] != ';' && !(newpos % 4)) { + *t++ = ' '; + *t++ = ' '; + newpos += 2; + } + strcpy(t,save+1); + newpos += strlen(t); + d = t + strlen(t); + pos = newpos; + } + else + d = e + 1; + } + } +} + +void +putone() +{ + register char *t; + + for (t = tokenbuf; *t; t++) { + *t &= 127; + if (*t == 127) { + *t = ' '; + strcpy(t+strlen(t)-1, "\t#???\n"); + checkers++; + } + } + t = tokenbuf; + if (*t == '#') { + if (strnEQ(t,"#!/bin/awk",10) || strnEQ(t,"#! /bin/awk",11)) + return; + if (strnEQ(t,"#!/usr/bin/awk",14) || strnEQ(t,"#! /usr/bin/awk",15)) + return; + } + fputs(tokenbuf,stdout); +} + +int +numary(arg) +int arg; +{ + STR *key; + int dummy; + + key = walk(0,0,arg,&dummy,P_MIN); + str_cat(key,"[]"); + hstore(symtab,key->str_ptr,str_make("1")); + str_free(key); + set_array_base = TRUE; + return arg; +} + +int +rememberargs(arg) +int arg; +{ + int type; + STR *str; + + if (!arg) + return arg; + type = ops[arg].ival & 255; + if (type == OCOMMA) { + rememberargs(ops[arg+1].ival); + rememberargs(ops[arg+3].ival); + } + else if (type == OVAR) { + str = str_new(0); + hstore(curarghash,ops[ops[arg+1].ival+1].cval,str); + } + else + fatal("panic: unknown argument type %d, line %d\n",type,line); + return arg; +} + +int +aryrefarg(arg) +int arg; +{ + int type = ops[arg].ival & 255; + STR *str; + + if (type != OSTRING) + fatal("panic: aryrefarg %d, line %d\n",type,line); + str = hfetch(curarghash,ops[arg+1].cval); + if (str) + str_set(str,"*"); + return arg; +} + +int +fixfargs(name,arg,prevargs) +int name; +int arg; +int prevargs; +{ + int type; + STR *str; + int numargs; + + if (!arg) + return prevargs; + type = ops[arg].ival & 255; + if (type == OCOMMA) { + numargs = fixfargs(name,ops[arg+1].ival,prevargs); + numargs = fixfargs(name,ops[arg+3].ival,numargs); + } + else if (type == OVAR) { + str = hfetch(curarghash,ops[ops[arg+1].ival+1].cval); + if (strEQ(str_get(str),"*")) { + char tmpbuf[128]; + + str_set(str,""); /* in case another routine has this */ + ops[arg].ival &= ~255; + ops[arg].ival |= OSTAR; + sprintf(tmpbuf,"%s:%d",ops[name+1].cval,prevargs); + fprintf(stderr,"Adding %s\n",tmpbuf); + str = str_new(0); + str_set(str,"*"); + hstore(curarghash,tmpbuf,str); + } + numargs = prevargs + 1; + } + else + fatal("panic: unknown argument type %d, arg %d, line %d\n", + type,prevargs+1,line); + return numargs; +} + +int +fixrargs(name,arg,prevargs) +char *name; +int arg; +int prevargs; +{ + int type; + STR *str; + int numargs; + + if (!arg) + return prevargs; + type = ops[arg].ival & 255; + if (type == OCOMMA) { + numargs = fixrargs(name,ops[arg+1].ival,prevargs); + numargs = fixrargs(name,ops[arg+3].ival,numargs); + } + else { + char tmpbuf[128]; + + sprintf(tmpbuf,"%s:%d",name,prevargs); + str = hfetch(curarghash,tmpbuf); + if (str && strEQ(str->str_ptr,"*")) { + if (type == OVAR || type == OSTAR) { + ops[arg].ival &= ~255; + ops[arg].ival |= OSTAR; + } + else + fatal("Can't pass expression by reference as arg %d of %s\n", + prevargs+1, name); + } + numargs = prevargs + 1; + } + return numargs; +} diff --git a/gnu/usr.bin/perl/x2p/cflags.SH b/gnu/usr.bin/perl/x2p/cflags.SH new file mode 100644 index 00000000000..531ef658053 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/cflags.SH @@ -0,0 +1,87 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +: This forces SH files to create target in same directory as SH file. +: This is so that make depend always knows where to find SH derivatives. +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting x2p/cflags (with variable substitutions)" +: This section of the file will have variable substitutions done on it. +: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. +: Protect any dollar signs and backticks that you do not want interpreted +: by putting a backslash in front. You may delete these comments. +$spitshell >cflags <<!GROK!THIS! +!GROK!THIS! + +: In the following dollars and backticks do not need the extra backslash. +$spitshell >>cflags <<'!NO!SUBS!' +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac + +also=': ' +case $# in +1) also='echo 1>&2 " CCCMD = "' +esac + +case $# in +0) set *.c; echo "The current C flags are:" ;; +esac + +set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g'` + +for file do + + case "$#" in + 1) ;; + *) echo $n " $file.c $c" ;; + esac + + : allow variables like str_cflags to be evaluated + + eval 'eval ${'"${file}_cflags"'-""}' + + : or customize here + + case "$file" in + a2p) ;; + a2py) ;; + hash) ;; + str) ;; + util) ;; + walk) ;; + *) ;; + esac + + ccflags="`echo $ccflags | sed -e 's/-DEMBED//'`" + + echo "$cc -c $ccflags $optimize $large $split" + eval "$also "'"$cc -c $ccflags $optimize $large $split"' + + . $TOP/config.sh + +done +!NO!SUBS! +chmod 755 cflags +$eunicefix cflags diff --git a/gnu/usr.bin/perl/x2p/find2perl.PL b/gnu/usr.bin/perl/x2p/find2perl.PL new file mode 100644 index 00000000000..32f78fe23f3 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/find2perl.PL @@ -0,0 +1,606 @@ +#!/usr/local/bin/perl + +use Config; +use File::Basename qw(&basename &dirname); + +# List explicitly here the variables you want Configure to +# generate. Metaconfig only looks for shell variables, so you +# have to mention them as if they were shell variables, not +# %Config entries. Thus you write +# $startperl +# to ensure Configure will look for $Config{startperl}. + +# This forces PL files to create target in same directory as PL file. +# This is so that make depend always knows where to find PL derivatives. +chdir(dirname($0)); +($file = basename($0)) =~ s/\.PL$//; +$file =~ s/\.pl$// + if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving" + +open OUT,">$file" or die "Can't create $file: $!"; + +print "Extracting $file (with variable substitutions)\n"; + +# In this section, perl variables will be expanded during extraction. +# You can use $Config{...} to use Configure variables. + +print OUT <<"!GROK!THIS!"; +$Config{'startperl'} + eval 'exec perl -S \$0 "\$@"' + if 0; +\$startperl = "$Config{startperl}"; +!GROK!THIS! + +# In the following, perl variables are not expanded during extraction. + +print OUT <<'!NO!SUBS!'; +# +# Modified September 26, 1993 to provide proper handling of years after 1999 +# Tom Link <tml+@pitt.edu> +# University of Pittsburgh + +while ($ARGV[0] =~ /^[^-!(]/) { + push(@roots, shift); +} +@roots = ('.') unless @roots; +for (@roots) { $_ = "e($_); } +$roots = join(',', @roots); + +$indent = 1; + +while (@ARGV) { + $_ = shift; + s/^-// || /^[()!]/ || die "Unrecognized switch: $_\n"; + if ($_ eq '(') { + $out .= &tab . "(\n"; + $indent++; + next; + } + elsif ($_ eq ')') { + $indent--; + $out .= &tab . ")"; + } + elsif ($_ eq '!') { + $out .= &tab . "!"; + next; + } + elsif ($_ eq 'name') { + $out .= &tab; + $pat = &fileglob_to_re(shift); + $out .= '/' . $pat . "/"; + } + elsif ($_ eq 'perm') { + $onum = shift; + die "Malformed -perm argument: $onum\n" unless $onum =~ /^-?[0-7]+$/; + if ($onum =~ s/^-//) { + $onum = '0' . sprintf("%o", oct($onum) & 017777); # s/b 07777 ? + $out .= &tab . "((\$mode & $onum) == $onum)"; + } + else { + $onum = '0' . $onum unless $onum =~ /^0/; + $out .= &tab . "((\$mode & 0777) == $onum)"; + } + } + elsif ($_ eq 'type') { + ($filetest = shift) =~ tr/s/S/; + $out .= &tab . "-$filetest _"; + } + elsif ($_ eq 'print') { + $out .= &tab . 'print("$name\n")'; + } + elsif ($_ eq 'print0') { + $out .= &tab . 'print("$name\0")'; + } + elsif ($_ eq 'fstype') { + $out .= &tab; + $type = shift; + if ($type eq 'nfs') + { $out .= '($dev < 0)'; } + else + { $out .= '($dev >= 0)'; } + } + elsif ($_ eq 'user') { + $uname = shift; + $out .= &tab . "(\$uid == \$uid{'$uname'})"; + $inituser++; + } + elsif ($_ eq 'group') { + $gname = shift; + $out .= &tab . "(\$gid == \$gid{'$gname'})"; + $initgroup++; + } + elsif ($_ eq 'nouser') { + $out .= &tab . '!defined $uid{$uid}'; + $inituser++; + } + elsif ($_ eq 'nogroup') { + $out .= &tab . '!defined $gid{$gid}'; + $initgroup++; + } + elsif ($_ eq 'links') { + $out .= &tab . '($nlink ' . &n(shift); + } + elsif ($_ eq 'inum') { + $out .= &tab . '($ino ' . &n(shift); + } + elsif ($_ eq 'size') { + $out .= &tab . '(int(((-s _) + 511) / 512) ' . &n(shift); + } + elsif ($_ eq 'atime') { + $out .= &tab . '(int(-A _) ' . &n(shift); + } + elsif ($_ eq 'mtime') { + $out .= &tab . '(int(-M _) ' . &n(shift); + } + elsif ($_ eq 'ctime') { + $out .= &tab . '(int(-C _) ' . &n(shift); + } + elsif ($_ eq 'exec') { + for (@cmd = (); @ARGV && $ARGV[0] ne ';'; push(@cmd,shift)) { } + shift; + $_ = "@cmd"; + if (m#^(/bin/)?rm -f {}$#) { + if (!@ARGV) { + $out .= &tab . 'unlink($_)'; + } + else { + $out .= &tab . '(unlink($_) || 1)'; + } + } + elsif (m#^(/bin/)?rm {}$#) { + $out .= &tab . '(unlink($_) || warn "$name: $!\n")'; + } + else { + for (@cmd) { s/'/\\'/g; } + $" = "','"; + $out .= &tab . "&exec(0, '@cmd')"; + $" = ' '; + $initexec++; + } + } + elsif ($_ eq 'ok') { + for (@cmd = (); @ARGV && $ARGV[0] ne ';'; push(@cmd,shift)) { } + shift; + for (@cmd) { s/'/\\'/g; } + $" = "','"; + $out .= &tab . "&exec(1, '@cmd')"; + $" = ' '; + $initexec++; + } + elsif ($_ eq 'prune') { + $out .= &tab . '($prune = 1)'; + } + elsif ($_ eq 'xdev') { + $out .= &tab . '!($prune |= ($dev != $topdev))'; + } + elsif ($_ eq 'newer') { + $out .= &tab; + $file = shift; + $newername = 'AGE_OF' . $file; + $newername =~ s/[^\w]/_/g; + $newername = '$' . $newername; + $out .= "(-M _ < $newername)"; + $initnewer .= "$newername = -M " . "e($file) . ";\n"; + } + elsif ($_ eq 'eval') { + $prog = "e(shift); + $out .= &tab . "eval $prog"; + } + elsif ($_ eq 'depth') { + $depth++; + next; + } + elsif ($_ eq 'ls') { + $out .= &tab . "&ls"; + $initls++; + } + elsif ($_ eq 'tar') { + $out .= &tab; + die "-tar must have a filename argument\n" unless @ARGV; + $file = shift; + $fh = 'FH' . $file; + $fh =~ s/[^\w]/_/g; + $out .= "&tar($fh)"; + $file = '>' . $file; + $initfile .= "open($fh, " . "e($file) . + qq{) || die "Can't open $fh: \$!\\n";\n}; + $inittar++; + $flushall = "\n&tflushall;\n"; + } + elsif (/^n?cpio$/) { + $depth++; + $out .= &tab; + die "-$_ must have a filename argument\n" unless @ARGV; + $file = shift; + $fh = 'FH' . $file; + $fh =~ s/[^\w]/_/g; + $out .= "&cpio('" . substr($_,0,1) . "', $fh)"; + $file = '>' . $file; + $initfile .= "open($fh, " . "e($file) . + qq{) || die "Can't open $fh: \$!\\n";\n}; + $initcpio++; + $flushall = "\n&flushall;\n"; + } + else { + die "Unrecognized switch: -$_\n"; + } + if (@ARGV) { + if ($ARGV[0] eq '-o') { + { local($statdone) = 1; $out .= "\n" . &tab . "||\n"; } + $statdone = 0 if $indent == 1 && $delayedstat; + $saw_or++; + shift; + } + else { + $out .= " &&" unless $ARGV[0] eq ')'; + $out .= "\n"; + shift if $ARGV[0] eq '-a'; + } + } +} + +print <<"END"; +$startperl + +eval 'exec perl -S \$0 \${1+"\$@"}' + if \$running_under_some_shell; + +END + +if ($initls) { + print <<'END'; +@rwx = ('---','--x','-w-','-wx','r--','r-x','rw-','rwx'); +@moname = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec); + +END +} + +if ($inituser || $initls) { + print 'while (($name, $pw, $uid) = getpwent) {', "\n"; + print ' $uid{$name} = $uid{$uid} = $uid;', "\n" if $inituser; + print ' $user{$uid} = $name unless $user{$uid};', "\n" if $initls; + print "}\n\n"; +} + +if ($initgroup || $initls) { + print 'while (($name, $pw, $gid) = getgrent) {', "\n"; + print ' $gid{$name} = $gid{$gid} = $gid;', "\n" if $initgroup; + print ' $group{$gid} = $name unless $group{$gid};', "\n" if $initls; + print "}\n\n"; +} + +print $initnewer, "\n" if $initnewer; + +print $initfile, "\n" if $initfile; + +$find = $depth ? "finddepth" : "find"; +print <<"END"; +require "$find.pl"; + +# Traverse desired filesystems + +&$find($roots); +$flushall +exit; + +sub wanted { +$out; +} + +END + +if ($initexec) { + print <<'END'; +sub exec { + local($ok, @cmd) = @_; + foreach $word (@cmd) { + $word =~ s#{}#$name#g; + } + if ($ok) { + local($old) = select(STDOUT); + $| = 1; + print "@cmd"; + select($old); + return 0 unless <STDIN> =~ /^y/; + } + chdir $cwd; # sigh + system @cmd; + chdir $dir; + return !$?; +} + +END +} + +if ($initls) { + print <<'END'; +sub ls { + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizemm, + $atime,$mtime,$ctime,$blksize,$blocks) = lstat(_); + + $pname = $name; + + if (defined $blocks) { + $blocks = int(($blocks + 1) / 2); + } + else { + $blocks = int(($size + 1023) / 1024); + } + + if (-f _) { $perms = '-'; } + elsif (-d _) { $perms = 'd'; } + elsif (-c _) { $perms = 'c'; $sizemm = &sizemm; } + elsif (-b _) { $perms = 'b'; $sizemm = &sizemm; } + elsif (-p _) { $perms = 'p'; } + elsif (-S _) { $perms = 's'; } + else { $perms = 'l'; $pname .= ' -> ' . readlink($_); } + + $tmpmode = $mode; + $tmp = $rwx[$tmpmode & 7]; + $tmpmode >>= 3; + $tmp = $rwx[$tmpmode & 7] . $tmp; + $tmpmode >>= 3; + $tmp = $rwx[$tmpmode & 7] . $tmp; + substr($tmp,2,1) =~ tr/-x/Ss/ if -u _; + substr($tmp,5,1) =~ tr/-x/Ss/ if -g _; + substr($tmp,8,1) =~ tr/-x/Tt/ if -k _; + $perms .= $tmp; + + $user = $user{$uid} || $uid; + $group = $group{$gid} || $gid; + + ($sec,$min,$hour,$mday,$mon,$year) = localtime($mtime); + $moname = $moname[$mon]; + if (-M _ > 365.25 / 2) { + $timeyear = $year + 1900; + } + else { + $timeyear = sprintf("%02d:%02d", $hour, $min); + } + + printf "%5lu %4ld %-10s %2d %-8s %-8s %8s %s %2d %5s %s\n", + $ino, + $blocks, + $perms, + $nlink, + $user, + $group, + $sizemm, + $moname, + $mday, + $timeyear, + $pname; + 1; +} + +sub sizemm { + sprintf("%3d, %3d", ($rdev >> 8) & 255, $rdev & 255); +} + +END +} + +if ($initcpio) { +print <<'END'; +sub cpio { + local($nc,$fh) = @_; + local($text); + + if ($name eq 'TRAILER!!!') { + $text = ''; + $size = 0; + } + else { + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = lstat(_); + if (-f _) { + open(IN, "./$_\0") || do { + warn "Couldn't open $name: $!\n"; + return; + }; + } + else { + $text = readlink($_); + $size = 0 unless defined $text; + } + } + + ($nm = $name) =~ s#^\./##; + $nc{$fh} = $nc; + if ($nc eq 'n') { + $cpout{$fh} .= + sprintf("%06o%06o%06o%06o%06o%06o%06o%06o%011lo%06o%011lo%s\0", + 070707, + $dev & 0777777, + $ino & 0777777, + $mode & 0777777, + $uid & 0777777, + $gid & 0777777, + $nlink & 0777777, + $rdev & 0177777, + $mtime, + length($nm)+1, + $size, + $nm); + } + else { + $cpout{$fh} .= "\0" if length($cpout{$fh}) & 1; + $cpout{$fh} .= pack("SSSSSSSSLSLa*", + 070707, $dev, $ino, $mode, $uid, $gid, $nlink, $rdev, $mtime, + length($nm)+1, $size, $nm . (length($nm) & 1 ? "\0" : "\0\0")); + } + if ($text ne '') { + $cpout{$fh} .= $text; + } + elsif ($size) { + &flush($fh) while ($l = length($cpout{$fh})) >= 5120; + while (sysread(IN, $cpout{$fh}, 5120 - $l, $l)) { + &flush($fh); + $l = length($cpout{$fh}); + } + } + close IN; +} + +sub flush { + local($fh) = @_; + + while (length($cpout{$fh}) >= 5120) { + syswrite($fh,$cpout{$fh},5120); + ++$blocks{$fh}; + substr($cpout{$fh}, 0, 5120) = ''; + } +} + +sub flushall { + $name = 'TRAILER!!!'; + foreach $fh (keys %cpout) { + &cpio($nc{$fh},$fh); + $cpout{$fh} .= "0" x (5120 - length($cpout{$fh})); + &flush($fh); + print $blocks{$fh} * 10, " blocks\n"; + } +} + +END +} + +if ($inittar) { +print <<'END'; +sub tar { + local($fh) = @_; + local($linkname,$header,$l,$slop); + local($linkflag) = "\0"; + + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = lstat(_); + $nm = $name; + if ($nlink > 1) { + if ($linkname = $linkseen{$fh,$dev,$ino}) { + $linkflag = 1; + } + else { + $linkseen{$fh,$dev,$ino} = $nm; + } + } + if (-f _) { + open(IN, "./$_\0") || do { + warn "Couldn't open $name: $!\n"; + return; + }; + $size = 0 if $linkflag ne "\0"; + } + else { + $linkname = readlink($_); + $linkflag = 2 if defined $linkname; + $nm .= '/' if -d _; + $size = 0; + } + + $header = pack("a100a8a8a8a12a12a8a1a100", + $nm, + sprintf("%6o ", $mode & 0777), + sprintf("%6o ", $uid & 0777777), + sprintf("%6o ", $gid & 0777777), + sprintf("%11o ", $size), + sprintf("%11o ", $mtime), + " ", + $linkflag, + $linkname); + $l = length($header) % 512; + substr($header, 148, 6) = sprintf("%6o", unpack("%16C*", $header)); + substr($header, 154, 1) = "\0"; # blech + $tarout{$fh} .= $header; + $tarout{$fh} .= "\0" x (512 - $l) if $l; + if ($size) { + &tflush($fh) while ($l = length($tarout{$fh})) >= 10240; + while (sysread(IN, $tarout{$fh}, 10240 - $l, $l)) { + $slop = length($tarout{$fh}) % 512; + $tarout{$fh} .= "\0" x (512 - $slop) if $slop; + &tflush($fh); + $l = length($tarout{$fh}); + } + } + close IN; +} + +sub tflush { + local($fh) = @_; + + while (length($tarout{$fh}) >= 10240) { + syswrite($fh,$tarout{$fh},10240); + ++$blocks{$fh}; + substr($tarout{$fh}, 0, 10240) = ''; + } +} + +sub tflushall { + local($len); + + foreach $fh (keys %tarout) { + $len = 10240 - length($tarout{$fh}); + $len += 10240 if $len < 1024; + $tarout{$fh} .= "\0" x $len; + &tflush($fh); + } +} + +END +} + +exit; + +############################################################################ + +sub tab { + local($tabstring); + + $tabstring = "\t" x ($indent / 2) . ' ' x ($indent % 2 * 4); + if (!$statdone) { + if ($_ =~ /^(name|print|prune|exec|ok|\(|\))/) { + $delayedstat++; + } + else { + if ($saw_or) { + $tabstring .= <<'ENDOFSTAT' . $tabstring; +($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) && +ENDOFSTAT + } + else { + $tabstring .= <<'ENDOFSTAT' . $tabstring; +(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && +ENDOFSTAT + } + $statdone = 1; + } + } + $tabstring =~ s/^\s+/ / if $out =~ /!$/; + $tabstring; +} + +sub fileglob_to_re { + local($tmp) = @_; + + $tmp =~ s#([./^\$()])#\\$1#g; + $tmp =~ s/([?*])/.$1/g; + "^$tmp\$"; +} + +sub n { + local($n) = @_; + + $n =~ s/^-/< / || $n =~ s/^\+/> / || $n =~ s/^/== /; + $n =~ s/ 0*(\d)/ $1/; + $n . ')'; +} + +sub quote { + local($string) = @_; + $string =~ s/'/\\'/; + "'$string'"; +} +!NO!SUBS! + +close OUT or die "Can't close $file: $!"; +chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; +exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; diff --git a/gnu/usr.bin/perl/x2p/handy.h b/gnu/usr.bin/perl/x2p/handy.h new file mode 100644 index 00000000000..0049a1108b4 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/handy.h @@ -0,0 +1,172 @@ +/* handy.h + * + * Copyright (c) 1991-1994, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +#if !defined(__STDC__) +#ifdef NULL +#undef NULL +#endif +#ifndef I286 +# define NULL 0 +#else +# define NULL 0L +#endif +#endif + +#define Null(type) ((type)NULL) +#define Nullch Null(char*) +#define Nullfp Null(FILE*) +#define Nullsv Null(SV*) + +#ifdef UTS +#define bool int +#else +#define bool char +#endif + +#ifdef TRUE +#undef TRUE +#endif +#ifdef FALSE +#undef FALSE +#endif +#define TRUE (1) +#define FALSE (0) + +typedef char I8; +typedef unsigned char U8; + +typedef short I16; +typedef unsigned short U16; + +#if BYTEORDER > 0x4321 + typedef int I32; + typedef unsigned int U32; +#else + typedef long I32; + typedef unsigned long U32; +#endif + +#define Ctl(ch) (ch & 037) + +#define strNE(s1,s2) (strcmp(s1,s2)) +#define strEQ(s1,s2) (!strcmp(s1,s2)) +#define strLT(s1,s2) (strcmp(s1,s2) < 0) +#define strLE(s1,s2) (strcmp(s1,s2) <= 0) +#define strGT(s1,s2) (strcmp(s1,s2) > 0) +#define strGE(s1,s2) (strcmp(s1,s2) >= 0) +#define strnNE(s1,s2,l) (strncmp(s1,s2,l)) +#define strnEQ(s1,s2,l) (!strncmp(s1,s2,l)) + +#ifdef HAS_SETLOCALE /* XXX Is there a better test for this? */ +# ifndef CTYPE256 +# define CTYPE256 +# endif +#endif + +#ifdef USE_NEXT_CTYPE +#define isALNUM(c) (NXIsAlpha((unsigned int)c) || NXIsDigit((unsigned int)c) || c == '_') +#define isIDFIRST(c) (NXIsAlpha((unsigned int)c) || c == '_') +#define isALPHA(c) NXIsAlpha((unsigned int)c) +#define isSPACE(c) NXIsSpace((unsigned int)c) +#define isDIGIT(c) NXIsDigit((unsigned int)c) +#define isUPPER(c) NXIsUpper((unsigned int)c) +#define isLOWER(c) NXIsLower((unsigned int)c) +#define toUPPER(c) NXToUpper((unsigned int)c) +#define toLOWER(c) NXToLower((unsigned int)c) +#else /* USE_NEXT_CTYPE */ +#if defined(CTYPE256) || (!defined(isascii) && !defined(HAS_ISASCII)) +#define isALNUM(c) (isalpha((unsigned char)(c)) || isdigit((unsigned char)(c)) || c == '_') +#define isIDFIRST(c) (isalpha((unsigned char)(c)) || (c) == '_') +#define isALPHA(c) isalpha((unsigned char)(c)) +#define isSPACE(c) isspace((unsigned char)(c)) +#define isDIGIT(c) isdigit((unsigned char)(c)) +#define isUPPER(c) isupper((unsigned char)(c)) +#define isLOWER(c) islower((unsigned char)(c)) +#define toUPPER(c) toupper((unsigned char)(c)) +#define toLOWER(c) tolower((unsigned char)(c)) +#else +#define isALNUM(c) (isascii(c) && (isalpha(c) || isdigit(c) || c == '_')) +#define isIDFIRST(c) (isascii(c) && (isalpha(c) || (c) == '_')) +#define isALPHA(c) (isascii(c) && isalpha(c)) +#define isSPACE(c) (isascii(c) && isspace(c)) +#define isDIGIT(c) (isascii(c) && isdigit(c)) +#define isUPPER(c) (isascii(c) && isupper(c)) +#define isLOWER(c) (isascii(c) && islower(c)) +#define toUPPER(c) toupper(c) +#define toLOWER(c) tolower(c) +#endif +#endif /* USE_NEXT_CTYPE */ + +/* Line numbers are unsigned, 16 bits. */ +typedef U16 line_t; +#ifdef lint +#define NOLINE ((line_t)0) +#else +#define NOLINE ((line_t) 65535) +#endif + +#ifndef lint +#ifndef LEAKTEST +#ifndef safemalloc +Malloc_t safemalloc _((MEM_SIZE)); +Malloc_t saferealloc _((char *, MEM_SIZE)); +void safefree _((char *)); +#endif +#ifndef MSDOS +#define New(x,v,n,t) (v = (t*)safemalloc((MEM_SIZE)((n) * sizeof(t)))) +#define Newc(x,v,n,t,c) (v = (c*)safemalloc((MEM_SIZE)((n) * sizeof(t)))) +#define Newz(x,v,n,t) (v = (t*)safemalloc((MEM_SIZE)((n) * sizeof(t)))), \ + memzero((char*)(v), (n) * sizeof(t)) +#define Renew(v,n,t) (v = (t*)saferealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) +#define Renewc(v,n,t,c) (v = (c*)saferealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) +#else +#define New(x,v,n,t) (v = (t*)safemalloc(((unsigned long)(n) * sizeof(t)))) +#define Newc(x,v,n,t,c) (v = (c*)safemalloc(((unsigned long)(n) * sizeof(t)))) +#define Newz(x,v,n,t) (v = (t*)safemalloc(((unsigned long)(n) * sizeof(t)))), \ + memzero((char*)(v), (n) * sizeof(t)) +#define Renew(v,n,t) (v = (t*)saferealloc((char*)(v),((unsigned long)(n)*sizeof(t)))) +#define Renewc(v,n,t,c) (v = (c*)saferealloc((char*)(v),((unsigned long)(n)*sizeof(t)))) +#endif /* MSDOS */ +#define Safefree(d) safefree((char*)d) +#define NEWSV(x,len) newSV(len) +#else /* LEAKTEST */ +char *safexmalloc(); +char *safexrealloc(); +void safexfree(); +#define New(x,v,n,t) (v = (t*)safexmalloc(x,(MEM_SIZE)((n) * sizeof(t)))) +#define Newc(x,v,n,t,c) (v = (c*)safexmalloc(x,(MEM_SIZE)((n) * sizeof(t)))) +#define Newz(x,v,n,t) (v = (t*)safexmalloc(x,(MEM_SIZE)((n) * sizeof(t)))), \ + memzero((char*)(v), (n) * sizeof(t)) +#define Renew(v,n,t) (v = (t*)safexrealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) +#define Renewc(v,n,t,c) (v = (c*)safexrealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) +#define Safefree(d) safexfree((char*)d) +#define NEWSV(x,len) newSV(x,len) +#define MAXXCOUNT 1200 +long xcount[MAXXCOUNT]; +long lastxcount[MAXXCOUNT]; +#endif /* LEAKTEST */ +#define Move(s,d,n,t) (void)memmove((char*)(d),(char*)(s), (n) * sizeof(t)) +#define Copy(s,d,n,t) (void)memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) +#define Zero(d,n,t) (void)memzero((char*)(d), (n) * sizeof(t)) +#else /* lint */ +#define New(x,v,n,s) (v = Null(s *)) +#define Newc(x,v,n,s,c) (v = Null(s *)) +#define Newz(x,v,n,s) (v = Null(s *)) +#define Renew(v,n,s) (v = Null(s *)) +#define Move(s,d,n,t) +#define Copy(s,d,n,t) +#define Zero(d,n,t) +#define Safefree(d) d = d +#endif /* lint */ + +#ifdef USE_STRUCT_COPY +#define StructCopy(s,d,t) *((t*)(d)) = *((t*)(s)) +#else +#define StructCopy(s,d,t) Copy(s,d,1,t) +#endif diff --git a/gnu/usr.bin/perl/x2p/hash.c b/gnu/usr.bin/perl/x2p/hash.c new file mode 100644 index 00000000000..58236f49e42 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/hash.c @@ -0,0 +1,242 @@ +/* $RCSfile: hash.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:20 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: hash.c,v $ + */ + +#include <stdio.h> +#include "EXTERN.h" +#include "a2p.h" +#include "util.h" + +STR * +hfetch(tb,key) +register HASH *tb; +char *key; +{ + register char *s; + register int i; + register int hash; + register HENT *entry; + + if (!tb) + return Nullstr; + for (s=key, i=0, hash = 0; + /* while */ *s; + s++, i++, hash *= 5) { + hash += *s * coeff[i]; + } + entry = tb->tbl_array[hash & tb->tbl_max]; + for (; entry; entry = entry->hent_next) { + if (entry->hent_hash != hash) /* strings can't be equal */ + continue; + if (strNE(entry->hent_key,key)) /* is this it? */ + continue; + return entry->hent_val; + } + return Nullstr; +} + +bool +hstore(tb,key,val) +register HASH *tb; +char *key; +STR *val; +{ + register char *s; + register int i; + register int hash; + register HENT *entry; + register HENT **oentry; + + if (!tb) + return FALSE; + for (s=key, i=0, hash = 0; + /* while */ *s; + s++, i++, hash *= 5) { + hash += *s * coeff[i]; + } + + oentry = &(tb->tbl_array[hash & tb->tbl_max]); + i = 1; + + for (entry = *oentry; entry; i=0, entry = entry->hent_next) { + if (entry->hent_hash != hash) /* strings can't be equal */ + continue; + if (strNE(entry->hent_key,key)) /* is this it? */ + continue; + /*NOSTRICT*/ + Safefree(entry->hent_val); + entry->hent_val = val; + return TRUE; + } + /*NOSTRICT*/ + entry = (HENT*) safemalloc(sizeof(HENT)); + + entry->hent_key = savestr(key); + entry->hent_val = val; + entry->hent_hash = hash; + entry->hent_next = *oentry; + *oentry = entry; + + if (i) { /* initial entry? */ + tb->tbl_fill++; + if ((tb->tbl_fill * 100 / (tb->tbl_max + 1)) > FILLPCT) + hsplit(tb); + } + + return FALSE; +} + +#ifdef NOTUSED +bool +hdelete(tb,key) +register HASH *tb; +char *key; +{ + register char *s; + register int i; + register int hash; + register HENT *entry; + register HENT **oentry; + + if (!tb) + return FALSE; + for (s=key, i=0, hash = 0; + /* while */ *s; + s++, i++, hash *= 5) { + hash += *s * coeff[i]; + } + + oentry = &(tb->tbl_array[hash & tb->tbl_max]); + entry = *oentry; + i = 1; + for (; entry; i=0, oentry = &entry->hent_next, entry = entry->hent_next) { + if (entry->hent_hash != hash) /* strings can't be equal */ + continue; + if (strNE(entry->hent_key,key)) /* is this it? */ + continue; + safefree((char*)entry->hent_val); + safefree(entry->hent_key); + *oentry = entry->hent_next; + safefree((char*)entry); + if (i) + tb->tbl_fill--; + return TRUE; + } + return FALSE; +} +#endif + +void +hsplit(tb) +HASH *tb; +{ + int oldsize = tb->tbl_max + 1; + register int newsize = oldsize * 2; + register int i; + register HENT **a; + register HENT **b; + register HENT *entry; + register HENT **oentry; + + a = (HENT**) saferealloc((char*)tb->tbl_array, newsize * sizeof(HENT*)); + bzero((char*)&a[oldsize], oldsize * sizeof(HENT*)); /* zero second half */ + tb->tbl_max = --newsize; + tb->tbl_array = a; + + for (i=0; i<oldsize; i++,a++) { + if (!*a) /* non-existent */ + continue; + b = a+oldsize; + for (oentry = a, entry = *a; entry; entry = *oentry) { + if ((entry->hent_hash & newsize) != i) { + *oentry = entry->hent_next; + entry->hent_next = *b; + if (!*b) + tb->tbl_fill++; + *b = entry; + continue; + } + else + oentry = &entry->hent_next; + } + if (!*a) /* everything moved */ + tb->tbl_fill--; + } +} + +HASH * +hnew() +{ + register HASH *tb = (HASH*)safemalloc(sizeof(HASH)); + + tb->tbl_array = (HENT**) safemalloc(8 * sizeof(HENT*)); + tb->tbl_fill = 0; + tb->tbl_max = 7; + hiterinit(tb); /* so each() will start off right */ + bzero((char*)tb->tbl_array, 8 * sizeof(HENT*)); + return tb; +} + +#ifdef NOTUSED +hshow(tb) +register HASH *tb; +{ + fprintf(stderr,"%5d %4d (%2d%%)\n", + tb->tbl_max+1, + tb->tbl_fill, + tb->tbl_fill * 100 / (tb->tbl_max+1)); +} +#endif + +int +hiterinit(tb) +register HASH *tb; +{ + tb->tbl_riter = -1; + tb->tbl_eiter = Null(HENT*); + return tb->tbl_fill; +} + +HENT * +hiternext(tb) +register HASH *tb; +{ + register HENT *entry; + + entry = tb->tbl_eiter; + do { + if (entry) + entry = entry->hent_next; + if (!entry) { + tb->tbl_riter++; + if (tb->tbl_riter > tb->tbl_max) { + tb->tbl_riter = -1; + break; + } + entry = tb->tbl_array[tb->tbl_riter]; + } + } while (!entry); + + tb->tbl_eiter = entry; + return entry; +} + +char * +hiterkey(entry) +register HENT *entry; +{ + return entry->hent_key; +} + +STR * +hiterval(entry) +register HENT *entry; +{ + return entry->hent_val; +} diff --git a/gnu/usr.bin/perl/x2p/hash.h b/gnu/usr.bin/perl/x2p/hash.h new file mode 100644 index 00000000000..f61a29f4e62 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/hash.h @@ -0,0 +1,52 @@ +/* $RCSfile: hash.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:21 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: hash.h,v $ + */ + +#define FILLPCT 60 /* don't make greater than 99 */ + +#ifdef DOINIT +char coeff[] = { + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, + 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1}; +#else +extern char coeff[]; +#endif + +typedef struct hentry HENT; + +struct hentry { + HENT *hent_next; + char *hent_key; + STR *hent_val; + int hent_hash; +}; + +struct htbl { + HENT **tbl_array; + int tbl_max; + int tbl_fill; + int tbl_riter; /* current root of iterator */ + HENT *tbl_eiter; /* current entry of iterator */ +}; + +bool hdelete _((HASH *tb, char *key)); +STR * hfetch _(( HASH *tb, char *key )); +int hiterinit _(( HASH *tb )); +char * hiterkey _(( HENT *entry )); +HENT * hiternext _(( HASH *tb )); +STR * hiterval _(( HENT *entry )); +HASH * hnew _(( void )); +void hsplit _(( HASH *tb )); +bool hstore _(( HASH *tb, char *key, STR *val )); diff --git a/gnu/usr.bin/perl/x2p/s2p.PL b/gnu/usr.bin/perl/x2p/s2p.PL new file mode 100644 index 00000000000..29864b418a6 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/s2p.PL @@ -0,0 +1,781 @@ +#!/usr/local/bin/perl + +use Config; +use File::Basename qw(&basename &dirname); + +# List explicitly here the variables you want Configure to +# generate. Metaconfig only looks for shell variables, so you +# have to mention them as if they were shell variables, not +# %Config entries. Thus you write +# $startperl +# to ensure Configure will look for $Config{startperl}. + +# This forces PL files to create target in same directory as PL file. +# This is so that make depend always knows where to find PL derivatives. +chdir(dirname($0)); +($file = basename($0)) =~ s/\.PL$//; +$file =~ s/\.pl$// + if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving" + +open OUT,">$file" or die "Can't create $file: $!"; + +print "Extracting $file (with variable substitutions)\n"; + +# In this section, perl variables will be expanded during extraction. +# You can use $Config{...} to use Configure variables. + +print OUT <<"!GROK!THIS!"; +$Config{'startperl'} + eval 'exec perl -S \$0 "\$@"' + if 0; +\$startperl = "$Config{startperl}"; +!GROK!THIS! + +# In the following, perl variables are not expanded during extraction. + +print OUT <<'!NO!SUBS!'; + +# $RCSfile: s2p.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:23 $ +# +# $Log: s2p.SH,v $ + +$indent = 4; +$shiftwidth = 4; +$l = '{'; $r = '}'; + +while ($ARGV[0] =~ /^-/) { + $_ = shift; + last if /^--/; + if (/^-D/) { + $debug++; + open(BODY,'>-'); + next; + } + if (/^-n/) { + $assumen++; + next; + } + if (/^-p/) { + $assumep++; + next; + } + die "I don't recognize this switch: $_\n"; +} + +unless ($debug) { + open(BODY,">/tmp/sperl$$") || + &Die("Can't open temp file: $!\n"); +} + +if (!$assumen && !$assumep) { + print BODY &q(<<'EOT'); +: while ($ARGV[0] =~ /^-/) { +: $_ = shift; +: last if /^--/; +: if (/^-n/) { +: $nflag++; +: next; +: } +: die "I don't recognize this switch: $_\\n"; +: } +: +EOT +} + +print BODY &q(<<'EOT'); +: #ifdef PRINTIT +: #ifdef ASSUMEP +: $printit++; +: #else +: $printit++ unless $nflag; +: #endif +: #endif +: <><> +: $\ = "\n"; # automatically add newline on print +: <><> +: #ifdef TOPLABEL +: LINE: +: while (chop($_ = <>)) { +: #else +: LINE: +: while (<>) { +: chop; +: #endif +EOT + +LINE: +while (<>) { + + # Wipe out surrounding whitespace. + + s/[ \t]*(.*)\n$/$1/; + + # Perhaps it's a label/comment. + + if (/^:/) { + s/^:[ \t]*//; + $label = &make_label($_); + if ($. == 1) { + $toplabel = $label; + if (/^(top|(re)?start|redo|begin(ning)|again|input)$/i) { + $_ = <>; + redo LINE; # Never referenced, so delete it if not a comment. + } + } + $_ = "$label:"; + if ($lastlinewaslabel++) { + $indent += 4; + print BODY &tab, ";\n"; + $indent -= 4; + } + if ($indent >= 2) { + $indent -= 2; + $indmod = 2; + } + next; + } else { + $lastlinewaslabel = ''; + } + + # Look for one or two address clauses + + $addr1 = ''; + $addr2 = ''; + if (s/^([0-9]+)//) { + $addr1 = "$1"; + $addr1 = "\$. == $addr1" unless /^,/; + } + elsif (s/^\$//) { + $addr1 = 'eof()'; + } + elsif (s|^/||) { + $addr1 = &fetchpat('/'); + } + if (s/^,//) { + if (s/^([0-9]+)//) { + $addr2 = "$1"; + } elsif (s/^\$//) { + $addr2 = "eof()"; + } elsif (s|^/||) { + $addr2 = &fetchpat('/'); + } else { + &Die("Invalid second address at line $.\n"); + } + if ($addr2 =~ /^\d+$/) { + $addr1 .= "..$addr2"; + } + else { + $addr1 .= "...$addr2"; + } + } + + # Now we check for metacommands {, }, and ! and worry + # about indentation. + + s/^[ \t]+//; + # a { to keep vi happy + if ($_ eq '}') { + $indent -= 4; + next; + } + if (s/^!//) { + $if = 'unless'; + $else = "$r else $l\n"; + } else { + $if = 'if'; + $else = ''; + } + if (s/^{//) { # a } to keep vi happy + $indmod = 4; + $redo = $_; + $_ = ''; + $rmaybe = ''; + } else { + $rmaybe = "\n$r"; + if ($addr2 || $addr1) { + $space = ' ' x $shiftwidth; + } else { + $space = ''; + } + $_ = &transmogrify(); + } + + # See if we can optimize to modifier form. + + if ($addr1) { + if ($_ !~ /[\n{}]/ && $rmaybe && !$change && + $_ !~ / if / && $_ !~ / unless /) { + s/;$/ $if $addr1;/; + $_ = substr($_,$shiftwidth,1000); + } else { + $_ = "$if ($addr1) $l\n$change$_$rmaybe"; + } + $change = ''; + next LINE; + } +} continue { + @lines = split(/\n/,$_); + for (@lines) { + unless (s/^ *<<--//) { + print BODY &tab; + } + print BODY $_, "\n"; + } + $indent += $indmod; + $indmod = 0; + if ($redo) { + $_ = $redo; + $redo = ''; + redo LINE; + } +} +if ($lastlinewaslabel++) { + $indent += 4; + print BODY &tab, ";\n"; + $indent -= 4; +} + +if ($appendseen || $tseen || !$assumen) { + $printit++ if $dseen || (!$assumen && !$assumep); + print BODY &q(<<'EOT'); +: #ifdef SAWNEXT +: } +: continue { +: #endif +: #ifdef PRINTIT +: #ifdef DSEEN +: #ifdef ASSUMEP +: print if $printit++; +: #else +: if ($printit) +: { print; } +: else +: { $printit++ unless $nflag; } +: #endif +: #else +: print if $printit; +: #endif +: #else +: print; +: #endif +: #ifdef TSEEN +: $tflag = 0; +: #endif +: #ifdef APPENDSEEN +: if ($atext) { chop $atext; print $atext; $atext = ''; } +: #endif +EOT + +print BODY &q(<<'EOT'); +: } +EOT +} + +close BODY; + +unless ($debug) { + open(HEAD,">/tmp/sperl2$$.c") + || &Die("Can't open temp file 2: $!\n"); + print HEAD "#define PRINTIT\n" if $printit; + print HEAD "#define APPENDSEEN\n" if $appendseen; + print HEAD "#define TSEEN\n" if $tseen; + print HEAD "#define DSEEN\n" if $dseen; + print HEAD "#define ASSUMEN\n" if $assumen; + print HEAD "#define ASSUMEP\n" if $assumep; + print HEAD "#define TOPLABEL\n" if $toplabel; + print HEAD "#define SAWNEXT\n" if $sawnext; + if ($opens) {print HEAD "$opens\n";} + open(BODY,"/tmp/sperl$$") + || &Die("Can't reopen temp file: $!\n"); + while (<BODY>) { + print HEAD $_; + } + close HEAD; + + print &q(<<"EOT"); +: $startperl +: eval 'exec perl -S \$0 \${1+"\$@"}' +: if \$running_under_some_shell; +: +EOT + open(BODY,"cc -E /tmp/sperl2$$.c |") || + &Die("Can't reopen temp file: $!\n"); + while (<BODY>) { + /^# [0-9]/ && next; + /^[ \t]*$/ && next; + s/^<><>//; + print; + } +} + +&Cleanup; +exit; + +sub Cleanup { + chdir "/tmp"; + unlink "sperl$$", "sperl2$$", "sperl2$$.c"; +} +sub Die { + &Cleanup; + die $_[0]; +} +sub tab { + "\t" x ($indent / 8) . ' ' x ($indent % 8); +} +sub make_filehandle { + local($_) = $_[0]; + local($fname) = $_; + if (!$seen{$fname}) { + $_ = "FH_" . $_ if /^\d/; + s/[^a-zA-Z0-9]/_/g; + s/^_*//; + $_ = "\U$_"; + if ($fhseen{$_}) { + for ($tmp = "a"; $fhseen{"$_$tmp"}; $a++) {} + $_ .= $tmp; + } + $fhseen{$_} = 1; + $opens .= &q(<<"EOT"); +: open($_, '>$fname') || die "Can't create $fname: \$!"; +EOT + $seen{$fname} = $_; + } + $seen{$fname}; +} + +sub make_label { + local($label) = @_; + $label =~ s/[^a-zA-Z0-9]/_/g; + if ($label =~ /^[0-9_]/) { $label = 'L' . $label; } + $label = substr($label,0,8); + + # Could be a reserved word, so capitalize it. + substr($label,0,1) =~ y/a-z/A-Z/ + if $label =~ /^[a-z]/; + + $label; +} + +sub transmogrify { + { # case + if (/^d/) { + $dseen++; + chop($_ = &q(<<'EOT')); +: <<--#ifdef PRINTIT +: $printit = 0; +: <<--#endif +: next LINE; +EOT + $sawnext++; + next; + } + + if (/^n/) { + chop($_ = &q(<<'EOT')); +: <<--#ifdef PRINTIT +: <<--#ifdef DSEEN +: <<--#ifdef ASSUMEP +: print if $printit++; +: <<--#else +: if ($printit) +: { print; } +: else +: { $printit++ unless $nflag; } +: <<--#endif +: <<--#else +: print if $printit; +: <<--#endif +: <<--#else +: print; +: <<--#endif +: <<--#ifdef APPENDSEEN +: if ($atext) {chop $atext; print $atext; $atext = '';} +: <<--#endif +: $_ = <>; +: chop; +: <<--#ifdef TSEEN +: $tflag = 0; +: <<--#endif +EOT + next; + } + + if (/^a/) { + $appendseen++; + $command = $space . "\$atext .= <<'End_Of_Text';\n<<--"; + $lastline = 0; + while (<>) { + s/^[ \t]*//; + s/^[\\]//; + unless (s|\\$||) { $lastline = 1;} + s/^([ \t]*\n)/<><>$1/; + $command .= $_; + $command .= '<<--'; + last if $lastline; + } + $_ = $command . "End_Of_Text"; + last; + } + + if (/^[ic]/) { + if (/^c/) { $change = 1; } + $addr1 = 1 if $addr1 eq ''; + $addr1 = '$iter = (' . $addr1 . ')'; + $command = $space . + " if (\$iter == 1) { print <<'End_Of_Text'; }\n<<--"; + $lastline = 0; + while (<>) { + s/^[ \t]*//; + s/^[\\]//; + unless (s/\\$//) { $lastline = 1;} + s/'/\\'/g; + s/^([ \t]*\n)/<><>$1/; + $command .= $_; + $command .= '<<--'; + last if $lastline; + } + $_ = $command . "End_Of_Text"; + if ($change) { + $dseen++; + $change = "$_\n"; + chop($_ = &q(<<"EOT")); +: <<--#ifdef PRINTIT +: $space\$printit = 0; +: <<--#endif +: ${space}next LINE; +EOT + $sawnext++; + } + last; + } + + if (/^s/) { + $delim = substr($_,1,1); + $len = length($_); + $repl = $end = 0; + $inbracket = 0; + for ($i = 2; $i < $len; $i++) { + $c = substr($_,$i,1); + if ($c eq $delim) { + if ($inbracket) { + substr($_, $i, 0) = '\\'; + $i++; + $len++; + } + else { + if ($repl) { + $end = $i; + last; + } else { + $repl = $i; + } + } + } + elsif ($c eq '\\') { + $i++; + if ($i >= $len) { + $_ .= 'n'; + $_ .= <>; + $len = length($_); + $_ = substr($_,0,--$len); + } + elsif (substr($_,$i,1) =~ /^[n]$/) { + ; + } + elsif (!$repl && + substr($_,$i,1) =~ /^[(){}\w]$/) { + $i--; + $len--; + substr($_, $i, 1) = ''; + } + elsif (!$repl && + substr($_,$i,1) =~ /^[<>]$/) { + substr($_,$i,1) = 'b'; + } + elsif ($repl && substr($_,$i,1) =~ /^\d$/) { + substr($_,$i-1,1) = '$'; + } + } + elsif ($c eq '&' && $repl) { + substr($_, $i, 0) = '$'; + $i++; + $len++; + } + elsif ($c eq '$' && $repl) { + substr($_, $i, 0) = '\\'; + $i++; + $len++; + } + elsif ($c eq '[' && !$repl) { + $i++ if substr($_,$i,1) eq '^'; + $i++ if substr($_,$i,1) eq ']'; + $inbracket = 1; + } + elsif ($c eq ']') { + $inbracket = 0; + } + elsif ($c eq "\t") { + substr($_, $i, 1) = '\\t'; + $i++; + $len++; + } + elsif (!$repl && index("()+",$c) >= 0) { + substr($_, $i, 0) = '\\'; + $i++; + $len++; + } + } + &Die("Malformed substitution at line $.\n") + unless $end; + $pat = substr($_, 0, $repl + 1); + $repl = substr($_, $repl+1, $end-$repl-1); + $end = substr($_, $end + 1, 1000); + &simplify($pat); + $dol = '$'; + $subst = "$pat$repl$delim"; + $cmd = ''; + while ($end) { + if ($end =~ s/^g//) { + $subst .= 'g'; + next; + } + if ($end =~ s/^p//) { + $cmd .= ' && (print)'; + next; + } + if ($end =~ s/^w[ \t]*//) { + $fh = &make_filehandle($end); + $cmd .= " && (print $fh \$_)"; + $end = ''; + next; + } + &Die("Unrecognized substitution command". + "($end) at line $.\n"); + } + chop ($_ = &q(<<"EOT")); +: <<--#ifdef TSEEN +: $subst && \$tflag++$cmd; +: <<--#else +: $subst$cmd; +: <<--#endif +EOT + next; + } + + if (/^p/) { + $_ = 'print;'; + next; + } + + if (/^w/) { + s/^w[ \t]*//; + $fh = &make_filehandle($_); + $_ = "print $fh \$_;"; + next; + } + + if (/^r/) { + $appendseen++; + s/^r[ \t]*//; + $file = $_; + $_ = "\$atext .= `cat $file 2>/dev/null`;"; + next; + } + + if (/^P/) { + $_ = 'print $1 if /^(.*)/;'; + next; + } + + if (/^D/) { + chop($_ = &q(<<'EOT')); +: s/^.*\n?//; +: redo LINE if $_; +: next LINE; +EOT + $sawnext++; + next; + } + + if (/^N/) { + chop($_ = &q(<<'EOT')); +: $_ .= "\n"; +: $len1 = length; +: $_ .= <>; +: chop if $len1 < length; +: <<--#ifdef TSEEN +: $tflag = 0; +: <<--#endif +EOT + next; + } + + if (/^h/) { + $_ = '$hold = $_;'; + next; + } + + if (/^H/) { + $_ = '$hold .= "\n"; $hold .= $_;'; + next; + } + + if (/^g/) { + $_ = '$_ = $hold;'; + next; + } + + if (/^G/) { + $_ = '$_ .= "\n"; $_ .= $hold;'; + next; + } + + if (/^x/) { + $_ = '($_, $hold) = ($hold, $_);'; + next; + } + + if (/^b$/) { + $_ = 'next LINE;'; + $sawnext++; + next; + } + + if (/^b/) { + s/^b[ \t]*//; + $lab = &make_label($_); + if ($lab eq $toplabel) { + $_ = 'redo LINE;'; + } else { + $_ = "goto $lab;"; + } + next; + } + + if (/^t$/) { + $_ = 'next LINE if $tflag;'; + $sawnext++; + $tseen++; + next; + } + + if (/^t/) { + s/^t[ \t]*//; + $lab = &make_label($_); + $_ = q/if ($tflag) {$tflag = 0; /; + if ($lab eq $toplabel) { + $_ .= 'redo LINE;}'; + } else { + $_ .= "goto $lab;}"; + } + $tseen++; + next; + } + + if (/^y/) { + s/abcdefghijklmnopqrstuvwxyz/a-z/g; + s/ABCDEFGHIJKLMNOPQRSTUVWXYZ/A-Z/g; + s/abcdef/a-f/g; + s/ABCDEF/A-F/g; + s/0123456789/0-9/g; + s/01234567/0-7/g; + $_ .= ';'; + } + + if (/^=/) { + $_ = 'print $.;'; + next; + } + + if (/^q/) { + chop($_ = &q(<<'EOT')); +: close(ARGV); +: @ARGV = (); +: next LINE; +EOT + $sawnext++; + next; + } + } continue { + if ($space) { + s/^/$space/; + s/(\n)(.)/$1$space$2/g; + } + last; + } + $_; +} + +sub fetchpat { + local($outer) = @_; + local($addr) = $outer; + local($inbracket); + local($prefix,$delim,$ch); + + # Process pattern one potential delimiter at a time. + + DELIM: while (s#^([^\]+(|)[\\/]*)([]+(|)[\\/])##) { + $prefix = $1; + $delim = $2; + if ($delim eq '\\') { + s/(.)//; + $ch = $1; + $delim = '' if $ch =~ /^[(){}A-Za-mo-z]$/; + $ch = 'b' if $ch =~ /^[<>]$/; + $delim .= $ch; + } + elsif ($delim eq '[') { + $inbracket = 1; + s/^\^// && ($delim .= '^'); + s/^]// && ($delim .= ']'); + } + elsif ($delim eq ']') { + $inbracket = 0; + } + elsif ($inbracket || $delim ne $outer) { + $delim = '\\' . $delim; + } + $addr .= $prefix; + $addr .= $delim; + if ($delim eq $outer && !$inbracket) { + last DELIM; + } + } + $addr =~ s/\t/\\t/g; + &simplify($addr); + $addr; +} + +sub q { + local($string) = @_; + local($*) = 1; + $string =~ s/^:\t?//g; + $string; +} + +sub simplify { + $_[0] =~ s/_a-za-z0-9/\\w/ig; + $_[0] =~ s/a-z_a-z0-9/\\w/ig; + $_[0] =~ s/a-za-z_0-9/\\w/ig; + $_[0] =~ s/a-za-z0-9_/\\w/ig; + $_[0] =~ s/_0-9a-za-z/\\w/ig; + $_[0] =~ s/0-9_a-za-z/\\w/ig; + $_[0] =~ s/0-9a-z_a-z/\\w/ig; + $_[0] =~ s/0-9a-za-z_/\\w/ig; + $_[0] =~ s/\[\\w\]/\\w/g; + $_[0] =~ s/\[^\\w\]/\\W/g; + $_[0] =~ s/\[0-9\]/\\d/g; + $_[0] =~ s/\[^0-9\]/\\D/g; + $_[0] =~ s/\\d\\d\*/\\d+/g; + $_[0] =~ s/\\D\\D\*/\\D+/g; + $_[0] =~ s/\\w\\w\*/\\w+/g; + $_[0] =~ s/\\t\\t\*/\\t+/g; + $_[0] =~ s/(\[.[^]]*\])\1\*/$1+/g; + $_[0] =~ s/([\w\s!@#%^&-=,:;'"])\1\*/$1+/g; +} + +!NO!SUBS! + +close OUT or die "Can't close $file: $!"; +chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; +exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; diff --git a/gnu/usr.bin/perl/x2p/s2p.man b/gnu/usr.bin/perl/x2p/s2p.man new file mode 100644 index 00000000000..7ddc718380f --- /dev/null +++ b/gnu/usr.bin/perl/x2p/s2p.man @@ -0,0 +1,95 @@ +.rn '' }` +''' $RCSfile: s2p.man,v $$Revision: 1.1 $$Date: 1996/08/19 10:13:36 $ +''' +''' $Log: s2p.man,v $ +''' Revision 1.1 1996/08/19 10:13:36 downsj +''' Initial revision +''' +.de Sh +.br +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp +.if t .sp .5v +.if n .sp +.. +.de Ip +.br +.ie \\n.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +''' +''' Set up \*(-- to give an unbreakable dash; +''' string Tr holds user defined translation string. +''' Bell System Logo is used as a dummy character. +''' +.tr \(*W-|\(bv\*(Tr +.ie n \{\ +.ds -- \(*W- +.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +.ds L" "" +.ds R" "" +.ds L' ' +.ds R' ' +'br\} +.el\{\ +.ds -- \(em\| +.tr \*(Tr +.ds L" `` +.ds R" '' +.ds L' ` +.ds R' ' +'br\} +.TH S2P 1 NEW +.SH NAME +s2p - Sed to Perl translator +.SH SYNOPSIS +.B s2p [options] filename +.SH DESCRIPTION +.I S2p +takes a sed script specified on the command line (or from standard input) +and produces a comparable +.I perl +script on the standard output. +.Sh "Options" +Options include: +.TP 5 +.B \-D<number> +sets debugging flags. +.TP 5 +.B \-n +specifies that this sed script was always invoked with a sed -n. +Otherwise a switch parser is prepended to the front of the script. +.TP 5 +.B \-p +specifies that this sed script was never invoked with a sed -n. +Otherwise a switch parser is prepended to the front of the script. +.Sh "Considerations" +The perl script produced looks very sed-ish, and there may very well be +better ways to express what you want to do in perl. +For instance, s2p does not make any use of the split operator, but you might +want to. +.PP +The perl script you end up with may be either faster or slower than the original +sed script. +If you're only interested in speed you'll just have to try it both ways. +Of course, if you want to do something sed doesn't do, you have no choice. +It's often possible to speed up the perl script by various methods, such +as deleting all references to $\e and chop. +.SH ENVIRONMENT +S2p uses no environment variables. +.SH AUTHOR +Larry Wall <lwall@jpl-devvax.Jpl.Nasa.Gov> +.SH FILES +.SH SEE ALSO +perl The perl compiler/interpreter +.br +a2p awk to perl translator +.SH DIAGNOSTICS +.SH BUGS +.rn }` '' diff --git a/gnu/usr.bin/perl/x2p/str.c b/gnu/usr.bin/perl/x2p/str.c new file mode 100644 index 00000000000..e9dd34400f0 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/str.c @@ -0,0 +1,468 @@ +/* $RCSfile: str.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:26 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: str.c,v $ + */ + +#include "EXTERN.h" +#include "a2p.h" +#include "util.h" + +void +str_numset(str,num) +register STR *str; +double num; +{ + str->str_nval = num; + str->str_pok = 0; /* invalidate pointer */ + str->str_nok = 1; /* validate number */ +} + +char * +str_2ptr(str) +register STR *str; +{ + register char *s; + + if (!str) + return ""; + GROWSTR(&(str->str_ptr), &(str->str_len), 24); + s = str->str_ptr; + if (str->str_nok) { + sprintf(s,"%.20g",str->str_nval); + while (*s) s++; + } + *s = '\0'; + str->str_cur = s - str->str_ptr; + str->str_pok = 1; +#ifdef DEBUGGING + if (debug & 32) + fprintf(stderr,"0x%lx ptr(%s)\n",str,str->str_ptr); +#endif + return str->str_ptr; +} + +double +str_2num(str) +register STR *str; +{ + if (!str) + return 0.0; + if (str->str_len && str->str_pok) + str->str_nval = atof(str->str_ptr); + else + str->str_nval = 0.0; + str->str_nok = 1; +#ifdef DEBUGGING + if (debug & 32) + fprintf(stderr,"0x%lx num(%g)\n",str,str->str_nval); +#endif + return str->str_nval; +} + +void +str_sset(dstr,sstr) +STR *dstr; +register STR *sstr; +{ + if (!sstr) + str_nset(dstr,No,0); + else if (sstr->str_nok) + str_numset(dstr,sstr->str_nval); + else if (sstr->str_pok) + str_nset(dstr,sstr->str_ptr,sstr->str_cur); + else + str_nset(dstr,"",0); +} + +void +str_nset(str,ptr,len) +register STR *str; +register char *ptr; +register int len; +{ + GROWSTR(&(str->str_ptr), &(str->str_len), len + 1); + bcopy(ptr,str->str_ptr,len); + str->str_cur = len; + *(str->str_ptr+str->str_cur) = '\0'; + str->str_nok = 0; /* invalidate number */ + str->str_pok = 1; /* validate pointer */ +} + +void +str_set(str,ptr) +register STR *str; +register char *ptr; +{ + register int len; + + if (!ptr) + ptr = ""; + len = strlen(ptr); + GROWSTR(&(str->str_ptr), &(str->str_len), len + 1); + bcopy(ptr,str->str_ptr,len+1); + str->str_cur = len; + str->str_nok = 0; /* invalidate number */ + str->str_pok = 1; /* validate pointer */ +} + +void +str_chop(str,ptr) /* like set but assuming ptr is in str */ +register STR *str; +register char *ptr; +{ + if (!(str->str_pok)) + str_2ptr(str); + str->str_cur -= (ptr - str->str_ptr); + bcopy(ptr,str->str_ptr, str->str_cur + 1); + str->str_nok = 0; /* invalidate number */ + str->str_pok = 1; /* validate pointer */ +} + +void +str_ncat(str,ptr,len) +register STR *str; +register char *ptr; +register int len; +{ + if (!(str->str_pok)) + str_2ptr(str); + GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1); + bcopy(ptr,str->str_ptr+str->str_cur,len); + str->str_cur += len; + *(str->str_ptr+str->str_cur) = '\0'; + str->str_nok = 0; /* invalidate number */ + str->str_pok = 1; /* validate pointer */ +} + +void +str_scat(dstr,sstr) +STR *dstr; +register STR *sstr; +{ + if (!(sstr->str_pok)) + str_2ptr(sstr); + if (sstr) + str_ncat(dstr,sstr->str_ptr,sstr->str_cur); +} + +void +str_cat(str,ptr) +register STR *str; +register char *ptr; +{ + register int len; + + if (!ptr) + return; + if (!(str->str_pok)) + str_2ptr(str); + len = strlen(ptr); + GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1); + bcopy(ptr,str->str_ptr+str->str_cur,len+1); + str->str_cur += len; + str->str_nok = 0; /* invalidate number */ + str->str_pok = 1; /* validate pointer */ +} + +char * +str_append_till(str,from,delim,keeplist) +register STR *str; +register char *from; +register int delim; +char *keeplist; +{ + register char *to; + register int len; + + if (!from) + return Nullch; + len = strlen(from); + GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1); + str->str_nok = 0; /* invalidate number */ + str->str_pok = 1; /* validate pointer */ + to = str->str_ptr+str->str_cur; + for (; *from; from++,to++) { + if (*from == '\\' && from[1] && delim != '\\') { + if (!keeplist) { + if (from[1] == delim || from[1] == '\\') + from++; + else + *to++ = *from++; + } + else if (strchr(keeplist,from[1])) + *to++ = *from++; + else + from++; + } + else if (*from == delim) + break; + *to = *from; + } + *to = '\0'; + str->str_cur = to - str->str_ptr; + return from; +} + +STR * +str_new(len) +int len; +{ + register STR *str; + + if (freestrroot) { + str = freestrroot; + freestrroot = str->str_link.str_next; + } + else { + str = (STR *) safemalloc(sizeof(STR)); + bzero((char*)str,sizeof(STR)); + } + if (len) + GROWSTR(&(str->str_ptr), &(str->str_len), len + 1); + return str; +} + +void +str_grow(str,len) +register STR *str; +int len; +{ + if (len && str) + GROWSTR(&(str->str_ptr), &(str->str_len), len + 1); +} + +/* make str point to what nstr did */ + +void +str_replace(str,nstr) +register STR *str; +register STR *nstr; +{ + Safefree(str->str_ptr); + str->str_ptr = nstr->str_ptr; + str->str_len = nstr->str_len; + str->str_cur = nstr->str_cur; + str->str_pok = nstr->str_pok; + if (str->str_nok = nstr->str_nok) + str->str_nval = nstr->str_nval; + safefree((char*)nstr); +} + +void +str_free(str) +register STR *str; +{ + if (!str) + return; + if (str->str_len) + str->str_ptr[0] = '\0'; + str->str_cur = 0; + str->str_nok = 0; + str->str_pok = 0; + str->str_link.str_next = freestrroot; + freestrroot = str; +} + +int +str_len(str) +register STR *str; +{ + if (!str) + return 0; + if (!(str->str_pok)) + str_2ptr(str); + if (str->str_len) + return str->str_cur; + else + return 0; +} + +char * +str_gets(str,fp) +register STR *str; +register FILE *fp; +{ +#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE) + /* Here is some breathtakingly efficient cheating */ + + register char *bp; /* we're going to steal some values */ + register int cnt; /* from the stdio struct and put EVERYTHING */ + register STDCHAR *ptr; /* in the innermost loop into registers */ + register char newline = '\n'; /* (assuming at least 6 registers) */ + int i; + int bpx; + + cnt = FILE_cnt(fp); /* get count into register */ + str->str_nok = 0; /* invalidate number */ + str->str_pok = 1; /* validate pointer */ + if (str->str_len <= cnt) /* make sure we have the room */ + GROWSTR(&(str->str_ptr), &(str->str_len), cnt+1); + bp = str->str_ptr; /* move these two too to registers */ + ptr = FILE_ptr(fp); + for (;;) { + while (--cnt >= 0) { + if ((*bp++ = *ptr++) == newline) + if (bp <= str->str_ptr || bp[-2] != '\\') + goto thats_all_folks; + else { + line++; + bp -= 2; + } + } + + FILE_cnt(fp) = cnt; /* deregisterize cnt and ptr */ + FILE_ptr(fp) = ptr; + i = _filbuf(fp); /* get more characters */ + cnt = FILE_cnt(fp); + ptr = FILE_ptr(fp); /* reregisterize cnt and ptr */ + + bpx = bp - str->str_ptr; /* prepare for possible relocation */ + GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + cnt + 1); + bp = str->str_ptr + bpx; /* reconstitute our pointer */ + + if (i == newline) { /* all done for now? */ + *bp++ = i; + goto thats_all_folks; + } + else if (i == EOF) /* all done for ever? */ + goto thats_all_folks; + *bp++ = i; /* now go back to screaming loop */ + } + +thats_all_folks: + FILE_cnt(fp) = cnt; /* put these back or we're in trouble */ + FILE_ptr(fp) = ptr; + *bp = '\0'; + str->str_cur = bp - str->str_ptr; /* set length */ + +#else /* USE_STDIO_PTR && STDIO_PTR_LVALUE && STDIO_CNT_LVALUE */ + /* The big, slow, and stupid way */ + + static char buf[4192]; + + if (fgets(buf, sizeof buf, fp) != Nullch) + str_set(str, buf); + else + str_set(str, No); + +#endif /* USE_STDIO_PTR && STDIO_PTR_LVALUE && STDIO_CNT_LVALUE */ + + return str->str_cur ? str->str_ptr : Nullch; +} + +void +str_inc(str) +register STR *str; +{ + register char *d; + + if (!str) + return; + if (str->str_nok) { + str->str_nval += 1.0; + str->str_pok = 0; + return; + } + if (!str->str_pok) { + str->str_nval = 1.0; + str->str_nok = 1; + return; + } + for (d = str->str_ptr; *d && *d != '.'; d++) ; + d--; + if (!isdigit(*str->str_ptr) || !isdigit(*d) ) { + str_numset(str,atof(str->str_ptr) + 1.0); /* punt */ + return; + } + while (d >= str->str_ptr) { + if (++*d <= '9') + return; + *(d--) = '0'; + } + /* oh,oh, the number grew */ + GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + 2); + str->str_cur++; + for (d = str->str_ptr + str->str_cur; d > str->str_ptr; d--) + *d = d[-1]; + *d = '1'; +} + +void +str_dec(str) +register STR *str; +{ + register char *d; + + if (!str) + return; + if (str->str_nok) { + str->str_nval -= 1.0; + str->str_pok = 0; + return; + } + if (!str->str_pok) { + str->str_nval = -1.0; + str->str_nok = 1; + return; + } + for (d = str->str_ptr; *d && *d != '.'; d++) ; + d--; + if (!isdigit(*str->str_ptr) || !isdigit(*d) || (*d == '0' && d == str->str_ptr)) { + str_numset(str,atof(str->str_ptr) - 1.0); /* punt */ + return; + } + while (d >= str->str_ptr) { + if (--*d >= '0') + return; + *(d--) = '9'; + } +} + +/* make a string that will exist for the duration of the expression eval */ + +STR * +str_mortal(oldstr) +STR *oldstr; +{ + register STR *str = str_new(0); + static long tmps_size = -1; + + str_sset(str,oldstr); + if (++tmps_max > tmps_size) { + tmps_size = tmps_max; + if (!(tmps_size & 127)) { + if (tmps_size) + tmps_list = (STR**)saferealloc((char*)tmps_list, + (tmps_size + 128) * sizeof(STR*) ); + else + tmps_list = (STR**)safemalloc(128 * sizeof(char*)); + } + } + tmps_list[tmps_max] = str; + return str; +} + +STR * +str_make(s) +char *s; +{ + register STR *str = str_new(0); + + str_set(str,s); + return str; +} + +STR * +str_nmake(n) +double n; +{ + register STR *str = str_new(0); + + str_numset(str,n); + return str; +} diff --git a/gnu/usr.bin/perl/x2p/str.h b/gnu/usr.bin/perl/x2p/str.h new file mode 100644 index 00000000000..9d495ab0bad --- /dev/null +++ b/gnu/usr.bin/perl/x2p/str.h @@ -0,0 +1,53 @@ +/* $RCSfile: str.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:27 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: str.h,v $ + */ + +struct string { + char * str_ptr; /* pointer to malloced string */ + double str_nval; /* numeric value, if any */ + int str_len; /* allocated size */ + int str_cur; /* length of str_ptr as a C string */ + union { + STR *str_next; /* while free, link to next free str */ + } str_link; + char str_pok; /* state of str_ptr */ + char str_nok; /* state of str_nval */ +}; + +#define Nullstr Null(STR*) + +/* the following macro updates any magic values this str is associated with */ + +#define STABSET(x) (x->str_link.str_magic && stabset(x->str_link.str_magic,x)) + +EXT STR **tmps_list; +EXT long tmps_max INIT(-1); + +double str_2num _(( STR *str )); +char * str_2ptr _(( STR *str )); +char * str_append_till _(( STR *str, char *from, int delim, char *keeplist )); +void str_cat _(( STR *str, char *ptr )); +void str_chop _(( STR *str, char *ptr )); +void str_dec _(( STR *str )); +void str_free _(( STR *str )); +char * str_gets _(( STR *str, FILE *fp )); +void str_grow _(( STR *str, int len )); +void str_inc _(( STR *str )); +int str_len _(( STR *str )); +STR * str_make _(( char *s )); +STR * str_mortal _(( STR *oldstr )); +void str_ncat _(( STR *str, char *ptr, int len )); +STR * str_new _(( int len )); +STR * str_nmake _(( double n )); +void str_nset _(( STR *str, char *ptr, int len )); +void str_numset _(( STR *str, double num )); +void str_replace _(( STR *str, STR *nstr )); +void str_scat _(( STR *dstr, STR *sstr )); +void str_set _(( STR *str, char *ptr )); +void str_sset _(( STR *dstr, STR *sstr )); diff --git a/gnu/usr.bin/perl/x2p/util.c b/gnu/usr.bin/perl/x2p/util.c new file mode 100644 index 00000000000..5c3554b7e3e --- /dev/null +++ b/gnu/usr.bin/perl/x2p/util.c @@ -0,0 +1,220 @@ +/* $RCSfile: util.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:29 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: util.c,v $ + */ + +#include "EXTERN.h" +#include "a2p.h" +#include "INTERN.h" +#include "util.h" + +#define FLUSH + +static char nomem[] = "Out of memory!\n"; + +/* paranoid version of malloc */ + + +Malloc_t +safemalloc(size) +MEM_SIZE size; +{ + char *ptr; + Malloc_t malloc(); + + ptr = (char *) malloc(size?size:1); /* malloc(0) is NASTY on our system */ +#ifdef DEBUGGING + if (debug & 128) + fprintf(stderr,"0x%x: (%05d) malloc %d bytes\n",ptr,an++,size); +#endif + if (ptr != Nullch) + return ptr; + else { + fputs(nomem,stdout) FLUSH; + exit(1); + } + /*NOTREACHED*/ +} + +/* paranoid version of realloc */ + +Malloc_t +saferealloc(where,size) +char *where; +MEM_SIZE size; +{ + char *ptr; + Malloc_t realloc(); + + ptr = (char *) + realloc(where,size?size:1); /* realloc(0) is NASTY on our system */ +#ifdef DEBUGGING + if (debug & 128) { + fprintf(stderr,"0x%x: (%05d) rfree\n",where,an++); + fprintf(stderr,"0x%x: (%05d) realloc %d bytes\n",ptr,an++,size); + } +#endif + if (ptr != Nullch) + return ptr; + else { + fputs(nomem,stdout) FLUSH; + exit(1); + } + /*NOTREACHED*/ +} + +/* safe version of free */ + +void +safefree(where) +char *where; +{ +#ifdef DEBUGGING + if (debug & 128) + fprintf(stderr,"0x%x: (%05d) free\n",where,an++); +#endif + free(where); +} + +/* safe version of string copy */ + +char * +safecpy(to,from,len) +char *to; +register char *from; +register int len; +{ + register char *dest = to; + + if (from != Nullch) + for (len--; len && (*dest++ = *from++); len--) ; + *dest = '\0'; + return to; +} + +/* copy a string up to some (non-backslashed) delimiter, if any */ + +char * +cpytill(to,from,delim) +register char *to, *from; +register int delim; +{ + for (; *from; from++,to++) { + if (*from == '\\') { + if (from[1] == delim) + from++; + else if (from[1] == '\\') + *to++ = *from++; + } + else if (*from == delim) + break; + *to = *from; + } + *to = '\0'; + return from; +} + + +char * +cpy2(to,from,delim) +register char *to, *from; +register int delim; +{ + for (; *from; from++,to++) { + if (*from == '\\') + *to++ = *from++; + else if (*from == '$') + *to++ = '\\'; + else if (*from == delim) + break; + *to = *from; + } + *to = '\0'; + return from; +} + +/* return ptr to little string in big string, NULL if not found */ + +char * +instr(big, little) +char *big, *little; + +{ + register char *t, *s, *x; + + for (t = big; *t; t++) { + for (x=t,s=little; *s; x++,s++) { + if (!*x) + return Nullch; + if (*s != *x) + break; + } + if (!*s) + return t; + } + return Nullch; +} + +/* copy a string to a safe spot */ + +char * +savestr(str) +char *str; +{ + register char *newaddr = safemalloc((MEM_SIZE)(strlen(str)+1)); + + (void)strcpy(newaddr,str); + return newaddr; +} + +/* grow a static string to at least a certain length */ + +void +growstr(strptr,curlen,newlen) +char **strptr; +int *curlen; +int newlen; +{ + if (newlen > *curlen) { /* need more room? */ + if (*curlen) + *strptr = saferealloc(*strptr,(MEM_SIZE)newlen); + else + *strptr = safemalloc((MEM_SIZE)newlen); + *curlen = newlen; + } +} + +/*VARARGS1*/ +void +croak(pat,a1,a2,a3,a4) +char *pat; +int a1,a2,a3,a4; +{ + fprintf(stderr,pat,a1,a2,a3,a4); + exit(1); +} + +/*VARARGS1*/ +void +fatal(pat,a1,a2,a3,a4) +char *pat; +int a1,a2,a3,a4; +{ + fprintf(stderr,pat,a1,a2,a3,a4); + exit(1); +} + +/*VARARGS1*/ +void +warn(pat,a1,a2,a3,a4) +char *pat; +int a1,a2,a3,a4; +{ + fprintf(stderr,pat,a1,a2,a3,a4); +} + diff --git a/gnu/usr.bin/perl/x2p/util.h b/gnu/usr.bin/perl/x2p/util.h new file mode 100644 index 00000000000..35f796121c1 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/util.h @@ -0,0 +1,33 @@ +/* $RCSfile: util.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:30 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: util.h,v $ + */ + +/* is the string for makedir a directory name or a filename? */ + +#define fatal Myfatal + +#define MD_DIR 0 +#define MD_FILE 1 + +#ifdef SETUIDGID + int eaccess(); +#endif + +char *getwd(); +int makedir(); + +char * cpy2 _(( char *to, char *from, int delim )); +char * cpytill _(( char *to, char *from, int delim )); +void croak _(( char *pat, int a1, int a2, int a3, int a4 )); +void growstr _(( char **strptr, int *curlen, int newlen )); +char * instr _(( char *big, char *little )); +void Myfatal (); +char * safecpy _(( char *to, char *from, int len )); +char * savestr _(( char *str )); +void warn (); diff --git a/gnu/usr.bin/perl/x2p/walk.c b/gnu/usr.bin/perl/x2p/walk.c new file mode 100644 index 00000000000..403d686e391 --- /dev/null +++ b/gnu/usr.bin/perl/x2p/walk.c @@ -0,0 +1,2078 @@ +/* $RCSfile: walk.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:31 $ + * + * Copyright (c) 1991, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + * $Log: walk.c,v $ + */ + +#include "EXTERN.h" +#include "a2p.h" +#include "util.h" + +bool exitval = FALSE; +bool realexit = FALSE; +bool saw_getline = FALSE; +bool subretnum = FALSE; +bool saw_FNR = FALSE; +bool saw_argv0 = FALSE; +bool saw_fh = FALSE; +int maxtmp = 0; +char *lparen; +char *rparen; +char *limit; +STR *subs; +STR *curargs = Nullstr; + +static void addsemi _(( STR *str )); +static void emit_split _(( STR *str, int level )); +static void fixtab _(( STR *str, int lvl )); +static void numericize _(( int node )); +static void tab _(( STR *str, int lvl )); + +int prewalk _(( int numit, int level, int node, int *numericptr )); +STR * walk _(( int useval, int level, int node, int *numericptr, int minprec )); + + +STR * +walk(useval,level,node,numericptr,minprec) +int useval; +int level; +register int node; +int *numericptr; +int minprec; /* minimum precedence without parens */ +{ + register int len; + register STR *str; + register int type; + register int i; + register STR *tmpstr; + STR *tmp2str; + STR *tmp3str; + char *t; + char *d, *s; + int numarg; + int numeric = FALSE; + STR *fstr; + int prec = P_MAX; /* assume no parens needed */ + + if (!node) { + *numericptr = 0; + return str_make(""); + } + type = ops[node].ival; + len = type >> 8; + type &= 255; + switch (type) { + case OPROG: + arymax = 0; + if (namelist) { + while (isalpha(*namelist)) { + for (d = tokenbuf,s=namelist; + isalpha(*s) || isdigit(*s) || *s == '_'; + *d++ = *s++) ; + *d = '\0'; + while (*s && !isalpha(*s)) s++; + namelist = s; + nameary[++arymax] = savestr(tokenbuf); + } + } + if (maxfld < arymax) + maxfld = arymax; + opens = str_new(0); + subs = str_new(0); + str = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + if (do_split && need_entire && !absmaxfld) + split_to_array = TRUE; + if (do_split && split_to_array) + set_array_base = TRUE; + if (set_array_base) { + str_cat(str,"$[ = 1;\t\t\t# set array base to 1\n"); + } + if (fswitch && !const_FS) + const_FS = fswitch; + if (saw_FS > 1 || saw_RS) + const_FS = 0; + if (saw_ORS && need_entire) + do_chop = TRUE; + if (fswitch) { + str_cat(str,"$FS = '"); + if (strchr("*+?.[]()|^$\\",fswitch)) + str_cat(str,"\\"); + sprintf(tokenbuf,"%c",fswitch); + str_cat(str,tokenbuf); + str_cat(str,"';\t\t# field separator from -F switch\n"); + } + else if (saw_FS && !const_FS) { + str_cat(str,"$FS = ' ';\t\t# set field separator\n"); + } + if (saw_OFS) { + str_cat(str,"$, = ' ';\t\t# set output field separator\n"); + } + if (saw_ORS) { + str_cat(str,"$\\ = \"\\n\";\t\t# set output record separator\n"); + } + if (saw_argv0) { + str_cat(str,"$ARGV0 = $0;\t\t# remember what we ran as\n"); + } + if (str->str_cur > 20) + str_cat(str,"\n"); + if (ops[node+2].ival) { + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,"\n\n"); + } + fstr = walk(0,level+1,ops[node+3].ival,&numarg,P_MIN); + if (*fstr->str_ptr) { + if (saw_line_op) + str_cat(str,"line: "); + str_cat(str,"while (<>) {\n"); + tab(str,++level); + if (saw_FS && !const_FS) + do_chop = TRUE; + if (do_chop) { + str_cat(str,"chop;\t# strip record separator\n"); + tab(str,level); + } + if (do_split) + emit_split(str,level); + str_scat(str,fstr); + str_free(fstr); + fixtab(str,--level); + str_cat(str,"}\n"); + if (saw_FNR) + str_cat(str,"continue {\n $FNRbase = $. if eof;\n}\n"); + } + else + str_cat(str,"while (<>) { } # (no line actions)\n"); + if (ops[node+4].ival) { + realexit = TRUE; + str_cat(str,"\n"); + tab(str,level); + str_scat(str,fstr=walk(0,level,ops[node+4].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,"\n"); + } + if (exitval) + str_cat(str,"exit $ExitValue;\n"); + if (subs->str_ptr) { + str_cat(str,"\n"); + str_scat(str,subs); + } + if (saw_getline) { + for (len = 0; len < 4; len++) { + if (saw_getline & (1 << len)) { + sprintf(tokenbuf,"\nsub Getline%d {\n",len); + str_cat(str, tokenbuf); + if (len & 2) { + if (do_fancy_opens) + str_cat(str," &Pick('',@_);\n"); + else + str_cat(str," ($fh) = @_;\n"); + } + else { + if (saw_FNR) + str_cat(str," $FNRbase = $. if eof;\n"); + } + if (len & 1) + str_cat(str," local($_);\n"); + if (len & 2) + str_cat(str, + " if ($getline_ok = (($_ = <$fh>) ne ''))"); + else + str_cat(str, + " if ($getline_ok = (($_ = <>) ne ''))"); + str_cat(str, " {\n"); + level += 2; + tab(str,level); + i = 0; + if (do_chop) { + i++; + str_cat(str,"chop;\t# strip record separator\n"); + tab(str,level); + } + if (do_split && !(len & 1)) { + i++; + emit_split(str,level); + } + if (!i) + str_cat(str,";\n"); + fixtab(str,--level); + str_cat(str,"}\n $_;\n}\n"); + --level; + } + } + } + if (do_fancy_opens) { + str_cat(str,"\n\ +sub Pick {\n\ + local($mode,$name,$pipe) = @_;\n\ + $fh = $name;\n\ + open($name,$mode.$name.$pipe) unless $opened{$name}++;\n\ +}\n\ +"); + } + break; + case OHUNKS: + str = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + if (len == 3) { + str_scat(str,fstr=walk(0,level,ops[node+3].ival,&numarg,P_MIN)); + str_free(fstr); + } + else { + } + break; + case ORANGE: + prec = P_DOTDOT; + str = walk(1,level,ops[node+1].ival,&numarg,prec+1); + str_cat(str," .. "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + break; + case OPAT: + goto def; + case OREGEX: + str = str_new(0); + str_set(str,"/"); + tmpstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN); + /* translate \nnn to [\nnn] */ + for (s = tmpstr->str_ptr, d = tokenbuf; *s; s++, d++) { + if (*s == '\\' && isdigit(s[1]) && isdigit(s[2]) && isdigit(s[3])){ + *d++ = '['; + *d++ = *s++; + *d++ = *s++; + *d++ = *s++; + *d++ = *s; + *d = ']'; + } + else + *d = *s; + } + *d = '\0'; + for (d=tokenbuf; *d; d++) + *d += 128; + str_cat(str,tokenbuf); + str_free(tmpstr); + str_cat(str,"/"); + break; + case OHUNK: + if (len == 1) { + str = str_new(0); + str = walk(0,level,oper1(OPRINT,0),&numarg,P_MIN); + str_cat(str," if "); + str_scat(str,fstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,";"); + } + else { + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + if (*tmpstr->str_ptr) { + str = str_new(0); + str_set(str,"if ("); + str_scat(str,tmpstr); + str_cat(str,") {\n"); + tab(str,++level); + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + fixtab(str,--level); + str_cat(str,"}\n"); + tab(str,level); + } + else { + str = walk(0,level,ops[node+2].ival,&numarg,P_MIN); + } + } + break; + case OPPAREN: + str = str_new(0); + str_set(str,"("); + str_scat(str,fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,")"); + break; + case OPANDAND: + prec = P_ANDAND; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," && "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1)); + str_free(fstr); + break; + case OPOROR: + prec = P_OROR; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," || "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1)); + str_free(fstr); + break; + case OPNOT: + prec = P_UNARY; + str = str_new(0); + str_set(str,"!"); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec)); + str_free(fstr); + break; + case OCOND: + prec = P_COND; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," ? "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + str_cat(str," : "); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1)); + str_free(fstr); + break; + case OCPAREN: + str = str_new(0); + str_set(str,"("); + str_scat(str,fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + numeric |= numarg; + str_cat(str,")"); + break; + case OCANDAND: + prec = P_ANDAND; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + numeric = 1; + str_cat(str," && "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1)); + str_free(fstr); + break; + case OCOROR: + prec = P_OROR; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + numeric = 1; + str_cat(str," || "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1)); + str_free(fstr); + break; + case OCNOT: + prec = P_UNARY; + str = str_new(0); + str_set(str,"!"); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec)); + str_free(fstr); + numeric = 1; + break; + case ORELOP: + prec = P_REL; + str = walk(1,level,ops[node+2].ival,&numarg,prec+1); + numeric |= numarg; + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + tmp2str = walk(1,level,ops[node+3].ival,&numarg,prec+1); + numeric |= numarg; + if (!numeric || + (!numarg && (*tmp2str->str_ptr == '"' || *tmp2str->str_ptr == '\''))) { + t = tmpstr->str_ptr; + if (strEQ(t,"==")) + str_set(tmpstr,"eq"); + else if (strEQ(t,"!=")) + str_set(tmpstr,"ne"); + else if (strEQ(t,"<")) + str_set(tmpstr,"lt"); + else if (strEQ(t,"<=")) + str_set(tmpstr,"le"); + else if (strEQ(t,">")) + str_set(tmpstr,"gt"); + else if (strEQ(t,">=")) + str_set(tmpstr,"ge"); + if (!strchr(tmpstr->str_ptr,'\'') && !strchr(tmpstr->str_ptr,'"') && + !strchr(tmp2str->str_ptr,'\'') && !strchr(tmp2str->str_ptr,'"') ) + numeric |= 2; + } + if (numeric & 2) { + if (numeric & 1) /* numeric is very good guess */ + str_cat(str," "); + else + str_cat(str,"\377"); + numeric = 1; + } + else + str_cat(str," "); + str_scat(str,tmpstr); + str_free(tmpstr); + str_cat(str," "); + str_scat(str,tmp2str); + str_free(tmp2str); + numeric = 1; + break; + case ORPAREN: + str = str_new(0); + str_set(str,"("); + str_scat(str,fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + numeric |= numarg; + str_cat(str,")"); + break; + case OMATCHOP: + prec = P_MATCH; + str = walk(1,level,ops[node+2].ival,&numarg,prec+1); + str_cat(str," "); + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + if (strEQ(tmpstr->str_ptr,"~")) + str_cat(str,"=~"); + else { + str_scat(str,tmpstr); + str_free(tmpstr); + } + str_cat(str," "); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case OMPAREN: + str = str_new(0); + str_set(str,"("); + str_scat(str, + fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + numeric |= numarg; + str_cat(str,")"); + break; + case OCONCAT: + prec = P_ADD; + type = ops[ops[node+1].ival].ival & 255; + str = walk(1,level,ops[node+1].ival,&numarg,prec+(type != OCONCAT)); + str_cat(str," . "); + type = ops[ops[node+2].ival].ival & 255; + str_scat(str, + fstr=walk(1,level,ops[node+2].ival,&numarg,prec+(type != OCONCAT))); + str_free(fstr); + break; + case OASSIGN: + prec = P_ASSIGN; + str = walk(0,level,ops[node+2].ival,&numarg,prec+1); + str_cat(str," "); + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + str_scat(str,tmpstr); + if (str_len(tmpstr) > 1) + numeric = 1; + str_free(tmpstr); + str_cat(str," "); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec)); + str_free(fstr); + numeric |= numarg; + if (strEQ(str->str_ptr,"$/ = ''")) + str_set(str, "$/ = \"\\n\\n\""); + break; + case OADD: + prec = P_ADD; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," + "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case OSUBTRACT: + prec = P_ADD; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," - "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case OMULT: + prec = P_MUL; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," * "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case ODIV: + prec = P_MUL; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," / "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case OPOW: + prec = P_POW; + str = walk(1,level,ops[node+1].ival,&numarg,prec+1); + str_cat(str," ** "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec)); + str_free(fstr); + numeric = 1; + break; + case OMOD: + prec = P_MUL; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str," % "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case OPOSTINCR: + prec = P_AUTO; + str = walk(1,level,ops[node+1].ival,&numarg,prec+1); + str_cat(str,"++"); + numeric = 1; + break; + case OPOSTDECR: + prec = P_AUTO; + str = walk(1,level,ops[node+1].ival,&numarg,prec+1); + str_cat(str,"--"); + numeric = 1; + break; + case OPREINCR: + prec = P_AUTO; + str = str_new(0); + str_set(str,"++"); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case OPREDECR: + prec = P_AUTO; + str = str_new(0); + str_set(str,"--"); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec+1)); + str_free(fstr); + numeric = 1; + break; + case OUMINUS: + prec = P_UNARY; + str = str_new(0); + str_set(str,"-"); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec)); + str_free(fstr); + numeric = 1; + break; + case OUPLUS: + numeric = 1; + goto def; + case OPAREN: + str = str_new(0); + str_set(str,"("); + str_scat(str, + fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,")"); + numeric |= numarg; + break; + case OGETLINE: + str = str_new(0); + if (useval) + str_cat(str,"("); + if (len > 0) { + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + if (!*fstr->str_ptr) { + str_cat(str,"$_"); + len = 2; /* a legal fiction */ + } + str_free(fstr); + } + else + str_cat(str,"$_"); + if (len > 1) { + tmpstr=walk(1,level,ops[node+3].ival,&numarg,P_MIN); + fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN); + if (!do_fancy_opens) { + t = tmpstr->str_ptr; + if (*t == '"' || *t == '\'') + t = cpytill(tokenbuf,t+1,*t); + else + fatal("Internal error: OGETLINE %s", t); + d = savestr(t); + s = savestr(tokenbuf); + for (t = tokenbuf; *t; t++) { + *t &= 127; + if (islower(*t)) + *t = toupper(*t); + if (!isalpha(*t) && !isdigit(*t)) + *t = '_'; + } + if (!strchr(tokenbuf,'_')) + strcpy(t,"_FH"); + tmp3str = hfetch(symtab,tokenbuf); + if (!tmp3str) { + do_opens = TRUE; + str_cat(opens,"open("); + str_cat(opens,tokenbuf); + str_cat(opens,", "); + d[1] = '\0'; + str_cat(opens,d); + str_cat(opens,tmpstr->str_ptr+1); + opens->str_cur--; + if (*fstr->str_ptr == '|') + str_cat(opens,"|"); + str_cat(opens,d); + if (*fstr->str_ptr == '|') + str_cat(opens,") || die 'Cannot pipe from \""); + else + str_cat(opens,") || die 'Cannot open file \""); + if (*d == '"') + str_cat(opens,"'.\""); + str_cat(opens,s); + if (*d == '"') + str_cat(opens,"\".'"); + str_cat(opens,"\".';\n"); + hstore(symtab,tokenbuf,str_make("x")); + } + safefree(s); + safefree(d); + str_set(tmpstr,"'"); + str_cat(tmpstr,tokenbuf); + str_cat(tmpstr,"'"); + } + if (*fstr->str_ptr == '|') + str_cat(tmpstr,", '|'"); + str_free(fstr); + } + else + tmpstr = str_make(""); + sprintf(tokenbuf," = &Getline%d(%s)",len,tmpstr->str_ptr); + str_cat(str,tokenbuf); + str_free(tmpstr); + if (useval) + str_cat(str,",$getline_ok)"); + saw_getline |= 1 << len; + break; + case OSPRINTF: + str = str_new(0); + str_set(str,"sprintf("); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,")"); + break; + case OSUBSTR: + str = str_new(0); + str_set(str,"substr("); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1)); + str_free(fstr); + str_cat(str,", "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_COMMA+1)); + str_free(fstr); + str_cat(str,", "); + if (len == 3) { + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,P_COMMA+1)); + str_free(fstr); + } + else + str_cat(str,"999999"); + str_cat(str,")"); + break; + case OSTRING: + str = str_new(0); + str_set(str,ops[node+1].cval); + break; + case OSPLIT: + str = str_new(0); + limit = ", 9999)"; + numeric = 1; + tmpstr = walk(1,level,ops[node+2].ival,&numarg,P_MIN); + if (useval) + str_set(str,"(@"); + else + str_set(str,"@"); + str_scat(str,tmpstr); + str_cat(str," = split("); + if (len == 3) { + fstr = walk(1,level,ops[node+3].ival,&numarg,P_COMMA+1); + if (str_len(fstr) == 3 && *fstr->str_ptr == '\'') { + i = fstr->str_ptr[1] & 127; + if (strchr("*+?.[]()|^$\\",i)) + sprintf(tokenbuf,"/\\%c/",i); + else if (i == ' ') + sprintf(tokenbuf,"' '"); + else + sprintf(tokenbuf,"/%c/",i); + str_cat(str,tokenbuf); + } + else + str_scat(str,fstr); + str_free(fstr); + } + else if (const_FS) { + sprintf(tokenbuf,"/[%c\\n]/",const_FS); + str_cat(str,tokenbuf); + } + else if (saw_FS) + str_cat(str,"$FS"); + else { + str_cat(str,"' '"); + limit = ")"; + } + str_cat(str,", "); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1)); + str_free(fstr); + str_cat(str,limit); + if (useval) { + str_cat(str,")"); + } + str_free(tmpstr); + break; + case OINDEX: + str = str_new(0); + str_set(str,"index("); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1)); + str_free(fstr); + str_cat(str,", "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_COMMA+1)); + str_free(fstr); + str_cat(str,")"); + numeric = 1; + break; + case OMATCH: + str = str_new(0); + prec = P_ANDAND; + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MATCH+1)); + str_free(fstr); + str_cat(str," =~ "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MATCH+1)); + str_free(fstr); + str_cat(str," && ($RLENGTH = length($&), $RSTART = length($`)+1)"); + numeric = 1; + break; + case OUSERDEF: + str = str_new(0); + subretnum = FALSE; + fstr=walk(1,level-1,ops[node+2].ival,&numarg,P_MIN); + curargs = str_new(0); + str_sset(curargs,fstr); + str_cat(curargs,","); + tmp2str=walk(1,level,ops[node+5].ival,&numarg,P_MIN); + str_free(curargs); + curargs = Nullstr; + level--; + subretnum |= numarg; + s = Nullch; + t = tmp2str->str_ptr; + while (t = instr(t,"return ")) + s = t++; + if (s) { + i = 0; + for (t = s+7; *t; t++) { + if (*t == ';' || *t == '}') + i++; + } + if (i == 1) { + strcpy(s,s+7); + tmp2str->str_cur -= 7; + } + } + str_set(str,"\n"); + tab(str,level); + str_cat(str,"sub "); + str_scat(str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + str_cat(str," {\n"); + tab(str,++level); + if (fstr->str_cur) { + str_cat(str,"local("); + str_scat(str,fstr); + str_cat(str,") = @_;"); + } + str_free(fstr); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,P_MIN)); + str_free(fstr); + fixtab(str,level); + str_scat(str,fstr=walk(1,level,ops[node+4].ival,&numarg,P_MIN)); + str_free(fstr); + fixtab(str,level); + str_scat(str,tmp2str); + str_free(tmp2str); + fixtab(str,--level); + str_cat(str,"}\n"); + tab(str,level); + str_scat(subs,str); + str_set(str,""); + str_cat(tmpstr,"("); + tmp2str = str_new(0); + if (subretnum) + str_set(tmp2str,"1"); + hstore(symtab,tmpstr->str_ptr,tmp2str); + str_free(tmpstr); + level++; + break; + case ORETURN: + str = str_new(0); + if (len > 0) { + str_cat(str,"return "); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_UNI+1)); + str_free(fstr); + if (numarg) + subretnum = TRUE; + } + else + str_cat(str,"return"); + break; + case OUSERFUN: + str = str_new(0); + str_set(str,"&"); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,"("); + tmpstr = hfetch(symtab,str->str_ptr+3); + if (tmpstr && tmpstr->str_ptr) + numeric |= atoi(tmpstr->str_ptr); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,")"); + break; + case OGSUB: + case OSUB: + if (type == OGSUB) + s = "g"; + else + s = ""; + str = str_new(0); + tmpstr = str_new(0); + i = 0; + if (len == 3) { + tmpstr = walk(1,level,ops[node+3].ival,&numarg,P_MATCH+1); + if (strNE(tmpstr->str_ptr,"$_")) { + str_cat(tmpstr, " =~ s"); + i++; + } + else + str_set(tmpstr, "s"); + } + else + str_set(tmpstr, "s"); + type = ops[ops[node+2].ival].ival; + len = type >> 8; + type &= 255; + tmp3str = str_new(0); + if (type == OSTR) { + tmp2str=walk(1,level,ops[ops[node+2].ival+1].ival,&numarg,P_MIN); + for (t = tmp2str->str_ptr, d=tokenbuf; *t; d++,t++) { + if (*t == '&') + *d++ = '$' + 128; + else if (*t == '$') + *d++ = '\\' + 128; + *d = *t + 128; + } + *d = '\0'; + str_set(tmp2str,tokenbuf); + } + else { + tmp2str=walk(1,level,ops[node+2].ival,&numarg,P_MIN); + str_set(tmp3str,"($s_ = '\"'.("); + str_scat(tmp3str,tmp2str); + str_cat(tmp3str,").'\"') =~ s/&/\\$&/g, "); + str_set(tmp2str,"eval $s_"); + s = (*s == 'g' ? "ge" : "e"); + i++; + } + type = ops[ops[node+1].ival].ival; + len = type >> 8; + type &= 255; + fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN); + if (type == OREGEX) { + if (useval && i) + str_cat(str,"("); + str_scat(str,tmp3str); + str_scat(str,tmpstr); + str_scat(str,fstr); + str_scat(str,tmp2str); + str_cat(str,"/"); + str_cat(str,s); + } + else if ((type == OFLD && !split_to_array) || (type == OVAR && len == 1)) { + if (useval && i) + str_cat(str,"("); + str_scat(str,tmp3str); + str_scat(str,tmpstr); + str_cat(str,"/"); + str_scat(str,fstr); + str_cat(str,"/"); + str_scat(str,tmp2str); + str_cat(str,"/"); + str_cat(str,s); + } + else { + i++; + if (useval) + str_cat(str,"("); + str_cat(str,"$s = "); + str_scat(str,fstr); + str_cat(str,", "); + str_scat(str,tmp3str); + str_scat(str,tmpstr); + str_cat(str,"/$s/"); + str_scat(str,tmp2str); + str_cat(str,"/"); + str_cat(str,s); + } + if (useval && i) + str_cat(str,")"); + str_free(fstr); + str_free(tmpstr); + str_free(tmp2str); + str_free(tmp3str); + numeric = 1; + break; + case ONUM: + str = walk(1,level,ops[node+1].ival,&numarg,P_MIN); + numeric = 1; + break; + case OSTR: + tmpstr = walk(1,level,ops[node+1].ival,&numarg,P_MIN); + s = "'"; + for (t = tmpstr->str_ptr, d=tokenbuf; *t; d++,t++) { + if (*t == '\'') + s = "\""; + else if (*t == '\\') { + s = "\""; + *d++ = *t++ + 128; + switch (*t) { + case '\\': case '"': case 'n': case 't': case '$': + break; + default: /* hide this from perl */ + *d++ = '\\' + 128; + } + } + *d = *t + 128; + } + *d = '\0'; + str = str_new(0); + str_set(str,s); + str_cat(str,tokenbuf); + str_free(tmpstr); + str_cat(str,s); + break; + case ODEFINED: + prec = P_UNI; + str = str_new(0); + str_set(str,"defined $"); + goto addvar; + case ODELETE: + str = str_new(0); + str_set(str,"delete $"); + goto addvar; + case OSTAR: + str = str_new(0); + str_set(str,"*"); + goto addvar; + case OVAR: + str = str_new(0); + str_set(str,"$"); + addvar: + str_scat(str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + if (len == 1) { + tmp2str = hfetch(symtab,tmpstr->str_ptr); + if (tmp2str && atoi(tmp2str->str_ptr)) + numeric = 2; + if (strEQ(str->str_ptr,"$FNR")) { + numeric = 1; + saw_FNR++; + str_set(str,"($.-$FNRbase)"); + } + else if (strEQ(str->str_ptr,"$NR")) { + numeric = 1; + str_set(str,"$."); + } + else if (strEQ(str->str_ptr,"$NF")) { + numeric = 1; + str_set(str,"$#Fld"); + } + else if (strEQ(str->str_ptr,"$0")) + str_set(str,"$_"); + else if (strEQ(str->str_ptr,"$ARGC")) + str_set(str,"($#ARGV+1)"); + } + else { +#ifdef NOTDEF + if (curargs) { + sprintf(tokenbuf,"$%s,",tmpstr->str_ptr); + ??? if (instr(curargs->str_ptr,tokenbuf)) + str_cat(str,"\377"); /* can't translate yet */ + } +#endif + str_cat(tmpstr,"[]"); + tmp2str = hfetch(symtab,tmpstr->str_ptr); + if (tmp2str && atoi(tmp2str->str_ptr)) + str_cat(str,"["); + else + str_cat(str,"{"); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + if (strEQ(str->str_ptr,"$ARGV[0")) { + str_set(str,"$ARGV0"); + saw_argv0++; + } + else { + if (tmp2str && atoi(tmp2str->str_ptr)) + strcpy(tokenbuf,"]"); + else + strcpy(tokenbuf,"}"); + *tokenbuf += 128; + str_cat(str,tokenbuf); + } + } + str_free(tmpstr); + break; + case OFLD: + str = str_new(0); + if (split_to_array) { + str_set(str,"$Fld"); + str_cat(str,"["); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,"]"); + } + else { + i = atoi(walk(1,level,ops[node+1].ival,&numarg,P_MIN)->str_ptr); + if (i <= arymax) + sprintf(tokenbuf,"$%s",nameary[i]); + else + sprintf(tokenbuf,"$Fld%d",i); + str_set(str,tokenbuf); + } + break; + case OVFLD: + str = str_new(0); + str_set(str,"$Fld["); + i = ops[node+1].ival; + if ((ops[i].ival & 255) == OPAREN) + i = ops[i+1].ival; + tmpstr=walk(1,level,i,&numarg,P_MIN); + str_scat(str,tmpstr); + str_free(tmpstr); + str_cat(str,"]"); + break; + case OJUNK: + goto def; + case OSNEWLINE: + str = str_new(2); + str_set(str,";\n"); + tab(str,level); + break; + case ONEWLINE: + str = str_new(1); + str_set(str,"\n"); + tab(str,level); + break; + case OSCOMMENT: + str = str_new(0); + str_set(str,";"); + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + for (s = tmpstr->str_ptr; *s && *s != '\n'; s++) + *s += 128; + str_scat(str,tmpstr); + str_free(tmpstr); + tab(str,level); + break; + case OCOMMENT: + str = str_new(0); + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + for (s = tmpstr->str_ptr; *s && *s != '\n'; s++) + *s += 128; + str_scat(str,tmpstr); + str_free(tmpstr); + tab(str,level); + break; + case OCOMMA: + prec = P_COMMA; + str = walk(1,level,ops[node+1].ival,&numarg,prec); + str_cat(str,", "); + str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1)); + str_free(fstr); + break; + case OSEMICOLON: + str = str_new(1); + str_set(str,";\n"); + tab(str,level); + break; + case OSTATES: + str = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + break; + case OSTATE: + str = str_new(0); + if (len >= 1) { + str_scat(str,fstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + if (len >= 2) { + tmpstr = walk(0,level,ops[node+2].ival,&numarg,P_MIN); + if (*tmpstr->str_ptr == ';') { + addsemi(str); + str_cat(str,tmpstr->str_ptr+1); + } + str_free(tmpstr); + } + } + break; + case OCLOSE: + str = str_make("close("); + tmpstr = walk(1,level,ops[node+1].ival,&numarg,P_MIN); + if (!do_fancy_opens) { + t = tmpstr->str_ptr; + if (*t == '"' || *t == '\'') + t = cpytill(tokenbuf,t+1,*t); + else + fatal("Internal error: OCLOSE %s",t); + s = savestr(tokenbuf); + for (t = tokenbuf; *t; t++) { + *t &= 127; + if (islower(*t)) + *t = toupper(*t); + if (!isalpha(*t) && !isdigit(*t)) + *t = '_'; + } + if (!strchr(tokenbuf,'_')) + strcpy(t,"_FH"); + str_free(tmpstr); + safefree(s); + str_set(str,"close "); + str_cat(str,tokenbuf); + } + else { + sprintf(tokenbuf,"delete $opened{%s} && close(%s)", + tmpstr->str_ptr, tmpstr->str_ptr); + str_free(tmpstr); + str_set(str,tokenbuf); + } + break; + case OPRINTF: + case OPRINT: + lparen = ""; /* set to parens if necessary */ + rparen = ""; + str = str_new(0); + if (len == 3) { /* output redirection */ + tmpstr = walk(1,level,ops[node+3].ival,&numarg,P_MIN); + tmp2str = walk(1,level,ops[node+2].ival,&numarg,P_MIN); + if (!do_fancy_opens) { + t = tmpstr->str_ptr; + if (*t == '"' || *t == '\'') + t = cpytill(tokenbuf,t+1,*t); + else + fatal("Internal error: OPRINT"); + d = savestr(t); + s = savestr(tokenbuf); + for (t = tokenbuf; *t; t++) { + *t &= 127; + if (islower(*t)) + *t = toupper(*t); + if (!isalpha(*t) && !isdigit(*t)) + *t = '_'; + } + if (!strchr(tokenbuf,'_')) + strcpy(t,"_FH"); + tmp3str = hfetch(symtab,tokenbuf); + if (!tmp3str) { + str_cat(opens,"open("); + str_cat(opens,tokenbuf); + str_cat(opens,", "); + d[1] = '\0'; + str_cat(opens,d); + str_scat(opens,tmp2str); + str_cat(opens,tmpstr->str_ptr+1); + if (*tmp2str->str_ptr == '|') + str_cat(opens,") || die 'Cannot pipe to \""); + else + str_cat(opens,") || die 'Cannot create file \""); + if (*d == '"') + str_cat(opens,"'.\""); + str_cat(opens,s); + if (*d == '"') + str_cat(opens,"\".'"); + str_cat(opens,"\".';\n"); + hstore(symtab,tokenbuf,str_make("x")); + } + str_free(tmpstr); + str_free(tmp2str); + safefree(s); + safefree(d); + } + else { + sprintf(tokenbuf,"&Pick('%s', %s) &&\n", + tmp2str->str_ptr, tmpstr->str_ptr); + str_cat(str,tokenbuf); + tab(str,level+1); + strcpy(tokenbuf,"$fh"); + str_free(tmpstr); + str_free(tmp2str); + lparen = "("; + rparen = ")"; + } + } + else + strcpy(tokenbuf,""); + str_cat(str,lparen); /* may be null */ + if (type == OPRINTF) + str_cat(str,"printf"); + else + str_cat(str,"print"); + saw_fh = 0; + if (len == 3 || do_fancy_opens) { + if (*tokenbuf) { + str_cat(str," "); + saw_fh = 1; + } + str_cat(str,tokenbuf); + } + tmpstr = walk(1+(type==OPRINT),level,ops[node+1].ival,&numarg,P_MIN); + if (!*tmpstr->str_ptr && lval_field) { + t = saw_OFS ? "$," : "' '"; + if (split_to_array) { + sprintf(tokenbuf,"join(%s,@Fld)",t); + str_cat(tmpstr,tokenbuf); + } + else { + for (i = 1; i < maxfld; i++) { + if (i <= arymax) + sprintf(tokenbuf,"$%s, ",nameary[i]); + else + sprintf(tokenbuf,"$Fld%d, ",i); + str_cat(tmpstr,tokenbuf); + } + if (maxfld <= arymax) + sprintf(tokenbuf,"$%s",nameary[maxfld]); + else + sprintf(tokenbuf,"$Fld%d",maxfld); + str_cat(tmpstr,tokenbuf); + } + } + if (*tmpstr->str_ptr) { + str_cat(str," "); + if (!saw_fh && *tmpstr->str_ptr == '(') { + str_cat(str,"("); + str_scat(str,tmpstr); + str_cat(str,")"); + } + else + str_scat(str,tmpstr); + } + else { + str_cat(str," $_"); + } + str_cat(str,rparen); /* may be null */ + str_free(tmpstr); + break; + case ORAND: + str = str_make("rand(1)"); + break; + case OSRAND: + str = str_make("srand("); + goto maybe0; + case OATAN2: + str = str_make("atan2("); + goto maybe0; + case OSIN: + str = str_make("sin("); + goto maybe0; + case OCOS: + str = str_make("cos("); + goto maybe0; + case OSYSTEM: + str = str_make("system("); + goto maybe0; + case OLENGTH: + str = str_make("length("); + goto maybe0; + case OLOG: + str = str_make("log("); + goto maybe0; + case OEXP: + str = str_make("exp("); + goto maybe0; + case OSQRT: + str = str_make("sqrt("); + goto maybe0; + case OINT: + str = str_make("int("); + maybe0: + numeric = 1; + if (len > 0) + tmpstr = walk(1,level,ops[node+1].ival,&numarg,P_MIN); + else + tmpstr = str_new(0);; + if (!tmpstr->str_ptr || !*tmpstr->str_ptr) { + if (lval_field) { + t = saw_OFS ? "$," : "' '"; + if (split_to_array) { + sprintf(tokenbuf,"join(%s,@Fld)",t); + str_cat(tmpstr,tokenbuf); + } + else { + sprintf(tokenbuf,"join(%s, ",t); + str_cat(tmpstr,tokenbuf); + for (i = 1; i < maxfld; i++) { + if (i <= arymax) + sprintf(tokenbuf,"$%s,",nameary[i]); + else + sprintf(tokenbuf,"$Fld%d,",i); + str_cat(tmpstr,tokenbuf); + } + if (maxfld <= arymax) + sprintf(tokenbuf,"$%s)",nameary[maxfld]); + else + sprintf(tokenbuf,"$Fld%d)",maxfld); + str_cat(tmpstr,tokenbuf); + } + } + else + str_cat(tmpstr,"$_"); + } + if (strEQ(tmpstr->str_ptr,"$_")) { + if (type == OLENGTH && !do_chop) { + str = str_make("(length("); + str_cat(tmpstr,") - 1"); + } + } + str_scat(str,tmpstr); + str_free(tmpstr); + str_cat(str,")"); + break; + case OBREAK: + str = str_new(0); + str_set(str,"last"); + break; + case ONEXT: + str = str_new(0); + str_set(str,"next line"); + break; + case OEXIT: + str = str_new(0); + if (realexit) { + prec = P_UNI; + str_set(str,"exit"); + if (len == 1) { + str_cat(str," "); + exitval = TRUE; + str_scat(str, + fstr=walk(1,level,ops[node+1].ival,&numarg,prec+1)); + str_free(fstr); + } + } + else { + if (len == 1) { + str_set(str,"$ExitValue = "); + exitval = TRUE; + str_scat(str, + fstr=walk(1,level,ops[node+1].ival,&numarg,P_ASSIGN)); + str_free(fstr); + str_cat(str,"; "); + } + str_cat(str,"last line"); + } + break; + case OCONTINUE: + str = str_new(0); + str_set(str,"next"); + break; + case OREDIR: + goto def; + case OIF: + str = str_new(0); + str_set(str,"if ("); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,") "); + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + if (len == 3) { + i = ops[node+3].ival; + if (i) { + if ((ops[i].ival & 255) == OBLOCK) { + i = ops[i+1].ival; + if (i) { + if ((ops[i].ival & 255) != OIF) + i = 0; + } + } + else + i = 0; + } + if (i) { + str_cat(str,"els"); + str_scat(str,fstr=walk(0,level,i,&numarg,P_MIN)); + str_free(fstr); + } + else { + str_cat(str,"else "); + str_scat(str,fstr=walk(0,level,ops[node+3].ival,&numarg,P_MIN)); + str_free(fstr); + } + } + break; + case OWHILE: + str = str_new(0); + str_set(str,"while ("); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,") "); + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + break; + case ODO: + str = str_new(0); + str_set(str,"do "); + str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + if (str->str_ptr[str->str_cur - 1] == '\n') + --str->str_cur;; + str_cat(str," while ("); + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,");"); + break; + case OFOR: + str = str_new(0); + str_set(str,"for ("); + str_scat(str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + i = numarg; + if (i) { + t = s = tmpstr->str_ptr; + while (isalpha(*t) || isdigit(*t) || *t == '$' || *t == '_') + t++; + i = t - s; + if (i < 2) + i = 0; + } + str_cat(str,"; "); + fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN); + if (i && (t = strchr(fstr->str_ptr,0377))) { + if (strnEQ(fstr->str_ptr,s,i)) + *t = ' '; + } + str_scat(str,fstr); + str_free(fstr); + str_free(tmpstr); + str_cat(str,"; "); + str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,P_MIN)); + str_free(fstr); + str_cat(str,") "); + str_scat(str,fstr=walk(0,level,ops[node+4].ival,&numarg,P_MIN)); + str_free(fstr); + break; + case OFORIN: + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + d = strchr(tmpstr->str_ptr,'$'); + if (!d) + fatal("Illegal for loop: %s",tmpstr->str_ptr); + s = strchr(d,'{'); + if (!s) + s = strchr(d,'['); + if (!s) + fatal("Illegal for loop: %s",d); + *s++ = '\0'; + for (t = s; i = *t; t++) { + i &= 127; + if (i == '}' || i == ']') + break; + } + if (*t) + *t = '\0'; + str = str_new(0); + str_set(str,d+1); + str_cat(str,"[]"); + tmp2str = hfetch(symtab,str->str_ptr); + if (tmp2str && atoi(tmp2str->str_ptr)) { + sprintf(tokenbuf, + "foreach %s ($[ .. $#%s) ", + s, + d+1); + } + else { + sprintf(tokenbuf, + "foreach %s (keys %%%s) ", + s, + d+1); + } + str_set(str,tokenbuf); + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + str_free(tmpstr); + break; + case OBLOCK: + str = str_new(0); + str_set(str,"{"); + if (len >= 2 && ops[node+2].ival) { + str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN)); + str_free(fstr); + } + fixtab(str,++level); + str_scat(str,fstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN)); + str_free(fstr); + addsemi(str); + fixtab(str,--level); + str_cat(str,"}\n"); + tab(str,level); + if (len >= 3) { + str_scat(str,fstr=walk(0,level,ops[node+3].ival,&numarg,P_MIN)); + str_free(fstr); + } + break; + default: + def: + if (len) { + if (len > 5) + fatal("Garbage length in walk"); + str = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + for (i = 2; i<= len; i++) { + str_scat(str,fstr=walk(0,level,ops[node+i].ival,&numarg,P_MIN)); + str_free(fstr); + } + } + else { + str = Nullstr; + } + break; + } + if (!str) + str = str_new(0); + + if (useval && prec < minprec) { /* need parens? */ + fstr = str_new(str->str_cur+2); + str_nset(fstr,"(",1); + str_scat(fstr,str); + str_ncat(fstr,")",1); + str_free(str); + str = fstr; + } + + *numericptr = numeric; +#ifdef DEBUGGING + if (debug & 4) { + printf("%3d %5d %15s %d %4d ",level,node,opname[type],len,str->str_cur); + for (t = str->str_ptr; *t && t - str->str_ptr < 40; t++) + if (*t == '\n') + printf("\\n"); + else if (*t == '\t') + printf("\\t"); + else + putchar(*t); + putchar('\n'); + } +#endif + return str; +} + +static void +tab(str,lvl) +register STR *str; +register int lvl; +{ + while (lvl > 1) { + str_cat(str,"\t"); + lvl -= 2; + } + if (lvl) + str_cat(str," "); +} + +static void +fixtab(str,lvl) +register STR *str; +register int lvl; +{ + register char *s; + + /* strip trailing white space */ + + s = str->str_ptr+str->str_cur - 1; + while (s >= str->str_ptr && (*s == ' ' || *s == '\t' || *s == '\n')) + s--; + s[1] = '\0'; + str->str_cur = s + 1 - str->str_ptr; + if (s >= str->str_ptr && *s != '\n') + str_cat(str,"\n"); + + tab(str,lvl); +} + +static void +addsemi(str) +register STR *str; +{ + register char *s; + + s = str->str_ptr+str->str_cur - 1; + while (s >= str->str_ptr && (*s == ' ' || *s == '\t' || *s == '\n')) + s--; + if (s >= str->str_ptr && *s != ';' && *s != '}') + str_cat(str,";"); +} + +static void +emit_split(str,level) +register STR *str; +int level; +{ + register int i; + + if (split_to_array) + str_cat(str,"@Fld"); + else { + str_cat(str,"("); + for (i = 1; i < maxfld; i++) { + if (i <= arymax) + sprintf(tokenbuf,"$%s,",nameary[i]); + else + sprintf(tokenbuf,"$Fld%d,",i); + str_cat(str,tokenbuf); + } + if (maxfld <= arymax) + sprintf(tokenbuf,"$%s)",nameary[maxfld]); + else + sprintf(tokenbuf,"$Fld%d)",maxfld); + str_cat(str,tokenbuf); + } + if (const_FS) { + sprintf(tokenbuf," = split(/[%c\\n]/, $_, 9999);\n",const_FS); + str_cat(str,tokenbuf); + } + else if (saw_FS) + str_cat(str," = split($FS, $_, 9999);\n"); + else + str_cat(str," = split(' ', $_, 9999);\n"); + tab(str,level); +} + +int +prewalk(numit,level,node,numericptr) +int numit; +int level; +register int node; +int *numericptr; +{ + register int len; + register int type; + register int i; + int numarg; + int numeric = FALSE; + STR *tmpstr; + STR *tmp2str; + + if (!node) { + *numericptr = 0; + return 0; + } + type = ops[node].ival; + len = type >> 8; + type &= 255; + switch (type) { + case OPROG: + prewalk(0,level,ops[node+1].ival,&numarg); + if (ops[node+2].ival) { + prewalk(0,level,ops[node+2].ival,&numarg); + } + ++level; + prewalk(0,level,ops[node+3].ival,&numarg); + --level; + if (ops[node+3].ival) { + prewalk(0,level,ops[node+4].ival,&numarg); + } + break; + case OHUNKS: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + if (len == 3) { + prewalk(0,level,ops[node+3].ival,&numarg); + } + break; + case ORANGE: + prewalk(1,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + break; + case OPAT: + goto def; + case OREGEX: + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OHUNK: + if (len == 1) { + prewalk(0,level,ops[node+1].ival,&numarg); + } + else { + i = prewalk(0,level,ops[node+1].ival,&numarg); + if (i) { + ++level; + prewalk(0,level,ops[node+2].ival,&numarg); + --level; + } + else { + prewalk(0,level,ops[node+2].ival,&numarg); + } + } + break; + case OPPAREN: + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OPANDAND: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + break; + case OPOROR: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + break; + case OPNOT: + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OCPAREN: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric |= numarg; + break; + case OCANDAND: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric = 1; + prewalk(0,level,ops[node+2].ival,&numarg); + break; + case OCOROR: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric = 1; + prewalk(0,level,ops[node+2].ival,&numarg); + break; + case OCNOT: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case ORELOP: + prewalk(0,level,ops[node+2].ival,&numarg); + numeric |= numarg; + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+3].ival,&numarg); + numeric |= numarg; + numeric = 1; + break; + case ORPAREN: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric |= numarg; + break; + case OMATCHOP: + prewalk(0,level,ops[node+2].ival,&numarg); + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+3].ival,&numarg); + numeric = 1; + break; + case OMPAREN: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric |= numarg; + break; + case OCONCAT: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + break; + case OASSIGN: + prewalk(0,level,ops[node+2].ival,&numarg); + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+3].ival,&numarg); + if (numarg || strlen(ops[ops[node+1].ival+1].cval) > (Size_t)1) { + numericize(ops[node+2].ival); + if (!numarg) + numericize(ops[node+3].ival); + } + numeric |= numarg; + break; + case OADD: + prewalk(1,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case OSUBTRACT: + prewalk(1,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case OMULT: + prewalk(1,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case ODIV: + prewalk(1,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case OPOW: + prewalk(1,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case OMOD: + prewalk(1,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case OPOSTINCR: + prewalk(1,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case OPOSTDECR: + prewalk(1,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case OPREINCR: + prewalk(1,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case OPREDECR: + prewalk(1,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case OUMINUS: + prewalk(1,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case OUPLUS: + prewalk(1,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case OPAREN: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric |= numarg; + break; + case OGETLINE: + break; + case OSPRINTF: + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OSUBSTR: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(1,level,ops[node+2].ival,&numarg); + if (len == 3) { + prewalk(1,level,ops[node+3].ival,&numarg); + } + break; + case OSTRING: + break; + case OSPLIT: + numeric = 1; + prewalk(0,level,ops[node+2].ival,&numarg); + if (len == 3) + prewalk(0,level,ops[node+3].ival,&numarg); + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OINDEX: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case OMATCH: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + numeric = 1; + break; + case OUSERDEF: + subretnum = FALSE; + --level; + tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); + ++level; + prewalk(0,level,ops[node+2].ival,&numarg); + prewalk(0,level,ops[node+4].ival,&numarg); + prewalk(0,level,ops[node+5].ival,&numarg); + --level; + str_cat(tmpstr,"("); + tmp2str = str_new(0); + if (subretnum || numarg) + str_set(tmp2str,"1"); + hstore(symtab,tmpstr->str_ptr,tmp2str); + str_free(tmpstr); + level++; + break; + case ORETURN: + if (len > 0) { + prewalk(0,level,ops[node+1].ival,&numarg); + if (numarg) + subretnum = TRUE; + } + break; + case OUSERFUN: + tmp2str = str_new(0); + str_scat(tmp2str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN)); + fixrargs(tmpstr->str_ptr,ops[node+2].ival,0); + str_free(tmpstr); + str_cat(tmp2str,"("); + tmpstr = hfetch(symtab,tmp2str->str_ptr); + if (tmpstr && tmpstr->str_ptr) + numeric |= atoi(tmpstr->str_ptr); + prewalk(0,level,ops[node+2].ival,&numarg); + str_free(tmp2str); + break; + case OGSUB: + case OSUB: + if (len >= 3) + prewalk(0,level,ops[node+3].ival,&numarg); + prewalk(0,level,ops[ops[node+2].ival+1].ival,&numarg); + prewalk(0,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case ONUM: + prewalk(0,level,ops[node+1].ival,&numarg); + numeric = 1; + break; + case OSTR: + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case ODEFINED: + case ODELETE: + case OSTAR: + case OVAR: + prewalk(0,level,ops[node+1].ival,&numarg); + if (len == 1) { + if (numit) + numericize(node); + } + else { + prewalk(0,level,ops[node+2].ival,&numarg); + } + break; + case OFLD: + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OVFLD: + i = ops[node+1].ival; + prewalk(0,level,i,&numarg); + break; + case OJUNK: + goto def; + case OSNEWLINE: + break; + case ONEWLINE: + break; + case OSCOMMENT: + break; + case OCOMMENT: + break; + case OCOMMA: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + prewalk(0,level,ops[node+3].ival,&numarg); + break; + case OSEMICOLON: + break; + case OSTATES: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + break; + case OSTATE: + if (len >= 1) { + prewalk(0,level,ops[node+1].ival,&numarg); + if (len >= 2) { + prewalk(0,level,ops[node+2].ival,&numarg); + } + } + break; + case OCLOSE: + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OPRINTF: + case OPRINT: + if (len == 3) { /* output redirection */ + prewalk(0,level,ops[node+3].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + } + prewalk(0+(type==OPRINT),level,ops[node+1].ival,&numarg); + break; + case ORAND: + break; + case OSRAND: + goto maybe0; + case OATAN2: + goto maybe0; + case OSIN: + goto maybe0; + case OCOS: + goto maybe0; + case OSYSTEM: + goto maybe0; + case OLENGTH: + goto maybe0; + case OLOG: + goto maybe0; + case OEXP: + goto maybe0; + case OSQRT: + goto maybe0; + case OINT: + maybe0: + numeric = 1; + if (len > 0) + prewalk(type != OLENGTH && type != OSYSTEM, + level,ops[node+1].ival,&numarg); + break; + case OBREAK: + break; + case ONEXT: + break; + case OEXIT: + if (len == 1) { + prewalk(1,level,ops[node+1].ival,&numarg); + } + break; + case OCONTINUE: + break; + case OREDIR: + goto def; + case OIF: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + if (len == 3) { + prewalk(0,level,ops[node+3].ival,&numarg); + } + break; + case OWHILE: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + break; + case OFOR: + prewalk(0,level,ops[node+1].ival,&numarg); + prewalk(0,level,ops[node+2].ival,&numarg); + prewalk(0,level,ops[node+3].ival,&numarg); + prewalk(0,level,ops[node+4].ival,&numarg); + break; + case OFORIN: + prewalk(0,level,ops[node+2].ival,&numarg); + prewalk(0,level,ops[node+1].ival,&numarg); + break; + case OBLOCK: + if (len == 2) { + prewalk(0,level,ops[node+2].ival,&numarg); + } + ++level; + prewalk(0,level,ops[node+1].ival,&numarg); + --level; + break; + default: + def: + if (len) { + if (len > 5) + fatal("Garbage length in prewalk"); + prewalk(0,level,ops[node+1].ival,&numarg); + for (i = 2; i<= len; i++) { + prewalk(0,level,ops[node+i].ival,&numarg); + } + } + break; + } + *numericptr = numeric; + return 1; +} + +static void +numericize(node) +register int node; +{ + register int len; + register int type; + STR *tmpstr; + STR *tmp2str; + int numarg; + + type = ops[node].ival; + len = type >> 8; + type &= 255; + if (type == OVAR && len == 1) { + tmpstr=walk(0,0,ops[node+1].ival,&numarg,P_MIN); + tmp2str = str_make("1"); + hstore(symtab,tmpstr->str_ptr,tmp2str); + } +} |