2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.12 1995-10-10 14:00:04 adam
8 * Function rset_open changed its wflag parameter to general flags.
10 * Revision 1.11 1995/10/06 14:38:05 adam
11 * New result set method: r_score.
12 * Local no (sysno) and score is transferred to retrieveCtrl.
14 * Revision 1.10 1995/09/08 14:52:42 adam
15 * Work on relevance feedback.
17 * Revision 1.9 1995/09/07 13:58:43 adam
18 * New parameter: result-set file descriptor (RSFD) to support multiple
19 * positions within the same result-set.
20 * Boolean operators: and, or, not implemented.
22 * Revision 1.8 1995/09/06 16:11:56 adam
23 * More work on boolean sets.
25 * Revision 1.7 1995/09/06 10:35:44 adam
26 * Null set implemented.
28 * Revision 1.6 1995/09/05 11:43:24 adam
29 * Complete version of temporary sets. Not tested yet though.
31 * Revision 1.5 1995/09/04 12:33:56 adam
32 * Various cleanup. YAZ util used instead.
34 * Revision 1.4 1995/09/04 09:10:55 adam
37 * Revision 1.3 1994/11/22 13:15:37 quinn
40 * Revision 1.2 1994/11/04 14:53:12 quinn
50 static rset_control *r_create(const struct rset_control *sel, void *parms);
51 static RSFD r_open (rset_control *ct, int flag);
52 static void r_close (RSFD rfd);
53 static void r_delete (rset_control *ct);
54 static void r_rewind (RSFD rfd);
55 static int r_count (rset_control *ct);
56 static int r_read (RSFD rfd, void *buf);
57 static int r_write (RSFD rfd, const void *buf);
58 static int r_score (RSFD rfd, int *score);
60 static const rset_control control =
75 const rset_control *rset_kind_isam = &control;
77 struct rset_ispt_info {
79 struct rset_ispt_info *next;
80 struct rset_isam_info *info;
83 struct rset_isam_info {
86 struct rset_ispt_info *ispt_list;
89 static rset_control *r_create(const struct rset_control *sel, void *parms)
92 rset_isam_parms *pt = parms;
93 struct rset_isam_info *info;
95 newct = xmalloc(sizeof(*newct));
96 memcpy(newct, sel, sizeof(*sel));
98 if (!(newct->buf = xmalloc (sizeof(struct rset_isam_info))))
103 info->ispt_list = NULL;
107 RSFD r_open (rset_control *ct, int flag)
109 struct rset_isam_info *info = ct->buf;
110 struct rset_ispt_info *ptinfo;
112 logf (LOG_DEBUG, "risam_open");
113 if (flag & RSETF_WRITE)
115 logf (LOG_FATAL, "ISAM set type is read-only");
118 ptinfo = xmalloc (sizeof(*ptinfo));
119 ptinfo->next = info->ispt_list;
120 info->ispt_list = ptinfo;
121 ptinfo->pt = is_position (info->is, info->pos);
126 static void r_close (RSFD rfd)
128 struct rset_isam_info *info = ((struct rset_ispt_info*) rfd)->info;
129 struct rset_ispt_info **ptinfop;
131 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
134 is_pt_free ((*ptinfop)->pt);
135 *ptinfop = (*ptinfop)->next;
139 logf (LOG_FATAL, "r_close but no rfd match!");
143 static void r_delete (rset_control *ct)
145 struct rset_isam_info *info = ct->buf;
147 logf (LOG_DEBUG, "rsisam_delete");
148 assert (info->ispt_list == NULL);
153 static void r_rewind (RSFD rfd)
155 logf (LOG_DEBUG, "rsisam_rewind");
156 is_rewind( ((struct rset_ispt_info*) rfd)->pt);
159 static int r_count (rset_control *ct)
164 static int r_read (RSFD rfd, void *buf)
166 return is_readkey( ((struct rset_ispt_info*) rfd)->pt, buf);
169 static int r_write (RSFD rfd, const void *buf)
171 logf (LOG_FATAL, "ISAM set type is read-only");
175 static int r_score (RSFD rfd, int *score)