本文整理汇总了Python中block.Block.next_id方法的典型用法代码示例。如果您正苦于以下问题:Python Block.next_id方法的具体用法?Python Block.next_id怎么用?Python Block.next_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block.Block
的用法示例。
在下文中一共展示了Block.next_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_revrefs
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import next_id [as 别名]
def make_revrefs():
revrefs = {}
for id in range(1, Block.next_id()):
revrefs[id] = []
for id in range(1, Block.next_id()):
block = Block.by_id(id)
if not block.has_return():
revrefs[block.passthru().id].append(id)
if block.branch():
revrefs[block.branch().id].append(id)
return revrefs
示例2: split_segments
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import next_id [as 别名]
def split_segments():
blocks_to_identify = []
for id in range(1, Block.next_id()):
block = Block.by_id(id)
if block.branch():
blocks_to_identify.append(id)
#segments, included_in, members = identify_structure(blocks_to_identify)
return _identify_structure(blocks_to_identify)
示例3: open
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import next_id [as 别名]
try:
import pygraphviz
except ImportError:
DEBUG_GRAPHVIZ = False
f = open('GameMenuRoutine.asm', 'r')
lines = f.readlines()
# part i - split code blocks
code_blocker.split_blocks(lines)
revrefs = code_blocker.make_revrefs()
if 'DEBUG_BLOCK' in globals() and DEBUG_BLOCK:
for id in range(1, Block.next_id()):
block = Block.by_id(id)
print(block.pp())
if 'DEBUG_BLOCK_GRAPHVIZ' in globals() and DEBUG_BLOCK_GRAPHVIZ:
g = pygraphviz.AGraph()
for id in range(1, Block.next_id()):
block = Block.by_id(id)
if block.has_return():
g.add_node(block.gv())
else:
g.add_edge(block.gv(), block.passthru().gv(), dir = 'forward')
if block.branch():
g.add_edge(block.gv(), block.branch().gv(), dir = 'forward',
color = 'blue', style = 'dashed')