2 * Copyright (C) 1994-1996, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1997-10-31 12:37:01 adam
8 * Code calls xfree() instead of free().
10 * Revision 1.2 1996/11/08 11:15:57 adam
11 * Compressed isam fully supported.
13 * Revision 1.1 1996/10/29 13:41:48 adam
23 static void *r_create(const struct rset_control *sel, void *parms,
25 static RSFD r_open (RSET ct, int flag);
26 static void r_close (RSFD rfd);
27 static void r_delete (RSET ct);
28 static void r_rewind (RSFD rfd);
29 static int r_count (RSET ct);
30 static int r_read (RSFD rfd, void *buf);
31 static int r_write (RSFD rfd, const void *buf);
32 static int r_score (RSFD rfd, int *score);
34 static const rset_control control =
48 const rset_control *rset_kind_isamc = &control;
52 struct rset_pp_info *next;
53 struct rset_isamc_info *info;
56 struct rset_isamc_info {
59 struct rset_pp_info *ispt_list;
62 static void *r_create(const struct rset_control *sel, void *parms,
65 rset_isamc_parms *pt = parms;
66 struct rset_isamc_info *info;
68 *flags |= RSET_FLAG_VOLATILE;
69 info = xmalloc (sizeof(*info));
72 info->ispt_list = NULL;
76 RSFD r_open (RSET ct, int flag)
78 struct rset_isamc_info *info = ct->buf;
79 struct rset_pp_info *ptinfo;
81 logf (LOG_DEBUG, "risamc_open");
82 if (flag & RSETF_WRITE)
84 logf (LOG_FATAL, "ISAMC set type is read-only");
87 ptinfo = xmalloc (sizeof(*ptinfo));
88 ptinfo->next = info->ispt_list;
89 info->ispt_list = ptinfo;
90 ptinfo->pt = isc_pp_open (info->is, info->pos);
95 static void r_close (RSFD rfd)
97 struct rset_isamc_info *info = ((struct rset_pp_info*) rfd)->info;
98 struct rset_pp_info **ptinfop;
100 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
103 isc_pp_close ((*ptinfop)->pt);
104 *ptinfop = (*ptinfop)->next;
108 logf (LOG_FATAL, "r_close but no rfd match!");
112 static void r_delete (RSET ct)
114 struct rset_isamc_info *info = ct->buf;
116 logf (LOG_DEBUG, "rsisamc_delete");
117 assert (info->ispt_list == NULL);
121 static void r_rewind (RSFD rfd)
123 logf (LOG_DEBUG, "rsisamc_rewind");
127 static int r_count (RSET ct)
132 static int r_read (RSFD rfd, void *buf)
134 return isc_pp_read( ((struct rset_pp_info*) rfd)->pt, buf);
137 static int r_write (RSFD rfd, const void *buf)
139 logf (LOG_FATAL, "ISAMC set type is read-only");
143 static int r_score (RSFD rfd, int *score)