sliceobject.h 1.55 KB
Newer Older
1 2 3 4 5 6
#ifndef Py_SLICEOBJECT_H
#define Py_SLICEOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif

7
/* The unique ellipsis object "..." */
8

9
PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
10

11
#define Py_Ellipsis (&_Py_EllipsisObject)
12 13 14 15 16 17 18

/* Slice object interface */

/*

A slice object containing start, stop, and step data members (the
names are from range).  After much talk with Guido, it was decided to
19
let these be any arbitrary python type.  Py_None stands for omitted values.
20
*/
21
#ifndef Py_LIMITED_API
22
typedef struct {
23
    PyObject_HEAD
24
    PyObject *start, *stop, *step;	/* not NULL */
25
} PySliceObject;
26
#endif
27

28
PyAPI_DATA(PyTypeObject) PySlice_Type;
29
PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
30

31
#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
32

33
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
34
                                  PyObject* step);
35
#ifndef Py_LIMITED_API
36
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
37 38 39
PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
                                 PyObject **start_ptr, PyObject **stop_ptr,
                                 PyObject **step_ptr);
40 41
#endif
PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
Martin v. Löwis's avatar
Martin v. Löwis committed
42
                                  Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
43
PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
Martin v. Löwis's avatar
Martin v. Löwis committed
44 45
				    Py_ssize_t *start, Py_ssize_t *stop, 
				    Py_ssize_t *step, Py_ssize_t *slicelength);
46 47 48 49 50

#ifdef __cplusplus
}
#endif
#endif /* !Py_SLICEOBJECT_H */