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 |
| 13 | platforms, True64 and SGI IRIX begin two of them, so for now the |
| 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 | |
Tim Peters | 76f373d | 2001-07-26 21:34:59 +0000 | [diff] [blame] | 30 | /* pyconfig.h may or may not define DL_IMPORT */ |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 31 | #ifndef DL_IMPORT /* declarations for DLL import/export */ |
| 32 | #define DL_IMPORT(RTYPE) RTYPE |
| 33 | #endif |
Guido van Rossum | 43466ec | 1998-12-04 18:48:25 +0000 | [diff] [blame] | 34 | #ifndef DL_EXPORT /* declarations for DLL import/export */ |
| 35 | #define DL_EXPORT(RTYPE) RTYPE |
| 36 | #endif |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 37 | |
Guido van Rossum | 90ce848 | 1998-05-26 18:38:07 +0000 | [diff] [blame] | 38 | #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) |
| 39 | #define _SGI_MP_SOURCE |
| 40 | #endif |
| 41 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 42 | #include <stdio.h> |
Tim Peters | 4826a89 | 2000-09-10 01:02:41 +0000 | [diff] [blame] | 43 | #ifndef NULL |
| 44 | # error "Python.h requires that stdio.h define NULL." |
| 45 | #endif |
| 46 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 47 | #include <string.h> |
| 48 | #include <errno.h> |
| 49 | #ifdef HAVE_STDLIB_H |
| 50 | #include <stdlib.h> |
| 51 | #endif |
Martin v. Löwis | cdc4451 | 2002-01-12 11:05:12 +0000 | [diff] [blame] | 52 | #ifdef HAVE_UNISTD_H |
| 53 | #include <unistd.h> |
| 54 | #endif |
Guido van Rossum | b2c075b | 2001-07-15 16:58:05 +0000 | [diff] [blame] | 55 | |
Tim Peters | 5defb17 | 2001-12-04 20:06:11 +0000 | [diff] [blame] | 56 | /* CAUTION: Build setups should ensure that NDEBUG is defined on the |
| 57 | * compiler command line when building Python in release mode; else |
| 58 | * assert() calls won't be removed. |
| 59 | */ |
Tim Peters | 8315ea5 | 2000-07-23 19:28:35 +0000 | [diff] [blame] | 60 | #include <assert.h> |
| 61 | |
| 62 | #include "pyport.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 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" |
| 82 | #include "longobject.h" |
| 83 | #include "floatobject.h" |
| 84 | #ifndef WITHOUT_COMPLEX |
| 85 | #include "complexobject.h" |
| 86 | #endif |
| 87 | #include "rangeobject.h" |
| 88 | #include "stringobject.h" |
Guido van Rossum | 2e19bd7 | 1998-10-07 14:36:10 +0000 | [diff] [blame] | 89 | #include "bufferobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 90 | #include "tupleobject.h" |
| 91 | #include "listobject.h" |
Guido van Rossum | 2ec9031 | 1997-05-13 21:23:32 +0000 | [diff] [blame] | 92 | #include "dictobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 93 | #include "methodobject.h" |
| 94 | #include "moduleobject.h" |
| 95 | #include "funcobject.h" |
| 96 | #include "classobject.h" |
| 97 | #include "fileobject.h" |
| 98 | #include "cobject.h" |
| 99 | #include "traceback.h" |
| 100 | #include "sliceobject.h" |
Jeremy Hylton | fbd849f | 2001-01-25 20:04:14 +0000 | [diff] [blame] | 101 | #include "cellobject.h" |
Guido van Rossum | 59d1d2b | 2001-04-20 19:13:02 +0000 | [diff] [blame] | 102 | #include "iterobject.h" |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 103 | #include "descrobject.h" |
Fred Drake | 19bc578 | 2001-10-05 21:55:19 +0000 | [diff] [blame] | 104 | #include "weakrefobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 105 | |
Guido van Rossum | bd7dfbc | 2000-03-10 22:34:00 +0000 | [diff] [blame] | 106 | #include "codecs.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 107 | #include "pyerrors.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 108 | |
Guido van Rossum | 618af4b | 1997-07-18 23:59:26 +0000 | [diff] [blame] | 109 | #include "pystate.h" |
| 110 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 111 | #include "modsupport.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 112 | #include "pythonrun.h" |
Tim Peters | 5ba5866 | 2001-07-16 02:29:45 +0000 | [diff] [blame] | 113 | #include "ceval.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 114 | #include "sysmodule.h" |
| 115 | #include "intrcheck.h" |
| 116 | #include "import.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 117 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 118 | #include "abstract.h" |
| 119 | |
Neal Norwitz | 1543c07 | 2002-03-25 22:21:58 +0000 | [diff] [blame] | 120 | /* 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] | 121 | #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) |
Neal Norwitz | 3a6f978 | 2002-03-25 20:46:46 +0000 | [diff] [blame] | 122 | |
| 123 | /* PyArg_NoArgs should not be necessary. |
| 124 | Set ml_flags in the PyMethodDef to METH_NOARGS. */ |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 125 | #define PyArg_NoArgs(v) PyArg_Parse(v, "") |
| 126 | |
| 127 | /* Convert a possibly signed character to a nonnegative int */ |
| 128 | /* XXX This assumes characters are 8 bits wide */ |
| 129 | #ifdef __CHAR_UNSIGNED__ |
| 130 | #define Py_CHARMASK(c) (c) |
| 131 | #else |
| 132 | #define Py_CHARMASK(c) ((c) & 0xff) |
| 133 | #endif |
| 134 | |
| 135 | #include "pyfpe.h" |
| 136 | |
Greg Ward | 9581144 | 2000-05-28 20:29:48 +0000 | [diff] [blame] | 137 | /* These definitions must match corresponding definitions in graminit.h. |
Guido van Rossum | b05a5c7 | 1997-05-07 17:46:13 +0000 | [diff] [blame] | 138 | There's code in compile.c that checks that they are the same. */ |
| 139 | #define Py_single_input 256 |
| 140 | #define Py_file_input 257 |
| 141 | #define Py_eval_input 258 |
| 142 | |
Guido van Rossum | 9e8181b | 2000-09-19 00:46:46 +0000 | [diff] [blame] | 143 | #ifdef HAVE_PTH |
Guido van Rossum | 07bd90e | 2000-05-08 13:41:38 +0000 | [diff] [blame] | 144 | /* GNU pth user-space thread support */ |
| 145 | #include <pth.h> |
| 146 | #endif |
Guido van Rossum | d27b4f2 | 1997-05-02 04:00:11 +0000 | [diff] [blame] | 147 | #endif /* !Py_PYTHON_H */ |