annotate Include/modsupport.h @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents 492c0cae1f05
children 781eb49d2d66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
1 #ifndef Py_MODSUPPORT_H
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
2 #define Py_MODSUPPORT_H
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
3 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
4 extern "C" {
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
5 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
6
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
7 /***********************************************************
2058
508036dbba3b Added 1995 copyright.
Guido van Rossum <guido@python.org>
parents: 1906
diff changeset
8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
508036dbba3b Added 1995 copyright.
Guido van Rossum <guido@python.org>
parents: 1906
diff changeset
9 The Netherlands.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
10
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
11 All Rights Reserved
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
12
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
13 Permission to use, copy, modify, and distribute this software and its
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
14 documentation for any purpose and without fee is hereby granted,
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
15 provided that the above copyright notice appear in all copies and that
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
16 both that copyright notice and this permission notice appear in
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
17 supporting documentation, and that the names of Stichting Mathematisch
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
18 Centrum or CWI or Corporation for National Research Initiatives or
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
19 CNRI not be used in advertising or publicity pertaining to
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
20 distribution of the software without specific, written prior
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
21 permission.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
22
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
23 While CWI is the initial source for this software, a modified version
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
24 is made available by the Corporation for National Research Initiatives
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
25 (CNRI) at the Internet address ftp://ftp.python.org.
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
26
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 4403
diff changeset
34 PERFORMANCE OF THIS SOFTWARE.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
35
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
36 ******************************************************************/
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
37
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 /* Module support interface */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
39
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
40 #ifdef HAVE_STDARG_PROTOTYPES
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
41
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
42 #include <stdarg.h>
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
43
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
44 extern int PyArg_Parse Py_PROTO((PyObject *, char *, ...));
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
45 extern int PyArg_ParseTuple Py_PROTO((PyObject *, char *, ...));
5103
492c0cae1f05 Added PyArg_ParseTupleAndKeywords() prototype.
Guido van Rossum <guido@python.org>
parents: 5004
diff changeset
46 extern int PyArg_ParseTupleAndKeywords Py_PROTO((PyObject *, PyObject *,
492c0cae1f05 Added PyArg_ParseTupleAndKeywords() prototype.
Guido van Rossum <guido@python.org>
parents: 5004
diff changeset
47 char *, char **, ...));
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
48 extern PyObject *Py_BuildValue Py_PROTO((char *, ...));
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
49
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
50 #else
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
51
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
52 #include <varargs.h>
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
53
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
54 /* Better to have no prototypes at all for varargs functions in this case */
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
55 extern int PyArg_Parse();
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
56 extern int PyArg_ParseTuple();
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
57 extern PyObject *Py_BuildValue();
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
58
1252
c4cd0d9d8281 * Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents: 819
diff changeset
59 #endif
c4cd0d9d8281 * Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents: 819
diff changeset
60
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
61 extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
62 extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
1252
c4cd0d9d8281 * Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents: 819
diff changeset
63
5004
4c8e4e9311e4 Bump API version due to the various speedup hacks.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
64 #define PYTHON_API_VERSION 1007
4c8e4e9311e4 Bump API version due to the various speedup hacks.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
65 #define PYTHON_API_STRING "1007"
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
66 /* The API version is maintained (independently from the Python version)
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
67 so we can detect mismatches between the interpreter and dynamically
3831
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
68 loaded modules. These are diagnosticised by an error message but
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
69 the module is still loaded (because the mismatch can only be tested
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
70 after loading the module). The error message is intended to
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
71 explain the core dump a few seconds later.
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
72
4110
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
73 The symbol PYTHON_API_STRING defines the same value as a string
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
74 literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
75
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
76 Please add a line or two to the top of this log for each API
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
77 version change:
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
78
5004
4c8e4e9311e4 Bump API version due to the various speedup hacks.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
79 18-Jan-1997 GvR string interning and other speedups
4c8e4e9311e4 Bump API version due to the various speedup hacks.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
80
4403
3b3f7c3f6da2 Ellipses -> Ellipsis rename (the dictionary really says that it should
Guido van Rossum <guido@python.org>
parents: 4110
diff changeset
81 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
3b3f7c3f6da2 Ellipses -> Ellipsis rename (the dictionary really says that it should
Guido van Rossum <guido@python.org>
parents: 4110
diff changeset
82
3831
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
83 30-Jul-1996 GvR Slice and ellipses syntax added
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
84
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
85 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
96851f51ad6b Two bumps for the price of one (PYTHON_API_VERSION)
Guido van Rossum <guido@python.org>
parents: 3318
diff changeset
86
3318
8b8d60fbe3bf bump api version
Guido van Rossum <guido@python.org>
parents: 2129
diff changeset
87 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
8b8d60fbe3bf bump api version
Guido van Rossum <guido@python.org>
parents: 2129
diff changeset
88
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
89 10-Jan-1995 GvR Renamed globals to new naming scheme
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
90
2095
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
91 9-Jan-1995 GvR Initial version (incompatible with older API)
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
92 */
0d7e4aa595f7 api version checking
Guido van Rossum <guido@python.org>
parents: 2078
diff changeset
93
4110
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
94 #ifdef MS_WINDOWS
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
95 /* Special defines for Windows versions. MS_DLL_ID is the key
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
96 used in the registry.
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
97 The full MS_DLL_VERSION_ID is imbedded in the core DLL, and
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
98 is so installers can determine incremental changes.
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
99 */
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
100 #define MS_DLL_ID "1.4.0"
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
101 #define MS_DLL_VERSION_ID MS_DLL_ID "." PYTHON_API_STRING
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
102
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
103 #endif /* MS_WINDOWS */
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
104
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
105 #ifdef Py_TRACE_REFS
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
106 /* When we are tracing reference counts, rename Py_InitModule4 so
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
107 modules compiled with incompatible settings will generate a
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
108 link-time error. */
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
109 #define Py_InitModule4 Py_InitModule4TraceRefs
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
110 #endif
07a35fd2e0a1 Add PYTHON_API_STRING, which is PYTHON_API_VERSION as a string literal.
Guido van Rossum <guido@python.org>
parents: 3831
diff changeset
111
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
112 extern PyObject *Py_InitModule4 Py_PROTO((char *, PyMethodDef *,
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
113 char *, PyObject *, int));
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
114 #define Py_InitModule(name, methods) \
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
115 Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2095
diff changeset
116 PYTHON_API_VERSION)
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
117
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
118 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
119 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
120 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
121 #endif /* !Py_MODSUPPORT_H */