[svn:parrot] r36355 - trunk/languages/lua/src/pmc

fperrad at svn.parrot.org fperrad at svn.parrot.org
Wed Feb 4 16:29:30 UTC 2009


Author: fperrad
Date: Wed Feb  4 16:29:28 2009
New Revision: 36355
URL: https://trac.parrot.org/parrot/changeset/36355

Log:
[Lua] some consting

Modified:
   trunk/languages/lua/src/pmc/lua.pmc
   trunk/languages/lua/src/pmc/luaany.pmc
   trunk/languages/lua/src/pmc/luaboolean.pmc
   trunk/languages/lua/src/pmc/luanil.pmc
   trunk/languages/lua/src/pmc/luanumber.pmc
   trunk/languages/lua/src/pmc/luastring.pmc
   trunk/languages/lua/src/pmc/luatable.pmc
   trunk/languages/lua/src/pmc/luauserdata.pmc

Modified: trunk/languages/lua/src/pmc/lua.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/lua.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/lua.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -89,8 +89,8 @@
 
 */
     METHOD PMC* clock() {
-        PMC     *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        FLOATVAL f      = (clock())/(FLOATVAL)CLOCKS_PER_SEC;
+        const FLOATVAL f = clock() / (FLOATVAL)CLOCKS_PER_SEC;
+        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, f);
         RETURN(PMC *retval);
     }

Modified: trunk/languages/lua/src/pmc/luaany.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luaany.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/luaany.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -155,7 +155,7 @@
 
 */
     VTABLE PMC* get_pmc_keyed(PMC *key) {
-        PMC *meth = find_meth(INTERP, SELF, "__index");
+        PMC * const meth = find_meth(INTERP, SELF, "__index");
 
         if (meth) {
             if (dynpmc_LuaFunction == PMC_type(meth)) {
@@ -184,7 +184,7 @@
 
 */
     VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
-        PMC *meth = find_meth(INTERP, SELF, "__newindex");
+        PMC * const meth = find_meth(INTERP, SELF, "__newindex");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -210,7 +210,7 @@
 
 */
     VTABLE PMC* neg(PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__unm");
+        PMC * const meth = find_meth(INTERP, SELF, "__unm");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -225,7 +225,7 @@
     }
 
     VTABLE void i_neg() {
-        PMC *meth = find_meth(INTERP, SELF, "__unm");
+        PMC * const  meth = find_meth(INTERP, SELF, "__unm");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -247,8 +247,9 @@
 
 */
     VTABLE PMC* logical_not(PMC *dest) {
+        const INTVAL result = ! SELF.get_bool();
         dest = pmc_new(INTERP, dynpmc_LuaBoolean);
-        VTABLE_set_bool(INTERP, dest, ! SELF.get_bool());
+        VTABLE_set_bool(INTERP, dest, result);
         return dest;
     }
 
@@ -275,7 +276,7 @@
 
 */
     VTABLE opcode_t* invoke(void *next) {
-        PMC *meth = find_meth(INTERP, SELF, "__call");
+        PMC * const meth = find_meth(INTERP, SELF, "__call");
         PMC *retval;
 
         if (!meth)
@@ -335,7 +336,7 @@
 
 */
     MULTI PMC* add(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__add");
+        PMC * const meth = find_meth(INTERP, SELF, "__add");
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
                 "attempt to perform arithmetic on a %Ss value", SELF.name());
@@ -349,7 +350,7 @@
     }
 
     MULTI void i_add(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, SELF, "__add");
+        PMC * const meth = find_meth(INTERP, SELF, "__add");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -361,7 +362,7 @@
     }
 
     MULTI PMC* subtract(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__sub");
+        PMC * const meth = find_meth(INTERP, SELF, "__sub");
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
                 "attempt to perform arithmetic on a %Ss value", SELF.name());
@@ -375,7 +376,7 @@
     }
 
     MULTI void i_subtract(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, SELF, "__sub");
+        PMC * const meth = find_meth(INTERP, SELF, "__sub");
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
                 "attempt to perform arithmetic on a %Ss value", SELF.name());
@@ -387,7 +388,7 @@
     }
 
     MULTI PMC* multiply(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__mul");
+        PMC * const meth = find_meth(INTERP, SELF, "__mul");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -402,7 +403,7 @@
     }
 
     MULTI void i_multiply(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, SELF, "__mul");
+        PMC * const meth = find_meth(INTERP, SELF, "__mul");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -415,7 +416,7 @@
     }
 
     MULTI PMC* divide(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__div");
+        PMC * const meth = find_meth(INTERP, SELF, "__div");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -430,7 +431,7 @@
     }
 
     MULTI void i_divide(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, SELF, "__div");
+        PMC * const meth = find_meth(INTERP, SELF, "__div");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -443,7 +444,7 @@
     }
 
     MULTI PMC* modulus(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__mod");
+        PMC * const meth = find_meth(INTERP, SELF, "__mod");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -458,7 +459,7 @@
     }
 
     MULTI void i_modulus(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, SELF, "__mod");
