bytes_methods.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef Py_BYTES_CTYPE_H
  2. #define Py_BYTES_CTYPE_H
  3. /*
  4. * The internal implementation behind PyString (bytes) and PyBytes (buffer)
  5. * methods of the given names, they operate on ASCII byte strings.
  6. */
  7. extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len);
  8. extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len);
  9. extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len);
  10. extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len);
  11. extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len);
  12. extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len);
  13. extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
  14. /* These store their len sized answer in the given preallocated *result arg. */
  15. extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
  16. extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
  17. extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
  18. extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
  19. extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
  20. /* Shared __doc__ strings. */
  21. extern const char _Py_isspace__doc__[];
  22. extern const char _Py_isalpha__doc__[];
  23. extern const char _Py_isalnum__doc__[];
  24. extern const char _Py_isdigit__doc__[];
  25. extern const char _Py_islower__doc__[];
  26. extern const char _Py_isupper__doc__[];
  27. extern const char _Py_istitle__doc__[];
  28. extern const char _Py_lower__doc__[];
  29. extern const char _Py_upper__doc__[];
  30. extern const char _Py_title__doc__[];
  31. extern const char _Py_capitalize__doc__[];
  32. extern const char _Py_swapcase__doc__[];
  33. /* These are left in for backward compatibility and will be removed
  34. in 2.8/3.2 */
  35. #define ISLOWER(c) Py_ISLOWER(c)
  36. #define ISUPPER(c) Py_ISUPPER(c)
  37. #define ISALPHA(c) Py_ISALPHA(c)
  38. #define ISDIGIT(c) Py_ISDIGIT(c)
  39. #define ISXDIGIT(c) Py_ISXDIGIT(c)
  40. #define ISALNUM(c) Py_ISALNUM(c)
  41. #define ISSPACE(c) Py_ISSPACE(c)
  42. #undef islower
  43. #define islower(c) undefined_islower(c)
  44. #undef isupper
  45. #define isupper(c) undefined_isupper(c)
  46. #undef isalpha
  47. #define isalpha(c) undefined_isalpha(c)
  48. #undef isdigit
  49. #define isdigit(c) undefined_isdigit(c)
  50. #undef isxdigit
  51. #define isxdigit(c) undefined_isxdigit(c)
  52. #undef isalnum
  53. #define isalnum(c) undefined_isalnum(c)
  54. #undef isspace
  55. #define isspace(c) undefined_isspace(c)
  56. /* These are left in for backward compatibility and will be removed
  57. in 2.8/3.2 */
  58. #define TOLOWER(c) Py_TOLOWER(c)
  59. #define TOUPPER(c) Py_TOUPPER(c)
  60. #undef tolower
  61. #define tolower(c) undefined_tolower(c)
  62. #undef toupper
  63. #define toupper(c) undefined_toupper(c)
  64. /* this is needed because some docs are shared from the .o, not static */
  65. #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str)
  66. #endif /* !Py_BYTES_CTYPE_H */