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