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.

91 lines
2.1 KiB

  1. /* Descriptors */
  2. #ifndef Py_DESCROBJECT_H
  3. #define Py_DESCROBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef PyObject *(*getter)(PyObject *, void *);
  8. typedef int (*setter)(PyObject *, PyObject *, void *);
  9. typedef struct PyGetSetDef {
  10. char *name;
  11. getter get;
  12. setter set;
  13. char *doc;
  14. void *closure;
  15. } PyGetSetDef;
  16. typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
  17. void *wrapped);
  18. typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
  19. void *wrapped, PyObject *kwds);
  20. struct wrapperbase {
  21. char *name;
  22. int offset;
  23. void *function;
  24. wrapperfunc wrapper;
  25. char *doc;
  26. int flags;
  27. PyObject *name_strobj;
  28. };
  29. /* Flags for above struct */
  30. #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
  31. /* Various kinds of descriptor objects */
  32. #define PyDescr_COMMON \
  33. PyObject_HEAD \
  34. PyTypeObject *d_type; \
  35. PyObject *d_name
  36. typedef struct {
  37. PyDescr_COMMON;
  38. } PyDescrObject;
  39. typedef struct {
  40. PyDescr_COMMON;
  41. PyMethodDef *d_method;
  42. } PyMethodDescrObject;
  43. typedef struct {
  44. PyDescr_COMMON;
  45. struct PyMemberDef *d_member;
  46. } PyMemberDescrObject;
  47. typedef struct {
  48. PyDescr_COMMON;
  49. PyGetSetDef *d_getset;
  50. } PyGetSetDescrObject;
  51. typedef struct {
  52. PyDescr_COMMON;
  53. struct wrapperbase *d_base;
  54. void *d_wrapped; /* This can be any function pointer */
  55. } PyWrapperDescrObject;
  56. PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
  57. PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
  58. PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
  59. PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
  60. struct PyMemberDef *);
  61. PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
  62. struct PyGetSetDef *);
  63. PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
  64. struct wrapperbase *, void *);
  65. #define PyDescr_IsData(d) ((d)->ob_type->tp_descr_set != NULL)
  66. PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
  67. PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
  68. PyAPI_DATA(PyTypeObject) PyProperty_Type;
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. #endif /* !Py_DESCROBJECT_H */