]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Include/tupleobject.h
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 1/5.
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Include / tupleobject.h
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/tupleobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/tupleobject.h
new file mode 100644 (file)
index 0000000..8fdfd59
--- /dev/null
@@ -0,0 +1,61 @@
+\r
+/* Tuple object interface */\r
+\r
+#ifndef Py_TUPLEOBJECT_H\r
+#define Py_TUPLEOBJECT_H\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*\r
+Another generally useful object type is a tuple of object pointers.\r
+For Python, this is an immutable type.  C code can change the tuple items\r
+(but not their number), and even use tuples are general-purpose arrays of\r
+object references, but in general only brand new tuples should be mutated,\r
+not ones that might already have been exposed to Python code.\r
+\r
+*** WARNING *** PyTuple_SetItem does not increment the new item's reference\r
+count, but does decrement the reference count of the item it replaces,\r
+if not nil.  It does *decrement* the reference count if it is *not*\r
+inserted in the tuple.  Similarly, PyTuple_GetItem does not increment the\r
+returned item's reference count.\r
+*/\r
+\r
+typedef struct {\r
+    PyObject_VAR_HEAD\r
+    PyObject *ob_item[1];\r
+\r
+    /* ob_item contains space for 'ob_size' elements.\r
+     * Items must normally not be NULL, except during construction when\r
+     * the tuple is not yet visible outside the function that builds it.\r
+     */\r
+} PyTupleObject;\r
+\r
+PyAPI_DATA(PyTypeObject) PyTuple_Type;\r
+\r
+#define PyTuple_Check(op) \\r
+                 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)\r
+#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type)\r
+\r
+PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);\r
+PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t);\r
+PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *);\r
+PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);\r
+PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);\r
+PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);\r
+PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);\r
+\r
+/* Macro, trading safety for speed */\r
+#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])\r
+#define PyTuple_GET_SIZE(op)    Py_SIZE(op)\r
+\r
+/* Macro, *only* to be used to fill in brand new tuples */\r
+#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)\r
+\r
+PyAPI_FUNC(int) PyTuple_ClearFreeList(void);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* !Py_TUPLEOBJECT_H */\r