annotate DEPENDENCIES/mingw32/Python27/include/listobject.h @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1
Chris@87 2 /* List object interface */
Chris@87 3
Chris@87 4 /*
Chris@87 5 Another generally useful object type is an list of object pointers.
Chris@87 6 This is a mutable type: the list items can be changed, and items can be
Chris@87 7 added or removed. Out-of-range indices or non-list objects are ignored.
Chris@87 8
Chris@87 9 *** WARNING *** PyList_SetItem does not increment the new item's reference
Chris@87 10 count, but does decrement the reference count of the item it replaces,
Chris@87 11 if not nil. It does *decrement* the reference count if it is *not*
Chris@87 12 inserted in the list. Similarly, PyList_GetItem does not increment the
Chris@87 13 returned item's reference count.
Chris@87 14 */
Chris@87 15
Chris@87 16 #ifndef Py_LISTOBJECT_H
Chris@87 17 #define Py_LISTOBJECT_H
Chris@87 18 #ifdef __cplusplus
Chris@87 19 extern "C" {
Chris@87 20 #endif
Chris@87 21
Chris@87 22 typedef struct {
Chris@87 23 PyObject_VAR_HEAD
Chris@87 24 /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
Chris@87 25 PyObject **ob_item;
Chris@87 26
Chris@87 27 /* ob_item contains space for 'allocated' elements. The number
Chris@87 28 * currently in use is ob_size.
Chris@87 29 * Invariants:
Chris@87 30 * 0 <= ob_size <= allocated
Chris@87 31 * len(list) == ob_size
Chris@87 32 * ob_item == NULL implies ob_size == allocated == 0
Chris@87 33 * list.sort() temporarily sets allocated to -1 to detect mutations.
Chris@87 34 *
Chris@87 35 * Items must normally not be NULL, except during construction when
Chris@87 36 * the list is not yet visible outside the function that builds it.
Chris@87 37 */
Chris@87 38 Py_ssize_t allocated;
Chris@87 39 } PyListObject;
Chris@87 40
Chris@87 41 PyAPI_DATA(PyTypeObject) PyList_Type;
Chris@87 42
Chris@87 43 #define PyList_Check(op) \
Chris@87 44 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
Chris@87 45 #define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
Chris@87 46
Chris@87 47 PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
Chris@87 48 PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
Chris@87 49 PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
Chris@87 50 PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
Chris@87 51 PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
Chris@87 52 PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
Chris@87 53 PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
Chris@87 54 PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
Chris@87 55 PyAPI_FUNC(int) PyList_Sort(PyObject *);
Chris@87 56 PyAPI_FUNC(int) PyList_Reverse(PyObject *);
Chris@87 57 PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
Chris@87 58 PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
Chris@87 59
Chris@87 60 /* Macro, trading safety for speed */
Chris@87 61 #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
Chris@87 62 #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
Chris@87 63 #define PyList_GET_SIZE(op) Py_SIZE(op)
Chris@87 64
Chris@87 65 #ifdef __cplusplus
Chris@87 66 }
Chris@87 67 #endif
Chris@87 68 #endif /* !Py_LISTOBJECT_H */