gooderp18绿色标准版
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

66 lines
2.5KB

  1. #ifndef Py_SLICEOBJECT_H
  2. #define Py_SLICEOBJECT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* The unique ellipsis object "..." */
  7. PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
  8. #define Py_Ellipsis (&_Py_EllipsisObject)
  9. /* Slice object interface */
  10. /*
  11. A slice object containing start, stop, and step data members (the
  12. names are from range). After much talk with Guido, it was decided to
  13. let these be any arbitrary python type. Py_None stands for omitted values.
  14. */
  15. #ifndef Py_LIMITED_API
  16. typedef struct {
  17. PyObject_HEAD
  18. PyObject *start, *stop, *step; /* not NULL */
  19. } PySliceObject;
  20. #endif
  21. PyAPI_DATA(PyTypeObject) PySlice_Type;
  22. PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
  23. #define PySlice_Check(op) Py_IS_TYPE((op), &PySlice_Type)
  24. PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
  25. PyObject* step);
  26. #ifndef Py_LIMITED_API
  27. PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
  28. PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
  29. PyObject **start_ptr, PyObject **stop_ptr,
  30. PyObject **step_ptr);
  31. #endif
  32. PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
  33. Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
  34. Py_DEPRECATED(3.7)
  35. PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
  36. Py_ssize_t *start, Py_ssize_t *stop,
  37. Py_ssize_t *step,
  38. Py_ssize_t *slicelength);
  39. #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100
  40. #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \
  41. PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \
  42. ((*(slicelen) = 0), -1) : \
  43. ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
  44. 0))
  45. PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
  46. Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
  47. PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,
  48. Py_ssize_t *start, Py_ssize_t *stop,
  49. Py_ssize_t step);
  50. #endif
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* !Py_SLICEOBJECT_H */
上海开阖软件有限公司 沪ICP备12045867号-1