From: Nick Ing-Simmons Date: Sun, 19 Jul 1998 12:38:30 +0000 (+0000) Subject: Merge Mainline X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a15299417de39f35d2ce17e6891b4f961265fb6a;p=p5sagit%2Fp5-mst-13.2.git Merge Mainline p4raw-id: //depot/ansiperl@1566 --- a15299417de39f35d2ce17e6891b4f961265fb6a diff --cc fixvars index 0000000,0000000..a211e58 new file mode 100755 --- /dev/null +++ b/fixvars @@@ -1,0 -1,0 +1,69 @@@ ++#!/usr/local/bin/perl -w ++use Data::Dumper; ++ ++my $targ = (@ARGV) ? join(' ',@ARGV) : 'miniperl' ; ++ ++my $work = 1; ++while ($work) ++ { ++ open(PIPE,"make $targ 2>&1 |") || die "Cannot open pipe to make:$!"; ++ my %fix; ++ while () ++ { ++ if (/^(.*):(\d+):\s+\`(\w+)'\s+undeclared/ && -f $1 ) ++ { ++ my ($file,$line,$var) = ($1,$2,$3); ++ $fix{$file} = [] unless exists $fix{$file}; ++ push(@{$fix{$file}},[$line => $var]) unless ($var =~ /^PL_/ || $file =~ /\.h$/); ++ } ++ print; ++ } ++ close(PIPE); ++ warn "Make retured $?\n"; ++ last unless $?; ++ my $changed = 0; ++ foreach my $file (keys %fix) ++ { ++ my @ar = sort( { $a->[0] <=> $b->[0] } @{delete $fix{$file}}); ++ my @miss; ++ my $fixed = 0; ++ unless (-w $file) ++ { ++ system("d4","edit",$file); ++ } ++ @ARGV = ($file); ++ $. = 0; ++ local $^I = '.sav'; ++ while (<>) ++ { ++ while (@ar && $. == $ar[0][0]) ++ { ++ my ($line,$var) = @{shift(@ar)}; ++ if (s/\b$var\b/PL_$var/) ++ { ++ warn "$file:$line: FIX $var\n"; ++ $fixed++; ++ $changed++; ++ } ++ else ++ { ++ push(@miss,[$line,$var,$_]); ++ } ++ } ++ print; ++ } ++ unless ($fixed) ++ { ++ rename("$file$^I",$file); ++ if (@miss) ++ { ++ while (@miss) ++ { ++ my ($line,$var,$txt) = @{shift(@miss)}; ++ warn "$file:$line:$var | $txt"; ++ } ++ } ++ } ++ } ++ last unless $changed; ++ } diff --cc pp_hot.c index e7b7ae0,d2a7af5..cca05f7 --- a/pp_hot.c +++ b/pp_hot.c @@@ -853,14 -853,12 +853,12 @@@ PP(pp_match } } } - if (!rx->nparens && !global) - gimme = G_SCALAR; /* accidental array context? */ safebase = (((gimme == G_ARRAY) || global || !rx->nparens) - && !sawampersand); + && !PL_sawampersand); safebase = safebase ? 0 : REXEC_COPY_STR ; if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) { - SAVEINT(multiline); - multiline = pm->op_pmflags & PMf_MULTILINE; + SAVEINT(PL_multiline); + PL_multiline = pm->op_pmflags & PMf_MULTILINE; } play_it_again: @@@ -1590,10 -1590,12 +1590,12 @@@ PP(pp_subst DIE("panic: do_subst"); strend = s + len; - maxiters = (strend - s) + 10; + maxiters = 2*(strend - s) + 10; /* We can match twice at each + position, once with zero-length, + second time with non-zero. */ - if (!rx->prelen && curpm) { - pm = curpm; + if (!rx->prelen && PL_curpm) { + pm = PL_curpm; rx = pm->op_pmregexp; } screamer = ( (SvSCREAM(TARG) && rx->check_substr diff --cc sv.c index c44b424,a54c6ba..db77f72 --- a/sv.c +++ b/sv.c @@@ -3237,14 -3237,9 +3237,9 @@@ sv_gets(register SV *sv, register PerlI char *buffer; /* Grab the size of the record we're getting */ - recsize = SvIV(SvRV(rs)); + recsize = SvIV(SvRV(PL_rs)); (void)SvPOK_only(sv); /* Validate pointer */ - /* Make sure we've got the room to yank in the whole thing */ - if (SvLEN(sv) <= recsize + 3) { - /* No, so make it bigger */ - SvGROW(sv, recsize + 3); - } - buffer = SvPVX(sv); /* Get the location of the final buffer */ + buffer = SvGROW(sv, recsize + 1); /* Go yank in */ #ifdef VMS /* VMS wants read instead of fread, because fread doesn't respect */ @@@ -3255,9 -3250,10 +3250,10 @@@ bytesread = PerlIO_read(fp, buffer, recsize); #endif SvCUR_set(sv, bytesread); + buffer[bytesread] = '\0'; return(SvCUR(sv) ? SvPVX(sv) : Nullch); } - else if (RsPARA(rs)) { + else if (RsPARA(PL_rs)) { rsptr = "\n\n"; rslen = 2; } diff --cc toke.c index 4058726,d1afa50..8c2121d --- a/toke.c +++ b/toke.c @@@ -5236,28 -5236,30 +5236,30 @@@ scan_heredoc(register char *s } else sv_setpvn(tmpstr,"",0); /* avoid "uninitialized" warning */ - while (s >= bufend) { /* multiple line string? */ + while (s >= PL_bufend) { /* multiple line string? */ if (!outer || - !(oldoldbufptr = oldbufptr = s = linestart = filter_gets(linestr, rsfp, 0))) { - curcop->cop_line = multi_start; - missingterm(tokenbuf); + !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = filter_gets(PL_linestr, PL_rsfp, 0))) { + PL_curcop->cop_line = PL_multi_start; + missingterm(PL_tokenbuf); } - curcop->cop_line++; - bufend = SvPVX(linestr) + SvCUR(linestr); + PL_curcop->cop_line++; + PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); #ifdef TMP_CRLF_PATCH - if (bufend - linestart >= 2) { - if ((bufend[-2] == '\r' && bufend[-1] == '\n') || - (bufend[-2] == '\n' && bufend[-1] == '\r')) + if (PL_bufend - PL_linestart >= 2) { - if (PL_bufend[-2] == '\r' || PL_bufend[-2] == '\n') { ++ if ((PL_bufend[-2] == '\r' && PL_bufend[-1] == '\n') || ++ (PL_bufend[-2] == '\n' && PL_bufend[-1] == '\r')) + { - bufend[-2] = '\n'; - bufend--; - SvCUR_set(linestr, bufend - SvPVX(linestr)); + PL_bufend[-2] = '\n'; + PL_bufend--; + SvCUR_set(PL_linestr, PL_bufend - SvPVX(PL_linestr)); } - else if (bufend[-1] == '\r') - bufend[-1] = '\n'; + else if (PL_bufend[-1] == '\r') + PL_bufend[-1] = '\n'; } - else if (bufend - linestart == 1 && bufend[-1] == '\r') - bufend[-1] = '\n'; + else if (PL_bufend - PL_linestart == 1 && PL_bufend[-1] == '\r') + PL_bufend[-1] = '\n'; #endif - if (PERLDB_LINE && curstash != debstash) { + if (PERLDB_LINE && PL_curstash != PL_debstash) { SV *sv = NEWSV(88,0); sv_upgrade(sv, SVt_PVMG);