Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/cpython
Path: blob/main/Objects/stringlib/stringdefs.h
12 views
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
9
#define FASTSEARCH fastsearch
10
#define STRINGLIB(F) stringlib_##F
11
#define STRINGLIB_OBJECT PyBytesObject
12
#define STRINGLIB_SIZEOF_CHAR 1
13
#define STRINGLIB_CHAR char
14
#define STRINGLIB_TYPE_NAME "string"
15
#define STRINGLIB_PARSE_CODE "S"
16
#define STRINGLIB_ISSPACE Py_ISSPACE
17
#define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r'))
18
#define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9'))
19
#define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1)
20
#define STRINGLIB_STR PyBytes_AS_STRING
21
#define STRINGLIB_LEN PyBytes_GET_SIZE
22
#define STRINGLIB_NEW PyBytes_FromStringAndSize
23
#define STRINGLIB_CHECK PyBytes_Check
24
#define STRINGLIB_CHECK_EXACT PyBytes_CheckExact
25
#define STRINGLIB_TOSTR PyObject_Str
26
#define STRINGLIB_TOASCII PyObject_Repr
27
#define STRINGLIB_FAST_MEMCHR memchr
28
#endif /* !STRINGLIB_STRINGDEFS_H */
29
30