1 | use crate::object::*; |
2 | #[cfg (not(any(PyPy, Py_LIMITED_API, Py_3_10)))] |
3 | use crate::pyarena::PyArena; |
4 | use crate::PyCompilerFlags; |
5 | #[cfg (not(any(PyPy, Py_3_10)))] |
6 | use crate::{_mod, _node}; |
7 | use libc::FILE; |
8 | use std::os::raw::{c_char, c_int}; |
9 | |
10 | extern "C" { |
11 | pub fn PyRun_SimpleStringFlags(arg1: *const c_char, arg2: *mut PyCompilerFlags) -> c_int; |
12 | pub fn _PyRun_SimpleFileObject( |
13 | fp: *mut FILE, |
14 | filename: *mut PyObject, |
15 | closeit: c_int, |
16 | flags: *mut PyCompilerFlags, |
17 | ) -> c_int; |
18 | pub fn PyRun_AnyFileExFlags( |
19 | fp: *mut FILE, |
20 | filename: *const c_char, |
21 | closeit: c_int, |
22 | flags: *mut PyCompilerFlags, |
23 | ) -> c_int; |
24 | pub fn _PyRun_AnyFileObject( |
25 | fp: *mut FILE, |
26 | filename: *mut PyObject, |
27 | closeit: c_int, |
28 | flags: *mut PyCompilerFlags, |
29 | ) -> c_int; |
30 | pub fn PyRun_SimpleFileExFlags( |
31 | fp: *mut FILE, |
32 | filename: *const c_char, |
33 | closeit: c_int, |
34 | flags: *mut PyCompilerFlags, |
35 | ) -> c_int; |
36 | pub fn PyRun_InteractiveOneFlags( |
37 | fp: *mut FILE, |
38 | filename: *const c_char, |
39 | flags: *mut PyCompilerFlags, |
40 | ) -> c_int; |
41 | pub fn PyRun_InteractiveOneObject( |
42 | fp: *mut FILE, |
43 | filename: *mut PyObject, |
44 | flags: *mut PyCompilerFlags, |
45 | ) -> c_int; |
46 | pub fn PyRun_InteractiveLoopFlags( |
47 | fp: *mut FILE, |
48 | filename: *const c_char, |
49 | flags: *mut PyCompilerFlags, |
50 | ) -> c_int; |
51 | pub fn _PyRun_InteractiveLoopObject( |
52 | fp: *mut FILE, |
53 | filename: *mut PyObject, |
54 | flags: *mut PyCompilerFlags, |
55 | ) -> c_int; |
56 | |
57 | #[cfg (not(any(PyPy, Py_3_10)))] |
58 | pub fn PyParser_ASTFromString( |
59 | s: *const c_char, |
60 | filename: *const c_char, |
61 | start: c_int, |
62 | flags: *mut PyCompilerFlags, |
63 | arena: *mut PyArena, |
64 | ) -> *mut _mod; |
65 | #[cfg (not(any(PyPy, Py_3_10)))] |
66 | pub fn PyParser_ASTFromStringObject( |
67 | s: *const c_char, |
68 | filename: *mut PyObject, |
69 | start: c_int, |
70 | flags: *mut PyCompilerFlags, |
71 | arena: *mut PyArena, |
72 | ) -> *mut _mod; |
73 | #[cfg (not(any(PyPy, Py_3_10)))] |
74 | pub fn PyParser_ASTFromFile( |
75 | fp: *mut FILE, |
76 | filename: *const c_char, |
77 | enc: *const c_char, |
78 | start: c_int, |
79 | ps1: *const c_char, |
80 | ps2: *const c_char, |
81 | flags: *mut PyCompilerFlags, |
82 | errcode: *mut c_int, |
83 | arena: *mut PyArena, |
84 | ) -> *mut _mod; |
85 | #[cfg (not(any(PyPy, Py_3_10)))] |
86 | pub fn PyParser_ASTFromFileObject( |
87 | fp: *mut FILE, |
88 | filename: *mut PyObject, |
89 | enc: *const c_char, |
90 | start: c_int, |
91 | ps1: *const c_char, |
92 | ps2: *const c_char, |
93 | flags: *mut PyCompilerFlags, |
94 | errcode: *mut c_int, |
95 | arena: *mut PyArena, |
96 | ) -> *mut _mod; |
97 | } |
98 | |
99 | extern "C" { |
100 | #[cfg_attr (PyPy, link_name = "PyPyRun_StringFlags" )] |
101 | pub fn PyRun_StringFlags( |
102 | arg1: *const c_char, |
103 | arg2: c_int, |
104 | arg3: *mut PyObject, |
105 | arg4: *mut PyObject, |
106 | arg5: *mut PyCompilerFlags, |
107 | ) -> *mut PyObject; |
108 | #[cfg (not(PyPy))] |
109 | pub fn PyRun_FileExFlags( |
110 | fp: *mut FILE, |
111 | filename: *const c_char, |
112 | start: c_int, |
113 | globals: *mut PyObject, |
114 | locals: *mut PyObject, |
115 | closeit: c_int, |
116 | flags: *mut PyCompilerFlags, |
117 | ) -> *mut PyObject; |
118 | |
119 | #[cfg (not(PyPy))] |
120 | pub fn Py_CompileStringExFlags( |
121 | str: *const c_char, |
122 | filename: *const c_char, |
123 | start: c_int, |
124 | flags: *mut PyCompilerFlags, |
125 | optimize: c_int, |
126 | ) -> *mut PyObject; |
127 | #[cfg (not(Py_LIMITED_API))] |
128 | pub fn Py_CompileStringObject( |
129 | str: *const c_char, |
130 | filename: *mut PyObject, |
131 | start: c_int, |
132 | flags: *mut PyCompilerFlags, |
133 | optimize: c_int, |
134 | ) -> *mut PyObject; |
135 | } |
136 | |
137 | #[inline ] |
138 | pub unsafe fn Py_CompileString(string: *const c_char, p: *const c_char, s: c_int) -> *mut PyObject { |
139 | #[cfg (not(PyPy))] |
140 | return Py_CompileStringExFlags(str:string, filename:p, start:s, flags:std::ptr::null_mut(), optimize:-1); |
141 | |
142 | #[cfg (PyPy)] |
143 | Py_CompileStringFlags(string, p, s, std::ptr::null_mut()) |
144 | } |
145 | |
146 | #[inline ] |
147 | #[cfg (not(PyPy))] |
148 | pub unsafe fn Py_CompileStringFlags( |
149 | string: *const c_char, |
150 | p: *const c_char, |
151 | s: c_int, |
152 | f: *mut PyCompilerFlags, |
153 | ) -> *mut PyObject { |
154 | Py_CompileStringExFlags(str:string, filename:p, start:s, flags:f, optimize:-1) |
155 | } |
156 | |
157 | // skipped _Py_SourceAsString |
158 | |
159 | extern "C" { |
160 | #[cfg_attr (PyPy, link_name = "PyPyRun_String" )] |
161 | pub fn PyRun_String( |
162 | string: *const c_char, |
163 | s: c_int, |
164 | g: *mut PyObject, |
165 | l: *mut PyObject, |
166 | ) -> *mut PyObject; |
167 | #[cfg (not(PyPy))] |
168 | pub fn PyRun_AnyFile(fp: *mut FILE, name: *const c_char) -> c_int; |
169 | #[cfg (not(PyPy))] |
170 | pub fn PyRun_AnyFileEx(fp: *mut FILE, name: *const c_char, closeit: c_int) -> c_int; |
171 | #[cfg (not(PyPy))] |
172 | pub fn PyRun_AnyFileFlags( |
173 | arg1: *mut FILE, |
174 | arg2: *const c_char, |
175 | arg3: *mut PyCompilerFlags, |
176 | ) -> c_int; |
177 | #[cfg_attr (PyPy, link_name = "PyPyRun_SimpleString" )] |
178 | pub fn PyRun_SimpleString(s: *const c_char) -> c_int; |
179 | #[cfg (not(PyPy))] |
180 | pub fn PyRun_SimpleFile(f: *mut FILE, p: *const c_char) -> c_int; |
181 | #[cfg (not(PyPy))] |
182 | pub fn PyRun_SimpleFileEx(f: *mut FILE, p: *const c_char, c: c_int) -> c_int; |
183 | #[cfg (not(PyPy))] |
184 | pub fn PyRun_InteractiveOne(f: *mut FILE, p: *const c_char) -> c_int; |
185 | #[cfg (not(PyPy))] |
186 | pub fn PyRun_InteractiveLoop(f: *mut FILE, p: *const c_char) -> c_int; |
187 | #[cfg_attr (PyPy, link_name = "PyPyRun_File" )] |
188 | pub fn PyRun_File( |
189 | fp: *mut FILE, |
190 | p: *const c_char, |
191 | s: c_int, |
192 | g: *mut PyObject, |
193 | l: *mut PyObject, |
194 | ) -> *mut PyObject; |
195 | #[cfg (not(PyPy))] |
196 | pub fn PyRun_FileEx( |
197 | fp: *mut FILE, |
198 | p: *const c_char, |
199 | s: c_int, |
200 | g: *mut PyObject, |
201 | l: *mut PyObject, |
202 | c: c_int, |
203 | ) -> *mut PyObject; |
204 | #[cfg (not(PyPy))] |
205 | pub fn PyRun_FileFlags( |
206 | fp: *mut FILE, |
207 | p: *const c_char, |
208 | s: c_int, |
209 | g: *mut PyObject, |
210 | l: *mut PyObject, |
211 | flags: *mut PyCompilerFlags, |
212 | ) -> *mut PyObject; |
213 | } |
214 | |
215 | // skipped macro PyRun_String |
216 | // skipped macro PyRun_AnyFile |
217 | // skipped macro PyRun_AnyFileEx |
218 | // skipped macro PyRun_AnyFileFlags |
219 | |
220 | extern "C" { |
221 | #[cfg (not(any(PyPy, Py_3_10)))] |
222 | #[cfg_attr (Py_3_9, deprecated(note = "Python 3.9" ))] |
223 | pub fn PyParser_SimpleParseStringFlags( |
224 | arg1: *const c_char, |
225 | arg2: c_int, |
226 | arg3: c_int, |
227 | ) -> *mut _node; |
228 | #[cfg (not(any(PyPy, Py_3_10)))] |
229 | #[cfg_attr (Py_3_9, deprecated(note = "Python 3.9" ))] |
230 | pub fn PyParser_SimpleParseStringFlagsFilename( |
231 | arg1: *const c_char, |
232 | arg2: *const c_char, |
233 | arg3: c_int, |
234 | arg4: c_int, |
235 | ) -> *mut _node; |
236 | #[cfg (not(any(PyPy, Py_3_10)))] |
237 | #[cfg_attr (Py_3_9, deprecated(note = "Python 3.9" ))] |
238 | pub fn PyParser_SimpleParseFileFlags( |
239 | arg1: *mut FILE, |
240 | arg2: *const c_char, |
241 | arg3: c_int, |
242 | arg4: c_int, |
243 | ) -> *mut _node; |
244 | |
245 | #[cfg (PyPy)] |
246 | #[cfg_attr (PyPy, link_name = "PyPy_CompileStringFlags" )] |
247 | pub fn Py_CompileStringFlags( |
248 | string: *const c_char, |
249 | p: *const c_char, |
250 | s: c_int, |
251 | f: *mut PyCompilerFlags, |
252 | ) -> *mut PyObject; |
253 | } |
254 | |