From: Nicholas Clark Date: Mon, 17 Apr 2006 16:52:54 +0000 (+0000) Subject: Turn on UTF8 cache assertions with -Ca X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5a22a2bbf3880b61603040e7bdfddd4d5f5809a5;p=p5sagit%2Fp5-mst-13.2.git Turn on UTF8 cache assertions with -Ca p4raw-id: //depot/perl@27875 --- diff --git a/locale.c b/locale.c index 9acacb1..d90b557 100644 --- a/locale.c +++ b/locale.c @@ -543,6 +543,8 @@ Perl_init_i18nl10n(pTHX_ int printwarn) { const char *p = PerlEnv_getenv("PERL_UNICODE"); PL_unicode = p ? parse_unicode_opts(&p) : 0; + if (PL_unicode & PERL_UNICODE_UTF8CACHEASSERT_FLAG) + PL_utf8cache = -1; } #endif diff --git a/perl.c b/perl.c index a8fd47f..320793d 100644 --- a/perl.c +++ b/perl.c @@ -3016,6 +3016,8 @@ Perl_moreswitches(pTHX_ char *s) case 'C': s++; PL_unicode = parse_unicode_opts( (const char **)&s ); + if (PL_unicode & PERL_UNICODE_UTF8CACHEASSERT_FLAG) + PL_utf8cache = -1; return s; case 'F': PL_minus_F = TRUE; diff --git a/perl.h b/perl.h index c44c9b9..5145e10 100644 --- a/perl.h +++ b/perl.h @@ -5444,6 +5444,7 @@ extern void moncontrol(int); #define PERL_UNICODE_ARGV_FLAG 0x0020 #define PERL_UNICODE_LOCALE_FLAG 0x0040 #define PERL_UNICODE_WIDESYSCALLS_FLAG 0x0080 /* for Sarathy */ +#define PERL_UNICODE_UTF8CACHEASSERT_FLAG 0x0100 #define PERL_UNICODE_STD_FLAG \ (PERL_UNICODE_STDIN_FLAG | \ @@ -5459,7 +5460,7 @@ extern void moncontrol(int); PERL_UNICODE_INOUT_FLAG | \ PERL_UNICODE_LOCALE_FLAG) -#define PERL_UNICODE_ALL_FLAGS 0x00ff +#define PERL_UNICODE_ALL_FLAGS 0x01ff #define PERL_UNICODE_STDIN 'I' #define PERL_UNICODE_STDOUT 'O' @@ -5471,6 +5472,7 @@ extern void moncontrol(int); #define PERL_UNICODE_ARGV 'A' #define PERL_UNICODE_LOCALE 'L' #define PERL_UNICODE_WIDESYSCALLS 'W' +#define PERL_UNICODE_UTF8CACHEASSERT 'a' #define PERL_SIGNALS_UNSAFE_FLAG 0x0001 diff --git a/pod/perlrun.pod b/pod/perlrun.pod index b973779..a0115bc 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -314,6 +314,11 @@ are as follows; listing the letters is equal to summing the numbers. variables (the LC_ALL, LC_TYPE, and LANG, in the order of decreasing precedence) -- if the variables indicate UTF-8, then the selected "IOEioA" are in effect + a 256 Set ${^UTF8CACHE} to -1, to run the UTF-8 caching code in + debugging mode. + +=for documenting_the_underdocumented +perl.h gives W/128 as PERL_UNICODE_WIDESYSCALLS "/* for Sarathy */" =for todo perltodo mentions Unicode in %ENV and filenames. I guess that these will be diff --git a/util.c b/util.c index 32aac26..e27d02e 100644 --- a/util.c +++ b/util.c @@ -4924,6 +4924,8 @@ Perl_parse_unicode_opts(pTHX_ const char **popt) opt |= PERL_UNICODE_LOCALE_FLAG; break; case PERL_UNICODE_ARGV: opt |= PERL_UNICODE_ARGV_FLAG; break; + case PERL_UNICODE_UTF8CACHEASSERT: + opt |= PERL_UNICODE_UTF8CACHEASSERT_FLAG; break; default: if (*p != '\n' && *p != '\r') Perl_croak(aTHX_