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.

81 lines
2.8 KiB

  1. /* Class object interface */
  2. /* Revealing some structures (not for general use) */
  3. #ifndef Py_CLASSOBJECT_H
  4. #define Py_CLASSOBJECT_H
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. typedef struct {
  9. PyObject_HEAD
  10. PyObject *cl_bases; /* A tuple of class objects */
  11. PyObject *cl_dict; /* A dictionary */
  12. PyObject *cl_name; /* A string */
  13. /* The following three are functions or NULL */
  14. PyObject *cl_getattr;
  15. PyObject *cl_setattr;
  16. PyObject *cl_delattr;
  17. } PyClassObject;
  18. typedef struct {
  19. PyObject_HEAD
  20. PyClassObject *in_class; /* The class object */
  21. PyObject *in_dict; /* A dictionary */
  22. PyObject *in_weakreflist; /* List of weak references */
  23. } PyInstanceObject;
  24. typedef struct {
  25. PyObject_HEAD
  26. PyObject *im_func; /* The callable object implementing the method */
  27. PyObject *im_self; /* The instance it is bound to, or NULL */
  28. PyObject *im_class; /* The class that asked for the method */
  29. PyObject *im_weakreflist; /* List of weak references */
  30. } PyMethodObject;
  31. PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;
  32. #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
  33. #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
  34. #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
  35. PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);
  36. PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *,
  37. PyObject *);
  38. PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);
  39. PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
  40. PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
  41. PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
  42. PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
  43. /* Look up attribute with name (a string) on instance object pinst, using
  44. * only the instance and base class dicts. If a descriptor is found in
  45. * a class dict, the descriptor is returned without calling it.
  46. * Returns NULL if nothing found, else a borrowed reference to the
  47. * value associated with name in the dict in which name was found.
  48. * The point of this routine is that it never calls arbitrary Python
  49. * code, so is always "safe": all it does is dict lookups. The function
  50. * can't fail, never sets an exception, and NULL is not an error (it just
  51. * means "not found").
  52. */
  53. PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);
  54. /* Macros for direct access to these values. Type checks are *not*
  55. done, so use with care. */
  56. #define PyMethod_GET_FUNCTION(meth) \
  57. (((PyMethodObject *)meth) -> im_func)
  58. #define PyMethod_GET_SELF(meth) \
  59. (((PyMethodObject *)meth) -> im_self)
  60. #define PyMethod_GET_CLASS(meth) \
  61. (((PyMethodObject *)meth) -> im_class)
  62. PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* !Py_CLASSOBJECT_H */