blob: 8bec17909d676b275688d3fd366a7a2c73eab6e0 [file] [log] [blame]
Guido van Rossume15d0de1996-07-30 16:42:30 +00001#ifndef Py_SLICEOBJECT_H
2#define Py_SLICEOBJECT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
Guido van Rossume449af71996-10-11 16:25:41 +00007/* The unique ellipsis object "..." */
Guido van Rossume15d0de1996-07-30 16:42:30 +00008
Mark Hammond91a681d2002-08-12 07:21:58 +00009PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
Guido van Rossume15d0de1996-07-30 16:42:30 +000010
Guido van Rossume449af71996-10-11 16:25:41 +000011#define Py_Ellipsis (&_Py_EllipsisObject)
Guido van Rossume15d0de1996-07-30 16:42:30 +000012
13/* Slice object interface */
14
15/*
16
17A slice object containing start, stop, and step data members (the
18names are from range). After much talk with Guido, it was decided to
Armin Rigo89a39462004-10-28 16:32:00 +000019let these be any arbitrary python type. Py_None stands for omitted values.
Guido van Rossume15d0de1996-07-30 16:42:30 +000020*/
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000021#ifndef Py_LIMITED_API
Guido van Rossume15d0de1996-07-30 16:42:30 +000022typedef struct {
Fred Drake3cf4d2b2000-07-09 00:55:06 +000023 PyObject_HEAD
Armin Rigo89a39462004-10-28 16:32:00 +000024 PyObject *start, *stop, *step; /* not NULL */
Guido van Rossume15d0de1996-07-30 16:42:30 +000025} PySliceObject;
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000026#endif
Guido van Rossume15d0de1996-07-30 16:42:30 +000027
Mark Hammond91a681d2002-08-12 07:21:58 +000028PyAPI_DATA(PyTypeObject) PySlice_Type;
Benjamin Petersonfd838e62009-04-20 02:09:13 +000029PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
Guido van Rossume15d0de1996-07-30 16:42:30 +000030
Christian Heimes90aa7642007-12-19 02:45:37 +000031#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
Guido van Rossume15d0de1996-07-30 16:42:30 +000032
Mark Hammond91a681d2002-08-12 07:21:58 +000033PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
Fred Drake3cf4d2b2000-07-09 00:55:06 +000034 PyObject* step);
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000035#ifndef Py_LIMITED_API
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000036PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000037#endif
38PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
Martin v. Löwis18e16552006-02-15 17:27:45 +000039 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000040PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
Martin v. Löwis18e16552006-02-15 17:27:45 +000041 Py_ssize_t *start, Py_ssize_t *stop,
42 Py_ssize_t *step, Py_ssize_t *slicelength);
Guido van Rossume15d0de1996-07-30 16:42:30 +000043
44#ifdef __cplusplus
45}
46#endif
47#endif /* !Py_SLICEOBJECT_H */