PageRenderTime 48ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/necco/python/Include/methodobject.h

https://github.com/brosner/cleese
C Header | 58 lines | 39 code | 13 blank | 6 comment | 1 complexity | c62f35c5df888fca11067e75ea7eb3f0 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. #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
  25. PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
  26. PyObject *);
  27. /* Flag passed to newmethodobject */
  28. #define METH_OLDARGS 0x0000
  29. #define METH_VARARGS 0x0001
  30. #define METH_KEYWORDS 0x0002
  31. /* METH_NOARGS and METH_O must not be combined with the flags above. */
  32. #define METH_NOARGS 0x0004
  33. #define METH_O 0x0008
  34. /* METH_CLASS and METH_STATIC are a little different; these control
  35. the construction of methods for a class. These cannot be used for
  36. functions in modules. */
  37. #define METH_CLASS 0x0010
  38. #define METH_STATIC 0x0020
  39. typedef struct {
  40. PyObject_HEAD
  41. PyMethodDef *m_ml;
  42. PyObject *m_self;
  43. PyObject *m_module;
  44. } PyCFunctionObject;
  45. #endif /* !Py_METHODOBJECT_H */