Fix a typo, un-shout, and reformat the installation output.
[p5sagit/p5-mst-13.2.git] / universal.c
index 9bf3efc..032a536 100644 (file)
@@ -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,30 +103,43 @@ 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 */
 
 #include "XSUB.h"
 
-static
 XS(XS_UNIVERSAL_isa)
 {
     dXSARGS;
     SV *sv;
     char *name;
+    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),PL_na);
+    name = (char *)SvPV(ST(1),n_a);
 
     ST(0) = boolSV(sv_derived_from(sv, name));
     XSRETURN(1);
 }
 
-static
 XS(XS_UNIVERSAL_can)
 {
     dXSARGS;
@@ -133,12 +147,13 @@ XS(XS_UNIVERSAL_can)
     char *name;
     SV   *rv;
     HV   *pkg = NULL;
+    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),PL_na);
+    name = (char *)SvPV(ST(1),n_a);
     rv = &PL_sv_undef;
 
     if(SvROK(sv)) {
@@ -160,7 +175,6 @@ XS(XS_UNIVERSAL_can)
     XSRETURN(1);
 }
 
-static
 XS(XS_UNIVERSAL_VERSION)
 {
     dXSARGS;
@@ -169,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 {
@@ -194,27 +208,14 @@ XS(XS_UNIVERSAL_VERSION)
         undef = "(undef)";
     }
 
-    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),PL_na), undef ? undef : SvPV(sv,PL_na));
+    if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv)))) {
+       STRLEN n_a;
+       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));
+    }
 
     ST(0) = sv;
 
     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);
-}