Hi
There were a test in t/op/pat.t that was failing on EBCDIC
print $lower =~ m/[$UPPER]/i ? "ok 776\n" : "not ok 776\n";
This is the code that has changed in the function S_find_byclass
0a1,2
>
>
95a98,101
> #ifdef EBCDIC
> int modify;
> #endif
972a979,981
> #ifdef EBCDIC
> register PMOP *pm = cPMOP;
> #endif
989c998,1010
< tmp = 1;
---
> #ifdef EBCDIC
> if ((ANYOF_FLAGS(c) & ANYOF_UNICODE) &&
> !UTF8_IS_INVARIANT((U8)s[0]) && pm->op_pmpermflags != 0 && !reginclass(c,
> (U8*)s, 0, do_utf8)) {
> modify = 1;
> if (tmp && (norun || regtry(prog, s)))
> goto got_it;
> else
> tmp = doevery;
> }
> else
> tmp = 1;
> #else
> tmp = 1;
> #endif
This is the code that has changed in the function S_regmatch
2573a2595,2598
> #ifdef EBCDIC
> char *l = locinput;
> char *e = PL_regeol;
> #endif
2574a2600,2606
> #ifndef EBCDIC
> if (!reginclass(scan, (U8*)locinput, &inclasslen, do_utf8))
> #else
> if (!reginclass(scan, (U8*)locinput, &inclasslen, do_utf8)) {
> if (modify == 1) {
> s = locinput;
> ln = strlen(s);
2576c2608,2628
< if (!reginclass(scan, (U8*)locinput, &inclasslen, do_utf8))
---
> if (ibcmp_utf8(s, 0, ln, (bool)UTF,
> l, &e, 0, do_utf8)) {
> /* One more case for the sharp s:
> * pack("U0U*", 0xDF) =~ /ss/i,
> * the 0xC3 0x9F are the UTF-8
> * byte sequence for the U+00DF. */
> if (!(do_utf8 &&
> toLOWER(s[0]) == 's' &&
> ln >= 2 &&
> toLOWER(s[1]) == 's' &&
> (U8)l[0] == 0xC3 &&
> e - l >= 2 &&
> (U8)l[1] == 0x9F))
> sayNO;
> }
> locinput = e;
> nextchr = UCHARAT(locinput);
> break;
> } /* modify = 1*/
> else
> #endif
2577a2630,2632
> #ifdef EBCDIC
> }
> #endif
a) Now the test passes with this change. I have just used the
permission flag pm->op_pmpermflags to make the test run. I am not
sure if the change is correct?
Is there any scenerio in which this can fail?
b) case ANYOF:
if (do_utf8) {
while (s + (uskip = UTF8SKIP(s)) <= strend) {
if ((ANYOF_FLAGS(c) & ANYOF_UNICODE) ||
!UTF8_IS_INVARIANT((U8)s[0]) ?
reginclass(c, (U8*)s, 0, do_utf8) :
REGINCLASS(c, (U8*)s)) {
In the above section of code( if ((ANYOF_FLAGS(c) & ANYOF_UNICODE) )
is called twice according to me.
Can we optimise it on EBCDIC in order not to recheck the if condition again?
regards
Sastry