Guido van Rossum | 98bf58f | 2001-10-18 20:34:25 +0000 | [diff] [blame] | 1 | |
| 2 | /* Tuple object interface */ |
| 3 | |
| 4 | #ifndef Py_STRUCTSEQ_H |
| 5 | #define Py_STRUCTSEQ_H |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
Fred Drake | 330f72c | 2002-10-17 19:48:27 +0000 | [diff] [blame] | 9 | |
Guido van Rossum | 98bf58f | 2001-10-18 20:34:25 +0000 | [diff] [blame] | 10 | typedef struct PyStructSequence_Field { |
| 11 | char *name; |
| 12 | char *doc; |
| 13 | } PyStructSequence_Field; |
| 14 | |
| 15 | typedef struct PyStructSequence_Desc { |
| 16 | char *name; |
| 17 | char *doc; |
| 18 | struct PyStructSequence_Field *fields; |
| 19 | int n_in_sequence; |
| 20 | } PyStructSequence_Desc; |
| 21 | |
Martin v. Löwis | f607bda | 2002-10-16 18:27:39 +0000 | [diff] [blame] | 22 | extern char* PyStructSequence_UnnamedField; |
| 23 | |
Fred Drake | 330f72c | 2002-10-17 19:48:27 +0000 | [diff] [blame] | 24 | PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, |
| 25 | PyStructSequence_Desc *desc); |
| 26 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 27 | PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); |
Guido van Rossum | 98bf58f | 2001-10-18 20:34:25 +0000 | [diff] [blame] | 28 | |
| 29 | typedef struct { |
| 30 | PyObject_VAR_HEAD |
| 31 | PyObject *ob_item[1]; |
| 32 | } PyStructSequence; |
| 33 | |
| 34 | /* Macro, *only* to be used to fill in brand new objects */ |
| 35 | #define PyStructSequence_SET_ITEM(op, i, v) \ |
| 36 | (((PyStructSequence *)(op))->ob_item[i] = v) |
| 37 | |
Skip Montanaro | 41cfce9 | 2007-08-24 21:11:00 +0000 | [diff] [blame] | 38 | #define PyStructSequence_GET_ITEM(op, i) \ |
| 39 | (((PyStructSequence *)(op))->ob_item[i]) |
| 40 | |
| 41 | |
Guido van Rossum | 98bf58f | 2001-10-18 20:34:25 +0000 | [diff] [blame] | 42 | #ifdef __cplusplus |
| 43 | } |
| 44 | #endif |
| 45 | #endif /* !Py_STRUCTSEQ_H */ |