From 8d9ac0325f53d122ce4ccdcb1ad424f802350534 Mon Sep 17 00:00:00 2001 From: koki Date: Wed, 18 Dec 2024 08:26:34 +0800 Subject: [PATCH] rename --- ohre/abcre/dis/{Method.py => AsmMethod.py} | 8 ++++---- ohre/abcre/dis/{Record.py => AsmRecord.py} | 10 +++++----- ohre/abcre/dis/AsmString.py | 2 +- ohre/abcre/dis/{Types.py => AsmTypes.py} | 0 ohre/abcre/dis/DisFile.py | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) rename ohre/abcre/dis/{Method.py => AsmMethod.py} (91%) rename ohre/abcre/dis/{Record.py => AsmRecord.py} (78%) rename ohre/abcre/dis/{Types.py => AsmTypes.py} (100%) diff --git a/ohre/abcre/dis/Method.py b/ohre/abcre/dis/AsmMethod.py similarity index 91% rename from ohre/abcre/dis/Method.py rename to ohre/abcre/dis/AsmMethod.py index 0707bdb..e9df5e3 100644 --- a/ohre/abcre/dis/Method.py +++ b/ohre/abcre/dis/AsmMethod.py @@ -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 @@ -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 @@ -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 diff --git a/ohre/abcre/dis/Record.py b/ohre/abcre/dis/AsmRecord.py similarity index 78% rename from ohre/abcre/dis/Record.py rename to ohre/abcre/dis/AsmRecord.py index fa67c3e..9e2acb0 100644 --- a/ohre/abcre/dis/Record.py +++ b/ohre/abcre/dis/AsmRecord.py @@ -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 = "" @@ -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 diff --git a/ohre/abcre/dis/AsmString.py b/ohre/abcre/dis/AsmString.py index 0c83145..3c22b3f 100644 --- a/ohre/abcre/dis/AsmString.py +++ b/ohre/abcre/dis/AsmString.py @@ -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: diff --git a/ohre/abcre/dis/Types.py b/ohre/abcre/dis/AsmTypes.py similarity index 100% rename from ohre/abcre/dis/Types.py rename to ohre/abcre/dis/AsmTypes.py diff --git a/ohre/abcre/dis/DisFile.py b/ohre/abcre/dis/DisFile.py index 2f921e1..b014700 100644 --- a/ohre/abcre/dis/DisFile.py +++ b/ohre/abcre/dis/DisFile.py @@ -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 @@ -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") @@ -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 @@ -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