Home | History | Annotate | Download | only in clinic
      1 /*[clinic input]
      2 preserve
      3 [clinic start generated code]*/
      4 
      5 #if defined(MS_WINDOWS)
      6 
      7 PyDoc_STRVAR(_io__WindowsConsoleIO_close__doc__,
      8 "close($self, /)\n"
      9 "--\n"
     10 "\n"
     11 "Close the handle.\n"
     12 "\n"
     13 "A closed handle cannot be used for further I/O operations.  close() may be\n"
     14 "called more than once without error.");
     15 
     16 #define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF    \
     17     {"close", (PyCFunction)_io__WindowsConsoleIO_close, METH_NOARGS, _io__WindowsConsoleIO_close__doc__},
     18 
     19 static PyObject *
     20 _io__WindowsConsoleIO_close_impl(winconsoleio *self);
     21 
     22 static PyObject *
     23 _io__WindowsConsoleIO_close(winconsoleio *self, PyObject *Py_UNUSED(ignored))
     24 {
     25     return _io__WindowsConsoleIO_close_impl(self);
     26 }
     27 
     28 #endif /* defined(MS_WINDOWS) */
     29 
     30 #if defined(MS_WINDOWS)
     31 
     32 PyDoc_STRVAR(_io__WindowsConsoleIO___init____doc__,
     33 "_WindowsConsoleIO(file, mode=\'r\', closefd=True, opener=None)\n"
     34 "--\n"
     35 "\n"
     36 "Open a console buffer by file descriptor.\n"
     37 "\n"
     38 "The mode can be \'rb\' (default), or \'wb\' for reading or writing bytes. All\n"
     39 "other mode characters will be ignored. Mode \'b\' will be assumed if it is\n"
     40 "omitted. The *opener* parameter is always ignored.");
     41 
     42 static int
     43 _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
     44                                     const char *mode, int closefd,
     45                                     PyObject *opener);
     46 
     47 static int
     48 _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
     49 {
     50     int return_value = -1;
     51     static const char * const _keywords[] = {"file", "mode", "closefd", "opener", NULL};
     52     static _PyArg_Parser _parser = {"O|siO:_WindowsConsoleIO", _keywords, 0};
     53     PyObject *nameobj;
     54     const char *mode = "r";
     55     int closefd = 1;
     56     PyObject *opener = Py_None;
     57 
     58     if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
     59         &nameobj, &mode, &closefd, &opener)) {
     60         goto exit;
     61     }
     62     return_value = _io__WindowsConsoleIO___init___impl((winconsoleio *)self, nameobj, mode, closefd, opener);
     63 
     64 exit:
     65     return return_value;
     66 }
     67 
     68 #endif /* defined(MS_WINDOWS) */
     69 
     70 #if defined(MS_WINDOWS)
     71 
     72 PyDoc_STRVAR(_io__WindowsConsoleIO_fileno__doc__,
     73 "fileno($self, /)\n"
     74 "--\n"
     75 "\n"
     76 "Return the underlying file descriptor (an integer).\n"
     77 "\n"
     78 "fileno is only set when a file descriptor is used to open\n"
     79 "one of the standard streams.");
     80 
     81 #define _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF    \
     82     {"fileno", (PyCFunction)_io__WindowsConsoleIO_fileno, METH_NOARGS, _io__WindowsConsoleIO_fileno__doc__},
     83 
     84 static PyObject *
     85 _io__WindowsConsoleIO_fileno_impl(winconsoleio *self);
     86 
     87 static PyObject *
     88 _io__WindowsConsoleIO_fileno(winconsoleio *self, PyObject *Py_UNUSED(ignored))
     89 {
     90     return _io__WindowsConsoleIO_fileno_impl(self);
     91 }
     92 
     93 #endif /* defined(MS_WINDOWS) */
     94 
     95 #if defined(MS_WINDOWS)
     96 
     97 PyDoc_STRVAR(_io__WindowsConsoleIO_readable__doc__,
     98 "readable($self, /)\n"
     99 "--\n"
    100 "\n"
    101 "True if console is an input buffer.");
    102 
    103 #define _IO__WINDOWSCONSOLEIO_READABLE_METHODDEF    \
    104     {"readable", (PyCFunction)_io__WindowsConsoleIO_readable, METH_NOARGS, _io__WindowsConsoleIO_readable__doc__},
    105 
    106 static PyObject *
    107 _io__WindowsConsoleIO_readable_impl(winconsoleio *self);
    108 
    109 static PyObject *
    110 _io__WindowsConsoleIO_readable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
    111 {
    112     return _io__WindowsConsoleIO_readable_impl(self);
    113 }
    114 
    115 #endif /* defined(MS_WINDOWS) */
    116 
    117 #if defined(MS_WINDOWS)
    118 
    119 PyDoc_STRVAR(_io__WindowsConsoleIO_writable__doc__,
    120 "writable($self, /)\n"
    121 "--\n"
    122 "\n"
    123 "True if console is an output buffer.");
    124 
    125 #define _IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF    \
    126     {"writable", (PyCFunction)_io__WindowsConsoleIO_writable, METH_NOARGS, _io__WindowsConsoleIO_writable__doc__},
    127 
    128 static PyObject *
    129 _io__WindowsConsoleIO_writable_impl(winconsoleio *self);
    130 
    131 static PyObject *
    132 _io__WindowsConsoleIO_writable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
    133 {
    134     return _io__WindowsConsoleIO_writable_impl(self);
    135 }
    136 
    137 #endif /* defined(MS_WINDOWS) */
    138 
    139 #if defined(MS_WINDOWS)
    140 
    141 PyDoc_STRVAR(_io__WindowsConsoleIO_readinto__doc__,
    142 "readinto($self, buffer, /)\n"
    143 "--\n"
    144 "\n"
    145 "Same as RawIOBase.readinto().");
    146 
    147 #define _IO__WINDOWSCONSOLEIO_READINTO_METHODDEF    \
    148     {"readinto", (PyCFunction)_io__WindowsConsoleIO_readinto, METH_O, _io__WindowsConsoleIO_readinto__doc__},
    149 
    150 static PyObject *
    151 _io__WindowsConsoleIO_readinto_impl(winconsoleio *self, Py_buffer *buffer);
    152 
    153 static PyObject *
    154 _io__WindowsConsoleIO_readinto(winconsoleio *self, PyObject *arg)
    155 {
    156     PyObject *return_value = NULL;
    157     Py_buffer buffer = {NULL, NULL};
    158 
    159     if (!PyArg_Parse(arg, "w*:readinto", &buffer)) {
    160         goto exit;
    161     }
    162     return_value = _io__WindowsConsoleIO_readinto_impl(self, &buffer);
    163 
    164 exit:
    165     /* Cleanup for buffer */
    166     if (buffer.obj) {
    167        PyBuffer_Release(&buffer);
    168     }
    169 
    170     return return_value;
    171 }
    172 
    173 #endif /* defined(MS_WINDOWS) */
    174 
    175 #if defined(MS_WINDOWS)
    176 
    177 PyDoc_STRVAR(_io__WindowsConsoleIO_readall__doc__,
    178 "readall($self, /)\n"
    179 "--\n"
    180 "\n"
    181 "Read all data from the console, returned as bytes.\n"
    182 "\n"
    183 "Return an empty bytes object at EOF.");
    184 
    185 #define _IO__WINDOWSCONSOLEIO_READALL_METHODDEF    \
    186     {"readall", (PyCFunction)_io__WindowsConsoleIO_readall, METH_NOARGS, _io__WindowsConsoleIO_readall__doc__},
    187 
    188 static PyObject *
    189 _io__WindowsConsoleIO_readall_impl(winconsoleio *self);
    190 
    191 static PyObject *
    192 _io__WindowsConsoleIO_readall(winconsoleio *self, PyObject *Py_UNUSED(ignored))
    193 {
    194     return _io__WindowsConsoleIO_readall_impl(self);
    195 }
    196 
    197 #endif /* defined(MS_WINDOWS) */
    198 
    199 #if defined(MS_WINDOWS)
    200 
    201 PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
    202 "read($self, size=-1, /)\n"
    203 "--\n"
    204 "\n"
    205 "Read at most size bytes, returned as bytes.\n"
    206 "\n"
    207 "Only makes one system call when size is a positive integer,\n"
    208 "so less data may be returned than requested.\n"
    209 "Return an empty bytes object at EOF.");
    210 
    211 #define _IO__WINDOWSCONSOLEIO_READ_METHODDEF    \
    212     {"read", (PyCFunction)_io__WindowsConsoleIO_read, METH_VARARGS, _io__WindowsConsoleIO_read__doc__},
    213 
    214 static PyObject *
    215 _io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size);
    216 
    217 static PyObject *
    218 _io__WindowsConsoleIO_read(winconsoleio *self, PyObject *args)
    219 {
    220     PyObject *return_value = NULL;
    221     Py_ssize_t size = -1;
    222 
    223     if (!PyArg_ParseTuple(args, "|O&:read",
    224         _PyIO_ConvertSsize_t, &size)) {
    225         goto exit;
    226     }
    227     return_value = _io__WindowsConsoleIO_read_impl(self, size);
    228 
    229 exit:
    230     return return_value;
    231 }
    232 
    233 #endif /* defined(MS_WINDOWS) */
    234 
    235 #if defined(MS_WINDOWS)
    236 
    237 PyDoc_STRVAR(_io__WindowsConsoleIO_write__doc__,
    238 "write($self, b, /)\n"
    239 "--\n"
    240 "\n"
    241 "Write buffer b to file, return number of bytes written.\n"
    242 "\n"
    243 "Only makes one system call, so not all of the data may be written.\n"
    244 "The number of bytes actually written is returned.");
    245 
    246 #define _IO__WINDOWSCONSOLEIO_WRITE_METHODDEF    \
    247     {"write", (PyCFunction)_io__WindowsConsoleIO_write, METH_O, _io__WindowsConsoleIO_write__doc__},
    248 
    249 static PyObject *
    250 _io__WindowsConsoleIO_write_impl(winconsoleio *self, Py_buffer *b);
    251 
    252 static PyObject *
    253 _io__WindowsConsoleIO_write(winconsoleio *self, PyObject *arg)
    254 {
    255     PyObject *return_value = NULL;
    256     Py_buffer b = {NULL, NULL};
    257 
    258     if (!PyArg_Parse(arg, "y*:write", &b)) {
    259         goto exit;
    260     }
    261     return_value = _io__WindowsConsoleIO_write_impl(self, &b);
    262 
    263 exit:
    264     /* Cleanup for b */
    265     if (b.obj) {
    266        PyBuffer_Release(&b);
    267     }
    268 
    269     return return_value;
    270 }
    271 
    272 #endif /* defined(MS_WINDOWS) */
    273 
    274 #if defined(MS_WINDOWS)
    275 
    276 PyDoc_STRVAR(_io__WindowsConsoleIO_isatty__doc__,
    277 "isatty($self, /)\n"
    278 "--\n"
    279 "\n"
    280 "Always True.");
    281 
    282 #define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF    \
    283     {"isatty", (PyCFunction)_io__WindowsConsoleIO_isatty, METH_NOARGS, _io__WindowsConsoleIO_isatty__doc__},
    284 
    285 static PyObject *
    286 _io__WindowsConsoleIO_isatty_impl(winconsoleio *self);
    287 
    288 static PyObject *
    289 _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
    290 {
    291     return _io__WindowsConsoleIO_isatty_impl(self);
    292 }
    293 
    294 #endif /* defined(MS_WINDOWS) */
    295 
    296 #ifndef _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
    297     #define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
    298 #endif /* !defined(_IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF) */
    299 
    300 #ifndef _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
    301     #define _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
    302 #endif /* !defined(_IO__WINDOWSCONSOLEIO_FILENO_METHODDEF) */
    303 
    304 #ifndef _IO__WINDOWSCONSOLEIO_READABLE_METHODDEF
    305     #define _IO__WINDOWSCONSOLEIO_READABLE_METHODDEF
    306 #endif /* !defined(_IO__WINDOWSCONSOLEIO_READABLE_METHODDEF) */
    307 
    308 #ifndef _IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
    309     #define _IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
    310 #endif /* !defined(_IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF) */
    311 
    312 #ifndef _IO__WINDOWSCONSOLEIO_READINTO_METHODDEF
    313     #define _IO__WINDOWSCONSOLEIO_READINTO_METHODDEF
    314 #endif /* !defined(_IO__WINDOWSCONSOLEIO_READINTO_METHODDEF) */
    315 
    316 #ifndef _IO__WINDOWSCONSOLEIO_READALL_METHODDEF
    317     #define _IO__WINDOWSCONSOLEIO_READALL_METHODDEF
    318 #endif /* !defined(_IO__WINDOWSCONSOLEIO_READALL_METHODDEF) */
    319 
    320 #ifndef _IO__WINDOWSCONSOLEIO_READ_METHODDEF
    321     #define _IO__WINDOWSCONSOLEIO_READ_METHODDEF
    322 #endif /* !defined(_IO__WINDOWSCONSOLEIO_READ_METHODDEF) */
    323 
    324 #ifndef _IO__WINDOWSCONSOLEIO_WRITE_METHODDEF
    325     #define _IO__WINDOWSCONSOLEIO_WRITE_METHODDEF
    326 #endif /* !defined(_IO__WINDOWSCONSOLEIO_WRITE_METHODDEF) */
    327 
    328 #ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
    329     #define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
    330 #endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
    331 /*[clinic end generated code: output=9eba916f8537fff7 input=a9049054013a1b77]*/
    332