[svn:ponie] rev 315 - trunk/perl
[email protected] 8 Jul 2005 16:53:54 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: nicholas
Date: Fri Jul 8 09:53:54 2005
New Revision: 315
Modified:
trunk/perl/embed.fnc
trunk/perl/sv.c
trunk/perl/sv.h
Log:
Send sv_setnv and sv_setnv_mg via the PMC's set interface.
Modified: trunk/perl/embed.fnc
==============================================================================
--- trunk/perl/embed.fnc (original)
+++ trunk/perl/embed.fnc Fri Jul 8 09:53:54 2005
@@ -778,6 +778,9 @@ Apd |bool |sv_cat_decode |SV* dsv|SV *en
Apd |char* |sv_reftype |const SV* sv|int ob
Apd |void |sv_replace |SV* sv|SV* nsv
Apd |void |sv_report_used
+#if defined(PERL_CORE) || defined(PONIE_CORE)
+Apd |void |sv_setnv_backend |SV* sv|NV num|I32 flags
+#endif
Apd |void |sv_reset |const char* s|HV* stash
Afpd |void |sv_setpvf |SV* sv|const char* pat|...
Apd |void |sv_vsetpvf |SV* sv|const char* pat|va_list* args
Modified: trunk/perl/sv.c
==============================================================================
--- trunk/perl/sv.c (original)
+++ trunk/perl/sv.c Fri Jul 8 09:53:54 2005
@@ -1218,17 +1218,8 @@ Perl_sv_setuv_mg(pTHX_ register SV *sv,
SvSETMAGIC(sv);
}
-/*
-=for apidoc sv_setnv
-
-Copies a double into the given SV, upgrading first if necessary.
-Does not handle 'set' magic. See also C<sv_setnv_mg>.
-
-=cut
-*/
-
void
-Perl_sv_setnv(pTHX_ register SV *sv, NV num)
+Perl_sv_setnv_backend(pTHX_ register SV *sv, NV num, I32 flags)
{
SV_CHECK_THINKFIRST_COW_DROP(sv);
switch (SvTYPE(sv)) {
@@ -1254,6 +1245,9 @@ Perl_sv_setnv(pTHX_ register SV *sv, NV
SvNV_set(sv, num);
(void)SvNOK_only(sv); /* validate number */
SvTAINT(sv);
+ if (flags & SV_SMAGIC)
+ SvSETMAGIC(sv);
+
}
/*
@@ -1267,14 +1261,30 @@ Like C<sv_setnv>, but also handles 'set'
void
Perl_sv_setnv_mg(pTHX_ register SV *sv, NV num)
{
- sv_setnv(sv,num);
- SvSETMAGIC(sv);
+ Parrot_PMC_set_numval(PL_Parrot, MUMBLE(sv), num);
}
/* Print an "isn't numeric" warning, using a cleaned-up,
* printable version of the offending string
*/
+
+/*
+=for apidoc sv_setnv
+
+Copies a double into the given SV, upgrading first if necessary.
+Does not handle 'set' magic. See also C<sv_setnv_mg>.
+
+=cut
+*/
+
+void
+Perl_sv_setnv(pTHX_ register SV *sv, NV num)
+{
+ Parrot_PMC_set_numval_intkey(PL_Parrot, MUMBLE(sv), Ponie_N_SV_NV_NO_GMAGIC,
+ num);
+}
+
STATIC void
S_not_a_number(pTHX_ SV *sv)
{
Modified: trunk/perl/sv.h
==============================================================================
--- trunk/perl/sv.h (original)
+++ trunk/perl/sv.h Fri Jul 8 09:53:54 2005
@@ -341,6 +341,11 @@ typedef enum {
Ponie_S_MAX
} Ponie_strings;
+typedef enum {
+ Ponie_N_SV_NV_NO_GMAGIC,
+ Ponie_N_MAX
+} Ponie_numbers;
+
#define SVTYPEMASK 0xff
#define SvTYPE(sv) ((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SV_TYPE))
#ifdef PERL_CORE
@@ -1308,6 +1313,7 @@ Like C<sv_catsv> but doesn't process mag
#define SV_COW_DROP_PV 4
#define SV_UTF8_NO_ENCODING 8
#define SV_NOSTEAL 16
+#define SV_SMAGIC 32
/* We are about to replace the SV's current value. So if it's copy on write
we need to normalise it. Use the SV_COW_DROP_PV flag hint to say that