11 |
# Modified by PH 17-March-2009 to generate the more verbose form that works |
# Modified by PH 17-March-2009 to generate the more verbose form that works |
12 |
# for UTF-support in EBCDIC as well as ASCII environments. |
# for UTF-support in EBCDIC as well as ASCII environments. |
13 |
# Modified by PH 01-March-2010 to add new scripts from Unicode 5.2.0. |
# Modified by PH 01-March-2010 to add new scripts from Unicode 5.2.0. |
14 |
|
# Modified by PH 04-May-2010 to add new "X.." special categories. |
15 |
|
|
16 |
script_names = ['Arabic', 'Armenian', 'Bengali', 'Bopomofo', 'Braille', 'Buginese', 'Buhid', 'Canadian_Aboriginal', \ |
script_names = ['Arabic', 'Armenian', 'Bengali', 'Bopomofo', 'Braille', 'Buginese', 'Buhid', 'Canadian_Aboriginal', \ |
17 |
'Cherokee', 'Common', 'Coptic', 'Cypriot', 'Cyrillic', 'Deseret', 'Devanagari', 'Ethiopic', 'Georgian', \ |
'Cherokee', 'Common', 'Coptic', 'Cypriot', 'Cyrillic', 'Deseret', 'Devanagari', 'Ethiopic', 'Georgian', \ |
37 |
|
|
38 |
general_category_names = ['C', 'L', 'M', 'N', 'P', 'S', 'Z'] |
general_category_names = ['C', 'L', 'M', 'N', 'P', 'S', 'Z'] |
39 |
|
|
40 |
|
# First add the Unicode script and category names. |
41 |
|
|
42 |
utt_table = zip(script_names, ['PT_SC'] * len(script_names)) |
utt_table = zip(script_names, ['PT_SC'] * len(script_names)) |
43 |
utt_table += zip(category_names, ['PT_PC'] * len(category_names)) |
utt_table += zip(category_names, ['PT_PC'] * len(category_names)) |
44 |
utt_table += zip(general_category_names, ['PT_GC'] * len(general_category_names)) |
utt_table += zip(general_category_names, ['PT_GC'] * len(general_category_names)) |
45 |
utt_table.append(('L&', 'PT_LAMP')) |
|
46 |
|
# Now add our own specials. |
47 |
|
|
48 |
utt_table.append(('Any', 'PT_ANY')) |
utt_table.append(('Any', 'PT_ANY')) |
49 |
|
utt_table.append(('L&', 'PT_LAMP')) |
50 |
|
utt_table.append(('Xan', 'PT_ALNUM')) |
51 |
|
utt_table.append(('Xps', 'PT_PXSPACE')) |
52 |
|
utt_table.append(('Xsp', 'PT_SPACE')) |
53 |
|
utt_table.append(('Xwd', 'PT_WORD')) |
54 |
|
|
55 |
|
# Sort the table. |
56 |
|
|
57 |
utt_table.sort() |
utt_table.sort() |
58 |
|
|
86 |
offset = 0 |
offset = 0 |
87 |
last = ',' |
last = ',' |
88 |
for utt in utt_table: |
for utt in utt_table: |
89 |
if utt[1] in ('PT_ANY', 'PT_LAMP'): |
if utt[1] in ('PT_ANY', 'PT_LAMP', 'PT_ALNUM', 'PT_PXSPACE', |
90 |
|
'PT_SPACE', 'PT_WORD'): |
91 |
value = '0' |
value = '0' |
92 |
else: |
else: |
93 |
value = 'ucp_' + utt[0] |
value = 'ucp_' + utt[0] |