add Joe
[python.git] / Include / Python.h
blob9e140a5c6496d90d779482f2aa0c12730842773b
1 #ifndef Py_PYTHON_H
2 #define Py_PYTHON_H
3 /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
5 /* Include nearly all Python header files */
7 #include "patchlevel.h"
8 #include "pyconfig.h"
9 #include "pymacconfig.h"
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.
15 #ifndef WITH_CYCLE_GC
16 #define WITH_CYCLE_GC 1
17 #endif
19 #include <limits.h>
21 #ifndef UCHAR_MAX
22 #error "Something's broken. UCHAR_MAX should be defined in limits.h."
23 #endif
25 #if UCHAR_MAX != 255
26 #error "Python's source code assumes C's unsigned char is an 8-bit type."
27 #endif
29 #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
30 #define _SGI_MP_SOURCE
31 #endif
33 #include <stdio.h>
34 #ifndef NULL
35 # error "Python.h requires that stdio.h define NULL."
36 #endif
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
47 /* For size_t? */
48 #ifdef HAVE_STDDEF_H
49 #include <stddef.h>
50 #endif
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.
56 #include <assert.h>
58 #include "pyport.h"
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
68 /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
69 * PYMALLOC_DEBUG is in error if pymalloc is not in use.
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"
80 #include "object.h"
81 #include "objimpl.h"
83 #include "pydebug.h"
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"
119 #include "codecs.h"
120 #include "pyerrors.h"
122 #include "pystate.h"
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"
132 #include "abstract.h"
134 #include "compile.h"
135 #include "eval.h"
137 #include "pyctype.h"
138 #include "pystrtod.h"
139 #include "pystrcmp.h"
141 /* _Py_Mangle is defined in compile.c */
142 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
144 /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */
145 #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
147 /* PyArg_NoArgs should not be necessary.
148 Set ml_flags in the PyMethodDef to METH_NOARGS. */
149 #define PyArg_NoArgs(v) PyArg_Parse(v, "")
151 /* Convert a possibly signed character to a nonnegative int */
152 /* XXX This assumes characters are 8 bits wide */
153 #ifdef __CHAR_UNSIGNED__
154 #define Py_CHARMASK(c) (c)
155 #else
156 #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
157 #endif
159 #include "pyfpe.h"
161 /* These definitions must match corresponding definitions in graminit.h.
162 There's code in compile.c that checks that they are the same. */
163 #define Py_single_input 256
164 #define Py_file_input 257
165 #define Py_eval_input 258
167 #ifdef HAVE_PTH
168 /* GNU pth user-space thread support */
169 #include <pth.h>
170 #endif
172 /* Define macros for inline documentation. */
173 #define PyDoc_VAR(name) static char name[]
174 #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
175 #ifdef WITH_DOC_STRINGS
176 #define PyDoc_STR(str) str
177 #else
178 #define PyDoc_STR(str) ""
179 #endif
181 #endif /* !Py_PYTHON_H */