Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 1 | #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öwis | d63a3b8 | 2011-09-28 07:41:54 +0200 | [diff] [blame] | 9 | #define FASTSEARCH fastsearch |
| 10 | #define STRINGLIB(F) stringlib_##F |
Eric Smith | 8fd3eba | 2008-02-17 19:48:00 +0000 | [diff] [blame] | 11 | #define STRINGLIB_OBJECT PyUnicodeObject |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 12 | #define STRINGLIB_CHAR Py_UNICODE |
| 13 | #define STRINGLIB_TYPE_NAME "unicode" |
Eric Smith | 37f1038 | 2007-09-01 10:56:01 +0000 | [diff] [blame] | 14 | #define STRINGLIB_PARSE_CODE "U" |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 15 | #define STRINGLIB_EMPTY unicode_empty |
Antoine Pitrou | f2c5484 | 2010-01-13 08:07:53 +0000 | [diff] [blame] | 16 | #define STRINGLIB_ISSPACE Py_UNICODE_ISSPACE |
| 17 | #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 18 | #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL |
| 19 | #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL |
| 20 | #define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER |
| 21 | #define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER |
| 22 | #define STRINGLIB_FILL Py_UNICODE_FILL |
| 23 | #define STRINGLIB_STR PyUnicode_AS_UNICODE |
| 24 | #define STRINGLIB_LEN PyUnicode_GET_SIZE |
| 25 | #define STRINGLIB_NEW PyUnicode_FromUnicode |
| 26 | #define STRINGLIB_RESIZE PyUnicode_Resize |
| 27 | #define STRINGLIB_CHECK PyUnicode_Check |
Eric Smith | 0f78bff | 2009-11-30 01:01:42 +0000 | [diff] [blame] | 28 | #define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact |
Eric Smith | 5807c41 | 2008-05-11 21:00:57 +0000 | [diff] [blame] | 29 | #define STRINGLIB_GROUPING _PyUnicode_InsertThousandsGrouping |
Eric Smith | a3b1ac8 | 2009-04-03 14:45:06 +0000 | [diff] [blame] | 30 | #define STRINGLIB_GROUPING_LOCALE _PyUnicode_InsertThousandsGroupingLocale |
Eric Smith | 8fd3eba | 2008-02-17 19:48:00 +0000 | [diff] [blame] | 31 | |
| 32 | #if PY_VERSION_HEX < 0x03000000 |
| 33 | #define STRINGLIB_TOSTR PyObject_Unicode |
Georg Brandl | 559e5d7 | 2008-06-11 18:37:52 +0000 | [diff] [blame] | 34 | #define STRINGLIB_TOASCII PyObject_Repr |
Eric Smith | 8fd3eba | 2008-02-17 19:48:00 +0000 | [diff] [blame] | 35 | #else |
Thomas Heller | 519a042 | 2007-11-15 20:48:54 +0000 | [diff] [blame] | 36 | #define STRINGLIB_TOSTR PyObject_Str |
Georg Brandl | 559e5d7 | 2008-06-11 18:37:52 +0000 | [diff] [blame] | 37 | #define STRINGLIB_TOASCII PyObject_ASCII |
Eric Smith | 8fd3eba | 2008-02-17 19:48:00 +0000 | [diff] [blame] | 38 | #endif |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 39 | |
Gregory P. Smith | 60d241f | 2007-10-16 06:31:30 +0000 | [diff] [blame] | 40 | #define STRINGLIB_WANT_CONTAINS_OBJ 1 |
| 41 | |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 42 | #endif /* !STRINGLIB_UNICODEDEFS_H */ |