[svn:parrot] r45103 - branches/pcc_hackathon_6Mar10/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Mon Mar 22 11:04:30 UTC 2010


Author: chromatic
Date: Mon Mar 22 11:04:13 2010
New Revision: 45103
URL: https://trac.parrot.org/parrot/changeset/45103

Log:
[PMC] Added preliminary shift_pmc and shift_string VTABLE entries to
CallContext for Rakudo (and because they went missing somehow).

Modified:
   branches/pcc_hackathon_6Mar10/src/pmc/callcontext.pmc

Modified: branches/pcc_hackathon_6Mar10/src/pmc/callcontext.pmc
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/pmc/callcontext.pmc	Mon Mar 22 07:15:54 2010	(r45102)
+++ branches/pcc_hackathon_6Mar10/src/pmc/callcontext.pmc	Mon Mar 22 11:04:13 2010	(r45103)
@@ -900,6 +900,47 @@
         SET_ATTR_num_positionals(INTERP, SELF, size + 1);
     }
 
+    VTABLE PMC * shift_pmc() {
+        Pcc_cell *cells;
+        PMC      *retval;
+        INTVAL    size = STATICSELF.elements();
+        INTVAL    i;
+
+        if (size < 1)
+            Parrot_ex_throw_from_c_args(interp, NULL,
+                EXCEPTION_INVALID_OPERATION,
+                "Cannot shift PMC from empty CallContext");
+
+        GET_ATTR_positionals(INTERP, SELF, cells);
+        retval = autobox_pmc(INTERP, &cells[0]);
+
+        for (i = 1; i < size; i++)
+            cells[i - 1] = cells[i];
+
+        SET_ATTR_num_positionals(INTERP, SELF, size - 1);
+        return retval;
+    }
+
+    VTABLE STRING * shift_string() {
+        Pcc_cell *cells;
+        STRING   *retval;
+        INTVAL    size = STATICSELF.elements();
+        INTVAL    i;
+
+        if (size < 1)
+            Parrot_ex_throw_from_c_args(interp, NULL,
+                EXCEPTION_INVALID_OPERATION,
+                "Cannot shift PMC from empty CallContext");
+
+        GET_ATTR_positionals(INTERP, SELF, cells);
+        retval = autobox_string(INTERP, &cells[0]);
+
+        for (i = 1; i < size; i++)
+            cells[i - 1] = cells[i];
+
+        SET_ATTR_num_positionals(INTERP, SELF, size - 1);
+        return retval;
+    }
 
     VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
         Pcc_cell *cells;


More information about the parrot-commits mailing list