Guido van Rossum | e15d0de | 1996-07-30 16:42:30 +0000 | [diff] [blame] | 1 | #ifndef Py_SLICEOBJECT_H |
| 2 | #define Py_SLICEOBJECT_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
Guido van Rossum | e449af7 | 1996-10-11 16:25:41 +0000 | [diff] [blame] | 7 | /* The unique ellipsis object "..." */ |
Guido van Rossum | e15d0de | 1996-07-30 16:42:30 +0000 | [diff] [blame] | 8 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 9 | PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ |
Guido van Rossum | e15d0de | 1996-07-30 16:42:30 +0000 | [diff] [blame] | 10 | |
Guido van Rossum | e449af7 | 1996-10-11 16:25:41 +0000 | [diff] [blame] | 11 | #define Py_Ellipsis (&_Py_EllipsisObject) |
Guido van Rossum | e15d0de | 1996-07-30 16:42:30 +0000 | [diff] [blame] | 12 | |
| 13 | /* Slice object interface */ |
| 14 | |
| 15 | /* |
| 16 | |
| 17 | A slice object containing start, stop, and step data members (the |
| 18 | names are from range). After much talk with Guido, it was decided to |
| 19 | let these be any arbitrary python type. |
| 20 | */ |
| 21 | |
| 22 | typedef struct { |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 23 | PyObject_HEAD |
| 24 | PyObject *start, *stop, *step; |
Guido van Rossum | e15d0de | 1996-07-30 16:42:30 +0000 | [diff] [blame] | 25 | } PySliceObject; |
| 26 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 27 | PyAPI_DATA(PyTypeObject) PySlice_Type; |
Guido van Rossum | e15d0de | 1996-07-30 16:42:30 +0000 | [diff] [blame] | 28 | |
| 29 | #define PySlice_Check(op) ((op)->ob_type == &PySlice_Type) |
| 30 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 31 | PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 32 | PyObject* step); |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 33 | PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, int length, |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 34 | int *start, int *stop, int *step); |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 35 | PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, int length, |
Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 36 | int *start, int *stop, |
| 37 | int *step, int *slicelength); |
Guido van Rossum | e15d0de | 1996-07-30 16:42:30 +0000 | [diff] [blame] | 38 | |
| 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |
| 42 | #endif /* !Py_SLICEOBJECT_H */ |