2 * Copyright (C) 1994-1996, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1996-10-29 13:41:48 adam
17 static void *r_create(const struct rset_control *sel, void *parms,
19 static RSFD r_open (RSET ct, int flag);
20 static void r_close (RSFD rfd);
21 static void r_delete (RSET ct);
22 static void r_rewind (RSFD rfd);
23 static int r_count (RSET ct);
24 static int r_read (RSFD rfd, void *buf);
25 static int r_write (RSFD rfd, const void *buf);
26 static int r_score (RSFD rfd, int *score);
28 static const rset_control control =
42 const rset_control *rset_kind_isamc = &control;
46 struct rset_pp_info *next;
47 struct rset_isamc_info *info;
50 struct rset_isamc_info {
53 struct rset_pp_info *ispt_list;
56 static void *r_create(const struct rset_control *sel, void *parms,
59 rset_isamc_parms *pt = parms;
60 struct rset_isamc_info *info;
62 *flags |= RSET_FLAG_VOLATILE;
63 info = xmalloc (sizeof(*info));
66 info->ispt_list = NULL;
70 RSFD r_open (RSET ct, int flag)
72 struct rset_isamc_info *info = ct->buf;
73 struct rset_pp_info *ptinfo;
75 logf (LOG_DEBUG, "risamc_open");
76 if (flag & RSETF_WRITE)
78 logf (LOG_FATAL, "ISAMC set type is read-only");
81 ptinfo = xmalloc (sizeof(*ptinfo));
82 ptinfo->next = info->ispt_list;
83 info->ispt_list = ptinfo;
84 ptinfo->pt = isc_pp_open (info->is, info->pos);
89 static void r_close (RSFD rfd)
91 struct rset_isamc_info *info = ((struct rset_pp_info*) rfd)->info;
92 struct rset_pp_info **ptinfop;
94 for (ptinfop = &info->ispt_list; *ptinfop; ptinfop = &(*ptinfop)->next)
97 isc_pp_close ((*ptinfop)->pt);
98 *ptinfop = (*ptinfop)->next;
102 logf (LOG_FATAL, "r_close but no rfd match!");
106 static void r_delete (RSET ct)
108 struct rset_isamc_info *info = ct->buf;
110 logf (LOG_DEBUG, "rsisamc_delete");
111 assert (info->ispt_list == NULL);
115 static void r_rewind (RSFD rfd)
117 logf (LOG_DEBUG, "rsisamc_rewind");
121 static int r_count (RSET ct)
126 static int r_read (RSFD rfd, void *buf)
128 return isc_read_key( ((struct rset_pp_info*) rfd)->pt, buf);
131 static int r_write (RSFD rfd, const void *buf)
133 logf (LOG_FATAL, "ISAMC set type is read-only");
137 static int r_score (RSFD rfd, int *score)