In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/100b2bb8398f189ce38052fd6f7138adebb1b995?hp=e9c9d63a490e3e74156a45e54ee8104fc9c83ebb>
- Log ----------------------------------------------------------------- commit 100b2bb8398f189ce38052fd6f7138adebb1b995 Author: Karl Williamson <[email protected]> Date: Sun Dec 7 21:53:37 2014 -0700 perly.c: Fix EBCDIC bug The code was changing the value in a structure on EBCDIC platforms. It turns out that that structure element is used later under quite limited circumstances. The changed value is actually only needed during an array look-up, so we no longer store the change. M perly.c commit 239f83d5b3d443f78d6f2c12df7ff685f9bb7e65 Author: Karl Williamson <[email protected]> Date: Sat Dec 6 16:06:49 2014 -0700 toke.c: Generalize trace for non-ASCII platform This was very ASCII-specific. The newer is clearer and saves a test. M toke.c commit c536450b09fc53d9fd03b72f6cbd62c89d4fd30f Author: Karl Williamson <[email protected]> Date: Wed Nov 26 19:51:23 2014 -0700 -Dp does work on EBCDIC. M perl.c ----------------------------------------------------------------------- Summary of changes: perl.c | 5 ----- perly.c | 20 ++++++++++---------- toke.c | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/perl.c b/perl.c index a238fb4..be9932d 100644 --- a/perl.c +++ b/perl.c @@ -3060,11 +3060,6 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp) const char *const *p = usage_msgd; while (*p) PerlIO_puts(PerlIO_stdout(), *p++); } -# ifdef EBCDIC - if ((i & DEBUG_p_FLAG) && ckWARN_d(WARN_DEBUGGING)) - Perl_warner(aTHX_ packWARN(WARN_DEBUGGING), - "-Dp not implemented on this platform\n"); -# endif return i; } #endif diff --git a/perly.c b/perly.c index 44d6ce6..f3243d4 100644 --- a/perly.c +++ b/perly.c @@ -320,15 +320,6 @@ Perl_yyparse (pTHX_ int gramtype) if (parser->yychar == YYEMPTY) { YYDPRINTF ((Perl_debug_log, "Reading a token: ")); parser->yychar = yylex(); - -/* perly.tab is shipped based on an ASCII system; if it were to be regenerated - * on a platform that doesn't use ASCII, this translation back would need to be - * removed */ -# ifdef EBCDIC - if (parser->yychar >= 0) { - parser->yychar = NATIVE_TO_UNI(parser->yychar); - } -# endif } if (parser->yychar <= YYEOF) { @@ -336,7 +327,16 @@ Perl_yyparse (pTHX_ int gramtype) YYDPRINTF ((Perl_debug_log, "Now at end of input.\n")); } else { - yytoken = YYTRANSLATE (parser->yychar); + /* perly.tab is shipped based on an ASCII system, so need to index it + * with characters translated to ASCII. Although it's not designed for + * this purpose, we can use NATIVE_TO_UNI here. It returns its + * argument on ASCII platforms, and on EBCDIC translates native to + * ascii in the 0-255 range, leaving everything else unchanged. This + * jibes with yylex() returning some bare characters in that range, but + * all tokens it returns are either 0, or above 255. There could be a + * problem if NULs weren't 0, or were ever returned as raw chars by + * yylex() */ + yytoken = YYTRANSLATE (NATIVE_TO_UNI(parser->yychar)); YYDSYMPRINTF ("Next token is", yytoken, &parser->yylval); } diff --git a/toke.c b/toke.c index ae832c0..d364e42 100644 --- a/toke.c +++ b/toke.c @@ -399,7 +399,7 @@ S_tokereport(pTHX_ I32 rv, const YYSTYPE* lvalp) } if (name) Perl_sv_catpv(aTHX_ report, name); - else if ((char)rv > ' ' && (char)rv <= '~') + else if (isGRAPH(rv)) { Perl_sv_catpvf(aTHX_ report, "'%c'", (char)rv); if ((char)rv == 'p') -- Perl5 Master Repository
