void endin_convertf( fields *endin, fields *info, int reftype, param *p, variants *all, int nall ) { newstr *d; int i, level, n, process; char *newtag, *t; for ( i=0; i<endin->nfields; ++i ) { /* Ensure that data exists */ d = &( endin->data[i] ); if ( !(d->data) || d->len==0 ) continue; /* * All refer format tags start with '%'. If we have one * that doesn't, assume that it comes from endx2xml * and just copy and paste to output */ t = endin->tag[i].data; if ( t[0]!='%' ) { fields_add( info, t, d->data, endin->level[i] ); continue; } n = process_findoldtag( t, reftype, all, nall ); if ( n==-1 ) { endin_notag( p, t, d->data ); continue; } process = ((all[reftype]).tags[n]).processingtype; if ( process == ALWAYS ) continue; /* add these later */ level = ((all[reftype]).tags[n]).level; newtag = ((all[reftype]).tags[n]).newstr; if ( process==SIMPLE ) fields_add( info, newtag, d->data, level ); else if ( process==TYPE ) addtype( info, d->data, level ); else if ( process==TITLE ) title_process( info, newtag, d->data, level ); else if ( process==PERSON ) name_add( info, newtag, d->data, level, &(p->asis), &(p->corps) ); else if ( process==DATE ) adddate( info, t, newtag,d->data,level); else if ( process==PAGES ) addpage( info, d->data, level ); else if ( process==SERIALNO ) addsn( info, d->data, level ); else if ( process==NOTES ) addnotes( info, newtag, d->data, level ); else { /* fprintf(stderr,"%s: internal error -- illegal process %d\n", r->progname, process ); */ } } }
int endin_convertf( fields *endin, fields *info, int reftype, param *p, variants *all, int nall ) { int i, level, n, process, nfields, ok; char *newtag, *t; newstr *d; nfields = fields_num( endin ); for ( i=0; i<nfields; ++i ) { /* Ensure that data exists */ d = fields_value( endin, i, FIELDS_STRP_NOUSE ); if ( d->len == 0 ) { fields_setused( endin, i ); continue; } /* * All refer format tags start with '%'. If we have one * that doesn't, assume that it comes from endx2xml * and just copy and paste to output */ t = fields_tag( endin, i, FIELDS_CHRP ); if ( t[0]!='%' ) { fields_add( info, t, d->data, endin->level[i] ); continue; } n = translate_oldtag( t, reftype, all, nall, &process, &level, &newtag ); if ( n==-1 ) { endin_notag( p, t, d->data ); continue; } if ( process == ALWAYS ) continue; /* add these later */ fields_setused( endin, i ); switch ( process ) { case SIMPLE: ok = fields_add( info, newtag, d->data, level ); break; case TYPE: ok = endin_addtype( info, d->data, level ); break; case TITLE: ok = title_process( info, newtag, d->data, level, p->nosplittitle ); break; case PERSON: ok = name_add( info, newtag, d->data, level, &(p->asis), &(p->corps) ); break; case DATE: ok = endin_adddate( info, t, newtag,d->data,level); break; case PAGES: ok = endin_addpage( info, d->data, level ); break; case SERIALNO: ok = addsn( info, d->data, level ); break; case NOTES: ok = endin_addnotes( info, newtag, d->data, level ); break; default: fprintf(stderr,"%s: internal error -- illegal process number %d\n", p->progname, process ); ok = 1; break; } if ( !ok ) return BIBL_ERR_MEMERR; } return BIBL_OK; }