*/
static SV *
-isa_lookup(stash, name, len, level)
-HV *stash;
-char *name;
-int len;
-int level;
+isa_lookup(HV *stash, char *name, int len, int level)
{
AV* av;
GV* gv;
}
if(hv) {
SV** svp = AvARRAY(av);
- I32 items = AvFILL(av) + 1;
+ /* NOTE: No support for tied ISA */
+ I32 items = AvFILLp(av) + 1;
while (items--) {
SV* sv = *svp++;
HV* basestash = gv_stashsv(sv, FALSE);
}
}
- return &sv_no;
+ return boolSV(strEQ(name, "UNIVERSAL"));
}
bool
-sv_derived_from(sv, name)
-SV * sv ;
-char * name ;
+sv_derived_from(SV *sv, char *name)
{
SV *rv;
char *type;
sv = ST(0);
name = (char *)SvPV(ST(1),na);
- ST(0) = (sv_derived_from(sv, name) ? &sv_yes : &sv_no) ;
-
+ ST(0) = boolSV(sv_derived_from(sv, name));
XSRETURN(1);
}
SV *sv;
char *name;
SV *rv;
- GV *gv;
- CV *cvp;
HV *pkg = NULL;
if (items != 2)
}
if (pkg) {
- gv = gv_fetchmethod(pkg, name);
-
- if(gv && GvCV(gv)) {
- /* If the sub is only a stub then we may have a gv to AUTOLOAD */
- GV **gvp = (GV**)hv_fetch(GvSTASH(gv), name, strlen(name), TRUE);
- if(gvp && (cvp = GvCV(*gvp))) {
- rv = sv_newmortal();
- sv_setsv(rv, newRV((SV*)cvp));
- }
- }
+ GV *gv = gv_fetchmethod_autoload(pkg, name, FALSE);
+ if (gv && isGV(gv))
+ rv = sv_2mortal(newRV((SV*)GvCV(gv)));
}
ST(0) = rv;
}
static
-XS(XS_UNIVERSAL_is_instance)
-{
- dXSARGS;
- ST(0) = SvROK(ST(0)) ? &sv_yes : &sv_no;
- XSRETURN(1);
-}
-
-static
-XS(XS_UNIVERSAL_class)
-{
- dXSARGS;
- if(SvROK(ST(0)) && SvOBJECT(SvRV(ST(0)))) {
- SV *sv = sv_newmortal();
- sv_setpv(sv, HvNAME(SvSTASH(SvRV(ST(0)))));
- ST(0) = sv;
- }
- XSRETURN(1);
-}
-
-static
XS(XS_UNIVERSAL_VERSION)
{
dXSARGS;
GV *gv;
SV *sv;
char *undef;
-#ifdef _SYS_ISC
- double req = SvNV(ST(1));
-#endif
+ double req;
if(SvROK(ST(0))) {
sv = (SV*)SvRV(ST(0));
undef = "(undef)";
}
-#ifdef _SYS_ISC
- /* needed for C compiler of Interactive Unix */
- if(items > 1 && (undef || (req = SvNV(ST(1)) && req > SvNV(sv))))
-#else
- if(items > 1 && (undef || SvNV(ST(1)) > SvNV(sv)))
-#endif
+ if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv))))
croak("%s version %s required--this is only version %s",
- HvNAME(pkg),SvPV(ST(1),na),undef ? undef : SvPV(sv,na));
+ HvNAME(pkg), SvPV(ST(1),na), undef ? undef : SvPV(sv,na));
ST(0) = sv;
}
void
-boot_core_UNIVERSAL()
+boot_core_UNIVERSAL(void)
{
char *file = __FILE__;
newXS("UNIVERSAL::isa", XS_UNIVERSAL_isa, file);
newXS("UNIVERSAL::can", XS_UNIVERSAL_can, file);
- newXS("UNIVERSAL::class", XS_UNIVERSAL_class, file);
- newXS("UNIVERSAL::is_instance", XS_UNIVERSAL_is_instance, file);
newXS("UNIVERSAL::VERSION", XS_UNIVERSAL_VERSION, file);
}