home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / py2s152.zip / Include / pystate.h < prev    next >
C/C++ Source or Header  |  1999-06-27  |  3KB  |  119 lines

  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. struct _ts; /* Forward */
  44. struct _is; /* Forward */
  45.  
  46. typedef struct _is {
  47.  
  48.     struct _is *next;
  49.     struct _ts *tstate_head;
  50.  
  51.     PyObject *modules;
  52.     PyObject *sysdict;
  53.     PyObject *builtins;
  54.  
  55.     int checkinterval;
  56.  
  57. } PyInterpreterState;
  58.  
  59.  
  60. /* State unique per thread */
  61.  
  62. struct _frame; /* Avoid including frameobject.h */
  63.  
  64. typedef struct _ts {
  65.  
  66.     struct _ts *next;
  67.     PyInterpreterState *interp;
  68.  
  69.     struct _frame *frame;
  70.     int recursion_depth;
  71.     int ticker;
  72.     int tracing;
  73.  
  74.     PyObject *sys_profilefunc;
  75.     PyObject *sys_tracefunc;
  76.  
  77.     PyObject *curexc_type;
  78.     PyObject *curexc_value;
  79.     PyObject *curexc_traceback;
  80.  
  81.     PyObject *exc_type;
  82.     PyObject *exc_value;
  83.     PyObject *exc_traceback;
  84.  
  85.     PyObject *dict;
  86.  
  87.     /* XXX signal handlers should also be here */
  88.  
  89. } PyThreadState;
  90.  
  91.  
  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 *));
  95.  
  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 *));
  99.  
  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));
  103.  
  104.  
  105. /* Variable and macro for in-line access to current thread state */
  106.  
  107. extern DL_IMPORT(PyThreadState *) _PyThreadState_Current;
  108.  
  109. #ifdef Py_DEBUG
  110. #define PyThreadState_GET() PyThreadState_Get()
  111. #else
  112. #define PyThreadState_GET() (_PyThreadState_Current)
  113. #endif
  114.  
  115. #ifdef __cplusplus
  116. }
  117. #endif
  118. #endif /* !Py_PYSTATE_H */
  119.