[svn:parrot] r39560 - branches/tt761_keys_revamp/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Jun 14 10:16:21 UTC 2009


Author: bacek
Date: Sun Jun 14 10:16:20 2009
New Revision: 39560
URL: https://trac.parrot.org/parrot/changeset/39560

Log:
[pmc] Migrate all *Array*.get_iter to ArrayIterator

Modified:
   branches/tt761_keys_revamp/src/pmc/array.pmc
   branches/tt761_keys_revamp/src/pmc/fixedbooleanarray.pmc
   branches/tt761_keys_revamp/src/pmc/fixedfloatarray.pmc
   branches/tt761_keys_revamp/src/pmc/fixedintegerarray.pmc
   branches/tt761_keys_revamp/src/pmc/fixedpmcarray.pmc
   branches/tt761_keys_revamp/src/pmc/fixedstringarray.pmc

Modified: branches/tt761_keys_revamp/src/pmc/array.pmc
==============================================================================
--- branches/tt761_keys_revamp/src/pmc/array.pmc	Sun Jun 14 10:15:55 2009	(r39559)
+++ branches/tt761_keys_revamp/src/pmc/array.pmc	Sun Jun 14 10:16:20 2009	(r39560)
@@ -1184,19 +1184,7 @@
     }
 
     VTABLE PMC *get_iter() {
-        STRING * const name = CONST_STRING(interp, "set_key");
-        PMC * const iter = pmc_new_init(INTERP, enum_class_Iterator, SELF);
-        PMC * const key  = pmc_new(INTERP, enum_class_Key);
-        Parrot_PCCINVOKE(interp, iter, name, "P->", key);
-
-        PObj_get_FLAGS(key) |= KEY_integer_FLAG;
-
-        if (!((List *)PMC_data(SELF))->length)
-            VTABLE_set_integer_native(INTERP, key, -1);
-        else
-            VTABLE_set_integer_native(INTERP, key, 0);
-
-        return iter;
+        return pmc_new_init(INTERP, enum_class_ArrayIterator, SELF);
     }
 
 /*

Modified: branches/tt761_keys_revamp/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- branches/tt761_keys_revamp/src/pmc/fixedbooleanarray.pmc	Sun Jun 14 10:15:55 2009	(r39559)
+++ branches/tt761_keys_revamp/src/pmc/fixedbooleanarray.pmc	Sun Jun 14 10:16:20 2009	(r39560)
@@ -504,19 +504,7 @@
 */
 
     VTABLE PMC *get_iter() {
-        STRING     *name     = CONST_STRING(interp, "set_key");
-        PMC * const iter     = pmc_new_init(INTERP, enum_class_Iterator, SELF);
-        PMC * const key      = pmc_new(INTERP, enum_class_Key);
-
-        Parrot_PCCINVOKE(interp, iter, name, "P->", key);
-        PObj_get_FLAGS(key) |= KEY_integer_FLAG;
-
-        if (SELF.get_integer() == 0)
-            VTABLE_set_integer_native(INTERP, key, -1);
-        else
-            VTABLE_set_integer_native(INTERP, key, 0);
-
-        return iter;
+        return pmc_new_init(INTERP, enum_class_ArrayIterator, SELF);
     }
 
 

