summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-04-08 13:40:55 -0500
committerBryan Bishop <kanzure@gmail.com>2012-04-08 13:40:55 -0500
commita650a86726a70d816050740b925578c78346ab7d (patch)
tree5cadc12be460d955e04d38c01cea800fa5caccd4
parent395d0db9a1b7632a2b89c0461b423e8695b21948 (diff)
get_label_for improvements (use script_parse_table if possible)
original-commit-id: d331a28c7a437d1f7d6fe12ded986edab0b0e566
-rw-r--r--crystal.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/crystal.py b/crystal.py
index 9e7ffdb..732ea59 100644
--- a/crystal.py
+++ b/crystal.py
@@ -5965,10 +5965,21 @@ def get_label_for(address):
global all_labels
if type(address) != int:
raise Exception, "get_label_for requires an integer address"
+
+ #the old way
for thing in all_labels:
if thing["address"] == address:
return thing["label"]
- return None
+
+ #the new way
+ if is_script_already_parsed_at(address):
+ obj = script_parse_table[address]
+ if hasattr(obj, "label"):
+ return getattr(obj, "label")
+ else:
+ return "AlreadyParsedNoDefaultUnknownLabel_" + hex(address)
+
+ return "NotYetParsed_"+hex(address)
def remove_quoted_text(line):
"""get rid of content inside quotes