NCBI C Toolkit Cross Reference

C/object/objmacro.c


  1 #include <asn.h>
  2 
  3 #define NLM_GENERATED_CODE_PROTO
  4 
  5 #include <objmacro.h>
  6 
  7 static Boolean loaded = FALSE;
  8 
  9 #include <asnmacro.h>
 10 
 11 #ifndef NLM_EXTERN_LOADS
 12 #define NLM_EXTERN_LOADS {}
 13 #endif
 14 
 15 NLM_EXTERN Boolean LIBCALL
 16 objmacroAsnLoad(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-Macro
 34 *    Generated using ASNCODE Revision: 6.16 at Nov 17, 2009 10:05 AM
 35 *
 36 **************************************************/
 37 
 38 
 39 /**************************************************
 40 *
 41 *    AECRActionNew()
 42 *
 43 **************************************************/
 44 NLM_EXTERN 
 45 AECRActionPtr LIBCALL
 46 AECRActionNew(void)
 47 {
 48    AECRActionPtr ptr = MemNew((size_t) sizeof(AECRAction));
 49 
 50    ptr -> also_change_mrna = 0;
 51    return ptr;
 52 
 53 }
 54 
 55 
 56 /**************************************************
 57 *
 58 *    AECRActionFree()
 59 *
 60 **************************************************/
 61 NLM_EXTERN 
 62 AECRActionPtr LIBCALL
 63 AECRActionFree(AECRActionPtr ptr)
 64 {
 65 
 66    if(ptr == NULL) {
 67       return NULL;
 68    }
 69    ActionChoiceFree(ptr -> action);
 70    ConstraintChoiceSetFree(ptr -> constraint);
 71    return MemFree(ptr);
 72 }
 73 
 74 
 75 /**************************************************
 76 *
 77 *    AECRActionAsnRead()
 78 *
 79 **************************************************/
 80 NLM_EXTERN 
 81 AECRActionPtr LIBCALL
 82 AECRActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 83 {
 84    DataVal av;
 85    AsnTypePtr atp;
 86    Boolean isError = FALSE;
 87    AsnReadFunc func;
 88    AECRActionPtr ptr;
 89 
 90    if (! loaded)
 91    {
 92       if (! objmacroAsnLoad()) {
 93          return NULL;
 94       }
 95    }
 96 
 97    if (aip == NULL) {
 98       return NULL;
 99    }
100 
101    if (orig == NULL) {         /* AECRAction ::= (self contained) */
102       atp = AsnReadId(aip, amp, AECR_ACTION);
103    } else {
104       atp = AsnLinkType(orig, AECR_ACTION);
105    }
106    /* link in local tree */
107    if (atp == NULL) {
108       return NULL;
109    }
110 
111    ptr = AECRActionNew();
112    if (ptr == NULL) {
113       goto erret;
114    }
115    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
116       goto erret;
117    }
118 
119    atp = AsnReadId(aip,amp, atp);
120    func = NULL;
121 
122    if (atp == AECR_ACTION_action) {
123       ptr -> action = ActionChoiceAsnRead(aip, atp);
124       if (aip -> io_failure) {
125          goto erret;
126       }
127       atp = AsnReadId(aip,amp, atp);
128    }
129    if (atp == AECR_ACTION_also_change_mrna) {
130       if ( AsnReadVal(aip, atp, &av) <= 0) {
131          goto erret;
132       }
133       ptr -> also_change_mrna = av.boolvalue;
134       atp = AsnReadId(aip,amp, atp);
135    }
136    if (atp == AECR_ACTION_constraint) {
137       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
138       if (aip -> io_failure) {
139          goto erret;
140       }
141       atp = AsnReadId(aip,amp, atp);
142    }
143 
144    if (AsnReadVal(aip, atp, &av) <= 0) {
145       goto erret;
146    }
147    /* end struct */
148 
149 ret:
150    AsnUnlinkType(orig);       /* unlink local tree */
151    return ptr;
152 
153 erret:
154    aip -> io_failure = TRUE;
155    ptr = AECRActionFree(ptr);
156    goto ret;
157 }
158 
159 
160 
161 /**************************************************
162 *
163 *    AECRActionAsnWrite()
164 *
165 **************************************************/
166 NLM_EXTERN Boolean LIBCALL 
167 AECRActionAsnWrite(AECRActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
168 {
169    DataVal av;
170    AsnTypePtr atp;
171    Boolean retval = FALSE;
172 
173    if (! loaded)
174    {
175       if (! objmacroAsnLoad()) {
176          return FALSE;
177       }
178    }
179 
180    if (aip == NULL) {
181       return FALSE;
182    }
183 
184    atp = AsnLinkType(orig, AECR_ACTION);   /* link local tree */
185    if (atp == NULL) {
186       return FALSE;
187    }
188 
189    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
190    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
191       goto erret;
192    }
193 
194    if (ptr -> action != NULL) {
195       if ( ! ActionChoiceAsnWrite(ptr -> action, aip, AECR_ACTION_action)) {
196          goto erret;
197       }
198    }
199    av.boolvalue = ptr -> also_change_mrna;
200    retval = AsnWrite(aip, AECR_ACTION_also_change_mrna,  &av);
201    if (ptr -> constraint != NULL) {
202       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, AECR_ACTION_constraint)) {
203          goto erret;
204       }
205    }
206    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
207       goto erret;
208    }
209    retval = TRUE;
210 
211 erret:
212    AsnUnlinkType(orig);       /* unlink local tree */
213    return retval;
214 }
215 
216 
217 
218 /**************************************************
219 *
220 *    ParseActionNew()
221 *
222 **************************************************/
223 NLM_EXTERN 
224 ParseActionPtr LIBCALL
225 ParseActionNew(void)
226 {
227    ParseActionPtr ptr = MemNew((size_t) sizeof(ParseAction));
228 
229    ptr -> capitalization = 0;
230    ptr -> remove_from_parsed = 0;
231    return ptr;
232 
233 }
234 
235 
236 /**************************************************
237 *
238 *    ParseActionFree()
239 *
240 **************************************************/
241 NLM_EXTERN 
242 ParseActionPtr LIBCALL
243 ParseActionFree(ParseActionPtr ptr)
244 {
245 
246    if(ptr == NULL) {
247       return NULL;
248    }
249    TextPortionFree(ptr -> portion);
250    ParseSrcFree(ptr -> src);
251    ParseDestFree(ptr -> dest);
252    return MemFree(ptr);
253 }
254 
255 
256 /**************************************************
257 *
258 *    ParseActionAsnRead()
259 *
260 **************************************************/
261 NLM_EXTERN 
262 ParseActionPtr LIBCALL
263 ParseActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
264 {
265    DataVal av;
266    AsnTypePtr atp;
267    Boolean isError = FALSE;
268    AsnReadFunc func;
269    ParseActionPtr ptr;
270 
271    if (! loaded)
272    {
273       if (! objmacroAsnLoad()) {
274          return NULL;
275       }
276    }
277 
278    if (aip == NULL) {
279       return NULL;
280    }
281 
282    if (orig == NULL) {         /* ParseAction ::= (self contained) */
283       atp = AsnReadId(aip, amp, PARSE_ACTION);
284    } else {
285       atp = AsnLinkType(orig, PARSE_ACTION);
286    }
287    /* link in local tree */
288    if (atp == NULL) {
289       return NULL;
290    }
291 
292    ptr = ParseActionNew();
293    if (ptr == NULL) {
294       goto erret;
295    }
296    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
297       goto erret;
298    }
299 
300    atp = AsnReadId(aip,amp, atp);
301    func = NULL;
302 
303    if (atp == PARSE_ACTION_portion) {
304       ptr -> portion = TextPortionAsnRead(aip, atp);
305       if (aip -> io_failure) {
306          goto erret;
307       }
308       atp = AsnReadId(aip,amp, atp);
309    }
310    if (atp == PARSE_ACTION_src) {
311       ptr -> src = ParseSrcAsnRead(aip, atp);
312       if (aip -> io_failure) {
313          goto erret;
314       }
315       atp = AsnReadId(aip,amp, atp);
316    }
317    if (atp == PARSE_ACTION_dest) {
318       ptr -> dest = ParseDestAsnRead(aip, atp);
319       if (aip -> io_failure) {
320          goto erret;
321       }
322       atp = AsnReadId(aip,amp, atp);
323    }
324    if (atp == PARSE_ACTION_capitalization) {
325       if ( AsnReadVal(aip, atp, &av) <= 0) {
326          goto erret;
327       }
328       ptr -> capitalization = av.intvalue;
329       atp = AsnReadId(aip,amp, atp);
330    }
331    if (atp == PARSE_ACTION_remove_from_parsed) {
332       if ( AsnReadVal(aip, atp, &av) <= 0) {
333          goto erret;
334       }
335       ptr -> remove_from_parsed = av.boolvalue;
336       atp = AsnReadId(aip,amp, atp);
337    }
338    if (atp == PARSE_ACTION_existing_text) {
339       if ( AsnReadVal(aip, atp, &av) <= 0) {
340          goto erret;
341       }
342       ptr -> existing_text = av.intvalue;
343       atp = AsnReadId(aip,amp, atp);
344    }
345 
346    if (AsnReadVal(aip, atp, &av) <= 0) {
347       goto erret;
348    }
349    /* end struct */
350 
351 ret:
352    AsnUnlinkType(orig);       /* unlink local tree */
353    return ptr;
354 
355 erret:
356    aip -> io_failure = TRUE;
357    ptr = ParseActionFree(ptr);
358    goto ret;
359 }
360 
361 
362 
363 /**************************************************
364 *
365 *    ParseActionAsnWrite()
366 *
367 **************************************************/
368 NLM_EXTERN Boolean LIBCALL 
369 ParseActionAsnWrite(ParseActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
370 {
371    DataVal av;
372    AsnTypePtr atp;
373    Boolean retval = FALSE;
374 
375    if (! loaded)
376    {
377       if (! objmacroAsnLoad()) {
378          return FALSE;
379       }
380    }
381 
382    if (aip == NULL) {
383       return FALSE;
384    }
385 
386    atp = AsnLinkType(orig, PARSE_ACTION);   /* link local tree */
387    if (atp == NULL) {
388       return FALSE;
389    }
390 
391    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
392    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
393       goto erret;
394    }
395 
396    if (ptr -> portion != NULL) {
397       if ( ! TextPortionAsnWrite(ptr -> portion, aip, PARSE_ACTION_portion)) {
398          goto erret;
399       }
400    }
401    if (ptr -> src != NULL) {
402       if ( ! ParseSrcAsnWrite(ptr -> src, aip, PARSE_ACTION_src)) {
403          goto erret;
404       }
405    }
406    if (ptr -> dest != NULL) {
407       if ( ! ParseDestAsnWrite(ptr -> dest, aip, PARSE_ACTION_dest)) {
408          goto erret;
409       }
410    }
411    av.intvalue = ptr -> capitalization;
412    retval = AsnWrite(aip, PARSE_ACTION_capitalization,  &av);
413    av.boolvalue = ptr -> remove_from_parsed;
414    retval = AsnWrite(aip, PARSE_ACTION_remove_from_parsed,  &av);
415    av.intvalue = ptr -> existing_text;
416    retval = AsnWrite(aip, PARSE_ACTION_existing_text,  &av);
417    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
418       goto erret;
419    }
420    retval = TRUE;
421 
422 erret:
423    AsnUnlinkType(orig);       /* unlink local tree */
424    return retval;
425 }
426 
427 
428 
429 /**************************************************
430 *
431 *    MacroActionListFree()
432 *
433 **************************************************/
434 NLM_EXTERN 
435 MacroActionListPtr LIBCALL
436 MacroActionListFree(MacroActionListPtr ptr)
437 {
438 
439    if(ptr == NULL) {
440       return NULL;
441    }
442    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) MacroActionChoiceFree);
443    return NULL;
444 }
445 
446 
447 /**************************************************
448 *
449 *    MacroActionListAsnRead()
450 *
451 **************************************************/
452 NLM_EXTERN 
453 MacroActionListPtr LIBCALL
454 MacroActionListAsnRead(AsnIoPtr aip, AsnTypePtr orig)
455 {
456    DataVal av;
457    AsnTypePtr atp;
458    Boolean isError = FALSE;
459    AsnReadFunc func;
460    MacroActionListPtr ptr;
461 
462    if (! loaded)
463    {
464       if (! objmacroAsnLoad()) {
465          return NULL;
466       }
467    }
468 
469    if (aip == NULL) {
470       return NULL;
471    }
472 
473    if (orig == NULL) {         /* MacroActionList ::= (self contained) */
474       atp = AsnReadId(aip, amp, MACRO_ACTION_LIST);
475    } else {
476       atp = AsnLinkType(orig, MACRO_ACTION_LIST);
477    }
478    /* link in local tree */
479    if (atp == NULL) {
480       return NULL;
481    }
482 
483    func = NULL;
484 
485    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MacroActionChoiceAsnRead, (AsnOptFreeFunc) MacroActionChoiceFree);
486    if (isError && ptr  == NULL) {
487       goto erret;
488    }
489 
490 
491 
492 ret:
493    AsnUnlinkType(orig);       /* unlink local tree */
494    return ptr;
495 
496 erret:
497    aip -> io_failure = TRUE;
498    ptr = MacroActionListFree(ptr);
499    goto ret;
500 }
501 
502 
503 
504 /**************************************************
505 *
506 *    MacroActionListAsnWrite()
507 *
508 **************************************************/
509 NLM_EXTERN Boolean LIBCALL 
510 MacroActionListAsnWrite(MacroActionListPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
511 {
512    DataVal av;
513    AsnTypePtr atp;
514    Boolean retval = FALSE;
515 
516    if (! loaded)
517    {
518       if (! objmacroAsnLoad()) {
519          return FALSE;
520       }
521    }
522 
523    if (aip == NULL) {
524       return FALSE;
525    }
526 
527    atp = AsnLinkType(orig, MACRO_ACTION_LIST);   /* link local tree */
528    if (atp == NULL) {
529       return FALSE;
530    }
531 
532    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
533    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) MacroActionChoiceAsnWrite, aip, atp, MACRO_ACTION_LIST_E);
534    retval = TRUE;
535 
536 erret:
537    AsnUnlinkType(orig);       /* unlink local tree */
538    return retval;
539 }
540 
541 
542 
543 /**************************************************
544 *
545 *    StringConstraintNew()
546 *
547 **************************************************/
548 NLM_EXTERN 
549 StringConstraintPtr LIBCALL
550 StringConstraintNew(void)
551 {
552    StringConstraintPtr ptr = MemNew((size_t) sizeof(StringConstraint));
553 
554    ptr -> match_location = 1;
555    ptr -> case_sensitive = 0;
556    ptr -> whole_word = 0;
557    ptr -> not_present = 0;
558    return ptr;
559 
560 }
561 
562 
563 /**************************************************
564 *
565 *    StringConstraintFree()
566 *
567 **************************************************/
568 NLM_EXTERN 
569 StringConstraintPtr LIBCALL
570 StringConstraintFree(StringConstraintPtr ptr)
571 {
572 
573    if(ptr == NULL) {
574       return NULL;
575    }
576    MemFree(ptr -> match_text);
577    return MemFree(ptr);
578 }
579 
580 
581 /**************************************************
582 *
583 *    StringConstraintAsnRead()
584 *
585 **************************************************/
586 NLM_EXTERN 
587 StringConstraintPtr LIBCALL
588 StringConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
589 {
590    DataVal av;
591    AsnTypePtr atp;
592    Boolean isError = FALSE;
593    AsnReadFunc func;
594    StringConstraintPtr ptr;
595 
596    if (! loaded)
597    {
598       if (! objmacroAsnLoad()) {
599          return NULL;
600       }
601    }
602 
603    if (aip == NULL) {
604       return NULL;
605    }
606 
607    if (orig == NULL) {         /* StringConstraint ::= (self contained) */
608       atp = AsnReadId(aip, amp, STRING_CONSTRAINT);
609    } else {
610       atp = AsnLinkType(orig, STRING_CONSTRAINT);
611    }
612    /* link in local tree */
613    if (atp == NULL) {
614       return NULL;
615    }
616 
617    ptr = StringConstraintNew();
618    if (ptr == NULL) {
619       goto erret;
620    }
621    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
622       goto erret;
623    }
624 
625    atp = AsnReadId(aip,amp, atp);
626    func = NULL;
627 
628    if (atp == STRING_CONSTRAINT_match_text) {
629       if ( AsnReadVal(aip, atp, &av) <= 0) {
630          goto erret;
631       }
632       ptr -> match_text = av.ptrvalue;
633       atp = AsnReadId(aip,amp, atp);
634    }
635    if (atp == CONSTRAINT_match_location) {
636       if ( AsnReadVal(aip, atp, &av) <= 0) {
637          goto erret;
638       }
639       ptr -> match_location = av.intvalue;
640       atp = AsnReadId(aip,amp, atp);
641    }
642    if (atp == CONSTRAINT_case_sensitive) {
643       if ( AsnReadVal(aip, atp, &av) <= 0) {
644          goto erret;
645       }
646       ptr -> case_sensitive = av.boolvalue;
647       atp = AsnReadId(aip,amp, atp);
648    }
649    if (atp == STRING_CONSTRAINT_whole_word) {
650       if ( AsnReadVal(aip, atp, &av) <= 0) {
651          goto erret;
652       }
653       ptr -> whole_word = av.boolvalue;
654       atp = AsnReadId(aip,amp, atp);
655    }
656    if (atp == STRING_CONSTRAINT_not_present) {
657       if ( AsnReadVal(aip, atp, &av) <= 0) {
658          goto erret;
659       }
660       ptr -> not_present = av.boolvalue;
661       atp = AsnReadId(aip,amp, atp);
662    }
663 
664    if (AsnReadVal(aip, atp, &av) <= 0) {
665       goto erret;
666    }
667    /* end struct */
668 
669 ret:
670    AsnUnlinkType(orig);       /* unlink local tree */
671    return ptr;
672 
673 erret:
674    aip -> io_failure = TRUE;
675    ptr = StringConstraintFree(ptr);
676    goto ret;
677 }
678 
679 
680 
681 /**************************************************
682 *
683 *    StringConstraintAsnWrite()
684 *
685 **************************************************/
686 NLM_EXTERN Boolean LIBCALL 
687 StringConstraintAsnWrite(StringConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
688 {
689    DataVal av;
690    AsnTypePtr atp;
691    Boolean retval = FALSE;
692 
693    if (! loaded)
694    {
695       if (! objmacroAsnLoad()) {
696          return FALSE;
697       }
698    }
699 
700    if (aip == NULL) {
701       return FALSE;
702    }
703 
704    atp = AsnLinkType(orig, STRING_CONSTRAINT);   /* link local tree */
705    if (atp == NULL) {
706       return FALSE;
707    }
708 
709    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
710    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
711       goto erret;
712    }
713 
714    if (ptr -> match_text != NULL) {
715       av.ptrvalue = ptr -> match_text;
716       retval = AsnWrite(aip, STRING_CONSTRAINT_match_text,  &av);
717    }
718    av.intvalue = ptr -> match_location;
719    retval = AsnWrite(aip, CONSTRAINT_match_location,  &av);
720    av.boolvalue = ptr -> case_sensitive;
721    retval = AsnWrite(aip, CONSTRAINT_case_sensitive,  &av);
722    av.boolvalue = ptr -> whole_word;
723    retval = AsnWrite(aip, STRING_CONSTRAINT_whole_word,  &av);
724    av.boolvalue = ptr -> not_present;
725    retval = AsnWrite(aip, STRING_CONSTRAINT_not_present,  &av);
726    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
727       goto erret;
728    }
729    retval = TRUE;
730 
731 erret:
732    AsnUnlinkType(orig);       /* unlink local tree */
733    return retval;
734 }
735 
736 
737 
738 /**************************************************
739 *
740 *    LocationConstraintNew()
741 *
742 **************************************************/
743 NLM_EXTERN 
744 LocationConstraintPtr LIBCALL
745 LocationConstraintNew(void)
746 {
747    LocationConstraintPtr ptr = MemNew((size_t) sizeof(LocationConstraint));
748 
749    ptr -> strand = 0;
750    ptr -> seq_type = 0;
751    ptr -> partial5 = 0;
752    ptr -> partial3 = 0;
753    return ptr;
754 
755 }
756 
757 
758 /**************************************************
759 *
760 *    LocationConstraintFree()
761 *
762 **************************************************/
763 NLM_EXTERN 
764 LocationConstraintPtr LIBCALL
765 LocationConstraintFree(LocationConstraintPtr ptr)
766 {
767 
768    if(ptr == NULL) {
769       return NULL;
770    }
771    return MemFree(ptr);
772 }
773 
774 
775 /**************************************************
776 *
777 *    LocationConstraintAsnRead()
778 *
779 **************************************************/
780 NLM_EXTERN 
781 LocationConstraintPtr LIBCALL
782 LocationConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
783 {
784    DataVal av;
785    AsnTypePtr atp;
786    Boolean isError = FALSE;
787    AsnReadFunc func;
788    LocationConstraintPtr ptr;
789 
790    if (! loaded)
791    {
792       if (! objmacroAsnLoad()) {
793          return NULL;
794       }
795    }
796 
797    if (aip == NULL) {
798       return NULL;
799    }
800 
801    if (orig == NULL) {         /* LocationConstraint ::= (self contained) */
802       atp = AsnReadId(aip, amp, LOCATION_CONSTRAINT);
803    } else {
804       atp = AsnLinkType(orig, LOCATION_CONSTRAINT);
805    }
806    /* link in local tree */
807    if (atp == NULL) {
808       return NULL;
809    }
810 
811    ptr = LocationConstraintNew();
812    if (ptr == NULL) {
813       goto erret;
814    }
815    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
816       goto erret;
817    }
818 
819    atp = AsnReadId(aip,amp, atp);
820    func = NULL;
821 
822    if (atp == LOCATION_CONSTRAINT_strand) {
823       if ( AsnReadVal(aip, atp, &av) <= 0) {
824          goto erret;
825       }
826       ptr -> strand = av.intvalue;
827       atp = AsnReadId(aip,amp, atp);
828    }
829    if (atp == LOCATION_CONSTRAINT_seq_type) {
830       if ( AsnReadVal(aip, atp, &av) <= 0) {
831          goto erret;
832       }
833       ptr -> seq_type = av.intvalue;
834       atp = AsnReadId(aip,amp, atp);
835    }
836    if (atp == LOCATION_CONSTRAINT_partial5) {
837       if ( AsnReadVal(aip, atp, &av) <= 0) {
838          goto erret;
839       }
840       ptr -> partial5 = av.intvalue;
841       atp = AsnReadId(aip,amp, atp);
842    }
843    if (atp == LOCATION_CONSTRAINT_partial3) {
844       if ( AsnReadVal(aip, atp, &av) <= 0) {
845          goto erret;
846       }
847       ptr -> partial3 = av.intvalue;
848       atp = AsnReadId(aip,amp, atp);
849    }
850 
851    if (AsnReadVal(aip, atp, &av) <= 0) {
852       goto erret;
853    }
854    /* end struct */
855 
856 ret:
857    AsnUnlinkType(orig);       /* unlink local tree */
858    return ptr;
859 
860 erret:
861    aip -> io_failure = TRUE;
862    ptr = LocationConstraintFree(ptr);
863    goto ret;
864 }
865 
866 
867 
868 /**************************************************
869 *
870 *    LocationConstraintAsnWrite()
871 *
872 **************************************************/
873 NLM_EXTERN Boolean LIBCALL 
874 LocationConstraintAsnWrite(LocationConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
875 {
876    DataVal av;
877    AsnTypePtr atp;
878    Boolean retval = FALSE;
879 
880    if (! loaded)
881    {
882       if (! objmacroAsnLoad()) {
883          return FALSE;
884       }
885    }
886 
887    if (aip == NULL) {
888       return FALSE;
889    }
890 
891    atp = AsnLinkType(orig, LOCATION_CONSTRAINT);   /* link local tree */
892    if (atp == NULL) {
893       return FALSE;
894    }
895 
896    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
897    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
898       goto erret;
899    }
900 
901    av.intvalue = ptr -> strand;
902    retval = AsnWrite(aip, LOCATION_CONSTRAINT_strand,  &av);
903    av.intvalue = ptr -> seq_type;
904    retval = AsnWrite(aip, LOCATION_CONSTRAINT_seq_type,  &av);
905    av.intvalue = ptr -> partial5;
906    retval = AsnWrite(aip, LOCATION_CONSTRAINT_partial5,  &av);
907    av.intvalue = ptr -> partial3;
908    retval = AsnWrite(aip, LOCATION_CONSTRAINT_partial3,  &av);
909    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
910       goto erret;
911    }
912    retval = TRUE;
913 
914 erret:
915    AsnUnlinkType(orig);       /* unlink local tree */
916    return retval;
917 }
918 
919 
920 
921 /**************************************************
922 *
923 *    FeatQualLegalValNew()
924 *
925 **************************************************/
926 NLM_EXTERN 
927 FeatQualLegalValPtr LIBCALL
928 FeatQualLegalValNew(void)
929 {
930    FeatQualLegalValPtr ptr = MemNew((size_t) sizeof(FeatQualLegalVal));
931 
932    return ptr;
933 
934 }
935 
936 
937 /**************************************************
938 *
939 *    FeatQualLegalValFree()
940 *
941 **************************************************/
942 NLM_EXTERN 
943 FeatQualLegalValPtr LIBCALL
944 FeatQualLegalValFree(FeatQualLegalValPtr ptr)
945 {
946 
947    if(ptr == NULL) {
948       return NULL;
949    }
950    MemFree(ptr -> val);
951    return MemFree(ptr);
952 }
953 
954 
955 /**************************************************
956 *
957 *    FeatQualLegalValAsnRead()
958 *
959 **************************************************/
960 NLM_EXTERN 
961 FeatQualLegalValPtr LIBCALL
962 FeatQualLegalValAsnRead(AsnIoPtr aip, AsnTypePtr orig)
963 {
964    DataVal av;
965    AsnTypePtr atp;
966    Boolean isError = FALSE;
967    AsnReadFunc func;
968    FeatQualLegalValPtr ptr;
969 
970    if (! loaded)
971    {
972       if (! objmacroAsnLoad()) {
973          return NULL;
974       }
975    }
976 
977    if (aip == NULL) {
978       return NULL;
979    }
980 
981    if (orig == NULL) {         /* FeatQualLegalVal ::= (self contained) */
982       atp = AsnReadId(aip, amp, FEAT_QUAL_LEGAL_VAL);
983    } else {
984       atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL);
985    }
986    /* link in local tree */
987    if (atp == NULL) {
988       return NULL;
989    }
990 
991    ptr = FeatQualLegalValNew();
992    if (ptr == NULL) {
993       goto erret;
994    }
995    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
996       goto erret;
997    }
998 
999    atp = AsnReadId(aip,amp, atp);
1000    func = NULL;
1001 
1002    if (atp == FEAT_QUAL_LEGAL_VAL_qual) {
1003       if ( AsnReadVal(aip, atp, &av) <= 0) {
1004          goto erret;
1005       }
1006       ptr -> qual = av.intvalue;
1007       atp = AsnReadId(aip,amp, atp);
1008    }
1009    if (atp == FEAT_QUAL_LEGAL_VAL_val) {
1010       if ( AsnReadVal(aip, atp, &av) <= 0) {
1011          goto erret;
1012       }
1013       ptr -> val = av.ptrvalue;
1014       atp = AsnReadId(aip,amp, atp);
1015    }
1016 
1017    if (AsnReadVal(aip, atp, &av) <= 0) {
1018       goto erret;
1019    }
1020    /* end struct */
1021 
1022 ret:
1023    AsnUnlinkType(orig);       /* unlink local tree */
1024    return ptr;
1025 
1026 erret:
1027    aip -> io_failure = TRUE;
1028    ptr = FeatQualLegalValFree(ptr);
1029    goto ret;
1030 }
1031 
1032 
1033 
1034 /**************************************************
1035 *
1036 *    FeatQualLegalValAsnWrite()
1037 *
1038 **************************************************/
1039 NLM_EXTERN Boolean LIBCALL 
1040 FeatQualLegalValAsnWrite(FeatQualLegalValPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1041 {
1042    DataVal av;
1043    AsnTypePtr atp;
1044    Boolean retval = FALSE;
1045 
1046    if (! loaded)
1047    {
1048       if (! objmacroAsnLoad()) {
1049          return FALSE;
1050       }
1051    }
1052 
1053    if (aip == NULL) {
1054       return FALSE;
1055    }
1056 
1057    atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL);   /* link local tree */
1058    if (atp == NULL) {
1059       return FALSE;
1060    }
1061 
1062    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1063    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1064       goto erret;
1065    }
1066 
1067    av.intvalue = ptr -> qual;
1068    retval = AsnWrite(aip, FEAT_QUAL_LEGAL_VAL_qual,  &av);
1069    if (ptr -> val != NULL) {
1070       av.ptrvalue = ptr -> val;
1071       retval = AsnWrite(aip, FEAT_QUAL_LEGAL_VAL_val,  &av);
1072    }
1073    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1074       goto erret;
1075    }
1076    retval = TRUE;
1077 
1078 erret:
1079    AsnUnlinkType(orig);       /* unlink local tree */
1080    return retval;
1081 }
1082 
1083 
1084 
1085 /**************************************************
1086 *
1087 *    FeatQualLegalValChoiceFree()
1088 *
1089 **************************************************/
1090 NLM_EXTERN 
1091 FeatQualLegalValChoicePtr LIBCALL
1092 FeatQualLegalValChoiceFree(ValNodePtr anp)
1093 {
1094    Pointer pnt;
1095 
1096    if (anp == NULL) {
1097       return NULL;
1098    }
1099 
1100    pnt = anp->data.ptrvalue;
1101    switch (anp->choice)
1102    {
1103    default:
1104       break;
1105    case FeatQualLegalValChoice_qual:
1106       FeatQualLegalValFree(anp -> data.ptrvalue);
1107       break;
1108    }
1109    return MemFree(anp);
1110 }
1111 
1112 
1113 /**************************************************
1114 *
1115 *    FeatQualLegalValChoiceAsnRead()
1116 *
1117 **************************************************/
1118 NLM_EXTERN 
1119 FeatQualLegalValChoicePtr LIBCALL
1120 FeatQualLegalValChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1121 {
1122    DataVal av;
1123    AsnTypePtr atp;
1124    ValNodePtr anp;
1125    Uint1 choice;
1126    Boolean isError = FALSE;
1127    Boolean nullIsError = FALSE;
1128    AsnReadFunc func;
1129 
1130    if (! loaded)
1131    {
1132       if (! objmacroAsnLoad()) {
1133          return NULL;
1134       }
1135    }
1136 
1137    if (aip == NULL) {
1138       return NULL;
1139    }
1140 
1141    if (orig == NULL) {         /* FeatQualLegalValChoice ::= (self contained) */
1142       atp = AsnReadId(aip, amp, FEAT_QUAL_LEGAL_VAL_CHOICE);
1143    } else {
1144       atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL_CHOICE);    /* link in local tree */
1145    }
1146    if (atp == NULL) {
1147       return NULL;
1148    }
1149 
1150    anp = ValNodeNew(NULL);
1151    if (anp == NULL) {
1152       goto erret;
1153    }
1154    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1155       goto erret;
1156    }
1157 
1158    func = NULL;
1159 
1160    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1161    if (atp == NULL) {
1162       goto erret;
1163    }
1164    if (atp == FEAT_QUAL_LEGAL_VAL_CHOICE_qual) {
1165       choice = FeatQualLegalValChoice_qual;
1166       func = (AsnReadFunc) FeatQualLegalValAsnRead;
1167    }
1168    anp->choice = choice;
1169    if (func != NULL)
1170    {
1171       anp->data.ptrvalue = (* func)(aip, atp);
1172       if (aip -> io_failure) goto erret;
1173 
1174       if (nullIsError && anp->data.ptrvalue == NULL) {
1175          goto erret;
1176       }
1177    }
1178 
1179 ret:
1180    AsnUnlinkType(orig);       /* unlink local tree */
1181    return anp;
1182 
1183 erret:
1184    anp = MemFree(anp);
1185    aip -> io_failure = TRUE;
1186    goto ret;
1187 }
1188 
1189 
1190 /**************************************************
1191 *
1192 *    FeatQualLegalValChoiceAsnWrite()
1193 *
1194 **************************************************/
1195 NLM_EXTERN Boolean LIBCALL 
1196 FeatQualLegalValChoiceAsnWrite(FeatQualLegalValChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
1197 
1198 {
1199    DataVal av;
1200    AsnTypePtr atp, writetype = NULL;
1201    Pointer pnt;
1202    AsnWriteFunc func = NULL;
1203    Boolean retval = FALSE;
1204 
1205    if (! loaded)
1206    {
1207       if (! objmacroAsnLoad())
1208       return FALSE;
1209    }
1210 
1211    if (aip == NULL)
1212    return FALSE;
1213 
1214    atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL_CHOICE);   /* link local tree */
1215    if (atp == NULL) {
1216       return FALSE;
1217    }
1218 
1219    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1220 
1221    av.ptrvalue = (Pointer)anp;
1222    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1223       goto erret;
1224    }
1225 
1226    pnt = anp->data.ptrvalue;
1227    switch (anp->choice)
1228    {
1229    case FeatQualLegalValChoice_qual:
1230       writetype = FEAT_QUAL_LEGAL_VAL_CHOICE_qual;
1231       func = (AsnWriteFunc) FeatQualLegalValAsnWrite;
1232       break;
1233    }
1234    if (writetype != NULL) {
1235       retval = (* func)(pnt, aip, writetype);   /* write it out */
1236    }
1237    if (!retval) {
1238       goto erret;
1239    }
1240    retval = TRUE;
1241 
1242 erret:
1243    AsnUnlinkType(orig);       /* unlink local tree */
1244    return retval;
1245 }
1246 
1247 
1248 /**************************************************
1249 *
1250 *    FeatQualLegalSetFree()
1251 *
1252 **************************************************/
1253 NLM_EXTERN 
1254 FeatQualLegalSetPtr LIBCALL
1255 FeatQualLegalSetFree(FeatQualLegalSetPtr ptr)
1256 {
1257 
1258    if(ptr == NULL) {
1259       return NULL;
1260    }
1261    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) FeatQualLegalValChoiceFree);
1262    return NULL;
1263 }
1264 
1265 
1266 /**************************************************
1267 *
1268 *    FeatQualLegalSetAsnRead()
1269 *
1270 **************************************************/
1271 NLM_EXTERN 
1272 FeatQualLegalSetPtr LIBCALL
1273 FeatQualLegalSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1274 {
1275    DataVal av;
1276    AsnTypePtr atp;
1277    Boolean isError = FALSE;
1278    AsnReadFunc func;
1279    FeatQualLegalSetPtr ptr;
1280 
1281    if (! loaded)
1282    {
1283       if (! objmacroAsnLoad()) {
1284          return NULL;
1285       }
1286    }
1287 
1288    if (aip == NULL) {
1289       return NULL;
1290    }
1291 
1292    if (orig == NULL) {         /* FeatQualLegalSet ::= (self contained) */
1293       atp = AsnReadId(aip, amp, FEAT_QUAL_LEGAL_SET);
1294    } else {
1295       atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_SET);
1296    }
1297    /* link in local tree */
1298    if (atp == NULL) {
1299       return NULL;
1300    }
1301 
1302    func = NULL;
1303 
1304    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) FeatQualLegalValChoiceAsnRead, (AsnOptFreeFunc) FeatQualLegalValChoiceFree);
1305    if (isError && ptr  == NULL) {
1306       goto erret;
1307    }
1308 
1309 
1310 
1311 ret:
1312    AsnUnlinkType(orig);       /* unlink local tree */
1313    return ptr;
1314 
1315 erret:
1316    aip -> io_failure = TRUE;
1317    ptr = FeatQualLegalSetFree(ptr);
1318    goto ret;
1319 }
1320 
1321 
1322 
1323 /**************************************************
1324 *
1325 *    FeatQualLegalSetAsnWrite()
1326 *
1327 **************************************************/
1328 NLM_EXTERN Boolean LIBCALL 
1329 FeatQualLegalSetAsnWrite(FeatQualLegalSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1330 {
1331    DataVal av;
1332    AsnTypePtr atp;
1333    Boolean retval = FALSE;
1334 
1335    if (! loaded)
1336    {
1337       if (! objmacroAsnLoad()) {
1338          return FALSE;
1339       }
1340    }
1341 
1342    if (aip == NULL) {
1343       return FALSE;
1344    }
1345 
1346    atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_SET);   /* link local tree */
1347    if (atp == NULL) {
1348       return FALSE;
1349    }
1350 
1351    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1352    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) FeatQualLegalValChoiceAsnWrite, aip, atp, FEAT_QUAL_LEGAL_SET_E);
1353    retval = TRUE;
1354 
1355 erret:
1356    AsnUnlinkType(orig);       /* unlink local tree */
1357    return retval;
1358 }
1359 
1360 
1361 
1362 /**************************************************
1363 *
1364 *    FeatQualChoiceFree()
1365 *
1366 **************************************************/
1367 NLM_EXTERN 
1368 FeatQualChoicePtr LIBCALL
1369 FeatQualChoiceFree(ValNodePtr anp)
1370 {
1371    Pointer pnt;
1372 
1373    if (anp == NULL) {
1374       return NULL;
1375    }
1376 
1377    pnt = anp->data.ptrvalue;
1378    switch (anp->choice)
1379    {
1380    default:
1381       break;
1382    case FeatQualChoice_illegal_qual:
1383       StringConstraintFree(anp -> data.ptrvalue);
1384       break;
1385    }
1386    return MemFree(anp);
1387 }
1388 
1389 
1390 /**************************************************
1391 *
1392 *    FeatQualChoiceAsnRead()
1393 *
1394 **************************************************/
1395 NLM_EXTERN 
1396 FeatQualChoicePtr LIBCALL
1397 FeatQualChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1398 {
1399    DataVal av;
1400    AsnTypePtr atp;
1401    ValNodePtr anp;
1402    Uint1 choice;
1403    Boolean isError = FALSE;
1404    Boolean nullIsError = FALSE;
1405    AsnReadFunc func;
1406 
1407    if (! loaded)
1408    {
1409       if (! objmacroAsnLoad()) {
1410          return NULL;
1411       }
1412    }
1413 
1414    if (aip == NULL) {
1415       return NULL;
1416    }
1417 
1418    if (orig == NULL) {         /* FeatQualChoice ::= (self contained) */
1419       atp = AsnReadId(aip, amp, FEAT_QUAL_CHOICE);
1420    } else {
1421       atp = AsnLinkType(orig, FEAT_QUAL_CHOICE);    /* link in local tree */
1422    }
1423    if (atp == NULL) {
1424       return NULL;
1425    }
1426 
1427    anp = ValNodeNew(NULL);
1428    if (anp == NULL) {
1429       goto erret;
1430    }
1431    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1432       goto erret;
1433    }
1434 
1435    func = NULL;
1436 
1437    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1438    if (atp == NULL) {
1439       goto erret;
1440    }
1441    if (atp == FEAT_QUAL_CHOICE_legal_qual) {
1442       choice = FeatQualChoice_legal_qual;
1443       if (AsnReadVal(aip, atp, &av) <= 0) {
1444          goto erret;
1445       }
1446       anp->data.intvalue = av.intvalue;
1447    }
1448    else if (atp == FEAT_QUAL_CHOICE_illegal_qual) {
1449       choice = FeatQualChoice_illegal_qual;
1450       func = (AsnReadFunc) StringConstraintAsnRead;
1451    }
1452    anp->choice = choice;
1453    if (func != NULL)
1454    {
1455       anp->data.ptrvalue = (* func)(aip, atp);
1456       if (aip -> io_failure) goto erret;
1457 
1458       if (nullIsError && anp->data.ptrvalue == NULL) {
1459          goto erret;
1460       }
1461    }
1462 
1463 ret:
1464    AsnUnlinkType(orig);       /* unlink local tree */
1465    return anp;
1466 
1467 erret:
1468    anp = MemFree(anp);
1469    aip -> io_failure = TRUE;
1470    goto ret;
1471 }
1472 
1473 
1474 /**************************************************
1475 *
1476 *    FeatQualChoiceAsnWrite()
1477 *
1478 **************************************************/
1479 NLM_EXTERN Boolean LIBCALL 
1480 FeatQualChoiceAsnWrite(FeatQualChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
1481 
1482 {
1483    DataVal av;
1484    AsnTypePtr atp, writetype = NULL;
1485    Pointer pnt;
1486    AsnWriteFunc func = NULL;
1487    Boolean retval = FALSE;
1488 
1489    if (! loaded)
1490    {
1491       if (! objmacroAsnLoad())
1492       return FALSE;
1493    }
1494 
1495    if (aip == NULL)
1496    return FALSE;
1497 
1498    atp = AsnLinkType(orig, FEAT_QUAL_CHOICE);   /* link local tree */
1499    if (atp == NULL) {
1500       return FALSE;
1501    }
1502 
1503    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1504 
1505    av.ptrvalue = (Pointer)anp;
1506    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1507       goto erret;
1508    }
1509 
1510    pnt = anp->data.ptrvalue;
1511    switch (anp->choice)
1512    {
1513    case FeatQualChoice_legal_qual:
1514       av.intvalue = anp->data.intvalue;
1515       retval = AsnWrite(aip, FEAT_QUAL_CHOICE_legal_qual, &av);
1516       break;
1517    case FeatQualChoice_illegal_qual:
1518       writetype = FEAT_QUAL_CHOICE_illegal_qual;
1519       func = (AsnWriteFunc) StringConstraintAsnWrite;
1520       break;
1521    }
1522    if (writetype != NULL) {
1523       retval = (* func)(pnt, aip, writetype);   /* write it out */
1524    }
1525    if (!retval) {
1526       goto erret;
1527    }
1528    retval = TRUE;
1529 
1530 erret:
1531    AsnUnlinkType(orig);       /* unlink local tree */
1532    return retval;
1533 }
1534 
1535 
1536 /**************************************************
1537 *
1538 *    FeatureFieldNew()
1539 *
1540 **************************************************/
1541 NLM_EXTERN 
1542 FeatureFieldPtr LIBCALL
1543 FeatureFieldNew(void)
1544 {
1545    FeatureFieldPtr ptr = MemNew((size_t) sizeof(FeatureField));
1546 
1547    return ptr;
1548 
1549 }
1550 
1551 
1552 /**************************************************
1553 *
1554 *    FeatureFieldFree()
1555 *
1556 **************************************************/
1557 NLM_EXTERN 
1558 FeatureFieldPtr LIBCALL
1559 FeatureFieldFree(FeatureFieldPtr ptr)
1560 {
1561 
1562    if(ptr == NULL) {
1563       return NULL;
1564    }
1565    FeatQualChoiceFree(ptr -> field);
1566    return MemFree(ptr);
1567 }
1568 
1569 
1570 /**************************************************
1571 *
1572 *    FeatureFieldAsnRead()
1573 *
1574 **************************************************/
1575 NLM_EXTERN 
1576 FeatureFieldPtr LIBCALL
1577 FeatureFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1578 {
1579    DataVal av;
1580    AsnTypePtr atp;
1581    Boolean isError = FALSE;
1582    AsnReadFunc func;
1583    FeatureFieldPtr ptr;
1584 
1585    if (! loaded)
1586    {
1587       if (! objmacroAsnLoad()) {
1588          return NULL;
1589       }
1590    }
1591 
1592    if (aip == NULL) {
1593       return NULL;
1594    }
1595 
1596    if (orig == NULL) {         /* FeatureField ::= (self contained) */
1597       atp = AsnReadId(aip, amp, FEATURE_FIELD);
1598    } else {
1599       atp = AsnLinkType(orig, FEATURE_FIELD);
1600    }
1601    /* link in local tree */
1602    if (atp == NULL) {
1603       return NULL;
1604    }
1605 
1606    ptr = FeatureFieldNew();
1607    if (ptr == NULL) {
1608       goto erret;
1609    }
1610    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1611       goto erret;
1612    }
1613 
1614    atp = AsnReadId(aip,amp, atp);
1615    func = NULL;
1616 
1617    if (atp == FEATURE_FIELD_type) {
1618       if ( AsnReadVal(aip, atp, &av) <= 0) {
1619          goto erret;
1620       }
1621       ptr -> type = av.intvalue;
1622       atp = AsnReadId(aip,amp, atp);
1623    }
1624    if (atp == FEATURE_FIELD_field) {
1625       ptr -> field = FeatQualChoiceAsnRead(aip, atp);
1626       if (aip -> io_failure) {
1627          goto erret;
1628       }
1629       atp = AsnReadId(aip,amp, atp);
1630    }
1631 
1632    if (AsnReadVal(aip, atp, &av) <= 0) {
1633       goto erret;
1634    }
1635    /* end struct */
1636 
1637 ret:
1638    AsnUnlinkType(orig);       /* unlink local tree */
1639    return ptr;
1640 
1641 erret:
1642    aip -> io_failure = TRUE;
1643    ptr = FeatureFieldFree(ptr);
1644    goto ret;
1645 }
1646 
1647 
1648 
1649 /**************************************************
1650 *
1651 *    FeatureFieldAsnWrite()
1652 *
1653 **************************************************/
1654 NLM_EXTERN Boolean LIBCALL 
1655 FeatureFieldAsnWrite(FeatureFieldPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1656 {
1657    DataVal av;
1658    AsnTypePtr atp;
1659    Boolean retval = FALSE;
1660 
1661    if (! loaded)
1662    {
1663       if (! objmacroAsnLoad()) {
1664          return FALSE;
1665       }
1666    }
1667 
1668    if (aip == NULL) {
1669       return FALSE;
1670    }
1671 
1672    atp = AsnLinkType(orig, FEATURE_FIELD);   /* link local tree */
1673    if (atp == NULL) {
1674       return FALSE;
1675    }
1676 
1677    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1678    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1679       goto erret;
1680    }
1681 
1682    av.intvalue = ptr -> type;
1683    retval = AsnWrite(aip, FEATURE_FIELD_type,  &av);
1684    if (ptr -> field != NULL) {
1685       if ( ! FeatQualChoiceAsnWrite(ptr -> field, aip, FEATURE_FIELD_field)) {
1686          goto erret;
1687       }
1688    }
1689    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1690       goto erret;
1691    }
1692    retval = TRUE;
1693 
1694 erret:
1695    AsnUnlinkType(orig);       /* unlink local tree */
1696    return retval;
1697 }
1698 
1699 
1700 
1701 /**************************************************
1702 *
1703 *    FeatureFieldLegalNew()
1704 *
1705 **************************************************/
1706 NLM_EXTERN 
1707 FeatureFieldLegalPtr LIBCALL
1708 FeatureFieldLegalNew(void)
1709 {
1710    FeatureFieldLegalPtr ptr = MemNew((size_t) sizeof(FeatureFieldLegal));
1711 
1712    return ptr;
1713 
1714 }
1715 
1716 
1717 /**************************************************
1718 *
1719 *    FeatureFieldLegalFree()
1720 *
1721 **************************************************/
1722 NLM_EXTERN 
1723 FeatureFieldLegalPtr LIBCALL
1724 FeatureFieldLegalFree(FeatureFieldLegalPtr ptr)
1725 {
1726 
1727    if(ptr == NULL) {
1728       return NULL;
1729    }
1730    return MemFree(ptr);
1731 }
1732 
1733 
1734 /**************************************************
1735 *
1736 *    FeatureFieldLegalAsnRead()
1737 *
1738 **************************************************/
1739 NLM_EXTERN 
1740 FeatureFieldLegalPtr LIBCALL
1741 FeatureFieldLegalAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1742 {
1743    DataVal av;
1744    AsnTypePtr atp;
1745    Boolean isError = FALSE;
1746    AsnReadFunc func;
1747    FeatureFieldLegalPtr ptr;
1748 
1749    if (! loaded)
1750    {
1751       if (! objmacroAsnLoad()) {
1752          return NULL;
1753       }
1754    }
1755 
1756    if (aip == NULL) {
1757       return NULL;
1758    }
1759 
1760    if (orig == NULL) {         /* FeatureFieldLegal ::= (self contained) */
1761       atp = AsnReadId(aip, amp, FEATURE_FIELD_LEGAL);
1762    } else {
1763       atp = AsnLinkType(orig, FEATURE_FIELD_LEGAL);
1764    }
1765    /* link in local tree */
1766    if (atp == NULL) {
1767       return NULL;
1768    }
1769 
1770    ptr = FeatureFieldLegalNew();
1771    if (ptr == NULL) {
1772       goto erret;
1773    }
1774    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1775       goto erret;
1776    }
1777 
1778    atp = AsnReadId(aip,amp, atp);
1779    func = NULL;
1780 
1781    if (atp == FEATURE_FIELD_LEGAL_type) {
1782       if ( AsnReadVal(aip, atp, &av) <= 0) {
1783          goto erret;
1784       }
1785       ptr -> type = av.intvalue;
1786       atp = AsnReadId(aip,amp, atp);
1787    }
1788    if (atp == FEATURE_FIELD_LEGAL_field) {
1789       if ( AsnReadVal(aip, atp, &av) <= 0) {
1790          goto erret;
1791       }
1792       ptr -> field = av.intvalue;
1793       atp = AsnReadId(aip,amp, atp);
1794    }
1795 
1796    if (AsnReadVal(aip, atp, &av) <= 0) {
1797       goto erret;
1798    }
1799    /* end struct */
1800 
1801 ret:
1802    AsnUnlinkType(orig);       /* unlink local tree */
1803    return ptr;
1804 
1805 erret:
1806    aip -> io_failure = TRUE;
1807    ptr = FeatureFieldLegalFree(ptr);
1808    goto ret;
1809 }
1810 
1811 
1812 
1813 /**************************************************
1814 *
1815 *    FeatureFieldLegalAsnWrite()
1816 *
1817 **************************************************/
1818 NLM_EXTERN Boolean LIBCALL 
1819 FeatureFieldLegalAsnWrite(FeatureFieldLegalPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1820 {
1821    DataVal av;
1822    AsnTypePtr atp;
1823    Boolean retval = FALSE;
1824 
1825    if (! loaded)
1826    {
1827       if (! objmacroAsnLoad()) {
1828          return FALSE;
1829       }
1830    }
1831 
1832    if (aip == NULL) {
1833       return FALSE;
1834    }
1835 
1836    atp = AsnLinkType(orig, FEATURE_FIELD_LEGAL);   /* link local tree */
1837    if (atp == NULL) {
1838       return FALSE;
1839    }
1840 
1841    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1842    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1843       goto erret;
1844    }
1845 
1846    av.intvalue = ptr -> type;
1847    retval = AsnWrite(aip, FEATURE_FIELD_LEGAL_type,  &av);
1848    av.intvalue = ptr -> field;
1849    retval = AsnWrite(aip, FEATURE_FIELD_LEGAL_field,  &av);
1850    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1851       goto erret;
1852    }
1853    retval = TRUE;
1854 
1855 erret:
1856    AsnUnlinkType(orig);       /* unlink local tree */
1857    return retval;
1858 }
1859 
1860 
1861 
1862 /**************************************************
1863 *
1864 *    FeatureFieldPairNew()
1865 *
1866 **************************************************/
1867 NLM_EXTERN 
1868 FeatureFieldPairPtr LIBCALL
1869 FeatureFieldPairNew(void)
1870 {
1871    FeatureFieldPairPtr ptr = MemNew((size_t) sizeof(FeatureFieldPair));
1872 
1873    return ptr;
1874 
1875 }
1876 
1877 
1878 /**************************************************
1879 *
1880 *    FeatureFieldPairFree()
1881 *
1882 **************************************************/
1883 NLM_EXTERN 
1884 FeatureFieldPairPtr LIBCALL
1885 FeatureFieldPairFree(FeatureFieldPairPtr ptr)
1886 {
1887 
1888    if(ptr == NULL) {
1889       return NULL;
1890    }
1891    FeatQualChoiceFree(ptr -> field_from);
1892    FeatQualChoiceFree(ptr -> field_to);
1893    return MemFree(ptr);
1894 }
1895 
1896 
1897 /**************************************************
1898 *
1899 *    FeatureFieldPairAsnRead()
1900 *
1901 **************************************************/
1902 NLM_EXTERN 
1903 FeatureFieldPairPtr LIBCALL
1904 FeatureFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1905 {
1906    DataVal av;
1907    AsnTypePtr atp;
1908    Boolean isError = FALSE;
1909    AsnReadFunc func;
1910    FeatureFieldPairPtr ptr;
1911 
1912    if (! loaded)
1913    {
1914       if (! objmacroAsnLoad()) {
1915          return NULL;
1916       }
1917    }
1918 
1919    if (aip == NULL) {
1920       return NULL;
1921    }
1922 
1923    if (orig == NULL) {         /* FeatureFieldPair ::= (self contained) */
1924       atp = AsnReadId(aip, amp, FEATURE_FIELD_PAIR);
1925    } else {
1926       atp = AsnLinkType(orig, FEATURE_FIELD_PAIR);
1927    }
1928    /* link in local tree */
1929    if (atp == NULL) {
1930       return NULL;
1931    }
1932 
1933    ptr = FeatureFieldPairNew();
1934    if (ptr == NULL) {
1935       goto erret;
1936    }
1937    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1938       goto erret;
1939    }
1940 
1941    atp = AsnReadId(aip,amp, atp);
1942    func = NULL;
1943 
1944    if (atp == FEATURE_FIELD_PAIR_type) {
1945       if ( AsnReadVal(aip, atp, &av) <= 0) {
1946          goto erret;
1947       }
1948       ptr -> type = av.intvalue;
1949       atp = AsnReadId(aip,amp, atp);
1950    }
1951    if (atp == FEATURE_FIELD_PAIR_field_from) {
1952       ptr -> field_from = FeatQualChoiceAsnRead(aip, atp);
1953       if (aip -> io_failure) {
1954          goto erret;
1955       }
1956       atp = AsnReadId(aip,amp, atp);
1957    }
1958    if (atp == FEATURE_FIELD_PAIR_field_to) {
1959       ptr -> field_to = FeatQualChoiceAsnRead(aip, atp);
1960       if (aip -> io_failure) {
1961          goto erret;
1962       }
1963       atp = AsnReadId(aip,amp, atp);
1964    }
1965 
1966    if (AsnReadVal(aip, atp, &av) <= 0) {
1967       goto erret;
1968    }
1969    /* end struct */
1970 
1971 ret:
1972    AsnUnlinkType(orig);       /* unlink local tree */
1973    return ptr;
1974 
1975 erret:
1976    aip -> io_failure = TRUE;
1977    ptr = FeatureFieldPairFree(ptr);
1978    goto ret;
1979 }
1980 
1981 
1982 
1983 /**************************************************
1984 *
1985 *    FeatureFieldPairAsnWrite()
1986 *
1987 **************************************************/
1988 NLM_EXTERN Boolean LIBCALL 
1989 FeatureFieldPairAsnWrite(FeatureFieldPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1990 {
1991    DataVal av;
1992    AsnTypePtr atp;
1993    Boolean retval = FALSE;
1994 
1995    if (! loaded)
1996    {
1997       if (! objmacroAsnLoad()) {
1998          return FALSE;
1999       }
2000    }
2001 
2002    if (aip == NULL) {
2003       return FALSE;
2004    }
2005 
2006    atp = AsnLinkType(orig, FEATURE_FIELD_PAIR);   /* link local tree */
2007    if (atp == NULL) {
2008       return FALSE;
2009    }
2010 
2011    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2012    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2013       goto erret;
2014    }
2015 
2016    av.intvalue = ptr -> type;
2017    retval = AsnWrite(aip, FEATURE_FIELD_PAIR_type,  &av);
2018    if (ptr -> field_from != NULL) {
2019       if ( ! FeatQualChoiceAsnWrite(ptr -> field_from, aip, FEATURE_FIELD_PAIR_field_from)) {
2020          goto erret;
2021       }
2022    }
2023    if (ptr -> field_to != NULL) {
2024       if ( ! FeatQualChoiceAsnWrite(ptr -> field_to, aip, FEATURE_FIELD_PAIR_field_to)) {
2025          goto erret;
2026       }
2027    }
2028    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2029       goto erret;
2030    }
2031    retval = TRUE;
2032 
2033 erret:
2034    AsnUnlinkType(orig);       /* unlink local tree */
2035    return retval;
2036 }
2037 
2038 
2039 
2040 /**************************************************
2041 *
2042 *    RnaFeatTypeFree()
2043 *
2044 **************************************************/
2045 NLM_EXTERN 
2046 RnaFeatTypePtr LIBCALL
2047 RnaFeatTypeFree(ValNodePtr anp)
2048 {
2049    Pointer pnt;
2050 
2051    if (anp == NULL) {
2052       return NULL;
2053    }
2054 
2055    pnt = anp->data.ptrvalue;
2056    switch (anp->choice)
2057    {
2058    default:
2059       break;
2060    case RnaFeatType_ncRNA:
2061       MemFree(anp -> data.ptrvalue);
2062       break;
2063    }
2064    return MemFree(anp);
2065 }
2066 
2067 
2068 /**************************************************
2069 *
2070 *    RnaFeatTypeAsnRead()
2071 *
2072 **************************************************/
2073 NLM_EXTERN 
2074 RnaFeatTypePtr LIBCALL
2075 RnaFeatTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2076 {
2077    DataVal av;
2078    AsnTypePtr atp;
2079    ValNodePtr anp;
2080    Uint1 choice;
2081    Boolean isError = FALSE;
2082    Boolean nullIsError = FALSE;
2083    AsnReadFunc func;
2084 
2085    if (! loaded)
2086    {
2087       if (! objmacroAsnLoad()) {
2088          return NULL;
2089       }
2090    }
2091 
2092    if (aip == NULL) {
2093       return NULL;
2094    }
2095 
2096    if (orig == NULL) {         /* RnaFeatType ::= (self contained) */
2097       atp = AsnReadId(aip, amp, RNA_FEAT_TYPE);
2098    } else {
2099       atp = AsnLinkType(orig, RNA_FEAT_TYPE);    /* link in local tree */
2100    }
2101    if (atp == NULL) {
2102       return NULL;
2103    }
2104 
2105    anp = ValNodeNew(NULL);
2106    if (anp == NULL) {
2107       goto erret;
2108    }
2109    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
2110       goto erret;
2111    }
2112 
2113    func = NULL;
2114 
2115    atp = AsnReadId(aip, amp, atp);  /* find the choice */
2116    if (atp == NULL) {
2117       goto erret;
2118    }
2119    if (atp == RNA_FEAT_TYPE_preRNA) {
2120       choice = RnaFeatType_preRNA;
2121       if (AsnReadVal(aip, atp, &av) <= 0) {
2122          goto erret;
2123       }
2124       anp->data.boolvalue = av.boolvalue;
2125    }
2126    else if (atp == RNA_FEAT_TYPE_mRNA) {
2127       choice = RnaFeatType_mRNA;
2128       if (AsnReadVal(aip, atp, &av) <= 0) {
2129          goto erret;
2130       }
2131       anp->data.boolvalue = av.boolvalue;
2132    }
2133    else if (atp == RNA_FEAT_TYPE_tRNA) {
2134       choice = RnaFeatType_tRNA;
2135       if (AsnReadVal(aip, atp, &av) <= 0) {
2136          goto erret;
2137       }
2138       anp->data.boolvalue = av.boolvalue;
2139    }
2140    else if (atp == RNA_FEAT_TYPE_rRNA) {
2141       choice = RnaFeatType_rRNA;
2142       if (AsnReadVal(aip, atp, &av) <= 0) {
2143          goto erret;
2144       }
2145       anp->data.boolvalue = av.boolvalue;
2146    }
2147    else if (atp == RNA_FEAT_TYPE_ncRNA) {
2148       choice = RnaFeatType_ncRNA;
2149       if (AsnReadVal(aip, atp, &av) <= 0) {
2150          goto erret;
2151       }
2152       anp->data.ptrvalue = av.ptrvalue;
2153    }
2154    else if (atp == RNA_FEAT_TYPE_tmRNA) {
2155       choice = RnaFeatType_tmRNA;
2156       if (AsnReadVal(aip, atp, &av) <= 0) {
2157          goto erret;
2158       }
2159       anp->data.boolvalue = av.boolvalue;
2160    }
2161    else if (atp == RNA_FEAT_TYPE_miscRNA) {
2162       choice = RnaFeatType_miscRNA;
2163       if (AsnReadVal(aip, atp, &av) <= 0) {
2164          goto erret;
2165       }
2166       anp->data.boolvalue = av.boolvalue;
2167    }
2168    anp->choice = choice;
2169    if (func != NULL)
2170    {
2171       anp->data.ptrvalue = (* func)(aip, atp);
2172       if (aip -> io_failure) goto erret;
2173 
2174       if (nullIsError && anp->data.ptrvalue == NULL) {
2175          goto erret;
2176       }
2177    }
2178 
2179 ret:
2180    AsnUnlinkType(orig);       /* unlink local tree */
2181    return anp;
2182 
2183 erret:
2184    anp = MemFree(anp);
2185    aip -> io_failure = TRUE;
2186    goto ret;
2187 }
2188 
2189 
2190 /**************************************************
2191 *
2192 *    RnaFeatTypeAsnWrite()
2193 *
2194 **************************************************/
2195 NLM_EXTERN Boolean LIBCALL 
2196 RnaFeatTypeAsnWrite(RnaFeatTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
2197 
2198 {
2199    DataVal av;
2200    AsnTypePtr atp, writetype = NULL;
2201    Pointer pnt;
2202    AsnWriteFunc func = NULL;
2203    Boolean retval = FALSE;
2204 
2205    if (! loaded)
2206    {
2207       if (! objmacroAsnLoad())
2208       return FALSE;
2209    }
2210 
2211    if (aip == NULL)
2212    return FALSE;
2213 
2214    atp = AsnLinkType(orig, RNA_FEAT_TYPE);   /* link local tree */
2215    if (atp == NULL) {
2216       return FALSE;
2217    }
2218 
2219    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2220 
2221    av.ptrvalue = (Pointer)anp;
2222    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2223       goto erret;
2224    }
2225 
2226    pnt = anp->data.ptrvalue;
2227    switch (anp->choice)
2228    {
2229    case RnaFeatType_preRNA:
2230       av.boolvalue = anp->data.boolvalue;
2231       retval = AsnWrite(aip, RNA_FEAT_TYPE_preRNA, &av);
2232       break;
2233    case RnaFeatType_mRNA:
2234       av.boolvalue = anp->data.boolvalue;
2235       retval = AsnWrite(aip, RNA_FEAT_TYPE_mRNA, &av);
2236       break;
2237    case RnaFeatType_tRNA:
2238       av.boolvalue = anp->data.boolvalue;
2239       retval = AsnWrite(aip, RNA_FEAT_TYPE_tRNA, &av);
2240       break;
2241    case RnaFeatType_rRNA:
2242       av.boolvalue = anp->data.boolvalue;
2243       retval = AsnWrite(aip, RNA_FEAT_TYPE_rRNA, &av);
2244       break;
2245    case RnaFeatType_ncRNA:
2246       av.ptrvalue = anp->data.ptrvalue;
2247       retval = AsnWrite(aip, RNA_FEAT_TYPE_ncRNA, &av);
2248       break;
2249    case RnaFeatType_tmRNA:
2250       av.boolvalue = anp->data.boolvalue;
2251       retval = AsnWrite(aip, RNA_FEAT_TYPE_tmRNA, &av);
2252       break;
2253    case RnaFeatType_miscRNA:
2254       av.boolvalue = anp->data.boolvalue;
2255       retval = AsnWrite(aip, RNA_FEAT_TYPE_miscRNA, &av);
2256       break;
2257    }
2258    if (writetype != NULL) {
2259       retval = (* func)(pnt, aip, writetype);   /* write it out */
2260    }
2261    if (!retval) {
2262       goto erret;
2263    }
2264    retval = TRUE;
2265 
2266 erret:
2267    AsnUnlinkType(orig);       /* unlink local tree */
2268    return retval;
2269 }
2270 
2271 
2272 /**************************************************
2273 *
2274 *    RnaQualNew()
2275 *
2276 **************************************************/
2277 NLM_EXTERN 
2278 RnaQualPtr LIBCALL
2279 RnaQualNew(void)
2280 {
2281    RnaQualPtr ptr = MemNew((size_t) sizeof(RnaQual));
2282 
2283    return ptr;
2284 
2285 }
2286 
2287 
2288 /**************************************************
2289 *
2290 *    RnaQualFree()
2291 *
2292 **************************************************/
2293 NLM_EXTERN 
2294 RnaQualPtr LIBCALL
2295 RnaQualFree(RnaQualPtr ptr)
2296 {
2297 
2298    if(ptr == NULL) {
2299       return NULL;
2300    }
2301    RnaFeatTypeFree(ptr -> type);
2302    return MemFree(ptr);
2303 }
2304 
2305 
2306 /**************************************************
2307 *
2308 *    RnaQualAsnRead()
2309 *
2310 **************************************************/
2311 NLM_EXTERN 
2312 RnaQualPtr LIBCALL
2313 RnaQualAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2314 {
2315    DataVal av;
2316    AsnTypePtr atp;
2317    Boolean isError = FALSE;
2318    AsnReadFunc func;
2319    RnaQualPtr ptr;
2320 
2321    if (! loaded)
2322    {
2323       if (! objmacroAsnLoad()) {
2324          return NULL;
2325       }
2326    }
2327 
2328    if (aip == NULL) {
2329       return NULL;
2330    }
2331 
2332    if (orig == NULL) {         /* RnaQual ::= (self contained) */
2333       atp = AsnReadId(aip, amp, RNA_QUAL);
2334    } else {
2335       atp = AsnLinkType(orig, RNA_QUAL);
2336    }
2337    /* link in local tree */
2338    if (atp == NULL) {
2339       return NULL;
2340    }
2341 
2342    ptr = RnaQualNew();
2343    if (ptr == NULL) {
2344       goto erret;
2345    }
2346    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2347       goto erret;
2348    }
2349 
2350    atp = AsnReadId(aip,amp, atp);
2351    func = NULL;
2352 
2353    if (atp == RNA_QUAL_type) {
2354       ptr -> type = RnaFeatTypeAsnRead(aip, atp);
2355       if (aip -> io_failure) {
2356          goto erret;
2357       }
2358       atp = AsnReadId(aip,amp, atp);
2359    }
2360    if (atp == RNA_QUAL_field) {
2361       if ( AsnReadVal(aip, atp, &av) <= 0) {
2362          goto erret;
2363       }
2364       ptr -> field = av.intvalue;
2365       atp = AsnReadId(aip,amp, atp);
2366    }
2367 
2368    if (AsnReadVal(aip, atp, &av) <= 0) {
2369       goto erret;
2370    }
2371    /* end struct */
2372 
2373 ret:
2374    AsnUnlinkType(orig);       /* unlink local tree */
2375    return ptr;
2376 
2377 erret:
2378    aip -> io_failure = TRUE;
2379    ptr = RnaQualFree(ptr);
2380    goto ret;
2381 }
2382 
2383 
2384 
2385 /**************************************************
2386 *
2387 *    RnaQualAsnWrite()
2388 *
2389 **************************************************/
2390 NLM_EXTERN Boolean LIBCALL 
2391 RnaQualAsnWrite(RnaQualPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2392 {
2393    DataVal av;
2394    AsnTypePtr atp;
2395    Boolean retval = FALSE;
2396 
2397    if (! loaded)
2398    {
2399       if (! objmacroAsnLoad()) {
2400          return FALSE;
2401       }
2402    }
2403 
2404    if (aip == NULL) {
2405       return FALSE;
2406    }
2407 
2408    atp = AsnLinkType(orig, RNA_QUAL);   /* link local tree */
2409    if (atp == NULL) {
2410       return FALSE;
2411    }
2412 
2413    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2414    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2415       goto erret;
2416    }
2417 
2418    if (ptr -> type != NULL) {
2419       if ( ! RnaFeatTypeAsnWrite(ptr -> type, aip, RNA_QUAL_type)) {
2420          goto erret;
2421       }
2422    }
2423    av.intvalue = ptr -> field;
2424    retval = AsnWrite(aip, RNA_QUAL_field,  &av);
2425    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2426       goto erret;
2427    }
2428    retval = TRUE;
2429 
2430 erret:
2431    AsnUnlinkType(orig);       /* unlink local tree */
2432    return retval;
2433 }
2434 
2435 
2436 
2437 /**************************************************
2438 *
2439 *    RnaQualPairNew()
2440 *
2441 **************************************************/
2442 NLM_EXTERN 
2443 RnaQualPairPtr LIBCALL
2444 RnaQualPairNew(void)
2445 {
2446    RnaQualPairPtr ptr = MemNew((size_t) sizeof(RnaQualPair));
2447 
2448    return ptr;
2449 
2450 }
2451 
2452 
2453 /**************************************************
2454 *
2455 *    RnaQualPairFree()
2456 *
2457 **************************************************/
2458 NLM_EXTERN 
2459 RnaQualPairPtr LIBCALL
2460 RnaQualPairFree(RnaQualPairPtr ptr)
2461 {
2462 
2463    if(ptr == NULL) {
2464       return NULL;
2465    }
2466    RnaFeatTypeFree(ptr -> type);
2467    return MemFree(ptr);
2468 }
2469 
2470 
2471 /**************************************************
2472 *
2473 *    RnaQualPairAsnRead()
2474 *
2475 **************************************************/
2476 NLM_EXTERN 
2477 RnaQualPairPtr LIBCALL
2478 RnaQualPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2479 {
2480    DataVal av;
2481    AsnTypePtr atp;
2482    Boolean isError = FALSE;
2483    AsnReadFunc func;
2484    RnaQualPairPtr ptr;
2485 
2486    if (! loaded)
2487    {
2488       if (! objmacroAsnLoad()) {
2489          return NULL;
2490       }
2491    }
2492 
2493    if (aip == NULL) {
2494       return NULL;
2495    }
2496 
2497    if (orig == NULL) {         /* RnaQualPair ::= (self contained) */
2498       atp = AsnReadId(aip, amp, RNA_QUAL_PAIR);
2499    } else {
2500       atp = AsnLinkType(orig, RNA_QUAL_PAIR);
2501    }
2502    /* link in local tree */
2503    if (atp == NULL) {
2504       return NULL;
2505    }
2506 
2507    ptr = RnaQualPairNew();
2508    if (ptr == NULL) {
2509       goto erret;
2510    }
2511    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2512       goto erret;
2513    }
2514 
2515    atp = AsnReadId(aip,amp, atp);
2516    func = NULL;
2517 
2518    if (atp == RNA_QUAL_PAIR_type) {
2519       ptr -> type = RnaFeatTypeAsnRead(aip, atp);
2520       if (aip -> io_failure) {
2521          goto erret;
2522       }
2523       atp = AsnReadId(aip,amp, atp);
2524    }
2525    if (atp == RNA_QUAL_PAIR_field_from) {
2526       if ( AsnReadVal(aip, atp, &av) <= 0) {
2527          goto erret;
2528       }
2529       ptr -> field_from = av.intvalue;
2530       atp = AsnReadId(aip,amp, atp);
2531    }
2532    if (atp == RNA_QUAL_PAIR_field_to) {
2533       if ( AsnReadVal(aip, atp, &av) <= 0) {
2534          goto erret;
2535       }
2536       ptr -> field_to = av.intvalue;
2537       atp = AsnReadId(aip,amp, atp);
2538    }
2539 
2540    if (AsnReadVal(aip, atp, &av) <= 0) {
2541       goto erret;
2542    }
2543    /* end struct */
2544 
2545 ret:
2546    AsnUnlinkType(orig);       /* unlink local tree */
2547    return ptr;
2548 
2549 erret:
2550    aip -> io_failure = TRUE;
2551    ptr = RnaQualPairFree(ptr);
2552    goto ret;
2553 }
2554 
2555 
2556 
2557 /**************************************************
2558 *
2559 *    RnaQualPairAsnWrite()
2560 *
2561 **************************************************/
2562 NLM_EXTERN Boolean LIBCALL 
2563 RnaQualPairAsnWrite(RnaQualPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2564 {
2565    DataVal av;
2566    AsnTypePtr atp;
2567    Boolean retval = FALSE;
2568 
2569    if (! loaded)
2570    {
2571       if (! objmacroAsnLoad()) {
2572          return FALSE;
2573       }
2574    }
2575 
2576    if (aip == NULL) {
2577       return FALSE;
2578    }
2579 
2580    atp = AsnLinkType(orig, RNA_QUAL_PAIR);   /* link local tree */
2581    if (atp == NULL) {
2582       return FALSE;
2583    }
2584 
2585    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2586    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2587       goto erret;
2588    }
2589 
2590    if (ptr -> type != NULL) {
2591       if ( ! RnaFeatTypeAsnWrite(ptr -> type, aip, RNA_QUAL_PAIR_type)) {
2592          goto erret;
2593       }
2594    }
2595    av.intvalue = ptr -> field_from;
2596    retval = AsnWrite(aip, RNA_QUAL_PAIR_field_from,  &av);
2597    av.intvalue = ptr -> field_to;
2598    retval = AsnWrite(aip, RNA_QUAL_PAIR_field_to,  &av);
2599    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2600       goto erret;
2601    }
2602    retval = TRUE;
2603 
2604 erret:
2605    AsnUnlinkType(orig);       /* unlink local tree */
2606    return retval;
2607 }
2608 
2609 
2610 
2611 /**************************************************
2612 *
2613 *    SourceQualPairNew()
2614 *
2615 **************************************************/
2616 NLM_EXTERN 
2617 SourceQualPairPtr LIBCALL
2618 SourceQualPairNew(void)
2619 {
2620    SourceQualPairPtr ptr = MemNew((size_t) sizeof(SourceQualPair));
2621 
2622    return ptr;
2623 
2624 }
2625 
2626 
2627 /**************************************************
2628 *
2629 *    SourceQualPairFree()
2630 *
2631 **************************************************/
2632 NLM_EXTERN 
2633 SourceQualPairPtr LIBCALL
2634 SourceQualPairFree(SourceQualPairPtr ptr)
2635 {
2636 
2637    if(ptr == NULL) {
2638       return NULL;
2639    }
2640    return MemFree(ptr);
2641 }
2642 
2643 
2644 /**************************************************
2645 *
2646 *    SourceQualPairAsnRead()
2647 *
2648 **************************************************/
2649 NLM_EXTERN 
2650 SourceQualPairPtr LIBCALL
2651 SourceQualPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2652 {
2653    DataVal av;
2654    AsnTypePtr atp;
2655    Boolean isError = FALSE;
2656    AsnReadFunc func;
2657    SourceQualPairPtr ptr;
2658 
2659    if (! loaded)
2660    {
2661       if (! objmacroAsnLoad()) {
2662          return NULL;
2663       }
2664    }
2665 
2666    if (aip == NULL) {
2667       return NULL;
2668    }
2669 
2670    if (orig == NULL) {         /* SourceQualPair ::= (self contained) */
2671       atp = AsnReadId(aip, amp, SOURCE_QUAL_PAIR);
2672    } else {
2673       atp = AsnLinkType(orig, SOURCE_QUAL_PAIR);
2674    }
2675    /* link in local tree */
2676    if (atp == NULL) {
2677       return NULL;
2678    }
2679 
2680    ptr = SourceQualPairNew();
2681    if (ptr == NULL) {
2682       goto erret;
2683    }
2684    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2685       goto erret;
2686    }
2687 
2688    atp = AsnReadId(aip,amp, atp);
2689    func = NULL;
2690 
2691    if (atp == SOURCE_QUAL_PAIR_field_from) {
2692       if ( AsnReadVal(aip, atp, &av) <= 0) {
2693          goto erret;
2694       }
2695       ptr -> field_from = av.intvalue;
2696       atp = AsnReadId(aip,amp, atp);
2697    }
2698    if (atp == SOURCE_QUAL_PAIR_field_to) {
2699       if ( AsnReadVal(aip, atp, &av) <= 0) {
2700          goto erret;
2701       }
2702       ptr -> field_to = av.intvalue;
2703       atp = AsnReadId(aip,amp, atp);
2704    }
2705 
2706    if (AsnReadVal(aip, atp, &av) <= 0) {
2707       goto erret;
2708    }
2709    /* end struct */
2710 
2711 ret:
2712    AsnUnlinkType(orig);       /* unlink local tree */
2713    return ptr;
2714 
2715 erret:
2716    aip -> io_failure = TRUE;
2717    ptr = SourceQualPairFree(ptr);
2718    goto ret;
2719 }
2720 
2721 
2722 
2723 /**************************************************
2724 *
2725 *    SourceQualPairAsnWrite()
2726 *
2727 **************************************************/
2728 NLM_EXTERN Boolean LIBCALL 
2729 SourceQualPairAsnWrite(SourceQualPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2730 {
2731    DataVal av;
2732    AsnTypePtr atp;
2733    Boolean retval = FALSE;
2734 
2735    if (! loaded)
2736    {
2737       if (! objmacroAsnLoad()) {
2738          return FALSE;
2739       }
2740    }
2741 
2742    if (aip == NULL) {
2743       return FALSE;
2744    }
2745 
2746    atp = AsnLinkType(orig, SOURCE_QUAL_PAIR);   /* link local tree */
2747    if (atp == NULL) {
2748       return FALSE;
2749    }
2750 
2751    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2752    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2753       goto erret;
2754    }
2755 
2756    av.intvalue = ptr -> field_from;
2757    retval = AsnWrite(aip, SOURCE_QUAL_PAIR_field_from,  &av);
2758    av.intvalue = ptr -> field_to;
2759    retval = AsnWrite(aip, SOURCE_QUAL_PAIR_field_to,  &av);
2760    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2761       goto erret;
2762    }
2763    retval = TRUE;
2764 
2765 erret:
2766    AsnUnlinkType(orig);       /* unlink local tree */
2767    return retval;
2768 }
2769 
2770 
2771 
2772 /**************************************************
2773 *
2774 *    SourceQualChoiceFree()
2775 *
2776 **************************************************/
2777 NLM_EXTERN 
2778 SourceQualChoicePtr LIBCALL
2779 SourceQualChoiceFree(ValNodePtr anp)
2780 {
2781    Pointer pnt;
2782 
2783    if (anp == NULL) {
2784       return NULL;
2785    }
2786 
2787    pnt = anp->data.ptrvalue;
2788    switch (anp->choice)
2789    {
2790    default:
2791       break;
2792    }
2793    return MemFree(anp);
2794 }
2795 
2796 
2797 /**************************************************
2798 *
2799 *    SourceQualChoiceAsnRead()
2800 *
2801 **************************************************/
2802 NLM_EXTERN 
2803 SourceQualChoicePtr LIBCALL
2804 SourceQualChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2805 {
2806    DataVal av;
2807    AsnTypePtr atp;
2808    ValNodePtr anp;
2809    Uint1 choice;
2810    Boolean isError = FALSE;
2811    Boolean nullIsError = FALSE;
2812    AsnReadFunc func;
2813 
2814    if (! loaded)
2815    {
2816       if (! objmacroAsnLoad()) {
2817          return NULL;
2818       }
2819    }
2820 
2821    if (aip == NULL) {
2822       return NULL;
2823    }
2824 
2825    if (orig == NULL) {         /* SourceQualChoice ::= (self contained) */
2826       atp = AsnReadId(aip, amp, SOURCE_QUAL_CHOICE);
2827    } else {
2828       atp = AsnLinkType(orig, SOURCE_QUAL_CHOICE);    /* link in local tree */
2829    }
2830    if (atp == NULL) {
2831       return NULL;
2832    }
2833 
2834    anp = ValNodeNew(NULL);
2835    if (anp == NULL) {
2836       goto erret;
2837    }
2838    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
2839       goto erret;
2840    }
2841 
2842    func = NULL;
2843 
2844    atp = AsnReadId(aip, amp, atp);  /* find the choice */
2845    if (atp == NULL) {
2846       goto erret;
2847    }
2848    if (atp == SOURCE_QUAL_CHOICE_textqual) {
2849       choice = SourceQualChoice_textqual;
2850       if (AsnReadVal(aip, atp, &av) <= 0) {
2851          goto erret;
2852       }
2853       anp->data.intvalue = av.intvalue;
2854    }
2855    else if (atp == SOURCE_QUAL_CHOICE_location) {
2856       choice = SourceQualChoice_location;
2857       if (AsnReadVal(aip, atp, &av) <= 0) {
2858          goto erret;
2859       }
2860       anp->data.intvalue = av.intvalue;
2861    }
2862    else if (atp == SOURCE_QUAL_CHOICE_origin) {
2863       choice = SourceQualChoice_origin;
2864       if (AsnReadVal(aip, atp, &av) <= 0) {
2865          goto erret;
2866       }
2867       anp->data.intvalue = av.intvalue;
2868    }
2869    else if (atp == SOURCE_QUAL_CHOICE_gcode) {
2870       choice = SourceQualChoice_gcode;
2871       if (AsnReadVal(aip, atp, &av) <= 0) {
2872          goto erret;
2873       }
2874       anp->data.intvalue = av.intvalue;
2875    }
2876    else if (atp == SOURCE_QUAL_CHOICE_mgcode) {
2877       choice = SourceQualChoice_mgcode;
2878       if (AsnReadVal(aip, atp, &av) <= 0) {
2879          goto erret;
2880       }
2881       anp->data.intvalue = av.intvalue;
2882    }
2883    anp->choice = choice;
2884    if (func != NULL)
2885    {
2886       anp->data.ptrvalue = (* func)(aip, atp);
2887       if (aip -> io_failure) goto erret;
2888 
2889       if (nullIsError && anp->data.ptrvalue == NULL) {
2890          goto erret;
2891       }
2892    }
2893 
2894 ret:
2895    AsnUnlinkType(orig);       /* unlink local tree */
2896    return anp;
2897 
2898 erret:
2899    anp = MemFree(anp);
2900    aip -> io_failure = TRUE;
2901    goto ret;
2902 }
2903 
2904 
2905 /**************************************************
2906 *
2907 *    SourceQualChoiceAsnWrite()
2908 *
2909 **************************************************/
2910 NLM_EXTERN Boolean LIBCALL 
2911 SourceQualChoiceAsnWrite(SourceQualChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
2912 
2913 {
2914    DataVal av;
2915    AsnTypePtr atp, writetype = NULL;
2916    Pointer pnt;
2917    AsnWriteFunc func = NULL;
2918    Boolean retval = FALSE;
2919 
2920    if (! loaded)
2921    {
2922       if (! objmacroAsnLoad())
2923       return FALSE;
2924    }
2925 
2926    if (aip == NULL)
2927    return FALSE;
2928 
2929    atp = AsnLinkType(orig, SOURCE_QUAL_CHOICE);   /* link local tree */
2930    if (atp == NULL) {
2931       return FALSE;
2932    }
2933 
2934    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2935 
2936    av.ptrvalue = (Pointer)anp;
2937    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2938       goto erret;
2939    }
2940 
2941    pnt = anp->data.ptrvalue;
2942    switch (anp->choice)
2943    {
2944    case SourceQualChoice_textqual:
2945       av.intvalue = anp->data.intvalue;
2946       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_textqual, &av);
2947       break;
2948    case SourceQualChoice_location:
2949       av.intvalue = anp->data.intvalue;
2950       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_location, &av);
2951       break;
2952    case SourceQualChoice_origin:
2953       av.intvalue = anp->data.intvalue;
2954       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_origin, &av);
2955       break;
2956    case SourceQualChoice_gcode:
2957       av.intvalue = anp->data.intvalue;
2958       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_gcode, &av);
2959       break;
2960    case SourceQualChoice_mgcode:
2961       av.intvalue = anp->data.intvalue;
2962       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_mgcode, &av);
2963       break;
2964    }
2965    if (writetype != NULL) {
2966       retval = (* func)(pnt, aip, writetype);   /* write it out */
2967    }
2968    if (!retval) {
2969       goto erret;
2970    }
2971    retval = TRUE;
2972 
2973 erret:
2974    AsnUnlinkType(orig);       /* unlink local tree */
2975    return retval;
2976 }
2977 
2978 
2979 /**************************************************
2980 *
2981 *    SourceQualTextValNew()
2982 *
2983 **************************************************/
2984 NLM_EXTERN 
2985 SourceQualTextValPtr LIBCALL
2986 SourceQualTextValNew(void)
2987 {
2988    SourceQualTextValPtr ptr = MemNew((size_t) sizeof(SourceQualTextVal));
2989 
2990    return ptr;
2991 
2992 }
2993 
2994 
2995 /**************************************************
2996 *
2997 *    SourceQualTextValFree()
2998 *
2999 **************************************************/
3000 NLM_EXTERN 
3001 SourceQualTextValPtr LIBCALL
3002 SourceQualTextValFree(SourceQualTextValPtr ptr)
3003 {
3004 
3005    if(ptr == NULL) {
3006       return NULL;
3007    }
3008    MemFree(ptr -> val);
3009    return MemFree(ptr);
3010 }
3011 
3012 
3013 /**************************************************
3014 *
3015 *    SourceQualTextValAsnRead()
3016 *
3017 **************************************************/
3018 NLM_EXTERN 
3019 SourceQualTextValPtr LIBCALL
3020 SourceQualTextValAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3021 {
3022    DataVal av;
3023    AsnTypePtr atp;
3024    Boolean isError = FALSE;
3025    AsnReadFunc func;
3026    SourceQualTextValPtr ptr;
3027 
3028    if (! loaded)
3029    {
3030       if (! objmacroAsnLoad()) {
3031          return NULL;
3032       }
3033    }
3034 
3035    if (aip == NULL) {
3036       return NULL;
3037    }
3038 
3039    if (orig == NULL) {         /* SourceQualTextVal ::= (self contained) */
3040       atp = AsnReadId(aip, amp, SOURCE_QUAL_TEXT_VAL);
3041    } else {
3042       atp = AsnLinkType(orig, SOURCE_QUAL_TEXT_VAL);
3043    }
3044    /* link in local tree */
3045    if (atp == NULL) {
3046       return NULL;
3047    }
3048 
3049    ptr = SourceQualTextValNew();
3050    if (ptr == NULL) {
3051       goto erret;
3052    }
3053    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3054       goto erret;
3055    }
3056 
3057    atp = AsnReadId(aip,amp, atp);
3058    func = NULL;
3059 
3060    if (atp == SOURCE_QUAL_TEXT_VAL_srcqual) {
3061       if ( AsnReadVal(aip, atp, &av) <= 0) {
3062          goto erret;
3063       }
3064       ptr -> srcqual = av.intvalue;
3065       atp = AsnReadId(aip,amp, atp);
3066    }
3067    if (atp == SOURCE_QUAL_TEXT_VAL_val) {
3068       if ( AsnReadVal(aip, atp, &av) <= 0) {
3069          goto erret;
3070       }
3071       ptr -> val = av.ptrvalue;
3072       atp = AsnReadId(aip,amp, atp);
3073    }
3074 
3075    if (AsnReadVal(aip, atp, &av) <= 0) {
3076       goto erret;
3077    }
3078    /* end struct */
3079 
3080 ret:
3081    AsnUnlinkType(orig);       /* unlink local tree */
3082    return ptr;
3083 
3084 erret:
3085    aip -> io_failure = TRUE;
3086    ptr = SourceQualTextValFree(ptr);
3087    goto ret;
3088 }
3089 
3090 
3091 
3092 /**************************************************
3093 *
3094 *    SourceQualTextValAsnWrite()
3095 *
3096 **************************************************/
3097 NLM_EXTERN Boolean LIBCALL 
3098 SourceQualTextValAsnWrite(SourceQualTextValPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3099 {
3100    DataVal av;
3101    AsnTypePtr atp;
3102    Boolean retval = FALSE;
3103 
3104    if (! loaded)
3105    {
3106       if (! objmacroAsnLoad()) {
3107          return FALSE;
3108       }
3109    }
3110 
3111    if (aip == NULL) {
3112       return FALSE;
3113    }
3114 
3115    atp = AsnLinkType(orig, SOURCE_QUAL_TEXT_VAL);   /* link local tree */
3116    if (atp == NULL) {
3117       return FALSE;
3118    }
3119 
3120    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3121    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3122       goto erret;
3123    }
3124 
3125    av.intvalue = ptr -> srcqual;
3126    retval = AsnWrite(aip, SOURCE_QUAL_TEXT_VAL_srcqual,  &av);
3127    if (ptr -> val != NULL) {
3128       av.ptrvalue = ptr -> val;
3129       retval = AsnWrite(aip, SOURCE_QUAL_TEXT_VAL_val,  &av);
3130    }
3131    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3132       goto erret;
3133    }
3134    retval = TRUE;
3135 
3136 erret:
3137    AsnUnlinkType(orig);       /* unlink local tree */
3138    return retval;
3139 }
3140 
3141 
3142 
3143 /**************************************************
3144 *
3145 *    SourceQualValChoiceFree()
3146 *
3147 **************************************************/
3148 NLM_EXTERN 
3149 SourceQualValChoicePtr LIBCALL
3150 SourceQualValChoiceFree(ValNodePtr anp)
3151 {
3152    Pointer pnt;
3153 
3154    if (anp == NULL) {
3155       return NULL;
3156    }
3157 
3158    pnt = anp->data.ptrvalue;
3159    switch (anp->choice)
3160    {
3161    default:
3162       break;
3163    case SourceQualValChoice_textqual:
3164       SourceQualTextValFree(anp -> data.ptrvalue);
3165       break;
3166    }
3167    return MemFree(anp);
3168 }
3169 
3170 
3171 /**************************************************
3172 *
3173 *    SourceQualValChoiceAsnRead()
3174 *
3175 **************************************************/
3176 NLM_EXTERN 
3177 SourceQualValChoicePtr LIBCALL
3178 SourceQualValChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3179 {
3180    DataVal av;
3181    AsnTypePtr atp;
3182    ValNodePtr anp;
3183    Uint1 choice;
3184    Boolean isError = FALSE;
3185    Boolean nullIsError = FALSE;
3186    AsnReadFunc func;
3187 
3188    if (! loaded)
3189    {
3190       if (! objmacroAsnLoad()) {
3191          return NULL;
3192       }
3193    }
3194 
3195    if (aip == NULL) {
3196       return NULL;
3197    }
3198 
3199    if (orig == NULL) {         /* SourceQualValChoice ::= (self contained) */
3200       atp = AsnReadId(aip, amp, SOURCE_QUAL_VAL_CHOICE);
3201    } else {
3202       atp = AsnLinkType(orig, SOURCE_QUAL_VAL_CHOICE);    /* link in local tree */
3203    }
3204    if (atp == NULL) {
3205       return NULL;
3206    }
3207 
3208    anp = ValNodeNew(NULL);
3209    if (anp == NULL) {
3210       goto erret;
3211    }
3212    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
3213       goto erret;
3214    }
3215 
3216    func = NULL;
3217 
3218    atp = AsnReadId(aip, amp, atp);  /* find the choice */
3219    if (atp == NULL) {
3220       goto erret;
3221    }
3222    if (atp == SOURCE_QUAL_VAL_CHOICE_textqual) {
3223       choice = SourceQualValChoice_textqual;
3224       func = (AsnReadFunc) SourceQualTextValAsnRead;
3225    }
3226    else if (atp == SOURCE_QUAL_VAL_CHOICE_location) {
3227       choice = SourceQualValChoice_location;
3228       if (AsnReadVal(aip, atp, &av) <= 0) {
3229          goto erret;
3230       }
3231       anp->data.intvalue = av.intvalue;
3232    }
3233    else if (atp == SOURCE_QUAL_VAL_CHOICE_origin) {
3234       choice = SourceQualValChoice_origin;
3235       if (AsnReadVal(aip, atp, &av) <= 0) {
3236          goto erret;
3237       }
3238       anp->data.intvalue = av.intvalue;
3239    }
3240    else if (atp == SOURCE_QUAL_VAL_CHOICE_gcode) {
3241       choice = SourceQualValChoice_gcode;
3242       if (AsnReadVal(aip, atp, &av) <= 0) {
3243          goto erret;
3244       }
3245       anp->data.intvalue = av.intvalue;
3246    }
3247    else if (atp == SOURCE_QUAL_VAL_CHOICE_mgcode) {
3248       choice = SourceQualValChoice_mgcode;
3249       if (AsnReadVal(aip, atp, &av) <= 0) {
3250          goto erret;
3251       }
3252       anp->data.intvalue = av.intvalue;
3253    }
3254    anp->choice = choice;
3255    if (func != NULL)
3256    {
3257       anp->data.ptrvalue = (* func)(aip, atp);
3258       if (aip -> io_failure) goto erret;
3259 
3260       if (nullIsError && anp->data.ptrvalue == NULL) {
3261          goto erret;
3262       }
3263    }
3264 
3265 ret:
3266    AsnUnlinkType(orig);       /* unlink local tree */
3267    return anp;
3268 
3269 erret:
3270    anp = MemFree(anp);
3271    aip -> io_failure = TRUE;
3272    goto ret;
3273 }
3274 
3275 
3276 /**************************************************
3277 *
3278 *    SourceQualValChoiceAsnWrite()
3279 *
3280 **************************************************/
3281 NLM_EXTERN Boolean LIBCALL 
3282 SourceQualValChoiceAsnWrite(SourceQualValChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
3283 
3284 {
3285    DataVal av;
3286    AsnTypePtr atp, writetype = NULL;
3287    Pointer pnt;
3288    AsnWriteFunc func = NULL;
3289    Boolean retval = FALSE;
3290 
3291    if (! loaded)
3292    {
3293       if (! objmacroAsnLoad())
3294       return FALSE;
3295    }
3296 
3297    if (aip == NULL)
3298    return FALSE;
3299 
3300    atp = AsnLinkType(orig, SOURCE_QUAL_VAL_CHOICE);   /* link local tree */
3301    if (atp == NULL) {
3302       return FALSE;
3303    }
3304 
3305    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3306 
3307    av.ptrvalue = (Pointer)anp;
3308    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
3309       goto erret;
3310    }
3311 
3312    pnt = anp->data.ptrvalue;
3313    switch (anp->choice)
3314    {
3315    case SourceQualValChoice_textqual:
3316       writetype = SOURCE_QUAL_VAL_CHOICE_textqual;
3317       func = (AsnWriteFunc) SourceQualTextValAsnWrite;
3318       break;
3319    case SourceQualValChoice_location:
3320       av.intvalue = anp->data.intvalue;
3321       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_location, &av);
3322       break;
3323    case SourceQualValChoice_origin:
3324       av.intvalue = anp->data.intvalue;
3325       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_origin, &av);
3326       break;
3327    case SourceQualValChoice_gcode:
3328       av.intvalue = anp->data.intvalue;
3329       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_gcode, &av);
3330       break;
3331    case SourceQualValChoice_mgcode:
3332       av.intvalue = anp->data.intvalue;
3333       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_mgcode, &av);
3334       break;
3335    }
3336    if (writetype != NULL) {
3337       retval = (* func)(pnt, aip, writetype);   /* write it out */
3338    }
3339    if (!retval) {
3340       goto erret;
3341    }
3342    retval = TRUE;
3343 
3344 erret:
3345    AsnUnlinkType(orig);       /* unlink local tree */
3346    return retval;
3347 }
3348 
3349 
3350 /**************************************************
3351 *
3352 *    SourceQualValSetFree()
3353 *
3354 **************************************************/
3355 NLM_EXTERN 
3356 SourceQualValSetPtr LIBCALL
3357 SourceQualValSetFree(SourceQualValSetPtr ptr)
3358 {
3359 
3360    if(ptr == NULL) {
3361       return NULL;
3362    }
3363    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) SourceQualValChoiceFree);
3364    return NULL;
3365 }
3366 
3367 
3368 /**************************************************
3369 *
3370 *    SourceQualValSetAsnRead()
3371 *
3372 **************************************************/
3373 NLM_EXTERN 
3374 SourceQualValSetPtr LIBCALL
3375 SourceQualValSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3376 {
3377    DataVal av;
3378    AsnTypePtr atp;
3379    Boolean isError = FALSE;
3380    AsnReadFunc func;
3381    SourceQualValSetPtr ptr;
3382 
3383    if (! loaded)
3384    {
3385       if (! objmacroAsnLoad()) {
3386          return NULL;
3387       }
3388    }
3389 
3390    if (aip == NULL) {
3391       return NULL;
3392    }
3393 
3394    if (orig == NULL) {         /* SourceQualValSet ::= (self contained) */
3395       atp = AsnReadId(aip, amp, SOURCE_QUAL_VAL_SET);
3396    } else {
3397       atp = AsnLinkType(orig, SOURCE_QUAL_VAL_SET);
3398    }
3399    /* link in local tree */
3400    if (atp == NULL) {
3401       return NULL;
3402    }
3403 
3404    func = NULL;
3405 
3406    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SourceQualValChoiceAsnRead, (AsnOptFreeFunc) SourceQualValChoiceFree);
3407    if (isError && ptr  == NULL) {
3408       goto erret;
3409    }
3410 
3411 
3412 
3413 ret:
3414    AsnUnlinkType(orig);       /* unlink local tree */
3415    return ptr;
3416 
3417 erret:
3418    aip -> io_failure = TRUE;
3419    ptr = SourceQualValSetFree(ptr);
3420    goto ret;
3421 }
3422 
3423 
3424 
3425 /**************************************************
3426 *
3427 *    SourceQualValSetAsnWrite()
3428 *
3429 **************************************************/
3430 NLM_EXTERN Boolean LIBCALL 
3431 SourceQualValSetAsnWrite(SourceQualValSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3432 {
3433    DataVal av;
3434    AsnTypePtr atp;
3435    Boolean retval = FALSE;
3436 
3437    if (! loaded)
3438    {
3439       if (! objmacroAsnLoad()) {
3440          return FALSE;
3441       }
3442    }
3443 
3444    if (aip == NULL) {
3445       return FALSE;
3446    }
3447 
3448    atp = AsnLinkType(orig, SOURCE_QUAL_VAL_SET);   /* link local tree */
3449    if (atp == NULL) {
3450       return FALSE;
3451    }
3452 
3453    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3454    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) SourceQualValChoiceAsnWrite, aip, atp, SOURCE_QUAL_VAL_SET_E);
3455    retval = TRUE;
3456 
3457 erret:
3458    AsnUnlinkType(orig);       /* unlink local tree */
3459    return retval;
3460 }
3461 
3462 
3463 
3464 /**************************************************
3465 *
3466 *    CDSGeneProtFieldPairNew()
3467 *
3468 **************************************************/
3469 NLM_EXTERN 
3470 CDSGeneProtFieldPairPtr LIBCALL
3471 CDSGeneProtFieldPairNew(void)
3472 {
3473    CDSGeneProtFieldPairPtr ptr = MemNew((size_t) sizeof(CDSGeneProtFieldPair));
3474 
3475    return ptr;
3476 
3477 }
3478 
3479 
3480 /**************************************************
3481 *
3482 *    CDSGeneProtFieldPairFree()
3483 *
3484 **************************************************/
3485 NLM_EXTERN 
3486 CDSGeneProtFieldPairPtr LIBCALL
3487 CDSGeneProtFieldPairFree(CDSGeneProtFieldPairPtr ptr)
3488 {
3489 
3490    if(ptr == NULL) {
3491       return NULL;
3492    }
3493    return MemFree(ptr);
3494 }
3495 
3496 
3497 /**************************************************
3498 *
3499 *    CDSGeneProtFieldPairAsnRead()
3500 *
3501 **************************************************/
3502 NLM_EXTERN 
3503 CDSGeneProtFieldPairPtr LIBCALL
3504 CDSGeneProtFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3505 {
3506    DataVal av;
3507    AsnTypePtr atp;
3508    Boolean isError = FALSE;
3509    AsnReadFunc func;
3510    CDSGeneProtFieldPairPtr ptr;
3511 
3512    if (! loaded)
3513    {
3514       if (! objmacroAsnLoad()) {
3515          return NULL;
3516       }
3517    }
3518 
3519    if (aip == NULL) {
3520       return NULL;
3521    }
3522 
3523    if (orig == NULL) {         /* CDSGeneProtFieldPair ::= (self contained) */
3524       atp = AsnReadId(aip, amp, CDSGENEPROT_FIELD_PAIR);
3525    } else {
3526       atp = AsnLinkType(orig, CDSGENEPROT_FIELD_PAIR);
3527    }
3528    /* link in local tree */
3529    if (atp == NULL) {
3530       return NULL;
3531    }
3532 
3533    ptr = CDSGeneProtFieldPairNew();
3534    if (ptr == NULL) {
3535       goto erret;
3536    }
3537    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3538       goto erret;
3539    }
3540 
3541    atp = AsnReadId(aip,amp, atp);
3542    func = NULL;
3543 
3544    if (atp == FIELD_PAIR_field_from) {
3545       if ( AsnReadVal(aip, atp, &av) <= 0) {
3546          goto erret;
3547       }
3548       ptr -> field_from = av.intvalue;
3549       atp = AsnReadId(aip,amp, atp);
3550    }
3551    if (atp == CDSGENEPROT_FIELD_PAIR_field_to) {
3552       if ( AsnReadVal(aip, atp, &av) <= 0) {
3553          goto erret;
3554       }
3555       ptr -> field_to = av.intvalue;
3556       atp = AsnReadId(aip,amp, atp);
3557    }
3558 
3559    if (AsnReadVal(aip, atp, &av) <= 0) {
3560       goto erret;
3561    }
3562    /* end struct */
3563 
3564 ret:
3565    AsnUnlinkType(orig);       /* unlink local tree */
3566    return ptr;
3567 
3568 erret:
3569    aip -> io_failure = TRUE;
3570    ptr = CDSGeneProtFieldPairFree(ptr);
3571    goto ret;
3572 }
3573 
3574 
3575 
3576 /**************************************************
3577 *
3578 *    CDSGeneProtFieldPairAsnWrite()
3579 *
3580 **************************************************/
3581 NLM_EXTERN Boolean LIBCALL 
3582 CDSGeneProtFieldPairAsnWrite(CDSGeneProtFieldPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3583 {
3584    DataVal av;
3585    AsnTypePtr atp;
3586    Boolean retval = FALSE;
3587 
3588    if (! loaded)
3589    {
3590       if (! objmacroAsnLoad()) {
3591          return FALSE;
3592       }
3593    }
3594 
3595    if (aip == NULL) {
3596       return FALSE;
3597    }
3598 
3599    atp = AsnLinkType(orig, CDSGENEPROT_FIELD_PAIR);   /* link local tree */
3600    if (atp == NULL) {
3601       return FALSE;
3602    }
3603 
3604    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3605    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3606       goto erret;
3607    }
3608 
3609    av.intvalue = ptr -> field_from;
3610    retval = AsnWrite(aip, FIELD_PAIR_field_from,  &av);
3611    av.intvalue = ptr -> field_to;
3612    retval = AsnWrite(aip, CDSGENEPROT_FIELD_PAIR_field_to,  &av);
3613    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3614       goto erret;
3615    }
3616    retval = TRUE;
3617 
3618 erret:
3619    AsnUnlinkType(orig);       /* unlink local tree */
3620    return retval;
3621 }
3622 
3623 
3624 
3625 /**************************************************
3626 *
3627 *    MolinfoFieldFree()
3628 *
3629 **************************************************/
3630 NLM_EXTERN 
3631 MolinfoFieldPtr LIBCALL
3632 MolinfoFieldFree(ValNodePtr anp)
3633 {
3634    Pointer pnt;
3635 
3636    if (anp == NULL) {
3637       return NULL;
3638    }
3639 
3640    pnt = anp->data.ptrvalue;
3641    switch (anp->choice)
3642    {
3643    default:
3644       break;
3645    }
3646    return MemFree(anp);
3647 }
3648 
3649 
3650 /**************************************************
3651 *
3652 *    MolinfoFieldAsnRead()
3653 *
3654 **************************************************/
3655 NLM_EXTERN 
3656 MolinfoFieldPtr LIBCALL
3657 MolinfoFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3658 {
3659    DataVal av;
3660    AsnTypePtr atp;
3661    ValNodePtr anp;
3662    Uint1 choice;
3663    Boolean isError = FALSE;
3664    Boolean nullIsError = FALSE;
3665    AsnReadFunc func;
3666 
3667    if (! loaded)
3668    {
3669       if (! objmacroAsnLoad()) {
3670          return NULL;
3671       }
3672    }
3673 
3674    if (aip == NULL) {
3675       return NULL;
3676    }
3677 
3678    if (orig == NULL) {         /* MolinfoField ::= (self contained) */
3679       atp = AsnReadId(aip, amp, MOLINFO_FIELD);
3680    } else {
3681       atp = AsnLinkType(orig, MOLINFO_FIELD);    /* link in local tree */
3682    }
3683    if (atp == NULL) {
3684       return NULL;
3685    }
3686 
3687    anp = ValNodeNew(NULL);
3688    if (anp == NULL) {
3689       goto erret;
3690    }
3691    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
3692       goto erret;
3693    }
3694 
3695    func = NULL;
3696 
3697    atp = AsnReadId(aip, amp, atp);  /* find the choice */
3698    if (atp == NULL) {
3699       goto erret;
3700    }
3701    if (atp == MOLINFO_FIELD_molecule) {
3702       choice = MolinfoField_molecule;
3703       if (AsnReadVal(aip, atp, &av) <= 0) {
3704          goto erret;
3705       }
3706       anp->data.intvalue = av.intvalue;
3707    }
3708    else if (atp == MOLINFO_FIELD_technique) {
3709       choice = MolinfoField_technique;
3710       if (AsnReadVal(aip, atp, &av) <= 0) {
3711          goto erret;
3712       }
3713       anp->data.intvalue = av.intvalue;
3714    }
3715    else if (atp == MOLINFO_FIELD_completedness) {
3716       choice = MolinfoField_completedness;
3717       if (AsnReadVal(aip, atp, &av) <= 0) {
3718          goto erret;
3719       }
3720       anp->data.intvalue = av.intvalue;
3721    }
3722    else if (atp == MOLINFO_FIELD_mol_class) {
3723       choice = MolinfoField_mol_class;
3724       if (AsnReadVal(aip, atp, &av) <= 0) {
3725          goto erret;
3726       }
3727       anp->data.intvalue = av.intvalue;
3728    }
3729    else if (atp == MOLINFO_FIELD_topology) {
3730       choice = MolinfoField_topology;
3731       if (AsnReadVal(aip, atp, &av) <= 0) {
3732          goto erret;
3733       }
3734       anp->data.intvalue = av.intvalue;
3735    }
3736    else if (atp == MOLINFO_FIELD_strand) {
3737       choice = MolinfoField_strand;
3738       if (AsnReadVal(aip, atp, &av) <= 0) {
3739          goto erret;
3740       }
3741       anp->data.intvalue = av.intvalue;
3742    }
3743    anp->choice = choice;
3744    if (func != NULL)
3745    {
3746       anp->data.ptrvalue = (* func)(aip, atp);
3747       if (aip -> io_failure) goto erret;
3748 
3749       if (nullIsError && anp->data.ptrvalue == NULL) {
3750          goto erret;
3751       }
3752    }
3753 
3754 ret:
3755    AsnUnlinkType(orig);       /* unlink local tree */
3756    return anp;
3757 
3758 erret:
3759    anp = MemFree(anp);
3760    aip -> io_failure = TRUE;
3761    goto ret;
3762 }
3763 
3764 
3765 /**************************************************
3766 *
3767 *    MolinfoFieldAsnWrite()
3768 *
3769 **************************************************/
3770 NLM_EXTERN Boolean LIBCALL 
3771 MolinfoFieldAsnWrite(MolinfoFieldPtr anp, AsnIoPtr aip, AsnTypePtr orig)
3772 
3773 {
3774    DataVal av;
3775    AsnTypePtr atp, writetype = NULL;
3776    Pointer pnt;
3777    AsnWriteFunc func = NULL;
3778    Boolean retval = FALSE;
3779 
3780    if (! loaded)
3781    {
3782       if (! objmacroAsnLoad())
3783       return FALSE;
3784    }
3785 
3786    if (aip == NULL)
3787    return FALSE;
3788 
3789    atp = AsnLinkType(orig, MOLINFO_FIELD);   /* link local tree */
3790    if (atp == NULL) {
3791       return FALSE;
3792    }
3793 
3794    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3795 
3796    av.ptrvalue = (Pointer)anp;
3797    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
3798       goto erret;
3799    }
3800 
3801    pnt = anp->data.ptrvalue;
3802    switch (anp->choice)
3803    {
3804    case MolinfoField_molecule:
3805       av.intvalue = anp->data.intvalue;
3806       retval = AsnWrite(aip, MOLINFO_FIELD_molecule, &av);
3807       break;
3808    case MolinfoField_technique:
3809       av.intvalue = anp->data.intvalue;
3810       retval = AsnWrite(aip, MOLINFO_FIELD_technique, &av);
3811       break;
3812    case MolinfoField_completedness:
3813       av.intvalue = anp->data.intvalue;
3814       retval = AsnWrite(aip, MOLINFO_FIELD_completedness, &av);
3815       break;
3816    case MolinfoField_mol_class:
3817       av.intvalue = anp->data.intvalue;
3818       retval = AsnWrite(aip, MOLINFO_FIELD_mol_class, &av);
3819       break;
3820    case MolinfoField_topology:
3821       av.intvalue = anp->data.intvalue;
3822       retval = AsnWrite(aip, MOLINFO_FIELD_topology, &av);
3823       break;
3824    case MolinfoField_strand:
3825       av.intvalue = anp->data.intvalue;
3826       retval = AsnWrite(aip, MOLINFO_FIELD_strand, &av);
3827       break;
3828    }
3829    if (writetype != NULL) {
3830       retval = (* func)(pnt, aip, writetype);   /* write it out */
3831    }
3832    if (!retval) {
3833       goto erret;
3834    }
3835    retval = TRUE;
3836 
3837 erret:
3838    AsnUnlinkType(orig);       /* unlink local tree */
3839    return retval;
3840 }
3841 
3842 
3843 /**************************************************
3844 *
3845 *    MolinfoMoleculePairNew()
3846 *
3847 **************************************************/
3848 NLM_EXTERN 
3849 MolinfoMoleculePairPtr LIBCALL
3850 MolinfoMoleculePairNew(void)
3851 {
3852    MolinfoMoleculePairPtr ptr = MemNew((size_t) sizeof(MolinfoMoleculePair));
3853 
3854    return ptr;
3855 
3856 }
3857 
3858 
3859 /**************************************************
3860 *
3861 *    MolinfoMoleculePairFree()
3862 *
3863 **************************************************/
3864 NLM_EXTERN 
3865 MolinfoMoleculePairPtr LIBCALL
3866 MolinfoMoleculePairFree(MolinfoMoleculePairPtr ptr)
3867 {
3868 
3869    if(ptr == NULL) {
3870       return NULL;
3871    }
3872    return MemFree(ptr);
3873 }
3874 
3875 
3876 /**************************************************
3877 *
3878 *    MolinfoMoleculePairAsnRead()
3879 *
3880 **************************************************/
3881 NLM_EXTERN 
3882 MolinfoMoleculePairPtr LIBCALL
3883 MolinfoMoleculePairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3884 {
3885    DataVal av;
3886    AsnTypePtr atp;
3887    Boolean isError = FALSE;
3888    AsnReadFunc func;
3889    MolinfoMoleculePairPtr ptr;
3890 
3891    if (! loaded)
3892    {
3893       if (! objmacroAsnLoad()) {
3894          return NULL;
3895       }
3896    }
3897 
3898    if (aip == NULL) {
3899       return NULL;
3900    }
3901 
3902    if (orig == NULL) {         /* MolinfoMoleculePair ::= (self contained) */
3903       atp = AsnReadId(aip, amp, MOLINFO_MOLECULE_PAIR);
3904    } else {
3905       atp = AsnLinkType(orig, MOLINFO_MOLECULE_PAIR);
3906    }
3907    /* link in local tree */
3908    if (atp == NULL) {
3909       return NULL;
3910    }
3911 
3912    ptr = MolinfoMoleculePairNew();
3913    if (ptr == NULL) {
3914       goto erret;
3915    }
3916    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3917       goto erret;
3918    }
3919 
3920    atp = AsnReadId(aip,amp, atp);
3921    func = NULL;
3922 
3923    if (atp == MOLINFO_MOLECULE_PAIR_from) {
3924       if ( AsnReadVal(aip, atp, &av) <= 0) {
3925          goto erret;
3926       }
3927       ptr -> from = av.intvalue;
3928       atp = AsnReadId(aip,amp, atp);
3929    }
3930    if (atp == MOLINFO_MOLECULE_PAIR_to) {
3931       if ( AsnReadVal(aip, atp, &av) <= 0) {
3932          goto erret;
3933       }
3934       ptr -> to = av.intvalue;
3935       atp = AsnReadId(aip,amp, atp);
3936    }
3937 
3938    if (AsnReadVal(aip, atp, &av) <= 0) {
3939       goto erret;
3940    }
3941    /* end struct */
3942 
3943 ret:
3944    AsnUnlinkType(orig);       /* unlink local tree */
3945    return ptr;
3946 
3947 erret:
3948    aip -> io_failure = TRUE;
3949    ptr = MolinfoMoleculePairFree(ptr);
3950    goto ret;
3951 }
3952 
3953 
3954 
3955 /**************************************************
3956 *
3957 *    MolinfoMoleculePairAsnWrite()
3958 *
3959 **************************************************/
3960 NLM_EXTERN Boolean LIBCALL 
3961 MolinfoMoleculePairAsnWrite(MolinfoMoleculePairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3962 {
3963    DataVal av;
3964    AsnTypePtr atp;
3965    Boolean retval = FALSE;
3966 
3967    if (! loaded)
3968    {
3969       if (! objmacroAsnLoad()) {
3970          return FALSE;
3971       }
3972    }
3973 
3974    if (aip == NULL) {
3975       return FALSE;
3976    }
3977 
3978    atp = AsnLinkType(orig, MOLINFO_MOLECULE_PAIR);   /* link local tree */
3979    if (atp == NULL) {
3980       return FALSE;
3981    }
3982 
3983    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3984    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3985       goto erret;
3986    }
3987 
3988    av.intvalue = ptr -> from;
3989    retval = AsnWrite(aip, MOLINFO_MOLECULE_PAIR_from,  &av);
3990    av.intvalue = ptr -> to;
3991    retval = AsnWrite(aip, MOLINFO_MOLECULE_PAIR_to,  &av);
3992    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3993       goto erret;
3994    }
3995    retval = TRUE;
3996 
3997 erret:
3998    AsnUnlinkType(orig);       /* unlink local tree */
3999    return retval;
4000 }
4001 
4002 
4003 
4004 /**************************************************
4005 *
4006 *    MolinfoTechniquePairNew()
4007 *
4008 **************************************************/
4009 NLM_EXTERN 
4010 MolinfoTechniquePairPtr LIBCALL
4011 MolinfoTechniquePairNew(void)
4012 {
4013    MolinfoTechniquePairPtr ptr = MemNew((size_t) sizeof(MolinfoTechniquePair));
4014 
4015    return ptr;
4016 
4017 }
4018 
4019 
4020 /**************************************************
4021 *
4022 *    MolinfoTechniquePairFree()
4023 *
4024 **************************************************/
4025 NLM_EXTERN 
4026 MolinfoTechniquePairPtr LIBCALL
4027 MolinfoTechniquePairFree(MolinfoTechniquePairPtr ptr)
4028 {
4029 
4030    if(ptr == NULL) {
4031       return NULL;
4032    }
4033    return MemFree(ptr);
4034 }
4035 
4036 
4037 /**************************************************
4038 *
4039 *    MolinfoTechniquePairAsnRead()
4040 *
4041 **************************************************/
4042 NLM_EXTERN 
4043 MolinfoTechniquePairPtr LIBCALL
4044 MolinfoTechniquePairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4045 {
4046    DataVal av;
4047    AsnTypePtr atp;
4048    Boolean isError = FALSE;
4049    AsnReadFunc func;
4050    MolinfoTechniquePairPtr ptr;
4051 
4052    if (! loaded)
4053    {
4054       if (! objmacroAsnLoad()) {
4055          return NULL;
4056       }
4057    }
4058 
4059    if (aip == NULL) {
4060       return NULL;
4061    }
4062 
4063    if (orig == NULL) {         /* MolinfoTechniquePair ::= (self contained) */
4064       atp = AsnReadId(aip, amp, MOLINFO_TECHNIQUE_PAIR);
4065    } else {
4066       atp = AsnLinkType(orig, MOLINFO_TECHNIQUE_PAIR);
4067    }
4068    /* link in local tree */
4069    if (atp == NULL) {
4070       return NULL;
4071    }
4072 
4073    ptr = MolinfoTechniquePairNew();
4074    if (ptr == NULL) {
4075       goto erret;
4076    }
4077    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4078       goto erret;
4079    }
4080 
4081    atp = AsnReadId(aip,amp, atp);
4082    func = NULL;
4083 
4084    if (atp == MOLINFO_TECHNIQUE_PAIR_from) {
4085       if ( AsnReadVal(aip, atp, &av) <= 0) {
4086          goto erret;
4087       }
4088       ptr -> from = av.intvalue;
4089       atp = AsnReadId(aip,amp, atp);
4090    }
4091    if (atp == MOLINFO_TECHNIQUE_PAIR_to) {
4092       if ( AsnReadVal(aip, atp, &av) <= 0) {
4093          goto erret;
4094       }
4095       ptr -> to = av.intvalue;
4096       atp = AsnReadId(aip,amp, atp);
4097    }
4098 
4099    if (AsnReadVal(aip, atp, &av) <= 0) {
4100       goto erret;
4101    }
4102    /* end struct */
4103 
4104 ret:
4105    AsnUnlinkType(orig);       /* unlink local tree */
4106    return ptr;
4107 
4108 erret:
4109    aip -> io_failure = TRUE;
4110    ptr = MolinfoTechniquePairFree(ptr);
4111    goto ret;
4112 }
4113 
4114 
4115 
4116 /**************************************************
4117 *
4118 *    MolinfoTechniquePairAsnWrite()
4119 *
4120 **************************************************/
4121 NLM_EXTERN Boolean LIBCALL 
4122 MolinfoTechniquePairAsnWrite(MolinfoTechniquePairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4123 {
4124    DataVal av;
4125    AsnTypePtr atp;
4126    Boolean retval = FALSE;
4127 
4128    if (! loaded)
4129    {
4130       if (! objmacroAsnLoad()) {
4131          return FALSE;
4132       }
4133    }
4134 
4135    if (aip == NULL) {
4136       return FALSE;
4137    }
4138 
4139    atp = AsnLinkType(orig, MOLINFO_TECHNIQUE_PAIR);   /* link local tree */
4140    if (atp == NULL) {
4141       return FALSE;
4142    }
4143 
4144    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4145    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4146       goto erret;
4147    }
4148 
4149    av.intvalue = ptr -> from;
4150    retval = AsnWrite(aip, MOLINFO_TECHNIQUE_PAIR_from,  &av);
4151    av.intvalue = ptr -> to;
4152    retval = AsnWrite(aip, MOLINFO_TECHNIQUE_PAIR_to,  &av);
4153    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4154       goto erret;
4155    }
4156    retval = TRUE;
4157 
4158 erret:
4159    AsnUnlinkType(orig);       /* unlink local tree */
4160    return retval;
4161 }
4162 
4163 
4164 
4165 /**************************************************
4166 *
4167 *    MolinfoCompletednessPairNew()
4168 *
4169 **************************************************/
4170 NLM_EXTERN 
4171 MolinfoCompletednessPairPtr LIBCALL
4172 MolinfoCompletednessPairNew(void)
4173 {
4174    MolinfoCompletednessPairPtr ptr = MemNew((size_t) sizeof(MolinfoCompletednessPair));
4175 
4176    return ptr;
4177 
4178 }
4179 
4180 
4181 /**************************************************
4182 *
4183 *    MolinfoCompletednessPairFree()
4184 *
4185 **************************************************/
4186 NLM_EXTERN 
4187 MolinfoCompletednessPairPtr LIBCALL
4188 MolinfoCompletednessPairFree(MolinfoCompletednessPairPtr ptr)
4189 {
4190 
4191    if(ptr == NULL) {
4192       return NULL;
4193    }
4194    return MemFree(ptr);
4195 }
4196 
4197 
4198 /**************************************************
4199 *
4200 *    MolinfoCompletednessPairAsnRead()
4201 *
4202 **************************************************/
4203 NLM_EXTERN 
4204 MolinfoCompletednessPairPtr LIBCALL
4205 MolinfoCompletednessPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4206 {
4207    DataVal av;
4208    AsnTypePtr atp;
4209    Boolean isError = FALSE;
4210    AsnReadFunc func;
4211    MolinfoCompletednessPairPtr ptr;
4212 
4213    if (! loaded)
4214    {
4215       if (! objmacroAsnLoad()) {
4216          return NULL;
4217       }
4218    }
4219 
4220    if (aip == NULL) {
4221       return NULL;
4222    }
4223 
4224    if (orig == NULL) {         /* MolinfoCompletednessPair ::= (self contained) */
4225       atp = AsnReadId(aip, amp, MOLINFO_COMPLETEDNESS_PAIR);
4226    } else {
4227       atp = AsnLinkType(orig, MOLINFO_COMPLETEDNESS_PAIR);
4228    }
4229    /* link in local tree */
4230    if (atp == NULL) {
4231       return NULL;
4232    }
4233 
4234    ptr = MolinfoCompletednessPairNew();
4235    if (ptr == NULL) {
4236       goto erret;
4237    }
4238    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4239       goto erret;
4240    }
4241 
4242    atp = AsnReadId(aip,amp, atp);
4243    func = NULL;
4244 
4245    if (atp == MOLINFO_COMPLETEDNESS_PAIR_from) {
4246       if ( AsnReadVal(aip, atp, &av) <= 0) {
4247          goto erret;
4248       }
4249       ptr -> from = av.intvalue;
4250       atp = AsnReadId(aip,amp, atp);
4251    }
4252    if (atp == MOLINFO_COMPLETEDNESS_PAIR_to) {
4253       if ( AsnReadVal(aip, atp, &av) <= 0) {
4254          goto erret;
4255       }
4256       ptr -> to = av.intvalue;
4257       atp = AsnReadId(aip,amp, atp);
4258    }
4259 
4260    if (AsnReadVal(aip, atp, &av) <= 0) {
4261       goto erret;
4262    }
4263    /* end struct */
4264 
4265 ret:
4266    AsnUnlinkType(orig);       /* unlink local tree */
4267    return ptr;
4268 
4269 erret:
4270    aip -> io_failure = TRUE;
4271    ptr = MolinfoCompletednessPairFree(ptr);
4272    goto ret;
4273 }
4274 
4275 
4276 
4277 /**************************************************
4278 *
4279 *    MolinfoCompletednessPairAsnWrite()
4280 *
4281 **************************************************/
4282 NLM_EXTERN Boolean LIBCALL 
4283 MolinfoCompletednessPairAsnWrite(MolinfoCompletednessPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4284 {
4285    DataVal av;
4286    AsnTypePtr atp;
4287    Boolean retval = FALSE;
4288 
4289    if (! loaded)
4290    {
4291       if (! objmacroAsnLoad()) {
4292          return FALSE;
4293       }
4294    }
4295 
4296    if (aip == NULL) {
4297       return FALSE;
4298    }
4299 
4300    atp = AsnLinkType(orig, MOLINFO_COMPLETEDNESS_PAIR);   /* link local tree */
4301    if (atp == NULL) {
4302       return FALSE;
4303    }
4304 
4305    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4306    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4307       goto erret;
4308    }
4309 
4310    av.intvalue = ptr -> from;
4311    retval = AsnWrite(aip, MOLINFO_COMPLETEDNESS_PAIR_from,  &av);
4312    av.intvalue = ptr -> to;
4313    retval = AsnWrite(aip, MOLINFO_COMPLETEDNESS_PAIR_to,  &av);
4314    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4315       goto erret;
4316    }
4317    retval = TRUE;
4318 
4319 erret:
4320    AsnUnlinkType(orig);       /* unlink local tree */
4321    return retval;
4322 }
4323 
4324 
4325 
4326 /**************************************************
4327 *
4328 *    MolinfoMolClassPairNew()
4329 *
4330 **************************************************/
4331 NLM_EXTERN 
4332 MolinfoMolClassPairPtr LIBCALL
4333 MolinfoMolClassPairNew(void)
4334 {
4335    MolinfoMolClassPairPtr ptr = MemNew((size_t) sizeof(MolinfoMolClassPair));
4336 
4337    return ptr;
4338 
4339 }
4340 
4341 
4342 /**************************************************
4343 *
4344 *    MolinfoMolClassPairFree()
4345 *
4346 **************************************************/
4347 NLM_EXTERN 
4348 MolinfoMolClassPairPtr LIBCALL
4349 MolinfoMolClassPairFree(MolinfoMolClassPairPtr ptr)
4350 {
4351 
4352    if(ptr == NULL) {
4353       return NULL;
4354    }
4355    return MemFree(ptr);
4356 }
4357 
4358 
4359 /**************************************************
4360 *
4361 *    MolinfoMolClassPairAsnRead()
4362 *
4363 **************************************************/
4364 NLM_EXTERN 
4365 MolinfoMolClassPairPtr LIBCALL
4366 MolinfoMolClassPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4367 {
4368    DataVal av;
4369    AsnTypePtr atp;
4370    Boolean isError = FALSE;
4371    AsnReadFunc func;
4372    MolinfoMolClassPairPtr ptr;
4373 
4374    if (! loaded)
4375    {
4376       if (! objmacroAsnLoad()) {
4377          return NULL;
4378       }
4379    }
4380 
4381    if (aip == NULL) {
4382       return NULL;
4383    }
4384 
4385    if (orig == NULL) {         /* MolinfoMolClassPair ::= (self contained) */
4386       atp = AsnReadId(aip, amp, MOLINFO_MOL_CLASS_PAIR);
4387    } else {
4388       atp = AsnLinkType(orig, MOLINFO_MOL_CLASS_PAIR);
4389    }
4390    /* link in local tree */
4391    if (atp == NULL) {
4392       return NULL;
4393    }
4394 
4395    ptr = MolinfoMolClassPairNew();
4396    if (ptr == NULL) {
4397       goto erret;
4398    }
4399    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4400       goto erret;
4401    }
4402 
4403    atp = AsnReadId(aip,amp, atp);
4404    func = NULL;
4405 
4406    if (atp == MOLINFO_MOL_CLASS_PAIR_from) {
4407       if ( AsnReadVal(aip, atp, &av) <= 0) {
4408          goto erret;
4409       }
4410       ptr -> from = av.intvalue;
4411       atp = AsnReadId(aip,amp, atp);
4412    }
4413    if (atp == MOLINFO_MOL_CLASS_PAIR_to) {
4414       if ( AsnReadVal(aip, atp, &av) <= 0) {
4415          goto erret;
4416       }
4417       ptr -> to = av.intvalue;
4418       atp = AsnReadId(aip,amp, atp);
4419    }
4420 
4421    if (AsnReadVal(aip, atp, &av) <= 0) {
4422       goto erret;
4423    }
4424    /* end struct */
4425 
4426 ret:
4427    AsnUnlinkType(orig);       /* unlink local tree */
4428    return ptr;
4429 
4430 erret:
4431    aip -> io_failure = TRUE;
4432    ptr = MolinfoMolClassPairFree(ptr);
4433    goto ret;
4434 }
4435 
4436 
4437 
4438 /**************************************************
4439 *
4440 *    MolinfoMolClassPairAsnWrite()
4441 *
4442 **************************************************/
4443 NLM_EXTERN Boolean LIBCALL 
4444 MolinfoMolClassPairAsnWrite(MolinfoMolClassPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4445 {
4446    DataVal av;
4447    AsnTypePtr atp;
4448    Boolean retval = FALSE;
4449 
4450    if (! loaded)
4451    {
4452       if (! objmacroAsnLoad()) {
4453          return FALSE;
4454       }
4455    }
4456 
4457    if (aip == NULL) {
4458       return FALSE;
4459    }
4460 
4461    atp = AsnLinkType(orig, MOLINFO_MOL_CLASS_PAIR);   /* link local tree */
4462    if (atp == NULL) {
4463       return FALSE;
4464    }
4465 
4466    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4467    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4468       goto erret;
4469    }
4470 
4471    av.intvalue = ptr -> from;
4472    retval = AsnWrite(aip, MOLINFO_MOL_CLASS_PAIR_from,  &av);
4473    av.intvalue = ptr -> to;
4474    retval = AsnWrite(aip, MOLINFO_MOL_CLASS_PAIR_to,  &av);
4475    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4476       goto erret;
4477    }
4478    retval = TRUE;
4479 
4480 erret:
4481    AsnUnlinkType(orig);       /* unlink local tree */
4482    return retval;
4483 }
4484 
4485 
4486 
4487 /**************************************************
4488 *
4489 *    MolinfoTopologyPairNew()
4490 *
4491 **************************************************/
4492 NLM_EXTERN 
4493 MolinfoTopologyPairPtr LIBCALL
4494 MolinfoTopologyPairNew(void)
4495 {
4496    MolinfoTopologyPairPtr ptr = MemNew((size_t) sizeof(MolinfoTopologyPair));
4497 
4498    return ptr;
4499 
4500 }
4501 
4502 
4503 /**************************************************
4504 *
4505 *    MolinfoTopologyPairFree()
4506 *
4507 **************************************************/
4508 NLM_EXTERN 
4509 MolinfoTopologyPairPtr LIBCALL
4510 MolinfoTopologyPairFree(MolinfoTopologyPairPtr ptr)
4511 {
4512 
4513    if(ptr == NULL) {
4514       return NULL;
4515    }
4516    return MemFree(ptr);
4517 }
4518 
4519 
4520 /**************************************************
4521 *
4522 *    MolinfoTopologyPairAsnRead()
4523 *
4524 **************************************************/
4525 NLM_EXTERN 
4526 MolinfoTopologyPairPtr LIBCALL
4527 MolinfoTopologyPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4528 {
4529    DataVal av;
4530    AsnTypePtr atp;
4531    Boolean isError = FALSE;
4532    AsnReadFunc func;
4533    MolinfoTopologyPairPtr ptr;
4534 
4535    if (! loaded)
4536    {
4537       if (! objmacroAsnLoad()) {
4538          return NULL;
4539       }
4540    }
4541 
4542    if (aip == NULL) {
4543       return NULL;
4544    }
4545 
4546    if (orig == NULL) {         /* MolinfoTopologyPair ::= (self contained) */
4547       atp = AsnReadId(aip, amp, MOLINFO_TOPOLOGY_PAIR);
4548    } else {
4549       atp = AsnLinkType(orig, MOLINFO_TOPOLOGY_PAIR);
4550    }
4551    /* link in local tree */
4552    if (atp == NULL) {
4553       return NULL;
4554    }
4555 
4556    ptr = MolinfoTopologyPairNew();
4557    if (ptr == NULL) {
4558       goto erret;
4559    }
4560    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4561       goto erret;
4562    }
4563 
4564    atp = AsnReadId(aip,amp, atp);
4565    func = NULL;
4566 
4567    if (atp == MOLINFO_TOPOLOGY_PAIR_from) {
4568       if ( AsnReadVal(aip, atp, &av) <= 0) {
4569          goto erret;
4570       }
4571       ptr -> from = av.intvalue;
4572       atp = AsnReadId(aip,amp, atp);
4573    }
4574    if (atp == MOLINFO_TOPOLOGY_PAIR_to) {
4575       if ( AsnReadVal(aip, atp, &av) <= 0) {
4576          goto erret;
4577       }
4578       ptr -> to = av.intvalue;
4579       atp = AsnReadId(aip,amp, atp);
4580    }
4581 
4582    if (AsnReadVal(aip, atp, &av) <= 0) {
4583       goto erret;
4584    }
4585    /* end struct */
4586 
4587 ret:
4588    AsnUnlinkType(orig);       /* unlink local tree */
4589    return ptr;
4590 
4591 erret:
4592    aip -> io_failure = TRUE;
4593    ptr = MolinfoTopologyPairFree(ptr);
4594    goto ret;
4595 }
4596 
4597 
4598 
4599 /**************************************************
4600 *
4601 *    MolinfoTopologyPairAsnWrite()
4602 *
4603 **************************************************/
4604 NLM_EXTERN Boolean LIBCALL 
4605 MolinfoTopologyPairAsnWrite(MolinfoTopologyPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4606 {
4607    DataVal av;
4608    AsnTypePtr atp;
4609    Boolean retval = FALSE;
4610 
4611    if (! loaded)
4612    {
4613       if (! objmacroAsnLoad()) {
4614          return FALSE;
4615       }
4616    }
4617 
4618    if (aip == NULL) {
4619       return FALSE;
4620    }
4621 
4622    atp = AsnLinkType(orig, MOLINFO_TOPOLOGY_PAIR);   /* link local tree */
4623    if (atp == NULL) {
4624       return FALSE;
4625    }
4626 
4627    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4628    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4629       goto erret;
4630    }
4631 
4632    av.intvalue = ptr -> from;
4633    retval = AsnWrite(aip, MOLINFO_TOPOLOGY_PAIR_from,  &av);
4634    av.intvalue = ptr -> to;
4635    retval = AsnWrite(aip, MOLINFO_TOPOLOGY_PAIR_to,  &av);
4636    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4637       goto erret;
4638    }
4639    retval = TRUE;
4640 
4641 erret:
4642    AsnUnlinkType(orig);       /* unlink local tree */
4643    return retval;
4644 }
4645 
4646 
4647 
4648 /**************************************************
4649 *
4650 *    MolinfoStrandPairNew()
4651 *
4652 **************************************************/
4653 NLM_EXTERN 
4654 MolinfoStrandPairPtr LIBCALL
4655 MolinfoStrandPairNew(void)
4656 {
4657    MolinfoStrandPairPtr ptr = MemNew((size_t) sizeof(MolinfoStrandPair));
4658 
4659    return ptr;
4660 
4661 }
4662 
4663 
4664 /**************************************************
4665 *
4666 *    MolinfoStrandPairFree()
4667 *
4668 **************************************************/
4669 NLM_EXTERN 
4670 MolinfoStrandPairPtr LIBCALL
4671 MolinfoStrandPairFree(MolinfoStrandPairPtr ptr)
4672 {
4673 
4674    if(ptr == NULL) {
4675       return NULL;
4676    }
4677    return MemFree(ptr);
4678 }
4679 
4680 
4681 /**************************************************
4682 *
4683 *    MolinfoStrandPairAsnRead()
4684 *
4685 **************************************************/
4686 NLM_EXTERN 
4687 MolinfoStrandPairPtr LIBCALL
4688 MolinfoStrandPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4689 {
4690    DataVal av;
4691    AsnTypePtr atp;
4692    Boolean isError = FALSE;
4693    AsnReadFunc func;
4694    MolinfoStrandPairPtr ptr;
4695 
4696    if (! loaded)
4697    {
4698       if (! objmacroAsnLoad()) {
4699          return NULL;
4700       }
4701    }
4702 
4703    if (aip == NULL) {
4704       return NULL;
4705    }
4706 
4707    if (orig == NULL) {         /* MolinfoStrandPair ::= (self contained) */
4708       atp = AsnReadId(aip, amp, MOLINFO_STRAND_PAIR);
4709    } else {
4710       atp = AsnLinkType(orig, MOLINFO_STRAND_PAIR);
4711    }
4712    /* link in local tree */
4713    if (atp == NULL) {
4714       return NULL;
4715    }
4716 
4717    ptr = MolinfoStrandPairNew();
4718    if (ptr == NULL) {
4719       goto erret;
4720    }
4721    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4722       goto erret;
4723    }
4724 
4725    atp = AsnReadId(aip,amp, atp);
4726    func = NULL;
4727 
4728    if (atp == MOLINFO_STRAND_PAIR_from) {
4729       if ( AsnReadVal(aip, atp, &av) <= 0) {
4730          goto erret;
4731       }
4732       ptr -> from = av.intvalue;
4733       atp = AsnReadId(aip,amp, atp);
4734    }
4735    if (atp == MOLINFO_STRAND_PAIR_to) {
4736       if ( AsnReadVal(aip, atp, &av) <= 0) {
4737          goto erret;
4738       }
4739       ptr -> to = av.intvalue;
4740       atp = AsnReadId(aip,amp, atp);
4741    }
4742 
4743    if (AsnReadVal(aip, atp, &av) <= 0) {
4744       goto erret;
4745    }
4746    /* end struct */
4747 
4748 ret:
4749    AsnUnlinkType(orig);       /* unlink local tree */
4750    return ptr;
4751 
4752 erret:
4753    aip -> io_failure = TRUE;
4754    ptr = MolinfoStrandPairFree(ptr);
4755    goto ret;
4756 }
4757 
4758 
4759 
4760 /**************************************************
4761 *
4762 *    MolinfoStrandPairAsnWrite()
4763 *
4764 **************************************************/
4765 NLM_EXTERN Boolean LIBCALL 
4766 MolinfoStrandPairAsnWrite(MolinfoStrandPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4767 {
4768    DataVal av;
4769    AsnTypePtr atp;
4770    Boolean retval = FALSE;
4771 
4772    if (! loaded)
4773    {
4774       if (! objmacroAsnLoad()) {
4775          return FALSE;
4776       }
4777    }
4778 
4779    if (aip == NULL) {
4780       return FALSE;
4781    }
4782 
4783    atp = AsnLinkType(orig, MOLINFO_STRAND_PAIR);   /* link local tree */
4784    if (atp == NULL) {
4785       return FALSE;
4786    }
4787 
4788    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4789    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4790       goto erret;
4791    }
4792 
4793    av.intvalue = ptr -> from;
4794    retval = AsnWrite(aip, MOLINFO_STRAND_PAIR_from,  &av);
4795    av.intvalue = ptr -> to;
4796    retval = AsnWrite(aip, MOLINFO_STRAND_PAIR_to,  &av);
4797    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4798       goto erret;
4799    }
4800    retval = TRUE;
4801 
4802 erret:
4803    AsnUnlinkType(orig);       /* unlink local tree */
4804    return retval;
4805 }
4806 
4807 
4808 
4809 /**************************************************
4810 *
4811 *    MolinfoFieldPairFree()
4812 *
4813 **************************************************/
4814 NLM_EXTERN 
4815 MolinfoFieldPairPtr LIBCALL
4816 MolinfoFieldPairFree(ValNodePtr anp)
4817 {
4818    Pointer pnt;
4819 
4820    if (anp == NULL) {
4821       return NULL;
4822    }
4823 
4824    pnt = anp->data.ptrvalue;
4825    switch (anp->choice)
4826    {
4827    default:
4828       break;
4829    case MolinfoFieldPair_molecule:
4830       MolinfoMoleculePairFree(anp -> data.ptrvalue);
4831       break;
4832    case MolinfoFieldPair_technique:
4833       MolinfoTechniquePairFree(anp -> data.ptrvalue);
4834       break;
4835    case MolinfoFieldPair_completedness:
4836       MolinfoCompletednessPairFree(anp -> data.ptrvalue);
4837       break;
4838    case MolinfoFieldPair_mol_class:
4839       MolinfoMolClassPairFree(anp -> data.ptrvalue);
4840       break;
4841    case MolinfoFieldPair_topology:
4842       MolinfoTopologyPairFree(anp -> data.ptrvalue);
4843       break;
4844    case MolinfoFieldPair_strand:
4845       MolinfoStrandPairFree(anp -> data.ptrvalue);
4846       break;
4847    }
4848    return MemFree(anp);
4849 }
4850 
4851 
4852 /**************************************************
4853 *
4854 *    MolinfoFieldPairAsnRead()
4855 *
4856 **************************************************/
4857 NLM_EXTERN 
4858 MolinfoFieldPairPtr LIBCALL
4859 MolinfoFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4860 {
4861    DataVal av;
4862    AsnTypePtr atp;
4863    ValNodePtr anp;
4864    Uint1 choice;
4865    Boolean isError = FALSE;
4866    Boolean nullIsError = FALSE;
4867    AsnReadFunc func;
4868 
4869    if (! loaded)
4870    {
4871       if (! objmacroAsnLoad()) {
4872          return NULL;
4873       }
4874    }
4875 
4876    if (aip == NULL) {
4877       return NULL;
4878    }
4879 
4880    if (orig == NULL) {         /* MolinfoFieldPair ::= (self contained) */
4881       atp = AsnReadId(aip, amp, MOLINFO_FIELD_PAIR);
4882    } else {
4883       atp = AsnLinkType(orig, MOLINFO_FIELD_PAIR);    /* link in local tree */
4884    }
4885    if (atp == NULL) {
4886       return NULL;
4887    }
4888 
4889    anp = ValNodeNew(NULL);
4890    if (anp == NULL) {
4891       goto erret;
4892    }
4893    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
4894       goto erret;
4895    }
4896 
4897    func = NULL;
4898 
4899    atp = AsnReadId(aip, amp, atp);  /* find the choice */
4900    if (atp == NULL) {
4901       goto erret;
4902    }
4903    if (atp == MOLINFO_FIELD_PAIR_molecule) {
4904       choice = MolinfoFieldPair_molecule;
4905       func = (AsnReadFunc) MolinfoMoleculePairAsnRead;
4906    }
4907    else if (atp == MOLINFO_FIELD_PAIR_technique) {
4908       choice = MolinfoFieldPair_technique;
4909       func = (AsnReadFunc) MolinfoTechniquePairAsnRead;
4910    }
4911    else if (atp == FIELD_PAIR_completedness) {
4912       choice = MolinfoFieldPair_completedness;
4913       func = (AsnReadFunc) MolinfoCompletednessPairAsnRead;
4914    }
4915    else if (atp == MOLINFO_FIELD_PAIR_mol_class) {
4916       choice = MolinfoFieldPair_mol_class;
4917       func = (AsnReadFunc) MolinfoMolClassPairAsnRead;
4918    }
4919    else if (atp == MOLINFO_FIELD_PAIR_topology) {
4920       choice = MolinfoFieldPair_topology;
4921       func = (AsnReadFunc) MolinfoTopologyPairAsnRead;
4922    }
4923    else if (atp == MOLINFO_FIELD_PAIR_strand) {
4924       choice = MolinfoFieldPair_strand;
4925       func = (AsnReadFunc) MolinfoStrandPairAsnRead;
4926    }
4927    anp->choice = choice;
4928    if (func != NULL)
4929    {
4930       anp->data.ptrvalue = (* func)(aip, atp);
4931       if (aip -> io_failure) goto erret;
4932 
4933       if (nullIsError && anp->data.ptrvalue == NULL) {
4934          goto erret;
4935       }
4936    }
4937 
4938 ret:
4939    AsnUnlinkType(orig);       /* unlink local tree */
4940    return anp;
4941 
4942 erret:
4943    anp = MemFree(anp);
4944    aip -> io_failure = TRUE;
4945    goto ret;
4946 }
4947 
4948 
4949 /**************************************************
4950 *
4951 *    MolinfoFieldPairAsnWrite()
4952 *
4953 **************************************************/
4954 NLM_EXTERN Boolean LIBCALL 
4955 MolinfoFieldPairAsnWrite(MolinfoFieldPairPtr anp, AsnIoPtr aip, AsnTypePtr orig)
4956 
4957 {
4958    DataVal av;
4959    AsnTypePtr atp, writetype = NULL;
4960    Pointer pnt;
4961    AsnWriteFunc func = NULL;
4962    Boolean retval = FALSE;
4963 
4964    if (! loaded)
4965    {
4966       if (! objmacroAsnLoad())
4967       return FALSE;
4968    }
4969 
4970    if (aip == NULL)
4971    return FALSE;
4972 
4973    atp = AsnLinkType(orig, MOLINFO_FIELD_PAIR);   /* link local tree */
4974    if (atp == NULL) {
4975       return FALSE;
4976    }
4977 
4978    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4979 
4980    av.ptrvalue = (Pointer)anp;
4981    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
4982       goto erret;
4983    }
4984 
4985    pnt = anp->data.ptrvalue;
4986    switch (anp->choice)
4987    {
4988    case MolinfoFieldPair_molecule:
4989       writetype = MOLINFO_FIELD_PAIR_molecule;
4990       func = (AsnWriteFunc) MolinfoMoleculePairAsnWrite;
4991       break;
4992    case MolinfoFieldPair_technique:
4993       writetype = MOLINFO_FIELD_PAIR_technique;
4994       func = (AsnWriteFunc) MolinfoTechniquePairAsnWrite;
4995       break;
4996    case MolinfoFieldPair_completedness:
4997       writetype = FIELD_PAIR_completedness;
4998       func = (AsnWriteFunc) MolinfoCompletednessPairAsnWrite;
4999       break;
5000    case MolinfoFieldPair_mol_class:
5001       writetype = MOLINFO_FIELD_PAIR_mol_class;
5002       func = (AsnWriteFunc) MolinfoMolClassPairAsnWrite;
5003       break;
5004    case MolinfoFieldPair_topology:
5005       writetype = MOLINFO_FIELD_PAIR_topology;
5006       func = (AsnWriteFunc) MolinfoTopologyPairAsnWrite;
5007       break;
5008    case MolinfoFieldPair_strand:
5009       writetype = MOLINFO_FIELD_PAIR_strand;
5010       func = (AsnWriteFunc) MolinfoStrandPairAsnWrite;
5011       break;
5012    }
5013    if (writetype != NULL) {
5014       retval = (* func)(pnt, aip, writetype);   /* write it out */
5015    }
5016    if (!retval) {
5017       goto erret;
5018    }
5019    retval = TRUE;
5020 
5021 erret:
5022    AsnUnlinkType(orig);       /* unlink local tree */
5023    return retval;
5024 }
5025 
5026 
5027 /**************************************************
5028 *
5029 *    MolinfoFieldListFree()
5030 *
5031 **************************************************/
5032 NLM_EXTERN 
5033 MolinfoFieldListPtr LIBCALL
5034 MolinfoFieldListFree(MolinfoFieldListPtr ptr)
5035 {
5036 
5037    if(ptr == NULL) {
5038       return NULL;
5039    }
5040    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) MolinfoFieldFree);
5041    return NULL;
5042 }
5043 
5044 
5045 /**************************************************
5046 *
5047 *    MolinfoFieldListAsnRead()
5048 *
5049 **************************************************/
5050 NLM_EXTERN 
5051 MolinfoFieldListPtr LIBCALL
5052 MolinfoFieldListAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5053 {
5054    DataVal av;
5055    AsnTypePtr atp;
5056    Boolean isError = FALSE;
5057    AsnReadFunc func;
5058    MolinfoFieldListPtr ptr;
5059 
5060    if (! loaded)
5061    {
5062       if (! objmacroAsnLoad()) {
5063          return NULL;
5064       }
5065    }
5066 
5067    if (aip == NULL) {
5068       return NULL;
5069    }
5070 
5071    if (orig == NULL) {         /* MolinfoFieldList ::= (self contained) */
5072       atp = AsnReadId(aip, amp, MOLINFO_FIELD_LIST);
5073    } else {
5074       atp = AsnLinkType(orig, MOLINFO_FIELD_LIST);
5075    }
5076    /* link in local tree */
5077    if (atp == NULL) {
5078       return NULL;
5079    }
5080 
5081    func = NULL;
5082 
5083    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MolinfoFieldAsnRead, (AsnOptFreeFunc) MolinfoFieldFree);
5084    if (isError && ptr  == NULL) {
5085       goto erret;
5086    }
5087 
5088 
5089 
5090 ret:
5091    AsnUnlinkType(orig);       /* unlink local tree */
5092    return ptr;
5093 
5094 erret:
5095    aip -> io_failure = TRUE;
5096    ptr = MolinfoFieldListFree(ptr);
5097    goto ret;
5098 }
5099 
5100 
5101 
5102 /**************************************************
5103 *
5104 *    MolinfoFieldListAsnWrite()
5105 *
5106 **************************************************/
5107 NLM_EXTERN Boolean LIBCALL 
5108 MolinfoFieldListAsnWrite(MolinfoFieldListPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5109 {
5110    DataVal av;
5111    AsnTypePtr atp;
5112    Boolean retval = FALSE;
5113 
5114    if (! loaded)
5115    {
5116       if (! objmacroAsnLoad()) {
5117          return FALSE;
5118       }
5119    }
5120 
5121    if (aip == NULL) {
5122       return FALSE;
5123    }
5124 
5125    atp = AsnLinkType(orig, MOLINFO_FIELD_LIST);   /* link local tree */
5126    if (atp == NULL) {
5127       return FALSE;
5128    }
5129 
5130    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5131    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) MolinfoFieldAsnWrite, aip, atp, MOLINFO_FIELD_LIST_E);
5132    retval = TRUE;
5133 
5134 erret:
5135    AsnUnlinkType(orig);       /* unlink local tree */
5136    return retval;
5137 }
5138 
5139 
5140 
5141 /**************************************************
5142 *
5143 *    StructuredCommentFieldFree()
5144 *
5145 **************************************************/
5146 NLM_EXTERN 
5147 StructuredCommentFieldPtr LIBCALL
5148 StructuredCommentFieldFree(ValNodePtr anp)
5149 {
5150    Pointer pnt;
5151 
5152    if (anp == NULL) {
5153       return NULL;
5154    }
5155 
5156    pnt = anp->data.ptrvalue;
5157    switch (anp->choice)
5158    {
5159    default:
5160       break;
5161    case StructuredCommentField_named:
5162       MemFree(anp -> data.ptrvalue);
5163       break;
5164    }
5165    return MemFree(anp);
5166 }
5167 
5168 
5169 /**************************************************
5170 *
5171 *    StructuredCommentFieldAsnRead()
5172 *
5173 **************************************************/
5174 NLM_EXTERN 
5175 StructuredCommentFieldPtr LIBCALL
5176 StructuredCommentFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5177 {
5178    DataVal av;
5179    AsnTypePtr atp;
5180    ValNodePtr anp;
5181    Uint1 choice;
5182    Boolean isError = FALSE;
5183    Boolean nullIsError = FALSE;
5184    AsnReadFunc func;
5185 
5186    if (! loaded)
5187    {
5188       if (! objmacroAsnLoad()) {
5189          return NULL;
5190       }
5191    }
5192 
5193    if (aip == NULL) {
5194       return NULL;
5195    }
5196 
5197    if (orig == NULL) {         /* StructuredCommentField ::= (self contained) */
5198       atp = AsnReadId(aip, amp, STRUCTURED_COMMENT_FIELD);
5199    } else {
5200       atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD);    /* link in local tree */
5201    }
5202    if (atp == NULL) {
5203       return NULL;
5204    }
5205 
5206    anp = ValNodeNew(NULL);
5207    if (anp == NULL) {
5208       goto erret;
5209    }
5210    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
5211       goto erret;
5212    }
5213 
5214    func = NULL;
5215 
5216    atp = AsnReadId(aip, amp, atp);  /* find the choice */
5217    if (atp == NULL) {
5218       goto erret;
5219    }
5220    if (atp == COMMENT_FIELD_database) {
5221       choice = StructuredCommentField_database;
5222       if (AsnReadVal(aip, atp, &av) <= 0) {
5223          goto erret;
5224       }
5225       anp->data.boolvalue = av.boolvalue;
5226    }
5227    else if (atp == STRUCTURED_COMMENT_FIELD_named) {
5228       choice = StructuredCommentField_named;
5229       if (AsnReadVal(aip, atp, &av) <= 0) {
5230          goto erret;
5231       }
5232       anp->data.ptrvalue = av.ptrvalue;
5233    }
5234    else if (atp == COMMENT_FIELD_field_name) {
5235       choice = StructuredCommentField_field_name;
5236       if (AsnReadVal(aip, atp, &av) <= 0) {
5237          goto erret;
5238       }
5239       anp->data.boolvalue = av.boolvalue;
5240    }
5241    anp->choice = choice;
5242    if (func != NULL)
5243    {
5244       anp->data.ptrvalue = (* func)(aip, atp);
5245       if (aip -> io_failure) goto erret;
5246 
5247       if (nullIsError && anp->data.ptrvalue == NULL) {
5248          goto erret;
5249       }
5250    }
5251 
5252 ret:
5253    AsnUnlinkType(orig);       /* unlink local tree */
5254    return anp;
5255 
5256 erret:
5257    anp = MemFree(anp);
5258    aip -> io_failure = TRUE;
5259    goto ret;
5260 }
5261 
5262 
5263 /**************************************************
5264 *
5265 *    StructuredCommentFieldAsnWrite()
5266 *
5267 **************************************************/
5268 NLM_EXTERN Boolean LIBCALL 
5269 StructuredCommentFieldAsnWrite(StructuredCommentFieldPtr anp, AsnIoPtr aip, AsnTypePtr orig)
5270 
5271 {
5272    DataVal av;
5273    AsnTypePtr atp, writetype = NULL;
5274    Pointer pnt;
5275    AsnWriteFunc func = NULL;
5276    Boolean retval = FALSE;
5277 
5278    if (! loaded)
5279    {
5280       if (! objmacroAsnLoad())
5281       return FALSE;
5282    }
5283 
5284    if (aip == NULL)
5285    return FALSE;
5286 
5287    atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD);   /* link local tree */
5288    if (atp == NULL) {
5289       return FALSE;
5290    }
5291 
5292    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5293 
5294    av.ptrvalue = (Pointer)anp;
5295    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
5296       goto erret;
5297    }
5298 
5299    pnt = anp->data.ptrvalue;
5300    switch (anp->choice)
5301    {
5302    case StructuredCommentField_database:
5303       av.boolvalue = anp->data.boolvalue;
5304       retval = AsnWrite(aip, COMMENT_FIELD_database, &av);
5305       break;
5306    case StructuredCommentField_named:
5307       av.ptrvalue = anp->data.ptrvalue;
5308       retval = AsnWrite(aip, STRUCTURED_COMMENT_FIELD_named, &av);
5309       break;
5310    case StructuredCommentField_field_name:
5311       av.boolvalue = anp->data.boolvalue;
5312       retval = AsnWrite(aip, COMMENT_FIELD_field_name, &av);
5313       break;
5314    }
5315    if (writetype != NULL) {
5316       retval = (* func)(pnt, aip, writetype);   /* write it out */
5317    }
5318    if (!retval) {
5319       goto erret;
5320    }
5321    retval = TRUE;
5322 
5323 erret:
5324    AsnUnlinkType(orig);       /* unlink local tree */
5325    return retval;
5326 }
5327 
5328 
5329 /**************************************************
5330 *
5331 *    StructuredCommentFieldPairNew()
5332 *
5333 **************************************************/
5334 NLM_EXTERN 
5335 StructuredCommentFieldPairPtr LIBCALL
5336 StructuredCommentFieldPairNew(void)
5337 {
5338    StructuredCommentFieldPairPtr ptr = MemNew((size_t) sizeof(StructuredCommentFieldPair));
5339 
5340    return ptr;
5341 
5342 }
5343 
5344 
5345 /**************************************************
5346 *
5347 *    StructuredCommentFieldPairFree()
5348 *
5349 **************************************************/
5350 NLM_EXTERN 
5351 StructuredCommentFieldPairPtr LIBCALL
5352 StructuredCommentFieldPairFree(StructuredCommentFieldPairPtr ptr)
5353 {
5354 
5355    if(ptr == NULL) {
5356       return NULL;
5357    }
5358    StructuredCommentFieldFree(ptr -> from);
5359    StructuredCommentFieldFree(ptr -> to);
5360    return MemFree(ptr);
5361 }
5362 
5363 
5364 /**************************************************
5365 *
5366 *    StructuredCommentFieldPairAsnRead()
5367 *
5368 **************************************************/
5369 NLM_EXTERN 
5370 StructuredCommentFieldPairPtr LIBCALL
5371 StructuredCommentFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5372 {
5373    DataVal av;
5374    AsnTypePtr atp;
5375    Boolean isError = FALSE;
5376    AsnReadFunc func;
5377    StructuredCommentFieldPairPtr ptr;
5378 
5379    if (! loaded)
5380    {
5381       if (! objmacroAsnLoad()) {
5382          return NULL;
5383       }
5384    }
5385 
5386    if (aip == NULL) {
5387       return NULL;
5388    }
5389 
5390    if (orig == NULL) {         /* StructuredCommentFieldPair ::= (self contained) */
5391       atp = AsnReadId(aip, amp, STRUCTURED_COMMENT_FIELD_PAIR);
5392    } else {
5393       atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD_PAIR);
5394    }
5395    /* link in local tree */
5396    if (atp == NULL) {
5397       return NULL;
5398    }
5399 
5400    ptr = StructuredCommentFieldPairNew();
5401    if (ptr == NULL) {
5402       goto erret;
5403    }
5404    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5405       goto erret;
5406    }
5407 
5408    atp = AsnReadId(aip,amp, atp);
5409    func = NULL;
5410 
5411    if (atp == COMMENT_FIELD_PAIR_from) {
5412       ptr -> from = StructuredCommentFieldAsnRead(aip, atp);
5413       if (aip -> io_failure) {
5414          goto erret;
5415       }
5416       atp = AsnReadId(aip,amp, atp);
5417    }
5418    if (atp == COMMENT_FIELD_PAIR_to) {
5419       ptr -> to = StructuredCommentFieldAsnRead(aip, atp);
5420       if (aip -> io_failure) {
5421          goto erret;
5422       }
5423       atp = AsnReadId(aip,amp, atp);
5424    }
5425 
5426    if (AsnReadVal(aip, atp, &av) <= 0) {
5427       goto erret;
5428    }
5429    /* end struct */
5430 
5431 ret:
5432    AsnUnlinkType(orig);       /* unlink local tree */
5433    return ptr;
5434 
5435 erret:
5436    aip -> io_failure = TRUE;
5437    ptr = StructuredCommentFieldPairFree(ptr);
5438    goto ret;
5439 }
5440 
5441 
5442 
5443 /**************************************************
5444 *
5445 *    StructuredCommentFieldPairAsnWrite()
5446 *
5447 **************************************************/
5448 NLM_EXTERN Boolean LIBCALL 
5449 StructuredCommentFieldPairAsnWrite(StructuredCommentFieldPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5450 {
5451    DataVal av;
5452    AsnTypePtr atp;
5453    Boolean retval = FALSE;
5454 
5455    if (! loaded)
5456    {
5457       if (! objmacroAsnLoad()) {
5458          return FALSE;
5459       }
5460    }
5461 
5462    if (aip == NULL) {
5463       return FALSE;
5464    }
5465 
5466    atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD_PAIR);   /* link local tree */
5467    if (atp == NULL) {
5468       return FALSE;
5469    }
5470 
5471    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5472    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5473       goto erret;
5474    }
5475 
5476    if (ptr -> from != NULL) {
5477       if ( ! StructuredCommentFieldAsnWrite(ptr -> from, aip, COMMENT_FIELD_PAIR_from)) {
5478          goto erret;
5479       }
5480    }
5481    if (ptr -> to != NULL) {
5482       if ( ! StructuredCommentFieldAsnWrite(ptr -> to, aip, COMMENT_FIELD_PAIR_to)) {
5483          goto erret;
5484       }
5485    }
5486    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5487       goto erret;
5488    }
5489    retval = TRUE;
5490 
5491 erret:
5492    AsnUnlinkType(orig);       /* unlink local tree */
5493    return retval;
5494 }
5495 
5496 
5497 
5498 /**************************************************
5499 *
5500 *    PubFieldConstraintNew()
5501 *
5502 **************************************************/
5503 NLM_EXTERN 
5504 PubFieldConstraintPtr LIBCALL
5505 PubFieldConstraintNew(void)
5506 {
5507    PubFieldConstraintPtr ptr = MemNew((size_t) sizeof(PubFieldConstraint));
5508 
5509    return ptr;
5510 
5511 }
5512 
5513 
5514 /**************************************************
5515 *
5516 *    PubFieldConstraintFree()
5517 *
5518 **************************************************/
5519 NLM_EXTERN 
5520 PubFieldConstraintPtr LIBCALL
5521 PubFieldConstraintFree(PubFieldConstraintPtr ptr)
5522 {
5523 
5524    if(ptr == NULL) {
5525       return NULL;
5526    }
5527    StringConstraintFree(ptr -> constraint);
5528    return MemFree(ptr);
5529 }
5530 
5531 
5532 /**************************************************
5533 *
5534 *    PubFieldConstraintAsnRead()
5535 *
5536 **************************************************/
5537 NLM_EXTERN 
5538 PubFieldConstraintPtr LIBCALL
5539 PubFieldConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5540 {
5541    DataVal av;
5542    AsnTypePtr atp;
5543    Boolean isError = FALSE;
5544    AsnReadFunc func;
5545    PubFieldConstraintPtr ptr;
5546 
5547    if (! loaded)
5548    {
5549       if (! objmacroAsnLoad()) {
5550          return NULL;
5551       }
5552    }
5553 
5554    if (aip == NULL) {
5555       return NULL;
5556    }
5557 
5558    if (orig == NULL) {         /* PubFieldConstraint ::= (self contained) */
5559       atp = AsnReadId(aip, amp, PUB_FIELD_CONSTRAINT);
5560    } else {
5561       atp = AsnLinkType(orig, PUB_FIELD_CONSTRAINT);
5562    }
5563    /* link in local tree */
5564    if (atp == NULL) {
5565       return NULL;
5566    }
5567 
5568    ptr = PubFieldConstraintNew();
5569    if (ptr == NULL) {
5570       goto erret;
5571    }
5572    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5573       goto erret;
5574    }
5575 
5576    atp = AsnReadId(aip,amp, atp);
5577    func = NULL;
5578 
5579    if (atp == PUB_FIELD_CONSTRAINT_field) {
5580       if ( AsnReadVal(aip, atp, &av) <= 0) {
5581          goto erret;
5582       }
5583       ptr -> field = av.intvalue;
5584       atp = AsnReadId(aip,amp, atp);
5585    }
5586    if (atp == PUB_FIELD_CONSTRAINT_constraint) {
5587       ptr -> constraint = StringConstraintAsnRead(aip, atp);
5588       if (aip -> io_failure) {
5589          goto erret;
5590       }
5591       atp = AsnReadId(aip,amp, atp);
5592    }
5593 
5594    if (AsnReadVal(aip, atp, &av) <= 0) {
5595       goto erret;
5596    }
5597    /* end struct */
5598 
5599 ret:
5600    AsnUnlinkType(orig);       /* unlink local tree */
5601    return ptr;
5602 
5603 erret:
5604    aip -> io_failure = TRUE;
5605    ptr = PubFieldConstraintFree(ptr);
5606    goto ret;
5607 }
5608 
5609 
5610 
5611 /**************************************************
5612 *
5613 *    PubFieldConstraintAsnWrite()
5614 *
5615 **************************************************/
5616 NLM_EXTERN Boolean LIBCALL 
5617 PubFieldConstraintAsnWrite(PubFieldConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5618 {
5619    DataVal av;
5620    AsnTypePtr atp;
5621    Boolean retval = FALSE;
5622 
5623    if (! loaded)
5624    {
5625       if (! objmacroAsnLoad()) {
5626          return FALSE;
5627       }
5628    }
5629 
5630    if (aip == NULL) {
5631       return FALSE;
5632    }
5633 
5634    atp = AsnLinkType(orig, PUB_FIELD_CONSTRAINT);   /* link local tree */
5635    if (atp == NULL) {
5636       return FALSE;
5637    }
5638 
5639    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5640    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5641       goto erret;
5642    }
5643 
5644    av.intvalue = ptr -> field;
5645    retval = AsnWrite(aip, PUB_FIELD_CONSTRAINT_field,  &av);
5646    if (ptr -> constraint != NULL) {
5647       if ( ! StringConstraintAsnWrite(ptr -> constraint, aip, PUB_FIELD_CONSTRAINT_constraint)) {
5648          goto erret;
5649       }
5650    }
5651    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5652       goto erret;
5653    }
5654    retval = TRUE;
5655 
5656 erret:
5657    AsnUnlinkType(orig);       /* unlink local tree */
5658    return retval;
5659 }
5660 
5661 
5662 
5663 /**************************************************
5664 *
5665 *    PublicationConstraintNew()
5666 *
5667 **************************************************/
5668 NLM_EXTERN 
5669 PublicationConstraintPtr LIBCALL
5670 PublicationConstraintNew(void)
5671 {
5672    PublicationConstraintPtr ptr = MemNew((size_t) sizeof(PublicationConstraint));
5673 
5674    return ptr;
5675 
5676 }
5677 
5678 
5679 /**************************************************
5680 *
5681 *    PublicationConstraintFree()
5682 *
5683 **************************************************/
5684 NLM_EXTERN 
5685 PublicationConstraintPtr LIBCALL
5686 PublicationConstraintFree(PublicationConstraintPtr ptr)
5687 {
5688 
5689    if(ptr == NULL) {
5690       return NULL;
5691    }
5692    PubFieldConstraintFree(ptr -> field);
5693    return MemFree(ptr);
5694 }
5695 
5696 
5697 /**************************************************
5698 *
5699 *    PublicationConstraintAsnRead()
5700 *
5701 **************************************************/
5702 NLM_EXTERN 
5703 PublicationConstraintPtr LIBCALL
5704 PublicationConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5705 {
5706    DataVal av;
5707    AsnTypePtr atp;
5708    Boolean isError = FALSE;
5709    AsnReadFunc func;
5710    PublicationConstraintPtr ptr;
5711 
5712    if (! loaded)
5713    {
5714       if (! objmacroAsnLoad()) {
5715          return NULL;
5716       }
5717    }
5718 
5719    if (aip == NULL) {
5720       return NULL;
5721    }
5722 
5723    if (orig == NULL) {         /* PublicationConstraint ::= (self contained) */
5724       atp = AsnReadId(aip, amp, PUBLICATION_CONSTRAINT);
5725    } else {
5726       atp = AsnLinkType(orig, PUBLICATION_CONSTRAINT);
5727    }
5728    /* link in local tree */
5729    if (atp == NULL) {
5730       return NULL;
5731    }
5732 
5733    ptr = PublicationConstraintNew();
5734    if (ptr == NULL) {
5735       goto erret;
5736    }
5737    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5738       goto erret;
5739    }
5740 
5741    atp = AsnReadId(aip,amp, atp);
5742    func = NULL;
5743 
5744    if (atp == PUBLICATION_CONSTRAINT_type) {
5745       if ( AsnReadVal(aip, atp, &av) <= 0) {
5746          goto erret;
5747       }
5748       ptr -> type = av.intvalue;
5749       atp = AsnReadId(aip,amp, atp);
5750    }
5751    if (atp == PUBLICATION_CONSTRAINT_field) {
5752       ptr -> field = PubFieldConstraintAsnRead(aip, atp);
5753       if (aip -> io_failure) {
5754          goto erret;
5755       }
5756       atp = AsnReadId(aip,amp, atp);
5757    }
5758 
5759    if (AsnReadVal(aip, atp, &av) <= 0) {
5760       goto erret;
5761    }
5762    /* end struct */
5763 
5764 ret:
5765    AsnUnlinkType(orig);       /* unlink local tree */
5766    return ptr;
5767 
5768 erret:
5769    aip -> io_failure = TRUE;
5770    ptr = PublicationConstraintFree(ptr);
5771    goto ret;
5772 }
5773 
5774 
5775 
5776 /**************************************************
5777 *
5778 *    PublicationConstraintAsnWrite()
5779 *
5780 **************************************************/
5781 NLM_EXTERN Boolean LIBCALL 
5782 PublicationConstraintAsnWrite(PublicationConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5783 {
5784    DataVal av;
5785    AsnTypePtr atp;
5786    Boolean retval = FALSE;
5787 
5788    if (! loaded)
5789    {
5790       if (! objmacroAsnLoad()) {
5791          return FALSE;
5792       }
5793    }
5794 
5795    if (aip == NULL) {
5796       return FALSE;
5797    }
5798 
5799    atp = AsnLinkType(orig, PUBLICATION_CONSTRAINT);   /* link local tree */
5800    if (atp == NULL) {
5801       return FALSE;
5802    }
5803 
5804    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5805    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5806       goto erret;
5807    }
5808 
5809    av.intvalue = ptr -> type;
5810    retval = AsnWrite(aip, PUBLICATION_CONSTRAINT_type,  &av);
5811    if (ptr -> field != NULL) {
5812       if ( ! PubFieldConstraintAsnWrite(ptr -> field, aip, PUBLICATION_CONSTRAINT_field)) {
5813          goto erret;
5814       }
5815    }
5816    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5817       goto erret;
5818    }
5819    retval = TRUE;
5820 
5821 erret:
5822    AsnUnlinkType(orig);       /* unlink local tree */
5823    return retval;
5824 }
5825 
5826 
5827 
5828 /**************************************************
5829 *
5830 *    SourceConstraintNew()
5831 *
5832 **************************************************/
5833 NLM_EXTERN 
5834 SourceConstraintPtr LIBCALL
5835 SourceConstraintNew(void)
5836 {
5837    SourceConstraintPtr ptr = MemNew((size_t) sizeof(SourceConstraint));
5838 
5839    return ptr;
5840 
5841 }
5842 
5843 
5844 /**************************************************
5845 *
5846 *    SourceConstraintFree()
5847 *
5848 **************************************************/
5849 NLM_EXTERN 
5850 SourceConstraintPtr LIBCALL
5851 SourceConstraintFree(SourceConstraintPtr ptr)
5852 {
5853 
5854    if(ptr == NULL) {
5855       return NULL;
5856    }
5857    SourceQualChoiceFree(ptr -> field1);
5858    SourceQualChoiceFree(ptr -> field2);
5859    StringConstraintFree(ptr -> constraint);
5860    return MemFree(ptr);
5861 }
5862 
5863 
5864 /**************************************************
5865 *
5866 *    SourceConstraintAsnRead()
5867 *
5868 **************************************************/
5869 NLM_EXTERN 
5870 SourceConstraintPtr LIBCALL
5871 SourceConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5872 {
5873    DataVal av;
5874    AsnTypePtr atp;
5875    Boolean isError = FALSE;
5876    AsnReadFunc func;
5877    SourceConstraintPtr ptr;
5878 
5879    if (! loaded)
5880    {
5881       if (! objmacroAsnLoad()) {
5882          return NULL;
5883       }
5884    }
5885 
5886    if (aip == NULL) {
5887       return NULL;
5888    }
5889 
5890    if (orig == NULL) {         /* SourceConstraint ::= (self contained) */
5891       atp = AsnReadId(aip, amp, SOURCE_CONSTRAINT);
5892    } else {
5893       atp = AsnLinkType(orig, SOURCE_CONSTRAINT);
5894    }
5895    /* link in local tree */
5896    if (atp == NULL) {
5897       return NULL;
5898    }
5899 
5900    ptr = SourceConstraintNew();
5901    if (ptr == NULL) {
5902       goto erret;
5903    }
5904    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5905       goto erret;
5906    }
5907 
5908    atp = AsnReadId(aip,amp, atp);
5909    func = NULL;
5910 
5911    if (atp == SOURCE_CONSTRAINT_field1) {
5912       ptr -> field1 = SourceQualChoiceAsnRead(aip, atp);
5913       if (aip -> io_failure) {
5914          goto erret;
5915       }
5916       atp = AsnReadId(aip,amp, atp);
5917    }
5918    if (atp == SOURCE_CONSTRAINT_field2) {
5919       ptr -> field2 = SourceQualChoiceAsnRead(aip, atp);
5920       if (aip -> io_failure) {
5921          goto erret;
5922       }
5923       atp = AsnReadId(aip,amp, atp);
5924    }
5925    if (atp == SOURCE_CONSTRAINT_constraint) {
5926       ptr -> constraint = StringConstraintAsnRead(aip, atp);
5927       if (aip -> io_failure) {
5928          goto erret;
5929       }
5930       atp = AsnReadId(aip,amp, atp);
5931    }
5932    if (atp == CONSTRAINT_type_constraint) {
5933       if ( AsnReadVal(aip, atp, &av) <= 0) {
5934          goto erret;
5935       }
5936       ptr -> type_constraint = av.intvalue;
5937       atp = AsnReadId(aip,amp, atp);
5938    }
5939 
5940    if (AsnReadVal(aip, atp, &av) <= 0) {
5941       goto erret;
5942    }
5943    /* end struct */
5944 
5945 ret:
5946    AsnUnlinkType(orig);       /* unlink local tree */
5947    return ptr;
5948 
5949 erret:
5950    aip -> io_failure = TRUE;
5951    ptr = SourceConstraintFree(ptr);
5952    goto ret;
5953 }
5954 
5955 
5956 
5957 /**************************************************
5958 *
5959 *    SourceConstraintAsnWrite()
5960 *
5961 **************************************************/
5962 NLM_EXTERN Boolean LIBCALL 
5963 SourceConstraintAsnWrite(SourceConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5964 {
5965    DataVal av;
5966    AsnTypePtr atp;
5967    Boolean retval = FALSE;
5968 
5969    if (! loaded)
5970    {
5971       if (! objmacroAsnLoad()) {
5972          return FALSE;
5973       }
5974    }
5975 
5976    if (aip == NULL) {
5977       return FALSE;
5978    }
5979 
5980    atp = AsnLinkType(orig, SOURCE_CONSTRAINT);   /* link local tree */
5981    if (atp == NULL) {
5982       return FALSE;
5983    }
5984 
5985    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5986    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5987       goto erret;
5988    }
5989 
5990    if (ptr -> field1 != NULL) {
5991       if ( ! SourceQualChoiceAsnWrite(ptr -> field1, aip, SOURCE_CONSTRAINT_field1)) {
5992          goto erret;
5993       }
5994    }
5995    if (ptr -> field2 != NULL) {
5996       if ( ! SourceQualChoiceAsnWrite(ptr -> field2, aip, SOURCE_CONSTRAINT_field2)) {
5997          goto erret;
5998       }
5999    }
6000    if (ptr -> constraint != NULL) {
6001       if ( ! StringConstraintAsnWrite(ptr -> constraint, aip, SOURCE_CONSTRAINT_constraint)) {
6002          goto erret;
6003       }
6004    }
6005    av.intvalue = ptr -> type_constraint;
6006    retval = AsnWrite(aip, CONSTRAINT_type_constraint,  &av);
6007    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6008       goto erret;
6009    }
6010    retval = TRUE;
6011 
6012 erret:
6013    AsnUnlinkType(orig);       /* unlink local tree */
6014    return retval;
6015 }
6016 
6017 
6018 
6019 /**************************************************
6020 *
6021 *    CDSGeneProtPseudoConstraintNew()
6022 *
6023 **************************************************/
6024 NLM_EXTERN 
6025 CDSGeneProtPseudoConstraintPtr LIBCALL
6026 CDSGeneProtPseudoConstraintNew(void)
6027 {
6028    CDSGeneProtPseudoConstraintPtr ptr = MemNew((size_t) sizeof(CDSGeneProtPseudoConstraint));
6029 
6030    ptr -> is_pseudo = 1;
6031    return ptr;
6032 
6033 }
6034 
6035 
6036 /**************************************************
6037 *
6038 *    CDSGeneProtPseudoConstraintFree()
6039 *
6040 **************************************************/
6041 NLM_EXTERN 
6042 CDSGeneProtPseudoConstraintPtr LIBCALL
6043 CDSGeneProtPseudoConstraintFree(CDSGeneProtPseudoConstraintPtr ptr)
6044 {
6045 
6046    if(ptr == NULL) {
6047       return NULL;
6048    }
6049    return MemFree(ptr);
6050 }
6051 
6052 
6053 /**************************************************
6054 *
6055 *    CDSGeneProtPseudoConstraintAsnRead()
6056 *
6057 **************************************************/
6058 NLM_EXTERN 
6059 CDSGeneProtPseudoConstraintPtr LIBCALL
6060 CDSGeneProtPseudoConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6061 {
6062    DataVal av;
6063    AsnTypePtr atp;
6064    Boolean isError = FALSE;
6065    AsnReadFunc func;
6066    CDSGeneProtPseudoConstraintPtr ptr;
6067 
6068    if (! loaded)
6069    {
6070       if (! objmacroAsnLoad()) {
6071          return NULL;
6072       }
6073    }
6074 
6075    if (aip == NULL) {
6076       return NULL;
6077    }
6078 
6079    if (orig == NULL) {         /* CDSGeneProtPseudoConstraint ::= (self contained) */
6080       atp = AsnReadId(aip, amp, CDSGENEPROT_PSEUDO_CONSTRAINT);
6081    } else {
6082       atp = AsnLinkType(orig, CDSGENEPROT_PSEUDO_CONSTRAINT);
6083    }
6084    /* link in local tree */
6085    if (atp == NULL) {
6086       return NULL;
6087    }
6088 
6089    ptr = CDSGeneProtPseudoConstraintNew();
6090    if (ptr == NULL) {
6091       goto erret;
6092    }
6093    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6094       goto erret;
6095    }
6096 
6097    atp = AsnReadId(aip,amp, atp);
6098    func = NULL;
6099 
6100    if (atp == PSEUDO_CONSTRAINT_feature) {
6101       if ( AsnReadVal(aip, atp, &av) <= 0) {
6102          goto erret;
6103       }
6104       ptr -> feature = av.intvalue;
6105       atp = AsnReadId(aip,amp, atp);
6106    }
6107    if (atp == PSEUDO_CONSTRAINT_is_pseudo) {
6108       if ( AsnReadVal(aip, atp, &av) <= 0) {
6109          goto erret;
6110       }
6111       ptr -> is_pseudo = av.boolvalue;
6112       atp = AsnReadId(aip,amp, atp);
6113    }
6114 
6115    if (AsnReadVal(aip, atp, &av) <= 0) {
6116       goto erret;
6117    }
6118    /* end struct */
6119 
6120 ret:
6121    AsnUnlinkType(orig);       /* unlink local tree */
6122    return ptr;
6123 
6124 erret:
6125    aip -> io_failure = TRUE;
6126    ptr = CDSGeneProtPseudoConstraintFree(ptr);
6127    goto ret;
6128 }
6129 
6130 
6131 
6132 /**************************************************
6133 *
6134 *    CDSGeneProtPseudoConstraintAsnWrite()
6135 *
6136 **************************************************/
6137 NLM_EXTERN Boolean LIBCALL 
6138 CDSGeneProtPseudoConstraintAsnWrite(CDSGeneProtPseudoConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6139 {
6140    DataVal av;
6141    AsnTypePtr atp;
6142    Boolean retval = FALSE;
6143 
6144    if (! loaded)
6145    {
6146       if (! objmacroAsnLoad()) {
6147          return FALSE;
6148       }
6149    }
6150 
6151    if (aip == NULL) {
6152       return FALSE;
6153    }
6154 
6155    atp = AsnLinkType(orig, CDSGENEPROT_PSEUDO_CONSTRAINT);   /* link local tree */
6156    if (atp == NULL) {
6157       return FALSE;
6158    }
6159 
6160    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6161    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6162       goto erret;
6163    }
6164 
6165    av.intvalue = ptr -> feature;
6166    retval = AsnWrite(aip, PSEUDO_CONSTRAINT_feature,  &av);
6167    av.boolvalue = ptr -> is_pseudo;
6168    retval = AsnWrite(aip, PSEUDO_CONSTRAINT_is_pseudo,  &av);
6169    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6170       goto erret;
6171    }
6172    retval = TRUE;
6173 
6174 erret:
6175    AsnUnlinkType(orig);       /* unlink local tree */
6176    return retval;
6177 }
6178 
6179 
6180 
6181 /**************************************************
6182 *
6183 *    CDSGeneProtConstraintFieldFree()
6184 *
6185 **************************************************/
6186 NLM_EXTERN 
6187 CDSGeneProtConstraintFieldPtr LIBCALL
6188 CDSGeneProtConstraintFieldFree(ValNodePtr anp)
6189 {
6190    Pointer pnt;
6191 
6192    if (anp == NULL) {
6193       return NULL;
6194    }
6195 
6196    pnt = anp->data.ptrvalue;
6197    switch (anp->choice)
6198    {
6199    default:
6200       break;
6201    }
6202    return MemFree(anp);
6203 }
6204 
6205 
6206 /**************************************************
6207 *
6208 *    CDSGeneProtConstraintFieldAsnRead()
6209 *
6210 **************************************************/
6211 NLM_EXTERN 
6212 CDSGeneProtConstraintFieldPtr LIBCALL
6213 CDSGeneProtConstraintFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6214 {
6215    DataVal av;
6216    AsnTypePtr atp;
6217    ValNodePtr anp;
6218    Uint1 choice;
6219    Boolean isError = FALSE;
6220    Boolean nullIsError = FALSE;
6221    AsnReadFunc func;
6222 
6223    if (! loaded)
6224    {
6225       if (! objmacroAsnLoad()) {
6226          return NULL;
6227       }
6228    }
6229 
6230    if (aip == NULL) {
6231       return NULL;
6232    }
6233 
6234    if (orig == NULL) {         /* CDSGeneProtConstraintField ::= (self contained) */
6235       atp = AsnReadId(aip, amp, CDSGENEPROT_CONSTRAINT_FIELD);
6236    } else {
6237       atp = AsnLinkType(orig, CDSGENEPROT_CONSTRAINT_FIELD);    /* link in local tree */
6238    }
6239    if (atp == NULL) {
6240       return NULL;
6241    }
6242 
6243    anp = ValNodeNew(NULL);
6244    if (anp == NULL) {
6245       goto erret;
6246    }
6247    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
6248       goto erret;
6249    }
6250 
6251    func = NULL;
6252 
6253    atp = AsnReadId(aip, amp, atp);  /* find the choice */
6254    if (atp == NULL) {
6255       goto erret;
6256    }
6257    if (atp == CONSTRAINT_FIELD_field) {
6258       choice = CDSGeneProtConstraintField_field;
6259       if (AsnReadVal(aip, atp, &av) <= 0) {
6260          goto erret;
6261       }
6262       anp->data.intvalue = av.intvalue;
6263    }
6264    anp->choice = choice;
6265    if (func != NULL)
6266    {
6267       anp->data.ptrvalue = (* func)(aip, atp);
6268       if (aip -> io_failure) goto erret;
6269 
6270       if (nullIsError && anp->data.ptrvalue == NULL) {
6271          goto erret;
6272       }
6273    }
6274 
6275 ret:
6276    AsnUnlinkType(orig);       /* unlink local tree */
6277    return anp;
6278 
6279 erret:
6280    anp = MemFree(anp);
6281    aip -> io_failure = TRUE;
6282    goto ret;
6283 }
6284 
6285 
6286 /**************************************************
6287 *
6288 *    CDSGeneProtConstraintFieldAsnWrite()
6289 *
6290 **************************************************/
6291 NLM_EXTERN Boolean LIBCALL 
6292 CDSGeneProtConstraintFieldAsnWrite(CDSGeneProtConstraintFieldPtr anp, AsnIoPtr aip, AsnTypePtr orig)
6293 
6294 {
6295    DataVal av;
6296    AsnTypePtr atp, writetype = NULL;
6297    Pointer pnt;
6298    AsnWriteFunc func = NULL;
6299    Boolean retval = FALSE;
6300 
6301    if (! loaded)
6302    {
6303       if (! objmacroAsnLoad())
6304       return FALSE;
6305    }
6306 
6307    if (aip == NULL)
6308    return FALSE;
6309 
6310    atp = AsnLinkType(orig, CDSGENEPROT_CONSTRAINT_FIELD);   /* link local tree */
6311    if (atp == NULL) {
6312       return FALSE;
6313    }
6314 
6315    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6316 
6317    av.ptrvalue = (Pointer)anp;
6318    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
6319       goto erret;
6320    }
6321 
6322    pnt = anp->data.ptrvalue;
6323    switch (anp->choice)
6324    {
6325    case CDSGeneProtConstraintField_field:
6326       av.intvalue = anp->data.intvalue;
6327       retval = AsnWrite(aip, CONSTRAINT_FIELD_field, &av);
6328       break;
6329    }
6330    if (writetype != NULL) {
6331       retval = (* func)(pnt, aip, writetype);   /* write it out */
6332    }
6333    if (!retval) {
6334       goto erret;
6335    }
6336    retval = TRUE;
6337 
6338 erret:
6339    AsnUnlinkType(orig);       /* unlink local tree */
6340    return retval;
6341 }
6342 
6343 
6344 /**************************************************
6345 *
6346 *    CDSGeneProtQualConstraintNew()
6347 *
6348 **************************************************/
6349 NLM_EXTERN 
6350 CDSGeneProtQualConstraintPtr LIBCALL
6351 CDSGeneProtQualConstraintNew(void)
6352 {
6353    CDSGeneProtQualConstraintPtr ptr = MemNew((size_t) sizeof(CDSGeneProtQualConstraint));
6354 
6355    return ptr;
6356 
6357 }
6358 
6359 
6360 /**************************************************
6361 *
6362 *    CDSGeneProtQualConstraintFree()
6363 *
6364 **************************************************/
6365 NLM_EXTERN 
6366 CDSGeneProtQualConstraintPtr LIBCALL
6367 CDSGeneProtQualConstraintFree(CDSGeneProtQualConstraintPtr ptr)
6368 {
6369 
6370    if(ptr == NULL) {
6371       return NULL;
6372    }
6373    CDSGeneProtConstraintFieldFree(ptr -> field1);
6374    CDSGeneProtConstraintFieldFree(ptr -> field2);
6375    StringConstraintFree(ptr -> constraint);
6376    return MemFree(ptr);
6377 }
6378 
6379 
6380 /**************************************************
6381 *
6382 *    CDSGeneProtQualConstraintAsnRead()
6383 *
6384 **************************************************/
6385 NLM_EXTERN 
6386 CDSGeneProtQualConstraintPtr LIBCALL
6387 CDSGeneProtQualConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6388 {
6389    DataVal av;
6390    AsnTypePtr atp;
6391    Boolean isError = FALSE;
6392    AsnReadFunc func;
6393    CDSGeneProtQualConstraintPtr ptr;
6394 
6395    if (! loaded)
6396    {
6397       if (! objmacroAsnLoad()) {
6398          return NULL;
6399       }
6400    }
6401 
6402    if (aip == NULL) {
6403       return NULL;
6404    }
6405 
6406    if (orig == NULL) {         /* CDSGeneProtQualConstraint ::= (self contained) */
6407       atp = AsnReadId(aip, amp, CDSGENEPROT_QUAL_CONSTRAINT);
6408    } else {
6409       atp = AsnLinkType(orig, CDSGENEPROT_QUAL_CONSTRAINT);
6410    }
6411    /* link in local tree */
6412    if (atp == NULL) {
6413       return NULL;
6414    }
6415 
6416    ptr = CDSGeneProtQualConstraintNew();
6417    if (ptr == NULL) {
6418       goto erret;
6419    }
6420    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6421       goto erret;
6422    }
6423 
6424    atp = AsnReadId(aip,amp, atp);
6425    func = NULL;
6426 
6427    if (atp == QUAL_CONSTRAINT_field1) {
6428       ptr -> field1 = CDSGeneProtConstraintFieldAsnRead(aip, atp);
6429       if (aip -> io_failure) {
6430          goto erret;
6431       }
6432       atp = AsnReadId(aip,amp, atp);
6433    }
6434    if (atp == QUAL_CONSTRAINT_field2) {
6435       ptr -> field2 = CDSGeneProtConstraintFieldAsnRead(aip, atp);
6436       if (aip -> io_failure) {
6437          goto erret;
6438       }
6439       atp = AsnReadId(aip,amp, atp);
6440    }
6441    if (atp == QUAL_CONSTRAINT_constraint) {
6442       ptr -> constraint = StringConstraintAsnRead(aip, atp);
6443       if (aip -> io_failure) {
6444          goto erret;
6445       }
6446       atp = AsnReadId(aip,amp, atp);
6447    }
6448 
6449    if (AsnReadVal(aip, atp, &av) <= 0) {
6450       goto erret;
6451    }
6452    /* end struct */
6453 
6454 ret:
6455    AsnUnlinkType(orig);       /* unlink local tree */
6456    return ptr;
6457 
6458 erret:
6459    aip -> io_failure = TRUE;
6460    ptr = CDSGeneProtQualConstraintFree(ptr);
6461    goto ret;
6462 }
6463 
6464 
6465 
6466 /**************************************************
6467 *
6468 *    CDSGeneProtQualConstraintAsnWrite()
6469 *
6470 **************************************************/
6471 NLM_EXTERN Boolean LIBCALL 
6472 CDSGeneProtQualConstraintAsnWrite(CDSGeneProtQualConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6473 {
6474    DataVal av;
6475    AsnTypePtr atp;
6476    Boolean retval = FALSE;
6477 
6478    if (! loaded)
6479    {
6480       if (! objmacroAsnLoad()) {
6481          return FALSE;
6482       }
6483    }
6484 
6485    if (aip == NULL) {
6486       return FALSE;
6487    }
6488 
6489    atp = AsnLinkType(orig, CDSGENEPROT_QUAL_CONSTRAINT);   /* link local tree */
6490    if (atp == NULL) {
6491       return FALSE;
6492    }
6493 
6494    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6495    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6496       goto erret;
6497    }
6498 
6499    if (ptr -> field1 != NULL) {
6500       if ( ! CDSGeneProtConstraintFieldAsnWrite(ptr -> field1, aip, QUAL_CONSTRAINT_field1)) {
6501          goto erret;
6502       }
6503    }
6504    if (ptr -> field2 != NULL) {
6505       if ( ! CDSGeneProtConstraintFieldAsnWrite(ptr -> field2, aip, QUAL_CONSTRAINT_field2)) {
6506          goto erret;
6507       }
6508    }
6509    if (ptr -> constraint != NULL) {
6510       if ( ! StringConstraintAsnWrite(ptr -> constraint, aip, QUAL_CONSTRAINT_constraint)) {
6511          goto erret;
6512       }
6513    }
6514    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6515       goto erret;
6516    }
6517    retval = TRUE;
6518 
6519 erret:
6520    AsnUnlinkType(orig);       /* unlink local tree */
6521    return retval;
6522 }
6523 
6524 
6525 
6526 /**************************************************
6527 *
6528 *    FieldConstraintNew()
6529 *
6530 **************************************************/
6531 NLM_EXTERN 
6532 FieldConstraintPtr LIBCALL
6533 FieldConstraintNew(void)
6534 {
6535    FieldConstraintPtr ptr = MemNew((size_t) sizeof(FieldConstraint));
6536 
6537    return ptr;
6538 
6539 }
6540 
6541 
6542 /**************************************************
6543 *
6544 *    FieldConstraintFree()
6545 *
6546 **************************************************/
6547 NLM_EXTERN 
6548 FieldConstraintPtr LIBCALL
6549 FieldConstraintFree(FieldConstraintPtr ptr)
6550 {
6551 
6552    if(ptr == NULL) {
6553       return NULL;
6554    }
6555    FieldTypeFree(ptr -> field);
6556    StringConstraintFree(ptr -> string_constraint);
6557    return MemFree(ptr);
6558 }
6559 
6560 
6561 /**************************************************
6562 *
6563 *    FieldConstraintAsnRead()
6564 *
6565 **************************************************/
6566 NLM_EXTERN 
6567 FieldConstraintPtr LIBCALL
6568 FieldConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6569 {
6570    DataVal av;
6571    AsnTypePtr atp;
6572    Boolean isError = FALSE;
6573    AsnReadFunc func;
6574    FieldConstraintPtr ptr;
6575 
6576    if (! loaded)
6577    {
6578       if (! objmacroAsnLoad()) {
6579          return NULL;
6580       }
6581    }
6582 
6583    if (aip == NULL) {
6584       return NULL;
6585    }
6586 
6587    if (orig == NULL) {         /* FieldConstraint ::= (self contained) */
6588       atp = AsnReadId(aip, amp, FIELD_CONSTRAINT);
6589    } else {
6590       atp = AsnLinkType(orig, FIELD_CONSTRAINT);
6591    }
6592    /* link in local tree */
6593    if (atp == NULL) {
6594       return NULL;
6595    }
6596 
6597    ptr = FieldConstraintNew();
6598    if (ptr == NULL) {
6599       goto erret;
6600    }
6601    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6602       goto erret;
6603    }
6604 
6605    atp = AsnReadId(aip,amp, atp);
6606    func = NULL;
6607 
6608    if (atp == FIELD_CONSTRAINT_field) {
6609       ptr -> field = FieldTypeAsnRead(aip, atp);
6610       if (aip -> io_failure) {
6611          goto erret;
6612       }
6613       atp = AsnReadId(aip,amp, atp);
6614    }
6615    if (atp == CONSTRAINT_string_constraint) {
6616       ptr -> string_constraint = StringConstraintAsnRead(aip, atp);
6617       if (aip -> io_failure) {
6618          goto erret;
6619       }
6620       atp = AsnReadId(aip,amp, atp);
6621    }
6622 
6623    if (AsnReadVal(aip, atp, &av) <= 0) {
6624       goto erret;
6625    }
6626    /* end struct */
6627 
6628 ret:
6629    AsnUnlinkType(orig);       /* unlink local tree */
6630    return ptr;
6631 
6632 erret:
6633    aip -> io_failure = TRUE;
6634    ptr = FieldConstraintFree(ptr);
6635    goto ret;
6636 }
6637 
6638 
6639 
6640 /**************************************************
6641 *
6642 *    FieldConstraintAsnWrite()
6643 *
6644 **************************************************/
6645 NLM_EXTERN Boolean LIBCALL 
6646 FieldConstraintAsnWrite(FieldConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6647 {
6648    DataVal av;
6649    AsnTypePtr atp;
6650    Boolean retval = FALSE;
6651 
6652    if (! loaded)
6653    {
6654       if (! objmacroAsnLoad()) {
6655          return FALSE;
6656       }
6657    }
6658 
6659    if (aip == NULL) {
6660       return FALSE;
6661    }
6662 
6663    atp = AsnLinkType(orig, FIELD_CONSTRAINT);   /* link local tree */
6664    if (atp == NULL) {
6665       return FALSE;
6666    }
6667 
6668    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6669    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6670       goto erret;
6671    }
6672 
6673    if (ptr -> field != NULL) {
6674       if ( ! FieldTypeAsnWrite(ptr -> field, aip, FIELD_CONSTRAINT_field)) {
6675          goto erret;
6676       }
6677    }
6678    if (ptr -> string_constraint != NULL) {
6679       if ( ! StringConstraintAsnWrite(ptr -> string_constraint, aip, CONSTRAINT_string_constraint)) {
6680          goto erret;
6681       }
6682    }
6683    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6684       goto erret;
6685    }
6686    retval = TRUE;
6687 
6688 erret:
6689    AsnUnlinkType(orig);       /* unlink local tree */
6690    return retval;
6691 }
6692 
6693 
6694 
6695 /**************************************************
6696 *
6697 *    FieldTypeFree()
6698 *
6699 **************************************************/
6700 NLM_EXTERN 
6701 FieldTypePtr LIBCALL
6702 FieldTypeFree(ValNodePtr anp)
6703 {
6704    Pointer pnt;
6705 
6706    if (anp == NULL) {
6707       return NULL;
6708    }
6709 
6710    pnt = anp->data.ptrvalue;
6711    switch (anp->choice)
6712    {
6713    default:
6714       break;
6715    case FieldType_source_qual:
6716       SourceQualChoiceFree(anp -> data.ptrvalue);
6717       break;
6718    case FieldType_feature_field:
6719       FeatureFieldFree(anp -> data.ptrvalue);
6720       break;
6721    case FieldType_rna_field:
6722       RnaQualFree(anp -> data.ptrvalue);
6723       break;
6724    case FieldType_molinfo_field:
6725       MolinfoFieldFree(anp -> data.ptrvalue);
6726       break;
6727    case FieldType_struc_comment_field:
6728       StructuredCommentFieldFree(anp -> data.ptrvalue);
6729       break;
6730    }
6731    return MemFree(anp);
6732 }
6733 
6734 
6735 /**************************************************
6736 *
6737 *    FieldTypeAsnRead()
6738 *
6739 **************************************************/
6740 NLM_EXTERN 
6741 FieldTypePtr LIBCALL
6742 FieldTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6743 {
6744    DataVal av;
6745    AsnTypePtr atp;
6746    ValNodePtr anp;
6747    Uint1 choice;
6748    Boolean isError = FALSE;
6749    Boolean nullIsError = FALSE;
6750    AsnReadFunc func;
6751 
6752    if (! loaded)
6753    {
6754       if (! objmacroAsnLoad()) {
6755          return NULL;
6756       }
6757    }
6758 
6759    if (aip == NULL) {
6760       return NULL;
6761    }
6762 
6763    if (orig == NULL) {         /* FieldType ::= (self contained) */
6764       atp = AsnReadId(aip, amp, FIELD_TYPE);
6765    } else {
6766       atp = AsnLinkType(orig, FIELD_TYPE);    /* link in local tree */
6767    }
6768    if (atp == NULL) {
6769       return NULL;
6770    }
6771 
6772    anp = ValNodeNew(NULL);
6773    if (anp == NULL) {
6774       goto erret;
6775    }
6776    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
6777       goto erret;
6778    }
6779 
6780    func = NULL;
6781 
6782    atp = AsnReadId(aip, amp, atp);  /* find the choice */
6783    if (atp == NULL) {
6784       goto erret;
6785    }
6786    if (atp == FIELD_TYPE_source_qual) {
6787       choice = FieldType_source_qual;
6788       func = (AsnReadFunc) SourceQualChoiceAsnRead;
6789    }
6790    else if (atp == FIELD_TYPE_feature_field) {
6791       choice = FieldType_feature_field;
6792       func = (AsnReadFunc) FeatureFieldAsnRead;
6793    }
6794    else if (atp == FIELD_TYPE_rna_field) {
6795       choice = FieldType_rna_field;
6796       func = (AsnReadFunc) RnaQualAsnRead;
6797    }
6798    else if (atp == FIELD_TYPE_cds_gene_prot) {
6799       choice = FieldType_cds_gene_prot;
6800       if (AsnReadVal(aip, atp, &av) <= 0) {
6801          goto erret;
6802       }
6803       anp->data.intvalue = av.intvalue;
6804    }
6805    else if (atp == FIELD_TYPE_molinfo_field) {
6806       choice = FieldType_molinfo_field;
6807       func = (AsnReadFunc) MolinfoFieldAsnRead;
6808    }
6809    else if (atp == FIELD_TYPE_pub) {
6810       choice = FieldType_pub;
6811       if (AsnReadVal(aip, atp, &av) <= 0) {
6812          goto erret;
6813       }
6814       anp->data.intvalue = av.intvalue;
6815    }
6816    else if (atp == FIELD_TYPE_struc_comment_field) {
6817       choice = FieldType_struc_comment_field;
6818       func = (AsnReadFunc) StructuredCommentFieldAsnRead;
6819    }
6820    else if (atp == FIELD_TYPE_misc) {
6821       choice = FieldType_misc;
6822       if (AsnReadVal(aip, atp, &av) <= 0) {
6823          goto erret;
6824       }
6825       anp->data.intvalue = av.intvalue;
6826    }
6827    anp->choice = choice;
6828    if (func != NULL)
6829    {
6830       anp->data.ptrvalue = (* func)(aip, atp);
6831       if (aip -> io_failure) goto erret;
6832 
6833       if (nullIsError && anp->data.ptrvalue == NULL) {
6834          goto erret;
6835       }
6836    }
6837 
6838 ret:
6839    AsnUnlinkType(orig);       /* unlink local tree */
6840    return anp;
6841 
6842 erret:
6843    anp = MemFree(anp);
6844    aip -> io_failure = TRUE;
6845    goto ret;
6846 }
6847 
6848 
6849 /**************************************************
6850 *
6851 *    FieldTypeAsnWrite()
6852 *
6853 **************************************************/
6854 NLM_EXTERN Boolean LIBCALL 
6855 FieldTypeAsnWrite(FieldTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
6856 
6857 {
6858    DataVal av;
6859    AsnTypePtr atp, writetype = NULL;
6860    Pointer pnt;
6861    AsnWriteFunc func = NULL;
6862    Boolean retval = FALSE;
6863 
6864    if (! loaded)
6865    {
6866       if (! objmacroAsnLoad())
6867       return FALSE;
6868    }
6869 
6870    if (aip == NULL)
6871    return FALSE;
6872 
6873    atp = AsnLinkType(orig, FIELD_TYPE);   /* link local tree */
6874    if (atp == NULL) {
6875       return FALSE;
6876    }
6877 
6878    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6879 
6880    av.ptrvalue = (Pointer)anp;
6881    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
6882       goto erret;
6883    }
6884 
6885    pnt = anp->data.ptrvalue;
6886    switch (anp->choice)
6887    {
6888    case FieldType_source_qual:
6889       writetype = FIELD_TYPE_source_qual;
6890       func = (AsnWriteFunc) SourceQualChoiceAsnWrite;
6891       break;
6892    case FieldType_feature_field:
6893       writetype = FIELD_TYPE_feature_field;
6894       func = (AsnWriteFunc) FeatureFieldAsnWrite;
6895       break;
6896    case FieldType_rna_field:
6897       writetype = FIELD_TYPE_rna_field;
6898       func = (AsnWriteFunc) RnaQualAsnWrite;
6899       break;
6900    case FieldType_cds_gene_prot:
6901       av.intvalue = anp->data.intvalue;
6902       retval = AsnWrite(aip, FIELD_TYPE_cds_gene_prot, &av);
6903       break;
6904    case FieldType_molinfo_field:
6905       writetype = FIELD_TYPE_molinfo_field;
6906       func = (AsnWriteFunc) MolinfoFieldAsnWrite;
6907       break;
6908    case FieldType_pub:
6909       av.intvalue = anp->data.intvalue;
6910       retval = AsnWrite(aip, FIELD_TYPE_pub, &av);
6911       break;
6912    case FieldType_struc_comment_field:
6913       writetype = FIELD_TYPE_struc_comment_field;
6914       func = (AsnWriteFunc) StructuredCommentFieldAsnWrite;
6915       break;
6916    case FieldType_misc:
6917       av.intvalue = anp->data.intvalue;
6918       retval = AsnWrite(aip, FIELD_TYPE_misc, &av);
6919       break;
6920    }
6921    if (writetype != NULL) {
6922       retval = (* func)(pnt, aip, writetype);   /* write it out */
6923    }
6924    if (!retval) {
6925       goto erret;
6926    }
6927    retval = TRUE;
6928 
6929 erret:
6930    AsnUnlinkType(orig);       /* unlink local tree */
6931    return retval;
6932 }
6933 
6934 
6935 /**************************************************
6936 *
6937 *    SequenceConstraintMolTypeConstraintFree()
6938 *
6939 **************************************************/
6940 NLM_EXTERN 
6941 SequenceConstraintMolTypeConstraintPtr LIBCALL
6942 SequenceConstraintMolTypeConstraintFree(ValNodePtr anp)
6943 {
6944    Pointer pnt;
6945 
6946    if (anp == NULL) {
6947       return NULL;
6948    }
6949 
6950    pnt = anp->data.ptrvalue;
6951    switch (anp->choice)
6952    {
6953    default:
6954       break;
6955    }
6956    return MemFree(anp);
6957 }
6958 
6959 
6960 /**************************************************
6961 *
6962 *    SequenceConstraintMolTypeConstraintAsnRead()
6963 *
6964 **************************************************/
6965 NLM_EXTERN 
6966 SequenceConstraintMolTypeConstraintPtr LIBCALL
6967 SequenceConstraintMolTypeConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6968 {
6969    DataVal av;
6970    AsnTypePtr atp;
6971    ValNodePtr anp;
6972    Uint1 choice;
6973    Boolean isError = FALSE;
6974    Boolean nullIsError = FALSE;
6975    AsnReadFunc func;
6976 
6977    if (! loaded)
6978    {
6979       if (! objmacroAsnLoad()) {
6980          return NULL;
6981       }
6982    }
6983 
6984    if (aip == NULL) {
6985       return NULL;
6986    }
6987 
6988    if (orig == NULL) {         /* SequenceConstraintMolTypeConstraint ::= (self contained) */
6989       atp = AsnReadId(aip, amp, CONSTRAINT_MOL_TYPE_CONSTRAINT);
6990    } else {
6991       atp = AsnLinkType(orig, CONSTRAINT_MOL_TYPE_CONSTRAINT);    /* link in local tree */
6992    }
6993    if (atp == NULL) {
6994       return NULL;
6995    }
6996 
6997    anp = ValNodeNew(NULL);
6998    if (anp == NULL) {
6999       goto erret;
7000    }
7001    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
7002       goto erret;
7003    }
7004 
7005    func = NULL;
7006 
7007    atp = AsnReadId(aip, amp, atp);  /* find the choice */
7008    if (atp == NULL) {
7009       goto erret;
7010    }
7011    if (atp == MOL_TYPE_CONSTRAINT_any) {
7012       choice = SequenceConstraintMolTypeConstraint_any;
7013       if (AsnReadVal(aip, atp, &av) <= 0) {
7014          goto erret;
7015       }
7016       anp->data.boolvalue = av.boolvalue;
7017    }
7018    else if (atp == MOL_TYPE_CONSTRAINT_nucleotide) {
7019       choice = SequenceConstraintMolTypeConstraint_nucleotide;
7020       if (AsnReadVal(aip, atp, &av) <= 0) {
7021          goto erret;
7022       }
7023       anp->data.boolvalue = av.boolvalue;
7024    }
7025    else if (atp == MOL_TYPE_CONSTRAINT_dna) {
7026       choice = SequenceConstraintMolTypeConstraint_dna;
7027       if (AsnReadVal(aip, atp, &av) <= 0) {
7028          goto erret;
7029       }
7030       anp->data.boolvalue = av.boolvalue;
7031    }
7032    else if (atp == MOL_TYPE_CONSTRAINT_rna) {
7033       choice = SequenceConstraintMolTypeConstraint_rna;
7034       if (AsnReadVal(aip, atp, &av) <= 0) {
7035          goto erret;
7036       }
7037       anp->data.intvalue = av.intvalue;
7038    }
7039    else if (atp == MOL_TYPE_CONSTRAINT_protein) {
7040       choice = SequenceConstraintMolTypeConstraint_protein;
7041       if (AsnReadVal(aip, atp, &av) <= 0) {
7042          goto erret;
7043       }
7044       anp->data.boolvalue = av.boolvalue;
7045    }
7046    anp->choice = choice;
7047    if (func != NULL)
7048    {
7049       anp->data.ptrvalue = (* func)(aip, atp);
7050       if (aip -> io_failure) goto erret;
7051 
7052       if (nullIsError && anp->data.ptrvalue == NULL) {
7053          goto erret;
7054       }
7055    }
7056 
7057 ret:
7058    AsnUnlinkType(orig);       /* unlink local tree */
7059    return anp;
7060 
7061 erret:
7062    anp = MemFree(anp);
7063    aip -> io_failure = TRUE;
7064    goto ret;
7065 }
7066 
7067 
7068 /**************************************************
7069 *
7070 *    SequenceConstraintMolTypeConstraintAsnWrite()
7071 *
7072 **************************************************/
7073 NLM_EXTERN Boolean LIBCALL 
7074 SequenceConstraintMolTypeConstraintAsnWrite(SequenceConstraintMolTypeConstraintPtr anp, AsnIoPtr aip, AsnTypePtr orig)
7075 
7076 {
7077    DataVal av;
7078    AsnTypePtr atp, writetype = NULL;
7079    Pointer pnt;
7080    AsnWriteFunc func = NULL;
7081    Boolean retval = FALSE;
7082 
7083    if (! loaded)
7084    {
7085       if (! objmacroAsnLoad())
7086       return FALSE;
7087    }
7088 
7089    if (aip == NULL)
7090    return FALSE;
7091 
7092    atp = AsnLinkType(orig, CONSTRAINT_MOL_TYPE_CONSTRAINT);   /* link local tree */
7093    if (atp == NULL) {
7094       return FALSE;
7095    }
7096 
7097    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7098 
7099    av.ptrvalue = (Pointer)anp;
7100    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
7101       goto erret;
7102    }
7103 
7104    pnt = anp->data.ptrvalue;
7105    switch (anp->choice)
7106    {
7107    case SequenceConstraintMolTypeConstraint_any:
7108       av.boolvalue = anp->data.boolvalue;
7109       retval = AsnWrite(aip, MOL_TYPE_CONSTRAINT_any, &av);
7110       break;
7111    case SequenceConstraintMolTypeConstraint_nucleotide:
7112       av.boolvalue = anp->data.boolvalue;
7113       retval = AsnWrite(aip, MOL_TYPE_CONSTRAINT_nucleotide, &av);
7114       break;
7115    case SequenceConstraintMolTypeConstraint_dna:
7116       av.boolvalue = anp->data.boolvalue;
7117       retval = AsnWrite(aip, MOL_TYPE_CONSTRAINT_dna, &av);
7118       break;
7119    case SequenceConstraintMolTypeConstraint_rna:
7120       av.intvalue = anp->data.intvalue;
7121       retval = AsnWrite(aip, MOL_TYPE_CONSTRAINT_rna, &av);
7122       break;
7123    case SequenceConstraintMolTypeConstraint_protein:
7124       av.boolvalue = anp->data.boolvalue;
7125       retval = AsnWrite(aip, MOL_TYPE_CONSTRAINT_protein, &av);
7126       break;
7127    }
7128    if (writetype != NULL) {
7129       retval = (* func)(pnt, aip, writetype);   /* write it out */
7130    }
7131    if (!retval) {
7132       goto erret;
7133    }
7134    retval = TRUE;
7135 
7136 erret:
7137    AsnUnlinkType(orig);       /* unlink local tree */
7138    return retval;
7139 }
7140 
7141 
7142 /**************************************************
7143 *
7144 *    SequenceConstraintNew()
7145 *
7146 **************************************************/
7147 NLM_EXTERN 
7148 SequenceConstraintPtr LIBCALL
7149 SequenceConstraintNew(void)
7150 {
7151    SequenceConstraintPtr ptr = MemNew((size_t) sizeof(SequenceConstraint));
7152 
7153    return ptr;
7154 
7155 }
7156 
7157 
7158 /**************************************************
7159 *
7160 *    SequenceConstraintFree()
7161 *
7162 **************************************************/
7163 NLM_EXTERN 
7164 SequenceConstraintPtr LIBCALL
7165 SequenceConstraintFree(SequenceConstraintPtr ptr)
7166 {
7167 
7168    if(ptr == NULL) {
7169       return NULL;
7170    }
7171    SequenceConstraintMolTypeConstraintFree(ptr -> seqtype);
7172    StringConstraintFree(ptr -> id);
7173    return MemFree(ptr);
7174 }
7175 
7176 
7177 /**************************************************
7178 *
7179 *    SequenceConstraintAsnRead()
7180 *
7181 **************************************************/
7182 NLM_EXTERN 
7183 SequenceConstraintPtr LIBCALL
7184 SequenceConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7185 {
7186    DataVal av;
7187    AsnTypePtr atp;
7188    Boolean isError = FALSE;
7189    AsnReadFunc func;
7190    SequenceConstraintPtr ptr;
7191 
7192    if (! loaded)
7193    {
7194       if (! objmacroAsnLoad()) {
7195          return NULL;
7196       }
7197    }
7198 
7199    if (aip == NULL) {
7200       return NULL;
7201    }
7202 
7203    if (orig == NULL) {         /* SequenceConstraint ::= (self contained) */
7204       atp = AsnReadId(aip, amp, SEQUENCE_CONSTRAINT);
7205    } else {
7206       atp = AsnLinkType(orig, SEQUENCE_CONSTRAINT);
7207    }
7208    /* link in local tree */
7209    if (atp == NULL) {
7210       return NULL;
7211    }
7212 
7213    ptr = SequenceConstraintNew();
7214    if (ptr == NULL) {
7215       goto erret;
7216    }
7217    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
7218       goto erret;
7219    }
7220 
7221    atp = AsnReadId(aip,amp, atp);
7222    func = NULL;
7223 
7224    if (atp == SEQUENCE_CONSTRAINT_seqtype) {
7225       ptr -> seqtype = SequenceConstraintMolTypeConstraintAsnRead(aip, atp);
7226       if (aip -> io_failure) {
7227          goto erret;
7228       }
7229       atp = AsnReadId(aip,amp, atp);
7230    }
7231    if (atp == SEQUENCE_CONSTRAINT_id) {
7232       ptr -> id = StringConstraintAsnRead(aip, atp);
7233       if (aip -> io_failure) {
7234          goto erret;
7235       }
7236       atp = AsnReadId(aip,amp, atp);
7237    }
7238    if (atp == SEQUENCE_CONSTRAINT_feature) {
7239       if ( AsnReadVal(aip, atp, &av) <= 0) {
7240          goto erret;
7241       }
7242       ptr -> feature = av.intvalue;
7243       atp = AsnReadId(aip,amp, atp);
7244    }
7245 
7246    if (AsnReadVal(aip, atp, &av) <= 0) {
7247       goto erret;
7248    }
7249    /* end struct */
7250 
7251 ret:
7252    AsnUnlinkType(orig);       /* unlink local tree */
7253    return ptr;
7254 
7255 erret:
7256    aip -> io_failure = TRUE;
7257    ptr = SequenceConstraintFree(ptr);
7258    goto ret;
7259 }
7260 
7261 
7262 
7263 /**************************************************
7264 *
7265 *    SequenceConstraintAsnWrite()
7266 *
7267 **************************************************/
7268 NLM_EXTERN Boolean LIBCALL 
7269 SequenceConstraintAsnWrite(SequenceConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
7270 {
7271    DataVal av;
7272    AsnTypePtr atp;
7273    Boolean retval = FALSE;
7274 
7275    if (! loaded)
7276    {
7277       if (! objmacroAsnLoad()) {
7278          return FALSE;
7279       }
7280    }
7281 
7282    if (aip == NULL) {
7283       return FALSE;
7284    }
7285 
7286    atp = AsnLinkType(orig, SEQUENCE_CONSTRAINT);   /* link local tree */
7287    if (atp == NULL) {
7288       return FALSE;
7289    }
7290 
7291    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7292    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
7293       goto erret;
7294    }
7295 
7296    if (ptr -> seqtype != NULL) {
7297       if ( ! SequenceConstraintMolTypeConstraintAsnWrite(ptr -> seqtype, aip, SEQUENCE_CONSTRAINT_seqtype)) {
7298          goto erret;
7299       }
7300    }
7301    if (ptr -> id != NULL) {
7302       if ( ! StringConstraintAsnWrite(ptr -> id, aip, SEQUENCE_CONSTRAINT_id)) {
7303          goto erret;
7304       }
7305    }
7306    av.intvalue = ptr -> feature;
7307    retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_feature,  &av);
7308    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
7309       goto erret;
7310    }
7311    retval = TRUE;
7312 
7313 erret:
7314    AsnUnlinkType(orig);       /* unlink local tree */
7315    return retval;
7316 }
7317 
7318 
7319 
7320 /**************************************************
7321 *
7322 *    ConstraintChoiceFree()
7323 *
7324 **************************************************/
7325 NLM_EXTERN 
7326 ConstraintChoicePtr LIBCALL
7327 ConstraintChoiceFree(ValNodePtr anp)
7328 {
7329    Pointer pnt;
7330 
7331    if (anp == NULL) {
7332       return NULL;
7333    }
7334 
7335    pnt = anp->data.ptrvalue;
7336    switch (anp->choice)
7337    {
7338    default:
7339       break;
7340    case ConstraintChoice_string:
7341       StringConstraintFree(anp -> data.ptrvalue);
7342       break;
7343    case ConstraintChoice_location:
7344       LocationConstraintFree(anp -> data.ptrvalue);
7345       break;
7346    case ConstraintChoice_field:
7347       FieldConstraintFree(anp -> data.ptrvalue);
7348       break;
7349    case ConstraintChoice_source:
7350       SourceConstraintFree(anp -> data.ptrvalue);
7351       break;
7352    case ConstraintChoice_cdsgeneprot_qual:
7353       CDSGeneProtQualConstraintFree(anp -> data.ptrvalue);
7354       break;
7355    case ConstraintChoice_cdsgeneprot_pseudo:
7356       CDSGeneProtPseudoConstraintFree(anp -> data.ptrvalue);
7357       break;
7358    case ConstraintChoice_sequence:
7359       SequenceConstraintFree(anp -> data.ptrvalue);
7360       break;
7361    case ConstraintChoice_pub:
7362       PublicationConstraintFree(anp -> data.ptrvalue);
7363       break;
7364    }
7365    return MemFree(anp);
7366 }
7367 
7368 
7369 /**************************************************
7370 *
7371 *    ConstraintChoiceAsnRead()
7372 *
7373 **************************************************/
7374 NLM_EXTERN 
7375 ConstraintChoicePtr LIBCALL
7376 ConstraintChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7377 {
7378    DataVal av;
7379    AsnTypePtr atp;
7380    ValNodePtr anp;
7381    Uint1 choice;
7382    Boolean isError = FALSE;
7383    Boolean nullIsError = FALSE;
7384    AsnReadFunc func;
7385 
7386    if (! loaded)
7387    {
7388       if (! objmacroAsnLoad()) {
7389          return NULL;
7390       }
7391    }
7392 
7393    if (aip == NULL) {
7394       return NULL;
7395    }
7396 
7397    if (orig == NULL) {         /* ConstraintChoice ::= (self contained) */
7398       atp = AsnReadId(aip, amp, CONSTRAINT_CHOICE);
7399    } else {
7400       atp = AsnLinkType(orig, CONSTRAINT_CHOICE);    /* link in local tree */
7401    }
7402    if (atp == NULL) {
7403       return NULL;
7404    }
7405 
7406    anp = ValNodeNew(NULL);
7407    if (anp == NULL) {
7408       goto erret;
7409    }
7410    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
7411       goto erret;
7412    }
7413 
7414    func = NULL;
7415 
7416    atp = AsnReadId(aip, amp, atp);  /* find the choice */
7417    if (atp == NULL) {
7418       goto erret;
7419    }
7420    if (atp == CONSTRAINT_CHOICE_string) {
7421       choice = ConstraintChoice_string;
7422       func = (AsnReadFunc) StringConstraintAsnRead;
7423    }
7424    else if (atp == CONSTRAINT_CHOICE_location) {
7425       choice = ConstraintChoice_location;
7426       func = (AsnReadFunc) LocationConstraintAsnRead;
7427    }
7428    else if (atp == CONSTRAINT_CHOICE_field) {
7429       choice = ConstraintChoice_field;
7430       func = (AsnReadFunc) FieldConstraintAsnRead;
7431    }
7432    else if (atp == CONSTRAINT_CHOICE_source) {
7433       choice = ConstraintChoice_source;
7434       func = (AsnReadFunc) SourceConstraintAsnRead;
7435    }
7436    else if (atp == CHOICE_cdsgeneprot_qual) {
7437       choice = ConstraintChoice_cdsgeneprot_qual;
7438       func = (AsnReadFunc) CDSGeneProtQualConstraintAsnRead;
7439    }
7440    else if (atp == CHOICE_cdsgeneprot_pseudo) {
7441       choice = ConstraintChoice_cdsgeneprot_pseudo;
7442       func = (AsnReadFunc) CDSGeneProtPseudoConstraintAsnRead;
7443    }
7444    else if (atp == CONSTRAINT_CHOICE_sequence) {
7445       choice = ConstraintChoice_sequence;
7446       func = (AsnReadFunc) SequenceConstraintAsnRead;
7447    }
7448    else if (atp == CONSTRAINT_CHOICE_pub) {
7449       choice = ConstraintChoice_pub;
7450       func = (AsnReadFunc) PublicationConstraintAsnRead;
7451    }
7452    anp->choice = choice;
7453    if (func != NULL)
7454    {
7455       anp->data.ptrvalue = (* func)(aip, atp);
7456       if (aip -> io_failure) goto erret;
7457 
7458       if (nullIsError && anp->data.ptrvalue == NULL) {
7459          goto erret;
7460       }
7461    }
7462 
7463 ret:
7464    AsnUnlinkType(orig);       /* unlink local tree */
7465    return anp;
7466 
7467 erret:
7468    anp = MemFree(anp);
7469    aip -> io_failure = TRUE;
7470    goto ret;
7471 }
7472 
7473 
7474 /**************************************************
7475 *
7476 *    ConstraintChoiceAsnWrite()
7477 *
7478 **************************************************/
7479 NLM_EXTERN Boolean LIBCALL 
7480 ConstraintChoiceAsnWrite(ConstraintChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
7481 
7482 {
7483    DataVal av;
7484    AsnTypePtr atp, writetype = NULL;
7485    Pointer pnt;
7486    AsnWriteFunc func = NULL;
7487    Boolean retval = FALSE;
7488 
7489    if (! loaded)
7490    {
7491       if (! objmacroAsnLoad())
7492       return FALSE;
7493    }
7494 
7495    if (aip == NULL)
7496    return FALSE;
7497 
7498    atp = AsnLinkType(orig, CONSTRAINT_CHOICE);   /* link local tree */
7499    if (atp == NULL) {
7500       return FALSE;
7501    }
7502 
7503    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7504 
7505    av.ptrvalue = (Pointer)anp;
7506    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
7507       goto erret;
7508    }
7509 
7510    pnt = anp->data.ptrvalue;
7511    switch (anp->choice)
7512    {
7513    case ConstraintChoice_string:
7514       writetype = CONSTRAINT_CHOICE_string;
7515       func = (AsnWriteFunc) StringConstraintAsnWrite;
7516       break;
7517    case ConstraintChoice_location:
7518       writetype = CONSTRAINT_CHOICE_location;
7519       func = (AsnWriteFunc) LocationConstraintAsnWrite;
7520       break;
7521    case ConstraintChoice_field:
7522       writetype = CONSTRAINT_CHOICE_field;
7523       func = (AsnWriteFunc) FieldConstraintAsnWrite;
7524       break;
7525    case ConstraintChoice_source:
7526       writetype = CONSTRAINT_CHOICE_source;
7527       func = (AsnWriteFunc) SourceConstraintAsnWrite;
7528       break;
7529    case ConstraintChoice_cdsgeneprot_qual:
7530       writetype = CHOICE_cdsgeneprot_qual;
7531       func = (AsnWriteFunc) CDSGeneProtQualConstraintAsnWrite;
7532       break;
7533    case ConstraintChoice_cdsgeneprot_pseudo:
7534       writetype = CHOICE_cdsgeneprot_pseudo;
7535       func = (AsnWriteFunc) CDSGeneProtPseudoConstraintAsnWrite;
7536       break;
7537    case ConstraintChoice_sequence:
7538       writetype = CONSTRAINT_CHOICE_sequence;
7539       func = (AsnWriteFunc) SequenceConstraintAsnWrite;
7540       break;
7541    case ConstraintChoice_pub:
7542       writetype = CONSTRAINT_CHOICE_pub;
7543       func = (AsnWriteFunc) PublicationConstraintAsnWrite;
7544       break;
7545    }
7546    if (writetype != NULL) {
7547       retval = (* func)(pnt, aip, writetype);   /* write it out */
7548    }
7549    if (!retval) {
7550       goto erret;
7551    }
7552    retval = TRUE;
7553 
7554 erret:
7555    AsnUnlinkType(orig);       /* unlink local tree */
7556    return retval;
7557 }
7558 
7559 
7560 /**************************************************
7561 *
7562 *    ConstraintChoiceSetFree()
7563 *
7564 **************************************************/
7565 NLM_EXTERN 
7566 ConstraintChoiceSetPtr LIBCALL
7567 ConstraintChoiceSetFree(ConstraintChoiceSetPtr ptr)
7568 {
7569 
7570    if(ptr == NULL) {
7571       return NULL;
7572    }
7573    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) ConstraintChoiceFree);
7574    return NULL;
7575 }
7576 
7577 
7578 /**************************************************
7579 *
7580 *    ConstraintChoiceSetAsnRead()
7581 *
7582 **************************************************/
7583 NLM_EXTERN 
7584 ConstraintChoiceSetPtr LIBCALL
7585 ConstraintChoiceSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7586 {
7587    DataVal av;
7588    AsnTypePtr atp;
7589    Boolean isError = FALSE;
7590    AsnReadFunc func;
7591    ConstraintChoiceSetPtr ptr;
7592 
7593    if (! loaded)
7594    {
7595       if (! objmacroAsnLoad()) {
7596          return NULL;
7597       }
7598    }
7599 
7600    if (aip == NULL) {
7601       return NULL;
7602    }
7603 
7604    if (orig == NULL) {         /* ConstraintChoiceSet ::= (self contained) */
7605       atp = AsnReadId(aip, amp, CONSTRAINT_CHOICE_SET);
7606    } else {
7607       atp = AsnLinkType(orig, CONSTRAINT_CHOICE_SET);
7608    }
7609    /* link in local tree */
7610    if (atp == NULL) {
7611       return NULL;
7612    }
7613 
7614    func = NULL;
7615 
7616    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ConstraintChoiceAsnRead, (AsnOptFreeFunc) ConstraintChoiceFree);
7617    if (isError && ptr  == NULL) {
7618       goto erret;
7619    }
7620 
7621 
7622 
7623 ret:
7624    AsnUnlinkType(orig);       /* unlink local tree */
7625    return ptr;
7626 
7627 erret:
7628    aip -> io_failure = TRUE;
7629    ptr = ConstraintChoiceSetFree(ptr);
7630    goto ret;
7631 }
7632 
7633 
7634 
7635 /**************************************************
7636 *
7637 *    ConstraintChoiceSetAsnWrite()
7638 *
7639 **************************************************/
7640 NLM_EXTERN Boolean LIBCALL 
7641 ConstraintChoiceSetAsnWrite(ConstraintChoiceSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
7642 {
7643    DataVal av;
7644    AsnTypePtr atp;
7645    Boolean retval = FALSE;
7646 
7647    if (! loaded)
7648    {
7649       if (! objmacroAsnLoad()) {
7650          return FALSE;
7651       }
7652    }
7653 
7654    if (aip == NULL) {
7655       return FALSE;
7656    }
7657 
7658    atp = AsnLinkType(orig, CONSTRAINT_CHOICE_SET);   /* link local tree */
7659    if (atp == NULL) {
7660       return FALSE;
7661    }
7662 
7663    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7664    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) ConstraintChoiceAsnWrite, aip, atp, CONSTRAINT_CHOICE_SET_E);
7665    retval = TRUE;
7666 
7667 erret:
7668    AsnUnlinkType(orig);       /* unlink local tree */
7669    return retval;
7670 }
7671 
7672 
7673 
7674 /**************************************************
7675 *
7676 *    TextPortionNew()
7677 *
7678 **************************************************/
7679 NLM_EXTERN 
7680 TextPortionPtr LIBCALL
7681 TextPortionNew(void)
7682 {
7683    TextPortionPtr ptr = MemNew((size_t) sizeof(TextPortion));
7684 
7685    ptr -> case_sensitive = 0;
7686    ptr -> whole_word = 0;
7687    return ptr;
7688 
7689 }
7690 
7691 
7692 /**************************************************
7693 *
7694 *    TextPortionFree()
7695 *
7696 **************************************************/
7697 NLM_EXTERN 
7698 TextPortionPtr LIBCALL
7699 TextPortionFree(TextPortionPtr ptr)
7700 {
7701 
7702    if(ptr == NULL) {
7703       return NULL;
7704    }
7705    MemFree(ptr -> left_text);
7706    MemFree(ptr -> right_text);
7707    return MemFree(ptr);
7708 }
7709 
7710 
7711 /**************************************************
7712 *
7713 *    TextPortionAsnRead()
7714 *
7715 **************************************************/
7716 NLM_EXTERN 
7717 TextPortionPtr LIBCALL
7718 TextPortionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7719 {
7720    DataVal av;
7721    AsnTypePtr atp;
7722    Boolean isError = FALSE;
7723    AsnReadFunc func;
7724    TextPortionPtr ptr;
7725 
7726    if (! loaded)
7727    {
7728       if (! objmacroAsnLoad()) {
7729          return NULL;
7730       }
7731    }
7732 
7733    if (aip == NULL) {
7734       return NULL;
7735    }
7736 
7737    if (orig == NULL) {         /* TextPortion ::= (self contained) */
7738       atp = AsnReadId(aip, amp, TEXT_PORTION);
7739    } else {
7740       atp = AsnLinkType(orig, TEXT_PORTION);
7741    }
7742    /* link in local tree */
7743    if (atp == NULL) {
7744       return NULL;
7745    }
7746 
7747    ptr = TextPortionNew();
7748    if (ptr == NULL) {
7749       goto erret;
7750    }
7751    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
7752       goto erret;
7753    }
7754 
7755    atp = AsnReadId(aip,amp, atp);
7756    func = NULL;
7757 
7758    if (atp == TEXT_PORTION_left_text) {
7759       if ( AsnReadVal(aip, atp, &av) <= 0) {
7760          goto erret;
7761       }
7762       ptr -> left_text = av.ptrvalue;
7763       atp = AsnReadId(aip,amp, atp);
7764    }
7765    if (atp == TEXT_PORTION_include_left) {
7766       if ( AsnReadVal(aip, atp, &av) <= 0) {
7767          goto erret;
7768       }
7769       ptr -> include_left = av.boolvalue;
7770       atp = AsnReadId(aip,amp, atp);
7771    }
7772    if (atp == TEXT_PORTION_right_text) {
7773       if ( AsnReadVal(aip, atp, &av) <= 0) {
7774          goto erret;
7775       }
7776       ptr -> right_text = av.ptrvalue;
7777       atp = AsnReadId(aip,amp, atp);
7778    }
7779    if (atp == TEXT_PORTION_include_right) {
7780       if ( AsnReadVal(aip, atp, &av) <= 0) {
7781          goto erret;
7782       }
7783       ptr -> include_right = av.boolvalue;
7784       atp = AsnReadId(aip,amp, atp);
7785    }
7786    if (atp == TEXT_PORTION_inside) {
7787       if ( AsnReadVal(aip, atp, &av) <= 0) {
7788          goto erret;
7789       }
7790       ptr -> inside = av.boolvalue;
7791       atp = AsnReadId(aip,amp, atp);
7792    }
7793    if (atp == TEXT_PORTION_case_sensitive) {
7794       if ( AsnReadVal(aip, atp, &av) <= 0) {
7795          goto erret;
7796       }
7797       ptr -> case_sensitive = av.boolvalue;
7798       atp = AsnReadId(aip,amp, atp);
7799    }
7800    if (atp == TEXT_PORTION_whole_word) {
7801       if ( AsnReadVal(aip, atp, &av) <= 0) {
7802          goto erret;
7803       }
7804       ptr -> whole_word = av.boolvalue;
7805       atp = AsnReadId(aip,amp, atp);
7806    }
7807 
7808    if (AsnReadVal(aip, atp, &av) <= 0) {
7809       goto erret;
7810    }
7811    /* end struct */
7812 
7813 ret:
7814    AsnUnlinkType(orig);       /* unlink local tree */
7815    return ptr;
7816 
7817 erret:
7818    aip -> io_failure = TRUE;
7819    ptr = TextPortionFree(ptr);
7820    goto ret;
7821 }
7822 
7823 
7824 
7825 /**************************************************
7826 *
7827 *    TextPortionAsnWrite()
7828 *
7829 **************************************************/
7830 NLM_EXTERN Boolean LIBCALL 
7831 TextPortionAsnWrite(TextPortionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
7832 {
7833    DataVal av;
7834    AsnTypePtr atp;
7835    Boolean retval = FALSE;
7836 
7837    if (! loaded)
7838    {
7839       if (! objmacroAsnLoad()) {
7840          return FALSE;
7841       }
7842    }
7843 
7844    if (aip == NULL) {
7845       return FALSE;
7846    }
7847 
7848    atp = AsnLinkType(orig, TEXT_PORTION);   /* link local tree */
7849    if (atp == NULL) {
7850       return FALSE;
7851    }
7852 
7853    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7854    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
7855       goto erret;
7856    }
7857 
7858    if (ptr -> left_text != NULL) {
7859       av.ptrvalue = ptr -> left_text;
7860       retval = AsnWrite(aip, TEXT_PORTION_left_text,  &av);
7861    }
7862    av.boolvalue = ptr -> include_left;
7863    retval = AsnWrite(aip, TEXT_PORTION_include_left,  &av);
7864    if (ptr -> right_text != NULL) {
7865       av.ptrvalue = ptr -> right_text;
7866       retval = AsnWrite(aip, TEXT_PORTION_right_text,  &av);
7867    }
7868    av.boolvalue = ptr -> include_right;
7869    retval = AsnWrite(aip, TEXT_PORTION_include_right,  &av);
7870    av.boolvalue = ptr -> inside;
7871    retval = AsnWrite(aip, TEXT_PORTION_inside,  &av);
7872    av.boolvalue = ptr -> case_sensitive;
7873    retval = AsnWrite(aip, TEXT_PORTION_case_sensitive,  &av);
7874    av.boolvalue = ptr -> whole_word;
7875    retval = AsnWrite(aip, TEXT_PORTION_whole_word,  &av);
7876    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
7877       goto erret;
7878    }
7879    retval = TRUE;
7880 
7881 erret:
7882    AsnUnlinkType(orig);       /* unlink local tree */
7883    return retval;
7884 }
7885 
7886 
7887 
7888 /**************************************************
7889 *
7890 *    FieldEditNew()
7891 *
7892 **************************************************/
7893 NLM_EXTERN 
7894 FieldEditPtr LIBCALL
7895 FieldEditNew(void)
7896 {
7897    FieldEditPtr ptr = MemNew((size_t) sizeof(FieldEdit));
7898 
7899    ptr -> location = 0;
7900    return ptr;
7901 
7902 }
7903 
7904 
7905 /**************************************************
7906 *
7907 *    FieldEditFree()
7908 *
7909 **************************************************/
7910 NLM_EXTERN 
7911 FieldEditPtr LIBCALL
7912 FieldEditFree(FieldEditPtr ptr)
7913 {
7914 
7915    if(ptr == NULL) {
7916       return NULL;
7917    }
7918    MemFree(ptr -> find_txt);
7919    MemFree(ptr -> repl_txt);
7920    return MemFree(ptr);
7921 }
7922 
7923 
7924 /**************************************************
7925 *
7926 *    FieldEditAsnRead()
7927 *
7928 **************************************************/
7929 NLM_EXTERN 
7930 FieldEditPtr LIBCALL
7931 FieldEditAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7932 {
7933    DataVal av;
7934    AsnTypePtr atp;
7935    Boolean isError = FALSE;
7936    AsnReadFunc func;
7937    FieldEditPtr ptr;
7938 
7939    if (! loaded)
7940    {
7941       if (! objmacroAsnLoad()) {
7942          return NULL;
7943       }
7944    }
7945 
7946    if (aip == NULL) {
7947       return NULL;
7948    }
7949 
7950    if (orig == NULL) {         /* FieldEdit ::= (self contained) */
7951       atp = AsnReadId(aip, amp, FIELD_EDIT);
7952    } else {
7953       atp = AsnLinkType(orig, FIELD_EDIT);
7954    }
7955    /* link in local tree */
7956    if (atp == NULL) {
7957       return NULL;
7958    }
7959 
7960    ptr = FieldEditNew();
7961    if (ptr == NULL) {
7962       goto erret;
7963    }
7964    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
7965       goto erret;
7966    }
7967 
7968    atp = AsnReadId(aip,amp, atp);
7969    func = NULL;
7970 
7971    if (atp == FIELD_EDIT_find_txt) {
7972       if ( AsnReadVal(aip, atp, &av) <= 0) {
7973          goto erret;
7974       }
7975       ptr -> find_txt = av.ptrvalue;
7976       atp = AsnReadId(aip,amp, atp);
7977    }
7978    if (atp == FIELD_EDIT_repl_txt) {
7979       if ( AsnReadVal(aip, atp, &av) <= 0) {
7980          goto erret;
7981       }
7982       ptr -> repl_txt = av.ptrvalue;
7983       atp = AsnReadId(aip,amp, atp);
7984    }
7985    if (atp == FIELD_EDIT_location) {
7986       if ( AsnReadVal(aip, atp, &av) <= 0) {
7987          goto erret;
7988       }
7989       ptr -> location = av.intvalue;
7990       atp = AsnReadId(aip,amp, atp);
7991    }
7992 
7993    if (AsnReadVal(aip, atp, &av) <= 0) {
7994       goto erret;
7995    }
7996    /* end struct */
7997 
7998 ret:
7999    AsnUnlinkType(orig);       /* unlink local tree */
8000    return ptr;
8001 
8002 erret:
8003    aip -> io_failure = TRUE;
8004    ptr = FieldEditFree(ptr);
8005    goto ret;
8006 }
8007 
8008 
8009 
8010 /**************************************************
8011 *
8012 *    FieldEditAsnWrite()
8013 *
8014 **************************************************/
8015 NLM_EXTERN Boolean LIBCALL 
8016 FieldEditAsnWrite(FieldEditPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
8017 {
8018    DataVal av;
8019    AsnTypePtr atp;
8020    Boolean retval = FALSE;
8021 
8022    if (! loaded)
8023    {
8024       if (! objmacroAsnLoad()) {
8025          return FALSE;
8026       }
8027    }
8028 
8029    if (aip == NULL) {
8030       return FALSE;
8031    }
8032 
8033    atp = AsnLinkType(orig, FIELD_EDIT);   /* link local tree */
8034    if (atp == NULL) {
8035       return FALSE;
8036    }
8037 
8038    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8039    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
8040       goto erret;
8041    }
8042 
8043    if (ptr -> find_txt != NULL) {
8044       av.ptrvalue = ptr -> find_txt;
8045       retval = AsnWrite(aip, FIELD_EDIT_find_txt,  &av);
8046    }
8047    if (ptr -> repl_txt != NULL) {
8048       av.ptrvalue = ptr -> repl_txt;
8049       retval = AsnWrite(aip, FIELD_EDIT_repl_txt,  &av);
8050    }
8051    av.intvalue = ptr -> location;
8052    retval = AsnWrite(aip, FIELD_EDIT_location,  &av);
8053    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
8054       goto erret;
8055    }
8056    retval = TRUE;
8057 
8058 erret:
8059    AsnUnlinkType(orig);       /* unlink local tree */
8060    return retval;
8061 }
8062 
8063 
8064 
8065 /**************************************************
8066 *
8067 *    FieldPairTypeFree()
8068 *
8069 **************************************************/
8070 NLM_EXTERN 
8071 FieldPairTypePtr LIBCALL
8072 FieldPairTypeFree(ValNodePtr anp)
8073 {
8074    Pointer pnt;
8075 
8076    if (anp == NULL) {
8077       return NULL;
8078    }
8079 
8080    pnt = anp->data.ptrvalue;
8081    switch (anp->choice)
8082    {
8083    default:
8084       break;
8085    case FieldPairType_source_qual:
8086       SourceQualPairFree(anp -> data.ptrvalue);
8087       break;
8088    case FieldPairType_feature_field:
8089       FeatureFieldPairFree(anp -> data.ptrvalue);
8090       break;
8091    case FieldPairType_rna_field:
8092       RnaQualPairFree(anp -> data.ptrvalue);
8093       break;
8094    case FieldPairType_cds_gene_prot:
8095       CDSGeneProtFieldPairFree(anp -> data.ptrvalue);
8096       break;
8097    case FieldPairType_molinfo_field:
8098       MolinfoFieldPairFree(anp -> data.ptrvalue);
8099       break;
8100    case FieldPairType_struc_comment_field:
8101       StructuredCommentFieldPairFree(anp -> data.ptrvalue);
8102       break;
8103    }
8104    return MemFree(anp);
8105 }
8106 
8107 
8108 /**************************************************
8109 *
8110 *    FieldPairTypeAsnRead()
8111 *
8112 **************************************************/
8113 NLM_EXTERN 
8114 FieldPairTypePtr LIBCALL
8115 FieldPairTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8116 {
8117    DataVal av;
8118    AsnTypePtr atp;
8119    ValNodePtr anp;
8120    Uint1 choice;
8121    Boolean isError = FALSE;
8122    Boolean nullIsError = FALSE;
8123    AsnReadFunc func;
8124 
8125    if (! loaded)
8126    {
8127       if (! objmacroAsnLoad()) {
8128          return NULL;
8129       }
8130    }
8131 
8132    if (aip == NULL) {
8133       return NULL;
8134    }
8135 
8136    if (orig == NULL) {         /* FieldPairType ::= (self contained) */
8137       atp = AsnReadId(aip, amp, FIELD_PAIR_TYPE);
8138    } else {
8139       atp = AsnLinkType(orig, FIELD_PAIR_TYPE);    /* link in local tree */
8140    }
8141    if (atp == NULL) {
8142       return NULL;
8143    }
8144 
8145    anp = ValNodeNew(NULL);
8146    if (anp == NULL) {
8147       goto erret;
8148    }
8149    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
8150       goto erret;
8151    }
8152 
8153    func = NULL;
8154 
8155    atp = AsnReadId(aip, amp, atp);  /* find the choice */
8156    if (atp == NULL) {
8157       goto erret;
8158    }
8159    if (atp == FIELD_PAIR_TYPE_source_qual) {
8160       choice = FieldPairType_source_qual;
8161       func = (AsnReadFunc) SourceQualPairAsnRead;
8162    }
8163    else if (atp == FIELD_PAIR_TYPE_feature_field) {
8164       choice = FieldPairType_feature_field;
8165       func = (AsnReadFunc) FeatureFieldPairAsnRead;
8166    }
8167    else if (atp == FIELD_PAIR_TYPE_rna_field) {
8168       choice = FieldPairType_rna_field;
8169       func = (AsnReadFunc) RnaQualPairAsnRead;
8170    }
8171    else if (atp == FIELD_PAIR_TYPE_cds_gene_prot) {
8172       choice = FieldPairType_cds_gene_prot;
8173       func = (AsnReadFunc) CDSGeneProtFieldPairAsnRead;
8174    }
8175    else if (atp == FIELD_PAIR_TYPE_molinfo_field) {
8176       choice = FieldPairType_molinfo_field;
8177       func = (AsnReadFunc) MolinfoFieldPairAsnRead;
8178    }
8179    else if (atp == PAIR_TYPE_struc_comment_field) {
8180       choice = FieldPairType_struc_comment_field;
8181       func = (AsnReadFunc) StructuredCommentFieldPairAsnRead;
8182    }
8183    anp->choice = choice;
8184    if (func != NULL)
8185    {
8186       anp->data.ptrvalue = (* func)(aip, atp);
8187       if (aip -> io_failure) goto erret;
8188 
8189       if (nullIsError && anp->data.ptrvalue == NULL) {
8190          goto erret;
8191       }
8192    }
8193 
8194 ret:
8195    AsnUnlinkType(orig);       /* unlink local tree */
8196    return anp;
8197 
8198 erret:
8199    anp = MemFree(anp);
8200    aip -> io_failure = TRUE;
8201    goto ret;
8202 }
8203 
8204 
8205 /**************************************************
8206 *
8207 *    FieldPairTypeAsnWrite()
8208 *
8209 **************************************************/
8210 NLM_EXTERN Boolean LIBCALL 
8211 FieldPairTypeAsnWrite(FieldPairTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
8212 
8213 {
8214    DataVal av;
8215    AsnTypePtr atp, writetype = NULL;
8216    Pointer pnt;
8217    AsnWriteFunc func = NULL;
8218    Boolean retval = FALSE;
8219 
8220    if (! loaded)
8221    {
8222       if (! objmacroAsnLoad())
8223       return FALSE;
8224    }
8225 
8226    if (aip == NULL)
8227    return FALSE;
8228 
8229    atp = AsnLinkType(orig, FIELD_PAIR_TYPE);   /* link local tree */
8230    if (atp == NULL) {
8231       return FALSE;
8232    }
8233 
8234    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8235 
8236    av.ptrvalue = (Pointer)anp;
8237    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
8238       goto erret;
8239    }
8240 
8241    pnt = anp->data.ptrvalue;
8242    switch (anp->choice)
8243    {
8244    case FieldPairType_source_qual:
8245       writetype = FIELD_PAIR_TYPE_source_qual;
8246       func = (AsnWriteFunc) SourceQualPairAsnWrite;
8247       break;
8248    case FieldPairType_feature_field:
8249       writetype = FIELD_PAIR_TYPE_feature_field;
8250       func = (AsnWriteFunc) FeatureFieldPairAsnWrite;
8251       break;
8252    case FieldPairType_rna_field:
8253       writetype = FIELD_PAIR_TYPE_rna_field;
8254       func = (AsnWriteFunc) RnaQualPairAsnWrite;
8255       break;
8256    case FieldPairType_cds_gene_prot:
8257       writetype = FIELD_PAIR_TYPE_cds_gene_prot;
8258       func = (AsnWriteFunc) CDSGeneProtFieldPairAsnWrite;
8259       break;
8260    case FieldPairType_molinfo_field:
8261       writetype = FIELD_PAIR_TYPE_molinfo_field;
8262       func = (AsnWriteFunc) MolinfoFieldPairAsnWrite;
8263       break;
8264    case FieldPairType_struc_comment_field:
8265       writetype = PAIR_TYPE_struc_comment_field;
8266       func = (AsnWriteFunc) StructuredCommentFieldPairAsnWrite;
8267       break;
8268    }
8269    if (writetype != NULL) {
8270       retval = (* func)(pnt, aip, writetype);   /* write it out */
8271    }
8272    if (!retval) {
8273       goto erret;
8274    }
8275    retval = TRUE;
8276 
8277 erret:
8278    AsnUnlinkType(orig);       /* unlink local tree */
8279    return retval;
8280 }
8281 
8282 
8283 /**************************************************
8284 *
8285 *    ApplyActionNew()
8286 *
8287 **************************************************/
8288 NLM_EXTERN 
8289 ApplyActionPtr LIBCALL
8290 ApplyActionNew(void)
8291 {
8292    ApplyActionPtr ptr = MemNew((size_t) sizeof(ApplyAction));
8293 
8294    return ptr;
8295 
8296 }
8297 
8298 
8299 /**************************************************
8300 *
8301 *    ApplyActionFree()
8302 *
8303 **************************************************/
8304 NLM_EXTERN 
8305 ApplyActionPtr LIBCALL
8306 ApplyActionFree(ApplyActionPtr ptr)
8307 {
8308 
8309    if(ptr == NULL) {
8310       return NULL;
8311    }
8312    FieldTypeFree(ptr -> field);
8313    MemFree(ptr -> value);
8314    return MemFree(ptr);
8315 }
8316 
8317 
8318 /**************************************************
8319 *
8320 *    ApplyActionAsnRead()
8321 *
8322 **************************************************/
8323 NLM_EXTERN 
8324 ApplyActionPtr LIBCALL
8325 ApplyActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8326 {
8327    DataVal av;
8328    AsnTypePtr atp;
8329    Boolean isError = FALSE;
8330    AsnReadFunc func;
8331    ApplyActionPtr ptr;
8332 
8333    if (! loaded)
8334    {
8335       if (! objmacroAsnLoad()) {
8336          return NULL;
8337       }
8338    }
8339 
8340    if (aip == NULL) {
8341       return NULL;
8342    }
8343 
8344    if (orig == NULL) {         /* ApplyAction ::= (self contained) */
8345       atp = AsnReadId(aip, amp, APPLY_ACTION);
8346    } else {
8347       atp = AsnLinkType(orig, APPLY_ACTION);
8348    }
8349    /* link in local tree */
8350    if (atp == NULL) {
8351       return NULL;
8352    }
8353 
8354    ptr = ApplyActionNew();
8355    if (ptr == NULL) {
8356       goto erret;
8357    }
8358    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
8359       goto erret;
8360    }
8361 
8362    atp = AsnReadId(aip,amp, atp);
8363    func = NULL;
8364 
8365    if (atp == APPLY_ACTION_field) {
8366       ptr -> field = FieldTypeAsnRead(aip, atp);
8367       if (aip -> io_failure) {
8368          goto erret;
8369       }
8370       atp = AsnReadId(aip,amp, atp);
8371    }
8372    if (atp == APPLY_ACTION_value) {
8373       if ( AsnReadVal(aip, atp, &av) <= 0) {
8374          goto erret;
8375       }
8376       ptr -> value = av.ptrvalue;
8377       atp = AsnReadId(aip,amp, atp);
8378    }
8379    if (atp == APPLY_ACTION_existing_text) {
8380       if ( AsnReadVal(aip, atp, &av) <= 0) {
8381          goto erret;
8382       }
8383       ptr -> existing_text = av.intvalue;
8384       atp = AsnReadId(aip,amp, atp);
8385    }
8386 
8387    if (AsnReadVal(aip, atp, &av) <= 0) {
8388       goto erret;
8389    }
8390    /* end struct */
8391 
8392 ret:
8393    AsnUnlinkType(orig);       /* unlink local tree */
8394    return ptr;
8395 
8396 erret:
8397    aip -> io_failure = TRUE;
8398    ptr = ApplyActionFree(ptr);
8399    goto ret;
8400 }
8401 
8402 
8403 
8404 /**************************************************
8405 *
8406 *    ApplyActionAsnWrite()
8407 *
8408 **************************************************/
8409 NLM_EXTERN Boolean LIBCALL 
8410 ApplyActionAsnWrite(ApplyActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
8411 {
8412    DataVal av;
8413    AsnTypePtr atp;
8414    Boolean retval = FALSE;
8415 
8416    if (! loaded)
8417    {
8418       if (! objmacroAsnLoad()) {
8419          return FALSE;
8420       }
8421    }
8422 
8423    if (aip == NULL) {
8424       return FALSE;
8425    }
8426 
8427    atp = AsnLinkType(orig, APPLY_ACTION);   /* link local tree */
8428    if (atp == NULL) {
8429       return FALSE;
8430    }
8431 
8432    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8433    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
8434       goto erret;
8435    }
8436 
8437    if (ptr -> field != NULL) {
8438       if ( ! FieldTypeAsnWrite(ptr -> field, aip, APPLY_ACTION_field)) {
8439          goto erret;
8440       }
8441    }
8442    if (ptr -> value != NULL) {
8443       av.ptrvalue = ptr -> value;
8444       retval = AsnWrite(aip, APPLY_ACTION_value,  &av);
8445    }
8446    av.intvalue = ptr -> existing_text;
8447    retval = AsnWrite(aip, APPLY_ACTION_existing_text,  &av);
8448    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
8449       goto erret;
8450    }
8451    retval = TRUE;
8452 
8453 erret:
8454    AsnUnlinkType(orig);       /* unlink local tree */
8455    return retval;
8456 }
8457 
8458 
8459 
8460 /**************************************************
8461 *
8462 *    EditActionNew()
8463 *
8464 **************************************************/
8465 NLM_EXTERN 
8466 EditActionPtr LIBCALL
8467 EditActionNew(void)
8468 {
8469    EditActionPtr ptr = MemNew((size_t) sizeof(EditAction));
8470 
8471    return ptr;
8472 
8473 }
8474 
8475 
8476 /**************************************************
8477 *
8478 *    EditActionFree()
8479 *
8480 **************************************************/
8481 NLM_EXTERN 
8482 EditActionPtr LIBCALL
8483 EditActionFree(EditActionPtr ptr)
8484 {
8485 
8486    if(ptr == NULL) {
8487       return NULL;
8488    }
8489    FieldEditFree(ptr -> edit);
8490    FieldTypeFree(ptr -> field);
8491    return MemFree(ptr);
8492 }
8493 
8494 
8495 /**************************************************
8496 *
8497 *    EditActionAsnRead()
8498 *
8499 **************************************************/
8500 NLM_EXTERN 
8501 EditActionPtr LIBCALL
8502 EditActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8503 {
8504    DataVal av;
8505    AsnTypePtr atp;
8506    Boolean isError = FALSE;
8507    AsnReadFunc func;
8508    EditActionPtr ptr;
8509 
8510    if (! loaded)
8511    {
8512       if (! objmacroAsnLoad()) {
8513          return NULL;
8514       }
8515    }
8516 
8517    if (aip == NULL) {
8518       return NULL;
8519    }
8520 
8521    if (orig == NULL) {         /* EditAction ::= (self contained) */
8522       atp = AsnReadId(aip, amp, EDIT_ACTION);
8523    } else {
8524       atp = AsnLinkType(orig, EDIT_ACTION);
8525    }
8526    /* link in local tree */
8527    if (atp == NULL) {
8528       return NULL;
8529    }
8530 
8531    ptr = EditActionNew();
8532    if (ptr == NULL) {
8533       goto erret;
8534    }
8535    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
8536       goto erret;
8537    }
8538 
8539    atp = AsnReadId(aip,amp, atp);
8540    func = NULL;
8541 
8542    if (atp == EDIT_ACTION_edit) {
8543       ptr -> edit = FieldEditAsnRead(aip, atp);
8544       if (aip -> io_failure) {
8545          goto erret;
8546       }
8547       atp = AsnReadId(aip,amp, atp);
8548    }
8549    if (atp == EDIT_ACTION_field) {
8550       ptr -> field = FieldTypeAsnRead(aip, atp);
8551       if (aip -> io_failure) {
8552          goto erret;
8553       }
8554       atp = AsnReadId(aip,amp, atp);
8555    }
8556 
8557    if (AsnReadVal(aip, atp, &av) <= 0) {
8558       goto erret;
8559    }
8560    /* end struct */
8561 
8562 ret:
8563    AsnUnlinkType(orig);       /* unlink local tree */
8564    return ptr;
8565 
8566 erret:
8567    aip -> io_failure = TRUE;
8568    ptr = EditActionFree(ptr);
8569    goto ret;
8570 }
8571 
8572 
8573 
8574 /**************************************************
8575 *
8576 *    EditActionAsnWrite()
8577 *
8578 **************************************************/
8579 NLM_EXTERN Boolean LIBCALL 
8580 EditActionAsnWrite(EditActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
8581 {
8582    DataVal av;
8583    AsnTypePtr atp;
8584    Boolean retval = FALSE;
8585 
8586    if (! loaded)
8587    {
8588       if (! objmacroAsnLoad()) {
8589          return FALSE;
8590       }
8591    }
8592 
8593    if (aip == NULL) {
8594       return FALSE;
8595    }
8596 
8597    atp = AsnLinkType(orig, EDIT_ACTION);   /* link local tree */
8598    if (atp == NULL) {
8599       return FALSE;
8600    }
8601 
8602    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8603    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
8604       goto erret;
8605    }
8606 
8607    if (ptr -> edit != NULL) {
8608       if ( ! FieldEditAsnWrite(ptr -> edit, aip, EDIT_ACTION_edit)) {
8609          goto erret;
8610       }
8611    }
8612    if (ptr -> field != NULL) {
8613       if ( ! FieldTypeAsnWrite(ptr -> field, aip, EDIT_ACTION_field)) {
8614          goto erret;
8615       }
8616    }
8617    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
8618       goto erret;
8619    }
8620    retval = TRUE;
8621 
8622 erret:
8623    AsnUnlinkType(orig);       /* unlink local tree */
8624    return retval;
8625 }
8626 
8627 
8628 
8629 /**************************************************
8630 *
8631 *    ConvertActionNew()
8632 *
8633 **************************************************/
8634 NLM_EXTERN 
8635 ConvertActionPtr LIBCALL
8636 ConvertActionNew(void)
8637 {
8638    ConvertActionPtr ptr = MemNew((size_t) sizeof(ConvertAction));
8639 
8640    ptr -> strip_name = 0;
8641    ptr -> keep_original = 0;
8642    return ptr;
8643 
8644 }
8645 
8646 
8647 /**************************************************
8648 *
8649 *    ConvertActionFree()
8650 *
8651 **************************************************/
8652 NLM_EXTERN 
8653 ConvertActionPtr LIBCALL
8654 ConvertActionFree(ConvertActionPtr ptr)
8655 {
8656 
8657    if(ptr == NULL) {
8658       return NULL;
8659    }
8660    FieldPairTypeFree(ptr -> fields);
8661    return MemFree(ptr);
8662 }
8663 
8664 
8665 /**************************************************
8666 *
8667 *    ConvertActionAsnRead()
8668 *
8669 **************************************************/
8670 NLM_EXTERN 
8671 ConvertActionPtr LIBCALL
8672 ConvertActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8673 {
8674    DataVal av;
8675    AsnTypePtr atp;
8676    Boolean isError = FALSE;
8677    AsnReadFunc func;
8678    ConvertActionPtr ptr;
8679 
8680    if (! loaded)
8681    {
8682       if (! objmacroAsnLoad()) {
8683          return NULL;
8684       }
8685    }
8686 
8687    if (aip == NULL) {
8688       return NULL;
8689    }
8690 
8691    if (orig == NULL) {         /* ConvertAction ::= (self contained) */
8692       atp = AsnReadId(aip, amp, CONVERT_ACTION);
8693    } else {
8694       atp = AsnLinkType(orig, CONVERT_ACTION);
8695    }
8696    /* link in local tree */
8697    if (atp == NULL) {
8698       return NULL;
8699    }
8700 
8701    ptr = ConvertActionNew();
8702    if (ptr == NULL) {
8703       goto erret;
8704    }
8705    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
8706       goto erret;
8707    }
8708 
8709    atp = AsnReadId(aip,amp, atp);
8710    func = NULL;
8711 
8712    if (atp == CONVERT_ACTION_fields) {
8713       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
8714       if (aip -> io_failure) {
8715          goto erret;
8716       }
8717       atp = AsnReadId(aip,amp, atp);
8718    }
8719    if (atp == CONVERT_ACTION_strip_name) {
8720       if ( AsnReadVal(aip, atp, &av) <= 0) {
8721          goto erret;
8722       }
8723       ptr -> strip_name = av.boolvalue;
8724       atp = AsnReadId(aip,amp, atp);
8725    }
8726    if (atp == CONVERT_ACTION_keep_original) {
8727       if ( AsnReadVal(aip, atp, &av) <= 0) {
8728          goto erret;
8729       }
8730       ptr -> keep_original = av.boolvalue;
8731       atp = AsnReadId(aip,amp, atp);
8732    }
8733    if (atp == CONVERT_ACTION_existing_text) {
8734       if ( AsnReadVal(aip, atp, &av) <= 0) {
8735          goto erret;
8736       }
8737       ptr -> existing_text = av.intvalue;
8738       atp = AsnReadId(aip,amp, atp);
8739    }
8740 
8741    if (AsnReadVal(aip, atp, &av) <= 0) {
8742       goto erret;
8743    }
8744    /* end struct */
8745 
8746 ret:
8747    AsnUnlinkType(orig);       /* unlink local tree */
8748    return ptr;
8749 
8750 erret:
8751    aip -> io_failure = TRUE;
8752    ptr = ConvertActionFree(ptr);
8753    goto ret;
8754 }
8755 
8756 
8757 
8758 /**************************************************
8759 *
8760 *    ConvertActionAsnWrite()
8761 *
8762 **************************************************/
8763 NLM_EXTERN Boolean LIBCALL 
8764 ConvertActionAsnWrite(ConvertActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
8765 {
8766    DataVal av;
8767    AsnTypePtr atp;
8768    Boolean retval = FALSE;
8769 
8770    if (! loaded)
8771    {
8772       if (! objmacroAsnLoad()) {
8773          return FALSE;
8774       }
8775    }
8776 
8777    if (aip == NULL) {
8778       return FALSE;
8779    }
8780 
8781    atp = AsnLinkType(orig, CONVERT_ACTION);   /* link local tree */
8782    if (atp == NULL) {
8783       return FALSE;
8784    }
8785 
8786    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8787    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
8788       goto erret;
8789    }
8790 
8791    if (ptr -> fields != NULL) {
8792       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, CONVERT_ACTION_fields)) {
8793          goto erret;
8794       }
8795    }
8796    av.boolvalue = ptr -> strip_name;
8797    retval = AsnWrite(aip, CONVERT_ACTION_strip_name,  &av);
8798    av.boolvalue = ptr -> keep_original;
8799    retval = AsnWrite(aip, CONVERT_ACTION_keep_original,  &av);
8800    av.intvalue = ptr -> existing_text;
8801    retval = AsnWrite(aip, CONVERT_ACTION_existing_text,  &av);
8802    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
8803       goto erret;
8804    }
8805    retval = TRUE;
8806 
8807 erret:
8808    AsnUnlinkType(orig);       /* unlink local tree */
8809    return retval;
8810 }
8811 
8812 
8813 
8814 /**************************************************
8815 *
8816 *    CopyActionNew()
8817 *
8818 **************************************************/
8819 NLM_EXTERN 
8820 CopyActionPtr LIBCALL
8821 CopyActionNew(void)
8822 {
8823    CopyActionPtr ptr = MemNew((size_t) sizeof(CopyAction));
8824 
8825    return ptr;
8826 
8827 }
8828 
8829 
8830 /**************************************************
8831 *
8832 *    CopyActionFree()
8833 *
8834 **************************************************/
8835 NLM_EXTERN 
8836 CopyActionPtr LIBCALL
8837 CopyActionFree(CopyActionPtr ptr)
8838 {
8839 
8840    if(ptr == NULL) {
8841       return NULL;
8842    }
8843    FieldPairTypeFree(ptr -> fields);
8844    return MemFree(ptr);
8845 }
8846 
8847 
8848 /**************************************************
8849 *
8850 *    CopyActionAsnRead()
8851 *
8852 **************************************************/
8853 NLM_EXTERN 
8854 CopyActionPtr LIBCALL
8855 CopyActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8856 {
8857    DataVal av;
8858    AsnTypePtr atp;
8859    Boolean isError = FALSE;
8860    AsnReadFunc func;
8861    CopyActionPtr ptr;
8862 
8863    if (! loaded)
8864    {
8865       if (! objmacroAsnLoad()) {
8866          return NULL;
8867       }
8868    }
8869 
8870    if (aip == NULL) {
8871       return NULL;
8872    }
8873 
8874    if (orig == NULL) {         /* CopyAction ::= (self contained) */
8875       atp = AsnReadId(aip, amp, COPY_ACTION);
8876    } else {
8877       atp = AsnLinkType(orig, COPY_ACTION);
8878    }
8879    /* link in local tree */
8880    if (atp == NULL) {
8881       return NULL;
8882    }
8883 
8884    ptr = CopyActionNew();
8885    if (ptr == NULL) {
8886       goto erret;
8887    }
8888    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
8889       goto erret;
8890    }
8891 
8892    atp = AsnReadId(aip,amp, atp);
8893    func = NULL;
8894 
8895    if (atp == COPY_ACTION_fields) {
8896       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
8897       if (aip -> io_failure) {
8898          goto erret;
8899       }
8900       atp = AsnReadId(aip,amp, atp);
8901    }
8902    if (atp == COPY_ACTION_existing_text) {
8903       if ( AsnReadVal(aip, atp, &av) <= 0) {
8904          goto erret;
8905       }
8906       ptr -> existing_text = av.intvalue;
8907       atp = AsnReadId(aip,amp, atp);
8908    }
8909 
8910    if (AsnReadVal(aip, atp, &av) <= 0) {
8911       goto erret;
8912    }
8913    /* end struct */
8914 
8915 ret:
8916    AsnUnlinkType(orig);       /* unlink local tree */
8917    return ptr;
8918 
8919 erret:
8920    aip -> io_failure = TRUE;
8921    ptr = CopyActionFree(ptr);
8922    goto ret;
8923 }
8924 
8925 
8926 
8927 /**************************************************
8928 *
8929 *    CopyActionAsnWrite()
8930 *
8931 **************************************************/
8932 NLM_EXTERN Boolean LIBCALL 
8933 CopyActionAsnWrite(CopyActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
8934 {
8935    DataVal av;
8936    AsnTypePtr atp;
8937    Boolean retval = FALSE;
8938 
8939    if (! loaded)
8940    {
8941       if (! objmacroAsnLoad()) {
8942          return FALSE;
8943       }
8944    }
8945 
8946    if (aip == NULL) {
8947       return FALSE;
8948    }
8949 
8950    atp = AsnLinkType(orig, COPY_ACTION);   /* link local tree */
8951    if (atp == NULL) {
8952       return FALSE;
8953    }
8954 
8955    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8956    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
8957       goto erret;
8958    }
8959 
8960    if (ptr -> fields != NULL) {
8961       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, COPY_ACTION_fields)) {
8962          goto erret;
8963       }
8964    }
8965    av.intvalue = ptr -> existing_text;
8966    retval = AsnWrite(aip, COPY_ACTION_existing_text,  &av);
8967    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
8968       goto erret;
8969    }
8970    retval = TRUE;
8971 
8972 erret:
8973    AsnUnlinkType(orig);       /* unlink local tree */
8974    return retval;
8975 }
8976 
8977 
8978 
8979 /**************************************************
8980 *
8981 *    SwapActionNew()
8982 *
8983 **************************************************/
8984 NLM_EXTERN 
8985 SwapActionPtr LIBCALL
8986 SwapActionNew(void)
8987 {
8988    SwapActionPtr ptr = MemNew((size_t) sizeof(SwapAction));
8989 
8990    return ptr;
8991 
8992 }
8993 
8994 
8995 /**************************************************
8996 *
8997 *    SwapActionFree()
8998 *
8999 **************************************************/
9000 NLM_EXTERN 
9001 SwapActionPtr LIBCALL
9002 SwapActionFree(SwapActionPtr ptr)
9003 {
9004 
9005    if(ptr == NULL) {
9006       return NULL;
9007    }
9008    FieldPairTypeFree(ptr -> fields);
9009    FieldTypeFree(ptr -> field_to);
9010    return MemFree(ptr);
9011 }
9012 
9013 
9014 /**************************************************
9015 *
9016 *    SwapActionAsnRead()
9017 *
9018 **************************************************/
9019 NLM_EXTERN 
9020 SwapActionPtr LIBCALL
9021 SwapActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9022 {
9023    DataVal av;
9024    AsnTypePtr atp;
9025    Boolean isError = FALSE;
9026    AsnReadFunc func;
9027    SwapActionPtr ptr;
9028 
9029    if (! loaded)
9030    {
9031       if (! objmacroAsnLoad()) {
9032          return NULL;
9033       }
9034    }
9035 
9036    if (aip == NULL) {
9037       return NULL;
9038    }
9039 
9040    if (orig == NULL) {         /* SwapAction ::= (self contained) */
9041       atp = AsnReadId(aip, amp, SWAP_ACTION);
9042    } else {
9043       atp = AsnLinkType(orig, SWAP_ACTION);
9044    }
9045    /* link in local tree */
9046    if (atp == NULL) {
9047       return NULL;
9048    }
9049 
9050    ptr = SwapActionNew();
9051    if (ptr == NULL) {
9052       goto erret;
9053    }
9054    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
9055       goto erret;
9056    }
9057 
9058    atp = AsnReadId(aip,amp, atp);
9059    func = NULL;
9060 
9061    if (atp == SWAP_ACTION_fields) {
9062       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
9063       if (aip -> io_failure) {
9064          goto erret;
9065       }
9066       atp = AsnReadId(aip,amp, atp);
9067    }
9068    if (atp == SWAP_ACTION_field_to) {
9069       ptr -> field_to = FieldTypeAsnRead(aip, atp);
9070       if (aip -> io_failure) {
9071          goto erret;
9072       }
9073       atp = AsnReadId(aip,amp, atp);
9074    }
9075 
9076    if (AsnReadVal(aip, atp, &av) <= 0) {
9077       goto erret;
9078    }
9079    /* end struct */
9080 
9081 ret:
9082    AsnUnlinkType(orig);       /* unlink local tree */
9083    return ptr;
9084 
9085 erret:
9086    aip -> io_failure = TRUE;
9087    ptr = SwapActionFree(ptr);
9088    goto ret;
9089 }
9090 
9091 
9092 
9093 /**************************************************
9094 *
9095 *    SwapActionAsnWrite()
9096 *
9097 **************************************************/
9098 NLM_EXTERN Boolean LIBCALL 
9099 SwapActionAsnWrite(SwapActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
9100 {
9101    DataVal av;
9102    AsnTypePtr atp;
9103    Boolean retval = FALSE;
9104 
9105    if (! loaded)
9106    {
9107       if (! objmacroAsnLoad()) {
9108          return FALSE;
9109       }
9110    }
9111 
9112    if (aip == NULL) {
9113       return FALSE;
9114    }
9115 
9116    atp = AsnLinkType(orig, SWAP_ACTION);   /* link local tree */
9117    if (atp == NULL) {
9118       return FALSE;
9119    }
9120 
9121    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9122    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
9123       goto erret;
9124    }
9125 
9126    if (ptr -> fields != NULL) {
9127       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, SWAP_ACTION_fields)) {
9128          goto erret;
9129       }
9130    }
9131    if (ptr -> field_to != NULL) {
9132       if ( ! FieldTypeAsnWrite(ptr -> field_to, aip, SWAP_ACTION_field_to)) {
9133          goto erret;
9134       }
9135    }
9136    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
9137       goto erret;
9138    }
9139    retval = TRUE;
9140 
9141 erret:
9142    AsnUnlinkType(orig);       /* unlink local tree */
9143    return retval;
9144 }
9145 
9146 
9147 
9148 /**************************************************
9149 *
9150 *    AECRParseActionNew()
9151 *
9152 **************************************************/
9153 NLM_EXTERN 
9154 AECRParseActionPtr LIBCALL
9155 AECRParseActionNew(void)
9156 {
9157    AECRParseActionPtr ptr = MemNew((size_t) sizeof(AECRParseAction));
9158 
9159    ptr -> remove_from_parsed = 0;
9160    ptr -> remove_left = 0;
9161    ptr -> remove_right = 0;
9162    return ptr;
9163 
9164 }
9165 
9166 
9167 /**************************************************
9168 *
9169 *    AECRParseActionFree()
9170 *
9171 **************************************************/
9172 NLM_EXTERN 
9173 AECRParseActionPtr LIBCALL
9174 AECRParseActionFree(AECRParseActionPtr ptr)
9175 {
9176 
9177    if(ptr == NULL) {
9178       return NULL;
9179    }
9180    TextPortionFree(ptr -> portion);
9181    FieldPairTypeFree(ptr -> fields);
9182    return MemFree(ptr);
9183 }
9184 
9185 
9186 /**************************************************
9187 *
9188 *    AECRParseActionAsnRead()
9189 *
9190 **************************************************/
9191 NLM_EXTERN 
9192 AECRParseActionPtr LIBCALL
9193 AECRParseActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9194 {
9195    DataVal av;
9196    AsnTypePtr atp;
9197    Boolean isError = FALSE;
9198    AsnReadFunc func;
9199    AECRParseActionPtr ptr;
9200 
9201    if (! loaded)
9202    {
9203       if (! objmacroAsnLoad()) {
9204          return NULL;
9205       }
9206    }
9207 
9208    if (aip == NULL) {
9209       return NULL;
9210    }
9211 
9212    if (orig == NULL) {         /* AECRParseAction ::= (self contained) */
9213       atp = AsnReadId(aip, amp, AECRPARSE_ACTION);
9214    } else {
9215       atp = AsnLinkType(orig, AECRPARSE_ACTION);
9216    }
9217    /* link in local tree */
9218    if (atp == NULL) {
9219       return NULL;
9220    }
9221 
9222    ptr = AECRParseActionNew();
9223    if (ptr == NULL) {
9224       goto erret;
9225    }
9226    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
9227       goto erret;
9228    }
9229 
9230    atp = AsnReadId(aip,amp, atp);
9231    func = NULL;
9232 
9233    if (atp == AECRPARSE_ACTION_portion) {
9234       ptr -> portion = TextPortionAsnRead(aip, atp);
9235       if (aip -> io_failure) {
9236          goto erret;
9237       }
9238       atp = AsnReadId(aip,amp, atp);
9239    }
9240    if (atp == AECRPARSE_ACTION_fields) {
9241       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
9242       if (aip -> io_failure) {
9243          goto erret;
9244       }
9245       atp = AsnReadId(aip,amp, atp);
9246    }
9247    if (atp == ACTION_remove_from_parsed) {
9248       if ( AsnReadVal(aip, atp, &av) <= 0) {
9249          goto erret;
9250       }
9251       ptr -> remove_from_parsed = av.boolvalue;
9252       atp = AsnReadId(aip,amp, atp);
9253    }
9254    if (atp == AECRPARSE_ACTION_remove_left) {
9255       if ( AsnReadVal(aip, atp, &av) <= 0) {
9256          goto erret;
9257       }
9258       ptr -> remove_left = av.boolvalue;
9259       atp = AsnReadId(aip,amp, atp);
9260    }
9261    if (atp == AECRPARSE_ACTION_remove_right) {
9262       if ( AsnReadVal(aip, atp, &av) <= 0) {
9263          goto erret;
9264       }
9265       ptr -> remove_right = av.boolvalue;
9266       atp = AsnReadId(aip,amp, atp);
9267    }
9268    if (atp == AECRPARSE_ACTION_existing_text) {
9269       if ( AsnReadVal(aip, atp, &av) <= 0) {
9270          goto erret;
9271       }
9272       ptr -> existing_text = av.intvalue;
9273       atp = AsnReadId(aip,amp, atp);
9274    }
9275 
9276    if (AsnReadVal(aip, atp, &av) <= 0) {
9277       goto erret;
9278    }
9279    /* end struct */
9280 
9281 ret:
9282    AsnUnlinkType(orig);       /* unlink local tree */
9283    return ptr;
9284 
9285 erret:
9286    aip -> io_failure = TRUE;
9287    ptr = AECRParseActionFree(ptr);
9288    goto ret;
9289 }
9290 
9291 
9292 
9293 /**************************************************
9294 *
9295 *    AECRParseActionAsnWrite()
9296 *
9297 **************************************************/
9298 NLM_EXTERN Boolean LIBCALL 
9299 AECRParseActionAsnWrite(AECRParseActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
9300 {
9301    DataVal av;
9302    AsnTypePtr atp;
9303    Boolean retval = FALSE;
9304 
9305    if (! loaded)
9306    {
9307       if (! objmacroAsnLoad()) {
9308          return FALSE;
9309       }
9310    }
9311 
9312    if (aip == NULL) {
9313       return FALSE;
9314    }
9315 
9316    atp = AsnLinkType(orig, AECRPARSE_ACTION);   /* link local tree */
9317    if (atp == NULL) {
9318       return FALSE;
9319    }
9320 
9321    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9322    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
9323       goto erret;
9324    }
9325 
9326    if (ptr -> portion != NULL) {
9327       if ( ! TextPortionAsnWrite(ptr -> portion, aip, AECRPARSE_ACTION_portion)) {
9328          goto erret;
9329       }
9330    }
9331    if (ptr -> fields != NULL) {
9332       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, AECRPARSE_ACTION_fields)) {
9333          goto erret;
9334       }
9335    }
9336    av.boolvalue = ptr -> remove_from_parsed;
9337    retval = AsnWrite(aip, ACTION_remove_from_parsed,  &av);
9338    av.boolvalue = ptr -> remove_left;
9339    retval = AsnWrite(aip, AECRPARSE_ACTION_remove_left,  &av);
9340    av.boolvalue = ptr -> remove_right;
9341    retval = AsnWrite(aip, AECRPARSE_ACTION_remove_right,  &av);
9342    av.intvalue = ptr -> existing_text;
9343    retval = AsnWrite(aip, AECRPARSE_ACTION_existing_text,  &av);
9344    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
9345       goto erret;
9346    }
9347    retval = TRUE;
9348 
9349 erret:
9350    AsnUnlinkType(orig);       /* unlink local tree */
9351    return retval;
9352 }
9353 
9354 
9355 
9356 /**************************************************
9357 *
9358 *    RemoveActionNew()
9359 *
9360 **************************************************/
9361 NLM_EXTERN 
9362 RemoveActionPtr LIBCALL
9363 RemoveActionNew(void)
9364 {
9365    RemoveActionPtr ptr = MemNew((size_t) sizeof(RemoveAction));
9366 
9367    return ptr;
9368 
9369 }
9370 
9371 
9372 /**************************************************
9373 *
9374 *    RemoveActionFree()
9375 *
9376 **************************************************/
9377 NLM_EXTERN 
9378 RemoveActionPtr LIBCALL
9379 RemoveActionFree(RemoveActionPtr ptr)
9380 {
9381 
9382    if(ptr == NULL) {
9383       return NULL;
9384    }
9385    FieldTypeFree(ptr -> field);
9386    return MemFree(ptr);
9387 }
9388 
9389 
9390 /**************************************************
9391 *
9392 *    RemoveActionAsnRead()
9393 *
9394 **************************************************/
9395 NLM_EXTERN 
9396 RemoveActionPtr LIBCALL
9397 RemoveActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9398 {
9399    DataVal av;
9400    AsnTypePtr atp;
9401    Boolean isError = FALSE;
9402    AsnReadFunc func;
9403    RemoveActionPtr ptr;
9404 
9405    if (! loaded)
9406    {
9407       if (! objmacroAsnLoad()) {
9408          return NULL;
9409       }
9410    }
9411 
9412    if (aip == NULL) {
9413       return NULL;
9414    }
9415 
9416    if (orig == NULL) {         /* RemoveAction ::= (self contained) */
9417       atp = AsnReadId(aip, amp, REMOVE_ACTION);
9418    } else {
9419       atp = AsnLinkType(orig, REMOVE_ACTION);
9420    }
9421    /* link in local tree */
9422    if (atp == NULL) {
9423       return NULL;
9424    }
9425 
9426    ptr = RemoveActionNew();
9427    if (ptr == NULL) {
9428       goto erret;
9429    }
9430    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
9431       goto erret;
9432    }
9433 
9434    atp = AsnReadId(aip,amp, atp);
9435    func = NULL;
9436 
9437    if (atp == REMOVE_ACTION_field) {
9438       ptr -> field = FieldTypeAsnRead(aip, atp);
9439       if (aip -> io_failure) {
9440          goto erret;
9441       }
9442       atp = AsnReadId(aip,amp, atp);
9443    }
9444 
9445    if (AsnReadVal(aip, atp, &av) <= 0) {
9446       goto erret;
9447    }
9448    /* end struct */
9449 
9450 ret:
9451    AsnUnlinkType(orig);       /* unlink local tree */
9452    return ptr;
9453 
9454 erret:
9455    aip -> io_failure = TRUE;
9456    ptr = RemoveActionFree(ptr);
9457    goto ret;
9458 }
9459 
9460 
9461 
9462 /**************************************************
9463 *
9464 *    RemoveActionAsnWrite()
9465 *
9466 **************************************************/
9467 NLM_EXTERN Boolean LIBCALL 
9468 RemoveActionAsnWrite(RemoveActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
9469 {
9470    DataVal av;
9471    AsnTypePtr atp;
9472    Boolean retval = FALSE;
9473 
9474    if (! loaded)
9475    {
9476       if (! objmacroAsnLoad()) {
9477          return FALSE;
9478       }
9479    }
9480 
9481    if (aip == NULL) {
9482       return FALSE;
9483    }
9484 
9485    atp = AsnLinkType(orig, REMOVE_ACTION);   /* link local tree */
9486    if (atp == NULL) {
9487       return FALSE;
9488    }
9489 
9490    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9491    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
9492       goto erret;
9493    }
9494 
9495    if (ptr -> field != NULL) {
9496       if ( ! FieldTypeAsnWrite(ptr -> field, aip, REMOVE_ACTION_field)) {
9497          goto erret;
9498       }
9499    }
9500    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
9501       goto erret;
9502    }
9503    retval = TRUE;
9504 
9505 erret:
9506    AsnUnlinkType(orig);       /* unlink local tree */
9507    return retval;
9508 }
9509 
9510 
9511 
9512 /**************************************************
9513 *
9514 *    ActionChoiceFree()
9515 *
9516 **************************************************/
9517 NLM_EXTERN 
9518 ActionChoicePtr LIBCALL
9519 ActionChoiceFree(ValNodePtr anp)
9520 {
9521    Pointer pnt;
9522 
9523    if (anp == NULL) {
9524       return NULL;
9525    }
9526 
9527    pnt = anp->data.ptrvalue;
9528    switch (anp->choice)
9529    {
9530    default:
9531       break;
9532    case ActionChoice_apply:
9533       ApplyActionFree(anp -> data.ptrvalue);
9534       break;
9535    case ActionChoice_edit:
9536       EditActionFree(anp -> data.ptrvalue);
9537       break;
9538    case ActionChoice_convert:
9539       ConvertActionFree(anp -> data.ptrvalue);
9540       break;
9541    case ActionChoice_copy:
9542       CopyActionFree(anp -> data.ptrvalue);
9543       break;
9544    case ActionChoice_swap:
9545       SwapActionFree(anp -> data.ptrvalue);
9546       break;
9547    case ActionChoice_remove:
9548       RemoveActionFree(anp -> data.ptrvalue);
9549       break;
9550    case ActionChoice_parse:
9551       AECRParseActionFree(anp -> data.ptrvalue);
9552       break;
9553    }
9554    return MemFree(anp);
9555 }
9556 
9557 
9558 /**************************************************
9559 *
9560 *    ActionChoiceAsnRead()
9561 *
9562 **************************************************/
9563 NLM_EXTERN 
9564 ActionChoicePtr LIBCALL
9565 ActionChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9566 {
9567    DataVal av;
9568    AsnTypePtr atp;
9569    ValNodePtr anp;
9570    Uint1 choice;
9571    Boolean isError = FALSE;
9572    Boolean nullIsError = FALSE;
9573    AsnReadFunc func;
9574 
9575    if (! loaded)
9576    {
9577       if (! objmacroAsnLoad()) {
9578          return NULL;
9579       }
9580    }
9581 
9582    if (aip == NULL) {
9583       return NULL;
9584    }
9585 
9586    if (orig == NULL) {         /* ActionChoice ::= (self contained) */
9587       atp = AsnReadId(aip, amp, ACTION_CHOICE);
9588    } else {
9589       atp = AsnLinkType(orig, ACTION_CHOICE);    /* link in local tree */
9590    }
9591    if (atp == NULL) {
9592       return NULL;
9593    }
9594 
9595    anp = ValNodeNew(NULL);
9596    if (anp == NULL) {
9597       goto erret;
9598    }
9599    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
9600       goto erret;
9601    }
9602 
9603    func = NULL;
9604 
9605    atp = AsnReadId(aip, amp, atp);  /* find the choice */
9606    if (atp == NULL) {
9607       goto erret;
9608    }
9609    if (atp == ACTION_CHOICE_apply) {
9610       choice = ActionChoice_apply;
9611       func = (AsnReadFunc)