Skip to content

Commit 93a17b2

Browse files
author
Larry Wall
committed
perl 5.0 alpha 3
[editor's note: the sparc executables have not been included, and emacs backup files have been removed]
1 parent 7907280 commit 93a17b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+10178
-3207
lines changed

Bugs/minmax

Lines changed: 0 additions & 12 deletions
This file was deleted.

Bugs/misparse

Lines changed: 0 additions & 2 deletions
This file was deleted.

Bugs/pagdir

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Article 433 of comp.os.386bsd.apps:
2+
Path: netlabs!news.cerf.net!usc!howland.reston.ans.net!spool.mu.edu!bloom-beacon.mit.edu!ai-lab!life.ai.mit.edu!mycroft
3+
From: mycroft@trinity.gnu.ai.mit.edu (Charles Hannum)
4+
Newsgroups: comp.os.386bsd.apps
5+
Subject: Re: Perl-4.036?
6+
Date: 06 Sep 1993 19:01:10 GMT
7+
Organization: MIT Artificial Intelligence Lab
8+
Lines: 9
9+
Message-ID: <MYCROFT.93Sep6150110@trinity.gnu.ai.mit.edu>
10+
References: <26fptu$1q1@terminator.rs.itd.umich.edu> <26fve4$ivf@homer.cs.mcgill.ca>
11+
NNTP-Posting-Host: trinity.gnu.ai.mit.edu
12+
In-reply-to: storm@cs.mcgill.ca's message of 6 Sep 1993 18:27:16 GMT
13+
14+
15+
Perl 4.036 comipled without a single hitch under NetBSD 0.9 last
16+
week. It failed the db test, but I suspect that is due to the new
17+
db stuff under NetBSD and the like...
18+
19+
Yes. The perl test seems to expect the database to be put in
20+
`foo.pag' and `foo.dir', which isn't the case any more. I suspect
21+
lwall will fix this soon.
22+
23+
24+

Bugs/replacecase

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
s/\w/[\u$&\l$&]/gi;

Bugs/stuff

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Article 13355 of comp.lang.perl:
2+
Newsgroups: comp.lang.perl
3+
Path: netlabs!news.cerf.net!usc!cs.utexas.edu!uunet!fmrco!fmrco!asherman
4+
From: asherman@fmrco.com (Aaron Sherman)
5+
Subject: Re: perl 5a2 cannot "die" (plus current list o' bugs)
6+
In-Reply-To: wjm@feenix.metronet.com's message of Fri, 20 Aug 1993 21:32:10 GMT
7+
Message-ID: <ASHERMAN.93Aug23094250@uboat.fmrco.com>
8+
Sender: news@fmrco.uucp
9+
X-Quote: "...accepting is much harder than giving." -Mike Smith
10+
Reply-To: asherman@fmrco.COM
11+
Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
12+
References: <ASHERMAN.93Aug20102959@uboat.fmrco.com> <CC2uHM.6Hq@feenix.metronet.com>
13+
Date: Mon, 23 Aug 1993 14:42:50 GMT
14+
Lines: 47
15+
16+
17+
>>>>> wjm@feenix.metronet.com (Bill Middleton) said:
18+
19+
wjm> asherman@fmrco.COM writes:
20+
21+
>An interesting pair of bugs can be seen in the following output:
22+
23+
wjm> I dont think so. Could be in the compilation or something. Did it
24+
wjm> pass all tests? Each of the following work fine here on this HP.
25+
26+
I tried compiling with Sun's native CC and GCC. Both worked fine, but
27+
caused this problem. I'll try it with Larry's original version when I
28+
get a chance.
29+
30+
wjm> perl5 -e 'die "hello $. \n";
31+
wjm> hello
32+
33+
Ah. But, note that the $. STILL isn't working. So only ONE of those
34+
bugs did not show.
35+
36+
This is my current list of bugs (not complete, but what I've had time
37+
to note). Hope it helps:
38+
39+
"perl -e die" will cause a seg-fault
40+
41+
$. is not updated
42+
43+
Memory leak for anonymous arrays:
44+
while(1) { @a = (1, 2, 3, [4, 5], 6); @a = (); }
45+
Will keep allocating and not freeing memory.
46+
47+
"perl -e 'sub foo {print 1} foo'" should either complain or call foo,
48+
but does neither. Or, did Larry not impliment the &-less
49+
function calling that he was talking about?
50+
51+
"perl -le 'sub foo {1} $a = \&foo; print &{$a}; print &{$a} + 1'" should
52+
not fail to parse.
53+
54+
55+
-AJS
56+
57+
--
58+
Aaron Sherman I-Kinetics, Inc.
59+
Systems Engineer "Open Systems Stepstones"
60+
Voice: (617)661-8181 19 Bishop Allen Dr.
61+
Fax: (617)661-8625 Cambridge, MA 02139
62+
Pager: (508)545-0584 asherman@i-kinetics.com
63+
64+

Changes

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,75 @@
1-
1+
Incompatibilities
2+
-----------------
23
s'$lhs'$rhs' now does no interpolation on either side. It used to
34
interplolate $lhs but not $rhs.
45

56
The second and third arguments of splice are now evaluated in scalar
67
context (like the book says) rather than list context.
78

8-
Saying shift @foo + 20 is now a semantic error.
9+
Saying "shift @foo + 20" is now a semantic error because of precedence.
10+
11+
"open FOO || die" is now incorrect. You need parens around the filehandle.
912

1013
The elements of argument lists for formats are now evaluated in list
11-
context.
14+
context. This means you can interpolate list values now.
1215

13-
You can't do a goto into a block that is optimized away.
16+
You can't do a goto into a block that is optimized away. Darn.
1417

1518
It is no longer syntactically legal to use whitespace as the name
1619
of a variable.
1720

1821
Some error messages will be different.
22+
23+
The caller function now a false value in a scalar context if there is
24+
no caller. This lets library files determine if they're being required.
25+
26+
m//g now attaches its state to the searched string rather than the
27+
regular expression.
28+
29+
New things
30+
----------
31+
The -w switch is much more informative.
32+
33+
References. See t/op/ref.t for examples.
34+
35+
Objects. See t/op/ref.t for examples.
36+
37+
=> is now a synonym for comma. This is useful as documentation for
38+
arguments that come in pairs, such as initializers for associative arrays,
39+
or named arguments to a subroutine.
40+
41+
All functions have been turned into list operators or unary operators,
42+
meaning the parens are optional. Even subroutines may be called as
43+
list operators if they've already been declared.
44+
45+
More embeddible. See main.c and embed_h.SH.
46+
47+
The interpreter is now flattened out. Compare Perl 4's eval.c with
48+
the perl 5's pp.c. Compare Perl 4's 900 line interpreter loop in cmd.c
49+
with Perl 5's 1 line interpreter loop in run.c. Eventually we'll make
50+
everything non-blocking so we can interface nicely with a scheduler.
51+
52+
eval is now treated more like a subroutine call. Among other things,
53+
this means you can return from it.
54+
55+
Format value lists may be spread over multiple lines by enclosing in
56+
curlies.
57+
58+
You may now define BEGIN and END subroutines for each package. The BEGIN
59+
subroutine executes the moment it's parsed. The END subroutine executes
60+
just before exiting.
61+
62+
Flags on the #! line are interpreted even if the script wasn't
63+
executed directly. (And even if the script was located by "perl -x"!)
64+
65+
The ?: operator is now legal as an lvalue.
66+
67+
List context now propagates to the right side of && and ||, as well
68+
as the 2nd and 3rd arguments to ?:.
69+
70+
The "defined" function can now take a general expression.
71+
72+
Lexical scoping available via "my". eval can see the current lexical
73+
variables.
74+
75+
Saying "package;" requires explicit package name on global symbols.

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ shlist:
360360
# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
361361
$(obj) hv.o:
362362
@ echo "You haven't done a "'"make depend" yet!'; exit 1
363+
363364
makedepend: makedepend.SH
364365
/bin/sh $(shellflags) makedepend.SH
365366

Todo

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
1+
POSIX compatibility
2+
hash binding
3+
pack(P)
4+
fix gv refcnts
5+
6+
/\Afoo/ (beginning of string, or where previous g match left off)
7+
/foo\Z/ (end of string only)
8+
Make specialized allocators
9+
Optimize switch statements
10+
Optimize foreach on array
11+
Optimize foreach (1..1000000)
112
Set KEEP on constant split
2-
Optimize foreach on array.
3-
Execute all BEGINs and ENDs.
4-
Make a good way to determine if *.pl is being executed directly.
5-
Make specialized allocators.
6-
Optimize switches.
7-
Do debugger
8-
Cache eval tree
9-
Implement eval once
10-
Cache m//g state
13+
Cache eval tree (unless lexical outer scope used (mark in &compiling?))
1114
rcatmaybe
12-
Fix length($&)
13-
eval {} coredump
15+
Cache method lookup
16+
Shrink opcode tables via multiple implementations selected in peep
17+
Straighten out the RS stuff in BEGIN
18+
Make yyparse recursion longjmp() proof.
1419

20+
sub mysplice(@, $, $, ...)?
21+
pretty function? (or is it, as I suspect, a lib routine?)
22+
perlex function?
23+
X Perl? Motif Perl?
24+
give DOG $bone?
25+
Nested destructors?
1526
make tr/// return histogram in list context?
16-
Do anything with "hint"?
27+
Implement eval once? (Unnecessary with cache?)
1728
When does split() go to @_?
1829
undef wantarray in void context?
30+
goto &coroutine?
31+
filehandle references?

bar

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
###############################################################################
1+
#!./perl
2+
3+
sub foo;
4+
5+
foo;

config.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ medium=''
233233
large=''
234234
huge=''
235235
optimize='-g'
236-
ccflags=' -I/usr/include/sun -I/usr/ucbinclude -DDEBUGGING'
237-
cppflags=' -I/usr/include/sun -I/usr/ucbinclude -DDEBUGGING'
236+
ccflags='-DDEBUGGING'
237+
cppflags='-DDEBUGGING'
238238
ldflags=''
239239
cc='cc'
240240
nativegcc=''

cop.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct cop {
4949
struct ccop ccop; /* compound command */
5050
struct scop scop; /* switch command */
5151
} uop;
52+
U32 cop_seq; /* parse sequence number */
5253
short cop_slen; /* len of cop_short, if not null */
5354
VOL short cop_flags; /* optimization flags--see above */
5455
HV * cop_stash; /* package line was compiled in */
@@ -70,6 +71,7 @@ struct block_sub {
7071
GV * defgv;
7172
AV * savearray;
7273
AV * argarray;
74+
AV * comppad;
7375
U16 olddepth;
7476
U8 hasargs;
7577
};

doio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ I32 len;
236236
}
237237
}
238238
if (!fp) {
239-
if (dowarn && io->type == '<' && index(name, '\n'))
239+
if (dowarn && io->type == '<' && strchr(name, '\n'))
240240
warn(warn_nl, "open");
241241
Safefree(myname);
242242
goto say_false;
@@ -909,7 +909,7 @@ dARGS
909909
sv_setpv(statname,SvPVn(sv));
910910
laststype = OP_STAT;
911911
laststatval = stat(SvPVn(sv),&statcache);
912-
if (laststatval < 0 && dowarn && index(SvPVn(sv), '\n'))
912+
if (laststatval < 0 && dowarn && strchr(SvPVn(sv), '\n'))
913913
warn(warn_nl, "stat");
914914
return laststatval;
915915
}
@@ -941,7 +941,7 @@ dARGS
941941
#else
942942
laststatval = stat(SvPVn(sv),&statcache);
943943
#endif
944-
if (laststatval < 0 && dowarn && index(SvPVn(sv), '\n'))
944+
if (laststatval < 0 && dowarn && strchr(SvPVn(sv), '\n'))
945945
warn(warn_nl, "lstat");
946946
return laststatval;
947947
}
@@ -1033,7 +1033,7 @@ char *cmd;
10331033
if (*s == '=')
10341034
goto doshell;
10351035
for (s = cmd; *s; s++) {
1036-
if (*s != ' ' && !isALPHA(*s) && index("$&*(){}[]'\";\\|?<>~`\n",*s)) {
1036+
if (*s != ' ' && !isALPHA(*s) && strchr("$&*(){}[]'\";\\|?<>~`\n",*s)) {
10371037
if (*s == '\n' && !s[1]) {
10381038
*s = '\0';
10391039
break;

doop.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ OP *arg;
8989

9090
tbl = (short*) cPVOP->op_pv;
9191
s = SvPVn(sv);
92-
send = s + SvCUR(sv);
92+
send = s + SvCUROK(sv);
9393
if (!tbl || !s)
9494
fatal("panic: do_trans");
9595
DEBUG_t( deb("2.TBL\n"));
@@ -139,7 +139,7 @@ register SV **sp;
139139
register I32 items = sp - mark;
140140
register char *delim = SvPVn(del);
141141
register STRLEN len;
142-
I32 delimlen = SvCUR(del);
142+
I32 delimlen = SvCUROK(del);
143143

144144
mark++;
145145
len = (items > 0 ? (delimlen * (items - 1) ) : 0);
@@ -207,7 +207,7 @@ register SV **sarg;
207207
sv_setpv(sv,"");
208208
len--; /* don't count pattern string */
209209
t = s = SvPVn(*sarg);
210-
send = s + SvCUR(*sarg);
210+
send = s + SvCUROK(*sarg);
211211
sarg++;
212212
for ( ; ; len--) {
213213

@@ -316,7 +316,7 @@ register SV **sarg;
316316
break; /* so handle simple cases */
317317
}
318318
else if (f[1] == '-') {
319-
char *mp = index(f, '.');
319+
char *mp = strchr(f, '.');
320320
I32 min = atoi(f+2);
321321

322322
if (mp) {
@@ -330,7 +330,7 @@ register SV **sarg;
330330
break;
331331
}
332332
else if (isDIGIT(f[1])) {
333-
char *mp = index(f, '.');
333+
char *mp = strchr(f, '.');
334334
I32 min = atoi(f+1);
335335

336336
if (mp) {
@@ -438,7 +438,7 @@ register SV *sv;
438438
return;
439439
}
440440
tmps = SvPVn(sv);
441-
if (tmps && SvCUR(sv)) {
441+
if (tmps && SvCUROK(sv)) {
442442
tmps += SvCUR(sv) - 1;
443443
sv_setpvn(astr,tmps,1); /* remember last char */
444444
*tmps = '\0'; /* wipe it out */
@@ -466,10 +466,10 @@ SV *right;
466466
register char *lc = SvPVn(left);
467467
register char *rc = SvPVn(right);
468468
register I32 len;
469+
I32 leftlen = SvCUROK(left);
470+
I32 rightlen = SvCUROK(right);
469471

470-
len = SvCUR(left);
471-
if (len > SvCUR(right))
472-
len = SvCUR(right);
472+
len = leftlen < rightlen ? leftlen : rightlen;
473473
if (SvTYPE(sv) < SVt_PV)
474474
sv_upgrade(sv, SVt_PV);
475475
if (SvCUR(sv) > len)
@@ -545,10 +545,10 @@ SV *right;
545545
*dc++ = *lc++ | *rc++;
546546
mop_up:
547547
len = SvCUR(sv);
548-
if (SvCUR(right) > len)
549-
sv_catpvn(sv,SvPV(right)+len,SvCUR(right) - len);
550-
else if (SvCUR(left) > len)
551-
sv_catpvn(sv,SvPV(left)+len,SvCUR(left) - len);
548+
if (rightlen > len)
549+
sv_catpvn(sv, SvPV(right) + len, rightlen - len);
550+
else if (leftlen > len)
551+
sv_catpvn(sv, SvPV(left) + len, leftlen - len);
552552
break;
553553
}
554554
}

0 commit comments

Comments
 (0)