@@ -0,0 +1,1890 @@
+%22%22%22%22%22%22%0A%0ATYPE_CPP2PY = %7B%0A    %22int%22: %22int%22,%0A    %22char%22: %22char%22,%0A    %22double%22: %22double%22,%0A    %22short%22: %22int%22,%0A%7D%0A%0A%0Aclass DataTypeGenerator:%0A    %22%22%22DataType%E7%94%9F%E6%88%90%E5%99%A8%22%22%22%0A%0A    def __init__(self, filename: str, prefix: str):%0A        %22%22%22Constructor%22%22%22%0A        self.filename = filename%0A        self.prefix = prefix%0A%0A    def run(self):%0A        %22%22%22%E4%B8%BB%E5%87%BD%E6%95%B0%22%22%22%0A        self.f_cpp = open(self.filename, %22r%22)%0A        self.f_define = open(f%22%7Bself.prefix%7D_constant.py%22, %22w%22)%0A        self.f_typedef = open(f%22%7Bself.prefix%7D_typedef.py%22, %22w%22)%0A%0A        for line in self.f_cpp:%0A            self.process_line(line)%0A%0A        self.f_cpp.close()%0A        self.f_define.close()%0A        self.f_typedef.close()%0A%0A        print(%22DataType%E7%94%9F%E6%88%90%E5%AE%8C%E6%AF%95%22)%0A%0A    def process_line(self, line: str):%0A        %22%22%22%E5%A4%84%E7%90%86%E6%AF%8F%E8%A1%8C%22%22%22%0A        line = line.replace(%22%5Cn%22, %22%22)%0A        line = line.replace(%22;%22, %22%22)%0A%0A        if line.startswith(%22#define%22):%0A            self.process_define(line)%0A        elif line.startswith(%22typedef%22):%0A            self.process_typedef(line)%0A%0A    def process_define(self, line: str):%0A        %22%22%22%E5%A4%84%E7%90%86%E5%B8%B8%E9%87%8F%E5%AE%9A%E4%B9%89%22%22%22%0A        words = line.split(%22 %22)%0A        words = %5Bword for word in words if word%5D%0A        if len(words) %3C 3:%0A            return%0A%0A        name = words%5B1%5D%0A        value = words%5B2%5D%0A%0A        new_line = f%22%7Bname%7D = %7Bvalue%7D%5Cn%22%0A        self.f_define.write(new_line)%0A%0A    def process_typedef(self, line: str):%0A        %22%22%22%E5%A4%84%E7%90%86%E7%B1%BB%E5%9E%8B%E5%AE%9A%E4%B9%89%22%22%22%0A        words = line.split(%22 %22)%0A        words = %5Bword for word in words if word != %22 %22%5D%0A%0A        name = words%5B2%5D%0A        typedef = TYPE_CPP2PY%5Bwords%5B1%5D%5D%0A%0A        if typedef == %22char%22:%0A            if %22%5B%22 in name:%0A                typedef = %22string%22%0A                name = name%5B:name.index(%22%5B%22)%5D%0A%0A        new_line = f%22%7Bname%7D = %5C%22%7Btypedef%7D%5C%22%5Cn%22%0A        self.f_typedef.write(new_line)%0A%0A%0Aif __name__ == %22__main__%22:%0A    generator = DataTypeGenerator(%22../include/ctp/ThostFtdcUserApiDataType.h%22, %22ctp%22)%0A    generator.run()%0A

Create generate_data_type.py