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