| 8 |
# offsets in the table. This is tedious to maintain by hand. Therefore, this |
# offsets in the table. This is tedious to maintain by hand. Therefore, this |
| 9 |
# script is used to generate the table. The output is sent to stdout. |
# script is used to generate the table. The output is sent to stdout. |
| 10 |
|
|
| 11 |
|
# 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. |
| 13 |
|
|
| 14 |
script_names = ['Arabic', 'Armenian', 'Bengali', 'Bopomofo', 'Braille', 'Buginese', 'Buhid', 'Canadian_Aboriginal', \ |
script_names = ['Arabic', 'Armenian', 'Bengali', 'Bopomofo', 'Braille', 'Buginese', 'Buhid', 'Canadian_Aboriginal', \ |
| 15 |
'Cherokee', 'Common', 'Coptic', 'Cypriot', 'Cyrillic', 'Deseret', 'Devanagari', 'Ethiopic', 'Georgian', \ |
'Cherokee', 'Common', 'Coptic', 'Cypriot', 'Cyrillic', 'Deseret', 'Devanagari', 'Ethiopic', 'Georgian', \ |
| 16 |
'Glagolitic', 'Gothic', 'Greek', 'Gujarati', 'Gurmukhi', 'Han', 'Hangul', 'Hanunoo', 'Hebrew', 'Hiragana', \ |
'Glagolitic', 'Gothic', 'Greek', 'Gujarati', 'Gurmukhi', 'Han', 'Hangul', 'Hanunoo', 'Hebrew', 'Hiragana', \ |
| 38 |
|
|
| 39 |
utt_table.sort() |
utt_table.sort() |
| 40 |
|
|
| 41 |
|
# We have to use STR_ macros to define the strings so that it all works in |
| 42 |
|
# UTF-8 mode on EBCDIC platforms. |
| 43 |
|
|
| 44 |
|
for utt in utt_table: |
| 45 |
|
print '#define STRING_%s0' % (utt[0].replace('&', '_AMPERSAND')), |
| 46 |
|
for c in utt[0]: |
| 47 |
|
if c == '_': |
| 48 |
|
print 'STR_UNDERSCORE', |
| 49 |
|
elif c == '&': |
| 50 |
|
print 'STR_AMPERSAND', |
| 51 |
|
else: |
| 52 |
|
print 'STR_%s' % c,; |
| 53 |
|
print '"\\0"' |
| 54 |
|
|
| 55 |
|
# Print the actual table, using the string names |
| 56 |
|
|
| 57 |
|
print '' |
| 58 |
print 'const char _pcre_utt_names[] = '; |
print 'const char _pcre_utt_names[] = '; |
| 59 |
last = '' |
last = '' |
| 60 |
for utt in utt_table: |
for utt in utt_table: |
| 61 |
if utt == utt_table[-1]: |
if utt == utt_table[-1]: |
| 62 |
last = ';' |
last = ';' |
| 63 |
print ' "%s\\0"%s' % (utt[0], last) |
print ' STRING_%s0%s' % (utt[0].replace('&', '_AMPERSAND'), last) |
| 64 |
|
# This was how it was done before the EBCDIC-compatible modification. |
| 65 |
|
# print ' "%s\\0"%s' % (utt[0], last) |
| 66 |
|
|
| 67 |
print '\nconst ucp_type_table _pcre_utt[] = { ' |
print '\nconst ucp_type_table _pcre_utt[] = { ' |
| 68 |
offset = 0 |
offset = 0 |