libcmo21/CodeGen/BMapBindings/ExtractBMapFctDecl.py
yyc12345 9903b61cac 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.
2024-08-17 23:29:08 +08:00

20 lines
741 B
Python

import os, re
self_path: str = os.path.dirname(__file__)
src_file: str = os.path.join(self_path, '../../BMap/BMExports.hpp')
dst_file: str = os.path.join(self_path, 'dest/BMExports.hpp')
with open(src_file, 'r', encoding='utf-8') as fsrc:
# read full text
fulltext: str = fsrc.read()
# do findall and write into file
with open(dst_file, 'w', encoding='utf-8') as fdst:
# We should not only match BMAP_EXPORT,
# because it may match the defination of BMAP_EXPORT.
# So we add a bool at head because all BMap functions return bool.
for item in re.findall('^BMAP_EXPORT[ \\t]+bool[ \\t]+[^;]+;', fulltext, re.MULTILINE):
fdst.write(item)
fdst.write('\n')
print('DONE')