diff --git a/src/gen-ucd.py b/src/gen-ucd.py index 9d51ea7e6..beec65f1e 100755 --- a/src/gen-ucd.py +++ b/src/gen-ucd.py @@ -5,12 +5,14 @@ from __future__ import print_function, division, absolute_import import io, os.path, sys, re if len (sys.argv) != 2: - print ("usage: ./gen-ucd ucdxml-file", file=sys.stderr) - sys.exit (1) + print("usage: ./gen-ucd-table ucd.nonunihan.grouped.xml", file=sys.stderr) + sys.exit(1) 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] ccc = [int(u['ccc']) for u in ucd] @@ -59,9 +61,26 @@ for line in open('hb-common.h'): DEFAULT = 1 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('#include ') print() + code = packTab.Code('_hb_ucd') sc_array, _, _ = code.addArray('hb_script_t', 'sc_map', sc_array) dm1_array, _, _ = code.addArray('hb_codepoint_t', 'dm1_map', dm1_array) @@ -91,3 +110,8 @@ for compression in (DEFAULT, COMPACT): print() print('#endif') print() + +print() +print("#endif /* HB_UCD_TABLE_HH */") +print() +print("/* == End of generated table == */")