import.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. PyAPI_FUNC(void) _PyImportZip_Init(void);
  8. PyMODINIT_FUNC PyInit_imp(void);
  9. PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
  10. PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
  11. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
  12. const char *name, /* UTF-8 encoded string */
  13. PyObject *co
  14. );
  15. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
  16. const char *name, /* UTF-8 encoded string */
  17. PyObject *co,
  18. const char *pathname /* decoded from the filesystem encoding */
  19. );
  20. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
  21. const char *name, /* UTF-8 encoded string */
  22. PyObject *co,
  23. const char *pathname, /* decoded from the filesystem encoding */
  24. const char *cpathname /* decoded from the filesystem encoding */
  25. );
  26. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
  27. PyObject *name,
  28. PyObject *co,
  29. PyObject *pathname,
  30. PyObject *cpathname
  31. );
  32. PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
  33. PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
  34. PyObject *name
  35. );
  36. PyAPI_FUNC(PyObject *) PyImport_AddModule(
  37. const char *name /* UTF-8 encoded string */
  38. );
  39. PyAPI_FUNC(PyObject *) PyImport_ImportModule(
  40. const char *name /* UTF-8 encoded string */
  41. );
  42. PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
  43. const char *name /* UTF-8 encoded string */
  44. );
  45. PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
  46. const char *name, /* UTF-8 encoded string */
  47. PyObject *globals,
  48. PyObject *locals,
  49. PyObject *fromlist,
  50. int level
  51. );
  52. PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
  53. PyObject *name,
  54. PyObject *globals,
  55. PyObject *locals,
  56. PyObject *fromlist,
  57. int level
  58. );
  59. #define PyImport_ImportModuleEx(n, g, l, f) \
  60. PyImport_ImportModuleLevel(n, g, l, f, 0)
  61. PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
  62. PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
  63. PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
  64. PyAPI_FUNC(void) PyImport_Cleanup(void);
  65. PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
  66. PyObject *name
  67. );
  68. PyAPI_FUNC(int) PyImport_ImportFrozenModule(
  69. const char *name /* UTF-8 encoded string */
  70. );
  71. #ifndef Py_LIMITED_API
  72. #ifdef WITH_THREAD
  73. PyAPI_FUNC(void) _PyImport_AcquireLock(void);
  74. PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
  75. #else
  76. #define _PyImport_AcquireLock()
  77. #define _PyImport_ReleaseLock() 1
  78. #endif
  79. PyAPI_FUNC(void) _PyImport_ReInitLock(void);
  80. PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
  81. const char *name /* UTF-8 encoded string */
  82. );
  83. PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
  84. PyAPI_FUNC(int) _PyImport_FixupBuiltin(
  85. PyObject *mod,
  86. const char *name /* UTF-8 encoded string */
  87. );
  88. PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
  89. struct _inittab {
  90. const char *name; /* ASCII encoded string */
  91. PyObject* (*initfunc)(void);
  92. };
  93. PyAPI_DATA(struct _inittab *) PyImport_Inittab;
  94. PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
  95. #endif /* Py_LIMITED_API */
  96. PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
  97. PyAPI_FUNC(int) PyImport_AppendInittab(
  98. const char *name, /* ASCII encoded string */
  99. PyObject* (*initfunc)(void)
  100. );
  101. #ifndef Py_LIMITED_API
  102. struct _frozen {
  103. const char *name; /* ASCII encoded string */
  104. const unsigned char *code;
  105. int size;
  106. };
  107. /* Embedding apps may change this pointer to point to their favorite
  108. collection of frozen modules: */
  109. PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
  110. #endif
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif /* !Py_IMPORT_H */