+ case -1: /* not specified */
+ case 100: /* do not truncate */
+ if (!string_relation(zh, zapt, &termp, term_dict,
+ attributeSet,
+ zm, space_split, display_term,
+ &relation_error))
+ {
+ if (relation_error)
+ {
+ zebra_setError(zh, relation_error, 0);
+ return ZEBRA_FAIL;
+ }
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ break;
+ case 1: /* right truncation */
+ wrbuf_putc(term_dict, '(');
+ if (!term_100(zm, &termp, term_dict, space_split, display_term))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_puts(term_dict, ".*)");
+ break;
+ case 2: /* left truncation */
+ wrbuf_puts(term_dict, "(.*");
+ if (!term_100(zm, &termp, term_dict, space_split, display_term))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_putc(term_dict, ')');
+ break;
+ case 3: /* left&right truncation */
+ wrbuf_puts(term_dict, "(.*");
+ if (!term_100(zm, &termp, term_dict, space_split, display_term))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_puts(term_dict, ".*)");
+ break;
+ case 101: /* process # in term */
+ wrbuf_putc(term_dict, '(');
+ if (!term_101(zm, &termp, term_dict, space_split, display_term))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_puts(term_dict, ")");
+ break;
+ case 102: /* Regexp-1 */
+ wrbuf_putc(term_dict, '(');
+ if (!term_102(zm, &termp, term_dict, space_split, display_term))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_putc(term_dict, ')');
+ break;
+ case 103: /* Regexp-2 */
+ regex_range = 1;
+ wrbuf_putc(term_dict, '(');
+ if (!term_103(zm, &termp, term_dict, ®ex_range,
+ space_split, display_term))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_putc(term_dict, ')');
+ break;
+ case 104: /* process ?n * # term */
+ wrbuf_putc(term_dict, '(');
+ if (!term_104(zm, &termp, term_dict, space_split, display_term))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_putc(term_dict, ')');
+ break;
+ case 105: /* process * ! in term and right truncate */
+ wrbuf_putc(term_dict, '(');
+ if (!term_105(zm, &termp, term_dict, space_split, display_term, 1))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_putc(term_dict, ')');
+ break;
+ case 106: /* process * ! in term */
+ wrbuf_putc(term_dict, '(');
+ if (!term_105(zm, &termp, term_dict, space_split, display_term, 0))
+ {
+ *term_sub = 0;
+ return ZEBRA_OK;
+ }
+ wrbuf_putc(term_dict, ')');
+ break;
+ default:
+ zebra_setError_zint(zh,
+ YAZ_BIB1_UNSUPP_TRUNCATION_ATTRIBUTE,
+ truncation_value);
+ return ZEBRA_FAIL;