develooper Front page | perl.perl5.porters | Postings from January 2001

Emasculating HINT_UTF8

Thread Next
From:
Simon Cozens
Date:
January 22, 2001 15:53
Subject:
Emasculating HINT_UTF8
Message ID:
20010122235309.A32655@pembro26.pmb.ox.ac.uk
As we know, "use utf8" should become a no-op. The following patch *makes* it a
no-op by assuming that "use utf8" is always on; after this patch is applied,
HINT_UTF8 is meaningless, and can be negated with "use bytes". If this causes
test or other failures, this indicates a failure in the UTF8 system that we
need to fix.

--- doop.c~	Mon Jan 22 23:46:23 2001
+++ doop.c	Mon Jan 22 23:47:41 2001
@@ -345,7 +345,7 @@
     }
     SvSETMAGIC(sv);
     SvUTF8_on(sv);
-    if (!isutf8 && !(PL_hints & HINT_UTF8))
+    if (!isutf8 && (PL_hints & HINT_BYTES))
 	sv_utf8_downgrade(sv, TRUE);
 
     return matches;
@@ -528,7 +528,7 @@
 	SvCUR_set(sv, d - dstart);
     }
     SvUTF8_on(sv);
-    if (!isutf8 && !(PL_hints & HINT_UTF8))
+    if (!isutf8 && (PL_hints & HINT_BYTES))
 	sv_utf8_downgrade(sv, TRUE);
     SvSETMAGIC(sv);
 
--- op.c~	Mon Jan 22 23:47:55 2001
+++ op.c	Mon Jan 22 23:48:44 2001
@@ -137,7 +137,7 @@
 
     if (!(PL_in_my == KEY_our ||
 	  isALPHA(name[1]) ||
-	  (PL_hints & HINT_UTF8 && UTF8_IS_START(name[1])) ||
+	  (UTF8_IS_START(name[1])) ||
 	  (name[1] == '_' && (int)strlen(name) > 2)))
     {
 	if (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1])) {
@@ -2945,16 +2945,14 @@
 	    p = SvPV(pat, plen);
 	    pm->op_pmflags |= PMf_SKIPWHITE;
 	}
-	if ((PL_hints & HINT_UTF8) || DO_UTF8(pat))
-	    pm->op_pmdynflags |= PMdf_UTF8;
+	pm->op_pmdynflags |= PMdf_UTF8;
 	pm->op_pmregexp = CALLREGCOMP(aTHX_ p, p + plen, pm);
 	if (strEQ("\\s+", pm->op_pmregexp->precomp))
 	    pm->op_pmflags |= PMf_WHITE;
 	op_free(expr);
     }
     else {
-	if (PL_hints & HINT_UTF8)
-	    pm->op_pmdynflags |= PMdf_UTF8;
+	pm->op_pmdynflags |= PMdf_UTF8;
 	if (pm->op_pmflags & PMf_KEEP || !(PL_hints & HINT_RE_EVAL))
 	    expr = newUNOP((!(PL_hints & HINT_RE_EVAL)
 			    ? OP_REGCRESET
--- pp_ctl.c~	Mon Jan 22 23:49:22 2001
+++ pp_ctl.c	Mon Jan 22 23:49:55 2001
@@ -1462,10 +1462,7 @@
 	    }
 	    else {
 		sv_setpvn(ERRSV, message, msglen);
-		if (PL_hints & HINT_UTF8)
-		    SvUTF8_on(ERRSV);
-		else
-		    SvUTF8_off(ERRSV);
+		SvUTF8_on(ERRSV);
 	    }
 	}
 	else
--- toke.c~	Mon Jan 22 23:50:28 2001
+++ toke.c	Mon Jan 22 23:50:51 2001
@@ -37,7 +37,7 @@
 #define XENUMMASK 127
 
 /*#define UTF (SvUTF8(PL_linestr) && !(PL_hints & HINT_BYTE))*/
-#define UTF (PL_hints & HINT_UTF8)
+#define UTF !(PL_hints & HINT_BYTE)
 
 /* In variables name $^X, these are the legal values for X.
  * 1999-02-27 mjd-perl-patch@plover.com */

-- 
teco < /dev/audio
    - Ignatios Souvatzis

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About