コード例 #1
0
ファイル: test_ll_termios.py プロジェクト: sota/pypy-old
 def runs_tcgetattr():
     fd = os.open('.', 0, 0777)
     try:
         rtermios.tcgetattr(fd)
     except OSError, e:
         assert e.errno == errno.ENOTTY
         print "ok"
コード例 #2
0
ファイル: test_rtermios.py プロジェクト: mozillazg/pypy
 def runs_tcgetattr():
     fd = os.open('.', 0, 0777)
     try:
         rtermios.tcgetattr(fd)
     except OSError as e:
         assert e.errno == errno.ENOTTY
         print "ok"
コード例 #3
0
ファイル: test_rtermios.py プロジェクト: mozillazg/pypy
 def runs_tcsetattr():
     tp = rtermios.tcgetattr(2)
     a, b, c, d, e, f, g = tp
     rtermios.tcsetattr(2, rtermios.TCSANOW, (a, b, c, d, e, f, g))
     time.sleep(.1)
     tp = rtermios.tcgetattr(2)
     assert tp[5] == f
     print "ok"
コード例 #4
0
ファイル: test_ll_termios.py プロジェクト: sota/pypy-old
 def runs_tcsetattr():
     tp = rtermios.tcgetattr(2)
     a, b, c, d, e, f, g = tp
     rtermios.tcsetattr(2, rtermios.TCSANOW, (a, b, c, d, e, f, g))
     time.sleep(.1)
     tp = rtermios.tcgetattr(2)
     assert tp[5] == f
     print "ok"
コード例 #5
0
ファイル: test_rtermios.py プロジェクト: mozillazg/pypy
 def f():
     from rpython.rlib import rtermios
     import termios
     def check(fd, when, attributes):
         count = len([i for i in attributes[-1] if isinstance(i, int)])
         assert count == 2
     termios.tcsetattr = check
     attr = list(rtermios.tcgetattr(2))
     attr[3] |= termios.ICANON
     rtermios.tcsetattr(2, termios.TCSANOW, attr)
コード例 #6
0
ファイル: test_ll_termios.py プロジェクト: sota/pypy-old
        def f():
            from rpython.rlib import rtermios
            import termios

            def check(fd, when, attributes):
                count = len([i for i in attributes[-1] if isinstance(i, int)])
                assert count == 2

            termios.tcsetattr = check
            attr = list(rtermios.tcgetattr(2))
            attr[3] |= termios.ICANON
            rtermios.tcsetattr(2, termios.TCSANOW, attr)
コード例 #7
0
 def method_tcsetattr(self, space, fd):
     try:
         mode = tcgetattr(fd)
     except OSError as e:
         raise error_for_oserror(space, e)
     mode_w = [
         space.newint(mode[0]),  # iflag
         space.newint(mode[1]),  # oflag
         space.newint(mode[2]),  # cflag
         space.newint(mode[3]),  # lflag
         space.newint(mode[4]),  # ispeed
         space.newint(mode[5]),  # ospeed
         space.newarray([space.newstr_fromstr(cc) for cc in mode[6]])
     ]
     return space.newarray(mode_w)
コード例 #8
0
ファイル: topaz.py プロジェクト: topazproject/topaz
 def method_tcgetattr(self, space, fd):
     try:
         mode = tcgetattr(fd)
     except OSError as e:
         raise error_for_oserror(space, e)
     mode_w = [
         space.newint(mode[0]),  # iflag
         space.newint(mode[1]),  # oflag
         space.newint(mode[2]),  # cflag
         space.newint(mode[3]),  # lflag
         space.newint(mode[4]),  # ispeed
         space.newint(mode[5]),  # ospeed
         space.newarray([space.newstr_fromstr(cc) for cc in mode[6]])
     ]
     return space.newarray(mode_w)
コード例 #9
0
def tcgetattr(space, w_fd):
    fd = space.c_filedescriptor_w(w_fd)
    try:
        tup = rtermios.tcgetattr(fd)
    except OSError as e:
        raise convert_error(space, e)
    iflag, oflag, cflag, lflag, ispeed, ospeed, cc = tup
    l_w = [space.newint(i) for i in [iflag, oflag, cflag, lflag, ispeed, ospeed]]
    # last one need to be chosen carefully
    cc_w = [space.newbytes(i) for i in cc]
    if lflag & rtermios.ICANON:
        cc_w[rtermios.VMIN] = space.newint(ord(cc[rtermios.VMIN][0]))
        cc_w[rtermios.VTIME] = space.newint(ord(cc[rtermios.VTIME][0]))
    w_cc = space.newlist(cc_w)
    l_w.append(w_cc)
    return space.newlist(l_w)
コード例 #10
0
ファイル: interp_termios.py プロジェクト: mozillazg/pypy
def tcgetattr(space, w_fd):
    fd = space.c_filedescriptor_w(w_fd)
    try:
        tup = rtermios.tcgetattr(fd)
    except OSError as e:
        raise convert_error(space, e)
    iflag, oflag, cflag, lflag, ispeed, ospeed, cc = tup
    l_w = [space.wrap(i) for i in [iflag, oflag, cflag, lflag, ispeed, ospeed]]
    # last one need to be chosen carefully
    cc_w = [space.wrap(i) for i in cc]
    if lflag & rtermios.ICANON:
        cc_w[rtermios.VMIN] = space.wrap(ord(cc[rtermios.VMIN][0]))
        cc_w[rtermios.VTIME] = space.wrap(ord(cc[rtermios.VTIME][0]))
    w_cc = space.newlist(cc_w)
    l_w.append(w_cc)
    return space.newlist(l_w)
コード例 #11
0
def tcgetattr(space, w_fd):
    fd = space.c_filedescriptor_w(w_fd)
    try:
        tup = rtermios.tcgetattr(fd)
    except OSError, e:
        raise convert_error(space, e)
コード例 #12
0
ファイル: interp_termios.py プロジェクト: Darriall/pypy
def tcgetattr(space, w_fd):
    fd = space.c_filedescriptor_w(w_fd)
    try:
        tup = rtermios.tcgetattr(fd)
    except OSError, e:
        raise convert_error(space, e)
コード例 #13
0
ファイル: test_rtermios.py プロジェクト: mozillazg/pypy
 def runs_tcgetattr():
     tpl = list(rtermios.tcgetattr(2)[:-1])
     return str(tpl)
コード例 #14
0
ファイル: test_ll_termios.py プロジェクト: sota/pypy-old
 def runs_tcgetattr():
     tpl = list(rtermios.tcgetattr(2)[:-1])
     return str(tpl)