Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 1 | /* |
| 2 | Dictionary object type -- mapping from char * to object. |
| 3 | NB: the key is given as a char *, not as a stringobject. |
| 4 | These functions set errno for errors. Functions dictremove() and |
| 5 | dictinsert() return nonzero for errors, getdictsize() returns -1, |
| 6 | the others NULL. A successful call to dictinsert() calls INCREF() |
| 7 | for the inserted item. |
| 8 | */ |
| 9 | |
| 10 | extern typeobject Dicttype; |
| 11 | |
| 12 | #define is_dictobject(op) ((op)->ob_type == &Dicttype) |
| 13 | |
| 14 | extern object *newdictobject PROTO((void)); |
| 15 | extern object *dictlookup PROTO((object *dp, char *key)); |
| 16 | extern int dictinsert PROTO((object *dp, char *key, object *item)); |
| 17 | extern int dictremove PROTO((object *dp, char *key)); |
| 18 | extern int getdictsize PROTO((object *dp)); |
| 19 | extern char *getdictkey PROTO((object *dp, int i)); |