+++ /dev/null
-/* Definitions for bytecode */\r
-\r
-#ifndef Py_CODE_H\r
-#define Py_CODE_H\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/* Bytecode object */\r
-typedef struct {\r
- PyObject_HEAD\r
- int co_argcount; /* #arguments, except *args */\r
- int co_nlocals; /* #local variables */\r
- int co_stacksize; /* #entries needed for evaluation stack */\r
- int co_flags; /* CO_..., see below */\r
- PyObject *co_code; /* instruction opcodes */\r
- PyObject *co_consts; /* list (constants used) */\r
- PyObject *co_names; /* list of strings (names used) */\r
- PyObject *co_varnames; /* tuple of strings (local variable names) */\r
- PyObject *co_freevars; /* tuple of strings (free variable names) */\r
- PyObject *co_cellvars; /* tuple of strings (cell variable names) */\r
- /* The rest doesn't count for hash/cmp */\r
- PyObject *co_filename; /* string (where it was loaded from) */\r
- PyObject *co_name; /* string (name, for reference) */\r
- int co_firstlineno; /* first source line number */\r
- PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See\r
- Objects/lnotab_notes.txt for details. */\r
- void *co_zombieframe; /* for optimization only (see frameobject.c) */\r
- PyObject *co_weakreflist; /* to support weakrefs to code objects */\r
-} PyCodeObject;\r
-\r
-/* Masks for co_flags above */\r
-#define CO_OPTIMIZED 0x0001\r
-#define CO_NEWLOCALS 0x0002\r
-#define CO_VARARGS 0x0004\r
-#define CO_VARKEYWORDS 0x0008\r
-#define CO_NESTED 0x0010\r
-#define CO_GENERATOR 0x0020\r
-/* The CO_NOFREE flag is set if there are no free or cell variables.\r
- This information is redundant, but it allows a single flag test\r
- to determine whether there is any extra work to be done when the\r
- call frame it setup.\r
-*/\r
-#define CO_NOFREE 0x0040\r
-\r
-#if 0\r
-/* This is no longer used. Stopped defining in 2.5, do not re-use. */\r
-#define CO_GENERATOR_ALLOWED 0x1000\r
-#endif\r
-#define CO_FUTURE_DIVISION 0x2000\r
-#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */\r
-#define CO_FUTURE_WITH_STATEMENT 0x8000\r
-#define CO_FUTURE_PRINT_FUNCTION 0x10000\r
-#define CO_FUTURE_UNICODE_LITERALS 0x20000\r
-\r
-/* This should be defined if a future statement modifies the syntax.\r
- For example, when a keyword is added.\r
-*/\r
-#if 1\r
-#define PY_PARSER_REQUIRES_FUTURE_KEYWORD\r
-#endif\r
-\r
-#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */\r
-\r
-PyAPI_DATA(PyTypeObject) PyCode_Type;\r
-\r
-#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type)\r
-#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars))\r
-\r
-/* Public interface */\r
-PyAPI_FUNC(PyCodeObject *) PyCode_New(\r
- int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,\r
- PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); \r
- /* same as struct above */\r
-\r
-/* Creates a new empty code object with the specified source location. */\r
-PyAPI_FUNC(PyCodeObject *)\r
-PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);\r
-\r
-/* Return the line number associated with the specified bytecode index\r
- in this code object. If you just need the line number of a frame,\r
- use PyFrame_GetLineNumber() instead. */\r
-PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);\r
-\r
-/* for internal use only */\r
-#define _PyCode_GETCODEPTR(co, pp) \\r
- ((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \\r
- ((co)->co_code, 0, (void **)(pp)))\r
-\r
-typedef struct _addr_pair {\r
- int ap_lower;\r
- int ap_upper;\r
-} PyAddrPair;\r
-\r
-/* Update *bounds to describe the first and one-past-the-last instructions in the\r
- same line as lasti. Return the number of that line.\r
-*/\r
-PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,\r
- int lasti, PyAddrPair *bounds);\r
-\r
-PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,\r
- PyObject *names, PyObject *lineno_obj);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif /* !Py_CODE_H */\r