[gen-ucd] Minor

This commit is contained in:
Behdad Esfahbod 2019-05-22 15:46:19 -04:00
parent 15a9e32b56
commit 831c213501
1 changed files with 27 additions and 3 deletions

View File

@ -5,12 +5,14 @@ from __future__ import print_function, division, absolute_import
import io, os.path, sys, re import io, os.path, sys, re
if len (sys.argv) != 2: if len (sys.argv) != 2:
print ("usage: ./gen-ucd ucdxml-file", file=sys.stderr) print("usage: ./gen-ucd-table ucd.nonunihan.grouped.xml", file=sys.stderr)
sys.exit(1) sys.exit(1)
import youseedy, packTab import youseedy, packTab
ucd = youseedy.load_ucdxml (sys.argv[1]) ucdxml = youseedy.load_ucdxml(sys.argv[1])
ucd = youseedy.ucdxml_get_repertoire(ucdxml)
gc = [u['gc'] for u in ucd] gc = [u['gc'] for u in ucd]
ccc = [int(u['ccc']) for u in ucd] ccc = [int(u['ccc']) for u in ucd]
@ -59,9 +61,26 @@ for line in open('hb-common.h'):
DEFAULT = 1 DEFAULT = 1
COMPACT = 3 COMPACT = 3
print("/* == Start of generated table == */")
print("/*")
print(" * The following table is generated by running:")
print(" *")
print(" * ./gen-ucd-table.py ucd.nonunihan.grouped.xml")
print(" *")
print(" * on file with this description:", ucdxml.description)
print(" */")
print()
print("#ifndef HB_UCD_TABLE_HH")
print("#define HB_UCD_TABLE_HH")
print()
print() print()
print('#include <stdint.h>') print('#include <stdint.h>')
print() print()
code = packTab.Code('_hb_ucd') code = packTab.Code('_hb_ucd')
sc_array, _, _ = code.addArray('hb_script_t', 'sc_map', sc_array) sc_array, _, _ = code.addArray('hb_script_t', 'sc_map', sc_array)
dm1_array, _, _ = code.addArray('hb_codepoint_t', 'dm1_map', dm1_array) dm1_array, _, _ = code.addArray('hb_codepoint_t', 'dm1_map', dm1_array)
@ -91,3 +110,8 @@ for compression in (DEFAULT, COMPACT):
print() print()
print('#endif') print('#endif')
print() print()
print()
print("#endif /* HB_UCD_TABLE_HH */")
print()
print("/* == End of generated table == */")