################################################################################
##
-## $Revision: 22 $
+## $Revision: 30 $
## $Author: mhx $
-## $Date: 2005/06/11 09:37:31 +0200 $
+## $Date: 2006/01/14 18:08:03 +0100 $
##
################################################################################
##
-## Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz.
+## Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
## Version 2.x, Copyright (C) 2001, Paul Marquess.
## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
##
EXTERN_C
STMT_START
STMT_END
+XSRETURN
/PL_\w+/
=implementation
-#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
+#if { VERSION <= 5.004_05 }
/* Replace: 1 */
# define PL_DBsingle DBsingle
# define PL_DBsub DBsub
__UNDEFINED__ get_hv perl_get_hv
/* Replace: 0 */
-#ifdef HAS_MEMCMP
-__UNDEFINED__ memNE(s1,s2,l) (memcmp(s1,s2,l))
-__UNDEFINED__ memEQ(s1,s2,l) (!memcmp(s1,s2,l))
-#else
-__UNDEFINED__ memNE(s1,s2,l) (bcmp(s1,s2,l))
-__UNDEFINED__ memEQ(s1,s2,l) (!bcmp(s1,s2,l))
-#endif
-
-__UNDEFINED__ MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t))
-__UNDEFINED__ CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
-#ifdef HAS_MEMSET
-__UNDEFINED__ ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t))
-#else
-__UNDEFINED__ ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)),d)
-#endif
-
-__UNDEFINED__ Poison(d,n,t) (void)memset((char*)(d), 0xAB, (n) * sizeof(t))
-
__UNDEFINED__ dUNDERBAR dNOOP
__UNDEFINED__ UNDERBAR DEFSV
__UNDEFINED__ dXSTARG SV * targ = sv_newmortal()
+__UNDEFINED__ dAXMARK I32 ax = POPMARK; \
+ register SV ** const mark = PL_stack_base + ax++
+
+
+__UNDEFINED__ XSprePUSH (sp = PL_stack_base + ax - 1)
+
+#if { VERSION < 5.005 }
+# undef XSRETURN
+# define XSRETURN(off) \
+ STMT_START { \
+ PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
+ return; \
+ } STMT_END
+#endif
+
=xsmisc
XS(XS_Devel__PPPort_dXSTARG); /* prototype */
XSRETURN(1);
}
+XS(XS_Devel__PPPort_dAXMARK); /* prototype */
+XS(XS_Devel__PPPort_dAXMARK)
+{
+ dSP;
+ dAXMARK;
+ dITEMS;
+ IV iv;
+ SP -= items;
+ iv = SvIV(ST(0)) - 1;
+ PUSHs(sv_2mortal(newSViv(iv)));
+ XSRETURN(1);
+}
+
=xsboot
newXS("Devel::PPPort::dXSTARG", XS_Devel__PPPort_dXSTARG, file);
+newXS("Devel::PPPort::dAXMARK", XS_Devel__PPPort_dAXMARK, file);
=xsubs
XPUSHs(newSVpvn(NULL, 0));
XSRETURN(5);
+void
+xsreturn(two)
+ int two
+ PPCODE:
+ XPUSHs(newSVpvn("test1", 5));
+ if (two)
+ XPUSHs(newSVpvn("test2", 5));
+ if (two)
+ XSRETURN(2);
+ else
+ XSRETURN(1);
+
SV *
PL_sv_undef()
CODE:
OUTPUT:
RETVAL
-=tests plan => 32
+void
+prepush()
+ CODE:
+ {
+ dXSTARG;
+ XSprePUSH;
+ PUSHi(42);
+ XSRETURN(1);
+ }
+
+=tests plan => 38
use vars qw($my_sv @my_av %my_hv);
ok(&Devel::PPPort::DEFSV(), "Fred");
ok(&Devel::PPPort::UNDERBAR(), "Fred");
+if ($] >= 5.009002) {
+ eval q{
+ my $_ = "Tony";
+ ok(&Devel::PPPort::DEFSV(), "Fred");
+ ok(&Devel::PPPort::UNDERBAR(), "Tony");
+ };
+}
+else {
+ ok(1);
+ ok(1);
+}
+
eval { 1 };
ok(!&Devel::PPPort::ERRSV());
eval { cannot_call_this_one() };
ok(&Devel::PPPort::get_cv('not_my_cv', 1));
ok(Devel::PPPort::dXSTARG(42), 43);
+ok(Devel::PPPort::dAXMARK(4711), 4710);
+
+ok(Devel::PPPort::prepush(), 42);
+ok(join(':', Devel::PPPort::xsreturn(0)), 'test1');
+ok(join(':', Devel::PPPort::xsreturn(1)), 'test1:test2');