1GETHTITEM(3)          MBK HASH TABLE MANAGEMENT FUNCTIONS         GETHTITEM(3)
2
3
4

NAME

6       gethtitem - searches an item in a hash table
7

SYNOPSIS

9       #include "mut.h"
10       int gethtitem(table, key)
11       ht ∗table;
12       void ∗key;
13

PARAMETERS

15       table               Hash table pointer
16
17       key                 Key used by the hash coding function
18

DESCRIPTION

20       gethtitem() searches an item in the hash table pointed to by table.
21

RETURN VALUE

23       If the key key exists, the associated value is returned, if it doesn't,
24       the function returns EMPTYHT.
25

EXAMPLE

27       #include <stdio.h>
28       #include "mut.h"
29       check(p)
30       losig_list *p;
31       {
32       char *amatla;
33       losig_list *ptsig;
34       locon_list *ptcon;
35       ht *h;
36          for (i = 0, ptsig = p->LOSIG; ptsig; i++, ptsig = ptsig->NEXT);
37          h = addht(i);
38          /* two connectors can't have the same name! */
39          for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT)
40             addhtitem(h, ptcon->NAME, 0);
41          for (ptsig = p->LOSIG; ptsig; ptsig = ptsig->NEXT) {
42             if (ptsig->TYPE == INTERNAL) {
43                amatla = getsigname(ptsig);
44                /* this is nicely done with sethtitem! */
45                if (gethtitem(h, amatla) == EMPTYHT) {
46                   printf("N %s;\n", amatla);
47                   addhtitem(h, amatla, 0);
48                }
49             }
50          }
51          delht();
52       }
53

SEE ALSO

55       mbk(1), addht(3), delht(3), addhtitem(3), delhtitem(3), viewht(3).
56
57
58
59
60
61
62ASIM/LIP6                       October 1, 1997                   GETHTITEM(3)
Impressum