1 | #[cfg (not(any(PyPy, Py_3_10)))] |
2 | use crate::object::PyObject; |
3 | #[cfg (not(any(PyPy, Py_3_10)))] |
4 | use crate::pyarena::*; |
5 | #[cfg (not(any(PyPy, Py_3_10)))] |
6 | use crate::pythonrun::*; |
7 | #[cfg (not(any(PyPy, Py_3_10)))] |
8 | use crate::PyCodeObject; |
9 | #[cfg (not(any(PyPy, Py_3_10)))] |
10 | use std::os::raw::c_char; |
11 | use std::os::raw::c_int; |
12 | |
13 | // skipped non-limited PyCF_MASK |
14 | // skipped non-limited PyCF_MASK_OBSOLETE |
15 | // skipped non-limited PyCF_SOURCE_IS_UTF8 |
16 | // skipped non-limited PyCF_DONT_IMPLY_DEDENT |
17 | // skipped non-limited PyCF_ONLY_AST |
18 | // skipped non-limited PyCF_IGNORE_COOKIE |
19 | // skipped non-limited PyCF_TYPE_COMMENTS |
20 | // skipped non-limited PyCF_ALLOW_TOP_LEVEL_AWAIT |
21 | // skipped non-limited PyCF_COMPILE_MASK |
22 | |
23 | #[repr (C)] |
24 | #[derive (Copy, Clone)] |
25 | pub struct PyCompilerFlags { |
26 | pub cf_flags: c_int, |
27 | #[cfg (Py_3_8)] |
28 | pub cf_feature_version: c_int, |
29 | } |
30 | |
31 | // skipped non-limited _PyCompilerFlags_INIT |
32 | |
33 | #[cfg (all(Py_3_12, not(PyPy)))] |
34 | #[repr (C)] |
35 | #[derive (Copy, Clone)] |
36 | pub struct _PyCompilerSrcLocation { |
37 | pub lineno: c_int, |
38 | pub end_lineno: c_int, |
39 | pub col_offset: c_int, |
40 | pub end_col_offset: c_int, |
41 | } |
42 | |
43 | // skipped SRC_LOCATION_FROM_AST |
44 | |
45 | #[cfg (not(PyPy))] |
46 | #[repr (C)] |
47 | #[derive (Copy, Clone)] |
48 | pub struct PyFutureFeatures { |
49 | pub ff_features: c_int, |
50 | #[cfg (not(Py_3_12))] |
51 | pub ff_lineno: c_int, |
52 | #[cfg (Py_3_12)] |
53 | pub ff_location: _PyCompilerSrcLocation, |
54 | } |
55 | |
56 | pub const FUTURE_NESTED_SCOPES: &str = "nested_scopes" ; |
57 | pub const FUTURE_GENERATORS: &str = "generators" ; |
58 | pub const FUTURE_DIVISION: &str = "division" ; |
59 | pub const FUTURE_ABSOLUTE_IMPORT: &str = "absolute_import" ; |
60 | pub const FUTURE_WITH_STATEMENT: &str = "with_statement" ; |
61 | pub const FUTURE_PRINT_FUNCTION: &str = "print_function" ; |
62 | pub const FUTURE_UNICODE_LITERALS: &str = "unicode_literals" ; |
63 | pub const FUTURE_BARRY_AS_BDFL: &str = "barry_as_FLUFL" ; |
64 | pub const FUTURE_GENERATOR_STOP: &str = "generator_stop" ; |
65 | // skipped non-limited FUTURE_ANNOTATIONS |
66 | |
67 | extern "C" { |
68 | #[cfg (not(any(PyPy, Py_3_10)))] |
69 | pub fn PyNode_Compile(arg1: *mut _node, arg2: *const c_char) -> *mut PyCodeObject; |
70 | |
71 | #[cfg (not(any(PyPy, Py_3_10)))] |
72 | pub fn PyAST_CompileEx( |
73 | _mod: *mut _mod, |
74 | filename: *const c_char, |
75 | flags: *mut PyCompilerFlags, |
76 | optimize: c_int, |
77 | arena: *mut PyArena, |
78 | ) -> *mut PyCodeObject; |
79 | |
80 | #[cfg (not(any(PyPy, Py_3_10)))] |
81 | pub fn PyAST_CompileObject( |
82 | _mod: *mut _mod, |
83 | filename: *mut PyObject, |
84 | flags: *mut PyCompilerFlags, |
85 | optimize: c_int, |
86 | arena: *mut PyArena, |
87 | ) -> *mut PyCodeObject; |
88 | |
89 | #[cfg (not(any(PyPy, Py_3_10)))] |
90 | pub fn PyFuture_FromAST(_mod: *mut _mod, filename: *const c_char) -> *mut PyFutureFeatures; |
91 | |
92 | #[cfg (not(any(PyPy, Py_3_10)))] |
93 | pub fn PyFuture_FromASTObject( |
94 | _mod: *mut _mod, |
95 | filename: *mut PyObject, |
96 | ) -> *mut PyFutureFeatures; |
97 | |
98 | // skipped non-limited _Py_Mangle |
99 | // skipped non-limited PY_INVALID_STACK_EFFECT |
100 | |
101 | pub fn PyCompile_OpcodeStackEffect(opcode: c_int, oparg: c_int) -> c_int; |
102 | |
103 | #[cfg (Py_3_8)] |
104 | pub fn PyCompile_OpcodeStackEffectWithJump(opcode: c_int, oparg: c_int, jump: c_int) -> c_int; |
105 | |
106 | // skipped non-limited _PyASTOptimizeState |
107 | // skipped non-limited _PyAST_Optimize |
108 | } |
109 | |