+static int range_convert (
+ yaz_nfa *n,
+ yaz_nfa_converter *c,
+ yaz_nfa_char **outbuff,
+ size_t *outcharsleft){
+ yaz_nfa_char *cp1,*cp2;
+ int i;
+ i = yaz_nfa_get_backref(n,c->backref_no, &cp1, &cp2);
+ printf ("range_convert: i=%d d=%d, cp1=%p cp2=%p \n",i,c->char_diff,cp1,cp2);
+ if (i == 2) /* no backref, produce no output, not ok */
+ return 1; /* should not happen */
+ if (i == 1) /* no match in dfa */
+ return 1; /* should not happen */
+ while (cp2 >= cp1) {
+ if ((*outcharsleft)-- <= 0)
+ return 2;
+ printf(" range_convert: %d '%c' -> ",*cp1,*cp1);
+ **outbuff=(*cp1++) + c->char_diff ;
+ printf("%d '%c'\n",**outbuff, **outbuff);
+ (*outbuff)++;
+ }
+ return 0;
+}
+