import.h 3.86 KB
Newer Older
1

Guido van Rossum's avatar
Guido van Rossum committed
2 3
/* Module definition and import interface */

4 5 6 7 8 9
#ifndef Py_IMPORT_H
#define Py_IMPORT_H
#ifdef __cplusplus
extern "C" {
#endif

10
#ifndef Py_LIMITED_API
11
PyAPI_FUNC(void) _PyImportZip_Init(void);
12
#endif /* !Py_LIMITED_API */
13 14

PyMODINIT_FUNC PyInit_imp(void);
15
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
Barry Warsaw's avatar
Barry Warsaw committed
16
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
17
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
18
    const char *name,           /* UTF-8 encoded string */
19 20
    PyObject *co
    );
21
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
22
    const char *name,           /* UTF-8 encoded string */
23
    PyObject *co,
24
    const char *pathname        /* decoded from the filesystem encoding */
25
    );
Barry Warsaw's avatar
Barry Warsaw committed
26
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
27
    const char *name,           /* UTF-8 encoded string */
28
    PyObject *co,
29 30
    const char *pathname,       /* decoded from the filesystem encoding */
    const char *cpathname       /* decoded from the filesystem encoding */
31
    );
32 33 34 35 36 37
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
    PyObject *name,
    PyObject *co,
    PyObject *pathname,
    PyObject *cpathname
    );
38
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
39 40 41
PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
    PyObject *name
    );
42 43 44 45 46 47 48 49 50 51
PyAPI_FUNC(PyObject *) PyImport_AddModule(
    const char *name            /* UTF-8 encoded string */
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
    const char *name            /* UTF-8 encoded string */
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
    const char *name            /* UTF-8 encoded string */
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
52
    const char *name,           /* UTF-8 encoded string */
53
    PyObject *globals,
54 55 56 57 58 59 60
    PyObject *locals,
    PyObject *fromlist,
    int level
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
    PyObject *name,
    PyObject *globals,
61 62 63 64
    PyObject *locals,
    PyObject *fromlist,
    int level
    );
65 66

#define PyImport_ImportModuleEx(n, g, l, f) \
67
    PyImport_ImportModuleLevel(n, g, l, f, 0)
68

69
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
70 71 72
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
PyAPI_FUNC(void) PyImport_Cleanup(void);
73 74 75
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
    PyObject *name
    );
76
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
77
    const char *name            /* UTF-8 encoded string */
78
    );
79

80
#ifndef Py_LIMITED_API
81 82 83 84 85 86 87 88
#ifdef WITH_THREAD
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
#else
#define _PyImport_AcquireLock()
#define _PyImport_ReleaseLock() 1
#endif

89
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
90

91
PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
92
    const char *name            /* UTF-8 encoded string */
93
    );
94 95
PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
96
    PyObject *mod,
97
    const char *name            /* UTF-8 encoded string */
98
    );
99
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
100

101
struct _inittab {
102
    const char *name;           /* ASCII encoded string */
103
    PyObject* (*initfunc)(void);
104
};
105 106 107
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
#endif /* Py_LIMITED_API */
108

109
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
110

111 112 113 114
PyAPI_FUNC(int) PyImport_AppendInittab(
    const char *name,           /* ASCII encoded string */
    PyObject* (*initfunc)(void)
    );
115

116
#ifndef Py_LIMITED_API
117
struct _frozen {
118 119
    const char *name;                 /* ASCII encoded string */
    const unsigned char *code;
120
    int size;
121 122 123 124 125
};

/* Embedding apps may change this pointer to point to their favorite
   collection of frozen modules: */

126
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
127
#endif
128

129 130 131 132
#ifdef __cplusplus
}
#endif
#endif /* !Py_IMPORT_H */