Victor Stinner | c3cec78 | 2011-10-05 21:24:08 +0200 | [diff] [blame] | 1 | /* this is sort of a hack. there's at least one place (formatting |
| 2 | floats) where some stringlib code takes a different path if it's |
| 3 | compiled as unicode. */ |
| 4 | #define STRINGLIB_IS_UNICODE 1 |
| 5 | |
| 6 | #define FASTSEARCH asciilib_fastsearch |
| 7 | #define STRINGLIB(F) asciilib_##F |
| 8 | #define STRINGLIB_OBJECT PyUnicodeObject |
Victor Stinner | 8cc70dc | 2011-10-11 23:22:22 +0200 | [diff] [blame] | 9 | #define STRINGLIB_SIZEOF_CHAR 1 |
Antoine Pitrou | ca5f91b | 2012-05-10 16:36:02 +0200 | [diff] [blame] | 10 | #define STRINGLIB_MAX_CHAR 0x7Fu |
Victor Stinner | c3cec78 | 2011-10-05 21:24:08 +0200 | [diff] [blame] | 11 | #define STRINGLIB_CHAR Py_UCS1 |
| 12 | #define STRINGLIB_TYPE_NAME "unicode" |
| 13 | #define STRINGLIB_PARSE_CODE "U" |
| 14 | #define STRINGLIB_EMPTY unicode_empty |
| 15 | #define STRINGLIB_ISSPACE Py_UNICODE_ISSPACE |
| 16 | #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK |
| 17 | #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL |
| 18 | #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL |
Victor Stinner | c3cec78 | 2011-10-05 21:24:08 +0200 | [diff] [blame] | 19 | #define STRINGLIB_STR PyUnicode_1BYTE_DATA |
| 20 | #define STRINGLIB_LEN PyUnicode_GET_LENGTH |
Victor Stinner | d3f0882 | 2012-05-29 12:57:52 +0200 | [diff] [blame] | 21 | #define STRINGLIB_NEW(STR,LEN) _PyUnicode_FromASCII((char*)(STR),(LEN)) |
Victor Stinner | c3cec78 | 2011-10-05 21:24:08 +0200 | [diff] [blame] | 22 | #define STRINGLIB_CHECK PyUnicode_Check |
| 23 | #define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact |
Victor Stinner | c3cec78 | 2011-10-05 21:24:08 +0200 | [diff] [blame] | 24 | |
| 25 | #define STRINGLIB_TOSTR PyObject_Str |
| 26 | #define STRINGLIB_TOASCII PyObject_ASCII |
| 27 | |
| 28 | #define _Py_InsertThousandsGrouping _PyUnicode_ascii_InsertThousandsGrouping |
Victor Stinner | c3cec78 | 2011-10-05 21:24:08 +0200 | [diff] [blame] | 29 | |