summaryrefslogtreecommitdiffstats
path: root/scripts2
diff options
context:
space:
mode:
Diffstat (limited to 'scripts2')
-rw-r--r--scripts2/generateheader.py3
-rw-r--r--scripts2/templates/zhuyin_table.h.in9
-rw-r--r--scripts2/zhuyin.py3
3 files changed, 14 insertions, 1 deletions
diff --git a/scripts2/generateheader.py b/scripts2/generateheader.py
index f91b843..59e7633 100644
--- a/scripts2/generateheader.py
+++ b/scripts2/generateheader.py
@@ -27,6 +27,7 @@ from fullpinyintable import gen_content_table, gen_pinyin_index, gen_luoma_pinyi
from specialtable import gen_divided_table, gen_resplit_table
from doublepinyintable import gen_shengmu_table, gen_yunmu_table, gen_fallback_table2, gen_fallback_table3
from bopomofotable import gen_chewing_symbols, gen_chewing_initials, gen_chewing_middles, gen_chewing_finals, gen_chewing_tones
+from zhuyin import gen_zhuyin_table
header = '''/* This file is generated by python scripts. Don't edit this file directly.
@@ -66,6 +67,8 @@ def get_table_content(tablename):
return gen_resplit_table()
if tablename == 'TABLE_INDEX':
return gen_table_index_for_chewing_key()
+ if tablename == 'VALID_ZHUYIN_TABLE':
+ return gen_zhuyin_table()
#double pinyin table
(scheme, part) = tablename.split('_', 1)
diff --git a/scripts2/templates/zhuyin_table.h.in b/scripts2/templates/zhuyin_table.h.in
index 9760d4f..f9fc9fa 100644
--- a/scripts2/templates/zhuyin_table.h.in
+++ b/scripts2/templates/zhuyin_table.h.in
@@ -107,7 +107,14 @@ const zhuyin_tone_item_t chewing_dachen_cp26_tones[] = {
@DACHEN-CP26_TONES@
};
-static const char * chewing_tone_table[CHEWING_NUMBER_OF_TONES] = {
+const bool valid_zhuyin_table[CHEWING_NUMBER_OF_INITIALS *
+ CHEWING_NUMBER_OF_MIDDLES *
+ CHEWING_NUMBER_OF_FINALS *
+ CHEWING_NUMBER_OF_TONES] = {
+@VALID_ZHUYIN_TABLE@
+};
+
+const char * chewing_tone_table[CHEWING_NUMBER_OF_TONES] = {
"",
" ",
"ˊ",
diff --git a/scripts2/zhuyin.py b/scripts2/zhuyin.py
index 5ab76c4..fa5dbd9 100644
--- a/scripts2/zhuyin.py
+++ b/scripts2/zhuyin.py
@@ -65,6 +65,7 @@ def compute_zero_tone():
final_maps = middle_maps[middle]
for final in final_maps.keys():
tone_maps = final_maps[final]
+ # assume all valid zero tones have sub tones
if len(tone_maps) > 0:
tone_maps["CHEWING_ZERO_TONE"] = True
@@ -95,6 +96,8 @@ def is_valid_zhuyin(key):
if tone not in maps:
return False
+ return True
+
# generate valid_zhuyin_table
def gen_zhuyin_table():