NCBI C Toolkit Cross Reference

C/object/objmime.c


  1 /*  objmime.c
  2 * ===========================================================================
  3 *
  4 *                            PUBLIC DOMAIN NOTICE
  5 *               National Center for Biotechnology Information
  6 *
  7 *  This software/database is a "United States Government Work" under the
  8 *  terms of the United States Copyright Act.  It was written as part of
  9 *  the author's official duties as a United States Government employee and
 10 *  thus cannot be copyrighted.  This software/database is freely available
 11 *  to the public for use. The National Library of Medicine and the U.S.
 12 *  Government have not placed any restriction on its use or reproduction.
 13 *
 14 *  Although all reasonable efforts have been taken to ensure the accuracy
 15 *  and reliability of the software and data, the NLM and the U.S.
 16 *  Government do not and cannot warrant the performance or results that
 17 *  may be obtained by using this software or data. The NLM and the U.S.
 18 *  Government disclaim all warranties, express or implied, including
 19 *  warranties of performance, merchantability or fitness for any particular
 20 *  purpose.
 21 *
 22 *  Please cite the author in any work or product based on this material.
 23 *
 24 * ===========================================================================
 25 *
 26 * File Name:  objmime.c
 27 *
 28 * Modifications:
 29 * --------------------------------------------------------------------------
 30 * Date     Name        Description of modification
 31 * -------  ----------  -----------------------------------------------------
 32 *
 33 * $Log: objmime.c,v $
 34 * Revision 6.15  2006/07/13 17:03:19  bollin
 35 * removed unused variables
 36 *
 37 * Revision 6.14  2002/08/23 20:35:34  thiessen
 38 * fix wrong user_annotations symbols
 39 *
 40 * Revision 6.13  2002/02/27 15:53:37  thiessen
 41 * fix typo
 42 *
 43 * Revision 6.12  2002/02/26 13:21:21  thiessen
 44 * add structure type to new general mime
 45 *
 46 * Revision 6.11  2001/11/21 16:38:23  thiessen
 47 * move cn3d stuff into bundle
 48 *
 49 * Revision 6.10  2001/11/21 14:25:41  thiessen
 50 * remove BisotrucOrId
 51 *
 52 * Revision 6.9  2001/11/20 15:59:34  thiessen
 53 * add imports to BundleSeqsAligns
 54 *
 55 * Revision 6.8  2001/11/16 14:54:26  thiessen
 56 * add new general type
 57 *
 58 * Revision 6.7  2001/06/21 14:44:29  thiessen
 59 * add new user annotations
 60 *
 61 * Revision 6.6  2001/06/14 14:21:32  thiessen
 62 * add style dictionary to mime blobs
 63 *
 64 * Revision 6.5  1999/09/16 17:12:02  ywang
 65 * use SeqAnnotSetAsnRead/Write to replace AsnGenericUserSeqOfAsnRead/Write to remove problem with seqannotset
 66 *
 67  * Revision 6.4  1998/12/07  16:29:28  ywang
 68  * add object loaded for mime type Biostruc-seqs
 69  *
 70 * ==========================================================================
 71 */
 72 
 73 #include <asn.h>
 74 
 75 #define NLM_GENERATED_CODE_PROTO
 76 
 77 /* hand change add include --- lyg */
 78 #include <mapmime.h>
 79 #include <objmime.h>
 80 
 81 static Boolean loaded = FALSE;
 82 
 83 /*hand change from ncbimime.h -- lyg & yanli */
 84 #include <asnmime.h>
 85 
 86 #ifndef NLM_EXTERN_LOADS
 87 #define NLM_EXTERN_LOADS {}
 88 #endif
 89 
 90 NLM_EXTERN Boolean LIBCALL
 91 objmimeAsnLoad(void)
 92 {
 93 
 94    if ( ! loaded) {
 95       NLM_EXTERN_LOADS
 96 
 97       if ( ! AsnLoad ())
 98       return FALSE;
 99       loaded = TRUE;
100    }
101 
102    return TRUE;
103 }
104 
105 
106 
107 /**************************************************
108 *    Generated object loaders for Module NCBI-Mime
109 *    Generated using ASNCODE Revision: 6.5 at Dec 4, 1998  2:11 PM
110 *
111 **************************************************/
112 
113 
114 /**************************************************
115 *
116 *    NcbiMimeAsn1Free()
117 *
118 **************************************************/
119 NLM_EXTERN 
120 NcbiMimeAsn1Ptr LIBCALL
121 NcbiMimeAsn1Free(ValNodePtr anp)
122 {
123    Pointer pnt;
124 
125    if (anp == NULL) {
126       return NULL;
127    }
128 
129    pnt = anp->data.ptrvalue;
130    switch (anp->choice)
131    {
132    default:
133       break;
134    case NcbiMimeAsn1_entrez:
135       EntrezGeneralFree(anp -> data.ptrvalue);
136       break;
137    case NcbiMimeAsn1_alignstruc:
138       BiostrucAlignFree(anp -> data.ptrvalue);
139       break;
140    case NcbiMimeAsn1_alignseq:
141       BiostrucAlignSeqFree(anp -> data.ptrvalue);
142       break;
143    case NcbiMimeAsn1_strucseq:
144       BiostrucSeqFree(anp -> data.ptrvalue);
145       break;
146    case NcbiMimeAsn1_strucseqs:
147       BiostrucSeqsFree(anp -> data.ptrvalue);
148       break;
149    case NcbiMimeAsn1_general:
150       BiostrucSeqsAlignsCddFree(anp -> data.ptrvalue);
151       break;
152    }
153    return MemFree(anp);
154 }
155 
156 
157 /**************************************************
158 *
159 *    NcbiMimeAsn1AsnRead()
160 *
161 **************************************************/
162 NLM_EXTERN 
163 NcbiMimeAsn1Ptr LIBCALL
164 NcbiMimeAsn1AsnRead(AsnIoPtr aip, AsnTypePtr orig)
165 {
166    DataVal av;
167    AsnTypePtr atp;
168    ValNodePtr anp;
169    Uint1 choice;
170    Boolean isError = FALSE;
171    Boolean nullIsError = FALSE;
172    AsnReadFunc func;
173 
174    if (! loaded)
175    {
176       if (! objmimeAsnLoad()) {
177          return NULL;
178       }
179    }
180 
181    if (aip == NULL) {
182       return NULL;
183    }
184 
185    if (orig == NULL) {         /* NcbiMimeAsn1 ::= (self contained) */
186       atp = AsnReadId(aip, amp, NCBI_MIME_ASN1);
187    } else {
188       atp = AsnLinkType(orig, NCBI_MIME_ASN1);    /* link in local tree */
189    }
190    if (atp == NULL) {
191       return NULL;
192    }
193 
194    anp = ValNodeNew(NULL);
195    if (anp == NULL) {
196       goto erret;
197    }
198    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
199       goto erret;
200    }
201 
202    func = NULL;
203 
204    atp = AsnReadId(aip, amp, atp);  /* find the choice */
205    if (atp == NULL) {
206       goto erret;
207    }
208    if (atp == NCBI_MIME_ASN1_entrez) {
209       choice = NcbiMimeAsn1_entrez;
210       func = (AsnReadFunc) EntrezGeneralAsnRead;
211    }
212    else if (atp == NCBI_MIME_ASN1_alignstruc) {
213       choice = NcbiMimeAsn1_alignstruc;
214       func = (AsnReadFunc) BiostrucAlignAsnRead;
215    }
216    else if (atp == NCBI_MIME_ASN1_alignseq) {
217       choice = NcbiMimeAsn1_alignseq;
218       func = (AsnReadFunc) BiostrucAlignSeqAsnRead;
219    }
220    else if (atp == NCBI_MIME_ASN1_strucseq) {
221       choice = NcbiMimeAsn1_strucseq;
222       func = (AsnReadFunc) BiostrucSeqAsnRead;
223    }
224    else if (atp == NCBI_MIME_ASN1_strucseqs) {
225       choice = NcbiMimeAsn1_strucseqs;
226       func = (AsnReadFunc) BiostrucSeqsAsnRead;
227    }
228    else if (atp == NCBI_MIME_ASN1_general) {
229       choice = NcbiMimeAsn1_general;
230       func = (AsnReadFunc) BiostrucSeqsAlignsCddAsnRead;
231    }
232    anp->choice = choice;
233    if (func != NULL)
234    {
235       anp->data.ptrvalue = (* func)(aip, atp);
236       if (aip -> io_failure) goto erret;
237 
238       if (nullIsError && anp->data.ptrvalue == NULL) {
239          goto erret;
240       }
241    }
242 
243 ret:
244    AsnUnlinkType(orig);       /* unlink local tree */
245    return anp;
246 
247 erret:
248    anp = MemFree(anp);
249    aip -> io_failure = TRUE;
250    goto ret;
251 }
252 
253 
254 /**************************************************
255 *
256 *    NcbiMimeAsn1AsnWrite()
257 *
258 **************************************************/
259 NLM_EXTERN Boolean LIBCALL 
260 NcbiMimeAsn1AsnWrite(NcbiMimeAsn1Ptr anp, AsnIoPtr aip, AsnTypePtr orig)
261 
262 {
263    DataVal av;
264    AsnTypePtr atp, writetype = NULL;
265    Pointer pnt;
266    AsnWriteFunc func = NULL;
267    Boolean retval = FALSE;
268 
269    if (! loaded)
270    {
271       if (! objmimeAsnLoad())
272       return FALSE;
273    }
274 
275    if (aip == NULL)
276    return FALSE;
277 
278    atp = AsnLinkType(orig, NCBI_MIME_ASN1);   /* link local tree */
279    if (atp == NULL) {
280       return FALSE;
281    }
282 
283    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
284 
285    av.ptrvalue = (Pointer)anp;
286    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
287       goto erret;
288    }
289 
290    pnt = anp->data.ptrvalue;
291    switch (anp->choice)
292    {
293    case NcbiMimeAsn1_entrez:
294       writetype = NCBI_MIME_ASN1_entrez;
295       func = (AsnWriteFunc) EntrezGeneralAsnWrite;
296       break;
297    case NcbiMimeAsn1_alignstruc:
298       writetype = NCBI_MIME_ASN1_alignstruc;
299       func = (AsnWriteFunc) BiostrucAlignAsnWrite;
300       break;
301    case NcbiMimeAsn1_alignseq:
302       writetype = NCBI_MIME_ASN1_alignseq;
303       func = (AsnWriteFunc) BiostrucAlignSeqAsnWrite;
304       break;
305    case NcbiMimeAsn1_strucseq:
306       writetype = NCBI_MIME_ASN1_strucseq;
307       func = (AsnWriteFunc) BiostrucSeqAsnWrite;
308       break;
309    case NcbiMimeAsn1_strucseqs:
310       writetype = NCBI_MIME_ASN1_strucseqs;
311       func = (AsnWriteFunc) BiostrucSeqsAsnWrite;
312       break;
313    case NcbiMimeAsn1_general:
314       writetype = NCBI_MIME_ASN1_general;
315       func = (AsnWriteFunc) BiostrucSeqsAlignsCddAsnWrite;
316       break;
317    }
318    if (writetype != NULL) {
319       retval = (* func)(pnt, aip, writetype);   /* write it out */
320    }
321    if (!retval) {
322       goto erret;
323    }
324    retval = TRUE;
325 
326 erret:
327    AsnUnlinkType(orig);       /* unlink local tree */
328    return retval;
329 }
330 
331 
332 /**************************************************
333 *
334 *    EntrezGeneralNew()
335 *
336 **************************************************/
337 NLM_EXTERN 
338 EntrezGeneralPtr LIBCALL
339 EntrezGeneralNew(void)
340 {
341    EntrezGeneralPtr ptr = MemNew((size_t) sizeof(EntrezGeneral));
342 
343    return ptr;
344 
345 }
346 
347 
348 /**************************************************
349 *
350 *    EntrezGeneralFree()
351 *
352 **************************************************/
353 NLM_EXTERN 
354 EntrezGeneralPtr LIBCALL
355 EntrezGeneralFree(EntrezGeneralPtr ptr)
356 {
357 
358    if(ptr == NULL) {
359       return NULL;
360    }
361    MemFree(ptr -> title);
362    Data_dataFree(ptr -> Data_data);
363    MemFree(ptr -> location);
364    return MemFree(ptr);
365 }
366 
367 
368 /**************************************************
369 *
370 *    Data_dataFree()
371 *
372 **************************************************/
373 static 
374 Data_dataPtr LIBCALL
375 Data_dataFree(ValNodePtr anp)
376 {
377    Pointer pnt;
378 
379    if (anp == NULL) {
380       return NULL;
381    }
382 
383    pnt = anp->data.ptrvalue;
384    switch (anp->choice)
385    {
386    default:
387       break;
388    case Data_data_ml:
389       MedlineEntryFree(anp -> data.ptrvalue);
390       break;
391    case Data_data_prot:
392       SeqEntryFree(anp -> data.ptrvalue);
393       break;
394    case Data_data_nuc:
395       SeqEntryFree(anp -> data.ptrvalue);
396       break;
397    case Data_data_genome:
398       SeqEntryFree(anp -> data.ptrvalue);
399       break;
400    case Data_data_structure:
401       BiostrucFree(anp -> data.ptrvalue);
402       break;
403    case Data_data_strucAnnot:
404       BiostrucAnnotSetFree(anp -> data.ptrvalue);
405       break;
406    }
407    return MemFree(anp);
408 }
409 
410 
411 /**************************************************
412 *
413 *    EntrezGeneralAsnRead()
414 *
415 **************************************************/
416 NLM_EXTERN 
417 EntrezGeneralPtr LIBCALL
418 EntrezGeneralAsnRead(AsnIoPtr aip, AsnTypePtr orig)
419 {
420    DataVal av;
421    AsnTypePtr atp;
422    Boolean isError = FALSE;
423    AsnReadFunc func;
424    EntrezGeneralPtr ptr;
425 
426    if (! loaded)
427    {
428       if (! objmimeAsnLoad()) {
429          return NULL;
430       }
431    }
432 
433    if (aip == NULL) {
434       return NULL;
435    }
436 
437    if (orig == NULL) {         /* EntrezGeneral ::= (self contained) */
438       atp = AsnReadId(aip, amp, ENTREZ_GENERAL);
439    } else {
440       atp = AsnLinkType(orig, ENTREZ_GENERAL);
441    }
442    /* link in local tree */
443    if (atp == NULL) {
444       return NULL;
445    }
446 
447    ptr = EntrezGeneralNew();
448    if (ptr == NULL) {
449       goto erret;
450    }
451    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
452       goto erret;
453    }
454 
455    atp = AsnReadId(aip,amp, atp);
456    func = NULL;
457 
458    if (atp == ENTREZ_GENERAL_title) {
459       if ( AsnReadVal(aip, atp, &av) <= 0) {
460          goto erret;
461       }
462       ptr -> title = av.ptrvalue;
463       atp = AsnReadId(aip,amp, atp);
464    }
465    if (atp == ENTREZ_GENERAL_data) {
466       ptr -> Data_data = Data_dataAsnRead(aip, atp);
467       if (aip -> io_failure) {
468          goto erret;
469       }
470       atp = AsnReadId(aip,amp, atp);
471    }
472    if (atp == ENTREZ_GENERAL_style) {
473       if ( AsnReadVal(aip, atp, &av) <= 0) {
474          goto erret;
475       }
476       ptr -> style = av.intvalue;
477       atp = AsnReadId(aip,amp, atp);
478    }
479    if (atp == ENTREZ_GENERAL_location) {
480       if ( AsnReadVal(aip, atp, &av) <= 0) {
481          goto erret;
482       }
483       ptr -> location = av.ptrvalue;
484       atp = AsnReadId(aip,amp, atp);
485    }
486 
487    if (AsnReadVal(aip, atp, &av) <= 0) {
488       goto erret;
489    }
490    /* end struct */
491 
492 ret:
493    AsnUnlinkType(orig);       /* unlink local tree */
494    return ptr;
495 
496 erret:
497    aip -> io_failure = TRUE;
498    ptr = EntrezGeneralFree(ptr);
499    goto ret;
500 }
501 
502 
503 
504 /**************************************************
505 *
506 *    Data_dataAsnRead()
507 *
508 **************************************************/
509 static 
510 Data_dataPtr LIBCALL
511 Data_dataAsnRead(AsnIoPtr aip, AsnTypePtr orig)
512 {
513    DataVal av;
514    AsnTypePtr atp;
515    ValNodePtr anp;
516    Uint1 choice;
517    Boolean isError = FALSE;
518    Boolean nullIsError = FALSE;
519    AsnReadFunc func;
520 
521    if (! loaded)
522    {
523       if (! objmimeAsnLoad()) {
524          return NULL;
525       }
526    }
527 
528    if (aip == NULL) {
529       return NULL;
530    }
531 
532    if (orig == NULL) {         /* Data_data ::= (self contained) */
533       atp = AsnReadId(aip, amp, ENTREZ_GENERAL_data);
534    } else {
535       atp = AsnLinkType(orig, ENTREZ_GENERAL_data);    /* link in local tree */
536    }
537    if (atp == NULL) {
538       return NULL;
539    }
540 
541    anp = ValNodeNew(NULL);
542    if (anp == NULL) {
543       goto erret;
544    }
545    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
546       goto erret;
547    }
548 
549    func = NULL;
550 
551    atp = AsnReadId(aip, amp, atp);  /* find the choice */
552    if (atp == NULL) {
553       goto erret;
554    }
555    if (atp == ENTREZ_GENERAL_data_ml) {
556       choice = Data_data_ml;
557       func = (AsnReadFunc) MedlineEntryAsnRead;
558    }
559    else if (atp == ENTREZ_GENERAL_data_prot) {
560       choice = Data_data_prot;
561       func = (AsnReadFunc) SeqEntryAsnRead;
562    }
563    else if (atp == ENTREZ_GENERAL_data_nuc) {
564       choice = Data_data_nuc;
565       func = (AsnReadFunc) SeqEntryAsnRead;
566    }
567    else if (atp == ENTREZ_GENERAL_data_genome) {
568       choice = Data_data_genome;
569       func = (AsnReadFunc) SeqEntryAsnRead;
570    }
571    else if (atp == ENTREZ_GENERAL_data_structure) {
572       choice = Data_data_structure;
573       func = (AsnReadFunc) BiostrucAsnRead;
574    }
575    else if (atp == ENTREZ_GENERAL_data_strucAnnot) {
576       choice = Data_data_strucAnnot;
577       func = (AsnReadFunc) BiostrucAnnotSetAsnRead;
578    }
579    anp->choice = choice;
580    if (func != NULL)
581    {
582       anp->data.ptrvalue = (* func)(aip, atp);
583       if (aip -> io_failure) goto erret;
584 
585       if (nullIsError && anp->data.ptrvalue == NULL) {
586          goto erret;
587       }
588    }
589 
590 ret:
591    AsnUnlinkType(orig);       /* unlink local tree */
592    return anp;
593 
594 erret:
595    anp = MemFree(anp);
596    aip -> io_failure = TRUE;
597    goto ret;
598 }
599 
600 
601 /**************************************************
602 *
603 *    EntrezGeneralAsnWrite()
604 *
605 **************************************************/
606 NLM_EXTERN Boolean LIBCALL 
607 EntrezGeneralAsnWrite(EntrezGeneralPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
608 {
609    DataVal av;
610    AsnTypePtr atp;
611    Boolean retval = FALSE;
612 
613    if (! loaded)
614    {
615       if (! objmimeAsnLoad()) {
616          return FALSE;
617       }
618    }
619 
620    if (aip == NULL) {
621       return FALSE;
622    }
623 
624    atp = AsnLinkType(orig, ENTREZ_GENERAL);   /* link local tree */
625    if (atp == NULL) {
626       return FALSE;
627    }
628 
629    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
630    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
631       goto erret;
632    }
633 
634    if (ptr -> title != NULL) {
635       av.ptrvalue = ptr -> title;
636       retval = AsnWrite(aip, ENTREZ_GENERAL_title,  &av);
637    }
638    if (ptr -> Data_data != NULL) {
639       if ( ! Data_dataAsnWrite(ptr -> Data_data, aip, ENTREZ_GENERAL_data)) {
640          goto erret;
641       }
642    }
643    av.intvalue = ptr -> style;
644    retval = AsnWrite(aip, ENTREZ_GENERAL_style,  &av);
645    if (ptr -> location != NULL) {
646       av.ptrvalue = ptr -> location;
647       retval = AsnWrite(aip, ENTREZ_GENERAL_location,  &av);
648    }
649    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
650       goto erret;
651    }
652    retval = TRUE;
653 
654 erret:
655    AsnUnlinkType(orig);       /* unlink local tree */
656    return retval;
657 }
658 
659 
660 
661 /**************************************************
662 *
663 *    Data_dataAsnWrite()
664 *
665 **************************************************/
666 static Boolean LIBCALL 
667 Data_dataAsnWrite(Data_dataPtr anp, AsnIoPtr aip, AsnTypePtr orig)
668 
669 {
670    DataVal av;
671    AsnTypePtr atp, writetype = NULL;
672    Pointer pnt;
673    AsnWriteFunc func = NULL;
674    Boolean retval = FALSE;
675 
676    if (! loaded)
677    {
678       if (! objmimeAsnLoad())
679       return FALSE;
680    }
681 
682    if (aip == NULL)
683    return FALSE;
684 
685    atp = AsnLinkType(orig, ENTREZ_GENERAL_data);   /* link local tree */
686    if (atp == NULL) {
687       return FALSE;
688    }
689 
690    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
691 
692    av.ptrvalue = (Pointer)anp;
693    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
694       goto erret;
695    }
696 
697    pnt = anp->data.ptrvalue;
698    switch (anp->choice)
699    {
700    case Data_data_ml:
701       writetype = ENTREZ_GENERAL_data_ml;
702       func = (AsnWriteFunc) MedlineEntryAsnWrite;
703       break;
704    case Data_data_prot:
705       writetype = ENTREZ_GENERAL_data_prot;
706       func = (AsnWriteFunc) SeqEntryAsnWrite;
707       break;
708    case Data_data_nuc:
709       writetype = ENTREZ_GENERAL_data_nuc;
710       func = (AsnWriteFunc) SeqEntryAsnWrite;
711       break;
712    case Data_data_genome:
713       writetype = ENTREZ_GENERAL_data_genome;
714       func = (AsnWriteFunc) SeqEntryAsnWrite;
715       break;
716    case Data_data_structure:
717       writetype = ENTREZ_GENERAL_data_structure;
718       func = (AsnWriteFunc) BiostrucAsnWrite;
719       break;
720    case Data_data_strucAnnot:
721       writetype = ENTREZ_GENERAL_data_strucAnnot;
722       func = (AsnWriteFunc) BiostrucAnnotSetAsnWrite;
723       break;
724    }
725    if (writetype != NULL) {
726       retval = (* func)(pnt, aip, writetype);   /* write it out */
727    }
728    if (!retval) {
729       goto erret;
730    }
731    retval = TRUE;
732 
733 erret:
734    AsnUnlinkType(orig);       /* unlink local tree */
735    return retval;
736 }
737 
738 
739 /**************************************************
740 *
741 *    BiostrucAlignNew()
742 *
743 **************************************************/
744 NLM_EXTERN 
745 BiostrucAlignPtr LIBCALL
746 BiostrucAlignNew(void)
747 {
748    BiostrucAlignPtr ptr = MemNew((size_t) sizeof(BiostrucAlign));
749 
750    return ptr;
751 
752 }
753 
754 
755 /**************************************************
756 *
757 *    BiostrucAlignFree()
758 *
759 **************************************************/
760 NLM_EXTERN 
761 BiostrucAlignPtr LIBCALL
762 BiostrucAlignFree(BiostrucAlignPtr ptr)
763 {
764 
765    if(ptr == NULL) {
766       return NULL;
767    }
768    BiostrucFree(ptr -> master);
769    AsnGenericUserSeqOfFree(ptr -> slaves, (AsnOptFreeFunc) BiostrucFree);
770    BiostrucAnnotSetFree(ptr -> alignments);
771    AsnGenericChoiceSeqOfFree(ptr -> sequences, (AsnOptFreeFunc) SeqEntryFree);
772    AsnGenericUserSeqOfFree(ptr -> seqalign, (AsnOptFreeFunc) SeqAnnotFree);
773    Cn3dStyleDictionaryFree(ptr -> style_dictionary); /* paul */
774    Cn3dUserAnnotationsFree(ptr -> user_annotations);
775    return MemFree(ptr);
776 }
777 
778 
779 /**************************************************
780 *
781 *    BiostrucAlignAsnRead()
782 *
783 **************************************************/
784 NLM_EXTERN 
785 BiostrucAlignPtr LIBCALL
786 BiostrucAlignAsnRead(AsnIoPtr aip, AsnTypePtr orig)
787 {
788    DataVal av;
789    AsnTypePtr atp;
790    Boolean isError = FALSE;
791    AsnReadFunc func;
792    BiostrucAlignPtr ptr;
793 
794    if (! loaded)
795    {
796       if (! objmimeAsnLoad()) {
797          return NULL;
798       }
799    }
800 
801    if (aip == NULL) {
802       return NULL;
803    }
804 
805    if (orig == NULL) {         /* BiostrucAlign ::= (self contained) */
806       atp = AsnReadId(aip, amp, BIOSTRUC_ALIGN);
807    } else {
808       atp = AsnLinkType(orig, BIOSTRUC_ALIGN);
809    }
810    /* link in local tree */
811    if (atp == NULL) {
812       return NULL;
813    }
814 
815    ptr = BiostrucAlignNew();
816    if (ptr == NULL) {
817       goto erret;
818    }
819    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
820       goto erret;
821    }
822 
823    atp = AsnReadId(aip,amp, atp);
824    func = NULL;
825 
826    if (atp == BIOSTRUC_ALIGN_master) {
827       ptr -> master = BiostrucAsnRead(aip, atp);
828       if (aip -> io_failure) {
829          goto erret;
830       }
831       atp = AsnReadId(aip,amp, atp);
832    }
833    if (atp == BIOSTRUC_ALIGN_slaves) {
834       ptr -> slaves = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucAsnRead, (AsnOptFreeFunc) BiostrucFree);
835       if (isError && ptr -> slaves == NULL) {
836          goto erret;
837       }
838       atp = AsnReadId(aip,amp, atp);
839    }
840    if (atp == BIOSTRUC_ALIGN_alignments) {
841       ptr -> alignments = BiostrucAnnotSetAsnRead(aip, atp);
842       if (aip -> io_failure) {
843          goto erret;
844       }
845       atp = AsnReadId(aip,amp, atp);
846    }
847    if (atp == BIOSTRUC_ALIGN_sequences) {
848       ptr -> sequences = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
849       if (isError && ptr -> sequences == NULL) {
850          goto erret;
851       }
852       atp = AsnReadId(aip,amp, atp);
853    }
854    if (atp == BIOSTRUC_ALIGN_seqalign) {
855 /*    ptr -> seqalign = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqAnnotAsnRead, (AsnOptFreeFunc) SeqAnnotFree);     
856       if (isError && ptr -> seqalign == NULL) {
857          goto erret;     
858       }  */   /* yanli comment this out, add the following, Sept. 16, 1999 */
859       ptr -> seqalign = SeqAnnotSetAsnRead(aip, BIOSTRUC_ALIGN_seqalign, BIOSTRUC_ALIGN_seqalign_E);     
860       atp = AsnReadId(aip,amp, atp);
861    }
862    /* paul */
863    if (atp == BIOSTRUC_ALIGN_style_dictionary) {
864       ptr -> style_dictionary = Cn3dStyleDictionaryAsnRead(aip, atp);
865       if (aip -> io_failure) {
866          goto erret;
867       }
868       atp = AsnReadId(aip,amp, atp);
869    }
870    if (atp == BIOSTRUC_ALIGN_user_annotations) {
871       ptr -> user_annotations = Cn3dUserAnnotationsAsnRead(aip, atp);
872       if (aip -> io_failure) {
873          goto erret;
874       }
875       atp = AsnReadId(aip,amp, atp);
876    }
877 
878    if (AsnReadVal(aip, atp, &av) <= 0) {
879       goto erret;
880    }
881    /* end struct */
882 
883 ret:
884    AsnUnlinkType(orig);       /* unlink local tree */
885    return ptr;
886 
887 erret:
888    aip -> io_failure = TRUE;
889    ptr = BiostrucAlignFree(ptr);
890    goto ret;
891 }
892 
893 
894 
895 /**************************************************
896 *
897 *    BiostrucAlignAsnWrite()
898 *
899 **************************************************/
900 NLM_EXTERN Boolean LIBCALL 
901 BiostrucAlignAsnWrite(BiostrucAlignPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
902 {
903    AsnTypePtr atp;
904    Boolean retval = FALSE;
905 
906    if (! loaded)
907    {
908       if (! objmimeAsnLoad()) {
909          return FALSE;
910       }
911    }
912 
913    if (aip == NULL) {
914       return FALSE;
915    }
916 
917    atp = AsnLinkType(orig, BIOSTRUC_ALIGN);   /* link local tree */
918    if (atp == NULL) {
919       return FALSE;
920    }
921 
922    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
923    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
924       goto erret;
925    }
926 
927    if (ptr -> master != NULL) {
928       if ( ! BiostrucAsnWrite(ptr -> master, aip, BIOSTRUC_ALIGN_master)) {
929          goto erret;
930       }
931    }
932    AsnGenericUserSeqOfAsnWrite(ptr -> slaves, (AsnWriteFunc) BiostrucAsnWrite, aip, BIOSTRUC_ALIGN_slaves, BIOSTRUC_ALIGN_slaves_E);
933    if (ptr -> alignments != NULL) {
934       if ( ! BiostrucAnnotSetAsnWrite(ptr -> alignments, aip, BIOSTRUC_ALIGN_alignments)) {
935          goto erret;
936       }
937    }
938    AsnGenericChoiceSeqOfAsnWrite(ptr -> sequences, (AsnWriteFunc) SeqEntryAsnWrite, aip, BIOSTRUC_ALIGN_sequences, BIOSTRUC_ALIGN_sequences_E);
939 
940 /* AsnGenericUserSeqOfAsnWrite(ptr -> seqalign, (AsnWriteFunc) SeqAnnotAsnWrite, aip, BIOSTRUC_ALIGN_seqalign, BIOSTRUC_ALIGN_seqalign_E); */
941        /* yanli comment it out, and add the following, Sept. 16, 1999 */
942    SeqAnnotSetAsnWrite(ptr -> seqalign, aip, BIOSTRUC_ALIGN_seqalign, BIOSTRUC_ALIGN_seqalign_E);
943    /* paul */
944    if (ptr -> style_dictionary != NULL) {
945       if ( ! Cn3dStyleDictionaryAsnWrite(ptr -> style_dictionary, aip, BIOSTRUC_ALIGN_style_dictionary)) {
946          goto erret;
947       }
948    }
949    if (ptr -> user_annotations != NULL) {
950       if ( ! Cn3dUserAnnotationsAsnWrite(ptr -> user_annotations, aip, BIOSTRUC_ALIGN_user_annotations)) {
951          goto erret;
952       }
953    }
954 
955    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
956       goto erret;
957    }
958    retval = TRUE;
959 
960 erret:
961    AsnUnlinkType(orig);       /* unlink local tree */
962    return retval;
963 }
964 
965 
966 
967 /**************************************************
968 *
969 *    BiostrucAlignSeqNew()
970 *
971 **************************************************/
972 NLM_EXTERN 
973 BiostrucAlignSeqPtr LIBCALL
974 BiostrucAlignSeqNew(void)
975 {
976    BiostrucAlignSeqPtr ptr = MemNew((size_t) sizeof(BiostrucAlignSeq));
977 
978    return ptr;
979 
980 }
981 
982 
983 /**************************************************
984 *
985 *    BiostrucAlignSeqFree()
986 *
987 **************************************************/
988 NLM_EXTERN 
989 BiostrucAlignSeqPtr LIBCALL
990 BiostrucAlignSeqFree(BiostrucAlignSeqPtr ptr)
991 {
992 
993    if(ptr == NULL) {
994       return NULL;
995    }
996    AsnGenericChoiceSeqOfFree(ptr -> sequences, (AsnOptFreeFunc) SeqEntryFree);
997    AsnGenericUserSeqOfFree(ptr -> seqalign, (AsnOptFreeFunc) SeqAnnotFree);
998    Cn3dStyleDictionaryFree(ptr -> style_dictionary); /* paul */
999    Cn3dUserAnnotationsFree(ptr -> user_annotations);
1000    return MemFree(ptr);
1001 }
1002 
1003 
1004 /**************************************************
1005 *
1006 *    BiostrucAlignSeqAsnRead()
1007 *
1008 **************************************************/
1009 NLM_EXTERN 
1010 BiostrucAlignSeqPtr LIBCALL
1011 BiostrucAlignSeqAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1012 {
1013    DataVal av;
1014    AsnTypePtr atp;
1015    Boolean isError = FALSE;
1016    AsnReadFunc func;
1017    BiostrucAlignSeqPtr ptr;
1018 
1019    if (! loaded)
1020    {
1021       if (! objmimeAsnLoad()) {
1022          return NULL;
1023       }
1024    }
1025 
1026    if (aip == NULL) {
1027       return NULL;
1028    }
1029 
1030    if (orig == NULL) {         /* BiostrucAlignSeq ::= (self contained) */
1031       atp = AsnReadId(aip, amp, BIOSTRUC_ALIGN_SEQ);
1032    } else {
1033       atp = AsnLinkType(orig, BIOSTRUC_ALIGN_SEQ);
1034    }
1035    /* link in local tree */
1036    if (atp == NULL) {
1037       return NULL;
1038    }
1039 
1040    ptr = BiostrucAlignSeqNew();
1041    if (ptr == NULL) {
1042       goto erret;
1043    }
1044    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1045       goto erret;
1046    }
1047 
1048    atp = AsnReadId(aip,amp, atp);
1049    func = NULL;
1050 
1051    if (atp == BIOSTRUC_ALIGN_SEQ_sequences) {
1052       ptr -> sequences = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
1053       if (isError && ptr -> sequences == NULL) {
1054          goto erret;
1055       }
1056       atp = AsnReadId(aip,amp, atp);
1057    }
1058    if (atp == BIOSTRUC_ALIGN_SEQ_seqalign) {
1059 /*    ptr -> seqalign = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqAnnotAsnRead, (AsnOptFreeFunc) SeqAnnotFree);
1060       if (isError && ptr -> seqalign == NULL) {
1061          goto erret;
1062       }  */ /* yanli comment this out, and add the following, Sept. 16, 1999 */
1063       ptr -> seqalign = SeqAnnotSetAsnRead(aip, BIOSTRUC_ALIGN_SEQ_seqalign, BIOSTRUC_ALIGN_SEQ_seqalign_E);
1064       atp = AsnReadId(aip,amp, atp);
1065    }
1066    /* paul */
1067    if (atp == ALIGN_SEQ_style_dictionary) {
1068       ptr -> style_dictionary = Cn3dStyleDictionaryAsnRead(aip, atp);
1069       if (aip -> io_failure) {
1070          goto erret;
1071       }
1072       atp = AsnReadId(aip,amp, atp);
1073    }
1074    if (atp == ALIGN_SEQ_user_annotations) {
1075       ptr -> user_annotations = Cn3dUserAnnotationsAsnRead(aip, atp);
1076       if (aip -> io_failure) {
1077          goto erret;
1078       }
1079       atp = AsnReadId(aip,amp, atp);
1080    }
1081 
1082    if (AsnReadVal(aip, atp, &av) <= 0) {
1083       goto erret;
1084    }
1085    /* end struct */
1086 
1087 ret:
1088    AsnUnlinkType(orig);       /* unlink local tree */
1089    return ptr;
1090 
1091 erret:
1092    aip -> io_failure = TRUE;
1093    ptr = BiostrucAlignSeqFree(ptr);
1094    goto ret;
1095 }
1096 
1097 
1098 
1099 /**************************************************
1100 *
1101 *    BiostrucAlignSeqAsnWrite()
1102 *
1103 **************************************************/
1104 NLM_EXTERN Boolean LIBCALL 
1105 BiostrucAlignSeqAsnWrite(BiostrucAlignSeqPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1106 {
1107    AsnTypePtr atp;
1108    Boolean retval = FALSE;
1109 
1110    if (! loaded)
1111    {
1112       if (! objmimeAsnLoad()) {
1113          return FALSE;
1114       }
1115    }
1116 
1117    if (aip == NULL) {
1118       return FALSE;
1119    }
1120 
1121    atp = AsnLinkType(orig, BIOSTRUC_ALIGN_SEQ);   /* link local tree */
1122    if (atp == NULL) {
1123       return FALSE;
1124    }
1125 
1126    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1127    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1128       goto erret;
1129    }
1130 
1131    AsnGenericChoiceSeqOfAsnWrite(ptr -> sequences, (AsnWriteFunc) SeqEntryAsnWrite, aip, BIOSTRUC_ALIGN_SEQ_sequences, BIOSTRUC_ALIGN_SEQ_sequences_E);
1132 /* AsnGenericUserSeqOfAsnWrite(ptr -> seqalign, (AsnWriteFunc) SeqAnnotAsnWrite, aip, BIOSTRUC_ALIGN_SEQ_seqalign, BIOSTRUC_ALIGN_SEQ_seqalign_E); */
1133      /* yanli comment it out, and add the following, Sept. 16, 1999 */
1134    SeqAnnotSetAsnWrite(ptr -> seqalign, aip, BIOSTRUC_ALIGN_SEQ_seqalign, BIOSTRUC_ALIGN_SEQ_seqalign_E);
1135    /* paul */
1136    if (ptr -> style_dictionary != NULL) {
1137       if ( ! Cn3dStyleDictionaryAsnWrite(ptr -> style_dictionary, aip, ALIGN_SEQ_style_dictionary)) {
1138          goto erret;
1139       }
1140    }
1141    if (ptr -> user_annotations != NULL) {
1142       if ( ! Cn3dUserAnnotationsAsnWrite(ptr -> user_annotations, aip, ALIGN_SEQ_user_annotations)) {
1143          goto erret;
1144       }
1145    }
1146 
1147    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1148       goto erret;
1149    }
1150    retval = TRUE;
1151 
1152 erret:
1153    AsnUnlinkType(orig);       /* unlink local tree */
1154    return retval;
1155 }
1156 
1157 
1158 
1159 /**************************************************
1160 *
1161 *    BiostrucSeqNew()
1162 *
1163 **************************************************/
1164 NLM_EXTERN 
1165 BiostrucSeqPtr LIBCALL
1166 BiostrucSeqNew(void)
1167 {
1168    BiostrucSeqPtr ptr = MemNew((size_t) sizeof(BiostrucSeq));
1169 
1170    return ptr;
1171 
1172 }
1173 
1174 
1175 /**************************************************
1176 *
1177 *    BiostrucSeqFree()
1178 *
1179 **************************************************/
1180 NLM_EXTERN 
1181 BiostrucSeqPtr LIBCALL
1182 BiostrucSeqFree(BiostrucSeqPtr ptr)
1183 {
1184 
1185    if(ptr == NULL) {
1186       return NULL;
1187    }
1188    BiostrucFree(ptr -> structure);
1189    AsnGenericChoiceSeqOfFree(ptr -> sequences, (AsnOptFreeFunc) SeqEntryFree);
1190    Cn3dStyleDictionaryFree(ptr -> style_dictionary); /* paul */
1191    Cn3dUserAnnotationsFree(ptr -> user_annotations);
1192    return MemFree(ptr);
1193 }
1194 
1195 
1196 /**************************************************
1197 *
1198 *    BiostrucSeqAsnRead()
1199 *
1200 **************************************************/
1201 NLM_EXTERN 
1202 BiostrucSeqPtr LIBCALL
1203 BiostrucSeqAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1204 {
1205    DataVal av;
1206    AsnTypePtr atp;
1207    Boolean isError = FALSE;
1208    AsnReadFunc func;
1209    BiostrucSeqPtr ptr;
1210 
1211    if (! loaded)
1212    {
1213       if (! objmimeAsnLoad()) {
1214          return NULL;
1215       }
1216    }
1217 
1218    if (aip == NULL) {
1219       return NULL;
1220    }
1221 
1222    if (orig == NULL) {         /* BiostrucSeq ::= (self contained) */
1223       atp = AsnReadId(aip, amp, BIOSTRUC_SEQ);
1224    } else {
1225       atp = AsnLinkType(orig, BIOSTRUC_SEQ);
1226    }
1227    /* link in local tree */
1228    if (atp == NULL) {
1229       return NULL;
1230    }
1231 
1232    ptr = BiostrucSeqNew();
1233    if (ptr == NULL) {
1234       goto erret;
1235    }
1236    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1237       goto erret;
1238    }
1239 
1240    atp = AsnReadId(aip,amp, atp);
1241    func = NULL;
1242 
1243    if (atp == BIOSTRUC_SEQ_structure) {
1244       ptr -> structure = BiostrucAsnRead(aip, atp);
1245       if (aip -> io_failure) {
1246          goto erret;
1247       }
1248       atp = AsnReadId(aip,amp, atp);
1249    }
1250    if (atp == BIOSTRUC_SEQ_sequences) {
1251       ptr -> sequences = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
1252       if (isError && ptr -> sequences == NULL) {
1253          goto erret;
1254       }
1255       atp = AsnReadId(aip,amp, atp);
1256    }
1257    /* paul */
1258    if (atp == BIOSTRUC_SEQ_style_dictionary) {
1259       ptr -> style_dictionary = Cn3dStyleDictionaryAsnRead(aip, atp);
1260       if (aip -> io_failure) {
1261          goto erret;
1262       }
1263       atp = AsnReadId(aip,amp, atp);
1264    }
1265    if (atp == BIOSTRUC_SEQ_user_annotations) {
1266       ptr -> user_annotations = Cn3dUserAnnotationsAsnRead(aip, atp);
1267       if (aip -> io_failure) {
1268          goto erret;
1269       }
1270       atp = AsnReadId(aip,amp, atp);
1271    }
1272 
1273    if (AsnReadVal(aip, atp, &av) <= 0) {
1274       goto erret;
1275    }
1276    /* end struct */
1277 
1278 ret:
1279    AsnUnlinkType(orig);       /* unlink local tree */
1280    return ptr;
1281 
1282 erret:
1283    aip -> io_failure = TRUE;
1284    ptr = BiostrucSeqFree(ptr);
1285    goto ret;
1286 }
1287 
1288 
1289 
1290 /**************************************************
1291 *
1292 *    BiostrucSeqAsnWrite()
1293 *
1294 **************************************************/
1295 NLM_EXTERN Boolean LIBCALL 
1296 BiostrucSeqAsnWrite(BiostrucSeqPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1297 {
1298    AsnTypePtr atp;
1299    Boolean retval = FALSE;
1300 
1301    if (! loaded)
1302    {
1303       if (! objmimeAsnLoad()) {
1304          return FALSE;
1305       }
1306    }
1307 
1308    if (aip == NULL) {
1309       return FALSE;
1310    }
1311 
1312    atp = AsnLinkType(orig, BIOSTRUC_SEQ);   /* link local tree */
1313    if (atp == NULL) {
1314       return FALSE;
1315    }
1316 
1317    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1318    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1319       goto erret;
1320    }
1321 
1322    if (ptr -> structure != NULL) {
1323       if ( ! BiostrucAsnWrite(ptr -> structure, aip, BIOSTRUC_SEQ_structure)) {
1324          goto erret;
1325       }
1326    }
1327    AsnGenericChoiceSeqOfAsnWrite(ptr -> sequences, (AsnWriteFunc) SeqEntryAsnWrite, aip, BIOSTRUC_SEQ_sequences, BIOSTRUC_SEQ_sequences_E);
1328    /* paul */
1329    if (ptr -> style_dictionary != NULL) {
1330       if ( ! Cn3dStyleDictionaryAsnWrite(ptr -> style_dictionary, aip, BIOSTRUC_SEQ_style_dictionary)) {
1331          goto erret;
1332       }
1333    }
1334    if (ptr -> user_annotations != NULL) {
1335       if ( ! Cn3dUserAnnotationsAsnWrite(ptr -> user_annotations, aip, BIOSTRUC_SEQ_user_annotations)) {
1336          goto erret;
1337       }
1338    }
1339 
1340    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1341       goto erret;
1342    }
1343    retval = TRUE;
1344 
1345 erret:
1346    AsnUnlinkType(orig);       /* unlink local tree */
1347    return retval;
1348 }
1349 
1350 
1351 
1352 /**************************************************
1353 *
1354 *    BiostrucSeqsNew()
1355 *
1356 **************************************************/
1357 NLM_EXTERN 
1358 BiostrucSeqsPtr LIBCALL
1359 BiostrucSeqsNew(void)
1360 {
1361    BiostrucSeqsPtr ptr = MemNew((size_t) sizeof(BiostrucSeqs));
1362 
1363    return ptr;
1364 
1365 }
1366 
1367 
1368 /**************************************************
1369 *
1370 *    BiostrucSeqsFree()
1371 *
1372 **************************************************/
1373 NLM_EXTERN 
1374 BiostrucSeqsPtr LIBCALL
1375 BiostrucSeqsFree(BiostrucSeqsPtr ptr)
1376 {
1377 
1378    if(ptr == NULL) {
1379       return NULL;
1380    }
1381    BiostrucFree(ptr -> structure);
1382    AsnGenericChoiceSeqOfFree(ptr -> sequences, (AsnOptFreeFunc) SeqEntryFree);
1383    AsnGenericUserSeqOfFree(ptr -> seqalign, (AsnOptFreeFunc) SeqAnnotFree);
1384    Cn3dStyleDictionaryFree(ptr -> style_dictionary); /* paul */
1385    Cn3dUserAnnotationsFree(ptr -> user_annotations);
1386    return MemFree(ptr);
1387 }
1388 
1389 
1390 /**************************************************
1391 *
1392 *    BiostrucSeqsAsnRead()
1393 *
1394 **************************************************/
1395 NLM_EXTERN 
1396 BiostrucSeqsPtr LIBCALL
1397 BiostrucSeqsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1398 {
1399    DataVal av;
1400    AsnTypePtr atp;
1401    Boolean isError = FALSE;
1402    AsnReadFunc func;
1403    BiostrucSeqsPtr ptr;
1404 
1405    if (! loaded)
1406    {
1407       if (! objmimeAsnLoad()) {
1408          return NULL;
1409       }
1410    }
1411 
1412    if (aip == NULL) {
1413       return NULL;
1414    }
1415 
1416    if (orig == NULL) {         /* BiostrucSeqs ::= (self contained) */
1417       atp = AsnReadId(aip, amp, BIOSTRUC_SEQS);
1418    } else {
1419       atp = AsnLinkType(orig, BIOSTRUC_SEQS);
1420    }
1421    /* link in local tree */
1422    if (atp == NULL) {
1423       return NULL;
1424    }
1425 
1426    ptr = BiostrucSeqsNew();
1427    if (ptr == NULL) {
1428       goto erret;
1429    }
1430    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1431       goto erret;
1432    }
1433 
1434    atp = AsnReadId(aip,amp, atp);
1435    func = NULL;
1436 
1437    if (atp == BIOSTRUC_SEQS_structure) {
1438       ptr -> structure = BiostrucAsnRead(aip, atp);
1439       if (aip -> io_failure) {
1440          goto erret;
1441       }
1442       atp = AsnReadId(aip,amp, atp);
1443    }
1444    if (atp == BIOSTRUC_SEQS_sequences) {
1445       ptr -> sequences = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
1446       if (isError && ptr -> sequences == NULL) {
1447          goto erret;
1448       }
1449       atp = AsnReadId(aip,amp, atp);
1450    }
1451    if (atp == BIOSTRUC_SEQS_seqalign) {
1452 /*    ptr -> seqalign = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqAnnotAsnRead, (AsnOptFreeFunc) SeqAnnotFree);
1453       if (isError && ptr -> seqalign == NULL) {
1454          goto erret;
1455       }  */ /* yanli comment it out, add following, Sept. 16, 1999 */
1456       ptr -> seqalign = SeqAnnotSetAsnRead(aip, BIOSTRUC_SEQS_seqalign, BIOSTRUC_SEQS_seqalign_E);
1457       atp = AsnReadId(aip,amp, atp);
1458    }
1459    /* paul */
1460    if (atp == BIOSTRUC_SEQS_style_dictionary) {
1461       ptr -> style_dictionary = Cn3dStyleDictionaryAsnRead(aip, atp);
1462       if (aip -> io_failure) {
1463          goto erret;
1464       }
1465       atp = AsnReadId(aip,amp, atp);
1466    }
1467    if (atp == BIOSTRUC_SEQS_user_annotations) {
1468       ptr -> user_annotations = Cn3dUserAnnotationsAsnRead(aip, atp);
1469       if (aip -> io_failure) {
1470          goto erret;
1471       }
1472       atp = AsnReadId(aip,amp, atp);
1473    }
1474 
1475    if (AsnReadVal(aip, atp, &av) <= 0) {
1476       goto erret;
1477    }
1478    /* end struct */
1479 
1480 ret:
1481    AsnUnlinkType(orig);       /* unlink local tree */
1482    return ptr;
1483 
1484 erret:
1485    aip -> io_failure = TRUE;
1486    ptr = BiostrucSeqsFree(ptr);
1487    goto ret;
1488 }
1489 
1490 
1491 
1492 /**************************************************
1493 *
1494 *    BiostrucSeqsAsnWrite()
1495 *
1496 **************************************************/
1497 NLM_EXTERN Boolean LIBCALL 
1498 BiostrucSeqsAsnWrite(BiostrucSeqsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1499 {
1500    AsnTypePtr atp;
1501    Boolean retval = FALSE;
1502 
1503    if (! loaded)
1504    {
1505       if (! objmimeAsnLoad()) {
1506          return FALSE;
1507       }
1508    }
1509 
1510    if (aip == NULL) {
1511       return FALSE;
1512    }
1513 
1514    atp = AsnLinkType(orig, BIOSTRUC_SEQS);   /* link local tree */
1515    if (atp == NULL) {
1516       return FALSE;
1517    }
1518 
1519    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1520    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1521       goto erret;
1522    }
1523 
1524    if (ptr -> structure != NULL) {
1525       if ( ! BiostrucAsnWrite(ptr -> structure, aip, BIOSTRUC_SEQS_structure)) {
1526          goto erret;
1527       }
1528    }
1529    AsnGenericChoiceSeqOfAsnWrite(ptr -> sequences, (AsnWriteFunc) SeqEntryAsnWrite, aip, BIOSTRUC_SEQS_sequences, BIOSTRUC_SEQS_sequences_E);
1530 /* AsnGenericUserSeqOfAsnWrite(ptr -> seqalign, (AsnWriteFunc) SeqAnnotAsnWrite, aip, BIOSTRUC_SEQS_seqalign, BIOSTRUC_SEQS_seqalign_E); */
1531    /* yanli comment this out, and the following, Sept. 16, 1998 */
1532    SeqAnnotSetAsnWrite(ptr -> seqalign, aip, BIOSTRUC_SEQS_seqalign, BIOSTRUC_SEQS_seqalign_E);
1533    /* paul */
1534    if (ptr -> style_dictionary != NULL) {
1535       if ( ! Cn3dStyleDictionaryAsnWrite(ptr -> style_dictionary, aip, BIOSTRUC_SEQS_style_dictionary)) {
1536          goto erret;
1537       }
1538    }
1539    if (ptr -> user_annotations != NULL) {
1540       if ( ! Cn3dUserAnnotationsAsnWrite(ptr -> user_annotations, aip, BIOSTRUC_SEQS_user_annotations)) {
1541          goto erret;
1542       }
1543    }
1544 
1545    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1546       goto erret;
1547    }
1548    retval = TRUE;
1549 
1550 erret:
1551    AsnUnlinkType(orig);       /* unlink local tree */
1552    return retval;
1553 }
1554 
1555 /**************************************************
1556 *
1557 *    BiostrucSeqsAlignsCddNew()
1558 *
1559 **************************************************/
1560 NLM_EXTERN
1561 BiostrucSeqsAlignsCddPtr LIBCALL
1562 BiostrucSeqsAlignsCddNew(void)
1563 {
1564    BiostrucSeqsAlignsCddPtr ptr = MemNew((size_t) sizeof(BiostrucSeqsAlignsCdd));
1565 
1566    return ptr;
1567 
1568 }
1569 
1570 
1571 /**************************************************
1572 *
1573 *    BiostrucSeqsAlignsCddFree()
1574 *
1575 **************************************************/
1576 NLM_EXTERN
1577 BiostrucSeqsAlignsCddPtr LIBCALL
1578 BiostrucSeqsAlignsCddFree(BiostrucSeqsAlignsCddPtr ptr)
1579 {
1580 
1581    if(ptr == NULL) {
1582       return NULL;
1583    }
1584    SeqAlignData_seq_align_dataFree(ptr -> SeqAlignData_seq_align_data);
1585    AsnGenericUserSeqOfFree(ptr -> structures, (AsnOptFreeFunc) BiostrucFree);
1586    return MemFree(ptr);
1587 }
1588 
1589 
1590 /**************************************************
1591 *
1592 *    SeqAlignData_seq_align_dataFree()
1593 *
1594 **************************************************/
1595 static
1596 SeqAlignData_seq_align_dataPtr LIBCALL
1597 SeqAlignData_seq_align_dataFree(ValNodePtr anp)
1598 {
1599    Pointer pnt;
1600 
1601    if (anp == NULL) {
1602       return NULL;
1603    }
1604 
1605    pnt = anp->data.ptrvalue;
1606    switch (anp->choice)
1607    {
1608    default:
1609       break;
1610    case SeqAlignData_seq_align_data_bundle:
1611       BundleSeqsAlignsFree(anp -> data.ptrvalue);
1612       break;
1613    case SeqAlignData_seq_align_data_cdd:
1614       CddFree(anp -> data.ptrvalue);
1615       break;
1616    }
1617    return MemFree(anp);
1618 }
1619 
1620 
1621 /**************************************************
1622 *
1623 *    BiostrucSeqsAlignsCddAsnRead()
1624 *
1625 **************************************************/
1626 NLM_EXTERN
1627 BiostrucSeqsAlignsCddPtr LIBCALL
1628 BiostrucSeqsAlignsCddAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1629 {
1630    DataVal av;
1631    AsnTypePtr atp;
1632    Boolean isError = FALSE;
1633    AsnReadFunc func;
1634    BiostrucSeqsAlignsCddPtr ptr;
1635 
1636    if (! loaded)
1637    {
1638       if (! objmimeAsnLoad()) {
1639          return NULL;
1640       }
1641    }
1642 
1643    if (aip == NULL) {
1644       return NULL;
1645    }
1646 
1647    if (orig == NULL) {         /* BiostrucSeqsAlignsCdd ::= (self contained) */
1648       atp = AsnReadId(aip, amp, BIOSTRUC_SEQS_ALIGNS_CDD);
1649    } else {
1650       atp = AsnLinkType(orig, BIOSTRUC_SEQS_ALIGNS_CDD);
1651    }
1652    /* link in local tree */
1653    if (atp == NULL) {
1654       return NULL;
1655    }
1656 
1657    ptr = BiostrucSeqsAlignsCddNew();
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 == SEQS_ALIGNS_CDD_seq_align_data) {
1669       ptr -> SeqAlignData_seq_align_data = SeqAlignData_seq_align_dataAsnRead(aip, atp);
1670       if (aip -> io_failure) {
1671          goto erret;
1672       }
1673       atp = AsnReadId(aip,amp, atp);
1674    }
1675    if (atp == SEQS_ALIGNS_CDD_structures) {
1676       ptr -> structures = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucAsnRead, (AsnOptFreeFunc) BiostrucFree);
1677       if (isError && ptr -> structures == NULL) {
1678          goto erret;
1679       }
1680       atp = AsnReadId(aip,amp, atp);
1681    }
1682    if (atp == SEQS_ALIGNS_CDD_structure_type) {
1683       if ( AsnReadVal(aip, atp, &av) <= 0) {
1684          goto erret;
1685       }
1686       ptr -> structure_type = av.intvalue;
1687       atp = AsnReadId(aip,amp, atp);
1688    }
1689 
1690    if (AsnReadVal(aip, atp, &av) <= 0) {
1691       goto erret;
1692    }
1693    /* end struct */
1694 
1695 ret:
1696    AsnUnlinkType(orig);       /* unlink local tree */
1697    return ptr;
1698 
1699 erret:
1700    aip -> io_failure = TRUE;
1701    ptr = BiostrucSeqsAlignsCddFree(ptr);
1702    goto ret;
1703 }
1704 
1705 
1706 
1707 /**************************************************
1708 *
1709 *    SeqAlignData_seq_align_dataAsnRead()
1710 *
1711 **************************************************/
1712 static
1713 SeqAlignData_seq_align_dataPtr LIBCALL
1714 SeqAlignData_seq_align_dataAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1715 {
1716    DataVal av;
1717    AsnTypePtr atp;
1718    ValNodePtr anp;
1719    Uint1 choice;
1720    Boolean isError = FALSE;
1721    Boolean nullIsError = FALSE;
1722    AsnReadFunc func;
1723 
1724    if (! loaded)
1725    {
1726       if (! objmimeAsnLoad()) {
1727          return NULL;
1728       }
1729    }
1730 
1731    if (aip == NULL) {
1732       return NULL;
1733    }
1734 
1735    if (orig == NULL) {         /* SeqAlignData_seq_align_data ::= (self contained) */
1736       atp = AsnReadId(aip, amp, SEQS_ALIGNS_CDD_seq_align_data);
1737    } else {
1738       atp = AsnLinkType(orig, SEQS_ALIGNS_CDD_seq_align_data);    /* link in local tree */
1739    }
1740    if (atp == NULL) {
1741       return NULL;
1742    }
1743 
1744    anp = ValNodeNew(NULL);
1745    if (anp == NULL) {
1746       goto erret;
1747    }
1748    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1749       goto erret;
1750    }
1751 
1752    func = NULL;
1753 
1754    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1755    if (atp == NULL) {
1756       goto erret;
1757    }
1758    if (atp == CDD_seq_align_data_bundle) {
1759       choice = SeqAlignData_seq_align_data_bundle;
1760       func = (AsnReadFunc) BundleSeqsAlignsAsnRead;
1761    }
1762    else if (atp == ALIGNS_CDD_seq_align_data_cdd) {
1763       choice = SeqAlignData_seq_align_data_cdd;
1764       func = (AsnReadFunc) CddAsnRead;
1765    }
1766    anp->choice = choice;
1767    if (func != NULL)
1768    {
1769       anp->data.ptrvalue = (* func)(aip, atp);
1770       if (aip -> io_failure) goto erret;
1771 
1772       if (nullIsError && anp->data.ptrvalue == NULL) {
1773          goto erret;
1774       }
1775    }
1776 
1777 ret:
1778    AsnUnlinkType(orig);       /* unlink local tree */
1779    return anp;
1780 
1781 erret:
1782    anp = MemFree(anp);
1783    aip -> io_failure = TRUE;
1784    goto ret;
1785 }
1786 
1787 
1788 /**************************************************
1789 *
1790 *    BiostrucSeqsAlignsCddAsnWrite()
1791 *
1792 **************************************************/
1793 NLM_EXTERN Boolean LIBCALL
1794 BiostrucSeqsAlignsCddAsnWrite(BiostrucSeqsAlignsCddPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1795 {
1796    DataVal av;
1797    AsnTypePtr atp;
1798    Boolean retval = FALSE;
1799 
1800    if (! loaded)
1801    {
1802       if (! objmimeAsnLoad()) {
1803          return FALSE;
1804       }
1805    }
1806 
1807    if (aip == NULL) {
1808       return FALSE;
1809    }
1810 
1811    atp = AsnLinkType(orig, BIOSTRUC_SEQS_ALIGNS_CDD);   /* link local tree */
1812    if (atp == NULL) {
1813       return FALSE;
1814    }
1815 
1816    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1817    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1818       goto erret;
1819    }
1820 
1821    if (ptr -> SeqAlignData_seq_align_data != NULL) {
1822       if ( ! SeqAlignData_seq_align_dataAsnWrite(ptr -> SeqAlignData_seq_align_data, aip, SEQS_ALIGNS_CDD_seq_align_data)) {
1823          goto erret;
1824       }
1825    }
1826    AsnGenericUserSeqOfAsnWrite(ptr -> structures, (AsnWriteFunc) BiostrucAsnWrite, aip, SEQS_ALIGNS_CDD_structures, SEQS_ALIGNS_CDD_structures_E);
1827    av.intvalue = ptr -> structure_type;
1828    retval = AsnWrite(aip, SEQS_ALIGNS_CDD_structure_type,  &av);
1829    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1830       goto erret;
1831    }
1832    retval = TRUE;
1833 
1834 erret:
1835    AsnUnlinkType(orig);       /* unlink local tree */
1836    return retval;
1837 }
1838 
1839 
1840 
1841 /**************************************************
1842 *
1843 *    SeqAlignData_seq_align_dataAsnWrite()
1844 *
1845 **************************************************/
1846 static Boolean LIBCALL
1847 SeqAlignData_seq_align_dataAsnWrite(SeqAlignData_seq_align_dataPtr anp, AsnIoPtr aip, AsnTypePtr orig)
1848 
1849 {
1850    DataVal av;
1851    AsnTypePtr atp, writetype = NULL;
1852    Pointer pnt;
1853    AsnWriteFunc func = NULL;
1854    Boolean retval = FALSE;
1855 
1856    if (! loaded)
1857    {
1858       if (! objmimeAsnLoad())
1859       return FALSE;
1860    }
1861 
1862    if (aip == NULL)
1863    return FALSE;
1864 
1865    atp = AsnLinkType(orig, SEQS_ALIGNS_CDD_seq_align_data);   /* link local tree */
1866    if (atp == NULL) {
1867       return FALSE;
1868    }
1869 
1870    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1871 
1872    av.ptrvalue = (Pointer)anp;
1873    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1874       goto erret;
1875    }
1876 
1877    pnt = anp->data.ptrvalue;
1878    switch (anp->choice)
1879    {
1880    case SeqAlignData_seq_align_data_bundle:
1881       writetype = CDD_seq_align_data_bundle;
1882       func = (AsnWriteFunc) BundleSeqsAlignsAsnWrite;
1883       break;
1884    case SeqAlignData_seq_align_data_cdd:
1885       writetype = ALIGNS_CDD_seq_align_data_cdd;
1886       func = (AsnWriteFunc) CddAsnWrite;
1887       break;
1888    }
1889    if (writetype != NULL) {
1890       retval = (* func)(pnt, aip, writetype);   /* write it out */
1891    }
1892    if (!retval) {
1893       goto erret;
1894    }
1895    retval = TRUE;
1896 
1897 erret:
1898    AsnUnlinkType(orig);       /* unlink local tree */
1899    return retval;
1900 }
1901 
1902 
1903 /**************************************************
1904 *
1905 *    BundleSeqsAlignsNew()
1906 *
1907 **************************************************/
1908 NLM_EXTERN
1909 BundleSeqsAlignsPtr LIBCALL
1910 BundleSeqsAlignsNew(void)
1911 {
1912    BundleSeqsAlignsPtr ptr = MemNew((size_t) sizeof(BundleSeqsAligns));
1913 
1914    return ptr;
1915 
1916 }
1917 
1918 
1919 /**************************************************
1920 *
1921 *    BundleSeqsAlignsFree()
1922 *
1923 **************************************************/
1924 NLM_EXTERN
1925 BundleSeqsAlignsPtr LIBCALL
1926 BundleSeqsAlignsFree(BundleSeqsAlignsPtr ptr)
1927 {
1928 
1929    if(ptr == NULL) {
1930       return NULL;
1931    }
1932    AsnGenericChoiceSeqOfFree(ptr -> sequences, (AsnOptFreeFunc) SeqEntryFree);
1933    AsnGenericUserSeqOfFree(ptr -> seqaligns, (AsnOptFreeFunc) SeqAnnotFree);
1934    BiostrucAnnotSetFree(ptr -> strucaligns);
1935    AsnGenericUserSeqOfFree(ptr -> imports, (AsnOptFreeFunc) SeqAnnotFree);
1936    Cn3dStyleDictionaryFree(ptr -> style_dictionary);
1937    Cn3dUserAnnotationsFree(ptr -> user_annotations);
1938    return MemFree(ptr);
1939 }
1940 
1941 
1942 /**************************************************
1943 *
1944 *    BundleSeqsAlignsAsnRead()
1945 *
1946 **************************************************/
1947 NLM_EXTERN
1948 BundleSeqsAlignsPtr LIBCALL
1949 BundleSeqsAlignsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1950 {
1951    DataVal av;
1952    AsnTypePtr atp;
1953    Boolean isError = FALSE;
1954    AsnReadFunc func;
1955    BundleSeqsAlignsPtr ptr;
1956 
1957    if (! loaded)
1958    {
1959       if (! objmimeAsnLoad()) {
1960          return NULL;
1961       }
1962    }
1963 
1964    if (aip == NULL) {
1965       return NULL;
1966    }
1967 
1968    if (orig == NULL) {         /* BundleSeqsAligns ::= (self contained) */
1969       atp = AsnReadId(aip, amp, BUNDLE_SEQS_ALIGNS);
1970    } else {
1971       atp = AsnLinkType(orig, BUNDLE_SEQS_ALIGNS);
1972    }
1973    /* link in local tree */
1974    if (atp == NULL) {
1975       return NULL;
1976    }
1977 
1978    ptr = BundleSeqsAlignsNew();
1979    if (ptr == NULL) {
1980       goto erret;
1981    }
1982    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1983       goto erret;
1984    }
1985 
1986    atp = AsnReadId(aip,amp, atp);
1987    func = NULL;
1988 
1989    if (atp == BUNDLE_SEQS_ALIGNS_sequences) {
1990       ptr -> sequences = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
1991       if (isError && ptr -> sequences == NULL) {
1992          goto erret;
1993       }
1994       atp = AsnReadId(aip,amp, atp);
1995    }
1996    if (atp == BUNDLE_SEQS_ALIGNS_seqaligns) {
1997       ptr -> seqaligns = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqAnnotAsnRead, (AsnOptFreeFunc) SeqAnnotFree);
1998       if (isError && ptr -> seqaligns == NULL) {
1999          goto erret;
2000       }
2001       atp = AsnReadId(aip,amp, atp);
2002    }
2003    if (atp == BUNDLE_SEQS_ALIGNS_strucaligns) {
2004       ptr -> strucaligns = BiostrucAnnotSetAsnRead(aip, atp);
2005       if (aip -> io_failure) {
2006          goto erret;
2007       }
2008       atp = AsnReadId(aip,amp, atp);
2009    }
2010    if (atp == BUNDLE_SEQS_ALIGNS_imports) {
2011       ptr -> imports = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqAnnotAsnRead, (AsnOptFreeFunc) SeqAnnotFree);
2012       if (isError && ptr -> imports == NULL) {
2013          goto erret;
2014       }
2015       atp = AsnReadId(aip,amp, atp);
2016    }
2017    if (atp == SEQS_ALIGNS_style_dictionary) {
2018       ptr -> style_dictionary = Cn3dStyleDictionaryAsnRead(aip, atp);
2019       if (aip -> io_failure) {
2020          goto erret;
2021       }
2022       atp = AsnReadId(aip,amp, atp);
2023    }
2024    if (atp == SEQS_ALIGNS_user_annotations) {
2025       ptr -> user_annotations = Cn3dUserAnnotationsAsnRead(aip, atp);
2026       if (aip -> io_failure) {
2027          goto erret;
2028       }
2029       atp = AsnReadId(aip,amp, atp);
2030    }
2031 
2032    if (AsnReadVal(aip, atp, &av) <= 0) {
2033       goto erret;
2034    }
2035    /* end struct */
2036 
2037 ret:
2038    AsnUnlinkType(orig);       /* unlink local tree */
2039    return ptr;
2040 
2041 erret:
2042    aip -> io_failure = TRUE;
2043    ptr = BundleSeqsAlignsFree(ptr);
2044    goto ret;
2045 }
2046 
2047 
2048 
2049 /**************************************************
2050 *
2051 *    BundleSeqsAlignsAsnWrite()
2052 *
2053 **************************************************/
2054 NLM_EXTERN Boolean LIBCALL
2055 BundleSeqsAlignsAsnWrite(BundleSeqsAlignsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2056 {
2057    AsnTypePtr atp;
2058    Boolean retval = FALSE;
2059 
2060    if (! loaded)
2061    {
2062       if (! objmimeAsnLoad()) {
2063          return FALSE;
2064       }
2065    }
2066 
2067    if (aip == NULL) {
2068       return FALSE;
2069    }
2070 
2071    atp = AsnLinkType(orig, BUNDLE_SEQS_ALIGNS);   /* link local tree */
2072    if (atp == NULL) {
2073       return FALSE;
2074    }
2075 
2076    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2077    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2078       goto erret;
2079    }
2080 
2081    AsnGenericChoiceSeqOfAsnWrite(ptr -> sequences, (AsnWriteFunc) SeqEntryAsnWrite, aip, BUNDLE_SEQS_ALIGNS_sequences, BUNDLE_SEQS_ALIGNS_sequences_E);
2082    AsnGenericUserSeqOfAsnWrite(ptr -> seqaligns, (AsnWriteFunc) SeqAnnotAsnWrite, aip, BUNDLE_SEQS_ALIGNS_seqaligns, BUNDLE_SEQS_ALIGNS_seqaligns_E);
2083    if (ptr -> strucaligns != NULL) {
2084       if ( ! BiostrucAnnotSetAsnWrite(ptr -> strucaligns, aip, BUNDLE_SEQS_ALIGNS_strucaligns)) {
2085          goto erret;
2086       }
2087    }
2088    AsnGenericUserSeqOfAsnWrite(ptr -> imports, (AsnWriteFunc) SeqAnnotAsnWrite, aip, BUNDLE_SEQS_ALIGNS_imports, BUNDLE_SEQS_ALIGNS_imports_E);
2089    if (ptr -> style_dictionary != NULL) {
2090       if ( ! Cn3dStyleDictionaryAsnWrite(ptr -> style_dictionary, aip, SEQS_ALIGNS_style_dictionary)) {
2091          goto erret;
2092       }
2093    }
2094    if (ptr -> user_annotations != NULL) {
2095       if ( ! Cn3dUserAnnotationsAsnWrite(ptr -> user_annotations, aip, SEQS_ALIGNS_user_annotations)) {
2096          goto erret;
2097       }
2098    }
2099    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2100       goto erret;
2101    }
2102    retval = TRUE;
2103 
2104 erret:
2105    AsnUnlinkType(orig);       /* unlink local tree */
2106    return retval;
2107 }
2108 

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

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