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