Guido van Rossum | d27b4f2 | 1997-05-02 04:00:11 +0000 | [diff] [blame] | 1 | #ifndef Py_PYTHON_H |
| 2 | #define Py_PYTHON_H |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 3 | /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ |
| 4 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 5 | /* Include nearly all Python header files */ |
| 6 | |
Guido van Rossum | f1176c4 | 1999-01-03 12:40:24 +0000 | [diff] [blame] | 7 | #include "patchlevel.h" |
Martin v. Löwis | 4f1cd8b | 2001-07-26 13:41:06 +0000 | [diff] [blame] | 8 | #include "pyconfig.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 9 | |
Fred Drake | d5fadf7 | 2000-09-26 05:46:01 +0000 | [diff] [blame] | 10 | #include <limits.h> |
Fred Drake | d5fadf7 | 2000-09-26 05:46:01 +0000 | [diff] [blame] | 11 | |
Skip Montanaro | ac4ea13 | 2003-12-22 16:31:41 +0000 | [diff] [blame] | 12 | #ifndef UCHAR_MAX |
| 13 | #error "Something's broken. UCHAR_MAX should be defined in limits.h." |
| 14 | #endif |
| 15 | |
| 16 | #if UCHAR_MAX != 255 |
Tim Peters | 0490fe9 | 2003-12-22 18:10:51 +0000 | [diff] [blame] | 17 | #error "Python's source code assumes C's unsigned char is an 8-bit type." |
Skip Montanaro | ac4ea13 | 2003-12-22 16:31:41 +0000 | [diff] [blame] | 18 | #endif |
| 19 | |
Guido van Rossum | 90ce848 | 1998-05-26 18:38:07 +0000 | [diff] [blame] | 20 | #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) |
| 21 | #define _SGI_MP_SOURCE |
| 22 | #endif |
| 23 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 24 | #include <stdio.h> |
Tim Peters | 4826a89 | 2000-09-10 01:02:41 +0000 | [diff] [blame] | 25 | #ifndef NULL |
| 26 | # error "Python.h requires that stdio.h define NULL." |
| 27 | #endif |
| 28 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 29 | #include <string.h> |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 30 | #ifdef HAVE_ERRNO_H |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 31 | #include <errno.h> |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 32 | #endif |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 33 | #include <stdlib.h> |
Martin v. Löwis | cdc4451 | 2002-01-12 11:05:12 +0000 | [diff] [blame] | 34 | #ifdef HAVE_UNISTD_H |
| 35 | #include <unistd.h> |
| 36 | #endif |
Guido van Rossum | b2c075b | 2001-07-15 16:58:05 +0000 | [diff] [blame] | 37 | |
Martin v. Löwis | fe393f4 | 2004-07-27 15:57:24 +0000 | [diff] [blame] | 38 | /* For uintptr_t, intptr_t */ |
| 39 | #ifdef HAVE_STDDEF_H |
| 40 | #include <stddef.h> |
| 41 | #endif |
| 42 | |
Tim Peters | 5defb17 | 2001-12-04 20:06:11 +0000 | [diff] [blame] | 43 | /* CAUTION: Build setups should ensure that NDEBUG is defined on the |
| 44 | * compiler command line when building Python in release mode; else |
| 45 | * assert() calls won't be removed. |
| 46 | */ |
Tim Peters | 8315ea5 | 2000-07-23 19:28:35 +0000 | [diff] [blame] | 47 | #include <assert.h> |
| 48 | |
Martin v. Löwis | 1e1fcef | 2002-05-15 18:24:06 +0000 | [diff] [blame] | 49 | #include "pyport.h" |
| 50 | |
Tim Peters | ddea208 | 2002-03-23 10:03:50 +0000 | [diff] [blame] | 51 | /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. |
| 52 | * PYMALLOC_DEBUG is in error if pymalloc is not in use. |
| 53 | */ |
| 54 | #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) |
| 55 | #define PYMALLOC_DEBUG |
| 56 | #endif |
| 57 | #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) |
| 58 | #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" |
| 59 | #endif |
Peter Schneider-Kamp | 25f6894 | 2000-07-31 22:19:30 +0000 | [diff] [blame] | 60 | #include "pymem.h" |
| 61 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 62 | #include "object.h" |
| 63 | #include "objimpl.h" |
| 64 | |
| 65 | #include "pydebug.h" |
| 66 | |
Guido van Rossum | 4dfe8a1 | 2006-04-22 23:28:04 +0000 | [diff] [blame] | 67 | #include "bytesobject.h" |
Guido van Rossum | 9e896b3 | 2000-04-05 20:11:21 +0000 | [diff] [blame] | 68 | #include "unicodeobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 69 | #include "intobject.h" |
Guido van Rossum | 77f6a65 | 2002-04-03 22:41:51 +0000 | [diff] [blame] | 70 | #include "boolobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 71 | #include "longobject.h" |
| 72 | #include "floatobject.h" |
| 73 | #ifndef WITHOUT_COMPLEX |
| 74 | #include "complexobject.h" |
| 75 | #endif |
| 76 | #include "rangeobject.h" |
| 77 | #include "stringobject.h" |
Guido van Rossum | 2e19bd7 | 1998-10-07 14:36:10 +0000 | [diff] [blame] | 78 | #include "bufferobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 79 | #include "tupleobject.h" |
| 80 | #include "listobject.h" |
Guido van Rossum | 2ec9031 | 1997-05-13 21:23:32 +0000 | [diff] [blame] | 81 | #include "dictobject.h" |
Guido van Rossum | 7dab242 | 2002-04-26 19:40:56 +0000 | [diff] [blame] | 82 | #include "enumobject.h" |
Raymond Hettinger | a690a99 | 2003-11-16 16:17:49 +0000 | [diff] [blame] | 83 | #include "setobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 84 | #include "methodobject.h" |
| 85 | #include "moduleobject.h" |
| 86 | #include "funcobject.h" |
| 87 | #include "classobject.h" |
| 88 | #include "fileobject.h" |
| 89 | #include "cobject.h" |
| 90 | #include "traceback.h" |
| 91 | #include "sliceobject.h" |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 92 | #include "cellobject.h" |
Guido van Rossum | 59d1d2b | 2001-04-20 19:13:02 +0000 | [diff] [blame] | 93 | #include "iterobject.h" |
Martin v. Löwis | 8d97e33 | 2004-06-27 15:43:12 +0000 | [diff] [blame] | 94 | #include "genobject.h" |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 95 | #include "descrobject.h" |
Fred Drake | 19bc578 | 2001-10-05 21:55:19 +0000 | [diff] [blame] | 96 | #include "weakrefobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 97 | |
Guido van Rossum | bd7dfbc | 2000-03-10 22:34:00 +0000 | [diff] [blame] | 98 | #include "codecs.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 99 | #include "pyerrors.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 100 | |
Guido van Rossum | 618af4b | 1997-07-18 23:59:26 +0000 | [diff] [blame] | 101 | #include "pystate.h" |
| 102 | |
Neal Norwitz | adb69fc | 2005-12-17 20:54:49 +0000 | [diff] [blame] | 103 | #include "pyarena.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 104 | #include "modsupport.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 105 | #include "pythonrun.h" |
Tim Peters | 5ba5866 | 2001-07-16 02:29:45 +0000 | [diff] [blame] | 106 | #include "ceval.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 107 | #include "sysmodule.h" |
| 108 | #include "intrcheck.h" |
| 109 | #include "import.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 110 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 111 | #include "abstract.h" |
| 112 | |
Skip Montanaro | 6e098a1 | 2004-03-13 23:11:44 +0000 | [diff] [blame] | 113 | #include "compile.h" |
| 114 | #include "eval.h" |
| 115 | |
Martin v. Löwis | 737ea82 | 2004-06-08 18:52:54 +0000 | [diff] [blame] | 116 | #include "pystrtod.h" |
| 117 | |
Raymond Hettinger | 0ae0c07 | 2002-06-20 22:23:15 +0000 | [diff] [blame] | 118 | /* _Py_Mangle is defined in compile.c */ |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 119 | PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); |
Raymond Hettinger | 0ae0c07 | 2002-06-20 22:23:15 +0000 | [diff] [blame] | 120 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 121 | /* Convert a possibly signed character to a nonnegative int */ |
| 122 | /* XXX This assumes characters are 8 bits wide */ |
| 123 | #ifdef __CHAR_UNSIGNED__ |
| 124 | #define Py_CHARMASK(c) (c) |
| 125 | #else |
| 126 | #define Py_CHARMASK(c) ((c) & 0xff) |
| 127 | #endif |
| 128 | |
| 129 | #include "pyfpe.h" |
| 130 | |
Greg Ward | 9581144 | 2000-05-28 20:29:48 +0000 | [diff] [blame] | 131 | /* These definitions must match corresponding definitions in graminit.h. |
Guido van Rossum | b05a5c7 | 1997-05-07 17:46:13 +0000 | [diff] [blame] | 132 | There's code in compile.c that checks that they are the same. */ |
| 133 | #define Py_single_input 256 |
| 134 | #define Py_file_input 257 |
| 135 | #define Py_eval_input 258 |
| 136 | |
Guido van Rossum | 9e8181b | 2000-09-19 00:46:46 +0000 | [diff] [blame] | 137 | #ifdef HAVE_PTH |
Guido van Rossum | 07bd90e | 2000-05-08 13:41:38 +0000 | [diff] [blame] | 138 | /* GNU pth user-space thread support */ |
| 139 | #include <pth.h> |
| 140 | #endif |
Martin v. Löwis | a3fb4f7 | 2002-06-09 13:33:54 +0000 | [diff] [blame] | 141 | |
| 142 | /* Define macros for inline documentation. */ |
| 143 | #define PyDoc_VAR(name) static char name[] |
| 144 | #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) |
| 145 | #ifdef WITH_DOC_STRINGS |
| 146 | #define PyDoc_STR(str) str |
| 147 | #else |
| 148 | #define PyDoc_STR(str) "" |
| 149 | #endif |
| 150 | |
Guido van Rossum | d27b4f2 | 1997-05-02 04:00:11 +0000 | [diff] [blame] | 151 | #endif /* !Py_PYTHON_H */ |