Remove tabs from c code.
[gitmo/Class-MOP.git] / mop.h
CommitLineData
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
19void 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
40extern SV *method_metaclass;
41extern SV *associated_metaclass;
42extern SV *wrap;
43
44UV mop_check_package_cache_flag(pTHX_ HV *stash);
45int get_code_info (SV *coderef, char **pkg, char **name);
46SV *mop_call0(pTHX_ SV *const self, SV *const method);
47
48typedef 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
57typedef bool (*get_package_symbols_cb_t) (const char *, STRLEN, SV *, void *);
58
59void get_package_symbols(HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud);
60HV *get_all_package_symbols (HV *stash, type_filter_t filter);
61
62#endif