- e->which = Z_Entry_termInfo;
- e->u.termInfo = t = (Z_TermInfo *)odr_malloc(assoc->encode, sizeof(*t));
- t->suggestedAttributes = 0;
- t->displayTerm = 0;
- t->alternativeTerm = 0;
- t->byAttributes = 0;
- t->otherTermInfo = 0;
- t->globalOccurrences = &srs->entries[i].occurrences;
- t->term = (Z_Term *)odr_malloc(assoc->encode, sizeof(*t->term));
- t->term->which = Z_Term_general;
- t->term->u.general = o = (Odr_oct *)odr_malloc(assoc->encode,
- sizeof(Odr_oct));
- o->buf = (unsigned char *)odr_malloc(assoc->encode, o->len = o->size =
- strlen(srs->entries[i].term));
- memcpy(o->buf, srs->entries[i].term, o->len);
- logf(LOG_DEBUG, " term #%d: '%s' (%d)", i,
- srs->entries[i].term, srs->entries[i].occurrences);
+ if (srs->entries[i].occurrences >= 0)
+ {
+ e->which = Z_Entry_termInfo;
+ e->u.termInfo = t = (Z_TermInfo *)
+ odr_malloc(assoc->encode, sizeof(*t));
+ t->suggestedAttributes = 0;
+ t->displayTerm = 0;
+ t->alternativeTerm = 0;
+ t->byAttributes = 0;
+ t->otherTermInfo = 0;
+ t->globalOccurrences = &srs->entries[i].occurrences;
+ t->term = (Z_Term *)
+ odr_malloc(assoc->encode, sizeof(*t->term));
+ t->term->which = Z_Term_general;
+ t->term->u.general = o =
+ (Odr_oct *)odr_malloc(assoc->encode, sizeof(Odr_oct));
+ o->buf = (unsigned char *)
+ odr_malloc(assoc->encode, o->len = o->size =
+ strlen(srs->entries[i].term));
+ memcpy(o->buf, srs->entries[i].term, o->len);
+ logf(LOG_DEBUG, " term #%d: '%s' (%d)", i,
+ srs->entries[i].term, srs->entries[i].occurrences);
+ }
+ else
+ {
+ Z_DiagRecs *drecs = diagrecs (assoc,
+ srs->entries[i].errcode,
+ srs->entries[i].errstring);
+ assert (drecs->num_diagRecs == 1);
+ e->which = Z_Entry_surrogateDiagnostic;
+ assert (drecs->diagRecs[0]);
+ e->u.surrogateDiagnostic = drecs->diagRecs[0];
+ }