Mercurial > cpython-lru_cache-weakref
annotate Include/frameobject.h @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | b7871ca930ad |
| children | 60fdb1db1175 |
| 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) */ |
|
5012
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
53 PyObject **f_valuestack; /* points after the last local */ |
|
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
54 PyObject *f_trace; /* Trace function */ |
|
5405
b7871ca930ad
Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
5012
diff
changeset
|
55 PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; |
|
b7871ca930ad
Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
5012
diff
changeset
|
56 PyThreadState *f_tstate; |
|
587
d1547d6bb5b5
Added f_lasti and f_lineno members.
Guido van Rossum <guido@python.org>
parents:
165
diff
changeset
|
57 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
|
58 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
|
59 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
|
60 in this scope */ |
|
5012
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
61 int f_iblock; /* index in f_blockstack */ |
|
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
62 PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ |
|
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
63 int f_nlocals; /* number of locals */ |
|
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
64 int f_stacksize; /* size of value stack */ |
|
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
65 PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
66 } PyFrameObject; |
| 86 | 67 |
| 68 | |
| 69 /* Standard object interface */ | |
| 70 | |
|
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
|
71 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
|
72 |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
73 #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) |
| 86 | 74 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
75 PyFrameObject * PyFrame_New |
|
5405
b7871ca930ad
Massive changes for separate thread state management.
Guido van Rossum <guido@python.org>
parents:
5012
diff
changeset
|
76 Py_PROTO((PyThreadState *, PyCodeObject *, |
|
5012
77f9c25e1f1f
New lay-out of frame object, for fewer mallocs.
Guido van Rossum <guido@python.org>
parents:
4839
diff
changeset
|
77 PyObject *, PyObject *)); |
| 86 | 78 |
| 79 | |
| 80 /* The rest of the interface is specific for frame objects */ | |
| 81 | |
|
2146
9afdbf944c2a
new names for lots of new functions
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
82 /* Tuple access macros */ |
| 86 | 83 |
|
4839
4567e158d20c
Rename DEBUG macro to Py_DEBUG
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
84 #ifndef Py_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
|
85 #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
|
86 #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
|
87 PyString_AS_STRING((PyStringObject *)GETITEM((v), (i))) |
| 86 | 88 #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
|
89 #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
|
90 #define GETITEMNAME(v, i) PyString_AsString(GETITEM(v, i)) |
| 86 | 91 #endif |
| 92 | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
93 #define GETUSTRINGVALUE(s) ((unsigned char *)PyString_AS_STRING(s)) |
| 86 | 94 |
| 95 /* Code access macros */ | |
| 96 | |
| 97 #define Getconst(f, i) (GETITEM((f)->f_code->co_consts, (i))) | |
| 98 #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
|
99 #define Getnamev(f, i) (GETITEM((f)->f_code->co_names, (i))) |
| 86 | 100 |
| 101 | |
| 102 /* Block management functions */ | |
| 103 | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
104 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
|
105 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
|
106 |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
107 /* Extend the value stack */ |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
108 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
109 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
|
110 |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
111 /* 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
|
112 |
|
2146
9afdbf944c2a
new names for lots of new functions
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
113 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
|
114 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
|
115 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
116 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
117 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
118 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
119 #endif /* !Py_FRAMEOBJECT_H */ |
