2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1996-02-02 13:43:50 adam
8 * The public functions simply use char instead of Dict_char to represent
9 * search strings. Dict_char is used internally only.
11 * Revision 1.3 1995/12/07 11:48:55 adam
12 * Insert operation obeys DICT_type = 1 (slack in page).
13 * Function dict_open exists if page size or magic aren't right.
15 * Revision 1.2 1995/12/06 17:48:30 adam
16 * Bug fix: delete didn't work.
18 * Revision 1.1 1995/12/06 14:52:21 adam
19 * New function: dict_delete.
30 static int dict_del (Dict dict, const Dict_char *str)
39 dict_bf_readp (dict->dbf, ptr, &p);
42 indxp = (short*) ((char*) p+DICT_pagesize(dict)-sizeof(short));
48 /* string (Dict_char *) DICT_EOS terminated */
49 /* unsigned char length of information */
50 /* char * information */
51 info = (char*)p + indxp[-mid];
52 cmp = dict_strcmp((Dict_char*) info, str);
58 indxp[-mid] = indxp[-mid-1];
63 dict_bf_touch (dict->dbf, ptr);
73 /* Dict_char sub char */
74 /* unsigned char length of information */
75 /* char * information */
76 info = (char*)p - indxp[-mid];
77 memcpy (&dc, info+sizeof(Dict_ptr), sizeof(Dict_char));
81 memcpy (&subptr, info, sizeof(Dict_ptr));
82 if (*++str == DICT_EOS)
84 if (info[sizeof(Dict_ptr)+sizeof(Dict_char)])
86 info[sizeof(Dict_ptr)+sizeof(Dict_char)] = 0;
88 dict_bf_touch (dict->dbf, ptr);
98 dict_bf_readp (dict->dbf, ptr, &p);
100 hi = DICT_nodir(p)-1;
101 indxp = (short*) ((char*) p+DICT_pagesize(dict)
115 int dict_delete (Dict dict, const char *p)
117 if (dict->head.last == 1)
119 return dict_del (dict, (const Dict_char*) p);