Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/python3....
File: bytesobject.h
[0] Fix | Delete
/* Bytes (String) object interface */
[1] Fix | Delete
[2] Fix | Delete
#ifndef Py_BYTESOBJECT_H
[3] Fix | Delete
#define Py_BYTESOBJECT_H
[4] Fix | Delete
#ifdef __cplusplus
[5] Fix | Delete
extern "C" {
[6] Fix | Delete
#endif
[7] Fix | Delete
[8] Fix | Delete
#include <stdarg.h>
[9] Fix | Delete
[10] Fix | Delete
/*
[11] Fix | Delete
Type PyBytesObject represents a character string. An extra zero byte is
[12] Fix | Delete
reserved at the end to ensure it is zero-terminated, but a size is
[13] Fix | Delete
present so strings with null bytes in them can be represented. This
[14] Fix | Delete
is an immutable object type.
[15] Fix | Delete
[16] Fix | Delete
There are functions to create new string objects, to test
[17] Fix | Delete
an object for string-ness, and to get the
[18] Fix | Delete
string value. The latter function returns a null pointer
[19] Fix | Delete
if the object is not of the proper type.
[20] Fix | Delete
There is a variant that takes an explicit size as well as a
[21] Fix | Delete
variant that assumes a zero-terminated string. Note that none of the
[22] Fix | Delete
functions should be applied to nil objects.
[23] Fix | Delete
*/
[24] Fix | Delete
[25] Fix | Delete
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
[26] Fix | Delete
This significantly speeds up dict lookups. */
[27] Fix | Delete
[28] Fix | Delete
#ifndef Py_LIMITED_API
[29] Fix | Delete
typedef struct {
[30] Fix | Delete
PyObject_VAR_HEAD
[31] Fix | Delete
Py_hash_t ob_shash;
[32] Fix | Delete
char ob_sval[1];
[33] Fix | Delete
[34] Fix | Delete
/* Invariants:
[35] Fix | Delete
* ob_sval contains space for 'ob_size+1' elements.
[36] Fix | Delete
* ob_sval[ob_size] == 0.
[37] Fix | Delete
* ob_shash is the hash of the string or -1 if not computed yet.
[38] Fix | Delete
*/
[39] Fix | Delete
} PyBytesObject;
[40] Fix | Delete
#endif
[41] Fix | Delete
[42] Fix | Delete
PyAPI_DATA(PyTypeObject) PyBytes_Type;
[43] Fix | Delete
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
[44] Fix | Delete
[45] Fix | Delete
#define PyBytes_Check(op) \
[46] Fix | Delete
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
[47] Fix | Delete
#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type)
[48] Fix | Delete
[49] Fix | Delete
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
[50] Fix | Delete
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
[51] Fix | Delete
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
[52] Fix | Delete
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
[53] Fix | Delete
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
[54] Fix | Delete
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
[55] Fix | Delete
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
[56] Fix | Delete
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
[57] Fix | Delete
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
[58] Fix | Delete
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
[59] Fix | Delete
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
[60] Fix | Delete
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
[61] Fix | Delete
#ifndef Py_LIMITED_API
[62] Fix | Delete
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
[63] Fix | Delete
PyAPI_FUNC(PyObject*) _PyBytes_FormatEx(
[64] Fix | Delete
const char *format,
[65] Fix | Delete
Py_ssize_t format_len,
[66] Fix | Delete
PyObject *args,
[67] Fix | Delete
int use_bytearray);
[68] Fix | Delete
PyAPI_FUNC(PyObject*) _PyBytes_FromHex(
[69] Fix | Delete
PyObject *string,
[70] Fix | Delete
int use_bytearray);
[71] Fix | Delete
#endif
[72] Fix | Delete
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
[73] Fix | Delete
const char *, Py_ssize_t,
[74] Fix | Delete
const char *);
[75] Fix | Delete
#ifndef Py_LIMITED_API
[76] Fix | Delete
/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */
[77] Fix | Delete
PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
[78] Fix | Delete
const char *, Py_ssize_t,
[79] Fix | Delete
const char *,
[80] Fix | Delete
const char **);
[81] Fix | Delete
#endif
[82] Fix | Delete
[83] Fix | Delete
/* Macro, trading safety for speed */
[84] Fix | Delete
#ifndef Py_LIMITED_API
[85] Fix | Delete
#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
[86] Fix | Delete
(((PyBytesObject *)(op))->ob_sval))
[87] Fix | Delete
#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
[88] Fix | Delete
#endif
[89] Fix | Delete
[90] Fix | Delete
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
[91] Fix | Delete
x must be an iterable object. */
[92] Fix | Delete
#ifndef Py_LIMITED_API
[93] Fix | Delete
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
[94] Fix | Delete
#endif
[95] Fix | Delete
[96] Fix | Delete
/* Provides access to the internal data buffer and size of a string
[97] Fix | Delete
object or the default encoded version of a Unicode object. Passing
[98] Fix | Delete
NULL as *len parameter will force the string buffer to be
[99] Fix | Delete
0-terminated (passing a string with embedded NULL characters will
[100] Fix | Delete
cause an exception). */
[101] Fix | Delete
PyAPI_FUNC(int) PyBytes_AsStringAndSize(
[102] Fix | Delete
PyObject *obj, /* string or Unicode object */
[103] Fix | Delete
char **s, /* pointer to buffer variable */
[104] Fix | Delete
Py_ssize_t *len /* pointer to length variable or NULL
[105] Fix | Delete
(only possible for 0-terminated
[106] Fix | Delete
strings) */
[107] Fix | Delete
);
[108] Fix | Delete
[109] Fix | Delete
/* Using the current locale, insert the thousands grouping
[110] Fix | Delete
into the string pointed to by buffer. For the argument descriptions,
[111] Fix | Delete
see Objects/stringlib/localeutil.h */
[112] Fix | Delete
#ifndef Py_LIMITED_API
[113] Fix | Delete
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer,
[114] Fix | Delete
Py_ssize_t n_buffer,
[115] Fix | Delete
char *digits,
[116] Fix | Delete
Py_ssize_t n_digits,
[117] Fix | Delete
Py_ssize_t min_width);
[118] Fix | Delete
[119] Fix | Delete
/* Using explicit passed-in values, insert the thousands grouping
[120] Fix | Delete
into the string pointed to by buffer. For the argument descriptions,
[121] Fix | Delete
see Objects/stringlib/localeutil.h */
[122] Fix | Delete
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,
[123] Fix | Delete
Py_ssize_t n_buffer,
[124] Fix | Delete
char *digits,
[125] Fix | Delete
Py_ssize_t n_digits,
[126] Fix | Delete
Py_ssize_t min_width,
[127] Fix | Delete
const char *grouping,
[128] Fix | Delete
const char *thousands_sep);
[129] Fix | Delete
#endif
[130] Fix | Delete
[131] Fix | Delete
/* Flags used by string formatting */
[132] Fix | Delete
#define F_LJUST (1<<0)
[133] Fix | Delete
#define F_SIGN (1<<1)
[134] Fix | Delete
#define F_BLANK (1<<2)
[135] Fix | Delete
#define F_ALT (1<<3)
[136] Fix | Delete
#define F_ZERO (1<<4)
[137] Fix | Delete
[138] Fix | Delete
#ifndef Py_LIMITED_API
[139] Fix | Delete
/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer".
[140] Fix | Delete
A _PyBytesWriter variable must be declared at the end of variables in a
[141] Fix | Delete
function to optimize the memory allocation on the stack. */
[142] Fix | Delete
typedef struct {
[143] Fix | Delete
/* bytes, bytearray or NULL (when the small buffer is used) */
[144] Fix | Delete
PyObject *buffer;
[145] Fix | Delete
[146] Fix | Delete
/* Number of allocated size. */
[147] Fix | Delete
Py_ssize_t allocated;
[148] Fix | Delete
[149] Fix | Delete
/* Minimum number of allocated bytes,
[150] Fix | Delete
incremented by _PyBytesWriter_Prepare() */
[151] Fix | Delete
Py_ssize_t min_size;
[152] Fix | Delete
[153] Fix | Delete
/* If non-zero, use a bytearray instead of a bytes object for buffer. */
[154] Fix | Delete
int use_bytearray;
[155] Fix | Delete
[156] Fix | Delete
/* If non-zero, overallocate the buffer (default: 0).
[157] Fix | Delete
This flag must be zero if use_bytearray is non-zero. */
[158] Fix | Delete
int overallocate;
[159] Fix | Delete
[160] Fix | Delete
/* Stack buffer */
[161] Fix | Delete
int use_small_buffer;
[162] Fix | Delete
char small_buffer[512];
[163] Fix | Delete
} _PyBytesWriter;
[164] Fix | Delete
[165] Fix | Delete
/* Initialize a bytes writer
[166] Fix | Delete
[167] Fix | Delete
By default, the overallocation is disabled. Set the overallocate attribute
[168] Fix | Delete
to control the allocation of the buffer. */
[169] Fix | Delete
PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer);
[170] Fix | Delete
[171] Fix | Delete
/* Get the buffer content and reset the writer.
[172] Fix | Delete
Return a bytes object, or a bytearray object if use_bytearray is non-zero.
[173] Fix | Delete
Raise an exception and return NULL on error. */
[174] Fix | Delete
PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer,
[175] Fix | Delete
void *str);
[176] Fix | Delete
[177] Fix | Delete
/* Deallocate memory of a writer (clear its internal buffer). */
[178] Fix | Delete
PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer);
[179] Fix | Delete
[180] Fix | Delete
/* Allocate the buffer to write size bytes.
[181] Fix | Delete
Return the pointer to the beginning of buffer data.
[182] Fix | Delete
Raise an exception and return NULL on error. */
[183] Fix | Delete
PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer,
[184] Fix | Delete
Py_ssize_t size);
[185] Fix | Delete
[186] Fix | Delete
/* Ensure that the buffer is large enough to write *size* bytes.
[187] Fix | Delete
Add size to the writer minimum size (min_size attribute).
[188] Fix | Delete
[189] Fix | Delete
str is the current pointer inside the buffer.
[190] Fix | Delete
Return the updated current pointer inside the buffer.
[191] Fix | Delete
Raise an exception and return NULL on error. */
[192] Fix | Delete
PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
[193] Fix | Delete
void *str,
[194] Fix | Delete
Py_ssize_t size);
[195] Fix | Delete
[196] Fix | Delete
/* Resize the buffer to make it larger.
[197] Fix | Delete
The new buffer may be larger than size bytes because of overallocation.
[198] Fix | Delete
Return the updated current pointer inside the buffer.
[199] Fix | Delete
Raise an exception and return NULL on error.
[200] Fix | Delete
[201] Fix | Delete
Note: size must be greater than the number of allocated bytes in the writer.
[202] Fix | Delete
[203] Fix | Delete
This function doesn't use the writer minimum size (min_size attribute).
[204] Fix | Delete
[205] Fix | Delete
See also _PyBytesWriter_Prepare().
[206] Fix | Delete
*/
[207] Fix | Delete
PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer,
[208] Fix | Delete
void *str,
[209] Fix | Delete
Py_ssize_t size);
[210] Fix | Delete
[211] Fix | Delete
/* Write bytes.
[212] Fix | Delete
Raise an exception and return NULL on error. */
[213] Fix | Delete
PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
[214] Fix | Delete
void *str,
[215] Fix | Delete
const void *bytes,
[216] Fix | Delete
Py_ssize_t size);
[217] Fix | Delete
#endif /* Py_LIMITED_API */
[218] Fix | Delete
[219] Fix | Delete
#ifdef __cplusplus
[220] Fix | Delete
}
[221] Fix | Delete
#endif
[222] Fix | Delete
#endif /* !Py_BYTESOBJECT_H */
[223] Fix | Delete
[224] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function