ucs2lib.h 1.2 KB

123456789101112131415161718192021222324252627282930
  1. /* this is sort of a hack. there's at least one place (formatting
  2. floats) where some stringlib code takes a different path if it's
  3. compiled as unicode. */
  4. #define STRINGLIB_IS_UNICODE 1
  5. #define FASTSEARCH ucs2lib_fastsearch
  6. #define STRINGLIB(F) ucs2lib_##F
  7. #define STRINGLIB_OBJECT PyUnicodeObject
  8. #define STRINGLIB_SIZEOF_CHAR 2
  9. #define STRINGLIB_MAX_CHAR 0xFFFFu
  10. #define STRINGLIB_CHAR Py_UCS2
  11. #define STRINGLIB_TYPE_NAME "unicode"
  12. #define STRINGLIB_PARSE_CODE "U"
  13. #define STRINGLIB_ISSPACE Py_UNICODE_ISSPACE
  14. #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK
  15. #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL
  16. #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL
  17. #define STRINGLIB_STR PyUnicode_2BYTE_DATA
  18. #define STRINGLIB_LEN PyUnicode_GET_LENGTH
  19. #define STRINGLIB_NEW _PyUnicode_FromUCS2
  20. #define STRINGLIB_CHECK PyUnicode_Check
  21. #define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact
  22. #define STRINGLIB_MUTABLE 0
  23. #if SIZEOF_WCHAR_T == 2
  24. #define STRINGLIB_FAST_MEMCHR(s, c, n) \
  25. (Py_UCS2 *)wmemchr((const wchar_t *)(s), c, n)
  26. #endif
  27. #define STRINGLIB_TOSTR PyObject_Str
  28. #define STRINGLIB_TOASCII PyObject_ASCII