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
objmacroAsnLoad(void)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.19 at Apr 21, 2015  2:54 PM
35 *
36 **************************************************/
37 
38 
39 /**************************************************
40 *
41 *    AECRActionNew()
42 *
43 **************************************************/
44 NLM_EXTERN
45 AECRActionPtr LIBCALL
AECRActionNew(void)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
AECRActionFree(AECRActionPtr ptr)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
AECRActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)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
AECRActionAsnWrite(AECRActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)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 
191     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
192 
193    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
194       goto erret;
195    }
196 
197    if (ptr -> action != NULL) {
198       if ( ! ActionChoiceAsnWrite(ptr -> action, aip, AECR_ACTION_action)) {
199          goto erret;
200       }
201    }
202    av.boolvalue = ptr -> also_change_mrna;
203    retval = AsnWrite(aip, AECR_ACTION_also_change_mrna,  &av);
204    if (ptr -> constraint != NULL) {
205       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, AECR_ACTION_constraint)) {
206          goto erret;
207       }
208    }
209    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
210       goto erret;
211    }
212    retval = TRUE;
213 
214 erret:
215    AsnUnlinkType(orig);       /* unlink local tree */
216    return retval;
217 }
218 
219 
220 
221 /**************************************************
222 *
223 *    ParseActionNew()
224 *
225 **************************************************/
226 NLM_EXTERN
227 ParseActionPtr LIBCALL
ParseActionNew(void)228 ParseActionNew(void)
229 {
230    ParseActionPtr ptr = MemNew((size_t) sizeof(ParseAction));
231 
232    ptr -> capitalization = 0;
233    ptr -> remove_from_parsed = 0;
234    return ptr;
235 
236 }
237 
238 
239 /**************************************************
240 *
241 *    ParseActionFree()
242 *
243 **************************************************/
244 NLM_EXTERN
245 ParseActionPtr LIBCALL
ParseActionFree(ParseActionPtr ptr)246 ParseActionFree(ParseActionPtr ptr)
247 {
248 
249    if(ptr == NULL) {
250       return NULL;
251    }
252    TextPortionFree(ptr -> portion);
253    ParseSrcFree(ptr -> src);
254    ParseDestFree(ptr -> dest);
255    TextTransformSetFree(ptr -> transform);
256    return MemFree(ptr);
257 }
258 
259 
260 /**************************************************
261 *
262 *    ParseActionAsnRead()
263 *
264 **************************************************/
265 NLM_EXTERN
266 ParseActionPtr LIBCALL
ParseActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)267 ParseActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
268 {
269    DataVal av;
270    AsnTypePtr atp;
271    Boolean isError = FALSE;
272    AsnReadFunc func;
273    ParseActionPtr ptr;
274 
275    if (! loaded)
276    {
277       if (! objmacroAsnLoad()) {
278          return NULL;
279       }
280    }
281 
282    if (aip == NULL) {
283       return NULL;
284    }
285 
286    if (orig == NULL) {         /* ParseAction ::= (self contained) */
287       atp = AsnReadId(aip, amp, PARSE_ACTION);
288    } else {
289       atp = AsnLinkType(orig, PARSE_ACTION);
290    }
291    /* link in local tree */
292    if (atp == NULL) {
293       return NULL;
294    }
295 
296    ptr = ParseActionNew();
297    if (ptr == NULL) {
298       goto erret;
299    }
300    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
301       goto erret;
302    }
303 
304    atp = AsnReadId(aip,amp, atp);
305    func = NULL;
306 
307    if (atp == PARSE_ACTION_portion) {
308       ptr -> portion = TextPortionAsnRead(aip, atp);
309       if (aip -> io_failure) {
310          goto erret;
311       }
312       atp = AsnReadId(aip,amp, atp);
313    }
314    if (atp == PARSE_ACTION_src) {
315       ptr -> src = ParseSrcAsnRead(aip, atp);
316       if (aip -> io_failure) {
317          goto erret;
318       }
319       atp = AsnReadId(aip,amp, atp);
320    }
321    if (atp == PARSE_ACTION_dest) {
322       ptr -> dest = ParseDestAsnRead(aip, atp);
323       if (aip -> io_failure) {
324          goto erret;
325       }
326       atp = AsnReadId(aip,amp, atp);
327    }
328    if (atp == PARSE_ACTION_capitalization) {
329       if ( AsnReadVal(aip, atp, &av) <= 0) {
330          goto erret;
331       }
332       ptr -> capitalization = av.intvalue;
333       atp = AsnReadId(aip,amp, atp);
334    }
335    if (atp == PARSE_ACTION_remove_from_parsed) {
336       if ( AsnReadVal(aip, atp, &av) <= 0) {
337          goto erret;
338       }
339       ptr -> remove_from_parsed = av.boolvalue;
340       atp = AsnReadId(aip,amp, atp);
341    }
342    if (atp == PARSE_ACTION_transform) {
343       ptr -> transform = TextTransformSetAsnRead(aip, atp);
344       if (aip -> io_failure) {
345          goto erret;
346       }
347       atp = AsnReadId(aip,amp, atp);
348    }
349    if (atp == PARSE_ACTION_existing_text) {
350       if ( AsnReadVal(aip, atp, &av) <= 0) {
351          goto erret;
352       }
353       ptr -> existing_text = av.intvalue;
354       atp = AsnReadId(aip,amp, atp);
355    }
356 
357    if (AsnReadVal(aip, atp, &av) <= 0) {
358       goto erret;
359    }
360    /* end struct */
361 
362 ret:
363    AsnUnlinkType(orig);       /* unlink local tree */
364    return ptr;
365 
366 erret:
367    aip -> io_failure = TRUE;
368    ptr = ParseActionFree(ptr);
369    goto ret;
370 }
371 
372 
373 
374 /**************************************************
375 *
376 *    ParseActionAsnWrite()
377 *
378 **************************************************/
379 NLM_EXTERN Boolean LIBCALL
ParseActionAsnWrite(ParseActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)380 ParseActionAsnWrite(ParseActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
381 {
382    DataVal av;
383    AsnTypePtr atp;
384    Boolean retval = FALSE;
385 
386    if (! loaded)
387    {
388       if (! objmacroAsnLoad()) {
389          return FALSE;
390       }
391    }
392 
393    if (aip == NULL) {
394       return FALSE;
395    }
396 
397    atp = AsnLinkType(orig, PARSE_ACTION);   /* link local tree */
398    if (atp == NULL) {
399       return FALSE;
400    }
401 
402    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
403 
404     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
405 
406    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
407       goto erret;
408    }
409 
410    if (ptr -> portion != NULL) {
411       if ( ! TextPortionAsnWrite(ptr -> portion, aip, PARSE_ACTION_portion)) {
412          goto erret;
413       }
414    }
415    if (ptr -> src != NULL) {
416       if ( ! ParseSrcAsnWrite(ptr -> src, aip, PARSE_ACTION_src)) {
417          goto erret;
418       }
419    }
420    if (ptr -> dest != NULL) {
421       if ( ! ParseDestAsnWrite(ptr -> dest, aip, PARSE_ACTION_dest)) {
422          goto erret;
423       }
424    }
425    av.intvalue = ptr -> capitalization;
426    retval = AsnWrite(aip, PARSE_ACTION_capitalization,  &av);
427    av.boolvalue = ptr -> remove_from_parsed;
428    retval = AsnWrite(aip, PARSE_ACTION_remove_from_parsed,  &av);
429    if (ptr -> transform != NULL) {
430       if ( ! TextTransformSetAsnWrite(ptr -> transform, aip, PARSE_ACTION_transform)) {
431          goto erret;
432       }
433    }
434    av.intvalue = ptr -> existing_text;
435    retval = AsnWrite(aip, PARSE_ACTION_existing_text,  &av);
436    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
437       goto erret;
438    }
439    retval = TRUE;
440 
441 erret:
442    AsnUnlinkType(orig);       /* unlink local tree */
443    return retval;
444 }
445 
446 
447 
448 /**************************************************
449 *
450 *    MacroActionListFree()
451 *
452 **************************************************/
453 NLM_EXTERN
454 MacroActionListPtr LIBCALL
MacroActionListFree(MacroActionListPtr ptr)455 MacroActionListFree(MacroActionListPtr ptr)
456 {
457 
458    if(ptr == NULL) {
459       return NULL;
460    }
461    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) MacroActionChoiceFree);
462    return NULL;
463 }
464 
465 
466 /**************************************************
467 *
468 *    MacroActionListAsnRead()
469 *
470 **************************************************/
471 NLM_EXTERN
472 MacroActionListPtr LIBCALL
MacroActionListAsnRead(AsnIoPtr aip,AsnTypePtr orig)473 MacroActionListAsnRead(AsnIoPtr aip, AsnTypePtr orig)
474 {
475    DataVal av;
476    AsnTypePtr atp;
477    Boolean isError = FALSE;
478    AsnReadFunc func;
479    MacroActionListPtr ptr;
480 
481    if (! loaded)
482    {
483       if (! objmacroAsnLoad()) {
484          return NULL;
485       }
486    }
487 
488    if (aip == NULL) {
489       return NULL;
490    }
491 
492    if (orig == NULL) {         /* MacroActionList ::= (self contained) */
493       atp = AsnReadId(aip, amp, MACRO_ACTION_LIST);
494    } else {
495       atp = AsnLinkType(orig, MACRO_ACTION_LIST);
496    }
497    /* link in local tree */
498    if (atp == NULL) {
499       return NULL;
500    }
501 
502    func = NULL;
503 
504    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MacroActionChoiceAsnRead, (AsnOptFreeFunc) MacroActionChoiceFree);
505    if (isError && ptr  == NULL) {
506       goto erret;
507    }
508 
509 
510 
511 ret:
512    AsnUnlinkType(orig);       /* unlink local tree */
513    return ptr;
514 
515 erret:
516    aip -> io_failure = TRUE;
517    ptr = MacroActionListFree(ptr);
518    goto ret;
519 }
520 
521 
522 
523 /**************************************************
524 *
525 *    MacroActionListAsnWrite()
526 *
527 **************************************************/
528 NLM_EXTERN Boolean LIBCALL
MacroActionListAsnWrite(MacroActionListPtr ptr,AsnIoPtr aip,AsnTypePtr orig)529 MacroActionListAsnWrite(MacroActionListPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
530 {
531    DataVal av;
532    AsnTypePtr atp;
533    Boolean retval = FALSE;
534 
535    if (! loaded)
536    {
537       if (! objmacroAsnLoad()) {
538          return FALSE;
539       }
540    }
541 
542    if (aip == NULL) {
543       return FALSE;
544    }
545 
546    atp = AsnLinkType(orig, MACRO_ACTION_LIST);   /* link local tree */
547    if (atp == NULL) {
548       return FALSE;
549    }
550 
551    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
552 
553     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
554 
555    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) MacroActionChoiceAsnWrite, aip, atp, MACRO_ACTION_LIST_E);
556    retval = TRUE;
557 
558 erret:
559    AsnUnlinkType(orig);       /* unlink local tree */
560    return retval;
561 }
562 
563 
564 
565 /**************************************************
566 *
567 *    SuspectRuleSetFree()
568 *
569 **************************************************/
570 NLM_EXTERN
571 SuspectRuleSetPtr LIBCALL
SuspectRuleSetFree(SuspectRuleSetPtr ptr)572 SuspectRuleSetFree(SuspectRuleSetPtr ptr)
573 {
574 
575    if(ptr == NULL) {
576       return NULL;
577    }
578    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) SuspectRuleFree);
579    return NULL;
580 }
581 
582 
583 /**************************************************
584 *
585 *    SuspectRuleSetAsnRead()
586 *
587 **************************************************/
588 NLM_EXTERN
589 SuspectRuleSetPtr LIBCALL
SuspectRuleSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)590 SuspectRuleSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
591 {
592    DataVal av;
593    AsnTypePtr atp;
594    Boolean isError = FALSE;
595    AsnReadFunc func;
596    SuspectRuleSetPtr ptr;
597 
598    if (! loaded)
599    {
600       if (! objmacroAsnLoad()) {
601          return NULL;
602       }
603    }
604 
605    if (aip == NULL) {
606       return NULL;
607    }
608 
609    if (orig == NULL) {         /* SuspectRuleSet ::= (self contained) */
610       atp = AsnReadId(aip, amp, SUSPECT_RULE_SET);
611    } else {
612       atp = AsnLinkType(orig, SUSPECT_RULE_SET);
613    }
614    /* link in local tree */
615    if (atp == NULL) {
616       return NULL;
617    }
618 
619    func = NULL;
620 
621    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SuspectRuleAsnRead, (AsnOptFreeFunc) SuspectRuleFree);
622    if (isError && ptr  == NULL) {
623       goto erret;
624    }
625 
626 
627 
628 ret:
629    AsnUnlinkType(orig);       /* unlink local tree */
630    return ptr;
631 
632 erret:
633    aip -> io_failure = TRUE;
634    ptr = SuspectRuleSetFree(ptr);
635    goto ret;
636 }
637 
638 
639 
640 /**************************************************
641 *
642 *    SuspectRuleSetAsnWrite()
643 *
644 **************************************************/
645 NLM_EXTERN Boolean LIBCALL
SuspectRuleSetAsnWrite(SuspectRuleSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)646 SuspectRuleSetAsnWrite(SuspectRuleSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
647 {
648    DataVal av;
649    AsnTypePtr atp;
650    Boolean retval = FALSE;
651 
652    if (! loaded)
653    {
654       if (! objmacroAsnLoad()) {
655          return FALSE;
656       }
657    }
658 
659    if (aip == NULL) {
660       return FALSE;
661    }
662 
663    atp = AsnLinkType(orig, SUSPECT_RULE_SET);   /* link local tree */
664    if (atp == NULL) {
665       return FALSE;
666    }
667 
668    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
669 
670     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
671 
672    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) SuspectRuleAsnWrite, aip, atp, SUSPECT_RULE_SET_E);
673    retval = TRUE;
674 
675 erret:
676    AsnUnlinkType(orig);       /* unlink local tree */
677    return retval;
678 }
679 
680 
681 
682 /**************************************************
683 *
684 *    WordSubstitutionNew()
685 *
686 **************************************************/
687 NLM_EXTERN
688 WordSubstitutionPtr LIBCALL
WordSubstitutionNew(void)689 WordSubstitutionNew(void)
690 {
691    WordSubstitutionPtr ptr = MemNew((size_t) sizeof(WordSubstitution));
692 
693    ptr -> case_sensitive = 0;
694    ptr -> whole_word = 0;
695    return ptr;
696 
697 }
698 
699 
700 /**************************************************
701 *
702 *    WordSubstitutionFree()
703 *
704 **************************************************/
705 NLM_EXTERN
706 WordSubstitutionPtr LIBCALL
WordSubstitutionFree(WordSubstitutionPtr ptr)707 WordSubstitutionFree(WordSubstitutionPtr ptr)
708 {
709 
710    if(ptr == NULL) {
711       return NULL;
712    }
713    MemFree(ptr -> word);
714    AsnGenericBaseSeqOfFree(ptr -> synonyms ,ASNCODE_PTRVAL_SLOT);
715    return MemFree(ptr);
716 }
717 
718 
719 /**************************************************
720 *
721 *    WordSubstitutionAsnRead()
722 *
723 **************************************************/
724 NLM_EXTERN
725 WordSubstitutionPtr LIBCALL
WordSubstitutionAsnRead(AsnIoPtr aip,AsnTypePtr orig)726 WordSubstitutionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
727 {
728    DataVal av;
729    AsnTypePtr atp;
730    Boolean isError = FALSE;
731    AsnReadFunc func;
732    WordSubstitutionPtr ptr;
733 
734    if (! loaded)
735    {
736       if (! objmacroAsnLoad()) {
737          return NULL;
738       }
739    }
740 
741    if (aip == NULL) {
742       return NULL;
743    }
744 
745    if (orig == NULL) {         /* WordSubstitution ::= (self contained) */
746       atp = AsnReadId(aip, amp, WORD_SUBSTITUTION);
747    } else {
748       atp = AsnLinkType(orig, WORD_SUBSTITUTION);
749    }
750    /* link in local tree */
751    if (atp == NULL) {
752       return NULL;
753    }
754 
755    ptr = WordSubstitutionNew();
756    if (ptr == NULL) {
757       goto erret;
758    }
759    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
760       goto erret;
761    }
762 
763    atp = AsnReadId(aip,amp, atp);
764    func = NULL;
765 
766    if (atp == WORD_SUBSTITUTION_word) {
767       if ( AsnReadVal(aip, atp, &av) <= 0) {
768          goto erret;
769       }
770       ptr -> word = av.ptrvalue;
771       atp = AsnReadId(aip,amp, atp);
772    }
773    if (atp == WORD_SUBSTITUTION_synonyms) {
774       ptr -> synonyms = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
775       if (isError && ptr -> synonyms == NULL) {
776          goto erret;
777       }
778       atp = AsnReadId(aip,amp, atp);
779    }
780    if (atp == WORD_SUBSTITUTION_case_sensitive) {
781       if ( AsnReadVal(aip, atp, &av) <= 0) {
782          goto erret;
783       }
784       ptr -> case_sensitive = av.boolvalue;
785       atp = AsnReadId(aip,amp, atp);
786    }
787    if (atp == WORD_SUBSTITUTION_whole_word) {
788       if ( AsnReadVal(aip, atp, &av) <= 0) {
789          goto erret;
790       }
791       ptr -> whole_word = av.boolvalue;
792       atp = AsnReadId(aip,amp, atp);
793    }
794 
795    if (AsnReadVal(aip, atp, &av) <= 0) {
796       goto erret;
797    }
798    /* end struct */
799 
800 ret:
801    AsnUnlinkType(orig);       /* unlink local tree */
802    return ptr;
803 
804 erret:
805    aip -> io_failure = TRUE;
806    ptr = WordSubstitutionFree(ptr);
807    goto ret;
808 }
809 
810 
811 
812 /**************************************************
813 *
814 *    WordSubstitutionAsnWrite()
815 *
816 **************************************************/
817 NLM_EXTERN Boolean LIBCALL
WordSubstitutionAsnWrite(WordSubstitutionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)818 WordSubstitutionAsnWrite(WordSubstitutionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
819 {
820    DataVal av;
821    AsnTypePtr atp;
822    Boolean retval = FALSE;
823 
824    if (! loaded)
825    {
826       if (! objmacroAsnLoad()) {
827          return FALSE;
828       }
829    }
830 
831    if (aip == NULL) {
832       return FALSE;
833    }
834 
835    atp = AsnLinkType(orig, WORD_SUBSTITUTION);   /* link local tree */
836    if (atp == NULL) {
837       return FALSE;
838    }
839 
840    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
841 
842     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
843 
844    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
845       goto erret;
846    }
847 
848    if (ptr -> word != NULL) {
849       av.ptrvalue = ptr -> word;
850       retval = AsnWrite(aip, WORD_SUBSTITUTION_word,  &av);
851    }
852    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> synonyms ,ASNCODE_PTRVAL_SLOT, aip, WORD_SUBSTITUTION_synonyms, WORD_SUBSTITUTION_synonyms_E);
853    av.boolvalue = ptr -> case_sensitive;
854    retval = AsnWrite(aip, WORD_SUBSTITUTION_case_sensitive,  &av);
855    av.boolvalue = ptr -> whole_word;
856    retval = AsnWrite(aip, WORD_SUBSTITUTION_whole_word,  &av);
857    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
858       goto erret;
859    }
860    retval = TRUE;
861 
862 erret:
863    AsnUnlinkType(orig);       /* unlink local tree */
864    return retval;
865 }
866 
867 
868 
869 /**************************************************
870 *
871 *    WordSubstitutionSetFree()
872 *
873 **************************************************/
874 NLM_EXTERN
875 WordSubstitutionSetPtr LIBCALL
WordSubstitutionSetFree(WordSubstitutionSetPtr ptr)876 WordSubstitutionSetFree(WordSubstitutionSetPtr ptr)
877 {
878 
879    if(ptr == NULL) {
880       return NULL;
881    }
882    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) WordSubstitutionFree);
883    return NULL;
884 }
885 
886 
887 /**************************************************
888 *
889 *    WordSubstitutionSetAsnRead()
890 *
891 **************************************************/
892 NLM_EXTERN
893 WordSubstitutionSetPtr LIBCALL
WordSubstitutionSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)894 WordSubstitutionSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
895 {
896    DataVal av;
897    AsnTypePtr atp;
898    Boolean isError = FALSE;
899    AsnReadFunc func;
900    WordSubstitutionSetPtr ptr;
901 
902    if (! loaded)
903    {
904       if (! objmacroAsnLoad()) {
905          return NULL;
906       }
907    }
908 
909    if (aip == NULL) {
910       return NULL;
911    }
912 
913    if (orig == NULL) {         /* WordSubstitutionSet ::= (self contained) */
914       atp = AsnReadId(aip, amp, WORD_SUBSTITUTION_SET);
915    } else {
916       atp = AsnLinkType(orig, WORD_SUBSTITUTION_SET);
917    }
918    /* link in local tree */
919    if (atp == NULL) {
920       return NULL;
921    }
922 
923    func = NULL;
924 
925    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) WordSubstitutionAsnRead, (AsnOptFreeFunc) WordSubstitutionFree);
926    if (isError && ptr  == NULL) {
927       goto erret;
928    }
929 
930 
931 
932 ret:
933    AsnUnlinkType(orig);       /* unlink local tree */
934    return ptr;
935 
936 erret:
937    aip -> io_failure = TRUE;
938    ptr = WordSubstitutionSetFree(ptr);
939    goto ret;
940 }
941 
942 
943 
944 /**************************************************
945 *
946 *    WordSubstitutionSetAsnWrite()
947 *
948 **************************************************/
949 NLM_EXTERN Boolean LIBCALL
WordSubstitutionSetAsnWrite(WordSubstitutionSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)950 WordSubstitutionSetAsnWrite(WordSubstitutionSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
951 {
952    DataVal av;
953    AsnTypePtr atp;
954    Boolean retval = FALSE;
955 
956    if (! loaded)
957    {
958       if (! objmacroAsnLoad()) {
959          return FALSE;
960       }
961    }
962 
963    if (aip == NULL) {
964       return FALSE;
965    }
966 
967    atp = AsnLinkType(orig, WORD_SUBSTITUTION_SET);   /* link local tree */
968    if (atp == NULL) {
969       return FALSE;
970    }
971 
972    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
973 
974     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
975 
976    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) WordSubstitutionAsnWrite, aip, atp, WORD_SUBSTITUTION_SET_E);
977    retval = TRUE;
978 
979 erret:
980    AsnUnlinkType(orig);       /* unlink local tree */
981    return retval;
982 }
983 
984 
985 
986 /**************************************************
987 *
988 *    StringConstraintNew()
989 *
990 **************************************************/
991 NLM_EXTERN
992 StringConstraintPtr LIBCALL
StringConstraintNew(void)993 StringConstraintNew(void)
994 {
995    StringConstraintPtr ptr = MemNew((size_t) sizeof(StringConstraint));
996 
997    ptr -> match_location = 1;
998    ptr -> case_sensitive = 0;
999    ptr -> ignore_space = 0;
1000    ptr -> ignore_punct = 0;
1001    ptr -> whole_word = 0;
1002    ptr -> not_present = 0;
1003    ptr -> is_all_caps = 0;
1004    ptr -> is_all_lower = 0;
1005    ptr -> is_all_punct = 0;
1006    ptr -> ignore_weasel = 0;
1007    ptr -> is_first_cap = 0;
1008    ptr -> is_first_each_cap = 0;
1009    return ptr;
1010 
1011 }
1012 
1013 
1014 /**************************************************
1015 *
1016 *    StringConstraintFree()
1017 *
1018 **************************************************/
1019 NLM_EXTERN
1020 StringConstraintPtr LIBCALL
StringConstraintFree(StringConstraintPtr ptr)1021 StringConstraintFree(StringConstraintPtr ptr)
1022 {
1023 
1024    if(ptr == NULL) {
1025       return NULL;
1026    }
1027    MemFree(ptr -> match_text);
1028    WordSubstitutionSetFree(ptr -> ignore_words);
1029    return MemFree(ptr);
1030 }
1031 
1032 
1033 /**************************************************
1034 *
1035 *    StringConstraintAsnRead()
1036 *
1037 **************************************************/
1038 NLM_EXTERN
1039 StringConstraintPtr LIBCALL
StringConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)1040 StringConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1041 {
1042    DataVal av;
1043    AsnTypePtr atp;
1044    Boolean isError = FALSE;
1045    AsnReadFunc func;
1046    StringConstraintPtr ptr;
1047 
1048    if (! loaded)
1049    {
1050       if (! objmacroAsnLoad()) {
1051          return NULL;
1052       }
1053    }
1054 
1055    if (aip == NULL) {
1056       return NULL;
1057    }
1058 
1059    if (orig == NULL) {         /* StringConstraint ::= (self contained) */
1060       atp = AsnReadId(aip, amp, STRING_CONSTRAINT);
1061    } else {
1062       atp = AsnLinkType(orig, STRING_CONSTRAINT);
1063    }
1064    /* link in local tree */
1065    if (atp == NULL) {
1066       return NULL;
1067    }
1068 
1069    ptr = StringConstraintNew();
1070    if (ptr == NULL) {
1071       goto erret;
1072    }
1073    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1074       goto erret;
1075    }
1076 
1077    atp = AsnReadId(aip,amp, atp);
1078    func = NULL;
1079 
1080    if (atp == STRING_CONSTRAINT_match_text) {
1081       if ( AsnReadVal(aip, atp, &av) <= 0) {
1082          goto erret;
1083       }
1084       ptr -> match_text = av.ptrvalue;
1085       atp = AsnReadId(aip,amp, atp);
1086    }
1087    if (atp == STRING_CONSTRAINT_match_location) {
1088       if ( AsnReadVal(aip, atp, &av) <= 0) {
1089          goto erret;
1090       }
1091       ptr -> match_location = av.intvalue;
1092       atp = AsnReadId(aip,amp, atp);
1093    }
1094    if (atp == STRING_CONSTRAINT_case_sensitive) {
1095       if ( AsnReadVal(aip, atp, &av) <= 0) {
1096          goto erret;
1097       }
1098       ptr -> case_sensitive = av.boolvalue;
1099       atp = AsnReadId(aip,amp, atp);
1100    }
1101    if (atp == STRING_CONSTRAINT_ignore_space) {
1102       if ( AsnReadVal(aip, atp, &av) <= 0) {
1103          goto erret;
1104       }
1105       ptr -> ignore_space = av.boolvalue;
1106       atp = AsnReadId(aip,amp, atp);
1107    }
1108    if (atp == STRING_CONSTRAINT_ignore_punct) {
1109       if ( AsnReadVal(aip, atp, &av) <= 0) {
1110          goto erret;
1111       }
1112       ptr -> ignore_punct = av.boolvalue;
1113       atp = AsnReadId(aip,amp, atp);
1114    }
1115    if (atp == STRING_CONSTRAINT_ignore_words) {
1116       ptr -> ignore_words = WordSubstitutionSetAsnRead(aip, atp);
1117       if (aip -> io_failure) {
1118          goto erret;
1119       }
1120       atp = AsnReadId(aip,amp, atp);
1121    }
1122    if (atp == STRING_CONSTRAINT_whole_word) {
1123       if ( AsnReadVal(aip, atp, &av) <= 0) {
1124          goto erret;
1125       }
1126       ptr -> whole_word = av.boolvalue;
1127       atp = AsnReadId(aip,amp, atp);
1128    }
1129    if (atp == STRING_CONSTRAINT_not_present) {
1130       if ( AsnReadVal(aip, atp, &av) <= 0) {
1131          goto erret;
1132       }
1133       ptr -> not_present = av.boolvalue;
1134       atp = AsnReadId(aip,amp, atp);
1135    }
1136    if (atp == STRING_CONSTRAINT_is_all_caps) {
1137       if ( AsnReadVal(aip, atp, &av) <= 0) {
1138          goto erret;
1139       }
1140       ptr -> is_all_caps = av.boolvalue;
1141       atp = AsnReadId(aip,amp, atp);
1142    }
1143    if (atp == STRING_CONSTRAINT_is_all_lower) {
1144       if ( AsnReadVal(aip, atp, &av) <= 0) {
1145          goto erret;
1146       }
1147       ptr -> is_all_lower = av.boolvalue;
1148       atp = AsnReadId(aip,amp, atp);
1149    }
1150    if (atp == STRING_CONSTRAINT_is_all_punct) {
1151       if ( AsnReadVal(aip, atp, &av) <= 0) {
1152          goto erret;
1153       }
1154       ptr -> is_all_punct = av.boolvalue;
1155       atp = AsnReadId(aip,amp, atp);
1156    }
1157    if (atp == STRING_CONSTRAINT_ignore_weasel) {
1158       if ( AsnReadVal(aip, atp, &av) <= 0) {
1159          goto erret;
1160       }
1161       ptr -> ignore_weasel = av.boolvalue;
1162       atp = AsnReadId(aip,amp, atp);
1163    }
1164    if (atp == STRING_CONSTRAINT_is_first_cap) {
1165       if ( AsnReadVal(aip, atp, &av) <= 0) {
1166          goto erret;
1167       }
1168       ptr -> is_first_cap = av.boolvalue;
1169       atp = AsnReadId(aip,amp, atp);
1170    }
1171    if (atp == STRING_CONSTRAINT_is_first_each_cap) {
1172       if ( AsnReadVal(aip, atp, &av) <= 0) {
1173          goto erret;
1174       }
1175       ptr -> is_first_each_cap = av.boolvalue;
1176       atp = AsnReadId(aip,amp, atp);
1177    }
1178 
1179    if (AsnReadVal(aip, atp, &av) <= 0) {
1180       goto erret;
1181    }
1182    /* end struct */
1183 
1184 ret:
1185    AsnUnlinkType(orig);       /* unlink local tree */
1186    return ptr;
1187 
1188 erret:
1189    aip -> io_failure = TRUE;
1190    ptr = StringConstraintFree(ptr);
1191    goto ret;
1192 }
1193 
1194 
1195 
1196 /**************************************************
1197 *
1198 *    StringConstraintAsnWrite()
1199 *
1200 **************************************************/
1201 NLM_EXTERN Boolean LIBCALL
StringConstraintAsnWrite(StringConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1202 StringConstraintAsnWrite(StringConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1203 {
1204    DataVal av;
1205    AsnTypePtr atp;
1206    Boolean retval = FALSE;
1207 
1208    if (! loaded)
1209    {
1210       if (! objmacroAsnLoad()) {
1211          return FALSE;
1212       }
1213    }
1214 
1215    if (aip == NULL) {
1216       return FALSE;
1217    }
1218 
1219    atp = AsnLinkType(orig, STRING_CONSTRAINT);   /* link local tree */
1220    if (atp == NULL) {
1221       return FALSE;
1222    }
1223 
1224    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1225 
1226     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1227 
1228    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1229       goto erret;
1230    }
1231 
1232    if (ptr -> match_text != NULL) {
1233       av.ptrvalue = ptr -> match_text;
1234       retval = AsnWrite(aip, STRING_CONSTRAINT_match_text,  &av);
1235    }
1236    av.intvalue = ptr -> match_location;
1237    retval = AsnWrite(aip, STRING_CONSTRAINT_match_location,  &av);
1238    av.boolvalue = ptr -> case_sensitive;
1239    retval = AsnWrite(aip, STRING_CONSTRAINT_case_sensitive,  &av);
1240    av.boolvalue = ptr -> ignore_space;
1241    retval = AsnWrite(aip, STRING_CONSTRAINT_ignore_space,  &av);
1242    av.boolvalue = ptr -> ignore_punct;
1243    retval = AsnWrite(aip, STRING_CONSTRAINT_ignore_punct,  &av);
1244    if (ptr -> ignore_words != NULL) {
1245       if ( ! WordSubstitutionSetAsnWrite(ptr -> ignore_words, aip, STRING_CONSTRAINT_ignore_words)) {
1246          goto erret;
1247       }
1248    }
1249    av.boolvalue = ptr -> whole_word;
1250    retval = AsnWrite(aip, STRING_CONSTRAINT_whole_word,  &av);
1251    av.boolvalue = ptr -> not_present;
1252    retval = AsnWrite(aip, STRING_CONSTRAINT_not_present,  &av);
1253    av.boolvalue = ptr -> is_all_caps;
1254    retval = AsnWrite(aip, STRING_CONSTRAINT_is_all_caps,  &av);
1255    av.boolvalue = ptr -> is_all_lower;
1256    retval = AsnWrite(aip, STRING_CONSTRAINT_is_all_lower,  &av);
1257    av.boolvalue = ptr -> is_all_punct;
1258    retval = AsnWrite(aip, STRING_CONSTRAINT_is_all_punct,  &av);
1259    av.boolvalue = ptr -> ignore_weasel;
1260    retval = AsnWrite(aip, STRING_CONSTRAINT_ignore_weasel,  &av);
1261    av.boolvalue = ptr -> is_first_cap;
1262    retval = AsnWrite(aip, STRING_CONSTRAINT_is_first_cap,  &av);
1263    av.boolvalue = ptr -> is_first_each_cap;
1264    retval = AsnWrite(aip, STRING_CONSTRAINT_is_first_each_cap,  &av);
1265    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1266       goto erret;
1267    }
1268    retval = TRUE;
1269 
1270 erret:
1271    AsnUnlinkType(orig);       /* unlink local tree */
1272    return retval;
1273 }
1274 
1275 
1276 
1277 /**************************************************
1278 *
1279 *    StringConstraintSetFree()
1280 *
1281 **************************************************/
1282 NLM_EXTERN
1283 StringConstraintSetPtr LIBCALL
StringConstraintSetFree(StringConstraintSetPtr ptr)1284 StringConstraintSetFree(StringConstraintSetPtr ptr)
1285 {
1286 
1287    if(ptr == NULL) {
1288       return NULL;
1289    }
1290    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) StringConstraintFree);
1291    return NULL;
1292 }
1293 
1294 
1295 /**************************************************
1296 *
1297 *    StringConstraintSetAsnRead()
1298 *
1299 **************************************************/
1300 NLM_EXTERN
1301 StringConstraintSetPtr LIBCALL
StringConstraintSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)1302 StringConstraintSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1303 {
1304    DataVal av;
1305    AsnTypePtr atp;
1306    Boolean isError = FALSE;
1307    AsnReadFunc func;
1308    StringConstraintSetPtr ptr;
1309 
1310    if (! loaded)
1311    {
1312       if (! objmacroAsnLoad()) {
1313          return NULL;
1314       }
1315    }
1316 
1317    if (aip == NULL) {
1318       return NULL;
1319    }
1320 
1321    if (orig == NULL) {         /* StringConstraintSet ::= (self contained) */
1322       atp = AsnReadId(aip, amp, STRING_CONSTRAINT_SET);
1323    } else {
1324       atp = AsnLinkType(orig, STRING_CONSTRAINT_SET);
1325    }
1326    /* link in local tree */
1327    if (atp == NULL) {
1328       return NULL;
1329    }
1330 
1331    func = NULL;
1332 
1333    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) StringConstraintAsnRead, (AsnOptFreeFunc) StringConstraintFree);
1334    if (isError && ptr  == NULL) {
1335       goto erret;
1336    }
1337 
1338 
1339 
1340 ret:
1341    AsnUnlinkType(orig);       /* unlink local tree */
1342    return ptr;
1343 
1344 erret:
1345    aip -> io_failure = TRUE;
1346    ptr = StringConstraintSetFree(ptr);
1347    goto ret;
1348 }
1349 
1350 
1351 
1352 /**************************************************
1353 *
1354 *    StringConstraintSetAsnWrite()
1355 *
1356 **************************************************/
1357 NLM_EXTERN Boolean LIBCALL
StringConstraintSetAsnWrite(StringConstraintSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1358 StringConstraintSetAsnWrite(StringConstraintSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1359 {
1360    DataVal av;
1361    AsnTypePtr atp;
1362    Boolean retval = FALSE;
1363 
1364    if (! loaded)
1365    {
1366       if (! objmacroAsnLoad()) {
1367          return FALSE;
1368       }
1369    }
1370 
1371    if (aip == NULL) {
1372       return FALSE;
1373    }
1374 
1375    atp = AsnLinkType(orig, STRING_CONSTRAINT_SET);   /* link local tree */
1376    if (atp == NULL) {
1377       return FALSE;
1378    }
1379 
1380    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1381 
1382     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1383 
1384    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) StringConstraintAsnWrite, aip, atp, STRING_CONSTRAINT_SET_E);
1385    retval = TRUE;
1386 
1387 erret:
1388    AsnUnlinkType(orig);       /* unlink local tree */
1389    return retval;
1390 }
1391 
1392 
1393 
1394 /**************************************************
1395 *
1396 *    LocationPosConstraintFree()
1397 *
1398 **************************************************/
1399 NLM_EXTERN
1400 LocationPosConstraintPtr LIBCALL
LocationPosConstraintFree(ValNodePtr anp)1401 LocationPosConstraintFree(ValNodePtr anp)
1402 {
1403    Pointer pnt;
1404 
1405    if (anp == NULL) {
1406       return NULL;
1407    }
1408 
1409    pnt = anp->data.ptrvalue;
1410    switch (anp->choice)
1411    {
1412    default:
1413       break;
1414    }
1415    return MemFree(anp);
1416 }
1417 
1418 
1419 /**************************************************
1420 *
1421 *    LocationPosConstraintAsnRead()
1422 *
1423 **************************************************/
1424 NLM_EXTERN
1425 LocationPosConstraintPtr LIBCALL
LocationPosConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)1426 LocationPosConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1427 {
1428    DataVal av;
1429    AsnTypePtr atp;
1430    ValNodePtr anp;
1431    Uint1 choice;
1432    Boolean isError = FALSE;
1433    Boolean nullIsError = FALSE;
1434    AsnReadFunc func;
1435 
1436    if (! loaded)
1437    {
1438       if (! objmacroAsnLoad()) {
1439          return NULL;
1440       }
1441    }
1442 
1443    if (aip == NULL) {
1444       return NULL;
1445    }
1446 
1447    if (orig == NULL) {         /* LocationPosConstraint ::= (self contained) */
1448       atp = AsnReadId(aip, amp, LOCATION_POS_CONSTRAINT);
1449    } else {
1450       atp = AsnLinkType(orig, LOCATION_POS_CONSTRAINT);    /* link in local tree */
1451    }
1452    if (atp == NULL) {
1453       return NULL;
1454    }
1455 
1456    anp = ValNodeNew(NULL);
1457    if (anp == NULL) {
1458       goto erret;
1459    }
1460    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1461       goto erret;
1462    }
1463 
1464    func = NULL;
1465 
1466    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1467    if (atp == NULL) {
1468       goto erret;
1469    }
1470    if (atp == LOCATION_POS_CONSTRAINT_dist_from_end) {
1471       choice = LocationPosConstraint_dist_from_end;
1472       if (AsnReadVal(aip, atp, &av) <= 0) {
1473          goto erret;
1474       }
1475       anp->data.intvalue = av.intvalue;
1476    }
1477    else if (atp == LOCATION_POS_CONSTRAINT_max_dist_from_end) {
1478       choice = LocationPosConstraint_max_dist_from_end;
1479       if (AsnReadVal(aip, atp, &av) <= 0) {
1480          goto erret;
1481       }
1482       anp->data.intvalue = av.intvalue;
1483    }
1484    else if (atp == LOCATION_POS_CONSTRAINT_min_dist_from_end) {
1485       choice = LocationPosConstraint_min_dist_from_end;
1486       if (AsnReadVal(aip, atp, &av) <= 0) {
1487          goto erret;
1488       }
1489       anp->data.intvalue = av.intvalue;
1490    }
1491    anp->choice = choice;
1492    if (func != NULL)
1493    {
1494       anp->data.ptrvalue = (* func)(aip, atp);
1495       if (aip -> io_failure) goto erret;
1496 
1497       if (nullIsError && anp->data.ptrvalue == NULL) {
1498          goto erret;
1499       }
1500    }
1501 
1502 ret:
1503    AsnUnlinkType(orig);       /* unlink local tree */
1504    return anp;
1505 
1506 erret:
1507    anp = MemFree(anp);
1508    aip -> io_failure = TRUE;
1509    goto ret;
1510 }
1511 
1512 
1513 /**************************************************
1514 *
1515 *    LocationPosConstraintAsnWrite()
1516 *
1517 **************************************************/
1518 NLM_EXTERN Boolean LIBCALL
LocationPosConstraintAsnWrite(LocationPosConstraintPtr anp,AsnIoPtr aip,AsnTypePtr orig)1519 LocationPosConstraintAsnWrite(LocationPosConstraintPtr anp, AsnIoPtr aip, AsnTypePtr orig)
1520 
1521 {
1522    DataVal av;
1523    AsnTypePtr atp, writetype = NULL;
1524    Pointer pnt;
1525    AsnWriteFunc func = NULL;
1526    Boolean retval = FALSE;
1527 
1528    if (! loaded)
1529    {
1530       if (! objmacroAsnLoad())
1531       return FALSE;
1532    }
1533 
1534    if (aip == NULL)
1535    return FALSE;
1536 
1537    atp = AsnLinkType(orig, LOCATION_POS_CONSTRAINT);   /* link local tree */
1538    if (atp == NULL) {
1539       return FALSE;
1540    }
1541 
1542    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1543 
1544     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1545 
1546    av.ptrvalue = (Pointer)anp;
1547    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1548       goto erret;
1549    }
1550 
1551    pnt = anp->data.ptrvalue;
1552    switch (anp->choice)
1553    {
1554    case LocationPosConstraint_dist_from_end:
1555       av.intvalue = anp->data.intvalue;
1556       retval = AsnWrite(aip, LOCATION_POS_CONSTRAINT_dist_from_end, &av);
1557       break;
1558    case LocationPosConstraint_max_dist_from_end:
1559       av.intvalue = anp->data.intvalue;
1560       retval = AsnWrite(aip, LOCATION_POS_CONSTRAINT_max_dist_from_end, &av);
1561       break;
1562    case LocationPosConstraint_min_dist_from_end:
1563       av.intvalue = anp->data.intvalue;
1564       retval = AsnWrite(aip, LOCATION_POS_CONSTRAINT_min_dist_from_end, &av);
1565       break;
1566    }
1567    if (writetype != NULL) {
1568       retval = (* func)(pnt, aip, writetype);   /* write it out */
1569    }
1570    if (!retval) {
1571       goto erret;
1572    }
1573    retval = TRUE;
1574 
1575 erret:
1576    AsnUnlinkType(orig);       /* unlink local tree */
1577    return retval;
1578 }
1579 
1580 
1581 /**************************************************
1582 *
1583 *    LocationConstraintNew()
1584 *
1585 **************************************************/
1586 NLM_EXTERN
1587 LocationConstraintPtr LIBCALL
LocationConstraintNew(void)1588 LocationConstraintNew(void)
1589 {
1590    LocationConstraintPtr ptr = MemNew((size_t) sizeof(LocationConstraint));
1591 
1592    ptr -> strand = 0;
1593    ptr -> seq_type = 0;
1594    ptr -> partial5 = 0;
1595    ptr -> partial3 = 0;
1596    ptr -> location_type = 0;
1597    return ptr;
1598 
1599 }
1600 
1601 
1602 /**************************************************
1603 *
1604 *    LocationConstraintFree()
1605 *
1606 **************************************************/
1607 NLM_EXTERN
1608 LocationConstraintPtr LIBCALL
LocationConstraintFree(LocationConstraintPtr ptr)1609 LocationConstraintFree(LocationConstraintPtr ptr)
1610 {
1611 
1612    if(ptr == NULL) {
1613       return NULL;
1614    }
1615    LocationPosConstraintFree(ptr -> end5);
1616    LocationPosConstraintFree(ptr -> end3);
1617    return MemFree(ptr);
1618 }
1619 
1620 
1621 /**************************************************
1622 *
1623 *    LocationConstraintAsnRead()
1624 *
1625 **************************************************/
1626 NLM_EXTERN
1627 LocationConstraintPtr LIBCALL
LocationConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)1628 LocationConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1629 {
1630    DataVal av;
1631    AsnTypePtr atp;
1632    Boolean isError = FALSE;
1633    AsnReadFunc func;
1634    LocationConstraintPtr ptr;
1635 
1636    if (! loaded)
1637    {
1638       if (! objmacroAsnLoad()) {
1639          return NULL;
1640       }
1641    }
1642 
1643    if (aip == NULL) {
1644       return NULL;
1645    }
1646 
1647    if (orig == NULL) {         /* LocationConstraint ::= (self contained) */
1648       atp = AsnReadId(aip, amp, LOCATION_CONSTRAINT);
1649    } else {
1650       atp = AsnLinkType(orig, LOCATION_CONSTRAINT);
1651    }
1652    /* link in local tree */
1653    if (atp == NULL) {
1654       return NULL;
1655    }
1656 
1657    ptr = LocationConstraintNew();
1658    if (ptr == NULL) {
1659       goto erret;
1660    }
1661    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1662       goto erret;
1663    }
1664 
1665    atp = AsnReadId(aip,amp, atp);
1666    func = NULL;
1667 
1668    if (atp == LOCATION_CONSTRAINT_strand) {
1669       if ( AsnReadVal(aip, atp, &av) <= 0) {
1670          goto erret;
1671       }
1672       ptr -> strand = av.intvalue;
1673       atp = AsnReadId(aip,amp, atp);
1674    }
1675    if (atp == LOCATION_CONSTRAINT_seq_type) {
1676       if ( AsnReadVal(aip, atp, &av) <= 0) {
1677          goto erret;
1678       }
1679       ptr -> seq_type = av.intvalue;
1680       atp = AsnReadId(aip,amp, atp);
1681    }
1682    if (atp == LOCATION_CONSTRAINT_partial5) {
1683       if ( AsnReadVal(aip, atp, &av) <= 0) {
1684          goto erret;
1685       }
1686       ptr -> partial5 = av.intvalue;
1687       atp = AsnReadId(aip,amp, atp);
1688    }
1689    if (atp == LOCATION_CONSTRAINT_partial3) {
1690       if ( AsnReadVal(aip, atp, &av) <= 0) {
1691          goto erret;
1692       }
1693       ptr -> partial3 = av.intvalue;
1694       atp = AsnReadId(aip,amp, atp);
1695    }
1696    if (atp == LOCATION_CONSTRAINT_location_type) {
1697       if ( AsnReadVal(aip, atp, &av) <= 0) {
1698          goto erret;
1699       }
1700       ptr -> location_type = av.intvalue;
1701       atp = AsnReadId(aip,amp, atp);
1702    }
1703    if (atp == LOCATION_CONSTRAINT_end5) {
1704       ptr -> end5 = LocationPosConstraintAsnRead(aip, atp);
1705       if (aip -> io_failure) {
1706          goto erret;
1707       }
1708       atp = AsnReadId(aip,amp, atp);
1709    }
1710    if (atp == LOCATION_CONSTRAINT_end3) {
1711       ptr -> end3 = LocationPosConstraintAsnRead(aip, atp);
1712       if (aip -> io_failure) {
1713          goto erret;
1714       }
1715       atp = AsnReadId(aip,amp, atp);
1716    }
1717 
1718    if (AsnReadVal(aip, atp, &av) <= 0) {
1719       goto erret;
1720    }
1721    /* end struct */
1722 
1723 ret:
1724    AsnUnlinkType(orig);       /* unlink local tree */
1725    return ptr;
1726 
1727 erret:
1728    aip -> io_failure = TRUE;
1729    ptr = LocationConstraintFree(ptr);
1730    goto ret;
1731 }
1732 
1733 
1734 
1735 /**************************************************
1736 *
1737 *    LocationConstraintAsnWrite()
1738 *
1739 **************************************************/
1740 NLM_EXTERN Boolean LIBCALL
LocationConstraintAsnWrite(LocationConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1741 LocationConstraintAsnWrite(LocationConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1742 {
1743    DataVal av;
1744    AsnTypePtr atp;
1745    Boolean retval = FALSE;
1746 
1747    if (! loaded)
1748    {
1749       if (! objmacroAsnLoad()) {
1750          return FALSE;
1751       }
1752    }
1753 
1754    if (aip == NULL) {
1755       return FALSE;
1756    }
1757 
1758    atp = AsnLinkType(orig, LOCATION_CONSTRAINT);   /* link local tree */
1759    if (atp == NULL) {
1760       return FALSE;
1761    }
1762 
1763    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1764 
1765     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1766 
1767    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1768       goto erret;
1769    }
1770 
1771    av.intvalue = ptr -> strand;
1772    retval = AsnWrite(aip, LOCATION_CONSTRAINT_strand,  &av);
1773    av.intvalue = ptr -> seq_type;
1774    retval = AsnWrite(aip, LOCATION_CONSTRAINT_seq_type,  &av);
1775    av.intvalue = ptr -> partial5;
1776    retval = AsnWrite(aip, LOCATION_CONSTRAINT_partial5,  &av);
1777    av.intvalue = ptr -> partial3;
1778    retval = AsnWrite(aip, LOCATION_CONSTRAINT_partial3,  &av);
1779    av.intvalue = ptr -> location_type;
1780    retval = AsnWrite(aip, LOCATION_CONSTRAINT_location_type,  &av);
1781    if (ptr -> end5 != NULL) {
1782       if ( ! LocationPosConstraintAsnWrite(ptr -> end5, aip, LOCATION_CONSTRAINT_end5)) {
1783          goto erret;
1784       }
1785    }
1786    if (ptr -> end3 != NULL) {
1787       if ( ! LocationPosConstraintAsnWrite(ptr -> end3, aip, LOCATION_CONSTRAINT_end3)) {
1788          goto erret;
1789       }
1790    }
1791    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1792       goto erret;
1793    }
1794    retval = TRUE;
1795 
1796 erret:
1797    AsnUnlinkType(orig);       /* unlink local tree */
1798    return retval;
1799 }
1800 
1801 
1802 
1803 /**************************************************
1804 *
1805 *    FeatQualLegalValNew()
1806 *
1807 **************************************************/
1808 NLM_EXTERN
1809 FeatQualLegalValPtr LIBCALL
FeatQualLegalValNew(void)1810 FeatQualLegalValNew(void)
1811 {
1812    FeatQualLegalValPtr ptr = MemNew((size_t) sizeof(FeatQualLegalVal));
1813 
1814    return ptr;
1815 
1816 }
1817 
1818 
1819 /**************************************************
1820 *
1821 *    FeatQualLegalValFree()
1822 *
1823 **************************************************/
1824 NLM_EXTERN
1825 FeatQualLegalValPtr LIBCALL
FeatQualLegalValFree(FeatQualLegalValPtr ptr)1826 FeatQualLegalValFree(FeatQualLegalValPtr ptr)
1827 {
1828 
1829    if(ptr == NULL) {
1830       return NULL;
1831    }
1832    MemFree(ptr -> val);
1833    return MemFree(ptr);
1834 }
1835 
1836 
1837 /**************************************************
1838 *
1839 *    FeatQualLegalValAsnRead()
1840 *
1841 **************************************************/
1842 NLM_EXTERN
1843 FeatQualLegalValPtr LIBCALL
FeatQualLegalValAsnRead(AsnIoPtr aip,AsnTypePtr orig)1844 FeatQualLegalValAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1845 {
1846    DataVal av;
1847    AsnTypePtr atp;
1848    Boolean isError = FALSE;
1849    AsnReadFunc func;
1850    FeatQualLegalValPtr ptr;
1851 
1852    if (! loaded)
1853    {
1854       if (! objmacroAsnLoad()) {
1855          return NULL;
1856       }
1857    }
1858 
1859    if (aip == NULL) {
1860       return NULL;
1861    }
1862 
1863    if (orig == NULL) {         /* FeatQualLegalVal ::= (self contained) */
1864       atp = AsnReadId(aip, amp, FEAT_QUAL_LEGAL_VAL);
1865    } else {
1866       atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL);
1867    }
1868    /* link in local tree */
1869    if (atp == NULL) {
1870       return NULL;
1871    }
1872 
1873    ptr = FeatQualLegalValNew();
1874    if (ptr == NULL) {
1875       goto erret;
1876    }
1877    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1878       goto erret;
1879    }
1880 
1881    atp = AsnReadId(aip,amp, atp);
1882    func = NULL;
1883 
1884    if (atp == FEAT_QUAL_LEGAL_VAL_qual) {
1885       if ( AsnReadVal(aip, atp, &av) <= 0) {
1886          goto erret;
1887       }
1888       ptr -> qual = av.intvalue;
1889       atp = AsnReadId(aip,amp, atp);
1890    }
1891    if (atp == FEAT_QUAL_LEGAL_VAL_val) {
1892       if ( AsnReadVal(aip, atp, &av) <= 0) {
1893          goto erret;
1894       }
1895       ptr -> val = av.ptrvalue;
1896       atp = AsnReadId(aip,amp, atp);
1897    }
1898 
1899    if (AsnReadVal(aip, atp, &av) <= 0) {
1900       goto erret;
1901    }
1902    /* end struct */
1903 
1904 ret:
1905    AsnUnlinkType(orig);       /* unlink local tree */
1906    return ptr;
1907 
1908 erret:
1909    aip -> io_failure = TRUE;
1910    ptr = FeatQualLegalValFree(ptr);
1911    goto ret;
1912 }
1913 
1914 
1915 
1916 /**************************************************
1917 *
1918 *    FeatQualLegalValAsnWrite()
1919 *
1920 **************************************************/
1921 NLM_EXTERN Boolean LIBCALL
FeatQualLegalValAsnWrite(FeatQualLegalValPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1922 FeatQualLegalValAsnWrite(FeatQualLegalValPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1923 {
1924    DataVal av;
1925    AsnTypePtr atp;
1926    Boolean retval = FALSE;
1927 
1928    if (! loaded)
1929    {
1930       if (! objmacroAsnLoad()) {
1931          return FALSE;
1932       }
1933    }
1934 
1935    if (aip == NULL) {
1936       return FALSE;
1937    }
1938 
1939    atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL);   /* link local tree */
1940    if (atp == NULL) {
1941       return FALSE;
1942    }
1943 
1944    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1945 
1946     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1947 
1948    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1949       goto erret;
1950    }
1951 
1952    av.intvalue = ptr -> qual;
1953    retval = AsnWrite(aip, FEAT_QUAL_LEGAL_VAL_qual,  &av);
1954    if (ptr -> val != NULL) {
1955       av.ptrvalue = ptr -> val;
1956       retval = AsnWrite(aip, FEAT_QUAL_LEGAL_VAL_val,  &av);
1957    }
1958    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1959       goto erret;
1960    }
1961    retval = TRUE;
1962 
1963 erret:
1964    AsnUnlinkType(orig);       /* unlink local tree */
1965    return retval;
1966 }
1967 
1968 
1969 
1970 /**************************************************
1971 *
1972 *    FeatQualLegalValChoiceFree()
1973 *
1974 **************************************************/
1975 NLM_EXTERN
1976 FeatQualLegalValChoicePtr LIBCALL
FeatQualLegalValChoiceFree(ValNodePtr anp)1977 FeatQualLegalValChoiceFree(ValNodePtr anp)
1978 {
1979    Pointer pnt;
1980 
1981    if (anp == NULL) {
1982       return NULL;
1983    }
1984 
1985    pnt = anp->data.ptrvalue;
1986    switch (anp->choice)
1987    {
1988    default:
1989       break;
1990    case FeatQualLegalValChoice_qual:
1991       FeatQualLegalValFree(anp -> data.ptrvalue);
1992       break;
1993    }
1994    return MemFree(anp);
1995 }
1996 
1997 
1998 /**************************************************
1999 *
2000 *    FeatQualLegalValChoiceAsnRead()
2001 *
2002 **************************************************/
2003 NLM_EXTERN
2004 FeatQualLegalValChoicePtr LIBCALL
FeatQualLegalValChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)2005 FeatQualLegalValChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2006 {
2007    DataVal av;
2008    AsnTypePtr atp;
2009    ValNodePtr anp;
2010    Uint1 choice;
2011    Boolean isError = FALSE;
2012    Boolean nullIsError = FALSE;
2013    AsnReadFunc func;
2014 
2015    if (! loaded)
2016    {
2017       if (! objmacroAsnLoad()) {
2018          return NULL;
2019       }
2020    }
2021 
2022    if (aip == NULL) {
2023       return NULL;
2024    }
2025 
2026    if (orig == NULL) {         /* FeatQualLegalValChoice ::= (self contained) */
2027       atp = AsnReadId(aip, amp, FEAT_QUAL_LEGAL_VAL_CHOICE);
2028    } else {
2029       atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL_CHOICE);    /* link in local tree */
2030    }
2031    if (atp == NULL) {
2032       return NULL;
2033    }
2034 
2035    anp = ValNodeNew(NULL);
2036    if (anp == NULL) {
2037       goto erret;
2038    }
2039    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
2040       goto erret;
2041    }
2042 
2043    func = NULL;
2044 
2045    atp = AsnReadId(aip, amp, atp);  /* find the choice */
2046    if (atp == NULL) {
2047       goto erret;
2048    }
2049    if (atp == FEAT_QUAL_LEGAL_VAL_CHOICE_qual) {
2050       choice = FeatQualLegalValChoice_qual;
2051       func = (AsnReadFunc) FeatQualLegalValAsnRead;
2052    }
2053    anp->choice = choice;
2054    if (func != NULL)
2055    {
2056       anp->data.ptrvalue = (* func)(aip, atp);
2057       if (aip -> io_failure) goto erret;
2058 
2059       if (nullIsError && anp->data.ptrvalue == NULL) {
2060          goto erret;
2061       }
2062    }
2063 
2064 ret:
2065    AsnUnlinkType(orig);       /* unlink local tree */
2066    return anp;
2067 
2068 erret:
2069    anp = MemFree(anp);
2070    aip -> io_failure = TRUE;
2071    goto ret;
2072 }
2073 
2074 
2075 /**************************************************
2076 *
2077 *    FeatQualLegalValChoiceAsnWrite()
2078 *
2079 **************************************************/
2080 NLM_EXTERN Boolean LIBCALL
FeatQualLegalValChoiceAsnWrite(FeatQualLegalValChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)2081 FeatQualLegalValChoiceAsnWrite(FeatQualLegalValChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
2082 
2083 {
2084    DataVal av;
2085    AsnTypePtr atp, writetype = NULL;
2086    Pointer pnt;
2087    AsnWriteFunc func = NULL;
2088    Boolean retval = FALSE;
2089 
2090    if (! loaded)
2091    {
2092       if (! objmacroAsnLoad())
2093       return FALSE;
2094    }
2095 
2096    if (aip == NULL)
2097    return FALSE;
2098 
2099    atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_VAL_CHOICE);   /* link local tree */
2100    if (atp == NULL) {
2101       return FALSE;
2102    }
2103 
2104    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2105 
2106     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2107 
2108    av.ptrvalue = (Pointer)anp;
2109    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2110       goto erret;
2111    }
2112 
2113    pnt = anp->data.ptrvalue;
2114    switch (anp->choice)
2115    {
2116    case FeatQualLegalValChoice_qual:
2117       writetype = FEAT_QUAL_LEGAL_VAL_CHOICE_qual;
2118       func = (AsnWriteFunc) FeatQualLegalValAsnWrite;
2119       break;
2120    }
2121    if (writetype != NULL) {
2122       retval = (* func)(pnt, aip, writetype);   /* write it out */
2123    }
2124    if (!retval) {
2125       goto erret;
2126    }
2127    retval = TRUE;
2128 
2129 erret:
2130    AsnUnlinkType(orig);       /* unlink local tree */
2131    return retval;
2132 }
2133 
2134 
2135 /**************************************************
2136 *
2137 *    FeatQualLegalSetFree()
2138 *
2139 **************************************************/
2140 NLM_EXTERN
2141 FeatQualLegalSetPtr LIBCALL
FeatQualLegalSetFree(FeatQualLegalSetPtr ptr)2142 FeatQualLegalSetFree(FeatQualLegalSetPtr ptr)
2143 {
2144 
2145    if(ptr == NULL) {
2146       return NULL;
2147    }
2148    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) FeatQualLegalValChoiceFree);
2149    return NULL;
2150 }
2151 
2152 
2153 /**************************************************
2154 *
2155 *    FeatQualLegalSetAsnRead()
2156 *
2157 **************************************************/
2158 NLM_EXTERN
2159 FeatQualLegalSetPtr LIBCALL
FeatQualLegalSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)2160 FeatQualLegalSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2161 {
2162    DataVal av;
2163    AsnTypePtr atp;
2164    Boolean isError = FALSE;
2165    AsnReadFunc func;
2166    FeatQualLegalSetPtr ptr;
2167 
2168    if (! loaded)
2169    {
2170       if (! objmacroAsnLoad()) {
2171          return NULL;
2172       }
2173    }
2174 
2175    if (aip == NULL) {
2176       return NULL;
2177    }
2178 
2179    if (orig == NULL) {         /* FeatQualLegalSet ::= (self contained) */
2180       atp = AsnReadId(aip, amp, FEAT_QUAL_LEGAL_SET);
2181    } else {
2182       atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_SET);
2183    }
2184    /* link in local tree */
2185    if (atp == NULL) {
2186       return NULL;
2187    }
2188 
2189    func = NULL;
2190 
2191    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) FeatQualLegalValChoiceAsnRead, (AsnOptFreeFunc) FeatQualLegalValChoiceFree);
2192    if (isError && ptr  == NULL) {
2193       goto erret;
2194    }
2195 
2196 
2197 
2198 ret:
2199    AsnUnlinkType(orig);       /* unlink local tree */
2200    return ptr;
2201 
2202 erret:
2203    aip -> io_failure = TRUE;
2204    ptr = FeatQualLegalSetFree(ptr);
2205    goto ret;
2206 }
2207 
2208 
2209 
2210 /**************************************************
2211 *
2212 *    FeatQualLegalSetAsnWrite()
2213 *
2214 **************************************************/
2215 NLM_EXTERN Boolean LIBCALL
FeatQualLegalSetAsnWrite(FeatQualLegalSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2216 FeatQualLegalSetAsnWrite(FeatQualLegalSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2217 {
2218    DataVal av;
2219    AsnTypePtr atp;
2220    Boolean retval = FALSE;
2221 
2222    if (! loaded)
2223    {
2224       if (! objmacroAsnLoad()) {
2225          return FALSE;
2226       }
2227    }
2228 
2229    if (aip == NULL) {
2230       return FALSE;
2231    }
2232 
2233    atp = AsnLinkType(orig, FEAT_QUAL_LEGAL_SET);   /* link local tree */
2234    if (atp == NULL) {
2235       return FALSE;
2236    }
2237 
2238    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2239 
2240     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2241 
2242    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) FeatQualLegalValChoiceAsnWrite, aip, atp, FEAT_QUAL_LEGAL_SET_E);
2243    retval = TRUE;
2244 
2245 erret:
2246    AsnUnlinkType(orig);       /* unlink local tree */
2247    return retval;
2248 }
2249 
2250 
2251 
2252 /**************************************************
2253 *
2254 *    FeatQualChoiceFree()
2255 *
2256 **************************************************/
2257 NLM_EXTERN
2258 FeatQualChoicePtr LIBCALL
FeatQualChoiceFree(ValNodePtr anp)2259 FeatQualChoiceFree(ValNodePtr anp)
2260 {
2261    Pointer pnt;
2262 
2263    if (anp == NULL) {
2264       return NULL;
2265    }
2266 
2267    pnt = anp->data.ptrvalue;
2268    switch (anp->choice)
2269    {
2270    default:
2271       break;
2272    case FeatQualChoice_illegal_qual:
2273       StringConstraintFree(anp -> data.ptrvalue);
2274       break;
2275    }
2276    return MemFree(anp);
2277 }
2278 
2279 
2280 /**************************************************
2281 *
2282 *    FeatQualChoiceAsnRead()
2283 *
2284 **************************************************/
2285 NLM_EXTERN
2286 FeatQualChoicePtr LIBCALL
FeatQualChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)2287 FeatQualChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2288 {
2289    DataVal av;
2290    AsnTypePtr atp;
2291    ValNodePtr anp;
2292    Uint1 choice;
2293    Boolean isError = FALSE;
2294    Boolean nullIsError = FALSE;
2295    AsnReadFunc func;
2296 
2297    if (! loaded)
2298    {
2299       if (! objmacroAsnLoad()) {
2300          return NULL;
2301       }
2302    }
2303 
2304    if (aip == NULL) {
2305       return NULL;
2306    }
2307 
2308    if (orig == NULL) {         /* FeatQualChoice ::= (self contained) */
2309       atp = AsnReadId(aip, amp, FEAT_QUAL_CHOICE);
2310    } else {
2311       atp = AsnLinkType(orig, FEAT_QUAL_CHOICE);    /* link in local tree */
2312    }
2313    if (atp == NULL) {
2314       return NULL;
2315    }
2316 
2317    anp = ValNodeNew(NULL);
2318    if (anp == NULL) {
2319       goto erret;
2320    }
2321    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
2322       goto erret;
2323    }
2324 
2325    func = NULL;
2326 
2327    atp = AsnReadId(aip, amp, atp);  /* find the choice */
2328    if (atp == NULL) {
2329       goto erret;
2330    }
2331    if (atp == FEAT_QUAL_CHOICE_legal_qual) {
2332       choice = FeatQualChoice_legal_qual;
2333       if (AsnReadVal(aip, atp, &av) <= 0) {
2334          goto erret;
2335       }
2336       anp->data.intvalue = av.intvalue;
2337    }
2338    else if (atp == FEAT_QUAL_CHOICE_illegal_qual) {
2339       choice = FeatQualChoice_illegal_qual;
2340       func = (AsnReadFunc) StringConstraintAsnRead;
2341    }
2342    anp->choice = choice;
2343    if (func != NULL)
2344    {
2345       anp->data.ptrvalue = (* func)(aip, atp);
2346       if (aip -> io_failure) goto erret;
2347 
2348       if (nullIsError && anp->data.ptrvalue == NULL) {
2349          goto erret;
2350       }
2351    }
2352 
2353 ret:
2354    AsnUnlinkType(orig);       /* unlink local tree */
2355    return anp;
2356 
2357 erret:
2358    anp = MemFree(anp);
2359    aip -> io_failure = TRUE;
2360    goto ret;
2361 }
2362 
2363 
2364 /**************************************************
2365 *
2366 *    FeatQualChoiceAsnWrite()
2367 *
2368 **************************************************/
2369 NLM_EXTERN Boolean LIBCALL
FeatQualChoiceAsnWrite(FeatQualChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)2370 FeatQualChoiceAsnWrite(FeatQualChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
2371 
2372 {
2373    DataVal av;
2374    AsnTypePtr atp, writetype = NULL;
2375    Pointer pnt;
2376    AsnWriteFunc func = NULL;
2377    Boolean retval = FALSE;
2378 
2379    if (! loaded)
2380    {
2381       if (! objmacroAsnLoad())
2382       return FALSE;
2383    }
2384 
2385    if (aip == NULL)
2386    return FALSE;
2387 
2388    atp = AsnLinkType(orig, FEAT_QUAL_CHOICE);   /* link local tree */
2389    if (atp == NULL) {
2390       return FALSE;
2391    }
2392 
2393    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2394 
2395     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2396 
2397    av.ptrvalue = (Pointer)anp;
2398    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2399       goto erret;
2400    }
2401 
2402    pnt = anp->data.ptrvalue;
2403    switch (anp->choice)
2404    {
2405    case FeatQualChoice_legal_qual:
2406       av.intvalue = anp->data.intvalue;
2407       retval = AsnWrite(aip, FEAT_QUAL_CHOICE_legal_qual, &av);
2408       break;
2409    case FeatQualChoice_illegal_qual:
2410       writetype = FEAT_QUAL_CHOICE_illegal_qual;
2411       func = (AsnWriteFunc) StringConstraintAsnWrite;
2412       break;
2413    }
2414    if (writetype != NULL) {
2415       retval = (* func)(pnt, aip, writetype);   /* write it out */
2416    }
2417    if (!retval) {
2418       goto erret;
2419    }
2420    retval = TRUE;
2421 
2422 erret:
2423    AsnUnlinkType(orig);       /* unlink local tree */
2424    return retval;
2425 }
2426 
2427 
2428 /**************************************************
2429 *
2430 *    FeatureFieldNew()
2431 *
2432 **************************************************/
2433 NLM_EXTERN
2434 FeatureFieldPtr LIBCALL
FeatureFieldNew(void)2435 FeatureFieldNew(void)
2436 {
2437    FeatureFieldPtr ptr = MemNew((size_t) sizeof(FeatureField));
2438 
2439    return ptr;
2440 
2441 }
2442 
2443 
2444 /**************************************************
2445 *
2446 *    FeatureFieldFree()
2447 *
2448 **************************************************/
2449 NLM_EXTERN
2450 FeatureFieldPtr LIBCALL
FeatureFieldFree(FeatureFieldPtr ptr)2451 FeatureFieldFree(FeatureFieldPtr ptr)
2452 {
2453 
2454    if(ptr == NULL) {
2455       return NULL;
2456    }
2457    FeatQualChoiceFree(ptr -> field);
2458    return MemFree(ptr);
2459 }
2460 
2461 
2462 /**************************************************
2463 *
2464 *    FeatureFieldAsnRead()
2465 *
2466 **************************************************/
2467 NLM_EXTERN
2468 FeatureFieldPtr LIBCALL
FeatureFieldAsnRead(AsnIoPtr aip,AsnTypePtr orig)2469 FeatureFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2470 {
2471    DataVal av;
2472    AsnTypePtr atp;
2473    Boolean isError = FALSE;
2474    AsnReadFunc func;
2475    FeatureFieldPtr ptr;
2476 
2477    if (! loaded)
2478    {
2479       if (! objmacroAsnLoad()) {
2480          return NULL;
2481       }
2482    }
2483 
2484    if (aip == NULL) {
2485       return NULL;
2486    }
2487 
2488    if (orig == NULL) {         /* FeatureField ::= (self contained) */
2489       atp = AsnReadId(aip, amp, FEATURE_FIELD);
2490    } else {
2491       atp = AsnLinkType(orig, FEATURE_FIELD);
2492    }
2493    /* link in local tree */
2494    if (atp == NULL) {
2495       return NULL;
2496    }
2497 
2498    ptr = FeatureFieldNew();
2499    if (ptr == NULL) {
2500       goto erret;
2501    }
2502    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2503       goto erret;
2504    }
2505 
2506    atp = AsnReadId(aip,amp, atp);
2507    func = NULL;
2508 
2509    if (atp == FEATURE_FIELD_type) {
2510       if ( AsnReadVal(aip, atp, &av) <= 0) {
2511          goto erret;
2512       }
2513       ptr -> type = av.intvalue;
2514       atp = AsnReadId(aip,amp, atp);
2515    }
2516    if (atp == FEATURE_FIELD_field) {
2517       ptr -> field = FeatQualChoiceAsnRead(aip, atp);
2518       if (aip -> io_failure) {
2519          goto erret;
2520       }
2521       atp = AsnReadId(aip,amp, atp);
2522    }
2523 
2524    if (AsnReadVal(aip, atp, &av) <= 0) {
2525       goto erret;
2526    }
2527    /* end struct */
2528 
2529 ret:
2530    AsnUnlinkType(orig);       /* unlink local tree */
2531    return ptr;
2532 
2533 erret:
2534    aip -> io_failure = TRUE;
2535    ptr = FeatureFieldFree(ptr);
2536    goto ret;
2537 }
2538 
2539 
2540 
2541 /**************************************************
2542 *
2543 *    FeatureFieldAsnWrite()
2544 *
2545 **************************************************/
2546 NLM_EXTERN Boolean LIBCALL
FeatureFieldAsnWrite(FeatureFieldPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2547 FeatureFieldAsnWrite(FeatureFieldPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2548 {
2549    DataVal av;
2550    AsnTypePtr atp;
2551    Boolean retval = FALSE;
2552 
2553    if (! loaded)
2554    {
2555       if (! objmacroAsnLoad()) {
2556          return FALSE;
2557       }
2558    }
2559 
2560    if (aip == NULL) {
2561       return FALSE;
2562    }
2563 
2564    atp = AsnLinkType(orig, FEATURE_FIELD);   /* link local tree */
2565    if (atp == NULL) {
2566       return FALSE;
2567    }
2568 
2569    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2570 
2571     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2572 
2573    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2574       goto erret;
2575    }
2576 
2577    av.intvalue = ptr -> type;
2578    retval = AsnWrite(aip, FEATURE_FIELD_type,  &av);
2579    if (ptr -> field != NULL) {
2580       if ( ! FeatQualChoiceAsnWrite(ptr -> field, aip, FEATURE_FIELD_field)) {
2581          goto erret;
2582       }
2583    }
2584    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2585       goto erret;
2586    }
2587    retval = TRUE;
2588 
2589 erret:
2590    AsnUnlinkType(orig);       /* unlink local tree */
2591    return retval;
2592 }
2593 
2594 
2595 
2596 /**************************************************
2597 *
2598 *    FeatureFieldLegalNew()
2599 *
2600 **************************************************/
2601 NLM_EXTERN
2602 FeatureFieldLegalPtr LIBCALL
FeatureFieldLegalNew(void)2603 FeatureFieldLegalNew(void)
2604 {
2605    FeatureFieldLegalPtr ptr = MemNew((size_t) sizeof(FeatureFieldLegal));
2606 
2607    return ptr;
2608 
2609 }
2610 
2611 
2612 /**************************************************
2613 *
2614 *    FeatureFieldLegalFree()
2615 *
2616 **************************************************/
2617 NLM_EXTERN
2618 FeatureFieldLegalPtr LIBCALL
FeatureFieldLegalFree(FeatureFieldLegalPtr ptr)2619 FeatureFieldLegalFree(FeatureFieldLegalPtr ptr)
2620 {
2621 
2622    if(ptr == NULL) {
2623       return NULL;
2624    }
2625    return MemFree(ptr);
2626 }
2627 
2628 
2629 /**************************************************
2630 *
2631 *    FeatureFieldLegalAsnRead()
2632 *
2633 **************************************************/
2634 NLM_EXTERN
2635 FeatureFieldLegalPtr LIBCALL
FeatureFieldLegalAsnRead(AsnIoPtr aip,AsnTypePtr orig)2636 FeatureFieldLegalAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2637 {
2638    DataVal av;
2639    AsnTypePtr atp;
2640    Boolean isError = FALSE;
2641    AsnReadFunc func;
2642    FeatureFieldLegalPtr ptr;
2643 
2644    if (! loaded)
2645    {
2646       if (! objmacroAsnLoad()) {
2647          return NULL;
2648       }
2649    }
2650 
2651    if (aip == NULL) {
2652       return NULL;
2653    }
2654 
2655    if (orig == NULL) {         /* FeatureFieldLegal ::= (self contained) */
2656       atp = AsnReadId(aip, amp, FEATURE_FIELD_LEGAL);
2657    } else {
2658       atp = AsnLinkType(orig, FEATURE_FIELD_LEGAL);
2659    }
2660    /* link in local tree */
2661    if (atp == NULL) {
2662       return NULL;
2663    }
2664 
2665    ptr = FeatureFieldLegalNew();
2666    if (ptr == NULL) {
2667       goto erret;
2668    }
2669    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2670       goto erret;
2671    }
2672 
2673    atp = AsnReadId(aip,amp, atp);
2674    func = NULL;
2675 
2676    if (atp == FEATURE_FIELD_LEGAL_type) {
2677       if ( AsnReadVal(aip, atp, &av) <= 0) {
2678          goto erret;
2679       }
2680       ptr -> type = av.intvalue;
2681       atp = AsnReadId(aip,amp, atp);
2682    }
2683    if (atp == FEATURE_FIELD_LEGAL_field) {
2684       if ( AsnReadVal(aip, atp, &av) <= 0) {
2685          goto erret;
2686       }
2687       ptr -> field = av.intvalue;
2688       atp = AsnReadId(aip,amp, atp);
2689    }
2690 
2691    if (AsnReadVal(aip, atp, &av) <= 0) {
2692       goto erret;
2693    }
2694    /* end struct */
2695 
2696 ret:
2697    AsnUnlinkType(orig);       /* unlink local tree */
2698    return ptr;
2699 
2700 erret:
2701    aip -> io_failure = TRUE;
2702    ptr = FeatureFieldLegalFree(ptr);
2703    goto ret;
2704 }
2705 
2706 
2707 
2708 /**************************************************
2709 *
2710 *    FeatureFieldLegalAsnWrite()
2711 *
2712 **************************************************/
2713 NLM_EXTERN Boolean LIBCALL
FeatureFieldLegalAsnWrite(FeatureFieldLegalPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2714 FeatureFieldLegalAsnWrite(FeatureFieldLegalPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2715 {
2716    DataVal av;
2717    AsnTypePtr atp;
2718    Boolean retval = FALSE;
2719 
2720    if (! loaded)
2721    {
2722       if (! objmacroAsnLoad()) {
2723          return FALSE;
2724       }
2725    }
2726 
2727    if (aip == NULL) {
2728       return FALSE;
2729    }
2730 
2731    atp = AsnLinkType(orig, FEATURE_FIELD_LEGAL);   /* link local tree */
2732    if (atp == NULL) {
2733       return FALSE;
2734    }
2735 
2736    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2737 
2738     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2739 
2740    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2741       goto erret;
2742    }
2743 
2744    av.intvalue = ptr -> type;
2745    retval = AsnWrite(aip, FEATURE_FIELD_LEGAL_type,  &av);
2746    av.intvalue = ptr -> field;
2747    retval = AsnWrite(aip, FEATURE_FIELD_LEGAL_field,  &av);
2748    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2749       goto erret;
2750    }
2751    retval = TRUE;
2752 
2753 erret:
2754    AsnUnlinkType(orig);       /* unlink local tree */
2755    return retval;
2756 }
2757 
2758 
2759 
2760 /**************************************************
2761 *
2762 *    FeatureFieldPairNew()
2763 *
2764 **************************************************/
2765 NLM_EXTERN
2766 FeatureFieldPairPtr LIBCALL
FeatureFieldPairNew(void)2767 FeatureFieldPairNew(void)
2768 {
2769    FeatureFieldPairPtr ptr = MemNew((size_t) sizeof(FeatureFieldPair));
2770 
2771    return ptr;
2772 
2773 }
2774 
2775 
2776 /**************************************************
2777 *
2778 *    FeatureFieldPairFree()
2779 *
2780 **************************************************/
2781 NLM_EXTERN
2782 FeatureFieldPairPtr LIBCALL
FeatureFieldPairFree(FeatureFieldPairPtr ptr)2783 FeatureFieldPairFree(FeatureFieldPairPtr ptr)
2784 {
2785 
2786    if(ptr == NULL) {
2787       return NULL;
2788    }
2789    FeatQualChoiceFree(ptr -> field_from);
2790    FeatQualChoiceFree(ptr -> field_to);
2791    return MemFree(ptr);
2792 }
2793 
2794 
2795 /**************************************************
2796 *
2797 *    FeatureFieldPairAsnRead()
2798 *
2799 **************************************************/
2800 NLM_EXTERN
2801 FeatureFieldPairPtr LIBCALL
FeatureFieldPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)2802 FeatureFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2803 {
2804    DataVal av;
2805    AsnTypePtr atp;
2806    Boolean isError = FALSE;
2807    AsnReadFunc func;
2808    FeatureFieldPairPtr ptr;
2809 
2810    if (! loaded)
2811    {
2812       if (! objmacroAsnLoad()) {
2813          return NULL;
2814       }
2815    }
2816 
2817    if (aip == NULL) {
2818       return NULL;
2819    }
2820 
2821    if (orig == NULL) {         /* FeatureFieldPair ::= (self contained) */
2822       atp = AsnReadId(aip, amp, FEATURE_FIELD_PAIR);
2823    } else {
2824       atp = AsnLinkType(orig, FEATURE_FIELD_PAIR);
2825    }
2826    /* link in local tree */
2827    if (atp == NULL) {
2828       return NULL;
2829    }
2830 
2831    ptr = FeatureFieldPairNew();
2832    if (ptr == NULL) {
2833       goto erret;
2834    }
2835    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2836       goto erret;
2837    }
2838 
2839    atp = AsnReadId(aip,amp, atp);
2840    func = NULL;
2841 
2842    if (atp == FEATURE_FIELD_PAIR_type) {
2843       if ( AsnReadVal(aip, atp, &av) <= 0) {
2844          goto erret;
2845       }
2846       ptr -> type = av.intvalue;
2847       atp = AsnReadId(aip,amp, atp);
2848    }
2849    if (atp == FEATURE_FIELD_PAIR_field_from) {
2850       ptr -> field_from = FeatQualChoiceAsnRead(aip, atp);
2851       if (aip -> io_failure) {
2852          goto erret;
2853       }
2854       atp = AsnReadId(aip,amp, atp);
2855    }
2856    if (atp == FEATURE_FIELD_PAIR_field_to) {
2857       ptr -> field_to = FeatQualChoiceAsnRead(aip, atp);
2858       if (aip -> io_failure) {
2859          goto erret;
2860       }
2861       atp = AsnReadId(aip,amp, atp);
2862    }
2863 
2864    if (AsnReadVal(aip, atp, &av) <= 0) {
2865       goto erret;
2866    }
2867    /* end struct */
2868 
2869 ret:
2870    AsnUnlinkType(orig);       /* unlink local tree */
2871    return ptr;
2872 
2873 erret:
2874    aip -> io_failure = TRUE;
2875    ptr = FeatureFieldPairFree(ptr);
2876    goto ret;
2877 }
2878 
2879 
2880 
2881 /**************************************************
2882 *
2883 *    FeatureFieldPairAsnWrite()
2884 *
2885 **************************************************/
2886 NLM_EXTERN Boolean LIBCALL
FeatureFieldPairAsnWrite(FeatureFieldPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2887 FeatureFieldPairAsnWrite(FeatureFieldPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2888 {
2889    DataVal av;
2890    AsnTypePtr atp;
2891    Boolean retval = FALSE;
2892 
2893    if (! loaded)
2894    {
2895       if (! objmacroAsnLoad()) {
2896          return FALSE;
2897       }
2898    }
2899 
2900    if (aip == NULL) {
2901       return FALSE;
2902    }
2903 
2904    atp = AsnLinkType(orig, FEATURE_FIELD_PAIR);   /* link local tree */
2905    if (atp == NULL) {
2906       return FALSE;
2907    }
2908 
2909    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2910 
2911     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2912 
2913    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2914       goto erret;
2915    }
2916 
2917    av.intvalue = ptr -> type;
2918    retval = AsnWrite(aip, FEATURE_FIELD_PAIR_type,  &av);
2919    if (ptr -> field_from != NULL) {
2920       if ( ! FeatQualChoiceAsnWrite(ptr -> field_from, aip, FEATURE_FIELD_PAIR_field_from)) {
2921          goto erret;
2922       }
2923    }
2924    if (ptr -> field_to != NULL) {
2925       if ( ! FeatQualChoiceAsnWrite(ptr -> field_to, aip, FEATURE_FIELD_PAIR_field_to)) {
2926          goto erret;
2927       }
2928    }
2929    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2930       goto erret;
2931    }
2932    retval = TRUE;
2933 
2934 erret:
2935    AsnUnlinkType(orig);       /* unlink local tree */
2936    return retval;
2937 }
2938 
2939 
2940 
2941 /**************************************************
2942 *
2943 *    RnaFeatTypeFree()
2944 *
2945 **************************************************/
2946 NLM_EXTERN
2947 RnaFeatTypePtr LIBCALL
RnaFeatTypeFree(ValNodePtr anp)2948 RnaFeatTypeFree(ValNodePtr anp)
2949 {
2950    Pointer pnt;
2951 
2952    if (anp == NULL) {
2953       return NULL;
2954    }
2955 
2956    pnt = anp->data.ptrvalue;
2957    switch (anp->choice)
2958    {
2959    default:
2960       break;
2961    case RnaFeatType_ncRNA:
2962       MemFree(anp -> data.ptrvalue);
2963       break;
2964    }
2965    return MemFree(anp);
2966 }
2967 
2968 
2969 /**************************************************
2970 *
2971 *    RnaFeatTypeAsnRead()
2972 *
2973 **************************************************/
2974 NLM_EXTERN
2975 RnaFeatTypePtr LIBCALL
RnaFeatTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)2976 RnaFeatTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2977 {
2978    DataVal av;
2979    AsnTypePtr atp;
2980    ValNodePtr anp;
2981    Uint1 choice;
2982    Boolean isError = FALSE;
2983    Boolean nullIsError = FALSE;
2984    AsnReadFunc func;
2985 
2986    if (! loaded)
2987    {
2988       if (! objmacroAsnLoad()) {
2989          return NULL;
2990       }
2991    }
2992 
2993    if (aip == NULL) {
2994       return NULL;
2995    }
2996 
2997    if (orig == NULL) {         /* RnaFeatType ::= (self contained) */
2998       atp = AsnReadId(aip, amp, RNA_FEAT_TYPE);
2999    } else {
3000       atp = AsnLinkType(orig, RNA_FEAT_TYPE);    /* link in local tree */
3001    }
3002    if (atp == NULL) {
3003       return NULL;
3004    }
3005 
3006    anp = ValNodeNew(NULL);
3007    if (anp == NULL) {
3008       goto erret;
3009    }
3010    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
3011       goto erret;
3012    }
3013 
3014    func = NULL;
3015 
3016    atp = AsnReadId(aip, amp, atp);  /* find the choice */
3017    if (atp == NULL) {
3018       goto erret;
3019    }
3020    if (atp == RNA_FEAT_TYPE_any) {
3021       choice = RnaFeatType_any;
3022       if (AsnReadVal(aip, atp, &av) <= 0) {
3023          goto erret;
3024       }
3025       anp->data.boolvalue = av.boolvalue;
3026    }
3027    else if (atp == RNA_FEAT_TYPE_preRNA) {
3028       choice = RnaFeatType_preRNA;
3029       if (AsnReadVal(aip, atp, &av) <= 0) {
3030          goto erret;
3031       }
3032       anp->data.boolvalue = av.boolvalue;
3033    }
3034    else if (atp == RNA_FEAT_TYPE_mRNA) {
3035       choice = RnaFeatType_mRNA;
3036       if (AsnReadVal(aip, atp, &av) <= 0) {
3037          goto erret;
3038       }
3039       anp->data.boolvalue = av.boolvalue;
3040    }
3041    else if (atp == RNA_FEAT_TYPE_tRNA) {
3042       choice = RnaFeatType_tRNA;
3043       if (AsnReadVal(aip, atp, &av) <= 0) {
3044          goto erret;
3045       }
3046       anp->data.boolvalue = av.boolvalue;
3047    }
3048    else if (atp == RNA_FEAT_TYPE_rRNA) {
3049       choice = RnaFeatType_rRNA;
3050       if (AsnReadVal(aip, atp, &av) <= 0) {
3051          goto erret;
3052       }
3053       anp->data.boolvalue = av.boolvalue;
3054    }
3055    else if (atp == RNA_FEAT_TYPE_ncRNA) {
3056       choice = RnaFeatType_ncRNA;
3057       if (AsnReadVal(aip, atp, &av) <= 0) {
3058          goto erret;
3059       }
3060       anp->data.ptrvalue = av.ptrvalue;
3061    }
3062    else if (atp == RNA_FEAT_TYPE_tmRNA) {
3063       choice = RnaFeatType_tmRNA;
3064       if (AsnReadVal(aip, atp, &av) <= 0) {
3065          goto erret;
3066       }
3067       anp->data.boolvalue = av.boolvalue;
3068    }
3069    else if (atp == RNA_FEAT_TYPE_miscRNA) {
3070       choice = RnaFeatType_miscRNA;
3071       if (AsnReadVal(aip, atp, &av) <= 0) {
3072          goto erret;
3073       }
3074       anp->data.boolvalue = av.boolvalue;
3075    }
3076    anp->choice = choice;
3077    if (func != NULL)
3078    {
3079       anp->data.ptrvalue = (* func)(aip, atp);
3080       if (aip -> io_failure) goto erret;
3081 
3082       if (nullIsError && anp->data.ptrvalue == NULL) {
3083          goto erret;
3084       }
3085    }
3086 
3087 ret:
3088    AsnUnlinkType(orig);       /* unlink local tree */
3089    return anp;
3090 
3091 erret:
3092    anp = MemFree(anp);
3093    aip -> io_failure = TRUE;
3094    goto ret;
3095 }
3096 
3097 
3098 /**************************************************
3099 *
3100 *    RnaFeatTypeAsnWrite()
3101 *
3102 **************************************************/
3103 NLM_EXTERN Boolean LIBCALL
RnaFeatTypeAsnWrite(RnaFeatTypePtr anp,AsnIoPtr aip,AsnTypePtr orig)3104 RnaFeatTypeAsnWrite(RnaFeatTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
3105 
3106 {
3107    DataVal av;
3108    AsnTypePtr atp, writetype = NULL;
3109    Pointer pnt;
3110    AsnWriteFunc func = NULL;
3111    Boolean retval = FALSE;
3112 
3113    if (! loaded)
3114    {
3115       if (! objmacroAsnLoad())
3116       return FALSE;
3117    }
3118 
3119    if (aip == NULL)
3120    return FALSE;
3121 
3122    atp = AsnLinkType(orig, RNA_FEAT_TYPE);   /* link local tree */
3123    if (atp == NULL) {
3124       return FALSE;
3125    }
3126 
3127    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3128 
3129     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3130 
3131    av.ptrvalue = (Pointer)anp;
3132    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
3133       goto erret;
3134    }
3135 
3136    pnt = anp->data.ptrvalue;
3137    switch (anp->choice)
3138    {
3139    case RnaFeatType_any:
3140       av.boolvalue = anp->data.boolvalue;
3141       retval = AsnWrite(aip, RNA_FEAT_TYPE_any, &av);
3142       break;
3143    case RnaFeatType_preRNA:
3144       av.boolvalue = anp->data.boolvalue;
3145       retval = AsnWrite(aip, RNA_FEAT_TYPE_preRNA, &av);
3146       break;
3147    case RnaFeatType_mRNA:
3148       av.boolvalue = anp->data.boolvalue;
3149       retval = AsnWrite(aip, RNA_FEAT_TYPE_mRNA, &av);
3150       break;
3151    case RnaFeatType_tRNA:
3152       av.boolvalue = anp->data.boolvalue;
3153       retval = AsnWrite(aip, RNA_FEAT_TYPE_tRNA, &av);
3154       break;
3155    case RnaFeatType_rRNA:
3156       av.boolvalue = anp->data.boolvalue;
3157       retval = AsnWrite(aip, RNA_FEAT_TYPE_rRNA, &av);
3158       break;
3159    case RnaFeatType_ncRNA:
3160       av.ptrvalue = anp->data.ptrvalue;
3161       retval = AsnWrite(aip, RNA_FEAT_TYPE_ncRNA, &av);
3162       break;
3163    case RnaFeatType_tmRNA:
3164       av.boolvalue = anp->data.boolvalue;
3165       retval = AsnWrite(aip, RNA_FEAT_TYPE_tmRNA, &av);
3166       break;
3167    case RnaFeatType_miscRNA:
3168       av.boolvalue = anp->data.boolvalue;
3169       retval = AsnWrite(aip, RNA_FEAT_TYPE_miscRNA, &av);
3170       break;
3171    }
3172    if (writetype != NULL) {
3173       retval = (* func)(pnt, aip, writetype);   /* write it out */
3174    }
3175    if (!retval) {
3176       goto erret;
3177    }
3178    retval = TRUE;
3179 
3180 erret:
3181    AsnUnlinkType(orig);       /* unlink local tree */
3182    return retval;
3183 }
3184 
3185 
3186 /**************************************************
3187 *
3188 *    RnaQualNew()
3189 *
3190 **************************************************/
3191 NLM_EXTERN
3192 RnaQualPtr LIBCALL
RnaQualNew(void)3193 RnaQualNew(void)
3194 {
3195    RnaQualPtr ptr = MemNew((size_t) sizeof(RnaQual));
3196 
3197    return ptr;
3198 
3199 }
3200 
3201 
3202 /**************************************************
3203 *
3204 *    RnaQualFree()
3205 *
3206 **************************************************/
3207 NLM_EXTERN
3208 RnaQualPtr LIBCALL
RnaQualFree(RnaQualPtr ptr)3209 RnaQualFree(RnaQualPtr ptr)
3210 {
3211 
3212    if(ptr == NULL) {
3213       return NULL;
3214    }
3215    RnaFeatTypeFree(ptr -> type);
3216    return MemFree(ptr);
3217 }
3218 
3219 
3220 /**************************************************
3221 *
3222 *    RnaQualAsnRead()
3223 *
3224 **************************************************/
3225 NLM_EXTERN
3226 RnaQualPtr LIBCALL
RnaQualAsnRead(AsnIoPtr aip,AsnTypePtr orig)3227 RnaQualAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3228 {
3229    DataVal av;
3230    AsnTypePtr atp;
3231    Boolean isError = FALSE;
3232    AsnReadFunc func;
3233    RnaQualPtr ptr;
3234 
3235    if (! loaded)
3236    {
3237       if (! objmacroAsnLoad()) {
3238          return NULL;
3239       }
3240    }
3241 
3242    if (aip == NULL) {
3243       return NULL;
3244    }
3245 
3246    if (orig == NULL) {         /* RnaQual ::= (self contained) */
3247       atp = AsnReadId(aip, amp, RNA_QUAL);
3248    } else {
3249       atp = AsnLinkType(orig, RNA_QUAL);
3250    }
3251    /* link in local tree */
3252    if (atp == NULL) {
3253       return NULL;
3254    }
3255 
3256    ptr = RnaQualNew();
3257    if (ptr == NULL) {
3258       goto erret;
3259    }
3260    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3261       goto erret;
3262    }
3263 
3264    atp = AsnReadId(aip,amp, atp);
3265    func = NULL;
3266 
3267    if (atp == RNA_QUAL_type) {
3268       ptr -> type = RnaFeatTypeAsnRead(aip, atp);
3269       if (aip -> io_failure) {
3270          goto erret;
3271       }
3272       atp = AsnReadId(aip,amp, atp);
3273    }
3274    if (atp == RNA_QUAL_field) {
3275       if ( AsnReadVal(aip, atp, &av) <= 0) {
3276          goto erret;
3277       }
3278       ptr -> field = av.intvalue;
3279       atp = AsnReadId(aip,amp, atp);
3280    }
3281 
3282    if (AsnReadVal(aip, atp, &av) <= 0) {
3283       goto erret;
3284    }
3285    /* end struct */
3286 
3287 ret:
3288    AsnUnlinkType(orig);       /* unlink local tree */
3289    return ptr;
3290 
3291 erret:
3292    aip -> io_failure = TRUE;
3293    ptr = RnaQualFree(ptr);
3294    goto ret;
3295 }
3296 
3297 
3298 
3299 /**************************************************
3300 *
3301 *    RnaQualAsnWrite()
3302 *
3303 **************************************************/
3304 NLM_EXTERN Boolean LIBCALL
RnaQualAsnWrite(RnaQualPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3305 RnaQualAsnWrite(RnaQualPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3306 {
3307    DataVal av;
3308    AsnTypePtr atp;
3309    Boolean retval = FALSE;
3310 
3311    if (! loaded)
3312    {
3313       if (! objmacroAsnLoad()) {
3314          return FALSE;
3315       }
3316    }
3317 
3318    if (aip == NULL) {
3319       return FALSE;
3320    }
3321 
3322    atp = AsnLinkType(orig, RNA_QUAL);   /* link local tree */
3323    if (atp == NULL) {
3324       return FALSE;
3325    }
3326 
3327    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3328 
3329     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3330 
3331    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3332       goto erret;
3333    }
3334 
3335    if (ptr -> type != NULL) {
3336       if ( ! RnaFeatTypeAsnWrite(ptr -> type, aip, RNA_QUAL_type)) {
3337          goto erret;
3338       }
3339    }
3340    av.intvalue = ptr -> field;
3341    retval = AsnWrite(aip, RNA_QUAL_field,  &av);
3342    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3343       goto erret;
3344    }
3345    retval = TRUE;
3346 
3347 erret:
3348    AsnUnlinkType(orig);       /* unlink local tree */
3349    return retval;
3350 }
3351 
3352 
3353 
3354 /**************************************************
3355 *
3356 *    RnaQualPairNew()
3357 *
3358 **************************************************/
3359 NLM_EXTERN
3360 RnaQualPairPtr LIBCALL
RnaQualPairNew(void)3361 RnaQualPairNew(void)
3362 {
3363    RnaQualPairPtr ptr = MemNew((size_t) sizeof(RnaQualPair));
3364 
3365    return ptr;
3366 
3367 }
3368 
3369 
3370 /**************************************************
3371 *
3372 *    RnaQualPairFree()
3373 *
3374 **************************************************/
3375 NLM_EXTERN
3376 RnaQualPairPtr LIBCALL
RnaQualPairFree(RnaQualPairPtr ptr)3377 RnaQualPairFree(RnaQualPairPtr ptr)
3378 {
3379 
3380    if(ptr == NULL) {
3381       return NULL;
3382    }
3383    RnaFeatTypeFree(ptr -> type);
3384    return MemFree(ptr);
3385 }
3386 
3387 
3388 /**************************************************
3389 *
3390 *    RnaQualPairAsnRead()
3391 *
3392 **************************************************/
3393 NLM_EXTERN
3394 RnaQualPairPtr LIBCALL
RnaQualPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)3395 RnaQualPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3396 {
3397    DataVal av;
3398    AsnTypePtr atp;
3399    Boolean isError = FALSE;
3400    AsnReadFunc func;
3401    RnaQualPairPtr ptr;
3402 
3403    if (! loaded)
3404    {
3405       if (! objmacroAsnLoad()) {
3406          return NULL;
3407       }
3408    }
3409 
3410    if (aip == NULL) {
3411       return NULL;
3412    }
3413 
3414    if (orig == NULL) {         /* RnaQualPair ::= (self contained) */
3415       atp = AsnReadId(aip, amp, RNA_QUAL_PAIR);
3416    } else {
3417       atp = AsnLinkType(orig, RNA_QUAL_PAIR);
3418    }
3419    /* link in local tree */
3420    if (atp == NULL) {
3421       return NULL;
3422    }
3423 
3424    ptr = RnaQualPairNew();
3425    if (ptr == NULL) {
3426       goto erret;
3427    }
3428    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3429       goto erret;
3430    }
3431 
3432    atp = AsnReadId(aip,amp, atp);
3433    func = NULL;
3434 
3435    if (atp == RNA_QUAL_PAIR_type) {
3436       ptr -> type = RnaFeatTypeAsnRead(aip, atp);
3437       if (aip -> io_failure) {
3438          goto erret;
3439       }
3440       atp = AsnReadId(aip,amp, atp);
3441    }
3442    if (atp == RNA_QUAL_PAIR_field_from) {
3443       if ( AsnReadVal(aip, atp, &av) <= 0) {
3444          goto erret;
3445       }
3446       ptr -> field_from = av.intvalue;
3447       atp = AsnReadId(aip,amp, atp);
3448    }
3449    if (atp == RNA_QUAL_PAIR_field_to) {
3450       if ( AsnReadVal(aip, atp, &av) <= 0) {
3451          goto erret;
3452       }
3453       ptr -> field_to = av.intvalue;
3454       atp = AsnReadId(aip,amp, atp);
3455    }
3456 
3457    if (AsnReadVal(aip, atp, &av) <= 0) {
3458       goto erret;
3459    }
3460    /* end struct */
3461 
3462 ret:
3463    AsnUnlinkType(orig);       /* unlink local tree */
3464    return ptr;
3465 
3466 erret:
3467    aip -> io_failure = TRUE;
3468    ptr = RnaQualPairFree(ptr);
3469    goto ret;
3470 }
3471 
3472 
3473 
3474 /**************************************************
3475 *
3476 *    RnaQualPairAsnWrite()
3477 *
3478 **************************************************/
3479 NLM_EXTERN Boolean LIBCALL
RnaQualPairAsnWrite(RnaQualPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3480 RnaQualPairAsnWrite(RnaQualPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3481 {
3482    DataVal av;
3483    AsnTypePtr atp;
3484    Boolean retval = FALSE;
3485 
3486    if (! loaded)
3487    {
3488       if (! objmacroAsnLoad()) {
3489          return FALSE;
3490       }
3491    }
3492 
3493    if (aip == NULL) {
3494       return FALSE;
3495    }
3496 
3497    atp = AsnLinkType(orig, RNA_QUAL_PAIR);   /* link local tree */
3498    if (atp == NULL) {
3499       return FALSE;
3500    }
3501 
3502    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3503 
3504     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3505 
3506    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3507       goto erret;
3508    }
3509 
3510    if (ptr -> type != NULL) {
3511       if ( ! RnaFeatTypeAsnWrite(ptr -> type, aip, RNA_QUAL_PAIR_type)) {
3512          goto erret;
3513       }
3514    }
3515    av.intvalue = ptr -> field_from;
3516    retval = AsnWrite(aip, RNA_QUAL_PAIR_field_from,  &av);
3517    av.intvalue = ptr -> field_to;
3518    retval = AsnWrite(aip, RNA_QUAL_PAIR_field_to,  &av);
3519    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3520       goto erret;
3521    }
3522    retval = TRUE;
3523 
3524 erret:
3525    AsnUnlinkType(orig);       /* unlink local tree */
3526    return retval;
3527 }
3528 
3529 
3530 
3531 /**************************************************
3532 *
3533 *    SourceQualPairNew()
3534 *
3535 **************************************************/
3536 NLM_EXTERN
3537 SourceQualPairPtr LIBCALL
SourceQualPairNew(void)3538 SourceQualPairNew(void)
3539 {
3540    SourceQualPairPtr ptr = MemNew((size_t) sizeof(SourceQualPair));
3541 
3542    return ptr;
3543 
3544 }
3545 
3546 
3547 /**************************************************
3548 *
3549 *    SourceQualPairFree()
3550 *
3551 **************************************************/
3552 NLM_EXTERN
3553 SourceQualPairPtr LIBCALL
SourceQualPairFree(SourceQualPairPtr ptr)3554 SourceQualPairFree(SourceQualPairPtr ptr)
3555 {
3556 
3557    if(ptr == NULL) {
3558       return NULL;
3559    }
3560    return MemFree(ptr);
3561 }
3562 
3563 
3564 /**************************************************
3565 *
3566 *    SourceQualPairAsnRead()
3567 *
3568 **************************************************/
3569 NLM_EXTERN
3570 SourceQualPairPtr LIBCALL
SourceQualPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)3571 SourceQualPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3572 {
3573    DataVal av;
3574    AsnTypePtr atp;
3575    Boolean isError = FALSE;
3576    AsnReadFunc func;
3577    SourceQualPairPtr ptr;
3578 
3579    if (! loaded)
3580    {
3581       if (! objmacroAsnLoad()) {
3582          return NULL;
3583       }
3584    }
3585 
3586    if (aip == NULL) {
3587       return NULL;
3588    }
3589 
3590    if (orig == NULL) {         /* SourceQualPair ::= (self contained) */
3591       atp = AsnReadId(aip, amp, SOURCE_QUAL_PAIR);
3592    } else {
3593       atp = AsnLinkType(orig, SOURCE_QUAL_PAIR);
3594    }
3595    /* link in local tree */
3596    if (atp == NULL) {
3597       return NULL;
3598    }
3599 
3600    ptr = SourceQualPairNew();
3601    if (ptr == NULL) {
3602       goto erret;
3603    }
3604    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3605       goto erret;
3606    }
3607 
3608    atp = AsnReadId(aip,amp, atp);
3609    func = NULL;
3610 
3611    if (atp == SOURCE_QUAL_PAIR_field_from) {
3612       if ( AsnReadVal(aip, atp, &av) <= 0) {
3613          goto erret;
3614       }
3615       ptr -> field_from = av.intvalue;
3616       atp = AsnReadId(aip,amp, atp);
3617    }
3618    if (atp == SOURCE_QUAL_PAIR_field_to) {
3619       if ( AsnReadVal(aip, atp, &av) <= 0) {
3620          goto erret;
3621       }
3622       ptr -> field_to = av.intvalue;
3623       atp = AsnReadId(aip,amp, atp);
3624    }
3625 
3626    if (AsnReadVal(aip, atp, &av) <= 0) {
3627       goto erret;
3628    }
3629    /* end struct */
3630 
3631 ret:
3632    AsnUnlinkType(orig);       /* unlink local tree */
3633    return ptr;
3634 
3635 erret:
3636    aip -> io_failure = TRUE;
3637    ptr = SourceQualPairFree(ptr);
3638    goto ret;
3639 }
3640 
3641 
3642 
3643 /**************************************************
3644 *
3645 *    SourceQualPairAsnWrite()
3646 *
3647 **************************************************/
3648 NLM_EXTERN Boolean LIBCALL
SourceQualPairAsnWrite(SourceQualPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3649 SourceQualPairAsnWrite(SourceQualPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3650 {
3651    DataVal av;
3652    AsnTypePtr atp;
3653    Boolean retval = FALSE;
3654 
3655    if (! loaded)
3656    {
3657       if (! objmacroAsnLoad()) {
3658          return FALSE;
3659       }
3660    }
3661 
3662    if (aip == NULL) {
3663       return FALSE;
3664    }
3665 
3666    atp = AsnLinkType(orig, SOURCE_QUAL_PAIR);   /* link local tree */
3667    if (atp == NULL) {
3668       return FALSE;
3669    }
3670 
3671    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3672 
3673     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3674 
3675    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3676       goto erret;
3677    }
3678 
3679    av.intvalue = ptr -> field_from;
3680    retval = AsnWrite(aip, SOURCE_QUAL_PAIR_field_from,  &av);
3681    av.intvalue = ptr -> field_to;
3682    retval = AsnWrite(aip, SOURCE_QUAL_PAIR_field_to,  &av);
3683    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3684       goto erret;
3685    }
3686    retval = TRUE;
3687 
3688 erret:
3689    AsnUnlinkType(orig);       /* unlink local tree */
3690    return retval;
3691 }
3692 
3693 
3694 
3695 /**************************************************
3696 *
3697 *    SourceQualChoiceFree()
3698 *
3699 **************************************************/
3700 NLM_EXTERN
3701 SourceQualChoicePtr LIBCALL
SourceQualChoiceFree(ValNodePtr anp)3702 SourceQualChoiceFree(ValNodePtr anp)
3703 {
3704    Pointer pnt;
3705 
3706    if (anp == NULL) {
3707       return NULL;
3708    }
3709 
3710    pnt = anp->data.ptrvalue;
3711    switch (anp->choice)
3712    {
3713    default:
3714       break;
3715    }
3716    return MemFree(anp);
3717 }
3718 
3719 
3720 /**************************************************
3721 *
3722 *    SourceQualChoiceAsnRead()
3723 *
3724 **************************************************/
3725 NLM_EXTERN
3726 SourceQualChoicePtr LIBCALL
SourceQualChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)3727 SourceQualChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3728 {
3729    DataVal av;
3730    AsnTypePtr atp;
3731    ValNodePtr anp;
3732    Uint1 choice;
3733    Boolean isError = FALSE;
3734    Boolean nullIsError = FALSE;
3735    AsnReadFunc func;
3736 
3737    if (! loaded)
3738    {
3739       if (! objmacroAsnLoad()) {
3740          return NULL;
3741       }
3742    }
3743 
3744    if (aip == NULL) {
3745       return NULL;
3746    }
3747 
3748    if (orig == NULL) {         /* SourceQualChoice ::= (self contained) */
3749       atp = AsnReadId(aip, amp, SOURCE_QUAL_CHOICE);
3750    } else {
3751       atp = AsnLinkType(orig, SOURCE_QUAL_CHOICE);    /* link in local tree */
3752    }
3753    if (atp == NULL) {
3754       return NULL;
3755    }
3756 
3757    anp = ValNodeNew(NULL);
3758    if (anp == NULL) {
3759       goto erret;
3760    }
3761    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
3762       goto erret;
3763    }
3764 
3765    func = NULL;
3766 
3767    atp = AsnReadId(aip, amp, atp);  /* find the choice */
3768    if (atp == NULL) {
3769       goto erret;
3770    }
3771    if (atp == SOURCE_QUAL_CHOICE_textqual) {
3772       choice = SourceQualChoice_textqual;
3773       if (AsnReadVal(aip, atp, &av) <= 0) {
3774          goto erret;
3775       }
3776       anp->data.intvalue = av.intvalue;
3777    }
3778    else if (atp == SOURCE_QUAL_CHOICE_location) {
3779       choice = SourceQualChoice_location;
3780       if (AsnReadVal(aip, atp, &av) <= 0) {
3781          goto erret;
3782       }
3783       anp->data.intvalue = av.intvalue;
3784    }
3785    else if (atp == SOURCE_QUAL_CHOICE_origin) {
3786       choice = SourceQualChoice_origin;
3787       if (AsnReadVal(aip, atp, &av) <= 0) {
3788          goto erret;
3789       }
3790       anp->data.intvalue = av.intvalue;
3791    }
3792    else if (atp == SOURCE_QUAL_CHOICE_gcode) {
3793       choice = SourceQualChoice_gcode;
3794       if (AsnReadVal(aip, atp, &av) <= 0) {
3795          goto erret;
3796       }
3797       anp->data.intvalue = av.intvalue;
3798    }
3799    else if (atp == SOURCE_QUAL_CHOICE_mgcode) {
3800       choice = SourceQualChoice_mgcode;
3801       if (AsnReadVal(aip, atp, &av) <= 0) {
3802          goto erret;
3803       }
3804       anp->data.intvalue = av.intvalue;
3805    }
3806    anp->choice = choice;
3807    if (func != NULL)
3808    {
3809       anp->data.ptrvalue = (* func)(aip, atp);
3810       if (aip -> io_failure) goto erret;
3811 
3812       if (nullIsError && anp->data.ptrvalue == NULL) {
3813          goto erret;
3814       }
3815    }
3816 
3817 ret:
3818    AsnUnlinkType(orig);       /* unlink local tree */
3819    return anp;
3820 
3821 erret:
3822    anp = MemFree(anp);
3823    aip -> io_failure = TRUE;
3824    goto ret;
3825 }
3826 
3827 
3828 /**************************************************
3829 *
3830 *    SourceQualChoiceAsnWrite()
3831 *
3832 **************************************************/
3833 NLM_EXTERN Boolean LIBCALL
SourceQualChoiceAsnWrite(SourceQualChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)3834 SourceQualChoiceAsnWrite(SourceQualChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
3835 
3836 {
3837    DataVal av;
3838    AsnTypePtr atp, writetype = NULL;
3839    Pointer pnt;
3840    AsnWriteFunc func = NULL;
3841    Boolean retval = FALSE;
3842 
3843    if (! loaded)
3844    {
3845       if (! objmacroAsnLoad())
3846       return FALSE;
3847    }
3848 
3849    if (aip == NULL)
3850    return FALSE;
3851 
3852    atp = AsnLinkType(orig, SOURCE_QUAL_CHOICE);   /* link local tree */
3853    if (atp == NULL) {
3854       return FALSE;
3855    }
3856 
3857    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3858 
3859     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3860 
3861    av.ptrvalue = (Pointer)anp;
3862    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
3863       goto erret;
3864    }
3865 
3866    pnt = anp->data.ptrvalue;
3867    switch (anp->choice)
3868    {
3869    case SourceQualChoice_textqual:
3870       av.intvalue = anp->data.intvalue;
3871       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_textqual, &av);
3872       break;
3873    case SourceQualChoice_location:
3874       av.intvalue = anp->data.intvalue;
3875       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_location, &av);
3876       break;
3877    case SourceQualChoice_origin:
3878       av.intvalue = anp->data.intvalue;
3879       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_origin, &av);
3880       break;
3881    case SourceQualChoice_gcode:
3882       av.intvalue = anp->data.intvalue;
3883       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_gcode, &av);
3884       break;
3885    case SourceQualChoice_mgcode:
3886       av.intvalue = anp->data.intvalue;
3887       retval = AsnWrite(aip, SOURCE_QUAL_CHOICE_mgcode, &av);
3888       break;
3889    }
3890    if (writetype != NULL) {
3891       retval = (* func)(pnt, aip, writetype);   /* write it out */
3892    }
3893    if (!retval) {
3894       goto erret;
3895    }
3896    retval = TRUE;
3897 
3898 erret:
3899    AsnUnlinkType(orig);       /* unlink local tree */
3900    return retval;
3901 }
3902 
3903 
3904 /**************************************************
3905 *
3906 *    SourceQualTextValNew()
3907 *
3908 **************************************************/
3909 NLM_EXTERN
3910 SourceQualTextValPtr LIBCALL
SourceQualTextValNew(void)3911 SourceQualTextValNew(void)
3912 {
3913    SourceQualTextValPtr ptr = MemNew((size_t) sizeof(SourceQualTextVal));
3914 
3915    return ptr;
3916 
3917 }
3918 
3919 
3920 /**************************************************
3921 *
3922 *    SourceQualTextValFree()
3923 *
3924 **************************************************/
3925 NLM_EXTERN
3926 SourceQualTextValPtr LIBCALL
SourceQualTextValFree(SourceQualTextValPtr ptr)3927 SourceQualTextValFree(SourceQualTextValPtr ptr)
3928 {
3929 
3930    if(ptr == NULL) {
3931       return NULL;
3932    }
3933    MemFree(ptr -> val);
3934    return MemFree(ptr);
3935 }
3936 
3937 
3938 /**************************************************
3939 *
3940 *    SourceQualTextValAsnRead()
3941 *
3942 **************************************************/
3943 NLM_EXTERN
3944 SourceQualTextValPtr LIBCALL
SourceQualTextValAsnRead(AsnIoPtr aip,AsnTypePtr orig)3945 SourceQualTextValAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3946 {
3947    DataVal av;
3948    AsnTypePtr atp;
3949    Boolean isError = FALSE;
3950    AsnReadFunc func;
3951    SourceQualTextValPtr ptr;
3952 
3953    if (! loaded)
3954    {
3955       if (! objmacroAsnLoad()) {
3956          return NULL;
3957       }
3958    }
3959 
3960    if (aip == NULL) {
3961       return NULL;
3962    }
3963 
3964    if (orig == NULL) {         /* SourceQualTextVal ::= (self contained) */
3965       atp = AsnReadId(aip, amp, SOURCE_QUAL_TEXT_VAL);
3966    } else {
3967       atp = AsnLinkType(orig, SOURCE_QUAL_TEXT_VAL);
3968    }
3969    /* link in local tree */
3970    if (atp == NULL) {
3971       return NULL;
3972    }
3973 
3974    ptr = SourceQualTextValNew();
3975    if (ptr == NULL) {
3976       goto erret;
3977    }
3978    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3979       goto erret;
3980    }
3981 
3982    atp = AsnReadId(aip,amp, atp);
3983    func = NULL;
3984 
3985    if (atp == SOURCE_QUAL_TEXT_VAL_srcqual) {
3986       if ( AsnReadVal(aip, atp, &av) <= 0) {
3987          goto erret;
3988       }
3989       ptr -> srcqual = av.intvalue;
3990       atp = AsnReadId(aip,amp, atp);
3991    }
3992    if (atp == SOURCE_QUAL_TEXT_VAL_val) {
3993       if ( AsnReadVal(aip, atp, &av) <= 0) {
3994          goto erret;
3995       }
3996       ptr -> val = av.ptrvalue;
3997       atp = AsnReadId(aip,amp, atp);
3998    }
3999 
4000    if (AsnReadVal(aip, atp, &av) <= 0) {
4001       goto erret;
4002    }
4003    /* end struct */
4004 
4005 ret:
4006    AsnUnlinkType(orig);       /* unlink local tree */
4007    return ptr;
4008 
4009 erret:
4010    aip -> io_failure = TRUE;
4011    ptr = SourceQualTextValFree(ptr);
4012    goto ret;
4013 }
4014 
4015 
4016 
4017 /**************************************************
4018 *
4019 *    SourceQualTextValAsnWrite()
4020 *
4021 **************************************************/
4022 NLM_EXTERN Boolean LIBCALL
SourceQualTextValAsnWrite(SourceQualTextValPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4023 SourceQualTextValAsnWrite(SourceQualTextValPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4024 {
4025    DataVal av;
4026    AsnTypePtr atp;
4027    Boolean retval = FALSE;
4028 
4029    if (! loaded)
4030    {
4031       if (! objmacroAsnLoad()) {
4032          return FALSE;
4033       }
4034    }
4035 
4036    if (aip == NULL) {
4037       return FALSE;
4038    }
4039 
4040    atp = AsnLinkType(orig, SOURCE_QUAL_TEXT_VAL);   /* link local tree */
4041    if (atp == NULL) {
4042       return FALSE;
4043    }
4044 
4045    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4046 
4047     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4048 
4049    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4050       goto erret;
4051    }
4052 
4053    av.intvalue = ptr -> srcqual;
4054    retval = AsnWrite(aip, SOURCE_QUAL_TEXT_VAL_srcqual,  &av);
4055    if (ptr -> val != NULL) {
4056       av.ptrvalue = ptr -> val;
4057       retval = AsnWrite(aip, SOURCE_QUAL_TEXT_VAL_val,  &av);
4058    }
4059    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4060       goto erret;
4061    }
4062    retval = TRUE;
4063 
4064 erret:
4065    AsnUnlinkType(orig);       /* unlink local tree */
4066    return retval;
4067 }
4068 
4069 
4070 
4071 /**************************************************
4072 *
4073 *    SourceQualValChoiceFree()
4074 *
4075 **************************************************/
4076 NLM_EXTERN
4077 SourceQualValChoicePtr LIBCALL
SourceQualValChoiceFree(ValNodePtr anp)4078 SourceQualValChoiceFree(ValNodePtr anp)
4079 {
4080    Pointer pnt;
4081 
4082    if (anp == NULL) {
4083       return NULL;
4084    }
4085 
4086    pnt = anp->data.ptrvalue;
4087    switch (anp->choice)
4088    {
4089    default:
4090       break;
4091    case SourceQualValChoice_textqual:
4092       SourceQualTextValFree(anp -> data.ptrvalue);
4093       break;
4094    }
4095    return MemFree(anp);
4096 }
4097 
4098 
4099 /**************************************************
4100 *
4101 *    SourceQualValChoiceAsnRead()
4102 *
4103 **************************************************/
4104 NLM_EXTERN
4105 SourceQualValChoicePtr LIBCALL
SourceQualValChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)4106 SourceQualValChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4107 {
4108    DataVal av;
4109    AsnTypePtr atp;
4110    ValNodePtr anp;
4111    Uint1 choice;
4112    Boolean isError = FALSE;
4113    Boolean nullIsError = FALSE;
4114    AsnReadFunc func;
4115 
4116    if (! loaded)
4117    {
4118       if (! objmacroAsnLoad()) {
4119          return NULL;
4120       }
4121    }
4122 
4123    if (aip == NULL) {
4124       return NULL;
4125    }
4126 
4127    if (orig == NULL) {         /* SourceQualValChoice ::= (self contained) */
4128       atp = AsnReadId(aip, amp, SOURCE_QUAL_VAL_CHOICE);
4129    } else {
4130       atp = AsnLinkType(orig, SOURCE_QUAL_VAL_CHOICE);    /* link in local tree */
4131    }
4132    if (atp == NULL) {
4133       return NULL;
4134    }
4135 
4136    anp = ValNodeNew(NULL);
4137    if (anp == NULL) {
4138       goto erret;
4139    }
4140    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
4141       goto erret;
4142    }
4143 
4144    func = NULL;
4145 
4146    atp = AsnReadId(aip, amp, atp);  /* find the choice */
4147    if (atp == NULL) {
4148       goto erret;
4149    }
4150    if (atp == SOURCE_QUAL_VAL_CHOICE_textqual) {
4151       choice = SourceQualValChoice_textqual;
4152       func = (AsnReadFunc) SourceQualTextValAsnRead;
4153    }
4154    else if (atp == SOURCE_QUAL_VAL_CHOICE_location) {
4155       choice = SourceQualValChoice_location;
4156       if (AsnReadVal(aip, atp, &av) <= 0) {
4157          goto erret;
4158       }
4159       anp->data.intvalue = av.intvalue;
4160    }
4161    else if (atp == SOURCE_QUAL_VAL_CHOICE_origin) {
4162       choice = SourceQualValChoice_origin;
4163       if (AsnReadVal(aip, atp, &av) <= 0) {
4164          goto erret;
4165       }
4166       anp->data.intvalue = av.intvalue;
4167    }
4168    else if (atp == SOURCE_QUAL_VAL_CHOICE_gcode) {
4169       choice = SourceQualValChoice_gcode;
4170       if (AsnReadVal(aip, atp, &av) <= 0) {
4171          goto erret;
4172       }
4173       anp->data.intvalue = av.intvalue;
4174    }
4175    else if (atp == SOURCE_QUAL_VAL_CHOICE_mgcode) {
4176       choice = SourceQualValChoice_mgcode;
4177       if (AsnReadVal(aip, atp, &av) <= 0) {
4178          goto erret;
4179       }
4180       anp->data.intvalue = av.intvalue;
4181    }
4182    anp->choice = choice;
4183    if (func != NULL)
4184    {
4185       anp->data.ptrvalue = (* func)(aip, atp);
4186       if (aip -> io_failure) goto erret;
4187 
4188       if (nullIsError && anp->data.ptrvalue == NULL) {
4189          goto erret;
4190       }
4191    }
4192 
4193 ret:
4194    AsnUnlinkType(orig);       /* unlink local tree */
4195    return anp;
4196 
4197 erret:
4198    anp = MemFree(anp);
4199    aip -> io_failure = TRUE;
4200    goto ret;
4201 }
4202 
4203 
4204 /**************************************************
4205 *
4206 *    SourceQualValChoiceAsnWrite()
4207 *
4208 **************************************************/
4209 NLM_EXTERN Boolean LIBCALL
SourceQualValChoiceAsnWrite(SourceQualValChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)4210 SourceQualValChoiceAsnWrite(SourceQualValChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
4211 
4212 {
4213    DataVal av;
4214    AsnTypePtr atp, writetype = NULL;
4215    Pointer pnt;
4216    AsnWriteFunc func = NULL;
4217    Boolean retval = FALSE;
4218 
4219    if (! loaded)
4220    {
4221       if (! objmacroAsnLoad())
4222       return FALSE;
4223    }
4224 
4225    if (aip == NULL)
4226    return FALSE;
4227 
4228    atp = AsnLinkType(orig, SOURCE_QUAL_VAL_CHOICE);   /* link local tree */
4229    if (atp == NULL) {
4230       return FALSE;
4231    }
4232 
4233    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4234 
4235     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4236 
4237    av.ptrvalue = (Pointer)anp;
4238    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
4239       goto erret;
4240    }
4241 
4242    pnt = anp->data.ptrvalue;
4243    switch (anp->choice)
4244    {
4245    case SourceQualValChoice_textqual:
4246       writetype = SOURCE_QUAL_VAL_CHOICE_textqual;
4247       func = (AsnWriteFunc) SourceQualTextValAsnWrite;
4248       break;
4249    case SourceQualValChoice_location:
4250       av.intvalue = anp->data.intvalue;
4251       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_location, &av);
4252       break;
4253    case SourceQualValChoice_origin:
4254       av.intvalue = anp->data.intvalue;
4255       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_origin, &av);
4256       break;
4257    case SourceQualValChoice_gcode:
4258       av.intvalue = anp->data.intvalue;
4259       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_gcode, &av);
4260       break;
4261    case SourceQualValChoice_mgcode:
4262       av.intvalue = anp->data.intvalue;
4263       retval = AsnWrite(aip, SOURCE_QUAL_VAL_CHOICE_mgcode, &av);
4264       break;
4265    }
4266    if (writetype != NULL) {
4267       retval = (* func)(pnt, aip, writetype);   /* write it out */
4268    }
4269    if (!retval) {
4270       goto erret;
4271    }
4272    retval = TRUE;
4273 
4274 erret:
4275    AsnUnlinkType(orig);       /* unlink local tree */
4276    return retval;
4277 }
4278 
4279 
4280 /**************************************************
4281 *
4282 *    SourceQualValSetFree()
4283 *
4284 **************************************************/
4285 NLM_EXTERN
4286 SourceQualValSetPtr LIBCALL
SourceQualValSetFree(SourceQualValSetPtr ptr)4287 SourceQualValSetFree(SourceQualValSetPtr ptr)
4288 {
4289 
4290    if(ptr == NULL) {
4291       return NULL;
4292    }
4293    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) SourceQualValChoiceFree);
4294    return NULL;
4295 }
4296 
4297 
4298 /**************************************************
4299 *
4300 *    SourceQualValSetAsnRead()
4301 *
4302 **************************************************/
4303 NLM_EXTERN
4304 SourceQualValSetPtr LIBCALL
SourceQualValSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)4305 SourceQualValSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4306 {
4307    DataVal av;
4308    AsnTypePtr atp;
4309    Boolean isError = FALSE;
4310    AsnReadFunc func;
4311    SourceQualValSetPtr ptr;
4312 
4313    if (! loaded)
4314    {
4315       if (! objmacroAsnLoad()) {
4316          return NULL;
4317       }
4318    }
4319 
4320    if (aip == NULL) {
4321       return NULL;
4322    }
4323 
4324    if (orig == NULL) {         /* SourceQualValSet ::= (self contained) */
4325       atp = AsnReadId(aip, amp, SOURCE_QUAL_VAL_SET);
4326    } else {
4327       atp = AsnLinkType(orig, SOURCE_QUAL_VAL_SET);
4328    }
4329    /* link in local tree */
4330    if (atp == NULL) {
4331       return NULL;
4332    }
4333 
4334    func = NULL;
4335 
4336    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SourceQualValChoiceAsnRead, (AsnOptFreeFunc) SourceQualValChoiceFree);
4337    if (isError && ptr  == NULL) {
4338       goto erret;
4339    }
4340 
4341 
4342 
4343 ret:
4344    AsnUnlinkType(orig);       /* unlink local tree */
4345    return ptr;
4346 
4347 erret:
4348    aip -> io_failure = TRUE;
4349    ptr = SourceQualValSetFree(ptr);
4350    goto ret;
4351 }
4352 
4353 
4354 
4355 /**************************************************
4356 *
4357 *    SourceQualValSetAsnWrite()
4358 *
4359 **************************************************/
4360 NLM_EXTERN Boolean LIBCALL
SourceQualValSetAsnWrite(SourceQualValSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4361 SourceQualValSetAsnWrite(SourceQualValSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4362 {
4363    DataVal av;
4364    AsnTypePtr atp;
4365    Boolean retval = FALSE;
4366 
4367    if (! loaded)
4368    {
4369       if (! objmacroAsnLoad()) {
4370          return FALSE;
4371       }
4372    }
4373 
4374    if (aip == NULL) {
4375       return FALSE;
4376    }
4377 
4378    atp = AsnLinkType(orig, SOURCE_QUAL_VAL_SET);   /* link local tree */
4379    if (atp == NULL) {
4380       return FALSE;
4381    }
4382 
4383    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4384 
4385     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4386 
4387    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) SourceQualValChoiceAsnWrite, aip, atp, SOURCE_QUAL_VAL_SET_E);
4388    retval = TRUE;
4389 
4390 erret:
4391    AsnUnlinkType(orig);       /* unlink local tree */
4392    return retval;
4393 }
4394 
4395 
4396 
4397 /**************************************************
4398 *
4399 *    CDSGeneProtFieldPairNew()
4400 *
4401 **************************************************/
4402 NLM_EXTERN
4403 CDSGeneProtFieldPairPtr LIBCALL
CDSGeneProtFieldPairNew(void)4404 CDSGeneProtFieldPairNew(void)
4405 {
4406    CDSGeneProtFieldPairPtr ptr = MemNew((size_t) sizeof(CDSGeneProtFieldPair));
4407 
4408    return ptr;
4409 
4410 }
4411 
4412 
4413 /**************************************************
4414 *
4415 *    CDSGeneProtFieldPairFree()
4416 *
4417 **************************************************/
4418 NLM_EXTERN
4419 CDSGeneProtFieldPairPtr LIBCALL
CDSGeneProtFieldPairFree(CDSGeneProtFieldPairPtr ptr)4420 CDSGeneProtFieldPairFree(CDSGeneProtFieldPairPtr ptr)
4421 {
4422 
4423    if(ptr == NULL) {
4424       return NULL;
4425    }
4426    return MemFree(ptr);
4427 }
4428 
4429 
4430 /**************************************************
4431 *
4432 *    CDSGeneProtFieldPairAsnRead()
4433 *
4434 **************************************************/
4435 NLM_EXTERN
4436 CDSGeneProtFieldPairPtr LIBCALL
CDSGeneProtFieldPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)4437 CDSGeneProtFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4438 {
4439    DataVal av;
4440    AsnTypePtr atp;
4441    Boolean isError = FALSE;
4442    AsnReadFunc func;
4443    CDSGeneProtFieldPairPtr ptr;
4444 
4445    if (! loaded)
4446    {
4447       if (! objmacroAsnLoad()) {
4448          return NULL;
4449       }
4450    }
4451 
4452    if (aip == NULL) {
4453       return NULL;
4454    }
4455 
4456    if (orig == NULL) {         /* CDSGeneProtFieldPair ::= (self contained) */
4457       atp = AsnReadId(aip, amp, CDSGENEPROT_FIELD_PAIR);
4458    } else {
4459       atp = AsnLinkType(orig, CDSGENEPROT_FIELD_PAIR);
4460    }
4461    /* link in local tree */
4462    if (atp == NULL) {
4463       return NULL;
4464    }
4465 
4466    ptr = CDSGeneProtFieldPairNew();
4467    if (ptr == NULL) {
4468       goto erret;
4469    }
4470    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4471       goto erret;
4472    }
4473 
4474    atp = AsnReadId(aip,amp, atp);
4475    func = NULL;
4476 
4477    if (atp == CDSGENEPROT_FIELD_PAIR_field_from) {
4478       if ( AsnReadVal(aip, atp, &av) <= 0) {
4479          goto erret;
4480       }
4481       ptr -> field_from = av.intvalue;
4482       atp = AsnReadId(aip,amp, atp);
4483    }
4484    if (atp == CDSGENEPROT_FIELD_PAIR_field_to) {
4485       if ( AsnReadVal(aip, atp, &av) <= 0) {
4486          goto erret;
4487       }
4488       ptr -> field_to = av.intvalue;
4489       atp = AsnReadId(aip,amp, atp);
4490    }
4491 
4492    if (AsnReadVal(aip, atp, &av) <= 0) {
4493       goto erret;
4494    }
4495    /* end struct */
4496 
4497 ret:
4498    AsnUnlinkType(orig);       /* unlink local tree */
4499    return ptr;
4500 
4501 erret:
4502    aip -> io_failure = TRUE;
4503    ptr = CDSGeneProtFieldPairFree(ptr);
4504    goto ret;
4505 }
4506 
4507 
4508 
4509 /**************************************************
4510 *
4511 *    CDSGeneProtFieldPairAsnWrite()
4512 *
4513 **************************************************/
4514 NLM_EXTERN Boolean LIBCALL
CDSGeneProtFieldPairAsnWrite(CDSGeneProtFieldPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4515 CDSGeneProtFieldPairAsnWrite(CDSGeneProtFieldPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4516 {
4517    DataVal av;
4518    AsnTypePtr atp;
4519    Boolean retval = FALSE;
4520 
4521    if (! loaded)
4522    {
4523       if (! objmacroAsnLoad()) {
4524          return FALSE;
4525       }
4526    }
4527 
4528    if (aip == NULL) {
4529       return FALSE;
4530    }
4531 
4532    atp = AsnLinkType(orig, CDSGENEPROT_FIELD_PAIR);   /* link local tree */
4533    if (atp == NULL) {
4534       return FALSE;
4535    }
4536 
4537    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4538 
4539     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4540 
4541    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4542       goto erret;
4543    }
4544 
4545    av.intvalue = ptr -> field_from;
4546    retval = AsnWrite(aip, CDSGENEPROT_FIELD_PAIR_field_from,  &av);
4547    av.intvalue = ptr -> field_to;
4548    retval = AsnWrite(aip, CDSGENEPROT_FIELD_PAIR_field_to,  &av);
4549    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4550       goto erret;
4551    }
4552    retval = TRUE;
4553 
4554 erret:
4555    AsnUnlinkType(orig);       /* unlink local tree */
4556    return retval;
4557 }
4558 
4559 
4560 
4561 /**************************************************
4562 *
4563 *    MolinfoFieldFree()
4564 *
4565 **************************************************/
4566 NLM_EXTERN
4567 MolinfoFieldPtr LIBCALL
MolinfoFieldFree(ValNodePtr anp)4568 MolinfoFieldFree(ValNodePtr anp)
4569 {
4570    Pointer pnt;
4571 
4572    if (anp == NULL) {
4573       return NULL;
4574    }
4575 
4576    pnt = anp->data.ptrvalue;
4577    switch (anp->choice)
4578    {
4579    default:
4580       break;
4581    }
4582    return MemFree(anp);
4583 }
4584 
4585 
4586 /**************************************************
4587 *
4588 *    MolinfoFieldAsnRead()
4589 *
4590 **************************************************/
4591 NLM_EXTERN
4592 MolinfoFieldPtr LIBCALL
MolinfoFieldAsnRead(AsnIoPtr aip,AsnTypePtr orig)4593 MolinfoFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4594 {
4595    DataVal av;
4596    AsnTypePtr atp;
4597    ValNodePtr anp;
4598    Uint1 choice;
4599    Boolean isError = FALSE;
4600    Boolean nullIsError = FALSE;
4601    AsnReadFunc func;
4602 
4603    if (! loaded)
4604    {
4605       if (! objmacroAsnLoad()) {
4606          return NULL;
4607       }
4608    }
4609 
4610    if (aip == NULL) {
4611       return NULL;
4612    }
4613 
4614    if (orig == NULL) {         /* MolinfoField ::= (self contained) */
4615       atp = AsnReadId(aip, amp, MOLINFO_FIELD);
4616    } else {
4617       atp = AsnLinkType(orig, MOLINFO_FIELD);    /* link in local tree */
4618    }
4619    if (atp == NULL) {
4620       return NULL;
4621    }
4622 
4623    anp = ValNodeNew(NULL);
4624    if (anp == NULL) {
4625       goto erret;
4626    }
4627    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
4628       goto erret;
4629    }
4630 
4631    func = NULL;
4632 
4633    atp = AsnReadId(aip, amp, atp);  /* find the choice */
4634    if (atp == NULL) {
4635       goto erret;
4636    }
4637    if (atp == MOLINFO_FIELD_molecule) {
4638       choice = MolinfoField_molecule;
4639       if (AsnReadVal(aip, atp, &av) <= 0) {
4640          goto erret;
4641       }
4642       anp->data.intvalue = av.intvalue;
4643    }
4644    else if (atp == MOLINFO_FIELD_technique) {
4645       choice = MolinfoField_technique;
4646       if (AsnReadVal(aip, atp, &av) <= 0) {
4647          goto erret;
4648       }
4649       anp->data.intvalue = av.intvalue;
4650    }
4651    else if (atp == MOLINFO_FIELD_completedness) {
4652       choice = MolinfoField_completedness;
4653       if (AsnReadVal(aip, atp, &av) <= 0) {
4654          goto erret;
4655       }
4656       anp->data.intvalue = av.intvalue;
4657    }
4658    else if (atp == MOLINFO_FIELD_mol_class) {
4659       choice = MolinfoField_mol_class;
4660       if (AsnReadVal(aip, atp, &av) <= 0) {
4661          goto erret;
4662       }
4663       anp->data.intvalue = av.intvalue;
4664    }
4665    else if (atp == MOLINFO_FIELD_topology) {
4666       choice = MolinfoField_topology;
4667       if (AsnReadVal(aip, atp, &av) <= 0) {
4668          goto erret;
4669       }
4670       anp->data.intvalue = av.intvalue;
4671    }
4672    else if (atp == MOLINFO_FIELD_strand) {
4673       choice = MolinfoField_strand;
4674       if (AsnReadVal(aip, atp, &av) <= 0) {
4675          goto erret;
4676       }
4677       anp->data.intvalue = av.intvalue;
4678    }
4679    anp->choice = choice;
4680    if (func != NULL)
4681    {
4682       anp->data.ptrvalue = (* func)(aip, atp);
4683       if (aip -> io_failure) goto erret;
4684 
4685       if (nullIsError && anp->data.ptrvalue == NULL) {
4686          goto erret;
4687       }
4688    }
4689 
4690 ret:
4691    AsnUnlinkType(orig);       /* unlink local tree */
4692    return anp;
4693 
4694 erret:
4695    anp = MemFree(anp);
4696    aip -> io_failure = TRUE;
4697    goto ret;
4698 }
4699 
4700 
4701 /**************************************************
4702 *
4703 *    MolinfoFieldAsnWrite()
4704 *
4705 **************************************************/
4706 NLM_EXTERN Boolean LIBCALL
MolinfoFieldAsnWrite(MolinfoFieldPtr anp,AsnIoPtr aip,AsnTypePtr orig)4707 MolinfoFieldAsnWrite(MolinfoFieldPtr anp, AsnIoPtr aip, AsnTypePtr orig)
4708 
4709 {
4710    DataVal av;
4711    AsnTypePtr atp, writetype = NULL;
4712    Pointer pnt;
4713    AsnWriteFunc func = NULL;
4714    Boolean retval = FALSE;
4715 
4716    if (! loaded)
4717    {
4718       if (! objmacroAsnLoad())
4719       return FALSE;
4720    }
4721 
4722    if (aip == NULL)
4723    return FALSE;
4724 
4725    atp = AsnLinkType(orig, MOLINFO_FIELD);   /* link local tree */
4726    if (atp == NULL) {
4727       return FALSE;
4728    }
4729 
4730    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4731 
4732     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4733 
4734    av.ptrvalue = (Pointer)anp;
4735    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
4736       goto erret;
4737    }
4738 
4739    pnt = anp->data.ptrvalue;
4740    switch (anp->choice)
4741    {
4742    case MolinfoField_molecule:
4743       av.intvalue = anp->data.intvalue;
4744       retval = AsnWrite(aip, MOLINFO_FIELD_molecule, &av);
4745       break;
4746    case MolinfoField_technique:
4747       av.intvalue = anp->data.intvalue;
4748       retval = AsnWrite(aip, MOLINFO_FIELD_technique, &av);
4749       break;
4750    case MolinfoField_completedness:
4751       av.intvalue = anp->data.intvalue;
4752       retval = AsnWrite(aip, MOLINFO_FIELD_completedness, &av);
4753       break;
4754    case MolinfoField_mol_class:
4755       av.intvalue = anp->data.intvalue;
4756       retval = AsnWrite(aip, MOLINFO_FIELD_mol_class, &av);
4757       break;
4758    case MolinfoField_topology:
4759       av.intvalue = anp->data.intvalue;
4760       retval = AsnWrite(aip, MOLINFO_FIELD_topology, &av);
4761       break;
4762    case MolinfoField_strand:
4763       av.intvalue = anp->data.intvalue;
4764       retval = AsnWrite(aip, MOLINFO_FIELD_strand, &av);
4765       break;
4766    }
4767    if (writetype != NULL) {
4768       retval = (* func)(pnt, aip, writetype);   /* write it out */
4769    }
4770    if (!retval) {
4771       goto erret;
4772    }
4773    retval = TRUE;
4774 
4775 erret:
4776    AsnUnlinkType(orig);       /* unlink local tree */
4777    return retval;
4778 }
4779 
4780 
4781 /**************************************************
4782 *
4783 *    MolinfoMoleculePairNew()
4784 *
4785 **************************************************/
4786 NLM_EXTERN
4787 MolinfoMoleculePairPtr LIBCALL
MolinfoMoleculePairNew(void)4788 MolinfoMoleculePairNew(void)
4789 {
4790    MolinfoMoleculePairPtr ptr = MemNew((size_t) sizeof(MolinfoMoleculePair));
4791 
4792    return ptr;
4793 
4794 }
4795 
4796 
4797 /**************************************************
4798 *
4799 *    MolinfoMoleculePairFree()
4800 *
4801 **************************************************/
4802 NLM_EXTERN
4803 MolinfoMoleculePairPtr LIBCALL
MolinfoMoleculePairFree(MolinfoMoleculePairPtr ptr)4804 MolinfoMoleculePairFree(MolinfoMoleculePairPtr ptr)
4805 {
4806 
4807    if(ptr == NULL) {
4808       return NULL;
4809    }
4810    return MemFree(ptr);
4811 }
4812 
4813 
4814 /**************************************************
4815 *
4816 *    MolinfoMoleculePairAsnRead()
4817 *
4818 **************************************************/
4819 NLM_EXTERN
4820 MolinfoMoleculePairPtr LIBCALL
MolinfoMoleculePairAsnRead(AsnIoPtr aip,AsnTypePtr orig)4821 MolinfoMoleculePairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4822 {
4823    DataVal av;
4824    AsnTypePtr atp;
4825    Boolean isError = FALSE;
4826    AsnReadFunc func;
4827    MolinfoMoleculePairPtr ptr;
4828 
4829    if (! loaded)
4830    {
4831       if (! objmacroAsnLoad()) {
4832          return NULL;
4833       }
4834    }
4835 
4836    if (aip == NULL) {
4837       return NULL;
4838    }
4839 
4840    if (orig == NULL) {         /* MolinfoMoleculePair ::= (self contained) */
4841       atp = AsnReadId(aip, amp, MOLINFO_MOLECULE_PAIR);
4842    } else {
4843       atp = AsnLinkType(orig, MOLINFO_MOLECULE_PAIR);
4844    }
4845    /* link in local tree */
4846    if (atp == NULL) {
4847       return NULL;
4848    }
4849 
4850    ptr = MolinfoMoleculePairNew();
4851    if (ptr == NULL) {
4852       goto erret;
4853    }
4854    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4855       goto erret;
4856    }
4857 
4858    atp = AsnReadId(aip,amp, atp);
4859    func = NULL;
4860 
4861    if (atp == MOLINFO_MOLECULE_PAIR_from) {
4862       if ( AsnReadVal(aip, atp, &av) <= 0) {
4863          goto erret;
4864       }
4865       ptr -> from = av.intvalue;
4866       atp = AsnReadId(aip,amp, atp);
4867    }
4868    if (atp == MOLINFO_MOLECULE_PAIR_to) {
4869       if ( AsnReadVal(aip, atp, &av) <= 0) {
4870          goto erret;
4871       }
4872       ptr -> to = av.intvalue;
4873       atp = AsnReadId(aip,amp, atp);
4874    }
4875 
4876    if (AsnReadVal(aip, atp, &av) <= 0) {
4877       goto erret;
4878    }
4879    /* end struct */
4880 
4881 ret:
4882    AsnUnlinkType(orig);       /* unlink local tree */
4883    return ptr;
4884 
4885 erret:
4886    aip -> io_failure = TRUE;
4887    ptr = MolinfoMoleculePairFree(ptr);
4888    goto ret;
4889 }
4890 
4891 
4892 
4893 /**************************************************
4894 *
4895 *    MolinfoMoleculePairAsnWrite()
4896 *
4897 **************************************************/
4898 NLM_EXTERN Boolean LIBCALL
MolinfoMoleculePairAsnWrite(MolinfoMoleculePairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4899 MolinfoMoleculePairAsnWrite(MolinfoMoleculePairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4900 {
4901    DataVal av;
4902    AsnTypePtr atp;
4903    Boolean retval = FALSE;
4904 
4905    if (! loaded)
4906    {
4907       if (! objmacroAsnLoad()) {
4908          return FALSE;
4909       }
4910    }
4911 
4912    if (aip == NULL) {
4913       return FALSE;
4914    }
4915 
4916    atp = AsnLinkType(orig, MOLINFO_MOLECULE_PAIR);   /* link local tree */
4917    if (atp == NULL) {
4918       return FALSE;
4919    }
4920 
4921    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4922 
4923     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4924 
4925    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4926       goto erret;
4927    }
4928 
4929    av.intvalue = ptr -> from;
4930    retval = AsnWrite(aip, MOLINFO_MOLECULE_PAIR_from,  &av);
4931    av.intvalue = ptr -> to;
4932    retval = AsnWrite(aip, MOLINFO_MOLECULE_PAIR_to,  &av);
4933    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4934       goto erret;
4935    }
4936    retval = TRUE;
4937 
4938 erret:
4939    AsnUnlinkType(orig);       /* unlink local tree */
4940    return retval;
4941 }
4942 
4943 
4944 
4945 /**************************************************
4946 *
4947 *    MolinfoTechniquePairNew()
4948 *
4949 **************************************************/
4950 NLM_EXTERN
4951 MolinfoTechniquePairPtr LIBCALL
MolinfoTechniquePairNew(void)4952 MolinfoTechniquePairNew(void)
4953 {
4954    MolinfoTechniquePairPtr ptr = MemNew((size_t) sizeof(MolinfoTechniquePair));
4955 
4956    return ptr;
4957 
4958 }
4959 
4960 
4961 /**************************************************
4962 *
4963 *    MolinfoTechniquePairFree()
4964 *
4965 **************************************************/
4966 NLM_EXTERN
4967 MolinfoTechniquePairPtr LIBCALL
MolinfoTechniquePairFree(MolinfoTechniquePairPtr ptr)4968 MolinfoTechniquePairFree(MolinfoTechniquePairPtr ptr)
4969 {
4970 
4971    if(ptr == NULL) {
4972       return NULL;
4973    }
4974    return MemFree(ptr);
4975 }
4976 
4977 
4978 /**************************************************
4979 *
4980 *    MolinfoTechniquePairAsnRead()
4981 *
4982 **************************************************/
4983 NLM_EXTERN
4984 MolinfoTechniquePairPtr LIBCALL
MolinfoTechniquePairAsnRead(AsnIoPtr aip,AsnTypePtr orig)4985 MolinfoTechniquePairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4986 {
4987    DataVal av;
4988    AsnTypePtr atp;
4989    Boolean isError = FALSE;
4990    AsnReadFunc func;
4991    MolinfoTechniquePairPtr ptr;
4992 
4993    if (! loaded)
4994    {
4995       if (! objmacroAsnLoad()) {
4996          return NULL;
4997       }
4998    }
4999 
5000    if (aip == NULL) {
5001       return NULL;
5002    }
5003 
5004    if (orig == NULL) {         /* MolinfoTechniquePair ::= (self contained) */
5005       atp = AsnReadId(aip, amp, MOLINFO_TECHNIQUE_PAIR);
5006    } else {
5007       atp = AsnLinkType(orig, MOLINFO_TECHNIQUE_PAIR);
5008    }
5009    /* link in local tree */
5010    if (atp == NULL) {
5011       return NULL;
5012    }
5013 
5014    ptr = MolinfoTechniquePairNew();
5015    if (ptr == NULL) {
5016       goto erret;
5017    }
5018    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5019       goto erret;
5020    }
5021 
5022    atp = AsnReadId(aip,amp, atp);
5023    func = NULL;
5024 
5025    if (atp == MOLINFO_TECHNIQUE_PAIR_from) {
5026       if ( AsnReadVal(aip, atp, &av) <= 0) {
5027          goto erret;
5028       }
5029       ptr -> from = av.intvalue;
5030       atp = AsnReadId(aip,amp, atp);
5031    }
5032    if (atp == MOLINFO_TECHNIQUE_PAIR_to) {
5033       if ( AsnReadVal(aip, atp, &av) <= 0) {
5034          goto erret;
5035       }
5036       ptr -> to = av.intvalue;
5037       atp = AsnReadId(aip,amp, atp);
5038    }
5039 
5040    if (AsnReadVal(aip, atp, &av) <= 0) {
5041       goto erret;
5042    }
5043    /* end struct */
5044 
5045 ret:
5046    AsnUnlinkType(orig);       /* unlink local tree */
5047    return ptr;
5048 
5049 erret:
5050    aip -> io_failure = TRUE;
5051    ptr = MolinfoTechniquePairFree(ptr);
5052    goto ret;
5053 }
5054 
5055 
5056 
5057 /**************************************************
5058 *
5059 *    MolinfoTechniquePairAsnWrite()
5060 *
5061 **************************************************/
5062 NLM_EXTERN Boolean LIBCALL
MolinfoTechniquePairAsnWrite(MolinfoTechniquePairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)5063 MolinfoTechniquePairAsnWrite(MolinfoTechniquePairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5064 {
5065    DataVal av;
5066    AsnTypePtr atp;
5067    Boolean retval = FALSE;
5068 
5069    if (! loaded)
5070    {
5071       if (! objmacroAsnLoad()) {
5072          return FALSE;
5073       }
5074    }
5075 
5076    if (aip == NULL) {
5077       return FALSE;
5078    }
5079 
5080    atp = AsnLinkType(orig, MOLINFO_TECHNIQUE_PAIR);   /* link local tree */
5081    if (atp == NULL) {
5082       return FALSE;
5083    }
5084 
5085    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5086 
5087     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5088 
5089    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5090       goto erret;
5091    }
5092 
5093    av.intvalue = ptr -> from;
5094    retval = AsnWrite(aip, MOLINFO_TECHNIQUE_PAIR_from,  &av);
5095    av.intvalue = ptr -> to;
5096    retval = AsnWrite(aip, MOLINFO_TECHNIQUE_PAIR_to,  &av);
5097    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5098       goto erret;
5099    }
5100    retval = TRUE;
5101 
5102 erret:
5103    AsnUnlinkType(orig);       /* unlink local tree */
5104    return retval;
5105 }
5106 
5107 
5108 
5109 /**************************************************
5110 *
5111 *    MolinfoCompletednessPairNew()
5112 *
5113 **************************************************/
5114 NLM_EXTERN
5115 MolinfoCompletednessPairPtr LIBCALL
MolinfoCompletednessPairNew(void)5116 MolinfoCompletednessPairNew(void)
5117 {
5118    MolinfoCompletednessPairPtr ptr = MemNew((size_t) sizeof(MolinfoCompletednessPair));
5119 
5120    return ptr;
5121 
5122 }
5123 
5124 
5125 /**************************************************
5126 *
5127 *    MolinfoCompletednessPairFree()
5128 *
5129 **************************************************/
5130 NLM_EXTERN
5131 MolinfoCompletednessPairPtr LIBCALL
MolinfoCompletednessPairFree(MolinfoCompletednessPairPtr ptr)5132 MolinfoCompletednessPairFree(MolinfoCompletednessPairPtr ptr)
5133 {
5134 
5135    if(ptr == NULL) {
5136       return NULL;
5137    }
5138    return MemFree(ptr);
5139 }
5140 
5141 
5142 /**************************************************
5143 *
5144 *    MolinfoCompletednessPairAsnRead()
5145 *
5146 **************************************************/
5147 NLM_EXTERN
5148 MolinfoCompletednessPairPtr LIBCALL
MolinfoCompletednessPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)5149 MolinfoCompletednessPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5150 {
5151    DataVal av;
5152    AsnTypePtr atp;
5153    Boolean isError = FALSE;
5154    AsnReadFunc func;
5155    MolinfoCompletednessPairPtr ptr;
5156 
5157    if (! loaded)
5158    {
5159       if (! objmacroAsnLoad()) {
5160          return NULL;
5161       }
5162    }
5163 
5164    if (aip == NULL) {
5165       return NULL;
5166    }
5167 
5168    if (orig == NULL) {         /* MolinfoCompletednessPair ::= (self contained) */
5169       atp = AsnReadId(aip, amp, MOLINFO_COMPLETEDNESS_PAIR);
5170    } else {
5171       atp = AsnLinkType(orig, MOLINFO_COMPLETEDNESS_PAIR);
5172    }
5173    /* link in local tree */
5174    if (atp == NULL) {
5175       return NULL;
5176    }
5177 
5178    ptr = MolinfoCompletednessPairNew();
5179    if (ptr == NULL) {
5180       goto erret;
5181    }
5182    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5183       goto erret;
5184    }
5185 
5186    atp = AsnReadId(aip,amp, atp);
5187    func = NULL;
5188 
5189    if (atp == MOLINFO_COMPLETEDNESS_PAIR_from) {
5190       if ( AsnReadVal(aip, atp, &av) <= 0) {
5191          goto erret;
5192       }
5193       ptr -> from = av.intvalue;
5194       atp = AsnReadId(aip,amp, atp);
5195    }
5196    if (atp == MOLINFO_COMPLETEDNESS_PAIR_to) {
5197       if ( AsnReadVal(aip, atp, &av) <= 0) {
5198          goto erret;
5199       }
5200       ptr -> to = av.intvalue;
5201       atp = AsnReadId(aip,amp, atp);
5202    }
5203 
5204    if (AsnReadVal(aip, atp, &av) <= 0) {
5205       goto erret;
5206    }
5207    /* end struct */
5208 
5209 ret:
5210    AsnUnlinkType(orig);       /* unlink local tree */
5211    return ptr;
5212 
5213 erret:
5214    aip -> io_failure = TRUE;
5215    ptr = MolinfoCompletednessPairFree(ptr);
5216    goto ret;
5217 }
5218 
5219 
5220 
5221 /**************************************************
5222 *
5223 *    MolinfoCompletednessPairAsnWrite()
5224 *
5225 **************************************************/
5226 NLM_EXTERN Boolean LIBCALL
MolinfoCompletednessPairAsnWrite(MolinfoCompletednessPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)5227 MolinfoCompletednessPairAsnWrite(MolinfoCompletednessPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5228 {
5229    DataVal av;
5230    AsnTypePtr atp;
5231    Boolean retval = FALSE;
5232 
5233    if (! loaded)
5234    {
5235       if (! objmacroAsnLoad()) {
5236          return FALSE;
5237       }
5238    }
5239 
5240    if (aip == NULL) {
5241       return FALSE;
5242    }
5243 
5244    atp = AsnLinkType(orig, MOLINFO_COMPLETEDNESS_PAIR);   /* link local tree */
5245    if (atp == NULL) {
5246       return FALSE;
5247    }
5248 
5249    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5250 
5251     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5252 
5253    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5254       goto erret;
5255    }
5256 
5257    av.intvalue = ptr -> from;
5258    retval = AsnWrite(aip, MOLINFO_COMPLETEDNESS_PAIR_from,  &av);
5259    av.intvalue = ptr -> to;
5260    retval = AsnWrite(aip, MOLINFO_COMPLETEDNESS_PAIR_to,  &av);
5261    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5262       goto erret;
5263    }
5264    retval = TRUE;
5265 
5266 erret:
5267    AsnUnlinkType(orig);       /* unlink local tree */
5268    return retval;
5269 }
5270 
5271 
5272 
5273 /**************************************************
5274 *
5275 *    MolinfoMolClassPairNew()
5276 *
5277 **************************************************/
5278 NLM_EXTERN
5279 MolinfoMolClassPairPtr LIBCALL
MolinfoMolClassPairNew(void)5280 MolinfoMolClassPairNew(void)
5281 {
5282    MolinfoMolClassPairPtr ptr = MemNew((size_t) sizeof(MolinfoMolClassPair));
5283 
5284    return ptr;
5285 
5286 }
5287 
5288 
5289 /**************************************************
5290 *
5291 *    MolinfoMolClassPairFree()
5292 *
5293 **************************************************/
5294 NLM_EXTERN
5295 MolinfoMolClassPairPtr LIBCALL
MolinfoMolClassPairFree(MolinfoMolClassPairPtr ptr)5296 MolinfoMolClassPairFree(MolinfoMolClassPairPtr ptr)
5297 {
5298 
5299    if(ptr == NULL) {
5300       return NULL;
5301    }
5302    return MemFree(ptr);
5303 }
5304 
5305 
5306 /**************************************************
5307 *
5308 *    MolinfoMolClassPairAsnRead()
5309 *
5310 **************************************************/
5311 NLM_EXTERN
5312 MolinfoMolClassPairPtr LIBCALL
MolinfoMolClassPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)5313 MolinfoMolClassPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5314 {
5315    DataVal av;
5316    AsnTypePtr atp;
5317    Boolean isError = FALSE;
5318    AsnReadFunc func;
5319    MolinfoMolClassPairPtr ptr;
5320 
5321    if (! loaded)
5322    {
5323       if (! objmacroAsnLoad()) {
5324          return NULL;
5325       }
5326    }
5327 
5328    if (aip == NULL) {
5329       return NULL;
5330    }
5331 
5332    if (orig == NULL) {         /* MolinfoMolClassPair ::= (self contained) */
5333       atp = AsnReadId(aip, amp, MOLINFO_MOL_CLASS_PAIR);
5334    } else {
5335       atp = AsnLinkType(orig, MOLINFO_MOL_CLASS_PAIR);
5336    }
5337    /* link in local tree */
5338    if (atp == NULL) {
5339       return NULL;
5340    }
5341 
5342    ptr = MolinfoMolClassPairNew();
5343    if (ptr == NULL) {
5344       goto erret;
5345    }
5346    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5347       goto erret;
5348    }
5349 
5350    atp = AsnReadId(aip,amp, atp);
5351    func = NULL;
5352 
5353    if (atp == MOLINFO_MOL_CLASS_PAIR_from) {
5354       if ( AsnReadVal(aip, atp, &av) <= 0) {
5355          goto erret;
5356       }
5357       ptr -> from = av.intvalue;
5358       atp = AsnReadId(aip,amp, atp);
5359    }
5360    if (atp == MOLINFO_MOL_CLASS_PAIR_to) {
5361       if ( AsnReadVal(aip, atp, &av) <= 0) {
5362          goto erret;
5363       }
5364       ptr -> to = av.intvalue;
5365       atp = AsnReadId(aip,amp, atp);
5366    }
5367 
5368    if (AsnReadVal(aip, atp, &av) <= 0) {
5369       goto erret;
5370    }
5371    /* end struct */
5372 
5373 ret:
5374    AsnUnlinkType(orig);       /* unlink local tree */
5375    return ptr;
5376 
5377 erret:
5378    aip -> io_failure = TRUE;
5379    ptr = MolinfoMolClassPairFree(ptr);
5380    goto ret;
5381 }
5382 
5383 
5384 
5385 /**************************************************
5386 *
5387 *    MolinfoMolClassPairAsnWrite()
5388 *
5389 **************************************************/
5390 NLM_EXTERN Boolean LIBCALL
MolinfoMolClassPairAsnWrite(MolinfoMolClassPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)5391 MolinfoMolClassPairAsnWrite(MolinfoMolClassPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5392 {
5393    DataVal av;
5394    AsnTypePtr atp;
5395    Boolean retval = FALSE;
5396 
5397    if (! loaded)
5398    {
5399       if (! objmacroAsnLoad()) {
5400          return FALSE;
5401       }
5402    }
5403 
5404    if (aip == NULL) {
5405       return FALSE;
5406    }
5407 
5408    atp = AsnLinkType(orig, MOLINFO_MOL_CLASS_PAIR);   /* link local tree */
5409    if (atp == NULL) {
5410       return FALSE;
5411    }
5412 
5413    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5414 
5415     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5416 
5417    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5418       goto erret;
5419    }
5420 
5421    av.intvalue = ptr -> from;
5422    retval = AsnWrite(aip, MOLINFO_MOL_CLASS_PAIR_from,  &av);
5423    av.intvalue = ptr -> to;
5424    retval = AsnWrite(aip, MOLINFO_MOL_CLASS_PAIR_to,  &av);
5425    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5426       goto erret;
5427    }
5428    retval = TRUE;
5429 
5430 erret:
5431    AsnUnlinkType(orig);       /* unlink local tree */
5432    return retval;
5433 }
5434 
5435 
5436 
5437 /**************************************************
5438 *
5439 *    MolinfoTopologyPairNew()
5440 *
5441 **************************************************/
5442 NLM_EXTERN
5443 MolinfoTopologyPairPtr LIBCALL
MolinfoTopologyPairNew(void)5444 MolinfoTopologyPairNew(void)
5445 {
5446    MolinfoTopologyPairPtr ptr = MemNew((size_t) sizeof(MolinfoTopologyPair));
5447 
5448    return ptr;
5449 
5450 }
5451 
5452 
5453 /**************************************************
5454 *
5455 *    MolinfoTopologyPairFree()
5456 *
5457 **************************************************/
5458 NLM_EXTERN
5459 MolinfoTopologyPairPtr LIBCALL
MolinfoTopologyPairFree(MolinfoTopologyPairPtr ptr)5460 MolinfoTopologyPairFree(MolinfoTopologyPairPtr ptr)
5461 {
5462 
5463    if(ptr == NULL) {
5464       return NULL;
5465    }
5466    return MemFree(ptr);
5467 }
5468 
5469 
5470 /**************************************************
5471 *
5472 *    MolinfoTopologyPairAsnRead()
5473 *
5474 **************************************************/
5475 NLM_EXTERN
5476 MolinfoTopologyPairPtr LIBCALL
MolinfoTopologyPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)5477 MolinfoTopologyPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5478 {
5479    DataVal av;
5480    AsnTypePtr atp;
5481    Boolean isError = FALSE;
5482    AsnReadFunc func;
5483    MolinfoTopologyPairPtr ptr;
5484 
5485    if (! loaded)
5486    {
5487       if (! objmacroAsnLoad()) {
5488          return NULL;
5489       }
5490    }
5491 
5492    if (aip == NULL) {
5493       return NULL;
5494    }
5495 
5496    if (orig == NULL) {         /* MolinfoTopologyPair ::= (self contained) */
5497       atp = AsnReadId(aip, amp, MOLINFO_TOPOLOGY_PAIR);
5498    } else {
5499       atp = AsnLinkType(orig, MOLINFO_TOPOLOGY_PAIR);
5500    }
5501    /* link in local tree */
5502    if (atp == NULL) {
5503       return NULL;
5504    }
5505 
5506    ptr = MolinfoTopologyPairNew();
5507    if (ptr == NULL) {
5508       goto erret;
5509    }
5510    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5511       goto erret;
5512    }
5513 
5514    atp = AsnReadId(aip,amp, atp);
5515    func = NULL;
5516 
5517    if (atp == MOLINFO_TOPOLOGY_PAIR_from) {
5518       if ( AsnReadVal(aip, atp, &av) <= 0) {
5519          goto erret;
5520       }
5521       ptr -> from = av.intvalue;
5522       atp = AsnReadId(aip,amp, atp);
5523    }
5524    if (atp == MOLINFO_TOPOLOGY_PAIR_to) {
5525       if ( AsnReadVal(aip, atp, &av) <= 0) {
5526          goto erret;
5527       }
5528       ptr -> to = av.intvalue;
5529       atp = AsnReadId(aip,amp, atp);
5530    }
5531 
5532    if (AsnReadVal(aip, atp, &av) <= 0) {
5533       goto erret;
5534    }
5535    /* end struct */
5536 
5537 ret:
5538    AsnUnlinkType(orig);       /* unlink local tree */
5539    return ptr;
5540 
5541 erret:
5542    aip -> io_failure = TRUE;
5543    ptr = MolinfoTopologyPairFree(ptr);
5544    goto ret;
5545 }
5546 
5547 
5548 
5549 /**************************************************
5550 *
5551 *    MolinfoTopologyPairAsnWrite()
5552 *
5553 **************************************************/
5554 NLM_EXTERN Boolean LIBCALL
MolinfoTopologyPairAsnWrite(MolinfoTopologyPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)5555 MolinfoTopologyPairAsnWrite(MolinfoTopologyPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5556 {
5557    DataVal av;
5558    AsnTypePtr atp;
5559    Boolean retval = FALSE;
5560 
5561    if (! loaded)
5562    {
5563       if (! objmacroAsnLoad()) {
5564          return FALSE;
5565       }
5566    }
5567 
5568    if (aip == NULL) {
5569       return FALSE;
5570    }
5571 
5572    atp = AsnLinkType(orig, MOLINFO_TOPOLOGY_PAIR);   /* link local tree */
5573    if (atp == NULL) {
5574       return FALSE;
5575    }
5576 
5577    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5578 
5579     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5580 
5581    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5582       goto erret;
5583    }
5584 
5585    av.intvalue = ptr -> from;
5586    retval = AsnWrite(aip, MOLINFO_TOPOLOGY_PAIR_from,  &av);
5587    av.intvalue = ptr -> to;
5588    retval = AsnWrite(aip, MOLINFO_TOPOLOGY_PAIR_to,  &av);
5589    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5590       goto erret;
5591    }
5592    retval = TRUE;
5593 
5594 erret:
5595    AsnUnlinkType(orig);       /* unlink local tree */
5596    return retval;
5597 }
5598 
5599 
5600 
5601 /**************************************************
5602 *
5603 *    MolinfoStrandPairNew()
5604 *
5605 **************************************************/
5606 NLM_EXTERN
5607 MolinfoStrandPairPtr LIBCALL
MolinfoStrandPairNew(void)5608 MolinfoStrandPairNew(void)
5609 {
5610    MolinfoStrandPairPtr ptr = MemNew((size_t) sizeof(MolinfoStrandPair));
5611 
5612    return ptr;
5613 
5614 }
5615 
5616 
5617 /**************************************************
5618 *
5619 *    MolinfoStrandPairFree()
5620 *
5621 **************************************************/
5622 NLM_EXTERN
5623 MolinfoStrandPairPtr LIBCALL
MolinfoStrandPairFree(MolinfoStrandPairPtr ptr)5624 MolinfoStrandPairFree(MolinfoStrandPairPtr ptr)
5625 {
5626 
5627    if(ptr == NULL) {
5628       return NULL;
5629    }
5630    return MemFree(ptr);
5631 }
5632 
5633 
5634 /**************************************************
5635 *
5636 *    MolinfoStrandPairAsnRead()
5637 *
5638 **************************************************/
5639 NLM_EXTERN
5640 MolinfoStrandPairPtr LIBCALL
MolinfoStrandPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)5641 MolinfoStrandPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5642 {
5643    DataVal av;
5644    AsnTypePtr atp;
5645    Boolean isError = FALSE;
5646    AsnReadFunc func;
5647    MolinfoStrandPairPtr ptr;
5648 
5649    if (! loaded)
5650    {
5651       if (! objmacroAsnLoad()) {
5652          return NULL;
5653       }
5654    }
5655 
5656    if (aip == NULL) {
5657       return NULL;
5658    }
5659 
5660    if (orig == NULL) {         /* MolinfoStrandPair ::= (self contained) */
5661       atp = AsnReadId(aip, amp, MOLINFO_STRAND_PAIR);
5662    } else {
5663       atp = AsnLinkType(orig, MOLINFO_STRAND_PAIR);
5664    }
5665    /* link in local tree */
5666    if (atp == NULL) {
5667       return NULL;
5668    }
5669 
5670    ptr = MolinfoStrandPairNew();
5671    if (ptr == NULL) {
5672       goto erret;
5673    }
5674    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5675       goto erret;
5676    }
5677 
5678    atp = AsnReadId(aip,amp, atp);
5679    func = NULL;
5680 
5681    if (atp == MOLINFO_STRAND_PAIR_from) {
5682       if ( AsnReadVal(aip, atp, &av) <= 0) {
5683          goto erret;
5684       }
5685       ptr -> from = av.intvalue;
5686       atp = AsnReadId(aip,amp, atp);
5687    }
5688    if (atp == MOLINFO_STRAND_PAIR_to) {
5689       if ( AsnReadVal(aip, atp, &av) <= 0) {
5690          goto erret;
5691       }
5692       ptr -> to = av.intvalue;
5693       atp = AsnReadId(aip,amp, atp);
5694    }
5695 
5696    if (AsnReadVal(aip, atp, &av) <= 0) {
5697       goto erret;
5698    }
5699    /* end struct */
5700 
5701 ret:
5702    AsnUnlinkType(orig);       /* unlink local tree */
5703    return ptr;
5704 
5705 erret:
5706    aip -> io_failure = TRUE;
5707    ptr = MolinfoStrandPairFree(ptr);
5708    goto ret;
5709 }
5710 
5711 
5712 
5713 /**************************************************
5714 *
5715 *    MolinfoStrandPairAsnWrite()
5716 *
5717 **************************************************/
5718 NLM_EXTERN Boolean LIBCALL
MolinfoStrandPairAsnWrite(MolinfoStrandPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)5719 MolinfoStrandPairAsnWrite(MolinfoStrandPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5720 {
5721    DataVal av;
5722    AsnTypePtr atp;
5723    Boolean retval = FALSE;
5724 
5725    if (! loaded)
5726    {
5727       if (! objmacroAsnLoad()) {
5728          return FALSE;
5729       }
5730    }
5731 
5732    if (aip == NULL) {
5733       return FALSE;
5734    }
5735 
5736    atp = AsnLinkType(orig, MOLINFO_STRAND_PAIR);   /* link local tree */
5737    if (atp == NULL) {
5738       return FALSE;
5739    }
5740 
5741    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5742 
5743     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5744 
5745    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5746       goto erret;
5747    }
5748 
5749    av.intvalue = ptr -> from;
5750    retval = AsnWrite(aip, MOLINFO_STRAND_PAIR_from,  &av);
5751    av.intvalue = ptr -> to;
5752    retval = AsnWrite(aip, MOLINFO_STRAND_PAIR_to,  &av);
5753    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5754       goto erret;
5755    }
5756    retval = TRUE;
5757 
5758 erret:
5759    AsnUnlinkType(orig);       /* unlink local tree */
5760    return retval;
5761 }
5762 
5763 
5764 
5765 /**************************************************
5766 *
5767 *    MolinfoFieldPairFree()
5768 *
5769 **************************************************/
5770 NLM_EXTERN
5771 MolinfoFieldPairPtr LIBCALL
MolinfoFieldPairFree(ValNodePtr anp)5772 MolinfoFieldPairFree(ValNodePtr anp)
5773 {
5774    Pointer pnt;
5775 
5776    if (anp == NULL) {
5777       return NULL;
5778    }
5779 
5780    pnt = anp->data.ptrvalue;
5781    switch (anp->choice)
5782    {
5783    default:
5784       break;
5785    case MolinfoFieldPair_molecule:
5786       MolinfoMoleculePairFree(anp -> data.ptrvalue);
5787       break;
5788    case MolinfoFieldPair_technique:
5789       MolinfoTechniquePairFree(anp -> data.ptrvalue);
5790       break;
5791    case MolinfoFieldPair_completedness:
5792       MolinfoCompletednessPairFree(anp -> data.ptrvalue);
5793       break;
5794    case MolinfoFieldPair_mol_class:
5795       MolinfoMolClassPairFree(anp -> data.ptrvalue);
5796       break;
5797    case MolinfoFieldPair_topology:
5798       MolinfoTopologyPairFree(anp -> data.ptrvalue);
5799       break;
5800    case MolinfoFieldPair_strand:
5801       MolinfoStrandPairFree(anp -> data.ptrvalue);
5802       break;
5803    }
5804    return MemFree(anp);
5805 }
5806 
5807 
5808 /**************************************************
5809 *
5810 *    MolinfoFieldPairAsnRead()
5811 *
5812 **************************************************/
5813 NLM_EXTERN
5814 MolinfoFieldPairPtr LIBCALL
MolinfoFieldPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)5815 MolinfoFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5816 {
5817    DataVal av;
5818    AsnTypePtr atp;
5819    ValNodePtr anp;
5820    Uint1 choice;
5821    Boolean isError = FALSE;
5822    Boolean nullIsError = FALSE;
5823    AsnReadFunc func;
5824 
5825    if (! loaded)
5826    {
5827       if (! objmacroAsnLoad()) {
5828          return NULL;
5829       }
5830    }
5831 
5832    if (aip == NULL) {
5833       return NULL;
5834    }
5835 
5836    if (orig == NULL) {         /* MolinfoFieldPair ::= (self contained) */
5837       atp = AsnReadId(aip, amp, MOLINFO_FIELD_PAIR);
5838    } else {
5839       atp = AsnLinkType(orig, MOLINFO_FIELD_PAIR);    /* link in local tree */
5840    }
5841    if (atp == NULL) {
5842       return NULL;
5843    }
5844 
5845    anp = ValNodeNew(NULL);
5846    if (anp == NULL) {
5847       goto erret;
5848    }
5849    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
5850       goto erret;
5851    }
5852 
5853    func = NULL;
5854 
5855    atp = AsnReadId(aip, amp, atp);  /* find the choice */
5856    if (atp == NULL) {
5857       goto erret;
5858    }
5859    if (atp == MOLINFO_FIELD_PAIR_molecule) {
5860       choice = MolinfoFieldPair_molecule;
5861       func = (AsnReadFunc) MolinfoMoleculePairAsnRead;
5862    }
5863    else if (atp == MOLINFO_FIELD_PAIR_technique) {
5864       choice = MolinfoFieldPair_technique;
5865       func = (AsnReadFunc) MolinfoTechniquePairAsnRead;
5866    }
5867    else if (atp == MOLINFO_FIELD_PAIR_completedness) {
5868       choice = MolinfoFieldPair_completedness;
5869       func = (AsnReadFunc) MolinfoCompletednessPairAsnRead;
5870    }
5871    else if (atp == MOLINFO_FIELD_PAIR_mol_class) {
5872       choice = MolinfoFieldPair_mol_class;
5873       func = (AsnReadFunc) MolinfoMolClassPairAsnRead;
5874    }
5875    else if (atp == MOLINFO_FIELD_PAIR_topology) {
5876       choice = MolinfoFieldPair_topology;
5877       func = (AsnReadFunc) MolinfoTopologyPairAsnRead;
5878    }
5879    else if (atp == MOLINFO_FIELD_PAIR_strand) {
5880       choice = MolinfoFieldPair_strand;
5881       func = (AsnReadFunc) MolinfoStrandPairAsnRead;
5882    }
5883    anp->choice = choice;
5884    if (func != NULL)
5885    {
5886       anp->data.ptrvalue = (* func)(aip, atp);
5887       if (aip -> io_failure) goto erret;
5888 
5889       if (nullIsError && anp->data.ptrvalue == NULL) {
5890          goto erret;
5891       }
5892    }
5893 
5894 ret:
5895    AsnUnlinkType(orig);       /* unlink local tree */
5896    return anp;
5897 
5898 erret:
5899    anp = MemFree(anp);
5900    aip -> io_failure = TRUE;
5901    goto ret;
5902 }
5903 
5904 
5905 /**************************************************
5906 *
5907 *    MolinfoFieldPairAsnWrite()
5908 *
5909 **************************************************/
5910 NLM_EXTERN Boolean LIBCALL
MolinfoFieldPairAsnWrite(MolinfoFieldPairPtr anp,AsnIoPtr aip,AsnTypePtr orig)5911 MolinfoFieldPairAsnWrite(MolinfoFieldPairPtr anp, AsnIoPtr aip, AsnTypePtr orig)
5912 
5913 {
5914    DataVal av;
5915    AsnTypePtr atp, writetype = NULL;
5916    Pointer pnt;
5917    AsnWriteFunc func = NULL;
5918    Boolean retval = FALSE;
5919 
5920    if (! loaded)
5921    {
5922       if (! objmacroAsnLoad())
5923       return FALSE;
5924    }
5925 
5926    if (aip == NULL)
5927    return FALSE;
5928 
5929    atp = AsnLinkType(orig, MOLINFO_FIELD_PAIR);   /* link local tree */
5930    if (atp == NULL) {
5931       return FALSE;
5932    }
5933 
5934    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5935 
5936     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5937 
5938    av.ptrvalue = (Pointer)anp;
5939    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
5940       goto erret;
5941    }
5942 
5943    pnt = anp->data.ptrvalue;
5944    switch (anp->choice)
5945    {
5946    case MolinfoFieldPair_molecule:
5947       writetype = MOLINFO_FIELD_PAIR_molecule;
5948       func = (AsnWriteFunc) MolinfoMoleculePairAsnWrite;
5949       break;
5950    case MolinfoFieldPair_technique:
5951       writetype = MOLINFO_FIELD_PAIR_technique;
5952       func = (AsnWriteFunc) MolinfoTechniquePairAsnWrite;
5953       break;
5954    case MolinfoFieldPair_completedness:
5955       writetype = MOLINFO_FIELD_PAIR_completedness;
5956       func = (AsnWriteFunc) MolinfoCompletednessPairAsnWrite;
5957       break;
5958    case MolinfoFieldPair_mol_class:
5959       writetype = MOLINFO_FIELD_PAIR_mol_class;
5960       func = (AsnWriteFunc) MolinfoMolClassPairAsnWrite;
5961       break;
5962    case MolinfoFieldPair_topology:
5963       writetype = MOLINFO_FIELD_PAIR_topology;
5964       func = (AsnWriteFunc) MolinfoTopologyPairAsnWrite;
5965       break;
5966    case MolinfoFieldPair_strand:
5967       writetype = MOLINFO_FIELD_PAIR_strand;
5968       func = (AsnWriteFunc) MolinfoStrandPairAsnWrite;
5969       break;
5970    }
5971    if (writetype != NULL) {
5972       retval = (* func)(pnt, aip, writetype);   /* write it out */
5973    }
5974    if (!retval) {
5975       goto erret;
5976    }
5977    retval = TRUE;
5978 
5979 erret:
5980    AsnUnlinkType(orig);       /* unlink local tree */
5981    return retval;
5982 }
5983 
5984 
5985 /**************************************************
5986 *
5987 *    MolinfoFieldListFree()
5988 *
5989 **************************************************/
5990 NLM_EXTERN
5991 MolinfoFieldListPtr LIBCALL
MolinfoFieldListFree(MolinfoFieldListPtr ptr)5992 MolinfoFieldListFree(MolinfoFieldListPtr ptr)
5993 {
5994 
5995    if(ptr == NULL) {
5996       return NULL;
5997    }
5998    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) MolinfoFieldFree);
5999    return NULL;
6000 }
6001 
6002 
6003 /**************************************************
6004 *
6005 *    MolinfoFieldListAsnRead()
6006 *
6007 **************************************************/
6008 NLM_EXTERN
6009 MolinfoFieldListPtr LIBCALL
MolinfoFieldListAsnRead(AsnIoPtr aip,AsnTypePtr orig)6010 MolinfoFieldListAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6011 {
6012    DataVal av;
6013    AsnTypePtr atp;
6014    Boolean isError = FALSE;
6015    AsnReadFunc func;
6016    MolinfoFieldListPtr ptr;
6017 
6018    if (! loaded)
6019    {
6020       if (! objmacroAsnLoad()) {
6021          return NULL;
6022       }
6023    }
6024 
6025    if (aip == NULL) {
6026       return NULL;
6027    }
6028 
6029    if (orig == NULL) {         /* MolinfoFieldList ::= (self contained) */
6030       atp = AsnReadId(aip, amp, MOLINFO_FIELD_LIST);
6031    } else {
6032       atp = AsnLinkType(orig, MOLINFO_FIELD_LIST);
6033    }
6034    /* link in local tree */
6035    if (atp == NULL) {
6036       return NULL;
6037    }
6038 
6039    func = NULL;
6040 
6041    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MolinfoFieldAsnRead, (AsnOptFreeFunc) MolinfoFieldFree);
6042    if (isError && ptr  == NULL) {
6043       goto erret;
6044    }
6045 
6046 
6047 
6048 ret:
6049    AsnUnlinkType(orig);       /* unlink local tree */
6050    return ptr;
6051 
6052 erret:
6053    aip -> io_failure = TRUE;
6054    ptr = MolinfoFieldListFree(ptr);
6055    goto ret;
6056 }
6057 
6058 
6059 
6060 /**************************************************
6061 *
6062 *    MolinfoFieldListAsnWrite()
6063 *
6064 **************************************************/
6065 NLM_EXTERN Boolean LIBCALL
MolinfoFieldListAsnWrite(MolinfoFieldListPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6066 MolinfoFieldListAsnWrite(MolinfoFieldListPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6067 {
6068    DataVal av;
6069    AsnTypePtr atp;
6070    Boolean retval = FALSE;
6071 
6072    if (! loaded)
6073    {
6074       if (! objmacroAsnLoad()) {
6075          return FALSE;
6076       }
6077    }
6078 
6079    if (aip == NULL) {
6080       return FALSE;
6081    }
6082 
6083    atp = AsnLinkType(orig, MOLINFO_FIELD_LIST);   /* link local tree */
6084    if (atp == NULL) {
6085       return FALSE;
6086    }
6087 
6088    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6089 
6090     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6091 
6092    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) MolinfoFieldAsnWrite, aip, atp, MOLINFO_FIELD_LIST_E);
6093    retval = TRUE;
6094 
6095 erret:
6096    AsnUnlinkType(orig);       /* unlink local tree */
6097    return retval;
6098 }
6099 
6100 
6101 
6102 /**************************************************
6103 *
6104 *    MolinfoFieldConstraintNew()
6105 *
6106 **************************************************/
6107 NLM_EXTERN
6108 MolinfoFieldConstraintPtr LIBCALL
MolinfoFieldConstraintNew(void)6109 MolinfoFieldConstraintNew(void)
6110 {
6111    MolinfoFieldConstraintPtr ptr = MemNew((size_t) sizeof(MolinfoFieldConstraint));
6112 
6113    ptr -> is_not = 0;
6114    return ptr;
6115 
6116 }
6117 
6118 
6119 /**************************************************
6120 *
6121 *    MolinfoFieldConstraintFree()
6122 *
6123 **************************************************/
6124 NLM_EXTERN
6125 MolinfoFieldConstraintPtr LIBCALL
MolinfoFieldConstraintFree(MolinfoFieldConstraintPtr ptr)6126 MolinfoFieldConstraintFree(MolinfoFieldConstraintPtr ptr)
6127 {
6128 
6129    if(ptr == NULL) {
6130       return NULL;
6131    }
6132    MolinfoFieldFree(ptr -> field);
6133    return MemFree(ptr);
6134 }
6135 
6136 
6137 /**************************************************
6138 *
6139 *    MolinfoFieldConstraintAsnRead()
6140 *
6141 **************************************************/
6142 NLM_EXTERN
6143 MolinfoFieldConstraintPtr LIBCALL
MolinfoFieldConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)6144 MolinfoFieldConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6145 {
6146    DataVal av;
6147    AsnTypePtr atp;
6148    Boolean isError = FALSE;
6149    AsnReadFunc func;
6150    MolinfoFieldConstraintPtr ptr;
6151 
6152    if (! loaded)
6153    {
6154       if (! objmacroAsnLoad()) {
6155          return NULL;
6156       }
6157    }
6158 
6159    if (aip == NULL) {
6160       return NULL;
6161    }
6162 
6163    if (orig == NULL) {         /* MolinfoFieldConstraint ::= (self contained) */
6164       atp = AsnReadId(aip, amp, MOLINFO_FIELD_CONSTRAINT);
6165    } else {
6166       atp = AsnLinkType(orig, MOLINFO_FIELD_CONSTRAINT);
6167    }
6168    /* link in local tree */
6169    if (atp == NULL) {
6170       return NULL;
6171    }
6172 
6173    ptr = MolinfoFieldConstraintNew();
6174    if (ptr == NULL) {
6175       goto erret;
6176    }
6177    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6178       goto erret;
6179    }
6180 
6181    atp = AsnReadId(aip,amp, atp);
6182    func = NULL;
6183 
6184    if (atp == MOLINFO_FIELD_CONSTRAINT_field) {
6185       ptr -> field = MolinfoFieldAsnRead(aip, atp);
6186       if (aip -> io_failure) {
6187          goto erret;
6188       }
6189       atp = AsnReadId(aip,amp, atp);
6190    }
6191    if (atp == MOLINFO_FIELD_CONSTRAINT_is_not) {
6192       if ( AsnReadVal(aip, atp, &av) <= 0) {
6193          goto erret;
6194       }
6195       ptr -> is_not = av.boolvalue;
6196       atp = AsnReadId(aip,amp, atp);
6197    }
6198 
6199    if (AsnReadVal(aip, atp, &av) <= 0) {
6200       goto erret;
6201    }
6202    /* end struct */
6203 
6204 ret:
6205    AsnUnlinkType(orig);       /* unlink local tree */
6206    return ptr;
6207 
6208 erret:
6209    aip -> io_failure = TRUE;
6210    ptr = MolinfoFieldConstraintFree(ptr);
6211    goto ret;
6212 }
6213 
6214 
6215 
6216 /**************************************************
6217 *
6218 *    MolinfoFieldConstraintAsnWrite()
6219 *
6220 **************************************************/
6221 NLM_EXTERN Boolean LIBCALL
MolinfoFieldConstraintAsnWrite(MolinfoFieldConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6222 MolinfoFieldConstraintAsnWrite(MolinfoFieldConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6223 {
6224    DataVal av;
6225    AsnTypePtr atp;
6226    Boolean retval = FALSE;
6227 
6228    if (! loaded)
6229    {
6230       if (! objmacroAsnLoad()) {
6231          return FALSE;
6232       }
6233    }
6234 
6235    if (aip == NULL) {
6236       return FALSE;
6237    }
6238 
6239    atp = AsnLinkType(orig, MOLINFO_FIELD_CONSTRAINT);   /* link local tree */
6240    if (atp == NULL) {
6241       return FALSE;
6242    }
6243 
6244    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6245 
6246     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6247 
6248    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6249       goto erret;
6250    }
6251 
6252    if (ptr -> field != NULL) {
6253       if ( ! MolinfoFieldAsnWrite(ptr -> field, aip, MOLINFO_FIELD_CONSTRAINT_field)) {
6254          goto erret;
6255       }
6256    }
6257    av.boolvalue = ptr -> is_not;
6258    retval = AsnWrite(aip, MOLINFO_FIELD_CONSTRAINT_is_not,  &av);
6259    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6260       goto erret;
6261    }
6262    retval = TRUE;
6263 
6264 erret:
6265    AsnUnlinkType(orig);       /* unlink local tree */
6266    return retval;
6267 }
6268 
6269 
6270 
6271 /**************************************************
6272 *
6273 *    StructuredCommentFieldFree()
6274 *
6275 **************************************************/
6276 NLM_EXTERN
6277 StructuredCommentFieldPtr LIBCALL
StructuredCommentFieldFree(ValNodePtr anp)6278 StructuredCommentFieldFree(ValNodePtr anp)
6279 {
6280    Pointer pnt;
6281 
6282    if (anp == NULL) {
6283       return NULL;
6284    }
6285 
6286    pnt = anp->data.ptrvalue;
6287    switch (anp->choice)
6288    {
6289    default:
6290       break;
6291    case StructuredCommentField_named:
6292       MemFree(anp -> data.ptrvalue);
6293       break;
6294    }
6295    return MemFree(anp);
6296 }
6297 
6298 
6299 /**************************************************
6300 *
6301 *    StructuredCommentFieldAsnRead()
6302 *
6303 **************************************************/
6304 NLM_EXTERN
6305 StructuredCommentFieldPtr LIBCALL
StructuredCommentFieldAsnRead(AsnIoPtr aip,AsnTypePtr orig)6306 StructuredCommentFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6307 {
6308    DataVal av;
6309    AsnTypePtr atp;
6310    ValNodePtr anp;
6311    Uint1 choice;
6312    Boolean isError = FALSE;
6313    Boolean nullIsError = FALSE;
6314    AsnReadFunc func;
6315 
6316    if (! loaded)
6317    {
6318       if (! objmacroAsnLoad()) {
6319          return NULL;
6320       }
6321    }
6322 
6323    if (aip == NULL) {
6324       return NULL;
6325    }
6326 
6327    if (orig == NULL) {         /* StructuredCommentField ::= (self contained) */
6328       atp = AsnReadId(aip, amp, STRUCTURED_COMMENT_FIELD);
6329    } else {
6330       atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD);    /* link in local tree */
6331    }
6332    if (atp == NULL) {
6333       return NULL;
6334    }
6335 
6336    anp = ValNodeNew(NULL);
6337    if (anp == NULL) {
6338       goto erret;
6339    }
6340    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
6341       goto erret;
6342    }
6343 
6344    func = NULL;
6345 
6346    atp = AsnReadId(aip, amp, atp);  /* find the choice */
6347    if (atp == NULL) {
6348       goto erret;
6349    }
6350    if (atp == STRUCTURED_COMMENT_FIELD_database) {
6351       choice = StructuredCommentField_database;
6352       if (AsnReadVal(aip, atp, &av) <= 0) {
6353          goto erret;
6354       }
6355       anp->data.boolvalue = av.boolvalue;
6356    }
6357    else if (atp == STRUCTURED_COMMENT_FIELD_named) {
6358       choice = StructuredCommentField_named;
6359       if (AsnReadVal(aip, atp, &av) <= 0) {
6360          goto erret;
6361       }
6362       anp->data.ptrvalue = av.ptrvalue;
6363    }
6364    else if (atp == STRUCTURED_COMMENT_FIELD_field_name) {
6365       choice = StructuredCommentField_field_name;
6366       if (AsnReadVal(aip, atp, &av) <= 0) {
6367          goto erret;
6368       }
6369       anp->data.boolvalue = av.boolvalue;
6370    }
6371    anp->choice = choice;
6372    if (func != NULL)
6373    {
6374       anp->data.ptrvalue = (* func)(aip, atp);
6375       if (aip -> io_failure) goto erret;
6376 
6377       if (nullIsError && anp->data.ptrvalue == NULL) {
6378          goto erret;
6379       }
6380    }
6381 
6382 ret:
6383    AsnUnlinkType(orig);       /* unlink local tree */
6384    return anp;
6385 
6386 erret:
6387    anp = MemFree(anp);
6388    aip -> io_failure = TRUE;
6389    goto ret;
6390 }
6391 
6392 
6393 /**************************************************
6394 *
6395 *    StructuredCommentFieldAsnWrite()
6396 *
6397 **************************************************/
6398 NLM_EXTERN Boolean LIBCALL
StructuredCommentFieldAsnWrite(StructuredCommentFieldPtr anp,AsnIoPtr aip,AsnTypePtr orig)6399 StructuredCommentFieldAsnWrite(StructuredCommentFieldPtr anp, AsnIoPtr aip, AsnTypePtr orig)
6400 
6401 {
6402    DataVal av;
6403    AsnTypePtr atp, writetype = NULL;
6404    Pointer pnt;
6405    AsnWriteFunc func = NULL;
6406    Boolean retval = FALSE;
6407 
6408    if (! loaded)
6409    {
6410       if (! objmacroAsnLoad())
6411       return FALSE;
6412    }
6413 
6414    if (aip == NULL)
6415    return FALSE;
6416 
6417    atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD);   /* link local tree */
6418    if (atp == NULL) {
6419       return FALSE;
6420    }
6421 
6422    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6423 
6424     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6425 
6426    av.ptrvalue = (Pointer)anp;
6427    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
6428       goto erret;
6429    }
6430 
6431    pnt = anp->data.ptrvalue;
6432    switch (anp->choice)
6433    {
6434    case StructuredCommentField_database:
6435       av.boolvalue = anp->data.boolvalue;
6436       retval = AsnWrite(aip, STRUCTURED_COMMENT_FIELD_database, &av);
6437       break;
6438    case StructuredCommentField_named:
6439       av.ptrvalue = anp->data.ptrvalue;
6440       retval = AsnWrite(aip, STRUCTURED_COMMENT_FIELD_named, &av);
6441       break;
6442    case StructuredCommentField_field_name:
6443       av.boolvalue = anp->data.boolvalue;
6444       retval = AsnWrite(aip, STRUCTURED_COMMENT_FIELD_field_name, &av);
6445       break;
6446    }
6447    if (writetype != NULL) {
6448       retval = (* func)(pnt, aip, writetype);   /* write it out */
6449    }
6450    if (!retval) {
6451       goto erret;
6452    }
6453    retval = TRUE;
6454 
6455 erret:
6456    AsnUnlinkType(orig);       /* unlink local tree */
6457    return retval;
6458 }
6459 
6460 
6461 /**************************************************
6462 *
6463 *    StructuredCommentFieldPairNew()
6464 *
6465 **************************************************/
6466 NLM_EXTERN
6467 StructuredCommentFieldPairPtr LIBCALL
StructuredCommentFieldPairNew(void)6468 StructuredCommentFieldPairNew(void)
6469 {
6470    StructuredCommentFieldPairPtr ptr = MemNew((size_t) sizeof(StructuredCommentFieldPair));
6471 
6472    return ptr;
6473 
6474 }
6475 
6476 
6477 /**************************************************
6478 *
6479 *    StructuredCommentFieldPairFree()
6480 *
6481 **************************************************/
6482 NLM_EXTERN
6483 StructuredCommentFieldPairPtr LIBCALL
StructuredCommentFieldPairFree(StructuredCommentFieldPairPtr ptr)6484 StructuredCommentFieldPairFree(StructuredCommentFieldPairPtr ptr)
6485 {
6486 
6487    if(ptr == NULL) {
6488       return NULL;
6489    }
6490    StructuredCommentFieldFree(ptr -> from);
6491    StructuredCommentFieldFree(ptr -> to);
6492    return MemFree(ptr);
6493 }
6494 
6495 
6496 /**************************************************
6497 *
6498 *    StructuredCommentFieldPairAsnRead()
6499 *
6500 **************************************************/
6501 NLM_EXTERN
6502 StructuredCommentFieldPairPtr LIBCALL
StructuredCommentFieldPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)6503 StructuredCommentFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6504 {
6505    DataVal av;
6506    AsnTypePtr atp;
6507    Boolean isError = FALSE;
6508    AsnReadFunc func;
6509    StructuredCommentFieldPairPtr ptr;
6510 
6511    if (! loaded)
6512    {
6513       if (! objmacroAsnLoad()) {
6514          return NULL;
6515       }
6516    }
6517 
6518    if (aip == NULL) {
6519       return NULL;
6520    }
6521 
6522    if (orig == NULL) {         /* StructuredCommentFieldPair ::= (self contained) */
6523       atp = AsnReadId(aip, amp, STRUCTURED_COMMENT_FIELD_PAIR);
6524    } else {
6525       atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD_PAIR);
6526    }
6527    /* link in local tree */
6528    if (atp == NULL) {
6529       return NULL;
6530    }
6531 
6532    ptr = StructuredCommentFieldPairNew();
6533    if (ptr == NULL) {
6534       goto erret;
6535    }
6536    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6537       goto erret;
6538    }
6539 
6540    atp = AsnReadId(aip,amp, atp);
6541    func = NULL;
6542 
6543    if (atp == STRUCTURED_COMMENT_FIELD_PAIR_from) {
6544       ptr -> from = StructuredCommentFieldAsnRead(aip, atp);
6545       if (aip -> io_failure) {
6546          goto erret;
6547       }
6548       atp = AsnReadId(aip,amp, atp);
6549    }
6550    if (atp == STRUCTURED_COMMENT_FIELD_PAIR_to) {
6551       ptr -> to = StructuredCommentFieldAsnRead(aip, atp);
6552       if (aip -> io_failure) {
6553          goto erret;
6554       }
6555       atp = AsnReadId(aip,amp, atp);
6556    }
6557 
6558    if (AsnReadVal(aip, atp, &av) <= 0) {
6559       goto erret;
6560    }
6561    /* end struct */
6562 
6563 ret:
6564    AsnUnlinkType(orig);       /* unlink local tree */
6565    return ptr;
6566 
6567 erret:
6568    aip -> io_failure = TRUE;
6569    ptr = StructuredCommentFieldPairFree(ptr);
6570    goto ret;
6571 }
6572 
6573 
6574 
6575 /**************************************************
6576 *
6577 *    StructuredCommentFieldPairAsnWrite()
6578 *
6579 **************************************************/
6580 NLM_EXTERN Boolean LIBCALL
StructuredCommentFieldPairAsnWrite(StructuredCommentFieldPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6581 StructuredCommentFieldPairAsnWrite(StructuredCommentFieldPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6582 {
6583    DataVal av;
6584    AsnTypePtr atp;
6585    Boolean retval = FALSE;
6586 
6587    if (! loaded)
6588    {
6589       if (! objmacroAsnLoad()) {
6590          return FALSE;
6591       }
6592    }
6593 
6594    if (aip == NULL) {
6595       return FALSE;
6596    }
6597 
6598    atp = AsnLinkType(orig, STRUCTURED_COMMENT_FIELD_PAIR);   /* link local tree */
6599    if (atp == NULL) {
6600       return FALSE;
6601    }
6602 
6603    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6604 
6605     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6606 
6607    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6608       goto erret;
6609    }
6610 
6611    if (ptr -> from != NULL) {
6612       if ( ! StructuredCommentFieldAsnWrite(ptr -> from, aip, STRUCTURED_COMMENT_FIELD_PAIR_from)) {
6613          goto erret;
6614       }
6615    }
6616    if (ptr -> to != NULL) {
6617       if ( ! StructuredCommentFieldAsnWrite(ptr -> to, aip, STRUCTURED_COMMENT_FIELD_PAIR_to)) {
6618          goto erret;
6619       }
6620    }
6621    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6622       goto erret;
6623    }
6624    retval = TRUE;
6625 
6626 erret:
6627    AsnUnlinkType(orig);       /* unlink local tree */
6628    return retval;
6629 }
6630 
6631 
6632 
6633 /**************************************************
6634 *
6635 *    DBLinkFieldPairNew()
6636 *
6637 **************************************************/
6638 NLM_EXTERN
6639 DBLinkFieldPairPtr LIBCALL
DBLinkFieldPairNew(void)6640 DBLinkFieldPairNew(void)
6641 {
6642    DBLinkFieldPairPtr ptr = MemNew((size_t) sizeof(DBLinkFieldPair));
6643 
6644    return ptr;
6645 
6646 }
6647 
6648 
6649 /**************************************************
6650 *
6651 *    DBLinkFieldPairFree()
6652 *
6653 **************************************************/
6654 NLM_EXTERN
6655 DBLinkFieldPairPtr LIBCALL
DBLinkFieldPairFree(DBLinkFieldPairPtr ptr)6656 DBLinkFieldPairFree(DBLinkFieldPairPtr ptr)
6657 {
6658 
6659    if(ptr == NULL) {
6660       return NULL;
6661    }
6662    return MemFree(ptr);
6663 }
6664 
6665 
6666 /**************************************************
6667 *
6668 *    DBLinkFieldPairAsnRead()
6669 *
6670 **************************************************/
6671 NLM_EXTERN
6672 DBLinkFieldPairPtr LIBCALL
DBLinkFieldPairAsnRead(AsnIoPtr aip,AsnTypePtr orig)6673 DBLinkFieldPairAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6674 {
6675    DataVal av;
6676    AsnTypePtr atp;
6677    Boolean isError = FALSE;
6678    AsnReadFunc func;
6679    DBLinkFieldPairPtr ptr;
6680 
6681    if (! loaded)
6682    {
6683       if (! objmacroAsnLoad()) {
6684          return NULL;
6685       }
6686    }
6687 
6688    if (aip == NULL) {
6689       return NULL;
6690    }
6691 
6692    if (orig == NULL) {         /* DBLinkFieldPair ::= (self contained) */
6693       atp = AsnReadId(aip, amp, DBLINK_FIELD_PAIR);
6694    } else {
6695       atp = AsnLinkType(orig, DBLINK_FIELD_PAIR);
6696    }
6697    /* link in local tree */
6698    if (atp == NULL) {
6699       return NULL;
6700    }
6701 
6702    ptr = DBLinkFieldPairNew();
6703    if (ptr == NULL) {
6704       goto erret;
6705    }
6706    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6707       goto erret;
6708    }
6709 
6710    atp = AsnReadId(aip,amp, atp);
6711    func = NULL;
6712 
6713    if (atp == DBLINK_FIELD_PAIR_from) {
6714       if ( AsnReadVal(aip, atp, &av) <= 0) {
6715          goto erret;
6716       }
6717       ptr -> from = av.intvalue;
6718       atp = AsnReadId(aip,amp, atp);
6719    }
6720    if (atp == DBLINK_FIELD_PAIR_to) {
6721       if ( AsnReadVal(aip, atp, &av) <= 0) {
6722          goto erret;
6723       }
6724       ptr -> to = av.intvalue;
6725       atp = AsnReadId(aip,amp, atp);
6726    }
6727 
6728    if (AsnReadVal(aip, atp, &av) <= 0) {
6729       goto erret;
6730    }
6731    /* end struct */
6732 
6733 ret:
6734    AsnUnlinkType(orig);       /* unlink local tree */
6735    return ptr;
6736 
6737 erret:
6738    aip -> io_failure = TRUE;
6739    ptr = DBLinkFieldPairFree(ptr);
6740    goto ret;
6741 }
6742 
6743 
6744 
6745 /**************************************************
6746 *
6747 *    DBLinkFieldPairAsnWrite()
6748 *
6749 **************************************************/
6750 NLM_EXTERN Boolean LIBCALL
DBLinkFieldPairAsnWrite(DBLinkFieldPairPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6751 DBLinkFieldPairAsnWrite(DBLinkFieldPairPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6752 {
6753    DataVal av;
6754    AsnTypePtr atp;
6755    Boolean retval = FALSE;
6756 
6757    if (! loaded)
6758    {
6759       if (! objmacroAsnLoad()) {
6760          return FALSE;
6761       }
6762    }
6763 
6764    if (aip == NULL) {
6765       return FALSE;
6766    }
6767 
6768    atp = AsnLinkType(orig, DBLINK_FIELD_PAIR);   /* link local tree */
6769    if (atp == NULL) {
6770       return FALSE;
6771    }
6772 
6773    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6774 
6775     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6776 
6777    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6778       goto erret;
6779    }
6780 
6781    av.intvalue = ptr -> from;
6782    retval = AsnWrite(aip, DBLINK_FIELD_PAIR_from,  &av);
6783    av.intvalue = ptr -> to;
6784    retval = AsnWrite(aip, DBLINK_FIELD_PAIR_to,  &av);
6785    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6786       goto erret;
6787    }
6788    retval = TRUE;
6789 
6790 erret:
6791    AsnUnlinkType(orig);       /* unlink local tree */
6792    return retval;
6793 }
6794 
6795 
6796 
6797 /**************************************************
6798 *
6799 *    PubFieldConstraintNew()
6800 *
6801 **************************************************/
6802 NLM_EXTERN
6803 PubFieldConstraintPtr LIBCALL
PubFieldConstraintNew(void)6804 PubFieldConstraintNew(void)
6805 {
6806    PubFieldConstraintPtr ptr = MemNew((size_t) sizeof(PubFieldConstraint));
6807 
6808    return ptr;
6809 
6810 }
6811 
6812 
6813 /**************************************************
6814 *
6815 *    PubFieldConstraintFree()
6816 *
6817 **************************************************/
6818 NLM_EXTERN
6819 PubFieldConstraintPtr LIBCALL
PubFieldConstraintFree(PubFieldConstraintPtr ptr)6820 PubFieldConstraintFree(PubFieldConstraintPtr ptr)
6821 {
6822 
6823    if(ptr == NULL) {
6824       return NULL;
6825    }
6826    StringConstraintFree(ptr -> constraint);
6827    return MemFree(ptr);
6828 }
6829 
6830 
6831 /**************************************************
6832 *
6833 *    PubFieldConstraintAsnRead()
6834 *
6835 **************************************************/
6836 NLM_EXTERN
6837 PubFieldConstraintPtr LIBCALL
PubFieldConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)6838 PubFieldConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6839 {
6840    DataVal av;
6841    AsnTypePtr atp;
6842    Boolean isError = FALSE;
6843    AsnReadFunc func;
6844    PubFieldConstraintPtr ptr;
6845 
6846    if (! loaded)
6847    {
6848       if (! objmacroAsnLoad()) {
6849          return NULL;
6850       }
6851    }
6852 
6853    if (aip == NULL) {
6854       return NULL;
6855    }
6856 
6857    if (orig == NULL) {         /* PubFieldConstraint ::= (self contained) */
6858       atp = AsnReadId(aip, amp, PUB_FIELD_CONSTRAINT);
6859    } else {
6860       atp = AsnLinkType(orig, PUB_FIELD_CONSTRAINT);
6861    }
6862    /* link in local tree */
6863    if (atp == NULL) {
6864       return NULL;
6865    }
6866 
6867    ptr = PubFieldConstraintNew();
6868    if (ptr == NULL) {
6869       goto erret;
6870    }
6871    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6872       goto erret;
6873    }
6874 
6875    atp = AsnReadId(aip,amp, atp);
6876    func = NULL;
6877 
6878    if (atp == PUB_FIELD_CONSTRAINT_field) {
6879       if ( AsnReadVal(aip, atp, &av) <= 0) {
6880          goto erret;
6881       }
6882       ptr -> field = av.intvalue;
6883       atp = AsnReadId(aip,amp, atp);
6884    }
6885    if (atp == PUB_FIELD_CONSTRAINT_constraint) {
6886       ptr -> constraint = StringConstraintAsnRead(aip, atp);
6887       if (aip -> io_failure) {
6888          goto erret;
6889       }
6890       atp = AsnReadId(aip,amp, atp);
6891    }
6892 
6893    if (AsnReadVal(aip, atp, &av) <= 0) {
6894       goto erret;
6895    }
6896    /* end struct */
6897 
6898 ret:
6899    AsnUnlinkType(orig);       /* unlink local tree */
6900    return ptr;
6901 
6902 erret:
6903    aip -> io_failure = TRUE;
6904    ptr = PubFieldConstraintFree(ptr);
6905    goto ret;
6906 }
6907 
6908 
6909 
6910 /**************************************************
6911 *
6912 *    PubFieldConstraintAsnWrite()
6913 *
6914 **************************************************/
6915 NLM_EXTERN Boolean LIBCALL
PubFieldConstraintAsnWrite(PubFieldConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6916 PubFieldConstraintAsnWrite(PubFieldConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6917 {
6918    DataVal av;
6919    AsnTypePtr atp;
6920    Boolean retval = FALSE;
6921 
6922    if (! loaded)
6923    {
6924       if (! objmacroAsnLoad()) {
6925          return FALSE;
6926       }
6927    }
6928 
6929    if (aip == NULL) {
6930       return FALSE;
6931    }
6932 
6933    atp = AsnLinkType(orig, PUB_FIELD_CONSTRAINT);   /* link local tree */
6934    if (atp == NULL) {
6935       return FALSE;
6936    }
6937 
6938    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6939 
6940     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6941 
6942    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6943       goto erret;
6944    }
6945 
6946    av.intvalue = ptr -> field;
6947    retval = AsnWrite(aip, PUB_FIELD_CONSTRAINT_field,  &av);
6948    if (ptr -> constraint != NULL) {
6949       if ( ! StringConstraintAsnWrite(ptr -> constraint, aip, PUB_FIELD_CONSTRAINT_constraint)) {
6950          goto erret;
6951       }
6952    }
6953    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6954       goto erret;
6955    }
6956    retval = TRUE;
6957 
6958 erret:
6959    AsnUnlinkType(orig);       /* unlink local tree */
6960    return retval;
6961 }
6962 
6963 
6964 
6965 /**************************************************
6966 *
6967 *    PubFieldSpecialConstraintTypeFree()
6968 *
6969 **************************************************/
6970 NLM_EXTERN
6971 PubFieldSpecialConstraintTypePtr LIBCALL
PubFieldSpecialConstraintTypeFree(ValNodePtr anp)6972 PubFieldSpecialConstraintTypeFree(ValNodePtr anp)
6973 {
6974    Pointer pnt;
6975 
6976    if (anp == NULL) {
6977       return NULL;
6978    }
6979 
6980    pnt = anp->data.ptrvalue;
6981    switch (anp->choice)
6982    {
6983    default:
6984       break;
6985    }
6986    return MemFree(anp);
6987 }
6988 
6989 
6990 /**************************************************
6991 *
6992 *    PubFieldSpecialConstraintTypeAsnRead()
6993 *
6994 **************************************************/
6995 NLM_EXTERN
6996 PubFieldSpecialConstraintTypePtr LIBCALL
PubFieldSpecialConstraintTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)6997 PubFieldSpecialConstraintTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6998 {
6999    DataVal av;
7000    AsnTypePtr atp;
7001    ValNodePtr anp;
7002    Uint1 choice;
7003    Boolean isError = FALSE;
7004    Boolean nullIsError = FALSE;
7005    AsnReadFunc func;
7006 
7007    if (! loaded)
7008    {
7009       if (! objmacroAsnLoad()) {
7010          return NULL;
7011       }
7012    }
7013 
7014    if (aip == NULL) {
7015       return NULL;
7016    }
7017 
7018    if (orig == NULL) {         /* PubFieldSpecialConstraintType ::= (self contained) */
7019       atp = AsnReadId(aip, amp, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE);
7020    } else {
7021       atp = AsnLinkType(orig, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE);    /* link in local tree */
7022    }
7023    if (atp == NULL) {
7024       return NULL;
7025    }
7026 
7027    anp = ValNodeNew(NULL);
7028    if (anp == NULL) {
7029       goto erret;
7030    }
7031    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
7032       goto erret;
7033    }
7034 
7035    func = NULL;
7036 
7037    atp = AsnReadId(aip, amp, atp);  /* find the choice */
7038    if (atp == NULL) {
7039       goto erret;
7040    }
7041    if (atp == PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_present) {
7042       choice = PubFieldSpecialConstraintType_is_present;
7043       if (AsnReadVal(aip, atp, &av) <= 0) {
7044          goto erret;
7045       }
7046       anp->data.boolvalue = av.boolvalue;
7047    }
7048    else if (atp == PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_not_present) {
7049       choice = PubFieldSpecialConstraintType_is_not_present;
7050       if (AsnReadVal(aip, atp, &av) <= 0) {
7051          goto erret;
7052       }
7053       anp->data.boolvalue = av.boolvalue;
7054    }
7055    else if (atp == PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_all_caps) {
7056       choice = PubFieldSpecialConstraintType_is_all_caps;
7057       if (AsnReadVal(aip, atp, &av) <= 0) {
7058          goto erret;
7059       }
7060       anp->data.boolvalue = av.boolvalue;
7061    }
7062    else if (atp == PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_all_lower) {
7063       choice = PubFieldSpecialConstraintType_is_all_lower;
7064       if (AsnReadVal(aip, atp, &av) <= 0) {
7065          goto erret;
7066       }
7067       anp->data.boolvalue = av.boolvalue;
7068    }
7069    else if (atp == PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_all_punct) {
7070       choice = PubFieldSpecialConstraintType_is_all_punct;
7071       if (AsnReadVal(aip, atp, &av) <= 0) {
7072          goto erret;
7073       }
7074       anp->data.boolvalue = av.boolvalue;
7075    }
7076    anp->choice = choice;
7077    if (func != NULL)
7078    {
7079       anp->data.ptrvalue = (* func)(aip, atp);
7080       if (aip -> io_failure) goto erret;
7081 
7082       if (nullIsError && anp->data.ptrvalue == NULL) {
7083          goto erret;
7084       }
7085    }
7086 
7087 ret:
7088    AsnUnlinkType(orig);       /* unlink local tree */
7089    return anp;
7090 
7091 erret:
7092    anp = MemFree(anp);
7093    aip -> io_failure = TRUE;
7094    goto ret;
7095 }
7096 
7097 
7098 /**************************************************
7099 *
7100 *    PubFieldSpecialConstraintTypeAsnWrite()
7101 *
7102 **************************************************/
7103 NLM_EXTERN Boolean LIBCALL
PubFieldSpecialConstraintTypeAsnWrite(PubFieldSpecialConstraintTypePtr anp,AsnIoPtr aip,AsnTypePtr orig)7104 PubFieldSpecialConstraintTypeAsnWrite(PubFieldSpecialConstraintTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
7105 
7106 {
7107    DataVal av;
7108    AsnTypePtr atp, writetype = NULL;
7109    Pointer pnt;
7110    AsnWriteFunc func = NULL;
7111    Boolean retval = FALSE;
7112 
7113    if (! loaded)
7114    {
7115       if (! objmacroAsnLoad())
7116       return FALSE;
7117    }
7118 
7119    if (aip == NULL)
7120    return FALSE;
7121 
7122    atp = AsnLinkType(orig, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE);   /* link local tree */
7123    if (atp == NULL) {
7124       return FALSE;
7125    }
7126 
7127    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7128 
7129     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
7130 
7131    av.ptrvalue = (Pointer)anp;
7132    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
7133       goto erret;
7134    }
7135 
7136    pnt = anp->data.ptrvalue;
7137    switch (anp->choice)
7138    {
7139    case PubFieldSpecialConstraintType_is_present:
7140       av.boolvalue = anp->data.boolvalue;
7141       retval = AsnWrite(aip, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_present, &av);
7142       break;
7143    case PubFieldSpecialConstraintType_is_not_present:
7144       av.boolvalue = anp->data.boolvalue;
7145       retval = AsnWrite(aip, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_not_present, &av);
7146       break;
7147    case PubFieldSpecialConstraintType_is_all_caps:
7148       av.boolvalue = anp->data.boolvalue;
7149       retval = AsnWrite(aip, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_all_caps, &av);
7150       break;
7151    case PubFieldSpecialConstraintType_is_all_lower:
7152       av.boolvalue = anp->data.boolvalue;
7153       retval = AsnWrite(aip, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_all_lower, &av);
7154       break;
7155    case PubFieldSpecialConstraintType_is_all_punct:
7156       av.boolvalue = anp->data.boolvalue;
7157       retval = AsnWrite(aip, PUB_FIELD_SPECIAL_CONSTRAINT_TYPE_is_all_punct, &av);
7158       break;
7159    }
7160    if (writetype != NULL) {
7161       retval = (* func)(pnt, aip, writetype);   /* write it out */
7162    }
7163    if (!retval) {
7164       goto erret;
7165    }
7166    retval = TRUE;
7167 
7168 erret:
7169    AsnUnlinkType(orig);       /* unlink local tree */
7170    return retval;
7171 }
7172 
7173 
7174 /**************************************************
7175 *
7176 *    PubFieldSpecialConstraintNew()
7177 *
7178 **************************************************/
7179 NLM_EXTERN
7180 PubFieldSpecialConstraintPtr LIBCALL
PubFieldSpecialConstraintNew(void)7181 PubFieldSpecialConstraintNew(void)
7182 {
7183    PubFieldSpecialConstraintPtr ptr = MemNew((size_t) sizeof(PubFieldSpecialConstraint));
7184 
7185    return ptr;
7186 
7187 }
7188 
7189 
7190 /**************************************************
7191 *
7192 *    PubFieldSpecialConstraintFree()
7193 *
7194 **************************************************/
7195 NLM_EXTERN
7196 PubFieldSpecialConstraintPtr LIBCALL
PubFieldSpecialConstraintFree(PubFieldSpecialConstraintPtr ptr)7197 PubFieldSpecialConstraintFree(PubFieldSpecialConstraintPtr ptr)
7198 {
7199 
7200    if(ptr == NULL) {
7201       return NULL;
7202    }
7203    PubFieldSpecialConstraintTypeFree(ptr -> constraint);
7204    return MemFree(ptr);
7205 }
7206 
7207 
7208 /**************************************************
7209 *
7210 *    PubFieldSpecialConstraintAsnRead()
7211 *
7212 **************************************************/
7213 NLM_EXTERN
7214 PubFieldSpecialConstraintPtr LIBCALL
PubFieldSpecialConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)7215 PubFieldSpecialConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7216 {
7217    DataVal av;
7218    AsnTypePtr atp;
7219    Boolean isError = FALSE;
7220    AsnReadFunc func;
7221    PubFieldSpecialConstraintPtr ptr;
7222 
7223    if (! loaded)
7224    {
7225       if (! objmacroAsnLoad()) {
7226          return NULL;
7227       }
7228    }
7229 
7230    if (aip == NULL) {
7231       return NULL;
7232    }
7233 
7234    if (orig == NULL) {         /* PubFieldSpecialConstraint ::= (self contained) */
7235       atp = AsnReadId(aip, amp, PUB_FIELD_SPECIAL_CONSTRAINT);
7236    } else {
7237       atp = AsnLinkType(orig, PUB_FIELD_SPECIAL_CONSTRAINT);
7238    }
7239    /* link in local tree */
7240    if (atp == NULL) {
7241       return NULL;
7242    }
7243 
7244    ptr = PubFieldSpecialConstraintNew();
7245    if (ptr == NULL) {
7246       goto erret;
7247    }
7248    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
7249       goto erret;
7250    }
7251 
7252    atp = AsnReadId(aip,amp, atp);
7253    func = NULL;
7254 
7255    if (atp == PUB_FIELD_SPECIAL_CONSTRAINT_field) {
7256       if ( AsnReadVal(aip, atp, &av) <= 0) {
7257          goto erret;
7258       }
7259       ptr -> field = av.intvalue;
7260       atp = AsnReadId(aip,amp, atp);
7261    }
7262    if (atp == PUB_FIELD_SPECIAL_CONSTRAINT_constraint) {
7263       ptr -> constraint = PubFieldSpecialConstraintTypeAsnRead(aip, atp);
7264       if (aip -> io_failure) {
7265          goto erret;
7266       }
7267       atp = AsnReadId(aip,amp, atp);
7268    }
7269 
7270    if (AsnReadVal(aip, atp, &av) <= 0) {
7271       goto erret;
7272    }
7273    /* end struct */
7274 
7275 ret:
7276    AsnUnlinkType(orig);       /* unlink local tree */
7277    return ptr;
7278 
7279 erret:
7280    aip -> io_failure = TRUE;
7281    ptr = PubFieldSpecialConstraintFree(ptr);
7282    goto ret;
7283 }
7284 
7285 
7286 
7287 /**************************************************
7288 *
7289 *    PubFieldSpecialConstraintAsnWrite()
7290 *
7291 **************************************************/
7292 NLM_EXTERN Boolean LIBCALL
PubFieldSpecialConstraintAsnWrite(PubFieldSpecialConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)7293 PubFieldSpecialConstraintAsnWrite(PubFieldSpecialConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
7294 {
7295    DataVal av;
7296    AsnTypePtr atp;
7297    Boolean retval = FALSE;
7298 
7299    if (! loaded)
7300    {
7301       if (! objmacroAsnLoad()) {
7302          return FALSE;
7303       }
7304    }
7305 
7306    if (aip == NULL) {
7307       return FALSE;
7308    }
7309 
7310    atp = AsnLinkType(orig, PUB_FIELD_SPECIAL_CONSTRAINT);   /* link local tree */
7311    if (atp == NULL) {
7312       return FALSE;
7313    }
7314 
7315    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7316 
7317     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
7318 
7319    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
7320       goto erret;
7321    }
7322 
7323    av.intvalue = ptr -> field;
7324    retval = AsnWrite(aip, PUB_FIELD_SPECIAL_CONSTRAINT_field,  &av);
7325    if (ptr -> constraint != NULL) {
7326       if ( ! PubFieldSpecialConstraintTypeAsnWrite(ptr -> constraint, aip, PUB_FIELD_SPECIAL_CONSTRAINT_constraint)) {
7327          goto erret;
7328       }
7329    }
7330    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
7331       goto erret;
7332    }
7333    retval = TRUE;
7334 
7335 erret:
7336    AsnUnlinkType(orig);       /* unlink local tree */
7337    return retval;
7338 }
7339 
7340 
7341 
7342 /**************************************************
7343 *
7344 *    PublicationConstraintNew()
7345 *
7346 **************************************************/
7347 NLM_EXTERN
7348 PublicationConstraintPtr LIBCALL
PublicationConstraintNew(void)7349 PublicationConstraintNew(void)
7350 {
7351    PublicationConstraintPtr ptr = MemNew((size_t) sizeof(PublicationConstraint));
7352 
7353    return ptr;
7354 
7355 }
7356 
7357 
7358 /**************************************************
7359 *
7360 *    PublicationConstraintFree()
7361 *
7362 **************************************************/
7363 NLM_EXTERN
7364 PublicationConstraintPtr LIBCALL
PublicationConstraintFree(PublicationConstraintPtr ptr)7365 PublicationConstraintFree(PublicationConstraintPtr ptr)
7366 {
7367 
7368    if(ptr == NULL) {
7369       return NULL;
7370    }
7371    PubFieldConstraintFree(ptr -> field);
7372    PubFieldSpecialConstraintFree(ptr -> special_field);
7373    return MemFree(ptr);
7374 }
7375 
7376 
7377 /**************************************************
7378 *
7379 *    PublicationConstraintAsnRead()
7380 *
7381 **************************************************/
7382 NLM_EXTERN
7383 PublicationConstraintPtr LIBCALL
PublicationConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)7384 PublicationConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7385 {
7386    DataVal av;
7387    AsnTypePtr atp;
7388    Boolean isError = FALSE;
7389    AsnReadFunc func;
7390    PublicationConstraintPtr ptr;
7391 
7392    if (! loaded)
7393    {
7394       if (! objmacroAsnLoad()) {
7395          return NULL;
7396       }
7397    }
7398 
7399    if (aip == NULL) {
7400       return NULL;
7401    }
7402 
7403    if (orig == NULL) {         /* PublicationConstraint ::= (self contained) */
7404       atp = AsnReadId(aip, amp, PUBLICATION_CONSTRAINT);
7405    } else {
7406       atp = AsnLinkType(orig, PUBLICATION_CONSTRAINT);
7407    }
7408    /* link in local tree */
7409    if (atp == NULL) {
7410       return NULL;
7411    }
7412 
7413    ptr = PublicationConstraintNew();
7414    if (ptr == NULL) {
7415       goto erret;
7416    }
7417    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
7418       goto erret;
7419    }
7420 
7421    atp = AsnReadId(aip,amp, atp);
7422    func = NULL;
7423 
7424    if (atp == PUBLICATION_CONSTRAINT_type) {
7425       if ( AsnReadVal(aip, atp, &av) <= 0) {
7426          goto erret;
7427       }
7428       ptr -> type = av.intvalue;
7429       atp = AsnReadId(aip,amp, atp);
7430    }
7431    if (atp == PUBLICATION_CONSTRAINT_field) {
7432       ptr -> field = PubFieldConstraintAsnRead(aip, atp);
7433       if (aip -> io_failure) {
7434          goto erret;
7435       }
7436       atp = AsnReadId(aip,amp, atp);
7437    }
7438    if (atp == PUBLICATION_CONSTRAINT_special_field) {
7439       ptr -> special_field = PubFieldSpecialConstraintAsnRead(aip, atp);
7440       if (aip -> io_failure) {
7441          goto erret;
7442       }
7443       atp = AsnReadId(aip,amp, atp);
7444    }
7445 
7446    if (AsnReadVal(aip, atp, &av) <= 0) {
7447       goto erret;
7448    }
7449    /* end struct */
7450 
7451 ret:
7452    AsnUnlinkType(orig);       /* unlink local tree */
7453    return ptr;
7454 
7455 erret:
7456    aip -> io_failure = TRUE;
7457    ptr = PublicationConstraintFree(ptr);
7458    goto ret;
7459 }
7460 
7461 
7462 
7463 /**************************************************
7464 *
7465 *    PublicationConstraintAsnWrite()
7466 *
7467 **************************************************/
7468 NLM_EXTERN Boolean LIBCALL
PublicationConstraintAsnWrite(PublicationConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)7469 PublicationConstraintAsnWrite(PublicationConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
7470 {
7471    DataVal av;
7472    AsnTypePtr atp;
7473    Boolean retval = FALSE;
7474 
7475    if (! loaded)
7476    {
7477       if (! objmacroAsnLoad()) {
7478          return FALSE;
7479       }
7480    }
7481 
7482    if (aip == NULL) {
7483       return FALSE;
7484    }
7485 
7486    atp = AsnLinkType(orig, PUBLICATION_CONSTRAINT);   /* link local tree */
7487    if (atp == NULL) {
7488       return FALSE;
7489    }
7490 
7491    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7492 
7493     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
7494 
7495    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
7496       goto erret;
7497    }
7498 
7499    av.intvalue = ptr -> type;
7500    retval = AsnWrite(aip, PUBLICATION_CONSTRAINT_type,  &av);
7501    if (ptr -> field != NULL) {
7502       if ( ! PubFieldConstraintAsnWrite(ptr -> field, aip, PUBLICATION_CONSTRAINT_field)) {
7503          goto erret;
7504       }
7505    }
7506    if (ptr -> special_field != NULL) {
7507       if ( ! PubFieldSpecialConstraintAsnWrite(ptr -> special_field, aip, PUBLICATION_CONSTRAINT_special_field)) {
7508          goto erret;
7509       }
7510    }
7511    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
7512       goto erret;
7513    }
7514    retval = TRUE;
7515 
7516 erret:
7517    AsnUnlinkType(orig);       /* unlink local tree */
7518    return retval;
7519 }
7520 
7521 
7522 
7523 /**************************************************
7524 *
7525 *    SourceConstraintNew()
7526 *
7527 **************************************************/
7528 NLM_EXTERN
7529 SourceConstraintPtr LIBCALL
SourceConstraintNew(void)7530 SourceConstraintNew(void)
7531 {
7532    SourceConstraintPtr ptr = MemNew((size_t) sizeof(SourceConstraint));
7533 
7534    return ptr;
7535 
7536 }
7537 
7538 
7539 /**************************************************
7540 *
7541 *    SourceConstraintFree()
7542 *
7543 **************************************************/
7544 NLM_EXTERN
7545 SourceConstraintPtr LIBCALL
SourceConstraintFree(SourceConstraintPtr ptr)7546 SourceConstraintFree(SourceConstraintPtr ptr)
7547 {
7548 
7549    if(ptr == NULL) {
7550       return NULL;
7551    }
7552    SourceQualChoiceFree(ptr -> field1);
7553    SourceQualChoiceFree(ptr -> field2);
7554    StringConstraintFree(ptr -> constraint);
7555    return MemFree(ptr);
7556 }
7557 
7558 
7559 /**************************************************
7560 *
7561 *    SourceConstraintAsnRead()
7562 *
7563 **************************************************/
7564 NLM_EXTERN
7565 SourceConstraintPtr LIBCALL
SourceConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)7566 SourceConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7567 {
7568    DataVal av;
7569    AsnTypePtr atp;
7570    Boolean isError = FALSE;
7571    AsnReadFunc func;
7572    SourceConstraintPtr ptr;
7573 
7574    if (! loaded)
7575    {
7576       if (! objmacroAsnLoad()) {
7577          return NULL;
7578       }
7579    }
7580 
7581    if (aip == NULL) {
7582       return NULL;
7583    }
7584 
7585    if (orig == NULL) {         /* SourceConstraint ::= (self contained) */
7586       atp = AsnReadId(aip, amp, SOURCE_CONSTRAINT);
7587    } else {
7588       atp = AsnLinkType(orig, SOURCE_CONSTRAINT);
7589    }
7590    /* link in local tree */
7591    if (atp == NULL) {
7592       return NULL;
7593    }
7594 
7595    ptr = SourceConstraintNew();
7596    if (ptr == NULL) {
7597       goto erret;
7598    }
7599    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
7600       goto erret;
7601    }
7602 
7603    atp = AsnReadId(aip,amp, atp);
7604    func = NULL;
7605 
7606    if (atp == SOURCE_CONSTRAINT_field1) {
7607       ptr -> field1 = SourceQualChoiceAsnRead(aip, atp);
7608       if (aip -> io_failure) {
7609          goto erret;
7610       }
7611       atp = AsnReadId(aip,amp, atp);
7612    }
7613    if (atp == SOURCE_CONSTRAINT_field2) {
7614       ptr -> field2 = SourceQualChoiceAsnRead(aip, atp);
7615       if (aip -> io_failure) {
7616          goto erret;
7617       }
7618       atp = AsnReadId(aip,amp, atp);
7619    }
7620    if (atp == SOURCE_CONSTRAINT_constraint) {
7621       ptr -> constraint = StringConstraintAsnRead(aip, atp);
7622       if (aip -> io_failure) {
7623          goto erret;
7624       }
7625       atp = AsnReadId(aip,amp, atp);
7626    }
7627    if (atp == SOURCE_CONSTRAINT_type_constraint) {
7628       if ( AsnReadVal(aip, atp, &av) <= 0) {
7629          goto erret;
7630       }
7631       ptr -> type_constraint = av.intvalue;
7632       atp = AsnReadId(aip,amp, atp);
7633    }
7634 
7635    if (AsnReadVal(aip, atp, &av) <= 0) {
7636       goto erret;
7637    }
7638    /* end struct */
7639 
7640 ret:
7641    AsnUnlinkType(orig);       /* unlink local tree */
7642    return ptr;
7643 
7644 erret:
7645    aip -> io_failure = TRUE;
7646    ptr = SourceConstraintFree(ptr);
7647    goto ret;
7648 }
7649 
7650 
7651 
7652 /**************************************************
7653 *
7654 *    SourceConstraintAsnWrite()
7655 *
7656 **************************************************/
7657 NLM_EXTERN Boolean LIBCALL
SourceConstraintAsnWrite(SourceConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)7658 SourceConstraintAsnWrite(SourceConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
7659 {
7660    DataVal av;
7661    AsnTypePtr atp;
7662    Boolean retval = FALSE;
7663 
7664    if (! loaded)
7665    {
7666       if (! objmacroAsnLoad()) {
7667          return FALSE;
7668       }
7669    }
7670 
7671    if (aip == NULL) {
7672       return FALSE;
7673    }
7674 
7675    atp = AsnLinkType(orig, SOURCE_CONSTRAINT);   /* link local tree */
7676    if (atp == NULL) {
7677       return FALSE;
7678    }
7679 
7680    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7681 
7682     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
7683 
7684    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
7685       goto erret;
7686    }
7687 
7688    if (ptr -> field1 != NULL) {
7689       if ( ! SourceQualChoiceAsnWrite(ptr -> field1, aip, SOURCE_CONSTRAINT_field1)) {
7690          goto erret;
7691       }
7692    }
7693    if (ptr -> field2 != NULL) {
7694       if ( ! SourceQualChoiceAsnWrite(ptr -> field2, aip, SOURCE_CONSTRAINT_field2)) {
7695          goto erret;
7696       }
7697    }
7698    if (ptr -> constraint != NULL) {
7699       if ( ! StringConstraintAsnWrite(ptr -> constraint, aip, SOURCE_CONSTRAINT_constraint)) {
7700          goto erret;
7701       }
7702    }
7703    av.intvalue = ptr -> type_constraint;
7704    retval = AsnWrite(aip, SOURCE_CONSTRAINT_type_constraint,  &av);
7705    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
7706       goto erret;
7707    }
7708    retval = TRUE;
7709 
7710 erret:
7711    AsnUnlinkType(orig);       /* unlink local tree */
7712    return retval;
7713 }
7714 
7715 
7716 
7717 /**************************************************
7718 *
7719 *    CDSGeneProtPseudoConstraintNew()
7720 *
7721 **************************************************/
7722 NLM_EXTERN
7723 CDSGeneProtPseudoConstraintPtr LIBCALL
CDSGeneProtPseudoConstraintNew(void)7724 CDSGeneProtPseudoConstraintNew(void)
7725 {
7726    CDSGeneProtPseudoConstraintPtr ptr = MemNew((size_t) sizeof(CDSGeneProtPseudoConstraint));
7727 
7728    ptr -> is_pseudo = 1;
7729    return ptr;
7730 
7731 }
7732 
7733 
7734 /**************************************************
7735 *
7736 *    CDSGeneProtPseudoConstraintFree()
7737 *
7738 **************************************************/
7739 NLM_EXTERN
7740 CDSGeneProtPseudoConstraintPtr LIBCALL
CDSGeneProtPseudoConstraintFree(CDSGeneProtPseudoConstraintPtr ptr)7741 CDSGeneProtPseudoConstraintFree(CDSGeneProtPseudoConstraintPtr ptr)
7742 {
7743 
7744    if(ptr == NULL) {
7745       return NULL;
7746    }
7747    return MemFree(ptr);
7748 }
7749 
7750 
7751 /**************************************************
7752 *
7753 *    CDSGeneProtPseudoConstraintAsnRead()
7754 *
7755 **************************************************/
7756 NLM_EXTERN
7757 CDSGeneProtPseudoConstraintPtr LIBCALL
CDSGeneProtPseudoConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)7758 CDSGeneProtPseudoConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7759 {
7760    DataVal av;
7761    AsnTypePtr atp;
7762    Boolean isError = FALSE;
7763    AsnReadFunc func;
7764    CDSGeneProtPseudoConstraintPtr ptr;
7765 
7766    if (! loaded)
7767    {
7768       if (! objmacroAsnLoad()) {
7769          return NULL;
7770       }
7771    }
7772 
7773    if (aip == NULL) {
7774       return NULL;
7775    }
7776 
7777    if (orig == NULL) {         /* CDSGeneProtPseudoConstraint ::= (self contained) */
7778       atp = AsnReadId(aip, amp, CDSGENEPROT_PSEUDO_CONSTRAINT);
7779    } else {
7780       atp = AsnLinkType(orig, CDSGENEPROT_PSEUDO_CONSTRAINT);
7781    }
7782    /* link in local tree */
7783    if (atp == NULL) {
7784       return NULL;
7785    }
7786 
7787    ptr = CDSGeneProtPseudoConstraintNew();
7788    if (ptr == NULL) {
7789       goto erret;
7790    }
7791    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
7792       goto erret;
7793    }
7794 
7795    atp = AsnReadId(aip,amp, atp);
7796    func = NULL;
7797 
7798    if (atp == CDSGENEPROT_PSEUDO_CONSTRAINT_feature) {
7799       if ( AsnReadVal(aip, atp, &av) <= 0) {
7800          goto erret;
7801       }
7802       ptr -> feature = av.intvalue;
7803       atp = AsnReadId(aip,amp, atp);
7804    }
7805    if (atp == CDSGENEPROT_PSEUDO_CONSTRAINT_is_pseudo) {
7806       if ( AsnReadVal(aip, atp, &av) <= 0) {
7807          goto erret;
7808       }
7809       ptr -> is_pseudo = av.boolvalue;
7810       atp = AsnReadId(aip,amp, atp);
7811    }
7812 
7813    if (AsnReadVal(aip, atp, &av) <= 0) {
7814       goto erret;
7815    }
7816    /* end struct */
7817 
7818 ret:
7819    AsnUnlinkType(orig);       /* unlink local tree */
7820    return ptr;
7821 
7822 erret:
7823    aip -> io_failure = TRUE;
7824    ptr = CDSGeneProtPseudoConstraintFree(ptr);
7825    goto ret;
7826 }
7827 
7828 
7829 
7830 /**************************************************
7831 *
7832 *    CDSGeneProtPseudoConstraintAsnWrite()
7833 *
7834 **************************************************/
7835 NLM_EXTERN Boolean LIBCALL
CDSGeneProtPseudoConstraintAsnWrite(CDSGeneProtPseudoConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)7836 CDSGeneProtPseudoConstraintAsnWrite(CDSGeneProtPseudoConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
7837 {
7838    DataVal av;
7839    AsnTypePtr atp;
7840    Boolean retval = FALSE;
7841 
7842    if (! loaded)
7843    {
7844       if (! objmacroAsnLoad()) {
7845          return FALSE;
7846       }
7847    }
7848 
7849    if (aip == NULL) {
7850       return FALSE;
7851    }
7852 
7853    atp = AsnLinkType(orig, CDSGENEPROT_PSEUDO_CONSTRAINT);   /* link local tree */
7854    if (atp == NULL) {
7855       return FALSE;
7856    }
7857 
7858    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
7859 
7860     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
7861 
7862    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
7863       goto erret;
7864    }
7865 
7866    av.intvalue = ptr -> feature;
7867    retval = AsnWrite(aip, CDSGENEPROT_PSEUDO_CONSTRAINT_feature,  &av);
7868    av.boolvalue = ptr -> is_pseudo;
7869    retval = AsnWrite(aip, CDSGENEPROT_PSEUDO_CONSTRAINT_is_pseudo,  &av);
7870    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
7871       goto erret;
7872    }
7873    retval = TRUE;
7874 
7875 erret:
7876    AsnUnlinkType(orig);       /* unlink local tree */
7877    return retval;
7878 }
7879 
7880 
7881 
7882 /**************************************************
7883 *
7884 *    CDSGeneProtConstraintFieldFree()
7885 *
7886 **************************************************/
7887 NLM_EXTERN
7888 CDSGeneProtConstraintFieldPtr LIBCALL
CDSGeneProtConstraintFieldFree(ValNodePtr anp)7889 CDSGeneProtConstraintFieldFree(ValNodePtr anp)
7890 {
7891    Pointer pnt;
7892 
7893    if (anp == NULL) {
7894       return NULL;
7895    }
7896 
7897    pnt = anp->data.ptrvalue;
7898    switch (anp->choice)
7899    {
7900    default:
7901       break;
7902    }
7903    return MemFree(anp);
7904 }
7905 
7906 
7907 /**************************************************
7908 *
7909 *    CDSGeneProtConstraintFieldAsnRead()
7910 *
7911 **************************************************/
7912 NLM_EXTERN
7913 CDSGeneProtConstraintFieldPtr LIBCALL
CDSGeneProtConstraintFieldAsnRead(AsnIoPtr aip,AsnTypePtr orig)7914 CDSGeneProtConstraintFieldAsnRead(AsnIoPtr aip, AsnTypePtr orig)
7915 {
7916    DataVal av;
7917    AsnTypePtr atp;
7918    ValNodePtr anp;
7919    Uint1 choice;
7920    Boolean isError = FALSE;
7921    Boolean nullIsError = FALSE;
7922    AsnReadFunc func;
7923 
7924    if (! loaded)
7925    {
7926       if (! objmacroAsnLoad()) {
7927          return NULL;
7928       }
7929    }
7930 
7931    if (aip == NULL) {
7932       return NULL;
7933    }
7934 
7935    if (orig == NULL) {         /* CDSGeneProtConstraintField ::= (self contained) */
7936       atp = AsnReadId(aip, amp, CDSGENEPROT_CONSTRAINT_FIELD);
7937    } else {
7938       atp = AsnLinkType(orig, CDSGENEPROT_CONSTRAINT_FIELD);    /* link in local tree */
7939    }
7940    if (atp == NULL) {
7941       return NULL;
7942    }
7943 
7944    anp = ValNodeNew(NULL);
7945    if (anp == NULL) {
7946       goto erret;
7947    }
7948    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
7949       goto erret;
7950    }
7951 
7952    func = NULL;
7953 
7954    atp = AsnReadId(aip, amp, atp);  /* find the choice */
7955    if (atp == NULL) {
7956       goto erret;
7957    }
7958    if (atp == CDSGENEPROT_CONSTRAINT_FIELD_field) {
7959       choice = CDSGeneProtConstraintField_field;
7960       if (AsnReadVal(aip, atp, &av) <= 0) {
7961          goto erret;
7962       }
7963       anp->data.intvalue = av.intvalue;
7964    }
7965    anp->choice = choice;
7966    if (func != NULL)
7967    {
7968       anp->data.ptrvalue = (* func)(aip, atp);
7969       if (aip -> io_failure) goto erret;
7970 
7971       if (nullIsError && anp->data.ptrvalue == NULL) {
7972          goto erret;
7973       }
7974    }
7975 
7976 ret:
7977    AsnUnlinkType(orig);       /* unlink local tree */
7978    return anp;
7979 
7980 erret:
7981    anp = MemFree(anp);
7982    aip -> io_failure = TRUE;
7983    goto ret;
7984 }
7985 
7986 
7987 /**************************************************
7988 *
7989 *    CDSGeneProtConstraintFieldAsnWrite()
7990 *
7991 **************************************************/
7992 NLM_EXTERN Boolean LIBCALL
CDSGeneProtConstraintFieldAsnWrite(CDSGeneProtConstraintFieldPtr anp,AsnIoPtr aip,AsnTypePtr orig)7993 CDSGeneProtConstraintFieldAsnWrite(CDSGeneProtConstraintFieldPtr anp, AsnIoPtr aip, AsnTypePtr orig)
7994 
7995 {
7996    DataVal av;
7997    AsnTypePtr atp, writetype = NULL;
7998    Pointer pnt;
7999    AsnWriteFunc func = NULL;
8000    Boolean retval = FALSE;
8001 
8002    if (! loaded)
8003    {
8004       if (! objmacroAsnLoad())
8005       return FALSE;
8006    }
8007 
8008    if (aip == NULL)
8009    return FALSE;
8010 
8011    atp = AsnLinkType(orig, CDSGENEPROT_CONSTRAINT_FIELD);   /* link local tree */
8012    if (atp == NULL) {
8013       return FALSE;
8014    }
8015 
8016    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8017 
8018     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
8019 
8020    av.ptrvalue = (Pointer)anp;
8021    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
8022       goto erret;
8023    }
8024 
8025    pnt = anp->data.ptrvalue;
8026    switch (anp->choice)
8027    {
8028    case CDSGeneProtConstraintField_field:
8029       av.intvalue = anp->data.intvalue;
8030       retval = AsnWrite(aip, CDSGENEPROT_CONSTRAINT_FIELD_field, &av);
8031       break;
8032    }
8033    if (writetype != NULL) {
8034       retval = (* func)(pnt, aip, writetype);   /* write it out */
8035    }
8036    if (!retval) {
8037       goto erret;
8038    }
8039    retval = TRUE;
8040 
8041 erret:
8042    AsnUnlinkType(orig);       /* unlink local tree */
8043    return retval;
8044 }
8045 
8046 
8047 /**************************************************
8048 *
8049 *    CDSGeneProtQualConstraintNew()
8050 *
8051 **************************************************/
8052 NLM_EXTERN
8053 CDSGeneProtQualConstraintPtr LIBCALL
CDSGeneProtQualConstraintNew(void)8054 CDSGeneProtQualConstraintNew(void)
8055 {
8056    CDSGeneProtQualConstraintPtr ptr = MemNew((size_t) sizeof(CDSGeneProtQualConstraint));
8057 
8058    return ptr;
8059 
8060 }
8061 
8062 
8063 /**************************************************
8064 *
8065 *    CDSGeneProtQualConstraintFree()
8066 *
8067 **************************************************/
8068 NLM_EXTERN
8069 CDSGeneProtQualConstraintPtr LIBCALL
CDSGeneProtQualConstraintFree(CDSGeneProtQualConstraintPtr ptr)8070 CDSGeneProtQualConstraintFree(CDSGeneProtQualConstraintPtr ptr)
8071 {
8072 
8073    if(ptr == NULL) {
8074       return NULL;
8075    }
8076    CDSGeneProtConstraintFieldFree(ptr -> field1);
8077    CDSGeneProtConstraintFieldFree(ptr -> field2);
8078    StringConstraintFree(ptr -> constraint);
8079    return MemFree(ptr);
8080 }
8081 
8082 
8083 /**************************************************
8084 *
8085 *    CDSGeneProtQualConstraintAsnRead()
8086 *
8087 **************************************************/
8088 NLM_EXTERN
8089 CDSGeneProtQualConstraintPtr LIBCALL
CDSGeneProtQualConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)8090 CDSGeneProtQualConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8091 {
8092    DataVal av;
8093    AsnTypePtr atp;
8094    Boolean isError = FALSE;
8095    AsnReadFunc func;
8096    CDSGeneProtQualConstraintPtr ptr;
8097 
8098    if (! loaded)
8099    {
8100       if (! objmacroAsnLoad()) {
8101          return NULL;
8102       }
8103    }
8104 
8105    if (aip == NULL) {
8106       return NULL;
8107    }
8108 
8109    if (orig == NULL) {         /* CDSGeneProtQualConstraint ::= (self contained) */
8110       atp = AsnReadId(aip, amp, CDSGENEPROT_QUAL_CONSTRAINT);
8111    } else {
8112       atp = AsnLinkType(orig, CDSGENEPROT_QUAL_CONSTRAINT);
8113    }
8114    /* link in local tree */
8115    if (atp == NULL) {
8116       return NULL;
8117    }
8118 
8119    ptr = CDSGeneProtQualConstraintNew();
8120    if (ptr == NULL) {
8121       goto erret;
8122    }
8123    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
8124       goto erret;
8125    }
8126 
8127    atp = AsnReadId(aip,amp, atp);
8128    func = NULL;
8129 
8130    if (atp == CDSGENEPROT_QUAL_CONSTRAINT_field1) {
8131       ptr -> field1 = CDSGeneProtConstraintFieldAsnRead(aip, atp);
8132       if (aip -> io_failure) {
8133          goto erret;
8134       }
8135       atp = AsnReadId(aip,amp, atp);
8136    }
8137    if (atp == CDSGENEPROT_QUAL_CONSTRAINT_field2) {
8138       ptr -> field2 = CDSGeneProtConstraintFieldAsnRead(aip, atp);
8139       if (aip -> io_failure) {
8140          goto erret;
8141       }
8142       atp = AsnReadId(aip,amp, atp);
8143    }
8144    if (atp == CDSGENEPROT_QUAL_CONSTRAINT_constraint) {
8145       ptr -> constraint = StringConstraintAsnRead(aip, atp);
8146       if (aip -> io_failure) {
8147          goto erret;
8148       }
8149       atp = AsnReadId(aip,amp, atp);
8150    }
8151 
8152    if (AsnReadVal(aip, atp, &av) <= 0) {
8153       goto erret;
8154    }
8155    /* end struct */
8156 
8157 ret:
8158    AsnUnlinkType(orig);       /* unlink local tree */
8159    return ptr;
8160 
8161 erret:
8162    aip -> io_failure = TRUE;
8163    ptr = CDSGeneProtQualConstraintFree(ptr);
8164    goto ret;
8165 }
8166 
8167 
8168 
8169 /**************************************************
8170 *
8171 *    CDSGeneProtQualConstraintAsnWrite()
8172 *
8173 **************************************************/
8174 NLM_EXTERN Boolean LIBCALL
CDSGeneProtQualConstraintAsnWrite(CDSGeneProtQualConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)8175 CDSGeneProtQualConstraintAsnWrite(CDSGeneProtQualConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
8176 {
8177    DataVal av;
8178    AsnTypePtr atp;
8179    Boolean retval = FALSE;
8180 
8181    if (! loaded)
8182    {
8183       if (! objmacroAsnLoad()) {
8184          return FALSE;
8185       }
8186    }
8187 
8188    if (aip == NULL) {
8189       return FALSE;
8190    }
8191 
8192    atp = AsnLinkType(orig, CDSGENEPROT_QUAL_CONSTRAINT);   /* link local tree */
8193    if (atp == NULL) {
8194       return FALSE;
8195    }
8196 
8197    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8198 
8199     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
8200 
8201    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
8202       goto erret;
8203    }
8204 
8205    if (ptr -> field1 != NULL) {
8206       if ( ! CDSGeneProtConstraintFieldAsnWrite(ptr -> field1, aip, CDSGENEPROT_QUAL_CONSTRAINT_field1)) {
8207          goto erret;
8208       }
8209    }
8210    if (ptr -> field2 != NULL) {
8211       if ( ! CDSGeneProtConstraintFieldAsnWrite(ptr -> field2, aip, CDSGENEPROT_QUAL_CONSTRAINT_field2)) {
8212          goto erret;
8213       }
8214    }
8215    if (ptr -> constraint != NULL) {
8216       if ( ! StringConstraintAsnWrite(ptr -> constraint, aip, CDSGENEPROT_QUAL_CONSTRAINT_constraint)) {
8217          goto erret;
8218       }
8219    }
8220    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
8221       goto erret;
8222    }
8223    retval = TRUE;
8224 
8225 erret:
8226    AsnUnlinkType(orig);       /* unlink local tree */
8227    return retval;
8228 }
8229 
8230 
8231 
8232 /**************************************************
8233 *
8234 *    FieldConstraintNew()
8235 *
8236 **************************************************/
8237 NLM_EXTERN
8238 FieldConstraintPtr LIBCALL
FieldConstraintNew(void)8239 FieldConstraintNew(void)
8240 {
8241    FieldConstraintPtr ptr = MemNew((size_t) sizeof(FieldConstraint));
8242 
8243    return ptr;
8244 
8245 }
8246 
8247 
8248 /**************************************************
8249 *
8250 *    FieldConstraintFree()
8251 *
8252 **************************************************/
8253 NLM_EXTERN
8254 FieldConstraintPtr LIBCALL
FieldConstraintFree(FieldConstraintPtr ptr)8255 FieldConstraintFree(FieldConstraintPtr ptr)
8256 {
8257 
8258    if(ptr == NULL) {
8259       return NULL;
8260    }
8261    FieldTypeFree(ptr -> field);
8262    StringConstraintFree(ptr -> string_constraint);
8263    return MemFree(ptr);
8264 }
8265 
8266 
8267 /**************************************************
8268 *
8269 *    FieldConstraintAsnRead()
8270 *
8271 **************************************************/
8272 NLM_EXTERN
8273 FieldConstraintPtr LIBCALL
FieldConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)8274 FieldConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8275 {
8276    DataVal av;
8277    AsnTypePtr atp;
8278    Boolean isError = FALSE;
8279    AsnReadFunc func;
8280    FieldConstraintPtr ptr;
8281 
8282    if (! loaded)
8283    {
8284       if (! objmacroAsnLoad()) {
8285          return NULL;
8286       }
8287    }
8288 
8289    if (aip == NULL) {
8290       return NULL;
8291    }
8292 
8293    if (orig == NULL) {         /* FieldConstraint ::= (self contained) */
8294       atp = AsnReadId(aip, amp, FIELD_CONSTRAINT);
8295    } else {
8296       atp = AsnLinkType(orig, FIELD_CONSTRAINT);
8297    }
8298    /* link in local tree */
8299    if (atp == NULL) {
8300       return NULL;
8301    }
8302 
8303    ptr = FieldConstraintNew();
8304    if (ptr == NULL) {
8305       goto erret;
8306    }
8307    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
8308       goto erret;
8309    }
8310 
8311    atp = AsnReadId(aip,amp, atp);
8312    func = NULL;
8313 
8314    if (atp == FIELD_CONSTRAINT_field) {
8315       ptr -> field = FieldTypeAsnRead(aip, atp);
8316       if (aip -> io_failure) {
8317          goto erret;
8318       }
8319       atp = AsnReadId(aip,amp, atp);
8320    }
8321    if (atp == FIELD_CONSTRAINT_string_constraint) {
8322       ptr -> string_constraint = StringConstraintAsnRead(aip, atp);
8323       if (aip -> io_failure) {
8324          goto erret;
8325       }
8326       atp = AsnReadId(aip,amp, atp);
8327    }
8328 
8329    if (AsnReadVal(aip, atp, &av) <= 0) {
8330       goto erret;
8331    }
8332    /* end struct */
8333 
8334 ret:
8335    AsnUnlinkType(orig);       /* unlink local tree */
8336    return ptr;
8337 
8338 erret:
8339    aip -> io_failure = TRUE;
8340    ptr = FieldConstraintFree(ptr);
8341    goto ret;
8342 }
8343 
8344 
8345 
8346 /**************************************************
8347 *
8348 *    FieldConstraintAsnWrite()
8349 *
8350 **************************************************/
8351 NLM_EXTERN Boolean LIBCALL
FieldConstraintAsnWrite(FieldConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)8352 FieldConstraintAsnWrite(FieldConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
8353 {
8354    DataVal av;
8355    AsnTypePtr atp;
8356    Boolean retval = FALSE;
8357 
8358    if (! loaded)
8359    {
8360       if (! objmacroAsnLoad()) {
8361          return FALSE;
8362       }
8363    }
8364 
8365    if (aip == NULL) {
8366       return FALSE;
8367    }
8368 
8369    atp = AsnLinkType(orig, FIELD_CONSTRAINT);   /* link local tree */
8370    if (atp == NULL) {
8371       return FALSE;
8372    }
8373 
8374    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8375 
8376     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
8377 
8378    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
8379       goto erret;
8380    }
8381 
8382    if (ptr -> field != NULL) {
8383       if ( ! FieldTypeAsnWrite(ptr -> field, aip, FIELD_CONSTRAINT_field)) {
8384          goto erret;
8385       }
8386    }
8387    if (ptr -> string_constraint != NULL) {
8388       if ( ! StringConstraintAsnWrite(ptr -> string_constraint, aip, FIELD_CONSTRAINT_string_constraint)) {
8389          goto erret;
8390       }
8391    }
8392    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
8393       goto erret;
8394    }
8395    retval = TRUE;
8396 
8397 erret:
8398    AsnUnlinkType(orig);       /* unlink local tree */
8399    return retval;
8400 }
8401 
8402 
8403 
8404 /**************************************************
8405 *
8406 *    FieldTypeFree()
8407 *
8408 **************************************************/
8409 NLM_EXTERN
8410 FieldTypePtr LIBCALL
FieldTypeFree(ValNodePtr anp)8411 FieldTypeFree(ValNodePtr anp)
8412 {
8413    Pointer pnt;
8414 
8415    if (anp == NULL) {
8416       return NULL;
8417    }
8418 
8419    pnt = anp->data.ptrvalue;
8420    switch (anp->choice)
8421    {
8422    default:
8423       break;
8424    case FieldType_source_qual:
8425       SourceQualChoiceFree(anp -> data.ptrvalue);
8426       break;
8427    case FieldType_feature_field:
8428       FeatureFieldFree(anp -> data.ptrvalue);
8429       break;
8430    case FieldType_rna_field:
8431       RnaQualFree(anp -> data.ptrvalue);
8432       break;
8433    case FieldType_molinfo_field:
8434       MolinfoFieldFree(anp -> data.ptrvalue);
8435       break;
8436    case FieldType_struc_comment_field:
8437       StructuredCommentFieldFree(anp -> data.ptrvalue);
8438       break;
8439    }
8440    return MemFree(anp);
8441 }
8442 
8443 
8444 /**************************************************
8445 *
8446 *    FieldTypeAsnRead()
8447 *
8448 **************************************************/
8449 NLM_EXTERN
8450 FieldTypePtr LIBCALL
FieldTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)8451 FieldTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8452 {
8453    DataVal av;
8454    AsnTypePtr atp;
8455    ValNodePtr anp;
8456    Uint1 choice;
8457    Boolean isError = FALSE;
8458    Boolean nullIsError = FALSE;
8459    AsnReadFunc func;
8460 
8461    if (! loaded)
8462    {
8463       if (! objmacroAsnLoad()) {
8464          return NULL;
8465       }
8466    }
8467 
8468    if (aip == NULL) {
8469       return NULL;
8470    }
8471 
8472    if (orig == NULL) {         /* FieldType ::= (self contained) */
8473       atp = AsnReadId(aip, amp, FIELD_TYPE);
8474    } else {
8475       atp = AsnLinkType(orig, FIELD_TYPE);    /* link in local tree */
8476    }
8477    if (atp == NULL) {
8478       return NULL;
8479    }
8480 
8481    anp = ValNodeNew(NULL);
8482    if (anp == NULL) {
8483       goto erret;
8484    }
8485    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
8486       goto erret;
8487    }
8488 
8489    func = NULL;
8490 
8491    atp = AsnReadId(aip, amp, atp);  /* find the choice */
8492    if (atp == NULL) {
8493       goto erret;
8494    }
8495    if (atp == FIELD_TYPE_source_qual) {
8496       choice = FieldType_source_qual;
8497       func = (AsnReadFunc) SourceQualChoiceAsnRead;
8498    }
8499    else if (atp == FIELD_TYPE_feature_field) {
8500       choice = FieldType_feature_field;
8501       func = (AsnReadFunc) FeatureFieldAsnRead;
8502    }
8503    else if (atp == FIELD_TYPE_rna_field) {
8504       choice = FieldType_rna_field;
8505       func = (AsnReadFunc) RnaQualAsnRead;
8506    }
8507    else if (atp == FIELD_TYPE_cds_gene_prot) {
8508       choice = FieldType_cds_gene_prot;
8509       if (AsnReadVal(aip, atp, &av) <= 0) {
8510          goto erret;
8511       }
8512       anp->data.intvalue = av.intvalue;
8513    }
8514    else if (atp == FIELD_TYPE_molinfo_field) {
8515       choice = FieldType_molinfo_field;
8516       func = (AsnReadFunc) MolinfoFieldAsnRead;
8517    }
8518    else if (atp == FIELD_TYPE_pub) {
8519       choice = FieldType_pub;
8520       if (AsnReadVal(aip, atp, &av) <= 0) {
8521          goto erret;
8522       }
8523       anp->data.intvalue = av.intvalue;
8524    }
8525    else if (atp == FIELD_TYPE_struc_comment_field) {
8526       choice = FieldType_struc_comment_field;
8527       func = (AsnReadFunc) StructuredCommentFieldAsnRead;
8528    }
8529    else if (atp == FIELD_TYPE_misc) {
8530       choice = FieldType_misc;
8531       if (AsnReadVal(aip, atp, &av) <= 0) {
8532          goto erret;
8533       }
8534       anp->data.intvalue = av.intvalue;
8535    }
8536    else if (atp == FIELD_TYPE_dblink) {
8537       choice = FieldType_dblink;
8538       if (AsnReadVal(aip, atp, &av) <= 0) {
8539          goto erret;
8540       }
8541       anp->data.intvalue = av.intvalue;
8542    }
8543    anp->choice = choice;
8544    if (func != NULL)
8545    {
8546       anp->data.ptrvalue = (* func)(aip, atp);
8547       if (aip -> io_failure) goto erret;
8548 
8549       if (nullIsError && anp->data.ptrvalue == NULL) {
8550          goto erret;
8551       }
8552    }
8553 
8554 ret:
8555    AsnUnlinkType(orig);       /* unlink local tree */
8556    return anp;
8557 
8558 erret:
8559    anp = MemFree(anp);
8560    aip -> io_failure = TRUE;
8561    goto ret;
8562 }
8563 
8564 
8565 /**************************************************
8566 *
8567 *    FieldTypeAsnWrite()
8568 *
8569 **************************************************/
8570 NLM_EXTERN Boolean LIBCALL
FieldTypeAsnWrite(FieldTypePtr anp,AsnIoPtr aip,AsnTypePtr orig)8571 FieldTypeAsnWrite(FieldTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
8572 
8573 {
8574    DataVal av;
8575    AsnTypePtr atp, writetype = NULL;
8576    Pointer pnt;
8577    AsnWriteFunc func = NULL;
8578    Boolean retval = FALSE;
8579 
8580    if (! loaded)
8581    {
8582       if (! objmacroAsnLoad())
8583       return FALSE;
8584    }
8585 
8586    if (aip == NULL)
8587    return FALSE;
8588 
8589    atp = AsnLinkType(orig, FIELD_TYPE);   /* link local tree */
8590    if (atp == NULL) {
8591       return FALSE;
8592    }
8593 
8594    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8595 
8596     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
8597 
8598    av.ptrvalue = (Pointer)anp;
8599    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
8600       goto erret;
8601    }
8602 
8603    pnt = anp->data.ptrvalue;
8604    switch (anp->choice)
8605    {
8606    case FieldType_source_qual:
8607       writetype = FIELD_TYPE_source_qual;
8608       func = (AsnWriteFunc) SourceQualChoiceAsnWrite;
8609       break;
8610    case FieldType_feature_field:
8611       writetype = FIELD_TYPE_feature_field;
8612       func = (AsnWriteFunc) FeatureFieldAsnWrite;
8613       break;
8614    case FieldType_rna_field:
8615       writetype = FIELD_TYPE_rna_field;
8616       func = (AsnWriteFunc) RnaQualAsnWrite;
8617       break;
8618    case FieldType_cds_gene_prot:
8619       av.intvalue = anp->data.intvalue;
8620       retval = AsnWrite(aip, FIELD_TYPE_cds_gene_prot, &av);
8621       break;
8622    case FieldType_molinfo_field:
8623       writetype = FIELD_TYPE_molinfo_field;
8624       func = (AsnWriteFunc) MolinfoFieldAsnWrite;
8625       break;
8626    case FieldType_pub:
8627       av.intvalue = anp->data.intvalue;
8628       retval = AsnWrite(aip, FIELD_TYPE_pub, &av);
8629       break;
8630    case FieldType_struc_comment_field:
8631       writetype = FIELD_TYPE_struc_comment_field;
8632       func = (AsnWriteFunc) StructuredCommentFieldAsnWrite;
8633       break;
8634    case FieldType_misc:
8635       av.intvalue = anp->data.intvalue;
8636       retval = AsnWrite(aip, FIELD_TYPE_misc, &av);
8637       break;
8638    case FieldType_dblink:
8639       av.intvalue = anp->data.intvalue;
8640       retval = AsnWrite(aip, FIELD_TYPE_dblink, &av);
8641       break;
8642    }
8643    if (writetype != NULL) {
8644       retval = (* func)(pnt, aip, writetype);   /* write it out */
8645    }
8646    if (!retval) {
8647       goto erret;
8648    }
8649    retval = TRUE;
8650 
8651 erret:
8652    AsnUnlinkType(orig);       /* unlink local tree */
8653    return retval;
8654 }
8655 
8656 
8657 /**************************************************
8658 *
8659 *    SequenceConstraintMolTypeConstraintFree()
8660 *
8661 **************************************************/
8662 NLM_EXTERN
8663 SequenceConstraintMolTypeConstraintPtr LIBCALL
SequenceConstraintMolTypeConstraintFree(ValNodePtr anp)8664 SequenceConstraintMolTypeConstraintFree(ValNodePtr anp)
8665 {
8666    Pointer pnt;
8667 
8668    if (anp == NULL) {
8669       return NULL;
8670    }
8671 
8672    pnt = anp->data.ptrvalue;
8673    switch (anp->choice)
8674    {
8675    default:
8676       break;
8677    }
8678    return MemFree(anp);
8679 }
8680 
8681 
8682 /**************************************************
8683 *
8684 *    SequenceConstraintMolTypeConstraintAsnRead()
8685 *
8686 **************************************************/
8687 NLM_EXTERN
8688 SequenceConstraintMolTypeConstraintPtr LIBCALL
SequenceConstraintMolTypeConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)8689 SequenceConstraintMolTypeConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8690 {
8691    DataVal av;
8692    AsnTypePtr atp;
8693    ValNodePtr anp;
8694    Uint1 choice;
8695    Boolean isError = FALSE;
8696    Boolean nullIsError = FALSE;
8697    AsnReadFunc func;
8698 
8699    if (! loaded)
8700    {
8701       if (! objmacroAsnLoad()) {
8702          return NULL;
8703       }
8704    }
8705 
8706    if (aip == NULL) {
8707       return NULL;
8708    }
8709 
8710    if (orig == NULL) {         /* SequenceConstraintMolTypeConstraint ::= (self contained) */
8711       atp = AsnReadId(aip, amp, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT);
8712    } else {
8713       atp = AsnLinkType(orig, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT);    /* link in local tree */
8714    }
8715    if (atp == NULL) {
8716       return NULL;
8717    }
8718 
8719    anp = ValNodeNew(NULL);
8720    if (anp == NULL) {
8721       goto erret;
8722    }
8723    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
8724       goto erret;
8725    }
8726 
8727    func = NULL;
8728 
8729    atp = AsnReadId(aip, amp, atp);  /* find the choice */
8730    if (atp == NULL) {
8731       goto erret;
8732    }
8733    if (atp == SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_any) {
8734       choice = SequenceConstraintMolTypeConstraint_any;
8735       if (AsnReadVal(aip, atp, &av) <= 0) {
8736          goto erret;
8737       }
8738       anp->data.boolvalue = av.boolvalue;
8739    }
8740    else if (atp == SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_nucleotide) {
8741       choice = SequenceConstraintMolTypeConstraint_nucleotide;
8742       if (AsnReadVal(aip, atp, &av) <= 0) {
8743          goto erret;
8744       }
8745       anp->data.boolvalue = av.boolvalue;
8746    }
8747    else if (atp == SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_dna) {
8748       choice = SequenceConstraintMolTypeConstraint_dna;
8749       if (AsnReadVal(aip, atp, &av) <= 0) {
8750          goto erret;
8751       }
8752       anp->data.boolvalue = av.boolvalue;
8753    }
8754    else if (atp == SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_rna) {
8755       choice = SequenceConstraintMolTypeConstraint_rna;
8756       if (AsnReadVal(aip, atp, &av) <= 0) {
8757          goto erret;
8758       }
8759       anp->data.intvalue = av.intvalue;
8760    }
8761    else if (atp == SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_protein) {
8762       choice = SequenceConstraintMolTypeConstraint_protein;
8763       if (AsnReadVal(aip, atp, &av) <= 0) {
8764          goto erret;
8765       }
8766       anp->data.boolvalue = av.boolvalue;
8767    }
8768    anp->choice = choice;
8769    if (func != NULL)
8770    {
8771       anp->data.ptrvalue = (* func)(aip, atp);
8772       if (aip -> io_failure) goto erret;
8773 
8774       if (nullIsError && anp->data.ptrvalue == NULL) {
8775          goto erret;
8776       }
8777    }
8778 
8779 ret:
8780    AsnUnlinkType(orig);       /* unlink local tree */
8781    return anp;
8782 
8783 erret:
8784    anp = MemFree(anp);
8785    aip -> io_failure = TRUE;
8786    goto ret;
8787 }
8788 
8789 
8790 /**************************************************
8791 *
8792 *    SequenceConstraintMolTypeConstraintAsnWrite()
8793 *
8794 **************************************************/
8795 NLM_EXTERN Boolean LIBCALL
SequenceConstraintMolTypeConstraintAsnWrite(SequenceConstraintMolTypeConstraintPtr anp,AsnIoPtr aip,AsnTypePtr orig)8796 SequenceConstraintMolTypeConstraintAsnWrite(SequenceConstraintMolTypeConstraintPtr anp, AsnIoPtr aip, AsnTypePtr orig)
8797 
8798 {
8799    DataVal av;
8800    AsnTypePtr atp, writetype = NULL;
8801    Pointer pnt;
8802    AsnWriteFunc func = NULL;
8803    Boolean retval = FALSE;
8804 
8805    if (! loaded)
8806    {
8807       if (! objmacroAsnLoad())
8808       return FALSE;
8809    }
8810 
8811    if (aip == NULL)
8812    return FALSE;
8813 
8814    atp = AsnLinkType(orig, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT);   /* link local tree */
8815    if (atp == NULL) {
8816       return FALSE;
8817    }
8818 
8819    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
8820 
8821     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
8822 
8823    av.ptrvalue = (Pointer)anp;
8824    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
8825       goto erret;
8826    }
8827 
8828    pnt = anp->data.ptrvalue;
8829    switch (anp->choice)
8830    {
8831    case SequenceConstraintMolTypeConstraint_any:
8832       av.boolvalue = anp->data.boolvalue;
8833       retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_any, &av);
8834       break;
8835    case SequenceConstraintMolTypeConstraint_nucleotide:
8836       av.boolvalue = anp->data.boolvalue;
8837       retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_nucleotide, &av);
8838       break;
8839    case SequenceConstraintMolTypeConstraint_dna:
8840       av.boolvalue = anp->data.boolvalue;
8841       retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_dna, &av);
8842       break;
8843    case SequenceConstraintMolTypeConstraint_rna:
8844       av.intvalue = anp->data.intvalue;
8845       retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_rna, &av);
8846       break;
8847    case SequenceConstraintMolTypeConstraint_protein:
8848       av.boolvalue = anp->data.boolvalue;
8849       retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_MOL_TYPE_CONSTRAINT_protein, &av);
8850       break;
8851    }
8852    if (writetype != NULL) {
8853       retval = (* func)(pnt, aip, writetype);   /* write it out */
8854    }
8855    if (!retval) {
8856       goto erret;
8857    }
8858    retval = TRUE;
8859 
8860 erret:
8861    AsnUnlinkType(orig);       /* unlink local tree */
8862    return retval;
8863 }
8864 
8865 
8866 /**************************************************
8867 *
8868 *    QuantityConstraintFree()
8869 *
8870 **************************************************/
8871 NLM_EXTERN
8872 QuantityConstraintPtr LIBCALL
QuantityConstraintFree(ValNodePtr anp)8873 QuantityConstraintFree(ValNodePtr anp)
8874 {
8875    Pointer pnt;
8876 
8877    if (anp == NULL) {
8878       return NULL;
8879    }
8880 
8881    pnt = anp->data.ptrvalue;
8882    switch (anp->choice)
8883    {
8884    default:
8885       break;
8886    }
8887    return MemFree(anp);
8888 }
8889 
8890 
8891 /**************************************************
8892 *
8893 *    QuantityConstraintAsnRead()
8894 *
8895 **************************************************/
8896 NLM_EXTERN
8897 QuantityConstraintPtr LIBCALL
QuantityConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)8898 QuantityConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
8899 {
8900    DataVal av;
8901    AsnTypePtr atp;
8902    ValNodePtr anp;
8903    Uint1 choice;
8904    Boolean isError = FALSE;
8905    Boolean nullIsError = FALSE;
8906    AsnReadFunc func;
8907 
8908    if (! loaded)
8909    {
8910       if (! objmacroAsnLoad()) {
8911          return NULL;
8912       }
8913    }
8914 
8915    if (aip == NULL) {
8916       return NULL;
8917    }
8918 
8919    if (orig == NULL) {         /* QuantityConstraint ::= (self contained) */
8920       atp = AsnReadId(aip, amp, QUANTITY_CONSTRAINT);
8921    } else {
8922       atp = AsnLinkType(orig, QUANTITY_CONSTRAINT);    /* link in local tree */
8923    }
8924    if (atp == NULL) {
8925       return NULL;
8926    }
8927 
8928    anp = ValNodeNew(NULL);
8929    if (anp == NULL) {
8930       goto erret;
8931    }
8932    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
8933       goto erret;
8934    }
8935 
8936    func = NULL;
8937 
8938    atp = AsnReadId(aip, amp, atp);  /* find the choice */
8939    if (atp == NULL) {
8940       goto erret;
8941    }
8942    if (atp == QUANTITY_CONSTRAINT_equals) {
8943       choice = QuantityConstraint_equals;
8944       if (AsnReadVal(aip, atp, &av) <= 0) {
8945          goto erret;
8946       }
8947       anp->data.intvalue = av.intvalue;
8948    }
8949    else if (atp == QUANTITY_CONSTRAINT_greater_than) {
8950       choice = QuantityConstraint_greater_than;
8951       if (AsnReadVal(aip, atp, &av) <= 0) {
8952          goto erret;
8953       }
8954       anp->data.intvalue = av.intvalue;
8955    }
8956    else if (atp == QUANTITY_CONSTRAINT_less_than) {
8957       choice = QuantityConstraint_less_than;
8958       if (AsnReadVal(aip, atp, &av) <= 0) {
8959          goto erret;
8960       }
8961       anp->data.intvalue = av.intvalue;
8962    }
8963    anp->choice = choice;
8964    if (func != NULL)
8965    {
8966       anp->data.ptrvalue = (* func)(aip, atp);
8967       if (aip -> io_failure) goto erret;
8968 
8969       if (nullIsError && anp->data.ptrvalue == NULL) {
8970          goto erret;
8971       }
8972    }
8973 
8974 ret:
8975    AsnUnlinkType(orig);       /* unlink local tree */
8976    return anp;
8977 
8978 erret:
8979    anp = MemFree(anp);
8980    aip -> io_failure = TRUE;
8981    goto ret;
8982 }
8983 
8984 
8985 /**************************************************
8986 *
8987 *    QuantityConstraintAsnWrite()
8988 *
8989 **************************************************/
8990 NLM_EXTERN Boolean LIBCALL
QuantityConstraintAsnWrite(QuantityConstraintPtr anp,AsnIoPtr aip,AsnTypePtr orig)8991 QuantityConstraintAsnWrite(QuantityConstraintPtr anp, AsnIoPtr aip, AsnTypePtr orig)
8992 
8993 {
8994    DataVal av;
8995    AsnTypePtr atp, writetype = NULL;
8996    Pointer pnt;
8997    AsnWriteFunc func = NULL;
8998    Boolean retval = FALSE;
8999 
9000    if (! loaded)
9001    {
9002       if (! objmacroAsnLoad())
9003       return FALSE;
9004    }
9005 
9006    if (aip == NULL)
9007    return FALSE;
9008 
9009    atp = AsnLinkType(orig, QUANTITY_CONSTRAINT);   /* link local tree */
9010    if (atp == NULL) {
9011       return FALSE;
9012    }
9013 
9014    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9015 
9016     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
9017 
9018    av.ptrvalue = (Pointer)anp;
9019    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
9020       goto erret;
9021    }
9022 
9023    pnt = anp->data.ptrvalue;
9024    switch (anp->choice)
9025    {
9026    case QuantityConstraint_equals:
9027       av.intvalue = anp->data.intvalue;
9028       retval = AsnWrite(aip, QUANTITY_CONSTRAINT_equals, &av);
9029       break;
9030    case QuantityConstraint_greater_than:
9031       av.intvalue = anp->data.intvalue;
9032       retval = AsnWrite(aip, QUANTITY_CONSTRAINT_greater_than, &av);
9033       break;
9034    case QuantityConstraint_less_than:
9035       av.intvalue = anp->data.intvalue;
9036       retval = AsnWrite(aip, QUANTITY_CONSTRAINT_less_than, &av);
9037       break;
9038    }
9039    if (writetype != NULL) {
9040       retval = (* func)(pnt, aip, writetype);   /* write it out */
9041    }
9042    if (!retval) {
9043       goto erret;
9044    }
9045    retval = TRUE;
9046 
9047 erret:
9048    AsnUnlinkType(orig);       /* unlink local tree */
9049    return retval;
9050 }
9051 
9052 
9053 /**************************************************
9054 *
9055 *    SequenceConstraintNew()
9056 *
9057 **************************************************/
9058 NLM_EXTERN
9059 SequenceConstraintPtr LIBCALL
SequenceConstraintNew(void)9060 SequenceConstraintNew(void)
9061 {
9062    SequenceConstraintPtr ptr = MemNew((size_t) sizeof(SequenceConstraint));
9063 
9064    ptr -> strandedness = 0;
9065    return ptr;
9066 
9067 }
9068 
9069 
9070 /**************************************************
9071 *
9072 *    SequenceConstraintFree()
9073 *
9074 **************************************************/
9075 NLM_EXTERN
9076 SequenceConstraintPtr LIBCALL
SequenceConstraintFree(SequenceConstraintPtr ptr)9077 SequenceConstraintFree(SequenceConstraintPtr ptr)
9078 {
9079 
9080    if(ptr == NULL) {
9081       return NULL;
9082    }
9083    SequenceConstraintMolTypeConstraintFree(ptr -> seqtype);
9084    StringConstraintFree(ptr -> id);
9085    QuantityConstraintFree(ptr -> num_type_features);
9086    QuantityConstraintFree(ptr -> num_features);
9087    QuantityConstraintFree(ptr -> length);
9088    return MemFree(ptr);
9089 }
9090 
9091 
9092 /**************************************************
9093 *
9094 *    SequenceConstraintAsnRead()
9095 *
9096 **************************************************/
9097 NLM_EXTERN
9098 SequenceConstraintPtr LIBCALL
SequenceConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)9099 SequenceConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9100 {
9101    DataVal av;
9102    AsnTypePtr atp;
9103    Boolean isError = FALSE;
9104    AsnReadFunc func;
9105    SequenceConstraintPtr ptr;
9106 
9107    if (! loaded)
9108    {
9109       if (! objmacroAsnLoad()) {
9110          return NULL;
9111       }
9112    }
9113 
9114    if (aip == NULL) {
9115       return NULL;
9116    }
9117 
9118    if (orig == NULL) {         /* SequenceConstraint ::= (self contained) */
9119       atp = AsnReadId(aip, amp, SEQUENCE_CONSTRAINT);
9120    } else {
9121       atp = AsnLinkType(orig, SEQUENCE_CONSTRAINT);
9122    }
9123    /* link in local tree */
9124    if (atp == NULL) {
9125       return NULL;
9126    }
9127 
9128    ptr = SequenceConstraintNew();
9129    if (ptr == NULL) {
9130       goto erret;
9131    }
9132    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
9133       goto erret;
9134    }
9135 
9136    atp = AsnReadId(aip,amp, atp);
9137    func = NULL;
9138 
9139    if (atp == SEQUENCE_CONSTRAINT_seqtype) {
9140       ptr -> seqtype = SequenceConstraintMolTypeConstraintAsnRead(aip, atp);
9141       if (aip -> io_failure) {
9142          goto erret;
9143       }
9144       atp = AsnReadId(aip,amp, atp);
9145    }
9146    if (atp == SEQUENCE_CONSTRAINT_id) {
9147       ptr -> id = StringConstraintAsnRead(aip, atp);
9148       if (aip -> io_failure) {
9149          goto erret;
9150       }
9151       atp = AsnReadId(aip,amp, atp);
9152    }
9153    if (atp == SEQUENCE_CONSTRAINT_feature) {
9154       if ( AsnReadVal(aip, atp, &av) <= 0) {
9155          goto erret;
9156       }
9157       ptr -> feature = av.intvalue;
9158       atp = AsnReadId(aip,amp, atp);
9159    }
9160    if (atp == SEQUENCE_CONSTRAINT_num_type_features) {
9161       ptr -> num_type_features = QuantityConstraintAsnRead(aip, atp);
9162       if (aip -> io_failure) {
9163          goto erret;
9164       }
9165       atp = AsnReadId(aip,amp, atp);
9166    }
9167    if (atp == SEQUENCE_CONSTRAINT_num_features) {
9168       ptr -> num_features = QuantityConstraintAsnRead(aip, atp);
9169       if (aip -> io_failure) {
9170          goto erret;
9171       }
9172       atp = AsnReadId(aip,amp, atp);
9173    }
9174    if (atp == SEQUENCE_CONSTRAINT_length) {
9175       ptr -> length = QuantityConstraintAsnRead(aip, atp);
9176       if (aip -> io_failure) {
9177          goto erret;
9178       }
9179       atp = AsnReadId(aip,amp, atp);
9180    }
9181    if (atp == SEQUENCE_CONSTRAINT_strandedness) {
9182       if ( AsnReadVal(aip, atp, &av) <= 0) {
9183          goto erret;
9184       }
9185       ptr -> strandedness = av.intvalue;
9186       atp = AsnReadId(aip,amp, atp);
9187    }
9188 
9189    if (AsnReadVal(aip, atp, &av) <= 0) {
9190       goto erret;
9191    }
9192    /* end struct */
9193 
9194 ret:
9195    AsnUnlinkType(orig);       /* unlink local tree */
9196    return ptr;
9197 
9198 erret:
9199    aip -> io_failure = TRUE;
9200    ptr = SequenceConstraintFree(ptr);
9201    goto ret;
9202 }
9203 
9204 
9205 
9206 /**************************************************
9207 *
9208 *    SequenceConstraintAsnWrite()
9209 *
9210 **************************************************/
9211 NLM_EXTERN Boolean LIBCALL
SequenceConstraintAsnWrite(SequenceConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)9212 SequenceConstraintAsnWrite(SequenceConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
9213 {
9214    DataVal av;
9215    AsnTypePtr atp;
9216    Boolean retval = FALSE;
9217 
9218    if (! loaded)
9219    {
9220       if (! objmacroAsnLoad()) {
9221          return FALSE;
9222       }
9223    }
9224 
9225    if (aip == NULL) {
9226       return FALSE;
9227    }
9228 
9229    atp = AsnLinkType(orig, SEQUENCE_CONSTRAINT);   /* link local tree */
9230    if (atp == NULL) {
9231       return FALSE;
9232    }
9233 
9234    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9235 
9236     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
9237 
9238    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
9239       goto erret;
9240    }
9241 
9242    if (ptr -> seqtype != NULL) {
9243       if ( ! SequenceConstraintMolTypeConstraintAsnWrite(ptr -> seqtype, aip, SEQUENCE_CONSTRAINT_seqtype)) {
9244          goto erret;
9245       }
9246    }
9247    if (ptr -> id != NULL) {
9248       if ( ! StringConstraintAsnWrite(ptr -> id, aip, SEQUENCE_CONSTRAINT_id)) {
9249          goto erret;
9250       }
9251    }
9252    av.intvalue = ptr -> feature;
9253    retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_feature,  &av);
9254    if (ptr -> num_type_features != NULL) {
9255       if ( ! QuantityConstraintAsnWrite(ptr -> num_type_features, aip, SEQUENCE_CONSTRAINT_num_type_features)) {
9256          goto erret;
9257       }
9258    }
9259    if (ptr -> num_features != NULL) {
9260       if ( ! QuantityConstraintAsnWrite(ptr -> num_features, aip, SEQUENCE_CONSTRAINT_num_features)) {
9261          goto erret;
9262       }
9263    }
9264    if (ptr -> length != NULL) {
9265       if ( ! QuantityConstraintAsnWrite(ptr -> length, aip, SEQUENCE_CONSTRAINT_length)) {
9266          goto erret;
9267       }
9268    }
9269    av.intvalue = ptr -> strandedness;
9270    retval = AsnWrite(aip, SEQUENCE_CONSTRAINT_strandedness,  &av);
9271    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
9272       goto erret;
9273    }
9274    retval = TRUE;
9275 
9276 erret:
9277    AsnUnlinkType(orig);       /* unlink local tree */
9278    return retval;
9279 }
9280 
9281 
9282 
9283 /**************************************************
9284 *
9285 *    TranslationConstraintNew()
9286 *
9287 **************************************************/
9288 NLM_EXTERN
9289 TranslationConstraintPtr LIBCALL
TranslationConstraintNew(void)9290 TranslationConstraintNew(void)
9291 {
9292    TranslationConstraintPtr ptr = MemNew((size_t) sizeof(TranslationConstraint));
9293 
9294    ptr -> internal_stops = 0;
9295    return ptr;
9296 
9297 }
9298 
9299 
9300 /**************************************************
9301 *
9302 *    TranslationConstraintFree()
9303 *
9304 **************************************************/
9305 NLM_EXTERN
9306 TranslationConstraintPtr LIBCALL
TranslationConstraintFree(TranslationConstraintPtr ptr)9307 TranslationConstraintFree(TranslationConstraintPtr ptr)
9308 {
9309 
9310    if(ptr == NULL) {
9311       return NULL;
9312    }
9313    StringConstraintSetFree(ptr -> actual_strings);
9314    StringConstraintSetFree(ptr -> transl_strings);
9315    QuantityConstraintFree(ptr -> num_mismatches);
9316    return MemFree(ptr);
9317 }
9318 
9319 
9320 /**************************************************
9321 *
9322 *    TranslationConstraintAsnRead()
9323 *
9324 **************************************************/
9325 NLM_EXTERN
9326 TranslationConstraintPtr LIBCALL
TranslationConstraintAsnRead(AsnIoPtr aip,AsnTypePtr orig)9327 TranslationConstraintAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9328 {
9329    DataVal av;
9330    AsnTypePtr atp;
9331    Boolean isError = FALSE;
9332    AsnReadFunc func;
9333    TranslationConstraintPtr ptr;
9334 
9335    if (! loaded)
9336    {
9337       if (! objmacroAsnLoad()) {
9338          return NULL;
9339       }
9340    }
9341 
9342    if (aip == NULL) {
9343       return NULL;
9344    }
9345 
9346    if (orig == NULL) {         /* TranslationConstraint ::= (self contained) */
9347       atp = AsnReadId(aip, amp, TRANSLATION_CONSTRAINT);
9348    } else {
9349       atp = AsnLinkType(orig, TRANSLATION_CONSTRAINT);
9350    }
9351    /* link in local tree */
9352    if (atp == NULL) {
9353       return NULL;
9354    }
9355 
9356    ptr = TranslationConstraintNew();
9357    if (ptr == NULL) {
9358       goto erret;
9359    }
9360    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
9361       goto erret;
9362    }
9363 
9364    atp = AsnReadId(aip,amp, atp);
9365    func = NULL;
9366 
9367    if (atp == TRANSLATION_CONSTRAINT_actual_strings) {
9368       ptr -> actual_strings = StringConstraintSetAsnRead(aip, atp);
9369       if (aip -> io_failure) {
9370          goto erret;
9371       }
9372       atp = AsnReadId(aip,amp, atp);
9373    }
9374    if (atp == TRANSLATION_CONSTRAINT_transl_strings) {
9375       ptr -> transl_strings = StringConstraintSetAsnRead(aip, atp);
9376       if (aip -> io_failure) {
9377          goto erret;
9378       }
9379       atp = AsnReadId(aip,amp, atp);
9380    }
9381    if (atp == TRANSLATION_CONSTRAINT_internal_stops) {
9382       if ( AsnReadVal(aip, atp, &av) <= 0) {
9383          goto erret;
9384       }
9385       ptr -> internal_stops = av.intvalue;
9386       atp = AsnReadId(aip,amp, atp);
9387    }
9388    if (atp == TRANSLATION_CONSTRAINT_num_mismatches) {
9389       ptr -> num_mismatches = QuantityConstraintAsnRead(aip, atp);
9390       if (aip -> io_failure) {
9391          goto erret;
9392       }
9393       atp = AsnReadId(aip,amp, atp);
9394    }
9395 
9396    if (AsnReadVal(aip, atp, &av) <= 0) {
9397       goto erret;
9398    }
9399    /* end struct */
9400 
9401 ret:
9402    AsnUnlinkType(orig);       /* unlink local tree */
9403    return ptr;
9404 
9405 erret:
9406    aip -> io_failure = TRUE;
9407    ptr = TranslationConstraintFree(ptr);
9408    goto ret;
9409 }
9410 
9411 
9412 
9413 /**************************************************
9414 *
9415 *    TranslationConstraintAsnWrite()
9416 *
9417 **************************************************/
9418 NLM_EXTERN Boolean LIBCALL
TranslationConstraintAsnWrite(TranslationConstraintPtr ptr,AsnIoPtr aip,AsnTypePtr orig)9419 TranslationConstraintAsnWrite(TranslationConstraintPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
9420 {
9421    DataVal av;
9422    AsnTypePtr atp;
9423    Boolean retval = FALSE;
9424 
9425    if (! loaded)
9426    {
9427       if (! objmacroAsnLoad()) {
9428          return FALSE;
9429       }
9430    }
9431 
9432    if (aip == NULL) {
9433       return FALSE;
9434    }
9435 
9436    atp = AsnLinkType(orig, TRANSLATION_CONSTRAINT);   /* link local tree */
9437    if (atp == NULL) {
9438       return FALSE;
9439    }
9440 
9441    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9442 
9443     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
9444 
9445    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
9446       goto erret;
9447    }
9448 
9449    if (ptr -> actual_strings != NULL) {
9450       if ( ! StringConstraintSetAsnWrite(ptr -> actual_strings, aip, TRANSLATION_CONSTRAINT_actual_strings)) {
9451          goto erret;
9452       }
9453    }
9454    if (ptr -> transl_strings != NULL) {
9455       if ( ! StringConstraintSetAsnWrite(ptr -> transl_strings, aip, TRANSLATION_CONSTRAINT_transl_strings)) {
9456          goto erret;
9457       }
9458    }
9459    av.intvalue = ptr -> internal_stops;
9460    retval = AsnWrite(aip, TRANSLATION_CONSTRAINT_internal_stops,  &av);
9461    if (ptr -> num_mismatches != NULL) {
9462       if ( ! QuantityConstraintAsnWrite(ptr -> num_mismatches, aip, TRANSLATION_CONSTRAINT_num_mismatches)) {
9463          goto erret;
9464       }
9465    }
9466    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
9467       goto erret;
9468    }
9469    retval = TRUE;
9470 
9471 erret:
9472    AsnUnlinkType(orig);       /* unlink local tree */
9473    return retval;
9474 }
9475 
9476 
9477 
9478 /**************************************************
9479 *
9480 *    ConstraintChoiceFree()
9481 *
9482 **************************************************/
9483 NLM_EXTERN
9484 ConstraintChoicePtr LIBCALL
ConstraintChoiceFree(ValNodePtr anp)9485 ConstraintChoiceFree(ValNodePtr anp)
9486 {
9487    Pointer pnt;
9488 
9489    if (anp == NULL) {
9490       return NULL;
9491    }
9492 
9493    pnt = anp->data.ptrvalue;
9494    switch (anp->choice)
9495    {
9496    default:
9497       break;
9498    case ConstraintChoice_string:
9499       StringConstraintFree(anp -> data.ptrvalue);
9500       break;
9501    case ConstraintChoice_location:
9502       LocationConstraintFree(anp -> data.ptrvalue);
9503       break;
9504    case ConstraintChoice_field:
9505       FieldConstraintFree(anp -> data.ptrvalue);
9506       break;
9507    case ConstraintChoice_source:
9508       SourceConstraintFree(anp -> data.ptrvalue);
9509       break;
9510    case ConstraintChoice_cdsgeneprot_qual:
9511       CDSGeneProtQualConstraintFree(anp -> data.ptrvalue);
9512       break;
9513    case ConstraintChoice_cdsgeneprot_pseudo:
9514       CDSGeneProtPseudoConstraintFree(anp -> data.ptrvalue);
9515       break;
9516    case ConstraintChoice_sequence:
9517       SequenceConstraintFree(anp -> data.ptrvalue);
9518       break;
9519    case ConstraintChoice_pub:
9520       PublicationConstraintFree(anp -> data.ptrvalue);
9521       break;
9522    case ConstraintChoice_molinfo:
9523       MolinfoFieldConstraintFree(anp -> data.ptrvalue);
9524       break;
9525    case ConstraintChoice_field_missing:
9526       FieldTypeFree(anp -> data.ptrvalue);
9527       break;
9528    case ConstraintChoice_translation:
9529       TranslationConstraintFree(anp -> data.ptrvalue);
9530       break;
9531    }
9532    return MemFree(anp);
9533 }
9534 
9535 
9536 /**************************************************
9537 *
9538 *    ConstraintChoiceAsnRead()
9539 *
9540 **************************************************/
9541 NLM_EXTERN
9542 ConstraintChoicePtr LIBCALL
ConstraintChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)9543 ConstraintChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9544 {
9545    DataVal av;
9546    AsnTypePtr atp;
9547    ValNodePtr anp;
9548    Uint1 choice;
9549    Boolean isError = FALSE;
9550    Boolean nullIsError = FALSE;
9551    AsnReadFunc func;
9552 
9553    if (! loaded)
9554    {
9555       if (! objmacroAsnLoad()) {
9556          return NULL;
9557       }
9558    }
9559 
9560    if (aip == NULL) {
9561       return NULL;
9562    }
9563 
9564    if (orig == NULL) {         /* ConstraintChoice ::= (self contained) */
9565       atp = AsnReadId(aip, amp, CONSTRAINT_CHOICE);
9566    } else {
9567       atp = AsnLinkType(orig, CONSTRAINT_CHOICE);    /* link in local tree */
9568    }
9569    if (atp == NULL) {
9570       return NULL;
9571    }
9572 
9573    anp = ValNodeNew(NULL);
9574    if (anp == NULL) {
9575       goto erret;
9576    }
9577    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
9578       goto erret;
9579    }
9580 
9581    func = NULL;
9582 
9583    atp = AsnReadId(aip, amp, atp);  /* find the choice */
9584    if (atp == NULL) {
9585       goto erret;
9586    }
9587    if (atp == CONSTRAINT_CHOICE_string) {
9588       choice = ConstraintChoice_string;
9589       func = (AsnReadFunc) StringConstraintAsnRead;
9590    }
9591    else if (atp == CONSTRAINT_CHOICE_location) {
9592       choice = ConstraintChoice_location;
9593       func = (AsnReadFunc) LocationConstraintAsnRead;
9594    }
9595    else if (atp == CONSTRAINT_CHOICE_field) {
9596       choice = ConstraintChoice_field;
9597       func = (AsnReadFunc) FieldConstraintAsnRead;
9598    }
9599    else if (atp == CONSTRAINT_CHOICE_source) {
9600       choice = ConstraintChoice_source;
9601       func = (AsnReadFunc) SourceConstraintAsnRead;
9602    }
9603    else if (atp == CONSTRAINT_CHOICE_cdsgeneprot_qual) {
9604       choice = ConstraintChoice_cdsgeneprot_qual;
9605       func = (AsnReadFunc) CDSGeneProtQualConstraintAsnRead;
9606    }
9607    else if (atp == CONSTRAINT_CHOICE_cdsgeneprot_pseudo) {
9608       choice = ConstraintChoice_cdsgeneprot_pseudo;
9609       func = (AsnReadFunc) CDSGeneProtPseudoConstraintAsnRead;
9610    }
9611    else if (atp == CONSTRAINT_CHOICE_sequence) {
9612       choice = ConstraintChoice_sequence;
9613       func = (AsnReadFunc) SequenceConstraintAsnRead;
9614    }
9615    else if (atp == CONSTRAINT_CHOICE_pub) {
9616       choice = ConstraintChoice_pub;
9617       func = (AsnReadFunc) PublicationConstraintAsnRead;
9618    }
9619    else if (atp == CONSTRAINT_CHOICE_molinfo) {
9620       choice = ConstraintChoice_molinfo;
9621       func = (AsnReadFunc) MolinfoFieldConstraintAsnRead;
9622    }
9623    else if (atp == CONSTRAINT_CHOICE_field_missing) {
9624       choice = ConstraintChoice_field_missing;
9625       func = (AsnReadFunc) FieldTypeAsnRead;
9626    }
9627    else if (atp == CONSTRAINT_CHOICE_translation) {
9628       choice = ConstraintChoice_translation;
9629       func = (AsnReadFunc) TranslationConstraintAsnRead;
9630    }
9631    anp->choice = choice;
9632    if (func != NULL)
9633    {
9634       anp->data.ptrvalue = (* func)(aip, atp);
9635       if (aip -> io_failure) goto erret;
9636 
9637       if (nullIsError && anp->data.ptrvalue == NULL) {
9638          goto erret;
9639       }
9640    }
9641 
9642 ret:
9643    AsnUnlinkType(orig);       /* unlink local tree */
9644    return anp;
9645 
9646 erret:
9647    anp = MemFree(anp);
9648    aip -> io_failure = TRUE;
9649    goto ret;
9650 }
9651 
9652 
9653 /**************************************************
9654 *
9655 *    ConstraintChoiceAsnWrite()
9656 *
9657 **************************************************/
9658 NLM_EXTERN Boolean LIBCALL
ConstraintChoiceAsnWrite(ConstraintChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)9659 ConstraintChoiceAsnWrite(ConstraintChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
9660 
9661 {
9662    DataVal av;
9663    AsnTypePtr atp, writetype = NULL;
9664    Pointer pnt;
9665    AsnWriteFunc func = NULL;
9666    Boolean retval = FALSE;
9667 
9668    if (! loaded)
9669    {
9670       if (! objmacroAsnLoad())
9671       return FALSE;
9672    }
9673 
9674    if (aip == NULL)
9675    return FALSE;
9676 
9677    atp = AsnLinkType(orig, CONSTRAINT_CHOICE);   /* link local tree */
9678    if (atp == NULL) {
9679       return FALSE;
9680    }
9681 
9682    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9683 
9684     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
9685 
9686    av.ptrvalue = (Pointer)anp;
9687    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
9688       goto erret;
9689    }
9690 
9691    pnt = anp->data.ptrvalue;
9692    switch (anp->choice)
9693    {
9694    case ConstraintChoice_string:
9695       writetype = CONSTRAINT_CHOICE_string;
9696       func = (AsnWriteFunc) StringConstraintAsnWrite;
9697       break;
9698    case ConstraintChoice_location:
9699       writetype = CONSTRAINT_CHOICE_location;
9700       func = (AsnWriteFunc) LocationConstraintAsnWrite;
9701       break;
9702    case ConstraintChoice_field:
9703       writetype = CONSTRAINT_CHOICE_field;
9704       func = (AsnWriteFunc) FieldConstraintAsnWrite;
9705       break;
9706    case ConstraintChoice_source:
9707       writetype = CONSTRAINT_CHOICE_source;
9708       func = (AsnWriteFunc) SourceConstraintAsnWrite;
9709       break;
9710    case ConstraintChoice_cdsgeneprot_qual:
9711       writetype = CONSTRAINT_CHOICE_cdsgeneprot_qual;
9712       func = (AsnWriteFunc) CDSGeneProtQualConstraintAsnWrite;
9713       break;
9714    case ConstraintChoice_cdsgeneprot_pseudo:
9715       writetype = CONSTRAINT_CHOICE_cdsgeneprot_pseudo;
9716       func = (AsnWriteFunc) CDSGeneProtPseudoConstraintAsnWrite;
9717       break;
9718    case ConstraintChoice_sequence:
9719       writetype = CONSTRAINT_CHOICE_sequence;
9720       func = (AsnWriteFunc) SequenceConstraintAsnWrite;
9721       break;
9722    case ConstraintChoice_pub:
9723       writetype = CONSTRAINT_CHOICE_pub;
9724       func = (AsnWriteFunc) PublicationConstraintAsnWrite;
9725       break;
9726    case ConstraintChoice_molinfo:
9727       writetype = CONSTRAINT_CHOICE_molinfo;
9728       func = (AsnWriteFunc) MolinfoFieldConstraintAsnWrite;
9729       break;
9730    case ConstraintChoice_field_missing:
9731       writetype = CONSTRAINT_CHOICE_field_missing;
9732       func = (AsnWriteFunc) FieldTypeAsnWrite;
9733       break;
9734    case ConstraintChoice_translation:
9735       writetype = CONSTRAINT_CHOICE_translation;
9736       func = (AsnWriteFunc) TranslationConstraintAsnWrite;
9737       break;
9738    }
9739    if (writetype != NULL) {
9740       retval = (* func)(pnt, aip, writetype);   /* write it out */
9741    }
9742    if (!retval) {
9743       goto erret;
9744    }
9745    retval = TRUE;
9746 
9747 erret:
9748    AsnUnlinkType(orig);       /* unlink local tree */
9749    return retval;
9750 }
9751 
9752 
9753 /**************************************************
9754 *
9755 *    ConstraintChoiceSetFree()
9756 *
9757 **************************************************/
9758 NLM_EXTERN
9759 ConstraintChoiceSetPtr LIBCALL
ConstraintChoiceSetFree(ConstraintChoiceSetPtr ptr)9760 ConstraintChoiceSetFree(ConstraintChoiceSetPtr ptr)
9761 {
9762 
9763    if(ptr == NULL) {
9764       return NULL;
9765    }
9766    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) ConstraintChoiceFree);
9767    return NULL;
9768 }
9769 
9770 
9771 /**************************************************
9772 *
9773 *    ConstraintChoiceSetAsnRead()
9774 *
9775 **************************************************/
9776 NLM_EXTERN
9777 ConstraintChoiceSetPtr LIBCALL
ConstraintChoiceSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)9778 ConstraintChoiceSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9779 {
9780    DataVal av;
9781    AsnTypePtr atp;
9782    Boolean isError = FALSE;
9783    AsnReadFunc func;
9784    ConstraintChoiceSetPtr ptr;
9785 
9786    if (! loaded)
9787    {
9788       if (! objmacroAsnLoad()) {
9789          return NULL;
9790       }
9791    }
9792 
9793    if (aip == NULL) {
9794       return NULL;
9795    }
9796 
9797    if (orig == NULL) {         /* ConstraintChoiceSet ::= (self contained) */
9798       atp = AsnReadId(aip, amp, CONSTRAINT_CHOICE_SET);
9799    } else {
9800       atp = AsnLinkType(orig, CONSTRAINT_CHOICE_SET);
9801    }
9802    /* link in local tree */
9803    if (atp == NULL) {
9804       return NULL;
9805    }
9806 
9807    func = NULL;
9808 
9809    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ConstraintChoiceAsnRead, (AsnOptFreeFunc) ConstraintChoiceFree);
9810    if (isError && ptr  == NULL) {
9811       goto erret;
9812    }
9813 
9814 
9815 
9816 ret:
9817    AsnUnlinkType(orig);       /* unlink local tree */
9818    return ptr;
9819 
9820 erret:
9821    aip -> io_failure = TRUE;
9822    ptr = ConstraintChoiceSetFree(ptr);
9823    goto ret;
9824 }
9825 
9826 
9827 
9828 /**************************************************
9829 *
9830 *    ConstraintChoiceSetAsnWrite()
9831 *
9832 **************************************************/
9833 NLM_EXTERN Boolean LIBCALL
ConstraintChoiceSetAsnWrite(ConstraintChoiceSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)9834 ConstraintChoiceSetAsnWrite(ConstraintChoiceSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
9835 {
9836    DataVal av;
9837    AsnTypePtr atp;
9838    Boolean retval = FALSE;
9839 
9840    if (! loaded)
9841    {
9842       if (! objmacroAsnLoad()) {
9843          return FALSE;
9844       }
9845    }
9846 
9847    if (aip == NULL) {
9848       return FALSE;
9849    }
9850 
9851    atp = AsnLinkType(orig, CONSTRAINT_CHOICE_SET);   /* link local tree */
9852    if (atp == NULL) {
9853       return FALSE;
9854    }
9855 
9856    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
9857 
9858     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
9859 
9860    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) ConstraintChoiceAsnWrite, aip, atp, CONSTRAINT_CHOICE_SET_E);
9861    retval = TRUE;
9862 
9863 erret:
9864    AsnUnlinkType(orig);       /* unlink local tree */
9865    return retval;
9866 }
9867 
9868 
9869 
9870 /**************************************************
9871 *
9872 *    TextMarkerFree()
9873 *
9874 **************************************************/
9875 NLM_EXTERN
9876 TextMarkerPtr LIBCALL
TextMarkerFree(ValNodePtr anp)9877 TextMarkerFree(ValNodePtr anp)
9878 {
9879    Pointer pnt;
9880 
9881    if (anp == NULL) {
9882       return NULL;
9883    }
9884 
9885    pnt = anp->data.ptrvalue;
9886    switch (anp->choice)
9887    {
9888    default:
9889       break;
9890    case TextMarker_free_text:
9891       MemFree(anp -> data.ptrvalue);
9892       break;
9893    }
9894    return MemFree(anp);
9895 }
9896 
9897 
9898 /**************************************************
9899 *
9900 *    TextMarkerAsnRead()
9901 *
9902 **************************************************/
9903 NLM_EXTERN
9904 TextMarkerPtr LIBCALL
TextMarkerAsnRead(AsnIoPtr aip,AsnTypePtr orig)9905 TextMarkerAsnRead(AsnIoPtr aip, AsnTypePtr orig)
9906 {
9907    DataVal av;
9908    AsnTypePtr atp;
9909    ValNodePtr anp;
9910    Uint1 choice;
9911    Boolean isError = FALSE;
9912    Boolean nullIsError = FALSE;
9913    AsnReadFunc func;
9914 
9915    if (! loaded)
9916    {
9917       if (! objmacroAsnLoad()) {
9918          return NULL;
9919       }
9920    }
9921 
9922    if (aip == NULL) {
9923       return NULL;
9924    }
9925 
9926    if (orig == NULL) {         /* TextMarker ::= (self contained) */
9927       atp = AsnReadId(aip, amp, TEXT_MARKER);
9928    } else {
9929       atp = AsnLinkType(orig, TEXT_MARKER);    /* link in local tree */
9930    }
9931    if (atp == NULL) {
9932       return NULL;
9933    }
9934 
9935    anp = ValNodeNew(NULL);
9936    if (anp == NULL) {
9937       goto erret;
9938    }
9939    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
9940       goto erret;
9941    }
9942 
9943    func = NULL;
9944 
9945    atp = AsnReadId(aip, amp, atp);  /* find the choice */
9946    if (atp == NULL) {
9947       goto erret;
9948    }
9949    if (atp == TEXT_MARKER_free_text) {
9950       choice = TextMarker_free_text;
9951       if (AsnReadVal(aip, atp, &av) <= 0) {
9952          goto erret;
9953       }
9954       anp->data.ptrvalue = av.ptrvalue;
9955    }
9956    else if (atp == TEXT_MARKER_digits) {
9957       choice = TextMarker_digits;
9958       if (AsnReadVal(aip, atp, &av) <= 0) {
9959          goto erret;
9960       }
9961       anp->data.boolvalue = av.boolvalue;
9962    }
9963    else if (atp == TEXT_MARKER_letters) {
9964       choice = TextMarker_letters;
9965       if (AsnReadVal(aip, atp, &av) <= 0) {
9966          goto erret;
9967       }
9968       anp->data.boolvalue = av.boolvalue;
9969    }
9970    anp->choice = choice;
9971    if (func != NULL)
9972    {
9973       anp->data.ptrvalue = (* func)(aip, atp);
9974       if (aip -> io_failure) goto erret;
9975 
9976       if (nullIsError && anp->data.ptrvalue == NULL) {
9977          goto erret;
9978       }
9979    }
9980 
9981 ret:
9982    AsnUnlinkType(orig);       /* unlink local tree */
9983    return anp;
9984 
9985 erret:
9986    anp = MemFree(anp);
9987    aip -> io_failure = TRUE;
9988    goto ret;
9989 }
9990 
9991 
9992 /**************************************************
9993 *
9994 *    TextMarkerAsnWrite()
9995 *
9996 **************************************************/
9997 NLM_EXTERN Boolean LIBCALL
TextMarkerAsnWrite(TextMarkerPtr anp,AsnIoPtr aip,AsnTypePtr orig)9998 TextMarkerAsnWrite(TextMarkerPtr anp, AsnIoPtr aip, AsnTypePtr orig)
9999 
10000 {
10001    DataVal av;
10002    AsnTypePtr atp, writetype = NULL;
10003    Pointer pnt;
10004    AsnWriteFunc func = NULL;
10005    Boolean retval = FALSE;
10006 
10007    if (! loaded)
10008    {
10009       if (! objmacroAsnLoad())
10010       return FALSE;
10011    }
10012 
10013    if (aip == NULL)
10014    return FALSE;
10015 
10016    atp = AsnLinkType(orig, TEXT_MARKER);   /* link local tree */
10017    if (atp == NULL) {
10018       return FALSE;
10019    }
10020 
10021    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
10022 
10023     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
10024 
10025    av.ptrvalue = (Pointer)anp;
10026    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
10027       goto erret;
10028    }
10029 
10030    pnt = anp->data.ptrvalue;
10031    switch (anp->choice)
10032    {
10033    case TextMarker_free_text:
10034       av.ptrvalue = anp->data.ptrvalue;
10035       retval = AsnWrite(aip, TEXT_MARKER_free_text, &av);
10036       break;
10037    case TextMarker_digits:
10038       av.boolvalue = anp->data.boolvalue;
10039       retval = AsnWrite(aip, TEXT_MARKER_digits, &av);
10040       break;
10041    case TextMarker_letters:
10042       av.boolvalue = anp->data.boolvalue;
10043       retval = AsnWrite(aip, TEXT_MARKER_letters, &av);
10044       break;
10045    }
10046    if (writetype != NULL) {
10047       retval = (* func)(pnt, aip, writetype);   /* write it out */
10048    }
10049    if (!retval) {
10050       goto erret;
10051    }
10052    retval = TRUE;
10053 
10054 erret:
10055    AsnUnlinkType(orig);       /* unlink local tree */
10056    return retval;
10057 }
10058 
10059 
10060 /**************************************************
10061 *
10062 *    TextPortionNew()
10063 *
10064 **************************************************/
10065 NLM_EXTERN
10066 TextPortionPtr LIBCALL
TextPortionNew(void)10067 TextPortionNew(void)
10068 {
10069    TextPortionPtr ptr = MemNew((size_t) sizeof(TextPortion));
10070 
10071    ptr -> case_sensitive = 0;
10072    ptr -> whole_word = 0;
10073    return ptr;
10074 
10075 }
10076 
10077 
10078 /**************************************************
10079 *
10080 *    TextPortionFree()
10081 *
10082 **************************************************/
10083 NLM_EXTERN
10084 TextPortionPtr LIBCALL
TextPortionFree(TextPortionPtr ptr)10085 TextPortionFree(TextPortionPtr ptr)
10086 {
10087 
10088    if(ptr == NULL) {
10089       return NULL;
10090    }
10091    TextMarkerFree(ptr -> left_marker);
10092    TextMarkerFree(ptr -> right_marker);
10093    return MemFree(ptr);
10094 }
10095 
10096 
10097 /**************************************************
10098 *
10099 *    TextPortionAsnRead()
10100 *
10101 **************************************************/
10102 NLM_EXTERN
10103 TextPortionPtr LIBCALL
TextPortionAsnRead(AsnIoPtr aip,AsnTypePtr orig)10104 TextPortionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
10105 {
10106    DataVal av;
10107    AsnTypePtr atp;
10108    Boolean isError = FALSE;
10109    AsnReadFunc func;
10110    TextPortionPtr ptr;
10111 
10112    if (! loaded)
10113    {
10114       if (! objmacroAsnLoad()) {
10115          return NULL;
10116       }
10117    }
10118 
10119    if (aip == NULL) {
10120       return NULL;
10121    }
10122 
10123    if (orig == NULL) {         /* TextPortion ::= (self contained) */
10124       atp = AsnReadId(aip, amp, TEXT_PORTION);
10125    } else {
10126       atp = AsnLinkType(orig, TEXT_PORTION);
10127    }
10128    /* link in local tree */
10129    if (atp == NULL) {
10130       return NULL;
10131    }
10132 
10133    ptr = TextPortionNew();
10134    if (ptr == NULL) {
10135       goto erret;
10136    }
10137    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
10138       goto erret;
10139    }
10140 
10141    atp = AsnReadId(aip,amp, atp);
10142    func = NULL;
10143 
10144    if (atp == TEXT_PORTION_left_marker) {
10145       ptr -> left_marker = TextMarkerAsnRead(aip, atp);
10146       if (aip -> io_failure) {
10147          goto erret;
10148       }
10149       atp = AsnReadId(aip,amp, atp);
10150    }
10151    if (atp == TEXT_PORTION_include_left) {
10152       if ( AsnReadVal(aip, atp, &av) <= 0) {
10153          goto erret;
10154       }
10155       ptr -> include_left = av.boolvalue;
10156       atp = AsnReadId(aip,amp, atp);
10157    }
10158    if (atp == TEXT_PORTION_right_marker) {
10159       ptr -> right_marker = TextMarkerAsnRead(aip, atp);
10160       if (aip -> io_failure) {
10161          goto erret;
10162       }
10163       atp = AsnReadId(aip,amp, atp);
10164    }
10165    if (atp == TEXT_PORTION_include_right) {
10166       if ( AsnReadVal(aip, atp, &av) <= 0) {
10167          goto erret;
10168       }
10169       ptr -> include_right = av.boolvalue;
10170       atp = AsnReadId(aip,amp, atp);
10171    }
10172    if (atp == TEXT_PORTION_inside) {
10173       if ( AsnReadVal(aip, atp, &av) <= 0) {
10174          goto erret;
10175       }
10176       ptr -> inside = av.boolvalue;
10177       atp = AsnReadId(aip,amp, atp);
10178    }
10179    if (atp == TEXT_PORTION_case_sensitive) {
10180       if ( AsnReadVal(aip, atp, &av) <= 0) {
10181          goto erret;
10182       }
10183       ptr -> case_sensitive = av.boolvalue;
10184       atp = AsnReadId(aip,amp, atp);
10185    }
10186    if (atp == TEXT_PORTION_whole_word) {
10187       if ( AsnReadVal(aip, atp, &av) <= 0) {
10188          goto erret;
10189       }
10190       ptr -> whole_word = av.boolvalue;
10191       atp = AsnReadId(aip,amp, atp);
10192    }
10193 
10194    if (AsnReadVal(aip, atp, &av) <= 0) {
10195       goto erret;
10196    }
10197    /* end struct */
10198 
10199 ret:
10200    AsnUnlinkType(orig);       /* unlink local tree */
10201    return ptr;
10202 
10203 erret:
10204    aip -> io_failure = TRUE;
10205    ptr = TextPortionFree(ptr);
10206    goto ret;
10207 }
10208 
10209 
10210 
10211 /**************************************************
10212 *
10213 *    TextPortionAsnWrite()
10214 *
10215 **************************************************/
10216 NLM_EXTERN Boolean LIBCALL
TextPortionAsnWrite(TextPortionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)10217 TextPortionAsnWrite(TextPortionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
10218 {
10219    DataVal av;
10220    AsnTypePtr atp;
10221    Boolean retval = FALSE;
10222 
10223    if (! loaded)
10224    {
10225       if (! objmacroAsnLoad()) {
10226          return FALSE;
10227       }
10228    }
10229 
10230    if (aip == NULL) {
10231       return FALSE;
10232    }
10233 
10234    atp = AsnLinkType(orig, TEXT_PORTION);   /* link local tree */
10235    if (atp == NULL) {
10236       return FALSE;
10237    }
10238 
10239    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
10240 
10241     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
10242 
10243    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
10244       goto erret;
10245    }
10246 
10247    if (ptr -> left_marker != NULL) {
10248       if ( ! TextMarkerAsnWrite(ptr -> left_marker, aip, TEXT_PORTION_left_marker)) {
10249          goto erret;
10250       }
10251    }
10252    av.boolvalue = ptr -> include_left;
10253    retval = AsnWrite(aip, TEXT_PORTION_include_left,  &av);
10254    if (ptr -> right_marker != NULL) {
10255       if ( ! TextMarkerAsnWrite(ptr -> right_marker, aip, TEXT_PORTION_right_marker)) {
10256          goto erret;
10257       }
10258    }
10259    av.boolvalue = ptr -> include_right;
10260    retval = AsnWrite(aip, TEXT_PORTION_include_right,  &av);
10261    av.boolvalue = ptr -> inside;
10262    retval = AsnWrite(aip, TEXT_PORTION_inside,  &av);
10263    av.boolvalue = ptr -> case_sensitive;
10264    retval = AsnWrite(aip, TEXT_PORTION_case_sensitive,  &av);
10265    av.boolvalue = ptr -> whole_word;
10266    retval = AsnWrite(aip, TEXT_PORTION_whole_word,  &av);
10267    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
10268       goto erret;
10269    }
10270    retval = TRUE;
10271 
10272 erret:
10273    AsnUnlinkType(orig);       /* unlink local tree */
10274    return retval;
10275 }
10276 
10277 
10278 
10279 /**************************************************
10280 *
10281 *    FieldEditNew()
10282 *
10283 **************************************************/
10284 NLM_EXTERN
10285 FieldEditPtr LIBCALL
FieldEditNew(void)10286 FieldEditNew(void)
10287 {
10288    FieldEditPtr ptr = MemNew((size_t) sizeof(FieldEdit));
10289 
10290    ptr -> location = 0;
10291    ptr -> case_insensitive = 0;
10292    return ptr;
10293 
10294 }
10295 
10296 
10297 /**************************************************
10298 *
10299 *    FieldEditFree()
10300 *
10301 **************************************************/
10302 NLM_EXTERN
10303 FieldEditPtr LIBCALL
FieldEditFree(FieldEditPtr ptr)10304 FieldEditFree(FieldEditPtr ptr)
10305 {
10306 
10307    if(ptr == NULL) {
10308       return NULL;
10309    }
10310    MemFree(ptr -> find_txt);
10311    MemFree(ptr -> repl_txt);
10312    return MemFree(ptr);
10313 }
10314 
10315 
10316 /**************************************************
10317 *
10318 *    FieldEditAsnRead()
10319 *
10320 **************************************************/
10321 NLM_EXTERN
10322 FieldEditPtr LIBCALL
FieldEditAsnRead(AsnIoPtr aip,AsnTypePtr orig)10323 FieldEditAsnRead(AsnIoPtr aip, AsnTypePtr orig)
10324 {
10325    DataVal av;
10326    AsnTypePtr atp;
10327    Boolean isError = FALSE;
10328    AsnReadFunc func;
10329    FieldEditPtr ptr;
10330 
10331    if (! loaded)
10332    {
10333       if (! objmacroAsnLoad()) {
10334          return NULL;
10335       }
10336    }
10337 
10338    if (aip == NULL) {
10339       return NULL;
10340    }
10341 
10342    if (orig == NULL) {         /* FieldEdit ::= (self contained) */
10343       atp = AsnReadId(aip, amp, FIELD_EDIT);
10344    } else {
10345       atp = AsnLinkType(orig, FIELD_EDIT);
10346    }
10347    /* link in local tree */
10348    if (atp == NULL) {
10349       return NULL;
10350    }
10351 
10352    ptr = FieldEditNew();
10353    if (ptr == NULL) {
10354       goto erret;
10355    }
10356    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
10357       goto erret;
10358    }
10359 
10360    atp = AsnReadId(aip,amp, atp);
10361    func = NULL;
10362 
10363    if (atp == FIELD_EDIT_find_txt) {
10364       if ( AsnReadVal(aip, atp, &av) <= 0) {
10365          goto erret;
10366       }
10367       ptr -> find_txt = av.ptrvalue;
10368       atp = AsnReadId(aip,amp, atp);
10369    }
10370    if (atp == FIELD_EDIT_repl_txt) {
10371       if ( AsnReadVal(aip, atp, &av) <= 0) {
10372          goto erret;
10373       }
10374       ptr -> repl_txt = av.ptrvalue;
10375       atp = AsnReadId(aip,amp, atp);
10376    }
10377    if (atp == FIELD_EDIT_location) {
10378       if ( AsnReadVal(aip, atp, &av) <= 0) {
10379          goto erret;
10380       }
10381       ptr -> location = av.intvalue;
10382       atp = AsnReadId(aip,amp, atp);
10383    }
10384    if (atp == FIELD_EDIT_case_insensitive) {
10385       if ( AsnReadVal(aip, atp, &av) <= 0) {
10386          goto erret;
10387       }
10388       ptr -> case_insensitive = av.boolvalue;
10389       atp = AsnReadId(aip,amp, atp);
10390    }
10391 
10392    if (AsnReadVal(aip, atp, &av) <= 0) {
10393       goto erret;
10394    }
10395    /* end struct */
10396 
10397 ret:
10398    AsnUnlinkType(orig);       /* unlink local tree */
10399    return ptr;
10400 
10401 erret:
10402    aip -> io_failure = TRUE;
10403    ptr = FieldEditFree(ptr);
10404    goto ret;
10405 }
10406 
10407 
10408 
10409 /**************************************************
10410 *
10411 *    FieldEditAsnWrite()
10412 *
10413 **************************************************/
10414 NLM_EXTERN Boolean LIBCALL
FieldEditAsnWrite(FieldEditPtr ptr,AsnIoPtr aip,AsnTypePtr orig)10415 FieldEditAsnWrite(FieldEditPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
10416 {
10417    DataVal av;
10418    AsnTypePtr atp;
10419    Boolean retval = FALSE;
10420 
10421    if (! loaded)
10422    {
10423       if (! objmacroAsnLoad()) {
10424          return FALSE;
10425       }
10426    }
10427 
10428    if (aip == NULL) {
10429       return FALSE;
10430    }
10431 
10432    atp = AsnLinkType(orig, FIELD_EDIT);   /* link local tree */
10433    if (atp == NULL) {
10434       return FALSE;
10435    }
10436 
10437    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
10438 
10439     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
10440 
10441    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
10442       goto erret;
10443    }
10444 
10445    if (ptr -> find_txt != NULL) {
10446       av.ptrvalue = ptr -> find_txt;
10447       retval = AsnWrite(aip, FIELD_EDIT_find_txt,  &av);
10448    }
10449    if (ptr -> repl_txt != NULL) {
10450       av.ptrvalue = ptr -> repl_txt;
10451       retval = AsnWrite(aip, FIELD_EDIT_repl_txt,  &av);
10452    }
10453    av.intvalue = ptr -> location;
10454    retval = AsnWrite(aip, FIELD_EDIT_location,  &av);
10455    av.boolvalue = ptr -> case_insensitive;
10456    retval = AsnWrite(aip, FIELD_EDIT_case_insensitive,  &av);
10457    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
10458       goto erret;
10459    }
10460    retval = TRUE;
10461 
10462 erret:
10463    AsnUnlinkType(orig);       /* unlink local tree */
10464    return retval;
10465 }
10466 
10467 
10468 
10469 /**************************************************
10470 *
10471 *    FieldPairTypeFree()
10472 *
10473 **************************************************/
10474 NLM_EXTERN
10475 FieldPairTypePtr LIBCALL
FieldPairTypeFree(ValNodePtr anp)10476 FieldPairTypeFree(ValNodePtr anp)
10477 {
10478    Pointer pnt;
10479 
10480    if (anp == NULL) {
10481       return NULL;
10482    }
10483 
10484    pnt = anp->data.ptrvalue;
10485    switch (anp->choice)
10486    {
10487    default:
10488       break;
10489    case FieldPairType_source_qual:
10490       SourceQualPairFree(anp -> data.ptrvalue);
10491       break;
10492    case FieldPairType_feature_field:
10493       FeatureFieldPairFree(anp -> data.ptrvalue);
10494       break;
10495    case FieldPairType_rna_field:
10496       RnaQualPairFree(anp -> data.ptrvalue);
10497       break;
10498    case FieldPairType_cds_gene_prot:
10499       CDSGeneProtFieldPairFree(anp -> data.ptrvalue);
10500       break;
10501    case FieldPairType_molinfo_field:
10502       MolinfoFieldPairFree(anp -> data.ptrvalue);
10503       break;
10504    case FieldPairType_struc_comment_field:
10505       StructuredCommentFieldPairFree(anp -> data.ptrvalue);
10506       break;
10507    case FieldPairType_dblink:
10508       DBLinkFieldPairFree(anp -> data.ptrvalue);
10509       break;
10510    }
10511    return MemFree(anp);
10512 }
10513 
10514 
10515 /**************************************************
10516 *
10517 *    FieldPairTypeAsnRead()
10518 *
10519 **************************************************/
10520 NLM_EXTERN
10521 FieldPairTypePtr LIBCALL
FieldPairTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)10522 FieldPairTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
10523 {
10524    DataVal av;
10525    AsnTypePtr atp;
10526    ValNodePtr anp;
10527    Uint1 choice;
10528    Boolean isError = FALSE;
10529    Boolean nullIsError = FALSE;
10530    AsnReadFunc func;
10531 
10532    if (! loaded)
10533    {
10534       if (! objmacroAsnLoad()) {
10535          return NULL;
10536       }
10537    }
10538 
10539    if (aip == NULL) {
10540       return NULL;
10541    }
10542 
10543    if (orig == NULL) {         /* FieldPairType ::= (self contained) */
10544       atp = AsnReadId(aip, amp, FIELD_PAIR_TYPE);
10545    } else {
10546       atp = AsnLinkType(orig, FIELD_PAIR_TYPE);    /* link in local tree */
10547    }
10548    if (atp == NULL) {
10549       return NULL;
10550    }
10551 
10552    anp = ValNodeNew(NULL);
10553    if (anp == NULL) {
10554       goto erret;
10555    }
10556    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
10557       goto erret;
10558    }
10559 
10560    func = NULL;
10561 
10562    atp = AsnReadId(aip, amp, atp);  /* find the choice */
10563    if (atp == NULL) {
10564       goto erret;
10565    }
10566    if (atp == FIELD_PAIR_TYPE_source_qual) {
10567       choice = FieldPairType_source_qual;
10568       func = (AsnReadFunc) SourceQualPairAsnRead;
10569    }
10570    else if (atp == FIELD_PAIR_TYPE_feature_field) {
10571       choice = FieldPairType_feature_field;
10572       func = (AsnReadFunc) FeatureFieldPairAsnRead;
10573    }
10574    else if (atp == FIELD_PAIR_TYPE_rna_field) {
10575       choice = FieldPairType_rna_field;
10576       func = (AsnReadFunc) RnaQualPairAsnRead;
10577    }
10578    else if (atp == FIELD_PAIR_TYPE_cds_gene_prot) {
10579       choice = FieldPairType_cds_gene_prot;
10580       func = (AsnReadFunc) CDSGeneProtFieldPairAsnRead;
10581    }
10582    else if (atp == FIELD_PAIR_TYPE_molinfo_field) {
10583       choice = FieldPairType_molinfo_field;
10584       func = (AsnReadFunc) MolinfoFieldPairAsnRead;
10585    }
10586    else if (atp == FIELD_PAIR_TYPE_struc_comment_field) {
10587       choice = FieldPairType_struc_comment_field;
10588       func = (AsnReadFunc) StructuredCommentFieldPairAsnRead;
10589    }
10590    else if (atp == FIELD_PAIR_TYPE_dblink) {
10591       choice = FieldPairType_dblink;
10592       func = (AsnReadFunc) DBLinkFieldPairAsnRead;
10593    }
10594    anp->choice = choice;
10595    if (func != NULL)
10596    {
10597       anp->data.ptrvalue = (* func)(aip, atp);
10598       if (aip -> io_failure) goto erret;
10599 
10600       if (nullIsError && anp->data.ptrvalue == NULL) {
10601          goto erret;
10602       }
10603    }
10604 
10605 ret:
10606    AsnUnlinkType(orig);       /* unlink local tree */
10607    return anp;
10608 
10609 erret:
10610    anp = MemFree(anp);
10611    aip -> io_failure = TRUE;
10612    goto ret;
10613 }
10614 
10615 
10616 /**************************************************
10617 *
10618 *    FieldPairTypeAsnWrite()
10619 *
10620 **************************************************/
10621 NLM_EXTERN Boolean LIBCALL
FieldPairTypeAsnWrite(FieldPairTypePtr anp,AsnIoPtr aip,AsnTypePtr orig)10622 FieldPairTypeAsnWrite(FieldPairTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
10623 
10624 {
10625    DataVal av;
10626    AsnTypePtr atp, writetype = NULL;
10627    Pointer pnt;
10628    AsnWriteFunc func = NULL;
10629    Boolean retval = FALSE;
10630 
10631    if (! loaded)
10632    {
10633       if (! objmacroAsnLoad())
10634       return FALSE;
10635    }
10636 
10637    if (aip == NULL)
10638    return FALSE;
10639 
10640    atp = AsnLinkType(orig, FIELD_PAIR_TYPE);   /* link local tree */
10641    if (atp == NULL) {
10642       return FALSE;
10643    }
10644 
10645    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
10646 
10647     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
10648 
10649    av.ptrvalue = (Pointer)anp;
10650    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
10651       goto erret;
10652    }
10653 
10654    pnt = anp->data.ptrvalue;
10655    switch (anp->choice)
10656    {
10657    case FieldPairType_source_qual:
10658       writetype = FIELD_PAIR_TYPE_source_qual;
10659       func = (AsnWriteFunc) SourceQualPairAsnWrite;
10660       break;
10661    case FieldPairType_feature_field:
10662       writetype = FIELD_PAIR_TYPE_feature_field;
10663       func = (AsnWriteFunc) FeatureFieldPairAsnWrite;
10664       break;
10665    case FieldPairType_rna_field:
10666       writetype = FIELD_PAIR_TYPE_rna_field;
10667       func = (AsnWriteFunc) RnaQualPairAsnWrite;
10668       break;
10669    case FieldPairType_cds_gene_prot:
10670       writetype = FIELD_PAIR_TYPE_cds_gene_prot;
10671       func = (AsnWriteFunc) CDSGeneProtFieldPairAsnWrite;
10672       break;
10673    case FieldPairType_molinfo_field:
10674       writetype = FIELD_PAIR_TYPE_molinfo_field;
10675       func = (AsnWriteFunc) MolinfoFieldPairAsnWrite;
10676       break;
10677    case FieldPairType_struc_comment_field:
10678       writetype = FIELD_PAIR_TYPE_struc_comment_field;
10679       func = (AsnWriteFunc) StructuredCommentFieldPairAsnWrite;
10680       break;
10681    case FieldPairType_dblink:
10682       writetype = FIELD_PAIR_TYPE_dblink;
10683       func = (AsnWriteFunc) DBLinkFieldPairAsnWrite;
10684       break;
10685    }
10686    if (writetype != NULL) {
10687       retval = (* func)(pnt, aip, writetype);   /* write it out */
10688    }
10689    if (!retval) {
10690       goto erret;
10691    }
10692    retval = TRUE;
10693 
10694 erret:
10695    AsnUnlinkType(orig);       /* unlink local tree */
10696    return retval;
10697 }
10698 
10699 
10700 /**************************************************
10701 *
10702 *    ApplyActionNew()
10703 *
10704 **************************************************/
10705 NLM_EXTERN
10706 ApplyActionPtr LIBCALL
ApplyActionNew(void)10707 ApplyActionNew(void)
10708 {
10709    ApplyActionPtr ptr = MemNew((size_t) sizeof(ApplyAction));
10710 
10711    return ptr;
10712 
10713 }
10714 
10715 
10716 /**************************************************
10717 *
10718 *    ApplyActionFree()
10719 *
10720 **************************************************/
10721 NLM_EXTERN
10722 ApplyActionPtr LIBCALL
ApplyActionFree(ApplyActionPtr ptr)10723 ApplyActionFree(ApplyActionPtr ptr)
10724 {
10725 
10726    if(ptr == NULL) {
10727       return NULL;
10728    }
10729    FieldTypeFree(ptr -> field);
10730    MemFree(ptr -> value);
10731    return MemFree(ptr);
10732 }
10733 
10734 
10735 /**************************************************
10736 *
10737 *    ApplyActionAsnRead()
10738 *
10739 **************************************************/
10740 NLM_EXTERN
10741 ApplyActionPtr LIBCALL
ApplyActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)10742 ApplyActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
10743 {
10744    DataVal av;
10745    AsnTypePtr atp;
10746    Boolean isError = FALSE;
10747    AsnReadFunc func;
10748    ApplyActionPtr ptr;
10749 
10750    if (! loaded)
10751    {
10752       if (! objmacroAsnLoad()) {
10753          return NULL;
10754       }
10755    }
10756 
10757    if (aip == NULL) {
10758       return NULL;
10759    }
10760 
10761    if (orig == NULL) {         /* ApplyAction ::= (self contained) */
10762       atp = AsnReadId(aip, amp, APPLY_ACTION);
10763    } else {
10764       atp = AsnLinkType(orig, APPLY_ACTION);
10765    }
10766    /* link in local tree */
10767    if (atp == NULL) {
10768       return NULL;
10769    }
10770 
10771    ptr = ApplyActionNew();
10772    if (ptr == NULL) {
10773       goto erret;
10774    }
10775    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
10776       goto erret;
10777    }
10778 
10779    atp = AsnReadId(aip,amp, atp);
10780    func = NULL;
10781 
10782    if (atp == APPLY_ACTION_field) {
10783       ptr -> field = FieldTypeAsnRead(aip, atp);
10784       if (aip -> io_failure) {
10785          goto erret;
10786       }
10787       atp = AsnReadId(aip,amp, atp);
10788    }
10789    if (atp == APPLY_ACTION_value) {
10790       if ( AsnReadVal(aip, atp, &av) <= 0) {
10791          goto erret;
10792       }
10793       ptr -> value = av.ptrvalue;
10794       atp = AsnReadId(aip,amp, atp);
10795    }
10796    if (atp == APPLY_ACTION_existing_text) {
10797       if ( AsnReadVal(aip, atp, &av) <= 0) {
10798          goto erret;
10799       }
10800       ptr -> existing_text = av.intvalue;
10801       atp = AsnReadId(aip,amp, atp);
10802    }
10803 
10804    if (AsnReadVal(aip, atp, &av) <= 0) {
10805       goto erret;
10806    }
10807    /* end struct */
10808 
10809 ret:
10810    AsnUnlinkType(orig);       /* unlink local tree */
10811    return ptr;
10812 
10813 erret:
10814    aip -> io_failure = TRUE;
10815    ptr = ApplyActionFree(ptr);
10816    goto ret;
10817 }
10818 
10819 
10820 
10821 /**************************************************
10822 *
10823 *    ApplyActionAsnWrite()
10824 *
10825 **************************************************/
10826 NLM_EXTERN Boolean LIBCALL
ApplyActionAsnWrite(ApplyActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)10827 ApplyActionAsnWrite(ApplyActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
10828 {
10829    DataVal av;
10830    AsnTypePtr atp;
10831    Boolean retval = FALSE;
10832 
10833    if (! loaded)
10834    {
10835       if (! objmacroAsnLoad()) {
10836          return FALSE;
10837       }
10838    }
10839 
10840    if (aip == NULL) {
10841       return FALSE;
10842    }
10843 
10844    atp = AsnLinkType(orig, APPLY_ACTION);   /* link local tree */
10845    if (atp == NULL) {
10846       return FALSE;
10847    }
10848 
10849    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
10850 
10851     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
10852 
10853    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
10854       goto erret;
10855    }
10856 
10857    if (ptr -> field != NULL) {
10858       if ( ! FieldTypeAsnWrite(ptr -> field, aip, APPLY_ACTION_field)) {
10859          goto erret;
10860       }
10861    }
10862    if (ptr -> value != NULL) {
10863       av.ptrvalue = ptr -> value;
10864       retval = AsnWrite(aip, APPLY_ACTION_value,  &av);
10865    }
10866    av.intvalue = ptr -> existing_text;
10867    retval = AsnWrite(aip, APPLY_ACTION_existing_text,  &av);
10868    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
10869       goto erret;
10870    }
10871    retval = TRUE;
10872 
10873 erret:
10874    AsnUnlinkType(orig);       /* unlink local tree */
10875    return retval;
10876 }
10877 
10878 
10879 
10880 /**************************************************
10881 *
10882 *    EditActionNew()
10883 *
10884 **************************************************/
10885 NLM_EXTERN
10886 EditActionPtr LIBCALL
EditActionNew(void)10887 EditActionNew(void)
10888 {
10889    EditActionPtr ptr = MemNew((size_t) sizeof(EditAction));
10890 
10891    return ptr;
10892 
10893 }
10894 
10895 
10896 /**************************************************
10897 *
10898 *    EditActionFree()
10899 *
10900 **************************************************/
10901 NLM_EXTERN
10902 EditActionPtr LIBCALL
EditActionFree(EditActionPtr ptr)10903 EditActionFree(EditActionPtr ptr)
10904 {
10905 
10906    if(ptr == NULL) {
10907       return NULL;
10908    }
10909    FieldEditFree(ptr -> edit);
10910    FieldTypeFree(ptr -> field);
10911    return MemFree(ptr);
10912 }
10913 
10914 
10915 /**************************************************
10916 *
10917 *    EditActionAsnRead()
10918 *
10919 **************************************************/
10920 NLM_EXTERN
10921 EditActionPtr LIBCALL
EditActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)10922 EditActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
10923 {
10924    DataVal av;
10925    AsnTypePtr atp;
10926    Boolean isError = FALSE;
10927    AsnReadFunc func;
10928    EditActionPtr ptr;
10929 
10930    if (! loaded)
10931    {
10932       if (! objmacroAsnLoad()) {
10933          return NULL;
10934       }
10935    }
10936 
10937    if (aip == NULL) {
10938       return NULL;
10939    }
10940 
10941    if (orig == NULL) {         /* EditAction ::= (self contained) */
10942       atp = AsnReadId(aip, amp, EDIT_ACTION);
10943    } else {
10944       atp = AsnLinkType(orig, EDIT_ACTION);
10945    }
10946    /* link in local tree */
10947    if (atp == NULL) {
10948       return NULL;
10949    }
10950 
10951    ptr = EditActionNew();
10952    if (ptr == NULL) {
10953       goto erret;
10954    }
10955    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
10956       goto erret;
10957    }
10958 
10959    atp = AsnReadId(aip,amp, atp);
10960    func = NULL;
10961 
10962    if (atp == EDIT_ACTION_edit) {
10963       ptr -> edit = FieldEditAsnRead(aip, atp);
10964       if (aip -> io_failure) {
10965          goto erret;
10966       }
10967       atp = AsnReadId(aip,amp, atp);
10968    }
10969    if (atp == EDIT_ACTION_field) {
10970       ptr -> field = FieldTypeAsnRead(aip, atp);
10971       if (aip -> io_failure) {
10972          goto erret;
10973       }
10974       atp = AsnReadId(aip,amp, atp);
10975    }
10976 
10977    if (AsnReadVal(aip, atp, &av) <= 0) {
10978       goto erret;
10979    }
10980    /* end struct */
10981 
10982 ret:
10983    AsnUnlinkType(orig);       /* unlink local tree */
10984    return ptr;
10985 
10986 erret:
10987    aip -> io_failure = TRUE;
10988    ptr = EditActionFree(ptr);
10989    goto ret;
10990 }
10991 
10992 
10993 
10994 /**************************************************
10995 *
10996 *    EditActionAsnWrite()
10997 *
10998 **************************************************/
10999 NLM_EXTERN Boolean LIBCALL
EditActionAsnWrite(EditActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)11000 EditActionAsnWrite(EditActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
11001 {
11002    DataVal av;
11003    AsnTypePtr atp;
11004    Boolean retval = FALSE;
11005 
11006    if (! loaded)
11007    {
11008       if (! objmacroAsnLoad()) {
11009          return FALSE;
11010       }
11011    }
11012 
11013    if (aip == NULL) {
11014       return FALSE;
11015    }
11016 
11017    atp = AsnLinkType(orig, EDIT_ACTION);   /* link local tree */
11018    if (atp == NULL) {
11019       return FALSE;
11020    }
11021 
11022    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
11023 
11024     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
11025 
11026    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
11027       goto erret;
11028    }
11029 
11030    if (ptr -> edit != NULL) {
11031       if ( ! FieldEditAsnWrite(ptr -> edit, aip, EDIT_ACTION_edit)) {
11032          goto erret;
11033       }
11034    }
11035    if (ptr -> field != NULL) {
11036       if ( ! FieldTypeAsnWrite(ptr -> field, aip, EDIT_ACTION_field)) {
11037          goto erret;
11038       }
11039    }
11040    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
11041       goto erret;
11042    }
11043    retval = TRUE;
11044 
11045 erret:
11046    AsnUnlinkType(orig);       /* unlink local tree */
11047    return retval;
11048 }
11049 
11050 
11051 
11052 /**************************************************
11053 *
11054 *    TextTransformFree()
11055 *
11056 **************************************************/
11057 NLM_EXTERN
11058 TextTransformPtr LIBCALL
TextTransformFree(ValNodePtr anp)11059 TextTransformFree(ValNodePtr anp)
11060 {
11061    Pointer pnt;
11062 
11063    if (anp == NULL) {
11064       return NULL;
11065    }
11066 
11067    pnt = anp->data.ptrvalue;
11068    switch (anp->choice)
11069    {
11070    default:
11071       break;
11072    case TextTransform_edit:
11073       FieldEditFree(anp -> data.ptrvalue);
11074       break;
11075    case TextTransform_remove:
11076       TextPortionFree(anp -> data.ptrvalue);
11077       break;
11078    }
11079    return MemFree(anp);
11080 }
11081 
11082 
11083 /**************************************************
11084 *
11085 *    TextTransformAsnRead()
11086 *
11087 **************************************************/
11088 NLM_EXTERN
11089 TextTransformPtr LIBCALL
TextTransformAsnRead(AsnIoPtr aip,AsnTypePtr orig)11090 TextTransformAsnRead(AsnIoPtr aip, AsnTypePtr orig)
11091 {
11092    DataVal av;
11093    AsnTypePtr atp;
11094    ValNodePtr anp;
11095    Uint1 choice;
11096    Boolean isError = FALSE;
11097    Boolean nullIsError = FALSE;
11098    AsnReadFunc func;
11099 
11100    if (! loaded)
11101    {
11102       if (! objmacroAsnLoad()) {
11103          return NULL;
11104       }
11105    }
11106 
11107    if (aip == NULL) {
11108       return NULL;
11109    }
11110 
11111    if (orig == NULL) {         /* TextTransform ::= (self contained) */
11112       atp = AsnReadId(aip, amp, TEXT_TRANSFORM);
11113    } else {
11114       atp = AsnLinkType(orig, TEXT_TRANSFORM);    /* link in local tree */
11115    }
11116    if (atp == NULL) {
11117       return NULL;
11118    }
11119 
11120    anp = ValNodeNew(NULL);
11121    if (anp == NULL) {
11122       goto erret;
11123    }
11124    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
11125       goto erret;
11126    }
11127 
11128    func = NULL;
11129 
11130    atp = AsnReadId(aip, amp, atp);  /* find the choice */
11131    if (atp == NULL) {
11132       goto erret;
11133    }
11134    if (atp == TEXT_TRANSFORM_edit) {
11135       choice = TextTransform_edit;
11136       func = (AsnReadFunc) FieldEditAsnRead;
11137    }
11138    else if (atp == TEXT_TRANSFORM_caps) {
11139       choice = TextTransform_caps;
11140       if (AsnReadVal(aip, atp, &av) <= 0) {
11141          goto erret;
11142       }
11143       anp->data.intvalue = av.intvalue;
11144    }
11145    else if (atp == TEXT_TRANSFORM_remove) {
11146       choice = TextTransform_remove;
11147       func = (AsnReadFunc) TextPortionAsnRead;
11148    }
11149    anp->choice = choice;
11150    if (func != NULL)
11151    {
11152       anp->data.ptrvalue = (* func)(aip, atp);
11153       if (aip -> io_failure) goto erret;
11154 
11155       if (nullIsError && anp->data.ptrvalue == NULL) {
11156          goto erret;
11157       }
11158    }
11159 
11160 ret:
11161    AsnUnlinkType(orig);       /* unlink local tree */
11162    return anp;
11163 
11164 erret:
11165    anp = MemFree(anp);
11166    aip -> io_failure = TRUE;
11167    goto ret;
11168 }
11169 
11170 
11171 /**************************************************
11172 *
11173 *    TextTransformAsnWrite()
11174 *
11175 **************************************************/
11176 NLM_EXTERN Boolean LIBCALL
TextTransformAsnWrite(TextTransformPtr anp,AsnIoPtr aip,AsnTypePtr orig)11177 TextTransformAsnWrite(TextTransformPtr anp, AsnIoPtr aip, AsnTypePtr orig)
11178 
11179 {
11180    DataVal av;
11181    AsnTypePtr atp, writetype = NULL;
11182    Pointer pnt;
11183    AsnWriteFunc func = NULL;
11184    Boolean retval = FALSE;
11185 
11186    if (! loaded)
11187    {
11188       if (! objmacroAsnLoad())
11189       return FALSE;
11190    }
11191 
11192    if (aip == NULL)
11193    return FALSE;
11194 
11195    atp = AsnLinkType(orig, TEXT_TRANSFORM);   /* link local tree */
11196    if (atp == NULL) {
11197       return FALSE;
11198    }
11199 
11200    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
11201 
11202     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
11203 
11204    av.ptrvalue = (Pointer)anp;
11205    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
11206       goto erret;
11207    }
11208 
11209    pnt = anp->data.ptrvalue;
11210    switch (anp->choice)
11211    {
11212    case TextTransform_edit:
11213       writetype = TEXT_TRANSFORM_edit;
11214       func = (AsnWriteFunc) FieldEditAsnWrite;
11215       break;
11216    case TextTransform_caps:
11217       av.intvalue = anp->data.intvalue;
11218       retval = AsnWrite(aip, TEXT_TRANSFORM_caps, &av);
11219       break;
11220    case TextTransform_remove:
11221       writetype = TEXT_TRANSFORM_remove;
11222       func = (AsnWriteFunc) TextPortionAsnWrite;
11223       break;
11224    }
11225    if (writetype != NULL) {
11226       retval = (* func)(pnt, aip, writetype);   /* write it out */
11227    }
11228    if (!retval) {
11229       goto erret;
11230    }
11231    retval = TRUE;
11232 
11233 erret:
11234    AsnUnlinkType(orig);       /* unlink local tree */
11235    return retval;
11236 }
11237 
11238 
11239 /**************************************************
11240 *
11241 *    TextTransformSetFree()
11242 *
11243 **************************************************/
11244 NLM_EXTERN
11245 TextTransformSetPtr LIBCALL
TextTransformSetFree(TextTransformSetPtr ptr)11246 TextTransformSetFree(TextTransformSetPtr ptr)
11247 {
11248 
11249    if(ptr == NULL) {
11250       return NULL;
11251    }
11252    AsnGenericChoiceSeqOfFree(ptr, (AsnOptFreeFunc) TextTransformFree);
11253    return NULL;
11254 }
11255 
11256 
11257 /**************************************************
11258 *
11259 *    TextTransformSetAsnRead()
11260 *
11261 **************************************************/
11262 NLM_EXTERN
11263 TextTransformSetPtr LIBCALL
TextTransformSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)11264 TextTransformSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
11265 {
11266    DataVal av;
11267    AsnTypePtr atp;
11268    Boolean isError = FALSE;
11269    AsnReadFunc func;
11270    TextTransformSetPtr ptr;
11271 
11272    if (! loaded)
11273    {
11274       if (! objmacroAsnLoad()) {
11275          return NULL;
11276       }
11277    }
11278 
11279    if (aip == NULL) {
11280       return NULL;
11281    }
11282 
11283    if (orig == NULL) {         /* TextTransformSet ::= (self contained) */
11284       atp = AsnReadId(aip, amp, TEXT_TRANSFORM_SET);
11285    } else {
11286       atp = AsnLinkType(orig, TEXT_TRANSFORM_SET);
11287    }
11288    /* link in local tree */
11289    if (atp == NULL) {
11290       return NULL;
11291    }
11292 
11293    func = NULL;
11294 
11295    ptr  = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) TextTransformAsnRead, (AsnOptFreeFunc) TextTransformFree);
11296    if (isError && ptr  == NULL) {
11297       goto erret;
11298    }
11299 
11300 
11301 
11302 ret:
11303    AsnUnlinkType(orig);       /* unlink local tree */
11304    return ptr;
11305 
11306 erret:
11307    aip -> io_failure = TRUE;
11308    ptr = TextTransformSetFree(ptr);
11309    goto ret;
11310 }
11311 
11312 
11313 
11314 /**************************************************
11315 *
11316 *    TextTransformSetAsnWrite()
11317 *
11318 **************************************************/
11319 NLM_EXTERN Boolean LIBCALL
TextTransformSetAsnWrite(TextTransformSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)11320 TextTransformSetAsnWrite(TextTransformSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
11321 {
11322    DataVal av;
11323    AsnTypePtr atp;
11324    Boolean retval = FALSE;
11325 
11326    if (! loaded)
11327    {
11328       if (! objmacroAsnLoad()) {
11329          return FALSE;
11330       }
11331    }
11332 
11333    if (aip == NULL) {
11334       return FALSE;
11335    }
11336 
11337    atp = AsnLinkType(orig, TEXT_TRANSFORM_SET);   /* link local tree */
11338    if (atp == NULL) {
11339       return FALSE;
11340    }
11341 
11342    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
11343 
11344     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
11345 
11346    retval = AsnGenericChoiceSeqOfAsnWrite(ptr , (AsnWriteFunc) TextTransformAsnWrite, aip, atp, TEXT_TRANSFORM_SET_E);
11347    retval = TRUE;
11348 
11349 erret:
11350    AsnUnlinkType(orig);       /* unlink local tree */
11351    return retval;
11352 }
11353 
11354 
11355 
11356 /**************************************************
11357 *
11358 *    ConvertActionNew()
11359 *
11360 **************************************************/
11361 NLM_EXTERN
11362 ConvertActionPtr LIBCALL
ConvertActionNew(void)11363 ConvertActionNew(void)
11364 {
11365    ConvertActionPtr ptr = MemNew((size_t) sizeof(ConvertAction));
11366 
11367    ptr -> strip_name = 0;
11368    ptr -> keep_original = 0;
11369    ptr -> capitalization = 0;
11370    return ptr;
11371 
11372 }
11373 
11374 
11375 /**************************************************
11376 *
11377 *    ConvertActionFree()
11378 *
11379 **************************************************/
11380 NLM_EXTERN
11381 ConvertActionPtr LIBCALL
ConvertActionFree(ConvertActionPtr ptr)11382 ConvertActionFree(ConvertActionPtr ptr)
11383 {
11384 
11385    if(ptr == NULL) {
11386       return NULL;
11387    }
11388    FieldPairTypeFree(ptr -> fields);
11389    return MemFree(ptr);
11390 }
11391 
11392 
11393 /**************************************************
11394 *
11395 *    ConvertActionAsnRead()
11396 *
11397 **************************************************/
11398 NLM_EXTERN
11399 ConvertActionPtr LIBCALL
ConvertActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)11400 ConvertActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
11401 {
11402    DataVal av;
11403    AsnTypePtr atp;
11404    Boolean isError = FALSE;
11405    AsnReadFunc func;
11406    ConvertActionPtr ptr;
11407 
11408    if (! loaded)
11409    {
11410       if (! objmacroAsnLoad()) {
11411          return NULL;
11412       }
11413    }
11414 
11415    if (aip == NULL) {
11416       return NULL;
11417    }
11418 
11419    if (orig == NULL) {         /* ConvertAction ::= (self contained) */
11420       atp = AsnReadId(aip, amp, CONVERT_ACTION);
11421    } else {
11422       atp = AsnLinkType(orig, CONVERT_ACTION);
11423    }
11424    /* link in local tree */
11425    if (atp == NULL) {
11426       return NULL;
11427    }
11428 
11429    ptr = ConvertActionNew();
11430    if (ptr == NULL) {
11431       goto erret;
11432    }
11433    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
11434       goto erret;
11435    }
11436 
11437    atp = AsnReadId(aip,amp, atp);
11438    func = NULL;
11439 
11440    if (atp == CONVERT_ACTION_fields) {
11441       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
11442       if (aip -> io_failure) {
11443          goto erret;
11444       }
11445       atp = AsnReadId(aip,amp, atp);
11446    }
11447    if (atp == CONVERT_ACTION_strip_name) {
11448       if ( AsnReadVal(aip, atp, &av) <= 0) {
11449          goto erret;
11450       }
11451       ptr -> strip_name = av.boolvalue;
11452       atp = AsnReadId(aip,amp, atp);
11453    }
11454    if (atp == CONVERT_ACTION_keep_original) {
11455       if ( AsnReadVal(aip, atp, &av) <= 0) {
11456          goto erret;
11457       }
11458       ptr -> keep_original = av.boolvalue;
11459       atp = AsnReadId(aip,amp, atp);
11460    }
11461    if (atp == CONVERT_ACTION_capitalization) {
11462       if ( AsnReadVal(aip, atp, &av) <= 0) {
11463          goto erret;
11464       }
11465       ptr -> capitalization = av.intvalue;
11466       atp = AsnReadId(aip,amp, atp);
11467    }
11468    if (atp == CONVERT_ACTION_existing_text) {
11469       if ( AsnReadVal(aip, atp, &av) <= 0) {
11470          goto erret;
11471       }
11472       ptr -> existing_text = av.intvalue;
11473       atp = AsnReadId(aip,amp, atp);
11474    }
11475 
11476    if (AsnReadVal(aip, atp, &av) <= 0) {
11477       goto erret;
11478    }
11479    /* end struct */
11480 
11481 ret:
11482    AsnUnlinkType(orig);       /* unlink local tree */
11483    return ptr;
11484 
11485 erret:
11486    aip -> io_failure = TRUE;
11487    ptr = ConvertActionFree(ptr);
11488    goto ret;
11489 }
11490 
11491 
11492 
11493 /**************************************************
11494 *
11495 *    ConvertActionAsnWrite()
11496 *
11497 **************************************************/
11498 NLM_EXTERN Boolean LIBCALL
ConvertActionAsnWrite(ConvertActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)11499 ConvertActionAsnWrite(ConvertActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
11500 {
11501    DataVal av;
11502    AsnTypePtr atp;
11503    Boolean retval = FALSE;
11504 
11505    if (! loaded)
11506    {
11507       if (! objmacroAsnLoad()) {
11508          return FALSE;
11509       }
11510    }
11511 
11512    if (aip == NULL) {
11513       return FALSE;
11514    }
11515 
11516    atp = AsnLinkType(orig, CONVERT_ACTION);   /* link local tree */
11517    if (atp == NULL) {
11518       return FALSE;
11519    }
11520 
11521    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
11522 
11523     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
11524 
11525    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
11526       goto erret;
11527    }
11528 
11529    if (ptr -> fields != NULL) {
11530       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, CONVERT_ACTION_fields)) {
11531          goto erret;
11532       }
11533    }
11534    av.boolvalue = ptr -> strip_name;
11535    retval = AsnWrite(aip, CONVERT_ACTION_strip_name,  &av);
11536    av.boolvalue = ptr -> keep_original;
11537    retval = AsnWrite(aip, CONVERT_ACTION_keep_original,  &av);
11538    av.intvalue = ptr -> capitalization;
11539    retval = AsnWrite(aip, CONVERT_ACTION_capitalization,  &av);
11540    av.intvalue = ptr -> existing_text;
11541    retval = AsnWrite(aip, CONVERT_ACTION_existing_text,  &av);
11542    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
11543       goto erret;
11544    }
11545    retval = TRUE;
11546 
11547 erret:
11548    AsnUnlinkType(orig);       /* unlink local tree */
11549    return retval;
11550 }
11551 
11552 
11553 
11554 /**************************************************
11555 *
11556 *    CopyActionNew()
11557 *
11558 **************************************************/
11559 NLM_EXTERN
11560 CopyActionPtr LIBCALL
CopyActionNew(void)11561 CopyActionNew(void)
11562 {
11563    CopyActionPtr ptr = MemNew((size_t) sizeof(CopyAction));
11564 
11565    return ptr;
11566 
11567 }
11568 
11569 
11570 /**************************************************
11571 *
11572 *    CopyActionFree()
11573 *
11574 **************************************************/
11575 NLM_EXTERN
11576 CopyActionPtr LIBCALL
CopyActionFree(CopyActionPtr ptr)11577 CopyActionFree(CopyActionPtr ptr)
11578 {
11579 
11580    if(ptr == NULL) {
11581       return NULL;
11582    }
11583    FieldPairTypeFree(ptr -> fields);
11584    return MemFree(ptr);
11585 }
11586 
11587 
11588 /**************************************************
11589 *
11590 *    CopyActionAsnRead()
11591 *
11592 **************************************************/
11593 NLM_EXTERN
11594 CopyActionPtr LIBCALL
CopyActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)11595 CopyActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
11596 {
11597    DataVal av;
11598    AsnTypePtr atp;
11599    Boolean isError = FALSE;
11600    AsnReadFunc func;
11601    CopyActionPtr ptr;
11602 
11603    if (! loaded)
11604    {
11605       if (! objmacroAsnLoad()) {
11606          return NULL;
11607       }
11608    }
11609 
11610    if (aip == NULL) {
11611       return NULL;
11612    }
11613 
11614    if (orig == NULL) {         /* CopyAction ::= (self contained) */
11615       atp = AsnReadId(aip, amp, COPY_ACTION);
11616    } else {
11617       atp = AsnLinkType(orig, COPY_ACTION);
11618    }
11619    /* link in local tree */
11620    if (atp == NULL) {
11621       return NULL;
11622    }
11623 
11624    ptr = CopyActionNew();
11625    if (ptr == NULL) {
11626       goto erret;
11627    }
11628    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
11629       goto erret;
11630    }
11631 
11632    atp = AsnReadId(aip,amp, atp);
11633    func = NULL;
11634 
11635    if (atp == COPY_ACTION_fields) {
11636       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
11637       if (aip -> io_failure) {
11638          goto erret;
11639       }
11640       atp = AsnReadId(aip,amp, atp);
11641    }
11642    if (atp == COPY_ACTION_existing_text) {
11643       if ( AsnReadVal(aip, atp, &av) <= 0) {
11644          goto erret;
11645       }
11646       ptr -> existing_text = av.intvalue;
11647       atp = AsnReadId(aip,amp, atp);
11648    }
11649 
11650    if (AsnReadVal(aip, atp, &av) <= 0) {
11651       goto erret;
11652    }
11653    /* end struct */
11654 
11655 ret:
11656    AsnUnlinkType(orig);       /* unlink local tree */
11657    return ptr;
11658 
11659 erret:
11660    aip -> io_failure = TRUE;
11661    ptr = CopyActionFree(ptr);
11662    goto ret;
11663 }
11664 
11665 
11666 
11667 /**************************************************
11668 *
11669 *    CopyActionAsnWrite()
11670 *
11671 **************************************************/
11672 NLM_EXTERN Boolean LIBCALL
CopyActionAsnWrite(CopyActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)11673 CopyActionAsnWrite(CopyActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
11674 {
11675    DataVal av;
11676    AsnTypePtr atp;
11677    Boolean retval = FALSE;
11678 
11679    if (! loaded)
11680    {
11681       if (! objmacroAsnLoad()) {
11682          return FALSE;
11683       }
11684    }
11685 
11686    if (aip == NULL) {
11687       return FALSE;
11688    }
11689 
11690    atp = AsnLinkType(orig, COPY_ACTION);   /* link local tree */
11691    if (atp == NULL) {
11692       return FALSE;
11693    }
11694 
11695    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
11696 
11697     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
11698 
11699    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
11700       goto erret;
11701    }
11702 
11703    if (ptr -> fields != NULL) {
11704       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, COPY_ACTION_fields)) {
11705          goto erret;
11706       }
11707    }
11708    av.intvalue = ptr -> existing_text;
11709    retval = AsnWrite(aip, COPY_ACTION_existing_text,  &av);
11710    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
11711       goto erret;
11712    }
11713    retval = TRUE;
11714 
11715 erret:
11716    AsnUnlinkType(orig);       /* unlink local tree */
11717    return retval;
11718 }
11719 
11720 
11721 
11722 /**************************************************
11723 *
11724 *    SwapActionNew()
11725 *
11726 **************************************************/
11727 NLM_EXTERN
11728 SwapActionPtr LIBCALL
SwapActionNew(void)11729 SwapActionNew(void)
11730 {
11731    SwapActionPtr ptr = MemNew((size_t) sizeof(SwapAction));
11732 
11733    return ptr;
11734 
11735 }
11736 
11737 
11738 /**************************************************
11739 *
11740 *    SwapActionFree()
11741 *
11742 **************************************************/
11743 NLM_EXTERN
11744 SwapActionPtr LIBCALL
SwapActionFree(SwapActionPtr ptr)11745 SwapActionFree(SwapActionPtr ptr)
11746 {
11747 
11748    if(ptr == NULL) {
11749       return NULL;
11750    }
11751    FieldPairTypeFree(ptr -> fields);
11752    return MemFree(ptr);
11753 }
11754 
11755 
11756 /**************************************************
11757 *
11758 *    SwapActionAsnRead()
11759 *
11760 **************************************************/
11761 NLM_EXTERN
11762 SwapActionPtr LIBCALL
SwapActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)11763 SwapActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
11764 {
11765    DataVal av;
11766    AsnTypePtr atp;
11767    Boolean isError = FALSE;
11768    AsnReadFunc func;
11769    SwapActionPtr ptr;
11770 
11771    if (! loaded)
11772    {
11773       if (! objmacroAsnLoad()) {
11774          return NULL;
11775       }
11776    }
11777 
11778    if (aip == NULL) {
11779       return NULL;
11780    }
11781 
11782    if (orig == NULL) {         /* SwapAction ::= (self contained) */
11783       atp = AsnReadId(aip, amp, SWAP_ACTION);
11784    } else {
11785       atp = AsnLinkType(orig, SWAP_ACTION);
11786    }
11787    /* link in local tree */
11788    if (atp == NULL) {
11789       return NULL;
11790    }
11791 
11792    ptr = SwapActionNew();
11793    if (ptr == NULL) {
11794       goto erret;
11795    }
11796    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
11797       goto erret;
11798    }
11799 
11800    atp = AsnReadId(aip,amp, atp);
11801    func = NULL;
11802 
11803    if (atp == SWAP_ACTION_fields) {
11804       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
11805       if (aip -> io_failure) {
11806          goto erret;
11807       }
11808       atp = AsnReadId(aip,amp, atp);
11809    }
11810 
11811    if (AsnReadVal(aip, atp, &av) <= 0) {
11812       goto erret;
11813    }
11814    /* end struct */
11815 
11816 ret:
11817    AsnUnlinkType(orig);       /* unlink local tree */
11818    return ptr;
11819 
11820 erret:
11821    aip -> io_failure = TRUE;
11822    ptr = SwapActionFree(ptr);
11823    goto ret;
11824 }
11825 
11826 
11827 
11828 /**************************************************
11829 *
11830 *    SwapActionAsnWrite()
11831 *
11832 **************************************************/
11833 NLM_EXTERN Boolean LIBCALL
SwapActionAsnWrite(SwapActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)11834 SwapActionAsnWrite(SwapActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
11835 {
11836    DataVal av;
11837    AsnTypePtr atp;
11838    Boolean retval = FALSE;
11839 
11840    if (! loaded)
11841    {
11842       if (! objmacroAsnLoad()) {
11843          return FALSE;
11844       }
11845    }
11846 
11847    if (aip == NULL) {
11848       return FALSE;
11849    }
11850 
11851    atp = AsnLinkType(orig, SWAP_ACTION);   /* link local tree */
11852    if (atp == NULL) {
11853       return FALSE;
11854    }
11855 
11856    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
11857 
11858     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
11859 
11860    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
11861       goto erret;
11862    }
11863 
11864    if (ptr -> fields != NULL) {
11865       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, SWAP_ACTION_fields)) {
11866          goto erret;
11867       }
11868    }
11869    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
11870       goto erret;
11871    }
11872    retval = TRUE;
11873 
11874 erret:
11875    AsnUnlinkType(orig);       /* unlink local tree */
11876    return retval;
11877 }
11878 
11879 
11880 
11881 /**************************************************
11882 *
11883 *    AECRParseActionNew()
11884 *
11885 **************************************************/
11886 NLM_EXTERN
11887 AECRParseActionPtr LIBCALL
AECRParseActionNew(void)11888 AECRParseActionNew(void)
11889 {
11890    AECRParseActionPtr ptr = MemNew((size_t) sizeof(AECRParseAction));
11891 
11892    ptr -> remove_from_parsed = 0;
11893    ptr -> remove_left = 0;
11894    ptr -> remove_right = 0;
11895    return ptr;
11896 
11897 }
11898 
11899 
11900 /**************************************************
11901 *
11902 *    AECRParseActionFree()
11903 *
11904 **************************************************/
11905 NLM_EXTERN
11906 AECRParseActionPtr LIBCALL
AECRParseActionFree(AECRParseActionPtr ptr)11907 AECRParseActionFree(AECRParseActionPtr ptr)
11908 {
11909 
11910    if(ptr == NULL) {
11911       return NULL;
11912    }
11913    TextPortionFree(ptr -> portion);
11914    FieldPairTypeFree(ptr -> fields);
11915    TextTransformSetFree(ptr -> transform);
11916    return MemFree(ptr);
11917 }
11918 
11919 
11920 /**************************************************
11921 *
11922 *    AECRParseActionAsnRead()
11923 *
11924 **************************************************/
11925 NLM_EXTERN
11926 AECRParseActionPtr LIBCALL
AECRParseActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)11927 AECRParseActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
11928 {
11929    DataVal av;
11930    AsnTypePtr atp;
11931    Boolean isError = FALSE;
11932    AsnReadFunc func;
11933    AECRParseActionPtr ptr;
11934 
11935    if (! loaded)
11936    {
11937       if (! objmacroAsnLoad()) {
11938          return NULL;
11939       }
11940    }
11941 
11942    if (aip == NULL) {
11943       return NULL;
11944    }
11945 
11946    if (orig == NULL) {         /* AECRParseAction ::= (self contained) */
11947       atp = AsnReadId(aip, amp, AECRPARSE_ACTION);
11948    } else {
11949       atp = AsnLinkType(orig, AECRPARSE_ACTION);
11950    }
11951    /* link in local tree */
11952    if (atp == NULL) {
11953       return NULL;
11954    }
11955 
11956    ptr = AECRParseActionNew();
11957    if (ptr == NULL) {
11958       goto erret;
11959    }
11960    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
11961       goto erret;
11962    }
11963 
11964    atp = AsnReadId(aip,amp, atp);
11965    func = NULL;
11966 
11967    if (atp == AECRPARSE_ACTION_portion) {
11968       ptr -> portion = TextPortionAsnRead(aip, atp);
11969       if (aip -> io_failure) {
11970          goto erret;
11971       }
11972       atp = AsnReadId(aip,amp, atp);
11973    }
11974    if (atp == AECRPARSE_ACTION_fields) {
11975       ptr -> fields = FieldPairTypeAsnRead(aip, atp);
11976       if (aip -> io_failure) {
11977          goto erret;
11978       }
11979       atp = AsnReadId(aip,amp, atp);
11980    }
11981    if (atp == AECRPARSE_ACTION_remove_from_parsed) {
11982       if ( AsnReadVal(aip, atp, &av) <= 0) {
11983          goto erret;
11984       }
11985       ptr -> remove_from_parsed = av.boolvalue;
11986       atp = AsnReadId(aip,amp, atp);
11987    }
11988    if (atp == AECRPARSE_ACTION_remove_left) {
11989       if ( AsnReadVal(aip, atp, &av) <= 0) {
11990          goto erret;
11991       }
11992       ptr -> remove_left = av.boolvalue;
11993       atp = AsnReadId(aip,amp, atp);
11994    }
11995    if (atp == AECRPARSE_ACTION_remove_right) {
11996       if ( AsnReadVal(aip, atp, &av) <= 0) {
11997          goto erret;
11998       }
11999       ptr -> remove_right = av.boolvalue;
12000       atp = AsnReadId(aip,amp, atp);
12001    }
12002    if (atp == AECRPARSE_ACTION_transform) {
12003       ptr -> transform = TextTransformSetAsnRead(aip, atp);
12004       if (aip -> io_failure) {
12005          goto erret;
12006       }
12007       atp = AsnReadId(aip,amp, atp);
12008    }
12009    if (atp == AECRPARSE_ACTION_existing_text) {
12010       if ( AsnReadVal(aip, atp, &av) <= 0) {
12011          goto erret;
12012       }
12013       ptr -> existing_text = av.intvalue;
12014       atp = AsnReadId(aip,amp, atp);
12015    }
12016 
12017    if (AsnReadVal(aip, atp, &av) <= 0) {
12018       goto erret;
12019    }
12020    /* end struct */
12021 
12022 ret:
12023    AsnUnlinkType(orig);       /* unlink local tree */
12024    return ptr;
12025 
12026 erret:
12027    aip -> io_failure = TRUE;
12028    ptr = AECRParseActionFree(ptr);
12029    goto ret;
12030 }
12031 
12032 
12033 
12034 /**************************************************
12035 *
12036 *    AECRParseActionAsnWrite()
12037 *
12038 **************************************************/
12039 NLM_EXTERN Boolean LIBCALL
AECRParseActionAsnWrite(AECRParseActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)12040 AECRParseActionAsnWrite(AECRParseActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
12041 {
12042    DataVal av;
12043    AsnTypePtr atp;
12044    Boolean retval = FALSE;
12045 
12046    if (! loaded)
12047    {
12048       if (! objmacroAsnLoad()) {
12049          return FALSE;
12050       }
12051    }
12052 
12053    if (aip == NULL) {
12054       return FALSE;
12055    }
12056 
12057    atp = AsnLinkType(orig, AECRPARSE_ACTION);   /* link local tree */
12058    if (atp == NULL) {
12059       return FALSE;
12060    }
12061 
12062    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
12063 
12064     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
12065 
12066    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
12067       goto erret;
12068    }
12069 
12070    if (ptr -> portion != NULL) {
12071       if ( ! TextPortionAsnWrite(ptr -> portion, aip, AECRPARSE_ACTION_portion)) {
12072          goto erret;
12073       }
12074    }
12075    if (ptr -> fields != NULL) {
12076       if ( ! FieldPairTypeAsnWrite(ptr -> fields, aip, AECRPARSE_ACTION_fields)) {
12077          goto erret;
12078       }
12079    }
12080    av.boolvalue = ptr -> remove_from_parsed;
12081    retval = AsnWrite(aip, AECRPARSE_ACTION_remove_from_parsed,  &av);
12082    av.boolvalue = ptr -> remove_left;
12083    retval = AsnWrite(aip, AECRPARSE_ACTION_remove_left,  &av);
12084    av.boolvalue = ptr -> remove_right;
12085    retval = AsnWrite(aip, AECRPARSE_ACTION_remove_right,  &av);
12086    if (ptr -> transform != NULL) {
12087       if ( ! TextTransformSetAsnWrite(ptr -> transform, aip, AECRPARSE_ACTION_transform)) {
12088          goto erret;
12089       }
12090    }
12091    av.intvalue = ptr -> existing_text;
12092    retval = AsnWrite(aip, AECRPARSE_ACTION_existing_text,  &av);
12093    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
12094       goto erret;
12095    }
12096    retval = TRUE;
12097 
12098 erret:
12099    AsnUnlinkType(orig);       /* unlink local tree */
12100    return retval;
12101 }
12102 
12103 
12104 
12105 /**************************************************
12106 *
12107 *    RemoveActionNew()
12108 *
12109 **************************************************/
12110 NLM_EXTERN
12111 RemoveActionPtr LIBCALL
RemoveActionNew(void)12112 RemoveActionNew(void)
12113 {
12114    RemoveActionPtr ptr = MemNew((size_t) sizeof(RemoveAction));
12115 
12116    return ptr;
12117 
12118 }
12119 
12120 
12121 /**************************************************
12122 *
12123 *    RemoveActionFree()
12124 *
12125 **************************************************/
12126 NLM_EXTERN
12127 RemoveActionPtr LIBCALL
RemoveActionFree(RemoveActionPtr ptr)12128 RemoveActionFree(RemoveActionPtr ptr)
12129 {
12130 
12131    if(ptr == NULL) {
12132       return NULL;
12133    }
12134    FieldTypeFree(ptr -> field);
12135    return MemFree(ptr);
12136 }
12137 
12138 
12139 /**************************************************
12140 *
12141 *    RemoveActionAsnRead()
12142 *
12143 **************************************************/
12144 NLM_EXTERN
12145 RemoveActionPtr LIBCALL
RemoveActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)12146 RemoveActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
12147 {
12148    DataVal av;
12149    AsnTypePtr atp;
12150    Boolean isError = FALSE;
12151    AsnReadFunc func;
12152    RemoveActionPtr ptr;
12153 
12154    if (! loaded)
12155    {
12156       if (! objmacroAsnLoad()) {
12157          return NULL;
12158       }
12159    }
12160 
12161    if (aip == NULL) {
12162       return NULL;
12163    }
12164 
12165    if (orig == NULL) {         /* RemoveAction ::= (self contained) */
12166       atp = AsnReadId(aip, amp, REMOVE_ACTION);
12167    } else {
12168       atp = AsnLinkType(orig, REMOVE_ACTION);
12169    }
12170    /* link in local tree */
12171    if (atp == NULL) {
12172       return NULL;
12173    }
12174 
12175    ptr = RemoveActionNew();
12176    if (ptr == NULL) {
12177       goto erret;
12178    }
12179    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
12180       goto erret;
12181    }
12182 
12183    atp = AsnReadId(aip,amp, atp);
12184    func = NULL;
12185 
12186    if (atp == REMOVE_ACTION_field) {
12187       ptr -> field = FieldTypeAsnRead(aip, atp);
12188       if (aip -> io_failure) {
12189          goto erret;
12190       }
12191       atp = AsnReadId(aip,amp, atp);
12192    }
12193 
12194    if (AsnReadVal(aip, atp, &av) <= 0) {
12195       goto erret;
12196    }
12197    /* end struct */
12198 
12199 ret:
12200    AsnUnlinkType(orig);       /* unlink local tree */
12201    return ptr;
12202 
12203 erret:
12204    aip -> io_failure = TRUE;
12205    ptr = RemoveActionFree(ptr);
12206    goto ret;
12207 }
12208 
12209 
12210 
12211 /**************************************************
12212 *
12213 *    RemoveActionAsnWrite()
12214 *
12215 **************************************************/
12216 NLM_EXTERN Boolean LIBCALL
RemoveActionAsnWrite(RemoveActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)12217 RemoveActionAsnWrite(RemoveActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
12218 {
12219    DataVal av;
12220    AsnTypePtr atp;
12221    Boolean retval = FALSE;
12222 
12223    if (! loaded)
12224    {
12225       if (! objmacroAsnLoad()) {
12226          return FALSE;
12227       }
12228    }
12229 
12230    if (aip == NULL) {
12231       return FALSE;
12232    }
12233 
12234    atp = AsnLinkType(orig, REMOVE_ACTION);   /* link local tree */
12235    if (atp == NULL) {
12236       return FALSE;
12237    }
12238 
12239    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
12240 
12241     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
12242 
12243    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
12244       goto erret;
12245    }
12246 
12247    if (ptr -> field != NULL) {
12248       if ( ! FieldTypeAsnWrite(ptr -> field, aip, REMOVE_ACTION_field)) {
12249          goto erret;
12250       }
12251    }
12252    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
12253       goto erret;
12254    }
12255    retval = TRUE;
12256 
12257 erret:
12258    AsnUnlinkType(orig);       /* unlink local tree */
12259    return retval;
12260 }
12261 
12262 
12263 
12264 /**************************************************
12265 *
12266 *    RemoveOutsideActionNew()
12267 *
12268 **************************************************/
12269 NLM_EXTERN
12270 RemoveOutsideActionPtr LIBCALL
RemoveOutsideActionNew(void)12271 RemoveOutsideActionNew(void)
12272 {
12273    RemoveOutsideActionPtr ptr = MemNew((size_t) sizeof(RemoveOutsideAction));
12274 
12275    ptr -> remove_if_not_found = 0;
12276    return ptr;
12277 
12278 }
12279 
12280 
12281 /**************************************************
12282 *
12283 *    RemoveOutsideActionFree()
12284 *
12285 **************************************************/
12286 NLM_EXTERN
12287 RemoveOutsideActionPtr LIBCALL
RemoveOutsideActionFree(RemoveOutsideActionPtr ptr)12288 RemoveOutsideActionFree(RemoveOutsideActionPtr ptr)
12289 {
12290 
12291    if(ptr == NULL) {
12292       return NULL;
12293    }
12294    TextPortionFree(ptr -> portion);
12295    FieldTypeFree(ptr -> field);
12296    return MemFree(ptr);
12297 }
12298 
12299 
12300 /**************************************************
12301 *
12302 *    RemoveOutsideActionAsnRead()
12303 *
12304 **************************************************/
12305 NLM_EXTERN
12306 RemoveOutsideActionPtr LIBCALL
RemoveOutsideActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)12307 RemoveOutsideActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
12308 {
12309    DataVal av;
12310    AsnTypePtr atp;
12311    Boolean isError = FALSE;
12312    AsnReadFunc func;
12313    RemoveOutsideActionPtr ptr;
12314 
12315    if (! loaded)
12316    {
12317       if (! objmacroAsnLoad()) {
12318          return NULL;
12319       }
12320    }
12321 
12322    if (aip == NULL) {
12323       return NULL;
12324    }
12325 
12326    if (orig == NULL) {         /* RemoveOutsideAction ::= (self contained) */
12327       atp = AsnReadId(aip, amp, REMOVE_OUTSIDE_ACTION);
12328    } else {
12329       atp = AsnLinkType(orig, REMOVE_OUTSIDE_ACTION);
12330    }
12331    /* link in local tree */
12332    if (atp == NULL) {
12333       return NULL;
12334    }
12335 
12336    ptr = RemoveOutsideActionNew();
12337    if (ptr == NULL) {
12338       goto erret;
12339    }
12340    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
12341       goto erret;
12342    }
12343 
12344    atp = AsnReadId(aip,amp, atp);
12345    func = NULL;
12346 
12347    if (atp == REMOVE_OUTSIDE_ACTION_portion) {
12348       ptr -> portion = TextPortionAsnRead(aip, atp);
12349       if (aip -> io_failure) {
12350          goto erret;
12351       }
12352       atp = AsnReadId(aip,amp, atp);
12353    }
12354    if (atp == REMOVE_OUTSIDE_ACTION_field) {
12355       ptr -> field = FieldTypeAsnRead(aip, atp);
12356       if (aip -> io_failure) {
12357          goto erret;
12358       }
12359       atp = AsnReadId(aip,amp, atp);
12360    }
12361    if (atp == REMOVE_OUTSIDE_ACTION_remove_if_not_found) {
12362       if ( AsnReadVal(aip, atp, &av) <= 0) {
12363          goto erret;
12364       }
12365       ptr -> remove_if_not_found = av.boolvalue;
12366       atp = AsnReadId(aip,amp, atp);
12367    }
12368 
12369    if (AsnReadVal(aip, atp, &av) <= 0) {
12370       goto erret;
12371    }
12372    /* end struct */
12373 
12374 ret:
12375    AsnUnlinkType(orig);       /* unlink local tree */
12376    return ptr;
12377 
12378 erret:
12379    aip -> io_failure = TRUE;
12380    ptr = RemoveOutsideActionFree(ptr);
12381    goto ret;
12382 }
12383 
12384 
12385 
12386 /**************************************************
12387 *
12388 *    RemoveOutsideActionAsnWrite()
12389 *
12390 **************************************************/
12391 NLM_EXTERN Boolean LIBCALL
RemoveOutsideActionAsnWrite(RemoveOutsideActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)12392 RemoveOutsideActionAsnWrite(RemoveOutsideActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
12393 {
12394    DataVal av;
12395    AsnTypePtr atp;
12396    Boolean retval = FALSE;
12397 
12398    if (! loaded)
12399    {
12400       if (! objmacroAsnLoad()) {
12401          return FALSE;
12402       }
12403    }
12404 
12405    if (aip == NULL) {
12406       return FALSE;
12407    }
12408 
12409    atp = AsnLinkType(orig, REMOVE_OUTSIDE_ACTION);   /* link local tree */
12410    if (atp == NULL) {
12411       return FALSE;
12412    }
12413 
12414    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
12415 
12416     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
12417 
12418    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
12419       goto erret;
12420    }
12421 
12422    if (ptr -> portion != NULL) {
12423       if ( ! TextPortionAsnWrite(ptr -> portion, aip, REMOVE_OUTSIDE_ACTION_portion)) {
12424          goto erret;
12425       }
12426    }
12427    if (ptr -> field != NULL) {
12428       if ( ! FieldTypeAsnWrite(ptr -> field, aip, REMOVE_OUTSIDE_ACTION_field)) {
12429          goto erret;
12430       }
12431    }
12432    av.boolvalue = ptr -> remove_if_not_found;
12433    retval = AsnWrite(aip, REMOVE_OUTSIDE_ACTION_remove_if_not_found,  &av);
12434    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
12435       goto erret;
12436    }
12437    retval = TRUE;
12438 
12439 erret:
12440    AsnUnlinkType(orig);       /* unlink local tree */
12441    return retval;
12442 }
12443 
12444 
12445 
12446 /**************************************************
12447 *
12448 *    ActionChoiceFree()
12449 *
12450 **************************************************/
12451 NLM_EXTERN
12452 ActionChoicePtr LIBCALL
ActionChoiceFree(ValNodePtr anp)12453 ActionChoiceFree(ValNodePtr anp)
12454 {
12455    Pointer pnt;
12456 
12457    if (anp == NULL) {
12458       return NULL;
12459    }
12460 
12461    pnt = anp->data.ptrvalue;
12462    switch (anp->choice)
12463    {
12464    default:
12465       break;
12466    case ActionChoice_apply:
12467       ApplyActionFree(anp -> data.ptrvalue);
12468       break;
12469    case ActionChoice_edit:
12470       EditActionFree(anp -> data.ptrvalue);
12471       break;
12472    case ActionChoice_convert:
12473       ConvertActionFree(anp -> data.ptrvalue);
12474       break;
12475    case ActionChoice_copy:
12476       CopyActionFree(anp -> data.ptrvalue);
12477       break;
12478    case ActionChoice_swap:
12479       SwapActionFree(anp -> data.ptrvalue);
12480       break;
12481    case ActionChoice_remove:
12482       RemoveActionFree(anp -> data.ptrvalue);
12483       break;
12484    case ActionChoice_parse:
12485       AECRParseActionFree(anp -> data.ptrvalue);
12486       break;
12487    case ActionChoice_remove_outside:
12488       RemoveOutsideActionFree(anp -> data.ptrvalue);
12489       break;
12490    }
12491    return MemFree(anp);
12492 }
12493 
12494 
12495 /**************************************************
12496 *
12497 *    ActionChoiceAsnRead()
12498 *
12499 **************************************************/
12500 NLM_EXTERN
12501 ActionChoicePtr LIBCALL
ActionChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)12502 ActionChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
12503 {
12504    DataVal av;
12505    AsnTypePtr atp;
12506    ValNodePtr anp;
12507    Uint1 choice;
12508    Boolean isError = FALSE;
12509    Boolean nullIsError = FALSE;
12510    AsnReadFunc func;
12511 
12512    if (! loaded)
12513    {
12514       if (! objmacroAsnLoad()) {
12515          return NULL;
12516       }
12517    }
12518 
12519    if (aip == NULL) {
12520       return NULL;
12521    }
12522 
12523    if (orig == NULL) {         /* ActionChoice ::= (self contained) */
12524       atp = AsnReadId(aip, amp, ACTION_CHOICE);
12525    } else {
12526       atp = AsnLinkType(orig, ACTION_CHOICE);    /* link in local tree */
12527    }
12528    if (atp == NULL) {
12529       return NULL;
12530    }
12531 
12532    anp = ValNodeNew(NULL);
12533    if (anp == NULL) {
12534       goto erret;
12535    }
12536    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
12537       goto erret;
12538    }
12539 
12540    func = NULL;
12541 
12542    atp = AsnReadId(aip, amp, atp);  /* find the choice */
12543    if (atp == NULL) {
12544       goto erret;
12545    }
12546    if (atp == ACTION_CHOICE_apply) {
12547       choice = ActionChoice_apply;
12548       func = (AsnReadFunc) ApplyActionAsnRead;
12549    }
12550    else if (atp == ACTION_CHOICE_edit) {
12551       choice = ActionChoice_edit;
12552       func = (AsnReadFunc) EditActionAsnRead;
12553    }
12554    else if (atp == ACTION_CHOICE_convert) {
12555       choice = ActionChoice_convert;
12556       func = (AsnReadFunc) ConvertActionAsnRead;
12557    }
12558    else if (atp == ACTION_CHOICE_copy) {
12559       choice = ActionChoice_copy;
12560       func = (AsnReadFunc) CopyActionAsnRead;
12561    }
12562    else if (atp == ACTION_CHOICE_swap) {
12563       choice = ActionChoice_swap;
12564       func = (AsnReadFunc) SwapActionAsnRead;
12565    }
12566    else if (atp == ACTION_CHOICE_remove) {
12567       choice = ActionChoice_remove;
12568       func = (AsnReadFunc) RemoveActionAsnRead;
12569    }
12570    else if (atp == ACTION_CHOICE_parse) {
12571       choice = ActionChoice_parse;
12572       func = (AsnReadFunc) AECRParseActionAsnRead;
12573    }
12574    else if (atp == ACTION_CHOICE_remove_outside) {
12575       choice = ActionChoice_remove_outside;
12576       func = (AsnReadFunc) RemoveOutsideActionAsnRead;
12577    }
12578    anp->choice = choice;
12579    if (func != NULL)
12580    {
12581       anp->data.ptrvalue = (* func)(aip, atp);
12582       if (aip -> io_failure) goto erret;
12583 
12584       if (nullIsError && anp->data.ptrvalue == NULL) {
12585          goto erret;
12586       }
12587    }
12588 
12589 ret:
12590    AsnUnlinkType(orig);       /* unlink local tree */
12591    return anp;
12592 
12593 erret:
12594    anp = MemFree(anp);
12595    aip -> io_failure = TRUE;
12596    goto ret;
12597 }
12598 
12599 
12600 /**************************************************
12601 *
12602 *    ActionChoiceAsnWrite()
12603 *
12604 **************************************************/
12605 NLM_EXTERN Boolean LIBCALL
ActionChoiceAsnWrite(ActionChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)12606 ActionChoiceAsnWrite(ActionChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
12607 
12608 {
12609    DataVal av;
12610    AsnTypePtr atp, writetype = NULL;
12611    Pointer pnt;
12612    AsnWriteFunc func = NULL;
12613    Boolean retval = FALSE;
12614 
12615    if (! loaded)
12616    {
12617       if (! objmacroAsnLoad())
12618       return FALSE;
12619    }
12620 
12621    if (aip == NULL)
12622    return FALSE;
12623 
12624    atp = AsnLinkType(orig, ACTION_CHOICE);   /* link local tree */
12625    if (atp == NULL) {
12626       return FALSE;
12627    }
12628 
12629    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
12630 
12631     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
12632 
12633    av.ptrvalue = (Pointer)anp;
12634    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
12635       goto erret;
12636    }
12637 
12638    pnt = anp->data.ptrvalue;
12639    switch (anp->choice)
12640    {
12641    case ActionChoice_apply:
12642       writetype = ACTION_CHOICE_apply;
12643       func = (AsnWriteFunc) ApplyActionAsnWrite;
12644       break;
12645    case ActionChoice_edit:
12646       writetype = ACTION_CHOICE_edit;
12647       func = (AsnWriteFunc) EditActionAsnWrite;
12648       break;
12649    case ActionChoice_convert:
12650       writetype = ACTION_CHOICE_convert;
12651       func = (AsnWriteFunc) ConvertActionAsnWrite;
12652       break;
12653    case ActionChoice_copy:
12654       writetype = ACTION_CHOICE_copy;
12655       func = (AsnWriteFunc) CopyActionAsnWrite;
12656       break;
12657    case ActionChoice_swap:
12658       writetype = ACTION_CHOICE_swap;
12659       func = (AsnWriteFunc) SwapActionAsnWrite;
12660       break;
12661    case ActionChoice_remove:
12662       writetype = ACTION_CHOICE_remove;
12663       func = (AsnWriteFunc) RemoveActionAsnWrite;
12664       break;
12665    case ActionChoice_parse:
12666       writetype = ACTION_CHOICE_parse;
12667       func = (AsnWriteFunc) AECRParseActionAsnWrite;
12668       break;
12669    case ActionChoice_remove_outside:
12670       writetype = ACTION_CHOICE_remove_outside;
12671       func = (AsnWriteFunc) RemoveOutsideActionAsnWrite;
12672       break;
12673    }
12674    if (writetype != NULL) {
12675       retval = (* func)(pnt, aip, writetype);   /* write it out */
12676    }
12677    if (!retval) {
12678       goto erret;
12679    }
12680    retval = TRUE;
12681 
12682 erret:
12683    AsnUnlinkType(orig);       /* unlink local tree */
12684    return retval;
12685 }
12686 
12687 
12688 /**************************************************
12689 *
12690 *    ParseSrcOrgChoiceFree()
12691 *
12692 **************************************************/
12693 NLM_EXTERN
12694 ParseSrcOrgChoicePtr LIBCALL
ParseSrcOrgChoiceFree(ValNodePtr anp)12695 ParseSrcOrgChoiceFree(ValNodePtr anp)
12696 {
12697    Pointer pnt;
12698 
12699    if (anp == NULL) {
12700       return NULL;
12701    }
12702 
12703    pnt = anp->data.ptrvalue;
12704    switch (anp->choice)
12705    {
12706    default:
12707       break;
12708    }
12709    return MemFree(anp);
12710 }
12711 
12712 
12713 /**************************************************
12714 *
12715 *    ParseSrcOrgChoiceAsnRead()
12716 *
12717 **************************************************/
12718 NLM_EXTERN
12719 ParseSrcOrgChoicePtr LIBCALL
ParseSrcOrgChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)12720 ParseSrcOrgChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
12721 {
12722    DataVal av;
12723    AsnTypePtr atp;
12724    ValNodePtr anp;
12725    Uint1 choice;
12726    Boolean isError = FALSE;
12727    Boolean nullIsError = FALSE;
12728    AsnReadFunc func;
12729 
12730    if (! loaded)
12731    {
12732       if (! objmacroAsnLoad()) {
12733          return NULL;
12734       }
12735    }
12736 
12737    if (aip == NULL) {
12738       return NULL;
12739    }
12740 
12741    if (orig == NULL) {         /* ParseSrcOrgChoice ::= (self contained) */
12742       atp = AsnReadId(aip, amp, PARSE_SRC_ORG_CHOICE);
12743    } else {
12744       atp = AsnLinkType(orig, PARSE_SRC_ORG_CHOICE);    /* link in local tree */
12745    }
12746    if (atp == NULL) {
12747       return NULL;
12748    }
12749 
12750    anp = ValNodeNew(NULL);
12751    if (anp == NULL) {
12752       goto erret;
12753    }
12754    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
12755       goto erret;
12756    }
12757 
12758    func = NULL;
12759 
12760    atp = AsnReadId(aip, amp, atp);  /* find the choice */
12761    if (atp == NULL) {
12762       goto erret;
12763    }
12764    if (atp == PARSE_SRC_ORG_CHOICE_source_qual) {
12765       choice = ParseSrcOrgChoice_source_qual;
12766       if (AsnReadVal(aip, atp, &av) <= 0) {
12767          goto erret;
12768       }
12769       anp->data.intvalue = av.intvalue;
12770    }
12771    else if (atp == PARSE_SRC_ORG_CHOICE_taxname_after_binomial) {
12772       choice = ParseSrcOrgChoice_taxname_after_binomial;
12773       if (AsnReadVal(aip, atp, &av) <= 0) {
12774          goto erret;
12775       }
12776       anp->data.boolvalue = av.boolvalue;
12777    }
12778    anp->choice = choice;
12779    if (func != NULL)
12780    {
12781       anp->data.ptrvalue = (* func)(aip, atp);
12782       if (aip -> io_failure) goto erret;
12783 
12784       if (nullIsError && anp->data.ptrvalue == NULL) {
12785          goto erret;
12786       }
12787    }
12788 
12789 ret:
12790    AsnUnlinkType(orig);       /* unlink local tree */
12791    return anp;
12792 
12793 erret:
12794    anp = MemFree(anp);
12795    aip -> io_failure = TRUE;
12796    goto ret;
12797 }
12798 
12799 
12800 /**************************************************
12801 *
12802 *    ParseSrcOrgChoiceAsnWrite()
12803 *
12804 **************************************************/
12805 NLM_EXTERN Boolean LIBCALL
ParseSrcOrgChoiceAsnWrite(ParseSrcOrgChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)12806 ParseSrcOrgChoiceAsnWrite(ParseSrcOrgChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
12807 
12808 {
12809    DataVal av;
12810    AsnTypePtr atp, writetype = NULL;
12811    Pointer pnt;
12812    AsnWriteFunc func = NULL;
12813    Boolean retval = FALSE;
12814 
12815    if (! loaded)
12816    {
12817       if (! objmacroAsnLoad())
12818       return FALSE;
12819    }
12820 
12821    if (aip == NULL)
12822    return FALSE;
12823 
12824    atp = AsnLinkType(orig, PARSE_SRC_ORG_CHOICE);   /* link local tree */
12825    if (atp == NULL) {
12826       return FALSE;
12827    }
12828 
12829    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
12830 
12831     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
12832 
12833    av.ptrvalue = (Pointer)anp;
12834    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
12835       goto erret;
12836    }
12837 
12838    pnt = anp->data.ptrvalue;
12839    switch (anp->choice)
12840    {
12841    case ParseSrcOrgChoice_source_qual:
12842       av.intvalue = anp->data.intvalue;
12843       retval = AsnWrite(aip, PARSE_SRC_ORG_CHOICE_source_qual, &av);
12844       break;
12845    case ParseSrcOrgChoice_taxname_after_binomial:
12846       av.boolvalue = anp->data.boolvalue;
12847       retval = AsnWrite(aip, PARSE_SRC_ORG_CHOICE_taxname_after_binomial, &av);
12848       break;
12849    }
12850    if (writetype != NULL) {
12851       retval = (* func)(pnt, aip, writetype);   /* write it out */
12852    }
12853    if (!retval) {
12854       goto erret;
12855    }
12856    retval = TRUE;
12857 
12858 erret:
12859    AsnUnlinkType(orig);       /* unlink local tree */
12860    return retval;
12861 }
12862 
12863 
12864 /**************************************************
12865 *
12866 *    ParseSrcOrgNew()
12867 *
12868 **************************************************/
12869 NLM_EXTERN
12870 ParseSrcOrgPtr LIBCALL
ParseSrcOrgNew(void)12871 ParseSrcOrgNew(void)
12872 {
12873    ParseSrcOrgPtr ptr = MemNew((size_t) sizeof(ParseSrcOrg));
12874 
12875    ptr -> type = 0;
12876    return ptr;
12877 
12878 }
12879 
12880 
12881 /**************************************************
12882 *
12883 *    ParseSrcOrgFree()
12884 *
12885 **************************************************/
12886 NLM_EXTERN
12887 ParseSrcOrgPtr LIBCALL
ParseSrcOrgFree(ParseSrcOrgPtr ptr)12888 ParseSrcOrgFree(ParseSrcOrgPtr ptr)
12889 {
12890 
12891    if(ptr == NULL) {
12892       return NULL;
12893    }
12894    ParseSrcOrgChoiceFree(ptr -> field);
12895    return MemFree(ptr);
12896 }
12897 
12898 
12899 /**************************************************
12900 *
12901 *    ParseSrcOrgAsnRead()
12902 *
12903 **************************************************/
12904 NLM_EXTERN
12905 ParseSrcOrgPtr LIBCALL
ParseSrcOrgAsnRead(AsnIoPtr aip,AsnTypePtr orig)12906 ParseSrcOrgAsnRead(AsnIoPtr aip, AsnTypePtr orig)
12907 {
12908    DataVal av;
12909    AsnTypePtr atp;
12910    Boolean isError = FALSE;
12911    AsnReadFunc func;
12912    ParseSrcOrgPtr ptr;
12913 
12914    if (! loaded)
12915    {
12916       if (! objmacroAsnLoad()) {
12917          return NULL;
12918       }
12919    }
12920 
12921    if (aip == NULL) {
12922       return NULL;
12923    }
12924 
12925    if (orig == NULL) {         /* ParseSrcOrg ::= (self contained) */
12926       atp = AsnReadId(aip, amp, PARSE_SRC_ORG);
12927    } else {
12928       atp = AsnLinkType(orig, PARSE_SRC_ORG);
12929    }
12930    /* link in local tree */
12931    if (atp == NULL) {
12932       return NULL;
12933    }
12934 
12935    ptr = ParseSrcOrgNew();
12936    if (ptr == NULL) {
12937       goto erret;
12938    }
12939    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
12940       goto erret;
12941    }
12942 
12943    atp = AsnReadId(aip,amp, atp);
12944    func = NULL;
12945 
12946    if (atp == PARSE_SRC_ORG_field) {
12947       ptr -> field = ParseSrcOrgChoiceAsnRead(aip, atp);
12948       if (aip -> io_failure) {
12949          goto erret;
12950       }
12951       atp = AsnReadId(aip,amp, atp);
12952    }
12953    if (atp == PARSE_SRC_ORG_type) {
12954       if ( AsnReadVal(aip, atp, &av) <= 0) {
12955          goto erret;
12956       }
12957       ptr -> type = av.intvalue;
12958       atp = AsnReadId(aip,amp, atp);
12959    }
12960 
12961    if (AsnReadVal(aip, atp, &av) <= 0) {
12962       goto erret;
12963    }
12964    /* end struct */
12965 
12966 ret:
12967    AsnUnlinkType(orig);       /* unlink local tree */
12968    return ptr;
12969 
12970 erret:
12971    aip -> io_failure = TRUE;
12972    ptr = ParseSrcOrgFree(ptr);
12973    goto ret;
12974 }
12975 
12976 
12977 
12978 /**************************************************
12979 *
12980 *    ParseSrcOrgAsnWrite()
12981 *
12982 **************************************************/
12983 NLM_EXTERN Boolean LIBCALL
ParseSrcOrgAsnWrite(ParseSrcOrgPtr ptr,AsnIoPtr aip,AsnTypePtr orig)12984 ParseSrcOrgAsnWrite(ParseSrcOrgPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
12985 {
12986    DataVal av;
12987    AsnTypePtr atp;
12988    Boolean retval = FALSE;
12989 
12990    if (! loaded)
12991    {
12992       if (! objmacroAsnLoad()) {
12993          return FALSE;
12994       }
12995    }
12996 
12997    if (aip == NULL) {
12998       return FALSE;
12999    }
13000 
13001    atp = AsnLinkType(orig, PARSE_SRC_ORG);   /* link local tree */
13002    if (atp == NULL) {
13003       return FALSE;
13004    }
13005 
13006    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
13007 
13008     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
13009 
13010    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
13011       goto erret;
13012    }
13013 
13014    if (ptr -> field != NULL) {
13015       if ( ! ParseSrcOrgChoiceAsnWrite(ptr -> field, aip, PARSE_SRC_ORG_field)) {
13016          goto erret;
13017       }
13018    }
13019    av.intvalue = ptr -> type;
13020    retval = AsnWrite(aip, PARSE_SRC_ORG_type,  &av);
13021    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
13022       goto erret;
13023    }
13024    retval = TRUE;
13025 
13026 erret:
13027    AsnUnlinkType(orig);       /* unlink local tree */
13028    return retval;
13029 }
13030 
13031 
13032 
13033 /**************************************************
13034 *
13035 *    ParseSrcGeneralIdFree()
13036 *
13037 **************************************************/
13038 NLM_EXTERN
13039 ParseSrcGeneralIdPtr LIBCALL
ParseSrcGeneralIdFree(ValNodePtr anp)13040 ParseSrcGeneralIdFree(ValNodePtr anp)
13041 {
13042    Pointer pnt;
13043 
13044    if (anp == NULL) {
13045       return NULL;
13046    }
13047 
13048    pnt = anp->data.ptrvalue;
13049    switch (anp->choice)
13050    {
13051    default:
13052       break;
13053    case ParseSrcGeneralId_tag:
13054       MemFree(anp -> data.ptrvalue);
13055       break;
13056    }
13057    return MemFree(anp);
13058 }
13059 
13060 
13061 /**************************************************
13062 *
13063 *    ParseSrcGeneralIdAsnRead()
13064 *
13065 **************************************************/
13066 NLM_EXTERN
13067 ParseSrcGeneralIdPtr LIBCALL
ParseSrcGeneralIdAsnRead(AsnIoPtr aip,AsnTypePtr orig)13068 ParseSrcGeneralIdAsnRead(AsnIoPtr aip, AsnTypePtr orig)
13069 {
13070    DataVal av;
13071    AsnTypePtr atp;
13072    ValNodePtr anp;
13073    Uint1 choice;
13074    Boolean isError = FALSE;
13075    Boolean nullIsError = FALSE;
13076    AsnReadFunc func;
13077 
13078    if (! loaded)
13079    {
13080       if (! objmacroAsnLoad()) {
13081          return NULL;
13082       }
13083    }
13084 
13085    if (aip == NULL) {
13086       return NULL;
13087    }
13088 
13089    if (orig == NULL) {         /* ParseSrcGeneralId ::= (self contained) */
13090       atp = AsnReadId(aip, amp, PARSE_SRC_GENERAL_ID);
13091    } else {
13092       atp = AsnLinkType(orig, PARSE_SRC_GENERAL_ID);    /* link in local tree */
13093    }
13094    if (atp == NULL) {
13095       return NULL;
13096    }
13097 
13098    anp = ValNodeNew(NULL);
13099    if (anp == NULL) {
13100       goto erret;
13101    }
13102    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
13103       goto erret;
13104    }
13105 
13106    func = NULL;
13107 
13108    atp = AsnReadId(aip, amp, atp);  /* find the choice */
13109    if (atp == NULL) {
13110       goto erret;
13111    }
13112    if (atp == PARSE_SRC_GENERAL_ID_whole_text) {
13113       choice = ParseSrcGeneralId_whole_text;
13114       if (AsnReadVal(aip, atp, &av) <= 0) {
13115          goto erret;
13116       }
13117       anp->data.boolvalue = av.boolvalue;
13118    }
13119    else if (atp == PARSE_SRC_GENERAL_ID_db) {
13120       choice = ParseSrcGeneralId_db;
13121       if (AsnReadVal(aip, atp, &av) <= 0) {
13122          goto erret;
13123       }
13124       anp->data.boolvalue = av.boolvalue;
13125    }
13126    else if (atp == PARSE_SRC_GENERAL_ID_tag) {
13127       choice = ParseSrcGeneralId_tag;
13128       if (AsnReadVal(aip, atp, &av) <= 0) {
13129          goto erret;
13130       }
13131       anp->data.ptrvalue = av.ptrvalue;
13132    }
13133    anp->choice = choice;
13134    if (func != NULL)
13135    {
13136       anp->data.ptrvalue = (* func)(aip, atp);
13137       if (aip -> io_failure) goto erret;
13138 
13139       if (nullIsError && anp->data.ptrvalue == NULL) {
13140          goto erret;
13141       }
13142    }
13143 
13144 ret:
13145    AsnUnlinkType(orig);       /* unlink local tree */
13146    return anp;
13147 
13148 erret:
13149    anp = MemFree(anp);
13150    aip -> io_failure = TRUE;
13151    goto ret;
13152 }
13153 
13154 
13155 /**************************************************
13156 *
13157 *    ParseSrcGeneralIdAsnWrite()
13158 *
13159 **************************************************/
13160 NLM_EXTERN Boolean LIBCALL
ParseSrcGeneralIdAsnWrite(ParseSrcGeneralIdPtr anp,AsnIoPtr aip,AsnTypePtr orig)13161 ParseSrcGeneralIdAsnWrite(ParseSrcGeneralIdPtr anp, AsnIoPtr aip, AsnTypePtr orig)
13162 
13163 {
13164    DataVal av;
13165    AsnTypePtr atp, writetype = NULL;
13166    Pointer pnt;
13167    AsnWriteFunc func = NULL;
13168    Boolean retval = FALSE;
13169 
13170    if (! loaded)
13171    {
13172       if (! objmacroAsnLoad())
13173       return FALSE;
13174    }
13175 
13176    if (aip == NULL)
13177    return FALSE;
13178 
13179    atp = AsnLinkType(orig, PARSE_SRC_GENERAL_ID);   /* link local tree */
13180    if (atp == NULL) {
13181       return FALSE;
13182    }
13183 
13184    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
13185 
13186     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
13187 
13188    av.ptrvalue = (Pointer)anp;
13189    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
13190       goto erret;
13191    }
13192 
13193    pnt = anp->data.ptrvalue;
13194    switch (anp->choice)
13195    {
13196    case ParseSrcGeneralId_whole_text:
13197       av.boolvalue = anp->data.boolvalue;
13198       retval = AsnWrite(aip, PARSE_SRC_GENERAL_ID_whole_text, &av);
13199       break;
13200    case ParseSrcGeneralId_db:
13201       av.boolvalue = anp->data.boolvalue;
13202       retval = AsnWrite(aip, PARSE_SRC_GENERAL_ID_db, &av);
13203       break;
13204    case ParseSrcGeneralId_tag:
13205       av.ptrvalue = anp->data.ptrvalue;
13206       retval = AsnWrite(aip, PARSE_SRC_GENERAL_ID_tag, &av);
13207       break;
13208    }
13209    if (writetype != NULL) {
13210       retval = (* func)(pnt, aip, writetype);   /* write it out */
13211    }
13212    if (!retval) {
13213       goto erret;
13214    }
13215    retval = TRUE;
13216 
13217 erret:
13218    AsnUnlinkType(orig);       /* unlink local tree */
13219    return retval;
13220 }
13221 
13222 
13223 /**************************************************
13224 *
13225 *    ParseSrcFree()
13226 *
13227 **************************************************/
13228 NLM_EXTERN
13229 ParseSrcPtr LIBCALL
ParseSrcFree(ValNodePtr anp)13230 ParseSrcFree(ValNodePtr anp)
13231 {
13232    Pointer pnt;
13233 
13234    if (anp == NULL) {
13235       return NULL;
13236    }
13237 
13238    pnt = anp->data.ptrvalue;
13239    switch (anp->choice)
13240    {
13241    default:
13242       break;
13243    case ParseSrc_org:
13244       ParseSrcOrgFree(anp -> data.ptrvalue);
13245       break;
13246    case ParseSrc_structured_comment:
13247       MemFree(anp -> data.ptrvalue);
13248       break;
13249    case ParseSrc_general_id:
13250       ParseSrcGeneralIdFree(anp -> data.ptrvalue);
13251       break;
13252    }
13253    return MemFree(anp);
13254 }
13255 
13256 
13257 /**************************************************
13258 *
13259 *    ParseSrcAsnRead()
13260 *
13261 **************************************************/
13262 NLM_EXTERN
13263 ParseSrcPtr LIBCALL
ParseSrcAsnRead(AsnIoPtr aip,AsnTypePtr orig)13264 ParseSrcAsnRead(AsnIoPtr aip, AsnTypePtr orig)
13265 {
13266    DataVal av;
13267    AsnTypePtr atp;
13268    ValNodePtr anp;
13269    Uint1 choice;
13270    Boolean isError = FALSE;
13271    Boolean nullIsError = FALSE;
13272    AsnReadFunc func;
13273 
13274    if (! loaded)
13275    {
13276       if (! objmacroAsnLoad()) {
13277          return NULL;
13278       }
13279    }
13280 
13281    if (aip == NULL) {
13282       return NULL;
13283    }
13284 
13285    if (orig == NULL) {         /* ParseSrc ::= (self contained) */
13286       atp = AsnReadId(aip, amp, PARSE_SRC);
13287    } else {
13288       atp = AsnLinkType(orig, PARSE_SRC);    /* link in local tree */
13289    }
13290    if (atp == NULL) {
13291       return NULL;
13292    }
13293 
13294    anp = ValNodeNew(NULL);
13295    if (anp == NULL) {
13296       goto erret;
13297    }
13298    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
13299       goto erret;
13300    }
13301 
13302    func = NULL;
13303 
13304    atp = AsnReadId(aip, amp, atp);  /* find the choice */
13305    if (atp == NULL) {
13306       goto erret;
13307    }
13308    if (atp == PARSE_SRC_defline) {
13309       choice = ParseSrc_defline;
13310       if (AsnReadVal(aip, atp, &av) <= 0) {
13311          goto erret;
13312       }
13313       anp->data.boolvalue = av.boolvalue;
13314    }
13315    else if (atp == PARSE_SRC_flatfile) {
13316       choice = ParseSrc_flatfile;
13317       if (AsnReadVal(aip, atp, &av) <= 0) {
13318          goto erret;
13319       }
13320       anp->data.boolvalue = av.boolvalue;
13321    }
13322    else if (atp == PARSE_SRC_local_id) {
13323       choice = ParseSrc_local_id;
13324       if (AsnReadVal(aip, atp, &av) <= 0) {
13325          goto erret;
13326       }
13327       anp->data.boolvalue = av.boolvalue;
13328    }
13329    else if (atp == PARSE_SRC_org) {
13330       choice = ParseSrc_org;
13331       func = (AsnReadFunc) ParseSrcOrgAsnRead;
13332    }
13333    else if (atp == PARSE_SRC_comment) {
13334       choice = ParseSrc_comment;
13335       if (AsnReadVal(aip, atp, &av) <= 0) {
13336          goto erret;
13337       }
13338       anp->data.boolvalue = av.boolvalue;
13339    }
13340    else if (atp == PARSE_SRC_bankit_comment) {
13341       choice = ParseSrc_bankit_comment;
13342       if (AsnReadVal(aip, atp, &av) <= 0) {
13343          goto erret;
13344       }
13345       anp->data.boolvalue = av.boolvalue;
13346    }
13347    else if (atp == PARSE_SRC_structured_comment) {
13348       choice = ParseSrc_structured_comment;
13349       if (AsnReadVal(aip, atp, &av) <= 0) {
13350          goto erret;
13351       }
13352       anp->data.ptrvalue = av.ptrvalue;
13353    }
13354    else if (atp == PARSE_SRC_file_id) {
13355       choice = ParseSrc_file_id;
13356       if (AsnReadVal(aip, atp, &av) <= 0) {
13357          goto erret;
13358       }
13359       anp->data.boolvalue = av.boolvalue;
13360    }
13361    else if (atp == PARSE_SRC_general_id) {
13362       choice = ParseSrc_general_id;
13363       func = (AsnReadFunc) ParseSrcGeneralIdAsnRead;
13364    }
13365    anp->choice = choice;
13366    if (func != NULL)
13367    {
13368       anp->data.ptrvalue = (* func)(aip, atp);
13369       if (aip -> io_failure) goto erret;
13370 
13371       if (nullIsError && anp->data.ptrvalue == NULL) {
13372          goto erret;
13373       }
13374    }
13375 
13376 ret:
13377    AsnUnlinkType(orig);       /* unlink local tree */
13378    return anp;
13379 
13380 erret:
13381    anp = MemFree(anp);
13382    aip -> io_failure = TRUE;
13383    goto ret;
13384 }
13385 
13386 
13387 /**************************************************
13388 *
13389 *    ParseSrcAsnWrite()
13390 *
13391 **************************************************/
13392 NLM_EXTERN Boolean LIBCALL
ParseSrcAsnWrite(ParseSrcPtr anp,AsnIoPtr aip,AsnTypePtr orig)13393 ParseSrcAsnWrite(ParseSrcPtr anp, AsnIoPtr aip, AsnTypePtr orig)
13394 
13395 {
13396    DataVal av;
13397    AsnTypePtr atp, writetype = NULL;
13398    Pointer pnt;
13399    AsnWriteFunc func = NULL;
13400    Boolean retval = FALSE;
13401 
13402    if (! loaded)
13403    {
13404       if (! objmacroAsnLoad())
13405       return FALSE;
13406    }
13407 
13408    if (aip == NULL)
13409    return FALSE;
13410 
13411    atp = AsnLinkType(orig, PARSE_SRC);   /* link local tree */
13412    if (atp == NULL) {
13413       return FALSE;
13414    }
13415 
13416    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
13417 
13418     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
13419 
13420    av.ptrvalue = (Pointer)anp;
13421    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
13422       goto erret;
13423    }
13424 
13425    pnt = anp->data.ptrvalue;
13426    switch (anp->choice)
13427    {
13428    case ParseSrc_defline:
13429       av.boolvalue = anp->data.boolvalue;
13430       retval = AsnWrite(aip, PARSE_SRC_defline, &av);
13431       break;
13432    case ParseSrc_flatfile:
13433       av.boolvalue = anp->data.boolvalue;
13434       retval = AsnWrite(aip, PARSE_SRC_flatfile, &av);
13435       break;
13436    case ParseSrc_local_id:
13437       av.boolvalue = anp->data.boolvalue;
13438       retval = AsnWrite(aip, PARSE_SRC_local_id, &av);
13439       break;
13440    case ParseSrc_org:
13441       writetype = PARSE_SRC_org;
13442       func = (AsnWriteFunc) ParseSrcOrgAsnWrite;
13443       break;
13444    case ParseSrc_comment:
13445       av.boolvalue = anp->data.boolvalue;
13446       retval = AsnWrite(aip, PARSE_SRC_comment, &av);
13447       break;
13448    case ParseSrc_bankit_comment:
13449       av.boolvalue = anp->data.boolvalue;
13450       retval = AsnWrite(aip, PARSE_SRC_bankit_comment, &av);
13451       break;
13452    case ParseSrc_structured_comment:
13453       av.ptrvalue = anp->data.ptrvalue;
13454       retval = AsnWrite(aip, PARSE_SRC_structured_comment, &av);
13455       break;
13456    case ParseSrc_file_id:
13457       av.boolvalue = anp->data.boolvalue;
13458       retval = AsnWrite(aip, PARSE_SRC_file_id, &av);
13459       break;
13460    case ParseSrc_general_id:
13461       writetype = PARSE_SRC_general_id;
13462       func = (AsnWriteFunc) ParseSrcGeneralIdAsnWrite;
13463       break;
13464    }
13465    if (writetype != NULL) {
13466       retval = (* func)(pnt, aip, writetype);   /* write it out */
13467    }
13468    if (!retval) {
13469       goto erret;
13470    }
13471    retval = TRUE;
13472 
13473 erret:
13474    AsnUnlinkType(orig);       /* unlink local tree */
13475    return retval;
13476 }
13477 
13478 
13479 /**************************************************
13480 *
13481 *    ParseDstOrgNew()
13482 *
13483 **************************************************/
13484 NLM_EXTERN
13485 ParseDstOrgPtr LIBCALL
ParseDstOrgNew(void)13486 ParseDstOrgNew(void)
13487 {
13488    ParseDstOrgPtr ptr = MemNew((size_t) sizeof(ParseDstOrg));
13489 
13490    ptr -> type = 0;
13491    return ptr;
13492 
13493 }
13494 
13495 
13496 /**************************************************
13497 *
13498 *    ParseDstOrgFree()
13499 *
13500 **************************************************/
13501 NLM_EXTERN
13502 ParseDstOrgPtr LIBCALL
ParseDstOrgFree(ParseDstOrgPtr ptr)13503 ParseDstOrgFree(ParseDstOrgPtr ptr)
13504 {
13505 
13506    if(ptr == NULL) {
13507       return NULL;
13508    }
13509    SourceQualChoiceFree(ptr -> field);
13510    return MemFree(ptr);
13511 }
13512 
13513 
13514 /**************************************************
13515 *
13516 *    ParseDstOrgAsnRead()
13517 *
13518 **************************************************/
13519 NLM_EXTERN
13520 ParseDstOrgPtr LIBCALL
ParseDstOrgAsnRead(AsnIoPtr aip,AsnTypePtr orig)13521 ParseDstOrgAsnRead(AsnIoPtr aip, AsnTypePtr orig)
13522 {
13523    DataVal av;
13524    AsnTypePtr atp;
13525    Boolean isError = FALSE;
13526    AsnReadFunc func;
13527    ParseDstOrgPtr ptr;
13528 
13529    if (! loaded)
13530    {
13531       if (! objmacroAsnLoad()) {
13532          return NULL;
13533       }
13534    }
13535 
13536    if (aip == NULL) {
13537       return NULL;
13538    }
13539 
13540    if (orig == NULL) {         /* ParseDstOrg ::= (self contained) */
13541       atp = AsnReadId(aip, amp, PARSE_DST_ORG);
13542    } else {
13543       atp = AsnLinkType(orig, PARSE_DST_ORG);
13544    }
13545    /* link in local tree */
13546    if (atp == NULL) {
13547       return NULL;
13548    }
13549 
13550    ptr = ParseDstOrgNew();
13551    if (ptr == NULL) {
13552       goto erret;
13553    }
13554    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
13555       goto erret;
13556    }
13557 
13558    atp = AsnReadId(aip,amp, atp);
13559    func = NULL;
13560 
13561    if (atp == PARSE_DST_ORG_field) {
13562       ptr -> field = SourceQualChoiceAsnRead(aip, atp);
13563       if (aip -> io_failure) {
13564          goto erret;
13565       }
13566       atp = AsnReadId(aip,amp, atp);
13567    }
13568    if (atp == PARSE_DST_ORG_type) {
13569       if ( AsnReadVal(aip, atp, &av) <= 0) {
13570          goto erret;
13571       }
13572       ptr -> type = av.intvalue;
13573       atp = AsnReadId(aip,amp, atp);
13574    }
13575 
13576    if (AsnReadVal(aip, atp, &av) <= 0) {
13577       goto erret;
13578    }
13579    /* end struct */
13580 
13581 ret:
13582    AsnUnlinkType(orig);       /* unlink local tree */
13583    return ptr;
13584 
13585 erret:
13586    aip -> io_failure = TRUE;
13587    ptr = ParseDstOrgFree(ptr);
13588    goto ret;
13589 }
13590 
13591 
13592 
13593 /**************************************************
13594 *
13595 *    ParseDstOrgAsnWrite()
13596 *
13597 **************************************************/
13598 NLM_EXTERN Boolean LIBCALL
ParseDstOrgAsnWrite(ParseDstOrgPtr ptr,AsnIoPtr aip,AsnTypePtr orig)13599 ParseDstOrgAsnWrite(ParseDstOrgPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
13600 {
13601    DataVal av;
13602    AsnTypePtr atp;
13603    Boolean retval = FALSE;
13604 
13605    if (! loaded)
13606    {
13607       if (! objmacroAsnLoad()) {
13608          return FALSE;
13609       }
13610    }
13611 
13612    if (aip == NULL) {
13613       return FALSE;
13614    }
13615 
13616    atp = AsnLinkType(orig, PARSE_DST_ORG);   /* link local tree */
13617    if (atp == NULL) {
13618       return FALSE;
13619    }
13620 
13621    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
13622 
13623     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
13624 
13625    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
13626       goto erret;
13627    }
13628 
13629    if (ptr -> field != NULL) {
13630       if ( ! SourceQualChoiceAsnWrite(ptr -> field, aip, PARSE_DST_ORG_field)) {
13631          goto erret;
13632       }
13633    }
13634    av.intvalue = ptr -> type;
13635    retval = AsnWrite(aip, PARSE_DST_ORG_type,  &av);
13636    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
13637       goto erret;
13638    }
13639    retval = TRUE;
13640 
13641 erret:
13642    AsnUnlinkType(orig);       /* unlink local tree */
13643    return retval;
13644 }
13645 
13646 
13647 
13648 /**************************************************
13649 *
13650 *    ParseDestFree()
13651 *
13652 **************************************************/
13653 NLM_EXTERN
13654 ParseDestPtr LIBCALL
ParseDestFree(ValNodePtr anp)13655 ParseDestFree(ValNodePtr anp)
13656 {
13657    Pointer pnt;
13658 
13659    if (anp == NULL) {
13660       return NULL;
13661    }
13662 
13663    pnt = anp->data.ptrvalue;
13664    switch (anp->choice)
13665    {
13666    default:
13667       break;
13668    case ParseDest_org:
13669       ParseDstOrgFree(anp -> data.ptrvalue);
13670       break;
13671    case ParseDest_featqual:
13672       FeatureFieldLegalFree(anp -> data.ptrvalue);
13673       break;
13674    case ParseDest_dbxref:
13675       MemFree(anp -> data.ptrvalue);
13676       break;
13677    }
13678    return MemFree(anp);
13679 }
13680 
13681 
13682 /**************************************************
13683 *
13684 *    ParseDestAsnRead()
13685 *
13686 **************************************************/
13687 NLM_EXTERN
13688 ParseDestPtr LIBCALL
ParseDestAsnRead(AsnIoPtr aip,AsnTypePtr orig)13689 ParseDestAsnRead(AsnIoPtr aip, AsnTypePtr orig)
13690 {
13691    DataVal av;
13692    AsnTypePtr atp;
13693    ValNodePtr anp;
13694    Uint1 choice;
13695    Boolean isError = FALSE;
13696    Boolean nullIsError = FALSE;
13697    AsnReadFunc func;
13698 
13699    if (! loaded)
13700    {
13701       if (! objmacroAsnLoad()) {
13702          return NULL;
13703       }
13704    }
13705 
13706    if (aip == NULL) {
13707       return NULL;
13708    }
13709 
13710    if (orig == NULL) {         /* ParseDest ::= (self contained) */
13711       atp = AsnReadId(aip, amp, PARSE_DEST);
13712    } else {
13713       atp = AsnLinkType(orig, PARSE_DEST);    /* link in local tree */
13714    }
13715    if (atp == NULL) {
13716       return NULL;
13717    }
13718 
13719    anp = ValNodeNew(NULL);
13720    if (anp == NULL) {
13721       goto erret;
13722    }
13723    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
13724       goto erret;
13725    }
13726 
13727    func = NULL;
13728 
13729    atp = AsnReadId(aip, amp, atp);  /* find the choice */
13730    if (atp == NULL) {
13731       goto erret;
13732    }
13733    if (atp == PARSE_DEST_defline) {
13734       choice = ParseDest_defline;
13735       if (AsnReadVal(aip, atp, &av) <= 0) {
13736          goto erret;
13737       }
13738       anp->data.boolvalue = av.boolvalue;
13739    }
13740    else if (atp == PARSE_DEST_org) {
13741       choice = ParseDest_org;
13742       func = (AsnReadFunc) ParseDstOrgAsnRead;
13743    }
13744    else if (atp == PARSE_DEST_featqual) {
13745       choice = ParseDest_featqual;
13746       func = (AsnReadFunc) FeatureFieldLegalAsnRead;
13747    }
13748    else if (atp == PARSE_DEST_comment_descriptor) {
13749       choice = ParseDest_comment_descriptor;
13750       if (AsnReadVal(aip, atp, &av) <= 0) {
13751          goto erret;
13752       }
13753       anp->data.boolvalue = av.boolvalue;
13754    }
13755    else if (atp == PARSE_DEST_dbxref) {
13756       choice = ParseDest_dbxref;
13757       if (AsnReadVal(aip, atp, &av) <= 0) {
13758          goto erret;
13759       }
13760       anp->data.ptrvalue = av.ptrvalue;
13761    }
13762    anp->choice = choice;
13763    if (func != NULL)
13764    {
13765       anp->data.ptrvalue = (* func)(aip, atp);
13766       if (aip -> io_failure) goto erret;
13767 
13768       if (nullIsError && anp->data.ptrvalue == NULL) {
13769          goto erret;
13770       }
13771    }
13772 
13773 ret:
13774    AsnUnlinkType(orig);       /* unlink local tree */
13775    return anp;
13776 
13777 erret:
13778    anp = MemFree(anp);
13779    aip -> io_failure = TRUE;
13780    goto ret;
13781 }
13782 
13783 
13784 /**************************************************
13785 *
13786 *    ParseDestAsnWrite()
13787 *
13788 **************************************************/
13789 NLM_EXTERN Boolean LIBCALL
ParseDestAsnWrite(ParseDestPtr anp,AsnIoPtr aip,AsnTypePtr orig)13790 ParseDestAsnWrite(ParseDestPtr anp, AsnIoPtr aip, AsnTypePtr orig)
13791 
13792 {
13793    DataVal av;
13794    AsnTypePtr atp, writetype = NULL;
13795    Pointer pnt;
13796    AsnWriteFunc func = NULL;
13797    Boolean retval = FALSE;
13798 
13799    if (! loaded)
13800    {
13801       if (! objmacroAsnLoad())
13802       return FALSE;
13803    }
13804 
13805    if (aip == NULL)
13806    return FALSE;
13807 
13808    atp = AsnLinkType(orig, PARSE_DEST);   /* link local tree */
13809    if (atp == NULL) {
13810       return FALSE;
13811    }
13812 
13813    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
13814 
13815     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
13816 
13817    av.ptrvalue = (Pointer)anp;
13818    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
13819       goto erret;
13820    }
13821 
13822    pnt = anp->data.ptrvalue;
13823    switch (anp->choice)
13824    {
13825    case ParseDest_defline:
13826       av.boolvalue = anp->data.boolvalue;
13827       retval = AsnWrite(aip, PARSE_DEST_defline, &av);
13828       break;
13829    case ParseDest_org:
13830       writetype = PARSE_DEST_org;
13831       func = (AsnWriteFunc) ParseDstOrgAsnWrite;
13832       break;
13833    case ParseDest_featqual:
13834       writetype = PARSE_DEST_featqual;
13835       func = (AsnWriteFunc) FeatureFieldLegalAsnWrite;
13836       break;
13837    case ParseDest_comment_descriptor:
13838       av.boolvalue = anp->data.boolvalue;
13839       retval = AsnWrite(aip, PARSE_DEST_comment_descriptor, &av);
13840       break;
13841    case ParseDest_dbxref:
13842       av.ptrvalue = anp->data.ptrvalue;
13843       retval = AsnWrite(aip, PARSE_DEST_dbxref, &av);
13844       break;
13845    }
13846    if (writetype != NULL) {
13847       retval = (* func)(pnt, aip, writetype);   /* write it out */
13848    }
13849    if (!retval) {
13850       goto erret;
13851    }
13852    retval = TRUE;
13853 
13854 erret:
13855    AsnUnlinkType(orig);       /* unlink local tree */
13856    return retval;
13857 }
13858 
13859 
13860 /**************************************************
13861 *
13862 *    LocationIntervalNew()
13863 *
13864 **************************************************/
13865 NLM_EXTERN
13866 LocationIntervalPtr LIBCALL
LocationIntervalNew(void)13867 LocationIntervalNew(void)
13868 {
13869    LocationIntervalPtr ptr = MemNew((size_t) sizeof(LocationInterval));
13870 
13871    return ptr;
13872 
13873 }
13874 
13875 
13876 /**************************************************
13877 *
13878 *    LocationIntervalFree()
13879 *
13880 **************************************************/
13881 NLM_EXTERN
13882 LocationIntervalPtr LIBCALL
LocationIntervalFree(LocationIntervalPtr ptr)13883 LocationIntervalFree(LocationIntervalPtr ptr)
13884 {
13885 
13886    if(ptr == NULL) {
13887       return NULL;
13888    }
13889    return MemFree(ptr);
13890 }
13891 
13892 
13893 /**************************************************
13894 *
13895 *    LocationIntervalAsnRead()
13896 *
13897 **************************************************/
13898 NLM_EXTERN
13899 LocationIntervalPtr LIBCALL
LocationIntervalAsnRead(AsnIoPtr aip,AsnTypePtr orig)13900 LocationIntervalAsnRead(AsnIoPtr aip, AsnTypePtr orig)
13901 {
13902    DataVal av;
13903    AsnTypePtr atp;
13904    Boolean isError = FALSE;
13905    AsnReadFunc func;
13906    LocationIntervalPtr ptr;
13907 
13908    if (! loaded)
13909    {
13910       if (! objmacroAsnLoad()) {
13911          return NULL;
13912       }
13913    }
13914 
13915    if (aip == NULL) {
13916       return NULL;
13917    }
13918 
13919    if (orig == NULL) {         /* LocationInterval ::= (self contained) */
13920       atp = AsnReadId(aip, amp, LOCATION_INTERVAL);
13921    } else {
13922       atp = AsnLinkType(orig, LOCATION_INTERVAL);
13923    }
13924    /* link in local tree */
13925    if (atp == NULL) {
13926       return NULL;
13927    }
13928 
13929    ptr = LocationIntervalNew();
13930    if (ptr == NULL) {
13931       goto erret;
13932    }
13933    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
13934       goto erret;
13935    }
13936 
13937    atp = AsnReadId(aip,amp, atp);
13938    func = NULL;
13939 
13940    if (atp == LOCATION_INTERVAL_from) {
13941       if ( AsnReadVal(aip, atp, &av) <= 0) {
13942          goto erret;
13943       }
13944       ptr -> from = av.intvalue;
13945       atp = AsnReadId(aip,amp, atp);
13946    }
13947    if (atp == LOCATION_INTERVAL_to) {
13948       if ( AsnReadVal(aip, atp, &av) <= 0) {
13949          goto erret;
13950       }
13951       ptr -> to = av.intvalue;
13952       atp = AsnReadId(aip,amp, atp);
13953    }
13954 
13955    if (AsnReadVal(aip, atp, &av) <= 0) {
13956       goto erret;
13957    }
13958    /* end struct */
13959 
13960 ret:
13961    AsnUnlinkType(orig);       /* unlink local tree */
13962    return ptr;
13963 
13964 erret:
13965    aip -> io_failure = TRUE;
13966    ptr = LocationIntervalFree(ptr);
13967    goto ret;
13968 }
13969 
13970 
13971 
13972 /**************************************************
13973 *
13974 *    LocationIntervalAsnWrite()
13975 *
13976 **************************************************/
13977 NLM_EXTERN Boolean LIBCALL
LocationIntervalAsnWrite(LocationIntervalPtr ptr,AsnIoPtr aip,AsnTypePtr orig)13978 LocationIntervalAsnWrite(LocationIntervalPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
13979 {
13980    DataVal av;
13981    AsnTypePtr atp;
13982    Boolean retval = FALSE;
13983 
13984    if (! loaded)
13985    {
13986       if (! objmacroAsnLoad()) {
13987          return FALSE;
13988       }
13989    }
13990 
13991    if (aip == NULL) {
13992       return FALSE;
13993    }
13994 
13995    atp = AsnLinkType(orig, LOCATION_INTERVAL);   /* link local tree */
13996    if (atp == NULL) {
13997       return FALSE;
13998    }
13999 
14000    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
14001 
14002     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
14003 
14004    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
14005       goto erret;
14006    }
14007 
14008    av.intvalue = ptr -> from;
14009    retval = AsnWrite(aip, LOCATION_INTERVAL_from,  &av);
14010    av.intvalue = ptr -> to;
14011    retval = AsnWrite(aip, LOCATION_INTERVAL_to,  &av);
14012    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
14013       goto erret;
14014    }
14015    retval = TRUE;
14016 
14017 erret:
14018    AsnUnlinkType(orig);       /* unlink local tree */
14019    return retval;
14020 }
14021 
14022 
14023 
14024 /**************************************************
14025 *
14026 *    LocationChoiceFree()
14027 *
14028 **************************************************/
14029 NLM_EXTERN
14030 LocationChoicePtr LIBCALL
LocationChoiceFree(ValNodePtr anp)14031 LocationChoiceFree(ValNodePtr anp)
14032 {
14033    Pointer pnt;
14034 
14035    if (anp == NULL) {
14036       return NULL;
14037    }
14038 
14039    pnt = anp->data.ptrvalue;
14040    switch (anp->choice)
14041    {
14042    default:
14043       break;
14044    case LocationChoice_interval:
14045       LocationIntervalFree(anp -> data.ptrvalue);
14046       break;
14047    }
14048    return MemFree(anp);
14049 }
14050 
14051 
14052 /**************************************************
14053 *
14054 *    LocationChoiceAsnRead()
14055 *
14056 **************************************************/
14057 NLM_EXTERN
14058 LocationChoicePtr LIBCALL
LocationChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)14059 LocationChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
14060 {
14061    DataVal av;
14062    AsnTypePtr atp;
14063    ValNodePtr anp;
14064    Uint1 choice;
14065    Boolean isError = FALSE;
14066    Boolean nullIsError = FALSE;
14067    AsnReadFunc func;
14068 
14069    if (! loaded)
14070    {
14071       if (! objmacroAsnLoad()) {
14072          return NULL;
14073       }
14074    }
14075 
14076    if (aip == NULL) {
14077       return NULL;
14078    }
14079 
14080    if (orig == NULL) {         /* LocationChoice ::= (self contained) */
14081       atp = AsnReadId(aip, amp, LOCATION_CHOICE);
14082    } else {
14083       atp = AsnLinkType(orig, LOCATION_CHOICE);    /* link in local tree */
14084    }
14085    if (atp == NULL) {
14086       return NULL;
14087    }
14088 
14089    anp = ValNodeNew(NULL);
14090    if (anp == NULL) {
14091       goto erret;
14092    }
14093    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
14094       goto erret;
14095    }
14096 
14097    func = NULL;
14098 
14099    atp = AsnReadId(aip, amp, atp);  /* find the choice */
14100    if (atp == NULL) {
14101       goto erret;
14102    }
14103    if (atp == LOCATION_CHOICE_interval) {
14104       choice = LocationChoice_interval;
14105       func = (AsnReadFunc) LocationIntervalAsnRead;
14106    }
14107    else if (atp == LOCATION_CHOICE_whole_sequence) {
14108       choice = LocationChoice_whole_sequence;
14109       if (AsnReadVal(aip, atp, &av) <= 0) {
14110          goto erret;
14111       }
14112       anp->data.boolvalue = av.boolvalue;
14113    }
14114    else if (atp == LOCATION_CHOICE_point) {
14115       choice = LocationChoice_point;
14116       if (AsnReadVal(aip, atp, &av) <= 0) {
14117          goto erret;
14118       }
14119       anp->data.intvalue = av.intvalue;
14120    }
14121    anp->choice = choice;
14122    if (func != NULL)
14123    {
14124       anp->data.ptrvalue = (* func)(aip, atp);
14125       if (aip -> io_failure) goto erret;
14126 
14127       if (nullIsError && anp->data.ptrvalue == NULL) {
14128          goto erret;
14129       }
14130    }
14131 
14132 ret:
14133    AsnUnlinkType(orig);       /* unlink local tree */
14134    return anp;
14135 
14136 erret:
14137    anp = MemFree(anp);
14138    aip -> io_failure = TRUE;
14139    goto ret;
14140 }
14141 
14142 
14143 /**************************************************
14144 *
14145 *    LocationChoiceAsnWrite()
14146 *
14147 **************************************************/
14148 NLM_EXTERN Boolean LIBCALL
LocationChoiceAsnWrite(LocationChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)14149 LocationChoiceAsnWrite(LocationChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
14150 
14151 {
14152    DataVal av;
14153    AsnTypePtr atp, writetype = NULL;
14154    Pointer pnt;
14155    AsnWriteFunc func = NULL;
14156    Boolean retval = FALSE;
14157 
14158    if (! loaded)
14159    {
14160       if (! objmacroAsnLoad())
14161       return FALSE;
14162    }
14163 
14164    if (aip == NULL)
14165    return FALSE;
14166 
14167    atp = AsnLinkType(orig, LOCATION_CHOICE);   /* link local tree */
14168    if (atp == NULL) {
14169       return FALSE;
14170    }
14171 
14172    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
14173 
14174     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
14175 
14176    av.ptrvalue = (Pointer)anp;
14177    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
14178       goto erret;
14179    }
14180 
14181    pnt = anp->data.ptrvalue;
14182    switch (anp->choice)
14183    {
14184    case LocationChoice_interval:
14185       writetype = LOCATION_CHOICE_interval;
14186       func = (AsnWriteFunc) LocationIntervalAsnWrite;
14187       break;
14188    case LocationChoice_whole_sequence:
14189       av.boolvalue = anp->data.boolvalue;
14190       retval = AsnWrite(aip, LOCATION_CHOICE_whole_sequence, &av);
14191       break;
14192    case LocationChoice_point:
14193       av.intvalue = anp->data.intvalue;
14194       retval = AsnWrite(aip, LOCATION_CHOICE_point, &av);
14195       break;
14196    }
14197    if (writetype != NULL) {
14198       retval = (* func)(pnt, aip, writetype);   /* write it out */
14199    }
14200    if (!retval) {
14201       goto erret;
14202    }
14203    retval = TRUE;
14204 
14205 erret:
14206    AsnUnlinkType(orig);       /* unlink local tree */
14207    return retval;
14208 }
14209 
14210 
14211 /**************************************************
14212 *
14213 *    SequenceListFree()
14214 *
14215 **************************************************/
14216 NLM_EXTERN
14217 SequenceListPtr LIBCALL
SequenceListFree(SequenceListPtr ptr)14218 SequenceListFree(SequenceListPtr ptr)
14219 {
14220 
14221    if(ptr == NULL) {
14222       return NULL;
14223    }
14224    AsnGenericBaseSeqOfFree(ptr,ASNCODE_PTRVAL_SLOT);
14225    return NULL;
14226 }
14227 
14228 
14229 /**************************************************
14230 *
14231 *    SequenceListAsnRead()
14232 *
14233 **************************************************/
14234 NLM_EXTERN
14235 SequenceListPtr LIBCALL
SequenceListAsnRead(AsnIoPtr aip,AsnTypePtr orig)14236 SequenceListAsnRead(AsnIoPtr aip, AsnTypePtr orig)
14237 {
14238    DataVal av;
14239    AsnTypePtr atp;
14240    Boolean isError = FALSE;
14241    AsnReadFunc func;
14242    SequenceListPtr ptr;
14243 
14244    if (! loaded)
14245    {
14246       if (! objmacroAsnLoad()) {
14247          return NULL;
14248       }
14249    }
14250 
14251    if (aip == NULL) {
14252       return NULL;
14253    }
14254 
14255    if (orig == NULL) {         /* SequenceList ::= (self contained) */
14256       atp = AsnReadId(aip, amp, SEQUENCE_LIST);
14257    } else {
14258       atp = AsnLinkType(orig, SEQUENCE_LIST);
14259    }
14260    /* link in local tree */
14261    if (atp == NULL) {
14262       return NULL;
14263    }
14264 
14265    func = NULL;
14266 
14267    ptr  = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
14268    if (isError && ptr  == NULL) {
14269       goto erret;
14270    }
14271 
14272 
14273 
14274 ret:
14275    AsnUnlinkType(orig);       /* unlink local tree */
14276    return ptr;
14277 
14278 erret:
14279    aip -> io_failure = TRUE;
14280    ptr = SequenceListFree(ptr);
14281    goto ret;
14282 }
14283 
14284 
14285 
14286 /**************************************************
14287 *
14288 *    SequenceListAsnWrite()
14289 *
14290 **************************************************/
14291 NLM_EXTERN Boolean LIBCALL
SequenceListAsnWrite(SequenceListPtr ptr,AsnIoPtr aip,AsnTypePtr orig)14292 SequenceListAsnWrite(SequenceListPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
14293 {
14294    DataVal av;
14295    AsnTypePtr atp;
14296    Boolean retval = FALSE;
14297 
14298    if (! loaded)
14299    {
14300       if (! objmacroAsnLoad()) {
14301          return FALSE;
14302       }
14303    }
14304 
14305    if (aip == NULL) {
14306       return FALSE;
14307    }
14308 
14309    atp = AsnLinkType(orig, SEQUENCE_LIST);   /* link local tree */
14310    if (atp == NULL) {
14311       return FALSE;
14312    }
14313 
14314    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
14315 
14316     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
14317 
14318    retval = AsnGenericBaseSeqOfAsnWrite(ptr, ASNCODE_PTRVAL_SLOT, aip, atp, SEQUENCE_LIST_E);
14319    retval = TRUE;
14320 
14321 erret:
14322    AsnUnlinkType(orig);       /* unlink local tree */
14323    return retval;
14324 }
14325 
14326 
14327 
14328 /**************************************************
14329 *
14330 *    SequenceListChoiceFree()
14331 *
14332 **************************************************/
14333 NLM_EXTERN
14334 SequenceListChoicePtr LIBCALL
SequenceListChoiceFree(ValNodePtr anp)14335 SequenceListChoiceFree(ValNodePtr anp)
14336 {
14337    Pointer pnt;
14338 
14339    if (anp == NULL) {
14340       return NULL;
14341    }
14342 
14343    pnt = anp->data.ptrvalue;
14344    switch (anp->choice)
14345    {
14346    default:
14347       break;
14348    case SequenceListChoice_list:
14349       SequenceListFree(anp -> data.ptrvalue);
14350       break;
14351    }
14352    return MemFree(anp);
14353 }
14354 
14355 
14356 /**************************************************
14357 *
14358 *    SequenceListChoiceAsnRead()
14359 *
14360 **************************************************/
14361 NLM_EXTERN
14362 SequenceListChoicePtr LIBCALL
SequenceListChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)14363 SequenceListChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
14364 {
14365    DataVal av;
14366    AsnTypePtr atp;
14367    ValNodePtr anp;
14368    Uint1 choice;
14369    Boolean isError = FALSE;
14370    Boolean nullIsError = FALSE;
14371    AsnReadFunc func;
14372 
14373    if (! loaded)
14374    {
14375       if (! objmacroAsnLoad()) {
14376          return NULL;
14377       }
14378    }
14379 
14380    if (aip == NULL) {
14381       return NULL;
14382    }
14383 
14384    if (orig == NULL) {         /* SequenceListChoice ::= (self contained) */
14385       atp = AsnReadId(aip, amp, SEQUENCE_LIST_CHOICE);
14386    } else {
14387       atp = AsnLinkType(orig, SEQUENCE_LIST_CHOICE);    /* link in local tree */
14388    }
14389    if (atp == NULL) {
14390       return NULL;
14391    }
14392 
14393    anp = ValNodeNew(NULL);
14394    if (anp == NULL) {
14395       goto erret;
14396    }
14397    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
14398       goto erret;
14399    }
14400 
14401    func = NULL;
14402 
14403    atp = AsnReadId(aip, amp, atp);  /* find the choice */
14404    if (atp == NULL) {
14405       goto erret;
14406    }
14407    if (atp == SEQUENCE_LIST_CHOICE_list) {
14408       choice = SequenceListChoice_list;
14409       func = (AsnReadFunc) SequenceListAsnRead;
14410    }
14411    else if (atp == SEQUENCE_LIST_CHOICE_all) {
14412       choice = SequenceListChoice_all;
14413       if (AsnReadVal(aip, atp, &av) <= 0) {
14414          goto erret;
14415       }
14416       anp->data.boolvalue = av.boolvalue;
14417    }
14418    anp->choice = choice;
14419    if (func != NULL)
14420    {
14421       anp->data.ptrvalue = (* func)(aip, atp);
14422       if (aip -> io_failure) goto erret;
14423 
14424       if (nullIsError && anp->data.ptrvalue == NULL) {
14425          goto erret;
14426       }
14427    }
14428 
14429 ret:
14430    AsnUnlinkType(orig);       /* unlink local tree */
14431    return anp;
14432 
14433 erret:
14434    anp = MemFree(anp);
14435    aip -> io_failure = TRUE;
14436    goto ret;
14437 }
14438 
14439 
14440 /**************************************************
14441 *
14442 *    SequenceListChoiceAsnWrite()
14443 *
14444 **************************************************/
14445 NLM_EXTERN Boolean LIBCALL
SequenceListChoiceAsnWrite(SequenceListChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)14446 SequenceListChoiceAsnWrite(SequenceListChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
14447 
14448 {
14449    DataVal av;
14450    AsnTypePtr atp, writetype = NULL;
14451    Pointer pnt;
14452    AsnWriteFunc func = NULL;
14453    Boolean retval = FALSE;
14454 
14455    if (! loaded)
14456    {
14457       if (! objmacroAsnLoad())
14458       return FALSE;
14459    }
14460 
14461    if (aip == NULL)
14462    return FALSE;
14463 
14464    atp = AsnLinkType(orig, SEQUENCE_LIST_CHOICE);   /* link local tree */
14465    if (atp == NULL) {
14466       return FALSE;
14467    }
14468 
14469    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
14470 
14471     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
14472 
14473    av.ptrvalue = (Pointer)anp;
14474    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
14475       goto erret;
14476    }
14477 
14478    pnt = anp->data.ptrvalue;
14479    switch (anp->choice)
14480    {
14481    case SequenceListChoice_list:
14482       writetype = SEQUENCE_LIST_CHOICE_list;
14483       func = (AsnWriteFunc) SequenceListAsnWrite;
14484       break;
14485    case SequenceListChoice_all:
14486       av.boolvalue = anp->data.boolvalue;
14487       retval = AsnWrite(aip, SEQUENCE_LIST_CHOICE_all, &av);
14488       break;
14489    }
14490    if (writetype != NULL) {
14491       retval = (* func)(pnt, aip, writetype);   /* write it out */
14492    }
14493    if (!retval) {
14494       goto erret;
14495    }
14496    retval = TRUE;
14497 
14498 erret:
14499    AsnUnlinkType(orig);       /* unlink local tree */
14500    return retval;
14501 }
14502 
14503 
14504 /**************************************************
14505 *
14506 *    ApplyFeatureActionNew()
14507 *
14508 **************************************************/
14509 NLM_EXTERN
14510 ApplyFeatureActionPtr LIBCALL
ApplyFeatureActionNew(void)14511 ApplyFeatureActionNew(void)
14512 {
14513    ApplyFeatureActionPtr ptr = MemNew((size_t) sizeof(ApplyFeatureAction));
14514 
14515    ptr -> partial5 = 0;
14516    ptr -> partial3 = 0;
14517    ptr -> plus_strand = 1;
14518    ptr -> add_redundant = 1;
14519    ptr -> add_mrna = 0;
14520    ptr -> apply_to_parts = 0;
14521    ptr -> only_seg_num = -1;
14522    return ptr;
14523 
14524 }
14525 
14526 
14527 /**************************************************
14528 *
14529 *    ApplyFeatureActionFree()
14530 *
14531 **************************************************/
14532 NLM_EXTERN
14533 ApplyFeatureActionPtr LIBCALL
ApplyFeatureActionFree(ApplyFeatureActionPtr ptr)14534 ApplyFeatureActionFree(ApplyFeatureActionPtr ptr)
14535 {
14536 
14537    if(ptr == NULL) {
14538       return NULL;
14539    }
14540    LocationChoiceFree(ptr -> location);
14541    SequenceListChoiceFree(ptr -> seq_list);
14542    FeatQualLegalSetFree(ptr -> fields);
14543    SourceQualValSetFree(ptr -> src_fields);
14544    return MemFree(ptr);
14545 }
14546 
14547 
14548 /**************************************************
14549 *
14550 *    ApplyFeatureActionAsnRead()
14551 *
14552 **************************************************/
14553 NLM_EXTERN
14554 ApplyFeatureActionPtr LIBCALL
ApplyFeatureActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)14555 ApplyFeatureActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
14556 {
14557    DataVal av;
14558    AsnTypePtr atp;
14559    Boolean isError = FALSE;
14560    AsnReadFunc func;
14561    ApplyFeatureActionPtr ptr;
14562 
14563    if (! loaded)
14564    {
14565       if (! objmacroAsnLoad()) {
14566          return NULL;
14567       }
14568    }
14569 
14570    if (aip == NULL) {
14571       return NULL;
14572    }
14573 
14574    if (orig == NULL) {         /* ApplyFeatureAction ::= (self contained) */
14575       atp = AsnReadId(aip, amp, APPLY_FEATURE_ACTION);
14576    } else {
14577       atp = AsnLinkType(orig, APPLY_FEATURE_ACTION);
14578    }
14579    /* link in local tree */
14580    if (atp == NULL) {
14581       return NULL;
14582    }
14583 
14584    ptr = ApplyFeatureActionNew();
14585    if (ptr == NULL) {
14586       goto erret;
14587    }
14588    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
14589       goto erret;
14590    }
14591 
14592    atp = AsnReadId(aip,amp, atp);
14593    func = NULL;
14594 
14595    if (atp == APPLY_FEATURE_ACTION_type) {
14596       if ( AsnReadVal(aip, atp, &av) <= 0) {
14597          goto erret;
14598       }
14599       ptr -> type = av.intvalue;
14600       atp = AsnReadId(aip,amp, atp);
14601    }
14602    if (atp == APPLY_FEATURE_ACTION_partial5) {
14603       if ( AsnReadVal(aip, atp, &av) <= 0) {
14604          goto erret;
14605       }
14606       ptr -> partial5 = av.boolvalue;
14607       atp = AsnReadId(aip,amp, atp);
14608    }
14609    if (atp == APPLY_FEATURE_ACTION_partial3) {
14610       if ( AsnReadVal(aip, atp, &av) <= 0) {
14611          goto erret;
14612       }
14613       ptr -> partial3 = av.boolvalue;
14614       atp = AsnReadId(aip,amp, atp);
14615    }
14616    if (atp == APPLY_FEATURE_ACTION_plus_strand) {
14617       if ( AsnReadVal(aip, atp, &av) <= 0) {
14618          goto erret;
14619       }
14620       ptr -> plus_strand = av.boolvalue;
14621       atp = AsnReadId(aip,amp, atp);
14622    }
14623    if (atp == APPLY_FEATURE_ACTION_location) {
14624       ptr -> location = LocationChoiceAsnRead(aip, atp);
14625       if (aip -> io_failure) {
14626          goto erret;
14627       }
14628       atp = AsnReadId(aip,amp, atp);
14629    }
14630    if (atp == APPLY_FEATURE_ACTION_seq_list) {
14631       ptr -> seq_list = SequenceListChoiceAsnRead(aip, atp);
14632       if (aip -> io_failure) {
14633          goto erret;
14634       }
14635       atp = AsnReadId(aip,amp, atp);
14636    }
14637    if (atp == APPLY_FEATURE_ACTION_add_redundant) {
14638       if ( AsnReadVal(aip, atp, &av) <= 0) {
14639          goto erret;
14640       }
14641       ptr -> add_redundant = av.boolvalue;
14642       atp = AsnReadId(aip,amp, atp);
14643    }
14644    if (atp == APPLY_FEATURE_ACTION_add_mrna) {
14645       if ( AsnReadVal(aip, atp, &av) <= 0) {
14646          goto erret;
14647       }
14648       ptr -> add_mrna = av.boolvalue;
14649       atp = AsnReadId(aip,amp, atp);
14650    }
14651    if (atp == APPLY_FEATURE_ACTION_apply_to_parts) {
14652       if ( AsnReadVal(aip, atp, &av) <= 0) {
14653          goto erret;
14654       }
14655       ptr -> apply_to_parts = av.boolvalue;
14656       atp = AsnReadId(aip,amp, atp);
14657    }
14658    if (atp == APPLY_FEATURE_ACTION_only_seg_num) {
14659       if ( AsnReadVal(aip, atp, &av) <= 0) {
14660          goto erret;
14661       }
14662       ptr -> only_seg_num = av.intvalue;
14663       atp = AsnReadId(aip,amp, atp);
14664    }
14665    if (atp == APPLY_FEATURE_ACTION_fields) {
14666       ptr -> fields = FeatQualLegalSetAsnRead(aip, atp);
14667       if (aip -> io_failure) {
14668          goto erret;
14669       }
14670       atp = AsnReadId(aip,amp, atp);
14671    }
14672    if (atp == APPLY_FEATURE_ACTION_src_fields) {
14673       ptr -> src_fields = SourceQualValSetAsnRead(aip, atp);
14674       if (aip -> io_failure) {
14675          goto erret;
14676       }
14677       atp = AsnReadId(aip,amp, atp);
14678    }
14679 
14680    if (AsnReadVal(aip, atp, &av) <= 0) {
14681       goto erret;
14682    }
14683    /* end struct */
14684 
14685 ret:
14686    AsnUnlinkType(orig);       /* unlink local tree */
14687    return ptr;
14688 
14689 erret:
14690    aip -> io_failure = TRUE;
14691    ptr = ApplyFeatureActionFree(ptr);
14692    goto ret;
14693 }
14694 
14695 
14696 
14697 /**************************************************
14698 *
14699 *    ApplyFeatureActionAsnWrite()
14700 *
14701 **************************************************/
14702 NLM_EXTERN Boolean LIBCALL
ApplyFeatureActionAsnWrite(ApplyFeatureActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)14703 ApplyFeatureActionAsnWrite(ApplyFeatureActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
14704 {
14705    DataVal av;
14706    AsnTypePtr atp;
14707    Boolean retval = FALSE;
14708 
14709    if (! loaded)
14710    {
14711       if (! objmacroAsnLoad()) {
14712          return FALSE;
14713       }
14714    }
14715 
14716    if (aip == NULL) {
14717       return FALSE;
14718    }
14719 
14720    atp = AsnLinkType(orig, APPLY_FEATURE_ACTION);   /* link local tree */
14721    if (atp == NULL) {
14722       return FALSE;
14723    }
14724 
14725    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
14726 
14727     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
14728 
14729    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
14730       goto erret;
14731    }
14732 
14733    av.intvalue = ptr -> type;
14734    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_type,  &av);
14735    av.boolvalue = ptr -> partial5;
14736    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_partial5,  &av);
14737    av.boolvalue = ptr -> partial3;
14738    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_partial3,  &av);
14739    av.boolvalue = ptr -> plus_strand;
14740    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_plus_strand,  &av);
14741    if (ptr -> location != NULL) {
14742       if ( ! LocationChoiceAsnWrite(ptr -> location, aip, APPLY_FEATURE_ACTION_location)) {
14743          goto erret;
14744       }
14745    }
14746    if (ptr -> seq_list != NULL) {
14747       if ( ! SequenceListChoiceAsnWrite(ptr -> seq_list, aip, APPLY_FEATURE_ACTION_seq_list)) {
14748          goto erret;
14749       }
14750    }
14751    av.boolvalue = ptr -> add_redundant;
14752    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_add_redundant,  &av);
14753    av.boolvalue = ptr -> add_mrna;
14754    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_add_mrna,  &av);
14755    av.boolvalue = ptr -> apply_to_parts;
14756    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_apply_to_parts,  &av);
14757    av.intvalue = ptr -> only_seg_num;
14758    retval = AsnWrite(aip, APPLY_FEATURE_ACTION_only_seg_num,  &av);
14759    if (ptr -> fields != NULL) {
14760       if ( ! FeatQualLegalSetAsnWrite(ptr -> fields, aip, APPLY_FEATURE_ACTION_fields)) {
14761          goto erret;
14762       }
14763    }
14764    if (ptr -> src_fields != NULL) {
14765       if ( ! SourceQualValSetAsnWrite(ptr -> src_fields, aip, APPLY_FEATURE_ACTION_src_fields)) {
14766          goto erret;
14767       }
14768    }
14769    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
14770       goto erret;
14771    }
14772    retval = TRUE;
14773 
14774 erret:
14775    AsnUnlinkType(orig);       /* unlink local tree */
14776    return retval;
14777 }
14778 
14779 
14780 
14781 /**************************************************
14782 *
14783 *    RemoveFeatureActionNew()
14784 *
14785 **************************************************/
14786 NLM_EXTERN
14787 RemoveFeatureActionPtr LIBCALL
RemoveFeatureActionNew(void)14788 RemoveFeatureActionNew(void)
14789 {
14790    RemoveFeatureActionPtr ptr = MemNew((size_t) sizeof(RemoveFeatureAction));
14791 
14792    return ptr;
14793 
14794 }
14795 
14796 
14797 /**************************************************
14798 *
14799 *    RemoveFeatureActionFree()
14800 *
14801 **************************************************/
14802 NLM_EXTERN
14803 RemoveFeatureActionPtr LIBCALL
RemoveFeatureActionFree(RemoveFeatureActionPtr ptr)14804 RemoveFeatureActionFree(RemoveFeatureActionPtr ptr)
14805 {
14806 
14807    if(ptr == NULL) {
14808       return NULL;
14809    }
14810    ConstraintChoiceSetFree(ptr -> constraint);
14811    return MemFree(ptr);
14812 }
14813 
14814 
14815 /**************************************************
14816 *
14817 *    RemoveFeatureActionAsnRead()
14818 *
14819 **************************************************/
14820 NLM_EXTERN
14821 RemoveFeatureActionPtr LIBCALL
RemoveFeatureActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)14822 RemoveFeatureActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
14823 {
14824    DataVal av;
14825    AsnTypePtr atp;
14826    Boolean isError = FALSE;
14827    AsnReadFunc func;
14828    RemoveFeatureActionPtr ptr;
14829 
14830    if (! loaded)
14831    {
14832       if (! objmacroAsnLoad()) {
14833          return NULL;
14834       }
14835    }
14836 
14837    if (aip == NULL) {
14838       return NULL;
14839    }
14840 
14841    if (orig == NULL) {         /* RemoveFeatureAction ::= (self contained) */
14842       atp = AsnReadId(aip, amp, REMOVE_FEATURE_ACTION);
14843    } else {
14844       atp = AsnLinkType(orig, REMOVE_FEATURE_ACTION);
14845    }
14846    /* link in local tree */
14847    if (atp == NULL) {
14848       return NULL;
14849    }
14850 
14851    ptr = RemoveFeatureActionNew();
14852    if (ptr == NULL) {
14853       goto erret;
14854    }
14855    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
14856       goto erret;
14857    }
14858 
14859    atp = AsnReadId(aip,amp, atp);
14860    func = NULL;
14861 
14862    if (atp == REMOVE_FEATURE_ACTION_type) {
14863       if ( AsnReadVal(aip, atp, &av) <= 0) {
14864          goto erret;
14865       }
14866       ptr -> type = av.intvalue;
14867       atp = AsnReadId(aip,amp, atp);
14868    }
14869    if (atp == REMOVE_FEATURE_ACTION_constraint) {
14870       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
14871       if (aip -> io_failure) {
14872          goto erret;
14873       }
14874       atp = AsnReadId(aip,amp, atp);
14875    }
14876 
14877    if (AsnReadVal(aip, atp, &av) <= 0) {
14878       goto erret;
14879    }
14880    /* end struct */
14881 
14882 ret:
14883    AsnUnlinkType(orig);       /* unlink local tree */
14884    return ptr;
14885 
14886 erret:
14887    aip -> io_failure = TRUE;
14888    ptr = RemoveFeatureActionFree(ptr);
14889    goto ret;
14890 }
14891 
14892 
14893 
14894 /**************************************************
14895 *
14896 *    RemoveFeatureActionAsnWrite()
14897 *
14898 **************************************************/
14899 NLM_EXTERN Boolean LIBCALL
RemoveFeatureActionAsnWrite(RemoveFeatureActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)14900 RemoveFeatureActionAsnWrite(RemoveFeatureActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
14901 {
14902    DataVal av;
14903    AsnTypePtr atp;
14904    Boolean retval = FALSE;
14905 
14906    if (! loaded)
14907    {
14908       if (! objmacroAsnLoad()) {
14909          return FALSE;
14910       }
14911    }
14912 
14913    if (aip == NULL) {
14914       return FALSE;
14915    }
14916 
14917    atp = AsnLinkType(orig, REMOVE_FEATURE_ACTION);   /* link local tree */
14918    if (atp == NULL) {
14919       return FALSE;
14920    }
14921 
14922    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
14923 
14924     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
14925 
14926    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
14927       goto erret;
14928    }
14929 
14930    av.intvalue = ptr -> type;
14931    retval = AsnWrite(aip, REMOVE_FEATURE_ACTION_type,  &av);
14932    if (ptr -> constraint != NULL) {
14933       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, REMOVE_FEATURE_ACTION_constraint)) {
14934          goto erret;
14935       }
14936    }
14937    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
14938       goto erret;
14939    }
14940    retval = TRUE;
14941 
14942 erret:
14943    AsnUnlinkType(orig);       /* unlink local tree */
14944    return retval;
14945 }
14946 
14947 
14948 
14949 /**************************************************
14950 *
14951 *    ConvertFromCDSOptionsNew()
14952 *
14953 **************************************************/
14954 NLM_EXTERN
14955 ConvertFromCDSOptionsPtr LIBCALL
ConvertFromCDSOptionsNew(void)14956 ConvertFromCDSOptionsNew(void)
14957 {
14958    ConvertFromCDSOptionsPtr ptr = MemNew((size_t) sizeof(ConvertFromCDSOptions));
14959 
14960    return ptr;
14961 
14962 }
14963 
14964 
14965 /**************************************************
14966 *
14967 *    ConvertFromCDSOptionsFree()
14968 *
14969 **************************************************/
14970 NLM_EXTERN
14971 ConvertFromCDSOptionsPtr LIBCALL
ConvertFromCDSOptionsFree(ConvertFromCDSOptionsPtr ptr)14972 ConvertFromCDSOptionsFree(ConvertFromCDSOptionsPtr ptr)
14973 {
14974 
14975    if(ptr == NULL) {
14976       return NULL;
14977    }
14978    return MemFree(ptr);
14979 }
14980 
14981 
14982 /**************************************************
14983 *
14984 *    ConvertFromCDSOptionsAsnRead()
14985 *
14986 **************************************************/
14987 NLM_EXTERN
14988 ConvertFromCDSOptionsPtr LIBCALL
ConvertFromCDSOptionsAsnRead(AsnIoPtr aip,AsnTypePtr orig)14989 ConvertFromCDSOptionsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
14990 {
14991    DataVal av;
14992    AsnTypePtr atp;
14993    Boolean isError = FALSE;
14994    AsnReadFunc func;
14995    ConvertFromCDSOptionsPtr ptr;
14996 
14997    if (! loaded)
14998    {
14999       if (! objmacroAsnLoad()) {
15000          return NULL;
15001       }
15002    }
15003 
15004    if (aip == NULL) {
15005       return NULL;
15006    }
15007 
15008    if (orig == NULL) {         /* ConvertFromCDSOptions ::= (self contained) */
15009       atp = AsnReadId(aip, amp, CONVERT_FROM_CDS_OPTIONS);
15010    } else {
15011       atp = AsnLinkType(orig, CONVERT_FROM_CDS_OPTIONS);
15012    }
15013    /* link in local tree */
15014    if (atp == NULL) {
15015       return NULL;
15016    }
15017 
15018    ptr = ConvertFromCDSOptionsNew();
15019    if (ptr == NULL) {
15020       goto erret;
15021    }
15022    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
15023       goto erret;
15024    }
15025 
15026    atp = AsnReadId(aip,amp, atp);
15027    func = NULL;
15028 
15029    if (atp == CONVERT_FROM_CDS_OPTIONS_remove_mRNA) {
15030       if ( AsnReadVal(aip, atp, &av) <= 0) {
15031          goto erret;
15032       }
15033       ptr -> remove_mRNA = av.boolvalue;
15034       atp = AsnReadId(aip,amp, atp);
15035    }
15036    if (atp == CONVERT_FROM_CDS_OPTIONS_remove_gene) {
15037       if ( AsnReadVal(aip, atp, &av) <= 0) {
15038          goto erret;
15039       }
15040       ptr -> remove_gene = av.boolvalue;
15041       atp = AsnReadId(aip,amp, atp);
15042    }
15043    if (atp == CONVERT_FROM_CDS_OPTIONS_remove_transcript_id) {
15044       if ( AsnReadVal(aip, atp, &av) <= 0) {
15045          goto erret;
15046       }
15047       ptr -> remove_transcript_id = av.boolvalue;
15048       atp = AsnReadId(aip,amp, atp);
15049    }
15050 
15051    if (AsnReadVal(aip, atp, &av) <= 0) {
15052       goto erret;
15053    }
15054    /* end struct */
15055 
15056 ret:
15057    AsnUnlinkType(orig);       /* unlink local tree */
15058    return ptr;
15059 
15060 erret:
15061    aip -> io_failure = TRUE;
15062    ptr = ConvertFromCDSOptionsFree(ptr);
15063    goto ret;
15064 }
15065 
15066 
15067 
15068 /**************************************************
15069 *
15070 *    ConvertFromCDSOptionsAsnWrite()
15071 *
15072 **************************************************/
15073 NLM_EXTERN Boolean LIBCALL
ConvertFromCDSOptionsAsnWrite(ConvertFromCDSOptionsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)15074 ConvertFromCDSOptionsAsnWrite(ConvertFromCDSOptionsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
15075 {
15076    DataVal av;
15077    AsnTypePtr atp;
15078    Boolean retval = FALSE;
15079 
15080    if (! loaded)
15081    {
15082       if (! objmacroAsnLoad()) {
15083          return FALSE;
15084       }
15085    }
15086 
15087    if (aip == NULL) {
15088       return FALSE;
15089    }
15090 
15091    atp = AsnLinkType(orig, CONVERT_FROM_CDS_OPTIONS);   /* link local tree */
15092    if (atp == NULL) {
15093       return FALSE;
15094    }
15095 
15096    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
15097 
15098     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
15099 
15100    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
15101       goto erret;
15102    }
15103 
15104    av.boolvalue = ptr -> remove_mRNA;
15105    retval = AsnWrite(aip, CONVERT_FROM_CDS_OPTIONS_remove_mRNA,  &av);
15106    av.boolvalue = ptr -> remove_gene;
15107    retval = AsnWrite(aip, CONVERT_FROM_CDS_OPTIONS_remove_gene,  &av);
15108    av.boolvalue = ptr -> remove_transcript_id;
15109    retval = AsnWrite(aip, CONVERT_FROM_CDS_OPTIONS_remove_transcript_id,  &av);
15110    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
15111       goto erret;
15112    }
15113    retval = TRUE;
15114 
15115 erret:
15116    AsnUnlinkType(orig);       /* unlink local tree */
15117    return retval;
15118 }
15119 
15120 
15121 
15122 /**************************************************
15123 *
15124 *    ConvertFeatureSrcOptionsFree()
15125 *
15126 **************************************************/
15127 NLM_EXTERN
15128 ConvertFeatureSrcOptionsPtr LIBCALL
ConvertFeatureSrcOptionsFree(ValNodePtr anp)15129 ConvertFeatureSrcOptionsFree(ValNodePtr anp)
15130 {
15131    Pointer pnt;
15132 
15133    if (anp == NULL) {
15134       return NULL;
15135    }
15136 
15137    pnt = anp->data.ptrvalue;
15138    switch (anp->choice)
15139    {
15140    default:
15141       break;
15142    case ConvertFeatureSrcOptions_cds:
15143       ConvertFromCDSOptionsFree(anp -> data.ptrvalue);
15144       break;
15145    }
15146    return MemFree(anp);
15147 }
15148 
15149 
15150 /**************************************************
15151 *
15152 *    ConvertFeatureSrcOptionsAsnRead()
15153 *
15154 **************************************************/
15155 NLM_EXTERN
15156 ConvertFeatureSrcOptionsPtr LIBCALL
ConvertFeatureSrcOptionsAsnRead(AsnIoPtr aip,AsnTypePtr orig)15157 ConvertFeatureSrcOptionsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
15158 {
15159    DataVal av;
15160    AsnTypePtr atp;
15161    ValNodePtr anp;
15162    Uint1 choice;
15163    Boolean isError = FALSE;
15164    Boolean nullIsError = FALSE;
15165    AsnReadFunc func;
15166 
15167    if (! loaded)
15168    {
15169       if (! objmacroAsnLoad()) {
15170          return NULL;
15171       }
15172    }
15173 
15174    if (aip == NULL) {
15175       return NULL;
15176    }
15177 
15178    if (orig == NULL) {         /* ConvertFeatureSrcOptions ::= (self contained) */
15179       atp = AsnReadId(aip, amp, CONVERT_FEATURE_SRC_OPTIONS);
15180    } else {
15181       atp = AsnLinkType(orig, CONVERT_FEATURE_SRC_OPTIONS);    /* link in local tree */
15182    }
15183    if (atp == NULL) {
15184       return NULL;
15185    }
15186 
15187    anp = ValNodeNew(NULL);
15188    if (anp == NULL) {
15189       goto erret;
15190    }
15191    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
15192       goto erret;
15193    }
15194 
15195    func = NULL;
15196 
15197    atp = AsnReadId(aip, amp, atp);  /* find the choice */
15198    if (atp == NULL) {
15199       goto erret;
15200    }
15201    if (atp == CONVERT_FEATURE_SRC_OPTIONS_cds) {
15202       choice = ConvertFeatureSrcOptions_cds;
15203       func = (AsnReadFunc) ConvertFromCDSOptionsAsnRead;
15204    }
15205    anp->choice = choice;
15206    if (func != NULL)
15207    {
15208       anp->data.ptrvalue = (* func)(aip, atp);
15209       if (aip -> io_failure) goto erret;
15210 
15211       if (nullIsError && anp->data.ptrvalue == NULL) {
15212          goto erret;
15213       }
15214    }
15215 
15216 ret:
15217    AsnUnlinkType(orig);       /* unlink local tree */
15218    return anp;
15219 
15220 erret:
15221    anp = MemFree(anp);
15222    aip -> io_failure = TRUE;
15223    goto ret;
15224 }
15225 
15226 
15227 /**************************************************
15228 *
15229 *    ConvertFeatureSrcOptionsAsnWrite()
15230 *
15231 **************************************************/
15232 NLM_EXTERN Boolean LIBCALL
ConvertFeatureSrcOptionsAsnWrite(ConvertFeatureSrcOptionsPtr anp,AsnIoPtr aip,AsnTypePtr orig)15233 ConvertFeatureSrcOptionsAsnWrite(ConvertFeatureSrcOptionsPtr anp, AsnIoPtr aip, AsnTypePtr orig)
15234 
15235 {
15236    DataVal av;
15237    AsnTypePtr atp, writetype = NULL;
15238    Pointer pnt;
15239    AsnWriteFunc func = NULL;
15240    Boolean retval = FALSE;
15241 
15242    if (! loaded)
15243    {
15244       if (! objmacroAsnLoad())
15245       return FALSE;
15246    }
15247 
15248    if (aip == NULL)
15249    return FALSE;
15250 
15251    atp = AsnLinkType(orig, CONVERT_FEATURE_SRC_OPTIONS);   /* link local tree */
15252    if (atp == NULL) {
15253       return FALSE;
15254    }
15255 
15256    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
15257 
15258     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
15259 
15260    av.ptrvalue = (Pointer)anp;
15261    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
15262       goto erret;
15263    }
15264 
15265    pnt = anp->data.ptrvalue;
15266    switch (anp->choice)
15267    {
15268    case ConvertFeatureSrcOptions_cds:
15269       writetype = CONVERT_FEATURE_SRC_OPTIONS_cds;
15270       func = (AsnWriteFunc) ConvertFromCDSOptionsAsnWrite;
15271       break;
15272    }
15273    if (writetype != NULL) {
15274       retval = (* func)(pnt, aip, writetype);   /* write it out */
15275    }
15276    if (!retval) {
15277       goto erret;
15278    }
15279    retval = TRUE;
15280 
15281 erret:
15282    AsnUnlinkType(orig);       /* unlink local tree */
15283    return retval;
15284 }
15285 
15286 
15287 /**************************************************
15288 *
15289 *    RegionTypeNew()
15290 *
15291 **************************************************/
15292 NLM_EXTERN
15293 RegionTypePtr LIBCALL
RegionTypeNew(void)15294 RegionTypeNew(void)
15295 {
15296    RegionTypePtr ptr = MemNew((size_t) sizeof(RegionType));
15297 
15298    return ptr;
15299 
15300 }
15301 
15302 
15303 /**************************************************
15304 *
15305 *    RegionTypeFree()
15306 *
15307 **************************************************/
15308 NLM_EXTERN
15309 RegionTypePtr LIBCALL
RegionTypeFree(RegionTypePtr ptr)15310 RegionTypeFree(RegionTypePtr ptr)
15311 {
15312 
15313    if(ptr == NULL) {
15314       return NULL;
15315    }
15316    return MemFree(ptr);
15317 }
15318 
15319 
15320 /**************************************************
15321 *
15322 *    RegionTypeAsnRead()
15323 *
15324 **************************************************/
15325 NLM_EXTERN
15326 RegionTypePtr LIBCALL
RegionTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)15327 RegionTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
15328 {
15329    DataVal av;
15330    AsnTypePtr atp;
15331    Boolean isError = FALSE;
15332    AsnReadFunc func;
15333    RegionTypePtr ptr;
15334 
15335    if (! loaded)
15336    {
15337       if (! objmacroAsnLoad()) {
15338          return NULL;
15339       }
15340    }
15341 
15342    if (aip == NULL) {
15343       return NULL;
15344    }
15345 
15346    if (orig == NULL) {         /* RegionType ::= (self contained) */
15347       atp = AsnReadId(aip, amp, REGION_TYPE);
15348    } else {
15349       atp = AsnLinkType(orig, REGION_TYPE);
15350    }
15351    /* link in local tree */
15352    if (atp == NULL) {
15353       return NULL;
15354    }
15355 
15356    ptr = RegionTypeNew();
15357    if (ptr == NULL) {
15358       goto erret;
15359    }
15360    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
15361       goto erret;
15362    }
15363 
15364    atp = AsnReadId(aip,amp, atp);
15365    func = NULL;
15366 
15367    if (atp == REGION_TYPE_create_nucleotide) {
15368       if ( AsnReadVal(aip, atp, &av) <= 0) {
15369          goto erret;
15370       }
15371       ptr -> create_nucleotide = av.boolvalue;
15372       atp = AsnReadId(aip,amp, atp);
15373    }
15374 
15375    if (AsnReadVal(aip, atp, &av) <= 0) {
15376       goto erret;
15377    }
15378    /* end struct */
15379 
15380 ret:
15381    AsnUnlinkType(orig);       /* unlink local tree */
15382    return ptr;
15383 
15384 erret:
15385    aip -> io_failure = TRUE;
15386    ptr = RegionTypeFree(ptr);
15387    goto ret;
15388 }
15389 
15390 
15391 
15392 /**************************************************
15393 *
15394 *    RegionTypeAsnWrite()
15395 *
15396 **************************************************/
15397 NLM_EXTERN Boolean LIBCALL
RegionTypeAsnWrite(RegionTypePtr ptr,AsnIoPtr aip,AsnTypePtr orig)15398 RegionTypeAsnWrite(RegionTypePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
15399 {
15400    DataVal av;
15401    AsnTypePtr atp;
15402    Boolean retval = FALSE;
15403 
15404    if (! loaded)
15405    {
15406       if (! objmacroAsnLoad()) {
15407          return FALSE;
15408       }
15409    }
15410 
15411    if (aip == NULL) {
15412       return FALSE;
15413    }
15414 
15415    atp = AsnLinkType(orig, REGION_TYPE);   /* link local tree */
15416    if (atp == NULL) {
15417       return FALSE;
15418    }
15419 
15420    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
15421 
15422     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
15423 
15424    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
15425       goto erret;
15426    }
15427 
15428    av.boolvalue = ptr -> create_nucleotide;
15429    retval = AsnWrite(aip, REGION_TYPE_create_nucleotide,  &av);
15430    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
15431       goto erret;
15432    }
15433    retval = TRUE;
15434 
15435 erret:
15436    AsnUnlinkType(orig);       /* unlink local tree */
15437    return retval;
15438 }
15439 
15440 
15441 
15442 /**************************************************
15443 *
15444 *    ConvertFeatureDstOptionsFree()
15445 *
15446 **************************************************/
15447 NLM_EXTERN
15448 ConvertFeatureDstOptionsPtr LIBCALL
ConvertFeatureDstOptionsFree(ValNodePtr anp)15449 ConvertFeatureDstOptionsFree(ValNodePtr anp)
15450 {
15451    Pointer pnt;
15452 
15453    if (anp == NULL) {
15454       return NULL;
15455    }
15456 
15457    pnt = anp->data.ptrvalue;
15458    switch (anp->choice)
15459    {
15460    default:
15461       break;
15462    case ConvertFeatureDstOptions_region:
15463       RegionTypeFree(anp -> data.ptrvalue);
15464       break;
15465    case ConvertFeatureDstOptions_ncrna_class:
15466       MemFree(anp -> data.ptrvalue);
15467       break;
15468    }
15469    return MemFree(anp);
15470 }
15471 
15472 
15473 /**************************************************
15474 *
15475 *    ConvertFeatureDstOptionsAsnRead()
15476 *
15477 **************************************************/
15478 NLM_EXTERN
15479 ConvertFeatureDstOptionsPtr LIBCALL
ConvertFeatureDstOptionsAsnRead(AsnIoPtr aip,AsnTypePtr orig)15480 ConvertFeatureDstOptionsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
15481 {
15482    DataVal av;
15483    AsnTypePtr atp;
15484    ValNodePtr anp;
15485    Uint1 choice;
15486    Boolean isError = FALSE;
15487    Boolean nullIsError = FALSE;
15488    AsnReadFunc func;
15489 
15490    if (! loaded)
15491    {
15492       if (! objmacroAsnLoad()) {
15493          return NULL;
15494       }
15495    }
15496 
15497    if (aip == NULL) {
15498       return NULL;
15499    }
15500 
15501    if (orig == NULL) {         /* ConvertFeatureDstOptions ::= (self contained) */
15502       atp = AsnReadId(aip, amp, CONVERT_FEATURE_DST_OPTIONS);
15503    } else {
15504       atp = AsnLinkType(orig, CONVERT_FEATURE_DST_OPTIONS);    /* link in local tree */
15505    }
15506    if (atp == NULL) {
15507       return NULL;
15508    }
15509 
15510    anp = ValNodeNew(NULL);
15511    if (anp == NULL) {
15512       goto erret;
15513    }
15514    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
15515       goto erret;
15516    }
15517 
15518    func = NULL;
15519 
15520    atp = AsnReadId(aip, amp, atp);  /* find the choice */
15521    if (atp == NULL) {
15522       goto erret;
15523    }
15524    if (atp == CONVERT_FEATURE_DST_OPTIONS_bond) {
15525       choice = ConvertFeatureDstOptions_bond;
15526       if (AsnReadVal(aip, atp, &av) <= 0) {
15527          goto erret;
15528       }
15529       anp->data.intvalue = av.intvalue;
15530    }
15531    else if (atp == CONVERT_FEATURE_DST_OPTIONS_site) {
15532       choice = ConvertFeatureDstOptions_site;
15533       if (AsnReadVal(aip, atp, &av) <= 0) {
15534          goto erret;
15535       }
15536       anp->data.intvalue = av.intvalue;
15537    }
15538    else if (atp == CONVERT_FEATURE_DST_OPTIONS_region) {
15539       choice = ConvertFeatureDstOptions_region;
15540       func = (AsnReadFunc) RegionTypeAsnRead;
15541    }
15542    else if (atp == CONVERT_FEATURE_DST_OPTIONS_ncrna_class) {
15543       choice = ConvertFeatureDstOptions_ncrna_class;
15544       if (AsnReadVal(aip, atp, &av) <= 0) {
15545          goto erret;
15546       }
15547       anp->data.ptrvalue = av.ptrvalue;
15548    }
15549    else if (atp == CONVERT_FEATURE_DST_OPTIONS_remove_original) {
15550       choice = ConvertFeatureDstOptions_remove_original;
15551       if (AsnReadVal(aip, atp, &av) <= 0) {
15552          goto erret;
15553       }
15554       anp->data.boolvalue = av.boolvalue;
15555    }
15556    anp->choice = choice;
15557    if (func != NULL)
15558    {
15559       anp->data.ptrvalue = (* func)(aip, atp);
15560       if (aip -> io_failure) goto erret;
15561 
15562       if (nullIsError && anp->data.ptrvalue == NULL) {
15563          goto erret;
15564       }
15565    }
15566 
15567 ret:
15568    AsnUnlinkType(orig);       /* unlink local tree */
15569    return anp;
15570 
15571 erret:
15572    anp = MemFree(anp);
15573    aip -> io_failure = TRUE;
15574    goto ret;
15575 }
15576 
15577 
15578 /**************************************************
15579 *
15580 *    ConvertFeatureDstOptionsAsnWrite()
15581 *
15582 **************************************************/
15583 NLM_EXTERN Boolean LIBCALL
ConvertFeatureDstOptionsAsnWrite(ConvertFeatureDstOptionsPtr anp,AsnIoPtr aip,AsnTypePtr orig)15584 ConvertFeatureDstOptionsAsnWrite(ConvertFeatureDstOptionsPtr anp, AsnIoPtr aip, AsnTypePtr orig)
15585 
15586 {
15587    DataVal av;
15588    AsnTypePtr atp, writetype = NULL;
15589    Pointer pnt;
15590    AsnWriteFunc func = NULL;
15591    Boolean retval = FALSE;
15592 
15593    if (! loaded)
15594    {
15595       if (! objmacroAsnLoad())
15596       return FALSE;
15597    }
15598 
15599    if (aip == NULL)
15600    return FALSE;
15601 
15602    atp = AsnLinkType(orig, CONVERT_FEATURE_DST_OPTIONS);   /* link local tree */
15603    if (atp == NULL) {
15604       return FALSE;
15605    }
15606 
15607    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
15608 
15609     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
15610 
15611    av.ptrvalue = (Pointer)anp;
15612    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
15613       goto erret;
15614    }
15615 
15616    pnt = anp->data.ptrvalue;
15617    switch (anp->choice)
15618    {
15619    case ConvertFeatureDstOptions_bond:
15620       av.intvalue = anp->data.intvalue;
15621       retval = AsnWrite(aip, CONVERT_FEATURE_DST_OPTIONS_bond, &av);
15622       break;
15623    case ConvertFeatureDstOptions_site:
15624       av.intvalue = anp->data.intvalue;
15625       retval = AsnWrite(aip, CONVERT_FEATURE_DST_OPTIONS_site, &av);
15626       break;
15627    case ConvertFeatureDstOptions_region:
15628       writetype = CONVERT_FEATURE_DST_OPTIONS_region;
15629       func = (AsnWriteFunc) RegionTypeAsnWrite;
15630       break;
15631    case ConvertFeatureDstOptions_ncrna_class:
15632       av.ptrvalue = anp->data.ptrvalue;
15633       retval = AsnWrite(aip, CONVERT_FEATURE_DST_OPTIONS_ncrna_class, &av);
15634       break;
15635    case ConvertFeatureDstOptions_remove_original:
15636       av.boolvalue = anp->data.boolvalue;
15637       retval = AsnWrite(aip, CONVERT_FEATURE_DST_OPTIONS_remove_original, &av);
15638       break;
15639    }
15640    if (writetype != NULL) {
15641       retval = (* func)(pnt, aip, writetype);   /* write it out */
15642    }
15643    if (!retval) {
15644       goto erret;
15645    }
15646    retval = TRUE;
15647 
15648 erret:
15649    AsnUnlinkType(orig);       /* unlink local tree */
15650    return retval;
15651 }
15652 
15653 
15654 /**************************************************
15655 *
15656 *    ConvertFeatureActionNew()
15657 *
15658 **************************************************/
15659 NLM_EXTERN
15660 ConvertFeatureActionPtr LIBCALL
ConvertFeatureActionNew(void)15661 ConvertFeatureActionNew(void)
15662 {
15663    ConvertFeatureActionPtr ptr = MemNew((size_t) sizeof(ConvertFeatureAction));
15664 
15665    return ptr;
15666 
15667 }
15668 
15669 
15670 /**************************************************
15671 *
15672 *    ConvertFeatureActionFree()
15673 *
15674 **************************************************/
15675 NLM_EXTERN
15676 ConvertFeatureActionPtr LIBCALL
ConvertFeatureActionFree(ConvertFeatureActionPtr ptr)15677 ConvertFeatureActionFree(ConvertFeatureActionPtr ptr)
15678 {
15679 
15680    if(ptr == NULL) {
15681       return NULL;
15682    }
15683    ConvertFeatureSrcOptionsFree(ptr -> src_options);
15684    ConvertFeatureDstOptionsFree(ptr -> dst_options);
15685    ConstraintChoiceSetFree(ptr -> src_feat_constraint);
15686    return MemFree(ptr);
15687 }
15688 
15689 
15690 /**************************************************
15691 *
15692 *    ConvertFeatureActionAsnRead()
15693 *
15694 **************************************************/
15695 NLM_EXTERN
15696 ConvertFeatureActionPtr LIBCALL
ConvertFeatureActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)15697 ConvertFeatureActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
15698 {
15699    DataVal av;
15700    AsnTypePtr atp;
15701    Boolean isError = FALSE;
15702    AsnReadFunc func;
15703    ConvertFeatureActionPtr ptr;
15704 
15705    if (! loaded)
15706    {
15707       if (! objmacroAsnLoad()) {
15708          return NULL;
15709       }
15710    }
15711 
15712    if (aip == NULL) {
15713       return NULL;
15714    }
15715 
15716    if (orig == NULL) {         /* ConvertFeatureAction ::= (self contained) */
15717       atp = AsnReadId(aip, amp, CONVERT_FEATURE_ACTION);
15718    } else {
15719       atp = AsnLinkType(orig, CONVERT_FEATURE_ACTION);
15720    }
15721    /* link in local tree */
15722    if (atp == NULL) {
15723       return NULL;
15724    }
15725 
15726    ptr = ConvertFeatureActionNew();
15727    if (ptr == NULL) {
15728       goto erret;
15729    }
15730    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
15731       goto erret;
15732    }
15733 
15734    atp = AsnReadId(aip,amp, atp);
15735    func = NULL;
15736 
15737    if (atp == CONVERT_FEATURE_ACTION_type_from) {
15738       if ( AsnReadVal(aip, atp, &av) <= 0) {
15739          goto erret;
15740       }
15741       ptr -> type_from = av.intvalue;
15742       atp = AsnReadId(aip,amp, atp);
15743    }
15744    if (atp == CONVERT_FEATURE_ACTION_type_to) {
15745       if ( AsnReadVal(aip, atp, &av) <= 0) {
15746          goto erret;
15747       }
15748       ptr -> type_to = av.intvalue;
15749       atp = AsnReadId(aip,amp, atp);
15750    }
15751    if (atp == CONVERT_FEATURE_ACTION_src_options) {
15752       ptr -> src_options = ConvertFeatureSrcOptionsAsnRead(aip, atp);
15753       if (aip -> io_failure) {
15754          goto erret;
15755       }
15756       atp = AsnReadId(aip,amp, atp);
15757    }
15758    if (atp == CONVERT_FEATURE_ACTION_dst_options) {
15759       ptr -> dst_options = ConvertFeatureDstOptionsAsnRead(aip, atp);
15760       if (aip -> io_failure) {
15761          goto erret;
15762       }
15763       atp = AsnReadId(aip,amp, atp);
15764    }
15765    if (atp == CONVERT_FEATURE_ACTION_leave_original) {
15766       if ( AsnReadVal(aip, atp, &av) <= 0) {
15767          goto erret;
15768       }
15769       ptr -> leave_original = av.boolvalue;
15770       atp = AsnReadId(aip,amp, atp);
15771    }
15772    if (atp == CONVERT_FEATURE_ACTION_src_feat_constraint) {
15773       ptr -> src_feat_constraint = ConstraintChoiceSetAsnRead(aip, atp);
15774       if (aip -> io_failure) {
15775          goto erret;
15776       }
15777       atp = AsnReadId(aip,amp, atp);
15778    }
15779 
15780    if (AsnReadVal(aip, atp, &av) <= 0) {
15781       goto erret;
15782    }
15783    /* end struct */
15784 
15785 ret:
15786    AsnUnlinkType(orig);       /* unlink local tree */
15787    return ptr;
15788 
15789 erret:
15790    aip -> io_failure = TRUE;
15791    ptr = ConvertFeatureActionFree(ptr);
15792    goto ret;
15793 }
15794 
15795 
15796 
15797 /**************************************************
15798 *
15799 *    ConvertFeatureActionAsnWrite()
15800 *
15801 **************************************************/
15802 NLM_EXTERN Boolean LIBCALL
ConvertFeatureActionAsnWrite(ConvertFeatureActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)15803 ConvertFeatureActionAsnWrite(ConvertFeatureActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
15804 {
15805    DataVal av;
15806    AsnTypePtr atp;
15807    Boolean retval = FALSE;
15808 
15809    if (! loaded)
15810    {
15811       if (! objmacroAsnLoad()) {
15812          return FALSE;
15813       }
15814    }
15815 
15816    if (aip == NULL) {
15817       return FALSE;
15818    }
15819 
15820    atp = AsnLinkType(orig, CONVERT_FEATURE_ACTION);   /* link local tree */
15821    if (atp == NULL) {
15822       return FALSE;
15823    }
15824 
15825    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
15826 
15827     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
15828 
15829    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
15830       goto erret;
15831    }
15832 
15833    av.intvalue = ptr -> type_from;
15834    retval = AsnWrite(aip, CONVERT_FEATURE_ACTION_type_from,  &av);
15835    av.intvalue = ptr -> type_to;
15836    retval = AsnWrite(aip, CONVERT_FEATURE_ACTION_type_to,  &av);
15837    if (ptr -> src_options != NULL) {
15838       if ( ! ConvertFeatureSrcOptionsAsnWrite(ptr -> src_options, aip, CONVERT_FEATURE_ACTION_src_options)) {
15839          goto erret;
15840       }
15841    }
15842    if (ptr -> dst_options != NULL) {
15843       if ( ! ConvertFeatureDstOptionsAsnWrite(ptr -> dst_options, aip, CONVERT_FEATURE_ACTION_dst_options)) {
15844          goto erret;
15845       }
15846    }
15847    av.boolvalue = ptr -> leave_original;
15848    retval = AsnWrite(aip, CONVERT_FEATURE_ACTION_leave_original,  &av);
15849    if (ptr -> src_feat_constraint != NULL) {
15850       if ( ! ConstraintChoiceSetAsnWrite(ptr -> src_feat_constraint, aip, CONVERT_FEATURE_ACTION_src_feat_constraint)) {
15851          goto erret;
15852       }
15853    }
15854    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
15855       goto erret;
15856    }
15857    retval = TRUE;
15858 
15859 erret:
15860    AsnUnlinkType(orig);       /* unlink local tree */
15861    return retval;
15862 }
15863 
15864 
15865 
15866 /**************************************************
15867 *
15868 *    EditLocationStrandNew()
15869 *
15870 **************************************************/
15871 NLM_EXTERN
15872 EditLocationStrandPtr LIBCALL
EditLocationStrandNew(void)15873 EditLocationStrandNew(void)
15874 {
15875    EditLocationStrandPtr ptr = MemNew((size_t) sizeof(EditLocationStrand));
15876 
15877    return ptr;
15878 
15879 }
15880 
15881 
15882 /**************************************************
15883 *
15884 *    EditLocationStrandFree()
15885 *
15886 **************************************************/
15887 NLM_EXTERN
15888 EditLocationStrandPtr LIBCALL
EditLocationStrandFree(EditLocationStrandPtr ptr)15889 EditLocationStrandFree(EditLocationStrandPtr ptr)
15890 {
15891 
15892    if(ptr == NULL) {
15893       return NULL;
15894    }
15895    return MemFree(ptr);
15896 }
15897 
15898 
15899 /**************************************************
15900 *
15901 *    EditLocationStrandAsnRead()
15902 *
15903 **************************************************/
15904 NLM_EXTERN
15905 EditLocationStrandPtr LIBCALL
EditLocationStrandAsnRead(AsnIoPtr aip,AsnTypePtr orig)15906 EditLocationStrandAsnRead(AsnIoPtr aip, AsnTypePtr orig)
15907 {
15908    DataVal av;
15909    AsnTypePtr atp;
15910    Boolean isError = FALSE;
15911    AsnReadFunc func;
15912    EditLocationStrandPtr ptr;
15913 
15914    if (! loaded)
15915    {
15916       if (! objmacroAsnLoad()) {
15917          return NULL;
15918       }
15919    }
15920 
15921    if (aip == NULL) {
15922       return NULL;
15923    }
15924 
15925    if (orig == NULL) {         /* EditLocationStrand ::= (self contained) */
15926       atp = AsnReadId(aip, amp, EDIT_LOCATION_STRAND);
15927    } else {
15928       atp = AsnLinkType(orig, EDIT_LOCATION_STRAND);
15929    }
15930    /* link in local tree */
15931    if (atp == NULL) {
15932       return NULL;
15933    }
15934 
15935    ptr = EditLocationStrandNew();
15936    if (ptr == NULL) {
15937       goto erret;
15938    }
15939    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
15940       goto erret;
15941    }
15942 
15943    atp = AsnReadId(aip,amp, atp);
15944    func = NULL;
15945 
15946    if (atp == EDIT_LOCATION_STRAND_strand_from) {
15947       if ( AsnReadVal(aip, atp, &av) <= 0) {
15948          goto erret;
15949       }
15950       ptr -> strand_from = av.intvalue;
15951       atp = AsnReadId(aip,amp, atp);
15952    }
15953    if (atp == EDIT_LOCATION_STRAND_strand_to) {
15954       if ( AsnReadVal(aip, atp, &av) <= 0) {
15955          goto erret;
15956       }
15957       ptr -> strand_to = av.intvalue;
15958       atp = AsnReadId(aip,amp, atp);
15959    }
15960 
15961    if (AsnReadVal(aip, atp, &av) <= 0) {
15962       goto erret;
15963    }
15964    /* end struct */
15965 
15966 ret:
15967    AsnUnlinkType(orig);       /* unlink local tree */
15968    return ptr;
15969 
15970 erret:
15971    aip -> io_failure = TRUE;
15972    ptr = EditLocationStrandFree(ptr);
15973    goto ret;
15974 }
15975 
15976 
15977 
15978 /**************************************************
15979 *
15980 *    EditLocationStrandAsnWrite()
15981 *
15982 **************************************************/
15983 NLM_EXTERN Boolean LIBCALL
EditLocationStrandAsnWrite(EditLocationStrandPtr ptr,AsnIoPtr aip,AsnTypePtr orig)15984 EditLocationStrandAsnWrite(EditLocationStrandPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
15985 {
15986    DataVal av;
15987    AsnTypePtr atp;
15988    Boolean retval = FALSE;
15989 
15990    if (! loaded)
15991    {
15992       if (! objmacroAsnLoad()) {
15993          return FALSE;
15994       }
15995    }
15996 
15997    if (aip == NULL) {
15998       return FALSE;
15999    }
16000 
16001    atp = AsnLinkType(orig, EDIT_LOCATION_STRAND);   /* link local tree */
16002    if (atp == NULL) {
16003       return FALSE;
16004    }
16005 
16006    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
16007 
16008     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
16009 
16010    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
16011       goto erret;
16012    }
16013 
16014    av.intvalue = ptr -> strand_from;
16015    retval = AsnWrite(aip, EDIT_LOCATION_STRAND_strand_from,  &av);
16016    av.intvalue = ptr -> strand_to;
16017    retval = AsnWrite(aip, EDIT_LOCATION_STRAND_strand_to,  &av);
16018    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
16019       goto erret;
16020    }
16021    retval = TRUE;
16022 
16023 erret:
16024    AsnUnlinkType(orig);       /* unlink local tree */
16025    return retval;
16026 }
16027 
16028 
16029 
16030 /**************************************************
16031 *
16032 *    Partial5SetActionNew()
16033 *
16034 **************************************************/
16035 NLM_EXTERN
16036 Partial5SetActionPtr LIBCALL
Partial5SetActionNew(void)16037 Partial5SetActionNew(void)
16038 {
16039    Partial5SetActionPtr ptr = MemNew((size_t) sizeof(Partial5SetAction));
16040 
16041    return ptr;
16042 
16043 }
16044 
16045 
16046 /**************************************************
16047 *
16048 *    Partial5SetActionFree()
16049 *
16050 **************************************************/
16051 NLM_EXTERN
16052 Partial5SetActionPtr LIBCALL
Partial5SetActionFree(Partial5SetActionPtr ptr)16053 Partial5SetActionFree(Partial5SetActionPtr ptr)
16054 {
16055 
16056    if(ptr == NULL) {
16057       return NULL;
16058    }
16059    return MemFree(ptr);
16060 }
16061 
16062 
16063 /**************************************************
16064 *
16065 *    Partial5SetActionAsnRead()
16066 *
16067 **************************************************/
16068 NLM_EXTERN
16069 Partial5SetActionPtr LIBCALL
Partial5SetActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)16070 Partial5SetActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
16071 {
16072    DataVal av;
16073    AsnTypePtr atp;
16074    Boolean isError = FALSE;
16075    AsnReadFunc func;
16076    Partial5SetActionPtr ptr;
16077 
16078    if (! loaded)
16079    {
16080       if (! objmacroAsnLoad()) {
16081          return NULL;
16082       }
16083    }
16084 
16085    if (aip == NULL) {
16086       return NULL;
16087    }
16088 
16089    if (orig == NULL) {         /* Partial5SetAction ::= (self contained) */
16090       atp = AsnReadId(aip, amp, PARTIAL_5_SET_ACTION);
16091    } else {
16092       atp = AsnLinkType(orig, PARTIAL_5_SET_ACTION);
16093    }
16094    /* link in local tree */
16095    if (atp == NULL) {
16096       return NULL;
16097    }
16098 
16099    ptr = Partial5SetActionNew();
16100    if (ptr == NULL) {
16101       goto erret;
16102    }
16103    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
16104       goto erret;
16105    }
16106 
16107    atp = AsnReadId(aip,amp, atp);
16108    func = NULL;
16109 
16110    if (atp == PARTIAL_5_SET_ACTION_constraint) {
16111       if ( AsnReadVal(aip, atp, &av) <= 0) {
16112          goto erret;
16113       }
16114       ptr -> constraint = av.intvalue;
16115       atp = AsnReadId(aip,amp, atp);
16116    }
16117    if (atp == PARTIAL_5_SET_ACTION_extend) {
16118       if ( AsnReadVal(aip, atp, &av) <= 0) {
16119          goto erret;
16120       }
16121       ptr -> extend = av.boolvalue;
16122       atp = AsnReadId(aip,amp, atp);
16123    }
16124 
16125    if (AsnReadVal(aip, atp, &av) <= 0) {
16126       goto erret;
16127    }
16128    /* end struct */
16129 
16130 ret:
16131    AsnUnlinkType(orig);       /* unlink local tree */
16132    return ptr;
16133 
16134 erret:
16135    aip -> io_failure = TRUE;
16136    ptr = Partial5SetActionFree(ptr);
16137    goto ret;
16138 }
16139 
16140 
16141 
16142 /**************************************************
16143 *
16144 *    Partial5SetActionAsnWrite()
16145 *
16146 **************************************************/
16147 NLM_EXTERN Boolean LIBCALL
Partial5SetActionAsnWrite(Partial5SetActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)16148 Partial5SetActionAsnWrite(Partial5SetActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
16149 {
16150    DataVal av;
16151    AsnTypePtr atp;
16152    Boolean retval = FALSE;
16153 
16154    if (! loaded)
16155    {
16156       if (! objmacroAsnLoad()) {
16157          return FALSE;
16158       }
16159    }
16160 
16161    if (aip == NULL) {
16162       return FALSE;
16163    }
16164 
16165    atp = AsnLinkType(orig, PARTIAL_5_SET_ACTION);   /* link local tree */
16166    if (atp == NULL) {
16167       return FALSE;
16168    }
16169 
16170    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
16171 
16172     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
16173 
16174    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
16175       goto erret;
16176    }
16177 
16178    av.intvalue = ptr -> constraint;
16179    retval = AsnWrite(aip, PARTIAL_5_SET_ACTION_constraint,  &av);
16180    av.boolvalue = ptr -> extend;
16181    retval = AsnWrite(aip, PARTIAL_5_SET_ACTION_extend,  &av);
16182    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
16183       goto erret;
16184    }
16185    retval = TRUE;
16186 
16187 erret:
16188    AsnUnlinkType(orig);       /* unlink local tree */
16189    return retval;
16190 }
16191 
16192 
16193 
16194 /**************************************************
16195 *
16196 *    Partial3SetActionNew()
16197 *
16198 **************************************************/
16199 NLM_EXTERN
16200 Partial3SetActionPtr LIBCALL
Partial3SetActionNew(void)16201 Partial3SetActionNew(void)
16202 {
16203    Partial3SetActionPtr ptr = MemNew((size_t) sizeof(Partial3SetAction));
16204 
16205    return ptr;
16206 
16207 }
16208 
16209 
16210 /**************************************************
16211 *
16212 *    Partial3SetActionFree()
16213 *
16214 **************************************************/
16215 NLM_EXTERN
16216 Partial3SetActionPtr LIBCALL
Partial3SetActionFree(Partial3SetActionPtr ptr)16217 Partial3SetActionFree(Partial3SetActionPtr ptr)
16218 {
16219 
16220    if(ptr == NULL) {
16221       return NULL;
16222    }
16223    return MemFree(ptr);
16224 }
16225 
16226 
16227 /**************************************************
16228 *
16229 *    Partial3SetActionAsnRead()
16230 *
16231 **************************************************/
16232 NLM_EXTERN
16233 Partial3SetActionPtr LIBCALL
Partial3SetActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)16234 Partial3SetActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
16235 {
16236    DataVal av;
16237    AsnTypePtr atp;
16238    Boolean isError = FALSE;
16239    AsnReadFunc func;
16240    Partial3SetActionPtr ptr;
16241 
16242    if (! loaded)
16243    {
16244       if (! objmacroAsnLoad()) {
16245          return NULL;
16246       }
16247    }
16248 
16249    if (aip == NULL) {
16250       return NULL;
16251    }
16252 
16253    if (orig == NULL) {         /* Partial3SetAction ::= (self contained) */
16254       atp = AsnReadId(aip, amp, PARTIAL_3_SET_ACTION);
16255    } else {
16256       atp = AsnLinkType(orig, PARTIAL_3_SET_ACTION);
16257    }
16258    /* link in local tree */
16259    if (atp == NULL) {
16260       return NULL;
16261    }
16262 
16263    ptr = Partial3SetActionNew();
16264    if (ptr == NULL) {
16265       goto erret;
16266    }
16267    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
16268       goto erret;
16269    }
16270 
16271    atp = AsnReadId(aip,amp, atp);
16272    func = NULL;
16273 
16274    if (atp == PARTIAL_3_SET_ACTION_constraint) {
16275       if ( AsnReadVal(aip, atp, &av) <= 0) {
16276          goto erret;
16277       }
16278       ptr -> constraint = av.intvalue;
16279       atp = AsnReadId(aip,amp, atp);
16280    }
16281    if (atp == PARTIAL_3_SET_ACTION_extend) {
16282       if ( AsnReadVal(aip, atp, &av) <= 0) {
16283          goto erret;
16284       }
16285       ptr -> extend = av.boolvalue;
16286       atp = AsnReadId(aip,amp, atp);
16287    }
16288 
16289    if (AsnReadVal(aip, atp, &av) <= 0) {
16290       goto erret;
16291    }
16292    /* end struct */
16293 
16294 ret:
16295    AsnUnlinkType(orig);       /* unlink local tree */
16296    return ptr;
16297 
16298 erret:
16299    aip -> io_failure = TRUE;
16300    ptr = Partial3SetActionFree(ptr);
16301    goto ret;
16302 }
16303 
16304 
16305 
16306 /**************************************************
16307 *
16308 *    Partial3SetActionAsnWrite()
16309 *
16310 **************************************************/
16311 NLM_EXTERN Boolean LIBCALL
Partial3SetActionAsnWrite(Partial3SetActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)16312 Partial3SetActionAsnWrite(Partial3SetActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
16313 {
16314    DataVal av;
16315    AsnTypePtr atp;
16316    Boolean retval = FALSE;
16317 
16318    if (! loaded)
16319    {
16320       if (! objmacroAsnLoad()) {
16321          return FALSE;
16322       }
16323    }
16324 
16325    if (aip == NULL) {
16326       return FALSE;
16327    }
16328 
16329    atp = AsnLinkType(orig, PARTIAL_3_SET_ACTION);   /* link local tree */
16330    if (atp == NULL) {
16331       return FALSE;
16332    }
16333 
16334    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
16335 
16336     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
16337 
16338    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
16339       goto erret;
16340    }
16341 
16342    av.intvalue = ptr -> constraint;
16343    retval = AsnWrite(aip, PARTIAL_3_SET_ACTION_constraint,  &av);
16344    av.boolvalue = ptr -> extend;
16345    retval = AsnWrite(aip, PARTIAL_3_SET_ACTION_extend,  &av);
16346    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
16347       goto erret;
16348    }
16349    retval = TRUE;
16350 
16351 erret:
16352    AsnUnlinkType(orig);       /* unlink local tree */
16353    return retval;
16354 }
16355 
16356 
16357 
16358 /**************************************************
16359 *
16360 *    PartialBothSetActionNew()
16361 *
16362 **************************************************/
16363 NLM_EXTERN
16364 PartialBothSetActionPtr LIBCALL
PartialBothSetActionNew(void)16365 PartialBothSetActionNew(void)
16366 {
16367    PartialBothSetActionPtr ptr = MemNew((size_t) sizeof(PartialBothSetAction));
16368 
16369    return ptr;
16370 
16371 }
16372 
16373 
16374 /**************************************************
16375 *
16376 *    PartialBothSetActionFree()
16377 *
16378 **************************************************/
16379 NLM_EXTERN
16380 PartialBothSetActionPtr LIBCALL
PartialBothSetActionFree(PartialBothSetActionPtr ptr)16381 PartialBothSetActionFree(PartialBothSetActionPtr ptr)
16382 {
16383 
16384    if(ptr == NULL) {
16385       return NULL;
16386    }
16387    return MemFree(ptr);
16388 }
16389 
16390 
16391 /**************************************************
16392 *
16393 *    PartialBothSetActionAsnRead()
16394 *
16395 **************************************************/
16396 NLM_EXTERN
16397 PartialBothSetActionPtr LIBCALL
PartialBothSetActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)16398 PartialBothSetActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
16399 {
16400    DataVal av;
16401    AsnTypePtr atp;
16402    Boolean isError = FALSE;
16403    AsnReadFunc func;
16404    PartialBothSetActionPtr ptr;
16405 
16406    if (! loaded)
16407    {
16408       if (! objmacroAsnLoad()) {
16409          return NULL;
16410       }
16411    }
16412 
16413    if (aip == NULL) {
16414       return NULL;
16415    }
16416 
16417    if (orig == NULL) {         /* PartialBothSetAction ::= (self contained) */
16418       atp = AsnReadId(aip, amp, PARTIAL_BOTH_SET_ACTION);
16419    } else {
16420       atp = AsnLinkType(orig, PARTIAL_BOTH_SET_ACTION);
16421    }
16422    /* link in local tree */
16423    if (atp == NULL) {
16424       return NULL;
16425    }
16426 
16427    ptr = PartialBothSetActionNew();
16428    if (ptr == NULL) {
16429       goto erret;
16430    }
16431    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
16432       goto erret;
16433    }
16434 
16435    atp = AsnReadId(aip,amp, atp);
16436    func = NULL;
16437 
16438    if (atp == PARTIAL_BOTH_SET_ACTION_constraint) {
16439       if ( AsnReadVal(aip, atp, &av) <= 0) {
16440          goto erret;
16441       }
16442       ptr -> constraint = av.intvalue;
16443       atp = AsnReadId(aip,amp, atp);
16444    }
16445    if (atp == PARTIAL_BOTH_SET_ACTION_extend) {
16446       if ( AsnReadVal(aip, atp, &av) <= 0) {
16447          goto erret;
16448       }
16449       ptr -> extend = av.boolvalue;
16450       atp = AsnReadId(aip,amp, atp);
16451    }
16452 
16453    if (AsnReadVal(aip, atp, &av) <= 0) {
16454       goto erret;
16455    }
16456    /* end struct */
16457 
16458 ret:
16459    AsnUnlinkType(orig);       /* unlink local tree */
16460    return ptr;
16461 
16462 erret:
16463    aip -> io_failure = TRUE;
16464    ptr = PartialBothSetActionFree(ptr);
16465    goto ret;
16466 }
16467 
16468 
16469 
16470 /**************************************************
16471 *
16472 *    PartialBothSetActionAsnWrite()
16473 *
16474 **************************************************/
16475 NLM_EXTERN Boolean LIBCALL
PartialBothSetActionAsnWrite(PartialBothSetActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)16476 PartialBothSetActionAsnWrite(PartialBothSetActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
16477 {
16478    DataVal av;
16479    AsnTypePtr atp;
16480    Boolean retval = FALSE;
16481 
16482    if (! loaded)
16483    {
16484       if (! objmacroAsnLoad()) {
16485          return FALSE;
16486       }
16487    }
16488 
16489    if (aip == NULL) {
16490       return FALSE;
16491    }
16492 
16493    atp = AsnLinkType(orig, PARTIAL_BOTH_SET_ACTION);   /* link local tree */
16494    if (atp == NULL) {
16495       return FALSE;
16496    }
16497 
16498    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
16499 
16500     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
16501 
16502    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
16503       goto erret;
16504    }
16505 
16506    av.intvalue = ptr -> constraint;
16507    retval = AsnWrite(aip, PARTIAL_BOTH_SET_ACTION_constraint,  &av);
16508    av.boolvalue = ptr -> extend;
16509    retval = AsnWrite(aip, PARTIAL_BOTH_SET_ACTION_extend,  &av);
16510    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
16511       goto erret;
16512    }
16513    retval = TRUE;
16514 
16515 erret:
16516    AsnUnlinkType(orig);       /* unlink local tree */
16517    return retval;
16518 }
16519 
16520 
16521 
16522 /**************************************************
16523 *
16524 *    ExtendToFeatureNew()
16525 *
16526 **************************************************/
16527 NLM_EXTERN
16528 ExtendToFeaturePtr LIBCALL
ExtendToFeatureNew(void)16529 ExtendToFeatureNew(void)
16530 {
16531    ExtendToFeaturePtr ptr = MemNew((size_t) sizeof(ExtendToFeature));
16532 
16533    return ptr;
16534 
16535 }
16536 
16537 
16538 /**************************************************
16539 *
16540 *    ExtendToFeatureFree()
16541 *
16542 **************************************************/
16543 NLM_EXTERN
16544 ExtendToFeaturePtr LIBCALL
ExtendToFeatureFree(ExtendToFeaturePtr ptr)16545 ExtendToFeatureFree(ExtendToFeaturePtr ptr)
16546 {
16547 
16548    if(ptr == NULL) {
16549       return NULL;
16550    }
16551    QuantityConstraintFree(ptr -> distance);
16552    return MemFree(ptr);
16553 }
16554 
16555 
16556 /**************************************************
16557 *
16558 *    ExtendToFeatureAsnRead()
16559 *
16560 **************************************************/
16561 NLM_EXTERN
16562 ExtendToFeaturePtr LIBCALL
ExtendToFeatureAsnRead(AsnIoPtr aip,AsnTypePtr orig)16563 ExtendToFeatureAsnRead(AsnIoPtr aip, AsnTypePtr orig)
16564 {
16565    DataVal av;
16566    AsnTypePtr atp;
16567    Boolean isError = FALSE;
16568    AsnReadFunc func;
16569    ExtendToFeaturePtr ptr;
16570 
16571    if (! loaded)
16572    {
16573       if (! objmacroAsnLoad()) {
16574          return NULL;
16575       }
16576    }
16577 
16578    if (aip == NULL) {
16579       return NULL;
16580    }
16581 
16582    if (orig == NULL) {         /* ExtendToFeature ::= (self contained) */
16583       atp = AsnReadId(aip, amp, EXTEND_TO_FEATURE);
16584    } else {
16585       atp = AsnLinkType(orig, EXTEND_TO_FEATURE);
16586    }
16587    /* link in local tree */
16588    if (atp == NULL) {
16589       return NULL;
16590    }
16591 
16592    ptr = ExtendToFeatureNew();
16593    if (ptr == NULL) {
16594       goto erret;
16595    }
16596    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
16597       goto erret;
16598    }
16599 
16600    atp = AsnReadId(aip,amp, atp);
16601    func = NULL;
16602 
16603    if (atp == EXTEND_TO_FEATURE_type) {
16604       if ( AsnReadVal(aip, atp, &av) <= 0) {
16605          goto erret;
16606       }
16607       ptr -> type = av.intvalue;
16608       atp = AsnReadId(aip,amp, atp);
16609    }
16610    if (atp == EXTEND_TO_FEATURE_include_feat) {
16611       if ( AsnReadVal(aip, atp, &av) <= 0) {
16612          goto erret;
16613       }
16614       ptr -> include_feat = av.boolvalue;
16615       atp = AsnReadId(aip,amp, atp);
16616    }
16617    if (atp == EXTEND_TO_FEATURE_distance) {
16618       ptr -> distance = QuantityConstraintAsnRead(aip, atp);
16619       if (aip -> io_failure) {
16620          goto erret;
16621       }
16622       atp = AsnReadId(aip,amp, atp);
16623    }
16624 
16625    if (AsnReadVal(aip, atp, &av) <= 0) {
16626       goto erret;
16627    }
16628    /* end struct */
16629 
16630 ret:
16631    AsnUnlinkType(orig);       /* unlink local tree */
16632    return ptr;
16633 
16634 erret:
16635    aip -> io_failure = TRUE;
16636    ptr = ExtendToFeatureFree(ptr);
16637    goto ret;
16638 }
16639 
16640 
16641 
16642 /**************************************************
16643 *
16644 *    ExtendToFeatureAsnWrite()
16645 *
16646 **************************************************/
16647 NLM_EXTERN Boolean LIBCALL
ExtendToFeatureAsnWrite(ExtendToFeaturePtr ptr,AsnIoPtr aip,AsnTypePtr orig)16648 ExtendToFeatureAsnWrite(ExtendToFeaturePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
16649 {
16650    DataVal av;
16651    AsnTypePtr atp;
16652    Boolean retval = FALSE;
16653 
16654    if (! loaded)
16655    {
16656       if (! objmacroAsnLoad()) {
16657          return FALSE;
16658       }
16659    }
16660 
16661    if (aip == NULL) {
16662       return FALSE;
16663    }
16664 
16665    atp = AsnLinkType(orig, EXTEND_TO_FEATURE);   /* link local tree */
16666    if (atp == NULL) {
16667       return FALSE;
16668    }
16669 
16670    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
16671 
16672     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
16673 
16674    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
16675       goto erret;
16676    }
16677 
16678    av.intvalue = ptr -> type;
16679    retval = AsnWrite(aip, EXTEND_TO_FEATURE_type,  &av);
16680    av.boolvalue = ptr -> include_feat;
16681    retval = AsnWrite(aip, EXTEND_TO_FEATURE_include_feat,  &av);
16682    if (ptr -> distance != NULL) {
16683       if ( ! QuantityConstraintAsnWrite(ptr -> distance, aip, EXTEND_TO_FEATURE_distance)) {
16684          goto erret;
16685       }
16686    }
16687    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
16688       goto erret;
16689    }
16690    retval = TRUE;
16691 
16692 erret:
16693    AsnUnlinkType(orig);       /* unlink local tree */
16694    return retval;
16695 }
16696 
16697 
16698 
16699 /**************************************************
16700 *
16701 *    LocationEditTypeFree()
16702 *
16703 **************************************************/
16704 NLM_EXTERN
16705 LocationEditTypePtr LIBCALL
LocationEditTypeFree(ValNodePtr anp)16706 LocationEditTypeFree(ValNodePtr anp)
16707 {
16708    Pointer pnt;
16709 
16710    if (anp == NULL) {
16711       return NULL;
16712    }
16713 
16714    pnt = anp->data.ptrvalue;
16715    switch (anp->choice)
16716    {
16717    default:
16718       break;
16719    case LocationEditType_strand:
16720       EditLocationStrandFree(anp -> data.ptrvalue);
16721       break;
16722    case LocationEditType_set_5_partial:
16723       Partial5SetActionFree(anp -> data.ptrvalue);
16724       break;
16725    case LocationEditType_set_3_partial:
16726       Partial3SetActionFree(anp -> data.ptrvalue);
16727       break;
16728    case LocationEditType_set_both_partial:
16729       PartialBothSetActionFree(anp -> data.ptrvalue);
16730       break;
16731    case LocationEditType_extend_5_to_feat:
16732       ExtendToFeatureFree(anp -> data.ptrvalue);
16733       break;
16734    case LocationEditType_extend_3_to_feat:
16735       ExtendToFeatureFree(anp -> data.ptrvalue);
16736       break;
16737    }
16738    return MemFree(anp);
16739 }
16740 
16741 
16742 /**************************************************
16743 *
16744 *    LocationEditTypeAsnRead()
16745 *
16746 **************************************************/
16747 NLM_EXTERN
16748 LocationEditTypePtr LIBCALL
LocationEditTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)16749 LocationEditTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
16750 {
16751    DataVal av;
16752    AsnTypePtr atp;
16753    ValNodePtr anp;
16754    Uint1 choice;
16755    Boolean isError = FALSE;
16756    Boolean nullIsError = FALSE;
16757    AsnReadFunc func;
16758 
16759    if (! loaded)
16760    {
16761       if (! objmacroAsnLoad()) {
16762          return NULL;
16763       }
16764    }
16765 
16766    if (aip == NULL) {
16767       return NULL;
16768    }
16769 
16770    if (orig == NULL) {         /* LocationEditType ::= (self contained) */
16771       atp = AsnReadId(aip, amp, LOCATION_EDIT_TYPE);
16772    } else {
16773       atp = AsnLinkType(orig, LOCATION_EDIT_TYPE);    /* link in local tree */
16774    }
16775    if (atp == NULL) {
16776       return NULL;
16777    }
16778 
16779    anp = ValNodeNew(NULL);
16780    if (anp == NULL) {
16781       goto erret;
16782    }
16783    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
16784       goto erret;
16785    }
16786 
16787    func = NULL;
16788 
16789    atp = AsnReadId(aip, amp, atp);  /* find the choice */
16790    if (atp == NULL) {
16791       goto erret;
16792    }
16793    if (atp == LOCATION_EDIT_TYPE_strand) {
16794       choice = LocationEditType_strand;
16795       func = (AsnReadFunc) EditLocationStrandAsnRead;
16796    }
16797    else if (atp == LOCATION_EDIT_TYPE_set_5_partial) {
16798       choice = LocationEditType_set_5_partial;
16799       func = (AsnReadFunc) Partial5SetActionAsnRead;
16800    }
16801    else if (atp == LOCATION_EDIT_TYPE_clear_5_partial) {
16802       choice = LocationEditType_clear_5_partial;
16803       if (AsnReadVal(aip, atp, &av) <= 0) {
16804          goto erret;
16805       }
16806       anp->data.intvalue = av.intvalue;
16807    }
16808    else if (atp == LOCATION_EDIT_TYPE_set_3_partial) {
16809       choice = LocationEditType_set_3_partial;
16810       func = (AsnReadFunc) Partial3SetActionAsnRead;
16811    }
16812    else if (atp == LOCATION_EDIT_TYPE_clear_3_partial) {
16813       choice = LocationEditType_clear_3_partial;
16814       if (AsnReadVal(aip, atp, &av) <= 0) {
16815          goto erret;
16816       }
16817       anp->data.intvalue = av.intvalue;
16818    }
16819    else if (atp == LOCATION_EDIT_TYPE_set_both_partial) {
16820       choice = LocationEditType_set_both_partial;
16821       func = (AsnReadFunc) PartialBothSetActionAsnRead;
16822    }
16823    else if (atp == LOCATION_EDIT_TYPE_clear_both_partial) {
16824       choice = LocationEditType_clear_both_partial;
16825       if (AsnReadVal(aip, atp, &av) <= 0) {
16826          goto erret;
16827       }
16828       anp->data.intvalue = av.intvalue;
16829    }
16830    else if (atp == LOCATION_EDIT_TYPE_convert) {
16831       choice = LocationEditType_convert;
16832       if (AsnReadVal(aip, atp, &av) <= 0) {
16833          goto erret;
16834       }
16835       anp->data.intvalue = av.intvalue;
16836    }
16837    else if (atp == LOCATION_EDIT_TYPE_extend_5) {
16838       choice = LocationEditType_extend_5;
16839       if (AsnReadVal(aip, atp, &av) <= 0) {
16840          goto erret;
16841       }
16842       anp->data.boolvalue = av.boolvalue;
16843    }
16844    else if (atp == LOCATION_EDIT_TYPE_extend_3) {
16845       choice = LocationEditType_extend_3;
16846       if (AsnReadVal(aip, atp, &av) <= 0) {
16847          goto erret;
16848       }
16849       anp->data.boolvalue = av.boolvalue;
16850    }
16851    else if (atp == LOCATION_EDIT_TYPE_extend_5_to_feat) {
16852       choice = LocationEditType_extend_5_to_feat;
16853       func = (AsnReadFunc) ExtendToFeatureAsnRead;
16854    }
16855    else if (atp == LOCATION_EDIT_TYPE_extend_3_to_feat) {
16856       choice = LocationEditType_extend_3_to_feat;
16857       func = (AsnReadFunc) ExtendToFeatureAsnRead;
16858    }
16859    anp->choice = choice;
16860    if (func != NULL)
16861    {
16862       anp->data.ptrvalue = (* func)(aip, atp);
16863       if (aip -> io_failure) goto erret;
16864 
16865       if (nullIsError && anp->data.ptrvalue == NULL) {
16866          goto erret;
16867       }
16868    }
16869 
16870 ret:
16871    AsnUnlinkType(orig);       /* unlink local tree */
16872    return anp;
16873 
16874 erret:
16875    anp = MemFree(anp);
16876    aip -> io_failure = TRUE;
16877    goto ret;
16878 }
16879 
16880 
16881 /**************************************************
16882 *
16883 *    LocationEditTypeAsnWrite()
16884 *
16885 **************************************************/
16886 NLM_EXTERN Boolean LIBCALL
LocationEditTypeAsnWrite(LocationEditTypePtr anp,AsnIoPtr aip,AsnTypePtr orig)16887 LocationEditTypeAsnWrite(LocationEditTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
16888 
16889 {
16890    DataVal av;
16891    AsnTypePtr atp, writetype = NULL;
16892    Pointer pnt;
16893    AsnWriteFunc func = NULL;
16894    Boolean retval = FALSE;
16895 
16896    if (! loaded)
16897    {
16898       if (! objmacroAsnLoad())
16899       return FALSE;
16900    }
16901 
16902    if (aip == NULL)
16903    return FALSE;
16904 
16905    atp = AsnLinkType(orig, LOCATION_EDIT_TYPE);   /* link local tree */
16906    if (atp == NULL) {
16907       return FALSE;
16908    }
16909 
16910    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
16911 
16912     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
16913 
16914    av.ptrvalue = (Pointer)anp;
16915    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
16916       goto erret;
16917    }
16918 
16919    pnt = anp->data.ptrvalue;
16920    switch (anp->choice)
16921    {
16922    case LocationEditType_strand:
16923       writetype = LOCATION_EDIT_TYPE_strand;
16924       func = (AsnWriteFunc) EditLocationStrandAsnWrite;
16925       break;
16926    case LocationEditType_set_5_partial:
16927       writetype = LOCATION_EDIT_TYPE_set_5_partial;
16928       func = (AsnWriteFunc) Partial5SetActionAsnWrite;
16929       break;
16930    case LocationEditType_clear_5_partial:
16931       av.intvalue = anp->data.intvalue;
16932       retval = AsnWrite(aip, LOCATION_EDIT_TYPE_clear_5_partial, &av);
16933       break;
16934    case LocationEditType_set_3_partial:
16935       writetype = LOCATION_EDIT_TYPE_set_3_partial;
16936       func = (AsnWriteFunc) Partial3SetActionAsnWrite;
16937       break;
16938    case LocationEditType_clear_3_partial:
16939       av.intvalue = anp->data.intvalue;
16940       retval = AsnWrite(aip, LOCATION_EDIT_TYPE_clear_3_partial, &av);
16941       break;
16942    case LocationEditType_set_both_partial:
16943       writetype = LOCATION_EDIT_TYPE_set_both_partial;
16944       func = (AsnWriteFunc) PartialBothSetActionAsnWrite;
16945       break;
16946    case LocationEditType_clear_both_partial:
16947       av.intvalue = anp->data.intvalue;
16948       retval = AsnWrite(aip, LOCATION_EDIT_TYPE_clear_both_partial, &av);
16949       break;
16950    case LocationEditType_convert:
16951       av.intvalue = anp->data.intvalue;
16952       retval = AsnWrite(aip, LOCATION_EDIT_TYPE_convert, &av);
16953       break;
16954    case LocationEditType_extend_5:
16955       av.boolvalue = anp->data.boolvalue;
16956       retval = AsnWrite(aip, LOCATION_EDIT_TYPE_extend_5, &av);
16957       break;
16958    case LocationEditType_extend_3:
16959       av.boolvalue = anp->data.boolvalue;
16960       retval = AsnWrite(aip, LOCATION_EDIT_TYPE_extend_3, &av);
16961       break;
16962    case LocationEditType_extend_5_to_feat:
16963       writetype = LOCATION_EDIT_TYPE_extend_5_to_feat;
16964       func = (AsnWriteFunc) ExtendToFeatureAsnWrite;
16965       break;
16966    case LocationEditType_extend_3_to_feat:
16967       writetype = LOCATION_EDIT_TYPE_extend_3_to_feat;
16968       func = (AsnWriteFunc) ExtendToFeatureAsnWrite;
16969       break;
16970    }
16971    if (writetype != NULL) {
16972       retval = (* func)(pnt, aip, writetype);   /* write it out */
16973    }
16974    if (!retval) {
16975       goto erret;
16976    }
16977    retval = TRUE;
16978 
16979 erret:
16980    AsnUnlinkType(orig);       /* unlink local tree */
16981    return retval;
16982 }
16983 
16984 
16985 /**************************************************
16986 *
16987 *    EditFeatureLocationActionNew()
16988 *
16989 **************************************************/
16990 NLM_EXTERN
16991 EditFeatureLocationActionPtr LIBCALL
EditFeatureLocationActionNew(void)16992 EditFeatureLocationActionNew(void)
16993 {
16994    EditFeatureLocationActionPtr ptr = MemNew((size_t) sizeof(EditFeatureLocationAction));
16995 
16996    return ptr;
16997 
16998 }
16999 
17000 
17001 /**************************************************
17002 *
17003 *    EditFeatureLocationActionFree()
17004 *
17005 **************************************************/
17006 NLM_EXTERN
17007 EditFeatureLocationActionPtr LIBCALL
EditFeatureLocationActionFree(EditFeatureLocationActionPtr ptr)17008 EditFeatureLocationActionFree(EditFeatureLocationActionPtr ptr)
17009 {
17010 
17011    if(ptr == NULL) {
17012       return NULL;
17013    }
17014    LocationEditTypeFree(ptr -> action);
17015    ConstraintChoiceSetFree(ptr -> constraint);
17016    return MemFree(ptr);
17017 }
17018 
17019 
17020 /**************************************************
17021 *
17022 *    EditFeatureLocationActionAsnRead()
17023 *
17024 **************************************************/
17025 NLM_EXTERN
17026 EditFeatureLocationActionPtr LIBCALL
EditFeatureLocationActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)17027 EditFeatureLocationActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
17028 {
17029    DataVal av;
17030    AsnTypePtr atp;
17031    Boolean isError = FALSE;
17032    AsnReadFunc func;
17033    EditFeatureLocationActionPtr ptr;
17034 
17035    if (! loaded)
17036    {
17037       if (! objmacroAsnLoad()) {
17038          return NULL;
17039       }
17040    }
17041 
17042    if (aip == NULL) {
17043       return NULL;
17044    }
17045 
17046    if (orig == NULL) {         /* EditFeatureLocationAction ::= (self contained) */
17047       atp = AsnReadId(aip, amp, EDIT_FEATURE_LOCATION_ACTION);
17048    } else {
17049       atp = AsnLinkType(orig, EDIT_FEATURE_LOCATION_ACTION);
17050    }
17051    /* link in local tree */
17052    if (atp == NULL) {
17053       return NULL;
17054    }
17055 
17056    ptr = EditFeatureLocationActionNew();
17057    if (ptr == NULL) {
17058       goto erret;
17059    }
17060    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
17061       goto erret;
17062    }
17063 
17064    atp = AsnReadId(aip,amp, atp);
17065    func = NULL;
17066 
17067    if (atp == EDIT_FEATURE_LOCATION_ACTION_type) {
17068       if ( AsnReadVal(aip, atp, &av) <= 0) {
17069          goto erret;
17070       }
17071       ptr -> type = av.intvalue;
17072       atp = AsnReadId(aip,amp, atp);
17073    }
17074    if (atp == EDIT_FEATURE_LOCATION_ACTION_action) {
17075       ptr -> action = LocationEditTypeAsnRead(aip, atp);
17076       if (aip -> io_failure) {
17077          goto erret;
17078       }
17079       atp = AsnReadId(aip,amp, atp);
17080    }
17081    if (atp == EDIT_FEATURE_LOCATION_ACTION_retranslate_cds) {
17082       if ( AsnReadVal(aip, atp, &av) <= 0) {
17083          goto erret;
17084       }
17085       ptr -> retranslate_cds = av.boolvalue;
17086       atp = AsnReadId(aip,amp, atp);
17087    }
17088    if (atp == EDIT_FEATURE_LOCATION_ACTION_also_edit_gene) {
17089       if ( AsnReadVal(aip, atp, &av) <= 0) {
17090          goto erret;
17091       }
17092       ptr -> also_edit_gene = av.boolvalue;
17093       atp = AsnReadId(aip,amp, atp);
17094    }
17095    if (atp == EDIT_FEATURE_LOCATION_ACTION_constraint) {
17096       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
17097       if (aip -> io_failure) {
17098          goto erret;
17099       }
17100       atp = AsnReadId(aip,amp, atp);
17101    }
17102 
17103    if (AsnReadVal(aip, atp, &av) <= 0) {
17104       goto erret;
17105    }
17106    /* end struct */
17107 
17108 ret:
17109    AsnUnlinkType(orig);       /* unlink local tree */
17110    return ptr;
17111 
17112 erret:
17113    aip -> io_failure = TRUE;
17114    ptr = EditFeatureLocationActionFree(ptr);
17115    goto ret;
17116 }
17117 
17118 
17119 
17120 /**************************************************
17121 *
17122 *    EditFeatureLocationActionAsnWrite()
17123 *
17124 **************************************************/
17125 NLM_EXTERN Boolean LIBCALL
EditFeatureLocationActionAsnWrite(EditFeatureLocationActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)17126 EditFeatureLocationActionAsnWrite(EditFeatureLocationActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
17127 {
17128    DataVal av;
17129    AsnTypePtr atp;
17130    Boolean retval = FALSE;
17131 
17132    if (! loaded)
17133    {
17134       if (! objmacroAsnLoad()) {
17135          return FALSE;
17136       }
17137    }
17138 
17139    if (aip == NULL) {
17140       return FALSE;
17141    }
17142 
17143    atp = AsnLinkType(orig, EDIT_FEATURE_LOCATION_ACTION);   /* link local tree */
17144    if (atp == NULL) {
17145       return FALSE;
17146    }
17147 
17148    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
17149 
17150     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
17151 
17152    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
17153       goto erret;
17154    }
17155 
17156    av.intvalue = ptr -> type;
17157    retval = AsnWrite(aip, EDIT_FEATURE_LOCATION_ACTION_type,  &av);
17158    if (ptr -> action != NULL) {
17159       if ( ! LocationEditTypeAsnWrite(ptr -> action, aip, EDIT_FEATURE_LOCATION_ACTION_action)) {
17160          goto erret;
17161       }
17162    }
17163    av.boolvalue = ptr -> retranslate_cds;
17164    retval = AsnWrite(aip, EDIT_FEATURE_LOCATION_ACTION_retranslate_cds,  &av);
17165    av.boolvalue = ptr -> also_edit_gene;
17166    retval = AsnWrite(aip, EDIT_FEATURE_LOCATION_ACTION_also_edit_gene,  &av);
17167    if (ptr -> constraint != NULL) {
17168       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, EDIT_FEATURE_LOCATION_ACTION_constraint)) {
17169          goto erret;
17170       }
17171    }
17172    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
17173       goto erret;
17174    }
17175    retval = TRUE;
17176 
17177 erret:
17178    AsnUnlinkType(orig);       /* unlink local tree */
17179    return retval;
17180 }
17181 
17182 
17183 
17184 /**************************************************
17185 *
17186 *    MolinfoBlockNew()
17187 *
17188 **************************************************/
17189 NLM_EXTERN
17190 MolinfoBlockPtr LIBCALL
MolinfoBlockNew(void)17191 MolinfoBlockNew(void)
17192 {
17193    MolinfoBlockPtr ptr = MemNew((size_t) sizeof(MolinfoBlock));
17194 
17195    return ptr;
17196 
17197 }
17198 
17199 
17200 /**************************************************
17201 *
17202 *    MolinfoBlockFree()
17203 *
17204 **************************************************/
17205 NLM_EXTERN
17206 MolinfoBlockPtr LIBCALL
MolinfoBlockFree(MolinfoBlockPtr ptr)17207 MolinfoBlockFree(MolinfoBlockPtr ptr)
17208 {
17209 
17210    if(ptr == NULL) {
17211       return NULL;
17212    }
17213    MolinfoFieldListFree(ptr -> to_list);
17214    MolinfoFieldListFree(ptr -> from_list);
17215    ConstraintChoiceSetFree(ptr -> constraint);
17216    return MemFree(ptr);
17217 }
17218 
17219 
17220 /**************************************************
17221 *
17222 *    MolinfoBlockAsnRead()
17223 *
17224 **************************************************/
17225 NLM_EXTERN
17226 MolinfoBlockPtr LIBCALL
MolinfoBlockAsnRead(AsnIoPtr aip,AsnTypePtr orig)17227 MolinfoBlockAsnRead(AsnIoPtr aip, AsnTypePtr orig)
17228 {
17229    DataVal av;
17230    AsnTypePtr atp;
17231    Boolean isError = FALSE;
17232    AsnReadFunc func;
17233    MolinfoBlockPtr ptr;
17234 
17235    if (! loaded)
17236    {
17237       if (! objmacroAsnLoad()) {
17238          return NULL;
17239       }
17240    }
17241 
17242    if (aip == NULL) {
17243       return NULL;
17244    }
17245 
17246    if (orig == NULL) {         /* MolinfoBlock ::= (self contained) */
17247       atp = AsnReadId(aip, amp, MOLINFO_BLOCK);
17248    } else {
17249       atp = AsnLinkType(orig, MOLINFO_BLOCK);
17250    }
17251    /* link in local tree */
17252    if (atp == NULL) {
17253       return NULL;
17254    }
17255 
17256    ptr = MolinfoBlockNew();
17257    if (ptr == NULL) {
17258       goto erret;
17259    }
17260    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
17261       goto erret;
17262    }
17263 
17264    atp = AsnReadId(aip,amp, atp);
17265    func = NULL;
17266 
17267    if (atp == MOLINFO_BLOCK_to_list) {
17268       ptr -> to_list = MolinfoFieldListAsnRead(aip, atp);
17269       if (aip -> io_failure) {
17270          goto erret;
17271       }
17272       atp = AsnReadId(aip,amp, atp);
17273    }
17274    if (atp == MOLINFO_BLOCK_from_list) {
17275       ptr -> from_list = MolinfoFieldListAsnRead(aip, atp);
17276       if (aip -> io_failure) {
17277          goto erret;
17278       }
17279       atp = AsnReadId(aip,amp, atp);
17280    }
17281    if (atp == MOLINFO_BLOCK_constraint) {
17282       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
17283       if (aip -> io_failure) {
17284          goto erret;
17285       }
17286       atp = AsnReadId(aip,amp, atp);
17287    }
17288 
17289    if (AsnReadVal(aip, atp, &av) <= 0) {
17290       goto erret;
17291    }
17292    /* end struct */
17293 
17294 ret:
17295    AsnUnlinkType(orig);       /* unlink local tree */
17296    return ptr;
17297 
17298 erret:
17299    aip -> io_failure = TRUE;
17300    ptr = MolinfoBlockFree(ptr);
17301    goto ret;
17302 }
17303 
17304 
17305 
17306 /**************************************************
17307 *
17308 *    MolinfoBlockAsnWrite()
17309 *
17310 **************************************************/
17311 NLM_EXTERN Boolean LIBCALL
MolinfoBlockAsnWrite(MolinfoBlockPtr ptr,AsnIoPtr aip,AsnTypePtr orig)17312 MolinfoBlockAsnWrite(MolinfoBlockPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
17313 {
17314    DataVal av;
17315    AsnTypePtr atp;
17316    Boolean retval = FALSE;
17317 
17318    if (! loaded)
17319    {
17320       if (! objmacroAsnLoad()) {
17321          return FALSE;
17322       }
17323    }
17324 
17325    if (aip == NULL) {
17326       return FALSE;
17327    }
17328 
17329    atp = AsnLinkType(orig, MOLINFO_BLOCK);   /* link local tree */
17330    if (atp == NULL) {
17331       return FALSE;
17332    }
17333 
17334    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
17335 
17336     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
17337 
17338    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
17339       goto erret;
17340    }
17341 
17342    if (ptr -> to_list != NULL) {
17343       if ( ! MolinfoFieldListAsnWrite(ptr -> to_list, aip, MOLINFO_BLOCK_to_list)) {
17344          goto erret;
17345       }
17346    }
17347    if (ptr -> from_list != NULL) {
17348       if ( ! MolinfoFieldListAsnWrite(ptr -> from_list, aip, MOLINFO_BLOCK_from_list)) {
17349          goto erret;
17350       }
17351    }
17352    if (ptr -> constraint != NULL) {
17353       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, MOLINFO_BLOCK_constraint)) {
17354          goto erret;
17355       }
17356    }
17357    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
17358       goto erret;
17359    }
17360    retval = TRUE;
17361 
17362 erret:
17363    AsnUnlinkType(orig);       /* unlink local tree */
17364    return retval;
17365 }
17366 
17367 
17368 
17369 /**************************************************
17370 *
17371 *    RemoveDescriptorActionNew()
17372 *
17373 **************************************************/
17374 NLM_EXTERN
17375 RemoveDescriptorActionPtr LIBCALL
RemoveDescriptorActionNew(void)17376 RemoveDescriptorActionNew(void)
17377 {
17378    RemoveDescriptorActionPtr ptr = MemNew((size_t) sizeof(RemoveDescriptorAction));
17379 
17380    return ptr;
17381 
17382 }
17383 
17384 
17385 /**************************************************
17386 *
17387 *    RemoveDescriptorActionFree()
17388 *
17389 **************************************************/
17390 NLM_EXTERN
17391 RemoveDescriptorActionPtr LIBCALL
RemoveDescriptorActionFree(RemoveDescriptorActionPtr ptr)17392 RemoveDescriptorActionFree(RemoveDescriptorActionPtr ptr)
17393 {
17394 
17395    if(ptr == NULL) {
17396       return NULL;
17397    }
17398    ConstraintChoiceSetFree(ptr -> constraint);
17399    return MemFree(ptr);
17400 }
17401 
17402 
17403 /**************************************************
17404 *
17405 *    RemoveDescriptorActionAsnRead()
17406 *
17407 **************************************************/
17408 NLM_EXTERN
17409 RemoveDescriptorActionPtr LIBCALL
RemoveDescriptorActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)17410 RemoveDescriptorActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
17411 {
17412    DataVal av;
17413    AsnTypePtr atp;
17414    Boolean isError = FALSE;
17415    AsnReadFunc func;
17416    RemoveDescriptorActionPtr ptr;
17417 
17418    if (! loaded)
17419    {
17420       if (! objmacroAsnLoad()) {
17421          return NULL;
17422       }
17423    }
17424 
17425    if (aip == NULL) {
17426       return NULL;
17427    }
17428 
17429    if (orig == NULL) {         /* RemoveDescriptorAction ::= (self contained) */
17430       atp = AsnReadId(aip, amp, REMOVE_DESCRIPTOR_ACTION);
17431    } else {
17432       atp = AsnLinkType(orig, REMOVE_DESCRIPTOR_ACTION);
17433    }
17434    /* link in local tree */
17435    if (atp == NULL) {
17436       return NULL;
17437    }
17438 
17439    ptr = RemoveDescriptorActionNew();
17440    if (ptr == NULL) {
17441       goto erret;
17442    }
17443    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
17444       goto erret;
17445    }
17446 
17447    atp = AsnReadId(aip,amp, atp);
17448    func = NULL;
17449 
17450    if (atp == REMOVE_DESCRIPTOR_ACTION_type) {
17451       if ( AsnReadVal(aip, atp, &av) <= 0) {
17452          goto erret;
17453       }
17454       ptr -> type = av.intvalue;
17455       atp = AsnReadId(aip,amp, atp);
17456    }
17457    if (atp == REMOVE_DESCRIPTOR_ACTION_constraint) {
17458       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
17459       if (aip -> io_failure) {
17460          goto erret;
17461       }
17462       atp = AsnReadId(aip,amp, atp);
17463    }
17464 
17465    if (AsnReadVal(aip, atp, &av) <= 0) {
17466       goto erret;
17467    }
17468    /* end struct */
17469 
17470 ret:
17471    AsnUnlinkType(orig);       /* unlink local tree */
17472    return ptr;
17473 
17474 erret:
17475    aip -> io_failure = TRUE;
17476    ptr = RemoveDescriptorActionFree(ptr);
17477    goto ret;
17478 }
17479 
17480 
17481 
17482 /**************************************************
17483 *
17484 *    RemoveDescriptorActionAsnWrite()
17485 *
17486 **************************************************/
17487 NLM_EXTERN Boolean LIBCALL
RemoveDescriptorActionAsnWrite(RemoveDescriptorActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)17488 RemoveDescriptorActionAsnWrite(RemoveDescriptorActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
17489 {
17490    DataVal av;
17491    AsnTypePtr atp;
17492    Boolean retval = FALSE;
17493 
17494    if (! loaded)
17495    {
17496       if (! objmacroAsnLoad()) {
17497          return FALSE;
17498       }
17499    }
17500 
17501    if (aip == NULL) {
17502       return FALSE;
17503    }
17504 
17505    atp = AsnLinkType(orig, REMOVE_DESCRIPTOR_ACTION);   /* link local tree */
17506    if (atp == NULL) {
17507       return FALSE;
17508    }
17509 
17510    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
17511 
17512     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
17513 
17514    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
17515       goto erret;
17516    }
17517 
17518    av.intvalue = ptr -> type;
17519    retval = AsnWrite(aip, REMOVE_DESCRIPTOR_ACTION_type,  &av);
17520    if (ptr -> constraint != NULL) {
17521       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, REMOVE_DESCRIPTOR_ACTION_constraint)) {
17522          goto erret;
17523       }
17524    }
17525    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
17526       goto erret;
17527    }
17528    retval = TRUE;
17529 
17530 erret:
17531    AsnUnlinkType(orig);       /* unlink local tree */
17532    return retval;
17533 }
17534 
17535 
17536 
17537 /**************************************************
17538 *
17539 *    AutodefActionNew()
17540 *
17541 **************************************************/
17542 NLM_EXTERN
17543 AutodefActionPtr LIBCALL
AutodefActionNew(void)17544 AutodefActionNew(void)
17545 {
17546    AutodefActionPtr ptr = MemNew((size_t) sizeof(AutodefAction));
17547 
17548    ptr -> misc_feat_parse_rule = 2;
17549    return ptr;
17550 
17551 }
17552 
17553 
17554 /**************************************************
17555 *
17556 *    AutodefActionFree()
17557 *
17558 **************************************************/
17559 NLM_EXTERN
17560 AutodefActionPtr LIBCALL
AutodefActionFree(AutodefActionPtr ptr)17561 AutodefActionFree(AutodefActionPtr ptr)
17562 {
17563 
17564    if(ptr == NULL) {
17565       return NULL;
17566    }
17567    AsnGenericBaseSeqOfFree(ptr -> modifiers ,ASNCODE_INTVAL_SLOT);
17568    return MemFree(ptr);
17569 }
17570 
17571 
17572 /**************************************************
17573 *
17574 *    AutodefActionAsnRead()
17575 *
17576 **************************************************/
17577 NLM_EXTERN
17578 AutodefActionPtr LIBCALL
AutodefActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)17579 AutodefActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
17580 {
17581    DataVal av;
17582    AsnTypePtr atp;
17583    Boolean isError = FALSE;
17584    AsnReadFunc func;
17585    AutodefActionPtr ptr;
17586 
17587    if (! loaded)
17588    {
17589       if (! objmacroAsnLoad()) {
17590          return NULL;
17591       }
17592    }
17593 
17594    if (aip == NULL) {
17595       return NULL;
17596    }
17597 
17598    if (orig == NULL) {         /* AutodefAction ::= (self contained) */
17599       atp = AsnReadId(aip, amp, AUTODEF_ACTION);
17600    } else {
17601       atp = AsnLinkType(orig, AUTODEF_ACTION);
17602    }
17603    /* link in local tree */
17604    if (atp == NULL) {
17605       return NULL;
17606    }
17607 
17608    ptr = AutodefActionNew();
17609    if (ptr == NULL) {
17610       goto erret;
17611    }
17612    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
17613       goto erret;
17614    }
17615 
17616    atp = AsnReadId(aip,amp, atp);
17617    func = NULL;
17618 
17619    if (atp == AUTODEF_ACTION_modifiers) {
17620       ptr -> modifiers = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
17621       if (isError && ptr -> modifiers == NULL) {
17622          goto erret;
17623       }
17624       atp = AsnReadId(aip,amp, atp);
17625    }
17626    if (atp == AUTODEF_ACTION_clause_list_type) {
17627       if ( AsnReadVal(aip, atp, &av) <= 0) {
17628          goto erret;
17629       }
17630       ptr -> clause_list_type = av.intvalue;
17631       atp = AsnReadId(aip,amp, atp);
17632    }
17633    if (atp == AUTODEF_ACTION_misc_feat_parse_rule) {
17634       if ( AsnReadVal(aip, atp, &av) <= 0) {
17635          goto erret;
17636       }
17637       ptr -> misc_feat_parse_rule = av.intvalue;
17638       atp = AsnReadId(aip,amp, atp);
17639    }
17640 
17641    if (AsnReadVal(aip, atp, &av) <= 0) {
17642       goto erret;
17643    }
17644    /* end struct */
17645 
17646 ret:
17647    AsnUnlinkType(orig);       /* unlink local tree */
17648    return ptr;
17649 
17650 erret:
17651    aip -> io_failure = TRUE;
17652    ptr = AutodefActionFree(ptr);
17653    goto ret;
17654 }
17655 
17656 
17657 
17658 /**************************************************
17659 *
17660 *    AutodefActionAsnWrite()
17661 *
17662 **************************************************/
17663 NLM_EXTERN Boolean LIBCALL
AutodefActionAsnWrite(AutodefActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)17664 AutodefActionAsnWrite(AutodefActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
17665 {
17666    DataVal av;
17667    AsnTypePtr atp;
17668    Boolean retval = FALSE;
17669 
17670    if (! loaded)
17671    {
17672       if (! objmacroAsnLoad()) {
17673          return FALSE;
17674       }
17675    }
17676 
17677    if (aip == NULL) {
17678       return FALSE;
17679    }
17680 
17681    atp = AsnLinkType(orig, AUTODEF_ACTION);   /* link local tree */
17682    if (atp == NULL) {
17683       return FALSE;
17684    }
17685 
17686    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
17687 
17688     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
17689 
17690    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
17691       goto erret;
17692    }
17693 
17694    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> modifiers ,ASNCODE_INTVAL_SLOT, aip, AUTODEF_ACTION_modifiers, AUTODEF_ACTION_modifiers_E);
17695    av.intvalue = ptr -> clause_list_type;
17696    retval = AsnWrite(aip, AUTODEF_ACTION_clause_list_type,  &av);
17697    av.intvalue = ptr -> misc_feat_parse_rule;
17698    retval = AsnWrite(aip, AUTODEF_ACTION_misc_feat_parse_rule,  &av);
17699    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
17700       goto erret;
17701    }
17702    retval = TRUE;
17703 
17704 erret:
17705    AsnUnlinkType(orig);       /* unlink local tree */
17706    return retval;
17707 }
17708 
17709 
17710 
17711 /**************************************************
17712 *
17713 *    FixPubCapsActionNew()
17714 *
17715 **************************************************/
17716 NLM_EXTERN
17717 FixPubCapsActionPtr LIBCALL
FixPubCapsActionNew(void)17718 FixPubCapsActionNew(void)
17719 {
17720    FixPubCapsActionPtr ptr = MemNew((size_t) sizeof(FixPubCapsAction));
17721 
17722    ptr -> punct_only = 0;
17723    return ptr;
17724 
17725 }
17726 
17727 
17728 /**************************************************
17729 *
17730 *    FixPubCapsActionFree()
17731 *
17732 **************************************************/
17733 NLM_EXTERN
17734 FixPubCapsActionPtr LIBCALL
FixPubCapsActionFree(FixPubCapsActionPtr ptr)17735 FixPubCapsActionFree(FixPubCapsActionPtr ptr)
17736 {
17737 
17738    if(ptr == NULL) {
17739       return NULL;
17740    }
17741    ConstraintChoiceSetFree(ptr -> constraint);
17742    return MemFree(ptr);
17743 }
17744 
17745 
17746 /**************************************************
17747 *
17748 *    FixPubCapsActionAsnRead()
17749 *
17750 **************************************************/
17751 NLM_EXTERN
17752 FixPubCapsActionPtr LIBCALL
FixPubCapsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)17753 FixPubCapsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
17754 {
17755    DataVal av;
17756    AsnTypePtr atp;
17757    Boolean isError = FALSE;
17758    AsnReadFunc func;
17759    FixPubCapsActionPtr ptr;
17760 
17761    if (! loaded)
17762    {
17763       if (! objmacroAsnLoad()) {
17764          return NULL;
17765       }
17766    }
17767 
17768    if (aip == NULL) {
17769       return NULL;
17770    }
17771 
17772    if (orig == NULL) {         /* FixPubCapsAction ::= (self contained) */
17773       atp = AsnReadId(aip, amp, FIX_PUB_CAPS_ACTION);
17774    } else {
17775       atp = AsnLinkType(orig, FIX_PUB_CAPS_ACTION);
17776    }
17777    /* link in local tree */
17778    if (atp == NULL) {
17779       return NULL;
17780    }
17781 
17782    ptr = FixPubCapsActionNew();
17783    if (ptr == NULL) {
17784       goto erret;
17785    }
17786    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
17787       goto erret;
17788    }
17789 
17790    atp = AsnReadId(aip,amp, atp);
17791    func = NULL;
17792 
17793    if (atp == FIX_PUB_CAPS_ACTION_title) {
17794       if ( AsnReadVal(aip, atp, &av) <= 0) {
17795          goto erret;
17796       }
17797       ptr -> title = av.boolvalue;
17798       atp = AsnReadId(aip,amp, atp);
17799    }
17800    if (atp == FIX_PUB_CAPS_ACTION_authors) {
17801       if ( AsnReadVal(aip, atp, &av) <= 0) {
17802          goto erret;
17803       }
17804       ptr -> authors = av.boolvalue;
17805       atp = AsnReadId(aip,amp, atp);
17806    }
17807    if (atp == FIX_PUB_CAPS_ACTION_affiliation) {
17808       if ( AsnReadVal(aip, atp, &av) <= 0) {
17809          goto erret;
17810       }
17811       ptr -> affiliation = av.boolvalue;
17812       atp = AsnReadId(aip,amp, atp);
17813    }
17814    if (atp == FIX_PUB_CAPS_ACTION_affil_country) {
17815       if ( AsnReadVal(aip, atp, &av) <= 0) {
17816          goto erret;
17817       }
17818       ptr -> affil_country = av.boolvalue;
17819       atp = AsnReadId(aip,amp, atp);
17820    }
17821    if (atp == FIX_PUB_CAPS_ACTION_punct_only) {
17822       if ( AsnReadVal(aip, atp, &av) <= 0) {
17823          goto erret;
17824       }
17825       ptr -> punct_only = av.boolvalue;
17826       atp = AsnReadId(aip,amp, atp);
17827    }
17828    if (atp == FIX_PUB_CAPS_ACTION_constraint) {
17829       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
17830       if (aip -> io_failure) {
17831          goto erret;
17832       }
17833       atp = AsnReadId(aip,amp, atp);
17834    }
17835 
17836    if (AsnReadVal(aip, atp, &av) <= 0) {
17837       goto erret;
17838    }
17839    /* end struct */
17840 
17841 ret:
17842    AsnUnlinkType(orig);       /* unlink local tree */
17843    return ptr;
17844 
17845 erret:
17846    aip -> io_failure = TRUE;
17847    ptr = FixPubCapsActionFree(ptr);
17848    goto ret;
17849 }
17850 
17851 
17852 
17853 /**************************************************
17854 *
17855 *    FixPubCapsActionAsnWrite()
17856 *
17857 **************************************************/
17858 NLM_EXTERN Boolean LIBCALL
FixPubCapsActionAsnWrite(FixPubCapsActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)17859 FixPubCapsActionAsnWrite(FixPubCapsActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
17860 {
17861    DataVal av;
17862    AsnTypePtr atp;
17863    Boolean retval = FALSE;
17864 
17865    if (! loaded)
17866    {
17867       if (! objmacroAsnLoad()) {
17868          return FALSE;
17869       }
17870    }
17871 
17872    if (aip == NULL) {
17873       return FALSE;
17874    }
17875 
17876    atp = AsnLinkType(orig, FIX_PUB_CAPS_ACTION);   /* link local tree */
17877    if (atp == NULL) {
17878       return FALSE;
17879    }
17880 
17881    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
17882 
17883     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
17884 
17885    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
17886       goto erret;
17887    }
17888 
17889    av.boolvalue = ptr -> title;
17890    retval = AsnWrite(aip, FIX_PUB_CAPS_ACTION_title,  &av);
17891    av.boolvalue = ptr -> authors;
17892    retval = AsnWrite(aip, FIX_PUB_CAPS_ACTION_authors,  &av);
17893    av.boolvalue = ptr -> affiliation;
17894    retval = AsnWrite(aip, FIX_PUB_CAPS_ACTION_affiliation,  &av);
17895    av.boolvalue = ptr -> affil_country;
17896    retval = AsnWrite(aip, FIX_PUB_CAPS_ACTION_affil_country,  &av);
17897    av.boolvalue = ptr -> punct_only;
17898    retval = AsnWrite(aip, FIX_PUB_CAPS_ACTION_punct_only,  &av);
17899    if (ptr -> constraint != NULL) {
17900       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, FIX_PUB_CAPS_ACTION_constraint)) {
17901          goto erret;
17902       }
17903    }
17904    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
17905       goto erret;
17906    }
17907    retval = TRUE;
17908 
17909 erret:
17910    AsnUnlinkType(orig);       /* unlink local tree */
17911    return retval;
17912 }
17913 
17914 
17915 
17916 /**************************************************
17917 *
17918 *    SortFieldsActionNew()
17919 *
17920 **************************************************/
17921 NLM_EXTERN
17922 SortFieldsActionPtr LIBCALL
SortFieldsActionNew(void)17923 SortFieldsActionNew(void)
17924 {
17925    SortFieldsActionPtr ptr = MemNew((size_t) sizeof(SortFieldsAction));
17926 
17927    return ptr;
17928 
17929 }
17930 
17931 
17932 /**************************************************
17933 *
17934 *    SortFieldsActionFree()
17935 *
17936 **************************************************/
17937 NLM_EXTERN
17938 SortFieldsActionPtr LIBCALL
SortFieldsActionFree(SortFieldsActionPtr ptr)17939 SortFieldsActionFree(SortFieldsActionPtr ptr)
17940 {
17941 
17942    if(ptr == NULL) {
17943       return NULL;
17944    }
17945    FieldTypeFree(ptr -> field);
17946    ConstraintChoiceSetFree(ptr -> constraint);
17947    return MemFree(ptr);
17948 }
17949 
17950 
17951 /**************************************************
17952 *
17953 *    SortFieldsActionAsnRead()
17954 *
17955 **************************************************/
17956 NLM_EXTERN
17957 SortFieldsActionPtr LIBCALL
SortFieldsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)17958 SortFieldsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
17959 {
17960    DataVal av;
17961    AsnTypePtr atp;
17962    Boolean isError = FALSE;
17963    AsnReadFunc func;
17964    SortFieldsActionPtr ptr;
17965 
17966    if (! loaded)
17967    {
17968       if (! objmacroAsnLoad()) {
17969          return NULL;
17970       }
17971    }
17972 
17973    if (aip == NULL) {
17974       return NULL;
17975    }
17976 
17977    if (orig == NULL) {         /* SortFieldsAction ::= (self contained) */
17978       atp = AsnReadId(aip, amp, SORT_FIELDS_ACTION);
17979    } else {
17980       atp = AsnLinkType(orig, SORT_FIELDS_ACTION);
17981    }
17982    /* link in local tree */
17983    if (atp == NULL) {
17984       return NULL;
17985    }
17986 
17987    ptr = SortFieldsActionNew();
17988    if (ptr == NULL) {
17989       goto erret;
17990    }
17991    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
17992       goto erret;
17993    }
17994 
17995    atp = AsnReadId(aip,amp, atp);
17996    func = NULL;
17997 
17998    if (atp == SORT_FIELDS_ACTION_field) {
17999       ptr -> field = FieldTypeAsnRead(aip, atp);
18000       if (aip -> io_failure) {
18001          goto erret;
18002       }
18003       atp = AsnReadId(aip,amp, atp);
18004    }
18005    if (atp == SORT_FIELDS_ACTION_order) {
18006       if ( AsnReadVal(aip, atp, &av) <= 0) {
18007          goto erret;
18008       }
18009       ptr -> order = av.intvalue;
18010       atp = AsnReadId(aip,amp, atp);
18011    }
18012    if (atp == SORT_FIELDS_ACTION_constraint) {
18013       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
18014       if (aip -> io_failure) {
18015          goto erret;
18016       }
18017       atp = AsnReadId(aip,amp, atp);
18018    }
18019 
18020    if (AsnReadVal(aip, atp, &av) <= 0) {
18021       goto erret;
18022    }
18023    /* end struct */
18024 
18025 ret:
18026    AsnUnlinkType(orig);       /* unlink local tree */
18027    return ptr;
18028 
18029 erret:
18030    aip -> io_failure = TRUE;
18031    ptr = SortFieldsActionFree(ptr);
18032    goto ret;
18033 }
18034 
18035 
18036 
18037 /**************************************************
18038 *
18039 *    SortFieldsActionAsnWrite()
18040 *
18041 **************************************************/
18042 NLM_EXTERN Boolean LIBCALL
SortFieldsActionAsnWrite(SortFieldsActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)18043 SortFieldsActionAsnWrite(SortFieldsActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
18044 {
18045    DataVal av;
18046    AsnTypePtr atp;
18047    Boolean retval = FALSE;
18048 
18049    if (! loaded)
18050    {
18051       if (! objmacroAsnLoad()) {
18052          return FALSE;
18053       }
18054    }
18055 
18056    if (aip == NULL) {
18057       return FALSE;
18058    }
18059 
18060    atp = AsnLinkType(orig, SORT_FIELDS_ACTION);   /* link local tree */
18061    if (atp == NULL) {
18062       return FALSE;
18063    }
18064 
18065    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
18066 
18067     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
18068 
18069    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
18070       goto erret;
18071    }
18072 
18073    if (ptr -> field != NULL) {
18074       if ( ! FieldTypeAsnWrite(ptr -> field, aip, SORT_FIELDS_ACTION_field)) {
18075          goto erret;
18076       }
18077    }
18078    av.intvalue = ptr -> order;
18079    retval = AsnWrite(aip, SORT_FIELDS_ACTION_order,  &av);
18080    if (ptr -> constraint != NULL) {
18081       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, SORT_FIELDS_ACTION_constraint)) {
18082          goto erret;
18083       }
18084    }
18085    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
18086       goto erret;
18087    }
18088    retval = TRUE;
18089 
18090 erret:
18091    AsnUnlinkType(orig);       /* unlink local tree */
18092    return retval;
18093 }
18094 
18095 
18096 
18097 /**************************************************
18098 *
18099 *    FixAuthorCapsNew()
18100 *
18101 **************************************************/
18102 NLM_EXTERN
18103 FixAuthorCapsPtr LIBCALL
FixAuthorCapsNew(void)18104 FixAuthorCapsNew(void)
18105 {
18106    FixAuthorCapsPtr ptr = MemNew((size_t) sizeof(FixAuthorCaps));
18107 
18108    return ptr;
18109 
18110 }
18111 
18112 
18113 /**************************************************
18114 *
18115 *    FixAuthorCapsFree()
18116 *
18117 **************************************************/
18118 NLM_EXTERN
18119 FixAuthorCapsPtr LIBCALL
FixAuthorCapsFree(FixAuthorCapsPtr ptr)18120 FixAuthorCapsFree(FixAuthorCapsPtr ptr)
18121 {
18122 
18123    if(ptr == NULL) {
18124       return NULL;
18125    }
18126    return MemFree(ptr);
18127 }
18128 
18129 
18130 /**************************************************
18131 *
18132 *    FixAuthorCapsAsnRead()
18133 *
18134 **************************************************/
18135 NLM_EXTERN
18136 FixAuthorCapsPtr LIBCALL
FixAuthorCapsAsnRead(AsnIoPtr aip,AsnTypePtr orig)18137 FixAuthorCapsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
18138 {
18139    DataVal av;
18140    AsnTypePtr atp;
18141    Boolean isError = FALSE;
18142    AsnReadFunc func;
18143    FixAuthorCapsPtr ptr;
18144 
18145    if (! loaded)
18146    {
18147       if (! objmacroAsnLoad()) {
18148          return NULL;
18149       }
18150    }
18151 
18152    if (aip == NULL) {
18153       return NULL;
18154    }
18155 
18156    if (orig == NULL) {         /* FixAuthorCaps ::= (self contained) */
18157       atp = AsnReadId(aip, amp, FIX_AUTHOR_CAPS);
18158    } else {
18159       atp = AsnLinkType(orig, FIX_AUTHOR_CAPS);
18160    }
18161    /* link in local tree */
18162    if (atp == NULL) {
18163       return NULL;
18164    }
18165 
18166    ptr = FixAuthorCapsNew();
18167    if (ptr == NULL) {
18168       goto erret;
18169    }
18170    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
18171       goto erret;
18172    }
18173 
18174    atp = AsnReadId(aip,amp, atp);
18175    func = NULL;
18176 
18177    if (atp == FIX_AUTHOR_CAPS_last_name_only) {
18178       if ( AsnReadVal(aip, atp, &av) <= 0) {
18179          goto erret;
18180       }
18181       ptr -> last_name_only = av.boolvalue;
18182       atp = AsnReadId(aip,amp, atp);
18183    }
18184 
18185    if (AsnReadVal(aip, atp, &av) <= 0) {
18186       goto erret;
18187    }
18188    /* end struct */
18189 
18190 ret:
18191    AsnUnlinkType(orig);       /* unlink local tree */
18192    return ptr;
18193 
18194 erret:
18195    aip -> io_failure = TRUE;
18196    ptr = FixAuthorCapsFree(ptr);
18197    goto ret;
18198 }
18199 
18200 
18201 
18202 /**************************************************
18203 *
18204 *    FixAuthorCapsAsnWrite()
18205 *
18206 **************************************************/
18207 NLM_EXTERN Boolean LIBCALL
FixAuthorCapsAsnWrite(FixAuthorCapsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)18208 FixAuthorCapsAsnWrite(FixAuthorCapsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
18209 {
18210    DataVal av;
18211    AsnTypePtr atp;
18212    Boolean retval = FALSE;
18213 
18214    if (! loaded)
18215    {
18216       if (! objmacroAsnLoad()) {
18217          return FALSE;
18218       }
18219    }
18220 
18221    if (aip == NULL) {
18222       return FALSE;
18223    }
18224 
18225    atp = AsnLinkType(orig, FIX_AUTHOR_CAPS);   /* link local tree */
18226    if (atp == NULL) {
18227       return FALSE;
18228    }
18229 
18230    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
18231 
18232     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
18233 
18234    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
18235       goto erret;
18236    }
18237 
18238    av.boolvalue = ptr -> last_name_only;
18239    retval = AsnWrite(aip, FIX_AUTHOR_CAPS_last_name_only,  &av);
18240    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
18241       goto erret;
18242    }
18243    retval = TRUE;
18244 
18245 erret:
18246    AsnUnlinkType(orig);       /* unlink local tree */
18247    return retval;
18248 }
18249 
18250 
18251 
18252 /**************************************************
18253 *
18254 *    FixCapsActionFree()
18255 *
18256 **************************************************/
18257 NLM_EXTERN
18258 FixCapsActionPtr LIBCALL
FixCapsActionFree(ValNodePtr anp)18259 FixCapsActionFree(ValNodePtr anp)
18260 {
18261    Pointer pnt;
18262 
18263    if (anp == NULL) {
18264       return NULL;
18265    }
18266 
18267    pnt = anp->data.ptrvalue;
18268    switch (anp->choice)
18269    {
18270    default:
18271       break;
18272    case FixCapsAction_pub:
18273       FixPubCapsActionFree(anp -> data.ptrvalue);
18274       break;
18275    case FixCapsAction_author:
18276       FixAuthorCapsFree(anp -> data.ptrvalue);
18277       break;
18278    }
18279    return MemFree(anp);
18280 }
18281 
18282 
18283 /**************************************************
18284 *
18285 *    FixCapsActionAsnRead()
18286 *
18287 **************************************************/
18288 NLM_EXTERN
18289 FixCapsActionPtr LIBCALL
FixCapsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)18290 FixCapsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
18291 {
18292    DataVal av;
18293    AsnTypePtr atp;
18294    ValNodePtr anp;
18295    Uint1 choice;
18296    Boolean isError = FALSE;
18297    Boolean nullIsError = FALSE;
18298    AsnReadFunc func;
18299 
18300    if (! loaded)
18301    {
18302       if (! objmacroAsnLoad()) {
18303          return NULL;
18304       }
18305    }
18306 
18307    if (aip == NULL) {
18308       return NULL;
18309    }
18310 
18311    if (orig == NULL) {         /* FixCapsAction ::= (self contained) */
18312       atp = AsnReadId(aip, amp, FIX_CAPS_ACTION);
18313    } else {
18314       atp = AsnLinkType(orig, FIX_CAPS_ACTION);    /* link in local tree */
18315    }
18316    if (atp == NULL) {
18317       return NULL;
18318    }
18319 
18320    anp = ValNodeNew(NULL);
18321    if (anp == NULL) {
18322       goto erret;
18323    }
18324    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
18325       goto erret;
18326    }
18327 
18328    func = NULL;
18329 
18330    atp = AsnReadId(aip, amp, atp);  /* find the choice */
18331    if (atp == NULL) {
18332       goto erret;
18333    }
18334    if (atp == FIX_CAPS_ACTION_pub) {
18335       choice = FixCapsAction_pub;
18336       func = (AsnReadFunc) FixPubCapsActionAsnRead;
18337    }
18338    else if (atp == FIX_CAPS_ACTION_src_country) {
18339       choice = FixCapsAction_src_country;
18340       if (AsnReadVal(aip, atp, &av) <= 0) {
18341          goto erret;
18342       }
18343       anp->data.boolvalue = av.boolvalue;
18344    }
18345    else if (atp == FIX_CAPS_ACTION_mouse_strain) {
18346       choice = FixCapsAction_mouse_strain;
18347       if (AsnReadVal(aip, atp, &av) <= 0) {
18348          goto erret;
18349       }
18350       anp->data.boolvalue = av.boolvalue;
18351    }
18352    else if (atp == FIX_CAPS_ACTION_src_qual) {
18353       choice = FixCapsAction_src_qual;
18354       if (AsnReadVal(aip, atp, &av) <= 0) {
18355          goto erret;
18356       }
18357       anp->data.intvalue = av.intvalue;
18358    }
18359    else if (atp == FIX_CAPS_ACTION_author) {
18360       choice = FixCapsAction_author;
18361       func = (AsnReadFunc) FixAuthorCapsAsnRead;
18362    }
18363    anp->choice = choice;
18364    if (func != NULL)
18365    {
18366       anp->data.ptrvalue = (* func)(aip, atp);
18367       if (aip -> io_failure) goto erret;
18368 
18369       if (nullIsError && anp->data.ptrvalue == NULL) {
18370          goto erret;
18371       }
18372    }
18373 
18374 ret:
18375    AsnUnlinkType(orig);       /* unlink local tree */
18376    return anp;
18377 
18378 erret:
18379    anp = MemFree(anp);
18380    aip -> io_failure = TRUE;
18381    goto ret;
18382 }
18383 
18384 
18385 /**************************************************
18386 *
18387 *    FixCapsActionAsnWrite()
18388 *
18389 **************************************************/
18390 NLM_EXTERN Boolean LIBCALL
FixCapsActionAsnWrite(FixCapsActionPtr anp,AsnIoPtr aip,AsnTypePtr orig)18391 FixCapsActionAsnWrite(FixCapsActionPtr anp, AsnIoPtr aip, AsnTypePtr orig)
18392 
18393 {
18394    DataVal av;
18395    AsnTypePtr atp, writetype = NULL;
18396    Pointer pnt;
18397    AsnWriteFunc func = NULL;
18398    Boolean retval = FALSE;
18399 
18400    if (! loaded)
18401    {
18402       if (! objmacroAsnLoad())
18403       return FALSE;
18404    }
18405 
18406    if (aip == NULL)
18407    return FALSE;
18408 
18409    atp = AsnLinkType(orig, FIX_CAPS_ACTION);   /* link local tree */
18410    if (atp == NULL) {
18411       return FALSE;
18412    }
18413 
18414    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
18415 
18416     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
18417 
18418    av.ptrvalue = (Pointer)anp;
18419    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
18420       goto erret;
18421    }
18422 
18423    pnt = anp->data.ptrvalue;
18424    switch (anp->choice)
18425    {
18426    case FixCapsAction_pub:
18427       writetype = FIX_CAPS_ACTION_pub;
18428       func = (AsnWriteFunc) FixPubCapsActionAsnWrite;
18429       break;
18430    case FixCapsAction_src_country:
18431       av.boolvalue = anp->data.boolvalue;
18432       retval = AsnWrite(aip, FIX_CAPS_ACTION_src_country, &av);
18433       break;
18434    case FixCapsAction_mouse_strain:
18435       av.boolvalue = anp->data.boolvalue;
18436       retval = AsnWrite(aip, FIX_CAPS_ACTION_mouse_strain, &av);
18437       break;
18438    case FixCapsAction_src_qual:
18439       av.intvalue = anp->data.intvalue;
18440       retval = AsnWrite(aip, FIX_CAPS_ACTION_src_qual, &av);
18441       break;
18442    case FixCapsAction_author:
18443       writetype = FIX_CAPS_ACTION_author;
18444       func = (AsnWriteFunc) FixAuthorCapsAsnWrite;
18445       break;
18446    }
18447    if (writetype != NULL) {
18448       retval = (* func)(pnt, aip, writetype);   /* write it out */
18449    }
18450    if (!retval) {
18451       goto erret;
18452    }
18453    retval = TRUE;
18454 
18455 erret:
18456    AsnUnlinkType(orig);       /* unlink local tree */
18457    return retval;
18458 }
18459 
18460 
18461 /**************************************************
18462 *
18463 *    FixFormatActionFree()
18464 *
18465 **************************************************/
18466 NLM_EXTERN
18467 FixFormatActionPtr LIBCALL
FixFormatActionFree(ValNodePtr anp)18468 FixFormatActionFree(ValNodePtr anp)
18469 {
18470    Pointer pnt;
18471 
18472    if (anp == NULL) {
18473       return NULL;
18474    }
18475 
18476    pnt = anp->data.ptrvalue;
18477    switch (anp->choice)
18478    {
18479    default:
18480       break;
18481    }
18482    return MemFree(anp);
18483 }
18484 
18485 
18486 /**************************************************
18487 *
18488 *    FixFormatActionAsnRead()
18489 *
18490 **************************************************/
18491 NLM_EXTERN
18492 FixFormatActionPtr LIBCALL
FixFormatActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)18493 FixFormatActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
18494 {
18495    DataVal av;
18496    AsnTypePtr atp;
18497    ValNodePtr anp;
18498    Uint1 choice;
18499    Boolean isError = FALSE;
18500    Boolean nullIsError = FALSE;
18501    AsnReadFunc func;
18502 
18503    if (! loaded)
18504    {
18505       if (! objmacroAsnLoad()) {
18506          return NULL;
18507       }
18508    }
18509 
18510    if (aip == NULL) {
18511       return NULL;
18512    }
18513 
18514    if (orig == NULL) {         /* FixFormatAction ::= (self contained) */
18515       atp = AsnReadId(aip, amp, FIX_FORMAT_ACTION);
18516    } else {
18517       atp = AsnLinkType(orig, FIX_FORMAT_ACTION);    /* link in local tree */
18518    }
18519    if (atp == NULL) {
18520       return NULL;
18521    }
18522 
18523    anp = ValNodeNew(NULL);
18524    if (anp == NULL) {
18525       goto erret;
18526    }
18527    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
18528       goto erret;
18529    }
18530 
18531    func = NULL;
18532 
18533    atp = AsnReadId(aip, amp, atp);  /* find the choice */
18534    if (atp == NULL) {
18535       goto erret;
18536    }
18537    if (atp == FIX_FORMAT_ACTION_collection_date) {
18538       choice = FixFormatAction_collection_date;
18539       if (AsnReadVal(aip, atp, &av) <= 0) {
18540          goto erret;
18541       }
18542       anp->data.boolvalue = av.boolvalue;
18543    }
18544    else if (atp == FIX_FORMAT_ACTION_lat_lon) {
18545       choice = FixFormatAction_lat_lon;
18546       if (AsnReadVal(aip, atp, &av) <= 0) {
18547          goto erret;
18548       }
18549       anp->data.boolvalue = av.boolvalue;
18550    }
18551    else if (atp == FIX_FORMAT_ACTION_primers) {
18552       choice = FixFormatAction_primers;
18553       if (AsnReadVal(aip, atp, &av) <= 0) {
18554          goto erret;
18555       }
18556       anp->data.boolvalue = av.boolvalue;
18557    }
18558    else if (atp == FIX_FORMAT_ACTION_protein_name) {
18559       choice = FixFormatAction_protein_name;
18560       if (AsnReadVal(aip, atp, &av) <= 0) {
18561          goto erret;
18562       }
18563       anp->data.boolvalue = av.boolvalue;
18564    }
18565    anp->choice = choice;
18566    if (func != NULL)
18567    {
18568       anp->data.ptrvalue = (* func)(aip, atp);
18569       if (aip -> io_failure) goto erret;
18570 
18571       if (nullIsError && anp->data.ptrvalue == NULL) {
18572          goto erret;
18573       }
18574    }
18575 
18576 ret:
18577    AsnUnlinkType(orig);       /* unlink local tree */
18578    return anp;
18579 
18580 erret:
18581    anp = MemFree(anp);
18582    aip -> io_failure = TRUE;
18583    goto ret;
18584 }
18585 
18586 
18587 /**************************************************
18588 *
18589 *    FixFormatActionAsnWrite()
18590 *
18591 **************************************************/
18592 NLM_EXTERN Boolean LIBCALL
FixFormatActionAsnWrite(FixFormatActionPtr anp,AsnIoPtr aip,AsnTypePtr orig)18593 FixFormatActionAsnWrite(FixFormatActionPtr anp, AsnIoPtr aip, AsnTypePtr orig)
18594 
18595 {
18596    DataVal av;
18597    AsnTypePtr atp, writetype = NULL;
18598    Pointer pnt;
18599    AsnWriteFunc func = NULL;
18600    Boolean retval = FALSE;
18601 
18602    if (! loaded)
18603    {
18604       if (! objmacroAsnLoad())
18605       return FALSE;
18606    }
18607 
18608    if (aip == NULL)
18609    return FALSE;
18610 
18611    atp = AsnLinkType(orig, FIX_FORMAT_ACTION);   /* link local tree */
18612    if (atp == NULL) {
18613       return FALSE;
18614    }
18615 
18616    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
18617 
18618     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
18619 
18620    av.ptrvalue = (Pointer)anp;
18621    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
18622       goto erret;
18623    }
18624 
18625    pnt = anp->data.ptrvalue;
18626    switch (anp->choice)
18627    {
18628    case FixFormatAction_collection_date:
18629       av.boolvalue = anp->data.boolvalue;
18630       retval = AsnWrite(aip, FIX_FORMAT_ACTION_collection_date, &av);
18631       break;
18632    case FixFormatAction_lat_lon:
18633       av.boolvalue = anp->data.boolvalue;
18634       retval = AsnWrite(aip, FIX_FORMAT_ACTION_lat_lon, &av);
18635       break;
18636    case FixFormatAction_primers:
18637       av.boolvalue = anp->data.boolvalue;
18638       retval = AsnWrite(aip, FIX_FORMAT_ACTION_primers, &av);
18639       break;
18640    case FixFormatAction_protein_name:
18641       av.boolvalue = anp->data.boolvalue;
18642       retval = AsnWrite(aip, FIX_FORMAT_ACTION_protein_name, &av);
18643       break;
18644    }
18645    if (writetype != NULL) {
18646       retval = (* func)(pnt, aip, writetype);   /* write it out */
18647    }
18648    if (!retval) {
18649       goto erret;
18650    }
18651    retval = TRUE;
18652 
18653 erret:
18654    AsnUnlinkType(orig);       /* unlink local tree */
18655    return retval;
18656 }
18657 
18658 
18659 /**************************************************
18660 *
18661 *    RemoveDuplicateFeatureActionNew()
18662 *
18663 **************************************************/
18664 NLM_EXTERN
18665 RemoveDuplicateFeatureActionPtr LIBCALL
RemoveDuplicateFeatureActionNew(void)18666 RemoveDuplicateFeatureActionNew(void)
18667 {
18668    RemoveDuplicateFeatureActionPtr ptr = MemNew((size_t) sizeof(RemoveDuplicateFeatureAction));
18669 
18670    return ptr;
18671 
18672 }
18673 
18674 
18675 /**************************************************
18676 *
18677 *    RemoveDuplicateFeatureActionFree()
18678 *
18679 **************************************************/
18680 NLM_EXTERN
18681 RemoveDuplicateFeatureActionPtr LIBCALL
RemoveDuplicateFeatureActionFree(RemoveDuplicateFeatureActionPtr ptr)18682 RemoveDuplicateFeatureActionFree(RemoveDuplicateFeatureActionPtr ptr)
18683 {
18684 
18685    if(ptr == NULL) {
18686       return NULL;
18687    }
18688    ConstraintChoiceSetFree(ptr -> rd_constraint);
18689    return MemFree(ptr);
18690 }
18691 
18692 
18693 /**************************************************
18694 *
18695 *    RemoveDuplicateFeatureActionAsnRead()
18696 *
18697 **************************************************/
18698 NLM_EXTERN
18699 RemoveDuplicateFeatureActionPtr LIBCALL
RemoveDuplicateFeatureActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)18700 RemoveDuplicateFeatureActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
18701 {
18702    DataVal av;
18703    AsnTypePtr atp;
18704    Boolean isError = FALSE;
18705    AsnReadFunc func;
18706    RemoveDuplicateFeatureActionPtr ptr;
18707 
18708    if (! loaded)
18709    {
18710       if (! objmacroAsnLoad()) {
18711          return NULL;
18712       }
18713    }
18714 
18715    if (aip == NULL) {
18716       return NULL;
18717    }
18718 
18719    if (orig == NULL) {         /* RemoveDuplicateFeatureAction ::= (self contained) */
18720       atp = AsnReadId(aip, amp, REMOVE_DUPLICATE_FEATURE_ACTION);
18721    } else {
18722       atp = AsnLinkType(orig, REMOVE_DUPLICATE_FEATURE_ACTION);
18723    }
18724    /* link in local tree */
18725    if (atp == NULL) {
18726       return NULL;
18727    }
18728 
18729    ptr = RemoveDuplicateFeatureActionNew();
18730    if (ptr == NULL) {
18731       goto erret;
18732    }
18733    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
18734       goto erret;
18735    }
18736 
18737    atp = AsnReadId(aip,amp, atp);
18738    func = NULL;
18739 
18740    if (atp == REMOVE_DUPLICATE_FEATURE_ACTION_type) {
18741       if ( AsnReadVal(aip, atp, &av) <= 0) {
18742          goto erret;
18743       }
18744       ptr -> type = av.intvalue;
18745       atp = AsnReadId(aip,amp, atp);
18746    }
18747    if (atp == REMOVE_DUPLICATE_FEATURE_ACTION_ignore_partials) {
18748       if ( AsnReadVal(aip, atp, &av) <= 0) {
18749          goto erret;
18750       }
18751       ptr -> ignore_partials = av.boolvalue;
18752       atp = AsnReadId(aip,amp, atp);
18753    }
18754    if (atp == REMOVE_DUPLICATE_FEATURE_ACTION_case_sensitive) {
18755       if ( AsnReadVal(aip, atp, &av) <= 0) {
18756          goto erret;
18757       }
18758       ptr -> case_sensitive = av.boolvalue;
18759       atp = AsnReadId(aip,amp, atp);
18760    }
18761    if (atp == REMOVE_DUPLICATE_FEATURE_ACTION_remove_proteins) {
18762       if ( AsnReadVal(aip, atp, &av) <= 0) {
18763          goto erret;
18764       }
18765       ptr -> remove_proteins = av.boolvalue;
18766       atp = AsnReadId(aip,amp, atp);
18767    }
18768    if (atp == REMOVE_DUPLICATE_FEATURE_ACTION_rd_constraint) {
18769       ptr -> rd_constraint = ConstraintChoiceSetAsnRead(aip, atp);
18770       if (aip -> io_failure) {
18771          goto erret;
18772       }
18773       atp = AsnReadId(aip,amp, atp);
18774    }
18775 
18776    if (AsnReadVal(aip, atp, &av) <= 0) {
18777       goto erret;
18778    }
18779    /* end struct */
18780 
18781 ret:
18782    AsnUnlinkType(orig);       /* unlink local tree */
18783    return ptr;
18784 
18785 erret:
18786    aip -> io_failure = TRUE;
18787    ptr = RemoveDuplicateFeatureActionFree(ptr);
18788    goto ret;
18789 }
18790 
18791 
18792 
18793 /**************************************************
18794 *
18795 *    RemoveDuplicateFeatureActionAsnWrite()
18796 *
18797 **************************************************/
18798 NLM_EXTERN Boolean LIBCALL
RemoveDuplicateFeatureActionAsnWrite(RemoveDuplicateFeatureActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)18799 RemoveDuplicateFeatureActionAsnWrite(RemoveDuplicateFeatureActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
18800 {
18801    DataVal av;
18802    AsnTypePtr atp;
18803    Boolean retval = FALSE;
18804 
18805    if (! loaded)
18806    {
18807       if (! objmacroAsnLoad()) {
18808          return FALSE;
18809       }
18810    }
18811 
18812    if (aip == NULL) {
18813       return FALSE;
18814    }
18815 
18816    atp = AsnLinkType(orig, REMOVE_DUPLICATE_FEATURE_ACTION);   /* link local tree */
18817    if (atp == NULL) {
18818       return FALSE;
18819    }
18820 
18821    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
18822 
18823     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
18824 
18825    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
18826       goto erret;
18827    }
18828 
18829    av.intvalue = ptr -> type;
18830    retval = AsnWrite(aip, REMOVE_DUPLICATE_FEATURE_ACTION_type,  &av);
18831    av.boolvalue = ptr -> ignore_partials;
18832    retval = AsnWrite(aip, REMOVE_DUPLICATE_FEATURE_ACTION_ignore_partials,  &av);
18833    av.boolvalue = ptr -> case_sensitive;
18834    retval = AsnWrite(aip, REMOVE_DUPLICATE_FEATURE_ACTION_case_sensitive,  &av);
18835    av.boolvalue = ptr -> remove_proteins;
18836    retval = AsnWrite(aip, REMOVE_DUPLICATE_FEATURE_ACTION_remove_proteins,  &av);
18837    if (ptr -> rd_constraint != NULL) {
18838       if ( ! ConstraintChoiceSetAsnWrite(ptr -> rd_constraint, aip, REMOVE_DUPLICATE_FEATURE_ACTION_rd_constraint)) {
18839          goto erret;
18840       }
18841    }
18842    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
18843       goto erret;
18844    }
18845    retval = TRUE;
18846 
18847 erret:
18848    AsnUnlinkType(orig);       /* unlink local tree */
18849    return retval;
18850 }
18851 
18852 
18853 
18854 /**************************************************
18855 *
18856 *    GeneXrefTypeNew()
18857 *
18858 **************************************************/
18859 NLM_EXTERN
18860 GeneXrefTypePtr LIBCALL
GeneXrefTypeNew(void)18861 GeneXrefTypeNew(void)
18862 {
18863    GeneXrefTypePtr ptr = MemNew((size_t) sizeof(GeneXrefType));
18864 
18865    return ptr;
18866 
18867 }
18868 
18869 
18870 /**************************************************
18871 *
18872 *    GeneXrefTypeFree()
18873 *
18874 **************************************************/
18875 NLM_EXTERN
18876 GeneXrefTypePtr LIBCALL
GeneXrefTypeFree(GeneXrefTypePtr ptr)18877 GeneXrefTypeFree(GeneXrefTypePtr ptr)
18878 {
18879 
18880    if(ptr == NULL) {
18881       return NULL;
18882    }
18883    return MemFree(ptr);
18884 }
18885 
18886 
18887 /**************************************************
18888 *
18889 *    GeneXrefTypeAsnRead()
18890 *
18891 **************************************************/
18892 NLM_EXTERN
18893 GeneXrefTypePtr LIBCALL
GeneXrefTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)18894 GeneXrefTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
18895 {
18896    DataVal av;
18897    AsnTypePtr atp;
18898    Boolean isError = FALSE;
18899    AsnReadFunc func;
18900    GeneXrefTypePtr ptr;
18901 
18902    if (! loaded)
18903    {
18904       if (! objmacroAsnLoad()) {
18905          return NULL;
18906       }
18907    }
18908 
18909    if (aip == NULL) {
18910       return NULL;
18911    }
18912 
18913    if (orig == NULL) {         /* GeneXrefType ::= (self contained) */
18914       atp = AsnReadId(aip, amp, GENE_XREF_TYPE);
18915    } else {
18916       atp = AsnLinkType(orig, GENE_XREF_TYPE);
18917    }
18918    /* link in local tree */
18919    if (atp == NULL) {
18920       return NULL;
18921    }
18922 
18923    ptr = GeneXrefTypeNew();
18924    if (ptr == NULL) {
18925       goto erret;
18926    }
18927    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
18928       goto erret;
18929    }
18930 
18931    atp = AsnReadId(aip,amp, atp);
18932    func = NULL;
18933 
18934    if (atp == GENE_XREF_TYPE_feature) {
18935       if ( AsnReadVal(aip, atp, &av) <= 0) {
18936          goto erret;
18937       }
18938       ptr -> feature = av.intvalue;
18939       atp = AsnReadId(aip,amp, atp);
18940    }
18941    if (atp == GENE_XREF_TYPE_suppression) {
18942       if ( AsnReadVal(aip, atp, &av) <= 0) {
18943          goto erret;
18944       }
18945       ptr -> suppression = av.intvalue;
18946       atp = AsnReadId(aip,amp, atp);
18947    }
18948    if (atp == GENE_XREF_TYPE_necessary) {
18949       if ( AsnReadVal(aip, atp, &av) <= 0) {
18950          goto erret;
18951       }
18952       ptr -> necessary = av.intvalue;
18953       atp = AsnReadId(aip,amp, atp);
18954    }
18955 
18956    if (AsnReadVal(aip, atp, &av) <= 0) {
18957       goto erret;
18958    }
18959    /* end struct */
18960 
18961 ret:
18962    AsnUnlinkType(orig);       /* unlink local tree */
18963    return ptr;
18964 
18965 erret:
18966    aip -> io_failure = TRUE;
18967    ptr = GeneXrefTypeFree(ptr);
18968    goto ret;
18969 }
18970 
18971 
18972 
18973 /**************************************************
18974 *
18975 *    GeneXrefTypeAsnWrite()
18976 *
18977 **************************************************/
18978 NLM_EXTERN Boolean LIBCALL
GeneXrefTypeAsnWrite(GeneXrefTypePtr ptr,AsnIoPtr aip,AsnTypePtr orig)18979 GeneXrefTypeAsnWrite(GeneXrefTypePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
18980 {
18981    DataVal av;
18982    AsnTypePtr atp;
18983    Boolean retval = FALSE;
18984 
18985    if (! loaded)
18986    {
18987       if (! objmacroAsnLoad()) {
18988          return FALSE;
18989       }
18990    }
18991 
18992    if (aip == NULL) {
18993       return FALSE;
18994    }
18995 
18996    atp = AsnLinkType(orig, GENE_XREF_TYPE);   /* link local tree */
18997    if (atp == NULL) {
18998       return FALSE;
18999    }
19000 
19001    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
19002 
19003     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
19004 
19005    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
19006       goto erret;
19007    }
19008 
19009    av.intvalue = ptr -> feature;
19010    retval = AsnWrite(aip, GENE_XREF_TYPE_feature,  &av);
19011    av.intvalue = ptr -> suppression;
19012    retval = AsnWrite(aip, GENE_XREF_TYPE_suppression,  &av);
19013    av.intvalue = ptr -> necessary;
19014    retval = AsnWrite(aip, GENE_XREF_TYPE_necessary,  &av);
19015    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
19016       goto erret;
19017    }
19018    retval = TRUE;
19019 
19020 erret:
19021    AsnUnlinkType(orig);       /* unlink local tree */
19022    return retval;
19023 }
19024 
19025 
19026 
19027 /**************************************************
19028 *
19029 *    XrefTypeFree()
19030 *
19031 **************************************************/
19032 NLM_EXTERN
19033 XrefTypePtr LIBCALL
XrefTypeFree(ValNodePtr anp)19034 XrefTypeFree(ValNodePtr anp)
19035 {
19036    Pointer pnt;
19037 
19038    if (anp == NULL) {
19039       return NULL;
19040    }
19041 
19042    pnt = anp->data.ptrvalue;
19043    switch (anp->choice)
19044    {
19045    default:
19046       break;
19047    case XrefType_gene:
19048       GeneXrefTypeFree(anp -> data.ptrvalue);
19049       break;
19050    }
19051    return MemFree(anp);
19052 }
19053 
19054 
19055 /**************************************************
19056 *
19057 *    XrefTypeAsnRead()
19058 *
19059 **************************************************/
19060 NLM_EXTERN
19061 XrefTypePtr LIBCALL
XrefTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)19062 XrefTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
19063 {
19064    DataVal av;
19065    AsnTypePtr atp;
19066    ValNodePtr anp;
19067    Uint1 choice;
19068    Boolean isError = FALSE;
19069    Boolean nullIsError = FALSE;
19070    AsnReadFunc func;
19071 
19072    if (! loaded)
19073    {
19074       if (! objmacroAsnLoad()) {
19075          return NULL;
19076       }
19077    }
19078 
19079    if (aip == NULL) {
19080       return NULL;
19081    }
19082 
19083    if (orig == NULL) {         /* XrefType ::= (self contained) */
19084       atp = AsnReadId(aip, amp, XREF_TYPE);
19085    } else {
19086       atp = AsnLinkType(orig, XREF_TYPE);    /* link in local tree */
19087    }
19088    if (atp == NULL) {
19089       return NULL;
19090    }
19091 
19092    anp = ValNodeNew(NULL);
19093    if (anp == NULL) {
19094       goto erret;
19095    }
19096    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
19097       goto erret;
19098    }
19099 
19100    func = NULL;
19101 
19102    atp = AsnReadId(aip, amp, atp);  /* find the choice */
19103    if (atp == NULL) {
19104       goto erret;
19105    }
19106    if (atp == XREF_TYPE_gene) {
19107       choice = XrefType_gene;
19108       func = (AsnReadFunc) GeneXrefTypeAsnRead;
19109    }
19110    anp->choice = choice;
19111    if (func != NULL)
19112    {
19113       anp->data.ptrvalue = (* func)(aip, atp);
19114       if (aip -> io_failure) goto erret;
19115 
19116       if (nullIsError && anp->data.ptrvalue == NULL) {
19117          goto erret;
19118       }
19119    }
19120 
19121 ret:
19122    AsnUnlinkType(orig);       /* unlink local tree */
19123    return anp;
19124 
19125 erret:
19126    anp = MemFree(anp);
19127    aip -> io_failure = TRUE;
19128    goto ret;
19129 }
19130 
19131 
19132 /**************************************************
19133 *
19134 *    XrefTypeAsnWrite()
19135 *
19136 **************************************************/
19137 NLM_EXTERN Boolean LIBCALL
XrefTypeAsnWrite(XrefTypePtr anp,AsnIoPtr aip,AsnTypePtr orig)19138 XrefTypeAsnWrite(XrefTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
19139 
19140 {
19141    DataVal av;
19142    AsnTypePtr atp, writetype = NULL;
19143    Pointer pnt;
19144    AsnWriteFunc func = NULL;
19145    Boolean retval = FALSE;
19146 
19147    if (! loaded)
19148    {
19149       if (! objmacroAsnLoad())
19150       return FALSE;
19151    }
19152 
19153    if (aip == NULL)
19154    return FALSE;
19155 
19156    atp = AsnLinkType(orig, XREF_TYPE);   /* link local tree */
19157    if (atp == NULL) {
19158       return FALSE;
19159    }
19160 
19161    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
19162 
19163     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
19164 
19165    av.ptrvalue = (Pointer)anp;
19166    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
19167       goto erret;
19168    }
19169 
19170    pnt = anp->data.ptrvalue;
19171    switch (anp->choice)
19172    {
19173    case XrefType_gene:
19174       writetype = XREF_TYPE_gene;
19175       func = (AsnWriteFunc) GeneXrefTypeAsnWrite;
19176       break;
19177    }
19178    if (writetype != NULL) {
19179       retval = (* func)(pnt, aip, writetype);   /* write it out */
19180    }
19181    if (!retval) {
19182       goto erret;
19183    }
19184    retval = TRUE;
19185 
19186 erret:
19187    AsnUnlinkType(orig);       /* unlink local tree */
19188    return retval;
19189 }
19190 
19191 
19192 /**************************************************
19193 *
19194 *    RemoveXrefsActionNew()
19195 *
19196 **************************************************/
19197 NLM_EXTERN
19198 RemoveXrefsActionPtr LIBCALL
RemoveXrefsActionNew(void)19199 RemoveXrefsActionNew(void)
19200 {
19201    RemoveXrefsActionPtr ptr = MemNew((size_t) sizeof(RemoveXrefsAction));
19202 
19203    return ptr;
19204 
19205 }
19206 
19207 
19208 /**************************************************
19209 *
19210 *    RemoveXrefsActionFree()
19211 *
19212 **************************************************/
19213 NLM_EXTERN
19214 RemoveXrefsActionPtr LIBCALL
RemoveXrefsActionFree(RemoveXrefsActionPtr ptr)19215 RemoveXrefsActionFree(RemoveXrefsActionPtr ptr)
19216 {
19217 
19218    if(ptr == NULL) {
19219       return NULL;
19220    }
19221    XrefTypeFree(ptr -> xref_type);
19222    ConstraintChoiceSetFree(ptr -> constraint);
19223    return MemFree(ptr);
19224 }
19225 
19226 
19227 /**************************************************
19228 *
19229 *    RemoveXrefsActionAsnRead()
19230 *
19231 **************************************************/
19232 NLM_EXTERN
19233 RemoveXrefsActionPtr LIBCALL
RemoveXrefsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)19234 RemoveXrefsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
19235 {
19236    DataVal av;
19237    AsnTypePtr atp;
19238    Boolean isError = FALSE;
19239    AsnReadFunc func;
19240    RemoveXrefsActionPtr ptr;
19241 
19242    if (! loaded)
19243    {
19244       if (! objmacroAsnLoad()) {
19245          return NULL;
19246       }
19247    }
19248 
19249    if (aip == NULL) {
19250       return NULL;
19251    }
19252 
19253    if (orig == NULL) {         /* RemoveXrefsAction ::= (self contained) */
19254       atp = AsnReadId(aip, amp, REMOVE_XREFS_ACTION);
19255    } else {
19256       atp = AsnLinkType(orig, REMOVE_XREFS_ACTION);
19257    }
19258    /* link in local tree */
19259    if (atp == NULL) {
19260       return NULL;
19261    }
19262 
19263    ptr = RemoveXrefsActionNew();
19264    if (ptr == NULL) {
19265       goto erret;
19266    }
19267    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
19268       goto erret;
19269    }
19270 
19271    atp = AsnReadId(aip,amp, atp);
19272    func = NULL;
19273 
19274    if (atp == REMOVE_XREFS_ACTION_xref_type) {
19275       ptr -> xref_type = XrefTypeAsnRead(aip, atp);
19276       if (aip -> io_failure) {
19277          goto erret;
19278       }
19279       atp = AsnReadId(aip,amp, atp);
19280    }
19281    if (atp == REMOVE_XREFS_ACTION_constraint) {
19282       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
19283       if (aip -> io_failure) {
19284          goto erret;
19285       }
19286       atp = AsnReadId(aip,amp, atp);
19287    }
19288 
19289    if (AsnReadVal(aip, atp, &av) <= 0) {
19290       goto erret;
19291    }
19292    /* end struct */
19293 
19294 ret:
19295    AsnUnlinkType(orig);       /* unlink local tree */
19296    return ptr;
19297 
19298 erret:
19299    aip -> io_failure = TRUE;
19300    ptr = RemoveXrefsActionFree(ptr);
19301    goto ret;
19302 }
19303 
19304 
19305 
19306 /**************************************************
19307 *
19308 *    RemoveXrefsActionAsnWrite()
19309 *
19310 **************************************************/
19311 NLM_EXTERN Boolean LIBCALL
RemoveXrefsActionAsnWrite(RemoveXrefsActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)19312 RemoveXrefsActionAsnWrite(RemoveXrefsActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
19313 {
19314    DataVal av;
19315    AsnTypePtr atp;
19316    Boolean retval = FALSE;
19317 
19318    if (! loaded)
19319    {
19320       if (! objmacroAsnLoad()) {
19321          return FALSE;
19322       }
19323    }
19324 
19325    if (aip == NULL) {
19326       return FALSE;
19327    }
19328 
19329    atp = AsnLinkType(orig, REMOVE_XREFS_ACTION);   /* link local tree */
19330    if (atp == NULL) {
19331       return FALSE;
19332    }
19333 
19334    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
19335 
19336     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
19337 
19338    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
19339       goto erret;
19340    }
19341 
19342    if (ptr -> xref_type != NULL) {
19343       if ( ! XrefTypeAsnWrite(ptr -> xref_type, aip, REMOVE_XREFS_ACTION_xref_type)) {
19344          goto erret;
19345       }
19346    }
19347    if (ptr -> constraint != NULL) {
19348       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, REMOVE_XREFS_ACTION_constraint)) {
19349          goto erret;
19350       }
19351    }
19352    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
19353       goto erret;
19354    }
19355    retval = TRUE;
19356 
19357 erret:
19358    AsnUnlinkType(orig);       /* unlink local tree */
19359    return retval;
19360 }
19361 
19362 
19363 
19364 /**************************************************
19365 *
19366 *    MakeGeneXrefActionNew()
19367 *
19368 **************************************************/
19369 NLM_EXTERN
19370 MakeGeneXrefActionPtr LIBCALL
MakeGeneXrefActionNew(void)19371 MakeGeneXrefActionNew(void)
19372 {
19373    MakeGeneXrefActionPtr ptr = MemNew((size_t) sizeof(MakeGeneXrefAction));
19374 
19375    return ptr;
19376 
19377 }
19378 
19379 
19380 /**************************************************
19381 *
19382 *    MakeGeneXrefActionFree()
19383 *
19384 **************************************************/
19385 NLM_EXTERN
19386 MakeGeneXrefActionPtr LIBCALL
MakeGeneXrefActionFree(MakeGeneXrefActionPtr ptr)19387 MakeGeneXrefActionFree(MakeGeneXrefActionPtr ptr)
19388 {
19389 
19390    if(ptr == NULL) {
19391       return NULL;
19392    }
19393    ConstraintChoiceSetFree(ptr -> constraint);
19394    return MemFree(ptr);
19395 }
19396 
19397 
19398 /**************************************************
19399 *
19400 *    MakeGeneXrefActionAsnRead()
19401 *
19402 **************************************************/
19403 NLM_EXTERN
19404 MakeGeneXrefActionPtr LIBCALL
MakeGeneXrefActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)19405 MakeGeneXrefActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
19406 {
19407    DataVal av;
19408    AsnTypePtr atp;
19409    Boolean isError = FALSE;
19410    AsnReadFunc func;
19411    MakeGeneXrefActionPtr ptr;
19412 
19413    if (! loaded)
19414    {
19415       if (! objmacroAsnLoad()) {
19416          return NULL;
19417       }
19418    }
19419 
19420    if (aip == NULL) {
19421       return NULL;
19422    }
19423 
19424    if (orig == NULL) {         /* MakeGeneXrefAction ::= (self contained) */
19425       atp = AsnReadId(aip, amp, MAKE_GENE_XREF_ACTION);
19426    } else {
19427       atp = AsnLinkType(orig, MAKE_GENE_XREF_ACTION);
19428    }
19429    /* link in local tree */
19430    if (atp == NULL) {
19431       return NULL;
19432    }
19433 
19434    ptr = MakeGeneXrefActionNew();
19435    if (ptr == NULL) {
19436       goto erret;
19437    }
19438    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
19439       goto erret;
19440    }
19441 
19442    atp = AsnReadId(aip,amp, atp);
19443    func = NULL;
19444 
19445    if (atp == MAKE_GENE_XREF_ACTION_feature) {
19446       if ( AsnReadVal(aip, atp, &av) <= 0) {
19447          goto erret;
19448       }
19449       ptr -> feature = av.intvalue;
19450       atp = AsnReadId(aip,amp, atp);
19451    }
19452    if (atp == MAKE_GENE_XREF_ACTION_constraint) {
19453       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
19454       if (aip -> io_failure) {
19455          goto erret;
19456       }
19457       atp = AsnReadId(aip,amp, atp);
19458    }
19459 
19460    if (AsnReadVal(aip, atp, &av) <= 0) {
19461       goto erret;
19462    }
19463    /* end struct */
19464 
19465 ret:
19466    AsnUnlinkType(orig);       /* unlink local tree */
19467    return ptr;
19468 
19469 erret:
19470    aip -> io_failure = TRUE;
19471    ptr = MakeGeneXrefActionFree(ptr);
19472    goto ret;
19473 }
19474 
19475 
19476 
19477 /**************************************************
19478 *
19479 *    MakeGeneXrefActionAsnWrite()
19480 *
19481 **************************************************/
19482 NLM_EXTERN Boolean LIBCALL
MakeGeneXrefActionAsnWrite(MakeGeneXrefActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)19483 MakeGeneXrefActionAsnWrite(MakeGeneXrefActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
19484 {
19485    DataVal av;
19486    AsnTypePtr atp;
19487    Boolean retval = FALSE;
19488 
19489    if (! loaded)
19490    {
19491       if (! objmacroAsnLoad()) {
19492          return FALSE;
19493       }
19494    }
19495 
19496    if (aip == NULL) {
19497       return FALSE;
19498    }
19499 
19500    atp = AsnLinkType(orig, MAKE_GENE_XREF_ACTION);   /* link local tree */
19501    if (atp == NULL) {
19502       return FALSE;
19503    }
19504 
19505    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
19506 
19507     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
19508 
19509    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
19510       goto erret;
19511    }
19512 
19513    av.intvalue = ptr -> feature;
19514    retval = AsnWrite(aip, MAKE_GENE_XREF_ACTION_feature,  &av);
19515    if (ptr -> constraint != NULL) {
19516       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, MAKE_GENE_XREF_ACTION_constraint)) {
19517          goto erret;
19518       }
19519    }
19520    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
19521       goto erret;
19522    }
19523    retval = TRUE;
19524 
19525 erret:
19526    AsnUnlinkType(orig);       /* unlink local tree */
19527    return retval;
19528 }
19529 
19530 
19531 
19532 /**************************************************
19533 *
19534 *    AuthorFixActionNew()
19535 *
19536 **************************************************/
19537 NLM_EXTERN
19538 AuthorFixActionPtr LIBCALL
AuthorFixActionNew(void)19539 AuthorFixActionNew(void)
19540 {
19541    AuthorFixActionPtr ptr = MemNew((size_t) sizeof(AuthorFixAction));
19542 
19543    return ptr;
19544 
19545 }
19546 
19547 
19548 /**************************************************
19549 *
19550 *    AuthorFixActionFree()
19551 *
19552 **************************************************/
19553 NLM_EXTERN
19554 AuthorFixActionPtr LIBCALL
AuthorFixActionFree(AuthorFixActionPtr ptr)19555 AuthorFixActionFree(AuthorFixActionPtr ptr)
19556 {
19557 
19558    if(ptr == NULL) {
19559       return NULL;
19560    }
19561    ConstraintChoiceSetFree(ptr -> constraint);
19562    return MemFree(ptr);
19563 }
19564 
19565 
19566 /**************************************************
19567 *
19568 *    AuthorFixActionAsnRead()
19569 *
19570 **************************************************/
19571 NLM_EXTERN
19572 AuthorFixActionPtr LIBCALL
AuthorFixActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)19573 AuthorFixActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
19574 {
19575    DataVal av;
19576    AsnTypePtr atp;
19577    Boolean isError = FALSE;
19578    AsnReadFunc func;
19579    AuthorFixActionPtr ptr;
19580 
19581    if (! loaded)
19582    {
19583       if (! objmacroAsnLoad()) {
19584          return NULL;
19585       }
19586    }
19587 
19588    if (aip == NULL) {
19589       return NULL;
19590    }
19591 
19592    if (orig == NULL) {         /* AuthorFixAction ::= (self contained) */
19593       atp = AsnReadId(aip, amp, AUTHOR_FIX_ACTION);
19594    } else {
19595       atp = AsnLinkType(orig, AUTHOR_FIX_ACTION);
19596    }
19597    /* link in local tree */
19598    if (atp == NULL) {
19599       return NULL;
19600    }
19601 
19602    ptr = AuthorFixActionNew();
19603    if (ptr == NULL) {
19604       goto erret;
19605    }
19606    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
19607       goto erret;
19608    }
19609 
19610    atp = AsnReadId(aip,amp, atp);
19611    func = NULL;
19612 
19613    if (atp == AUTHOR_FIX_ACTION_fix_type) {
19614       if ( AsnReadVal(aip, atp, &av) <= 0) {
19615          goto erret;
19616       }
19617       ptr -> fix_type = av.intvalue;
19618       atp = AsnReadId(aip,amp, atp);
19619    }
19620    if (atp == AUTHOR_FIX_ACTION_constraint) {
19621       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
19622       if (aip -> io_failure) {
19623          goto erret;
19624       }
19625       atp = AsnReadId(aip,amp, atp);
19626    }
19627 
19628    if (AsnReadVal(aip, atp, &av) <= 0) {
19629       goto erret;
19630    }
19631    /* end struct */
19632 
19633 ret:
19634    AsnUnlinkType(orig);       /* unlink local tree */
19635    return ptr;
19636 
19637 erret:
19638    aip -> io_failure = TRUE;
19639    ptr = AuthorFixActionFree(ptr);
19640    goto ret;
19641 }
19642 
19643 
19644 
19645 /**************************************************
19646 *
19647 *    AuthorFixActionAsnWrite()
19648 *
19649 **************************************************/
19650 NLM_EXTERN Boolean LIBCALL
AuthorFixActionAsnWrite(AuthorFixActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)19651 AuthorFixActionAsnWrite(AuthorFixActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
19652 {
19653    DataVal av;
19654    AsnTypePtr atp;
19655    Boolean retval = FALSE;
19656 
19657    if (! loaded)
19658    {
19659       if (! objmacroAsnLoad()) {
19660          return FALSE;
19661       }
19662    }
19663 
19664    if (aip == NULL) {
19665       return FALSE;
19666    }
19667 
19668    atp = AsnLinkType(orig, AUTHOR_FIX_ACTION);   /* link local tree */
19669    if (atp == NULL) {
19670       return FALSE;
19671    }
19672 
19673    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
19674 
19675     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
19676 
19677    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
19678       goto erret;
19679    }
19680 
19681    av.intvalue = ptr -> fix_type;
19682    retval = AsnWrite(aip, AUTHOR_FIX_ACTION_fix_type,  &av);
19683    if (ptr -> constraint != NULL) {
19684       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, AUTHOR_FIX_ACTION_constraint)) {
19685          goto erret;
19686       }
19687    }
19688    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
19689       goto erret;
19690    }
19691    retval = TRUE;
19692 
19693 erret:
19694    AsnUnlinkType(orig);       /* unlink local tree */
19695    return retval;
19696 }
19697 
19698 
19699 
19700 /**************************************************
19701 *
19702 *    UpdateSequencesActionNew()
19703 *
19704 **************************************************/
19705 NLM_EXTERN
19706 UpdateSequencesActionPtr LIBCALL
UpdateSequencesActionNew(void)19707 UpdateSequencesActionNew(void)
19708 {
19709    UpdateSequencesActionPtr ptr = MemNew((size_t) sizeof(UpdateSequencesAction));
19710 
19711    ptr -> add_cit_subs = 0;
19712    return ptr;
19713 
19714 }
19715 
19716 
19717 /**************************************************
19718 *
19719 *    UpdateSequencesActionFree()
19720 *
19721 **************************************************/
19722 NLM_EXTERN
19723 UpdateSequencesActionPtr LIBCALL
UpdateSequencesActionFree(UpdateSequencesActionPtr ptr)19724 UpdateSequencesActionFree(UpdateSequencesActionPtr ptr)
19725 {
19726 
19727    if(ptr == NULL) {
19728       return NULL;
19729    }
19730    MemFree(ptr -> filename);
19731    return MemFree(ptr);
19732 }
19733 
19734 
19735 /**************************************************
19736 *
19737 *    UpdateSequencesActionAsnRead()
19738 *
19739 **************************************************/
19740 NLM_EXTERN
19741 UpdateSequencesActionPtr LIBCALL
UpdateSequencesActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)19742 UpdateSequencesActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
19743 {
19744    DataVal av;
19745    AsnTypePtr atp;
19746    Boolean isError = FALSE;
19747    AsnReadFunc func;
19748    UpdateSequencesActionPtr ptr;
19749 
19750    if (! loaded)
19751    {
19752       if (! objmacroAsnLoad()) {
19753          return NULL;
19754       }
19755    }
19756 
19757    if (aip == NULL) {
19758       return NULL;
19759    }
19760 
19761    if (orig == NULL) {         /* UpdateSequencesAction ::= (self contained) */
19762       atp = AsnReadId(aip, amp, UPDATE_SEQUENCES_ACTION);
19763    } else {
19764       atp = AsnLinkType(orig, UPDATE_SEQUENCES_ACTION);
19765    }
19766    /* link in local tree */
19767    if (atp == NULL) {
19768       return NULL;
19769    }
19770 
19771    ptr = UpdateSequencesActionNew();
19772    if (ptr == NULL) {
19773       goto erret;
19774    }
19775    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
19776       goto erret;
19777    }
19778 
19779    atp = AsnReadId(aip,amp, atp);
19780    func = NULL;
19781 
19782    if (atp == UPDATE_SEQUENCES_ACTION_filename) {
19783       if ( AsnReadVal(aip, atp, &av) <= 0) {
19784          goto erret;
19785       }
19786       ptr -> filename = av.ptrvalue;
19787       atp = AsnReadId(aip,amp, atp);
19788    }
19789    if (atp == UPDATE_SEQUENCES_ACTION_add_cit_subs) {
19790       if ( AsnReadVal(aip, atp, &av) <= 0) {
19791          goto erret;
19792       }
19793       ptr -> add_cit_subs = av.boolvalue;
19794       atp = AsnReadId(aip,amp, atp);
19795    }
19796 
19797    if (AsnReadVal(aip, atp, &av) <= 0) {
19798       goto erret;
19799    }
19800    /* end struct */
19801 
19802 ret:
19803    AsnUnlinkType(orig);       /* unlink local tree */
19804    return ptr;
19805 
19806 erret:
19807    aip -> io_failure = TRUE;
19808    ptr = UpdateSequencesActionFree(ptr);
19809    goto ret;
19810 }
19811 
19812 
19813 
19814 /**************************************************
19815 *
19816 *    UpdateSequencesActionAsnWrite()
19817 *
19818 **************************************************/
19819 NLM_EXTERN Boolean LIBCALL
UpdateSequencesActionAsnWrite(UpdateSequencesActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)19820 UpdateSequencesActionAsnWrite(UpdateSequencesActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
19821 {
19822    DataVal av;
19823    AsnTypePtr atp;
19824    Boolean retval = FALSE;
19825 
19826    if (! loaded)
19827    {
19828       if (! objmacroAsnLoad()) {
19829          return FALSE;
19830       }
19831    }
19832 
19833    if (aip == NULL) {
19834       return FALSE;
19835    }
19836 
19837    atp = AsnLinkType(orig, UPDATE_SEQUENCES_ACTION);   /* link local tree */
19838    if (atp == NULL) {
19839       return FALSE;
19840    }
19841 
19842    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
19843 
19844     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
19845 
19846    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
19847       goto erret;
19848    }
19849 
19850    if (ptr -> filename != NULL) {
19851       av.ptrvalue = ptr -> filename;
19852       retval = AsnWrite(aip, UPDATE_SEQUENCES_ACTION_filename,  &av);
19853    }
19854    av.boolvalue = ptr -> add_cit_subs;
19855    retval = AsnWrite(aip, UPDATE_SEQUENCES_ACTION_add_cit_subs,  &av);
19856    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
19857       goto erret;
19858    }
19859    retval = TRUE;
19860 
19861 erret:
19862    AsnUnlinkType(orig);       /* unlink local tree */
19863    return retval;
19864 }
19865 
19866 
19867 
19868 /**************************************************
19869 *
19870 *    CreateTSAIdsSrcFree()
19871 *
19872 **************************************************/
19873 NLM_EXTERN
19874 CreateTSAIdsSrcPtr LIBCALL
CreateTSAIdsSrcFree(ValNodePtr anp)19875 CreateTSAIdsSrcFree(ValNodePtr anp)
19876 {
19877    Pointer pnt;
19878 
19879    if (anp == NULL) {
19880       return NULL;
19881    }
19882 
19883    pnt = anp->data.ptrvalue;
19884    switch (anp->choice)
19885    {
19886    default:
19887       break;
19888    case CreateTSAIdsSrc_defline:
19889       TextPortionFree(anp -> data.ptrvalue);
19890       break;
19891    }
19892    return MemFree(anp);
19893 }
19894 
19895 
19896 /**************************************************
19897 *
19898 *    CreateTSAIdsSrcAsnRead()
19899 *
19900 **************************************************/
19901 NLM_EXTERN
19902 CreateTSAIdsSrcPtr LIBCALL
CreateTSAIdsSrcAsnRead(AsnIoPtr aip,AsnTypePtr orig)19903 CreateTSAIdsSrcAsnRead(AsnIoPtr aip, AsnTypePtr orig)
19904 {
19905    DataVal av;
19906    AsnTypePtr atp;
19907    ValNodePtr anp;
19908    Uint1 choice;
19909    Boolean isError = FALSE;
19910    Boolean nullIsError = FALSE;
19911    AsnReadFunc func;
19912 
19913    if (! loaded)
19914    {
19915       if (! objmacroAsnLoad()) {
19916          return NULL;
19917       }
19918    }
19919 
19920    if (aip == NULL) {
19921       return NULL;
19922    }
19923 
19924    if (orig == NULL) {         /* CreateTSAIdsSrc ::= (self contained) */
19925       atp = AsnReadId(aip, amp, CREATE_TSA_IDS_SRC);
19926    } else {
19927       atp = AsnLinkType(orig, CREATE_TSA_IDS_SRC);    /* link in local tree */
19928    }
19929    if (atp == NULL) {
19930       return NULL;
19931    }
19932 
19933    anp = ValNodeNew(NULL);
19934    if (anp == NULL) {
19935       goto erret;
19936    }
19937    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
19938       goto erret;
19939    }
19940 
19941    func = NULL;
19942 
19943    atp = AsnReadId(aip, amp, atp);  /* find the choice */
19944    if (atp == NULL) {
19945       goto erret;
19946    }
19947    if (atp == CREATE_TSA_IDS_SRC_local_id) {
19948       choice = CreateTSAIdsSrc_local_id;
19949       if (AsnReadVal(aip, atp, &av) <= 0) {
19950          goto erret;
19951       }
19952       anp->data.boolvalue = av.boolvalue;
19953    }
19954    else if (atp == CREATE_TSA_IDS_SRC_defline) {
19955       choice = CreateTSAIdsSrc_defline;
19956       func = (AsnReadFunc) TextPortionAsnRead;
19957    }
19958    anp->choice = choice;
19959    if (func != NULL)
19960    {
19961       anp->data.ptrvalue = (* func)(aip, atp);
19962       if (aip -> io_failure) goto erret;
19963 
19964       if (nullIsError && anp->data.ptrvalue == NULL) {
19965          goto erret;
19966       }
19967    }
19968 
19969 ret:
19970    AsnUnlinkType(orig);       /* unlink local tree */
19971    return anp;
19972 
19973 erret:
19974    anp = MemFree(anp);
19975    aip -> io_failure = TRUE;
19976    goto ret;
19977 }
19978 
19979 
19980 /**************************************************
19981 *
19982 *    CreateTSAIdsSrcAsnWrite()
19983 *
19984 **************************************************/
19985 NLM_EXTERN Boolean LIBCALL
CreateTSAIdsSrcAsnWrite(CreateTSAIdsSrcPtr anp,AsnIoPtr aip,AsnTypePtr orig)19986 CreateTSAIdsSrcAsnWrite(CreateTSAIdsSrcPtr anp, AsnIoPtr aip, AsnTypePtr orig)
19987 
19988 {
19989    DataVal av;
19990    AsnTypePtr atp, writetype = NULL;
19991    Pointer pnt;
19992    AsnWriteFunc func = NULL;
19993    Boolean retval = FALSE;
19994 
19995    if (! loaded)
19996    {
19997       if (! objmacroAsnLoad())
19998       return FALSE;
19999    }
20000 
20001    if (aip == NULL)
20002    return FALSE;
20003 
20004    atp = AsnLinkType(orig, CREATE_TSA_IDS_SRC);   /* link local tree */
20005    if (atp == NULL) {
20006       return FALSE;
20007    }
20008 
20009    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
20010 
20011     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
20012 
20013    av.ptrvalue = (Pointer)anp;
20014    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
20015       goto erret;
20016    }
20017 
20018    pnt = anp->data.ptrvalue;
20019    switch (anp->choice)
20020    {
20021    case CreateTSAIdsSrc_local_id:
20022       av.boolvalue = anp->data.boolvalue;
20023       retval = AsnWrite(aip, CREATE_TSA_IDS_SRC_local_id, &av);
20024       break;
20025    case CreateTSAIdsSrc_defline:
20026       writetype = CREATE_TSA_IDS_SRC_defline;
20027       func = (AsnWriteFunc) TextPortionAsnWrite;
20028       break;
20029    }
20030    if (writetype != NULL) {
20031       retval = (* func)(pnt, aip, writetype);   /* write it out */
20032    }
20033    if (!retval) {
20034       goto erret;
20035    }
20036    retval = TRUE;
20037 
20038 erret:
20039    AsnUnlinkType(orig);       /* unlink local tree */
20040    return retval;
20041 }
20042 
20043 
20044 /**************************************************
20045 *
20046 *    CreateTSAIdsActionNew()
20047 *
20048 **************************************************/
20049 NLM_EXTERN
20050 CreateTSAIdsActionPtr LIBCALL
CreateTSAIdsActionNew(void)20051 CreateTSAIdsActionNew(void)
20052 {
20053    CreateTSAIdsActionPtr ptr = MemNew((size_t) sizeof(CreateTSAIdsAction));
20054 
20055    return ptr;
20056 
20057 }
20058 
20059 
20060 /**************************************************
20061 *
20062 *    CreateTSAIdsActionFree()
20063 *
20064 **************************************************/
20065 NLM_EXTERN
20066 CreateTSAIdsActionPtr LIBCALL
CreateTSAIdsActionFree(CreateTSAIdsActionPtr ptr)20067 CreateTSAIdsActionFree(CreateTSAIdsActionPtr ptr)
20068 {
20069 
20070    if(ptr == NULL) {
20071       return NULL;
20072    }
20073    CreateTSAIdsSrcFree(ptr -> src);
20074    MemFree(ptr -> suffix);
20075    TextPortionFree(ptr -> id_text_portion);
20076    return MemFree(ptr);
20077 }
20078 
20079 
20080 /**************************************************
20081 *
20082 *    CreateTSAIdsActionAsnRead()
20083 *
20084 **************************************************/
20085 NLM_EXTERN
20086 CreateTSAIdsActionPtr LIBCALL
CreateTSAIdsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)20087 CreateTSAIdsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
20088 {
20089    DataVal av;
20090    AsnTypePtr atp;
20091    Boolean isError = FALSE;
20092    AsnReadFunc func;
20093    CreateTSAIdsActionPtr ptr;
20094 
20095    if (! loaded)
20096    {
20097       if (! objmacroAsnLoad()) {
20098          return NULL;
20099       }
20100    }
20101 
20102    if (aip == NULL) {
20103       return NULL;
20104    }
20105 
20106    if (orig == NULL) {         /* CreateTSAIdsAction ::= (self contained) */
20107       atp = AsnReadId(aip, amp, CREATE_TSA_IDS_ACTION);
20108    } else {
20109       atp = AsnLinkType(orig, CREATE_TSA_IDS_ACTION);
20110    }
20111    /* link in local tree */
20112    if (atp == NULL) {
20113       return NULL;
20114    }
20115 
20116    ptr = CreateTSAIdsActionNew();
20117    if (ptr == NULL) {
20118       goto erret;
20119    }
20120    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
20121       goto erret;
20122    }
20123 
20124    atp = AsnReadId(aip,amp, atp);
20125    func = NULL;
20126 
20127    if (atp == CREATE_TSA_IDS_ACTION_src) {
20128       ptr -> src = CreateTSAIdsSrcAsnRead(aip, atp);
20129       if (aip -> io_failure) {
20130          goto erret;
20131       }
20132       atp = AsnReadId(aip,amp, atp);
20133    }
20134    if (atp == CREATE_TSA_IDS_ACTION_suffix) {
20135       if ( AsnReadVal(aip, atp, &av) <= 0) {
20136          goto erret;
20137       }
20138       ptr -> suffix = av.ptrvalue;
20139       atp = AsnReadId(aip,amp, atp);
20140    }
20141    if (atp == CREATE_TSA_IDS_ACTION_id_text_portion) {
20142       ptr -> id_text_portion = TextPortionAsnRead(aip, atp);
20143       if (aip -> io_failure) {
20144          goto erret;
20145       }
20146       atp = AsnReadId(aip,amp, atp);
20147    }
20148 
20149    if (AsnReadVal(aip, atp, &av) <= 0) {
20150       goto erret;
20151    }
20152    /* end struct */
20153 
20154 ret:
20155    AsnUnlinkType(orig);       /* unlink local tree */
20156    return ptr;
20157 
20158 erret:
20159    aip -> io_failure = TRUE;
20160    ptr = CreateTSAIdsActionFree(ptr);
20161    goto ret;
20162 }
20163 
20164 
20165 
20166 /**************************************************
20167 *
20168 *    CreateTSAIdsActionAsnWrite()
20169 *
20170 **************************************************/
20171 NLM_EXTERN Boolean LIBCALL
CreateTSAIdsActionAsnWrite(CreateTSAIdsActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)20172 CreateTSAIdsActionAsnWrite(CreateTSAIdsActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
20173 {
20174    DataVal av;
20175    AsnTypePtr atp;
20176    Boolean retval = FALSE;
20177 
20178    if (! loaded)
20179    {
20180       if (! objmacroAsnLoad()) {
20181          return FALSE;
20182       }
20183    }
20184 
20185    if (aip == NULL) {
20186       return FALSE;
20187    }
20188 
20189    atp = AsnLinkType(orig, CREATE_TSA_IDS_ACTION);   /* link local tree */
20190    if (atp == NULL) {
20191       return FALSE;
20192    }
20193 
20194    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
20195 
20196     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
20197 
20198    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
20199       goto erret;
20200    }
20201 
20202    if (ptr -> src != NULL) {
20203       if ( ! CreateTSAIdsSrcAsnWrite(ptr -> src, aip, CREATE_TSA_IDS_ACTION_src)) {
20204          goto erret;
20205       }
20206    }
20207    if (ptr -> suffix != NULL) {
20208       av.ptrvalue = ptr -> suffix;
20209       retval = AsnWrite(aip, CREATE_TSA_IDS_ACTION_suffix,  &av);
20210    }
20211    if (ptr -> id_text_portion != NULL) {
20212       if ( ! TextPortionAsnWrite(ptr -> id_text_portion, aip, CREATE_TSA_IDS_ACTION_id_text_portion)) {
20213          goto erret;
20214       }
20215    }
20216    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
20217       goto erret;
20218    }
20219    retval = TRUE;
20220 
20221 erret:
20222    AsnUnlinkType(orig);       /* unlink local tree */
20223    return retval;
20224 }
20225 
20226 
20227 
20228 /**************************************************
20229 *
20230 *    AutofixActionNew()
20231 *
20232 **************************************************/
20233 NLM_EXTERN
20234 AutofixActionPtr LIBCALL
AutofixActionNew(void)20235 AutofixActionNew(void)
20236 {
20237    AutofixActionPtr ptr = MemNew((size_t) sizeof(AutofixAction));
20238 
20239    return ptr;
20240 
20241 }
20242 
20243 
20244 /**************************************************
20245 *
20246 *    AutofixActionFree()
20247 *
20248 **************************************************/
20249 NLM_EXTERN
20250 AutofixActionPtr LIBCALL
AutofixActionFree(AutofixActionPtr ptr)20251 AutofixActionFree(AutofixActionPtr ptr)
20252 {
20253 
20254    if(ptr == NULL) {
20255       return NULL;
20256    }
20257    MemFree(ptr -> test_name);
20258    return MemFree(ptr);
20259 }
20260 
20261 
20262 /**************************************************
20263 *
20264 *    AutofixActionAsnRead()
20265 *
20266 **************************************************/
20267 NLM_EXTERN
20268 AutofixActionPtr LIBCALL
AutofixActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)20269 AutofixActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
20270 {
20271    DataVal av;
20272    AsnTypePtr atp;
20273    Boolean isError = FALSE;
20274    AsnReadFunc func;
20275    AutofixActionPtr ptr;
20276 
20277    if (! loaded)
20278    {
20279       if (! objmacroAsnLoad()) {
20280          return NULL;
20281       }
20282    }
20283 
20284    if (aip == NULL) {
20285       return NULL;
20286    }
20287 
20288    if (orig == NULL) {         /* AutofixAction ::= (self contained) */
20289       atp = AsnReadId(aip, amp, AUTOFIX_ACTION);
20290    } else {
20291       atp = AsnLinkType(orig, AUTOFIX_ACTION);
20292    }
20293    /* link in local tree */
20294    if (atp == NULL) {
20295       return NULL;
20296    }
20297 
20298    ptr = AutofixActionNew();
20299    if (ptr == NULL) {
20300       goto erret;
20301    }
20302    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
20303       goto erret;
20304    }
20305 
20306    atp = AsnReadId(aip,amp, atp);
20307    func = NULL;
20308 
20309    if (atp == AUTOFIX_ACTION_test_name) {
20310       if ( AsnReadVal(aip, atp, &av) <= 0) {
20311          goto erret;
20312       }
20313       ptr -> test_name = av.ptrvalue;
20314       atp = AsnReadId(aip,amp, atp);
20315    }
20316 
20317    if (AsnReadVal(aip, atp, &av) <= 0) {
20318       goto erret;
20319    }
20320    /* end struct */
20321 
20322 ret:
20323    AsnUnlinkType(orig);       /* unlink local tree */
20324    return ptr;
20325 
20326 erret:
20327    aip -> io_failure = TRUE;
20328    ptr = AutofixActionFree(ptr);
20329    goto ret;
20330 }
20331 
20332 
20333 
20334 /**************************************************
20335 *
20336 *    AutofixActionAsnWrite()
20337 *
20338 **************************************************/
20339 NLM_EXTERN Boolean LIBCALL
AutofixActionAsnWrite(AutofixActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)20340 AutofixActionAsnWrite(AutofixActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
20341 {
20342    DataVal av;
20343    AsnTypePtr atp;
20344    Boolean retval = FALSE;
20345 
20346    if (! loaded)
20347    {
20348       if (! objmacroAsnLoad()) {
20349          return FALSE;
20350       }
20351    }
20352 
20353    if (aip == NULL) {
20354       return FALSE;
20355    }
20356 
20357    atp = AsnLinkType(orig, AUTOFIX_ACTION);   /* link local tree */
20358    if (atp == NULL) {
20359       return FALSE;
20360    }
20361 
20362    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
20363 
20364     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
20365 
20366    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
20367       goto erret;
20368    }
20369 
20370    if (ptr -> test_name != NULL) {
20371       av.ptrvalue = ptr -> test_name;
20372       retval = AsnWrite(aip, AUTOFIX_ACTION_test_name,  &av);
20373    }
20374    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
20375       goto erret;
20376    }
20377    retval = TRUE;
20378 
20379 erret:
20380    AsnUnlinkType(orig);       /* unlink local tree */
20381    return retval;
20382 }
20383 
20384 
20385 
20386 /**************************************************
20387 *
20388 *    FixSetsActionFree()
20389 *
20390 **************************************************/
20391 NLM_EXTERN
20392 FixSetsActionPtr LIBCALL
FixSetsActionFree(ValNodePtr anp)20393 FixSetsActionFree(ValNodePtr anp)
20394 {
20395    Pointer pnt;
20396 
20397    if (anp == NULL) {
20398       return NULL;
20399    }
20400 
20401    pnt = anp->data.ptrvalue;
20402    switch (anp->choice)
20403    {
20404    default:
20405       break;
20406    }
20407    return MemFree(anp);
20408 }
20409 
20410 
20411 /**************************************************
20412 *
20413 *    FixSetsActionAsnRead()
20414 *
20415 **************************************************/
20416 NLM_EXTERN
20417 FixSetsActionPtr LIBCALL
FixSetsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)20418 FixSetsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
20419 {
20420    DataVal av;
20421    AsnTypePtr atp;
20422    ValNodePtr anp;
20423    Uint1 choice;
20424    Boolean isError = FALSE;
20425    Boolean nullIsError = FALSE;
20426    AsnReadFunc func;
20427 
20428    if (! loaded)
20429    {
20430       if (! objmacroAsnLoad()) {
20431          return NULL;
20432       }
20433    }
20434 
20435    if (aip == NULL) {
20436       return NULL;
20437    }
20438 
20439    if (orig == NULL) {         /* FixSetsAction ::= (self contained) */
20440       atp = AsnReadId(aip, amp, FIX_SETS_ACTION);
20441    } else {
20442       atp = AsnLinkType(orig, FIX_SETS_ACTION);    /* link in local tree */
20443    }
20444    if (atp == NULL) {
20445       return NULL;
20446    }
20447 
20448    anp = ValNodeNew(NULL);
20449    if (anp == NULL) {
20450       goto erret;
20451    }
20452    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
20453       goto erret;
20454    }
20455 
20456    func = NULL;
20457 
20458    atp = AsnReadId(aip, amp, atp);  /* find the choice */
20459    if (atp == NULL) {
20460       goto erret;
20461    }
20462    if (atp == FIX_SETS_ACTION_remove_single_item_set) {
20463       choice = FixSetsAction_remove_single_item_set;
20464       if (AsnReadVal(aip, atp, &av) <= 0) {
20465          goto erret;
20466       }
20467       anp->data.boolvalue = av.boolvalue;
20468    }
20469    else if (atp == FIX_SETS_ACTION_renormalize_nuc_prot_sets) {
20470       choice = FixSetsAction_renormalize_nuc_prot_sets;
20471       if (AsnReadVal(aip, atp, &av) <= 0) {
20472          goto erret;
20473       }
20474       anp->data.boolvalue = av.boolvalue;
20475    }
20476    else if (atp == FIX_SETS_ACTION_fix_pop_to_phy) {
20477       choice = FixSetsAction_fix_pop_to_phy;
20478       if (AsnReadVal(aip, atp, &av) <= 0) {
20479          goto erret;
20480       }
20481       anp->data.boolvalue = av.boolvalue;
20482    }
20483    anp->choice = choice;
20484    if (func != NULL)
20485    {
20486       anp->data.ptrvalue = (* func)(aip, atp);
20487       if (aip -> io_failure) goto erret;
20488 
20489       if (nullIsError && anp->data.ptrvalue == NULL) {
20490          goto erret;
20491       }
20492    }
20493 
20494 ret:
20495    AsnUnlinkType(orig);       /* unlink local tree */
20496    return anp;
20497 
20498 erret:
20499    anp = MemFree(anp);
20500    aip -> io_failure = TRUE;
20501    goto ret;
20502 }
20503 
20504 
20505 /**************************************************
20506 *
20507 *    FixSetsActionAsnWrite()
20508 *
20509 **************************************************/
20510 NLM_EXTERN Boolean LIBCALL
FixSetsActionAsnWrite(FixSetsActionPtr anp,AsnIoPtr aip,AsnTypePtr orig)20511 FixSetsActionAsnWrite(FixSetsActionPtr anp, AsnIoPtr aip, AsnTypePtr orig)
20512 
20513 {
20514    DataVal av;
20515    AsnTypePtr atp, writetype = NULL;
20516    Pointer pnt;
20517    AsnWriteFunc func = NULL;
20518    Boolean retval = FALSE;
20519 
20520    if (! loaded)
20521    {
20522       if (! objmacroAsnLoad())
20523       return FALSE;
20524    }
20525 
20526    if (aip == NULL)
20527    return FALSE;
20528 
20529    atp = AsnLinkType(orig, FIX_SETS_ACTION);   /* link local tree */
20530    if (atp == NULL) {
20531       return FALSE;
20532    }
20533 
20534    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
20535 
20536     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
20537 
20538    av.ptrvalue = (Pointer)anp;
20539    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
20540       goto erret;
20541    }
20542 
20543    pnt = anp->data.ptrvalue;
20544    switch (anp->choice)
20545    {
20546    case FixSetsAction_remove_single_item_set:
20547       av.boolvalue = anp->data.boolvalue;
20548       retval = AsnWrite(aip, FIX_SETS_ACTION_remove_single_item_set, &av);
20549       break;
20550    case FixSetsAction_renormalize_nuc_prot_sets:
20551       av.boolvalue = anp->data.boolvalue;
20552       retval = AsnWrite(aip, FIX_SETS_ACTION_renormalize_nuc_prot_sets, &av);
20553       break;
20554    case FixSetsAction_fix_pop_to_phy:
20555       av.boolvalue = anp->data.boolvalue;
20556       retval = AsnWrite(aip, FIX_SETS_ACTION_fix_pop_to_phy, &av);
20557       break;
20558    }
20559    if (writetype != NULL) {
20560       retval = (* func)(pnt, aip, writetype);   /* write it out */
20561    }
20562    if (!retval) {
20563       goto erret;
20564    }
20565    retval = TRUE;
20566 
20567 erret:
20568    AsnUnlinkType(orig);       /* unlink local tree */
20569    return retval;
20570 }
20571 
20572 
20573 /**************************************************
20574 *
20575 *    TableMatchTypeFree()
20576 *
20577 **************************************************/
20578 NLM_EXTERN
20579 TableMatchTypePtr LIBCALL
TableMatchTypeFree(ValNodePtr anp)20580 TableMatchTypeFree(ValNodePtr anp)
20581 {
20582    Pointer pnt;
20583 
20584    if (anp == NULL) {
20585       return NULL;
20586    }
20587 
20588    pnt = anp->data.ptrvalue;
20589    switch (anp->choice)
20590    {
20591    default:
20592       break;
20593    case TableMatchType_src_qual:
20594       SourceQualChoiceFree(anp -> data.ptrvalue);
20595       break;
20596    }
20597    return MemFree(anp);
20598 }
20599 
20600 
20601 /**************************************************
20602 *
20603 *    TableMatchTypeAsnRead()
20604 *
20605 **************************************************/
20606 NLM_EXTERN
20607 TableMatchTypePtr LIBCALL
TableMatchTypeAsnRead(AsnIoPtr aip,AsnTypePtr orig)20608 TableMatchTypeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
20609 {
20610    DataVal av;
20611    AsnTypePtr atp;
20612    ValNodePtr anp;
20613    Uint1 choice;
20614    Boolean isError = FALSE;
20615    Boolean nullIsError = FALSE;
20616    AsnReadFunc func;
20617 
20618    if (! loaded)
20619    {
20620       if (! objmacroAsnLoad()) {
20621          return NULL;
20622       }
20623    }
20624 
20625    if (aip == NULL) {
20626       return NULL;
20627    }
20628 
20629    if (orig == NULL) {         /* TableMatchType ::= (self contained) */
20630       atp = AsnReadId(aip, amp, TABLE_MATCH_TYPE);
20631    } else {
20632       atp = AsnLinkType(orig, TABLE_MATCH_TYPE);    /* link in local tree */
20633    }
20634    if (atp == NULL) {
20635       return NULL;
20636    }
20637 
20638    anp = ValNodeNew(NULL);
20639    if (anp == NULL) {
20640       goto erret;
20641    }
20642    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
20643       goto erret;
20644    }
20645 
20646    func = NULL;
20647 
20648    atp = AsnReadId(aip, amp, atp);  /* find the choice */
20649    if (atp == NULL) {
20650       goto erret;
20651    }
20652    if (atp == TABLE_MATCH_TYPE_feature_id) {
20653       choice = TableMatchType_feature_id;
20654       if (AsnReadVal(aip, atp, &av) <= 0) {
20655          goto erret;
20656       }
20657       anp->data.boolvalue = av.boolvalue;
20658    }
20659    else if (atp == TABLE_MATCH_TYPE_gene_locus_tag) {
20660       choice = TableMatchType_gene_locus_tag;
20661       if (AsnReadVal(aip, atp, &av) <= 0) {
20662          goto erret;
20663       }
20664       anp->data.boolvalue = av.boolvalue;
20665    }
20666    else if (atp == TABLE_MATCH_TYPE_protein_id) {
20667       choice = TableMatchType_protein_id;
20668       if (AsnReadVal(aip, atp, &av) <= 0) {
20669          goto erret;
20670       }
20671       anp->data.boolvalue = av.boolvalue;
20672    }
20673    else if (atp == TABLE_MATCH_TYPE_dbxref) {
20674       choice = TableMatchType_dbxref;
20675       if (AsnReadVal(aip, atp, &av) <= 0) {
20676          goto erret;
20677       }
20678       anp->data.boolvalue = av.boolvalue;
20679    }
20680    else if (atp == TABLE_MATCH_TYPE_nuc_id) {
20681       choice = TableMatchType_nuc_id;
20682       if (AsnReadVal(aip, atp, &av) <= 0) {
20683          goto erret;
20684       }
20685       anp->data.boolvalue = av.boolvalue;
20686    }
20687    else if (atp == TABLE_MATCH_TYPE_src_qual) {
20688       choice = TableMatchType_src_qual;
20689       func = (AsnReadFunc) SourceQualChoiceAsnRead;
20690    }
20691    else if (atp == TABLE_MATCH_TYPE_protein_name) {
20692       choice = TableMatchType_protein_name;
20693       if (AsnReadVal(aip, atp, &av) <= 0) {
20694          goto erret;
20695       }
20696       anp->data.boolvalue = av.boolvalue;
20697    }
20698    else if (atp == TABLE_MATCH_TYPE_bioproject) {
20699       choice = TableMatchType_bioproject;
20700       if (AsnReadVal(aip, atp, &av) <= 0) {
20701          goto erret;
20702       }
20703       anp->data.boolvalue = av.boolvalue;
20704    }
20705    else if (atp == TABLE_MATCH_TYPE_any) {
20706       choice = TableMatchType_any;
20707       if (AsnReadVal(aip, atp, &av) <= 0) {
20708          goto erret;
20709       }
20710       anp->data.boolvalue = av.boolvalue;
20711    }
20712    anp->choice = choice;
20713    if (func != NULL)
20714    {
20715       anp->data.ptrvalue = (* func)(aip, atp);
20716       if (aip -> io_failure) goto erret;
20717 
20718       if (nullIsError && anp->data.ptrvalue == NULL) {
20719          goto erret;
20720       }
20721    }
20722 
20723 ret:
20724    AsnUnlinkType(orig);       /* unlink local tree */
20725    return anp;
20726 
20727 erret:
20728    anp = MemFree(anp);
20729    aip -> io_failure = TRUE;
20730    goto ret;
20731 }
20732 
20733 
20734 /**************************************************
20735 *
20736 *    TableMatchTypeAsnWrite()
20737 *
20738 **************************************************/
20739 NLM_EXTERN Boolean LIBCALL
TableMatchTypeAsnWrite(TableMatchTypePtr anp,AsnIoPtr aip,AsnTypePtr orig)20740 TableMatchTypeAsnWrite(TableMatchTypePtr anp, AsnIoPtr aip, AsnTypePtr orig)
20741 
20742 {
20743    DataVal av;
20744    AsnTypePtr atp, writetype = NULL;
20745    Pointer pnt;
20746    AsnWriteFunc func = NULL;
20747    Boolean retval = FALSE;
20748 
20749    if (! loaded)
20750    {
20751       if (! objmacroAsnLoad())
20752       return FALSE;
20753    }
20754 
20755    if (aip == NULL)
20756    return FALSE;
20757 
20758    atp = AsnLinkType(orig, TABLE_MATCH_TYPE);   /* link local tree */
20759    if (atp == NULL) {
20760       return FALSE;
20761    }
20762 
20763    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
20764 
20765     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
20766 
20767    av.ptrvalue = (Pointer)anp;
20768    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
20769       goto erret;
20770    }
20771 
20772    pnt = anp->data.ptrvalue;
20773    switch (anp->choice)
20774    {
20775    case TableMatchType_feature_id:
20776       av.boolvalue = anp->data.boolvalue;
20777       retval = AsnWrite(aip, TABLE_MATCH_TYPE_feature_id, &av);
20778       break;
20779    case TableMatchType_gene_locus_tag:
20780       av.boolvalue = anp->data.boolvalue;
20781       retval = AsnWrite(aip, TABLE_MATCH_TYPE_gene_locus_tag, &av);
20782       break;
20783    case TableMatchType_protein_id:
20784       av.boolvalue = anp->data.boolvalue;
20785       retval = AsnWrite(aip, TABLE_MATCH_TYPE_protein_id, &av);
20786       break;
20787    case TableMatchType_dbxref:
20788       av.boolvalue = anp->data.boolvalue;
20789       retval = AsnWrite(aip, TABLE_MATCH_TYPE_dbxref, &av);
20790       break;
20791    case TableMatchType_nuc_id:
20792       av.boolvalue = anp->data.boolvalue;
20793       retval = AsnWrite(aip, TABLE_MATCH_TYPE_nuc_id, &av);
20794       break;
20795    case TableMatchType_src_qual:
20796       writetype = TABLE_MATCH_TYPE_src_qual;
20797       func = (AsnWriteFunc) SourceQualChoiceAsnWrite;
20798       break;
20799    case TableMatchType_protein_name:
20800       av.boolvalue = anp->data.boolvalue;
20801       retval = AsnWrite(aip, TABLE_MATCH_TYPE_protein_name, &av);
20802       break;
20803    case TableMatchType_bioproject:
20804       av.boolvalue = anp->data.boolvalue;
20805       retval = AsnWrite(aip, TABLE_MATCH_TYPE_bioproject, &av);
20806       break;
20807    case TableMatchType_any:
20808       av.boolvalue = anp->data.boolvalue;
20809       retval = AsnWrite(aip, TABLE_MATCH_TYPE_any, &av);
20810       break;
20811    }
20812    if (writetype != NULL) {
20813       retval = (* func)(pnt, aip, writetype);   /* write it out */
20814    }
20815    if (!retval) {
20816       goto erret;
20817    }
20818    retval = TRUE;
20819 
20820 erret:
20821    AsnUnlinkType(orig);       /* unlink local tree */
20822    return retval;
20823 }
20824 
20825 
20826 /**************************************************
20827 *
20828 *    TableMatchNew()
20829 *
20830 **************************************************/
20831 NLM_EXTERN
20832 TableMatchPtr LIBCALL
TableMatchNew(void)20833 TableMatchNew(void)
20834 {
20835    TableMatchPtr ptr = MemNew((size_t) sizeof(TableMatch));
20836 
20837    ptr -> match_location = 2;
20838    return ptr;
20839 
20840 }
20841 
20842 
20843 /**************************************************
20844 *
20845 *    TableMatchFree()
20846 *
20847 **************************************************/
20848 NLM_EXTERN
20849 TableMatchPtr LIBCALL
TableMatchFree(TableMatchPtr ptr)20850 TableMatchFree(TableMatchPtr ptr)
20851 {
20852 
20853    if(ptr == NULL) {
20854       return NULL;
20855    }
20856    TableMatchTypeFree(ptr -> match_type);
20857    return MemFree(ptr);
20858 }
20859 
20860 
20861 /**************************************************
20862 *
20863 *    TableMatchAsnRead()
20864 *
20865 **************************************************/
20866 NLM_EXTERN
20867 TableMatchPtr LIBCALL
TableMatchAsnRead(AsnIoPtr aip,AsnTypePtr orig)20868 TableMatchAsnRead(AsnIoPtr aip, AsnTypePtr orig)
20869 {
20870    DataVal av;
20871    AsnTypePtr atp;
20872    Boolean isError = FALSE;
20873    AsnReadFunc func;
20874    TableMatchPtr ptr;
20875 
20876    if (! loaded)
20877    {
20878       if (! objmacroAsnLoad()) {
20879          return NULL;
20880       }
20881    }
20882 
20883    if (aip == NULL) {
20884       return NULL;
20885    }
20886 
20887    if (orig == NULL) {         /* TableMatch ::= (self contained) */
20888       atp = AsnReadId(aip, amp, TABLE_MATCH);
20889    } else {
20890       atp = AsnLinkType(orig, TABLE_MATCH);
20891    }
20892    /* link in local tree */
20893    if (atp == NULL) {
20894       return NULL;
20895    }
20896 
20897    ptr = TableMatchNew();
20898    if (ptr == NULL) {
20899       goto erret;
20900    }
20901    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
20902       goto erret;
20903    }
20904 
20905    atp = AsnReadId(aip,amp, atp);
20906    func = NULL;
20907 
20908    if (atp == TABLE_MATCH_match_type) {
20909       ptr -> match_type = TableMatchTypeAsnRead(aip, atp);
20910       if (aip -> io_failure) {
20911          goto erret;
20912       }
20913       atp = AsnReadId(aip,amp, atp);
20914    }
20915    if (atp == TABLE_MATCH_match_location) {
20916       if ( AsnReadVal(aip, atp, &av) <= 0) {
20917          goto erret;
20918       }
20919       ptr -> match_location = av.intvalue;
20920       atp = AsnReadId(aip,amp, atp);
20921    }
20922 
20923    if (AsnReadVal(aip, atp, &av) <= 0) {
20924       goto erret;
20925    }
20926    /* end struct */
20927 
20928 ret:
20929    AsnUnlinkType(orig);       /* unlink local tree */
20930    return ptr;
20931 
20932 erret:
20933    aip -> io_failure = TRUE;
20934    ptr = TableMatchFree(ptr);
20935    goto ret;
20936 }
20937 
20938 
20939 
20940 /**************************************************
20941 *
20942 *    TableMatchAsnWrite()
20943 *
20944 **************************************************/
20945 NLM_EXTERN Boolean LIBCALL
TableMatchAsnWrite(TableMatchPtr ptr,AsnIoPtr aip,AsnTypePtr orig)20946 TableMatchAsnWrite(TableMatchPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
20947 {
20948    DataVal av;
20949    AsnTypePtr atp;
20950    Boolean retval = FALSE;
20951 
20952    if (! loaded)
20953    {
20954       if (! objmacroAsnLoad()) {
20955          return FALSE;
20956       }
20957    }
20958 
20959    if (aip == NULL) {
20960       return FALSE;
20961    }
20962 
20963    atp = AsnLinkType(orig, TABLE_MATCH);   /* link local tree */
20964    if (atp == NULL) {
20965       return FALSE;
20966    }
20967 
20968    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
20969 
20970     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
20971 
20972    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
20973       goto erret;
20974    }
20975 
20976    if (ptr -> match_type != NULL) {
20977       if ( ! TableMatchTypeAsnWrite(ptr -> match_type, aip, TABLE_MATCH_match_type)) {
20978          goto erret;
20979       }
20980    }
20981    av.intvalue = ptr -> match_location;
20982    retval = AsnWrite(aip, TABLE_MATCH_match_location,  &av);
20983    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
20984       goto erret;
20985    }
20986    retval = TRUE;
20987 
20988 erret:
20989    AsnUnlinkType(orig);       /* unlink local tree */
20990    return retval;
20991 }
20992 
20993 
20994 
20995 /**************************************************
20996 *
20997 *    ApplyTableExtraDataFree()
20998 *
20999 **************************************************/
21000 NLM_EXTERN
21001 ApplyTableExtraDataPtr LIBCALL
ApplyTableExtraDataFree(ValNodePtr anp)21002 ApplyTableExtraDataFree(ValNodePtr anp)
21003 {
21004    Pointer pnt;
21005 
21006    if (anp == NULL) {
21007       return NULL;
21008    }
21009 
21010    pnt = anp->data.ptrvalue;
21011    switch (anp->choice)
21012    {
21013    default:
21014       break;
21015    }
21016    return MemFree(anp);
21017 }
21018 
21019 
21020 /**************************************************
21021 *
21022 *    ApplyTableExtraDataAsnRead()
21023 *
21024 **************************************************/
21025 NLM_EXTERN
21026 ApplyTableExtraDataPtr LIBCALL
ApplyTableExtraDataAsnRead(AsnIoPtr aip,AsnTypePtr orig)21027 ApplyTableExtraDataAsnRead(AsnIoPtr aip, AsnTypePtr orig)
21028 {
21029    DataVal av;
21030    AsnTypePtr atp;
21031    ValNodePtr anp;
21032    Uint1 choice;
21033    Boolean isError = FALSE;
21034    Boolean nullIsError = FALSE;
21035    AsnReadFunc func;
21036 
21037    if (! loaded)
21038    {
21039       if (! objmacroAsnLoad()) {
21040          return NULL;
21041       }
21042    }
21043 
21044    if (aip == NULL) {
21045       return NULL;
21046    }
21047 
21048    if (orig == NULL) {         /* ApplyTableExtraData ::= (self contained) */
21049       atp = AsnReadId(aip, amp, APPLY_TABLE_EXTRA_DATA);
21050    } else {
21051       atp = AsnLinkType(orig, APPLY_TABLE_EXTRA_DATA);    /* link in local tree */
21052    }
21053    if (atp == NULL) {
21054       return NULL;
21055    }
21056 
21057    anp = ValNodeNew(NULL);
21058    if (anp == NULL) {
21059       goto erret;
21060    }
21061    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
21062       goto erret;
21063    }
21064 
21065    func = NULL;
21066 
21067    atp = AsnReadId(aip, amp, atp);  /* find the choice */
21068    if (atp == NULL) {
21069       goto erret;
21070    }
21071    if (atp == APPLY_TABLE_EXTRA_DATA_table) {
21072       choice = ApplyTableExtraData_table;
21073       if (AsnReadVal(aip, atp, &av) <= 0) {
21074          goto erret;
21075       }
21076       anp->data.boolvalue = av.boolvalue;
21077    }
21078    anp->choice = choice;
21079    if (func != NULL)
21080    {
21081       anp->data.ptrvalue = (* func)(aip, atp);
21082       if (aip -> io_failure) goto erret;
21083 
21084       if (nullIsError && anp->data.ptrvalue == NULL) {
21085          goto erret;
21086       }
21087    }
21088 
21089 ret:
21090    AsnUnlinkType(orig);       /* unlink local tree */
21091    return anp;
21092 
21093 erret:
21094    anp = MemFree(anp);
21095    aip -> io_failure = TRUE;
21096    goto ret;
21097 }
21098 
21099 
21100 /**************************************************
21101 *
21102 *    ApplyTableExtraDataAsnWrite()
21103 *
21104 **************************************************/
21105 NLM_EXTERN Boolean LIBCALL
ApplyTableExtraDataAsnWrite(ApplyTableExtraDataPtr anp,AsnIoPtr aip,AsnTypePtr orig)21106 ApplyTableExtraDataAsnWrite(ApplyTableExtraDataPtr anp, AsnIoPtr aip, AsnTypePtr orig)
21107 
21108 {
21109    DataVal av;
21110    AsnTypePtr atp, writetype = NULL;
21111    Pointer pnt;
21112    AsnWriteFunc func = NULL;
21113    Boolean retval = FALSE;
21114 
21115    if (! loaded)
21116    {
21117       if (! objmacroAsnLoad())
21118       return FALSE;
21119    }
21120 
21121    if (aip == NULL)
21122    return FALSE;
21123 
21124    atp = AsnLinkType(orig, APPLY_TABLE_EXTRA_DATA);   /* link local tree */
21125    if (atp == NULL) {
21126       return FALSE;
21127    }
21128 
21129    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
21130 
21131     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
21132 
21133    av.ptrvalue = (Pointer)anp;
21134    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
21135       goto erret;
21136    }
21137 
21138    pnt = anp->data.ptrvalue;
21139    switch (anp->choice)
21140    {
21141    case ApplyTableExtraData_table:
21142       av.boolvalue = anp->data.boolvalue;
21143       retval = AsnWrite(aip, APPLY_TABLE_EXTRA_DATA_table, &av);
21144       break;
21145    }
21146    if (writetype != NULL) {
21147       retval = (* func)(pnt, aip, writetype);   /* write it out */
21148    }
21149    if (!retval) {
21150       goto erret;
21151    }
21152    retval = TRUE;
21153 
21154 erret:
21155    AsnUnlinkType(orig);       /* unlink local tree */
21156    return retval;
21157 }
21158 
21159 
21160 /**************************************************
21161 *
21162 *    ApplyTableActionNew()
21163 *
21164 **************************************************/
21165 NLM_EXTERN
21166 ApplyTableActionPtr LIBCALL
ApplyTableActionNew(void)21167 ApplyTableActionNew(void)
21168 {
21169    ApplyTableActionPtr ptr = MemNew((size_t) sizeof(ApplyTableAction));
21170 
21171    ptr -> also_change_mrna = 0;
21172    ptr -> skip_blanks = 1;
21173    return ptr;
21174 
21175 }
21176 
21177 
21178 /**************************************************
21179 *
21180 *    ApplyTableActionFree()
21181 *
21182 **************************************************/
21183 NLM_EXTERN
21184 ApplyTableActionPtr LIBCALL
ApplyTableActionFree(ApplyTableActionPtr ptr)21185 ApplyTableActionFree(ApplyTableActionPtr ptr)
21186 {
21187 
21188    if(ptr == NULL) {
21189       return NULL;
21190    }
21191    MemFree(ptr -> filename);
21192    TableMatchFree(ptr -> match_type);
21193    ApplyTableExtraDataFree(ptr -> in_memory_table);
21194    return MemFree(ptr);
21195 }
21196 
21197 
21198 /**************************************************
21199 *
21200 *    ApplyTableActionAsnRead()
21201 *
21202 **************************************************/
21203 NLM_EXTERN
21204 ApplyTableActionPtr LIBCALL
ApplyTableActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)21205 ApplyTableActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
21206 {
21207    DataVal av;
21208    AsnTypePtr atp;
21209    Boolean isError = FALSE;
21210    AsnReadFunc func;
21211    ApplyTableActionPtr ptr;
21212 
21213    if (! loaded)
21214    {
21215       if (! objmacroAsnLoad()) {
21216          return NULL;
21217       }
21218    }
21219 
21220    if (aip == NULL) {
21221       return NULL;
21222    }
21223 
21224    if (orig == NULL) {         /* ApplyTableAction ::= (self contained) */
21225       atp = AsnReadId(aip, amp, APPLY_TABLE_ACTION);
21226    } else {
21227       atp = AsnLinkType(orig, APPLY_TABLE_ACTION);
21228    }
21229    /* link in local tree */
21230    if (atp == NULL) {
21231       return NULL;
21232    }
21233 
21234    ptr = ApplyTableActionNew();
21235    if (ptr == NULL) {
21236       goto erret;
21237    }
21238    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
21239       goto erret;
21240    }
21241 
21242    atp = AsnReadId(aip,amp, atp);
21243    func = NULL;
21244 
21245    if (atp == APPLY_TABLE_ACTION_filename) {
21246       if ( AsnReadVal(aip, atp, &av) <= 0) {
21247          goto erret;
21248       }
21249       ptr -> filename = av.ptrvalue;
21250       atp = AsnReadId(aip,amp, atp);
21251    }
21252    if (atp == APPLY_TABLE_ACTION_match_type) {
21253       ptr -> match_type = TableMatchAsnRead(aip, atp);
21254       if (aip -> io_failure) {
21255          goto erret;
21256       }
21257       atp = AsnReadId(aip,amp, atp);
21258    }
21259    if (atp == APPLY_TABLE_ACTION_in_memory_table) {
21260       ptr -> in_memory_table = ApplyTableExtraDataAsnRead(aip, atp);
21261       if (aip -> io_failure) {
21262          goto erret;
21263       }
21264       atp = AsnReadId(aip,amp, atp);
21265    }
21266    if (atp == APPLY_TABLE_ACTION_also_change_mrna) {
21267       if ( AsnReadVal(aip, atp, &av) <= 0) {
21268          goto erret;
21269       }
21270       ptr -> also_change_mrna = av.boolvalue;
21271       atp = AsnReadId(aip,amp, atp);
21272    }
21273    if (atp == APPLY_TABLE_ACTION_skip_blanks) {
21274       if ( AsnReadVal(aip, atp, &av) <= 0) {
21275          goto erret;
21276       }
21277       ptr -> skip_blanks = av.boolvalue;
21278       atp = AsnReadId(aip,amp, atp);
21279    }
21280 
21281    if (AsnReadVal(aip, atp, &av) <= 0) {
21282       goto erret;
21283    }
21284    /* end struct */
21285 
21286 ret:
21287    AsnUnlinkType(orig);       /* unlink local tree */
21288    return ptr;
21289 
21290 erret:
21291    aip -> io_failure = TRUE;
21292    ptr = ApplyTableActionFree(ptr);
21293    goto ret;
21294 }
21295 
21296 
21297 
21298 /**************************************************
21299 *
21300 *    ApplyTableActionAsnWrite()
21301 *
21302 **************************************************/
21303 NLM_EXTERN Boolean LIBCALL
ApplyTableActionAsnWrite(ApplyTableActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)21304 ApplyTableActionAsnWrite(ApplyTableActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
21305 {
21306    DataVal av;
21307    AsnTypePtr atp;
21308    Boolean retval = FALSE;
21309 
21310    if (! loaded)
21311    {
21312       if (! objmacroAsnLoad()) {
21313          return FALSE;
21314       }
21315    }
21316 
21317    if (aip == NULL) {
21318       return FALSE;
21319    }
21320 
21321    atp = AsnLinkType(orig, APPLY_TABLE_ACTION);   /* link local tree */
21322    if (atp == NULL) {
21323       return FALSE;
21324    }
21325 
21326    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
21327 
21328     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
21329 
21330    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
21331       goto erret;
21332    }
21333 
21334    if (ptr -> filename != NULL) {
21335       av.ptrvalue = ptr -> filename;
21336       retval = AsnWrite(aip, APPLY_TABLE_ACTION_filename,  &av);
21337    }
21338    if (ptr -> match_type != NULL) {
21339       if ( ! TableMatchAsnWrite(ptr -> match_type, aip, APPLY_TABLE_ACTION_match_type)) {
21340          goto erret;
21341       }
21342    }
21343    if (ptr -> in_memory_table != NULL) {
21344       if ( ! ApplyTableExtraDataAsnWrite(ptr -> in_memory_table, aip, APPLY_TABLE_ACTION_in_memory_table)) {
21345          goto erret;
21346       }
21347    }
21348    av.boolvalue = ptr -> also_change_mrna;
21349    retval = AsnWrite(aip, APPLY_TABLE_ACTION_also_change_mrna,  &av);
21350    av.boolvalue = ptr -> skip_blanks;
21351    retval = AsnWrite(aip, APPLY_TABLE_ACTION_skip_blanks,  &av);
21352    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
21353       goto erret;
21354    }
21355    retval = TRUE;
21356 
21357 erret:
21358    AsnUnlinkType(orig);       /* unlink local tree */
21359    return retval;
21360 }
21361 
21362 
21363 
21364 /**************************************************
21365 *
21366 *    AddFileActionNew()
21367 *
21368 **************************************************/
21369 NLM_EXTERN
21370 AddFileActionPtr LIBCALL
AddFileActionNew(void)21371 AddFileActionNew(void)
21372 {
21373    AddFileActionPtr ptr = MemNew((size_t) sizeof(AddFileAction));
21374 
21375    return ptr;
21376 
21377 }
21378 
21379 
21380 /**************************************************
21381 *
21382 *    AddFileActionFree()
21383 *
21384 **************************************************/
21385 NLM_EXTERN
21386 AddFileActionPtr LIBCALL
AddFileActionFree(AddFileActionPtr ptr)21387 AddFileActionFree(AddFileActionPtr ptr)
21388 {
21389 
21390    if(ptr == NULL) {
21391       return NULL;
21392    }
21393    MemFree(ptr -> filename);
21394    ApplyTableExtraDataFree(ptr -> in_memory_table);
21395    return MemFree(ptr);
21396 }
21397 
21398 
21399 /**************************************************
21400 *
21401 *    AddFileActionAsnRead()
21402 *
21403 **************************************************/
21404 NLM_EXTERN
21405 AddFileActionPtr LIBCALL
AddFileActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)21406 AddFileActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
21407 {
21408    DataVal av;
21409    AsnTypePtr atp;
21410    Boolean isError = FALSE;
21411    AsnReadFunc func;
21412    AddFileActionPtr ptr;
21413 
21414    if (! loaded)
21415    {
21416       if (! objmacroAsnLoad()) {
21417          return NULL;
21418       }
21419    }
21420 
21421    if (aip == NULL) {
21422       return NULL;
21423    }
21424 
21425    if (orig == NULL) {         /* AddFileAction ::= (self contained) */
21426       atp = AsnReadId(aip, amp, ADD_FILE_ACTION);
21427    } else {
21428       atp = AsnLinkType(orig, ADD_FILE_ACTION);
21429    }
21430    /* link in local tree */
21431    if (atp == NULL) {
21432       return NULL;
21433    }
21434 
21435    ptr = AddFileActionNew();
21436    if (ptr == NULL) {
21437       goto erret;
21438    }
21439    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
21440       goto erret;
21441    }
21442 
21443    atp = AsnReadId(aip,amp, atp);
21444    func = NULL;
21445 
21446    if (atp == ADD_FILE_ACTION_filename) {
21447       if ( AsnReadVal(aip, atp, &av) <= 0) {
21448          goto erret;
21449       }
21450       ptr -> filename = av.ptrvalue;
21451       atp = AsnReadId(aip,amp, atp);
21452    }
21453    if (atp == ADD_FILE_ACTION_in_memory_table) {
21454       ptr -> in_memory_table = ApplyTableExtraDataAsnRead(aip, atp);
21455       if (aip -> io_failure) {
21456          goto erret;
21457       }
21458       atp = AsnReadId(aip,amp, atp);
21459    }
21460 
21461    if (AsnReadVal(aip, atp, &av) <= 0) {
21462       goto erret;
21463    }
21464    /* end struct */
21465 
21466 ret:
21467    AsnUnlinkType(orig);       /* unlink local tree */
21468    return ptr;
21469 
21470 erret:
21471    aip -> io_failure = TRUE;
21472    ptr = AddFileActionFree(ptr);
21473    goto ret;
21474 }
21475 
21476 
21477 
21478 /**************************************************
21479 *
21480 *    AddFileActionAsnWrite()
21481 *
21482 **************************************************/
21483 NLM_EXTERN Boolean LIBCALL
AddFileActionAsnWrite(AddFileActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)21484 AddFileActionAsnWrite(AddFileActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
21485 {
21486    DataVal av;
21487    AsnTypePtr atp;
21488    Boolean retval = FALSE;
21489 
21490    if (! loaded)
21491    {
21492       if (! objmacroAsnLoad()) {
21493          return FALSE;
21494       }
21495    }
21496 
21497    if (aip == NULL) {
21498       return FALSE;
21499    }
21500 
21501    atp = AsnLinkType(orig, ADD_FILE_ACTION);   /* link local tree */
21502    if (atp == NULL) {
21503       return FALSE;
21504    }
21505 
21506    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
21507 
21508     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
21509 
21510    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
21511       goto erret;
21512    }
21513 
21514    if (ptr -> filename != NULL) {
21515       av.ptrvalue = ptr -> filename;
21516       retval = AsnWrite(aip, ADD_FILE_ACTION_filename,  &av);
21517    }
21518    if (ptr -> in_memory_table != NULL) {
21519       if ( ! ApplyTableExtraDataAsnWrite(ptr -> in_memory_table, aip, ADD_FILE_ACTION_in_memory_table)) {
21520          goto erret;
21521       }
21522    }
21523    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
21524       goto erret;
21525    }
21526    retval = TRUE;
21527 
21528 erret:
21529    AsnUnlinkType(orig);       /* unlink local tree */
21530    return retval;
21531 }
21532 
21533 
21534 
21535 /**************************************************
21536 *
21537 *    AddDescriptorListActionNew()
21538 *
21539 **************************************************/
21540 NLM_EXTERN
21541 AddDescriptorListActionPtr LIBCALL
AddDescriptorListActionNew(void)21542 AddDescriptorListActionNew(void)
21543 {
21544    AddDescriptorListActionPtr ptr = MemNew((size_t) sizeof(AddDescriptorListAction));
21545 
21546    return ptr;
21547 
21548 }
21549 
21550 
21551 /**************************************************
21552 *
21553 *    AddDescriptorListActionFree()
21554 *
21555 **************************************************/
21556 NLM_EXTERN
21557 AddDescriptorListActionPtr LIBCALL
AddDescriptorListActionFree(AddDescriptorListActionPtr ptr)21558 AddDescriptorListActionFree(AddDescriptorListActionPtr ptr)
21559 {
21560 
21561    if(ptr == NULL) {
21562       return NULL;
21563    }
21564    AddFileActionFree(ptr -> descriptor_list);
21565    ConstraintChoiceSetFree(ptr -> constraint);
21566    return MemFree(ptr);
21567 }
21568 
21569 
21570 /**************************************************
21571 *
21572 *    AddDescriptorListActionAsnRead()
21573 *
21574 **************************************************/
21575 NLM_EXTERN
21576 AddDescriptorListActionPtr LIBCALL
AddDescriptorListActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)21577 AddDescriptorListActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
21578 {
21579    DataVal av;
21580    AsnTypePtr atp;
21581    Boolean isError = FALSE;
21582    AsnReadFunc func;
21583    AddDescriptorListActionPtr ptr;
21584 
21585    if (! loaded)
21586    {
21587       if (! objmacroAsnLoad()) {
21588          return NULL;
21589       }
21590    }
21591 
21592    if (aip == NULL) {
21593       return NULL;
21594    }
21595 
21596    if (orig == NULL) {         /* AddDescriptorListAction ::= (self contained) */
21597       atp = AsnReadId(aip, amp, ADD_DESCRIPTOR_LIST_ACTION);
21598    } else {
21599       atp = AsnLinkType(orig, ADD_DESCRIPTOR_LIST_ACTION);
21600    }
21601    /* link in local tree */
21602    if (atp == NULL) {
21603       return NULL;
21604    }
21605 
21606    ptr = AddDescriptorListActionNew();
21607    if (ptr == NULL) {
21608       goto erret;
21609    }
21610    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
21611       goto erret;
21612    }
21613 
21614    atp = AsnReadId(aip,amp, atp);
21615    func = NULL;
21616 
21617    if (atp == ADD_DESCRIPTOR_LIST_ACTION_descriptor_list) {
21618       ptr -> descriptor_list = AddFileActionAsnRead(aip, atp);
21619       if (aip -> io_failure) {
21620          goto erret;
21621       }
21622       atp = AsnReadId(aip,amp, atp);
21623    }
21624    if (atp == ADD_DESCRIPTOR_LIST_ACTION_constraint) {
21625       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
21626       if (aip -> io_failure) {
21627          goto erret;
21628       }
21629       atp = AsnReadId(aip,amp, atp);
21630    }
21631 
21632    if (AsnReadVal(aip, atp, &av) <= 0) {
21633       goto erret;
21634    }
21635    /* end struct */
21636 
21637 ret:
21638    AsnUnlinkType(orig);       /* unlink local tree */
21639    return ptr;
21640 
21641 erret:
21642    aip -> io_failure = TRUE;
21643    ptr = AddDescriptorListActionFree(ptr);
21644    goto ret;
21645 }
21646 
21647 
21648 
21649 /**************************************************
21650 *
21651 *    AddDescriptorListActionAsnWrite()
21652 *
21653 **************************************************/
21654 NLM_EXTERN Boolean LIBCALL
AddDescriptorListActionAsnWrite(AddDescriptorListActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)21655 AddDescriptorListActionAsnWrite(AddDescriptorListActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
21656 {
21657    DataVal av;
21658    AsnTypePtr atp;
21659    Boolean retval = FALSE;
21660 
21661    if (! loaded)
21662    {
21663       if (! objmacroAsnLoad()) {
21664          return FALSE;
21665       }
21666    }
21667 
21668    if (aip == NULL) {
21669       return FALSE;
21670    }
21671 
21672    atp = AsnLinkType(orig, ADD_DESCRIPTOR_LIST_ACTION);   /* link local tree */
21673    if (atp == NULL) {
21674       return FALSE;
21675    }
21676 
21677    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
21678 
21679     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
21680 
21681    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
21682       goto erret;
21683    }
21684 
21685    if (ptr -> descriptor_list != NULL) {
21686       if ( ! AddFileActionAsnWrite(ptr -> descriptor_list, aip, ADD_DESCRIPTOR_LIST_ACTION_descriptor_list)) {
21687          goto erret;
21688       }
21689    }
21690    if (ptr -> constraint != NULL) {
21691       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, ADD_DESCRIPTOR_LIST_ACTION_constraint)) {
21692          goto erret;
21693       }
21694    }
21695    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
21696       goto erret;
21697    }
21698    retval = TRUE;
21699 
21700 erret:
21701    AsnUnlinkType(orig);       /* unlink local tree */
21702    return retval;
21703 }
21704 
21705 
21706 
21707 /**************************************************
21708 *
21709 *    RemoveSequencesActionNew()
21710 *
21711 **************************************************/
21712 NLM_EXTERN
21713 RemoveSequencesActionPtr LIBCALL
RemoveSequencesActionNew(void)21714 RemoveSequencesActionNew(void)
21715 {
21716    RemoveSequencesActionPtr ptr = MemNew((size_t) sizeof(RemoveSequencesAction));
21717 
21718    return ptr;
21719 
21720 }
21721 
21722 
21723 /**************************************************
21724 *
21725 *    RemoveSequencesActionFree()
21726 *
21727 **************************************************/
21728 NLM_EXTERN
21729 RemoveSequencesActionPtr LIBCALL
RemoveSequencesActionFree(RemoveSequencesActionPtr ptr)21730 RemoveSequencesActionFree(RemoveSequencesActionPtr ptr)
21731 {
21732 
21733    if(ptr == NULL) {
21734       return NULL;
21735    }
21736    ConstraintChoiceSetFree(ptr -> constraint);
21737    return MemFree(ptr);
21738 }
21739 
21740 
21741 /**************************************************
21742 *
21743 *    RemoveSequencesActionAsnRead()
21744 *
21745 **************************************************/
21746 NLM_EXTERN
21747 RemoveSequencesActionPtr LIBCALL
RemoveSequencesActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)21748 RemoveSequencesActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
21749 {
21750    DataVal av;
21751    AsnTypePtr atp;
21752    Boolean isError = FALSE;
21753    AsnReadFunc func;
21754    RemoveSequencesActionPtr ptr;
21755 
21756    if (! loaded)
21757    {
21758       if (! objmacroAsnLoad()) {
21759          return NULL;
21760       }
21761    }
21762 
21763    if (aip == NULL) {
21764       return NULL;
21765    }
21766 
21767    if (orig == NULL) {         /* RemoveSequencesAction ::= (self contained) */
21768       atp = AsnReadId(aip, amp, REMOVE_SEQUENCES_ACTION);
21769    } else {
21770       atp = AsnLinkType(orig, REMOVE_SEQUENCES_ACTION);
21771    }
21772    /* link in local tree */
21773    if (atp == NULL) {
21774       return NULL;
21775    }
21776 
21777    ptr = RemoveSequencesActionNew();
21778    if (ptr == NULL) {
21779       goto erret;
21780    }
21781    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
21782       goto erret;
21783    }
21784 
21785    atp = AsnReadId(aip,amp, atp);
21786    func = NULL;
21787 
21788    if (atp == REMOVE_SEQUENCES_ACTION_constraint) {
21789       ptr -> constraint = ConstraintChoiceSetAsnRead(aip, atp);
21790       if (aip -> io_failure) {
21791          goto erret;
21792       }
21793       atp = AsnReadId(aip,amp, atp);
21794    }
21795 
21796    if (AsnReadVal(aip, atp, &av) <= 0) {
21797       goto erret;
21798    }
21799    /* end struct */
21800 
21801 ret:
21802    AsnUnlinkType(orig);       /* unlink local tree */
21803    return ptr;
21804 
21805 erret:
21806    aip -> io_failure = TRUE;
21807    ptr = RemoveSequencesActionFree(ptr);
21808    goto ret;
21809 }
21810 
21811 
21812 
21813 /**************************************************
21814 *
21815 *    RemoveSequencesActionAsnWrite()
21816 *
21817 **************************************************/
21818 NLM_EXTERN Boolean LIBCALL
RemoveSequencesActionAsnWrite(RemoveSequencesActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)21819 RemoveSequencesActionAsnWrite(RemoveSequencesActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
21820 {
21821    DataVal av;
21822    AsnTypePtr atp;
21823    Boolean retval = FALSE;
21824 
21825    if (! loaded)
21826    {
21827       if (! objmacroAsnLoad()) {
21828          return FALSE;
21829       }
21830    }
21831 
21832    if (aip == NULL) {
21833       return FALSE;
21834    }
21835 
21836    atp = AsnLinkType(orig, REMOVE_SEQUENCES_ACTION);   /* link local tree */
21837    if (atp == NULL) {
21838       return FALSE;
21839    }
21840 
21841    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
21842 
21843     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
21844 
21845    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
21846       goto erret;
21847    }
21848 
21849    if (ptr -> constraint != NULL) {
21850       if ( ! ConstraintChoiceSetAsnWrite(ptr -> constraint, aip, REMOVE_SEQUENCES_ACTION_constraint)) {
21851          goto erret;
21852       }
21853    }
21854    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
21855       goto erret;
21856    }
21857    retval = TRUE;
21858 
21859 erret:
21860    AsnUnlinkType(orig);       /* unlink local tree */
21861    return retval;
21862 }
21863 
21864 
21865 
21866 /**************************************************
21867 *
21868 *    UpdateReplacedEcNumbersActionNew()
21869 *
21870 **************************************************/
21871 NLM_EXTERN
21872 UpdateReplacedEcNumbersActionPtr LIBCALL
UpdateReplacedEcNumbersActionNew(void)21873 UpdateReplacedEcNumbersActionNew(void)
21874 {
21875    UpdateReplacedEcNumbersActionPtr ptr = MemNew((size_t) sizeof(UpdateReplacedEcNumbersAction));
21876 
21877    return ptr;
21878 
21879 }
21880 
21881 
21882 /**************************************************
21883 *
21884 *    UpdateReplacedEcNumbersActionFree()
21885 *
21886 **************************************************/
21887 NLM_EXTERN
21888 UpdateReplacedEcNumbersActionPtr LIBCALL
UpdateReplacedEcNumbersActionFree(UpdateReplacedEcNumbersActionPtr ptr)21889 UpdateReplacedEcNumbersActionFree(UpdateReplacedEcNumbersActionPtr ptr)
21890 {
21891 
21892    if(ptr == NULL) {
21893       return NULL;
21894    }
21895    return MemFree(ptr);
21896 }
21897 
21898 
21899 /**************************************************
21900 *
21901 *    UpdateReplacedEcNumbersActionAsnRead()
21902 *
21903 **************************************************/
21904 NLM_EXTERN
21905 UpdateReplacedEcNumbersActionPtr LIBCALL
UpdateReplacedEcNumbersActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)21906 UpdateReplacedEcNumbersActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
21907 {
21908    DataVal av;
21909    AsnTypePtr atp;
21910    Boolean isError = FALSE;
21911    AsnReadFunc func;
21912    UpdateReplacedEcNumbersActionPtr ptr;
21913 
21914    if (! loaded)
21915    {
21916       if (! objmacroAsnLoad()) {
21917          return NULL;
21918       }
21919    }
21920 
21921    if (aip == NULL) {
21922       return NULL;
21923    }
21924 
21925    if (orig == NULL) {         /* UpdateReplacedEcNumbersAction ::= (self contained) */
21926       atp = AsnReadId(aip, amp, UPDATE_REPLACED_EC_NUMBERS_ACTION);
21927    } else {
21928       atp = AsnLinkType(orig, UPDATE_REPLACED_EC_NUMBERS_ACTION);
21929    }
21930    /* link in local tree */
21931    if (atp == NULL) {
21932       return NULL;
21933    }
21934 
21935    ptr = UpdateReplacedEcNumbersActionNew();
21936    if (ptr == NULL) {
21937       goto erret;
21938    }
21939    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
21940       goto erret;
21941    }
21942 
21943    atp = AsnReadId(aip,amp, atp);
21944    func = NULL;
21945 
21946    if (atp == UPDATE_REPLACED_EC_NUMBERS_ACTION_delete_improper_format) {
21947       if ( AsnReadVal(aip, atp, &av) <= 0) {
21948          goto erret;
21949       }
21950       ptr -> delete_improper_format = av.boolvalue;
21951       atp = AsnReadId(aip,amp, atp);
21952    }
21953    if (atp == UPDATE_REPLACED_EC_NUMBERS_ACTION_delete_unrecognized) {
21954       if ( AsnReadVal(aip, atp, &av) <= 0) {
21955          goto erret;
21956       }
21957       ptr -> delete_unrecognized = av.boolvalue;
21958       atp = AsnReadId(aip,amp, atp);
21959    }
21960    if (atp == UPDATE_REPLACED_EC_NUMBERS_ACTION_delete_multiple_replacement) {
21961       if ( AsnReadVal(aip, atp, &av) <= 0) {
21962          goto erret;
21963       }
21964       ptr -> delete_multiple_replacement = av.boolvalue;
21965       atp = AsnReadId(aip,amp, atp);
21966    }
21967 
21968    if (AsnReadVal(aip, atp, &av) <= 0) {
21969       goto erret;
21970    }
21971    /* end struct */
21972 
21973 ret:
21974    AsnUnlinkType(orig);       /* unlink local tree */
21975    return ptr;
21976 
21977 erret:
21978    aip -> io_failure = TRUE;
21979    ptr = UpdateReplacedEcNumbersActionFree(ptr);
21980    goto ret;
21981 }
21982 
21983 
21984 
21985 /**************************************************
21986 *
21987 *    UpdateReplacedEcNumbersActionAsnWrite()
21988 *
21989 **************************************************/
21990 NLM_EXTERN Boolean LIBCALL
UpdateReplacedEcNumbersActionAsnWrite(UpdateReplacedEcNumbersActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)21991 UpdateReplacedEcNumbersActionAsnWrite(UpdateReplacedEcNumbersActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
21992 {
21993    DataVal av;
21994    AsnTypePtr atp;
21995    Boolean retval = FALSE;
21996 
21997    if (! loaded)
21998    {
21999       if (! objmacroAsnLoad()) {
22000          return FALSE;
22001       }
22002    }
22003 
22004    if (aip == NULL) {
22005       return FALSE;
22006    }
22007 
22008    atp = AsnLinkType(orig, UPDATE_REPLACED_EC_NUMBERS_ACTION);   /* link local tree */
22009    if (atp == NULL) {
22010       return FALSE;
22011    }
22012 
22013    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
22014 
22015     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
22016 
22017    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
22018       goto erret;
22019    }
22020 
22021    av.boolvalue = ptr -> delete_improper_format;
22022    retval = AsnWrite(aip, UPDATE_REPLACED_EC_NUMBERS_ACTION_delete_improper_format,  &av);
22023    av.boolvalue = ptr -> delete_unrecognized;
22024    retval = AsnWrite(aip, UPDATE_REPLACED_EC_NUMBERS_ACTION_delete_unrecognized,  &av);
22025    av.boolvalue = ptr -> delete_multiple_replacement;
22026    retval = AsnWrite(aip, UPDATE_REPLACED_EC_NUMBERS_ACTION_delete_multiple_replacement,  &av);
22027    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
22028       goto erret;
22029    }
22030    retval = TRUE;
22031 
22032 erret:
22033    AsnUnlinkType(orig);       /* unlink local tree */
22034    return retval;
22035 }
22036 
22037 
22038 
22039 /**************************************************
22040 *
22041 *    RetranslateCdsActionNew()
22042 *
22043 **************************************************/
22044 NLM_EXTERN
22045 RetranslateCdsActionPtr LIBCALL
RetranslateCdsActionNew(void)22046 RetranslateCdsActionNew(void)
22047 {
22048    RetranslateCdsActionPtr ptr = MemNew((size_t) sizeof(RetranslateCdsAction));
22049 
22050    return ptr;
22051 
22052 }
22053 
22054 
22055 /**************************************************
22056 *
22057 *    RetranslateCdsActionFree()
22058 *
22059 **************************************************/
22060 NLM_EXTERN
22061 RetranslateCdsActionPtr LIBCALL
RetranslateCdsActionFree(RetranslateCdsActionPtr ptr)22062 RetranslateCdsActionFree(RetranslateCdsActionPtr ptr)
22063 {
22064 
22065    if(ptr == NULL) {
22066       return NULL;
22067    }
22068    return MemFree(ptr);
22069 }
22070 
22071 
22072 /**************************************************
22073 *
22074 *    RetranslateCdsActionAsnRead()
22075 *
22076 **************************************************/
22077 NLM_EXTERN
22078 RetranslateCdsActionPtr LIBCALL
RetranslateCdsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)22079 RetranslateCdsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
22080 {
22081    DataVal av;
22082    AsnTypePtr atp;
22083    Boolean isError = FALSE;
22084    AsnReadFunc func;
22085    RetranslateCdsActionPtr ptr;
22086 
22087    if (! loaded)
22088    {
22089       if (! objmacroAsnLoad()) {
22090          return NULL;
22091       }
22092    }
22093 
22094    if (aip == NULL) {
22095       return NULL;
22096    }
22097 
22098    if (orig == NULL) {         /* RetranslateCdsAction ::= (self contained) */
22099       atp = AsnReadId(aip, amp, RETRANSLATE_CDS_ACTION);
22100    } else {
22101       atp = AsnLinkType(orig, RETRANSLATE_CDS_ACTION);
22102    }
22103    /* link in local tree */
22104    if (atp == NULL) {
22105       return NULL;
22106    }
22107 
22108    ptr = RetranslateCdsActionNew();
22109    if (ptr == NULL) {
22110       goto erret;
22111    }
22112    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
22113       goto erret;
22114    }
22115 
22116    atp = AsnReadId(aip,amp, atp);
22117    func = NULL;
22118 
22119    if (atp == RETRANSLATE_CDS_ACTION_obey_stop_codon) {
22120       if ( AsnReadVal(aip, atp, &av) <= 0) {
22121          goto erret;
22122       }
22123       ptr -> obey_stop_codon = av.boolvalue;
22124       atp = AsnReadId(aip,amp, atp);
22125    }
22126 
22127    if (AsnReadVal(aip, atp, &av) <= 0) {
22128       goto erret;
22129    }
22130    /* end struct */
22131 
22132 ret:
22133    AsnUnlinkType(orig);       /* unlink local tree */
22134    return ptr;
22135 
22136 erret:
22137    aip -> io_failure = TRUE;
22138    ptr = RetranslateCdsActionFree(ptr);
22139    goto ret;
22140 }
22141 
22142 
22143 
22144 /**************************************************
22145 *
22146 *    RetranslateCdsActionAsnWrite()
22147 *
22148 **************************************************/
22149 NLM_EXTERN Boolean LIBCALL
RetranslateCdsActionAsnWrite(RetranslateCdsActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)22150 RetranslateCdsActionAsnWrite(RetranslateCdsActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
22151 {
22152    DataVal av;
22153    AsnTypePtr atp;
22154    Boolean retval = FALSE;
22155 
22156    if (! loaded)
22157    {
22158       if (! objmacroAsnLoad()) {
22159          return FALSE;
22160       }
22161    }
22162 
22163    if (aip == NULL) {
22164       return FALSE;
22165    }
22166 
22167    atp = AsnLinkType(orig, RETRANSLATE_CDS_ACTION);   /* link local tree */
22168    if (atp == NULL) {
22169       return FALSE;
22170    }
22171 
22172    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
22173 
22174     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
22175 
22176    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
22177       goto erret;
22178    }
22179 
22180    av.boolvalue = ptr -> obey_stop_codon;
22181    retval = AsnWrite(aip, RETRANSLATE_CDS_ACTION_obey_stop_codon,  &av);
22182    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
22183       goto erret;
22184    }
22185    retval = TRUE;
22186 
22187 erret:
22188    AsnUnlinkType(orig);       /* unlink local tree */
22189    return retval;
22190 }
22191 
22192 
22193 
22194 /**************************************************
22195 *
22196 *    AdjustFeaturesForGapsActionNew()
22197 *
22198 **************************************************/
22199 NLM_EXTERN
22200 AdjustFeaturesForGapsActionPtr LIBCALL
AdjustFeaturesForGapsActionNew(void)22201 AdjustFeaturesForGapsActionNew(void)
22202 {
22203    AdjustFeaturesForGapsActionPtr ptr = MemNew((size_t) sizeof(AdjustFeaturesForGapsAction));
22204 
22205    return ptr;
22206 
22207 }
22208 
22209 
22210 /**************************************************
22211 *
22212 *    AdjustFeaturesForGapsActionFree()
22213 *
22214 **************************************************/
22215 NLM_EXTERN
22216 AdjustFeaturesForGapsActionPtr LIBCALL
AdjustFeaturesForGapsActionFree(AdjustFeaturesForGapsActionPtr ptr)22217 AdjustFeaturesForGapsActionFree(AdjustFeaturesForGapsActionPtr ptr)
22218 {
22219 
22220    if(ptr == NULL) {
22221       return NULL;
22222    }
22223    return MemFree(ptr);
22224 }
22225 
22226 
22227 /**************************************************
22228 *
22229 *    AdjustFeaturesForGapsActionAsnRead()
22230 *
22231 **************************************************/
22232 NLM_EXTERN
22233 AdjustFeaturesForGapsActionPtr LIBCALL
AdjustFeaturesForGapsActionAsnRead(AsnIoPtr aip,AsnTypePtr orig)22234 AdjustFeaturesForGapsActionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
22235 {
22236    DataVal av;
22237    AsnTypePtr atp;
22238    Boolean isError = FALSE;
22239    AsnReadFunc func;
22240    AdjustFeaturesForGapsActionPtr ptr;
22241 
22242    if (! loaded)
22243    {
22244       if (! objmacroAsnLoad()) {
22245          return NULL;
22246       }
22247    }
22248 
22249    if (aip == NULL) {
22250       return NULL;
22251    }
22252 
22253    if (orig == NULL) {         /* AdjustFeaturesForGapsAction ::= (self contained) */
22254       atp = AsnReadId(aip, amp, ADJUST_FEATURES_FOR_GAPS_ACTION);
22255    } else {
22256       atp = AsnLinkType(orig, ADJUST_FEATURES_FOR_GAPS_ACTION);
22257    }
22258    /* link in local tree */
22259    if (atp == NULL) {
22260       return NULL;
22261    }
22262 
22263    ptr = AdjustFeaturesForGapsActionNew();
22264    if (ptr == NULL) {
22265       goto erret;
22266    }
22267    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
22268       goto erret;
22269    }
22270 
22271    atp = AsnReadId(aip,amp, atp);
22272    func = NULL;
22273 
22274    if (atp == ADJUST_FEATURES_FOR_GAPS_ACTION_type) {
22275       if ( AsnReadVal(aip, atp, &av) <= 0) {
22276          goto erret;
22277       }
22278       ptr -> type = av.intvalue;
22279       atp = AsnReadId(aip,amp, atp);
22280    }
22281    if (atp == ADJUST_FEATURES_FOR_GAPS_ACTION_adjust_for_unknown_length_gaps) {
22282       if ( AsnReadVal(aip, atp, &av) <= 0) {
22283          goto erret;
22284       }
22285       ptr -> adjust_for_unknown_length_gaps = av.boolvalue;
22286       atp = AsnReadId(aip,amp, atp);
22287    }
22288    if (atp == ADJUST_FEATURES_FOR_GAPS_ACTION_adjust_for_known_length_gaps) {
22289       if ( AsnReadVal(aip, atp, &av) <= 0) {
22290          goto erret;
22291       }
22292       ptr -> adjust_for_known_length_gaps = av.boolvalue;
22293       atp = AsnReadId(aip,amp, atp);
22294    }
22295    if (atp == ADJUST_FEATURES_FOR_GAPS_ACTION_make_truncated_ends_partial) {
22296       if ( AsnReadVal(aip, atp, &av) <= 0) {
22297          goto erret;
22298       }
22299       ptr -> make_truncated_ends_partial = av.intvalue;
22300       atp = AsnReadId(aip,amp, atp);
22301    }
22302    if (atp == ADJUST_FEATURES_FOR_GAPS_ACTION_trim_ends_in_gaps) {
22303       if ( AsnReadVal(aip, atp, &av) <= 0) {
22304          goto erret;
22305       }
22306       ptr -> trim_ends_in_gaps = av.boolvalue;
22307       atp = AsnReadId(aip,amp, atp);
22308    }
22309    if (atp == ADJUST_FEATURES_FOR_GAPS_ACTION_split_for_internal_gaps) {
22310       if ( AsnReadVal(aip, atp, &av) <= 0) {
22311          goto erret;
22312       }
22313       ptr -> split_for_internal_gaps = av.boolvalue;
22314       atp = AsnReadId(aip,amp, atp);
22315    }
22316    if (atp == ADJUST_FEATURES_FOR_GAPS_ACTION_even_when_gaps_are_in_introns) {
22317       if ( AsnReadVal(aip, atp, &av) <= 0) {
22318          goto erret;
22319       }
22320       ptr -> even_when_gaps_are_in_introns = av.boolvalue;
22321       atp = AsnReadId(aip,amp, atp);
22322    }
22323 
22324    if (AsnReadVal(aip, atp, &av) <= 0) {
22325       goto erret;
22326    }
22327    /* end struct */
22328 
22329 ret:
22330    AsnUnlinkType(orig);       /* unlink local tree */
22331    return ptr;
22332 
22333 erret:
22334    aip -> io_failure = TRUE;
22335    ptr = AdjustFeaturesForGapsActionFree(ptr);
22336    goto ret;
22337 }
22338 
22339 
22340 
22341 /**************************************************
22342 *
22343 *    AdjustFeaturesForGapsActionAsnWrite()
22344 *
22345 **************************************************/
22346 NLM_EXTERN Boolean LIBCALL
AdjustFeaturesForGapsActionAsnWrite(AdjustFeaturesForGapsActionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)22347 AdjustFeaturesForGapsActionAsnWrite(AdjustFeaturesForGapsActionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
22348 {
22349    DataVal av;
22350    AsnTypePtr atp;
22351    Boolean retval = FALSE;
22352 
22353    if (! loaded)
22354    {
22355       if (! objmacroAsnLoad()) {
22356          return FALSE;
22357       }
22358    }
22359 
22360    if (aip == NULL) {
22361       return FALSE;
22362    }
22363 
22364    atp = AsnLinkType(orig, ADJUST_FEATURES_FOR_GAPS_ACTION);   /* link local tree */
22365    if (atp == NULL) {
22366       return FALSE;
22367    }
22368 
22369    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
22370 
22371     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
22372 
22373    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
22374       goto erret;
22375    }
22376 
22377    av.intvalue = ptr -> type;
22378    retval = AsnWrite(aip, ADJUST_FEATURES_FOR_GAPS_ACTION_type,  &av);
22379    av.boolvalue = ptr -> adjust_for_unknown_length_gaps;
22380    retval = AsnWrite(aip, ADJUST_FEATURES_FOR_GAPS_ACTION_adjust_for_unknown_length_gaps,  &av);
22381    av.boolvalue = ptr -> adjust_for_known_length_gaps;
22382    retval = AsnWrite(aip, ADJUST_FEATURES_FOR_GAPS_ACTION_adjust_for_known_length_gaps,  &av);
22383    av.intvalue = ptr -> make_truncated_ends_partial;
22384    retval = AsnWrite(aip, ADJUST_FEATURES_FOR_GAPS_ACTION_make_truncated_ends_partial,  &av);
22385    av.boolvalue = ptr -> trim_ends_in_gaps;
22386    retval = AsnWrite(aip, ADJUST_FEATURES_FOR_GAPS_ACTION_trim_ends_in_gaps,  &av);
22387    av.boolvalue = ptr -> split_for_internal_gaps;
22388    retval = AsnWrite(aip, ADJUST_FEATURES_FOR_GAPS_ACTION_split_for_internal_gaps,  &av);
22389    av.boolvalue = ptr -> even_when_gaps_are_in_introns;
22390    retval = AsnWrite(aip, ADJUST_FEATURES_FOR_GAPS_ACTION_even_when_gaps_are_in_introns,  &av);
22391    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
22392       goto erret;
22393    }
22394    retval = TRUE;
22395 
22396 erret:
22397    AsnUnlinkType(orig);       /* unlink local tree */
22398    return retval;
22399 }
22400 
22401 
22402 
22403 /**************************************************
22404 *
22405 *    MacroActionChoiceFree()
22406 *
22407 **************************************************/
22408 NLM_EXTERN
22409 MacroActionChoicePtr LIBCALL
MacroActionChoiceFree(ValNodePtr anp)22410 MacroActionChoiceFree(ValNodePtr anp)
22411 {
22412    Pointer pnt;
22413 
22414    if (anp == NULL) {
22415       return NULL;
22416    }
22417 
22418    pnt = anp->data.ptrvalue;
22419    switch (anp->choice)
22420    {
22421    default:
22422       break;
22423    case MacroActionChoice_aecr:
22424       AECRActionFree(anp -> data.ptrvalue);
22425       break;
22426    case MacroActionChoice_parse:
22427       ParseActionFree(anp -> data.ptrvalue);
22428       break;
22429    case MacroActionChoice_add_feature:
22430       ApplyFeatureActionFree(anp -> data.ptrvalue);
22431       break;
22432    case MacroActionChoice_remove_feature:
22433       RemoveFeatureActionFree(anp -> data.ptrvalue);
22434       break;
22435    case MacroActionChoice_convert_feature:
22436       ConvertFeatureActionFree(anp -> data.ptrvalue);
22437       break;
22438    case MacroActionChoice_edit_location:
22439       EditFeatureLocationActionFree(anp -> data.ptrvalue);
22440       break;
22441    case MacroActionChoice_remove_descriptor:
22442       RemoveDescriptorActionFree(anp -> data.ptrvalue);
22443       break;
22444    case MacroActionChoice_autodef:
22445       AutodefActionFree(anp -> data.ptrvalue);
22446       break;
22447    case MacroActionChoice_fix_pub_caps:
22448       FixPubCapsActionFree(anp -> data.ptrvalue);
22449       break;
22450    case MacroActionChoice_sort_fields:
22451       SortFieldsActionFree(anp -> data.ptrvalue);
22452       break;
22453    case MacroActionChoice_apply_molinfo_block:
22454       MolinfoBlockFree(anp -> data.ptrvalue);
22455       break;
22456    case MacroActionChoice_fix_caps:
22457       FixCapsActionFree(anp -> data.ptrvalue);
22458       break;
22459    case MacroActionChoice_fix_format:
22460       FixFormatActionFree(anp -> data.ptrvalue);
22461       break;
22462    case MacroActionChoice_remove_duplicate_features:
22463       RemoveDuplicateFeatureActionFree(anp -> data.ptrvalue);
22464       break;
22465    case MacroActionChoice_remove_xrefs:
22466       RemoveXrefsActionFree(anp -> data.ptrvalue);
22467       break;
22468    case MacroActionChoice_make_gene_xrefs:
22469       MakeGeneXrefActionFree(anp -> data.ptrvalue);
22470       break;
22471    case MacroActionChoice_fix_author:
22472       AuthorFixActionFree(anp -> data.ptrvalue);
22473       break;
22474    case MacroActionChoice_update_sequences:
22475       UpdateSequencesActionFree(anp -> data.ptrvalue);
22476       break;
22477    case MacroActionChoice_create_tsa_ids:
22478       CreateTSAIdsActionFree(anp -> data.ptrvalue);
22479       break;
22480    case MacroActionChoice_perform_autofix:
22481       AutofixActionFree(anp -> data.ptrvalue);
22482       break;
22483    case MacroActionChoice_fix_sets:
22484       FixSetsActionFree(anp -> data.ptrvalue);
22485       break;
22486    case MacroActionChoice_apply_table:
22487       ApplyTableActionFree(anp -> data.ptrvalue);
22488       break;
22489    case MacroActionChoice_remove_sequences:
22490       RemoveSequencesActionFree(anp -> data.ptrvalue);
22491       break;
22492    case MacroActionChoice_add_file_descriptors:
22493       AddDescriptorListActionFree(anp -> data.ptrvalue);
22494       break;
22495    case MacroActionChoice_update_replaced_ecnumbers:
22496       UpdateReplacedEcNumbersActionFree(anp -> data.ptrvalue);
22497       break;
22498    case MacroActionChoice_retranslate_cds:
22499       RetranslateCdsActionFree(anp -> data.ptrvalue);
22500       break;
22501    case MacroActionChoice_adjust_features_for_gaps:
22502       AdjustFeaturesForGapsActionFree(anp -> data.ptrvalue);
22503       break;
22504    }
22505    return MemFree(anp);
22506 }
22507 
22508 
22509 /**************************************************
22510 *
22511 *    MacroActionChoiceAsnRead()
22512 *
22513 **************************************************/
22514 NLM_EXTERN
22515 MacroActionChoicePtr LIBCALL
MacroActionChoiceAsnRead(AsnIoPtr aip,AsnTypePtr orig)22516 MacroActionChoiceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
22517 {
22518    DataVal av;
22519    AsnTypePtr atp;
22520    ValNodePtr anp;
22521    Uint1 choice;
22522    Boolean isError = FALSE;
22523    Boolean nullIsError = FALSE;
22524    AsnReadFunc func;
22525 
22526    if (! loaded)
22527    {
22528       if (! objmacroAsnLoad()) {
22529          return NULL;
22530       }
22531    }
22532 
22533    if (aip == NULL) {
22534       return NULL;
22535    }
22536 
22537    if (orig == NULL) {         /* MacroActionChoice ::= (self contained) */
22538       atp = AsnReadId(aip, amp, MACRO_ACTION_CHOICE);
22539    } else {
22540       atp = AsnLinkType(orig, MACRO_ACTION_CHOICE);    /* link in local tree */
22541    }
22542    if (atp == NULL) {
22543       return NULL;
22544    }
22545 
22546    anp = ValNodeNew(NULL);
22547    if (anp == NULL) {
22548       goto erret;
22549    }
22550    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
22551       goto erret;
22552    }
22553 
22554    func = NULL;
22555 
22556    atp = AsnReadId(aip, amp, atp);  /* find the choice */
22557    if (atp == NULL) {
22558       goto erret;
22559    }
22560    if (atp == MACRO_ACTION_CHOICE_aecr) {
22561       choice = MacroActionChoice_aecr;
22562       func = (AsnReadFunc) AECRActionAsnRead;
22563    }
22564    else if (atp == MACRO_ACTION_CHOICE_parse) {
22565       choice = MacroActionChoice_parse;
22566       func = (AsnReadFunc) ParseActionAsnRead;
22567    }
22568    else if (atp == MACRO_ACTION_CHOICE_add_feature) {
22569       choice = MacroActionChoice_add_feature;
22570       func = (AsnReadFunc) ApplyFeatureActionAsnRead;
22571    }
22572    else if (atp == MACRO_ACTION_CHOICE_remove_feature) {
22573       choice = MacroActionChoice_remove_feature;
22574       func = (AsnReadFunc) RemoveFeatureActionAsnRead;
22575    }
22576    else if (atp == MACRO_ACTION_CHOICE_convert_feature) {
22577       choice = MacroActionChoice_convert_feature;
22578       func = (AsnReadFunc) ConvertFeatureActionAsnRead;
22579    }
22580    else if (atp == MACRO_ACTION_CHOICE_edit_location) {
22581       choice = MacroActionChoice_edit_location;
22582       func = (AsnReadFunc) EditFeatureLocationActionAsnRead;
22583    }
22584    else if (atp == MACRO_ACTION_CHOICE_remove_descriptor) {
22585       choice = MacroActionChoice_remove_descriptor;
22586       func = (AsnReadFunc) RemoveDescriptorActionAsnRead;
22587    }
22588    else if (atp == MACRO_ACTION_CHOICE_autodef) {
22589       choice = MacroActionChoice_autodef;
22590       func = (AsnReadFunc) AutodefActionAsnRead;
22591    }
22592    else if (atp == MACRO_ACTION_CHOICE_removesets) {
22593       choice = MacroActionChoice_removesets;
22594       if (AsnReadVal(aip, atp, &av) <= 0) {
22595          goto erret;
22596       }
22597       anp->data.boolvalue = av.boolvalue;
22598    }
22599    else if (atp == MACRO_ACTION_CHOICE_trim_junk_from_primer_seq) {
22600       choice = MacroActionChoice_trim_junk_from_primer_seq;
22601       if (AsnReadVal(aip, atp, &av) <= 0) {
22602          goto erret;
22603       }
22604       anp->data.boolvalue = av.boolvalue;
22605    }
22606    else if (atp == MACRO_ACTION_CHOICE_trim_stop_from_complete_cds) {
22607       choice = MacroActionChoice_trim_stop_from_complete_cds;
22608       if (AsnReadVal(aip, atp, &av) <= 0) {
22609          goto erret;
22610       }
22611       anp->data.boolvalue = av.boolvalue;
22612    }
22613    else if (atp == MACRO_ACTION_CHOICE_fix_usa_and_states) {
22614       choice = MacroActionChoice_fix_usa_and_states;
22615       if (AsnReadVal(aip, atp, &av) <= 0) {
22616          goto erret;
22617       }
22618       anp->data.boolvalue = av.boolvalue;
22619    }
22620    else if (atp == MACRO_ACTION_CHOICE_synchronize_cds_partials) {
22621       choice = MacroActionChoice_synchronize_cds_partials;
22622       if (AsnReadVal(aip, atp, &av) <= 0) {
22623          goto erret;
22624       }
22625       anp->data.boolvalue = av.boolvalue;
22626    }
22627    else if (atp == MACRO_ACTION_CHOICE_adjust_for_consensus_splice) {
22628       choice = MacroActionChoice_adjust_for_consensus_splice;
22629       if (AsnReadVal(aip, atp, &av) <= 0) {
22630          goto erret;
22631       }
22632       anp->data.boolvalue = av.boolvalue;
22633    }
22634    else if (atp == MACRO_ACTION_CHOICE_fix_pub_caps) {
22635       choice = MacroActionChoice_fix_pub_caps;
22636       func = (AsnReadFunc) FixPubCapsActionAsnRead;
22637    }
22638    else if (atp == MACRO_ACTION_CHOICE_remove_seg_gaps) {
22639       choice = MacroActionChoice_remove_seg_gaps;
22640       if (AsnReadVal(aip, atp, &av) <= 0) {
22641          goto erret;
22642       }
22643       anp->data.boolvalue = av.boolvalue;
22644    }
22645    else if (atp == MACRO_ACTION_CHOICE_sort_fields) {
22646       choice = MacroActionChoice_sort_fields;
22647       func = (AsnReadFunc) SortFieldsActionAsnRead;
22648    }
22649    else if (atp == MACRO_ACTION_CHOICE_apply_molinfo_block) {
22650       choice = MacroActionChoice_apply_molinfo_block;
22651       func = (AsnReadFunc) MolinfoBlockAsnRead;
22652    }
22653    else if (atp == MACRO_ACTION_CHOICE_fix_caps) {
22654       choice = MacroActionChoice_fix_caps;
22655       func = (AsnReadFunc) FixCapsActionAsnRead;
22656    }
22657    else if (atp == MACRO_ACTION_CHOICE_fix_format) {
22658       choice = MacroActionChoice_fix_format;
22659       func = (AsnReadFunc) FixFormatActionAsnRead;
22660    }
22661    else if (atp == MACRO_ACTION_CHOICE_fix_spell) {
22662       choice = MacroActionChoice_fix_spell;
22663       if (AsnReadVal(aip, atp, &av) <= 0) {
22664          goto erret;
22665       }
22666       anp->data.boolvalue = av.boolvalue;
22667    }
22668    else if (atp == MACRO_ACTION_CHOICE_remove_duplicate_features) {
22669       choice = MacroActionChoice_remove_duplicate_features;
22670       func = (AsnReadFunc) RemoveDuplicateFeatureActionAsnRead;
22671    }
22672    else if (atp == MACRO_ACTION_CHOICE_remove_lineage_notes) {
22673       choice = MacroActionChoice_remove_lineage_notes;
22674       if (AsnReadVal(aip, atp, &av) <= 0) {
22675          goto erret;
22676       }
22677       anp->data.boolvalue = av.boolvalue;
22678    }
22679    else if (atp == MACRO_ACTION_CHOICE_remove_xrefs) {
22680       choice = MacroActionChoice_remove_xrefs;
22681       func = (AsnReadFunc) RemoveXrefsActionAsnRead;
22682    }
22683    else if (atp == MACRO_ACTION_CHOICE_make_gene_xrefs) {
22684       choice = MacroActionChoice_make_gene_xrefs;
22685       func = (AsnReadFunc) MakeGeneXrefActionAsnRead;
22686    }
22687    else if (atp == MACRO_ACTION_CHOICE_make_bold_xrefs) {
22688       choice = MacroActionChoice_make_bold_xrefs;
22689       if (AsnReadVal(aip, atp, &av) <= 0) {
22690          goto erret;
22691       }
22692       anp->data.boolvalue = av.boolvalue;
22693    }
22694    else if (atp == MACRO_ACTION_CHOICE_fix_author) {
22695       choice = MacroActionChoice_fix_author;
22696       func = (AsnReadFunc) AuthorFixActionAsnRead;
22697    }
22698    else if (atp == MACRO_ACTION_CHOICE_update_sequences) {
22699       choice = MacroActionChoice_update_sequences;
22700       func = (AsnReadFunc) UpdateSequencesActionAsnRead;
22701    }
22702    else if (atp == MACRO_ACTION_CHOICE_add_trans_splicing) {
22703       choice = MacroActionChoice_add_trans_splicing;
22704       if (AsnReadVal(aip, atp, &av) <= 0) {
22705          goto erret;
22706       }
22707       anp->data.boolvalue = av.boolvalue;
22708    }
22709    else if (atp == MACRO_ACTION_CHOICE_remove_invalid_ecnumbers) {
22710       choice = MacroActionChoice_remove_invalid_ecnumbers;
22711       if (AsnReadVal(aip, atp, &av) <= 0) {
22712          goto erret;
22713       }
22714       anp->data.boolvalue = av.boolvalue;
22715    }
22716    else if (atp == MACRO_ACTION_CHOICE_create_tsa_ids) {
22717       choice = MacroActionChoice_create_tsa_ids;
22718       func = (AsnReadFunc) CreateTSAIdsActionAsnRead;
22719    }
22720    else if (atp == MACRO_ACTION_CHOICE_perform_autofix) {
22721       choice = MacroActionChoice_perform_autofix;
22722       func = (AsnReadFunc) AutofixActionAsnRead;
22723    }
22724    else if (atp == MACRO_ACTION_CHOICE_fix_sets) {
22725       choice = MacroActionChoice_fix_sets;
22726       func = (AsnReadFunc) FixSetsActionAsnRead;
22727    }
22728    else if (atp == MACRO_ACTION_CHOICE_apply_table) {
22729       choice = MacroActionChoice_apply_table;
22730       func = (AsnReadFunc) ApplyTableActionAsnRead;
22731    }
22732    else if (atp == MACRO_ACTION_CHOICE_remove_sequences) {
22733       choice = MacroActionChoice_remove_sequences;
22734       func = (AsnReadFunc) RemoveSequencesActionAsnRead;
22735    }
22736    else if (atp == MACRO_ACTION_CHOICE_propagate_sequence_technology) {
22737       choice = MacroActionChoice_propagate_sequence_technology;
22738       if (AsnReadVal(aip, atp, &av) <= 0) {
22739          goto erret;
22740       }
22741       anp->data.boolvalue = av.boolvalue;
22742    }
22743    else if (atp == MACRO_ACTION_CHOICE_add_file_descriptors) {
22744       choice = MacroActionChoice_add_file_descriptors;
22745       func = (AsnReadFunc) AddDescriptorListActionAsnRead;
22746    }
22747    else if (atp == MACRO_ACTION_CHOICE_propagate_missing_old_name) {
22748       choice = MacroActionChoice_propagate_missing_old_name;
22749       if (AsnReadVal(aip, atp, &av) <= 0) {
22750          goto erret;
22751       }
22752       anp->data.boolvalue = av.boolvalue;
22753    }
22754    else if (atp == MACRO_ACTION_CHOICE_autoapply_structured_comments) {
22755       choice = MacroActionChoice_autoapply_structured_comments;
22756       if (AsnReadVal(aip, atp, &av) <= 0) {
22757          goto erret;
22758       }
22759       anp->data.boolvalue = av.boolvalue;
22760    }
22761    else if (atp == MACRO_ACTION_CHOICE_reorder_structured_comments) {
22762       choice = MacroActionChoice_reorder_structured_comments;
22763       if (AsnReadVal(aip, atp, &av) <= 0) {
22764          goto erret;
22765       }
22766       anp->data.boolvalue = av.boolvalue;
22767    }
22768    else if (atp == MACRO_ACTION_CHOICE_remove_duplicate_structured_comments) {
22769       choice = MacroActionChoice_remove_duplicate_structured_comments;
22770       if (AsnReadVal(aip, atp, &av) <= 0) {
22771          goto erret;
22772       }
22773       anp->data.boolvalue = av.boolvalue;
22774    }
22775    else if (atp == MACRO_ACTION_CHOICE_lookup_taxonomy) {
22776       choice = MacroActionChoice_lookup_taxonomy;
22777       if (AsnReadVal(aip, atp, &av) <= 0) {
22778          goto erret;
22779       }
22780       anp->data.boolvalue = av.boolvalue;
22781    }
22782    else if (atp == MACRO_ACTION_CHOICE_lookup_pubs) {
22783       choice = MacroActionChoice_lookup_pubs;
22784       if (AsnReadVal(aip, atp, &av) <= 0) {
22785          goto erret;
22786       }
22787       anp->data.boolvalue = av.boolvalue;
22788    }
22789    else if (atp == MACRO_ACTION_CHOICE_trim_terminal_ns) {
22790       choice = MacroActionChoice_trim_terminal_ns;
22791       if (AsnReadVal(aip, atp, &av) <= 0) {
22792          goto erret;
22793       }
22794       anp->data.boolvalue = av.boolvalue;
22795    }
22796    else if (atp == MACRO_ACTION_CHOICE_update_replaced_ecnumbers) {
22797       choice = MacroActionChoice_update_replaced_ecnumbers;
22798       func = (AsnReadFunc) UpdateReplacedEcNumbersActionAsnRead;
22799    }
22800    else if (atp == MACRO_ACTION_CHOICE_instantiate_protein_titles) {
22801       choice = MacroActionChoice_instantiate_protein_titles;
22802       if (AsnReadVal(aip, atp, &av) <= 0) {
22803          goto erret;
22804       }
22805       anp->data.boolvalue = av.boolvalue;
22806    }
22807    else if (atp == MACRO_ACTION_CHOICE_retranslate_cds) {
22808       choice = MacroActionChoice_retranslate_cds;
22809       func = (AsnReadFunc) RetranslateCdsActionAsnRead;
22810    }
22811    else if (atp == MACRO_ACTION_CHOICE_add_selenocysteine_except) {
22812       choice = MacroActionChoice_add_selenocysteine_except;
22813       if (AsnReadVal(aip, atp, &av) <= 0) {
22814          goto erret;
22815       }
22816       anp->data.boolvalue = av.boolvalue;
22817    }
22818    else if (atp == MACRO_ACTION_CHOICE_join_short_trnas) {
22819       choice = MacroActionChoice_join_short_trnas;
22820       if (AsnReadVal(aip, atp, &av) <= 0) {
22821          goto erret;
22822       }
22823       anp->data.boolvalue = av.boolvalue;
22824    }
22825    else if (atp == MACRO_ACTION_CHOICE_adjust_features_for_gaps) {
22826       choice = MacroActionChoice_adjust_features_for_gaps;
22827       func = (AsnReadFunc) AdjustFeaturesForGapsActionAsnRead;
22828    }
22829    anp->choice = choice;
22830    if (func != NULL)
22831    {
22832       anp->data.ptrvalue = (* func)(aip, atp);
22833       if (aip -> io_failure) goto erret;
22834 
22835       if (nullIsError && anp->data.ptrvalue == NULL) {
22836          goto erret;
22837       }
22838    }
22839 
22840 ret:
22841    AsnUnlinkType(orig);       /* unlink local tree */
22842    return anp;
22843 
22844 erret:
22845    anp = MemFree(anp);
22846    aip -> io_failure = TRUE;
22847    goto ret;
22848 }
22849 
22850 
22851 /**************************************************
22852 *
22853 *    MacroActionChoiceAsnWrite()
22854 *
22855 **************************************************/
22856 NLM_EXTERN Boolean LIBCALL
MacroActionChoiceAsnWrite(MacroActionChoicePtr anp,AsnIoPtr aip,AsnTypePtr orig)22857 MacroActionChoiceAsnWrite(MacroActionChoicePtr anp, AsnIoPtr aip, AsnTypePtr orig)
22858 
22859 {
22860    DataVal av;
22861    AsnTypePtr atp, writetype = NULL;
22862    Pointer pnt;
22863    AsnWriteFunc func = NULL;
22864    Boolean retval = FALSE;
22865 
22866    if (! loaded)
22867    {
22868       if (! objmacroAsnLoad())
22869       return FALSE;
22870    }
22871 
22872    if (aip == NULL)
22873    return FALSE;
22874 
22875    atp = AsnLinkType(orig, MACRO_ACTION_CHOICE);   /* link local tree */
22876    if (atp == NULL) {
22877       return FALSE;
22878    }
22879 
22880    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
22881 
22882     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
22883 
22884    av.ptrvalue = (Pointer)anp;
22885    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
22886       goto erret;
22887    }
22888 
22889    pnt = anp->data.ptrvalue;
22890    switch (anp->choice)
22891    {
22892    case MacroActionChoice_aecr:
22893       writetype = MACRO_ACTION_CHOICE_aecr;
22894       func = (AsnWriteFunc) AECRActionAsnWrite;
22895       break;
22896    case MacroActionChoice_parse:
22897       writetype = MACRO_ACTION_CHOICE_parse;
22898       func = (AsnWriteFunc) ParseActionAsnWrite;
22899       break;
22900    case MacroActionChoice_add_feature:
22901       writetype = MACRO_ACTION_CHOICE_add_feature;
22902       func = (AsnWriteFunc) ApplyFeatureActionAsnWrite;
22903       break;
22904    case MacroActionChoice_remove_feature:
22905       writetype = MACRO_ACTION_CHOICE_remove_feature;
22906       func = (AsnWriteFunc) RemoveFeatureActionAsnWrite;
22907       break;
22908    case MacroActionChoice_convert_feature:
22909       writetype = MACRO_ACTION_CHOICE_convert_feature;
22910       func = (AsnWriteFunc) ConvertFeatureActionAsnWrite;
22911       break;
22912    case MacroActionChoice_edit_location:
22913       writetype = MACRO_ACTION_CHOICE_edit_location;
22914       func = (AsnWriteFunc) EditFeatureLocationActionAsnWrite;
22915       break;
22916    case MacroActionChoice_remove_descriptor:
22917       writetype = MACRO_ACTION_CHOICE_remove_descriptor;
22918       func = (AsnWriteFunc) RemoveDescriptorActionAsnWrite;
22919       break;
22920    case MacroActionChoice_autodef:
22921       writetype = MACRO_ACTION_CHOICE_autodef;
22922       func = (AsnWriteFunc) AutodefActionAsnWrite;
22923       break;
22924    case MacroActionChoice_removesets:
22925       av.boolvalue = anp->data.boolvalue;
22926       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_removesets, &av);
22927       break;
22928    case MacroActionChoice_trim_junk_from_primer_seq:
22929       av.boolvalue = anp->data.boolvalue;
22930       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_trim_junk_from_primer_seq, &av);
22931       break;
22932    case MacroActionChoice_trim_stop_from_complete_cds:
22933       av.boolvalue = anp->data.boolvalue;
22934       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_trim_stop_from_complete_cds, &av);
22935       break;
22936    case MacroActionChoice_fix_usa_and_states:
22937       av.boolvalue = anp->data.boolvalue;
22938       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_fix_usa_and_states, &av);
22939       break;
22940    case MacroActionChoice_synchronize_cds_partials:
22941       av.boolvalue = anp->data.boolvalue;
22942       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_synchronize_cds_partials, &av);
22943       break;
22944    case MacroActionChoice_adjust_for_consensus_splice:
22945       av.boolvalue = anp->data.boolvalue;
22946       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_adjust_for_consensus_splice, &av);
22947       break;
22948    case MacroActionChoice_fix_pub_caps:
22949       writetype = MACRO_ACTION_CHOICE_fix_pub_caps;
22950       func = (AsnWriteFunc) FixPubCapsActionAsnWrite;
22951       break;
22952    case MacroActionChoice_remove_seg_gaps:
22953       av.boolvalue = anp->data.boolvalue;
22954       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_remove_seg_gaps, &av);
22955       break;
22956    case MacroActionChoice_sort_fields:
22957       writetype = MACRO_ACTION_CHOICE_sort_fields;
22958       func = (AsnWriteFunc) SortFieldsActionAsnWrite;
22959       break;
22960    case MacroActionChoice_apply_molinfo_block:
22961       writetype = MACRO_ACTION_CHOICE_apply_molinfo_block;
22962       func = (AsnWriteFunc) MolinfoBlockAsnWrite;
22963       break;
22964    case MacroActionChoice_fix_caps:
22965       writetype = MACRO_ACTION_CHOICE_fix_caps;
22966       func = (AsnWriteFunc) FixCapsActionAsnWrite;
22967       break;
22968    case MacroActionChoice_fix_format:
22969       writetype = MACRO_ACTION_CHOICE_fix_format;
22970       func = (AsnWriteFunc) FixFormatActionAsnWrite;
22971       break;
22972    case MacroActionChoice_fix_spell:
22973       av.boolvalue = anp->data.boolvalue;
22974       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_fix_spell, &av);
22975       break;
22976    case MacroActionChoice_remove_duplicate_features:
22977       writetype = MACRO_ACTION_CHOICE_remove_duplicate_features;
22978       func = (AsnWriteFunc) RemoveDuplicateFeatureActionAsnWrite;
22979       break;
22980    case MacroActionChoice_remove_lineage_notes:
22981       av.boolvalue = anp->data.boolvalue;
22982       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_remove_lineage_notes, &av);
22983       break;
22984    case MacroActionChoice_remove_xrefs:
22985       writetype = MACRO_ACTION_CHOICE_remove_xrefs;
22986       func = (AsnWriteFunc) RemoveXrefsActionAsnWrite;
22987       break;
22988    case MacroActionChoice_make_gene_xrefs:
22989       writetype = MACRO_ACTION_CHOICE_make_gene_xrefs;
22990       func = (AsnWriteFunc) MakeGeneXrefActionAsnWrite;
22991       break;
22992    case MacroActionChoice_make_bold_xrefs:
22993       av.boolvalue = anp->data.boolvalue;
22994       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_make_bold_xrefs, &av);
22995       break;
22996    case MacroActionChoice_fix_author:
22997       writetype = MACRO_ACTION_CHOICE_fix_author;
22998       func = (AsnWriteFunc) AuthorFixActionAsnWrite;
22999       break;
23000    case MacroActionChoice_update_sequences:
23001       writetype = MACRO_ACTION_CHOICE_update_sequences;
23002       func = (AsnWriteFunc) UpdateSequencesActionAsnWrite;
23003       break;
23004    case MacroActionChoice_add_trans_splicing:
23005       av.boolvalue = anp->data.boolvalue;
23006       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_add_trans_splicing, &av);
23007       break;
23008    case MacroActionChoice_remove_invalid_ecnumbers:
23009       av.boolvalue = anp->data.boolvalue;
23010       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_remove_invalid_ecnumbers, &av);
23011       break;
23012    case MacroActionChoice_create_tsa_ids:
23013       writetype = MACRO_ACTION_CHOICE_create_tsa_ids;
23014       func = (AsnWriteFunc) CreateTSAIdsActionAsnWrite;
23015       break;
23016    case MacroActionChoice_perform_autofix:
23017       writetype = MACRO_ACTION_CHOICE_perform_autofix;
23018       func = (AsnWriteFunc) AutofixActionAsnWrite;
23019       break;
23020    case MacroActionChoice_fix_sets:
23021       writetype = MACRO_ACTION_CHOICE_fix_sets;
23022       func = (AsnWriteFunc) FixSetsActionAsnWrite;
23023       break;
23024    case MacroActionChoice_apply_table:
23025       writetype = MACRO_ACTION_CHOICE_apply_table;
23026       func = (AsnWriteFunc) ApplyTableActionAsnWrite;
23027       break;
23028    case MacroActionChoice_remove_sequences:
23029       writetype = MACRO_ACTION_CHOICE_remove_sequences;
23030       func = (AsnWriteFunc) RemoveSequencesActionAsnWrite;
23031       break;
23032    case MacroActionChoice_propagate_sequence_technology:
23033       av.boolvalue = anp->data.boolvalue;
23034       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_propagate_sequence_technology, &av);
23035       break;
23036    case MacroActionChoice_add_file_descriptors:
23037       writetype = MACRO_ACTION_CHOICE_add_file_descriptors;
23038       func = (AsnWriteFunc) AddDescriptorListActionAsnWrite;
23039       break;
23040    case MacroActionChoice_propagate_missing_old_name:
23041       av.boolvalue = anp->data.boolvalue;
23042       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_propagate_missing_old_name, &av);
23043       break;
23044    case MacroActionChoice_autoapply_structured_comments:
23045       av.boolvalue = anp->data.boolvalue;
23046       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_autoapply_structured_comments, &av);
23047       break;
23048    case MacroActionChoice_reorder_structured_comments:
23049       av.boolvalue = anp->data.boolvalue;
23050       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_reorder_structured_comments, &av);
23051       break;
23052    case MacroActionChoice_remove_duplicate_structured_comments:
23053       av.boolvalue = anp->data.boolvalue;
23054       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_remove_duplicate_structured_comments, &av);
23055       break;
23056    case MacroActionChoice_lookup_taxonomy:
23057       av.boolvalue = anp->data.boolvalue;
23058       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_lookup_taxonomy, &av);
23059       break;
23060    case MacroActionChoice_lookup_pubs:
23061       av.boolvalue = anp->data.boolvalue;
23062       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_lookup_pubs, &av);
23063       break;
23064    case MacroActionChoice_trim_terminal_ns:
23065       av.boolvalue = anp->data.boolvalue;
23066       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_trim_terminal_ns, &av);
23067       break;
23068    case MacroActionChoice_update_replaced_ecnumbers:
23069       writetype = MACRO_ACTION_CHOICE_update_replaced_ecnumbers;
23070       func = (AsnWriteFunc) UpdateReplacedEcNumbersActionAsnWrite;
23071       break;
23072    case MacroActionChoice_instantiate_protein_titles:
23073       av.boolvalue = anp->data.boolvalue;
23074       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_instantiate_protein_titles, &av);
23075       break;
23076    case MacroActionChoice_retranslate_cds:
23077       writetype = MACRO_ACTION_CHOICE_retranslate_cds;
23078       func = (AsnWriteFunc) RetranslateCdsActionAsnWrite;
23079       break;
23080    case MacroActionChoice_add_selenocysteine_except:
23081       av.boolvalue = anp->data.boolvalue;
23082       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_add_selenocysteine_except, &av);
23083       break;
23084    case MacroActionChoice_join_short_trnas:
23085       av.boolvalue = anp->data.boolvalue;
23086       retval = AsnWrite(aip, MACRO_ACTION_CHOICE_join_short_trnas, &av);
23087       break;
23088    case MacroActionChoice_adjust_features_for_gaps:
23089       writetype = MACRO_ACTION_CHOICE_adjust_features_for_gaps;
23090       func = (AsnWriteFunc) AdjustFeaturesForGapsActionAsnWrite;
23091       break;
23092    }
23093    if (writetype != NULL) {
23094       retval = (* func)(pnt, aip, writetype);   /* write it out */
23095    }
23096    if (!retval) {
23097       goto erret;
23098    }
23099    retval = TRUE;
23100 
23101 erret:
23102    AsnUnlinkType(orig);       /* unlink local tree */
23103    return retval;
23104 }
23105 
23106 
23107 /**************************************************
23108 *
23109 *    SearchFuncFree()
23110 *
23111 **************************************************/
23112 NLM_EXTERN
23113 SearchFuncPtr LIBCALL
SearchFuncFree(ValNodePtr anp)23114 SearchFuncFree(ValNodePtr anp)
23115 {
23116    Pointer pnt;
23117 
23118    if (anp == NULL) {
23119       return NULL;
23120    }
23121 
23122    pnt = anp->data.ptrvalue;
23123    switch (anp->choice)
23124    {
23125    default:
23126       break;
23127    case SearchFunc_string_constraint:
23128       StringConstraintFree(anp -> data.ptrvalue);
23129       break;
23130    case SearchFunc_prefix_and_numbers:
23131       MemFree(anp -> data.ptrvalue);
23132       break;
23133    case SearchFunc_has_term:
23134       MemFree(anp -> data.ptrvalue);
23135       break;
23136    }
23137    return MemFree(anp);
23138 }
23139 
23140 
23141 /**************************************************
23142 *
23143 *    SearchFuncAsnRead()
23144 *
23145 **************************************************/
23146 NLM_EXTERN
23147 SearchFuncPtr LIBCALL
SearchFuncAsnRead(AsnIoPtr aip,AsnTypePtr orig)23148 SearchFuncAsnRead(AsnIoPtr aip, AsnTypePtr orig)
23149 {
23150    DataVal av;
23151    AsnTypePtr atp;
23152    ValNodePtr anp;
23153    Uint1 choice;
23154    Boolean isError = FALSE;
23155    Boolean nullIsError = FALSE;
23156    AsnReadFunc func;
23157 
23158    if (! loaded)
23159    {
23160       if (! objmacroAsnLoad()) {
23161          return NULL;
23162       }
23163    }
23164 
23165    if (aip == NULL) {
23166       return NULL;
23167    }
23168 
23169    if (orig == NULL) {         /* SearchFunc ::= (self contained) */
23170       atp = AsnReadId(aip, amp, SEARCH_FUNC);
23171    } else {
23172       atp = AsnLinkType(orig, SEARCH_FUNC);    /* link in local tree */
23173    }
23174    if (atp == NULL) {
23175       return NULL;
23176    }
23177 
23178    anp = ValNodeNew(NULL);
23179    if (anp == NULL) {
23180       goto erret;
23181    }
23182    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
23183       goto erret;
23184    }
23185 
23186    func = NULL;
23187 
23188    atp = AsnReadId(aip, amp, atp);  /* find the choice */
23189    if (atp == NULL) {
23190       goto erret;
23191    }
23192    if (atp == SEARCH_FUNC_string_constraint) {
23193       choice = SearchFunc_string_constraint;
23194       func = (AsnReadFunc) StringConstraintAsnRead;
23195    }
23196    else if (atp == SEARCH_FUNC_contains_plural) {
23197       choice = SearchFunc_contains_plural;
23198       if (AsnReadVal(aip, atp, &av) <= 0) {
23199          goto erret;
23200       }
23201       anp->data.boolvalue = av.boolvalue;
23202    }
23203    else if (atp == SEARCH_FUNC_n_or_more_brackets_or_parentheses) {
23204       choice = SearchFunc_n_or_more_brackets_or_parentheses;
23205       if (AsnReadVal(aip, atp, &av) <= 0) {
23206          goto erret;
23207       }
23208       anp->data.intvalue = av.intvalue;
23209    }
23210    else if (atp == SEARCH_FUNC_three_numbers) {
23211       choice = SearchFunc_three_numbers;
23212       if (AsnReadVal(aip, atp, &av) <= 0) {
23213          goto erret;
23214       }
23215       anp->data.boolvalue = av.boolvalue;
23216    }
23217    else if (atp == SEARCH_FUNC_underscore) {
23218       choice = SearchFunc_underscore;
23219       if (AsnReadVal(aip, atp, &av) <= 0) {
23220          goto erret;
23221       }
23222       anp->data.boolvalue = av.boolvalue;
23223    }
23224    else if (atp == SEARCH_FUNC_prefix_and_numbers) {
23225       choice = SearchFunc_prefix_and_numbers;
23226       if (AsnReadVal(aip, atp, &av) <= 0) {
23227          goto erret;
23228       }
23229       anp->data.ptrvalue = av.ptrvalue;
23230    }
23231    else if (atp == SEARCH_FUNC_all_caps) {
23232       choice = SearchFunc_all_caps;
23233       if (AsnReadVal(aip, atp, &av) <= 0) {
23234          goto erret;
23235       }
23236       anp->data.boolvalue = av.boolvalue;
23237    }
23238    else if (atp == SEARCH_FUNC_unbalanced_paren) {
23239       choice = SearchFunc_unbalanced_paren;
23240       if (AsnReadVal(aip, atp, &av) <= 0) {
23241          goto erret;
23242       }
23243       anp->data.boolvalue = av.boolvalue;
23244    }
23245    else if (atp == SEARCH_FUNC_too_long) {
23246       choice = SearchFunc_too_long;
23247       if (AsnReadVal(aip, atp, &av) <= 0) {
23248          goto erret;
23249       }
23250       anp->data.intvalue = av.intvalue;
23251    }
23252    else if (atp == SEARCH_FUNC_has_term) {
23253       choice = SearchFunc_has_term;
23254       if (AsnReadVal(aip, atp, &av) <= 0) {
23255          goto erret;
23256       }
23257       anp->data.ptrvalue = av.ptrvalue;
23258    }
23259    anp->choice = choice;
23260    if (func != NULL)
23261    {
23262       anp->data.ptrvalue = (* func)(aip, atp);
23263       if (aip -> io_failure) goto erret;
23264 
23265       if (nullIsError && anp->data.ptrvalue == NULL) {
23266          goto erret;
23267       }
23268    }
23269 
23270 ret:
23271    AsnUnlinkType(orig);       /* unlink local tree */
23272    return anp;
23273 
23274 erret:
23275    anp = MemFree(anp);
23276    aip -> io_failure = TRUE;
23277    goto ret;
23278 }
23279 
23280 
23281 /**************************************************
23282 *
23283 *    SearchFuncAsnWrite()
23284 *
23285 **************************************************/
23286 NLM_EXTERN Boolean LIBCALL
SearchFuncAsnWrite(SearchFuncPtr anp,AsnIoPtr aip,AsnTypePtr orig)23287 SearchFuncAsnWrite(SearchFuncPtr anp, AsnIoPtr aip, AsnTypePtr orig)
23288 
23289 {
23290    DataVal av;
23291    AsnTypePtr atp, writetype = NULL;
23292    Pointer pnt;
23293    AsnWriteFunc func = NULL;
23294    Boolean retval = FALSE;
23295 
23296    if (! loaded)
23297    {
23298       if (! objmacroAsnLoad())
23299       return FALSE;
23300    }
23301 
23302    if (aip == NULL)
23303    return FALSE;
23304 
23305    atp = AsnLinkType(orig, SEARCH_FUNC);   /* link local tree */
23306    if (atp == NULL) {
23307       return FALSE;
23308    }
23309 
23310    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
23311 
23312     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
23313 
23314    av.ptrvalue = (Pointer)anp;
23315    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
23316       goto erret;
23317    }
23318 
23319    pnt = anp->data.ptrvalue;
23320    switch (anp->choice)
23321    {
23322    case SearchFunc_string_constraint:
23323       writetype = SEARCH_FUNC_string_constraint;
23324       func = (AsnWriteFunc) StringConstraintAsnWrite;
23325       break;
23326    case SearchFunc_contains_plural:
23327       av.boolvalue = anp->data.boolvalue;
23328       retval = AsnWrite(aip, SEARCH_FUNC_contains_plural, &av);
23329       break;
23330    case SearchFunc_n_or_more_brackets_or_parentheses:
23331       av.intvalue = anp->data.intvalue;
23332       retval = AsnWrite(aip, SEARCH_FUNC_n_or_more_brackets_or_parentheses, &av);
23333       break;
23334    case SearchFunc_three_numbers:
23335       av.boolvalue = anp->data.boolvalue;
23336       retval = AsnWrite(aip, SEARCH_FUNC_three_numbers, &av);
23337       break;
23338    case SearchFunc_underscore:
23339       av.boolvalue = anp->data.boolvalue;
23340       retval = AsnWrite(aip, SEARCH_FUNC_underscore, &av);
23341       break;
23342    case SearchFunc_prefix_and_numbers:
23343       av.ptrvalue = anp->data.ptrvalue;
23344       retval = AsnWrite(aip, SEARCH_FUNC_prefix_and_numbers, &av);
23345       break;
23346    case SearchFunc_all_caps:
23347       av.boolvalue = anp->data.boolvalue;
23348       retval = AsnWrite(aip, SEARCH_FUNC_all_caps, &av);
23349       break;
23350    case SearchFunc_unbalanced_paren:
23351       av.boolvalue = anp->data.boolvalue;
23352       retval = AsnWrite(aip, SEARCH_FUNC_unbalanced_paren, &av);
23353       break;
23354    case SearchFunc_too_long:
23355       av.intvalue = anp->data.intvalue;
23356       retval = AsnWrite(aip, SEARCH_FUNC_too_long, &av);
23357       break;
23358    case SearchFunc_has_term:
23359       av.ptrvalue = anp->data.ptrvalue;
23360       retval = AsnWrite(aip, SEARCH_FUNC_has_term, &av);
23361       break;
23362    }
23363    if (writetype != NULL) {
23364       retval = (* func)(pnt, aip, writetype);   /* write it out */
23365    }
23366    if (!retval) {
23367       goto erret;
23368    }
23369    retval = TRUE;
23370 
23371 erret:
23372    AsnUnlinkType(orig);       /* unlink local tree */
23373    return retval;
23374 }
23375 
23376 
23377 /**************************************************
23378 *
23379 *    SimpleReplaceNew()
23380 *
23381 **************************************************/
23382 NLM_EXTERN
23383 SimpleReplacePtr LIBCALL
SimpleReplaceNew(void)23384 SimpleReplaceNew(void)
23385 {
23386    SimpleReplacePtr ptr = MemNew((size_t) sizeof(SimpleReplace));
23387 
23388    ptr -> whole_string = 0;
23389    ptr -> weasel_to_putative = 0;
23390    return ptr;
23391 
23392 }
23393 
23394 
23395 /**************************************************
23396 *
23397 *    SimpleReplaceFree()
23398 *
23399 **************************************************/
23400 NLM_EXTERN
23401 SimpleReplacePtr LIBCALL
SimpleReplaceFree(SimpleReplacePtr ptr)23402 SimpleReplaceFree(SimpleReplacePtr ptr)
23403 {
23404 
23405    if(ptr == NULL) {
23406       return NULL;
23407    }
23408    MemFree(ptr -> replace);
23409    return MemFree(ptr);
23410 }
23411 
23412 
23413 /**************************************************
23414 *
23415 *    SimpleReplaceAsnRead()
23416 *
23417 **************************************************/
23418 NLM_EXTERN
23419 SimpleReplacePtr LIBCALL
SimpleReplaceAsnRead(AsnIoPtr aip,AsnTypePtr orig)23420 SimpleReplaceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
23421 {
23422    DataVal av;
23423    AsnTypePtr atp;
23424    Boolean isError = FALSE;
23425    AsnReadFunc func;
23426    SimpleReplacePtr ptr;
23427 
23428    if (! loaded)
23429    {
23430       if (! objmacroAsnLoad()) {
23431          return NULL;
23432       }
23433    }
23434 
23435    if (aip == NULL) {
23436       return NULL;
23437    }
23438 
23439    if (orig == NULL) {         /* SimpleReplace ::= (self contained) */
23440       atp = AsnReadId(aip, amp, SIMPLE_REPLACE);
23441    } else {
23442       atp = AsnLinkType(orig, SIMPLE_REPLACE);
23443    }
23444    /* link in local tree */
23445    if (atp == NULL) {
23446       return NULL;
23447    }
23448 
23449    ptr = SimpleReplaceNew();
23450    if (ptr == NULL) {
23451       goto erret;
23452    }
23453    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
23454       goto erret;
23455    }
23456 
23457    atp = AsnReadId(aip,amp, atp);
23458    func = NULL;
23459 
23460    if (atp == SIMPLE_REPLACE_replace) {
23461       if ( AsnReadVal(aip, atp, &av) <= 0) {
23462          goto erret;
23463       }
23464       ptr -> replace = av.ptrvalue;
23465       atp = AsnReadId(aip,amp, atp);
23466    }
23467    if (atp == SIMPLE_REPLACE_whole_string) {
23468       if ( AsnReadVal(aip, atp, &av) <= 0) {
23469          goto erret;
23470       }
23471       ptr -> whole_string = av.boolvalue;
23472       atp = AsnReadId(aip,amp, atp);
23473    }
23474    if (atp == SIMPLE_REPLACE_weasel_to_putative) {
23475       if ( AsnReadVal(aip, atp, &av) <= 0) {
23476          goto erret;
23477       }
23478       ptr -> weasel_to_putative = av.boolvalue;
23479       atp = AsnReadId(aip,amp, atp);
23480    }
23481 
23482    if (AsnReadVal(aip, atp, &av) <= 0) {
23483       goto erret;
23484    }
23485    /* end struct */
23486 
23487 ret:
23488    AsnUnlinkType(orig);       /* unlink local tree */
23489    return ptr;
23490 
23491 erret:
23492    aip -> io_failure = TRUE;
23493    ptr = SimpleReplaceFree(ptr);
23494    goto ret;
23495 }
23496 
23497 
23498 
23499 /**************************************************
23500 *
23501 *    SimpleReplaceAsnWrite()
23502 *
23503 **************************************************/
23504 NLM_EXTERN Boolean LIBCALL
SimpleReplaceAsnWrite(SimpleReplacePtr ptr,AsnIoPtr aip,AsnTypePtr orig)23505 SimpleReplaceAsnWrite(SimpleReplacePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
23506 {
23507    DataVal av;
23508    AsnTypePtr atp;
23509    Boolean retval = FALSE;
23510 
23511    if (! loaded)
23512    {
23513       if (! objmacroAsnLoad()) {
23514          return FALSE;
23515       }
23516    }
23517 
23518    if (aip == NULL) {
23519       return FALSE;
23520    }
23521 
23522    atp = AsnLinkType(orig, SIMPLE_REPLACE);   /* link local tree */
23523    if (atp == NULL) {
23524       return FALSE;
23525    }
23526 
23527    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
23528 
23529     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
23530 
23531    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
23532       goto erret;
23533    }
23534 
23535    if (ptr -> replace != NULL) {
23536       av.ptrvalue = ptr -> replace;
23537       retval = AsnWrite(aip, SIMPLE_REPLACE_replace,  &av);
23538    }
23539    av.boolvalue = ptr -> whole_string;
23540    retval = AsnWrite(aip, SIMPLE_REPLACE_whole_string,  &av);
23541    av.boolvalue = ptr -> weasel_to_putative;
23542    retval = AsnWrite(aip, SIMPLE_REPLACE_weasel_to_putative,  &av);
23543    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
23544       goto erret;
23545    }
23546    retval = TRUE;
23547 
23548 erret:
23549    AsnUnlinkType(orig);       /* unlink local tree */
23550    return retval;
23551 }
23552 
23553 
23554 
23555 /**************************************************
23556 *
23557 *    ReplaceFuncFree()
23558 *
23559 **************************************************/
23560 NLM_EXTERN
23561 ReplaceFuncPtr LIBCALL
ReplaceFuncFree(ValNodePtr anp)23562 ReplaceFuncFree(ValNodePtr anp)
23563 {
23564    Pointer pnt;
23565 
23566    if (anp == NULL) {
23567       return NULL;
23568    }
23569 
23570    pnt = anp->data.ptrvalue;
23571    switch (anp->choice)
23572    {
23573    default:
23574       break;
23575    case ReplaceFunc_simple_replace:
23576       SimpleReplaceFree(anp -> data.ptrvalue);
23577       break;
23578    case ReplaceFunc_haem_replace:
23579       MemFree(anp -> data.ptrvalue);
23580       break;
23581    }
23582    return MemFree(anp);
23583 }
23584 
23585 
23586 /**************************************************
23587 *
23588 *    ReplaceFuncAsnRead()
23589 *
23590 **************************************************/
23591 NLM_EXTERN
23592 ReplaceFuncPtr LIBCALL
ReplaceFuncAsnRead(AsnIoPtr aip,AsnTypePtr orig)23593 ReplaceFuncAsnRead(AsnIoPtr aip, AsnTypePtr orig)
23594 {
23595    DataVal av;
23596    AsnTypePtr atp;
23597    ValNodePtr anp;
23598    Uint1 choice;
23599    Boolean isError = FALSE;
23600    Boolean nullIsError = FALSE;
23601    AsnReadFunc func;
23602 
23603    if (! loaded)
23604    {
23605       if (! objmacroAsnLoad()) {
23606          return NULL;
23607       }
23608    }
23609 
23610    if (aip == NULL) {
23611       return NULL;
23612    }
23613 
23614    if (orig == NULL) {         /* ReplaceFunc ::= (self contained) */
23615       atp = AsnReadId(aip, amp, REPLACE_FUNC);
23616    } else {
23617       atp = AsnLinkType(orig, REPLACE_FUNC);    /* link in local tree */
23618    }
23619    if (atp == NULL) {
23620       return NULL;
23621    }
23622 
23623    anp = ValNodeNew(NULL);
23624    if (anp == NULL) {
23625       goto erret;
23626    }
23627    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
23628       goto erret;
23629    }
23630 
23631    func = NULL;
23632 
23633    atp = AsnReadId(aip, amp, atp);  /* find the choice */
23634    if (atp == NULL) {
23635       goto erret;
23636    }
23637    if (atp == REPLACE_FUNC_simple_replace) {
23638       choice = ReplaceFunc_simple_replace;
23639       func = (AsnReadFunc) SimpleReplaceAsnRead;
23640    }
23641    else if (atp == REPLACE_FUNC_haem_replace) {
23642       choice = ReplaceFunc_haem_replace;
23643       if (AsnReadVal(aip, atp, &av) <= 0) {
23644          goto erret;
23645       }
23646       anp->data.ptrvalue = av.ptrvalue;
23647    }
23648    anp->choice = choice;
23649    if (func != NULL)
23650    {
23651       anp->data.ptrvalue = (* func)(aip, atp);
23652       if (aip -> io_failure) goto erret;
23653 
23654       if (nullIsError && anp->data.ptrvalue == NULL) {
23655          goto erret;
23656       }
23657    }
23658 
23659 ret:
23660    AsnUnlinkType(orig);       /* unlink local tree */
23661    return anp;
23662 
23663 erret:
23664    anp = MemFree(anp);
23665    aip -> io_failure = TRUE;
23666    goto ret;
23667 }
23668 
23669 
23670 /**************************************************
23671 *
23672 *    ReplaceFuncAsnWrite()
23673 *
23674 **************************************************/
23675 NLM_EXTERN Boolean LIBCALL
ReplaceFuncAsnWrite(ReplaceFuncPtr anp,AsnIoPtr aip,AsnTypePtr orig)23676 ReplaceFuncAsnWrite(ReplaceFuncPtr anp, AsnIoPtr aip, AsnTypePtr orig)
23677 
23678 {
23679    DataVal av;
23680    AsnTypePtr atp, writetype = NULL;
23681    Pointer pnt;
23682    AsnWriteFunc func = NULL;
23683    Boolean retval = FALSE;
23684 
23685    if (! loaded)
23686    {
23687       if (! objmacroAsnLoad())
23688       return FALSE;
23689    }
23690 
23691    if (aip == NULL)
23692    return FALSE;
23693 
23694    atp = AsnLinkType(orig, REPLACE_FUNC);   /* link local tree */
23695    if (atp == NULL) {
23696       return FALSE;
23697    }
23698 
23699    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
23700 
23701     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
23702 
23703    av.ptrvalue = (Pointer)anp;
23704    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
23705       goto erret;
23706    }
23707 
23708    pnt = anp->data.ptrvalue;
23709    switch (anp->choice)
23710    {
23711    case ReplaceFunc_simple_replace:
23712       writetype = REPLACE_FUNC_simple_replace;
23713       func = (AsnWriteFunc) SimpleReplaceAsnWrite;
23714       break;
23715    case ReplaceFunc_haem_replace:
23716       av.ptrvalue = anp->data.ptrvalue;
23717       retval = AsnWrite(aip, REPLACE_FUNC_haem_replace, &av);
23718       break;
23719    }
23720    if (writetype != NULL) {
23721       retval = (* func)(pnt, aip, writetype);   /* write it out */
23722    }
23723    if (!retval) {
23724       goto erret;
23725    }
23726    retval = TRUE;
23727 
23728 erret:
23729    AsnUnlinkType(orig);       /* unlink local tree */
23730    return retval;
23731 }
23732 
23733 
23734 /**************************************************
23735 *
23736 *    ReplaceRuleNew()
23737 *
23738 **************************************************/
23739 NLM_EXTERN
23740 ReplaceRulePtr LIBCALL
ReplaceRuleNew(void)23741 ReplaceRuleNew(void)
23742 {
23743    ReplaceRulePtr ptr = MemNew((size_t) sizeof(ReplaceRule));
23744 
23745    ptr -> move_to_note = 0;
23746    return ptr;
23747 
23748 }
23749 
23750 
23751 /**************************************************
23752 *
23753 *    ReplaceRuleFree()
23754 *
23755 **************************************************/
23756 NLM_EXTERN
23757 ReplaceRulePtr LIBCALL
ReplaceRuleFree(ReplaceRulePtr ptr)23758 ReplaceRuleFree(ReplaceRulePtr ptr)
23759 {
23760 
23761    if(ptr == NULL) {
23762       return NULL;
23763    }
23764    ReplaceFuncFree(ptr -> replace_func);
23765    return MemFree(ptr);
23766 }
23767 
23768 
23769 /**************************************************
23770 *
23771 *    ReplaceRuleAsnRead()
23772 *
23773 **************************************************/
23774 NLM_EXTERN
23775 ReplaceRulePtr LIBCALL
ReplaceRuleAsnRead(AsnIoPtr aip,AsnTypePtr orig)23776 ReplaceRuleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
23777 {
23778    DataVal av;
23779    AsnTypePtr atp;
23780    Boolean isError = FALSE;
23781    AsnReadFunc func;
23782    ReplaceRulePtr ptr;
23783 
23784    if (! loaded)
23785    {
23786       if (! objmacroAsnLoad()) {
23787          return NULL;
23788       }
23789    }
23790 
23791    if (aip == NULL) {
23792       return NULL;
23793    }
23794 
23795    if (orig == NULL) {         /* ReplaceRule ::= (self contained) */
23796       atp = AsnReadId(aip, amp, REPLACE_RULE);
23797    } else {
23798       atp = AsnLinkType(orig, REPLACE_RULE);
23799    }
23800    /* link in local tree */
23801    if (atp == NULL) {
23802       return NULL;
23803    }
23804 
23805    ptr = ReplaceRuleNew();
23806    if (ptr == NULL) {
23807       goto erret;
23808    }
23809    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
23810       goto erret;
23811    }
23812 
23813    atp = AsnReadId(aip,amp, atp);
23814    func = NULL;
23815 
23816    if (atp == REPLACE_RULE_replace_func) {
23817       ptr -> replace_func = ReplaceFuncAsnRead(aip, atp);
23818       if (aip -> io_failure) {
23819          goto erret;
23820       }
23821       atp = AsnReadId(aip,amp, atp);
23822    }
23823    if (atp == REPLACE_RULE_move_to_note) {
23824       if ( AsnReadVal(aip, atp, &av) <= 0) {
23825          goto erret;
23826       }
23827       ptr -> move_to_note = av.boolvalue;
23828       atp = AsnReadId(aip,amp, atp);
23829    }
23830 
23831    if (AsnReadVal(aip, atp, &av) <= 0) {
23832       goto erret;
23833    }
23834    /* end struct */
23835 
23836 ret:
23837    AsnUnlinkType(orig);       /* unlink local tree */
23838    return ptr;
23839 
23840 erret:
23841    aip -> io_failure = TRUE;
23842    ptr = ReplaceRuleFree(ptr);
23843    goto ret;
23844 }
23845 
23846 
23847 
23848 /**************************************************
23849 *
23850 *    ReplaceRuleAsnWrite()
23851 *
23852 **************************************************/
23853 NLM_EXTERN Boolean LIBCALL
ReplaceRuleAsnWrite(ReplaceRulePtr ptr,AsnIoPtr aip,AsnTypePtr orig)23854 ReplaceRuleAsnWrite(ReplaceRulePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
23855 {
23856    DataVal av;
23857    AsnTypePtr atp;
23858    Boolean retval = FALSE;
23859 
23860    if (! loaded)
23861    {
23862       if (! objmacroAsnLoad()) {
23863          return FALSE;
23864       }
23865    }
23866 
23867    if (aip == NULL) {
23868       return FALSE;
23869    }
23870 
23871    atp = AsnLinkType(orig, REPLACE_RULE);   /* link local tree */
23872    if (atp == NULL) {
23873       return FALSE;
23874    }
23875 
23876    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
23877 
23878     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
23879 
23880    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
23881       goto erret;
23882    }
23883 
23884    if (ptr -> replace_func != NULL) {
23885       if ( ! ReplaceFuncAsnWrite(ptr -> replace_func, aip, REPLACE_RULE_replace_func)) {
23886          goto erret;
23887       }
23888    }
23889    av.boolvalue = ptr -> move_to_note;
23890    retval = AsnWrite(aip, REPLACE_RULE_move_to_note,  &av);
23891    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
23892       goto erret;
23893    }
23894    retval = TRUE;
23895 
23896 erret:
23897    AsnUnlinkType(orig);       /* unlink local tree */
23898    return retval;
23899 }
23900 
23901 
23902 
23903 /**************************************************
23904 *
23905 *    SuspectRuleNew()
23906 *
23907 **************************************************/
23908 NLM_EXTERN
23909 SuspectRulePtr LIBCALL
SuspectRuleNew(void)23910 SuspectRuleNew(void)
23911 {
23912    SuspectRulePtr ptr = MemNew((size_t) sizeof(SuspectRule));
23913 
23914    ptr -> rule_type = 0;
23915    ptr -> fatal = 0;
23916    return ptr;
23917 
23918 }
23919 
23920 
23921 /**************************************************
23922 *
23923 *    SuspectRuleFree()
23924 *
23925 **************************************************/
23926 NLM_EXTERN
23927 SuspectRulePtr LIBCALL
SuspectRuleFree(SuspectRulePtr ptr)23928 SuspectRuleFree(SuspectRulePtr ptr)
23929 {
23930 
23931    if(ptr == NULL) {
23932       return NULL;
23933    }
23934    SearchFuncFree(ptr -> find);
23935    SearchFuncFree(ptr -> except);
23936    ConstraintChoiceSetFree(ptr -> feat_constraint);
23937    ReplaceRuleFree(ptr -> replace);
23938    MemFree(ptr -> description);
23939    return MemFree(ptr);
23940 }
23941 
23942 
23943 /**************************************************
23944 *
23945 *    SuspectRuleAsnRead()
23946 *
23947 **************************************************/
23948 NLM_EXTERN
23949 SuspectRulePtr LIBCALL
SuspectRuleAsnRead(AsnIoPtr aip,AsnTypePtr orig)23950 SuspectRuleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
23951 {
23952    DataVal av;
23953    AsnTypePtr atp;
23954    Boolean isError = FALSE;
23955    AsnReadFunc func;
23956    SuspectRulePtr ptr;
23957 
23958    if (! loaded)
23959    {
23960       if (! objmacroAsnLoad()) {
23961          return NULL;
23962       }
23963    }
23964 
23965    if (aip == NULL) {
23966       return NULL;
23967    }
23968 
23969    if (orig == NULL) {         /* SuspectRule ::= (self contained) */
23970       atp = AsnReadId(aip, amp, SUSPECT_RULE);
23971    } else {
23972       atp = AsnLinkType(orig, SUSPECT_RULE);
23973    }
23974    /* link in local tree */
23975    if (atp == NULL) {
23976       return NULL;
23977    }
23978 
23979    ptr = SuspectRuleNew();
23980    if (ptr == NULL) {
23981       goto erret;
23982    }
23983    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
23984       goto erret;
23985    }
23986 
23987    atp = AsnReadId(aip,amp, atp);
23988    func = NULL;
23989 
23990    if (atp == SUSPECT_RULE_find) {
23991       ptr -> find = SearchFuncAsnRead(aip, atp);
23992       if (aip -> io_failure) {
23993          goto erret;
23994       }
23995       atp = AsnReadId(aip,amp, atp);
23996    }
23997    if (atp == SUSPECT_RULE_except) {
23998       ptr -> except = SearchFuncAsnRead(aip, atp);
23999       if (aip -> io_failure) {
24000          goto erret;
24001       }
24002       atp = AsnReadId(aip,amp, atp);
24003    }
24004    if (atp == SUSPECT_RULE_feat_constraint) {
24005       ptr -> feat_constraint = ConstraintChoiceSetAsnRead(aip, atp);
24006       if (aip -> io_failure) {
24007          goto erret;
24008       }
24009       atp = AsnReadId(aip,amp, atp);
24010    }
24011    if (atp == SUSPECT_RULE_rule_type) {
24012       if ( AsnReadVal(aip, atp, &av) <= 0) {
24013          goto erret;
24014       }
24015       ptr -> rule_type = av.intvalue;
24016       atp = AsnReadId(aip,amp, atp);
24017    }
24018    if (atp == SUSPECT_RULE_replace) {
24019       ptr -> replace = ReplaceRuleAsnRead(aip, atp);
24020       if (aip -> io_failure) {
24021          goto erret;
24022       }
24023       atp = AsnReadId(aip,amp, atp);
24024    }
24025    if (atp == SUSPECT_RULE_description) {
24026       if ( AsnReadVal(aip, atp, &av) <= 0) {
24027          goto erret;
24028       }
24029       ptr -> description = av.ptrvalue;
24030       atp = AsnReadId(aip,amp, atp);
24031    }
24032    if (atp == SUSPECT_RULE_fatal) {
24033       if ( AsnReadVal(aip, atp, &av) <= 0) {
24034          goto erret;
24035       }
24036       ptr -> fatal = av.boolvalue;
24037       atp = AsnReadId(aip,amp, atp);
24038    }
24039 
24040    if (AsnReadVal(aip, atp, &av) <= 0) {
24041       goto erret;
24042    }
24043    /* end struct */
24044 
24045 ret:
24046    AsnUnlinkType(orig);       /* unlink local tree */
24047    return ptr;
24048 
24049 erret:
24050    aip -> io_failure = TRUE;
24051    ptr = SuspectRuleFree(ptr);
24052    goto ret;
24053 }
24054 
24055 
24056 
24057 /**************************************************
24058 *
24059 *    SuspectRuleAsnWrite()
24060 *
24061 **************************************************/
24062 NLM_EXTERN Boolean LIBCALL
SuspectRuleAsnWrite(SuspectRulePtr ptr,AsnIoPtr aip,AsnTypePtr orig)24063 SuspectRuleAsnWrite(SuspectRulePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
24064 {
24065    DataVal av;
24066    AsnTypePtr atp;
24067    Boolean retval = FALSE;
24068 
24069    if (! loaded)
24070    {
24071       if (! objmacroAsnLoad()) {
24072          return FALSE;
24073       }
24074    }
24075 
24076    if (aip == NULL) {
24077       return FALSE;
24078    }
24079 
24080    atp = AsnLinkType(orig, SUSPECT_RULE);   /* link local tree */
24081    if (atp == NULL) {
24082       return FALSE;
24083    }
24084 
24085    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
24086 
24087     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
24088 
24089    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
24090       goto erret;
24091    }
24092 
24093    if (ptr -> find != NULL) {
24094       if ( ! SearchFuncAsnWrite(ptr -> find, aip, SUSPECT_RULE_find)) {
24095          goto erret;
24096       }
24097    }
24098    if (ptr -> except != NULL) {
24099       if ( ! SearchFuncAsnWrite(ptr -> except, aip, SUSPECT_RULE_except)) {
24100          goto erret;
24101       }
24102    }
24103    if (ptr -> feat_constraint != NULL) {
24104       if ( ! ConstraintChoiceSetAsnWrite(ptr -> feat_constraint, aip, SUSPECT_RULE_feat_constraint)) {
24105          goto erret;
24106       }
24107    }
24108    av.intvalue = ptr -> rule_type;
24109    retval = AsnWrite(aip, SUSPECT_RULE_rule_type,  &av);
24110    if (ptr -> replace != NULL) {
24111       if ( ! ReplaceRuleAsnWrite(ptr -> replace, aip, SUSPECT_RULE_replace)) {
24112          goto erret;
24113       }
24114    }
24115    if (ptr -> description != NULL) {
24116       av.ptrvalue = ptr -> description;
24117       retval = AsnWrite(aip, SUSPECT_RULE_description,  &av);
24118    }
24119    av.boolvalue = ptr -> fatal;
24120    retval = AsnWrite(aip, SUSPECT_RULE_fatal,  &av);
24121    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
24122       goto erret;
24123    }
24124    retval = TRUE;
24125 
24126 erret:
24127    AsnUnlinkType(orig);       /* unlink local tree */
24128    return retval;
24129 }
24130 
24131