Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:50

0001 #ifndef Py_SLICEOBJECT_H
0002 #define Py_SLICEOBJECT_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006 
0007 /* The unique ellipsis object "..." */
0008 
0009 PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
0010 
0011 #define Py_Ellipsis (&_Py_EllipsisObject)
0012 
0013 /* Slice object interface */
0014 
0015 /*
0016 
0017 A slice object containing start, stop, and step data members (the
0018 names are from range).  After much talk with Guido, it was decided to
0019 let these be any arbitrary python type.  Py_None stands for omitted values.
0020 */
0021 #ifndef Py_LIMITED_API
0022 typedef struct {
0023     PyObject_HEAD
0024     PyObject *start, *stop, *step;      /* not NULL */
0025 } PySliceObject;
0026 #endif
0027 
0028 PyAPI_DATA(PyTypeObject) PySlice_Type;
0029 PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
0030 
0031 #define PySlice_Check(op) Py_IS_TYPE((op), &PySlice_Type)
0032 
0033 PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
0034                                   PyObject* step);
0035 #ifndef Py_LIMITED_API
0036 PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
0037 PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
0038                                  PyObject **start_ptr, PyObject **stop_ptr,
0039                                  PyObject **step_ptr);
0040 #endif
0041 PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
0042                                   Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
0043 Py_DEPRECATED(3.7)
0044 PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
0045                                      Py_ssize_t *start, Py_ssize_t *stop,
0046                                      Py_ssize_t *step,
0047                                      Py_ssize_t *slicelength);
0048 
0049 #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100
0050 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) (  \
0051     PySlice_Unpack((slice), (start), (stop), (step)) < 0 ?                  \
0052     ((*(slicelen) = 0), -1) :                                               \
0053     ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
0054      0))
0055 PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
0056                                Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
0057 PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,
0058                                              Py_ssize_t *start, Py_ssize_t *stop,
0059                                              Py_ssize_t step);
0060 #endif
0061 
0062 #ifdef __cplusplus
0063 }
0064 #endif
0065 #endif /* !Py_SLICEOBJECT_H */