blob: bdc3a29160c10d93f70d998da296b6f0baeb9caf [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
Christian Heimes593daf52008-05-26 12:51:38 +00009#define STRINGLIB_OBJECT PyBytesObject
Eric Smitha9f7d622008-02-17 19:46:49 +000010#define STRINGLIB_CHAR char
11#define STRINGLIB_TYPE_NAME "string"
12#define STRINGLIB_PARSE_CODE "S"
13#define STRINGLIB_EMPTY nullstring
14#define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9'))
15#define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1)
16#define STRINGLIB_TOUPPER toupper
17#define STRINGLIB_TOLOWER tolower
18#define STRINGLIB_FILL memset
Christian Heimes593daf52008-05-26 12:51:38 +000019#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 Smitha9f7d622008-02-17 19:46:49 +000024#define STRINGLIB_CMP memcmp
25#define STRINGLIB_TOSTR PyObject_Str
Christian Heimes593daf52008-05-26 12:51:38 +000026#define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping
Eric Smitha9f7d622008-02-17 19:46:49 +000027
28#endif /* !STRINGLIB_STRINGDEFS_H */