Python.h revision d5fadf75e4d18df61db41205ace0cda28d98eeaa
1d27b4f2a3f6a90dfcc5eb6fb30c1a895ed60142dGuido van Rossum#ifndef Py_PYTHON_H
2d27b4f2a3f6a90dfcc5eb6fb30c1a895ed60142dGuido van Rossum#define Py_PYTHON_H
3174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
4174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
5174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
6295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg/* Enable compiler features; switching on C lib defines doesn't work
7295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg   here, because the symbols haven't necessarily been defined yet. */
882249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#ifndef _GNU_SOURCE
982249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg# define _GNU_SOURCE	1
1082249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#endif
11295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg
12295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg/* Forcing SUSv2 compatibility still produces problems on some
13295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg   platforms, True64 and SGI IRIX begin two of them, so for now the
14295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg   define is switched off. */
15295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg#if 0
1682249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#ifndef _XOPEN_SOURCE
1782249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg# define _XOPEN_SOURCE	500
1882249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#endif
19295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg#endif
2082249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg
21174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* Include nearly all Python header files */
22174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
23f1176c4815cd628ae443b5c4b0e1841588369776Guido van Rossum#include "patchlevel.h"
24174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "config.h"
25174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
26d5fadf75e4d18df61db41205ace0cda28d98eeaaFred Drake#ifdef HAVE_LIMITS_H
27d5fadf75e4d18df61db41205ace0cda28d98eeaaFred Drake#include <limits.h>
28d5fadf75e4d18df61db41205ace0cda28d98eeaaFred Drake#endif
29d5fadf75e4d18df61db41205ace0cda28d98eeaaFred Drake
30174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* config.h may or may not define DL_IMPORT */
31174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifndef DL_IMPORT	/* declarations for DLL import/export */
32174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define DL_IMPORT(RTYPE) RTYPE
33174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
3443466ec7b07de6bcad016bec60839cd6079c5a9cGuido van Rossum#ifndef DL_EXPORT	/* declarations for DLL import/export */
3543466ec7b07de6bcad016bec60839cd6079c5a9cGuido van Rossum#define DL_EXPORT(RTYPE) RTYPE
3643466ec7b07de6bcad016bec60839cd6079c5a9cGuido van Rossum#endif
37174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
3890ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
3990ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum#define _SGI_MP_SOURCE
4090ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum#endif
4190ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum
42174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <stdio.h>
434826a894c5afa6f8b61d2b94c5a8b07588cb692aTim Peters#ifndef NULL
444826a894c5afa6f8b61d2b94c5a8b07588cb692aTim Peters#   error "Python.h requires that stdio.h define NULL."
454826a894c5afa6f8b61d2b94c5a8b07588cb692aTim Peters#endif
464826a894c5afa6f8b61d2b94c5a8b07588cb692aTim Peters
47174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <string.h>
48174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <errno.h>
49174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifdef HAVE_STDLIB_H
50174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <stdlib.h>
51174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
528315ea579046727bb234dc4692ca28c8514eacbeTim Peters#include <assert.h>
538315ea579046727bb234dc4692ca28c8514eacbeTim Peters
548315ea579046727bb234dc4692ca28c8514eacbeTim Peters#include "pyport.h"
55174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
5625f68944c20a3a37da6776277057c2d19a80211fPeter Schneider-Kamp#include "pymem.h"
5725f68944c20a3a37da6776277057c2d19a80211fPeter Schneider-Kamp
58174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "object.h"
59174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "objimpl.h"
60174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
61174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pydebug.h"
62174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
639e896b37c7a554250d7d832566cc4fe7d30d034cGuido van Rossum#include "unicodeobject.h"
64174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "intobject.h"
65174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "longobject.h"
66174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "floatobject.h"
67174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifndef WITHOUT_COMPLEX
68174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "complexobject.h"
69174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
70174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "rangeobject.h"
71174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "stringobject.h"
722e19bd7cc7520052b0c6e3d3da6baf45fb3b5e6bGuido van Rossum#include "bufferobject.h"
73174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "tupleobject.h"
74174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "listobject.h"
752ec9031b5589db81026f5fc3a11070002ec4d0d7Guido van Rossum#include "dictobject.h"
76174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "methodobject.h"
77174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "moduleobject.h"
78174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "funcobject.h"
79174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "classobject.h"
80174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "fileobject.h"
81174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "cobject.h"
82174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "traceback.h"
83174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "sliceobject.h"
84174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
85bd7dfbc146deb31c520d886415ffd2d00f6970b0Guido van Rossum#include "codecs.h"
86174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pyerrors.h"
87174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
88618af4b3ef08d5eee9c36fafd4cd57c54573f95eGuido van Rossum#include "pystate.h"
89618af4b3ef08d5eee9c36fafd4cd57c54573f95eGuido van Rossum
90174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "modsupport.h"
91174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "ceval.h"
92174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pythonrun.h"
93174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "sysmodule.h"
94174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "intrcheck.h"
95174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "import.h"
96174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
97174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "abstract.h"
98174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
99174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define PyArg_GetInt(v, a)	PyArg_Parse((v), "i", (a))
100174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define PyArg_NoArgs(v)		PyArg_Parse(v, "")
101174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
102174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* Convert a possibly signed character to a nonnegative int */
103174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* XXX This assumes characters are 8 bits wide */
104174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifdef __CHAR_UNSIGNED__
105174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define Py_CHARMASK(c)		(c)
106174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#else
107174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define Py_CHARMASK(c)		((c) & 0xff)
108174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
109174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
110174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pyfpe.h"
111174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
1129581144329e39787b1f584dc575b78f099710595Greg Ward/* These definitions must match corresponding definitions in graminit.h.
113b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum   There's code in compile.c that checks that they are the same. */
114b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum#define Py_single_input 256
115b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum#define Py_file_input 257
116b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum#define Py_eval_input 258
117b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum
1189e8181b809c0dc40f86d66ce7e51db83aaeccd20Guido van Rossum#ifdef HAVE_PTH
11907bd90e92d9cb8982ad541dda59bc0f8867e9414Guido van Rossum/* GNU pth user-space thread support */
12007bd90e92d9cb8982ad541dda59bc0f8867e9414Guido van Rossum#include <pth.h>
12107bd90e92d9cb8982ad541dda59bc0f8867e9414Guido van Rossum#endif
122d27b4f2a3f6a90dfcc5eb6fb30c1a895ed60142dGuido van Rossum#endif /* !Py_PYTHON_H */
123