1#ifndef Py_COMPILE_H
2#define Py_COMPILE_H
3
4#ifndef Py_LIMITED_API
5#include "code.h"
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11/* Public interface */
12struct _node; /* Declare the existence of this type */
13PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
14
15/* Future feature support */
16
17typedef struct {
18 int ff_features; /* flags set by future statements */
19 int ff_lineno; /* line number of last future statement */
20} PyFutureFeatures;
21
22#define FUTURE_NESTED_SCOPES "nested_scopes"
23#define FUTURE_GENERATORS "generators"
24#define FUTURE_DIVISION "division"
25#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
26#define FUTURE_WITH_STATEMENT "with_statement"
27#define FUTURE_PRINT_FUNCTION "print_function"
28#define FUTURE_UNICODE_LITERALS "unicode_literals"
29#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
30#define FUTURE_GENERATOR_STOP "generator_stop"
31
32struct _mod; /* Declare the existence of this type */
33#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
34PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
35 struct _mod *mod,
36 const char *filename, /* decoded from the filesystem encoding */
37 PyCompilerFlags *flags,
38 int optimize,
39 PyArena *arena);
40PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
41 struct _mod *mod,
42 PyObject *filename,
43 PyCompilerFlags *flags,
44 int optimize,
45 PyArena *arena);
46PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
47 struct _mod * mod,
48 const char *filename /* decoded from the filesystem encoding */
49 );
50PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
51 struct _mod * mod,
52 PyObject *filename
53 );
54
55/* _Py_Mangle is defined in compile.c */
56PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
57
58#define PY_INVALID_STACK_EFFECT INT_MAX
59PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif /* !Py_LIMITED_API */
66
67/* These definitions must match corresponding definitions in graminit.h.
68 There's code in compile.c that checks that they are the same. */
69#define Py_single_input 256
70#define Py_file_input 257
71#define Py_eval_input 258
72
73#endif /* !Py_COMPILE_H */
74