]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Include/frameobject.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Include / frameobject.h
CommitLineData
4710c53d 1\r
2/* Frame object interface */\r
3\r
4#ifndef Py_FRAMEOBJECT_H\r
5#define Py_FRAMEOBJECT_H\r
6#ifdef __cplusplus\r
7extern "C" {\r
8#endif\r
9\r
10typedef struct {\r
11 int b_type; /* what kind of block this is */\r
12 int b_handler; /* where to jump to find handler */\r
13 int b_level; /* value stack level to pop to */\r
14} PyTryBlock;\r
15\r
16typedef struct _frame {\r
17 PyObject_VAR_HEAD\r
18 struct _frame *f_back; /* previous frame, or NULL */\r
19 PyCodeObject *f_code; /* code segment */\r
20 PyObject *f_builtins; /* builtin symbol table (PyDictObject) */\r
21 PyObject *f_globals; /* global symbol table (PyDictObject) */\r
22 PyObject *f_locals; /* local symbol table (any mapping) */\r
23 PyObject **f_valuestack; /* points after the last local */\r
24 /* Next free slot in f_valuestack. Frame creation sets to f_valuestack.\r
25 Frame evaluation usually NULLs it, but a frame that yields sets it\r
26 to the current stack top. */\r
27 PyObject **f_stacktop;\r
28 PyObject *f_trace; /* Trace function */\r
29\r
30 /* If an exception is raised in this frame, the next three are used to\r
31 * record the exception info (if any) originally in the thread state. See\r
32 * comments before set_exc_info() -- it's not obvious.\r
33 * Invariant: if _type is NULL, then so are _value and _traceback.\r
34 * Desired invariant: all three are NULL, or all three are non-NULL. That\r
35 * one isn't currently true, but "should be".\r
36 */\r
37 PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;\r
38\r
39 PyThreadState *f_tstate;\r
40 int f_lasti; /* Last instruction if called */\r
41 /* Call PyFrame_GetLineNumber() instead of reading this field\r
42 directly. As of 2.3 f_lineno is only valid when tracing is\r
43 active (i.e. when f_trace is set). At other times we use\r
44 PyCode_Addr2Line to calculate the line from the current\r
45 bytecode index. */\r
46 int f_lineno; /* Current line number */\r
47 int f_iblock; /* index in f_blockstack */\r
48 PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */\r
49 PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */\r
50} PyFrameObject;\r
51\r
52\r
53/* Standard object interface */\r
54\r
55PyAPI_DATA(PyTypeObject) PyFrame_Type;\r
56\r
57#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)\r
58#define PyFrame_IsRestricted(f) \\r
59 ((f)->f_builtins != (f)->f_tstate->interp->builtins)\r
60\r
61PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,\r
62 PyObject *, PyObject *);\r
63\r
64\r
65/* The rest of the interface is specific for frame objects */\r
66\r
67/* Block management functions */\r
68\r
69PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);\r
70PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);\r
71\r
72/* Extend the value stack */\r
73\r
74PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int);\r
75\r
76/* Conversions between "fast locals" and locals in dictionary */\r
77\r
78PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);\r
79PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);\r
80\r
81PyAPI_FUNC(int) PyFrame_ClearFreeList(void);\r
82\r
83/* Return the line of code the frame is currently executing. */\r
84PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);\r
85\r
86#ifdef __cplusplus\r
87}\r
88#endif\r
89#endif /* !Py_FRAMEOBJECT_H */\r