Patch from Peter Prymmer to disable utf8 in EBCDIC platforms.
Jarkko Hietaniemi [Fri, 6 Oct 2000 00:38:11 +0000 (00:38 +0000)]
p4raw-id: //depot/perl@7152

perl.c
pp_ctl.c
sv.h
utf8.c

diff --git a/perl.c b/perl.c
index cb2cb14..e5d263a 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -723,7 +723,11 @@ perl_destruct(pTHXx)
     Safefree(PL_psig_ptr);
     Safefree(PL_psig_name);
     nuke_stacks();
+#ifdef EBCDIC
+    PL_hints = HINT_BYTE;      /* Reset hints. Should hints be per-interpreter ? */
+#else
     PL_hints = 0;              /* Reset hints. Should hints be per-interpreter ? */
+#endif
     
     DEBUG_P(debprofdump());
 #ifdef USE_THREADS
@@ -2506,12 +2510,20 @@ S_init_main_stash(pTHX)
     HvNAME(PL_defstash) = savepv("main");
     PL_incgv = gv_HVadd(gv_AVadd(gv_fetchpv("INC",TRUE, SVt_PVAV)));
     GvMULTI_on(PL_incgv);
+#ifdef EBCDIC
+    PL_hintgv = gv_fetchpv("\010",TRUE, SVt_PV); /* ^H */
+#else
     PL_hintgv = gv_fetchpv("\010",TRUE, SVt_PV); /* ^H */
+#endif
     GvMULTI_on(PL_hintgv);
     PL_defgv = gv_fetchpv("_",TRUE, SVt_PVAV);
     PL_errgv = gv_HVadd(gv_fetchpv("@", TRUE, SVt_PV));
     GvMULTI_on(PL_errgv);
+#ifdef EBCDIC
+    PL_replgv = gv_fetchpv("\022", TRUE, SVt_PV); /* ^R */
+#else
     PL_replgv = gv_fetchpv("\022", TRUE, SVt_PV); /* ^R */
+#endif
     GvMULTI_on(PL_replgv);
     (void)Perl_form(aTHX_ "%240s",""); /* Preallocate temp - for immediate signals. */
     sv_grow(ERRSV, 240);       /* Preallocate - for immediate signals. */
index c949e78..9204879 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2694,7 +2694,11 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, char *code, AV** avp)
 #else
     SAVEVPTR(PL_op);
 #endif
+#ifdef EBCDIC
+    PL_hints = HINT_BYTE;
+#else
     PL_hints = 0;
+#endif
 
     PL_op = &dummy;
     PL_op->op_type = OP_ENTEREVAL;
@@ -3240,7 +3244,11 @@ trylocal: {
 
     PL_rsfp = tryrsfp;
     SAVEHINTS();
+#ifdef EBCDIC
+    PL_hints = HINT_BYTE;
+#else
     PL_hints = 0;
+#endif
     SAVESPTR(PL_compiling.cop_warnings);
     if (PL_dowarn & G_WARN_ALL_ON)
         PL_compiling.cop_warnings = pWARN_ALL ;
diff --git a/sv.h b/sv.h
index fa73a86..d9522c4 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -202,7 +202,11 @@ perform the upgrade if necessary.  See C<svtype>.
 #define SVp_POK                0x04000000      /* has valid non-public pointer value */
 #define SVp_SCREAM     0x08000000      /* has been studied? */
 
+#ifdef EBCDIC
+#define SVf_UTF8        0x00000000      /* SvPVX is not UTF-8 encoded */
+#else
 #define SVf_UTF8        0x20000000      /* SvPVX is UTF-8 encoded */
+#endif
 
 #define SVf_THINKFIRST (SVf_READONLY|SVf_ROK|SVf_FAKE|SVf_UTF8)
 
diff --git a/utf8.c b/utf8.c
index 3ab402c..a12d8d4 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -910,7 +910,11 @@ Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none)
     PUTBACK;
     ENTER;
     SAVEI32(PL_hints);
+#ifdef EBCDIC
+    PL_hints = HINT_BYTE;
+#else
     PL_hints = 0;
+#endif
     save_re_context();
     if (PL_curcop == &PL_compiling)    /* XXX ought to be handled by lex_start */
        strncpy(tmpbuf, PL_tokenbuf, sizeof tmpbuf);