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.

58 lines
1.4 KiB

36 years ago
36 years ago
36 years ago
  1. /* Module object interface */
  2. #ifndef Py_MODULEOBJECT_H
  3. #define Py_MODULEOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. PyAPI_DATA(PyTypeObject) PyModule_Type;
  8. #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
  9. #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type)
  10. PyAPI_FUNC(PyObject *) PyModule_New(
  11. const char *name /* UTF-8 encoded string */
  12. );
  13. PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
  14. PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
  15. PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
  16. PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
  17. #ifndef Py_LIMITED_API
  18. PyAPI_FUNC(void) _PyModule_Clear(PyObject *);
  19. #endif
  20. PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*);
  21. PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
  22. typedef struct PyModuleDef_Base {
  23. PyObject_HEAD
  24. PyObject* (*m_init)(void);
  25. Py_ssize_t m_index;
  26. PyObject* m_copy;
  27. } PyModuleDef_Base;
  28. #define PyModuleDef_HEAD_INIT { \
  29. PyObject_HEAD_INIT(NULL) \
  30. NULL, /* m_init */ \
  31. 0, /* m_index */ \
  32. NULL, /* m_copy */ \
  33. }
  34. typedef struct PyModuleDef{
  35. PyModuleDef_Base m_base;
  36. const char* m_name;
  37. const char* m_doc;
  38. Py_ssize_t m_size;
  39. PyMethodDef *m_methods;
  40. inquiry m_reload;
  41. traverseproc m_traverse;
  42. inquiry m_clear;
  43. freefunc m_free;
  44. }PyModuleDef;
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif /* !Py_MODULEOBJECT_H */