[svn:parrot] r44253 - trunk/src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sat Feb 20 22:18:13 UTC 2010


Author: NotFound
Date: Sat Feb 20 22:18:13 2010
New Revision: 44253
URL: https://trac.parrot.org/parrot/changeset/44253

Log:
[pmc] experimental method set_main in PackfileConstantTable

Modified:
   trunk/src/pmc/packfileconstanttable.pmc

Modified: trunk/src/pmc/packfileconstanttable.pmc
==============================================================================
--- trunk/src/pmc/packfileconstanttable.pmc	Sat Feb 20 22:12:51 2010	(r44252)
+++ trunk/src/pmc/packfileconstanttable.pmc	Sat Feb 20 22:18:13 2010	(r44253)
@@ -323,6 +323,29 @@
 
 /*
 
+=item C<void set_main(INTVAL index)>
+
+Set the :main flag in a Sub in the constant table.
+
+Experimental. Use with care. There is no way to set the
+private flags from PIR, so we need something like this.
+
+If something goes wrong, blame NotFound.
+
+=cut
+
+*/
+    METHOD set_main(INTVAL index) {
+        PMC *mainsub = SELF.get_pmc_keyed_int(index);
+        if (mainsub->vtable->base_type != enum_class_Sub)
+            Parrot_ex_throw_from_c_args(interp, NULL,
+                EXCEPTION_INVALID_OPERATION,
+                "Attempt to set main flag in a non Sub");
+        SUB_FLAG_flag_SET(PF_MAIN, mainsub);
+    }
+
+/*
+
 =item C<INTVAL get_or_create_constant()>
 
 Get or create constant for passed value.


More information about the parrot-commits mailing list