projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Passing a TERMID to rsets when creating, and getting it back when reading.
[idzebra-moved-to-github.git]
/
rset
/
rsisamb.c
diff --git
a/rset/rsisamb.c
b/rset/rsisamb.c
index
170a22d
..
e7fbe40
100644
(file)
--- a/
rset/rsisamb.c
+++ b/
rset/rsisamb.c
@@
-1,4
+1,4
@@
-/* $Id: rsisamb.c,v 1.21 2004-09-01 15:01:32 heikki Exp $
+/* $Id: rsisamb.c,v 1.24 2004-10-15 10:07:34 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
@@
-33,10
+33,9
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static RSFD r_open (RSET ct, int flag);
static void r_close (RSFD rfd);
static void r_delete (RSET ct);
static RSFD r_open (RSET ct, int flag);
static void r_close (RSFD rfd);
static void r_delete (RSET ct);
-static void r_rewind (RSFD rfd);
-static int r_forward(RSFD rfd, void *buf, const void *untilbuf);
+static int r_forward(RSFD rfd, void *buf, TERMID *term, const void *untilbuf);
static void r_pos (RSFD rfd, double *current, double *total);
static void r_pos (RSFD rfd, double *current, double *total);
-static int r_read (RSFD rfd, void *buf);
+static int r_read (RSFD rfd, void *buf, TERMID *term);
static int r_write (RSFD rfd, const void *buf);
static const struct rset_control control =
static int r_write (RSFD rfd, const void *buf);
static const struct rset_control control =
@@
-45,7
+44,6
@@
static const struct rset_control control =
r_delete,
r_open,
r_close,
r_delete,
r_open,
r_close,
- r_rewind,
r_forward,
r_pos,
r_read,
r_forward,
r_pos,
r_read,
@@
-64,10
+62,10
@@
struct rset_isamb_info {
ISAMB_P pos;
};
ISAMB_P pos;
};
-RSET rsisamb_create( NMEM nmem, const struct key_control *kcontrol,
- ISAMB is, ISAMB_P pos)
+RSET rsisamb_create( NMEM nmem, const struct key_control *kcontrol, int scope,
+ ISAMB is, ISAMB_P pos, TERMID term)
{
{
- RSET rnew=rset_create_base(&control, nmem, kcontrol);
+ RSET rnew=rset_create_base(&control, nmem, kcontrol, scope, term);
struct rset_isamb_info *info;
info = (struct rset_isamb_info *) nmem_malloc(rnew->nmem,sizeof(*info));
info->is=is;
struct rset_isamb_info *info;
info = (struct rset_isamb_info *) nmem_malloc(rnew->nmem,sizeof(*info));
info->is=is;
@@
-100,7
+98,7
@@
RSFD r_open (RSET ct, int flag)
ptinfo->buf = nmem_malloc (ct->nmem,ct->keycontrol->key_size);
rfd->priv=ptinfo;
}
ptinfo->buf = nmem_malloc (ct->nmem,ct->keycontrol->key_size);
rfd->priv=ptinfo;
}
- ptinfo->pt = isamb_pp_open (info->is, info->pos);
+ ptinfo->pt = isamb_pp_open (info->is, info->pos, ct->scope );
return rfd;
}
return rfd;
}
@@
-112,16
+110,14
@@
static void r_close (RSFD rfd)
}
}
-static void r_rewind (RSFD rfd)
-{
- logf (LOG_DEBUG, "rsisamb_rewind");
- abort ();
-}
-
-static int r_forward(RSFD rfd, void *buf, const void *untilbuf)
+static int r_forward(RSFD rfd, void *buf, TERMID *term, const void *untilbuf)
{
struct rset_pp_info *pinfo=(struct rset_pp_info *)(rfd->priv);
{
struct rset_pp_info *pinfo=(struct rset_pp_info *)(rfd->priv);
- return isamb_pp_forward(pinfo->pt, buf, untilbuf);
+ int rc;
+ rc=isamb_pp_forward(pinfo->pt, buf, untilbuf);
+ if (rc && term)
+ *term=rfd->rset->term;
+ return rc;
}
static void r_pos (RSFD rfd, double *current, double *total)
}
static void r_pos (RSFD rfd, double *current, double *total)
@@
-135,11
+131,14
@@
static void r_pos (RSFD rfd, double *current, double *total)
#endif
}
#endif
}
-static int r_read (RSFD rfd, void *buf)
+static int r_read (RSFD rfd, void *buf, TERMID *term)
{
struct rset_pp_info *pinfo=(struct rset_pp_info *)(rfd->priv);
{
struct rset_pp_info *pinfo=(struct rset_pp_info *)(rfd->priv);
-
- return isamb_pp_read(pinfo->pt, buf);
+ int rc;
+ rc=isamb_pp_read(pinfo->pt, buf);
+ if (rc && term)
+ *term=rfd->rset->term;
+ return rc;
}
static int r_write (RSFD rfd, const void *buf)
}
static int r_write (RSFD rfd, const void *buf)