Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / include / python2.4 / compile.h
CommitLineData
86530b38
AT
1#ifndef Py_COMPILE_H
2#define Py_COMPILE_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7/* Bytecode object */
8typedef struct {
9 PyObject_HEAD
10 int co_argcount; /* #arguments, except *args */
11 int co_nlocals; /* #local variables */
12 int co_stacksize; /* #entries needed for evaluation stack */
13 int co_flags; /* CO_..., see below */
14 PyObject *co_code; /* instruction opcodes */
15 PyObject *co_consts; /* list (constants used) */
16 PyObject *co_names; /* list of strings (names used) */
17 PyObject *co_varnames; /* tuple of strings (local variable names) */
18 PyObject *co_freevars; /* tuple of strings (free variable names) */
19 PyObject *co_cellvars; /* tuple of strings (cell variable names) */
20 /* The rest doesn't count for hash/cmp */
21 PyObject *co_filename; /* string (where it was loaded from) */
22 PyObject *co_name; /* string (name, for reference) */
23 int co_firstlineno; /* first source line number */
24 PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */
25} PyCodeObject;
26
27/* Masks for co_flags above */
28#define CO_OPTIMIZED 0x0001
29#define CO_NEWLOCALS 0x0002
30#define CO_VARARGS 0x0004
31#define CO_VARKEYWORDS 0x0008
32#define CO_NESTED 0x0010
33#define CO_GENERATOR 0x0020
34/* The CO_NOFREE flag is set if there are no free or cell variables.
35 This information is redundant, but it allows a single flag test
36 to determine whether there is any extra work to be done when the
37 call frame it setup.
38*/
39#define CO_NOFREE 0x0040
40/* XXX Temporary hack. Until generators are a permanent part of the
41 language, we need a way for a code object to record that generators
42 were *possible* when it was compiled. This is so code dynamically
43 compiled *by* a code object knows whether to allow yield stmts. In
44 effect, this passes on the "from __future__ import generators" state
45 in effect when the code block was compiled. */
46#define CO_GENERATOR_ALLOWED 0x1000 /* no longer used in an essential way */
47#define CO_FUTURE_DIVISION 0x2000
48
49PyAPI_DATA(PyTypeObject) PyCode_Type;
50
51#define PyCode_Check(op) ((op)->ob_type == &PyCode_Type)
52#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars))
53
54#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
55
56/* Public interface */
57struct _node; /* Declare the existence of this type */
58PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
59PyAPI_FUNC(PyCodeObject *) PyCode_New(
60 int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
61 PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
62 /* same as struct above */
63PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
64
65/* Future feature support */
66
67typedef struct {
68 int ff_found_docstring;
69 int ff_last_lineno;
70 int ff_features;
71} PyFutureFeatures;
72
73PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, const char *);
74PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *,
75 PyCompilerFlags *);
76
77#define FUTURE_NESTED_SCOPES "nested_scopes"
78#define FUTURE_GENERATORS "generators"
79#define FUTURE_DIVISION "division"
80
81#ifdef __cplusplus
82}
83#endif
84#endif /* !Py_COMPILE_H */