Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(_multibytecodec_MultibyteCodec_encode__doc__, |
| 6 | "encode($self, /, input, errors=None)\n" |
| 7 | "--\n" |
| 8 | "\n" |
| 9 | "Return an encoded string version of `input\'.\n" |
| 10 | "\n" |
| 11 | "\'errors\' may be given to set a different error handling scheme. Default is\n" |
| 12 | "\'strict\' meaning that encoding errors raise a UnicodeEncodeError. Other possible\n" |
| 13 | "values are \'ignore\', \'replace\' and \'xmlcharrefreplace\' as well as any other name\n" |
| 14 | "registered with codecs.register_error that can handle UnicodeEncodeErrors."); |
| 15 | |
| 16 | #define _MULTIBYTECODEC_MULTIBYTECODEC_ENCODE_METHODDEF \ |
| 17 | {"encode", (PyCFunction)_multibytecodec_MultibyteCodec_encode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteCodec_encode__doc__}, |
| 18 | |
| 19 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 20 | _multibytecodec_MultibyteCodec_encode_impl(MultibyteCodecObject *self, |
| 21 | PyObject *input, |
| 22 | const char *errors); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 23 | |
| 24 | static PyObject * |
| 25 | _multibytecodec_MultibyteCodec_encode(MultibyteCodecObject *self, PyObject *args, PyObject *kwargs) |
| 26 | { |
| 27 | PyObject *return_value = NULL; |
| 28 | static char *_keywords[] = {"input", "errors", NULL}; |
| 29 | PyObject *input; |
| 30 | const char *errors = NULL; |
| 31 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 32 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|z:encode", _keywords, |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 33 | &input, &errors)) |
| 34 | goto exit; |
| 35 | return_value = _multibytecodec_MultibyteCodec_encode_impl(self, input, errors); |
| 36 | |
| 37 | exit: |
| 38 | return return_value; |
| 39 | } |
| 40 | |
| 41 | PyDoc_STRVAR(_multibytecodec_MultibyteCodec_decode__doc__, |
| 42 | "decode($self, /, input, errors=None)\n" |
| 43 | "--\n" |
| 44 | "\n" |
| 45 | "Decodes \'input\'.\n" |
| 46 | "\n" |
| 47 | "\'errors\' may be given to set a different error handling scheme. Default is\n" |
| 48 | "\'strict\' meaning that encoding errors raise a UnicodeDecodeError. Other possible\n" |
| 49 | "values are \'ignore\' and \'replace\' as well as any other name registered with\n" |
| 50 | "codecs.register_error that is able to handle UnicodeDecodeErrors.\""); |
| 51 | |
| 52 | #define _MULTIBYTECODEC_MULTIBYTECODEC_DECODE_METHODDEF \ |
| 53 | {"decode", (PyCFunction)_multibytecodec_MultibyteCodec_decode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteCodec_decode__doc__}, |
| 54 | |
| 55 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 56 | _multibytecodec_MultibyteCodec_decode_impl(MultibyteCodecObject *self, |
| 57 | Py_buffer *input, |
| 58 | const char *errors); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 59 | |
| 60 | static PyObject * |
| 61 | _multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject *args, PyObject *kwargs) |
| 62 | { |
| 63 | PyObject *return_value = NULL; |
| 64 | static char *_keywords[] = {"input", "errors", NULL}; |
| 65 | Py_buffer input = {NULL, NULL}; |
| 66 | const char *errors = NULL; |
| 67 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 68 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|z:decode", _keywords, |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 69 | &input, &errors)) |
| 70 | goto exit; |
| 71 | return_value = _multibytecodec_MultibyteCodec_decode_impl(self, &input, errors); |
| 72 | |
| 73 | exit: |
| 74 | /* Cleanup for input */ |
| 75 | if (input.obj) |
| 76 | PyBuffer_Release(&input); |
| 77 | |
| 78 | return return_value; |
| 79 | } |
| 80 | |
| 81 | PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_encode__doc__, |
Serhiy Storchaka | 8b2e8b6 | 2015-05-30 11:30:39 +0300 | [diff] [blame^] | 82 | "encode($self, /, input, final=False)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 83 | "--\n" |
| 84 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 85 | |
| 86 | #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_ENCODE_METHODDEF \ |
| 87 | {"encode", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_encode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalEncoder_encode__doc__}, |
| 88 | |
| 89 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 90 | _multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self, |
| 91 | PyObject *input, |
| 92 | int final); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 93 | |
| 94 | static PyObject * |
| 95 | _multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderObject *self, PyObject *args, PyObject *kwargs) |
| 96 | { |
| 97 | PyObject *return_value = NULL; |
| 98 | static char *_keywords[] = {"input", "final", NULL}; |
| 99 | PyObject *input; |
| 100 | int final = 0; |
| 101 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 102 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:encode", _keywords, |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 103 | &input, &final)) |
| 104 | goto exit; |
| 105 | return_value = _multibytecodec_MultibyteIncrementalEncoder_encode_impl(self, input, final); |
| 106 | |
| 107 | exit: |
| 108 | return return_value; |
| 109 | } |
| 110 | |
| 111 | PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_reset__doc__, |
| 112 | "reset($self, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 113 | "--\n" |
| 114 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 115 | |
| 116 | #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_RESET_METHODDEF \ |
| 117 | {"reset", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_reset, METH_NOARGS, _multibytecodec_MultibyteIncrementalEncoder_reset__doc__}, |
| 118 | |
| 119 | static PyObject * |
| 120 | _multibytecodec_MultibyteIncrementalEncoder_reset_impl(MultibyteIncrementalEncoderObject *self); |
| 121 | |
| 122 | static PyObject * |
| 123 | _multibytecodec_MultibyteIncrementalEncoder_reset(MultibyteIncrementalEncoderObject *self, PyObject *Py_UNUSED(ignored)) |
| 124 | { |
| 125 | return _multibytecodec_MultibyteIncrementalEncoder_reset_impl(self); |
| 126 | } |
| 127 | |
| 128 | PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_decode__doc__, |
Serhiy Storchaka | 8b2e8b6 | 2015-05-30 11:30:39 +0300 | [diff] [blame^] | 129 | "decode($self, /, input, final=False)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 130 | "--\n" |
| 131 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 132 | |
| 133 | #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_DECODE_METHODDEF \ |
| 134 | {"decode", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_decode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalDecoder_decode__doc__}, |
| 135 | |
| 136 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 137 | _multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDecoderObject *self, |
| 138 | Py_buffer *input, |
| 139 | int final); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 140 | |
| 141 | static PyObject * |
| 142 | _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderObject *self, PyObject *args, PyObject *kwargs) |
| 143 | { |
| 144 | PyObject *return_value = NULL; |
| 145 | static char *_keywords[] = {"input", "final", NULL}; |
| 146 | Py_buffer input = {NULL, NULL}; |
| 147 | int final = 0; |
| 148 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 149 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|i:decode", _keywords, |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 150 | &input, &final)) |
| 151 | goto exit; |
| 152 | return_value = _multibytecodec_MultibyteIncrementalDecoder_decode_impl(self, &input, final); |
| 153 | |
| 154 | exit: |
| 155 | /* Cleanup for input */ |
| 156 | if (input.obj) |
| 157 | PyBuffer_Release(&input); |
| 158 | |
| 159 | return return_value; |
| 160 | } |
| 161 | |
| 162 | PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_reset__doc__, |
| 163 | "reset($self, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 164 | "--\n" |
| 165 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 166 | |
| 167 | #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_RESET_METHODDEF \ |
| 168 | {"reset", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_reset, METH_NOARGS, _multibytecodec_MultibyteIncrementalDecoder_reset__doc__}, |
| 169 | |
| 170 | static PyObject * |
| 171 | _multibytecodec_MultibyteIncrementalDecoder_reset_impl(MultibyteIncrementalDecoderObject *self); |
| 172 | |
| 173 | static PyObject * |
| 174 | _multibytecodec_MultibyteIncrementalDecoder_reset(MultibyteIncrementalDecoderObject *self, PyObject *Py_UNUSED(ignored)) |
| 175 | { |
| 176 | return _multibytecodec_MultibyteIncrementalDecoder_reset_impl(self); |
| 177 | } |
| 178 | |
| 179 | PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_read__doc__, |
| 180 | "read($self, sizeobj=None, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 181 | "--\n" |
| 182 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 183 | |
| 184 | #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READ_METHODDEF \ |
| 185 | {"read", (PyCFunction)_multibytecodec_MultibyteStreamReader_read, METH_VARARGS, _multibytecodec_MultibyteStreamReader_read__doc__}, |
| 186 | |
| 187 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 188 | _multibytecodec_MultibyteStreamReader_read_impl(MultibyteStreamReaderObject *self, |
| 189 | PyObject *sizeobj); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 190 | |
| 191 | static PyObject * |
| 192 | _multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, PyObject *args) |
| 193 | { |
| 194 | PyObject *return_value = NULL; |
| 195 | PyObject *sizeobj = Py_None; |
| 196 | |
| 197 | if (!PyArg_UnpackTuple(args, "read", |
| 198 | 0, 1, |
| 199 | &sizeobj)) |
| 200 | goto exit; |
| 201 | return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj); |
| 202 | |
| 203 | exit: |
| 204 | return return_value; |
| 205 | } |
| 206 | |
| 207 | PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readline__doc__, |
| 208 | "readline($self, sizeobj=None, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 209 | "--\n" |
| 210 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 211 | |
| 212 | #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINE_METHODDEF \ |
| 213 | {"readline", (PyCFunction)_multibytecodec_MultibyteStreamReader_readline, METH_VARARGS, _multibytecodec_MultibyteStreamReader_readline__doc__}, |
| 214 | |
| 215 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 216 | _multibytecodec_MultibyteStreamReader_readline_impl(MultibyteStreamReaderObject *self, |
| 217 | PyObject *sizeobj); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 218 | |
| 219 | static PyObject * |
| 220 | _multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self, PyObject *args) |
| 221 | { |
| 222 | PyObject *return_value = NULL; |
| 223 | PyObject *sizeobj = Py_None; |
| 224 | |
| 225 | if (!PyArg_UnpackTuple(args, "readline", |
| 226 | 0, 1, |
| 227 | &sizeobj)) |
| 228 | goto exit; |
| 229 | return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj); |
| 230 | |
| 231 | exit: |
| 232 | return return_value; |
| 233 | } |
| 234 | |
| 235 | PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readlines__doc__, |
| 236 | "readlines($self, sizehintobj=None, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 237 | "--\n" |
| 238 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 239 | |
| 240 | #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINES_METHODDEF \ |
| 241 | {"readlines", (PyCFunction)_multibytecodec_MultibyteStreamReader_readlines, METH_VARARGS, _multibytecodec_MultibyteStreamReader_readlines__doc__}, |
| 242 | |
| 243 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 244 | _multibytecodec_MultibyteStreamReader_readlines_impl(MultibyteStreamReaderObject *self, |
| 245 | PyObject *sizehintobj); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 246 | |
| 247 | static PyObject * |
| 248 | _multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *self, PyObject *args) |
| 249 | { |
| 250 | PyObject *return_value = NULL; |
| 251 | PyObject *sizehintobj = Py_None; |
| 252 | |
| 253 | if (!PyArg_UnpackTuple(args, "readlines", |
| 254 | 0, 1, |
| 255 | &sizehintobj)) |
| 256 | goto exit; |
| 257 | return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj); |
| 258 | |
| 259 | exit: |
| 260 | return return_value; |
| 261 | } |
| 262 | |
| 263 | PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_reset__doc__, |
| 264 | "reset($self, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 265 | "--\n" |
| 266 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 267 | |
| 268 | #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_RESET_METHODDEF \ |
| 269 | {"reset", (PyCFunction)_multibytecodec_MultibyteStreamReader_reset, METH_NOARGS, _multibytecodec_MultibyteStreamReader_reset__doc__}, |
| 270 | |
| 271 | static PyObject * |
| 272 | _multibytecodec_MultibyteStreamReader_reset_impl(MultibyteStreamReaderObject *self); |
| 273 | |
| 274 | static PyObject * |
| 275 | _multibytecodec_MultibyteStreamReader_reset(MultibyteStreamReaderObject *self, PyObject *Py_UNUSED(ignored)) |
| 276 | { |
| 277 | return _multibytecodec_MultibyteStreamReader_reset_impl(self); |
| 278 | } |
| 279 | |
| 280 | PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_write__doc__, |
| 281 | "write($self, strobj, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 282 | "--\n" |
| 283 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 284 | |
| 285 | #define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_WRITE_METHODDEF \ |
| 286 | {"write", (PyCFunction)_multibytecodec_MultibyteStreamWriter_write, METH_O, _multibytecodec_MultibyteStreamWriter_write__doc__}, |
| 287 | |
| 288 | PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_writelines__doc__, |
| 289 | "writelines($self, lines, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 290 | "--\n" |
| 291 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 292 | |
| 293 | #define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_WRITELINES_METHODDEF \ |
| 294 | {"writelines", (PyCFunction)_multibytecodec_MultibyteStreamWriter_writelines, METH_O, _multibytecodec_MultibyteStreamWriter_writelines__doc__}, |
| 295 | |
| 296 | PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_reset__doc__, |
| 297 | "reset($self, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 298 | "--\n" |
| 299 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 300 | |
| 301 | #define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_RESET_METHODDEF \ |
| 302 | {"reset", (PyCFunction)_multibytecodec_MultibyteStreamWriter_reset, METH_NOARGS, _multibytecodec_MultibyteStreamWriter_reset__doc__}, |
| 303 | |
| 304 | static PyObject * |
| 305 | _multibytecodec_MultibyteStreamWriter_reset_impl(MultibyteStreamWriterObject *self); |
| 306 | |
| 307 | static PyObject * |
| 308 | _multibytecodec_MultibyteStreamWriter_reset(MultibyteStreamWriterObject *self, PyObject *Py_UNUSED(ignored)) |
| 309 | { |
| 310 | return _multibytecodec_MultibyteStreamWriter_reset_impl(self); |
| 311 | } |
| 312 | |
| 313 | PyDoc_STRVAR(_multibytecodec___create_codec__doc__, |
| 314 | "__create_codec($module, arg, /)\n" |
Zachary Ware | 8ef887c | 2015-04-13 18:22:35 -0500 | [diff] [blame] | 315 | "--\n" |
| 316 | "\n"); |
Brett Cannon | f2de1fc | 2014-08-22 11:45:03 -0400 | [diff] [blame] | 317 | |
| 318 | #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \ |
| 319 | {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__}, |
Serhiy Storchaka | 8b2e8b6 | 2015-05-30 11:30:39 +0300 | [diff] [blame^] | 320 | /*[clinic end generated code: output=eebb21e18c3043d1 input=a9049054013a1b77]*/ |