1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2009 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
22 #include <idzebra/util.h>
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 int r_read (RSFD rfd, void *buf, TERMID *term);
29 static int r_write (RSFD rfd, const void *buf);
30 static void r_pos (RSFD rfd, double *current, double *total);
32 static const struct rset_control control =
55 RSET rsisams_create(NMEM nmem, struct rset_key_control *kcontrol,
57 ISAMS is, ISAM_P pos, TERMID term)
59 RSET rnew = rset_create_base(&control, nmem, kcontrol, scope, term, 0, 0);
60 struct rset_private *info;
61 info = (struct rset_private *) nmem_malloc(rnew->nmem, sizeof(*info));
68 static void r_delete (RSET ct)
70 yaz_log (YLOG_DEBUG, "rsisams_delete");
73 RSFD r_open (RSET ct, int flag)
75 struct rset_private *info = (struct rset_private *) ct->priv;
77 struct rfd_private *ptinfo;
79 yaz_log (YLOG_DEBUG, "risams_open");
80 if (flag & RSETF_WRITE)
82 yaz_log (YLOG_FATAL, "ISAMS set type is read-only");
85 rfd = rfd_create_base(ct);
87 ptinfo = (struct rfd_private *)(rfd->priv);
89 ptinfo = (struct rfd_private *) nmem_malloc(ct->nmem,sizeof(*ptinfo));
92 ptinfo->pt = isams_pp_open (info->is, info->pos);
96 static void r_close (RSFD rfd)
98 struct rfd_private *ptinfo = (struct rfd_private *)(rfd->priv);
100 isams_pp_close (ptinfo->pt);
104 static int r_read (RSFD rfd, void *buf, TERMID *term)
106 struct rfd_private *ptinfo = (struct rfd_private *)(rfd->priv);
107 int rc = isams_pp_read(ptinfo->pt, buf);
109 *term = rfd->rset->term;
113 static int r_write (RSFD rfd, const void *buf)
115 yaz_log (YLOG_FATAL, "ISAMS set type is read-only");
119 static void r_pos (RSFD rfd, double *current, double *total)
121 *current=-1; /* sorry, not implemented yet */
129 * c-file-style: "Stroustrup"
130 * indent-tabs-mode: nil
132 * vim: shiftwidth=4 tabstop=8 expandtab