Mercurial > cpython-lru_cache-weakref
annotate Include/methodobject.h @ 13778:f6e4a9dd67cd legacy-trunk
Rename the "parser" package to "parsers" to be compatible with the PyXML
project.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Mon, 31 Jul 2000 23:59:54 +0000 |
| parents | a89f7f268de4 |
| children | 95eee868611e |
| rev | line source |
|---|---|
| 145 | 1 /*********************************************************** |
|
13255
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
9586
diff
changeset
|
2 Copyright (c) 2000, BeOpen.com. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
9586
diff
changeset
|
3 Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
9586
diff
changeset
|
4 Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
9586
diff
changeset
|
5 All rights reserved. |
| 145 | 6 |
|
13255
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
9586
diff
changeset
|
7 See the file "Misc/COPYRIGHT" for information on usage and |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
9586
diff
changeset
|
8 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 145 | 9 ******************************************************************/ |
| 10 | |
| 6 | 11 /* Method object interface */ |
| 12 | |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
13 #ifndef Py_METHODOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
14 #define Py_METHODOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
15 #ifdef __cplusplus |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
16 extern "C" { |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
17 #endif |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
18 |
|
2436
fa98dda07877
make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents:
2256
diff
changeset
|
19 extern DL_IMPORT(PyTypeObject) PyCFunction_Type; |
| 6 | 20 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2072
diff
changeset
|
21 #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type) |
| 6 | 22 |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
13444
diff
changeset
|
23 typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); |
|
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
13444
diff
changeset
|
24 typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, |
|
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
13444
diff
changeset
|
25 PyObject *); |
| 6 | 26 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
27 extern DL_IMPORT(PyCFunction) PyCFunction_GetFunction(PyObject *); |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
28 extern DL_IMPORT(PyObject *) PyCFunction_GetSelf(PyObject *); |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
29 extern DL_IMPORT(int) PyCFunction_GetFlags(PyObject *); |
| 86 | 30 |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
31 /* Macros for direct access to these values. Type checks are *not* |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
32 done, so use with care. */ |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
33 #define PyCFunction_GET_FUNCTION(func) \ |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
34 (((PyCFunctionObject *)func) -> m_ml -> ml_meth) |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
35 #define PyCFunction_GET_SELF(func) \ |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
36 (((PyCFunctionObject *)func) -> m_self) |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
37 #define PyCFunction_GET_FLAGS(func) \ |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
38 (((PyCFunctionObject *)func) -> m_ml -> ml_flags) |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
39 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2072
diff
changeset
|
40 struct PyMethodDef { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
41 char *ml_name; |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
42 PyCFunction ml_meth; |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
43 int ml_flags; |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
44 char *ml_doc; |
| 86 | 45 }; |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2072
diff
changeset
|
46 typedef struct PyMethodDef PyMethodDef; |
| 86 | 47 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
48 extern DL_IMPORT(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *); |
|
2072
cf65a124fa4b
added ml_doc and changed newmethodlist interface
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
49 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
50 extern DL_IMPORT(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
51 |
| 2058 | 52 /* Flag passed to newmethodobject */ |
| 53 #define METH_VARARGS 0x0001 | |
|
2863
10e007aef1cf
changes for keyword args to built-in functions and classes
Guido van Rossum <guido@python.org>
parents:
2436
diff
changeset
|
54 #define METH_KEYWORDS 0x0002 |
| 2058 | 55 |
|
2256
d091b246a3a7
added findmethodinchain and methodchain data types
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
56 typedef struct PyMethodChain { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
57 PyMethodDef *methods; /* Methods of this type */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
58 struct PyMethodChain *link; /* NULL or base type */ |
|
2256
d091b246a3a7
added findmethodinchain and methodchain data types
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
59 } PyMethodChain; |
|
d091b246a3a7
added findmethodinchain and methodchain data types
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
60 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
61 extern DL_IMPORT(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
62 char *); |
|
2256
d091b246a3a7
added findmethodinchain and methodchain data types
Guido van Rossum <guido@python.org>
parents:
2129
diff
changeset
|
63 |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
64 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
65 PyObject_HEAD |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
66 PyMethodDef *m_ml; |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
67 PyObject *m_self; |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
68 } PyCFunctionObject; |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
69 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
70 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
71 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
72 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
73 #endif /* !Py_METHODOBJECT_H */ |
