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.

54 lines
1.7 KiB

  1. /* C objects to be exported from one extension module to another.
  2. C objects are used for communication between extension modules.
  3. They provide a way for an extension module to export a C interface
  4. to other extension modules, so that extension modules can use the
  5. Python import mechanism to link to one another.
  6. */
  7. #ifndef Py_COBJECT_H
  8. #define Py_COBJECT_H
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. PyAPI_DATA(PyTypeObject) PyCObject_Type;
  13. #define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
  14. /* Create a PyCObject from a pointer to a C object and an optional
  15. destructor function. If the second argument is non-null, then it
  16. will be called with the first argument if and when the PyCObject is
  17. destroyed.
  18. */
  19. PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr(
  20. void *cobj, void (*destruct)(void*));
  21. /* Create a PyCObject from a pointer to a C object, a description object,
  22. and an optional destructor function. If the third argument is non-null,
  23. then it will be called with the first and second arguments if and when
  24. the PyCObject is destroyed.
  25. */
  26. PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc(
  27. void *cobj, void *desc, void (*destruct)(void*,void*));
  28. /* Retrieve a pointer to a C object from a PyCObject. */
  29. PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *);
  30. /* Retrieve a pointer to a description object from a PyCObject. */
  31. PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *);
  32. /* Import a pointer to a C object from a module using a PyCObject. */
  33. PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name);
  34. /* Modify a C object. Fails (==0) if object has a destructor. */
  35. PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj);
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* !Py_COBJECT_H */