diff options
Diffstat (limited to 'scripts/genpinyinheader.py')
-rw-r--r-- | scripts/genpinyinheader.py | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/scripts/genpinyinheader.py b/scripts/genpinyinheader.py index 8a0a8fd..7d07a24 100644 --- a/scripts/genpinyinheader.py +++ b/scripts/genpinyinheader.py @@ -20,7 +20,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import os +from utils import expand_file from genpinyintable import gen_content_table, \ gen_pinyin_index, gen_bopomofo_index, \ gen_chewing_key_table @@ -41,20 +41,6 @@ def get_table_content(tablename): return gen_chewing_key_table() -def expand_file(filename): - infile = open(filename, "r") - for line in infile.readlines(): - line = line.rstrip(os.linesep) - if len(line) < 3 : - print(line) - continue - if line[0] == '@' and line[-1] == '@': - tablename = line[1:-1] - print(get_table_content(tablename)) - else: - print(line) - - ### main function ### if __name__ == "__main__": - expand_file("pinyin_parser_table.h.in") + expand_file("pinyin_parser_table.h.in", get_table_content) |