+static int yaz_record_conv_record_rule(yaz_record_conv_t p,
+ struct yaz_record_conv_rule *r,
+ const char *input_record_buf,
+ size_t input_record_len,
+ WRBUF output_record);
+
+int yaz_record_conv_opac_record(yaz_record_conv_t p,
+ Z_OPACRecord *input_record,
+ WRBUF output_record)
+{
+ int ret = 0;
+ struct yaz_record_conv_rule *r = p->rules;
+ WRBUF res = wrbuf_alloc();
+ yaz_marc_t mt = yaz_marc_create();
+
+ wrbuf_rewind(p->wr_error);
+ yaz_marc_xml(mt, r->u.marc.output_format);
+ if (r->u.marc.iconv_t)
+ yaz_marc_iconv(mt, r->u.marc.iconv_t);
+ yaz_opac_decode_wrbuf(mt, input_record, res);
+ if (ret != -1)
+ {
+ ret = yaz_record_conv_record_rule(p,
+ r->next,
+ wrbuf_buf(res), wrbuf_len(res),
+ output_record);
+ }
+ yaz_marc_destroy(mt);
+ wrbuf_destroy(res);
+ return ret;
+}
+