X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=index%2Fzrpn.c;h=c7cb15623e26d29c2b749cf067741fe5da7b883e;hb=36f8c4a15cad06268b2d5621aed28ab16c015cc5;hp=9d14757373bc996daa8e3f25d0656e97da325c43;hpb=726c42c6ae793b79a5351d2fce805d220d21321e;p=idzebra-moved-to-github.git diff --git a/index/zrpn.c b/index/zrpn.c index 9d14757..c7cb156 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.150 2004-09-09 10:08:05 heikki Exp $ +/* $Id: zrpn.c,v 1.153 2004-09-15 08:13:51 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -37,7 +37,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include -static const struct key_control it_ctrl={ +static const struct key_control it_ctrl = { sizeof(struct it_key), 2, /* we have sysnos and seqnos in this key, nothing more */ key_compare_it, @@ -46,7 +46,7 @@ static const struct key_control it_ctrl={ }; -const struct key_control *key_it_ctrl=&it_ctrl; +const struct key_control *key_it_ctrl = &it_ctrl; struct rpn_char_map_info { ZebraMaps zm; @@ -64,7 +64,7 @@ typedef struct { static const char **rpn_char_map_handler (void *vp, const char **from, int len) { struct rpn_char_map_info *p = (struct rpn_char_map_info *) vp; - const char **out = zebra_maps_input (p->zm, p->reg_type, from, len); + const char **out = zebra_maps_input (p->zm, p->reg_type, from, len, 0); #if 0 if (out && *out) { @@ -261,7 +261,7 @@ static int grep_handle (char *name, const char *info, void *p) } static int term_pre (ZebraMaps zebra_maps, int reg_type, const char **src, - const char *ct1, const char *ct2) + const char *ct1, const char *ct2, int first) { const char *s1, *s0 = *src; const char **map; @@ -274,7 +274,7 @@ static int term_pre (ZebraMaps zebra_maps, int reg_type, const char **src, if (ct2 && strchr (ct2, *s0)) break; s1 = s0; - map = zebra_maps_input (zebra_maps, reg_type, &s1, strlen(s1)); + map = zebra_maps_input (zebra_maps, reg_type, &s1, strlen(s1), first); if (**map != *CHR_SPACE) break; s0 = s1; @@ -298,13 +298,13 @@ static int term_100 (ZebraMaps zebra_maps, int reg_type, const char *space_start = 0; const char *space_end = 0; - if (!term_pre (zebra_maps, reg_type, src, NULL, NULL)) + if (!term_pre (zebra_maps, reg_type, src, NULL, NULL, !space_split)) return 0; s0 = *src; while (*s0) { s1 = s0; - map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0)); + map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0), 0); if (space_split) { if (**map == *CHR_SPACE) @@ -356,7 +356,7 @@ static int term_101 (ZebraMaps zebra_maps, int reg_type, int i = 0; int j = 0; - if (!term_pre (zebra_maps, reg_type, src, "#", "#")) + if (!term_pre (zebra_maps, reg_type, src, "#", "#", !space_split)) return 0; s0 = *src; while (*s0) @@ -370,7 +370,7 @@ static int term_101 (ZebraMaps zebra_maps, int reg_type, else { s1 = s0; - map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0)); + map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0), 0); if (space_split && **map == *CHR_SPACE) break; while (s1 < s0) @@ -398,7 +398,7 @@ static int term_103 (ZebraMaps zebra_maps, int reg_type, const char **src, const char *s0, *s1; const char **map; - if (!term_pre (zebra_maps, reg_type, src, "^\\()[].*+?|", "(")) + if (!term_pre (zebra_maps, reg_type, src, "^\\()[].*+?|", "(", !space_split)) return 0; s0 = *src; if (errors && *s0 == '+' && s0[1] && s0[2] == '+' && s0[3] && @@ -419,7 +419,7 @@ static int term_103 (ZebraMaps zebra_maps, int reg_type, const char **src, else { s1 = s0; - map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0)); + map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0), 0); if (**map == *CHR_SPACE) break; while (s1 < s0) @@ -456,7 +456,7 @@ static int term_104 (ZebraMaps zebra_maps, int reg_type, int i = 0; int j = 0; - if (!term_pre (zebra_maps, reg_type, src, "?*#", "?*#")) + if (!term_pre (zebra_maps, reg_type, src, "?*#", "?*#", !space_split)) return 0; s0 = *src; while (*s0) @@ -499,7 +499,7 @@ static int term_104 (ZebraMaps zebra_maps, int reg_type, } { s1 = s0; - map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0)); + map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0), 0); if (space_split && **map == *CHR_SPACE) break; while (s1 < s0) @@ -527,7 +527,7 @@ static int term_105 (ZebraMaps zebra_maps, int reg_type, int i = 0; int j = 0; - if (!term_pre (zebra_maps, reg_type, src, "*!", "*!")) + if (!term_pre (zebra_maps, reg_type, src, "*!", "*!", !space_split)) return 0; s0 = *src; while (*s0) @@ -545,7 +545,7 @@ static int term_105 (ZebraMaps zebra_maps, int reg_type, } { s1 = s0; - map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0)); + map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0), 0); if (space_split && **map == *CHR_SPACE) break; while (s1 < s0) @@ -1054,7 +1054,7 @@ static int string_term (ZebraHandle zh, Z_AttributesPlusTerm *zapt, attributeSet, reg_type, space_split, term_dst)) return 0; - logf (LOG_LOG, "dict_lookup_grep: %s", term_dict+prefix_len); + logf (LOG_DEBUG, "dict_lookup_grep: %s", term_dict+prefix_len); r = dict_lookup_grep (zh->reg->dict, term_dict, 0, grep_info, &max_pos, 0, grep_handle); if (r) @@ -1245,7 +1245,7 @@ static int trans_scan_term (ZebraHandle zh, Z_AttributesPlusTerm *zapt, while ((len = (cp_end - cp)) > 0) { - map = zebra_maps_input (zh->reg->zebra_maps, reg_type, &cp, len); + map = zebra_maps_input (zh->reg->zebra_maps, reg_type, &cp, len, 0); if (**map == *CHR_SPACE) space_map = *map; else @@ -1759,16 +1759,9 @@ static RSET rpn_search_APT_local (ZebraHandle zh, Z_AttributesPlusTerm *zapt, sys = atoi(termz); if (sys <= 0) sys = 1; -#if IT_KEY_NEW key.mem[0] = sys; key.mem[1] = 1; key.len = 2; -#else - key.sysno = sys; - key.seqno = 1; - if (key.sysno <= 0) - key.sysno = 1; -#endif rset_write (rsfd, &key); rset_close (rsfd); return result; @@ -2420,19 +2413,11 @@ static void count_set (RSET r, int *count) rfd = rset_open (r, RSETF_READ); while (rset_read (rfd, &key)) { -#if IT_KEY_NEW if (key.mem[0] != psysno) { psysno = key.mem[0]; (*count)++; } -#else - if (key.sysno != psysno) - { - psysno = key.sysno; - (*count)++; - } -#endif kno++; } rset_close (rfd);