Back to index

python3.2  3.2.2
Python.h
Go to the documentation of this file.
00001 #ifndef Py_PYTHON_H
00002 #define Py_PYTHON_H
00003 /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
00004 
00005 /* Include nearly all Python header files */
00006 
00007 #include "patchlevel.h"
00008 #include "pyconfig.h"
00009 #include "pymacconfig.h"
00010 
00011 #include <limits.h>
00012 
00013 #ifndef UCHAR_MAX
00014 #error "Something's broken.  UCHAR_MAX should be defined in limits.h."
00015 #endif
00016 
00017 #if UCHAR_MAX != 255
00018 #error "Python's source code assumes C's unsigned char is an 8-bit type."
00019 #endif
00020 
00021 #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
00022 #define _SGI_MP_SOURCE
00023 #endif
00024 
00025 #include <stdio.h>
00026 #ifndef NULL
00027 #   error "Python.h requires that stdio.h define NULL."
00028 #endif
00029 
00030 #include <string.h>
00031 #ifdef HAVE_ERRNO_H
00032 #include <errno.h>
00033 #endif
00034 #include <stdlib.h>
00035 #ifdef HAVE_UNISTD_H
00036 #include <unistd.h>
00037 #endif
00038 
00039 /* For size_t? */
00040 #ifdef HAVE_STDDEF_H
00041 #include <stddef.h>
00042 #endif
00043 
00044 /* CAUTION:  Build setups should ensure that NDEBUG is defined on the
00045  * compiler command line when building Python in release mode; else
00046  * assert() calls won't be removed.
00047  */
00048 #include <assert.h>
00049 
00050 #include "pyport.h"
00051 
00052 #include "pyatomic.h"
00053 
00054 /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
00055  *  PYMALLOC_DEBUG is in error if pymalloc is not in use.
00056  */
00057 #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
00058 #define PYMALLOC_DEBUG
00059 #endif
00060 #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
00061 #error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
00062 #endif
00063 #include "pymath.h"
00064 #include "pytime.h"
00065 #include "pymem.h"
00066 
00067 #include "object.h"
00068 #include "objimpl.h"
00069 #include "typeslots.h"
00070 
00071 #include "pydebug.h"
00072 
00073 #include "bytearrayobject.h"
00074 #include "bytesobject.h"
00075 #include "unicodeobject.h"
00076 #include "longobject.h"
00077 #include "longintrepr.h"
00078 #include "boolobject.h"
00079 #include "floatobject.h"
00080 #include "complexobject.h"
00081 #include "rangeobject.h"
00082 #include "memoryobject.h"
00083 #include "tupleobject.h"
00084 #include "listobject.h"
00085 #include "dictobject.h"
00086 #include "enumobject.h"
00087 #include "setobject.h"
00088 #include "methodobject.h"
00089 #include "moduleobject.h"
00090 #include "funcobject.h"
00091 #include "classobject.h"
00092 #include "fileobject.h"
00093 #include "pycapsule.h"
00094 #include "traceback.h"
00095 #include "sliceobject.h"
00096 #include "cellobject.h"
00097 #include "iterobject.h"
00098 #include "genobject.h"
00099 #include "descrobject.h"
00100 #include "warnings.h"
00101 #include "weakrefobject.h"
00102 #include "structseq.h"
00103 
00104 
00105 #include "codecs.h"
00106 #include "pyerrors.h"
00107 
00108 #include "pystate.h"
00109 
00110 #include "pyarena.h"
00111 #include "modsupport.h"
00112 #include "pythonrun.h"
00113 #include "ceval.h"
00114 #include "sysmodule.h"
00115 #include "intrcheck.h"
00116 #include "import.h"
00117 
00118 #include "abstract.h"
00119 #include "bltinmodule.h"
00120 
00121 #include "compile.h"
00122 #include "eval.h"
00123 
00124 #include "pyctype.h"
00125 #include "pystrtod.h"
00126 #include "pystrcmp.h"
00127 #include "dtoa.h"
00128 #include "fileutils.h"
00129 
00130 #ifdef __cplusplus
00131 extern "C" {
00132 #endif
00133 
00134 /* _Py_Mangle is defined in compile.c */
00135 #ifndef Py_LIMITED_API
00136 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
00137 #endif
00138 
00139 #ifdef __cplusplus
00140 }
00141 #endif
00142 
00143 /* Argument must be a char or an int in [-128, 127] or [0, 255]. */
00144 #define Py_CHARMASK(c)             ((unsigned char)((c) & 0xff))
00145 
00146 #include "pyfpe.h"
00147 
00148 /* These definitions must match corresponding definitions in graminit.h.
00149    There's code in compile.c that checks that they are the same. */
00150 #define Py_single_input 256
00151 #define Py_file_input 257
00152 #define Py_eval_input 258
00153 
00154 #ifdef HAVE_PTH
00155 /* GNU pth user-space thread support */
00156 #include <pth.h>
00157 #endif
00158 
00159 /* Define macros for inline documentation. */
00160 #define PyDoc_VAR(name) static char name[]
00161 #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
00162 #ifdef WITH_DOC_STRINGS
00163 #define PyDoc_STR(str) str
00164 #else
00165 #define PyDoc_STR(str) ""
00166 #endif
00167 
00168 #endif /* !Py_PYTHON_H */