blob: fc80254dd51ee30f04eb82c3a731e35a10ce0c77 [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);
Mark Hammond91a681d2002-08-12 07:21:58 +000033PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, int length,
Fred Drake3cf4d2b2000-07-09 00:55:06 +000034 int *start, int *stop, int *step);
Mark Hammond91a681d2002-08-12 07:21:58 +000035PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, int length,
Michael W. Hudson5efaf7e2002-06-11 10:55:12 +000036 int *start, int *stop,
37 int *step, int *slicelength);
Guido van Rossume15d0de1996-07-30 16:42:30 +000038
39#ifdef __cplusplus
40}
41#endif
42#endif /* !Py_SLICEOBJECT_H */