PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/echo/python/Include/methodobject.h

https://github.com/jtauber/cleese
C Header | 57 lines | 38 code | 13 blank | 6 comment | 1 complexity | 31d5ce11df19f1bbac8dff98fe58944b MD5 | raw file
  1. /* Method object interface */
  2. #ifndef Py_METHODOBJECT_H
  3. #define Py_METHODOBJECT_H
  4. PyAPI_DATA(PyTypeObject) PyCFunction_Type;
  5. #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type)
  6. typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
  7. typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
  8. PyObject *);
  9. typedef PyObject *(*PyNoArgsFunction)(PyObject *);
  10. #define PyCFunction_GET_FUNCTION(func) \
  11. (((PyCFunctionObject *)func) -> m_ml -> ml_meth)
  12. #define PyCFunction_GET_SELF(func) \
  13. (((PyCFunctionObject *)func) -> m_self)
  14. #define PyCFunction_GET_FLAGS(func) \
  15. (((PyCFunctionObject *)func) -> m_ml -> ml_flags)
  16. PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
  17. struct PyMethodDef {
  18. char *ml_name;
  19. PyCFunction ml_meth;
  20. int ml_flags;
  21. char *ml_doc;
  22. };
  23. typedef struct PyMethodDef PyMethodDef;
  24. PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
  25. PyObject *);
  26. /* Flag passed to newmethodobject */
  27. #define METH_OLDARGS 0x0000
  28. #define METH_VARARGS 0x0001
  29. #define METH_KEYWORDS 0x0002
  30. /* METH_NOARGS and METH_O must not be combined with the flags above. */
  31. #define METH_NOARGS 0x0004
  32. #define METH_O 0x0008
  33. /* METH_CLASS and METH_STATIC are a little different; these control
  34. the construction of methods for a class. These cannot be used for
  35. functions in modules. */
  36. #define METH_CLASS 0x0010
  37. #define METH_STATIC 0x0020
  38. typedef struct {
  39. PyObject_HEAD
  40. PyMethodDef *m_ml;
  41. PyObject *m_self;
  42. PyObject *m_module;
  43. } PyCFunctionObject;
  44. #endif /* !Py_METHODOBJECT_H */