Ignore all .git.*
[gitmo/Class-MOP.git] / xs / Package.xs
CommitLineData
d846ade3 1#include "mop.h"
2
d846ade3 3MODULE = Class::MOP::Package PACKAGE = Class::MOP::Package
4
5PROTOTYPES: DISABLE
6
7void
8get_all_package_symbols(self, filter=TYPE_FILTER_NONE)
9 SV *self
10 type_filter_t filter
11 PREINIT:
12 HV *stash = NULL;
13 HV *symbols = NULL;
14 register HE *he;
15 PPCODE:
16 if ( ! SvROK(self) ) {
17 die("Cannot call get_all_package_symbols as a class method");
18 }
19
20 if (GIMME_V == G_VOID) {
21 XSRETURN_EMPTY;
22 }
23
24 PUTBACK;
25
22932438 26 if ( (he = hv_fetch_ent((HV *)SvRV(self), KEY_FOR(package), 0, HASH_FOR(package))) ) {
d846ade3 27 stash = gv_stashsv(HeVAL(he), 0);
28 }
29
30
31 if (!stash) {
32 XSRETURN_UNDEF;
33 }
34
e1f52a8a 35 symbols = mop_get_all_package_symbols(stash, filter);
d846ade3 36 PUSHs(sv_2mortal(newRV_noinc((SV *)symbols)));
37
7ec7b950 38BOOT:
39 INSTALL_SIMPLE_READER_WITH_KEY(Package, name, package);