()
| 151 | |
| 152 | |
| 153 | def main_tw(): |
| 154 | big5decmap, big5encmap = load_big5_map() |
| 155 | cp950decmap, cp950encmap = load_cp950_map() |
| 156 | |
| 157 | # CP950 extends Big5, and the codec can use the Big5 lookup tables |
| 158 | # for most entries. So the CP950 tables should only include entries |
| 159 | # that are not in Big5: |
| 160 | for c1, m in list(cp950encmap.items()): |
| 161 | for c2, code in list(m.items()): |
| 162 | if (c1 in big5encmap and c2 in big5encmap[c1] |
| 163 | and big5encmap[c1][c2] == code): |
| 164 | del cp950encmap[c1][c2] |
| 165 | for c1, m in list(cp950decmap.items()): |
| 166 | for c2, code in list(m.items()): |
| 167 | if (c1 in big5decmap and c2 in big5decmap[c1] |
| 168 | and big5decmap[c1][c2] == code): |
| 169 | del cp950decmap[c1][c2] |
| 170 | |
| 171 | with open('mappings_tw.h', 'w') as fp: |
| 172 | print_autogen(fp, os.path.basename(__file__)) |
| 173 | write_big5_maps(fp, 'BIG5', 'big5', big5decmap, big5encmap) |
| 174 | write_big5_maps(fp, 'CP950', 'cp950ext', cp950decmap, cp950encmap) |
| 175 | |
| 176 | |
| 177 | def write_big5_maps(fp, display_name, table_name, decode_map, encode_map): |
no test coverage detected
searching dependent graphs…