diff options
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r-- | Include/unicodeobject.h | 476 |
1 files changed, 238 insertions, 238 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 2e399a0..c0a1ca1 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -28,14 +28,14 @@ Copyright (c) Corporation for National Research Initiatives. * * -------------------------------------------------------------------- * This Unicode String Type is - * + * * Copyright (c) 1999 by Secret Labs AB * Copyright (c) 1999 by Fredrik Lundh - * + * * By obtaining, using, and/or copying this software and/or its * associated documentation, you agree that you have read, understood, * and will comply with the following terms and conditions: - * + * * Permission to use, copy, modify, and distribute this software and its * associated documentation for any purpose and without fee is hereby * granted, provided that the above copyright notice appears in all @@ -44,7 +44,7 @@ Copyright (c) Corporation for National Research Initiatives. * AB or the author not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. - * + * * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR @@ -124,10 +124,10 @@ Copyright (c) Corporation for National Research Initiatives. * Use this typedef when you need to represent a UTF-16 surrogate pair * as single unsigned integer. */ -#if SIZEOF_INT >= 4 -typedef unsigned int Py_UCS4; +#if SIZEOF_INT >= 4 +typedef unsigned int Py_UCS4; #elif SIZEOF_LONG >= 4 -typedef unsigned long Py_UCS4; +typedef unsigned long Py_UCS4; #endif /* Py_UNICODE is the native Unicode storage format (code unit) used by @@ -361,7 +361,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE; */ #define Py_UNICODE_ISSPACE(ch) \ - ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) + ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) #define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) #define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch) @@ -386,16 +386,16 @@ typedef PY_UNICODE_TYPE Py_UNICODE; #define Py_UNICODE_ISALNUM(ch) \ (Py_UNICODE_ISALPHA(ch) || \ - Py_UNICODE_ISDECIMAL(ch) || \ - Py_UNICODE_ISDIGIT(ch) || \ - Py_UNICODE_ISNUMERIC(ch)) + Py_UNICODE_ISDECIMAL(ch) || \ + Py_UNICODE_ISDIGIT(ch) || \ + Py_UNICODE_ISNUMERIC(ch)) -#define Py_UNICODE_COPY(target, source, length) \ - Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) +#define Py_UNICODE_COPY(target, source, length) \ + Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) #define Py_UNICODE_FILL(target, value, length) \ do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ - for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ + for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ } while (0) /* Check if substring matches at given offset. the offset must be @@ -414,12 +414,12 @@ extern "C" { typedef struct { PyObject_HEAD - Py_ssize_t length; /* Length of raw Unicode data in buffer */ - Py_UNICODE *str; /* Raw Unicode buffer */ - long hash; /* Hash value; -1 if not set */ - PyObject *defenc; /* (Default) Encoded version as Python - string, or NULL; this is used for - implementing the buffer protocol */ + Py_ssize_t length; /* Length of raw Unicode data in buffer */ + Py_UNICODE *str; /* Raw Unicode buffer */ + long hash; /* Hash value; -1 if not set */ + PyObject *defenc; /* (Default) Encoded version as Python + string, or NULL; this is used for + implementing the buffer protocol */ } PyUnicodeObject; PyAPI_DATA(PyTypeObject) PyUnicode_Type; @@ -430,13 +430,13 @@ PyAPI_DATA(PyTypeObject) PyUnicode_Type; /* Fast access macros */ #define PyUnicode_GET_SIZE(op) \ - (((PyUnicodeObject *)(op))->length) + (((PyUnicodeObject *)(op))->length) #define PyUnicode_GET_DATA_SIZE(op) \ - (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE)) + (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE)) #define PyUnicode_AS_UNICODE(op) \ - (((PyUnicodeObject *)(op))->str) + (((PyUnicodeObject *)(op))->str) #define PyUnicode_AS_DATA(op) \ - ((const char *)((PyUnicodeObject *)(op))->str) + ((const char *)((PyUnicodeObject *)(op))->str) /* --- Constants ---------------------------------------------------------- */ @@ -452,7 +452,7 @@ PyAPI_DATA(PyTypeObject) PyUnicode_Type; /* --- Plain Py_UNICODE --------------------------------------------------- */ /* Create a Unicode Object from the Py_UNICODE buffer u of the given - size. + size. u may be NULL which causes the contents to be undefined. It is the user's responsibility to fill in the needed data afterwards. Note @@ -482,13 +482,13 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromString( Py_UNICODE buffer. */ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); /* Get the length of the Unicode object. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); /* Get the maximum ordinal for a Unicode character. */ @@ -509,8 +509,8 @@ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); */ PyAPI_FUNC(int) PyUnicode_Resize( - PyObject **unicode, /* Pointer to the Unicode object */ - Py_ssize_t length /* New length */ + PyObject **unicode, /* Pointer to the Unicode object */ + Py_ssize_t length /* New length */ ); /* Coerce obj to an Unicode object and return a reference with @@ -531,14 +531,14 @@ PyAPI_FUNC(int) PyUnicode_Resize( */ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( - register PyObject *obj, /* Object */ + register PyObject *obj, /* Object */ const char *encoding, /* encoding */ const char *errors /* error handling */ ); /* Coerce obj to an Unicode object and return a reference with *incremented* refcount. - + Unicode objects are passed back as-is (subclasses are converted to true Unicode objects), all other objects are delegated to PyUnicode_FromEncodedObject(obj, NULL, "strict") which results in @@ -550,7 +550,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( */ PyAPI_FUNC(PyObject*) PyUnicode_FromObject( - register PyObject *obj /* Object */ + register PyObject *obj /* Object */ ); PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); @@ -559,8 +559,8 @@ PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, - Py_UNICODE *format_spec, - Py_ssize_t format_spec_len); + Py_UNICODE *format_spec, + Py_ssize_t format_spec_len); /* --- wchar_t support for platforms which support it --------------------- */ @@ -598,8 +598,8 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( /* --- Unicode ordinals --------------------------------------------------- */ -/* Create a Unicode Object from the given Unicode code point ordinal. - +/* Create a Unicode Object from the given Unicode code point ordinal. + The ordinal must be in range(0x10000) on narrow Python builds (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is raised in case it is not. @@ -619,11 +619,11 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); -/* === Builtin Codecs ===================================================== +/* === Builtin Codecs ===================================================== Many of these APIs take two arguments encoding and errors. These parameters encoding and errors have the same semantics as the ones - of the builtin unicode() API. + of the builtin unicode() API. Setting encoding to NULL causes the default encoding to be used. @@ -640,7 +640,7 @@ PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); /* --- Manage the default encoding ---------------------------------------- */ /* Return a Python string holding the default encoded value of the - Unicode object. + Unicode object. The resulting string is cached in the Unicode object for subsequent usage by this function. The cached version is needed to implement @@ -662,7 +662,7 @@ PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString( process global. This may change in future versions of the interpreter to become a parameter which is managed on a per-thread basis. - + */ PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); @@ -670,11 +670,11 @@ PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); /* Sets the currently active default encoding. Returns 0 on success, -1 in case of an error. - + */ PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( - const char *encoding /* Encoding name in standard form */ + const char *encoding /* Encoding name in standard form */ ); /* --- Generic Codecs ----------------------------------------------------- */ @@ -689,7 +689,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Decode( const char *errors /* error handling */ ); -/* Encodes a Py_UNICODE buffer of the given size and returns a +/* Encodes a Py_UNICODE buffer of the given size and returns a Python string object. */ PyAPI_FUNC(PyObject*) PyUnicode_Encode( @@ -703,18 +703,18 @@ PyAPI_FUNC(PyObject*) PyUnicode_Encode( object. */ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ ); /* Encodes a Unicode object and returns the result as Python string object. */ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( @@ -725,51 +725,51 @@ PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( /* --- UTF-7 Codecs ------------------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( - const char *string, /* UTF-7 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ + const char *string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( - const char *string, /* UTF-7 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ + const char *string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ int encodeSetO, /* force the encoder to encode characters in Set O, as described in RFC2152 */ int encodeWhiteSpace, /* force the encoder to encode space, tab, carriage return and linefeed characters */ - const char *errors /* error handling */ + const char *errors /* error handling */ ); /* --- UTF-8 Codecs ------------------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( - const char *string, /* UTF-8 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ + const char *string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( - const char *string, /* UTF-8 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ + const char *string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ - const char *errors /* error handling */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char *errors /* error handling */ ); /* --- UTF-32 Codecs ------------------------------------------------------ */ @@ -778,14 +778,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( the corresponding Unicode object. errors (if non-NULL) defines the error handling. It defaults - to "strict". + to "strict". If byteorder is non-NULL, the decoder starts decoding using the given byte order: - *byteorder == -1: little endian - *byteorder == 0: native order - *byteorder == 1: big endian + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian In native mode, the first four bytes of the stream are checked for a BOM mark. If found, the BOM mark is analysed, the byte order @@ -798,29 +798,29 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( - const char *string, /* UTF-32 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ + const char *string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( - const char *string, /* UTF-32 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder, /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - Py_ssize_t *consumed /* bytes consumed */ + const char *string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t *consumed /* bytes consumed */ ); /* Returns a Python string using the UTF-32 encoding in native byte order. The string always starts with a BOM mark. */ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); /* Returns a Python string object holding the UTF-32 encoded value of @@ -840,10 +840,10 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( */ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ - const char *errors, /* error handling */ - int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char *errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); /* --- UTF-16 Codecs ------------------------------------------------------ */ @@ -852,14 +852,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( the corresponding Unicode object. errors (if non-NULL) defines the error handling. It defaults - to "strict". + to "strict". If byteorder is non-NULL, the decoder starts decoding using the given byte order: - *byteorder == -1: little endian - *byteorder == 0: native order - *byteorder == 1: big endian + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian In native mode, the first two bytes of the stream are checked for a BOM mark. If found, the BOM mark is analysed, the byte order @@ -872,29 +872,29 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( - const char *string, /* UTF-16 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ + const char *string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ ); PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( - const char *string, /* UTF-16 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder, /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - Py_ssize_t *consumed /* bytes consumed */ + const char *string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t *consumed /* bytes consumed */ ); /* Returns a Python string using the UTF-16 encoding in native byte order. The string always starts with a BOM mark. */ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); /* Returns a Python string object holding the UTF-16 encoded value of @@ -918,44 +918,44 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( */ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ - const char *errors, /* error handling */ - int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char *errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ ); /* --- Unicode-Escape Codecs ---------------------------------------------- */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( - const char *string, /* Unicode-Escape encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length /* Number of Py_UNICODE chars to encode */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); /* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( - const char *string, /* Raw-Unicode-Escape encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ + const char *string, /* Raw-Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length /* Number of Py_UNICODE chars to encode */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length /* Number of Py_UNICODE chars to encode */ ); /* --- Unicode Internal Codec --------------------------------------------- @@ -968,53 +968,53 @@ PyObject *_PyUnicode_DecodeUnicodeInternal( const char *errors ); -/* --- Latin-1 Codecs ----------------------------------------------------- +/* --- Latin-1 Codecs ----------------------------------------------------- Note: Latin-1 corresponds to the first 256 Unicode ordinals. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( - const char *string, /* Latin-1 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ + const char *string, /* Latin-1 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - const char *errors /* error handling */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + const char *errors /* error handling */ ); -/* --- ASCII Codecs ------------------------------------------------------- +/* --- ASCII Codecs ------------------------------------------------------- Only 7-bit ASCII data is excepted. All other codes generate errors. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( - const char *string, /* ASCII encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ + const char *string, /* ASCII encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( - PyObject *unicode /* Unicode object */ + PyObject *unicode /* Unicode object */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - const char *errors /* error handling */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + const char *errors /* error handling */ ); -/* --- Character Map Codecs ----------------------------------------------- +/* --- Character Map Codecs ----------------------------------------------- - This codec uses mappings to encode and decode characters. + This codec uses mappings to encode and decode characters. Decoding mappings must map single string characters to single Unicode characters, integers (which are then interpreted as Unicode @@ -1035,25 +1035,25 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( - const char *string, /* Encoded string */ - Py_ssize_t length, /* size of string */ - PyObject *mapping, /* character mapping - (char ordinal -> unicode ordinal) */ - const char *errors /* error handling */ + const char *string, /* Encoded string */ + Py_ssize_t length, /* size of string */ + PyObject *mapping, /* character mapping + (char ordinal -> unicode ordinal) */ + const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( - PyObject *unicode, /* Unicode object */ - PyObject *mapping /* character mapping - (unicode ordinal -> char ordinal) */ + PyObject *unicode, /* Unicode object */ + PyObject *mapping /* character mapping + (unicode ordinal -> char ordinal) */ ); PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - PyObject *mapping, /* character mapping - (unicode ordinal -> char ordinal) */ - const char *errors /* error handling */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + PyObject *mapping, /* character mapping + (unicode ordinal -> char ordinal) */ + const char *errors /* error handling */ ); /* Translate a Py_UNICODE buffer of the given length by applying a @@ -1061,7 +1061,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( object. The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). + ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and @@ -1070,10 +1070,10 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( */ PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - PyObject *table, /* Translate table */ - const char *errors /* error handling */ + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + PyObject *table, /* Translate table */ + const char *errors /* error handling */ ); #ifdef MS_WIN32 @@ -1122,7 +1122,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( NULL or "strict": raise a ValueError "ignore": ignore the wrong characters (these are not copied to the - output buffer) + output buffer) "replace": replaces illegal characters with '?' Returns 0 on success, -1 on failure. @@ -1130,10 +1130,10 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( */ PyAPI_FUNC(int) PyUnicode_EncodeDecimal( - Py_UNICODE *s, /* Unicode buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - char *output, /* Output buffer; must have size >= length */ - const char *errors /* error handling */ + Py_UNICODE *s, /* Unicode buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + char *output, /* Output buffer; must have size >= length */ + const char *errors /* error handling */ ); /* --- Methods & Slots ---------------------------------------------------- @@ -1145,8 +1145,8 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal( /* Concat two strings giving a new Unicode string. */ PyAPI_FUNC(PyObject*) PyUnicode_Concat( - PyObject *left, /* Left string */ - PyObject *right /* Right string */ + PyObject *left, /* Left string */ + PyObject *right /* Right string */ ); /* Split a string giving a list of Unicode strings. @@ -1161,35 +1161,35 @@ PyAPI_FUNC(PyObject*) PyUnicode_Concat( */ PyAPI_FUNC(PyObject*) PyUnicode_Split( - PyObject *s, /* String to split */ - PyObject *sep, /* String separator */ - Py_ssize_t maxsplit /* Maxsplit count */ - ); + PyObject *s, /* String to split */ + PyObject *sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); /* Dito, but split at line breaks. CRLF is considered to be one line break. Line breaks are not included in the resulting list. */ - + PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( - PyObject *s, /* String to split */ - int keepends /* If true, line end markers are included */ - ); + PyObject *s, /* String to split */ + int keepends /* If true, line end markers are included */ + ); /* Partition a string using a given separator. */ PyAPI_FUNC(PyObject*) PyUnicode_Partition( - PyObject *s, /* String to partition */ - PyObject *sep /* String separator */ - ); + PyObject *s, /* String to partition */ + PyObject *sep /* String separator */ + ); /* Partition a string using a given separator, searching from the end of the string. */ PyAPI_FUNC(PyObject*) PyUnicode_RPartition( - PyObject *s, /* String to partition */ - PyObject *sep /* String separator */ - ); + PyObject *s, /* String to partition */ + PyObject *sep /* String separator */ + ); /* Split a string giving a list of Unicode strings. @@ -1205,16 +1205,16 @@ PyAPI_FUNC(PyObject*) PyUnicode_RPartition( */ PyAPI_FUNC(PyObject*) PyUnicode_RSplit( - PyObject *s, /* String to split */ - PyObject *sep, /* String separator */ - Py_ssize_t maxsplit /* Maxsplit count */ - ); + PyObject *s, /* String to split */ + PyObject *sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); /* Translate a string by applying a character mapping table to it and return the resulting Unicode object. The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). + ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and @@ -1223,28 +1223,28 @@ PyAPI_FUNC(PyObject*) PyUnicode_RSplit( */ PyAPI_FUNC(PyObject *) PyUnicode_Translate( - PyObject *str, /* String */ - PyObject *table, /* Translate table */ - const char *errors /* error handling */ + PyObject *str, /* String */ + PyObject *table, /* Translate table */ + const char *errors /* error handling */ ); /* Join a sequence of strings using the given separator and return the resulting Unicode string. */ - + PyAPI_FUNC(PyObject*) PyUnicode_Join( - PyObject *separator, /* Separator string */ - PyObject *seq /* Sequence object */ + PyObject *separator, /* Separator string */ + PyObject *seq /* Sequence object */ ); /* Return 1 if substr matches str[start:end] at the given tail end, 0 otherwise. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( - PyObject *str, /* String */ - PyObject *substr, /* Prefix or Suffix string */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end, /* Stop index */ - int direction /* Tail end: -1 prefix, +1 suffix */ + PyObject *str, /* String */ + PyObject *substr, /* Prefix or Suffix string */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Tail end: -1 prefix, +1 suffix */ ); /* Return the first position of substr in str[start:end] using the @@ -1252,39 +1252,39 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( an error occurred and an exception is set. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( - PyObject *str, /* String */ - PyObject *substr, /* Substring to find */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end, /* Stop index */ - int direction /* Find direction: +1 forward, -1 backward */ + PyObject *str, /* String */ + PyObject *substr, /* Substring to find */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Find direction: +1 forward, -1 backward */ ); /* Count the number of occurrences of substr in str[start:end]. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( - PyObject *str, /* String */ - PyObject *substr, /* Substring to count */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end /* Stop index */ + PyObject *str, /* String */ + PyObject *substr, /* Substring to count */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end /* Stop index */ ); /* Replace at most maxcount occurrences of substr in str with replstr and return the resulting Unicode object. */ PyAPI_FUNC(PyObject *) PyUnicode_Replace( - PyObject *str, /* String */ - PyObject *substr, /* Substring to find */ - PyObject *replstr, /* Substring to replace */ - Py_ssize_t maxcount /* Max. number of replacements to apply; - -1 = all */ + PyObject *str, /* String */ + PyObject *substr, /* Substring to find */ + PyObject *replstr, /* Substring to replace */ + Py_ssize_t maxcount /* Max. number of replacements to apply; + -1 = all */ ); /* Compare two strings and return -1, 0, 1 for less than, equal, greater than resp. */ PyAPI_FUNC(int) PyUnicode_Compare( - PyObject *left, /* Left string */ - PyObject *right /* Right string */ + PyObject *left, /* Left string */ + PyObject *right /* Right string */ ); /* Rich compare two strings and return one of the following: @@ -1304,17 +1304,17 @@ PyAPI_FUNC(int) PyUnicode_Compare( */ PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( - PyObject *left, /* Left string */ - PyObject *right, /* Right string */ - int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ + PyObject *left, /* Left string */ + PyObject *right, /* Right string */ + int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ ); /* Apply a argument tuple or dictionary to a format string and return the resulting Unicode string. */ PyAPI_FUNC(PyObject *) PyUnicode_Format( - PyObject *format, /* Format string */ - PyObject *args /* Argument tuple or dictionary */ + PyObject *format, /* Format string */ + PyObject *args /* Argument tuple or dictionary */ ); /* Checks whether element is contained in container and return 1/0 @@ -1324,8 +1324,8 @@ PyAPI_FUNC(PyObject *) PyUnicode_Format( returned in case of an error. */ PyAPI_FUNC(int) PyUnicode_Contains( - PyObject *container, /* Container string */ - PyObject *element /* Element string */ + PyObject *container, /* Container string */ + PyObject *element /* Element string */ ); /* Externally visible for str.strip(unicode) */ @@ -1342,70 +1342,70 @@ PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; /* These should not be used directly. Use the Py_UNICODE_IS* and - Py_UNICODE_TO* macros instead. + Py_UNICODE_TO* macros instead. These APIs are implemented in Objects/unicodectype.c. */ PyAPI_FUNC(int) _PyUnicode_IsLowercase( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsUppercase( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsTitlecase( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsWhitespace( - const Py_UNICODE ch /* Unicode character */ + const Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsLinebreak( - const Py_UNICODE ch /* Unicode character */ + const Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToDigit( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(double) _PyUnicode_ToNumeric( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsDigit( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsNumeric( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsAlpha( - Py_UNICODE ch /* Unicode character */ + Py_UNICODE ch /* Unicode character */ ); #ifdef __cplusplus |