summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafcol.lafayette.edu>1994-04-04 00:00:00 +0000
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1994-04-04 00:00:00 +0000
commit2304df62caa7d9be70e8b8bcdb454e139c9c103d (patch)
tree98a456ef0fbe59b1a02bfe68afa4a3d9afb4f21c /x2p
parent8990e3071044a96302560bbdb5706f3e74cf1bef (diff)
downloadperl-2304df62caa7d9be70e8b8bcdb454e139c9c103d.tar.gz
perl 5.0 alpha 8
[the last one taken from the September '94 InfoMagic CD; a similar style of cleanup as the previous commits was performed]
Diffstat (limited to 'x2p')
-rw-r--r--x2p/Makefile12
-rw-r--r--x2p/a2p.y4
-rwxr-xr-xx2p/find2perl34
-rw-r--r--x2p/makefile95
-rw-r--r--x2p/malloc.c49
5 files changed, 96 insertions, 98 deletions
diff --git a/x2p/Makefile b/x2p/Makefile
index 1c6d4a9398..2d2ff74b8f 100644
--- a/x2p/Makefile
+++ b/x2p/Makefile
@@ -1,4 +1,4 @@
-# : Makefile.SH,v 15738Revision: 4.1 15738Date: 92/08/07 18:29:07 $
+# $RCSfile: Makefile.SH,v 28453Revision: 4.1 28453Date: 92/08/07 18:29:07 $
#
# $Log: Makefile.SH,v $
# Revision 4.1 92/08/07 18:29:07 lwall
@@ -20,11 +20,11 @@
#
CC = cc
-YACC = /bin/yacc
+YACC = yacc
bin = /usr/local/bin
-lib =
-mansrc = /usr/man/manl
-manext = l
+lib = /usr/local/lib
+mansrc = /usr/local/man/man1
+manext = 1
LDFLAGS =
SMALL =
LARGE =
@@ -32,7 +32,7 @@ mallocsrc = malloc.c
mallocobj = malloc.o
shellflags =
-libs = -ldbm -lm -lposix
+libs = -ldl -lm -lposix
CCCMD = `sh $(shellflags) cflags $@`
diff --git a/x2p/a2p.y b/x2p/a2p.y
index 111a6f612b..b732b720fd 100644
--- a/x2p/a2p.y
+++ b/x2p/a2p.y
@@ -105,6 +105,8 @@ cond : expr
| match
| rel
| compound_cond
+ | cond '?' expr ':' expr
+ { $$ = oper3(OCOND,$1,$3,$5); }
;
compound_cond
@@ -370,7 +372,7 @@ simple
{ $$ = oper0(ORETURN); }
| RET expr
{ $$ = oper1(ORETURN,$2); }
- | DELETE VAR '[' expr ']'
+ | DELETE VAR '[' expr_list ']'
{ $$ = oper2(ODELETE,aryrefarg($2),$4); }
;
diff --git a/x2p/find2perl b/x2p/find2perl
index 62e6b1b740..7bbeccd55d 100755
--- a/x2p/find2perl
+++ b/x2p/find2perl
@@ -1,4 +1,8 @@
#!/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;
@@ -62,18 +66,18 @@ while (@ARGV) {
$out .= &tab;
$type = shift;
if ($type eq 'nfs')
- { $out .= '$dev < 0'; }
+ { $out .= '($dev < 0)'; }
else
- { $out .= '$dev >= 0'; }
+ { $out .= '($dev >= 0)'; }
}
elsif ($_ eq 'user') {
$uname = shift;
- $out .= &tab . "\$uid == \$uid{'$uname'}";
+ $out .= &tab . "(\$uid == \$uid{'$uname'})";
$inituser++;
}
elsif ($_ eq 'group') {
$gname = shift;
- $out .= &tab . "\$gid == \$gid{'$gname'}";
+ $out .= &tab . "(\$gid == \$gid{'$gname'})";
$initgroup++;
}
elsif ($_ eq 'nouser') {
@@ -85,22 +89,22 @@ while (@ARGV) {
$initgroup++;
}
elsif ($_ eq 'links') {
- $out .= &tab . '$nlink ' . &n(shift);
+ $out .= &tab . '($nlink ' . &n(shift);
}
elsif ($_ eq 'inum') {
- $out .= &tab . '$ino ' . &n(shift);
+ $out .= &tab . '($ino ' . &n(shift);
}
elsif ($_ eq 'size') {
- $out .= &tab . 'int((-s _ + 511) / 512) ' . &n(shift);
+ $out .= &tab . '(int(((-s _) + 511) / 512) ' . &n(shift);
}
elsif ($_ eq 'atime') {
- $out .= &tab . 'int(-A _) ' . &n(shift);
+ $out .= &tab . '(int(-A _) ' . &n(shift);
}
elsif ($_ eq 'mtime') {
- $out .= &tab . 'int(-M _) ' . &n(shift);
+ $out .= &tab . '(int(-M _) ' . &n(shift);
}
elsif ($_ eq 'ctime') {
- $out .= &tab . 'int(-C _) ' . &n(shift);
+ $out .= &tab . '(int(-C _) ' . &n(shift);
}
elsif ($_ eq 'exec') {
for (@cmd = (); @ARGV && $ARGV[0] ne ';'; push(@cmd,shift)) { }
@@ -146,7 +150,7 @@ while (@ARGV) {
$newername = 'AGE_OF' . $file;
$newername =~ s/[^\w]/_/g;
$newername = '$' . $newername;
- $out .= "-M _ < $newername";
+ $out .= "(-M _ < $newername)";
$initnewer .= "$newername = -M " . &quote($file) . ";\n";
}
elsif ($_ eq 'eval') {
@@ -319,7 +323,7 @@ sub ls {
($sec,$min,$hour,$mday,$mon,$year) = localtime($mtime);
$moname = $moname[$mon];
if (-M _ > 365.25 / 2) {
- $timeyear = '19' . $year;
+ $timeyear = $year + 1900;
}
else {
$timeyear = sprintf("%02d:%02d", $hour, $min);
@@ -548,9 +552,9 @@ ENDOFSTAT
sub fileglob_to_re {
local($tmp) = @_;
- $tmp =~ s/([.^\$()])/\\$1/g;
+ $tmp =~ s#([./^\$()])#\\$1#g;
$tmp =~ s/([?*])/.$1/g;
- "^$tmp$";
+ "^$tmp\$";
}
sub n {
@@ -558,7 +562,7 @@ sub n {
$n =~ s/^-/< / || $n =~ s/^\+/> / || $n =~ s/^/== /;
$n =~ s/ 0*(\d)/ $1/;
- $n;
+ $n . ')';
}
sub quote {
diff --git a/x2p/makefile b/x2p/makefile
index d6a11d348d..18b8e0b428 100644
--- a/x2p/makefile
+++ b/x2p/makefile
@@ -1,4 +1,4 @@
-# : Makefile.SH,v 15738Revision: 4.1 15738Date: 92/08/07 18:29:07 $
+# $RCSfile: Makefile.SH,v 28453Revision: 4.1 28453Date: 92/08/07 18:29:07 $
#
# $Log: Makefile.SH,v $
# Revision 4.1 92/08/07 18:29:07 lwall
@@ -20,11 +20,11 @@
#
CC = cc
-YACC = /bin/yacc
+YACC = yacc
bin = /usr/local/bin
-lib =
-mansrc = /usr/man/manl
-manext = l
+lib = /usr/local/lib
+mansrc = /usr/local/man/man1
+manext = 1
LDFLAGS =
SMALL =
LARGE =
@@ -32,7 +32,7 @@ mallocsrc = malloc.c
mallocobj = malloc.o
shellflags =
-libs = -ldbm -lm -lposix
+libs = -ldl -lm -lposix
CCCMD = `sh $(shellflags) cflags $@`
@@ -129,10 +129,9 @@ malloc.c: ../malloc.c
# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
# If this runs make out of memory, delete /usr/include lines.
-hash.o:
hash.o: ../config.h
-hash.o: /usr/ucbinclude/ctype.h
-hash.o: /usr/ucbinclude/stdio.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
@@ -140,60 +139,60 @@ hash.o: hash.c
hash.o: hash.h
hash.o: str.h
hash.o: util.h
-malloc.o:
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: ../pm.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/ucbinclude/ctype.h
-malloc.o: /usr/ucbinclude/dirent.h
-malloc.o: /usr/ucbinclude/errno.h
-malloc.o: /usr/ucbinclude/machine/param.h
-malloc.o: /usr/ucbinclude/machine/setjmp.h
-malloc.o: /usr/ucbinclude/ndbm.h
-malloc.o: /usr/ucbinclude/netinet/in.h
-malloc.o: /usr/ucbinclude/setjmp.h
-malloc.o: /usr/ucbinclude/stdio.h
-malloc.o: /usr/ucbinclude/sys/dirent.h
-malloc.o: /usr/ucbinclude/sys/errno.h
-malloc.o: /usr/ucbinclude/sys/filio.h
-malloc.o: /usr/ucbinclude/sys/ioccom.h
-malloc.o: /usr/ucbinclude/sys/ioctl.h
-malloc.o: /usr/ucbinclude/sys/param.h
-malloc.o: /usr/ucbinclude/sys/signal.h
-malloc.o: /usr/ucbinclude/sys/sockio.h
-malloc.o: /usr/ucbinclude/sys/stat.h
-malloc.o: /usr/ucbinclude/sys/stdtypes.h
-malloc.o: /usr/ucbinclude/sys/sysmacros.h
-malloc.o: /usr/ucbinclude/sys/time.h
-malloc.o: /usr/ucbinclude/sys/times.h
-malloc.o: /usr/ucbinclude/sys/ttold.h
-malloc.o: /usr/ucbinclude/sys/ttychars.h
-malloc.o: /usr/ucbinclude/sys/ttycom.h
-malloc.o: /usr/ucbinclude/sys/ttydev.h
-malloc.o: /usr/ucbinclude/sys/types.h
-malloc.o: /usr/ucbinclude/time.h
-malloc.o: /usr/ucbinclude/vm/faultcode.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:
str.o: ../config.h
-str.o: /usr/ucbinclude/ctype.h
-str.o: /usr/ucbinclude/stdio.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
@@ -201,10 +200,9 @@ str.o: hash.h
str.o: str.c
str.o: str.h
str.o: util.h
-util.o:
util.o: ../config.h
-util.o: /usr/ucbinclude/ctype.h
-util.o: /usr/ucbinclude/stdio.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
@@ -213,10 +211,9 @@ util.o: hash.h
util.o: str.h
util.o: util.c
util.o: util.h
-walk.o:
walk.o: ../config.h
-walk.o: /usr/ucbinclude/ctype.h
-walk.o: /usr/ucbinclude/stdio.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
diff --git a/x2p/malloc.c b/x2p/malloc.c
index c31d0e151e..d5c4717131 100644
--- a/x2p/malloc.c
+++ b/x2p/malloc.c
@@ -82,7 +82,6 @@ union overhead {
};
#define MAGIC 0xff /* magic # on accounting info */
-#define OLDMAGIC 0x7f /* same after a free() */
#define RMAGIC 0x55555555 /* magic # on range info */
#ifdef RCHECK
#define RSLOP sizeof (u_int)
@@ -122,7 +121,7 @@ botch(s)
#define ASSERT(p)
#endif
-MALLOCPTRTYPE *
+Malloc_t
malloc(nbytes)
register MEM_SIZE nbytes;
{
@@ -143,7 +142,7 @@ malloc(nbytes)
#endif /* MSDOS */
#ifdef DEBUGGING
if ((long)nbytes < 0)
- fatal("panic: malloc");
+ croak("panic: malloc");
#endif
#endif /* safemalloc */
@@ -177,14 +176,10 @@ malloc(nbytes)
}
#ifdef safemalloc
-#ifdef DEBUGGING
-# if !(defined(I286) || defined(atarist))
- if (debug & 128)
- fprintf(stderr,"0x%x: (%05d) malloc %ld bytes\n",p+1,an++,(long)size);
-# else
- if (debug & 128)
- fprintf(stderr,"0x%lx: (%05d) malloc %ld bytes\n",p+1,an++,(long)size);
-# endif
+#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
#endif /* safemalloc */
@@ -213,7 +208,7 @@ malloc(nbytes)
p->ov_rmagic = RMAGIC;
*((u_int *)((caddr_t)p + nbytes - RSLOP)) = RMAGIC;
#endif
- return ((MALLOCPTRTYPE *)(p + 1));
+ return ((Malloc_t)(p + 1));
}
/*
@@ -286,21 +281,17 @@ morecore(bucket)
void
free(mp)
- MALLOCPTRTYPE *mp;
+ Malloc_t mp;
{
register MEM_SIZE size;
register union overhead *op;
char *cp = (char*)mp;
#ifdef safemalloc
-#ifdef DEBUGGING
-# if !(defined(I286) || defined(atarist))
- if (debug & 128)
- fprintf(stderr,"0x%x: (%05d) free\n",cp,an++);
-# else
- if (debug & 128)
- fprintf(stderr,"0x%lx: (%05d) free\n",cp,an++);
-# endif
+#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
#endif /* safemalloc */
@@ -311,16 +302,20 @@ free(mp)
ASSERT(op->ov_magic == MAGIC); /* make sure it was in use */
#else
if (op->ov_magic != MAGIC) {
+#ifdef RCHECK
warn("%s free() ignored",
- op->ov_magic == OLDMAGIC ? "Duplicate" : "Bad");
+ op->ov_rmagic == RMAGIC - 1 ? "Duplicate" : "Bad");
+#else
+ warn("Bad free() ignored");
+#endif
return; /* sanity */
}
- op->ov_magic = OLDMAGIC;
#endif
#ifdef RCHECK
ASSERT(op->ov_rmagic == RMAGIC);
if (op->ov_index <= 13)
ASSERT(*(u_int *)((caddr_t)op + op->ov_size + 1 - RSLOP) == RMAGIC);
+ op->ov_rmagic = RMAGIC - 1;
#endif
ASSERT(op->ov_index < NBUCKETS);
size = op->ov_index;
@@ -344,9 +339,9 @@ free(mp)
*/
int reall_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */
-MALLOCPTRTYPE *
+Malloc_t
realloc(mp, nbytes)
- MALLOCPTRTYPE *mp;
+ Malloc_t mp;
MEM_SIZE nbytes;
{
register MEM_SIZE onb;
@@ -371,7 +366,7 @@ realloc(mp, nbytes)
return malloc(nbytes);
#ifdef DEBUGGING
if ((long)nbytes < 0)
- fatal("panic: realloc");
+ croak("panic: realloc");
#endif
#endif /* safemalloc */
@@ -443,7 +438,7 @@ realloc(mp, nbytes)
# endif
#endif
#endif /* safemalloc */
- return ((MALLOCPTRTYPE*)res);
+ return ((Malloc_t)res);
}
/*