Added 'list_only' option (and modified 'run()' to respect it).
[python/dscho.git] / Include / pystate.h
blobe578024c3375e20f7b4140f3502f89cb90ff572b
1 #ifndef Py_PYSTATE_H
2 #define Py_PYSTATE_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
7 /***********************************************************
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
9 The Netherlands.
11 All Rights Reserved
13 Permission to use, copy, modify, and distribute this software and its
14 documentation for any purpose and without fee is hereby granted,
15 provided that the above copyright notice appear in all copies and that
16 both that copyright notice and this permission notice appear in
17 supporting documentation, and that the names of Stichting Mathematisch
18 Centrum or CWI or Corporation for National Research Initiatives or
19 CNRI not be used in advertising or publicity pertaining to
20 distribution of the software without specific, written prior
21 permission.
23 While CWI is the initial source for this software, a modified version
24 is made available by the Corporation for National Research Initiatives
25 (CNRI) at the Internet address ftp://ftp.python.org.
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34 PERFORMANCE OF THIS SOFTWARE.
36 ******************************************************************/
38 /* Thread and interpreter state structures and their interfaces */
41 /* State shared between threads */
43 struct _ts; /* Forward */
44 struct _is; /* Forward */
46 typedef struct _is {
48 struct _is *next;
49 struct _ts *tstate_head;
51 PyObject *modules;
52 PyObject *sysdict;
53 PyObject *builtins;
55 int checkinterval;
57 } PyInterpreterState;
60 /* State unique per thread */
62 struct _frame; /* Avoid including frameobject.h */
64 typedef struct _ts {
66 struct _ts *next;
67 PyInterpreterState *interp;
69 struct _frame *frame;
70 int recursion_depth;
71 int ticker;
72 int tracing;
74 PyObject *sys_profilefunc;
75 PyObject *sys_tracefunc;
77 PyObject *curexc_type;
78 PyObject *curexc_value;
79 PyObject *curexc_traceback;
81 PyObject *exc_type;
82 PyObject *exc_value;
83 PyObject *exc_traceback;
85 PyObject *dict;
87 /* XXX signal handlers should also be here */
89 } PyThreadState;
92 DL_IMPORT(PyInterpreterState *) PyInterpreterState_New Py_PROTO((void));
93 DL_IMPORT(void) PyInterpreterState_Clear Py_PROTO((PyInterpreterState *));
94 DL_IMPORT(void) PyInterpreterState_Delete Py_PROTO((PyInterpreterState *));
96 DL_IMPORT(PyThreadState *) PyThreadState_New Py_PROTO((PyInterpreterState *));
97 DL_IMPORT(void) PyThreadState_Clear Py_PROTO((PyThreadState *));
98 DL_IMPORT(void) PyThreadState_Delete Py_PROTO((PyThreadState *));
100 DL_IMPORT(PyThreadState *) PyThreadState_Get Py_PROTO((void));
101 DL_IMPORT(PyThreadState *) PyThreadState_Swap Py_PROTO((PyThreadState *));
102 DL_IMPORT(PyObject *) PyThreadState_GetDict Py_PROTO((void));
105 /* Variable and macro for in-line access to current thread state */
107 extern DL_IMPORT(PyThreadState *) _PyThreadState_Current;
109 #ifdef Py_DEBUG
110 #define PyThreadState_GET() PyThreadState_Get()
111 #else
112 #define PyThreadState_GET() (_PyThreadState_Current)
113 #endif
115 #ifdef __cplusplus
117 #endif
118 #endif /* !Py_PYSTATE_H */