blob: c55b46b758a6dbebade36876d1ee88dd4eaa8a74 [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001/***********************************************************
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00002Copyright (c) 2000, BeOpen.com.
3Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5All rights reserved.
Guido van Rossumf70e43a1991-02-19 12:39:46 +00006
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00007See the file "Misc/COPYRIGHT" for information on usage and
8redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumf70e43a1991-02-19 12:39:46 +00009******************************************************************/
10
Fred Draked5c84ed2000-07-08 17:25:55 +000011#ifndef Py_MODSUPPORT_H
12#define Py_MODSUPPORT_H
13#ifdef __cplusplus
14extern "C" {
15#endif
16
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000017/* Module support interface */
18
Guido van Rossumb6775db1994-08-01 11:34:53 +000019#ifdef HAVE_STDARG_PROTOTYPES
20
21#include <stdarg.h>
22
Fred Draked5c84ed2000-07-08 17:25:55 +000023extern DL_IMPORT(int) PyArg_Parse(PyObject *, char *, ...);
24extern DL_IMPORT(int) PyArg_ParseTuple(PyObject *, char *, ...);
25extern DL_IMPORT(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
26 char *, char **, ...);
27extern DL_IMPORT(PyObject *) Py_BuildValue(char *, ...);
Guido van Rossumb6775db1994-08-01 11:34:53 +000028
29#else
30
31#include <varargs.h>
32
33/* Better to have no prototypes at all for varargs functions in this case */
Guido van Rossum43466ec1998-12-04 18:48:25 +000034extern DL_IMPORT(int) PyArg_Parse();
35extern DL_IMPORT(int) PyArg_ParseTuple();
36extern DL_IMPORT(PyObject *) Py_BuildValue();
Guido van Rossumb6775db1994-08-01 11:34:53 +000037
Guido van Rossume5372401993-03-16 12:15:04 +000038#endif
39
Fred Draked5c84ed2000-07-08 17:25:55 +000040extern DL_IMPORT(int) PyArg_VaParse(PyObject *, char *, va_list);
41extern DL_IMPORT(PyObject *) Py_VaBuildValue(char *, va_list);
Guido van Rossume5372401993-03-16 12:15:04 +000042
Guido van Rossum21a50bd2000-03-29 01:46:45 +000043#define PYTHON_API_VERSION 1009
44#define PYTHON_API_STRING "1009"
Guido van Rossum970a0a21995-01-09 17:47:20 +000045/* The API version is maintained (independently from the Python version)
46 so we can detect mismatches between the interpreter and dynamically
Thomas Wouters7e474022000-07-16 12:04:32 +000047 loaded modules. These are diagnosed by an error message but
Guido van Rossumae8a99e1996-07-30 16:41:02 +000048 the module is still loaded (because the mismatch can only be tested
49 after loading the module). The error message is intended to
50 explain the core dump a few seconds later.
Guido van Rossum970a0a21995-01-09 17:47:20 +000051
Guido van Rossum2ea0b061996-08-22 22:55:47 +000052 The symbol PYTHON_API_STRING defines the same value as a string
53 literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
54
Guido van Rossum970a0a21995-01-09 17:47:20 +000055 Please add a line or two to the top of this log for each API
56 version change:
57
Guido van Rossum21a50bd2000-03-29 01:46:45 +000058 14-Mar-2000 GvR 1009 Unicode API added
59
Guido van Rossumf1176c41999-01-03 12:40:24 +000060 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
61
62 3-Dec-1998 GvR 1008 Python 1.5.2b1
Guido van Rossum7531d501998-12-03 18:18:12 +000063
64 18-Jan-1997 GvR 1007 string interning and other speedups
Guido van Rossumee5cf9b1997-01-18 07:54:03 +000065
Guido van Rossume449af71996-10-11 16:25:41 +000066 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
67
Guido van Rossumae8a99e1996-07-30 16:41:02 +000068 30-Jul-1996 GvR Slice and ellipses syntax added
69
70 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
71
Guido van Rossume0dbd591996-01-12 00:49:39 +000072 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
73
Guido van Rossumcaa63801995-01-12 11:45:45 +000074 10-Jan-1995 GvR Renamed globals to new naming scheme
75
Guido van Rossum970a0a21995-01-09 17:47:20 +000076 9-Jan-1995 GvR Initial version (incompatible with older API)
77*/
78
Guido van Rossum2ea0b061996-08-22 22:55:47 +000079#ifdef MS_WINDOWS
Guido van Rossumb4cfdfa1997-09-29 23:29:08 +000080/* Special defines for Windows versions used to live here. Things
81 have changed, and the "Version" is now in a global string variable.
82 Reason for this is that this for easier branding of a "custom DLL"
83 without actually needing a recompile. */
Guido van Rossum2ea0b061996-08-22 22:55:47 +000084#endif /* MS_WINDOWS */
85
86#ifdef Py_TRACE_REFS
87/* When we are tracing reference counts, rename Py_InitModule4 so
88 modules compiled with incompatible settings will generate a
89 link-time error. */
90#define Py_InitModule4 Py_InitModule4TraceRefs
91#endif
92
Fred Draked5c84ed2000-07-08 17:25:55 +000093extern DL_IMPORT(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods,
94 char *doc, PyObject *self,
95 int apiver);
96
Guido van Rossumcaa63801995-01-12 11:45:45 +000097#define Py_InitModule(name, methods) \
98 Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
99 PYTHON_API_VERSION)
Guido van Rossuma3309961993-07-28 09:05:47 +0000100
Guido van Rossuma70d1601998-06-27 18:21:59 +0000101#define Py_InitModule3(name, methods, doc) \
102 Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
103 PYTHON_API_VERSION)
104
Guido van Rossum43466ec1998-12-04 18:48:25 +0000105extern DL_IMPORT(char *) _Py_PackageContext;
Guido van Rossumee6fd1c1997-11-19 18:51:35 +0000106
Guido van Rossuma3309961993-07-28 09:05:47 +0000107#ifdef __cplusplus
108}
109#endif
110#endif /* !Py_MODSUPPORT_H */