[svn:parrot] r41863 - branches/pcc_reapply/src/pmc

allison at svn.parrot.org allison at svn.parrot.org
Wed Oct 14 22:26:06 UTC 2009


Author: allison
Date: Wed Oct 14 22:26:05 2009
New Revision: 41863
URL: https://trac.parrot.org/parrot/changeset/41863

Log:
[pcc] Reordering a few CallSignature vtable functions to match the grouping of
the others, adding one new one needed for number argument handling.

Modified:
   branches/pcc_reapply/src/pmc/callsignature.pmc

Modified: branches/pcc_reapply/src/pmc/callsignature.pmc
==============================================================================
--- branches/pcc_reapply/src/pmc/callsignature.pmc	Wed Oct 14 22:13:01 2009	(r41862)
+++ branches/pcc_reapply/src/pmc/callsignature.pmc	Wed Oct 14 22:26:05 2009	(r41863)
@@ -979,11 +979,11 @@
         CELL_PMC(cell) = value;
     }
 
-    VTABLE INTVAL get_integer_keyed(PMC *key) {
+    VTABLE INTVAL get_integer_keyed_str(STRING *key) {
         Hash *hash = get_hash(interp, SELF);
 
         if (hash) {
-            void     *k    = hash_key_from_pmc(interp, hash, key);
+            void     *k    = hash_key_from_string(interp, hash, key);
             Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
 
             if (cell)
@@ -993,7 +993,7 @@
         return 0;
     }
 
-    VTABLE INTVAL get_integer_keyed_str(STRING *key) {
+    VTABLE FLOATVAL get_number_keyed_str(STRING *key) {
         Hash *hash = get_hash(interp, SELF);
 
         if (hash) {
@@ -1001,27 +1001,42 @@
             Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
 
             if (cell)
-                return autobox_intval(interp, cell);
+                return autobox_floatval(interp, cell);
         }
 
-        return 0;
+        return 0.0;
     }
 
-    VTABLE FLOATVAL get_number_keyed(PMC *key) {
+
+    VTABLE STRING * get_string_keyed_str(STRING *key) {
         Hash *hash = get_hash(interp, SELF);
 
         if (hash) {
-            void     *k    = hash_key_from_pmc(interp, hash, key);
+            void     *k    = hash_key_from_string(interp, hash, key);
             Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
 
             if (cell)
-                return autobox_floatval(interp, cell);
+                return autobox_string(interp, cell);
         }
 
-        return 0.0;
+        return NULL;
     }
 
-    VTABLE STRING * get_string_keyed(PMC *key) {
+    VTABLE PMC * get_pmc_keyed_str(STRING *key) {
+        Hash *hash = get_hash(interp, SELF);
+
+        if (hash) {
+            void     *k    = hash_key_from_string(interp, hash, key);
+            Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
+
+            if (cell)
+                return autobox_pmc(interp, cell);
+        }
+
+        return PMCNULL;
+    }
+
+    VTABLE INTVAL get_integer_keyed(PMC *key) {
         Hash *hash = get_hash(interp, SELF);
 
         if (hash) {
@@ -1029,27 +1044,27 @@
             Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
 
             if (cell)
-                return autobox_string(interp, cell);
+                return autobox_intval(interp, cell);
         }
 
-        return NULL;
+        return 0;
     }
 
-    VTABLE STRING * get_string_keyed_str(STRING *key) {
+    VTABLE FLOATVAL get_number_keyed(PMC *key) {
         Hash *hash = get_hash(interp, SELF);
 
         if (hash) {
-            void     *k    = hash_key_from_string(interp, hash, key);
+            void     *k    = hash_key_from_pmc(interp, hash, key);
             Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
 
             if (cell)
-                return autobox_string(interp, cell);
+                return autobox_floatval(interp, cell);
         }
 
-        return NULL;
+        return 0.0;
     }
 
-    VTABLE PMC * get_pmc_keyed(PMC *key) {
+    VTABLE STRING * get_string_keyed(PMC *key) {
         Hash *hash = get_hash(interp, SELF);
 
         if (hash) {
@@ -1057,17 +1072,17 @@
             Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
 
             if (cell)
-                return autobox_pmc(interp, cell);
+                return autobox_string(interp, cell);
         }
 
-        return PMCNULL;
+        return NULL;
     }
 
-    VTABLE PMC * get_pmc_keyed_str(STRING *key) {
+    VTABLE PMC * get_pmc_keyed(PMC *key) {
         Hash *hash = get_hash(interp, SELF);
 
         if (hash) {
-            void     *k    = hash_key_from_string(interp, hash, key);
+            void     *k    = hash_key_from_pmc(interp, hash, key);
             Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(interp, hash, k);
 
             if (cell)


More information about the parrot-commits mailing list