zsh-workers
 help / color / mirror / code / Atom feed
* MB_ macros confusion
@ 2006-09-23 17:34 ` Andrey Borzenkov
  2006-09-23 20:16   ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Borzenkov @ 2006-09-23 17:34 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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). 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFFXAcR6LMutpd94wRAn0CAJ4z7CHO5zPQWyVcSZTPnuy9GabmMACfZJ9z
7PHml7ONNRw5nCF/ncFRGPg=
=O6To
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: MB_ macros confusion
  2006-09-23 17:34 ` MB_ macros confusion Andrey Borzenkov
@ 2006-09-23 20:16   ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2006-09-23 20:16 UTC (permalink / raw)
  To: zsh-workers

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3667 bytes --]

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@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-23 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <arvidjaar@newmail.ru>
2006-09-23 17:34 ` MB_ macros confusion Andrey Borzenkov
2006-09-23 20:16   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).