Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / include / python2.4 / ceval.h
CommitLineData
920dae64
AT
1#ifndef Py_CEVAL_H
2#define Py_CEVAL_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7
8/* Interface to random parts in ceval.c */
9
10PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
11 PyObject *, PyObject *, PyObject *);
12
13/* DLL-level Backwards compatibility: */
14#undef PyEval_CallObject
15PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
16
17/* Inline this */
18#define PyEval_CallObject(func,arg) \
19 PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
20
21PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...);
22PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
23 char *methodname, char *format, ...);
24
25PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
26PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
27
28struct _frame; /* Avoid including frameobject.h */
29
30PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
31PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
32PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
33PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void);
34PyAPI_FUNC(int) PyEval_GetRestricted(void);
35
36/* Look at the current frame's (if any) code's co_flags, and turn on
37 the corresponding compiler flags in cf->cf_flags. Return 1 if any
38 flag was set, else return 0. */
39PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
40
41PyAPI_FUNC(int) Py_FlushLine(void);
42
43PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
44PyAPI_FUNC(int) Py_MakePendingCalls(void);
45
46/* Protection against deeply nested recursive calls */
47PyAPI_FUNC(void) Py_SetRecursionLimit(int);
48PyAPI_FUNC(int) Py_GetRecursionLimit(void);
49
50#define Py_EnterRecursiveCall(where) \
51 (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
52 _Py_CheckRecursiveCall(where))
53#define Py_LeaveRecursiveCall() \
54 (--PyThreadState_GET()->recursion_depth)
55PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where);
56PyAPI_DATA(int) _Py_CheckRecursionLimit;
57#ifdef USE_STACKCHECK
58# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit)
59#else
60# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
61#endif
62
63PyAPI_FUNC(char *) PyEval_GetFuncName(PyObject *);
64PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *);
65
66PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
67PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
68
69/* this used to be handled on a per-thread basis - now just two globals */
70PyAPI_DATA(volatile int) _Py_Ticker;
71PyAPI_DATA(int) _Py_CheckInterval;
72
73/* Interface for threads.
74
75 A module that plans to do a blocking system call (or something else
76 that lasts a long time and doesn't touch Python data) can allow other
77 threads to run as follows:
78
79 ...preparations here...
80 Py_BEGIN_ALLOW_THREADS
81 ...blocking system call here...
82 Py_END_ALLOW_THREADS
83 ...interpret result here...
84
85 The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a
86 {}-surrounded block.
87 To leave the block in the middle (e.g., with return), you must insert
88 a line containing Py_BLOCK_THREADS before the return, e.g.
89
90 if (...premature_exit...) {
91 Py_BLOCK_THREADS
92 PyErr_SetFromErrno(PyExc_IOError);
93 return NULL;
94 }
95
96 An alternative is:
97
98 Py_BLOCK_THREADS
99 if (...premature_exit...) {
100 PyErr_SetFromErrno(PyExc_IOError);
101 return NULL;
102 }
103 Py_UNBLOCK_THREADS
104
105 For convenience, that the value of 'errno' is restored across
106 Py_END_ALLOW_THREADS and Py_BLOCK_THREADS.
107
108 WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND
109 Py_END_ALLOW_THREADS!!!
110
111 The function PyEval_InitThreads() should be called only from
112 initthread() in "threadmodule.c".
113
114 Note that not yet all candidates have been converted to use this
115 mechanism!
116*/
117
118PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
119PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
120
121#ifdef WITH_THREAD
122
123PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
124PyAPI_FUNC(void) PyEval_InitThreads(void);
125PyAPI_FUNC(void) PyEval_AcquireLock(void);
126PyAPI_FUNC(void) PyEval_ReleaseLock(void);
127PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
128PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
129PyAPI_FUNC(void) PyEval_ReInitThreads(void);
130
131#define Py_BEGIN_ALLOW_THREADS { \
132 PyThreadState *_save; \
133 _save = PyEval_SaveThread();
134#define Py_BLOCK_THREADS PyEval_RestoreThread(_save);
135#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread();
136#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \
137 }
138
139#else /* !WITH_THREAD */
140
141#define Py_BEGIN_ALLOW_THREADS {
142#define Py_BLOCK_THREADS
143#define Py_UNBLOCK_THREADS
144#define Py_END_ALLOW_THREADS }
145
146#endif /* !WITH_THREAD */
147
148PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, int *);
149
150
151#ifdef __cplusplus
152}
153#endif
154#endif /* !Py_CEVAL_H */