1cb93a386Sopenharmony_ci#! /usr/bin/env python 2cb93a386Sopenharmony_ci 3cb93a386Sopenharmony_ci# Copyright 2016 Google Inc. 4cb93a386Sopenharmony_ci# 5cb93a386Sopenharmony_ci# Use of this source code is governed by a BSD-style license that can be 6cb93a386Sopenharmony_ci# found in the LICENSE file. 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ciimport array, zlib, base64, sys 9cb93a386Sopenharmony_ci 10cb93a386Sopenharmony_ci# import array, zlib, base64, sys, unicodedata 11cb93a386Sopenharmony_ci# def codepoints(): 12cb93a386Sopenharmony_ci# for i in range(0x110000): 13cb93a386Sopenharmony_ci# try: 14cb93a386Sopenharmony_ci# u = ('\\U%08x' % i).decode('unicode-escape') 15cb93a386Sopenharmony_ci# n = unicodedata.name(u) 16cb93a386Sopenharmony_ci# c = unicodedata.category(u) 17cb93a386Sopenharmony_ci# if c[0] == 'C' or n.startswith('VARIATION '): 18cb93a386Sopenharmony_ci# continue 19cb93a386Sopenharmony_ci# yield i 20cb93a386Sopenharmony_ci# except ValueError: 21cb93a386Sopenharmony_ci# pass 22cb93a386Sopenharmony_ci# def make_unicode_data(): 23cb93a386Sopenharmony_ci# last = 0 24cb93a386Sopenharmony_ci# a = array.array('I') 25cb93a386Sopenharmony_ci# for i in codepoints(): 26cb93a386Sopenharmony_ci# a.append(i - last - 1) 27cb93a386Sopenharmony_ci# last = i 28cb93a386Sopenharmony_ci# return base64.b64encode(zlib.compress(a.tostring(), 9)) 29cb93a386Sopenharmony_ci# if __name__ == '__main__': 30cb93a386Sopenharmony_ci# b = make_unicode_data() 31cb93a386Sopenharmony_ci# for i in range(0, len(b), 76): 32cb93a386Sopenharmony_ci# print ' %s' % b[i:i+76] 33cb93a386Sopenharmony_civalid_codepoint_data = ''' 34cb93a386Sopenharmony_ci eNrt3LmOHEUYAOCt7p5jL89iAbZJwJY4ExKTIiJChAh4CgSvgIgREjEJEa+ARAQxEW/gR4GRbDGa 35cb93a386Sopenharmony_ci 7Z4+pq+q/j5p5fVMd3XVX3fPTr99wVSedjgnCBsAANyTlby2qllX9722tlYH4DqieTKG+etV3tYJ 36cb93a386Sopenharmony_ci t5ntiNcqWxu9NnCbW+r6yLpQnaewn1rS3pFpPVhQWVcL7Dd/GVt6m1PGHL/WDfMXGsZlqLyHmvfy 37cb93a386Sopenharmony_ci DjGsyvN+3V6cuG42wrhRVd5i4jiX/ZtVnFeW1309bUrS3fS4Pw8tyxlmEMsu7auqDPvzd2ekuYuo 38cb93a386Sopenharmony_ci 358Tw7K8b4/abh/9/66mLPmJ8uYHr4ej1/KKNJooWuYjezlXDLGOW7dob2P02zZph5o4ti3D5uj1 39cb93a386Sopenharmony_ci dce2t23Y9lOId9byvKqYbyrafZt87SKN60WDsaltOS5L2mE2YH76vi+ZXwyr6Tolq8ljceLcums8 40cb93a386Sopenharmony_ci PPj9ZiF7uGKCa75bUp/hYF5tu+Y5rN9z2n2o6Zuhh33qq+OeXTDkWB1zPykii00Y6dz3dQu45yrC 41cb93a386Sopenharmony_ci POeqDaDx2qju79u63q+JpYxLiHvQrhetmOi6Y63H1qq4d9dCAABAIvuFlO162DuPtQ+47Dm9mzPL 42cb93a386Sopenharmony_ci Hs5IZ86yRPK37vm4tn2hr2tQbxtRXleqq9QUnyH38XfadcfHsk7JRp7PhzDWvev1gG3MOiIdYeZx 43cb93a386Sopenharmony_ci H3qN9JUmMMvxa6n78LZ5/Tzx9pYvpN7rfDmjvNwaBmGW3hQCYIL9W5ZYfsPRz9zyH7MwwbnZAHk5 44cb93a386Sopenharmony_ci dY3Qc1nGui+fwv3/uwn6TlldjnF/+tEM4r27gHo+ZwYASHM/UOVJi2PfUJUAAFEIPadVjJzfqZ+9 45cb93a386Sopenharmony_ci EmZWl1XPmD8ltc8s85nWeWh5rO+kAgAApKvpnu+3iMsY5J2F20SY56tE62L/LLC7gdPvMp6k8B7N 46cb93a386Sopenharmony_ci fWEOS8aNEEDv3mp5fLHweBnrh+F5ZPMVw3difbZvPCwzt2fP3qhrQN8DAAAAAAAAAAAAAAAAAAAA 47cb93a386Sopenharmony_ci AAAAAAAAAAAAAKCDKyEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 48cb93a386Sopenharmony_ci AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACIwnMhAAAAAOBInnDZLlUvwChe 49cb93a386Sopenharmony_ci n/j6WU/pbEfO91bTEV9m5dsEylA0PG6t/y9O273ReqZtl2auJ7puLvSdhA595R3jVec9QTZx+Yx3 50cb93a386Sopenharmony_ci /3tc8tqLSMvStF2tVTsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA 51cb93a386Sopenharmony_ci JzcDpl0kEJ/iqTYCxCVTbmbsvZZrktVI+QoVr4Wj94MqjIplHEA87qzhk/RBx/MeNjxufeK9yxnF 52cb93a386Sopenharmony_ci IQyYVjHw9UhLIQQsUN5y7m3yet5xzL/tOO+PNa4PMV+dk2bX9dEzzX4xVpHPcbkqHKw9NPE80nL+ 53cb93a386Sopenharmony_ci oK128vGM9oM3I177kwT2wFPvhT4yvDKBpuvgr/Pq82O7NxQO5pxshOuc8mvC8+x+vfRnRUxWLWI3 54cb93a386Sopenharmony_ci ZvsqWo7l2wbHbCZu798nOnZNsWbMRu4/S6zXPj2a8IOwsMA/KDseqz/daYMAAABz97MQzMbt0f9/ 55cb93a386Sopenharmony_ci vBYTAAAAYL7++UUMIDVXM86bZ3s1sxWC2fBd03J/CMFg+nrGyU9C2TvPYKmPTXYw12dnxi/UnKM+ 56cb93a386Sopenharmony_ci 7scgO6MNh4nzXvX8zlwbALBPB4xHsXkcV3Y9U3Jevmlx7Gri/nr9cl+Wvdy7le3f9ve5989leHJ0 57cb93a386Sopenharmony_ci 7+CqJL3v/vuZy9eYHzQ45vdb7RUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 58cb93a386Sopenharmony_ci AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 59cb93a386Sopenharmony_ci AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 60cb93a386Sopenharmony_ci AAAAAAAAAAAAAAAAAIB2PhQCAAAAAAAAAAAAAAAAAAAAYAB/fyYGAMA4/gXQcRfM 61cb93a386Sopenharmony_ci''' 62cb93a386Sopenharmony_cidef codepoints(): 63cb93a386Sopenharmony_ci i = 0 64cb93a386Sopenharmony_ci for increment in array.array('I', zlib.decompress( 65cb93a386Sopenharmony_ci base64.b64decode(valid_codepoint_data))).tolist(): 66cb93a386Sopenharmony_ci i += increment + 1 67cb93a386Sopenharmony_ci yield i 68cb93a386Sopenharmony_ciif sys.version_info[0] < 3: 69cb93a386Sopenharmony_ci def to_unicode(i): 70cb93a386Sopenharmony_ci return ('\\U%08x' % i).decode('unicode-escape').encode('UTF-8') 71cb93a386Sopenharmony_cielse: 72cb93a386Sopenharmony_ci def to_unicode(i): 73cb93a386Sopenharmony_ci return chr(i) 74cb93a386Sopenharmony_ciif __name__ == '__main__': 75cb93a386Sopenharmony_ci o = sys.stdout 76cb93a386Sopenharmony_ci o.write(to_unicode(0xFEFF)) 77cb93a386Sopenharmony_ci last_row = -1 78cb93a386Sopenharmony_ci for i in codepoints(): 79cb93a386Sopenharmony_ci row = i - (i & 63) 80cb93a386Sopenharmony_ci if last_row != row: 81cb93a386Sopenharmony_ci if row: 82cb93a386Sopenharmony_ci o.write('\n' if row % 1024 else '\n\n') 83cb93a386Sopenharmony_ci o.write('U+%06x ' % row) 84cb93a386Sopenharmony_ci last_row = row 85cb93a386Sopenharmony_ci o.write(' ' + to_unicode(i)) 86cb93a386Sopenharmony_ci o.write('\n') 87