blob: 140e336f633f199a12e7f34e9a9990c1d3d35744 [file] [log] [blame]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001/*
2Dictionary object type -- mapping from char * to object.
3NB: the key is given as a char *, not as a stringobject.
4These functions set errno for errors. Functions dictremove() and
5dictinsert() return nonzero for errors, getdictsize() returns -1,
6the others NULL. A successful call to dictinsert() calls INCREF()
7for the inserted item.
8*/
9
10extern typeobject Dicttype;
11
12#define is_dictobject(op) ((op)->ob_type == &Dicttype)
13
14extern object *newdictobject PROTO((void));
15extern object *dictlookup PROTO((object *dp, char *key));
16extern int dictinsert PROTO((object *dp, char *key, object *item));
17extern int dictremove PROTO((object *dp, char *key));
18extern int getdictsize PROTO((object *dp));
19extern char *getdictkey PROTO((object *dp, int i));
20
21/* New interface with (string)object * instead of char * arguments */
22extern object *dict2lookup PROTO((object *dp, object *key));
23extern int dict2insert PROTO((object *dp, object *key, object *item));
24extern int dict2remove PROTO((object *dp, object *key));
25extern object *getdict2key PROTO((object *dp, int i));