diff options
Diffstat (limited to 'pyGHDL/libghdl')
-rw-r--r-- | pyGHDL/libghdl/errorout_memory.py | 5 | ||||
-rw-r--r-- | pyGHDL/libghdl/name_table.py | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/pyGHDL/libghdl/errorout_memory.py b/pyGHDL/libghdl/errorout_memory.py index f9977ec27..444c53e80 100644 --- a/pyGHDL/libghdl/errorout_memory.py +++ b/pyGHDL/libghdl/errorout_memory.py @@ -79,13 +79,12 @@ def Get_Error_Record(Idx: ErrorIndex): # FIXME: returns Error_Message @export -def Get_Error_Message(Idx: ErrorIndex) -> str: # FIXME: check '*_addr' vs string return value +def Get_Error_Message(Idx: ErrorIndex) -> str: func = libghdl.errorout__memory__get_error_message_addr func.argstype = [c_int32] func.restype = c_char_p - # FIXME: don't we need to encode to utf-8? - return func(Idx) + return func(Idx).decode("utf-8") @export diff --git a/pyGHDL/libghdl/name_table.py b/pyGHDL/libghdl/name_table.py index b82207fb3..72b6dfd8c 100644 --- a/pyGHDL/libghdl/name_table.py +++ b/pyGHDL/libghdl/name_table.py @@ -56,7 +56,7 @@ def Get_Name_Length(Id: NameId) -> int: @export -def Get_Name_Ptr(Id: NameId) -> bytes: +def Get_Name_Ptr(Id: NameId) -> str: """ Get the address of the first character of ID. The address is valid until the next call to Get_Identifier (which may reallocate the string table). @@ -67,8 +67,8 @@ def Get_Name_Ptr(Id: NameId) -> bytes: """ func = libghdl.name_table__get_name_ptr func.restype = c_char_p - # FIXME: don't we need to encode to utf-8? - return func(Id) + + return func(Id).decode("utf-8") @export @@ -76,9 +76,11 @@ def Get_Identifier(string: str) -> NameId: """ Get or create an entry in the name table. - Note: - * an identifier is represented in all lower case letter, - * an extended identifier is represented in backslashes, double internal backslashes are simplified. + .. note:: + + * an identifier is represented in all lower case letter, + * an extended identifier is represented in backslashes, double internal + backslashes are simplified. :param string: String to create or lookup. :return: Id in name table. |