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 | termios_tcgetattr(PyObject *module, PyObject *arg) |
26 | { |
27 | PyObject *return_value = NULL; |
28 | int fd; |
29 | |
30 | if (!_PyLong_FileDescriptor_Converter(arg, &fd)) { |
31 | goto exit; |
32 | } |
33 | return_value = termios_tcgetattr_impl(module, fd); |
34 | |
35 | exit: |
36 | 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)(void(*)(void))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 | termios_tcsetattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
60 | { |
61 | PyObject *return_value = NULL; |
62 | int fd; |
63 | int when; |
64 | PyObject *term; |
65 | |
66 | if (!_PyArg_CheckPositional("tcsetattr" , nargs, 3, 3)) { |
67 | goto exit; |
68 | } |
69 | if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) { |
70 | goto exit; |
71 | } |
72 | when = _PyLong_AsInt(args[1]); |
73 | if (when == -1 && PyErr_Occurred()) { |
74 | goto exit; |
75 | } |
76 | term = args[2]; |
77 | return_value = termios_tcsetattr_impl(module, fd, when, term); |
78 | |
79 | exit: |
80 | 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)(void(*)(void))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 | termios_tcsendbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
100 | { |
101 | PyObject *return_value = NULL; |
102 | int fd; |
103 | int duration; |
104 | |
105 | if (!_PyArg_CheckPositional("tcsendbreak" , nargs, 2, 2)) { |
106 | goto exit; |
107 | } |
108 | if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) { |
109 | goto exit; |
110 | } |
111 | duration = _PyLong_AsInt(args[1]); |
112 | if (duration == -1 && PyErr_Occurred()) { |
113 | goto exit; |
114 | } |
115 | return_value = termios_tcsendbreak_impl(module, fd, duration); |
116 | |
117 | exit: |
118 | 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 | termios_tcdrain(PyObject *module, PyObject *arg) |
135 | { |
136 | PyObject *return_value = NULL; |
137 | int fd; |
138 | |
139 | if (!_PyLong_FileDescriptor_Converter(arg, &fd)) { |
140 | goto exit; |
141 | } |
142 | return_value = termios_tcdrain_impl(module, fd); |
143 | |
144 | exit: |
145 | 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)(void(*)(void))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 | termios_tcflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
166 | { |
167 | PyObject *return_value = NULL; |
168 | int fd; |
169 | int queue; |
170 | |
171 | if (!_PyArg_CheckPositional("tcflush" , nargs, 2, 2)) { |
172 | goto exit; |
173 | } |
174 | if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) { |
175 | goto exit; |
176 | } |
177 | queue = _PyLong_AsInt(args[1]); |
178 | if (queue == -1 && PyErr_Occurred()) { |
179 | goto exit; |
180 | } |
181 | return_value = termios_tcflush_impl(module, fd, queue); |
182 | |
183 | exit: |
184 | 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)(void(*)(void))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 | termios_tcflow(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
205 | { |
206 | PyObject *return_value = NULL; |
207 | int fd; |
208 | int action; |
209 | |
210 | if (!_PyArg_CheckPositional("tcflow" , nargs, 2, 2)) { |
211 | goto exit; |
212 | } |
213 | if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) { |
214 | goto exit; |
215 | } |
216 | action = _PyLong_AsInt(args[1]); |
217 | if (action == -1 && PyErr_Occurred()) { |
218 | goto exit; |
219 | } |
220 | return_value = termios_tcflow_impl(module, fd, action); |
221 | |
222 | exit: |
223 | return return_value; |
224 | } |
225 | /*[clinic end generated code: output=a129179f1e2545cc input=a9049054013a1b77]*/ |
226 | |