Mercurial > cpython-lru_cache-weakref
diff Include/stringobject.h @ 13376:bfe22cf6e770 legacy-trunk
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.
| author | Marc-André Lemburg <mal@egenix.com> |
|---|---|
| date | Thu, 06 Jul 2000 11:25:40 +0000 |
| parents | 87ee82e5c56d |
| children | 091ca6b9348f |
line wrap: on
line diff
--- a/Include/stringobject.h Thu Jul 06 05:34:14 2000 +0000 +++ b/Include/stringobject.h Thu Jul 06 11:25:40 2000 +0000 @@ -81,6 +81,37 @@ #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
