Steve Dower | 312cef7 | 2016-10-03 09:04:58 -0700 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | #if defined(MS_WINDOWS) |
| 6 | |
| 7 | PyDoc_STRVAR(_testconsole_write_input__doc__, |
| 8 | "write_input($module, /, file, s)\n" |
| 9 | "--\n" |
| 10 | "\n" |
| 11 | "Writes UTF-16-LE encoded bytes to the console as if typed by a user."); |
| 12 | |
| 13 | #define _TESTCONSOLE_WRITE_INPUT_METHODDEF \ |
Serhiy Storchaka | 6969eaf | 2017-07-03 21:20:15 +0300 | [diff] [blame] | 14 | {"write_input", (PyCFunction)_testconsole_write_input, METH_FASTCALL|METH_KEYWORDS, _testconsole_write_input__doc__}, |
Steve Dower | 312cef7 | 2016-10-03 09:04:58 -0700 | [diff] [blame] | 15 | |
| 16 | static PyObject * |
| 17 | _testconsole_write_input_impl(PyObject *module, PyObject *file, |
| 18 | PyBytesObject *s); |
| 19 | |
| 20 | static PyObject * |
| 21 | _testconsole_write_input(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
| 22 | { |
| 23 | PyObject *return_value = NULL; |
| 24 | static const char * const _keywords[] = {"file", "s", NULL}; |
| 25 | static _PyArg_Parser _parser = {"OS:write_input", _keywords, 0}; |
| 26 | PyObject *file; |
| 27 | PyBytesObject *s; |
| 28 | |
Victor Stinner | 3e1fad6 | 2017-01-17 01:29:01 +0100 | [diff] [blame] | 29 | if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, |
Steve Dower | 312cef7 | 2016-10-03 09:04:58 -0700 | [diff] [blame] | 30 | &file, &s)) { |
| 31 | goto exit; |
| 32 | } |
| 33 | return_value = _testconsole_write_input_impl(module, file, s); |
| 34 | |
| 35 | exit: |
| 36 | return return_value; |
| 37 | } |
| 38 | |
| 39 | #endif /* defined(MS_WINDOWS) */ |
| 40 | |
| 41 | #if defined(MS_WINDOWS) |
| 42 | |
| 43 | PyDoc_STRVAR(_testconsole_read_output__doc__, |
| 44 | "read_output($module, /, file)\n" |
| 45 | "--\n" |
| 46 | "\n" |
| 47 | "Reads a str from the console as written to stdout."); |
| 48 | |
| 49 | #define _TESTCONSOLE_READ_OUTPUT_METHODDEF \ |
Serhiy Storchaka | 6969eaf | 2017-07-03 21:20:15 +0300 | [diff] [blame] | 50 | {"read_output", (PyCFunction)_testconsole_read_output, METH_FASTCALL|METH_KEYWORDS, _testconsole_read_output__doc__}, |
Steve Dower | 312cef7 | 2016-10-03 09:04:58 -0700 | [diff] [blame] | 51 | |
| 52 | static PyObject * |
| 53 | _testconsole_read_output_impl(PyObject *module, PyObject *file); |
| 54 | |
| 55 | static PyObject * |
| 56 | _testconsole_read_output(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
| 57 | { |
| 58 | PyObject *return_value = NULL; |
| 59 | static const char * const _keywords[] = {"file", NULL}; |
| 60 | static _PyArg_Parser _parser = {"O:read_output", _keywords, 0}; |
| 61 | PyObject *file; |
| 62 | |
Victor Stinner | 3e1fad6 | 2017-01-17 01:29:01 +0100 | [diff] [blame] | 63 | if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, |
Steve Dower | 312cef7 | 2016-10-03 09:04:58 -0700 | [diff] [blame] | 64 | &file)) { |
| 65 | goto exit; |
| 66 | } |
| 67 | return_value = _testconsole_read_output_impl(module, file); |
| 68 | |
| 69 | exit: |
| 70 | return return_value; |
| 71 | } |
| 72 | |
| 73 | #endif /* defined(MS_WINDOWS) */ |
| 74 | |
| 75 | #ifndef _TESTCONSOLE_WRITE_INPUT_METHODDEF |
| 76 | #define _TESTCONSOLE_WRITE_INPUT_METHODDEF |
| 77 | #endif /* !defined(_TESTCONSOLE_WRITE_INPUT_METHODDEF) */ |
| 78 | |
| 79 | #ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF |
| 80 | #define _TESTCONSOLE_READ_OUTPUT_METHODDEF |
| 81 | #endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */ |
Serhiy Storchaka | 6969eaf | 2017-07-03 21:20:15 +0300 | [diff] [blame] | 82 | /*[clinic end generated code: output=ac80ed19e6edc0af input=a9049054013a1b77]*/ |