This action will force synchronization from OpenHarmony-SIG/python, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
#! /usr/bin/env python"""Generate C code for the jump table of the threaded code interpreter(for compilers supporting computed gotos or "labels-as-values", such as gcc)."""import osimport systry:from importlib.machinery import SourceFileLoaderexcept ImportError:import impdef find_module(modname):"""Finds and returns a module in the local dist/checkout."""modpath = os.path.join(os.path.dirname(os.path.dirname(__file__)), "Lib")return imp.load_module(modname, *imp.find_module(modname, [modpath]))else:def find_module(modname):"""Finds and returns a module in the local dist/checkout."""modpath = os.path.join(os.path.dirname(os.path.dirname(__file__)), "Lib", modname + ".py")return SourceFileLoader(modname, modpath).load_module()def write_contents(f):"""Write C code contents to the target file object."""opcode = find_module('opcode')targets = ['_unknown_opcode'] * 256for opname, op in opcode.opmap.items():targets[op] = "TARGET_%s" % opnamef.write("static void *opcode_targets[256] = {\n")f.write(",\n".join([" &&%s" % s for s in targets]))f.write("\n};\n")def main():if len(sys.argv) >= 3:sys.exit("Too many arguments")if len(sys.argv) == 2:target = sys.argv[1]else:target = "Python/opcode_targets.h"with open(target, "w") as f:write_contents(f)print("Jump table written into %s" % target)if __name__ == "__main__":main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。