CopFILE / MacPerl_MPWFileName
Chris Nandor [Fri, 8 Feb 2002 16:31:41 +0000 (11:31 -0500)]
Message-ID: <pudge-10FC3D.16314108022002@onion.valueclick.com>

p4raw-id: //depot/perl@14608

cop.h
deb.c
pp_ctl.c
toke.c
util.c

diff --git a/cop.h b/cop.h
index 3e1820f..d617bfc 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -70,6 +70,13 @@ struct cop {
 #define CopLINE_dec(c)         (--CopLINE(c))
 #define CopLINE_set(c,l)       (CopLINE(c) = (l))
 
+/* OutCopFILE() is CopFILE for output (caller, die, warn, etc.) */
+#ifdef MACOS_TRADITIONAL
+#  define OutCopFILE(c) MacPerl_MPWFileName(CopFILE(c))
+#else
+#  define OutCopFILE(c) CopFILE(c)
+#endif
+
 /*
  * Here we have some enormously heavy (or at least ponderous) wizardry.
  */
diff --git a/deb.c b/deb.c
index 4b964a3..fae944c 100644 (file)
--- a/deb.c
+++ b/deb.c
@@ -45,7 +45,7 @@ void
 Perl_vdeb(pTHX_ const char *pat, va_list *args)
 {
 #ifdef DEBUGGING
-    char* file = CopFILE(PL_curcop);
+    char* file = OutCopFILE(PL_curcop);
 
 #ifdef USE_5005THREADS
     PerlIO_printf(Perl_debug_log, "0x%"UVxf" (%s:%ld)\t",
index 183849e..9dbd525 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1414,7 +1414,7 @@ PP(pp_caller)
        PUSHs(&PL_sv_undef);
     else
        PUSHs(sv_2mortal(newSVpv(stashname, 0)));
-    PUSHs(sv_2mortal(newSVpv(CopFILE(cx->blk_oldcop), 0)));
+    PUSHs(sv_2mortal(newSVpv(OutCopFILE(cx->blk_oldcop), 0)));
     PUSHs(sv_2mortal(newSViv((I32)CopLINE(cx->blk_oldcop))));
     if (!MAXARG)
        RETURN;
diff --git a/toke.c b/toke.c
index 7db985e..2eb049f 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -7594,7 +7594,7 @@ Perl_yyerror(pTHX_ char *s)
     }
     msg = sv_2mortal(newSVpv(s, 0));
     Perl_sv_catpvf(aTHX_ msg, " at %s line %"IVdf", ",
-                  CopFILE(PL_curcop), (IV)CopLINE(PL_curcop));
+        OutCopFILE(PL_curcop), (IV)CopLINE(PL_curcop));
     if (context)
        Perl_sv_catpvf(aTHX_ msg, "near \"%.*s\"\n", contlen, context);
     else
@@ -7612,10 +7612,10 @@ Perl_yyerror(pTHX_ char *s)
     if (PL_error_count >= 10) {
        if (PL_in_eval && SvCUR(ERRSV))
            Perl_croak(aTHX_ "%"SVf"%s has too many errors.\n",
-                      ERRSV, CopFILE(PL_curcop));
+            ERRSV, OutCopFILE(PL_curcop));
        else
            Perl_croak(aTHX_ "%s has too many errors.\n",
-                      CopFILE(PL_curcop));
+            OutCopFILE(PL_curcop));
     }
     PL_in_my = 0;
     PL_in_my_stash = Nullhv;
diff --git a/util.c b/util.c
index fb064af..33dcf19 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1104,7 +1104,7 @@ Perl_vmess(pTHX_ const char *pat, va_list *args)
 
        if (CopLINE(cop))
            Perl_sv_catpvf(aTHX_ sv, " at %s line %"IVdf,
-                          CopFILE(cop), (IV)CopLINE(cop));
+           OutCopFILE(cop), (IV)CopLINE(cop));
        if (GvIO(PL_last_in_gv) && IoLINES(GvIOp(PL_last_in_gv))) {
            bool line_mode = (RsSIMPLE(PL_rs) &&
                              SvCUR(PL_rs) == 1 && *SvPVX(PL_rs) == '\n');