diff options
Diffstat (limited to '')
-rwxr-xr-x | extra-tools/luatablegen.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/extra-tools/luatablegen.py b/extra-tools/luatablegen.py index 7443c39..c66b94c 100755 --- a/extra-tools/luatablegen.py +++ b/extra-tools/luatablegen.py @@ -328,21 +328,30 @@ class TbgParser(object): table_reg_list.append(struct_name + "_register(__ls);\n") h_source.write(TABLE_REGISTER[0].replace("XXX", struct_name).replace(" {\n", ";\n")) self.end(h_source) + # header aggregate if self.argparser.args.headeraggr: - aggr_header = open(self.argparser.args.headeraggr, "w") - aggr_header.write(HEADER_GUARD[0].replace("XXX", "WASM_TABLES_AGGR")) - aggr_header.write(EXTERN_C[0]) + name = self.argparser.args.headeraggr + dummy = name[name.rfind("/"):] + aggr_header = open(self.argparser.args.headeraggr.replace(".h", ".c"), "w") + aggr_header_h = open(self.argparser.args.headeraggr, "w") + aggr_header.write("// automatically generated by luatablegen\n") + aggr_header_h.write("// automatically generated by luatablegen\n") + aggr_header_h.write(HEADER_GUARD[0].replace("XXX", "WASM_TABLES_AGGR")) + aggr_header_h.write(EXTERN_C[0]) aggr_header.write("\n") for item in header_aggr_list: aggr_header.write("#include " + '"' + item + '"\n') + aggr_header_h.write("#include " + '"' + item + '"\n') + aggr_header.write("#include " + '".' + dummy + '"\n') aggr_header.write("\n") aggr_header.write("void reg_tablegen_tables(lua_State* __ls) {\n") + aggr_header_h.write("void reg_tablegen_tables(lua_State* __ls);\n") for func_sig in table_reg_list: aggr_header.write("\t" + func_sig) aggr_header.write("\t" + "lua_pop(__ls, 1);\n") aggr_header.write("}\n") - aggr_header.write(EXTERN_C[1]) - aggr_header.write(HEADER_GUARD[1]) + aggr_header_h.write(EXTERN_C[1]) + aggr_header_h.write(HEADER_GUARD[1]) aggr_header.write("\n") if self.argparser.args.makemacro: if self.argparser.args.out[-1] == "/": |