Adjustments to the generated Indic table output (#1936)

* Add empty parentheses after print call

* Minor: newlines. Move #pragma pop down one; #endif up one

* Adjust #define ISC/IMC output

* Regenerate Indic table
This commit is contained in:
Adrian Wong 2019-08-28 21:31:27 +10:00 committed by Behdad Esfahbod
parent 4ef08dbce1
commit b66076812d
2 changed files with 69 additions and 59 deletions

View File

@ -133,8 +133,8 @@ what = ["INDIC_SYLLABIC_CATEGORY", "INDIC_MATRA_CATEGORY"]
what_short = ["ISC", "IMC"]
print ('#pragma GCC diagnostic push')
print ('#pragma GCC diagnostic ignored "-Wunused-macros"')
cat_defs = []
for i in range (2):
print ()
vv = sorted (values[i].keys ())
for v in vv:
v_no_and = v.replace ('_And_', '_')
@ -146,10 +146,17 @@ for i in range (2):
raise Exception ("Duplicate short value alias", v, all_shorts[i][s])
all_shorts[i][s] = v
short[i][v] = s
print ("#define %s_%s %s_%s %s/* %3d chars; %s */" %
(what_short[i], s, what[i], v.upper (),
' '* ((48-1 - len (what[i]) - 1 - len (v)) // 8),
values[i][v], v))
cat_defs.append ((what_short[i] + '_' + s, what[i] + '_' + v.upper (), str (values[i][v]), v))
maxlen_s = max ([len (c[0]) for c in cat_defs])
maxlen_l = max ([len (c[1]) for c in cat_defs])
maxlen_n = max ([len (c[2]) for c in cat_defs])
for s in what_short:
print ()
for c in [c for c in cat_defs if s in c[0]]:
print ("#define %s %s /* %s chars; %s */" %
(c[0].ljust (maxlen_s), c[1].ljust (maxlen_l), c[2].rjust (maxlen_n), c[3]))
print ()
print ('#pragma GCC diagnostic pop')
print ()
print ("#define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, IMC_##M)")
@ -249,14 +256,14 @@ print ("}")
print ()
print ("#undef _")
for i in range (2):
print
print ()
vv = sorted (values[i].keys ())
for v in vv:
print ("#undef %s_%s" %
(what_short[i], short[i][v]))
print ()
print ()
print ('#endif')
print ()
print ("/* == End of generated table == */")
# Maintain at least 30% occupancy in the table */

View File

@ -75,6 +75,7 @@
#define IMC_TLR INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT /* 4 chars; Top_And_Left_And_Right */
#define IMC_TR INDIC_MATRA_CATEGORY_TOP_AND_RIGHT /* 13 chars; Top_And_Right */
#define IMC_VOL INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT /* 19 chars; Visual_Order_Left */
#pragma GCC diagnostic pop
#define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, IMC_##M)
@ -439,6 +440,7 @@ hb_indic_get_categories (hb_codepoint_t u)
}
#undef _
#undef ISC_A
#undef ISC_Bi
#undef ISC_BJN
@ -475,6 +477,7 @@ hb_indic_get_categories (hb_codepoint_t u)
#undef ISC_Vo
#undef ISC_M
#undef ISC_VI
#undef IMC_B
#undef IMC_BL
#undef IMC_BR
@ -491,6 +494,6 @@ hb_indic_get_categories (hb_codepoint_t u)
#undef IMC_TR
#undef IMC_VOL
#endif
/* == End of generated table == */