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