2 * Copyright (C) 1994-1996, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1996-11-08 11:15:57 adam
8 * Compressed isam fully supported.
10 * Revision 1.1 1996/10/29 13:41:48 adam
20 static void *r_create(const struct rset_control *sel, void *parms,
22 static RSFD r_open (RSET ct, int flag);
23 static void r_close (RSFD rfd);
24 static void r_delete (RSET ct);
25 static void r_rewind (RSFD rfd);
26 static int r_count (RSET ct);
27 static int r_read (RSFD rfd, void *buf);
28 static int r_write (RSFD rfd, const void *buf);
29 static int r_score (RSFD rfd, int *score);
31 static const rset_control control =
45 const rset_control *rset_kind_isamc = &control;
49 struct rset_pp_info *next;
50 struct rset_isamc_info *info;
53 struct rset_isamc_info {
56 struct rset_pp_info *ispt_list;
59 static void *r_create(const struct rset_control *sel, void *parms,
62 rset_isamc_parms *pt = parms;
63 struct rset_isamc_info *info;
65 *flags |= RSET_FLAG_VOLATILE;
66 info = xmalloc (sizeof(*info));
69 info->ispt_list = NULL;
73 RSFD r_open (RSET ct, int flag)
75 struct rset_isamc_info *info = ct->buf;
76 struct rset_pp_info *ptinfo;
78 logf (LOG_DEBUG, "risamc_open");
79 if (flag & RSETF_WRITE)
81 logf (LOG_FATAL, "ISAMC set type is read-only");
84 ptinfo = xmalloc (sizeof(*ptinfo));
85 ptinfo->next = info->ispt_list;
86 info->ispt_list = ptinfo;
87 ptinfo->pt = isc_pp_open (info->is, info->pos);
92 static void r_close (RSFD rfd)
94 struct rset_isamc_info *info = ((struct rset_pp_info*) rfd)->info;
95 struct rset_pp_info **ptinfop;
97 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
100 isc_pp_close ((*ptinfop)->pt);
101 *ptinfop = (*ptinfop)->next;
105 logf (LOG_FATAL, "r_close but no rfd match!");
109 static void r_delete (RSET ct)
111 struct rset_isamc_info *info = ct->buf;
113 logf (LOG_DEBUG, "rsisamc_delete");
114 assert (info->ispt_list == NULL);
118 static void r_rewind (RSFD rfd)
120 logf (LOG_DEBUG, "rsisamc_rewind");
124 static int r_count (RSET ct)
129 static int r_read (RSFD rfd, void *buf)
131 return isc_pp_read( ((struct rset_pp_info*) rfd)->pt, buf);
134 static int r_write (RSFD rfd, const void *buf)
136 logf (LOG_FATAL, "ISAMC set type is read-only");
140 static int r_score (RSFD rfd, int *score)