diff options
author | bloodstalker <thabogre@gmail.com> | 2018-08-04 18:44:21 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-08-04 18:44:21 +0000 |
commit | b7251595295f7e1c3bf28afe25f6d070400bbcf5 (patch) | |
tree | 785c2820bccb164d27c381277e6f127bafa1ba4e /main.py | |
parent | update (diff) | |
download | faultreiber-b7251595295f7e1c3bf28afe25f6d070400bbcf5.tar.gz faultreiber-b7251595295f7e1c3bf28afe25f6d070400bbcf5.zip |
update
Diffstat (limited to '')
-rwxr-xr-x | main.py | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -197,7 +197,7 @@ def dupemake(path, main_name): class CodeGen(object): def __init__(self, argparser): self.argparser = argparser - self.struct_json = json.load(open(self.argparser.args.structs)) + #self.struct_json = json.load(open(self.argparser.args.structs)) self.dnt = datetime.datetime.now().isoformat() self.elems = [] self.def_elems = [] @@ -356,11 +356,12 @@ class CodeGen(object): void_source.write("\n// automatically generated by faultreiber\n") void_source.write("// " + self.dnt + "\n") void_source.write('#include "./structs.h"\n') - void_source.write('#include "./read.c"\n') + void_source.write('#include "./read.h"\n') void_source.write("#include <stdlib.h>\n") #void_source.write("void** void_train(void) {\n") void_source_h.write('#ifndef FT_AGGREGATE_H\n#define FT_AGGREGATE_H\n') void_source_h.write('#ifdef __cplusplus\nextern "C" {\n#endif\n') + void_source_h.write('#include "./structs.h"\n') for elem in self.read_elems: count = get_elem_count(elem) size = get_elem_size(elem) @@ -506,17 +507,21 @@ class CodeGen(object): def_header.write("}" + child.attrib["name"] + ";\n\n") def gen_struct_header_xml(self): - struct_source = open(self.struct_source, "w") + struct_source = open(self.struct_source_h, "w") struct_source_c = open(get_full_path(self.argparser.args.outdir, "structs.c"), "w") + struct_source.write("#ifndef FT_STRUCTS_H\n#define FT_STRUCTS_H\n") struct_source_c.write('#include "structs.h"') + struct_source.write('#include <unistd.h>') struct_source.write(text.pre_header_guard) struct_source.write(text.autogen_warning) if self.argparser.args.datetime: struct_source.write("// " + self.dnt + "\n") struct_source.write(text.header_guard_begin.replace("XXX", "structs".upper())) struct_source.write(text.header_inttype) - struct_source.write(text.c_read_leb_u_def + "\n") - struct_source.write(text.c_read_leb_s_def + "\n") - struct_source.write(text.c_read_leb_macro_defs + "\n") + struct_source_c.write(text.c_read_leb_u_def + "\n") + struct_source_c.write(text.c_read_leb_s_def + "\n") + struct_source.write(text.c_read_leb_128_u_sig + "\n") + struct_source.write(text.c_read_leb_128_s_sig + "\n") + #struct_source.write(text.c_read_leb_macro_defs + "\n") if self.argparser.args.structsinclude: copy(self.argparser.args.structsinclude, self.argparser.args.outdir) pos = self.argparser.args.structsinclude.rfind("/") @@ -548,6 +553,7 @@ class CodeGen(object): struct_source.write(ref_type + pointer + " " + childer.attrib["name"] + ";\n") struct_source.write("}" + child.attrib["name"] + ";\n\n") struct_source.write(text.pragma_endif) + struct_source.write("#endif //end of header guard\n") #struct_source.write(text.last_comment) def gen_struct_header(self): |