vidya7732/AI_Doctor_LLM_GenModel
0
1 2/* Bytes (String) object interface */3 4#ifndef Py_BYTESOBJECT_H5#define Py_BYTESOBJECT_H6#ifdef __cplusplus7extern "C" {8#endif9 10#include <stdarg.h>11 12/*13Type PyBytesObject represents a character string. An extra zero byte is14reserved at the end to ensure it is zero-terminated, but a size is15present so strings with null bytes in them can be represented. This16is an immutable object type.17 18There are functions to create new string objects, to test19an object for string-ness, and to get the20string value. The latter function returns a null pointer21if the object is not of the proper type.22There is a variant that takes an explicit size as well as a23variant that assumes a zero-terminated string. Note that none of the24functions should be applied to nil objects.25*/26 27/* Caching the hash (ob_shash) saves recalculation of a string's hash value.28 This significantly speeds up dict lookups. */29 30PyAPI_DATA(PyTypeObject) PyBytes_Type;31PyAPI_DATA(PyTypeObject) PyBytesIter_Type;32 33#define PyBytes_Check(op) \34 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)35#define PyBytes_CheckExact(op) Py_IS_TYPE(op, &PyBytes_Type)36 37PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);38PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);39PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);40PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)41 Py_GCC_ATTRIBUTE((format(printf, 1, 0)));42PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)43 Py_GCC_ATTRIBUTE((format(printf, 1, 2)));44PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);45PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);46PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);47PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);48PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);49PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,50 const char *, Py_ssize_t,51 const char *);52 53/* Provides access to the internal data buffer and size of a string54 object or the default encoded version of a Unicode object. Passing55 NULL as *len parameter will force the string buffer to be56 0-terminated (passing a string with embedded NULL characters will57 cause an exception). */58PyAPI_FUNC(int) PyBytes_AsStringAndSize(59 PyObject *obj, /* string or Unicode object */60 char **s, /* pointer to buffer variable */61 Py_ssize_t *len /* pointer to length variable or NULL62 (only possible for 0-terminated63 strings) */64 );65 66/* Flags used by string formatting */67#define F_LJUST (1<<0)68#define F_SIGN (1<<1)69#define F_BLANK (1<<2)70#define F_ALT (1<<3)71#define F_ZERO (1<<4)72 73#ifndef Py_LIMITED_API74# define Py_CPYTHON_BYTESOBJECT_H75# include "cpython/bytesobject.h"76# undef Py_CPYTHON_BYTESOBJECT_H77#endif78 79#ifdef __cplusplus80}81#endif82#endif /* !Py_BYTESOBJECT_H */83 