Commit | Line | Data |
d846ade3 |
1 | #ifndef __MOP_H__ |
2 | #define __MOP_H__ |
3 | |
4 | #include "EXTERN.h" |
5 | #include "perl.h" |
6 | #include "XSUB.h" |
7 | |
8 | #define NEED_newRV_noinc |
9 | #define NEED_sv_2pv_flags |
10 | #define NEED_sv_2pv_nolen |
11 | #include "ppport.h" |
12 | |
13 | #define MOP_CALL_BOOT(name) \ |
e3dcef7f |
14 | { \ |
15 | EXTERN_C XS(name); \ |
16 | mop_call_xs(aTHX_ name, cv, mark); \ |
17 | } |
d846ade3 |
18 | |
19 | void mop_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *), CV *cv, SV **mark); |
20 | |
21 | #define DECLARE_KEY(name) SV *key_##name; U32 hash_##name; |
22 | #define NEEDS_KEY(name) extern SV *key_##name; extern U32 hash_##name; |
23 | |
24 | #define PREHASH_KEY_WITH_VALUE(name, value) do { \ |
25 | key_##name = newSVpvs(value); \ |
26 | PERL_HASH(hash_##name, value, sizeof(value) - 1); \ |
27 | } while (0) |
28 | |
29 | /* this is basically the same as the above macro, except that the value will be |
30 | * the stringified name. However, we can't just implement this in terms of |
31 | * PREHASH_KEY_WITH_VALUE as that'd cause macro expansion on the value of |
32 | * 'name' when it's being passed to the other macro. suggestions on how to make |
33 | * this more elegant would be much appreciated */ |
34 | |
35 | #define PREHASH_KEY(name) do { \ |
36 | key_##name = newSVpvs(#name); \ |
37 | PERL_HASH(hash_##name, #name, sizeof(#name) - 1); \ |
38 | } while (0) |
39 | |
e1f52a8a |
40 | extern SV *mop_method_metaclass; |
41 | extern SV *mop_associated_metaclass; |
42 | extern SV *mop_wrap; |
d846ade3 |
43 | |
44 | UV mop_check_package_cache_flag(pTHX_ HV *stash); |
e1f52a8a |
45 | int mop_get_code_info (SV *coderef, char **pkg, char **name); |
d846ade3 |
46 | SV *mop_call0(pTHX_ SV *const self, SV *const method); |
47 | |
48 | typedef enum { |
49 | TYPE_FILTER_NONE, |
50 | TYPE_FILTER_CODE, |
51 | TYPE_FILTER_ARRAY, |
52 | TYPE_FILTER_IO, |
53 | TYPE_FILTER_HASH, |
54 | TYPE_FILTER_SCALAR, |
55 | } type_filter_t; |
56 | |
57 | typedef bool (*get_package_symbols_cb_t) (const char *, STRLEN, SV *, void *); |
58 | |
e1f52a8a |
59 | void mop_get_package_symbols(HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud); |
60 | HV *mop_get_all_package_symbols (HV *stash, type_filter_t filter); |
d846ade3 |
61 | |
62 | #endif |