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