/MOULOpenSourceClientPlugin/Plasma20/SDKs/XPlatform/Cypython-2.3.3/include/methodobject.h

https://bitbucket.org/karolasty8/cwe · C++ Header · 79 lines · 55 code · 16 blank · 8 comment · 1 complexity · 3e7a5788e161d1889a21c0a5cfce8154 MD5 · raw file

  1. /* Method object interface */
  2. #ifndef Py_METHODOBJECT_H
  3. #define Py_METHODOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. PyAPI_DATA(PyTypeObject) PyCFunction_Type;
  8. #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type)
  9. typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
  10. typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
  11. PyObject *);
  12. typedef PyObject *(*PyNoArgsFunction)(PyObject *);
  13. PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
  14. PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
  15. PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
  16. /* Macros for direct access to these values. Type checks are *not*
  17. done, so use with care. */
  18. #define PyCFunction_GET_FUNCTION(func) \
  19. (((PyCFunctionObject *)func) -> m_ml -> ml_meth)
  20. #define PyCFunction_GET_SELF(func) \
  21. (((PyCFunctionObject *)func) -> m_self)
  22. #define PyCFunction_GET_FLAGS(func) \
  23. (((PyCFunctionObject *)func) -> m_ml -> ml_flags)
  24. PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
  25. struct PyMethodDef {
  26. char *ml_name;
  27. PyCFunction ml_meth;
  28. int ml_flags;
  29. char *ml_doc;
  30. };
  31. typedef struct PyMethodDef PyMethodDef;
  32. PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *);
  33. #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
  34. PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
  35. PyObject *);
  36. /* Flag passed to newmethodobject */
  37. #define METH_OLDARGS 0x0000
  38. #define METH_VARARGS 0x0001
  39. #define METH_KEYWORDS 0x0002
  40. /* METH_NOARGS and METH_O must not be combined with the flags above. */
  41. #define METH_NOARGS 0x0004
  42. #define METH_O 0x0008
  43. /* METH_CLASS and METH_STATIC are a little different; these control
  44. the construction of methods for a class. These cannot be used for
  45. functions in modules. */
  46. #define METH_CLASS 0x0010
  47. #define METH_STATIC 0x0020
  48. typedef struct PyMethodChain {
  49. PyMethodDef *methods; /* Methods of this type */
  50. struct PyMethodChain *link; /* NULL or base type */
  51. } PyMethodChain;
  52. PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
  53. char *);
  54. typedef struct {
  55. PyObject_HEAD
  56. PyMethodDef *m_ml;
  57. PyObject *m_self;
  58. PyObject *m_module;
  59. } PyCFunctionObject;
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif /* !Py_METHODOBJECT_H */