#define has_slot(self, key) mouse_instance_has_slot(aTHX_ self, key)
#define get_slot(self, key) mouse_instance_get_slot(aTHX_ self, key)
#define set_slot(self, key, value) mouse_instance_set_slot(aTHX_ self, key, value)
+#define delete_slot(self, key) mouse_instance_delete_slot(aTHX_ self, key)
+#define weaken_slot(self, key) mouse_instance_weaken_slot(aTHX_ self, key)
-#define has_slots(self, key) mouse_instance_has_slot(aTHX_ self, sv_2mortal(newSVpvs_share(key)))
-#define get_slots(self, key) mouse_instance_get_slot(aTHX_ self, sv_2mortal(newSVpvs_share(key)))
-#define set_slots(self, key, value) mouse_instance_set_slot(aTHX_ self, sv_2mortal(newSVpvs_share(key)), value)
+#define has_slots(self, key) has_slot(self, sv_2mortal(newSVpvs_share(key)))
+#define get_slots(self, key) get_slot(self, sv_2mortal(newSVpvs_share(key)))
+#define set_slots(self, key, value) set_slot(self, sv_2mortal(newSVpvs_share(key)), value)
/* mouse_simle_accessor.xs */
#define INSTALL_SIMPLE_READER(klass, name) INSTALL_SIMPLE_READER_WITH_KEY(klass, name, name)
namespace(SV* self)
CODE:
{
- SV* const package = mouse_instance_get_slot(aTHX_ self, mouse_package);
+ SV* const package = get_slot(aTHX_ self, mouse_package);
if(!(package && SvOK(package))){
croak("No package name defined");
}
add_method(SV* self, SV* name, SV* code, ...)
CODE:
{
- SV* const package = mouse_instance_get_slot(aTHX_ self, mouse_package); /* $self->{package} */
- SV* const methods = mouse_instance_get_slot(aTHX_ self, mouse_methods); /* $self->{methods} */
+ SV* const package = get_slot(aTHX_ self, mouse_package); /* $self->{package} */
+ SV* const methods = get_slot(aTHX_ self, mouse_methods); /* $self->{methods} */
GV* gv;
SV* code_ref;
}
sv_setsv_mg((SV*)gv, code_ref); /* *gv = $code_ref */
- mouse_instance_set_slot(aTHX_ methods, name, code); /* $self->{methods}{$name} = $code */
+ set_slot(methods, name, code); /* $self->{methods}{$name} = $code */
/* TODO: name the CODE ref if it's anonymous */
//code_entity = (CV*)SvRV(code_ref);
SV* const slot = MOUSE_mg_slot(mg);
SV* value;
- value = mouse_instance_get_slot(aTHX_ self, slot);
+ value = get_slot(self, slot);
/* check_lazy */
if( !value && flags & MOUSEf_ATTR_IS_LAZY ){
}
/* store value to slot */
- value = mouse_instance_set_slot(aTHX_ self, slot, value);
+ value = set_slot(self, slot, value);
}
PUSH_VALUE(value, flags);
value = mouse_apply_type_constraint(aTHX_ MOUSE_mg_xa(mg), value, flags);
}
- mouse_instance_set_slot(aTHX_ self, slot, value);
+ set_slot(self, slot, value);
if(flags & MOUSEf_ATTR_IS_WEAK_REF){
- mouse_instance_weaken_slot(aTHX_ self, slot);
+ weaken_slot(self, slot);
}
if(flags & MOUSEf_ATTR_HAS_TRIGGER){
croak("Expected exactly one argument for a reader for '%"SVf"'", slot);
}
- value = mouse_instance_get_slot(aTHX_ self, slot);
+ value = get_slot(self, slot);
ST(0) = value ? value : &PL_sv_undef;
XSRETURN(1);
}
croak("Expected exactly two argument for a writer for '%"SVf"'", slot);
}
- ST(0) = mouse_instance_set_slot(aTHX_ self, slot, ST(1));
+ ST(0) = set_slot(self, slot, ST(1));
XSRETURN(1);
}
croak("Expected exactly one argument for a clearer for '%"SVf"'", slot);
}
- value = mouse_instance_delete_slot(aTHX_ self, slot);
+ value = delete_slot(self, slot);
ST(0) = value ? value : &PL_sv_undef;
XSRETURN(1);
}
croak("Expected exactly one argument for a predicate for '%"SVf"'", slot);
}
- ST(0) = boolSV( mouse_instance_has_slot(aTHX_ self, slot) );
+ ST(0) = boolSV( has_slot(self, slot) );
XSRETURN(1);
}