Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 1 | #ifndef STRINGLIB_STRINGDEFS_H |
| 2 | #define STRINGLIB_STRINGDEFS_H |
| 3 | |
Victor Stinner | c41eed1 | 2020-06-23 15:54:35 +0200 | [diff] [blame] | 4 | #ifndef STRINGLIB_GET_EMPTY |
| 5 | # error "STRINGLIB_GET_EMPTY macro must be defined" |
| 6 | #endif |
| 7 | |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 8 | /* this is sort of a hack. there's at least one place (formatting |
| 9 | floats) where some stringlib code takes a different path if it's |
| 10 | compiled as unicode. */ |
| 11 | #define STRINGLIB_IS_UNICODE 0 |
| 12 | |
Martin v. Löwis | d63a3b8 | 2011-09-28 07:41:54 +0200 | [diff] [blame] | 13 | #define FASTSEARCH fastsearch |
| 14 | #define STRINGLIB(F) stringlib_##F |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 15 | #define STRINGLIB_OBJECT PyBytesObject |
Victor Stinner | 8cc70dc | 2011-10-11 23:22:22 +0200 | [diff] [blame] | 16 | #define STRINGLIB_SIZEOF_CHAR 1 |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 17 | #define STRINGLIB_CHAR char |
| 18 | #define STRINGLIB_TYPE_NAME "string" |
Eric Smith | 37f1038 | 2007-09-01 10:56:01 +0000 | [diff] [blame] | 19 | #define STRINGLIB_PARSE_CODE "S" |
Antoine Pitrou | f2c5484 | 2010-01-13 08:07:53 +0000 | [diff] [blame] | 20 | #define STRINGLIB_ISSPACE Py_ISSPACE |
| 21 | #define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r')) |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 22 | #define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9')) |
| 23 | #define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1) |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 24 | #define STRINGLIB_STR PyBytes_AS_STRING |
| 25 | #define STRINGLIB_LEN PyBytes_GET_SIZE |
| 26 | #define STRINGLIB_NEW PyBytes_FromStringAndSize |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 27 | #define STRINGLIB_CHECK PyBytes_Check |
Eric Smith | 0f78bff | 2009-11-30 01:01:42 +0000 | [diff] [blame] | 28 | #define STRINGLIB_CHECK_EXACT PyBytes_CheckExact |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 29 | #define STRINGLIB_TOSTR PyObject_Str |
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 */ |