annotate DEPENDENCIES/mingw32/Python27/include/codecs.h @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1 #ifndef Py_CODECREGISTRY_H
Chris@87 2 #define Py_CODECREGISTRY_H
Chris@87 3 #ifdef __cplusplus
Chris@87 4 extern "C" {
Chris@87 5 #endif
Chris@87 6
Chris@87 7 /* ------------------------------------------------------------------------
Chris@87 8
Chris@87 9 Python Codec Registry and support functions
Chris@87 10
Chris@87 11
Chris@87 12 Written by Marc-Andre Lemburg (mal@lemburg.com).
Chris@87 13
Chris@87 14 Copyright (c) Corporation for National Research Initiatives.
Chris@87 15
Chris@87 16 ------------------------------------------------------------------------ */
Chris@87 17
Chris@87 18 /* Register a new codec search function.
Chris@87 19
Chris@87 20 As side effect, this tries to load the encodings package, if not
Chris@87 21 yet done, to make sure that it is always first in the list of
Chris@87 22 search functions.
Chris@87 23
Chris@87 24 The search_function's refcount is incremented by this function. */
Chris@87 25
Chris@87 26 PyAPI_FUNC(int) PyCodec_Register(
Chris@87 27 PyObject *search_function
Chris@87 28 );
Chris@87 29
Chris@87 30 /* Codec register lookup API.
Chris@87 31
Chris@87 32 Looks up the given encoding and returns a CodecInfo object with
Chris@87 33 function attributes which implement the different aspects of
Chris@87 34 processing the encoding.
Chris@87 35
Chris@87 36 The encoding string is looked up converted to all lower-case
Chris@87 37 characters. This makes encodings looked up through this mechanism
Chris@87 38 effectively case-insensitive.
Chris@87 39
Chris@87 40 If no codec is found, a KeyError is set and NULL returned.
Chris@87 41
Chris@87 42 As side effect, this tries to load the encodings package, if not
Chris@87 43 yet done. This is part of the lazy load strategy for the encodings
Chris@87 44 package.
Chris@87 45
Chris@87 46 */
Chris@87 47
Chris@87 48 PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
Chris@87 49 const char *encoding
Chris@87 50 );
Chris@87 51
Chris@87 52 /* Generic codec based encoding API.
Chris@87 53
Chris@87 54 object is passed through the encoder function found for the given
Chris@87 55 encoding using the error handling method defined by errors. errors
Chris@87 56 may be NULL to use the default method defined for the codec.
Chris@87 57
Chris@87 58 Raises a LookupError in case no encoder can be found.
Chris@87 59
Chris@87 60 */
Chris@87 61
Chris@87 62 PyAPI_FUNC(PyObject *) PyCodec_Encode(
Chris@87 63 PyObject *object,
Chris@87 64 const char *encoding,
Chris@87 65 const char *errors
Chris@87 66 );
Chris@87 67
Chris@87 68 /* Generic codec based decoding API.
Chris@87 69
Chris@87 70 object is passed through the decoder function found for the given
Chris@87 71 encoding using the error handling method defined by errors. errors
Chris@87 72 may be NULL to use the default method defined for the codec.
Chris@87 73
Chris@87 74 Raises a LookupError in case no encoder can be found.
Chris@87 75
Chris@87 76 */
Chris@87 77
Chris@87 78 PyAPI_FUNC(PyObject *) PyCodec_Decode(
Chris@87 79 PyObject *object,
Chris@87 80 const char *encoding,
Chris@87 81 const char *errors
Chris@87 82 );
Chris@87 83
Chris@87 84 /* --- Codec Lookup APIs --------------------------------------------------
Chris@87 85
Chris@87 86 All APIs return a codec object with incremented refcount and are
Chris@87 87 based on _PyCodec_Lookup(). The same comments w/r to the encoding
Chris@87 88 name also apply to these APIs.
Chris@87 89
Chris@87 90 */
Chris@87 91
Chris@87 92 /* Get an encoder function for the given encoding. */
Chris@87 93
Chris@87 94 PyAPI_FUNC(PyObject *) PyCodec_Encoder(
Chris@87 95 const char *encoding
Chris@87 96 );
Chris@87 97
Chris@87 98 /* Get a decoder function for the given encoding. */
Chris@87 99
Chris@87 100 PyAPI_FUNC(PyObject *) PyCodec_Decoder(
Chris@87 101 const char *encoding
Chris@87 102 );
Chris@87 103
Chris@87 104 /* Get a IncrementalEncoder object for the given encoding. */
Chris@87 105
Chris@87 106 PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder(
Chris@87 107 const char *encoding,
Chris@87 108 const char *errors
Chris@87 109 );
Chris@87 110
Chris@87 111 /* Get a IncrementalDecoder object function for the given encoding. */
Chris@87 112
Chris@87 113 PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder(
Chris@87 114 const char *encoding,
Chris@87 115 const char *errors
Chris@87 116 );
Chris@87 117
Chris@87 118 /* Get a StreamReader factory function for the given encoding. */
Chris@87 119
Chris@87 120 PyAPI_FUNC(PyObject *) PyCodec_StreamReader(
Chris@87 121 const char *encoding,
Chris@87 122 PyObject *stream,
Chris@87 123 const char *errors
Chris@87 124 );
Chris@87 125
Chris@87 126 /* Get a StreamWriter factory function for the given encoding. */
Chris@87 127
Chris@87 128 PyAPI_FUNC(PyObject *) PyCodec_StreamWriter(
Chris@87 129 const char *encoding,
Chris@87 130 PyObject *stream,
Chris@87 131 const char *errors
Chris@87 132 );
Chris@87 133
Chris@87 134 /* Unicode encoding error handling callback registry API */
Chris@87 135
Chris@87 136 /* Register the error handling callback function error under the given
Chris@87 137 name. This function will be called by the codec when it encounters
Chris@87 138 unencodable characters/undecodable bytes and doesn't know the
Chris@87 139 callback name, when name is specified as the error parameter
Chris@87 140 in the call to the encode/decode function.
Chris@87 141 Return 0 on success, -1 on error */
Chris@87 142 PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error);
Chris@87 143
Chris@87 144 /* Lookup the error handling callback function registered under the given
Chris@87 145 name. As a special case NULL can be passed, in which case
Chris@87 146 the error handling callback for "strict" will be returned. */
Chris@87 147 PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name);
Chris@87 148
Chris@87 149 /* raise exc as an exception */
Chris@87 150 PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc);
Chris@87 151
Chris@87 152 /* ignore the unicode error, skipping the faulty input */
Chris@87 153 PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc);
Chris@87 154
Chris@87 155 /* replace the unicode encode error with ? or U+FFFD */
Chris@87 156 PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc);
Chris@87 157
Chris@87 158 /* replace the unicode encode error with XML character references */
Chris@87 159 PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc);
Chris@87 160
Chris@87 161 /* replace the unicode encode error with backslash escapes (\x, \u and \U) */
Chris@87 162 PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc);
Chris@87 163
Chris@87 164 #ifdef __cplusplus
Chris@87 165 }
Chris@87 166 #endif
Chris@87 167 #endif /* !Py_CODECREGISTRY_H */