blob: dbc34b2aeaac175741394df2fbc645f71ea09910 [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
29#define PySlice_Check(op) ((op)->ob_type == &PySlice_Type)
30
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 */