2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1994-08-17 13:32:33 adam
8 * Use cache in dict - not in bfile.
10 * Revision 1.1 1994/08/16 16:26:53 adam
20 typedef unsigned Dict_ptr;
21 typedef char Dict_char;
26 Dict_ptr free_list, last;
29 struct Dict_file_block
31 struct Dict_file_block *h_next, **h_prev;
32 struct Dict_file_block *lru_next, *lru_prev;
38 typedef struct Dict_file_struct
43 struct Dict_file_block *all_blocks;
44 struct Dict_file_block *free_list;
45 struct Dict_file_block **hash_array;
47 struct Dict_file_block *lru_back, *lru_front;
55 typedef struct Dict_struct {
57 struct Dict_head head;
60 int dict_bf_readp (Dict_BFile bf, int no, void **bufp);
61 int dict_bf_newp (Dict_BFile bf, int no, void **bufp);
62 int dict_bf_touch (Dict_BFile bf, int no);
63 void dict_bf_flush_blocks (Dict_BFile bf, int no_to_flush);
64 Dict_BFile dict_bf_open (const char *name, int block_size, int cache, int rw);
65 int dict_bf_close (Dict_BFile dbf);
66 #define DICT_MAGIC "dict00"
68 typedef int Dict_info;
70 #define DICT_PAGESIZE 8192
72 Dict dict_open (const char *name, int cache, int rw);
73 int dict_close (Dict dict);
74 int dict_insert (Dict dict, const Dict_char *p, void *userinfo);
75 int dict_lookup (Dict dict, Dict_char *p);
76 int dict_strcmp (const Dict_char *s1, const Dict_char *s2);
77 int dict_strlen (const Dict_char *s);
80 #define DICT_type(x) 0[(Dict_ptr*) x]
81 #define DICT_backptr(x) 1[(Dict_ptr*) x]
82 #define DICT_nextptr(x) 2[(Dict_ptr*) x]
83 #define DICT_nodir(x) 0[(short*)((char*)(x)+3*sizeof(Dict_ptr))]
84 #define DICT_size(x) 1[(short*)((char*)(x)+3*sizeof(Dict_ptr))]
85 #define DICT_info(x) ((char*)(x)+3*sizeof(Dict_ptr)+2*sizeof(short))
87 #define DICT_to_str(x) sizeof(Dict_info)+sizeof(Dict_ptr)
91 backptr pointer to parent
92 nextptr pointer to next page (if any)
94 size size of strings,info,ptr entries