17db96d56Sopenharmony_ci#ifndef Py_CPYTHON_COMPILE_H 27db96d56Sopenharmony_ci# error "this header file must not be included directly" 37db96d56Sopenharmony_ci#endif 47db96d56Sopenharmony_ci 57db96d56Sopenharmony_ci/* Public interface */ 67db96d56Sopenharmony_ci#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ 77db96d56Sopenharmony_ci CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ 87db96d56Sopenharmony_ci CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \ 97db96d56Sopenharmony_ci CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS) 107db96d56Sopenharmony_ci#define PyCF_MASK_OBSOLETE (CO_NESTED) 117db96d56Sopenharmony_ci 127db96d56Sopenharmony_ci/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique. 137db96d56Sopenharmony_ci PyCF_ constants can use bits from 0x0100 to 0x10000. 147db96d56Sopenharmony_ci CO_FUTURE_ constants use bits starting at 0x20000. */ 157db96d56Sopenharmony_ci#define PyCF_SOURCE_IS_UTF8 0x0100 167db96d56Sopenharmony_ci#define PyCF_DONT_IMPLY_DEDENT 0x0200 177db96d56Sopenharmony_ci#define PyCF_ONLY_AST 0x0400 187db96d56Sopenharmony_ci#define PyCF_IGNORE_COOKIE 0x0800 197db96d56Sopenharmony_ci#define PyCF_TYPE_COMMENTS 0x1000 207db96d56Sopenharmony_ci#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000 217db96d56Sopenharmony_ci#define PyCF_ALLOW_INCOMPLETE_INPUT 0x4000 227db96d56Sopenharmony_ci#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \ 237db96d56Sopenharmony_ci PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT | \ 247db96d56Sopenharmony_ci PyCF_ALLOW_INCOMPLETE_INPUT) 257db96d56Sopenharmony_ci 267db96d56Sopenharmony_citypedef struct { 277db96d56Sopenharmony_ci int cf_flags; /* bitmask of CO_xxx flags relevant to future */ 287db96d56Sopenharmony_ci int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */ 297db96d56Sopenharmony_ci} PyCompilerFlags; 307db96d56Sopenharmony_ci 317db96d56Sopenharmony_ci#define _PyCompilerFlags_INIT \ 327db96d56Sopenharmony_ci (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION} 337db96d56Sopenharmony_ci 347db96d56Sopenharmony_ci/* Future feature support */ 357db96d56Sopenharmony_ci 367db96d56Sopenharmony_citypedef struct { 377db96d56Sopenharmony_ci int ff_features; /* flags set by future statements */ 387db96d56Sopenharmony_ci int ff_lineno; /* line number of last future statement */ 397db96d56Sopenharmony_ci} PyFutureFeatures; 407db96d56Sopenharmony_ci 417db96d56Sopenharmony_ci#define FUTURE_NESTED_SCOPES "nested_scopes" 427db96d56Sopenharmony_ci#define FUTURE_GENERATORS "generators" 437db96d56Sopenharmony_ci#define FUTURE_DIVISION "division" 447db96d56Sopenharmony_ci#define FUTURE_ABSOLUTE_IMPORT "absolute_import" 457db96d56Sopenharmony_ci#define FUTURE_WITH_STATEMENT "with_statement" 467db96d56Sopenharmony_ci#define FUTURE_PRINT_FUNCTION "print_function" 477db96d56Sopenharmony_ci#define FUTURE_UNICODE_LITERALS "unicode_literals" 487db96d56Sopenharmony_ci#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL" 497db96d56Sopenharmony_ci#define FUTURE_GENERATOR_STOP "generator_stop" 507db96d56Sopenharmony_ci#define FUTURE_ANNOTATIONS "annotations" 517db96d56Sopenharmony_ci 527db96d56Sopenharmony_ci#define PY_INVALID_STACK_EFFECT INT_MAX 537db96d56Sopenharmony_ciPyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg); 547db96d56Sopenharmony_ciPyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump); 55