2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.11 1995-10-06 14:38:05 adam
8 * New result set method: r_score.
9 * Local no (sysno) and score is transferred to retrieveCtrl.
11 * Revision 1.10 1995/09/08 14:52:42 adam
12 * Work on relevance feedback.
14 * Revision 1.9 1995/09/07 13:58:43 adam
15 * New parameter: result-set file descriptor (RSFD) to support multiple
16 * positions within the same result-set.
17 * Boolean operators: and, or, not implemented.
19 * Revision 1.8 1995/09/06 16:11:56 adam
20 * More work on boolean sets.
22 * Revision 1.7 1995/09/06 10:35:44 adam
23 * Null set implemented.
25 * Revision 1.6 1995/09/05 11:43:24 adam
26 * Complete version of temporary sets. Not tested yet though.
28 * Revision 1.5 1995/09/04 12:33:56 adam
29 * Various cleanup. YAZ util used instead.
31 * Revision 1.4 1995/09/04 09:10:55 adam
34 * Revision 1.3 1994/11/22 13:15:37 quinn
37 * Revision 1.2 1994/11/04 14:53:12 quinn
47 static rset_control *r_create(const struct rset_control *sel, void *parms);
48 static RSFD r_open (rset_control *ct, int wflag);
49 static void r_close (RSFD rfd);
50 static void r_delete (rset_control *ct);
51 static void r_rewind (RSFD rfd);
52 static int r_count (rset_control *ct);
53 static int r_read (RSFD rfd, void *buf);
54 static int r_write (RSFD rfd, const void *buf);
55 static int r_score (RSFD rfd, int *score);
57 static const rset_control control =
72 const rset_control *rset_kind_isam = &control;
74 struct rset_ispt_info {
76 struct rset_ispt_info *next;
77 struct rset_isam_info *info;
80 struct rset_isam_info {
83 struct rset_ispt_info *ispt_list;
86 static rset_control *r_create(const struct rset_control *sel, void *parms)
89 rset_isam_parms *pt = parms;
90 struct rset_isam_info *info;
92 newct = xmalloc(sizeof(*newct));
93 memcpy(newct, sel, sizeof(*sel));
95 if (!(newct->buf = xmalloc (sizeof(struct rset_isam_info))))
100 info->ispt_list = NULL;
104 RSFD r_open (rset_control *ct, int wflag)
106 struct rset_isam_info *info = ct->buf;
107 struct rset_ispt_info *ptinfo;
109 logf (LOG_DEBUG, "risam_open");
112 logf (LOG_FATAL, "ISAM set type is read-only");
115 ptinfo = xmalloc (sizeof(*ptinfo));
116 ptinfo->next = info->ispt_list;
117 info->ispt_list = ptinfo;
118 ptinfo->pt = is_position (info->is, info->pos);
123 static void r_close (RSFD rfd)
125 struct rset_isam_info *info = ((struct rset_ispt_info*) rfd)->info;
126 struct rset_ispt_info **ptinfop;
128 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
131 is_pt_free ((*ptinfop)->pt);
132 *ptinfop = (*ptinfop)->next;
136 logf (LOG_FATAL, "r_close but no rfd match!");
140 static void r_delete (rset_control *ct)
142 struct rset_isam_info *info = ct->buf;
144 logf (LOG_DEBUG, "rsisam_delete");
145 assert (info->ispt_list == NULL);
150 static void r_rewind (RSFD rfd)
152 logf (LOG_DEBUG, "rsisam_rewind");
153 is_rewind( ((struct rset_ispt_info*) rfd)->pt);
156 static int r_count (rset_control *ct)
161 static int r_read (RSFD rfd, void *buf)
163 return is_readkey( ((struct rset_ispt_info*) rfd)->pt, buf);
166 static int r_write (RSFD rfd, const void *buf)
168 logf (LOG_FATAL, "ISAM set type is read-only");
172 static int r_score (RSFD rfd, int *score)