blob: e396a674bc468412e1f02f861f1c43fc06a2449c [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);
Victor Stinnera82f63f2020-12-09 22:37:27 +010016PyAPI_FUNC(int) _PyRun_AnyFileObject(
17 FILE *fp,
18 PyObject *filename,
19 int closeit,
20 PyCompilerFlags *flags);
Victor Stinnerfe6e5e72020-12-08 23:51:54 +010021PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
22 FILE *fp,
23 const char *filename, /* decoded from the filesystem encoding */
24 int closeit,
25 PyCompilerFlags *flags);
26PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
27 FILE *fp,
28 const char *filename, /* decoded from the filesystem encoding */
29 PyCompilerFlags *flags);
30PyAPI_FUNC(int) PyRun_InteractiveOneObject(
31 FILE *fp,
32 PyObject *filename,
33 PyCompilerFlags *flags);
34PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
35 FILE *fp,
36 const char *filename, /* decoded from the filesystem encoding */
37 PyCompilerFlags *flags);
Victor Stinnera82f63f2020-12-09 22:37:27 +010038PyAPI_FUNC(int) _PyRun_InteractiveLoopObject(
39 FILE *fp,
40 PyObject *filename,
41 PyCompilerFlags *flags);
Victor Stinnerfe6e5e72020-12-08 23:51:54 +010042
43
44PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
45 PyObject *, PyCompilerFlags *);
46
47PyAPI_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
57PyAPI_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);
63PyAPI_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
73PyAPI_FUNC(const char *) _Py_SourceAsString(
74 PyObject *cmd,
75 const char *funcname,
76 const char *what,
77 PyCompilerFlags *cf,
78 PyObject **cmd_copy);
79
80PyAPI_FUNC(struct symtable *) Py_SymtableStringObject(
81 const char *str,
82 PyObject *filename,
83 int start);
84
85PyAPI_FUNC(struct symtable *) _Py_SymtableStringObjectFlags(
86 const char *str,
87 PyObject *filename,
88 int start,
89 PyCompilerFlags *flags);
90
91
92/* A function flavor is also exported by libpython. It is required when
93 libpython is accessed directly rather than using header files which defines
94 macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
95 export functions in pythonXX.dll. */
96PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
97PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
98PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
99PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
100PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
101PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
102PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
103PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
104PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
105PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
106PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
107PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
108
109/* Use macros for a bunch of old variants */
110#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
111#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
112#define PyRun_AnyFileEx(fp, name, closeit) \
113 PyRun_AnyFileExFlags(fp, name, closeit, NULL)
114#define PyRun_AnyFileFlags(fp, name, flags) \
115 PyRun_AnyFileExFlags(fp, name, 0, flags)
116#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
117#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
118#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
119#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
120#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
121#define PyRun_File(fp, p, s, g, l) \
122 PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
123#define PyRun_FileEx(fp, p, s, g, l, c) \
124 PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
125#define PyRun_FileFlags(fp, p, s, g, l, flags) \
126 PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
127
128
129/* Stuff with no proper home (yet) */
130PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
131PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;