2000-07-09 02:20:36 +02:00
|
|
|
#ifndef Py_COMPILE_H
|
|
|
|
#define Py_COMPILE_H
|
2006-03-01 00:09:08 +01:00
|
|
|
|
2011-09-29 01:04:08 +02:00
|
|
|
#ifndef Py_LIMITED_API
|
2006-03-01 00:09:08 +01:00
|
|
|
#include "code.h"
|
|
|
|
|
2000-07-09 02:20:36 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
1990-12-20 16:06:42 +01:00
|
|
|
/* Public interface */
|
1991-04-03 21:00:55 +02:00
|
|
|
struct _node; /* Declare the existence of this type */
|
2002-12-11 15:04:59 +01:00
|
|
|
PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
|
1993-07-28 11:05:47 +02:00
|
|
|
|
2001-02-27 20:07:02 +01:00
|
|
|
/* Future feature support */
|
|
|
|
|
|
|
|
typedef struct {
|
2005-10-20 21:59:25 +02:00
|
|
|
int ff_features; /* flags set by future statements */
|
|
|
|
int ff_lineno; /* line number of last future statement */
|
2001-02-27 20:07:02 +01:00
|
|
|
} PyFutureFeatures;
|
|
|
|
|
|
|
|
#define FUTURE_NESTED_SCOPES "nested_scopes"
|
2001-07-15 23:08:29 +02:00
|
|
|
#define FUTURE_GENERATORS "generators"
|
2001-08-08 07:00:18 +02:00
|
|
|
#define FUTURE_DIVISION "division"
|
2006-04-21 12:40:58 +02:00
|
|
|
#define FUTURE_ABSOLUTE_IMPORT "absolute_import"
|
2006-02-28 20:02:24 +01:00
|
|
|
#define FUTURE_WITH_STATEMENT "with_statement"
|
2008-03-21 00:02:08 +01:00
|
|
|
#define FUTURE_PRINT_FUNCTION "print_function"
|
2008-03-26 23:34:47 +01:00
|
|
|
#define FUTURE_UNICODE_LITERALS "unicode_literals"
|
2009-04-01 07:08:41 +02:00
|
|
|
#define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
|
2001-08-08 07:00:18 +02:00
|
|
|
|
2005-10-20 21:59:25 +02:00
|
|
|
struct _mod; /* Declare the existence of this type */
|
2010-12-04 11:26:46 +01:00
|
|
|
#define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
|
2010-12-27 02:49:31 +01:00
|
|
|
PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
|
2010-12-27 03:39:20 +01:00
|
|
|
struct _mod *mod,
|
2010-12-27 02:49:31 +01: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 21:59:25 +02: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 21:59:25 +02:00
|
|
|
|
2013-11-23 23:49:22 +01:00
|
|
|
#define PY_INVALID_STACK_EFFECT INT_MAX
|
|
|
|
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
|
|
|
|
|
1993-07-28 11:05:47 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2011-09-29 01:04:08 +02:00
|
|
|
|
2010-12-03 21:14:31 +01:00
|
|
|
#endif /* !Py_LIMITED_API */
|
2011-09-29 01:04:08 +02:00
|
|
|
|
|
|
|
/* These definitions must match corresponding definitions in graminit.h.
|
|
|
|
There's code in compile.c that checks that they are the same. */
|
|
|
|
#define Py_single_input 256
|
|
|
|
#define Py_file_input 257
|
|
|
|
#define Py_eval_input 258
|
|
|
|
|
|
|
|
#endif /* !Py_COMPILE_H */
|