#
################################################################################
#
-# $Revision: 51 $
+# $Revision: 52 $
# $Author: mhx $
-# $Date: 2007/01/02 12:32:27 +0100 $
+# $Date: 2007/03/23 16:27:19 +0100 $
#
################################################################################
#
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}) {
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)";
#
################################################################################
#
-# $Revision: 51 $
+# $Revision: 52 $
# $Author: mhx $
-# $Date: 2007/01/02 12:32:27 +0100 $
+# $Date: 2007/03/23 16:27:19 +0100 $
#
################################################################################
#
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
{
################################################################################
##
-## $Revision: 10 $
+## $Revision: 12 $
## $Author: mhx $
-## $Date: 2007/01/02 12:32:32 +0100 $
+## $Date: 2007/03/23 17:57:58 +0100 $
##
################################################################################
##
call_pv
call_argv
call_method
+load_module
+vload_module
=implementation
__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 */
#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
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
{
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");
################################################################################
##
-## $Revision: 7 $
+## $Revision: 8 $
## $Author: mhx $
-## $Date: 2007/01/02 12:32:31 +0100 $
+## $Date: 2007/03/23 16:24:34 +0100 $
##
################################################################################
##
# 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
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);
ppp_TESTVAR(PL_tainting);
XSRETURN(count);
-=tests plan => 36
+=tests plan => 37
ok(Devel::PPPort::compare_PL_signals());