summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2000-07-06 11:25:40 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2000-07-06 11:25:40 (GMT)
commit3d1a1d7f0c56fc9e25806d559ef08963d88022db (patch)
treee792a5a53c128cef023216a01559714f9eaa7f47 /Include
parent0a3f7978c40742672a01f3a5ea537e9f45b8b59f (diff)
downloadcpython-3d1a1d7f0c56fc9e25806d559ef08963d88022db.zip
cpython-3d1a1d7f0c56fc9e25806d559ef08963d88022db.tar.gz
cpython-3d1a1d7f0c56fc9e25806d559ef08963d88022db.tar.bz2
Added prototypes for the new codec APIs for strings. These APIs
match the ones in the Unicode implementation, but were extended to be able to reuse the existing Unicode codecs for string purposes too. Conversion from string to Unicode and back are done using the default encoding.
Diffstat (limited to 'Include')
-rw-r--r--Include/stringobject.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/Include/stringobject.h b/Include/stringobject.h
index 377ab25..d30bc03 100644
--- a/Include/stringobject.h
+++ b/Include/stringobject.h
@@ -81,6 +81,37 @@ extern DL_IMPORT(PyObject *) PyString_InternFromString Py_PROTO((const char *));
#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
#define PyString_GET_SIZE(op) (((PyStringObject *)(op))->ob_size)
+/* --- Generic Codecs ----------------------------------------------------- */
+
+/* Create a string object by decoding the encoded string s of the
+ given size. */
+
+extern DL_IMPORT(PyObject*) PyString_Decode(
+ const char *s, /* encoded string */
+ int size, /* size of buffer */
+ const char *encoding, /* encoding */
+ const char *errors /* error handling */
+ );
+
+/* Encodes a char buffer of the given size and returns a
+ Python string object. */
+
+extern DL_IMPORT(PyObject*) PyString_Encode(
+ const char *s, /* string char buffer */
+ int size, /* number of chars to encode */
+ const char *encoding, /* encoding */
+ const char *errors /* error handling */
+ );
+
+/* Encodes a string object and returns the result as Python string
+ object. */
+
+extern DL_IMPORT(PyObject*) PyString_AsEncodedString(
+ PyObject *str, /* string object */
+ const char *encoding, /* encoding */
+ const char *errors /* error handling */
+ );
+
#ifdef __cplusplus
}
#endif