NCBI C Toolkit Cross Reference

C/access/objentgene.c


  1 #include <asn.h>
  2 
  3 #define NLM_GENERATED_CODE_PROTO
  4 
  5 #include <egkludge.h>
  6 #include <objentgene.h>
  7 
  8 static Boolean loaded = FALSE;
  9 
 10 #include <asnentgene.h>
 11 
 12 #ifndef NLM_EXTERN_LOADS
 13 #define NLM_EXTERN_LOADS {}
 14 #endif
 15 
 16 NLM_EXTERN Boolean LIBCALL
 17 objentgeneAsnLoad(void)
 18 {
 19 
 20    if ( ! loaded) {
 21       NLM_EXTERN_LOADS
 22 
 23       if ( ! AsnLoad ())
 24       return FALSE;
 25       loaded = TRUE;
 26    }
 27 
 28    return TRUE;
 29 }
 30 
 31 
 32 
 33 /**************************************************
 34 *    Generated object loaders for Module NCBI-Entrezgene
 35 *    Generated using ASNCODE Revision: 6.16 at Apr 24, 2009 11:11 AM
 36 *
 37 **************************************************/
 38 
 39 
 40 /**************************************************
 41 *
 42 *    EntrezgeneNew()
 43 *
 44 **************************************************/
 45 NLM_EXTERN 
 46 EntrezgenePtr LIBCALL
 47 EntrezgeneNew(void)
 48 {
 49    EntrezgenePtr ptr = MemNew((size_t) sizeof(Entrezgene));
 50 
 51    return ptr;
 52 
 53 }
 54 
 55 
 56 /**************************************************
 57 *
 58 *    EntrezgeneFree()
 59 *
 60 **************************************************/
 61 NLM_EXTERN 
 62 EntrezgenePtr LIBCALL
 63 EntrezgeneFree(EntrezgenePtr ptr)
 64 {
 65 
 66    if(ptr == NULL) {
 67       return NULL;
 68    }
 69    GeneTrackFree(ptr -> track_info);
 70    BioSourceFree(ptr -> source);
 71    GeneRefFree(ptr -> gene);
 72    ProtRefFree(ptr -> prot);
 73    RNARefFree(ptr -> rna);
 74    MemFree(ptr -> summary);
 75    AsnGenericUserSeqOfFree(ptr -> location, (AsnOptFreeFunc) MapsFree);
 76    GeneSourceFree(ptr -> gene_source);
 77    AsnGenericUserSeqOfFree(ptr -> locus, (AsnOptFreeFunc) GeneCommentaryFree);
 78    AsnGenericUserSeqOfFree(ptr -> properties, (AsnOptFreeFunc) GeneCommentaryFree);
 79    AsnGenericUserSeqOfFree(ptr -> refgene, (AsnOptFreeFunc) GeneCommentaryFree);
 80    AsnGenericUserSeqOfFree(ptr -> homology, (AsnOptFreeFunc) GeneCommentaryFree);
 81    AsnGenericUserSeqOfFree(ptr -> comments, (AsnOptFreeFunc) GeneCommentaryFree);
 82    AsnGenericUserSeqOfFree(ptr -> unique_keys, (AsnOptFreeFunc) DbtagFree);
 83    AsnGenericBaseSeqOfFree(ptr -> xtra_index_terms ,ASNCODE_PTRVAL_SLOT);
 84    AsnGenericUserSeqOfFree(ptr -> xtra_properties, (AsnOptFreeFunc) XtraTermsFree);
 85    AsnGenericUserSeqOfFree(ptr -> xtra_iq, (AsnOptFreeFunc) XtraTermsFree);
 86    AsnGenericUserSeqOfFree(ptr -> non_unique_keys, (AsnOptFreeFunc) DbtagFree);
 87    return MemFree(ptr);
 88 }
 89 
 90 
 91 /**************************************************
 92 *
 93 *    EntrezgeneAsnRead()
 94 *
 95 **************************************************/
 96 NLM_EXTERN 
 97 EntrezgenePtr LIBCALL
 98 EntrezgeneAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 99 {
100    DataVal av;
101    AsnTypePtr atp;
102    Boolean isError = FALSE;
103    AsnReadFunc func;
104    EntrezgenePtr ptr;
105 
106    if (! loaded)
107    {
108       if (! objentgeneAsnLoad()) {
109          return NULL;
110       }
111    }
112 
113    if (aip == NULL) {
114       return NULL;
115    }
116 
117    if (orig == NULL) {         /* Entrezgene ::= (self contained) */
118       atp = AsnReadId(aip, amp, ENTREZGENE);
119    } else {
120       atp = AsnLinkType(orig, ENTREZGENE);
121    }
122    /* link in local tree */
123    if (atp == NULL) {
124       return NULL;
125    }
126 
127    ptr = EntrezgeneNew();
128    if (ptr == NULL) {
129       goto erret;
130    }
131    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
132       goto erret;
133    }
134 
135    atp = AsnReadId(aip,amp, atp);
136    func = NULL;
137 
138    if (atp == ENTREZGENE_track_info) {
139       ptr -> track_info = GeneTrackAsnRead(aip, atp);
140       if (aip -> io_failure) {
141          goto erret;
142       }
143       atp = AsnReadId(aip,amp, atp);
144    }
145    if (atp == ENTREZGENE_type) {
146       if ( AsnReadVal(aip, atp, &av) <= 0) {
147          goto erret;
148       }
149       ptr -> type = av.intvalue;
150       atp = AsnReadId(aip,amp, atp);
151    }
152    if (atp == ENTREZGENE_source) {
153       ptr -> source = BioSourceAsnRead(aip, atp);
154       if (aip -> io_failure) {
155          goto erret;
156       }
157       atp = AsnReadId(aip,amp, atp);
158    }
159    if (atp == ENTREZGENE_gene) {
160       ptr -> gene = GeneRefAsnRead(aip, atp);
161       if (aip -> io_failure) {
162          goto erret;
163       }
164       atp = AsnReadId(aip,amp, atp);
165    }
166    if (atp == ENTREZGENE_prot) {
167       ptr -> prot = ProtRefAsnRead(aip, atp);
168       if (aip -> io_failure) {
169          goto erret;
170       }
171       atp = AsnReadId(aip,amp, atp);
172    }
173    if (atp == ENTREZGENE_rna) {
174       ptr -> rna = RNARefAsnRead(aip, atp);
175       if (aip -> io_failure) {
176          goto erret;
177       }
178       atp = AsnReadId(aip,amp, atp);
179    }
180    if (atp == ENTREZGENE_summary) {
181       if ( AsnReadVal(aip, atp, &av) <= 0) {
182          goto erret;
183       }
184       ptr -> summary = av.ptrvalue;
185       atp = AsnReadId(aip,amp, atp);
186    }
187    if (atp == ENTREZGENE_location) {
188       ptr -> location = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MapsAsnRead, (AsnOptFreeFunc) MapsFree);
189       if (isError && ptr -> location == NULL) {
190          goto erret;
191       }
192       atp = AsnReadId(aip,amp, atp);
193    }
194    if (atp == ENTREZGENE_gene_source) {
195       ptr -> gene_source = GeneSourceAsnRead(aip, atp);
196       if (aip -> io_failure) {
197          goto erret;
198       }
199       atp = AsnReadId(aip,amp, atp);
200    }
201    if (atp == ENTREZGENE_locus) {
202       ptr -> locus = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
203       if (isError && ptr -> locus == NULL) {
204          goto erret;
205       }
206       atp = AsnReadId(aip,amp, atp);
207    }
208    if (atp == ENTREZGENE_properties) {
209       ptr -> properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
210       if (isError && ptr -> properties == NULL) {
211          goto erret;
212       }
213       atp = AsnReadId(aip,amp, atp);
214    }
215    if (atp == ENTREZGENE_refgene) {
216       ptr -> refgene = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
217       if (isError && ptr -> refgene == NULL) {
218          goto erret;
219       }
220       atp = AsnReadId(aip,amp, atp);
221    }
222    if (atp == ENTREZGENE_homology) {
223       ptr -> homology = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
224       if (isError && ptr -> homology == NULL) {
225          goto erret;
226       }
227       atp = AsnReadId(aip,amp, atp);
228    }
229    if (atp == ENTREZGENE_comments) {
230       ptr -> comments = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
231       if (isError && ptr -> comments == NULL) {
232          goto erret;
233       }
234       atp = AsnReadId(aip,amp, atp);
235    }
236    if (atp == ENTREZGENE_unique_keys) {
237       ptr -> unique_keys = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) DbtagAsnRead, (AsnOptFreeFunc) DbtagFree);
238       if (isError && ptr -> unique_keys == NULL) {
239          goto erret;
240       }
241       atp = AsnReadId(aip,amp, atp);
242    }
243    if (atp == ENTREZGENE_xtra_index_terms) {
244       ptr -> xtra_index_terms = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
245       if (isError && ptr -> xtra_index_terms == NULL) {
246          goto erret;
247       }
248       atp = AsnReadId(aip,amp, atp);
249    }
250    if (atp == ENTREZGENE_xtra_properties) {
251       ptr -> xtra_properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) XtraTermsAsnRead, (AsnOptFreeFunc) XtraTermsFree);
252       if (isError && ptr -> xtra_properties == NULL) {
253          goto erret;
254       }
255       atp = AsnReadId(aip,amp, atp);
256    }
257    if (atp == ENTREZGENE_xtra_iq) {
258       ptr -> xtra_iq = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) XtraTermsAsnRead, (AsnOptFreeFunc) XtraTermsFree);
259       if (isError && ptr -> xtra_iq == NULL) {
260          goto erret;
261       }
262       atp = AsnReadId(aip,amp, atp);
263    }
264    if (atp == ENTREZGENE_non_unique_keys) {
265       ptr -> non_unique_keys = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) DbtagAsnRead, (AsnOptFreeFunc) DbtagFree);
266       if (isError && ptr -> non_unique_keys == NULL) {
267          goto erret;
268       }
269       atp = AsnReadId(aip,amp, atp);
270    }
271 
272    if (AsnReadVal(aip, atp, &av) <= 0) {
273       goto erret;
274    }
275    /* end struct */
276 
277 ret:
278    AsnUnlinkType(orig);       /* unlink local tree */
279    return ptr;
280 
281 erret:
282    aip -> io_failure = TRUE;
283    ptr = EntrezgeneFree(ptr);
284    goto ret;
285 }
286 
287 
288 
289 /**************************************************
290 *
291 *    EntrezgeneAsnWrite()
292 *
293 **************************************************/
294 NLM_EXTERN Boolean LIBCALL 
295 EntrezgeneAsnWrite(EntrezgenePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
296 {
297    DataVal av;
298    AsnTypePtr atp;
299    Boolean retval = FALSE;
300 
301    if (! loaded)
302    {
303       if (! objentgeneAsnLoad()) {
304          return FALSE;
305       }
306    }
307 
308    if (aip == NULL) {
309       return FALSE;
310    }
311 
312    atp = AsnLinkType(orig, ENTREZGENE);   /* link local tree */
313    if (atp == NULL) {
314       return FALSE;
315    }
316 
317    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
318    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
319       goto erret;
320    }
321 
322    if (ptr -> track_info != NULL) {
323       if ( ! GeneTrackAsnWrite(ptr -> track_info, aip, ENTREZGENE_track_info)) {
324          goto erret;
325       }
326    }
327    av.intvalue = ptr -> type;
328    retval = AsnWrite(aip, ENTREZGENE_type,  &av);
329    if (ptr -> source != NULL) {
330       if ( ! BioSourceAsnWrite(ptr -> source, aip, ENTREZGENE_source)) {
331          goto erret;
332       }
333    }
334    if (ptr -> gene != NULL) {
335       if ( ! GeneRefAsnWrite(ptr -> gene, aip, ENTREZGENE_gene)) {
336          goto erret;
337       }
338    }
339    if (ptr -> prot != NULL) {
340       if ( ! ProtRefAsnWrite(ptr -> prot, aip, ENTREZGENE_prot)) {
341          goto erret;
342       }
343    }
344    if (ptr -> rna != NULL) {
345       if ( ! RNARefAsnWrite(ptr -> rna, aip, ENTREZGENE_rna)) {
346          goto erret;
347       }
348    }
349    if (ptr -> summary != NULL) {
350       av.ptrvalue = ptr -> summary;
351       retval = AsnWrite(aip, ENTREZGENE_summary,  &av);
352    }
353    AsnGenericUserSeqOfAsnWrite(ptr -> location, (AsnWriteFunc) MapsAsnWrite, aip, ENTREZGENE_location, ENTREZGENE_location_E);
354    if (ptr -> gene_source != NULL) {
355       if ( ! GeneSourceAsnWrite(ptr -> gene_source, aip, ENTREZGENE_gene_source)) {
356          goto erret;
357       }
358    }
359    AsnGenericUserSeqOfAsnWrite(ptr -> locus, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_locus, ENTREZGENE_locus_E);
360    AsnGenericUserSeqOfAsnWrite(ptr -> properties, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_properties, ENTREZGENE_properties_E);
361    AsnGenericUserSeqOfAsnWrite(ptr -> refgene, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_refgene, ENTREZGENE_refgene_E);
362    AsnGenericUserSeqOfAsnWrite(ptr -> homology, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_homology, ENTREZGENE_homology_E);
363    AsnGenericUserSeqOfAsnWrite(ptr -> comments, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_comments, ENTREZGENE_comments_E);
364    AsnGenericUserSeqOfAsnWrite(ptr -> unique_keys, (AsnWriteFunc) DbtagAsnWrite, aip, ENTREZGENE_unique_keys, ENTREZGENE_unique_keys_E);
365    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> xtra_index_terms ,ASNCODE_PTRVAL_SLOT, aip, ENTREZGENE_xtra_index_terms, ENTREZGENE_xtra_index_terms_E);
366    AsnGenericUserSeqOfAsnWrite(ptr -> xtra_properties, (AsnWriteFunc) XtraTermsAsnWrite, aip, ENTREZGENE_xtra_properties, ENTREZGENE_xtra_properties_E);
367    AsnGenericUserSeqOfAsnWrite(ptr -> xtra_iq, (AsnWriteFunc) XtraTermsAsnWrite, aip, ENTREZGENE_xtra_iq, ENTREZGENE_xtra_iq_E);
368    AsnGenericUserSeqOfAsnWrite(ptr -> non_unique_keys, (AsnWriteFunc) DbtagAsnWrite, aip, ENTREZGENE_non_unique_keys, ENTREZGENE_non_unique_keys_E);
369    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
370       goto erret;
371    }
372    retval = TRUE;
373 
374 erret:
375    AsnUnlinkType(orig);       /* unlink local tree */
376    return retval;
377 }
378 
379 
380 
381 /**************************************************
382 *
383 *    EntrezgeneSetFree()
384 *
385 **************************************************/
386 NLM_EXTERN 
387 EntrezgeneSetPtr LIBCALL
388 EntrezgeneSetFree(EntrezgeneSetPtr ptr)
389 {
390 
391    if(ptr == NULL) {
392       return NULL;
393    }
394    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) EntrezgeneFree);
395    return NULL;
396 }
397 
398 
399 /**************************************************
400 *
401 *    EntrezgeneSetAsnRead()
402 *
403 **************************************************/
404 NLM_EXTERN 
405 EntrezgeneSetPtr LIBCALL
406 EntrezgeneSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
407 {
408    DataVal av;
409    AsnTypePtr atp;
410    Boolean isError = FALSE;
411    AsnReadFunc func;
412    EntrezgeneSetPtr ptr;
413 
414    if (! loaded)
415    {
416       if (! objentgeneAsnLoad()) {
417          return NULL;
418       }
419    }
420 
421    if (aip == NULL) {
422       return NULL;
423    }
424 
425    if (orig == NULL) {         /* EntrezgeneSet ::= (self contained) */
426       atp = AsnReadId(aip, amp, ENTREZGENE_SET);
427    } else {
428       atp = AsnLinkType(orig, ENTREZGENE_SET);
429    }
430    /* link in local tree */
431    if (atp == NULL) {
432       return NULL;
433    }
434 
435    func = NULL;
436 
437    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) EntrezgeneAsnRead, (AsnOptFreeFunc) EntrezgeneFree);
438    if (isError && ptr  == NULL) {
439       goto erret;
440    }
441 
442 
443 
444 ret:
445    AsnUnlinkType(orig);       /* unlink local tree */
446    return ptr;
447 
448 erret:
449    aip -> io_failure = TRUE;
450    ptr = EntrezgeneSetFree(ptr);
451    goto ret;
452 }
453 
454 
455 
456 /**************************************************
457 *
458 *    EntrezgeneSetAsnWrite()
459 *
460 **************************************************/
461 NLM_EXTERN Boolean LIBCALL 
462 EntrezgeneSetAsnWrite(EntrezgeneSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
463 {
464    DataVal av;
465    AsnTypePtr atp;
466    Boolean retval = FALSE;
467 
468    if (! loaded)
469    {
470       if (! objentgeneAsnLoad()) {
471          return FALSE;
472       }
473    }
474 
475    if (aip == NULL) {
476       return FALSE;
477    }
478 
479    atp = AsnLinkType(orig, ENTREZGENE_SET);   /* link local tree */
480    if (atp == NULL) {
481       return FALSE;
482    }
483 
484    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
485    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) EntrezgeneAsnWrite, aip, atp, ENTREZGENE_SET_E);
486    retval = TRUE;
487 
488 erret:
489    AsnUnlinkType(orig);       /* unlink local tree */
490    return retval;
491 }
492 
493 
494 
495 /**************************************************
496 *
497 *    GeneTrackNew()
498 *
499 **************************************************/
500 NLM_EXTERN 
501 GeneTrackPtr LIBCALL
502 GeneTrackNew(void)
503 {
504    GeneTrackPtr ptr = MemNew((size_t) sizeof(GeneTrack));
505 
506    ptr -> status = 0;
507    return ptr;
508 
509 }
510 
511 
512 /**************************************************
513 *
514 *    GeneTrackFree()
515 *
516 **************************************************/
517 NLM_EXTERN 
518 GeneTrackPtr LIBCALL
519 GeneTrackFree(GeneTrackPtr ptr)
520 {
521 
522    if(ptr == NULL) {
523       return NULL;
524    }
525    AsnGenericUserSeqOfFree(ptr -> current_id, (AsnOptFreeFunc) DbtagFree);
526    DateFree(ptr -> create_date);
527    DateFree(ptr -> update_date);
528    DateFree(ptr -> discontinue_date);
529    return MemFree(ptr);
530 }
531 
532 
533 /**************************************************
534 *
535 *    GeneTrackAsnRead()
536 *
537 **************************************************/
538 NLM_EXTERN 
539 GeneTrackPtr LIBCALL
540 GeneTrackAsnRead(AsnIoPtr aip, AsnTypePtr orig)
541 {
542    DataVal av;
543    AsnTypePtr atp;
544    Boolean isError = FALSE;
545    AsnReadFunc func;
546    GeneTrackPtr ptr;
547 
548    if (! loaded)
549    {
550       if (! objentgeneAsnLoad()) {
551          return NULL;
552       }
553    }
554 
555    if (aip == NULL) {
556       return NULL;
557    }
558 
559    if (orig == NULL) {         /* GeneTrack ::= (self contained) */
560       atp = AsnReadId(aip, amp, GENE_TRACK);
561    } else {
562       atp = AsnLinkType(orig, GENE_TRACK);
563    }
564    /* link in local tree */
565    if (atp == NULL) {
566       return NULL;
567    }
568 
569    ptr = GeneTrackNew();
570    if (ptr == NULL) {
571       goto erret;
572    }
573    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
574       goto erret;
575    }
576 
577    atp = AsnReadId(aip,amp, atp);
578    func = NULL;
579 
580    if (atp == GENE_TRACK_geneid) {
581       if ( AsnReadVal(aip, atp, &av) <= 0) {
582          goto erret;
583       }
584       ptr -> geneid = av.intvalue;
585       atp = AsnReadId(aip,amp, atp);
586    }
587    if (atp == GENE_TRACK_status) {
588       if ( AsnReadVal(aip, atp, &av) <= 0) {
589          goto erret;
590       }
591       ptr -> status = av.intvalue;
592       atp = AsnReadId(aip,amp, atp);
593    }
594    if (atp == GENE_TRACK_current_id) {
595       ptr -> current_id = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) DbtagAsnRead, (AsnOptFreeFunc) DbtagFree);
596       if (isError && ptr -> current_id == NULL) {
597          goto erret;
598       }
599       atp = AsnReadId(aip,amp, atp);
600    }
601    if (atp == GENE_TRACK_create_date) {
602       ptr -> create_date = DateAsnRead(aip, atp);
603       if (aip -> io_failure) {
604          goto erret;
605       }
606       atp = AsnReadId(aip,amp, atp);
607    }
608    if (atp == GENE_TRACK_update_date) {
609       ptr -> update_date = DateAsnRead(aip, atp);
610       if (aip -> io_failure) {
611          goto erret;
612       }
613       atp = AsnReadId(aip,amp, atp);
614    }
615    if (atp == GENE_TRACK_discontinue_date) {
616       ptr -> discontinue_date = DateAsnRead(aip, atp);
617       if (aip -> io_failure) {
618          goto erret;
619       }
620       atp = AsnReadId(aip,amp, atp);
621    }
622 
623    if (AsnReadVal(aip, atp, &av) <= 0) {
624       goto erret;
625    }
626    /* end struct */
627 
628 ret:
629    AsnUnlinkType(orig);       /* unlink local tree */
630    return ptr;
631 
632 erret:
633    aip -> io_failure = TRUE;
634    ptr = GeneTrackFree(ptr);
635    goto ret;
636 }
637 
638 
639 
640 /**************************************************
641 *
642 *    GeneTrackAsnWrite()
643 *
644 **************************************************/
645 NLM_EXTERN Boolean LIBCALL 
646 GeneTrackAsnWrite(GeneTrackPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
647 {
648    DataVal av;
649    AsnTypePtr atp;
650    Boolean retval = FALSE;
651 
652    if (! loaded)
653    {
654       if (! objentgeneAsnLoad()) {
655          return FALSE;
656       }
657    }
658 
659    if (aip == NULL) {
660       return FALSE;
661    }
662 
663    atp = AsnLinkType(orig, GENE_TRACK);   /* link local tree */
664    if (atp == NULL) {
665       return FALSE;
666    }
667 
668    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
669    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
670       goto erret;
671    }
672 
673    av.intvalue = ptr -> geneid;
674    retval = AsnWrite(aip, GENE_TRACK_geneid,  &av);
675    av.intvalue = ptr -> status;
676    retval = AsnWrite(aip, GENE_TRACK_status,  &av);
677    AsnGenericUserSeqOfAsnWrite(ptr -> current_id, (AsnWriteFunc) DbtagAsnWrite, aip, GENE_TRACK_current_id, GENE_TRACK_current_id_E);
678    if (ptr -> create_date != NULL) {
679       if ( ! DateAsnWrite(ptr -> create_date, aip, GENE_TRACK_create_date)) {
680          goto erret;
681       }
682    }
683    if (ptr -> update_date != NULL) {
684       if ( ! DateAsnWrite(ptr -> update_date, aip, GENE_TRACK_update_date)) {
685          goto erret;
686       }
687    }
688    if (ptr -> discontinue_date != NULL) {
689       if ( ! DateAsnWrite(ptr -> discontinue_date, aip, GENE_TRACK_discontinue_date)) {
690          goto erret;
691       }
692    }
693    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
694       goto erret;
695    }
696    retval = TRUE;
697 
698 erret:
699    AsnUnlinkType(orig);       /* unlink local tree */
700    return retval;
701 }
702 
703 
704 
705 /**************************************************
706 *
707 *    GeneCommentaryNew()
708 *
709 **************************************************/
710 NLM_EXTERN 
711 GeneCommentaryPtr LIBCALL
712 GeneCommentaryNew(void)
713 {
714    GeneCommentaryPtr ptr = MemNew((size_t) sizeof(GeneCommentary));
715 
716    return ptr;
717 
718 }
719 
720 
721 /**************************************************
722 *
723 *    GeneCommentaryFree()
724 *
725 **************************************************/
726 NLM_EXTERN 
727 GeneCommentaryPtr LIBCALL
728 GeneCommentaryFree(GeneCommentaryPtr ptr)
729 {
730 
731    if(ptr == NULL) {
732       return NULL;
733    }
734    MemFree(ptr -> heading);
735    MemFree(ptr -> label);
736    MemFree(ptr -> text);
737    MemFree(ptr -> accession);
738    AsnGenericUserSeqOfFree(ptr -> xtra_properties, (AsnOptFreeFunc) XtraTermsFree);
739    AsnGenericChoiceSeqOfFree(ptr -> refs, (AsnOptFreeFunc) PubFree);
740    AsnGenericUserSeqOfFree(ptr -> source, (AsnOptFreeFunc) OtherSourceFree);
741    AsnGenericChoiceSeqOfFree(ptr -> genomic_coords, (AsnOptFreeFunc) SeqLocFree);
742    AsnGenericChoiceSeqOfFree(ptr -> seqs, (AsnOptFreeFunc) SeqLocFree);
743    AsnGenericUserSeqOfFree(ptr -> products, (AsnOptFreeFunc) GeneCommentaryFree);
744    AsnGenericUserSeqOfFree(ptr -> properties, (AsnOptFreeFunc) GeneCommentaryFree);
745    AsnGenericUserSeqOfFree(ptr -> comment, (AsnOptFreeFunc) GeneCommentaryFree);
746    DateFree(ptr -> create_date);
747    DateFree(ptr -> update_date);
748    return MemFree(ptr);
749 }
750 
751 
752 /**************************************************
753 *
754 *    GeneCommentaryAsnRead()
755 *
756 **************************************************/
757 NLM_EXTERN 
758 GeneCommentaryPtr LIBCALL
759 GeneCommentaryAsnRead(AsnIoPtr aip, AsnTypePtr orig)
760 {
761    DataVal av;
762    AsnTypePtr atp;
763    Boolean isError = FALSE;
764    AsnReadFunc func;
765    GeneCommentaryPtr ptr;
766 
767    if (! loaded)
768    {
769       if (! objentgeneAsnLoad()) {
770          return NULL;
771       }
772    }
773 
774    if (aip == NULL) {
775       return NULL;
776    }
777 
778    if (orig == NULL) {         /* GeneCommentary ::= (self contained) */
779       atp = AsnReadId(aip, amp, GENE_COMMENTARY);
780    } else {
781       atp = AsnLinkType(orig, GENE_COMMENTARY);
782    }
783    /* link in local tree */
784    if (atp == NULL) {
785       return NULL;
786    }
787 
788    ptr = GeneCommentaryNew();
789    if (ptr == NULL) {
790       goto erret;
791    }
792    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
793       goto erret;
794    }
795 
796    atp = AsnReadId(aip,amp, atp);
797    func = NULL;
798 
799    if (atp == GENE_COMMENTARY_type) {
800       if ( AsnReadVal(aip, atp, &av) <= 0) {
801          goto erret;
802       }
803       ptr -> type = av.intvalue;
804       atp = AsnReadId(aip,amp, atp);
805    }
806    if (atp == GENE_COMMENTARY_heading) {
807       if ( AsnReadVal(aip, atp, &av) <= 0) {
808          goto erret;
809       }
810       ptr -> heading = av.ptrvalue;
811       atp = AsnReadId(aip,amp, atp);
812    }
813    if (atp == GENE_COMMENTARY_label) {
814       if ( AsnReadVal(aip, atp, &av) <= 0) {
815          goto erret;
816       }
817       ptr -> label = av.ptrvalue;
818       atp = AsnReadId(aip,amp, atp);
819    }
820    if (atp == GENE_COMMENTARY_text) {
821       if ( AsnReadVal(aip, atp, &av) <= 0) {
822          goto erret;
823       }
824       ptr -> text = av.ptrvalue;
825       atp = AsnReadId(aip,amp, atp);
826    }
827    if (atp == GENE_COMMENTARY_accession) {
828       if ( AsnReadVal(aip, atp, &av) <= 0) {
829          goto erret;
830       }
831       ptr -> accession = av.ptrvalue;
832       atp = AsnReadId(aip,amp, atp);
833    }
834    if (atp == GENE_COMMENTARY_version) {
835       if ( AsnReadVal(aip, atp, &av) <= 0) {
836          goto erret;
837       }
838       ptr -> version = av.intvalue;
839       atp = AsnReadId(aip,amp, atp);
840    }
841    if (atp == GENE_COMMENTARY_xtra_properties) {
842       ptr -> xtra_properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) XtraTermsAsnRead, (AsnOptFreeFunc) XtraTermsFree);
843       if (isError && ptr -> xtra_properties == NULL) {
844          goto erret;
845       }
846       atp = AsnReadId(aip,amp, atp);
847    }
848    if (atp == GENE_COMMENTARY_refs) {
849       ptr -> refs = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) PubAsnRead, (AsnOptFreeFunc) PubFree);
850       if (isError && ptr -> refs == NULL) {
851          goto erret;
852       }
853       atp = AsnReadId(aip,amp, atp);
854    }
855    if (atp == GENE_COMMENTARY_source) {
856       ptr -> source = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) OtherSourceAsnRead, (AsnOptFreeFunc) OtherSourceFree);
857       if (isError && ptr -> source == NULL) {
858          goto erret;
859       }
860       atp = AsnReadId(aip,amp, atp);
861    }
862    if (atp == GENE_COMMENTARY_genomic_coords) {
863       ptr -> genomic_coords = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
864       if (isError && ptr -> genomic_coords == NULL) {
865          goto erret;
866       }
867       atp = AsnReadId(aip,amp, atp);
868    }
869    if (atp == GENE_COMMENTARY_seqs) {
870       ptr -> seqs = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
871       if (isError && ptr -> seqs == NULL) {
872          goto erret;
873       }
874       atp = AsnReadId(aip,amp, atp);
875    }
876    if (atp == GENE_COMMENTARY_products) {
877       ptr -> products = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
878       if (isError && ptr -> products == NULL) {
879          goto erret;
880       }
881       atp = AsnReadId(aip,amp, atp);
882    }
883    if (atp == GENE_COMMENTARY_properties) {
884       ptr -> properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
885       if (isError && ptr -> properties == NULL) {
886          goto erret;
887       }
888       atp = AsnReadId(aip,amp, atp);
889    }
890    if (atp == GENE_COMMENTARY_comment) {
891       ptr -> comment = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
892       if (isError && ptr -> comment == NULL) {
893          goto erret;
894       }
895       atp = AsnReadId(aip,amp, atp);
896    }
897    if (atp == GENE_COMMENTARY_create_date) {
898       ptr -> create_date = DateAsnRead(aip, atp);
899       if (aip -> io_failure) {
900          goto erret;
901       }
902       atp = AsnReadId(aip,amp, atp);
903    }
904    if (atp == GENE_COMMENTARY_update_date) {
905       ptr -> update_date = DateAsnRead(aip, atp);
906       if (aip -> io_failure) {
907          goto erret;
908       }
909       atp = AsnReadId(aip,amp, atp);
910    }
911 
912    if (AsnReadVal(aip, atp, &av) <= 0) {
913       goto erret;
914    }
915    /* end struct */
916 
917 ret:
918    AsnUnlinkType(orig);       /* unlink local tree */
919    return ptr;
920 
921 erret:
922    aip -> io_failure = TRUE;
923    ptr = GeneCommentaryFree(ptr);
924    goto ret;
925 }
926 
927 
928 
929 /**************************************************
930 *
931 *    GeneCommentaryAsnWrite()
932 *
933 **************************************************/
934 NLM_EXTERN Boolean LIBCALL 
935 GeneCommentaryAsnWrite(GeneCommentaryPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
936 {
937    DataVal av;
938    AsnTypePtr atp;
939    Boolean retval = FALSE;
940 
941    if (! loaded)
942    {
943       if (! objentgeneAsnLoad()) {
944          return FALSE;
945       }
946    }
947 
948    if (aip == NULL) {
949       return FALSE;
950    }
951 
952    atp = AsnLinkType(orig, GENE_COMMENTARY);   /* link local tree */
953    if (atp == NULL) {
954       return FALSE;
955    }
956 
957    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
958    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
959       goto erret;
960    }
961 
962    av.intvalue = ptr -> type;
963    retval = AsnWrite(aip, GENE_COMMENTARY_type,  &av);
964    if (ptr -> heading != NULL) {
965       av.ptrvalue = ptr -> heading;
966       retval = AsnWrite(aip, GENE_COMMENTARY_heading,  &av);
967    }
968    if (ptr -> label != NULL) {
969       av.ptrvalue = ptr -> label;
970       retval = AsnWrite(aip, GENE_COMMENTARY_label,  &av);
971    }
972    if (ptr -> text != NULL) {
973       av.ptrvalue = ptr -> text;
974       retval = AsnWrite(aip, GENE_COMMENTARY_text,  &av);
975    }
976    if (ptr -> accession != NULL) {
977       av.ptrvalue = ptr -> accession;
978       retval = AsnWrite(aip, GENE_COMMENTARY_accession,  &av);
979    }
980    av.intvalue = ptr -> version;
981    retval = AsnWrite(aip, GENE_COMMENTARY_version,  &av);
982    AsnGenericUserSeqOfAsnWrite(ptr -> xtra_properties, (AsnWriteFunc) XtraTermsAsnWrite, aip, GENE_COMMENTARY_xtra_properties, COMMENTARY_xtra_properties_E);
983    AsnGenericChoiceSeqOfAsnWrite(ptr -> refs, (AsnWriteFunc) PubAsnWrite, aip, GENE_COMMENTARY_refs, GENE_COMMENTARY_refs_E);
984    AsnGenericUserSeqOfAsnWrite(ptr -> source, (AsnWriteFunc) OtherSourceAsnWrite, aip, GENE_COMMENTARY_source, GENE_COMMENTARY_source_E);
985    AsnGenericChoiceSeqOfAsnWrite(ptr -> genomic_coords, (AsnWriteFunc) SeqLocAsnWrite, aip, GENE_COMMENTARY_genomic_coords, COMMENTARY_genomic_coords_E);
986    AsnGenericChoiceSeqOfAsnWrite(ptr -> seqs, (AsnWriteFunc) SeqLocAsnWrite, aip, GENE_COMMENTARY_seqs, GENE_COMMENTARY_seqs_E);
987    AsnGenericUserSeqOfAsnWrite(ptr -> products, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, GENE_COMMENTARY_products, GENE_COMMENTARY_products_E);
988    AsnGenericUserSeqOfAsnWrite(ptr -> properties, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, GENE_COMMENTARY_properties, GENE_COMMENTARY_properties_E);
989    AsnGenericUserSeqOfAsnWrite(ptr -> comment, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, GENE_COMMENTARY_comment, GENE_COMMENTARY_comment_E);
990    if (ptr -> create_date != NULL) {
991       if ( ! DateAsnWrite(ptr -> create_date, aip, GENE_COMMENTARY_create_date)) {
992          goto erret;
993       }
994    }
995    if (ptr -> update_date != NULL) {
996       if ( ! DateAsnWrite(ptr -> update_date, aip, GENE_COMMENTARY_update_date)) {
997          goto erret;
998       }
999    }
1000    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1001       goto erret;
1002    }
1003    retval = TRUE;
1004 
1005 erret:
1006    AsnUnlinkType(orig);       /* unlink local tree */
1007    return retval;
1008 }
1009 
1010 
1011 
1012 /**************************************************
1013 *
1014 *    MapsNew()
1015 *
1016 **************************************************/
1017 NLM_EXTERN 
1018 MapsPtr LIBCALL
1019 MapsNew(void)
1020 {
1021    MapsPtr ptr = MemNew((size_t) sizeof(Maps));
1022 
1023    return ptr;
1024 
1025 }
1026 
1027 
1028 /**************************************************
1029 *
1030 *    MapsFree()
1031 *
1032 **************************************************/
1033 NLM_EXTERN 
1034 MapsPtr LIBCALL
1035 MapsFree(MapsPtr ptr)
1036 {
1037 
1038    if(ptr == NULL) {
1039       return NULL;
1040    }
1041    MemFree(ptr -> display_str);
1042    Method_methodFree(ptr -> Method_method);
1043    return MemFree(ptr);
1044 }
1045 
1046 
1047 /**************************************************
1048 *
1049 *    Method_methodFree()
1050 *
1051 **************************************************/
1052 static 
1053 Method_methodPtr LIBCALL
1054 Method_methodFree(ValNodePtr anp)
1055 {
1056    Pointer pnt;
1057 
1058    if (anp == NULL) {
1059       return NULL;
1060    }
1061 
1062    pnt = anp->data.ptrvalue;
1063    switch (anp->choice)
1064    {
1065    default:
1066       break;
1067    case Method_method_proxy:
1068       MemFree(anp -> data.ptrvalue);
1069       break;
1070    }
1071    return MemFree(anp);
1072 }
1073 
1074 
1075 /**************************************************
1076 *
1077 *    MapsAsnRead()
1078 *
1079 **************************************************/
1080 NLM_EXTERN 
1081 MapsPtr LIBCALL
1082 MapsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1083 {
1084    DataVal av;
1085    AsnTypePtr atp;
1086    Boolean isError = FALSE;
1087    AsnReadFunc func;
1088    MapsPtr ptr;
1089 
1090    if (! loaded)
1091    {
1092       if (! objentgeneAsnLoad()) {
1093          return NULL;
1094       }
1095    }
1096 
1097    if (aip == NULL) {
1098       return NULL;
1099    }
1100 
1101    if (orig == NULL) {         /* Maps ::= (self contained) */
1102       atp = AsnReadId(aip, amp, MAPS);
1103    } else {
1104       atp = AsnLinkType(orig, MAPS);
1105    }
1106    /* link in local tree */
1107    if (atp == NULL) {
1108       return NULL;
1109    }
1110 
1111    ptr = MapsNew();
1112    if (ptr == NULL) {
1113       goto erret;
1114    }
1115    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1116       goto erret;
1117    }
1118 
1119    atp = AsnReadId(aip,amp, atp);
1120    func = NULL;
1121 
1122    if (atp == MAPS_display_str) {
1123       if ( AsnReadVal(aip, atp, &av) <= 0) {
1124          goto erret;
1125       }
1126       ptr -> display_str = av.ptrvalue;
1127       atp = AsnReadId(aip,amp, atp);
1128    }
1129    if (atp == MAPS_method) {
1130       ptr -> Method_method = Method_methodAsnRead(aip, atp);
1131       if (aip -> io_failure) {
1132          goto erret;
1133       }
1134       atp = AsnReadId(aip,amp, atp);
1135    }
1136 
1137    if (AsnReadVal(aip, atp, &av) <= 0) {
1138       goto erret;
1139    }
1140    /* end struct */
1141 
1142 ret:
1143    AsnUnlinkType(orig);       /* unlink local tree */
1144    return ptr;
1145 
1146 erret:
1147    aip -> io_failure = TRUE;
1148    ptr = MapsFree(ptr);
1149    goto ret;
1150 }
1151 
1152 
1153 
1154 /**************************************************
1155 *
1156 *    Method_methodAsnRead()
1157 *
1158 **************************************************/
1159 static 
1160 Method_methodPtr LIBCALL
1161 Method_methodAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1162 {
1163    DataVal av;
1164    AsnTypePtr atp;
1165    ValNodePtr anp;
1166    Uint1 choice;
1167    Boolean isError = FALSE;
1168    Boolean nullIsError = FALSE;
1169    AsnReadFunc func;
1170 
1171    if (! loaded)
1172    {
1173       if (! objentgeneAsnLoad()) {
1174          return NULL;
1175       }
1176    }
1177 
1178    if (aip == NULL) {
1179       return NULL;
1180    }
1181 
1182    if (orig == NULL) {         /* Method_method ::= (self contained) */
1183       atp = AsnReadId(aip, amp, MAPS_method);
1184    } else {
1185       atp = AsnLinkType(orig, MAPS_method);    /* link in local tree */
1186    }
1187    if (atp == NULL) {
1188       return NULL;
1189    }
1190 
1191    anp = ValNodeNew(NULL);
1192    if (anp == NULL) {
1193       goto erret;
1194    }
1195    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1196       goto erret;
1197    }
1198 
1199    func = NULL;
1200 
1201    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1202    if (atp == NULL) {
1203       goto erret;
1204    }
1205    if (atp == MAPS_method_proxy) {
1206       choice = Method_method_proxy;
1207       if (AsnReadVal(aip, atp, &av) <= 0) {
1208          goto erret;
1209       }
1210       anp->data.ptrvalue = av.ptrvalue;
1211    }
1212    else if (atp == MAPS_method_map_type) {
1213       choice = Method_method_map_type;
1214       if (AsnReadVal(aip, atp, &av) <= 0) {
1215          goto erret;
1216       }
1217       anp->data.intvalue = av.intvalue;
1218    }
1219    anp->choice = choice;
1220    if (func != NULL)
1221    {
1222       anp->data.ptrvalue = (* func)(aip, atp);
1223       if (aip -> io_failure) goto erret;
1224 
1225       if (nullIsError && anp->data.ptrvalue == NULL) {
1226          goto erret;
1227       }
1228    }
1229 
1230 ret:
1231    AsnUnlinkType(orig);       /* unlink local tree */
1232    return anp;
1233 
1234 erret:
1235    anp = MemFree(anp);
1236    aip -> io_failure = TRUE;
1237    goto ret;
1238 }
1239 
1240 
1241 /**************************************************
1242 *
1243 *    MapsAsnWrite()
1244 *
1245 **************************************************/
1246 NLM_EXTERN Boolean LIBCALL 
1247 MapsAsnWrite(MapsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1248 {
1249    DataVal av;
1250    AsnTypePtr atp;
1251    Boolean retval = FALSE;
1252 
1253    if (! loaded)
1254    {
1255       if (! objentgeneAsnLoad()) {
1256          return FALSE;
1257       }
1258    }
1259 
1260    if (aip == NULL) {
1261       return FALSE;
1262    }
1263 
1264    atp = AsnLinkType(orig, MAPS);   /* link local tree */
1265    if (atp == NULL) {
1266       return FALSE;
1267    }
1268 
1269    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1270    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1271       goto erret;
1272    }
1273 
1274    if (ptr -> display_str != NULL) {
1275       av.ptrvalue = ptr -> display_str;
1276       retval = AsnWrite(aip, MAPS_display_str,  &av);
1277    }
1278    if (ptr -> Method_method != NULL) {
1279       if ( ! Method_methodAsnWrite(ptr -> Method_method, aip, MAPS_method)) {
1280          goto erret;
1281       }
1282    }
1283    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1284       goto erret;
1285    }
1286    retval = TRUE;
1287 
1288 erret:
1289    AsnUnlinkType(orig);       /* unlink local tree */
1290    return retval;
1291 }
1292 
1293 
1294 
1295 /**************************************************
1296 *
1297 *    Method_methodAsnWrite()
1298 *
1299 **************************************************/
1300 static Boolean LIBCALL 
1301 Method_methodAsnWrite(Method_methodPtr anp, AsnIoPtr aip, AsnTypePtr orig)
1302 
1303 {
1304    DataVal av;
1305    AsnTypePtr atp, writetype = NULL;
1306    Pointer pnt;
1307    AsnWriteFunc func = NULL;
1308    Boolean retval = FALSE;
1309 
1310    if (! loaded)
1311    {
1312       if (! objentgeneAsnLoad())
1313       return FALSE;
1314    }
1315 
1316    if (aip == NULL)
1317    return FALSE;
1318 
1319    atp = AsnLinkType(orig, MAPS_method);   /* link local tree */
1320    if (atp == NULL) {
1321       return FALSE;
1322    }
1323 
1324    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1325 
1326    av.ptrvalue = (Pointer)anp;
1327    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1328       goto erret;
1329    }
1330 
1331    pnt = anp->data.ptrvalue;
1332    switch (anp->choice)
1333    {
1334    case Method_method_proxy:
1335       av.ptrvalue = anp->data.ptrvalue;
1336       retval = AsnWrite(aip, MAPS_method_proxy, &av);
1337       break;
1338    case Method_method_map_type:
1339       av.intvalue = anp->data.intvalue;
1340       retval = AsnWrite(aip, MAPS_method_map_type, &av);
1341       break;
1342    }
1343    if (writetype != NULL) {
1344       retval = (* func)(pnt, aip, writetype);   /* write it out */
1345    }
1346    if (!retval) {
1347       goto erret;
1348    }
1349    retval = TRUE;
1350 
1351 erret:
1352    AsnUnlinkType(orig);       /* unlink local tree */
1353    return retval;
1354 }
1355 
1356 
1357 /**************************************************
1358 *
1359 *    GeneSourceNew()
1360 *
1361 **************************************************/
1362 NLM_EXTERN 
1363 GeneSourcePtr LIBCALL
1364 GeneSourceNew(void)
1365 {
1366    GeneSourcePtr ptr = MemNew((size_t) sizeof(GeneSource));
1367 
1368    ptr -> gene_display = 0;
1369    ptr -> locus_display = 0;
1370    ptr -> extra_terms = 0;
1371    return ptr;
1372 
1373 }
1374 
1375 
1376 /**************************************************
1377 *
1378 *    GeneSourceFree()
1379 *
1380 **************************************************/
1381 NLM_EXTERN 
1382 GeneSourcePtr LIBCALL
1383 GeneSourceFree(GeneSourcePtr ptr)
1384 {
1385 
1386    if(ptr == NULL) {
1387       return NULL;
1388    }
1389    MemFree(ptr -> src);
1390    MemFree(ptr -> src_str1);
1391    MemFree(ptr -> src_str2);
1392    return MemFree(ptr);
1393 }
1394 
1395 
1396 /**************************************************
1397 *
1398 *    GeneSourceAsnRead()
1399 *
1400 **************************************************/
1401 NLM_EXTERN 
1402 GeneSourcePtr LIBCALL
1403 GeneSourceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1404 {
1405    DataVal av;
1406    AsnTypePtr atp;
1407    Boolean isError = FALSE;
1408    AsnReadFunc func;
1409    GeneSourcePtr ptr;
1410 
1411    if (! loaded)
1412    {
1413       if (! objentgeneAsnLoad()) {
1414          return NULL;
1415       }
1416    }
1417 
1418    if (aip == NULL) {
1419       return NULL;
1420    }
1421 
1422    if (orig == NULL) {         /* GeneSource ::= (self contained) */
1423       atp = AsnReadId(aip, amp, GENE_SOURCE);
1424    } else {
1425       atp = AsnLinkType(orig, GENE_SOURCE);
1426    }
1427    /* link in local tree */
1428    if (atp == NULL) {
1429       return NULL;
1430    }
1431 
1432    ptr = GeneSourceNew();
1433    if (ptr == NULL) {
1434       goto erret;
1435    }
1436    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1437       goto erret;
1438    }
1439 
1440    atp = AsnReadId(aip,amp, atp);
1441    func = NULL;
1442 
1443    if (atp == GENE_SOURCE_src) {
1444       if ( AsnReadVal(aip, atp, &av) <= 0) {
1445          goto erret;
1446       }
1447       ptr -> src = av.ptrvalue;
1448       atp = AsnReadId(aip,amp, atp);
1449    }
1450    if (atp == GENE_SOURCE_src_int) {
1451       if ( AsnReadVal(aip, atp, &av) <= 0) {
1452          goto erret;
1453       }
1454       ptr -> src_int = av.intvalue;
1455       atp = AsnReadId(aip,amp, atp);
1456    }
1457    if (atp == GENE_SOURCE_src_str1) {
1458       if ( AsnReadVal(aip, atp, &av) <= 0) {
1459          goto erret;
1460       }
1461       ptr -> src_str1 = av.ptrvalue;
1462       atp = AsnReadId(aip,amp, atp);
1463    }
1464    if (atp == GENE_SOURCE_src_str2) {
1465       if ( AsnReadVal(aip, atp, &av) <= 0) {
1466          goto erret;
1467       }
1468       ptr -> src_str2 = av.ptrvalue;
1469       atp = AsnReadId(aip,amp, atp);
1470    }
1471    if (atp == GENE_SOURCE_gene_display) {
1472       if ( AsnReadVal(aip, atp, &av) <= 0) {
1473          goto erret;
1474       }
1475       ptr -> gene_display = av.boolvalue;
1476       atp = AsnReadId(aip,amp, atp);
1477    }
1478    if (atp == GENE_SOURCE_locus_display) {
1479       if ( AsnReadVal(aip, atp, &av) <= 0) {
1480          goto erret;
1481       }
1482       ptr -> locus_display = av.boolvalue;
1483       atp = AsnReadId(aip,amp, atp);
1484    }
1485    if (atp == GENE_SOURCE_extra_terms) {
1486       if ( AsnReadVal(aip, atp, &av) <= 0) {
1487          goto erret;
1488       }
1489       ptr -> extra_terms = av.boolvalue;
1490       atp = AsnReadId(aip,amp, atp);
1491    }
1492 
1493    if (AsnReadVal(aip, atp, &av) <= 0) {
1494       goto erret;
1495    }
1496    /* end struct */
1497 
1498 ret:
1499    AsnUnlinkType(orig);       /* unlink local tree */
1500    return ptr;
1501 
1502 erret:
1503    aip -> io_failure = TRUE;
1504    ptr = GeneSourceFree(ptr);
1505    goto ret;
1506 }
1507 
1508 
1509 
1510 /**************************************************
1511 *
1512 *    GeneSourceAsnWrite()
1513 *
1514 **************************************************/
1515 NLM_EXTERN Boolean LIBCALL 
1516 GeneSourceAsnWrite(GeneSourcePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1517 {
1518    DataVal av;
1519    AsnTypePtr atp;
1520    Boolean retval = FALSE;
1521 
1522    if (! loaded)
1523    {
1524       if (! objentgeneAsnLoad()) {
1525          return FALSE;
1526       }
1527    }
1528 
1529    if (aip == NULL) {
1530       return FALSE;
1531    }
1532 
1533    atp = AsnLinkType(orig, GENE_SOURCE);   /* link local tree */
1534    if (atp == NULL) {
1535       return FALSE;
1536    }
1537 
1538    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1539    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1540       goto erret;
1541    }
1542 
1543    if (ptr -> src != NULL) {
1544       av.ptrvalue = ptr -> src;
1545       retval = AsnWrite(aip, GENE_SOURCE_src,  &av);
1546    }
1547    av.intvalue = ptr -> src_int;
1548    retval = AsnWrite(aip, GENE_SOURCE_src_int,  &av);
1549    if (ptr -> src_str1 != NULL) {
1550       av.ptrvalue = ptr -> src_str1;
1551       retval = AsnWrite(aip, GENE_SOURCE_src_str1,  &av);
1552    }
1553    if (ptr -> src_str2 != NULL) {
1554       av.ptrvalue = ptr -> src_str2;
1555       retval = AsnWrite(aip, GENE_SOURCE_src_str2,  &av);
1556    }
1557    av.boolvalue = ptr -> gene_display;
1558    retval = AsnWrite(aip, GENE_SOURCE_gene_display,  &av);
1559    av.boolvalue = ptr -> locus_display;
1560    retval = AsnWrite(aip, GENE_SOURCE_locus_display,  &av);
1561    av.boolvalue = ptr -> extra_terms;
1562    retval = AsnWrite(aip, GENE_SOURCE_extra_terms,  &av);
1563    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1564       goto erret;
1565    }
1566    retval = TRUE;
1567 
1568 erret:
1569    AsnUnlinkType(orig);       /* unlink local tree */
1570    return retval;
1571 }
1572 
1573 
1574 
1575 /**************************************************
1576 *
1577 *    XtraTermsNew()
1578 *
1579 **************************************************/
1580 NLM_EXTERN 
1581 XtraTermsPtr LIBCALL
1582 XtraTermsNew(void)
1583 {
1584    XtraTermsPtr ptr = MemNew((size_t) sizeof(XtraTerms));
1585 
1586    return ptr;
1587 
1588 }
1589 
1590 
1591 /**************************************************
1592 *
1593 *    XtraTermsFree()
1594 *
1595 **************************************************/
1596 NLM_EXTERN 
1597 XtraTermsPtr LIBCALL
1598 XtraTermsFree(XtraTermsPtr ptr)
1599 {
1600 
1601    if(ptr == NULL) {
1602       return NULL;
1603    }
1604    MemFree(ptr -> tag);
1605    MemFree(ptr -> value);
1606    return MemFree(ptr);
1607 }
1608 
1609 
1610 /**************************************************
1611 *
1612 *    XtraTermsAsnRead()
1613 *
1614 **************************************************/
1615 NLM_EXTERN 
1616 XtraTermsPtr LIBCALL
1617 XtraTermsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1618 {
1619    DataVal av;
1620    AsnTypePtr atp;
1621    Boolean isError = FALSE;
1622    AsnReadFunc func;
1623    XtraTermsPtr ptr;
1624 
1625    if (! loaded)
1626    {
1627       if (! objentgeneAsnLoad()) {
1628          return NULL;
1629       }
1630    }
1631 
1632    if (aip == NULL) {
1633       return NULL;
1634    }
1635 
1636    if (orig == NULL) {         /* XtraTerms ::= (self contained) */
1637       atp = AsnReadId(aip, amp, XTRA_TERMS);
1638    } else {
1639       atp = AsnLinkType(orig, XTRA_TERMS);
1640    }
1641    /* link in local tree */
1642    if (atp == NULL) {
1643       return NULL;
1644    }
1645 
1646    ptr = XtraTermsNew();
1647    if (ptr == NULL) {
1648       goto erret;
1649    }
1650    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1651       goto erret;
1652    }
1653 
1654    atp = AsnReadId(aip,amp, atp);
1655    func = NULL;
1656 
1657    if (atp == XTRA_TERMS_tag) {
1658       if ( AsnReadVal(aip, atp, &av) <= 0) {
1659          goto erret;
1660       }
1661       ptr -> tag = av.ptrvalue;
1662       atp = AsnReadId(aip,amp, atp);
1663    }
1664    if (atp == XTRA_TERMS_value) {
1665       if ( AsnReadVal(aip, atp, &av) <= 0) {
1666          goto erret;
1667       }
1668       ptr -> value = av.ptrvalue;
1669       atp = AsnReadId(aip,amp, atp);
1670    }
1671 
1672    if (AsnReadVal(aip, atp, &av) <= 0) {
1673       goto erret;
1674    }
1675    /* end struct */
1676 
1677 ret:
1678    AsnUnlinkType(orig);       /* unlink local tree */
1679    return ptr;
1680 
1681 erret:
1682    aip -> io_failure = TRUE;
1683    ptr = XtraTermsFree(ptr);
1684    goto ret;
1685 }
1686 
1687 
1688 
1689 /**************************************************
1690 *
1691 *    XtraTermsAsnWrite()
1692 *
1693 **************************************************/
1694 NLM_EXTERN Boolean LIBCALL 
1695 XtraTermsAsnWrite(XtraTermsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1696 {
1697    DataVal av;
1698    AsnTypePtr atp;
1699    Boolean retval = FALSE;
1700 
1701    if (! loaded)
1702    {
1703       if (! objentgeneAsnLoad()) {
1704          return FALSE;
1705       }
1706    }
1707 
1708    if (aip == NULL) {
1709       return FALSE;
1710    }
1711 
1712    atp = AsnLinkType(orig, XTRA_TERMS);   /* link local tree */
1713    if (atp == NULL) {
1714       return FALSE;
1715    }
1716 
1717    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1718    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1719       goto erret;
1720    }
1721 
1722    if (ptr -> tag != NULL) {
1723       av.ptrvalue = ptr -> tag;
1724       retval = AsnWrite(aip, XTRA_TERMS_tag,  &av);
1725    }
1726    if (ptr -> value != NULL) {
1727       av.ptrvalue = ptr -> value;
1728       retval = AsnWrite(aip, XTRA_TERMS_value,  &av);
1729    }
1730    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1731       goto erret;
1732    }
1733    retval = TRUE;
1734 
1735 erret:
1736    AsnUnlinkType(orig);       /* unlink local tree */
1737    return retval;
1738 }
1739 
1740 
1741 
1742 /**************************************************
1743 *
1744 *    OtherSourceNew()
1745 *
1746 **************************************************/
1747 NLM_EXTERN 
1748 OtherSourcePtr LIBCALL
1749 OtherSourceNew(void)
1750 {
1751    OtherSourcePtr ptr = MemNew((size_t) sizeof(OtherSource));
1752 
1753    return ptr;
1754 
1755 }
1756 
1757 
1758 /**************************************************
1759 *
1760 *    OtherSourceFree()
1761 *
1762 **************************************************/
1763 NLM_EXTERN 
1764 OtherSourcePtr LIBCALL
1765 OtherSourceFree(OtherSourcePtr ptr)
1766 {
1767 
1768    if(ptr == NULL) {
1769       return NULL;
1770    }
1771    DbtagFree(ptr -> src);
1772    MemFree(ptr -> pre_text);
1773    MemFree(ptr -> anchor);
1774    MemFree(ptr -> url);
1775    MemFree(ptr -> post_text);
1776    return MemFree(ptr);
1777 }
1778 
1779 
1780 /**************************************************
1781 *
1782 *    OtherSourceAsnRead()
1783 *
1784 **************************************************/
1785 NLM_EXTERN 
1786 OtherSourcePtr LIBCALL
1787 OtherSourceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1788 {
1789    DataVal av;
1790    AsnTypePtr atp;
1791    Boolean isError = FALSE;
1792    AsnReadFunc func;
1793    OtherSourcePtr ptr;
1794 
1795    if (! loaded)
1796    {
1797       if (! objentgeneAsnLoad()) {
1798          return NULL;
1799       }
1800    }
1801 
1802    if (aip == NULL) {
1803       return NULL;
1804    }
1805 
1806    if (orig == NULL) {         /* OtherSource ::= (self contained) */
1807       atp = AsnReadId(aip, amp, OTHER_SOURCE);
1808    } else {
1809       atp = AsnLinkType(orig, OTHER_SOURCE);
1810    }
1811    /* link in local tree */
1812    if (atp == NULL) {
1813       return NULL;
1814    }
1815 
1816    ptr = OtherSourceNew();
1817    if (ptr == NULL) {
1818       goto erret;
1819    }
1820    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1821       goto erret;
1822    }
1823 
1824    atp = AsnReadId(aip,amp, atp);
1825    func = NULL;
1826 
1827    if (atp == OTHER_SOURCE_src) {
1828       ptr -> src = DbtagAsnRead(aip, atp);
1829       if (aip -> io_failure) {
1830          goto erret;
1831       }
1832       atp = AsnReadId(aip,amp, atp);
1833    }
1834    if (atp == OTHER_SOURCE_pre_text) {
1835       if ( AsnReadVal(aip, atp, &av) <= 0) {
1836          goto erret;
1837       }
1838       ptr -> pre_text = av.ptrvalue;
1839       atp = AsnReadId(aip,amp, atp);
1840    }
1841    if (atp == OTHER_SOURCE_anchor) {
1842       if ( AsnReadVal(aip, atp, &av) <= 0) {
1843          goto erret;
1844       }
1845       ptr -> anchor = av.ptrvalue;
1846       atp = AsnReadId(aip,amp, atp);
1847    }
1848    if (atp == OTHER_SOURCE_url) {
1849       if ( AsnReadVal(aip, atp, &av) <= 0) {
1850          goto erret;
1851       }
1852       ptr -> url = av.ptrvalue;
1853       atp = AsnReadId(aip,amp, atp);
1854    }
1855    if (atp == OTHER_SOURCE_post_text) {
1856       if ( AsnReadVal(aip, atp, &av) <= 0) {
1857          goto erret;
1858       }
1859       ptr -> post_text = av.ptrvalue;
1860       atp = AsnReadId(aip,amp, atp);
1861    }
1862 
1863    if (AsnReadVal(aip, atp, &av) <= 0) {
1864       goto erret;
1865    }
1866    /* end struct */
1867 
1868 ret:
1869    AsnUnlinkType(orig);       /* unlink local tree */
1870    return ptr;
1871 
1872 erret:
1873    aip -> io_failure = TRUE;
1874    ptr = OtherSourceFree(ptr);
1875    goto ret;
1876 }
1877 
1878 
1879 
1880 /**************************************************
1881 *
1882 *    OtherSourceAsnWrite()
1883 *
1884 **************************************************/
1885 NLM_EXTERN Boolean LIBCALL 
1886 OtherSourceAsnWrite(OtherSourcePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1887 {
1888    DataVal av;
1889    AsnTypePtr atp;
1890    Boolean retval = FALSE;
1891 
1892    if (! loaded)
1893    {
1894       if (! objentgeneAsnLoad()) {
1895          return FALSE;
1896       }
1897    }
1898 
1899    if (aip == NULL) {
1900       return FALSE;
1901    }
1902 
1903    atp = AsnLinkType(orig, OTHER_SOURCE);   /* link local tree */
1904    if (atp == NULL) {
1905       return FALSE;
1906    }
1907 
1908    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1909    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1910       goto erret;
1911    }
1912 
1913    if (ptr -> src != NULL) {
1914       if ( ! DbtagAsnWrite(ptr -> src, aip, OTHER_SOURCE_src)) {
1915          goto erret;
1916       }
1917    }
1918    if (ptr -> pre_text != NULL) {
1919       av.ptrvalue = ptr -> pre_text;
1920       retval = AsnWrite(aip, OTHER_SOURCE_pre_text,  &av);
1921    }
1922    if (ptr -> anchor != NULL) {
1923       av.ptrvalue = ptr -> anchor;
1924       retval = AsnWrite(aip, OTHER_SOURCE_anchor,  &av);
1925    }
1926    if (ptr -> url != NULL) {
1927       av.ptrvalue = ptr -> url;
1928       retval = AsnWrite(aip, OTHER_SOURCE_url,  &av);
1929    }
1930    if (ptr -> post_text != NULL) {
1931       av.ptrvalue = ptr -> post_text;
1932       retval = AsnWrite(aip, OTHER_SOURCE_post_text,  &av);
1933    }
1934    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1935       goto erret;
1936    }
1937    retval = TRUE;
1938 
1939 erret:
1940    AsnUnlinkType(orig);       /* unlink local tree */
1941    return retval;
1942 }
1943 
1944 

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.