def getSourceInfo(self)->SourceInfo: libsrcinfo = _LibSourceInfo() sourceinfo_p = byref(libsrcinfo) get_lib().ucis_GetScopeSourceInfo(self.db, self.obj, sourceinfo_p) return LibSourceInfo.ctor(self.db, libsrcinfo)
def __next__(self): next = get_lib().ucis_HistoryScan(self.db, self.iter) if next is None: get_lib().ucis_FreeIterator(self.iter) raise StopIteration return LibHistoryNode(self.db, next)
def __next__(self): from ucis.ucdb.ucdb_scope import LibScope next = get_lib().ucis_ScopeScan(self.db, self.iter) if next is None: get_lib().ucis_FreeIterator(self.db, self.iter) raise StopIteration return LibScope(self.db, next)
def createScope(self, name:str, srcinfo:SourceInfo, weight:int, source, type, flags): srcinfo_p = None if srcinfo is None else byref(_LibSourceInfo.ctor(srcinfo)) print("createScope: db=" + str(self.db) + " obj=" + str(self.obj) + " name=" + str(name) + " srcinfo_p=" + str(srcinfo_p) + " weight=" + str(weight) + "source=" + hex(source) + " type=" + hex(type) + " flags=" + hex(flags)); sh = get_lib().ucis_CreateScope( self.db, self.obj, None if name is None else str.encode(name), srcinfo_p, weight, source, type, flags) if sh is None: print("Error: createScope failed: parent=" + str(self.obj)) raise Exception("Failed to create scope") return LibScope(self.db, sh)
def createInstance(self, name : str, fileinfo : SourceInfo, weight : int, source : SourceT, type : ScopeTypeT, du_scope : Scope, flags : FlagsT): fileinfo_p = None if fileinfo is None else byref(_LibSourceInfo.ctor(fileinfo)) sh = get_lib().ucis_CreateInstance( self.db, self.obj, str.encode(name), fileinfo_p, weight, source, type, du_scope.obj, flags) if sh is None: print("Error: ucis_CreateInstance failed: du=" + str(du_scope) + " du.obj=" + str(du_scope.obj)) raise Exception("ucis_CreateInstance failed") return LibScope(self.db, sh)
def __init__(self, file: str = None, db=None): if db is None: db = get_lib().ucis_Open( str.encode(file) if file is not None else None) if db is None: if file is not None: raise Exception("Error: failed to open UCIS file \"" + file + "\"") else: raise Exception("Error: failed to create UCIS DB") super().__init__(db, None)
def createHistoryNode(self, parent, logicalname, physicalname, kind) -> 'HistoryNode': print("--> createHistoryNode") print(" db=" + str(self.db)) print(" parent=" + str(parent)) print(" logicalname=" + str(logicalname)) print(" physicalname=" + str(physicalname)) print(" kind=" + str(kind)) hn = get_lib().ucis_CreateHistoryNode(self.db, parent, str.encode(logicalname), str.encode(physicalname), kind) print("hn=" + str(hn)) print("<-- createHistoryNode") return LibHistoryNode(self.db, hn)
def createNextCover(self, name : str, data : CoverData, sourceinfo : SourceInfo) -> int: sourceinfo_p = None if sourceinfo is None else byref(_LibSourceInfo.ctor(sourceinfo)) data_p = byref(LibCoverData.ctor(data)) index = get_lib().ucis_CreateNextCover( self.db, self.obj, str.encode(name), data_p, sourceinfo_p) return LibCoverIndex(self.db, self.obj, index)
def createToggle(self, name : str, canonical_name : str, flags : FlagsT, toggle_metric : ToggleMetricT, toggle_type : ToggleTypeT, toggle_dir : ToggleDirT) -> 'Scope': th = get_lib().ucis_CreateToggle( self.db, self.obj, str.encode(name), None if canonical_name is None else str.encode(canonical_name), flags, toggle_metric, toggle_type, toggle_dir) return LibScope(self.db, th)
def createCovergroup(self, name:str, srcinfo:SourceInfo, weight:int, source) -> 'Covergroup': from ucis.lib.lib_covergroup import LibCovergroup srcinfo_p = None if srcinfo is None else pointer(_LibSourceInfo.ctor(srcinfo)) cg_obj = get_lib().ucis_CreateScope( self.db, self.obj, str.encode(name), srcinfo_p, weight, source, UCIS_COVERGROUP, 0) return LibCovergroup(self.db, cg_obj)
def createFileHandle(self, filename, workdir) -> FileHandle: fh = get_lib().ucis_CreateFileHandle( self.db, str.encode(filename), None if workdir is None else str.encode(workdir)) return LibFileHandle(self.db, fh)
def getNumTests(self): return get_lib().ucis_GetIntProperty(self.db, -1, IntProperty.NUM_TESTS)
def modifiedSinceSim(self): return get_lib().ucis_GetIntProperty( self.db, -1, IntProperty.MODIFIED_SINCE_SIM) == 1
def isModified(self): return get_lib().ucis_GetIntProperty(self.db, -1, IntProperty.IS_MODIFIED) == 1
def getFileName(self)->str: return get_lib().ucis_GetFileName(self.db, self.fh)
def close(self): ret = get_lib().ucis_Close(self.db) print("close ret=" + str(ret))
def __init__(self, db, hist_obj, kind): self.db = db self.iter = get_lib().ucis_HistoryIterate(self.db, hist_obj, kind)
def __init__(self, db, scope, mask: ScopeTypeT): self.db = db self.iter = get_lib().ucis_ScopeIterate(db, scope, mask)
def setIntProperty(self, coverindex: int, property: IntProperty, value: int): obj = self.db if self.obj is None else self.obj get_lib().ucis_SetIntProperty(self.db, obj, coverindex, property, value)
def getTestData(self): lib_td = pointer(LibTestData()) get_lib().ucis_SetTestData(self.db, self.obj, lib_td) return lib_td.to_testdata()
def setStringProperty(self, coverindex: int, property: StrProperty, value: str): obj = self.db if self.obj is None else self.obj get_lib().ucis_SetStringProperty(self.db, obj, coverindex, property, str.encode(value))
def write(self, file, scope=None, recurse=True, covertype=-1): print("file=" + file) ret = get_lib().ucis_Write(self.db, str.encode(file), scope, 1 if recurse else 0, covertype) print("ret=" + str(ret))
def setTestData(self, testdata: TestData): lib_td = pointer(LibTestData.ctor(testdata)) get_lib().ucis_SetTestData(self.db, self.obj, lib_td)