+        PMC * const meth = find_meth(INTERP, SELF, "__mod");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -471,7 +472,7 @@
     }
 
     MULTI PMC* pow(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__pow");
+        PMC * const meth = find_meth(INTERP, SELF, "__pow");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -486,7 +487,7 @@
     }
 
     MULTI void i_pow(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, SELF, "__pow");
+        PMC * const meth = find_meth(INTERP, SELF, "__pow");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -499,7 +500,7 @@
     }
 
     MULTI PMC* concatenate(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, SELF, "__concat");
+        PMC * const meth = find_meth(INTERP, SELF, "__concat");
 
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -514,7 +515,7 @@
     }
 
     MULTI void i_concatenate(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, SELF, "__concat");
+        PMC * const meth = find_meth(INTERP, SELF, "__concat");
         if (!meth)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
                 "attempt to concatenate a %Ss value", SELF.name());
@@ -554,8 +555,8 @@
     }
 
     MULTI INTVAL cmp(DEFAULT value) {
-        STRING *self_name = SELF.name();
-        STRING *val_name  = VTABLE_name(INTERP, value);
+        STRING * const self_name = SELF.name();
+        STRING * const val_name  = VTABLE_name(INTERP, value);
 
         if (Parrot_str_compare(INTERP, self_name, val_name) != 0)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
@@ -592,7 +593,7 @@
 
 */
     METHOD PMC* len() {
-        PMC *meth = find_meth(INTERP, SELF, "__len");
+        PMC * const meth = find_meth(INTERP, SELF, "__len");
         PMC *retval;
 
         if (!meth)
@@ -633,7 +634,7 @@
 
 */
     METHOD PMC* tostring() {
-        PMC *meth = find_meth(INTERP, SELF, "__tostring");
+        PMC * const meth = find_meth(INTERP, SELF, "__tostring");
         PMC *retval;
 
         if (meth) {

Modified: trunk/languages/lua/src/pmc/luaboolean.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luaboolean.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/luaboolean.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -76,13 +76,13 @@
 
 */
     VTABLE PMC* instantiate_str(STRING *rep, INTVAL flags) {
-        const INTVAL type = SELF->vtable->base_type;
+        const INTVAL type = PMC_type(SELF);
         PMC * const res =
             (flags & PObj_constant_FLAG)
                 ? constant_pmc_new(INTERP, type)
                 : pmc_new(INTERP, type);
-
-        SET_ATTR_iv(INTERP, res, Parrot_str_to_int(INTERP, rep) != 0);
+        const INTVAL iv = Parrot_str_to_int(INTERP, rep) != 0;
+        SET_ATTR_iv(INTERP, res, iv);
         return res;
     }
 
@@ -110,7 +110,7 @@
 */
     VTABLE PMC* clone() {
         INTVAL iv;
-        PMC *dest = pmc_new(INTERP, SELF->vtable->base_type);
+        PMC *dest = pmc_new(INTERP, PMC_type(SELF));
         GET_ATTR_iv(INTERP, SELF, iv);
         SET_ATTR_iv(INTERP, dest, iv);
         return dest;
@@ -264,8 +264,8 @@
     METHOD PMC* rawequal(PMC *value) {
         PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
 
-        if (PMC_type(SELF)    == PMC_type(value)
-        &&  VTABLE_get_integer(INTERP, SELF) == VTABLE_get_integer(INTERP, value))
+        if (PMC_type(SELF) == PMC_type(value)
+         && VTABLE_get_integer(INTERP, SELF) == VTABLE_get_integer(INTERP, value))
             VTABLE_set_integer_native(INTERP, retval, 1);
         else
             VTABLE_set_integer_native(INTERP, retval, 0);

Modified: trunk/languages/lua/src/pmc/luanil.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luanil.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/luanil.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -50,12 +50,11 @@
 
 */
     VTABLE PMC* instantiate_str(STRING *rep, INTVAL flags) {
-        PMC *res;
-        INTVAL type = PMC_type(SELF);
-        if (flags & PObj_constant_FLAG)
-            res = constant_pmc_new(INTERP, type);
-        else
-            res = pmc_new(INTERP, type);
+        const INTVAL type = PMC_type(SELF);
+        PMC * const res =
+            (flags & PObj_constant_FLAG)
+                ? constant_pmc_new(INTERP, type)
+                : pmc_new(INTERP, type);
         return res;
     }
 

Modified: trunk/languages/lua/src/pmc/luanumber.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luanumber.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/luanumber.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -81,13 +81,13 @@
 
 */
     VTABLE PMC *instantiate_str(STRING *rep, INTVAL flags) {
-        const INTVAL type = SELF->vtable->base_type;
+        const INTVAL type = PMC_type(SELF);
         PMC * const res =
             (flags & PObj_constant_FLAG)
                 ? constant_pmc_new(INTERP, type)
                 : pmc_new(INTERP, type);
-
-        SET_ATTR_fv(INTERP, res, Parrot_str_to_num(INTERP, rep));
+        const FLOATVAL fv = Parrot_str_to_num(INTERP, rep);
+        SET_ATTR_fv(INTERP, res, fv);
         return res;
     }
 
@@ -115,7 +115,7 @@
 */
     VTABLE PMC *clone() {
         FLOATVAL fv;
-        PMC *dest = pmc_new(INTERP, SELF->vtable->base_type);
+        PMC *dest = pmc_new(INTERP, PMC_type(SELF));
         GET_ATTR_fv(INTERP, SELF, fv);
         SET_ATTR_fv(INTERP, dest, fv);
         return dest;
@@ -131,9 +131,9 @@
 
 */
     VTABLE INTVAL get_integer() {
-        /* two steps avoid casting warnings */
-        FLOATVAL n = SELF.get_number();
-        return (INTVAL) n;
+        FLOATVAL fv;
+        GET_ATTR_fv(INTERP, SELF, fv);
+        return (INTVAL) fv;
     }
 
 /*
@@ -252,9 +252,9 @@
 
 */
     VTABLE PMC *neg(PMC *dest) {
-        FLOATVAL a = -SELF.get_number();
+        const FLOATVAL n = - SELF.get_number();
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, dest, a);
+        VTABLE_set_number_native(INTERP, dest, n);
         return dest;
     }
 
@@ -266,8 +266,8 @@
 
 */
     VTABLE void i_neg() {
-        FLOATVAL a = -SELF.get_number();
-        SELF.set_number_native(a);
+        const FLOATVAL n = - SELF.get_number();
+        SELF.set_number_native(n);
     }
 
 /*
@@ -317,9 +317,10 @@
 */
 
     MULTI PMC *add(LuaNumber value, PMC *dest) {
+        const FLOATVAL n = SELF.get_number()
+                         + VTABLE_get_number(INTERP, value);
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, dest,
-                SELF.get_number() + VTABLE_get_number(INTERP, value));
+        VTABLE_set_number_native(INTERP, dest, n);
         return dest;
     }
 
@@ -337,7 +338,7 @@
     }
 
     MULTI PMC *add(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__add");
+        PMC * const meth = find_meth(INTERP, value, "__add");
 
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -360,7 +361,8 @@
 
 */
     MULTI void i_add(LuaNumber value) {
-        FLOATVAL n = SELF.get_number() + VTABLE_get_number(INTERP, value);
+        const FLOATVAL n = SELF.get_number()
+                         + VTABLE_get_number(INTERP, value);
         SELF.set_number_native(n);
     }
 
@@ -378,7 +380,7 @@
     }
 
     MULTI void i_add(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__add");
+        PMC * const meth = find_meth(INTERP, value, "__add");
 
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -401,11 +403,10 @@
 
 */
     MULTI PMC *subtract(LuaNumber value, PMC *dest) {
+        const FLOATVAL n = SELF.get_number()
+                         - VTABLE_get_number(INTERP, value);
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
-
-        VTABLE_set_number_native(INTERP, dest,
-                SELF.get_number() - VTABLE_get_number(INTERP, value));
-
+        VTABLE_set_number_native(INTERP, dest, n);
         return dest;
     }
 
@@ -423,7 +424,7 @@
     }
 
     MULTI PMC *subtract(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__sub");
+        PMC * const meth = find_meth(INTERP, value, "__sub");
 
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -447,7 +448,8 @@
 
 */
     MULTI void i_subtract(LuaNumber value) {
-        FLOATVAL n = SELF.get_number() - VTABLE_get_number(INTERP, value);
+        const FLOATVAL n = SELF.get_number()
+                         - VTABLE_get_number(INTERP, value);
         SELF.set_number_native(n);
     }
 
@@ -465,7 +467,7 @@
     }
 
     MULTI void i_subtract(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__sub");
+        PMC * const meth = find_meth(INTERP, value, "__sub");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (! SELF)
@@ -487,9 +489,10 @@
 
 */
     MULTI PMC *multiply(LuaNumber value, PMC *dest) {
+        const FLOATVAL n = SELF.get_number()
+                         * VTABLE_get_number(INTERP, value);
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, dest,
-                SELF.get_number() * VTABLE_get_number(INTERP, value));
+        VTABLE_set_number_native(INTERP, dest, n);
         return dest;
     }
 
@@ -507,7 +510,7 @@
     }
 
     MULTI PMC *multiply(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__mul");
+        PMC * const meth = find_meth(INTERP, value, "__mul");
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(dest))
@@ -529,7 +532,7 @@
 
 */
     MULTI void i_multiply(LuaNumber value) {
-        FLOATVAL n = SELF.get_number() * VTABLE_get_number(INTERP, value);
+        const FLOATVAL n = SELF.get_number() * VTABLE_get_number(INTERP, value);
         SELF.set_number_native(n);
     }
 
@@ -547,7 +550,7 @@
     }
 
     MULTI void i_multiply(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__mul");
+        PMC * const meth = find_meth(INTERP, value, "__mul");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (! SELF)
@@ -569,9 +572,10 @@
 
 */
     MULTI PMC *divide(LuaNumber value, PMC *dest) {
+        const FLOATVAL n = SELF.get_number()
+                         / VTABLE_get_number(INTERP, value);
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, dest,
-                SELF.get_number() / VTABLE_get_number(INTERP, value));
+        VTABLE_set_number_native(INTERP, dest, n);
         return dest;
     }
 
@@ -589,7 +593,7 @@
     }
 
     MULTI PMC *divide(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__div");
+        PMC * const meth = find_meth(INTERP, value, "__div");
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(dest))
@@ -611,8 +615,8 @@
 
 */
     MULTI void i_divide(LuaNumber value) {
-        FLOATVAL n = SELF.get_number()
-                    / VTABLE_get_number(INTERP, value);
+        const FLOATVAL n = SELF.get_number()
+                         / VTABLE_get_number(INTERP, value);
         SELF.set_number_native(n);
     }
 
@@ -630,7 +634,7 @@
     }
 
     MULTI void i_divide(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__div");
+        PMC * const meth = find_meth(INTERP, value, "__div");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (! SELF)
@@ -652,12 +656,11 @@
 
 */
     MULTI PMC *modulus(LuaNumber value, PMC *dest) {
-        FLOATVAL a = SELF.get_number();
-        FLOATVAL b = VTABLE_get_number(INTERP, value);
-        dest       = pmc_new(INTERP, dynpmc_LuaNumber);
-
-        VTABLE_set_number_native(INTERP, dest, a - floor(a/b)*b);
-
+        const FLOATVAL a = SELF.get_number();
+        const FLOATVAL b = VTABLE_get_number(INTERP, value);
+        const FLOATVAL n = a - floor(a / b) * b;
+        dest = pmc_new(INTERP, dynpmc_LuaNumber);
+        VTABLE_set_number_native(INTERP, dest, n);
         return dest;
     }
 
@@ -675,7 +678,7 @@
     }
 
     MULTI PMC *modulus(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__mod");
+        PMC * const meth = find_meth(INTERP, value, "__mod");
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(dest))
@@ -697,10 +700,10 @@
 
 */
     MULTI void i_modulus(LuaNumber value) {
-        FLOATVAL a = SELF.get_number();
-        FLOATVAL b = VTABLE_get_number(INTERP, value);
-
-        SELF.set_number_native(a - floor(a/b)*b);
+        const FLOATVAL a = SELF.get_number();
+        const FLOATVAL b = VTABLE_get_number(INTERP, value);
+        const FLOATVAL n = a - floor(a / b) * b;
+        SELF.set_number_native(n);
     }
 
     MULTI void i_modulus(LuaString value) {
@@ -717,7 +720,7 @@
     }
 
     MULTI void i_modulus(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__mod");
+        PMC * const meth = find_meth(INTERP, value, "__mod");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (! SELF)
@@ -739,9 +742,10 @@
 
 */
     MULTI PMC *pow(LuaNumber value, PMC *dest) {
+        const FLOATVAL n = pow(SELF.get_number(),
+                               VTABLE_get_number(INTERP, value));
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, dest,
-              pow(SELF.get_number(), VTABLE_get_number(INTERP, value)));
+        VTABLE_set_number_native(INTERP, dest, n);
         return dest;
     }
 
