| 1 | from pypy.interpreter.mixedmodule import MixedModule |
| 2 | |
| 3 | from rpython.rlib import rtermios |
| 4 | |
| 5 | class Module(MixedModule): |
| 6 | "This module provides an interface to the Posix calls for tty I/O control.\n\ |
| 7 | For a complete description of these calls, see the Posix or Unix manual\n\ |
| 8 | pages. It is only available for those Unix versions that support Posix\n\ |
| 9 | termios style tty I/O control.\n\ |
| 10 | \n\ |
| 11 | All functions in this module take a file descriptor fd as their first\n\ |
| 12 | argument. This can be an integer file descriptor, such as returned by\n\ |
| 13 | sys.stdin.fileno(), or a file object, such as sys.stdin itself." |
| 14 | |
| 15 | appleveldefs = { |
| 16 | } |
| 17 | |
| 18 | interpleveldefs = { |
| 19 | 'tcdrain' : 'interp_termios.tcdrain', |
| 20 | 'tcflow' : 'interp_termios.tcflow', |
| 21 | 'tcflush' : 'interp_termios.tcflush', |
| 22 | 'tcgetattr' : 'interp_termios.tcgetattr', |
| 23 | 'tcsendbreak' : 'interp_termios.tcsendbreak', |
| 24 | 'tcsetattr' : 'interp_termios.tcsetattr', |
| 25 | 'error' : 'space.fromcache(interp_termios.Cache).w_error', |
| 26 | 'tcgetwinsize': 'interp_termios.tcgetwinsize', |
| 27 | 'tcsetwinsize': 'interp_termios.tcsetwinsize', |
| 28 | } |
| 29 | |
| 30 | for name in rtermios.all_constants: |
| 31 | value = getattr(rtermios, name) |
| 32 | interpleveldefs[name] = "space.wrap(%s)" % value |