[svn:parrot] r37779 - trunk/src/pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Fri Mar 27 23:53:44 UTC 2009
Author: whiteknight
Date: Fri Mar 27 23:53:40 2009
New Revision: 37779
URL: https://trac.parrot.org/parrot/changeset/37779
Log:
add an elements() VTABLE to Eval PMC, to retrieve the number of Subs that the Eval contains
Modified:
trunk/src/pmc/eval.pmc
Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc Fri Mar 27 22:45:42 2009 (r37778)
+++ trunk/src/pmc/eval.pmc Fri Mar 27 23:53:40 2009 (r37779)
@@ -370,6 +370,31 @@
/* PackFile_destroy(INTERP, pf); */
}
+ VTABLE INTVAL elements() {
+ INTVAL i, n;
+ Parrot_sub *sub;
+ PackFile_ByteCode *seg;
+ PackFile_FixupTable *ft;
+
+ PMC_get_sub(interp, SELF, sub);
+ seg = sub->seg;
+
+ if (!seg)
+ return 0;
+
+ ft = seg->fixups;
+ if (!ft)
+ return 0;
+
+ for (i = n = 0; i < ft->fixup_count; i++) {
+ PackFile_FixupEntry *e = ft->fixups[i];
+
+ if (e->type == enum_fixup_sub)
+ n++;
+ }
+
+ return n;
+ }
}
/*
More information about the parrot-commits
mailing list