From c66753469d139c4233a3572edf4b15b0497e0f28 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 15 Aug 2006 14:28:32 +0000 Subject: [PATCH] Definitions in zebramap.h are private. ZebraMaps no longer used in recctrl system. --- include/Makefile.am | 4 +- include/idzebra/Makefile.am | 4 +- include/idzebra/recctrl.h | 5 +-- include/idzebra/zebramap.h | 88 ------------------------------------------- include/zebramap.h | 88 +++++++++++++++++++++++++++++++++++++++++++ index/extract.c | 30 +++++++-------- index/index.h | 3 +- util/zebramap.c | 4 +- 8 files changed, 112 insertions(+), 114 deletions(-) delete mode 100644 include/idzebra/zebramap.h create mode 100644 include/zebramap.h diff --git a/include/Makefile.am b/include/Makefile.am index 1357c2a..c3de7dc 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,6 @@ -# $Id: Makefile.am,v 1.23 2006-05-19 13:49:33 adam Exp $ +# $Id: Makefile.am,v 1.24 2006-08-15 14:28:32 adam Exp $ noinst_HEADERS = bset.h charmap.h \ direntz.h passwddb.h dfa.h zebra_xpath.h d1_absyn.h \ -rset.h dfaset.h sortidx.h zebra-lock.h attrfind.h +rset.h dfaset.h sortidx.h zebra-lock.h attrfind.h zebramap.h SUBDIRS = idzebra diff --git a/include/idzebra/Makefile.am b/include/idzebra/Makefile.am index 9fede05..74a1a9c 100644 --- a/include/idzebra/Makefile.am +++ b/include/idzebra/Makefile.am @@ -1,8 +1,8 @@ -# $Id: Makefile.am,v 1.10 2006-06-28 13:26:14 adam Exp $ +# $Id: Makefile.am,v 1.11 2006-08-15 14:28:33 adam Exp $ zebraincludedir=$(includedir)/$(PACKAGE)$(PACKAGE_SUFFIX)/idzebra zebrainclude_HEADERS=api.h version.h res.h recctrl.h data1.h recgrs.h \ - zebramap.h bfile.h dict.h isam-codec.h isams.h isamc.h isamb.h util.h \ + bfile.h dict.h isam-codec.h isams.h isamc.h isamb.h util.h \ snippet.h api_swig.h flock.h diff --git a/include/idzebra/recctrl.h b/include/idzebra/recctrl.h index 4d18730..c202d8d 100644 --- a/include/idzebra/recctrl.h +++ b/include/idzebra/recctrl.h @@ -1,4 +1,4 @@ -/* $Id: recctrl.h,v 1.26 2006-08-14 10:40:14 adam Exp $ +/* $Id: recctrl.h,v 1.27 2006-08-15 14:28:33 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include -#include YAZ_BEGIN_CDECL @@ -58,7 +57,6 @@ typedef struct { zint seqno; zint record_id; zint section_id; - ZebraMaps zebra_maps; struct recExtractCtrl *extractCtrl; } RecWord; @@ -74,7 +72,6 @@ struct recExtractCtrl { void *clientData; void (*tokenAdd)(RecWord *w); void (*setStoreData)(struct recExtractCtrl *p, void *buf, size_t size); - ZebraMaps zebra_maps; int first_record; int flagShowRecords; int seqno[256]; diff --git a/include/idzebra/zebramap.h b/include/idzebra/zebramap.h deleted file mode 100644 index 454b182..0000000 --- a/include/idzebra/zebramap.h +++ /dev/null @@ -1,88 +0,0 @@ -/* $Id: zebramap.h,v 1.8 2006-08-14 10:40:14 adam Exp $ - Copyright (C) 1995-2006 - Index Data ApS - -This file is part of the Zebra server. - -Zebra is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -Zebra is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#ifndef ZEBRAMAP_H -#define ZEBRAMAP_H - -#include -#include - -YAZ_BEGIN_CDECL - -typedef struct zebra_maps *ZebraMaps; - -YAZ_EXPORT -ZebraMaps zebra_maps_open (Res res, const char *base_path, - const char *profile_path); -YAZ_EXPORT -ZEBRA_RES zebra_maps_read_file(ZebraMaps zms, const char *fname); - -YAZ_EXPORT -void zebra_maps_close (ZebraMaps zm); - -YAZ_EXPORT -const char **zebra_maps_input (ZebraMaps zms, unsigned reg_id, - const char **from, int len, int first); - -YAZ_EXPORT -const char **zebra_maps_search (ZebraMaps zms, unsigned reg_id, - const char **from, int len, int *q_map_match); - -YAZ_EXPORT -const char *zebra_maps_output(ZebraMaps, unsigned reg_id, const char **from); - -YAZ_EXPORT -int zebra_maps_attr (ZebraMaps zms, Z_AttributesPlusTerm *zapt, - unsigned *reg_id, char **search_type, char *rank_type, - int *complete_flag, int *sort_flag); - -YAZ_EXPORT -int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes, - int *numerical); - -YAZ_EXPORT -int zebra_maps_is_complete (ZebraMaps zms, unsigned reg_id); - -YAZ_EXPORT -int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id); - -YAZ_EXPORT -int zebra_maps_is_alwaysmatches (ZebraMaps zms, unsigned reg_id); - -YAZ_EXPORT -int zebra_maps_is_positioned (ZebraMaps zms, unsigned reg_id); - -YAZ_EXPORT -WRBUF zebra_replace(ZebraMaps zms, unsigned reg_id, const char *ex_list, - const char *input_str, int input_len); - -YAZ_END_CDECL - -#endif -/* - * Local variables: - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ - diff --git a/include/zebramap.h b/include/zebramap.h new file mode 100644 index 0000000..2061bc2 --- /dev/null +++ b/include/zebramap.h @@ -0,0 +1,88 @@ +/* $Id: zebramap.h,v 1.19 2006-08-15 14:28:32 adam Exp $ + Copyright (C) 1995-2006 + Index Data ApS + +This file is part of the Zebra server. + +Zebra is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Zebra is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef ZEBRAMAP_H +#define ZEBRAMAP_H + +#include +#include + +YAZ_BEGIN_CDECL + +typedef struct zebra_maps *ZebraMaps; + +YAZ_EXPORT +ZebraMaps zebra_maps_open (Res res, const char *base_path, + const char *profile_path); +YAZ_EXPORT +ZEBRA_RES zebra_maps_read_file(ZebraMaps zms, const char *fname); + +YAZ_EXPORT +void zebra_maps_close (ZebraMaps zm); + +YAZ_EXPORT +const char **zebra_maps_input (ZebraMaps zms, unsigned reg_id, + const char **from, int len, int first); + +YAZ_EXPORT +const char **zebra_maps_search (ZebraMaps zms, unsigned reg_id, + const char **from, int len, int *q_map_match); + +YAZ_EXPORT +const char *zebra_maps_output(ZebraMaps, unsigned reg_id, const char **from); + +YAZ_EXPORT +int zebra_maps_attr (ZebraMaps zms, Z_AttributesPlusTerm *zapt, + unsigned *reg_id, char **search_type, char *rank_type, + int *complete_flag, int *sort_flag); + +YAZ_EXPORT +int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes, + int *numerical); + +YAZ_EXPORT +int zebra_maps_is_complete (ZebraMaps zms, unsigned reg_id); + +YAZ_EXPORT +int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id); + +YAZ_EXPORT +int zebra_maps_is_alwaysmatches (ZebraMaps zms, unsigned reg_id); + +YAZ_EXPORT +int zebra_maps_is_positioned (ZebraMaps zms, unsigned reg_id); + +YAZ_EXPORT +WRBUF zebra_replace(ZebraMaps zms, unsigned reg_id, const char *ex_list, + const char *input_str, int input_len); + +YAZ_END_CDECL + +#endif +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ + diff --git a/index/extract.c b/index/extract.c index a2719dd..4b76e03 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1,4 +1,4 @@ -/* $Id: extract.c,v 1.225 2006-08-14 10:40:15 adam Exp $ +/* $Id: extract.c,v 1.226 2006-08-15 14:28:33 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -114,7 +114,6 @@ static void extract_set_store_data_prepare(struct recExtractCtrl *p); static void extract_init (struct recExtractCtrl *p, RecWord *w) { - w->zebra_maps = p->zebra_maps; w->seqno = 1; w->index_name = "any"; w->index_type = 'w'; @@ -395,7 +394,6 @@ static void init_extractCtrl(ZebraHandle zh, struct recExtractCtrl *ctrl) else ctrl->seqno[i] = 0; } - ctrl->zebra_maps = zh->reg->zebra_maps; ctrl->flagShowRecords = !zh->m_flag_rw; } @@ -1630,7 +1628,6 @@ static void extract_add_index_string(RecWord *p, zinfo_index_category_t cat, const char *str, int length) { struct it_key key; - ZebraHandle zh = p->extractCtrl->handle; ZebraExplainInfo zei = zh->reg->zei; int ch; @@ -1671,7 +1668,6 @@ static void extract_add_index_string(RecWord *p, zinfo_index_category_t cat, static void extract_add_sort_string(RecWord *p, const char *str, int length) { struct it_key key; - ZebraHandle zh = p->extractCtrl->handle; ZebraExplainInfo zei = zh->reg->zei; int ch; @@ -1711,14 +1707,15 @@ static void extract_add_sort_string(RecWord *p, const char *str, int length) static void extract_add_string (RecWord *p, const char *string, int length) { + ZebraHandle zh = p->extractCtrl->handle; assert (length > 0); - if (zebra_maps_is_sort (p->zebra_maps, p->index_type)) + if (zebra_maps_is_sort (zh->reg->zebra_maps, p->index_type)) extract_add_sort_string (p, string, length); else { extract_add_index_string(p, zinfo_index_category_index, string, length); - if (zebra_maps_is_alwaysmatches(p->zebra_maps, p->index_type)) + if (zebra_maps_is_alwaysmatches(zh->reg->zebra_maps, p->index_type)) { RecWord word; memcpy(&word, p, sizeof(word)); @@ -1732,12 +1729,13 @@ static void extract_add_string (RecWord *p, const char *string, int length) static void extract_add_incomplete_field (RecWord *p) { + ZebraHandle zh = p->extractCtrl->handle; const char *b = p->term_buf; int remain = p->term_len; const char **map = 0; if (remain > 0) - map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, 0); + map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, 0); while (map) { @@ -1749,7 +1747,7 @@ static void extract_add_incomplete_field (RecWord *p) { remain = p->term_len - (b - p->term_buf); if (remain > 0) - map = zebra_maps_input(p->zebra_maps, p->index_type, &b, + map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, 0); else map = 0; @@ -1765,7 +1763,7 @@ static void extract_add_incomplete_field (RecWord *p) buf[i++] = *(cp++); remain = p->term_len - (b - p->term_buf); if (remain > 0) - map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, 0); + map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, 0); else map = 0; } @@ -1778,13 +1776,14 @@ static void extract_add_incomplete_field (RecWord *p) static void extract_add_complete_field (RecWord *p) { + ZebraHandle zh = p->extractCtrl->handle; const char *b = p->term_buf; char buf[IT_MAX_WORD+1]; const char **map = 0; int i = 0, remain = p->term_len; if (remain > 0) - map = zebra_maps_input (p->zebra_maps, p->index_type, &b, remain, 1); + map = zebra_maps_input (zh->reg->zebra_maps, p->index_type, &b, remain, 1); while (remain > 0 && i < IT_MAX_WORD) { @@ -1795,7 +1794,7 @@ static void extract_add_complete_field (RecWord *p) if (remain > 0) { int first = i ? 0 : 1; /* first position */ - map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, first); + map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, first); } else map = 0; @@ -1823,7 +1822,7 @@ static void extract_add_complete_field (RecWord *p) remain = p->term_len - (b - p->term_buf); if (remain > 0) { - map = zebra_maps_input (p->zebra_maps, p->index_type, &b, + map = zebra_maps_input (zh->reg->zebra_maps, p->index_type, &b, remain, 0); } else @@ -1837,19 +1836,20 @@ static void extract_add_complete_field (RecWord *p) static void extract_token_add(RecWord *p) { + ZebraHandle zh = p->extractCtrl->handle; WRBUF wrbuf; if (log_level) yaz_log(log_level, "extract_token_add " "type=%c index=%s seqno=" ZINT_FORMAT " s=%.*s", p->index_type, p->index_name, p->seqno, p->term_len, p->term_buf); - if ((wrbuf = zebra_replace(p->zebra_maps, p->index_type, 0, + if ((wrbuf = zebra_replace(zh->reg->zebra_maps, p->index_type, 0, p->term_buf, p->term_len))) { p->term_buf = wrbuf_buf(wrbuf); p->term_len = wrbuf_len(wrbuf); } - if (zebra_maps_is_complete (p->zebra_maps, p->index_type)) + if (zebra_maps_is_complete (zh->reg->zebra_maps, p->index_type)) extract_add_complete_field (p); else extract_add_incomplete_field(p); diff --git a/index/index.h b/index/index.h index 3fd1a75..1e8fa72 100644 --- a/index/index.h +++ b/index/index.h @@ -1,4 +1,4 @@ -/* $Id: index.h,v 1.171 2006-08-14 10:40:15 adam Exp $ +/* $Id: index.h,v 1.172 2006-08-15 14:28:34 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "zinfo.h" #include #include +#include YAZ_BEGIN_CDECL diff --git a/util/zebramap.c b/util/zebramap.c index 3ffb276..7dc5d0f 100644 --- a/util/zebramap.c +++ b/util/zebramap.c @@ -1,4 +1,4 @@ -/* $Id: zebramap.c,v 1.51 2006-06-23 11:21:38 adam Exp $ +/* $Id: zebramap.c,v 1.52 2006-08-15 14:28:35 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -28,7 +28,7 @@ #include #include -#include +#include #define ZEBRA_MAP_TYPE_SORT 1 #define ZEBRA_MAP_TYPE_INDEX 2 -- 1.7.10.4