annotate Modules/_codecsmodule.c @ 13163:a09e8635534d legacy-trunk

Don't try to guess the name of a .def file -- if one is supplied, use it, otherwise just generate an '/export:' option.
author Greg Ward <gward@python.net>
date Thu, 29 Jun 2000 23:09:20 +0000
parents 65f35b73e350
children c8706e5a882f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11980
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 /* ------------------------------------------------------------------------
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 _codecs -- Provides access to the codec registry and the builtin
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 codecs.
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
5
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 This module should never be imported directly. The standard library
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 module "codecs" wraps this builtin module for use within Python.
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 The codec registry is accessible via:
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
10
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 register(search_function) -> None
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
14
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 The builtin Unicode codecs use the following interface:
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
16
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 <encoding>_encode(Unicode_object[,errors='strict']) ->
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 (string object, bytes consumed)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
19
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 <encoding>_decode(char_buffer_obj[,errors='strict']) ->
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 (Unicode object, bytes consumed)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
22
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 These <encoding>s are available: utf_8, unicode_escape,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 raw_unicode_escape, unicode_internal, latin_1, ascii (7-bit)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
25
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 Written by Marc-Andre Lemburg (mal@lemburg.com).
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
27
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
28 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
29
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 ------------------------------------------------------------------------ */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
31
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 #include "Python.h"
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
33
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
34 /* --- Registry ----------------------------------------------------------- */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
35
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 static
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 PyObject *codecregister(PyObject *self, PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 PyObject *search_function;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
40
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 if (!PyArg_ParseTuple(args, "O:register", &search_function))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 goto onError;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
43
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 if (PyCodec_Register(search_function))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 goto onError;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
46
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 Py_INCREF(Py_None);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 return Py_None;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
49
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 onError:
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
53
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 static
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 PyObject *codeclookup(PyObject *self, PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
56 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 char *encoding;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
58
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
59 if (!PyArg_ParseTuple(args, "s:lookup", &encoding))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 goto onError;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
61
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
62 return _PyCodec_Lookup(encoding);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
63
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 onError:
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
65 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
66 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
67
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
68 /* --- Helpers ------------------------------------------------------------ */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
69
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
70 static
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
71 PyObject *codec_tuple(PyObject *unicode,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
72 int len)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
73 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 PyObject *v,*w;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
75
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
76 if (unicode == NULL)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
77 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
78 v = PyTuple_New(2);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
79 if (v == NULL) {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
80 Py_DECREF(unicode);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
81 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
82 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
83 PyTuple_SET_ITEM(v,0,unicode);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 w = PyInt_FromLong(len);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
85 if (w == NULL) {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
86 Py_DECREF(v);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
87 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
88 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
89 PyTuple_SET_ITEM(v,1,w);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
90 return v;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
92
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
93 /* --- Decoder ------------------------------------------------------------ */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
94
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
95 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
96 unicode_internal_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
98 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
99 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
101 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
102
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
103 if (!PyArg_ParseTuple(args, "s#|z:unicode_internal_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
104 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
105 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
106
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
107 return codec_tuple(PyUnicode_FromUnicode((Py_UNICODE *)data,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
108 size / sizeof(Py_UNICODE)),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
109 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
110 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
111
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
112 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
113 utf_8_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
114 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
115 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
116 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
117 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
118 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
119
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
120 if (!PyArg_ParseTuple(args, "t#|z:utf_8_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
121 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
122 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
123
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
124 return codec_tuple(PyUnicode_DecodeUTF8(data, size, errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
125 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
126 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
127
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
128 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
129 utf_16_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
130 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
131 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
132 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
133 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
134 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
135 int byteorder = 0;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
136
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
137 if (!PyArg_ParseTuple(args, "t#|z:utf_16_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
138 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
139 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
140 return codec_tuple(PyUnicode_DecodeUTF16(data, size, errors, &byteorder),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
141 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
142 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
143
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
144 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
145 utf_16_le_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
146 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
147 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
148 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
149 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
150 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
151 int byteorder = -1;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
152
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
153 if (!PyArg_ParseTuple(args, "t#|z:utf_16_le_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
154 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
155 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
156 return codec_tuple(PyUnicode_DecodeUTF16(data, size, errors, &byteorder),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
157 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
158 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
159
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
160 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
161 utf_16_be_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
162 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
163 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
164 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
165 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
166 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
167 int byteorder = 1;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
168
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
169 if (!PyArg_ParseTuple(args, "t#|z:utf_16_be_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
170 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
171 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
172 return codec_tuple(PyUnicode_DecodeUTF16(data, size, errors, &byteorder),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
173 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
174 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
175
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
176 /* This non-standard version also provides access to the byteorder
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
177 parameter of the builtin UTF-16 codec.
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
178
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
179 It returns a tuple (unicode, bytesread, byteorder) with byteorder
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
180 being the value in effect at the end of data.
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
181
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
182 */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
183
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
184 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
185 utf_16_ex_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
186 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
187 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
188 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
189 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
190 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
191 int byteorder = 0;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
192 PyObject *unicode, *tuple;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
193
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
194 if (!PyArg_ParseTuple(args, "t#|zi:utf_16_ex_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
195 &data, &size, &errors, &byteorder))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
196 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
197
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
198 unicode = PyUnicode_DecodeUTF16(data, size, errors, &byteorder);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
199 if (unicode == NULL)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
200 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
201 tuple = Py_BuildValue("Oii", unicode, size, byteorder);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
202 Py_DECREF(unicode);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
203 return tuple;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
204 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
205
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
206 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
207 unicode_escape_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
208 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
209 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
210 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
211 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
212 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
213
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
214 if (!PyArg_ParseTuple(args, "t#|z:unicode_escape_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
215 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
216 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
217
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
218 return codec_tuple(PyUnicode_DecodeUnicodeEscape(data, size, errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
219 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
220 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
221
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
222 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
223 raw_unicode_escape_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
224 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
225 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
226 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
227 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
228 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
229
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
230 if (!PyArg_ParseTuple(args, "t#|z:raw_unicode_escape_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
231 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
232 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
233
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
234 return codec_tuple(PyUnicode_DecodeRawUnicodeEscape(data, size, errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
235 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
236 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
237
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
238 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
239 latin_1_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
240 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
241 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
242 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
243 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
244 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
245
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
246 if (!PyArg_ParseTuple(args, "t#|z:latin_1_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
247 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
248 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
249
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
250 return codec_tuple(PyUnicode_DecodeLatin1(data, size, errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
251 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
252 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
253
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
254 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
255 ascii_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
256 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
257 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
258 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
259 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
260 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
261
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
262 if (!PyArg_ParseTuple(args, "t#|z:ascii_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
263 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
264 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
265
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
266 return codec_tuple(PyUnicode_DecodeASCII(data, size, errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
267 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
268 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
269
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
270 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
271 charmap_decode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
272 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
273 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
274 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
275 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
276 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
277 PyObject *mapping = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
278
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
279 if (!PyArg_ParseTuple(args, "t#|zO:charmap_decode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
280 &data, &size, &errors, &mapping))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
281 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
282 if (mapping == Py_None)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
283 mapping = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
284
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
285 return codec_tuple(PyUnicode_DecodeCharmap(data, size, mapping, errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
286 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
287 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
288
12074
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
289 #ifdef MS_WIN32
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
290
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
291 static PyObject *
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
292 mbcs_decode(PyObject *self,
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
293 PyObject *args)
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
294 {
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
295 const char *data;
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
296 int size;
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
297 const char *errors = NULL;
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
298
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
299 if (!PyArg_ParseTuple(args, "t#|z:mbcs_decode",
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
300 &data, &size, &errors))
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
301 return NULL;
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
302
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
303 return codec_tuple(PyUnicode_DecodeMBCS(data, size, errors),
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
304 size);
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
305 }
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
306
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
307 #endif /* MS_WIN32 */
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
308
11980
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
309 /* --- Encoder ------------------------------------------------------------ */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
310
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
311 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
312 readbuffer_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
313 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
314 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
315 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
316 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
317 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
318
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
319 if (!PyArg_ParseTuple(args, "s#|z:readbuffer_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
320 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
321 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
322
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
323 return codec_tuple(PyString_FromStringAndSize(data, size),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
324 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
325 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
326
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
327 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
328 charbuffer_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
329 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
330 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
331 const char *data;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
332 int size;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
333 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
334
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
335 if (!PyArg_ParseTuple(args, "t#|z:charbuffer_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
336 &data, &size, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
337 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
338
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
339 return codec_tuple(PyString_FromStringAndSize(data, size),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
340 size);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
341 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
342
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
343 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
344 utf_8_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
345 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
346 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
347 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
348 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
349
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
350 if (!PyArg_ParseTuple(args, "U|z:utf_8_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
351 &str, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
352 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
353
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
354 return codec_tuple(PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
355 PyUnicode_GET_SIZE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
356 errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
357 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
358 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
359
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
360 /* This version provides access to the byteorder parameter of the
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
361 builtin UTF-16 codecs as optional third argument. It defaults to 0
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
362 which means: use the native byte order and prepend the data with a
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
363 BOM mark.
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
364
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
365 */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
366
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
367 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
368 utf_16_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
369 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
370 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
371 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
372 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
373 int byteorder = 0;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
374
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
375 if (!PyArg_ParseTuple(args, "U|zi:utf_16_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
376 &str, &errors, &byteorder))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
377 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
378
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
379 return codec_tuple(PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
380 PyUnicode_GET_SIZE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
381 errors,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
382 byteorder),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
383 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
384 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
385
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
386 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
387 utf_16_le_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
388 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
389 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
390 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
391 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
392
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
393 if (!PyArg_ParseTuple(args, "U|zi:utf_16_le_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
394 &str, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
395 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
396
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
397 return codec_tuple(PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
398 PyUnicode_GET_SIZE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
399 errors,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
400 -1),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
401 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
402 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
403
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
404 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
405 utf_16_be_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
406 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
407 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
408 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
409 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
410
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
411 if (!PyArg_ParseTuple(args, "U|zi:utf_16_be_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
412 &str, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
413 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
414
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
415 return codec_tuple(PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
416 PyUnicode_GET_SIZE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
417 errors,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
418 +1),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
419 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
420 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
421
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
422 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
423 unicode_escape_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
424 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
425 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
426 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
427 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
428
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
429 if (!PyArg_ParseTuple(args, "U|z:unicode_escape_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
430 &str, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
431 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
432
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
433 return codec_tuple(PyUnicode_EncodeUnicodeEscape(
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
434 PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
435 PyUnicode_GET_SIZE(str)),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
436 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
437 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
438
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
439 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
440 raw_unicode_escape_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
441 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
442 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
443 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
444 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
445
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
446 if (!PyArg_ParseTuple(args, "U|z:raw_unicode_escape_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
447 &str, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
448 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
449
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
450 return codec_tuple(PyUnicode_EncodeRawUnicodeEscape(
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
451 PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
452 PyUnicode_GET_SIZE(str)),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
453 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
454 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
455
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
456 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
457 latin_1_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
458 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
459 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
460 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
461 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
462
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
463 if (!PyArg_ParseTuple(args, "U|z:latin_1_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
464 &str, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
465 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
466
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
467 return codec_tuple(PyUnicode_EncodeLatin1(
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
468 PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
469 PyUnicode_GET_SIZE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
470 errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
471 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
472 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
473
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
474 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
475 ascii_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
476 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
477 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
478 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
479 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
480
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
481 if (!PyArg_ParseTuple(args, "U|z:ascii_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
482 &str, &errors))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
483 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
484
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
485 return codec_tuple(PyUnicode_EncodeASCII(
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
486 PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
487 PyUnicode_GET_SIZE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
488 errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
489 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
490 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
491
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
492 static PyObject *
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
493 charmap_encode(PyObject *self,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
494 PyObject *args)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
495 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
496 PyObject *str;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
497 const char *errors = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
498 PyObject *mapping = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
499
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
500 if (!PyArg_ParseTuple(args, "U|zO:charmap_encode",
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
501 &str, &errors, &mapping))
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
502 return NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
503 if (mapping == Py_None)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
504 mapping = NULL;
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
505
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
506 return codec_tuple(PyUnicode_EncodeCharmap(
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
507 PyUnicode_AS_UNICODE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
508 PyUnicode_GET_SIZE(str),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
509 mapping,
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
510 errors),
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
511 PyUnicode_GET_SIZE(str));
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
512 }
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
513
12074
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
514 #ifdef MS_WIN32
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
515
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
516 static PyObject *
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
517 mbcs_encode(PyObject *self,
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
518 PyObject *args)
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
519 {
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
520 PyObject *str;
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
521 const char *errors = NULL;
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
522
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
523 if (!PyArg_ParseTuple(args, "U|z:mbcs_encode",
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
524 &str, &errors))
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
525 return NULL;
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
526
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
527 return codec_tuple(PyUnicode_EncodeMBCS(
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
528 PyUnicode_AS_UNICODE(str),
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
529 PyUnicode_GET_SIZE(str),
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
530 errors),
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
531 PyUnicode_GET_SIZE(str));
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
532 }
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
533
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
534 #endif /* MS_WIN32 */
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
535
11980
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
536 /* --- Module API --------------------------------------------------------- */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
537
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
538 static PyMethodDef _codecs_functions[] = {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
539 {"register", codecregister, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
540 {"lookup", codeclookup, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
541 {"utf_8_encode", utf_8_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
542 {"utf_8_decode", utf_8_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
543 {"utf_16_encode", utf_16_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
544 {"utf_16_le_encode", utf_16_le_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
545 {"utf_16_be_encode", utf_16_be_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
546 {"utf_16_decode", utf_16_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
547 {"utf_16_le_decode", utf_16_le_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
548 {"utf_16_be_decode", utf_16_be_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
549 {"utf_16_ex_decode", utf_16_ex_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
550 {"unicode_escape_encode", unicode_escape_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
551 {"unicode_escape_decode", unicode_escape_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
552 {"unicode_internal_encode", readbuffer_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
553 {"unicode_internal_decode", unicode_internal_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
554 {"raw_unicode_escape_encode", raw_unicode_escape_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
555 {"raw_unicode_escape_decode", raw_unicode_escape_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
556 {"latin_1_encode", latin_1_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
557 {"latin_1_decode", latin_1_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
558 {"ascii_encode", ascii_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
559 {"ascii_decode", ascii_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
560 {"charmap_encode", charmap_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
561 {"charmap_decode", charmap_decode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
562 {"readbuffer_encode", readbuffer_encode, 1},
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
563 {"charbuffer_encode", charbuffer_encode, 1},
12074
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
564 #ifdef MS_WIN32
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
565 {"mbcs_encode", mbcs_encode, 1},
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
566 {"mbcs_decode", mbcs_decode, 1},
65f35b73e350 Marc-Andre Lemburg:
Guido van Rossum <guido@python.org>
parents: 11980
diff changeset
567 #endif
11980
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
568 {NULL, NULL} /* sentinel */
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
569 };
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
570
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
571 DL_EXPORT(void)
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
572 init_codecs()
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
573 {
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
574 Py_InitModule("_codecs", _codecs_functions);
a9b5a31ff8cb Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff changeset
575 }