Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
kokifish committed Dec 18, 2024
1 parent 9b00db0 commit 8d9ac03
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions ohre/abcre/dis/Method.py → ohre/abcre/dis/AsmMethod.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Any, Dict, Iterable, List, Tuple
from ohre.misc import Log
from ohre.abcre.dis.Types import AsmTpye
from ohre.abcre.dis.AsmTypes import AsmTpye


class Method:
class AsmMethod:
# fields in Class
def __init__(self, slotNumberIdx, lines: List[str]):
assert len(lines) >= 2
Expand Down Expand Up @@ -70,7 +70,7 @@ def __str__(self):
return self.debug_short()

def debug_short(self) -> str:
out = f"Method: {self.slotNumberIdx} {self.func_type} {self.class_func_name} file: {self.file_name}\n\
out = f"AsmMethod: {self.slotNumberIdx} {self.func_type} {self.class_func_name} file: {self.file_name}\n\
args({len(self.args)}) {self.args} insts({len(self.insts)})"
return out

Expand All @@ -85,6 +85,6 @@ def debug_deep(self) -> str:
else:
out += f"{inst[i]}"
out_insts += f"{out}\n"
out = f"Method: {self.slotNumberIdx} {self.func_type} {self.class_func_name} file: {self.file_name}\n\
out = f"AsmMethod: {self.slotNumberIdx} {self.func_type} {self.class_func_name} file: {self.file_name}\n\
args({len(self.args)}) {self.args} insts({len(self.insts)})\n{out_insts}"
return out
10 changes: 5 additions & 5 deletions ohre/abcre/dis/Record.py → ohre/abcre/dis/AsmRecord.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Any, Dict, Iterable, List, Tuple
from ohre.misc import Log
from ohre.abcre.dis.Types import AsmTpye
from ohre.abcre.dis.AsmTypes import AsmTpye


class Record:
class AsmRecord:
# fields in Class
def __init__(self, lines: List[str]):
self.class_name: str = ""
Expand All @@ -22,13 +22,13 @@ def __init__(self, lines: List[str]):
if (AsmTpye.is_uint(ty)):
value = int(value, 16)
else:
Log.error(f"ERROR in Record init: ty {ty} name {name} value {value} {type(value)}")
Log.error(f"ERROR in AsmRecord init: ty {ty} name {name} value {value} {type(value)}")
self.fields[name] = (ty, value)
else:
Log.warn(f"invalid line in Record: {line},\nlines: {lines}")
Log.warn(f"invalid line in AsmRecord: {line},\nlines: {lines}")

def debug_deep(self):
out = f"Record {self.class_name}: "
out = f"AsmRecord {self.class_name}: "
for field_name, (ty, value) in self.fields.items():
out += f"{field_name}({ty}) {value};"
return out
2 changes: 1 addition & 1 deletion ohre/abcre/dis/AsmString.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Dict, Iterable, List, Tuple
from ohre.misc import Log
from ohre.abcre.dis.Types import AsmTpye
from ohre.abcre.dis.AsmTypes import AsmTpye


class AsmString:
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions ohre/abcre/dis/DisFile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, Dict, Iterable, List, Tuple

from ohre.abcre.dis.Record import Record
from ohre.abcre.dis.Method import Method
from ohre.abcre.dis.AsmRecord import AsmRecord
from ohre.abcre.dis.AsmMethod import AsmMethod
from ohre.abcre.dis.AsmString import AsmString
from ohre.misc import Log

Expand All @@ -27,8 +27,8 @@ def __init__(self, value):
self.source_binary_name: str = ""
self.language: str = ""
self.lines: List[str] = list()
self.records: List[Record] = list()
self.methods: List[Method] = list()
self.records: List[AsmRecord] = list()
self.methods: List[AsmMethod] = list()
self.asmstrs: List[AsmString] = list()
if (isinstance(value, str)):
file = open(value, "r", encoding="utf-8", errors="ignore")
Expand Down Expand Up @@ -112,7 +112,7 @@ def _read_records(self, l_n) -> Tuple[int, int]:
l_n += 1
if ("}" in line_rec):
break
rec = Record(lines_record)
rec = AsmRecord(lines_record)
self.records.append(rec)
else:
l_n += 1
Expand All @@ -136,7 +136,7 @@ def _read_methods(self, l_n) -> Tuple[int, int]:
l_n += 1
if ("}" == line_method):
break
method = Method(slotNumberIdx, lines_method)
method = AsmMethod(slotNumberIdx, lines_method)
self.methods.append(method)
else:
l_n += 1
Expand Down

0 comments on commit 8d9ac03

Please sign in to comment.