+++ /dev/null
-#ifndef Py_CODECREGISTRY_H\r
-#define Py_CODECREGISTRY_H\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/* ------------------------------------------------------------------------\r
-\r
- Python Codec Registry and support functions\r
-\r
-\r
-Written by Marc-Andre Lemburg (mal@lemburg.com).\r
-\r
-Copyright (c) Corporation for National Research Initiatives.\r
-\r
- ------------------------------------------------------------------------ */\r
-\r
-/* Register a new codec search function.\r
-\r
- As side effect, this tries to load the encodings package, if not\r
- yet done, to make sure that it is always first in the list of\r
- search functions.\r
-\r
- The search_function's refcount is incremented by this function. */\r
-\r
-PyAPI_FUNC(int) PyCodec_Register(\r
- PyObject *search_function\r
- );\r
-\r
-/* Codec register lookup API.\r
-\r
- Looks up the given encoding and returns a CodecInfo object with\r
- function attributes which implement the different aspects of\r
- processing the encoding.\r
-\r
- The encoding string is looked up converted to all lower-case\r
- characters. This makes encodings looked up through this mechanism\r
- effectively case-insensitive.\r
-\r
- If no codec is found, a KeyError is set and NULL returned.\r
-\r
- As side effect, this tries to load the encodings package, if not\r
- yet done. This is part of the lazy load strategy for the encodings\r
- package.\r
-\r
- */\r
-\r
-PyAPI_FUNC(PyObject *) _PyCodec_Lookup(\r
- const char *encoding\r
- );\r
-\r
-/* Generic codec based encoding API.\r
-\r
- object is passed through the encoder function found for the given\r
- encoding using the error handling method defined by errors. errors\r
- may be NULL to use the default method defined for the codec.\r
- \r
- Raises a LookupError in case no encoder can be found.\r
-\r
- */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_Encode(\r
- PyObject *object,\r
- const char *encoding,\r
- const char *errors\r
- );\r
-\r
-/* Generic codec based decoding API.\r
-\r
- object is passed through the decoder function found for the given\r
- encoding using the error handling method defined by errors. errors\r
- may be NULL to use the default method defined for the codec.\r
- \r
- Raises a LookupError in case no encoder can be found.\r
-\r
- */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_Decode(\r
- PyObject *object,\r
- const char *encoding,\r
- const char *errors\r
- );\r
-\r
-/* --- Codec Lookup APIs -------------------------------------------------- \r
-\r
- All APIs return a codec object with incremented refcount and are\r
- based on _PyCodec_Lookup(). The same comments w/r to the encoding\r
- name also apply to these APIs.\r
-\r
-*/\r
-\r
-/* Get an encoder function for the given encoding. */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_Encoder(\r
- const char *encoding\r
- );\r
-\r
-/* Get a decoder function for the given encoding. */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_Decoder(\r
- const char *encoding\r
- );\r
-\r
-/* Get a IncrementalEncoder object for the given encoding. */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(\r
- const char *encoding,\r
- const char *errors\r
- );\r
-\r
-/* Get a IncrementalDecoder object function for the given encoding. */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(\r
- const char *encoding,\r
- const char *errors\r
- );\r
-\r
-/* Get a StreamReader factory function for the given encoding. */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_StreamReader(\r
- const char *encoding,\r
- PyObject *stream,\r
- const char *errors\r
- );\r
-\r
-/* Get a StreamWriter factory function for the given encoding. */\r
-\r
-PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(\r
- const char *encoding,\r
- PyObject *stream,\r
- const char *errors\r
- );\r
-\r
-/* Unicode encoding error handling callback registry API */\r
-\r
-/* Register the error handling callback function error under the given\r
- name. This function will be called by the codec when it encounters\r
- unencodable characters/undecodable bytes and doesn't know the\r
- callback name, when name is specified as the error parameter\r
- in the call to the encode/decode function.\r
- Return 0 on success, -1 on error */\r
-PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);\r
-\r
-/* Lookup the error handling callback function registered under the given\r
- name. As a special case NULL can be passed, in which case\r
- the error handling callback for "strict" will be returned. */\r
-PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);\r
-\r
-/* raise exc as an exception */\r
-PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);\r
-\r
-/* ignore the unicode error, skipping the faulty input */\r
-PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);\r
-\r
-/* replace the unicode encode error with ? or U+FFFD */\r
-PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);\r
-\r
-/* replace the unicode encode error with XML character references */\r
-PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);\r
-\r
-/* replace the unicode encode error with backslash escapes (\x, \u and \U) */\r
-PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif /* !Py_CODECREGISTRY_H */\r