Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: MB_ macros confusion
- X-seq: zsh-workers 22765
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: MB_ macros confusion
- Date: Sat, 23 Sep 2006 21:16:19 +0100
- In-reply-to: Message from Andrey Borzenkov <arvidjaar@xxxxxxxxxx> of "Sat, 23 Sep 2006 21:34:19 +0400." <200609232134.20199.arvidjaar@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Andrey Borzenkov wrote:
> MB_ macros in zsh.h apply to multibyte characters while MB_ macros ztype.h
> apply to wide characters. I'd suggest calling them something different to
> avoid confusion (in particular I need something a lá ctype for mb
> characters.
> I'm likely to roll up something but I almost picked up MB_ZISTYPE).
Yes, you're right, it should be WC. Somewhere I'd tried to be
consistent, but must have missed this.
Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.61
diff -u -r1.61 subst.c
--- Src/subst.c 20 Sep 2006 09:22:34 -0000 1.61
+++ Src/subst.c 23 Sep 2006 20:06:17 -0000
@@ -360,7 +360,7 @@
l = 1;
} else {
l = MB_METACHARLENCONV(x, &c);
- if (!inq && !inp && MB_ZISTYPE(c, ISEP)) {
+ if (!inq && !inp && WC_ZISTYPE(c, ISEP)) {
*x = '\0';
for (x += l; *x; x += l) {
if (itok(STOUC(*x))) {
@@ -370,7 +370,7 @@
break;
}
l = MB_METACHARLENCONV(x, &c);
- if (!MB_ZISTYPE(c, ISEP))
+ if (!WC_ZISTYPE(c, ISEP))
break;
}
if (!*x)
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.139
diff -u -r1.139 utils.c
--- Src/utils.c 21 Sep 2006 16:36:53 -0000 1.139
+++ Src/utils.c 23 Sep 2006 20:06:19 -0000
@@ -2616,7 +2616,7 @@
continue;
} else {
ilen = MB_METACHARLENCONV(t+1, &c);
- if (MB_ZISTYPE(c, ISEP)) {
+ if (WC_ZISTYPE(c, ISEP)) {
chuck(t);
/* then advance over new character, length ilen */
} else {
@@ -2628,7 +2628,7 @@
}
} else {
ilen = MB_METACHARLENCONV(t, &c);
- if (MB_ZISTYPE(c, ISEP))
+ if (WC_ZISTYPE(c, ISEP))
break;
}
}
@@ -2683,7 +2683,7 @@
for (t = *s; *t; t += sl) {
convchar_t c;
sl = MB_METACHARLENCONV(t, &c);
- if (!MB_ZISTYPE(c, ISEP))
+ if (!WC_ZISTYPE(c, ISEP))
break;
}
*s = t;
@@ -4172,7 +4172,7 @@
#ifdef MULTIBYTE_SUPPORT
cc != WEOF &&
#endif
- MB_ISPRINT(cc)) {
+ WC_ISPRINT(cc)) {
switch (cc) {
case ZWC('\\'):
case ZWC('\''):
Index: Src/ztype.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/ztype.h,v
retrieving revision 1.6
diff -u -r1.6 ztype.h
--- Src/ztype.h 1 Aug 2006 21:28:04 -0000 1.6
+++ Src/ztype.h 23 Sep 2006 20:06:19 -0000
@@ -60,9 +60,9 @@
#define inull(X) zistype(X,INULL)
#ifdef MULTIBYTE_SUPPORT
-#define MB_ZISTYPE(X,Y) wcsitype((X),(Y))
-#define MB_ISPRINT(X) iswprint(X)
+#define WC_ZISTYPE(X,Y) wcsitype((X),(Y))
+#define WC_ISPRINT(X) iswprint(X)
#else
-#define MB_ZISTYPE(X,Y) zistype((X),(Y))
-#define MB_ISPRINT(X) isprint(X)
+#define WC_ZISTYPE(X,Y) zistype((X),(Y))
+#define WC_ISPRINT(X) isprint(X)
#endif
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.91
diff -u -r1.91 zle_main.c
--- Src/Zle/zle_main.c 17 Sep 2006 17:42:57 -0000 1.91
+++ Src/Zle/zle_main.c 23 Sep 2006 20:06:19 -0000
@@ -1457,7 +1457,7 @@
sepcount++;
} else {
t += MB_METACHARLENCONV(t, &c);
- if (MB_ZISTYPE(c, ISEP))
+ if (WC_ZISTYPE(c, ISEP))
sepcount++;
}
}
@@ -1473,7 +1473,7 @@
*nptr++ = *t++;
} else {
clen = MB_METACHARLENCONV(t, &c);
- if (MB_ZISTYPE(c, ISEP))
+ if (WC_ZISTYPE(c, ISEP))
*nptr++ = '\\';
while (clen--)
*nptr++ = *t++;
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author