X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=universal.c;h=032a536e556054dbab376e2d4420c3bf59b9109d;hb=0002dd408e3c774a6362509144c535985989fca0;hp=4f76d922557418d576b6b76734af4e9c332c6195;hpb=2d8e6c8d50eaf50f663a5fd184404c73944226e0;p=p5sagit%2Fp5-mst-13.2.git diff --git a/universal.c b/universal.c index 4f76d92..032a536 100644 --- a/universal.c +++ b/universal.c @@ -1,4 +1,5 @@ #include "EXTERN.h" +#define PERL_IN_UNIVERSAL_C #include "perl.h" /* @@ -7,7 +8,7 @@ */ STATIC SV * -isa_lookup(HV *stash, char *name, int len, int level) +S_isa_lookup(pTHX_ HV *stash, const char *name, int len, int level) { AV* av; GV* gv; @@ -21,7 +22,7 @@ isa_lookup(HV *stash, char *name, int len, int level) return &PL_sv_yes; if (level > 100) - croak("Recursive inheritance detected in package '%s'", HvNAME(stash)); + Perl_croak(aTHX_ "Recursive inheritance detected in package '%s'", HvNAME(stash)); gvp = (GV**)hv_fetch(stash, "::ISA::CACHE::", 14, FALSE); @@ -55,7 +56,7 @@ isa_lookup(HV *stash, char *name, int len, int level) if (!basestash) { dTHR; if (ckWARN(WARN_MISC)) - warner(WARN_SYNTAX, + Perl_warner(aTHX_ WARN_SYNTAX, "Can't locate package %s for @%s::ISA", SvPVX(sv), HvNAME(stash)); continue; @@ -73,7 +74,7 @@ isa_lookup(HV *stash, char *name, int len, int level) } bool -sv_derived_from(SV *sv, char *name) +Perl_sv_derived_from(pTHX_ SV *sv, const char *name) { SV *rv; char *type; @@ -102,6 +103,20 @@ sv_derived_from(SV *sv, char *name) } +void XS_UNIVERSAL_isa(pTHXo_ CV *cv); +void XS_UNIVERSAL_can(pTHXo_ CV *cv); +void XS_UNIVERSAL_VERSION(pTHXo_ CV *cv); + +void +Perl_boot_core_UNIVERSAL(pTHX) +{ + char *file = __FILE__; + + newXS("UNIVERSAL::isa", XS_UNIVERSAL_isa, file); + newXS("UNIVERSAL::can", XS_UNIVERSAL_can, file); + newXS("UNIVERSAL::VERSION", XS_UNIVERSAL_VERSION, file); +} + #ifdef PERL_OBJECT #define NO_XSLOCKS #endif /* PERL_OBJECT */ @@ -116,7 +131,7 @@ XS(XS_UNIVERSAL_isa) STRLEN n_a; if (items != 2) - croak("Usage: UNIVERSAL::isa(reference, kind)"); + Perl_croak(aTHX_ "Usage: UNIVERSAL::isa(reference, kind)"); sv = ST(0); name = (char *)SvPV(ST(1),n_a); @@ -135,7 +150,7 @@ XS(XS_UNIVERSAL_can) STRLEN n_a; if (items != 2) - croak("Usage: UNIVERSAL::can(object-ref, method)"); + Perl_croak(aTHX_ "Usage: UNIVERSAL::can(object-ref, method)"); sv = ST(0); name = (char *)SvPV(ST(1),n_a); @@ -168,12 +183,12 @@ XS(XS_UNIVERSAL_VERSION) GV *gv; SV *sv; char *undef; - double req; + NV req; if(SvROK(ST(0))) { sv = (SV*)SvRV(ST(0)); if(!SvOBJECT(sv)) - croak("Cannot find version of an unblessed reference"); + Perl_croak(aTHX_ "Cannot find version of an unblessed reference"); pkg = SvSTASH(sv); } else { @@ -195,7 +210,7 @@ XS(XS_UNIVERSAL_VERSION) if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv)))) { STRLEN n_a; - croak("%s version %s required--this is only version %s", + Perl_croak(aTHX_ "%s version %s required--this is only version %s", HvNAME(pkg), SvPV(ST(1),n_a), undef ? undef : SvPV(sv,n_a)); } @@ -204,18 +219,3 @@ XS(XS_UNIVERSAL_VERSION) XSRETURN(1); } -#ifdef PERL_OBJECT -#undef boot_core_UNIVERSAL -#define boot_core_UNIVERSAL CPerlObj::Perl_boot_core_UNIVERSAL -#define pPerl this -#endif - -void -boot_core_UNIVERSAL(void) -{ - char *file = __FILE__; - - newXS("UNIVERSAL::isa", XS_UNIVERSAL_isa, file); - newXS("UNIVERSAL::can", XS_UNIVERSAL_can, file); - newXS("UNIVERSAL::VERSION", XS_UNIVERSAL_VERSION, file); -}