2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.5 1999-02-02 14:50:17 adam
8 * Updated WIN32 code specific sections. Changed header.
10 * Revision 1.4 1996/02/02 13:43:50 adam
11 * The public functions simply use char instead of Dict_char to represent
12 * search strings. Dict_char is used internally only.
14 * Revision 1.3 1995/12/07 11:48:55 adam
15 * Insert operation obeys DICT_type = 1 (slack in page).
16 * Function dict_open exists if page size or magic aren't right.
18 * Revision 1.2 1995/12/06 17:48:30 adam
19 * Bug fix: delete didn't work.
21 * Revision 1.1 1995/12/06 14:52:21 adam
22 * New function: dict_delete.
33 static int dict_del (Dict dict, const Dict_char *str)
42 dict_bf_readp (dict->dbf, ptr, &p);
45 indxp = (short*) ((char*) p+DICT_pagesize(dict)-sizeof(short));
51 /* string (Dict_char *) DICT_EOS terminated */
52 /* unsigned char length of information */
53 /* char * information */
54 info = (char*)p + indxp[-mid];
55 cmp = dict_strcmp((Dict_char*) info, str);
61 indxp[-mid] = indxp[-mid-1];
66 dict_bf_touch (dict->dbf, ptr);
76 /* Dict_char sub char */
77 /* unsigned char length of information */
78 /* char * information */
79 info = (char*)p - indxp[-mid];
80 memcpy (&dc, info+sizeof(Dict_ptr), sizeof(Dict_char));
84 memcpy (&subptr, info, sizeof(Dict_ptr));
85 if (*++str == DICT_EOS)
87 if (info[sizeof(Dict_ptr)+sizeof(Dict_char)])
89 info[sizeof(Dict_ptr)+sizeof(Dict_char)] = 0;
91 dict_bf_touch (dict->dbf, ptr);
101 dict_bf_readp (dict->dbf, ptr, &p);
103 hi = DICT_nodir(p)-1;
104 indxp = (short*) ((char*) p+DICT_pagesize(dict)
118 int dict_delete (Dict dict, const char *p)
120 if (dict->head.last == 1)
122 return dict_del (dict, (const Dict_char*) p);