123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- import os
- import sys
- import ucd
-
- ucd_rootdir = sys.argv[1]
- csur_rootdir = 'data/csur'
-
- unicode_chars = {}
- for data in ucd.parse_ucd_data(ucd_rootdir, 'UnicodeData'):
- for codepoint in data['CodePoint']:
- unicode_chars[codepoint] = data
- unicode_chars[codepoint]['Properties'] = []
- for data in ucd.parse_ucd_data(ucd_rootdir, 'PropList'):
- if data['Property'] in ['White_Space']:
- for codepoint in data['Range']:
- unicode_chars[codepoint]['Properties'].append(data['Property'])
- for data in ucd.parse_ucd_data(ucd_rootdir, 'Scripts'):
- for codepoint in data['Range']:
- unicode_chars[codepoint]['Script'] = data['Script']
- if '--with-csur' in sys.argv:
- for csur in ['Klingon']:
- for data in ucd.parse_ucd_data('data/csur', csur):
- for codepoint in data['CodePoint']:
- unicode_chars[codepoint] = data
-
- null = ucd.CodePoint('0000')
- if __name__ == '__main__':
- for codepoint in ucd.CodeRange('000000..10FFFF'):
- try:
- data = unicode_chars[codepoint]
- except KeyError:
- data = {}
- script = data.get('Script', 'Zzzz')
- title = data.get('TitleCase', codepoint)
- upper = data.get('UpperCase', codepoint)
- lower = data.get('LowerCase', codepoint)
- if title == null: title = codepoint
- if upper == null: upper = codepoint
- if lower == null: lower = codepoint
- print('%s %s %s %s %s %s %s %s' % (
- codepoint, script,
- data.get('GeneralCategory', 'Cn')[0], data.get('GeneralCategory', 'Cn'),
- upper, lower, title,
- ' '.join(data.get('Properties', []))))
|