Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.0 KiB

  1. /* Tuple object interface */
  2. #ifndef Py_TUPLEOBJECT_H
  3. #define Py_TUPLEOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*
  8. Another generally useful object type is a tuple of object pointers.
  9. For Python, this is an immutable type. C code can change the tuple items
  10. (but not their number), and even use tuples are general-purpose arrays of
  11. object references, but in general only brand new tuples should be mutated,
  12. not ones that might already have been exposed to Python code.
  13. *** WARNING *** PyTuple_SetItem does not increment the new item's reference
  14. count, but does decrement the reference count of the item it replaces,
  15. if not nil. It does *decrement* the reference count if it is *not*
  16. inserted in the tuple. Similarly, PyTuple_GetItem does not increment the
  17. returned item's reference count.
  18. */
  19. typedef struct {
  20. PyObject_VAR_HEAD
  21. PyObject *ob_item[1];
  22. /* ob_item contains space for 'ob_size' elements.
  23. * Items must normally not be NULL, except during construction when
  24. * the tuple is not yet visible outside the function that builds it.
  25. */
  26. } PyTupleObject;
  27. PyAPI_DATA(PyTypeObject) PyTuple_Type;
  28. #define PyTuple_Check(op) PyObject_TypeCheck(op, &PyTuple_Type)
  29. #define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type)
  30. PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
  31. PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
  32. PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t);
  33. PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *);
  34. PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
  35. PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
  36. PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
  37. /* Macro, trading safety for speed */
  38. #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
  39. #define PyTuple_GET_SIZE(op) (((PyTupleObject *)(op))->ob_size)
  40. /* Macro, *only* to be used to fill in brand new tuples */
  41. #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif /* !Py_TUPLEOBJECT_H */