2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.10 1995-09-08 14:52:42 adam
8 * Work on relevance feedback.
10 * Revision 1.9 1995/09/07 13:58:43 adam
11 * New parameter: result-set file descriptor (RSFD) to support multiple
12 * positions within the same result-set.
13 * Boolean operators: and, or, not implemented.
15 * Revision 1.8 1995/09/06 16:11:56 adam
16 * More work on boolean sets.
18 * Revision 1.7 1995/09/06 10:35:44 adam
19 * Null set implemented.
21 * Revision 1.6 1995/09/05 11:43:24 adam
22 * Complete version of temporary sets. Not tested yet though.
24 * Revision 1.5 1995/09/04 12:33:56 adam
25 * Various cleanup. YAZ util used instead.
27 * Revision 1.4 1995/09/04 09:10:55 adam
30 * Revision 1.3 1994/11/22 13:15:37 quinn
33 * Revision 1.2 1994/11/04 14:53:12 quinn
43 static rset_control *r_create(const struct rset_control *sel, void *parms);
44 static RSFD r_open (rset_control *ct, int wflag);
45 static void r_close (RSFD rfd);
46 static void r_delete (rset_control *ct);
47 static void r_rewind (RSFD rfd);
48 static int r_count (rset_control *ct);
49 static int r_read (RSFD rfd, void *buf);
50 static int r_write (RSFD rfd, const void *buf);
52 static const rset_control control =
66 const rset_control *rset_kind_isam = &control;
68 struct rset_ispt_info {
70 struct rset_ispt_info *next;
71 struct rset_isam_info *info;
74 struct rset_isam_info {
77 struct rset_ispt_info *ispt_list;
80 static rset_control *r_create(const struct rset_control *sel, void *parms)
83 rset_isam_parms *pt = parms;
84 struct rset_isam_info *info;
86 newct = xmalloc(sizeof(*newct));
87 memcpy(newct, sel, sizeof(*sel));
89 if (!(newct->buf = xmalloc (sizeof(struct rset_isam_info))))
94 info->ispt_list = NULL;
98 RSFD r_open (rset_control *ct, int wflag)
100 struct rset_isam_info *info = ct->buf;
101 struct rset_ispt_info *ptinfo;
103 logf (LOG_DEBUG, "risam_open");
106 logf (LOG_FATAL, "ISAM set type is read-only");
109 ptinfo = xmalloc (sizeof(*ptinfo));
110 ptinfo->next = info->ispt_list;
111 info->ispt_list = ptinfo;
112 ptinfo->pt = is_position (info->is, info->pos);
117 static void r_close (RSFD rfd)
119 struct rset_isam_info *info = ((struct rset_ispt_info*) rfd)->info;
120 struct rset_ispt_info **ptinfop;
122 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
125 is_pt_free ((*ptinfop)->pt);
126 *ptinfop = (*ptinfop)->next;
130 logf (LOG_FATAL, "r_close but no rfd match!");
134 static void r_delete (rset_control *ct)
136 struct rset_isam_info *info = ct->buf;
138 logf (LOG_DEBUG, "rsisam_delete");
139 assert (info->ispt_list == NULL);
144 static void r_rewind (RSFD rfd)
146 logf (LOG_DEBUG, "rsisam_rewind");
147 is_rewind( ((struct rset_ispt_info*) rfd)->pt);
150 static int r_count (rset_control *ct)
155 static int r_read (RSFD rfd, void *buf)
157 return is_readkey( ((struct rset_ispt_info*) rfd)->pt, buf);
160 static int r_write (RSFD rfd, const void *buf)
162 logf (LOG_FATAL, "ISAM set type is read-only");