summaryrefslogtreecommitdiff
path: root/python/languagerepresentation.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-01-20 18:44:25 -0500
committerRusty Wagner <rusty.wagner@gmail.com>2025-01-20 18:44:25 -0500
commite78cae77103b5396ce42d9e33593ea55f9135be0 (patch)
treeb44cb4bf7732c1e2e77ae39335eb4e2f02d9af84 /python/languagerepresentation.py
parentcbd4d7f12d54ddc4b6d3d90a8d7b49591f468a94 (diff)
Revert "Add line formatter API and a generic line formatter plugin"
This reverts commit 1699c71999d29d32aba5c9f8fea193a661a4b02b.
Diffstat (limited to 'python/languagerepresentation.py')
-rw-r--r--python/languagerepresentation.py34
1 files changed, 2 insertions, 32 deletions
diff --git a/python/languagerepresentation.py b/python/languagerepresentation.py
index a0a5a234..ac34c860 100644
--- a/python/languagerepresentation.py
+++ b/python/languagerepresentation.py
@@ -30,7 +30,6 @@ from . import binaryview
from . import function
from . import highlevelil
from . import highlight
-from . import lineformatter
from . import variable
from . import types
from .log import log_error
@@ -328,8 +327,7 @@ class LanguageRepresentationFunction:
annotation_end_string = "}"
def __init__(
- self, func_type: Optional['LanguageRepresentationFunctionType'] = None,
- arch: Optional['architecture.Architecture'] = None, owner: Optional['function.Function'] = None,
+ self, arch: Optional['architecture.Architecture'] = None, owner: Optional['function.Function'] = None,
hlil: Optional['highlevelil.HighLevelILFunction'] = None, handle=None
):
if handle is None:
@@ -356,9 +354,7 @@ class LanguageRepresentationFunction:
self.comment_end_string = self.__class__.comment_end_string
self.annotation_start_string = self.__class__.annotation_start_string
self.annotation_end_string = self.__class__.annotation_end_string
- _handle = core.BNCreateCustomLanguageRepresentationFunction(
- func_type.handle, arch.handle, owner.handle, hlil.handle, self._cb
- )
+ _handle = core.BNCreateCustomLanguageRepresentationFunction(arch.handle, owner.handle, hlil.handle, self._cb)
assert _handle is not None
else:
self.comment_start_string = core.BNGetLanguageRepresentationFunctionCommentStartString(handle)
@@ -625,7 +621,6 @@ class LanguageRepresentationFunctionType(metaclass=_LanguageRepresentationFuncti
self._cb.isValid = self._cb.isValid.__class__(self._is_valid)
self._cb.getTypePrinter = self._cb.getTypePrinter.__class__(self._type_printer)
self._cb.getTypeParser = self._cb.getTypeParser.__class__(self._type_parser)
- self._cb.getLineFormatter = self._cb.getLineFormatter.__class__(self._line_formatter)
self._cb.getFunctionTypeTokens = self._cb.getFunctionTypeTokens.__class__(self._function_type_tokens)
self._cb.freeLines = self._cb.freeLines.__class__(self._free_lines)
self.handle = core.BNRegisterLanguageRepresentationFunctionType(self.__class__.language_name, self._cb)
@@ -677,16 +672,6 @@ class LanguageRepresentationFunctionType(metaclass=_LanguageRepresentationFuncti
log_error(traceback.format_exc())
return None
- def _line_formatter(self, ctxt):
- try:
- result = self.line_formatter
- if result is None:
- return None
- return ctypes.cast(result.handle, ctypes.c_void_p).value
- except:
- log_error(traceback.format_exc())
- return None
-
def _function_type_tokens(
self, ctxt, func: core.BNFunctionHandle, settings: Optional[core.BNDisassemblySettingsHandle],
count: ctypes.POINTER(ctypes.c_ulonglong)
@@ -766,14 +751,6 @@ class LanguageRepresentationFunctionType(metaclass=_LanguageRepresentationFuncti
"""
return None
- @property
- def line_formatter(self) -> Optional['lineformatter.LineFormatter']:
- """
- Returns the line formatter for formatting lines in this language. If ``None`` is returned, the default
- line formatter will be used.
- """
- return None
-
def function_type_tokens(
self, func: 'function.Function', settings: Optional['function.DisassemblySettings']
) -> List['function.DisassemblyTextLine']:
@@ -829,13 +806,6 @@ class CoreLanguageRepresentationFunctionType(LanguageRepresentationFunctionType)
return None
return binaryninja.typeparser.TypeParser(handle=result)
- @property
- def line_formatter(self) -> Optional['lineformatter.LineFormatter']:
- result = core.BNGetLanguageRepresentationFunctionTypeLineFormatter(self.handle)
- if result is None:
- return None
- return binaryninja.lineformatter.LineFormatter(handle=result)
-
def function_type_tokens(
self, func: 'function.Function', settings: Optional['function.DisassemblySettings']
) -> List['function.DisassemblyTextLine']: