Revision 3ce9a5e7 lib/opcodes.py
b/lib/opcodes.py | ||
---|---|---|
129 | 129 |
_TestNicDef = ht.TDictOf(ht.TElemOf(constants.INIC_PARAMS), |
130 | 130 |
ht.TOr(ht.TNone, ht.TNonEmptyString)) |
131 | 131 |
|
132 |
_SUMMARY_PREFIX = { |
|
133 |
"CLUSTER_": "C_", |
|
134 |
"GROUP_": "G_", |
|
135 |
"NODE_": "N_", |
|
136 |
"INSTANCE_": "I_", |
|
137 |
} |
|
138 |
|
|
132 | 139 |
|
133 | 140 |
def _NameToId(name): |
134 | 141 |
"""Convert an opcode class name to an OP_ID. |
... | ... | |
463 | 470 |
txt = "%s(%s)" % (txt, field_value) |
464 | 471 |
return txt |
465 | 472 |
|
473 |
def TinySummary(self): |
|
474 |
"""Generates a compact summary description of the opcode. |
|
475 |
|
|
476 |
""" |
|
477 |
assert self.OP_ID.startswith("OP_") |
|
478 |
|
|
479 |
text = self.OP_ID[3:] |
|
480 |
|
|
481 |
for (prefix, supplement) in _SUMMARY_PREFIX.items(): |
|
482 |
if text.startswith(prefix): |
|
483 |
return supplement + text[len(prefix):] |
|
484 |
|
|
485 |
return text |
|
486 |
|
|
466 | 487 |
|
467 | 488 |
# cluster opcodes |
468 | 489 |
|
Also available in: Unified diff