Example #1
0
def tigetstr(capname):
    _ensure_initialised_setupterm()
    if isinstance(capname, unicode):
        capname = capname.encode('ascii')
    val = lib.tigetstr(capname)
    if int(ffi.cast("intptr_t", val)) in (0, -1):
        return None
    return ffi.string(val)
Example #2
0
def tigetstr(capname):
    _ensure_initialised_setupterm()
    if isinstance(capname, unicode):
        capname = capname.encode('ascii')
    val = lib.tigetstr(capname)
    if int(ffi.cast("intptr_t", val)) in (0, -1):
        return None
    return ffi.string(val)
Example #3
0
def tparm(fmt, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0):
    args = [ffi.cast("int", i) for i in (i1, i2, i3, i4, i5, i6, i7, i8, i9)]
    # fmt is expected to be a byte string; CPython 3.x complains
    # "TypeError: 'str' does not support the buffer interface", but we
    # can do better.
    if isinstance(fmt, str):
        # error message modeled on "TypeError: must be str, not bytes"
        # that you get if you call curses.tigetstr(b'...') on CPython 3.x
        raise TypeError('must be bytes, not str')
    result = lib.tparm(fmt, *args)
    if result == ffi.NULL:
        raise error("tparm() returned NULL")
    return ffi.string(result)
Example #4
0
def tparm(fmt, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0):
    args = [ffi.cast("int", i) for i in (i1, i2, i3, i4, i5, i6, i7, i8, i9)]
    # fmt is expected to be a byte string; CPython 3.x complains
    # "TypeError: 'str' does not support the buffer interface", but we
    # can do better.
    if isinstance(fmt, str):
        # error message modeled on "TypeError: must be str, not bytes"
        # that you get if you call curses.tigetstr(b'...') on CPython 3.x
        raise TypeError('must be bytes, not str')
    result = lib.tparm(fmt, *args)
    if result == ffi.NULL:
        raise error("tparm() returned NULL")
    return ffi.string(result)
Example #5
0
def _chtype(ch):
    return int(ffi.cast("chtype", ch))
Example #6
0
def tparm(fmt, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0):
    args = [ffi.cast("int", i) for i in (i1, i2, i3, i4, i5, i6, i7, i8, i9)]
    result = lib.tparm(fmt, *args)
    if result == ffi.NULL:
        raise error("tparm() returned NULL")
    return ffi.string(result)
Example #7
0
def _chtype(ch):
    return int(ffi.cast("chtype", ch))
Example #8
0
def tigetstr(capname):
    _ensure_initialised_setupterm()
    val = lib.tigetstr(capname.encode())
    if int(ffi.cast("intptr_t", val)) in (0, -1):
        return None
    return ffi.string(val)
Example #9
0
def tparm(fmt, i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0):
    args = [ffi.cast("int", i) for i in (i1, i2, i3, i4, i5, i6, i7, i8, i9)]
    result = lib.tparm(fmt, *args)
    if result == ffi.NULL:
        raise error("tparm() returned NULL")
    return ffi.string(result)
Example #10
0
def tigetstr(capname):
    _ensure_initialised_setupterm()
    val = lib.tigetstr(capname)
    if int(ffi.cast("intptr_t", val)) in (0, -1):
        return None
    return ffi.string(val)