blob: 2c5d53949868bf468e47f0e72c2661d375fcd73e [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001/***********************************************************
Guido van Rossum5113f5f1992-04-05 14:20:22 +00002Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
Guido van Rossumf70e43a1991-02-19 12:39:46 +00003Netherlands.
4
5 All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the names of Stichting Mathematisch
12Centrum or CWI not be used in advertising or publicity pertaining to
13distribution of the software without specific, written prior permission.
14
15STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
23******************************************************************/
24
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000025/*
26Dictionary object type -- mapping from char * to object.
27NB: the key is given as a char *, not as a stringobject.
28These functions set errno for errors. Functions dictremove() and
29dictinsert() return nonzero for errors, getdictsize() returns -1,
30the others NULL. A successful call to dictinsert() calls INCREF()
31for the inserted item.
32*/
33
34extern typeobject Dicttype;
35
36#define is_dictobject(op) ((op)->ob_type == &Dicttype)
37
38extern object *newdictobject PROTO((void));
39extern object *dictlookup PROTO((object *dp, char *key));
40extern int dictinsert PROTO((object *dp, char *key, object *item));
41extern int dictremove PROTO((object *dp, char *key));
42extern int getdictsize PROTO((object *dp));
43extern char *getdictkey PROTO((object *dp, int i));
Guido van Rossum6990c941990-10-30 13:27:43 +000044extern object *getdictkeys PROTO((object *dp));
Guido van Rossum88671ae1991-04-03 19:02:06 +000045
Guido van Rossum4b3c1da1991-08-16 09:00:42 +000046extern object *getdict2key PROTO((object *dp, int i));
47extern object *dict2lookup PROTO((object *dp, object *key));
Guido van Rossum88671ae1991-04-03 19:02:06 +000048extern int dict2insert PROTO((object *dp, object *key, object *item));
Guido van Rossum4b3c1da1991-08-16 09:00:42 +000049extern int dict2remove PROTO((object *dp, object *key));