Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame^] | 1 | /* List object interface */ |
| 2 | |
| 3 | /* |
| 4 | 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12 |
| 5 | |
| 6 | Another generally useful object type is an list of object pointers. |
| 7 | This is a mutable type: the list items can be changed, and items can be |
| 8 | added or removed. Out-of-range indices or non-list objects are ignored. |
| 9 | |
| 10 | *** WARNING *** setlistitem does not increment the new item's reference |
| 11 | count, but does decrement the reference count of the item it replaces, |
| 12 | if not nil. It does *decrement* the reference count if it is *not* |
| 13 | inserted in the list. Similarly, getlistitem does not increment the |
| 14 | returned item's reference count. |
| 15 | */ |
| 16 | |
| 17 | extern typeobject Listtype; |
| 18 | |
| 19 | #define is_listobject(op) ((op)->ob_type == &Listtype) |
| 20 | |
| 21 | extern object *newlistobject PROTO((int size)); |
| 22 | extern int getlistsize PROTO((object *)); |
| 23 | extern object *getlistitem PROTO((object *, int)); |
| 24 | extern int setlistitem PROTO((object *, int, object *)); |
| 25 | extern int inslistitem PROTO((object *, int, object *)); |
| 26 | extern int addlistitem PROTO((object *, object *)); |