[svn:parrot] r43881 - branches/op_pmcs/src/pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Thu Feb 11 02:54:33 UTC 2010


Author: whiteknight
Date: Thu Feb 11 02:54:32 2010
New Revision: 43881
URL: https://trac.parrot.org/parrot/changeset/43881

Log:
extra vtable + comment

Modified:
   branches/op_pmcs/src/pmc/oplib.pmc

Modified: branches/op_pmcs/src/pmc/oplib.pmc
==============================================================================
--- branches/op_pmcs/src/pmc/oplib.pmc	Thu Feb 11 02:51:32 2010	(r43880)
+++ branches/op_pmcs/src/pmc/oplib.pmc	Thu Feb 11 02:54:32 2010	(r43881)
@@ -14,6 +14,17 @@
         OPLIB_PMC_INSTANCE = (PMC *)ptr;
     }
 
+    /* Look up an opnumber given the name of the op. First we look for the
+       specific name, then the more general short name. */
+    VTABLE INTVAL get_integer_keyed_string(STRING *name) {
+        const char * const cstr = Parrot_str_to_cstring(INTERP, name);
+        INTVAL num = interp->op_lib->op_code(cstr, 1);
+        if (num == -1)
+            num = interp->op_lib->op_code(cstr, 0);
+        Parrot_str_free_cstring(INTERP, cstr);
+        return num;
+    }
+
     VTABLE PMC *get_pmc_keyed_string(STRING *name) {
         PMC * const family = pmc_new(INTERP, enum_class_OpFamily);
         VTABLE_set_string_native(INTERP, name);


More information about the parrot-commits mailing list