+ *d++ = ch;
+ }
+ else if (ch == -1) /* -1 is unmapped character */
+ *d++ = *s;
+ else if (ch == -2) /* -2 is delete character */
+ matches++;
+ s++;
+ }
+ }
+ *d = '\0';
+ SvCUR_set(sv, d - dstart);
+ }
+ else { /* isutf8 */
+ if (grows)
+ New(0, d, len*2+1, U8);
+ else
+ d = s;
+ dstart = d;
+ if (complement && !del)
+ rlen = tbl[0x100];
+
+#ifdef MACOS_TRADITIONAL
+#define comp CoMP /* "comp" is a keyword in some compilers ... */
+#endif
+
+ if (PL_op->op_private & OPpTRANS_SQUASH) {
+ UV pch = 0xfeedface;
+ while (s < send) {
+ STRLEN len;
+ UV comp = utf8_to_uvchr(s, &len);
+
+ if (comp > 0xff) {
+ if (!complement) {
+ Copy(s, d, len, U8);
+ d += len;
+ }
+ else {
+ matches++;
+ if (!del) {
+ ch = (rlen == 0) ? comp :
+ (comp - 0x100 < rlen) ?
+ tbl[comp+1] : tbl[0x100+rlen];
+ if (ch != pch) {
+ d = uvchr_to_utf8(d, ch);
+ pch = ch;
+ }
+ s += len;
+ continue;
+ }
+ }
+ }
+ else if ((ch = tbl[comp]) >= 0) {
+ matches++;
+ if (ch != pch) {
+ d = uvchr_to_utf8(d, ch);
+ pch = ch;
+ }
+ s += len;
+ continue;
+ }
+ else if (ch == -1) { /* -1 is unmapped character */
+ Copy(s, d, len, U8);
+ d += len;
+ }
+ else if (ch == -2) /* -2 is delete character */
+ matches++;
+ s += len;
+ pch = 0xfeedface;
+ }