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 ); */ } } }
/* translate_oldtag() */ int translate_oldtag( char *oldtag, int reftype, variants all[], int nall, int *processingtype, int *level, char **newtag ) { int n; n = process_findoldtag( oldtag, reftype, all, nall ); if ( n!=-1 ) { *processingtype = ((all[reftype]).tags[n]).processingtype; *level = ((all[reftype]).tags[n]).level; *newtag = ((all[reftype]).tags[n]).newstr; } return n; }
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 ); }
/* pull off authors first--use AF before AU */ static void isiin_addauthors( fields *isiin, fields *info, int reftype, variants *all, int nall, list *asis, list *corps ) { newstr *t, *d; char *newtag, *authortype, use_af[]="AF", use_au[]="AU"; int level, i, n, has_af=0, has_au=0; for ( i=0; i<isiin->nfields && has_af==0; ++i ) { t = &( isiin->tag[i] ); if ( !strcasecmp( t->data, "AU" ) ) has_au++; if ( !strcasecmp( t->data, "AF" ) ) has_af++; } if ( has_af ) authortype = use_af; else authortype = use_au; for ( i=0; i<isiin->nfields; ++i ) { t = &( isiin->tag[i] ); if ( !strcasecmp( t->data, "AU" ) ) has_au++; if ( strcasecmp( t->data, authortype ) ) continue; d = &( isiin->data[i] ); n = process_findoldtag( authortype, reftype, all, nall ); level = ((all[reftype]).tags[n]).level; newtag = all[reftype].tags[n].newstr; name_add( info, newtag, d->data, level, asis, corps ); } }
int bibtexin_convertf( fields *bibin, fields *info, int reftype, param *p, variants *all, int nall ) { int process, level, i, n, nfields, status; newstr *t, *d; char *outtag; nfields = fields_num( bibin ); for ( i=0; i<nfields; ++i ) { if ( fields_used( bibin, i ) ) continue; /* e.g. successful crossref */ if ( fields_nodata( bibin, i ) ) continue; t = fields_tag( bibin, i, FIELDS_STRP ); if ( t->len == 0 ) continue; /* Don't consider with null tags */ n = process_findoldtag( t->data, reftype, all, nall ); if ( n==-1 ) { bibtexin_notag( p, t->data ); continue; } d = fields_value( bibin, i, FIELDS_STRP ); process = ((all[reftype]).tags[n]).processingtype; level = ((all[reftype]).tags[n]).level; outtag = ((all[reftype]).tags[n]).newstr; switch( process ) { case SIMPLE: status = bibtex_simple( info, outtag, d, level ); break; case TITLE: status = bibtexin_title_process( info, "TITLE", bibin, t, d, level, p->nosplittitle ); break; case PERSON: status = bibtex_names( info, outtag, d, level, &(p->asis), &(p->corps) ); break; case PAGES: status = process_pages( info, d, level ); break; case KEYWORD: status = process_keywords( info, d, level ); break; case HOWPUBLISHED: status = process_howpublished( info, d, level ); break; case LINKEDFILE: status = process_file( info, d, level ); break; case BT_NOTE: status = process_note( info, d, level ); break; case BT_SENTE: status = process_sente( info, d, level ); break; case BT_URL: status = process_url( info, d, level ); break; case BT_ORG: status = process_organization( bibin, info, d, level ); break; default: status = BIBL_OK; break; } if ( status!=BIBL_OK ) return status; } return status; }