def saveAsAsmFile(self):
asm_fmt = open(TEMPLATES_PATH + "/template.asm", "rb").read()
txt = self.canvas.codeWidget.parser.getCleanCodeAsByte(as_string=True)
if sys.version_info.major == 2:
title = bytes(self.arch.name)
else:
title = bytes(self.arch.name, encoding="utf-8")
asm = asm_fmt % (title, b'\n'.join([b"\t%s"%x for x in txt.split(b'\n')]))
fd, fpath = tempfile.mkstemp(suffix=".asm")
os.write(fd, asm)
os.close(fd)
self.canvas.logWidget.editor.append("Saved as '%s'" % fpath)
评论列表
文章目录