* enc/unicode/name2ctype.h: split from enc/unicode.c and made a

perfect hash.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-08-21 08:01:09 +00:00
parent a606038c6a
commit a7b920686a
9 changed files with 1483 additions and 152 deletions

View File

@ -1,3 +1,8 @@
Fri Aug 21 17:01:04 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enc/unicode/name2ctype.h: split from enc/unicode.c and made a
perfect hash.
Fri Aug 21 15:13:08 2009 NARUSE, Yui <naruse@ruby-lang.org>
* include/ruby/io.h, io.c (FMODE_SETENC_BY_BOM):

View File

@ -208,6 +208,28 @@ lex.c: defs/keywords
cp $@ $(srcdir)/lex.c.blt; \
fi
NAME2CTYPE_OPTIONS = -7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p
enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd
$(MAKEDIRS) $(@D)
@\
if cmp -s $(?:.kwd=.src) $?; then \
set -x; \
cp $(?:.kwd=.h.blt) $@; \
else \
trap '$(RM) $@-1.h $@-2.h' 0 && \
set -x; \
sed '/^#ifdef USE_UNICODE_PROPERTIES/,/^#endif/d' $? | gperf $(NAME2CTYPE_OPTIONS) > $@-1.h && \
gperf $(NAME2CTYPE_OPTIONS) < $? > $@-2.h && \
diff -DUSE_UNICODE_PROPERTIES $@-1.h $@-2.h > $@.tmp; \
mv $@.tmp $@ && \
cp $? $(?:.kwd=.src) && \
cp $@ $(?:.kwd=.h.blt); \
fi
enc/unicode/name2ctype_prop.h: $(srcdir)/enc/unicode/name2ctype.kwd
$(MAKEDIRS) $(@D)
.c.@OBJEXT@:
$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $<

View File

@ -640,7 +640,9 @@ us_ascii.$(OBJEXT): {$(VPATH)}us_ascii.c {$(VPATH)}regenc.h \
unicode.$(OBJEXT): {$(VPATH)}unicode.c {$(VPATH)}regint.h \
{$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
{$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
{$(VPATH)}missing.h {$(VPATH)}intern.h
{$(VPATH)}missing.h {$(VPATH)}intern.h \
{$(VPATH)}enc/unicode/name2ctype.h
utf_8.$(OBJEXT): {$(VPATH)}utf_8.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
{$(VPATH)}defines.h {$(VPATH)}oniguruma.h
@ -678,7 +680,7 @@ srcs-enc: $(ENC_MK)
$(MAKE) -f $(ENC_MK) RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) srcs
incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}encdb.h {$(VPATH)}transdb.h {$(VPATH)}known_errors.inc \
$(srcdir)/revision.h $(REVISION_H)
$(srcdir)/revision.h $(REVISION_H) enc/unicode/name2ctype.h
insns: $(INSNS)

View File

@ -10486,128 +10486,7 @@ static const CaseUnfold_13_Type CaseUnfold_13[] = {
{ {0x03c9, 0x0342, 0x03b9}, {1, {0x1ff7 }}}
};
static PosixBracketEntryType HashEntryData[] = {
{ (UChar* )"NEWLINE", 0, 7 },
{ (UChar* )"Alpha", 1, 5 },
{ (UChar* )"Blank", 2, 5 },
{ (UChar* )"Cntrl", 3, 5 },
{ (UChar* )"Digit", 4, 5 },
{ (UChar* )"Graph", 5, 5 },
{ (UChar* )"Lower", 6, 5 },
{ (UChar* )"Print", 7, 5 },
{ (UChar* )"Punct", 8, 5 },
{ (UChar* )"Space", 9, 5 },
{ (UChar* )"Upper", 10, 5 },
{ (UChar* )"XDigit", 11, 6 },
{ (UChar* )"Word", 12, 4 },
{ (UChar* )"Alnum", 13, 5 },
{ (UChar* )"ASCII", 14, 5 },
#ifdef USE_UNICODE_PROPERTIES
{ (UChar* )"Any", 15, 3 },
{ (UChar* )"Assigned", 16, 8 },
{ (UChar* )"C", 17, 1 },
{ (UChar* )"Cc", 18, 2 },
{ (UChar* )"Cf", 19, 2 },
{ (UChar* )"Cn", 20, 2 },
{ (UChar* )"Co", 21, 2 },
{ (UChar* )"Cs", 22, 2 },
{ (UChar* )"L", 23, 1 },
{ (UChar* )"Ll", 24, 2 },
{ (UChar* )"Lm", 25, 2 },
{ (UChar* )"Lo", 26, 2 },
{ (UChar* )"Lt", 27, 2 },
{ (UChar* )"Lu", 28, 2 },
{ (UChar* )"M", 29, 1 },
{ (UChar* )"Mc", 30, 2 },
{ (UChar* )"Me", 31, 2 },
{ (UChar* )"Mn", 32, 2 },
{ (UChar* )"N", 33, 1 },
{ (UChar* )"Nd", 34, 2 },
{ (UChar* )"Nl", 35, 2 },
{ (UChar* )"No", 36, 2 },
{ (UChar* )"P", 37, 1 },
{ (UChar* )"Pc", 38, 2 },
{ (UChar* )"Pd", 39, 2 },
{ (UChar* )"Pe", 40, 2 },
{ (UChar* )"Pf", 41, 2 },
{ (UChar* )"Pi", 42, 2 },
{ (UChar* )"Po", 43, 2 },
{ (UChar* )"Ps", 44, 2 },
{ (UChar* )"S", 45, 1 },
{ (UChar* )"Sc", 46, 2 },
{ (UChar* )"Sk", 47, 2 },
{ (UChar* )"Sm", 48, 2 },
{ (UChar* )"So", 49, 2 },
{ (UChar* )"Z", 50, 1 },
{ (UChar* )"Zl", 51, 2 },
{ (UChar* )"Zp", 52, 2 },
{ (UChar* )"Zs", 53, 2 },
{ (UChar* )"Arabic", 54, 6 },
{ (UChar* )"Armenian", 55, 8 },
{ (UChar* )"Bengali", 56, 7 },
{ (UChar* )"Bopomofo", 57, 8 },
{ (UChar* )"Braille", 58, 7 },
{ (UChar* )"Buginese", 59, 8 },
{ (UChar* )"Buhid", 60, 5 },
{ (UChar* )"Canadian_Aboriginal", 61, 19 },
{ (UChar* )"Cherokee", 62, 8 },
{ (UChar* )"Common", 63, 6 },
{ (UChar* )"Coptic", 64, 6 },
{ (UChar* )"Cypriot", 65, 7 },
{ (UChar* )"Cyrillic", 66, 8 },
{ (UChar* )"Deseret", 67, 7 },
{ (UChar* )"Devanagari", 68, 10 },
{ (UChar* )"Ethiopic", 69, 8 },
{ (UChar* )"Georgian", 70, 8 },
{ (UChar* )"Glagolitic", 71, 10 },
{ (UChar* )"Gothic", 72, 6 },
{ (UChar* )"Greek", 73, 5 },
{ (UChar* )"Gujarati", 74, 8 },
{ (UChar* )"Gurmukhi", 75, 8 },
{ (UChar* )"Han", 76, 3 },
{ (UChar* )"Hangul", 77, 6 },
{ (UChar* )"Hanunoo", 78, 7 },
{ (UChar* )"Hebrew", 79, 6 },
{ (UChar* )"Hiragana", 80, 8 },
{ (UChar* )"Inherited", 81, 9 },
{ (UChar* )"Kannada", 82, 7 },
{ (UChar* )"Katakana", 83, 8 },
{ (UChar* )"Kharoshthi", 84, 10 },
{ (UChar* )"Khmer", 85, 5 },
{ (UChar* )"Lao", 86, 3 },
{ (UChar* )"Latin", 87, 5 },
{ (UChar* )"Limbu", 88, 5 },
{ (UChar* )"Linear_B", 89, 8 },
{ (UChar* )"Malayalam", 90, 9 },
{ (UChar* )"Mongolian", 91, 9 },
{ (UChar* )"Myanmar", 92, 7 },
{ (UChar* )"New_Tai_Lue", 93, 11 },
{ (UChar* )"Ogham", 94, 5 },
{ (UChar* )"Old_Italic", 95, 10 },
{ (UChar* )"Old_Persian", 96, 11 },
{ (UChar* )"Oriya", 97, 5 },
{ (UChar* )"Osmanya", 98, 7 },
{ (UChar* )"Runic", 99, 5 },
{ (UChar* )"Shavian", 100, 7 },
{ (UChar* )"Sinhala", 101, 7 },
{ (UChar* )"Syloti_Nagri", 102, 12 },
{ (UChar* )"Syriac", 103, 6 },
{ (UChar* )"Tagalog", 104, 7 },
{ (UChar* )"Tagbanwa", 105, 8 },
{ (UChar* )"Tai_Le", 106, 6 },
{ (UChar* )"Tamil", 107, 5 },
{ (UChar* )"Telugu", 108, 6 },
{ (UChar* )"Thaana", 109, 6 },
{ (UChar* )"Thai", 110, 4 },
{ (UChar* )"Tibetan", 111, 7 },
{ (UChar* )"Tifinagh", 112, 8 },
{ (UChar* )"Ugaritic", 113, 8 },
{ (UChar* )"Yi", 114, 2 },
#endif /* USE_UNICODE_PROPERTIES */
{ (UChar* )NULL, -1, 0 }
};
#include "enc/unicode/name2ctype.h"
#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define CODE_RANGES_NUM numberof(CodeRanges)
@ -10777,33 +10656,11 @@ onigenc_utf16_32_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
#define PROPERTY_NAME_MAX_SIZE 20
static st_table* NameCtypeTable;
static int NameTableInited = 0;
static int init_name_ctype_table(void)
{
PosixBracketEntryType *pb;
THREAD_ATOMIC_START;
NameCtypeTable = onig_st_init_strend_table_with_size(100);
if (ONIG_IS_NULL(NameCtypeTable)) return ONIGERR_MEMORY;
for (pb = HashEntryData; ONIG_IS_NOT_NULL(pb->name); pb++) {
onig_st_insert_strend(NameCtypeTable, pb->name, pb->name + pb->len,
(st_data_t )pb->ctype);
}
NameTableInited = 1;
THREAD_ATOMIC_END;
return 0;
}
extern int
onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end)
{
int len;
st_data_t ctype;
int ctype;
UChar buf[PROPERTY_NAME_MAX_SIZE];
UChar *p;
OnigCodePoint code;
@ -10824,14 +10681,11 @@ onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end
buf[len] = 0;
if (NameTableInited == 0) init_name_ctype_table();
if (onig_st_lookup_strend(NameCtypeTable, buf, buf + len,
&ctype) == 0) {
if ((ctype = uniname2ctype(buf, len)) < 0) {
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
}
return (int)ctype;
return ctype;
}

588
enc/unicode/name2ctype.h Normal file
View File

@ -0,0 +1,588 @@
/* C code produced by gperf version 3.0.4 */
/* Command-line: gperf -7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p */
#ifndef USE_UNICODE_PROPERTIES
/* Computed positions: -k'1,3' */
#else /* USE_UNICODE_PROPERTIES */
/* Computed positions: -k'1,3,$' */
#endif /* USE_UNICODE_PROPERTIES */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
struct uniname2ctype_struct {
int name, ctype;
};
static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int);
#ifndef USE_UNICODE_PROPERTIES
#define TOTAL_KEYWORDS 15
#define MIN_WORD_LENGTH 4
#define MAX_WORD_LENGTH 7
#define MIN_HASH_VALUE 6
#define MAX_HASH_VALUE 20
/* maximum key range = 15, duplicates = 0 */
#else /* USE_UNICODE_PROPERTIES */
#define TOTAL_KEYWORDS 115
#define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 19
#define MIN_HASH_VALUE 3
#define MAX_HASH_VALUE 138
/* maximum key range = 136, duplicates = 0 */
#endif /* USE_UNICODE_PROPERTIES */
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
uniname2ctype_hash (str, len)
register const char *str;
register unsigned int len;
{
static const unsigned char asso_values[] =
{
#ifndef USE_UNICODE_PROPERTIES
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 1, 10, 3, 7, 21,
21, 8, 21, 21, 21, 21, 6, 21, 8, 21,
4, 21, 21, 5, 21, 8, 21, 1, 4, 21,
21, 21, 21, 21, 21, 21, 21, 5, 21, 21,
21, 21, 21, 7, 21, 3, 21, 21, 21, 21,
2, 21, 1, 21, 1, 21, 2, 21, 21, 6,
21, 21, 21, 21, 21, 21, 21, 21
#else /* USE_UNICODE_PROPERTIES */
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 31, 4, 2, 80, 31,
139, 40, 45, 26, 139, 49, 14, 12, 33, 12,
1, 139, 74, 3, 3, 74, 139, 55, 74, 39,
49, 139, 139, 139, 139, 139, 139, 20, 139, 8,
51, 20, 65, 41, 34, 11, 42, 28, 45, 33,
2, 5, 25, 66, 14, 81, 1, 48, 29, 3,
2, 44, 139, 22, 139, 139, 139, 139, 139, 139
#endif /* USE_UNICODE_PROPERTIES */
};
#ifndef USE_UNICODE_PROPERTIES
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
#else /* USE_UNICODE_PROPERTIES */
register int hval = len;
switch (hval)
{
default:
hval += asso_values[(unsigned char)str[2]+2];
/*FALLTHROUGH*/
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
#endif /* USE_UNICODE_PROPERTIES */
}
struct uniname2ctype_pool_t
{
#ifndef USE_UNICODE_PROPERTIES
char uniname2ctype_pool_str6[sizeof("Word")];
char uniname2ctype_pool_str7[sizeof("Alpha")];
char uniname2ctype_pool_str8[sizeof("Alnum")];
char uniname2ctype_pool_str9[sizeof("ASCII")];
char uniname2ctype_pool_str10[sizeof("Cntrl")];
char uniname2ctype_pool_str11[sizeof("Punct")];
char uniname2ctype_pool_str12[sizeof("Print")];
char uniname2ctype_pool_str13[sizeof("XDigit")];
char uniname2ctype_pool_str14[sizeof("Upper")];
char uniname2ctype_pool_str15[sizeof("Space")];
char uniname2ctype_pool_str16[sizeof("NEWLINE")];
char uniname2ctype_pool_str17[sizeof("Lower")];
char uniname2ctype_pool_str18[sizeof("Graph")];
char uniname2ctype_pool_str19[sizeof("Digit")];
char uniname2ctype_pool_str20[sizeof("Blank")];
#else /* USE_UNICODE_PROPERTIES */
char uniname2ctype_pool_str3[sizeof("P")];
char uniname2ctype_pool_str5[sizeof("C")];
char uniname2ctype_pool_str6[sizeof("Cn")];
char uniname2ctype_pool_str7[sizeof("S")];
char uniname2ctype_pool_str8[sizeof("Po")];
char uniname2ctype_pool_str9[sizeof("Co")];
char uniname2ctype_pool_str10[sizeof("So")];
char uniname2ctype_pool_str11[sizeof("Pc")];
char uniname2ctype_pool_str12[sizeof("Cc")];
char uniname2ctype_pool_str13[sizeof("Sc")];
char uniname2ctype_pool_str14[sizeof("Pi")];
char uniname2ctype_pool_str15[sizeof("Common")];
char uniname2ctype_pool_str16[sizeof("Mn")];
char uniname2ctype_pool_str17[sizeof("Lt")];
char uniname2ctype_pool_str18[sizeof("Syriac")];
char uniname2ctype_pool_str19[sizeof("Cyrillic")];
char uniname2ctype_pool_str20[sizeof("Shavian")];
char uniname2ctype_pool_str21[sizeof("Lo")];
char uniname2ctype_pool_str22[sizeof("Mc")];
char uniname2ctype_pool_str23[sizeof("Pe")];
char uniname2ctype_pool_str24[sizeof("Cypriot")];
char uniname2ctype_pool_str25[sizeof("M")];
char uniname2ctype_pool_str26[sizeof("Thai")];
char uniname2ctype_pool_str28[sizeof("Syloti_Nagri")];
char uniname2ctype_pool_str29[sizeof("L")];
char uniname2ctype_pool_str30[sizeof("Coptic")];
char uniname2ctype_pool_str31[sizeof("Bopomofo")];
char uniname2ctype_pool_str32[sizeof("Punct")];
char uniname2ctype_pool_str33[sizeof("Sk")];
char uniname2ctype_pool_str34[sizeof("Me")];
char uniname2ctype_pool_str35[sizeof("Print")];
char uniname2ctype_pool_str36[sizeof("Space")];
char uniname2ctype_pool_str37[sizeof("Thaana")];
char uniname2ctype_pool_str38[sizeof("Sm")];
char uniname2ctype_pool_str39[sizeof("Braille")];
char uniname2ctype_pool_str40[sizeof("No")];
char uniname2ctype_pool_str41[sizeof("Myanmar")];
char uniname2ctype_pool_str42[sizeof("Tagbanwa")];
char uniname2ctype_pool_str43[sizeof("Buginese")];
char uniname2ctype_pool_str44[sizeof("Osmanya")];
char uniname2ctype_pool_str45[sizeof("Blank")];
char uniname2ctype_pool_str46[sizeof("Armenian")];
char uniname2ctype_pool_str47[sizeof("Bengali")];
char uniname2ctype_pool_str48[sizeof("Mongolian")];
char uniname2ctype_pool_str49[sizeof("Lm")];
char uniname2ctype_pool_str50[sizeof("Latin")];
char uniname2ctype_pool_str51[sizeof("Linear_B")];
char uniname2ctype_pool_str52[sizeof("Yi")];
char uniname2ctype_pool_str53[sizeof("Arabic")];
char uniname2ctype_pool_str54[sizeof("Pd")];
char uniname2ctype_pool_str55[sizeof("Sinhala")];
char uniname2ctype_pool_str56[sizeof("Malayalam")];
char uniname2ctype_pool_str57[sizeof("Tai_Le")];
char uniname2ctype_pool_str58[sizeof("Tamil")];
char uniname2ctype_pool_str59[sizeof("Telugu")];
char uniname2ctype_pool_str60[sizeof("Gurmukhi")];
char uniname2ctype_pool_str61[sizeof("Ll")];
char uniname2ctype_pool_str62[sizeof("Tagalog")];
char uniname2ctype_pool_str63[sizeof("Tibetan")];
char uniname2ctype_pool_str64[sizeof("Lu")];
char uniname2ctype_pool_str65[sizeof("Oriya")];
char uniname2ctype_pool_str66[sizeof("Glagolitic")];
char uniname2ctype_pool_str67[sizeof("N")];
char uniname2ctype_pool_str68[sizeof("Pf")];
char uniname2ctype_pool_str69[sizeof("Cf")];
char uniname2ctype_pool_str70[sizeof("Alpha")];
char uniname2ctype_pool_str71[sizeof("Cherokee")];
char uniname2ctype_pool_str72[sizeof("Limbu")];
char uniname2ctype_pool_str73[sizeof("Khmer")];
char uniname2ctype_pool_str74[sizeof("Hiragana")];
char uniname2ctype_pool_str75[sizeof("Han")];
char uniname2ctype_pool_str76[sizeof("Zp")];
char uniname2ctype_pool_str77[sizeof("Lower")];
char uniname2ctype_pool_str78[sizeof("Kharoshthi")];
char uniname2ctype_pool_str79[sizeof("Tifinagh")];
char uniname2ctype_pool_str80[sizeof("Nl")];
char uniname2ctype_pool_str81[sizeof("Cntrl")];
char uniname2ctype_pool_str82[sizeof("Hanunoo")];
char uniname2ctype_pool_str83[sizeof("Gothic")];
char uniname2ctype_pool_str84[sizeof("Ps")];
char uniname2ctype_pool_str85[sizeof("Cs")];
char uniname2ctype_pool_str86[sizeof("Nd")];
char uniname2ctype_pool_str87[sizeof("Graph")];
char uniname2ctype_pool_str88[sizeof("Lao")];
char uniname2ctype_pool_str89[sizeof("Ethiopic")];
char uniname2ctype_pool_str90[sizeof("Old_Persian")];
char uniname2ctype_pool_str91[sizeof("Canadian_Aboriginal")];
char uniname2ctype_pool_str92[sizeof("Ogham")];
char uniname2ctype_pool_str93[sizeof("ASCII")];
char uniname2ctype_pool_str94[sizeof("Alnum")];
char uniname2ctype_pool_str95[sizeof("Old_Italic")];
char uniname2ctype_pool_str96[sizeof("Zl")];
char uniname2ctype_pool_str97[sizeof("Digit")];
char uniname2ctype_pool_str98[sizeof("Ugaritic")];
char uniname2ctype_pool_str99[sizeof("Z")];
char uniname2ctype_pool_str100[sizeof("Any")];
char uniname2ctype_pool_str101[sizeof("Kannada")];
char uniname2ctype_pool_str102[sizeof("Buhid")];
char uniname2ctype_pool_str103[sizeof("Devanagari")];
char uniname2ctype_pool_str104[sizeof("Gujarati")];
char uniname2ctype_pool_str105[sizeof("Hebrew")];
char uniname2ctype_pool_str106[sizeof("Katakana")];
char uniname2ctype_pool_str107[sizeof("Upper")];
char uniname2ctype_pool_str108[sizeof("New_Tai_Lue")];
char uniname2ctype_pool_str109[sizeof("XDigit")];
char uniname2ctype_pool_str110[sizeof("NEWLINE")];
char uniname2ctype_pool_str111[sizeof("Word")];
char uniname2ctype_pool_str112[sizeof("Runic")];
char uniname2ctype_pool_str114[sizeof("Greek")];
char uniname2ctype_pool_str116[sizeof("Georgian")];
char uniname2ctype_pool_str121[sizeof("Hangul")];
char uniname2ctype_pool_str128[sizeof("Inherited")];
char uniname2ctype_pool_str132[sizeof("Zs")];
char uniname2ctype_pool_str136[sizeof("Deseret")];
char uniname2ctype_pool_str138[sizeof("Assigned")];
#endif /* USE_UNICODE_PROPERTIES */
};
static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
{
#ifndef USE_UNICODE_PROPERTIES
"Word",
"Alpha",
"Alnum",
"ASCII",
"Cntrl",
#else /* USE_UNICODE_PROPERTIES */
"P",
"C",
"Cn",
"S",
"Po",
"Co",
"So",
"Pc",
"Cc",
"Sc",
"Pi",
"Common",
"Mn",
"Lt",
"Syriac",
"Cyrillic",
"Shavian",
"Lo",
"Mc",
"Pe",
"Cypriot",
"M",
"Thai",
"Syloti_Nagri",
"L",
"Coptic",
"Bopomofo",
#endif /* USE_UNICODE_PROPERTIES */
"Punct",
#ifdef USE_UNICODE_PROPERTIES
"Sk",
"Me",
#endif /* USE_UNICODE_PROPERTIES */
"Print",
#ifndef USE_UNICODE_PROPERTIES
"XDigit",
"Upper",
#endif /* ! USE_UNICODE_PROPERTIES */
"Space",
#ifndef USE_UNICODE_PROPERTIES
"NEWLINE",
#else /* USE_UNICODE_PROPERTIES */
"Thaana",
"Sm",
"Braille",
"No",
"Myanmar",
"Tagbanwa",
"Buginese",
"Osmanya",
"Blank",
"Armenian",
"Bengali",
"Mongolian",
"Lm",
"Latin",
"Linear_B",
"Yi",
"Arabic",
"Pd",
"Sinhala",
"Malayalam",
"Tai_Le",
"Tamil",
"Telugu",
"Gurmukhi",
"Ll",
"Tagalog",
"Tibetan",
"Lu",
"Oriya",
"Glagolitic",
"N",
"Pf",
"Cf",
"Alpha",
"Cherokee",
"Limbu",
"Khmer",
"Hiragana",
"Han",
"Zp",
#endif /* USE_UNICODE_PROPERTIES */
"Lower",
#ifdef USE_UNICODE_PROPERTIES
"Kharoshthi",
"Tifinagh",
"Nl",
"Cntrl",
"Hanunoo",
"Gothic",
"Ps",
"Cs",
"Nd",
#endif /* USE_UNICODE_PROPERTIES */
"Graph",
#ifdef USE_UNICODE_PROPERTIES
"Lao",
"Ethiopic",
"Old_Persian",
"Canadian_Aboriginal",
"Ogham",
"ASCII",
"Alnum",
"Old_Italic",
"Zl",
#endif /* USE_UNICODE_PROPERTIES */
"Digit",
#ifndef USE_UNICODE_PROPERTIES
"Blank"
#else /* USE_UNICODE_PROPERTIES */
"Ugaritic",
"Z",
"Any",
"Kannada",
"Buhid",
"Devanagari",
"Gujarati",
"Hebrew",
"Katakana",
"Upper",
"New_Tai_Lue",
"XDigit",
"NEWLINE",
"Word",
"Runic",
"Greek",
"Georgian",
"Hangul",
"Inherited",
"Zs",
"Deseret",
"Assigned"
#endif /* USE_UNICODE_PROPERTIES */
};
#define uniname2ctype_pool ((const char *) &uniname2ctype_pool_contents)
#ifdef __GNUC__
__inline
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif
const struct uniname2ctype_struct *
uniname2ctype_p (str, len)
register const char *str;
register unsigned int len;
{
static const struct uniname2ctype_struct wordlist[] =
{
#ifdef USE_UNICODE_PROPERTIES
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 37},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 17},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str6, 20},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 45},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 43},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 21},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 49},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 38},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 18},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 46},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 42},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 63},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 32},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 27},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 103},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 66},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 100},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21, 26},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str22, 30},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str23, 40},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24, 65},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str25, 29},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str26, 110},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str28, 102},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 23},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 64},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31, 57},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 8},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str33, 47},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 31},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 7},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str36, 9},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str37, 109},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str38, 48},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str39, 58},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str40, 36},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str41, 92},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 105},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str43, 59},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 98},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str45, 2},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str46, 55},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str47, 56},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str48, 91},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 25},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str50, 87},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str51, 89},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52, 114},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str53, 54},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str54, 39},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str55, 101},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str56, 90},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str57, 106},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str58, 107},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str59, 108},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str60, 75},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str61, 24},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62, 104},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str63, 111},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 28},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str65, 97},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str66, 71},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str67, 33},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str68, 41},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 19},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str70, 1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str71, 62},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 88},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str73, 85},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 80},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str75, 76},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str76, 52},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str77, 6},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str78, 84},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str79, 112},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str80, 35},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str81, 3},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82, 78},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str83, 72},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 44},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str85, 22},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 34},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str87, 5},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str88, 86},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str89, 69},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 96},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str91, 61},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 94},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str93, 14},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str94, 13},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str95, 95},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str96, 51},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str97, 4},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str98, 113},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99, 50},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str100, 15},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str101, 82},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str102, 60},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str103, 68},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str104, 74},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str105, 79},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106, 83},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str107, 10},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str108, 93},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 11},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str110, 0},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str111, 12},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str112, 99},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 73},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 70},
{-1}, {-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str121, 77},
#endif /* USE_UNICODE_PROPERTIES */
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#ifndef USE_UNICODE_PROPERTIES
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str6, 12},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 13},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 14},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 3},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 8},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 7},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 11},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 10},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 9},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 0},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 6},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 5},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 4},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 2}
#else /* USE_UNICODE_PROPERTIES */
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str128, 81},
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str132, 53},
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str136, 67},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str138, 16}
#endif /* USE_UNICODE_PROPERTIES */
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = uniname2ctype_hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register int o = wordlist[key].name;
if (o >= 0)
{
register const char *s = o + uniname2ctype_pool;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[key];
}
}
}
return 0;
}
static int
uniname2ctype(const UChar *name, unsigned int len)
{
const struct uniname2ctype_struct *p = uniname2ctype_p((const char *)name, len);
if (p) return p->ctype;
return -1;
}

