Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 1 | #ifndef Py_PYSTATE_H |
| 2 | #define Py_PYSTATE_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
| 7 | /*********************************************************** |
| 8 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 9 | The Netherlands. |
| 10 | |
| 11 | All Rights Reserved |
| 12 | |
| 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. |
| 22 | |
| 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. |
| 26 | |
| 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. |
| 35 | |
| 36 | ******************************************************************/ |
| 37 | |
| 38 | /* Thread and interpreter state structures and their interfaces */ |
| 39 | |
| 40 | |
| 41 | /* State shared between threads */ |
| 42 | |
| 43 | #define NEXITFUNCS 32 |
| 44 | |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 45 | struct _ts; /* Forward */ |
| 46 | struct _is; /* Forward */ |
| 47 | |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 48 | typedef struct _is { |
| 49 | |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 50 | struct _is *next; |
| 51 | struct _ts *tstate_head; |
| 52 | |
| 53 | PyObject *modules; |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 54 | PyObject *sysdict; |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 55 | PyObject *builtins; |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 56 | |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 57 | int checkinterval; |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 58 | |
| 59 | } PyInterpreterState; |
| 60 | |
| 61 | |
| 62 | /* State unique per thread */ |
| 63 | |
| 64 | struct _frame; /* Avoid including frameobject.h */ |
| 65 | |
| 66 | typedef struct _ts { |
| 67 | |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 68 | struct _ts *next; |
| 69 | PyInterpreterState *interp; |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 70 | |
| 71 | struct _frame *frame; |
| 72 | int recursion_depth; |
| 73 | int ticker; |
| 74 | int tracing; |
| 75 | |
| 76 | PyObject *sys_profilefunc; |
| 77 | PyObject *sys_tracefunc; |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 78 | |
| 79 | PyObject *curexc_type; |
| 80 | PyObject *curexc_value; |
| 81 | PyObject *curexc_traceback; |
| 82 | |
| 83 | PyObject *exc_type; |
| 84 | PyObject *exc_value; |
| 85 | PyObject *exc_traceback; |
| 86 | |
Guido van Rossum | ee0a63b | 1998-04-13 20:24:05 +0000 | [diff] [blame] | 87 | PyObject *dict; |
| 88 | |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 89 | /* XXX signal handlers should also be here */ |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 90 | |
| 91 | } PyThreadState; |
| 92 | |
| 93 | |
Guido van Rossum | 59943ba | 1997-05-20 22:07:46 +0000 | [diff] [blame] | 94 | PyInterpreterState *PyInterpreterState_New Py_PROTO((void)); |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 95 | void PyInterpreterState_Clear Py_PROTO((PyInterpreterState *)); |
Guido van Rossum | 59943ba | 1997-05-20 22:07:46 +0000 | [diff] [blame] | 96 | void PyInterpreterState_Delete Py_PROTO((PyInterpreterState *)); |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 97 | |
Guido van Rossum | 59943ba | 1997-05-20 22:07:46 +0000 | [diff] [blame] | 98 | PyThreadState *PyThreadState_New Py_PROTO((PyInterpreterState *)); |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 99 | void PyThreadState_Clear Py_PROTO((PyThreadState *)); |
Guido van Rossum | 59943ba | 1997-05-20 22:07:46 +0000 | [diff] [blame] | 100 | void PyThreadState_Delete Py_PROTO((PyThreadState *)); |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 101 | |
Guido van Rossum | 59943ba | 1997-05-20 22:07:46 +0000 | [diff] [blame] | 102 | PyThreadState *PyThreadState_Get Py_PROTO((void)); |
| 103 | PyThreadState *PyThreadState_Swap Py_PROTO((PyThreadState *)); |
Guido van Rossum | 204751b | 1998-04-10 20:19:01 +0000 | [diff] [blame] | 104 | PyObject *PyThreadState_GetDict Py_PROTO((void)); |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 105 | |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 106 | #ifdef __cplusplus |
| 107 | } |
| 108 | #endif |
| 109 | #endif /* !Py_PYSTATE_H */ |