blob: 21bc0257c69d3d4636dd4e1db13c0c39a900c2b8 [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*/
21
22typedef 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;
26
Mark Hammond91a681d2002-08-12 07:21:58 +000027PyAPI_DATA(PyTypeObject) PySlice_Type;
Guido van Rossume15d0de1996-07-30 16:42:30 +000028
Martin v. Löwis9f2e3462007-07-21 17:22:18 +000029#define PySlice_Check(op) (Py_Type(op) == &PySlice_Type)
Guido van Rossume15d0de1996-07-30 16:42:30 +000030
Mark Hammond91a681d2002-08-12 07:21:58 +000031PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
Fred Drake3cf4d2b2000-07-09 00:55:06 +000032 PyObject* step);
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000033PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
Martin v. Löwis18e16552006-02-15 17:27:45 +000034PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
35 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
36PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
37 Py_ssize_t *start, Py_ssize_t *stop,
38 Py_ssize_t *step, Py_ssize_t *slicelength);
Guido van Rossume15d0de1996-07-30 16:42:30 +000039
40#ifdef __cplusplus
41}
42#endif
43#endif /* !Py_SLICEOBJECT_H */