develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35718 - trunk/languages/WMLScript/pmc

From:
fperrad
Date:
January 18, 2009 06:13
Subject:
[svn:parrot] r35718 - trunk/languages/WMLScript/pmc
Message ID:
20090118141343.AA1C1CB9AE@x12.develooper.com
Author: fperrad
Date: Sun Jan 18 06:13:42 2009
New Revision: 35718

Modified:
   trunk/languages/WMLScript/pmc/wmlsfloat.pmc
   trunk/languages/WMLScript/pmc/wmlsstring.pmc

Log:
[WMLScript]
make WmlsFloat use ATTRs, remove most remaining uses of PMC_num_val
(see r35666)

Modified: trunk/languages/WMLScript/pmc/wmlsfloat.pmc
==============================================================================
--- trunk/languages/WMLScript/pmc/wmlsfloat.pmc	(original)
+++ trunk/languages/WMLScript/pmc/wmlsfloat.pmc	Sun Jan 18 06:13:42 2009
@@ -50,6 +50,8 @@
     group wmls_group
     hll wmlscript maps Float {
 
+    ATTR FLOATVAL fv;
+
 /* Class initialization. Caches constant strings that will be used later.
 */
     void class_init() {
@@ -103,7 +105,7 @@
 
 */
     VTABLE void set_integer_native(INTVAL value) {
-        PMC_num_val(SELF) = (FLOATVAL)value;
+        SET_ATTR_fv(INTERP, SELF, (FLOATVAL)value);
     }
 
 /*
@@ -116,8 +118,9 @@
 
 */
     VTABLE PMC* neg(PMC* dest) {
+        FLOATVAL result = - SELF.get_number();
         dest = pmc_new(INTERP, dynpmc_WmlsFloat);
-        PMC_num_val(dest) = - SELF.get_number();
+        VTABLE_set_number_native(INTERP, dest, result);
         return dest;
     }
 

Modified: trunk/languages/WMLScript/pmc/wmlsstring.pmc
==============================================================================
--- trunk/languages/WMLScript/pmc/wmlsstring.pmc	(original)
+++ trunk/languages/WMLScript/pmc/wmlsstring.pmc	Sun Jan 18 06:13:42 2009
@@ -160,8 +160,9 @@
             return dest;
         }
         if (trans->vtable->base_type == dynpmc_WmlsFloat) {
+            FLOATVAL result = - VTABLE_get_number(INTERP, trans);
             dest = pmc_new(INTERP, dynpmc_WmlsFloat);
-            PMC_num_val(dest) = - VTABLE_get_number(INTERP, trans);
+            VTABLE_set_number_native(INTERP, dest, result);
             return dest;
         }
         return pmc_new(INTERP, dynpmc_WmlsInvalid);
@@ -1539,7 +1540,7 @@
             if (fabs(d) < 1.17549435e-38)
                 d = 0.0;
 
-            PMC_num_val(retval) = d;
+            VTABLE_set_number_native(INTERP, retval, d);
         }
         else
             retval = pmc_new(INTERP, dynpmc_WmlsInvalid);



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About