1 // This file is a modified version of Python 2.2/2.2.1 Python.h. As
2 // such it is:
3 //
4 //    Copyright (c) 2001, 2002 Python Software Foundation; All Rights
5 //    Reserved
6 //
7 // boostinspect:nolicense (don't complain about the lack of a Boost license)
8 //
9 // Changes from the original:
10 //  1. #includes <unistd.h> for Python 2.2.1
11 //  2. Provides missing extern "C" wrapper for  "iterobject.h" and  "descrobject.h".
12 //
13 
14 // Changes marked with "Boost.Python modification"
15 #ifndef Py_PYTHON_H
16 #define Py_PYTHON_H
17 /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
18 
19 
20 /* Enable compiler features; switching on C lib defines doesn't work
21    here, because the symbols haven't necessarily been defined yet. */
22 #ifndef _GNU_SOURCE
23 # define _GNU_SOURCE    1
24 #endif
25 
26 /* Forcing SUSv2 compatibility still produces problems on some
27    platforms, True64 and SGI IRIX begin two of them, so for now the
28    define is switched off. */
29 #if 0
30 #ifndef _XOPEN_SOURCE
31 # define _XOPEN_SOURCE  500
32 #endif
33 #endif
34 
35 /* Include nearly all Python header files */
36 
37 #include "patchlevel.h"
38 #include "pyconfig.h"
39 
40 #ifdef HAVE_LIMITS_H
41 #include <limits.h>
42 #endif
43 
44 /* pyconfig.h may or may not define DL_IMPORT */
45 #ifndef DL_IMPORT       /* declarations for DLL import/export */
46 #define DL_IMPORT(RTYPE) RTYPE
47 #endif
48 #ifndef DL_EXPORT       /* declarations for DLL import/export */
49 #define DL_EXPORT(RTYPE) RTYPE
50 #endif
51 
52 #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
53 #define _SGI_MP_SOURCE
54 #endif
55 
56 #include <stdio.h>
57 #ifndef NULL
58 #   error "Python.h requires that stdio.h define NULL."
59 #endif
60 
61 #include <string.h>
62 #include <errno.h>
63 #ifdef HAVE_STDLIB_H
64 #include <stdlib.h>
65 #endif
66 #if PY_MICRO_VERSION == 1 // Boost.Python modification: emulate Python 2.2
67 #ifdef HAVE_UNISTD_H
68 #include <unistd.h>
69 #endif
70 #endif // Boost.Python modification: emulate Python 2.2
71 
72 /* CAUTION:  Build setups should ensure that NDEBUG is defined on the
73  * compiler command line when building Python in release mode; else
74  * assert() calls won't be removed.
75  */
76 #include <assert.h>
77 
78 #include "pyport.h"
79 
80 #include "pymem.h"
81 
82 #include "object.h"
83 #include "objimpl.h"
84 
85 #include "pydebug.h"
86 
87 #include "unicodeobject.h"
88 #include "intobject.h"
89 #include "longobject.h"
90 #include "floatobject.h"
91 #ifndef WITHOUT_COMPLEX
92 #include "complexobject.h"
93 #endif
94 #include "rangeobject.h"
95 #include "stringobject.h"
96 #include "bufferobject.h"
97 #include "tupleobject.h"
98 #include "listobject.h"
99 #include "dictobject.h"
100 #include "methodobject.h"
101 #include "moduleobject.h"
102 #include "funcobject.h"
103 #include "classobject.h"
104 #include "fileobject.h"
105 #include "cobject.h"
106 #include "traceback.h"
107 #include "sliceobject.h"
108 #include "cellobject.h"
109 extern "C" { // Boost.Python modification: provide missing extern "C"
110 #include "iterobject.h"
111 #include "descrobject.h"
112 } // Boost.Python modification: provide missing extern "C"
113 #include "weakrefobject.h"
114 
115 #include "codecs.h"
116 #include "pyerrors.h"
117 
118 #include "pystate.h"
119 
120 #include "modsupport.h"
121 #include "pythonrun.h"
122 #include "ceval.h"
123 #include "sysmodule.h"
124 #include "intrcheck.h"
125 #include "import.h"
126 
127 #include "abstract.h"
128 
129 #define PyArg_GetInt(v, a)      PyArg_Parse((v), "i", (a))
130 #define PyArg_NoArgs(v)         PyArg_Parse(v, "")
131 
132 /* Convert a possibly signed character to a nonnegative int */
133 /* XXX This assumes characters are 8 bits wide */
134 #ifdef __CHAR_UNSIGNED__
135 #define Py_CHARMASK(c)          (c)
136 #else
137 #define Py_CHARMASK(c)          ((c) & 0xff)
138 #endif
139 
140 #include "pyfpe.h"
141 
142 /* These definitions must match corresponding definitions in graminit.h.
143    There's code in compile.c that checks that they are the same. */
144 #define Py_single_input 256
145 #define Py_file_input 257
146 #define Py_eval_input 258
147 
148 #ifdef HAVE_PTH
149 /* GNU pth user-space thread support */
150 #include <pth.h>
151 #endif
152 #endif /* !Py_PYTHON_H */
153