summaryrefslogtreecommitdiffstats
path: root/scripts/genbopomofoheader.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/genbopomofoheader.py')
-rw-r--r--scripts/genbopomofoheader.py18
1 files changed, 3 insertions, 15 deletions
diff --git a/scripts/genbopomofoheader.py b/scripts/genbopomofoheader.py
index 9d617b6..cb4024f 100644
--- a/scripts/genbopomofoheader.py
+++ b/scripts/genbopomofoheader.py
@@ -21,8 +21,8 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-import os
from operator import itemgetter
+from utils import expand_file
bopomofo = [
'ㄅ', 'ㄆ', 'ㄇ', 'ㄈ', 'ㄉ', 'ㄊ', 'ㄋ', 'ㄌ', 'ㄍ', 'ㄎ',
@@ -118,18 +118,6 @@ def get_table_content(tablename):
return gen_chewing_tones(scheme);
-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("chewing_table.h.in")
+ expand_file("chewing_table.h.in", get_table_content)