X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzrpn.c;h=e87cf464d07f2051bb55b24711e85e6969cc9e1e;hb=43506dd0ff92373604bb7288e2dcc943b2c1d524;hp=14e17ea02f3c122dd70d9f4bda00d9bd2b6c38d1;hpb=75b192c1c670ec987b49f81acf860666345f719d;p=idzebra-moved-to-github.git diff --git a/index/zrpn.c b/index/zrpn.c index 14e17ea..e87cf46 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.96 1999-09-23 10:05:05 adam + * Revision 1.98 1999-11-30 13:48:04 adam + * Improved installation. Updated for inclusion of YAZ header files. + * + * Revision 1.97 1999/10/14 14:33:50 adam + * Added truncation 5=106. + * + * Revision 1.96 1999/09/23 10:05:05 adam * Implemented structure=105 searching. * * Revision 1.95 1999/09/07 07:19:21 adam @@ -445,7 +451,7 @@ struct grep_info { #ifdef TERM_COUNT int *term_no; #endif - ISAM_P *isam_p_buf; + ISAMS_P *isam_p_buf; int isam_p_size; int isam_p_indx; ZebraHandle zh; @@ -472,12 +478,12 @@ static void add_isam_p (const char *name, const char *info, { if (p->isam_p_indx == p->isam_p_size) { - ISAM_P *new_isam_p_buf; + ISAMS_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 = (ISAM_P *) xmalloc (sizeof(*new_isam_p_buf) * + new_isam_p_buf = (ISAMS_P *) xmalloc (sizeof(*new_isam_p_buf) * p->isam_p_size); if (p->isam_p_buf) { @@ -717,10 +723,10 @@ static int term_104 (ZebraMaps zebra_maps, int reg_type, return i; } -/* term_105: handle term, where trunc=Process # and ! and right trunc */ +/* term_105/106: handle term, where trunc=Process # and ! and right trunc */ static int term_105 (ZebraMaps zebra_maps, int reg_type, const char **src, char *dst, int space_split, - char *dst_term) + char *dst_term, int right_truncate) { const char *s0, *s1; const char **map; @@ -757,8 +763,11 @@ static int term_105 (ZebraMaps zebra_maps, int reg_type, } } } - dst[i++] = '.'; - dst[i++] = '*'; + if (right_truncate) + { + dst[i++] = '.'; + dst[i++] = '*'; + } dst[i] = '\0'; dst_term[j++] = '\0'; @@ -1253,7 +1262,18 @@ static int string_term (ZebraHandle zh, Z_AttributesPlusTerm *zapt, case 105: /* process * and ! in term */ term_dict[j++] = '('; if (!term_105 (zh->zebra_maps, reg_type, - &termp, term_dict + j, space_split, term_dst)) + &termp, term_dict + j, space_split, term_dst, 1)) + return 0; + strcat (term_dict, ")"); + r = dict_lookup_grep (zh->dict, term_dict, 0, grep_info, + &max_pos, 0, grep_handle); + if (r) + logf (LOG_WARN, "dict_lookup_grep err, trunc=*/!: %d", r); + break; + case 106: /* process * and ! in term */ + term_dict[j++] = '('; + if (!term_105 (zh->zebra_maps, reg_type, + &termp, term_dict + j, space_split, term_dst, 0)) return 0; strcat (term_dict, ")"); r = dict_lookup_grep (zh->dict, term_dict, 0, grep_info, @@ -2337,7 +2357,7 @@ RSET rpn_search (ZebraHandle zh, NMEM nmem, struct scan_info_entry { char *term; - ISAM_P isam_p; + ISAMS_P isam_p; }; struct scan_info { @@ -2361,8 +2381,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(ISAM_P)); - memcpy (&scan_info->list[idx].isam_p, info+1, sizeof(ISAM_P)); + assert (*info == sizeof(ISAMS_P)); + memcpy (&scan_info->list[idx].isam_p, info+1, sizeof(ISAMS_P)); return 0; }