diff options
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | embed.h | 12 | ||||
-rwxr-xr-x | embed.pl | 12 | ||||
-rw-r--r-- | ext/Data/Dumper/Dumper.xs | 2 | ||||
-rw-r--r-- | ext/Digest/MD5/Changes | 11 | ||||
-rw-r--r-- | ext/Digest/MD5/MD5.pm | 2 | ||||
-rw-r--r-- | ext/Digest/MD5/MD5.xs | 9 | ||||
-rw-r--r-- | ext/Digest/MD5/Makefile.PL | 1 | ||||
-rw-r--r-- | ext/Digest/MD5/hints/dec_osf.pl | 13 | ||||
-rw-r--r-- | ext/Digest/MD5/t/files.t | 19 | ||||
-rw-r--r-- | ext/List/Util/ChangeLog | 31 | ||||
-rw-r--r-- | ext/List/Util/Util.xs | 34 | ||||
-rw-r--r-- | ext/List/Util/lib/List/Util.pm | 2 | ||||
-rw-r--r-- | ext/List/Util/lib/Scalar/Util.pm | 11 | ||||
-rw-r--r-- | ext/List/Util/t/isvstring.t | 15 | ||||
-rw-r--r-- | ext/List/Util/t/proto.t | 75 | ||||
-rw-r--r-- | ext/MIME/Base64/Base64.xs | 8 | ||||
-rw-r--r-- | ext/Storable/Storable.xs | 11 | ||||
-rw-r--r-- | pod/perlembed.pod | 18 |
19 files changed, 249 insertions, 39 deletions
@@ -168,6 +168,7 @@ ext/Devel/PPPort/soak Test Harness to run Devel::PPPort other Perls ext/Devel/PPPort/t/test.t See if Devel::PPPort works ext/Devel/PPPort/TODO Devel::PPPort Todo ext/Digest/MD5/Changes Digest::MD5 extension changes +ext/Digest/MD5/hints/dec_osf.pl Hints for named architecture ext/Digest/MD5/hints/irix_6.pl Hints for named architecture ext/Digest/MD5/hints/MacOS.pl Hints for named architecture ext/Digest/MD5/Makefile.PL Digest::MD5 extension makefile writer @@ -486,6 +487,7 @@ ext/List/Util/t/maxstr.t List::Util ext/List/Util/t/min.t List::Util ext/List/Util/t/minstr.t List::Util ext/List/Util/t/openhan.t Scalar::Util +ext/List/Util/t/proto.t Scalar::Util ext/List/Util/t/readonly.t Scalar::Util ext/List/Util/t/reduce.t List::Util ext/List/Util/t/refaddr.t Scalar::Util @@ -16,7 +16,11 @@ /* (Doing namespace management portably in C is really gross.) */ -/* NO_EMBED is no longer supported. i.e. EMBED is always active. */ +/* By defining PERL_NO_SHORT_NAMES (not done by default) the short forms + * (like warn instead of Perl_warn) for the API are not defined. + * Not defining the short forms is a good thing for cleaner embedding. */ + +#ifndef PERL_NO_SHORT_NAMES /* Hide global symbols */ @@ -786,8 +790,6 @@ #ifdef PERL_CORE #define peep Perl_peep #endif -#ifdef PERL_CORE -#endif #if defined(USE_5005THREADS) #define new_struct_thread Perl_new_struct_thread #endif @@ -4908,6 +4910,8 @@ #endif /* PERL_IMPLICIT_CONTEXT */ +#endif /* #ifndef PERL_NO_SHORT_NAMES */ + /* Compatibility stubs. Compile extensions with -DPERL_NOCOMPAT to disable them. @@ -4949,7 +4953,7 @@ an extra argument but grab the context pointer using the macro dTHX. */ -#if defined(PERL_IMPLICIT_CONTEXT) +#if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_SHORT_NAMES) # define croak Perl_croak_nocontext # define deb Perl_deb_nocontext # define die Perl_die_nocontext @@ -316,7 +316,11 @@ print EM do_not_edit ("embed.h"), <<'END'; /* (Doing namespace management portably in C is really gross.) */ -/* NO_EMBED is no longer supported. i.e. EMBED is always active. */ +/* By defining PERL_NO_SHORT_NAMES (not done by default) the short forms + * (like warn instead of Perl_warn) for the API are not defined. + * Not defining the short forms is a good thing for cleaner embedding. */ + +#ifndef PERL_NO_SHORT_NAMES /* Hide global symbols */ @@ -340,7 +344,7 @@ walk_table { $ret .= hide($func,"Perl_$func"); } } - unless ($flags =~ /A/) { + if ($ret ne '' && $flags !~ /A/) { if ($flags =~ /E/) { $ret = "#if defined(PERL_CORE) || defined(PERL_EXT)\n$ret#endif\n"; } else { @@ -428,6 +432,8 @@ print EM <<'END'; #endif /* PERL_IMPLICIT_CONTEXT */ +#endif /* #ifndef PERL_NO_SHORT_NAMES */ + END print EM <<'END'; @@ -472,7 +478,7 @@ print EM <<'END'; an extra argument but grab the context pointer using the macro dTHX. */ -#if defined(PERL_IMPLICIT_CONTEXT) +#if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_SHORT_NAMES) # define croak Perl_croak_nocontext # define deb Perl_deb_nocontext # define die Perl_die_nocontext diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index 1bbf4f56e9..6f3b350ac3 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -5,7 +5,7 @@ #ifndef PERL_VERSION # include <patchlevel.h> -# ifndef PERL_VERSION +# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL))) # include <could_not_find_Perl_patchlevel.h> # endif # define PERL_VERSION PATCHLEVEL diff --git a/ext/Digest/MD5/Changes b/ext/Digest/MD5/Changes index 2c113b41b7..b81bc5267a 100644 --- a/ext/Digest/MD5/Changes +++ b/ext/Digest/MD5/Changes @@ -1,4 +1,13 @@ -2002-03-04 Gisle Aas <gisle@ActiveState.com> +2003-01-18 Gisle Aas <gisle@ActiveState.com> + + Release 2.23 + + Override INSTALLDIRS for 5.8 as suggested by + Guido Ostkamp <Guido.Ostkamp@t-online.de>. + + + +2003-01-04 Gisle Aas <gisle@ActiveState.com> Release 2.22. diff --git a/ext/Digest/MD5/MD5.pm b/ext/Digest/MD5/MD5.pm index 0017e5af56..22366059e9 100644 --- a/ext/Digest/MD5/MD5.pm +++ b/ext/Digest/MD5/MD5.pm @@ -3,7 +3,7 @@ package Digest::MD5; use strict; use vars qw($VERSION @ISA @EXPORT_OK); -$VERSION = '2.22'; # $Date: 2003/01/05 00:56:14 $ +$VERSION = '2.23'; # $Date: 2003/01/19 04:42:15 $ require Exporter; *import = \&Exporter::import; diff --git a/ext/Digest/MD5/MD5.xs b/ext/Digest/MD5/MD5.xs index b1f2a04cdf..f70acbb8fa 100644 --- a/ext/Digest/MD5/MD5.xs +++ b/ext/Digest/MD5/MD5.xs @@ -44,10 +44,13 @@ extern "C" { } #endif -#include <patchlevel.h> -#ifndef PERL_VERSION -# include <could_not_find_Perl_patchlevel.h> +#ifndef PATCHLEVEL +# include <patchlevel.h> +# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL))) +# include <could_not_find_Perl_patchlevel.h> +# endif #endif + #if PATCHLEVEL <= 4 && !defined(PL_dowarn) #define PL_dowarn dowarn #endif diff --git a/ext/Digest/MD5/Makefile.PL b/ext/Digest/MD5/Makefile.PL index ceae9493f0..1a91de02dc 100644 --- a/ext/Digest/MD5/Makefile.PL +++ b/ext/Digest/MD5/Makefile.PL @@ -15,6 +15,7 @@ if ($^O eq 'VMS') { } } +push(@extra, 'INSTALLDIRS' => 'perl') if $] >= 5.008; WriteMakefile( 'NAME' => 'Digest::MD5', diff --git a/ext/Digest/MD5/hints/dec_osf.pl b/ext/Digest/MD5/hints/dec_osf.pl new file mode 100644 index 0000000000..89eeaab9a9 --- /dev/null +++ b/ext/Digest/MD5/hints/dec_osf.pl @@ -0,0 +1,13 @@ +if ($] < 5.00503 and !$Config{gccversion}) { + print " + Because of a bug with the DEC system C compiler, some tests in + t/rfc2202.t will be skipped. These tests fail because the compiler + bug breaks Perl's 'x' operator for eight-bit characters. The + Digest:: modules themselves work and should be safe to install + anyway. + + Versions of Perl after 5.005_03 will contain a workaround for the + bug. + +"; +} diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t index a1d567bd3b..f133c2242e 100644 --- a/ext/Digest/MD5/t/files.t +++ b/ext/Digest/MD5/t/files.t @@ -20,27 +20,27 @@ use Digest::MD5 qw(md5 md5_hex md5_base64); my $EXPECT; if (ord "A" == 193) { # EBCDIC $EXPECT = <<EOT; -ed8efe2e2dbab62fcc9dea2df6682569 Changes +aab6fda26844b46ca878f46394c52bb2 Changes 0565ec21b15c0f23f4c51fb327c8926d README -0fcdd6d6e33b8772bd4b4832043035cd MD5.pm -4757a101ad5df97136a2fa8e910d9d6a MD5.xs +5d2a638a7323f5bd5b5c120c9330b99d MD5.pm +de2c149900efee0fbb39ad87dea68a43 MD5.xs 276da0aa4e9a08b7fe09430c9c5690aa rfc1321.txt EOT } elsif ("\n" eq "\015") { # MacOS $EXPECT = <<EOT; -2879619f967d5fc5a00ffe37b639f2ee Changes +d286d6c6a61e44e88d1deba9954ce37a Changes 6c950a0211a5a28f023bb482037698cd README -4e1043f0a7a266416d8408d6fa96f454 MD5.pm -fc1b8007a6f5262561a0a76493759a55 MD5.xs +d31c9aefa1a9e40beda9fff1e1d9c02d MD5.pm +df178436ead9d354d63089fa0e01af27 MD5.xs 754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt EOT } else { # This is the output of: 'md5sum Changes README MD5.pm MD5.xs rfc1321.txt' $EXPECT = <<EOT; -2879619f967d5fc5a00ffe37b639f2ee Changes +d286d6c6a61e44e88d1deba9954ce37a Changes 6c950a0211a5a28f023bb482037698cd README -4e1043f0a7a266416d8408d6fa96f454 MD5.pm -fc1b8007a6f5262561a0a76493759a55 MD5.xs +d31c9aefa1a9e40beda9fff1e1d9c02d MD5.pm +df178436ead9d354d63089fa0e01af27 MD5.xs 754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt EOT } @@ -61,6 +61,7 @@ if ($@) { for (split /^/, $EXPECT) { my($md5hex, $file) = split ' '; my $base = $file; + print "# $base\n"; if ($ENV{PERL_CORE}) { if ($file eq 'rfc1321.txt') { # Don't have it in core. print "ok ", ++$testno, " # Skip: PERL_CORE\n"; diff --git a/ext/List/Util/ChangeLog b/ext/List/Util/ChangeLog index e03b31c7ee..3157e92086 100644 --- a/ext/List/Util/ChangeLog +++ b/ext/List/Util/ChangeLog @@ -1,3 +1,32 @@ +Change 770 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr) + + Release 1.11 + +Change 769 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr) + + Add t/proto.t to MANIFEST + +Change 768 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr) + + Add set_prototype from Rafael Garcia-Suarez + +Change 767 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr) + + Fix t/isvstring.t so it does not cause perl5.004 to segv + because of the exit from within BEGIN + +Change 766 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr) + + Change how patchlevel.h is included and check we got what we wanted (from Jarkko) + +Change 765 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr) + + Add -DPERL_EXT to DEFINEs, requested by Jarkko for 5.8.1 + +Change 764 on 2003/02/04 by <gbarr@pobox.com> (Graham Barr) + + Release 1.10 + Change 763 on 2003/02/04 by <gbarr@pobox.com> (Graham Barr) Fix linking error for older perls @@ -36,7 +65,7 @@ Change 756 on 2002/11/03 by <gbarr@pobox.com> (Graham Barr) Change 751 on 2002/10/18 by <gbarr@pobox.com> (Graham Barr) Fix context so that sub for reduce/first is always in a scalar context - Fix sum/min/max so that they dont upgrade thier arguments to NVs + Fix sum/min/max so that they don't upgrade their arguments to NVs if they are IV or UV Change 750 on 2002/10/14 by <gbarr@pobox.com> (Graham Barr) diff --git a/ext/List/Util/Util.xs b/ext/List/Util/Util.xs index 856bb9c527..cd3560497e 100644 --- a/ext/List/Util/Util.xs +++ b/ext/List/Util/Util.xs @@ -8,7 +8,10 @@ #include <XSUB.h> #ifndef PERL_VERSION -# include "patchlevel.h" +# include <patchlevel.h> +# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL))) +# include <could_not_find_Perl_patchlevel.h> +# endif # define PERL_REVISION 5 # define PERL_VERSION PATCHLEVEL # define PERL_SUBVERSION SUBVERSION @@ -474,6 +477,35 @@ CODE: OUTPUT: RETVAL +SV* +set_prototype(subref, proto) + SV *subref + SV *proto +PROTOTYPE: &$ +CODE: +{ + if (SvROK(subref)) { + SV *sv = SvRV(subref); + if (SvTYPE(sv) != SVt_PVCV) { + /* not a subroutine reference */ + croak("set_prototype: not a subroutine reference"); + } + if (SvPOK(proto)) { + /* set the prototype */ + STRLEN len; + char *ptr = SvPV(proto, len); + sv_setpvn(sv, ptr, len); + } + else { + /* delete the prototype */ + SvPOK_off(sv); + } + } + else { + croak("set_prototype: not a reference"); + } + XSRETURN(1); +} BOOT: { diff --git a/ext/List/Util/lib/List/Util.pm b/ext/List/Util/lib/List/Util.pm index 872bb2dbcf..09beda67ef 100644 --- a/ext/List/Util/lib/List/Util.pm +++ b/ext/List/Util/lib/List/Util.pm @@ -11,7 +11,7 @@ require DynaLoader; our @ISA = qw(Exporter DynaLoader); our @EXPORT_OK = qw(first min max minstr maxstr reduce sum shuffle); -our $VERSION = "1.10_00"; +our $VERSION = "1.11_00"; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/List/Util/lib/Scalar/Util.pm b/ext/List/Util/lib/Scalar/Util.pm index 4de463d092..ca60dfd3e1 100644 --- a/ext/List/Util/lib/Scalar/Util.pm +++ b/ext/List/Util/lib/Scalar/Util.pm @@ -10,7 +10,7 @@ require Exporter; require List::Util; # List::Util loads the XS our @ISA = qw(Exporter); -our @EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number); +our @EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number set_prototype); our $VERSION = $List::Util::VERSION; sub openhandle ($) { @@ -41,7 +41,7 @@ Scalar::Util - A selection of general-utility scalar subroutines =head1 SYNOPSIS - use Scalar::Util qw(blessed dualvar isweak readonly refaddr reftype tainted weaken isvstring looks_like_number); + use Scalar::Util qw(blessed dualvar isweak readonly refaddr reftype tainted weaken isvstring looks_like_number set_prototype); =head1 DESCRIPTION @@ -143,6 +143,13 @@ is returned. Otherwise C<undef> is returned. $obj = bless {}, "Foo"; $type = reftype $obj; # HASH +=item set_prototype CODEREF, PROTOTYPE + +Sets the prototype of the given function, or deletes it if PROTOTYPE is +undef. Returns the CODEREF. + + set_prototype \&foo, '$$'; + =item tainted EXPR Return true if the result of EXPR is tainted diff --git a/ext/List/Util/t/isvstring.t b/ext/List/Util/t/isvstring.t index bd70b63ebf..1f679ca0ef 100644 --- a/ext/List/Util/t/isvstring.t +++ b/ext/List/Util/t/isvstring.t @@ -11,15 +11,16 @@ BEGIN { exit 0; } } - $|=1; - require Scalar::Util; - if (grep { /isvstring/ } @Scalar::Util::EXPORT_FAIL) { - print("1..0\n"); - exit 0; - } } -use Scalar::Util qw(isvstring); +$|=1; +require Scalar::Util; +if (grep { /isvstring/ } @Scalar::Util::EXPORT_FAIL) { + print("1..0\n"); + exit 0; +} + +Scalar::Util->import(qw[isvstring]); print "1..4\n"; diff --git a/ext/List/Util/t/proto.t b/ext/List/Util/t/proto.t new file mode 100644 index 0000000000..91541cb5e7 --- /dev/null +++ b/ext/List/Util/t/proto.t @@ -0,0 +1,75 @@ +#!./perl + +BEGIN { + unless (-d 'blib') { + chdir 't' if -d 't'; + @INC = '../lib'; + require Config; import Config; + keys %Config; # Silence warning + if ($Config{extensions} !~ /\bList\/Util\b/) { + print "1..0 # Skip: List::Util was not built\n"; + exit 0; + } + } +} + +BEGIN { + require Scalar::Util; + + if (grep { /set_prototype/ } @Scalar::Util::EXPORT_FAIL) { + print "1..0\n"; + $skip=1; + } +} + +eval <<'EOT' unless $skip; +use Scalar::Util qw(set_prototype); + +print "1..13\n"; +$test = 0; + +sub proto_is ($$) { + $proto = prototype shift; + $expected = shift; + if (defined $expected) { + print "# Got $proto, expected $expected\nnot " if $expected ne $proto; + } + else { + print "# Got $proto, expected undef\nnot " if defined $proto; + } + print "ok ", ++$test, "\n"; +} + +sub f { } +proto_is 'f' => undef; +$r = set_prototype(\&f,'$'); +proto_is 'f' => '$'; +print "not " unless ref $r eq "CODE" and $r == \&f; +print "ok ", ++$test, " - return value\n"; +set_prototype(\&f,undef); +proto_is 'f' => undef; +set_prototype(\&f,''); +proto_is 'f' => ''; + +sub g (@) { } +proto_is 'g' => '@'; +set_prototype(\&g,undef); +proto_is 'g' => undef; + +sub non_existent; +proto_is 'non_existent' => undef; +set_prototype(\&non_existent,'$$$'); +proto_is 'non_existent' => '$$$'; + +sub forward_decl ($$$$); +proto_is 'forward_decl' => '$$$$'; +set_prototype(\&forward_decl,'\%'); +proto_is 'forward_decl' => '\%'; + +eval { &set_prototype( 'f', '' ); }; +print "not " unless $@ =~ /^set_prototype: not a reference/; +print "ok ", ++$test, " - error msg\n"; +eval { &set_prototype( \'f', '' ); }; +print "not " unless $@ =~ /^set_prototype: not a subroutine reference/; +print "ok ", ++$test, " - error msg\n"; +EOT diff --git a/ext/MIME/Base64/Base64.xs b/ext/MIME/Base64/Base64.xs index da2da500fc..6f855fb92a 100644 --- a/ext/MIME/Base64/Base64.xs +++ b/ext/MIME/Base64/Base64.xs @@ -35,7 +35,13 @@ extern "C" { } #endif -#include "patchlevel.h" +#ifndef PATCHLEVEL +# include <patchlevel.h> +# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL))) +# include <could_not_find_Perl_patchlevel.h> +# endif +#endif + #if PATCHLEVEL <= 4 && !defined(PL_dowarn) #define PL_dowarn dowarn #endif diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index 7cc610e733..fe6ee11a45 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -10,12 +10,15 @@ #include <EXTERN.h> #include <perl.h> -#include <patchlevel.h> /* Perl's one, needed since 5.6 */ -#ifndef PERL_VERSION -# include <could_not_find_Perl_patchlevel.h> -#endif #include <XSUB.h> +#ifndef PATCHLEVEL +# include <patchlevel.h> /* Perl's one, needed since 5.6 */ +# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL))) +# include <could_not_find_Perl_patchlevel.h> +# endif +#endif + #ifndef NETWARE #if 0 #define DEBUGME /* Debug mode, turns assertions on as well */ diff --git a/pod/perlembed.pod b/pod/perlembed.pod index b9aae2d87a..484884ea06 100644 --- a/pod/perlembed.pod +++ b/pod/perlembed.pod @@ -1038,6 +1038,24 @@ also need this path so it knows where to find Perl include files. This path can be added via the Tools -> Options -> Directories menu. Finally, select Build -> Build interp.exe and you're ready to go. +=head1 Hiding Perl_ + +If you completely hide the short forms forms of the Perl public API, +add -DPERL_NO_SHORT_NAMES to the compilation flags. This means that +for example instead of writing + + warn("%d bottles of beer on the wall", bottlecount); + +you will have to write the explicit full form + + Perl_warn(aTHX_ "%d bottles of beer on the wall", bottlecount); + +(See L<perlguts/Background and PERL_IMPLICIT_CONTEXT for the explanation +of the C<aTHX_>.> ) Hiding the short forms is very useful for avoiding +all sorts of nasty (C preprocessor or otherwise) conflicts with other +software packages (Perl defines about 2400 APIs with these short names, +take or leave few hundred, so there certainly is room for conflict.) + =head1 MORAL You can sometimes I<write faster code> in C, but |