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