@@ -759,7 +763,7 @@
     }
 
     MULTI PMC *pow(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__pow");
+        PMC * const meth = find_meth(INTERP, value, "__pow");
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(dest))
@@ -781,8 +785,8 @@
 
 */
     MULTI void i_pow(LuaNumber value) {
-        FLOATVAL n = pow(SELF.get_number(),
-                        VTABLE_get_number(INTERP, value));
+        const FLOATVAL n = pow(SELF.get_number(),
+                               VTABLE_get_number(INTERP, value));
         SELF.set_number_native(n);
     }
 
@@ -800,7 +804,7 @@
     }
 
     MULTI void i_pow(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__pow");
+        PMC * const meth = find_meth(INTERP, value, "__pow");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (! SELF)
@@ -855,27 +859,23 @@
 
 */
     MULTI PMC *concatenate(LuaNumber value,  PMC *dest) {
-        STRING *s = Parrot_str_concat(INTERP, SELF.get_string(),
+        STRING * const s = Parrot_str_concat(INTERP, SELF.get_string(),
             VTABLE_get_string(INTERP, value), 0);
-
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_string_native(INTERP, dest, s);
-
         return dest;
     }
 
     MULTI PMC *concatenate(LuaString value,  PMC *dest) {
-        STRING *s = Parrot_str_concat(INTERP, SELF.get_string(),
+        STRING * const s = Parrot_str_concat(INTERP, SELF.get_string(),
             VTABLE_get_string(INTERP, value), 0);
-
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_string_native(INTERP, dest, s);
-
         return dest;
     }
 
     MULTI PMC *concatenate(DEFAULT value,  PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__concat");
+        PMC * const meth = find_meth(INTERP, value, "__concat");
 
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -899,19 +899,19 @@
 
 */
     MULTI void i_concatenate(LuaNumber value) {
-        STRING *s = SELF.get_string();
-        STRING *v = VTABLE_get_string(INTERP, value);
+        STRING * const s = SELF.get_string();
+        STRING * const v = VTABLE_get_string(INTERP, value);
         SELF.set_string_native(Parrot_str_append(INTERP, s, v));
     }
 
     MULTI void i_concatenate(LuaString value) {
-        STRING *s = SELF.get_string();
-        STRING *v = VTABLE_get_string(INTERP, value);
+        STRING * const s = SELF.get_string();
+        STRING * const v = VTABLE_get_string(INTERP, value);
         SELF.set_string_native(Parrot_str_append(INTERP, s, v));
     }
 
     MULTI void i_concatenate(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__concat");
+        PMC * const meth = find_meth(INTERP, value, "__concat");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
 
@@ -940,9 +940,9 @@
 
 */
     METHOD PMC* acosh() {
+        const FLOATVAL n = acosh(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 acosh(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -954,9 +954,9 @@
 
 */
     METHOD PMC* asinh() {
+        const FLOATVAL n = asinh(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 asinh(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -968,9 +968,9 @@
 
 */
     METHOD PMC* atanh() {
+        const FLOATVAL n = atanh(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 atanh(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -982,9 +982,9 @@
 
 */
     METHOD PMC* cbrt() {
+        const FLOATVAL n = cbrt(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 cbrt(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -996,10 +996,10 @@
 
 */
     METHOD PMC* copysign(PMC* y) {
+        const FLOATVAL n = copysign(VTABLE_get_number(INTERP, SELF),
+                                    VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 copysign(VTABLE_get_number(INTERP, SELF),
-                                          VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1011,9 +1011,9 @@
 
 */
     METHOD PMC* erf() {
+        const FLOATVAL n = erf(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 erf(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1025,9 +1025,9 @@
 
 */
     METHOD PMC* erfc() {
+        const FLOATVAL n = erfc(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 erfc(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1039,9 +1039,9 @@
 
 */
     METHOD PMC* exp2() {
+        const FLOATVAL n = exp2(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 exp2(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1053,9 +1053,9 @@
 
 */
     METHOD PMC* expm1() {
+        const FLOATVAL n = expm1(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 expm1(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1067,10 +1067,10 @@
 
 */
     METHOD PMC* fdim(PMC* y) {
+        const FLOATVAL n = fdim(VTABLE_get_number(INTERP, SELF),
+                                VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 fdim(VTABLE_get_number(INTERP, SELF),
-                                      VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1082,11 +1082,11 @@
 
 */
     METHOD PMC* fma(PMC* y, PMC* z) {
+        const FLOATVAL n = fma(VTABLE_get_number(INTERP, SELF),
+                               VTABLE_get_number(INTERP, y),
+                               VTABLE_get_number(INTERP, z));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 fma(VTABLE_get_number(INTERP, SELF),
-                                     VTABLE_get_number(INTERP, y),
-                                     VTABLE_get_number(INTERP, z)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1098,10 +1098,10 @@
 
 */
     METHOD PMC* fmax(PMC* y) {
+        const FLOATVAL n = fmax(VTABLE_get_number(INTERP, SELF),
+                                VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 fmax(VTABLE_get_number(INTERP, SELF),
-                                      VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1113,10 +1113,10 @@
 
 */
     METHOD PMC* fmin(PMC* y) {
+        const FLOATVAL n = fmin(VTABLE_get_number(INTERP, SELF),
+                                VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 fmin(VTABLE_get_number(INTERP, SELF),
-                                      VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1174,10 +1174,10 @@
 
 */
     METHOD PMC* hypot(PMC* y) {
+        const FLOATVAL n = hypot(VTABLE_get_number(INTERP, SELF),
+                                 VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 hypot(VTABLE_get_number(INTERP, SELF),
-                                       VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1189,9 +1189,9 @@
 
 */
     METHOD PMC* ilogb() {
+        const FLOATVAL n = ilogb(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 ilogb(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1203,9 +1203,9 @@
 
 */
     METHOD PMC* isfinite() {
+        const INTVAL b = isfinite(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-        VTABLE_set_bool(INTERP, retval,
-                        isfinite(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 
@@ -1217,9 +1217,9 @@
 
 */
     METHOD PMC* isinf() {
+        const INTVAL b = isinf(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-        VTABLE_set_bool(INTERP, retval,
-                        isinf(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 
@@ -1231,9 +1231,9 @@
 
 */
     METHOD PMC* isnan() {
+        const INTVAL b = isnan(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-        VTABLE_set_bool(INTERP, retval,
-                        isnan(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 
@@ -1245,9 +1245,9 @@
 
 */
     METHOD PMC* isnormal() {
+        const INTVAL b = isnormal(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-        VTABLE_set_bool(INTERP, retval,
-                        isnormal(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 
@@ -1259,11 +1259,10 @@
 
 */
     METHOD PMC* ldexp(PMC *expn) {
+        const FLOATVAL n = ldexp(VTABLE_get_number(INTERP, SELF),
+                                 VTABLE_get_integer(INTERP, expn));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-
-        VTABLE_set_number_native(INTERP, retval,
-                                 ldexp(VTABLE_get_number(INTERP, SELF),
-                                       VTABLE_get_integer(INTERP, expn)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1275,9 +1274,9 @@
 
 */
     METHOD PMC* lgamma() {
+        const FLOATVAL n = lgamma(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 lgamma(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1289,9 +1288,9 @@
 
 */
     METHOD PMC* log1p() {
+        const FLOATVAL n = log1p(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 log1p(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1303,9 +1302,9 @@
 
 */
     METHOD PMC* log2() {
+        const FLOATVAL n = log2(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 log2(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1317,9 +1316,9 @@
 
 */
     METHOD PMC* logb() {
+        const FLOATVAL n = logb(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 logb(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1354,9 +1353,9 @@
 
 */
     METHOD PMC* nearbyint() {
+        const FLOATVAL n = nearbyint(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 nearbyint(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1368,10 +1367,10 @@
 
 */
     METHOD PMC* nextafter(PMC* y) {
+        const FLOATVAL n = nextafter(VTABLE_get_number(INTERP, SELF),
+                                     VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 nextafter(VTABLE_get_number(INTERP, SELF),
-                                           VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1383,10 +1382,10 @@
 
 */
     METHOD PMC* nexttoward(PMC* y) {
+        const FLOATVAL n = nexttoward(VTABLE_get_number(INTERP, SELF),
+                                      VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 nexttoward(VTABLE_get_number(INTERP, SELF),
-                                            VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1400,7 +1399,7 @@
     METHOD PMC *rawequal(PMC *value) {
         PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
 
-        if (PMC_type(SELF)    == PMC_type(value)
+        if (PMC_type(SELF) == PMC_type(value)
         &&  VTABLE_get_number(INTERP, SELF) == VTABLE_get_number(INTERP, value))
             VTABLE_set_integer_native(INTERP, retval, 1);
         else
@@ -1417,10 +1416,10 @@
 
 */
     METHOD PMC* remainder(PMC* y) {
+        const FLOATVAL n = remainder(VTABLE_get_number(INTERP, SELF),
+                                     VTABLE_get_number(INTERP, y));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 remainder(VTABLE_get_number(INTERP, SELF),
-                                           VTABLE_get_number(INTERP, y)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1432,9 +1431,9 @@
 
 */
     METHOD PMC* rint() {
+        const FLOATVAL n = rint(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 rint(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1446,9 +1445,9 @@
 
 */
     METHOD PMC* round() {
+        const FLOATVAL n = round(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 round(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1460,10 +1459,10 @@
 
 */
     METHOD PMC* scalbn(PMC* ex) {
+        const FLOATVAL n = scalbn(VTABLE_get_number(INTERP, SELF),
+                                  VTABLE_get_number(INTERP, ex));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 scalbn(VTABLE_get_number(INTERP, SELF),
-                                        VTABLE_get_number(INTERP, ex)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1475,9 +1474,9 @@
 
 */
     METHOD PMC* signbit() {
+        const FLOATVAL n = signbit(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 signbit(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1489,9 +1488,9 @@
 
 */
     METHOD PMC* tgamma() {
+        const FLOATVAL n = tgamma(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 tgamma(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 
@@ -1503,9 +1502,9 @@
 
 */
     METHOD PMC* trunc() {
+        const FLOATVAL n = trunc(VTABLE_get_number(INTERP, SELF));
         PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
-        VTABLE_set_number_native(INTERP, retval,
-                                 trunc(VTABLE_get_number(INTERP, SELF)));
+        VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
 

Modified: trunk/languages/lua/src/pmc/luastring.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luastring.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/luastring.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -228,7 +228,7 @@
 
 */
     VTABLE INTVAL elements() {
-        return Parrot_str_byte_length(INTERP, PMC_str_val(SELF));
+        return Parrot_str_byte_length(INTERP, SELF.get_string());
     }
 
 /*
@@ -241,9 +241,9 @@
 
 */
     VTABLE void freeze(visit_info *info) {
-        IMAGE_IO *io = info->image_io;
+        IMAGE_IO * const io = info->image_io;
         SUPER(info);
-        VTABLE_push_string(INTERP, io, PMC_str_val(SELF));
+        VTABLE_push_string(INTERP, io, SELF.get_string());
     }
 
 /*
@@ -256,10 +256,10 @@
 
 */
     VTABLE void thaw(visit_info *info) {
-        IMAGE_IO *io = info->image_io;
+        IMAGE_IO * const io = info->image_io;
         SUPER(info);
         if (info->extra_flags == EXTRA_IS_NULL)
-            PMC_str_val(SELF) = VTABLE_shift_string(INTERP, io);
+            SELF.set_string_native(VTABLE_shift_string(INTERP, io));
     }
 
 /*
@@ -300,7 +300,7 @@
     }
 
     MULTI PMC* add(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__add");
+        PMC * const meth = find_meth(INTERP, value, "__add");
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(dest))
@@ -348,7 +348,7 @@
     }
 
     MULTI void i_add(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__add");
+        PMC * const meth = find_meth(INTERP, value, "__add");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(SELF))
@@ -394,7 +394,7 @@
     }
 
     MULTI PMC* subtract(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__sub");
+        PMC * const meth = find_meth(INTERP, value, "__sub");
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(dest))
@@ -442,7 +442,7 @@
     }
 
     MULTI void i_subtract(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__sub");
+        PMC * const meth = find_meth(INTERP, value, "__sub");
 
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -489,7 +489,7 @@
     }
 
     MULTI PMC* multiply(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__mul");
+        PMC * const meth = find_meth(INTERP, value, "__mul");
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(dest))
@@ -537,7 +537,7 @@
     }
 
     MULTI void i_multiply(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__mul");
+        PMC * const meth = find_meth(INTERP, value, "__mul");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(SELF))
@@ -583,7 +583,7 @@
     }
 
     MULTI PMC* divide(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__div");
+        PMC * const meth = find_meth(INTERP, value, "__div");
 
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -632,7 +632,7 @@
     }
 
     MULTI void i_divide(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__div");
+        PMC * const meth = find_meth(INTERP, value, "__div");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(SELF))
@@ -678,7 +678,7 @@
     }
 
     MULTI PMC* modulus(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__mod");
+        PMC * const meth = find_meth(INTERP, value, "__mod");
 
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -727,7 +727,7 @@
     }
 
     MULTI void i_modulus(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__mod");
+        PMC * const meth = find_meth(INTERP, value, "__mod");
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
             if (PMC_IS_NULL(SELF))
@@ -773,7 +773,7 @@
     }
 
     MULTI PMC* pow(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__pow");
+        PMC * const meth = find_meth(INTERP, value, "__pow");
 
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -822,7 +822,7 @@
     }
 
     MULTI void i_pow(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__pow");
+        PMC * const meth = find_meth(INTERP, value, "__pow");
 
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -848,8 +848,8 @@
 
 */
     MULTI INTVAL is_equal(LuaString value) {
-        STRING *s = PMC_str_val(SELF);
-        STRING *v = VTABLE_get_string(INTERP, value);
+        STRING * const s = SELF.get_string();
+        STRING * const v = VTABLE_get_string(INTERP, value);
         return (INTVAL)(0 == Parrot_str_not_equal(INTERP, s, v));
     }
 
@@ -871,8 +871,8 @@
 
 */
     MULTI INTVAL cmp(LuaString value) {
-        STRING *s = PMC_str_val(SELF);
-        STRING *v = VTABLE_get_string(INTERP, value);
+        STRING * const s = SELF.get_string();
+        STRING * const v = VTABLE_get_string(INTERP, value);
         return Parrot_str_compare(INTERP, s, v);
     }
 
@@ -890,7 +890,7 @@
 
 */
     MULTI PMC* concatenate(LuaNumber value, PMC *dest) {
-        STRING *s = Parrot_str_concat(INTERP,
+        STRING * const s = Parrot_str_concat(INTERP,
             SELF.get_string(), VTABLE_get_string(INTERP, value), 0);
 
         dest = pmc_new(INTERP, dynpmc_LuaString);
@@ -899,7 +899,7 @@
     }
 
     MULTI PMC* concatenate(LuaString value, PMC *dest) {
-        STRING *s = Parrot_str_concat(INTERP,
+        STRING * const s = Parrot_str_concat(INTERP,
             SELF.get_string(), VTABLE_get_string(INTERP, value), 0);
 
         dest = pmc_new(INTERP, dynpmc_LuaString);
@@ -908,7 +908,7 @@
     }
 
     MULTI PMC* concatenate(DEFAULT value, PMC *dest) {
-        PMC *meth = find_meth(INTERP, value, "__concat");
+        PMC * const meth = find_meth(INTERP, value, "__concat");
 
         if (meth) {
             dest = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -931,19 +931,19 @@
 
 */
     MULTI void i_concatenate(LuaNumber value) {
-        STRING *s = SELF.get_string();
-        STRING *v = VTABLE_get_string(INTERP, value);
+        STRING * const s = SELF.get_string();
+        STRING * const v = VTABLE_get_string(INTERP, value);
         SELF.set_string_native(Parrot_str_append(INTERP, s, v));
     }
 
     MULTI void i_concatenate(LuaString value) {
-        STRING *s = SELF.get_string();
-        STRING *v = VTABLE_get_string(INTERP, value);
+        STRING * const s = SELF.get_string();
+        STRING * const v = VTABLE_get_string(INTERP, value);
         SELF.set_string_native(Parrot_str_append(INTERP, s, v));
     }
 
     MULTI void i_concatenate(DEFAULT value) {
-        PMC *meth = find_meth(INTERP, value, "__concat");
+        PMC * const meth = find_meth(INTERP, value, "__concat");
 
         if (meth) {
             SELF = Parrot_runops_fromc_args(INTERP, meth, "PPP", SELF, value);
@@ -1006,7 +1006,7 @@
         PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
 
         if (PMC_type(SELF) == PMC_type(value)
-        && 0               == Parrot_str_not_equal(INTERP, PMC_str_val(SELF),
+        && 0               == Parrot_str_not_equal(INTERP, SELF.get_string(),
                                   VTABLE_get_string(INTERP, value)))
             VTABLE_set_bool(INTERP, retval, 1);
         else
@@ -1023,11 +1023,10 @@
 
 */
     METHOD PMC* tonumber() {
-        PMC     *retval;
-        STRING  *rep = SELF.get_string();
-        char    *s1  = Parrot_str_to_cstring(INTERP, rep);
-        char    *s2;
-        FLOATVAL d   = strtod(s1, &s2);
+        PMC *retval;
+        char * const s1 = Parrot_str_to_cstring(INTERP, SELF.get_string());
+        char *s2;
+        const FLOATVAL d = strtod(s1, &s2);
 
         /* at least one valid digit? */
         if (s1 != s2) {
@@ -1056,11 +1055,10 @@
 
 */
     METHOD PMC* tobase(INTVAL base) {
-        PMC          *retval;
-        STRING       *rep = SELF.get_string();
-        char         *s1  = Parrot_str_to_cstring(INTERP, rep);
-        char         *s2;
-        unsigned long n   = strtoul(s1, &s2, base);
+        PMC *retval;
+        char * const s1 = Parrot_str_to_cstring(INTERP, SELF.get_string());
+        char *s2;
+        const unsigned long n = strtoul(s1, &s2, base);
 
         /* at least one valid digit? */
         if (s1 != s2) {

Modified: trunk/languages/lua/src/pmc/luatable.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luatable.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/luatable.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -508,7 +508,7 @@
         if (pvalue)
             value = *pvalue;
         else {
-            PMC *meth = find_meth(INTERP, SELF, "__index");
+            PMC * const meth = find_meth(INTERP, SELF, "__index");
             if (meth) {
                 if (dynpmc_LuaFunction == PMC_type(meth)) {
                     value = Parrot_runops_fromc_args(INTERP, meth, "PPP",
@@ -536,7 +536,7 @@
 */
     VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
         if (! lua_get(INTERP, PMC_hash(SELF), key)) {
-            PMC *meth = find_meth(INTERP, SELF, "__newindex");
+            PMC * const meth = find_meth(INTERP, SELF, "__newindex");
             if (meth) {
                 if (dynpmc_LuaFunction == PMC_type(meth)) {
                     Parrot_runops_fromc_args(INTERP, meth, "vPPP", SELF,
@@ -605,7 +605,7 @@
 
 */
     MULTI INTVAL is_equal(LuaTable value) {
-        PMC *meth = find_meth(INTERP, SELF, "__eq");
+        PMC * const meth = find_meth(INTERP, SELF, "__eq");
         if (meth) {
             PMC *retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
                                                    SELF, value);
@@ -635,7 +635,7 @@
 */
     MULTI INTVAL cmp(LuaTable value) {
 #if 0
-        PMC *meth = find_meth(INTERP, SELF, "__cmp");
+        PMC * const meth = find_meth(INTERP, SELF, "__cmp");
         if (meth) {
             PMC *retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
                                                    SELF, value);
@@ -644,7 +644,7 @@
                 return (INTVAL)VTABLE_get_number(INTERP, retval);
         }
 #else
-        PMC *_lt = find_meth(INTERP, SELF, "__lt");
+        PMC * const _lt = find_meth(INTERP, SELF, "__lt");
 
         if (_lt) {
             PMC *retval = Parrot_runops_fromc_args(INTERP, _lt, "PPP",
@@ -654,7 +654,7 @@
             if (r)
                 return (INTVAL)-1;
             else {
-                PMC *_le = find_meth(INTERP, SELF, "__le");
+                PMC * const _le = find_meth(INTERP, SELF, "__le");
                 if (_le) {
                     retval = Parrot_runops_fromc_args(INTERP, _le, "PPP",
                                                       SELF, value);

Modified: trunk/languages/lua/src/pmc/luauserdata.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luauserdata.pmc	Wed Feb  4 16:13:02 2009	(r36354)
+++ trunk/languages/lua/src/pmc/luauserdata.pmc	Wed Feb  4 16:29:28 2009	(r36355)
@@ -107,7 +107,7 @@
 */
     VTABLE void destroy() {
         Parrot_LuaUserdata_attributes *u = PARROT_LUAUSERDATA(SELF);
-        PMC *meth = find_meth(INTERP, SELF, "__gc");
+        PMC * const meth = find_meth(INTERP, SELF, "__gc");
 
         if (meth)
             (void)Parrot_runops_fromc_args(INTERP, meth, "vP", SELF);
@@ -205,7 +205,7 @@
 
 */
     MULTI INTVAL is_equal(LuaUserdata value) {
-        PMC *meth = find_meth(INTERP, SELF, "__eq");
+        PMC * const meth = find_meth(INTERP, SELF, "__eq");
         if (meth) {
             PMC *retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
                                                    SELF, value);
@@ -234,7 +234,7 @@
 */
     MULTI INTVAL cmp(LuaUserdata value) {
 #if 0
-        PMC *meth = find_meth(INTERP, SELF, "__cmp");
+        PMC * const meth = find_meth(INTERP, SELF, "__cmp");
         if (meth) {
             PMC *retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
                                                    SELF, value);
@@ -243,7 +243,7 @@
                 return (INTVAL)VTABLE_get_number(INTERP, retval);
         }
 #else
-        PMC *_lt = find_meth(INTERP, SELF, "__lt");
+        PMC * const _lt = find_meth(INTERP, SELF, "__lt");
 
         if (_lt) {
             PMC *retval = Parrot_runops_fromc_args(INTERP, _lt, "PPP",
@@ -253,7 +253,7 @@
             if (r)
                 return (INTVAL)-1;
             else {
-                PMC *_le = find_meth(INTERP, SELF, "__le");
+                PMC * const _le = find_meth(INTERP, SELF, "__le");
                 if (_le) {
                     retval = Parrot_runops_fromc_args(INTERP, _le, "PPP",
                                                       SELF, value);


More information about the parrot-commits mailing list