View File

@ -0,0 +1,588 @@
/* C code produced by gperf version 3.0.4 */
/* Command-line: gperf -7 -c -j1 -i1 -t -C -P -T -H uniname2ctype_hash -Q uniname2ctype_pool -N uniname2ctype_p */
#ifndef USE_UNICODE_PROPERTIES
/* Computed positions: -k'1,3' */
#else /* USE_UNICODE_PROPERTIES */
/* Computed positions: -k'1,3,$' */
#endif /* USE_UNICODE_PROPERTIES */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
struct uniname2ctype_struct {
int name, ctype;
};
static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int);
#ifndef USE_UNICODE_PROPERTIES
#define TOTAL_KEYWORDS 15
#define MIN_WORD_LENGTH 4
#define MAX_WORD_LENGTH 7
#define MIN_HASH_VALUE 6
#define MAX_HASH_VALUE 20
/* maximum key range = 15, duplicates = 0 */
#else /* USE_UNICODE_PROPERTIES */
#define TOTAL_KEYWORDS 115
#define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 19
#define MIN_HASH_VALUE 3
#define MAX_HASH_VALUE 138
/* maximum key range = 136, duplicates = 0 */
#endif /* USE_UNICODE_PROPERTIES */
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
uniname2ctype_hash (str, len)
register const char *str;
register unsigned int len;
{
static const unsigned char asso_values[] =
{
#ifndef USE_UNICODE_PROPERTIES
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 1, 10, 3, 7, 21,
21, 8, 21, 21, 21, 21, 6, 21, 8, 21,
4, 21, 21, 5, 21, 8, 21, 1, 4, 21,
21, 21, 21, 21, 21, 21, 21, 5, 21, 21,
21, 21, 21, 7, 21, 3, 21, 21, 21, 21,
2, 21, 1, 21, 1, 21, 2, 21, 21, 6,
21, 21, 21, 21, 21, 21, 21, 21
#else /* USE_UNICODE_PROPERTIES */
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 31, 4, 2, 80, 31,
139, 40, 45, 26, 139, 49, 14, 12, 33, 12,
1, 139, 74, 3, 3, 74, 139, 55, 74, 39,
49, 139, 139, 139, 139, 139, 139, 20, 139, 8,
51, 20, 65, 41, 34, 11, 42, 28, 45, 33,
2, 5, 25, 66, 14, 81, 1, 48, 29, 3,
2, 44, 139, 22, 139, 139, 139, 139, 139, 139
#endif /* USE_UNICODE_PROPERTIES */
};
#ifndef USE_UNICODE_PROPERTIES
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
#else /* USE_UNICODE_PROPERTIES */
register int hval = len;
switch (hval)
{
default:
hval += asso_values[(unsigned char)str[2]+2];
/*FALLTHROUGH*/
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
#endif /* USE_UNICODE_PROPERTIES */
}
struct uniname2ctype_pool_t
{
#ifndef USE_UNICODE_PROPERTIES
char uniname2ctype_pool_str6[sizeof("Word")];
char uniname2ctype_pool_str7[sizeof("Alpha")];
char uniname2ctype_pool_str8[sizeof("Alnum")];
char uniname2ctype_pool_str9[sizeof("ASCII")];
char uniname2ctype_pool_str10[sizeof("Cntrl")];
char uniname2ctype_pool_str11[sizeof("Punct")];
char uniname2ctype_pool_str12[sizeof("Print")];
char uniname2ctype_pool_str13[sizeof("XDigit")];
char uniname2ctype_pool_str14[sizeof("Upper")];
char uniname2ctype_pool_str15[sizeof("Space")];
char uniname2ctype_pool_str16[sizeof("NEWLINE")];
char uniname2ctype_pool_str17[sizeof("Lower")];
char uniname2ctype_pool_str18[sizeof("Graph")];
char uniname2ctype_pool_str19[sizeof("Digit")];
char uniname2ctype_pool_str20[sizeof("Blank")];
#else /* USE_UNICODE_PROPERTIES */
char uniname2ctype_pool_str3[sizeof("P")];
char uniname2ctype_pool_str5[sizeof("C")];
char uniname2ctype_pool_str6[sizeof("Cn")];
char uniname2ctype_pool_str7[sizeof("S")];
char uniname2ctype_pool_str8[sizeof("Po")];
char uniname2ctype_pool_str9[sizeof("Co")];
char uniname2ctype_pool_str10[sizeof("So")];
char uniname2ctype_pool_str11[sizeof("Pc")];
char uniname2ctype_pool_str12[sizeof("Cc")];
char uniname2ctype_pool_str13[sizeof("Sc")];
char uniname2ctype_pool_str14[sizeof("Pi")];
char uniname2ctype_pool_str15[sizeof("Common")];
char uniname2ctype_pool_str16[sizeof("Mn")];
char uniname2ctype_pool_str17[sizeof("Lt")];
char uniname2ctype_pool_str18[sizeof("Syriac")];
char uniname2ctype_pool_str19[sizeof("Cyrillic")];
char uniname2ctype_pool_str20[sizeof("Shavian")];
char uniname2ctype_pool_str21[sizeof("Lo")];
char uniname2ctype_pool_str22[sizeof("Mc")];
char uniname2ctype_pool_str23[sizeof("Pe")];
char uniname2ctype_pool_str24[sizeof("Cypriot")];
char uniname2ctype_pool_str25[sizeof("M")];
char uniname2ctype_pool_str26[sizeof("Thai")];
char uniname2ctype_pool_str28[sizeof("Syloti_Nagri")];
char uniname2ctype_pool_str29[sizeof("L")];
char uniname2ctype_pool_str30[sizeof("Coptic")];
char uniname2ctype_pool_str31[sizeof("Bopomofo")];
char uniname2ctype_pool_str32[sizeof("Punct")];
char uniname2ctype_pool_str33[sizeof("Sk")];
char uniname2ctype_pool_str34[sizeof("Me")];
char uniname2ctype_pool_str35[sizeof("Print")];
char uniname2ctype_pool_str36[sizeof("Space")];
char uniname2ctype_pool_str37[sizeof("Thaana")];
char uniname2ctype_pool_str38[sizeof("Sm")];
char uniname2ctype_pool_str39[sizeof("Braille")];
char uniname2ctype_pool_str40[sizeof("No")];
char uniname2ctype_pool_str41[sizeof("Myanmar")];
char uniname2ctype_pool_str42[sizeof("Tagbanwa")];
char uniname2ctype_pool_str43[sizeof("Buginese")];
char uniname2ctype_pool_str44[sizeof("Osmanya")];
char uniname2ctype_pool_str45[sizeof("Blank")];
char uniname2ctype_pool_str46[sizeof("Armenian")];
char uniname2ctype_pool_str47[sizeof("Bengali")];
char uniname2ctype_pool_str48[sizeof("Mongolian")];
char uniname2ctype_pool_str49[sizeof("Lm")];
char uniname2ctype_pool_str50[sizeof("Latin")];
char uniname2ctype_pool_str51[sizeof("Linear_B")];
char uniname2ctype_pool_str52[sizeof("Yi")];
char uniname2ctype_pool_str53[sizeof("Arabic")];
char uniname2ctype_pool_str54[sizeof("Pd")];
char uniname2ctype_pool_str55[sizeof("Sinhala")];
char uniname2ctype_pool_str56[sizeof("Malayalam")];
char uniname2ctype_pool_str57[sizeof("Tai_Le")];
char uniname2ctype_pool_str58[sizeof("Tamil")];
char uniname2ctype_pool_str59[sizeof("Telugu")];
char uniname2ctype_pool_str60[sizeof("Gurmukhi")];
char uniname2ctype_pool_str61[sizeof("Ll")];
char uniname2ctype_pool_str62[sizeof("Tagalog")];
char uniname2ctype_pool_str63[sizeof("Tibetan")];
char uniname2ctype_pool_str64[sizeof("Lu")];
char uniname2ctype_pool_str65[sizeof("Oriya")];
char uniname2ctype_pool_str66[sizeof("Glagolitic")];
char uniname2ctype_pool_str67[sizeof("N")];
char uniname2ctype_pool_str68[sizeof("Pf")];
char uniname2ctype_pool_str69[sizeof("Cf")];
char uniname2ctype_pool_str70[sizeof("Alpha")];
char uniname2ctype_pool_str71[sizeof("Cherokee")];
char uniname2ctype_pool_str72[sizeof("Limbu")];
char uniname2ctype_pool_str73[sizeof("Khmer")];
char uniname2ctype_pool_str74[sizeof("Hiragana")];
char uniname2ctype_pool_str75[sizeof("Han")];
char uniname2ctype_pool_str76[sizeof("Zp")];
char uniname2ctype_pool_str77[sizeof("Lower")];
char uniname2ctype_pool_str78[sizeof("Kharoshthi")];
char uniname2ctype_pool_str79[sizeof("Tifinagh")];
char uniname2ctype_pool_str80[sizeof("Nl")];
char uniname2ctype_pool_str81[sizeof("Cntrl")];
char uniname2ctype_pool_str82[sizeof("Hanunoo")];
char uniname2ctype_pool_str83[sizeof("Gothic")];
char uniname2ctype_pool_str84[sizeof("Ps")];
char uniname2ctype_pool_str85[sizeof("Cs")];
char uniname2ctype_pool_str86[sizeof("Nd")];
char uniname2ctype_pool_str87[sizeof("Graph")];
char uniname2ctype_pool_str88[sizeof("Lao")];
char uniname2ctype_pool_str89[sizeof("Ethiopic")];
char uniname2ctype_pool_str90[sizeof("Old_Persian")];
char uniname2ctype_pool_str91[sizeof("Canadian_Aboriginal")];
char uniname2ctype_pool_str92[sizeof("Ogham")];
char uniname2ctype_pool_str93[sizeof("ASCII")];
char uniname2ctype_pool_str94[sizeof("Alnum")];
char uniname2ctype_pool_str95[sizeof("Old_Italic")];
char uniname2ctype_pool_str96[sizeof("Zl")];
char uniname2ctype_pool_str97[sizeof("Digit")];
char uniname2ctype_pool_str98[sizeof("Ugaritic")];
char uniname2ctype_pool_str99[sizeof("Z")];
char uniname2ctype_pool_str100[sizeof("Any")];
char uniname2ctype_pool_str101[sizeof("Kannada")];
char uniname2ctype_pool_str102[sizeof("Buhid")];
char uniname2ctype_pool_str103[sizeof("Devanagari")];
char uniname2ctype_pool_str104[sizeof("Gujarati")];
char uniname2ctype_pool_str105[sizeof("Hebrew")];
char uniname2ctype_pool_str106[sizeof("Katakana")];
char uniname2ctype_pool_str107[sizeof("Upper")];
char uniname2ctype_pool_str108[sizeof("New_Tai_Lue")];
char uniname2ctype_pool_str109[sizeof("XDigit")];
char uniname2ctype_pool_str110[sizeof("NEWLINE")];
char uniname2ctype_pool_str111[sizeof("Word")];
char uniname2ctype_pool_str112[sizeof("Runic")];
char uniname2ctype_pool_str114[sizeof("Greek")];
char uniname2ctype_pool_str116[sizeof("Georgian")];
char uniname2ctype_pool_str121[sizeof("Hangul")];
char uniname2ctype_pool_str128[sizeof("Inherited")];
char uniname2ctype_pool_str132[sizeof("Zs")];
char uniname2ctype_pool_str136[sizeof("Deseret")];
char uniname2ctype_pool_str138[sizeof("Assigned")];
#endif /* USE_UNICODE_PROPERTIES */
};
static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
{
#ifndef USE_UNICODE_PROPERTIES
"Word",
"Alpha",
"Alnum",
"ASCII",
"Cntrl",
#else /* USE_UNICODE_PROPERTIES */
"P",
"C",
"Cn",
"S",
"Po",
"Co",
"So",
"Pc",
"Cc",
"Sc",
"Pi",
"Common",
"Mn",
"Lt",
"Syriac",
"Cyrillic",
"Shavian",
"Lo",
"Mc",
"Pe",
"Cypriot",
"M",
"Thai",
"Syloti_Nagri",
"L",
"Coptic",
"Bopomofo",
#endif /* USE_UNICODE_PROPERTIES */
"Punct",
#ifdef USE_UNICODE_PROPERTIES
"Sk",
"Me",
#endif /* USE_UNICODE_PROPERTIES */
"Print",
#ifndef USE_UNICODE_PROPERTIES
"XDigit",
"Upper",
#endif /* ! USE_UNICODE_PROPERTIES */
"Space",
#ifndef USE_UNICODE_PROPERTIES
"NEWLINE",
#else /* USE_UNICODE_PROPERTIES */
"Thaana",
"Sm",
"Braille",
"No",
"Myanmar",
"Tagbanwa",
"Buginese",
"Osmanya",
"Blank",
"Armenian",
"Bengali",
"Mongolian",
"Lm",
"Latin",
"Linear_B",
"Yi",
"Arabic",
"Pd",
"Sinhala",
"Malayalam",
"Tai_Le",
"Tamil",
"Telugu",
"Gurmukhi",
"Ll",
"Tagalog",
"Tibetan",
"Lu",
"Oriya",
"Glagolitic",
"N",
"Pf",
"Cf",
"Alpha",
"Cherokee",
"Limbu",
"Khmer",
"Hiragana",
"Han",
"Zp",
#endif /* USE_UNICODE_PROPERTIES */
"Lower",
#ifdef USE_UNICODE_PROPERTIES
"Kharoshthi",
"Tifinagh",
"Nl",
"Cntrl",
"Hanunoo",
"Gothic",
"Ps",
"Cs",
"Nd",
#endif /* USE_UNICODE_PROPERTIES */
"Graph",
#ifdef USE_UNICODE_PROPERTIES
"Lao",
"Ethiopic",
"Old_Persian",
"Canadian_Aboriginal",
"Ogham",
"ASCII",
"Alnum",
"Old_Italic",
"Zl",
#endif /* USE_UNICODE_PROPERTIES */
"Digit",
#ifndef USE_UNICODE_PROPERTIES
"Blank"
#else /* USE_UNICODE_PROPERTIES */
"Ugaritic",
"Z",
"Any",
"Kannada",
"Buhid",
"Devanagari",
"Gujarati",
"Hebrew",
"Katakana",
"Upper",
"New_Tai_Lue",
"XDigit",
"NEWLINE",
"Word",
"Runic",
"Greek",
"Georgian",
"Hangul",
"Inherited",
"Zs",
"Deseret",
"Assigned"
#endif /* USE_UNICODE_PROPERTIES */
};
#define uniname2ctype_pool ((const char *) &uniname2ctype_pool_contents)
#ifdef __GNUC__
__inline
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif
const struct uniname2ctype_struct *
uniname2ctype_p (str, len)
register const char *str;
register unsigned int len;
{
static const struct uniname2ctype_struct wordlist[] =
{
#ifdef USE_UNICODE_PROPERTIES
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 37},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str5, 17},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str6, 20},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 45},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 43},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 21},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 49},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 38},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 18},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 46},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 42},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 63},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 32},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 27},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 103},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 66},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 100},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str21, 26},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str22, 30},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str23, 40},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24, 65},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str25, 29},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str26, 110},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str28, 102},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29, 23},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30, 64},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31, 57},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 8},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str33, 47},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 31},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 7},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str36, 9},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str37, 109},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str38, 48},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str39, 58},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str40, 36},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str41, 92},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 105},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str43, 59},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 98},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str45, 2},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str46, 55},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str47, 56},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str48, 91},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 25},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str50, 87},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str51, 89},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52, 114},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str53, 54},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str54, 39},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str55, 101},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str56, 90},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str57, 106},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str58, 107},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str59, 108},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str60, 75},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str61, 24},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62, 104},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str63, 111},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 28},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str65, 97},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str66, 71},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str67, 33},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str68, 41},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 19},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str70, 1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str71, 62},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 88},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str73, 85},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str74, 80},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str75, 76},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str76, 52},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str77, 6},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str78, 84},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str79, 112},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str80, 35},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str81, 3},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82, 78},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str83, 72},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 44},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str85, 22},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 34},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str87, 5},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str88, 86},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str89, 69},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 96},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str91, 61},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str92, 94},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str93, 14},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str94, 13},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str95, 95},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str96, 51},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str97, 4},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str98, 113},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99, 50},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str100, 15},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str101, 82},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str102, 60},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str103, 68},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str104, 74},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str105, 79},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106, 83},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str107, 10},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str108, 93},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str109, 11},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str110, 0},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str111, 12},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str112, 99},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114, 73},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 70},
{-1}, {-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str121, 77},
#endif /* USE_UNICODE_PROPERTIES */
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#ifndef USE_UNICODE_PROPERTIES
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str6, 12},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str7, 1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str8, 13},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str9, 14},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str10, 3},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11, 8},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str12, 7},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 11},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str14, 10},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15, 9},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str16, 0},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str17, 6},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str18, 5},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str19, 4},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 2}
#else /* USE_UNICODE_PROPERTIES */
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str128, 81},
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str132, 53},
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str136, 67},
{-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str138, 16}
#endif /* USE_UNICODE_PROPERTIES */
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = uniname2ctype_hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register int o = wordlist[key].name;
if (o >= 0)
{
register const char *s = o + uniname2ctype_pool;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[key];
}
}
}
return 0;
}
static int
uniname2ctype(const UChar *name, unsigned int len)
{
const struct uniname2ctype_struct *p = uniname2ctype_p((const char *)name, len);
if (p) return p->ctype;
return -1;
}

