blob: ac2636dfc93db6e1cde928b2fd9e5610c3a7258c [file] [log] [blame]
Fred Drakeea9cb5a2000-07-09 00:20:36 +00001#ifndef Py_COMPILE_H
2#define Py_COMPILE_H
Thomas Woutersca82a8b2006-02-28 23:09:08 +00003
Victor Stinner2bdc7f52011-09-29 01:04:08 +02004#ifndef Py_LIMITED_API
Thomas Woutersca82a8b2006-02-28 23:09:08 +00005#include "code.h"
6
Fred Drakeea9cb5a2000-07-09 00:20:36 +00007#ifdef __cplusplus
8extern "C" {
9#endif
10
Guido van Rossum3f5da241990-12-20 15:06:42 +000011/* Public interface */
Guido van Rossume543a941991-04-03 19:00:55 +000012struct _node; /* Declare the existence of this type */
Martin v. Löwis95292d62002-12-11 14:04:59 +000013PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
Guido van Rossuma3309961993-07-28 09:05:47 +000014
Jeremy Hylton4db62b12001-02-27 19:07:02 +000015/* Future feature support */
16
17typedef struct {
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000018 int ff_features; /* flags set by future statements */
19 int ff_lineno; /* line number of last future statement */
Jeremy Hylton4db62b12001-02-27 19:07:02 +000020} PyFutureFeatures;
21
Jeremy Hylton4db62b12001-02-27 19:07:02 +000022#define FUTURE_NESTED_SCOPES "nested_scopes"
Guido van Rossumb09f7ed2001-07-15 21:08:29 +000023#define FUTURE_GENERATORS "generators"
Guido van Rossum4668b002001-08-08 05:00:18 +000024#define FUTURE_DIVISION "division"
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000025#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
Thomas Wouters34aa7ba2006-02-28 19:02:24 +000026#define FUTURE_WITH_STATEMENT "with_statement"
Eric Smith87824082008-03-20 23:02:08 +000027#define FUTURE_PRINT_FUNCTION "print_function"
Christian Heimes4d6ec852008-03-26 22:34:47 +000028#define FUTURE_UNICODE_LITERALS "unicode_literals"
Brett Cannone3944a52009-04-01 05:08:41 +000029#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
Guido van Rossum4668b002001-08-08 05:00:18 +000030
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000031struct _mod; /* Declare the existence of this type */
Georg Brandl8334fd92010-12-04 10:26:46 +000032#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
Victor Stinner00676d12010-12-27 01:49:31 +000033PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
Victor Stinner0d711162010-12-27 02:39:20 +000034 struct _mod *mod,
Victor Stinner00676d12010-12-27 01:49:31 +000035 const char *filename, /* decoded from the filesystem encoding */
36 PyCompilerFlags *flags,
37 int optimize,
38 PyArena *arena);
Neal Norwitz38eb50b2005-10-23 19:06:02 +000039PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000040
Victor Stinner2bdc7f52011-09-29 01:04:08 +020041/* _Py_Mangle is defined in compile.c */
42PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000043
Guido van Rossuma3309961993-07-28 09:05:47 +000044#ifdef __cplusplus
45}
46#endif
Victor Stinner2bdc7f52011-09-29 01:04:08 +020047
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000048#endif /* !Py_LIMITED_API */
Victor Stinner2bdc7f52011-09-29 01:04:08 +020049
50/* These definitions must match corresponding definitions in graminit.h.
51 There's code in compile.c that checks that they are the same. */
52#define Py_single_input 256
53#define Py_file_input 257
54#define Py_eval_input 258
55
56#endif /* !Py_COMPILE_H */