home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / TemaCD / webclean / !!!python!!! / BeOpen-Python-2.0.exe / PYSTATE.H < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-01  |  1.9 KB  |  89 lines

  1.  
  2. /* Thread and interpreter state structures and their interfaces */
  3.  
  4.  
  5. #ifndef Py_PYSTATE_H
  6. #define Py_PYSTATE_H
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10.  
  11. /* State shared between threads */
  12.  
  13. struct _ts; /* Forward */
  14. struct _is; /* Forward */
  15.  
  16. typedef struct _is {
  17.  
  18.     struct _is *next;
  19.     struct _ts *tstate_head;
  20.  
  21.     PyObject *modules;
  22.     PyObject *sysdict;
  23.     PyObject *builtins;
  24.  
  25.     int checkinterval;
  26.  
  27. } PyInterpreterState;
  28.  
  29.  
  30. /* State unique per thread */
  31.  
  32. struct _frame; /* Avoid including frameobject.h */
  33.  
  34. typedef struct _ts {
  35.  
  36.     struct _ts *next;
  37.     PyInterpreterState *interp;
  38.  
  39.     struct _frame *frame;
  40.     int recursion_depth;
  41.     int ticker;
  42.     int tracing;
  43.  
  44.     PyObject *sys_profilefunc;
  45.     PyObject *sys_tracefunc;
  46.  
  47.     PyObject *curexc_type;
  48.     PyObject *curexc_value;
  49.     PyObject *curexc_traceback;
  50.  
  51.     PyObject *exc_type;
  52.     PyObject *exc_value;
  53.     PyObject *exc_traceback;
  54.  
  55.     PyObject *dict;
  56.  
  57.     /* XXX signal handlers should also be here */
  58.  
  59. } PyThreadState;
  60.  
  61.  
  62. DL_IMPORT(PyInterpreterState *) PyInterpreterState_New(void);
  63. DL_IMPORT(void) PyInterpreterState_Clear(PyInterpreterState *);
  64. DL_IMPORT(void) PyInterpreterState_Delete(PyInterpreterState *);
  65.  
  66. DL_IMPORT(PyThreadState *) PyThreadState_New(PyInterpreterState *);
  67. DL_IMPORT(void) PyThreadState_Clear(PyThreadState *);
  68. DL_IMPORT(void) PyThreadState_Delete(PyThreadState *);
  69.  
  70. DL_IMPORT(PyThreadState *) PyThreadState_Get(void);
  71. DL_IMPORT(PyThreadState *) PyThreadState_Swap(PyThreadState *);
  72. DL_IMPORT(PyObject *) PyThreadState_GetDict(void);
  73.  
  74.  
  75. /* Variable and macro for in-line access to current thread state */
  76.  
  77. extern DL_IMPORT(PyThreadState *) _PyThreadState_Current;
  78.  
  79. #ifdef Py_DEBUG
  80. #define PyThreadState_GET() PyThreadState_Get()
  81. #else
  82. #define PyThreadState_GET() (_PyThreadState_Current)
  83. #endif
  84.  
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif /* !Py_PYSTATE_H */
  89.