X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=rset%2Frset.c;h=2f4896e1a76391dcba0e08354cde9dbfa7417f02;hb=70ba74c9bbf739fbe82d1bc2b0fb64a547c0c9e0;hp=66164da832f2ea8d13597bdb89bdbfd9e4fd8d1a;hpb=896c0427df9d8eff5de6a1735dcd992e067df844;p=idzebra-moved-to-github.git diff --git a/rset/rset.c b/rset/rset.c index 66164da..2f4896e 100644 --- a/rset/rset.c +++ b/rset/rset.c @@ -1,5 +1,5 @@ -/* $Id: rset.c,v 1.17 2002-08-02 19:26:57 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 +/* $Id: rset.c,v 1.21 2004-08-03 14:54:41 heikki Exp $ + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps This file is part of the Zebra server. @@ -25,8 +25,10 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include +#include #include +#include <../index/index.h> /* for log_keydump. Debugging only */ RSET rset_create(const struct rset_control *sel, void *parms) { @@ -63,6 +65,39 @@ RSET rset_dup (RSET rs) return rs; } +void rset_default_pos (RSFD rfd, int *current, int *total) +{ /* FIXME - This function should not be needed, only while */ + /* coding the pos functions. */ + assert(rfd); + assert(current); + assert(total); + *current=-1; /* signal that pos is not implemented */ + *total=-1; +} /* rset_default_pos */ + +int rset_default_forward(RSET ct, RSFD rfd, void *buf, int *term_index, + int (*cmpfunc)(const void *p1, const void *p2), + const void *untilbuf) +{ + int more=1; + int cmp=2; + logf (LOG_DEBUG, "rset_default_forward starting '%s' (ct=%p rfd=%p)", + ct->control->desc, ct,rfd); + key_logdump(LOG_DEBUG, untilbuf); + while ( (cmp==2) && (more)) + { + logf (LOG_DEBUG, "rset_default_forward looping m=%d c=%d",more,cmp); + more=rset_read(ct, rfd, buf, term_index); + if (more) + cmp=(*cmpfunc)(untilbuf,buf); + if (more) + key_logdump(LOG_DEBUG,buf); + } + logf (LOG_DEBUG, "rset_default_forward exiting m=%d c=%d",more,cmp); + + return more; +} + RSET_TERM *rset_terms(RSET rs, int *no) { *no = rs->no_rset_terms;