#define NEED_sv_2pv_nolen
#include "ppport.h"
-#define MOP_CALL_BOOT(name) \
- { \
- EXTERN_C XS(name); \
- mop_call_xs(aTHX_ name, cv, mark); \
- }
+#define MOP_CALL_BOOT(name) mop_call_xs(aTHX_ name, cv, mark);
-void mop_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *), CV *cv, SV **mark);
+#ifndef XSPROTO
+#define XSPROTO(name) XS(name)
+#endif
-#define DECLARE_KEY(name) { #name, #name, NULL, 0 }
-#define DECLARE_KEY_WITH_VALUE(name, value) { #name, value, NULL, 0 }
+void mop_call_xs (pTHX_ XSPROTO(subaddr), CV *cv, SV **mark);
typedef enum {
+ KEY__expected_method_class,
+ KEY_ISA,
+ KEY_VERSION,
+ KEY_accessor,
+ KEY_associated_class,
+ KEY_associated_metaclass,
+ KEY_associated_methods,
+ KEY_attribute_metaclass,
+ KEY_attributes,
+ KEY_body,
+ KEY_builder,
+ KEY_clearer,
+ KEY_constructor_class,
+ KEY_constructor_name,
+ KEY_definition_context,
+ KEY_destructor_class,
+ KEY_immutable_trait,
+ KEY_init_arg,
+ KEY_initializer,
+ KEY_insertion_order,
+ KEY_instance_metaclass,
+ KEY_is_inline,
+ KEY_method_metaclass,
+ KEY_methods,
KEY_name,
KEY_package,
KEY_package_name,
- KEY_body,
+ KEY_predicate,
+ KEY_reader,
+ KEY_wrapped_method_metaclass,
+ KEY_writer,
KEY_package_cache_flag,
- KEY_methods,
- KEY_VERSION,
- KEY_ISA,
+ KEY__version,
key_last,
} mop_prehashed_key_t;
#define HASH_FOR(name) mop_prehashed_hash_for(KEY_ ##name)
void mop_prehash_keys (void);
-inline SV *mop_prehashed_key_for (mop_prehashed_key_t key);
-inline U32 mop_prehashed_hash_for (mop_prehashed_key_t key);
+SV *mop_prehashed_key_for (mop_prehashed_key_t key);
+U32 mop_prehashed_hash_for (mop_prehashed_key_t key);
+
+#define INSTALL_SIMPLE_READER(klass, name) INSTALL_SIMPLE_READER_WITH_KEY(klass, name, name)
+#define INSTALL_SIMPLE_READER_WITH_KEY(klass, name, key) \
+ { \
+ CV *cv = newXS("Class::MOP::" #klass "::" #name, mop_xs_simple_reader, __FILE__); \
+ CvXSUBANY(cv).any_i32 = KEY_ ##key; \
+ }
+
+XS(mop_xs_simple_reader);
extern SV *mop_method_metaclass;
extern SV *mop_associated_metaclass;