int copacin_convertf( fields *copacin, fields *out, int reftype, param *p, variants *all, int nall ) { int process, level, i, n, nfields, ok, status = BIBL_OK; newstr *tag, *data; char *newtag; nfields = fields_num( copacin ); for ( i=0; i<nfields; ++i ) { tag = fields_tag( copacin, i, FIELDS_STRP ); n = translate_oldtag( tag->data, reftype, all, nall, &process, &level, &newtag ); if ( n==-1 ) { copacin_report_notag( p, tag->data ); continue; } if ( process == ALWAYS ) continue; /*add these later*/ data = fields_value( copacin, i, FIELDS_STRP ); switch ( process ) { case SIMPLE: status = copacin_simple( out, newtag, data->data, level ); break; case TITLE: ok = title_process( out, newtag, data->data, level, p->nosplittitle ); if ( ok ) status = BIBL_OK; else status = BIBL_ERR_MEMERR; break; case PERSON: status = copacin_addname( out, newtag, data, level, &(p->asis), &(p->corps) ); break; case SERIALNO: ok = addsn( out, data->data, level ); if ( ok ) status = BIBL_OK; else status = BIBL_ERR_MEMERR; break; default: fprintf(stderr,"%s: internal error -- " "illegal process value %d\n", p->progname, process ); status = BIBL_OK; break; } if ( status!=BIBL_OK ) return status; } return status; }
static int bibtexin_title_process( fields *info, char *outtag, fields *bibin, newstr *t, newstr *d, int level, int nosplittitle ) { char *intag = t->data; char *indata = d->data; int ok; if ( bibtexin_titleinbook_isbooktitle( intag, bibin ) ) level=LEVEL_MAIN; ok = title_process( info, outtag, indata, level, nosplittitle ); if ( ok ) return BIBL_OK; else return BIBL_ERR_MEMERR; }
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 ); */ } } }
void risin_convertf( fields *risin, fields *info, int reftype, param *p, variants *all, int nall ) { newstr *t, *d; int process, level, i, n; char *newtag; for ( i=0; i<risin->nfields; ++i ) { t = &( risin->tag[i] ); d = &( risin->data[i] ); n = process_findoldtag( t->data, reftype, all, nall ); if ( n==-1 ) { risin_report_notag( p, t->data ); continue; } process = ((all[reftype]).tags[n]).processingtype; 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==PERSON ) name_add( info, newtag, d->data, level, &(p->asis), &(p->corps) ); else if ( process==TITLE ) title_process( info, newtag, d->data, level ); else if ( process==DATE ) adddate( info, newtag, d->data, level ); else if ( process==SERIALNO ) addsn( info, d->data, level ); else if ( process==NOTES ) notes_add( info, newtag, d, level ); else { /* do nothing */ } } /* look for thesis-type hint */ if ( !strcasecmp( all[reftype].type, "THES" ) ) { for ( i=0; i<risin->nfields; ++i ) { if ( strcasecmp(risin->tag[i].data, "U1") ) continue; if ( !strcasecmp(risin->data[i].data,"Ph.D. Thesis")|| !strcasecmp(risin->data[i].data,"Masters Thesis")|| !strcasecmp(risin->data[i].data,"Diploma Thesis")|| !strcasecmp(risin->data[i].data,"Doctoral Thesis")|| !strcasecmp(risin->data[i].data,"Habilitation Thesis")) fields_add( info, "GENRE", risin->data[i].data, 0 ); } } }
void copacin_convertf( fields *copacin, fields *info, int reftype, param *p, variants *all, int nall ) { newstr *t, *d; int process, level, i, n; char *newtag; for ( i=0; i<copacin->nfields; ++i ) { t = &( copacin->tag[i] ); d = &( copacin->data[i] ); n = process_findoldtag( t->data, reftype, all, nall ); if ( n==-1 ) { copacin_report_notag( p, t->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==TITLE ) title_process( info, newtag, d->data, level ); else if ( process==PERSON ) copacin_addname( info, newtag, d, level, &(p->asis), &(p->corps) ); else if ( process==DATE ) copacin_adddate(info,all[reftype]. tags[i].oldstr,newtag,d->data,level); else if ( process==PAGES ) copacin_addpage( info, d->data, level ); else if ( process==SERIALNO ) addsn( info, d->data, level ); /* else { fprintf(stderr,"%s: internal error -- " "illegal process %d\n", r->progname, process ); }*/ } }
void isiin_convertf( fields *isiin, fields *info, int reftype, param *p, variants *all, int nall ) { newstr *t, *d; int process, level, i, n; char *newtag; isiin_addauthors( isiin, info, reftype, all, nall, &(p->asis), &(p->corps) ); for ( i=0; i<isiin->nfields; ++i ) { t = &( isiin->tag[i] ); if ( !strcasecmp( t->data, "AU" ) || !strcasecmp( t->data, "AF" ) ) continue; d = &( isiin->data[i] ); n = process_findoldtag( t->data, reftype, all, nall ); if ( n==-1 ) { isiin_report_notag( p, t->data ); continue; } process = ((all[reftype]).tags[n]).processingtype; level = ((all[reftype]).tags[n]).level; newtag = all[reftype].tags[n].newstr; if ( process == SIMPLE || process == DATE ) fields_add( info, newtag, d->data, level ); else if ( process == PERSON ) name_add( info, newtag, d->data, level, &(p->asis), &(p->corps) ); else if ( process == TITLE ) title_process( info, newtag, d->data, level ); else if ( process == ISI_KEYWORD ) keyword_process( info, newtag, d->data, level ); else if ( process == SERIALNO ) addsn( info, d->data, level ); /* do nothing if process==TYPE || process==ALWAYS */ } }
void bibtexin_convertf( fields *bibin, fields *info, int reftype, param *p, variants *all, int nall ) { newstr *t, *d; int process, level, i, n; char *newtag; for ( i=0; i<bibin->nfields; ++i ) { d = &( bibin->data[i] ); if ( d->len == 0 ) continue; /* skip ones with no data */ /* skip ones already "used" such as successful crossref */ if ( bibin->used[i] ) continue; t = &( bibin->tag[i] ); n = process_findoldtag( t->data, reftype, all, nall ); if ( n==-1 ) { bibtexin_notag( p, t->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==TITLE ) title_process( info, "TITLE", d->data, level); else if ( process==PERSON ) process_names( info, newtag, d, level, &(p->asis), &(p->corps) ); else if ( process==PAGES ) process_pages( info, d, level); else if ( process==BIBTEX_URL ) process_url( info, d->data, level ); } if ( p->verbose ) report( info ); }
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; }