From owner-freebsd-standards Thu Aug 15 8:50: 5 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F7AB37B400; Thu, 15 Aug 2002 08:49:54 -0700 (PDT) Received: from portege.clkao.org (61-223-25-135.HINET-IP.hinet.net [61.223.25.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D41B43E6E; Thu, 15 Aug 2002 08:49:52 -0700 (PDT) (envelope-from clkao@portege.clkao.org) Received: by portege.clkao.org (Postfix, from userid 1000) id 6BB6EBEE; Thu, 15 Aug 2002 23:49:16 +0800 (CST) Date: Thu, 15 Aug 2002 23:49:16 +0800 From: Chia-liang Kao To: "Andrey A. Chernov" , standards@FreeBSD.ORG, i18n@FreeBSD.ORG Cc: keichii@FreeBSD.ORG, tjr@FreeBSD.ORG Subject: Re: wcwidth and mklocale Message-ID: <20020815154915.GA9607@portege.clkao.org> References: <20020811181805.GA1809@portege.clkao.org> <20020812102835.GA1288@nagual.pp.ru> <20020813035009.GA1084@portege.clkao.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5G06lTa6Jq83wMTw" Content-Disposition: inline In-Reply-To: <20020813035009.GA1084@portege.clkao.org> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --5G06lTa6Jq83wMTw Content-Type: multipart/mixed; boundary="Bn2rw/3z4jIqBvZU" Content-Disposition: inline --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline attached is the revised patch that treats printable wchar without width specified as SWIDTH_1. Cheers, CLK --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="swidth.diff" Content-Transfer-Encoding: quoted-printable Index: include/ctype.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/include/ctype.h,v retrieving revision 1.18 diff -u -r1.18 ctype.h --- ctype.h 23 Mar 2002 17:24:53 -0000 1.18 +++ ctype.h 15 Aug 2002 15:31:33 -0000 @@ -65,6 +65,12 @@ #define _CTYPE_I 0x00080000L /* Ideogram */ #define _CTYPE_T 0x00100000L /* Special */ #define _CTYPE_Q 0x00200000L /* Phonogram */ +#define _CTYPE_SWM 0xe0000000L /* Mask to get screen width data */ +#define _CTYPE_SWS 30 /* Bits to shift to get width */ +#define _CTYPE_SW0 0x20000000L /* 0 width character */ +#define _CTYPE_SW1 0x00000000L /* 1 width character / default*/ +#define _CTYPE_SW2 0x80000000L /* 2 width character */ +#define _CTYPE_SW3 0xc0000000L /* 3 width character */ =20 __BEGIN_DECLS int isalnum(int); Index: lib/libc/locale/iswctype.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/lib/libc/locale/iswctype.c,v retrieving revision 1.1 diff -u -r1.1 iswctype.c --- iswctype.c 5 Aug 2002 10:45:23 -0000 1.1 +++ iswctype.c 15 Aug 2002 15:43:19 -0000 @@ -211,3 +211,13 @@ { return (__toupper(wc)); } + +#undef wcwidth +int +wcwidth(wc) + wchar_t wc; +{ + int width =3D (unsigned)__maskrune((wc), _CTYPE_SWM) >> _CTYPE_SWS; + return width ? width : isprint(wc); +} + Index: usr.bin/mklocale/lex.l =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.bin/mklocale/lex.l,v retrieving revision 1.6 diff -u -r1.6 lex.l --- lex.l 28 Apr 2002 12:34:54 -0000 1.6 +++ lex.l 11 Aug 2002 17:07:56 -0000 @@ -118,6 +118,10 @@ return(LIST); } PHONOGRAM { yylval.i =3D _CTYPE_Q|_CTYPE_R|_CTYPE_G; return(LIST); } +SWIDTH0 { yylval.i =3D _CTYPE_SW0; return(LIST); } +SWIDTH1 { yylval.i =3D _CTYPE_SW1; return(LIST); } +SWIDTH2 { yylval.i =3D _CTYPE_SW2; return(LIST); } +SWIDTH3 { yylval.i =3D _CTYPE_SW3; return(LIST); } =20 VARIABLE[\t ] { static char vbuf[1024]; char *v =3D vbuf; --Bn2rw/3z4jIqBvZU-- --5G06lTa6Jq83wMTw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE9W817k1XldlEkA5YRAs6OAJ4gVkrRdcT4qhxIH4PpTsgLVzCUEgCdHa2d vDrI0eg8z0sDJUxYRvJfTC4= =6F6u -----END PGP SIGNATURE----- --5G06lTa6Jq83wMTw-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message