From 7e38b1ea2bf1a0817942275cea89c959bf446d87 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 23 Apr 2012 15:25:23 -0400 Subject: destubify iswalpha and update iswpunct to unicode 6.1 alpha is defined as unicode property "Alphabetic" plus category Nd minus ASCII digits minus 2 special-cased Thai punctuation marks supposedly misclassified by Unicode as letters. punct is defined as all of unicode except control, alphanumeric, and space characters. the tables were generated by a simple tool based on the code posted previously to the mailing list. in the future, this and other code used for maintaining locale/iconv/i18n data will be published either in the main source repository or in a separate locale data generation repository. --- src/ctype/iswalpha.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/ctype/iswalpha.c') diff --git a/src/ctype/iswalpha.c b/src/ctype/iswalpha.c index 0f031eac..4007c8a6 100644 --- a/src/ctype/iswalpha.c +++ b/src/ctype/iswalpha.c @@ -1,6 +1,14 @@ #include +static unsigned char table[] = { +#include "alpha.h" +}; + int iswalpha(wint_t wc) { - return (32U|wc)-'a'<26; + if (wc<0x20000U) + return (table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1; + if (wc<0x2fffeU) + return 1; + return 0; } -- cgit v1.2.1