1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(termios_tcgetattr__doc__,
"tcgetattr($module, fd, /)\n"
"--\n"
"\n"
"Get the tty attributes for file descriptor fd.\n"
"\n"
"Returns a list [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]\n"
"where cc is a list of the tty special characters (each a string of\n"
"length 1, except the items with indices VMIN and VTIME, which are\n"
"integers when these fields are defined). The interpretation of the\n"
"flags and the speeds as well as the indexing in the cc array must be\n"
"done using the symbolic constants defined in this module.");
#define TERMIOS_TCGETATTR_METHODDEF \
{"tcgetattr", (PyCFunction)termios_tcgetattr, METH_O, termios_tcgetattr__doc__},
static PyObject *
termios_tcgetattr_impl(PyObject *module, int fd);
static PyObject *
termios_tcgetattr(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int fd;
fd = PyObject_AsFileDescriptor(arg);
if (fd < 0) {
goto exit;
}
return_value = termios_tcgetattr_impl(module, fd);
exit:
return return_value;
}
PyDoc_STRVAR(termios_tcsetattr__doc__,
"tcsetattr($module, fd, when, attributes, /)\n"
"--\n"
"\n"
"Set the tty attributes for file descriptor fd.\n"
"\n"
"The attributes to be set are taken from the attributes argument, which\n"
"is a list like the one returned by tcgetattr(). The when argument\n"
"determines when the attributes are changed: termios.TCSANOW to\n"
"change immediately, termios.TCSADRAIN to change after transmitting all\n"
"queued output, or termios.TCSAFLUSH to change after transmitting all\n"
"queued output and discarding all queued input.");
#define TERMIOS_TCSETATTR_METHODDEF \
{"tcsetattr", (PyCFunction)(void(*)(void))termios_tcsetattr, METH_FASTCALL, termios_tcsetattr__doc__},
static PyObject *
termios_tcsetattr_impl(PyObject *module, int fd, int when, PyObject *term);
static PyObject *
termios_tcsetattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int when;
PyObject *term;
if (nargs != 3) {
PyErr_Format(PyExc_TypeError, "tcsetattr expected 3 arguments, got %zd", nargs);
goto exit;
}
fd = PyObject_AsFileDescriptor(args[0]);
if (fd < 0) {
goto exit;
}
when = PyLong_AsInt(args[1]);
if (when == -1 && PyErr_Occurred()) {
goto exit;
}
term = args[2];
return_value = termios_tcsetattr_impl(module, fd, when, term);
exit:
return return_value;
}
PyDoc_STRVAR(termios_tcsendbreak__doc__,
"tcsendbreak($module, fd, duration, /)\n"
"--\n"
"\n"
"Send a break on file descriptor fd.\n"
"\n"
"A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n"
"has a system dependent meaning.");
#define TERMIOS_TCSENDBREAK_METHODDEF \
{"tcsendbreak", (PyCFunction)(void(*)(void))termios_tcsendbreak, METH_FASTCALL, termios_tcsendbreak__doc__},
static PyObject *
termios_tcsendbreak_impl(PyObject *module, int fd, int duration);
static PyObject *
termios_tcsendbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int duration;
if (nargs != 2) {
PyErr_Format(PyExc_TypeError, "tcsendbreak expected 2 arguments, got %zd", nargs);
goto exit;
}
fd = PyObject_AsFileDescriptor(args[0]);
if (fd < 0) {
goto exit;
}
duration = PyLong_AsInt(args[1]);
if (duration == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = termios_tcsendbreak_impl(module, fd, duration);
exit:
return return_value;
}
PyDoc_STRVAR(termios_tcdrain__doc__,
"tcdrain($module, fd, /)\n"
"--\n"
"\n"
"Wait until all output written to file descriptor fd has been transmitted.");
#define TERMIOS_TCDRAIN_METHODDEF \
{"tcdrain", (PyCFunction)termios_tcdrain, METH_O, termios_tcdrain__doc__},
static PyObject *
termios_tcdrain_impl(PyObject *module, int fd);
static PyObject *
termios_tcdrain(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int fd;
fd = PyObject_AsFileDescriptor(arg);
if (fd < 0) {
goto exit;
}
return_value = termios_tcdrain_impl(module, fd);
exit:
return return_value;
}
PyDoc_STRVAR(termios_tcflush__doc__,
"tcflush($module, fd, queue, /)\n"
"--\n"
"\n"
"Discard queued data on file descriptor fd.\n"
"\n"
"The queue selector specifies which queue: termios.TCIFLUSH for the input\n"
"queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for\n"
"both queues.");
#define TERMIOS_TCFLUSH_METHODDEF \
{"tcflush", (PyCFunction)(void(*)(void))termios_tcflush, METH_FASTCALL, termios_tcflush__doc__},
static PyObject *
termios_tcflush_impl(PyObject *module, int fd, int queue);
static PyObject *
termios_tcflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int queue;
if (nargs != 2) {
PyErr_Format(PyExc_TypeError, "tcflush expected 2 arguments, got %zd", nargs);
goto exit;
}
fd = PyObject_AsFileDescriptor(args[0]);
if (fd < 0) {
goto exit;
}
queue = PyLong_AsInt(args[1]);
if (queue == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = termios_tcflush_impl(module, fd, queue);
exit:
return return_value;
}
PyDoc_STRVAR(termios_tcflow__doc__,
"tcflow($module, fd, action, /)\n"
"--\n"
"\n"
"Suspend or resume input or output on file descriptor fd.\n"
"\n"
"The action argument can be termios.TCOOFF to suspend output,\n"
"termios.TCOON to restart output, termios.TCIOFF to suspend input,\n"
"or termios.TCION to restart input.");
#define TERMIOS_TCFLOW_METHODDEF \
{"tcflow", (PyCFunction)(void(*)(void))termios_tcflow, METH_FASTCALL, termios_tcflow__doc__},
static PyObject *
termios_tcflow_impl(PyObject *module, int fd, int action);
static PyObject *
termios_tcflow(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
int action;
if (nargs != 2) {
PyErr_Format(PyExc_TypeError, "tcflow expected 2 arguments, got %zd", nargs);
goto exit;
}
fd = PyObject_AsFileDescriptor(args[0]);
if (fd < 0) {
goto exit;
}
action = PyLong_AsInt(args[1]);
if (action == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = termios_tcflow_impl(module, fd, action);
exit:
return return_value;
}
PyDoc_STRVAR(termios_tcgetwinsize__doc__,
"tcgetwinsize($module, fd, /)\n"
"--\n"
"\n"
"Get the tty winsize for file descriptor fd.\n"
"\n"
"Returns a tuple (ws_row, ws_col).");
#define TERMIOS_TCGETWINSIZE_METHODDEF \
{"tcgetwinsize", (PyCFunction)termios_tcgetwinsize, METH_O, termios_tcgetwinsize__doc__},
static PyObject *
termios_tcgetwinsize_impl(PyObject *module, int fd);
static PyObject *
termios_tcgetwinsize(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
int fd;
fd = PyObject_AsFileDescriptor(arg);
if (fd < 0) {
goto exit;
}
return_value = termios_tcgetwinsize_impl(module, fd);
exit:
return return_value;
}
PyDoc_STRVAR(termios_tcsetwinsize__doc__,
"tcsetwinsize($module, fd, winsize, /)\n"
"--\n"
"\n"
"Set the tty winsize for file descriptor fd.\n"
"\n"
"The winsize to be set is taken from the winsize argument, which\n"
"is a two-item tuple (ws_row, ws_col) like the one returned by tcgetwinsize().");
#define TERMIOS_TCSETWINSIZE_METHODDEF \
{"tcsetwinsize", (PyCFunction)(void(*)(void))termios_tcsetwinsize, METH_FASTCALL, termios_tcsetwinsize__doc__},
static PyObject *
termios_tcsetwinsize_impl(PyObject *module, int fd, PyObject *winsz);
static PyObject *
termios_tcsetwinsize(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int fd;
PyObject *winsz;
if (nargs != 2) {
PyErr_Format(PyExc_TypeError, "tcsetwinsize expected 2 arguments, got %zd", nargs);
goto exit;
}
fd = PyObject_AsFileDescriptor(args[0]);
if (fd < 0) {
goto exit;
}
winsz = args[1];
return_value = termios_tcsetwinsize_impl(module, fd, winsz);
exit:
return return_value;
}
/*[clinic end generated code: output=c6c6192583b0da36 input=a9049054013a1b77]*/
|