Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?

Aharon Robbins <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <201306271346.r5RDkaSB015265__3076.87999816171$1372340823$gmane$org@skeeve.com>
> Date: Thu, 27 Jun 2013 15:27:40 +0200
> From: Paolo Bonzini <[email protected]>
> Subject: Re: locale specific ordering in EN_US -- why is a<A<b<B<y<Y<z<Z?
>
> Right now only gawk is different from the others, and not in a very
> clean manner:
>
> #ifndef GAWK
>               /* Defer to the system regex library about the meaning
>                  of range expressions.  */
>               regex_t re;
>               char pattern[6] = { '[', 0, '-', 0, ']', 0 };
>               char subject[2] = { 0, 0 };
>               c1 = c;
>               if (case_fold)
>                 {
>                   c1 = tolower (c1);
>                   c2 = tolower (c2);
>                 }
>
>               pattern[1] = c1;
>               pattern[3] = c2;
>               regcomp (&re, pattern, REG_NOSUB);
>               for (c = 0; c < NOTCHAR; ++c)
>                 {
>                   if ((case_fold && isupper (c))
>                       || (MB_CUR_MAX > 1 && btowc (c) == WEOF))
>                     continue;
>                   subject[0] = c;
>                   if (regexec (&re, subject, 0, NULL, 0) != REG_NOMATCH)
>                     setbit_case_fold_c (c, ccl);
>                 }
>               regfree (&re);
> #else
>               c1 = c;
>               if (case_fold)
>                 {
>                   c1 = tolower (c1);
>                   c2 = tolower (c2);
>                 }
>               for (c = c1; c <= c2; c++)
>                 setbit_case_fold_c (c, ccl);
> #endif
>
> I would suggest distros to rip out the #else part of this #ifndef.

And I wouldn't, but as I have no control over the distros, I'm
not going to worry about it.

All I know is that with the non-gawk case, gawk fails its test suite,
and I've given up discussing it.

Arnold
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.