Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(msvcrt_heapmin__doc__, |
| 6 | "heapmin($module, /)\n" |
| 7 | "--\n" |
| 8 | "\n" |
| 9 | "Minimize the malloc() heap.\n" |
| 10 | "\n" |
| 11 | "Force the malloc() heap to clean itself up and return unused blocks\n" |
| 12 | "to the operating system. On failure, this raises OSError."); |
| 13 | |
| 14 | #define MSVCRT_HEAPMIN_METHODDEF \ |
| 15 | {"heapmin", (PyCFunction)msvcrt_heapmin, METH_NOARGS, msvcrt_heapmin__doc__}, |
| 16 | |
| 17 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 18 | msvcrt_heapmin_impl(PyObject *module); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 19 | |
| 20 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 21 | msvcrt_heapmin(PyObject *module, PyObject *Py_UNUSED(ignored)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 22 | { |
| 23 | return msvcrt_heapmin_impl(module); |
| 24 | } |
| 25 | |
| 26 | PyDoc_STRVAR(msvcrt_locking__doc__, |
| 27 | "locking($module, fd, mode, nbytes, /)\n" |
| 28 | "--\n" |
| 29 | "\n" |
| 30 | "Lock part of a file based on file descriptor fd from the C runtime.\n" |
| 31 | "\n" |
| 32 | "Raises IOError on failure. The locked region of the file extends from\n" |
| 33 | "the current file position for nbytes bytes, and may continue beyond\n" |
| 34 | "the end of the file. mode must be one of the LK_* constants listed\n" |
| 35 | "below. Multiple regions in a file may be locked at the same time, but\n" |
| 36 | "may not overlap. Adjacent regions are not merged; they must be unlocked\n" |
| 37 | "individually."); |
| 38 | |
| 39 | #define MSVCRT_LOCKING_METHODDEF \ |
| 40 | {"locking", (PyCFunction)msvcrt_locking, METH_VARARGS, msvcrt_locking__doc__}, |
| 41 | |
| 42 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 43 | msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 44 | |
| 45 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 46 | msvcrt_locking(PyObject *module, PyObject *args) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 47 | { |
| 48 | PyObject *return_value = NULL; |
| 49 | int fd; |
| 50 | int mode; |
| 51 | long nbytes; |
| 52 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 53 | if (!PyArg_ParseTuple(args, "iil:locking", |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 54 | &fd, &mode, &nbytes)) |
| 55 | goto exit; |
| 56 | return_value = msvcrt_locking_impl(module, fd, mode, nbytes); |
| 57 | |
| 58 | exit: |
| 59 | return return_value; |
| 60 | } |
| 61 | |
| 62 | PyDoc_STRVAR(msvcrt_setmode__doc__, |
| 63 | "setmode($module, fd, mode, /)\n" |
| 64 | "--\n" |
| 65 | "\n" |
| 66 | "Set the line-end translation mode for the file descriptor fd.\n" |
| 67 | "\n" |
| 68 | "To set it to text mode, flags should be os.O_TEXT; for binary, it\n" |
| 69 | "should be os.O_BINARY.\n" |
| 70 | "\n" |
| 71 | "Return value is the previous mode."); |
| 72 | |
| 73 | #define MSVCRT_SETMODE_METHODDEF \ |
| 74 | {"setmode", (PyCFunction)msvcrt_setmode, METH_VARARGS, msvcrt_setmode__doc__}, |
| 75 | |
| 76 | static long |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 77 | msvcrt_setmode_impl(PyObject *module, int fd, int flags); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 78 | |
| 79 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 80 | msvcrt_setmode(PyObject *module, PyObject *args) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 81 | { |
| 82 | PyObject *return_value = NULL; |
| 83 | int fd; |
| 84 | int flags; |
| 85 | long _return_value; |
| 86 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 87 | if (!PyArg_ParseTuple(args, "ii:setmode", |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 88 | &fd, &flags)) |
| 89 | goto exit; |
| 90 | _return_value = msvcrt_setmode_impl(module, fd, flags); |
| 91 | if ((_return_value == -1) && PyErr_Occurred()) |
| 92 | goto exit; |
| 93 | return_value = PyLong_FromLong(_return_value); |
| 94 | |
| 95 | exit: |
| 96 | return return_value; |
| 97 | } |
| 98 | |
| 99 | PyDoc_STRVAR(msvcrt_open_osfhandle__doc__, |
| 100 | "open_osfhandle($module, handle, flags, /)\n" |
| 101 | "--\n" |
| 102 | "\n" |
| 103 | "Create a C runtime file descriptor from the file handle handle.\n" |
| 104 | "\n" |
| 105 | "The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,\n" |
| 106 | "and os.O_TEXT. The returned file descriptor may be used as a parameter\n" |
| 107 | "to os.fdopen() to create a file object."); |
| 108 | |
| 109 | #define MSVCRT_OPEN_OSFHANDLE_METHODDEF \ |
| 110 | {"open_osfhandle", (PyCFunction)msvcrt_open_osfhandle, METH_VARARGS, msvcrt_open_osfhandle__doc__}, |
| 111 | |
| 112 | static long |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 113 | msvcrt_open_osfhandle_impl(PyObject *module, Py_intptr_t handle, int flags); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 114 | |
| 115 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 116 | msvcrt_open_osfhandle(PyObject *module, PyObject *args) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 117 | { |
| 118 | PyObject *return_value = NULL; |
| 119 | Py_intptr_t handle; |
| 120 | int flags; |
| 121 | long _return_value; |
| 122 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 123 | if (!PyArg_ParseTuple(args, ""_Py_PARSE_INTPTR"i:open_osfhandle", |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 124 | &handle, &flags)) |
| 125 | goto exit; |
| 126 | _return_value = msvcrt_open_osfhandle_impl(module, handle, flags); |
| 127 | if ((_return_value == -1) && PyErr_Occurred()) |
| 128 | goto exit; |
| 129 | return_value = PyLong_FromLong(_return_value); |
| 130 | |
| 131 | exit: |
| 132 | return return_value; |
| 133 | } |
| 134 | |
| 135 | PyDoc_STRVAR(msvcrt_get_osfhandle__doc__, |
| 136 | "get_osfhandle($module, fd, /)\n" |
| 137 | "--\n" |
| 138 | "\n" |
| 139 | "Return the file handle for the file descriptor fd.\n" |
| 140 | "\n" |
| 141 | "Raises IOError if fd is not recognized."); |
| 142 | |
| 143 | #define MSVCRT_GET_OSFHANDLE_METHODDEF \ |
| 144 | {"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__}, |
| 145 | |
| 146 | static Py_intptr_t |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 147 | msvcrt_get_osfhandle_impl(PyObject *module, int fd); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 148 | |
| 149 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 150 | msvcrt_get_osfhandle(PyObject *module, PyObject *arg) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 151 | { |
| 152 | PyObject *return_value = NULL; |
| 153 | int fd; |
| 154 | Py_intptr_t _return_value; |
| 155 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 156 | if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 157 | goto exit; |
| 158 | _return_value = msvcrt_get_osfhandle_impl(module, fd); |
| 159 | if ((_return_value == -1) && PyErr_Occurred()) |
| 160 | goto exit; |
| 161 | return_value = PyLong_FromVoidPtr((void *)_return_value); |
| 162 | |
| 163 | exit: |
| 164 | return return_value; |
| 165 | } |
| 166 | |
| 167 | PyDoc_STRVAR(msvcrt_kbhit__doc__, |
| 168 | "kbhit($module, /)\n" |
| 169 | "--\n" |
| 170 | "\n" |
| 171 | "Return true if a keypress is waiting to be read."); |
| 172 | |
| 173 | #define MSVCRT_KBHIT_METHODDEF \ |
| 174 | {"kbhit", (PyCFunction)msvcrt_kbhit, METH_NOARGS, msvcrt_kbhit__doc__}, |
| 175 | |
| 176 | static long |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 177 | msvcrt_kbhit_impl(PyObject *module); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 178 | |
| 179 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 180 | msvcrt_kbhit(PyObject *module, PyObject *Py_UNUSED(ignored)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 181 | { |
| 182 | PyObject *return_value = NULL; |
| 183 | long _return_value; |
| 184 | |
| 185 | _return_value = msvcrt_kbhit_impl(module); |
| 186 | if ((_return_value == -1) && PyErr_Occurred()) |
| 187 | goto exit; |
| 188 | return_value = PyLong_FromLong(_return_value); |
| 189 | |
| 190 | exit: |
| 191 | return return_value; |
| 192 | } |
| 193 | |
| 194 | PyDoc_STRVAR(msvcrt_getch__doc__, |
| 195 | "getch($module, /)\n" |
| 196 | "--\n" |
| 197 | "\n" |
| 198 | "Read a keypress and return the resulting character as a byte string.\n" |
| 199 | "\n" |
| 200 | "Nothing is echoed to the console. This call will block if a keypress is\n" |
| 201 | "not already available, but will not wait for Enter to be pressed. If the\n" |
| 202 | "pressed key was a special function key, this will return \'\\000\' or\n" |
| 203 | "\'\\xe0\'; the next call will return the keycode. The Control-C keypress\n" |
| 204 | "cannot be read with this function."); |
| 205 | |
| 206 | #define MSVCRT_GETCH_METHODDEF \ |
| 207 | {"getch", (PyCFunction)msvcrt_getch, METH_NOARGS, msvcrt_getch__doc__}, |
| 208 | |
| 209 | static int |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 210 | msvcrt_getch_impl(PyObject *module); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 211 | |
| 212 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 213 | msvcrt_getch(PyObject *module, PyObject *Py_UNUSED(ignored)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 214 | { |
| 215 | PyObject *return_value = NULL; |
| 216 | char s[1]; |
| 217 | |
| 218 | s[0] = msvcrt_getch_impl(module); |
| 219 | return_value = PyBytes_FromStringAndSize(s, 1); |
| 220 | |
| 221 | return return_value; |
| 222 | } |
| 223 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 224 | PyDoc_STRVAR(msvcrt_getwch__doc__, |
| 225 | "getwch($module, /)\n" |
| 226 | "--\n" |
| 227 | "\n" |
| 228 | "Wide char variant of getch(), returning a Unicode value."); |
| 229 | |
| 230 | #define MSVCRT_GETWCH_METHODDEF \ |
| 231 | {"getwch", (PyCFunction)msvcrt_getwch, METH_NOARGS, msvcrt_getwch__doc__}, |
| 232 | |
| 233 | static wchar_t |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 234 | msvcrt_getwch_impl(PyObject *module); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 235 | |
| 236 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 237 | msvcrt_getwch(PyObject *module, PyObject *Py_UNUSED(ignored)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 238 | { |
| 239 | PyObject *return_value = NULL; |
| 240 | wchar_t _return_value; |
| 241 | |
| 242 | _return_value = msvcrt_getwch_impl(module); |
| 243 | return_value = PyUnicode_FromOrdinal(_return_value); |
| 244 | |
| 245 | return return_value; |
| 246 | } |
| 247 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 248 | PyDoc_STRVAR(msvcrt_getche__doc__, |
| 249 | "getche($module, /)\n" |
| 250 | "--\n" |
| 251 | "\n" |
| 252 | "Similar to getch(), but the keypress will be echoed if possible."); |
| 253 | |
| 254 | #define MSVCRT_GETCHE_METHODDEF \ |
| 255 | {"getche", (PyCFunction)msvcrt_getche, METH_NOARGS, msvcrt_getche__doc__}, |
| 256 | |
| 257 | static int |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 258 | msvcrt_getche_impl(PyObject *module); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 259 | |
| 260 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 261 | msvcrt_getche(PyObject *module, PyObject *Py_UNUSED(ignored)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 262 | { |
| 263 | PyObject *return_value = NULL; |
| 264 | char s[1]; |
| 265 | |
| 266 | s[0] = msvcrt_getche_impl(module); |
| 267 | return_value = PyBytes_FromStringAndSize(s, 1); |
| 268 | |
| 269 | return return_value; |
| 270 | } |
| 271 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 272 | PyDoc_STRVAR(msvcrt_getwche__doc__, |
| 273 | "getwche($module, /)\n" |
| 274 | "--\n" |
| 275 | "\n" |
| 276 | "Wide char variant of getche(), returning a Unicode value."); |
| 277 | |
| 278 | #define MSVCRT_GETWCHE_METHODDEF \ |
| 279 | {"getwche", (PyCFunction)msvcrt_getwche, METH_NOARGS, msvcrt_getwche__doc__}, |
| 280 | |
| 281 | static wchar_t |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 282 | msvcrt_getwche_impl(PyObject *module); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 283 | |
| 284 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 285 | msvcrt_getwche(PyObject *module, PyObject *Py_UNUSED(ignored)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 286 | { |
| 287 | PyObject *return_value = NULL; |
| 288 | wchar_t _return_value; |
| 289 | |
| 290 | _return_value = msvcrt_getwche_impl(module); |
| 291 | return_value = PyUnicode_FromOrdinal(_return_value); |
| 292 | |
| 293 | return return_value; |
| 294 | } |
| 295 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 296 | PyDoc_STRVAR(msvcrt_putch__doc__, |
| 297 | "putch($module, char, /)\n" |
| 298 | "--\n" |
| 299 | "\n" |
| 300 | "Print the byte string char to the console without buffering."); |
| 301 | |
| 302 | #define MSVCRT_PUTCH_METHODDEF \ |
| 303 | {"putch", (PyCFunction)msvcrt_putch, METH_O, msvcrt_putch__doc__}, |
| 304 | |
| 305 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 306 | msvcrt_putch_impl(PyObject *module, char char_value); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 307 | |
| 308 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 309 | msvcrt_putch(PyObject *module, PyObject *arg) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 310 | { |
| 311 | PyObject *return_value = NULL; |
| 312 | char char_value; |
| 313 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 314 | if (!PyArg_Parse(arg, "c:putch", &char_value)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 315 | goto exit; |
| 316 | return_value = msvcrt_putch_impl(module, char_value); |
| 317 | |
| 318 | exit: |
| 319 | return return_value; |
| 320 | } |
| 321 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 322 | PyDoc_STRVAR(msvcrt_putwch__doc__, |
| 323 | "putwch($module, unicode_char, /)\n" |
| 324 | "--\n" |
| 325 | "\n" |
| 326 | "Wide char variant of putch(), accepting a Unicode value."); |
| 327 | |
| 328 | #define MSVCRT_PUTWCH_METHODDEF \ |
| 329 | {"putwch", (PyCFunction)msvcrt_putwch, METH_O, msvcrt_putwch__doc__}, |
| 330 | |
| 331 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 332 | msvcrt_putwch_impl(PyObject *module, int unicode_char); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 333 | |
| 334 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 335 | msvcrt_putwch(PyObject *module, PyObject *arg) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 336 | { |
| 337 | PyObject *return_value = NULL; |
| 338 | int unicode_char; |
| 339 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 340 | if (!PyArg_Parse(arg, "C:putwch", &unicode_char)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 341 | goto exit; |
| 342 | return_value = msvcrt_putwch_impl(module, unicode_char); |
| 343 | |
| 344 | exit: |
| 345 | return return_value; |
| 346 | } |
| 347 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 348 | PyDoc_STRVAR(msvcrt_ungetch__doc__, |
| 349 | "ungetch($module, char, /)\n" |
| 350 | "--\n" |
| 351 | "\n" |
| 352 | "Opposite of getch.\n" |
| 353 | "\n" |
| 354 | "Cause the byte string char to be \"pushed back\" into the\n" |
| 355 | "console buffer; it will be the next character read by\n" |
| 356 | "getch() or getche()."); |
| 357 | |
| 358 | #define MSVCRT_UNGETCH_METHODDEF \ |
| 359 | {"ungetch", (PyCFunction)msvcrt_ungetch, METH_O, msvcrt_ungetch__doc__}, |
| 360 | |
| 361 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 362 | msvcrt_ungetch_impl(PyObject *module, char char_value); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 363 | |
| 364 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 365 | msvcrt_ungetch(PyObject *module, PyObject *arg) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 366 | { |
| 367 | PyObject *return_value = NULL; |
| 368 | char char_value; |
| 369 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 370 | if (!PyArg_Parse(arg, "c:ungetch", &char_value)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 371 | goto exit; |
| 372 | return_value = msvcrt_ungetch_impl(module, char_value); |
| 373 | |
| 374 | exit: |
| 375 | return return_value; |
| 376 | } |
| 377 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 378 | PyDoc_STRVAR(msvcrt_ungetwch__doc__, |
| 379 | "ungetwch($module, unicode_char, /)\n" |
| 380 | "--\n" |
| 381 | "\n" |
| 382 | "Wide char variant of ungetch(), accepting a Unicode value."); |
| 383 | |
| 384 | #define MSVCRT_UNGETWCH_METHODDEF \ |
| 385 | {"ungetwch", (PyCFunction)msvcrt_ungetwch, METH_O, msvcrt_ungetwch__doc__}, |
| 386 | |
| 387 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 388 | msvcrt_ungetwch_impl(PyObject *module, int unicode_char); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 389 | |
| 390 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 391 | msvcrt_ungetwch(PyObject *module, PyObject *arg) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 392 | { |
| 393 | PyObject *return_value = NULL; |
| 394 | int unicode_char; |
| 395 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 396 | if (!PyArg_Parse(arg, "C:ungetwch", &unicode_char)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 397 | goto exit; |
| 398 | return_value = msvcrt_ungetwch_impl(module, unicode_char); |
| 399 | |
| 400 | exit: |
| 401 | return return_value; |
| 402 | } |
| 403 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 404 | #if defined(_DEBUG) |
| 405 | |
| 406 | PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__, |
| 407 | "CrtSetReportFile($module, type, file, /)\n" |
| 408 | "--\n" |
| 409 | "\n" |
| 410 | "Wrapper around _CrtSetReportFile.\n" |
| 411 | "\n" |
| 412 | "Only available on Debug builds."); |
| 413 | |
| 414 | #define MSVCRT_CRTSETREPORTFILE_METHODDEF \ |
| 415 | {"CrtSetReportFile", (PyCFunction)msvcrt_CrtSetReportFile, METH_VARARGS, msvcrt_CrtSetReportFile__doc__}, |
| 416 | |
| 417 | static long |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 418 | msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 419 | |
| 420 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 421 | msvcrt_CrtSetReportFile(PyObject *module, PyObject *args) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 422 | { |
| 423 | PyObject *return_value = NULL; |
| 424 | int type; |
| 425 | int file; |
| 426 | long _return_value; |
| 427 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 428 | if (!PyArg_ParseTuple(args, "ii:CrtSetReportFile", |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 429 | &type, &file)) |
| 430 | goto exit; |
| 431 | _return_value = msvcrt_CrtSetReportFile_impl(module, type, file); |
| 432 | if ((_return_value == -1) && PyErr_Occurred()) |
| 433 | goto exit; |
| 434 | return_value = PyLong_FromLong(_return_value); |
| 435 | |
| 436 | exit: |
| 437 | return return_value; |
| 438 | } |
| 439 | |
| 440 | #endif /* defined(_DEBUG) */ |
| 441 | |
| 442 | #if defined(_DEBUG) |
| 443 | |
| 444 | PyDoc_STRVAR(msvcrt_CrtSetReportMode__doc__, |
| 445 | "CrtSetReportMode($module, type, mode, /)\n" |
| 446 | "--\n" |
| 447 | "\n" |
| 448 | "Wrapper around _CrtSetReportMode.\n" |
| 449 | "\n" |
| 450 | "Only available on Debug builds."); |
| 451 | |
| 452 | #define MSVCRT_CRTSETREPORTMODE_METHODDEF \ |
| 453 | {"CrtSetReportMode", (PyCFunction)msvcrt_CrtSetReportMode, METH_VARARGS, msvcrt_CrtSetReportMode__doc__}, |
| 454 | |
| 455 | static long |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 456 | msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 457 | |
| 458 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 459 | msvcrt_CrtSetReportMode(PyObject *module, PyObject *args) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 460 | { |
| 461 | PyObject *return_value = NULL; |
| 462 | int type; |
| 463 | int mode; |
| 464 | long _return_value; |
| 465 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 466 | if (!PyArg_ParseTuple(args, "ii:CrtSetReportMode", |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 467 | &type, &mode)) |
| 468 | goto exit; |
| 469 | _return_value = msvcrt_CrtSetReportMode_impl(module, type, mode); |
| 470 | if ((_return_value == -1) && PyErr_Occurred()) |
| 471 | goto exit; |
| 472 | return_value = PyLong_FromLong(_return_value); |
| 473 | |
| 474 | exit: |
| 475 | return return_value; |
| 476 | } |
| 477 | |
| 478 | #endif /* defined(_DEBUG) */ |
| 479 | |
| 480 | #if defined(_DEBUG) |
| 481 | |
| 482 | PyDoc_STRVAR(msvcrt_set_error_mode__doc__, |
| 483 | "set_error_mode($module, mode, /)\n" |
| 484 | "--\n" |
| 485 | "\n" |
| 486 | "Wrapper around _set_error_mode.\n" |
| 487 | "\n" |
| 488 | "Only available on Debug builds."); |
| 489 | |
| 490 | #define MSVCRT_SET_ERROR_MODE_METHODDEF \ |
| 491 | {"set_error_mode", (PyCFunction)msvcrt_set_error_mode, METH_O, msvcrt_set_error_mode__doc__}, |
| 492 | |
| 493 | static long |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 494 | msvcrt_set_error_mode_impl(PyObject *module, int mode); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 495 | |
| 496 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 497 | msvcrt_set_error_mode(PyObject *module, PyObject *arg) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 498 | { |
| 499 | PyObject *return_value = NULL; |
| 500 | int mode; |
| 501 | long _return_value; |
| 502 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 503 | if (!PyArg_Parse(arg, "i:set_error_mode", &mode)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 504 | goto exit; |
| 505 | _return_value = msvcrt_set_error_mode_impl(module, mode); |
| 506 | if ((_return_value == -1) && PyErr_Occurred()) |
| 507 | goto exit; |
| 508 | return_value = PyLong_FromLong(_return_value); |
| 509 | |
| 510 | exit: |
| 511 | return return_value; |
| 512 | } |
| 513 | |
| 514 | #endif /* defined(_DEBUG) */ |
| 515 | |
| 516 | PyDoc_STRVAR(msvcrt_SetErrorMode__doc__, |
| 517 | "SetErrorMode($module, mode, /)\n" |
| 518 | "--\n" |
| 519 | "\n" |
| 520 | "Wrapper around SetErrorMode."); |
| 521 | |
| 522 | #define MSVCRT_SETERRORMODE_METHODDEF \ |
| 523 | {"SetErrorMode", (PyCFunction)msvcrt_SetErrorMode, METH_O, msvcrt_SetErrorMode__doc__}, |
| 524 | |
| 525 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 526 | msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode); |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 527 | |
| 528 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 529 | msvcrt_SetErrorMode(PyObject *module, PyObject *arg) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 530 | { |
| 531 | PyObject *return_value = NULL; |
| 532 | unsigned int mode; |
| 533 | |
Zachary Ware | 77772c0 | 2015-05-13 10:58:35 -0500 | [diff] [blame] | 534 | if (!PyArg_Parse(arg, "I:SetErrorMode", &mode)) |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 535 | goto exit; |
| 536 | return_value = msvcrt_SetErrorMode_impl(module, mode); |
| 537 | |
| 538 | exit: |
| 539 | return return_value; |
| 540 | } |
| 541 | |
Zachary Ware | 4552089 | 2015-05-13 01:22:32 -0500 | [diff] [blame] | 542 | #ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF |
| 543 | #define MSVCRT_CRTSETREPORTFILE_METHODDEF |
| 544 | #endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */ |
| 545 | |
| 546 | #ifndef MSVCRT_CRTSETREPORTMODE_METHODDEF |
| 547 | #define MSVCRT_CRTSETREPORTMODE_METHODDEF |
| 548 | #endif /* !defined(MSVCRT_CRTSETREPORTMODE_METHODDEF) */ |
| 549 | |
| 550 | #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF |
| 551 | #define MSVCRT_SET_ERROR_MODE_METHODDEF |
| 552 | #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */ |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame^] | 553 | /*[clinic end generated code: output=2a794c520d6ae887 input=a9049054013a1b77]*/ |