| 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 | #include <errno.h> |
| 39 | #include <stdlib.h> |
| 40 | #ifdef HAVE_UNISTD_H |
| 41 | #include <unistd.h> |
| 42 | #endif |
| 43 | |
| 44 | /* For uintptr_t, intptr_t */ |
| 45 | #ifdef HAVE_STDDEF_H |
| 46 | #include <stddef.h> |
| 47 | #endif |
| 48 | |
| 49 | /* CAUTION: Build setups should ensure that NDEBUG is defined on the |
| 50 | * compiler command line when building Python in release mode; else |
| 51 | * assert() calls won't be removed. |
| 52 | */ |
| 53 | #include <assert.h> |
| 54 | |
| 55 | #include "pyport.h" |
| 56 | |
| 57 | /* pyconfig.h or pyport.h may or may not define DL_IMPORT */ |
| 58 | #ifndef DL_IMPORT /* declarations for DLL import/export */ |
| 59 | #define DL_IMPORT(RTYPE) RTYPE |
| 60 | #endif |
| 61 | #ifndef DL_EXPORT /* declarations for DLL import/export */ |
| 62 | #define DL_EXPORT(RTYPE) RTYPE |
| 63 | #endif |
| 64 | |
| 65 | /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. |
| 66 | * PYMALLOC_DEBUG is in error if pymalloc is not in use. |
| 67 | */ |
| 68 | #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) |
| 69 | #define PYMALLOC_DEBUG |
| 70 | #endif |
| 71 | #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) |
| 72 | #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" |
| 73 | #endif |
| 74 | #include "pymem.h" |
| 75 | |
| 76 | #include "object.h" |
| 77 | #include "objimpl.h" |
| 78 | |
| 79 | #include "pydebug.h" |
| 80 | |
| 81 | #include "unicodeobject.h" |
| 82 | #include "intobject.h" |
| 83 | #include "boolobject.h" |
| 84 | #include "longobject.h" |
| 85 | #include "floatobject.h" |
| 86 | #ifndef WITHOUT_COMPLEX |
| 87 | #include "complexobject.h" |
| 88 | #endif |
| 89 | #include "rangeobject.h" |
| 90 | #include "stringobject.h" |
| 91 | #include "bufferobject.h" |
| 92 | #include "tupleobject.h" |
| 93 | #include "listobject.h" |
| 94 | #include "dictobject.h" |
| 95 | #include "enumobject.h" |
| 96 | #include "setobject.h" |
| 97 | #include "methodobject.h" |
| 98 | #include "moduleobject.h" |
| 99 | #include "funcobject.h" |
| 100 | #include "classobject.h" |
| 101 | #include "fileobject.h" |
| 102 | #include "cobject.h" |
| 103 | #include "traceback.h" |
| 104 | #include "sliceobject.h" |
| 105 | #include "cellobject.h" |
| 106 | #include "iterobject.h" |
| 107 | #include "genobject.h" |
| 108 | #include "descrobject.h" |
| 109 | #include "weakrefobject.h" |
| 110 | |
| 111 | #include "codecs.h" |
| 112 | #include "pyerrors.h" |
| 113 | |
| 114 | #include "pystate.h" |
| 115 | |
| 116 | #include "modsupport.h" |
| 117 | #include "pythonrun.h" |
| 118 | #include "ceval.h" |
| 119 | #include "sysmodule.h" |
| 120 | #include "intrcheck.h" |
| 121 | #include "import.h" |
| 122 | |
| 123 | #include "abstract.h" |
| 124 | |
| 125 | #include "compile.h" |
| 126 | #include "eval.h" |
| 127 | |
| 128 | #include "pystrtod.h" |
| 129 | |
| 130 | /* _Py_Mangle is defined in compile.c */ |
| 131 | PyAPI_FUNC(int) _Py_Mangle(char *p, char *name, \ |
| 132 | char *buffer, size_t maxlen); |
| 133 | |
| 134 | /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ |
| 135 | #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) |
| 136 | |
| 137 | /* PyArg_NoArgs should not be necessary. |
| 138 | Set ml_flags in the PyMethodDef to METH_NOARGS. */ |
| 139 | #define PyArg_NoArgs(v) PyArg_Parse(v, "") |
| 140 | |
| 141 | /* Convert a possibly signed character to a nonnegative int */ |
| 142 | /* XXX This assumes characters are 8 bits wide */ |
| 143 | #ifdef __CHAR_UNSIGNED__ |
| 144 | #define Py_CHARMASK(c) (c) |
| 145 | #else |
| 146 | #define Py_CHARMASK(c) ((c) & 0xff) |
| 147 | #endif |
| 148 | |
| 149 | #include "pyfpe.h" |
| 150 | |
| 151 | /* These definitions must match corresponding definitions in graminit.h. |
| 152 | There's code in compile.c that checks that they are the same. */ |
| 153 | #define Py_single_input 256 |
| 154 | #define Py_file_input 257 |
| 155 | #define Py_eval_input 258 |
| 156 | |
| 157 | #ifdef HAVE_PTH |
| 158 | /* GNU pth user-space thread support */ |
| 159 | #include <pth.h> |
| 160 | #endif |
| 161 | |
| 162 | /* Define macros for inline documentation. */ |
| 163 | #define PyDoc_VAR(name) static char name[] |
| 164 | #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) |
| 165 | #ifdef WITH_DOC_STRINGS |
| 166 | #define PyDoc_STR(str) str |
| 167 | #else |
| 168 | #define PyDoc_STR(str) "" |
| 169 | #endif |
| 170 | |
| 171 | #endif /* !Py_PYTHON_H */ |