1 /**
2   Mirror _sliceobject.h
3 
4   Slice object interface
5   */
6 module deimos.python.sliceobject;
7 
8 import deimos.python.pyport;
9 import deimos.python.object;
10 
11 extern(C):
12 // Python-header-file: Include/sliceobject.h:
13 
14 mixin(PyAPI_DATA!"PyObject _Py_EllipsisObject");
15 
16 /** The unique ellipsis object "..." */
17 @property PyObject* Py_Ellipsis()() {
18     return &_Py_EllipsisObject;
19 }
20 
21 /**
22 A slice object containing start, stop, and step data members (the
23 names are from range).  After much talk with Guido, it was decided to
24 let these be any arbitrary python type.  Py_None stands for omitted values.
25 
26 subclass of PyObject
27 */
28 struct PySliceObject {
29     mixin PyObject_HEAD;
30     /** not NULL */
31     PyObject* start;
32     /// ditto
33     PyObject* stop;
34     /// ditto
35     PyObject* step;
36 }
37 
38 /// _
39 mixin(PyAPI_DATA!"PyTypeObject PySlice_Type");
40 
41 // D translation of C macro:
42 /// _
43 int PySlice_Check()(PyObject* op) {
44     return Py_TYPE(op) == &PySlice_Type;
45 }
46 
47 /// _
48 PyObject* PySlice_New(PyObject* start, PyObject* stop, PyObject* step);
49 // before python 3.2, r was typed as PySliceObject*, but bah humbug.
50 /// _
51 int PySlice_GetIndices(PyObject* r, Py_ssize_t length,
52         Py_ssize_t* start, Py_ssize_t* stop, Py_ssize_t* step);
53 // before python 3.2, r was typed as PySliceObject*, but bah humbug.
54 /// _
55 int PySlice_GetIndicesEx(PyObject* r, Py_ssize_t length,
56         Py_ssize_t* start, Py_ssize_t* stop,
57         Py_ssize_t* step, Py_ssize_t* slicelength);
58 
59