]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Include / classobject.h
CommitLineData
c8042e10
DM
1\r
2/* Class object interface */\r
3\r
4/* Revealing some structures (not for general use) */\r
5\r
6#ifndef Py_CLASSOBJECT_H\r
7#define Py_CLASSOBJECT_H\r
8#ifdef __cplusplus\r
9extern "C" {\r
10#endif\r
11\r
12typedef struct {\r
13 PyObject_HEAD\r
14 PyObject *cl_bases; /* A tuple of class objects */\r
15 PyObject *cl_dict; /* A dictionary */\r
16 PyObject *cl_name; /* A string */\r
17 /* The following three are functions or NULL */\r
18 PyObject *cl_getattr;\r
19 PyObject *cl_setattr;\r
20 PyObject *cl_delattr;\r
21 PyObject *cl_weakreflist; /* List of weak references */\r
22} PyClassObject;\r
23\r
24typedef struct {\r
25 PyObject_HEAD\r
26 PyClassObject *in_class; /* The class object */\r
27 PyObject *in_dict; /* A dictionary */\r
28 PyObject *in_weakreflist; /* List of weak references */\r
29} PyInstanceObject;\r
30\r
31typedef struct {\r
32 PyObject_HEAD\r
33 PyObject *im_func; /* The callable object implementing the method */\r
34 PyObject *im_self; /* The instance it is bound to, or NULL */\r
35 PyObject *im_class; /* The class that asked for the method */\r
36 PyObject *im_weakreflist; /* List of weak references */\r
37} PyMethodObject;\r
38\r
39PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;\r
40\r
41#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)\r
42#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)\r
43#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)\r
44\r
45PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);\r
46PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *,\r
47 PyObject *);\r
48PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);\r
49PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);\r
50\r
51PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);\r
52PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);\r
53PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);\r
54\r
55/* Look up attribute with name (a string) on instance object pinst, using\r
56 * only the instance and base class dicts. If a descriptor is found in\r
57 * a class dict, the descriptor is returned without calling it.\r
58 * Returns NULL if nothing found, else a borrowed reference to the\r
59 * value associated with name in the dict in which name was found.\r
60 * The point of this routine is that it never calls arbitrary Python\r
61 * code, so is always "safe": all it does is dict lookups. The function\r
62 * can't fail, never sets an exception, and NULL is not an error (it just\r
63 * means "not found").\r
64 */\r
65PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);\r
66\r
67/* Macros for direct access to these values. Type checks are *not*\r
68 done, so use with care. */\r
69#define PyMethod_GET_FUNCTION(meth) \\r
70 (((PyMethodObject *)meth) -> im_func)\r
71#define PyMethod_GET_SELF(meth) \\r
72 (((PyMethodObject *)meth) -> im_self)\r
73#define PyMethod_GET_CLASS(meth) \\r
74 (((PyMethodObject *)meth) -> im_class)\r
75\r
76PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);\r
77\r
78PyAPI_FUNC(int) PyMethod_ClearFreeList(void);\r
79\r
80#ifdef __cplusplus\r
81}\r
82#endif\r
83#endif /* !Py_CLASSOBJECT_H */\r