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

[email protected]
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.