summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-02-28 21:08:58 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-02-28 21:08:58 +0000
commit50243a955e8631e9228f2bc8eee4c6976cfd9f02 (patch)
treecfc2eca84684ee6e4161d7114defc2f241231dd0
parent924b3ec4f489a98ec4753478b6e6dcb35be8bf12 (diff)
parent319b3e9ef186494f9113ad230d3224fc10e20bba (diff)
downloadperl-50243a955e8631e9228f2bc8eee4c6976cfd9f02.tar.gz
[win32] integrate mainline
p4raw-id: //depot/win32/perl@604
-rwxr-xr-xConfigure823
-rw-r--r--MANIFEST18
-rw-r--r--Makefile.SH4
-rw-r--r--Policy_sh.SH77
-rw-r--r--atomic.h85
-rw-r--r--bytecode.h26
-rw-r--r--bytecode.pl2
-rw-r--r--byterun.c2
-rw-r--r--ext/SDBM_File/Makefile.PL34
-rw-r--r--ext/SDBM_File/sdbm/Makefile.PL4
-rw-r--r--ext/SDBM_File/sdbm/sdbm.h20
-rw-r--r--lib/ExtUtils/MM_VMS.pm14
-rw-r--r--lib/Tie/Handle.pm161
-rw-r--r--os2/diff.configure248
-rw-r--r--os2/os2.c4
-rw-r--r--perl.c3
-rw-r--r--perlvars.h1
-rw-r--r--pod/perltie.pod24
-rw-r--r--pp_sys.c29
-rw-r--r--sv.c7
-rw-r--r--sv.h37
-rwxr-xr-xt/lib/anydbm.t16
-rwxr-xr-xt/lib/sdbm.t23
-rwxr-xr-xt/op/tiehandle.t137
-rw-r--r--util.c4
-rw-r--r--vms/descrip.mms30
-rw-r--r--vms/perlvms.pod24
-rw-r--r--vms/test.com5
-rw-r--r--win32/makedef.pl1
29 files changed, 1154 insertions, 709 deletions
diff --git a/Configure b/Configure
index e0dff4f5a5..a34a5db6f4 100755
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Tue Feb 24 12:36:41 EST 1998 [metaconfig 3.0 PL70]
+# Generated on Wed Feb 25 16:44:06 EST 1998 [metaconfig 3.0 PL70]
cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
@@ -765,7 +765,7 @@ locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
inclwanted=''
: Trailing extension. Override this in a hint file, if needed.
-_exe=''
+_exe=''
: Extra object files, if any, needed on this platform.
archobjs=''
groupstype=''
@@ -1431,7 +1431,7 @@ if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
fi
if $needman; then
cat <<EOH
-
+
This installation shell script will examine your system and ask you questions
to determine how the perl5 package should be installed. If you get
stuck on a question, you may use a ! shell escape to start a subshell or
@@ -1783,7 +1783,8 @@ fi
if test ! -f config.sh; then
$cat <<EOM
-First time through, eh? I have some defaults handy for the following systems:
+First time through, eh? I have some defaults handy for some systems
+that need some extra help getting the Configure answers right:
EOM
(cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
@@ -2056,23 +2057,44 @@ EOM
esac
;;
esac
+ if $test -f Policy.sh ; then
+ case "$dflt" in
+ *Policy*) ;;
+ none) dflt="Policy" ;;
+ *) dflt="Policy $dflt" ;;
+ esac
+ fi
;;
*)
dflt=`echo $hintfile | $sed 's/\.sh$//'`
;;
esac
+ if $test -f Policy.sh ; then
+ $cat <<EOM
+
+There's also a Policy hint file available, which should make the
+site-specific (policy) questions easier to answer.
+EOM
+
+ fi
+
$cat <<EOM
You may give one or more space-separated answers, or "none" if appropriate.
-If your OS version has no hints, DO NOT give a wrong version -- say "none".
+A well-behaved OS will have no hints, so answering "none" or just "Policy"
+is a good thing. DO NOT give a wrong version.
EOM
+
rp="Which of these apply, if any?"
. UU/myread
tans=$ans
for file in $tans; do
- if $test -f $src/hints/$file.sh; then
+ if $test X$file = XPolicy -a -f Policy.sh; then
+ . Policy.sh
+ $cat Policy.sh >> UU/config.sh
+ elif $test -f $src/hints/$file.sh; then
. $src/hints/$file.sh
$cat $src/hints/$file.sh >> UU/config.sh
elif $test X$tans = X -o X$tans = Xnone ; then
@@ -3027,6 +3049,393 @@ else
echo "Could not find manual pages in source form." >&4
fi
+: determine where manual pages go
+set man1dir man1dir none
+eval $prefixit
+$cat <<EOM
+
+$spackage has manual pages available in source form.
+EOM
+case "$nroff" in
+nroff)
+ echo "However, you don't have nroff, so they're probably useless to you."
+ case "$man1dir" in
+ '') man1dir="none";;
+ esac;;
+esac
+echo "If you don't want the manual sources installed, answer 'none'."
+case "$man1dir" in
+' ') dflt=none
+ ;;
+'')
+ lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
+ lookpath="$lookpath $prefixexp/man/p_man/man1"
+ lookpath="$lookpath $prefixexp/man/u_man/man1"
+ lookpath="$lookpath $prefixexp/man/man.1"
+ case "$sysman" in
+ */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
+ *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
+ esac
+ set dflt
+ eval $prefixup
+ ;;
+*) dflt="$man1dir"
+ ;;
+esac
+echo " "
+fn=dn+~
+rp="Where do the main $spackage manual pages (source) go?"
+. ./getfile
+if $test "X$man1direxp" != "X$ansexp"; then
+ installman1dir=''
+fi
+man1dir="$ans"
+man1direxp="$ansexp"
+case "$man1dir" in
+'') man1dir=' '
+ installman1dir='';;
+esac
+if $afs; then
+ $cat <<EOM
+
+Since you are running AFS, I need to distinguish the directory in which
+manual pages reside from the directory in which they are installed (and from
+which they are presumably copied to the former directory by occult means).
+
+EOM
+ case "$installman1dir" in
+ '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
+ *) dflt="$installman1dir";;
+ esac
+ fn=de~
+ rp='Where will man pages be installed?'
+ . ./getfile
+ installman1dir="$ans"
+else
+ installman1dir="$man1direxp"
+fi
+
+: What suffix to use on installed man pages
+
+case "$man1dir" in
+' ')
+ man1ext='0'
+ ;;
+*)
+ rp="What suffix should be used for the main $spackage man pages?"
+ case "$man1ext" in
+ '') case "$man1dir" in
+ *1) dflt=1 ;;
+ *1p) dflt=1p ;;
+ *1pm) dflt=1pm ;;
+ *l) dflt=l;;
+ *n) dflt=n;;
+ *o) dflt=o;;
+ *p) dflt=p;;
+ *C) dflt=C;;
+ *L) dflt=L;;
+ *L1) dflt=L1;;
+ *) dflt=1;;
+ esac
+ ;;
+ *) dflt="$man1ext";;
+ esac
+ . ./myread
+ man1ext="$ans"
+ ;;
+esac
+
+: see if we can have long filenames
+echo " "
+rmlist="$rmlist /tmp/cf$$"
+$test -d /tmp/cf$$ || mkdir /tmp/cf$$
+first=123456789abcdef
+second=/tmp/cf$$/$first
+$rm -f $first $second
+if (echo hi >$first) 2>/dev/null; then
+ if $test -f 123456789abcde; then
+ echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
+ val="$undef"
+ else
+ if (echo hi >$second) 2>/dev/null; then
+ if $test -f /tmp/cf$$/123456789abcde; then
+ $cat <<'EOM'
+That's peculiar... You can have filenames longer than 14 characters, but only
+on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
+I shall consider your system cannot support long filenames at all.
+EOM
+ val="$undef"
+ else
+ echo 'You can have filenames longer than 14 characters.' >&4
+ val="$define"
+ fi
+ else
+ $cat <<'EOM'
+How confusing! Some of your filesystems are sane enough to allow filenames
+longer than 14 characters but some others like /tmp can't even think about them.
+So, for now on, I shall assume your kernel does not allow them at all.
+EOM
+ val="$undef"
+ fi
+ fi
+else
+ $cat <<'EOM'
+You can't have filenames longer than 14 chars. You can't even think about them!
+EOM
+ val="$undef"
+fi
+set d_flexfnam
+eval $setvar
+$rm -rf /tmp/cf$$ 123456789abcde*
+
+: determine where library module manual pages go
+set man3dir man3dir none
+eval $prefixit
+$cat <<EOM
+
+$spackage has manual pages for many of the library modules.
+EOM
+
+case "$nroff" in
+nroff)
+ $cat <<'EOM'
+However, you don't have nroff, so they're probably useless to you.
+EOM
+ case "$man3dir" in
+ '') man3dir="none";;
+ esac;;
+esac
+
+case "$d_flexfnam" in
+undef)
+ $cat <<'EOM'
+However, your system can't handle the long file names like File::Basename.3.
+EOM
+ case "$man3dir" in
+ '') man3dir="none";;
+ esac;;
+esac
+
+echo "If you don't want the manual sources installed, answer 'none'."
+prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+case "$man3dir" in
+'') case "$prefix" in
+ *$prog*) dflt=`echo $man1dir |
+ $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
+ *) dflt="$privlib/man/man3" ;;
+ esac
+ ;;
+' ') dflt=none;;
+*) dflt="$man3dir" ;;
+esac
+echo " "
+
+fn=dn+~
+rp="Where do the $package library man pages (source) go?"
+. ./getfile
+if test "X$man3direxp" != "X$ansexp"; then
+ installman3dir=''
+fi
+
+man3dir="$ans"
+man3direxp="$ansexp"
+case "$man3dir" in
+'') man3dir=' '
+ installman3dir='';;
+esac
+if $afs; then
+ $cat <<EOM
+
+Since you are running AFS, I need to distinguish the directory in which
+manual pages reside from the directory in which they are installed (and from
+which they are presumably copied to the former directory by occult means).
+
+EOM
+ case "$installman3dir" in
+ '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
+ *) dflt="$installman3dir";;
+ esac
+ fn=de~
+ rp='Where will man pages be installed?'
+ . ./getfile
+ installman3dir="$ans"
+else
+ installman3dir="$man3direxp"
+fi
+
+: What suffix to use on installed man pages
+
+case "$man3dir" in
+' ')
+ man3ext='0'
+ ;;
+*)
+ rp="What suffix should be used for the $package library man pages?"
+ case "$man3ext" in
+ '') case "$man3dir" in
+ *3) dflt=3 ;;
+ *3p) dflt=3p ;;
+ *3pm) dflt=3pm ;;
+ *l) dflt=l;;
+ *n) dflt=n;;
+ *o) dflt=o;;
+ *p) dflt=p;;
+ *C) dflt=C;;
+ *L) dflt=L;;
+ *L3) dflt=L3;;
+ *) dflt=3;;
+ esac
+ ;;
+ *) dflt="$man3ext";;
+ esac
+ . ./myread
+ man3ext="$ans"
+ ;;
+esac
+
+: determine where public executable scripts go
+set scriptdir scriptdir
+eval $prefixit
+case "$scriptdir" in
+'')
+ dflt="$bin"
+ : guess some guesses
+ $test -d /usr/share/scripts && dflt=/usr/share/scripts
+ $test -d /usr/share/bin && dflt=/usr/share/bin
+ $test -d /usr/local/script && dflt=/usr/local/script
+ $test -d $prefixexp/script && dflt=$prefixexp/script
+ set dflt
+ eval $prefixup
+ ;;
+*) dflt="$scriptdir"
+ ;;
+esac
+$cat <<EOM
+
+Some installations have a separate directory just for executable scripts so
+that they can mount it across multiple architectures but keep the scripts in
+one spot. You might, for example, have a subdirectory of /usr/share for this.
+Or you might just lump your scripts in with all your other executables.
+
+EOM
+fn=d~
+rp='Where do you keep publicly executable scripts?'
+. ./getfile
+if $test "X$ansexp" != "X$scriptdirexp"; then
+ installscript=''
+fi
+scriptdir="$ans"
+scriptdirexp="$ansexp"
+if $afs; then
+ $cat <<EOM
+
+Since you are running AFS, I need to distinguish the directory in which
+scripts reside from the directory in which they are installed (and from
+which they are presumably copied to the former directory by occult means).
+
+EOM
+ case "$installscript" in
+ '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
+ *) dflt="$installscript";;
+ esac
+ fn=de~
+ rp='Where will public scripts be installed?'
+ . ./getfile
+ installscript="$ans"
+else
+ installscript="$scriptdirexp"
+fi
+
+: determine where site specific libraries go.
+set sitelib sitelib
+eval $prefixit
+case "$sitelib" in
+'')
+ prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ dflt="$privlib/site_$prog" ;;
+*) dflt="$sitelib" ;;
+esac
+$cat <<EOM
+
+The installation process will also create a directory for
+site-specific extensions and modules. Some users find it convenient
+to place all local files in this directory rather than in the main
+distribution directory.
+
+EOM
+fn=d~+
+rp='Pathname for the site-specific library files?'
+. ./getfile
+if $test "X$sitelibexp" != "X$ansexp"; then
+ installsitelib=''
+fi
+sitelib="$ans"
+sitelibexp="$ansexp"
+if $afs; then
+ $cat <<EOM
+
+Since you are running AFS, I need to distinguish the directory in
+which site-specific files reside from the directory in which they are
+installed (and from which they are presumably copied to the former
+directory by occult means).
+
+EOM
+ case "$installsitelib" in
+ '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
+ *) dflt="$installsitelib";;
+ esac
+ fn=de~
+ rp='Where will site-specific files be installed?'
+ . ./getfile
+ installsitelib="$ans"
+else
+ installsitelib="$sitelibexp"
+fi
+
+: determine where site specific architecture-dependent libraries go.
+xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'`
+: xxx is usuually lib/site_perl/archname.
+set sitearch sitearch none
+eval $prefixit
+case "$sitearch" in
+'') dflt="$sitelib/$archname" ;;
+*) dflt="$sitearch" ;;
+esac
+$cat <<EOM
+
+The installation process will also create a directory for
+architecture-dependent site-specific extensions and modules.
+
+EOM
+fn=nd~+
+rp='Pathname for the site-specific architecture-dependent library files?'
+. ./getfile
+if $test "X$sitearchexp" != "X$ansexp"; then
+ installsitearch=''
+fi
+sitearch="$ans"
+sitearchexp="$ansexp"
+if $afs; then
+ $cat <<EOM
+
+Since you are running AFS, I need to distinguish the directory in
+which site-specific architecture-dependent library files reside from
+the directory in which they are installed (and from which they are
+presumably copied to the former directory by occult means).
+
+EOM
+ case "$installsitearch" in
+ '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
+ *) dflt="$installsitearch";;
+ esac
+ fn=de~
+ rp='Where will site-specific architecture-dependent files be installed?'
+ . ./getfile
+ installsitearch="$ans"
+else
+ installsitearch="$sitearchexp"
+fi
+
: see what memory models we can support
case "$models" in
'')
@@ -4867,250 +5276,6 @@ case "$shrpenv" in
'') shrpenv="$tmp_shrpenv" ;;
esac
-: determine where manual pages go
-set man1dir man1dir none
-eval $prefixit
-$cat <<EOM
-
-$spackage has manual pages available in source form.
-EOM
-case "$nroff" in
-nroff)
- echo "However, you don't have nroff, so they're probably useless to you."
- case "$man1dir" in
- '') man1dir="none";;
- esac;;
-esac
-echo "If you don't want the manual sources installed, answer 'none'."
-case "$man1dir" in
-' ') dflt=none
- ;;
-'')
- lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
- lookpath="$lookpath $prefixexp/man/p_man/man1"
- lookpath="$lookpath $prefixexp/man/u_man/man1"
- lookpath="$lookpath $prefixexp/man/man.1"
- case "$sysman" in
- */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
- *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
- esac
- set dflt
- eval $prefixup
- ;;
-*) dflt="$man1dir"
- ;;
-esac
-echo " "
-fn=dn+~
-rp="Where do the main $spackage manual pages (source) go?"
-. ./getfile
-if $test "X$man1direxp" != "X$ansexp"; then
- installman1dir=''
-fi
-man1dir="$ans"
-man1direxp="$ansexp"
-case "$man1dir" in
-'') man1dir=' '
- installman1dir='';;
-esac
-if $afs; then
- $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-manual pages reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
-
-EOM
- case "$installman1dir" in
- '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
- *) dflt="$installman1dir";;
- esac
- fn=de~
- rp='Where will man pages be installed?'
- . ./getfile
- installman1dir="$ans"
-else
- installman1dir="$man1direxp"
-fi
-
-: What suffix to use on installed man pages
-
-case "$man1dir" in
-' ')
- man1ext='0'
- ;;
-*)
- rp="What suffix should be used for the main $spackage man pages?"
- case "$man1ext" in
- '') case "$man1dir" in
- *1) dflt=1 ;;
- *1p) dflt=1p ;;
- *1pm) dflt=1pm ;;
- *l) dflt=l;;
- *n) dflt=n;;
- *o) dflt=o;;
- *p) dflt=p;;
- *C) dflt=C;;
- *L) dflt=L;;
- *L1) dflt=L1;;
- *) dflt=1;;
- esac
- ;;
- *) dflt="$man1ext";;
- esac
- . ./myread
- man1ext="$ans"
- ;;
-esac
-
-: see if we can have long filenames
-echo " "
-rmlist="$rmlist /tmp/cf$$"
-$test -d /tmp/cf$$ || mkdir /tmp/cf$$
-first=123456789abcdef
-second=/tmp/cf$$/$first
-$rm -f $first $second
-if (echo hi >$first) 2>/dev/null; then
- if $test -f 123456789abcde; then
- echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
- val="$undef"
- else
- if (echo hi >$second) 2>/dev/null; then
- if $test -f /tmp/cf$$/123456789abcde; then
- $cat <<'EOM'
-That's peculiar... You can have filenames longer than 14 characters, but only
-on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
-I shall consider your system cannot support long filenames at all.
-EOM
- val="$undef"
- else
- echo 'You can have filenames longer than 14 characters.' >&4
- val="$define"
- fi
- else
- $cat <<'EOM'
-How confusing! Some of your filesystems are sane enough to allow filenames
-longer than 14 characters but some others like /tmp can't even think about them.
-So, for now on, I shall assume your kernel does not allow them at all.
-EOM
- val="$undef"
- fi
- fi
-else
- $cat <<'EOM'
-You can't have filenames longer than 14 chars. You can't even think about them!
-EOM
- val="$undef"
-fi
-set d_flexfnam
-eval $setvar
-$rm -rf /tmp/cf$$ 123456789abcde*
-
-: determine where library module manual pages go
-set man3dir man3dir none
-eval $prefixit
-$cat <<EOM
-
-$spackage has manual pages for many of the library modules.
-EOM
-
-case "$nroff" in
-nroff)
- $cat <<'EOM'
-However, you don't have nroff, so they're probably useless to you.
-EOM
- case "$man3dir" in
- '') man3dir="none";;
- esac;;
-esac
-
-case "$d_flexfnam" in
-undef)
- $cat <<'EOM'
-However, your system can't handle the long file names like File::Basename.3.
-EOM
- case "$man3dir" in
- '') man3dir="none";;
- esac;;
-esac
-
-echo "If you don't want the manual sources installed, answer 'none'."
-prog=`echo $package | $sed 's/-*[0-9.]*$//'`
-case "$man3dir" in
-'') case "$prefix" in
- *$prog*) dflt=`echo $man1dir |
- $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
- *) dflt="$privlib/man/man3" ;;
- esac
- ;;
-' ') dflt=none;;
-*) dflt="$man3dir" ;;
-esac
-echo " "
-
-fn=dn+~
-rp="Where do the $package library man pages (source) go?"
-. ./getfile
-if test "X$man3direxp" != "X$ansexp"; then
- installman3dir=''
-fi
-
-man3dir="$ans"
-man3direxp="$ansexp"
-case "$man3dir" in
-'') man3dir=' '
- installman3dir='';;
-esac
-if $afs; then
- $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-manual pages reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
-
-EOM
- case "$installman3dir" in
- '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
- *) dflt="$installman3dir";;
- esac
- fn=de~
- rp='Where will man pages be installed?'
- . ./getfile
- installman3dir="$ans"
-else
- installman3dir="$man3direxp"
-fi
-
-: What suffix to use on installed man pages
-
-case "$man3dir" in
-' ')
- man3ext='0'
- ;;
-*)
- rp="What suffix should be used for the $package library man pages?"
- case "$man3ext" in
- '') case "$man3dir" in
- *3) dflt=3 ;;
- *3p) dflt=3p ;;
- *3pm) dflt=3pm ;;
- *l) dflt=l;;
- *n) dflt=n;;
- *o) dflt=o;;
- *p) dflt=p;;
- *C) dflt=C;;
- *L) dflt=L;;
- *L3) dflt=L3;;
- *) dflt=3;;
- esac
- ;;
- *) dflt="$man3ext";;
- esac
- . ./myread
- man3ext="$ans"
- ;;
-esac
-
: see if we have to deal with yellow pages, now NIS.
if $test -d /usr/etc/yp || $test -d /etc/yp; then
if $test -f /usr/etc/nibindd; then
@@ -5473,149 +5638,6 @@ case "$startperl" in
*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
esac
-: determine where public executable scripts go
-set scriptdir scriptdir
-eval $prefixit
-case "$scriptdir" in
-'')
- dflt="$bin"
- : guess some guesses
- $test -d /usr/share/scripts && dflt=/usr/share/scripts
- $test -d /usr/share/bin && dflt=/usr/share/bin
- $test -d /usr/local/script && dflt=/usr/local/script
- $test -d $prefixexp/script && dflt=$prefixexp/script
- set dflt
- eval $prefixup
- ;;
-*) dflt="$scriptdir"
- ;;
-esac
-$cat <<EOM
-
-Some installations have a separate directory just for executable scripts so
-that they can mount it across multiple architectures but keep the scripts in
-one spot. You might, for example, have a subdirectory of /usr/share for this.
-Or you might just lump your scripts in with all your other executables.
-
-EOM
-fn=d~
-rp='Where do you keep publicly executable scripts?'
-. ./getfile
-if $test "X$ansexp" != "X$scriptdirexp"; then
- installscript=''
-fi
-scriptdir="$ans"
-scriptdirexp="$ansexp"
-if $afs; then
- $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in which
-scripts reside from the directory in which they are installed (and from
-which they are presumably copied to the former directory by occult means).
-
-EOM
- case "$installscript" in
- '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
- *) dflt="$installscript";;
- esac
- fn=de~
- rp='Where will public scripts be installed?'
- . ./getfile
- installscript="$ans"
-else
- installscript="$scriptdirexp"
-fi
-
-: determine where site specific libraries go.
-set sitelib sitelib
-eval $prefixit
-case "$sitelib" in
-'')
- prog=`echo $package | $sed 's/-*[0-9.]*$//'`
- dflt="$privlib/site_$prog" ;;
-*) dflt="$sitelib" ;;
-esac
-$cat <<EOM
-
-The installation process will also create a directory for
-site-specific extensions and modules. Some users find it convenient
-to place all local files in this directory rather than in the main
-distribution directory.
-
-EOM
-fn=d~+
-rp='Pathname for the site-specific library files?'
-. ./getfile
-if $test "X$sitelibexp" != "X$ansexp"; then
- installsitelib=''
-fi
-sitelib="$ans"
-sitelibexp="$ansexp"
-if $afs; then
- $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in
-which site-specific files reside from the directory in which they are
-installed (and from which they are presumably copied to the former
-directory by occult means).
-
-EOM
- case "$installsitelib" in
- '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
- *) dflt="$installsitelib";;
- esac
- fn=de~
- rp='Where will site-specific files be installed?'
- . ./getfile
- installsitelib="$ans"
-else
- installsitelib="$sitelibexp"
-fi
-
-: determine where site specific architecture-dependent libraries go.
-xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'`
-: xxx is usuually lib/site_perl/archname.
-set sitearch sitearch none
-eval $prefixit
-case "$sitearch" in
-'') dflt="$sitelib/$archname" ;;
-*) dflt="$sitearch" ;;
-esac
-$cat <<EOM
-
-The installation process will also create a directory for
-architecture-dependent site-specific extensions and modules.
-
-EOM
-fn=nd~+
-rp='Pathname for the site-specific architecture-dependent library files?'
-. ./getfile
-if $test "X$sitearchexp" != "X$ansexp"; then
- installsitearch=''
-fi
-sitearch="$ans"
-sitearchexp="$ansexp"
-if $afs; then
- $cat <<EOM
-
-Since you are running AFS, I need to distinguish the directory in
-which site-specific architecture-dependent library files reside from
-the directory in which they are installed (and from which they are
-presumably copied to the former directory by occult means).
-
-EOM
- case "$installsitearch" in
- '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
- *) dflt="$installsitearch";;
- esac
- fn=de~
- rp='Where will site-specific architecture-dependent files be installed?'
- . ./getfile
- installsitearch="$ans"
-else
- installsitearch="$sitearchexp"
-fi
-
cat <<EOM
Previous version of $package used the standard IO mechanisms as defined
@@ -9167,13 +9189,13 @@ $cc $ccflags -c foo.c >/dev/null 2>&1
$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
./foobar >/dev/null 2>&1; then
- echo "ar appears to generate random libraries itself."
+ echo "$ar appears to generate random libraries itself."
orderlib=false
ranlib=":"
elif $ar ts bar$_a >/dev/null 2>&1 &&
$cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
./foobar >/dev/null 2>&1; then
- echo "a table of contents needs to be added with 'ar ts'."
+ echo "a table of contents needs to be added with '$ar ts'."
orderlib=false
ranlib="$ar ts"
else
@@ -11000,6 +11022,17 @@ else
echo "Done."
fi
+if $test -f Policy.sh; then
+ $cat <<EOM
+
+If you compile $package on a different machine or from a different object
+directory, copy the Policy.sh file from this object directory to the
+new one before you run Configure -- this will help you with most of
+the policy defaults.
+
+EOM
+fi
+
$rm -f kit*isdone ark*isdone
$rm -rf UU
diff --git a/MANIFEST b/MANIFEST
index 71532764a7..80bae3eee1 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4,7 +4,6 @@ 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.gnu Crude emulation of GNU configure
Configure Portability tool
Copying The GNU General Public License
EXTERN.h Included before foreign .h files
@@ -12,9 +11,10 @@ INSTALL Detailed installation instructions
INTERN.h Included before domestic .h files
MANIFEST This list of files
Makefile.SH A script that generates Makefile
+Policy_sh.SH Hold site-wide preferences between Configure runs.
Porting/Glossary Glossary of config.sh variables
-Porting/config_H Sample config.h
Porting/config.sh Sample config.sh
+Porting/config_H Sample config.h
Porting/makerel Release making utility
Porting/patchls Flexible patch file listing utility
Porting/pumpkin.pod Guidelines and hints for Perl maintainers
@@ -31,6 +31,7 @@ README.win32 Notes about Win32 port
Todo The Wishlist
Todo.5.005 What needs doing before 5.005 release
XSUB.h Include file for extension subroutines
+atomic.h Atomic refcount handling for multi-threading
av.c Array value code
av.h Array value header
bytecode.h Bytecode header for compiler
@@ -42,6 +43,7 @@ cflags.SH A script that emits C compilation flags per file
compat3.sym List of symbols for binary-compatibility with 5.003
config_h.SH Produces config.h
configpm Produces lib/Config.pm
+configure.gnu Crude emulation of GNU configure
cop.h Control operator header
cv.h Code value header
cygwin32/cw32imp.h Cygwin32 port
@@ -261,11 +263,11 @@ 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.pm Thread extension Perl module
+ext/Thread/Thread.xs Thread extension external subroutines
ext/Thread/Thread/Queue.pm Thread synchronised queue objects
ext/Thread/Thread/Semaphore.pm Thread semaphore objects
ext/Thread/Thread/Specific.pm Thread specific data access
-ext/Thread/Thread.pm Thread extension Perl module
-ext/Thread/Thread.xs Thread extension external subroutines
ext/Thread/create.t Test thread creation
ext/Thread/die.t Test thread die()
ext/Thread/die2.t Test thread die() differently
@@ -472,6 +474,7 @@ lib/Text/Soundex.pm Perl module to implement Soundex
lib/Text/Tabs.pm Do expand and unexpand
lib/Text/Wrap.pm Paragraph formatter
lib/Tie/Array.pm Base class for tied arrays
+lib/Tie/Handle.pm Base class for tied handles
lib/Tie/Hash.pm Base class for tied hashes
lib/Tie/RefHash.pm Base class for tied hashes with references as keys
lib/Tie/Scalar.pm Base class for tied scalars
@@ -588,10 +591,10 @@ os2/diff.configure Patches to Configure
os2/dl_os2.c Addon for dl_open
os2/dlfcn.h Addon for dl_open
os2/os2.c Additional code for OS/2
+os2/os2.sym Additional symbols to export
os2/os2ish.h Header for OS/2
-os2/perl2cmd.pl Corrects installed binaries under OS/2
os2/os2thread.h pthread-like typedefs
-os2/os2.sym Additional symbols to export
+os2/perl2cmd.pl Corrects installed binaries under OS/2
patchlevel.h The current patch level of perl
perl.c main()
perl.h Global declarations
@@ -859,6 +862,7 @@ t/op/sysio.t See if sysread and syswrite work
t/op/taint.t See if tainting works
t/op/tie.t See if tie/untie functions work
t/op/tiearray.t See if tie for arrays works
+t/op/tiehandle.t See if tie for handles works
t/op/time.t See if time functions work
t/op/undef.t See if undef works
t/op/universal.t See if UNIVERSAL class works
@@ -964,8 +968,8 @@ win32/win32.c Win32 port
win32/win32.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
+win32/win32thread.h Win32 port mapping to 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/Makefile.SH b/Makefile.SH
index cea0c240f0..ebbdbe97cc 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -448,10 +448,10 @@ s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
clean: _tidy _mopup
realclean: _cleaner _mopup
- @echo "Note that make realclean does not delete config.sh"
+ @echo "Note that make realclean does not delete config.sh or Policy.sh"
clobber: _cleaner _mopup
- rm -f config.sh cppstdin
+ rm -f config.sh cppstdin Policy.sh
distclean: clobber
diff --git a/Policy_sh.SH b/Policy_sh.SH
new file mode 100644
index 0000000000..831585422a
--- /dev/null
+++ b/Policy_sh.SH
@@ -0,0 +1,77 @@
+case $CONFIG in
+'') . ./config.sh ;;
+esac
+echo "Extracting Policy.sh (with variable substitutions)"
+$spitshell <<!GROK!THIS! >Policy.sh
+$startsh
+#
+# This file was produced by running the Policy_sh.SH script, which
+# gets its values from config.sh, which is generally produced by
+# running Configure.
+#
+# The idea here is to distill in one place the common site-wide
+# "policy" answers (such as installation directories) that are
+# to be "sticky". That is, if you keep the file Policy.sh around in
+# the same directory as you are building Perl, then Configure will
+# (by default) load up the Policy.sh file just before the
+# platform-specific hints file.
+#
+
+#Credits:
+# The original design for this Policy.sh file came from Wayne Davison,
+# maintainer of trn.
+# This version for Perl5.004_61 originally written by
+# Andy Dougherty <doughera@lafcol.lafayette.edu>.
+# This file may be distributed under the same terms as Perl itself.
+
+
+# Site-specific values
+
+perladmin='$perladmin'
+
+# Installation directives. Note that each one comes in three flavors.
+# For example, we have privlib, privlibexp, and installprivlib.
+# privlib is for private (to perl) library files.
+# privlibexp is the same, expcept any '~' the user gave to Configure
+# is expanded to the user's home directory. This is figured
+# out automatically by Configure, so you don't have to include it here.
+# installprivlib is for systems (such as those running AFS) that
+# need to distinguish between the place where things
+# get installed and where they finally will reside.
+# A full Glossary of all these config.sh variables is in the
+# Porting/Glossary file.
+
+# Installation Prefix.
+prefix='$prefix'
+
+bin='$bin'
+installbin='$installbin'
+
+scriptdir='$scriptdir'
+installscript='$installscript'
+
+privlib='$privlib'
+installprivlib='$installprivlib'
+
+archlib='$archlib'
+installarchlib='$installarchlib'
+
+sitearch='$sitearch'
+installsitearch='$installsitearch'
+
+sitelib='$sitelib'
+installsitelib='$installsitelib'
+
+# man1 and man3 manpage directories and extensions.
+man1dir='$man1dir'
+man1ext='$man1ext'
+installman1dir='$installman1dir'
+man3dir='$man3dir'
+man3ext='$man3ext'
+installman3dir='$installman3dir'
+
+# You may add additional items here, for example, to set the pager
+# to your local favorite value, uncomment
+# #pager='$pager'
+
+!GROK!THIS!
diff --git a/atomic.h b/atomic.h
new file mode 100644
index 0000000000..714bf23a6a
--- /dev/null
+++ b/atomic.h
@@ -0,0 +1,85 @@
+#ifdef __GNUC__
+
+/*
+ * These atomic operations copied from the linux kernel and altered
+ * only slightly. I need to get official permission to distribute
+ * under the Artistic License.
+ */
+/* We really need to integrate the atomic typedef with the typedef
+ * used by sv_refcnt of an SV. It's possible that for CPUs like alpha
+ * where we'd need to up sv_refcnt from 32 to 64 bits, we may be better
+ * off sticking with EMULATE_ATOMIC_REFCOUNTS instead.
+ */
+typedef U32 atomic_t; /* kludge */
+
+#ifdef i386
+
+# ifdef NO_SMP
+# define LOCK ""
+# else
+# define LOCK "lock ; "
+# endif
+
+# define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x)
+static __inline__ void atomic_inc(atomic_t *v)
+{
+ __asm__ __volatile__(
+ LOCK "incl %0"
+ :"=m" (__atomic_fool_gcc(v))
+ :"m" (__atomic_fool_gcc(v)));
+}
+
+static __inline__ int atomic_dec_and_test(atomic_t *v)
+{
+ unsigned char c;
+
+ __asm__ __volatile__(
+ LOCK "decl %0; sete %1"
+ :"=m" (__atomic_fool_gcc(v)), "=qm" (c)
+ :"m" (__atomic_fool_gcc(v)));
+ return c != 0;
+}
+# else
+/* XXX What symbol does gcc define for sparc64? */
+# ifdef sparc64
+# define __atomic_fool_gcc(x) ((struct { int a[100]; } *)x)
+typedef U32 atomic_t;
+extern __inline__ void atomic_add(int i, atomic_t *v)
+{
+ __asm__ __volatile__("
+1: lduw [%1], %%g5
+ add %%g5, %0, %%g7
+ cas [%1], %%g5, %%g7
+ sub %%g5, %%g7, %%g5
+ brnz,pn %%g5, 1b
+ nop"
+ : /* No outputs */
+ : "HIr" (i), "r" (__atomic_fool_gcc(v))
+ : "g5", "g7", "memory");
+}
+
+extern __inline__ int atomic_sub_return(int i, atomic_t *v)
+{
+ unsigned long oldval;
+ __asm__ __volatile__("
+1: lduw [%2], %%g5
+ sub %%g5, %1, %%g7
+ cas [%2], %%g5, %%g7
+ sub %%g5, %%g7, %%g5
+ brnz,pn %%g5, 1b
+ sub %%g7, %1, %0"
+ : "=&r" (oldval)
+ : "HIr" (i), "r" (__atomic_fool_gcc(v))
+ : "g5", "g7", "memory");
+ return (int)oldval;
+}
+
+#define atomic_inc(v) atomic_add(1,(v))
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+/* Add further gcc architectures here */
+# endif /* sparc64 */
+#endif /* i386 */
+#else
+/* Add non-gcc native atomic operations here */
+# define EMULATE_ATOMIC_REFCOUNTS
+#endif
diff --git a/bytecode.h b/bytecode.h
index 7ca7ffd3ac..f605e27e55 100644
--- a/bytecode.h
+++ b/bytecode.h
@@ -19,17 +19,21 @@ EXT void **obj_list;
EXT I32 obj_list_fill INIT(-1);
#ifdef INDIRECT_BGET_MACROS
-#define FREAD(argp, len, nelem) bs.fread((char*)(argp),(len),(nelem),bs.data)
-#define FGETC() bs.fgetc(bs.data)
+#define BGET_FREAD(argp, len, nelem) \
+ bs.fread((char*)(argp),(len),(nelem),bs.data)
+#define BGET_FGETC() bs.fgetc(bs.data)
#else
-#define FREAD(argp, len, nelem) fread((argp), (len), (nelem), fp)
-#define FGETC() getc(fp)
+#define BGET_FREAD(argp, len, nelem) fread((argp), (len), (nelem), fp)
+#define BGET_FGETC() getc(fp)
#endif /* INDIRECT_BGET_MACROS */
-#define BGET_U32(arg) FREAD(&arg, sizeof(U32), 1); arg = ntohl((U32)arg)
-#define BGET_I32(arg) FREAD(&arg, sizeof(I32), 1); arg = (I32)ntohl((U32)arg)
-#define BGET_U16(arg) FREAD(&arg, sizeof(U16), 1); arg = ntohs((U16)arg)
-#define BGET_U8(arg) arg = FGETC()
+#define BGET_U32(arg) \
+ BGET_FREAD(&arg, sizeof(U32), 1); arg = ntohl((U32)arg)
+#define BGET_I32(arg) \
+ BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)ntohl((U32)arg)
+#define BGET_U16(arg) \
+ BGET_FREAD(&arg, sizeof(U16), 1); arg = ntohs((U16)arg)
+#define BGET_U8(arg) arg = BGET_FGETC()
#if INDIRECT_BGET_MACROS
#define BGET_PV(arg) do { \
@@ -59,7 +63,7 @@ EXT I32 obj_list_fill INIT(-1);
#endif /* INDIRECT_BGET_MACROS */
#define BGET_comment(arg) \
- do { arg = FGETC(); } while (arg != '\n' && arg != EOF)
+ do { arg = BGET_FGETC(); } while (arg != '\n' && arg != EOF)
/*
* In the following, sizeof(IV)*4 is just a way of encoding 32 on 64-bit-IV
@@ -86,7 +90,7 @@ EXT I32 obj_list_fill INIT(-1);
unsigned short *ary; \
int i; \
New(666, ary, 256, unsigned short); \
- FREAD(ary, 256, 2); \
+ BGET_FREAD(ary, 256, 2); \
for (i = 0; i < 256; i++) \
ary[i] = ntohs(ary[i]); \
arg = (char *) ary; \
@@ -94,7 +98,7 @@ EXT I32 obj_list_fill INIT(-1);
#define BGET_pvcontents(arg) arg = pv.xpv_pv
#define BGET_strconst(arg) do { \
- for (arg = tokenbuf; (*arg = FGETC()); arg++) /* nothing */; \
+ for (arg = tokenbuf; (*arg = BGET_FGETC()); arg++) /* nothing */; \
arg = tokenbuf; \
} while (0)
diff --git a/bytecode.pl b/bytecode.pl
index c545f4136d..4553edf9bc 100644
--- a/bytecode.pl
+++ b/bytecode.pl
@@ -88,7 +88,7 @@ void byterun(FILE *fp)
{
dTHR;
int insn;
- while ((insn = FGETC()) != EOF) {
+ while ((insn = BGET_FGETC()) != EOF) {
switch (insn) {
EOT
diff --git a/byterun.c b/byterun.c
index 57c662009a..7c32930a6a 100644
--- a/byterun.c
+++ b/byterun.c
@@ -34,7 +34,7 @@ void byterun(FILE *fp)
{
dTHR;
int insn;
- while ((insn = FGETC()) != EOF) {
+ while ((insn = BGET_FGETC()) != EOF) {
switch (insn) {
case INSN_COMMENT: /* 35 */
{
diff --git a/ext/SDBM_File/Makefile.PL b/ext/SDBM_File/Makefile.PL
index 02dfd7d84f..c0daa064c7 100644
--- a/ext/SDBM_File/Makefile.PL
+++ b/ext/SDBM_File/Makefile.PL
@@ -6,21 +6,37 @@ use ExtUtils::MakeMaker;
# which perform the corresponding actions in the subdirectory.
$define = ($^O eq 'MSWin32') ? '-DMSDOS' : '';
+if ($^O eq 'MSWin32') {
+ $myextlib = 'sdbm\\libsdbm$(LIB_EXT)';
+} elsif ($^O eq 'VMS') {
+ $myextlib = 'sdbm/libsdbm$(LIB_EXT)';
+} else {
+ $myextlib = 'sdbm/libsdbm$(LIB_EXT)';
+}
WriteMakefile(
- NAME => 'SDBM_File',
- MYEXTLIB => 'sdbm'.($^O eq 'MSWin32' ? '\\' : '/').'libsdbm$(LIB_EXT)',
- MAN3PODS => ' ', # Pods will be built by installman.
- XSPROTOARG => '-noprototypes', # XXX remove later?
- VERSION_FROM => 'SDBM_File.pm',
- DEFINE => $define,
-);
-
+ NAME => 'SDBM_File',
+ MYEXTLIB => $myextlib,
+ MAN3PODS => ' ', # Pods will be built by installman.
+ XSPROTOARG => '-noprototypes', # XXX remove later?
+ VERSION_FROM => 'SDBM_File.pm',
+ DEFINE => $define,
+# NORECURS => $^O eq 'VMS',
+# SKIP => $^O eq 'VMS' ? 'subdirs' : '', # Don't do the subdirs section for VMS
+ );
sub MY::postamble {
+ if ($^O ne 'VMS') {
'
$(MYEXTLIB): sdbm/Makefile
cd sdbm && $(MAKE) all
';
+ } else {
+ '
+$(MYEXTLIB): [.sdbm]descrip.mms
+ set def [.sdbm]
+ $(MMS) all
+ set def [-]
+';
+ }
}
-
diff --git a/ext/SDBM_File/sdbm/Makefile.PL b/ext/SDBM_File/sdbm/Makefile.PL
index 50fd83eb25..e9d4dcd0fa 100644
--- a/ext/SDBM_File/sdbm/Makefile.PL
+++ b/ext/SDBM_File/sdbm/Makefile.PL
@@ -5,11 +5,11 @@ $define .= ' -DWIN32' if ($^O eq 'MSWin32');
WriteMakefile(
NAME => 'sdbm', # (doesn't matter what the name is here) oh yes it does
- LINKTYPE => 'static',
+# LINKTYPE => 'static',
DEFINE => $define,
INC => '-I$(PERL_INC)', # force PERL_INC dir ahead of system -I's
SKIP => [qw(dynamic dynamic_lib)],
- OBJECT => '$(O_FILES)',
+ OBJECT => ($^O eq 'VMS') ? 'sdbm.obj pair.obj hash.obj' : '$(O_FILES)',
clean => {'FILES' => 'dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag'},
H => [qw(tune.h sdbm.h pair.h $(PERL_INC)/config.h)],
C => [qw(sdbm.c pair.c hash.c)]
diff --git a/ext/SDBM_File/sdbm/sdbm.h b/ext/SDBM_File/sdbm/sdbm.h
index ac2dc36b01..b3ed2d4b8b 100644
--- a/ext/SDBM_File/sdbm/sdbm.h
+++ b/ext/SDBM_File/sdbm/sdbm.h
@@ -9,7 +9,11 @@
#define PAIRMAX 1008 /* arbitrary on PBLKSIZ-N */
#define SPLTMAX 10 /* maximum allowed splits */
/* for a single insertion */
+#ifdef VMS
+#define DIRFEXT ".sdbm_dir"
+#else
#define DIRFEXT ".dir"
+#endif
#define PAGFEXT ".pag"
typedef struct {
@@ -116,11 +120,15 @@ extern long sdbm_hash proto((char *, int));
#include <ctype.h>
#include <setjmp.h>
-#ifdef I_UNISTD
+#if defined(I_UNISTD) || defined(VMS)
#include <unistd.h>
#endif
-#if !defined(MSDOS) && !defined(WIN32)
+#ifdef VMS
+# include <fcntl.h>
+#endif
+
+#if !defined(MSDOS) && !defined(WIN32) && !defined(VMS)
# ifdef PARAM_NEEDS_TYPES
# include <sys/types.h>
# endif
@@ -237,7 +245,7 @@ extern long sdbm_hash proto((char *, int));
# endif
#else
# ifndef memcmp
-# /* maybe we should have included the full embedding header... */
+ /* maybe we should have included the full embedding header... */
# ifdef NO_EMBED
# define memcmp my_memcmp
# else
@@ -264,7 +272,11 @@ extern long sdbm_hash proto((char *, int));
#endif
#ifdef I_NETINET_IN
-# include <netinet/in.h>
+# ifdef VMS
+# include <in.h>
+# else
+# include <netinet/in.h>
+# endif
#endif
#endif /* Include guard */
diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm
index dc3b4ceca6..954f6123d5 100644
--- a/lib/ExtUtils/MM_VMS.pm
+++ b/lib/ExtUtils/MM_VMS.pm
@@ -1422,7 +1422,21 @@ $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
push(@m,'
If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
+');
+ # if there was a library to copy, then we can't use MMS$SOURCE_LIST,
+ # 'cause it's a library and you can't stick them in other libraries.
+ # In that case, we use $OBJECT instead and hope for the best
+ if ($self->{MYEXTLIB}) {
+ push(@m,'
+ Library/Object/Replace $(MMS$TARGET) $(OBJECT)
+');
+ } else {
+ push(@m,'
Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
+');
+ }
+
+ push(@m, '
$(NOECHO) $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq{$(EXTRALIBS)\n};close F;"
');
push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
diff --git a/lib/Tie/Handle.pm b/lib/Tie/Handle.pm
new file mode 100644
index 0000000000..c7550530b8
--- /dev/null
+++ b/lib/Tie/Handle.pm
@@ -0,0 +1,161 @@
+package Tie::Handle;
+
+=head1 NAME
+
+Tie::Handle - base class definitions for tied handles
+
+=head1 SYNOPSIS
+
+ package NewHandle;
+ require Tie::Handle;
+
+ @ISA = (Tie::Handle);
+
+ sub READ { ... } # Provide a needed method
+ sub TIEHANDLE { ... } # Overrides inherited method
+
+
+ package main;
+
+ tie *FH, 'NewHandle';
+
+=head1 DESCRIPTION
+
+This module provides some skeletal methods for handle-tying classes. See
+L<perltie> for a list of the functions required in tying a handle to a package.
+The basic B<Tie::Handle> package provides a C<new> method, as well as methods
+C<TIESCALAR>, C<FETCH> and C<STORE>. The C<new> method is provided as a means
+of grandfathering, for classes that forget to provide their own C<TIESCALAR>
+method.
+
+For developers wishing to write their own tied-handle classes, the methods
+are summarized below. The L<perltie> section not only documents these, but
+has sample code as well:
+
+=over
+
+=item TIEHANDLE classname, LIST
+
+The method invoked by the command C<tie *glob, classname>. Associates a new
+glob instance with the specified class. C<LIST> would represent additional
+arguments (along the lines of L<AnyDBM_File> and compatriots) needed to
+complete the association.
+
+=item WRITE this, scalar, length, offset
+
+Write I<length> bytes of data from I<scalar> starting at I<offset>.
+
+=item PRINT this, LIST
+
+Print the values in I<LIST>
+
+=item PRINTF this, format, LIST
+
+Print the values in I<LIST> using I<format>
+
+=item READ this, scalar, length, offset
+
+Read I<length> bytes of data into I<scalar> starting at I<offset>.
+
+=item READLINE this
+
+Read a single line
+
+=item GETC this
+
+Get a single character
+
+=item DESTROY this
+
+Free the storage associated with the tied handle referenced by I<this>.
+This is rarely needed, as Perl manages its memory quite well. But the
+option exists, should a class wish to perform specific actions upon the
+destruction of an instance.
+
+=back
+
+=head1 MORE INFORMATION
+
+The L<perltie> section contains an example of tying handles.
+
+=cut
+
+use Carp;
+
+sub new {
+ my $pkg = shift;
+ $pkg->TIEHANDLE(@_);
+}
+
+# "Grandfather" the new, a la Tie::Hash
+
+sub TIEHANDLE {
+ my $pkg = shift;
+ if (defined &{"{$pkg}::new"}) {
+ carp "WARNING: calling ${pkg}->new since ${pkg}->TIEHANDLE is missing"
+ if $^W;
+ $pkg->new(@_);
+ }
+ else {
+ croak "$pkg doesn't define a TIEHANDLE method";
+ }
+}
+
+sub PRINT {
+ my $self = shift;
+ if($self->can('WRITE') != \&WRITE) {
+ my $buf = join(defined $, ? $, : "",@_);
+ $buf .= $\ if defined $\;
+ $self->WRITE($buf,length($buf),0);
+ }
+ else {
+ croak ref($self)," doesn't define a PRINT method";
+ }
+}
+
+sub PRINTF {
+ my $self = shift;
+
+ if($self->can('WRITE') != \&WRITE) {
+ my $buf = sprintf(@_);
+ $self->WRITE($buf,length($buf),0);
+ }
+ else {
+ croak ref($self)," doesn't define a PRINTF method";
+ }
+}
+
+sub READLINE {
+ my $pkg = ref $_[0];
+ croak "$pkg doesn't define a READLINE method";
+}
+
+sub GETC {
+ my $self = shift;
+
+ if($self->can('READ') != \&READ) {
+ my $buf;
+ $self->READ($buf,1);
+ return $buf;
+ }
+ else {
+ croak ref($self)," doesn't define a GETC method";
+ }
+}
+
+sub READ {
+ my $pkg = ref $_[0];
+ croak "$pkg doesn't define a READ method";
+}
+
+sub WRITE {
+ my $pkg = ref $_[0];
+ croak "$pkg doesn't define a WRITE method";
+}
+
+sub CLOSE {
+ my $pkg = ref $_[0];
+ croak "$pkg doesn't define a CLOSE method";
+}
+
+1;
diff --git a/os2/diff.configure b/os2/diff.configure
index 9f42dc139f..7bdfa6f585 100644
--- a/os2/diff.configure
+++ b/os2/diff.configure
@@ -1,6 +1,6 @@
---- Configure.orig Fri Aug 1 23:12:26 1997
-+++ Configure Fri Aug 1 23:20:24 1997
-@@ -1489,7 +1489,7 @@
+--- Configure Wed Feb 25 16:52:55 1998
++++ Configure.os2 Wed Feb 25 16:52:58 1998
+@@ -1602,7 +1602,7 @@
*)
echo "I don't know where '$file' is, and my life depends on it." >&4
echo "Go find a public domain implementation or fix your PATH setting!" >&4
@@ -9,18 +9,7 @@
;;
esac
done
-@@ -1498,7 +1498,9 @@
- say=offhand
- for file in $trylist; do
- xxx=`./loc $file $file $pth`
-- eval $file=$xxx
-+ if test "X$file" != "X$xxx" ; then
-+ eval $file=$xxx
-+ fi
- eval _$file=$xxx
- case "$xxx" in
- /*)
-@@ -3198,7 +3200,7 @@
+@@ -3637,7 +3637,7 @@
exit(0);
}
EOM
@@ -29,20 +18,7 @@
gccversion=`./gccvers`
case "$gccversion" in
'') echo "You are not using GNU cc." ;;
-@@ -3401,6 +3403,12 @@
- *"-l$thislib "*);;
- *) dflt="$dflt -l$thislib";;
- esac
-+ elif xxx=`./loc $thislib.lib X $libpth`; $test -f "$xxx"; then
-+ echo "Found -l$thislib."
-+ case " $dflt " in
-+ *"-l$thislib "*);;
-+ *) dflt="$dflt -l$thislib";;
-+ esac
- else
- echo "No -l$thislib."
- fi
-@@ -3950,7 +3958,7 @@
+@@ -4434,7 +4434,7 @@
esac
;;
esac
@@ -51,219 +27,7 @@
case "$libs" in
'') ;;
*) for thislib in $libs; do
-@@ -3972,6 +3980,8 @@
- :
- elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
- :
-+ elif try=`./loc $thislib$lib_ext X $libpth`; $test -f "$try"; then
-+ :
- elif try=`./loc Slib$thislib$lib_ext X $xlibpth`; $test -f "$try"; then
- :
- else
-@@ -4156,6 +4166,10 @@
- eval $xscan;\
- $contains '^fprintf$' libc.list >/dev/null 2>&1; then
- eval $xrun
-+elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
-+ eval $xscan;\
-+ $contains '^fprintf$' libc.list >/dev/null 2>&1; then
-+ eval $xrun
- else
- nm -p $* 2>/dev/null >libc.tmp
- $grep fprintf libc.tmp > libc.ptf
-@@ -4166,23 +4180,33 @@
- eval $xrun
- else
- echo " "
-- echo "nm didn't seem to work right. Trying ar instead..." >&4
-+ echo "nm didn't seem to work right. Trying $ar instead..." >&4
- com=''
-- if ar t $libc > libc.tmp; then
-- for thisname in $libnames; do
-- ar t $thisname >>libc.tmp
-+ if test "X$osname" = "Xos2"; then ar_opt=tv ; else ar_opt=t ;fi
-+ if $ar $ar_opt $libc > libc.tmp; then
-+ echo \; > libc.tmp
-+ for thisname in $libnames $libc; do
-+ $ar $ar_opt $thisname >>libc.tmp
-+ if test "X$osname" = "Xos2"; then
-+ # Revision 50 of EMX has bug in $ar:
-+ emximp -o tmp.imp $thisname \
-+ 2>/dev/null && \
-+ $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
-+ < tmp.imp >>libc.tmp
-+ $rm tmp.imp
-+ fi
- done
-- $sed -e 's/\.o$//' < libc.tmp > libc.list
-+ $sed -e 's/\.o$//' -e 's/^ \+//' < libc.tmp | grep -v "^IMPORT#" > libc.list
- echo "Ok." >&4
- else
-- echo "ar didn't seem to work right." >&4
-+ echo "$ar didn't seem to work right." >&4
- echo "Maybe this is a Cray...trying bld instead..." >&4
- if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list
- then
- for thisname in $libnames; do
- bld t $libnames | \
- $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
-- ar t $thisname >>libc.tmp
-+ $ar t $thisname >>libc.tmp
- done
- echo "Ok." >&4
- else
-@@ -5611,15 +5635,15 @@
- EOCP
- : check sys/file.h first, no particular reason here
- if $test `./findhdr sys/file.h` && \
-- $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
-+ $cc $ldflags $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
- h_sysfile=true;
- echo "<sys/file.h> defines the *_OK access constants." >&4
- elif $test `./findhdr fcntl.h` && \
-- $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
-+ $cc $ldflags $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
- h_fcntl=true;
- echo "<fcntl.h> defines the *_OK access constants." >&4
- elif $test `./findhdr unistd.h` && \
-- $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
-+ $cc $ldflags $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
- echo "<unistd.h> defines the *_OK access constants." >&4
- else
- echo "I can't find the four *_OK access constants--I'll use mine." >&4
-@@ -5913,7 +5937,7 @@
- exit(result);
- }
- EOCP
--if $cc -o try $ccflags try.c >/dev/null 2>&1; then
-+if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then
- ./try
- yyy=$?
- else
-@@ -5994,7 +6018,7 @@
-
- }
- EOCP
--if $cc -o try $ccflags try.c >/dev/null 2>&1; then
-+if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then
- ./try
- castflags=$?
- else
-@@ -6033,7 +6057,7 @@
- exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
- }
- EOF
-- if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
-+ if $cc $ccflags vprintf.c $ldflags -o vprintf >/dev/null 2>&1 && ./vprintf; then
- echo "Your vsprintf() returns (int)." >&4
- val2="$undef"
- else
-@@ -6381,7 +6405,7 @@
- EOCP
- : check sys/file.h first to get FREAD on Sun
- if $test `./findhdr sys/file.h` && \
-- $cc $ccflags "-DI_SYS_FILE" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
-+ $cc $ldflags $ccflags "-DI_SYS_FILE" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
- h_sysfile=true;
- echo "<sys/file.h> defines the O_* constants..." >&4
- if ./open3; then
-@@ -6392,7 +6416,7 @@
- val="$undef"
- fi
- elif $test `./findhdr fcntl.h` && \
-- $cc $ccflags "-DI_FCNTL" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
-+ $cc $ldflags $ccflags "-DI_FCNTL" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
- h_fcntl=true;
- echo "<fcntl.h> defines the O_* constants..." >&4
- if ./open3; then
-@@ -6898,7 +6922,7 @@
- y*|true)
- usemymalloc='y'
- mallocsrc='malloc.c'
-- mallocobj='malloc.o'
-+ mallocobj="malloc$obj_ext"
- d_mymalloc="$define"
- case "$libs" in
- *-lmalloc*)
-@@ -8156,7 +8180,7 @@
- printf("%d\n", (char *)&try.bar - (char *)&try.foo);
- }
- EOCP
-- if $cc $ccflags try.c -o try >/dev/null 2>&1; then
-+ if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
- dflt=`./try`
- else
- dflt='8'
-@@ -8204,7 +8228,7 @@
- }
- EOCP
- xxx_prompt=y
-- if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
-+ if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
- dflt=`./try`
- case "$dflt" in
- [1-4][1-4][1-4][1-4]|12345678|87654321)
-@@ -8711,18 +8735,18 @@
- $cc $ccflags -c bar1.c >/dev/null 2>&1
- $cc $ccflags -c bar2.c >/dev/null 2>&1
- $cc $ccflags -c foo.c >/dev/null 2>&1
--ar rc bar$lib_ext bar2.o bar1.o >/dev/null 2>&1
-+$ar rc bar$lib_ext bar2.o bar1.o >/dev/null 2>&1
- if $cc $ccflags $ldflags -o foobar foo.o bar$lib_ext $libs > /dev/null 2>&1 &&
- ./foobar >/dev/null 2>&1; then
-- echo "ar appears to generate random libraries itself."
-+ echo "$ar appears to generate random libraries itself."
- orderlib=false
- ranlib=":"
--elif ar ts bar$lib_ext >/dev/null 2>&1 &&
-+elif $ar ts bar$lib_ext >/dev/null 2>&1 &&
- $cc $ccflags $ldflags -o foobar foo.o bar$lib_ext $libs > /dev/null 2>&1 &&
- ./foobar >/dev/null 2>&1; then
-- echo "a table of contents needs to be added with 'ar ts'."
-+ echo "a table of contents needs to be added with '$ar ts'."
- orderlib=false
-- ranlib="ar ts"
-+ ranlib="$ar ts"
- else
- case "$ranlib" in
- :) ranlib='';;
-@@ -8794,7 +8818,7 @@
- '') $echo $n ".$c"
- if $cc $ccflags \
- $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
-- try.c -o try >/dev/null 2>&1 ; then
-+ try.c -o try $ldflags >/dev/null 2>&1 ; then
- set X $i_time $i_systime $i_systimek $sysselect $s_timeval
- shift
- flags="$*"
-@@ -8863,7 +8887,7 @@
- #endif
- }
- EOCP
--if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
-+if $cc $ccflags $ldflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
- d_fds_bits="$define"
- d_fd_set="$define"
- echo "Well, your system knows about the normal fd_set typedef..." >&4
-@@ -8880,7 +8904,7 @@
- $cat <<'EOM'
- Hmm, your compiler has some difficulty with fd_set. Checking further...
- EOM
-- if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
-+ if $cc $ccflags $ldflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
- d_fds_bits="$undef"
- d_fd_set="$define"
- echo "Well, your system has some sort of fd_set available..." >&4
-@@ -9627,7 +9651,7 @@
- else
- echo "false"
- fi
--$rm -f varargs.o
-+$rm -f varargs$obj_ext
- EOP
- chmod +x varargs
-
-@@ -9954,7 +9978,7 @@
+@@ -10392,7 +10392,7 @@
echo " "
echo "Stripping down executable paths..." >&4
for file in $loclist $trylist; do
diff --git a/os2/os2.c b/os2/os2.c
index fe7f99bb7e..f24c3af5ce 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -620,8 +620,6 @@ char *mode;
PerlIO *res;
SV *sv;
- if (pipe(p) < 0)
- return Nullfp;
/* `this' is what we use in the parent, `that' in the child. */
this = (*mode == 'w');
that = !this;
@@ -629,6 +627,8 @@ char *mode;
taint_env();
taint_proper("Insecure %s%s", "EXEC");
}
+ if (pipe(p) < 0)
+ return Nullfp;
/* Now we need to spawn the child. */
newfd = dup(*mode == 'r'); /* Preserve std* */
if (p[that] != (*mode == 'r')) {
diff --git a/perl.c b/perl.c
index 0c525579af..6d222cecae 100644
--- a/perl.c
+++ b/perl.c
@@ -130,6 +130,9 @@ perl_construct(register PerlInterpreter *sv_interp)
COND_INIT(&eval_cond);
MUTEX_INIT(&threads_mutex);
COND_INIT(&nthreads_cond);
+#ifdef EMULATE_ATOMIC_REFCOUNTS
+ MUTEX_INIT(&svref_mutex);
+#endif /* EMULATE_ATOMIC_REFCOUNTS */
thr = init_main_thread();
#endif /* USE_THREADS */
diff --git a/perlvars.h b/perlvars.h
index 8a72312e57..69206a5d7a 100644
--- a/perlvars.h
+++ b/perlvars.h
@@ -19,6 +19,7 @@ PERLVAR(Geval_owner, struct perl_thread *) /* Owner thread for doeval */
PERLVAR(Gnthreads, int) /* Number of threads currently */
PERLVAR(Gthreads_mutex, perl_mutex) /* Mutex for nthreads and thread list */
PERLVAR(Gnthreads_cond, perl_cond) /* Condition variable for nthreads */
+PERLVAR(Gsvref_mutex, perl_mutex) /* Mutex for SvREFCNT_{inc,dec} */
PERLVARI(Gthreadsv_names, char *, THREADSV_NAMES)
#ifdef FAKE_THREADS
PERLVAR(Gcurthr, struct perl_thread *) /* Currently executing (fake) thread */
diff --git a/pod/perltie.pod b/pod/perltie.pod
index 79a749e68a..398c3a0d29 100644
--- a/pod/perltie.pod
+++ b/pod/perltie.pod
@@ -620,8 +620,8 @@ use the each() function to iterate over such. Example:
This is partially implemented now.
A class implementing a tied filehandle should define the following
-methods: TIEHANDLE, at least one of PRINT, PRINTF, READLINE, GETC, or READ,
-and possibly DESTROY.
+methods: TIEHANDLE, at least one of PRINT, PRINTF, WRITE, READLINE, GETC,
+READ, and possibly CLOSE and DESTROY.
It is especially useful when perl is embedded in some other program,
where output to STDOUT and STDERR may have to be redirected in some
@@ -641,6 +641,17 @@ hold some internal information.
sub TIEHANDLE { print "<shout>\n"; my $i; bless \$i, shift }
+=item WRITE this, LIST
+
+This method will be called when the handle is written to via the
+C<syswrite> function.
+
+ sub WRITE {
+ $r = shift;
+ my($buf,$len,$offset) = @_;
+ print "WRITE called, \$buf=$buf, \$len=$len, \$offset=$offset";
+ }
+
=item PRINT this, LIST
This method will be triggered every time the tied handle is printed to
@@ -663,7 +674,7 @@ passed to the printf function.
print sprintf($fmt, @_)."\n";
}
-=item READ this LIST
+=item READ this, LIST
This method will be called when the handle is read from via the C<read>
or C<sysread> functions.
@@ -687,6 +698,13 @@ This method will be called when the C<getc> function is called.
sub GETC { print "Don't GETC, Get Perl"; return "a"; }
+=item CLOSE this
+
+This method will be called when the handle is closed via the C<close>
+function.
+
+ sub CLOSE { print "CLOSE called.\n" }
+
=item DESTROY this
As with the other types of ties, this method will be called when the
diff --git a/pp_sys.c b/pp_sys.c
index f90299289a..c273c8c5b2 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -356,11 +356,23 @@ PP(pp_close)
{
djSP;
GV *gv;
+ MAGIC *mg;
if (MAXARG == 0)
gv = defoutgv;
else
gv = (GV*)POPs;
+
+ if (SvRMAGICAL(gv) && (mg = mg_find((SV*)gv, 'q'))) {
+ PUSHMARK(SP);
+ XPUSHs(mg->mg_obj);
+ PUTBACK;
+ ENTER;
+ perl_call_method("CLOSE", G_SCALAR);
+ LEAVE;
+ SPAGAIN;
+ RETURN;
+ }
EXTEND(SP, 1);
PUSHs(boolSV(do_close(gv, TRUE)));
RETURN;
@@ -1319,8 +1331,25 @@ PP(pp_send)
char *buffer;
int length;
STRLEN blen;
+ MAGIC *mg;
gv = (GV*)*++MARK;
+ if (op->op_type == OP_SYSWRITE &&
+ SvRMAGICAL(gv) && (mg = mg_find((SV*)gv, 'q')))
+ {
+ SV *sv;
+
+ PUSHMARK(MARK-1);
+ *MARK = mg->mg_obj;
+ ENTER;
+ perl_call_method("WRITE", G_SCALAR);
+ LEAVE;
+ SPAGAIN;
+ sv = POPs;
+ SP = ORIGMARK;
+ PUSHs(sv);
+ RETURN;
+ }
if (!gv)
goto say_undef;
bufsv = *++MARK;
diff --git a/sv.c b/sv.c
index ab9ec14eff..8bb6c14740 100644
--- a/sv.c
+++ b/sv.c
@@ -2870,13 +2870,15 @@ SV *
sv_newref(SV *sv)
{
if (sv)
- SvREFCNT(sv)++;
+ ATOMIC_INC(SvREFCNT(sv));
return sv;
}
void
sv_free(SV *sv)
{
+ int refcount_is_zero;
+
if (!sv)
return;
if (SvREADONLY(sv)) {
@@ -2891,7 +2893,8 @@ sv_free(SV *sv)
warn("Attempt to free unreferenced scalar");
return;
}
- if (--SvREFCNT(sv) > 0)
+ ATOMIC_DEC_AND_TEST(refcount_is_zero, SvREFCNT(sv));
+ if (!refcount_is_zero)
return;
#ifdef DEBUGGING
if (SvTEMP(sv)) {
diff --git a/sv.h b/sv.h
index 5993a8de9b..e9614e63a1 100644
--- a/sv.h
+++ b/sv.h
@@ -72,13 +72,46 @@ struct io {
#define SvFLAGS(sv) (sv)->sv_flags
#define SvREFCNT(sv) (sv)->sv_refcnt
+#ifdef USE_THREADS
+
+# ifndef EMULATE_ATOMIC_REFCOUNTS
+# include "atomic.h"
+# endif
+
+# ifdef EMULATE_ATOMIC_REFCOUNTS
+# define ATOMIC_INC(count) STMT_START { \
+ MUTEX_LOCK(&svref_mutex); \
+ ++count; \
+ MUTEX_UNLOCK(&svref_mutex); \
+ } STMT_END
+# define ATOMIC_DEC_AND_TEST(res,count) \
+ MUTEX_LOCK(&svref_mutex); \
+ res = (--count == 0); \
+ MUTEX_UNLOCK(&svref_mutex); \
+ } STMT_END
+# else
+# define ATOMIC_INC(count) atomic_inc(&count)
+# define ATOMIC_DEC_AND_TEST(res,count) (res = atomic_dec_and_test(&count))
+# endif /* EMULATE_ATOMIC_REFCOUNTS */
+#else
+# define ATOMIC_INC(count) (++count)
+# define ATOMIC_DEC_AND_TEST(res, count) (res = (--count == 0))
+#endif /* USE_THREADS */
+
#ifdef __GNUC__
-# define SvREFCNT_inc(sv) ({SV* nsv=(SV*)(sv); if(nsv) ++SvREFCNT(nsv); nsv;})
+# define SvREFCNT_inc(sv) \
+ ({ \
+ SV *nsv = (SV*)(sv); \
+ if (nsv) \
+ ATOMIC_INC(SvREFCNT(nsv)); \
+ nsv; \
+ })
#else
# if defined(CRIPPLED_CC) || defined(USE_THREADS)
# define SvREFCNT_inc(sv) sv_newref((SV*)sv)
# else
-# define SvREFCNT_inc(sv) ((Sv=(SV*)(sv)), (Sv && ++SvREFCNT(Sv)), (SV*)Sv)
+# define SvREFCNT_inc(sv) \
+ ((Sv=(SV*)(sv)), (Sv && ATOMIC_INC(SvREFCNT(Sv))), (SV*)Sv)
# endif
#endif
diff --git a/t/lib/anydbm.t b/t/lib/anydbm.t
index ce3003e5b7..3ab609cecc 100755
--- a/t/lib/anydbm.t
+++ b/t/lib/anydbm.t
@@ -12,15 +12,15 @@ use Fcntl;
print "1..12\n";
-unlink <Op.dbmx*>;
+unlink <Op_dbmx.*>;
umask(0);
-print (tie(%h,AnyDBM_File,'Op.dbmx', O_RDWR|O_CREAT, 0640)
+print (tie(%h,AnyDBM_File,'Op_dbmx', O_RDWR|O_CREAT, 0640)
? "ok 1\n" : "not ok 1\n");
-$Dfile = "Op.dbmx.pag";
+$Dfile = "Op_dbmx.pag";
if (! -e $Dfile) {
- ($Dfile) = <Op.dbmx*>;
+ ($Dfile) = <Op_dbmx.*>;
}
if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'dos') {
print "ok 2 # Skipped: different file permission semantics\n";
@@ -55,7 +55,7 @@ $h{'goner2'} = 'snork';
delete $h{'goner2'};
untie(%h);
-print (tie(%h,AnyDBM_File,'Op.dbmx', O_RDWR, 0640) ? "ok 4\n" : "not ok 4\n");
+print (tie(%h,AnyDBM_File,'Op_dbmx', O_RDWR, 0640) ? "ok 4\n" : "not ok 4\n");
$h{'j'} = 'J';
$h{'k'} = 'K';
@@ -118,4 +118,8 @@ print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n");
print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n");
untie %h;
-unlink 'Op.dbmx.dir', $Dfile;
+if ($^O eq 'VMS') {
+ unlink 'Op_dbmx.sdbm_dir', $Dfile;
+} else {
+ unlink 'Op_dbmx.dir', $Dfile;
+}
diff --git a/t/lib/sdbm.t b/t/lib/sdbm.t
index c2952ecf68..591fe14c60 100755
--- a/t/lib/sdbm.t
+++ b/t/lib/sdbm.t
@@ -6,7 +6,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require Config; import Config;
- if ($Config{'extensions'} !~ /\bSDBM_File\b/) {
+ if (($Config{'extensions'} !~ /\bSDBM_File\b/) && ($^O ne 'VMS')){
print "1..0\n";
exit 0;
}
@@ -17,15 +17,15 @@ use Fcntl;
print "1..18\n";
-unlink <Op.dbmx*>;
+unlink <Op_dbmx.*>;
umask(0);
-print (tie(%h,SDBM_File,'Op.dbmx', O_RDWR|O_CREAT, 0640)
+print (tie(%h,SDBM_File,'Op_dbmx', O_RDWR|O_CREAT, 0640)
? "ok 1\n" : "not ok 1\n");
-$Dfile = "Op.dbmx.pag";
+$Dfile = "Op_dbmx.pag";
if (! -e $Dfile) {
- ($Dfile) = <Op.dbmx*>;
+ ($Dfile) = <Op_dbmx.*>;
}
if ($^O eq 'amigaos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'dos') {
print "ok 2 # Skipped: different file permission semantics\n";
@@ -60,7 +60,7 @@ $h{'goner2'} = 'snork';
delete $h{'goner2'};
untie(%h);
-print (tie(%h,SDBM_File,'Op.dbmx', O_RDWR, 0640) ? "ok 4\n" : "not ok 4\n");
+print (tie(%h,SDBM_File,'Op_dbmx', O_RDWR, 0640) ? "ok 4\n" : "not ok 4\n");
$h{'j'} = 'J';
$h{'k'} = 'K';
@@ -123,7 +123,12 @@ print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n");
print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n");
untie %h;
-unlink 'Op.dbmx.dir', $Dfile;
+if ($^O eq 'VMS') {
+ unlink 'Op_dbmx.sdbm_dir', $Dfile;
+} else {
+ unlink 'Op_dbmx.dir', $Dfile;
+}
+
sub ok
{
@@ -187,7 +192,7 @@ EOM
my %h ;
my $X ;
eval '
- $X = tie(%h, "SubDB","dbhash.tmp", O_RDWR|O_CREAT, 0640 );
+ $X = tie(%h, "SubDB","dbhash_tmp", O_RDWR|O_CREAT, 0640 );
' ;
main::ok(14, $@ eq "") ;
@@ -202,6 +207,6 @@ EOM
undef $X;
untie(%h);
- unlink "SubDB.pm", <dbhash.tmp*> ;
+ unlink "SubDB.pm", <dbhash_tmp.*> ;
}
diff --git a/t/op/tiehandle.t b/t/op/tiehandle.t
new file mode 100755
index 0000000000..e3d24723a9
--- /dev/null
+++ b/t/op/tiehandle.t
@@ -0,0 +1,137 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+my @expect;
+my $data = "";
+my @data = ();
+my $test = 1;
+
+sub ok { print "not " unless shift; print "ok ",$test++,"\n"; }
+
+package Implement;
+
+BEGIN { *ok = \*main::ok }
+
+sub compare {
+ return unless @expect;
+ return ok(0) unless(@_ == @expect);
+
+ my $i;
+ for($i = 0 ; $i < @_ ; $i++) {
+ next if $_[$i] eq $expect[$i];
+ return ok(0);
+ }
+
+ ok(1);
+}
+
+sub TIEHANDLE {
+ compare(TIEHANDLE => @_);
+ my ($class,@val) = @_;
+ return bless \@val,$class;
+}
+
+sub PRINT {
+ compare(PRINT => @_);
+ 1;
+}
+
+sub PRINTF {
+ compare(PRINTF => @_);
+ 2;
+}
+
+sub READLINE {
+ compare(READLINE => @_);
+ wantarray ? @data : shift @data;
+}
+
+sub GETC {
+ compare(GETC => @_);
+ substr($data,0,1);
+}
+
+sub READ {
+ compare(READ => @_);
+ substr($_[1],$_[3] || 0) = substr($data,0,$_[2]);
+ 3;
+}
+
+sub WRITE {
+ compare(WRITE => @_);
+ $data = substr($_[1],$_[3] || 0, $_[2]);
+ 4;
+}
+
+sub CLOSE {
+ compare(CLOSE => @_);
+
+ 5;
+}
+
+package main;
+
+use Symbol;
+
+print "1..23\n";
+
+my $fh = gensym;
+
+@expect = (TIEHANDLE => 'Implement');
+my $ob = tie *$fh,'Implement';
+ok(ref($ob) eq 'Implement');
+ok(tied(*$fh) == $ob);
+
+@expect = (PRINT => $ob,"some","text");
+$r = print $fh @expect[2,3];
+ok($r == 1);
+
+@expect = (PRINTF => $ob,"%s","text");
+$r = printf $fh @expect[2,3];
+ok($r == 2);
+
+$text = (@data = ("the line\n"))[0];
+@expect = (READLINE => $ob);
+$ln = <$fh>;
+ok($ln eq $text);
+
+@expect = ();
+@in = @data = qw(a line at a time);
+@line = <$fh>;
+@expect = @in;
+Implement::compare(@line);
+
+@expect = (GETC => $ob);
+$data = "abc";
+$ch = getc $fh;
+ok($ch eq "a");
+
+$buf = "xyz";
+@expect = (READ => $ob, $buf, 3);
+$data = "abc";
+$r = read $fh,$buf,3;
+ok($r == 3);
+ok($buf eq "abc");
+
+
+$buf = "xyzasd";
+@expect = (READ => $ob, $buf, 3,3);
+$data = "abc";
+$r = sysread $fh,$buf,3,3;
+ok($r == 3);
+ok($buf eq "xyzabc");
+
+$buf = "qwerty";
+@expect = (WRITE => $ob, $buf, 4,1);
+$data = "";
+$r = syswrite $fh,$buf,4,1;
+ok($r == 4);
+ok($data eq "wert");
+
+@expect = (CLOSE => $ob);
+$r = close $fh;
+ok($r == 5);
diff --git a/util.c b/util.c
index 0dd944333f..770aa29419 100644
--- a/util.c
+++ b/util.c
@@ -1855,14 +1855,14 @@ my_popen(char *cmd, char *mode)
return my_syspopen(cmd,mode);
}
#endif
- if (PerlProc_pipe(p) < 0)
- return Nullfp;
This = (*mode == 'w');
that = !This;
if (doexec && tainting) {
taint_env();
taint_proper("Insecure %s%s", "EXEC");
}
+ if (PerlProc_pipe(p) < 0)
+ return Nullfp;
while ((pid = (doexec?vfork():fork())) < 0) {
if (errno != EAGAIN) {
PerlLIO_close(p[This]);
diff --git a/vms/descrip.mms b/vms/descrip.mms
index adbcb1cc75..5f055091b0 100644
--- a/vms/descrip.mms
+++ b/vms/descrip.mms
@@ -74,7 +74,7 @@ OBJVAL = $(MMS$TARGET_NAME)$(O)
.endif
# Updated by fndvers.com -- do not edit by hand
-PERL_VERSION = 5_00456#
+PERL_VERSION = 5_00460#
.ifdef DECC_SOCKETS
SOCKET=1
@@ -345,7 +345,7 @@ all : base extras x2p archcorefiles preplibrary perlpods
.endif
base : miniperl perl
@ $(NOOP)
-extras : Fcntl IO Opcode attrs $(POSIX) $(THREAD) libmods utils podxform
+extras : Fcntl IO Opcode attrs $(POSIX) $(THREAD) SDBM_File libmods utils podxform
@ $(NOOP)
libmods : $(LIBPREREQ)
@ $(NOOP)
@@ -556,6 +556,26 @@ THREAD : [.lib]THREAD.pm [.lib.auto.THREAD]THREAD$(E)
[.ext.THREAD]Descrip.MMS : [.ext.THREAD]Makefile.PL $(LIBPREREQ) $(DBG)perlshr$(E)
$(MINIPERL) "-I[--.lib]" -e "chdir('[.ext.THREAD]') or die $!; do 'Makefile.PL'; print ${@} if ${@};" "INST_LIB=[--.lib]" "INST_ARCHLIB=[--.lib]"
+SDBM_File : [.lib]SDBM_File.pm [.lib.auto.SDBM_File]SDBM_File$(E)
+ @ $(NOOP)
+
+[.lib]SDBM_File.pm : [.ext.SDBM_File]Descrip.MMS
+ @ If F$Search("[.lib]auto.dir").eqs."" Then Create/Directory [.lib.auto]
+ @ If F$Search("[.lib.auto]sdbm.dir").eqs."" Then Create/Directory [.lib.auto.sdbm]
+ @ Set Default [.ext.SDBM_File]
+ $(MMS)
+ @ Set Default [--]
+
+[.lib.auto.SDBM_File]SDBM_File$(E) : [.ext.SDBM_File]Descrip.MMS
+ @ Set Default [.ext.SDBM_File]
+ $(MMS)
+ @ Set Default [--]
+
+# Add "-I[--.lib]" t $(MINIPERL) so we use this copy of lib after C<chdir>
+# ${@} necessary to distract different versions of MM[SK]/make
+[.ext.SDBM_File]Descrip.MMS : [.ext.SDBM_File]Makefile.PL $(LIBPREREQ) $(DBG)perlshr$(E)
+ $(MINIPERL) "-I[--.lib]" -e "chdir('[.ext.SDBM_File]') or die $!; do 'Makefile.PL'; print ${@} if ${@};" "INST_LIB=[--.lib]" "INST_ARCHLIB=[--.lib]"
+
IO : [.lib]IO.pm [.lib.IO]File.pm [.lib.IO]Handle.pm [.lib.IO]Pipe.pm [.lib.IO]Seekable.pm [.lib.IO]Socket.pm [.lib.auto.IO]IO$(E)
@ $(NOOP)
@@ -1172,6 +1192,9 @@ clean : tidy
- $(MMS) clean
Set Default [--]
.endif
+ Set Default [.ext.SDBM_File]
+ - $(MMS) clean
+ Set Default [--]
- If F$Search("*.Opt").nes."" Then Delete/NoConfirm/Log *.Opt;*/Exclude=PerlShr_*.Opt
- If F$Search("[...]*$(O);*") .nes."" Then Delete/NoConfirm/Log [...]*$(O);*
- If F$Search("Config.H").nes."" Then Delete/NoConfirm/Log Config.H;*
@@ -1215,6 +1238,9 @@ realclean : clean
- $(MMS) realclean
Set Default [--]
.endif
+ Set Default [.ext.SDBM_File]
+ - $(MMS) realclean
+ Set Default [--]
- If F$Search("*$(OLB)").nes."" Then Delete/NoConfirm/Log *$(OLB);*
- If F$Search("*.Opt").nes."" Then Delete/NoConfirm/Log *.Opt;*
- $(MINIPERL) -e "use File::Path; rmtree(['lib/auto','lib/VMS','lib/$(ARCH)'],1,0);"
diff --git a/vms/perlvms.pod b/vms/perlvms.pod
index c599e5834c..4aa68008d5 100644
--- a/vms/perlvms.pod
+++ b/vms/perlvms.pod
@@ -329,7 +329,12 @@ undefined behavior (rarely, we hope):
getgrnam, setgrent, endgrent, ioctl, link, lstat,
msgctl, msgget, msgsend, msgrcv, readlink, semctl,
semget, semop, setpgrp, setpriority, shmctl, shmget,
- shmread, shmwrite, socketpair, symlink, syscall, truncate
+ shmread, shmwrite, socketpair, symlink, syscall
+
+The following functions are available on Perls compiled with Dec C 5.2 or
+greater and running VMS 7.0 or greater
+
+ truncate
The following functions may or may not be implemented,
depending on what type of socket support you've built into
@@ -749,12 +754,23 @@ it's equivalent to calling fflush() and fsync() from C.
=back
+=head1 Standard modules with VMS-specific differences
+
+=head2 SDBM_File
+
+SDBM_File works peroperly on VMS. It has, however, one minor
+difference. The database directory file created has a L<.sdbm_dir>
+extension rather than a L<.dir> extension. L<.dir> files are VMS filesystem
+directory files, and using them for other purposes could cause unacceptable
+problems.
+
=head1 Revision date
-This document was last updated on 28-Feb-1996, for Perl 5,
-patchlevel 2.
+This document was last updated on 26-Feb-1998, for Perl 5,
+patchlevel 5.
=head1 AUTHOR
-Charles Bailey bailey@genetics.upenn.edu
+Charles Bailey bailey@cor.newman.upenn.edu
+Last revision by Dan Sugalski sugalskd@ous.edu
diff --git a/vms/test.com b/vms/test.com
index 201b5f57d6..7786a17e1b 100644
--- a/vms/test.com
+++ b/vms/test.com
@@ -91,10 +91,9 @@ use Config;
@compexcl=('cpp.t');
@ioexcl=('argv.t','dup.t','fs.t','inplace.t','pipe.t');
-@libexcl=('anydbm.t','db-btree.t','db-hash.t','db-recno.t',
+@libexcl=('db-btree.t','db-hash.t','db-recno.t',
'gdbm.t','io_dup.t', 'io_pipe.t', 'io_sel.t', 'io_sock.t',
- 'ndbm.t','odbm.t','open2.t','open3.t','posix.t',
- 'sdbm.t');
+ 'ndbm.t','odbm.t','open2.t','open3.t','posix.t');
# Note: POSIX is not part of basic build, but can be built
# separately if you're using DECC
diff --git a/win32/makedef.pl b/win32/makedef.pl
index 276c2a9e78..c6af1a0f3c 100644
--- a/win32/makedef.pl
+++ b/win32/makedef.pl
@@ -203,6 +203,7 @@ unless ($define{'USE_THREADS'})
Perl_condpair_magic
Perl_thr_key
Perl_sv_mutex
+Perl_svref_mutex
Perl_malloc_mutex
Perl_eval_mutex
Perl_eval_cond