blob: 1b7fe0a73c3a0bded1d216aca6412dbe2a8c6a3e [file] [log] [blame]
Andrew Hsieh83760d22013-06-18 12:24:28 -07001
2/* Module definition and import interface */
3
4#ifndef Py_IMPORT_H
5#define Py_IMPORT_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
11PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
12PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
13 char *name, PyObject *co, char *pathname);
14PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
15PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
16PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
17PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *);
18PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
19 PyObject *globals, PyObject *locals, PyObject *fromlist, int level);
20
21#define PyImport_ImportModuleEx(n, g, l, f) \
22 PyImport_ImportModuleLevel(n, g, l, f, -1)
23
24PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
25PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
26PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
27PyAPI_FUNC(void) PyImport_Cleanup(void);
28PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
29
30#ifdef WITH_THREAD
31PyAPI_FUNC(void) _PyImport_AcquireLock(void);
32PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
33#else
34#define _PyImport_AcquireLock()
35#define _PyImport_ReleaseLock() 1
36#endif
37
38PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
39 const char *, PyObject *, char *, size_t, FILE **, PyObject **);
40PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
41PyAPI_FUNC(void) _PyImport_ReInitLock(void);
42
43PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
44PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
45
46struct _inittab {
47 char *name;
48 void (*initfunc)(void);
49};
50
51PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
52PyAPI_DATA(struct _inittab *) PyImport_Inittab;
53
54PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void));
55PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
56
57struct _frozen {
58 char *name;
59 unsigned char *code;
60 int size;
61};
62
63/* Embedding apps may change this pointer to point to their favorite
64 collection of frozen modules: */
65
66PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
67
68#ifdef __cplusplus
69}
70#endif
71#endif /* !Py_IMPORT_H */