blob: 48d00eccd046a55648eb4d0334c53e6393217e5b [file] [log] [blame]
Eric Smith8c663262007-08-25 02:26:07 +00001#ifndef STRINGLIB_UNICODEDEFS_H
2#define STRINGLIB_UNICODEDEFS_H
3
4/* this is sort of a hack. there's at least one place (formatting
5 floats) where some stringlib code takes a different path if it's
6 compiled as unicode. */
7#define STRINGLIB_IS_UNICODE 1
8
Martin v. Löwisd63a3b82011-09-28 07:41:54 +02009#define FASTSEARCH fastsearch
10#define STRINGLIB(F) stringlib_##F
Eric Smith8fd3eba2008-02-17 19:48:00 +000011#define STRINGLIB_OBJECT PyUnicodeObject
Victor Stinner8cc70dc2011-10-11 23:22:22 +020012#define STRINGLIB_SIZEOF_CHAR Py_UNICODE_SIZE
Eric Smith8c663262007-08-25 02:26:07 +000013#define STRINGLIB_CHAR Py_UNICODE
14#define STRINGLIB_TYPE_NAME "unicode"
Eric Smith37f10382007-09-01 10:56:01 +000015#define STRINGLIB_PARSE_CODE "U"
Eric Smith8c663262007-08-25 02:26:07 +000016#define STRINGLIB_EMPTY unicode_empty
Antoine Pitrouf2c54842010-01-13 08:07:53 +000017#define STRINGLIB_ISSPACE Py_UNICODE_ISSPACE
18#define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK
Eric Smith8c663262007-08-25 02:26:07 +000019#define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL
20#define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL
Eric Smith8c663262007-08-25 02:26:07 +000021#define STRINGLIB_STR PyUnicode_AS_UNICODE
22#define STRINGLIB_LEN PyUnicode_GET_SIZE
23#define STRINGLIB_NEW PyUnicode_FromUnicode
Eric Smith8c663262007-08-25 02:26:07 +000024#define STRINGLIB_CHECK PyUnicode_Check
Eric Smith0f78bff2009-11-30 01:01:42 +000025#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
Eric Smith8fd3eba2008-02-17 19:48:00 +000026
27#if PY_VERSION_HEX < 0x03000000
28#define STRINGLIB_TOSTR PyObject_Unicode
Georg Brandl559e5d72008-06-11 18:37:52 +000029#define STRINGLIB_TOASCII PyObject_Repr
Eric Smith8fd3eba2008-02-17 19:48:00 +000030#else
Thomas Heller519a0422007-11-15 20:48:54 +000031#define STRINGLIB_TOSTR PyObject_Str
Georg Brandl559e5d72008-06-11 18:37:52 +000032#define STRINGLIB_TOASCII PyObject_ASCII
Eric Smith8fd3eba2008-02-17 19:48:00 +000033#endif
Eric Smith8c663262007-08-25 02:26:07 +000034
Gregory P. Smith60d241f2007-10-16 06:31:30 +000035#define STRINGLIB_WANT_CONTAINS_OBJ 1
36
Eric Smith8c663262007-08-25 02:26:07 +000037#endif /* !STRINGLIB_UNICODEDEFS_H */