]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 1/5.
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Include / classobject.h
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h
new file mode 100644 (file)
index 0000000..8e42e53
--- /dev/null
@@ -0,0 +1,83 @@
+\r
+/* Class object interface */\r
+\r
+/* Revealing some structures (not for general use) */\r
+\r
+#ifndef Py_CLASSOBJECT_H\r
+#define Py_CLASSOBJECT_H\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+typedef struct {\r
+    PyObject_HEAD\r
+    PyObject   *cl_bases;      /* A tuple of class objects */\r
+    PyObject   *cl_dict;       /* A dictionary */\r
+    PyObject   *cl_name;       /* A string */\r
+    /* The following three are functions or NULL */\r
+    PyObject   *cl_getattr;\r
+    PyObject   *cl_setattr;\r
+    PyObject   *cl_delattr;\r
+    PyObject    *cl_weakreflist; /* List of weak references */\r
+} PyClassObject;\r
+\r
+typedef struct {\r
+    PyObject_HEAD\r
+    PyClassObject *in_class;   /* The class object */\r
+    PyObject     *in_dict;     /* A dictionary */\r
+    PyObject     *in_weakreflist; /* List of weak references */\r
+} PyInstanceObject;\r
+\r
+typedef struct {\r
+    PyObject_HEAD\r
+    PyObject *im_func;   /* The callable object implementing the method */\r
+    PyObject *im_self;   /* The instance it is bound to, or NULL */\r
+    PyObject *im_class;  /* The class that asked for the method */\r
+    PyObject *im_weakreflist; /* List of weak references */\r
+} PyMethodObject;\r
+\r
+PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type;\r
+\r
+#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)\r
+#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)\r
+#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)\r
+\r
+PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);\r
+PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *,\r
+                                            PyObject *);\r
+PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);\r
+PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);\r
+\r
+PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);\r
+\r
+/* Look up attribute with name (a string) on instance object pinst, using\r
+ * only the instance and base class dicts.  If a descriptor is found in\r
+ * a class dict, the descriptor is returned without calling it.\r
+ * Returns NULL if nothing found, else a borrowed reference to the\r
+ * value associated with name in the dict in which name was found.\r
+ * The point of this routine is that it never calls arbitrary Python\r
+ * code, so is always "safe":  all it does is dict lookups.  The function\r
+ * can't fail, never sets an exception, and NULL is not an error (it just\r
+ * means "not found").\r
+ */\r
+PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);\r
+\r
+/* Macros for direct access to these values. Type checks are *not*\r
+   done, so use with care. */\r
+#define PyMethod_GET_FUNCTION(meth) \\r
+        (((PyMethodObject *)meth) -> im_func)\r
+#define PyMethod_GET_SELF(meth) \\r
+       (((PyMethodObject *)meth) -> im_self)\r
+#define PyMethod_GET_CLASS(meth) \\r
+       (((PyMethodObject *)meth) -> im_class)\r
+\r
+PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);\r
+\r
+PyAPI_FUNC(int) PyMethod_ClearFreeList(void);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* !Py_CLASSOBJECT_H */\r