Left: | ||
Right: |
OLD | NEW |
---|---|
1 | |
2 /* Bytes (String) object interface */ | 1 /* Bytes (String) object interface */ |
3 | 2 |
4 #ifndef Py_BYTESOBJECT_H | 3 #ifndef Py_BYTESOBJECT_H |
5 #define Py_BYTESOBJECT_H | 4 #define Py_BYTESOBJECT_H |
6 #ifdef __cplusplus | 5 #ifdef __cplusplus |
7 extern "C" { | 6 extern "C" { |
8 #endif | 7 #endif |
9 | 8 |
10 #include <stdarg.h> | 9 #include <stdarg.h> |
11 | 10 |
(...skipping 26 matching lines...) Expand all Loading... | |
38 * ob_sval[ob_size] == 0. | 37 * ob_sval[ob_size] == 0. |
39 * ob_shash is the hash of the string or -1 if not computed yet. | 38 * ob_shash is the hash of the string or -1 if not computed yet. |
40 */ | 39 */ |
41 } PyBytesObject; | 40 } PyBytesObject; |
42 #endif | 41 #endif |
43 | 42 |
44 PyAPI_DATA(PyTypeObject) PyBytes_Type; | 43 PyAPI_DATA(PyTypeObject) PyBytes_Type; |
45 PyAPI_DATA(PyTypeObject) PyBytesIter_Type; | 44 PyAPI_DATA(PyTypeObject) PyBytesIter_Type; |
46 | 45 |
47 #define PyBytes_Check(op) \ | 46 #define PyBytes_Check(op) \ |
48 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS) | 47 » » PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS) |
storchaka
2016/10/31 10:52:05
Unrelated change.
| |
49 #define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) | 48 #define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) |
50 | 49 |
51 PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); | 50 PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); |
52 PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); | 51 PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); |
53 PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); | 52 PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); |
54 PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) | 53 PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) |
55 Py_GCC_ATTRIBUTE((format(printf, 1, 0))); | 54 Py_GCC_ATTRIBUTE((format(printf, 1, 0))); |
56 PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) | 55 PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) |
57 Py_GCC_ATTRIBUTE((format(printf, 1, 2))); | 56 Py_GCC_ATTRIBUTE((format(printf, 1, 2))); |
58 PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); | 57 PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); |
59 PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); | 58 PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); |
60 PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); | 59 PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); |
61 PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *); | 60 PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *); |
62 PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *); | 61 PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *); |
63 #ifndef Py_LIMITED_API | 62 #ifndef Py_LIMITED_API |
64 PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); | 63 PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); |
65 PyAPI_FUNC(PyObject*) _PyBytes_FormatEx( | 64 PyAPI_FUNC(PyObject*) _PyBytes_FormatEx( |
66 const char *format, | 65 const char *format, |
67 Py_ssize_t format_len, | 66 Py_ssize_t format_len, |
68 PyObject *args, | 67 PyObject *args, |
69 int use_bytearray); | 68 int use_bytearray); |
70 PyAPI_FUNC(PyObject*) _PyBytes_FromHex( | 69 PyAPI_FUNC(PyObject*) _PyBytes_FromHex( |
71 PyObject *string, | 70 PyObject *string, |
72 int use_bytearray); | 71 int use_bytearray); |
73 #endif | 72 #endif |
74 PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, | 73 PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, |
75 const char *, Py_ssize_t, | 74 const char *, Py_ssize_t, |
76 const char *); | 75 const char *); |
76 /* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ | |
77 PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, | |
78 const char *, Py_ssize_t, | |
79 const char *, | |
80 const char**); | |
storchaka
2016/10/31 10:52:05
If there is a space between "char" and "*" in abov
| |
77 | 81 |
78 /* Macro, trading safety for speed */ | 82 /* Macro, trading safety for speed */ |
79 #ifndef Py_LIMITED_API | 83 #ifndef Py_LIMITED_API |
80 #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \ | 84 #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \ |
81 (((PyBytesObject *)(op))->ob_sval)) | 85 » » » » (((PyBytesObject *)(op))->ob_sval)) |
82 #define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op)) | 86 #define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op)) |
83 #endif | 87 #endif |
84 | 88 |
85 /* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, | 89 /* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, |
86 x must be an iterable object. */ | 90 x must be an iterable object. */ |
87 #ifndef Py_LIMITED_API | 91 #ifndef Py_LIMITED_API |
88 PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); | 92 PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); |
89 #endif | 93 #endif |
90 | 94 |
91 /* Provides access to the internal data buffer and size of a string | 95 /* Provides access to the internal data buffer and size of a string |
92 object or the default encoded version of a Unicode object. Passing | 96 object or the default encoded version of a Unicode object. Passing |
93 NULL as *len parameter will force the string buffer to be | 97 NULL as *len parameter will force the string buffer to be |
94 0-terminated (passing a string with embedded NULL characters will | 98 0-terminated (passing a string with embedded NULL characters will |
95 cause an exception). */ | 99 cause an exception). */ |
96 PyAPI_FUNC(int) PyBytes_AsStringAndSize( | 100 PyAPI_FUNC(int) PyBytes_AsStringAndSize( |
97 PyObject *obj, /* string or Unicode object */ | 101 PyObject *obj, /* string or Unicode object */ |
98 char **s, /* pointer to buffer variable */ | 102 char **s, /* pointer to buffer variable */ |
99 Py_ssize_t *len /* pointer to length variable or NULL | 103 Py_ssize_t *len /* pointer to length variable or NULL |
100 (only possible for 0-terminated | 104 » » » (only possible for 0-terminated |
101 strings) */ | 105 » » » strings) */ |
102 ); | 106 ); |
103 | 107 |
104 /* Using the current locale, insert the thousands grouping | 108 /* Using the current locale, insert the thousands grouping |
105 into the string pointed to by buffer. For the argument descriptions, | 109 into the string pointed to by buffer. For the argument descriptions, |
106 see Objects/stringlib/localeutil.h */ | 110 see Objects/stringlib/localeutil.h */ |
107 #ifndef Py_LIMITED_API | 111 #ifndef Py_LIMITED_API |
108 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer, | 112 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer, |
109 Py_ssize_t n_buffer, | 113 » » » » » » Py_ssize_t n_buffer, |
110 char *digits, | 114 » » » » » » char *digits, |
111 Py_ssize_t n_digits, | 115 » » » » » » Py_ssize_t n_digits, |
112 Py_ssize_t min_width); | 116 » » » » » » Py_ssize_t min_width); |
113 | 117 |
114 /* Using explicit passed-in values, insert the thousands grouping | 118 /* Using explicit passed-in values, insert the thousands grouping |
115 into the string pointed to by buffer. For the argument descriptions, | 119 into the string pointed to by buffer. For the argument descriptions, |
116 see Objects/stringlib/localeutil.h */ | 120 see Objects/stringlib/localeutil.h */ |
117 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer, | 121 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer, |
118 Py_ssize_t n_buffer, | 122 » » » » » » Py_ssize_t n_buffer, |
119 char *digits, | 123 » » » » » » char *digits, |
120 Py_ssize_t n_digits, | 124 » » » » » » Py_ssize_t n_digits, |
121 Py_ssize_t min_width, | 125 » » » » » » Py_ssize_t min_width, |
122 const char *grouping, | 126 » » » » » » const char *grouping, |
123 const char *thousands_sep); | 127 » » » » » » const char *thousands_sep); |
124 #endif | 128 #endif |
125 | 129 |
126 /* Flags used by string formatting */ | 130 /* Flags used by string formatting */ |
127 #define F_LJUST (1<<0) | 131 #define F_LJUST (1<<0) |
128 #define F_SIGN (1<<1) | 132 #define F_SIGN (1<<1) |
129 #define F_BLANK (1<<2) | 133 #define F_BLANK (1<<2) |
130 #define F_ALT (1<<3) | 134 #define F_ALT (1<<3) |
131 #define F_ZERO (1<<4) | 135 #define F_ZERO (1<<4) |
132 | 136 |
133 #ifndef Py_LIMITED_API | 137 #ifndef Py_LIMITED_API |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer, | 212 PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer, |
209 void *str, | 213 void *str, |
210 const void *bytes, | 214 const void *bytes, |
211 Py_ssize_t size); | 215 Py_ssize_t size); |
212 #endif /* Py_LIMITED_API */ | 216 #endif /* Py_LIMITED_API */ |
213 | 217 |
214 #ifdef __cplusplus | 218 #ifdef __cplusplus |
215 } | 219 } |
216 #endif | 220 #endif |
217 #endif /* !Py_BYTESOBJECT_H */ | 221 #endif /* !Py_BYTESOBJECT_H */ |
OLD | NEW |