blob: 0f07e367f64eeb76ca28615be4ca00b975dd9536 [file] [log] [blame]
Guido van Rossumd27b4f21997-05-02 04:00:11 +00001#ifndef Py_PYTHON_H
2#define Py_PYTHON_H
Guido van Rossum174f95a1997-05-02 03:55:52 +00003/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
4
Guido van Rossum174f95a1997-05-02 03:55:52 +00005
Marc-André Lemburg295b1bb2000-07-07 11:24:49 +00006/* Enable compiler features; switching on C lib defines doesn't work
7 here, because the symbols haven't necessarily been defined yet. */
Marc-André Lemburg82249c82000-07-05 08:53:18 +00008#ifndef _GNU_SOURCE
9# define _GNU_SOURCE 1
10#endif
Marc-André Lemburg295b1bb2000-07-07 11:24:49 +000011
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é Lemburg82249c82000-07-05 08:53:18 +000016#ifndef _XOPEN_SOURCE
17# define _XOPEN_SOURCE 500
18#endif
Marc-André Lemburg295b1bb2000-07-07 11:24:49 +000019#endif
Marc-André Lemburg82249c82000-07-05 08:53:18 +000020
Guido van Rossum174f95a1997-05-02 03:55:52 +000021/* Include nearly all Python header files */
22
Guido van Rossumf1176c41999-01-03 12:40:24 +000023#include "patchlevel.h"
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000024#include "pyconfig.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000025
Fred Draked5fadf72000-09-26 05:46:01 +000026#ifdef HAVE_LIMITS_H
27#include <limits.h>
28#endif
29
Tim Peters76f373d2001-07-26 21:34:59 +000030/* pyconfig.h may or may not define DL_IMPORT */
Guido van Rossum174f95a1997-05-02 03:55:52 +000031#ifndef DL_IMPORT /* declarations for DLL import/export */
32#define DL_IMPORT(RTYPE) RTYPE
33#endif
Guido van Rossum43466ec1998-12-04 18:48:25 +000034#ifndef DL_EXPORT /* declarations for DLL import/export */
35#define DL_EXPORT(RTYPE) RTYPE
36#endif
Guido van Rossum174f95a1997-05-02 03:55:52 +000037
Guido van Rossum90ce8481998-05-26 18:38:07 +000038#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
39#define _SGI_MP_SOURCE
40#endif
41
Guido van Rossum174f95a1997-05-02 03:55:52 +000042#include <stdio.h>
Tim Peters4826a892000-09-10 01:02:41 +000043#ifndef NULL
44# error "Python.h requires that stdio.h define NULL."
45#endif
46
Guido van Rossum174f95a1997-05-02 03:55:52 +000047#include <string.h>
48#include <errno.h>
49#ifdef HAVE_STDLIB_H
50#include <stdlib.h>
51#endif
Guido van Rossumb2c075b2001-07-15 16:58:05 +000052
Tim Peters5defb172001-12-04 20:06:11 +000053/* CAUTION: Build setups should ensure that NDEBUG is defined on the
54 * compiler command line when building Python in release mode; else
55 * assert() calls won't be removed.
56 */
Tim Peters8315ea52000-07-23 19:28:35 +000057#include <assert.h>
58
59#include "pyport.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000060
Peter Schneider-Kamp25f68942000-07-31 22:19:30 +000061#include "pymem.h"
62
Guido van Rossum174f95a1997-05-02 03:55:52 +000063#include "object.h"
64#include "objimpl.h"
65
66#include "pydebug.h"
67
Guido van Rossum9e896b32000-04-05 20:11:21 +000068#include "unicodeobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000069#include "intobject.h"
70#include "longobject.h"
71#include "floatobject.h"
72#ifndef WITHOUT_COMPLEX
73#include "complexobject.h"
74#endif
75#include "rangeobject.h"
76#include "stringobject.h"
Guido van Rossum2e19bd71998-10-07 14:36:10 +000077#include "bufferobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000078#include "tupleobject.h"
79#include "listobject.h"
Guido van Rossum2ec90311997-05-13 21:23:32 +000080#include "dictobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000081#include "methodobject.h"
82#include "moduleobject.h"
83#include "funcobject.h"
84#include "classobject.h"
85#include "fileobject.h"
86#include "cobject.h"
87#include "traceback.h"
88#include "sliceobject.h"
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +000089#include "cellobject.h"
Guido van Rossum59d1d2b2001-04-20 19:13:02 +000090#include "iterobject.h"
Tim Peters6d6c1a32001-08-02 04:15:00 +000091#include "descrobject.h"
Fred Drake19bc5782001-10-05 21:55:19 +000092#include "weakrefobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000093
Guido van Rossumbd7dfbc2000-03-10 22:34:00 +000094#include "codecs.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000095#include "pyerrors.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000096
Guido van Rossum618af4b1997-07-18 23:59:26 +000097#include "pystate.h"
98
Guido van Rossum174f95a1997-05-02 03:55:52 +000099#include "modsupport.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000100#include "pythonrun.h"
Tim Peters5ba58662001-07-16 02:29:45 +0000101#include "ceval.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000102#include "sysmodule.h"
103#include "intrcheck.h"
104#include "import.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000105
Guido van Rossum174f95a1997-05-02 03:55:52 +0000106#include "abstract.h"
107
108#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
109#define PyArg_NoArgs(v) PyArg_Parse(v, "")
110
111/* Convert a possibly signed character to a nonnegative int */
112/* XXX This assumes characters are 8 bits wide */
113#ifdef __CHAR_UNSIGNED__
114#define Py_CHARMASK(c) (c)
115#else
116#define Py_CHARMASK(c) ((c) & 0xff)
117#endif
118
119#include "pyfpe.h"
120
Greg Ward95811442000-05-28 20:29:48 +0000121/* These definitions must match corresponding definitions in graminit.h.
Guido van Rossumb05a5c71997-05-07 17:46:13 +0000122 There's code in compile.c that checks that they are the same. */
123#define Py_single_input 256
124#define Py_file_input 257
125#define Py_eval_input 258
126
Guido van Rossum9e8181b2000-09-19 00:46:46 +0000127#ifdef HAVE_PTH
Guido van Rossum07bd90e2000-05-08 13:41:38 +0000128/* GNU pth user-space thread support */
129#include <pth.h>
130#endif
Guido van Rossumd27b4f21997-05-02 04:00:11 +0000131#endif /* !Py_PYTHON_H */