Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / include / python2.4 / tupleobject.h
CommitLineData
86530b38
AT
1#ifndef Py_TUPLEOBJECT_H
2#define Py_TUPLEOBJECT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7/*
8Another generally useful object type is a tuple of object pointers.
9For Python, this is an immutable type. C code can change the tuple items
10(but not their number), and even use tuples are general-purpose arrays of
11object references, but in general only brand new tuples should be mutated,
12not ones that might already have been exposed to Python code.
13
14*** WARNING *** PyTuple_SetItem does not increment the new item's reference
15count, but does decrement the reference count of the item it replaces,
16if not nil. It does *decrement* the reference count if it is *not*
17inserted in the tuple. Similarly, PyTuple_GetItem does not increment the
18returned item's reference count.
19*/
20
21typedef struct {
22 PyObject_VAR_HEAD
23 PyObject *ob_item[1];
24
25 /* ob_item contains space for 'ob_size' elements.
26 * Items must normally not be NULL, except during construction when
27 * the tuple is not yet visible outside the function that builds it.
28 */
29} PyTupleObject;
30
31PyAPI_DATA(PyTypeObject) PyTuple_Type;
32
33#define PyTuple_Check(op) PyObject_TypeCheck(op, &PyTuple_Type)
34#define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type)
35
36PyAPI_FUNC(PyObject *) PyTuple_New(int size);
37PyAPI_FUNC(int) PyTuple_Size(PyObject *);
38PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, int);
39PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, int, PyObject *);
40PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, int, int);
41PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, int);
42PyAPI_FUNC(PyObject *) PyTuple_Pack(int, ...);
43
44/* Macro, trading safety for speed */
45#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
46#define PyTuple_GET_SIZE(op) (((PyTupleObject *)(op))->ob_size)
47
48/* Macro, *only* to be used to fill in brand new tuples */
49#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
50
51#ifdef __cplusplus
52}
53#endif
54#endif /* !Py_TUPLEOBJECT_H */