Victor Stinner | fe6e5e7 | 2020-12-08 23:51:54 +0100 | [diff] [blame] | 1 | #ifndef Py_CPYTHON_PYTHONRUN_H |
| 2 | # error "this header file must not be included directly" |
| 3 | #endif |
| 4 | |
| 5 | PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); |
Victor Stinner | 550e467 | 2020-12-09 00:32:54 +0100 | [diff] [blame] | 6 | PyAPI_FUNC(int) _PyRun_SimpleFileObject( |
| 7 | FILE *fp, |
| 8 | PyObject *filename, |
| 9 | int closeit, |
| 10 | PyCompilerFlags *flags); |
Victor Stinner | fe6e5e7 | 2020-12-08 23:51:54 +0100 | [diff] [blame] | 11 | PyAPI_FUNC(int) PyRun_AnyFileExFlags( |
| 12 | FILE *fp, |
| 13 | const char *filename, /* decoded from the filesystem encoding */ |
| 14 | int closeit, |
| 15 | PyCompilerFlags *flags); |
Victor Stinner | a82f63f | 2020-12-09 22:37:27 +0100 | [diff] [blame] | 16 | PyAPI_FUNC(int) _PyRun_AnyFileObject( |
| 17 | FILE *fp, |
| 18 | PyObject *filename, |
| 19 | int closeit, |
| 20 | PyCompilerFlags *flags); |
Victor Stinner | fe6e5e7 | 2020-12-08 23:51:54 +0100 | [diff] [blame] | 21 | PyAPI_FUNC(int) PyRun_SimpleFileExFlags( |
| 22 | FILE *fp, |
| 23 | const char *filename, /* decoded from the filesystem encoding */ |
| 24 | int closeit, |
| 25 | PyCompilerFlags *flags); |
| 26 | PyAPI_FUNC(int) PyRun_InteractiveOneFlags( |
| 27 | FILE *fp, |
| 28 | const char *filename, /* decoded from the filesystem encoding */ |
| 29 | PyCompilerFlags *flags); |
| 30 | PyAPI_FUNC(int) PyRun_InteractiveOneObject( |
| 31 | FILE *fp, |
| 32 | PyObject *filename, |
| 33 | PyCompilerFlags *flags); |
| 34 | PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( |
| 35 | FILE *fp, |
| 36 | const char *filename, /* decoded from the filesystem encoding */ |
| 37 | PyCompilerFlags *flags); |
Victor Stinner | a82f63f | 2020-12-09 22:37:27 +0100 | [diff] [blame] | 38 | PyAPI_FUNC(int) _PyRun_InteractiveLoopObject( |
| 39 | FILE *fp, |
| 40 | PyObject *filename, |
| 41 | PyCompilerFlags *flags); |
Victor Stinner | fe6e5e7 | 2020-12-08 23:51:54 +0100 | [diff] [blame] | 42 | |
| 43 | |
| 44 | PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, |
| 45 | PyObject *, PyCompilerFlags *); |
| 46 | |
| 47 | PyAPI_FUNC(PyObject *) PyRun_FileExFlags( |
| 48 | FILE *fp, |
| 49 | const char *filename, /* decoded from the filesystem encoding */ |
| 50 | int start, |
| 51 | PyObject *globals, |
| 52 | PyObject *locals, |
| 53 | int closeit, |
| 54 | PyCompilerFlags *flags); |
| 55 | |
| 56 | |
| 57 | PyAPI_FUNC(PyObject *) Py_CompileStringExFlags( |
| 58 | const char *str, |
| 59 | const char *filename, /* decoded from the filesystem encoding */ |
| 60 | int start, |
| 61 | PyCompilerFlags *flags, |
| 62 | int optimize); |
| 63 | PyAPI_FUNC(PyObject *) Py_CompileStringObject( |
| 64 | const char *str, |
| 65 | PyObject *filename, int start, |
| 66 | PyCompilerFlags *flags, |
| 67 | int optimize); |
| 68 | |
| 69 | #define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1) |
| 70 | #define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1) |
| 71 | |
| 72 | |
| 73 | PyAPI_FUNC(const char *) _Py_SourceAsString( |
| 74 | PyObject *cmd, |
| 75 | const char *funcname, |
| 76 | const char *what, |
| 77 | PyCompilerFlags *cf, |
| 78 | PyObject **cmd_copy); |
| 79 | |
Victor Stinner | fe6e5e7 | 2020-12-08 23:51:54 +0100 | [diff] [blame] | 80 | |
| 81 | /* A function flavor is also exported by libpython. It is required when |
| 82 | libpython is accessed directly rather than using header files which defines |
| 83 | macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to |
| 84 | export functions in pythonXX.dll. */ |
| 85 | PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l); |
| 86 | PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name); |
| 87 | PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit); |
| 88 | PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); |
| 89 | PyAPI_FUNC(int) PyRun_SimpleString(const char *s); |
| 90 | PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p); |
| 91 | PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c); |
| 92 | PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p); |
| 93 | PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p); |
| 94 | PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l); |
| 95 | PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c); |
| 96 | PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags); |
| 97 | |
| 98 | /* Use macros for a bunch of old variants */ |
| 99 | #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) |
| 100 | #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) |
| 101 | #define PyRun_AnyFileEx(fp, name, closeit) \ |
| 102 | PyRun_AnyFileExFlags(fp, name, closeit, NULL) |
| 103 | #define PyRun_AnyFileFlags(fp, name, flags) \ |
| 104 | PyRun_AnyFileExFlags(fp, name, 0, flags) |
| 105 | #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) |
| 106 | #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) |
| 107 | #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) |
| 108 | #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) |
| 109 | #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) |
| 110 | #define PyRun_File(fp, p, s, g, l) \ |
| 111 | PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) |
| 112 | #define PyRun_FileEx(fp, p, s, g, l, c) \ |
| 113 | PyRun_FileExFlags(fp, p, s, g, l, c, NULL) |
| 114 | #define PyRun_FileFlags(fp, p, s, g, l, flags) \ |
| 115 | PyRun_FileExFlags(fp, p, s, g, l, 0, flags) |
| 116 | |
| 117 | |
| 118 | /* Stuff with no proper home (yet) */ |
| 119 | PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *); |
| 120 | PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; |