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