def GetModeOfNode(node: Iir) -> Mode: """Return the mode of a :obj:`node`.""" if node == Null_Iir: raise ValueError("GetModeOfNode: Parameter 'node' must not be 'Null_iir'.") try: return __MODE_TRANSLATION[nodes.Get_Mode(node)] except KeyError: raise LibGHDLException("Unknown mode.")
def inner(*args): try: return functionPointer(*args) except OSError as ex: errors = [str(ex)] raise LibGHDLException( "Caught exception when calling '{func}' in libghdl.". format(func=subprogramName), errors, ) from ex
def CheckForErrors() -> None: errorCount = errorout_memory.Get_Nbr_Messages() errors = [] if errorCount != 0: for i in range(errorCount): rec = errorout_memory.Get_Error_Record(i + 1) # FIXME: needs help from @tgingold fileName = "" # name_table.Get_Name_Ptr(files_map.Get_File_Name(rec.file)) message = errorout_memory.Get_Error_Message(i + 1) errors.append( "{file}:{line}:{column}: {msg}".format(file=fileName, line=rec.line, column=rec.offset, msg=message) ) raise DOMException("Error raised in libghdl.") from LibGHDLException("libghdl: Internal error.", errors)
def __ghdl_init(self): """Initialization: set options and then load libraries.""" # Initialize libghdl libghdl_finalize() libghdl_initialize() # Collect error messages in memory errorout_memory.Install_Handler() libghdl_set_option("--std=08") parse.Flag_Parse_Parenthesis.value = True # Finish initialization. This will load the standard package. if libghdl_analyze_init_status() != 0: raise LibGHDLException("Error initializing 'libghdl'.")