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 | |
Peter Schneider-Kamp | 25f6894 | 2000-07-31 22:19:30 +0000 | [diff] [blame] | 64 | #include "pymem.h" |
| 65 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 66 | #include "object.h" |
| 67 | #include "objimpl.h" |
| 68 | |
| 69 | #include "pydebug.h" |
| 70 | |
Guido van Rossum | 9e896b3 | 2000-04-05 20:11:21 +0000 | [diff] [blame] | 71 | #include "unicodeobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 72 | #include "intobject.h" |
| 73 | #include "longobject.h" |
| 74 | #include "floatobject.h" |
| 75 | #ifndef WITHOUT_COMPLEX |
| 76 | #include "complexobject.h" |
| 77 | #endif |
| 78 | #include "rangeobject.h" |
| 79 | #include "stringobject.h" |
Guido van Rossum | 2e19bd7 | 1998-10-07 14:36:10 +0000 | [diff] [blame] | 80 | #include "bufferobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 81 | #include "tupleobject.h" |
| 82 | #include "listobject.h" |
Guido van Rossum | 2ec9031 | 1997-05-13 21:23:32 +0000 | [diff] [blame] | 83 | #include "dictobject.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" |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 94 | #include "descrobject.h" |
Fred Drake | 19bc578 | 2001-10-05 21:55:19 +0000 | [diff] [blame] | 95 | #include "weakrefobject.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 96 | |
Guido van Rossum | bd7dfbc | 2000-03-10 22:34:00 +0000 | [diff] [blame] | 97 | #include "codecs.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 98 | #include "pyerrors.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 99 | |
Guido van Rossum | 618af4b | 1997-07-18 23:59:26 +0000 | [diff] [blame] | 100 | #include "pystate.h" |
| 101 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 102 | #include "modsupport.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 103 | #include "pythonrun.h" |
Tim Peters | 5ba5866 | 2001-07-16 02:29:45 +0000 | [diff] [blame] | 104 | #include "ceval.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 105 | #include "sysmodule.h" |
| 106 | #include "intrcheck.h" |
| 107 | #include "import.h" |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 108 | |
Guido van Rossum | 174f95a | 1997-05-02 03:55:52 +0000 | [diff] [blame] | 109 | #include "abstract.h" |
| 110 | |
| 111 | #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) |
| 112 | #define PyArg_NoArgs(v) PyArg_Parse(v, "") |
| 113 | |
| 114 | /* Convert a possibly signed character to a nonnegative int */ |
| 115 | /* XXX This assumes characters are 8 bits wide */ |
| 116 | #ifdef __CHAR_UNSIGNED__ |
| 117 | #define Py_CHARMASK(c) (c) |
| 118 | #else |
| 119 | #define Py_CHARMASK(c) ((c) & 0xff) |
| 120 | #endif |
| 121 | |
| 122 | #include "pyfpe.h" |
| 123 | |
Greg Ward | 9581144 | 2000-05-28 20:29:48 +0000 | [diff] [blame] | 124 | /* These definitions must match corresponding definitions in graminit.h. |
Guido van Rossum | b05a5c7 | 1997-05-07 17:46:13 +0000 | [diff] [blame] | 125 | There's code in compile.c that checks that they are the same. */ |
| 126 | #define Py_single_input 256 |
| 127 | #define Py_file_input 257 |
| 128 | #define Py_eval_input 258 |
| 129 | |
Guido van Rossum | 9e8181b | 2000-09-19 00:46:46 +0000 | [diff] [blame] | 130 | #ifdef HAVE_PTH |
Guido van Rossum | 07bd90e | 2000-05-08 13:41:38 +0000 | [diff] [blame] | 131 | /* GNU pth user-space thread support */ |
| 132 | #include <pth.h> |
| 133 | #endif |
Guido van Rossum | d27b4f2 | 1997-05-02 04:00:11 +0000 | [diff] [blame] | 134 | #endif /* !Py_PYTHON_H */ |