def ilistdir_ex(path="."): dir = opendir_(path) if not dir: raise_error() res = [] dirent_fmt = "LLHB256s" while True: dirent = readdir_(dir) if not dirent: break dirent = ffi.as_bytearray(dirent, struct.calcsize(dirent_fmt)) dirent = struct.unpack(dirent_fmt, dirent) yield dirent
def cmp(pa, pb): a = ffi.as_bytearray(pa, 1) b = ffi.as_bytearray(pb, 1) # print("cmp:", a, b) return a[0] - b[0]
def cmp(pa, pb): a = ffi.as_bytearray(pa, 1) b = ffi.as_bytearray(pb, 1) #print("cmp:", a, b) return a[0] - b[0]
def errno_(val=None): if val is None: p = __errno() buf = ffi.as_bytearray(p, 4) return int.from_bytes(buf) raise NotImplementedError