diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1997-11-11 23:08:54 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1997-11-11 23:08:54 +0000 |
commit | e7cd54d7e2bd82a89f30e2f71675be1f5d3be34d (patch) | |
tree | f6873b8c4849ed68422779287f972403412a3412 | |
parent | 1d64a758d60d7ded97c59c753fea85d3365ca0df (diff) | |
parent | 004955206412e3e53b76d4dad6bc7ac3032c300a (diff) | |
download | perl-e7cd54d7e2bd82a89f30e2f71675be1f5d3be34d.tar.gz |
Initial (untested) integration of mainline changes.
p4raw-id: //depot/win32/perl@234
-rw-r--r-- | INTERN.h | 7 | ||||
-rw-r--r-- | MANIFEST | 4 | ||||
-rw-r--r-- | XSUB.h | 2 | ||||
-rw-r--r-- | av.c | 116 | ||||
-rwxr-xr-x | configure | 124 | ||||
-rw-r--r-- | deb.c | 6 | ||||
-rw-r--r-- | doio.c | 103 | ||||
-rw-r--r-- | doop.c | 37 | ||||
-rw-r--r-- | dump.c | 24 | ||||
-rw-r--r-- | embed.h | 9 | ||||
-rw-r--r-- | ext/DB_File/DB_File.xs | 3 | ||||
-rw-r--r-- | ext/DynaLoader/dl_dlopen.xs | 2 | ||||
-rw-r--r-- | ext/Fcntl/Fcntl.xs | 7 | ||||
-rw-r--r-- | ext/GDBM_File/GDBM_File.xs | 7 | ||||
-rw-r--r-- | ext/IO/IO.xs | 7 | ||||
-rw-r--r-- | ext/Opcode/Opcode.pm | 2 | ||||
-rw-r--r-- | ext/Opcode/Opcode.xs | 32 | ||||
-rw-r--r-- | ext/POSIX/POSIX.xs | 7 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/hash.c | 4 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/pair.c | 45 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/sdbm.c | 66 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/sdbm.h | 9 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/util.c | 7 | ||||
-rw-r--r-- | ext/Socket/Socket.xs | 11 | ||||
-rw-r--r-- | ext/Thread/Thread.xs | 5 | ||||
-rw-r--r-- | ext/attrs/attrs.xs | 7 | ||||
-rw-r--r-- | gv.c | 111 | ||||
-rw-r--r-- | hv.c | 132 | ||||
-rw-r--r-- | interp.sym | 3 | ||||
-rw-r--r-- | malloc.c | 38 | ||||
-rw-r--r-- | mg.c | 224 | ||||
-rw-r--r-- | miniperlmain.c | 8 | ||||
-rw-r--r-- | op.c | 523 | ||||
-rw-r--r-- | op.h | 2 | ||||
-rw-r--r-- | opcode.h | 22 | ||||
-rwxr-xr-x | opcode.pl | 10 | ||||
-rw-r--r-- | perl.c | 185 | ||||
-rw-r--r-- | perl.h | 11 | ||||
-rw-r--r-- | perlio.c | 10 | ||||
-rw-r--r-- | perly.c | 9 | ||||
-rw-r--r-- | perly.y | 2 | ||||
-rw-r--r-- | pp.c | 289 | ||||
-rw-r--r-- | pp.h | 10 | ||||
-rw-r--r-- | pp_ctl.c | 148 | ||||
-rw-r--r-- | pp_hot.c | 85 | ||||
-rw-r--r-- | pp_sys.c | 328 | ||||
-rw-r--r-- | proto.h | 2 | ||||
-rw-r--r-- | regcomp.c | 131 | ||||
-rw-r--r-- | regexec.c | 42 | ||||
-rw-r--r-- | run.c | 15 | ||||
-rw-r--r-- | scope.c | 107 | ||||
-rw-r--r-- | sv.c | 392 | ||||
-rwxr-xr-x | t/lib/safe2.t | 3 | ||||
-rw-r--r-- | taint.c | 6 | ||||
-rw-r--r-- | thread.h | 4 | ||||
-rw-r--r-- | toke.c | 178 | ||||
-rw-r--r-- | universal.c | 12 | ||||
-rw-r--r-- | util.c | 255 | ||||
-rw-r--r-- | win32/Makefile | 5 | ||||
-rw-r--r-- | win32/makefile.mk | 4 | ||||
-rw-r--r-- | win32/perllib.c | 4 | ||||
-rw-r--r-- | x2p/a2p.c | 2 | ||||
-rw-r--r-- | x2p/a2p.h | 4 | ||||
-rw-r--r-- | x2p/a2py.c | 105 | ||||
-rw-r--r-- | x2p/hash.c | 26 | ||||
-rw-r--r-- | x2p/str.c | 84 | ||||
-rw-r--r-- | x2p/util.c | 41 | ||||
-rw-r--r-- | x2p/walk.c | 36 |
68 files changed, 1472 insertions, 2789 deletions
@@ -23,11 +23,18 @@ # define EXTCONST globaldef {"$GLOBAL_RO_VARS"} readonly # define dEXTCONST globaldef {"$GLOBAL_RO_VARS"} readonly #else +# ifdef __cplusplus +# define EXT +# define dEXT +# define EXTCONST extern const +# define dEXTCONST const +#else # define EXT # define dEXT # define EXTCONST const # define dEXTCONST const #endif +#endif #undef INIT #define INIT(x) = x @@ -4,8 +4,7 @@ Changes5.000 Differences between 4.x and 5.000 Changes5.001 Differences between 5.000 and 5.001 Changes5.002 Differences between 5.001 and 5.002 Changes5.003 Differences between 5.002 and 5.003 -configure Crude emulation of GNU configure -configure.gnu Copy of configure (for case-insensitive systems) +configure.gnu Crude emulation of GNU configure Configure Portability tool Copying The GNU General Public License EXTERN.h Included before foreign .h files @@ -211,7 +210,6 @@ ext/Socket/Socket.xs Socket extension external subroutines ext/Thread/Makefile.PL Thread extension makefile writer ext/Thread/Notes Thread notes ext/Thread/README Thread README -ext/Thread/Thread Directory for Thread:: submodules ext/Thread/Thread/Queue.pm Thread synchronised queue objects ext/Thread/Thread/Semaphore.pm Thread semaphore objects ext/Thread/Thread.pm Thread extension Perl module @@ -7,7 +7,7 @@ #endif #define dXSARGS \ - dTHR; dSP; dMARK; \ + dSP; dMARK; \ I32 ax = mark - stack_base + 1; \ I32 items = sp - mark @@ -16,8 +16,7 @@ #include "perl.h" void -av_reify(av) -AV* av; +av_reify(AV *av) { I32 key; SV* sv; @@ -42,9 +41,7 @@ AV* av; } void -av_extend(av,key) -AV *av; -I32 key; +av_extend(AV *av, I32 key) { dTHR; /* only necessary if we have to extend stack */ if (key > AvMAX(av)) { @@ -123,10 +120,7 @@ I32 key; } SV** -av_fetch(av,key,lval) -register AV *av; -I32 key; -I32 lval; +av_fetch(register AV *av, I32 key, I32 lval) { SV *sv; @@ -175,10 +169,7 @@ I32 lval; } SV** -av_store(av,key,val) -register AV *av; -I32 key; -SV *val; +av_store(register AV *av, I32 key, SV *val) { SV** ary; @@ -232,7 +223,7 @@ SV *val; } AV * -newAV() +newAV(void) { register AV *av; @@ -246,9 +237,7 @@ newAV() } AV * -av_make(size,strp) -register I32 size; -register SV **strp; +av_make(register I32 size, register SV **strp) { register AV *av; register I32 i; @@ -274,9 +263,7 @@ register SV **strp; } AV * -av_fake(size,strp) -register I32 size; -register SV **strp; +av_fake(register I32 size, register SV **strp) { register AV *av; register SV** ary; @@ -299,8 +286,7 @@ register SV **strp; } void -av_clear(av) -register AV *av; +av_clear(register AV *av) { register I32 key; SV** ary; @@ -333,8 +319,7 @@ register AV *av; } void -av_undef(av) -register AV *av; +av_undef(register AV *av) { register I32 key; @@ -357,9 +342,7 @@ register AV *av; } void -av_push(av,val) -register AV *av; -SV *val; +av_push(register AV *av, SV *val) { if (!av) return; @@ -367,8 +350,7 @@ SV *val; } SV * -av_pop(av) -register AV *av; +av_pop(register AV *av) { SV *retval; @@ -384,9 +366,7 @@ register AV *av; } void -av_unshift(av,num) -register AV *av; -register I32 num; +av_unshift(register AV *av, register I32 num) { register I32 i; register SV **sstr,**dstr; @@ -427,8 +407,7 @@ register I32 num; } SV * -av_shift(av) -register AV *av; +av_shift(register AV *av) { SV *retval; @@ -448,16 +427,13 @@ register AV *av; } I32 -av_len(av) -register AV *av; +av_len(register AV *av) { return AvFILL(av); } void -av_fill(av, fill) -register AV *av; -I32 fill; +av_fill(register AV *av, I32 fill) { if (!av) croak("panic: null array"); @@ -487,11 +463,7 @@ I32 fill; } SV** -avhv_fetch(av, key, klen, lval) -AV *av; -char *key; -U32 klen; -I32 lval; +avhv_fetch(AV *av, char *key, U32 klen, I32 lval) { SV **keys, **indsvp; I32 ind; @@ -515,11 +487,7 @@ I32 lval; } SV** -avhv_fetch_ent(av, keysv, lval, hash) -AV *av; -SV *keysv; -I32 lval; -U32 hash; +avhv_fetch_ent(AV *av, SV *keysv, I32 lval, U32 hash) { SV **keys, **indsvp; HE *he; @@ -544,12 +512,7 @@ U32 hash; } SV** -avhv_store(av, key, klen, val, hash) -AV *av; -char *key; -U32 klen; -SV *val; -U32 hash; +avhv_store(AV *av, char *key, U32 klen, SV *val, U32 hash) { SV **keys, **indsvp; I32 ind; @@ -570,11 +533,7 @@ U32 hash; } SV** -avhv_store_ent(av, keysv, val, hash) -AV *av; -SV *keysv; -SV *val; -U32 hash; +avhv_store_ent(AV *av, SV *keysv, SV *val, U32 hash) { SV **keys; HE *he; @@ -596,10 +555,7 @@ U32 hash; } bool -avhv_exists_ent(av, keysv, hash) -AV *av; -SV *keysv; -U32 hash; +avhv_exists_ent(AV *av, SV *keysv, U32 hash) { SV **keys; @@ -610,10 +566,7 @@ U32 hash; } bool -avhv_exists(av, key, klen) -AV *av; -char *key; -U32 klen; +avhv_exists(AV *av, char *key, U32 klen) { SV **keys; @@ -625,11 +578,7 @@ U32 klen; /* avhv_delete leaks. Caller can re-index and compress if so desired. */ SV * -avhv_delete(av, key, klen, flags) -AV *av; -char *key; -U32 klen; -I32 flags; +avhv_delete(AV *av, char *key, U32 klen, I32 flags) { SV **keys; SV *sv; @@ -660,11 +609,7 @@ I32 flags; /* avhv_delete_ent leaks. Caller can re-index and compress if so desired. */ SV * -avhv_delete_ent(av, keysv, flags, hash) -AV *av; -SV *keysv; -I32 flags; -U32 hash; +avhv_delete_ent(AV *av, SV *keysv, I32 flags, U32 hash) { SV **keys; SV *sv; @@ -694,8 +639,7 @@ U32 hash; } I32 -avhv_iterinit(av) -AV *av; +avhv_iterinit(AV *av) { SV **keys; @@ -706,8 +650,7 @@ AV *av; } HE * -avhv_iternext(av) -AV *av; +avhv_iternext(AV *av) { SV **keys; @@ -718,9 +661,7 @@ AV *av; } SV * -avhv_iterval(av, entry) -AV *av; -register HE *entry; +avhv_iterval(AV *av, register HE *entry) { SV **keys; SV *sv; @@ -737,10 +678,7 @@ register HE *entry; } SV * -avhv_iternextsv(av, key, retlen) -AV *av; -char **key; -I32 *retlen; +avhv_iternextsv(AV *av, char **key, I32 *retlen) { SV **keys; HE *he; diff --git a/configure b/configure deleted file mode 100755 index e101147948..0000000000 --- a/configure +++ /dev/null @@ -1,124 +0,0 @@ -#! /bin/sh -# -# $Id: configure,v 3.0.1.1 1995/07/25 14:16:21 ram Exp $ -# -# GNU configure-like front end to metaconfig's Configure. -# -# Written by Andy Dougherty <doughera@lafcol.lafayette.edu> -# and Matthew Green <mrg@mame.mu.oz.au>. -# -# Reformatted and modified for inclusion in the dist-3.0 package by -# Raphael Manfredi <ram@hptnos02.grenoble.hp.com>. -# -# This script belongs to the public domain and may be freely redistributed. -# -# The remaining of this leading shell comment may be removed if you -# include this script in your own package. -# -# $Log: configure,v $ -# Revision 3.0.1.1 1995/07/25 14:16:21 ram -# patch56: created -# - -(exit $?0) || exec sh $0 $argv:q - -case "$0" in -*configure) - if cmp $0 `echo $0 | sed -e s/configure/Configure/` >/dev/null; then - echo "Your configure and Configure scripts seem to be identical." - echo "This can happen on filesystems that aren't fully case sensitive." - echo "You'll have to explicitly extract Configure and run that." - exit 1 - fi - ;; -esac - -opts='' -verbose='' -create='-e' -while test $# -gt 0; do - case $1 in - --help) - cat <<EOM -Usage: configure [options] -This is GNU configure-like front end for a metaconfig-generated Configure. -It emulates the following GNU configure options (must be fully spelled out): - --help - --no-create - --prefix=PREFIX - --cache-file (ignored) - --quiet - --silent - --verbose - --version - -And it honours these environment variables: CC, CFLAGS and DEFS. -EOM - exit 0 - ;; - --no-create) - create='-E' - shift - ;; - --prefix=*) - arg=`echo $1 | sed 's/--prefix=/-Dprefix=/'` - opts="$opts $arg" - shift - ;; - --cache-file=*) - shift # Just ignore it. - ;; - --quiet|--silent) - exec >/dev/null 2>&1 - shift - ;; - --verbose) - verbose=true - shift - ;; - --version) - copt="$copt -V" - shift - ;; - --*) - opt=`echo $1 | sed 's/=.*//'` - echo "This GNU configure front end does not understand $opt" - exit 1 - ;; - *) - opts="$opts $1" - shift - ;; - esac -done - -case "$CC" in -'') ;; -*) opts="$opts -Dcc='$CC'";; -esac - -# Join DEFS and CFLAGS together. -ccflags='' -case "$DEFS" in -'') ;; -*) ccflags=$DEFS;; -esac -case "$CFLAGS" in -'') ;; -*) ccflags="$ccflags $CFLAGS";; -esac -case "$ccflags" in -'') ;; -*) opts="$opts -Dccflags='$ccflags'";; -esac - -# Don't use -s if they want verbose mode -case "$verbose" in -'') copt="$copt -ds";; -*) copt="$copt -d";; -esac - -set X sh Configure $copt $create $opts -shift -echo "$@" -exec "$@" @@ -88,7 +88,7 @@ deb(pat, va_alist) #endif /* !defined(I_STDARG) && !defined(I_VARARGS) */ void -deb_growlevel() +deb_growlevel(void) { dlmax += 128; Renew(debname, dlmax, char); @@ -96,7 +96,7 @@ deb_growlevel() } I32 -debstackptrs() +debstackptrs(void) { dTHR; PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n", @@ -110,7 +110,7 @@ debstackptrs() } I32 -debstack() +debstack(void) { dTHR; I32 top = stack_sp - stack_base; @@ -76,13 +76,7 @@ #endif bool -do_open(gv,name,len,as_raw,rawmode,rawperm,supplied_fp) -GV *gv; -register char *name; -I32 len; -int as_raw; -int rawmode, rawperm; -PerlIO *supplied_fp; +do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawperm, FILE *supplied_fp) { register IO *io = GvIOn(gv); PerlIO *saveifp = Nullfp; @@ -364,8 +358,7 @@ say_false: } PerlIO * -nextargv(gv) -register GV *gv; +nextargv(register GV *gv) { register SV *sv; #ifndef FLEXFILENAMES @@ -514,10 +507,7 @@ register GV *gv; #ifdef HAS_PIPE void -do_pipe(sv, rgv, wgv) -SV *sv; -GV *rgv; -GV *wgv; +do_pipe(SV *sv, GV *rgv, GV *wgv) { register IO *rstio; register IO *wstio; @@ -596,8 +586,7 @@ do_close(GV *gv, bool not_implicit) } bool -io_close(io) -IO* io; +io_close(IO *io) { bool retval = FALSE; int status; @@ -625,8 +614,7 @@ IO* io; } bool -do_eof(gv) -GV *gv; +do_eof(GV *gv) { dTHR; register IO *io; @@ -664,8 +652,7 @@ GV *gv; } long -do_tell(gv) -GV *gv; +do_tell(GV *gv) { register IO *io; register PerlIO *fp; @@ -684,10 +671,7 @@ GV *gv; } bool -do_seek(gv, pos, whence) -GV *gv; -long pos; -int whence; +do_seek(GV *gv, long int pos, int whence) { register IO *io; register PerlIO *fp; @@ -706,10 +690,7 @@ int whence; } long -do_sysseek(gv, pos, whence) -GV *gv; -long pos; -int whence; +do_sysseek(GV *gv, long int pos, int whence) { register IO *io; register PerlIO *fp; @@ -774,9 +755,7 @@ Off_t length; /* length to set file to */ #endif /* F_FREESP */ bool -do_print(sv,fp) -register SV *sv; -PerlIO *fp; +do_print(register SV *sv, FILE *fp) { register char *tmps; STRLEN len; @@ -820,10 +799,9 @@ PerlIO *fp; } I32 -my_stat(ARGS) -dARGS +my_stat(ARGSproto) { - dSP; + djSP; IO *io; GV* tmpgv; @@ -872,10 +850,9 @@ dARGS } I32 -my_lstat(ARGS) -dARGS +my_lstat(ARGSproto) { - dSP; + djSP; SV *sv; if (op->op_flags & OPf_REF) { EXTEND(sp,1); @@ -903,10 +880,7 @@ dARGS } bool -do_aexec(really,mark,sp) -SV *really; -register SV **mark; -register SV **sp; +do_aexec(SV *really, register SV **mark, register SV **sp) { register char **a; char *tmps; @@ -936,7 +910,7 @@ register SV **sp; } void -do_execfree() +do_execfree(void) { if (Argv) { Safefree(Argv); @@ -951,8 +925,7 @@ do_execfree() #if !defined(OS2) && !defined(WIN32) bool -do_exec(cmd) -char *cmd; +do_exec(char *cmd) { register char **a; register char *s; @@ -1042,10 +1015,7 @@ char *cmd; #endif /* OS2 || WIN32 */ I32 -apply(type,mark,sp) -I32 type; -register SV **mark; -register SV **sp; +apply(I32 type, register SV **mark, register SV **sp) { dTHR; register I32 val; @@ -1215,10 +1185,7 @@ register SV **sp; /* Do the permissions allow some operation? Assumes statcache already set. */ #ifndef VMS /* VMS' cando is in vms.c */ I32 -cando(bit, effective, statbufp) -I32 bit; -I32 effective; -register struct stat *statbufp; +cando(I32 bit, I32 effective, register struct stat *statbufp) { #ifdef DOSISH /* [Comments and code from Len Reed] @@ -1270,9 +1237,7 @@ register struct stat *statbufp; #endif /* ! VMS */ I32 -ingroup(testgid,effective) -I32 testgid; -I32 effective; +ingroup(I32 testgid, I32 effective) { if (testgid == (effective ? egid : gid)) return TRUE; @@ -1296,10 +1261,7 @@ I32 effective; #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) I32 -do_ipcget(optype, mark, sp) -I32 optype; -SV **mark; -SV **sp; +do_ipcget(I32 optype, SV **mark, SV **sp) { dTHR; key_t key; @@ -1332,10 +1294,7 @@ SV **sp; } I32 -do_ipcctl(optype, mark, sp) -I32 optype; -SV **mark; -SV **sp; +do_ipcctl(I32 optype, SV **mark, SV **sp) { dTHR; SV *astr; @@ -1457,9 +1416,7 @@ SV **sp; } I32 -do_msgsnd(mark, sp) -SV **mark; -SV **sp; +do_msgsnd(SV **mark, SV **sp) { #ifdef HAS_MSG dTHR; @@ -1482,9 +1439,7 @@ SV **sp; } I32 -do_msgrcv(mark, sp) -SV **mark; -SV **sp; +do_msgrcv(SV **mark, SV **sp) { #ifdef HAS_MSG dTHR; @@ -1521,9 +1476,7 @@ SV **sp; } I32 -do_semop(mark, sp) -SV **mark; -SV **sp; +do_semop(SV **mark, SV **sp) { #ifdef HAS_SEM dTHR; @@ -1548,10 +1501,7 @@ SV **sp; } I32 -do_shmio(optype, mark, sp) -I32 optype; -SV **mark; -SV **sp; +do_shmio(I32 optype, SV **mark, SV **sp) { #ifdef HAS_SHM dTHR; @@ -1572,7 +1522,7 @@ SV **sp; SETERRNO(EFAULT,SS$_ACCVIO); /* can't do as caller requested */ return -1; } - shm = (Shmat_t)shmat(id, (char*)NULL, (optype == OP_SHMREAD) ? SHM_RDONLY : 0); + shm = (char *)shmat(id, (char*)NULL, (optype == OP_SHMREAD) ? SHM_RDONLY : 0); if (shm == (char *)-1) /* I hate System V IPC, I really do */ return -1; if (optype == OP_SHMREAD) { @@ -1601,3 +1551,4 @@ SV **sp; } #endif /* SYSV IPC */ + @@ -19,9 +19,7 @@ #endif I32 -do_trans(sv,arg) -SV *sv; -OP *arg; +do_trans(SV *sv, OP *arg) { dTHR; register short *tbl; @@ -82,11 +80,7 @@ OP *arg; } void -do_join(sv,del,mark,sp) -register SV *sv; -SV *del; -register SV **mark; -register SV **sp; +do_join(register SV *sv, SV *del, register SV **mark, register SV **sp) { SV **oldmark = mark; register I32 items = sp - mark; @@ -142,10 +136,7 @@ register SV **sp; } void -do_sprintf(sv,len,sarg) -SV *sv; -I32 len; -SV **sarg; +do_sprintf(SV *sv, I32 len, SV **sarg) { STRLEN patlen; char *pat = SvPV(*sarg, patlen); @@ -158,8 +149,7 @@ SV **sarg; } void -do_vecset(sv) -SV *sv; +do_vecset(SV *sv) { SV *targ = LvTARG(sv); register I32 offset; @@ -210,9 +200,7 @@ SV *sv; } void -do_chop(astr,sv) -register SV *astr; -register SV *sv; +do_chop(register SV *astr, register SV *sv) { STRLEN len; char *s; @@ -254,8 +242,7 @@ register SV *sv; } I32 -do_chomp(sv) -register SV *sv; +do_chomp(register SV *sv) { dTHR; register I32 count; @@ -329,11 +316,7 @@ register SV *sv; } void -do_vop(optype,sv,left,right) -I32 optype; -SV *sv; -SV *left; -SV *right; +do_vop(I32 optype, SV *sv, SV *left, SV *right) { dTHR; /* just for taint */ #ifdef LIBERAL @@ -447,10 +430,9 @@ SV *right; } OP * -do_kv(ARGS) -dARGS +do_kv(ARGSproto) { - dSP; + djSP; HV *hv = (HV*)POPs; register HE *entry; SV *tmpstr; @@ -532,3 +514,4 @@ dARGS } return NORMAL; } + @@ -17,7 +17,7 @@ #ifndef DEBUGGING void -dump_all() +dump_all(void) { } #else /* Rest of file is for DEBUGGING */ @@ -29,7 +29,7 @@ static void dump(); #endif void -dump_all() +dump_all(void) { dTHR; PerlIO_setlinebuf(Perl_debug_log); @@ -39,8 +39,7 @@ dump_all() } void -dump_packsubs(stash) -HV* stash; +dump_packsubs(HV *stash) { dTHR; I32 i; @@ -64,8 +63,7 @@ HV* stash; } void -dump_sub(gv) -GV* gv; +dump_sub(GV *gv) { SV *sv = sv_newmortal(); @@ -82,8 +80,7 @@ GV* gv; } void -dump_form(gv) -GV* gv; +dump_form(GV *gv) { SV *sv = sv_newmortal(); @@ -96,14 +93,13 @@ GV* gv; } void -dump_eval() +dump_eval(void) { dump_op(eval_root); } void -dump_op(o) -register OP *o; +dump_op(OP *o) { dump("{\n"); if (o->op_seq) @@ -316,8 +312,7 @@ register OP *o; } void -dump_gv(gv) -register GV *gv; +dump_gv(GV *gv) { SV *sv; @@ -340,8 +335,7 @@ register GV *gv; } void -dump_pm(pm) -register PMOP *pm; +dump_pm(PMOP *pm) { char ch; @@ -1267,8 +1267,7 @@ #define e_tmpname (curinterp->Ie_tmpname) #define endav (curinterp->Iendav) #define envgv (curinterp->Ienvgv) -#define errhv (curinterp->Ierrhv) -#define errsv (curinterp->Ierrsv) +#define errgv (curinterp->Ierrgv) #define eval_root (curinterp->Ieval_root) #define eval_start (curinterp->Ieval_start) #define fdpid (curinterp->Ifdpid) @@ -1419,8 +1418,7 @@ #define Ie_tmpname e_tmpname #define Iendav endav #define Ienvgv envgv -#define Ierrhv errhv -#define Ierrsv errsv +#define Ierrgv errgv #define Ieval_root eval_root #define Ieval_start eval_start #define Ifdpid fdpid @@ -1580,8 +1578,7 @@ #define e_fp Perl_e_fp #define e_tmpname Perl_e_tmpname #define endav Perl_endav -#define errhv Perl_errhv -#define errsv Perl_errsv +#define errgv Perl_errgv #define eval_root Perl_eval_root #define eval_start Perl_eval_start #define fdpid Perl_fdpid diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs index bd0c933329..959f3425eb 100644 --- a/ext/DB_File/DB_File.xs +++ b/ext/DB_File/DB_File.xs @@ -140,7 +140,6 @@ btree_compare(key1, key2) const DBT * key1 ; const DBT * key2 ; { - dTHR ; dSP ; void * data1, * data2 ; int retval ; @@ -188,7 +187,6 @@ btree_prefix(key1, key2) const DBT * key1 ; const DBT * key2 ; { - dTHR ; dSP ; void * data1, * data2 ; int retval ; @@ -236,7 +234,6 @@ hash_cb(data, size) const void * data ; size_t size ; { - dTHR ; dSP ; int retval ; int count ; diff --git a/ext/DynaLoader/dl_dlopen.xs b/ext/DynaLoader/dl_dlopen.xs index fef4530cfe..2459205653 100644 --- a/ext/DynaLoader/dl_dlopen.xs +++ b/ext/DynaLoader/dl_dlopen.xs @@ -206,7 +206,7 @@ dl_install_xsub(perl_name, symref, filename="$Package") CODE: DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), "dl_install_xsub(name=%s, symref=%lx)\n", perl_name, (unsigned long) symref)); - ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename))); + ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)_((CV *)))symref, filename))); char * diff --git a/ext/Fcntl/Fcntl.xs b/ext/Fcntl/Fcntl.xs index 9034031c9c..251f3f4176 100644 --- a/ext/Fcntl/Fcntl.xs +++ b/ext/Fcntl/Fcntl.xs @@ -23,17 +23,14 @@ */ static int -not_here(s) -char *s; +not_here(char *s) { croak("%s not implemented on this architecture", s); return -1; } static double -constant(name, arg) -char *name; -int arg; +constant(char *name, int arg) { errno = 0; switch (*name) { diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs index a423c88c70..ac1ca8c68d 100644 --- a/ext/GDBM_File/GDBM_File.xs +++ b/ext/GDBM_File/GDBM_File.xs @@ -23,8 +23,7 @@ typedef datum gdatum; typedef void (*FATALFUNC)(); static int -not_here(s) -char *s; +not_here(char *s) { croak("GDBM_File::%s not implemented on this architecture", s); return -1; @@ -41,9 +40,7 @@ char *s; #endif static double -constant(name, arg) -char *name; -int arg; +constant(char *name, int arg) { errno = 0; switch (*name) { diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs index e558d5c4e0..f226a79a9f 100644 --- a/ext/IO/IO.xs +++ b/ext/IO/IO.xs @@ -22,17 +22,14 @@ typedef FILE * OutputStream; #endif static int -not_here(s) -char *s; +not_here(char *s) { croak("%s not implemented on this architecture", s); return -1; } static bool -constant(name, pval) -char *name; -IV *pval; +constant(char *name, IV *pval) { switch (*name) { case '_': diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index c7d7ce3f96..b71e8b43cf 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -431,7 +431,7 @@ beyond the scope of the compartment. These ops are related to multi-threading. - lock specific + lock threadsv =item :default diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index 8307ade2ca..bed7099900 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -24,7 +24,7 @@ static SV *get_op_bitspec _((char *opname, STRLEN len, int fatal)); */ static void -op_names_init() +op_names_init(void) { int i; STRLEN len; @@ -58,10 +58,7 @@ op_names_init() */ static void -put_op_bitspec(optag, len, mask) - char *optag; - STRLEN len; - SV *mask; +put_op_bitspec(char *optag, STRLEN len, SV *mask) { SV **svp; verify_opset(mask,1); @@ -82,10 +79,7 @@ put_op_bitspec(optag, len, mask) */ static SV * -get_op_bitspec(opname, len, fatal) - char *opname; - STRLEN len; - int fatal; +get_op_bitspec(char *opname, STRLEN len, int fatal) { SV **svp; if (!len) @@ -108,8 +102,7 @@ get_op_bitspec(opname, len, fatal) static SV * -new_opset(old_opset) - SV *old_opset; +new_opset(SV *old_opset) { SV *opset; if (old_opset) { @@ -128,9 +121,7 @@ new_opset(old_opset) static int -verify_opset(opset, fatal) - SV *opset; - int fatal; +verify_opset(SV *opset, int fatal) { char *err = Nullch; if (!SvOK(opset)) err = "undefined"; @@ -144,11 +135,7 @@ verify_opset(opset, fatal) static void -set_opset_bits(bitmap, bitspec, on, opname) - char *bitmap; - SV *bitspec; - int on; - char *opname; +set_opset_bits(char *bitmap, SV *bitspec, int on, char *opname) { if (SvIOK(bitspec)) { int myopcode = SvIV(bitspec); @@ -182,8 +169,7 @@ set_opset_bits(bitmap, bitspec, on, opname) static void -opmask_add(opset) /* THE ONLY FUNCTION TO EDIT op_mask ITSELF */ - SV *opset; +opmask_add(SV *opset) /* THE ONLY FUNCTION TO EDIT op_mask ITSELF */ { int i,j; char *bitmask; @@ -210,9 +196,7 @@ opmask_add(opset) /* THE ONLY FUNCTION TO EDIT op_mask ITSELF */ } static void -opmask_addlocal(opset, op_mask_buf) /* Localise op_mask then opmask_add() */ - SV *opset; - char *op_mask_buf; +opmask_addlocal(SV *opset, char *op_mask_buf) /* Localise op_mask then opmask_add() */ { char *orig_op_mask = op_mask; SAVEPPTR(op_mask); diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 0e53a49183..57efb83a42 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -275,17 +275,14 @@ init_tm(ptm) /* see mktime, strftime and asctime */ #endif static int -not_here(s) -char *s; +not_here(char *s) { croak("POSIX::%s not implemented on this architecture", s); return -1; } static double -constant(name, arg) -char *name; -int arg; +constant(char *name, int arg) { errno = 0; switch (*name) { diff --git a/ext/SDBM_File/sdbm/hash.c b/ext/SDBM_File/sdbm/hash.c index eb585ac102..514bb5ed1a 100644 --- a/ext/SDBM_File/sdbm/hash.c +++ b/ext/SDBM_File/sdbm/hash.c @@ -17,9 +17,7 @@ * 65587 even better. */ long -sdbm_hash(str, len) -register char *str; -register int len; +sdbm_hash(register char *str, register int len) { register unsigned long n = 0; diff --git a/ext/SDBM_File/sdbm/pair.c b/ext/SDBM_File/sdbm/pair.c index 23bbfe9a67..e1a6ee6f43 100644 --- a/ext/SDBM_File/sdbm/pair.c +++ b/ext/SDBM_File/sdbm/pair.c @@ -44,9 +44,7 @@ static int seepair proto((char *, int, char *, int)); */ int -fitpair(pag, need) -char *pag; -int need; +fitpair(char *pag, int need) { register int n; register int off; @@ -63,10 +61,7 @@ int need; } void -putpair(pag, key, val) -char *pag; -datum key; -datum val; +putpair(char *pag, datum key, datum val) { register int n; register int off; @@ -92,9 +87,7 @@ datum val; } datum -getpair(pag, key) -char *pag; -datum key; +getpair(char *pag, datum key) { register int i; register int n; @@ -114,9 +107,7 @@ datum key; #ifdef SEEDUPS int -duppair(pag, key) -char *pag; -datum key; +duppair(char *pag, datum key) { register short *ino = (short *) pag; return ino[0] > 0 && seepair(pag, ino[0], key.dptr, key.dsize) > 0; @@ -124,9 +115,7 @@ datum key; #endif datum -getnkey(pag, num) -char *pag; -int num; +getnkey(char *pag, int num) { datum key; register int off; @@ -145,9 +134,7 @@ int num; } int -delpair(pag, key) -char *pag; -datum key; +delpair(char *pag, datum key) { register int n; register int i; @@ -219,11 +206,7 @@ datum key; * return 0 if not found. */ static int -seepair(pag, n, key, siz) -char *pag; -register int n; -register char *key; -register int siz; +seepair(char *pag, register int n, register char *key, register int siz) { register int i; register int off = PBLKSIZ; @@ -239,10 +222,7 @@ register int siz; } void -splpage(pag, new, sbit) -char *pag; -char *new; -long sbit; +splpage(char *pag, char *New, long int sbit) { datum key; datum val; @@ -254,7 +234,7 @@ long sbit; (void) memcpy(cur, pag, PBLKSIZ); (void) memset(pag, 0, PBLKSIZ); - (void) memset(new, 0, PBLKSIZ); + (void) memset(New, 0, PBLKSIZ); n = ino[0]; for (ino++; n > 0; ino += 2) { @@ -265,14 +245,14 @@ long sbit; /* * select the page pointer (by looking at sbit) and insert */ - (void) putpair((exhash(key) & sbit) ? new : pag, key, val); + (void) putpair((exhash(key) & sbit) ? New : pag, key, val); off = ino[1]; n -= 2; } debug(("%d split %d/%d\n", ((short *) cur)[0] / 2, - ((short *) new)[0] / 2, + ((short *) New)[0] / 2, ((short *) pag)[0] / 2)); } @@ -283,8 +263,7 @@ long sbit; * this could be made more rigorous. */ int -chkpage(pag) -char *pag; +chkpage(char *pag) { register int n; register int off; diff --git a/ext/SDBM_File/sdbm/sdbm.c b/ext/SDBM_File/sdbm/sdbm.c index c2d9cbd47d..7fbba0f00a 100644 --- a/ext/SDBM_File/sdbm/sdbm.c +++ b/ext/SDBM_File/sdbm/sdbm.c @@ -39,7 +39,7 @@ extern int errno; extern Malloc_t malloc proto((MEM_SIZE)); extern Free_t free proto((Malloc_t)); -extern Off_t lseek(); +extern Off_t lseek(int, off_t, int); #endif /* @@ -75,10 +75,7 @@ static long masks[] = { datum nullitem = {NULL, 0}; DBM * -sdbm_open(file, flags, mode) -register char *file; -register int flags; -register int mode; +sdbm_open(register char *file, register int flags, register int mode) { register DBM *db; register char *dirname; @@ -92,7 +89,7 @@ register int mode; */ n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2; - if ((dirname = malloc((unsigned) n)) == NULL) + if ((dirname = (char *) malloc((unsigned) n)) == NULL) return errno = ENOMEM, (DBM *) NULL; /* * build the file names @@ -107,11 +104,7 @@ register int mode; } DBM * -sdbm_prep(dirname, pagname, flags, mode) -char *dirname; -char *pagname; -int flags; -int mode; +sdbm_prep(char *dirname, char *pagname, int flags, int mode) { register DBM *db; struct stat dstat; @@ -170,8 +163,7 @@ int mode; } void -sdbm_close(db) -register DBM *db; +sdbm_close(register DBM *db) { if (db == NULL) errno = EINVAL; @@ -183,9 +175,7 @@ register DBM *db; } datum -sdbm_fetch(db, key) -register DBM *db; -datum key; +sdbm_fetch(register DBM *db, datum key) { if (db == NULL || bad(key)) return errno = EINVAL, nullitem; @@ -197,9 +187,7 @@ datum key; } int -sdbm_delete(db, key) -register DBM *db; -datum key; +sdbm_delete(register DBM *db, datum key) { if (db == NULL || bad(key)) return errno = EINVAL, -1; @@ -223,11 +211,7 @@ datum key; } int -sdbm_store(db, key, val, flags) -register DBM *db; -datum key; -datum val; -int flags; +sdbm_store(register DBM *db, datum key, datum val, int flags) { int need; register long hash; @@ -285,22 +269,19 @@ int flags; * giving up. */ static int -makroom(db, hash, need) -register DBM *db; -long hash; -int need; +makroom(register DBM *db, long int hash, int need) { long newp; char twin[PBLKSIZ]; char *pag = db->pagbuf; - char *new = twin; + char *New = twin; register int smax = SPLTMAX; do { /* * split the current page */ - (void) splpage(pag, new, db->hmask + 1); + (void) splpage(pag, New, db->hmask + 1); /* * address of the new page */ @@ -319,10 +300,10 @@ int need; || write(db->pagf, db->pagbuf, PBLKSIZ) < 0) return 0; db->pagbno = newp; - (void) memcpy(pag, new, PBLKSIZ); + (void) memcpy(pag, New, PBLKSIZ); } else if (lseek(db->pagf, OFF_PAG(newp), SEEK_SET) < 0 - || write(db->pagf, new, PBLKSIZ) < 0) + || write(db->pagf, New, PBLKSIZ) < 0) return 0; if (!setdbit(db, db->curbit)) @@ -363,8 +344,7 @@ int need; * deletions aren't taken into account. (ndbm bug) */ datum -sdbm_firstkey(db) -register DBM *db; +sdbm_firstkey(register DBM *db) { if (db == NULL) return errno = EINVAL, nullitem; @@ -382,8 +362,7 @@ register DBM *db; } datum -sdbm_nextkey(db) -register DBM *db; +sdbm_nextkey(register DBM *db) { if (db == NULL) return errno = EINVAL, nullitem; @@ -394,9 +373,7 @@ register DBM *db; * all important binary trie traversal */ static int -getpage(db, hash) -register DBM *db; -register long hash; +getpage(register DBM *db, register long int hash) { register int hbit; register long dbit; @@ -435,9 +412,7 @@ register long hash; } static int -getdbit(db, dbit) -register DBM *db; -register long dbit; +getdbit(register DBM *db, register long int dbit) { register long c; register long dirb; @@ -458,9 +433,7 @@ register long dbit; } static int -setdbit(db, dbit) -register DBM *db; -register long dbit; +setdbit(register DBM *db, register long int dbit) { register long c; register long dirb; @@ -494,8 +467,7 @@ register long dbit; * the page, try the next page in sequence */ static datum -getnext(db) -register DBM *db; +getnext(register DBM *db) { datum key; diff --git a/ext/SDBM_File/sdbm/sdbm.h b/ext/SDBM_File/sdbm/sdbm.h index fdd9165145..5bc629f402 100644 --- a/ext/SDBM_File/sdbm/sdbm.h +++ b/ext/SDBM_File/sdbm/sdbm.h @@ -49,7 +49,7 @@ typedef struct { extern datum nullitem; -#ifdef __STDC__ +#if defined(__STDC__) || defined(__cplusplus) #define proto(p) p #else #define proto(p) () @@ -183,6 +183,10 @@ extern long sdbm_hash proto((char *, int)); #ifdef I_MEMORY #include <memory.h> +#endif + +#ifdef __cplusplus +#define HAS_MEMCPY #endif #ifdef HAS_MEMCPY @@ -239,7 +243,9 @@ extern long sdbm_hash proto((char *, int)); # else # define memcmp Perl_my_memcmp # endif +#ifndef __cplusplus extern int memcmp proto((char*, char*, int)); +#endif # endif #endif /* HAS_MEMCMP */ @@ -262,3 +268,4 @@ extern long sdbm_hash proto((char *, int)); #endif #endif /* Include guard */ + diff --git a/ext/SDBM_File/sdbm/util.c b/ext/SDBM_File/sdbm/util.c index 4b03d89f09..16bd4ac9a5 100644 --- a/ext/SDBM_File/sdbm/util.c +++ b/ext/SDBM_File/sdbm/util.c @@ -6,9 +6,7 @@ #endif void -oops(s1, s2) -register char *s1; -register char *s2; +oops(register char *s1, register char *s2) { extern int errno, sys_nerr; extern char *sys_errlist[]; @@ -24,8 +22,7 @@ register char *s2; } int -okpage(pag) -char *pag; +okpage(char *pag) { register unsigned n; register off; diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index e3b282b0ad..d37208f012 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -47,9 +47,7 @@ * cannot distinguish between failure and a local broadcast address. */ static int -my_inet_aton(cp, addr) -register const char *cp; -struct in_addr *addr; +my_inet_aton(register const char *cp, struct in_addr *addr) { register U32 val; register int base; @@ -145,17 +143,14 @@ struct in_addr *addr; static int -not_here(s) -char *s; +not_here(char *s) { croak("Socket::%s not implemented on this architecture", s); return -1; } static double -constant(name, arg) -char *name; -int arg; +constant(char *name, int arg) { errno = 0; switch (*name) { diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index 7bbe0889e7..841b5698a1 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -82,7 +82,7 @@ threadstart(void *arg) #else Thread thr = (Thread) arg; LOGOP myop; - dSP; + djSP; I32 oldmark = TOPMARK; I32 oldscope = scopestack_ix; I32 retval; @@ -163,6 +163,8 @@ threadstart(void *arg) SvREFCNT_dec(thr->cvcache); SvREFCNT_dec(thr->magicals); SvREFCNT_dec(thr->specific); + SvREFCNT_dec(thr->errsv); + SvREFCNT_dec(thr->errhv); Safefree(markstack); Safefree(scopestack); Safefree(savestack); @@ -214,7 +216,6 @@ threadstart(void *arg) static SV * newthread (SV *startsv, AV *initargs, char *Class) { - dTHR; #ifdef USE_THREADS dSP; Thread savethread; diff --git a/ext/attrs/attrs.xs b/ext/attrs/attrs.xs index f34ac850ea..dae612adaf 100644 --- a/ext/attrs/attrs.xs +++ b/ext/attrs/attrs.xs @@ -3,8 +3,7 @@ #include "XSUB.h" static cv_flags_t -get_flag(attr) -char *attr; +get_flag(char *attr) { if (strnEQ(attr, "method", 6)) return CVf_METHOD; @@ -17,8 +16,8 @@ char *attr; MODULE = attrs PACKAGE = attrs void -import(class, ...) -char * class +import(Class, ...) +char * Class ALIAS: unimport = 1 PREINIT: @@ -22,8 +22,7 @@ EXT char rcsid[]; GV * -gv_AVadd(gv) -register GV *gv; +gv_AVadd(register GV *gv) { if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) croak("Bad symbol for array"); @@ -33,8 +32,7 @@ register GV *gv; } GV * -gv_HVadd(gv) -register GV *gv; +gv_HVadd(register GV *gv) { if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) croak("Bad symbol for hash"); @@ -44,8 +42,7 @@ register GV *gv; } GV * -gv_IOadd(gv) -register GV *gv; +gv_IOadd(register GV *gv) { if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) croak("Bad symbol for filehandle"); @@ -55,8 +52,7 @@ register GV *gv; } GV * -gv_fetchfile(name) -char *name; +gv_fetchfile(char *name) { dTHR; char smallbuf[256]; @@ -86,12 +82,7 @@ char *name; } void -gv_init(gv, stash, name, len, multi) -GV *gv; -HV *stash; -char *name; -STRLEN len; -int multi; +gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi) { dTHR; register GP *gp; @@ -114,9 +105,7 @@ int multi; } static void -gv_init_sv(gv, sv_type) -GV* gv; -I32 sv_type; +gv_init_sv(GV *gv, I32 sv_type) { switch (sv_type) { case SVt_PVIO: @@ -132,11 +121,7 @@ I32 sv_type; } GV * -gv_fetchmeth(stash, name, len, level) -HV* stash; -char* name; -STRLEN len; -I32 level; +gv_fetchmeth(HV *stash, char *name, STRLEN len, I32 level) { AV* av; GV* topgv; @@ -248,18 +233,13 @@ I32 level; } GV * -gv_fetchmethod(stash, name) -HV* stash; -char* name; +gv_fetchmethod(HV *stash, char *name) { return gv_fetchmethod_autoload(stash, name, TRUE); } GV * -gv_fetchmethod_autoload(stash, name, autoload) -HV* stash; -char* name; -I32 autoload; +gv_fetchmethod_autoload(HV *stash, char *name, I32 autoload) { dTHR; register char *nend; @@ -320,11 +300,7 @@ I32 autoload; } GV* -gv_autoload4(stash, name, len, method) -HV* stash; -char* name; -STRLEN len; -I32 method; +gv_autoload4(HV *stash, char *name, STRLEN len, I32 method) { static char autoload[] = "AUTOLOAD"; static STRLEN autolen = 8; @@ -367,18 +343,13 @@ I32 method; } HV* -gv_stashpv(name,create) -char *name; -I32 create; +gv_stashpv(char *name, I32 create) { return gv_stashpvn(name, strlen(name), create); } HV* -gv_stashpvn(name,namelen,create) -char *name; -U32 namelen; -I32 create; +gv_stashpvn(char *name, U32 namelen, I32 create) { char smallbuf[256]; char *tmpbuf; @@ -407,9 +378,7 @@ I32 create; } HV* -gv_stashsv(sv,create) -SV *sv; -I32 create; +gv_stashsv(SV *sv, I32 create) { register char *ptr; STRLEN len; @@ -419,10 +388,7 @@ I32 create; GV * -gv_fetchpv(nambeg,add,sv_type) -char *nambeg; -I32 add; -I32 sv_type; +gv_fetchpv(char *nambeg, I32 add, I32 sv_type) { dTHR; register char *name = nambeg; @@ -777,10 +743,7 @@ I32 sv_type; } void -gv_fullname3(sv, gv, prefix) -SV *sv; -GV *gv; -char *prefix; +gv_fullname3(SV *sv, GV *gv, char *prefix) { HV *hv = GvSTASH(gv); if (!hv) { @@ -794,10 +757,7 @@ char *prefix; } void -gv_efullname3(sv, gv, prefix) -SV *sv; -GV *gv; -char *prefix; +gv_efullname3(SV *sv, GV *gv, char *prefix) { GV *egv = GvEGV(gv); if (!egv) @@ -807,24 +767,20 @@ char *prefix; /* XXX compatibility with versions <= 5.003. */ void -gv_fullname(sv,gv) -SV *sv; -GV *gv; +gv_fullname(SV *sv, GV *gv) { gv_fullname3(sv, gv, sv == (SV*)gv ? "*" : ""); } /* XXX compatibility with versions <= 5.003. */ void -gv_efullname(sv,gv) -SV *sv; -GV *gv; +gv_efullname(SV *sv, GV *gv) { gv_efullname3(sv, gv, sv == (SV*)gv ? "*" : ""); } IO * -newIO() +newIO(void) { dTHR; IO *io; @@ -842,8 +798,7 @@ newIO() } void -gv_check(stash) -HV* stash; +gv_check(HV *stash) { dTHR; register HE *entry; @@ -879,8 +834,7 @@ HV* stash; } GV * -newGVgen(pack) -char *pack; +newGVgen(char *pack) { return gv_fetchpv(form("%s::_GEN_%ld", pack, (long)gensym++), TRUE, SVt_PVGV); @@ -889,8 +843,7 @@ char *pack; /* hopefully this is only called on local symbol table entries */ GP* -gp_ref(gp) -GP* gp; +gp_ref(GP *gp) { gp->gp_refcnt++; if (gp->gp_cv) { @@ -909,8 +862,7 @@ GP* gp; } void -gp_free(gv) -GV* gv; +gp_free(GV *gv) { GP* gp; CV* cv; @@ -970,8 +922,7 @@ register GV *gv; /* Updates and caches the CV's */ bool -Gv_AMupdate(stash) -HV* stash; +Gv_AMupdate(HV *stash) { dTHR; GV** gvp; @@ -979,7 +930,7 @@ HV* stash; GV* gv; CV* cv; MAGIC* mg=mg_find((SV*)stash,'c'); - AMT *amtp=mg ? (AMT*)mg->mg_ptr: NULL; + AMT *amtp = (mg) ? (AMT*)mg->mg_ptr: (AMT *) NULL; AMT amt; if (mg && amtp->was_ok_am == amagic_generation @@ -1131,11 +1082,7 @@ HV* stash; * advised to call SPAGAIN macro in your code after call */ SV* -amagic_call(left,right,method,flags) -SV* left; -SV* right; -int method; -int flags; +amagic_call(SV *left, SV *right, int method, int flags) { dTHR; MAGIC *mg; @@ -1149,7 +1096,7 @@ int flags; && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(left))),'c')) && (ocvp = cvp = (AMT_AMAGIC((AMT*)mg->mg_ptr) ? (oamtp = amtp = (AMT*)mg->mg_ptr)->table - : NULL)) + : (CV **) NULL)) && ((cv = cvp[off=method+assignshift]) || (assign && amtp->fallback > AMGfallNEVER && /* fallback to * usual method */ @@ -1242,7 +1189,7 @@ int flags; && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(right))),'c')) && (cvp = (AMT_AMAGIC((AMT*)mg->mg_ptr) ? (amtp = (AMT*)mg->mg_ptr)->table - : NULL)) + : (CV **) NULL)) && (cv = cvp[off=method])) { /* Method for right * argument found */ lr=1; @@ -1337,7 +1284,6 @@ int flags; || inc_dec_ass) RvDEEPCP(left); } { - dTHR; dSP; BINOP myop; SV* res; @@ -1415,3 +1361,4 @@ int flags; } } #endif /* OVERLOAD */ + @@ -17,10 +17,10 @@ static void hsplit _((HV *hv)); static void hfreeentries _((HV *hv)); -static HE* more_he(); +static HE* more_he(void); static HE* -new_he() +new_he(void) { HE* he; if (he_root) { @@ -32,15 +32,14 @@ new_he() } static void -del_he(p) -HE* p; +del_he(HE *p) { HeNEXT(p) = (HE*)he_root; he_root = p; } static HE* -more_he() +more_he(void) { register HE* he; register HE* heend; @@ -56,10 +55,7 @@ more_he() } static HEK * -save_hek(str, len, hash) -char *str; -I32 len; -U32 hash; +save_hek(char *str, I32 len, U32 hash) { char *k; register HEK *hek; @@ -74,8 +70,7 @@ U32 hash; } void -unshare_hek(hek) -HEK *hek; +unshare_hek(HEK *hek) { unsharepvn(HEK_KEY(hek),HEK_LEN(hek),HEK_HASH(hek)); } @@ -84,11 +79,7 @@ HEK *hek; * contains an SV* */ SV** -hv_fetch(hv,key,klen,lval) -HV *hv; -char *key; -U32 klen; -I32 lval; +hv_fetch(HV *hv, char *key, U32 klen, I32 lval) { register XPVHV* xhv; register U32 hash; @@ -153,11 +144,7 @@ I32 lval; /* returns a HE * structure with the all fields set */ /* note that hent_val will be a mortal sv for MAGICAL hashes */ HE * -hv_fetch_ent(hv,keysv,lval,hash) -HV *hv; -SV *keysv; -I32 lval; -register U32 hash; +hv_fetch_ent(HV *hv, SV *keysv, I32 lval, register U32 hash) { register XPVHV* xhv; register char *key; @@ -230,12 +217,7 @@ register U32 hash; } SV** -hv_store(hv,key,klen,val,hash) -HV *hv; -char *key; -U32 klen; -SV *val; -register U32 hash; +hv_store(HV *hv, char *key, U32 klen, SV *val, register U32 hash) { register XPVHV* xhv; register I32 i; @@ -298,11 +280,7 @@ register U32 hash; } HE * -hv_store_ent(hv,keysv,val,hash) -HV *hv; -SV *keysv; -SV *val; -register U32 hash; +hv_store_ent(HV *hv, SV *keysv, SV *val, register U32 hash) { register XPVHV* xhv; register char *key; @@ -376,11 +354,7 @@ register U32 hash; } SV * -hv_delete(hv,key,klen,flags) -HV *hv; -char *key; -U32 klen; -I32 flags; +hv_delete(HV *hv, char *key, U32 klen, I32 flags) { register XPVHV* xhv; register I32 i; @@ -436,11 +410,7 @@ I32 flags; } SV * -hv_delete_ent(hv,keysv,flags,hash) -HV *hv; -SV *keysv; -I32 flags; -U32 hash; +hv_delete_ent(HV *hv, SV *keysv, I32 flags, U32 hash) { register XPVHV* xhv; register I32 i; @@ -498,10 +468,7 @@ U32 hash; } bool -hv_exists(hv,key,klen) -HV *hv; -char *key; -U32 klen; +hv_exists(HV *hv, char *key, U32 klen) { register XPVHV* xhv; register U32 hash; @@ -542,10 +509,7 @@ U32 klen; bool -hv_exists_ent(hv,keysv,hash) -HV *hv; -SV *keysv; -U32 hash; +hv_exists_ent(HV *hv, SV *keysv, U32 hash) { register XPVHV* xhv; register char *key; @@ -589,8 +553,7 @@ U32 hash; } static void -hsplit(hv) -HV *hv; +hsplit(HV *hv) { register XPVHV* xhv = (XPVHV*)SvANY(hv); I32 oldsize = (I32) xhv->xhv_max + 1; /* sic(k) */ @@ -654,9 +617,7 @@ HV *hv; } void -hv_ksplit(hv, newmax) -HV *hv; -IV newmax; +hv_ksplit(HV *hv, IV newmax) { register XPVHV* xhv = (XPVHV*)SvANY(hv); I32 oldsize = (I32) xhv->xhv_max + 1; /* sic(k) */ @@ -732,7 +693,7 @@ IV newmax; } HV * -newHV() +newHV(void) { register HV *hv; register XPVHV* xhv; @@ -753,9 +714,7 @@ newHV() } void -hv_free_ent(hv, entry) -HV *hv; -register HE *entry; +hv_free_ent(HV *hv, register HE *entry) { if (!entry) return; @@ -774,9 +733,7 @@ register HE *entry; } void -hv_delayfree_ent(hv, entry) -HV *hv; -register HE *entry; +hv_delayfree_ent(HV *hv, register HE *entry) { if (!entry) return; @@ -795,8 +752,7 @@ register HE *entry; } void -hv_clear(hv) -HV *hv; +hv_clear(HV *hv) { register XPVHV* xhv; if (!hv) @@ -813,8 +769,7 @@ HV *hv; } static void -hfreeentries(hv) -HV *hv; +hfreeentries(HV *hv) { register HE **array; register HE *entry; @@ -847,8 +802,7 @@ HV *hv; } void -hv_undef(hv) -HV *hv; +hv_undef(HV *hv) { register XPVHV* xhv; if (!hv) @@ -870,8 +824,7 @@ HV *hv; } I32 -hv_iterinit(hv) -HV *hv; +hv_iterinit(HV *hv) { register XPVHV* xhv; HE *entry; @@ -894,8 +847,7 @@ HV *hv; } HE * -hv_iternext(hv) -HV *hv; +hv_iternext(HV *hv) { register XPVHV* xhv; register HE *entry; @@ -961,9 +913,7 @@ HV *hv; } char * -hv_iterkey(entry,retlen) -register HE *entry; -I32 *retlen; +hv_iterkey(register HE *entry, I32 *retlen) { if (HeKLEN(entry) == HEf_SVKEY) { STRLEN len; @@ -979,8 +929,7 @@ I32 *retlen; /* unlike hv_iterval(), this always returns a mortal copy of the key */ SV * -hv_iterkeysv(entry) -register HE *entry; +hv_iterkeysv(register HE *entry) { if (HeKLEN(entry) == HEf_SVKEY) return sv_mortalcopy(HeKEY_sv(entry)); @@ -990,9 +939,7 @@ register HE *entry; } SV * -hv_iterval(hv,entry) -HV *hv; -register HE *entry; +hv_iterval(HV *hv, register HE *entry) { if (SvRMAGICAL(hv)) { if (mg_find((SV*)hv,'P')) { @@ -1007,10 +954,7 @@ register HE *entry; } SV * -hv_iternextsv(hv, key, retlen) - HV *hv; - char **key; - I32 *retlen; +hv_iternextsv(HV *hv, char **key, I32 *retlen) { HE *he; if ( (he = hv_iternext(hv)) == NULL) @@ -1020,19 +964,13 @@ hv_iternextsv(hv, key, retlen) } void -hv_magic(hv, gv, how) -HV* hv; -GV* gv; -int how; +hv_magic(HV *hv, GV *gv, int how) { sv_magic((SV*)hv, (SV*)gv, how, Nullch, 0); } char* -sharepvn(sv, len, hash) -char* sv; -I32 len; -U32 hash; +sharepvn(char *sv, I32 len, U32 hash) { return HEK_KEY(share_hek(sv, len, hash)); } @@ -1041,10 +979,7 @@ U32 hash; * len and hash must both be valid for str. */ void -unsharepvn(str, len, hash) -char* str; -I32 len; -U32 hash; +unsharepvn(char *str, I32 len, U32 hash) { register XPVHV* xhv; register HE *entry; @@ -1088,10 +1023,7 @@ U32 hash; * len and hash must both be valid for str. */ HEK * -share_hek(str, len, hash) -char *str; -I32 len; -register U32 hash; +share_hek(char *str, I32 len, register U32 hash) { register XPVHV* xhv; register HE *entry; diff --git a/interp.sym b/interp.sym index 9235ff201e..f50711b802 100644 --- a/interp.sym +++ b/interp.sym @@ -47,8 +47,7 @@ e_fp e_tmpname endav envgv -errhv -errsv +errgv eval_root eval_start fdpid @@ -237,8 +237,14 @@ static union overhead *nextf[NBUCKETS]; #ifdef USE_PERL_SBRK #define sbrk(a) Perl_sbrk(a) char * Perl_sbrk _((int size)); +#else +#ifdef DONT_DECLARE_STD +#ifdef I_UNISTD +#include <unistd.h> +#endif #else -extern char *sbrk(); +extern char *sbrk(int); +#endif #endif #ifdef DEBUGGING_MSTATS @@ -255,8 +261,7 @@ static u_int start_slack; #ifdef DEBUGGING #define ASSERT(p) if (!(p)) botch(STRINGIFY(p)); else static void -botch(s) - char *s; +botch(char *s) { PerlIO_printf(PerlIO_stderr(), "assertion botched: %s\n", s); abort(); @@ -266,8 +271,7 @@ botch(s) #endif Malloc_t -malloc(nbytes) - register MEM_SIZE nbytes; +malloc(register size_t nbytes) { register union overhead *p; register int bucket = 0; @@ -368,8 +372,7 @@ malloc(nbytes) * Allocate more memory to the indicated bucket. */ static void -morecore(bucket) - register int bucket; +morecore(register int bucket) { register union overhead *ovp; register int rnu; /* 2^rnu bytes will be requested */ @@ -481,8 +484,7 @@ morecore(bucket) } Free_t -free(mp) - Malloc_t mp; +free(void *mp) { register MEM_SIZE size; register union overhead *ovp; @@ -546,9 +548,7 @@ free(mp) int reall_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ Malloc_t -realloc(mp, nbytes) - Malloc_t mp; - MEM_SIZE nbytes; +realloc(void *mp, size_t nbytes) { register MEM_SIZE onb; union overhead *ovp; @@ -672,9 +672,7 @@ realloc(mp, nbytes) * Return bucket number, or -1 if not found. */ static int -findbucket(freep, srchlen) - union overhead *freep; - int srchlen; +findbucket(union overhead *freep, int srchlen) { register union overhead *p; register int i, j; @@ -691,9 +689,7 @@ findbucket(freep, srchlen) } Malloc_t -calloc(elements, size) - register MEM_SIZE elements; - register MEM_SIZE size; +calloc(register size_t elements, register size_t size) { long sz = elements * size; Malloc_t p = malloc(sz); @@ -713,8 +709,7 @@ calloc(elements, size) * frees for each size category. */ void -dump_mstats(s) - char *s; +dump_mstats(char *s) { register int i, j; register union overhead *p; @@ -746,8 +741,7 @@ dump_mstats(s) } #else void -dump_mstats(s) - char *s; +dump_mstats(char *s) { } #endif @@ -39,9 +39,7 @@ typedef struct magic_state MGS; static void restore_magic _((void *p)); static void -save_magic(mgs, sv) -MGS* mgs; -SV* sv; +save_magic(MGS *mgs, SV *sv) { assert(SvMAGICAL(sv)); @@ -55,8 +53,7 @@ SV* sv; } static void -restore_magic(p) -void* p; +restore_magic(void *p) { MGS* mgs = (MGS*)p; SV* sv = mgs->mgs_sv; @@ -74,8 +71,7 @@ void* p; void -mg_magical(sv) -SV* sv; +mg_magical(SV *sv) { MAGIC* mg; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { @@ -92,8 +88,7 @@ SV* sv; } int -mg_get(sv) -SV* sv; +mg_get(SV *sv) { MGS mgs; MAGIC* mg; @@ -127,8 +122,7 @@ SV* sv; } int -mg_set(sv) -SV* sv; +mg_set(SV *sv) { MGS mgs; MAGIC* mg; @@ -153,8 +147,7 @@ SV* sv; } U32 -mg_len(sv) -SV* sv; +mg_len(SV *sv) { MAGIC* mg; char *junk; @@ -179,8 +172,7 @@ SV* sv; } int -mg_clear(sv) -SV* sv; +mg_clear(SV *sv) { MGS mgs; MAGIC* mg; @@ -201,9 +193,7 @@ SV* sv; } MAGIC* -mg_find(sv, type) -SV* sv; -int type; +mg_find(SV *sv, int type) { MAGIC* mg; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { @@ -214,11 +204,7 @@ int type; } int -mg_copy(sv, nsv, key, klen) -SV* sv; -SV* nsv; -char *key; -I32 klen; +mg_copy(SV *sv, SV *nsv, char *key, I32 klen) { int count = 0; MAGIC* mg; @@ -232,8 +218,7 @@ I32 klen; } int -mg_free(sv) -SV* sv; +mg_free(SV *sv) { MAGIC* mg; MAGIC* moremagic; @@ -260,9 +245,7 @@ SV* sv; #endif U32 -magic_len(sv, mg) -SV *sv; -MAGIC *mg; +magic_len(SV *sv, MAGIC *mg) { dTHR; register I32 paren; @@ -326,9 +309,7 @@ MAGIC *mg; } int -magic_get(sv, mg) -SV *sv; -MAGIC *mg; +magic_get(SV *sv, MAGIC *mg) { dTHR; register I32 paren; @@ -580,7 +561,7 @@ MAGIC *mg; break; #ifdef USE_THREADS case '@': - sv_setsv(sv, errsv); + sv_setsv(sv, thr->errsv); break; #endif /* USE_THREADS */ } @@ -588,9 +569,7 @@ MAGIC *mg; } int -magic_getuvar(sv, mg) -SV *sv; -MAGIC *mg; +magic_getuvar(SV *sv, MAGIC *mg) { struct ufuncs *uf = (struct ufuncs *)mg->mg_ptr; @@ -600,9 +579,7 @@ MAGIC *mg; } int -magic_setenv(sv,mg) -SV* sv; -MAGIC* mg; +magic_setenv(SV *sv, MAGIC *mg) { register char *s; char *ptr; @@ -678,18 +655,14 @@ MAGIC* mg; } int -magic_clearenv(sv,mg) -SV* sv; -MAGIC* mg; +magic_clearenv(SV *sv, MAGIC *mg) { my_setenv(MgPV(mg,na),Nullch); return 0; } int -magic_set_all_env(sv,mg) -SV* sv; -MAGIC* mg; +magic_set_all_env(SV *sv, MAGIC *mg) { #if defined(VMS) die("Can't make list assignment to %%ENV on this system"); @@ -710,9 +683,7 @@ MAGIC* mg; } int -magic_clear_all_env(sv,mg) -SV* sv; -MAGIC* mg; +magic_clear_all_env(SV *sv, MAGIC *mg) { #if defined(VMS) die("Can't make list assignment to %%ENV on this system"); @@ -749,9 +720,7 @@ MAGIC* mg; } int -magic_getsig(sv,mg) -SV* sv; -MAGIC* mg; +magic_getsig(SV *sv, MAGIC *mg) { I32 i; /* Are we fetching a signal entry? */ @@ -774,9 +743,7 @@ MAGIC* mg; return 0; } int -magic_clearsig(sv,mg) -SV* sv; -MAGIC* mg; +magic_clearsig(SV *sv, MAGIC *mg) { I32 i; /* Are we clearing a signal entry? */ @@ -795,9 +762,7 @@ MAGIC* mg; } int -magic_setsig(sv,mg) -SV* sv; -MAGIC* mg; +magic_setsig(SV *sv, MAGIC *mg) { dTHR; register char *s; @@ -871,9 +836,7 @@ MAGIC* mg; } int -magic_setisa(sv,mg) -SV* sv; -MAGIC* mg; +magic_setisa(SV *sv, MAGIC *mg) { sub_generation++; return 0; @@ -882,9 +845,7 @@ MAGIC* mg; #ifdef OVERLOAD int -magic_setamagic(sv,mg) -SV* sv; -MAGIC* mg; +magic_setamagic(SV *sv, MAGIC *mg) { /* HV_badAMAGIC_on(Sv_STASH(sv)); */ amagic_generation++; @@ -894,9 +855,7 @@ MAGIC* mg; #endif /* OVERLOAD */ int -magic_setnkeys(sv,mg) -SV* sv; -MAGIC* mg; +magic_setnkeys(SV *sv, MAGIC *mg) { if (LvTARG(sv)) { hv_ksplit((HV*)LvTARG(sv), SvIV(sv)); @@ -906,12 +865,8 @@ MAGIC* mg; } static int -magic_methpack(sv,mg,meth) -SV* sv; -MAGIC* mg; -char *meth; +magic_methpack(SV *sv, MAGIC *mg, char *meth) { - dTHR; dSP; ENTER; @@ -938,9 +893,7 @@ char *meth; } int -magic_getpack(sv,mg) -SV* sv; -MAGIC* mg; +magic_getpack(SV *sv, MAGIC *mg) { magic_methpack(sv,mg,"FETCH"); if (mg->mg_ptr) @@ -949,11 +902,8 @@ MAGIC* mg; } int -magic_setpack(sv,mg) -SV* sv; -MAGIC* mg; +magic_setpack(SV *sv, MAGIC *mg) { - dTHR; dSP; PUSHMARK(sp); @@ -976,18 +926,13 @@ MAGIC* mg; } int -magic_clearpack(sv,mg) -SV* sv; -MAGIC* mg; +magic_clearpack(SV *sv, MAGIC *mg) { return magic_methpack(sv,mg,"DELETE"); } -int magic_wipepack(sv,mg) -SV* sv; -MAGIC* mg; +int magic_wipepack(SV *sv, MAGIC *mg) { - dTHR; dSP; PUSHMARK(sp); @@ -1000,12 +945,8 @@ MAGIC* mg; } int -magic_nextpack(sv,mg,key) -SV* sv; -MAGIC* mg; -SV* key; +magic_nextpack(SV *sv, MAGIC *mg, SV *key) { - dTHR; dSP; char *meth = SvOK(key) ? "NEXTKEY" : "FIRSTKEY"; @@ -1027,17 +968,13 @@ SV* key; } int -magic_existspack(sv,mg) -SV* sv; -MAGIC* mg; +magic_existspack(SV *sv, MAGIC *mg) { return magic_methpack(sv,mg,"EXISTS"); } int -magic_setdbline(sv,mg) -SV* sv; -MAGIC* mg; +magic_setdbline(SV *sv, MAGIC *mg) { dTHR; OP *o; @@ -1057,9 +994,7 @@ MAGIC* mg; } int -magic_getarylen(sv,mg) -SV* sv; -MAGIC* mg; +magic_getarylen(SV *sv, MAGIC *mg) { dTHR; sv_setiv(sv, AvFILL((AV*)mg->mg_obj) + curcop->cop_arybase); @@ -1067,9 +1002,7 @@ MAGIC* mg; } int -magic_setarylen(sv,mg) -SV* sv; -MAGIC* mg; +magic_setarylen(SV *sv, MAGIC *mg) { dTHR; av_fill((AV*)mg->mg_obj, SvIV(sv) - curcop->cop_arybase); @@ -1077,9 +1010,7 @@ MAGIC* mg; } int -magic_getpos(sv,mg) -SV* sv; -MAGIC* mg; +magic_getpos(SV *sv, MAGIC *mg) { SV* lsv = LvTARG(sv); @@ -1096,9 +1027,7 @@ MAGIC* mg; } int -magic_setpos(sv,mg) -SV* sv; -MAGIC* mg; +magic_setpos(SV *sv, MAGIC *mg) { SV* lsv = LvTARG(sv); SSize_t pos; @@ -1135,9 +1064,7 @@ MAGIC* mg; } int -magic_getglob(sv,mg) -SV* sv; -MAGIC* mg; +magic_getglob(SV *sv, MAGIC *mg) { if (SvFAKE(sv)) { /* FAKE globs can get coerced */ SvFAKE_off(sv); @@ -1150,9 +1077,7 @@ MAGIC* mg; } int -magic_setglob(sv,mg) -SV* sv; -MAGIC* mg; +magic_setglob(SV *sv, MAGIC *mg) { register char *s; GV* gv; @@ -1172,9 +1097,7 @@ MAGIC* mg; } int -magic_setsubstr(sv,mg) -SV* sv; -MAGIC* mg; +magic_setsubstr(SV *sv, MAGIC *mg) { STRLEN len; char *tmps = SvPV(sv,len); @@ -1183,9 +1106,7 @@ MAGIC* mg; } int -magic_gettaint(sv,mg) -SV* sv; -MAGIC* mg; +magic_gettaint(SV *sv, MAGIC *mg) { dTHR; TAINT_IF((mg->mg_len & 1) || @@ -1194,9 +1115,7 @@ MAGIC* mg; } int -magic_settaint(sv,mg) -SV* sv; -MAGIC* mg; +magic_settaint(SV *sv, MAGIC *mg) { dTHR; if (localizing) { @@ -1213,18 +1132,14 @@ MAGIC* mg; } int -magic_setvec(sv,mg) -SV* sv; -MAGIC* mg; +magic_setvec(SV *sv, MAGIC *mg) { do_vecset(sv); /* XXX slurp this routine */ return 0; } int -magic_getdefelem(sv,mg) -SV* sv; -MAGIC* mg; +magic_getdefelem(SV *sv, MAGIC *mg) { SV *targ = Nullsv; if (LvTARGLEN(sv)) { @@ -1257,9 +1172,7 @@ MAGIC* mg; } int -magic_setdefelem(sv,mg) -SV* sv; -MAGIC* mg; +magic_setdefelem(SV *sv, MAGIC *mg) { if (LvTARGLEN(sv)) vivify_defelem(sv); @@ -1271,17 +1184,14 @@ MAGIC* mg; } int -magic_freedefelem(sv,mg) -SV* sv; -MAGIC* mg; +magic_freedefelem(SV *sv, MAGIC *mg) { SvREFCNT_dec(LvTARG(sv)); return 0; } void -vivify_defelem(sv) -SV* sv; +vivify_defelem(SV *sv) { dTHR; /* just for SvREFCNT_inc and SvREFCNT_dec*/ MAGIC* mg; @@ -1315,9 +1225,7 @@ SV* sv; } int -magic_setmglob(sv,mg) -SV* sv; -MAGIC* mg; +magic_setmglob(SV *sv, MAGIC *mg) { mg->mg_len = -1; SvSCREAM_off(sv); @@ -1325,9 +1233,7 @@ MAGIC* mg; } int -magic_setbm(sv,mg) -SV* sv; -MAGIC* mg; +magic_setbm(SV *sv, MAGIC *mg) { sv_unmagic(sv, 'B'); SvVALID_off(sv); @@ -1335,9 +1241,7 @@ MAGIC* mg; } int -magic_setfm(sv,mg) -SV* sv; -MAGIC* mg; +magic_setfm(SV *sv, MAGIC *mg) { sv_unmagic(sv, 'f'); SvCOMPILED_off(sv); @@ -1345,9 +1249,7 @@ MAGIC* mg; } int -magic_setuvar(sv,mg) -SV* sv; -MAGIC* mg; +magic_setuvar(SV *sv, MAGIC *mg) { struct ufuncs *uf = (struct ufuncs *)mg->mg_ptr; @@ -1358,9 +1260,7 @@ MAGIC* mg; #ifdef USE_LOCALE_COLLATE int -magic_setcollxfrm(sv,mg) -SV* sv; -MAGIC* mg; +magic_setcollxfrm(SV *sv, MAGIC *mg) { /* * René Descartes said "I think not." @@ -1376,9 +1276,7 @@ MAGIC* mg; #endif /* USE_LOCALE_COLLATE */ int -magic_set(sv,mg) -SV* sv; -MAGIC* mg; +magic_set(SV *sv, MAGIC *mg) { dTHR; register char *s; @@ -1719,7 +1617,7 @@ MAGIC* mg; break; #ifdef USE_THREADS case '@': - sv_setsv(errsv, sv); + sv_setsv(thr->errsv, sv); break; #endif /* USE_THREADS */ } @@ -1728,9 +1626,7 @@ MAGIC* mg; #ifdef USE_THREADS int -magic_mutexfree(sv, mg) -SV *sv; -MAGIC *mg; +magic_mutexfree(SV *sv, MAGIC *mg) { dTHR; DEBUG_L(PerlIO_printf(PerlIO_stderr(), "0x%lx: magic_mutexfree 0x%lx\n", @@ -1745,8 +1641,7 @@ MAGIC *mg; #endif /* USE_THREADS */ I32 -whichsig(sig) -char *sig; +whichsig(char *sig) { register char **sigv; @@ -1767,8 +1662,7 @@ char *sig; static SV* sig_sv; static void -unwind_handler_stack(p) - void *p; +unwind_handler_stack(void *p) { dTHR; U32 flags = *(U32*)p; @@ -1781,10 +1675,8 @@ unwind_handler_stack(p) } Signal_t -sighandler(sig) -int sig; +sighandler(int sig) { - dTHR; dSP; GV *gv; HV *st; @@ -1885,3 +1777,5 @@ int sig; Xpv = tXpv; return; } + + diff --git a/miniperlmain.c b/miniperlmain.c index 402f2ef065..7522ae28cf 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -6,15 +6,12 @@ #pragma runopts(HEAP(1M,32K,ANYWHERE,KEEP,8K,4K)) #endif -#ifdef __cplusplus -extern "C" { -#endif #include "EXTERN.h" #include "perl.h" +#undef EXTERN_C #ifdef __cplusplus -} # define EXTERN_C extern "C" #else # define EXTERN_C extern @@ -58,6 +55,7 @@ char **env; PERL_SYS_TERM(); exit( exitstatus ); + return exitstatus; } /* Register any extra external extensions */ @@ -65,7 +63,7 @@ char **env; /* Do not delete this line--writemain depends on it */ static void -xs_init() +xs_init(void) { dXSUB_SYS; } @@ -42,8 +42,7 @@ static PADOFFSET pad_findlex _((char* name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)); static char* -gv_ename(gv) -GV* gv; +gv_ename(GV *gv) { SV* tmpsv = sv_newmortal(); gv_efullname3(tmpsv, gv, Nullch); @@ -51,8 +50,7 @@ GV* gv; } static OP * -no_fh_allowed(o) -OP *o; +no_fh_allowed(OP *o) { yyerror(form("Missing comma after first argument to %s function", op_desc[o->op_type])); @@ -60,37 +58,28 @@ OP *o; } static OP * -too_few_arguments(o, name) -OP* o; -char* name; +too_few_arguments(OP *o, char *name) { yyerror(form("Not enough arguments for %s", name)); return o; } static OP * -too_many_arguments(o, name) -OP *o; -char* name; +too_many_arguments(OP *o, char *name) { yyerror(form("Too many arguments for %s", name)); return o; } static void -bad_type(n, t, name, kid) -I32 n; -char *t; -char *name; -OP *kid; +bad_type(I32 n, char *t, char *name, OP *kid) { yyerror(form("Type of arg %d to %s must be %s (not %s)", (int)n, name, t, op_desc[kid->op_type])); } void -assertref(o) -OP *o; +assertref(OP *o) { int type = o->op_type; if (type != OP_AELEM && type != OP_HELEM) { @@ -104,8 +93,7 @@ OP *o; /* "register" allocation */ PADOFFSET -pad_allocmy(name) -char *name; +pad_allocmy(char *name) { dTHR; PADOFFSET off; @@ -295,8 +283,7 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix) } PADOFFSET -pad_findmy(name) -char *name; +pad_findmy(char *name) { dTHR; I32 off; @@ -345,8 +332,7 @@ char *name; } void -pad_leavemy(fill) -I32 fill; +pad_leavemy(I32 fill) { I32 off; SV **svp = AvARRAY(comppad_name); @@ -365,9 +351,7 @@ I32 fill; } PADOFFSET -pad_alloc(optype,tmptype) -I32 optype; -U32 tmptype; +pad_alloc(I32 optype, U32 tmptype) { dTHR; SV *sv; @@ -488,7 +472,7 @@ pad_swipe(PADOFFSET po) } void -pad_reset() +pad_reset(void) { dTHR; register I32 po; @@ -514,8 +498,7 @@ pad_reset() #ifdef USE_THREADS /* find_thread_magical is not reentrant */ PADOFFSET -find_thread_magical(name) -char *name; +find_thread_magical(char *name) { dTHR; char *p; @@ -553,8 +536,7 @@ char *name; /* Destructor */ void -op_free(o) -OP *o; +op_free(OP *o) { register OP *kid, *nextkid; @@ -576,7 +558,7 @@ OP *o; o->op_targ = 0; /* Was holding hints. */ break; #ifdef USE_THREADS - case OP_SPECIFIC: + case OP_THREADSV: o->op_targ = 0; /* Was holding index into thr->magicals AV. */ break; #endif /* USE_THREADS */ @@ -624,8 +606,7 @@ OP *o; } static void -null(o) -OP* o; +null(OP *o) { if (o->op_type != OP_NULL && o->op_targ > 0) pad_free(o->op_targ); @@ -639,8 +620,7 @@ OP* o; #define LINKLIST(o) ((o)->op_next ? (o)->op_next : linklist((OP*)o)) OP * -linklist(o) -OP *o; +linklist(OP *o) { register OP *kid; @@ -664,8 +644,7 @@ OP *o; } OP * -scalarkids(o) -OP *o; +scalarkids(OP *o) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -676,8 +655,7 @@ OP *o; } static OP * -scalarboolean(o) -OP *o; +scalarboolean(OP *o) { if (dowarn && o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST) { @@ -693,8 +671,7 @@ OP *o; } OP * -scalar(o) -OP *o; +scalar(OP *o) { OP *kid; @@ -760,8 +737,7 @@ OP *o; } OP * -scalarvoid(o) -OP *o; +scalarvoid(OP *o) { OP *kid; char* useless = 0; @@ -944,8 +920,7 @@ OP *o; } OP * -listkids(o) -OP *o; +listkids(OP *o) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -956,8 +931,7 @@ OP *o; } OP * -list(o) -OP *o; +list(OP *o) { OP *kid; @@ -1023,8 +997,7 @@ OP *o; } OP * -scalarseq(o) -OP *o; +scalarseq(OP *o) { OP *kid; @@ -1052,9 +1025,7 @@ OP *o; } static OP * -modkids(o, type) -OP *o; -I32 type; +modkids(OP *o, I32 type) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -1067,9 +1038,7 @@ I32 type; static I32 modcount; OP * -mod(o, type) -OP *o; -I32 type; +mod(OP *o, I32 type) { dTHR; OP *kid; @@ -1178,7 +1147,7 @@ I32 type; case OP_RV2SV: if (!type && cUNOPo->op_first->op_type != OP_GV) croak("Can't localize through a reference"); - ref(cUNOPo->op_first, o->op_type); + ref(cUNOPo->op_first, o->op_type); /* FALL THROUGH */ case OP_GV: case OP_AV2ARYLEN: @@ -1203,12 +1172,8 @@ I32 type; break; #ifdef USE_THREADS - case OP_SPECIFIC: + case OP_THREADSV: modcount++; /* XXX ??? */ -#if 0 - if (!type) - croak("Can't localize thread-specific variable"); -#endif break; #endif /* USE_THREADS */ @@ -1272,9 +1237,7 @@ I32 type; } static bool -scalar_mod_type(o, type) -OP *o; -I32 type; +scalar_mod_type(OP *o, I32 type) { switch (type) { case OP_SASSIGN: @@ -1318,9 +1281,7 @@ I32 type; } OP * -refkids(o, type) -OP *o; -I32 type; +refkids(OP *o, I32 type) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -1331,9 +1292,7 @@ I32 type; } OP * -ref(o, type) -OP *o; -I32 type; +ref(OP *o, I32 type) { OP *kid; @@ -1351,7 +1310,7 @@ I32 type; o->op_flags |= OPf_SPECIAL; } break; - + case OP_COND_EXPR: for (kid = cUNOPo->op_first->op_sibling; kid; kid = kid->op_sibling) ref(kid, type); @@ -1368,13 +1327,13 @@ I32 type; } break; - case OP_SPECIFIC: + case OP_THREADSV: o->op_flags |= OPf_MOD; /* XXX ??? */ break; case OP_RV2AV: case OP_RV2HV: - o->op_flags |= OPf_REF; + o->op_flags |= OPf_REF; /* FALL THROUGH */ case OP_RV2GV: ref(cUNOPo->op_first, o->op_type); @@ -1382,9 +1341,9 @@ I32 type; case OP_PADAV: case OP_PADHV: - o->op_flags |= OPf_REF; + o->op_flags |= OPf_REF; break; - + case OP_SCALAR: case OP_NULL: if (!(o->op_flags & OPf_KIDS)) @@ -1418,8 +1377,7 @@ I32 type; } OP * -my(o) -OP *o; +my(OP *o) { OP *kid; I32 type; @@ -1446,8 +1404,7 @@ OP *o; } OP * -sawparens(o) -OP *o; +sawparens(OP *o) { if (o) o->op_flags |= OPf_PARENS; @@ -1455,10 +1412,7 @@ OP *o; } OP * -bind_match(type, left, right) -I32 type; -OP *left; -OP *right; +bind_match(I32 type, OP *left, OP *right) { OP *o; @@ -1496,8 +1450,7 @@ OP *right; } OP * -invert(o) -OP *o; +invert(OP *o) { if (!o) return o; @@ -1506,8 +1459,7 @@ OP *o; } OP * -scope(o) -OP *o; +scope(OP *o) { if (o) { if (o->op_flags & OPf_PARENS || PERLDB_NOOPT || tainting) { @@ -1534,8 +1486,7 @@ OP *o; } int -block_start(full) -int full; +block_start(int full) { dTHR; int retval = savestack_ix; @@ -1559,9 +1510,7 @@ int full; } OP* -block_end(floor, seq) -I32 floor; -OP* seq; +block_end(I32 floor, OP *seq) { dTHR; int needblockscope = hints & HINT_BLOCK_SCOPE; @@ -1576,8 +1525,7 @@ OP* seq; } void -newPROG(o) -OP *o; +newPROG(OP *o) { dTHR; if (in_eval) { @@ -1611,9 +1559,7 @@ OP *o; } OP * -localize(o, lex) -OP *o; -I32 lex; +localize(OP *o, I32 lex) { if (o->op_flags & OPf_PARENS) list(o); @@ -1635,13 +1581,12 @@ I32 lex; } OP * -jmaybe(o) -OP *o; +jmaybe(OP *o) { if (o->op_type == OP_LIST) { OP *o2; #ifdef USE_THREADS - o2 = newOP(OP_SPECIFIC, 0); + o2 = newOP(OP_THREADSV, 0); o2->op_targ = find_thread_magical(";"); #else o2 = newSVREF(newGVOP(OP_GV, 0, gv_fetchpv(";", TRUE, SVt_PV))), @@ -1652,8 +1597,7 @@ OP *o; } OP * -fold_constants(o) -register OP *o; +fold_constants(register OP *o) { dTHR; register OP *curop; @@ -1720,7 +1664,7 @@ register OP *o; } return newSVOP(OP_CONST, 0, sv); } - + nope: if (!(opargs[type] & OA_OTHERINT)) return o; @@ -1746,8 +1690,7 @@ register OP *o; } OP * -gen_constant_list(o) -register OP *o; +gen_constant_list(register OP *o) { dTHR; register OP *curop; @@ -1775,10 +1718,7 @@ register OP *o; } OP * -convert(type, flags, o) -I32 type; -I32 flags; -OP* o; +convert(I32 type, I32 flags, OP *o) { OP *kid; OP *last = 0; @@ -1812,10 +1752,7 @@ OP* o; /* List constructors */ OP * -append_elem(type, first, last) -I32 type; -OP* first; -OP* last; +append_elem(I32 type, OP *first, OP *last) { if (!first) return last; @@ -1838,10 +1775,7 @@ OP* last; } OP * -append_list(type, first, last) -I32 type; -LISTOP* first; -LISTOP* last; +append_list(I32 type, LISTOP *first, LISTOP *last) { if (!first) return (OP*)last; @@ -1866,10 +1800,7 @@ LISTOP* last; } OP * -prepend_elem(type, first, last) -I32 type; -OP* first; -OP* last; +prepend_elem(I32 type, OP *first, OP *last) { if (!first) return last; @@ -1900,14 +1831,13 @@ OP* last; /* Constructors */ OP * -newNULLLIST() +newNULLLIST(void) { return newOP(OP_STUB, 0); } OP * -force_list(o) -OP *o; +force_list(OP *o) { if (!o || o->op_type != OP_LIST) o = newLISTOP(OP_LIST, 0, o, Nullop); @@ -1916,11 +1846,7 @@ OP *o; } OP * -newLISTOP(type, flags, first, last) -I32 type; -I32 flags; -OP* first; -OP* last; +newLISTOP(I32 type, I32 flags, OP *first, OP *last) { LISTOP *listop; @@ -1955,9 +1881,7 @@ OP* last; } OP * -newOP(type, flags) -I32 type; -I32 flags; +newOP(I32 type, I32 flags) { OP *o; Newz(1101, o, 1, OP); @@ -1975,15 +1899,12 @@ I32 flags; } OP * -newUNOP(type, flags, first) -I32 type; -I32 flags; -OP* first; +newUNOP(I32 type, I32 flags, OP *first) { UNOP *unop; if (!first) - first = newOP(OP_STUB, 0); + first = newOP(OP_STUB, 0); if (opargs[type] & OA_MARK) first = force_list(first); @@ -2002,11 +1923,7 @@ OP* first; } OP * -newBINOP(type, flags, first, last) -I32 type; -I32 flags; -OP* first; -OP* last; +newBINOP(I32 type, I32 flags, OP *first, OP *last) { BINOP *binop; Newz(1101, binop, 1, BINOP); @@ -2037,10 +1954,7 @@ OP* last; } OP * -pmtrans(o, expr, repl) -OP *o; -OP *expr; -OP *repl; +pmtrans(OP *o, OP *expr, OP *repl) { SV *tstr = ((SVOP*)expr)->op_sv; SV *rstr = ((SVOP*)repl)->op_sv; @@ -2050,13 +1964,13 @@ OP *repl; register U8 *r = (U8*)SvPV(rstr, rlen); register I32 i; register I32 j; - I32 delete; + I32 Delete; I32 complement; register short *tbl; tbl = (short*)cPVOPo->op_pv; complement = o->op_private & OPpTRANS_COMPLEMENT; - delete = o->op_private & OPpTRANS_DELETE; + Delete = o->op_private & OPpTRANS_DELETE; /* squash = o->op_private & OPpTRANS_SQUASH; */ if (complement) { @@ -2066,7 +1980,7 @@ OP *repl; for (i = 0, j = 0; i < 256; i++) { if (!tbl[i]) { if (j >= rlen) { - if (delete) + if (Delete) tbl[i] = -2; else if (rlen) tbl[i] = r[j-1]; @@ -2079,14 +1993,14 @@ OP *repl; } } else { - if (!rlen && !delete) { + if (!rlen && !Delete) { r = t; rlen = tlen; } for (i = 0; i < 256; i++) tbl[i] = -1; for (i = 0, j = 0; i < tlen; i++,j++) { if (j >= rlen) { - if (delete) { + if (Delete) { if (tbl[t[i]] == -1) tbl[t[i]] = -2; continue; @@ -2104,9 +2018,7 @@ OP *repl; } OP * -newPMOP(type, flags) -I32 type; -I32 flags; +newPMOP(I32 type, I32 flags) { dTHR; PMOP *pmop; @@ -2130,10 +2042,7 @@ I32 flags; } OP * -pmruntime(o, expr, repl) -OP *o; -OP *expr; -OP *repl; +pmruntime(OP *o, OP *expr, OP *repl) { PMOP *pm; LOGOP *rcop; @@ -2154,7 +2063,7 @@ OP *repl; pm->op_pmflags |= PMf_SKIPWHITE; } pm->op_pmregexp = pregcomp(p, p + plen, pm); - if (strEQ("\\s+", pm->op_pmregexp->precomp)) + if (strEQ("\\s+", pm->op_pmregexp->precomp)) pm->op_pmflags |= PMf_WHITE; hoistmust(pm); op_free(expr); @@ -2190,7 +2099,7 @@ OP *repl; if (pm->op_pmflags & PMf_EVAL) curop = 0; #ifdef USE_THREADS - else if (repl->op_type == OP_SPECIFIC + else if (repl->op_type == OP_THREADSV && strchr("&`'123456789+", per_thread_magicals[repl->op_targ])) { @@ -2204,7 +2113,7 @@ OP *repl; for (curop = LINKLIST(repl); curop!=repl; curop = LINKLIST(curop)) { if (opargs[curop->op_type] & OA_DANGEROUS) { #ifdef USE_THREADS - if (curop->op_type == OP_SPECIFIC + if (curop->op_type == OP_THREADSV && strchr("&`'123456789+", curop->op_private)) { break; } @@ -2264,10 +2173,7 @@ OP *repl; } OP * -newSVOP(type, flags, sv) -I32 type; -I32 flags; -SV *sv; +newSVOP(I32 type, I32 flags, SV *sv) { SVOP *svop; Newz(1101, svop, 1, SVOP); @@ -2284,10 +2190,7 @@ SV *sv; } OP * -newGVOP(type, flags, gv) -I32 type; -I32 flags; -GV *gv; +newGVOP(I32 type, I32 flags, GV *gv) { dTHR; GVOP *gvop; @@ -2305,10 +2208,7 @@ GV *gv; } OP * -newPVOP(type, flags, pv) -I32 type; -I32 flags; -char *pv; +newPVOP(I32 type, I32 flags, char *pv) { PVOP *pvop; Newz(1101, pvop, 1, PVOP); @@ -2325,8 +2225,7 @@ char *pv; } void -package(o) -OP *o; +package(OP *o) { dTHR; SV *sv; @@ -2351,12 +2250,7 @@ OP *o; } void -utilize(aver, floor, version, id, arg) -int aver; -I32 floor; -OP *version; -OP *id; -OP *arg; +utilize(int aver, I32 floor, OP *version, OP *id, OP *arg) { OP *pack; OP *meth; @@ -2393,7 +2287,7 @@ OP *arg; newUNOP(OP_METHOD, 0, meth))); } } - + /* Fake up an import/unimport */ if (arg && arg->op_type == OP_STUB) imop = arg; /* no import on explicit () */ @@ -2432,10 +2326,7 @@ OP *arg; } OP * -newSLICEOP(flags, subscript, listval) -I32 flags; -OP *subscript; -OP *listval; +newSLICEOP(I32 flags, OP *subscript, OP *listval) { return newBINOP(OP_LSLICE, flags, list(force_list(subscript)), @@ -2443,8 +2334,7 @@ OP *listval; } static I32 -list_assignment(o) -register OP *o; +list_assignment(register OP *o) { if (!o) return TRUE; @@ -2478,11 +2368,7 @@ register OP *o; } OP * -newASSIGNOP(flags, left, optype, right) -I32 flags; -OP *left; -I32 optype; -OP *right; +newASSIGNOP(I32 flags, OP *left, I32 optype, OP *right) { OP *o; @@ -2611,10 +2497,7 @@ OP *right; } OP * -newSTATEOP(flags, label, o) -I32 flags; -char *label; -OP *o; +newSTATEOP(I32 flags, char *label, OP *o) { dTHR; U32 seq = intro_my(); @@ -2666,7 +2549,7 @@ OP *o; /* "Introduce" my variables to visible status. */ U32 -intro_my() +intro_my(void) { SV **svp; SV *sv; @@ -2688,11 +2571,7 @@ intro_my() } OP * -newLOGOP(type, flags, first, other) -I32 type; -I32 flags; -OP* first; -OP* other; +newLOGOP(I32 type, I32 flags, OP *first, OP *other) { dTHR; LOGOP *logop; @@ -2793,11 +2672,7 @@ OP* other; } OP * -newCONDOP(flags, first, trueop, falseop) -I32 flags; -OP* first; -OP* trueop; -OP* falseop; +newCONDOP(I32 flags, OP *first, OP *trueop, OP *falseop) { dTHR; CONDOP *condop; @@ -2850,10 +2725,7 @@ OP* falseop; } OP * -newRANGE(flags, left, right) -I32 flags; -OP *left; -OP *right; +newRANGE(I32 flags, OP *left, OP *right) { dTHR; CONDOP *condop; @@ -2898,11 +2770,7 @@ OP *right; } OP * -newLOOPOP(flags, debuggable, expr, block) -I32 flags; -I32 debuggable; -OP *expr; -OP *block; +newLOOPOP(I32 flags, I32 debuggable, OP *expr, OP *block) { dTHR; OP* listop; @@ -2938,14 +2806,7 @@ OP *block; } OP * -newWHILEOP(flags, debuggable, loop, whileline, expr, block, cont) -I32 flags; -I32 debuggable; -LOOP *loop; -I32 whileline; -OP *expr; -OP *block; -OP *cont; +newWHILEOP(I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP *expr, OP *block, OP *cont) { dTHR; OP *redo; @@ -2984,7 +2845,7 @@ OP *cont; op_free((OP*)loop); return Nullop; /* (listop already freed by newLOGOP) */ } - ((LISTOP*)listop)->op_last->op_next = condop = + ((LISTOP*)listop)->op_last->op_next = condop = (o == listop ? redo : LINKLIST(o)); if (!next) next = condop; @@ -3066,9 +2927,7 @@ newFOROP(I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *block,OP *cont } OP* -newLOOPEX(type, label) -I32 type; -OP* label; +newLOOPEX(I32 type, OP *label) { dTHR; OP *o; @@ -3089,8 +2948,7 @@ OP* label; } void -cv_undef(cv) -CV *cv; +cv_undef(CV *cv) { dTHR; #ifdef USE_THREADS @@ -3195,9 +3053,7 @@ CV* cv; #endif /* DEBUG_CLOSURES */ static CV * -cv_clone2(proto, outside) -CV* proto; -CV* outside; +cv_clone2(CV *proto, CV *outside) { dTHR; AV* av; @@ -3329,17 +3185,13 @@ CV* outside; } CV * -cv_clone(proto) -CV* proto; +cv_clone(CV *proto) { return cv_clone2(proto, CvOUTSIDE(proto)); } void -cv_ckproto(cv, gv, p) -CV* cv; -GV* gv; -char* p; +cv_ckproto(CV *cv, GV *gv, char *p) { if ((!p != !SvPOK(cv)) || (p && strNE(p, SvPVX(cv)))) { SV* msg = sv_newmortal(); @@ -3362,12 +3214,11 @@ char* p; } SV * -cv_const_sv(cv) -CV* cv; +cv_const_sv(CV *cv) { OP *o; SV *sv; - + if (!cv || !SvPOK(cv) || SvCUR(cv)) return Nullsv; @@ -3398,11 +3249,7 @@ CV* cv; } CV * -newSUB(floor,o,proto,block) -I32 floor; -OP *o; -OP *proto; -OP *block; +newSUB(I32 floor, OP *o, OP *proto, OP *block) { dTHR; char *name = o ? SvPVx(cSVOPo->op_sv, na) : Nullch; @@ -3487,8 +3334,8 @@ OP *block; croak(not_safe); else { /* force display of errors found but not reported */ - sv_catpv(errsv, not_safe); - croak("%s", SvPV(errsv, na)); + sv_catpv(ERRSV, not_safe); + croak("%s", SvPVx(ERRSV, na)); } } } @@ -3616,10 +3463,7 @@ OP *block; } CV * -newXS(name, subaddr, filename) -char *name; -void (*subaddr) _((CV*)); -char *filename; +newXS(char *name, void (*subaddr) (CV *), char *filename) { dTHR; GV *gv = gv_fetchpv(name ? name : "__ANON__", GV_ADDMULTI, SVt_PVCV); @@ -3696,10 +3540,7 @@ char *filename; } void -newFORM(floor,o,block) -I32 floor; -OP *o; -OP *block; +newFORM(I32 floor, OP *o, OP *block) { dTHR; register CV *cv; @@ -3743,34 +3584,28 @@ OP *block; } OP * -newANONLIST(o) -OP* o; +newANONLIST(OP *o) { return newUNOP(OP_REFGEN, 0, mod(list(convert(OP_ANONLIST, 0, o)), OP_REFGEN)); } OP * -newANONHASH(o) -OP* o; +newANONHASH(OP *o) { return newUNOP(OP_REFGEN, 0, mod(list(convert(OP_ANONHASH, 0, o)), OP_REFGEN)); } OP * -newANONSUB(floor, proto, block) -I32 floor; -OP *proto; -OP *block; +newANONSUB(I32 floor, OP *proto, OP *block) { return newUNOP(OP_REFGEN, 0, newSVOP(OP_ANONCODE, 0, (SV*)newSUB(floor, 0, proto, block))); } OP * -oopsAV(o) -OP *o; +oopsAV(OP *o) { switch (o->op_type) { case OP_PADSV: @@ -3792,8 +3627,7 @@ OP *o; } OP * -oopsHV(o) -OP *o; +oopsHV(OP *o) { switch (o->op_type) { case OP_PADSV: @@ -3817,8 +3651,7 @@ OP *o; } OP * -newAVREF(o) -OP *o; +newAVREF(OP *o) { if (o->op_type == OP_PADANY) { o->op_type = OP_PADAV; @@ -3829,9 +3662,7 @@ OP *o; } OP * -newGVREF(type,o) -I32 type; -OP *o; +newGVREF(I32 type, OP *o) { if (type == OP_MAPSTART) return newUNOP(OP_NULL, 0, o); @@ -3839,8 +3670,7 @@ OP *o; } OP * -newHVREF(o) -OP *o; +newHVREF(OP *o) { if (o->op_type == OP_PADANY) { o->op_type = OP_PADHV; @@ -3851,8 +3681,7 @@ OP *o; } OP * -oopsCV(o) -OP *o; +oopsCV(OP *o) { croak("NOT IMPL LINE %d",__LINE__); /* STUB */ @@ -3860,23 +3689,20 @@ OP *o; } OP * -newCVREF(flags, o) -I32 flags; -OP *o; +newCVREF(I32 flags, OP *o) { return newUNOP(OP_RV2CV, flags, scalar(o)); } OP * -newSVREF(o) -OP *o; +newSVREF(OP *o) { if (o->op_type == OP_PADANY) { o->op_type = OP_PADSV; o->op_ppaddr = ppaddr[OP_PADSV]; return o; } - else if (o->op_type == OP_SPECIFIC) + else if (o->op_type == OP_THREADSV) return o; return newUNOP(OP_RV2SV, 0, scalar(o)); } @@ -3884,8 +3710,7 @@ OP *o; /* Check routines. */ OP * -ck_anoncode(o) -OP *o; +ck_anoncode(OP *o) { PADOFFSET ix; SV* name; @@ -3905,16 +3730,14 @@ OP *o; } OP * -ck_bitop(o) -OP *o; +ck_bitop(OP *o) { o->op_private = hints; return o; } OP * -ck_concat(o) -OP *o; +ck_concat(OP *o) { if (cUNOPo->op_first->op_type == OP_CONCAT) o->op_flags |= OPf_STACKED; @@ -3922,8 +3745,7 @@ OP *o; } OP * -ck_spair(o) -OP *o; +ck_spair(OP *o) { if (o->op_flags & OPf_KIDS) { OP* newop; @@ -3937,7 +3759,7 @@ OP *o; !(opargs[newop->op_type] & OA_RETSCALAR) || newop->op_type == OP_PADAV || newop->op_type == OP_PADHV || newop->op_type == OP_RV2AV || newop->op_type == OP_RV2HV)) { - + return o; } op_free(kUNOP->op_first); @@ -3948,8 +3770,7 @@ OP *o; } OP * -ck_delete(o) -OP *o; +ck_delete(OP *o) { o = ck_fun(o); o->op_private = 0; @@ -3966,8 +3787,7 @@ OP *o; } OP * -ck_eof(o) -OP *o; +ck_eof(OP *o) { I32 type = o->op_type; @@ -3983,8 +3803,7 @@ OP *o; } OP * -ck_eval(o) -OP *o; +ck_eval(OP *o) { hints |= HINT_BLOCK_SCOPE; if (o->op_flags & OPf_KIDS) { @@ -4025,8 +3844,7 @@ OP *o; } OP * -ck_exec(o) -OP *o; +ck_exec(OP *o) { OP *kid; if (o->op_flags & OPf_STACKED) { @@ -4041,8 +3859,7 @@ OP *o; } OP * -ck_exists(o) -OP *o; +ck_exists(OP *o) { o = ck_fun(o); if (o->op_flags & OPf_KIDS) { @@ -4055,8 +3872,7 @@ OP *o; } OP * -ck_gvconst(o) -register OP *o; +ck_gvconst(register OP *o) { o = fold_constants(o); if (o->op_type == OP_CONST) @@ -4065,8 +3881,7 @@ register OP *o; } OP * -ck_rvconst(o) -register OP *o; +ck_rvconst(register OP *o) { dTHR; SVOP *kid = (SVOP*)cUNOPo->op_first; @@ -4126,8 +3941,7 @@ register OP *o; } OP * -ck_ftst(o) -OP *o; +ck_ftst(OP *o) { dTHR; I32 type = o->op_type; @@ -4157,8 +3971,7 @@ OP *o; } OP * -ck_fun(o) -OP *o; +ck_fun(OP *o) { dTHR; register OP *kid; @@ -4167,7 +3980,7 @@ OP *o; I32 numargs = 0; int type = o->op_type; register I32 oa = opargs[type] >> OASHIFT; - + if (o->op_flags & OPf_STACKED) { if ((oa & OA_OPTIONAL) && (oa >> 4) && !((oa >> 4) & OA_OPTIONAL)) oa &= ~OA_OPTIONAL; @@ -4296,8 +4109,7 @@ OP *o; } OP * -ck_glob(o) -OP *o; +ck_glob(OP *o) { GV *gv; @@ -4317,7 +4129,7 @@ OP *o; cLISTOPo->op_first->op_type = OP_PUSHMARK; cLISTOPo->op_first->op_ppaddr = ppaddr[OP_PUSHMARK]; o = newUNOP(OP_ENTERSUB, OPf_STACKED, - append_elem(OP_LIST, o, + append_elem(OP_LIST, o, scalar(newUNOP(OP_RV2CV, 0, newGVOP(OP_GV, 0, gv))))); o = newUNOP(OP_NULL, 0, ck_subr(o)); @@ -4332,8 +4144,7 @@ OP *o; } OP * -ck_grep(o) -OP *o; +ck_grep(OP *o) { LOGOP *gwop; OP *kid; @@ -4341,7 +4152,7 @@ OP *o; o->op_ppaddr = ppaddr[OP_GREPSTART]; Newz(1101, gwop, 1, LOGOP); - + if (o->op_flags & OPf_STACKED) { OP* k; o = ck_sort(o); @@ -4360,7 +4171,7 @@ OP *o; o = ck_fun(o); if (error_count) return o; - kid = cLISTOPo->op_first->op_sibling; + kid = cLISTOPo->op_first->op_sibling; if (kid->op_type != OP_NULL) croak("panic: ck_grep"); kid = kUNOP->op_first; @@ -4384,8 +4195,7 @@ OP *o; } OP * -ck_index(o) -OP *o; +ck_index(OP *o) { if (o->op_flags & OPf_KIDS) { OP *kid = cLISTOPo->op_first->op_sibling; /* get past pushmark */ @@ -4396,35 +4206,31 @@ OP *o; } OP * -ck_lengthconst(o) -OP *o; +ck_lengthconst(OP *o) { /* XXX length optimization goes here */ return ck_fun(o); } OP * -ck_lfun(o) -OP *o; +ck_lfun(OP *o) { OPCODE type = o->op_type; return modkids(ck_fun(o), type); } OP * -ck_rfun(o) -OP *o; +ck_rfun(OP *o) { OPCODE type = o->op_type; return refkids(ck_fun(o), type); } OP * -ck_listiob(o) -OP *o; +ck_listiob(OP *o) { register OP *kid; - + kid = cLISTOPo->op_first; if (!kid) { o = force_list(o); @@ -4459,8 +4265,7 @@ OP *o; } OP * -ck_fun_locale(o) -OP *o; +ck_fun_locale(OP *o) { o = ck_fun(o); @@ -4474,8 +4279,7 @@ OP *o; } OP * -ck_scmp(o) -OP *o; +ck_scmp(OP *o) { o->op_private = 0; #ifdef USE_LOCALE @@ -4487,23 +4291,20 @@ OP *o; } OP * -ck_match(o) -OP *o; +ck_match(OP *o) { o->op_private |= OPpRUNTIME; return o; } OP * -ck_null(o) -OP *o; +ck_null(OP *o) { return o; } OP * -ck_repeat(o) -OP *o; +ck_repeat(OP *o) { if (cBINOPo->op_first->op_flags & OPf_PARENS) { o->op_private |= OPpREPEAT_DOLIST; @@ -4515,8 +4316,7 @@ OP *o; } OP * -ck_require(o) -OP *o; +ck_require(OP *o) { if (o->op_flags & OPf_KIDS) { /* Shall we supply missing .pm? */ SVOP *kid = (SVOP*)cUNOPo->op_first; @@ -4537,8 +4337,7 @@ OP *o; } OP * -ck_retarget(o) -OP *o; +ck_retarget(OP *o) { croak("NOT IMPL LINE %d",__LINE__); /* STUB */ @@ -4546,8 +4345,7 @@ OP *o; } OP * -ck_select(o) -OP *o; +ck_select(OP *o) { OP* kid; if (o->op_flags & OPf_KIDS) { @@ -4567,8 +4365,7 @@ OP *o; } OP * -ck_shift(o) -OP *o; +ck_shift(OP *o) { I32 type = o->op_type; @@ -4597,8 +4394,7 @@ OP *o; } OP * -ck_sort(o) -OP *o; +ck_sort(OP *o) { o->op_private = 0; #ifdef USE_LOCALE @@ -4647,12 +4443,11 @@ OP *o; } OP * -ck_split(o) -OP *o; +ck_split(OP *o) { register OP *kid; PMOP* pm; - + if (o->op_flags & OPf_STACKED) return no_fh_allowed(o); @@ -4705,8 +4500,7 @@ OP *o; } OP * -ck_subr(o) -OP *o; +ck_subr(OP *o) { dTHR; OP *prev = ((cUNOPo->op_first->op_sibling) @@ -4831,16 +4625,14 @@ OP *o; } OP * -ck_svconst(o) -OP *o; +ck_svconst(OP *o) { SvREADONLY_on(cSVOPo->op_sv); return o; } OP * -ck_trunc(o) -OP *o; +ck_trunc(OP *o) { if (o->op_flags & OPf_KIDS) { SVOP *kid = (SVOP*)cUNOPo->op_first; @@ -4857,8 +4649,7 @@ OP *o; /* A peephole optimizer. We visit the ops in the order they're to execute. */ void -peep(o) -register OP* o; +peep(register OP *o) { dTHR; register OP* oldop = 0; @@ -4958,7 +4749,7 @@ register OP* o; o->op_next = o->op_next->op_next; } break; - + case OP_PADHV: if (o->op_next->op_type == OP_RV2HV && (o->op_next->op_flags && OPf_REF)) @@ -5009,7 +4800,7 @@ register OP* o; } } break; - + case OP_HELEM: { UNOP *rop; SV *lexname; @@ -5018,7 +4809,7 @@ register OP* o; I32 ind; char *key; STRLEN keylen; - + if (o->op_private & (OPpDEREF_HV|OPpDEREF_AV|OPpLVAL_INTRO) || ((BINOP*)o)->op_last->op_type != OP_CONST) break; @@ -35,7 +35,7 @@ typedef U32 PADOFFSET; #define BASEOP \ OP* op_next; \ OP* op_sibling; \ - OP* (*op_ppaddr)(); \ + OP* (*op_ppaddr)_((ARGSproto)); \ PADOFFSET op_targ; \ OPCODE op_type; \ U16 op_seq; \ @@ -349,7 +349,7 @@ typedef enum { OP_GETLOGIN, /* 342 */ OP_SYSCALL, /* 343 */ OP_LOCK, /* 344 */ - OP_SPECIFIC, /* 345 */ + OP_THREADSV, /* 345 */ OP_max } opcode; @@ -704,7 +704,7 @@ EXT char *op_name[] = { "getlogin", "syscall", "lock", - "specific", + "threadsv", }; #endif @@ -1057,10 +1057,12 @@ EXT char *op_desc[] = { "getlogin", "syscall", "lock", - "thread-specific", + "per-thread variable", }; #endif +START_EXTERN_C + OP * ck_anoncode _((OP* o)); OP * ck_bitop _((OP* o)); OP * ck_concat _((OP* o)); @@ -1439,12 +1441,14 @@ OP * pp_egrent _((ARGSproto)); OP * pp_getlogin _((ARGSproto)); OP * pp_syscall _((ARGSproto)); OP * pp_lock _((ARGSproto)); -OP * pp_specific _((ARGSproto)); +OP * pp_threadsv _((ARGSproto)); + +END_EXTERN_C #ifndef DOINIT -EXT OP * (*ppaddr[])(); +EXT OP * (*ppaddr[])(ARGSproto); #else -EXT OP * (*ppaddr[])() = { +EXT OP * (*ppaddr[])(ARGSproto) = { pp_null, pp_stub, pp_scalar, @@ -1790,7 +1794,7 @@ EXT OP * (*ppaddr[])() = { pp_getlogin, pp_syscall, pp_lock, - pp_specific, + pp_threadsv, }; #endif @@ -2143,7 +2147,7 @@ EXT OP * (*check[]) _((OP *op)) = { ck_null, /* getlogin */ ck_fun, /* syscall */ ck_rfun, /* lock */ - ck_null, /* specific */ + ck_null, /* threadsv */ }; #endif @@ -2496,6 +2500,6 @@ EXT U32 opargs[] = { 0x0000000c, /* getlogin */ 0x0002151d, /* syscall */ 0x00001c04, /* lock */ - 0x00000044, /* specific */ + 0x00000044, /* threadsv */ }; #endif @@ -77,6 +77,8 @@ print <<END; }; #endif +START_EXTERN_C + END # Emit function declarations. @@ -95,10 +97,12 @@ for (@ops) { print <<END; +END_EXTERN_C + #ifndef DOINIT -EXT OP * (*ppaddr[])(); +EXT OP * (*ppaddr[])(ARGSproto); #else -EXT OP * (*ppaddr[])() = { +EXT OP * (*ppaddr[])(ARGSproto) = { END for (@ops) { @@ -677,4 +681,4 @@ syscall syscall ck_fun imst@ S L # For multi-threading lock lock ck_rfun s% S -specific thread-specific ck_null ds0 +threadsv per-thread variable ck_null ds0 @@ -97,7 +97,7 @@ catch_sigsegv(int signo, struct sigcontext_struct sc) #endif PerlInterpreter * -perl_alloc() +perl_alloc(void) { PerlInterpreter *sv_interp; @@ -107,8 +107,7 @@ perl_alloc() } void -perl_construct( sv_interp ) -register PerlInterpreter *sv_interp; +perl_construct(register PerlInterpreter *sv_interp) { #ifdef USE_THREADS int i; @@ -226,8 +225,7 @@ register PerlInterpreter *sv_interp; } void -perl_destruct(sv_interp) -register PerlInterpreter *sv_interp; +perl_destruct(register PerlInterpreter *sv_interp) { dTHR; int destruct_level; /* 0=none, 1=full, 2=full with checks */ @@ -474,8 +472,7 @@ register PerlInterpreter *sv_interp; envgv = Nullgv; siggv = Nullgv; incgv = Nullgv; - errhv = Nullhv; - errsv = Nullsv; + errgv = Nullgv; argvgv = Nullgv; argvoutgv = Nullgv; stdingv = Nullgv; @@ -586,8 +583,7 @@ register PerlInterpreter *sv_interp; } void -perl_free(sv_interp) -PerlInterpreter *sv_interp; +perl_free(PerlInterpreter *sv_interp) { if (!(curinterp = sv_interp)) return; @@ -595,12 +591,7 @@ PerlInterpreter *sv_interp; } int -perl_parse(sv_interp, xsinit, argc, argv, env) -PerlInterpreter *sv_interp; -void (*xsinit)_((void)); -int argc; -char **argv; -char **env; +perl_parse(PerlInterpreter *sv_interp, void (*xsinit) (void), int argc, char **argv, char **env) { dTHR; register SV *sv; @@ -1001,8 +992,7 @@ print \" \\@INC:\\n @INC\\n\";"); } int -perl_run(sv_interp) -PerlInterpreter *sv_interp; +perl_run(PerlInterpreter *sv_interp) { dTHR; I32 oldscope; @@ -1087,20 +1077,26 @@ PerlInterpreter *sv_interp; } SV* -perl_get_sv(name, create) -char* name; -I32 create; +perl_get_sv(char *name, I32 create) { - GV* gv = gv_fetchpv(name, create, SVt_PV); + GV *gv; +#ifdef USE_THREADS + if (name[1] == '\0' && !isALPHA(name[0])) { + PADOFFSET tmp = find_thread_magical(name); + if (tmp != NOT_IN_PAD) { + dTHR; + return *av_fetch(thr->magicals, tmp, FALSE); + } + } +#endif /* USE_THREADS */ + gv = gv_fetchpv(name, create, SVt_PV); if (gv) return GvSV(gv); return Nullsv; } AV* -perl_get_av(name, create) -char* name; -I32 create; +perl_get_av(char *name, I32 create) { GV* gv = gv_fetchpv(name, create, SVt_PVAV); if (create) @@ -1111,9 +1107,7 @@ I32 create; } HV* -perl_get_hv(name, create) -char* name; -I32 create; +perl_get_hv(char *name, I32 create) { GV* gv = gv_fetchpv(name, create, SVt_PVHV); if (create) @@ -1124,9 +1118,7 @@ I32 create; } CV* -perl_get_cv(name, create) -char* name; -I32 create; +perl_get_cv(char *name, I32 create) { GV* gv = gv_fetchpv(name, create, SVt_PVCV); if (create && !GvCVu(gv)) @@ -1142,12 +1134,11 @@ I32 create; /* Be sure to refetch the stack pointer after calling these routines. */ I32 -perl_call_argv(subname, flags, argv) -char *subname; -I32 flags; /* See G_* flags in cop.h */ -register char **argv; /* null terminated arg list */ +perl_call_argv(char *subname, I32 flags, register char **argv) + + /* See G_* flags in cop.h */ + /* null terminated arg list */ { - dTHR; dSP; PUSHMARK(sp); @@ -1162,19 +1153,18 @@ register char **argv; /* null terminated arg list */ } I32 -perl_call_pv(subname, flags) -char *subname; /* name of the subroutine */ -I32 flags; /* See G_* flags in cop.h */ +perl_call_pv(char *subname, I32 flags) + /* name of the subroutine */ + /* See G_* flags in cop.h */ { return perl_call_sv((SV*)perl_get_cv(subname, TRUE), flags); } I32 -perl_call_method(methname, flags) -char *methname; /* name of the subroutine */ -I32 flags; /* See G_* flags in cop.h */ +perl_call_method(char *methname, I32 flags) + /* name of the subroutine */ + /* See G_* flags in cop.h */ { - dTHR; dSP; OP myop; if (!op) @@ -1187,9 +1177,9 @@ I32 flags; /* See G_* flags in cop.h */ /* May be called with any of a CV, a GV, or an SV containing the name. */ I32 -perl_call_sv(sv, flags) -SV* sv; -I32 flags; /* See G_* flags in cop.h */ +perl_call_sv(SV *sv, I32 flags) + + /* See G_* flags in cop.h */ { dTHR; LOGOP myop; /* fake syntax tree node */ @@ -1251,7 +1241,7 @@ I32 flags; /* See G_* flags in cop.h */ if (flags & G_KEEPERR) in_eval |= 4; else - sv_setpv(errsv,""); + sv_setpv(ERRSV,""); } markstack_ptr++; @@ -1296,7 +1286,7 @@ I32 flags; /* See G_* flags in cop.h */ runops(); retval = stack_sp - (stack_base + oldmark); if ((flags & G_EVAL) && !(flags & G_KEEPERR)) - sv_setpv(errsv,""); + sv_setpv(ERRSV,""); cleanup: if (flags & G_EVAL) { @@ -1331,9 +1321,9 @@ I32 flags; /* See G_* flags in cop.h */ /* Eval a string. The G_EVAL flag is always assumed. */ I32 -perl_eval_sv(sv, flags) -SV* sv; -I32 flags; /* See G_* flags in cop.h */ +perl_eval_sv(SV *sv, I32 flags) + + /* See G_* flags in cop.h */ { dTHR; UNOP myop; /* fake syntax tree node */ @@ -1405,7 +1395,7 @@ I32 flags; /* See G_* flags in cop.h */ runops(); retval = stack_sp - (stack_base + oldmark); if (!(flags & G_KEEPERR)) - sv_setpv(errsv,""); + sv_setpv(ERRSV,""); cleanup: JMPENV_POP; @@ -1420,11 +1410,8 @@ I32 flags; /* See G_* flags in cop.h */ } SV* -perl_eval_pv(p, croak_on_error) -char* p; -I32 croak_on_error; +perl_eval_pv(char *p, I32 croak_on_error) { - dTHR; dSP; SV* sv = newSVpv(p, 0); @@ -1436,8 +1423,8 @@ I32 croak_on_error; sv = POPs; PUTBACK; - if (croak_on_error && SvTRUE(errsv)) - croak(SvPV(errsv, na)); + if (croak_on_error && SvTRUE(ERRSV)) + croak(SvPVx(ERRSV, na)); return sv; } @@ -1445,8 +1432,7 @@ I32 croak_on_error; /* Require a module. */ void -perl_require_pv(pv) -char* pv; +perl_require_pv(char *pv) { SV* sv = sv_newmortal(); sv_setpv(sv, "require '"); @@ -1456,10 +1442,7 @@ char* pv; } void -magicname(sym,name,namlen) -char *sym; -char *name; -I32 namlen; +magicname(char *sym, char *name, I32 namlen) { register GV *gv; @@ -1468,8 +1451,8 @@ I32 namlen; } static void -usage(name) /* XXX move this out into a module ? */ -char *name; +usage(char *name) /* XXX move this out into a module ? */ + { /* This message really ought to be max 23 lines. * Removed -h because the user already knows that opton. Others? */ @@ -1511,8 +1494,7 @@ NULL /* This routine handles any switches that can be given during run */ char * -moreswitches(s) -char *s; +moreswitches(char *s) { I32 numlen; U32 rschar; @@ -1756,7 +1738,7 @@ GNU General Public License, which may be found in the Perl 5.0 source kit.\n\n") /* unexec() can be found in the Gnu emacs distribution */ void -my_unexec() +my_unexec(void) { #ifdef UNEXEC SV* prog; @@ -1785,7 +1767,7 @@ my_unexec() } static void -init_main_stash() +init_main_stash(void) { dTHR; GV *gv; @@ -1808,11 +1790,11 @@ init_main_stash() incgv = gv_HVadd(gv_AVadd(gv_fetchpv("INC",TRUE, SVt_PVAV))); GvMULTI_on(incgv); defgv = gv_fetchpv("_",TRUE, SVt_PVAV); - errsv = newSVpv("", 0); - errhv = newHV(); + errgv = gv_HVadd(gv_fetchpv("@", TRUE, SVt_PV)); + GvMULTI_on(errgv); (void)form("%240s",""); /* Preallocate temp - for immediate signals. */ - sv_grow(errsv, 240); /* Preallocate - for immediate signals. */ - sv_setpvn(errsv, "", 0); + sv_grow(ERRSV, 240); /* Preallocate - for immediate signals. */ + sv_setpvn(ERRSV, "", 0); curstash = defstash; compiling.cop_stash = defstash; debstash = GvHV(gv_fetchpv("DB::", GV_ADDMULTI, SVt_PVHV)); @@ -2145,9 +2127,7 @@ sed %s -e \"/^[^#]/b\" \ } static void -validate_suid(validarg, scriptname) -char *validarg; -char *scriptname; +validate_suid(char *validarg, char *scriptname) { int which; @@ -2387,7 +2367,7 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n"); } static void -find_beginning() +find_beginning(void) { register char *s, *s2; @@ -2416,7 +2396,7 @@ find_beginning() } static void -init_ids() +init_ids(void) { uid = (int)getuid(); euid = (int)geteuid(); @@ -2430,8 +2410,7 @@ init_ids() } static void -forbid_setid(s) -char *s; +forbid_setid(char *s) { if (euid != uid) croak("No %s allowed while running setuid", s); @@ -2440,7 +2419,7 @@ char *s; } static void -init_debugger() +init_debugger(void) { dTHR; curstash = debstash; @@ -2459,8 +2438,7 @@ init_debugger() } void -init_stacks(ARGS) -dARGS +init_stacks(ARGSproto) { curstack = newAV(); mainstack = curstack; /* remember in case we switch stacks */ @@ -2519,7 +2497,7 @@ dARGS } static void -nuke_stacks() +nuke_stacks(void) { dTHR; Safefree(cxstack); @@ -2533,7 +2511,7 @@ nuke_stacks() static PerlIO *tmpfp; /* moved outside init_lexer() because of UNICOS bug */ static void -init_lexer() +init_lexer(void) { tmpfp = rsfp; rsfp = Nullfp; @@ -2543,7 +2521,7 @@ init_lexer() } static void -init_predump_symbols() +init_predump_symbols(void) { dTHR; GV *tmpgv; @@ -2584,10 +2562,7 @@ init_predump_symbols() } static void -init_postdump_symbols(argc,argv,env) -register int argc; -register char **argv; -register char **env; +init_postdump_symbols(register int argc, register char **argv, register char **env) { dTHR; char *s; @@ -2675,7 +2650,7 @@ register char **env; } static void -init_perllib() +init_perllib(void) { char *s; if (!tainting) { @@ -2742,9 +2717,7 @@ init_perllib() #endif static void -incpush(p, addsubdirs) -char *p; -int addsubdirs; +incpush(char *p, int addsubdirs) { SV *subdir = Nullsv; static char *archpat_auto; @@ -2845,6 +2818,7 @@ init_main_thread() thr->cvcache = newHV(); thr->magicals = newAV(); thr->specific = newAV(); + thr->errhv = newHV(); thr->flags = THRf_R_JOINABLE; MUTEX_INIT(&thr->mutex); /* Handcraft thrsv similarly to mess_sv */ @@ -2886,14 +2860,13 @@ init_main_thread() sv_upgrade(bodytarget, SVt_PVFM); sv_setpvn(bodytarget, "", 0); formtarget = bodytarget; + thr->errsv = newSVpv("", 0); return thr; } #endif /* USE_THREADS */ void -call_list(oldscope, list) -I32 oldscope; -AV* list; +call_list(I32 oldscope, AV *list) { dTHR; line_t oldline = curcop->cop_line; @@ -2909,20 +2882,21 @@ AV* list; JMPENV_PUSH(ret); switch (ret) { case 0: { + SV* atsv = ERRSV; PUSHMARK(stack_sp); perl_call_sv((SV*)cv, G_EVAL|G_DISCARD); - (void)SvPV(errsv, len); + (void)SvPV(atsv, len); if (len) { JMPENV_POP; curcop = &compiling; curcop->cop_line = oldline; if (list == beginav) - sv_catpv(errsv, "BEGIN failed--compilation aborted"); + sv_catpv(atsv, "BEGIN failed--compilation aborted"); else - sv_catpv(errsv, "END failed--cleanup aborted"); + sv_catpv(atsv, "END failed--cleanup aborted"); while (scopestack_ix > oldscope) LEAVE; - croak("%s", SvPVX(errsv)); + croak("%s", SvPVX(atsv)); } } break; @@ -2964,8 +2938,7 @@ AV* list; } void -my_exit(status) -U32 status; +my_exit(U32 status) { dTHR; @@ -2988,7 +2961,7 @@ U32 status; } void -my_failure_exit() +my_failure_exit(void) { #ifdef VMS if (vaxc$errno & 1) { @@ -3011,7 +2984,7 @@ my_failure_exit() } static void -my_exit_jump() +my_exit_jump(void) { dTHR; register CONTEXT *cx; @@ -3037,3 +3010,5 @@ my_exit_jump() JMPENV_JUMP(2); } + + @@ -462,6 +462,14 @@ register struct op *op asm(stringify(OP_IN_REGISTER)); # define SETERRNO(errcode,vmserrcode) errno = (errcode) #endif +#ifdef USE_THREADS +# define ERRSV (thr->errsv) +# define ERRHV (thr->errhv) +#else +# define ERRSV GvSV(errgv) +# define ERRHV GvHV(errgv) +#endif /* USE_THREADS */ + #ifndef errno extern int errno; /* ANSI allows errno to be an lvalue expr */ #endif @@ -1870,8 +1878,7 @@ IEXT I32 Imaxscream IINIT(-1); IEXT SV * Ilastscream; /* shortcuts to misc objects */ -IEXT HV * Ierrhv; -IEXT SV * Ierrsv; +IEXT GV * Ierrgv; /* shortcuts to debugging objects */ IEXT GV * IDBgv; @@ -26,7 +26,7 @@ #ifdef PERLIO_IS_STDIO void -PerlIO_init() +PerlIO_init(void) { /* Does nothing (yet) except force this file to be included in perl binary. That allows this file to force inclusion @@ -37,7 +37,7 @@ PerlIO_init() #undef PerlIO_tmpfile PerlIO * -PerlIO_tmpfile() +PerlIO_tmpfile(void) { return tmpfile(); } @@ -610,11 +610,7 @@ char *pat, *args; #ifndef PerlIO_vsprintf int -PerlIO_vsprintf(s,n,fmt,ap) -char *s; -const char *fmt; -int n; -va_list ap; +PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap) { int val = vsprintf(s, fmt, ap); if (n >= 0) @@ -7,7 +7,7 @@ static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/91"; #include "perl.h" static void -dep() +dep(void) { deprecate("\"do\" to call subroutines"); } @@ -1303,8 +1303,7 @@ struct ysv { }; void -yydestruct(ptr) -void* ptr; +yydestruct(void *ptr) { struct ysv* ysave = (struct ysv*)ptr; if (ysave->yyss) Safefree(ysave->yyss); @@ -1319,7 +1318,7 @@ void* ptr; } int -yyparse() +yyparse(void) { register int yym, yyn, yystate; register short *yyssp; @@ -1330,8 +1329,10 @@ yyparse() int retval = 0; #if YYDEBUG register char *yys; +#ifndef __cplusplus extern char *getenv(); #endif +#endif struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv)); SAVEDESTRUCTOR(yydestruct, ysave); @@ -17,7 +17,7 @@ #include "perl.h" static void -dep() +dep(void) { deprecate("\"do\" to call subroutines"); } @@ -24,7 +24,7 @@ */ #ifdef CXUX_BROKEN_CONSTANT_CONVERT static double UV_MAX_cxux = ((double)UV_MAX); -#endif +#endif /* * Types used in bitwise operations. @@ -105,9 +105,17 @@ static bool srand_called = FALSE; /* variations on pp_null */ +#ifdef DONT_DECLARE_STD +#ifdef I_UNISTD +#include <unistd.h> +#endif +#else +extern pid_t getpid (void); +#endif + PP(pp_stub) { - dSP; + djSP; if (GIMME_V == G_SCALAR) XPUSHs(&sv_undef); RETURN; @@ -122,7 +130,7 @@ PP(pp_scalar) PP(pp_padav) { - dSP; dTARGET; + djSP; dTARGET; if (op->op_private & OPpLVAL_INTRO) SAVECLEARSV(curpad[op->op_targ]); EXTEND(SP, 1); @@ -147,7 +155,7 @@ PP(pp_padav) PP(pp_padhv) { - dSP; dTARGET; + djSP; dTARGET; I32 gimme; XPUSHs(TARG); @@ -180,7 +188,7 @@ PP(pp_padany) PP(pp_rv2gv) { - dSP; dTOPss; + djSP; dTOPss; if (SvROK(sv)) { wasref: @@ -225,7 +233,7 @@ PP(pp_rv2gv) PP(pp_rv2sv) { - dSP; dTOPss; + djSP; dTOPss; if (SvROK(sv)) { wasref: @@ -274,7 +282,7 @@ PP(pp_rv2sv) PP(pp_av2arylen) { - dSP; + djSP; AV *av = (AV*)TOPs; SV *sv = AvARYLEN(av); if (!sv) { @@ -288,7 +296,7 @@ PP(pp_av2arylen) PP(pp_pos) { - dSP; dTARGET; dPOPss; + djSP; dTARGET; dPOPss; if (op->op_flags & OPf_MOD) { if (SvTYPE(TARG) < SVt_PVLV) { @@ -317,7 +325,7 @@ PP(pp_pos) PP(pp_rv2cv) { - dSP; + djSP; GV *gv; HV *stash; @@ -336,7 +344,7 @@ PP(pp_rv2cv) PP(pp_prototype) { - dSP; + djSP; CV *cv; HV *stash; GV *gv; @@ -352,7 +360,7 @@ PP(pp_prototype) PP(pp_anoncode) { - dSP; + djSP; CV* cv = (CV*)curpad[op->op_targ]; if (CvCLONE(cv)) cv = (CV*)sv_2mortal((SV*)cv_clone(cv)); @@ -363,14 +371,14 @@ PP(pp_anoncode) PP(pp_srefgen) { - dSP; + djSP; *SP = refto(*SP); RETURN; } PP(pp_refgen) { - dSP; dMARK; + djSP; dMARK; if (GIMME != G_ARRAY) { MARK[1] = *SP; SP = MARK + 1; @@ -382,8 +390,7 @@ PP(pp_refgen) } static SV* -refto(sv) -SV* sv; +refto(SV *sv) { SV* rv; @@ -408,7 +415,7 @@ SV* sv; PP(pp_ref) { - dSP; dTARGET; + djSP; dTARGET; SV *sv; char *pv; @@ -428,7 +435,7 @@ PP(pp_ref) PP(pp_bless) { - dSP; + djSP; HV *stash; if (MAXARG == 1) @@ -446,7 +453,7 @@ PP(pp_gelem) SV *sv; SV *ref; char *elem; - dSP; + djSP; sv = POPs; elem = SvPV(sv, na); @@ -506,7 +513,7 @@ PP(pp_gelem) PP(pp_study) { - dSP; dPOPss; + djSP; dPOPss; register unsigned char *s; register I32 pos; register I32 ch; @@ -568,7 +575,7 @@ PP(pp_study) PP(pp_trans) { - dSP; dTARG; + djSP; dTARG; SV *sv; if (op->op_flags & OPf_STACKED) @@ -586,7 +593,7 @@ PP(pp_trans) PP(pp_schop) { - dSP; dTARGET; + djSP; dTARGET; do_chop(TARG, TOPs); SETTARG; RETURN; @@ -594,7 +601,7 @@ PP(pp_schop) PP(pp_chop) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; while (SP > MARK) do_chop(TARG, POPs); PUSHTARG; @@ -603,14 +610,14 @@ PP(pp_chop) PP(pp_schomp) { - dSP; dTARGET; + djSP; dTARGET; SETi(do_chomp(TOPs)); RETURN; } PP(pp_chomp) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; register I32 count = 0; while (SP > MARK) @@ -621,7 +628,7 @@ PP(pp_chomp) PP(pp_defined) { - dSP; + djSP; register SV* sv; sv = POPs; @@ -651,7 +658,7 @@ PP(pp_defined) PP(pp_undef) { - dSP; + djSP; SV *sv; if (!op->op_private) { @@ -709,7 +716,7 @@ PP(pp_undef) PP(pp_predec) { - dSP; + djSP; if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV) croak(no_modify); if (SvIOK(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) && @@ -726,7 +733,7 @@ PP(pp_predec) PP(pp_postinc) { - dSP; dTARGET; + djSP; dTARGET; if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV) croak(no_modify); sv_setsv(TARG, TOPs); @@ -747,7 +754,7 @@ PP(pp_postinc) PP(pp_postdec) { - dSP; dTARGET; + djSP; dTARGET; if(SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV) croak(no_modify); sv_setsv(TARG, TOPs); @@ -768,7 +775,7 @@ PP(pp_postdec) PP(pp_pow) { - dSP; dATARGET; tryAMAGICbin(pow,opASSIGN); + djSP; dATARGET; tryAMAGICbin(pow,opASSIGN); { dPOPTOPnnrl; SETn( pow( left, right) ); @@ -778,7 +785,7 @@ PP(pp_pow) PP(pp_multiply) { - dSP; dATARGET; tryAMAGICbin(mult,opASSIGN); + djSP; dATARGET; tryAMAGICbin(mult,opASSIGN); { dPOPTOPnnrl; SETn( left * right ); @@ -788,7 +795,7 @@ PP(pp_multiply) PP(pp_divide) { - dSP; dATARGET; tryAMAGICbin(div,opASSIGN); + djSP; dATARGET; tryAMAGICbin(div,opASSIGN); { dPOPPOPnnrl; double value; @@ -816,7 +823,7 @@ PP(pp_divide) PP(pp_modulo) { - dSP; dATARGET; tryAMAGICbin(mod,opASSIGN); + djSP; dATARGET; tryAMAGICbin(mod,opASSIGN); { UV left; UV right; @@ -851,8 +858,8 @@ PP(pp_modulo) if (right_neg) { /* XXX may warn: unary minus operator applied to unsigned type */ /* could change -foo to be (~foo)+1 instead */ - if (ans <= -(UV)IV_MAX) - sv_setiv(TARG, (IV) -ans); + if (ans <= ~((UV)IV_MAX)+1) + sv_setiv(TARG, ~ans+1); else sv_setnv(TARG, -(double)ans); } @@ -865,7 +872,7 @@ PP(pp_modulo) PP(pp_repeat) { - dSP; dATARGET; tryAMAGICbin(repeat,opASSIGN); + djSP; dATARGET; tryAMAGICbin(repeat,opASSIGN); { register I32 count = POPi; if (GIMME == G_ARRAY && op->op_private & OPpREPEAT_DOLIST) { @@ -921,7 +928,7 @@ PP(pp_repeat) PP(pp_subtract) { - dSP; dATARGET; tryAMAGICbin(subtr,opASSIGN); + djSP; dATARGET; tryAMAGICbin(subtr,opASSIGN); { dPOPTOPnnrl_ul; SETn( left - right ); @@ -931,7 +938,7 @@ PP(pp_subtract) PP(pp_left_shift) { - dSP; dATARGET; tryAMAGICbin(lshift,opASSIGN); + djSP; dATARGET; tryAMAGICbin(lshift,opASSIGN); { IBW shift = POPi; if (op->op_private & HINT_INTEGER) { @@ -950,7 +957,7 @@ PP(pp_left_shift) PP(pp_right_shift) { - dSP; dATARGET; tryAMAGICbin(rshift,opASSIGN); + djSP; dATARGET; tryAMAGICbin(rshift,opASSIGN); { IBW shift = POPi; if (op->op_private & HINT_INTEGER) { @@ -969,7 +976,7 @@ PP(pp_right_shift) PP(pp_lt) { - dSP; tryAMAGICbinSET(lt,0); + djSP; tryAMAGICbinSET(lt,0); { dPOPnv; SETs(boolSV(TOPn < value)); @@ -979,7 +986,7 @@ PP(pp_lt) PP(pp_gt) { - dSP; tryAMAGICbinSET(gt,0); + djSP; tryAMAGICbinSET(gt,0); { dPOPnv; SETs(boolSV(TOPn > value)); @@ -989,7 +996,7 @@ PP(pp_gt) PP(pp_le) { - dSP; tryAMAGICbinSET(le,0); + djSP; tryAMAGICbinSET(le,0); { dPOPnv; SETs(boolSV(TOPn <= value)); @@ -999,7 +1006,7 @@ PP(pp_le) PP(pp_ge) { - dSP; tryAMAGICbinSET(ge,0); + djSP; tryAMAGICbinSET(ge,0); { dPOPnv; SETs(boolSV(TOPn >= value)); @@ -1009,7 +1016,7 @@ PP(pp_ge) PP(pp_ne) { - dSP; tryAMAGICbinSET(ne,0); + djSP; tryAMAGICbinSET(ne,0); { dPOPnv; SETs(boolSV(TOPn != value)); @@ -1019,7 +1026,7 @@ PP(pp_ne) PP(pp_ncmp) { - dSP; dTARGET; tryAMAGICbin(ncmp,0); + djSP; dTARGET; tryAMAGICbin(ncmp,0); { dPOPTOPnnrl; I32 value; @@ -1041,7 +1048,7 @@ PP(pp_ncmp) PP(pp_slt) { - dSP; tryAMAGICbinSET(slt,0); + djSP; tryAMAGICbinSET(slt,0); { dPOPTOPssrl; int cmp = ((op->op_private & OPpLOCALE) @@ -1054,7 +1061,7 @@ PP(pp_slt) PP(pp_sgt) { - dSP; tryAMAGICbinSET(sgt,0); + djSP; tryAMAGICbinSET(sgt,0); { dPOPTOPssrl; int cmp = ((op->op_private & OPpLOCALE) @@ -1067,7 +1074,7 @@ PP(pp_sgt) PP(pp_sle) { - dSP; tryAMAGICbinSET(sle,0); + djSP; tryAMAGICbinSET(sle,0); { dPOPTOPssrl; int cmp = ((op->op_private & OPpLOCALE) @@ -1080,7 +1087,7 @@ PP(pp_sle) PP(pp_sge) { - dSP; tryAMAGICbinSET(sge,0); + djSP; tryAMAGICbinSET(sge,0); { dPOPTOPssrl; int cmp = ((op->op_private & OPpLOCALE) @@ -1093,7 +1100,7 @@ PP(pp_sge) PP(pp_seq) { - dSP; tryAMAGICbinSET(seq,0); + djSP; tryAMAGICbinSET(seq,0); { dPOPTOPssrl; SETs(boolSV(sv_eq(left, right))); @@ -1103,7 +1110,7 @@ PP(pp_seq) PP(pp_sne) { - dSP; tryAMAGICbinSET(sne,0); + djSP; tryAMAGICbinSET(sne,0); { dPOPTOPssrl; SETs(boolSV(!sv_eq(left, right))); @@ -1113,7 +1120,7 @@ PP(pp_sne) PP(pp_scmp) { - dSP; dTARGET; tryAMAGICbin(scmp,0); + djSP; dTARGET; tryAMAGICbin(scmp,0); { dPOPTOPssrl; int cmp = ((op->op_private & OPpLOCALE) @@ -1126,7 +1133,7 @@ PP(pp_scmp) PP(pp_bit_and) { - dSP; dATARGET; tryAMAGICbin(band,opASSIGN); + djSP; dATARGET; tryAMAGICbin(band,opASSIGN); { dPOPTOPssrl; if (SvNIOKp(left) || SvNIOKp(right)) { @@ -1149,7 +1156,7 @@ PP(pp_bit_and) PP(pp_bit_xor) { - dSP; dATARGET; tryAMAGICbin(bxor,opASSIGN); + djSP; dATARGET; tryAMAGICbin(bxor,opASSIGN); { dPOPTOPssrl; if (SvNIOKp(left) || SvNIOKp(right)) { @@ -1172,7 +1179,7 @@ PP(pp_bit_xor) PP(pp_bit_or) { - dSP; dATARGET; tryAMAGICbin(bor,opASSIGN); + djSP; dATARGET; tryAMAGICbin(bor,opASSIGN); { dPOPTOPssrl; if (SvNIOKp(left) || SvNIOKp(right)) { @@ -1195,7 +1202,7 @@ PP(pp_bit_or) PP(pp_negate) { - dSP; dTARGET; tryAMAGICun(neg); + djSP; dTARGET; tryAMAGICun(neg); { dTOPss; if (SvGMAGICAL(sv)) @@ -1228,7 +1235,7 @@ PP(pp_negate) PP(pp_not) { #ifdef OVERLOAD - dSP; tryAMAGICunSET(not); + djSP; tryAMAGICunSET(not); #endif /* OVERLOAD */ *stack_sp = boolSV(!SvTRUE(*stack_sp)); return NORMAL; @@ -1236,7 +1243,7 @@ PP(pp_not) PP(pp_complement) { - dSP; dTARGET; tryAMAGICun(compl); + djSP; dTARGET; tryAMAGICun(compl); { dTOPss; if (SvNIOKp(sv)) { @@ -1279,7 +1286,7 @@ PP(pp_complement) PP(pp_i_multiply) { - dSP; dATARGET; tryAMAGICbin(mult,opASSIGN); + djSP; dATARGET; tryAMAGICbin(mult,opASSIGN); { dPOPTOPiirl; SETi( left * right ); @@ -1289,7 +1296,7 @@ PP(pp_i_multiply) PP(pp_i_divide) { - dSP; dATARGET; tryAMAGICbin(div,opASSIGN); + djSP; dATARGET; tryAMAGICbin(div,opASSIGN); { dPOPiv; if (value == 0) @@ -1302,7 +1309,7 @@ PP(pp_i_divide) PP(pp_i_modulo) { - dSP; dATARGET; tryAMAGICbin(mod,opASSIGN); + djSP; dATARGET; tryAMAGICbin(mod,opASSIGN); { dPOPTOPiirl; if (!right) @@ -1314,7 +1321,7 @@ PP(pp_i_modulo) PP(pp_i_add) { - dSP; dATARGET; tryAMAGICbin(add,opASSIGN); + djSP; dATARGET; tryAMAGICbin(add,opASSIGN); { dPOPTOPiirl; SETi( left + right ); @@ -1324,7 +1331,7 @@ PP(pp_i_add) PP(pp_i_subtract) { - dSP; dATARGET; tryAMAGICbin(subtr,opASSIGN); + djSP; dATARGET; tryAMAGICbin(subtr,opASSIGN); { dPOPTOPiirl; SETi( left - right ); @@ -1334,7 +1341,7 @@ PP(pp_i_subtract) PP(pp_i_lt) { - dSP; tryAMAGICbinSET(lt,0); + djSP; tryAMAGICbinSET(lt,0); { dPOPTOPiirl; SETs(boolSV(left < right)); @@ -1344,7 +1351,7 @@ PP(pp_i_lt) PP(pp_i_gt) { - dSP; tryAMAGICbinSET(gt,0); + djSP; tryAMAGICbinSET(gt,0); { dPOPTOPiirl; SETs(boolSV(left > right)); @@ -1354,7 +1361,7 @@ PP(pp_i_gt) PP(pp_i_le) { - dSP; tryAMAGICbinSET(le,0); + djSP; tryAMAGICbinSET(le,0); { dPOPTOPiirl; SETs(boolSV(left <= right)); @@ -1364,7 +1371,7 @@ PP(pp_i_le) PP(pp_i_ge) { - dSP; tryAMAGICbinSET(ge,0); + djSP; tryAMAGICbinSET(ge,0); { dPOPTOPiirl; SETs(boolSV(left >= right)); @@ -1374,7 +1381,7 @@ PP(pp_i_ge) PP(pp_i_eq) { - dSP; tryAMAGICbinSET(eq,0); + djSP; tryAMAGICbinSET(eq,0); { dPOPTOPiirl; SETs(boolSV(left == right)); @@ -1384,7 +1391,7 @@ PP(pp_i_eq) PP(pp_i_ne) { - dSP; tryAMAGICbinSET(ne,0); + djSP; tryAMAGICbinSET(ne,0); { dPOPTOPiirl; SETs(boolSV(left != right)); @@ -1394,7 +1401,7 @@ PP(pp_i_ne) PP(pp_i_ncmp) { - dSP; dTARGET; tryAMAGICbin(ncmp,0); + djSP; dTARGET; tryAMAGICbin(ncmp,0); { dPOPTOPiirl; I32 value; @@ -1412,7 +1419,7 @@ PP(pp_i_ncmp) PP(pp_i_negate) { - dSP; dTARGET; tryAMAGICun(neg); + djSP; dTARGET; tryAMAGICun(neg); SETi(-TOPi); RETURN; } @@ -1421,7 +1428,7 @@ PP(pp_i_negate) PP(pp_atan2) { - dSP; dTARGET; tryAMAGICbin(atan2,0); + djSP; dTARGET; tryAMAGICbin(atan2,0); { dPOPTOPnnrl; SETn(atan2(left, right)); @@ -1431,7 +1438,7 @@ PP(pp_atan2) PP(pp_sin) { - dSP; dTARGET; tryAMAGICun(sin); + djSP; dTARGET; tryAMAGICun(sin); { double value; value = POPn; @@ -1443,7 +1450,7 @@ PP(pp_sin) PP(pp_cos) { - dSP; dTARGET; tryAMAGICun(cos); + djSP; dTARGET; tryAMAGICun(cos); { double value; value = POPn; @@ -1455,7 +1462,7 @@ PP(pp_cos) PP(pp_rand) { - dSP; dTARGET; + djSP; dTARGET; double value; if (MAXARG < 1) value = 1.0; @@ -1486,7 +1493,7 @@ PP(pp_rand) PP(pp_srand) { - dSP; + djSP; UV anum; if (MAXARG < 1) anum = seed(); @@ -1499,7 +1506,7 @@ PP(pp_srand) } static U32 -seed() +seed(void) { /* * This is really just a quick hack which grabs various garbage @@ -1553,7 +1560,7 @@ seed() PP(pp_exp) { - dSP; dTARGET; tryAMAGICun(exp); + djSP; dTARGET; tryAMAGICun(exp); { double value; value = POPn; @@ -1565,7 +1572,7 @@ PP(pp_exp) PP(pp_log) { - dSP; dTARGET; tryAMAGICun(log); + djSP; dTARGET; tryAMAGICun(log); { double value; value = POPn; @@ -1581,7 +1588,7 @@ PP(pp_log) PP(pp_sqrt) { - dSP; dTARGET; tryAMAGICun(sqrt); + djSP; dTARGET; tryAMAGICun(sqrt); { double value; value = POPn; @@ -1597,7 +1604,7 @@ PP(pp_sqrt) PP(pp_int) { - dSP; dTARGET; + djSP; dTARGET; { double value = TOPn; IV iv; @@ -1625,7 +1632,7 @@ PP(pp_int) PP(pp_abs) { - dSP; dTARGET; tryAMAGICun(abs); + djSP; dTARGET; tryAMAGICun(abs); { double value = TOPn; IV iv; @@ -1647,7 +1654,7 @@ PP(pp_abs) PP(pp_hex) { - dSP; dTARGET; + djSP; dTARGET; char *tmps; I32 argtype; @@ -1658,7 +1665,7 @@ PP(pp_hex) PP(pp_oct) { - dSP; dTARGET; + djSP; dTARGET; UV value; I32 argtype; char *tmps; @@ -1680,14 +1687,14 @@ PP(pp_oct) PP(pp_length) { - dSP; dTARGET; + djSP; dTARGET; SETi( sv_len(TOPs) ); RETURN; } PP(pp_substr) { - dSP; dTARGET; + djSP; dTARGET; SV *sv; I32 len; STRLEN curlen; @@ -1774,7 +1781,7 @@ PP(pp_substr) PP(pp_vec) { - dSP; dTARGET; + djSP; dTARGET; register I32 size = POPi; register I32 offset = POPi; register SV *src = POPs; @@ -1848,7 +1855,7 @@ PP(pp_vec) PP(pp_index) { - dSP; dTARGET; + djSP; dTARGET; SV *big; SV *little; I32 offset; @@ -1880,7 +1887,7 @@ PP(pp_index) PP(pp_rindex) { - dSP; dTARGET; + djSP; dTARGET; SV *big; SV *little; STRLEN blen; @@ -1917,7 +1924,7 @@ PP(pp_rindex) PP(pp_sprintf) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; #ifdef USE_LOCALE_NUMERIC if (op->op_private & OPpLOCALE) SET_NUMERIC_LOCAL(); @@ -1933,7 +1940,7 @@ PP(pp_sprintf) PP(pp_ord) { - dSP; dTARGET; + djSP; dTARGET; I32 value; char *tmps; @@ -1952,7 +1959,7 @@ PP(pp_ord) PP(pp_chr) { - dSP; dTARGET; + djSP; dTARGET; char *tmps; (void)SvUPGRADE(TARG,SVt_PV); @@ -1968,7 +1975,7 @@ PP(pp_chr) PP(pp_crypt) { - dSP; dTARGET; dPOPTOPssrl; + djSP; dTARGET; dPOPTOPssrl; #ifdef HAS_CRYPT char *tmps = SvPV(left, na); #ifdef FCRYPT @@ -1986,7 +1993,7 @@ PP(pp_crypt) PP(pp_ucfirst) { - dSP; + djSP; SV *sv = TOPs; register char *s; @@ -2012,7 +2019,7 @@ PP(pp_ucfirst) PP(pp_lcfirst) { - dSP; + djSP; SV *sv = TOPs; register char *s; @@ -2039,7 +2046,7 @@ PP(pp_lcfirst) PP(pp_uc) { - dSP; + djSP; SV *sv = TOPs; register char *s; STRLEN len; @@ -2071,7 +2078,7 @@ PP(pp_uc) PP(pp_lc) { - dSP; + djSP; SV *sv = TOPs; register char *s; STRLEN len; @@ -2103,7 +2110,7 @@ PP(pp_lc) PP(pp_quotemeta) { - dSP; dTARGET; + djSP; dTARGET; SV *sv = TOPs; STRLEN len; register char *s = SvPV(sv,len); @@ -2132,7 +2139,7 @@ PP(pp_quotemeta) PP(pp_aslice) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; register SV** svp; register AV* av = (AV*)POPs; register I32 lval = op->op_flags & OPf_MOD; @@ -2177,7 +2184,7 @@ PP(pp_aslice) PP(pp_each) { - dSP; dTARGET; + djSP; dTARGET; HV *hash = (HV*)POPs; HE *entry; I32 gimme = GIMME_V; @@ -2218,7 +2225,7 @@ PP(pp_keys) PP(pp_delete) { - dSP; + djSP; I32 gimme = GIMME_V; I32 discard = (gimme == G_VOID) ? G_DISCARD : 0; SV *sv; @@ -2265,7 +2272,7 @@ PP(pp_delete) PP(pp_exists) { - dSP; + djSP; SV *tmpsv = POPs; HV *hv = (HV*)POPs; if (SvTYPE(hv) == SVt_PVHV) { @@ -2282,7 +2289,7 @@ PP(pp_exists) PP(pp_hslice) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; register HE *he; register HV *hv = (HV*)POPs; register I32 lval = op->op_flags & OPf_MOD; @@ -2319,7 +2326,7 @@ PP(pp_hslice) PP(pp_list) { - dSP; dMARK; + djSP; dMARK; if (GIMME != G_ARRAY) { if (++MARK <= SP) *MARK = *SP; /* unwanted list, return last item */ @@ -2332,7 +2339,7 @@ PP(pp_list) PP(pp_lslice) { - dSP; + djSP; SV **lastrelem = stack_sp; SV **lastlelem = stack_base + POPMARK; SV **firstlelem = stack_base + POPMARK + 1; @@ -2390,7 +2397,7 @@ PP(pp_lslice) PP(pp_anonlist) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; I32 items = SP - MARK; SV *av = sv_2mortal((SV*)av_make(items, MARK+1)); SP = ORIGMARK; /* av_make() might realloc stack_sp */ @@ -2400,7 +2407,7 @@ PP(pp_anonlist) PP(pp_anonhash) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; HV* hv = (HV*)sv_2mortal((SV*)newHV()); while (MARK < SP) { @@ -2419,7 +2426,7 @@ PP(pp_anonhash) PP(pp_splice) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; register AV *ary = (AV*)*++MARK; register SV **src; register SV **dst; @@ -2614,7 +2621,7 @@ PP(pp_splice) PP(pp_push) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; register AV *ary = (AV*)*++MARK; register SV *sv = &sv_undef; @@ -2631,7 +2638,7 @@ PP(pp_push) PP(pp_pop) { - dSP; + djSP; AV *av = (AV*)POPs; SV *sv = av_pop(av); if (!SvIMMORTAL(sv) && AvREAL(av)) @@ -2642,7 +2649,7 @@ PP(pp_pop) PP(pp_shift) { - dSP; + djSP; AV *av = (AV*)POPs; SV *sv = av_shift(av); EXTEND(SP, 1); @@ -2656,7 +2663,7 @@ PP(pp_shift) PP(pp_unshift) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; register AV *ary = (AV*)*++MARK; register SV *sv; register I32 i = 0; @@ -2675,7 +2682,7 @@ PP(pp_unshift) PP(pp_reverse) { - dSP; dMARK; + djSP; dMARK; register SV *tmp; SV **oldsp = SP; @@ -2716,9 +2723,7 @@ PP(pp_reverse) } static SV * -mul128(sv, m) - SV *sv; - U8 m; +mul128(SV *sv, U8 m) { STRLEN len; char *s = SvPV(sv, len); @@ -2726,11 +2731,11 @@ mul128(sv, m) U32 i = 0; if (!strnEQ(s, "0000", 4)) { /* need to grow sv */ - SV *new = newSVpv("0000000000", 10); + SV *New = newSVpv("0000000000", 10); - sv_catsv(new, sv); + sv_catsv(New, sv); SvREFCNT_dec(sv); /* free old sv */ - sv = new; + sv = New; s = SvPV(sv, len); } t = s + len - 1; @@ -2748,7 +2753,7 @@ mul128(sv, m) PP(pp_unpack) { - dSP; + djSP; dPOPPOPssrl; SV **oldsp = sp; I32 gimme = GIMME_V; @@ -3386,10 +3391,10 @@ PP(pp_unpack) d = (*s++ - ' ') & 077; else d = 0; - hunk[0] = a << 2 | b >> 4; - hunk[1] = b << 4 | c >> 2; - hunk[2] = c << 6 | d; - sv_catpvn(sv, hunk, len > 3 ? 3 : len); + hunk[0] = (a << 2) | (b >> 4); + hunk[1] = (b << 4) | (c >> 2); + hunk[2] = (c << 6) | d; + sv_catpvn(sv, hunk, (len > 3) ? 3 : len); len -= 3; } if (*s == '\n') @@ -3440,10 +3445,7 @@ PP(pp_unpack) } static void -doencodes(sv, s, len) -register SV *sv; -register char *s; -register I32 len; +doencodes(register SV *sv, register char *s, register I32 len) { char hunk[5]; @@ -3452,8 +3454,8 @@ register I32 len; hunk[4] = '\0'; while (len > 0) { hunk[0] = ' ' + (077 & (*s >> 2)); - hunk[1] = ' ' + (077 & ((*s << 4) & 060 | (s[1] >> 4) & 017)); - hunk[2] = ' ' + (077 & ((s[1] << 2) & 074 | (s[2] >> 6) & 03)); + hunk[1] = ' ' + (077 & (((*s << 4) & 060) | ((s[1] >> 4) & 017))); + hunk[2] = ' ' + (077 & (((s[1] << 2) & 074) | ((s[2] >> 6) & 03))); hunk[3] = ' ' + (077 & (s[2] & 077)); sv_catpvn(sv, hunk, 4); s += 3; @@ -3467,9 +3469,7 @@ register I32 len; } static SV * -is_an_int(s, l) - char *s; - STRLEN l; +is_an_int(char *s, STRLEN l) { SV *result = newSVpv("", l); char *result_c = SvPV(result, na); /* convenience */ @@ -3517,9 +3517,9 @@ is_an_int(s, l) } static int -div128(pnum, done) - SV *pnum; /* must be '\0' terminated */ - bool *done; +div128(SV *pnum, char *done) + /* must be '\0' terminated */ + { STRLEN len; char *s = SvPV(pnum, len); @@ -3547,7 +3547,7 @@ div128(pnum, done) PP(pp_pack) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; register SV *cat = TARG; register I32 items; STRLEN fromlen; @@ -4013,7 +4013,7 @@ PP(pp_pack) PP(pp_split) { - dSP; dTARG; + djSP; dTARG; AV *ary; register I32 limit = POPi; /* note, negative is forever */ SV *sv = POPs; @@ -4243,8 +4243,7 @@ PP(pp_split) #ifdef USE_THREADS void -unlock_condpair(svv) -void *svv; +unlock_condpair(void *svv) { dTHR; MAGIC *mg = mg_find((SV*)svv, 'm'); @@ -4264,7 +4263,7 @@ void *svv; PP(pp_lock) { - dSP; + djSP; dTOPss; SV *retsv = sv; #ifdef USE_THREADS @@ -4296,20 +4295,20 @@ PP(pp_lock) RETURN; } -PP(pp_specific) +PP(pp_threadsv) { - dSP; + djSP; #ifdef USE_THREADS SV **svp = av_fetch(thr->magicals, op->op_targ, FALSE); if (!svp) - croak("panic: pp_specific"); + croak("panic: pp_threadsv"); EXTEND(sp, 1); if (op->op_private & OPpLVAL_INTRO) PUSHs(save_svref(svp)); else PUSHs(*svp); #else - DIE("tried to access thread-specific data in non-threaded perl"); + DIE("tried to access per-thread data in non-threaded perl"); #endif /* USE_THREADS */ RETURN; } @@ -10,12 +10,15 @@ #ifdef USE_THREADS #define ARGS thr #define dARGS struct thread *thr; -#define PP(s) OP* s(ARGS) dARGS #else #define ARGS #define dARGS -#define PP(s) OP* s(ARGS) dARGS #endif /* USE_THREADS */ +#ifdef CAN_PROTOTYPE +#define PP(s) OP * s(ARGSproto) +#else /* CAN_PROTOTYPE */ +#define PP(s) OP* s(ARGS) dARGS +#endif /* CAN_PROTOTYPE */ #define SP sp #define MARK mark @@ -28,7 +31,8 @@ #define TOPMARK (*markstack_ptr) #define POPMARK (*markstack_ptr--) -#define dSP register SV **sp = stack_sp +#define djSP register SV **sp = stack_sp +#define dSP dTHR; djSP #define dMARK register SV **mark = stack_base + POPMARK #define dORIGMARK I32 origmark = mark - stack_base #define SETORIGMARK origmark = mark - stack_base @@ -42,7 +42,7 @@ static I32 sortcxix; PP(pp_wantarray) { - dSP; + djSP; I32 cxix; EXTEND(SP, 1); @@ -66,7 +66,7 @@ PP(pp_regcmaybe) } PP(pp_regcomp) { - dSP; + djSP; register PMOP *pm = (PMOP*)cLOGOP->op_other; register char *t; SV *tmpstr; @@ -103,7 +103,7 @@ PP(pp_regcomp) { PP(pp_substcont) { - dSP; + djSP; register PMOP *pm = (PMOP*) cLOGOP->op_other; register CONTEXT *cx = &cxstack[cxstack_ix]; register SV *dstr = cx->sb_dstr; @@ -164,9 +164,7 @@ PP(pp_substcont) } void -rxres_save(rsp, rx) -void **rsp; -REGEXP *rx; +rxres_save(void **rsp, REGEXP *rx) { UV *p = (UV*)*rsp; U32 i; @@ -194,9 +192,7 @@ REGEXP *rx; } void -rxres_restore(rsp, rx) -void **rsp; -REGEXP *rx; +rxres_restore(void **rsp, REGEXP *rx) { UV *p = (UV*)*rsp; U32 i; @@ -216,8 +212,7 @@ REGEXP *rx; } void -rxres_free(rsp) -void **rsp; +rxres_free(void **rsp) { UV *p = (UV*)*rsp; @@ -230,7 +225,7 @@ void **rsp; PP(pp_formline) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; register SV *form = *++MARK; register U16 *fpc; register char *t; @@ -523,7 +518,7 @@ PP(pp_formline) PP(pp_grepstart) { - dSP; + djSP; SV *src; if (stack_base + *markstack_ptr == sp) { @@ -560,7 +555,7 @@ PP(pp_mapstart) PP(pp_mapwhile) { - dSP; + djSP; I32 diff = (sp - stack_base) - *markstack_ptr; I32 count; I32 shift; @@ -624,7 +619,7 @@ PP(pp_mapwhile) PP(pp_sort) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; register SV **up; SV **myorigmark = ORIGMARK; register I32 max; @@ -758,7 +753,7 @@ PP(pp_range) PP(pp_flip) { - dSP; + djSP; if (GIMME == G_ARRAY) { RETURNOP(((CONDOP*)cUNOP->op_first)->op_false); @@ -790,7 +785,7 @@ PP(pp_flip) PP(pp_flop) { - dSP; + djSP; if (GIMME == G_ARRAY) { dPOPPOPssrl; @@ -847,8 +842,7 @@ PP(pp_flop) /* Control. */ static I32 -dopoptolabel(label) -char *label; +dopoptolabel(char *label) { dTHR; register I32 i; @@ -888,14 +882,14 @@ char *label; } I32 -dowantarray() +dowantarray(void) { I32 gimme = block_gimme(); return (gimme == G_VOID) ? G_SCALAR : gimme; } I32 -block_gimme() +block_gimme(void) { dTHR; I32 cxix; @@ -905,20 +899,19 @@ block_gimme() return G_VOID; switch (cxstack[cxix].blk_gimme) { - case G_VOID: - return G_VOID; case G_SCALAR: return G_SCALAR; case G_ARRAY: return G_ARRAY; default: croak("panic: bad gimme: %d\n", cxstack[cxix].blk_gimme); + case G_VOID: + return G_VOID; } } static I32 -dopoptosub(startingblock) -I32 startingblock; +dopoptosub(I32 startingblock) { dTHR; I32 i; @@ -938,8 +931,7 @@ I32 startingblock; } static I32 -dopoptoeval(startingblock) -I32 startingblock; +dopoptoeval(I32 startingblock) { dTHR; I32 i; @@ -958,8 +950,7 @@ I32 startingblock; } static I32 -dopoptoloop(startingblock) -I32 startingblock; +dopoptoloop(I32 startingblock) { dTHR; I32 i; @@ -992,8 +983,7 @@ I32 startingblock; } void -dounwind(cxix) -I32 cxix; +dounwind(I32 cxix) { dTHR; register CONTEXT *cx; @@ -1026,8 +1016,7 @@ I32 cxix; } OP * -die_where(message) -char *message; +die_where(char *message) { dTHR; if (in_eval) { @@ -1040,21 +1029,21 @@ char *message; SV **svp; STRLEN klen = strlen(message); - svp = hv_fetch(errhv, message, klen, TRUE); + svp = hv_fetch(ERRHV, message, klen, TRUE); if (svp) { if (!SvIOK(*svp)) { static char prefix[] = "\t(in cleanup) "; sv_upgrade(*svp, SVt_IV); (void)SvIOK_only(*svp); - SvGROW(errsv, SvCUR(errsv)+sizeof(prefix)+klen); - sv_catpvn(errsv, prefix, sizeof(prefix)-1); - sv_catpvn(errsv, message, klen); + SvGROW(ERRSV, SvCUR(ERRSV)+sizeof(prefix)+klen); + sv_catpvn(ERRSV, prefix, sizeof(prefix)-1); + sv_catpvn(ERRSV, message, klen); } sv_inc(*svp); } } else - sv_setpv(errsv, message); + sv_setpv(ERRSV, message); cxix = dopoptoeval(cxstack_ix); if (cxix >= 0) { @@ -1077,7 +1066,7 @@ char *message; LEAVE; if (optype == OP_REQUIRE) { - char* msg = SvPV(errsv, na); + char* msg = SvPVx(ERRSV, na); DIE("%s", *msg ? msg : "Compilation failed in require"); } return pop_return(); @@ -1092,7 +1081,7 @@ char *message; PP(pp_xor) { - dSP; dPOPTOPssrl; + djSP; dPOPTOPssrl; if (SvTRUE(left) != SvTRUE(right)) RETSETYES; else @@ -1101,7 +1090,7 @@ PP(pp_xor) PP(pp_andassign) { - dSP; + djSP; if (!SvTRUE(TOPs)) RETURN; else @@ -1110,7 +1099,7 @@ PP(pp_andassign) PP(pp_orassign) { - dSP; + djSP; if (SvTRUE(TOPs)) RETURN; else @@ -1119,7 +1108,7 @@ PP(pp_orassign) PP(pp_caller) { - dSP; + djSP; register I32 cxix = dopoptosub(cxstack_ix); register CONTEXT *cx; I32 dbcxix; @@ -1215,9 +1204,7 @@ PP(pp_caller) } static int -sortcv(a, b) -const void *a; -const void *b; +sortcv(const void *a, const void *b) { dTHR; SV * const *str1 = (SV * const *)a; @@ -1243,24 +1230,20 @@ const void *b; } static int -sortcmp(a, b) -const void *a; -const void *b; +sortcmp(const void *a, const void *b) { return sv_cmp(*(SV * const *)a, *(SV * const *)b); } static int -sortcmp_locale(a, b) -const void *a; -const void *b; +sortcmp_locale(const void *a, const void *b) { return sv_cmp_locale(*(SV * const *)a, *(SV * const *)b); } PP(pp_reset) { - dSP; + djSP; char *tmps; if (MAXARG < 1) @@ -1330,7 +1313,7 @@ PP(pp_scope) PP(pp_enteriter) { - dSP; dMARK; + djSP; dMARK; register CONTEXT *cx; I32 gimme = GIMME_V; SV **svp; @@ -1362,7 +1345,7 @@ PP(pp_enteriter) PP(pp_enterloop) { - dSP; + djSP; register CONTEXT *cx; I32 gimme = GIMME_V; @@ -1378,7 +1361,7 @@ PP(pp_enterloop) PP(pp_leaveloop) { - dSP; + djSP; register CONTEXT *cx; struct block_loop cxloop; I32 gimme; @@ -1419,7 +1402,7 @@ PP(pp_leaveloop) PP(pp_return) { - dSP; dMARK; + djSP; dMARK; I32 cxix; register CONTEXT *cx; struct block_sub cxsub; @@ -1495,7 +1478,7 @@ PP(pp_return) PP(pp_last) { - dSP; + djSP; I32 cxix; register CONTEXT *cx; struct block_loop cxloop; @@ -1628,11 +1611,7 @@ PP(pp_redo) static OP* lastgotoprobe; static OP * -dofindlabel(o,label,opstack,oplimit) -OP *o; -char *label; -OP **opstack; -OP **oplimit; +dofindlabel(OP *o, char *label, OP **opstack, OP **oplimit) { OP *kid; OP **ops = opstack; @@ -1681,7 +1660,7 @@ PP(pp_dump) PP(pp_goto) { - dSP; + djSP; OP *retop = 0; I32 ix; register CONTEXT *cx; @@ -1988,7 +1967,7 @@ PP(pp_goto) PP(pp_exit) { - dSP; + djSP; I32 anum; if (MAXARG < 1) @@ -2008,7 +1987,7 @@ PP(pp_exit) #ifdef NOTYET PP(pp_nswitch) { - dSP; + djSP; double value = SvNVx(GvSV(cCOP->cop_gv)); register I32 match = I_32(value); @@ -2027,7 +2006,7 @@ PP(pp_nswitch) PP(pp_cswitch) { - dSP; + djSP; register I32 match; if (multiline) @@ -2048,9 +2027,7 @@ PP(pp_cswitch) /* Eval. */ static void -save_lines(array, sv) -AV *array; -SV *sv; +save_lines(AV *array, SV *sv) { register char *s = SvPVX(sv); register char *send = SvPVX(sv) + SvCUR(sv); @@ -2074,8 +2051,7 @@ SV *sv; } static OP * -docatch(o) -OP *o; +docatch(OP *o) { dTHR; int ret; @@ -2113,10 +2089,8 @@ OP *o; /* With USE_THREADS, eval_owner must be held on entry to doeval */ static OP * -doeval(gimme) -int gimme; +doeval(int gimme) { - dTHR; dSP; OP *saveop = op; HV *newstash; @@ -2194,7 +2168,7 @@ int gimme; if (saveop->op_flags & OPf_SPECIAL) in_eval |= 4; else - sv_setpv(errsv,""); + sv_setpv(ERRSV,""); if (yyparse() || error_count || !eval_root) { SV **newsp; I32 gimme; @@ -2213,7 +2187,7 @@ int gimme; lex_end(); LEAVE; if (optype == OP_REQUIRE) { - char* msg = SvPV(errsv, na); + char* msg = SvPVx(ERRSV, na); DIE("%s", *msg ? msg : "Compilation failed in require"); } SvREFCNT_dec(rs); @@ -2268,7 +2242,7 @@ int gimme; PP(pp_require) { - dSP; + djSP; register CONTEXT *cx; SV *sv; char *name; @@ -2418,7 +2392,7 @@ PP(pp_dofile) PP(pp_entereval) { - dSP; + djSP; register CONTEXT *cx; dPOPss; I32 gimme = GIMME_V, was = sub_generation; @@ -2478,7 +2452,7 @@ PP(pp_entereval) PP(pp_leaveeval) { - dSP; + djSP; register SV **mark; SV **newsp; PMOP *newpm; @@ -2567,14 +2541,14 @@ PP(pp_leaveeval) LEAVE; if (!(save_flags & OPf_SPECIAL)) - sv_setpv(errsv,""); + sv_setpv(ERRSV,""); RETURNOP(retop); } PP(pp_entertry) { - dSP; + djSP; register CONTEXT *cx; I32 gimme = GIMME_V; @@ -2587,14 +2561,14 @@ PP(pp_entertry) eval_root = op; /* Only needed so that goto works right. */ in_eval = 1; - sv_setpv(errsv,""); + sv_setpv(ERRSV,""); PUTBACK; return DOCATCH(op->op_next); } PP(pp_leavetry) { - dSP; + djSP; register SV **mark; SV **newsp; PMOP *newpm; @@ -2635,13 +2609,12 @@ PP(pp_leavetry) curpm = newpm; /* Don't pop $1 et al till now */ LEAVE; - sv_setpv(errsv,""); + sv_setpv(ERRSV,""); RETURN; } static void -doparseform(sv) -SV *sv; +doparseform(SV *sv) { STRLEN len; register char *s = SvPV_force(sv, len); @@ -2817,3 +2790,4 @@ SV *sv; sv_magic(sv, Nullsv, 'f', Nullch, 0); SvCOMPILED_on(sv); } + @@ -18,12 +18,15 @@ #include "EXTERN.h" #include "perl.h" +#ifdef I_UNISTD +#include <unistd.h> +#endif + /* Hot code. */ #ifdef USE_THREADS static void -unset_cvowner(cvarg) -void *cvarg; +unset_cvowner(void *cvarg) { register CV* cv = (CV *) cvarg; #ifdef DEBUGGING @@ -45,7 +48,7 @@ void *cvarg; PP(pp_const) { - dSP; + djSP; XPUSHs(cSVOP->op_sv); RETURN; } @@ -61,7 +64,7 @@ PP(pp_nextstate) PP(pp_gvsv) { - dSP; + djSP; EXTEND(sp,1); if (op->op_private & OPpLVAL_INTRO) PUSHs(save_scalar(cGVOP->op_gv)); @@ -83,7 +86,7 @@ PP(pp_pushmark) PP(pp_stringify) { - dSP; dTARGET; + djSP; dTARGET; STRLEN len; char *s; s = SvPV(TOPs,len); @@ -94,14 +97,14 @@ PP(pp_stringify) PP(pp_gv) { - dSP; + djSP; XPUSHs((SV*)cGVOP->op_gv); RETURN; } PP(pp_and) { - dSP; + djSP; if (!SvTRUE(TOPs)) RETURN; else { @@ -112,7 +115,7 @@ PP(pp_and) PP(pp_sassign) { - dSP; dPOPTOPssrl; + djSP; dPOPTOPssrl; MAGIC *mg; if (op->op_private & OPpASSIGN_BACKWARDS) { @@ -128,7 +131,7 @@ PP(pp_sassign) PP(pp_cond_expr) { - dSP; + djSP; if (SvTRUEx(POPs)) RETURNOP(cCONDOP->op_true); else @@ -148,7 +151,7 @@ PP(pp_unstack) PP(pp_concat) { - dSP; dATARGET; tryAMAGICbin(concat,opASSIGN); + djSP; dATARGET; tryAMAGICbin(concat,opASSIGN); { dPOPTOPssrl; STRLEN len; @@ -175,7 +178,7 @@ PP(pp_concat) PP(pp_padsv) { - dSP; dTARGET; + djSP; dTARGET; XPUSHs(TARG); if (op->op_flags & OPf_MOD) { if (op->op_private & OPpLVAL_INTRO) @@ -194,7 +197,7 @@ PP(pp_readline) PP(pp_eq) { - dSP; tryAMAGICbinSET(eq,0); + djSP; tryAMAGICbinSET(eq,0); { dPOPnv; SETs(boolSV(TOPn == value)); @@ -204,7 +207,7 @@ PP(pp_eq) PP(pp_preinc) { - dSP; + djSP; if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV) croak(no_modify); if (SvIOK(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) && @@ -221,7 +224,7 @@ PP(pp_preinc) PP(pp_or) { - dSP; + djSP; if (SvTRUE(TOPs)) RETURN; else { @@ -232,7 +235,7 @@ PP(pp_or) PP(pp_add) { - dSP; dATARGET; tryAMAGICbin(add,opASSIGN); + djSP; dATARGET; tryAMAGICbin(add,opASSIGN); { dPOPTOPnnrl_ul; SETn( left + right ); @@ -242,7 +245,7 @@ PP(pp_add) PP(pp_aelemfast) { - dSP; + djSP; AV *av = GvAV((GV*)cSVOP->op_sv); SV** svp = av_fetch(av, op->op_private, op->op_flags & OPf_MOD); PUSHs(svp ? *svp : &sv_undef); @@ -251,7 +254,7 @@ PP(pp_aelemfast) PP(pp_join) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; MARK++; do_join(TARG, *MARK, MARK, SP); SP = MARK; @@ -261,7 +264,7 @@ PP(pp_join) PP(pp_pushre) { - dSP; + djSP; #ifdef DEBUGGING /* * We ass_u_me that LvTARGOFF() comes first, and that two STRLENs @@ -282,7 +285,7 @@ PP(pp_pushre) PP(pp_print) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; GV *gv; IO *io; register PerlIO *fp; @@ -379,7 +382,7 @@ PP(pp_print) PP(pp_rv2av) { - dSP; dPOPss; + djSP; dPOPss; AV *av; if (SvROK(sv)) { @@ -454,7 +457,7 @@ PP(pp_rv2av) PP(pp_rv2hv) { - dSP; dTOPss; + djSP; dTOPss; HV *hv; if (SvROK(sv)) { @@ -535,7 +538,7 @@ PP(pp_rv2hv) PP(pp_aassign) { - dSP; + djSP; SV **lastlelem = stack_sp; SV **lastrelem = stack_base + POPMARK; SV **firstrelem = stack_base + POPMARK + 1; @@ -737,7 +740,7 @@ PP(pp_aassign) PP(pp_match) { - dSP; dTARG; + djSP; dTARG; register PMOP *pm = cPMOP; register char *t; register char *s; @@ -947,9 +950,8 @@ ret_no: } OP * -do_readline() +do_readline(void) { - dTHR; dSP; dTARGETSTACKED; register SV *sv; STRLEN tmplen = 0; @@ -1208,7 +1210,7 @@ do_readline() PP(pp_enter) { - dSP; + djSP; register CONTEXT *cx; I32 gimme = OP_GIMME(op, -1); @@ -1229,7 +1231,7 @@ PP(pp_enter) PP(pp_helem) { - dSP; + djSP; HE* he; SV **svp; SV *keysv = POPs; @@ -1278,7 +1280,7 @@ PP(pp_helem) PP(pp_leave) { - dSP; + djSP; register CONTEXT *cx; register SV **mark; SV **newsp; @@ -1334,7 +1336,7 @@ PP(pp_leave) PP(pp_iter) { - dSP; + djSP; register CONTEXT *cx; SV* sv; AV* av; @@ -1370,7 +1372,7 @@ PP(pp_iter) } LvTARG(lv) = SvREFCNT_inc(av); LvTARGOFF(lv) = cx->blk_loop.iterix; - LvTARGLEN(lv) = -1; + LvTARGLEN(lv) = (UV) -1; sv = (SV*)lv; } @@ -1380,7 +1382,7 @@ PP(pp_iter) PP(pp_subst) { - dSP; dTARG; + djSP; dTARG; register PMOP *pm = cPMOP; PMOP *rpm = pm; register SV *dstr; @@ -1632,7 +1634,7 @@ ret_no: PP(pp_grepwhile) { - dSP; + djSP; if (SvTRUEx(POPs)) stack_base[markstack_ptr[-1]++] = stack_base[*markstack_ptr]; @@ -1673,7 +1675,7 @@ PP(pp_grepwhile) PP(pp_leavesub) { - dSP; + djSP; SV **mark; SV **newsp; PMOP *newpm; @@ -1713,9 +1715,7 @@ PP(pp_leavesub) } static CV * -get_db_sub(svp, cv) -SV **svp; -CV *cv; +get_db_sub(SV **svp, CV *cv) { dTHR; SV *oldsv = *svp; @@ -1744,7 +1744,7 @@ CV *cv; PP(pp_entersub) { - dSP; dPOPss; + djSP; dPOPss; GV *gv; HV *stash; register CV *cv; @@ -2144,8 +2144,7 @@ PP(pp_entersub) } void -sub_crush_depth(cv) -CV* cv; +sub_crush_depth(CV *cv) { if (CvANON(cv)) warn("Deep recursion on anonymous subroutine"); @@ -2158,7 +2157,7 @@ CV* cv; PP(pp_aelem) { - dSP; + djSP; SV** svp; I32 elem = POPi; AV* av = (AV*)POPs; @@ -2195,9 +2194,7 @@ PP(pp_aelem) } void -vivify_ref(sv, to_what) -SV* sv; -U32 to_what; +vivify_ref(SV *sv, U32 to_what) { if (SvGMAGICAL(sv)) mg_get(sv); @@ -2229,7 +2226,7 @@ U32 to_what; PP(pp_method) { - dSP; + djSP; SV* sv; SV* ob; GV* gv; @@ -22,6 +22,12 @@ # include <unistd.h> #endif +#ifdef HAS_SYSCALL +#ifdef __cplusplus +extern "C" int syscall(unsigned long,...); +#endif +#endif + #ifdef I_SYS_WAIT # include <sys/wait.h> #endif @@ -169,7 +175,7 @@ static char zero_but_true[ZBTLEN + 1] = "0 but true"; PP(pp_backtick) { - dSP; dTARGET; + djSP; dTARGET; PerlIO *fp; char *tmps = POPp; I32 gimme = GIMME_V; @@ -266,7 +272,7 @@ PP(pp_rcatline) PP(pp_warn) { - dSP; dMARK; + djSP; dMARK; char *tmps; if (SP - MARK != 1) { dTARGET; @@ -278,10 +284,10 @@ PP(pp_warn) tmps = SvPV(TOPs, na); } if (!tmps || !*tmps) { - (void)SvUPGRADE(errsv, SVt_PV); - if (SvPOK(errsv) && SvCUR(errsv)) - sv_catpv(errsv, "\t...caught"); - tmps = SvPV(errsv, na); + (void)SvUPGRADE(ERRSV, SVt_PV); + if (SvPOK(ERRSV) && SvCUR(ERRSV)) + sv_catpv(ERRSV, "\t...caught"); + tmps = SvPV(ERRSV, na); } if (!tmps || !*tmps) tmps = "Warning: something's wrong"; @@ -291,7 +297,7 @@ PP(pp_warn) PP(pp_die) { - dSP; dMARK; + djSP; dMARK; char *tmps; if (SP - MARK != 1) { dTARGET; @@ -303,10 +309,10 @@ PP(pp_die) tmps = SvPV(TOPs, na); } if (!tmps || !*tmps) { - (void)SvUPGRADE(errsv, SVt_PV); - if (SvPOK(errsv) && SvCUR(errsv)) - sv_catpv(errsv, "\t...propagated"); - tmps = SvPV(errsv, na); + (void)SvUPGRADE(ERRSV, SVt_PV); + if (SvPOK(ERRSV) && SvCUR(ERRSV)) + sv_catpv(ERRSV, "\t...propagated"); + tmps = SvPV(ERRSV, na); } if (!tmps || !*tmps) tmps = "Died"; @@ -317,7 +323,7 @@ PP(pp_die) PP(pp_open) { - dSP; dTARGET; + djSP; dTARGET; GV *gv; SV *sv; char *tmps; @@ -346,7 +352,7 @@ PP(pp_open) PP(pp_close) { - dSP; + djSP; GV *gv; if (MAXARG == 0) @@ -360,7 +366,7 @@ PP(pp_close) PP(pp_pipe_op) { - dSP; + djSP; #ifdef HAS_PIPE GV *rgv; GV *wgv; @@ -412,7 +418,7 @@ badexit: PP(pp_fileno) { - dSP; dTARGET; + djSP; dTARGET; GV *gv; IO *io; PerlIO *fp; @@ -427,7 +433,7 @@ PP(pp_fileno) PP(pp_umask) { - dSP; dTARGET; + djSP; dTARGET; int anum; #ifdef HAS_UMASK @@ -447,7 +453,7 @@ PP(pp_umask) PP(pp_binmode) { - dSP; + djSP; GV *gv; IO *io; PerlIO *fp; @@ -497,9 +503,10 @@ PP(pp_binmode) } + PP(pp_tie) { - dSP; + djSP; SV *varsv; HV* stash; GV *gv; @@ -572,7 +579,7 @@ PP(pp_tie) PP(pp_untie) { - dSP; + djSP; SV * sv ; sv = POPs; @@ -600,7 +607,7 @@ PP(pp_untie) PP(pp_tied) { - dSP; + djSP; SV * sv ; MAGIC * mg ; @@ -622,7 +629,7 @@ PP(pp_tied) PP(pp_dbmopen) { - dSP; + djSP; HV *hv; dPOPPOPssrl; HV* stash; @@ -680,7 +687,7 @@ PP(pp_dbmopen) runops(); #else PUTBACK; - perl_call_sv((SV*)gv, G_SCALAR); + perl_call_sv((SV*)GvCV(gv), G_SCALAR); #endif SPAGAIN; @@ -707,7 +714,7 @@ PP(pp_dbmopen) if (op = pp_entersub(ARGS)) runops(); #else - perl_call_sv((SV*)gv, G_SCALAR); + perl_call_sv((SV*)GvCV(gv), G_SCALAR); #endif SPAGAIN; } @@ -728,7 +735,7 @@ PP(pp_dbmclose) PP(pp_sselect) { - dSP; dTARGET; + djSP; dTARGET; #ifdef HAS_SELECT register I32 i; register I32 j; @@ -861,8 +868,7 @@ PP(pp_sselect) } void -setdefout(gv) -GV *gv; +setdefout(GV *gv) { dTHR; if (gv) @@ -874,11 +880,11 @@ GV *gv; PP(pp_select) { - dSP; dTARGET; + djSP; dTARGET; GV *newdefout, *egv; HV *hv; - newdefout = (op->op_private > 0) ? ((GV *) POPs) : NULL; + newdefout = (op->op_private > 0) ? ((GV *) POPs) : (GV *) NULL; egv = GvEGV(defoutgv); if (!egv) @@ -908,7 +914,7 @@ PP(pp_select) PP(pp_getc) { - dSP; dTARGET; + djSP; dTARGET; GV *gv; MAGIC *mg; @@ -947,10 +953,7 @@ PP(pp_read) } static OP * -doform(cv,gv,retop) -CV *cv; -GV *gv; -OP *retop; +doform(CV *cv, GV *gv, OP *retop) { dTHR; register CONTEXT *cx; @@ -973,7 +976,7 @@ OP *retop; PP(pp_enterwrite) { - dSP; + djSP; register GV *gv; register IO *io; GV *fgv; @@ -1014,7 +1017,7 @@ PP(pp_enterwrite) PP(pp_leavewrite) { - dSP; + djSP; GV *gv = cxstack[cxstack_ix].blk_sub.gv; register IO *io = GvIOp(gv); PerlIO *ofp = IoOFP(io); @@ -1128,7 +1131,7 @@ PP(pp_leavewrite) PP(pp_prtf) { - dSP; dMARK; dORIGMARK; + djSP; dMARK; dORIGMARK; GV *gv; IO *io; PerlIO *fp; @@ -1209,7 +1212,7 @@ PP(pp_prtf) PP(pp_sysopen) { - dSP; + djSP; GV *gv; SV *sv; char *tmps; @@ -1237,7 +1240,7 @@ PP(pp_sysopen) PP(pp_sysread) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; int offset; GV *gv; IO *io; @@ -1366,7 +1369,7 @@ PP(pp_syswrite) PP(pp_send) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; GV *gv; IO *io; int offset; @@ -1442,7 +1445,7 @@ PP(pp_recv) PP(pp_eof) { - dSP; + djSP; GV *gv; if (MAXARG <= 0) @@ -1455,7 +1458,7 @@ PP(pp_eof) PP(pp_tell) { - dSP; dTARGET; + djSP; dTARGET; GV *gv; if (MAXARG <= 0) @@ -1473,7 +1476,7 @@ PP(pp_seek) PP(pp_sysseek) { - dSP; + djSP; GV *gv; int whence = POPi; long offset = POPl; @@ -1492,7 +1495,7 @@ PP(pp_sysseek) PP(pp_truncate) { - dSP; + djSP; Off_t len = (Off_t)POPn; int result = 1; GV *tmpgv; @@ -1560,7 +1563,7 @@ PP(pp_fcntl) PP(pp_ioctl) { - dSP; dTARGET; + djSP; dTARGET; SV *argsv = POPs; unsigned int func = U_I(POPn); int optype = op->op_type; @@ -1631,7 +1634,7 @@ PP(pp_ioctl) PP(pp_flock) { - dSP; dTARGET; + djSP; dTARGET; I32 value; int argtype; GV *gv; @@ -1664,7 +1667,7 @@ PP(pp_flock) PP(pp_socket) { - dSP; + djSP; #ifdef HAS_SOCKET GV *gv; register IO *io; @@ -1706,7 +1709,7 @@ PP(pp_socket) PP(pp_sockpair) { - dSP; + djSP; #ifdef HAS_SOCKETPAIR GV *gv1; GV *gv2; @@ -1756,7 +1759,7 @@ PP(pp_sockpair) PP(pp_bind) { - dSP; + djSP; #ifdef HAS_SOCKET SV *addrsv = POPs; char *addr; @@ -1786,7 +1789,7 @@ nuts: PP(pp_connect) { - dSP; + djSP; #ifdef HAS_SOCKET SV *addrsv = POPs; char *addr; @@ -1816,7 +1819,7 @@ nuts: PP(pp_listen) { - dSP; + djSP; #ifdef HAS_SOCKET int backlog = POPi; GV *gv = (GV*)POPs; @@ -1842,7 +1845,7 @@ nuts: PP(pp_accept) { - dSP; dTARGET; + djSP; dTARGET; #ifdef HAS_SOCKET GV *ngv; GV *ggv; @@ -1899,7 +1902,7 @@ badexit: PP(pp_shutdown) { - dSP; dTARGET; + djSP; dTARGET; #ifdef HAS_SOCKET int how = POPi; GV *gv = (GV*)POPs; @@ -1932,7 +1935,7 @@ PP(pp_gsockopt) PP(pp_ssockopt) { - dSP; + djSP; #ifdef HAS_SOCKET int optype = op->op_type; SV *sv; @@ -2012,7 +2015,7 @@ PP(pp_getsockname) PP(pp_getpeername) { - dSP; + djSP; #ifdef HAS_SOCKET int optype = op->op_type; SV *sv; @@ -2083,7 +2086,7 @@ PP(pp_lstat) PP(pp_stat) { - dSP; + djSP; GV *tmpgv; I32 gimme; I32 max = 13; @@ -2171,7 +2174,7 @@ PP(pp_stat) PP(pp_ftrread) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (cando(S_IRUSR, 0, &statcache)) @@ -2182,7 +2185,7 @@ PP(pp_ftrread) PP(pp_ftrwrite) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (cando(S_IWUSR, 0, &statcache)) @@ -2193,7 +2196,7 @@ PP(pp_ftrwrite) PP(pp_ftrexec) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (cando(S_IXUSR, 0, &statcache)) @@ -2204,7 +2207,7 @@ PP(pp_ftrexec) PP(pp_fteread) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (cando(S_IRUSR, 1, &statcache)) @@ -2215,7 +2218,7 @@ PP(pp_fteread) PP(pp_ftewrite) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (cando(S_IWUSR, 1, &statcache)) @@ -2226,7 +2229,7 @@ PP(pp_ftewrite) PP(pp_fteexec) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (cando(S_IXUSR, 1, &statcache)) @@ -2237,7 +2240,7 @@ PP(pp_fteexec) PP(pp_ftis) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; RETPUSHYES; @@ -2251,7 +2254,7 @@ PP(pp_fteowned) PP(pp_ftrowned) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (statcache.st_uid == (op->op_type == OP_FTEOWNED ? euid : uid) ) @@ -2262,7 +2265,7 @@ PP(pp_ftrowned) PP(pp_ftzero) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (!statcache.st_size) @@ -2273,7 +2276,7 @@ PP(pp_ftzero) PP(pp_ftsize) { I32 result = my_stat(ARGS); - dSP; dTARGET; + djSP; dTARGET; if (result < 0) RETPUSHUNDEF; PUSHi(statcache.st_size); @@ -2283,7 +2286,7 @@ PP(pp_ftsize) PP(pp_ftmtime) { I32 result = my_stat(ARGS); - dSP; dTARGET; + djSP; dTARGET; if (result < 0) RETPUSHUNDEF; PUSHn( ((I32)basetime - (I32)statcache.st_mtime) / 86400.0 ); @@ -2293,7 +2296,7 @@ PP(pp_ftmtime) PP(pp_ftatime) { I32 result = my_stat(ARGS); - dSP; dTARGET; + djSP; dTARGET; if (result < 0) RETPUSHUNDEF; PUSHn( ((I32)basetime - (I32)statcache.st_atime) / 86400.0 ); @@ -2303,7 +2306,7 @@ PP(pp_ftatime) PP(pp_ftctime) { I32 result = my_stat(ARGS); - dSP; dTARGET; + djSP; dTARGET; if (result < 0) RETPUSHUNDEF; PUSHn( ((I32)basetime - (I32)statcache.st_ctime) / 86400.0 ); @@ -2313,7 +2316,7 @@ PP(pp_ftctime) PP(pp_ftsock) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (S_ISSOCK(statcache.st_mode)) @@ -2324,7 +2327,7 @@ PP(pp_ftsock) PP(pp_ftchr) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (S_ISCHR(statcache.st_mode)) @@ -2335,7 +2338,7 @@ PP(pp_ftchr) PP(pp_ftblk) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (S_ISBLK(statcache.st_mode)) @@ -2346,7 +2349,7 @@ PP(pp_ftblk) PP(pp_ftfile) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (S_ISREG(statcache.st_mode)) @@ -2357,7 +2360,7 @@ PP(pp_ftfile) PP(pp_ftdir) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (S_ISDIR(statcache.st_mode)) @@ -2368,7 +2371,7 @@ PP(pp_ftdir) PP(pp_ftpipe) { I32 result = my_stat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (S_ISFIFO(statcache.st_mode)) @@ -2379,7 +2382,7 @@ PP(pp_ftpipe) PP(pp_ftlink) { I32 result = my_lstat(ARGS); - dSP; + djSP; if (result < 0) RETPUSHUNDEF; if (S_ISLNK(statcache.st_mode)) @@ -2389,7 +2392,7 @@ PP(pp_ftlink) PP(pp_ftsuid) { - dSP; + djSP; #ifdef S_ISUID I32 result = my_stat(ARGS); SPAGAIN; @@ -2403,7 +2406,7 @@ PP(pp_ftsuid) PP(pp_ftsgid) { - dSP; + djSP; #ifdef S_ISGID I32 result = my_stat(ARGS); SPAGAIN; @@ -2417,7 +2420,7 @@ PP(pp_ftsgid) PP(pp_ftsvtx) { - dSP; + djSP; #ifdef S_ISVTX I32 result = my_stat(ARGS); SPAGAIN; @@ -2431,7 +2434,7 @@ PP(pp_ftsvtx) PP(pp_fttty) { - dSP; + djSP; int fd; GV *gv; char *tmps = Nullch; @@ -2466,7 +2469,7 @@ PP(pp_fttty) PP(pp_fttext) { - dSP; + djSP; I32 i; I32 len; I32 odd = 0; @@ -2593,7 +2596,7 @@ PP(pp_ftbinary) PP(pp_chdir) { - dSP; dTARGET; + djSP; dTARGET; char *tmps; SV **svp; @@ -2623,7 +2626,7 @@ PP(pp_chdir) PP(pp_chown) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value; #ifdef HAS_CHOWN value = (I32)apply(op->op_type, MARK, SP); @@ -2637,7 +2640,7 @@ PP(pp_chown) PP(pp_chroot) { - dSP; dTARGET; + djSP; dTARGET; char *tmps; #ifdef HAS_CHROOT tmps = POPp; @@ -2651,7 +2654,7 @@ PP(pp_chroot) PP(pp_unlink) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value; value = (I32)apply(op->op_type, MARK, SP); SP = MARK; @@ -2661,7 +2664,7 @@ PP(pp_unlink) PP(pp_chmod) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value; value = (I32)apply(op->op_type, MARK, SP); SP = MARK; @@ -2671,7 +2674,7 @@ PP(pp_chmod) PP(pp_utime) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value; value = (I32)apply(op->op_type, MARK, SP); SP = MARK; @@ -2681,7 +2684,7 @@ PP(pp_utime) PP(pp_rename) { - dSP; dTARGET; + djSP; dTARGET; int anum; char *tmps2 = POPp; @@ -2707,7 +2710,7 @@ PP(pp_rename) PP(pp_link) { - dSP; dTARGET; + djSP; dTARGET; #ifdef HAS_LINK char *tmps2 = POPp; char *tmps = SvPV(TOPs, na); @@ -2721,7 +2724,7 @@ PP(pp_link) PP(pp_symlink) { - dSP; dTARGET; + djSP; dTARGET; #ifdef HAS_SYMLINK char *tmps2 = POPp; char *tmps = SvPV(TOPs, na); @@ -2735,7 +2738,7 @@ PP(pp_symlink) PP(pp_readlink) { - dSP; dTARGET; + djSP; dTARGET; #ifdef HAS_SYMLINK char *tmps; char buf[MAXPATHLEN]; @@ -2848,7 +2851,7 @@ char *filename; PP(pp_mkdir) { - dSP; dTARGET; + djSP; dTARGET; int mode = POPi; #ifndef HAS_MKDIR int oldumask; @@ -2869,7 +2872,7 @@ PP(pp_mkdir) PP(pp_rmdir) { - dSP; dTARGET; + djSP; dTARGET; char *tmps; tmps = POPp; @@ -2886,7 +2889,7 @@ PP(pp_rmdir) PP(pp_open_dir) { - dSP; + djSP; #if defined(Direntry_t) && defined(HAS_READDIR) char *dirname = POPp; GV *gv = (GV*)POPs; @@ -2912,7 +2915,7 @@ nope: PP(pp_readdir) { - dSP; + djSP; #if defined(Direntry_t) && defined(HAS_READDIR) #ifndef I_DIRENT Direntry_t *readdir _((DIR *)); @@ -2968,9 +2971,9 @@ nope: PP(pp_telldir) { - dSP; dTARGET; + djSP; dTARGET; #if defined(HAS_TELLDIR) || defined(telldir) -#if !defined(telldir) && !defined(HAS_TELLDIR_PROTOTYPE) +#if !defined(telldir) && !defined(HAS_TELLDIR_PROTOTYPE) && !defined(DONT_DECLARE_STD) long telldir _((DIR *)); #endif GV *gv = (GV*)POPs; @@ -2992,7 +2995,7 @@ nope: PP(pp_seekdir) { - dSP; + djSP; #if defined(HAS_SEEKDIR) || defined(seekdir) long along = POPl; GV *gv = (GV*)POPs; @@ -3015,7 +3018,7 @@ nope: PP(pp_rewinddir) { - dSP; + djSP; #if defined(HAS_REWINDDIR) || defined(rewinddir) GV *gv = (GV*)POPs; register IO *io = GvIOn(gv); @@ -3036,7 +3039,7 @@ nope: PP(pp_closedir) { - dSP; + djSP; #if defined(Direntry_t) && defined(HAS_READDIR) GV *gv = (GV*)POPs; register IO *io = GvIOn(gv); @@ -3069,7 +3072,7 @@ nope: PP(pp_fork) { #ifdef HAS_FORK - dSP; dTARGET; + djSP; dTARGET; int childpid; GV *tmpgv; @@ -3093,7 +3096,7 @@ PP(pp_fork) PP(pp_wait) { #if !defined(DOSISH) || defined(OS2) - dSP; dTARGET; + djSP; dTARGET; int childpid; int argflags; @@ -3109,7 +3112,7 @@ PP(pp_wait) PP(pp_waitpid) { #if !defined(DOSISH) || defined(OS2) - dSP; dTARGET; + djSP; dTARGET; int childpid; int optype; int argflags; @@ -3127,7 +3130,7 @@ PP(pp_waitpid) PP(pp_system) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; I32 value; int childpid; int result; @@ -3178,10 +3181,10 @@ PP(pp_system) #else /* ! FORK or VMS or OS/2 */ if (op->op_flags & OPf_STACKED) { SV *really = *++MARK; - value = (I32)do_aspawn(really, MARK, SP); + value = (I32)do_aspawn(really, (void **)MARK, (void **)SP); } else if (SP - MARK != 1) - value = (I32)do_aspawn(Nullsv, MARK, SP); + value = (I32)do_aspawn(Nullsv, (void **)MARK, (void **)SP); else { value = (I32)do_spawn(SvPVx(sv_mortalcopy(*SP), na)); } @@ -3195,7 +3198,7 @@ PP(pp_system) PP(pp_exec) { - dSP; dMARK; dORIGMARK; dTARGET; + djSP; dMARK; dORIGMARK; dTARGET; I32 value; if (op->op_flags & OPf_STACKED) { @@ -3227,7 +3230,7 @@ PP(pp_exec) PP(pp_kill) { - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value; #ifdef HAS_KILL value = (I32)apply(op->op_type, MARK, SP); @@ -3242,7 +3245,7 @@ PP(pp_kill) PP(pp_getppid) { #ifdef HAS_GETPPID - dSP; dTARGET; + djSP; dTARGET; XPUSHi( getppid() ); RETURN; #else @@ -3253,7 +3256,7 @@ PP(pp_getppid) PP(pp_getpgrp) { #ifdef HAS_GETPGRP - dSP; dTARGET; + djSP; dTARGET; int pid; I32 value; @@ -3278,7 +3281,7 @@ PP(pp_getpgrp) PP(pp_setpgrp) { #ifdef HAS_SETPGRP - dSP; dTARGET; + djSP; dTARGET; int pgrp; int pid; if (MAXARG < 2) { @@ -3306,7 +3309,7 @@ PP(pp_setpgrp) PP(pp_getpriority) { - dSP; dTARGET; + djSP; dTARGET; int which; int who; #ifdef HAS_GETPRIORITY @@ -3321,7 +3324,7 @@ PP(pp_getpriority) PP(pp_setpriority) { - dSP; dTARGET; + djSP; dTARGET; int which; int who; int niceval; @@ -3341,7 +3344,7 @@ PP(pp_setpriority) PP(pp_time) { - dSP; dTARGET; + djSP; dTARGET; #ifdef BIG_TIME XPUSHn( time(Null(Time_t*)) ); #else @@ -3368,7 +3371,7 @@ PP(pp_time) PP(pp_tms) { - dSP; + djSP; #ifndef HAS_TIMES DIE("times not implemented"); @@ -3400,7 +3403,7 @@ PP(pp_localtime) PP(pp_gmtime) { - dSP; + djSP; Time_t when; struct tm *tmbuf; static char *dayname[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; @@ -3454,7 +3457,7 @@ PP(pp_gmtime) PP(pp_alarm) { - dSP; dTARGET; + djSP; dTARGET; int anum; #ifdef HAS_ALARM anum = POPi; @@ -3471,7 +3474,7 @@ PP(pp_alarm) PP(pp_sleep) { - dSP; dTARGET; + djSP; dTARGET; I32 duration; Time_t lasttime; Time_t when; @@ -3508,7 +3511,7 @@ PP(pp_shmread) PP(pp_shmwrite) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value = (I32)(do_shmio(op->op_type, MARK, SP) >= 0); SP = MARK; PUSHi(value); @@ -3533,7 +3536,7 @@ PP(pp_msgctl) PP(pp_msgsnd) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value = (I32)(do_msgsnd(MARK, SP) >= 0); SP = MARK; PUSHi(value); @@ -3546,7 +3549,7 @@ PP(pp_msgsnd) PP(pp_msgrcv) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value = (I32)(do_msgrcv(MARK, SP) >= 0); SP = MARK; PUSHi(value); @@ -3561,7 +3564,7 @@ PP(pp_msgrcv) PP(pp_semget) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; int anum = do_ipcget(op->op_type, MARK, SP); SP = MARK; if (anum == -1) @@ -3576,7 +3579,7 @@ PP(pp_semget) PP(pp_semctl) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; int anum = do_ipcctl(op->op_type, MARK, SP); SP = MARK; if (anum == -1) @@ -3596,7 +3599,7 @@ PP(pp_semctl) PP(pp_semop) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; + djSP; dMARK; dTARGET; I32 value = (I32)(do_semop(MARK, SP) >= 0); SP = MARK; PUSHi(value); @@ -3628,15 +3631,15 @@ PP(pp_ghbyaddr) PP(pp_ghostent) { - dSP; + djSP; #ifdef HAS_SOCKET I32 which = op->op_type; register char **elem; register SV *sv; - struct hostent *gethostbyname(); - struct hostent *gethostbyaddr(); -#ifdef HAS_GETHOSTENT - struct hostent *gethostent(); +#if defined(HAS_GETHOSTENT) && !defined(DONT_DECLARE_STD) + struct hostent *gethostbyname(const char *); + struct hostent *gethostbyaddr(const char *, int, int); + struct hostent *gethostent(void); #endif struct hostent *hent; unsigned long len; @@ -3729,14 +3732,16 @@ PP(pp_gnbyaddr) PP(pp_gnetent) { - dSP; + djSP; #ifdef HAS_SOCKET I32 which = op->op_type; register char **elem; register SV *sv; - struct netent *getnetbyname(); - struct netent *getnetbyaddr(); - struct netent *getnetent(); +#ifndef DONT_DECLARE_STD + struct netent *getnetbyname(const char *); + struct netent *getnetbyaddr(long int, int); + struct netent *getnetent(void); +#endif struct netent *nent; if (which == OP_GNBYNAME) @@ -3802,14 +3807,16 @@ PP(pp_gpbynumber) PP(pp_gprotoent) { - dSP; + djSP; #ifdef HAS_SOCKET I32 which = op->op_type; register char **elem; - register SV *sv; - struct protoent *getprotobyname(); - struct protoent *getprotobynumber(); - struct protoent *getprotoent(); + register SV *sv; +#ifndef DONT_DECLARE_STD + struct protoent *getprotobyname(const char *); + struct protoent *getprotobynumber(int); + struct protoent *getprotoent(void); +#endif struct protoent *pent; if (which == OP_GPBYNAME) @@ -3870,14 +3877,16 @@ PP(pp_gsbyport) PP(pp_gservent) { - dSP; + djSP; #ifdef HAS_SOCKET I32 which = op->op_type; register char **elem; register SV *sv; - struct servent *getservbyname(); +#ifndef DONT_DECLARE_STD + struct servent *getservbyname(const char *, const char *); struct servent *getservbynumber(); - struct servent *getservent(); + struct servent *getservent(void); +#endif struct servent *sent; if (which == OP_GSBYNAME) { @@ -3945,7 +3954,7 @@ PP(pp_gservent) PP(pp_shostent) { - dSP; + djSP; #ifdef HAS_SOCKET sethostent(TOPi); RETSETYES; @@ -3956,7 +3965,7 @@ PP(pp_shostent) PP(pp_snetent) { - dSP; + djSP; #ifdef HAS_SOCKET setnetent(TOPi); RETSETYES; @@ -3967,7 +3976,7 @@ PP(pp_snetent) PP(pp_sprotoent) { - dSP; + djSP; #ifdef HAS_SOCKET setprotoent(TOPi); RETSETYES; @@ -3978,7 +3987,7 @@ PP(pp_sprotoent) PP(pp_sservent) { - dSP; + djSP; #ifdef HAS_SOCKET setservent(TOPi); RETSETYES; @@ -3989,7 +3998,7 @@ PP(pp_sservent) PP(pp_ehostent) { - dSP; + djSP; #ifdef HAS_SOCKET endhostent(); EXTEND(sp,1); @@ -4001,7 +4010,7 @@ PP(pp_ehostent) PP(pp_enetent) { - dSP; + djSP; #ifdef HAS_SOCKET endnetent(); EXTEND(sp,1); @@ -4013,7 +4022,7 @@ PP(pp_enetent) PP(pp_eprotoent) { - dSP; + djSP; #ifdef HAS_SOCKET endprotoent(); EXTEND(sp,1); @@ -4025,7 +4034,7 @@ PP(pp_eprotoent) PP(pp_eservent) { - dSP; + djSP; #ifdef HAS_SOCKET endservent(); EXTEND(sp,1); @@ -4055,7 +4064,7 @@ PP(pp_gpwuid) PP(pp_gpwent) { - dSP; + djSP; #ifdef HAS_PASSWD I32 which = op->op_type; register SV *sv; @@ -4131,7 +4140,7 @@ PP(pp_gpwent) PP(pp_spwent) { - dSP; + djSP; #if defined(HAS_PASSWD) && !defined(CYGWIN32) setpwent(); RETPUSHYES; @@ -4142,7 +4151,7 @@ PP(pp_spwent) PP(pp_epwent) { - dSP; + djSP; #ifdef HAS_PASSWD endpwent(); RETPUSHYES; @@ -4171,7 +4180,7 @@ PP(pp_ggrgid) PP(pp_ggrent) { - dSP; + djSP; #ifdef HAS_GROUP I32 which = op->op_type; register char **elem; @@ -4220,7 +4229,7 @@ PP(pp_ggrent) PP(pp_sgrent) { - dSP; + djSP; #ifdef HAS_GROUP setgrent(); RETPUSHYES; @@ -4231,7 +4240,7 @@ PP(pp_sgrent) PP(pp_egrent) { - dSP; + djSP; #ifdef HAS_GROUP endgrent(); RETPUSHYES; @@ -4242,7 +4251,7 @@ PP(pp_egrent) PP(pp_getlogin) { - dSP; dTARGET; + djSP; dTARGET; #ifdef HAS_GETLOGIN char *tmps; EXTEND(SP, 1); @@ -4259,8 +4268,8 @@ PP(pp_getlogin) PP(pp_syscall) { -#ifdef HAS_SYSCALL - dSP; dMARK; dORIGMARK; dTARGET; +#ifdef HAS_SYSCALL + djSP; dMARK; dORIGMARK; dTARGET; register I32 items = SP - MARK; unsigned long a[20]; register I32 i = 0; @@ -4361,9 +4370,7 @@ PP(pp_syscall) */ static int -fcntl_emulate_flock(fd, operation) -int fd; -int operation; +fcntl_emulate_flock(int fd, int operation) { struct flock flock; @@ -4475,3 +4482,4 @@ int operation; } #endif /* LOCKF_EMULATE_FLOCK */ + @@ -4,7 +4,7 @@ #undef __attribute__ #endif #define __attribute__(attr) -#endif +#endif #endif #ifdef OVERLOAD SV* amagic_call _((SV* left,SV* right,int method,int dir)); @@ -132,10 +132,7 @@ static char* nextchar _((void)); * of the structure of the compiled regexp. [I'll say.] */ regexp * -pregcomp(exp,xend,pm) -char* exp; -char* xend; -PMOP* pm; +pregcomp(char *exp, char *xend, PMOP *pm) { register regexp *r; register char *scan; @@ -436,9 +433,9 @@ PMOP* pm; * follows makes it hard to avoid. */ static char * -reg(paren, flagp) -I32 paren; /* Parenthesized? */ -I32 *flagp; +reg(I32 paren, I32 *flagp) + /* Parenthesized? */ + { register char *ret; register char *br; @@ -567,8 +564,7 @@ I32 *flagp; * Implements the concatenation operator. */ static char * -regbranch(flagp) -I32 *flagp; +regbranch(I32 *flagp) { register char *ret; register char *chain; @@ -614,8 +610,7 @@ I32 *flagp; * endmarker role is not redundant. */ static char * -regpiece(flagp) -I32 *flagp; +regpiece(I32 *flagp) { register char *ret; register char op; @@ -762,8 +757,7 @@ I32 *flagp; * [Yes, it is worth fixing, some scripts can run twice the speed.] */ static char * -regatom(flagp) -I32 *flagp; +regatom(I32 *flagp) { register char *ret = 0; I32 flags; @@ -1075,9 +1069,7 @@ tryagain: } static char * -regwhite(p, e) -char *p; -char *e; +regwhite(char *p, char *e) { while (p < e) { if (isSPACE(*p)) @@ -1094,9 +1086,7 @@ char *e; } static void -regset(opnd, c) -char *opnd; -register I32 c; +regset(char *opnd, register I32 c) { if (opnd == ®dummy) return; @@ -1105,10 +1095,10 @@ register I32 c; } static char * -regclass() +regclass(void) { register char *opnd; - register I32 class; + register I32 Class; register I32 lastclass = 1234; register I32 range = 0; register char *ret; @@ -1117,7 +1107,7 @@ regclass() ret = regnode(ANYOF); opnd = regcode; - for (class = 0; class < 33; class++) + for (Class = 0; Class < 33; Class++) regc(0); if (*regparse == '^') { /* Complement of range. */ regnaughty++; @@ -1135,19 +1125,19 @@ regclass() goto skipcond; /* allow 1st char to be ] or - */ while (regparse < regxend && *regparse != ']') { skipcond: - class = UCHARAT(regparse++); - if (class == '\\') { - class = UCHARAT(regparse++); - switch (class) { + Class = UCHARAT(regparse++); + if (Class == '\\') { + Class = UCHARAT(regparse++); + switch (Class) { case 'w': if (regflags & PMf_LOCALE) { if (opnd != ®dummy) *opnd |= ANYOF_ALNUML; } else { - for (class = 0; class < 256; class++) - if (isALNUM(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (isALNUM(Class)) + regset(opnd, Class); } lastclass = 1234; continue; @@ -1157,9 +1147,9 @@ regclass() *opnd |= ANYOF_NALNUML; } else { - for (class = 0; class < 256; class++) - if (!isALNUM(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (!isALNUM(Class)) + regset(opnd, Class); } lastclass = 1234; continue; @@ -1169,9 +1159,9 @@ regclass() *opnd |= ANYOF_SPACEL; } else { - for (class = 0; class < 256; class++) - if (isSPACE(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (isSPACE(Class)) + regset(opnd, Class); } lastclass = 1234; continue; @@ -1181,67 +1171,67 @@ regclass() *opnd |= ANYOF_NSPACEL; } else { - for (class = 0; class < 256; class++) - if (!isSPACE(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (!isSPACE(Class)) + regset(opnd, Class); } lastclass = 1234; continue; case 'd': - for (class = '0'; class <= '9'; class++) - regset(opnd, class); + for (Class = '0'; Class <= '9'; Class++) + regset(opnd, Class); lastclass = 1234; continue; case 'D': - for (class = 0; class < '0'; class++) - regset(opnd, class); - for (class = '9' + 1; class < 256; class++) - regset(opnd, class); + for (Class = 0; Class < '0'; Class++) + regset(opnd, Class); + for (Class = '9' + 1; Class < 256; Class++) + regset(opnd, Class); lastclass = 1234; continue; case 'n': - class = '\n'; + Class = '\n'; break; case 'r': - class = '\r'; + Class = '\r'; break; case 't': - class = '\t'; + Class = '\t'; break; case 'f': - class = '\f'; + Class = '\f'; break; case 'b': - class = '\b'; + Class = '\b'; break; case 'e': - class = '\033'; + Class = '\033'; break; case 'a': - class = '\007'; + Class = '\007'; break; case 'x': - class = scan_hex(regparse, 2, &numlen); + Class = scan_hex(regparse, 2, &numlen); regparse += numlen; break; case 'c': - class = UCHARAT(regparse++); - class = toCTRL(class); + Class = UCHARAT(regparse++); + Class = toCTRL(Class); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - class = scan_oct(--regparse, 3, &numlen); + Class = scan_oct(--regparse, 3, &numlen); regparse += numlen; break; } } if (range) { - if (lastclass > class) + if (lastclass > Class) FAIL("invalid [] range in regexp"); range = 0; } else { - lastclass = class; + lastclass = Class; if (*regparse == '-' && regparse+1 < regxend && regparse[1] != ']') { regparse++; @@ -1249,9 +1239,9 @@ regclass() continue; /* do it next time */ } } - for ( ; lastclass <= class; lastclass++) + for ( ; lastclass <= Class; lastclass++) regset(opnd, lastclass); - lastclass = class; + lastclass = Class; } if (*regparse != ']') FAIL("unmatched [] in regexp"); @@ -1260,7 +1250,7 @@ regclass() } static char* -nextchar() +nextchar(void) { char* retval = regparse++; @@ -1447,9 +1437,7 @@ char *opnd; - regtail - set the next-pointer at the end of a node chain */ static void -regtail(p, val) -char *p; -char *val; +regtail(char *p, char *val) { register char *scan; register char *temp; @@ -1488,9 +1476,7 @@ char *val; - regoptail - regtail on operand of first argument; nop if operandless */ static void -regoptail(p, val) -char *p; -char *val; +regoptail(char *p, char *val) { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || regkind[(U8)OP(p)] != BRANCH) @@ -1502,8 +1488,7 @@ char *val; - regcurly - a little FSA that accepts {\d+,?\d*} */ STATIC I32 -regcurly(s) -register char *s; +regcurly(register char *s) { if (*s++ != '{') return FALSE; @@ -1526,8 +1511,7 @@ register char *s; - regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form */ void -regdump(r) -regexp *r; +regdump(regexp *r) { register char *s; register char op = EXACT; /* Arbitrary non-END op. */ @@ -1599,9 +1583,7 @@ regexp *r; - regprop - printable representation of opcode */ void -regprop(sv, o) -SV *sv; -char *o; +regprop(SV *sv, char *o) { register char *p = 0; @@ -1752,8 +1734,7 @@ char *o; #endif /* DEBUGGING */ void -pregfree(r) -struct regexp *r; +pregfree(struct regexp *r) { if (!r) return; @@ -86,8 +86,7 @@ static CHECKPOINT regcppush _((I32 parenfloor)); static char * regcppop _((void)); static CHECKPOINT -regcppush(parenfloor) -I32 parenfloor; +regcppush(I32 parenfloor) { dTHR; int retval = savestack_ix; @@ -109,7 +108,7 @@ I32 parenfloor; } static char * -regcppop() +regcppop(void) { dTHR; I32 i = SSPOPINT; @@ -145,8 +144,7 @@ regcppop() * 0 > length [ "foobar" =~ / ( (foo) | (bar) )* /x ]->[1] */ static void -regcppartblow(base) -I32 base; +regcppartblow(I32 base) { dTHR; I32 i = SSPOPINT; @@ -188,14 +186,14 @@ static bool regtainted; /* tainted information used? */ - pregexec - match a regexp against a string */ I32 -pregexec(prog, stringarg, strend, strbeg, minend, screamer, safebase) -register regexp *prog; -char *stringarg; -register char *strend; /* pointer to null at end of string */ -char *strbeg; /* real beginning of string */ -I32 minend; /* end of match must be at least minend after stringarg */ -SV *screamer; -I32 safebase; /* no need to remember string in subbase */ +pregexec(register regexp *prog, char *stringarg, register char *strend, char *strbeg, I32 minend, SV *screamer, I32 safebase) + + + /* pointer to null at end of string */ + /* real beginning of string */ + /* end of match must be at least minend after stringarg */ + + /* no need to remember string in subbase */ { register char *s; register char *c; @@ -595,9 +593,7 @@ phooey: - regtry - try match at specific point */ static I32 /* 0 failure, 1 success */ -regtry(prog, startpos) -regexp *prog; -char *startpos; +regtry(regexp *prog, char *startpos) { register I32 i; register char **sp; @@ -642,8 +638,7 @@ char *startpos; * advantage of machines that use a register save mask on subroutine entry. */ static I32 /* 0 failure, 1 success */ -regmatch(prog) -char *prog; +regmatch(char *prog) { register char *scan; /* Current node. */ char *next; /* Next node. */ @@ -1186,9 +1181,7 @@ no: * rather than incrementing count on every character.] */ static I32 -regrepeat(p, max) -char *p; -I32 max; +regrepeat(char *p, I32 max) { register char *scan; register char *opnd; @@ -1288,9 +1281,7 @@ I32 max; */ static bool -reginclass(p, c) -register char *p; -register I32 c; +reginclass(register char *p, register I32 c) { char flags = *p; bool match = FALSE; @@ -1332,8 +1323,7 @@ register I32 c; * that bypass this code for speed.] */ char * -regnext(p) -register char *p; +regnext(register char *p) { register I32 offset; @@ -20,7 +20,7 @@ dEXT char **watchaddr = 0; dEXT char *watchok; int -runops_standard() { +runops_standard(void) { dTHR; while ( op = (*op->op_ppaddr)(ARGS) ) ; @@ -33,7 +33,7 @@ runops_standard() { static void debprof _((OP*o)); int -runops_debug() { +runops_debug(void) { dTHR; if (!op) { warn("NULL OP IN RUN"); @@ -56,8 +56,7 @@ runops_debug() { } I32 -debop(o) -OP *o; +debop(OP *o) { SV *sv; deb("%s", op_name[o->op_type]); @@ -84,8 +83,7 @@ OP *o; } void -watch(addr) -char **addr; +watch(char **addr) { watchaddr = addr; watchok = *addr; @@ -94,8 +92,7 @@ char **addr; } static void -debprof(o) -OP* o; +debprof(OP *o) { if (!profiledata) New(000, profiledata, MAXO, U32); @@ -103,7 +100,7 @@ OP* o; } void -debprofdump() +debprofdump(void) { unsigned i; if (!profiledata) @@ -16,10 +16,7 @@ #include "perl.h" SV** -stack_grow(sp, p, n) -SV** sp; -SV** p; -int n; +stack_grow(SV **sp, SV **p, int n) { dTHR; stack_sp = sp; @@ -28,7 +25,7 @@ int n; } I32 -cxinc() +cxinc(void) { dTHR; cxstack_max = cxstack_max * 3 / 2; @@ -37,8 +34,7 @@ cxinc() } void -push_return(retop) -OP *retop; +push_return(OP *retop) { dTHR; if (retstack_ix == retstack_max) { @@ -49,7 +45,7 @@ OP *retop; } OP * -pop_return() +pop_return(void) { dTHR; if (retstack_ix > 0) @@ -59,7 +55,7 @@ pop_return() } void -push_scope() +push_scope(void) { dTHR; if (scopestack_ix == scopestack_max) { @@ -71,7 +67,7 @@ push_scope() } void -pop_scope() +pop_scope(void) { dTHR; I32 oldsave = scopestack[--scopestack_ix]; @@ -79,7 +75,7 @@ pop_scope() } void -markstack_grow() +markstack_grow(void) { dTHR; I32 oldmax = markstack_max - markstack; @@ -91,7 +87,7 @@ markstack_grow() } void -savestack_grow() +savestack_grow(void) { dTHR; savestack_max = savestack_max * 3 / 2; @@ -99,7 +95,7 @@ savestack_grow() } void -free_tmps() +free_tmps(void) { dTHR; /* XXX should tmps_floor live in cxstack? */ @@ -117,8 +113,7 @@ free_tmps() } static SV * -save_scalar_at(sptr) -SV **sptr; +save_scalar_at(SV **sptr) { dTHR; register SV *sv; @@ -149,8 +144,7 @@ SV **sptr; } SV * -save_scalar(gv) -GV *gv; +save_scalar(GV *gv) { dTHR; SSCHECK(3); @@ -161,8 +155,7 @@ GV *gv; } SV* -save_svref(sptr) -SV **sptr; +save_svref(SV **sptr) { dTHR; SSCHECK(3); @@ -173,9 +166,7 @@ SV **sptr; } void -save_gp(gv, empty) -GV *gv; -I32 empty; +save_gp(GV *gv, I32 empty) { dTHR; SSCHECK(6); @@ -203,8 +194,7 @@ I32 empty; } AV * -save_ary(gv) -GV *gv; +save_ary(GV *gv) { dTHR; AV *oav, *av; @@ -229,8 +219,7 @@ GV *gv; } HV * -save_hash(gv) -GV *gv; +save_hash(GV *gv) { dTHR; HV *ohv, *hv; @@ -255,8 +244,7 @@ GV *gv; } void -save_item(item) -register SV *item; +save_item(register SV *item) { dTHR; register SV *sv; @@ -270,8 +258,7 @@ register SV *item; } void -save_int(intp) -int *intp; +save_int(int *intp) { dTHR; SSCHECK(3); @@ -281,8 +268,7 @@ int *intp; } void -save_long(longp) -long *longp; +save_long(long int *longp) { dTHR; SSCHECK(3); @@ -292,8 +278,7 @@ long *longp; } void -save_I32(intp) -I32 *intp; +save_I32(I32 *intp) { dTHR; SSCHECK(3); @@ -303,8 +288,7 @@ I32 *intp; } void -save_I16(intp) -I16 *intp; +save_I16(I16 *intp) { dTHR; SSCHECK(3); @@ -314,8 +298,7 @@ I16 *intp; } void -save_iv(ivp) -IV *ivp; +save_iv(IV *ivp) { dTHR; SSCHECK(3); @@ -328,8 +311,7 @@ IV *ivp; * force word-alignment and we'll miss the pointer. */ void -save_pptr(pptr) -char **pptr; +save_pptr(char **pptr) { dTHR; SSCHECK(3); @@ -339,8 +321,7 @@ char **pptr; } void -save_sptr(sptr) -SV **sptr; +save_sptr(SV **sptr) { dTHR; SSCHECK(3); @@ -350,8 +331,7 @@ SV **sptr; } void -save_nogv(gv) -GV *gv; +save_nogv(GV *gv) { dTHR; SSCHECK(2); @@ -360,8 +340,7 @@ GV *gv; } void -save_hptr(hptr) -HV **hptr; +save_hptr(HV **hptr) { dTHR; SSCHECK(3); @@ -371,8 +350,7 @@ HV **hptr; } void -save_aptr(aptr) -AV **aptr; +save_aptr(AV **aptr) { dTHR; SSCHECK(3); @@ -382,8 +360,7 @@ AV **aptr; } void -save_freesv(sv) -SV *sv; +save_freesv(SV *sv) { dTHR; SSCHECK(2); @@ -392,8 +369,7 @@ SV *sv; } void -save_freeop(o) -OP *o; +save_freeop(OP *o) { dTHR; SSCHECK(2); @@ -402,8 +378,7 @@ OP *o; } void -save_freepv(pv) -char *pv; +save_freepv(char *pv) { dTHR; SSCHECK(2); @@ -412,8 +387,7 @@ char *pv; } void -save_clearsv(svp) -SV** svp; +save_clearsv(SV **svp) { dTHR; SSCHECK(2); @@ -422,10 +396,7 @@ SV** svp; } void -save_delete(hv,key,klen) -HV *hv; -char *key; -I32 klen; +save_delete(HV *hv, char *key, I32 klen) { dTHR; SSCHECK(4); @@ -436,9 +407,7 @@ I32 klen; } void -save_list(sarg,maxsarg) -register SV **sarg; -I32 maxsarg; +save_list(register SV **sarg, I32 maxsarg) { dTHR; register SV *sv; @@ -455,9 +424,7 @@ I32 maxsarg; } void -save_destructor(f,p) -void (*f) _((void*)); -void* p; +save_destructor(void (*f) (void *), void *p) { dTHR; SSCHECK(3); @@ -467,7 +434,7 @@ void* p; } void -save_op() +save_op(void) { dTHR; SSCHECK(2); @@ -476,8 +443,7 @@ save_op() } void -leave_scope(base) -I32 base; +leave_scope(I32 base) { dTHR; register SV *sv; @@ -717,8 +683,7 @@ I32 base; #ifdef DEBUGGING void -cx_dump(cx) -CONTEXT* cx; +cx_dump(CONTEXT *cx) { dTHR; PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), block_type[cx->cx_type]); @@ -204,8 +204,7 @@ U32 flags; } while (0) static void -del_sv(p) -SV* p; +del_sv(SV *p) { if (debug & 32768) { SV* sva; @@ -233,10 +232,7 @@ SV* p; #endif /* DEBUGGING */ void -sv_add_arena(ptr, size, flags) -char* ptr; -U32 size; -U32 flags; +sv_add_arena(char *ptr, U32 size, U32 flags) { SV* sva = (SV*)ptr; register SV* sv; @@ -264,7 +260,7 @@ U32 flags; /* sv_mutex must be held while calling more_sv() */ static SV* -more_sv() +more_sv(void) { register SV* sv; @@ -282,8 +278,7 @@ more_sv() } static void -visit(f) -SVFUNC f; +visit(SVFUNC f) { SV* sva; SV* sv; @@ -301,8 +296,7 @@ SVFUNC f; #endif /* PURIFY */ static void -do_report_used(sv) -SV* sv; +do_report_used(SV *sv) { if (SvTYPE(sv) != SVTYPEMASK) { /* XXX Perhaps this ought to go to Perl_debug_log, if DEBUGGING. */ @@ -312,14 +306,13 @@ SV* sv; } void -sv_report_used() +sv_report_used(void) { visit(do_report_used); } static void -do_clean_objs(sv) -SV* sv; +do_clean_objs(SV *sv) { SV* rv; @@ -335,8 +328,7 @@ SV* sv; #ifndef DISABLE_DESTRUCTOR_KLUDGE static void -do_clean_named_objs(sv) -SV* sv; +do_clean_named_objs(SV *sv) { if (SvTYPE(sv) == SVt_PVGV && GvSV(sv)) do_clean_objs(GvSV(sv)); @@ -346,7 +338,7 @@ SV* sv; static bool in_clean_objs = FALSE; void -sv_clean_objs() +sv_clean_objs(void) { in_clean_objs = TRUE; #ifndef DISABLE_DESTRUCTOR_KLUDGE @@ -357,8 +349,7 @@ sv_clean_objs() } static void -do_clean_all(sv) -SV* sv; +do_clean_all(SV *sv) { DEBUG_D((PerlIO_printf(Perl_debug_log, "Cleaning loops:\n "), sv_dump(sv));) SvFLAGS(sv) |= SVf_BREAK; @@ -368,7 +359,7 @@ SV* sv; static bool in_clean_all = FALSE; void -sv_clean_all() +sv_clean_all(void) { in_clean_all = TRUE; visit(do_clean_all); @@ -376,7 +367,7 @@ sv_clean_all() } void -sv_free_arenas() +sv_free_arenas(void) { SV* sva; SV* svanext; @@ -398,7 +389,7 @@ sv_free_arenas() } static XPVIV* -new_xiv() +new_xiv(void) { IV** xiv; if (xiv_root) { @@ -413,8 +404,7 @@ new_xiv() } static void -del_xiv(p) -XPVIV* p; +del_xiv(XPVIV *p) { IV** xiv = (IV**)((char*)(p) + sizeof(XPV)); *xiv = (IV *)xiv_root; @@ -422,7 +412,7 @@ XPVIV* p; } static XPVIV* -more_xiv() +more_xiv(void) { register IV** xiv; register IV** xivend; @@ -443,7 +433,7 @@ more_xiv() } static XPVNV* -new_xnv() +new_xnv(void) { double* xnv; if (xnv_root) { @@ -455,8 +445,7 @@ new_xnv() } static void -del_xnv(p) -XPVNV* p; +del_xnv(XPVNV *p) { double* xnv = (double*)((char*)(p) + sizeof(XPVIV)); *(double**)xnv = xnv_root; @@ -464,7 +453,7 @@ XPVNV* p; } static XPVNV* -more_xnv() +more_xnv(void) { register double* xnv; register double* xnvend; @@ -481,7 +470,7 @@ more_xnv() } static XRV* -new_xrv() +new_xrv(void) { XRV* xrv; if (xrv_root) { @@ -493,15 +482,14 @@ new_xrv() } static void -del_xrv(p) -XRV* p; +del_xrv(XRV *p) { p->xrv_rv = (SV*)xrv_root; xrv_root = p; } static XRV* -more_xrv() +more_xrv(void) { register XRV* xrv; register XRV* xrvend; @@ -517,7 +505,7 @@ more_xrv() } static XPV* -new_xpv() +new_xpv(void) { XPV* xpv; if (xpv_root) { @@ -529,15 +517,14 @@ new_xpv() } static void -del_xpv(p) -XPV* p; +del_xpv(XPV *p) { p->xpv_pv = (char*)xpv_root; xpv_root = p; } static XPV* -more_xpv() +more_xpv(void) { register XPV* xpv; register XPV* xpvend; @@ -557,7 +544,7 @@ more_xpv() #define del_XIV(p) free((char*)p) #else #define new_XIV() (void*)new_xiv() -#define del_XIV(p) del_xiv(p) +#define del_XIV(p) del_xiv((XPVIV*) p) #endif #ifdef PURIFY @@ -565,7 +552,7 @@ more_xpv() #define del_XNV(p) free((char*)p) #else #define new_XNV() (void*)new_xnv() -#define del_XNV(p) del_xnv(p) +#define del_XNV(p) del_xnv((XPVNV*) p) #endif #ifdef PURIFY @@ -573,7 +560,7 @@ more_xpv() #define del_XRV(p) free((char*)p) #else #define new_XRV() (void*)new_xrv() -#define del_XRV(p) del_xrv(p) +#define del_XRV(p) del_xrv((XRV*) p) #endif #ifdef PURIFY @@ -581,7 +568,7 @@ more_xpv() #define del_XPV(p) free((char*)p) #else #define new_XPV() (void*)new_xpv() -#define del_XPV(p) del_xpv(p) +#define del_XPV(p) del_xpv((XPV *)p) #endif #define new_XPVIV() (void*)safemalloc(sizeof(XPVIV)) @@ -618,9 +605,7 @@ more_xpv() #define del_XPVIO(p) free((char*)p) bool -sv_upgrade(sv, mt) -register SV* sv; -U32 mt; +sv_upgrade(register SV *sv, U32 mt) { char* pv; U32 cur; @@ -895,8 +880,7 @@ U32 mt; #ifdef DEBUGGING char * -sv_peek(sv) -register SV *sv; +sv_peek(SV *sv) { SV *t = sv_newmortal(); STRLEN prevlen; @@ -1043,8 +1027,7 @@ register SV *sv; #endif int -sv_backoff(sv) -register SV *sv; +sv_backoff(register SV *sv) { assert(SvOOK(sv)); if (SvIVX(sv)) { @@ -1059,12 +1042,10 @@ register SV *sv; } char * -sv_grow(sv,newlen) -register SV *sv; #ifndef DOSISH -register I32 newlen; +sv_grow(register SV *sv, register I32 newlen) #else -unsigned long newlen; +sv_grow(SV* sv, unsigned long newlen) #endif { register char *s; @@ -1101,9 +1082,7 @@ unsigned long newlen; } void -sv_setiv(sv,i) -register SV *sv; -IV i; +sv_setiv(register SV *sv, IV i) { dTHR; /* just for taint */ sv_check_thinkfirst(sv); @@ -1142,9 +1121,7 @@ IV i; } void -sv_setuv(sv,u) -register SV *sv; -UV u; +sv_setuv(register SV *sv, UV u) { if (u <= IV_MAX) sv_setiv(sv, u); @@ -1153,9 +1130,7 @@ UV u; } void -sv_setnv(sv,num) -register SV *sv; -double num; +sv_setnv(register SV *sv, double num) { dTHR; /* just for taint */ sv_check_thinkfirst(sv); @@ -1200,8 +1175,7 @@ double num; } static void -not_a_number(sv) -SV *sv; +not_a_number(SV *sv) { dTHR; char tmpbuf[64]; @@ -1256,8 +1230,7 @@ SV *sv; } IV -sv_2iv(sv) -register SV *sv; +sv_2iv(register SV *sv) { if (!sv) return 0; @@ -1337,8 +1310,7 @@ register SV *sv; } UV -sv_2uv(sv) -register SV *sv; +sv_2uv(register SV *sv) { if (!sv) return 0; @@ -1408,8 +1380,7 @@ register SV *sv; } double -sv_2nv(sv) -register SV *sv; +sv_2nv(register SV *sv) { if (!sv) return 0.0; @@ -1491,8 +1462,7 @@ register SV *sv; } static IV -asIV(sv) -SV *sv; +asIV(SV *sv) { I32 numtype = looks_like_number(sv); double d; @@ -1510,8 +1480,7 @@ SV *sv; } static UV -asUV(sv) -SV *sv; +asUV(SV *sv) { I32 numtype = looks_like_number(sv); @@ -1526,8 +1495,7 @@ SV *sv; } I32 -looks_like_number(sv) -SV *sv; +looks_like_number(SV *sv) { register char *s; register char *send; @@ -1606,9 +1574,7 @@ SV *sv; } char * -sv_2pv(sv, lp) -register SV *sv; -STRLEN *lp; +sv_2pv(register SV *sv, STRLEN *lp) { register char *s; int olderrno; @@ -1799,8 +1765,7 @@ STRLEN *lp; /* This function is only called on magical items */ bool -sv_2bool(sv) -register SV *sv; +sv_2bool(register SV *sv) { if (SvGMAGICAL(sv)) mg_get(sv); @@ -1846,9 +1811,7 @@ register SV *sv; */ void -sv_setsv(dstr,sstr) -SV *dstr; -register SV *sstr; +sv_setsv(SV *dstr, register SV *sstr) { dTHR; register U32 sflags; @@ -2183,10 +2146,7 @@ register SV *sstr; } void -sv_setpvn(sv,ptr,len) -register SV *sv; -register const char *ptr; -register STRLEN len; +sv_setpvn(register SV *sv, register const char *ptr, register STRLEN len) { dTHR; /* just for taint */ assert(len >= 0); /* STRLEN is probably unsigned, so this may @@ -2211,9 +2171,7 @@ register STRLEN len; } void -sv_setpv(sv,ptr) -register SV *sv; -register const char *ptr; +sv_setpv(register SV *sv, register const char *ptr) { dTHR; /* just for taint */ register STRLEN len; @@ -2238,10 +2196,7 @@ register const char *ptr; } void -sv_usepvn(sv,ptr,len) -register SV *sv; -register char *ptr; -register STRLEN len; +sv_usepvn(register SV *sv, register char *ptr, register STRLEN len) { dTHR; /* just for taint */ sv_check_thinkfirst(sv); @@ -2263,8 +2218,7 @@ register STRLEN len; } static void -sv_check_thinkfirst(sv) -register SV *sv; +sv_check_thinkfirst(register SV *sv) { if (SvTHINKFIRST(sv)) { if (SvREADONLY(sv)) { @@ -2278,9 +2232,9 @@ register SV *sv; } void -sv_chop(sv,ptr) /* like set but assuming ptr is in sv */ -register SV *sv; -register char *ptr; +sv_chop(register SV *sv, register char *ptr) /* like set but assuming ptr is in sv */ + + { register STRLEN delta; @@ -2303,10 +2257,7 @@ register char *ptr; } void -sv_catpvn(sv,ptr,len) -register SV *sv; -register char *ptr; -register STRLEN len; +sv_catpvn(register SV *sv, register char *ptr, register STRLEN len) { dTHR; /* just for taint */ STRLEN tlen; @@ -2324,9 +2275,7 @@ register STRLEN len; } void -sv_catsv(dstr,sstr) -SV *dstr; -register SV *sstr; +sv_catsv(SV *dstr, register SV *sstr) { char *s; STRLEN len; @@ -2337,9 +2286,7 @@ register SV *sstr; } void -sv_catpv(sv,ptr) -register SV *sv; -register char *ptr; +sv_catpv(register SV *sv, register char *ptr) { dTHR; /* just for taint */ register STRLEN len; @@ -2364,9 +2311,9 @@ SV * newSV(x,len) I32 x; #else -newSV(len) +newSV(STRLEN len) #endif -STRLEN len; + { register SV *sv; @@ -2384,12 +2331,7 @@ STRLEN len; /* name is assumed to contain an SV* if (name && namelen == HEf_SVKEY) */ void -sv_magic(sv, obj, how, name, namlen) -register SV *sv; -SV *obj; -int how; -char *name; -I32 namlen; +sv_magic(register SV *sv, SV *obj, int how, char *name, I32 namlen) { MAGIC* mg; @@ -2539,9 +2481,7 @@ I32 namlen; } int -sv_unmagic(sv, type) -SV* sv; -int type; +sv_unmagic(SV *sv, int type) { MAGIC* mg; MAGIC** mgp; @@ -2575,12 +2515,7 @@ int type; } void -sv_insert(bigstr,offset,len,little,littlelen) -SV *bigstr; -STRLEN offset; -STRLEN len; -char *little; -STRLEN littlelen; +sv_insert(SV *bigstr, STRLEN offset, STRLEN len, char *little, STRLEN littlelen) { register char *big; register char *mid; @@ -2658,9 +2593,7 @@ STRLEN littlelen; /* make sv point to what nstr did */ void -sv_replace(sv,nsv) -register SV *sv; -register SV *nsv; +sv_replace(register SV *sv, register SV *nsv) { U32 refcnt = SvREFCNT(sv); sv_check_thinkfirst(sv); @@ -2686,8 +2619,7 @@ register SV *nsv; } void -sv_clear(sv) -register SV *sv; +sv_clear(register SV *sv) { assert(sv); assert(SvREFCNT(sv) == 0); @@ -2695,8 +2627,7 @@ register SV *sv; if (SvOBJECT(sv)) { dTHR; if (defstash) { /* Still have a symbol table? */ - dTHR; - dSP; + djSP; GV* destructor; ENTER; @@ -2844,8 +2775,7 @@ register SV *sv; } SV * -sv_newref(sv) -SV* sv; +sv_newref(SV *sv) { if (sv) SvREFCNT(sv)++; @@ -2853,8 +2783,7 @@ SV* sv; } void -sv_free(sv) -SV *sv; +sv_free(SV *sv) { if (!sv) return; @@ -2884,8 +2813,7 @@ SV *sv; } STRLEN -sv_len(sv) -register SV *sv; +sv_len(register SV *sv) { char *junk; STRLEN len; @@ -2901,9 +2829,7 @@ register SV *sv; } I32 -sv_eq(str1,str2) -register SV *str1; -register SV *str2; +sv_eq(register SV *str1, register SV *str2) { char *pv1; STRLEN cur1; @@ -2929,14 +2855,12 @@ register SV *str2; } I32 -sv_cmp(str1, str2) -register SV *str1; -register SV *str2; +sv_cmp(register SV *str1, register SV *str2) { STRLEN cur1 = 0; - char *pv1 = str1 ? SvPV(str1, cur1) : NULL; + char *pv1 = str1 ? SvPV(str1, cur1) : (char *) NULL; STRLEN cur2 = 0; - char *pv2 = str2 ? SvPV(str2, cur2) : NULL; + char *pv2 = str2 ? SvPV(str2, cur2) : (char *) NULL; I32 retval; if (!cur1) @@ -2957,9 +2881,7 @@ register SV *str2; } I32 -sv_cmp_locale(sv1, sv2) -register SV *sv1; -register SV *sv2; +sv_cmp_locale(register SV *sv1, register SV *sv2) { #ifdef USE_LOCALE_COLLATE @@ -2971,9 +2893,9 @@ register SV *sv2; goto raw_compare; len1 = 0; - pv1 = sv1 ? sv_collxfrm(sv1, &len1) : NULL; + pv1 = sv1 ? sv_collxfrm(sv1, &len1) : (char *) NULL; len2 = 0; - pv2 = sv2 ? sv_collxfrm(sv2, &len2) : NULL; + pv2 = sv2 ? sv_collxfrm(sv2, &len2) : (char *) NULL; if (!pv1 || !len1) { if (pv2 && len2) @@ -3014,13 +2936,11 @@ register SV *sv2; * according to the locale settings. */ char * -sv_collxfrm(sv, nxp) - SV *sv; - STRLEN *nxp; +sv_collxfrm(SV *sv, STRLEN *nxp) { MAGIC *mg; - mg = SvMAGICAL(sv) ? mg_find(sv, 'o') : NULL; + mg = SvMAGICAL(sv) ? mg_find(sv, 'o') : (MAGIC *) NULL; if (!mg || !mg->mg_ptr || *(U32*)mg->mg_ptr != collation_ix) { char *s, *xf; STRLEN len, xlen; @@ -3062,10 +2982,7 @@ sv_collxfrm(sv, nxp) #endif /* USE_LOCALE_COLLATE */ char * -sv_gets(sv,fp,append) -register SV *sv; -register PerlIO *fp; -I32 append; +sv_gets(register SV *sv, register FILE *fp, I32 append) { dTHR; char *rsptr; @@ -3304,8 +3221,7 @@ screamer2: void -sv_inc(sv) -register SV *sv; +sv_inc(register SV *sv) { register char *d; int flags; @@ -3383,8 +3299,7 @@ register SV *sv; } void -sv_dec(sv) -register SV *sv; +sv_dec(register SV *sv) { int flags; @@ -3437,7 +3352,7 @@ register SV *sv; * permanent location. */ static void -sv_mortalgrow() +sv_mortalgrow(void) { dTHR; tmps_max += (tmps_max < 512) ? 128 : 512; @@ -3445,8 +3360,7 @@ sv_mortalgrow() } SV * -sv_mortalcopy(oldstr) -SV *oldstr; +sv_mortalcopy(SV *oldstr) { dTHR; register SV *sv; @@ -3464,7 +3378,7 @@ SV *oldstr; } SV * -sv_newmortal() +sv_newmortal(void) { dTHR; register SV *sv; @@ -3482,8 +3396,7 @@ sv_newmortal() /* same thing without the copying */ SV * -sv_2mortal(sv) -register SV *sv; +sv_2mortal(register SV *sv) { dTHR; if (!sv) @@ -3498,9 +3411,7 @@ register SV *sv; } SV * -newSVpv(s,len) -char *s; -STRLEN len; +newSVpv(char *s, STRLEN len) { register SV *sv; @@ -3544,8 +3455,7 @@ va_dcl SV * -newSVnv(n) -double n; +newSVnv(double n) { register SV *sv; @@ -3558,8 +3468,7 @@ double n; } SV * -newSViv(i) -IV i; +newSViv(IV i) { register SV *sv; @@ -3572,8 +3481,7 @@ IV i; } SV * -newRV(ref) -SV *ref; +newRV(SV *ref) { dTHR; register SV *sv; @@ -3592,8 +3500,7 @@ SV *ref; SV * -Perl_newRV_noinc(ref) -SV *ref; +Perl_newRV_noinc(SV *ref) { register SV *sv; @@ -3605,8 +3512,7 @@ SV *ref; /* make an exact duplicate of old */ SV * -newSVsv(old) -register SV *old; +newSVsv(register SV *old) { register SV *sv; @@ -3631,9 +3537,7 @@ register SV *old; } void -sv_reset(s,stash) -register char *s; -HV *stash; +sv_reset(register char *s, HV *stash) { register HE *entry; register GV *gv; @@ -3697,8 +3601,7 @@ HV *stash; } IO* -sv_2io(sv) -SV *sv; +sv_2io(SV *sv) { IO* io; GV* gv; @@ -3731,11 +3634,7 @@ SV *sv; } CV * -sv_2cv(sv, st, gvp, lref) -SV *sv; -HV **st; -GV **gvp; -I32 lref; +sv_2cv(SV *sv, HV **st, GV **gvp, I32 lref) { GV *gv; CV *cv; @@ -3795,8 +3694,7 @@ I32 lref; } I32 -sv_true(sv) -register SV *sv; +sv_true(register SV *sv) { dTHR; if (!sv) @@ -3826,8 +3724,7 @@ register SV *sv; } IV -sv_iv(sv) -register SV *sv; +sv_iv(register SV *sv) { if (SvIOK(sv)) return SvIVX(sv); @@ -3835,8 +3732,7 @@ register SV *sv; } UV -sv_uv(sv) -register SV *sv; +sv_uv(register SV *sv) { if (SvIOK(sv)) return SvUVX(sv); @@ -3844,8 +3740,7 @@ register SV *sv; } double -sv_nv(sv) -register SV *sv; +sv_nv(register SV *sv) { if (SvNOK(sv)) return SvNVX(sv); @@ -3853,9 +3748,7 @@ register SV *sv; } char * -sv_pvn(sv, lp) -SV *sv; -STRLEN *lp; +sv_pvn(SV *sv, STRLEN *lp) { if (SvPOK(sv)) { *lp = SvCUR(sv); @@ -3865,9 +3758,7 @@ STRLEN *lp; } char * -sv_pvn_force(sv, lp) -SV *sv; -STRLEN *lp; +sv_pvn_force(SV *sv, STRLEN *lp) { char *s; @@ -3918,9 +3809,7 @@ STRLEN *lp; } char * -sv_reftype(sv, ob) -SV* sv; -int ob; +sv_reftype(SV *sv, int ob) { if (ob && SvOBJECT(sv)) return HvNAME(SvSTASH(sv)); @@ -3951,8 +3840,7 @@ int ob; } int -sv_isobject(sv) -SV *sv; +sv_isobject(SV *sv) { if (!sv) return 0; @@ -3967,9 +3855,7 @@ SV *sv; } int -sv_isa(sv, name) -SV *sv; -char *name; +sv_isa(SV *sv, char *name) { if (!sv) return 0; @@ -3985,9 +3871,7 @@ char *name; } SV* -newSVrv(rv, classname) -SV *rv; -char *classname; +newSVrv(SV *rv, char *classname) { dTHR; SV *sv; @@ -4008,10 +3892,7 @@ char *classname; } SV* -sv_setref_pv(rv, classname, pv) -SV *rv; -char *classname; -void* pv; +sv_setref_pv(SV *rv, char *classname, void *pv) { if (!pv) sv_setsv(rv, &sv_undef); @@ -4021,40 +3902,28 @@ void* pv; } SV* -sv_setref_iv(rv, classname, iv) -SV *rv; -char *classname; -IV iv; +sv_setref_iv(SV *rv, char *classname, IV iv) { sv_setiv(newSVrv(rv,classname), iv); return rv; } SV* -sv_setref_nv(rv, classname, nv) -SV *rv; -char *classname; -double nv; +sv_setref_nv(SV *rv, char *classname, double nv) { sv_setnv(newSVrv(rv,classname), nv); return rv; } SV* -sv_setref_pvn(rv, classname, pv, n) -SV *rv; -char *classname; -char* pv; -I32 n; +sv_setref_pvn(SV *rv, char *classname, char *pv, I32 n) { sv_setpvn(newSVrv(rv,classname), pv, n); return rv; } SV* -sv_bless(sv,stash) -SV* sv; -HV* stash; +sv_bless(SV *sv, HV *stash) { dTHR; SV *ref; @@ -4087,8 +3956,7 @@ HV* stash; } static void -sv_unglob(sv) -SV* sv; +sv_unglob(SV *sv) { assert(SvTYPE(sv) == SVt_PVGV); SvFAKE_off(sv); @@ -4102,8 +3970,7 @@ SV* sv; } void -sv_unref(sv) -SV* sv; +sv_unref(SV *sv) { SV* rv = SvRV(sv); @@ -4116,15 +3983,13 @@ SV* sv; } void -sv_taint(sv) -SV *sv; +sv_taint(SV *sv) { sv_magic((sv), Nullsv, 't', Nullch, 0); } void -sv_untaint(sv) -SV *sv; +sv_untaint(SV *sv) { if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { MAGIC *mg = mg_find(sv, 't'); @@ -4134,8 +3999,7 @@ SV *sv; } bool -sv_tainted(sv) -SV *sv; +sv_tainted(SV *sv) { if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { MAGIC *mg = mg_find(sv, 't'); @@ -4146,9 +4010,7 @@ SV *sv; } void -sv_setpviv(sv, iv) -SV *sv; -IV iv; +sv_setpviv(SV *sv, IV iv) { STRLEN len; char buf[TYPE_DIGITS(UV)]; @@ -4225,28 +4087,14 @@ sv_catpvf(sv, pat, va_alist) } void -sv_vsetpvfn(sv, pat, patlen, args, svargs, svmax, used_locale) - SV *sv; - const char *pat; - STRLEN patlen; - va_list *args; - SV **svargs; - I32 svmax; - bool *used_locale; +sv_vsetpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, I32 svmax, char *used_locale) { sv_setpvn(sv, "", 0); sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale); } void -sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale) - SV *sv; - const char *pat; - STRLEN patlen; - va_list *args; - SV **svargs; - I32 svmax; - bool *used_locale; +sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, I32 svmax, char *used_locale) { dTHR; char *p; @@ -4737,8 +4585,7 @@ sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale) #ifdef DEBUGGING void -sv_dump(sv) -SV* sv; +sv_dump(SV *sv) { SV *d = sv_newmortal(); char *s; @@ -5001,8 +4848,11 @@ SV* sv; } #else void -sv_dump(sv) -SV* sv; +sv_dump(SV *sv) { } #endif + + + + diff --git a/t/lib/safe2.t b/t/lib/safe2.t index 40c5098058..a9d24051ea 100755 --- a/t/lib/safe2.t +++ b/t/lib/safe2.t @@ -64,7 +64,8 @@ $glob = "ok 11\n"; sub sayok { print "ok @_\n" } -$cpt->share(qw($foo %bar @baz *glob sayok $")); +$cpt->share(qw($foo %bar @baz *glob sayok)); +$cpt->share('$"') unless $Config{archname} =~ /-thread$/; $cpt->reval(q{ package other; @@ -8,9 +8,7 @@ #include "perl.h" void -taint_proper(f, s) -const char *f; -char *s; +taint_proper(const char *f, char *s) { dTHR; /* just for taint */ char *ug; @@ -33,7 +31,7 @@ char *s; } void -taint_env() +taint_env(void) { SV** svp; MAGIC* mg; @@ -220,11 +220,13 @@ struct thread { U32 flags; AV * magicals; /* Per-thread magicals */ AV * specific; /* Thread-specific user data */ + SV * errsv; /* Backing SV for $@ */ + HV * errhv; /* HV for what was %@ in pp_ctl.c */ perl_mutex mutex; /* For the fields others can change */ U32 tid; struct thread *next, *prev; /* Circular linked list of threads */ JMPENV Tstart_env; /* Top of top_env longjmp() chain */ -#ifdef ADD_THREAD_INTERN +#ifdef HAVE_THREAD_INTERN struct thread_intern i; /* Platform-dependent internals */ #endif char trailing_nul; /* For the sake of thrsv and oursv */ @@ -144,8 +144,7 @@ static struct { #define OLDLOP(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)LSTOP) static int -ao(toketype) -int toketype; +ao(int toketype) { if (*bufptr == '=') { bufptr++; @@ -159,9 +158,7 @@ int toketype; } static void -no_op(what, s) -char *what; -char *s; +no_op(char *what, char *s) { char *oldbp = bufptr; bool is_first = (oldbufptr == linestart); @@ -184,8 +181,7 @@ char *s; } static void -missingterm(s) -char *s; +missingterm(char *s) { char tmpbuf[3]; char q; @@ -211,22 +207,20 @@ char *s; } void -deprecate(s) -char *s; +deprecate(char *s) { if (dowarn) warn("Use of %s is deprecated", s); } static void -depcom() +depcom(void) { deprecate("comma-less variable list"); } void -lex_start(line) -SV *line; +lex_start(SV *line) { dTHR; char *s; @@ -290,14 +284,13 @@ SV *line; } void -lex_end() +lex_end(void) { doextract = FALSE; } static void -restore_rsfp(f) -void *f; +restore_rsfp(void *f) { PerlIO *fp = (PerlIO*)f; @@ -309,8 +302,7 @@ void *f; } static void -incline(s) -char *s; +incline(char *s) { dTHR; char *t; @@ -351,8 +343,7 @@ char *s; } static char * -skipspace(s) -register char *s; +skipspace(register char *s) { dTHR; if (lex_formbrack && lex_brackets <= lex_formbrack) { @@ -410,7 +401,7 @@ register char *s; } static void -check_uni() { +check_uni(void) { char *s; char ch; char *t; @@ -434,9 +425,7 @@ check_uni() { #define UNI(f) return uni(f,s) static int -uni(f,s) -I32 f; -char *s; +uni(I32 f, char *s) { yylval.ival = f; expect = XTERM; @@ -486,8 +475,7 @@ char *s; } static void -force_next(type) -I32 type; +force_next(I32 type) { nexttype[nexttoke] = type; nexttoke++; @@ -499,12 +487,7 @@ I32 type; } static char * -force_word(start,token,check_keyword,allow_pack,allow_tick) -register char *start; -int token; -int check_keyword; -int allow_pack; -int allow_tick; +force_word(register char *start, int token, int check_keyword, int allow_pack, int allow_tick) { register char *s; STRLEN len; @@ -536,9 +519,7 @@ int allow_tick; } static void -force_ident(s, kind) -register char *s; -int kind; +force_ident(register char *s, int kind) { if (s && *s) { OP* o = (OP*)newSVOP(OP_CONST, 0, newSVpv(s,0)); @@ -561,8 +542,7 @@ int kind; } static char * -force_version(s) -char *s; +force_version(char *s) { OP *version = Nullop; @@ -589,8 +569,7 @@ char *s; } static SV * -q(sv) -SV *sv; +q(SV *sv) { register char *s; register char *send; @@ -623,7 +602,7 @@ SV *sv; } static I32 -sublex_start() +sublex_start(void) { register I32 op_type = yylval.ival; @@ -658,7 +637,7 @@ sublex_start() } static I32 -sublex_push() +sublex_push(void) { dTHR; push_scope(); @@ -711,7 +690,7 @@ sublex_push() } static I32 -sublex_done() +sublex_done(void) { if (!lex_starts++) { expect = XOPERATOR; @@ -756,8 +735,7 @@ sublex_done() } static char * -scan_const(start) -char *start; +scan_const(char *start) { register char *send = bufend; SV *sv = NEWSV(93, send - start); @@ -896,8 +874,7 @@ char *start; /* This is the one truly awful dwimmer necessary to conflate C and sed. */ static int -intuit_more(s) -register char *s; +intuit_more(register char *s) { if (lex_brackets) return TRUE; @@ -1025,9 +1002,7 @@ register char *s; } static int -intuit_method(start,gv) -char *start; -GV *gv; +intuit_method(char *start, GV *gv) { char *s = start + (*start == '$'); char tmpbuf[sizeof tokenbuf]; @@ -1073,7 +1048,7 @@ GV *gv; } static char* -incl_perldb() +incl_perldb(void) { if (perldb) { char *pdb = getenv("PERL5DB"); @@ -1104,9 +1079,7 @@ incl_perldb() static int filter_debug = 0; SV * -filter_add(funcp, datasv) - filter_t funcp; - SV *datasv; +filter_add(filter_t funcp, SV *datasv) { if (!funcp){ /* temporary handy debugging hack to be deleted */ filter_debug = atoi((char*)datasv); @@ -1129,8 +1102,7 @@ filter_add(funcp, datasv) /* Delete most recently added instance of this filter function. */ void -filter_del(funcp) - filter_t funcp; +filter_del(filter_t funcp) { if (filter_debug) warn("filter_del func %p", funcp); @@ -1150,10 +1122,10 @@ filter_del(funcp) /* Invoke the n'th filter function for the current rsfp. */ I32 -filter_read(idx, buf_sv, maxlen) - int idx; - SV *buf_sv; - int maxlen; /* 0 = read one text line */ +filter_read(int idx, SV *buf_sv, int maxlen) + + + /* 0 = read one text line */ { filter_t funcp; SV *datasv = NULL; @@ -1208,10 +1180,7 @@ filter_read(idx, buf_sv, maxlen) } static char * -filter_gets(sv,fp, append) -register SV *sv; -register PerlIO *fp; -STRLEN append; +filter_gets(register SV *sv, register FILE *fp, STRLEN append) { if (rsfp_filters) { @@ -1236,7 +1205,7 @@ STRLEN append; EXT int yychar; /* last token */ int -yylex() +yylex(void) { dTHR; register char *s; @@ -1263,7 +1232,7 @@ yylex() && !isALPHA(tokenbuf[1]) /* Rule out obvious non-magicals */ && (tmp = find_thread_magical(&tokenbuf[1])) != NOT_IN_PAD) { - yylval.opval = newOP(OP_SPECIFIC, 0); + yylval.opval = newOP(OP_THREADSV, 0); yylval.opval->op_targ = tmp; return PRIVATEREF; } @@ -1404,7 +1373,7 @@ yylex() nextval[nexttoke].ival = 0; force_next(','); #ifdef USE_THREADS - nextval[nexttoke].opval = newOP(OP_SPECIFIC, 0); + nextval[nexttoke].opval = newOP(OP_THREADSV, 0); nextval[nexttoke].opval->op_targ = find_thread_magical("\""); force_next(PRIVATEREF); #else @@ -2667,7 +2636,7 @@ yylex() (oldoldbufptr == last_lop || oldoldbufptr == last_uni) && /* NO SKIPSPACE BEFORE HERE! */ (expect == XREF || - (opargs[last_lop_op] >> OASHIFT & 7) == OA_FILEREF) ) + ((opargs[last_lop_op] >> OASHIFT)& 7) == OA_FILEREF) ) { bool immediate_paren = *s == '('; @@ -3797,9 +3766,7 @@ yylex() } I32 -keyword(d, len) -register char *d; -I32 len; +keyword(register char *d, I32 len) { switch (*d) { case '_': @@ -4415,10 +4382,7 @@ I32 len; } static void -checkcomma(s,name,what) -register char *s; -char *name; -char *what; +checkcomma(register char *s, char *name, char *what) { char *w; @@ -4460,12 +4424,7 @@ char *what; } static char * -scan_word(s, dest, destlen, allow_package, slp) -register char *s; -char *dest; -STRLEN destlen; -int allow_package; -STRLEN *slp; +scan_word(register char *s, char *dest, STRLEN destlen, int allow_package, STRLEN *slp) { register char *d = dest; register char *e = d + destlen - 3; /* two-character token, ending NUL */ @@ -4492,12 +4451,7 @@ STRLEN *slp; } static char * -scan_ident(s, send, dest, destlen, ck_uni) -register char *s; -register char *send; -char *dest; -STRLEN destlen; -I32 ck_uni; +scan_ident(register char *s, register char *send, char *dest, STRLEN destlen, I32 ck_uni) { register char *d; register char *e; @@ -4613,9 +4567,7 @@ I32 ck_uni; return s; } -void pmflag(pmfl,ch) -U16* pmfl; -int ch; +void pmflag(U16 *pmfl, int ch) { if (ch == 'i') *pmfl |= PMf_FOLD; @@ -4634,8 +4586,7 @@ int ch; } static char * -scan_pat(start) -char *start; +scan_pat(char *start) { PMOP *pm; char *s; @@ -4661,8 +4612,7 @@ char *start; } static char * -scan_subst(start) -char *start; +scan_subst(char *start) { register char *s; register PMOP *pm; @@ -4727,8 +4677,7 @@ char *start; } void -hoistmust(pm) -register PMOP *pm; +hoistmust(register PMOP *pm) { dTHR; if (!pm->op_pmshort && pm->op_pmregexp->regstart && @@ -4768,14 +4717,13 @@ register PMOP *pm; } static char * -scan_trans(start) -char *start; +scan_trans(char *start) { register char* s; OP *o; short *tbl; I32 squash; - I32 delete; + I32 Delete; I32 complement; yylval.ival = OP_NULL; @@ -4804,17 +4752,17 @@ char *start; New(803,tbl,256,short); o = newPVOP(OP_TRANS, 0, (char*)tbl); - complement = delete = squash = 0; + complement = Delete = squash = 0; while (*s == 'c' || *s == 'd' || *s == 's') { if (*s == 'c') complement = OPpTRANS_COMPLEMENT; else if (*s == 'd') - delete = OPpTRANS_DELETE; + Delete = OPpTRANS_DELETE; else squash = OPpTRANS_SQUASH; s++; } - o->op_private = delete|squash|complement; + o->op_private = Delete|squash|complement; lex_op = o; yylval.ival = OP_TRANS; @@ -4822,8 +4770,7 @@ char *start; } static char * -scan_heredoc(s) -register char *s; +scan_heredoc(register char *s) { dTHR; SV *herewas; @@ -4949,8 +4896,7 @@ register char *s; } static char * -scan_inputsymbol(start) -char *start; +scan_inputsymbol(char *start) { register char *s = start; register char *d; @@ -5006,8 +4952,7 @@ char *start; } static char * -scan_str(start) -char *start; +scan_str(char *start) { dTHR; SV *sv; @@ -5103,8 +5048,7 @@ char *start; } char * -scan_num(start) -char *start; +scan_num(char *start) { register char *s = start; register char *d; @@ -5232,8 +5176,7 @@ char *start; } static char * -scan_formline(s) -register char *s; +scan_formline(register char *s) { dTHR; register char *eol; @@ -5303,7 +5246,7 @@ register char *s; } static void -set_csh() +set_csh(void) { #ifdef CSH if (!cshlen) @@ -5312,9 +5255,7 @@ set_csh() } I32 -start_subparse(is_format, flags) -I32 is_format; -U32 flags; +start_subparse(I32 is_format, U32 flags) { dTHR; I32 oldsavestack_ix = savestack_ix; @@ -5374,8 +5315,7 @@ U32 flags; } int -yywarn(s) -char *s; +yywarn(char *s) { dTHR; --error_count; @@ -5386,8 +5326,7 @@ char *s; } int -yyerror(s) -char *s; +yyerror(char *s) { dTHR; char *where = NULL; @@ -5448,7 +5387,7 @@ char *s; if (in_eval & 2) warn("%_", msg); else if (in_eval) - sv_catsv(errsv, msg); + sv_catsv(ERRSV, msg); else PerlIO_write(PerlIO_stderr(), SvPVX(msg), SvCUR(msg)); if (++error_count >= 10) @@ -5457,3 +5396,4 @@ char *s; in_my_stash = Nullhv; return 0; } + diff --git a/universal.c b/universal.c index d6689f8acf..9a867631d0 100644 --- a/universal.c +++ b/universal.c @@ -8,11 +8,7 @@ */ static SV * -isa_lookup(stash, name, len, level) -HV *stash; -char *name; -int len; -int level; +isa_lookup(HV *stash, char *name, int len, int level) { AV* av; GV* gv; @@ -75,9 +71,7 @@ int level; } bool -sv_derived_from(sv, name) -SV * sv ; -char * name ; +sv_derived_from(SV *sv, char *name) { SV *rv; char *type; @@ -203,7 +197,7 @@ XS(XS_UNIVERSAL_VERSION) } void -boot_core_UNIVERSAL() +boot_core_UNIVERSAL(void) { char *file = __FILE__; @@ -71,8 +71,7 @@ static U32 threadnum = 0; */ Malloc_t -safemalloc(size) -MEM_SIZE size; +safemalloc(MEM_SIZE size) { Malloc_t ptr; #ifdef HAS_64K_LIMIT @@ -98,6 +97,7 @@ MEM_SIZE size; else { PerlIO_puts(PerlIO_stderr(),no_mem) FLUSH; my_exit(1); + return Nullch; } /*NOTREACHED*/ } @@ -105,9 +105,7 @@ MEM_SIZE size; /* paranoid version of realloc */ Malloc_t -saferealloc(where,size) -Malloc_t where; -MEM_SIZE size; +saferealloc(Malloc_t where,MEM_SIZE size) { Malloc_t ptr; #if !defined(STANDARD_C) && !defined(HAS_REALLOC_PROTOTYPE) @@ -148,6 +146,7 @@ MEM_SIZE size; else { PerlIO_puts(PerlIO_stderr(),no_mem) FLUSH; my_exit(1); + return Nullch; } /*NOTREACHED*/ } @@ -155,13 +154,12 @@ MEM_SIZE size; /* safe version of free */ Free_t -safefree(where) -Malloc_t where; +safefree(Malloc_t where) { #if !(defined(I286) || defined(atarist)) - DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%x: (%05d) free\n",where,an++)); + DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%x: (%05d) free\n",(char *) where,an++)); #else - DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) free\n",where,an++)); + DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) free\n",(char *) where,an++)); #endif if (where) { /*SUPPRESS 701*/ @@ -172,9 +170,7 @@ Malloc_t where; /* safe version of calloc */ Malloc_t -safecalloc(count, size) -MEM_SIZE count; -MEM_SIZE size; +safecalloc(MEM_SIZE count, MEM_SIZE size) { Malloc_t ptr; @@ -205,6 +201,7 @@ MEM_SIZE size; else { PerlIO_puts(PerlIO_stderr(),no_mem) FLUSH; my_exit(1); + return Nullch; } /*NOTREACHED*/ } @@ -216,9 +213,7 @@ MEM_SIZE size; #define ALIGN sizeof(long) Malloc_t -safexmalloc(x,size) -I32 x; -MEM_SIZE size; +safexmalloc(I32 x, MEM_SIZE size) { register Malloc_t where; @@ -230,17 +225,14 @@ MEM_SIZE size; } Malloc_t -safexrealloc(where,size) -Malloc_t where; -MEM_SIZE size; +safexrealloc(Malloc_t where, MEM_SIZE size) { register Malloc_t new = saferealloc(where - ALIGN, size + ALIGN); return new + ALIGN; } void -safexfree(where) -Malloc_t where; +safexfree(Malloc_t where) { I32 x; @@ -253,10 +245,7 @@ Malloc_t where; } Malloc_t -safexcalloc(x,count,size) -I32 x; -MEM_SIZE count; -MEM_SIZE size; +safexcalloc(I32 x,MEM_SIZE count, MEM_SIZE size) { register Malloc_t where; @@ -269,7 +258,7 @@ MEM_SIZE size; } static void -xstat() +xstat(void) { register I32 i; @@ -286,13 +275,7 @@ xstat() /* copy a string up to some (non-backslashed) delimiter, if any */ char * -delimcpy(to, toend, from, fromend, delim, retlen) -register char *to; -register char *toend; -register char *from; -register char *fromend; -register int delim; -I32 *retlen; +delimcpy(register char *to, register char *toend, register char *from, register char *fromend, register int delim, I32 *retlen) { register I32 tolen; for (tolen = 0; from < fromend; from++, tolen++) { @@ -321,9 +304,7 @@ I32 *retlen; /* This routine was donated by Corey Satten. */ char * -instr(big, little) -register char *big; -register char *little; +instr(register char *big, register char *little) { register char *s, *x; register I32 first; @@ -353,11 +334,7 @@ register char *little; /* same as instr but allow embedded nulls */ char * -ninstr(big, bigend, little, lend) -register char *big; -register char *bigend; -char *little; -char *lend; +ninstr(register char *big, register char *bigend, char *little, char *lend) { register char *s, *x; register I32 first = *little; @@ -386,11 +363,7 @@ char *lend; /* reverse of the above--find last substring */ char * -rninstr(big, bigend, little, lend) -register char *big; -char *bigend; -char *little; -char *lend; +rninstr(register char *big, char *bigend, char *little, char *lend) { register char *bigbeg; register char *s, *x; @@ -420,8 +393,7 @@ char *lend; * Set up for a new ctype locale. */ void -perl_new_ctype(newctype) - char *newctype; +perl_new_ctype(char *newctype) { #ifdef USE_LOCALE_CTYPE @@ -443,8 +415,7 @@ perl_new_ctype(newctype) * Set up for a new collation locale. */ void -perl_new_collate(newcoll) - char *newcoll; +perl_new_collate(char *newcoll) { #ifdef USE_LOCALE_COLLATE @@ -488,8 +459,7 @@ perl_new_collate(newcoll) * Set up for a new numeric locale. */ void -perl_new_numeric(newnum) - char *newnum; +perl_new_numeric(char *newnum) { #ifdef USE_LOCALE_NUMERIC @@ -514,7 +484,7 @@ perl_new_numeric(newnum) } void -perl_set_numeric_standard() +perl_set_numeric_standard(void) { #ifdef USE_LOCALE_NUMERIC @@ -528,7 +498,7 @@ perl_set_numeric_standard() } void -perl_set_numeric_local() +perl_set_numeric_local(void) { #ifdef USE_LOCALE_NUMERIC @@ -546,8 +516,7 @@ perl_set_numeric_local() * Initialize locale awareness. */ int -perl_init_i18nl10n(printwarn) - int printwarn; +perl_init_i18nl10n(int printwarn) { int ok = 1; /* returns @@ -776,8 +745,7 @@ perl_init_i18nl10n(printwarn) /* Backwards compatibility. */ int -perl_init_i18nl14n(printwarn) - int printwarn; +perl_init_i18nl14n(int printwarn) { return perl_init_i18nl10n(printwarn); } @@ -792,10 +760,7 @@ perl_init_i18nl14n(printwarn) * Please see sv_collxfrm() to see how this is used. */ char * -mem_collxfrm(s, len, xlen) - const char *s; - STRLEN len; - STRLEN *xlen; +mem_collxfrm(const char *s, STRLEN len, STRLEN *xlen) { char *xbuf; STRLEN xalloc, xin, xout; @@ -845,8 +810,7 @@ mem_collxfrm(s, len, xlen) #endif /* USE_LOCALE_COLLATE */ void -fbm_compile(sv) -SV *sv; +fbm_compile(SV *sv) { register unsigned char *s; register unsigned char *table; @@ -887,10 +851,7 @@ SV *sv; } char * -fbm_instr(big, bigend, littlestr) -unsigned char *big; -register unsigned char *bigend; -SV *littlestr; +fbm_instr(unsigned char *big, register unsigned char *bigend, SV *littlestr) { register unsigned char *s; register I32 tmp; @@ -963,9 +924,7 @@ SV *littlestr; } char * -screaminstr(bigstr, littlestr) -SV *bigstr; -SV *littlestr; +screaminstr(SV *bigstr, SV *littlestr) { register unsigned char *s, *x; register unsigned char *big; @@ -1024,9 +983,7 @@ SV *littlestr; } I32 -ibcmp(s1, s2, len) -char *s1, *s2; -register I32 len; +ibcmp(char *s1, char *s2, register I32 len) { register U8 *a = (U8 *)s1; register U8 *b = (U8 *)s2; @@ -1039,9 +996,7 @@ register I32 len; } I32 -ibcmp_locale(s1, s2, len) -char *s1, *s2; -register I32 len; +ibcmp_locale(char *s1, char *s2, register I32 len) { register U8 *a = (U8 *)s1; register U8 *b = (U8 *)s2; @@ -1056,8 +1011,7 @@ register I32 len; /* copy a string to a safe spot */ char * -savepv(sv) -char *sv; +savepv(char *sv) { register char *newaddr; @@ -1069,9 +1023,7 @@ char *sv; /* same thing but with a known length */ char * -savepvn(sv, len) -char *sv; -register I32 len; +savepvn(char *sv, register I32 len) { register char *newaddr; @@ -1084,7 +1036,7 @@ register I32 len; /* the SV for form() and mess() is not kept in an arena */ static SV * -mess_alloc() +mess_alloc(void) { SV *sv; XPVMG *any; @@ -1123,9 +1075,7 @@ form(pat, va_alist) } char * -mess(pat, args) - const char *pat; - va_list *args; +mess(const char *pat, va_list *args) { SV *sv; static char dgd[] = " during global destruction.\n"; @@ -1361,8 +1311,7 @@ warn(pat,va_alist) #ifndef VMS /* VMS' my_setenv() is in VMS.c */ #ifndef WIN32 void -my_setenv(nam,val) -char *nam, *val; +my_setenv(char *nam, char *val) { register I32 i=setenv_getix(nam); /* where does it go? */ @@ -1410,8 +1359,7 @@ char *nam, *val; #else /* if WIN32 */ void -my_setenv(nam,val) -char *nam, *val; +my_setenv(char *nam,char *val) { #ifdef USE_WIN32_RTL_ENV @@ -1476,8 +1424,7 @@ char *nam, *val; #endif /* WIN32 */ I32 -setenv_getix(nam) -char *nam; +setenv_getix(char *nam) { register I32 i, len = strlen(nam); @@ -1510,10 +1457,7 @@ char *f; #if !defined(HAS_BCOPY) || !defined(HAS_SAFE_BCOPY) char * -my_bcopy(from,to,len) -register char *from; -register char *to; -register I32 len; +my_bcopy(register char *from,register char *to,register I32 len) { char *retval = to; @@ -1765,12 +1709,10 @@ VTOH(vtohl,long) /* VMS' my_popen() is in VMS.c, same with OS/2. */ #if (!defined(DOSISH) || defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) PerlIO * -my_popen(cmd,mode) -char *cmd; -char *mode; +my_popen(char *cmd, char *mode) { int p[2]; - register I32 this, that; + register I32 This, that; register I32 pid; SV *sv; I32 doexec = strNE(cmd,"-"); @@ -1782,15 +1724,15 @@ char *mode; #endif if (pipe(p) < 0) return Nullfp; - this = (*mode == 'w'); - that = !this; + This = (*mode == 'w'); + that = !This; if (doexec && tainting) { taint_env(); taint_proper("Insecure %s%s", "EXEC"); } while ((pid = (doexec?vfork():fork())) < 0) { if (errno != EAGAIN) { - close(p[this]); + close(p[This]); if (!doexec) croak("Can't fork"); return Nullfp; @@ -1801,7 +1743,7 @@ char *mode; GV* tmpgv; #define THIS that -#define THAT this +#define THAT This close(p[THAT]); if (p[THIS] != (*mode == 'r')) { dup2(p[THIS], *mode == 'r'); @@ -1831,16 +1773,16 @@ char *mode; } do_execfree(); /* free any memory malloced by child on vfork */ close(p[that]); - if (p[that] < p[this]) { - dup2(p[this], p[that]); - close(p[this]); - p[this] = p[that]; + if (p[that] < p[This]) { + dup2(p[This], p[that]); + close(p[This]); + p[This] = p[that]; } - sv = *av_fetch(fdpid,p[this],TRUE); + sv = *av_fetch(fdpid,p[This],TRUE); (void)SvUPGRADE(sv,SVt_IV); SvIVX(sv) = pid; forkprocess = pid; - return PerlIO_fdopen(p[this], mode); + return PerlIO_fdopen(p[This], mode); } #else #if defined(atarist) || defined(DJGPP) @@ -1914,9 +1856,7 @@ int newfd; #ifdef HAS_SIGACTION Sighandler_t -rsignal(signo, handler) -int signo; -Sighandler_t handler; +rsignal(int signo, Sighandler_t handler) { struct sigaction act, oact; @@ -1933,8 +1873,7 @@ Sighandler_t handler; } Sighandler_t -rsignal_state(signo) -int signo; +rsignal_state(int signo) { struct sigaction oact; @@ -1945,10 +1884,7 @@ int signo; } int -rsignal_save(signo, handler, save) -int signo; -Sighandler_t handler; -Sigsave_t *save; +rsignal_save(int signo, Sighandler_t handler, Sigsave_t *save) { struct sigaction act; @@ -1962,9 +1898,7 @@ Sigsave_t *save; } int -rsignal_restore(signo, save) -int signo; -Sigsave_t *save; +rsignal_restore(int signo, Sigsave_t *save) { return sigaction(signo, save, (struct sigaction *)NULL); } @@ -1972,9 +1906,7 @@ Sigsave_t *save; #else /* !HAS_SIGACTION */ Sighandler_t -rsignal(signo, handler) -int signo; -Sighandler_t handler; +rsignal(int signo, Sighandler_t handler) { return signal(signo, handler); } @@ -1983,15 +1915,13 @@ static int sig_trapped; static Signal_t -sig_trap(signo) -int signo; +sig_trap(int signo) { sig_trapped++; } Sighandler_t -rsignal_state(signo) -int signo; +rsignal_state(int signo) { Sighandler_t oldsig; @@ -2004,19 +1934,14 @@ int signo; } int -rsignal_save(signo, handler, save) -int signo; -Sighandler_t handler; -Sigsave_t *save; +rsignal_save(int signo, Sighandler_t handler, Sigsave_t *save) { *save = signal(signo, handler); return (*save == SIG_ERR) ? -1 : 0; } int -rsignal_restore(signo, save) -int signo; -Sigsave_t *save; +rsignal_restore(int signo, Sigsave_t *save) { return (signal(signo, *save) == SIG_ERR) ? -1 : 0; } @@ -2026,8 +1951,7 @@ Sigsave_t *save; /* VMS' my_pclose() is in VMS.c; same with OS/2 */ #if (!defined(DOSISH) || defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) I32 -my_pclose(ptr) -PerlIO *ptr; +my_pclose(FILE *ptr) { Sigsave_t hstat, istat, qstat; int status; @@ -2076,10 +2000,7 @@ PerlIO *ptr; #if !defined(DOSISH) || defined(OS2) I32 -wait4pid(pid,statusp,flags) -int pid; -int *statusp; -int flags; +wait4pid(int pid, int *statusp, int flags) { SV *sv; SV** svp; @@ -2139,9 +2060,7 @@ int flags; void /*SUPPRESS 590*/ -pidgone(pid,status) -int pid; -int status; +pidgone(int pid, int status) { register SV *sv; char spid[TYPE_CHARS(int)]; @@ -2174,11 +2093,7 @@ PerlIO *ptr; #endif void -repeatcpy(to,from,len,count) -register char *to; -register char *from; -I32 len; -register I32 count; +repeatcpy(register char *to, register char *from, I32 len, register I32 count) { register I32 todo; register char *frombase = from; @@ -2312,10 +2227,7 @@ char *b; #endif /* !HAS_RENAME */ UV -scan_oct(start, len, retlen) -char *start; -I32 len; -I32 *retlen; +scan_oct(char *start, I32 len, I32 *retlen) { register char *s = start; register UV retval = 0; @@ -2337,23 +2249,20 @@ I32 *retlen; } UV -scan_hex(start, len, retlen) -char *start; -I32 len; -I32 *retlen; +scan_hex(char *start, I32 len, I32 *retlen) { register char *s = start; register UV retval = 0; bool overflowed = FALSE; char *tmp; - while (len-- && *s && (tmp = strchr(hexdigit, *s))) { + while (len-- && *s && (tmp = strchr((char *) hexdigit, *s))) { register UV n = retval << 4; if (!overflowed && (n >> 4) != retval) { warn("Integer overflow in hex number"); overflowed = TRUE; } - retval = n | (tmp - hexdigit) & 15; + retval = n | ((tmp - hexdigit) & 15); s++; } *retlen = s - start; @@ -2452,8 +2361,7 @@ getTHR _((void)) #endif /* OLD_PTHREADS_API */ MAGIC * -condpair_magic(sv) -SV *sv; +condpair_magic(SV *sv) { MAGIC *mg; @@ -2498,8 +2406,7 @@ SV *sv; * thread calling new_struct_thread) clearly satisfies this constraint. */ struct thread * -new_struct_thread(t) -struct thread *t; +new_struct_thread(struct thread *t) { struct thread *thr; SV *sv; @@ -2527,6 +2434,8 @@ struct thread *t; thr->cvcache = newHV(); thr->magicals = newAV(); thr->specific = newAV(); + thr->errsv = newSVpv("", 0); + thr->errhv = newHV(); thr->flags = THRf_R_JOINABLE; MUTEX_INIT(&thr->mutex); @@ -2586,20 +2495,9 @@ struct thread *t; thr->next->prev = thr; MUTEX_UNLOCK(&threads_mutex); -/* - * This is highly suspect - new_struct_thread is executed - * by creating thread so pthread_self() or equivalent - * is parent thread not the child. - * In particular this should _NOT_ change dTHR value of calling thread. - * - * But a good place to have a 'hook' for filling in port-private - * fields of thr. - */ -#ifdef INIT_THREAD_INTERN - INIT_THREAD_INTERN(thr); -#else - thr->self = pthread_self(); -#endif /* INIT_THREAD_INTERN */ +#ifdef HAVE_THREAD_INTERN + init_thread_intern(thr); +#endif /* HAVE_THREAD_INTERN */ return thr; } #endif /* USE_THREADS */ @@ -2611,8 +2509,9 @@ struct thread *t; * Needed for SunOS with Sun's 'acc' for example. */ double -Perl_huge() +Perl_huge(void) { return HUGE_VAL; } #endif + diff --git a/win32/Makefile b/win32/Makefile index 08fdb693f4..ba02106df4 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -204,7 +204,7 @@ WIN32_C = perllib.c \ WIN32_OBJ = win32.obj \ win32io.obj \ win32sck.obj \ - win32thread.obj + win32thread.obj PERL95_OBJ = perl95.obj \ win32mt.obj \ @@ -273,7 +273,7 @@ DYNALOADMODULES= \ $(OPCODE_DLL) \ $(SDBM_FILE_DLL)\ $(IO_DLL) \ - $(ATTRS_DLL) \ + $(ATTRS_DLL) \ $(THREAD_DLL) POD2HTML=$(PODDIR)\pod2html @@ -307,6 +307,7 @@ config.w32 : $(CFGSH_TMPL) .\config.h : $(CFGH_TMPL) -del /f config.h copy $(CFGH_TMPL) config.h + ..\config.sh : config.w32 $(MINIPERL) config_sh.PL $(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" \ diff --git a/win32/makefile.mk b/win32/makefile.mk index 3dc00a215a..e7c385756b 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -10,8 +10,8 @@ # Set these to wherever you want "nmake install" to put your # newly built perl. INST_DRV=c: -INST_TOP=$(INST_DRV)\perl\perl5004.5X -BUILDOPT=-DUSE_THREADS +INST_TOP=$(INST_DRV)\perl +BUILDOPT=-DUSE_THREADS # -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include diff --git a/win32/perllib.c b/win32/perllib.c index 391b4d375f..317c88ac05 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -2,16 +2,12 @@ * "The Road goes ever on and on, down from the door where it began." */ -#ifdef __cplusplus -extern "C" { -#endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef __cplusplus -} # define EXTERN_C extern "C" #else # define EXTERN_C extern @@ -2014,7 +2014,9 @@ yyparse() register int yym, yyn, yystate; #if YYDEBUG register char *yys; +#ifndef __cplusplus extern char *getenv(); +#endif if (yys = getenv("YYDEBUG")) { @@ -63,10 +63,10 @@ # include <strings.h> #endif -#ifndef HAS_BCOPY +#if !defined(HAS_BCOPY) || defined(__cplusplus) # define bcopy(s1,s2,l) memcpy(s2,s1,l) #endif -#ifndef HAS_BZERO +#if !defined(HAS_BZERO) || defined(__cplusplus) # define bzero(s,l) memset(s,0,l) #endif diff --git a/x2p/a2py.c b/x2p/a2py.c index 3a3cb5275d..202d5921e0 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -18,13 +18,13 @@ char *myname; int checkers = 0; -int oper0(); -int oper1(); -int oper2(); -int oper3(); -int oper4(); -int oper5(); -STR *walk(); +int oper0(int type); +int oper1(int type, int arg1); +int oper2(int type, int arg1, int arg2); +int oper3(int type, int arg1, int arg2, int arg3); +int oper4(int type, int arg1, int arg2, int arg3, int arg4); +int oper5(int type, int arg1, int arg2, int arg3, int arg4, int arg5); +STR *walk(int useval, int level, register int node, int *numericptr, int minprec); #ifdef OS2 static void @@ -44,10 +44,7 @@ usage() #endif int -main(argc,argv,env) -register int argc; -register char **argv; -register char **env; +main(register int argc, register char **argv, register char **env) { register STR *str; int i; @@ -200,7 +197,7 @@ register char **env; int idtype; int -yylex() +yylex(void) { register char *s = bufptr; register char *d; @@ -794,8 +791,7 @@ yylex() } char * -scanpat(s) -register char *s; +scanpat(register char *s) { register char *d; @@ -840,16 +836,14 @@ register char *s; } void -yyerror(s) -char *s; +yyerror(char *s) { fprintf(stderr,"%s in file %s at line %d\n", s,filename,line); } char * -scannum(s) -register char *s; +scannum(register char *s) { register char *d; @@ -885,16 +879,14 @@ register char *s; } int -string(ptr,len) -char *ptr; -int len; +string(char *ptr, int len) { int retval = mop; ops[mop++].ival = OSTRING + (1<<8); if (!len) len = strlen(ptr); - ops[mop].cval = safemalloc(len+1); + ops[mop].cval = (char *) safemalloc(len+1); strncpy(ops[mop].cval,ptr,len); ops[mop++].cval[len] = '\0'; if (mop >= OPSMAX) @@ -903,8 +895,7 @@ int len; } int -oper0(type) -int type; +oper0(int type) { int retval = mop; @@ -917,9 +908,7 @@ int type; } int -oper1(type,arg1) -int type; -int arg1; +oper1(int type, int arg1) { int retval = mop; @@ -933,10 +922,7 @@ int arg1; } int -oper2(type,arg1,arg2) -int type; -int arg1; -int arg2; +oper2(int type, int arg1, int arg2) { int retval = mop; @@ -951,11 +937,7 @@ int arg2; } int -oper3(type,arg1,arg2,arg3) -int type; -int arg1; -int arg2; -int arg3; +oper3(int type, int arg1, int arg2, int arg3) { int retval = mop; @@ -971,12 +953,7 @@ int arg3; } int -oper4(type,arg1,arg2,arg3,arg4) -int type; -int arg1; -int arg2; -int arg3; -int arg4; +oper4(int type, int arg1, int arg2, int arg3, int arg4) { int retval = mop; @@ -993,13 +970,7 @@ int arg4; } int -oper5(type,arg1,arg2,arg3,arg4,arg5) -int type; -int arg1; -int arg2; -int arg3; -int arg4; -int arg5; +oper5(int type, int arg1, int arg2, int arg3, int arg4, int arg5) { int retval = mop; @@ -1019,8 +990,7 @@ int arg5; int depth = 0; void -dump(branch) -int branch; +dump(int branch) { register int type; register int len; @@ -1047,9 +1017,7 @@ int branch; } int -bl(arg,maybe) -int arg; -int maybe; +bl(int arg, int maybe) { if (!arg) return 0; @@ -1062,8 +1030,7 @@ int maybe; } void -fixup(str) -STR *str; +fixup(STR *str) { register char *s; register char *t; @@ -1088,8 +1055,7 @@ STR *str; } void -putlines(str) -STR *str; +putlines(STR *str) { register char *d, *s, *t, *e; register int pos, newpos; @@ -1165,7 +1131,7 @@ STR *str; } void -putone() +putone(void) { register char *t; @@ -1188,8 +1154,7 @@ putone() } int -numary(arg) -int arg; +numary(int arg) { STR *key; int dummy; @@ -1203,8 +1168,7 @@ int arg; } int -rememberargs(arg) -int arg; +rememberargs(int arg) { int type; STR *str; @@ -1226,8 +1190,7 @@ int arg; } int -aryrefarg(arg) -int arg; +aryrefarg(int arg) { int type = ops[arg].ival & 255; STR *str; @@ -1241,10 +1204,7 @@ int arg; } int -fixfargs(name,arg,prevargs) -int name; -int arg; -int prevargs; +fixfargs(int name, int arg, int prevargs) { int type; STR *str; @@ -1280,10 +1240,7 @@ int prevargs; } int -fixrargs(name,arg,prevargs) -char *name; -int arg; -int prevargs; +fixrargs(char *name, int arg, int prevargs) { int type; STR *str; @@ -1297,7 +1254,7 @@ int prevargs; numargs = fixrargs(name,ops[arg+3].ival,numargs); } else { - char *tmpbuf = safemalloc(strlen(name) + (sizeof(prevargs) * 3) + 5); + char *tmpbuf = (char *) safemalloc(strlen(name) + (sizeof(prevargs) * 3) + 5); sprintf(tmpbuf,"%s:%d",name,prevargs); str = hfetch(curarghash,tmpbuf); safefree(tmpbuf); diff --git a/x2p/hash.c b/x2p/hash.c index 5859eab470..9f6bbe9015 100644 --- a/x2p/hash.c +++ b/x2p/hash.c @@ -14,9 +14,7 @@ #include "util.h" STR * -hfetch(tb,key) -register HASH *tb; -char *key; +hfetch(register HASH *tb, char *key) { register char *s; register int i; @@ -42,10 +40,7 @@ char *key; } bool -hstore(tb,key,val) -register HASH *tb; -char *key; -STR *val; +hstore(register HASH *tb, char *key, STR *val) { register char *s; register int i; @@ -133,8 +128,7 @@ char *key; #endif void -hsplit(tb) -HASH *tb; +hsplit(HASH *tb) { int oldsize = tb->tbl_max + 1; register int newsize = oldsize * 2; @@ -171,7 +165,7 @@ HASH *tb; } HASH * -hnew() +hnew(void) { register HASH *tb = (HASH*)safemalloc(sizeof(HASH)); @@ -195,8 +189,7 @@ register HASH *tb; #endif int -hiterinit(tb) -register HASH *tb; +hiterinit(register HASH *tb) { tb->tbl_riter = -1; tb->tbl_eiter = Null(HENT*); @@ -204,8 +197,7 @@ register HASH *tb; } HENT * -hiternext(tb) -register HASH *tb; +hiternext(register HASH *tb) { register HENT *entry; @@ -228,15 +220,13 @@ register HASH *tb; } char * -hiterkey(entry) -register HENT *entry; +hiterkey(register HENT *entry) { return entry->hent_key; } STR * -hiterval(entry) -register HENT *entry; +hiterval(register HENT *entry) { return entry->hent_val; } @@ -13,9 +13,7 @@ #include "util.h" void -str_numset(str,num) -register STR *str; -double num; +str_numset(register STR *str, double num) { str->str_nval = num; str->str_pok = 0; /* invalidate pointer */ @@ -23,8 +21,7 @@ double num; } char * -str_2ptr(str) -register STR *str; +str_2ptr(register STR *str) { register char *s; @@ -47,8 +44,7 @@ register STR *str; } double -str_2num(str) -register STR *str; +str_2num(register STR *str) { if (!str) return 0.0; @@ -65,9 +61,7 @@ register STR *str; } void -str_sset(dstr,sstr) -STR *dstr; -register STR *sstr; +str_sset(STR *dstr, register STR *sstr) { if (!sstr) str_nset(dstr,No,0); @@ -80,10 +74,7 @@ register STR *sstr; } void -str_nset(str,ptr,len) -register STR *str; -register char *ptr; -register int len; +str_nset(register STR *str, register char *ptr, register int len) { GROWSTR(&(str->str_ptr), &(str->str_len), len + 1); bcopy(ptr,str->str_ptr,len); @@ -94,9 +85,7 @@ register int len; } void -str_set(str,ptr) -register STR *str; -register char *ptr; +str_set(register STR *str, register char *ptr) { register int len; @@ -111,9 +100,9 @@ register char *ptr; } void -str_chop(str,ptr) /* like set but assuming ptr is in str */ -register STR *str; -register char *ptr; +str_chop(register STR *str, register char *ptr) /* like set but assuming ptr is in str */ + + { if (!(str->str_pok)) str_2ptr(str); @@ -124,10 +113,7 @@ register char *ptr; } void -str_ncat(str,ptr,len) -register STR *str; -register char *ptr; -register int len; +str_ncat(register STR *str, register char *ptr, register int len) { if (!(str->str_pok)) str_2ptr(str); @@ -140,9 +126,7 @@ register int len; } void -str_scat(dstr,sstr) -STR *dstr; -register STR *sstr; +str_scat(STR *dstr, register STR *sstr) { if (!(sstr->str_pok)) str_2ptr(sstr); @@ -151,9 +135,7 @@ register STR *sstr; } void -str_cat(str,ptr) -register STR *str; -register char *ptr; +str_cat(register STR *str, register char *ptr) { register int len; @@ -170,11 +152,7 @@ register char *ptr; } char * -str_append_till(str,from,delim,keeplist) -register STR *str; -register char *from; -register int delim; -char *keeplist; +str_append_till(register STR *str, register char *from, register int delim, char *keeplist) { register char *to; register int len; @@ -209,8 +187,7 @@ char *keeplist; } STR * -str_new(len) -int len; +str_new(int len) { register STR *str; @@ -228,9 +205,7 @@ int len; } void -str_grow(str,len) -register STR *str; -int len; +str_grow(register STR *str, int len) { if (len && str) GROWSTR(&(str->str_ptr), &(str->str_len), len + 1); @@ -239,9 +214,7 @@ int len; /* make str point to what nstr did */ void -str_replace(str,nstr) -register STR *str; -register STR *nstr; +str_replace(register STR *str, register STR *nstr) { Safefree(str->str_ptr); str->str_ptr = nstr->str_ptr; @@ -254,8 +227,7 @@ register STR *nstr; } void -str_free(str) -register STR *str; +str_free(register STR *str) { if (!str) return; @@ -269,8 +241,7 @@ register STR *str; } int -str_len(str) -register STR *str; +str_len(register STR *str) { if (!str) return 0; @@ -283,9 +254,7 @@ register STR *str; } char * -str_gets(str,fp) -register STR *str; -register FILE *fp; +str_gets(register STR *str, register FILE *fp) { #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE) /* Here is some breathtakingly efficient cheating */ @@ -366,8 +335,7 @@ thats_all_folks: } void -str_inc(str) -register STR *str; +str_inc(register STR *str) { register char *d; @@ -403,8 +371,7 @@ register STR *str; } void -str_dec(str) -register STR *str; +str_dec(register STR *str) { register char *d; @@ -436,8 +403,7 @@ register STR *str; /* make a string that will exist for the duration of the expression eval */ STR * -str_mortal(oldstr) -STR *oldstr; +str_mortal(STR *oldstr) { register STR *str = str_new(0); static long tmps_size = -1; @@ -458,8 +424,7 @@ STR *oldstr; } STR * -str_make(s) -char *s; +str_make(char *s) { register STR *str = str_new(0); @@ -468,8 +433,7 @@ char *s; } STR * -str_nmake(n) -double n; +str_nmake(double n) { register STR *str = str_new(0); diff --git a/x2p/util.c b/x2p/util.c index 469beb0c14..3d3b99a952 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -24,8 +24,7 @@ static char nomem[] = "Out of memory!\n"; Malloc_t -safemalloc(size) -MEM_SIZE size; +safemalloc(size_t size) { Malloc_t ptr; @@ -48,9 +47,7 @@ MEM_SIZE size; /* paranoid version of realloc */ Malloc_t -saferealloc(where,size) -Malloc_t where; -MEM_SIZE size; +saferealloc(void *where, size_t size) { Malloc_t ptr; @@ -74,8 +71,7 @@ MEM_SIZE size; /* safe version of free */ Free_t -safefree(where) -Malloc_t where; +safefree(void *where) { #ifdef DEBUGGING if (debug & 128) @@ -87,10 +83,7 @@ Malloc_t where; /* safe version of string copy */ char * -safecpy(to,from,len) -char *to; -register char *from; -register int len; +safecpy(char *to, register char *from, register int len) { register char *dest = to; @@ -103,9 +96,7 @@ register int len; /* copy a string up to some (non-backslashed) delimiter, if any */ char * -cpytill(to,from,delim) -register char *to, *from; -register int delim; +cpytill(register char *to, register char *from, register int delim) { for (; *from; from++,to++) { if (*from == '\\') { @@ -124,9 +115,7 @@ register int delim; char * -cpy2(to,from,delim) -register char *to, *from; -register int delim; +cpy2(register char *to, register char *from, register int delim) { for (; *from; from++,to++) { if (*from == '\\') @@ -144,9 +133,7 @@ register int delim; /* return ptr to little string in big string, NULL if not found */ char * -instr(big, little) -char *big, *little; - +instr(char *big, char *little) { register char *t, *s, *x; @@ -166,10 +153,9 @@ char *big, *little; /* copy a string to a safe spot */ char * -savestr(str) -char *str; +savestr(char *str) { - register char *newaddr = safemalloc((MEM_SIZE)(strlen(str)+1)); + register char *newaddr = (char *) safemalloc((MEM_SIZE)(strlen(str)+1)); (void)strcpy(newaddr,str); return newaddr; @@ -178,16 +164,13 @@ char *str; /* grow a static string to at least a certain length */ void -growstr(strptr,curlen,newlen) -char **strptr; -int *curlen; -int newlen; +growstr(char **strptr, int *curlen, int newlen) { if (newlen > *curlen) { /* need more room? */ if (*curlen) - *strptr = saferealloc(*strptr,(MEM_SIZE)newlen); + *strptr = (char *) saferealloc(*strptr,(MEM_SIZE)newlen); else - *strptr = safemalloc((MEM_SIZE)newlen); + *strptr = (char *) safemalloc((MEM_SIZE)newlen); *curlen = newlen; } } diff --git a/x2p/walk.c b/x2p/walk.c index cb40073b22..0b4065586b 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -37,12 +37,12 @@ STR * walk _(( int useval, int level, int node, int *numericptr, int minprec )); STR * -walk(useval,level,node,numericptr,minprec) -int useval; -int level; -register int node; -int *numericptr; -int minprec; /* minimum precedence without parens */ +walk(int useval, int level, register int node, int *numericptr, int minprec) + + + + + /* minimum precedence without parens */ { register int len; register STR *str; @@ -1556,9 +1556,7 @@ sub Pick {\n\ } static void -tab(str,lvl) -register STR *str; -register int lvl; +tab(register STR *str, register int lvl) { while (lvl > 1) { str_cat(str,"\t"); @@ -1569,9 +1567,7 @@ register int lvl; } static void -fixtab(str,lvl) -register STR *str; -register int lvl; +fixtab(register STR *str, register int lvl) { register char *s; @@ -1589,8 +1585,7 @@ register int lvl; } static void -addsemi(str) -register STR *str; +addsemi(register STR *str) { register char *s; @@ -1602,9 +1597,7 @@ register STR *str; } static void -emit_split(str,level) -register STR *str; -int level; +emit_split(register STR *str, int level) { register int i; @@ -1637,11 +1630,7 @@ int level; } int -prewalk(numit,level,node,numericptr) -int numit; -int level; -register int node; -int *numericptr; +prewalk(int numit, int level, register int node, int *numericptr) { register int len; register int type; @@ -2058,8 +2047,7 @@ int *numericptr; } static void -numericize(node) -register int node; +numericize(register int node) { register int len; register int type; |