X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=rset%2Frsisamb.c;h=cd16cba9abba8f2ebb6d573498663a22104fcd5c;hb=a9eae0225b1a51b0257f80d9da9f95475dd04f53;hp=e4c58e1759fcfb2c24026f8f4543c6b01a2b51df;hpb=230fdc17aa503a23c842cd587f241cfe2fce1c0d;p=idzebra-moved-to-github.git diff --git a/rset/rsisamb.c b/rset/rsisamb.c index e4c58e1..cd16cba 100644 --- a/rset/rsisamb.c +++ b/rset/rsisamb.c @@ -1,4 +1,4 @@ -/* $Id: rsisamb.c,v 1.20 2004-08-31 14:43:42 heikki Exp $ +/* $Id: rsisamb.c,v 1.22 2004-09-09 10:08:06 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -23,9 +23,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include -#include +#include #include -#include <../index/index.h> /* for log_keydump. Debugging only */ #ifndef RSET_DEBUG #define RSET_DEBUG 0 @@ -35,9 +34,7 @@ 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, - int (*cmpfunc)(const void *p1, const void *p2), - const void *untilbuf); +static int r_forward(RSFD rfd, void *buf, const void *untilbuf); static void r_pos (RSFD rfd, double *current, double *total); static int r_read (RSFD rfd, void *buf); static int r_write (RSFD rfd, const void *buf); @@ -65,19 +62,14 @@ struct rset_pp_info { struct rset_isamb_info { ISAMB is; ISAMB_P pos; - int key_size; - int (*cmp)(const void *p1, const void *p2); }; -RSET rsisamb_create( NMEM nmem, int key_size, - int (*cmp)(const void *p1, const void *p2), +RSET rsisamb_create( NMEM nmem, const struct key_control *kcontrol, int scope, ISAMB is, ISAMB_P pos) { - RSET rnew=rset_create_base(&control, nmem); + RSET rnew=rset_create_base(&control, nmem, kcontrol, scope); struct rset_isamb_info *info; info = (struct rset_isamb_info *) nmem_malloc(rnew->nmem,sizeof(*info)); - info->key_size = key_size; - info->cmp = cmp; info->is=is; info->pos=pos; rnew->priv=info; @@ -104,11 +96,11 @@ RSFD r_open (RSET ct, int flag) if (rfd->priv) ptinfo=(struct rset_pp_info *) (rfd->priv); else { - ptinfo = (struct rset_pp_info *) nmem_malloc (ct->nmem,sizeof(*ptinfo)); - ptinfo->buf = nmem_malloc (ct->nmem,info->key_size); + ptinfo = (struct rset_pp_info *)nmem_malloc(ct->nmem,sizeof(*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; } @@ -126,9 +118,7 @@ static void r_rewind (RSFD rfd) abort (); } -static int r_forward(RSFD rfd, void *buf, - int (*cmpfunc)(const void *p1, const void *p2), - const void *untilbuf) +static int r_forward(RSFD rfd, void *buf, const void *untilbuf) { struct rset_pp_info *pinfo=(struct rset_pp_info *)(rfd->priv); return isamb_pp_forward(pinfo->pt, buf, untilbuf);