fix: fix issues

- fix BMapBindings generator due to the rename of LIBCMO_EXPORT -> BMAP_EXPORT.
- fix relative path issue in Python scripts within CodeGen.
- remove all references to LIBCMO_PANIC. use exception instead to tell user they are fool.
- basically finish universal encoding tables. add lost encoding name.
This commit is contained in:
2024-08-17 23:29:08 +08:00
parent e682a87d25
commit 9903b61cac
12 changed files with 49 additions and 29 deletions

View File

@ -1,5 +1,6 @@
import typing
import io
import os
class LanguageToken:
m_Name: str
@ -48,8 +49,13 @@ def write_iconv_map(fs: io.TextIOWrapper, data: tuple[LanguageToken, ...]) -> No
fs.write('};\n')
if __name__ == '__main__':
with open('EncodingTable.csv', 'r', encoding='utf-8') as fr:
with open('UEncodingTable.cpp', 'w', encoding='utf-8') as fw:
# get file path
self_path: str = os.path.dirname(__file__)
csv_file: str = os.path.join(self_path, 'EncodingTable.csv')
cpp_file: str = os.path.join(self_path, 'EncodingTable.cpp')
# process files
with open(csv_file, 'r', encoding='utf-8') as fr:
with open(cpp_file, 'w', encoding='utf-8') as fw:
data = extract_data(fr)
token = extract_token(data)
write_alias_map(fw, token)