summaryrefslogtreecommitdiff
path: root/perly.fixer
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-06-06 23:28:14 +0000
committerLarry Wall <lwall@netlabs.com>1991-06-06 23:28:14 +0000
commit9ef589d8078fdf16316dec772c00e81b3c38fd22 (patch)
treee45650d2a4acb876fe2b249e8727e066c5be4c90 /perly.fixer
parent352d5a3ab0aab9889c59e847643d265e062cec0b (diff)
downloadperl-9ef589d8078fdf16316dec772c00e81b3c38fd22.tar.gz
perl 4.0 patch 8: patch #4, continued
See patch #4.
Diffstat (limited to 'perly.fixer')
-rw-r--r--perly.fixer21
1 files changed, 18 insertions, 3 deletions
diff --git a/perly.fixer b/perly.fixer
index 33d1c5cd1a..f3b0e6a90a 100644
--- a/perly.fixer
+++ b/perly.fixer
@@ -2,6 +2,9 @@
# Hacks to make it work with Interactive's SysVr3 Version 2.2
# doughera@lafvax.lafayette.edu (Andy Dougherty) 3/23/91
+#
+# Additional information to make the BSD section work with SunOS 4.0.2
+# tdinger@East.Sun.COM (Tom Dinger) 4/15/1991
input=$1
output=$2
@@ -10,11 +13,12 @@ tmp=/tmp/f$$
plan="unknown"
# Test for BSD 4.3 version.
+# Also tests for the SunOS 4.0.2 version
egrep 'YYSTYPE[ ]*yyv\[ *YYMAXDEPTH *\];
short[ ]*yys\[ *YYMAXDEPTH *\] *;
yyps *= *&yys\[ *-1 *\];
yypv *= *&yyv\[ *-1 *\];
-if *\( *\+\+yyps *> *&yys\[ *YYMAXDEPTH *\] *\)' $input >$tmp
+if *\( *\+\+yyps *>=* *&yys\[ *YYMAXDEPTH *\] *\)' $input >$tmp
set `wc -l $tmp`
if test "$1" = "5"; then
@@ -36,7 +40,10 @@ if *\( *\+\+yy_ps *>= *&yys\[ *YYMAXDEPTH *\] *\)' $input >$tmp
fi
case "$plan" in
- #######################################################
+ ##################################################################
+ # The SunOS 4.0.2 version has the comparison fixed already.
+ # Also added are out of memory checks (makes porting the generated
+ # code easier) For most systems, it can't hurt. -- TD
"bsd43")
echo "Patching perly.c to allow dynamic yacc stack allocation"
echo "Assuming bsd4.3 yaccpar"
@@ -55,13 +62,17 @@ short *maxyyps;
\ if (!yyv) {\
\ yyv = (YYSTYPE*) malloc(yymaxdepth * sizeof(YYSTYPE));\
\ yys = (short*) malloc(yymaxdepth * sizeof(short));\
+\ if ( !yyv || !yys ) {\
+\ yyerror( "out of memory" );\
+\ return(1);\
+\ }\
\ maxyyps = &yys[yymaxdepth];\
\ }\
\ yyps = &yys[-1];\
\ yypv = &yyv[-1];
-/if *( *\+\+yyps *> *&yys\[ *YYMAXDEPTH *\] *)/c\
+/if *( *\+\+yyps *>=* *&yys\[ *YYMAXDEPTH *\] *)/c\
\ if( ++yyps >= maxyyps ) {\
\ int tv = yypv - yyv;\
\ int ts = yyps - yys;\
@@ -71,6 +82,10 @@ short *maxyyps;
\ yymaxdepth*sizeof(YYSTYPE));\
\ yys = (short*)realloc((char*)yys,\
\ yymaxdepth*sizeof(short));\
+\ if ( !yyv || !yys ) {\
+\ yyerror( "yacc stack overflow" );\
+\ return(1);\
+\ }\
\ yyps = yys + ts;\
\ yypv = yyv + tv;\
\ maxyyps = &yys[yymaxdepth];\