X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs%2FClass.xs;h=32bbde6595c3210b0eae8a6aab8ca57283baab26;hb=8e374ce5e500e0e79c3c829b3d9c6154556b39d2;hp=911e97d64190c18c697af39e31d161d3632c4b97;hpb=d846ade3f993c0e6c140bb28284022e602b8988e;p=gitmo%2FClass-MOP.git diff --git a/xs/Class.xs b/xs/Class.xs index 911e97d..32bbde6 100644 --- a/xs/Class.xs +++ b/xs/Class.xs @@ -1,12 +1,5 @@ #include "mop.h" -NEEDS_KEY(name); -NEEDS_KEY(body); -NEEDS_KEY(methods); -NEEDS_KEY(package); -NEEDS_KEY(package_name); -NEEDS_KEY(package_cache_flag); - static void mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stash, HV *const map) { @@ -18,7 +11,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas HV *symbols; dSP; - symbols = get_all_package_symbols(stash, TYPE_FILTER_CODE); + symbols = mop_get_all_package_symbols(stash, TYPE_FILTER_CODE); (void)hv_iterinit(symbols); while ( (coderef = hv_iternextsv(symbols, &method_name, &method_name_len)) ) { @@ -28,7 +21,7 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas SV *method_slot; SV *method_object; - if (!get_code_info(coderef, &cvpkg_name, &cv_name)) { + if (!mop_get_code_info(coderef, &cvpkg_name, &cv_name)) { continue; } @@ -41,13 +34,13 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas method_slot = *hv_fetch(map, method_name, method_name_len, TRUE); if ( SvOK(method_slot) ) { - SV *const body = mop_call0(aTHX_ method_slot, key_body); /* $method_object->body() */ + SV *const body = mop_call0(aTHX_ method_slot, KEY_FOR(body)); /* $method_object->body() */ if ( SvROK(body) && ((CV *) SvRV(body)) == cv ) { continue; } } - method_metaclass_name = mop_call0(aTHX_ self, method_metaclass); /* $self->method_metaclass() */ + method_metaclass_name = mop_call0(aTHX_ self, mop_method_metaclass); /* $self->method_metaclass() */ /* $method_object = $method_metaclass->wrap( @@ -64,15 +57,15 @@ mop_update_method_map(pTHX_ SV *const self, SV *const class_name, HV *const stas EXTEND(SP, 8); PUSHs(method_metaclass_name); /* invocant */ mPUSHs(newRV_inc((SV *)cv)); - PUSHs(associated_metaclass); + PUSHs(mop_associated_metaclass); PUSHs(self); - PUSHs(key_package_name); + PUSHs(KEY_FOR(package_name)); PUSHs(class_name); - PUSHs(key_name); + PUSHs(KEY_FOR(name)); mPUSHs(newSVpv(method_name, method_name_len)); PUTBACK; - call_sv(wrap, G_SCALAR | G_METHOD); + call_sv(mop_wrap, G_SCALAR | G_METHOD); SPAGAIN; method_object = POPs; PUTBACK; @@ -93,11 +86,11 @@ get_method_map(self) SV *self PREINIT: HV *const obj = (HV *)SvRV(self); - SV *const class_name = HeVAL( hv_fetch_ent(obj, key_package, 0, hash_package) ); + SV *const class_name = HeVAL( hv_fetch_ent(obj, KEY_FOR(package), 0, HASH_FOR(package)) ); HV *const stash = gv_stashsv(class_name, 0); UV const current = mop_check_package_cache_flag(aTHX_ stash); - SV *const cache_flag = HeVAL( hv_fetch_ent(obj, key_package_cache_flag, TRUE, hash_package_cache_flag)); - SV *const map_ref = HeVAL( hv_fetch_ent(obj, key_methods, TRUE, hash_methods)); + SV *const cache_flag = HeVAL( hv_fetch_ent(obj, KEY_FOR(package_cache_flag), TRUE, HASH_FOR(package_cache_flag))); + SV *const map_ref = HeVAL( hv_fetch_ent(obj, KEY_FOR(methods), TRUE, HASH_FOR(methods))); PPCODE: /* in $self->{methods} does not yet exist (or got deleted) */ if ( !SvROK(map_ref) || SvTYPE(SvRV(map_ref)) != SVt_PVHV ) {