2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.9 1995-09-07 13:58:43 adam
8 * New parameter: result-set file descriptor (RSFD) to support multiple
9 * positions within the same result-set.
10 * Boolean operators: and, or, not implemented.
12 * Revision 1.8 1995/09/06 16:11:56 adam
13 * More work on boolean sets.
15 * Revision 1.7 1995/09/06 10:35:44 adam
16 * Null set implemented.
18 * Revision 1.6 1995/09/05 11:43:24 adam
19 * Complete version of temporary sets. Not tested yet though.
21 * Revision 1.5 1995/09/04 12:33:56 adam
22 * Various cleanup. YAZ util used instead.
24 * Revision 1.4 1995/09/04 09:10:55 adam
27 * Revision 1.3 1994/11/22 13:15:37 quinn
30 * Revision 1.2 1994/11/04 14:53:12 quinn
40 static rset_control *r_create(const struct rset_control *sel, void *parms);
41 static RSFD r_open (rset_control *ct, int wflag);
42 static void r_close (RSFD rfd);
43 static void r_delete (rset_control *ct);
44 static void r_rewind (RSFD rfd);
45 static int r_count (rset_control *ct);
46 static int r_read (RSFD rfd, void *buf);
47 static int r_write (RSFD rfd, const void *buf);
49 static const rset_control control =
63 const rset_control *rset_kind_isam = &control;
65 struct rset_ispt_info {
67 struct rset_ispt_info *next;
68 struct rset_isam_info *info;
71 struct rset_isam_info {
74 struct rset_ispt_info *ispt_list;
77 static rset_control *r_create(const struct rset_control *sel, void *parms)
80 rset_isam_parms *pt = parms;
81 struct rset_isam_info *info;
83 logf (LOG_DEBUG, "rsisam_create(%s)", sel->desc);
84 newct = xmalloc(sizeof(*newct));
85 memcpy(newct, sel, sizeof(*sel));
87 if (!(newct->buf = xmalloc (sizeof(struct rset_isam_info))))
92 info->ispt_list = NULL;
96 RSFD r_open (rset_control *ct, int wflag)
98 struct rset_isam_info *info = ct->buf;
99 struct rset_ispt_info *ptinfo;
101 logf (LOG_DEBUG, "risam_open");
104 logf (LOG_FATAL, "ISAM set type is read-only");
107 ptinfo = xmalloc (sizeof(*ptinfo));
108 ptinfo->next = info->ispt_list;
109 info->ispt_list = ptinfo;
110 ptinfo->pt = is_position (info->is, info->pos);
115 static void r_close (RSFD rfd)
117 struct rset_isam_info *info = ((struct rset_ispt_info*) rfd)->info;
118 struct rset_ispt_info **ptinfop;
120 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
123 is_pt_free ((*ptinfop)->pt);
124 *ptinfop = (*ptinfop)->next;
128 logf (LOG_FATAL, "r_close but no rfd match!");
132 static void r_delete (rset_control *ct)
134 struct rset_isam_info *info = ct->buf;
136 logf (LOG_DEBUG, "rsisam_delete");
137 assert (info->ispt_list == NULL);
142 static void r_rewind (RSFD rfd)
144 logf (LOG_DEBUG, "rsisam_rewind");
145 is_rewind( ((struct rset_ispt_info*) rfd)->pt);
148 static int r_count (rset_control *ct)
153 static int r_read (RSFD rfd, void *buf)
155 return is_readkey( ((struct rset_ispt_info*) rfd)->pt, buf);
158 static int r_write (RSFD rfd, const void *buf)
160 logf (LOG_FATAL, "ISAM set type is read-only");