p++;
break;
case 'e':
-#ifdef ASCIIish
- ender = '\033';
-#else
- ender = '\047';
-#endif
+ ender = ASCII_TO_NATIVE('\033');
p++;
break;
case 'a':
-#ifdef ASCIIish
- ender = '\007';
-#else
- ender = '\057';
-#endif
+ ender = ASCII_TO_NATIVE('\007');
p++;
break;
case 'x':
case 't': value = '\t'; break;
case 'f': value = '\f'; break;
case 'b': value = '\b'; break;
-#ifdef ASCIIish
- case 'e': value = '\033'; break;
- case 'a': value = '\007'; break;
-#else
- case 'e': value = '\047'; break;
- case 'a': value = '\057'; break;
-#endif
+ case 'e': value = ASCII_TO_NATIVE('\033');break;
+ case 'a': value = ASCII_TO_NATIVE('\007');break;
case 'x':
if (*RExC_parse == '{') {
e = strchr(RExC_parse++, '}');
if (LOC)
ANYOF_CLASS_SET(ret, ANYOF_ASCII);
else {
-#ifdef ASCIIish
+#ifndef EBCDIC
for (value = 0; value < 128; value++)
ANYOF_BITMAP_SET(ret, value);
#else /* EBCDIC */
if (LOC)
ANYOF_CLASS_SET(ret, ANYOF_NASCII);
else {
-#ifdef ASCIIish
+#ifndef EBCDIC
for (value = 128; value < 256; value++)
ANYOF_BITMAP_SET(ret, value);
#else /* EBCDIC */
/* now is the next time */
if (!SIZE_ONLY) {
if (lastvalue < 256 && value < 256) {
-#ifndef ASCIIish /* EBCDIC, for example. */
+#ifdef EBCDIC /* EBCDIC, for example. */
if ((isLOWER(lastvalue) && isLOWER(value)) ||
(isUPPER(lastvalue) && isUPPER(value)))
{
(char)min, (char)max);
}
-#ifndef ASCIIish
+#ifdef EBCDIC
if ((isLOWER(min) && isLOWER(max)) ||
(isUPPER(min) && isUPPER(max))) {
if (isLOWER(min)) {
* There will always enough room in sv since such
* escapes will be longer than any UT-F8 sequence
* they can end up as. */
-
- /* This spot is wrong for EBCDIC. Characters like
- * the lowercase letters and digits are >127 in EBCDIC,
- * so here they would need to be mapped to the Unicode
- * repertoire. --jhi */
- if (uv > 127) {
+ /* We need to map to chars to ASCII before doing the tests
+ to cover EBCDIC
+ */
+ if (NATIVE_TO_ASCII(uv) > 127) {
if (!has_utf8 && uv > 255) {
/* Might need to recode whatever we have
* accumulated so far if it contains any
* (Can't we keep track of that and avoid
* this rescan? --jhi)
*/
- int hicount = 0;
+ int hicount = 0;
char *c;
for (c = SvPVX(sv); c < d; c++) {
- if (UTF8_IS_CONTINUED(*c))
+ if (UTF8_IS_CONTINUED(NATIVE_TO_ASCII(*c)))
hicount++;
}
if (hicount) {
dst = d - 1;
while (src < dst) {
- if (UTF8_IS_CONTINUED(*src)) {
- *dst-- = UTF8_EIGHT_BIT_LO(*src);
- *dst-- = UTF8_EIGHT_BIT_HI(*src--);
+ U8 ch = NATIVE_TO_ASCII(*src);
+ if (UTF8_IS_CONTINUED(ch)) {
+ *dst-- = UTF8_EIGHT_BIT_LO(ch);
+ *dst-- = UTF8_EIGHT_BIT_HI(ch);
}
else {
- *dst-- = *src--;
+ *dst-- = ch;
}
+ src--;
}
}
}
/* \c is a control character */
case 'c':
s++;
-#ifdef EBCDIC
- *d = *s++;
- if (isLOWER(*d))
- *d = toUPPER(*d);
- *d = toCTRL(*d);
- d++;
-#else
{
U8 c = *s++;
+#ifdef EBCDIC
+ if (isLOWER(c))
+ c = toUPPER(c);
+#endif
*d++ = toCTRL(c);
}
-#endif
continue;
/* printf-style backslashes, formfeeds, newlines, etc */
case 't':
*d++ = '\t';
break;
-#ifdef EBCDIC
case 'e':
- *d++ = '\047'; /* CP 1047 */
+ *d++ = ASCII_TO_NATIVE('\033');
break;
case 'a':
- *d++ = '\057'; /* CP 1047 */
- break;
-#else
- case 'e':
- *d++ = '\033';
+ *d++ = ASCII_TO_NATIVE('\007');
break;
- case 'a':
- *d++ = '\007';
- break;
-#endif
} /* end switch */
s++;
} /* end if (backslash) */
default_action:
- if (UTF8_IS_CONTINUED(*s) && (this_utf8 || has_utf8)) {
+ if (UTF8_IS_CONTINUED(NATIVE_TO_ASCII(*s)) && (this_utf8 || has_utf8)) {
STRLEN len = (STRLEN) -1;
UV uv;
if (this_utf8) {