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 | |
25bcd95c |
13 | #define MOP_CALL_BOOT(name) mop_call_xs(aTHX_ name, cv, mark); |
d846ade3 |
14 | |
c97ec1de |
15 | #ifndef XSPROTO |
16 | #define XSPROTO(name) XS(name) |
17 | #endif |
18 | |
1be56175 |
19 | void mop_call_xs (pTHX_ XSPROTO(subaddr), CV *cv, SV **mark); |
d846ade3 |
20 | |
22932438 |
21 | typedef enum { |
22 | KEY_name, |
23 | KEY_package, |
24 | KEY_package_name, |
25 | KEY_body, |
26 | KEY_package_cache_flag, |
27 | KEY_methods, |
28 | KEY_VERSION, |
29 | KEY_ISA, |
30 | key_last, |
31 | } mop_prehashed_key_t; |
32 | |
33 | #define KEY_FOR(name) mop_prehashed_key_for(KEY_ ##name) |
34 | #define HASH_FOR(name) mop_prehashed_hash_for(KEY_ ##name) |
35 | |
36 | void mop_prehash_keys (void); |
20c230c5 |
37 | SV *mop_prehashed_key_for (mop_prehashed_key_t key); |
38 | U32 mop_prehashed_hash_for (mop_prehashed_key_t key); |
d846ade3 |
39 | |
0253cbf3 |
40 | #define INSTALL_SIMPLE_READER(klass, name) INSTALL_SIMPLE_READER_WITH_KEY(klass, name, name) |
7ec7b950 |
41 | #define INSTALL_SIMPLE_READER_WITH_KEY(klass, name, key) \ |
42 | { \ |
43 | CV *cv = newXS("Class::MOP::" #klass "::" #name, mop_xs_simple_reader, __FILE__); \ |
44 | CvXSUBANY(cv).any_i32 = KEY_ ##key; \ |
45 | } |
46 | |
7ec7b950 |
47 | XS(mop_xs_simple_reader); |
48 | |
e1f52a8a |
49 | extern SV *mop_method_metaclass; |
50 | extern SV *mop_associated_metaclass; |
51 | extern SV *mop_wrap; |
d846ade3 |
52 | |
53 | UV mop_check_package_cache_flag(pTHX_ HV *stash); |
e1f52a8a |
54 | int mop_get_code_info (SV *coderef, char **pkg, char **name); |
d846ade3 |
55 | SV *mop_call0(pTHX_ SV *const self, SV *const method); |
56 | |
57 | typedef enum { |
58 | TYPE_FILTER_NONE, |
59 | TYPE_FILTER_CODE, |
60 | TYPE_FILTER_ARRAY, |
61 | TYPE_FILTER_IO, |
62 | TYPE_FILTER_HASH, |
63 | TYPE_FILTER_SCALAR, |
64 | } type_filter_t; |
65 | |
66 | typedef bool (*get_package_symbols_cb_t) (const char *, STRLEN, SV *, void *); |
67 | |
e1f52a8a |
68 | void mop_get_package_symbols(HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud); |
69 | HV *mop_get_all_package_symbols (HV *stash, type_filter_t filter); |
d846ade3 |
70 | |
71 | #endif |