X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=rset%2Frsisamb.c;h=e7fbe4059448cdd6b3d087afa465f04b76a6a06b;hb=0229bb1ac74706a4e460a11a8a8712b4ea0f2ebe;hp=170a22dfd9cff63f3d9a542e6751310fa6902885;hpb=56131846f59919027a4d3c59efb485afb6efb0de;p=idzebra-moved-to-github.git diff --git a/rset/rsisamb.c b/rset/rsisamb.c index 170a22d..e7fbe40 100644 --- 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 @@ -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 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 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 = @@ -45,7 +44,6 @@ static const struct rset_control control = r_delete, r_open, r_close, - r_rewind, r_forward, r_pos, r_read, @@ -64,10 +62,10 @@ struct rset_isamb_info { 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; @@ -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->pt = isamb_pp_open (info->is, info->pos); + ptinfo->pt = isamb_pp_open (info->is, info->pos, ct->scope ); 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); - 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) @@ -135,11 +131,14 @@ static void r_pos (RSFD rfd, double *current, double *total) #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); - - 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)