134
enc/unicode/name2ctype.kwd Normal file
View File

@ -0,0 +1,134 @@
%{
struct uniname2ctype_struct {
int name, ctype;
};
static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int);
%}
struct uniname2ctype_struct;
%%
NEWLINE, 0
Alpha, 1
Blank, 2
Cntrl, 3
Digit, 4
Graph, 5
Lower, 6
Print, 7
Punct, 8
Space, 9
Upper, 10
XDigit, 11
Word, 12
Alnum, 13
ASCII, 14
#ifdef USE_UNICODE_PROPERTIES
Any, 15
Assigned, 16
C, 17
Cc, 18
Cf, 19
Cn, 20
Co, 21
Cs, 22
L, 23
Ll, 24
Lm, 25
Lo, 26
Lt, 27
Lu, 28
M, 29
Mc, 30
Me, 31
Mn, 32
N, 33
Nd, 34
Nl, 35
No, 36
P, 37
Pc, 38
Pd, 39
Pe, 40
Pf, 41
Pi, 42
Po, 43
Ps, 44
S, 45
Sc, 46
Sk, 47
Sm, 48
So, 49
Z, 50
Zl, 51
Zp, 52
Zs, 53
Arabic, 54
Armenian, 55
Bengali, 56
Bopomofo, 57
Braille, 58
Buginese, 59
Buhid, 60
Canadian_Aboriginal, 61
Cherokee, 62
Common, 63
Coptic, 64
Cypriot, 65
Cyrillic, 66
Deseret, 67
Devanagari, 68
Ethiopic, 69
Georgian, 70
Glagolitic, 71
Gothic, 72
Greek, 73
Gujarati, 74
Gurmukhi, 75
Han, 76
Hangul, 77
Hanunoo, 78
Hebrew, 79
Hiragana, 80
Inherited, 81
Kannada, 82
Katakana, 83
Kharoshthi, 84
Khmer, 85
Lao, 86
Latin, 87
Limbu, 88
Linear_B, 89
Malayalam, 90
Mongolian, 91
Myanmar, 92
New_Tai_Lue, 93
Ogham, 94
Old_Italic, 95
Old_Persian, 96
Oriya, 97
Osmanya, 98
Runic, 99
Shavian, 100
Sinhala, 101
Syloti_Nagri, 102
Syriac, 103
Tagalog, 104
Tagbanwa, 105
Tai_Le, 106
Tamil, 107
Telugu, 108
Thaana, 109
Thai, 110
Tibetan, 111
Tifinagh, 112
Ugaritic, 113
Yi, 114
#endif /* USE_UNICODE_PROPERTIES */
%%
static int
uniname2ctype(const UChar *name, unsigned int len)
{
const struct uniname2ctype_struct *p = uniname2ctype_p((const char *)name, len);
if (p) return p->ctype;
return -1;
}

