blob: a5672c7e6b93694b34c32667bb7050beac5f7dfa [file] [log] [blame]
Eric Smith8c663262007-08-25 02:26:07 +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 Heimes72b710a2008-05-26 13:28:38 +00009#define STRINGLIB_OBJECT PyBytesObject
Eric Smith8c663262007-08-25 02:26:07 +000010#define STRINGLIB_CHAR char
11#define STRINGLIB_TYPE_NAME "string"
Eric Smith37f10382007-09-01 10:56:01 +000012#define STRINGLIB_PARSE_CODE "S"
Eric Smith8fd3eba2008-02-17 19:48:00 +000013#define STRINGLIB_EMPTY nullstring
Eric Smith8c663262007-08-25 02:26:07 +000014#define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9'))
15#define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1)
Eric Smith6dc46f52009-04-27 20:39:49 +000016#define STRINGLIB_TOUPPER Py_TOUPPER
17#define STRINGLIB_TOLOWER Py_TOLOWER
Eric Smith8c663262007-08-25 02:26:07 +000018#define STRINGLIB_FILL memset
Christian Heimes72b710a2008-05-26 13:28: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 Smith8c663262007-08-25 02:26:07 +000024#define STRINGLIB_CMP memcmp
25#define STRINGLIB_TOSTR PyObject_Str
Christian Heimes72b710a2008-05-26 13:28:38 +000026#define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping
Eric Smitha3b1ac82009-04-03 14:45:06 +000027#define STRINGLIB_GROUPING_LOCALE _PyBytes_InsertThousandsGroupingLocale
Georg Brandl559e5d72008-06-11 18:37:52 +000028#define STRINGLIB_TOASCII PyObject_Repr
Eric Smith8c663262007-08-25 02:26:07 +000029#endif /* !STRINGLIB_STRINGDEFS_H */