123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259 |
- #ifndef Py_UNICODEOBJECT_H
- #define Py_UNICODEOBJECT_H
- #include <stdarg.h>
- #include <ctype.h>
- #define Py_USING_UNICODE
- #ifndef SIZEOF_WCHAR_T
- #error Must define SIZEOF_WCHAR_T
- #endif
- #define Py_UNICODE_SIZE SIZEOF_WCHAR_T
- #if Py_UNICODE_SIZE >= 4
- #define Py_UNICODE_WIDE
- #endif
- #ifndef Py_LIMITED_API
- #define PY_UNICODE_TYPE wchar_t
- typedef wchar_t Py_UNICODE;
- #endif
- #ifdef HAVE_USABLE_WCHAR_T
- # ifndef HAVE_WCHAR_H
- # define HAVE_WCHAR_H
- # endif
- #endif
- #if defined(MS_WINDOWS)
- # define HAVE_MBCS
- #endif
- #ifdef HAVE_WCHAR_H
- # ifdef _HAVE_BSDI
- # include <time.h>
- # endif
- # include <wchar.h>
- #endif
- #if SIZEOF_INT == 4
- typedef unsigned int Py_UCS4;
- #elif SIZEOF_LONG == 4
- typedef unsigned long Py_UCS4;
- #else
- #error "Could not find a proper typedef for Py_UCS4"
- #endif
- #if SIZEOF_SHORT == 2
- typedef unsigned short Py_UCS2;
- #else
- #error "Could not find a proper typedef for Py_UCS2"
- #endif
- typedef unsigned char Py_UCS1;
- #ifndef Py_LIMITED_API
- #define Py_UNICODE_ISSPACE(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)
- #define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch)
- #define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch)
- #define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch)
- #define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch)
- #define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch)
- #define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
- #define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
- #define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
- #define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
- #define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
- #define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
- #define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch)
- #define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch)
- #define Py_UNICODE_ISALNUM(ch) \
- (Py_UNICODE_ISALPHA(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_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_;\
- } while (0)
- #define Py_UNICODE_IS_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDFFF)
- #define Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDBFF)
- #define Py_UNICODE_IS_LOW_SURROGATE(ch) (0xDC00 <= (ch) && (ch) <= 0xDFFF)
- #define Py_UNICODE_JOIN_SURROGATES(high, low) \
- (((((Py_UCS4)(high) & 0x03FF) << 10) | \
- ((Py_UCS4)(low) & 0x03FF)) + 0x10000)
- #define Py_UNICODE_HIGH_SURROGATE(ch) (0xD800 - (0x10000 >> 10) + ((ch) >> 10))
- #define Py_UNICODE_LOW_SURROGATE(ch) (0xDC00 + ((ch) & 0x3FF))
- #define Py_UNICODE_MATCH(string, offset, substring) \
- ((*((string)->wstr + (offset)) == *((substring)->wstr)) && \
- ((*((string)->wstr + (offset) + (substring)->wstr_length-1) == *((substring)->wstr + (substring)->wstr_length-1))) && \
- !memcmp((string)->wstr + (offset), (substring)->wstr, (substring)->wstr_length*sizeof(Py_UNICODE)))
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifndef Py_LIMITED_API
- typedef struct {
-
- PyObject_HEAD
- Py_ssize_t length;
- Py_hash_t hash;
- struct {
-
- unsigned int interned:2;
-
- unsigned int kind:3;
-
- unsigned int compact:1;
-
- unsigned int ascii:1;
-
- unsigned int ready:1;
-
- unsigned int :24;
- } state;
- wchar_t *wstr;
- } PyASCIIObject;
- typedef struct {
- PyASCIIObject _base;
- Py_ssize_t utf8_length;
- char *utf8;
- Py_ssize_t wstr_length;
- } PyCompactUnicodeObject;
- typedef struct {
- PyCompactUnicodeObject _base;
- union {
- void *any;
- Py_UCS1 *latin1;
- Py_UCS2 *ucs2;
- Py_UCS4 *ucs4;
- } data;
- } PyUnicodeObject;
- #endif
- PyAPI_DATA(PyTypeObject) PyUnicode_Type;
- PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
- #define PyUnicode_Check(op) \
- PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
- #define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type)
- #ifndef Py_LIMITED_API
- #define PyUnicode_WSTR_LENGTH(op) \
- (PyUnicode_IS_COMPACT_ASCII(op) ? \
- ((PyASCIIObject*)op)->length : \
- ((PyCompactUnicodeObject*)op)->wstr_length)
- #define PyUnicode_GET_SIZE(op) \
- (assert(PyUnicode_Check(op)), \
- (((PyASCIIObject *)(op))->wstr) ? \
- PyUnicode_WSTR_LENGTH(op) : \
- ((void)PyUnicode_AsUnicode((PyObject *)(op)), \
- assert(((PyASCIIObject *)(op))->wstr), \
- PyUnicode_WSTR_LENGTH(op)))
- #define PyUnicode_GET_DATA_SIZE(op) \
- (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
- #define PyUnicode_AS_UNICODE(op) \
- (assert(PyUnicode_Check(op)), \
- (((PyASCIIObject *)(op))->wstr) ? (((PyASCIIObject *)(op))->wstr) : \
- PyUnicode_AsUnicode((PyObject *)(op)))
- #define PyUnicode_AS_DATA(op) \
- ((const char *)(PyUnicode_AS_UNICODE(op)))
- #define SSTATE_NOT_INTERNED 0
- #define SSTATE_INTERNED_MORTAL 1
- #define SSTATE_INTERNED_IMMORTAL 2
- #define PyUnicode_IS_ASCII(op) \
- (assert(PyUnicode_Check(op)), \
- assert(PyUnicode_IS_READY(op)), \
- ((PyASCIIObject*)op)->state.ascii)
- #define PyUnicode_IS_COMPACT(op) \
- (((PyASCIIObject*)(op))->state.compact)
- #define PyUnicode_IS_COMPACT_ASCII(op) \
- (((PyASCIIObject*)op)->state.ascii && PyUnicode_IS_COMPACT(op))
- enum PyUnicode_Kind {
- PyUnicode_WCHAR_KIND = 0,
- PyUnicode_1BYTE_KIND = 1,
- PyUnicode_2BYTE_KIND = 2,
- PyUnicode_4BYTE_KIND = 4
- };
- #define PyUnicode_1BYTE_DATA(op) ((Py_UCS1*)PyUnicode_DATA(op))
- #define PyUnicode_2BYTE_DATA(op) ((Py_UCS2*)PyUnicode_DATA(op))
- #define PyUnicode_4BYTE_DATA(op) ((Py_UCS4*)PyUnicode_DATA(op))
- #define PyUnicode_KIND(op) \
- (assert(PyUnicode_Check(op)), \
- assert(PyUnicode_IS_READY(op)), \
- ((PyASCIIObject *)(op))->state.kind)
- #define _PyUnicode_COMPACT_DATA(op) \
- (PyUnicode_IS_ASCII(op) ? \
- ((void*)((PyASCIIObject*)(op) + 1)) : \
- ((void*)((PyCompactUnicodeObject*)(op) + 1)))
- #define _PyUnicode_NONCOMPACT_DATA(op) \
- (assert(((PyUnicodeObject*)(op))->data.any), \
- ((((PyUnicodeObject *)(op))->data.any)))
- #define PyUnicode_DATA(op) \
- (assert(PyUnicode_Check(op)), \
- PyUnicode_IS_COMPACT(op) ? _PyUnicode_COMPACT_DATA(op) : \
- _PyUnicode_NONCOMPACT_DATA(op))
- #define PyUnicode_WRITE(kind, data, index, value) \
- do { \
- switch ((kind)) { \
- case PyUnicode_1BYTE_KIND: { \
- ((Py_UCS1 *)(data))[(index)] = (Py_UCS1)(value); \
- break; \
- } \
- case PyUnicode_2BYTE_KIND: { \
- ((Py_UCS2 *)(data))[(index)] = (Py_UCS2)(value); \
- break; \
- } \
- default: { \
- assert((kind) == PyUnicode_4BYTE_KIND); \
- ((Py_UCS4 *)(data))[(index)] = (Py_UCS4)(value); \
- } \
- } \
- } while (0)
- #define PyUnicode_READ(kind, data, index) \
- ((Py_UCS4) \
- ((kind) == PyUnicode_1BYTE_KIND ? \
- ((const Py_UCS1 *)(data))[(index)] : \
- ((kind) == PyUnicode_2BYTE_KIND ? \
- ((const Py_UCS2 *)(data))[(index)] : \
- ((const Py_UCS4 *)(data))[(index)] \
- ) \
- ))
- #define PyUnicode_READ_CHAR(unicode, index) \
- (assert(PyUnicode_Check(unicode)), \
- assert(PyUnicode_IS_READY(unicode)), \
- (Py_UCS4) \
- (PyUnicode_KIND((unicode)) == PyUnicode_1BYTE_KIND ? \
- ((const Py_UCS1 *)(PyUnicode_DATA((unicode))))[(index)] : \
- (PyUnicode_KIND((unicode)) == PyUnicode_2BYTE_KIND ? \
- ((const Py_UCS2 *)(PyUnicode_DATA((unicode))))[(index)] : \
- ((const Py_UCS4 *)(PyUnicode_DATA((unicode))))[(index)] \
- ) \
- ))
- #define PyUnicode_GET_LENGTH(op) \
- (assert(PyUnicode_Check(op)), \
- assert(PyUnicode_IS_READY(op)), \
- ((PyASCIIObject *)(op))->length)
- #define PyUnicode_IS_READY(op) (((PyASCIIObject*)op)->state.ready)
- #define PyUnicode_READY(op) \
- (assert(PyUnicode_Check(op)), \
- (PyUnicode_IS_READY(op) ? \
- 0 : _PyUnicode_Ready((PyObject *)(op))))
- #define PyUnicode_MAX_CHAR_VALUE(op) \
- (assert(PyUnicode_IS_READY(op)), \
- (PyUnicode_IS_ASCII(op) ? \
- (0x7f) : \
- (PyUnicode_KIND(op) == PyUnicode_1BYTE_KIND ? \
- (0xffU) : \
- (PyUnicode_KIND(op) == PyUnicode_2BYTE_KIND ? \
- (0xffffU) : \
- (0x10ffffU)))))
- #endif
- #define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UCS4) 0xFFFD)
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_New(
- Py_ssize_t size,
- Py_UCS4 maxchar
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(int) _PyUnicode_Ready(
- PyObject *unicode
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) _PyUnicode_Copy(
- PyObject *unicode
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(
- PyObject *to,
- Py_ssize_t to_start,
- PyObject *from,
- Py_ssize_t from_start,
- Py_ssize_t how_many
- );
- PyAPI_FUNC(void) _PyUnicode_FastCopyCharacters(
- PyObject *to,
- Py_ssize_t to_start,
- PyObject *from,
- Py_ssize_t from_start,
- Py_ssize_t how_many
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill(
- PyObject *unicode,
- Py_ssize_t start,
- Py_ssize_t length,
- Py_UCS4 fill_char
- );
- PyAPI_FUNC(void) _PyUnicode_FastFill(
- PyObject *unicode,
- Py_ssize_t start,
- Py_ssize_t length,
- Py_UCS4 fill_char
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
- const Py_UNICODE *u,
- Py_ssize_t size
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize(
- const char *u,
- Py_ssize_t size
- );
- PyAPI_FUNC(PyObject*) PyUnicode_FromString(
- const char *u
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData(
- int kind,
- const void *buffer,
- Py_ssize_t size);
- PyAPI_FUNC(PyObject*) _PyUnicode_FromASCII(
- const char *buffer,
- Py_ssize_t size);
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_Substring(
- PyObject *str,
- Py_ssize_t start,
- Py_ssize_t end);
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar (
- PyObject *unicode,
- Py_ssize_t start,
- Py_ssize_t end);
- #endif
- PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4(
- PyObject *unicode,
- Py_UCS4* buffer,
- Py_ssize_t buflen,
- int copy_null);
- PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode);
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
- PyObject *unicode
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize(
- PyObject *unicode,
- Py_ssize_t *size
- );
- #endif
- PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength(
- PyObject *unicode
- );
- PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
- PyObject *unicode
- );
- PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar(
- PyObject *unicode,
- Py_ssize_t index
- );
- PyAPI_FUNC(int) PyUnicode_WriteChar(
- PyObject *unicode,
- Py_ssize_t index,
- Py_UCS4 character
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
- #endif
- PyAPI_FUNC(int) PyUnicode_Resize(
- PyObject **unicode,
- Py_ssize_t length
- );
- PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
- PyObject *obj,
- const char *encoding,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_FromObject(
- PyObject *obj
- );
- PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(
- const char *format,
- va_list vargs
- );
- PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(
- const char *format,
- ...
- );
- #ifndef Py_LIMITED_API
- typedef struct {
- PyObject *buffer;
- void *data;
- enum PyUnicode_Kind kind;
- Py_UCS4 maxchar;
- Py_ssize_t size;
- Py_ssize_t pos;
-
- Py_ssize_t min_length;
-
- Py_UCS4 min_char;
-
- unsigned char overallocate;
-
- unsigned char readonly;
- } _PyUnicodeWriter ;
- PyAPI_FUNC(void)
- _PyUnicodeWriter_Init(_PyUnicodeWriter *writer);
- #define _PyUnicodeWriter_Prepare(WRITER, LENGTH, MAXCHAR) \
- (((MAXCHAR) <= (WRITER)->maxchar \
- && (LENGTH) <= (WRITER)->size - (WRITER)->pos) \
- ? 0 \
- : (((LENGTH) == 0) \
- ? 0 \
- : _PyUnicodeWriter_PrepareInternal((WRITER), (LENGTH), (MAXCHAR))))
- PyAPI_FUNC(int)
- _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
- Py_ssize_t length, Py_UCS4 maxchar);
- PyAPI_FUNC(int)
- _PyUnicodeWriter_WriteChar(_PyUnicodeWriter *writer,
- Py_UCS4 ch
- );
- PyAPI_FUNC(int)
- _PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer,
- PyObject *str
- );
- PyAPI_FUNC(int)
- _PyUnicodeWriter_WriteSubstring(_PyUnicodeWriter *writer,
- PyObject *str,
- Py_ssize_t start,
- Py_ssize_t end
- );
- PyAPI_FUNC(int)
- _PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer,
- const char *str,
- Py_ssize_t len
- );
- PyAPI_FUNC(int)
- _PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer,
- const char *str,
- Py_ssize_t len
- );
- PyAPI_FUNC(PyObject *)
- _PyUnicodeWriter_Finish(_PyUnicodeWriter *writer);
- PyAPI_FUNC(void)
- _PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer);
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter(
- _PyUnicodeWriter *writer,
- PyObject *obj,
- PyObject *format_spec,
- Py_ssize_t start,
- Py_ssize_t end);
- #endif
- PyAPI_FUNC(void) PyUnicode_InternInPlace(PyObject **);
- PyAPI_FUNC(void) PyUnicode_InternImmortal(PyObject **);
- PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(
- const char *u
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void);
- #endif
- #define PyUnicode_CHECK_INTERNED(op) \
- (((PyASCIIObject *)(op))->state.interned)
- #ifdef HAVE_WCHAR_H
- PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar(
- const wchar_t *w,
- Py_ssize_t size
- );
- PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
- PyObject *unicode,
- wchar_t *w,
- Py_ssize_t size
- );
- PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString(
- PyObject *unicode,
- Py_ssize_t *size
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind);
- #endif
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
- PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(char *) PyUnicode_AsUTF8AndSize(
- PyObject *unicode,
- Py_ssize_t *size);
- #define _PyUnicode_AsStringAndSize PyUnicode_AsUTF8AndSize
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(char *) PyUnicode_AsUTF8(PyObject *unicode);
- #define _PyUnicode_AsString PyUnicode_AsUTF8
- #endif
- PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void);
- PyAPI_FUNC(PyObject*) PyUnicode_Decode(
- const char *s,
- Py_ssize_t size,
- const char *encoding,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedObject(
- PyObject *unicode,
- const char *encoding,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsDecodedUnicode(
- PyObject *unicode,
- const char *encoding,
- const char *errors
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_Encode(
- const Py_UNICODE *s,
- Py_ssize_t size,
- const char *encoding,
- const char *errors
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject(
- PyObject *unicode,
- const char *encoding,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString(
- PyObject *unicode,
- const char *encoding,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedUnicode(
- PyObject *unicode,
- const char *encoding,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap(
- PyObject* string
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful(
- const char *string,
- Py_ssize_t length,
- const char *errors,
- Py_ssize_t *consumed
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
- const Py_UNICODE *data,
- Py_ssize_t length,
- int base64SetO,
- int base64WhiteSpace,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7(
- PyObject *unicode,
- int base64SetO,
- int base64WhiteSpace,
- const char *errors
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful(
- const char *string,
- Py_ssize_t length,
- const char *errors,
- Py_ssize_t *consumed
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String(
- PyObject *unicode,
- const char *errors);
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
- const Py_UNICODE *data,
- Py_ssize_t length,
- const char *errors
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32(
- const char *string,
- Py_ssize_t length,
- const char *errors,
- int *byteorder
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful(
- const char *string,
- Py_ssize_t length,
- const char *errors,
- int *byteorder,
- Py_ssize_t *consumed
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
- const Py_UNICODE *data,
- Py_ssize_t length,
- const char *errors,
- int byteorder
- );
- PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32(
- PyObject *object,
- const char *errors,
- int byteorder
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16(
- const char *string,
- Py_ssize_t length,
- const char *errors,
- int *byteorder
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful(
- const char *string,
- Py_ssize_t length,
- const char *errors,
- int *byteorder,
- Py_ssize_t *consumed
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
- const Py_UNICODE *data,
- Py_ssize_t length,
- const char *errors,
- int byteorder
- );
- PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16(
- PyObject* unicode,
- const char *errors,
- int byteorder
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape(
- const Py_UNICODE *data,
- Py_ssize_t length
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape(
- const Py_UNICODE *data,
- Py_ssize_t length
- );
- #endif
- #ifndef Py_LIMITED_API
- PyObject *_PyUnicode_DecodeUnicodeInternal(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) _PyUnicode_AsLatin1String(
- PyObject* unicode,
- const char* errors);
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1(
- const Py_UNICODE *data,
- Py_ssize_t length,
- const char *errors
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) _PyUnicode_AsASCIIString(
- PyObject* unicode,
- const char* errors);
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII(
- const Py_UNICODE *data,
- Py_ssize_t length,
- const char *errors
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap(
- const char *string,
- Py_ssize_t length,
- PyObject *mapping,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString(
- PyObject *unicode,
- PyObject *mapping
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
- const Py_UNICODE *data,
- Py_ssize_t length,
- PyObject *mapping,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
- PyObject *unicode,
- PyObject *mapping,
- const char *errors
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
- const Py_UNICODE *data,
- Py_ssize_t length,
- PyObject *table,
- const char *errors
- );
- #endif
- #ifdef HAVE_MBCS
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS(
- const char *string,
- Py_ssize_t length,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful(
- const char *string,
- Py_ssize_t length,
- const char *errors,
- Py_ssize_t *consumed
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful(
- int code_page,
- const char *string,
- Py_ssize_t length,
- const char *errors,
- Py_ssize_t *consumed
- );
- PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString(
- PyObject *unicode
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
- const Py_UNICODE *data,
- Py_ssize_t length,
- const char *errors
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage(
- int code_page,
- PyObject *unicode,
- const char *errors
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
- Py_UNICODE *s,
- Py_ssize_t length,
- char *output,
- const char *errors
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) PyUnicode_TransformDecimalToASCII(
- Py_UNICODE *s,
- Py_ssize_t length
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject*) _PyUnicode_TransformDecimalAndSpaceToASCII(
- PyObject *unicode
- );
- #endif
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocaleAndSize(
- const char *str,
- Py_ssize_t len,
- const char *errors);
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeLocale(
- const char *str,
- const char *errors);
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeLocale(
- PyObject *unicode,
- const char *errors
- );
- PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*);
- PyAPI_FUNC(int) PyUnicode_FSDecoder(PyObject*, void*);
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefault(
- const char *s
- );
- PyAPI_FUNC(PyObject*) PyUnicode_DecodeFSDefaultAndSize(
- const char *s,
- Py_ssize_t size
- );
- PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault(
- PyObject *unicode
- );
- PyAPI_FUNC(PyObject*) PyUnicode_Concat(
- PyObject *left,
- PyObject *right
- );
- PyAPI_FUNC(void) PyUnicode_Append(
- PyObject **pleft,
- PyObject *right
- );
- PyAPI_FUNC(void) PyUnicode_AppendAndDel(
- PyObject **pleft,
- PyObject *right
- );
- PyAPI_FUNC(PyObject*) PyUnicode_Split(
- PyObject *s,
- PyObject *sep,
- Py_ssize_t maxsplit
- );
- PyAPI_FUNC(PyObject*) PyUnicode_Splitlines(
- PyObject *s,
- int keepends
- );
- PyAPI_FUNC(PyObject*) PyUnicode_Partition(
- PyObject *s,
- PyObject *sep
- );
- PyAPI_FUNC(PyObject*) PyUnicode_RPartition(
- PyObject *s,
- PyObject *sep
- );
- PyAPI_FUNC(PyObject*) PyUnicode_RSplit(
- PyObject *s,
- PyObject *sep,
- Py_ssize_t maxsplit
- );
- PyAPI_FUNC(PyObject *) PyUnicode_Translate(
- PyObject *str,
- PyObject *table,
- const char *errors
- );
- PyAPI_FUNC(PyObject*) PyUnicode_Join(
- PyObject *separator,
- PyObject *seq
- );
- PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch(
- PyObject *str,
- PyObject *substr,
- Py_ssize_t start,
- Py_ssize_t end,
- int direction
- );
- PyAPI_FUNC(Py_ssize_t) PyUnicode_Find(
- PyObject *str,
- PyObject *substr,
- Py_ssize_t start,
- Py_ssize_t end,
- int direction
- );
- PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar(
- PyObject *str,
- Py_UCS4 ch,
- Py_ssize_t start,
- Py_ssize_t end,
- int direction
- );
- PyAPI_FUNC(Py_ssize_t) PyUnicode_Count(
- PyObject *str,
- PyObject *substr,
- Py_ssize_t start,
- Py_ssize_t end
- );
- PyAPI_FUNC(PyObject *) PyUnicode_Replace(
- PyObject *str,
- PyObject *substr,
- PyObject *replstr,
- Py_ssize_t maxcount
- );
- PyAPI_FUNC(int) PyUnicode_Compare(
- PyObject *left,
- PyObject *right
- );
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(int) _PyUnicode_CompareWithId(
- PyObject *left,
- _Py_Identifier *right
- );
- #endif
- PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString(
- PyObject *left,
- const char *right
- );
- PyAPI_FUNC(PyObject *) PyUnicode_RichCompare(
- PyObject *left,
- PyObject *right,
- int op
- );
- PyAPI_FUNC(PyObject *) PyUnicode_Format(
- PyObject *format,
- PyObject *args
- );
- PyAPI_FUNC(int) PyUnicode_Contains(
- PyObject *container,
- PyObject *element
- );
- PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s);
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(PyObject *) _PyUnicode_XStrip(
- PyObject *self,
- int striptype,
- PyObject *sepobj
- );
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_FUNC(Py_ssize_t) _PyUnicode_InsertThousandsGrouping(
- PyObject *unicode,
- Py_ssize_t index,
- Py_ssize_t n_buffer,
- void *digits,
- Py_ssize_t n_digits,
- Py_ssize_t min_width,
- const char *grouping,
- PyObject *thousands_sep,
- Py_UCS4 *maxchar);
- #endif
- #ifndef Py_LIMITED_API
- PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
- PyAPI_FUNC(int) _PyUnicode_IsLowercase(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsUppercase(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsTitlecase(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsXidStart(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsXidContinue(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsWhitespace(
- const Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsLinebreak(
- const Py_UCS4 ch
- );
- PyAPI_FUNC(Py_UCS4) _PyUnicode_ToLowercase(
- Py_UCS4 ch
- );
- PyAPI_FUNC(Py_UCS4) _PyUnicode_ToUppercase(
- Py_UCS4 ch
- );
- PyAPI_FUNC(Py_UCS4) _PyUnicode_ToTitlecase(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_ToLowerFull(
- Py_UCS4 ch,
- Py_UCS4 *res
- );
- PyAPI_FUNC(int) _PyUnicode_ToTitleFull(
- Py_UCS4 ch,
- Py_UCS4 *res
- );
- PyAPI_FUNC(int) _PyUnicode_ToUpperFull(
- Py_UCS4 ch,
- Py_UCS4 *res
- );
- PyAPI_FUNC(int) _PyUnicode_ToFoldedFull(
- Py_UCS4 ch,
- Py_UCS4 *res
- );
- PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsCased(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_ToDigit(
- Py_UCS4 ch
- );
- PyAPI_FUNC(double) _PyUnicode_ToNumeric(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsDigit(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsNumeric(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsPrintable(
- Py_UCS4 ch
- );
- PyAPI_FUNC(int) _PyUnicode_IsAlpha(
- Py_UCS4 ch
- );
- PyAPI_FUNC(size_t) Py_UNICODE_strlen(
- const Py_UNICODE *u
- );
- PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy(
- Py_UNICODE *s1,
- const Py_UNICODE *s2);
- PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcat(
- Py_UNICODE *s1, const Py_UNICODE *s2);
- PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy(
- Py_UNICODE *s1,
- const Py_UNICODE *s2,
- size_t n);
- PyAPI_FUNC(int) Py_UNICODE_strcmp(
- const Py_UNICODE *s1,
- const Py_UNICODE *s2
- );
- PyAPI_FUNC(int) Py_UNICODE_strncmp(
- const Py_UNICODE *s1,
- const Py_UNICODE *s2,
- size_t n
- );
- PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(
- const Py_UNICODE *s,
- Py_UNICODE c
- );
- PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
- const Py_UNICODE *s,
- Py_UNICODE c
- );
- PyAPI_FUNC(PyObject*) _PyUnicode_FormatLong(PyObject *, int, int, int);
- PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
- PyObject *unicode
- );
- #endif
- #if defined(Py_DEBUG) && !defined(Py_LIMITED_API)
- PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
- PyObject *op,
- int check_content);
- #endif
- PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
- PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|