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