|
1 #ifndef Py_PYTHON_H |
|
2 #define Py_PYTHON_H |
|
3 /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ |
|
4 |
|
5 /* Include nearly all Python header files */ |
|
6 |
|
7 #include "patchlevel.h" |
|
8 #include "pyconfig.h" |
|
9 |
|
10 /* Cyclic gc is always enabled, starting with release 2.3a1. Supply the |
|
11 * old symbol for the benefit of extension modules written before then |
|
12 * that may be conditionalizing on it. The core doesn't use it anymore. |
|
13 */ |
|
14 #ifndef WITH_CYCLE_GC |
|
15 #define WITH_CYCLE_GC 1 |
|
16 #endif |
|
17 |
|
18 #include <limits.h> |
|
19 |
|
20 #ifndef UCHAR_MAX |
|
21 #error "Something's broken. UCHAR_MAX should be defined in limits.h." |
|
22 #endif |
|
23 |
|
24 #if UCHAR_MAX != 255 |
|
25 #error "Python's source code assumes C's unsigned char is an 8-bit type." |
|
26 #endif |
|
27 |
|
28 #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) |
|
29 #define _SGI_MP_SOURCE |
|
30 #endif |
|
31 |
|
32 #include <stdio.h> |
|
33 #ifndef NULL |
|
34 # error "Python.h requires that stdio.h define NULL." |
|
35 #endif |
|
36 |
|
37 #include <string.h> |
|
38 #ifdef HAVE_ERRNO_H |
|
39 #include <errno.h> |
|
40 #endif |
|
41 #include <stdlib.h> |
|
42 #ifdef HAVE_UNISTD_H |
|
43 #include <unistd.h> |
|
44 #endif |
|
45 |
|
46 /* For uintptr_t, intptr_t */ |
|
47 #ifdef HAVE_STDDEF_H |
|
48 #include <stddef.h> |
|
49 #endif |
|
50 |
|
51 /* CAUTION: Build setups should ensure that NDEBUG is defined on the |
|
52 * compiler command line when building Python in release mode; else |
|
53 * assert() calls won't be removed. |
|
54 */ |
|
55 #include <assert.h> |
|
56 |
|
57 #include "pyport.h" |
|
58 |
|
59 /* pyconfig.h or pyport.h may or may not define DL_IMPORT */ |
|
60 #ifndef DL_IMPORT /* declarations for DLL import/export */ |
|
61 #define DL_IMPORT(RTYPE) RTYPE |
|
62 #endif |
|
63 #ifndef DL_EXPORT /* declarations for DLL import/export */ |
|
64 #define DL_EXPORT(RTYPE) RTYPE |
|
65 #endif |
|
66 |
|
67 /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. |
|
68 * PYMALLOC_DEBUG is in error if pymalloc is not in use. |
|
69 */ |
|
70 #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) |
|
71 #define PYMALLOC_DEBUG |
|
72 #endif |
|
73 #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) |
|
74 #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" |
|
75 #endif |
|
76 #include "pymem.h" |
|
77 |
|
78 #include "object.h" |
|
79 #include "objimpl.h" |
|
80 |
|
81 #include "pydebug.h" |
|
82 |
|
83 #include "unicodeobject.h" |
|
84 #include "intobject.h" |
|
85 #include "boolobject.h" |
|
86 #include "longobject.h" |
|
87 #include "floatobject.h" |
|
88 #ifndef WITHOUT_COMPLEX |
|
89 #include "complexobject.h" |
|
90 #endif |
|
91 #include "rangeobject.h" |
|
92 #include "stringobject.h" |
|
93 #include "bufferobject.h" |
|
94 #include "tupleobject.h" |
|
95 #include "listobject.h" |
|
96 #include "dictobject.h" |
|
97 #include "enumobject.h" |
|
98 #include "setobject.h" |
|
99 #include "methodobject.h" |
|
100 #include "moduleobject.h" |
|
101 #include "funcobject.h" |
|
102 #include "classobject.h" |
|
103 #include "fileobject.h" |
|
104 #include "cobject.h" |
|
105 #include "traceback.h" |
|
106 #include "sliceobject.h" |
|
107 #include "cellobject.h" |
|
108 #include "iterobject.h" |
|
109 #include "genobject.h" |
|
110 #include "descrobject.h" |
|
111 #include "weakrefobject.h" |
|
112 |
|
113 #include "codecs.h" |
|
114 #include "pyerrors.h" |
|
115 |
|
116 #include "pystate.h" |
|
117 |
|
118 #include "pyarena.h" |
|
119 #include "modsupport.h" |
|
120 #include "pythonrun.h" |
|
121 #include "ceval.h" |
|
122 #include "sysmodule.h" |
|
123 #include "intrcheck.h" |
|
124 #include "import.h" |
|
125 |
|
126 #include "abstract.h" |
|
127 |
|
128 #include "compile.h" |
|
129 #include "eval.h" |
|
130 |
|
131 #include "pystrtod.h" |
|
132 |
|
133 /* _Py_Mangle is defined in compile.c */ |
|
134 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); |
|
135 |
|
136 /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ |
|
137 #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) |
|
138 |
|
139 /* PyArg_NoArgs should not be necessary. |
|
140 Set ml_flags in the PyMethodDef to METH_NOARGS. */ |
|
141 #define PyArg_NoArgs(v) PyArg_Parse(v, "") |
|
142 |
|
143 /* Convert a possibly signed character to a nonnegative int */ |
|
144 /* XXX This assumes characters are 8 bits wide */ |
|
145 #ifdef __CHAR_UNSIGNED__ |
|
146 #define Py_CHARMASK(c) (c) |
|
147 #else |
|
148 #define Py_CHARMASK(c) ((c) & 0xff) |
|
149 #endif |
|
150 |
|
151 #include "pyfpe.h" |
|
152 |
|
153 /* These definitions must match corresponding definitions in graminit.h. |
|
154 There's code in compile.c that checks that they are the same. */ |
|
155 #define Py_single_input 256 |
|
156 #define Py_file_input 257 |
|
157 #define Py_eval_input 258 |
|
158 |
|
159 #ifdef HAVE_PTH |
|
160 /* GNU pth user-space thread support */ |
|
161 #include <pth.h> |
|
162 #endif |
|
163 |
|
164 /* Define macros for inline documentation. */ |
|
165 #define PyDoc_VAR(name) static char name[] |
|
166 #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) |
|
167 #ifdef WITH_DOC_STRINGS |
|
168 #define PyDoc_STR(str) str |
|
169 #else |
|
170 #define PyDoc_STR(str) "" |
|
171 #endif |
|
172 |
|
173 #endif /* !Py_PYTHON_H */ |