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 | |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 9 | #define STRINGLIB_OBJECT PyBytesObject |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 10 | #define STRINGLIB_CHAR char |
| 11 | #define STRINGLIB_TYPE_NAME "string" |
Eric Smith | 37f1038 | 2007-09-01 10:56:01 +0000 | [diff] [blame] | 12 | #define STRINGLIB_PARSE_CODE "S" |
Eric Smith | 8fd3eba | 2008-02-17 19:48:00 +0000 | [diff] [blame] | 13 | #define STRINGLIB_EMPTY nullstring |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 14 | #define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9')) |
| 15 | #define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1) |
Eric Smith | 8fd3eba | 2008-02-17 19:48:00 +0000 | [diff] [blame] | 16 | #define STRINGLIB_TOUPPER toupper |
| 17 | #define STRINGLIB_TOLOWER tolower |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 18 | #define STRINGLIB_FILL memset |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 19 | #define STRINGLIB_STR PyBytes_AS_STRING |
| 20 | #define STRINGLIB_LEN PyBytes_GET_SIZE |
| 21 | #define STRINGLIB_NEW PyBytes_FromStringAndSize |
| 22 | #define STRINGLIB_RESIZE _PyBytes_Resize |
| 23 | #define STRINGLIB_CHECK PyBytes_Check |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 24 | #define STRINGLIB_CMP memcmp |
| 25 | #define STRINGLIB_TOSTR PyObject_Str |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 26 | #define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping |
Georg Brandl | 559e5d7 | 2008-06-11 18:37:52 +0000 | [diff] [blame] | 27 | #define STRINGLIB_TOASCII PyObject_Repr |
Eric Smith | 8c66326 | 2007-08-25 02:26:07 +0000 | [diff] [blame] | 28 | #endif /* !STRINGLIB_STRINGDEFS_H */ |