stringdefs.h 1.2 KB

12345678910111213141516171819202122232425262728
  1. #ifndef STRINGLIB_STRINGDEFS_H
  2. #define STRINGLIB_STRINGDEFS_H
  3. /* this is sort of a hack. there's at least one place (formatting
  4. floats) where some stringlib code takes a different path if it's
  5. compiled as unicode. */
  6. #define STRINGLIB_IS_UNICODE 0
  7. #define FASTSEARCH fastsearch
  8. #define STRINGLIB(F) stringlib_##F
  9. #define STRINGLIB_OBJECT PyBytesObject
  10. #define STRINGLIB_SIZEOF_CHAR 1
  11. #define STRINGLIB_CHAR char
  12. #define STRINGLIB_TYPE_NAME "string"
  13. #define STRINGLIB_PARSE_CODE "S"
  14. #define STRINGLIB_ISSPACE Py_ISSPACE
  15. #define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r'))
  16. #define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9'))
  17. #define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1)
  18. #define STRINGLIB_STR PyBytes_AS_STRING
  19. #define STRINGLIB_LEN PyBytes_GET_SIZE
  20. #define STRINGLIB_NEW PyBytes_FromStringAndSize
  21. #define STRINGLIB_CHECK PyBytes_Check
  22. #define STRINGLIB_CHECK_EXACT PyBytes_CheckExact
  23. #define STRINGLIB_TOSTR PyObject_Str
  24. #define STRINGLIB_TOASCII PyObject_Repr
  25. #define STRINGLIB_FAST_MEMCHR memchr
  26. #endif /* !STRINGLIB_STRINGDEFS_H */