134
enc/unicode/name2ctype.src Normal file
View File

@ -0,0 +1,134 @@
%{
struct uniname2ctype_struct {
int name, ctype;
};
static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int);
%}
struct uniname2ctype_struct;
%%
NEWLINE, 0
Alpha, 1
Blank, 2
Cntrl, 3
Digit, 4
Graph, 5
Lower, 6
Print, 7
Punct, 8
Space, 9
Upper, 10
XDigit, 11
Word, 12
Alnum, 13
ASCII, 14
#ifdef USE_UNICODE_PROPERTIES
Any, 15
Assigned, 16
C, 17
Cc, 18
Cf, 19
Cn, 20
Co, 21
Cs, 22
L, 23
Ll, 24
Lm, 25
Lo, 26
Lt, 27
Lu, 28
M, 29
Mc, 30
Me, 31
Mn, 32
N, 33
Nd, 34
Nl, 35
No, 36
P, 37
Pc, 38
Pd, 39
Pe, 40
Pf, 41
Pi, 42
Po, 43
Ps, 44
S, 45
Sc, 46
Sk, 47
Sm, 48
So, 49
Z, 50
Zl, 51
Zp, 52
Zs, 53
Arabic, 54
Armenian, 55
Bengali, 56
Bopomofo, 57
Braille, 58
Buginese, 59
Buhid, 60
Canadian_Aboriginal, 61
Cherokee, 62
Common, 63
Coptic, 64
Cypriot, 65
Cyrillic, 66
Deseret, 67
Devanagari, 68
Ethiopic, 69
Georgian, 70
Glagolitic, 71
Gothic, 72
Greek, 73
Gujarati, 74
Gurmukhi, 75
Han, 76
Hangul, 77
Hanunoo, 78
Hebrew, 79
Hiragana, 80
Inherited, 81
Kannada, 82
Katakana, 83
Kharoshthi, 84
Khmer, 85
Lao, 86
Latin, 87
Limbu, 88
Linear_B, 89
Malayalam, 90
Mongolian, 91
Myanmar, 92
New_Tai_Lue, 93
Ogham, 94
Old_Italic, 95
Old_Persian, 96
Oriya, 97
Osmanya, 98
Runic, 99
Shavian, 100
Sinhala, 101
Syloti_Nagri, 102
Syriac, 103
Tagalog, 104
Tagbanwa, 105
Tai_Le, 106
Tamil, 107
Telugu, 108
Thaana, 109
Thai, 110
Tibetan, 111
Tifinagh, 112
Ugaritic, 113
Yi, 114
#endif /* USE_UNICODE_PROPERTIES */
%%
static int
uniname2ctype(const UChar *name, unsigned int len)
{
const struct uniname2ctype_struct *p = uniname2ctype_p((const char *)name, len);
if (p) return p->ctype;
return -1;
}

View File

@ -853,6 +853,10 @@ end
lex.c: {$(srcdir)}lex.c.blt
copy $(?:/=\) $@
enc/unicode/name2ctype.h: {$(srcdir)}enc/unicode/name2ctype.h.blt
$(MAKEDIRS) $(@D:/=\)
copy $(?:/=\) $(@:/=\)
$(OBJS): {$(hdrdir)/ruby}win32.h
dir.$(OBJEXT) win32.$(OBJEXT): {$(srcdir)}win32/dir.h