MCPcopy Create free account
hub / github.com/aff3ct/aff3ct / export_as_source

Method export_as_source

scripts/debug_parser/aff3ct_debug_parser.py:63–92  ·  view source on GitHub ↗
(self, path, frame_index=None)

Source from the content-addressed store, hash-verified

61 fout.write("\n")
62
63 def export_as_source(self, path, frame_index=None):
64 export_all = False
65 if frame_index is None:
66 export_all = True
67
68 # get c_type (signed char, signed short...)
69 c_type = self.get_c_type()
70
71 # unable to identify c_type -> exit
72 if not c_type:
73 return
74
75 with open(path, "w") as fout:
76 fout.write("{0} {1}".format(c_type, self.name))
77 if export_all:
78 fout.write("[{0}]".format(str(len(self.frames))))
79 fout.write("[{0}] = ".format(str(self.frame_length)))
80
81 if export_all:
82 fout.write("\n{\n")
83 for inner_frame_index in range(0, len(self.frames)):
84 if inner_frame_index:
85 fout.write(",\n")
86 self.write_array(fout, inner_frame_index)
87 fout.write("\n}")
88 else:
89 fout.write("\n")
90 self.write_array(fout, frame_index)
91
92 fout.write(";\n")
93
94 def write_array(self, fout, frame_index):
95 fout.write("{\n\t")

Callers 1

mainFunction · 0.80

Calls 3

get_c_typeMethod · 0.95
write_arrayMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected