From ecf94fc25324414287d3bbfbeba4440e558edd17 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 13 Apr 2005 13:03:47 +0000 Subject: [PATCH] Get rid of typedefs iSAMS_P, ISAMC_P, ISAMB_P and use ISAM_P instead. --- include/idzebra/isamb.h | 13 +++++------ include/idzebra/isamc.h | 32 ++++++++++++++------------ include/idzebra/isams.h | 7 +++--- include/rset.h | 8 +++---- index/index.h | 4 ++-- index/invstat.c | 30 ++++++++++++------------ index/kcompare.c | 4 ++-- index/kinput.c | 34 +++++++++++++++------------ index/trunc.c | 42 +++++++++++++++++----------------- index/zebraapi.c | 10 ++++---- index/zrpn.c | 16 ++++++------- isamb/isamb.c | 58 +++++++++++++++++++++++------------------------ isamb/tstisamb.c | 26 +++++++++++---------- isamc/isamc.c | 48 +++++++++++++++++++-------------------- isamc/merge.c | 52 +++++++++++++++++++++--------------------- isams/isams.c | 6 ++--- rset/rsisamb.c | 8 +++---- rset/rsisamc.c | 14 ++++++------ rset/rsisams.c | 8 +++---- 19 files changed, 213 insertions(+), 207 deletions(-) diff --git a/include/idzebra/isamb.h b/include/idzebra/isamb.h index 1e5e98a..142bd3f 100644 --- a/include/idzebra/isamb.h +++ b/include/idzebra/isamb.h @@ -1,4 +1,4 @@ -/* $Id: isamb.h,v 1.4 2005-03-08 14:02:08 adam Exp $ +/* $Id: isamb.h,v 1.5 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -30,7 +30,6 @@ YAZ_BEGIN_CDECL typedef struct ISAMB_s *ISAMB; typedef struct ISAMB_PP_s *ISAMB_PP; -typedef ISAMC_P ISAMB_P; YAZ_EXPORT ISAMB isamb_open(BFiles bfs, const char *name, int writeflag, ISAMC_M *method, @@ -40,10 +39,10 @@ YAZ_EXPORT void isamb_close(ISAMB isamb); YAZ_EXPORT -ISAMB_P isamb_merge(ISAMB b, ISAMB_P pos, ISAMC_I *data); +void isamb_merge(ISAMB b, ISAM_P *pos, ISAMC_I *data); YAZ_EXPORT -ISAMB_PP isamb_pp_open(ISAMB isamb, ISAMB_P pos, int scope); +ISAMB_PP isamb_pp_open(ISAMB isamb, ISAM_P pos, int scope); YAZ_EXPORT int isamb_pp_read(ISAMB_PP pp, void *buf); @@ -60,10 +59,10 @@ YAZ_EXPORT void isamb_pp_close(ISAMB_PP pp); YAZ_EXPORT -int isamb_unlink(ISAMB b, ISAMC_P pos); +int isamb_unlink(ISAMB b, ISAM_P pos); YAZ_EXPORT -ISAMB_PP isamb_pp_open_x(ISAMB isamb, ISAMB_P pos, int *level, int scope); +ISAMB_PP isamb_pp_open_x(ISAMB isamb, ISAM_P pos, int *level, int scope); YAZ_EXPORT void isamb_pp_close_x(ISAMB_PP pp, zint *size, zint *blocks); @@ -71,7 +70,7 @@ YAZ_EXPORT int isamb_block_info(ISAMB isamb, int cat); YAZ_EXPORT -void isamb_dump(ISAMB b, ISAMB_P pos, void (*pr)(const char *str)); +void isamb_dump(ISAMB b, ISAM_P pos, void (*pr)(const char *str)); YAZ_END_CDECL diff --git a/include/idzebra/isamc.h b/include/idzebra/isamc.h index 2ea23b6..ccb5644 100644 --- a/include/idzebra/isamc.h +++ b/include/idzebra/isamc.h @@ -1,4 +1,4 @@ -/* $Id: isamc.h,v 1.2 2005-01-15 19:38:24 adam Exp $ +/* $Id: isamc.h,v 1.3 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -28,8 +28,9 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA YAZ_BEGIN_CDECL +typedef zint ISAM_P; + typedef struct ISAMC_s *ISAMC; -typedef zint ISAMC_P; typedef struct ISAMC_PP_s *ISAMC_PP; typedef struct ISAMC_filecat_s { @@ -56,23 +57,24 @@ typedef struct ISAMC_I_s { void *clientData; } ISAMC_I; -void isc_getmethod (ISAMC_M *m); +void isamc_getmethod (ISAMC_M *m); -ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method); -int isc_close (ISAMC is); -ISAMC_P isc_merge (ISAMC is, ISAMC_P pos, ISAMC_I *data); +ISAMC isamc_open (BFiles bfs, const char *name, int writeflag, + ISAMC_M *method); +int isamc_close (ISAMC is); +void isamc_merge (ISAMC is, ISAM_P *pos, ISAMC_I *data); -ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P pos); -void isc_pp_close (ISAMC_PP pp); -int isc_read_item (ISAMC_PP pp, char **dst); -int isc_pp_read (ISAMC_PP pp, void *buf); -zint isc_pp_num (ISAMC_PP pp); +ISAMC_PP isamc_pp_open (ISAMC is, ISAM_P pos); +void isamc_pp_close (ISAMC_PP pp); +int isamc_read_item (ISAMC_PP pp, char **dst); +int isamc_pp_read (ISAMC_PP pp, void *buf); +zint isamc_pp_num (ISAMC_PP pp); -zint isc_block_used (ISAMC is, int type); -int isc_block_size (ISAMC is, int type); +zint isamc_block_used (ISAMC is, int type); +int isamc_block_size (ISAMC is, int type); -#define isc_type(x) ((x) & 7) -#define isc_block(x) ((x) >> 3) +#define isamc_type(x) ((x) & 7) +#define isamc_block(x) ((x) >> 3) YAZ_END_CDECL diff --git a/include/idzebra/isams.h b/include/idzebra/isams.h index f811c30..8f85bf0 100644 --- a/include/idzebra/isams.h +++ b/include/idzebra/isams.h @@ -1,4 +1,4 @@ -/* $Id: isams.h,v 1.2 2005-01-15 19:38:24 adam Exp $ +/* $Id: isams.h,v 1.3 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -31,7 +31,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA YAZ_BEGIN_CDECL typedef struct ISAMS_s *ISAMS; -typedef ISAMC_P ISAMS_P; typedef struct ISAMS_PP_s *ISAMS_PP; typedef struct ISAMS_M_s { @@ -54,8 +53,8 @@ void isams_getmethod (ISAMS_M *me); ISAMS isams_open (BFiles bfs, const char *name, int writeflag, ISAMS_M *method); int isams_close (ISAMS is); -ISAMS_P isams_merge (ISAMS is, ISAMS_I data); -ISAMS_PP isams_pp_open (ISAMS is, ISAMS_P pos); +ISAM_P isams_merge (ISAMS is, ISAMS_I data); +ISAMS_PP isams_pp_open (ISAMS is, ISAM_P pos); void isams_pp_close (ISAMS_PP pp); int isams_read_item (ISAMS_PP pp, char **dst); int isams_pp_read (ISAMS_PP pp, void *buf); diff --git a/include/rset.h b/include/rset.h index 87b47ae..8892855 100644 --- a/include/rset.h +++ b/include/rset.h @@ -1,4 +1,4 @@ -/* $Id: rset.h,v 1.47 2005-01-17 01:21:43 adam Exp $ +/* $Id: rset.h,v 1.48 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -240,13 +240,13 @@ RSET rsprox_create(NMEM nmem, const struct key_control *kcontrol, int ordered, int exclusion, int relation, int distance); RSET rsisamb_create(NMEM nmem, const struct key_control *kcontrol, - int scope, ISAMB is, ISAMB_P pos, TERMID term); + int scope, ISAMB is, ISAM_P pos, TERMID term); RSET rsisamc_create(NMEM nmem, const struct key_control *kcontrol, - int scope, ISAMC is, ISAMC_P pos, TERMID term); + int scope, ISAMC is, ISAM_P pos, TERMID term); RSET rsisams_create(NMEM nmem, const struct key_control *kcontrol, - int scope, ISAMS is, ISAMS_P pos, TERMID term); + int scope, ISAMS is, ISAM_P pos, TERMID term); YAZ_END_CDECL diff --git a/index/index.h b/index/index.h index 5fdc519..8e7b995 100644 --- a/index/index.h +++ b/index/index.h @@ -1,4 +1,4 @@ -/* $Id: index.h,v 1.131 2005-03-30 09:25:23 adam Exp $ +/* $Id: index.h,v 1.132 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -346,7 +346,7 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, int *position, int *num_entries, ZebraScanEntry **list, int *is_partial, RSET limit_set, int return_zero); -RSET rset_trunc (ZebraHandle zh, ISAMS_P *isam_p, int no, +RSET rset_trunc (ZebraHandle zh, ISAM_P *isam_p, int no, const char *term, int length_term, const char *flags, int preserve_position, int term_type, NMEM rset_nmem, const struct key_control *kctrl, int scope); diff --git a/index/invstat.c b/index/invstat.c index 4f87064..bd8037d 100644 --- a/index/invstat.c +++ b/index/invstat.c @@ -1,4 +1,4 @@ -/* $Id: invstat.c,v 1.45 2005-03-09 12:14:42 adam Exp $ +/* $Id: invstat.c,v 1.46 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -74,7 +74,7 @@ static int inv_stat_handle (char *name, const char *info, int pos, zint occur = 0; int i = 0; struct inv_stat_info *stat_info = (struct inv_stat_info*) client; - ISAMS_P isam_p; + ISAM_P isam_p; int firstsys=-1; int firstseq=-1; int lastsys=-1; @@ -83,8 +83,8 @@ static int inv_stat_handle (char *name, const char *info, int pos, stat_info->no_dict_entries++; stat_info->no_dict_bytes += strlen(name); - assert (*info == sizeof(ISAMS_P)); - memcpy (&isam_p, info+1, sizeof(ISAMS_P)); + assert (*info == sizeof(ISAM_P)); + memcpy (&isam_p, info+1, sizeof(ISAM_P)); if (stat_info->zh->reg->isams) { @@ -108,15 +108,15 @@ static int inv_stat_handle (char *name, const char *info, int pos, zint occurx = 0; struct it_key key; - pp = isc_pp_open (stat_info->zh->reg->isamc, isam_p); - occur = isc_pp_num (pp); - while (isc_pp_read(pp, &key)) + pp = isamc_pp_open (stat_info->zh->reg->isamc, isam_p); + occur = isamc_pp_num (pp); + while (isamc_pp_read(pp, &key)) { occurx++; } assert (occurx == occur); - stat_info->no_isam_entries[isc_type(isam_p)] += occur; - isc_pp_close (pp); + stat_info->no_isam_entries[isamc_type(isam_p)] += occur; + isamc_pp_close (pp); } if (stat_info->zh->reg->isamb) { @@ -213,19 +213,19 @@ int zebra_register_statistics (ZebraHandle zh, int dumpdict) if (zh->reg->isamc) { fprintf (stdout, " Blocks Occur Size KB Bytes/Entry\n"); - for (i = 0; isc_block_used (zh->reg->isamc, i) >= 0; i++) + for (i = 0; isamc_block_used (zh->reg->isamc, i) >= 0; i++) { fprintf (stdout, " %8" ZINT_FORMAT0 " %8" ZINT_FORMAT0, - isc_block_used (zh->reg->isamc, i), + isamc_block_used (zh->reg->isamc, i), stat_info.no_isam_entries[i]); if (stat_info.no_isam_entries[i]) fprintf (stdout, " %8d %f", (int) ((1023.0 + (double) - isc_block_used(zh->reg->isamc, i) * - isc_block_size(zh->reg->isamc,i))/1024), - ((double) isc_block_used(zh->reg->isamc, i) * - isc_block_size(zh->reg->isamc,i))/ + isamc_block_used(zh->reg->isamc, i) * + isamc_block_size(zh->reg->isamc,i))/1024), + ((double) isamc_block_used(zh->reg->isamc, i) * + isamc_block_size(zh->reg->isamc,i))/ stat_info.no_isam_entries[i]); fprintf (stdout, "\n"); } diff --git a/index/kcompare.c b/index/kcompare.c index 94ebb50..b53c516 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -1,4 +1,4 @@ -/* $Id: kcompare.c,v 1.55 2005-01-15 19:38:25 adam Exp $ +/* $Id: kcompare.c,v 1.56 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -281,7 +281,7 @@ ISAMS_M *key_isams_m (Res res, ISAMS_M *me) ISAMC_M *key_isamc_m (Res res, ISAMC_M *me) { - isc_getmethod (me); + isamc_getmethod (me); me->compare_item = key_compare; me->log_item = key_logdump_txt; diff --git a/index/kinput.c b/index/kinput.c index aca8fe9..cc464c2 100644 --- a/index/kinput.c +++ b/index/kinput.c @@ -1,4 +1,4 @@ -/* $Id: kinput.c,v 1.64 2005-01-15 19:38:26 adam Exp $ +/* $Id: kinput.c,v 1.65 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -546,7 +546,7 @@ int heap_inpc (struct heap_info *hi) while (hci.more) { char this_name[INP_NAME_MAX]; - ISAMC_P isamc_p, isamc_p2; + ISAM_P isamc_p, isamc_p2; char *dict_info; strcpy (this_name, hci.cur_name); @@ -554,8 +554,9 @@ int heap_inpc (struct heap_info *hi) hi->no_diffs++; if ((dict_info = dict_lookup (hi->reg->dict, hci.cur_name))) { - memcpy (&isamc_p, dict_info+1, sizeof(ISAMC_P)); - isamc_p2 = isc_merge (hi->reg->isamc, isamc_p, isamc_i); + memcpy (&isamc_p, dict_info+1, sizeof(ISAM_P)); + isamc_p2 = isamc_p; + isamc_merge (hi->reg->isamc, &isamc_p2, isamc_i); if (!isamc_p2) { hi->no_deletions++; @@ -567,14 +568,15 @@ int heap_inpc (struct heap_info *hi) hi->no_updates++; if (isamc_p2 != isamc_p) dict_insert (hi->reg->dict, this_name, - sizeof(ISAMC_P), &isamc_p2); + sizeof(ISAM_P), &isamc_p2); } } else { - isamc_p = isc_merge (hi->reg->isamc, 0, isamc_i); + isamc_p = 0; + isamc_merge (hi->reg->isamc, &isamc_p, isamc_i); hi->no_insertions++; - dict_insert (hi->reg->dict, this_name, sizeof(ISAMC_P), &isamc_p); + dict_insert (hi->reg->dict, this_name, sizeof(ISAM_P), &isamc_p); } } xfree (isamc_i); @@ -626,7 +628,7 @@ int heap_inpb (struct heap_info *hi) while (hci.more) { char this_name[INP_NAME_MAX]; - ISAMC_P isamc_p, isamc_p2; + ISAM_P isamc_p, isamc_p2; char *dict_info; strcpy (this_name, hci.cur_name); @@ -638,8 +640,9 @@ int heap_inpb (struct heap_info *hi) #endif if ((dict_info = dict_lookup (hi->reg->dict, hci.cur_name))) { - memcpy (&isamc_p, dict_info+1, sizeof(ISAMC_P)); - isamc_p2 = isamb_merge (hi->reg->isamb, isamc_p, isamc_i); + memcpy (&isamc_p, dict_info+1, sizeof(ISAM_P)); + isamc_p2 = isamc_p; + isamb_merge (hi->reg->isamb, &isamc_p2, isamc_i); if (!isamc_p2) { hi->no_deletions++; @@ -651,14 +654,15 @@ int heap_inpb (struct heap_info *hi) hi->no_updates++; if (isamc_p2 != isamc_p) dict_insert (hi->reg->dict, this_name, - sizeof(ISAMC_P), &isamc_p2); + sizeof(ISAM_P), &isamc_p2); } } else { - isamc_p = isamb_merge (hi->reg->isamb, 0, isamc_i); + isamc_p = 0; + isamb_merge (hi->reg->isamb, &isamc_p, isamc_i); hi->no_insertions++; - dict_insert (hi->reg->dict, this_name, sizeof(ISAMC_P), &isamc_p); + dict_insert (hi->reg->dict, this_name, sizeof(ISAM_P), &isamc_p); } } xfree (isamc_i); @@ -687,7 +691,7 @@ int heap_inps (struct heap_info *hi) while (hci.more) { char this_name[INP_NAME_MAX]; - ISAMS_P isams_p; + ISAM_P isams_p; char *dict_info; strcpy (this_name, hci.cur_name); @@ -697,7 +701,7 @@ int heap_inps (struct heap_info *hi) { isams_p = isams_merge (hi->reg->isams, isams_i); hi->no_insertions++; - dict_insert (hi->reg->dict, this_name, sizeof(ISAMS_P), &isams_p); + dict_insert (hi->reg->dict, this_name, sizeof(ISAM_P), &isams_p); } else { diff --git a/index/trunc.c b/index/trunc.c index f64f12b..9dc70af 100644 --- a/index/trunc.c +++ b/index/trunc.c @@ -1,4 +1,4 @@ -/* $Id: trunc.c,v 1.51 2005-01-15 20:47:15 adam Exp $ +/* $Id: trunc.c,v 1.52 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -123,12 +123,12 @@ static void heap_close (struct trunc_info *ti) xfree(ti); } -static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, - const char *flags, ISAMS_P *isam_p, int from, int to, - int merge_chunk, int preserve_position, - int term_type, NMEM rset_nmem, - const struct key_control *kctrl, int scope, - TERMID termid) +static RSET rset_trunc_r(ZebraHandle zi, const char *term, int length, + const char *flags, ISAM_P *isam_p, int from, int to, + int merge_chunk, int preserve_position, + int term_type, NMEM rset_nmem, + const struct key_control *kctrl, int scope, + TERMID termid) { RSET result; RSFD result_rsfd; @@ -225,11 +225,11 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, key_compare_it); for (i = to-from; --i >= 0; ) { - ispt[i] = isc_pp_open (zi->reg->isamc, isam_p[from+i]); - if (isc_pp_read (ispt[i], ti->tmpbuf)) + ispt[i] = isamc_pp_open (zi->reg->isamc, isam_p[from+i]); + if (isamc_pp_read (ispt[i], ti->tmpbuf)) heap_insert (ti, ti->tmpbuf, i); else - isc_pp_close (ispt[i]); + isamc_pp_close (ispt[i]); } while (ti->heapnum) { @@ -240,19 +240,19 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, if (preserve_position) { heap_delete (ti); - if (isc_pp_read (ispt[n], ti->tmpbuf)) + if (isamc_pp_read (ispt[n], ti->tmpbuf)) heap_insert (ti, ti->tmpbuf, n); else - isc_pp_close (ispt[n]); + isamc_pp_close (ispt[n]); } else { while (1) { - if (!isc_pp_read (ispt[n], ti->tmpbuf)) + if (!isamc_pp_read (ispt[n], ti->tmpbuf)) { heap_delete (ti); - isc_pp_close (ispt[n]); + isamc_pp_close (ispt[n]); break; } if ((*ti->cmp)(ti->tmpbuf, ti->heap[ti->ptr[1]]) > 1) @@ -377,8 +377,8 @@ static RSET rset_trunc_r (ZebraHandle zi, const char *term, int length, static int isams_trunc_cmp (const void *p1, const void *p2) { - ISAMS_P i1 = *(ISAMS_P*) p1; - ISAMS_P i2 = *(ISAMS_P*) p2; + ISAM_P i1 = *(ISAM_P*) p1; + ISAM_P i2 = *(ISAM_P*) p2; if (i1 > i2) return 1; @@ -389,13 +389,13 @@ static int isams_trunc_cmp (const void *p1, const void *p2) static int isamc_trunc_cmp (const void *p1, const void *p2) { - ISAMC_P i1 = *(ISAMC_P*) p1; - ISAMC_P i2 = *(ISAMC_P*) p2; + ISAM_P i1 = *(ISAM_P*) p1; + ISAM_P i2 = *(ISAM_P*) p2; zint d; - d = (isc_type (i1) - isc_type (i2)); + d = (isamc_type (i1) - isamc_type (i2)); if (d == 0) - d = isc_block (i1) - isc_block (i2); + d = isamc_block (i1) - isamc_block (i2); if (d > 0) return 1; else if (d < 0) @@ -403,7 +403,7 @@ static int isamc_trunc_cmp (const void *p1, const void *p2) return 0; } -RSET rset_trunc (ZebraHandle zi, ISAMS_P *isam_p, int no, +RSET rset_trunc (ZebraHandle zi, ISAM_P *isam_p, int no, const char *term, int length, const char *flags, int preserve_position, int term_type, NMEM rset_nmem, const struct key_control *kctrl, int scope) diff --git a/index/zebraapi.c b/index/zebraapi.c index e6530e7..f3165d5 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.157 2005-04-13 08:52:27 adam Exp $ +/* $Id: zebraapi.c,v 1.158 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -345,10 +345,10 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, if (res_get_match (res, "isam", "c", ISAM_DEFAULT)) { struct ISAMC_M_s isamc_m; - if (!(reg->isamc = isc_open (reg->bfs, FNAME_ISAMC, + if (!(reg->isamc = isamc_open (reg->bfs, FNAME_ISAMC, rw, key_isamc_m(res, &isamc_m)))) { - yaz_log (YLOG_WARN, "isc_open failed"); + yaz_log (YLOG_WARN, "isamc_open failed"); return 0; } } @@ -439,7 +439,7 @@ static void zebra_register_close (ZebraService zs, struct zebra_register *reg) if (reg->isams) isams_close (reg->isams); if (reg->isamc) - isc_close (reg->isamc); + isamc_close (reg->isamc); if (reg->isamb) isamb_close (reg->isamb); rec_close (®->records); @@ -1243,7 +1243,7 @@ int zebra_admin_exchange_record (ZebraHandle zh, int delete_w_handle(const char *info, void *handle) { ZebraHandle zh = (ZebraHandle) handle; - ISAMC_P pos; + ISAM_P pos; ASSERTZH; if (*info == sizeof(pos)) diff --git a/index/zrpn.c b/index/zrpn.c index a9882c6..caccbcd 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.172 2005-04-13 08:52:01 adam Exp $ +/* $Id: zrpn.c,v 1.173 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -180,7 +180,7 @@ struct grep_info { #ifdef TERM_COUNT int *term_no; #endif - ISAMC_P *isam_p_buf; + ISAM_P *isam_p_buf; int isam_p_size; int isam_p_indx; ZebraHandle zh; @@ -215,13 +215,13 @@ static void add_isam_p(const char *name, const char *info, } if (p->isam_p_indx == p->isam_p_size) { - ISAMC_P *new_isam_p_buf; + ISAM_P *new_isam_p_buf; #ifdef TERM_COUNT int *new_term_no; #endif p->isam_p_size = 2*p->isam_p_size + 100; - new_isam_p_buf = (ISAMC_P *) xmalloc(sizeof(*new_isam_p_buf) * - p->isam_p_size); + new_isam_p_buf = (ISAM_P *) xmalloc(sizeof(*new_isam_p_buf) * + p->isam_p_size); if (p->isam_p_buf) { memcpy(new_isam_p_buf, p->isam_p_buf, @@ -2406,7 +2406,7 @@ RSET rpn_search(ZebraHandle zh, NMEM nmem, NMEM rset_nmem, struct scan_info_entry { char *term; - ISAMC_P isam_p; + ISAM_P isam_p; }; struct scan_info { @@ -2430,8 +2430,8 @@ static int scan_handle (char *name, const char *info, int pos, void *client) scan_info->list[idx].term = (char *) odr_malloc(scan_info->odr, strlen(name + len_prefix)+1); strcpy(scan_info->list[idx].term, name + len_prefix); - assert (*info == sizeof(ISAMC_P)); - memcpy (&scan_info->list[idx].isam_p, info+1, sizeof(ISAMC_P)); + assert (*info == sizeof(ISAM_P)); + memcpy (&scan_info->list[idx].isam_p, info+1, sizeof(ISAM_P)); return 0; } diff --git a/isamb/isamb.c b/isamb/isamb.c index af6d202..294683d 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -1,4 +1,4 @@ -/* $Id: isamb.c,v 1.75 2005-03-21 17:20:54 adam Exp $ +/* $Id: isamb.c,v 1.76 2005-04-13 13:03:47 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -72,7 +72,7 @@ struct ISAMB_head { #define ISAMB_PTR_CODEC 1 struct ISAMB_cache_entry { - ISAMB_P pos; + ISAM_P pos; unsigned char *buf; int dirty; int hits; @@ -102,7 +102,7 @@ struct ISAMB_s { }; struct ISAMB_block { - ISAMB_P pos; + ISAM_P pos; int cat; int size; int leaf; @@ -119,7 +119,7 @@ struct ISAMB_block { struct ISAMB_PP_s { ISAMB isamb; - ISAMB_P pos; + ISAM_P pos; int level; int maxlevel; /* total depth */ zint total_size; @@ -181,7 +181,7 @@ static void decode_ptr(const char **src, zint *pos) #endif ISAMB isamb_open(BFiles bfs, const char *name, int writeflag, ISAMC_M *method, - int cache) + int cache) { ISAMB isamb = xmalloc(sizeof(*isamb)); int i, b_size = ISAMB_MIN_SIZE; @@ -299,7 +299,7 @@ static void flush_blocks (ISAMB b, int cat) } } -static int cache_block (ISAMB b, ISAMC_P pos, char *userbuf, int wr) +static int cache_block (ISAMB b, ISAM_P pos, char *userbuf, int wr) { int cat = (int) (pos&CAT_MASK); int off = (int) (((pos/CAT_MAX) & @@ -432,7 +432,7 @@ void isamb_close (ISAMB isamb) * Reserve 5 bytes for large block sizes. 1 for small ones .. Number of items. We can thus have at most 2^40 nodes. */ -static struct ISAMB_block *open_block(ISAMB b, ISAMC_P pos) +static struct ISAMB_block *open_block(ISAMB b, ISAM_P pos) { int cat = (int) (pos&CAT_MASK); const char *src; @@ -544,7 +544,7 @@ static void check_block (ISAMB b, struct ISAMB_block *p) char *startp = p->bytes; const char *src = startp; char *endp = p->bytes + p->size; - ISAMB_P pos; + ISAM_P pos; void *c1 = (*b->method->codec.start)(); decode_ptr(&src, &pos); @@ -628,7 +628,7 @@ int insert_int (ISAMB b, struct ISAMB_block *p, void *lookahead_item, char *startp = p->bytes; const char *src = startp; char *endp = p->bytes + p->size; - ISAMB_P pos; + ISAM_P pos; struct ISAMB_block *sub_p1 = 0, *sub_p2 = 0; char sub_item[DST_ITEM_MAX]; int sub_size; @@ -1108,7 +1108,7 @@ int insert_sub (ISAMB b, struct ISAMB_block **p, void *new_item, sub_size, max_item); } -int isamb_unlink (ISAMB b, ISAMC_P pos) +int isamb_unlink (ISAMB b, ISAM_P pos) { struct ISAMB_block *p1; @@ -1149,7 +1149,7 @@ int isamb_unlink (ISAMB b, ISAMC_P pos) return 0; } -ISAMB_P isamb_merge (ISAMB b, ISAMC_P pos, ISAMC_I *stream) +void isamb_merge(ISAMB b, ISAM_P *pos, ISAMC_I *stream) { char item_buf[DST_ITEM_MAX]; char *item_ptr; @@ -1166,7 +1166,8 @@ ISAMB_P isamb_merge (ISAMB b, ISAMC_P pos, ISAMC_I *stream) more = (*stream->read_item)(stream->clientData, &item_ptr, &i_mode); } - return 1; + *pos = 1; + return; } item_ptr = item_buf; more = (*stream->read_item)(stream->clientData, &item_ptr, &i_mode); @@ -1176,8 +1177,8 @@ ISAMB_P isamb_merge (ISAMB b, ISAMC_P pos, ISAMC_I *stream) char sub_item[DST_ITEM_MAX]; int sub_size; - if (pos) - p = open_block(b, pos); + if (*pos) + p = open_block(b, *pos); more = insert_sub (b, &p, item_buf, &i_mode, stream, &sp, sub_item, &sub_size, 0); if (sp) @@ -1203,7 +1204,7 @@ ISAMB_P isamb_merge (ISAMB b, ISAMC_P pos, ISAMC_I *stream) p2->size = dst - p2->bytes; p2->no_items = p->no_items + sp->no_items; - pos = p2->pos; /* return new super page */ + *pos = p2->pos; /* return new super page */ close_block(b, sp); close_block(b, p2); #if INT_ENCODE @@ -1212,7 +1213,7 @@ ISAMB_P isamb_merge (ISAMB b, ISAMC_P pos, ISAMC_I *stream) } else { - pos = p->pos; /* return current one (again) */ + *pos = p->pos; /* return current one (again) */ } if (p->no_items == 0) must_delete = 1; @@ -1222,13 +1223,12 @@ ISAMB_P isamb_merge (ISAMB b, ISAMC_P pos, ISAMC_I *stream) } if (must_delete) { - isamb_unlink(b, pos); - return 0; + isamb_unlink(b, *pos); + *pos = 0; } - return pos; } -ISAMB_PP isamb_pp_open_x(ISAMB isamb, ISAMB_P pos, int *level, int scope) +ISAMB_PP isamb_pp_open_x(ISAMB isamb, ISAM_P pos, int *level, int scope) { ISAMB_PP pp = xmalloc(sizeof(*pp)); int i; @@ -1270,7 +1270,7 @@ ISAMB_PP isamb_pp_open_x(ISAMB isamb, ISAMB_P pos, int *level, int scope) return pp; } -ISAMB_PP isamb_pp_open (ISAMB isamb, ISAMB_P pos, int scope) +ISAMB_PP isamb_pp_open (ISAMB isamb, ISAM_P pos, int scope) { return isamb_pp_open_x(isamb, pos, 0, scope); } @@ -1318,7 +1318,7 @@ void isamb_pp_close (ISAMB_PP pp) } /* simple recursive dumper .. */ -static void isamb_dump_r (ISAMB b, ISAMB_P pos, void (*pr)(const char *str), +static void isamb_dump_r (ISAMB b, ISAM_P pos, void (*pr)(const char *str), int level) { char buf[1024]; @@ -1347,7 +1347,7 @@ static void isamb_dump_r (ISAMB b, ISAMB_P pos, void (*pr)(const char *str), else { const char *src = p->bytes + p->offset; - ISAMB_P sub; + ISAM_P sub; decode_ptr(&src, &sub); p->offset = src - (char*) p->bytes; @@ -1380,7 +1380,7 @@ static void isamb_dump_r (ISAMB b, ISAMB_P pos, void (*pr)(const char *str), } } -void isamb_dump(ISAMB b, ISAMB_P pos, void (*pr)(const char *str)) +void isamb_dump(ISAMB b, ISAM_P pos, void (*pr)(const char *str)) { isamb_dump_r(b, pos, pr, 0); } @@ -1514,7 +1514,7 @@ static int isamb_pp_forward_on_leaf(ISAMB_PP pp, void *buf, const void *untilbuf } } /* forward_on_leaf */ -static int isamb_pp_climb_level(ISAMB_PP pp, ISAMB_P *pos) +static int isamb_pp_climb_level(ISAMB_PP pp, ISAM_P *pos) { /* climbs higher in the tree, until finds a level with data left */ /* returns the node to (consider to) descend to in *pos) */ struct ISAMB_block *p = pp->block[pp->level]; @@ -1654,7 +1654,7 @@ static zint isamb_pp_forward_unode(ISAMB_PP pp, zint pos, const void *untilbuf) } /* forward_unode */ -static void isamb_pp_descend_to_leaf(ISAMB_PP pp, ISAMB_P pos, +static void isamb_pp_descend_to_leaf(ISAMB_PP pp, ISAM_P pos, const void *untilbuf) { /* climbs down the tree, from pos, to the leftmost leaf */ struct ISAMB_block *p = pp->block[pp->level]; @@ -1694,7 +1694,7 @@ static void isamb_pp_descend_to_leaf(ISAMB_PP pp, ISAMB_P pos, static int isamb_pp_find_next_leaf(ISAMB_PP pp) { /* finds the next leaf by climbing up and down */ - ISAMB_P pos; + ISAM_P pos; if (!isamb_pp_climb_level(pp, &pos)) return 0; isamb_pp_descend_to_leaf(pp, pos, 0); @@ -1703,7 +1703,7 @@ static int isamb_pp_find_next_leaf(ISAMB_PP pp) static int isamb_pp_climb_desc(ISAMB_PP pp, const void *untilbuf) { /* climbs up and descends to a leaf where values >= *untilbuf are found */ - ISAMB_P pos; + ISAM_P pos; #if ISAMB_DEBUG struct ISAMB_block *p = pp->block[pp->level]; yaz_log(YLOG_DEBUG, "isamb_pp_climb_desc starting " @@ -1823,7 +1823,7 @@ int isamb_pp_forward2(ISAMB_PP pp, void *buf, const void *untilb) again: while (p->offset == p->size) { - ISAMB_P pos; + ISAM_P pos; #if INT_ENCODE const char *src_0; void *c1; diff --git a/isamb/tstisamb.c b/isamb/tstisamb.c index 5adb3e8..d815089 100644 --- a/isamb/tstisamb.c +++ b/isamb/tstisamb.c @@ -1,4 +1,4 @@ -/* $Id: tstisamb.c,v 1.19 2005-03-21 17:20:54 adam Exp $ +/* $Id: tstisamb.c,v 1.20 2005-04-13 13:03:48 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -97,7 +97,7 @@ int code_read(void *vp, char **dst, int *insertMode) void tst_insert(ISAMB isb, int n) { ISAMC_I isamc_i; - ISAMC_P isamc_p; + ISAM_P isamc_p; struct read_info ri; ISAMB_PP pp; char key_buf[10]; @@ -112,7 +112,8 @@ void tst_insert(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - isamc_p = isamb_merge (isb, 0 /* new list */ , &isamc_i); + isamc_p = 0; /* new list */ + isamb_merge (isb, &isamc_p , &isamc_i); /* read the entries */ pp = isamb_pp_open (isb, isamc_p, 1); @@ -153,7 +154,7 @@ void tst_insert(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - isamc_p = isamb_merge (isb, isamc_p , &isamc_i); + isamb_merge (isb, &isamc_p , &isamc_i); /* delete a number of entries (odd ones) */ ri.no = 1; @@ -164,7 +165,7 @@ void tst_insert(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - isamc_p = isamb_merge (isb, isamc_p , &isamc_i); + isamb_merge (isb, &isamc_p, &isamc_i); if (isamc_p) { @@ -176,7 +177,7 @@ void tst_insert(ISAMB isb, int n) void tst_forward(ISAMB isb, int n) { ISAMC_I isamc_i; - ISAMC_P isamc_p; + ISAM_P isamc_p; struct read_info ri; int i; ISAMB_PP pp; @@ -190,7 +191,8 @@ void tst_forward(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - isamc_p = isamb_merge (isb, 0 /* new list */ , &isamc_i); + isamc_p = 0; + isamb_merge (isb, &isamc_p, &isamc_i); /* read the entries */ pp = isamb_pp_open (isb, isamc_p, 1); @@ -232,7 +234,7 @@ void tst_forward(ISAMB isb, int n) void tst_x(ISAMB isb) { ISAMC_I isamc_i; - ISAMB_P isamb_p = 0; + ISAM_P isamb_p = 0; struct read_info ri; isamc_i.clientData = &ri; @@ -241,19 +243,19 @@ void tst_x(ISAMB isb) ri.step = 1; ri.max = 1500; - isamb_p = isamb_merge (isb, isamb_p , &isamc_i); + isamb_merge (isb, &isamb_p , &isamc_i); ri.no = 1; ri.step = 1; ri.max = 500; - isamb_p = isamb_merge (isb, isamb_p , &isamc_i); + isamb_merge (isb, &isamb_p , &isamc_i); } void tst_append(ISAMB isb, int n) { ISAMC_I isamc_i; - ISAMB_P isamb_p = 0; + ISAM_P isamb_p = 0; struct read_info ri; int i; int chunk = 10; @@ -269,7 +271,7 @@ void tst_append(ISAMB isb, int n) isamc_i.clientData = &ri; isamc_i.read_item = code_read; - isamb_p = isamb_merge (isb, isamb_p , &isamc_i); + isamb_merge (isb, &isamb_p , &isamc_i); } } diff --git a/isamc/isamc.c b/isamc/isamc.c index d1819b2..61949c4 100644 --- a/isamc/isamc.c +++ b/isamc/isamc.c @@ -1,4 +1,4 @@ -/* $Id: isamc.c,v 1.29 2005-01-15 19:38:31 adam Exp $ +/* $Id: isamc.c,v 1.30 2005-04-13 13:03:48 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -22,7 +22,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* * TODO: - * Reduction to lower categories in isc_merge + * Reduction to lower categories in isamc_merge */ #include #include @@ -41,7 +41,7 @@ static void init_fc (ISAMC is, int cat); #define SMALL_TEST 0 -void isc_getmethod (ISAMC_M *m) +void isamc_getmethod (ISAMC_M *m) { static struct ISAMC_filecat_s def_cat[] = { @@ -73,7 +73,7 @@ void isc_getmethod (ISAMC_M *m) m->max_blocks_mem = 10; } -ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method) +ISAMC isamc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method) { ISAMC is; ISAMC_filecat filecat; @@ -154,14 +154,14 @@ ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M *method) return is; } -zint isc_block_used (ISAMC is, int type) +zint isamc_block_used (ISAMC is, int type) { if (type < 0 || type >= is->no_files) return -1; return is->files[type].head.lastblock-1; } -int isc_block_size (ISAMC is, int type) +int isamc_block_size (ISAMC is, int type) { ISAMC_filecat filecat = is->method->filecat; if (type < 0 || type >= is->no_files) @@ -169,7 +169,7 @@ int isc_block_size (ISAMC is, int type) return filecat[type].bsize; } -int isc_close (ISAMC is) +int isamc_close (ISAMC is) { int i; @@ -217,13 +217,13 @@ int isc_close (ISAMC is) return 0; } -int isc_read_block (ISAMC is, int cat, zint pos, char *dst) +int isamc_read_block (ISAMC is, int cat, zint pos, char *dst) { ++(is->files[cat].no_reads); return bf_read (is->files[cat].bf, pos, 0, 0, dst); } -int isc_write_block (ISAMC is, int cat, zint pos, char *src) +int isamc_write_block (ISAMC is, int cat, zint pos, char *src) { ++(is->files[cat].no_writes); if (is->method->debug > 2) @@ -231,7 +231,7 @@ int isc_write_block (ISAMC is, int cat, zint pos, char *src) return bf_write (is->files[cat].bf, pos, 0, 0, src); } -int isc_write_dblock (ISAMC is, int cat, zint pos, char *src, +int isamc_write_dblock (ISAMC is, int cat, zint pos, char *src, zint nextpos, int offset) { ISAMC_BLOCK_SIZE size = offset + ISAMC_BLOCK_OFFSET_N; @@ -241,7 +241,7 @@ int isc_write_dblock (ISAMC is, int cat, zint pos, char *src, src -= ISAMC_BLOCK_OFFSET_N; memcpy (src, &nextpos, sizeof(nextpos)); memcpy (src + sizeof(nextpos), &size, sizeof(size)); - return isc_write_block (is, cat, pos, src); + return isamc_write_block (is, cat, pos, src); } #if ISAMC_FREELIST_CHUNK @@ -376,7 +376,7 @@ static void release_block (ISAMC is, int cat, zint pos) } #endif -zint isc_alloc_block (ISAMC is, int cat) +zint isamc_alloc_block (ISAMC is, int cat) { zint block = 0; @@ -399,7 +399,7 @@ zint isc_alloc_block (ISAMC is, int cat) return block; } -void isc_release_block (ISAMC is, int cat, zint pos) +void isamc_release_block (ISAMC is, int cat, zint pos) { if (is->method->debug > 3) yaz_log (YLOG_LOG, "isc: release_block in cat %d:" ZINT_FORMAT, cat, pos); @@ -440,7 +440,7 @@ static void release_fc (ISAMC is, int cat) } } -void isc_pp_close (ISAMC_PP pp) +void isamc_pp_close (ISAMC_PP pp) { ISAMC is = pp->is; @@ -449,13 +449,13 @@ void isc_pp_close (ISAMC_PP pp) xfree (pp); } -ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P ipos) +ISAMC_PP isamc_pp_open (ISAMC is, ISAM_P ipos) { ISAMC_PP pp = (ISAMC_PP) xmalloc (sizeof(*pp)); char *src; - pp->cat = (int) isc_type(ipos); - pp->pos = isc_block(ipos); + pp->cat = (int) isamc_type(ipos); + pp->pos = isamc_block(ipos); src = pp->buf = (char *) xmalloc (is->method->filecat[pp->cat].bsize); @@ -470,7 +470,7 @@ ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P ipos) if (pp->pos) { src = pp->buf; - isc_read_block (is, pp->cat, pp->pos, src); + isamc_read_block (is, pp->cat, pp->pos, src); memcpy (&pp->next, src, sizeof(pp->next)); src += sizeof(pp->next); memcpy (&pp->size, src, sizeof(pp->size)); @@ -493,10 +493,10 @@ ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P ipos) } /* returns non-zero if item could be read; 0 otherwise */ -int isc_pp_read (ISAMC_PP pp, void *buf) +int isamc_pp_read (ISAMC_PP pp, void *buf) { char *cp = buf; - return isc_read_item (pp, &cp); + return isamc_read_item (pp, &cp); } /* read one item from file - decode and store it in *dst. @@ -504,7 +504,7 @@ int isc_pp_read (ISAMC_PP pp, void *buf) 0 if end-of-file 1 if item could be read ok and NO boundary 2 if item could be read ok and boundary */ -int isc_read_item (ISAMC_PP pp, char **dst) +int isamc_read_item (ISAMC_PP pp, char **dst) { ISAMC is = pp->is; const char *src = pp->buf + pp->offset; @@ -540,7 +540,7 @@ int isc_read_item (ISAMC_PP pp, char **dst) pp->pos = pp->next; src = pp->buf; /* read block and save 'next' and 'size' entry */ - isc_read_block (is, pp->cat, pp->pos, pp->buf); + isamc_read_block (is, pp->cat, pp->pos, pp->buf); memcpy (&pp->next, src, sizeof(pp->next)); src += sizeof(pp->next); memcpy (&pp->size, src, sizeof(pp->size)); @@ -556,7 +556,7 @@ int isc_read_item (ISAMC_PP pp, char **dst) } if (pp->deleteFlag) - isc_release_block (is, pp->cat, pp->pos); + isamc_release_block (is, pp->cat, pp->pos); (*is->method->codec.decode)(pp->decodeClientData, dst, &src); pp->offset = src - pp->buf; if (is->method->debug > 2) @@ -569,7 +569,7 @@ int isc_read_item (ISAMC_PP pp, char **dst) return 1; } -zint isc_pp_num (ISAMC_PP pp) +zint isamc_pp_num (ISAMC_PP pp) { return pp->numKeys; } diff --git a/isamc/merge.c b/isamc/merge.c index e0abc2f..68fc2e5 100644 --- a/isamc/merge.c +++ b/isamc/merge.c @@ -1,4 +1,4 @@ -/* $Id: merge.c,v 1.29 2005-01-15 19:38:31 adam Exp $ +/* $Id: merge.c,v 1.30 2005-04-13 13:03:48 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -27,14 +27,14 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include "isamc-p.h" -struct isc_merge_block { - int offset; /* offset in r_buf */ - zint block; /* block number of file (0 if none) */ - int dirty; /* block is different from that on file */ +struct isamc_merge_block { + int offset; /* offset in r_buf */ + zint block; /* block number of file (0 if none) */ + int dirty; /* block is different from that on file */ }; #if 0 -static void opt_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, +static void opt_blocks (ISAMC is, struct isamc_merge_block *mb, int ptr, int last) { int i, no_dirty = 0; @@ -63,7 +63,7 @@ static void opt_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, } #endif -static void flush_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, +static void flush_blocks (ISAMC is, struct isamc_merge_block *mb, int ptr, char *r_buf, zint *firstpos, int cat, int last, zint *numkeys) { @@ -74,7 +74,7 @@ static void flush_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, /* consider this block number */ if (!mb[i].block) { - mb[i].block = isc_alloc_block (is, cat); + mb[i].block = isamc_alloc_block (is, cat); mb[i].dirty = 1; } @@ -83,7 +83,7 @@ static void flush_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, mb[i+1].block = 0; else if (!mb[i+1].block) { - mb[i+1].block = isc_alloc_block (is, cat); + mb[i+1].block = isamc_alloc_block (is, cat); mb[i+1].dirty = 1; mb[i].dirty = 1; } @@ -131,11 +131,11 @@ static void flush_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, } memcpy (src, &mb[i+1].block, sizeof(zint)); memcpy (src+sizeof(zint), &ssize, sizeof(ssize)); - isc_write_block (is, cat, mb[i].block, src); + isamc_write_block (is, cat, mb[i].block, src); } } -static int get_border (ISAMC is, struct isc_merge_block *mb, zint ptr, +static int get_border (ISAMC is, struct isamc_merge_block *mb, zint ptr, int cat, zint firstpos) { /* Border set to initial fill or block size depending on @@ -151,7 +151,7 @@ static int get_border (ISAMC is, struct isc_merge_block *mb, zint ptr, return mb[ptr].offset + fill - off; } -ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) +void isamc_merge (ISAMC is, ISAM_P *ipos, ISAMC_I *data) { char i_item[128], *i_item_ptr; @@ -163,7 +163,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) int last_dirty = 0; int debug = is->method->debug; - struct isc_merge_block mb[200]; + struct isamc_merge_block mb[200]; zint firstpos = 0; int cat = 0; @@ -178,16 +178,16 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) r_clientData = (*is->method->codec.start)(); r_buf = is->merge_buf + 128; - pp = isc_pp_open (is, ipos); + pp = isamc_pp_open (is, *ipos); /* read first item from file. make sure f_more indicates no boundary */ f_item_ptr = f_item; - f_more = isc_read_item (pp, &f_item_ptr); + f_more = isamc_read_item (pp, &f_item_ptr); if (f_more > 0) f_more = 1; cat = pp->cat; if (debug > 1) - yaz_log (YLOG_LOG, "isc: isc_merge begin %d " ZINT_FORMAT, cat, pp->pos); + yaz_log (YLOG_LOG, "isc: isamc_merge begin %d " ZINT_FORMAT, cat, pp->pos); /* read first item from i */ i_item_ptr = i_item; @@ -220,7 +220,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) if (debug > 3) yaz_log (YLOG_LOG, "isc: release A"); if (mb[ptr].block) - isc_release_block (is, pp->cat, mb[ptr].block); + isamc_release_block (is, pp->cat, mb[ptr].block); mb[ptr].block = pp->pos; if (!mb[ptr].dirty) mb[ptr].dirty = 1; @@ -306,14 +306,14 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) } /* move f */ f_item_ptr = f_item; - f_more = isc_read_item (pp, &f_item_ptr); + f_more = isamc_read_item (pp, &f_item_ptr); } else if (cmp > 0) /* insert f */ { memcpy (r_item, f_item, f_item_ptr - f_item); /* move f */ f_item_ptr = f_item; - f_more = isc_read_item (pp, &f_item_ptr); + f_more = isamc_read_item (pp, &f_item_ptr); } else /* insert i */ { @@ -391,7 +391,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) /* delete all original block(s) read so far */ for (i = 0; i < ptr; i++) if (mb[i].block) - isc_release_block (is, pp->cat, mb[i].block); + isamc_release_block (is, pp->cat, mb[i].block); /* also delete all block to be read in the future */ pp->deleteFlag = 1; @@ -438,7 +438,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) { if (debug > 3) yaz_log (YLOG_LOG, "isc: release C"); - isc_release_block (is, pp->cat, mb[ptr].block); + isamc_release_block (is, pp->cat, mb[ptr].block); mb[ptr].block = 0; if (ptr > 0) mb[ptr-1].dirty = 1; @@ -452,7 +452,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) { /* we have to patch initial block with num keys if that has changed */ - if (numKeys != isc_pp_num (pp)) + if (numKeys != isamc_pp_num (pp)) { if (debug > 2) yaz_log (YLOG_LOG, "isc: patch num keys firstpos=" ZINT_FORMAT " num=" ZINT_FORMAT, @@ -464,7 +464,7 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) else if (ptr > 0) { /* we haven't flushed initial block yet and there surely are some blocks to flush. Make first block dirty if numKeys differ */ - if (numKeys != isc_pp_num (pp)) + if (numKeys != isamc_pp_num (pp)) mb[0].dirty = 1; } /* flush rest of block(s) in r_buf */ @@ -474,8 +474,8 @@ ISAMC_P isc_merge (ISAMC is, ISAMC_P ipos, ISAMC_I *data) if (!firstpos) cat = 0; if (debug > 1) - yaz_log (YLOG_LOG, "isc: isc_merge return %d " ZINT_FORMAT, cat, firstpos); - isc_pp_close (pp); - return cat + firstpos * 8; + yaz_log (YLOG_LOG, "isc: isamc_merge return %d " ZINT_FORMAT, cat, firstpos); + isamc_pp_close (pp); + *ipos = cat + firstpos * 8; } diff --git a/isams/isams.c b/isams/isams.c index aae9651..9ddc0f0 100644 --- a/isams/isams.c +++ b/isams/isams.c @@ -1,4 +1,4 @@ -/* $Id: isams.c,v 1.11 2005-01-15 19:38:31 adam Exp $ +/* $Id: isams.c,v 1.12 2005-04-13 13:03:48 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -112,7 +112,7 @@ int isams_close (ISAMS is) return 0; } -ISAMS_P isams_merge (ISAMS is, ISAMS_I data) +ISAM_P isams_merge (ISAMS is, ISAMS_I data) { char i_item[128]; int i_more, i_mode; @@ -184,7 +184,7 @@ ISAMS_P isams_merge (ISAMS is, ISAMS_I data) return first_block * is->block_size + first_offset; } -ISAMS_PP isams_pp_open (ISAMS is, ISAMS_P pos) +ISAMS_PP isams_pp_open (ISAMS is, ISAM_P pos) { ISAMS_PP pp = (ISAMS_PP) xmalloc (sizeof(*pp)); diff --git a/rset/rsisamb.c b/rset/rsisamb.c index c07c5a5..fed2c49 100644 --- a/rset/rsisamb.c +++ b/rset/rsisamb.c @@ -1,4 +1,4 @@ -/* $Id: rsisamb.c,v 1.30 2005-03-30 09:25:24 adam Exp $ +/* $Id: rsisamb.c,v 1.31 2005-04-13 13:03:48 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -57,14 +57,14 @@ struct rset_pp_info { struct rset_isamb_info { ISAMB is; - ISAMB_P pos; + ISAM_P pos; }; static int log_level = 0; static int log_level_initialized = 0; -RSET rsisamb_create( NMEM nmem, const struct key_control *kcontrol, int scope, - ISAMB is, ISAMB_P pos, TERMID term) +RSET rsisamb_create(NMEM nmem, const struct key_control *kcontrol, int scope, + ISAMB is, ISAM_P pos, TERMID term) { RSET rnew = rset_create_base(&control, nmem, kcontrol, scope, term); struct rset_isamb_info *info; diff --git a/rset/rsisamc.c b/rset/rsisamc.c index 7eafe1d..6dc3983 100644 --- a/rset/rsisamc.c +++ b/rset/rsisamc.c @@ -1,4 +1,4 @@ -/* $Id: rsisamc.c,v 1.36 2005-03-30 09:25:24 adam Exp $ +/* $Id: rsisamc.c,v 1.37 2005-04-13 13:03:49 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -58,14 +58,14 @@ struct rset_pp_info { struct rset_isamc_info { ISAMC is; - ISAMC_P pos; + ISAM_P pos; }; static int log_level = 0; static int log_level_initialized = 0; -RSET rsisamc_create( NMEM nmem, const struct key_control *kcontrol, int scope, - ISAMC is, ISAMC_P pos, TERMID term) +RSET rsisamc_create(NMEM nmem, const struct key_control *kcontrol, int scope, + ISAMC is, ISAM_P pos, TERMID term) { RSET rnew = rset_create_base(&control, nmem, kcontrol, scope,term); struct rset_isamc_info *info; @@ -108,7 +108,7 @@ RSFD r_open (RSET ct, int flag) rfd->priv = ptinfo; ptinfo->buf = nmem_malloc (ct->nmem,ct->keycontrol->key_size); } - ptinfo->pt = isc_pp_open(info->is, info->pos); + ptinfo->pt = isamc_pp_open(info->is, info->pos); return rfd; } @@ -116,7 +116,7 @@ static void r_close (RSFD rfd) { struct rset_pp_info *p = (struct rset_pp_info *)(rfd->priv); - isc_pp_close(p->pt); + isamc_pp_close(p->pt); rfd_delete_base(rfd); } @@ -125,7 +125,7 @@ static int r_read (RSFD rfd, void *buf, TERMID *term) { struct rset_pp_info *p = (struct rset_pp_info *)(rfd->priv); int r; - r = isc_pp_read(p->pt, buf); + r = isamc_pp_read(p->pt, buf); if (term) *term = rfd->rset->term; yaz_log(log_level, "isamc.r_read"); diff --git a/rset/rsisams.c b/rset/rsisams.c index 28bb5e5..b30df9c 100644 --- a/rset/rsisams.c +++ b/rset/rsisams.c @@ -1,4 +1,4 @@ -/* $Id: rsisams.c,v 1.19 2005-03-30 09:25:24 adam Exp $ +/* $Id: rsisams.c,v 1.20 2005-04-13 13:03:50 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -55,12 +55,12 @@ struct rset_pp_info { struct rset_isams_info { ISAMS is; - ISAMS_P pos; + ISAM_P pos; }; -RSET rsisams_create( NMEM nmem, const struct key_control *kcontrol, int scope, - ISAMS is, ISAMS_P pos, TERMID term) +RSET rsisams_create(NMEM nmem, const struct key_control *kcontrol, int scope, + ISAMS is, ISAM_P pos, TERMID term) { RSET rnew=rset_create_base(&control, nmem, kcontrol, scope, term); struct rset_isams_info *info; -- 1.7.10.4