From: Doug MacEachern Date: Sun, 18 Feb 2001 14:49:33 +0000 (-0800) Subject: [patch] add sv_setref_uv X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4030fe4ad6ddcf55e0341ef163ebb1419014d565;p=p5sagit%2Fp5-mst-13.2.git [patch] add sv_setref_uv Message-ID: p4raw-id: //depot/perl@8840 --- diff --git a/embed.h b/embed.h index 9a8e442..a101d23 100644 --- a/embed.h +++ b/embed.h @@ -698,6 +698,7 @@ #define sv_setuv Perl_sv_setuv #define sv_setnv Perl_sv_setnv #define sv_setref_iv Perl_sv_setref_iv +#define sv_setref_uv Perl_sv_setref_uv #define sv_setref_nv Perl_sv_setref_nv #define sv_setref_pv Perl_sv_setref_pv #define sv_setref_pvn Perl_sv_setref_pvn @@ -2186,6 +2187,7 @@ #define sv_setuv(a,b) Perl_sv_setuv(aTHX_ a,b) #define sv_setnv(a,b) Perl_sv_setnv(aTHX_ a,b) #define sv_setref_iv(a,b,c) Perl_sv_setref_iv(aTHX_ a,b,c) +#define sv_setref_uv(a,b,c) Perl_sv_setref_uv(aTHX_ a,b,c) #define sv_setref_nv(a,b,c) Perl_sv_setref_nv(aTHX_ a,b,c) #define sv_setref_pv(a,b,c) Perl_sv_setref_pv(aTHX_ a,b,c) #define sv_setref_pvn(a,b,c,d) Perl_sv_setref_pvn(aTHX_ a,b,c,d) @@ -4290,6 +4292,8 @@ #define sv_setnv Perl_sv_setnv #define Perl_sv_setref_iv CPerlObj::Perl_sv_setref_iv #define sv_setref_iv Perl_sv_setref_iv +#define Perl_sv_setref_uv CPerlObj::Perl_sv_setref_uv +#define sv_setref_uv Perl_sv_setref_uv #define Perl_sv_setref_nv CPerlObj::Perl_sv_setref_nv #define sv_setref_nv Perl_sv_setref_nv #define Perl_sv_setref_pv CPerlObj::Perl_sv_setref_pv diff --git a/embed.pl b/embed.pl index 1cdc4a2..f1bfd41 100755 --- a/embed.pl +++ b/embed.pl @@ -2045,6 +2045,7 @@ Apd |void |sv_setpviv |SV* sv|IV num Apd |void |sv_setuv |SV* sv|UV num Apd |void |sv_setnv |SV* sv|NV num Apd |SV* |sv_setref_iv |SV* rv|const char* classname|IV iv +Apd |SV* |sv_setref_uv |SV* rv|const char* classname|UV uv Apd |SV* |sv_setref_nv |SV* rv|const char* classname|NV nv Apd |SV* |sv_setref_pv |SV* rv|const char* classname|void* pv Apd |SV* |sv_setref_pvn |SV* rv|const char* classname|char* pv \ diff --git a/global.sym b/global.sym index 5ab9c71..cdc36aa 100644 --- a/global.sym +++ b/global.sym @@ -437,6 +437,7 @@ Perl_sv_setpviv Perl_sv_setuv Perl_sv_setnv Perl_sv_setref_iv +Perl_sv_setref_uv Perl_sv_setref_nv Perl_sv_setref_pv Perl_sv_setref_pvn diff --git a/objXSUB.h b/objXSUB.h index 1fd1839..2549344 100644 --- a/objXSUB.h +++ b/objXSUB.h @@ -1753,6 +1753,10 @@ #define Perl_sv_setref_iv pPerl->Perl_sv_setref_iv #undef sv_setref_iv #define sv_setref_iv Perl_sv_setref_iv +#undef Perl_sv_setref_uv +#define Perl_sv_setref_uv pPerl->Perl_sv_setref_uv +#undef sv_setref_uv +#define sv_setref_uv Perl_sv_setref_uv #undef Perl_sv_setref_nv #define Perl_sv_setref_nv pPerl->Perl_sv_setref_nv #undef sv_setref_nv diff --git a/perlapi.c b/perlapi.c index 726be51..644bef8 100644 --- a/perlapi.c +++ b/perlapi.c @@ -3178,6 +3178,13 @@ Perl_sv_setref_iv(pTHXo_ SV* rv, const char* classname, IV iv) return ((CPerlObj*)pPerl)->Perl_sv_setref_iv(rv, classname, iv); } +#undef Perl_sv_setref_uv +SV* +Perl_sv_setref_uv(pTHXo_ SV* rv, const char* classname, UV uv) +{ + return ((CPerlObj*)pPerl)->Perl_sv_setref_uv(rv, classname, uv); +} + #undef Perl_sv_setref_nv SV* Perl_sv_setref_nv(pTHXo_ SV* rv, const char* classname, NV nv) diff --git a/pod/perlapi.pod b/pod/perlapi.pod index ef3a260..7b6ad4a 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -2368,19 +2368,19 @@ false, defined or undefined. Does not handle 'get' magic. =for hackers Found in file sv.h -=item svtype +=item SvTYPE -An enum of flags for Perl types. These are found in the file B -in the C enum. Test these flags with the C macro. +Returns the type of the SV. See C. + + svtype SvTYPE(SV* sv) =for hackers Found in file sv.h -=item SvTYPE - -Returns the type of the SV. See C. +=item svtype - svtype SvTYPE(SV* sv) +An enum of flags for Perl types. These are found in the file B +in the C enum. Test these flags with the C macro. =for hackers Found in file sv.h @@ -3011,6 +3011,19 @@ Note that C copies the pointer while this copies the string. =for hackers Found in file sv.c +=item sv_setref_uv + +Copies an unsigned integer into a new SV, optionally blessing the SV. The C +argument will be upgraded to an RV. That RV will be modified to point to +the new SV. The C argument indicates the package for the +blessing. Set C to C to avoid the blessing. The new SV +will be returned and will have a reference count of 1. + + SV* sv_setref_uv(SV* rv, const char* classname, UV uv) + +=for hackers +Found in file sv.c + =item sv_setsv Copies the contents of the source SV C into the destination SV C. diff --git a/pod/perlguts.pod b/pod/perlguts.pod index 54d0715..557dbaf 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -530,10 +530,11 @@ class. SV is returned. SV* newSVrv(SV* rv, const char* classname); -Copies integer or double into an SV whose reference is C. SV is blessed +Copies integer, unsigned integer or double into an SV whose reference is C. SV is blessed if C is non-null. SV* sv_setref_iv(SV* rv, const char* classname, IV iv); + SV* sv_setref_uv(SV* rv, const char* classname, UV uv); SV* sv_setref_nv(SV* rv, const char* classname, NV iv); Copies the pointer value (I) into an SV whose diff --git a/proto.h b/proto.h index 10ef21a..a33e8b7 100644 --- a/proto.h +++ b/proto.h @@ -779,6 +779,7 @@ PERL_CALLCONV void Perl_sv_setpviv(pTHX_ SV* sv, IV num); PERL_CALLCONV void Perl_sv_setuv(pTHX_ SV* sv, UV num); PERL_CALLCONV void Perl_sv_setnv(pTHX_ SV* sv, NV num); PERL_CALLCONV SV* Perl_sv_setref_iv(pTHX_ SV* rv, const char* classname, IV iv); +PERL_CALLCONV SV* Perl_sv_setref_uv(pTHX_ SV* rv, const char* classname, UV uv); PERL_CALLCONV SV* Perl_sv_setref_nv(pTHX_ SV* rv, const char* classname, NV nv); PERL_CALLCONV SV* Perl_sv_setref_pv(pTHX_ SV* rv, const char* classname, void* pv); PERL_CALLCONV SV* Perl_sv_setref_pvn(pTHX_ SV* rv, const char* classname, char* pv, STRLEN n); diff --git a/sv.c b/sv.c index ea360c3..eeda889 100644 --- a/sv.c +++ b/sv.c @@ -6349,6 +6349,25 @@ Perl_sv_setref_iv(pTHX_ SV *rv, const char *classname, IV iv) } /* +=for apidoc sv_setref_uv + +Copies an unsigned integer into a new SV, optionally blessing the SV. The C +argument will be upgraded to an RV. That RV will be modified to point to +the new SV. The C argument indicates the package for the +blessing. Set C to C to avoid the blessing. The new SV +will be returned and will have a reference count of 1. + +=cut +*/ + +SV* +Perl_sv_setref_uv(pTHX_ SV *rv, const char *classname, UV uv) +{ + sv_setuv(newSVrv(rv,classname), uv); + return rv; +} + +/* =for apidoc sv_setref_nv Copies a double into a new SV, optionally blessing the SV. The C