diff options
Diffstat (limited to 'x2p')
-rw-r--r-- | x2p/EXTERN.h | 8 | ||||
-rw-r--r-- | x2p/INTERN.h | 8 | ||||
-rw-r--r-- | x2p/Makefile | 134 | ||||
-rwxr-xr-x | x2p/Makefile.SH | 79 | ||||
-rw-r--r-- | x2p/a2p.c | 1607 | ||||
-rw-r--r-- | x2p/a2p.h | 15 | ||||
-rw-r--r-- | x2p/a2p.man | 15 | ||||
-rw-r--r-- | x2p/a2p.y | 11 | ||||
-rw-r--r-- | x2p/a2py.c | 23 | ||||
-rw-r--r-- | x2p/all | 0 | ||||
-rwxr-xr-x | x2p/cflags | 55 | ||||
-rwxr-xr-x | x2p/cflags.SH | 48 | ||||
l--------- | x2p/config.sh | 1 | ||||
-rwxr-xr-x | x2p/find2perl | 572 | ||||
-rwxr-xr-x | x2p/find2perl.SH | 22 | ||||
-rw-r--r-- | x2p/handy.h | 11 | ||||
-rw-r--r-- | x2p/hash.c | 8 | ||||
-rw-r--r-- | x2p/hash.h | 8 | ||||
-rw-r--r-- | x2p/make.out | 13 | ||||
-rw-r--r-- | x2p/makefile | 226 | ||||
-rw-r--r-- | x2p/malloc.c | 69 | ||||
-rwxr-xr-x | x2p/s2p | 760 | ||||
-rwxr-xr-x | x2p/s2p.SH | 42 | ||||
-rw-r--r-- | x2p/s2p.man | 15 | ||||
-rw-r--r-- | x2p/str.c | 10 | ||||
-rw-r--r-- | x2p/str.h | 8 | ||||
-rw-r--r-- | x2p/util.c | 17 | ||||
-rw-r--r-- | x2p/util.h | 11 | ||||
-rw-r--r-- | x2p/walk.c | 42 |
29 files changed, 118 insertions, 3720 deletions
diff --git a/x2p/EXTERN.h b/x2p/EXTERN.h index 6a77ad00cb..e4abe5f87b 100644 --- a/x2p/EXTERN.h +++ b/x2p/EXTERN.h @@ -6,14 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: EXTERN.h,v $ - * Revision 4.1 92/08/07 18:29:05 lwall - * - * Revision 4.0.1.1 91/06/07 12:11:15 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:56:53 lwall - * 4.0 baseline. - * */ #undef EXT diff --git a/x2p/INTERN.h b/x2p/INTERN.h index 64c528272d..aa3af58c8d 100644 --- a/x2p/INTERN.h +++ b/x2p/INTERN.h @@ -6,14 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: INTERN.h,v $ - * Revision 4.1 92/08/07 18:29:06 lwall - * - * Revision 4.0.1.1 91/06/07 12:11:20 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:56:58 lwall - * 4.0 baseline. - * */ #undef EXT diff --git a/x2p/Makefile b/x2p/Makefile deleted file mode 100644 index 6e87e87a23..0000000000 --- a/x2p/Makefile +++ /dev/null @@ -1,134 +0,0 @@ -# $RCSfile: Makefile.SH,v 3314Revision: 4.1 3314Date: 92/08/07 18:29:07 $ -# -# $Log: Makefile.SH,v $ -# Revision 4.1 92/08/07 18:29:07 lwall -# -# Revision 4.0.1.3 92/06/08 16:11:32 lwall -# patch20: SH files didn't work well with symbolic links -# patch20: cray didn't give enough memory to /bin/sh -# patch20: makefiles now display new shift/reduce expectations -# -# Revision 4.0.1.2 91/11/05 19:19:04 lwall -# patch11: random cleanup -# -# Revision 4.0.1.1 91/06/07 12:12:14 lwall -# patch4: cflags now emits entire cc command except for the filename -# -# Revision 4.0 91/03/20 01:57:03 lwall -# 4.0 baseline. -# -# - -CC = cc -YACC = yacc -bin = /usr/local/bin -lib = /usr/local/lib -mansrc = /usr/local/man/man1 -manext = 1 -LDFLAGS = -SMALL = -LARGE = -mallocsrc = malloc.c -mallocobj = malloc.o -shellflags = - -libs = -ldbm -ldl -lm -lposix - -CCCMD = `sh $(shellflags) cflags $@` - -public = a2p s2p find2perl - -private = - -manpages = a2p.man s2p.man - -util = - -sh = Makefile.SH makedepend.SH - -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.o $(mallocobj) str.o util.o walk.o - -lintflags = -phbvxac - -addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7 - -# grrr -SHELL = /bin/sh - -.c.o: - $(CCCMD) $*.c - -all: $(public) $(private) $(util) - touch all - -a2p: $(obj) a2p.o - $(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p - -a2p.c: a2p.y - @ echo Expect 231 shift/reduce conflicts... - $(YACC) a2p.y - mv y.tab.c a2p.c - -a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h - $(CCCMD) $(LARGE) a2p.c - -install: a2p s2p -# won't work with csh - export PATH || exit 1 - - mv $(bin)/a2p $(bin)/a2p.old 2>/dev/null - - mv $(bin)/s2p $(bin)/s2p.old 2>/dev/null - - if test `pwd` != $(bin); then cp $(public) $(bin); fi - cd $(bin); \ -for pub in $(public); do \ -chmod +x `basename $$pub`; \ -done - - if test `pwd` != $(mansrc); then \ -for page in $(manpages); do \ -cp $$page $(mansrc)/`basename $$page .man`.$(manext); \ -done; \ -fi - -clean: - rm -f a2p *.o a2p.c - -realclean: clean - rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p find2perl all cflags - -# 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 - ../makedepend - -clist: - echo $(c) | tr ' ' '\012' >.clist - -hlist: - echo $(h) | tr ' ' '\012' >.hlist - -shlist: - echo $(sh) | tr ' ' '\012' >.shlist - -config.sh: ../config.sh - rm -f config.sh - ln ../config.sh . - -malloc.c: ../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: makedepend.SH - /bin/sh $(shellflags) makedepend.SH diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH index f3c1a8d3d7..e24a9beb6d 100755 --- a/x2p/Makefile.SH +++ b/x2p/Makefile.SH @@ -1,46 +1,31 @@ -case "$0" in -*/*) cd `expr X$0 : 'X\(.*\)/'` ;; -esac case $CONFIG in '') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln -s ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - fi 2>/dev/null - . ./config.sh - ;; + 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 $ -# Revision 4.1 92/08/07 18:29:07 lwall -# -# Revision 4.0.1.3 92/06/08 16:11:32 lwall -# patch20: SH files didn't work well with symbolic links -# patch20: cray didn't give enough memory to /bin/sh -# patch20: makefiles now display new shift/reduce expectations -# -# Revision 4.0.1.2 91/11/05 19:19:04 lwall -# patch11: random cleanup -# -# Revision 4.0.1.1 91/06/07 12:12:14 lwall -# patch4: cflags now emits entire cc command except for the filename -# -# Revision 4.0 91/03/20 01:57:03 lwall -# 4.0 baseline. -# -# CC = $cc YACC = $yacc -bin = $bin -lib = $lib mansrc = $mansrc manext = $manext LDFLAGS = $ldflags @@ -65,7 +50,7 @@ manpages = a2p.man s2p.man util = -sh = Makefile.SH makedepend.SH +sh = Makefile.SH cflags.SH find2perl.SH s2p.SH h = EXTERN.h INTERN.h ../config.h handy.h hash.h a2p.h str.h util.h @@ -75,8 +60,6 @@ obj = hash.o $(mallocobj) str.o util.o walk.o lintflags = -phbvxac -addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7 - # grrr SHELL = /bin/sh @@ -90,34 +73,19 @@ a2p: $(obj) a2p.o $(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p a2p.c: a2p.y - @ echo Expect 231 shift/reduce conflicts... + @ echo Expect many shift/reduce and reduce/reduce conflicts... $(YACC) a2p.y mv y.tab.c a2p.c a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h $(CCCMD) $(LARGE) a2p.c -install: a2p s2p -# won't work with csh - export PATH || exit 1 - - mv $(bin)/a2p $(bin)/a2p.old 2>/dev/null - - mv $(bin)/s2p $(bin)/s2p.old 2>/dev/null - - if test `pwd` != $(bin); then cp $(public) $(bin); fi - cd $(bin); \ -for pub in $(public); do \ -chmod +x `basename $$pub`; \ -done - - if test `pwd` != $(mansrc); then \ -for page in $(manpages); do \ -cp $$page $(mansrc)/`basename $$page .man`.$(manext); \ -done; \ -fi - clean: rm -f a2p *.o a2p.c realclean: clean - rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p find2perl all cflags + rm -f *.orig */*.orig core $(addedbyconf) a2p.c all + rm -f Makefile cflags find2perl s2p makefile makefile.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. @@ -139,10 +107,6 @@ hlist: shlist: echo $(sh) | tr ' ' '\012' >.shlist -config.sh: ../config.sh - rm -f config.sh - ln ../config.sh . - malloc.c: ../malloc.c sed <../malloc.c >malloc.c \ -e 's/"perl.h"/"..\/perl.h"/' \ @@ -151,8 +115,7 @@ malloc.c: ../malloc.c # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE $(obj): @ echo "You haven't done a "'"make depend" yet!'; exit 1 -makedepend: makedepend.SH - /bin/sh $(shellflags) makedepend.SH +makedepend: depend !NO!SUBS! $eunicefix Makefile case `pwd` in diff --git a/x2p/a2p.c b/x2p/a2p.c deleted file mode 100644 index 41636f0c17..0000000000 --- a/x2p/a2p.c +++ /dev/null @@ -1,1607 +0,0 @@ -extern char *malloc(), *realloc(); - -# line 2 "a2p.y" -/* $RCSfile: a2p.y,v $$Revision: 4.0.1.2 $$Date: 92/06/08 16:13:03 $ - * - * 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 $ - * Revision 4.0.1.2 92/06/08 16:13:03 lwall - * patch20: in a2p, getline should allow variable to be array element - * - * Revision 4.0.1.1 91/06/07 12:12:41 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:57:21 lwall - * 4.0 baseline. - * - */ - -#include "INTERN.h" -#include "a2p.h" - -int root; -int begins = Nullop; -int ends = Nullop; - -# 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 yyclearin yychar = -1 -#define yyerrok yyerrflag = 0 -extern int yychar; -extern int yyerrflag; -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 150 -#endif -#ifndef YYSTYPE -#define YYSTYPE int -#endif -YYSTYPE yylval, yyval; -# define YYERRCODE 256 - -# line 402 "a2p.y" - -#include "a2py.c" -int yyexca[] ={ --1, 1, - 0, -1, - -2, 0, - }; -# define YYNPROD 137 -# define YYLAST 3142 -int yyact[]={ - - 63, 44, 156, 32, 50, 31, 222, 73, 74, 75, - 210, 53, 45, 46, 124, 49, 86, 307, 104, 158, - 74, 75, 52, 54, 53, 302, 126, 271, 306, 265, - 106, 107, 270, 245, 51, 157, 269, 21, 56, 92, - 2, 131, 55, 20, 48, 72, 19, 90, 69, 132, - 47, 196, 241, 102, 100, 272, 195, 193, 109, 110, - 111, 112, 253, 76, 79, 252, 72, 139, 15, 77, - 237, 68, 78, 311, 236, 160, 66, 64, 309, 65, - 293, 67, 187, 174, 255, 139, 198, 184, 183, 130, - 68, 80, 179, 129, 5, 66, 64, 71, 65, 128, - 67, 68, 286, 214, 199, 212, 66, 211, 105, 103, - 99, 67, 98, 97, 96, 95, 71, 108, 94, 89, - 88, 152, 87, 4, 153, 10, 9, 200, 69, 14, - 177, 178, 239, 140, 13, 3, 136, 137, 127, 1, - 0, 0, 0, 185, 186, 0, 72, 69, 151, 0, - 0, 154, 0, 0, 0, 0, 0, 0, 69, 0, - 0, 0, 0, 204, 205, 72, 0, 106, 107, 0, - 0, 0, 0, 0, 175, 176, 72, 213, 0, 215, - 76, 0, 140, 0, 0, 0, 77, 0, 0, 78, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 230, 231, 232, 233, 234, 235, 0, - 206, 207, 0, 0, 0, 0, 244, 0, 0, 0, - 159, 106, 107, 34, 35, 0, 162, 163, 37, 39, - 170, 0, 171, 173, 248, 166, 165, 164, 167, 168, - 33, 172, 42, 43, 41, 161, 36, 169, 44, 18, - 247, 27, 44, 38, 40, 54, 53, 249, 28, 45, - 46, 29, 30, 45, 46, 54, 53, 54, 53, 0, - 282, 18, 18, 238, 284, 285, 242, 243, 289, 290, - 54, 53, 240, 91, 54, 53, 0, 299, 300, 54, - 53, 0, 304, 0, 0, 6, 7, 8, 18, 0, - 0, 298, 0, 113, 114, 115, 116, 63, 70, 18, - 32, 310, 31, 313, 312, 315, 314, 316, 0, 18, - 0, 0, 303, 0, 247, 0, 158, 70, 201, 202, - 203, 0, 133, 135, 91, 91, 308, 287, 247, 141, - 143, 144, 145, 146, 147, 149, 91, 0, 0, 91, - 0, 301, 0, 0, 0, 18, 18, 0, 0, 0, - 63, 0, 0, 32, 0, 31, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 181, 158, - 0, 0, 0, 0, 0, 0, 0, 0, 141, 0, - 174, 0, 305, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 91, 91, - 63, 0, 208, 32, 209, 31, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 158, - 0, 219, 220, 0, 221, 0, 223, 225, 226, 227, - 228, 229, 0, 174, 0, 274, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 18, 0, - 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 63, 0, 0, 32, 0, 31, 0, 0, - 0, 0, 266, 0, 0, 0, 267, 268, 0, 0, - 0, 158, 0, 174, 0, 217, 275, 0, 276, 0, - 0, 0, 0, 0, 278, 0, 279, 0, 280, 0, - 281, 0, 0, 0, 0, 0, 0, 0, 18, 0, - 0, 0, 0, 0, 0, 0, 0, 159, 0, 0, - 34, 35, 18, 162, 163, 37, 39, 170, 0, 171, - 173, 0, 166, 165, 164, 167, 168, 33, 172, 42, - 43, 41, 0, 36, 169, 174, 0, 216, 27, 44, - 38, 40, 0, 0, 0, 28, 0, 0, 29, 30, - 45, 46, 63, 0, 0, 32, 0, 31, 0, 0, - 159, 0, 0, 34, 35, 0, 162, 163, 37, 39, - 170, 0, 171, 173, 0, 166, 165, 164, 167, 168, - 33, 172, 42, 43, 41, 0, 36, 169, 0, 0, - 0, 27, 44, 38, 40, 0, 0, 0, 28, 0, - 0, 29, 30, 45, 46, 0, 25, 0, 0, 32, - 159, 31, 0, 34, 35, 0, 162, 163, 37, 39, - 170, 0, 171, 173, 0, 166, 165, 164, 167, 168, - 33, 172, 42, 43, 41, 0, 36, 169, 0, 0, - 0, 27, 44, 38, 40, 0, 0, 0, 28, 0, - 0, 29, 30, 45, 46, 63, 0, 0, 32, 0, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 159, 0, 158, 34, 35, 0, 162, 163, - 37, 39, 170, 0, 171, 173, 0, 166, 165, 164, - 167, 168, 33, 172, 42, 43, 41, 0, 36, 169, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 63, 0, 0, - 32, 0, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 158, 0, 174, 0, - 197, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 63, 0, 0, 32, 138, 31, 0, 0, - 0, 0, 0, 0, 0, 34, 35, 0, 162, 163, - 37, 39, 59, 0, 58, 0, 0, 166, 165, 164, - 167, 168, 33, 0, 42, 43, 41, 0, 36, 169, - 174, 0, 155, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 0, 0, 0, - 0, 0, 0, 0, 0, 24, 0, 106, 107, 34, - 35, 0, 0, 0, 37, 39, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 26, 29, 30, 45, - 46, 0, 0, 0, 0, 159, 0, 0, 34, 35, - 0, 162, 163, 37, 39, 170, 0, 171, 173, 0, - 166, 165, 164, 167, 168, 33, 172, 42, 43, 41, - 63, 36, 169, 32, 0, 31, 27, 44, 38, 40, - 0, 0, 0, 28, 0, 0, 29, 30, 45, 46, - 59, 0, 58, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 159, 0, 0, - 34, 35, 0, 162, 163, 37, 39, 170, 0, 171, - 173, 0, 166, 165, 164, 167, 168, 33, 172, 42, - 43, 41, 0, 36, 169, 23, 0, 0, 27, 44, - 38, 40, 0, 0, 0, 28, 0, 0, 29, 30, - 45, 46, 0, 0, 62, 34, 35, 0, 0, 0, - 37, 39, 0, 0, 0, 81, 82, 62, 62, 85, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 62, 27, 44, 38, 40, 60, 57, 0, - 28, 0, 0, 29, 30, 45, 46, 0, 0, 0, - 62, 62, 62, 62, 62, 62, 25, 62, 0, 32, - 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, - 62, 62, 62, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 180, 0, 0, 0, 0, 0, 0, 62, - 63, 62, 0, 32, 0, 31, 0, 62, 0, 62, - 62, 62, 62, 62, 0, 62, 0, 0, 0, 12, - 0, 0, 0, 34, 35, 0, 0, 62, 37, 39, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 33, 0, 42, 43, 41, 62, 36, 62, 0, 0, - 0, 27, 44, 38, 40, 60, 57, 0, 28, 0, - 0, 29, 30, 45, 46, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 62, 62, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 62, 62, 62, 0, 62, - 0, 62, 62, 62, 62, 62, 0, 0, 0, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 62, 62, 62, 83, 84, 0, 0, 0, - 0, 62, 62, 0, 62, 62, 62, 62, 0, 0, - 101, 0, 0, 16, 17, 24, 0, 0, 0, 34, - 35, 0, 0, 0, 37, 39, 0, 0, 118, 119, - 120, 121, 122, 123, 0, 125, 33, 0, 42, 43, - 41, 11, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 61, 26, 29, 30, 45, - 46, 0, 25, 0, 0, 32, 0, 31, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 61, 61, 61, - 61, 288, 0, 34, 35, 0, 0, 0, 37, 39, - 0, 0, 0, 0, 0, 0, 0, 61, 0, 61, - 33, 0, 42, 43, 41, 61, 36, 61, 61, 61, - 61, 61, 25, 61, 0, 32, 0, 31, 28, 0, - 0, 29, 30, 45, 46, 61, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 218, 0, 61, 0, 0, 0, 0, - 0, 0, 0, 0, 63, 263, 0, 32, 264, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 61, 61, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 61, 61, 61, 0, 61, 0, 61, - 61, 61, 61, 61, 0, 0, 63, 261, 0, 32, - 262, 31, 0, 0, 0, 0, 0, 0, 0, 0, - 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 61, 61, 61, 0, 0, 0, 0, 0, 0, 61, - 61, 0, 61, 61, 61, 61, 63, 259, 0, 32, - 260, 31, 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, 24, 0, 0, 0, 34, 35, 0, 0, 0, - 37, 39, 63, 257, 0, 32, 258, 31, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 26, 29, 30, 45, 46, 0, 0, 0, - 0, 24, 0, 0, 0, 34, 35, 0, 0, 0, - 37, 39, 63, 251, 0, 32, 250, 31, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 26, 29, 30, 45, 46, 34, 35, 0, - 0, 0, 37, 39, 0, 0, 63, 0, 0, 32, - 0, 31, 0, 0, 33, 0, 42, 43, 41, 0, - 36, 0, 0, 0, 0, 27, 44, 38, 40, 0, - 0, 0, 28, 0, 0, 29, 30, 45, 46, 34, - 35, 0, 0, 0, 37, 39, 0, 0, 0, 0, - 0, 0, 142, 0, 0, 32, 33, 31, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 0, 0, 0, 0, 0, 0, 0, 0, 34, - 35, 0, 0, 0, 37, 39, 63, 297, 0, 32, - 0, 31, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 0, 0, 0, 0, 34, 35, 0, 0, 0, - 37, 39, 63, 296, 0, 32, 0, 31, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 0, 0, 0, - 0, 0, 0, 0, 0, 34, 35, 0, 0, 0, - 37, 39, 63, 295, 0, 32, 0, 31, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 106, 107, 34, - 35, 0, 0, 0, 37, 39, 63, 294, 0, 32, - 0, 31, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 24, 0, 0, 0, 34, 35, 0, 0, 0, - 37, 39, 63, 292, 0, 32, 0, 31, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 26, 29, 30, 45, 46, 0, 0, 34, - 35, 0, 0, 0, 37, 39, 63, 291, 0, 32, - 0, 31, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 0, 0, 0, 0, 34, 35, 0, 0, 63, - 37, 39, 32, 0, 31, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 0, 0, 0, - 0, 0, 0, 0, 0, 34, 35, 0, 0, 0, - 37, 39, 283, 63, 0, 0, 32, 0, 31, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 0, 0, 34, - 35, 0, 0, 0, 37, 39, 63, 273, 0, 32, - 0, 31, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 0, 0, 0, 0, 34, 35, 0, 0, 0, - 37, 39, 63, 256, 0, 32, 0, 31, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 0, 0, 34, - 35, 0, 0, 0, 37, 39, 63, 254, 0, 32, - 0, 31, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 0, 34, 35, 0, 0, 0, 37, 39, 0, - 0, 0, 63, 0, 0, 32, 0, 31, 0, 33, - 0, 42, 43, 41, 0, 36, 0, 0, 0, 0, - 27, 44, 38, 40, 0, 0, 0, 28, 0, 0, - 29, 30, 45, 46, 0, 0, 0, 0, 0, 0, - 0, 0, 277, 0, 0, 63, 34, 35, 32, 194, - 31, 37, 39, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 33, 0, 42, 43, 41, 0, 36, - 0, 0, 0, 0, 27, 44, 38, 40, 0, 0, - 0, 28, 0, 0, 29, 30, 45, 46, 63, 34, - 35, 32, 192, 31, 37, 39, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 0, 0, 0, 63, 34, 35, 32, 191, 31, - 37, 39, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 0, 63, 34, - 35, 32, 190, 31, 37, 39, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 33, 0, 42, 43, - 41, 0, 36, 0, 0, 0, 0, 27, 44, 38, - 40, 0, 0, 0, 28, 0, 0, 29, 30, 45, - 46, 224, 0, 0, 63, 34, 35, 32, 189, 31, - 37, 39, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 33, 0, 42, 43, 41, 0, 36, 0, - 0, 0, 0, 27, 44, 38, 40, 0, 0, 0, - 28, 0, 0, 29, 30, 45, 46, 63, 34, 35, - 32, 188, 31, 37, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 42, 43, 41, - 0, 36, 0, 0, 0, 0, 27, 44, 38, 40, - 0, 0, 0, 28, 0, 0, 29, 30, 45, 46, - 0, 34, 35, 0, 0, 0, 37, 39, 63, 182, - 0, 32, 0, 31, 0, 0, 0, 0, 33, 0, - 42, 43, 41, 0, 36, 0, 0, 0, 0, 27, - 44, 38, 40, 0, 0, 0, 28, 0, 0, 29, - 30, 45, 46, 0, 0, 0, 0, 34, 35, 0, - 0, 0, 37, 39, 63, 0, 0, 32, 0, 31, - 0, 0, 0, 0, 33, 0, 42, 43, 41, 0, - 36, 0, 0, 0, 0, 27, 44, 38, 40, 0, - 0, 0, 28, 0, 0, 29, 30, 45, 46, 0, - 0, 34, 35, 0, 0, 0, 37, 39, 0, 0, - 63, 0, 0, 32, 0, 31, 0, 0, 33, 0, - 42, 43, 41, 0, 36, 0, 0, 0, 0, 27, - 44, 38, 40, 0, 0, 0, 28, 0, 0, 29, - 30, 45, 46, 0, 0, 0, 0, 34, 35, 0, - 0, 0, 37, 39, 63, 0, 0, 32, 138, 31, - 0, 0, 0, 0, 33, 0, 42, 43, 41, 0, - 36, 0, 0, 0, 0, 27, 44, 38, 40, 0, - 0, 0, 28, 0, 0, 29, 30, 45, 46, 0, - 34, 35, 0, 0, 0, 37, 39, 63, 134, 0, - 32, 0, 31, 0, 0, 0, 0, 33, 0, 42, - 43, 41, 0, 36, 0, 0, 0, 0, 27, 44, - 38, 40, 0, 0, 0, 28, 0, 0, 29, 30, - 45, 46, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 34, 35, 0, 0, 63, 37, 39, 32, 0, - 31, 0, 0, 0, 0, 0, 0, 0, 33, 0, - 42, 43, 41, 0, 36, 0, 0, 0, 0, 27, - 44, 38, 40, 0, 0, 0, 28, 0, 0, 29, - 30, 45, 46, 150, 0, 0, 0, 34, 35, 0, - 0, 63, 37, 39, 32, 0, 31, 0, 0, 0, - 0, 0, 0, 0, 33, 0, 42, 43, 41, 0, - 36, 0, 0, 0, 0, 27, 44, 38, 40, 0, - 0, 0, 28, 0, 0, 29, 30, 45, 46, 148, - 0, 0, 0, 34, 35, 0, 0, 93, 37, 39, - 32, 0, 31, 0, 0, 0, 0, 0, 0, 0, - 33, 0, 42, 43, 41, 0, 36, 0, 0, 0, - 0, 27, 44, 38, 40, 0, 0, 0, 28, 0, - 0, 29, 30, 45, 46, 0, 0, 34, 35, 0, - 0, 0, 37, 39, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 33, 0, 42, 43, 41, 0, - 36, 0, 0, 0, 0, 27, 44, 38, 40, 0, - 0, 0, 28, 0, 0, 29, 30, 45, 46, 0, - 34, 35, 0, 0, 0, 37, 39, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 33, 0, 42, - 43, 41, 0, 36, 0, 0, 0, 0, 27, 44, - 38, 40, 0, 0, 0, 28, 0, 0, 29, 30, - 45, 46, 0, 0, 117, 0, 0, 0, 34, 35, - 0, 0, 0, 37, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 42, 43, 41, - 0, 36, 0, 0, 0, 0, 27, 44, 38, 40, - 0, 0, 0, 28, 0, 0, 29, 30, 45, 46, - 0, 0, 0, 0, 34, 35, 0, 0, 0, 37, - 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 33, 0, 42, 43, 41, 0, 36, 0, 0, - 0, 0, 27, 44, 38, 40, 0, 0, 0, 28, - 0, 0, 29, 30, 45, 46, 0, 0, 0, 0, - 34, 35, 0, 0, 0, 37, 39, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 33, 0, 42, - 43, 41, 0, 36, 0, 0, 0, 0, 27, 44, - 38, 40, 0, 0, 0, 28, 0, 0, 29, 30, - 45, 46 }; -int yypact[]={ - - -1000, -1000, 35, 1016, -1000, -1000, -1000, -1000, -1000, -1000, - -79, -271, -1000, -1000, -227, -22, -81, -85, 880, -1000, - -1000, -1000, 53, -281, -1000, 1332, 1332, -1000, -1000, -291, - -291, 2791, 2791, -44, 82, 80, 79, 2837, 78, 75, - 74, 73, 72, 70, -37, -1000, 2791, 35, -1000, 69, - -231, -1000, 1332, -1000, -1000, -1000, -1000, 2791, 2791, 2791, - 2745, 53, -293, 1332, 2791, 2791, 2791, 2791, 2791, 2791, - -278, 2791, -254, 1332, -1000, -1000, 58, 52, 48, 0, - -1000, -1000, -1000, -46, -46, -11, 2791, 2697, 2837, 2837, - -1000, 2654, 23, 1652, 2791, 2791, 2791, 2791, 2610, 2564, - 2837, -67, -231, 2837, 697, -1000, -1000, -1000, -266, 586, - 586, -231, -231, 1080, 1080, 1080, 1080, -1000, 64, 64, - -46, -46, -46, -46, -1000, 34, -291, -266, -1000, -1000, - -1000, -1000, 2791, 1080, -1000, 2518, 47, 46, -1000, -1000, - 41, 742, 1652, 2467, 2424, 2378, 2334, 2288, 13, 2245, - 12, -42, 635, 45, -1000, -1000, -1000, 68, -1000, -1000, - -1000, 2791, 2837, 2837, -1000, -1000, 2791, -1000, 2791, -282, - 67, 65, -1000, 63, -1000, -1000, -279, 432, 370, 2791, - -1000, 1080, -1000, -1000, -1000, 1606, 1606, -1000, 2791, -286, - 2791, 2202, 2791, 2791, 2791, 2791, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -231, -231, 8, 8, 2791, 2791, - -39, 1332, 1332, -40, 532, -231, -1000, -1000, 53, 2791, - 2791, 1562, 21, 2156, 43, 2112, 1512, 1466, 1416, 1374, - -94, -231, -231, -231, -231, -231, 2791, -1000, -1000, -1000, - 2791, 2791, -5, -9, -245, -4, 2066, -1000, 320, 35, - 2791, -1000, 2023, -1000, -1000, -1000, -1000, -1000, 2791, -1000, - 2791, -1000, 2791, -1000, 2791, -1000, 2791, 2791, 1969, -1000, - -1000, 62, 1282, -1000, -1000, 1926, 1882, 39, 1836, 1792, - 1742, 1696, -231, -1000, -40, -40, 1332, -34, 532, -40, - -231, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 267, -243, - -1000, -24, 532, 37, -1000, -1000, -1000, -1000, 32, -1000, - -40, -1000, -40, -1000, -40, -1000, -1000 }; -int yypgo[]={ - - 0, 139, 40, 135, 134, 4, 18, 129, 126, 125, - 124, 47, 64, 245, 46, 43, 37, 1223, 985, 39, - 123, 108, 104, 2, 35, 75, 33, 74 }; -int yyr1[]={ - - 0, 1, 4, 7, 7, 3, 3, 8, 8, 8, - 8, 8, 8, 10, 9, 9, 12, 12, 12, 12, - 16, 16, 16, 16, 15, 15, 15, 15, 14, 14, - 14, 14, 13, 13, 13, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 18, 18, 18, 18, 11, 11, 11, 19, 19, - 19, 2, 2, 20, 20, 20, 20, 5, 5, 21, - 21, 22, 22, 22, 22, 6, 6, 23, 23, 23, - 23, 26, 26, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 27, 27, 27, 25, - 25, 25, 25, 25, 25, 25, 25 }; -int yyr2[]={ - - 0, 5, 13, 11, 5, 7, 1, 3, 11, 21, - 9, 2, 2, 3, 3, 7, 2, 2, 2, 2, - 7, 9, 9, 5, 7, 7, 7, 7, 7, 7, - 3, 7, 3, 5, 7, 3, 3, 3, 7, 7, - 7, 7, 7, 7, 7, 11, 5, 5, 5, 5, - 5, 5, 7, 3, 5, 7, 9, 7, 9, 3, - 7, 9, 9, 9, 5, 17, 13, 17, 17, 13, - 13, 13, 13, 13, 13, 13, 13, 17, 17, 17, - 17, 3, 9, 3, 5, 2, 2, 1, 9, 9, - 7, 5, 1, 3, 3, 3, 3, 5, 1, 3, - 3, 5, 5, 5, 5, 5, 1, 7, 5, 5, - 2, 2, 1, 2, 9, 5, 9, 5, 3, 3, - 3, 5, 3, 3, 5, 11, 3, 3, 3, 13, - 19, 13, 15, 21, 19, 13, 11 }; -int yychk[]={ - - -1000, -1, -2, -3, -20, 59, 260, 261, 262, -8, - -9, 285, 123, -4, -7, -12, 257, 258, -13, -14, - -15, -16, -17, -18, 259, 40, 300, 291, 298, 301, - 302, 45, 43, 280, 263, 264, 286, 268, 293, 269, - 294, 284, 282, 283, 292, 303, 304, -2, 123, 286, - -5, 261, 44, 290, 289, 123, 123, 296, 62, 60, - 295, -17, -18, 40, 43, 45, 42, 47, 37, 94, - 274, 63, 112, 288, 301, 302, -16, -15, -14, -12, - -12, -18, -18, -17, -17, -18, 60, 40, 40, 40, - -11, -13, -19, 40, 40, 40, 40, 40, 40, 40, - 91, -17, -5, 40, -6, -21, 261, 262, -12, -5, - -5, -5, -5, -13, -13, -13, -13, 259, -17, -17, - -17, -17, -17, -17, 292, -17, 280, -12, 41, 41, - 41, 41, 60, -13, 41, -13, -11, -11, 44, 44, - -19, -13, 40, -13, -13, -13, -13, -13, 259, -13, - 259, -11, -6, -10, -11, 125, -23, -24, 59, 260, - -25, -13, 266, 267, 277, 276, 275, 278, 279, 287, - 270, 272, 281, 273, 123, -12, -12, -6, -6, 58, - -18, -13, 41, 41, 41, -5, -5, 41, 44, 44, - 44, 44, 44, 44, 44, 44, 93, 125, 41, -22, - 59, 260, 261, 262, -5, -5, -11, -11, -13, -13, - 292, 40, 40, -5, 40, -5, 125, 125, -17, -13, - -13, -13, 292, -13, 259, -13, -13, -13, -13, -13, - -5, -5, -5, -5, -5, -5, -27, 62, 265, 124, - -27, 91, -12, -12, -23, -26, -13, -24, -6, -2, - 44, 41, 44, 41, 41, 41, 41, 41, 44, 41, - 44, 41, 44, 41, 44, 123, -13, -13, -13, 41, - 41, 272, 59, 41, 125, -13, -13, 259, -13, -13, - -13, -13, -5, 93, -5, -5, 40, -12, 59, -5, - -5, 41, 41, 41, 41, 41, 41, 41, -6, -23, - -23, -12, 59, -26, -23, 125, 271, 41, -26, 41, - -5, 41, -5, -23, -5, -23, -23 }; -int yydef[]={ - - 92, -2, 6, 1, 91, 93, 94, 95, 96, 92, - 7, 0, 98, 11, 12, 14, 0, 0, 16, 17, - 18, 19, 32, 35, 30, 0, 0, 36, 37, 0, - 0, 0, 0, 53, 59, 0, 0, 87, 0, 0, - 0, 0, 0, 0, 81, 83, 0, 5, 98, 0, - 106, 4, 0, 98, 98, 98, 98, 0, 0, 0, - 0, 33, 35, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 46, 47, 19, 18, 17, 0, - 23, 48, 49, 50, 51, 54, 0, 0, 87, 87, - 64, 85, 86, 0, 0, 0, 0, 0, 0, 0, - 87, 84, 106, 87, 0, 97, 99, 100, 15, 0, - 0, 106, 106, 24, 25, 26, 28, 29, 38, 39, - 40, 41, 42, 43, 44, 0, 57, 34, 20, 27, - 31, 52, 0, 55, 60, 0, 0, 0, 98, 98, - 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 13, 10, 105, 0, 98, 98, - 110, 113, 87, 87, 118, 119, 120, 122, 123, 0, - 0, 0, 98, 0, 98, 21, 22, 0, 0, 0, - 58, 56, 61, 62, 63, 0, 0, 90, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 8, 98, 98, - 98, 98, 98, 98, 108, 109, 115, 117, 121, 124, - 0, 0, 0, 0, 112, 106, 92, 3, 45, 88, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 107, 101, 102, 103, 104, 0, 126, 127, 128, - 0, 0, 0, 0, 0, 0, 113, 111, 0, 2, - 0, 66, 0, 69, 70, 71, 72, 73, 0, 74, - 0, 75, 0, 76, 0, 98, 114, 116, 0, 98, - 98, 0, 0, 98, 98, 0, 0, 0, 0, 0, - 0, 0, 106, 125, 0, 0, 0, 0, 112, 0, - 136, 65, 67, 68, 77, 78, 79, 80, 0, 129, - 131, 0, 112, 0, 135, 9, 98, 132, 0, 98, - 0, 98, 0, 130, 0, 134, 133 }; -typedef struct { char *t_name; int t_val; } yytoktype; -#ifndef YYDEBUG -# define YYDEBUG 0 /* don't allow debugging */ -#endif - -#if YYDEBUG - -yytoktype yytoks[] = -{ - "BEGIN", 257, - "END", 258, - "REGEX", 259, - "SEMINEW", 260, - "NEWLINE", 261, - "COMMENT", 262, - "FUN1", 263, - "FUNN", 264, - "GRGR", 265, - "PRINT", 266, - "PRINTF", 267, - "SPRINTF", 268, - "SPLIT", 269, - "IF", 270, - "ELSE", 271, - "WHILE", 272, - "FOR", 273, - "IN", 274, - "EXIT", 275, - "NEXT", 276, - "BREAK", 277, - "CONTINUE", 278, - "RET", 279, - "GETLINE", 280, - "DO", 281, - "SUB", 282, - "GSUB", 283, - "MATCH", 284, - "FUNCTION", 285, - "USERFUN", 286, - "DELETE", 287, - "ASGNOP", 288, - "?", 63, - ":", 58, - "OROR", 289, - "ANDAND", 290, - "NUMBER", 291, - "VAR", 292, - "SUBSTR", 293, - "INDEX", 294, - "MATCHOP", 295, - "RELOP", 296, - "<", 60, - ">", 62, - "OR", 297, - "STRING", 298, - "+", 43, - "-", 45, - "*", 42, - "/", 47, - "%", 37, - "UMINUS", 299, - "NOT", 300, - "^", 94, - "INCR", 301, - "DECR", 302, - "FIELD", 303, - "VFIELD", 304, - "-unknown-", -1 /* ends search */ -}; - -char * yyreds[] = -{ - "-no such reduction-", - "program : junk hunks", - "begin : BEGIN '{' maybe states '}' junk", - "end : END '{' maybe states '}'", - "end : end NEWLINE", - "hunks : hunks hunk junk", - "hunks : /* empty */", - "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", - "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 : term '?' term ':' term", - "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 : /* empty */", - "clist : expr ',' maybe expr", - "clist : clist ',' maybe expr", - "clist : '(' clist ')'", - "junk : junk hunksep", - "junk : /* empty */", - "hunksep : ';'", - "hunksep : SEMINEW", - "hunksep : NEWLINE", - "hunksep : COMMENT", - "maybe : maybe nlstuff", - "maybe : /* empty */", - "nlstuff : NEWLINE", - "nlstuff : COMMENT", - "separator : ';' maybe", - "separator : SEMINEW maybe", - "separator : NEWLINE maybe", - "separator : COMMENT maybe", - "states : states statement", - "states : /* empty */", - "statement : simple separator maybe", - "statement : ';' maybe", - "statement : SEMINEW maybe", - "statement : compound", - "simpnull : simple", - "simpnull : /* empty */", - "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 ']'", - "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 /* YYDEBUG */ -#line 1 "/usr/lib/yaccpar" -/* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */ - -/* -** Skeleton parser driver for yacc output -*/ - -/* -** yacc user known macros and defines -*/ -#define YYERROR goto yyerrlab -#define YYACCEPT { free(yys); free(yyv); return(0); } -#define YYABORT { free(yys); free(yyv); return(1); } -#define YYBACKUP( newtoken, newvalue )\ -{\ - if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ - {\ - yyerror( "syntax error - cannot backup" );\ - goto yyerrlab;\ - }\ - yychar = newtoken;\ - yystate = *yyps;\ - yylval = newvalue;\ - goto yynewstate;\ -} -#define YYRECOVERING() (!!yyerrflag) -#ifndef YYDEBUG -# define YYDEBUG 1 /* make debugging available */ -#endif - -/* -** user known globals -*/ -int yydebug; /* set to 1 to get debugging */ - -/* -** driver internal defines -*/ -#define YYFLAG (-1000) - -/* -** static variables used by the parser -*/ -static YYSTYPE *yyv; /* value stack */ -static int *yys; /* state stack */ - -static YYSTYPE *yypv; /* top of value stack */ -static int *yyps; /* top of state stack */ - -static int yystate; /* current state */ -static int yytmp; /* extra var (lasts between blocks) */ - -int yynerrs; /* number of errors */ - -int yyerrflag; /* error recovery flag */ -int yychar; /* current input token number */ - - -/* -** yyparse - return 0 if worked, 1 if syntax error not recovered from -*/ -int -yyparse() -{ - register YYSTYPE *yypvt; /* top of value stack for $vars */ - unsigned yymaxdepth = YYMAXDEPTH; - - /* - ** Initialize externals - yyparse may be called more than once - */ - yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE)); - yys = (int*)malloc(yymaxdepth*sizeof(int)); - if (!yyv || !yys) - { - yyerror( "out of memory" ); - return(1); - } - yypv = &yyv[-1]; - yyps = &yys[-1]; - yystate = 0; - yytmp = 0; - yynerrs = 0; - yyerrflag = 0; - yychar = -1; - - goto yystack; - { - register YYSTYPE *yy_pv; /* top of value stack */ - register int *yy_ps; /* top of state stack */ - register int yy_state; /* current state */ - register int yy_n; /* internal state number info */ - - /* - ** get globals into registers. - ** branch to here only if YYBACKUP was called. - */ - yynewstate: - yy_pv = yypv; - yy_ps = yyps; - yy_state = yystate; - goto yy_newstate; - - /* - ** get globals into registers. - ** either we just started, or we just finished a reduction - */ - yystack: - yy_pv = yypv; - yy_ps = yyps; - yy_state = yystate; - - /* - ** top of for (;;) loop while no reductions done - */ - yy_stack: - /* - ** put a state and value onto the stacks - */ -#if YYDEBUG - /* - ** if debugging, look up token value in list of value vs. - ** name pairs. 0 and negative (-1) are special values. - ** Note: linear search is used since time is not a real - ** consideration while debugging. - */ - if ( yydebug ) - { - register int yy_i; - - (void)printf( "State %d, token ", yy_state ); - if ( yychar == 0 ) - (void)printf( "end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "-none-\n" ); - else - { - for ( yy_i = 0; yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val == yychar ) - break; - } - (void)printf( "%s\n", yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ - { - /* - ** reallocate and recover. Note that pointers - ** have to be reset, or bad things will happen - */ - int yyps_index = (yy_ps - yys); - int yypv_index = (yy_pv - yyv); - int yypvt_index = (yypvt - yyv); - yymaxdepth += YYMAXDEPTH; - yyv = (YYSTYPE*)realloc((char*)yyv, - yymaxdepth * sizeof(YYSTYPE)); - yys = (int*)realloc((char*)yys, - yymaxdepth * sizeof(int)); - if (!yyv || !yys) - { - yyerror( "yacc stack overflow" ); - return(1); - } - yy_ps = yys + yyps_index; - yy_pv = yyv + yypv_index; - yypvt = yyv + yypvt_index; - } - *yy_ps = yy_state; - *++yy_pv = yyval; - - /* - ** we have a new state - find out what to do - */ - yy_newstate: - if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) - goto yydefault; /* simple state */ -#if YYDEBUG - /* - ** if debugging, need to mark whether new token grabbed - */ - yytmp = yychar < 0; -#endif - if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) ) - yychar = 0; /* reached EOF */ -#if YYDEBUG - if ( yydebug && yytmp ) - { - register int yy_i; - - (void)printf( "Received token " ); - if ( yychar == 0 ) - (void)printf( "end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "-none-\n" ); - else - { - for ( yy_i = 0; yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val == yychar ) - break; - } - (void)printf( "%s\n", yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) - goto yydefault; - if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ - { - yychar = -1; - yyval = yylval; - yy_state = yy_n; - if ( yyerrflag > 0 ) - yyerrflag--; - goto yy_stack; - } - - yydefault: - if ( ( yy_n = yydef[ yy_state ] ) == -2 ) - { -#if YYDEBUG - yytmp = yychar < 0; -#endif - if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) ) - yychar = 0; /* reached EOF */ -#if YYDEBUG - if ( yydebug && yytmp ) - { - register int yy_i; - - (void)printf( "Received token " ); - if ( yychar == 0 ) - (void)printf( "end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "-none-\n" ); - else - { - for ( yy_i = 0; - yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val - == yychar ) - { - break; - } - } - (void)printf( "%s\n", yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - /* - ** look through exception table - */ - { - register int *yyxi = yyexca; - - while ( ( *yyxi != -1 ) || - ( yyxi[1] != yy_state ) ) - { - yyxi += 2; - } - while ( ( *(yyxi += 2) >= 0 ) && - ( *yyxi != yychar ) ) - ; - if ( ( yy_n = yyxi[1] ) < 0 ) - YYACCEPT; - } - } - - /* - ** check for syntax error - */ - if ( yy_n == 0 ) /* have an error */ - { - /* no worry about speed here! */ - switch ( yyerrflag ) - { - case 0: /* new error */ - yyerror( "syntax error" ); - goto skip_init; - yyerrlab: - /* - ** get globals into registers. - ** we have a user generated syntax type error - */ - yy_pv = yypv; - yy_ps = yyps; - yy_state = yystate; - yynerrs++; - skip_init: - case 1: - case 2: /* incompletely recovered error */ - /* try again... */ - yyerrflag = 3; - /* - ** find state where "error" is a legal - ** shift action - */ - while ( yy_ps >= yys ) - { - yy_n = yypact[ *yy_ps ] + YYERRCODE; - if ( yy_n >= 0 && yy_n < YYLAST && - yychk[yyact[yy_n]] == YYERRCODE) { - /* - ** simulate shift of "error" - */ - yy_state = yyact[ yy_n ]; - goto yy_stack; - } - /* - ** current state has no shift on - ** "error", pop stack - */ -#if YYDEBUG -# define _POP_ "Error recovery pops state %d, uncovers state %d\n" - if ( yydebug ) - (void)printf( _POP_, *yy_ps, - yy_ps[-1] ); -# undef _POP_ -#endif - yy_ps--; - yy_pv--; - } - /* - ** there is no state on stack with "error" as - ** a valid shift. give up. - */ - YYABORT; - case 3: /* no shift yet; eat a token */ -#if YYDEBUG - /* - ** if debugging, look up token in list of - ** pairs. 0 and negative shouldn't occur, - ** but since timing doesn't matter when - ** debugging, it doesn't hurt to leave the - ** tests here. - */ - if ( yydebug ) - { - register int yy_i; - - (void)printf( "Error recovery discards " ); - if ( yychar == 0 ) - (void)printf( "token end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "token -none-\n" ); - else - { - for ( yy_i = 0; - yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val - == yychar ) - { - break; - } - } - (void)printf( "token %s\n", - yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - if ( yychar == 0 ) /* reached EOF. quit */ - YYABORT; - yychar = -1; - goto yy_newstate; - } - }/* end if ( yy_n == 0 ) */ - /* - ** reduction by production yy_n - ** put stack tops, etc. so things right after switch - */ -#if YYDEBUG - /* - ** if debugging, print the string that is the user's - ** specification of the reduction which is just about - ** to be done. - */ - if ( yydebug ) - (void)printf( "Reduce by (%d) \"%s\"\n", - yy_n, yyreds[ yy_n ] ); -#endif - yytmp = yy_n; /* value to switch over */ - yypvt = yy_pv; /* $vars top of value stack */ - /* - ** Look in goto table for next state - ** Sorry about using yy_state here as temporary - ** register variable, but why not, if it works... - ** If yyr2[ yy_n ] doesn't have the low order bit - ** set, then there is no action to be done for - ** this reduction. So, no saving & unsaving of - ** registers done. The only difference between the - ** code just after the if and the body of the if is - ** the goto yy_stack in the body. This way the test - ** can be made before the choice of what to do is needed. - */ - { - /* length of production doubled with extra bit */ - register int yy_len = yyr2[ yy_n ]; - - if ( !( yy_len & 01 ) ) - { - yy_len >>= 1; - yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ - yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + - *( yy_ps -= yy_len ) + 1; - if ( yy_state >= YYLAST || - yychk[ yy_state = - yyact[ yy_state ] ] != -yy_n ) - { - yy_state = yyact[ yypgo[ yy_n ] ]; - } - goto yy_stack; - } - yy_len >>= 1; - yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ - yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + - *( yy_ps -= yy_len ) + 1; - if ( yy_state >= YYLAST || - yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) - { - yy_state = yyact[ yypgo[ yy_n ] ]; - } - } - /* save until reenter driver code */ - yystate = yy_state; - yyps = yy_ps; - yypv = yy_pv; - } - /* - ** code supplied by user is placed in this switch - */ - switch( yytmp ) - { - -case 1: -# line 60 "a2p.y" -{ root = oper4(OPROG,yypvt[-1],begins,yypvt[-0],ends); } break; -case 2: -# line 64 "a2p.y" -{ begins = oper4(OJUNK,begins,yypvt[-3],yypvt[-2],yypvt[-0]); in_begin = FALSE; - yyval = Nullop; } break; -case 3: -# line 69 "a2p.y" -{ ends = oper3(OJUNK,ends,yypvt[-2],yypvt[-1]); yyval = Nullop; } break; -case 4: -# line 71 "a2p.y" -{ yyval = yypvt[-1]; } break; -case 5: -# line 75 "a2p.y" -{ yyval = oper3(OHUNKS,yypvt[-2],yypvt[-1],yypvt[-0]); } break; -case 6: -# line 77 "a2p.y" -{ yyval = Nullop; } break; -case 7: -# line 81 "a2p.y" -{ yyval = oper1(OHUNK,yypvt[-0]); need_entire = TRUE; } break; -case 8: -# line 83 "a2p.y" -{ yyval = oper2(OHUNK,yypvt[-4],oper2(OJUNK,yypvt[-2],yypvt[-1])); } break; -case 9: -# line 85 "a2p.y" -{ fixfargs(yypvt[-8],yypvt[-6],0); yyval = oper5(OUSERDEF,yypvt[-8],yypvt[-6],yypvt[-4],yypvt[-2],yypvt[-1]); } break; -case 10: -# line 87 "a2p.y" -{ yyval = oper2(OHUNK,Nullop,oper2(OJUNK,yypvt[-2],yypvt[-1])); } break; -case 13: -# line 93 "a2p.y" -{ yyval = rememberargs(yyval); } break; -case 14: -# line 97 "a2p.y" -{ yyval = oper1(OPAT,yypvt[-0]); } break; -case 15: -# line 99 "a2p.y" -{ yyval = oper2(ORANGE,yypvt[-2],yypvt[-0]); } break; -case 20: -# line 110 "a2p.y" -{ yyval = oper1(OCPAREN,yypvt[-1]); } break; -case 21: -# line 112 "a2p.y" -{ yyval = oper3(OCANDAND,yypvt[-3],yypvt[-1],yypvt[-0]); } break; -case 22: -# line 114 "a2p.y" -{ yyval = oper3(OCOROR,yypvt[-3],yypvt[-1],yypvt[-0]); } break; -case 23: -# line 116 "a2p.y" -{ yyval = oper1(OCNOT,yypvt[-0]); } break; -case 24: -# line 120 "a2p.y" -{ yyval = oper3(ORELOP,yypvt[-1],yypvt[-2],yypvt[-0]); } break; -case 25: -# line 122 "a2p.y" -{ yyval = oper3(ORELOP,string(">",1),yypvt[-2],yypvt[-0]); } break; -case 26: -# line 124 "a2p.y" -{ yyval = oper3(ORELOP,string("<",1),yypvt[-2],yypvt[-0]); } break; -case 27: -# line 126 "a2p.y" -{ yyval = oper1(ORPAREN,yypvt[-1]); } break; -case 28: -# line 130 "a2p.y" -{ yyval = oper3(OMATCHOP,yypvt[-1],yypvt[-2],yypvt[-0]); } break; -case 29: -# line 132 "a2p.y" -{ yyval = oper3(OMATCHOP,yypvt[-1],yypvt[-2],oper1(OREGEX,yypvt[-0])); } break; -case 30: -# line 134 "a2p.y" -{ yyval = oper1(OREGEX,yypvt[-0]); } break; -case 31: -# line 136 "a2p.y" -{ yyval = oper1(OMPAREN,yypvt[-1]); } break; -case 32: -# line 140 "a2p.y" -{ yyval = yypvt[-0]; } break; -case 33: -# line 142 "a2p.y" -{ yyval = oper2(OCONCAT,yypvt[-1],yypvt[-0]); } break; -case 34: -# line 144 "a2p.y" -{ yyval = oper3(OASSIGN,yypvt[-1],yypvt[-2],yypvt[-0]); - if ((ops[yypvt[-2]].ival & 255) == OFLD) - lval_field = TRUE; - if ((ops[yypvt[-2]].ival & 255) == OVFLD) - lval_field = TRUE; - } break; -case 35: -# line 153 "a2p.y" -{ yyval = yypvt[-0]; } break; -case 36: -# line 155 "a2p.y" -{ yyval = oper1(ONUM,yypvt[-0]); } break; -case 37: -# line 157 "a2p.y" -{ yyval = oper1(OSTR,yypvt[-0]); } break; -case 38: -# line 159 "a2p.y" -{ yyval = oper2(OADD,yypvt[-2],yypvt[-0]); } break; -case 39: -# line 161 "a2p.y" -{ yyval = oper2(OSUBTRACT,yypvt[-2],yypvt[-0]); } break; -case 40: -# line 163 "a2p.y" -{ yyval = oper2(OMULT,yypvt[-2],yypvt[-0]); } break; -case 41: -# line 165 "a2p.y" -{ yyval = oper2(ODIV,yypvt[-2],yypvt[-0]); } break; -case 42: -# line 167 "a2p.y" -{ yyval = oper2(OMOD,yypvt[-2],yypvt[-0]); } break; -case 43: -# line 169 "a2p.y" -{ yyval = oper2(OPOW,yypvt[-2],yypvt[-0]); } break; -case 44: -# line 171 "a2p.y" -{ yyval = oper2(ODEFINED,aryrefarg(yypvt[-0]),yypvt[-2]); } break; -case 45: -# line 173 "a2p.y" -{ yyval = oper3(OCOND,yypvt[-4],yypvt[-2],yypvt[-0]); } break; -case 46: -# line 175 "a2p.y" -{ yyval = oper1(OPOSTINCR,yypvt[-1]); } break; -case 47: -# line 177 "a2p.y" -{ yyval = oper1(OPOSTDECR,yypvt[-1]); } break; -case 48: -# line 179 "a2p.y" -{ yyval = oper1(OPREINCR,yypvt[-0]); } break; -case 49: -# line 181 "a2p.y" -{ yyval = oper1(OPREDECR,yypvt[-0]); } break; -case 50: -# line 183 "a2p.y" -{ yyval = oper1(OUMINUS,yypvt[-0]); } break; -case 51: -# line 185 "a2p.y" -{ yyval = oper1(OUPLUS,yypvt[-0]); } break; -case 52: -# line 187 "a2p.y" -{ yyval = oper1(OPAREN,yypvt[-1]); } break; -case 53: -# line 189 "a2p.y" -{ yyval = oper0(OGETLINE); } break; -case 54: -# line 191 "a2p.y" -{ yyval = oper1(OGETLINE,yypvt[-0]); } break; -case 55: -# line 193 "a2p.y" -{ yyval = oper3(OGETLINE,Nullop,string("<",1),yypvt[-0]); - if (ops[yypvt[-0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } break; -case 56: -# line 196 "a2p.y" -{ yyval = oper3(OGETLINE,yypvt[-2],string("<",1),yypvt[-0]); - if (ops[yypvt[-0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } break; -case 57: -# line 199 "a2p.y" -{ yyval = oper3(OGETLINE,Nullop,string("|",1),yypvt[-2]); - if (ops[yypvt[-2]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } break; -case 58: -# line 202 "a2p.y" -{ yyval = oper3(OGETLINE,yypvt[-0],string("|",1),yypvt[-3]); - if (ops[yypvt[-3]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } break; -case 59: -# line 205 "a2p.y" -{ yyval = oper0(yypvt[-0]); need_entire = do_chop = TRUE; } break; -case 60: -# line 207 "a2p.y" -{ yyval = oper1(yypvt[-2],Nullop); need_entire = do_chop = TRUE; } break; -case 61: -# line 209 "a2p.y" -{ yyval = oper1(yypvt[-3],yypvt[-1]); } break; -case 62: -# line 211 "a2p.y" -{ yyval = oper1(yypvt[-3],yypvt[-1]); } break; -case 63: -# line 213 "a2p.y" -{ yyval = oper2(OUSERFUN,yypvt[-3],yypvt[-1]); } break; -case 64: -# line 215 "a2p.y" -{ yyval = oper1(OSPRINTF,yypvt[-0]); } break; -case 65: -# line 217 "a2p.y" -{ yyval = oper3(OSUBSTR,yypvt[-5],yypvt[-3],yypvt[-1]); } break; -case 66: -# line 219 "a2p.y" -{ yyval = oper2(OSUBSTR,yypvt[-3],yypvt[-1]); } break; -case 67: -# line 221 "a2p.y" -{ yyval = oper3(OSPLIT,yypvt[-5],aryrefarg(numary(yypvt[-3])),yypvt[-1]); } break; -case 68: -# line 223 "a2p.y" -{ yyval = oper3(OSPLIT,yypvt[-5],aryrefarg(numary(yypvt[-3])),oper1(OREGEX,yypvt[-1]));} break; -case 69: -# line 225 "a2p.y" -{ yyval = oper2(OSPLIT,yypvt[-3],aryrefarg(numary(yypvt[-1]))); } break; -case 70: -# line 227 "a2p.y" -{ yyval = oper2(OINDEX,yypvt[-3],yypvt[-1]); } break; -case 71: -# line 229 "a2p.y" -{ yyval = oper2(OMATCH,yypvt[-3],oper1(OREGEX,yypvt[-1])); } break; -case 72: -# line 231 "a2p.y" -{ yyval = oper2(OMATCH,yypvt[-3],yypvt[-1]); } break; -case 73: -# line 233 "a2p.y" -{ yyval = oper2(OSUB,yypvt[-3],yypvt[-1]); } break; -case 74: -# line 235 "a2p.y" -{ yyval = oper2(OSUB,oper1(OREGEX,yypvt[-3]),yypvt[-1]); } break; -case 75: -# line 237 "a2p.y" -{ yyval = oper2(OGSUB,yypvt[-3],yypvt[-1]); } break; -case 76: -# line 239 "a2p.y" -{ yyval = oper2(OGSUB,oper1(OREGEX,yypvt[-3]),yypvt[-1]); } break; -case 77: -# line 241 "a2p.y" -{ yyval = oper3(OSUB,yypvt[-5],yypvt[-3],yypvt[-1]); } break; -case 78: -# line 243 "a2p.y" -{ yyval = oper3(OSUB,oper1(OREGEX,yypvt[-5]),yypvt[-3],yypvt[-1]); } break; -case 79: -# line 245 "a2p.y" -{ yyval = oper3(OGSUB,yypvt[-5],yypvt[-3],yypvt[-1]); } break; -case 80: -# line 247 "a2p.y" -{ yyval = oper3(OGSUB,oper1(OREGEX,yypvt[-5]),yypvt[-3],yypvt[-1]); } break; -case 81: -# line 251 "a2p.y" -{ yyval = oper1(OVAR,yypvt[-0]); } break; -case 82: -# line 253 "a2p.y" -{ yyval = oper2(OVAR,aryrefarg(yypvt[-3]),yypvt[-1]); } break; -case 83: -# line 255 "a2p.y" -{ yyval = oper1(OFLD,yypvt[-0]); } break; -case 84: -# line 257 "a2p.y" -{ yyval = oper1(OVFLD,yypvt[-0]); } break; -case 87: -# line 264 "a2p.y" -{ yyval = Nullop; } break; -case 88: -# line 268 "a2p.y" -{ yyval = oper3(OCOMMA,yypvt[-3],yypvt[-1],yypvt[-0]); } break; -case 89: -# line 270 "a2p.y" -{ yyval = oper3(OCOMMA,yypvt[-3],yypvt[-1],yypvt[-0]); } break; -case 90: -# line 272 "a2p.y" -{ yyval = yypvt[-1]; } break; -case 91: -# line 276 "a2p.y" -{ yyval = oper2(OJUNK,yypvt[-1],yypvt[-0]); } break; -case 92: -# line 278 "a2p.y" -{ yyval = Nullop; } break; -case 93: -# line 282 "a2p.y" -{ yyval = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); } break; -case 94: -# line 284 "a2p.y" -{ yyval = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); } break; -case 95: -# line 286 "a2p.y" -{ yyval = oper0(ONEWLINE); } break; -case 96: -# line 288 "a2p.y" -{ yyval = oper1(OCOMMENT,yypvt[-0]); } break; -case 97: -# line 292 "a2p.y" -{ yyval = oper2(OJUNK,yypvt[-1],yypvt[-0]); } break; -case 98: -# line 294 "a2p.y" -{ yyval = Nullop; } break; -case 99: -# line 298 "a2p.y" -{ yyval = oper0(ONEWLINE); } break; -case 100: -# line 300 "a2p.y" -{ yyval = oper1(OCOMMENT,yypvt[-0]); } break; -case 101: -# line 305 "a2p.y" -{ yyval = oper2(OJUNK,oper0(OSEMICOLON),yypvt[-0]); } break; -case 102: -# line 307 "a2p.y" -{ yyval = oper2(OJUNK,oper0(OSNEWLINE),yypvt[-0]); } break; -case 103: -# line 309 "a2p.y" -{ yyval = oper2(OJUNK,oper0(OSNEWLINE),yypvt[-0]); } break; -case 104: -# line 311 "a2p.y" -{ yyval = oper2(OJUNK,oper1(OSCOMMENT,yypvt[-1]),yypvt[-0]); } break; -case 105: -# line 315 "a2p.y" -{ yyval = oper2(OSTATES,yypvt[-1],yypvt[-0]); } break; -case 106: -# line 317 "a2p.y" -{ yyval = Nullop; } break; -case 107: -# line 322 "a2p.y" -{ yyval = oper2(OJUNK,oper2(OSTATE,yypvt[-2],yypvt[-1]),yypvt[-0]); } break; -case 108: -# line 324 "a2p.y" -{ yyval = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSEMICOLON),yypvt[-0])); } break; -case 109: -# line 326 "a2p.y" -{ yyval = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSNEWLINE),yypvt[-0])); } break; -case 112: -# line 332 "a2p.y" -{ yyval = Nullop; } break; -case 114: -# line 338 "a2p.y" -{ yyval = oper3(OPRINT,yypvt[-2],yypvt[-1],yypvt[-0]); - do_opens = TRUE; - saw_ORS = saw_OFS = TRUE; - if (!yypvt[-2]) need_entire = TRUE; - if (ops[yypvt[-0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } break; -case 115: -# line 344 "a2p.y" -{ yyval = oper1(OPRINT,yypvt[-0]); - if (!yypvt[-0]) need_entire = TRUE; - saw_ORS = saw_OFS = TRUE; - } break; -case 116: -# line 349 "a2p.y" -{ yyval = oper3(OPRINTF,yypvt[-2],yypvt[-1],yypvt[-0]); - do_opens = TRUE; - if (!yypvt[-2]) need_entire = TRUE; - if (ops[yypvt[-0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; } break; -case 117: -# line 354 "a2p.y" -{ yyval = oper1(OPRINTF,yypvt[-0]); - if (!yypvt[-0]) need_entire = TRUE; - } break; -case 118: -# line 358 "a2p.y" -{ yyval = oper0(OBREAK); } break; -case 119: -# line 360 "a2p.y" -{ yyval = oper0(ONEXT); } break; -case 120: -# line 362 "a2p.y" -{ yyval = oper0(OEXIT); } break; -case 121: -# line 364 "a2p.y" -{ yyval = oper1(OEXIT,yypvt[-0]); } break; -case 122: -# line 366 "a2p.y" -{ yyval = oper0(OCONTINUE); } break; -case 123: -# line 368 "a2p.y" -{ yyval = oper0(ORETURN); } break; -case 124: -# line 370 "a2p.y" -{ yyval = oper1(ORETURN,yypvt[-0]); } break; -case 125: -# line 372 "a2p.y" -{ yyval = oper2(ODELETE,aryrefarg(yypvt[-3]),yypvt[-1]); } break; -case 126: -# line 376 "a2p.y" -{ yyval = oper1(OREDIR,string(">",1)); } break; -case 127: -# line 378 "a2p.y" -{ yyval = oper1(OREDIR,string(">>",2)); } break; -case 128: -# line 380 "a2p.y" -{ yyval = oper1(OREDIR,string("|",1)); } break; -case 129: -# line 385 "a2p.y" -{ yyval = oper2(OIF,yypvt[-3],bl(yypvt[-0],yypvt[-1])); } break; -case 130: -# line 387 "a2p.y" -{ yyval = oper3(OIF,yypvt[-6],bl(yypvt[-3],yypvt[-4]),bl(yypvt[-0],yypvt[-1])); } break; -case 131: -# line 389 "a2p.y" -{ yyval = oper2(OWHILE,yypvt[-3],bl(yypvt[-0],yypvt[-1])); } break; -case 132: -# line 391 "a2p.y" -{ yyval = oper2(ODO,bl(yypvt[-4],yypvt[-5]),yypvt[-1]); } break; -case 133: -# line 393 "a2p.y" -{ yyval = oper4(OFOR,yypvt[-7],yypvt[-5],yypvt[-3],bl(yypvt[-0],yypvt[-1])); } break; -case 134: -# line 395 "a2p.y" -{ yyval = oper4(OFOR,yypvt[-6],string("",0),yypvt[-3],bl(yypvt[-0],yypvt[-1])); } break; -case 135: -# line 397 "a2p.y" -{ yyval = oper2(OFORIN,yypvt[-3],bl(yypvt[-0],yypvt[-1])); } break; -case 136: -# line 399 "a2p.y" -{ yyval = oper3(OBLOCK,oper2(OJUNK,yypvt[-3],yypvt[-2]),Nullop,yypvt[-0]); } break; - } - goto yystack; /* reset registers in driver code */ -} @@ -6,17 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: a2p.h,v $ - * Revision 4.1 92/08/07 18:29:09 lwall - * - * Revision 4.0.1.2 92/06/08 16:12:23 lwall - * patch20: hash tables now split only if the memory is available to do so - * - * Revision 4.0.1.1 91/06/07 12:12:27 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:57:07 lwall - * 4.0 baseline. - * */ #define VOIDUSED 1 @@ -229,7 +218,7 @@ union u_ops { #else #define OPSMAX 50000 #endif /* 80286 hack */ -union u_ops ops[OPSMAX]; +EXT union u_ops ops[OPSMAX]; #include <stdio.h> #include <ctype.h> @@ -309,7 +298,7 @@ EXT char fswitch INIT(0); EXT int saw_FS INIT(0); EXT int maxfld INIT(0); EXT int arymax INIT(0); -char *nameary[100]; +EXT char *nameary[100]; EXT STR *opens; diff --git a/x2p/a2p.man b/x2p/a2p.man index 4f4168b269..f74e596ed2 100644 --- a/x2p/a2p.man +++ b/x2p/a2p.man @@ -2,21 +2,6 @@ ''' $RCSfile: a2p.man,v $$Revision: 4.1 $$Date: 92/08/07 18:29:10 $ ''' ''' $Log: a2p.man,v $ -''' Revision 4.1 92/08/07 18:29:10 lwall -''' -''' Revision 4.0 91/03/20 01:57:11 lwall -''' 4.0 baseline. -''' -''' Revision 3.0 89/10/18 15:34:22 lwall -''' 3.0 baseline -''' -''' Revision 2.0.1.1 88/07/11 23:16:25 root -''' patch2: changes related to 1985 awk -''' -''' Revision 2.0 88/06/05 00:15:36 root -''' Baseline version 2.0. -''' -''' .de Sh .br .ne 5 @@ -7,17 +7,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: a2p.y,v $ - * Revision 4.1 92/08/07 18:29:12 lwall - * - * Revision 4.0.1.2 92/06/08 16:13:03 lwall - * patch20: in a2p, getline should allow variable to be array element - * - * Revision 4.0.1.1 91/06/07 12:12:41 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:57:21 lwall - * 4.0 baseline. - * */ #include "INTERN.h" diff --git a/x2p/a2py.c b/x2p/a2py.c index a092c8ab63..59c22414a5 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -6,26 +6,13 @@ * License or the Artistic License, as specified in the README file. * * $Log: a2py.c,v $ - * Revision 4.1 92/08/07 18:29:14 lwall - * - * Revision 4.0.1.2 92/06/08 16:15:16 lwall - * patch20: in a2p, now warns about spurious backslashes - * patch20: in a2p, now allows [ to be backslashed in pattern - * patch20: in a2p, now allows numbers of the form 2. - * - * Revision 4.0.1.1 91/06/07 12:12:59 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:57:26 lwall - * 4.0 baseline. - * */ #ifdef OS2 #include "../patchlevel.h" #endif #include "util.h" -char *index(); +char *strchr(); char *filename; char *myname; @@ -36,7 +23,7 @@ STR *walk(); #ifdef OS2 usage() { - printf("\nThis is the AWK to PERL translator, version 4.0, patchlevel %d\n", PATCHLEVEL); + 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" @@ -170,7 +157,7 @@ register char **env; # 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_]+=)(.*)/ && shift;\n"); + "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) { @@ -211,7 +198,7 @@ yylex() retry: #ifdef YYDEBUG if (yydebug) - if (index(s,'\n')) + if (strchr(s,'\n')) fprintf(stderr,"Tokener at %s",s); else fprintf(stderr,"Tokener at %s\n",s); @@ -871,7 +858,7 @@ register char *s; else s++; } - if (index("eE",*s) && index("+-0123456789",s[1])) { + if (strchr("eE",*s) && strchr("+-0123456789",s[1])) { *d++ = *s++; if (*s == '+' || *s == '-') *d++ = *s++; diff --git a/x2p/all b/x2p/all deleted file mode 100644 index e69de29bb2..0000000000 --- a/x2p/all +++ /dev/null diff --git a/x2p/cflags b/x2p/cflags deleted file mode 100755 index ba795b376a..0000000000 --- a/x2p/cflags +++ /dev/null @@ -1,55 +0,0 @@ -case "$0" in -*/*) cd `expr X$0 : 'X\(.*\)/'` ;; -esac -case $CONFIG in -'') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - fi 2>/dev/null - . ./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 's/\.[oc] / /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 - - echo "$cc -c $ccflags $optimize $large $split" - eval "$also "'"$cc -c $ccflags $optimize $large $split"' - - . ./config.sh - -done diff --git a/x2p/cflags.SH b/x2p/cflags.SH index db857c0492..e20c3a478b 100755 --- a/x2p/cflags.SH +++ b/x2p/cflags.SH @@ -1,43 +1,43 @@ case $CONFIG in '') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - fi - . config.sh - ;; + 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 cflags (with variable substitutions)" +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. -rm -f cflags $spitshell >cflags <<!GROK!THIS! !GROK!THIS! : In the following dollars and backticks do not need the extra backslash. $spitshell >>cflags <<'!NO!SUBS!' -case "$0" in -*/*) cd `expr X$0 : 'X\(.*\)/'` ;; -esac case $CONFIG in '') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - fi 2>/dev/null - . ./config.sh - ;; + 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=': ' @@ -74,12 +74,14 @@ for file do *) ;; esac + ccflags="`echo $ccflags | sed -e 's/-DEMBED//'`" + echo "$cc -c $ccflags $optimize $large $split" eval "$also "'"$cc -c $ccflags $optimize $large $split"' - . ./config.sh + . $TOP/config.sh done !NO!SUBS! -chmod +x cflags +chmod 755 cflags $eunicefix cflags diff --git a/x2p/config.sh b/x2p/config.sh deleted file mode 120000 index 3131e78bcf..0000000000 --- a/x2p/config.sh +++ /dev/null @@ -1 +0,0 @@ -../config.sh
\ No newline at end of file diff --git a/x2p/find2perl b/x2p/find2perl deleted file mode 100755 index 7bbeccd55d..0000000000 --- a/x2p/find2perl +++ /dev/null @@ -1,572 +0,0 @@ -#!/usr/local/bin/perl -# -# Modified September 26, 1993 to provide proper handling of years after 1999 -# Tom Link <tml+@pitt.edu> -# University of Pittsburgh - -eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' - if $running_under_some_shell; - -$bin = "/usr/local/bin"; - - -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)),1)'; - } - 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"; -#!$bin/perl - -eval 'exec $bin/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'"; -} diff --git a/x2p/find2perl.SH b/x2p/find2perl.SH index 8670173db6..8ab7f9c394 100755 --- a/x2p/find2perl.SH +++ b/x2p/find2perl.SH @@ -1,20 +1,22 @@ case $CONFIG in '') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - fi - . ./config.sh - ;; + 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 find2perl (with variable substitutions)" +echo "Extracting x2p/find2perl (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 @@ -169,7 +171,7 @@ while (@ARGV) { $out .= &tab . '($prune = 1)'; } elsif ($_ eq 'xdev') { - $out .= &tab . '(($prune |= ($dev != $topdev)),1)'; + $out .= &tab . '!($prune |= ($dev != $topdev))'; } elsif ($_ eq 'newer') { $out .= &tab; diff --git a/x2p/handy.h b/x2p/handy.h index ee31a1c577..8995b2448b 100644 --- a/x2p/handy.h +++ b/x2p/handy.h @@ -6,17 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: handy.h,v $ - * Revision 4.1 92/08/07 18:29:19 lwall - * - * Revision 4.0.1.2 91/06/07 12:15:43 lwall - * patch4: new copyright notice - * - * Revision 4.0.1.1 91/04/12 09:29:08 lwall - * patch1: random cleanup in cpp namespace - * - * Revision 4.0 91/03/20 01:57:45 lwall - * 4.0 baseline. - * */ #define Null(type) ((type)0) diff --git a/x2p/hash.c b/x2p/hash.c index 96b854f770..b910af603e 100644 --- a/x2p/hash.c +++ b/x2p/hash.c @@ -6,14 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: hash.c,v $ - * Revision 4.1 92/08/07 18:29:20 lwall - * - * Revision 4.0.1.1 91/06/07 12:15:55 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:57:49 lwall - * 4.0 baseline. - * */ #include <stdio.h> diff --git a/x2p/hash.h b/x2p/hash.h index a977ae5cfc..5685e53259 100644 --- a/x2p/hash.h +++ b/x2p/hash.h @@ -6,14 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: hash.h,v $ - * Revision 4.1 92/08/07 18:29:21 lwall - * - * Revision 4.0.1.1 91/06/07 12:16:04 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:57:53 lwall - * 4.0 baseline. - * */ #define FILLPCT 60 /* don't make greater than 99 */ diff --git a/x2p/make.out b/x2p/make.out deleted file mode 100644 index bd2565451f..0000000000 --- a/x2p/make.out +++ /dev/null @@ -1,13 +0,0 @@ -../makedepend -make: Warning: Both `makefile' and `Makefile' exists -Current working directory /usr/src/local/lwall/perl5/x2p -echo hash.c malloc.c str.c util.c walk.c | tr ' ' '\012' >.clist -Finding dependencies for hash.o. -Finding dependencies for malloc.o. -Finding dependencies for str.o. -Finding dependencies for util.o. -Finding dependencies for walk.o. -make: Warning: Both `makefile' and `Makefile' exists -Current working directory /usr/src/local/lwall/perl5/x2p -echo Makefile.SH makedepend.SH | tr ' ' '\012' >.shlist -Updating makefile... diff --git a/x2p/makefile b/x2p/makefile deleted file mode 100644 index fc29d5de95..0000000000 --- a/x2p/makefile +++ /dev/null @@ -1,226 +0,0 @@ -# $RCSfile: Makefile.SH,v 3314Revision: 4.1 3314Date: 92/08/07 18:29:07 $ -# -# $Log: Makefile.SH,v $ -# Revision 4.1 92/08/07 18:29:07 lwall -# -# Revision 4.0.1.3 92/06/08 16:11:32 lwall -# patch20: SH files didn't work well with symbolic links -# patch20: cray didn't give enough memory to /bin/sh -# patch20: makefiles now display new shift/reduce expectations -# -# Revision 4.0.1.2 91/11/05 19:19:04 lwall -# patch11: random cleanup -# -# Revision 4.0.1.1 91/06/07 12:12:14 lwall -# patch4: cflags now emits entire cc command except for the filename -# -# Revision 4.0 91/03/20 01:57:03 lwall -# 4.0 baseline. -# -# - -CC = cc -YACC = yacc -bin = /usr/local/bin -lib = /usr/local/lib -mansrc = /usr/local/man/man1 -manext = 1 -LDFLAGS = -SMALL = -LARGE = -mallocsrc = malloc.c -mallocobj = malloc.o -shellflags = - -libs = -ldbm -ldl -lm -lposix - -CCCMD = `sh $(shellflags) cflags $@` - -public = a2p s2p find2perl - -private = - -manpages = a2p.man s2p.man - -util = - -sh = Makefile.SH makedepend.SH - -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.o $(mallocobj) str.o util.o walk.o - -lintflags = -phbvxac - -addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7 - -# grrr -SHELL = /bin/sh - -.c.o: - $(CCCMD) $*.c - -all: $(public) $(private) $(util) - touch all - -a2p: $(obj) a2p.o - $(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p - -a2p.c: a2p.y - @ echo Expect 231 shift/reduce conflicts... - $(YACC) a2p.y - mv y.tab.c a2p.c - -a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h - $(CCCMD) $(LARGE) a2p.c - -install: a2p s2p -# won't work with csh - export PATH || exit 1 - - mv $(bin)/a2p $(bin)/a2p.old 2>/dev/null - - mv $(bin)/s2p $(bin)/s2p.old 2>/dev/null - - if test `pwd` != $(bin); then cp $(public) $(bin); fi - cd $(bin); \ -for pub in $(public); do \ -chmod +x `basename $$pub`; \ -done - - if test `pwd` != $(mansrc); then \ -for page in $(manpages); do \ -cp $$page $(mansrc)/`basename $$page .man`.$(manext); \ -done; \ -fi - -clean: - rm -f a2p *.o a2p.c - -realclean: clean - rm -f *.orig */*.orig core $(addedbyconf) a2p.c s2p find2perl all cflags - -# 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 - ../makedepend - -clist: - echo $(c) | tr ' ' '\012' >.clist - -hlist: - echo $(h) | tr ' ' '\012' >.hlist - -shlist: - echo $(sh) | tr ' ' '\012' >.shlist - -config.sh: ../config.sh - rm -f config.sh - ln ../config.sh . - -malloc.c: ../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 -# If this runs make out of memory, delete /usr/include lines. -hash.o: ../config.h -hash.o: /usr/include/ctype.h -hash.o: /usr/include/stdio.h -hash.o: EXTERN.h -hash.o: a2p.h -hash.o: handy.h -hash.o: hash.c -hash.o: hash.h -hash.o: str.h -hash.o: util.h -malloc.o: ../av.h -malloc.o: ../config.h -malloc.o: ../cop.h -malloc.o: ../cv.h -malloc.o: ../embed.h -malloc.o: ../form.h -malloc.o: ../gv.h -malloc.o: ../handy.h -malloc.o: ../hv.h -malloc.o: ../mg.h -malloc.o: ../op.h -malloc.o: ../opcode.h -malloc.o: ../perl.h -malloc.o: ../pp.h -malloc.o: ../proto.h -malloc.o: ../regexp.h -malloc.o: ../scope.h -malloc.o: ../sv.h -malloc.o: ../unixish.h -malloc.o: ../util.h -malloc.o: /usr/include/ctype.h -malloc.o: /usr/include/dirent.h -malloc.o: /usr/include/errno.h -malloc.o: /usr/include/machine/param.h -malloc.o: /usr/include/machine/setjmp.h -malloc.o: /usr/include/netinet/in.h -malloc.o: /usr/include/setjmp.h -malloc.o: /usr/include/stdio.h -malloc.o: /usr/include/sys/dirent.h -malloc.o: /usr/include/sys/errno.h -malloc.o: /usr/include/sys/filio.h -malloc.o: /usr/include/sys/ioccom.h -malloc.o: /usr/include/sys/ioctl.h -malloc.o: /usr/include/sys/param.h -malloc.o: /usr/include/sys/signal.h -malloc.o: /usr/include/sys/sockio.h -malloc.o: /usr/include/sys/stat.h -malloc.o: /usr/include/sys/stdtypes.h -malloc.o: /usr/include/sys/sysmacros.h -malloc.o: /usr/include/sys/time.h -malloc.o: /usr/include/sys/times.h -malloc.o: /usr/include/sys/ttold.h -malloc.o: /usr/include/sys/ttychars.h -malloc.o: /usr/include/sys/ttycom.h -malloc.o: /usr/include/sys/ttydev.h -malloc.o: /usr/include/sys/types.h -malloc.o: /usr/include/time.h -malloc.o: /usr/include/varargs.h -malloc.o: /usr/include/vm/faultcode.h -malloc.o: EXTERN.h -malloc.o: malloc.c -str.o: ../config.h -str.o: /usr/include/ctype.h -str.o: /usr/include/stdio.h -str.o: EXTERN.h -str.o: a2p.h -str.o: handy.h -str.o: hash.h -str.o: str.c -str.o: str.h -str.o: util.h -util.o: ../config.h -util.o: /usr/include/ctype.h -util.o: /usr/include/stdio.h -util.o: EXTERN.h -util.o: INTERN.h -util.o: a2p.h -util.o: handy.h -util.o: hash.h -util.o: str.h -util.o: util.c -util.o: util.h -walk.o: ../config.h -walk.o: /usr/include/ctype.h -walk.o: /usr/include/stdio.h -walk.o: EXTERN.h -walk.o: a2p.h -walk.o: handy.h -walk.o: hash.h -walk.o: str.h -walk.o: util.h -walk.o: walk.c -Makefile: Makefile.SH config.sh ; /bin/sh Makefile.SH -makedepend: makedepend.SH config.sh ; /bin/sh makedepend.SH -# WARNING: Put nothing here or make depend will gobble it up! diff --git a/x2p/malloc.c b/x2p/malloc.c index 396d31cef2..87c5068e99 100644 --- a/x2p/malloc.c +++ b/x2p/malloc.c @@ -1,31 +1,9 @@ /* $RCSfile: malloc.c,v $$Revision: 4.1 $$Date: 92/08/07 18:24:25 $ * * $Log: malloc.c,v $ - * Revision 4.1 92/08/07 18:24:25 lwall - * - * Revision 4.0.1.4 92/06/08 14:28:38 lwall - * patch20: removed implicit int declarations on functions - * patch20: hash tables now split only if the memory is available to do so - * patch20: realloc(0, size) now does malloc in case library routines call it - * - * Revision 4.0.1.3 91/11/05 17:57:40 lwall - * patch11: safe malloc code now integrated into Perl's malloc when possible - * - * Revision 4.0.1.2 91/06/07 11:20:45 lwall - * patch4: many, many itty-bitty portability fixes - * - * Revision 4.0.1.1 91/04/11 17:48:31 lwall - * patch1: Configure now figures out malloc ptr type - * - * Revision 4.0 91/03/20 01:28:52 lwall - * 4.0 baseline. - * */ #ifndef lint -/*SUPPRESS 592*/ -static char sccsid[] = "@(#)malloc.c 4.3 (Berkeley) 9/16/83"; - #ifdef DEBUGGING #define RCHECK #endif @@ -44,9 +22,6 @@ static char sccsid[] = "@(#)malloc.c 4.3 (Berkeley) 9/16/83"; #include "EXTERN.h" #include "../perl.h" -static int findbucket(); -static int morecore(); - /* I don't much care whether these are defined in sys/types.h--LAW */ #define u_char unsigned char @@ -81,6 +56,12 @@ union overhead { #define ov_rmagic ovu.ovu_rmagic }; +#ifdef debug +static void botch _((char *s)); +#endif +static void morecore _((int bucket)); +static int findbucket _((union overhead *freep, int srchlen)); + #define MAGIC 0xff /* magic # on accounting info */ #define RMAGIC 0x55555555 /* magic # on range info */ #ifdef RCHECK @@ -176,21 +157,15 @@ malloc(nbytes) } #ifdef safemalloc -#if !(defined(I286) || defined(atarist)) - DEBUG_m(fprintf(stderr,"0x%x: (%05d) malloc %ld bytes\n",p+1,an++,(long)size)); -#else - DEBUG_m(fprintf(stderr,"0x%lx: (%05d) malloc %ld bytes\n",p+1,an++,(long)size)); -#endif + DEBUG_m(fprintf(stderr,"0x%lx: (%05d) malloc %ld bytes\n", + (unsigned long)(p+1),an++,(long)size)); #endif /* safemalloc */ /* remove from linked list */ #ifdef RCHECK if (*((int*)p) & (sizeof(union overhead) - 1)) -#if !(defined(I286) || defined(atarist)) - fprintf(stderr,"Corrupt malloc ptr 0x%x at 0x%x\n",*((int*)p),p); -#else - fprintf(stderr,"Corrupt malloc ptr 0x%lx at 0x%lx\n",*((int*)p),p); -#endif + fprintf(stderr,"Corrupt malloc ptr 0x%lx at 0x%lx\n", + (unsigned long)*((int*)p),(unsigned long)p); #endif nextf[bucket] = p->ov_next; p->ov_magic = MAGIC; @@ -214,7 +189,7 @@ malloc(nbytes) /* * Allocate more memory to the indicated bucket. */ -static +static void morecore(bucket) register int bucket; { @@ -288,11 +263,7 @@ free(mp) char *cp = (char*)mp; #ifdef safemalloc -#if !(defined(I286) || defined(atarist)) - DEBUG_m(fprintf(stderr,"0x%x: (%05d) free\n",cp,an++)); -#else - DEBUG_m(fprintf(stderr,"0x%lx: (%05d) free\n",cp,an++)); -#endif + DEBUG_m(fprintf(stderr,"0x%lx: (%05d) free\n",(unsigned long)cp,an++)); #endif /* safemalloc */ if (cp == NULL) @@ -425,17 +396,11 @@ realloc(mp, nbytes) #ifdef safemalloc #ifdef DEBUGGING -# if !(defined(I286) || defined(atarist)) - if (debug & 128) { - fprintf(stderr,"0x%x: (%05d) rfree\n",res,an++); - fprintf(stderr,"0x%x: (%05d) realloc %ld bytes\n",res,an++,(long)size); - } -# else - if (debug & 128) { - fprintf(stderr,"0x%lx: (%05d) rfree\n",res,an++); - fprintf(stderr,"0x%lx: (%05d) realloc %ld bytes\n",res,an++,(long)size); - } -# endif + if (debug & 128) { + fprintf(stderr,"0x%lx: (%05d) rfree\n",(unsigned long)res,an++); + fprintf(stderr,"0x%lx: (%05d) realloc %ld bytes\n", + (unsigned long)res,an++,(long)size); + } #endif #endif /* safemalloc */ return ((Malloc_t)res); diff --git a/x2p/s2p b/x2p/s2p deleted file mode 100755 index fa6e01791d..0000000000 --- a/x2p/s2p +++ /dev/null @@ -1,760 +0,0 @@ -#!/usr/local/bin/perl - -eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' - if $running_under_some_shell; - -$bin = '/usr/local/bin'; - -# $RCSfile: s2p.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:23 $ -# -# $Log: s2p.SH,v $ -# Revision 4.1 92/08/07 18:29:23 lwall -# -# Revision 4.0.1.2 92/06/08 17:26:31 lwall -# patch20: s2p didn't output portable startup code -# patch20: added ... as variant on .. -# patch20: s2p didn't translate s/pat/\&/ or s/pat/\$/ or s/pat/\\1/ right -# -# Revision 4.0.1.1 91/06/07 12:19:18 lwall -# patch4: s2p now handles embedded newlines better and optimizes common idioms -# -# Revision 4.0 91/03/20 01:57:59 lwall -# 4.0 baseline. -# -# - -$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"); -: #!$bin/perl -: eval 'exec $bin/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; -} - diff --git a/x2p/s2p.SH b/x2p/s2p.SH index 1f892aeb60..5819fd9a21 100755 --- a/x2p/s2p.SH +++ b/x2p/s2p.SH @@ -1,21 +1,23 @@ +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 -case $CONFIG in -'') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln -s ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - fi 2>/dev/null - . ./config.sh - ;; -esac -echo "Extracting s2p (with variable substitutions)" + +echo "Extracting x2p/s2p (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 @@ -36,20 +38,6 @@ $spitshell >>s2p <<'!NO!SUBS!' # $RCSfile: s2p.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:23 $ # # $Log: s2p.SH,v $ -# Revision 4.1 92/08/07 18:29:23 lwall -# -# Revision 4.0.1.2 92/06/08 17:26:31 lwall -# patch20: s2p didn't output portable startup code -# patch20: added ... as variant on .. -# patch20: s2p didn't translate s/pat/\&/ or s/pat/\$/ or s/pat/\\1/ right -# -# Revision 4.0.1.1 91/06/07 12:19:18 lwall -# patch4: s2p now handles embedded newlines better and optimizes common idioms -# -# Revision 4.0 91/03/20 01:57:59 lwall -# 4.0 baseline. -# -# $indent = 4; $shiftwidth = 4; diff --git a/x2p/s2p.man b/x2p/s2p.man index 1374dff928..ae4611613f 100644 --- a/x2p/s2p.man +++ b/x2p/s2p.man @@ -2,21 +2,6 @@ ''' $RCSfile: s2p.man,v $$Revision: 4.1 $$Date: 92/08/07 18:29:24 $ ''' ''' $Log: s2p.man,v $ -''' Revision 4.1 92/08/07 18:29:24 lwall -''' -''' Revision 4.0.1.1 91/06/07 12:19:57 lwall -''' patch4: s2p now handles embedded newlines better and optimizes common idioms -''' -''' Revision 4.0 91/03/20 01:58:07 lwall -''' 4.0 baseline. -''' -''' Revision 3.0 89/10/18 15:35:09 lwall -''' 3.0 baseline -''' -''' Revision 2.0 88/06/05 00:15:59 root -''' Baseline version 2.0. -''' -''' .de Sh .br .ne 5 @@ -6,14 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: str.c,v $ - * Revision 4.1 92/08/07 18:29:26 lwall - * - * Revision 4.0.1.1 91/06/07 12:20:08 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:58:15 lwall - * 4.0 baseline. - * */ #include "handy.h" @@ -195,7 +187,7 @@ char *keeplist; else *to++ = *from++; } - else if (index(keeplist,from[1])) + else if (strchr(keeplist,from[1])) *to++ = *from++; else from++; @@ -6,14 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: str.h,v $ - * Revision 4.1 92/08/07 18:29:27 lwall - * - * Revision 4.0.1.1 91/06/07 12:20:22 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:58:21 lwall - * 4.0 baseline. - * */ struct string { diff --git a/x2p/util.c b/x2p/util.c index 5fd96f831c..79cba699df 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -6,14 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: util.c,v $ - * Revision 4.1 92/08/07 18:29:29 lwall - * - * Revision 4.0.1.1 91/06/07 12:20:35 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:58:25 lwall - * 4.0 baseline. - * */ #include <stdio.h> @@ -31,7 +23,6 @@ static char nomem[] = "Out of memory!\n"; /* paranoid version of malloc */ -static int an = 0; char * safemalloc(size) @@ -201,6 +192,14 @@ int newlen; } /*VARARGS1*/ +croak(pat,a1,a2,a3,a4) +char *pat; +{ + fprintf(stderr,pat,a1,a2,a3,a4); + exit(1); +} + +/*VARARGS1*/ fatal(pat,a1,a2,a3,a4) char *pat; { diff --git a/x2p/util.h b/x2p/util.h index b088e4a98a..eeb128ba2c 100644 --- a/x2p/util.h +++ b/x2p/util.h @@ -6,17 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: util.h,v $ - * Revision 4.1 92/08/07 18:29:30 lwall - * - * Revision 4.0.1.2 91/11/05 19:21:20 lwall - * patch11: various portability fixes - * - * Revision 4.0.1.1 91/06/07 12:20:43 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:58:29 lwall - * 4.0 baseline. - * */ /* is the string for makedir a directory name or a filename? */ diff --git a/x2p/walk.c b/x2p/walk.c index 55ba719b23..26e89ae5bd 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -6,24 +6,6 @@ * License or the Artistic License, as specified in the README file. * * $Log: walk.c,v $ - * Revision 4.1 92/08/07 18:29:31 lwall - * - * Revision 4.0.1.3 92/06/08 17:33:46 lwall - * patch20: in a2p, simplified the filehandle model - * patch20: in a2p, made RS="" translate to $/ = "\n\n" - * patch20: in a2p, do {...} while ... was missing some reconstruction code - * patch20: in a2p, getline should allow variable to be array element - * - * Revision 4.0.1.2 91/11/05 19:25:09 lwall - * patch11: in a2p, split on whitespace produced extra null field - * - * Revision 4.0.1.1 91/06/07 12:22:04 lwall - * patch4: new copyright notice - * patch4: a2p didn't correctly implement -n switch - * - * Revision 4.0 91/03/20 01:58:36 lwall - * 4.0 baseline. - * */ #include "handy.h" @@ -66,7 +48,7 @@ int minprec; /* minimum precedence without parens */ int numeric = FALSE; STR *fstr; int prec = P_MAX; /* assume no parens needed */ - char *index(); + char *strchr(); if (!node) { *numericptr = 0; @@ -109,7 +91,7 @@ int minprec; /* minimum precedence without parens */ do_chop = TRUE; if (fswitch) { str_cat(str,"$FS = '"); - if (index("*+?.[]()|^$\\",fswitch)) + if (strchr("*+?.[]()|^$\\",fswitch)) str_cat(str,"\\"); sprintf(tokenbuf,"%c",fswitch); str_cat(str,tokenbuf); @@ -397,8 +379,8 @@ sub Pick {\n\ str_set(tmpstr,"gt"); else if (strEQ(t,">=")) str_set(tmpstr,"ge"); - if (!index(tmpstr->str_ptr,'\'') && !index(tmpstr->str_ptr,'"') && - !index(tmp2str->str_ptr,'\'') && !index(tmp2str->str_ptr,'"') ) + if (!strchr(tmpstr->str_ptr,'\'') && !strchr(tmpstr->str_ptr,'"') && + !strchr(tmp2str->str_ptr,'\'') && !strchr(tmp2str->str_ptr,'"') ) numeric |= 2; } if (numeric & 2) { @@ -604,7 +586,7 @@ sub Pick {\n\ if (!isalpha(*t) && !isdigit(*t)) *t = '_'; } - if (!index(tokenbuf,'_')) + if (!strchr(tokenbuf,'_')) strcpy(t,"_FH"); tmp3str = hfetch(symtab,tokenbuf); if (!tmp3str) { @@ -693,7 +675,7 @@ sub Pick {\n\ 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 (index("*+?.[]()|^$\\",i)) + if (strchr("*+?.[]()|^$\\",i)) sprintf(tokenbuf,"/\\%c/",i); else if (i == ' ') sprintf(tokenbuf,"' '"); @@ -1135,7 +1117,7 @@ sub Pick {\n\ if (!isalpha(*t) && !isdigit(*t)) *t = '_'; } - if (!index(tokenbuf,'_')) + if (!strchr(tokenbuf,'_')) strcpy(t,"_FH"); str_free(tmpstr); safefree(s); @@ -1172,7 +1154,7 @@ sub Pick {\n\ if (!isalpha(*t) && !isdigit(*t)) *t = '_'; } - if (!index(tokenbuf,'_')) + if (!strchr(tokenbuf,'_')) strcpy(t,"_FH"); tmp3str = hfetch(symtab,tokenbuf); if (!tmp3str) { @@ -1448,7 +1430,7 @@ sub Pick {\n\ } str_cat(str,"; "); fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN); - if (i && (t = index(fstr->str_ptr,0377))) { + if (i && (t = strchr(fstr->str_ptr,0377))) { if (strnEQ(fstr->str_ptr,s,i)) *t = ' '; } @@ -1464,12 +1446,12 @@ sub Pick {\n\ break; case OFORIN: tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN); - d = index(tmpstr->str_ptr,'$'); + d = strchr(tmpstr->str_ptr,'$'); if (!d) fatal("Illegal for loop: %s",tmpstr->str_ptr); - s = index(d,'{'); + s = strchr(d,'{'); if (!s) - s = index(d,'['); + s = strchr(d,'['); if (!s) fatal("Illegal for loop: %s",d); *s++ = '\0'; |