1 ################################################################################
5 ## $Date: 2006/05/19 23:00:18 +0200 $
7 ################################################################################
9 ## Version 3.x, Copyright (C) 2004-2006, 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 ################################################################################
24 /* concatenating with "" ensures that only literal strings are accepted as argument
25 * note that STR_WITH_LEN() can't be used as argument to macros or functions that
26 * under some configurations might be macros
29 __UNDEFINED__ STR_WITH_LEN(s) (s ""), (sizeof(s)-1)
31 __UNDEFINED__ newSVpvs(str) newSVpvn(str "", sizeof(str) - 1)
32 __UNDEFINED__ sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1)
33 __UNDEFINED__ sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1)
34 __UNDEFINED__ hv_fetchs(hv,key,lval) hv_fetch(hv, key "", sizeof(key) - 1, lval)
35 __UNDEFINED__ hv_stores(hv,key,val,hash) hv_store(hv, key "", sizeof(key) - 1, val, hash)
42 XPUSHs(newSVpvs("newSVpvs"));
49 sv_catpvs(sv, "sv_catpvs");
55 sv_setpvs(sv, "sv_setpvs");
63 s = hv_fetchs((HV *) SvRV(hv), "hv_fetchs", 0);
64 XPUSHs(sv_mortalcopy(*s));
72 hv_stores((HV *) SvRV(hv), "hv_stores", SvREFCNT_inc(sv), 0);
78 ok(Devel::PPPort::newSVpvs(), "newSVpvs");
80 Devel::PPPort::sv_catpvs($x);
81 ok($x, "foosv_catpvs");
83 Devel::PPPort::sv_setpvs($x);
86 my %h = ('hv_fetchs' => 42);
87 Devel::PPPort::hv_stores(\%h, 4711);
88 ok(scalar keys %h, 2);
89 ok(exists $h{'hv_stores'});
90 ok($h{'hv_stores'}, 4711);
91 ok(Devel::PPPort::hv_fetchs(\%h), 42);