Change 30728 by [EMAIL PROTECTED] on 2007/03/23 17:21:15 Upgrade to Devel::PPPort 3.11_01
Affected files ... ... //depot/perl/ext/Devel/PPPort/Changes#35 edit ... //depot/perl/ext/Devel/PPPort/PPPort_pm.PL#28 edit ... //depot/perl/ext/Devel/PPPort/parts/inc/call#5 edit ... //depot/perl/ext/Devel/PPPort/parts/inc/variables#4 edit ... //depot/perl/ext/Devel/PPPort/parts/todo/5006000#6 edit ... //depot/perl/ext/Devel/PPPort/soak#23 edit ... //depot/perl/ext/Devel/PPPort/t/call.t#6 edit ... //depot/perl/ext/Devel/PPPort/t/variables.t#5 edit Differences ... ==== //depot/perl/ext/Devel/PPPort/Changes#35 (xtext) ==== Index: perl/ext/Devel/PPPort/Changes --- perl/ext/Devel/PPPort/Changes#34~30280~ 2007-02-14 05:23:50.000000000 -0800 +++ perl/ext/Devel/PPPort/Changes 2007-03-23 10:21:15.000000000 -0700 @@ -1,3 +1,11 @@ +3.11_01 - 2007-03-23 + + * added support for the following API + PL_expect + load_module + vload_module + (thanks to Nicholas Clark for providing a patch) + 3.11 - 2007-02-14 * happy new year! ==== //depot/perl/ext/Devel/PPPort/PPPort_pm.PL#28 (text) ==== Index: perl/ext/Devel/PPPort/PPPort_pm.PL --- perl/ext/Devel/PPPort/PPPort_pm.PL#27~30280~ 2007-02-14 05:23:50.000000000 -0800 +++ perl/ext/Devel/PPPort/PPPort_pm.PL 2007-03-23 10:21:15.000000000 -0700 @@ -4,9 +4,9 @@ # ################################################################################ # -# $Revision: 51 $ +# $Revision: 52 $ # $Author: mhx $ -# $Date: 2007/01/02 12:32:27 +0100 $ +# $Date: 2007/03/23 16:27:19 +0100 $ # ################################################################################ # @@ -284,6 +284,7 @@ my $f = shift; my $n = $f->{name}; my $a = do { my $x = 'a'; join ',', map { $x++ } 1 .. @{$f->{args}} }; + my $lastarg = ${$f->{args}}[-1]; if ($f->{flags}{n}) { if ($f->{flags}{p}) { @@ -304,6 +305,10 @@ if ($f->{flags}{f}) { return "#define Perl_$n $DPPP(my_$n)"; } + elsif (@$lastarg && $lastarg->[0] =~ /\.\.\./) { + return $undef . "#define $n $DPPP(my_$n)\n" . + "#define Perl_$n $DPPP(my_$n)"; + } else { return $undef . "#define $n($a) $DPPP(my_$n)(aTHX_ $a)\n" . "#define Perl_$n $DPPP(my_$n)"; @@ -339,9 +344,9 @@ # ################################################################################ # -# $Revision: 51 $ +# $Revision: 52 $ # $Author: mhx $ -# $Date: 2007/01/02 12:32:27 +0100 $ +# $Date: 2007/03/23 16:27:19 +0100 $ # ################################################################################ # @@ -502,7 +507,7 @@ use strict; use vars qw($VERSION $data); -$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; +$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11_01 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; sub _init_data { ==== //depot/perl/ext/Devel/PPPort/parts/inc/call#5 (text) ==== Index: perl/ext/Devel/PPPort/parts/inc/call --- perl/ext/Devel/PPPort/parts/inc/call#4~30280~ 2007-02-14 05:23:50.000000000 -0800 +++ perl/ext/Devel/PPPort/parts/inc/call 2007-03-23 10:21:15.000000000 -0700 @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 10 $ +## $Revision: 12 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:32 +0100 $ +## $Date: 2007/03/23 17:57:58 +0100 $ ## ################################################################################ ## @@ -23,6 +23,8 @@ call_pv call_argv call_method +load_module +vload_module =implementation @@ -33,6 +35,11 @@ __UNDEFINED__ call_method perl_call_method __UNDEFINED__ eval_sv perl_eval_sv + +__UNDEFINED__ PERL_LOADMOD_DENY 0x1 +__UNDEFINED__ PERL_LOADMOD_NOIMPORT 0x2 +__UNDEFINED__ PERL_LOADMOD_IMPORT_OPS 0x4 + /* Replace: 0 */ /* Replace perl_eval_pv with eval_pv */ @@ -64,9 +71,87 @@ #endif #endif +#ifndef vload_module +#if { NEED vload_module } + +void +vload_module(U32 flags, SV *name, SV *ver, va_list *args) +{ + dTHR; + dVAR; + OP *veop, *imop; + + OP * const modname = newSVOP(OP_CONST, 0, name); + /* 5.005 has a somewhat hacky force_normal that doesn't croak on + SvREADONLY() if PL_compling is true. Current perls take care in + ck_require() to correctly turn off SvREADONLY before calling + force_normal_flags(). This seems a better fix than fudging PL_compling + */ + SvREADONLY_off(((SVOP*)modname)->op_sv); + modname->op_private |= OPpCONST_BARE; + if (ver) { + veop = newSVOP(OP_CONST, 0, ver); + } + else + veop = NULL; + if (flags & PERL_LOADMOD_NOIMPORT) { + imop = sawparens(newNULLLIST()); + } + else if (flags & PERL_LOADMOD_IMPORT_OPS) { + imop = va_arg(*args, OP*); + } + else { + SV *sv; + imop = NULL; + sv = va_arg(*args, SV*); + while (sv) { + imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv)); + sv = va_arg(*args, SV*); + } + } + { + const line_t ocopline = PL_copline; + COP * const ocurcop = PL_curcop; + const int oexpect = PL_expect; + +#if { VERSION >= 5.004 } + utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0), + veop, modname, imop); +#else + utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(), + modname, imop); +#endif + PL_expect = oexpect; + PL_copline = ocopline; + PL_curcop = ocurcop; + } +} + +#endif +#endif + +/* load_module depends on vload_module */ + +#ifndef load_module +#if { NEED load_module } + +void +load_module(U32 flags, SV *name, SV *ver, ...) +{ + va_list args; + va_start(args, ver); + vload_module(flags, name, ver, &args); + va_end(args); +} + +#endif +#endif + =xsinit #define NEED_eval_pv +#define NEED_load_module +#define NEED_vload_module =xsubs @@ -183,7 +268,19 @@ EXTEND(SP, 1); PUSHs(sv_2mortal(newSViv(i))); -=tests plan => 44 +void +load_module(flags, name, version, ...) + U32 flags + SV *name + SV *version + CODE: + /* Both SV parameters are donated to the ops built inside + load_module, so we need to bump the refcounts. */ + SvREFCNT_inc(name); + SvREFCNT_inc(version); + Perl_load_module(aTHX_ flags, name, version, NULL); + +=tests plan => 46 sub eq_array { @@ -237,3 +334,6 @@ ok(&Devel::PPPort::eval_pv('f()', 0), 'y'); ok(&Devel::PPPort::eval_pv('f(qw(a b c))', 0), 'y'); +ok(!defined $::{'less::'}, 1, "Hadn't loaded less yet"); +Devel::PPPort::load_module(0, "less", undef); +ok(defined $::{'less::'}, 1, "Have now loaded less"); ==== //depot/perl/ext/Devel/PPPort/parts/inc/variables#4 (text) ==== Index: perl/ext/Devel/PPPort/parts/inc/variables --- perl/ext/Devel/PPPort/parts/inc/variables#3~30280~ 2007-02-14 05:23:50.000000000 -0800 +++ perl/ext/Devel/PPPort/parts/inc/variables 2007-03-23 10:21:15.000000000 -0700 @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 7 $ +## $Revision: 8 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:31 +0100 $ +## $Date: 2007/03/23 16:24:34 +0100 $ ## ################################################################################ ## @@ -71,6 +71,7 @@ # define PL_dirty dirty # define PL_dowarn dowarn # define PL_errgv errgv +# define PL_expect expect # define PL_hexdigit hexdigit # define PL_hints hints # define PL_laststatval laststatval @@ -210,6 +211,7 @@ ppp_TESTVAR(PL_dirty); ppp_TESTVAR(PL_dowarn); ppp_TESTVAR(PL_errgv); + ppp_TESTVAR(PL_expect); ppp_TESTVAR(PL_laststatval); ppp_TESTVAR(PL_no_modify); ppp_TESTVAR(PL_perl_destruct_level); @@ -225,7 +227,7 @@ ppp_TESTVAR(PL_tainting); XSRETURN(count); -=tests plan => 36 +=tests plan => 37 ok(Devel::PPPort::compare_PL_signals()); ==== //depot/perl/ext/Devel/PPPort/parts/todo/5006000#6 (text) ==== Index: perl/ext/Devel/PPPort/parts/todo/5006000 --- perl/ext/Devel/PPPort/parts/todo/5006000#5~28332~ 2006-05-29 10:50:48.000000000 -0700 +++ perl/ext/Devel/PPPort/parts/todo/5006000 2007-03-23 10:21:15.000000000 -0700 @@ -85,7 +85,6 @@ is_utf8_space # U is_utf8_upper # U is_utf8_xdigit # U -load_module # U magic_dump # U mess # E (Perl_mess) my_atof # U @@ -148,7 +147,6 @@ utf8_hop # U vcroak # U vform # U -vload_module # U vmess # U vwarn # U vwarner # U ==== //depot/perl/ext/Devel/PPPort/soak#23 (text) ==== Index: perl/ext/Devel/PPPort/soak --- perl/ext/Devel/PPPort/soak#22~30280~ 2007-02-14 05:23:50.000000000 -0800 +++ perl/ext/Devel/PPPort/soak 2007-03-23 10:21:15.000000000 -0700 @@ -33,7 +33,7 @@ use List::Util qw(max); use Config; -my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; +my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11_01 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; $| = 1; my %OPT = ( ==== //depot/perl/ext/Devel/PPPort/t/call.t#6 (text) ==== Index: perl/ext/Devel/PPPort/t/call.t --- perl/ext/Devel/PPPort/t/call.t#5~29436~ 2006-12-02 09:13:26.000000000 -0800 +++ perl/ext/Devel/PPPort/t/call.t 2007-03-23 10:21:15.000000000 -0700 @@ -30,9 +30,9 @@ require 'testutil.pl' if $@; } - if (44) { + if (46) { load(); - plan(tests => 44); + plan(tests => 46); } } @@ -100,3 +100,7 @@ ok(&Devel::PPPort::eval_pv('f()', 0), 'y'); ok(&Devel::PPPort::eval_pv('f(qw(a b c))', 0), 'y'); +ok(!defined $::{'less::'}, 1, "Hadn't loaded less yet"); +Devel::PPPort::load_module(0, "less", undef); +ok(defined $::{'less::'}, 1, "Have now loaded less"); + ==== //depot/perl/ext/Devel/PPPort/t/variables.t#5 (text) ==== Index: perl/ext/Devel/PPPort/t/variables.t --- perl/ext/Devel/PPPort/t/variables.t#4~29436~ 2006-12-02 09:13:26.000000000 -0800 +++ perl/ext/Devel/PPPort/t/variables.t 2007-03-23 10:21:15.000000000 -0700 @@ -30,9 +30,9 @@ require 'testutil.pl' if $@; } - if (36) { + if (37) { load(); - plan(tests => 36); + plan(tests => 37); } } End of Patch.