comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/compile.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 #ifndef Py_COMPILE_H
2 #define Py_COMPILE_H
3
4 #ifndef Py_LIMITED_API
5 #include "code.h"
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 /* Public interface */
12 struct _node; /* Declare the existence of this type */
13 PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
14 /* XXX (ncoghlan): Unprefixed type name in a public API! */
15
16 #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
17 CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
18 CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
19 CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
20 #define PyCF_MASK_OBSOLETE (CO_NESTED)
21 #define PyCF_SOURCE_IS_UTF8 0x0100
22 #define PyCF_DONT_IMPLY_DEDENT 0x0200
23 #define PyCF_ONLY_AST 0x0400
24 #define PyCF_IGNORE_COOKIE 0x0800
25 #define PyCF_TYPE_COMMENTS 0x1000
26 #define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
27
28 #ifndef Py_LIMITED_API
29 typedef struct {
30 int cf_flags; /* bitmask of CO_xxx flags relevant to future */
31 int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */
32 } PyCompilerFlags;
33
34 #define _PyCompilerFlags_INIT \
35 (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
36 #endif
37
38 /* Future feature support */
39
40 typedef struct {
41 int ff_features; /* flags set by future statements */
42 int ff_lineno; /* line number of last future statement */
43 } PyFutureFeatures;
44
45 #define FUTURE_NESTED_SCOPES "nested_scopes"
46 #define FUTURE_GENERATORS "generators"
47 #define FUTURE_DIVISION "division"
48 #define FUTURE_ABSOLUTE_IMPORT "absolute_import"
49 #define FUTURE_WITH_STATEMENT "with_statement"
50 #define FUTURE_PRINT_FUNCTION "print_function"
51 #define FUTURE_UNICODE_LITERALS "unicode_literals"
52 #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
53 #define FUTURE_GENERATOR_STOP "generator_stop"
54 #define FUTURE_ANNOTATIONS "annotations"
55
56 struct _mod; /* Declare the existence of this type */
57 #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
58 PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
59 struct _mod *mod,
60 const char *filename, /* decoded from the filesystem encoding */
61 PyCompilerFlags *flags,
62 int optimize,
63 PyArena *arena);
64 PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
65 struct _mod *mod,
66 PyObject *filename,
67 PyCompilerFlags *flags,
68 int optimize,
69 PyArena *arena);
70 PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
71 struct _mod * mod,
72 const char *filename /* decoded from the filesystem encoding */
73 );
74 PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
75 struct _mod * mod,
76 PyObject *filename
77 );
78
79 /* _Py_Mangle is defined in compile.c */
80 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
81
82 #define PY_INVALID_STACK_EFFECT INT_MAX
83 PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
84 PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
85
86 PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, int optimize);
87
88 #ifdef __cplusplus
89 }
90 #endif
91
92 #endif /* !Py_LIMITED_API */
93
94 /* These definitions must match corresponding definitions in graminit.h. */
95 #define Py_single_input 256
96 #define Py_file_input 257
97 #define Py_eval_input 258
98 #define Py_func_type_input 345
99
100 #endif /* !Py_COMPILE_H */