32 int start,
int *count,
void *client,
33 int (*userfunc)(
char *,
const char *,
int,
void *),
52 indxp = (
short*) ((
char*) p+
DICT_bsize(p)-
sizeof(short));
54 while (lo <= hi && lo >= 0 && *count > 0)
62 info = (
char*)p + indxp[-lo];
63 for (j = 0; info[j] !=
DICT_EOS; j++)
66 if ((*userfunc)((
char*) str, info+(j+1)*
sizeof(
Dict_char),
67 *count * dir, client))
84 info = (
char*)p - indxp[-lo];
87 memcpy(&subptr, info,
sizeof(
Dict_ptr));
91 if ((*userfunc)((
char*) str,
93 *count * dir, client))
100 if (*count>0 && subptr)
103 client, userfunc, dir);
105 indxp = (
short*) ((
char*) p+
DICT_bsize(p)-
sizeof(short));
110 if ((*userfunc)((
char*) str,
112 *count * dir, client))
125 int *before,
int *after,
void *client,
126 int (*userfunc)(
char *,
const char *,
int,
void *))
128 int cmp = 0, mid, lo, hi;
138 indxp = (
short*) ((
char*) p+
DICT_bsize(p)-
sizeof(short));
147 info = (
char*)p + indxp[-mid];
153 if ((*userfunc)((
char *) str, info+
175 info = (
char*)p - indxp[-mid];
180 memcpy(&subptr, info,
sizeof(
Dict_ptr));
187 if ((*userfunc)((
char*) str,
198 if (*after && subptr)
200 after, client, userfunc, 1);
212 if ((*userfunc)((
char*) str,
232 if (lo>hi && cmp < 0)
236 client, userfunc, 1);
237 if (*before && mid > 0)
239 client, userfunc, -1);
243 int (*f)(
char *name,
const char *info,
int pos,
void *client))
247 yaz_log(YLOG_DEBUG,
"dict_scan");
248 for (i = 0; str[i]; i++)
250 yaz_log(YLOG_DEBUG,
"start_term pos %d %3d %c", i, str[i],
251 (str[i] >
' ' && str[i] < 127) ? str[i] :
'?');
256 before, after, client, f);
int dict_bf_readp(Dict_BFile bf, int no, void **bufp)
int dict_strlen(const Dict_char *s)
int dict_strcmp(const Dict_char *s1, const Dict_char *s2)
void dict_scan_r(Dict dict, Dict_ptr ptr, int pos, Dict_char *str, int *before, int *after, void *client, int(*userfunc)(char *, const char *, int, void *))
static void scan_direction(Dict dict, Dict_ptr ptr, int pos, Dict_char *str, int start, int *count, void *client, int(*userfunc)(char *, const char *, int, void *), int dir)
int dict_scan(Dict dict, char *str, int *before, int *after, void *client, int(*f)(char *name, const char *info, int pos, void *client))
dictionary scan