From: Jarkko Hietaniemi Date: Tue, 5 Feb 2002 14:25:36 +0000 (+0000) Subject: EBCDIC: SHARP S is different. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ebc501f0d71ea004ab6861cc2b4fb1f7e49fd2ae;p=p5sagit%2Fp5-mst-13.2.git EBCDIC: SHARP S is different. p4raw-id: //depot/perl@14561 --- diff --git a/regexec.c b/regexec.c index 830488a..8bd2284 100644 --- a/regexec.c +++ b/regexec.c @@ -924,8 +924,11 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta STRLEN skip = do_utf8 ? UTF8SKIP(s) : 1; if (reginclass(c, (U8*)s, do_utf8) || - (ANYOF_UNICODE_FOLD_SHARP_S(c, s, strend) && - (skip = 2))) { + (ANYOF_FOLD_SHARP_S(c, s, strend) && + /* The assignment of 2 is intentional: + * for the sharp s, the skip is 2. */ + (skip = SHARP_S_SKIP) + )) { if (tmp && (norun || regtry(prog, s))) goto got_it; else @@ -2439,8 +2442,8 @@ S_regmatch(pTHX_ regnode *prog) /* If we might have the case of the German sharp s * in a casefolding Unicode character class. */ - if (ANYOF_UNICODE_FOLD_SHARP_S(scan, locinput, PL_regeol)) { - locinput += 2; + if (ANYOF_FOLD_SHARP_S(scan, locinput, PL_regeol)) { + locinput += SHARP_S_SKIP; nextchr = UCHARAT(locinput); } else diff --git a/utf8.h b/utf8.h index c69cd86..49531a9 100644 --- a/utf8.h +++ b/utf8.h @@ -194,15 +194,28 @@ END_EXTERN_C #define UNICODE_GREEK_SMALL_LETTER_FINAL_SIGMA 0x03C2 #define UNICODE_GREEK_SMALL_LETTER_SIGMA 0x03C3 +#define EBCDIC_LATIN_SMALL_LETTER_SHARP_S 0x0059 + #define UNI_DISPLAY_ISPRINT 0x0001 #define UNI_DISPLAY_BACKSLASH 0x0002 #define UNI_DISPLAY_QQ (UNI_DISPLAY_ISPRINT|UNI_DISPLAY_BACKSLASH) #define UNI_DISPLAY_REGEX (UNI_DISPLAY_ISPRINT|UNI_DISPLAY_BACKSLASH) -#define ANYOF_UNICODE_FOLD_SHARP_S(node, input, end) \ +#ifdef EBCDIC +# define ANYOF_FOLD_SHARP_S(node, input, end) \ + (ANYOF_BITMAP_TEST(node, EBCDIC_LATIN_SMALL_LETTER_SHARP_S) && \ + (ANYOF_FLAGS(node) & ANYOF_UNICODE) && \ + (ANYOF_FLAGS(node) & ANYOF_FOLD) && \ + ((end) > (input) + 1) && \ + toLOWER((input)[0]) == 's' && \ + toLOWER((input)[1]) == 's') +#else +# define ANYOF_FOLD_SHARP_S(node, input, end) \ (ANYOF_BITMAP_TEST(node, UNICODE_LATIN_SMALL_LETTER_SHARP_S) && \ (ANYOF_FLAGS(node) & ANYOF_UNICODE) && \ (ANYOF_FLAGS(node) & ANYOF_FOLD) && \ ((end) > (input) + 1) && \ toLOWER((input)[0]) == 's' && \ toLOWER((input)[1]) == 's') +#endif +#define SHARP_S_SKIP 2