From e6560f0cd26a865401808de3de2f304841f3a482 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 9 Jul 2024 08:55:44 -0400 Subject: Refactor architecture calling convention python api --- python/architecture.py | 60 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 8 deletions(-) (limited to 'python') diff --git a/python/architecture.py b/python/architecture.py index 8c118c44..c3b0f705 100644 --- a/python/architecture.py +++ b/python/architecture.py @@ -2049,40 +2049,84 @@ class Architecture(metaclass=_ArchitectureMetaClass): """ core.BNRegisterCallingConvention(self.handle, cc.handle) - def get_default_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + @property + def default_calling_convention(self): + """ + Default calling convention. + + .. note:: Make sure the calling convention has been registered with `Architecture.register_calling_convention`. + + :getter: returns a CallingConvention object for the default calling convention, if one exists. + :setter: sets the default calling convention + :type: Optional['callingconvention.CallingConvention'] + """ cc_handle = core.BNGetArchitectureDefaultCallingConvention(self.handle) if cc_handle is None: return None return callingconvention.CallingConvention(handle=cc_handle) - def set_default_calling_convention(self, cc: 'callingconvention.CallingConvention'): + @default_calling_convention.setter + def default_calling_convention(self, cc: 'callingconvention.CallingConvention'): core.BNSetArchitectureDefaultCallingConvention(self.handle, cc.handle) - def get_cdecl_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + @property + def cdecl_calling_convention(self): + """ + Cdecl calling convention. + + .. note:: Make sure the calling convention has been registered with `Architecture.register_calling_convention`. + + :getter: returns a CallingConvention object for the cdecl calling convention, if one exists. + :setter: sets the cdecl calling convention + :type: Optional['callingconvention.CallingConvention'] + """ cc_handle = core.BNGetArchitectureCdeclCallingConvention(self.handle) if cc_handle is None: return None return callingconvention.CallingConvention(handle=cc_handle) - def set_cdecl_calling_convention(self, cc: 'callingconvention.CallingConvention'): + @cdecl_calling_convention.setter + def cdecl_calling_convention(self, cc: 'callingconvention.CallingConvention'): core.BNSetArchitectureCdeclCallingConvention(self.handle, cc.handle) - def get_stdcall_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + @property + def stdcall_calling_convention(self): + """ + Stdcall calling convention. + + .. note:: Make sure the calling convention has been registered with `Architecture.register_calling_convention`. + + :getter: returns a CallingConvention object for the stdcall calling convention, if one exists. + :setter: sets the stdcall calling convention + :type: Optional['callingconvention.CallingConvention'] + """ cc_handle = core.BNGetArchitectureStdcallCallingConvention(self.handle) if cc_handle is None: return None return callingconvention.CallingConvention(handle=cc_handle) - def set_stdcall_calling_convention(self, cc: 'callingconvention.CallingConvention'): + @stdcall_calling_convention.setter + def stdcall_calling_convention(self, cc: 'callingconvention.CallingConvention'): core.BNSetArchitectureStdcallCallingConvention(self.handle, cc.handle) - def get_fastcall_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + @property + def fastcall_calling_convention(self): + """ + Fastcall calling convention. + + .. note:: Make sure the calling convention has been registered with `Architecture.register_calling_convention`. + + :getter: returns a CallingConvention object for the fastcall calling convention, if one exists. + :setter: sets the fastcall calling convention + :type: Optional['callingconvention.CallingConvention'] + """ cc_handle = core.BNGetArchitectureFastcallCallingConvention(self.handle) if cc_handle is None: return None return callingconvention.CallingConvention(handle=cc_handle) - def set_fastcall_calling_convention(self, cc: 'callingconvention.CallingConvention'): + @fastcall_calling_convention.setter + def fastcall_calling_convention(self, cc: 'callingconvention.CallingConvention'): core.BNSetArchitectureFastcallCallingConvention(self.handle, cc.handle) -- cgit v1.3.1