1 /* This file is part of the Zebra server.
2 Copyright (C) Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <idzebra/util.h>
28 static RSFD r_open (RSET ct, int flag);
29 static void r_close (RSFD rfd);
30 static void r_delete (RSET ct);
31 static int r_read (RSFD rfd, void *buf, TERMID *term);
32 static void r_pos (RSFD rfd, double *current, double *total);
34 static const struct rset_control control =
57 RSET rsisams_create(NMEM nmem, struct rset_key_control *kcontrol,
59 ISAMS is, ISAM_P pos, TERMID term)
61 RSET rnew = rset_create_base(&control, nmem, kcontrol, scope, term, 0, 0);
62 struct rset_private *info;
63 info = (struct rset_private *) nmem_malloc(rnew->nmem, sizeof(*info));
70 static void r_delete (RSET ct)
72 yaz_log (YLOG_DEBUG, "rsisams_delete");
75 RSFD r_open (RSET ct, int flag)
77 struct rset_private *info = (struct rset_private *) ct->priv;
79 struct rfd_private *ptinfo;
81 yaz_log (YLOG_DEBUG, "risams_open");
82 if (flag & RSETF_WRITE)
84 yaz_log (YLOG_FATAL, "ISAMS set type is read-only");
87 rfd = rfd_create_base(ct);
89 ptinfo = (struct rfd_private *)(rfd->priv);
91 ptinfo = (struct rfd_private *) nmem_malloc(ct->nmem,sizeof(*ptinfo));
94 ptinfo->pt = isams_pp_open (info->is, info->pos);
98 static void r_close (RSFD rfd)
100 struct rfd_private *ptinfo = (struct rfd_private *)(rfd->priv);
102 isams_pp_close (ptinfo->pt);
106 static int r_read (RSFD rfd, void *buf, TERMID *term)
108 struct rfd_private *ptinfo = (struct rfd_private *)(rfd->priv);
109 int rc = isams_pp_read(ptinfo->pt, buf);
111 *term = rfd->rset->term;
115 static void r_pos (RSFD rfd, double *current, double *total)
117 *current=-1; /* sorry, not implemented yet */
125 * c-file-style: "Stroustrup"
126 * indent-tabs-mode: nil
128 * vim: shiftwidth=4 tabstop=8 expandtab