Orbits  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
descrobject.h
Go to the documentation of this file.
1 /* Descriptors */
2 #ifndef Py_DESCROBJECT_H
3 #define Py_DESCROBJECT_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 typedef PyObject *(*getter)(PyObject *, void *);
9 typedef int (*setter)(PyObject *, PyObject *, void *);
10 
11 typedef struct PyGetSetDef {
12  char *name;
13  getter get;
14  setter set;
15  char *doc;
16  void *closure;
17 } PyGetSetDef;
18 
19 typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args,
20  void *wrapped);
21 
22 typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args,
23  void *wrapped, PyObject *kwds);
24 
25 struct wrapperbase {
26  char *name;
27  int offset;
28  void *function;
30  char *doc;
31  int flags;
32  PyObject *name_strobj;
33 };
34 
35 /* Flags for above struct */
36 #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
37 
38 /* Various kinds of descriptor objects */
39 
40 #define PyDescr_COMMON \
41  PyObject_HEAD \
42  PyTypeObject *d_type; \
43  PyObject *d_name
44 
45 typedef struct {
48 
49 typedef struct {
53 
54 typedef struct {
58 
59 typedef struct {
63 
64 typedef struct {
67  void *d_wrapped; /* This can be any function pointer */
69 
70 PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
71 PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
72 PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
73 PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
74 
75 PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
76 PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
77 PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
78  struct PyMemberDef *);
79 PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
80  struct PyGetSetDef *);
81 PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
82  struct wrapperbase *, void *);
83 #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
84 
85 PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
86 PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
87 
88 
89 PyAPI_DATA(PyTypeObject) PyProperty_Type;
90 #ifdef __cplusplus
91 }
92 #endif
93 #endif /* !Py_DESCROBJECT_H */
94 

Copyright 2014 Google Inc. All rights reserved.