diff options
Diffstat (limited to 'pyGHDL/libghdl/errorout_memory.py')
-rw-r--r-- | pyGHDL/libghdl/errorout_memory.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/pyGHDL/libghdl/errorout_memory.py b/pyGHDL/libghdl/errorout_memory.py index d4cbaeed9..5187d5e3c 100644 --- a/pyGHDL/libghdl/errorout_memory.py +++ b/pyGHDL/libghdl/errorout_memory.py @@ -6,9 +6,9 @@ # | .__/ \__, |\____|_| |_|____/|_____(_)_|_|_.__/ \__, |_| |_|\__,_|_| # |_| |___/ |___/ # ============================================================================= -# Authors: -# Tristan Gingold -# Patrick Lehmann +# Authors: +# Tristan Gingold +# Patrick Lehmann # # Package package: Python binding and low-level API for shared library 'libghdl'. # @@ -36,8 +36,8 @@ from ctypes import c_int8, c_int32, c_char_p, Structure from pydecor import export -from pyGHDL.libghdl import libghdl from pyGHDL.libghdl._types import ErrorIndex +from pyGHDL.libghdl._decorator import BindToLibGHDL @export @@ -81,22 +81,23 @@ Msg_Last = 3 @export +@BindToLibGHDL("errorout__memory__install_handler") def Install_Handler() -> None: """Install the handlers for reporting errors.""" - libghdl.errorout__memory__install_handler() @export +@BindToLibGHDL("errorout__memory__get_nbr_messages") def Get_Nbr_Messages() -> ErrorIndex: """ Get number of error messages available. :return: Number of messages available. """ - return libghdl.errorout__memory__get_nbr_messages() @export +@BindToLibGHDL("errorout__memory__get_error_record") def Get_Error_Record(Idx: ErrorIndex) -> Error_Message: """ Get error messages by index :obj:`Idy` as structure :class:`Error_Message`. @@ -104,29 +105,25 @@ def Get_Error_Record(Idx: ErrorIndex) -> Error_Message: :param Idx: Index from 1 to ``Nbr_Messages`` See :func:`Get_Nbr_Messages`. :return: Type: ``Error_Message`` """ - func = libghdl.errorout__memory__get_error_record - func.argstypes = [c_int32] - func.restype = Error_Message - return func(Idx) +#@export +@BindToLibGHDL("errorout__memory__get_error_message_addr") +def _Get_Error_Message(Idx: ErrorIndex) -> c_char_p: + pass @export def Get_Error_Message(Idx: ErrorIndex) -> str: """ - Get error messages by index :obj:`Idy` as string. + Get error messages by index :obj:`Idx` as string. :param Idx: Index from 1 to ``Nbr_Messages`` See :func:`Get_Nbr_Messages`. - :return: Type: ``Error_Message`` + :return: Error message. """ - func = libghdl.errorout__memory__get_error_message_addr - func.argstype = [c_int32] - func.restype = c_char_p - - return func(Idx).decode("utf-8") + return _Get_Error_Message(Idx).decode("utf-8") @export +@BindToLibGHDL("errorout__memory__clear_errors") def Clear_Errors() -> None: """Remove all error messages.""" - libghdl.errorout__memory__clear_errors() |