Python.h revision 8315ea579046727bb234dc4692ca28c8514eacbe
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/***********************************************************
6fd71b9e9d496caa510dec56a9b69966558d6ba5dGuido van RossumCopyright (c) 2000, BeOpen.com.
7fd71b9e9d496caa510dec56a9b69966558d6ba5dGuido van RossumCopyright (c) 1995-2000, Corporation for National Research Initiatives.
8fd71b9e9d496caa510dec56a9b69966558d6ba5dGuido van RossumCopyright (c) 1990-1995, Stichting Mathematisch Centrum.
9fd71b9e9d496caa510dec56a9b69966558d6ba5dGuido van RossumAll rights reserved.
10fd71b9e9d496caa510dec56a9b69966558d6ba5dGuido van Rossum
11fd71b9e9d496caa510dec56a9b69966558d6ba5dGuido van RossumSee the file "Misc/COPYRIGHT" for information on usage and
12fd71b9e9d496caa510dec56a9b69966558d6ba5dGuido van Rossumredistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum******************************************************************/
14174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
15295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg/* Enable compiler features; switching on C lib defines doesn't work
16295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg   here, because the symbols haven't necessarily been defined yet. */
1782249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#ifndef _GNU_SOURCE
1882249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg# define _GNU_SOURCE	1
1982249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#endif
20295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg
21295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg/* Forcing SUSv2 compatibility still produces problems on some
22295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg   platforms, True64 and SGI IRIX begin two of them, so for now the
23295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg   define is switched off. */
24295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg#if 0
2582249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#ifndef _XOPEN_SOURCE
2682249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg# define _XOPEN_SOURCE	500
2782249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg#endif
28295b1bbca10b3b919e11812f6946facd8217f248Marc-André Lemburg#endif
2982249c83891d86af179d0ff06bfb11d783cbd997Marc-André Lemburg
30174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* Include nearly all Python header files */
31174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
32f1176c4815cd628ae443b5c4b0e1841588369776Guido van Rossum#include "patchlevel.h"
33174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "config.h"
34174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
35174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* config.h may or may not define DL_IMPORT */
36174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifndef DL_IMPORT	/* declarations for DLL import/export */
37174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define DL_IMPORT(RTYPE) RTYPE
38174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
3943466ec7b07de6bcad016bec60839cd6079c5a9cGuido van Rossum#ifndef DL_EXPORT	/* declarations for DLL import/export */
4043466ec7b07de6bcad016bec60839cd6079c5a9cGuido van Rossum#define DL_EXPORT(RTYPE) RTYPE
4143466ec7b07de6bcad016bec60839cd6079c5a9cGuido van Rossum#endif
42174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
4390ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
4490ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum#define _SGI_MP_SOURCE
4590ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum#endif
4690ce8488481521e5ddd1fe5ed942e1df4acd6365Guido van Rossum
47174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <stdio.h>
48174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <string.h>
49174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <errno.h>
50174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifdef HAVE_STDLIB_H
51174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include <stdlib.h>
52174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
538315ea579046727bb234dc4692ca28c8514eacbeTim Peters#include <assert.h>
548315ea579046727bb234dc4692ca28c8514eacbeTim Peters
558315ea579046727bb234dc4692ca28c8514eacbeTim Peters#include "pyport.h"
56174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
57174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "myproto.h"
58174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
59174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "object.h"
60174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "objimpl.h"
61174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
62174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pydebug.h"
63174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
649e896b37c7a554250d7d832566cc4fe7d30d034cGuido van Rossum#include "unicodeobject.h"
65174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "intobject.h"
66174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "longobject.h"
67174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "floatobject.h"
68174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifndef WITHOUT_COMPLEX
69174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "complexobject.h"
70174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
71174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "rangeobject.h"
72174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "stringobject.h"
732e19bd7cc7520052b0c6e3d3da6baf45fb3b5e6bGuido van Rossum#include "bufferobject.h"
74174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "tupleobject.h"
75174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "listobject.h"
762ec9031b5589db81026f5fc3a11070002ec4d0d7Guido van Rossum#include "dictobject.h"
77174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "methodobject.h"
78174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "moduleobject.h"
79174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "funcobject.h"
80174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "classobject.h"
81174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "fileobject.h"
82174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "cobject.h"
83174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "traceback.h"
84174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "sliceobject.h"
85174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
86bd7dfbc146deb31c520d886415ffd2d00f6970b0Guido van Rossum#include "codecs.h"
87174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pyerrors.h"
88174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "mymalloc.h"
89174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
90618af4b3ef08d5eee9c36fafd4cd57c54573f95eGuido van Rossum#include "pystate.h"
91618af4b3ef08d5eee9c36fafd4cd57c54573f95eGuido van Rossum
92174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "modsupport.h"
93174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "ceval.h"
94174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pythonrun.h"
95174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "sysmodule.h"
96174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "intrcheck.h"
97174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "import.h"
98174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
99174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "abstract.h"
100174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
101174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define PyArg_GetInt(v, a)	PyArg_Parse((v), "i", (a))
102174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define PyArg_NoArgs(v)		PyArg_Parse(v, "")
103174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
104174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* Convert a possibly signed character to a nonnegative int */
105174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum/* XXX This assumes characters are 8 bits wide */
106174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#ifdef __CHAR_UNSIGNED__
107174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define Py_CHARMASK(c)		(c)
108174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#else
109174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#define Py_CHARMASK(c)		((c) & 0xff)
110174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#endif
111174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
112174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum#include "pyfpe.h"
113174f95adf7ee1251738a291d0fb52760ea1b25c0Guido van Rossum
1149581144329e39787b1f584dc575b78f099710595Greg Ward/* These definitions must match corresponding definitions in graminit.h.
115b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum   There's code in compile.c that checks that they are the same. */
116b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum#define Py_single_input 256
117b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum#define Py_file_input 257
118b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum#define Py_eval_input 258
119b05a5c7698cd8dff3e5c02e513db765ba12281f0Guido van Rossum
12007bd90e92d9cb8982ad541dda59bc0f8867e9414Guido van Rossum#ifdef _GNU_PTH
12107bd90e92d9cb8982ad541dda59bc0f8867e9414Guido van Rossum/* GNU pth user-space thread support */
12207bd90e92d9cb8982ad541dda59bc0f8867e9414Guido van Rossum#include <pth.h>
12307bd90e92d9cb8982ad541dda59bc0f8867e9414Guido van Rossum#endif
124d27b4f2a3f6a90dfcc5eb6fb30c1a895ed60142dGuido van Rossum#endif /* !Py_PYTHON_H */
125