NCBI C Toolkit Cross Reference

C/access/mla2api.c


  1 /*   mla2api.c
  2 * ===========================================================================
  3 *
  4 *                            PUBLIC DOMAIN NOTICE
  5 *            National Center for Biotechnology Information (NCBI)
  6 *
  7 *  This software/database is a "United States Government Work" under the
  8 *  terms of the United States Copyright Act.  It was written as part of
  9 *  the author's official duties as a United States Government employee and
 10 *  thus cannot be copyrighted.  This software/database is freely available
 11 *  to the public for use. The National Library of Medicine and the U.S.
 12 *  Government do not place any restriction on its use or reproduction.
 13 *  We would, however, appreciate having the NCBI and the author cited in
 14 *  any work or product based on this material
 15 *
 16 *  Although all reasonable efforts have been taken to ensure the accuracy
 17 *  and reliability of the software and data, the NLM and the U.S.
 18 *  Government do not and cannot warrant the performance or results that
 19 *  may be obtained by using this software or data. The NLM and the U.S.
 20 *  Government disclaim all warranties, express or implied, including
 21 *  warranties of performance, merchantability or fitness for any particular
 22 *  purpose.
 23 *
 24 * ===========================================================================
 25 *
 26 * File Name:  mla2api.c
 27 *
 28 * Author:  Jonathan Kans
 29 *
 30 * Version Creation Date:   1/30/07
 31 *
 32 * $Revision: 1.15 $
 33 *
 34 * File Description: 
 35 *
 36 * Modifications:  
 37 * --------------------------------------------------------------------------
 38 *
 39 * ==========================================================================
 40 */
 41 
 42 #include <mla2api.h>
 43 #include <urlquery.h>
 44 #include <ncbithr.h>
 45 
 46 /* low-level connection functions */
 47 
 48 NLM_EXTERN CONN Mla2OpenConnection (void)
 49 
 50 {
 51   return QUERY_OpenServiceQuery ("MedArch", NULL, 30);
 52 }
 53 
 54 #ifdef OS_MAC
 55 #include <Events.h>
 56 #endif
 57 
 58 NLM_EXTERN MlaBackPtr Mla2WaitForReply (
 59   CONN conn
 60 )
 61 
 62 {
 63   AsnIoConnPtr  aicp;
 64   time_t        currtime, starttime;
 65   time_t        max = 0;
 66   MlaBackPtr    mbp = NULL;
 67   EIO_Status    status;
 68   STimeout      timeout;
 69 #ifdef OS_MAC
 70   EventRecord   currEvent;
 71 #endif
 72 
 73   if (conn == NULL) return NULL;
 74 
 75 #ifdef OS_MAC
 76   timeout.sec = 0;
 77   timeout.usec = 0;
 78 #else
 79   timeout.sec = 100;
 80   timeout.usec = 0;
 81 #endif
 82 
 83   starttime = GetSecs ();
 84   while ((status = CONN_Wait (conn, eIO_Read, &timeout)) == eIO_Timeout && max < 300) {
 85     currtime = GetSecs ();
 86     max = currtime - starttime;
 87 #ifdef OS_MAC
 88     WaitNextEvent (0, &currEvent, 0, NULL);
 89 #endif
 90   }
 91   if (status == eIO_Success) {
 92     aicp = QUERY_AsnIoConnOpen ("rb", conn);
 93     mbp = MlaBackAsnRead (aicp->aip, NULL);
 94     QUERY_AsnIoConnClose (aicp);
 95   }
 96   CONN_Close (conn);
 97 
 98   return mbp;
 99 }
