Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / include / python2.4 / listobject.h
CommitLineData
86530b38
AT
1#ifndef Py_LISTOBJECT_H
2#define Py_LISTOBJECT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7typedef struct {
8 PyObject_VAR_HEAD
9 /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */
10 PyObject **ob_item;
11
12 /* ob_item contains space for 'allocated' elements. The number
13 * currently in use is ob_size.
14 * Invariants:
15 * 0 <= ob_size <= allocated
16 * len(list) == ob_size
17 * ob_item == NULL implies ob_size == allocated == 0
18 * list.sort() temporarily sets allocated to -1 to detect mutations.
19 *
20 * Items must normally not be NULL, except during construction when
21 * the list is not yet visible outside the function that builds it.
22 */
23 int allocated;
24} PyListObject;
25
26PyAPI_DATA(PyTypeObject) PyList_Type;
27
28#define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type)
29#define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type)
30
31PyAPI_FUNC(PyObject *) PyList_New(int size);
32PyAPI_FUNC(int) PyList_Size(PyObject *);
33PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, int);
34PyAPI_FUNC(int) PyList_SetItem(PyObject *, int, PyObject *);
35PyAPI_FUNC(int) PyList_Insert(PyObject *, int, PyObject *);
36PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
37PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, int, int);
38PyAPI_FUNC(int) PyList_SetSlice(PyObject *, int, int, PyObject *);
39PyAPI_FUNC(int) PyList_Sort(PyObject *);
40PyAPI_FUNC(int) PyList_Reverse(PyObject *);
41PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
42PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
43
44/* Macro, trading safety for speed */
45#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
46#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
47#define PyList_GET_SIZE(op) (((PyListObject *)(op))->ob_size)
48
49#ifdef __cplusplus
50}
51#endif
52#endif /* !Py_LISTOBJECT_H */