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 | |
Marc-André Lemburg | 295b1bb | 2000-07-07 11:24:49 +0000 | [diff] [blame] | 6 | /* Enable compiler features; switching on C lib defines doesn't work |
| 7 | here, because the symbols haven't necessarily been defined yet. */ |
Marc-André Lemburg | 82249c8 | 2000-07-05 08:53:18 +0000 | [diff] [blame] | 8 | #ifndef _GNU_SOURCE |
| 9 | # define _GNU_SOURCE 1 |
| 10 | #endif |
Marc-André Lemburg | 295b1bb | 2000-07-07 11:24:49 +0000 | [diff] [blame] | 11 | |
| 12 | /* Forcing SUSv2 compatibility still produces problems on some |
Michael W. Hudson | e5df105 | 2002-05-27 14:05:31 +0000 | [diff] [blame] | 13 | platforms, True64 and SGI IRIX being two of them, so for now the |
Marc-André Lemburg | 295b1bb | 2000-07-07 11:24:49 +0000 | [diff] [blame] | 14 | define is switched off. */ |
| 15 | #if 0 |
Marc-André Lemburg | 82249c8 | 2000-07-05 08:53:18 +0000 | [diff] [blame] | 16 | #ifndef _XOPEN_SOURCE |
| 17 | # define _XOPEN_SOURCE 500 |
| 18 | #endif |
Marc-André Lemburg | 295b1bb | 2000-07-07 11:24:49 +0000 | [diff] [blame] | 19 | #endif |
Marc-André Lemburg | 82249c8 | 2000-07-05 08:53:18 +0000 | [diff] [blame] | 20 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 21 | /* Include nearly all Python header files */ |
| 22 | |
Guido van Rossum | f1176c4 | 1999-01-03 12:40:24 +0000 | [diff] [blame] | 23 | #include "patchlevel.h" |
Martin v. Löwis | 4f1cd8b | 2001-07-26 13:41:06 +0000 | [diff] [blame] | 24 | #include "pyconfig.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 25 | |
Fred Drake | d5fadf7 | 2000-09-26 05:46:01 +0000 | [diff] [blame] | 26 | #ifdef HAVE_LIMITS_H |
| 27 | #include <limits.h> |
| 28 | #endif |
| 29 | |
Guido van Rossum | 90ce848 | 1998-05-26 18:38:07 +0000 | [diff] [blame] | 30 | #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) |
| 31 | #define _SGI_MP_SOURCE |
| 32 | #endif |
| 33 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 34 | #include <stdio.h> |
Tim Peters | 4826a89 | 2000-09-10 01:02:41 +0000 | [diff] [blame] | 35 | #ifndef NULL |
| 36 | # error "Python.h requires that stdio.h define NULL." |
| 37 | #endif |
| 38 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 39 | #include <string.h> |
| 40 | #include <errno.h> |
| 41 | #ifdef HAVE_STDLIB_H |
| 42 | #include <stdlib.h> |
| 43 | #endif |
Martin v. Löwis | cdc4451 | 2002-01-12 11:05:12 +0000 | [diff] [blame] | 44 | #ifdef HAVE_UNISTD_H |
| 45 | #include <unistd.h> |
| 46 | #endif |
Guido van Rossum | b2c075b | 2001-07-15 16:58:05 +0000 | [diff] [blame] | 47 | |
Tim Peters | 5defb17 | 2001-12-04 20:06:11 +0000 | [diff] [blame] | 48 | /* CAUTION: Build setups should ensure that NDEBUG is defined on the |
| 49 | * compiler command line when building Python in release mode; else |
| 50 | * assert() calls won't be removed. |
| 51 | */ |
Tim Peters | 8315ea5 | 2000-07-23 19:28:35 +0000 | [diff] [blame] | 52 | #include <assert.h> |
| 53 | |
Martin v. Löwis | 1e1fcef | 2002-05-15 18:24:06 +0000 | [diff] [blame] | 54 | #include "pyport.h" |
| 55 | |
Jason Tishler | bc48826 | 2002-06-04 15:07:08 +0000 | [diff] [blame] | 56 | /* pyconfig.h or pyport.h may or may not define DL_IMPORT */ |
| 57 | #ifndef DL_IMPORT /* declarations for DLL import/export */ |
| 58 | #define DL_IMPORT(RTYPE) RTYPE |
| 59 | #endif |
| 60 | #ifndef DL_EXPORT /* declarations for DLL import/export */ |
| 61 | #define DL_EXPORT(RTYPE) RTYPE |
| 62 | #endif |
| 63 | |
Tim Peters | ddea208 | 2002-03-23 10:03:50 +0000 | [diff] [blame] | 64 | /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. |
| 65 | * PYMALLOC_DEBUG is in error if pymalloc is not in use. |
| 66 | */ |
| 67 | #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) |
| 68 | #define PYMALLOC_DEBUG |
| 69 | #endif |
| 70 | #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) |
| 71 | #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" |
| 72 | #endif |
Peter Schneider-Kamp | 25f6894 | 2000-07-31 22:19:30 +0000 | [diff] [blame] | 73 | #include "pymem.h" |
| 74 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 75 | #include "object.h" |
| 76 | #include "objimpl.h" |
| 77 | |
| 78 | #include "pydebug.h" |
| 79 | |
Guido van Rossum | 9e896b3 | 2000-04-05 20:11:21 +0000 | [diff] [blame] | 80 | #include "unicodeobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 81 | #include "intobject.h" |
Guido van Rossum | 77f6a65 | 2002-04-03 22:41:51 +0000 | [diff] [blame] | 82 | #include "boolobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 83 | #include "longobject.h" |
| 84 | #include "floatobject.h" |
| 85 | #ifndef WITHOUT_COMPLEX |
| 86 | #include "complexobject.h" |
| 87 | #endif |
| 88 | #include "rangeobject.h" |
| 89 | #include "stringobject.h" |
Guido van Rossum | 2e19bd7 | 1998-10-07 14:36:10 +0000 | [diff] [blame] | 90 | #include "bufferobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 91 | #include "tupleobject.h" |
| 92 | #include "listobject.h" |
Guido van Rossum | 2ec9031 | 1997-05-13 21:23:32 +0000 | [diff] [blame] | 93 | #include "dictobject.h" |
Guido van Rossum | 7dab242 | 2002-04-26 19:40:56 +0000 | [diff] [blame] | 94 | #include "enumobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 95 | #include "methodobject.h" |
| 96 | #include "moduleobject.h" |
| 97 | #include "funcobject.h" |
| 98 | #include "classobject.h" |
| 99 | #include "fileobject.h" |
| 100 | #include "cobject.h" |
| 101 | #include "traceback.h" |
| 102 | #include "sliceobject.h" |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 103 | #include "cellobject.h" |
Guido van Rossum | 59d1d2b | 2001-04-20 19:13:02 +0000 | [diff] [blame] | 104 | #include "iterobject.h" |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 105 | #include "descrobject.h" |
Fred Drake | 19bc578 | 2001-10-05 21:55:19 +0000 | [diff] [blame] | 106 | #include "weakrefobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 107 | |
Guido van Rossum | bd7dfbc | 2000-03-10 22:34:00 +0000 | [diff] [blame] | 108 | #include "codecs.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 109 | #include "pyerrors.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 110 | |
Guido van Rossum | 618af4b | 1997-07-18 23:59:26 +0000 | [diff] [blame] | 111 | #include "pystate.h" |
| 112 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 113 | #include "modsupport.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 114 | #include "pythonrun.h" |
Tim Peters | 5ba5866 | 2001-07-16 02:29:45 +0000 | [diff] [blame] | 115 | #include "ceval.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 116 | #include "sysmodule.h" |
| 117 | #include "intrcheck.h" |
| 118 | #include "import.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 119 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 120 | #include "abstract.h" |
| 121 | |
Neal Norwitz | 1543c07 | 2002-03-25 22:21:58 +0000 | [diff] [blame] | 122 | /* 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] | 123 | #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) |
Neal Norwitz | 3a6f978 | 2002-03-25 20:46:46 +0000 | [diff] [blame] | 124 | |
| 125 | /* PyArg_NoArgs should not be necessary. |
| 126 | Set ml_flags in the PyMethodDef to METH_NOARGS. */ |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 127 | #define PyArg_NoArgs(v) PyArg_Parse(v, "") |
| 128 | |
| 129 | /* Convert a possibly signed character to a nonnegative int */ |
| 130 | /* XXX This assumes characters are 8 bits wide */ |
| 131 | #ifdef __CHAR_UNSIGNED__ |
| 132 | #define Py_CHARMASK(c) (c) |
| 133 | #else |
| 134 | #define Py_CHARMASK(c) ((c) & 0xff) |
| 135 | #endif |
| 136 | |
| 137 | #include "pyfpe.h" |
| 138 | |
Greg Ward | 9581144 | 2000-05-28 20:29:48 +0000 | [diff] [blame] | 139 | /* These definitions must match corresponding definitions in graminit.h. |
Guido van Rossum | b05a5c7 | 1997-05-07 17:46:13 +0000 | [diff] [blame] | 140 | There's code in compile.c that checks that they are the same. */ |
| 141 | #define Py_single_input 256 |
| 142 | #define Py_file_input 257 |
| 143 | #define Py_eval_input 258 |
| 144 | |
Guido van Rossum | 9e8181b | 2000-09-19 00:46:46 +0000 | [diff] [blame] | 145 | #ifdef HAVE_PTH |
Guido van Rossum | 07bd90e | 2000-05-08 13:41:38 +0000 | [diff] [blame] | 146 | /* GNU pth user-space thread support */ |
| 147 | #include <pth.h> |
| 148 | #endif |
Guido van Rossum | d27b4f2 | 1997-05-02 04:00:11 +0000 | [diff] [blame] | 149 | #endif /* !Py_PYTHON_H */ |