summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-11-11 16:36:22 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-11-11 16:36:22 +0000
commite5687acb0c7cb7e00d80dde70d5d9163677bffea (patch)
tree85408ddaa2ae5aac8fb957f4ee0e9cc81e5c49ff
parent2faa37ccf8e46b865687f0ab4992b29a75eb79ea (diff)
parent4a8966581a604869d2f8db229d9d60d76ee72dcf (diff)
downloadperl-e5687acb0c7cb7e00d80dde70d5d9163677bffea.tar.gz
Initial integration of ansi branch into mainline (untested).
p4raw-id: //depot/perl@230
-rw-r--r--INTERN.h7
-rw-r--r--MANIFEST9
-rw-r--r--XSUB.h2
-rw-r--r--av.c116
-rwxr-xr-xconfigure124
-rw-r--r--deb.c6
-rw-r--r--doio.c103
-rw-r--r--doop.c37
-rw-r--r--dump.c24
-rw-r--r--embed.h20
-rw-r--r--ext/DynaLoader/dl_dlopen.xs2
-rw-r--r--ext/Fcntl/Fcntl.xs7
-rw-r--r--ext/GDBM_File/GDBM_File.xs9
-rw-r--r--ext/IO/IO.xs7
-rw-r--r--ext/Opcode/Opcode.pm2
-rw-r--r--ext/Opcode/Opcode.xs32
-rw-r--r--ext/POSIX/POSIX.xs7
-rw-r--r--ext/SDBM_File/sdbm/hash.c4
-rw-r--r--ext/SDBM_File/sdbm/pair.c45
-rw-r--r--ext/SDBM_File/sdbm/sdbm.c66
-rw-r--r--ext/SDBM_File/sdbm/sdbm.h9
-rw-r--r--ext/SDBM_File/sdbm/util.c7
-rw-r--r--ext/Socket/Socket.xs11
-rw-r--r--ext/Thread/Thread.xs110
-rw-r--r--ext/attrs/attrs.xs7
-rw-r--r--global.sym11
-rw-r--r--gv.c111
-rw-r--r--hv.c132
-rw-r--r--malloc.c38
-rw-r--r--mg.c220
-rw-r--r--miniperlmain.c8
-rw-r--r--op.c501
-rw-r--r--op.h2
-rw-r--r--opcode.h8
-rwxr-xr-xopcode.pl8
-rw-r--r--perl.c160
-rw-r--r--perl.h97
-rw-r--r--perlio.c10
-rw-r--r--perly.c9
-rw-r--r--perly.y2
-rw-r--r--pp.c281
-rw-r--r--pp.h10
-rw-r--r--pp_ctl.c126
-rw-r--r--pp_hot.c85
-rw-r--r--pp_sys.c308
-rw-r--r--proto.h11
-rw-r--r--regcomp.c131
-rw-r--r--regexec.c42
-rw-r--r--run.c15
-rw-r--r--scope.c107
-rw-r--r--sv.c417
-rw-r--r--sv.h22
-rwxr-xr-xt/TEST55
-rwxr-xr-xt/lib/english.t8
-rw-r--r--t/lib/thread.t54
-rwxr-xr-xt/op/misc.t9
-rw-r--r--t/op/nothread.t35
-rw-r--r--taint.c6
-rw-r--r--thread.h9
-rw-r--r--thread.sym1
-rw-r--r--toke.c172
-rw-r--r--universal.c12
-rw-r--r--util.c347
-rw-r--r--win32/Makefile43
-rw-r--r--win32/config.bc8
-rw-r--r--win32/config.vc7
-rw-r--r--win32/config_H.bc2
-rw-r--r--win32/config_H.vc2
-rw-r--r--win32/makedef.pl61
-rw-r--r--win32/makefile.mk59
-rw-r--r--win32/perllib.c4
-rw-r--r--win32/win32.c84
-rw-r--r--win32/win32.h30
-rw-r--r--win32/win32io.c24
-rw-r--r--win32/win32io.h10
-rw-r--r--win32/win32iop.h24
-rw-r--r--win32/win32sck.c7
-rw-r--r--win32/win32thread.c31
-rw-r--r--win32/win32thread.h94
-rw-r--r--x2p/a2p.c2
-rw-r--r--x2p/a2p.h4
-rw-r--r--x2p/a2py.c105
-rw-r--r--x2p/hash.c26
-rw-r--r--x2p/str.c84
-rw-r--r--x2p/util.c41
-rw-r--r--x2p/walk.c36
86 files changed, 2166 insertions, 2975 deletions
diff --git a/INTERN.h b/INTERN.h
index ba71c2f7ad..22e42c5b97 100644
--- a/INTERN.h
+++ b/INTERN.h
@@ -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
diff --git a/MANIFEST b/MANIFEST
index 363b264919..53ffcab82d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -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
@@ -721,6 +719,7 @@ t/lib/symbol.t See if Symbol works
t/lib/texttabs.t See if Text::Tabs works
t/lib/textwrap.t See if Text::Wrap works
t/lib/timelocal.t See if Time::Local works
+t/lib/thread.t Basic test of threading (skipped if no threads)
t/lib/trig.t See if Math::Trig works
t/op/append.t See if . works
t/op/arith.t See if arithmetic works
@@ -755,6 +754,7 @@ t/op/method.t See if method calls work
t/op/misc.t See if miscellaneous bugs have been fixed
t/op/mkdir.t See if mkdir works
t/op/my.t See if lexical scoping works
+t/op/nothread.t local @_ test which does not work threaded
t/op/oct.t See if oct and hex work
t/op/ord.t See if ord works
t/op/pack.t See if pack and unpack work
@@ -800,6 +800,7 @@ t/pragma/warn-1global Tests of global warnings for warning.t
t/pragma/warning.t See if warning controls work
taint.c Tainting code
thread.h Threading header
+thread.sym Symbols for threads
toke.c The tokener
universal.c The default UNIVERSAL package methods
unixish.h Defines that are assumed on Unix
@@ -883,6 +884,8 @@ win32/win32io.c Win32 port
win32/win32io.h Win32 port
win32/win32iop.h Win32 port
win32/win32sck.c Win32 port
+win32/win32thread.h Win32 port mapping to threads
+win32/win32thread.c Win32 functions for threads
writemain.SH Generate perlmain.c from miniperlmain.c+extensions
x2p/EXTERN.h Same as above
x2p/INTERN.h Same as above
diff --git a/XSUB.h b/XSUB.h
index b3ea825519..c7c3f6d80e 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -7,7 +7,7 @@
#endif
#define dXSARGS \
- dTHR; dSP; dMARK; \
+ dSP; dMARK; \
I32 ax = mark - stack_base + 1; \
I32 items = sp - mark
diff --git a/av.c b/av.c
index 933e6559c3..5a8646071b 100644
--- a/av.c
+++ b/av.c
@@ -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 "$@"
diff --git a/deb.c b/deb.c
index 01463c90a6..95ea3f4087 100644
--- a/deb.c
+++ b/deb.c
@@ -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;
diff --git a/doio.c b/doio.c
index 54b6d56747..8413fca7cf 100644
--- a/doio.c
+++ b/doio.c
@@ -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 */
+
diff --git a/doop.c b/doop.c
index 0be09acfc9..277f46ef7a 100644
--- a/doop.c
+++ b/doop.c
@@ -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;
}
+
diff --git a/dump.c b/dump.c
index cf9cf5deb0..51fd157f60 100644
--- a/dump.c
+++ b/dump.c
@@ -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;
diff --git a/embed.h b/embed.h
index 0101ca8ad8..46709be1c1 100644
--- a/embed.h
+++ b/embed.h
@@ -443,6 +443,7 @@
#define newPVOP Perl_newPVOP
#define newRANGE Perl_newRANGE
#define newRV Perl_newRV
+#define newRV_noinc Perl_newRV_noinc
#define newSLICEOP Perl_newSLICEOP
#define newSTATEOP Perl_newSTATEOP
#define newSUB Perl_newSUB
@@ -482,6 +483,7 @@
#define nomethod_amg Perl_nomethod_amg
#define not_amg Perl_not_amg
#define nthreads Perl_nthreads
+#define nthreads_cond Perl_nthreads_cond
#define numer_amg Perl_numer_amg
#define numeric_local Perl_numeric_local
#define numeric_name Perl_numeric_name
@@ -1055,12 +1057,14 @@
#define sv_insert Perl_sv_insert
#define sv_isa Perl_sv_isa
#define sv_isobject Perl_sv_isobject
+#define sv_iv Perl_sv_iv
#define sv_len Perl_sv_len
#define sv_magic Perl_sv_magic
#define sv_mortalcopy Perl_sv_mortalcopy
#define sv_newmortal Perl_sv_newmortal
#define sv_newref Perl_sv_newref
#define sv_no Perl_sv_no
+#define sv_nv Perl_sv_nv
#define sv_peek Perl_sv_peek
#define sv_pvn_force Perl_sv_pvn_force
#define sv_ref Perl_sv_ref
@@ -1083,12 +1087,14 @@
#define sv_setuv Perl_sv_setuv
#define sv_taint Perl_sv_taint
#define sv_tainted Perl_sv_tainted
+#define sv_true Perl_sv_true
#define sv_undef Perl_sv_undef
#define sv_unmagic Perl_sv_unmagic
#define sv_unref Perl_sv_unref
#define sv_untaint Perl_sv_untaint
#define sv_upgrade Perl_sv_upgrade
#define sv_usepvn Perl_sv_usepvn
+#define sv_uv Perl_sv_uv
#define sv_vcatpvfn Perl_sv_vcatpvfn
#define sv_vsetpvfn Perl_sv_vsetpvfn
#define sv_yes Perl_sv_yes
@@ -1096,6 +1102,7 @@
#define taint_proper Perl_taint_proper
#define thisexpr Perl_thisexpr
#define thr_key Perl_thr_key
+#define threads_mutex Perl_threads_mutex
#define timesbuf Perl_timesbuf
#define tokenbuf Perl_tokenbuf
#define too_few_arguments Perl_too_few_arguments
@@ -1177,10 +1184,6 @@
#ifndef BINCOMPAT3
#define Error Perl_Error
-#define SvIV Perl_SvIV
-#define SvNV Perl_SvNV
-#define SvTRUE Perl_SvTRUE
-#define SvUV Perl_SvUV
#define block_type Perl_block_type
#define boot_core_UNIVERSAL Perl_boot_core_UNIVERSAL
#define comppad_name_floor Perl_comppad_name_floor
@@ -1264,7 +1267,8 @@
#define e_tmpname (curinterp->Ie_tmpname)
#define endav (curinterp->Iendav)
#define envgv (curinterp->Ienvgv)
-#define errgv (curinterp->Ierrgv)
+#define errhv (curinterp->Ierrhv)
+#define errsv (curinterp->Ierrsv)
#define eval_root (curinterp->Ieval_root)
#define eval_start (curinterp->Ieval_start)
#define fdpid (curinterp->Ifdpid)
@@ -1416,7 +1420,8 @@
#define Ie_tmpname e_tmpname
#define Iendav endav
#define Ienvgv envgv
-#define Ierrgv errgv
+#define Ierrhv errhv
+#define Ierrsv errsv
#define Ieval_root eval_root
#define Ieval_start eval_start
#define Ifdpid fdpid
@@ -1577,7 +1582,8 @@
#define e_fp Perl_e_fp
#define e_tmpname Perl_e_tmpname
#define endav Perl_endav
-#define errgv Perl_errgv
+#define errhv Perl_errhv
+#define errsv Perl_errsv
#define eval_root Perl_eval_root
#define eval_start Perl_eval_start
#define fdpid Perl_fdpid
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..d3305ec38d 100644
--- a/ext/GDBM_File/GDBM_File.xs
+++ b/ext/GDBM_File/GDBM_File.xs
@@ -20,11 +20,10 @@ typedef GDBM_FILE GDBM_File;
typedef datum gdatum;
-typedef void (*FATALFUNC)();
+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 dcc5d745a4..b71e8b43cf 100644
--- a/ext/Opcode/Opcode.pm
+++ b/ext/Opcode/Opcode.pm
@@ -438,7 +438,7 @@ These ops are related to multi-threading.
A handy tag name for a I<reasonable> default set of ops. (The current ops
allowed are unstable while development continues. It will change.)
- :base_core :base_mem :base_loop :base_io :base_orig
+ :base_core :base_mem :base_loop :base_io :base_orig :base_thread
If safety matters to you (and why else would you be using the Opcode module?)
then you should not rely on the definition of this, or indeed any other, optag!
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 f5bb2220b2..841b5698a1 100644
--- a/ext/Thread/Thread.xs
+++ b/ext/Thread/Thread.xs
@@ -5,13 +5,26 @@
/* Magic signature for Thread's mg_private is "Th" */
#define Thread_MAGIC_SIGNATURE 0x5468
+#ifdef __cplusplus
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#endif
+#include <fcntl.h>
+
static U32 threadnum = 0;
static int sig_pipe[2];
+
+#ifndef THREAD_RET_TYPE
+typedef struct thread *Thread;
+#define THREAD_RET_TYPE void *
+#define THREAD_RET_CAST(x) ((THREAD_RET_TYPE) x)
+#endif;
static void
-remove_thread(t)
-Thread t;
+remove_thread(struct thread *t)
{
+#ifdef USE_THREADS
DEBUG_L(WITH_THR(PerlIO_printf(PerlIO_stderr(),
"%p: remove_thread %p\n", thr, t)));
MUTEX_LOCK(&threads_mutex);
@@ -21,12 +34,13 @@ Thread t;
t->next->prev = t->prev;
COND_BROADCAST(&nthreads_cond);
MUTEX_UNLOCK(&threads_mutex);
+#endif
}
static THREAD_RET_TYPE
-threadstart(arg)
-void *arg;
+threadstart(void *arg)
{
+#ifdef USE_THREADS
#ifdef FAKE_THREADS
Thread savethread = thr;
LOGOP myop;
@@ -68,15 +82,17 @@ void *arg;
#else
Thread thr = (Thread) arg;
LOGOP myop;
- dSP;
+ djSP;
I32 oldmark = TOPMARK;
I32 oldscope = scopestack_ix;
I32 retval;
AV *returnav;
int i, ret;
dJMPENV;
+ DEBUG_L(PerlIO_printf(PerlIO_stderr(), "new thread %p waiting to start\n",
+ thr));
- /* Don't call *anything* requiring dTHR until after pthread_setspecific */
+ /* Don't call *anything* requiring dTHR until after SET_THR() */
/*
* Wait until our creator releases us. If we didn't do this, then
* it would be potentially possible for out thread to carry on and
@@ -192,15 +208,15 @@ void *arg;
/* us unless we're detached, in which */
/* case noone sees the value anyway. */
#endif
+#else
+ return THREAD_RET_CAST(NULL);
+#endif
}
static SV *
-newthread(startsv, initargs, class)
-SV *startsv;
-AV *initargs;
-char *class;
+newthread (SV *startsv, AV *initargs, char *Class)
{
- dTHR;
+#ifdef USE_THREADS
dSP;
Thread savethread;
int i;
@@ -214,8 +230,8 @@ char *class;
thr = new_struct_thread(thr);
SPAGAIN;
DEBUG_L(PerlIO_printf(PerlIO_stderr(),
- "%p: newthread, tid is %u, preparing stack\n",
- savethread, thr->tid));
+ "%p: newthread (%p), tid is %u, preparing stack\n",
+ savethread, thr, thr->tid));
/* The following pushes the arg list and startsv onto the *new* stack */
PUSHMARK(sp);
/* Could easily speed up the following greatly */
@@ -223,9 +239,8 @@ char *class;
XPUSHs(SvREFCNT_inc(*av_fetch(initargs, i, FALSE)));
XPUSHs(SvREFCNT_inc(startsv));
PUTBACK;
-
#ifdef THREAD_CREATE
- THREAD_CREATE(thr, threadstart);
+ err = THREAD_CREATE(thr, threadstart);
#else
/* On your marks... */
MUTEX_LOCK(&thr->mutex);
@@ -239,6 +254,8 @@ char *class;
MUTEX_UNLOCK(&thr->mutex);
#endif
if (err) {
+ DEBUG_L(PerlIO_printf(PerlIO_stderr(),
+ "%p: create of %p failed %d\n", savethread, thr, err));
/* Thread creation failed--clean up */
SvREFCNT_dec(thr->cvcache);
remove_thread(thr);
@@ -257,26 +274,32 @@ char *class;
sv = newSViv(thr->tid);
sv_magic(sv, thr->oursv, '~', 0, 0);
SvMAGIC(sv)->mg_private = Thread_MAGIC_SIGNATURE;
- return sv_bless(newRV_noinc(sv), gv_stashpv(class, TRUE));
+ return sv_bless(newRV_noinc(sv), gv_stashpv(Class, TRUE));
+#else
+ croak("No threads in this perl");
+ return &sv_undef;
+#endif
}
+static Signal_t handle_thread_signal _((int sig));
+
static Signal_t
-handle_thread_signal(sig)
-int sig;
+handle_thread_signal(int sig)
{
char c = (char) sig;
write(sig_pipe[0], &c, 1);
}
MODULE = Thread PACKAGE = Thread
+PROTOTYPES: DISABLE
void
-new(class, startsv, ...)
- char * class
+new(Class, startsv, ...)
+ char * Class
SV * startsv
AV * av = av_make(items - 2, &ST(2));
PPCODE:
- XPUSHs(sv_2mortal(newthread(startsv, av, class)));
+ XPUSHs(sv_2mortal(newthread(startsv, av, Class)));
void
join(t)
@@ -284,6 +307,7 @@ join(t)
AV * av = NO_INIT
int i = NO_INIT
PPCODE:
+#ifdef USE_THREADS
DEBUG_L(PerlIO_printf(PerlIO_stderr(), "%p: joining %p (state %u)\n",
thr, t, ThrSTATE(t)););
MUTEX_LOCK(&t->mutex);
@@ -308,11 +332,13 @@ join(t)
/* Could easily speed up the following if necessary */
for (i = 0; i <= AvFILL(av); i++)
XPUSHs(sv_2mortal(*av_fetch(av, i, FALSE)));
+#endif
void
detach(t)
Thread t
CODE:
+#ifdef USE_THREADS
DEBUG_L(PerlIO_printf(PerlIO_stderr(), "%p: detaching %p (state %u)\n",
thr, t, ThrSTATE(t)););
MUTEX_LOCK(&t->mutex);
@@ -335,6 +361,7 @@ detach(t)
croak("can't detach thread");
/* NOTREACHED */
}
+#endif
void
equal(t1, t2)
@@ -347,26 +374,34 @@ void
flags(t)
Thread t
PPCODE:
+#ifdef USE_THREADS
PUSHs(sv_2mortal(newSViv(t->flags)));
+#endif
void
-self(class)
- char * class
+self(Class)
+ char * Class
PREINIT:
SV *sv;
- PPCODE:
+ PPCODE:
+#ifdef USE_THREADS
sv = newSViv(thr->tid);
sv_magic(sv, thr->oursv, '~', 0, 0);
SvMAGIC(sv)->mg_private = Thread_MAGIC_SIGNATURE;
- PUSHs(sv_2mortal(sv_bless(newRV_noinc(sv), gv_stashpv(class, TRUE))));
+ PUSHs(sv_2mortal(sv_bless(newRV_noinc(sv), gv_stashpv(Class, TRUE))));
+#endif
U32
tid(t)
Thread t
CODE:
+#ifdef USE_THREADS
MUTEX_LOCK(&t->mutex);
RETVAL = t->tid;
MUTEX_UNLOCK(&t->mutex);
+#else
+ RETVAL = 0;
+#endif
OUTPUT:
RETVAL
@@ -379,13 +414,18 @@ DESTROY(t)
void
yield()
CODE:
+{
+#ifdef USE_THREADS
YIELD;
+#endif
+}
void
cond_wait(sv)
SV * sv
MAGIC * mg = NO_INIT
-CODE:
+CODE:
+#ifdef USE_THREADS
if (SvROK(sv))
sv = SvRV(sv);
@@ -402,12 +442,14 @@ CODE:
COND_WAIT(MgOWNERCONDP(mg), MgMUTEXP(mg));
MgOWNER(mg) = thr;
MUTEX_UNLOCK(MgMUTEXP(mg));
-
+#endif
+
void
cond_signal(sv)
SV * sv
MAGIC * mg = NO_INIT
CODE:
+#ifdef USE_THREADS
if (SvROK(sv))
sv = SvRV(sv);
@@ -420,12 +462,14 @@ CODE:
}
COND_SIGNAL(MgCONDP(mg));
MUTEX_UNLOCK(MgMUTEXP(mg));
+#endif
void
cond_broadcast(sv)
SV * sv
MAGIC * mg = NO_INIT
-CODE:
+CODE:
+#ifdef USE_THREADS
if (SvROK(sv))
sv = SvRV(sv);
@@ -439,16 +483,18 @@ CODE:
}
COND_BROADCAST(MgCONDP(mg));
MUTEX_UNLOCK(MgMUTEXP(mg));
+#endif
void
-list(class)
- char * class
+list(Class)
+ char * Class
PREINIT:
Thread t;
AV * av;
SV ** svp;
int n = 0;
PPCODE:
+#ifdef USE_THREADS
av = newAV();
/*
* Iterate until we have enough dynamic storage for all threads.
@@ -464,7 +510,7 @@ list(class)
SV *sv = newSViv(0); /* fill in tid later */
sv_magic(sv, 0, '~', 0, 0); /* fill in other magic later */
av_push(av, sv_bless(newRV_noinc(sv),
- gv_stashpv(class, TRUE)));
+ gv_stashpv(Class, TRUE)));
}
}
@@ -498,6 +544,7 @@ list(class)
for (svp = AvARRAY(av); n > 0; n--, svp++)
PUSHs(*svp);
(void)sv_2mortal((SV*)av);
+#endif
MODULE = Thread PACKAGE = Thread::Signal
@@ -532,3 +579,4 @@ await_signal()
RETVAL = c ? psig_ptr[c] : &sv_no;
OUTPUT:
RETVAL
+
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:
diff --git a/global.sym b/global.sym
index aab677c115..c2c8b0b18e 100644
--- a/global.sym
+++ b/global.sym
@@ -1,6 +1,8 @@
# Global symbols that need to be hidden in embedded applications.
# Variables
+nthreads_cond
+threads_mutex
AMG_names
Error
@@ -301,10 +303,10 @@ yyval
# Functions
Gv_AMupdate
-SvTRUE
-SvIV
-SvUV
-SvNV
+sv_true
+sv_iv
+sv_uv
+sv_nv
amagic_call
append_elem
append_list
@@ -618,6 +620,7 @@ newPROG
newPVOP
newRANGE
newRV
+newRV_noinc
newSLICEOP
newSTATEOP
newSUB
diff --git a/gv.c b/gv.c
index 857e19c221..7d8df6cd17 100644
--- a/gv.c
+++ b/gv.c
@@ -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 */
+
diff --git a/hv.c b/hv.c
index 15d6c624de..f3ab6ccbb9 100644
--- a/hv.c
+++ b/hv.c
@@ -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/malloc.c b/malloc.c
index 4794e08447..00ca55663f 100644
--- a/malloc.c
+++ b/malloc.c
@@ -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
diff --git a/mg.c b/mg.c
index 15005e075e..bcb9e838fa 100644
--- a/mg.c
+++ b/mg.c
@@ -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;
@@ -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;
@@ -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;
}
diff --git a/op.c b/op.c
index 50073b17ba..796c034a26 100644
--- a/op.c
+++ b/op.c
@@ -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;
@@ -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:
@@ -1268,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:
@@ -1314,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) {
@@ -1327,9 +1292,7 @@ I32 type;
}
OP *
-ref(o, type)
-OP *o;
-I32 type;
+ref(OP *o, I32 type)
{
OP *kid;
@@ -1347,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);
@@ -1370,7 +1333,7 @@ I32 type;
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);
@@ -1378,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))
@@ -1414,8 +1377,7 @@ I32 type;
}
OP *
-my(o)
-OP *o;
+my(OP *o)
{
OP *kid;
I32 type;
@@ -1442,8 +1404,7 @@ OP *o;
}
OP *
-sawparens(o)
-OP *o;
+sawparens(OP *o)
{
if (o)
o->op_flags |= OPf_PARENS;
@@ -1451,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;
@@ -1492,8 +1450,7 @@ OP *right;
}
OP *
-invert(o)
-OP *o;
+invert(OP *o)
{
if (!o)
return o;
@@ -1502,8 +1459,7 @@ OP *o;
}
OP *
-scope(o)
-OP *o;
+scope(OP *o)
{
if (o) {
if (o->op_flags & OPf_PARENS || PERLDB_NOOPT || tainting) {
@@ -1530,8 +1486,7 @@ OP *o;
}
int
-block_start(full)
-int full;
+block_start(int full)
{
dTHR;
int retval = savestack_ix;
@@ -1555,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;
@@ -1572,8 +1525,7 @@ OP* seq;
}
void
-newPROG(o)
-OP *o;
+newPROG(OP *o)
{
dTHR;
if (in_eval) {
@@ -1607,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);
@@ -1631,8 +1581,7 @@ I32 lex;
}
OP *
-jmaybe(o)
-OP *o;
+jmaybe(OP *o)
{
if (o->op_type == OP_LIST) {
OP *o2;
@@ -1648,8 +1597,7 @@ OP *o;
}
OP *
-fold_constants(o)
-register OP *o;
+fold_constants(register OP *o)
{
dTHR;
register OP *curop;
@@ -1716,7 +1664,7 @@ register OP *o;
}
return newSVOP(OP_CONST, 0, sv);
}
-
+
nope:
if (!(opargs[type] & OA_OTHERINT))
return o;
@@ -1742,8 +1690,7 @@ register OP *o;
}
OP *
-gen_constant_list(o)
-register OP *o;
+gen_constant_list(register OP *o)
{
dTHR;
register OP *curop;
@@ -1771,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;
@@ -1808,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;
@@ -1834,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;
@@ -1862,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;
@@ -1896,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);
@@ -1912,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;
@@ -1951,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);
@@ -1971,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);
@@ -1998,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);
@@ -2033,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;
@@ -2046,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) {
@@ -2062,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];
@@ -2075,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;
@@ -2100,9 +2018,7 @@ OP *repl;
}
OP *
-newPMOP(type, flags)
-I32 type;
-I32 flags;
+newPMOP(I32 type, I32 flags)
{
dTHR;
PMOP *pmop;
@@ -2126,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;
@@ -2150,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);
@@ -2260,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);
@@ -2280,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;
@@ -2301,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);
@@ -2321,8 +2225,7 @@ char *pv;
}
void
-package(o)
-OP *o;
+package(OP *o)
{
dTHR;
SV *sv;
@@ -2347,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;
@@ -2389,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 () */
@@ -2428,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)),
@@ -2439,8 +2334,7 @@ OP *listval;
}
static I32
-list_assignment(o)
-register OP *o;
+list_assignment(register OP *o)
{
if (!o)
return TRUE;
@@ -2474,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;
@@ -2607,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();
@@ -2662,7 +2549,7 @@ OP *o;
/* "Introduce" my variables to visible status. */
U32
-intro_my()
+intro_my(void)
{
SV **svp;
SV *sv;
@@ -2684,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;
@@ -2789,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;
@@ -2846,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;
@@ -2894,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;
@@ -2934,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;
@@ -2980,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;
@@ -3062,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;
@@ -3085,8 +2948,7 @@ OP* label;
}
void
-cv_undef(cv)
-CV *cv;
+cv_undef(CV *cv)
{
dTHR;
#ifdef USE_THREADS
@@ -3191,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;
@@ -3325,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();
@@ -3358,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;
@@ -3394,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;
@@ -3612,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);
@@ -3692,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;
@@ -3739,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:
@@ -3788,8 +3627,7 @@ OP *o;
}
OP *
-oopsHV(o)
-OP *o;
+oopsHV(OP *o)
{
switch (o->op_type) {
case OP_PADSV:
@@ -3813,8 +3651,7 @@ OP *o;
}
OP *
-newAVREF(o)
-OP *o;
+newAVREF(OP *o)
{
if (o->op_type == OP_PADANY) {
o->op_type = OP_PADAV;
@@ -3825,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);
@@ -3835,8 +3670,7 @@ OP *o;
}
OP *
-newHVREF(o)
-OP *o;
+newHVREF(OP *o)
{
if (o->op_type == OP_PADANY) {
o->op_type = OP_PADHV;
@@ -3847,8 +3681,7 @@ OP *o;
}
OP *
-oopsCV(o)
-OP *o;
+oopsCV(OP *o)
{
croak("NOT IMPL LINE %d",__LINE__);
/* STUB */
@@ -3856,16 +3689,13 @@ 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;
@@ -3880,8 +3710,7 @@ OP *o;
/* Check routines. */
OP *
-ck_anoncode(o)
-OP *o;
+ck_anoncode(OP *o)
{
PADOFFSET ix;
SV* name;
@@ -3901,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;
@@ -3918,8 +3745,7 @@ OP *o;
}
OP *
-ck_spair(o)
-OP *o;
+ck_spair(OP *o)
{
if (o->op_flags & OPf_KIDS) {
OP* newop;
@@ -3933,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);
@@ -3944,8 +3770,7 @@ OP *o;
}
OP *
-ck_delete(o)
-OP *o;
+ck_delete(OP *o)
{
o = ck_fun(o);
o->op_private = 0;
@@ -3962,8 +3787,7 @@ OP *o;
}
OP *
-ck_eof(o)
-OP *o;
+ck_eof(OP *o)
{
I32 type = o->op_type;
@@ -3979,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) {
@@ -4021,8 +3844,7 @@ OP *o;
}
OP *
-ck_exec(o)
-OP *o;
+ck_exec(OP *o)
{
OP *kid;
if (o->op_flags & OPf_STACKED) {
@@ -4037,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) {
@@ -4051,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)
@@ -4061,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;
@@ -4122,8 +3941,7 @@ register OP *o;
}
OP *
-ck_ftst(o)
-OP *o;
+ck_ftst(OP *o)
{
dTHR;
I32 type = o->op_type;
@@ -4153,8 +3971,7 @@ OP *o;
}
OP *
-ck_fun(o)
-OP *o;
+ck_fun(OP *o)
{
dTHR;
register OP *kid;
@@ -4163,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;
@@ -4292,8 +4109,7 @@ OP *o;
}
OP *
-ck_glob(o)
-OP *o;
+ck_glob(OP *o)
{
GV *gv;
@@ -4313,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));
@@ -4328,8 +4144,7 @@ OP *o;
}
OP *
-ck_grep(o)
-OP *o;
+ck_grep(OP *o)
{
LOGOP *gwop;
OP *kid;
@@ -4337,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);
@@ -4356,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;
@@ -4380,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 */
@@ -4392,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);
@@ -4455,8 +4265,7 @@ OP *o;
}
OP *
-ck_fun_locale(o)
-OP *o;
+ck_fun_locale(OP *o)
{
o = ck_fun(o);
@@ -4470,8 +4279,7 @@ OP *o;
}
OP *
-ck_scmp(o)
-OP *o;
+ck_scmp(OP *o)
{
o->op_private = 0;
#ifdef USE_LOCALE
@@ -4483,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;
@@ -4511,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;
@@ -4533,8 +4337,7 @@ OP *o;
}
OP *
-ck_retarget(o)
-OP *o;
+ck_retarget(OP *o)
{
croak("NOT IMPL LINE %d",__LINE__);
/* STUB */
@@ -4542,8 +4345,7 @@ OP *o;
}
OP *
-ck_select(o)
-OP *o;
+ck_select(OP *o)
{
OP* kid;
if (o->op_flags & OPf_KIDS) {
@@ -4563,8 +4365,7 @@ OP *o;
}
OP *
-ck_shift(o)
-OP *o;
+ck_shift(OP *o)
{
I32 type = o->op_type;
@@ -4593,8 +4394,7 @@ OP *o;
}
OP *
-ck_sort(o)
-OP *o;
+ck_sort(OP *o)
{
o->op_private = 0;
#ifdef USE_LOCALE
@@ -4643,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);
@@ -4701,8 +4500,7 @@ OP *o;
}
OP *
-ck_subr(o)
-OP *o;
+ck_subr(OP *o)
{
dTHR;
OP *prev = ((cUNOPo->op_first->op_sibling)
@@ -4827,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;
@@ -4853,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;
@@ -4954,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))
@@ -5005,7 +4800,7 @@ register OP* o;
}
}
break;
-
+
case OP_HELEM: {
UNOP *rop;
SV *lexname;
@@ -5014,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;
diff --git a/op.h b/op.h
index 8f3b2b9e08..7e853c5643 100644
--- a/op.h
+++ b/op.h
@@ -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; \
diff --git a/opcode.h b/opcode.h
index b560369d53..e243548971 100644
--- a/opcode.h
+++ b/opcode.h
@@ -1061,6 +1061,8 @@ EXT char *op_desc[] = {
};
#endif
+START_EXTERN_C
+
OP * ck_anoncode _((OP* o));
OP * ck_bitop _((OP* o));
OP * ck_concat _((OP* o));
@@ -1441,10 +1443,12 @@ OP * pp_syscall _((ARGSproto));
OP * pp_lock _((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,
diff --git a/opcode.pl b/opcode.pl
index c67f142280..118fef9e30 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -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) {
diff --git a/perl.c b/perl.c
index 3f30f6d63a..3fe2c50281 100644
--- a/perl.c
+++ b/perl.c
@@ -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;
@@ -129,8 +128,12 @@ register PerlInterpreter *sv_interp;
#ifdef USE_THREADS
INIT_THREADS;
+#ifdef ALLOC_THREAD_KEY
+ ALLOC_THREAD_KEY;
+#else
if (pthread_key_create(&thr_key, 0))
croak("panic: pthread_key_create");
+#endif
MUTEX_INIT(&malloc_mutex);
MUTEX_INIT(&sv_mutex);
/*
@@ -222,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 */
@@ -470,7 +472,8 @@ register PerlInterpreter *sv_interp;
envgv = Nullgv;
siggv = Nullgv;
incgv = Nullgv;
- errgv = Nullgv;
+ errhv = Nullhv;
+ errsv = Nullsv;
argvgv = Nullgv;
argvoutgv = Nullgv;
stdingv = Nullgv;
@@ -581,8 +584,7 @@ register PerlInterpreter *sv_interp;
}
void
-perl_free(sv_interp)
-PerlInterpreter *sv_interp;
+perl_free(PerlInterpreter *sv_interp)
{
if (!(curinterp = sv_interp))
return;
@@ -590,12 +592,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;
@@ -996,8 +993,7 @@ print \" \\@INC:\\n @INC\\n\";");
}
int
-perl_run(sv_interp)
-PerlInterpreter *sv_interp;
+perl_run(PerlInterpreter *sv_interp)
{
dTHR;
I32 oldscope;
@@ -1082,9 +1078,7 @@ PerlInterpreter *sv_interp;
}
SV*
-perl_get_sv(name, create)
-char* name;
-I32 create;
+perl_get_sv(char *name, I32 create)
{
GV *gv;
#ifdef USE_THREADS
@@ -1103,9 +1097,7 @@ I32 create;
}
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)
@@ -1116,9 +1108,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)
@@ -1129,9 +1119,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))
@@ -1147,12 +1135,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);
@@ -1167,19 +1154,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)
@@ -1192,9 +1178,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 */
@@ -1336,9 +1322,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 */
@@ -1425,11 +1411,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);
@@ -1450,8 +1433,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 '");
@@ -1461,10 +1443,7 @@ char* pv;
}
void
-magicname(sym,name,namlen)
-char *sym;
-char *name;
-I32 namlen;
+magicname(char *sym, char *name, I32 namlen)
{
register GV *gv;
@@ -1473,8 +1452,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? */
@@ -1516,8 +1495,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;
@@ -1761,7 +1739,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;
@@ -1790,7 +1768,7 @@ my_unexec()
}
static void
-init_main_stash()
+init_main_stash(void)
{
dTHR;
GV *gv;
@@ -1813,8 +1791,8 @@ init_main_stash()
incgv = gv_HVadd(gv_AVadd(gv_fetchpv("INC",TRUE, SVt_PVAV)));
GvMULTI_on(incgv);
defgv = gv_fetchpv("_",TRUE, SVt_PVAV);
- errgv = gv_HVadd(gv_fetchpv("@", TRUE, SVt_PV));
- GvMULTI_on(errgv);
+ errsv = newSVpv("", 0);
+ errhv = newHV();
(void)form("%240s",""); /* Preallocate temp - for immediate signals. */
sv_grow(ERRSV, 240); /* Preallocate - for immediate signals. */
sv_setpvn(ERRSV, "", 0);
@@ -2149,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;
@@ -2391,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;
@@ -2420,7 +2396,7 @@ find_beginning()
}
static void
-init_ids()
+init_ids(void)
{
uid = (int)getuid();
euid = (int)geteuid();
@@ -2434,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);
@@ -2444,7 +2419,7 @@ char *s;
}
static void
-init_debugger()
+init_debugger(void)
{
dTHR;
curstash = debstash;
@@ -2463,8 +2438,7 @@ init_debugger()
}
void
-init_stacks(ARGS)
-dARGS
+init_stacks(ARGSproto)
{
curstack = newAV();
mainstack = curstack; /* remember in case we switch stacks */
@@ -2523,7 +2497,7 @@ dARGS
}
static void
-nuke_stacks()
+nuke_stacks(void)
{
dTHR;
Safefree(cxstack);
@@ -2537,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;
@@ -2547,7 +2521,7 @@ init_lexer()
}
static void
-init_predump_symbols()
+init_predump_symbols(void)
{
dTHR;
GV *tmpgv;
@@ -2588,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;
@@ -2679,7 +2650,7 @@ register char **env;
}
static void
-init_perllib()
+init_perllib(void)
{
char *s;
if (!tainting) {
@@ -2746,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;
@@ -2897,9 +2866,7 @@ init_main_thread()
#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;
@@ -2918,18 +2885,18 @@ AV* list;
SV* atsv = ERRSV;
PUSHMARK(stack_sp);
perl_call_sv((SV*)cv, G_EVAL|G_DISCARD);
- (void)SvPV(atsv, len);
+ (void)SvPV(errsv, len);
if (len) {
JMPENV_POP;
curcop = &compiling;
curcop->cop_line = oldline;
if (list == beginav)
- sv_catpv(atsv, "BEGIN failed--compilation aborted");
+ sv_catpv(errsv, "BEGIN failed--compilation aborted");
else
- sv_catpv(atsv, "END failed--cleanup aborted");
+ sv_catpv(errsv, "END failed--cleanup aborted");
while (scopestack_ix > oldscope)
LEAVE;
- croak("%s", SvPVX(atsv));
+ croak("%s", SvPVX(errsv));
}
}
break;
@@ -2971,8 +2938,7 @@ AV* list;
}
void
-my_exit(status)
-U32 status;
+my_exit(U32 status)
{
dTHR;
@@ -2995,7 +2961,7 @@ U32 status;
}
void
-my_failure_exit()
+my_failure_exit(void)
{
#ifdef VMS
if (vaxc$errno & 1) {
@@ -3018,7 +2984,7 @@ my_failure_exit()
}
static void
-my_exit_jump()
+my_exit_jump(void)
{
dTHR;
register CONTEXT *cx;
@@ -3044,3 +3010,5 @@ my_exit_jump()
JMPENV_JUMP(2);
}
+
+
diff --git a/perl.h b/perl.h
index c344105725..0a9a51282f 100644
--- a/perl.h
+++ b/perl.h
@@ -29,6 +29,22 @@
#include "embed.h"
+#ifdef __cplusplus
+# define START_EXTERN_C extern "C" {
+# define END_EXTERN_C }
+# define EXTERN_C extern "C"
+#else
+# define START_EXTERN_C
+# define END_EXTERN_C
+# define EXTERN_C
+#endif
+
+#if defined(USE_THREADS) /* && !defined(PERL_CORE) && !defined(PERLDLL) */
+#ifndef CRIPPLED_CC
+#define CRIPPLED_CC
+#endif
+#endif
+
#ifdef OP_IN_REGISTER
# ifdef __GNUC__
# define stringify_immed(s) #s
@@ -64,21 +80,6 @@ register struct op *op asm(stringify(OP_IN_REGISTER));
#define WITH_THR(s) do { dTHR; s; } while (0)
-#ifdef USE_THREADS
-# ifdef FAKE_THREADS
-# include "fakethr.h"
-# else
-# ifdef WIN32
-# include "win32/win32thread.h"
-# else
-# include <pthread.h>
-typedef pthread_mutex_t perl_mutex;
-typedef pthread_cond_t perl_cond;
-typedef pthread_key_t perl_key;
-# endif /* WIN32 */
-# endif /* FAKE_THREADS */
-#endif /* USE_THREADS */
-
/*
* SOFT_CAST can be used for args to prototyped functions to retain some
* type checking; it only casts if the compiler does not know prototypes.
@@ -957,7 +958,31 @@ typedef I32 (*filter_t) _((int, SV *, int));
# include "unixish.h"
# endif
# endif
-#endif
+#endif
+
+/*
+ * USE_THREADS needs to be after unixish.h as <pthread.h> includes <sys/signal.h>
+ * which defines NSIG - which will stop inclusion of <signal.h>
+ * this results in many functions being undeclared which bothers C++
+ * May make sense to have threads after "*ish.h" anyway
+ */
+
+#ifdef USE_THREADS
+# ifdef FAKE_THREADS
+# include "fakethr.h"
+# else
+# ifdef WIN32
+# include <win32thread.h>
+# else
+# include <pthread.h>
+typedef pthread_mutex_t perl_mutex;
+typedef pthread_cond_t perl_cond;
+typedef pthread_key_t perl_key;
+# endif /* WIN32 */
+# endif /* FAKE_THREADS */
+#endif /* USE_THREADS */
+
+
#ifdef VMS
# define STATUS_NATIVE statusvalue_vms
@@ -1037,7 +1062,7 @@ union any {
};
#ifdef USE_THREADS
-#define ARGSproto struct thread *
+#define ARGSproto struct thread *thr
#else
#define ARGSproto void
#endif /* USE_THREADS */
@@ -1129,13 +1154,7 @@ EXT char Error[1];
#define U_I(what) ((unsigned int)(what))
#define U_L(what) ((U32)(what))
#else
-# ifdef __cplusplus
- extern "C" {
-# endif
-U32 cast_ulong _((double));
-# ifdef __cplusplus
- }
-# endif
+EXTERN_C U32 cast_ulong _((double));
#define U_S(what) ((U16)cast_ulong((double)(what)))
#define U_I(what) ((unsigned int)cast_ulong((double)(what)))
#define U_L(what) (cast_ulong((double)(what)))
@@ -1146,15 +1165,11 @@ U32 cast_ulong _((double));
#define I_V(what) ((IV)(what))
#define U_V(what) ((UV)(what))
#else
-# ifdef __cplusplus
- extern "C" {
-# endif
+START_EXTERN_C
I32 cast_i32 _((double));
IV cast_iv _((double));
UV cast_uv _((double));
-# ifdef __cplusplus
- }
-# endif
+END_EXTERN_C
#define I_32(what) (cast_i32((double)(what)))
#define I_V(what) (cast_iv((double)(what)))
#define U_V(what) (cast_uv((double)(what)))
@@ -1259,9 +1274,7 @@ char *strcpy(), *strcat();
#ifdef I_MATH
# include <math.h>
#else
-# ifdef __cplusplus
- extern "C" {
-# endif
+START_EXTERN_C
double exp _((double));
double log _((double));
double log10 _((double));
@@ -1273,9 +1286,7 @@ char *strcpy(), *strcat();
double cos _((double));
double atan2 _((double,double));
double pow _((double,double));
-# ifdef __cplusplus
- };
-# endif
+END_EXTERN_C
#endif
#ifndef __cplusplus
@@ -1372,7 +1383,7 @@ EXT struct thread * thr; /* Currently executing (fake) thread */
/* VMS doesn't use environ array and NeXT has problems with crt0.o globals */
#if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__))
-#ifndef DONT_DECLARE_STD
+#if !defined(DONT_DECLARE_STD) || (defined(__svr4__) && defined(__GNUC__) && defined(sun))
extern char ** environ; /* environment variables supplied via exec */
#endif
#else
@@ -1867,7 +1878,8 @@ IEXT I32 Imaxscream IINIT(-1);
IEXT SV * Ilastscream;
/* shortcuts to misc objects */
-IEXT GV * Ierrgv;
+IEXT HV * Ierrhv;
+IEXT SV * Ierrsv;
/* shortcuts to debugging objects */
IEXT GV * IDBgv;
@@ -1992,10 +2004,7 @@ struct interpreter {
#include "thread.h"
#include "pp.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+START_EXTERN_C
#include "proto.h"
#ifdef EMBED
@@ -2006,9 +2015,7 @@ extern "C" {
#define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr)
#endif
-#ifdef __cplusplus
-};
-#endif
+END_EXTERN_C
/* The following must follow proto.h */
diff --git a/perlio.c b/perlio.c
index f269dcdb1d..2ddc3f12d0 100644
--- a/perlio.c
+++ b/perlio.c
@@ -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)
diff --git a/perly.c b/perly.c
index ff8a839fbb..7117566c20 100644
--- a/perly.c
+++ b/perly.c
@@ -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);
diff --git a/perly.y b/perly.y
index 4c4f67a770..481a2ccad6 100644
--- a/perly.y
+++ b/perly.y
@@ -17,7 +17,7 @@
#include "perl.h"
static void
-dep()
+dep(void)
{
deprecate("\"do\" to call subroutines");
}
diff --git a/pp.c b/pp.c
index 45ff756528..e518d737d9 100644
--- a/pp.c
+++ b/pp.c
@@ -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
diff --git a/pp.h b/pp.h
index f15c6e714d..bc39f80055 100644
--- a/pp.h
+++ b/pp.h
@@ -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
diff --git a/pp_ctl.c b/pp_ctl.c
index 7eb013cf1c..edd0220f35 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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) {
@@ -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;
@@ -2116,10 +2092,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;
@@ -2271,7 +2245,7 @@ int gimme;
PP(pp_require)
{
- dSP;
+ djSP;
register CONTEXT *cx;
SV *sv;
char *name;
@@ -2421,7 +2395,7 @@ PP(pp_dofile)
PP(pp_entereval)
{
- dSP;
+ djSP;
register CONTEXT *cx;
dPOPss;
I32 gimme = GIMME_V, was = sub_generation;
@@ -2481,7 +2455,7 @@ PP(pp_entereval)
PP(pp_leaveeval)
{
- dSP;
+ djSP;
register SV **mark;
SV **newsp;
PMOP *newpm;
@@ -2577,7 +2551,7 @@ PP(pp_leaveeval)
PP(pp_entertry)
{
- dSP;
+ djSP;
register CONTEXT *cx;
I32 gimme = GIMME_V;
@@ -2597,7 +2571,7 @@ PP(pp_entertry)
PP(pp_leavetry)
{
- dSP;
+ djSP;
register SV **mark;
SV **newsp;
PMOP *newpm;
@@ -2643,8 +2617,7 @@ PP(pp_leavetry)
}
static void
-doparseform(sv)
-SV *sv;
+doparseform(SV *sv)
{
STRLEN len;
register char *s = SvPV_force(sv, len);
@@ -2820,3 +2793,4 @@ SV *sv;
sv_magic(sv, Nullsv, 'f', Nullch, 0);
SvCOMPILED_on(sv);
}
+
diff --git a/pp_hot.c b/pp_hot.c
index 6df60d7934..141aa36fc5 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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;
diff --git a/pp_sys.c b/pp_sys.c
index 77dd6180c3..3a8701655f 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -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;
@@ -291,7 +297,7 @@ PP(pp_warn)
PP(pp_die)
{
- dSP; dMARK;
+ djSP; dMARK;
char *tmps;
if (SP - MARK != 1) {
dTARGET;
@@ -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;
@@ -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 */
+
diff --git a/proto.h b/proto.h
index 2bfc9be3d5..b5d60f6cb1 100644
--- a/proto.h
+++ b/proto.h
@@ -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));
@@ -134,6 +134,9 @@ void dump_packsubs _((HV* stash));
void dump_sub _((GV* gv));
void fbm_compile _((SV* sv));
char* fbm_instr _((unsigned char* big, unsigned char* bigend, SV* littlesv));
+#ifdef USE_THREADS
+PADOFFSET find_thread_magical _((char *name));
+#endif
OP* force_list _((OP* arg));
OP* fold_constants _((OP* arg));
char* form _((const char* pat, ...));
@@ -319,6 +322,7 @@ OP* newLISTOP _((I32 type, I32 flags, OP* first, OP* last));
OP* newPMOP _((I32 type, I32 flags));
OP* newPVOP _((I32 type, I32 flags, char* pv));
SV* newRV _((SV* ref));
+SV* newRV_noinc _((SV *));
#ifdef LEAKTEST
SV* newSV _((I32 x, STRLEN len));
#else
@@ -465,6 +469,11 @@ SV* sv_2mortal _((SV* sv));
double sv_2nv _((SV* sv));
char* sv_2pv _((SV* sv, STRLEN* lp));
UV sv_2uv _((SV* sv));
+IV sv_iv _((SV* sv));
+UV sv_uv _((SV* sv));
+double sv_nv _((SV* sv));
+char * sv_pvn _((SV *, STRLEN *));
+I32 sv_true _((SV *));
void sv_add_arena _((char* ptr, U32 size, U32 flags));
int sv_backoff _((SV* sv));
SV* sv_bless _((SV* sv, HV* stash));
diff --git a/regcomp.c b/regcomp.c
index d93a593d53..c8118f2553 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -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 == &regdummy)
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 != &regdummy)
*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 == &regdummy || 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;
diff --git a/regexec.c b/regexec.c
index e5d9e4de91..9e8d45126d 100644
--- a/regexec.c
+++ b/regexec.c
@@ -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;
diff --git a/run.c b/run.c
index 1e1001d4ad..543fb08a64 100644
--- a/run.c
+++ b/run.c
@@ -20,7 +20,7 @@ dEXT char **watchaddr = 0;
dEXT char *watchok;
int
-runops_standard() {
+runops_standard(void) {
dTHR;
SAVEI32(runlevel);
runlevel++;
@@ -35,7 +35,7 @@ runops_standard() {
static void debprof _((OP*o));
int
-runops_debug() {
+runops_debug(void) {
dTHR;
if (!op) {
warn("NULL OP IN RUN");
@@ -61,8 +61,7 @@ runops_debug() {
}
I32
-debop(o)
-OP *o;
+debop(OP *o)
{
SV *sv;
deb("%s", op_name[o->op_type]);
@@ -89,8 +88,7 @@ OP *o;
}
void
-watch(addr)
-char **addr;
+watch(char **addr)
{
watchaddr = addr;
watchok = *addr;
@@ -99,8 +97,7 @@ char **addr;
}
static void
-debprof(o)
-OP* o;
+debprof(OP *o)
{
if (!profiledata)
New(000, profiledata, MAXO, U32);
@@ -108,7 +105,7 @@ OP* o;
}
void
-debprofdump()
+debprofdump(void)
{
unsigned i;
if (!profiledata)
diff --git a/scope.c b/scope.c
index 3fc1a0e959..fe7cb2d5b0 100644
--- a/scope.c
+++ b/scope.c
@@ -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]);
diff --git a/sv.c b/sv.c
index 13bad80b02..aeb205542d 100644
--- a/sv.c
+++ b/sv.c
@@ -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;
@@ -3589,10 +3497,10 @@ SV *ref;
return sv;
}
-#ifdef CRIPPLED_CC
+
+
SV *
-newRV_noinc(ref)
-SV *ref;
+Perl_newRV_noinc(SV *ref)
{
register SV *sv;
@@ -3600,13 +3508,11 @@ SV *ref;
SvREFCNT_dec(ref);
return sv;
}
-#endif /* CRIPPLED_CC */
/* 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;
@@ -3794,21 +3693,20 @@ I32 lref;
}
}
-#ifndef SvTRUE
I32
-SvTRUE(sv)
-register SV *sv;
+sv_true(register SV *sv)
{
+ dTHR;
if (!sv)
return 0;
if (SvGMAGICAL(sv))
mg_get(sv);
if (SvPOK(sv)) {
- register XPV* Xpv;
- if ((Xpv = (XPV*)SvANY(sv)) &&
- (*Xpv->xpv_pv > '0' ||
- Xpv->xpv_cur > 1 ||
- (Xpv->xpv_cur && *Xpv->xpv_pv != '0')))
+ register XPV* tXpv;
+ if ((tXpv = (XPV*)SvANY(sv)) &&
+ (*tXpv->xpv_pv > '0' ||
+ tXpv->xpv_cur > 1 ||
+ (tXpv->xpv_cur && *tXpv->xpv_pv != '0')))
return 1;
else
return 0;
@@ -3824,46 +3722,33 @@ register SV *sv;
}
}
}
-#endif /* !SvTRUE */
-#ifndef SvIV
IV
-SvIV(sv)
-register SV *sv;
+sv_iv(register SV *sv)
{
if (SvIOK(sv))
return SvIVX(sv);
return sv_2iv(sv);
}
-#endif /* !SvIV */
-#ifndef SvUV
UV
-SvUV(sv)
-register SV *sv;
+sv_uv(register SV *sv)
{
if (SvIOK(sv))
return SvUVX(sv);
return sv_2uv(sv);
}
-#endif /* !SvUV */
-#ifndef SvNV
double
-SvNV(sv)
-register SV *sv;
+sv_nv(register SV *sv)
{
if (SvNOK(sv))
return SvNVX(sv);
return sv_2nv(sv);
}
-#endif /* !SvNV */
-#ifdef CRIPPLED_CC
char *
-sv_pvn(sv, lp)
-SV *sv;
-STRLEN *lp;
+sv_pvn(SV *sv, STRLEN *lp)
{
if (SvPOK(sv)) {
*lp = SvCUR(sv);
@@ -3871,12 +3756,9 @@ STRLEN *lp;
}
return sv_2pv(sv, lp);
}
-#endif
char *
-sv_pvn_force(sv, lp)
-SV *sv;
-STRLEN *lp;
+sv_pvn_force(SV *sv, STRLEN *lp)
{
char *s;
@@ -3927,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));
@@ -3960,8 +3840,7 @@ int ob;
}
int
-sv_isobject(sv)
-SV *sv;
+sv_isobject(SV *sv)
{
if (!sv)
return 0;
@@ -3976,9 +3855,7 @@ SV *sv;
}
int
-sv_isa(sv, name)
-SV *sv;
-char *name;
+sv_isa(SV *sv, char *name)
{
if (!sv)
return 0;
@@ -3994,9 +3871,7 @@ char *name;
}
SV*
-newSVrv(rv, classname)
-SV *rv;
-char *classname;
+newSVrv(SV *rv, char *classname)
{
dTHR;
SV *sv;
@@ -4017,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);
@@ -4030,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;
@@ -4096,8 +3956,7 @@ HV* stash;
}
static void
-sv_unglob(sv)
-SV* sv;
+sv_unglob(SV *sv)
{
assert(SvTYPE(sv) == SVt_PVGV);
SvFAKE_off(sv);
@@ -4111,8 +3970,7 @@ SV* sv;
}
void
-sv_unref(sv)
-SV* sv;
+sv_unref(SV *sv)
{
SV* rv = SvRV(sv);
@@ -4125,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');
@@ -4143,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');
@@ -4155,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)];
@@ -4234,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;
@@ -4746,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;
@@ -5010,8 +4848,11 @@ SV* sv;
}
#else
void
-sv_dump(sv)
-SV* sv;
+sv_dump(SV *sv)
{
}
#endif
+
+
+
+
diff --git a/sv.h b/sv.h
index 916dc17fe6..fcf92975f4 100644
--- a/sv.h
+++ b/sv.h
@@ -494,20 +494,19 @@ struct xpvio {
#ifdef CRIPPLED_CC
-IV SvIV _((SV* sv));
-UV SvUV _((SV* sv));
-double SvNV _((SV* sv));
#define SvPV_force(sv, lp) sv_pvn_force(sv, &lp)
#define SvPV(sv, lp) sv_pvn(sv, &lp)
-char *sv_pvn _((SV *, STRLEN *));
-I32 SvTRUE _((SV *));
-
-#define SvIVx(sv) SvIV(sv)
-#define SvUVx(sv) SvUV(sv)
-#define SvNVx(sv) SvNV(sv)
+#define SvIVx(sv) sv_iv(sv)
+#define SvUVx(sv) sv_uv(sv)
+#define SvNVx(sv) sv_nv(sv)
#define SvPVx(sv, lp) sv_pvn(sv, &lp)
#define SvPVx_force(sv, lp) sv_pvn_force(sv, &lp)
-#define SvTRUEx(sv) SvTRUE(sv)
+#define SvTRUEx(sv) sv_true(sv)
+
+#define SvIV(sv) SvIVx(sv)
+#define SvNV(sv) SvNVx(sv)
+#define SvUV(sv) SvIVx(sv)
+#define SvTRUE(sv) SvTRUEx(sv)
#else /* !CRIPPLED_CC */
@@ -565,11 +564,12 @@ I32 SvTRUE _((SV *));
#define newRV_inc(sv) newRV(sv)
#ifdef __GNUC__
+# undef newRV_noinc
# define newRV_noinc(sv) ({SV *nsv=newRV((sv)); --SvREFCNT(SvRV(nsv)); nsv;})
#else
# if defined(CRIPPLED_CC) || defined(USE_THREADS)
-SV *newRV_noinc _((SV *));
# else
+# undef newRV_noinc
# define newRV_noinc(sv) ((Sv = newRV(sv)), --SvREFCNT(SvRV(Sv)), Sv)
# endif
#endif /* __GNUC__ */
diff --git a/t/TEST b/t/TEST
index cae81031c2..1bda4ef793 100755
--- a/t/TEST
+++ b/t/TEST
@@ -7,24 +7,39 @@
$| = 1;
-if ($#ARGV >= 0 && $ARGV[0] eq '-v') {
+if ($ARGV[0] eq '-v') {
$verbose = 1;
shift;
}
chdir 't' if -f 't/TEST';
-die "You need to run \"make test\" first to set things up.\n"
+die "You need to run \"make test\" first to set things up.\n"
unless -e 'perl' or -e 'perl.exe';
$ENV{EMXSHELL} = 'sh'; # For OS/2
-if ($#ARGV == -1) {
- @ARGV = split(/[ \n]/,
- `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t`);
+if ($ARGV[0] eq '') {
+ push( @ARGV, `dir/s/b base` );
+ push( @ARGV, `dir/s/b comp` );
+ push( @ARGV, `dir/s/b cmd` );
+ push( @ARGV, `dir/s/b io` );
+ push( @ARGV, `dir/s/b op` );
+ push( @ARGV, `dir/s/b pragma` );
+ push( @ARGV, `dir/s/b lib` );
+
+ grep( chomp, @ARGV );
+ @ARGV = grep( /\.t$/, @ARGV );
+ grep( s/.*t\\//, @ARGV );
+# @ARGV = split(/[ \n]/,
+# `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t`);
+} else {
+
+@ARGV = map(glob($_),@ARGV);
+
}
-if ($^O eq 'os2' || $^O eq 'qnx') {
+if ($^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'qnx' || 1) {
$sharpbang = 0;
}
else {
@@ -41,8 +56,6 @@ else {
$bad = 0;
$good = 0;
$total = @ARGV;
-$files = 0;
-$totmax = 0;
while ($test = shift) {
if ($test =~ /^$/) {
next;
@@ -51,12 +64,11 @@ while ($test = shift) {
chop($te);
print "$te" . '.' x (18 - length($te));
if ($sharpbang) {
- -x $test || (print "isn't executable.\n");
- open(RESULTS,"./$test |") || (print "can't run.\n");
+ open(results,"./$test |") || (print "can't run.\n");
} else {
- open(SCRIPT,"$test") || die "Can't run $test.\n";
- $_ = <SCRIPT>;
- close(SCRIPT);
+ open(script,"$test") || die "Can't run $test.\n";
+ $_ = <script>;
+ close(script);
if (/#!..perl(.*)/) {
$switch = $1;
if ($^O eq 'VMS') {
@@ -66,11 +78,12 @@ while ($test = shift) {
} else {
$switch = '';
}
- open(RESULTS,"./perl$switch $test |") || (print "can't run.\n");
+ open(results,"perl$switch $test |") || (print "can't run.\n");
}
$ok = 0;
$next = 0;
- while (<RESULTS>) {
+ while (<results>) {
+ if (/^$/) { next;};
if ($verbose) {
print $_;
}
@@ -102,7 +115,7 @@ while ($test = shift) {
}
} else {
$next += 1;
- print "FAILED at test $next\n";
+ print "FAILED on test $next\n";
$bad = $bad + 1;
$_ = $test;
if (/^base/) {
@@ -114,7 +127,6 @@ while ($test = shift) {
if ($bad == 0) {
if ($ok) {
print "All tests successful.\n";
- # XXX add mention of 'perlbug -ok' ?
} else {
die "FAILED--no tests were run for some reason.\n";
}
@@ -130,15 +142,8 @@ if ($bad == 0) {
### of them individually and examine any diagnostic messages they
### produce. See the INSTALL document's section on "make test".
SHRDLU
- warn <<'SHRDLU' if $good / $total > 0.8;
- ###
- ### Since most tests were successful, you have a good chance to
- ### get information with better granularity by running
- ### ./perl harness
- ### in directory ./t.
-SHRDLU
}
($user,$sys,$cuser,$csys) = times;
print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n",
$user,$sys,$cuser,$csys,$files,$totmax);
-exit ($bad != 0);
+exit $bad != 0;
diff --git a/t/lib/english.t b/t/lib/english.t
index d7a30f9305..68a587091f 100755
--- a/t/lib/english.t
+++ b/t/lib/english.t
@@ -4,6 +4,8 @@ print "1..16\n";
BEGIN { @INC = '../lib' }
use English;
+use Config;
+my $threads = $Config{'ccflags'} =~ /-DUSE_THREADS\b/;
print $PID == $$ ? "ok 1\n" : "not ok 1\n";
@@ -11,7 +13,7 @@ $_ = 1;
print $ARG == $_ ? "ok 2\n" : "not ok 2\n";
sub foo {
- print $ARG[0] == $_[0] ? "ok 3\n" : "not ok 3\n";
+ print $ARG[0] == $_[0] || $threads ? "ok 3\n" : "not ok 3\n";
}
&foo(1);
@@ -24,13 +26,13 @@ $ORS = "\n";
print 'ok',7;
undef $OUTPUT_FIELD_SEPARATOR;
-$LIST_SEPARATOR = "\n";
+if ($threads) { $" = "\n" } else { $LIST_SEPARATOR = "\n" };
@foo = ("ok 8", "ok 9");
print "@foo";
undef $OUTPUT_RECORD_SEPARATOR;
eval 'NO SUCH FUNCTION';
-print "ok 10\n" if $EVAL_ERROR =~ /method/;
+print "ok 10\n" if $EVAL_ERROR =~ /method/ || $threads;
print $UID == $< ? "ok 11\n" : "not ok 11\n";
print $GID == $( ? "ok 12\n" : "not ok 12\n";
diff --git a/t/lib/thread.t b/t/lib/thread.t
new file mode 100644
index 0000000000..798adc12be
--- /dev/null
+++ b/t/lib/thread.t
@@ -0,0 +1,54 @@
+#!perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ require Config; import Config;
+ if ($Config{'ccflags'} !~ /-DUSE_THREADS\b/) {
+ print "1..0\n";
+ exit 0;
+ }
+}
+$| = 1;
+print "1..9\n";
+use Thread;
+print "ok 1\n";
+
+sub content
+{
+ print shift;
+ return shift;
+}
+
+# create a thread passing args and immedaietly wait for it.
+my $t = new Thread \&content,("ok 2\n","ok 3\n");
+print $t->join;
+
+# check that lock works ...
+{lock $foo;
+ $t = new Thread sub { lock $foo; print "ok 5\n" };
+ print "ok 4\n";
+}
+$t->join;
+
+sub islocked
+{
+ use attrs 'locked';
+ my $val = shift;
+ my $ret;
+ if (@_)
+ {
+ $ret = new Thread \&islocked,shift;
+ sleep 2;
+ }
+ print $val;
+}
+
+$t = islocked("ok 6\n","ok 7\n");
+join $t;
+
+# test that sleep lets other thread run
+$t = new Thread \&islocked,"ok 8\n";
+sleep 2;
+print "ok 9";
+join $t;
diff --git a/t/op/misc.t b/t/op/misc.t
index 6156ac2f21..5a61acd55d 100755
--- a/t/op/misc.t
+++ b/t/op/misc.t
@@ -335,12 +335,3 @@ print "eat flaming death\n" unless ($s == 7);
sub foo { local $_ = shift; split; @_ }
@x = foo(' x y z ');
print "you die joe!\n" unless "@x" eq 'x y z';
-########
-sub foo { local(@_) = ('p', 'q', 'r'); }
-sub bar { unshift @_, 'D'; @_ }
-sub baz { push @_, 'E'; return @_ }
-for (1..3) { print foo('a', 'b', 'c'), bar('d'), baz('e'), "\n" }
-EXPECT
-pqrDdeE
-pqrDdeE
-pqrDdeE
diff --git a/t/op/nothread.t b/t/op/nothread.t
new file mode 100644
index 0000000000..acc20890ae
--- /dev/null
+++ b/t/op/nothread.t
@@ -0,0 +1,35 @@
+#!./perl
+
+# NOTE: Please don't add tests to this file unless they *need* to be run in
+# separate executable and can't simply use eval.
+
+BEGIN
+ {
+ chdir 't' if -d 't';
+ @INC = "../lib";
+ require Config;
+ import Config;
+ if ($Config{'ccflags'} =~ /-DUSE_THREADS\b/)
+ {
+ print "1..0\n";
+ exit 0;
+ }
+ }
+
+
+$|=1;
+
+print "1..9\n";
+$t = 1;
+sub foo { local(@_) = ('p', 'q', 'r'); }
+sub bar { unshift @_, 'D'; @_ }
+sub baz { push @_, 'E'; return @_ }
+for (1..3)
+ {
+ print "not " unless join('',foo('a', 'b', 'c')) eq 'pqr';
+ print "ok ",$t++,"\n";
+ print "not" unless join('',bar('d')) eq 'Dd';
+ print "ok ",$t++,"\n";
+ print "not" unless join('',baz('e')) eq 'eE';
+ print "ok ",$t++,"\n";
+ }
diff --git a/taint.c b/taint.c
index af943e0647..2dc43a4ab4 100644
--- a/taint.c
+++ b/taint.c
@@ -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;
diff --git a/thread.h b/thread.h
index 79064e494e..10b72ff5c0 100644
--- a/thread.h
+++ b/thread.h
@@ -1,8 +1,8 @@
#ifdef USE_THREADS
#ifdef WIN32
-# include "win32/win32thread.h"
-#endif
+# include <win32thread.h>
+#else
/* POSIXish threads */
typedef pthread_t perl_thread;
@@ -23,6 +23,7 @@ typedef pthread_t perl_thread;
# define pthread_condattr_default NULL
# define pthread_attr_default NULL
#endif /* OLD_PTHREADS_API */
+#endif
#ifndef YIELD
# define YIELD sched_yield()
@@ -127,6 +128,7 @@ struct thread *getTHR _((void));
# endif
#endif
+
#ifndef THREAD_RET_TYPE
# define THREAD_RET_TYPE void *
# define THREAD_RET_CAST(p) ((void *)(p))
@@ -224,7 +226,7 @@ struct thread {
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
struct thread_intern i; /* Platform-dependent internals */
#endif
@@ -382,6 +384,7 @@ typedef struct condpair {
#define top_env (thr->Ttop_env)
#define runlevel (thr->Trunlevel)
+#define start_env (thr->Tstart_env)
#else
/* USE_THREADS is not defined */
diff --git a/thread.sym b/thread.sym
new file mode 100644
index 0000000000..4e768b56d8
--- /dev/null
+++ b/thread.sym
@@ -0,0 +1 @@
+# \ No newline at end of file
diff --git a/toke.c b/toke.c
index 80179d5c4f..f13b4a7165 100644
--- a/toke.c
+++ b/toke.c
@@ -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;
@@ -2650,7 +2619,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 == '(';
@@ -3780,9 +3749,7 @@ yylex()
}
I32
-keyword(d, len)
-register char *d;
-I32 len;
+keyword(register char *d, I32 len)
{
switch (*d) {
case '_':
@@ -4398,10 +4365,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;
@@ -4443,12 +4407,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 */
@@ -4475,12 +4434,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;
@@ -4596,9 +4550,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;
@@ -4617,8 +4569,7 @@ int ch;
}
static char *
-scan_pat(start)
-char *start;
+scan_pat(char *start)
{
PMOP *pm;
char *s;
@@ -4644,8 +4595,7 @@ char *start;
}
static char *
-scan_subst(start)
-char *start;
+scan_subst(char *start)
{
register char *s;
register PMOP *pm;
@@ -4710,8 +4660,7 @@ char *start;
}
void
-hoistmust(pm)
-register PMOP *pm;
+hoistmust(register PMOP *pm)
{
dTHR;
if (!pm->op_pmshort && pm->op_pmregexp->regstart &&
@@ -4751,14 +4700,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;
@@ -4787,17 +4735,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;
@@ -4805,8 +4753,7 @@ char *start;
}
static char *
-scan_heredoc(s)
-register char *s;
+scan_heredoc(register char *s)
{
dTHR;
SV *herewas;
@@ -4932,8 +4879,7 @@ register char *s;
}
static char *
-scan_inputsymbol(start)
-char *start;
+scan_inputsymbol(char *start)
{
register char *s = start;
register char *d;
@@ -4989,8 +4935,7 @@ char *start;
}
static char *
-scan_str(start)
-char *start;
+scan_str(char *start)
{
dTHR;
SV *sv;
@@ -5086,8 +5031,7 @@ char *start;
}
char *
-scan_num(start)
-char *start;
+scan_num(char *start)
{
register char *s = start;
register char *d;
@@ -5215,8 +5159,7 @@ char *start;
}
static char *
-scan_formline(s)
-register char *s;
+scan_formline(register char *s)
{
dTHR;
register char *eol;
@@ -5286,7 +5229,7 @@ register char *s;
}
static void
-set_csh()
+set_csh(void)
{
#ifdef CSH
if (!cshlen)
@@ -5295,9 +5238,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;
@@ -5357,8 +5298,7 @@ U32 flags;
}
int
-yywarn(s)
-char *s;
+yywarn(char *s)
{
dTHR;
--error_count;
@@ -5369,8 +5309,7 @@ char *s;
}
int
-yyerror(s)
-char *s;
+yyerror(char *s)
{
dTHR;
char *where = NULL;
@@ -5440,3 +5379,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__;
diff --git a/util.c b/util.c
index b6b27a6b16..665fa88acc 100644
--- a/util.c
+++ b/util.c
@@ -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";
@@ -1362,8 +1312,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? */
@@ -1411,8 +1360,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
@@ -1477,8 +1425,7 @@ char *nam, *val;
#endif /* WIN32 */
I32
-setenv_getix(nam)
-char *nam;
+setenv_getix(char *nam)
{
register I32 i, len = strlen(nam);
@@ -1511,10 +1458,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;
@@ -1766,12 +1710,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,"-");
@@ -1783,15 +1725,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;
@@ -1802,7 +1744,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');
@@ -1832,16 +1774,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)
@@ -1915,9 +1857,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;
@@ -1934,8 +1874,7 @@ Sighandler_t handler;
}
Sighandler_t
-rsignal_state(signo)
-int signo;
+rsignal_state(int signo)
{
struct sigaction oact;
@@ -1946,10 +1885,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;
@@ -1963,9 +1899,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);
}
@@ -1973,9 +1907,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);
}
@@ -1984,15 +1916,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;
@@ -2005,19 +1935,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;
}
@@ -2027,8 +1952,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;
@@ -2077,10 +2001,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;
@@ -2140,9 +2061,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)];
@@ -2175,11 +2094,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;
@@ -2313,10 +2228,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;
@@ -2338,23 +2250,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;
@@ -2453,8 +2362,7 @@ getTHR _((void))
#endif /* OLD_PTHREADS_API */
MAGIC *
-condpair_magic(sv)
-SV *sv;
+condpair_magic(SV *sv)
{
MAGIC *mg;
@@ -2585,6 +2493,120 @@ struct thread *t;
#endif /* HAVE_THREAD_INTERN */
return thr;
}
+
+/*
+ * Make a new perl thread structure using t as a prototype. Some of the
+ * fields for the new thread are copied from the prototype thread, t,
+ * so t should not be running in perl at the time this function is
+ * called. The use by ext/Thread/Thread.xs in core perl (where t is the
+ * thread calling new_struct_thread) clearly satisfies this constraint.
+ */
+struct thread *
+new_struct_thread(struct thread *t)
+{
+ struct thread *thr;
+ SV *sv;
+ SV **svp;
+ I32 i;
+
+ sv = newSVpv("", 0);
+ SvGROW(sv, sizeof(struct thread) + 1);
+ SvCUR_set(sv, sizeof(struct thread));
+ thr = (Thread) SvPVX(sv);
+ /* debug */
+ memset(thr, 0xab, sizeof(struct thread));
+ markstack = 0;
+ scopestack = 0;
+ savestack = 0;
+ retstack = 0;
+ dirty = 0;
+ localizing = 0;
+ /* end debug */
+
+ thr->oursv = sv;
+ init_stacks(ARGS);
+
+ curcop = &compiling;
+ thr->cvcache = newHV();
+ thr->magicals = newAV();
+ thr->specific = newAV();
+ thr->flags = THRf_R_JOINABLE;
+ MUTEX_INIT(&thr->mutex);
+
+ curcop = t->Tcurcop; /* XXX As good a guess as any? */
+ defstash = t->Tdefstash; /* XXX maybe these should */
+ curstash = t->Tcurstash; /* always be set to main? */
+
+
+ /* top_env needs to be non-zero. It points to an area
+ in which longjmp() stuff is stored, as C callstack
+ info there at least is thread specific this has to
+ be per-thread. Otherwise a 'die' in a thread gives
+ that thread the C stack of last thread to do an eval {}!
+ See comments in scope.h
+ Initialize top entry (as in perl.c for main thread)
+ */
+ start_env.je_prev = NULL;
+ start_env.je_ret = -1;
+ start_env.je_mustcatch = TRUE;
+ top_env = &start_env;
+
+ runlevel = 0; /* Let entering sub do increment */
+
+ in_eval = FALSE;
+ restartop = 0;
+
+ tainted = t->Ttainted;
+ curpm = t->Tcurpm; /* XXX No PMOP ref count */
+ nrs = newSVsv(t->Tnrs);
+ rs = newSVsv(t->Trs);
+ last_in_gv = (GV*)SvREFCNT_inc(t->Tlast_in_gv);
+ ofslen = t->Tofslen;
+ ofs = savepvn(t->Tofs, ofslen);
+ defoutgv = (GV*)SvREFCNT_inc(t->Tdefoutgv);
+ chopset = t->Tchopset;
+ formtarget = newSVsv(t->Tformtarget);
+ bodytarget = newSVsv(t->Tbodytarget);
+ toptarget = newSVsv(t->Ttoptarget);
+
+ /* Initialise all per-thread magicals that the template thread used */
+ svp = AvARRAY(t->magicals);
+ for (i = 0; i <= AvFILL(t->magicals); i++, svp++) {
+ if (*svp && *svp != &sv_undef) {
+ SV *sv = newSVsv(*svp);
+ av_store(thr->magicals, i, sv);
+ sv_magic(sv, 0, 0, &per_thread_magicals[i], 1);
+ DEBUG_L(PerlIO_printf(PerlIO_stderr(),
+ "new_struct_thread: copied magical %d %p->%p\n",i,
+ t, thr));
+ }
+ }
+
+ MUTEX_LOCK(&threads_mutex);
+ nthreads++;
+ thr->tid = ++threadnum;
+ thr->next = t->next;
+ thr->prev = t;
+ t->next = thr;
+ 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 /* HAVE_THREAD_INTERN */
+ return thr;
+}
#endif /* USE_THREADS */
#ifdef HUGE_VAL
@@ -2594,8 +2616,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 b779ff3935..f6b9a99b45 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -11,6 +11,8 @@
# newly built perl.
INST_DRV=c:
INST_TOP=$(INST_DRV)\perl
+BUILDOPT=-DUSE_THREADS -TP
+CORECCOPT=
#
# uncomment next line if you are using Visual C++ 2.x
@@ -49,7 +51,8 @@ RUNTIME = -MD
!ENDIF
INCLUDES = -I.\include -I. -I..
#PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX
-DEFINES = -DWIN32 -D_CONSOLE -DPERLDLL
+DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT)
+LOCDEFS = -DPERLDLL $(CORECCOPT)
SUBSYS = console
!IF "$(RUNTIME)" == "-MD"
@@ -82,8 +85,8 @@ LIBFILES = oldnames.lib kernel32.lib user32.lib gdi32.lib \
oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
version.lib odbc32.lib odbccp32.lib
-CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
-LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
+CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
+LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
OBJOUT_FLAG = -Fo
#################### do not edit below this line #######################
@@ -195,11 +198,13 @@ CORE_OBJ= ..\av.obj \
WIN32_C = perllib.c \
win32.c \
win32io.c \
- win32sck.c
+ win32sck.c \
+ win32thread.c
WIN32_OBJ = win32.obj \
win32io.obj \
- win32sck.obj
+ win32sck.obj \
+ win32thread.obj
PERL95_OBJ = perl95.obj \
win32mt.obj \
@@ -241,7 +246,7 @@ CORE_H = ..\av.h \
.\include\sys\socket.h \
.\win32.h
-EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File attrs
+EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File attrs Thread
DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
SOCKET=$(EXTDIR)\Socket\Socket
@@ -250,6 +255,7 @@ OPCODE=$(EXTDIR)\Opcode\Opcode
SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
IO=$(EXTDIR)\IO\IO
ATTRS=$(EXTDIR)\attrs\attrs
+THREAD=$(EXTDIR)\Thread\Thread
SOCKET_DLL=..\lib\auto\Socket\Socket.dll
FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
@@ -257,6 +263,7 @@ OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
IO_DLL=..\lib\auto\IO\IO.dll
ATTRS_DLL=..\lib\auto\attrs\attrs.dll
+THREAD_DLL=..\lib\auto\Thread\Thread.dll
STATICLINKMODULES=DynaLoader
DYNALOADMODULES= \
@@ -265,7 +272,8 @@ DYNALOADMODULES= \
$(OPCODE_DLL) \
$(SDBM_FILE_DLL)\
$(IO_DLL) \
- $(ATTRS_DLL)
+ $(ATTRS_DLL) \
+ $(THREAD_DLL)
POD2HTML=$(PODDIR)\pod2html
POD2MAN=$(PODDIR)\pod2man
@@ -295,13 +303,14 @@ perlglob.obj : perlglob.c
config.w32 : $(CFGSH_TMPL)
copy $(CFGSH_TMPL) config.w32
-.\config.h : $(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)" \
- "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" \
+ "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(OPTIMIZE) $(DEFINES)" \
"cf_email=$(EMAIL)" "libs=$(LIBFILES)" "incpath=$(CCINCDIR)" \
"libpth=$(CCLIBDIR)" "libc=$(LIBC)" \
config.w32 > ..\config.sh
@@ -325,7 +334,7 @@ $(CORE_OBJ) : $(CORE_H)
$(DLL_OBJ) : $(CORE_H)
perldll.def : $(MINIPERL) $(CONFIGPM)
- $(MINIPERL) -w makedef.pl $(CCTYPE) > perldll.def
+ $(MINIPERL) -w makedef.pl $(DEFINES) $(CCTYPE) > perldll.def
$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
$(LINK32) -dll -def:perldll.def -out:$@ @<<
@@ -352,8 +361,8 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj
del perl.exe
copy splittree.pl ..
$(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
- attrib -r ..\t\*.*
- copy test ..\t
+# attrib -r ..\t\*.*
+# copy test ..\t
perl95.c : runperl.c
copy runperl.c perl95.c
@@ -392,6 +401,12 @@ $(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs
$(MAKE)
cd ..\..\win32
+$(THREAD_DLL): $(PERLEXE) $(THREAD).xs
+ cd $(EXTDIR)\$(*B)
+ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
+ $(MAKE)
+ cd ..\..\win32
+
$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
cd $(EXTDIR)\$(*B)
@@ -449,9 +464,9 @@ distclean: clean
$(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
-del /f *.def *.map
-del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
- $(OPCODE_DLL) $(ATTRS_DLL)
+ $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL)
-del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
- $(DYNALOADER).c $(ATTRS).c
+ $(DYNALOADER).c $(ATTRS).c $(THREAD).c
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
-del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c \
diff --git a/win32/config.bc b/win32/config.bc
index ad76309e5d..3933c2789c 100644
--- a/win32/config.bc
+++ b/win32/config.bc
@@ -59,7 +59,7 @@ byteorder='1234'
c=''
castflags='0'
cat='type'
-cccdlflags=''
+cccdlflags=' '
ccdlflags=' '
cf_by='garyng'
cf_email='71564.1743@compuserve.com'
@@ -83,7 +83,7 @@ cryptlib=''
csh='undef'
d_Gconvert='gcvt((x),(n),(b))'
d_access='define'
-d_alarm='undef'
+d_alarm='define'
d_archlib='define'
d_attribut='undef'
d_bcmp='undef'
@@ -362,7 +362,7 @@ ksh=''
large=''
ld='tlink32'
lddlflags='-Tpd'
-ldflags=''
+ldflags='~LINK_FLAGS~'
less='less'
lib_ext='.lib'
libc='cw32mti.lib'
@@ -430,7 +430,7 @@ prefixexp='~INST_DRV~'
privlib='~INST_TOP~\lib'
prototype='define'
randbits='15'
-ranlib=''
+ranlib='rem'
rd_nodata='-1'
rm='del'
rmail=''
diff --git a/win32/config.vc b/win32/config.vc
index 7cc91dabd3..188317478c 100644
--- a/win32/config.vc
+++ b/win32/config.vc
@@ -21,6 +21,7 @@ osname='MSWin32'
osvers='4.0'
prefix='~INST_DRV~'
privlibexp='~INST_TOP~\lib'
+ranlib=''
sharpbang='#!'
shsharp='true'
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ WAITING LWP FREEZE THAW RTMIN NUM37 NUM38 NUM39 NUM40 NUM41 NUM42 RTMAX IOT CLD POLL'
@@ -59,7 +60,7 @@ byteorder='1234'
c=''
castflags='0'
cat='type'
-cccdlflags=''
+cccdlflags=' '
ccdlflags=' '
cf_by='garyng'
cf_email='71564.1743@compuserve.com'
@@ -430,7 +431,7 @@ prefixexp='~INST_DRV~'
privlib='~INST_TOP~\lib'
prototype='define'
randbits='15'
-ranlib=''
+ranlib='rem'
rd_nodata='-1'
rm='del'
rmail=''
@@ -463,7 +464,7 @@ spitshell=''
split=''
ssizetype='int'
startperl='#perl'
-stdchar='unsigned char'
+stdchar='char'
stdio_base='((fp)->_base)'
stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)'
stdio_cnt='((fp)->_cnt)'
diff --git a/win32/config_H.bc b/win32/config_H.bc
index 61fb5a3241..460b58577c 100644
--- a/win32/config_H.bc
+++ b/win32/config_H.bc
@@ -113,7 +113,7 @@
* This symbol, if defined, indicates that the alarm routine is
* available.
*/
-/*#define HAS_ALARM /**/
+#define HAS_ALARM /**/
/* HASATTRIBUTE:
* This symbol indicates the C compiler can check for function attributes,
diff --git a/win32/config_H.vc b/win32/config_H.vc
index 76f19f1d87..4634072a4e 100644
--- a/win32/config_H.vc
+++ b/win32/config_H.vc
@@ -1400,7 +1400,7 @@
* This symbol is defined to be the type of char used in stdio.h.
* It has the values "unsigned char" or "char".
*/
-#define STDCHAR unsigned char /**/
+#define STDCHAR char /**/
/* Uid_t:
* This symbol holds the type used to declare user ids in the kernel.
diff --git a/win32/makedef.pl b/win32/makedef.pl
index 04e6fd93ed..8bc7a8a46a 100644
--- a/win32/makedef.pl
+++ b/win32/makedef.pl
@@ -14,15 +14,18 @@
# that does not present in the WIN32 port but there is no easy
# way to find them so I just put a exception list here
+while (@ARGV && $ARGV[0] =~ /^-/)
+ {
+ my $flag = shift;
+ $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
+ }
+
+warn join(' ',keys %define)."\n";
+
my $CCTYPE = shift || "MSVC";
$skip_sym=<<'!END!OF!SKIP!';
-Perl_SvIV
-Perl_SvNV
-Perl_SvTRUE
-Perl_SvUV
Perl_block_type
-Perl_sv_pvn
Perl_additem
Perl_cast_ulong
Perl_check_uni
@@ -63,6 +66,7 @@ Perl_force_next
Perl_force_word
Perl_hv_stashpv
Perl_intuit_more
+Perl_init_thread_intern
Perl_know_next
Perl_modkids
Perl_mstats
@@ -83,6 +87,7 @@ Perl_pp_interp
Perl_pp_map
Perl_pp_nswitch
Perl_q
+Perl_rcsid
Perl_reall_srchlen
Perl_regdump
Perl_regfold
@@ -108,7 +113,6 @@ Perl_setenv_getix
Perl_skipspace
Perl_sublex_done
Perl_sublex_start
-Perl_sv_peek
Perl_sv_ref
Perl_sv_setptrobj
Perl_timesbuf
@@ -136,12 +140,50 @@ Perl_my_memcmp
Perl_my_memset
Perl_cshlen
Perl_cshname
-Perl_condpair_magic
-Perl_magic_mutexfree
Perl_opsave
+!END!OF!SKIP!
+
+unless ($define{'USE_THREADS'})
+ {
+ $skip_sym .= <<'!END!OF!SKIP!';
+Perl_condpair_magic
+Perl_thr_key
+Perl_sv_mutex
+Perl_malloc_mutex
+Perl_eval_mutex
+Perl_eval_cond
+Perl_eval_owner
+Perl_threads_mutex
+Perl_nthreads_cond
Perl_unlock_condpair
Perl_vtbl_mutex
+Perl_magic_mutexfree
+Perl_sv_iv
+Perl_sv_nv
+Perl_sv_true
+Perl_sv_uv
+Perl_sv_pvn
+Perl_newRV_noinc
!END!OF!SKIP!
+ }
+
+if ($define{'USE_THISPTR'} || $define{'USE_THREADS'})
+ {
+ open(THREAD,"<../thread.sym") || die "Cannot open thread.sym:$!";
+ while (<THREAD>)
+ {
+ next if (!/^[A-Za-z]/);
+ next if (/_amg[ \t]*$/);
+ $skip_sym .= "Perl_".$_;
+ }
+ close(THREAD);
+ $skip_sym .= "Perl_op\n";
+ }
+
+unless ($define{'USE_THREADS'})
+ {
+ $skip_sym .= "Perl_thread_create\n";
+ }
# All symbols have a Perl_ prefix because that's what embed.h
# sticks in front of them.
@@ -188,6 +230,8 @@ while (<DATA>) {
next if (/^#/);
$symbol = $_;
next if ($skip_sym =~ m/^$symbol/m);
+ $symbol = "Perl_".$symbol if ($define{'USE_THISPTR'}
+ && $symbol =~ /^perl/);
emit_symbol($symbol);
}
@@ -233,6 +277,7 @@ perl_require_pv
perl_eval_pv
perl_eval_sv
boot_DynaLoader
+Perl_thread_create
win32_errno
win32_environ
win32_stdin
diff --git a/win32/makefile.mk b/win32/makefile.mk
index ffd66d566d..655efb7395 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -10,7 +10,10 @@
# Set these to wherever you want "nmake install" to put your
# newly built perl.
INST_DRV=c:
-INST_TOP=$(INST_DRV)\perl
+INST_TOP=$(INST_DRV)\perl\perl5004.5X
+BUILDOPT=-DUSE_THREADS
+
+# -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include
#
# uncomment one if you are using Visual C++ 2.x or Borland
@@ -25,14 +28,14 @@ CCTYPE=BORLAND
#
# set the install locations of the compiler include/libraries
#CCHOME = f:\msdev\vc
-CCHOME = D:\bc5
+CCHOME = C:\bc5
CCINCDIR = $(CCHOME)\include
CCLIBDIR = $(CCHOME)\lib
#
# set this to point to cmd.exe (only needed if you use some
# alternate shell that doesn't grok cmd.exe style commands)
-SHELL = g:\winnt\system32\cmd.exe
+#SHELL = g:\winnt\system32\cmd.exe
#
# set this to your email address (perl will guess a value from
@@ -60,7 +63,8 @@ IMPLIB = implib
RUNTIME = -D_RTLDLL
INCLUDES = -I.\include -I. -I.. -I$(CCINCDIR)
#PCHFLAGS = -H -H$(INTDIR)\bcmoduls.pch
-DEFINES = -DWIN32 -DPERLDLL
+DEFINES = -DWIN32 $(BUILDOPT)
+LOCDEFS = -DPERLDLL
SUBSYS = console
LIBC = cw32mti.lib
LIBFILES = import32.lib $(LIBC) odbc32.lib odbccp32.lib
@@ -71,11 +75,11 @@ WINIOMAYBE =
OPTIMIZE = -v $(RUNTIME)
LINK_DBG = -v
.ELSE
-OPTIMIZE = -O $(RUNTIME)
+OPTIMIZE = -5 -O2 $(RUNTIME)
LINK_DBG =
.ENDIF
-CFLAGS = -w -tWM -tWD $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
+CFLAGS = -w -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
LINK_FLAGS = $(LINK_DBG) -L$(CCLIBDIR)
OBJOUT_FLAG = -o
@@ -92,7 +96,8 @@ RUNTIME = -MD
.ENDIF
INCLUDES = -I.\include -I. -I..
#PCHFLAGS = -Fp$(INTDIR)\vcmoduls.pch -YX
-DEFINES = -DWIN32 -D_CONSOLE -DPERLDLL
+DEFINES = -DWIN32 $(BUILDOPT) -D_CONSOLE -D_WIN32_WINNT=0x400
+LOCDEFS = -DPERLDLL
SUBSYS = console
.IF "$(RUNTIME)" == "-MD"
@@ -125,7 +130,7 @@ LIBFILES = oldnames.lib kernel32.lib user32.lib gdi32.lib \
oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
version.lib odbc32.lib odbccp32.lib
-CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
+CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
OBJOUT_FLAG = -Fo
@@ -261,11 +266,13 @@ CORE_OBJ= ..\av.obj \
WIN32_C = perllib.c \
win32.c \
win32io.c \
- win32sck.c
+ win32sck.c \
+ win32thread.c
WIN32_OBJ = win32.obj \
win32io.obj \
- win32sck.obj
+ win32sck.obj \
+ win32thread.obj
PERL95_OBJ = perl95.obj \
win32mt.obj \
@@ -297,6 +304,7 @@ CORE_H = ..\av.h \
..\regexp.h \
..\scope.h \
..\sv.h \
+ ..\thread.h \
..\unixish.h \
..\util.h \
..\XSUB.h \
@@ -308,7 +316,7 @@ CORE_H = ..\av.h \
.\win32.h
-EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File attrs
+EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File attrs Thread
DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
SOCKET=$(EXTDIR)\Socket\Socket
@@ -317,6 +325,7 @@ OPCODE=$(EXTDIR)\Opcode\Opcode
SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
IO=$(EXTDIR)\IO\IO
ATTRS=$(EXTDIR)\attrs\attrs
+THREAD=$(EXTDIR)\Thread\Thread
SOCKET_DLL=..\lib\auto\Socket\Socket.dll
FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
@@ -324,6 +333,7 @@ OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
IO_DLL=..\lib\auto\IO\IO.dll
ATTRS_DLL=..\lib\auto\attrs\attrs.dll
+THREAD_DLL=..\lib\auto\Thread\Thread.dll
STATICLINKMODULES=DynaLoader
DYNALOADMODULES= \
@@ -332,7 +342,8 @@ DYNALOADMODULES= \
$(OPCODE_DLL) \
$(SDBM_FILE_DLL)\
$(IO_DLL) \
- $(ATTRS_DLL)
+ $(ATTRS_DLL) \
+ $(THREAD_DLL)
POD2HTML=$(PODDIR)\pod2html
POD2MAN=$(PODDIR)\pod2man
@@ -368,15 +379,16 @@ perlglob.obj : perlglob.c
config.w32 : $(CFGSH_TMPL)
copy $(CFGSH_TMPL) config.w32
-.\config.h : $(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)" \
- "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" \
+ "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(OPTIMIZE) $(DEFINES)" \
"cf_email=$(EMAIL)" "libs=$(LIBFILES:f)" "incpath=$(CCINCDIR)" \
"libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" "libc=$(LIBC)" \
+ "LINK_FLAGS=$(LINK_FLAGS)" \
config.w32 > ..\config.sh
$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
@@ -403,8 +415,8 @@ $(WIN32_OBJ) : $(CORE_H)
$(CORE_OBJ) : $(CORE_H)
$(DLL_OBJ) : $(CORE_H)
-perldll.def : $(MINIPERL) $(CONFIGPM)
- $(MINIPERL) -w makedef.pl $(CCTYPE) > perldll.def
+perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym makedef.pl
+ $(MINIPERL) -w makedef.pl $(DEFINES) $(CCTYPE) > perldll.def
$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
.IF "$(CCTYPE)" == "BORLAND"
@@ -449,8 +461,8 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj
.ENDIF
copy splittree.pl ..
$(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
- attrib -r ..\t\*.*
- copy test ..\t
+# attrib -r ..\t\*.*
+# copy test ..\t
.IF "$(CCTYPE)" != "BORLAND"
@@ -486,12 +498,17 @@ $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
+$(THREAD_DLL): $(PERLEXE) $(THREAD).xs
+ cd $(EXTDIR)\$(*B) && \
+ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
+ cd $(EXTDIR)\$(*B) && $(MAKE)
+
$(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs
cd $(EXTDIR)\$(*B) && \
..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
cd $(EXTDIR)\$(*B) && $(MAKE)
-$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
+$(IO_DLL): $(PERLEXE) $(IO).xs
cd $(EXTDIR)\$(*B) && \
..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
cd $(EXTDIR)\$(*B) && $(MAKE)
@@ -538,9 +555,9 @@ distclean: clean
$(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
-del /f *.def *.map
-del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
- $(OPCODE_DLL) $(ATTRS_DLL)
+ $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL)
-del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
- $(DYNALOADER).c $(ATTRS).c
+ $(DYNALOADER).c $(ATTRS).c $(THREAD).c
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
-del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new
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
diff --git a/win32/win32.c b/win32/win32.c
index 7cbfae8a83..e10bf2b463 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -361,7 +361,7 @@ GetShell(void)
}
int
-do_aspawn(void* really, void** mark, void** arglast)
+do_aspawn(void* really, void ** mark, void ** arglast)
{
char **argv;
char *strPtr;
@@ -524,7 +524,7 @@ opendir(char *filename)
/* char *dummy;*/
/* check to see if filename is a directory */
- if (win32_stat(filename, &sbuf) < 0 || sbuf.st_mode & S_IFDIR == 0) {
+ if (win32_stat(filename, &sbuf) < 0 || (sbuf.st_mode & S_IFDIR) == 0) {
return NULL;
}
@@ -833,26 +833,78 @@ win32_getenv(const char *name)
#endif
+static long
+FileTimeToClock(PFILETIME ft)
+{
+ __int64 qw = ft->dwHighDateTime;
+ qw <<= 32;
+ qw |= ft->dwLowDateTime;
+ qw /= 10000; /* File time ticks at 0.1uS, clock at 1mS */
+ return (long) qw;
+}
+
#undef times
int
mytimes(struct tms *timebuf)
{
- clock_t t = clock();
- timebuf->tms_utime = t;
- timebuf->tms_stime = 0;
- timebuf->tms_cutime = 0;
- timebuf->tms_cstime = 0;
-
+ FILETIME user;
+ FILETIME kernel;
+ FILETIME dummy;
+ if (GetProcessTimes(GetCurrentProcess(), &dummy, &dummy,
+ &kernel,&user)) {
+ timebuf->tms_utime = FileTimeToClock(&user);
+ timebuf->tms_stime = FileTimeToClock(&kernel);
+ timebuf->tms_cutime = 0;
+ timebuf->tms_cstime = 0;
+
+ } else {
+ /* That failed - e.g. Win95 fallback to clock() */
+ clock_t t = clock();
+ timebuf->tms_utime = t;
+ timebuf->tms_stime = 0;
+ timebuf->tms_cutime = 0;
+ timebuf->tms_cstime = 0;
+ }
return 0;
}
+static UINT timerid = 0;
+
+
+static VOID CALLBACK TimerProc(HWND win, UINT msg, UINT id, DWORD time)
+{
+ KillTimer(NULL,timerid);
+ timerid=0;
+ sighandler(14);
+}
+
#undef alarm
unsigned int
myalarm(unsigned int sec)
{
- /* we warn the usuage of alarm function */
- if (sec != 0)
- WARN("dummy function alarm called, program might not function as expected\n");
+ /*
+ * the 'obvious' implentation is SetTimer() with a callback
+ * which does whatever receiving SIGALRM would do
+ * we cannot use SIGALRM even via raise() as it is not
+ * one of the supported codes in <signal.h>
+ *
+ * Snag is unless something is looking at the message queue
+ * nothing happens :-(
+ */
+ if (sec)
+ {
+ timerid = SetTimer(NULL,timerid,sec*1000,(TIMERPROC)TimerProc);
+ if (!timerid)
+ croak("Cannot set timer");
+ }
+ else
+ {
+ if (timerid)
+ {
+ KillTimer(NULL,timerid);
+ timerid=0;
+ }
+ }
return 0;
}
@@ -987,7 +1039,7 @@ win32_fopen(const char *filename, const char *mode)
DllExport FILE *
win32_fdopen( int handle, const char *mode)
{
- return pIOSubSystem->pfnfdopen(handle, mode);
+ return pIOSubSystem->pfnfdopen(handle, (char *) mode);
}
DllExport FILE *
@@ -1205,13 +1257,13 @@ win32_chdir(const char *dir)
DllExport int
win32_spawnvp(int mode, const char *cmdname, const char *const *argv)
{
- return pIOSubSystem->pfnspawnvp(mode, cmdname, argv);
+ return pIOSubSystem->pfnspawnvp(mode, cmdname, (char * const *) argv);
}
DllExport int
win32_execvp(const char *cmdname, const char *const *argv)
{
- return pIOSubSystem->pfnexecvp(cmdname, argv);
+ return pIOSubSystem->pfnexecvp(cmdname, (char *const *)argv);
}
DllExport void
@@ -1637,3 +1689,7 @@ Perl_win32_init(int *argcp, char ***argvp)
_control87(MCW_EM, MCW_EM);
#endif
}
+
+
+
+
diff --git a/win32/win32.h b/win32/win32.h
index dc069ba366..525ef0f6cc 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -52,6 +52,10 @@ typedef long gid_t;
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern uid_t getuid(void);
extern gid_t getgid(void);
extern uid_t geteuid(void);
@@ -61,6 +65,11 @@ extern int setgid(gid_t gid);
extern int kill(int pid, int sig);
+#ifdef __cplusplus
+}
+#endif
+
+
extern char *staticlinkmodules[];
/* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls
@@ -79,10 +88,16 @@ extern char *staticlinkmodules[];
EXT char *win32_getenv(const char *name);
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
EXT void Perl_win32_init(int *argcp, char ***argvp);
#define USE_SOCKETS_AS_HANDLES
#ifndef USE_SOCKETS_AS_HANDLES
+
extern FILE *myfdopen(int, char *);
#undef fdopen
@@ -119,11 +134,15 @@ char *win32PerlLibPath(void);
char *win32SiteLibPath(void);
int mytimes(struct tms *timebuf);
unsigned int myalarm(unsigned int sec);
-int do_aspawn(void* really, void** mark, void** arglast);
+int do_aspawn(void* really, void ** mark, void ** arglast);
int do_spawn(char *cmd);
char do_exec(char *cmd);
void init_os_extras(void);
+#ifdef __cplusplus
+}
+#endif
+
typedef char * caddr_t; /* In malloc.c (core address). */
/*
@@ -144,9 +163,18 @@ typedef char * caddr_t; /* In malloc.c (core address). */
#pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761)
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int IsWin95(void);
int IsWinNT(void);
+#ifdef __cplusplus
+}
+#endif
+
+
#ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers dont have this */
#define VER_PLATFORM_WIN32_WINDOWS 1
#endif
diff --git a/win32/win32io.c b/win32/win32io.c
index eeb684620b..0e2e649059 100644
--- a/win32/win32io.c
+++ b/win32/win32io.c
@@ -1,13 +1,11 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
#define WIN32_LEAN_AND_MEAN
+#include <stdio.h>
+extern int my_fclose(FILE *pf);
+#include "EXTERN.h"
#define WIN32IO_IS_STDIO
-#define EXT
#include <windows.h>
-#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <sys/stat.h>
@@ -17,6 +15,16 @@ extern "C" {
#include <errno.h>
#include <process.h>
#include <direct.h>
+
+
+#ifdef __cplusplus
+#define START_EXTERN_C extern "C" {
+#define END_EXTERN_C }
+#else
+#define START_EXTERN_C
+#define END_EXTERN_C
+#endif
+
#include "win32iop.h"
/*
@@ -238,7 +246,6 @@ my_flock(int fd, int oper)
#undef LK_ERR
#undef LK_LEN
-EXT int my_fclose(FILE *pf);
#ifdef PERLDLL
__declspec(dllexport)
@@ -321,7 +328,6 @@ WIN32_IOSUBSYSTEM win32stdio = {
};
-#ifdef __cplusplus
-}
-#endif
+
+
diff --git a/win32/win32io.h b/win32/win32io.h
index ba4080c152..0e849cf783 100644
--- a/win32/win32io.h
+++ b/win32/win32io.h
@@ -3,6 +3,9 @@
#ifdef __BORLANDC__
#include <stdarg.h>
+#define MSconst
+#else
+#define MSconst const
#endif
typedef struct {
@@ -20,7 +23,7 @@ int (*pfnvprintf)(const char *format, va_list arg);
size_t (*pfnfread)(void *buf, size_t size, size_t count, FILE *pf);
size_t (*pfnfwrite)(const void *buf, size_t size, size_t count, FILE *pf);
FILE* (*pfnfopen)(const char *path, const char *mode);
-FILE* (*pfnfdopen)(int fh, const char *mode);
+FILE* (*pfnfdopen)(int fh, MSconst char *mode);
FILE* (*pfnfreopen)(const char *path, const char *mode, FILE *pf);
int (*pfnfclose)(FILE *pf);
int (*pfnfputs)(const char *s,FILE *pf);
@@ -55,12 +58,12 @@ int (*pfnwrite)(int fd, const void *buf, unsigned int cnt);
int (*pfnopenmode)(int mode);
int (*pfn_open_osfhandle)(long handle, int flags);
long (*pfn_get_osfhandle)(int fd);
-int (*pfnspawnvp)(int mode, const char *cmdname, const char *const *argv);
+int (*pfnspawnvp)(int mode, const char *cmdname, MSconst char * const *argv);
int (*pfnmkdir)(const char *path);
int (*pfnrmdir)(const char *path);
int (*pfnchdir)(const char *path);
int (*pfnflock)(int fd, int oper);
-int (*pfnexecvp)(const char *cmdname, const char *const *argv);
+int (*pfnexecvp)(const char *cmdname, MSconst char *const *argv);
void (*pfnperror)(const char *str);
void (*pfnsetbuf)(FILE *pf, char *buf);
int (*pfnsetvbuf)(FILE *pf, char *buf, int type, size_t size);
@@ -85,3 +88,4 @@ int signature_end;
typedef WIN32_IOSUBSYSTEM *PWIN32_IOSUBSYSTEM;
#endif /* WIN32IO_H */
+
diff --git a/win32/win32iop.h b/win32/win32iop.h
index 4606563d0e..52acce1a9b 100644
--- a/win32/win32iop.h
+++ b/win32/win32iop.h
@@ -1,6 +1,15 @@
#ifndef WIN32IOP_H
#define WIN32IOP_H
+/*
+ * defines for flock emulation
+ */
+#define LOCK_SH 1
+#define LOCK_EX 2
+#define LOCK_NB 4
+#define LOCK_UN 8
+
+#include <win32io.h> /* pull in the io sub system structure */
/*
* Make this as close to original stdio as possible.
@@ -9,6 +18,8 @@
/*
* function prototypes for our own win32io layer
*/
+START_EXTERN_C
+
EXT int * win32_errno(void);
EXT char *** win32_environ(void);
EXT FILE* win32_stdin(void);
@@ -81,25 +92,20 @@ EXT void* win32_calloc(size_t numitems, size_t size);
EXT void* win32_realloc(void *block, size_t size);
EXT void win32_free(void *block);
+
+
/*
* these two are win32 specific but still io related
*/
int stolen_open_osfhandle(long handle, int flags);
long stolen_get_osfhandle(int fd);
-/*
- * defines for flock emulation
- */
-#define LOCK_SH 1
-#define LOCK_EX 2
-#define LOCK_NB 4
-#define LOCK_UN 8
-
-#include <win32io.h> /* pull in the io sub system structure */
EXT PWIN32_IOSUBSYSTEM SetIOSubSystem(void *piosubsystem);
EXT PWIN32_IOSUBSYSTEM GetIOSubSystem(void);
+END_EXTERN_C
+
/*
* the following six(6) is #define in stdio.h
*/
diff --git a/win32/win32sck.c b/win32/win32sck.c
index 3653fc8b88..b4ad4f4cfb 100644
--- a/win32/win32sck.c
+++ b/win32/win32sck.c
@@ -702,7 +702,14 @@ win32_setservent(int stayopen)
#define WIN32IO_IS_STDIO
#include <io.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
#include "win32iop.h"
+#ifdef __cplusplus
+}
+#endif
static struct servent*
win32_savecopyservent(struct servent*d, struct servent*s, const char *proto)
diff --git a/win32/win32thread.c b/win32/win32thread.c
index 9f63d178f4..dfa9a0c733 100644
--- a/win32/win32thread.c
+++ b/win32/win32thread.c
@@ -1,10 +1,26 @@
#include "EXTERN.h"
#include "perl.h"
-#include "win32/win32thread.h"
+
+void
+Perl_alloc_thread_key(void)
+{
+#ifdef USE_THREADS
+ static int key_allocated = 0;
+ if (!key_allocated) {
+ if ((thr_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
+ croak("panic: TlsAlloc");
+ key_allocated = 1;
+ }
+#endif
+}
void
init_thread_intern(struct thread *thr)
{
+#ifdef USE_THREADS
+ /* GetCurrentThread() retrurns a pseudo handle, need
+ this to convert it into a handle another thread can use
+ */
DuplicateHandle(GetCurrentProcess(),
GetCurrentThread(),
GetCurrentProcess(),
@@ -12,19 +28,22 @@ init_thread_intern(struct thread *thr)
0,
FALSE,
DUPLICATE_SAME_ACCESS);
- if ((thr_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
- croak("panic: TlsAlloc");
- if (TlsSetValue(thr_key, (LPVOID) thr) != TRUE)
- croak("panic: TlsSetValue");
+#endif
}
+#ifdef USE_THREADS
int
-thread_create(struct thread *thr, THREAD_RET_TYPE (*fn)(void *))
+Perl_thread_create(struct thread *thr, thread_func_t *fn)
{
DWORD junk;
MUTEX_LOCK(&thr->mutex);
+ DEBUG_L(PerlIO_printf(PerlIO_stderr(),
+ "%p: create OS thread\n", thr));
thr->self = CreateThread(NULL, 0, fn, (void*)thr, 0, &junk);
+ DEBUG_L(PerlIO_printf(PerlIO_stderr(),
+ "%p: OS thread = %p, id=%ld\n", thr, thr->self, junk));
MUTEX_UNLOCK(&thr->mutex);
return thr->self ? 0 : -1;
}
+#endif
diff --git a/win32/win32thread.h b/win32/win32thread.h
index ab0dbc598f..75aa25b632 100644
--- a/win32/win32thread.h
+++ b/win32/win32thread.h
@@ -1,6 +1,6 @@
-/*typedef CRITICAL_SECTION perl_mutex;*/
-typedef HANDLE perl_mutex;
-typedef HANDLE perl_cond;
+#ifndef _WIN32THREAD_H
+#define _WIN32THREAD_H
+typedef struct win32_cond { LONG waiters; HANDLE sem; } perl_cond;
typedef DWORD perl_key;
typedef HANDLE perl_thread;
@@ -8,12 +8,15 @@ typedef HANDLE perl_thread;
* but can't be communicated to child processes, and can't get
* HANDLE to it for use elsewhere
*/
-/*
+
+#ifndef DONT_USE_CRITICAL_SECTION
+typedef CRITICAL_SECTION perl_mutex;
#define MUTEX_INIT(m) InitializeCriticalSection(m)
#define MUTEX_LOCK(m) EnterCriticalSection(m)
#define MUTEX_UNLOCK(m) LeaveCriticalSection(m)
#define MUTEX_DESTROY(m) DeleteCriticalSection(m)
-*/
+#else
+typedef HANDLE perl_mutex;
#define MUTEX_INIT(m) \
STMT_START { \
@@ -36,38 +39,51 @@ typedef HANDLE perl_thread;
croak("panic: MUTEX_DESTROY"); \
} STMT_END
+#endif
+
+/* These macros assume that the mutex associated with the condition
+ * will always be held before COND_{SIGNAL,BROADCAST,WAIT,DESTROY},
+ * so there's no separate mutex protecting access to (c)->waiters
+ */
#define COND_INIT(c) \
- STMT_START { \
- if ((*(c) = CreateEvent(NULL,TRUE,FALSE,NULL)) == NULL) \
- croak("panic: COND_INIT"); \
+ STMT_START { \
+ (c)->waiters = 0; \
+ (c)->sem = CreateSemaphore(NULL,0,LONG_MAX,NULL); \
+ if ((c)->sem == NULL) \
+ croak("panic: COND_INIT (%ld)",GetLastError()); \
} STMT_END
+
#define COND_SIGNAL(c) \
- STMT_START { \
- if (PulseEvent(*(c)) == 0) \
- croak("panic: COND_SIGNAL (%ld)",GetLastError()); \
+ STMT_START { \
+ if (ReleaseSemaphore((c)->sem,1,NULL) == 0) \
+ croak("panic: COND_SIGNAL (%ld)",GetLastError()); \
} STMT_END
+
#define COND_BROADCAST(c) \
- STMT_START { \
- if (PulseEvent(*(c)) == 0) \
- croak("panic: COND_BROADCAST"); \
+ STMT_START { \
+ if ((c)->waiters > 0 && \
+ ReleaseSemaphore((c)->sem,(c)->waiters,NULL) == 0) \
+ croak("panic: COND_BROADCAST (%ld)",GetLastError());\
} STMT_END
-/* #define COND_WAIT(c, m) \
- STMT_START { \
- if (WaitForSingleObject(*(c),INFINITE) == WAIT_FAILED) \
- croak("panic: COND_WAIT"); \
- } STMT_END
-*/
+
#define COND_WAIT(c, m) \
- STMT_START { \
- if (SignalObjectAndWait(*(m),*(c),INFINITE,FALSE) == WAIT_FAILED)\
- croak("panic: COND_WAIT"); \
- else \
- MUTEX_LOCK(m); \
+ STMT_START { \
+ (c)->waiters++; \
+ MUTEX_UNLOCK(m); \
+ /* Note that there's no race here, since a \
+ * COND_BROADCAST() on another thread will have seen the\
+ * right number of waiters (i.e. including this one) */ \
+ if (WaitForSingleObject((c)->sem,INFINITE)==WAIT_FAILED)\
+ croak("panic: COND_WAIT (%ld)",GetLastError()); \
+ MUTEX_LOCK(m); \
+ (c)->waiters--; \
} STMT_END
+
#define COND_DESTROY(c) \
- STMT_START { \
- if (CloseHandle(*(c)) == 0) \
- croak("panic: COND_DESTROY"); \
+ STMT_START { \
+ (c)->waiters = 0; \
+ if (CloseHandle((c)->sem) == 0) \
+ croak("panic: COND_DESTROY (%ld)",GetLastError()); \
} STMT_END
#define DETACH(t) \
@@ -79,8 +95,22 @@ typedef HANDLE perl_thread;
} STMT_END
#define THR ((struct thread *) TlsGetValue(thr_key))
+#define THREAD_CREATE(t, f) Perl_thread_create(t, f)
+#define THREAD_POST_CREATE(t) NOOP
+#define THREAD_RET_TYPE DWORD WINAPI
+#define THREAD_RET_CAST(p) ((DWORD)(p))
-#define HAVE_THREAD_INTERN
+typedef THREAD_RET_TYPE thread_func_t(void *);
+
+START_EXTERN_C
+void Perl_alloc_thread_key _((void));
+int Perl_thread_create _((struct thread *thr, thread_func_t *fn));
+void Perl_init_thread_intern _((struct thread *thr));
+END_EXTERN_C
+
+#define INIT_THREADS NOOP
+#define ALLOC_THREAD_KEY Perl_alloc_thread_key()
+#define INIT_THREAD_INTERN(thr) Perl_init_thread_intern(thr)
#define JOIN(t, avp) \
STMT_START { \
@@ -95,8 +125,6 @@ typedef HANDLE perl_thread;
croak("panic: TlsSetValue"); \
} STMT_END
-#define THREAD_CREATE(t, f) thread_create(t, f)
-#define THREAD_POST_CREATE(t) NOOP
-#define THREAD_RET_TYPE DWORD WINAPI
-#define THREAD_RET_CAST(p) ((DWORD)(p))
#define YIELD Sleep(0)
+
+#endif /* _WIN32THREAD_H */
diff --git a/x2p/a2p.c b/x2p/a2p.c
index 340e4bfad6..e79e156203 100644
--- a/x2p/a2p.c
+++ b/x2p/a2p.c
@@ -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"))
{
diff --git a/x2p/a2p.h b/x2p/a2p.h
index b00b0723ea..085935d98f 100644
--- a/x2p/a2p.h
+++ b/x2p/a2p.h
@@ -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;
}
diff --git a/x2p/str.c b/x2p/str.c
index 88b3c60405..ff2dd7ce59 100644
--- a/x2p/str.c
+++ b/x2p/str.c
@@ -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;