X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perly.fixer;h=98296a72fd23191447870fb2e4de39aa1031c599;hb=b851de6cd1cc79b5e8ed7db02ebd0a9769d34232;hp=f3b0e6a90a6ce6d13ac3aa8111d170eeafc8db88;hpb=9ef589d8078fdf16316dec772c00e81b3c38fd22;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perly.fixer b/perly.fixer old mode 100644 new mode 100755 index f3b0e6a..98296a7 --- a/perly.fixer +++ b/perly.fixer @@ -1,5 +1,13 @@ #!/bin/sh +# Fix up yacc output to allow dynamic allocation. Since perly.c +# is now provided with the perl source, this should not be necessary. +# +# However, if the user wishes to use byacc, or wishes to try another +# compiler compiler (e.g. bison or yacc), this script will get run. +# +# Currently, only byacc version 1.8 is supported. +# # Hacks to make it work with Interactive's SysVr3 Version 2.2 # doughera@lafvax.lafayette.edu (Andy Dougherty) 3/23/91 # @@ -10,15 +18,41 @@ input=$1 output=$2 tmp=/tmp/f$$ +if grep 'yaccpar 1.8 (Berkeley)' $input >/dev/null 2>&1; then + cp $input $output + if test -f perly.c.diff; then + patch -F3 $output /dev/null 2>&1; then + if test -f perly.c.dif9; then + patch -F3 $output =* *&yys\[ *YYMAXDEPTH *\] *\)' $input >$tmp +if *\( *\+\+yyps *>=* *&yys\[ *YYMAXDEPTH *\] *\)' $input >$tmp 2>/dev/null set `wc -l $tmp` if test "$1" = "5"; then @@ -26,12 +60,12 @@ if test "$1" = "5"; then fi if test "$plan" = "unknown"; then - # Test for ISC 2.2 version. + # Test for ISC 2.2 version (probably generic SysVr3). egrep 'YYSTYPE[ ]*yyv\[ *YYMAXDEPTH *\]; int[ ]*yys\[ *YYMAXDEPTH *\] *; yyps *= *&yys\[ *-1 *\]; yypv *= *&yyv\[ *-1 *\]; -if *\( *\+\+yy_ps *>= *&yys\[ *YYMAXDEPTH *\] *\)' $input >$tmp +if *\( *\+\+yy_ps *>= *&yys\[ *YYMAXDEPTH *\] *\)' $input >$tmp 2>/dev/null set `wc -l $tmp` if test "$1" = "5"; then @@ -60,8 +94,8 @@ short *maxyyps; /yypv *= *&yyv\[ *-1 *\];/c\ \ if (!yyv) {\ -\ yyv = (YYSTYPE*) malloc(yymaxdepth * sizeof(YYSTYPE));\ -\ yys = (short*) malloc(yymaxdepth * sizeof(short));\ +\ yyv = (YYSTYPE*) safemalloc(yymaxdepth * sizeof(YYSTYPE));\ +\ yys = (short*) safemalloc(yymaxdepth * sizeof(short));\ \ if ( !yyv || !yys ) {\ \ yyerror( "out of memory" );\ \ return(1);\ @@ -121,8 +155,8 @@ int *maxyyps; /yypv *= *&yyv\[ *-1 *\];/c\ \ if (!yyv) {\ -\ yyv = (YYSTYPE*) malloc(yymaxdepth * sizeof(YYSTYPE));\ -\ yys = (int*) malloc(yymaxdepth * sizeof(int));\ +\ yyv = (YYSTYPE*) safemalloc(yymaxdepth * sizeof(YYSTYPE));\ +\ yys = (int*) safemalloc(yymaxdepth * sizeof(int));\ \ maxyyps = &yys[yymaxdepth];\ \ }\ \ yyps = &yys[-1];\ @@ -148,7 +182,7 @@ END ###################################################### # Plan still unknown - *) mv $input $output; + *) sed -e 's/Received token/ *** Received token/' $input >$output; esac rm -rf $tmp $input