2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.6 1995-12-11 09:04:50 adam
8 * Bug fix: the lookup/scan/lookgrep didn't handle empty dictionary.
10 * Revision 1.5 1995/09/04 09:09:15 adam
11 * String arg in lookup is const.
13 * Revision 1.4 1994/10/05 12:16:51 adam
14 * Pagesize is a resource now.
16 * Revision 1.3 1994/09/26 10:17:25 adam
19 * Revision 1.2 1994/09/16 15:39:14 adam
20 * Initial code of lookup - not tested yet.
22 * Revision 1.1 1994/08/16 16:26:48 adam
34 static char *dict_look (Dict dict, const Dict_char *str)
43 dict_bf_readp (dict->dbf, ptr, &p);
46 indxp = (short*) ((char*) p+DICT_pagesize(dict)-sizeof(short));
52 /* string (Dict_char *) DICT_EOS terminated */
53 /* unsigned char length of information */
54 /* char * information */
55 info = (char*)p + indxp[-mid];
56 cmp = dict_strcmp((Dict_char*) info, str);
58 return info+(dict_strlen (info)+1)*sizeof(Dict_char);
66 /* Dict_char sub char */
67 /* unsigned char length of information */
68 /* char * information */
69 info = (char*)p - indxp[-mid];
70 memcpy (&dc, info+sizeof(Dict_ptr), sizeof(Dict_char));
74 memcpy (&subptr, info, sizeof(Dict_ptr));
75 if (*++str == DICT_EOS)
77 if (info[sizeof(Dict_ptr)+sizeof(Dict_char)])
78 return info+sizeof(Dict_ptr)+sizeof(Dict_char);
86 dict_bf_readp (dict->dbf, ptr, &p);
89 indxp = (short*) ((char*) p+DICT_pagesize(dict)
103 char *dict_lookup (Dict dict, const Dict_char *p)
105 if (dict->head.last <= 1)
107 return dict_look (dict, p);