NCBI C Toolkit Cross Reference

C/object/objgbseq.c


  1 #include <asn.h>
  2 
  3 #define NLM_GENERATED_CODE_PROTO
  4 
  5 #include <objgbseq.h>
  6 
  7 static Boolean loaded = FALSE;
  8 
  9 #include <asngbseq.h>
 10 
 11 #ifndef NLM_EXTERN_LOADS
 12 #define NLM_EXTERN_LOADS {}
 13 #endif
 14 
 15 NLM_EXTERN Boolean LIBCALL
 16 objgbseqAsnLoad(void)
 17 {
 18 
 19    if ( ! loaded) {
 20       NLM_EXTERN_LOADS
 21 
 22       if ( ! AsnLoad ())
 23       return FALSE;
 24       loaded = TRUE;
 25    }
 26 
 27    return TRUE;
 28 }
 29 
 30 
 31 
 32 /**************************************************
 33 *    Generated object loaders for Module NCBI-GBSeq
 34 *    Generated using ASNCODE Revision: 6.16 at Jan 15, 2009  2:16 PM
 35 *
 36 **************************************************/
 37 
 38 
 39 /**************************************************
 40 *
 41 *    GBSetFree()
 42 *
 43 **************************************************/
 44 NLM_EXTERN 
 45 GBSetPtr LIBCALL
 46 GBSetFree(GBSetPtr ptr)
 47 {
 48 
 49    if(ptr == NULL) {
 50       return NULL;
 51    }
 52    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) GBSeqFree);
 53    return NULL;
 54 }
 55 
 56 
 57 /**************************************************
 58 *
 59 *    GBSetAsnRead()
 60 *
 61 **************************************************/
 62 NLM_EXTERN 
 63 GBSetPtr LIBCALL
 64 GBSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 65 {
 66    DataVal av;
 67    AsnTypePtr atp;
 68    Boolean isError = FALSE;
 69    AsnReadFunc func;
 70    GBSetPtr ptr;
 71 
 72    if (! loaded)
 73    {
 74       if (! objgbseqAsnLoad()) {
 75          return NULL;
 76       }
 77    }
 78 
 79    if (aip == NULL) {
 80       return NULL;
 81    }
 82 
 83    if (orig == NULL) {         /* GBSet ::= (self contained) */
 84       atp = AsnReadId(aip, amp, GBSET);
 85    } else {
 86       atp = AsnLinkType(orig, GBSET);
 87    }
 88    /* link in local tree */
 89    if (atp == NULL) {
 90       return NULL;
 91    }
 92 
 93    func = NULL;
 94 
 95    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBSeqAsnRead, (AsnOptFreeFunc) GBSeqFree);
 96    if (isError && ptr  == NULL) {
 97       goto erret;
 98    }
 99 
