Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 1 | #ifndef STRINGLIB_STRINGDEFS_H |
| 2 | #define STRINGLIB_STRINGDEFS_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 0 |
| 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 |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 11 | #define STRINGLIB_OBJECT PyBytesObject |
Victor Stinner | 8cc70dc | 2011-10-11 23:22:22 +0200 | [diff] [blame] | 12 | #define STRINGLIB_SIZEOF_CHAR 1 |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 13 | #define STRINGLIB_CHAR char |
| 14 | #define STRINGLIB_TYPE_NAME "string" |
Eric Smith | 37f1038 | 2007-09-01 10:56:01 +0000 | [diff] [blame] | 15 | #define STRINGLIB_PARSE_CODE "S" |
Eric Smith | 8fd3eba | 2008-02-17 19:48:00 +0000 | [diff] [blame] | 16 | #define STRINGLIB_EMPTY nullstring |
Antoine Pitrou | f2c5484 | 2010-01-13 08:07:53 +0000 | [diff] [blame] | 17 | #define STRINGLIB_ISSPACE Py_ISSPACE |
| 18 | #define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r')) |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 19 | #define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9')) |
| 20 | #define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1) |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 21 | #define STRINGLIB_STR PyBytes_AS_STRING |
| 22 | #define STRINGLIB_LEN PyBytes_GET_SIZE |
| 23 | #define STRINGLIB_NEW PyBytes_FromStringAndSize |
| 24 | #define STRINGLIB_RESIZE _PyBytes_Resize |
| 25 | #define STRINGLIB_CHECK PyBytes_Check |
Eric Smith | 0f78bff | 2009-11-30 01:01:42 +0000 | [diff] [blame] | 26 | #define STRINGLIB_CHECK_EXACT PyBytes_CheckExact |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 27 | #define STRINGLIB_TOSTR PyObject_Str |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 28 | #define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping |
Eric Smith | a3b1ac8 | 2009-04-03 14:45:06 +0000 | [diff] [blame] | 29 | #define STRINGLIB_GROUPING_LOCALE _PyBytes_InsertThousandsGroupingLocale |
Georg Brandl | 559e5d7 | 2008-06-11 18:37:52 +0000 | [diff] [blame] | 30 | #define STRINGLIB_TOASCII PyObject_Repr |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 31 | #endif /* !STRINGLIB_STRINGDEFS_H */ |