Modified: branches/tt761_keys_revamp/src/pmc/fixedfloatarray.pmc
==============================================================================
--- branches/tt761_keys_revamp/src/pmc/fixedfloatarray.pmc	Sun Jun 14 10:15:55 2009	(r39559)
+++ branches/tt761_keys_revamp/src/pmc/fixedfloatarray.pmc	Sun Jun 14 10:16:20 2009	(r39560)
@@ -107,19 +107,7 @@
 */
 
     VTABLE PMC *get_iter() {
-        STRING     *name     = CONST_STRING(interp, "set_key");
-        PMC * const iter     = pmc_new_init(INTERP, enum_class_Iterator, SELF);
-        PMC * const key      = pmc_new(INTERP, enum_class_Key);
-
-        Parrot_PCCINVOKE(interp, iter, name, "P->", key);
-        PObj_get_FLAGS(key) |= KEY_integer_FLAG;
-
-        if (SELF.get_integer() == 0)
-            VTABLE_set_integer_native(INTERP, key, -1);
-        else
-            VTABLE_set_integer_native(INTERP, key, 0);
-
-        return iter;
+        return pmc_new_init(INTERP, enum_class_ArrayIterator, SELF);
     }
 
 /*

Modified: branches/tt761_keys_revamp/src/pmc/fixedintegerarray.pmc
==============================================================================
--- branches/tt761_keys_revamp/src/pmc/fixedintegerarray.pmc	Sun Jun 14 10:15:55 2009	(r39559)
+++ branches/tt761_keys_revamp/src/pmc/fixedintegerarray.pmc	Sun Jun 14 10:16:20 2009	(r39560)
@@ -597,22 +597,7 @@
 */
 
     VTABLE PMC *get_iter() {
-        STRING     *name = CONST_STRING(interp, "set_key");
-        PMC * const iter = pmc_new_init(INTERP, enum_class_Iterator, SELF);
-        PMC * const key  = pmc_new(INTERP, enum_class_Key);
-        INTVAL      size;
-
-        Parrot_PCCINVOKE(interp, iter, name, "P->", key);
-        PObj_get_FLAGS(key) |= KEY_integer_FLAG;
-
-        GET_ATTR_size(INTERP, SELF, size);
-
-        if (size)
-            VTABLE_set_integer_native(INTERP, key, 0);
-        else
-            VTABLE_set_integer_native(INTERP, key, -1);
-
-        return iter;
+        return pmc_new_init(INTERP, enum_class_ArrayIterator, SELF);
     }
 
 /*

Modified: branches/tt761_keys_revamp/src/pmc/fixedpmcarray.pmc
==============================================================================
--- branches/tt761_keys_revamp/src/pmc/fixedpmcarray.pmc	Sun Jun 14 10:15:55 2009	(r39559)
+++ branches/tt761_keys_revamp/src/pmc/fixedpmcarray.pmc	Sun Jun 14 10:16:20 2009	(r39560)
@@ -646,19 +646,7 @@
     }
 
     VTABLE PMC *get_iter() {
-        STRING     *name     = CONST_STRING(interp, "set_key");
-        PMC * const iter     = pmc_new_init(INTERP, enum_class_Iterator, SELF);
-        PMC * const key      = pmc_new(INTERP, enum_class_Key);
-
-        Parrot_PCCINVOKE(interp, iter, name, "P->", key);
-        PObj_get_FLAGS(key) |= KEY_integer_FLAG;
-
-        if (PMC_size(SELF) == 0)
-            VTABLE_set_integer_native(INTERP, key, -1);
-        else
-            VTABLE_set_integer_native(INTERP, key, 0);
-
-        return iter;
+        return pmc_new_init(INTERP, enum_class_ArrayIterator, SELF);
     }
 
 /*

Modified: branches/tt761_keys_revamp/src/pmc/fixedstringarray.pmc
==============================================================================
--- branches/tt761_keys_revamp/src/pmc/fixedstringarray.pmc	Sun Jun 14 10:15:55 2009	(r39559)
+++ branches/tt761_keys_revamp/src/pmc/fixedstringarray.pmc	Sun Jun 14 10:16:20 2009	(r39560)
@@ -159,16 +159,7 @@
 
 */
     VTABLE PMC *get_iter() {
-        STRING     *name = CONST_STRING(interp, "set_key");
-        PMC * const iter = pmc_new_init(INTERP, enum_class_Iterator, SELF);
-        PMC * const key  = pmc_new(INTERP, enum_class_Key);
-
-        Parrot_PCCINVOKE(interp, iter, name, "P->", key);
-        PObj_get_FLAGS(key) |= KEY_integer_FLAG;
-        VTABLE_set_integer_native(INTERP, key,
-                VTABLE_get_bool(INTERP, SELF) ? 0 : -1);
-
-        return iter;
+        return pmc_new_init(INTERP, enum_class_ArrayIterator, SELF);
     }
 
 /*


More information about the parrot-commits mailing list