structseq.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Named tuple object interface */
  2. #ifndef Py_STRUCTSEQ_H
  3. #define Py_STRUCTSEQ_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct PyStructSequence_Field {
  8. const char *name;
  9. const char *doc;
  10. } PyStructSequence_Field;
  11. typedef struct PyStructSequence_Desc {
  12. const char *name;
  13. const char *doc;
  14. struct PyStructSequence_Field *fields;
  15. int n_in_sequence;
  16. } PyStructSequence_Desc;
  17. extern char* PyStructSequence_UnnamedField;
  18. #ifndef Py_LIMITED_API
  19. PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
  20. PyStructSequence_Desc *desc);
  21. PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type,
  22. PyStructSequence_Desc *desc);
  23. #endif
  24. PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc);
  25. PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
  26. #ifndef Py_LIMITED_API
  27. typedef PyTupleObject PyStructSequence;
  28. /* Macro, *only* to be used to fill in brand new objects */
  29. #define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v)
  30. #define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i)
  31. #endif
  32. PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*);
  33. PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t);
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* !Py_STRUCTSEQ_H */