100 
101 
102 ret:
103    AsnUnlinkType(orig);       /* unlink local tree */
104    return ptr;
105 
106 erret:
107    aip -> io_failure = TRUE;
108    ptr = GBSetFree(ptr);
109    goto ret;
110 }
111 
112 
113 
114 /**************************************************
115 *
116 *    GBSetAsnWrite()
117 *
118 **************************************************/
119 NLM_EXTERN Boolean LIBCALL 
120 GBSetAsnWrite(GBSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
121 {
122    DataVal av;
123    AsnTypePtr atp;
124    Boolean retval = FALSE;
125 
126    if (! loaded)
127    {
128       if (! objgbseqAsnLoad()) {
129          return FALSE;
130       }
131    }
132 
133    if (aip == NULL) {
134       return FALSE;
135    }
136 
137    atp = AsnLinkType(orig, GBSET);   /* link local tree */
138    if (atp == NULL) {
139       return FALSE;
140    }
141 
142    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
143    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) GBSeqAsnWrite, aip, atp, GBSET_E);
144    retval = TRUE;
145 
146 erret:
147    AsnUnlinkType(orig);       /* unlink local tree */
148    return retval;
149 }
150 
151 
152 
153 /**************************************************
154 *
155 *    GBSeqNew()
156 *
157 **************************************************/
158 NLM_EXTERN 
159 GBSeqPtr LIBCALL
160 GBSeqNew(void)
161 {
162    GBSeqPtr ptr = MemNew((size_t) sizeof(GBSeq));
163 
164    return ptr;
165 
166 }
167 
168 
169 /**************************************************
170 *
171 *    GBSeqFree()
172 *
173 **************************************************/
174 NLM_EXTERN 
175 GBSeqPtr LIBCALL
176 GBSeqFree(GBSeqPtr ptr)
177 {
178 
179    if(ptr == NULL) {
180       return NULL;
181    }
182    MemFree(ptr -> locus);
183    MemFree(ptr -> strandedness);
184    MemFree(ptr -> moltype);
185    MemFree(ptr -> topology);
186    MemFree(ptr -> division);
187    MemFree(ptr -> update_date);
188    MemFree(ptr -> create_date);
189    MemFree(ptr -> update_release);
190    MemFree(ptr -> create_release);
191    MemFree(ptr -> definition);
192    MemFree(ptr -> primary_accession);
193    MemFree(ptr -> entry_version);
194    MemFree(ptr -> accession_version);
195    AsnGenericBaseSeqOfFree(ptr -> other_seqids ,ASNCODE_PTRVAL_SLOT);
196    AsnGenericBaseSeqOfFree(ptr -> secondary_accessions ,ASNCODE_PTRVAL_SLOT);
197    MemFree(ptr -> project);
198    AsnGenericBaseSeqOfFree(ptr -> keywords ,ASNCODE_PTRVAL_SLOT);
199    MemFree(ptr -> segment);
200    MemFree(ptr -> source);
201    MemFree(ptr -> organism);
202    MemFree(ptr -> taxonomy);
203    AsnGenericUserSeqOfFree(ptr -> references, (AsnOptFreeFunc) GBReferenceFree);
204    MemFree(ptr -> comment);
205    GBTagsetFree(ptr -> tagset);
206    MemFree(ptr -> primary);
207    MemFree(ptr -> source_db);
208    MemFree(ptr -> database_reference);
209    AsnGenericUserSeqOfFree(ptr -> feature_table, (AsnOptFreeFunc) GBFeatureFree);
210    MemFree(ptr -> sequence);
211    MemFree(ptr -> contig);
212    return MemFree(ptr);
213 }
214 
215 
216 /**************************************************
217 *
218 *    GBSeqAsnRead()
219 *
220 **************************************************/
221 NLM_EXTERN 
222 GBSeqPtr LIBCALL
223 GBSeqAsnRead(AsnIoPtr aip, AsnTypePtr orig)
224 {
225    DataVal av;
226    AsnTypePtr atp;
227    Boolean isError = FALSE;
228    AsnReadFunc func;
229    GBSeqPtr ptr;
230 
231    if (! loaded)
232    {
233       if (! objgbseqAsnLoad()) {
234          return NULL;
235       }
236    }
237 
238    if (aip == NULL) {
239       return NULL;
240    }
241 
242    if (orig == NULL) {         /* GBSeq ::= (self contained) */
243       atp = AsnReadId(aip, amp, GBSEQ);
244    } else {
245       atp = AsnLinkType(orig, GBSEQ);
246    }
247    /* link in local tree */
248    if (atp == NULL) {
249       return NULL;
250    }
251 
252    ptr = GBSeqNew();
253    if (ptr == NULL) {
254       goto erret;
255    }
256    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
257       goto erret;
258    }
259 
260    atp = AsnReadId(aip,amp, atp);
261    func = NULL;
262 
263    if (atp == GBSEQ_locus) {
264       if ( AsnReadVal(aip, atp, &av) <= 0) {
265          goto erret;
266       }
267       ptr -> locus = av.ptrvalue;
268       atp = AsnReadId(aip,amp, atp);
269    }
270    if (atp == GBSEQ_length) {
271       if ( AsnReadVal(aip, atp, &av) <= 0) {
272          goto erret;
273       }
274       ptr -> length = av.intvalue;
275       atp = AsnReadId(aip,amp, atp);
276    }
277    if (atp == GBSEQ_strandedness) {
278       if ( AsnReadVal(aip, atp, &av) <= 0) {
279          goto erret;
280       }
281       ptr -> strandedness = av.ptrvalue;
282       atp = AsnReadId(aip,amp, atp);
283    }
284    if (atp == GBSEQ_moltype) {
285       if ( AsnReadVal(aip, atp, &av) <= 0) {
286          goto erret;
287       }
288       ptr -> moltype = av.ptrvalue;
289       atp = AsnReadId(aip,amp, atp);
290    }
291    if (atp == GBSEQ_topology) {
292       if ( AsnReadVal(aip, atp, &av) <= 0) {
293          goto erret;
294       }
295       ptr -> topology = av.ptrvalue;
296       atp = AsnReadId(aip,amp, atp);
297    }
298    if (atp == GBSEQ_division) {
299       if ( AsnReadVal(aip, atp, &av) <= 0) {
300          goto erret;
301       }
302       ptr -> division = av.ptrvalue;
303       atp = AsnReadId(aip,amp, atp);
304    }
305    if (atp == GBSEQ_update_date) {
306       if ( AsnReadVal(aip, atp, &av) <= 0) {
307          goto erret;
308       }
309       ptr -> update_date = av.ptrvalue;
310       atp = AsnReadId(aip,amp, atp);
311    }
312    if (atp == GBSEQ_create_date) {
313       if ( AsnReadVal(aip, atp, &av) <= 0) {
314          goto erret;
315       }
316       ptr -> create_date = av.ptrvalue;
317       atp = AsnReadId(aip,amp, atp);
318    }
319    if (atp == GBSEQ_update_release) {
320       if ( AsnReadVal(aip, atp, &av) <= 0) {
321          goto erret;
322       }
323       ptr -> update_release = av.ptrvalue;
324       atp = AsnReadId(aip,amp, atp);
325    }
326    if (atp == GBSEQ_create_release) {
327       if ( AsnReadVal(aip, atp, &av) <= 0) {
328          goto erret;
329       }
330       ptr -> create_release = av.ptrvalue;
331       atp = AsnReadId(aip,amp, atp);
332    }
333    if (atp == GBSEQ_definition) {
334       if ( AsnReadVal(aip, atp, &av) <= 0) {
335          goto erret;
336       }
337       ptr -> definition = av.ptrvalue;
338       atp = AsnReadId(aip,amp, atp);
339    }
340    if (atp == GBSEQ_primary_accession) {
341       if ( AsnReadVal(aip, atp, &av) <= 0) {
342          goto erret;
343       }
344       ptr -> primary_accession = av.ptrvalue;
345       atp = AsnReadId(aip,amp, atp);
346    }
347    if (atp == GBSEQ_entry_version) {
348       if ( AsnReadVal(aip, atp, &av) <= 0) {
349          goto erret;
350       }
351       ptr -> entry_version = av.ptrvalue;
352       atp = AsnReadId(aip,amp, atp);
353    }
354    if (atp == GBSEQ_accession_version) {
355       if ( AsnReadVal(aip, atp, &av) <= 0) {
356          goto erret;
357       }
358       ptr -> accession_version = av.ptrvalue;
359       atp = AsnReadId(aip,amp, atp);
360    }
361    if (atp == GBSEQ_other_seqids) {
362       ptr -> other_seqids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
363       if (isError && ptr -> other_seqids == NULL) {
364          goto erret;
365       }
366       atp = AsnReadId(aip,amp, atp);
367    }
368    if (atp == GBSEQ_secondary_accessions) {
369       ptr -> secondary_accessions = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
370       if (isError && ptr -> secondary_accessions == NULL) {
371          goto erret;
372       }
373       atp = AsnReadId(aip,amp, atp);
374    }
375    if (atp == GBSEQ_project) {
376       if ( AsnReadVal(aip, atp, &av) <= 0) {
377          goto erret;
378       }
379       ptr -> project = av.ptrvalue;
380       atp = AsnReadId(aip,amp, atp);
381    }
382    if (atp == GBSEQ_keywords) {
383       ptr -> keywords = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
384       if (isError && ptr -> keywords == NULL) {
385          goto erret;
386       }
387       atp = AsnReadId(aip,amp, atp);
388    }
389    if (atp == GBSEQ_segment) {
390       if ( AsnReadVal(aip, atp, &av) <= 0) {
391          goto erret;
392       }
393       ptr -> segment = av.ptrvalue;
394       atp = AsnReadId(aip,amp, atp);
395    }
396    if (atp == GBSEQ_source) {
397       if ( AsnReadVal(aip, atp, &av) <= 0) {
398          goto erret;
399       }
400       ptr -> source = av.ptrvalue;
401       atp = AsnReadId(aip,amp, atp);
402    }
403    if (atp == GBSEQ_organism) {
404       if ( AsnReadVal(aip, atp, &av) <= 0) {
405          goto erret;
406       }
407       ptr -> organism = av.ptrvalue;
408       atp = AsnReadId(aip,amp, atp);
409    }
410    if (atp == GBSEQ_taxonomy) {
411       if ( AsnReadVal(aip, atp, &av) <= 0) {
412          goto erret;
413       }
414       ptr -> taxonomy = av.ptrvalue;
415       atp = AsnReadId(aip,amp, atp);
416    }
417    if (atp == GBSEQ_references) {
418       ptr -> references = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBReferenceAsnRead, (AsnOptFreeFunc) GBReferenceFree);
419       if (isError && ptr -> references == NULL) {
420          goto erret;
421       }
422       atp = AsnReadId(aip,amp, atp);
423    }
424    if (atp == GBSEQ_comment) {
425       if ( AsnReadVal(aip, atp, &av) <= 0) {
426          goto erret;
427       }
428       ptr -> comment = av.ptrvalue;
429       atp = AsnReadId(aip,amp, atp);
430    }
431    if (atp == GBSEQ_tagset) {
432       ptr -> tagset = GBTagsetAsnRead(aip, atp);
433       if (aip -> io_failure) {
434          goto erret;
435       }
436       atp = AsnReadId(aip,amp, atp);
437    }
438    if (atp == GBSEQ_primary) {
439       if ( AsnReadVal(aip, atp, &av) <= 0) {
440          goto erret;
441       }
442       ptr -> primary = av.ptrvalue;
443       atp = AsnReadId(aip,amp, atp);
444    }
445    if (atp == GBSEQ_source_db) {
446       if ( AsnReadVal(aip, atp, &av) <= 0) {
447          goto erret;
448       }
449       ptr -> source_db = av.ptrvalue;
450       atp = AsnReadId(aip,amp, atp);
451    }
452    if (atp == GBSEQ_database_reference) {
453       if ( AsnReadVal(aip, atp, &av) <= 0) {
454          goto erret;
455       }
456       ptr -> database_reference = av.ptrvalue;
457       atp = AsnReadId(aip,amp, atp);
458    }
459    if (atp == GBSEQ_feature_table) {
460       ptr -> feature_table = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBFeatureAsnRead, (AsnOptFreeFunc) GBFeatureFree);
461       if (isError && ptr -> feature_table == NULL) {
462          goto erret;
463       }
464       atp = AsnReadId(aip,amp, atp);
465    }
466    if (atp == GBSEQ_sequence) {
467       if ( AsnReadVal(aip, atp, &av) <= 0) {
468          goto erret;
469       }
470       ptr -> sequence = av.ptrvalue;
471       atp = AsnReadId(aip,amp, atp);
472    }
473    if (atp == GBSEQ_contig) {
474       if ( AsnReadVal(aip, atp, &av) <= 0) {
475          goto erret;
476       }
477       ptr -> contig = av.ptrvalue;
478       atp = AsnReadId(aip,amp, atp);
479    }
480 
481    if (AsnReadVal(aip, atp, &av) <= 0) {
482       goto erret;
483    }
484    /* end struct */
485 
486 ret:
487    AsnUnlinkType(orig);       /* unlink local tree */
488    return ptr;
489 
490 erret:
491    aip -> io_failure = TRUE;
492    ptr = GBSeqFree(ptr);
493    goto ret;
494 }
495 
496 
497 
498 /**************************************************
499 *
500 *    GBSeqAsnWrite()
501 *
502 **************************************************/
503 NLM_EXTERN Boolean LIBCALL 
504 GBSeqAsnWrite(GBSeqPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
505 {
506    DataVal av;
507    AsnTypePtr atp;
508    Boolean retval = FALSE;
509 
510    if (! loaded)
511    {
512       if (! objgbseqAsnLoad()) {
513          return FALSE;
514       }
515    }
516 
517    if (aip == NULL) {
518       return FALSE;
519    }
520 
521    atp = AsnLinkType(orig, GBSEQ);   /* link local tree */
522    if (atp == NULL) {
523       return FALSE;
524    }
525 
526    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
527    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
528       goto erret;
529    }
530 
531    if (ptr -> locus != NULL) {
532       av.ptrvalue = ptr -> locus;
533       retval = AsnWrite(aip, GBSEQ_locus,  &av);
534    }
535    av.intvalue = ptr -> length;
536    retval = AsnWrite(aip, GBSEQ_length,  &av);
537    if (ptr -> strandedness != NULL) {
538       av.ptrvalue = ptr -> strandedness;
539       retval = AsnWrite(aip, GBSEQ_strandedness,  &av);
540    }
541    if (ptr -> moltype != NULL) {
542       av.ptrvalue = ptr -> moltype;
543       retval = AsnWrite(aip, GBSEQ_moltype,  &av);
544    }
545    if (ptr -> topology != NULL) {
546       av.ptrvalue = ptr -> topology;
547       retval = AsnWrite(aip, GBSEQ_topology,  &av);
548    }
549    if (ptr -> division != NULL) {
550       av.ptrvalue = ptr -> division;
551       retval = AsnWrite(aip, GBSEQ_division,  &av);
552    }
553    if (ptr -> update_date != NULL) {
554       av.ptrvalue = ptr -> update_date;
555       retval = AsnWrite(aip, GBSEQ_update_date,  &av);
556    }
557    if (ptr -> create_date != NULL) {
558       av.ptrvalue = ptr -> create_date;
559       retval = AsnWrite(aip, GBSEQ_create_date,  &av);
560    }
561    if (ptr -> update_release != NULL) {
562       av.ptrvalue = ptr -> update_release;
563       retval = AsnWrite(aip, GBSEQ_update_release,  &av);
564    }
565    if (ptr -> create_release != NULL) {
566       av.ptrvalue = ptr -> create_release;
567       retval = AsnWrite(aip, GBSEQ_create_release,  &av);
568    }
569    if (ptr -> definition != NULL) {
570       av.ptrvalue = ptr -> definition;
571       retval = AsnWrite(aip, GBSEQ_definition,  &av);
572    }
573    if (ptr -> primary_accession != NULL) {
574       av.ptrvalue = ptr -> primary_accession;
575       retval = AsnWrite(aip, GBSEQ_primary_accession,  &av);
576    }
577    if (ptr -> entry_version != NULL) {
578       av.ptrvalue = ptr -> entry_version;
579       retval = AsnWrite(aip, GBSEQ_entry_version,  &av);
580    }
581    if (ptr -> accession_version != NULL) {
582       av.ptrvalue = ptr -> accession_version;
583       retval = AsnWrite(aip, GBSEQ_accession_version,  &av);
584    }
585    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> other_seqids ,ASNCODE_PTRVAL_SLOT, aip, GBSEQ_other_seqids, GBSEQ_other_seqids_E);
586    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> secondary_accessions ,ASNCODE_PTRVAL_SLOT, aip, GBSEQ_secondary_accessions, GBSEQ_secondary_accessions_E);
587    if (ptr -> project != NULL) {
588       av.ptrvalue = ptr -> project;
589       retval = AsnWrite(aip, GBSEQ_project,  &av);
590    }
591    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> keywords ,ASNCODE_PTRVAL_SLOT, aip, GBSEQ_keywords, GBSEQ_keywords_E);
592    if (ptr -> segment != NULL) {
593       av.ptrvalue = ptr -> segment;
594       retval = AsnWrite(aip, GBSEQ_segment,  &av);
595    }
596    if (ptr -> source != NULL) {
597       av.ptrvalue = ptr -> source;
598       retval = AsnWrite(aip, GBSEQ_source,  &av);
599    }
600    if (ptr -> organism != NULL) {
601       av.ptrvalue = ptr -> organism;
602       retval = AsnWrite(aip, GBSEQ_organism,  &av);
603    }
604    if (ptr -> taxonomy != NULL) {
605       av.ptrvalue = ptr -> taxonomy;
606       retval = AsnWrite(aip, GBSEQ_taxonomy,  &av);
607    }
608    AsnGenericUserSeqOfAsnWrite(ptr -> references, (AsnWriteFunc) GBReferenceAsnWrite, aip, GBSEQ_references, GBSEQ_references_E);
609    if (ptr -> comment != NULL) {
610       av.ptrvalue = ptr -> comment;
611       retval = AsnWrite(aip, GBSEQ_comment,  &av);
612    }
613    if (ptr -> tagset != NULL) {
614       if ( ! GBTagsetAsnWrite(ptr -> tagset, aip, GBSEQ_tagset)) {
615          goto erret;
616       }
617    }
618    if (ptr -> primary != NULL) {
619       av.ptrvalue = ptr -> primary;
620       retval = AsnWrite(aip, GBSEQ_primary,  &av);
621    }
622    if (ptr -> source_db != NULL) {
623       av.ptrvalue = ptr -> source_db;
624       retval = AsnWrite(aip, GBSEQ_source_db,  &av);
625    }
626    if (ptr -> database_reference != NULL) {
627       av.ptrvalue = ptr -> database_reference;
628       retval = AsnWrite(aip, GBSEQ_database_reference,  &av);
629    }
630    AsnGenericUserSeqOfAsnWrite(ptr -> feature_table, (AsnWriteFunc) GBFeatureAsnWrite, aip, GBSEQ_feature_table, GBSEQ_feature_table_E);
631    if (ptr -> sequence != NULL) {
632       av.ptrvalue = ptr -> sequence;
633       retval = AsnWrite(aip, GBSEQ_sequence,  &av);
634    }
635    if (ptr -> contig != NULL) {
636       av.ptrvalue = ptr -> contig;
637       retval = AsnWrite(aip, GBSEQ_contig,  &av);
638    }
639    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
640       goto erret;
641    }
642    retval = TRUE;
643 
644 erret:
645    AsnUnlinkType(orig);       /* unlink local tree */
646    return retval;
647 }
648 
649 
650 
651 /**************************************************
652 *
653 *    GBReferenceNew()
654 *
655 **************************************************/
656 NLM_EXTERN 
657 GBReferencePtr LIBCALL
658 GBReferenceNew(void)
659 {
660    GBReferencePtr ptr = MemNew((size_t) sizeof(GBReference));
661 
662    return ptr;
663 
664 }
665 
666 
667 /**************************************************
668 *
669 *    GBReferenceFree()
670 *
671 **************************************************/
672 NLM_EXTERN 
673 GBReferencePtr LIBCALL
674 GBReferenceFree(GBReferencePtr ptr)
675 {
676 
677    if(ptr == NULL) {
678       return NULL;
679    }
680    MemFree(ptr -> reference);
681    MemFree(ptr -> position);
682    AsnGenericBaseSeqOfFree(ptr -> authors ,ASNCODE_PTRVAL_SLOT);
683    MemFree(ptr -> consortium);
684    MemFree(ptr -> title);
685    MemFree(ptr -> journal);
686    AsnGenericUserSeqOfFree(ptr -> xref, (AsnOptFreeFunc) GBXrefFree);
687    MemFree(ptr -> remark);
688    return MemFree(ptr);
689 }
690 
691 
692 /**************************************************
693 *
694 *    GBReferenceAsnRead()
695 *
696 **************************************************/
697 NLM_EXTERN 
698 GBReferencePtr LIBCALL
699 GBReferenceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
700 {
701    DataVal av;
702    AsnTypePtr atp;
703    Boolean isError = FALSE;
704    AsnReadFunc func;
705    GBReferencePtr ptr;
706 
707    if (! loaded)
708    {
709       if (! objgbseqAsnLoad()) {
710          return NULL;
711       }
712    }
713 
714    if (aip == NULL) {
715       return NULL;
716    }
717 
718    if (orig == NULL) {         /* GBReference ::= (self contained) */
719       atp = AsnReadId(aip, amp, GBREFERENCE);
720    } else {
721       atp = AsnLinkType(orig, GBREFERENCE);
722    }
723    /* link in local tree */
724    if (atp == NULL) {
725       return NULL;
726    }
727 
728    ptr = GBReferenceNew();
729    if (ptr == NULL) {
730       goto erret;
731    }
732    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
733       goto erret;
734    }
735 
736    atp = AsnReadId(aip,amp, atp);
737    func = NULL;
738 
739    if (atp == GBREFERENCE_reference) {
740       if ( AsnReadVal(aip, atp, &av) <= 0) {
741          goto erret;
742       }
743       ptr -> reference = av.ptrvalue;
744       atp = AsnReadId(aip,amp, atp);
745    }
746    if (atp == GBREFERENCE_position) {
747       if ( AsnReadVal(aip, atp, &av) <= 0) {
748          goto erret;
749       }
750       ptr -> position = av.ptrvalue;
751       atp = AsnReadId(aip,amp, atp);
752    }
753    if (atp == GBREFERENCE_authors) {
754       ptr -> authors = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
755       if (isError && ptr -> authors == NULL) {
756          goto erret;
757       }
758       atp = AsnReadId(aip,amp, atp);
759    }
760    if (atp == GBREFERENCE_consortium) {
761       if ( AsnReadVal(aip, atp, &av) <= 0) {
762          goto erret;
763       }
764       ptr -> consortium = av.ptrvalue;
765       atp = AsnReadId(aip,amp, atp);
766    }
767    if (atp == GBREFERENCE_title) {
768       if ( AsnReadVal(aip, atp, &av) <= 0) {
769          goto erret;
770       }
771       ptr -> title = av.ptrvalue;
772       atp = AsnReadId(aip,amp, atp);
773    }
774    if (atp == GBREFERENCE_journal) {
775       if ( AsnReadVal(aip, atp, &av) <= 0) {
776          goto erret;
777       }
778       ptr -> journal = av.ptrvalue;
779       atp = AsnReadId(aip,amp, atp);
780    }
781    if (atp == GBREFERENCE_xref) {
782       ptr -> xref = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBXrefAsnRead, (AsnOptFreeFunc) GBXrefFree);
783       if (isError && ptr -> xref == NULL) {
784          goto erret;
785       }
786       atp = AsnReadId(aip,amp, atp);
787    }
788    if (atp == GBREFERENCE_pubmed) {
789       if ( AsnReadVal(aip, atp, &av) <= 0) {
790          goto erret;
791       }
792       ptr -> pubmed = av.intvalue;
793       ptr -> OBbits__ |= 1<<0;
794       atp = AsnReadId(aip,amp, atp);
795    }
796    if (atp == GBREFERENCE_remark) {
797       if ( AsnReadVal(aip, atp, &av) <= 0) {
798          goto erret;
799       }
800       ptr -> remark = av.ptrvalue;
801       atp = AsnReadId(aip,amp, atp);
802    }
803 
804    if (AsnReadVal(aip, atp, &av) <= 0) {
805       goto erret;
806    }
807    /* end struct */
808 
809 ret:
810    AsnUnlinkType(orig);       /* unlink local tree */
811    return ptr;
812 
813 erret:
814    aip -> io_failure = TRUE;
815    ptr = GBReferenceFree(ptr);
816    goto ret;
817 }
818 
819 
820 
821 /**************************************************
822 *
823 *    GBReferenceAsnWrite()
824 *
825 **************************************************/
826 NLM_EXTERN Boolean LIBCALL 
827 GBReferenceAsnWrite(GBReferencePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
828 {
829    DataVal av;
830    AsnTypePtr atp;
831    Boolean retval = FALSE;
832 
833    if (! loaded)
834    {
835       if (! objgbseqAsnLoad()) {
836          return FALSE;
837       }
838    }
839 
840    if (aip == NULL) {
841       return FALSE;
842    }
843 
844    atp = AsnLinkType(orig, GBREFERENCE);   /* link local tree */
845    if (atp == NULL) {
846       return FALSE;
847    }
848 
849    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
850    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
851       goto erret;
852    }
853 
854    if (ptr -> reference != NULL) {
855       av.ptrvalue = ptr -> reference;
856       retval = AsnWrite(aip, GBREFERENCE_reference,  &av);
857    }
858    if (ptr -> position != NULL) {
859       av.ptrvalue = ptr -> position;
860       retval = AsnWrite(aip, GBREFERENCE_position,  &av);
861    }
862    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> authors ,ASNCODE_PTRVAL_SLOT, aip, GBREFERENCE_authors, GBREFERENCE_authors_E);
863    if (ptr -> consortium != NULL) {
864       av.ptrvalue = ptr -> consortium;
865       retval = AsnWrite(aip, GBREFERENCE_consortium,  &av);
866    }
867    if (ptr -> title != NULL) {
868       av.ptrvalue = ptr -> title;
869       retval = AsnWrite(aip, GBREFERENCE_title,  &av);
870    }
871    if (ptr -> journal != NULL) {
872       av.ptrvalue = ptr -> journal;
873       retval = AsnWrite(aip, GBREFERENCE_journal,  &av);
874    }
875    AsnGenericUserSeqOfAsnWrite(ptr -> xref, (AsnWriteFunc) GBXrefAsnWrite, aip, GBREFERENCE_xref, GBREFERENCE_xref_E);
876    if (ptr -> pubmed || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> pubmed;
877       retval = AsnWrite(aip, GBREFERENCE_pubmed,  &av);
878    }
879    if (ptr -> remark != NULL) {
880       av.ptrvalue = ptr -> remark;
881       retval = AsnWrite(aip, GBREFERENCE_remark,  &av);
882    }
883    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
884       goto erret;
885    }
886    retval = TRUE;
887 
888 erret:
889    AsnUnlinkType(orig);       /* unlink local tree */
890    return retval;
891 }
892 
893 
894 
895 /**************************************************
896 *
897 *    GBTagsetNew()
898 *
899 **************************************************/
900 NLM_EXTERN 
901 GBTagsetPtr LIBCALL
902 GBTagsetNew(void)
903 {
904    GBTagsetPtr ptr = MemNew((size_t) sizeof(GBTagset));
905 
906    return ptr;
907 
908 }
909 
910 
911 /**************************************************
912 *
913 *    GBTagsetFree()
914 *
915 **************************************************/
916 NLM_EXTERN 
917 GBTagsetPtr LIBCALL
918 GBTagsetFree(GBTagsetPtr ptr)
919 {
920 
921    if(ptr == NULL) {
922       return NULL;
923    }
924    MemFree(ptr -> authority);
925    MemFree(ptr -> version);
926    MemFree(ptr -> url);
927    GBTagsFree(ptr -> tags);
928    return MemFree(ptr);
929 }
930 
931 
932 /**************************************************
933 *
934 *    GBTagsetAsnRead()
935 *
936 **************************************************/
937 NLM_EXTERN 
938 GBTagsetPtr LIBCALL
939 GBTagsetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
940 {
941    DataVal av;
942    AsnTypePtr atp;
943    Boolean isError = FALSE;
944    AsnReadFunc func;
945    GBTagsetPtr ptr;
946 
947    if (! loaded)
948    {
949       if (! objgbseqAsnLoad()) {
950          return NULL;
951       }
952    }
953 
954    if (aip == NULL) {
955       return NULL;
956    }
957 
958    if (orig == NULL) {         /* GBTagset ::= (self contained) */
959       atp = AsnReadId(aip, amp, GBTAGSET);
960    } else {
961       atp = AsnLinkType(orig, GBTAGSET);
962    }
963    /* link in local tree */
964    if (atp == NULL) {
965       return NULL;
966    }
967 
968    ptr = GBTagsetNew();
969    if (ptr == NULL) {
970       goto erret;
971    }
972    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
973       goto erret;
974    }
975 
976    atp = AsnReadId(aip,amp, atp);
977    func = NULL;
978 
979    if (atp == GBTAGSET_authority) {
980       if ( AsnReadVal(aip, atp, &av) <= 0) {
981          goto erret;
982       }
983       ptr -> authority = av.ptrvalue;
984       atp = AsnReadId(aip,amp, atp);
985    }
986    if (atp == GBTAGSET_version) {
987       if ( AsnReadVal(aip, atp, &av) <= 0) {
988          goto erret;
989       }
990       ptr -> version = av.ptrvalue;
991       atp = AsnReadId(aip,amp, atp);
992    }
993    if (atp == GBTAGSET_url) {
994       if ( AsnReadVal(aip, atp, &av) <= 0) {
995          goto erret;
996       }
997       ptr -> url = av.ptrvalue;
998       atp = AsnReadId(aip,amp, atp);
999    }
1000    if (atp == GBTAGSET_tags) {
1001       ptr -> tags = GBTagsAsnRead(aip, atp);
1002       if (aip -> io_failure) {
1003          goto erret;
1004       }
1005       atp = AsnReadId(aip,amp, atp);
1006    }
1007 
1008    if (AsnReadVal(aip, atp, &av) <= 0) {
1009       goto erret;
1010    }
1011    /* end struct */
1012 
1013 ret:
1014    AsnUnlinkType(orig);       /* unlink local tree */
1015    return ptr;
1016 
1017 erret:
1018    aip -> io_failure = TRUE;
1019    ptr = GBTagsetFree(ptr);
1020    goto ret;
1021 }
1022 
1023 
1024 
1025 /**************************************************
1026 *
1027 *    GBTagsetAsnWrite()
1028 *
1029 **************************************************/
1030 NLM_EXTERN Boolean LIBCALL 
1031 GBTagsetAsnWrite(GBTagsetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1032 {
1033    DataVal av;
1034    AsnTypePtr atp;
1035    Boolean retval = FALSE;
1036 
1037    if (! loaded)
1038    {
1039       if (! objgbseqAsnLoad()) {
1040          return FALSE;
1041       }
1042    }
1043 
1044    if (aip == NULL) {
1045       return FALSE;
1046    }
1047 
1048    atp = AsnLinkType(orig, GBTAGSET);   /* link local tree */
1049    if (atp == NULL) {
1050       return FALSE;
1051    }
1052 
1053    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1054    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1055       goto erret;
1056    }
1057 
1058    if (ptr -> authority != NULL) {
1059       av.ptrvalue = ptr -> authority;
1060       retval = AsnWrite(aip, GBTAGSET_authority,  &av);
1061    }
1062    if (ptr -> version != NULL) {
1063       av.ptrvalue = ptr -> version;
1064       retval = AsnWrite(aip, GBTAGSET_version,  &av);
1065    }
1066    if (ptr -> url != NULL) {
1067       av.ptrvalue = ptr -> url;
1068       retval = AsnWrite(aip, GBTAGSET_url,  &av);
1069    }
1070    if (ptr -> tags != NULL) {
1071       if ( ! GBTagsAsnWrite(ptr -> tags, aip, GBTAGSET_tags)) {
1072          goto erret;
1073       }
1074    }
1075    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1076       goto erret;
1077    }
1078    retval = TRUE;
1079 
1080 erret:
1081    AsnUnlinkType(orig);       /* unlink local tree */
1082    return retval;
1083 }
1084 
1085 
1086 
1087 /**************************************************
1088 *
1089 *    GBFeatureNew()
1090 *
1091 **************************************************/
1092 NLM_EXTERN 
1093 GBFeaturePtr LIBCALL
1094 GBFeatureNew(void)
1095 {
1096    GBFeaturePtr ptr = MemNew((size_t) sizeof(GBFeature));
1097 
1098    return ptr;
1099 
1100 }
1101 
1102 
1103 /**************************************************
1104 *
1105 *    GBFeatureFree()
1106 *
1107 **************************************************/
1108 NLM_EXTERN 
1109 GBFeaturePtr LIBCALL
1110 GBFeatureFree(GBFeaturePtr ptr)
1111 {
1112 
1113    if(ptr == NULL) {
1114       return NULL;
1115    }
1116    MemFree(ptr -> key);
1117    MemFree(ptr -> location);
1118    AsnGenericUserSeqOfFree(ptr -> intervals, (AsnOptFreeFunc) GBIntervalFree);
1119    MemFree(ptr -> operator__);
1120    AsnGenericUserSeqOfFree(ptr -> quals, (AsnOptFreeFunc) GBQualifierFree);
1121    return MemFree(ptr);
1122 }
1123 
1124 
1125 /**************************************************
1126 *
1127 *    GBFeatureAsnRead()
1128 *
1129 **************************************************/
1130 NLM_EXTERN 
1131 GBFeaturePtr LIBCALL
1132 GBFeatureAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1133 {
1134    DataVal av;
1135    AsnTypePtr atp;
1136    Boolean isError = FALSE;
1137    AsnReadFunc func;
1138    GBFeaturePtr ptr;
1139 
1140    if (! loaded)
1141    {
1142       if (! objgbseqAsnLoad()) {
1143          return NULL;
1144       }
1145    }
1146 
1147    if (aip == NULL) {
1148       return NULL;
1149    }
1150 
1151    if (orig == NULL) {         /* GBFeature ::= (self contained) */
1152       atp = AsnReadId(aip, amp, GBFEATURE);
1153    } else {
1154       atp = AsnLinkType(orig, GBFEATURE);
1155    }
1156    /* link in local tree */
1157    if (atp == NULL) {
1158       return NULL;
1159    }
1160 
1161    ptr = GBFeatureNew();
1162    if (ptr == NULL) {
1163       goto erret;
1164    }
1165    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1166       goto erret;
1167    }
1168 
1169    atp = AsnReadId(aip,amp, atp);
1170    func = NULL;
1171 
1172    if (atp == GBFEATURE_key) {
1173       if ( AsnReadVal(aip, atp, &av) <= 0) {
1174          goto erret;
1175       }
1176       ptr -> key = av.ptrvalue;
1177       atp = AsnReadId(aip,amp, atp);
1178    }
1179    if (atp == GBFEATURE_location) {
1180       if ( AsnReadVal(aip, atp, &av) <= 0) {
1181          goto erret;
1182       }
1183       ptr -> location = av.ptrvalue;
1184       atp = AsnReadId(aip,amp, atp);
1185    }
1186    if (atp == GBFEATURE_intervals) {
1187       ptr -> intervals = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBIntervalAsnRead, (AsnOptFreeFunc) GBIntervalFree);
1188       if (isError && ptr -> intervals == NULL) {
1189          goto erret;
1190       }
1191       atp = AsnReadId(aip,amp, atp);
1192    }
1193    if (atp == GBFEATURE_operator) {
1194       if ( AsnReadVal(aip, atp, &av) <= 0) {
1195          goto erret;
1196       }
1197       ptr -> operator__ = av.ptrvalue;
1198       atp = AsnReadId(aip,amp, atp);
1199    }
1200    if (atp == GBFEATURE_partial5) {
1201       if ( AsnReadVal(aip, atp, &av) <= 0) {
1202          goto erret;
1203       }
1204       ptr -> partial5 = av.boolvalue;
1205       ptr -> OBbits__ |= 1<<0;
1206       atp = AsnReadId(aip,amp, atp);
1207    }
1208    if (atp == GBFEATURE_partial3) {
1209       if ( AsnReadVal(aip, atp, &av) <= 0) {
1210          goto erret;
1211       }
1212       ptr -> partial3 = av.boolvalue;
1213       ptr -> OBbits__ |= 1<<1;
1214       atp = AsnReadId(aip,amp, atp);
1215    }
1216    if (atp == GBFEATURE_quals) {
1217       ptr -> quals = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBQualifierAsnRead, (AsnOptFreeFunc) GBQualifierFree);
1218       if (isError && ptr -> quals == NULL) {
1219          goto erret;
1220       }
1221       atp = AsnReadId(aip,amp, atp);
1222    }
1223 
1224    if (AsnReadVal(aip, atp, &av) <= 0) {
1225       goto erret;
1226    }
1227    /* end struct */
1228 
1229 ret:
1230    AsnUnlinkType(orig);       /* unlink local tree */
1231    return ptr;
1232 
1233 erret:
1234    aip -> io_failure = TRUE;
1235    ptr = GBFeatureFree(ptr);
1236    goto ret;
1237 }
1238 
1239 
1240 
1241 /**************************************************
1242 *
1243 *    GBFeatureAsnWrite()
1244 *
1245 **************************************************/
1246 NLM_EXTERN Boolean LIBCALL 
1247 GBFeatureAsnWrite(GBFeaturePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1248 {
1249    DataVal av;
1250    AsnTypePtr atp;
1251    Boolean retval = FALSE;
1252 
1253    if (! loaded)
1254    {
1255       if (! objgbseqAsnLoad()) {
1256          return FALSE;
1257       }
1258    }
1259 
1260    if (aip == NULL) {
1261       return FALSE;
1262    }
1263 
1264    atp = AsnLinkType(orig, GBFEATURE);   /* 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 -> key != NULL) {
1275       av.ptrvalue = ptr -> key;
1276       retval = AsnWrite(aip, GBFEATURE_key,  &av);
1277    }
1278    if (ptr -> location != NULL) {
1279       av.ptrvalue = ptr -> location;
1280       retval = AsnWrite(aip, GBFEATURE_location,  &av);
1281    }
1282    AsnGenericUserSeqOfAsnWrite(ptr -> intervals, (AsnWriteFunc) GBIntervalAsnWrite, aip, GBFEATURE_intervals, GBFEATURE_intervals_E);
1283    if (ptr -> operator__ != NULL) {
1284       av.ptrvalue = ptr -> operator__;
1285       retval = AsnWrite(aip, GBFEATURE_operator,  &av);
1286    }
1287    if (ptr -> partial5 || (ptr -> OBbits__ & (1<<0) )){   av.boolvalue = ptr -> partial5;
1288       retval = AsnWrite(aip, GBFEATURE_partial5,  &av);
1289    }
1290    if (ptr -> partial3 || (ptr -> OBbits__ & (1<<1) )){   av.boolvalue = ptr -> partial3;
1291       retval = AsnWrite(aip, GBFEATURE_partial3,  &av);
1292    }
1293    AsnGenericUserSeqOfAsnWrite(ptr -> quals, (AsnWriteFunc) GBQualifierAsnWrite, aip, GBFEATURE_quals, GBFEATURE_quals_E);
1294    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1295       goto erret;
1296    }
1297    retval = TRUE;
1298 
1299 erret:
1300    AsnUnlinkType(orig);       /* unlink local tree */
1301    return retval;
1302 }
1303 
1304 
1305 
1306 /**************************************************
1307 *
1308 *    GBXrefNew()
1309 *
1310 **************************************************/
1311 NLM_EXTERN 
1312 GBXrefPtr LIBCALL
1313 GBXrefNew(void)
1314 {
1315    GBXrefPtr ptr = MemNew((size_t) sizeof(GBXref));
1316 
1317    return ptr;
1318 
1319 }
1320 
1321 
1322 /**************************************************
1323 *
1324 *    GBXrefFree()
1325 *
1326 **************************************************/
1327 NLM_EXTERN 
1328 GBXrefPtr LIBCALL
1329 GBXrefFree(GBXrefPtr ptr)
1330 {
1331 
1332    if(ptr == NULL) {
1333       return NULL;
1334    }
1335    MemFree(ptr -> dbname);
1336    MemFree(ptr -> id);
1337    return MemFree(ptr);
1338 }
1339 
1340 
1341 /**************************************************
1342 *
1343 *    GBXrefAsnRead()
1344 *
1345 **************************************************/
1346 NLM_EXTERN 
1347 GBXrefPtr LIBCALL
1348 GBXrefAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1349 {
1350    DataVal av;
1351    AsnTypePtr atp;
1352    Boolean isError = FALSE;
1353    AsnReadFunc func;
1354    GBXrefPtr ptr;
1355 
1356    if (! loaded)
1357    {
1358       if (! objgbseqAsnLoad()) {
1359          return NULL;
1360       }
1361    }
1362 
1363    if (aip == NULL) {
1364       return NULL;
1365    }
1366 
1367    if (orig == NULL) {         /* GBXref ::= (self contained) */
1368       atp = AsnReadId(aip, amp, GBXREF);
1369    } else {
1370       atp = AsnLinkType(orig, GBXREF);
1371    }
1372    /* link in local tree */
1373    if (atp == NULL) {
1374       return NULL;
1375    }
1376 
1377    ptr = GBXrefNew();
1378    if (ptr == NULL) {
1379       goto erret;
1380    }
1381    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1382       goto erret;
1383    }
1384 
1385    atp = AsnReadId(aip,amp, atp);
1386    func = NULL;
1387 
1388    if (atp == GBXREF_dbname) {
1389       if ( AsnReadVal(aip, atp, &av) <= 0) {
1390          goto erret;
1391       }
1392       ptr -> dbname = av.ptrvalue;
1393       atp = AsnReadId(aip,amp, atp);
1394    }
1395    if (atp == GBXREF_id) {
1396       if ( AsnReadVal(aip, atp, &av) <= 0) {
1397          goto erret;
1398       }
1399       ptr -> id = av.ptrvalue;
1400       atp = AsnReadId(aip,amp, atp);
1401    }
1402 
1403    if (AsnReadVal(aip, atp, &av) <= 0) {
1404       goto erret;
1405    }
1406    /* end struct */
1407 
1408 ret:
1409    AsnUnlinkType(orig);       /* unlink local tree */
1410    return ptr;
1411 
1412 erret:
1413    aip -> io_failure = TRUE;
1414    ptr = GBXrefFree(ptr);
1415    goto ret;
1416 }
1417 
1418 
1419 
1420 /**************************************************
1421 *
1422 *    GBXrefAsnWrite()
1423 *
1424 **************************************************/
1425 NLM_EXTERN Boolean LIBCALL 
1426 GBXrefAsnWrite(GBXrefPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1427 {
1428    DataVal av;
1429    AsnTypePtr atp;
1430    Boolean retval = FALSE;
1431 
1432    if (! loaded)
1433    {
1434       if (! objgbseqAsnLoad()) {
1435          return FALSE;
1436       }
1437    }
1438 
1439    if (aip == NULL) {
1440       return FALSE;
1441    }
1442 
1443    atp = AsnLinkType(orig, GBXREF);   /* link local tree */
1444    if (atp == NULL) {
1445       return FALSE;
1446    }
1447 
1448    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1449    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1450       goto erret;
1451    }
1452 
1453    if (ptr -> dbname != NULL) {
1454       av.ptrvalue = ptr -> dbname;
1455       retval = AsnWrite(aip, GBXREF_dbname,  &av);
1456    }
1457    if (ptr -> id != NULL) {
1458       av.ptrvalue = ptr -> id;
1459       retval = AsnWrite(aip, GBXREF_id,  &av);
1460    }
1461    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1462       goto erret;
1463    }
1464    retval = TRUE;
1465 
1466 erret:
1467    AsnUnlinkType(orig);       /* unlink local tree */
1468    return retval;
1469 }
1470 
1471 
1472 
1473 /**************************************************
1474 *
1475 *    GBTagsFree()
1476 *
1477 **************************************************/
1478 NLM_EXTERN 
1479 GBTagsPtr LIBCALL
1480 GBTagsFree(GBTagsPtr ptr)
1481 {
1482 
1483    if(ptr == NULL) {
1484       return NULL;
1485    }
1486    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) GBTagFree);
1487    return NULL;
1488 }
1489 
1490 
1491 /**************************************************
1492 *
1493 *    GBTagsAsnRead()
1494 *
1495 **************************************************/
1496 NLM_EXTERN 
1497 GBTagsPtr LIBCALL
1498 GBTagsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1499 {
1500    DataVal av;
1501    AsnTypePtr atp;
1502    Boolean isError = FALSE;
1503    AsnReadFunc func;
1504    GBTagsPtr ptr;
1505 
1506    if (! loaded)
1507    {
1508       if (! objgbseqAsnLoad()) {
1509          return NULL;
1510       }
1511    }
1512 
1513    if (aip == NULL) {
1514       return NULL;
1515    }
1516 
1517    if (orig == NULL) {         /* GBTags ::= (self contained) */
1518       atp = AsnReadId(aip, amp, GBTAGS);
1519    } else {
1520       atp = AsnLinkType(orig, GBTAGS);
1521    }
1522    /* link in local tree */
1523    if (atp == NULL) {
1524       return NULL;
1525    }
1526 
1527    func = NULL;
1528 
1529    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBTagAsnRead, (AsnOptFreeFunc) GBTagFree);
1530    if (isError && ptr  == NULL) {
1531       goto erret;
1532    }
1533 
1534 
1535 
1536 ret:
1537    AsnUnlinkType(orig);       /* unlink local tree */
1538    return ptr;
1539 
1540 erret:
1541    aip -> io_failure = TRUE;
1542    ptr = GBTagsFree(ptr);
1543    goto ret;
1544 }
1545 
1546 
1547 
1548 /**************************************************
1549 *
1550 *    GBTagsAsnWrite()
1551 *
1552 **************************************************/
1553 NLM_EXTERN Boolean LIBCALL 
1554 GBTagsAsnWrite(GBTagsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1555 {
1556    DataVal av;
1557    AsnTypePtr atp;
1558    Boolean retval = FALSE;
1559 
1560    if (! loaded)
1561    {
1562       if (! objgbseqAsnLoad()) {
1563          return FALSE;
1564       }
1565    }
1566 
1567    if (aip == NULL) {
1568       return FALSE;
1569    }
1570 
1571    atp = AsnLinkType(orig, GBTAGS);   /* link local tree */
1572    if (atp == NULL) {
1573       return FALSE;
1574    }
1575 
1576    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1577    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) GBTagAsnWrite, aip, atp, GBTAGS_E);
1578    retval = TRUE;
1579 
1580 erret:
1581    AsnUnlinkType(orig);       /* unlink local tree */
1582    return retval;
1583 }
1584 
1585 
1586 
1587 /**************************************************
1588 *
1589 *    GBTagNew()
1590 *
1591 **************************************************/
1592 NLM_EXTERN 
1593 GBTagPtr LIBCALL
1594 GBTagNew(void)
1595 {
1596    GBTagPtr ptr = MemNew((size_t) sizeof(GBTag));
1597 
1598    return ptr;
1599 
1600 }
1601 
1602 
1603 /**************************************************
1604 *
1605 *    GBTagFree()
1606 *
1607 **************************************************/
1608 NLM_EXTERN 
1609 GBTagPtr LIBCALL
1610 GBTagFree(GBTagPtr ptr)
1611 {
1612 
1613    if(ptr == NULL) {
1614       return NULL;
1615    }
1616    MemFree(ptr -> name);
1617    MemFree(ptr -> value);
1618    MemFree(ptr -> unit);
1619    return MemFree(ptr);
1620 }
1621 
1622 
1623 /**************************************************
1624 *
1625 *    GBTagAsnRead()
1626 *
1627 **************************************************/
1628 NLM_EXTERN 
1629 GBTagPtr LIBCALL
1630 GBTagAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1631 {
1632    DataVal av;
1633    AsnTypePtr atp;
1634    Boolean isError = FALSE;
1635    AsnReadFunc func;
1636    GBTagPtr ptr;
1637 
1638    if (! loaded)
1639    {
1640       if (! objgbseqAsnLoad()) {
1641          return NULL;
1642       }
1643    }
1644 
1645    if (aip == NULL) {
1646       return NULL;
1647    }
1648 
1649    if (orig == NULL) {         /* GBTag ::= (self contained) */
1650       atp = AsnReadId(aip, amp, GBTAG);
1651    } else {
1652       atp = AsnLinkType(orig, GBTAG);
1653    }
1654    /* link in local tree */
1655    if (atp == NULL) {
1656       return NULL;
1657    }
1658 
1659    ptr = GBTagNew();
1660    if (ptr == NULL) {
1661       goto erret;
1662    }
1663    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1664       goto erret;
1665    }
1666 
1667    atp = AsnReadId(aip,amp, atp);
1668    func = NULL;
1669 
1670    if (atp == GBTAG_name) {
1671       if ( AsnReadVal(aip, atp, &av) <= 0) {
1672          goto erret;
1673       }
1674       ptr -> name = av.ptrvalue;
1675       atp = AsnReadId(aip,amp, atp);
1676    }
1677    if (atp == GBTAG_value) {
1678       if ( AsnReadVal(aip, atp, &av) <= 0) {
1679          goto erret;
1680       }
1681       ptr -> value = av.ptrvalue;
1682       atp = AsnReadId(aip,amp, atp);
1683    }
1684    if (atp == GBTAG_unit) {
1685       if ( AsnReadVal(aip, atp, &av) <= 0) {
1686          goto erret;
1687       }
1688       ptr -> unit = av.ptrvalue;
1689       atp = AsnReadId(aip,amp, atp);
1690    }
1691 
1692    if (AsnReadVal(aip, atp, &av) <= 0) {
1693       goto erret;
1694    }
1695    /* end struct */
1696 
1697 ret:
1698    AsnUnlinkType(orig);       /* unlink local tree */
1699    return ptr;
1700 
1701 erret:
1702    aip -> io_failure = TRUE;
1703    ptr = GBTagFree(ptr);
1704    goto ret;
1705 }
1706 
1707 
1708 
1709 /**************************************************
1710 *
1711 *    GBTagAsnWrite()
1712 *
1713 **************************************************/
1714 NLM_EXTERN Boolean LIBCALL 
1715 GBTagAsnWrite(GBTagPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1716 {
1717    DataVal av;
1718    AsnTypePtr atp;
1719    Boolean retval = FALSE;
1720 
1721    if (! loaded)
1722    {
1723       if (! objgbseqAsnLoad()) {
1724          return FALSE;
1725       }
1726    }
1727 
1728    if (aip == NULL) {
1729       return FALSE;
1730    }
1731 
1732    atp = AsnLinkType(orig, GBTAG);   /* link local tree */
1733    if (atp == NULL) {
1734       return FALSE;
1735    }
1736 
1737    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1738    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1739       goto erret;
1740    }
1741 
1742    if (ptr -> name != NULL) {
1743       av.ptrvalue = ptr -> name;
1744       retval = AsnWrite(aip, GBTAG_name,  &av);
1745    }
1746    if (ptr -> value != NULL) {
1747       av.ptrvalue = ptr -> value;
1748       retval = AsnWrite(aip, GBTAG_value,  &av);
1749    }
1750    if (ptr -> unit != NULL) {
1751       av.ptrvalue = ptr -> unit;
1752       retval = AsnWrite(aip, GBTAG_unit,  &av);
1753    }
1754    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1755       goto erret;
1756    }
1757    retval = TRUE;
1758 
1759 erret:
1760    AsnUnlinkType(orig);       /* unlink local tree */
1761    return retval;
1762 }
1763 
1764 
1765 
1766 /**************************************************
1767 *
1768 *    GBIntervalNew()
1769 *
1770 **************************************************/
1771 NLM_EXTERN 
1772 GBIntervalPtr LIBCALL
1773 GBIntervalNew(void)
1774 {
1775    GBIntervalPtr ptr = MemNew((size_t) sizeof(GBInterval));
1776 
1777    return ptr;
1778 
1779 }
1780 
1781 
1782 /**************************************************
1783 *
1784 *    GBIntervalFree()
1785 *
1786 **************************************************/
1787 NLM_EXTERN 
1788 GBIntervalPtr LIBCALL
1789 GBIntervalFree(GBIntervalPtr ptr)
1790 {
1791 
1792    if(ptr == NULL) {
1793       return NULL;
1794    }
1795    MemFree(ptr -> accession);
1796    return MemFree(ptr);
1797 }
1798 
1799 
1800 /**************************************************
1801 *
1802 *    GBIntervalAsnRead()
1803 *
1804 **************************************************/
1805 NLM_EXTERN 
1806 GBIntervalPtr LIBCALL
1807 GBIntervalAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1808 {
1809    DataVal av;
1810    AsnTypePtr atp;
1811    Boolean isError = FALSE;
1812    AsnReadFunc func;
1813    GBIntervalPtr ptr;
1814 
1815    if (! loaded)
1816    {
1817       if (! objgbseqAsnLoad()) {
1818          return NULL;
1819       }
1820    }
1821 
1822    if (aip == NULL) {
1823       return NULL;
1824    }
1825 
1826    if (orig == NULL) {         /* GBInterval ::= (self contained) */
1827       atp = AsnReadId(aip, amp, GBINTERVAL);
1828    } else {
1829       atp = AsnLinkType(orig, GBINTERVAL);
1830    }
1831    /* link in local tree */
1832    if (atp == NULL) {
1833       return NULL;
1834    }
1835 
1836    ptr = GBIntervalNew();
1837    if (ptr == NULL) {
1838       goto erret;
1839    }
1840    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1841       goto erret;
1842    }
1843 
1844    atp = AsnReadId(aip,amp, atp);
1845    func = NULL;
1846 
1847    if (atp == GBINTERVAL_from) {
1848       if ( AsnReadVal(aip, atp, &av) <= 0) {
1849          goto erret;
1850       }
1851       ptr -> from = av.intvalue;
1852       ptr -> OBbits__ |= 1<<0;
1853       atp = AsnReadId(aip,amp, atp);
1854    }
1855    if (atp == GBINTERVAL_to) {
1856       if ( AsnReadVal(aip, atp, &av) <= 0) {
1857          goto erret;
1858       }
1859       ptr -> to = av.intvalue;
1860       ptr -> OBbits__ |= 1<<1;
1861       atp = AsnReadId(aip,amp, atp);
1862    }
1863    if (atp == GBINTERVAL_point) {
1864       if ( AsnReadVal(aip, atp, &av) <= 0) {
1865          goto erret;
1866       }
1867       ptr -> point = av.intvalue;
1868       ptr -> OBbits__ |= 1<<2;
1869       atp = AsnReadId(aip,amp, atp);
1870    }
1871    if (atp == GBINTERVAL_iscomp) {
1872       if ( AsnReadVal(aip, atp, &av) <= 0) {
1873          goto erret;
1874       }
1875       ptr -> iscomp = av.boolvalue;
1876       ptr -> OBbits__ |= 1<<3;
1877       atp = AsnReadId(aip,amp, atp);
1878    }
1879    if (atp == GBINTERVAL_interbp) {
1880       if ( AsnReadVal(aip, atp, &av) <= 0) {
1881          goto erret;
1882       }
1883       ptr -> interbp = av.boolvalue;
1884       ptr -> OBbits__ |= 1<<4;
1885       atp = AsnReadId(aip,amp, atp);
1886    }
1887    if (atp == GBINTERVAL_accession) {
1888       if ( AsnReadVal(aip, atp, &av) <= 0) {
1889          goto erret;
1890       }
1891       ptr -> accession = av.ptrvalue;
1892       atp = AsnReadId(aip,amp, atp);
1893    }
1894 
1895    if (AsnReadVal(aip, atp, &av) <= 0) {
1896       goto erret;
1897    }
1898    /* end struct */
1899 
1900 ret:
1901    AsnUnlinkType(orig);       /* unlink local tree */
1902    return ptr;
1903 
1904 erret:
1905    aip -> io_failure = TRUE;
1906    ptr = GBIntervalFree(ptr);
1907    goto ret;
1908 }
1909 
1910 
1911 
1912 /**************************************************
1913 *
1914 *    GBIntervalAsnWrite()
1915 *
1916 **************************************************/
1917 NLM_EXTERN Boolean LIBCALL 
1918 GBIntervalAsnWrite(GBIntervalPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1919 {
1920    DataVal av;
1921    AsnTypePtr atp;
1922    Boolean retval = FALSE;
1923 
1924    if (! loaded)
1925    {
1926       if (! objgbseqAsnLoad()) {
1927          return FALSE;
1928       }
1929    }
1930 
1931    if (aip == NULL) {
1932       return FALSE;
1933    }
1934 
1935    atp = AsnLinkType(orig, GBINTERVAL);   /* link local tree */
1936    if (atp == NULL) {
1937       return FALSE;
1938    }
1939 
1940    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1941    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1942       goto erret;
1943    }
1944 
1945    if (ptr -> from || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> from;
1946       retval = AsnWrite(aip, GBINTERVAL_from,  &av);
1947    }
1948    if (ptr -> to || (ptr -> OBbits__ & (1<<1) )){   av.intvalue = ptr -> to;
1949       retval = AsnWrite(aip, GBINTERVAL_to,  &av);
1950    }
1951    if (ptr -> point || (ptr -> OBbits__ & (1<<2) )){   av.intvalue = ptr -> point;
1952       retval = AsnWrite(aip, GBINTERVAL_point,  &av);
1953    }
1954    if (ptr -> iscomp || (ptr -> OBbits__ & (1<<3) )){   av.boolvalue = ptr -> iscomp;
1955       retval = AsnWrite(aip, GBINTERVAL_iscomp,  &av);
1956    }
1957    if (ptr -> interbp || (ptr -> OBbits__ & (1<<4) )){   av.boolvalue = ptr -> interbp;
1958       retval = AsnWrite(aip, GBINTERVAL_interbp,  &av);
1959    }
1960    if (ptr -> accession != NULL) {
1961       av.ptrvalue = ptr -> accession;
1962       retval = AsnWrite(aip, GBINTERVAL_accession,  &av);
1963    }
1964    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1965       goto erret;
1966    }
1967    retval = TRUE;
1968 
1969 erret:
1970    AsnUnlinkType(orig);       /* unlink local tree */
1971    return retval;
1972 }
1973 
1974 
1975 
1976 /**************************************************
1977 *
1978 *    GBQualifierNew()
1979 *
1980 **************************************************/
1981 NLM_EXTERN 
1982 GBQualifierPtr LIBCALL
1983 GBQualifierNew(void)
1984 {
1985    GBQualifierPtr ptr = MemNew((size_t) sizeof(GBQualifier));
1986 
1987    return ptr;
1988 
1989 }
1990 
1991 
1992 /**************************************************
1993 *
1994 *    GBQualifierFree()
1995 *
1996 **************************************************/
1997 NLM_EXTERN 
1998 GBQualifierPtr LIBCALL
1999 GBQualifierFree(GBQualifierPtr ptr)
2000 {
2001 
2002    if(ptr == NULL) {
2003       return NULL;
2004    }
2005    MemFree(ptr -> name);
2006    MemFree(ptr -> value);
2007    return MemFree(ptr);
2008 }
2009 
2010 
2011 /**************************************************
2012 *
2013 *    GBQualifierAsnRead()
2014 *
2015 **************************************************/
2016 NLM_EXTERN 
2017 GBQualifierPtr LIBCALL
2018 GBQualifierAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2019 {
2020    DataVal av;
2021    AsnTypePtr atp;
2022    Boolean isError = FALSE;
2023    AsnReadFunc func;
2024    GBQualifierPtr ptr;
2025 
2026    if (! loaded)
2027    {
2028       if (! objgbseqAsnLoad()) {
2029          return NULL;
2030       }
2031    }
2032 
2033    if (aip == NULL) {
2034       return NULL;
2035    }
2036 
2037    if (orig == NULL) {         /* GBQualifier ::= (self contained) */
2038       atp = AsnReadId(aip, amp, GBQUALIFIER);
2039    } else {
2040       atp = AsnLinkType(orig, GBQUALIFIER);
2041    }
2042    /* link in local tree */
2043    if (atp == NULL) {
2044       return NULL;
2045    }
2046 
2047    ptr = GBQualifierNew();
2048    if (ptr == NULL) {
2049       goto erret;
2050    }
2051    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2052       goto erret;
2053    }
2054 
2055    atp = AsnReadId(aip,amp, atp);
2056    func = NULL;
2057 
2058    if (atp == GBQUALIFIER_name) {
2059       if ( AsnReadVal(aip, atp, &av) <= 0) {
2060          goto erret;
2061       }
2062       ptr -> name = av.ptrvalue;
2063       atp = AsnReadId(aip,amp, atp);
2064    }
2065    if (atp == GBQUALIFIER_value) {
2066       if ( AsnReadVal(aip, atp, &av) <= 0) {
2067          goto erret;
2068       }
2069       ptr -> value = av.ptrvalue;
2070       atp = AsnReadId(aip,amp, atp);
2071    }
2072 
2073    if (AsnReadVal(aip, atp, &av) <= 0) {
2074       goto erret;
2075    }
2076    /* end struct */
2077 
2078 ret:
2079    AsnUnlinkType(orig);       /* unlink local tree */
2080    return ptr;
2081 
2082 erret:
2083    aip -> io_failure = TRUE;
2084    ptr = GBQualifierFree(ptr);
2085    goto ret;
2086 }
2087 
2088 
2089 
2090 /**************************************************
2091 *
2092 *    GBQualifierAsnWrite()
2093 *
2094 **************************************************/
2095 NLM_EXTERN Boolean LIBCALL 
2096 GBQualifierAsnWrite(GBQualifierPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2097 {
2098    DataVal av;
2099    AsnTypePtr atp;
2100    Boolean retval = FALSE;
2101 
2102    if (! loaded)
2103    {
2104       if (! objgbseqAsnLoad()) {
2105          return FALSE;
2106       }
2107    }
2108 
2109    if (aip == NULL) {
2110       return FALSE;
2111    }
2112 
2113    atp = AsnLinkType(orig, GBQUALIFIER);   /* link local tree */
2114    if (atp == NULL) {
2115       return FALSE;
2116    }
2117 
2118    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2119    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2120       goto erret;
2121    }
2122 
2123    if (ptr -> name != NULL) {
2124       av.ptrvalue = ptr -> name;
2125       retval = AsnWrite(aip, GBQUALIFIER_name,  &av);
2126    }
2127    if (ptr -> value != NULL) {
2128       av.ptrvalue = ptr -> value;
2129       retval = AsnWrite(aip, GBQUALIFIER_value,  &av);
2130    }
2131    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2132       goto erret;
2133    }
2134    retval = TRUE;
2135 
2136 erret:
2137    AsnUnlinkType(orig);       /* unlink local tree */
2138    return retval;
2139 }
2140 
2141 
2142 
2143 /**************************************************
2144 *
2145 *    GBTagsetRulesNew()
2146 *
2147 **************************************************/
2148 NLM_EXTERN 
2149 GBTagsetRulesPtr LIBCALL
2150 GBTagsetRulesNew(void)
2151 {
2152    GBTagsetRulesPtr ptr = MemNew((size_t) sizeof(GBTagsetRules));
2153 
2154    return ptr;
2155 
2156 }
2157 
2158 
2159 /**************************************************
2160 *
2161 *    GBTagsetRulesFree()
2162 *
2163 **************************************************/
2164 NLM_EXTERN 
2165 GBTagsetRulesPtr LIBCALL
2166 GBTagsetRulesFree(GBTagsetRulesPtr ptr)
2167 {
2168 
2169    if(ptr == NULL) {
2170       return NULL;
2171    }
2172    MemFree(ptr -> authority);
2173    MemFree(ptr -> version);
2174    GBTagNamesFree(ptr -> mandatorytags);
2175    GBTagNamesFree(ptr -> optionaltags);
2176    GBTagNamesFree(ptr -> uniquetags);
2177    return MemFree(ptr);
2178 }
2179 
2180 
2181 /**************************************************
2182 *
2183 *    GBTagsetRulesAsnRead()
2184 *
2185 **************************************************/
2186 NLM_EXTERN 
2187 GBTagsetRulesPtr LIBCALL
2188 GBTagsetRulesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2189 {
2190    DataVal av;
2191    AsnTypePtr atp;
2192    Boolean isError = FALSE;
2193    AsnReadFunc func;
2194    GBTagsetRulesPtr ptr;
2195 
2196    if (! loaded)
2197    {
2198       if (! objgbseqAsnLoad()) {
2199          return NULL;
2200       }
2201    }
2202 
2203    if (aip == NULL) {
2204       return NULL;
2205    }
2206 
2207    if (orig == NULL) {         /* GBTagsetRules ::= (self contained) */
2208       atp = AsnReadId(aip, amp, GBTAGSETRULES);
2209    } else {
2210       atp = AsnLinkType(orig, GBTAGSETRULES);
2211    }
2212    /* link in local tree */
2213    if (atp == NULL) {
2214       return NULL;
2215    }
2216 
2217    ptr = GBTagsetRulesNew();
2218    if (ptr == NULL) {
2219       goto erret;
2220    }
2221    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2222       goto erret;
2223    }
2224 
2225    atp = AsnReadId(aip,amp, atp);
2226    func = NULL;
2227 
2228    if (atp == GBTAGSETRULES_authority) {
2229       if ( AsnReadVal(aip, atp, &av) <= 0) {
2230          goto erret;
2231       }
2232       ptr -> authority = av.ptrvalue;
2233       atp = AsnReadId(aip,amp, atp);
2234    }
2235    if (atp == GBTAGSETRULES_version) {
2236       if ( AsnReadVal(aip, atp, &av) <= 0) {
2237          goto erret;
2238       }
2239       ptr -> version = av.ptrvalue;
2240       atp = AsnReadId(aip,amp, atp);
2241    }
2242    if (atp == GBTAGSETRULES_mandatorytags) {
2243       ptr -> mandatorytags = GBTagNamesAsnRead(aip, atp);
2244       if (aip -> io_failure) {
2245          goto erret;
2246       }
2247       atp = AsnReadId(aip,amp, atp);
2248    }
2249    if (atp == GBTAGSETRULES_optionaltags) {
2250       ptr -> optionaltags = GBTagNamesAsnRead(aip, atp);
2251       if (aip -> io_failure) {
2252          goto erret;
2253       }
2254       atp = AsnReadId(aip,amp, atp);
2255    }
2256    if (atp == GBTAGSETRULES_uniquetags) {
2257       ptr -> uniquetags = GBTagNamesAsnRead(aip, atp);
2258       if (aip -> io_failure) {
2259          goto erret;
2260       }
2261       atp = AsnReadId(aip,amp, atp);
2262    }
2263    if (atp == GBTAGSETRULES_extensible) {
2264       if ( AsnReadVal(aip, atp, &av) <= 0) {
2265          goto erret;
2266       }
2267       ptr -> extensible = av.boolvalue;
2268       ptr -> OBbits__ |= 1<<0;
2269       atp = AsnReadId(aip,amp, atp);
2270    }
2271 
2272    if (AsnReadVal(aip, atp, &av) <= 0) {
2273       goto erret;
2274    }
2275    /* end struct */
2276 
2277 ret:
2278    AsnUnlinkType(orig);       /* unlink local tree */
2279    return ptr;
2280 
2281 erret:
2282    aip -> io_failure = TRUE;
2283    ptr = GBTagsetRulesFree(ptr);
2284    goto ret;
2285 }
2286 
2287 
2288 
2289 /**************************************************
2290 *
2291 *    GBTagsetRulesAsnWrite()
2292 *
2293 **************************************************/
2294 NLM_EXTERN Boolean LIBCALL 
2295 GBTagsetRulesAsnWrite(GBTagsetRulesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2296 {
2297    DataVal av;
2298    AsnTypePtr atp;
2299    Boolean retval = FALSE;
2300 
2301    if (! loaded)
2302    {
2303       if (! objgbseqAsnLoad()) {
2304          return FALSE;
2305       }
2306    }
2307 
2308    if (aip == NULL) {
2309       return FALSE;
2310    }
2311 
2312    atp = AsnLinkType(orig, GBTAGSETRULES);   /* link local tree */
2313    if (atp == NULL) {
2314       return FALSE;
2315    }
2316 
2317    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2318    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2319       goto erret;
2320    }
2321 
2322    if (ptr -> authority != NULL) {
2323       av.ptrvalue = ptr -> authority;
2324       retval = AsnWrite(aip, GBTAGSETRULES_authority,  &av);
2325    }
2326    if (ptr -> version != NULL) {
2327       av.ptrvalue = ptr -> version;
2328       retval = AsnWrite(aip, GBTAGSETRULES_version,  &av);
2329    }
2330    if (ptr -> mandatorytags != NULL) {
2331       if ( ! GBTagNamesAsnWrite(ptr -> mandatorytags, aip, GBTAGSETRULES_mandatorytags)) {
2332          goto erret;
2333       }
2334    }
2335    if (ptr -> optionaltags != NULL) {
2336       if ( ! GBTagNamesAsnWrite(ptr -> optionaltags, aip, GBTAGSETRULES_optionaltags)) {
2337          goto erret;
2338       }
2339    }
2340    if (ptr -> uniquetags != NULL) {
2341       if ( ! GBTagNamesAsnWrite(ptr -> uniquetags, aip, GBTAGSETRULES_uniquetags)) {
2342          goto erret;
2343       }
2344    }
2345    if (ptr -> extensible || (ptr -> OBbits__ & (1<<0) )){   av.boolvalue = ptr -> extensible;
2346       retval = AsnWrite(aip, GBTAGSETRULES_extensible,  &av);
2347    }
2348    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2349       goto erret;
2350    }
2351    retval = TRUE;
2352 
2353 erret:
2354    AsnUnlinkType(orig);       /* unlink local tree */
2355    return retval;
2356 }
2357 
2358 
2359 
2360 /**************************************************
2361 *
2362 *    GBTagNamesFree()
2363 *
2364 **************************************************/
2365 NLM_EXTERN 
2366 GBTagNamesPtr LIBCALL
2367 GBTagNamesFree(GBTagNamesPtr ptr)
2368 {
2369 
2370    if(ptr == NULL) {
2371       return NULL;
2372    }
2373    AsnGenericBaseSeqOfFree(ptr,ASNCODE_PTRVAL_SLOT);
2374    return NULL;
2375 }
2376 
2377 
2378 /**************************************************
2379 *
2380 *    GBTagNamesAsnRead()
2381 *
2382 **************************************************/
2383 NLM_EXTERN 
2384 GBTagNamesPtr LIBCALL
2385 GBTagNamesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2386 {
2387    DataVal av;
2388    AsnTypePtr atp;
2389    Boolean isError = FALSE;
2390    AsnReadFunc func;
2391    GBTagNamesPtr ptr;
2392 
2393    if (! loaded)
2394    {
2395       if (! objgbseqAsnLoad()) {
2396          return NULL;
2397       }
2398    }
2399 
2400    if (aip == NULL) {
2401       return NULL;
2402    }
2403 
2404    if (orig == NULL) {         /* GBTagNames ::= (self contained) */
2405       atp = AsnReadId(aip, amp, GBTAGNAMES);
2406    } else {
2407       atp = AsnLinkType(orig, GBTAGNAMES);
2408    }
2409    /* link in local tree */
2410    if (atp == NULL) {
2411       return NULL;
2412    }
2413 
2414    func = NULL;
2415 
2416    ptr  = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
2417    if (isError && ptr  == NULL) {
2418       goto erret;
2419    }
2420 
2421 
2422 
2423 ret:
2424    AsnUnlinkType(orig);       /* unlink local tree */
2425    return ptr;
2426 
2427 erret:
2428    aip -> io_failure = TRUE;
2429    ptr = GBTagNamesFree(ptr);
2430    goto ret;
2431 }
2432 
2433 
2434 
2435 /**************************************************
2436 *
2437 *    GBTagNamesAsnWrite()
2438 *
2439 **************************************************/
2440 NLM_EXTERN Boolean LIBCALL 
2441 GBTagNamesAsnWrite(GBTagNamesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2442 {
2443    DataVal av;
2444    AsnTypePtr atp;
2445    Boolean retval = FALSE;
2446 
2447    if (! loaded)
2448    {
2449       if (! objgbseqAsnLoad()) {
2450          return FALSE;
2451       }
2452    }
2453 
2454    if (aip == NULL) {
2455       return FALSE;
2456    }
2457 
2458    atp = AsnLinkType(orig, GBTAGNAMES);   /* link local tree */
2459    if (atp == NULL) {
2460       return FALSE;
2461    }
2462 
2463    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2464    retval = AsnGenericBaseSeqOfAsnWrite(ptr, ASNCODE_PTRVAL_SLOT, aip, atp, GBTAGNAMES_E);
2465    retval = TRUE;
2466 
2467 erret:
2468    AsnUnlinkType(orig);       /* unlink local tree */
2469    return retval;
2470 }
2471 
2472 
2473 
2474 /**************************************************
2475 *
2476 *    GBTagsetRuleSetFree()
2477 *
2478 **************************************************/
2479 NLM_EXTERN 
2480 GBTagsetRuleSetPtr LIBCALL
2481 GBTagsetRuleSetFree(GBTagsetRuleSetPtr ptr)
2482 {
2483 
2484    if(ptr == NULL) {
2485       return NULL;
2486    }
2487    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) GBTagsetRulesFree);
2488    return NULL;
2489 }
2490 
2491 
2492 /**************************************************
2493 *
2494 *    GBTagsetRuleSetAsnRead()
2495 *
2496 **************************************************/
2497 NLM_EXTERN 
2498 GBTagsetRuleSetPtr LIBCALL
2499 GBTagsetRuleSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2500 {
2501    DataVal av;
2502    AsnTypePtr atp;
2503    Boolean isError = FALSE;
2504    AsnReadFunc func;
2505    GBTagsetRuleSetPtr ptr;
2506 
2507    if (! loaded)
2508    {
2509       if (! objgbseqAsnLoad()) {
2510          return NULL;
2511       }
2512    }
2513 
2514    if (aip == NULL) {
2515       return NULL;
2516    }
2517 
2518    if (orig == NULL) {         /* GBTagsetRuleSet ::= (self contained) */
2519       atp = AsnReadId(aip, amp, GBTAGSETRULESET);
2520    } else {
2521       atp = AsnLinkType(orig, GBTAGSETRULESET);
2522    }
2523    /* link in local tree */
2524    if (atp == NULL) {
2525       return NULL;
2526    }
2527 
2528    func = NULL;
2529 
2530    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GBTagsetRulesAsnRead, (AsnOptFreeFunc) GBTagsetRulesFree);
2531    if (isError && ptr  == NULL) {
2532       goto erret;
2533    }
2534 
2535 
2536 
2537 ret:
2538    AsnUnlinkType(orig);       /* unlink local tree */
2539    return ptr;
2540 
2541 erret:
2542    aip -> io_failure = TRUE;
2543    ptr = GBTagsetRuleSetFree(ptr);
2544    goto ret;
2545 }
2546 
2547 
2548 
2549 /**************************************************
2550 *
2551 *    GBTagsetRuleSetAsnWrite()
2552 *
2553 **************************************************/
2554 NLM_EXTERN Boolean LIBCALL 
2555 GBTagsetRuleSetAsnWrite(GBTagsetRuleSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2556 {
2557    DataVal av;
2558    AsnTypePtr atp;
2559    Boolean retval = FALSE;
2560 
2561    if (! loaded)
2562    {
2563       if (! objgbseqAsnLoad()) {
2564          return FALSE;
2565       }
2566    }
2567 
2568    if (aip == NULL) {
2569       return FALSE;
2570    }
2571 
2572    atp = AsnLinkType(orig, GBTAGSETRULESET);   /* link local tree */
2573    if (atp == NULL) {
2574       return FALSE;
2575    }
2576 
2577    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2578    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) GBTagsetRulesAsnWrite, aip, atp, GBTAGSETRULESET_E);
2579    retval = TRUE;
2580 
2581 erret:
2582    AsnUnlinkType(orig);       /* unlink local tree */
2583    return retval;
2584 }
2585 
2586 

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.