35 short *from_indxp, *to_indxp;
36 char *from_info, *to_info;
38 from_indxp = (
short*) ((
char*) from_p+
DICT_bsize(from_p));
39 to_indxp = (
short*) ((
char*) to_p+
DICT_bsize(to_p));
43 if (*--from_indxp > 0)
49 from_info = (
char*) from_p + *from_indxp;
50 *--to_indxp = to_info - to_p;
52 memcpy(to_info, from_info, slen);
65 *--to_indxp = -(to_info - to_p);
66 from_info = (
char*) from_p - *from_indxp;
68 memcpy(&subptr, from_info,
sizeof(subptr));
71 memcpy(&subchar, from_info,
sizeof(subchar));
74 memcpy(to_info, &subptr,
sizeof(
Dict_ptr));
76 memcpy(to_info, &subchar,
sizeof(
Dict_char));
79 assert(to_info < (
char*) to_indxp);
81 memcpy(to_info, from_info, slen);
93 Dict dict_from, dict_to;
95 dict_from =
dict_open(bfs, from_name, 0, 0, 0, 4096);
98 map = (
int *) xmalloc((dict_from->
head.
last+1) *
sizeof(*map));
99 for (i = 0; i <= (int)(dict_from->
head.
last); i++)
101 dict_to =
dict_open(bfs, to_name, 0, 1, 1, 4096);
107 for (i = 1; i < (int) (dict_from->
head.
last); i++)
112 yaz_log(YLOG_LOG,
"map[%d] = %d", i, map[i]);
115 size = ((
DICT_size(buf)+
sizeof(short)-1)/
sizeof(short) +
117 map[i+1] = map[i] + size;
121 yaz_log(YLOG_LOG,
"map[%d] = %d", i, map[i]);
122 yaz_log(YLOG_LOG,
"nodir = %d", no_dir);
126 for (i = 1; i< (int) (dict_from->
head.
last); i++)
131 yaz_log(YLOG_LOG,
"dict_bf_newp no=%d size=%d", map[i],
static void dict_copy_page(Dict dict, char *to_p, char *from_p, int *map)
int dict_copy_compact(BFiles bfs, const char *from_name, const char *to_name)
copies one dictionary to another
int dict_bf_readp(Dict_BFile bf, int no, void **bufp)
int dict_strlen(const Dict_char *s)
int dict_bf_newp(Dict_BFile bf, int no, void **bufp, int nbytes)
Dict dict_open(BFiles bfs, const char *name, int cache, int rw, int compact_flag, int page_size)
open dictionary
int dict_close(Dict dict)
closes dictionary