X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <20090615084443.GO5039@calimero.vinschen.de> References: <20090512165404 DOT GW21324 AT calimero DOT vinschen DOT de> <20090512173153 DOT GY21324 AT calimero DOT vinschen DOT de> <3f0ad08d0905140858j17c7b374paa649f18ef18178d AT mail DOT gmail DOT com> <200905201652 DOT n4KGqYGm000509 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> <200906051625 DOT n55GP6t3028411 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> <3f0ad08d0906060242t275a78e7tb9913bf78d1c5e83 AT mail DOT gmail DOT com> <200906121538 DOT n5CFcSld014997 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> <3f0ad08d0906140604y49c470eeu68c6c307ec1cd073 AT mail DOT gmail DOT com> <3f0ad08d0906140618w53c82556ye709c70efc1c65e0 AT mail DOT gmail DOT com> <20090615084443 DOT GO5039 AT calimero DOT vinschen DOT de> Date: Mon, 15 Jun 2009 23:35:16 +0900 Message-ID: <3f0ad08d0906150735g27576d41t7207970465e5d884@mail.gmail.com> Subject: Re: [PATCH] Add "@cjknarrow" modifier (was Re: [Fwd: [1.7] wcwidth failing configure tests]) From: IWAMURO Motonori To: cygwin AT cygwin DOT com, newlib AT sourceware DOT org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 2009/6/15 Corinna Vinschen : >> Yes, but the guideline exists. >> http://cygwin.com/ml/cygwin/2009-05/msg00444.html > > A single mail in a single mailing list of a single project. =A0That's rat= her > a suggestion than a guideline... Sorry, my writing was bad. My quotation is a part of Unicode Standard Annex #11 EAST ASIAN WIDTH. Please see "When processing or displaying data" of "5 Recommendations" at http://www.unicode.org/unicode/reports/tr11/ . > If everybody agrees to this suggestion, here's the patch. Is the name of modifier prefix "cjk-" good? It influences not CJK characters but a part of symbols and European characters. Please refer to Andy's opinion: http://cygwin.com/ml/cygwin/2009-06/msg00240.html It personally proposes "ambinarrow" because the switch of Vim is "ambiwidth= ". And, I don't think that it is symmetrical. How about the following patch? (I have not changed the name of modifier prefix) --- libc/locale/locale.c.ORIG 2009-06-15 23:05:40.812500000 +0900 +++ libc/locale/locale.c 2009-06-15 22:56:35.546875000 +0900 @@ -398,7 +398,8 @@ int (*l_mbtowc) (struct _reent *, wchar_t *, const char *, size_t, const char *, mbstate_t *); #ifdef _MB_CAPABLE - int cjknarrow =3D 0; +#define CJK_DEFAULT -1 + int cjk_lang =3D CJK_DEFAULT; #endif /* "POSIX" is translated to "C", as on Linux. */ @@ -453,11 +454,14 @@ if (c[0] =3D=3D '@') { /* Modifier */ - /* Only one modifier is recognized right now. "cjknarrow" is used - to modify the behaviour of wcwidth() for East Asian languages. - For details see the comment at the end of this function. */ + /* Only one modifier is recognized right now. "cjknarrow" and + "cjkwide" are used to modify the behaviour of wcwidth() for + East Asian languages. For details see the comment at the + end of this function. */ if (!strcmp (c + 1, "cjknarrow")) - cjknarrow =3D 1; + cjk_lang =3D 0; + else if (!strcmp (c + 1, "cjkwide")) + cjk_lang =3D 1; } #endif } @@ -627,10 +631,11 @@ The result is stored in lc_ctype_cjk_lang and tested in wcwidth() to figure out the width to return (1 or 2) for the "CJK Ambiguous Width" category of characters. */ - lc_ctype_cjk_lang =3D !cjknarrow - && ((strncmp (locale, "ja", 2) =3D=3D 0 - || strncmp (locale, "ko", 2) =3D=3D 0 - || strncmp (locale, "zh", 2) =3D=3D 0)); + lc_ctype_cjk_lang =3D cjk_lang !=3D CJK_DEFAULT + ? cjk_lang + : ((strncmp (locale, "ja", 2) =3D=3D 0 + || strncmp (locale, "ko", 2) =3D=3D 0 + || strncmp (locale, "zh", 2) =3D=3D 0)); #endif } else if (category =3D=3D LC_MESSAGES) --=20 IWAMURO Motnori -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/