1 ################################################################################
5 ## $Date: 2004/08/17 23:13:18 +0200 $
7 ################################################################################
9 ## Version 3.x, Copyright (C) 2004, Marcus Holland-Moritz.
10 ## Version 2.x, Copyright (C) 2001, Paul Marquess.
11 ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
13 ## This program is free software; you can redistribute it and/or
14 ## modify it under the same terms as Perl itself.
16 ################################################################################
27 # define sv_setuv(sv, uv) \
30 if (TeMpUv <= IV_MAX) \
31 sv_setiv(sv, TeMpUv); \
33 sv_setnv(sv, (double)TeMpUv); \
38 # define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv))
41 __UNDEFINED__ sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv)))
42 __UNDEFINED__ SvUVX(sv) ((UV)SvIVX(sv))
43 __UNDEFINED__ SvUVXx(sv) SvUVX(sv)
44 __UNDEFINED__ SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
45 __UNDEFINED__ SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv))
48 * Always use the SvUVx() macro instead of sv_uv().
50 __UNDEFINED__ sv_uv(sv) SvUVx(sv)
52 __UNDEFINED__ XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) )
53 __UNDEFINED__ XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END
55 __UNDEFINED__ PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END
56 __UNDEFINED__ XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
104 TARG = sv_newmortal();
114 TARG = sv_newmortal();
120 ok(&Devel::PPPort::sv_setuv(42), 42);
121 ok(&Devel::PPPort::newSVuv(123), 123);
122 ok(&Devel::PPPort::sv_2uv("4711"), 4711);
123 ok(&Devel::PPPort::sv_2uv("1735928559"), 1735928559);
124 ok(&Devel::PPPort::SvUVx("1735928559"), 1735928559);
125 ok(&Devel::PPPort::SvUVx(1735928559), 1735928559);
126 ok(&Devel::PPPort::SvUVx(0xdeadbeef), 0xdeadbeef);
127 ok(&Devel::PPPort::XSRETURN_UV(), 42);
128 ok(&Devel::PPPort::PUSHu(), 42);
129 ok(&Devel::PPPort::XPUSHu(), 43);