| 
									
										
										
										
											2000-07-09 00:20:36 +00:00
										 |  |  | #ifndef Py_COMPILE_H
 | 
					
						
							|  |  |  | #define Py_COMPILE_H
 | 
					
						
							| 
									
										
										
										
											2006-02-28 23:09:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-29 01:04:08 +02:00
										 |  |  | #ifndef Py_LIMITED_API
 | 
					
						
							| 
									
										
										
										
											2006-02-28 23:09:08 +00:00
										 |  |  | #include "code.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-07-09 00:20:36 +00:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1990-12-20 15:06:42 +00:00
										 |  |  | /* Public interface */ | 
					
						
							| 
									
										
										
										
											1991-04-03 19:00:55 +00:00
										 |  |  | struct _node; /* Declare the existence of this type */ | 
					
						
							| 
									
										
										
										
											2002-12-11 14:04:59 +00:00
										 |  |  | PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); | 
					
						
							| 
									
										
										
										
											2017-05-22 21:36:03 -07:00
										 |  |  | /* XXX (ncoghlan): Unprefixed type name in a public API! */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
 | 
					
						
							|  |  |  |                    CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ | 
					
						
							|  |  |  |                    CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ | 
					
						
							| 
									
										
										
										
											2018-01-26 08:20:18 -08:00
										 |  |  |                    CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS) | 
					
						
							| 
									
										
										
										
											2017-05-22 21:36:03 -07:00
										 |  |  | #define PyCF_MASK_OBSOLETE (CO_NESTED)
 | 
					
						
							| 
									
										
										
										
											2020-04-22 19:09:03 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique.
 | 
					
						
							|  |  |  |    PyCF_ constants can use bits from 0x0100 to 0x10000. | 
					
						
							|  |  |  |    CO_FUTURE_ constants use bits starting at 0x20000. */ | 
					
						
							| 
									
										
										
										
											2017-05-22 21:36:03 -07:00
										 |  |  | #define PyCF_SOURCE_IS_UTF8  0x0100
 | 
					
						
							|  |  |  | #define PyCF_DONT_IMPLY_DEDENT 0x0200
 | 
					
						
							|  |  |  | #define PyCF_ONLY_AST 0x0400
 | 
					
						
							|  |  |  | #define PyCF_IGNORE_COOKIE 0x0800
 | 
					
						
							| 
									
										
										
										
											2019-01-31 03:40:27 -08:00
										 |  |  | #define PyCF_TYPE_COMMENTS 0x1000
 | 
					
						
							| 
									
										
										
										
											2019-05-21 13:12:03 -07:00
										 |  |  | #define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
 | 
					
						
							| 
									
										
										
										
											2020-04-22 19:09:03 +03:00
										 |  |  | #define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
 | 
					
						
							|  |  |  |                            PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT) | 
					
						
							| 
									
										
										
										
											2017-05-22 21:36:03 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef Py_LIMITED_API
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     int cf_flags;  /* bitmask of CO_xxx flags relevant to future */ | 
					
						
							| 
									
										
										
										
											2019-03-07 12:38:08 -08:00
										 |  |  |     int cf_feature_version;  /* minor Python version (PyCF_ONLY_AST) */ | 
					
						
							| 
									
										
										
										
											2017-05-22 21:36:03 -07:00
										 |  |  | } PyCompilerFlags; | 
					
						
							| 
									
										
										
										
											2019-06-13 02:16:41 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define _PyCompilerFlags_INIT \
 | 
					
						
							|  |  |  |     (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION} | 
					
						
							| 
									
										
										
										
											2017-05-22 21:36:03 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											1993-07-28 09:05:47 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-27 19:07:02 +00:00
										 |  |  | /* Future feature support */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							| 
									
										
										
										
											2005-10-20 19:59:25 +00:00
										 |  |  |     int ff_features;      /* flags set by future statements */ | 
					
						
							|  |  |  |     int ff_lineno;        /* line number of last future statement */ | 
					
						
							| 
									
										
										
										
											2001-02-27 19:07:02 +00:00
										 |  |  | } PyFutureFeatures; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define FUTURE_NESTED_SCOPES "nested_scopes"
 | 
					
						
							| 
									
										
										
										
											2001-07-15 21:08:29 +00:00
										 |  |  | #define FUTURE_GENERATORS "generators"
 | 
					
						
							| 
									
										
										
										
											2001-08-08 05:00:18 +00:00
										 |  |  | #define FUTURE_DIVISION "division"
 | 
					
						
							| 
									
										
										
										
											2006-04-21 10:40:58 +00:00
										 |  |  | #define FUTURE_ABSOLUTE_IMPORT "absolute_import"
 | 
					
						
							| 
									
										
										
										
											2006-02-28 19:02:24 +00:00
										 |  |  | #define FUTURE_WITH_STATEMENT "with_statement"
 | 
					
						
							| 
									
										
										
										
											2008-03-20 23:02:08 +00:00
										 |  |  | #define FUTURE_PRINT_FUNCTION "print_function"
 | 
					
						
							| 
									
										
										
										
											2008-03-26 22:34:47 +00:00
										 |  |  | #define FUTURE_UNICODE_LITERALS "unicode_literals"
 | 
					
						
							| 
									
										
										
										
											2009-04-01 05:08:41 +00:00
										 |  |  | #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
 | 
					
						
							| 
									
										
										
										
											2015-05-09 11:44:30 -04:00
										 |  |  | #define FUTURE_GENERATOR_STOP "generator_stop"
 | 
					
						
							| 
									
										
										
										
											2018-01-26 08:20:18 -08:00
										 |  |  | #define FUTURE_ANNOTATIONS "annotations"
 | 
					
						
							| 
									
										
										
										
											2001-08-08 05:00:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-20 19:59:25 +00:00
										 |  |  | struct _mod; /* Declare the existence of this type */ | 
					
						
							| 
									
										
										
										
											2010-12-04 10:26:46 +00:00
										 |  |  | #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
 | 
					
						
							| 
									
										
										
										
											2010-12-27 01:49:31 +00:00
										 |  |  | PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx( | 
					
						
							| 
									
										
										
										
											2010-12-27 02:39:20 +00:00
										 |  |  |     struct _mod *mod, | 
					
						
							| 
									
										
										
										
											2010-12-27 01:49:31 +00:00
										 |  |  |     const char *filename,       /* decoded from the filesystem encoding */ | 
					
						
							|  |  |  |     PyCompilerFlags *flags, | 
					
						
							|  |  |  |     int optimize, | 
					
						
							|  |  |  |     PyArena *arena); | 
					
						
							| 
									
										
										
										
											2013-08-26 22:28:21 +02:00
										 |  |  | PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject( | 
					
						
							|  |  |  |     struct _mod *mod, | 
					
						
							|  |  |  |     PyObject *filename, | 
					
						
							|  |  |  |     PyCompilerFlags *flags, | 
					
						
							|  |  |  |     int optimize, | 
					
						
							|  |  |  |     PyArena *arena); | 
					
						
							|  |  |  | PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST( | 
					
						
							|  |  |  |     struct _mod * mod, | 
					
						
							|  |  |  |     const char *filename        /* decoded from the filesystem encoding */ | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject( | 
					
						
							|  |  |  |     struct _mod * mod, | 
					
						
							|  |  |  |     PyObject *filename | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2005-10-20 19:59:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-29 01:04:08 +02:00
										 |  |  | /* _Py_Mangle is defined in compile.c */ | 
					
						
							|  |  |  | PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); | 
					
						
							| 
									
										
										
										
											2005-10-20 19:59:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-23 14:49:22 -08:00
										 |  |  | #define PY_INVALID_STACK_EFFECT INT_MAX
 | 
					
						
							|  |  |  | PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); | 
					
						
							| 
									
										
										
										
											2018-09-18 09:54:26 +03:00
										 |  |  | PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump); | 
					
						
							| 
									
										
										
										
											2013-11-23 14:49:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-18 23:02:09 +00:00
										 |  |  | typedef struct { | 
					
						
							|  |  |  |     int optimize; | 
					
						
							|  |  |  |     int ff_features; | 
					
						
							|  |  |  | } _PyASTOptimizeState; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, _PyASTOptimizeState *state); | 
					
						
							| 
									
										
										
										
											2017-12-14 16:47:20 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1993-07-28 09:05:47 +00:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-09-29 01:04:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-03 20:14:31 +00:00
										 |  |  | #endif /* !Py_LIMITED_API */
 | 
					
						
							| 
									
										
										
										
											2011-09-29 01:04:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-31 03:40:27 -08:00
										 |  |  | /* These definitions must match corresponding definitions in graminit.h. */ | 
					
						
							| 
									
										
										
										
											2011-09-29 01:04:08 +02:00
										 |  |  | #define Py_single_input 256
 | 
					
						
							|  |  |  | #define Py_file_input 257
 | 
					
						
							|  |  |  | #define Py_eval_input 258
 | 
					
						
							| 
									
										
										
										
											2019-01-31 03:40:27 -08:00
										 |  |  | #define Py_func_type_input 345
 | 
					
						
							| 
									
										
										
										
											2011-09-29 01:04:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif /* !Py_COMPILE_H */
 |