From: gfx Date: Sun, 25 Oct 2009 09:00:23 +0000 (+0900) Subject: Ensure backward compatibility X-Git-Tag: 0.40_01~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ea28db6c35f2f60bfcce151cb4fcee58d6edcf7;p=gitmo%2FMouse.git Ensure backward compatibility --- diff --git a/Makefile.PL b/Makefile.PL index 8e9ed08..02450a7 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -30,6 +30,10 @@ for (@ARGV) { /^--xs$/ and $use_xs = 1; } +if($] < 5.008_001){ + $use_xs = 0; +} + if(!defined $use_xs){ configure_requires 'ExtUtils::CBuilder'; require ExtUtils::CBuilder; diff --git a/mouse.h b/mouse.h index 21e45c3..fdc50f4 100644 --- a/mouse.h +++ b/mouse.h @@ -6,16 +6,25 @@ #include #include +#define NEED_newSVpvn_flags #include "ppport.h" +/* for portability */ #ifndef newSVpvs_share #define newSVpvs_share(s) Perl_newSVpvn_share(aTHX_ s, sizeof(s)-1, 0U) #endif +#ifndef GvNAME_get +#define GvNAME_get GvNAME +#endif +#ifndef GvNAMELEN_get +#define GvNAMELEN_get GvNAMELEN +#endif + #ifndef mro_get_linear_isa #define no_mro_get_linear_isa #define mro_get_linear_isa(stash) mouse_mro_get_linear_isa(aTHX_ stash) -AV* mouse_mro_get_linear_isa(pTHX_ HV* const stash) +AV* mouse_mro_get_linear_isa(pTHX_ HV* const stash); #endif /* !mro_get_linear_isa */ #ifndef mro_get_pkg_gen @@ -26,7 +35,7 @@ AV* mouse_mro_get_linear_isa(pTHX_ HV* const stash) #endif /* !no_mro_get_linear_isa */ #endif /* mro_get_package_gen */ -#define MOUSE_CALL_BOOT(name) STMT_START { \ +#define MOUSE_CALL_BOOT(name) STMT_START { \ EXTERN_C XS(CAT2(boot_, name)); \ PUSHMARK(SP); \ CALL_FPTR(CAT2(boot_, name))(aTHX_ cv); \ diff --git a/xs-src/Mouse.xs b/xs-src/Mouse.xs index ed97592..c4ba5f1 100644 --- a/xs-src/Mouse.xs +++ b/xs-src/Mouse.xs @@ -123,7 +123,7 @@ HV* namespace(SV* self) CODE: { - SV* const package = mouse_instance_get_slot(self, mouse_package); + SV* const package = mouse_instance_get_slot(aTHX_ self, mouse_package); if(!(package && SvOK(package))){ croak("No package name"); } diff --git a/xs-src/mouse_simple_accessor.xs b/xs-src/mouse_simple_accessor.xs index 285f3cb..f05d753 100644 --- a/xs-src/mouse_simple_accessor.xs +++ b/xs-src/mouse_simple_accessor.xs @@ -62,7 +62,7 @@ XS(mouse_xs_simple_reader) croak("Expected exactly one argument for a reader for '%"SVf"'", slot); } - value = mouse_instance_get_slot(self, slot); + value = mouse_instance_get_slot(aTHX_ self, slot); ST(0) = value ? value : &PL_sv_undef; XSRETURN(1); } @@ -78,7 +78,7 @@ XS(mouse_xs_simple_writer) croak("Expected exactly two argument for a writer for '%"SVf"'", slot); } - ST(0) = mouse_instance_set_slot(self, slot, ST(1)); + ST(0) = mouse_instance_set_slot(aTHX_ self, slot, ST(1)); XSRETURN(1); } @@ -108,6 +108,6 @@ XS(mouse_xs_simple_predicate) croak("Expected exactly one argument for a predicate for '%"SVf"'", slot); } - ST(0) = boolSV( mouse_instance_has_slot(self, slot) ); + ST(0) = boolSV( mouse_instance_has_slot(aTHX_ self, slot) ); XSRETURN(1); } diff --git a/xs-src/mouse_util.xs b/xs-src/mouse_util.xs index f041951..94239c8 100644 --- a/xs-src/mouse_util.xs +++ b/xs-src/mouse_util.xs @@ -2,7 +2,7 @@ #define ISA_CACHE "::LINEALIZED_ISA_CACHE::" -#ifndef no_mro_get_linear_isa +#ifdef no_mro_get_linear_isa AV* mouse_mro_get_linear_isa(pTHX_ HV* const stash){ GV* const cachegv = *(GV**)hv_fetchs(stash, ISA_CACHE, TRUE);