100 
101 /* high-level connection functions */
102 
103 NLM_EXTERN MlaBackPtr Mla2SynchronousQuery (
104   MlaRequestPtr mrp
105 )
106 
107 {
108   AsnIoConnPtr  aicp;
109   CONN          conn;
110   MlaBackPtr    mbp = NULL;
111 
112   if (mrp == NULL) return NULL;
113 
114   conn = Mla2OpenConnection ();
115 
116   if (conn == NULL) return NULL;
117 
118   aicp = QUERY_AsnIoConnOpen ("wb", conn);
119 
120   MlaRequestAsnWrite (mrp, aicp->aip, NULL);
121 
122   AsnIoFlush (aicp->aip);
123   QUERY_AsnIoConnClose (aicp);
124 
125   QUERY_SendQuery (conn);
126 
127   mbp = Mla2WaitForReply (conn);
128 
129   return mbp;
130 }
131 
132 NLM_EXTERN Boolean Mla2AsynchronousQuery (
133   MlaRequestPtr mrp,
134   QUEUE* queue,
135   QueryResultProc resultproc,
136   VoidPtr userdata
137 )
138 
139 {
140   AsnIoConnPtr  aicp;
141   CONN          conn;
142 
143   if (mrp == NULL) return FALSE;
144 
145   conn = Mla2OpenConnection ();
146 
147   if (conn == NULL) return FALSE;
148 
149   aicp = QUERY_AsnIoConnOpen ("wb", conn);
150 
151   Mla2RequestAsnWrite (mrp, aicp->aip, NULL);
152 
153   AsnIoFlush (aicp->aip);
154   QUERY_AsnIoConnClose (aicp);
155 
156   QUERY_SendQuery (conn);
157 
158   QUERY_AddToQueue (queue, conn, resultproc, userdata, TRUE);
159 
160   return TRUE;
161 }
162 
163 NLM_EXTERN Int4 Mla2CheckQueue (
164   QUEUE* queue
165 )
166 
167 {
168   return QUERY_CheckQueue (queue);
169 }
170 
171 NLM_EXTERN MlaBackPtr Mla2ReadReply (
172   CONN conn,
173   EIO_Status status
174 )
175 
176 {
177   AsnIoConnPtr  aicp;
178   MlaBackPtr    mbp = NULL;
179 
180   if (conn != NULL && status == eIO_Success) {
181     aicp = QUERY_AsnIoConnOpen ("rb", conn);
182     mbp = Mla2BackAsnRead (aicp->aip, NULL);
183     QUERY_AsnIoConnClose (aicp);
184   }
185 
186   return mbp;
187 }
188 
189 /* request creation functions */
190 
191 NLM_EXTERN MlaRequestPtr Mla2CreateJournalTitleRequest (
192   CharPtr journal_name
193 )
194 
195 {
196   ValNodePtr     jta;
197   MlaRequestPtr  mrp;
198   TitleMsgPtr    tmp;
199 
200   if (StringHasNoText (journal_name)) return NULL;
201 
202   jta = ValNodeNew (NULL);
203   jta->choice = Title_type_name;
204   jta->data.ptrvalue = StringSave (journal_name);
205 
206   tmp = TitleMsgNew ();
207   tmp->type = Title_type_all;
208   tmp->title = jta;
209 
210   mrp = ValNodeNew (NULL);
211   mrp->choice = MlaRequest_gettitle;
212   mrp->data.ptrvalue = (Pointer) tmp;
213 
214   return mrp;
215 }
216 
217 NLM_EXTERN MlaRequestPtr Mla2CreateCitArtJournalRequest (
218   CitArtPtr cap
219 )
220 
221 {
222   CitJourPtr  cjp;
223   CharPtr     str;
224   ValNodePtr  ttl;
225 
226   if (cap == NULL) return NULL;
227   if (cap->from != 1) return NULL;
228   cjp = (CitJourPtr) cap->fromptr;
229   if (cjp == NULL) return NULL;
230 
231   for (ttl = cjp->title; ttl != NULL; ttl = ttl->next) {
232     if (ttl->choice == Cit_title_name ||
233         ttl->choice == Cit_title_trans ||
234         ttl->choice == Cit_title_jta ||
235         ttl->choice == Cit_title_iso_jta ||
236         ttl->choice == Cit_title_ml_jta ||
237         ttl->choice == Cit_title_coden ||
238         ttl->choice == Cit_title_issn) {
239       str = (CharPtr) ttl->data.ptrvalue;
240       if (StringHasNoText (str)) continue;
241       return Mla2CreateJournalTitleRequest (str);
242     }
243   }
244 
245   return NULL;
246 }
247 
248 NLM_EXTERN MlaRequestPtr Mla2CreateCitArtMatchRequest (
249   CitArtPtr cap
250 )
251 
252 {
253   MlaRequestPtr  mrp;
254   ValNodePtr     pub;
255 
256 
257   if (cap == NULL) return NULL;
258   cap = AsnIoMemCopy ((Pointer) cap,
259                       (AsnReadFunc) CitArtAsnRead,
260                       (AsnWriteFunc) CitArtAsnWrite);
261 
262   pub = ValNodeNew (NULL);
263   pub->choice = PUB_Article;
264   pub->data.ptrvalue = cap;
265 
266   mrp = ValNodeNew (NULL);
267   mrp->choice = MlaRequest_citmatch;
268   mrp->data.ptrvalue = (Pointer) pub;
269 
270   return mrp;
271 }
272 
273 NLM_EXTERN MlaRequestPtr Mla2CreateCitationtMatchRequest (
274   CharPtr author,
275   CharPtr journal,
276   CharPtr volume,
277   CharPtr page,
278   Int4 year,
279   CharPtr title
280 )
281 
282 {
283   AuthListPtr    alp;
284   AuthorPtr      ap;
285   CitArtPtr      cap;
286   CitJourPtr     cjp;
287   DatePtr        dp;
288   ImprintPtr     imp;
289   ValNodePtr     jta;
290   MlaRequestPtr  mrp;
291   ValNodePtr     names;
292   NameStdPtr     nsp;
293   PersonIdPtr    pid;
294   ValNodePtr     pub;
295   ValNodePtr     ttl;
296 
297   if (StringHasNoText (author) || StringHasNoText (journal) || year < 1900) return NULL;
298 
299   cap = CitArtNew ();
300   if (cap == NULL) return NULL;
301 
302   nsp = NameStdNew ();
303   nsp->names [0] = StringSave (author);
304 
305   pid = PersonIdNew ();
306   pid->choice = 2;
307   pid->data = nsp;
308 
309   ap = AuthorNew ();
310   ap->name = pid;
311 
312   names = ValNodeNew (NULL);
313   names->choice = 1;
314   names->data.ptrvalue = ap;
315 
316   alp = AuthListNew ();
317   alp->choice = 1;
318   alp->names = names;
319 
320   cap->authors = alp;
321 
322   jta = ValNodeNew (NULL);
323   jta->choice = Title_type_name;
324   jta->data.ptrvalue = StringSave (journal);
325 
326   cjp = CitJourNew ();
327   cjp->title = jta;
328 
329   dp = DateNew ();
330   dp->data [0] = 1;
331   dp->data [1] = year - 1900;
332 
333   imp = ImprintNew ();
334   imp->date = dp;
335   imp->volume = StringSaveNoNull (volume);
336   imp->pages = StringSaveNoNull (page);
337 
338   cjp->imp = imp;
339 
340   cap->from = 1;
341   cap->fromptr = cjp;
342 
343   if (StringDoesHaveText (title)) 
344   {
345     ttl = ValNodeNew (NULL);
346     ttl->choice = Title_type_name;
347     ttl->data.ptrvalue = StringSave (title);
348 
349     cap->title = ttl;
350   }
351 
352   pub = ValNodeNew (NULL);
353   pub->choice = PUB_Article;
354   pub->data.ptrvalue = cap;
355 
356   mrp = ValNodeNew (NULL);
357   mrp->choice = MlaRequest_citmatch;
358   mrp->data.ptrvalue = (Pointer) pub;
359 
360   return mrp;
361 }
362 
363 NLM_EXTERN MlaRequestPtr Mla2CreatePubFetchRequest (
364   Int4 pmid
365 )
366 
367 {
368   MlaRequestPtr  mrp;
369 
370   if (pmid  < 1) return NULL;
371 
372   mrp = ValNodeNew (NULL);
373   mrp->choice = MlaRequest_getpub;
374   mrp->data.intvalue = pmid;
375 
376   return mrp;
377 }
378 
379 /* reply extraction functions */
380 
381 NLM_EXTERN TitleMsgListPtr Mla2ExtractJournalTitleReply (
382   MlaBackPtr mbp
383 )
384 
385 {
386   TitleMsgListPtr  tlp;
387 
388   if (mbp == NULL || mbp->choice != MlaBack_gettitle) return NULL;
389   tlp = (TitleMsgListPtr) mbp->data.ptrvalue;
390   if (tlp == NULL) return NULL;
391   mbp->data.ptrvalue = NULL;
392 
393   return tlp;
394 }
395 
396 NLM_EXTERN Int4 Mla2ExtractCitMatchReply (
397   MlaBackPtr mbp
398 )
399 
400 {
401   Int4  pmid;
402 
403   if (mbp == NULL || mbp->choice != MlaBack_citmatch) return 0;
404   pmid = (Int4) mbp->data.intvalue;
405   if (pmid < 1) return 0;
406 
407   return pmid;
408 }
409 
410 NLM_EXTERN CitArtPtr Mla2ExtractPubFetchReply (
411   MlaBackPtr mbp
412 )
413 
414 {
415   CitArtPtr   cap;
416   ValNodePtr  pub;
417 
418   if (mbp == NULL || mbp->choice != MlaBack_getpub) return NULL;
419   pub = mbp->data.ptrvalue;
420   if (pub == NULL || pub->choice != PUB_Article) return NULL;
421   cap = (CitArtPtr) pub->data.ptrvalue;
422   if (cap == NULL) return NULL;
423   pub->data.ptrvalue = NULL;
424 
425   return cap;
426 }
427 
428 /* utility functions */
429 
430 /* ml to std code modified from original in medutil.c and then in pmfapi.c */
431 
432 static Boolean StrIsAllUpperCase (
433   CharPtr p
434 )
435 
436 {
437   Char  ch;
438 
439   if (p == NULL) return FALSE;
440   ch = *p;
441   while (ch != '\0') {
442     if (! IS_UPPER (ch)) return FALSE;
443     p++;
444     ch = *p;
445   }
446   return TRUE;
447 }
448 
449 static void SplitMLAuthName (
450   CharPtr name,
451   CharPtr last,
452   CharPtr initials,
453   CharPtr suffix
454 )
455 
456 {
457   CharPtr  p, p2;
458   Int2     i;
459   Char     sbuf [40], ibuf [40];
460 
461   /* Clear the ibuf field and transfer the entire name to 'last',
462   excluding leading and trailing spaces */
463 
464   if (name == NULL) return;
465 
466   ibuf [0] = '\0';
467   sbuf [0] = '\0';
468   last [0] = '\0';
469   initials [0] = '\0';
470   suffix [0] = '\0';
471   while (*name <= ' ') {
472     name++;
473     if (*name == '\0') return;
474   }
475   StringCpy( last, name );
476 
477   for (i=StringLen (last) - 1; ((i >= 0) && (last [i] <= ' ')); i--) {
478     last[i] = '\0';
479   }
480 
481   /* Strip off the last token (initials or name suffix (Jr, Sr, suffix.) */
482 
483   p = StringRChr (last, (int) ' ');
484   if (p != NULL) { /* more than just last name */
485 
486     /* Separate the token from the last name */
487 
488     p2 = p + 1;
489     while ((p > last) && (*p == ' ')) {
490       *p = '\0';
491       p--;
492     }
493 
494     /* If the last token is not all upper case, and there are more than
495     two tokens, see if the next to the last are initials (upper case) */
496 
497     if (! StrIsAllUpperCase (p2) && (p = StringRChr (last, (int) ' ' )) != NULL) {
498 
499       /* We have at least three tokens, is the next to last initials? */
500 
501       if (StrIsAllUpperCase (p + 1)) {
502 
503         /* Yes - concatenate the last two tokens as initials */
504 
505         StringCpy (ibuf, p + 1);
506         StringCpy (sbuf, p2);
507         while (p > last && (*p == ' ')) {
508           *p = '\0';
509           p--;
510         }
511       }
512     }
513     
514     if (ibuf [0] == '\0') { /* Only the last token goes in ibuf */
515       StringCpy (ibuf, p2);
516     }
517   }
518 
519   /* now add periods to ibuf and convert suffix */
520 
521   for (p = initials, p2 = ibuf; *p2 != '\0'; p2++, p++) {
522     *p = *p2;
523     if (! IS_LOWER(*(p2 + 1))) { /* watch out for foreign names */
524       p++;
525       *p = '.';
526     }
527   }
528   *p = '\0';
529 
530   if (sbuf [0]) {
531     if (StringCmp (sbuf, "1d") == 0 || StringCmp (sbuf, "1st") == 0)
532       p = StringMove (suffix, "I");
533     else if (StringCmp (sbuf, "2d") == 0 || StringCmp (sbuf, "2nd") == 0)
534       p = StringMove (suffix, "II");
535     else if (StringCmp (sbuf, "3d") == 0 || StringCmp (sbuf, "3rd") == 0)
536       p = StringMove (suffix, "III");
537     else if (StringCmp (sbuf, "4th") == 0)
538       p = StringMove (suffix, "IV");
539     else if (StringCmp (sbuf, "5th") == 0)
540       p = StringMove (suffix, "V");
541     else if (StringCmp (sbuf, "6th") == 0)
542       p = StringMove (suffix, "VI");
543     else if (StringCmp (sbuf, "Sr") == 0)
544       p = StringMove (suffix, "Sr.");
545     else if (StringCmp (sbuf, "Jr") == 0)
546       p = StringMove (suffix, "Jr.");
547     else
548       p = StringMove (suffix, sbuf);
549   }
550 }
551 
552 static ValNodePtr ChangeMLtoSTD (
553   CharPtr token
554 )
555 
556 {
557   AuthorPtr   aup;
558   CharPtr     eptr;
559   Char        last [180], initials [40], suffix [40];
560   NameStdPtr  nsp;
561   PersonIdPtr pid;
562   ValNodePtr  vnp;
563 
564   if (token == NULL) return NULL;
565   for (eptr = token + StringLen (token) - 1;
566        eptr > token && *eptr == ' ';
567        eptr--) continue;
568 
569   SplitMLAuthName (token, last, initials, suffix);
570 
571   nsp = NameStdNew ();
572   if (nsp == NULL) return NULL;
573   nsp->names [0] = StringSave (last);
574   if (initials [0] != '\0') {
575     nsp->names[4] = StringSave (initials);
576   }
577   if (suffix[0] != '\0') {
578     nsp->names[5] = StringSave (suffix);
579   }
580   if (nsp->names[0] != NULL) {
581     pid = PersonIdNew ();
582     pid->choice = 2; /* name */
583     pid->data = nsp;
584     aup = AuthorNew ();
585     aup->name = pid;
586     vnp = ValNodeNew (NULL);
587     vnp->data.ptrvalue = (Pointer) aup;
588     return vnp;
589   }
590   return NULL;
591 }
592 
593 NLM_EXTERN void ChangeCitArtMLAuthorsToSTD (
594   CitArtPtr cap
595 )
596 
597 {
598   AuthListPtr  alp;
599   AuthorPtr    ap;
600   ValNodePtr   curr, last = NULL, names, oldnames, tmp;
601   PersonIdPtr  pid;
602   CharPtr      str;
603 
604   if (cap == NULL) return;
605   alp = cap->authors;
606   if (alp == NULL) return;
607 
608   if (alp->choice == 1) {
609     for (names = alp->names; names != NULL; names = names->next) {
610       ap = names->data.ptrvalue;
611       if (ap == NULL) continue;
612       pid = ap->name;
613       if (pid == NULL) continue;
614       if (pid->choice != 3) continue;
615       str = (CharPtr) pid->data;
616       if (StringHasNoText (str)) continue;
617       curr = ChangeMLtoSTD (str);
618       if (curr == NULL) continue;
619       names->data.ptrvalue = AuthorFree (ap);
620       names->data.ptrvalue = curr->data.ptrvalue;
621       /* do not ValNodeFreeData, since data has been switched to old author */
622       ValNodeFree (curr);
623     }
624   }
625 
626   if (alp->choice == 2) {
627 
628     /* do not convert if too big for buffers */
629 
630     for (tmp = alp->names; tmp != NULL; tmp = tmp->next) {
631       if (StringLen ((CharPtr) tmp->data.ptrvalue) > 170) return;
632     }
633 
634     oldnames = alp->names;
635     alp->names = NULL;
636     alp->choice = 1; /* make std names */
637 
638     for (tmp = oldnames; tmp != NULL; tmp = tmp->next) {
639       curr = ChangeMLtoSTD ((CharPtr) tmp->data.ptrvalue);
640       if (alp->names == NULL) {
641         alp->names = curr;
642       }
643       if (last != NULL) {
644         last->next = curr;
645       }
646       last = curr;
647     }
648 
649     ValNodeFreeData (oldnames);
650   }
651 }
652 
653 NLM_EXTERN void ChangeMlaBackMLAuthorsToSTD (
654   MlaBackPtr mbp 
655 )
656 
657 {
658   CitArtPtr   cap;
659   ValNodePtr  pub;
660 
661   if (mbp == NULL || mbp->choice != MlaBack_getpub) return;
662   pub = mbp->data.ptrvalue;
663   if (pub == NULL || pub->choice != PUB_Article) return;
664   cap = (CitArtPtr) pub->data.ptrvalue;
665   if (cap == NULL) return;
666   ChangeCitArtMLAuthorsToSTD (cap);
667 }
668 
669 typedef struct ejour {
670   CharPtr  journal_name;
671   Int2     starting_year;
672 } EjourData, PNTR EjourDataPtr;
673 
674 static EjourData mla2_ejour_list [] = {
675  {"Acta Crystallograph. Sect. F Struct. Biol. Cryst. Commun.",     0 },
676  {"Acta Vet. Scand.",                                           2006 },
677  {"Afr. J. Biotechnol.",                                           0 },
678  {"Ambul. Surg.",                                               2005 },
679  {"Ann. Clin. Microbiol. Antimicrob.",                             0 },
680  {"Biol. Direct",                                                  0 },
681  {"Biotecnol. Apl.",                                            2002 },
682  {"BMC Biochem.",                                                  0 },
683  {"BMC Bioinformatics",                                            0 },
684  {"BMC Biotechnol.",                                               0 },
685  {"BMC Cancer",                                                    0 },
686  {"BMC Cell Biol.",                                                0 },
687  {"BMC Dermatol.",                                                 0 },
688  {"BMC Dev. Biol.",                                                0 },
689  {"BMC Ecol.",                                                     0 },
690  {"BMC Evol. Biol.",                                               0 },
691  {"BMC Genet.",                                                    0 },
692  {"BMC Genomics",                                                  0 },
693  {"BMC Immunol.",                                                  0 },
694  {"BMC Infect. Dis.",                                              0 },
695  {"BMC Med. Genet.",                                               0 },
696  {"BMC Microbiol.",                                                0 },
697  {"BMC Mol. Biol.",                                                0 },
698  {"BMC Pharmacol.",                                                0 },
699  {"BMC Physiol.",                                                  0 },
700  {"BMC Plant Biol.",                                               0 },
701  {"BMC Struct. Biol.",                                             0 },
702  {"BMC Vet. Res.",                                                 0 },
703  {"Breast Cancer Res.",                                         2005 },
704  {"Cancer Cell Int.",                                              0 },
705  {"Cancer Immun.",                                                 0 },
706  {"Cell Commun. Signal",                                           0 },
707  {"Cell Struct. Funct.",                                        2005 },
708  {"Cell. Mol. Biol. (Noisy-le-grand)",                          2004 },
709  {"Colomb. Med.",                                               1998 },
710  {"Crit. Rev. Oral Biol. Med.",                                 2002 },
711  {"Dermatol. Online J.",                                           0 },
712  {"Electron. J. Biotechnol.",                                      0 },
713  {"Eur. J. Genet. Mol. Toxicol.",                                  0 },
714  {"Evol. Bioinform. Online",                                       0 },
715  {"Front. Zool.",                                                  0 },
716  {"Fungal Planet",                                                 0 },
717  {"Genome Biol.",                                               2005 },
718  {"Geochem. Trans.",                                               0 },
719  {"Hereditas",                                                  2004 },
720  {"Hum. Genomics",                                              2004 },
721  {"Infect. Agents Cancer",                                         0 },
722  {"J. Exp. Clin. Assist. Reprod.",                                 0 },
723  {"J. Plankton Res.",                                              0 },
724  {"JOP",                                                           0 },
725  {"Kinetoplastid Biol Dis",                                        0 },
726  {"Malar. J.",                                                     0 },
727  {"Microb. Cell Fact.",                                            0 },
728  {"Mol. Syst. Biol.",                                              0 },
729  {"Mol. Vis.",                                                     0 },
730  {"Neoplasia",                                                  2005 },
731  {"Nucl. Recept.",                                                 0 },
732  {"Pharmacologyonline",                                            0 },
733  {"Plant Methods",                                                 0 },
734  {"PLoS Biol.",                                                 2006 },
735  {"PLoS Comput. Biol.",                                            0 },
736  {"PLoS Genet.",                                                   0 },
737  {"PLoS Med.",                                                     0 },
738  {"PLoS Negl Trop Dis",                                            0 },
739  {"PLoS ONE",                                                      0 },
740  {"PLoS Pathog.",                                                  0 },
741  {"Redox Rep.",                                                 2004 },
742  {"Reprod. Biol. Endocrinol.",                                     0 },
743  {"Retrovirology",                                                 0 },
744  {"Saline Syst.",                                                  0 },
745  {"Sci. STKE",                                                     0 },
746  {"ScientificWorldJournal",                                        0 },
747  {"Tech. Tips Online",                                             0 },
748  {"Virol. J.",                                                     0 },
749  {NULL,                                                            0 }
750 };
751 
752 NLM_EXTERN Boolean Mla2IsEPubOnlyJournal (
753   CharPtr jta,
754   Int2Ptr starting_yearP
755 )
756 
757 {
758   EjourDataPtr  ejp;
759   Int2          L, R, mid;
760 
761   if (starting_yearP != NULL) {
762     *starting_yearP = 0;
763   }
764 
765   if (StringHasNoText (jta)) return FALSE;
766 
767   L = 0;
768   R = sizeof (mla2_ejour_list) / sizeof (mla2_ejour_list [0]) - 1; /* -1 because now NULL terminated */
769 
770   while (L < R) {
771     mid = (L + R) / 2;
772     ejp = &(mla2_ejour_list [mid]);
773     if (ejp != NULL && StringICmp (ejp->journal_name, jta) < 0) {
774       L = mid + 1;
775     } else {
776       R = mid;
777     }
778   }
779 
780   ejp = &(mla2_ejour_list [R]);
781   if (ejp != NULL && StringICmp (ejp->journal_name, jta) == 0) {
782     if (starting_yearP != NULL) {
783       *starting_yearP = ejp->starting_year;
784     }
785     return TRUE;
786   }
787 
788   return FALSE;
789 }
790 
791 NLM_EXTERN Int2 Mla2CorrectCitArt (
792   CitArtPtr newcap,
793   CitArtPtr oldcap
794 )
795 
796 {
797   if (newcap == NULL) return 0;
798 
799   ChangeCitArtMLAuthorsToSTD (newcap);
800 
801   return 0;
802 }
803 
804 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.