blob: d08971a7280b0c3405c28c8206f056a09eaaf6aa [file] [log] [blame]
Eric Smitha9f7d622008-02-17 19:46:49 +00001#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
Eric Smithaca19e62009-04-22 13:29:05 +00009/* _tolower and _toupper are defined by SUSv2, but they're not ISO C */
10/* This needs to be cleaned up. See issue 5793. */
11#ifndef _tolower
12#define _tolower tolower
13#endif
14#ifndef _toupper
15#define _toupper toupper
16#endif
17
Gregory P. Smithdd96db62008-06-09 04:58:54 +000018#define STRINGLIB_OBJECT PyStringObject
Eric Smitha9f7d622008-02-17 19:46:49 +000019#define STRINGLIB_CHAR char
20#define STRINGLIB_TYPE_NAME "string"
21#define STRINGLIB_PARSE_CODE "S"
22#define STRINGLIB_EMPTY nullstring
23#define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9'))
24#define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1)
Eric Smithaca19e62009-04-22 13:29:05 +000025#define STRINGLIB_TOUPPER(x) _toupper(Py_CHARMASK(x))
26#define STRINGLIB_TOLOWER(x) _tolower(Py_CHARMASK(x))
Eric Smitha9f7d622008-02-17 19:46:49 +000027#define STRINGLIB_FILL memset
Gregory P. Smithdd96db62008-06-09 04:58:54 +000028#define STRINGLIB_STR PyString_AS_STRING
29#define STRINGLIB_LEN PyString_GET_SIZE
30#define STRINGLIB_NEW PyString_FromStringAndSize
31#define STRINGLIB_RESIZE _PyString_Resize
32#define STRINGLIB_CHECK PyString_Check
Eric Smitha9f7d622008-02-17 19:46:49 +000033#define STRINGLIB_CMP memcmp
34#define STRINGLIB_TOSTR PyObject_Str
Gregory P. Smithdd96db62008-06-09 04:58:54 +000035#define STRINGLIB_GROUPING _PyString_InsertThousandsGrouping
Eric Smithaca19e62009-04-22 13:29:05 +000036#define STRINGLIB_GROUPING_LOCALE _PyString_InsertThousandsGroupingLocale
Eric Smitha9f7d622008-02-17 19:46:49 +000037
38#endif /* !STRINGLIB_STRINGDEFS_H */