import.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* Module definition and import interface */
  2. #ifndef Py_IMPORT_H
  3. #define Py_IMPORT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #ifndef Py_LIMITED_API
  8. PyMODINIT_FUNC PyInit__imp(void);
  9. #endif /* !Py_LIMITED_API */
  10. PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
  11. PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
  12. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
  13. const char *name, /* UTF-8 encoded string */
  14. PyObject *co
  15. );
  16. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
  17. const char *name, /* UTF-8 encoded string */
  18. PyObject *co,
  19. const char *pathname /* decoded from the filesystem encoding */
  20. );
  21. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
  22. const char *name, /* UTF-8 encoded string */
  23. PyObject *co,
  24. const char *pathname, /* decoded from the filesystem encoding */
  25. const char *cpathname /* decoded from the filesystem encoding */
  26. );
  27. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
  28. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
  29. PyObject *name,
  30. PyObject *co,
  31. PyObject *pathname,
  32. PyObject *cpathname
  33. );
  34. #endif
  35. PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
  36. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
  37. PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name);
  38. #endif
  39. #ifndef Py_LIMITED_API
  40. PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
  41. PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name);
  42. PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name,
  43. PyObject *modules);
  44. PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);
  45. PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module);
  46. #endif
  47. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
  48. PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
  49. PyObject *name
  50. );
  51. #endif
  52. PyAPI_FUNC(PyObject *) PyImport_AddModule(
  53. const char *name /* UTF-8 encoded string */
  54. );
  55. PyAPI_FUNC(PyObject *) PyImport_ImportModule(
  56. const char *name /* UTF-8 encoded string */
  57. );
  58. PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
  59. const char *name /* UTF-8 encoded string */
  60. );
  61. PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
  62. const char *name, /* UTF-8 encoded string */
  63. PyObject *globals,
  64. PyObject *locals,
  65. PyObject *fromlist,
  66. int level
  67. );
  68. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
  69. PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
  70. PyObject *name,
  71. PyObject *globals,
  72. PyObject *locals,
  73. PyObject *fromlist,
  74. int level
  75. );
  76. #endif
  77. #define PyImport_ImportModuleEx(n, g, l, f) \
  78. PyImport_ImportModuleLevel(n, g, l, f, 0)
  79. PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
  80. PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
  81. PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
  82. PyAPI_FUNC(void) PyImport_Cleanup(void);
  83. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
  84. PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
  85. PyObject *name
  86. );
  87. #endif
  88. PyAPI_FUNC(int) PyImport_ImportFrozenModule(
  89. const char *name /* UTF-8 encoded string */
  90. );
  91. #ifndef Py_LIMITED_API
  92. PyAPI_FUNC(void) _PyImport_AcquireLock(void);
  93. PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
  94. PyAPI_FUNC(void) _PyImport_ReInitLock(void);
  95. PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
  96. const char *name, /* UTF-8 encoded string */
  97. PyObject *modules
  98. );
  99. PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
  100. PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObjectEx(PyObject *, PyObject *,
  101. PyObject *);
  102. PyAPI_FUNC(int) _PyImport_FixupBuiltin(
  103. PyObject *mod,
  104. const char *name, /* UTF-8 encoded string */
  105. PyObject *modules
  106. );
  107. PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *,
  108. PyObject *, PyObject *);
  109. struct _inittab {
  110. const char *name; /* ASCII encoded string */
  111. PyObject* (*initfunc)(void);
  112. };
  113. PyAPI_DATA(struct _inittab *) PyImport_Inittab;
  114. PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
  115. #endif /* Py_LIMITED_API */
  116. PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
  117. PyAPI_FUNC(int) PyImport_AppendInittab(
  118. const char *name, /* ASCII encoded string */
  119. PyObject* (*initfunc)(void)
  120. );
  121. #ifndef Py_LIMITED_API
  122. struct _frozen {
  123. const char *name; /* ASCII encoded string */
  124. const unsigned char *code;
  125. int size;
  126. };
  127. /* Embedding apps may change this pointer to point to their favorite
  128. collection of frozen modules: */
  129. PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
  130. #endif
  131. #ifdef __cplusplus
  132. }
  133. #endif
  134. #endif /* !Py_IMPORT_H */