Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 5 | PyDoc_STRVAR(_codecs_register__doc__, |
| 6 | "register($module, search_function, /)\n" |
| 7 | "--\n" |
| 8 | "\n" |
| 9 | "Register a codec search function.\n" |
| 10 | "\n" |
| 11 | "Search functions are expected to take one argument, the encoding name in\n" |
| 12 | "all lower case letters, and either return None, or a tuple of functions\n" |
| 13 | "(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object)."); |
| 14 | |
| 15 | #define _CODECS_REGISTER_METHODDEF \ |
| 16 | {"register", (PyCFunction)_codecs_register, METH_O, _codecs_register__doc__}, |
| 17 | |
| 18 | PyDoc_STRVAR(_codecs_lookup__doc__, |
| 19 | "lookup($module, encoding, /)\n" |
| 20 | "--\n" |
| 21 | "\n" |
| 22 | "Looks up a codec tuple in the Python codec registry and returns a CodecInfo object."); |
| 23 | |
| 24 | #define _CODECS_LOOKUP_METHODDEF \ |
| 25 | {"lookup", (PyCFunction)_codecs_lookup, METH_O, _codecs_lookup__doc__}, |
| 26 | |
| 27 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 28 | _codecs_lookup_impl(PyObject *module, const char *encoding); |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 29 | |
| 30 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 31 | _codecs_lookup(PyObject *module, PyObject *arg) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 32 | { |
| 33 | PyObject *return_value = NULL; |
| 34 | const char *encoding; |
| 35 | |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 36 | if (!PyArg_Parse(arg, "s:lookup", &encoding)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 37 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 38 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 39 | return_value = _codecs_lookup_impl(module, encoding); |
| 40 | |
| 41 | exit: |
| 42 | return return_value; |
| 43 | } |
| 44 | |
| 45 | PyDoc_STRVAR(_codecs_encode__doc__, |
Serhiy Storchaka | c97a962 | 2015-08-09 12:23:08 +0300 | [diff] [blame] | 46 | "encode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n" |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 47 | "--\n" |
| 48 | "\n" |
| 49 | "Encodes obj using the codec registered for encoding.\n" |
| 50 | "\n" |
Serhiy Storchaka | c97a962 | 2015-08-09 12:23:08 +0300 | [diff] [blame] | 51 | "The default encoding is \'utf-8\'. errors may be given to set a\n" |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 52 | "different error handling scheme. Default is \'strict\' meaning that encoding\n" |
| 53 | "errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n" |
| 54 | "and \'backslashreplace\' as well as any other name registered with\n" |
| 55 | "codecs.register_error that can handle ValueErrors."); |
| 56 | |
| 57 | #define _CODECS_ENCODE_METHODDEF \ |
| 58 | {"encode", (PyCFunction)_codecs_encode, METH_VARARGS|METH_KEYWORDS, _codecs_encode__doc__}, |
| 59 | |
| 60 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 61 | _codecs_encode_impl(PyObject *module, PyObject *obj, const char *encoding, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 62 | const char *errors); |
| 63 | |
| 64 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 65 | _codecs_encode(PyObject *module, PyObject *args, PyObject *kwargs) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 66 | { |
| 67 | PyObject *return_value = NULL; |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 68 | static const char * const _keywords[] = {"obj", "encoding", "errors", NULL}; |
| 69 | static _PyArg_Parser _parser = {"O|ss:encode", _keywords, 0}; |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 70 | PyObject *obj; |
| 71 | const char *encoding = NULL; |
| 72 | const char *errors = NULL; |
| 73 | |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 74 | if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 75 | &obj, &encoding, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 76 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 77 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 78 | return_value = _codecs_encode_impl(module, obj, encoding, errors); |
| 79 | |
| 80 | exit: |
| 81 | return return_value; |
| 82 | } |
| 83 | |
| 84 | PyDoc_STRVAR(_codecs_decode__doc__, |
Serhiy Storchaka | c97a962 | 2015-08-09 12:23:08 +0300 | [diff] [blame] | 85 | "decode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n" |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 86 | "--\n" |
| 87 | "\n" |
| 88 | "Decodes obj using the codec registered for encoding.\n" |
| 89 | "\n" |
Serhiy Storchaka | c97a962 | 2015-08-09 12:23:08 +0300 | [diff] [blame] | 90 | "Default encoding is \'utf-8\'. errors may be given to set a\n" |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 91 | "different error handling scheme. Default is \'strict\' meaning that encoding\n" |
| 92 | "errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n" |
| 93 | "and \'backslashreplace\' as well as any other name registered with\n" |
| 94 | "codecs.register_error that can handle ValueErrors."); |
| 95 | |
| 96 | #define _CODECS_DECODE_METHODDEF \ |
| 97 | {"decode", (PyCFunction)_codecs_decode, METH_VARARGS|METH_KEYWORDS, _codecs_decode__doc__}, |
| 98 | |
| 99 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 100 | _codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 101 | const char *errors); |
| 102 | |
| 103 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 104 | _codecs_decode(PyObject *module, PyObject *args, PyObject *kwargs) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 105 | { |
| 106 | PyObject *return_value = NULL; |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 107 | static const char * const _keywords[] = {"obj", "encoding", "errors", NULL}; |
| 108 | static _PyArg_Parser _parser = {"O|ss:decode", _keywords, 0}; |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 109 | PyObject *obj; |
| 110 | const char *encoding = NULL; |
| 111 | const char *errors = NULL; |
| 112 | |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 113 | if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 114 | &obj, &encoding, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 115 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 116 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 117 | return_value = _codecs_decode_impl(module, obj, encoding, errors); |
| 118 | |
| 119 | exit: |
| 120 | return return_value; |
| 121 | } |
| 122 | |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 123 | PyDoc_STRVAR(_codecs__forget_codec__doc__, |
| 124 | "_forget_codec($module, encoding, /)\n" |
| 125 | "--\n" |
| 126 | "\n" |
| 127 | "Purge the named codec from the internal codec lookup cache"); |
| 128 | |
| 129 | #define _CODECS__FORGET_CODEC_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 130 | {"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_O, _codecs__forget_codec__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 131 | |
| 132 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 133 | _codecs__forget_codec_impl(PyObject *module, const char *encoding); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 134 | |
| 135 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 136 | _codecs__forget_codec(PyObject *module, PyObject *arg) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 137 | { |
| 138 | PyObject *return_value = NULL; |
| 139 | const char *encoding; |
| 140 | |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 141 | if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 142 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 143 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 144 | return_value = _codecs__forget_codec_impl(module, encoding); |
| 145 | |
| 146 | exit: |
| 147 | return return_value; |
| 148 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 149 | |
| 150 | PyDoc_STRVAR(_codecs_escape_decode__doc__, |
| 151 | "escape_decode($module, data, errors=None, /)\n" |
| 152 | "--\n" |
| 153 | "\n"); |
| 154 | |
| 155 | #define _CODECS_ESCAPE_DECODE_METHODDEF \ |
| 156 | {"escape_decode", (PyCFunction)_codecs_escape_decode, METH_VARARGS, _codecs_escape_decode__doc__}, |
| 157 | |
| 158 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 159 | _codecs_escape_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 160 | const char *errors); |
| 161 | |
| 162 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 163 | _codecs_escape_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 164 | { |
| 165 | PyObject *return_value = NULL; |
| 166 | Py_buffer data = {NULL, NULL}; |
| 167 | const char *errors = NULL; |
| 168 | |
| 169 | if (!PyArg_ParseTuple(args, "s*|z:escape_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 170 | &data, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 171 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 172 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 173 | return_value = _codecs_escape_decode_impl(module, &data, errors); |
| 174 | |
| 175 | exit: |
| 176 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 177 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 178 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 179 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 180 | |
| 181 | return return_value; |
| 182 | } |
| 183 | |
| 184 | PyDoc_STRVAR(_codecs_escape_encode__doc__, |
| 185 | "escape_encode($module, data, errors=None, /)\n" |
| 186 | "--\n" |
| 187 | "\n"); |
| 188 | |
| 189 | #define _CODECS_ESCAPE_ENCODE_METHODDEF \ |
| 190 | {"escape_encode", (PyCFunction)_codecs_escape_encode, METH_VARARGS, _codecs_escape_encode__doc__}, |
| 191 | |
| 192 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 193 | _codecs_escape_encode_impl(PyObject *module, PyObject *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 194 | const char *errors); |
| 195 | |
| 196 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 197 | _codecs_escape_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 198 | { |
| 199 | PyObject *return_value = NULL; |
| 200 | PyObject *data; |
| 201 | const char *errors = NULL; |
| 202 | |
| 203 | if (!PyArg_ParseTuple(args, "O!|z:escape_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 204 | &PyBytes_Type, &data, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 205 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 206 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 207 | return_value = _codecs_escape_encode_impl(module, data, errors); |
| 208 | |
| 209 | exit: |
| 210 | return return_value; |
| 211 | } |
| 212 | |
| 213 | PyDoc_STRVAR(_codecs_unicode_internal_decode__doc__, |
| 214 | "unicode_internal_decode($module, obj, errors=None, /)\n" |
| 215 | "--\n" |
| 216 | "\n"); |
| 217 | |
| 218 | #define _CODECS_UNICODE_INTERNAL_DECODE_METHODDEF \ |
| 219 | {"unicode_internal_decode", (PyCFunction)_codecs_unicode_internal_decode, METH_VARARGS, _codecs_unicode_internal_decode__doc__}, |
| 220 | |
| 221 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 222 | _codecs_unicode_internal_decode_impl(PyObject *module, PyObject *obj, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 223 | const char *errors); |
| 224 | |
| 225 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 226 | _codecs_unicode_internal_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 227 | { |
| 228 | PyObject *return_value = NULL; |
| 229 | PyObject *obj; |
| 230 | const char *errors = NULL; |
| 231 | |
| 232 | if (!PyArg_ParseTuple(args, "O|z:unicode_internal_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 233 | &obj, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 234 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 235 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 236 | return_value = _codecs_unicode_internal_decode_impl(module, obj, errors); |
| 237 | |
| 238 | exit: |
| 239 | return return_value; |
| 240 | } |
| 241 | |
| 242 | PyDoc_STRVAR(_codecs_utf_7_decode__doc__, |
| 243 | "utf_7_decode($module, data, errors=None, final=False, /)\n" |
| 244 | "--\n" |
| 245 | "\n"); |
| 246 | |
| 247 | #define _CODECS_UTF_7_DECODE_METHODDEF \ |
| 248 | {"utf_7_decode", (PyCFunction)_codecs_utf_7_decode, METH_VARARGS, _codecs_utf_7_decode__doc__}, |
| 249 | |
| 250 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 251 | _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 252 | const char *errors, int final); |
| 253 | |
| 254 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 255 | _codecs_utf_7_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 256 | { |
| 257 | PyObject *return_value = NULL; |
| 258 | Py_buffer data = {NULL, NULL}; |
| 259 | const char *errors = NULL; |
| 260 | int final = 0; |
| 261 | |
| 262 | if (!PyArg_ParseTuple(args, "y*|zi:utf_7_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 263 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 264 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 265 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 266 | return_value = _codecs_utf_7_decode_impl(module, &data, errors, final); |
| 267 | |
| 268 | exit: |
| 269 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 270 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 271 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 272 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 273 | |
| 274 | return return_value; |
| 275 | } |
| 276 | |
| 277 | PyDoc_STRVAR(_codecs_utf_8_decode__doc__, |
| 278 | "utf_8_decode($module, data, errors=None, final=False, /)\n" |
| 279 | "--\n" |
| 280 | "\n"); |
| 281 | |
| 282 | #define _CODECS_UTF_8_DECODE_METHODDEF \ |
| 283 | {"utf_8_decode", (PyCFunction)_codecs_utf_8_decode, METH_VARARGS, _codecs_utf_8_decode__doc__}, |
| 284 | |
| 285 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 286 | _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 287 | const char *errors, int final); |
| 288 | |
| 289 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 290 | _codecs_utf_8_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 291 | { |
| 292 | PyObject *return_value = NULL; |
| 293 | Py_buffer data = {NULL, NULL}; |
| 294 | const char *errors = NULL; |
| 295 | int final = 0; |
| 296 | |
| 297 | if (!PyArg_ParseTuple(args, "y*|zi:utf_8_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 298 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 299 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 300 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 301 | return_value = _codecs_utf_8_decode_impl(module, &data, errors, final); |
| 302 | |
| 303 | exit: |
| 304 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 305 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 306 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 307 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 308 | |
| 309 | return return_value; |
| 310 | } |
| 311 | |
| 312 | PyDoc_STRVAR(_codecs_utf_16_decode__doc__, |
| 313 | "utf_16_decode($module, data, errors=None, final=False, /)\n" |
| 314 | "--\n" |
| 315 | "\n"); |
| 316 | |
| 317 | #define _CODECS_UTF_16_DECODE_METHODDEF \ |
| 318 | {"utf_16_decode", (PyCFunction)_codecs_utf_16_decode, METH_VARARGS, _codecs_utf_16_decode__doc__}, |
| 319 | |
| 320 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 321 | _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 322 | const char *errors, int final); |
| 323 | |
| 324 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 325 | _codecs_utf_16_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 326 | { |
| 327 | PyObject *return_value = NULL; |
| 328 | Py_buffer data = {NULL, NULL}; |
| 329 | const char *errors = NULL; |
| 330 | int final = 0; |
| 331 | |
| 332 | if (!PyArg_ParseTuple(args, "y*|zi:utf_16_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 333 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 334 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 335 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 336 | return_value = _codecs_utf_16_decode_impl(module, &data, errors, final); |
| 337 | |
| 338 | exit: |
| 339 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 340 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 341 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 342 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 343 | |
| 344 | return return_value; |
| 345 | } |
| 346 | |
| 347 | PyDoc_STRVAR(_codecs_utf_16_le_decode__doc__, |
| 348 | "utf_16_le_decode($module, data, errors=None, final=False, /)\n" |
| 349 | "--\n" |
| 350 | "\n"); |
| 351 | |
| 352 | #define _CODECS_UTF_16_LE_DECODE_METHODDEF \ |
| 353 | {"utf_16_le_decode", (PyCFunction)_codecs_utf_16_le_decode, METH_VARARGS, _codecs_utf_16_le_decode__doc__}, |
| 354 | |
| 355 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 356 | _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 357 | const char *errors, int final); |
| 358 | |
| 359 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 360 | _codecs_utf_16_le_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 361 | { |
| 362 | PyObject *return_value = NULL; |
| 363 | Py_buffer data = {NULL, NULL}; |
| 364 | const char *errors = NULL; |
| 365 | int final = 0; |
| 366 | |
| 367 | if (!PyArg_ParseTuple(args, "y*|zi:utf_16_le_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 368 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 369 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 370 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 371 | return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final); |
| 372 | |
| 373 | exit: |
| 374 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 375 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 376 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 377 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 378 | |
| 379 | return return_value; |
| 380 | } |
| 381 | |
| 382 | PyDoc_STRVAR(_codecs_utf_16_be_decode__doc__, |
| 383 | "utf_16_be_decode($module, data, errors=None, final=False, /)\n" |
| 384 | "--\n" |
| 385 | "\n"); |
| 386 | |
| 387 | #define _CODECS_UTF_16_BE_DECODE_METHODDEF \ |
| 388 | {"utf_16_be_decode", (PyCFunction)_codecs_utf_16_be_decode, METH_VARARGS, _codecs_utf_16_be_decode__doc__}, |
| 389 | |
| 390 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 391 | _codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 392 | const char *errors, int final); |
| 393 | |
| 394 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 395 | _codecs_utf_16_be_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 396 | { |
| 397 | PyObject *return_value = NULL; |
| 398 | Py_buffer data = {NULL, NULL}; |
| 399 | const char *errors = NULL; |
| 400 | int final = 0; |
| 401 | |
| 402 | if (!PyArg_ParseTuple(args, "y*|zi:utf_16_be_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 403 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 404 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 405 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 406 | return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final); |
| 407 | |
| 408 | exit: |
| 409 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 410 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 411 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 412 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 413 | |
| 414 | return return_value; |
| 415 | } |
| 416 | |
| 417 | PyDoc_STRVAR(_codecs_utf_16_ex_decode__doc__, |
| 418 | "utf_16_ex_decode($module, data, errors=None, byteorder=0, final=False,\n" |
| 419 | " /)\n" |
| 420 | "--\n" |
| 421 | "\n"); |
| 422 | |
| 423 | #define _CODECS_UTF_16_EX_DECODE_METHODDEF \ |
| 424 | {"utf_16_ex_decode", (PyCFunction)_codecs_utf_16_ex_decode, METH_VARARGS, _codecs_utf_16_ex_decode__doc__}, |
| 425 | |
| 426 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 427 | _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 428 | const char *errors, int byteorder, int final); |
| 429 | |
| 430 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 431 | _codecs_utf_16_ex_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 432 | { |
| 433 | PyObject *return_value = NULL; |
| 434 | Py_buffer data = {NULL, NULL}; |
| 435 | const char *errors = NULL; |
| 436 | int byteorder = 0; |
| 437 | int final = 0; |
| 438 | |
| 439 | if (!PyArg_ParseTuple(args, "y*|zii:utf_16_ex_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 440 | &data, &errors, &byteorder, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 441 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 442 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 443 | return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final); |
| 444 | |
| 445 | exit: |
| 446 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 447 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 448 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 449 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 450 | |
| 451 | return return_value; |
| 452 | } |
| 453 | |
| 454 | PyDoc_STRVAR(_codecs_utf_32_decode__doc__, |
| 455 | "utf_32_decode($module, data, errors=None, final=False, /)\n" |
| 456 | "--\n" |
| 457 | "\n"); |
| 458 | |
| 459 | #define _CODECS_UTF_32_DECODE_METHODDEF \ |
| 460 | {"utf_32_decode", (PyCFunction)_codecs_utf_32_decode, METH_VARARGS, _codecs_utf_32_decode__doc__}, |
| 461 | |
| 462 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 463 | _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 464 | const char *errors, int final); |
| 465 | |
| 466 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 467 | _codecs_utf_32_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 468 | { |
| 469 | PyObject *return_value = NULL; |
| 470 | Py_buffer data = {NULL, NULL}; |
| 471 | const char *errors = NULL; |
| 472 | int final = 0; |
| 473 | |
| 474 | if (!PyArg_ParseTuple(args, "y*|zi:utf_32_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 475 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 476 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 477 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 478 | return_value = _codecs_utf_32_decode_impl(module, &data, errors, final); |
| 479 | |
| 480 | exit: |
| 481 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 482 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 483 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 484 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 485 | |
| 486 | return return_value; |
| 487 | } |
| 488 | |
| 489 | PyDoc_STRVAR(_codecs_utf_32_le_decode__doc__, |
| 490 | "utf_32_le_decode($module, data, errors=None, final=False, /)\n" |
| 491 | "--\n" |
| 492 | "\n"); |
| 493 | |
| 494 | #define _CODECS_UTF_32_LE_DECODE_METHODDEF \ |
| 495 | {"utf_32_le_decode", (PyCFunction)_codecs_utf_32_le_decode, METH_VARARGS, _codecs_utf_32_le_decode__doc__}, |
| 496 | |
| 497 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 498 | _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 499 | const char *errors, int final); |
| 500 | |
| 501 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 502 | _codecs_utf_32_le_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 503 | { |
| 504 | PyObject *return_value = NULL; |
| 505 | Py_buffer data = {NULL, NULL}; |
| 506 | const char *errors = NULL; |
| 507 | int final = 0; |
| 508 | |
| 509 | if (!PyArg_ParseTuple(args, "y*|zi:utf_32_le_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 510 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 511 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 512 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 513 | return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final); |
| 514 | |
| 515 | exit: |
| 516 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 517 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 518 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 519 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 520 | |
| 521 | return return_value; |
| 522 | } |
| 523 | |
| 524 | PyDoc_STRVAR(_codecs_utf_32_be_decode__doc__, |
| 525 | "utf_32_be_decode($module, data, errors=None, final=False, /)\n" |
| 526 | "--\n" |
| 527 | "\n"); |
| 528 | |
| 529 | #define _CODECS_UTF_32_BE_DECODE_METHODDEF \ |
| 530 | {"utf_32_be_decode", (PyCFunction)_codecs_utf_32_be_decode, METH_VARARGS, _codecs_utf_32_be_decode__doc__}, |
| 531 | |
| 532 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 533 | _codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 534 | const char *errors, int final); |
| 535 | |
| 536 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 537 | _codecs_utf_32_be_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 538 | { |
| 539 | PyObject *return_value = NULL; |
| 540 | Py_buffer data = {NULL, NULL}; |
| 541 | const char *errors = NULL; |
| 542 | int final = 0; |
| 543 | |
| 544 | if (!PyArg_ParseTuple(args, "y*|zi:utf_32_be_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 545 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 546 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 547 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 548 | return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final); |
| 549 | |
| 550 | exit: |
| 551 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 552 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 553 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 554 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 555 | |
| 556 | return return_value; |
| 557 | } |
| 558 | |
| 559 | PyDoc_STRVAR(_codecs_utf_32_ex_decode__doc__, |
| 560 | "utf_32_ex_decode($module, data, errors=None, byteorder=0, final=False,\n" |
| 561 | " /)\n" |
| 562 | "--\n" |
| 563 | "\n"); |
| 564 | |
| 565 | #define _CODECS_UTF_32_EX_DECODE_METHODDEF \ |
| 566 | {"utf_32_ex_decode", (PyCFunction)_codecs_utf_32_ex_decode, METH_VARARGS, _codecs_utf_32_ex_decode__doc__}, |
| 567 | |
| 568 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 569 | _codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 570 | const char *errors, int byteorder, int final); |
| 571 | |
| 572 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 573 | _codecs_utf_32_ex_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 574 | { |
| 575 | PyObject *return_value = NULL; |
| 576 | Py_buffer data = {NULL, NULL}; |
| 577 | const char *errors = NULL; |
| 578 | int byteorder = 0; |
| 579 | int final = 0; |
| 580 | |
| 581 | if (!PyArg_ParseTuple(args, "y*|zii:utf_32_ex_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 582 | &data, &errors, &byteorder, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 583 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 584 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 585 | return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final); |
| 586 | |
| 587 | exit: |
| 588 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 589 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 590 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 591 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 592 | |
| 593 | return return_value; |
| 594 | } |
| 595 | |
| 596 | PyDoc_STRVAR(_codecs_unicode_escape_decode__doc__, |
| 597 | "unicode_escape_decode($module, data, errors=None, /)\n" |
| 598 | "--\n" |
| 599 | "\n"); |
| 600 | |
| 601 | #define _CODECS_UNICODE_ESCAPE_DECODE_METHODDEF \ |
| 602 | {"unicode_escape_decode", (PyCFunction)_codecs_unicode_escape_decode, METH_VARARGS, _codecs_unicode_escape_decode__doc__}, |
| 603 | |
| 604 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 605 | _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 606 | const char *errors); |
| 607 | |
| 608 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 609 | _codecs_unicode_escape_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 610 | { |
| 611 | PyObject *return_value = NULL; |
| 612 | Py_buffer data = {NULL, NULL}; |
| 613 | const char *errors = NULL; |
| 614 | |
| 615 | if (!PyArg_ParseTuple(args, "s*|z:unicode_escape_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 616 | &data, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 617 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 618 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 619 | return_value = _codecs_unicode_escape_decode_impl(module, &data, errors); |
| 620 | |
| 621 | exit: |
| 622 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 623 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 624 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 625 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 626 | |
| 627 | return return_value; |
| 628 | } |
| 629 | |
| 630 | PyDoc_STRVAR(_codecs_raw_unicode_escape_decode__doc__, |
| 631 | "raw_unicode_escape_decode($module, data, errors=None, /)\n" |
| 632 | "--\n" |
| 633 | "\n"); |
| 634 | |
| 635 | #define _CODECS_RAW_UNICODE_ESCAPE_DECODE_METHODDEF \ |
| 636 | {"raw_unicode_escape_decode", (PyCFunction)_codecs_raw_unicode_escape_decode, METH_VARARGS, _codecs_raw_unicode_escape_decode__doc__}, |
| 637 | |
| 638 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 639 | _codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 640 | const char *errors); |
| 641 | |
| 642 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 643 | _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 644 | { |
| 645 | PyObject *return_value = NULL; |
| 646 | Py_buffer data = {NULL, NULL}; |
| 647 | const char *errors = NULL; |
| 648 | |
| 649 | if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 650 | &data, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 651 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 652 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 653 | return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors); |
| 654 | |
| 655 | exit: |
| 656 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 657 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 658 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 659 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 660 | |
| 661 | return return_value; |
| 662 | } |
| 663 | |
| 664 | PyDoc_STRVAR(_codecs_latin_1_decode__doc__, |
| 665 | "latin_1_decode($module, data, errors=None, /)\n" |
| 666 | "--\n" |
| 667 | "\n"); |
| 668 | |
| 669 | #define _CODECS_LATIN_1_DECODE_METHODDEF \ |
| 670 | {"latin_1_decode", (PyCFunction)_codecs_latin_1_decode, METH_VARARGS, _codecs_latin_1_decode__doc__}, |
| 671 | |
| 672 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 673 | _codecs_latin_1_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 674 | const char *errors); |
| 675 | |
| 676 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 677 | _codecs_latin_1_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 678 | { |
| 679 | PyObject *return_value = NULL; |
| 680 | Py_buffer data = {NULL, NULL}; |
| 681 | const char *errors = NULL; |
| 682 | |
| 683 | if (!PyArg_ParseTuple(args, "y*|z:latin_1_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 684 | &data, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 685 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 686 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 687 | return_value = _codecs_latin_1_decode_impl(module, &data, errors); |
| 688 | |
| 689 | exit: |
| 690 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 691 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 692 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 693 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 694 | |
| 695 | return return_value; |
| 696 | } |
| 697 | |
| 698 | PyDoc_STRVAR(_codecs_ascii_decode__doc__, |
| 699 | "ascii_decode($module, data, errors=None, /)\n" |
| 700 | "--\n" |
| 701 | "\n"); |
| 702 | |
| 703 | #define _CODECS_ASCII_DECODE_METHODDEF \ |
| 704 | {"ascii_decode", (PyCFunction)_codecs_ascii_decode, METH_VARARGS, _codecs_ascii_decode__doc__}, |
| 705 | |
| 706 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 707 | _codecs_ascii_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 708 | const char *errors); |
| 709 | |
| 710 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 711 | _codecs_ascii_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 712 | { |
| 713 | PyObject *return_value = NULL; |
| 714 | Py_buffer data = {NULL, NULL}; |
| 715 | const char *errors = NULL; |
| 716 | |
| 717 | if (!PyArg_ParseTuple(args, "y*|z:ascii_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 718 | &data, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 719 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 720 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 721 | return_value = _codecs_ascii_decode_impl(module, &data, errors); |
| 722 | |
| 723 | exit: |
| 724 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 725 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 726 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 727 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 728 | |
| 729 | return return_value; |
| 730 | } |
| 731 | |
| 732 | PyDoc_STRVAR(_codecs_charmap_decode__doc__, |
| 733 | "charmap_decode($module, data, errors=None, mapping=None, /)\n" |
| 734 | "--\n" |
| 735 | "\n"); |
| 736 | |
| 737 | #define _CODECS_CHARMAP_DECODE_METHODDEF \ |
| 738 | {"charmap_decode", (PyCFunction)_codecs_charmap_decode, METH_VARARGS, _codecs_charmap_decode__doc__}, |
| 739 | |
| 740 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 741 | _codecs_charmap_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 742 | const char *errors, PyObject *mapping); |
| 743 | |
| 744 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 745 | _codecs_charmap_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 746 | { |
| 747 | PyObject *return_value = NULL; |
| 748 | Py_buffer data = {NULL, NULL}; |
| 749 | const char *errors = NULL; |
| 750 | PyObject *mapping = NULL; |
| 751 | |
| 752 | if (!PyArg_ParseTuple(args, "y*|zO:charmap_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 753 | &data, &errors, &mapping)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 754 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 755 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 756 | return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping); |
| 757 | |
| 758 | exit: |
| 759 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 760 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 761 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 762 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 763 | |
| 764 | return return_value; |
| 765 | } |
| 766 | |
| 767 | #if defined(HAVE_MBCS) |
| 768 | |
| 769 | PyDoc_STRVAR(_codecs_mbcs_decode__doc__, |
| 770 | "mbcs_decode($module, data, errors=None, final=False, /)\n" |
| 771 | "--\n" |
| 772 | "\n"); |
| 773 | |
| 774 | #define _CODECS_MBCS_DECODE_METHODDEF \ |
| 775 | {"mbcs_decode", (PyCFunction)_codecs_mbcs_decode, METH_VARARGS, _codecs_mbcs_decode__doc__}, |
| 776 | |
| 777 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 778 | _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 779 | const char *errors, int final); |
| 780 | |
| 781 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 782 | _codecs_mbcs_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 783 | { |
| 784 | PyObject *return_value = NULL; |
| 785 | Py_buffer data = {NULL, NULL}; |
| 786 | const char *errors = NULL; |
| 787 | int final = 0; |
| 788 | |
| 789 | if (!PyArg_ParseTuple(args, "y*|zi:mbcs_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 790 | &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 791 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 792 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 793 | return_value = _codecs_mbcs_decode_impl(module, &data, errors, final); |
| 794 | |
| 795 | exit: |
| 796 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 797 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 798 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 799 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 800 | |
| 801 | return return_value; |
| 802 | } |
| 803 | |
| 804 | #endif /* defined(HAVE_MBCS) */ |
| 805 | |
| 806 | #if defined(HAVE_MBCS) |
| 807 | |
Steve Dower | f5aba58 | 2016-09-06 19:42:27 -0700 | [diff] [blame^] | 808 | PyDoc_STRVAR(_codecs_oem_decode__doc__, |
| 809 | "oem_decode($module, data, errors=None, final=False, /)\n" |
| 810 | "--\n" |
| 811 | "\n"); |
| 812 | |
| 813 | #define _CODECS_OEM_DECODE_METHODDEF \ |
| 814 | {"oem_decode", (PyCFunction)_codecs_oem_decode, METH_VARARGS, _codecs_oem_decode__doc__}, |
| 815 | |
| 816 | static PyObject * |
| 817 | _codecs_oem_decode_impl(PyObject *module, Py_buffer *data, |
| 818 | const char *errors, int final); |
| 819 | |
| 820 | static PyObject * |
| 821 | _codecs_oem_decode(PyObject *module, PyObject *args) |
| 822 | { |
| 823 | PyObject *return_value = NULL; |
| 824 | Py_buffer data = {NULL, NULL}; |
| 825 | const char *errors = NULL; |
| 826 | int final = 0; |
| 827 | |
| 828 | if (!PyArg_ParseTuple(args, "y*|zi:oem_decode", |
| 829 | &data, &errors, &final)) { |
| 830 | goto exit; |
| 831 | } |
| 832 | return_value = _codecs_oem_decode_impl(module, &data, errors, final); |
| 833 | |
| 834 | exit: |
| 835 | /* Cleanup for data */ |
| 836 | if (data.obj) { |
| 837 | PyBuffer_Release(&data); |
| 838 | } |
| 839 | |
| 840 | return return_value; |
| 841 | } |
| 842 | |
| 843 | #endif /* defined(HAVE_MBCS) */ |
| 844 | |
| 845 | #if defined(HAVE_MBCS) |
| 846 | |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 847 | PyDoc_STRVAR(_codecs_code_page_decode__doc__, |
| 848 | "code_page_decode($module, codepage, data, errors=None, final=False, /)\n" |
| 849 | "--\n" |
| 850 | "\n"); |
| 851 | |
| 852 | #define _CODECS_CODE_PAGE_DECODE_METHODDEF \ |
| 853 | {"code_page_decode", (PyCFunction)_codecs_code_page_decode, METH_VARARGS, _codecs_code_page_decode__doc__}, |
| 854 | |
| 855 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 856 | _codecs_code_page_decode_impl(PyObject *module, int codepage, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 857 | Py_buffer *data, const char *errors, int final); |
| 858 | |
| 859 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 860 | _codecs_code_page_decode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 861 | { |
| 862 | PyObject *return_value = NULL; |
| 863 | int codepage; |
| 864 | Py_buffer data = {NULL, NULL}; |
| 865 | const char *errors = NULL; |
| 866 | int final = 0; |
| 867 | |
| 868 | if (!PyArg_ParseTuple(args, "iy*|zi:code_page_decode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 869 | &codepage, &data, &errors, &final)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 870 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 871 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 872 | return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final); |
| 873 | |
| 874 | exit: |
| 875 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 876 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 877 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 878 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 879 | |
| 880 | return return_value; |
| 881 | } |
| 882 | |
| 883 | #endif /* defined(HAVE_MBCS) */ |
| 884 | |
| 885 | PyDoc_STRVAR(_codecs_readbuffer_encode__doc__, |
| 886 | "readbuffer_encode($module, data, errors=None, /)\n" |
| 887 | "--\n" |
| 888 | "\n"); |
| 889 | |
| 890 | #define _CODECS_READBUFFER_ENCODE_METHODDEF \ |
| 891 | {"readbuffer_encode", (PyCFunction)_codecs_readbuffer_encode, METH_VARARGS, _codecs_readbuffer_encode__doc__}, |
| 892 | |
| 893 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 894 | _codecs_readbuffer_encode_impl(PyObject *module, Py_buffer *data, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 895 | const char *errors); |
| 896 | |
| 897 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 898 | _codecs_readbuffer_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 899 | { |
| 900 | PyObject *return_value = NULL; |
| 901 | Py_buffer data = {NULL, NULL}; |
| 902 | const char *errors = NULL; |
| 903 | |
| 904 | if (!PyArg_ParseTuple(args, "s*|z:readbuffer_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 905 | &data, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 906 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 907 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 908 | return_value = _codecs_readbuffer_encode_impl(module, &data, errors); |
| 909 | |
| 910 | exit: |
| 911 | /* Cleanup for data */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 912 | if (data.obj) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 913 | PyBuffer_Release(&data); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 914 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 915 | |
| 916 | return return_value; |
| 917 | } |
| 918 | |
| 919 | PyDoc_STRVAR(_codecs_unicode_internal_encode__doc__, |
| 920 | "unicode_internal_encode($module, obj, errors=None, /)\n" |
| 921 | "--\n" |
| 922 | "\n"); |
| 923 | |
| 924 | #define _CODECS_UNICODE_INTERNAL_ENCODE_METHODDEF \ |
| 925 | {"unicode_internal_encode", (PyCFunction)_codecs_unicode_internal_encode, METH_VARARGS, _codecs_unicode_internal_encode__doc__}, |
| 926 | |
| 927 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 928 | _codecs_unicode_internal_encode_impl(PyObject *module, PyObject *obj, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 929 | const char *errors); |
| 930 | |
| 931 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 932 | _codecs_unicode_internal_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 933 | { |
| 934 | PyObject *return_value = NULL; |
| 935 | PyObject *obj; |
| 936 | const char *errors = NULL; |
| 937 | |
| 938 | if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 939 | &obj, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 940 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 941 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 942 | return_value = _codecs_unicode_internal_encode_impl(module, obj, errors); |
| 943 | |
| 944 | exit: |
| 945 | return return_value; |
| 946 | } |
| 947 | |
| 948 | PyDoc_STRVAR(_codecs_utf_7_encode__doc__, |
| 949 | "utf_7_encode($module, str, errors=None, /)\n" |
| 950 | "--\n" |
| 951 | "\n"); |
| 952 | |
| 953 | #define _CODECS_UTF_7_ENCODE_METHODDEF \ |
| 954 | {"utf_7_encode", (PyCFunction)_codecs_utf_7_encode, METH_VARARGS, _codecs_utf_7_encode__doc__}, |
| 955 | |
| 956 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 957 | _codecs_utf_7_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 958 | const char *errors); |
| 959 | |
| 960 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 961 | _codecs_utf_7_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 962 | { |
| 963 | PyObject *return_value = NULL; |
| 964 | PyObject *str; |
| 965 | const char *errors = NULL; |
| 966 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 967 | if (!PyArg_ParseTuple(args, "U|z:utf_7_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 968 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 969 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 970 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 971 | return_value = _codecs_utf_7_encode_impl(module, str, errors); |
| 972 | |
| 973 | exit: |
| 974 | return return_value; |
| 975 | } |
| 976 | |
| 977 | PyDoc_STRVAR(_codecs_utf_8_encode__doc__, |
| 978 | "utf_8_encode($module, str, errors=None, /)\n" |
| 979 | "--\n" |
| 980 | "\n"); |
| 981 | |
| 982 | #define _CODECS_UTF_8_ENCODE_METHODDEF \ |
| 983 | {"utf_8_encode", (PyCFunction)_codecs_utf_8_encode, METH_VARARGS, _codecs_utf_8_encode__doc__}, |
| 984 | |
| 985 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 986 | _codecs_utf_8_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 987 | const char *errors); |
| 988 | |
| 989 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 990 | _codecs_utf_8_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 991 | { |
| 992 | PyObject *return_value = NULL; |
| 993 | PyObject *str; |
| 994 | const char *errors = NULL; |
| 995 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 996 | if (!PyArg_ParseTuple(args, "U|z:utf_8_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 997 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 998 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 999 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1000 | return_value = _codecs_utf_8_encode_impl(module, str, errors); |
| 1001 | |
| 1002 | exit: |
| 1003 | return return_value; |
| 1004 | } |
| 1005 | |
| 1006 | PyDoc_STRVAR(_codecs_utf_16_encode__doc__, |
| 1007 | "utf_16_encode($module, str, errors=None, byteorder=0, /)\n" |
| 1008 | "--\n" |
| 1009 | "\n"); |
| 1010 | |
| 1011 | #define _CODECS_UTF_16_ENCODE_METHODDEF \ |
| 1012 | {"utf_16_encode", (PyCFunction)_codecs_utf_16_encode, METH_VARARGS, _codecs_utf_16_encode__doc__}, |
| 1013 | |
| 1014 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1015 | _codecs_utf_16_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1016 | const char *errors, int byteorder); |
| 1017 | |
| 1018 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1019 | _codecs_utf_16_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1020 | { |
| 1021 | PyObject *return_value = NULL; |
| 1022 | PyObject *str; |
| 1023 | const char *errors = NULL; |
| 1024 | int byteorder = 0; |
| 1025 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1026 | if (!PyArg_ParseTuple(args, "U|zi:utf_16_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1027 | &str, &errors, &byteorder)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1028 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1029 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1030 | return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder); |
| 1031 | |
| 1032 | exit: |
| 1033 | return return_value; |
| 1034 | } |
| 1035 | |
| 1036 | PyDoc_STRVAR(_codecs_utf_16_le_encode__doc__, |
| 1037 | "utf_16_le_encode($module, str, errors=None, /)\n" |
| 1038 | "--\n" |
| 1039 | "\n"); |
| 1040 | |
| 1041 | #define _CODECS_UTF_16_LE_ENCODE_METHODDEF \ |
| 1042 | {"utf_16_le_encode", (PyCFunction)_codecs_utf_16_le_encode, METH_VARARGS, _codecs_utf_16_le_encode__doc__}, |
| 1043 | |
| 1044 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1045 | _codecs_utf_16_le_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1046 | const char *errors); |
| 1047 | |
| 1048 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1049 | _codecs_utf_16_le_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1050 | { |
| 1051 | PyObject *return_value = NULL; |
| 1052 | PyObject *str; |
| 1053 | const char *errors = NULL; |
| 1054 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1055 | if (!PyArg_ParseTuple(args, "U|z:utf_16_le_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1056 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1057 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1058 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1059 | return_value = _codecs_utf_16_le_encode_impl(module, str, errors); |
| 1060 | |
| 1061 | exit: |
| 1062 | return return_value; |
| 1063 | } |
| 1064 | |
| 1065 | PyDoc_STRVAR(_codecs_utf_16_be_encode__doc__, |
| 1066 | "utf_16_be_encode($module, str, errors=None, /)\n" |
| 1067 | "--\n" |
| 1068 | "\n"); |
| 1069 | |
| 1070 | #define _CODECS_UTF_16_BE_ENCODE_METHODDEF \ |
| 1071 | {"utf_16_be_encode", (PyCFunction)_codecs_utf_16_be_encode, METH_VARARGS, _codecs_utf_16_be_encode__doc__}, |
| 1072 | |
| 1073 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1074 | _codecs_utf_16_be_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1075 | const char *errors); |
| 1076 | |
| 1077 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1078 | _codecs_utf_16_be_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1079 | { |
| 1080 | PyObject *return_value = NULL; |
| 1081 | PyObject *str; |
| 1082 | const char *errors = NULL; |
| 1083 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1084 | if (!PyArg_ParseTuple(args, "U|z:utf_16_be_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1085 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1086 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1087 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1088 | return_value = _codecs_utf_16_be_encode_impl(module, str, errors); |
| 1089 | |
| 1090 | exit: |
| 1091 | return return_value; |
| 1092 | } |
| 1093 | |
| 1094 | PyDoc_STRVAR(_codecs_utf_32_encode__doc__, |
| 1095 | "utf_32_encode($module, str, errors=None, byteorder=0, /)\n" |
| 1096 | "--\n" |
| 1097 | "\n"); |
| 1098 | |
| 1099 | #define _CODECS_UTF_32_ENCODE_METHODDEF \ |
| 1100 | {"utf_32_encode", (PyCFunction)_codecs_utf_32_encode, METH_VARARGS, _codecs_utf_32_encode__doc__}, |
| 1101 | |
| 1102 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1103 | _codecs_utf_32_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1104 | const char *errors, int byteorder); |
| 1105 | |
| 1106 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1107 | _codecs_utf_32_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1108 | { |
| 1109 | PyObject *return_value = NULL; |
| 1110 | PyObject *str; |
| 1111 | const char *errors = NULL; |
| 1112 | int byteorder = 0; |
| 1113 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1114 | if (!PyArg_ParseTuple(args, "U|zi:utf_32_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1115 | &str, &errors, &byteorder)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1116 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1117 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1118 | return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder); |
| 1119 | |
| 1120 | exit: |
| 1121 | return return_value; |
| 1122 | } |
| 1123 | |
| 1124 | PyDoc_STRVAR(_codecs_utf_32_le_encode__doc__, |
| 1125 | "utf_32_le_encode($module, str, errors=None, /)\n" |
| 1126 | "--\n" |
| 1127 | "\n"); |
| 1128 | |
| 1129 | #define _CODECS_UTF_32_LE_ENCODE_METHODDEF \ |
| 1130 | {"utf_32_le_encode", (PyCFunction)_codecs_utf_32_le_encode, METH_VARARGS, _codecs_utf_32_le_encode__doc__}, |
| 1131 | |
| 1132 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1133 | _codecs_utf_32_le_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1134 | const char *errors); |
| 1135 | |
| 1136 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1137 | _codecs_utf_32_le_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1138 | { |
| 1139 | PyObject *return_value = NULL; |
| 1140 | PyObject *str; |
| 1141 | const char *errors = NULL; |
| 1142 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1143 | if (!PyArg_ParseTuple(args, "U|z:utf_32_le_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1144 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1145 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1146 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1147 | return_value = _codecs_utf_32_le_encode_impl(module, str, errors); |
| 1148 | |
| 1149 | exit: |
| 1150 | return return_value; |
| 1151 | } |
| 1152 | |
| 1153 | PyDoc_STRVAR(_codecs_utf_32_be_encode__doc__, |
| 1154 | "utf_32_be_encode($module, str, errors=None, /)\n" |
| 1155 | "--\n" |
| 1156 | "\n"); |
| 1157 | |
| 1158 | #define _CODECS_UTF_32_BE_ENCODE_METHODDEF \ |
| 1159 | {"utf_32_be_encode", (PyCFunction)_codecs_utf_32_be_encode, METH_VARARGS, _codecs_utf_32_be_encode__doc__}, |
| 1160 | |
| 1161 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1162 | _codecs_utf_32_be_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1163 | const char *errors); |
| 1164 | |
| 1165 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1166 | _codecs_utf_32_be_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1167 | { |
| 1168 | PyObject *return_value = NULL; |
| 1169 | PyObject *str; |
| 1170 | const char *errors = NULL; |
| 1171 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1172 | if (!PyArg_ParseTuple(args, "U|z:utf_32_be_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1173 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1174 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1175 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1176 | return_value = _codecs_utf_32_be_encode_impl(module, str, errors); |
| 1177 | |
| 1178 | exit: |
| 1179 | return return_value; |
| 1180 | } |
| 1181 | |
| 1182 | PyDoc_STRVAR(_codecs_unicode_escape_encode__doc__, |
| 1183 | "unicode_escape_encode($module, str, errors=None, /)\n" |
| 1184 | "--\n" |
| 1185 | "\n"); |
| 1186 | |
| 1187 | #define _CODECS_UNICODE_ESCAPE_ENCODE_METHODDEF \ |
| 1188 | {"unicode_escape_encode", (PyCFunction)_codecs_unicode_escape_encode, METH_VARARGS, _codecs_unicode_escape_encode__doc__}, |
| 1189 | |
| 1190 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1191 | _codecs_unicode_escape_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1192 | const char *errors); |
| 1193 | |
| 1194 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1195 | _codecs_unicode_escape_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1196 | { |
| 1197 | PyObject *return_value = NULL; |
| 1198 | PyObject *str; |
| 1199 | const char *errors = NULL; |
| 1200 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1201 | if (!PyArg_ParseTuple(args, "U|z:unicode_escape_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1202 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1203 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1204 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1205 | return_value = _codecs_unicode_escape_encode_impl(module, str, errors); |
| 1206 | |
| 1207 | exit: |
| 1208 | return return_value; |
| 1209 | } |
| 1210 | |
| 1211 | PyDoc_STRVAR(_codecs_raw_unicode_escape_encode__doc__, |
| 1212 | "raw_unicode_escape_encode($module, str, errors=None, /)\n" |
| 1213 | "--\n" |
| 1214 | "\n"); |
| 1215 | |
| 1216 | #define _CODECS_RAW_UNICODE_ESCAPE_ENCODE_METHODDEF \ |
| 1217 | {"raw_unicode_escape_encode", (PyCFunction)_codecs_raw_unicode_escape_encode, METH_VARARGS, _codecs_raw_unicode_escape_encode__doc__}, |
| 1218 | |
| 1219 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1220 | _codecs_raw_unicode_escape_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1221 | const char *errors); |
| 1222 | |
| 1223 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1224 | _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1225 | { |
| 1226 | PyObject *return_value = NULL; |
| 1227 | PyObject *str; |
| 1228 | const char *errors = NULL; |
| 1229 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1230 | if (!PyArg_ParseTuple(args, "U|z:raw_unicode_escape_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1231 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1232 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1233 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1234 | return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors); |
| 1235 | |
| 1236 | exit: |
| 1237 | return return_value; |
| 1238 | } |
| 1239 | |
| 1240 | PyDoc_STRVAR(_codecs_latin_1_encode__doc__, |
| 1241 | "latin_1_encode($module, str, errors=None, /)\n" |
| 1242 | "--\n" |
| 1243 | "\n"); |
| 1244 | |
| 1245 | #define _CODECS_LATIN_1_ENCODE_METHODDEF \ |
| 1246 | {"latin_1_encode", (PyCFunction)_codecs_latin_1_encode, METH_VARARGS, _codecs_latin_1_encode__doc__}, |
| 1247 | |
| 1248 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1249 | _codecs_latin_1_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1250 | const char *errors); |
| 1251 | |
| 1252 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1253 | _codecs_latin_1_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1254 | { |
| 1255 | PyObject *return_value = NULL; |
| 1256 | PyObject *str; |
| 1257 | const char *errors = NULL; |
| 1258 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1259 | if (!PyArg_ParseTuple(args, "U|z:latin_1_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1260 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1261 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1262 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1263 | return_value = _codecs_latin_1_encode_impl(module, str, errors); |
| 1264 | |
| 1265 | exit: |
| 1266 | return return_value; |
| 1267 | } |
| 1268 | |
| 1269 | PyDoc_STRVAR(_codecs_ascii_encode__doc__, |
| 1270 | "ascii_encode($module, str, errors=None, /)\n" |
| 1271 | "--\n" |
| 1272 | "\n"); |
| 1273 | |
| 1274 | #define _CODECS_ASCII_ENCODE_METHODDEF \ |
| 1275 | {"ascii_encode", (PyCFunction)_codecs_ascii_encode, METH_VARARGS, _codecs_ascii_encode__doc__}, |
| 1276 | |
| 1277 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1278 | _codecs_ascii_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1279 | const char *errors); |
| 1280 | |
| 1281 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1282 | _codecs_ascii_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1283 | { |
| 1284 | PyObject *return_value = NULL; |
| 1285 | PyObject *str; |
| 1286 | const char *errors = NULL; |
| 1287 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1288 | if (!PyArg_ParseTuple(args, "U|z:ascii_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1289 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1290 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1291 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1292 | return_value = _codecs_ascii_encode_impl(module, str, errors); |
| 1293 | |
| 1294 | exit: |
| 1295 | return return_value; |
| 1296 | } |
| 1297 | |
| 1298 | PyDoc_STRVAR(_codecs_charmap_encode__doc__, |
| 1299 | "charmap_encode($module, str, errors=None, mapping=None, /)\n" |
| 1300 | "--\n" |
| 1301 | "\n"); |
| 1302 | |
| 1303 | #define _CODECS_CHARMAP_ENCODE_METHODDEF \ |
| 1304 | {"charmap_encode", (PyCFunction)_codecs_charmap_encode, METH_VARARGS, _codecs_charmap_encode__doc__}, |
| 1305 | |
| 1306 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1307 | _codecs_charmap_encode_impl(PyObject *module, PyObject *str, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1308 | const char *errors, PyObject *mapping); |
| 1309 | |
| 1310 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1311 | _codecs_charmap_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1312 | { |
| 1313 | PyObject *return_value = NULL; |
| 1314 | PyObject *str; |
| 1315 | const char *errors = NULL; |
| 1316 | PyObject *mapping = NULL; |
| 1317 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1318 | if (!PyArg_ParseTuple(args, "U|zO:charmap_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1319 | &str, &errors, &mapping)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1320 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1321 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1322 | return_value = _codecs_charmap_encode_impl(module, str, errors, mapping); |
| 1323 | |
| 1324 | exit: |
| 1325 | return return_value; |
| 1326 | } |
| 1327 | |
| 1328 | PyDoc_STRVAR(_codecs_charmap_build__doc__, |
| 1329 | "charmap_build($module, map, /)\n" |
| 1330 | "--\n" |
| 1331 | "\n"); |
| 1332 | |
| 1333 | #define _CODECS_CHARMAP_BUILD_METHODDEF \ |
| 1334 | {"charmap_build", (PyCFunction)_codecs_charmap_build, METH_O, _codecs_charmap_build__doc__}, |
| 1335 | |
| 1336 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1337 | _codecs_charmap_build_impl(PyObject *module, PyObject *map); |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1338 | |
| 1339 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1340 | _codecs_charmap_build(PyObject *module, PyObject *arg) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1341 | { |
| 1342 | PyObject *return_value = NULL; |
| 1343 | PyObject *map; |
| 1344 | |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1345 | if (!PyArg_Parse(arg, "U:charmap_build", &map)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1346 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1347 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1348 | return_value = _codecs_charmap_build_impl(module, map); |
| 1349 | |
| 1350 | exit: |
| 1351 | return return_value; |
| 1352 | } |
| 1353 | |
| 1354 | #if defined(HAVE_MBCS) |
| 1355 | |
| 1356 | PyDoc_STRVAR(_codecs_mbcs_encode__doc__, |
| 1357 | "mbcs_encode($module, str, errors=None, /)\n" |
| 1358 | "--\n" |
| 1359 | "\n"); |
| 1360 | |
| 1361 | #define _CODECS_MBCS_ENCODE_METHODDEF \ |
| 1362 | {"mbcs_encode", (PyCFunction)_codecs_mbcs_encode, METH_VARARGS, _codecs_mbcs_encode__doc__}, |
| 1363 | |
| 1364 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1365 | _codecs_mbcs_encode_impl(PyObject *module, PyObject *str, const char *errors); |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1366 | |
| 1367 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1368 | _codecs_mbcs_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1369 | { |
| 1370 | PyObject *return_value = NULL; |
| 1371 | PyObject *str; |
| 1372 | const char *errors = NULL; |
| 1373 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1374 | if (!PyArg_ParseTuple(args, "U|z:mbcs_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1375 | &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1376 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1377 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1378 | return_value = _codecs_mbcs_encode_impl(module, str, errors); |
| 1379 | |
| 1380 | exit: |
| 1381 | return return_value; |
| 1382 | } |
| 1383 | |
| 1384 | #endif /* defined(HAVE_MBCS) */ |
| 1385 | |
| 1386 | #if defined(HAVE_MBCS) |
| 1387 | |
Steve Dower | f5aba58 | 2016-09-06 19:42:27 -0700 | [diff] [blame^] | 1388 | PyDoc_STRVAR(_codecs_oem_encode__doc__, |
| 1389 | "oem_encode($module, str, errors=None, /)\n" |
| 1390 | "--\n" |
| 1391 | "\n"); |
| 1392 | |
| 1393 | #define _CODECS_OEM_ENCODE_METHODDEF \ |
| 1394 | {"oem_encode", (PyCFunction)_codecs_oem_encode, METH_VARARGS, _codecs_oem_encode__doc__}, |
| 1395 | |
| 1396 | static PyObject * |
| 1397 | _codecs_oem_encode_impl(PyObject *module, PyObject *str, const char *errors); |
| 1398 | |
| 1399 | static PyObject * |
| 1400 | _codecs_oem_encode(PyObject *module, PyObject *args) |
| 1401 | { |
| 1402 | PyObject *return_value = NULL; |
| 1403 | PyObject *str; |
| 1404 | const char *errors = NULL; |
| 1405 | |
| 1406 | if (!PyArg_ParseTuple(args, "U|z:oem_encode", |
| 1407 | &str, &errors)) { |
| 1408 | goto exit; |
| 1409 | } |
| 1410 | return_value = _codecs_oem_encode_impl(module, str, errors); |
| 1411 | |
| 1412 | exit: |
| 1413 | return return_value; |
| 1414 | } |
| 1415 | |
| 1416 | #endif /* defined(HAVE_MBCS) */ |
| 1417 | |
| 1418 | #if defined(HAVE_MBCS) |
| 1419 | |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1420 | PyDoc_STRVAR(_codecs_code_page_encode__doc__, |
| 1421 | "code_page_encode($module, code_page, str, errors=None, /)\n" |
| 1422 | "--\n" |
| 1423 | "\n"); |
| 1424 | |
| 1425 | #define _CODECS_CODE_PAGE_ENCODE_METHODDEF \ |
| 1426 | {"code_page_encode", (PyCFunction)_codecs_code_page_encode, METH_VARARGS, _codecs_code_page_encode__doc__}, |
| 1427 | |
| 1428 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1429 | _codecs_code_page_encode_impl(PyObject *module, int code_page, PyObject *str, |
| 1430 | const char *errors); |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1431 | |
| 1432 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1433 | _codecs_code_page_encode(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1434 | { |
| 1435 | PyObject *return_value = NULL; |
| 1436 | int code_page; |
| 1437 | PyObject *str; |
| 1438 | const char *errors = NULL; |
| 1439 | |
Serhiy Storchaka | 2eb6b0d | 2016-04-14 12:30:54 +0300 | [diff] [blame] | 1440 | if (!PyArg_ParseTuple(args, "iU|z:code_page_encode", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1441 | &code_page, &str, &errors)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1442 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1443 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1444 | return_value = _codecs_code_page_encode_impl(module, code_page, str, errors); |
| 1445 | |
| 1446 | exit: |
| 1447 | return return_value; |
| 1448 | } |
| 1449 | |
| 1450 | #endif /* defined(HAVE_MBCS) */ |
| 1451 | |
| 1452 | PyDoc_STRVAR(_codecs_register_error__doc__, |
| 1453 | "register_error($module, errors, handler, /)\n" |
| 1454 | "--\n" |
| 1455 | "\n" |
| 1456 | "Register the specified error handler under the name errors.\n" |
| 1457 | "\n" |
| 1458 | "handler must be a callable object, that will be called with an exception\n" |
| 1459 | "instance containing information about the location of the encoding/decoding\n" |
| 1460 | "error and must return a (replacement, new position) tuple."); |
| 1461 | |
| 1462 | #define _CODECS_REGISTER_ERROR_METHODDEF \ |
| 1463 | {"register_error", (PyCFunction)_codecs_register_error, METH_VARARGS, _codecs_register_error__doc__}, |
| 1464 | |
| 1465 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1466 | _codecs_register_error_impl(PyObject *module, const char *errors, |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1467 | PyObject *handler); |
| 1468 | |
| 1469 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1470 | _codecs_register_error(PyObject *module, PyObject *args) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1471 | { |
| 1472 | PyObject *return_value = NULL; |
| 1473 | const char *errors; |
| 1474 | PyObject *handler; |
| 1475 | |
| 1476 | if (!PyArg_ParseTuple(args, "sO:register_error", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1477 | &errors, &handler)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1478 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1479 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1480 | return_value = _codecs_register_error_impl(module, errors, handler); |
| 1481 | |
| 1482 | exit: |
| 1483 | return return_value; |
| 1484 | } |
| 1485 | |
| 1486 | PyDoc_STRVAR(_codecs_lookup_error__doc__, |
| 1487 | "lookup_error($module, name, /)\n" |
| 1488 | "--\n" |
| 1489 | "\n" |
| 1490 | "lookup_error(errors) -> handler\n" |
| 1491 | "\n" |
| 1492 | "Return the error handler for the specified error handling name or raise a\n" |
| 1493 | "LookupError, if no handler exists under this name."); |
| 1494 | |
| 1495 | #define _CODECS_LOOKUP_ERROR_METHODDEF \ |
| 1496 | {"lookup_error", (PyCFunction)_codecs_lookup_error, METH_O, _codecs_lookup_error__doc__}, |
| 1497 | |
| 1498 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1499 | _codecs_lookup_error_impl(PyObject *module, const char *name); |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1500 | |
| 1501 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 1502 | _codecs_lookup_error(PyObject *module, PyObject *arg) |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1503 | { |
| 1504 | PyObject *return_value = NULL; |
| 1505 | const char *name; |
| 1506 | |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1507 | if (!PyArg_Parse(arg, "s:lookup_error", &name)) { |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1508 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 1509 | } |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1510 | return_value = _codecs_lookup_error_impl(module, name); |
| 1511 | |
| 1512 | exit: |
| 1513 | return return_value; |
| 1514 | } |
| 1515 | |
| 1516 | #ifndef _CODECS_MBCS_DECODE_METHODDEF |
| 1517 | #define _CODECS_MBCS_DECODE_METHODDEF |
| 1518 | #endif /* !defined(_CODECS_MBCS_DECODE_METHODDEF) */ |
| 1519 | |
Steve Dower | f5aba58 | 2016-09-06 19:42:27 -0700 | [diff] [blame^] | 1520 | #ifndef _CODECS_OEM_DECODE_METHODDEF |
| 1521 | #define _CODECS_OEM_DECODE_METHODDEF |
| 1522 | #endif /* !defined(_CODECS_OEM_DECODE_METHODDEF) */ |
| 1523 | |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1524 | #ifndef _CODECS_CODE_PAGE_DECODE_METHODDEF |
| 1525 | #define _CODECS_CODE_PAGE_DECODE_METHODDEF |
| 1526 | #endif /* !defined(_CODECS_CODE_PAGE_DECODE_METHODDEF) */ |
| 1527 | |
| 1528 | #ifndef _CODECS_MBCS_ENCODE_METHODDEF |
| 1529 | #define _CODECS_MBCS_ENCODE_METHODDEF |
| 1530 | #endif /* !defined(_CODECS_MBCS_ENCODE_METHODDEF) */ |
| 1531 | |
Steve Dower | f5aba58 | 2016-09-06 19:42:27 -0700 | [diff] [blame^] | 1532 | #ifndef _CODECS_OEM_ENCODE_METHODDEF |
| 1533 | #define _CODECS_OEM_ENCODE_METHODDEF |
| 1534 | #endif /* !defined(_CODECS_OEM_ENCODE_METHODDEF) */ |
| 1535 | |
Serhiy Storchaka | 0c59ff6 | 2015-05-12 13:15:57 +0300 | [diff] [blame] | 1536 | #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF |
| 1537 | #define _CODECS_CODE_PAGE_ENCODE_METHODDEF |
| 1538 | #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */ |
Steve Dower | f5aba58 | 2016-09-06 19:42:27 -0700 | [diff] [blame^] | 1539 | /*[clinic end generated code: output=7874e2d559d49368 input=a9049054013a1b77]*/ |