From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24711 invoked from network); 1 Nov 2005 04:31:16 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Nov 2005 04:31:16 -0000 Received: (qmail 72833 invoked from network); 1 Nov 2005 04:31:10 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Nov 2005 04:31:10 -0000 Received: (qmail 15562 invoked by alias); 1 Nov 2005 04:31:07 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21964 Received: (qmail 15553 invoked from network); 1 Nov 2005 04:31:06 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Nov 2005 04:31:06 -0000 Received: (qmail 72558 invoked from network); 1 Nov 2005 04:31:06 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO dot.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 1 Nov 2005 04:31:05 -0000 Received: by dot.blorf.net (Postfix, from userid 1000) id 6FEFE2F77; Mon, 31 Oct 2005 20:31:04 -0800 (PST) Date: Mon, 31 Oct 2005 20:31:04 -0800 From: Wayne Davison To: Peter Stephenson Cc: Zsh hackers list Subject: Re: changing ZLE_CHAR_T? Message-ID: <20051101043104.GD18495@blorf.net> References: <20051028225841.GC27510@blorf.net> <200510290959.j9T9x0aI003876@pwslaptop.csr.com> <20051031214538.GB18495@blorf.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WYTEVAkct0FjGQmd" Content-Disposition: inline In-Reply-To: <20051031214538.GB18495@blorf.net> User-Agent: Mutt/1.5.9i X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 --WYTEVAkct0FjGQmd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline FYI, I went ahead and committed the ZLE_CHAR_T changes with a few extra minor modifications from the posted patch. On Mon, Oct 31, 2005 at 01:45:38PM -0800, Wayne Davison wrote: > (aside: we could switch some of the existing macros over to this > method, such as idigit(), and free up some bits in the typtab[] > array). It also allows the set of characters for things like isalpha() to flex with the OS's definition. Attached is a diff that changes idigit(), ialpha(), and ialnum(). I almost changed icntrl() too, but I noticed that zsh is currently treating chars 128 - 159 as control characters (something that the normal iscntrl() function does not do), so I left it alone for now. This does point out an inconsistency in multibyte mode: the ZC_icntrl() macro (which currently uses iswcntrl()) will not return true for these extended chars. Do we need this? In an attempt to make multibyte ZC_iblank() and ZC_inblank() work the same as the non-multibyte versions, this patch chooses to extend the non-multibyte versions of the functions by giving \r and \v the IBLANK and INBLANK bits. I'm not going to commit this, so feel free to let me know if this is not a good way to go. ..wayne.. --WYTEVAkct0FjGQmd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="typtab.patch" --- Src/utils.c 1 Nov 2005 02:50:24 -0000 1.102 +++ Src/utils.c 1 Nov 2005 04:06:03 -0000 @@ -2534,9 +2534,9 @@ inittyptab(void) typtab[t0] = typtab[t0 + 128] = ICNTRL; typtab[127] = ICNTRL; for (t0 = '0'; t0 <= '9'; t0++) - typtab[t0] = IDIGIT | IALNUM | IWORD | IIDENT | IUSER; + typtab[t0] = IIDENT | IUSER | IWORD; for (t0 = 'a'; t0 <= 'z'; t0++) - typtab[t0] = typtab[t0 - 'a' + 'A'] = IALPHA | IALNUM | IIDENT | IUSER | IWORD; + typtab[t0] = typtab[t0 - 'a' + 'A'] = IIDENT | IUSER | IWORD; #ifndef MULTIBYTE_SUPPORT /* * This really doesn't seem to me the right thing to do when @@ -2547,12 +2547,14 @@ inittyptab(void) * should disappear into history... */ for (t0 = 0240; t0 != 0400; t0++) - typtab[t0] = IALPHA | IALNUM | IIDENT | IUSER | IWORD; + typtab[t0] = IIDENT | IUSER | IWORD; #endif typtab['_'] = IIDENT | IUSER; typtab['-'] = IUSER; typtab[' '] |= IBLANK | INBLANK; typtab['\t'] |= IBLANK | INBLANK; + typtab['\r'] |= IBLANK | INBLANK; + typtab['\v'] |= IBLANK | INBLANK; typtab['\n'] |= INBLANK; typtab['\0'] |= IMETA; typtab[STOUC(Meta) ] |= IMETA; --- Src/ztype.h 1 Nov 2005 02:50:22 -0000 1.3 +++ Src/ztype.h 1 Nov 2005 04:06:03 -0000 @@ -27,13 +27,13 @@ * */ -#define IDIGIT (1 << 0) -#define IALNUM (1 << 1) +#define UNUSED0 (1 << 0) +#define UNUSED1 (1 << 1) #define IBLANK (1 << 2) #define INBLANK (1 << 3) #define ITOK (1 << 4) #define ISEP (1 << 5) -#define IALPHA (1 << 6) +#define UNUSED6 (1 << 6) #define IIDENT (1 << 7) #define IUSER (1 << 8) #define ICNTRL (1 << 9) @@ -42,14 +42,12 @@ #define IMETA (1 << 12) #define IWSEP (1 << 13) #define INULL (1 << 14) +#define UNUSED15 (1 << 15) #define _icom(X,Y) (typtab[STOUC(X)] & Y) -#define idigit(X) _icom(X,IDIGIT) -#define ialnum(X) _icom(X,IALNUM) #define iblank(X) _icom(X,IBLANK) /* blank, not including \n */ #define inblank(X) _icom(X,INBLANK) /* blank or \n */ #define itok(X) _icom(X,ITOK) #define isep(X) _icom(X,ISEP) -#define ialpha(X) _icom(X,IALPHA) #define iident(X) _icom(X,IIDENT) #define iuser(X) _icom(X,IUSER) /* username char */ #define icntrl(X) _icom(X,ICNTRL) @@ -59,7 +57,10 @@ #define iwsep(X) _icom(X,IWSEP) #define inull(X) _icom(X,INULL) +#define ialnum(X) isalnum(STOUC(X)) +#define ialpha(X) isalpha(STOUC(X)) #define iascii(X) isascii(STOUC(X)) +#define idigit(X) isdigit(STOUC(X)) #define ilower(X) islower(STOUC(X)) #define iprint(X) isprint(STOUC(X)) #define iupper(X) isupper(STOUC(X)) --WYTEVAkct0FjGQmd--