Mercurial > cpython-lru_cache-weakref
annotate Include/frameobject.h @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | 65d2d8e67da3 |
| children | 4567e158d20c |
| rev | line source |
|---|---|
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
1 #ifndef Py_FRAMEOBJECT_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
2 #define Py_FRAMEOBJECT_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
3 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
4 extern "C" { |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
5 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
6 |
| 145 | 7 /*********************************************************** |
| 2058 | 8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 9 The Netherlands. | |
| 145 | 10 |
| 11 All Rights Reserved | |
| 12 | |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
13 Permission to use, copy, modify, and distribute this software and its |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
14 documentation for any purpose and without fee is hereby granted, |
| 145 | 15 provided that the above copyright notice appear in all copies and that |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
16 both that copyright notice and this permission notice appear in |
| 145 | 17 supporting documentation, and that the names of Stichting Mathematisch |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
18 Centrum or CWI or Corporation for National Research Initiatives or |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
19 CNRI not be used in advertising or publicity pertaining to |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
20 distribution of the software without specific, written prior |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
21 permission. |
| 145 | 22 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
23 While CWI is the initial source for this software, a modified version |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
24 is made available by the Corporation for National Research Initiatives |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
25 (CNRI) at the Internet address ftp://ftp.python.org. |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
26 |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3605
diff
changeset
|
34 PERFORMANCE OF THIS SOFTWARE. |
| 145 | 35 |
| 36 ******************************************************************/ | |
| 37 | |
| 86 | 38 /* Frame object interface */ |
| 39 | |
| 40 typedef struct { | |
| 41 int b_type; /* what kind of block this is */ | |
| 42 int b_handler; /* where to jump to find handler */ | |
| 43 int b_level; /* value stack level to pop to */ | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
44 } PyTryBlock; |
| 86 | 45 |
| 46 typedef struct _frame { | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
47 PyObject_HEAD |
| 86 | 48 struct _frame *f_back; /* previous frame, or NULL */ |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
49 PyCodeObject *f_code; /* code segment */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
50 PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
51 PyObject *f_globals; /* global symbol table (PyDictObject) */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
52 PyObject *f_locals; /* local symbol table (PyDictObject) */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
53 PyObject *f_owner; /* owner (e.g. class or module) or NULL */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
54 PyObject *f_fastlocals; /* fast local variables (PyListObject) */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
55 PyObject **f_valuestack; /* malloc'ed array */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
56 PyTryBlock *f_blockstack; /* malloc'ed array */ |
| 86 | 57 int f_nvalues; /* size of f_valuestack */ |
| 58 int f_nblocks; /* size of f_blockstack */ | |
| 59 int f_iblock; /* index in f_blockstack */ | |
|
587
d1547d6bb5b5
Added f_lasti and f_lineno members.
Guido van Rossum <guido@python.org>
parents:
165
diff
changeset
|
60 int f_lasti; /* Last instruction if called */ |
|
d1547d6bb5b5
Added f_lasti and f_lineno members.
Guido van Rossum <guido@python.org>
parents:
165
diff
changeset
|
61 int f_lineno; /* Current line number */ |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
62 int f_restricted; /* Flag set if restricted operations |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
63 in this scope */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
64 PyObject *f_trace; /* Trace function */ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
65 } PyFrameObject; |
| 86 | 66 |
| 67 | |
| 68 /* Standard object interface */ | |
| 69 | |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2146
diff
changeset
|
70 extern DL_IMPORT(PyTypeObject) PyFrame_Type; |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
71 |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
72 #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) |
| 86 | 73 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
74 PyFrameObject * PyFrame_New |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
75 Py_PROTO((PyFrameObject *, PyCodeObject *, |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
76 PyObject *, PyObject *, PyObject *, int, int)); |
| 86 | 77 |
| 78 | |
| 79 /* The rest of the interface is specific for frame objects */ | |
| 80 | |
|
2146
9afdbf944c2a
new names for lots of new functions
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
81 /* Tuple access macros */ |
| 86 | 82 |
| 3605 | 83 #ifndef DEBUG |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
84 #define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i)) |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
85 #define GETITEMNAME(v, i) \ |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
86 PyString_AS_STRING((PyStringObject *)GETITEM((v), (i))) |
| 86 | 87 #else |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
88 #define GETITEM(v, i) PyTuple_GetItem((v), (i)) |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
89 #define GETITEMNAME(v, i) PyString_AsString(GETITEM(v, i)) |
| 86 | 90 #endif |
| 91 | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
92 #define GETUSTRINGVALUE(s) ((unsigned char *)PyString_AS_STRING(s)) |
| 86 | 93 |
| 94 /* Code access macros */ | |
| 95 | |
| 96 #define Getconst(f, i) (GETITEM((f)->f_code->co_consts, (i))) | |
| 97 #define Getname(f, i) (GETITEMNAME((f)->f_code->co_names, (i))) | |
|
165
a4547af29671
Added Getnamev() macro.
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
98 #define Getnamev(f, i) (GETITEM((f)->f_code->co_names, (i))) |
| 86 | 99 |
| 100 | |
| 101 /* Block management functions */ | |
| 102 | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
103 void PyFrame_BlockSetup Py_PROTO((PyFrameObject *, int, int, int)); |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
104 PyTryBlock *PyFrame_BlockPop Py_PROTO((PyFrameObject *)); |
|
1079
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
105 |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
106 /* Extend the value stack */ |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
107 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
108 PyObject **PyFrame_ExtendStack Py_PROTO((PyFrameObject *, int, int)); |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
109 |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
110 /* Conversions between "fast locals" and locals in dictionary */ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
111 |
|
2146
9afdbf944c2a
new names for lots of new functions
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
112 void PyFrame_LocalsToFast Py_PROTO((PyFrameObject *, int)); |
|
9afdbf944c2a
new names for lots of new functions
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
113 void PyFrame_FastToLocals Py_PROTO((PyFrameObject *)); |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
114 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
115 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
116 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
117 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
118 #endif /* !Py_FRAMEOBJECT_H */ |
