X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=isamb%2Ftstisamb.c;h=3ea1d926c56e780be4df886094d1d427498629e8;hb=4da0cd2978c9a902be772e95302e6522175402fd;hp=a2c9140f092b05c1f639fd195ead51e9c26b923b;hpb=ae2d0647bd3a555df77397b6c2f9c129fda0733a;p=idzebra-moved-to-github.git diff --git a/isamb/tstisamb.c b/isamb/tstisamb.c index a2c9140..3ea1d92 100644 --- a/isamb/tstisamb.c +++ b/isamb/tstisamb.c @@ -1,5 +1,5 @@ -/* $Id: tstisamb.c,v 1.1 2003-06-23 15:36:11 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 +/* $Id: tstisamb.c,v 1.8 2004-08-04 08:35:24 adam Exp $ + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps This file is part of the Zebra server. @@ -26,6 +26,18 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include +static void log_item(int level, const void *b, const char *txt) +{ + int x; + memcpy(&x, b, sizeof(int)); + yaz_log(LOG_DEBUG, "%s %d", txt, x); +} + +static void log_pr(const char *txt) +{ + yaz_log(LOG_DEBUG, "%s", txt); +} + int compare_item(const void *a, const void *b) { int ia, ib; @@ -35,12 +47,12 @@ int compare_item(const void *a, const void *b) return ia - ib; } -void *code_start(int mode) +void *code_start() { return 0; } -void code_item(int mode, void *p, char **dst, char **src) +void code_item(void *p, char **dst, const char **src) { memcpy (*dst, *src, sizeof(int)); (*dst) += sizeof(int); @@ -50,7 +62,7 @@ void code_item(int mode, void *p, char **dst, char **src) void code_reset(void *p) { } -void code_stop(int mode, void *p) +void code_stop(void *p) { } @@ -77,6 +89,60 @@ int code_read(void *vp, char **dst, int *insertMode) return 1; } +void tst_forward(ISAMB isb, int n) +{ + ISAMC_I isamc_i; + ISAMC_P isamc_p; + struct read_info ri; + int i; + ISAMB_PP pp; + + /* insert a number of entries */ + ri.no = 0; + ri.max = n; + + isamc_i.clientData = &ri; + isamc_i.read_item = code_read; + + isamc_p = isamb_merge (isb, 0 /* new list */ , &isamc_i); + + /* read the entries */ + pp = isamb_pp_open (isb, isamc_p); + + for (i = 0; i