1 #include <asn.h>
2 
3 #define NLM_GENERATED_CODE_PROTO
4 
5 #include <strimprt.h>
6 #include <objmmdb3.h>
7 
8 static Boolean loaded = FALSE;
9 
10 #include <mmdb3.h>
11 
12 #ifndef NLM_EXTERN_LOADS
13 #define NLM_EXTERN_LOADS {}
14 #endif
15 
16 NLM_EXTERN Boolean LIBCALL
objmmdb3AsnLoad(void)17 objmmdb3AsnLoad(void)
18 {
19 
20    if ( ! loaded) {
21       NLM_EXTERN_LOADS
22 
23       if ( ! AsnLoad ())
24       return FALSE;
25       loaded = TRUE;
26    }
27 
28    return TRUE;
29 }
30 
31 
32 
33 /**************************************************
34 *    Generated object loaders for Module MMDB-Features
35 *    Generated using ASNCODE Revision: 6.17 at Feb 3, 2011 12:29 PM
36 *
37 **************************************************/
38 
39 
40 /**************************************************
41 *
42 *    BiostrucFeatureSetNew()
43 *
44 **************************************************/
45 NLM_EXTERN
46 BiostrucFeatureSetPtr LIBCALL
BiostrucFeatureSetNew(void)47 BiostrucFeatureSetNew(void)
48 {
49    BiostrucFeatureSetPtr ptr = MemNew((size_t) sizeof(BiostrucFeatureSet));
50 
51    return ptr;
52 
53 }
54 
55 
56 /**************************************************
57 *
58 *    BiostrucFeatureSetFree()
59 *
60 **************************************************/
61 NLM_EXTERN
62 BiostrucFeatureSetPtr LIBCALL
BiostrucFeatureSetFree(BiostrucFeatureSetPtr ptr)63 BiostrucFeatureSetFree(BiostrucFeatureSetPtr ptr)
64 {
65 
66    if(ptr == NULL) {
67       return NULL;
68    }
69    AsnGenericChoiceSeqOfFree(ptr -> descr, (AsnOptFreeFunc) BiostrucFeatureSetDescrFree);
70    AsnGenericUserSeqOfFree(ptr -> features, (AsnOptFreeFunc) BiostrucFeatureFree);
71    return MemFree(ptr);
72 }
73 
74 
75 /**************************************************
76 *
77 *    BiostrucFeatureSetAsnRead()
78 *
79 **************************************************/
80 NLM_EXTERN
81 BiostrucFeatureSetPtr LIBCALL
BiostrucFeatureSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)82 BiostrucFeatureSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
83 {
84    DataVal av;
85    AsnTypePtr atp;
86    Boolean isError = FALSE;
87    AsnReadFunc func;
88    BiostrucFeatureSetPtr ptr;
89 
90    if (! loaded)
91    {
92       if (! objmmdb3AsnLoad()) {
93          return NULL;
94       }
95    }
96 
97    if (aip == NULL) {
98       return NULL;
99    }
100 
101    if (orig == NULL) {         /* BiostrucFeatureSet ::= (self contained) */
102       atp = AsnReadId(aip, amp, BIOSTRUC_FEATURE_SET);
103    } else {
104       atp = AsnLinkType(orig, BIOSTRUC_FEATURE_SET);
105    }
106    /* link in local tree */
107    if (atp == NULL) {
108       return NULL;
109    }
110 
111    ptr = BiostrucFeatureSetNew();
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 == BIOSTRUC_FEATURE_SET_id) {
123       if ( AsnReadVal(aip, atp, &av) <= 0) {
124          goto erret;
125       }
126       ptr -> id = av.intvalue;
127       atp = AsnReadId(aip,amp, atp);
128    }
129    if (atp == BIOSTRUC_FEATURE_SET_descr) {
130       ptr -> descr = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucFeatureSetDescrAsnRead, (AsnOptFreeFunc) BiostrucFeatureSetDescrFree);
131       if (isError && ptr -> descr == NULL) {
132          goto erret;
133       }
134       atp = AsnReadId(aip,amp, atp);
135    }
136    if (atp == BIOSTRUC_FEATURE_SET_features) {
137       ptr -> features = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucFeatureAsnRead, (AsnOptFreeFunc) BiostrucFeatureFree);
138       if (isError && ptr -> features == NULL) {
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 = BiostrucFeatureSetFree(ptr);
156    goto ret;
157 }
158 
159 
160 
161 /**************************************************
162 *
163 *    BiostrucFeatureSetAsnWrite()
164 *
165 **************************************************/
166 NLM_EXTERN Boolean LIBCALL
BiostrucFeatureSetAsnWrite(BiostrucFeatureSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)167 BiostrucFeatureSetAsnWrite(BiostrucFeatureSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
168 {
169    DataVal av;
170    AsnTypePtr atp;
171    Boolean retval = FALSE;
172 
173    if (! loaded)
174    {
175       if (! objmmdb3AsnLoad()) {
176          return FALSE;
177       }
178    }
179 
180    if (aip == NULL) {
181       return FALSE;
182    }
183 
184    atp = AsnLinkType(orig, BIOSTRUC_FEATURE_SET);   /* link local tree */
185    if (atp == NULL) {
186       return FALSE;
187    }
188 
189    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
190    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
191    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
192       goto erret;
193    }
194 
195    av.intvalue = ptr -> id;
196    retval = AsnWrite(aip, BIOSTRUC_FEATURE_SET_id,  &av);
197    AsnGenericChoiceSeqOfAsnWrite(ptr -> descr, (AsnWriteFunc) BiostrucFeatureSetDescrAsnWrite, aip, BIOSTRUC_FEATURE_SET_descr, BIOSTRUC_FEATURE_SET_descr_E);
198    AsnGenericUserSeqOfAsnWrite(ptr -> features, (AsnWriteFunc) BiostrucFeatureAsnWrite, aip, BIOSTRUC_FEATURE_SET_features, BIOSTRUC_FEATURE_SET_features_E);
199    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
200       goto erret;
201    }
202    retval = TRUE;
203 
204 erret:
205    AsnUnlinkType(orig);       /* unlink local tree */
206    return retval;
207 }
208 
209 
210 
211 /**************************************************
212 *
213 *    ChemGraphPntrsFree()
214 *
215 **************************************************/
216 NLM_EXTERN
217 ChemGraphPntrsPtr LIBCALL
ChemGraphPntrsFree(ValNodePtr anp)218 ChemGraphPntrsFree(ValNodePtr anp)
219 {
220    Pointer pnt;
221 
222    if (anp == NULL) {
223       return NULL;
224    }
225 
226    pnt = anp->data.ptrvalue;
227    switch (anp->choice)
228    {
229    default:
230       break;
231    case ChemGraphPntrs_atoms:
232       AtomPntrsFree(anp -> data.ptrvalue);
233       break;
234    case ChemGraphPntrs_residues:
235       ResiduePntrsFree(anp -> data.ptrvalue);
236       break;
237    case ChemGraphPntrs_molecules:
238       MoleculePntrsFree(anp -> data.ptrvalue);
239       break;
240    }
241    return MemFree(anp);
242 }
243 
244 
245 /**************************************************
246 *
247 *    ChemGraphPntrsAsnRead()
248 *
249 **************************************************/
250 NLM_EXTERN
251 ChemGraphPntrsPtr LIBCALL
ChemGraphPntrsAsnRead(AsnIoPtr aip,AsnTypePtr orig)252 ChemGraphPntrsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
253 {
254    DataVal av;
255    AsnTypePtr atp;
256    ValNodePtr anp;
257    Uint1 choice;
258    Boolean nullIsError = FALSE;
259    AsnReadFunc func;
260 
261    if (! loaded)
262    {
263       if (! objmmdb3AsnLoad()) {
264          return NULL;
265       }
266    }
267 
268    if (aip == NULL) {
269       return NULL;
270    }
271 
272    if (orig == NULL) {         /* ChemGraphPntrs ::= (self contained) */
273       atp = AsnReadId(aip, amp, CHEM_GRAPH_PNTRS);
274    } else {
275       atp = AsnLinkType(orig, CHEM_GRAPH_PNTRS);    /* link in local tree */
276    }
277    if (atp == NULL) {
278       return NULL;
279    }
280 
281    anp = ValNodeNew(NULL);
282    if (anp == NULL) {
283       goto erret;
284    }
285    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
286       goto erret;
287    }
288 
289    func = NULL;
290 
291    atp = AsnReadId(aip, amp, atp);  /* find the choice */
292    if (atp == NULL) {
293       goto erret;
294    }
295    if (atp == CHEM_GRAPH_PNTRS_atoms) {
296       choice = ChemGraphPntrs_atoms;
297       func = (AsnReadFunc) AtomPntrsAsnRead;
298    }
299    else if (atp == CHEM_GRAPH_PNTRS_residues) {
300       choice = ChemGraphPntrs_residues;
301       func = (AsnReadFunc) ResiduePntrsAsnRead;
302    }
303    else if (atp == CHEM_GRAPH_PNTRS_molecules) {
304       choice = ChemGraphPntrs_molecules;
305       func = (AsnReadFunc) MoleculePntrsAsnRead;
306    }
307    anp->choice = choice;
308    if (func != NULL)
309    {
310       anp->data.ptrvalue = (* func)(aip, atp);
311       if (aip -> io_failure) goto erret;
312 
313       if (nullIsError && anp->data.ptrvalue == NULL) {
314          goto erret;
315       }
316    }
317 
318 ret:
319    AsnUnlinkType(orig);       /* unlink local tree */
320    return anp;
321 
322 erret:
323    anp = MemFree(anp);
324    aip -> io_failure = TRUE;
325    goto ret;
326 }
327 
328 
329 /**************************************************
330 *
331 *    ChemGraphPntrsAsnWrite()
332 *
333 **************************************************/
334 NLM_EXTERN Boolean LIBCALL
ChemGraphPntrsAsnWrite(ChemGraphPntrsPtr anp,AsnIoPtr aip,AsnTypePtr orig)335 ChemGraphPntrsAsnWrite(ChemGraphPntrsPtr anp, AsnIoPtr aip, AsnTypePtr orig)
336 
337 {
338    DataVal av;
339    AsnTypePtr atp, writetype = NULL;
340    Pointer pnt;
341    AsnWriteFunc func = NULL;
342    Boolean retval = FALSE;
343 
344    if (! loaded)
345    {
346       if (! objmmdb3AsnLoad())
347       return FALSE;
348    }
349 
350    if (aip == NULL)
351    return FALSE;
352 
353    atp = AsnLinkType(orig, CHEM_GRAPH_PNTRS);   /* link local tree */
354    if (atp == NULL) {
355       return FALSE;
356    }
357 
358    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
359    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
360    av.ptrvalue = (Pointer)anp;
361    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
362       goto erret;
363    }
364 
365    pnt = anp->data.ptrvalue;
366    switch (anp->choice)
367    {
368    case ChemGraphPntrs_atoms:
369       writetype = CHEM_GRAPH_PNTRS_atoms;
370       func = (AsnWriteFunc) AtomPntrsAsnWrite;
371       break;
372    case ChemGraphPntrs_residues:
373       writetype = CHEM_GRAPH_PNTRS_residues;
374       func = (AsnWriteFunc) ResiduePntrsAsnWrite;
375       break;
376    case ChemGraphPntrs_molecules:
377       writetype = CHEM_GRAPH_PNTRS_molecules;
378       func = (AsnWriteFunc) MoleculePntrsAsnWrite;
379       break;
380    }
381    if (writetype != NULL) {
382       retval = (* func)(pnt, aip, writetype);   /* write it out */
383    }
384    if (!retval) {
385       goto erret;
386    }
387    retval = TRUE;
388 
389 erret:
390    AsnUnlinkType(orig);       /* unlink local tree */
391    return retval;
392 }
393 
394 
395 /**************************************************
396 *
397 *    AtomPntrsNew()
398 *
399 **************************************************/
400 NLM_EXTERN
401 AtomPntrsPtr LIBCALL
AtomPntrsNew(void)402 AtomPntrsNew(void)
403 {
404    AtomPntrsPtr ptr = MemNew((size_t) sizeof(AtomPntrs));
405 
406    return ptr;
407 
408 }
409 
410 
411 /**************************************************
412 *
413 *    AtomPntrsFree()
414 *
415 **************************************************/
416 NLM_EXTERN
417 AtomPntrsPtr LIBCALL
AtomPntrsFree(AtomPntrsPtr ptr)418 AtomPntrsFree(AtomPntrsPtr ptr)
419 {
420 
421    if(ptr == NULL) {
422       return NULL;
423    }
424    AsnGenericBaseSeqOfFree(ptr -> molecule_ids ,ASNCODE_INTVAL_SLOT);
425    AsnGenericBaseSeqOfFree(ptr -> residue_ids ,ASNCODE_INTVAL_SLOT);
426    AsnGenericBaseSeqOfFree(ptr -> atom_ids ,ASNCODE_INTVAL_SLOT);
427    return MemFree(ptr);
428 }
429 
430 
431 /**************************************************
432 *
433 *    AtomPntrsAsnRead()
434 *
435 **************************************************/
436 NLM_EXTERN
437 AtomPntrsPtr LIBCALL
AtomPntrsAsnRead(AsnIoPtr aip,AsnTypePtr orig)438 AtomPntrsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
439 {
440    DataVal av;
441    AsnTypePtr atp;
442    Boolean isError = FALSE;
443    AsnReadFunc func;
444    AtomPntrsPtr ptr;
445 
446    if (! loaded)
447    {
448       if (! objmmdb3AsnLoad()) {
449          return NULL;
450       }
451    }
452 
453    if (aip == NULL) {
454       return NULL;
455    }
456 
457    if (orig == NULL) {         /* AtomPntrs ::= (self contained) */
458       atp = AsnReadId(aip, amp, ATOM_PNTRS);
459    } else {
460       atp = AsnLinkType(orig, ATOM_PNTRS);
461    }
462    /* link in local tree */
463    if (atp == NULL) {
464       return NULL;
465    }
466 
467    ptr = AtomPntrsNew();
468    if (ptr == NULL) {
469       goto erret;
470    }
471    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
472       goto erret;
473    }
474 
475    atp = AsnReadId(aip,amp, atp);
476    func = NULL;
477 
478    if (atp == ATOM_PNTRS_number_of_ptrs) {
479       if ( AsnReadVal(aip, atp, &av) <= 0) {
480          goto erret;
481       }
482       ptr -> number_of_ptrs = av.intvalue;
483       atp = AsnReadId(aip,amp, atp);
484    }
485    if (atp == ATOM_PNTRS_molecule_ids) {
486       ptr -> molecule_ids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
487       if (isError && ptr -> molecule_ids == NULL) {
488          goto erret;
489       }
490       atp = AsnReadId(aip,amp, atp);
491    }
492    if (atp == ATOM_PNTRS_residue_ids) {
493       ptr -> residue_ids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
494       if (isError && ptr -> residue_ids == NULL) {
495          goto erret;
496       }
497       atp = AsnReadId(aip,amp, atp);
498    }
499    if (atp == ATOM_PNTRS_atom_ids) {
500       ptr -> atom_ids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
501       if (isError && ptr -> atom_ids == NULL) {
502          goto erret;
503       }
504       atp = AsnReadId(aip,amp, atp);
505    }
506 
507    if (AsnReadVal(aip, atp, &av) <= 0) {
508       goto erret;
509    }
510    /* end struct */
511 
512 ret:
513    AsnUnlinkType(orig);       /* unlink local tree */
514    return ptr;
515 
516 erret:
517    aip -> io_failure = TRUE;
518    ptr = AtomPntrsFree(ptr);
519    goto ret;
520 }
521 
522 
523 
524 /**************************************************
525 *
526 *    AtomPntrsAsnWrite()
527 *
528 **************************************************/
529 NLM_EXTERN Boolean LIBCALL
AtomPntrsAsnWrite(AtomPntrsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)530 AtomPntrsAsnWrite(AtomPntrsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
531 {
532    DataVal av;
533    AsnTypePtr atp;
534    Boolean retval = FALSE;
535 
536    if (! loaded)
537    {
538       if (! objmmdb3AsnLoad()) {
539          return FALSE;
540       }
541    }
542 
543    if (aip == NULL) {
544       return FALSE;
545    }
546 
547    atp = AsnLinkType(orig, ATOM_PNTRS);   /* link local tree */
548    if (atp == NULL) {
549       return FALSE;
550    }
551 
552    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
553    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
554    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
555       goto erret;
556    }
557 
558    av.intvalue = ptr -> number_of_ptrs;
559    retval = AsnWrite(aip, ATOM_PNTRS_number_of_ptrs,  &av);
560    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> molecule_ids ,ASNCODE_INTVAL_SLOT, aip, ATOM_PNTRS_molecule_ids, ATOM_PNTRS_molecule_ids_E);
561    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> residue_ids ,ASNCODE_INTVAL_SLOT, aip, ATOM_PNTRS_residue_ids, ATOM_PNTRS_residue_ids_E);
562    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> atom_ids ,ASNCODE_INTVAL_SLOT, aip, ATOM_PNTRS_atom_ids, ATOM_PNTRS_atom_ids_E);
563    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
564       goto erret;
565    }
566    retval = TRUE;
567 
568 erret:
569    AsnUnlinkType(orig);       /* unlink local tree */
570    return retval;
571 }
572 
573 
574 
575 /**************************************************
576 *
577 *    ChemGraphAlignmentNew()
578 *
579 **************************************************/
580 NLM_EXTERN
581 ChemGraphAlignmentPtr LIBCALL
ChemGraphAlignmentNew(void)582 ChemGraphAlignmentNew(void)
583 {
584    ChemGraphAlignmentPtr ptr = MemNew((size_t) sizeof(ChemGraphAlignment));
585 
586    ptr -> dimension = 2;
587    return ptr;
588 
589 }
590 
591 
592 /**************************************************
593 *
594 *    ChemGraphAlignmentFree()
595 *
596 **************************************************/
597 NLM_EXTERN
598 ChemGraphAlignmentPtr LIBCALL
ChemGraphAlignmentFree(ChemGraphAlignmentPtr ptr)599 ChemGraphAlignmentFree(ChemGraphAlignmentPtr ptr)
600 {
601 
602    if(ptr == NULL) {
603       return NULL;
604    }
605    AsnGenericChoiceSeqOfFree(ptr -> biostruc_ids, (AsnOptFreeFunc) BiostrucIdFree);
606    AsnGenericChoiceSeqOfFree(ptr -> alignment, (AsnOptFreeFunc) ChemGraphPntrsFree);
607    AsnGenericChoiceSeqOfFree(ptr -> domain, (AsnOptFreeFunc) ChemGraphPntrsFree);
608    AsnGenericUserSeqOfFree(ptr -> transform, (AsnOptFreeFunc) TransformFree);
609    AsnGenericUserSeqOfFree(ptr -> aligndata, (AsnOptFreeFunc) AlignStatsFree);
610    return MemFree(ptr);
611 }
612 
613 
614 /**************************************************
615 *
616 *    ChemGraphAlignmentAsnRead()
617 *
618 **************************************************/
619 NLM_EXTERN
620 ChemGraphAlignmentPtr LIBCALL
ChemGraphAlignmentAsnRead(AsnIoPtr aip,AsnTypePtr orig)621 ChemGraphAlignmentAsnRead(AsnIoPtr aip, AsnTypePtr orig)
622 {
623    DataVal av;
624    AsnTypePtr atp;
625    Boolean isError = FALSE;
626    AsnReadFunc func;
627    ChemGraphAlignmentPtr ptr;
628 
629    if (! loaded)
630    {
631       if (! objmmdb3AsnLoad()) {
632          return NULL;
633       }
634    }
635 
636    if (aip == NULL) {
637       return NULL;
638    }
639 
640    if (orig == NULL) {         /* ChemGraphAlignment ::= (self contained) */
641       atp = AsnReadId(aip, amp, CHEM_GRAPH_ALIGNMENT);
642    } else {
643       atp = AsnLinkType(orig, CHEM_GRAPH_ALIGNMENT);
644    }
645    /* link in local tree */
646    if (atp == NULL) {
647       return NULL;
648    }
649 
650    ptr = ChemGraphAlignmentNew();
651    if (ptr == NULL) {
652       goto erret;
653    }
654    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
655       goto erret;
656    }
657 
658    atp = AsnReadId(aip,amp, atp);
659    func = NULL;
660 
661    if (atp == CHEM_GRAPH_ALIGNMENT_dimension) {
662       if ( AsnReadVal(aip, atp, &av) <= 0) {
663          goto erret;
664       }
665       ptr -> dimension = av.intvalue;
666       atp = AsnReadId(aip,amp, atp);
667    }
668    if (atp == CHEM_GRAPH_ALIGNMENT_biostruc_ids) {
669       ptr -> biostruc_ids = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucIdAsnRead, (AsnOptFreeFunc) BiostrucIdFree);
670       if (isError && ptr -> biostruc_ids == NULL) {
671          goto erret;
672       }
673       atp = AsnReadId(aip,amp, atp);
674    }
675    if (atp == CHEM_GRAPH_ALIGNMENT_alignment) {
676       ptr -> alignment = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ChemGraphPntrsAsnRead, (AsnOptFreeFunc) ChemGraphPntrsFree);
677       if (isError && ptr -> alignment == NULL) {
678          goto erret;
679       }
680       atp = AsnReadId(aip,amp, atp);
681    }
682    if (atp == CHEM_GRAPH_ALIGNMENT_domain) {
683       ptr -> domain = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ChemGraphPntrsAsnRead, (AsnOptFreeFunc) ChemGraphPntrsFree);
684       if (isError && ptr -> domain == NULL) {
685          goto erret;
686       }
687       atp = AsnReadId(aip,amp, atp);
688    }
689    if (atp == CHEM_GRAPH_ALIGNMENT_transform) {
690       ptr -> transform = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) TransformAsnRead, (AsnOptFreeFunc) TransformFree);
691       if (isError && ptr -> transform == NULL) {
692          goto erret;
693       }
694       atp = AsnReadId(aip,amp, atp);
695    }
696    if (atp == CHEM_GRAPH_ALIGNMENT_aligndata) {
697       ptr -> aligndata = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) AlignStatsAsnRead, (AsnOptFreeFunc) AlignStatsFree);
698       if (isError && ptr -> aligndata == NULL) {
699          goto erret;
700       }
701       atp = AsnReadId(aip,amp, atp);
702    }
703 
704    if (AsnReadVal(aip, atp, &av) <= 0) {
705       goto erret;
706    }
707    /* end struct */
708 
709 ret:
710    AsnUnlinkType(orig);       /* unlink local tree */
711    return ptr;
712 
713 erret:
714    aip -> io_failure = TRUE;
715    ptr = ChemGraphAlignmentFree(ptr);
716    goto ret;
717 }
718 
719 
720 
721 /**************************************************
722 *
723 *    ChemGraphAlignmentAsnWrite()
724 *
725 **************************************************/
726 NLM_EXTERN Boolean LIBCALL
ChemGraphAlignmentAsnWrite(ChemGraphAlignmentPtr ptr,AsnIoPtr aip,AsnTypePtr orig)727 ChemGraphAlignmentAsnWrite(ChemGraphAlignmentPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
728 {
729    DataVal av;
730    AsnTypePtr atp;
731    Boolean retval = FALSE;
732 
733    if (! loaded)
734    {
735       if (! objmmdb3AsnLoad()) {
736          return FALSE;
737       }
738    }
739 
740    if (aip == NULL) {
741       return FALSE;
742    }
743 
744    atp = AsnLinkType(orig, CHEM_GRAPH_ALIGNMENT);   /* link local tree */
745    if (atp == NULL) {
746       return FALSE;
747    }
748 
749    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
750    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
751    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
752       goto erret;
753    }
754 
755    av.intvalue = ptr -> dimension;
756    retval = AsnWrite(aip, CHEM_GRAPH_ALIGNMENT_dimension,  &av);
757    AsnGenericChoiceSeqOfAsnWrite(ptr -> biostruc_ids, (AsnWriteFunc) BiostrucIdAsnWrite, aip, CHEM_GRAPH_ALIGNMENT_biostruc_ids, CHEM_GRAPH_ALIGNMENT_biostruc_ids_E);
758    AsnGenericChoiceSeqOfAsnWrite(ptr -> alignment, (AsnWriteFunc) ChemGraphPntrsAsnWrite, aip, CHEM_GRAPH_ALIGNMENT_alignment, CHEM_GRAPH_ALIGNMENT_alignment_E);
759    AsnGenericChoiceSeqOfAsnWrite(ptr -> domain, (AsnWriteFunc) ChemGraphPntrsAsnWrite, aip, CHEM_GRAPH_ALIGNMENT_domain, CHEM_GRAPH_ALIGNMENT_domain_E);
760    AsnGenericUserSeqOfAsnWrite(ptr -> transform, (AsnWriteFunc) TransformAsnWrite, aip, CHEM_GRAPH_ALIGNMENT_transform, CHEM_GRAPH_ALIGNMENT_transform_E);
761    AsnGenericUserSeqOfAsnWrite(ptr -> aligndata, (AsnWriteFunc) AlignStatsAsnWrite, aip, CHEM_GRAPH_ALIGNMENT_aligndata, CHEM_GRAPH_ALIGNMENT_aligndata_E);
762    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
763       goto erret;
764    }
765    retval = TRUE;
766 
767 erret:
768    AsnUnlinkType(orig);       /* unlink local tree */
769    return retval;
770 }
771 
772 
773 
774 /**************************************************
775 *
776 *    ChemGraphInteractionNew()
777 *
778 **************************************************/
779 NLM_EXTERN
780 ChemGraphInteractionPtr LIBCALL
ChemGraphInteractionNew(void)781 ChemGraphInteractionNew(void)
782 {
783    ChemGraphInteractionPtr ptr = MemNew((size_t) sizeof(ChemGraphInteraction));
784 
785    return ptr;
786 
787 }
788 
789 
790 /**************************************************
791 *
792 *    ChemGraphInteractionFree()
793 *
794 **************************************************/
795 NLM_EXTERN
796 ChemGraphInteractionPtr LIBCALL
ChemGraphInteractionFree(ChemGraphInteractionPtr ptr)797 ChemGraphInteractionFree(ChemGraphInteractionPtr ptr)
798 {
799 
800    if(ptr == NULL) {
801       return NULL;
802    }
803    RealValueFree(ptr -> distance_threshold);
804    AsnGenericUserSeqOfFree(ptr -> interactors, (AsnOptFreeFunc) BiostrucMoleculePntrFree);
805    AsnGenericChoiceSeqOfFree(ptr -> residue_contacts, (AsnOptFreeFunc) ChemGraphPntrsFree);
806    AsnGenericChoiceSeqOfFree(ptr -> atom_contacts, (AsnOptFreeFunc) ChemGraphPntrsFree);
807    AsnGenericUserSeqOfFree(ptr -> atom_distance, (AsnOptFreeFunc) RealValueFree);
808    return MemFree(ptr);
809 }
810 
811 
812 /**************************************************
813 *
814 *    ChemGraphInteractionAsnRead()
815 *
816 **************************************************/
817 NLM_EXTERN
818 ChemGraphInteractionPtr LIBCALL
ChemGraphInteractionAsnRead(AsnIoPtr aip,AsnTypePtr orig)819 ChemGraphInteractionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
820 {
821    DataVal av;
822    AsnTypePtr atp;
823    Boolean isError = FALSE;
824    AsnReadFunc func;
825    ChemGraphInteractionPtr ptr;
826 
827    if (! loaded)
828    {
829       if (! objmmdb3AsnLoad()) {
830          return NULL;
831       }
832    }
833 
834    if (aip == NULL) {
835       return NULL;
836    }
837 
838    if (orig == NULL) {         /* ChemGraphInteraction ::= (self contained) */
839       atp = AsnReadId(aip, amp, CHEM_GRAPH_INTERACTION);
840    } else {
841       atp = AsnLinkType(orig, CHEM_GRAPH_INTERACTION);
842    }
843    /* link in local tree */
844    if (atp == NULL) {
845       return NULL;
846    }
847 
848    ptr = ChemGraphInteractionNew();
849    if (ptr == NULL) {
850       goto erret;
851    }
852    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
853       goto erret;
854    }
855 
856    atp = AsnReadId(aip,amp, atp);
857    func = NULL;
858 
859    if (atp == CHEM_GRAPH_INTERACTION_type) {
860       if ( AsnReadVal(aip, atp, &av) <= 0) {
861          goto erret;
862       }
863       ptr -> type = av.intvalue;
864       ptr -> OBbits__ |= 1<<0;
865       atp = AsnReadId(aip,amp, atp);
866    }
867    if (atp == CHEM_GRAPH_INTERACTION_distance_threshold) {
868       ptr -> distance_threshold = RealValueAsnRead(aip, atp);
869       if (aip -> io_failure) {
870          goto erret;
871       }
872       atp = AsnReadId(aip,amp, atp);
873    }
874    if (atp == CHEM_GRAPH_INTERACTION_interactors) {
875       ptr -> interactors = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucMoleculePntrAsnRead, (AsnOptFreeFunc) BiostrucMoleculePntrFree);
876       if (isError && ptr -> interactors == NULL) {
877          goto erret;
878       }
879       atp = AsnReadId(aip,amp, atp);
880    }
881    if (atp == CHEM_GRAPH_INTERACTION_residue_contacts) {
882       ptr -> residue_contacts = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ChemGraphPntrsAsnRead, (AsnOptFreeFunc) ChemGraphPntrsFree);
883       if (isError && ptr -> residue_contacts == NULL) {
884          goto erret;
885       }
886       atp = AsnReadId(aip,amp, atp);
887    }
888    if (atp == CHEM_GRAPH_INTERACTION_atom_contacts) {
889       ptr -> atom_contacts = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ChemGraphPntrsAsnRead, (AsnOptFreeFunc) ChemGraphPntrsFree);
890       if (isError && ptr -> atom_contacts == NULL) {
891          goto erret;
892       }
893       atp = AsnReadId(aip,amp, atp);
894    }
895    if (atp == CHEM_GRAPH_INTERACTION_atom_distance) {
896       ptr -> atom_distance = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) RealValueAsnRead, (AsnOptFreeFunc) RealValueFree);
897       if (isError && ptr -> atom_distance == NULL) {
898          goto erret;
899       }
900       atp = AsnReadId(aip,amp, atp);
901    }
902 
903    if (AsnReadVal(aip, atp, &av) <= 0) {
904       goto erret;
905    }
906    /* end struct */
907 
908 ret:
909    AsnUnlinkType(orig);       /* unlink local tree */
910    return ptr;
911 
912 erret:
913    aip -> io_failure = TRUE;
914    ptr = ChemGraphInteractionFree(ptr);
915    goto ret;
916 }
917 
918 
919 
920 /**************************************************
921 *
922 *    ChemGraphInteractionAsnWrite()
923 *
924 **************************************************/
925 NLM_EXTERN Boolean LIBCALL
ChemGraphInteractionAsnWrite(ChemGraphInteractionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)926 ChemGraphInteractionAsnWrite(ChemGraphInteractionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
927 {
928    DataVal av;
929    AsnTypePtr atp;
930    Boolean retval = FALSE;
931 
932    if (! loaded)
933    {
934       if (! objmmdb3AsnLoad()) {
935          return FALSE;
936       }
937    }
938 
939    if (aip == NULL) {
940       return FALSE;
941    }
942 
943    atp = AsnLinkType(orig, CHEM_GRAPH_INTERACTION);   /* link local tree */
944    if (atp == NULL) {
945       return FALSE;
946    }
947 
948    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
949    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
950    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
951       goto erret;
952    }
953 
954    if (ptr -> type || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> type;
955       retval = AsnWrite(aip, CHEM_GRAPH_INTERACTION_type,  &av);
956    }
957    if (ptr -> distance_threshold != NULL) {
958       if ( ! RealValueAsnWrite(ptr -> distance_threshold, aip, CHEM_GRAPH_INTERACTION_distance_threshold)) {
959          goto erret;
960       }
961    }
962    AsnGenericUserSeqOfAsnWrite(ptr -> interactors, (AsnWriteFunc) BiostrucMoleculePntrAsnWrite, aip, CHEM_GRAPH_INTERACTION_interactors, CHEM_GRAPH_INTERACTION_interactors_E);
963    AsnGenericChoiceSeqOfAsnWrite(ptr -> residue_contacts, (AsnWriteFunc) ChemGraphPntrsAsnWrite, aip, CHEM_GRAPH_INTERACTION_residue_contacts, CHEM_GRAPH_INTERACTION_residue_contacts_E);
964    AsnGenericChoiceSeqOfAsnWrite(ptr -> atom_contacts, (AsnWriteFunc) ChemGraphPntrsAsnWrite, aip, CHEM_GRAPH_INTERACTION_atom_contacts, CHEM_GRAPH_INTERACTION_atom_contacts_E);
965    AsnGenericUserSeqOfAsnWrite(ptr -> atom_distance, (AsnWriteFunc) RealValueAsnWrite, aip, CHEM_GRAPH_INTERACTION_atom_distance, CHEM_GRAPH_INTERACTION_atom_distance_E);
966    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
967       goto erret;
968    }
969    retval = TRUE;
970 
971 erret:
972    AsnUnlinkType(orig);       /* unlink local tree */
973    return retval;
974 }
975 
976 
977 
978 /**************************************************
979 *
980 *    SphereNew()
981 *
982 **************************************************/
983 NLM_EXTERN
984 SpherePtr LIBCALL
SphereNew(void)985 SphereNew(void)
986 {
987    SpherePtr ptr = MemNew((size_t) sizeof(Sphere));
988 
989    return ptr;
990 
991 }
992 
993 
994 /**************************************************
995 *
996 *    SphereFree()
997 *
998 **************************************************/
999 NLM_EXTERN
1000 SpherePtr LIBCALL
SphereFree(SpherePtr ptr)1001 SphereFree(SpherePtr ptr)
1002 {
1003 
1004    if(ptr == NULL) {
1005       return NULL;
1006    }
1007    ModelSpacePointFree(ptr -> center);
1008    RealValueFree(ptr -> radius);
1009    return MemFree(ptr);
1010 }
1011 
1012 
1013 /**************************************************
1014 *
1015 *    SphereAsnRead()
1016 *
1017 **************************************************/
1018 NLM_EXTERN
1019 SpherePtr LIBCALL
SphereAsnRead(AsnIoPtr aip,AsnTypePtr orig)1020 SphereAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1021 {
1022    DataVal av;
1023    AsnTypePtr atp;
1024    AsnReadFunc func;
1025    SpherePtr ptr;
1026 
1027    if (! loaded)
1028    {
1029       if (! objmmdb3AsnLoad()) {
1030          return NULL;
1031       }
1032    }
1033 
1034    if (aip == NULL) {
1035       return NULL;
1036    }
1037 
1038    if (orig == NULL) {         /* Sphere ::= (self contained) */
1039       atp = AsnReadId(aip, amp, SPHERE);
1040    } else {
1041       atp = AsnLinkType(orig, SPHERE);
1042    }
1043    /* link in local tree */
1044    if (atp == NULL) {
1045       return NULL;
1046    }
1047 
1048    ptr = SphereNew();
1049    if (ptr == NULL) {
1050       goto erret;
1051    }
1052    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1053       goto erret;
1054    }
1055 
1056    atp = AsnReadId(aip,amp, atp);
1057    func = NULL;
1058 
1059    if (atp == SPHERE_center) {
1060       ptr -> center = ModelSpacePointAsnRead(aip, atp);
1061       if (aip -> io_failure) {
1062          goto erret;
1063       }
1064       atp = AsnReadId(aip,amp, atp);
1065    }
1066    if (atp == SPHERE_radius) {
1067       ptr -> radius = RealValueAsnRead(aip, atp);
1068       if (aip -> io_failure) {
1069          goto erret;
1070       }
1071       atp = AsnReadId(aip,amp, atp);
1072    }
1073 
1074    if (AsnReadVal(aip, atp, &av) <= 0) {
1075       goto erret;
1076    }
1077    /* end struct */
1078 
1079 ret:
1080    AsnUnlinkType(orig);       /* unlink local tree */
1081    return ptr;
1082 
1083 erret:
1084    aip -> io_failure = TRUE;
1085    ptr = SphereFree(ptr);
1086    goto ret;
1087 }
1088 
1089 
1090 
1091 /**************************************************
1092 *
1093 *    SphereAsnWrite()
1094 *
1095 **************************************************/
1096 NLM_EXTERN Boolean LIBCALL
SphereAsnWrite(SpherePtr ptr,AsnIoPtr aip,AsnTypePtr orig)1097 SphereAsnWrite(SpherePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1098 {
1099    AsnTypePtr atp;
1100    Boolean retval = FALSE;
1101 
1102    if (! loaded)
1103    {
1104       if (! objmmdb3AsnLoad()) {
1105          return FALSE;
1106       }
1107    }
1108 
1109    if (aip == NULL) {
1110       return FALSE;
1111    }
1112 
1113    atp = AsnLinkType(orig, SPHERE);   /* link local tree */
1114    if (atp == NULL) {
1115       return FALSE;
1116    }
1117 
1118    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1119    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1120       goto erret;
1121    }
1122 
1123    if (ptr -> center != NULL) {
1124       if ( ! ModelSpacePointAsnWrite(ptr -> center, aip, SPHERE_center)) {
1125          goto erret;
1126       }
1127    }
1128    if (ptr -> radius != NULL) {
1129       if ( ! RealValueAsnWrite(ptr -> radius, aip, SPHERE_radius)) {
1130          goto erret;
1131       }
1132    }
1133    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1134       goto erret;
1135    }
1136    retval = TRUE;
1137 
1138 erret:
1139    AsnUnlinkType(orig);       /* unlink local tree */
1140    return retval;
1141 }
1142 
1143 
1144 
1145 /**************************************************
1146 *
1147 *    ConeNew()
1148 *
1149 **************************************************/
1150 NLM_EXTERN
1151 ConePtr LIBCALL
ConeNew(void)1152 ConeNew(void)
1153 {
1154    ConePtr ptr = MemNew((size_t) sizeof(Cone));
1155 
1156    return ptr;
1157 
1158 }
1159 
1160 
1161 /**************************************************
1162 *
1163 *    ConeFree()
1164 *
1165 **************************************************/
1166 NLM_EXTERN
1167 ConePtr LIBCALL
ConeFree(ConePtr ptr)1168 ConeFree(ConePtr ptr)
1169 {
1170 
1171    if(ptr == NULL) {
1172       return NULL;
1173    }
1174    ModelSpacePointFree(ptr -> axis_top);
1175    ModelSpacePointFree(ptr -> axis_bottom);
1176    RealValueFree(ptr -> radius_bottom);
1177    return MemFree(ptr);
1178 }
1179 
1180 
1181 /**************************************************
1182 *
1183 *    ConeAsnRead()
1184 *
1185 **************************************************/
1186 NLM_EXTERN
1187 ConePtr LIBCALL
ConeAsnRead(AsnIoPtr aip,AsnTypePtr orig)1188 ConeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1189 {
1190    DataVal av;
1191    AsnTypePtr atp;
1192    AsnReadFunc func;
1193    ConePtr ptr;
1194 
1195    if (! loaded)
1196    {
1197       if (! objmmdb3AsnLoad()) {
1198          return NULL;
1199       }
1200    }
1201 
1202    if (aip == NULL) {
1203       return NULL;
1204    }
1205 
1206    if (orig == NULL) {         /* Cone ::= (self contained) */
1207       atp = AsnReadId(aip, amp, CONE);
1208    } else {
1209       atp = AsnLinkType(orig, CONE);
1210    }
1211    /* link in local tree */
1212    if (atp == NULL) {
1213       return NULL;
1214    }
1215 
1216    ptr = ConeNew();
1217    if (ptr == NULL) {
1218       goto erret;
1219    }
1220    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1221       goto erret;
1222    }
1223 
1224    atp = AsnReadId(aip,amp, atp);
1225    func = NULL;
1226 
1227    if (atp == CONE_axis_top) {
1228       ptr -> axis_top = ModelSpacePointAsnRead(aip, atp);
1229       if (aip -> io_failure) {
1230          goto erret;
1231       }
1232       atp = AsnReadId(aip,amp, atp);
1233    }
1234    if (atp == CONE_axis_bottom) {
1235       ptr -> axis_bottom = ModelSpacePointAsnRead(aip, atp);
1236       if (aip -> io_failure) {
1237          goto erret;
1238       }
1239       atp = AsnReadId(aip,amp, atp);
1240    }
1241    if (atp == CONE_radius_bottom) {
1242       ptr -> radius_bottom = RealValueAsnRead(aip, atp);
1243       if (aip -> io_failure) {
1244          goto erret;
1245       }
1246       atp = AsnReadId(aip,amp, atp);
1247    }
1248 
1249    if (AsnReadVal(aip, atp, &av) <= 0) {
1250       goto erret;
1251    }
1252    /* end struct */
1253 
1254 ret:
1255    AsnUnlinkType(orig);       /* unlink local tree */
1256    return ptr;
1257 
1258 erret:
1259    aip -> io_failure = TRUE;
1260    ptr = ConeFree(ptr);
1261    goto ret;
1262 }
1263 
1264 
1265 
1266 /**************************************************
1267 *
1268 *    ConeAsnWrite()
1269 *
1270 **************************************************/
1271 NLM_EXTERN Boolean LIBCALL
ConeAsnWrite(ConePtr ptr,AsnIoPtr aip,AsnTypePtr orig)1272 ConeAsnWrite(ConePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1273 {
1274    AsnTypePtr atp;
1275    Boolean retval = FALSE;
1276 
1277    if (! loaded)
1278    {
1279       if (! objmmdb3AsnLoad()) {
1280          return FALSE;
1281       }
1282    }
1283 
1284    if (aip == NULL) {
1285       return FALSE;
1286    }
1287 
1288    atp = AsnLinkType(orig, CONE);   /* link local tree */
1289    if (atp == NULL) {
1290       return FALSE;
1291    }
1292 
1293    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1294    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1295       goto erret;
1296    }
1297 
1298    if (ptr -> axis_top != NULL) {
1299       if ( ! ModelSpacePointAsnWrite(ptr -> axis_top, aip, CONE_axis_top)) {
1300          goto erret;
1301       }
1302    }
1303    if (ptr -> axis_bottom != NULL) {
1304       if ( ! ModelSpacePointAsnWrite(ptr -> axis_bottom, aip, CONE_axis_bottom)) {
1305          goto erret;
1306       }
1307    }
1308    if (ptr -> radius_bottom != NULL) {
1309       if ( ! RealValueAsnWrite(ptr -> radius_bottom, aip, CONE_radius_bottom)) {
1310          goto erret;
1311       }
1312    }
1313    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1314       goto erret;
1315    }
1316    retval = TRUE;
1317 
1318 erret:
1319    AsnUnlinkType(orig);       /* unlink local tree */
1320    return retval;
1321 }
1322 
1323 
1324 
1325 /**************************************************
1326 *
1327 *    CylinderNew()
1328 *
1329 **************************************************/
1330 NLM_EXTERN
1331 CylinderPtr LIBCALL
CylinderNew(void)1332 CylinderNew(void)
1333 {
1334    CylinderPtr ptr = MemNew((size_t) sizeof(Cylinder));
1335 
1336    return ptr;
1337 
1338 }
1339 
1340 
1341 /**************************************************
1342 *
1343 *    CylinderFree()
1344 *
1345 **************************************************/
1346 NLM_EXTERN
1347 CylinderPtr LIBCALL
CylinderFree(CylinderPtr ptr)1348 CylinderFree(CylinderPtr ptr)
1349 {
1350 
1351    if(ptr == NULL) {
1352       return NULL;
1353    }
1354    ModelSpacePointFree(ptr -> axis_top);
1355    ModelSpacePointFree(ptr -> axis_bottom);
1356    RealValueFree(ptr -> radius);
1357    return MemFree(ptr);
1358 }
1359 
1360 
1361 /**************************************************
1362 *
1363 *    CylinderAsnRead()
1364 *
1365 **************************************************/
1366 NLM_EXTERN
1367 CylinderPtr LIBCALL
CylinderAsnRead(AsnIoPtr aip,AsnTypePtr orig)1368 CylinderAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1369 {
1370    DataVal av;
1371    AsnTypePtr atp;
1372    AsnReadFunc func;
1373    CylinderPtr ptr;
1374 
1375    if (! loaded)
1376    {
1377       if (! objmmdb3AsnLoad()) {
1378          return NULL;
1379       }
1380    }
1381 
1382    if (aip == NULL) {
1383       return NULL;
1384    }
1385 
1386    if (orig == NULL) {         /* Cylinder ::= (self contained) */
1387       atp = AsnReadId(aip, amp, CYLINDER);
1388    } else {
1389       atp = AsnLinkType(orig, CYLINDER);
1390    }
1391    /* link in local tree */
1392    if (atp == NULL) {
1393       return NULL;
1394    }
1395 
1396    ptr = CylinderNew();
1397    if (ptr == NULL) {
1398       goto erret;
1399    }
1400    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1401       goto erret;
1402    }
1403 
1404    atp = AsnReadId(aip,amp, atp);
1405    func = NULL;
1406 
1407    if (atp == CYLINDER_axis_top) {
1408       ptr -> axis_top = ModelSpacePointAsnRead(aip, atp);
1409       if (aip -> io_failure) {
1410          goto erret;
1411       }
1412       atp = AsnReadId(aip,amp, atp);
1413    }
1414    if (atp == CYLINDER_axis_bottom) {
1415       ptr -> axis_bottom = ModelSpacePointAsnRead(aip, atp);
1416       if (aip -> io_failure) {
1417          goto erret;
1418       }
1419       atp = AsnReadId(aip,amp, atp);
1420    }
1421    if (atp == CYLINDER_radius) {
1422       ptr -> radius = RealValueAsnRead(aip, atp);
1423       if (aip -> io_failure) {
1424          goto erret;
1425       }
1426       atp = AsnReadId(aip,amp, atp);
1427    }
1428 
1429    if (AsnReadVal(aip, atp, &av) <= 0) {
1430       goto erret;
1431    }
1432    /* end struct */
1433 
1434 ret:
1435    AsnUnlinkType(orig);       /* unlink local tree */
1436    return ptr;
1437 
1438 erret:
1439    aip -> io_failure = TRUE;
1440    ptr = CylinderFree(ptr);
1441    goto ret;
1442 }
1443 
1444 
1445 
1446 /**************************************************
1447 *
1448 *    CylinderAsnWrite()
1449 *
1450 **************************************************/
1451 NLM_EXTERN Boolean LIBCALL
CylinderAsnWrite(CylinderPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1452 CylinderAsnWrite(CylinderPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1453 {
1454    AsnTypePtr atp;
1455    Boolean retval = FALSE;
1456 
1457    if (! loaded)
1458    {
1459       if (! objmmdb3AsnLoad()) {
1460          return FALSE;
1461       }
1462    }
1463 
1464    if (aip == NULL) {
1465       return FALSE;
1466    }
1467 
1468    atp = AsnLinkType(orig, CYLINDER);   /* link local tree */
1469    if (atp == NULL) {
1470       return FALSE;
1471    }
1472 
1473    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1474    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1475       goto erret;
1476    }
1477 
1478    if (ptr -> axis_top != NULL) {
1479       if ( ! ModelSpacePointAsnWrite(ptr -> axis_top, aip, CYLINDER_axis_top)) {
1480          goto erret;
1481       }
1482    }
1483    if (ptr -> axis_bottom != NULL) {
1484       if ( ! ModelSpacePointAsnWrite(ptr -> axis_bottom, aip, CYLINDER_axis_bottom)) {
1485          goto erret;
1486       }
1487    }
1488    if (ptr -> radius != NULL) {
1489       if ( ! RealValueAsnWrite(ptr -> radius, aip, CYLINDER_radius)) {
1490          goto erret;
1491       }
1492    }
1493    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1494       goto erret;
1495    }
1496    retval = TRUE;
1497 
1498 erret:
1499    AsnUnlinkType(orig);       /* unlink local tree */
1500    return retval;
1501 }
1502 
1503 
1504 
1505 /**************************************************
1506 *
1507 *    BrickNew()
1508 *
1509 **************************************************/
1510 NLM_EXTERN
1511 BrickPtr LIBCALL
BrickNew(void)1512 BrickNew(void)
1513 {
1514    BrickPtr ptr = MemNew((size_t) sizeof(Brick));
1515 
1516    return ptr;
1517 
1518 }
1519 
1520 
1521 /**************************************************
1522 *
1523 *    BrickFree()
1524 *
1525 **************************************************/
1526 NLM_EXTERN
1527 BrickPtr LIBCALL
BrickFree(BrickPtr ptr)1528 BrickFree(BrickPtr ptr)
1529 {
1530 
1531    if(ptr == NULL) {
1532       return NULL;
1533    }
1534    ModelSpacePointFree(ptr -> corner_000);
1535    ModelSpacePointFree(ptr -> corner_001);
1536    ModelSpacePointFree(ptr -> corner_010);
1537    ModelSpacePointFree(ptr -> corner_011);
1538    ModelSpacePointFree(ptr -> corner_100);
1539    ModelSpacePointFree(ptr -> corner_101);
1540    ModelSpacePointFree(ptr -> corner_110);
1541    ModelSpacePointFree(ptr -> corner_111);
1542    return MemFree(ptr);
1543 }
1544 
1545 
1546 /**************************************************
1547 *
1548 *    BrickAsnRead()
1549 *
1550 **************************************************/
1551 NLM_EXTERN
1552 BrickPtr LIBCALL
BrickAsnRead(AsnIoPtr aip,AsnTypePtr orig)1553 BrickAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1554 {
1555    DataVal av;
1556    AsnTypePtr atp;
1557    AsnReadFunc func;
1558    BrickPtr ptr;
1559 
1560    if (! loaded)
1561    {
1562       if (! objmmdb3AsnLoad()) {
1563          return NULL;
1564       }
1565    }
1566 
1567    if (aip == NULL) {
1568       return NULL;
1569    }
1570 
1571    if (orig == NULL) {         /* Brick ::= (self contained) */
1572       atp = AsnReadId(aip, amp, BRICK);
1573    } else {
1574       atp = AsnLinkType(orig, BRICK);
1575    }
1576    /* link in local tree */
1577    if (atp == NULL) {
1578       return NULL;
1579    }
1580 
1581    ptr = BrickNew();
1582    if (ptr == NULL) {
1583       goto erret;
1584    }
1585    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1586       goto erret;
1587    }
1588 
1589    atp = AsnReadId(aip,amp, atp);
1590    func = NULL;
1591 
1592    if (atp == BRICK_corner_000) {
1593       ptr -> corner_000 = ModelSpacePointAsnRead(aip, atp);
1594       if (aip -> io_failure) {
1595          goto erret;
1596       }
1597       atp = AsnReadId(aip,amp, atp);
1598    }
1599    if (atp == BRICK_corner_001) {
1600       ptr -> corner_001 = ModelSpacePointAsnRead(aip, atp);
1601       if (aip -> io_failure) {
1602          goto erret;
1603       }
1604       atp = AsnReadId(aip,amp, atp);
1605    }
1606    if (atp == BRICK_corner_010) {
1607       ptr -> corner_010 = ModelSpacePointAsnRead(aip, atp);
1608       if (aip -> io_failure) {
1609          goto erret;
1610       }
1611       atp = AsnReadId(aip,amp, atp);
1612    }
1613    if (atp == BRICK_corner_011) {
1614       ptr -> corner_011 = ModelSpacePointAsnRead(aip, atp);
1615       if (aip -> io_failure) {
1616          goto erret;
1617       }
1618       atp = AsnReadId(aip,amp, atp);
1619    }
1620    if (atp == BRICK_corner_100) {
1621       ptr -> corner_100 = ModelSpacePointAsnRead(aip, atp);
1622       if (aip -> io_failure) {
1623          goto erret;
1624       }
1625       atp = AsnReadId(aip,amp, atp);
1626    }
1627    if (atp == BRICK_corner_101) {
1628       ptr -> corner_101 = ModelSpacePointAsnRead(aip, atp);
1629       if (aip -> io_failure) {
1630          goto erret;
1631       }
1632       atp = AsnReadId(aip,amp, atp);
1633    }
1634    if (atp == BRICK_corner_110) {
1635       ptr -> corner_110 = ModelSpacePointAsnRead(aip, atp);
1636       if (aip -> io_failure) {
1637          goto erret;
1638       }
1639       atp = AsnReadId(aip,amp, atp);
1640    }
1641    if (atp == BRICK_corner_111) {
1642       ptr -> corner_111 = ModelSpacePointAsnRead(aip, atp);
1643       if (aip -> io_failure) {
1644          goto erret;
1645       }
1646       atp = AsnReadId(aip,amp, atp);
1647    }
1648 
1649    if (AsnReadVal(aip, atp, &av) <= 0) {
1650       goto erret;
1651    }
1652    /* end struct */
1653 
1654 ret:
1655    AsnUnlinkType(orig);       /* unlink local tree */
1656    return ptr;
1657 
1658 erret:
1659    aip -> io_failure = TRUE;
1660    ptr = BrickFree(ptr);
1661    goto ret;
1662 }
1663 
1664 
1665 
1666 /**************************************************
1667 *
1668 *    BrickAsnWrite()
1669 *
1670 **************************************************/
1671 NLM_EXTERN Boolean LIBCALL
BrickAsnWrite(BrickPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1672 BrickAsnWrite(BrickPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1673 {
1674    AsnTypePtr atp;
1675    Boolean retval = FALSE;
1676 
1677    if (! loaded)
1678    {
1679       if (! objmmdb3AsnLoad()) {
1680          return FALSE;
1681       }
1682    }
1683 
1684    if (aip == NULL) {
1685       return FALSE;
1686    }
1687 
1688    atp = AsnLinkType(orig, BRICK);   /* link local tree */
1689    if (atp == NULL) {
1690       return FALSE;
1691    }
1692 
1693    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1694    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1695       goto erret;
1696    }
1697 
1698    if (ptr -> corner_000 != NULL) {
1699       if ( ! ModelSpacePointAsnWrite(ptr -> corner_000, aip, BRICK_corner_000)) {
1700          goto erret;
1701       }
1702    }
1703    if (ptr -> corner_001 != NULL) {
1704       if ( ! ModelSpacePointAsnWrite(ptr -> corner_001, aip, BRICK_corner_001)) {
1705          goto erret;
1706       }
1707    }
1708    if (ptr -> corner_010 != NULL) {
1709       if ( ! ModelSpacePointAsnWrite(ptr -> corner_010, aip, BRICK_corner_010)) {
1710          goto erret;
1711       }
1712    }
1713    if (ptr -> corner_011 != NULL) {
1714       if ( ! ModelSpacePointAsnWrite(ptr -> corner_011, aip, BRICK_corner_011)) {
1715          goto erret;
1716       }
1717    }
1718    if (ptr -> corner_100 != NULL) {
1719       if ( ! ModelSpacePointAsnWrite(ptr -> corner_100, aip, BRICK_corner_100)) {
1720          goto erret;
1721       }
1722    }
1723    if (ptr -> corner_101 != NULL) {
1724       if ( ! ModelSpacePointAsnWrite(ptr -> corner_101, aip, BRICK_corner_101)) {
1725          goto erret;
1726       }
1727    }
1728    if (ptr -> corner_110 != NULL) {
1729       if ( ! ModelSpacePointAsnWrite(ptr -> corner_110, aip, BRICK_corner_110)) {
1730          goto erret;
1731       }
1732    }
1733    if (ptr -> corner_111 != NULL) {
1734       if ( ! ModelSpacePointAsnWrite(ptr -> corner_111, aip, BRICK_corner_111)) {
1735          goto erret;
1736       }
1737    }
1738    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1739       goto erret;
1740    }
1741    retval = TRUE;
1742 
1743 erret:
1744    AsnUnlinkType(orig);       /* unlink local tree */
1745    return retval;
1746 }
1747 
1748 
1749 
1750 /**************************************************
1751 *
1752 *    TransformNew()
1753 *
1754 **************************************************/
1755 NLM_EXTERN
1756 TransformPtr LIBCALL
TransformNew(void)1757 TransformNew(void)
1758 {
1759    TransformPtr ptr = MemNew((size_t) sizeof(Transform));
1760 
1761    return ptr;
1762 
1763 }
1764 
1765 
1766 /**************************************************
1767 *
1768 *    TransformFree()
1769 *
1770 **************************************************/
1771 NLM_EXTERN
1772 TransformPtr LIBCALL
TransformFree(TransformPtr ptr)1773 TransformFree(TransformPtr ptr)
1774 {
1775 
1776    if(ptr == NULL) {
1777       return NULL;
1778    }
1779    AsnGenericChoiceSeqOfFree(ptr -> moves, (AsnOptFreeFunc) MoveFree);
1780    return MemFree(ptr);
1781 }
1782 
1783 
1784 /**************************************************
1785 *
1786 *    TransformAsnRead()
1787 *
1788 **************************************************/
1789 NLM_EXTERN
1790 TransformPtr LIBCALL
TransformAsnRead(AsnIoPtr aip,AsnTypePtr orig)1791 TransformAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1792 {
1793    DataVal av;
1794    AsnTypePtr atp;
1795    Boolean isError = FALSE;
1796    AsnReadFunc func;
1797    TransformPtr ptr;
1798 
1799    if (! loaded)
1800    {
1801       if (! objmmdb3AsnLoad()) {
1802          return NULL;
1803       }
1804    }
1805 
1806    if (aip == NULL) {
1807       return NULL;
1808    }
1809 
1810    if (orig == NULL) {         /* Transform ::= (self contained) */
1811       atp = AsnReadId(aip, amp, TRANSFORM);
1812    } else {
1813       atp = AsnLinkType(orig, TRANSFORM);
1814    }
1815    /* link in local tree */
1816    if (atp == NULL) {
1817       return NULL;
1818    }
1819 
1820    ptr = TransformNew();
1821    if (ptr == NULL) {
1822       goto erret;
1823    }
1824    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1825       goto erret;
1826    }
1827 
1828    atp = AsnReadId(aip,amp, atp);
1829    func = NULL;
1830 
1831    if (atp == TRANSFORM_id) {
1832       if ( AsnReadVal(aip, atp, &av) <= 0) {
1833          goto erret;
1834       }
1835       ptr -> id = av.intvalue;
1836       atp = AsnReadId(aip,amp, atp);
1837    }
1838    if (atp == TRANSFORM_moves) {
1839       ptr -> moves = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MoveAsnRead, (AsnOptFreeFunc) MoveFree);
1840       if (isError && ptr -> moves == NULL) {
1841          goto erret;
1842       }
1843       atp = AsnReadId(aip,amp, atp);
1844    }
1845 
1846    if (AsnReadVal(aip, atp, &av) <= 0) {
1847       goto erret;
1848    }
1849    /* end struct */
1850 
1851 ret:
1852    AsnUnlinkType(orig);       /* unlink local tree */
1853    return ptr;
1854 
1855 erret:
1856    aip -> io_failure = TRUE;
1857    ptr = TransformFree(ptr);
1858    goto ret;
1859 }
1860 
1861 
1862 
1863 /**************************************************
1864 *
1865 *    TransformAsnWrite()
1866 *
1867 **************************************************/
1868 NLM_EXTERN Boolean LIBCALL
TransformAsnWrite(TransformPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1869 TransformAsnWrite(TransformPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1870 {
1871    DataVal av;
1872    AsnTypePtr atp;
1873    Boolean retval = FALSE;
1874 
1875    if (! loaded)
1876    {
1877       if (! objmmdb3AsnLoad()) {
1878          return FALSE;
1879       }
1880    }
1881 
1882    if (aip == NULL) {
1883       return FALSE;
1884    }
1885 
1886    atp = AsnLinkType(orig, TRANSFORM);   /* link local tree */
1887    if (atp == NULL) {
1888       return FALSE;
1889    }
1890 
1891    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1892    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1893    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1894       goto erret;
1895    }
1896 
1897    av.intvalue = ptr -> id;
1898    retval = AsnWrite(aip, TRANSFORM_id,  &av);
1899    AsnGenericChoiceSeqOfAsnWrite(ptr -> moves, (AsnWriteFunc) MoveAsnWrite, aip, TRANSFORM_moves, TRANSFORM_moves_E);
1900    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1901       goto erret;
1902    }
1903    retval = TRUE;
1904 
1905 erret:
1906    AsnUnlinkType(orig);       /* unlink local tree */
1907    return retval;
1908 }
1909 
1910 
1911 
1912 /**************************************************
1913 *
1914 *    BiostrucFeatureSetDescrFree()
1915 *
1916 **************************************************/
1917 NLM_EXTERN
1918 BiostrucFeatureSetDescrPtr LIBCALL
BiostrucFeatureSetDescrFree(ValNodePtr anp)1919 BiostrucFeatureSetDescrFree(ValNodePtr anp)
1920 {
1921    Pointer pnt;
1922 
1923    if (anp == NULL) {
1924       return NULL;
1925    }
1926 
1927    pnt = anp->data.ptrvalue;
1928    switch (anp->choice)
1929    {
1930    default:
1931       break;
1932    case BiostrucFeatureSetDescr_name:
1933       MemFree(anp -> data.ptrvalue);
1934       break;
1935    case BiostrucFeatureSetDescr_pdb_comment:
1936       MemFree(anp -> data.ptrvalue);
1937       break;
1938    case BiostrucFeatureSetDescr_other_comment:
1939       MemFree(anp -> data.ptrvalue);
1940       break;
1941    case BiostrucFeatureSetDescr_attribution:
1942       PubFree(anp -> data.ptrvalue);
1943       break;
1944    }
1945    return MemFree(anp);
1946 }
1947 
1948 
1949 /**************************************************
1950 *
1951 *    BiostrucFeatureSetDescrAsnRead()
1952 *
1953 **************************************************/
1954 NLM_EXTERN
1955 BiostrucFeatureSetDescrPtr LIBCALL
BiostrucFeatureSetDescrAsnRead(AsnIoPtr aip,AsnTypePtr orig)1956 BiostrucFeatureSetDescrAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1957 {
1958    DataVal av;
1959    AsnTypePtr atp;
1960    ValNodePtr anp;
1961    Uint1 choice;
1962    Boolean nullIsError = FALSE;
1963    AsnReadFunc func;
1964 
1965    if (! loaded)
1966    {
1967       if (! objmmdb3AsnLoad()) {
1968          return NULL;
1969       }
1970    }
1971 
1972    if (aip == NULL) {
1973       return NULL;
1974    }
1975 
1976    if (orig == NULL) {         /* BiostrucFeatureSetDescr ::= (self contained) */
1977       atp = AsnReadId(aip, amp, BIOSTRUC_FEATURE_SET_DESCR);
1978    } else {
1979       atp = AsnLinkType(orig, BIOSTRUC_FEATURE_SET_DESCR);    /* link in local tree */
1980    }
1981    if (atp == NULL) {
1982       return NULL;
1983    }
1984 
1985    anp = ValNodeNew(NULL);
1986    if (anp == NULL) {
1987       goto erret;
1988    }
1989    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1990       goto erret;
1991    }
1992 
1993    func = NULL;
1994 
1995    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1996    if (atp == NULL) {
1997       goto erret;
1998    }
1999    if (atp == BIOSTRUC_FEATURE_SET_DESCR_name) {
2000       choice = BiostrucFeatureSetDescr_name;
2001       if (AsnReadVal(aip, atp, &av) <= 0) {
2002          goto erret;
2003       }
2004       anp->data.ptrvalue = av.ptrvalue;
2005    }
2006    else if (atp == BIOSTRUC_FEATURE_SET_DESCR_pdb_comment) {
2007       choice = BiostrucFeatureSetDescr_pdb_comment;
2008       if (AsnReadVal(aip, atp, &av) <= 0) {
2009          goto erret;
2010       }
2011       anp->data.ptrvalue = av.ptrvalue;
2012    }
2013    else if (atp == BIOSTRUC_FEATURE_SET_DESCR_other_comment) {
2014       choice = BiostrucFeatureSetDescr_other_comment;
2015       if (AsnReadVal(aip, atp, &av) <= 0) {
2016          goto erret;
2017       }
2018       anp->data.ptrvalue = av.ptrvalue;
2019    }
2020    else if (atp == BIOSTRUC_FEATURE_SET_DESCR_attribution) {
2021       choice = BiostrucFeatureSetDescr_attribution;
2022       func = (AsnReadFunc) PubAsnRead;
2023    }
2024    anp->choice = choice;
2025    if (func != NULL)
2026    {
2027       anp->data.ptrvalue = (* func)(aip, atp);
2028       if (aip -> io_failure) goto erret;
2029 
2030       if (nullIsError && anp->data.ptrvalue == NULL) {
2031          goto erret;
2032       }
2033    }
2034 
2035 ret:
2036    AsnUnlinkType(orig);       /* unlink local tree */
2037    return anp;
2038 
2039 erret:
2040    anp = MemFree(anp);
2041    aip -> io_failure = TRUE;
2042    goto ret;
2043 }
2044 
2045 
2046 /**************************************************
2047 *
2048 *    BiostrucFeatureSetDescrAsnWrite()
2049 *
2050 **************************************************/
2051 NLM_EXTERN Boolean LIBCALL
BiostrucFeatureSetDescrAsnWrite(BiostrucFeatureSetDescrPtr anp,AsnIoPtr aip,AsnTypePtr orig)2052 BiostrucFeatureSetDescrAsnWrite(BiostrucFeatureSetDescrPtr anp, AsnIoPtr aip, AsnTypePtr orig)
2053 
2054 {
2055    DataVal av;
2056    AsnTypePtr atp, writetype = NULL;
2057    Pointer pnt;
2058    AsnWriteFunc func = NULL;
2059    Boolean retval = FALSE;
2060 
2061    if (! loaded)
2062    {
2063       if (! objmmdb3AsnLoad())
2064       return FALSE;
2065    }
2066 
2067    if (aip == NULL)
2068    return FALSE;
2069 
2070    atp = AsnLinkType(orig, BIOSTRUC_FEATURE_SET_DESCR);   /* link local tree */
2071    if (atp == NULL) {
2072       return FALSE;
2073    }
2074 
2075    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2076    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2077    av.ptrvalue = (Pointer)anp;
2078    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2079       goto erret;
2080    }
2081 
2082    pnt = anp->data.ptrvalue;
2083    switch (anp->choice)
2084    {
2085    case BiostrucFeatureSetDescr_name:
2086       av.ptrvalue = anp->data.ptrvalue;
2087       retval = AsnWrite(aip, BIOSTRUC_FEATURE_SET_DESCR_name, &av);
2088       break;
2089    case BiostrucFeatureSetDescr_pdb_comment:
2090       av.ptrvalue = anp->data.ptrvalue;
2091       retval = AsnWrite(aip, BIOSTRUC_FEATURE_SET_DESCR_pdb_comment, &av);
2092       break;
2093    case BiostrucFeatureSetDescr_other_comment:
2094       av.ptrvalue = anp->data.ptrvalue;
2095       retval = AsnWrite(aip, BIOSTRUC_FEATURE_SET_DESCR_other_comment, &av);
2096       break;
2097    case BiostrucFeatureSetDescr_attribution:
2098       writetype = BIOSTRUC_FEATURE_SET_DESCR_attribution;
2099       func = (AsnWriteFunc) PubAsnWrite;
2100       break;
2101    }
2102    if (writetype != NULL) {
2103       retval = (* func)(pnt, aip, writetype);   /* write it out */
2104    }
2105    if (!retval) {
2106       goto erret;
2107    }
2108    retval = TRUE;
2109 
2110 erret:
2111    AsnUnlinkType(orig);       /* unlink local tree */
2112    return retval;
2113 }
2114 
2115 
2116 /**************************************************
2117 *
2118 *    BiostrucFeatureNew()
2119 *
2120 **************************************************/
2121 NLM_EXTERN
2122 BiostrucFeaturePtr LIBCALL
BiostrucFeatureNew(void)2123 BiostrucFeatureNew(void)
2124 {
2125    BiostrucFeaturePtr ptr = MemNew((size_t) sizeof(BiostrucFeature));
2126 
2127    return ptr;
2128 
2129 }
2130 
2131 
2132 /**************************************************
2133 *
2134 *    BiostrucFeatureFree()
2135 *
2136 **************************************************/
2137 NLM_EXTERN
2138 BiostrucFeaturePtr LIBCALL
BiostrucFeatureFree(BiostrucFeaturePtr ptr)2139 BiostrucFeatureFree(BiostrucFeaturePtr ptr)
2140 {
2141 
2142    if(ptr == NULL) {
2143       return NULL;
2144    }
2145    MemFree(ptr -> name);
2146    Property_propertyFree(ptr -> Property_property);
2147    Location_locationFree(ptr -> Location_location);
2148    return MemFree(ptr);
2149 }
2150 
2151 
2152 /**************************************************
2153 *
2154 *    Location_locationFree()
2155 *
2156 **************************************************/
2157 static
2158 Location_locationPtr LIBCALL
Location_locationFree(ValNodePtr anp)2159 Location_locationFree(ValNodePtr anp)
2160 {
2161    Pointer pnt;
2162 
2163    if (anp == NULL) {
2164       return NULL;
2165    }
2166 
2167    pnt = anp->data.ptrvalue;
2168    switch (anp->choice)
2169    {
2170    default:
2171       break;
2172    case Location_location_subgraph:
2173       ChemGraphPntrsFree(anp -> data.ptrvalue);
2174       break;
2175    case Location_location_region:
2176       RegionPntrsFree(anp -> data.ptrvalue);
2177       break;
2178    case Location_location_alignment:
2179       ChemGraphAlignmentFree(anp -> data.ptrvalue);
2180       break;
2181    case Location_location_interaction:
2182       ChemGraphInteractionFree(anp -> data.ptrvalue);
2183       break;
2184    case Location_location_similarity:
2185       RegionSimilarityFree(anp -> data.ptrvalue);
2186       break;
2187    case Location_location_indirect:
2188       OtherFeatureFree(anp -> data.ptrvalue);
2189       break;
2190    }
2191    return MemFree(anp);
2192 }
2193 
2194 
2195 /**************************************************
2196 *
2197 *    BiostrucFeatureAsnRead()
2198 *
2199 **************************************************/
2200 NLM_EXTERN
2201 BiostrucFeaturePtr LIBCALL
BiostrucFeatureAsnRead(AsnIoPtr aip,AsnTypePtr orig)2202 BiostrucFeatureAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2203 {
2204    DataVal av;
2205    AsnTypePtr atp;
2206    AsnReadFunc func;
2207    BiostrucFeaturePtr ptr;
2208 
2209    if (! loaded)
2210    {
2211       if (! objmmdb3AsnLoad()) {
2212          return NULL;
2213       }
2214    }
2215 
2216    if (aip == NULL) {
2217       return NULL;
2218    }
2219 
2220    if (orig == NULL) {         /* BiostrucFeature ::= (self contained) */
2221       atp = AsnReadId(aip, amp, BIOSTRUC_FEATURE);
2222    } else {
2223       atp = AsnLinkType(orig, BIOSTRUC_FEATURE);
2224    }
2225    /* link in local tree */
2226    if (atp == NULL) {
2227       return NULL;
2228    }
2229 
2230    ptr = BiostrucFeatureNew();
2231    if (ptr == NULL) {
2232       goto erret;
2233    }
2234    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2235       goto erret;
2236    }
2237 
2238    atp = AsnReadId(aip,amp, atp);
2239    func = NULL;
2240 
2241    if (atp == BIOSTRUC_FEATURE_id) {
2242       if ( AsnReadVal(aip, atp, &av) <= 0) {
2243          goto erret;
2244       }
2245       ptr -> id = av.intvalue;
2246       ptr -> OBbits__ |= 1<<0;
2247       atp = AsnReadId(aip,amp, atp);
2248    }
2249    if (atp == BIOSTRUC_FEATURE_name) {
2250       if ( AsnReadVal(aip, atp, &av) <= 0) {
2251          goto erret;
2252       }
2253       ptr -> name = av.ptrvalue;
2254       atp = AsnReadId(aip,amp, atp);
2255    }
2256    if (atp == BIOSTRUC_FEATURE_type) {
2257       if ( AsnReadVal(aip, atp, &av) <= 0) {
2258          goto erret;
2259       }
2260       ptr -> type = av.intvalue;
2261       ptr -> OBbits__ |= 1<<1;
2262       atp = AsnReadId(aip,amp, atp);
2263    }
2264    if (atp == BIOSTRUC_FEATURE_property) {
2265       ptr -> Property_property = Property_propertyAsnRead(aip, atp);
2266       if (aip -> io_failure) {
2267          goto erret;
2268       }
2269       atp = AsnReadId(aip,amp, atp);
2270    }
2271    if (atp == BIOSTRUC_FEATURE_location) {
2272       ptr -> Location_location = Location_locationAsnRead(aip, atp);
2273       if (aip -> io_failure) {
2274          goto erret;
2275       }
2276       atp = AsnReadId(aip,amp, atp);
2277    }
2278 
2279    if (AsnReadVal(aip, atp, &av) <= 0) {
2280       goto erret;
2281    }
2282    /* end struct */
2283 
2284 ret:
2285    AsnUnlinkType(orig);       /* unlink local tree */
2286    return ptr;
2287 
2288 erret:
2289    aip -> io_failure = TRUE;
2290    ptr = BiostrucFeatureFree(ptr);
2291    goto ret;
2292 }
2293 
2294 
2295 
2296 /**************************************************
2297 *
2298 *    Location_locationAsnRead()
2299 *
2300 **************************************************/
2301 static
2302 Location_locationPtr LIBCALL
Location_locationAsnRead(AsnIoPtr aip,AsnTypePtr orig)2303 Location_locationAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2304 {
2305    DataVal av;
2306    AsnTypePtr atp;
2307    ValNodePtr anp;
2308    Uint1 choice;
2309    Boolean nullIsError = FALSE;
2310    AsnReadFunc func;
2311 
2312    if (! loaded)
2313    {
2314       if (! objmmdb3AsnLoad()) {
2315          return NULL;
2316       }
2317    }
2318 
2319    if (aip == NULL) {
2320       return NULL;
2321    }
2322 
2323    if (orig == NULL) {         /* Location_location ::= (self contained) */
2324       atp = AsnReadId(aip, amp, BIOSTRUC_FEATURE_location);
2325    } else {
2326       atp = AsnLinkType(orig, BIOSTRUC_FEATURE_location);    /* link in local tree */
2327    }
2328    if (atp == NULL) {
2329       return NULL;
2330    }
2331 
2332    anp = ValNodeNew(NULL);
2333    if (anp == NULL) {
2334       goto erret;
2335    }
2336    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
2337       goto erret;
2338    }
2339 
2340    func = NULL;
2341 
2342    atp = AsnReadId(aip, amp, atp);  /* find the choice */
2343    if (atp == NULL) {
2344       goto erret;
2345    }
2346    if (atp == BIOSTRUC_FEATURE_location_subgraph) {
2347       choice = Location_location_subgraph;
2348       func = (AsnReadFunc) ChemGraphPntrsAsnRead;
2349    }
2350    else if (atp == BIOSTRUC_FEATURE_location_region) {
2351       choice = Location_location_region;
2352       func = (AsnReadFunc) RegionPntrsAsnRead;
2353    }
2354    else if (atp == BIOSTRUC_FEATURE_location_alignment) {
2355       choice = Location_location_alignment;
2356       func = (AsnReadFunc) ChemGraphAlignmentAsnRead;
2357    }
2358    else if (atp == BIOSTRUC_FEATURE_location_interaction) {
2359       choice = Location_location_interaction;
2360       func = (AsnReadFunc) ChemGraphInteractionAsnRead;
2361    }
2362    else if (atp == BIOSTRUC_FEATURE_location_similarity) {
2363       choice = Location_location_similarity;
2364       func = (AsnReadFunc) RegionSimilarityAsnRead;
2365    }
2366    else if (atp == BIOSTRUC_FEATURE_location_indirect) {
2367       choice = Location_location_indirect;
2368       func = (AsnReadFunc) OtherFeatureAsnRead;
2369    }
2370    anp->choice = choice;
2371    if (func != NULL)
2372    {
2373       anp->data.ptrvalue = (* func)(aip, atp);
2374       if (aip -> io_failure) goto erret;
2375 
2376       if (nullIsError && anp->data.ptrvalue == NULL) {
2377          goto erret;
2378       }
2379    }
2380 
2381 ret:
2382    AsnUnlinkType(orig);       /* unlink local tree */
2383    return anp;
2384 
2385 erret:
2386    anp = MemFree(anp);
2387    aip -> io_failure = TRUE;
2388    goto ret;
2389 }
2390 
2391 
2392 /**************************************************
2393 *
2394 *    BiostrucFeatureAsnWrite()
2395 *
2396 **************************************************/
2397 NLM_EXTERN Boolean LIBCALL
BiostrucFeatureAsnWrite(BiostrucFeaturePtr ptr,AsnIoPtr aip,AsnTypePtr orig)2398 BiostrucFeatureAsnWrite(BiostrucFeaturePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2399 {
2400    DataVal av;
2401    AsnTypePtr atp;
2402    Boolean retval = FALSE;
2403 
2404    if (! loaded)
2405    {
2406       if (! objmmdb3AsnLoad()) {
2407          return FALSE;
2408       }
2409    }
2410 
2411    if (aip == NULL) {
2412       return FALSE;
2413    }
2414 
2415    atp = AsnLinkType(orig, BIOSTRUC_FEATURE);   /* link local tree */
2416    if (atp == NULL) {
2417       return FALSE;
2418    }
2419 
2420    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2421    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2422    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2423       goto erret;
2424    }
2425 
2426    if (ptr -> id || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> id;
2427       retval = AsnWrite(aip, BIOSTRUC_FEATURE_id,  &av);
2428    }
2429    if (ptr -> name != NULL) {
2430       av.ptrvalue = ptr -> name;
2431       retval = AsnWrite(aip, BIOSTRUC_FEATURE_name,  &av);
2432    }
2433    if (ptr -> type || (ptr -> OBbits__ & (1<<1) )){   av.intvalue = ptr -> type;
2434       retval = AsnWrite(aip, BIOSTRUC_FEATURE_type,  &av);
2435    }
2436    if (ptr -> Property_property != NULL) {
2437       if ( ! Property_propertyAsnWrite(ptr -> Property_property, aip, BIOSTRUC_FEATURE_property)) {
2438          goto erret;
2439       }
2440    }
2441    if (ptr -> Location_location != NULL) {
2442       if ( ! Location_locationAsnWrite(ptr -> Location_location, aip, BIOSTRUC_FEATURE_location)) {
2443          goto erret;
2444       }
2445    }
2446    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2447       goto erret;
2448    }
2449    retval = TRUE;
2450 
2451 erret:
2452    AsnUnlinkType(orig);       /* unlink local tree */
2453    return retval;
2454 }
2455 
2456 
2457 
2458 /**************************************************
2459 *
2460 *    Location_locationAsnWrite()
2461 *
2462 **************************************************/
2463 static Boolean LIBCALL
Location_locationAsnWrite(Location_locationPtr anp,AsnIoPtr aip,AsnTypePtr orig)2464 Location_locationAsnWrite(Location_locationPtr anp, AsnIoPtr aip, AsnTypePtr orig)
2465 
2466 {
2467    DataVal av;
2468    AsnTypePtr atp, writetype = NULL;
2469    Pointer pnt;
2470    AsnWriteFunc func = NULL;
2471    Boolean retval = FALSE;
2472 
2473    if (! loaded)
2474    {
2475       if (! objmmdb3AsnLoad())
2476       return FALSE;
2477    }
2478 
2479    if (aip == NULL)
2480    return FALSE;
2481 
2482    atp = AsnLinkType(orig, BIOSTRUC_FEATURE_location);   /* link local tree */
2483    if (atp == NULL) {
2484       return FALSE;
2485    }
2486 
2487    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2488    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2489    av.ptrvalue = (Pointer)anp;
2490    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2491       goto erret;
2492    }
2493 
2494    pnt = anp->data.ptrvalue;
2495    switch (anp->choice)
2496    {
2497    case Location_location_subgraph:
2498       writetype = BIOSTRUC_FEATURE_location_subgraph;
2499       func = (AsnWriteFunc) ChemGraphPntrsAsnWrite;
2500       break;
2501    case Location_location_region:
2502       writetype = BIOSTRUC_FEATURE_location_region;
2503       func = (AsnWriteFunc) RegionPntrsAsnWrite;
2504       break;
2505    case Location_location_alignment:
2506       writetype = BIOSTRUC_FEATURE_location_alignment;
2507       func = (AsnWriteFunc) ChemGraphAlignmentAsnWrite;
2508       break;
2509    case Location_location_interaction:
2510       writetype = BIOSTRUC_FEATURE_location_interaction;
2511       func = (AsnWriteFunc) ChemGraphInteractionAsnWrite;
2512       break;
2513    case Location_location_similarity:
2514       writetype = BIOSTRUC_FEATURE_location_similarity;
2515       func = (AsnWriteFunc) RegionSimilarityAsnWrite;
2516       break;
2517    case Location_location_indirect:
2518       writetype = BIOSTRUC_FEATURE_location_indirect;
2519       func = (AsnWriteFunc) OtherFeatureAsnWrite;
2520       break;
2521    }
2522    if (writetype != NULL) {
2523       retval = (* func)(pnt, aip, writetype);   /* write it out */
2524    }
2525    if (!retval) {
2526       goto erret;
2527    }
2528    retval = TRUE;
2529 
2530 erret:
2531    AsnUnlinkType(orig);       /* unlink local tree */
2532    return retval;
2533 }
2534 
2535 
2536 /**************************************************
2537 *
2538 *    Property_propertyAsnWrite()
2539 *
2540 **************************************************/
2541 static Boolean LIBCALL
Property_propertyAsnWrite(Property_propertyPtr anp,AsnIoPtr aip,AsnTypePtr orig)2542 Property_propertyAsnWrite(Property_propertyPtr anp, AsnIoPtr aip, AsnTypePtr orig)
2543 
2544 {
2545    DataVal av;
2546    AsnTypePtr atp, writetype = NULL;
2547    Pointer pnt;
2548    AsnWriteFunc func = NULL;
2549    Boolean retval = FALSE;
2550 
2551    if (! loaded)
2552    {
2553       if (! objmmdb3AsnLoad())
2554       return FALSE;
2555    }
2556 
2557    if (aip == NULL)
2558    return FALSE;
2559 
2560    atp = AsnLinkType(orig, BIOSTRUC_FEATURE_property);   /* link local tree */
2561    if (atp == NULL) {
2562       return FALSE;
2563    }
2564 
2565    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2566    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2567    av.ptrvalue = (Pointer)anp;
2568    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2569       goto erret;
2570    }
2571 
2572    pnt = anp->data.ptrvalue;
2573    switch (anp->choice)
2574    {
2575    case Property_property_color:
2576       writetype = BIOSTRUC_FEATURE_property_color;
2577       func = (AsnWriteFunc) ColorPropAsnWrite;
2578       break;
2579    case Property_property_render:
2580       av.intvalue = anp->data.intvalue;
2581       retval = AsnWrite(aip, BIOSTRUC_FEATURE_property_render, &av);
2582       break;
2583    case Property_property_transform:
2584       writetype = BIOSTRUC_FEATURE_property_transform;
2585       func = (AsnWriteFunc) TransformAsnWrite;
2586       break;
2587    case Property_property_camera:
2588       writetype = BIOSTRUC_FEATURE_property_camera;
2589       func = (AsnWriteFunc) CameraAsnWrite;
2590       break;
2591    case Property_property_script:
2592       writetype = BIOSTRUC_FEATURE_property_script;
2593       func = (AsnWriteFunc) BiostrucScriptAsnWrite;
2594       break;
2595    case Property_property_user:
2596       writetype = BIOSTRUC_FEATURE_property_user;
2597       func = (AsnWriteFunc) UserObjectAsnWrite;
2598       break;
2599    }
2600    if (writetype != NULL) {
2601       retval = (* func)(pnt, aip, writetype);   /* write it out */
2602    }
2603    if (!retval) {
2604       goto erret;
2605    }
2606    retval = TRUE;
2607 
2608 erret:
2609    AsnUnlinkType(orig);       /* unlink local tree */
2610    return retval;
2611 }
2612 
2613 
2614 /**************************************************
2615 *
2616 *    Property_propertyAsnRead()
2617 *
2618 **************************************************/
2619 static
2620 Property_propertyPtr LIBCALL
Property_propertyAsnRead(AsnIoPtr aip,AsnTypePtr orig)2621 Property_propertyAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2622 {
2623    DataVal av;
2624    AsnTypePtr atp;
2625    ValNodePtr anp;
2626    Uint1 choice;
2627    Boolean nullIsError = FALSE;
2628    AsnReadFunc func;
2629 
2630    if (! loaded)
2631    {
2632       if (! objmmdb3AsnLoad()) {
2633          return NULL;
2634       }
2635    }
2636 
2637    if (aip == NULL) {
2638       return NULL;
2639    }
2640 
2641    if (orig == NULL) {         /* Property_property ::= (self contained) */
2642       atp = AsnReadId(aip, amp, BIOSTRUC_FEATURE_property);
2643    } else {
2644       atp = AsnLinkType(orig, BIOSTRUC_FEATURE_property);    /* link in local tree */
2645    }
2646    if (atp == NULL) {
2647       return NULL;
2648    }
2649 
2650    anp = ValNodeNew(NULL);
2651    if (anp == NULL) {
2652       goto erret;
2653    }
2654    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
2655       goto erret;
2656    }
2657 
2658    func = NULL;
2659 
2660    atp = AsnReadId(aip, amp, atp);  /* find the choice */
2661    if (atp == NULL) {
2662       goto erret;
2663    }
2664    if (atp == BIOSTRUC_FEATURE_property_color) {
2665       choice = Property_property_color;
2666       func = (AsnReadFunc) ColorPropAsnRead;
2667    }
2668    else if (atp == BIOSTRUC_FEATURE_property_render) {
2669       choice = Property_property_render;
2670       if (AsnReadVal(aip, atp, &av) <= 0) {
2671          goto erret;
2672       }
2673       anp->data.intvalue = av.intvalue;
2674    }
2675    else if (atp == BIOSTRUC_FEATURE_property_transform) {
2676       choice = Property_property_transform;
2677       func = (AsnReadFunc) TransformAsnRead;
2678    }
2679    else if (atp == BIOSTRUC_FEATURE_property_camera) {
2680       choice = Property_property_camera;
2681       func = (AsnReadFunc) CameraAsnRead;
2682    }
2683    else if (atp == BIOSTRUC_FEATURE_property_script) {
2684       choice = Property_property_script;
2685       func = (AsnReadFunc) BiostrucScriptAsnRead;
2686    }
2687    else if (atp == BIOSTRUC_FEATURE_property_user) {
2688       choice = Property_property_user;
2689       func = (AsnReadFunc) UserObjectAsnRead;
2690    }
2691    anp->choice = choice;
2692    if (func != NULL)
2693    {
2694       anp->data.ptrvalue = (* func)(aip, atp);
2695       if (aip -> io_failure) goto erret;
2696 
2697       if (nullIsError && anp->data.ptrvalue == NULL) {
2698          goto erret;
2699       }
2700    }
2701 
2702 ret:
2703    AsnUnlinkType(orig);       /* unlink local tree */
2704    return anp;
2705 
2706 erret:
2707    anp = MemFree(anp);
2708    aip -> io_failure = TRUE;
2709    goto ret;
2710 }
2711 
2712 
2713 /**************************************************
2714 *
2715 *    Property_propertyFree()
2716 *
2717 **************************************************/
2718 static
2719 Property_propertyPtr LIBCALL
Property_propertyFree(ValNodePtr anp)2720 Property_propertyFree(ValNodePtr anp)
2721 {
2722    Pointer pnt;
2723 
2724    if (anp == NULL) {
2725       return NULL;
2726    }
2727 
2728    pnt = anp->data.ptrvalue;
2729    switch (anp->choice)
2730    {
2731    default:
2732       break;
2733    case Property_property_color:
2734       ColorPropFree(anp -> data.ptrvalue);
2735       break;
2736    case Property_property_transform:
2737       TransformFree(anp -> data.ptrvalue);
2738       break;
2739    case Property_property_camera:
2740       CameraFree(anp -> data.ptrvalue);
2741       break;
2742    case Property_property_script:
2743       BiostrucScriptFree(anp -> data.ptrvalue);
2744       break;
2745    case Property_property_user:
2746       UserObjectFree(anp -> data.ptrvalue);
2747       break;
2748    }
2749    return MemFree(anp);
2750 }
2751 
2752 
2753 /**************************************************
2754 *
2755 *    ColorPropNew()
2756 *
2757 **************************************************/
2758 NLM_EXTERN
2759 ColorPropPtr LIBCALL
ColorPropNew(void)2760 ColorPropNew(void)
2761 {
2762    ColorPropPtr ptr = MemNew((size_t) sizeof(ColorProp));
2763 
2764    return ptr;
2765 
2766 }
2767 
2768 
2769 /**************************************************
2770 *
2771 *    ColorPropFree()
2772 *
2773 **************************************************/
2774 NLM_EXTERN
2775 ColorPropPtr LIBCALL
ColorPropFree(ColorPropPtr ptr)2776 ColorPropFree(ColorPropPtr ptr)
2777 {
2778 
2779    if(ptr == NULL) {
2780       return NULL;
2781    }
2782    MemFree(ptr -> name);
2783    return MemFree(ptr);
2784 }
2785 
2786 
2787 /**************************************************
2788 *
2789 *    ColorPropAsnRead()
2790 *
2791 **************************************************/
2792 NLM_EXTERN
2793 ColorPropPtr LIBCALL
ColorPropAsnRead(AsnIoPtr aip,AsnTypePtr orig)2794 ColorPropAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2795 {
2796    DataVal av;
2797    AsnTypePtr atp;
2798    AsnReadFunc func;
2799    ColorPropPtr ptr;
2800 
2801    if (! loaded)
2802    {
2803       if (! objmmdb3AsnLoad()) {
2804          return NULL;
2805       }
2806    }
2807 
2808    if (aip == NULL) {
2809       return NULL;
2810    }
2811 
2812    if (orig == NULL) {         /* ColorProp ::= (self contained) */
2813       atp = AsnReadId(aip, amp, COLOR_PROP);
2814    } else {
2815       atp = AsnLinkType(orig, COLOR_PROP);
2816    }
2817    /* link in local tree */
2818    if (atp == NULL) {
2819       return NULL;
2820    }
2821 
2822    ptr = ColorPropNew();
2823    if (ptr == NULL) {
2824       goto erret;
2825    }
2826    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2827       goto erret;
2828    }
2829 
2830    atp = AsnReadId(aip,amp, atp);
2831    func = NULL;
2832 
2833    if (atp == COLOR_PROP_r) {
2834       if ( AsnReadVal(aip, atp, &av) <= 0) {
2835          goto erret;
2836       }
2837       ptr -> r = av.intvalue;
2838       ptr -> OBbits__ |= 1<<0;
2839       atp = AsnReadId(aip,amp, atp);
2840    }
2841    if (atp == COLOR_PROP_g) {
2842       if ( AsnReadVal(aip, atp, &av) <= 0) {
2843          goto erret;
2844       }
2845       ptr -> g = av.intvalue;
2846       ptr -> OBbits__ |= 1<<1;
2847       atp = AsnReadId(aip,amp, atp);
2848    }
2849    if (atp == COLOR_PROP_b) {
2850       if ( AsnReadVal(aip, atp, &av) <= 0) {
2851          goto erret;
2852       }
2853       ptr -> b = av.intvalue;
2854       ptr -> OBbits__ |= 1<<2;
2855       atp = AsnReadId(aip,amp, atp);
2856    }
2857    if (atp == COLOR_PROP_name) {
2858       if ( AsnReadVal(aip, atp, &av) <= 0) {
2859          goto erret;
2860       }
2861       ptr -> name = av.ptrvalue;
2862       atp = AsnReadId(aip,amp, atp);
2863    }
2864 
2865    if (AsnReadVal(aip, atp, &av) <= 0) {
2866       goto erret;
2867    }
2868    /* end struct */
2869 
2870 ret:
2871    AsnUnlinkType(orig);       /* unlink local tree */
2872    return ptr;
2873 
2874 erret:
2875    aip -> io_failure = TRUE;
2876    ptr = ColorPropFree(ptr);
2877    goto ret;
2878 }
2879 
2880 
2881 
2882 /**************************************************
2883 *
2884 *    ColorPropAsnWrite()
2885 *
2886 **************************************************/
2887 NLM_EXTERN Boolean LIBCALL
ColorPropAsnWrite(ColorPropPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2888 ColorPropAsnWrite(ColorPropPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2889 {
2890    DataVal av;
2891    AsnTypePtr atp;
2892    Boolean retval = FALSE;
2893 
2894    if (! loaded)
2895    {
2896       if (! objmmdb3AsnLoad()) {
2897          return FALSE;
2898       }
2899    }
2900 
2901    if (aip == NULL) {
2902       return FALSE;
2903    }
2904 
2905    atp = AsnLinkType(orig, COLOR_PROP);   /* link local tree */
2906    if (atp == NULL) {
2907       return FALSE;
2908    }
2909 
2910    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2911    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2912    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2913       goto erret;
2914    }
2915 
2916    if (ptr -> r || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> r;
2917       retval = AsnWrite(aip, COLOR_PROP_r,  &av);
2918    }
2919    if (ptr -> g || (ptr -> OBbits__ & (1<<1) )){   av.intvalue = ptr -> g;
2920       retval = AsnWrite(aip, COLOR_PROP_g,  &av);
2921    }
2922    if (ptr -> b || (ptr -> OBbits__ & (1<<2) )){   av.intvalue = ptr -> b;
2923       retval = AsnWrite(aip, COLOR_PROP_b,  &av);
2924    }
2925    if (ptr -> name != NULL) {
2926       av.ptrvalue = ptr -> name;
2927       retval = AsnWrite(aip, COLOR_PROP_name,  &av);
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 *    CameraNew()
2944 *
2945 **************************************************/
2946 NLM_EXTERN
2947 CameraPtr LIBCALL
CameraNew(void)2948 CameraNew(void)
2949 {
2950    CameraPtr ptr = MemNew((size_t) sizeof(Camera));
2951 
2952    return ptr;
2953 
2954 }
2955 
2956 
2957 /**************************************************
2958 *
2959 *    CameraFree()
2960 *
2961 **************************************************/
2962 NLM_EXTERN
2963 CameraPtr LIBCALL
CameraFree(CameraPtr ptr)2964 CameraFree(CameraPtr ptr)
2965 {
2966 
2967    if(ptr == NULL) {
2968       return NULL;
2969    }
2970    GLMatrixFree(ptr -> modelview);
2971    return MemFree(ptr);
2972 }
2973 
2974 
2975 /**************************************************
2976 *
2977 *    CameraAsnRead()
2978 *
2979 **************************************************/
2980 NLM_EXTERN
2981 CameraPtr LIBCALL
CameraAsnRead(AsnIoPtr aip,AsnTypePtr orig)2982 CameraAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2983 {
2984    DataVal av;
2985    AsnTypePtr atp;
2986    AsnReadFunc func;
2987    CameraPtr ptr;
2988 
2989    if (! loaded)
2990    {
2991       if (! objmmdb3AsnLoad()) {
2992          return NULL;
2993       }
2994    }
2995 
2996    if (aip == NULL) {
2997       return NULL;
2998    }
2999 
3000    if (orig == NULL) {         /* Camera ::= (self contained) */
3001       atp = AsnReadId(aip, amp, CAMERA);
3002    } else {
3003       atp = AsnLinkType(orig, CAMERA);
3004    }
3005    /* link in local tree */
3006    if (atp == NULL) {
3007       return NULL;
3008    }
3009 
3010    ptr = CameraNew();
3011    if (ptr == NULL) {
3012       goto erret;
3013    }
3014    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3015       goto erret;
3016    }
3017 
3018    atp = AsnReadId(aip,amp, atp);
3019    func = NULL;
3020 
3021    if (atp == CAMERA_x) {
3022       if ( AsnReadVal(aip, atp, &av) <= 0) {
3023          goto erret;
3024       }
3025       ptr -> x = av.intvalue;
3026       atp = AsnReadId(aip,amp, atp);
3027    }
3028    if (atp == CAMERA_y) {
3029       if ( AsnReadVal(aip, atp, &av) <= 0) {
3030          goto erret;
3031       }
3032       ptr -> y = av.intvalue;
3033       atp = AsnReadId(aip,amp, atp);
3034    }
3035    if (atp == CAMERA_distance) {
3036       if ( AsnReadVal(aip, atp, &av) <= 0) {
3037          goto erret;
3038       }
3039       ptr -> distance = av.intvalue;
3040       atp = AsnReadId(aip,amp, atp);
3041    }
3042    if (atp == CAMERA_angle) {
3043       if ( AsnReadVal(aip, atp, &av) <= 0) {
3044          goto erret;
3045       }
3046       ptr -> angle = av.intvalue;
3047       atp = AsnReadId(aip,amp, atp);
3048    }
3049    if (atp == CAMERA_scale) {
3050       if ( AsnReadVal(aip, atp, &av) <= 0) {
3051          goto erret;
3052       }
3053       ptr -> scale = av.intvalue;
3054       atp = AsnReadId(aip,amp, atp);
3055    }
3056    if (atp == CAMERA_modelview) {
3057       ptr -> modelview = GLMatrixAsnRead(aip, atp);
3058       if (aip -> io_failure) {
3059          goto erret;
3060       }
3061       atp = AsnReadId(aip,amp, atp);
3062    }
3063 
3064    if (AsnReadVal(aip, atp, &av) <= 0) {
3065       goto erret;
3066    }
3067    /* end struct */
3068 
3069 ret:
3070    AsnUnlinkType(orig);       /* unlink local tree */
3071    return ptr;
3072 
3073 erret:
3074    aip -> io_failure = TRUE;
3075    ptr = CameraFree(ptr);
3076    goto ret;
3077 }
3078 
3079 
3080 
3081 /**************************************************
3082 *
3083 *    CameraAsnWrite()
3084 *
3085 **************************************************/
3086 NLM_EXTERN Boolean LIBCALL
CameraAsnWrite(CameraPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3087 CameraAsnWrite(CameraPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3088 {
3089    DataVal av;
3090    AsnTypePtr atp;
3091    Boolean retval = FALSE;
3092 
3093    if (! loaded)
3094    {
3095       if (! objmmdb3AsnLoad()) {
3096          return FALSE;
3097       }
3098    }
3099 
3100    if (aip == NULL) {
3101       return FALSE;
3102    }
3103 
3104    atp = AsnLinkType(orig, CAMERA);   /* link local tree */
3105    if (atp == NULL) {
3106       return FALSE;
3107    }
3108 
3109    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3110    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3111    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3112       goto erret;
3113    }
3114 
3115    av.intvalue = ptr -> x;
3116    retval = AsnWrite(aip, CAMERA_x,  &av);
3117    av.intvalue = ptr -> y;
3118    retval = AsnWrite(aip, CAMERA_y,  &av);
3119    av.intvalue = ptr -> distance;
3120    retval = AsnWrite(aip, CAMERA_distance,  &av);
3121    av.intvalue = ptr -> angle;
3122    retval = AsnWrite(aip, CAMERA_angle,  &av);
3123    av.intvalue = ptr -> scale;
3124    retval = AsnWrite(aip, CAMERA_scale,  &av);
3125    if (ptr -> modelview != NULL) {
3126       if ( ! GLMatrixAsnWrite(ptr -> modelview, aip, CAMERA_modelview)) {
3127          goto erret;
3128       }
3129    }
3130    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3131       goto erret;
3132    }
3133    retval = TRUE;
3134 
3135 erret:
3136    AsnUnlinkType(orig);       /* unlink local tree */
3137    return retval;
3138 }
3139 
3140 
3141 
3142 /**************************************************
3143 *
3144 *    BiostrucScriptFree()
3145 *
3146 **************************************************/
3147 NLM_EXTERN
3148 BiostrucScriptPtr LIBCALL
BiostrucScriptFree(BiostrucScriptPtr ptr)3149 BiostrucScriptFree(BiostrucScriptPtr ptr)
3150 {
3151 
3152    if(ptr == NULL) {
3153       return NULL;
3154    }
3155    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) BiostrucScriptStepFree);
3156    return NULL;
3157 }
3158 
3159 
3160 /**************************************************
3161 *
3162 *    BiostrucScriptAsnRead()
3163 *
3164 **************************************************/
3165 NLM_EXTERN
3166 BiostrucScriptPtr LIBCALL
BiostrucScriptAsnRead(AsnIoPtr aip,AsnTypePtr orig)3167 BiostrucScriptAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3168 {
3169    AsnTypePtr atp;
3170    Boolean isError = FALSE;
3171    AsnReadFunc func;
3172    BiostrucScriptPtr ptr;
3173 
3174    if (! loaded)
3175    {
3176       if (! objmmdb3AsnLoad()) {
3177          return NULL;
3178       }
3179    }
3180 
3181    if (aip == NULL) {
3182       return NULL;
3183    }
3184 
3185    if (orig == NULL) {         /* BiostrucScript ::= (self contained) */
3186       atp = AsnReadId(aip, amp, BIOSTRUC_SCRIPT);
3187    } else {
3188       atp = AsnLinkType(orig, BIOSTRUC_SCRIPT);
3189    }
3190    /* link in local tree */
3191    if (atp == NULL) {
3192       return NULL;
3193    }
3194 
3195    func = NULL;
3196 
3197    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucScriptStepAsnRead, (AsnOptFreeFunc) BiostrucScriptStepFree);
3198    if (isError && ptr  == NULL) {
3199       goto erret;
3200    }
3201 
3202 
3203 
3204 ret:
3205    AsnUnlinkType(orig);       /* unlink local tree */
3206    return ptr;
3207 
3208 erret:
3209    aip -> io_failure = TRUE;
3210    ptr = BiostrucScriptFree(ptr);
3211    goto ret;
3212 }
3213 
3214 
3215 
3216 /**************************************************
3217 *
3218 *    BiostrucScriptAsnWrite()
3219 *
3220 **************************************************/
3221 NLM_EXTERN Boolean LIBCALL
BiostrucScriptAsnWrite(BiostrucScriptPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3222 BiostrucScriptAsnWrite(BiostrucScriptPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3223 {
3224    AsnTypePtr atp;
3225    Boolean retval = FALSE;
3226 
3227    if (! loaded)
3228    {
3229       if (! objmmdb3AsnLoad()) {
3230          return FALSE;
3231       }
3232    }
3233 
3234    if (aip == NULL) {
3235       return FALSE;
3236    }
3237 
3238    atp = AsnLinkType(orig, BIOSTRUC_SCRIPT);   /* link local tree */
3239    if (atp == NULL) {
3240       return FALSE;
3241    }
3242 
3243    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3244    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) BiostrucScriptStepAsnWrite, aip, atp, BIOSTRUC_SCRIPT_E);
3245    retval = TRUE;
3246 
3247 erret:
3248    AsnUnlinkType(orig);       /* unlink local tree */
3249    return retval;
3250 }
3251 
3252 
3253 
3254 /**************************************************
3255 *
3256 *    RegionPntrsNew()
3257 *
3258 **************************************************/
3259 NLM_EXTERN
3260 RegionPntrsPtr LIBCALL
RegionPntrsNew(void)3261 RegionPntrsNew(void)
3262 {
3263    RegionPntrsPtr ptr = MemNew((size_t) sizeof(RegionPntrs));
3264 
3265    return ptr;
3266 
3267 }
3268 
3269 
3270 /**************************************************
3271 *
3272 *    RegionPntrsFree()
3273 *
3274 **************************************************/
3275 NLM_EXTERN
3276 RegionPntrsPtr LIBCALL
RegionPntrsFree(RegionPntrsPtr ptr)3277 RegionPntrsFree(RegionPntrsPtr ptr)
3278 {
3279 
3280    if(ptr == NULL) {
3281       return NULL;
3282    }
3283    Region_regionFree(ptr -> Region_region);
3284    return MemFree(ptr);
3285 }
3286 
3287 
3288 /**************************************************
3289 *
3290 *    Region_regionFree()
3291 *
3292 **************************************************/
3293 static
3294 Region_regionPtr LIBCALL
Region_regionFree(ValNodePtr anp)3295 Region_regionFree(ValNodePtr anp)
3296 {
3297    Pointer pnt;
3298 
3299    if (anp == NULL) {
3300       return NULL;
3301    }
3302 
3303    pnt = anp->data.ptrvalue;
3304    switch (anp->choice)
3305    {
3306    default:
3307       break;
3308    case Region_region_site:
3309       AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) RegionCoordinatesFree);
3310       break;
3311    case Region_region_boundary:
3312       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) RegionBoundaryFree);
3313       break;
3314    }
3315    return MemFree(anp);
3316 }
3317 
3318 
3319 /**************************************************
3320 *
3321 *    RegionPntrsAsnRead()
3322 *
3323 **************************************************/
3324 NLM_EXTERN
3325 RegionPntrsPtr LIBCALL
RegionPntrsAsnRead(AsnIoPtr aip,AsnTypePtr orig)3326 RegionPntrsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3327 {
3328    DataVal av;
3329    AsnTypePtr atp;
3330    AsnReadFunc func;
3331    RegionPntrsPtr ptr;
3332 
3333    if (! loaded)
3334    {
3335       if (! objmmdb3AsnLoad()) {
3336          return NULL;
3337       }
3338    }
3339 
3340    if (aip == NULL) {
3341       return NULL;
3342    }
3343 
3344    if (orig == NULL) {         /* RegionPntrs ::= (self contained) */
3345       atp = AsnReadId(aip, amp, REGION_PNTRS);
3346    } else {
3347       atp = AsnLinkType(orig, REGION_PNTRS);
3348    }
3349    /* link in local tree */
3350    if (atp == NULL) {
3351       return NULL;
3352    }
3353 
3354    ptr = RegionPntrsNew();
3355    if (ptr == NULL) {
3356       goto erret;
3357    }
3358    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3359       goto erret;
3360    }
3361 
3362    atp = AsnReadId(aip,amp, atp);
3363    func = NULL;
3364 
3365    if (atp == REGION_PNTRS_model_id) {
3366       if ( AsnReadVal(aip, atp, &av) <= 0) {
3367          goto erret;
3368       }
3369       ptr -> model_id = av.intvalue;
3370       atp = AsnReadId(aip,amp, atp);
3371    }
3372    if (atp == REGION_PNTRS_region) {
3373       ptr -> Region_region = Region_regionAsnRead(aip, atp);
3374       if (aip -> io_failure) {
3375          goto erret;
3376       }
3377       atp = AsnReadId(aip,amp, atp);
3378    }
3379 
3380    if (AsnReadVal(aip, atp, &av) <= 0) {
3381       goto erret;
3382    }
3383    /* end struct */
3384 
3385 ret:
3386    AsnUnlinkType(orig);       /* unlink local tree */
3387    return ptr;
3388 
3389 erret:
3390    aip -> io_failure = TRUE;
3391    ptr = RegionPntrsFree(ptr);
3392    goto ret;
3393 }
3394 
3395 
3396 
3397 /**************************************************
3398 *
3399 *    Region_regionAsnRead()
3400 *
3401 **************************************************/
3402 static
3403 Region_regionPtr LIBCALL
Region_regionAsnRead(AsnIoPtr aip,AsnTypePtr orig)3404 Region_regionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3405 {
3406    DataVal av;
3407    AsnTypePtr atp;
3408    ValNodePtr anp;
3409    Uint1 choice;
3410    Boolean isError = FALSE;
3411    Boolean nullIsError = FALSE;
3412    AsnReadFunc func;
3413 
3414    if (! loaded)
3415    {
3416       if (! objmmdb3AsnLoad()) {
3417          return NULL;
3418       }
3419    }
3420 
3421    if (aip == NULL) {
3422       return NULL;
3423    }
3424 
3425    if (orig == NULL) {         /* Region_region ::= (self contained) */
3426       atp = AsnReadId(aip, amp, REGION_PNTRS_region);
3427    } else {
3428       atp = AsnLinkType(orig, REGION_PNTRS_region);    /* link in local tree */
3429    }
3430    if (atp == NULL) {
3431       return NULL;
3432    }
3433 
3434    anp = ValNodeNew(NULL);
3435    if (anp == NULL) {
3436       goto erret;
3437    }
3438    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
3439       goto erret;
3440    }
3441 
3442    func = NULL;
3443 
3444    atp = AsnReadId(aip, amp, atp);  /* find the choice */
3445    if (atp == NULL) {
3446       goto erret;
3447    }
3448    if (atp == REGION_PNTRS_region_site) {
3449       choice = Region_region_site;
3450       anp -> data.ptrvalue =
3451       AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) RegionCoordinatesAsnRead,             (AsnOptFreeFunc) RegionCoordinatesFree);
3452       if (isError && anp -> data.ptrvalue == NULL) {
3453          goto erret;
3454       }
3455    }
3456    else if (atp == REGION_PNTRS_region_boundary) {
3457       choice = Region_region_boundary;
3458       anp -> data.ptrvalue =
3459       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) RegionBoundaryAsnRead,             (AsnOptFreeFunc) RegionBoundaryFree);
3460       if (isError && anp -> data.ptrvalue == NULL) {
3461          goto erret;
3462       }
3463    }
3464    anp->choice = choice;
3465    if (func != NULL)
3466    {
3467       anp->data.ptrvalue = (* func)(aip, atp);
3468       if (aip -> io_failure) goto erret;
3469 
3470       if (nullIsError && anp->data.ptrvalue == NULL) {
3471          goto erret;
3472       }
3473    }
3474 
3475 ret:
3476    AsnUnlinkType(orig);       /* unlink local tree */
3477    return anp;
3478 
3479 erret:
3480    anp = MemFree(anp);
3481    aip -> io_failure = TRUE;
3482    goto ret;
3483 }
3484 
3485 
3486 /**************************************************
3487 *
3488 *    RegionPntrsAsnWrite()
3489 *
3490 **************************************************/
3491 NLM_EXTERN Boolean LIBCALL
RegionPntrsAsnWrite(RegionPntrsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3492 RegionPntrsAsnWrite(RegionPntrsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3493 {
3494    DataVal av;
3495    AsnTypePtr atp;
3496    Boolean retval = FALSE;
3497 
3498    if (! loaded)
3499    {
3500       if (! objmmdb3AsnLoad()) {
3501          return FALSE;
3502       }
3503    }
3504 
3505    if (aip == NULL) {
3506       return FALSE;
3507    }
3508 
3509    atp = AsnLinkType(orig, REGION_PNTRS);   /* link local tree */
3510    if (atp == NULL) {
3511       return FALSE;
3512    }
3513 
3514    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3515    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3516    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3517       goto erret;
3518    }
3519 
3520    av.intvalue = ptr -> model_id;
3521    retval = AsnWrite(aip, REGION_PNTRS_model_id,  &av);
3522    if (ptr -> Region_region != NULL) {
3523       if ( ! Region_regionAsnWrite(ptr -> Region_region, aip, REGION_PNTRS_region)) {
3524          goto erret;
3525       }
3526    }
3527    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3528       goto erret;
3529    }
3530    retval = TRUE;
3531 
3532 erret:
3533    AsnUnlinkType(orig);       /* unlink local tree */
3534    return retval;
3535 }
3536 
3537 
3538 
3539 /**************************************************
3540 *
3541 *    Region_regionAsnWrite()
3542 *
3543 **************************************************/
3544 static Boolean LIBCALL
Region_regionAsnWrite(Region_regionPtr anp,AsnIoPtr aip,AsnTypePtr orig)3545 Region_regionAsnWrite(Region_regionPtr anp, AsnIoPtr aip, AsnTypePtr orig)
3546 
3547 {
3548    DataVal av;
3549    AsnTypePtr atp, writetype = NULL;
3550    Pointer pnt;
3551    AsnWriteFunc func = NULL;
3552    Boolean retval = FALSE;
3553 
3554    if (! loaded)
3555    {
3556       if (! objmmdb3AsnLoad())
3557       return FALSE;
3558    }
3559 
3560    if (aip == NULL)
3561    return FALSE;
3562 
3563    atp = AsnLinkType(orig, REGION_PNTRS_region);   /* link local tree */
3564    if (atp == NULL) {
3565       return FALSE;
3566    }
3567 
3568    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3569    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3570    av.ptrvalue = (Pointer)anp;
3571    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
3572       goto erret;
3573    }
3574 
3575    pnt = anp->data.ptrvalue;
3576    switch (anp->choice)
3577    {
3578    case Region_region_site:
3579       retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) RegionCoordinatesAsnWrite, aip, REGION_PNTRS_region_site, REGION_PNTRS_region_site_E);
3580       break;
3581    case Region_region_boundary:
3582       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) RegionBoundaryAsnWrite, aip, REGION_PNTRS_region_boundary, REGION_PNTRS_region_boundary_E);
3583       break;
3584    }
3585    if (writetype != NULL) {
3586       retval = (* func)(pnt, aip, writetype);   /* write it out */
3587    }
3588    if (!retval) {
3589       goto erret;
3590    }
3591    retval = TRUE;
3592 
3593 erret:
3594    AsnUnlinkType(orig);       /* unlink local tree */
3595    return retval;
3596 }
3597 
3598 
3599 /**************************************************
3600 *
3601 *    RegionSimilarityNew()
3602 *
3603 **************************************************/
3604 NLM_EXTERN
3605 RegionSimilarityPtr LIBCALL
RegionSimilarityNew(void)3606 RegionSimilarityNew(void)
3607 {
3608    RegionSimilarityPtr ptr = MemNew((size_t) sizeof(RegionSimilarity));
3609 
3610    ptr -> dimension = 2;
3611    return ptr;
3612 
3613 }
3614 
3615 
3616 /**************************************************
3617 *
3618 *    RegionSimilarityFree()
3619 *
3620 **************************************************/
3621 NLM_EXTERN
3622 RegionSimilarityPtr LIBCALL
RegionSimilarityFree(RegionSimilarityPtr ptr)3623 RegionSimilarityFree(RegionSimilarityPtr ptr)
3624 {
3625 
3626    if(ptr == NULL) {
3627       return NULL;
3628    }
3629    AsnGenericChoiceSeqOfFree(ptr -> biostruc_ids, (AsnOptFreeFunc) BiostrucIdFree);
3630    AsnGenericUserSeqOfFree(ptr -> similarity, (AsnOptFreeFunc) RegionPntrsFree);
3631    AsnGenericUserSeqOfFree(ptr -> transform, (AsnOptFreeFunc) TransformFree);
3632    return MemFree(ptr);
3633 }
3634 
3635 
3636 /**************************************************
3637 *
3638 *    RegionSimilarityAsnRead()
3639 *
3640 **************************************************/
3641 NLM_EXTERN
3642 RegionSimilarityPtr LIBCALL
RegionSimilarityAsnRead(AsnIoPtr aip,AsnTypePtr orig)3643 RegionSimilarityAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3644 {
3645    DataVal av;
3646    AsnTypePtr atp;
3647    Boolean isError = FALSE;
3648    AsnReadFunc func;
3649    RegionSimilarityPtr ptr;
3650 
3651    if (! loaded)
3652    {
3653       if (! objmmdb3AsnLoad()) {
3654          return NULL;
3655       }
3656    }
3657 
3658    if (aip == NULL) {
3659       return NULL;
3660    }
3661 
3662    if (orig == NULL) {         /* RegionSimilarity ::= (self contained) */
3663       atp = AsnReadId(aip, amp, REGION_SIMILARITY);
3664    } else {
3665       atp = AsnLinkType(orig, REGION_SIMILARITY);
3666    }
3667    /* link in local tree */
3668    if (atp == NULL) {
3669       return NULL;
3670    }
3671 
3672    ptr = RegionSimilarityNew();
3673    if (ptr == NULL) {
3674       goto erret;
3675    }
3676    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3677       goto erret;
3678    }
3679 
3680    atp = AsnReadId(aip,amp, atp);
3681    func = NULL;
3682 
3683    if (atp == REGION_SIMILARITY_dimension) {
3684       if ( AsnReadVal(aip, atp, &av) <= 0) {
3685          goto erret;
3686       }
3687       ptr -> dimension = av.intvalue;
3688       atp = AsnReadId(aip,amp, atp);
3689    }
3690    if (atp == REGION_SIMILARITY_biostruc_ids) {
3691       ptr -> biostruc_ids = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BiostrucIdAsnRead, (AsnOptFreeFunc) BiostrucIdFree);
3692       if (isError && ptr -> biostruc_ids == NULL) {
3693          goto erret;
3694       }
3695       atp = AsnReadId(aip,amp, atp);
3696    }
3697    if (atp == REGION_SIMILARITY_similarity) {
3698       ptr -> similarity = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) RegionPntrsAsnRead, (AsnOptFreeFunc) RegionPntrsFree);
3699       if (isError && ptr -> similarity == NULL) {
3700          goto erret;
3701       }
3702       atp = AsnReadId(aip,amp, atp);
3703    }
3704    if (atp == REGION_SIMILARITY_transform) {
3705       ptr -> transform = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) TransformAsnRead, (AsnOptFreeFunc) TransformFree);
3706       if (isError && ptr -> transform == NULL) {
3707          goto erret;
3708       }
3709       atp = AsnReadId(aip,amp, atp);
3710    }
3711 
3712    if (AsnReadVal(aip, atp, &av) <= 0) {
3713       goto erret;
3714    }
3715    /* end struct */
3716 
3717 ret:
3718    AsnUnlinkType(orig);       /* unlink local tree */
3719    return ptr;
3720 
3721 erret:
3722    aip -> io_failure = TRUE;
3723    ptr = RegionSimilarityFree(ptr);
3724    goto ret;
3725 }
3726 
3727 
3728 
3729 /**************************************************
3730 *
3731 *    RegionSimilarityAsnWrite()
3732 *
3733 **************************************************/
3734 NLM_EXTERN Boolean LIBCALL
RegionSimilarityAsnWrite(RegionSimilarityPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3735 RegionSimilarityAsnWrite(RegionSimilarityPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3736 {
3737    DataVal av;
3738    AsnTypePtr atp;
3739    Boolean retval = FALSE;
3740 
3741    if (! loaded)
3742    {
3743       if (! objmmdb3AsnLoad()) {
3744          return FALSE;
3745       }
3746    }
3747 
3748    if (aip == NULL) {
3749       return FALSE;
3750    }
3751 
3752    atp = AsnLinkType(orig, REGION_SIMILARITY);   /* link local tree */
3753    if (atp == NULL) {
3754       return FALSE;
3755    }
3756 
3757    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3758    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3759    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3760       goto erret;
3761    }
3762 
3763    av.intvalue = ptr -> dimension;
3764    retval = AsnWrite(aip, REGION_SIMILARITY_dimension,  &av);
3765    AsnGenericChoiceSeqOfAsnWrite(ptr -> biostruc_ids, (AsnWriteFunc) BiostrucIdAsnWrite, aip, REGION_SIMILARITY_biostruc_ids, REGION_SIMILARITY_biostruc_ids_E);
3766    AsnGenericUserSeqOfAsnWrite(ptr -> similarity, (AsnWriteFunc) RegionPntrsAsnWrite, aip, REGION_SIMILARITY_similarity, REGION_SIMILARITY_similarity_E);
3767    AsnGenericUserSeqOfAsnWrite(ptr -> transform, (AsnWriteFunc) TransformAsnWrite, aip, REGION_SIMILARITY_transform, REGION_SIMILARITY_transform_E);
3768    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3769       goto erret;
3770    }
3771    retval = TRUE;
3772 
3773 erret:
3774    AsnUnlinkType(orig);       /* unlink local tree */
3775    return retval;
3776 }
3777 
3778 
3779 
3780 /**************************************************
3781 *
3782 *    OtherFeatureNew()
3783 *
3784 **************************************************/
3785 NLM_EXTERN
3786 OtherFeaturePtr LIBCALL
OtherFeatureNew(void)3787 OtherFeatureNew(void)
3788 {
3789    OtherFeaturePtr ptr = MemNew((size_t) sizeof(OtherFeature));
3790 
3791    return ptr;
3792 
3793 }
3794 
3795 
3796 /**************************************************
3797 *
3798 *    OtherFeatureFree()
3799 *
3800 **************************************************/
3801 NLM_EXTERN
3802 OtherFeaturePtr LIBCALL
OtherFeatureFree(OtherFeaturePtr ptr)3803 OtherFeatureFree(OtherFeaturePtr ptr)
3804 {
3805 
3806    if(ptr == NULL) {
3807       return NULL;
3808    }
3809    BiostrucIdFree(ptr -> biostruc_id);
3810    return MemFree(ptr);
3811 }
3812 
3813 
3814 /**************************************************
3815 *
3816 *    OtherFeatureAsnRead()
3817 *
3818 **************************************************/
3819 NLM_EXTERN
3820 OtherFeaturePtr LIBCALL
OtherFeatureAsnRead(AsnIoPtr aip,AsnTypePtr orig)3821 OtherFeatureAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3822 {
3823    DataVal av;
3824    AsnTypePtr atp;
3825    AsnReadFunc func;
3826    OtherFeaturePtr ptr;
3827 
3828    if (! loaded)
3829    {
3830       if (! objmmdb3AsnLoad()) {
3831          return NULL;
3832       }
3833    }
3834 
3835    if (aip == NULL) {
3836       return NULL;
3837    }
3838 
3839    if (orig == NULL) {         /* OtherFeature ::= (self contained) */
3840       atp = AsnReadId(aip, amp, OTHER_FEATURE);
3841    } else {
3842       atp = AsnLinkType(orig, OTHER_FEATURE);
3843    }
3844    /* link in local tree */
3845    if (atp == NULL) {
3846       return NULL;
3847    }
3848 
3849    ptr = OtherFeatureNew();
3850    if (ptr == NULL) {
3851       goto erret;
3852    }
3853    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3854       goto erret;
3855    }
3856 
3857    atp = AsnReadId(aip,amp, atp);
3858    func = NULL;
3859 
3860    if (atp == OTHER_FEATURE_biostruc_id) {
3861       ptr -> biostruc_id = BiostrucIdAsnRead(aip, atp);
3862       if (aip -> io_failure) {
3863          goto erret;
3864       }
3865       atp = AsnReadId(aip,amp, atp);
3866    }
3867    if (atp == OTHER_FEATURE_set) {
3868       if ( AsnReadVal(aip, atp, &av) <= 0) {
3869          goto erret;
3870       }
3871       ptr -> set = av.intvalue;
3872       atp = AsnReadId(aip,amp, atp);
3873    }
3874    if (atp == OTHER_FEATURE_feature) {
3875       if ( AsnReadVal(aip, atp, &av) <= 0) {
3876          goto erret;
3877       }
3878       ptr -> feature = av.intvalue;
3879       atp = AsnReadId(aip,amp, atp);
3880    }
3881 
3882    if (AsnReadVal(aip, atp, &av) <= 0) {
3883       goto erret;
3884    }
3885    /* end struct */
3886 
3887 ret:
3888    AsnUnlinkType(orig);       /* unlink local tree */
3889    return ptr;
3890 
3891 erret:
3892    aip -> io_failure = TRUE;
3893    ptr = OtherFeatureFree(ptr);
3894    goto ret;
3895 }
3896 
3897 
3898 
3899 /**************************************************
3900 *
3901 *    OtherFeatureAsnWrite()
3902 *
3903 **************************************************/
3904 NLM_EXTERN Boolean LIBCALL
OtherFeatureAsnWrite(OtherFeaturePtr ptr,AsnIoPtr aip,AsnTypePtr orig)3905 OtherFeatureAsnWrite(OtherFeaturePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3906 {
3907    DataVal av;
3908    AsnTypePtr atp;
3909    Boolean retval = FALSE;
3910 
3911    if (! loaded)
3912    {
3913       if (! objmmdb3AsnLoad()) {
3914          return FALSE;
3915       }
3916    }
3917 
3918    if (aip == NULL) {
3919       return FALSE;
3920    }
3921 
3922    atp = AsnLinkType(orig, OTHER_FEATURE);   /* link local tree */
3923    if (atp == NULL) {
3924       return FALSE;
3925    }
3926 
3927    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3928    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3929    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3930       goto erret;
3931    }
3932 
3933    if (ptr -> biostruc_id != NULL) {
3934       if ( ! BiostrucIdAsnWrite(ptr -> biostruc_id, aip, OTHER_FEATURE_biostruc_id)) {
3935          goto erret;
3936       }
3937    }
3938    av.intvalue = ptr -> set;
3939    retval = AsnWrite(aip, OTHER_FEATURE_set,  &av);
3940    av.intvalue = ptr -> feature;
3941    retval = AsnWrite(aip, OTHER_FEATURE_feature,  &av);
3942    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3943       goto erret;
3944    }
3945    retval = TRUE;
3946 
3947 erret:
3948    AsnUnlinkType(orig);       /* unlink local tree */
3949    return retval;
3950 }
3951 
3952 
3953 
3954 /**************************************************
3955 *
3956 *    BiostrucMoleculePntrNew()
3957 *
3958 **************************************************/
3959 NLM_EXTERN
3960 BiostrucMoleculePntrPtr LIBCALL
BiostrucMoleculePntrNew(void)3961 BiostrucMoleculePntrNew(void)
3962 {
3963    BiostrucMoleculePntrPtr ptr = MemNew((size_t) sizeof(BiostrucMoleculePntr));
3964 
3965    return ptr;
3966 
3967 }
3968 
3969 
3970 /**************************************************
3971 *
3972 *    BiostrucMoleculePntrFree()
3973 *
3974 **************************************************/
3975 NLM_EXTERN
3976 BiostrucMoleculePntrPtr LIBCALL
BiostrucMoleculePntrFree(BiostrucMoleculePntrPtr ptr)3977 BiostrucMoleculePntrFree(BiostrucMoleculePntrPtr ptr)
3978 {
3979 
3980    if(ptr == NULL) {
3981       return NULL;
3982    }
3983    BiostrucIdFree(ptr -> biostruc_id);
3984    return MemFree(ptr);
3985 }
3986 
3987 
3988 /**************************************************
3989 *
3990 *    BiostrucMoleculePntrAsnRead()
3991 *
3992 **************************************************/
3993 NLM_EXTERN
3994 BiostrucMoleculePntrPtr LIBCALL
BiostrucMoleculePntrAsnRead(AsnIoPtr aip,AsnTypePtr orig)3995 BiostrucMoleculePntrAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3996 {
3997    DataVal av;
3998    AsnTypePtr atp;
3999    AsnReadFunc func;
4000    BiostrucMoleculePntrPtr ptr;
4001 
4002    if (! loaded)
4003    {
4004       if (! objmmdb3AsnLoad()) {
4005          return NULL;
4006       }
4007    }
4008 
4009    if (aip == NULL) {
4010       return NULL;
4011    }
4012 
4013    if (orig == NULL) {         /* BiostrucMoleculePntr ::= (self contained) */
4014       atp = AsnReadId(aip, amp, BIOSTRUC_MOLECULE_PNTR);
4015    } else {
4016       atp = AsnLinkType(orig, BIOSTRUC_MOLECULE_PNTR);
4017    }
4018    /* link in local tree */
4019    if (atp == NULL) {
4020       return NULL;
4021    }
4022 
4023    ptr = BiostrucMoleculePntrNew();
4024    if (ptr == NULL) {
4025       goto erret;
4026    }
4027    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4028       goto erret;
4029    }
4030 
4031    atp = AsnReadId(aip,amp, atp);
4032    func = NULL;
4033 
4034    if (atp == BIOSTRUC_MOLECULE_PNTR_biostruc_id) {
4035       ptr -> biostruc_id = BiostrucIdAsnRead(aip, atp);
4036       if (aip -> io_failure) {
4037          goto erret;
4038       }
4039       atp = AsnReadId(aip,amp, atp);
4040    }
4041    if (atp == BIOSTRUC_MOLECULE_PNTR_molecule_id) {
4042       if ( AsnReadVal(aip, atp, &av) <= 0) {
4043          goto erret;
4044       }
4045       ptr -> molecule_id = av.intvalue;
4046       atp = AsnReadId(aip,amp, atp);
4047    }
4048 
4049    if (AsnReadVal(aip, atp, &av) <= 0) {
4050       goto erret;
4051    }
4052    /* end struct */
4053 
4054 ret:
4055    AsnUnlinkType(orig);       /* unlink local tree */
4056    return ptr;
4057 
4058 erret:
4059    aip -> io_failure = TRUE;
4060    ptr = BiostrucMoleculePntrFree(ptr);
4061    goto ret;
4062 }
4063 
4064 
4065 
4066 /**************************************************
4067 *
4068 *    BiostrucMoleculePntrAsnWrite()
4069 *
4070 **************************************************/
4071 NLM_EXTERN Boolean LIBCALL
BiostrucMoleculePntrAsnWrite(BiostrucMoleculePntrPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4072 BiostrucMoleculePntrAsnWrite(BiostrucMoleculePntrPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4073 {
4074    DataVal av;
4075    AsnTypePtr atp;
4076    Boolean retval = FALSE;
4077 
4078    if (! loaded)
4079    {
4080       if (! objmmdb3AsnLoad()) {
4081          return FALSE;
4082       }
4083    }
4084 
4085    if (aip == NULL) {
4086       return FALSE;
4087    }
4088 
4089    atp = AsnLinkType(orig, BIOSTRUC_MOLECULE_PNTR);   /* link local tree */
4090    if (atp == NULL) {
4091       return FALSE;
4092    }
4093 
4094    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4095    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4096    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4097       goto erret;
4098    }
4099 
4100    if (ptr -> biostruc_id != NULL) {
4101       if ( ! BiostrucIdAsnWrite(ptr -> biostruc_id, aip, BIOSTRUC_MOLECULE_PNTR_biostruc_id)) {
4102          goto erret;
4103       }
4104    }
4105    av.intvalue = ptr -> molecule_id;
4106    retval = AsnWrite(aip, BIOSTRUC_MOLECULE_PNTR_molecule_id,  &av);
4107    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4108       goto erret;
4109    }
4110    retval = TRUE;
4111 
4112 erret:
4113    AsnUnlinkType(orig);       /* unlink local tree */
4114    return retval;
4115 }
4116 
4117 
4118 
4119 /**************************************************
4120 *
4121 *    ResiduePntrsFree()
4122 *
4123 **************************************************/
4124 NLM_EXTERN
4125 ResiduePntrsPtr LIBCALL
ResiduePntrsFree(ValNodePtr anp)4126 ResiduePntrsFree(ValNodePtr anp)
4127 {
4128    Pointer pnt;
4129 
4130    if (anp == NULL) {
4131       return NULL;
4132    }
4133 
4134    pnt = anp->data.ptrvalue;
4135    switch (anp->choice)
4136    {
4137    default:
4138       break;
4139    case ResiduePntrs_explicit:
4140       ResidueExplicitPntrsFree(anp -> data.ptrvalue);
4141       break;
4142    case ResiduePntrs_interval:
4143       AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) ResidueIntervalPntrFree);
4144       break;
4145    }
4146    return MemFree(anp);
4147 }
4148 
4149 
4150 /**************************************************
4151 *
4152 *    ResiduePntrsAsnRead()
4153 *
4154 **************************************************/
4155 NLM_EXTERN
4156 ResiduePntrsPtr LIBCALL
ResiduePntrsAsnRead(AsnIoPtr aip,AsnTypePtr orig)4157 ResiduePntrsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4158 {
4159    DataVal av;
4160    AsnTypePtr atp;
4161    ValNodePtr anp;
4162    Uint1 choice;
4163    Boolean isError = FALSE;
4164    Boolean nullIsError = FALSE;
4165    AsnReadFunc func;
4166 
4167    if (! loaded)
4168    {
4169       if (! objmmdb3AsnLoad()) {
4170          return NULL;
4171       }
4172    }
4173 
4174    if (aip == NULL) {
4175       return NULL;
4176    }
4177 
4178    if (orig == NULL) {         /* ResiduePntrs ::= (self contained) */
4179       atp = AsnReadId(aip, amp, RESIDUE_PNTRS);
4180    } else {
4181       atp = AsnLinkType(orig, RESIDUE_PNTRS);    /* link in local tree */
4182    }
4183    if (atp == NULL) {
4184       return NULL;
4185    }
4186 
4187    anp = ValNodeNew(NULL);
4188    if (anp == NULL) {
4189       goto erret;
4190    }
4191    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
4192       goto erret;
4193    }
4194 
4195    func = NULL;
4196 
4197    atp = AsnReadId(aip, amp, atp);  /* find the choice */
4198    if (atp == NULL) {
4199       goto erret;
4200    }
4201    if (atp == RESIDUE_PNTRS_explicit) {
4202       choice = ResiduePntrs_explicit;
4203       func = (AsnReadFunc) ResidueExplicitPntrsAsnRead;
4204    }
4205    else if (atp == RESIDUE_PNTRS_interval) {
4206       choice = ResiduePntrs_interval;
4207       anp -> data.ptrvalue =
4208       AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ResidueIntervalPntrAsnRead,             (AsnOptFreeFunc) ResidueIntervalPntrFree);
4209       if (isError && anp -> data.ptrvalue == NULL) {
4210          goto erret;
4211       }
4212    }
4213    anp->choice = choice;
4214    if (func != NULL)
4215    {
4216       anp->data.ptrvalue = (* func)(aip, atp);
4217       if (aip -> io_failure) goto erret;
4218 
4219       if (nullIsError && anp->data.ptrvalue == NULL) {
4220          goto erret;
4221       }
4222    }
4223 
4224 ret:
4225    AsnUnlinkType(orig);       /* unlink local tree */
4226    return anp;
4227 
4228 erret:
4229    anp = MemFree(anp);
4230    aip -> io_failure = TRUE;
4231    goto ret;
4232 }
4233 
4234 
4235 /**************************************************
4236 *
4237 *    ResiduePntrsAsnWrite()
4238 *
4239 **************************************************/
4240 NLM_EXTERN Boolean LIBCALL
ResiduePntrsAsnWrite(ResiduePntrsPtr anp,AsnIoPtr aip,AsnTypePtr orig)4241 ResiduePntrsAsnWrite(ResiduePntrsPtr anp, AsnIoPtr aip, AsnTypePtr orig)
4242 
4243 {
4244    DataVal av;
4245    AsnTypePtr atp, writetype = NULL;
4246    Pointer pnt;
4247    AsnWriteFunc func = NULL;
4248    Boolean retval = FALSE;
4249 
4250    if (! loaded)
4251    {
4252       if (! objmmdb3AsnLoad())
4253       return FALSE;
4254    }
4255 
4256    if (aip == NULL)
4257    return FALSE;
4258 
4259    atp = AsnLinkType(orig, RESIDUE_PNTRS);   /* link local tree */
4260    if (atp == NULL) {
4261       return FALSE;
4262    }
4263 
4264    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4265    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4266    av.ptrvalue = (Pointer)anp;
4267    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
4268       goto erret;
4269    }
4270 
4271    pnt = anp->data.ptrvalue;
4272    switch (anp->choice)
4273    {
4274    case ResiduePntrs_explicit:
4275       writetype = RESIDUE_PNTRS_explicit;
4276       func = (AsnWriteFunc) ResidueExplicitPntrsAsnWrite;
4277       break;
4278    case ResiduePntrs_interval:
4279       retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) ResidueIntervalPntrAsnWrite, aip, RESIDUE_PNTRS_interval, RESIDUE_PNTRS_interval_E);
4280       break;
4281    }
4282    if (writetype != NULL) {
4283       retval = (* func)(pnt, aip, writetype);   /* write it out */
4284    }
4285    if (!retval) {
4286       goto erret;
4287    }
4288    retval = TRUE;
4289 
4290 erret:
4291    AsnUnlinkType(orig);       /* unlink local tree */
4292    return retval;
4293 }
4294 
4295 
4296 /**************************************************
4297 *
4298 *    MoleculePntrsNew()
4299 *
4300 **************************************************/
4301 NLM_EXTERN
4302 MoleculePntrsPtr LIBCALL
MoleculePntrsNew(void)4303 MoleculePntrsNew(void)
4304 {
4305    MoleculePntrsPtr ptr = MemNew((size_t) sizeof(MoleculePntrs));
4306 
4307    return ptr;
4308 
4309 }
4310 
4311 
4312 /**************************************************
4313 *
4314 *    MoleculePntrsFree()
4315 *
4316 **************************************************/
4317 NLM_EXTERN
4318 MoleculePntrsPtr LIBCALL
MoleculePntrsFree(MoleculePntrsPtr ptr)4319 MoleculePntrsFree(MoleculePntrsPtr ptr)
4320 {
4321 
4322    if(ptr == NULL) {
4323       return NULL;
4324    }
4325    AsnGenericBaseSeqOfFree(ptr -> molecule_ids ,ASNCODE_INTVAL_SLOT);
4326    return MemFree(ptr);
4327 }
4328 
4329 
4330 /**************************************************
4331 *
4332 *    MoleculePntrsAsnRead()
4333 *
4334 **************************************************/
4335 NLM_EXTERN
4336 MoleculePntrsPtr LIBCALL
MoleculePntrsAsnRead(AsnIoPtr aip,AsnTypePtr orig)4337 MoleculePntrsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4338 {
4339    DataVal av;
4340    AsnTypePtr atp;
4341    Boolean isError = FALSE;
4342    AsnReadFunc func;
4343    MoleculePntrsPtr ptr;
4344 
4345    if (! loaded)
4346    {
4347       if (! objmmdb3AsnLoad()) {
4348          return NULL;
4349       }
4350    }
4351 
4352    if (aip == NULL) {
4353       return NULL;
4354    }
4355 
4356    if (orig == NULL) {         /* MoleculePntrs ::= (self contained) */
4357       atp = AsnReadId(aip, amp, MOLECULE_PNTRS);
4358    } else {
4359       atp = AsnLinkType(orig, MOLECULE_PNTRS);
4360    }
4361    /* link in local tree */
4362    if (atp == NULL) {
4363       return NULL;
4364    }
4365 
4366    ptr = MoleculePntrsNew();
4367    if (ptr == NULL) {
4368       goto erret;
4369    }
4370    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4371       goto erret;
4372    }
4373 
4374    atp = AsnReadId(aip,amp, atp);
4375    func = NULL;
4376 
4377    if (atp == MOLECULE_PNTRS_number_of_ptrs) {
4378       if ( AsnReadVal(aip, atp, &av) <= 0) {
4379          goto erret;
4380       }
4381       ptr -> number_of_ptrs = av.intvalue;
4382       atp = AsnReadId(aip,amp, atp);
4383    }
4384    if (atp == MOLECULE_PNTRS_molecule_ids) {
4385       ptr -> molecule_ids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
4386       if (isError && ptr -> molecule_ids == NULL) {
4387          goto erret;
4388       }
4389       atp = AsnReadId(aip,amp, atp);
4390    }
4391 
4392    if (AsnReadVal(aip, atp, &av) <= 0) {
4393       goto erret;
4394    }
4395    /* end struct */
4396 
4397 ret:
4398    AsnUnlinkType(orig);       /* unlink local tree */
4399    return ptr;
4400 
4401 erret:
4402    aip -> io_failure = TRUE;
4403    ptr = MoleculePntrsFree(ptr);
4404    goto ret;
4405 }
4406 
4407 
4408 
4409 /**************************************************
4410 *
4411 *    MoleculePntrsAsnWrite()
4412 *
4413 **************************************************/
4414 NLM_EXTERN Boolean LIBCALL
MoleculePntrsAsnWrite(MoleculePntrsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4415 MoleculePntrsAsnWrite(MoleculePntrsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4416 {
4417    DataVal av;
4418    AsnTypePtr atp;
4419    Boolean retval = FALSE;
4420 
4421    if (! loaded)
4422    {
4423       if (! objmmdb3AsnLoad()) {
4424          return FALSE;
4425       }
4426    }
4427 
4428    if (aip == NULL) {
4429       return FALSE;
4430    }
4431 
4432    atp = AsnLinkType(orig, MOLECULE_PNTRS);   /* link local tree */
4433    if (atp == NULL) {
4434       return FALSE;
4435    }
4436 
4437    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4438    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4439    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4440       goto erret;
4441    }
4442 
4443    av.intvalue = ptr -> number_of_ptrs;
4444    retval = AsnWrite(aip, MOLECULE_PNTRS_number_of_ptrs,  &av);
4445    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> molecule_ids ,ASNCODE_INTVAL_SLOT, aip, MOLECULE_PNTRS_molecule_ids, MOLECULE_PNTRS_molecule_ids_E);
4446    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4447       goto erret;
4448    }
4449    retval = TRUE;
4450 
4451 erret:
4452    AsnUnlinkType(orig);       /* unlink local tree */
4453    return retval;
4454 }
4455 
4456 
4457 
4458 /**************************************************
4459 *
4460 *    ResidueExplicitPntrsNew()
4461 *
4462 **************************************************/
4463 NLM_EXTERN
4464 ResidueExplicitPntrsPtr LIBCALL
ResidueExplicitPntrsNew(void)4465 ResidueExplicitPntrsNew(void)
4466 {
4467    ResidueExplicitPntrsPtr ptr = MemNew((size_t) sizeof(ResidueExplicitPntrs));
4468 
4469    return ptr;
4470 
4471 }
4472 
4473 
4474 /**************************************************
4475 *
4476 *    ResidueExplicitPntrsFree()
4477 *
4478 **************************************************/
4479 NLM_EXTERN
4480 ResidueExplicitPntrsPtr LIBCALL
ResidueExplicitPntrsFree(ResidueExplicitPntrsPtr ptr)4481 ResidueExplicitPntrsFree(ResidueExplicitPntrsPtr ptr)
4482 {
4483 
4484    if(ptr == NULL) {
4485       return NULL;
4486    }
4487    AsnGenericBaseSeqOfFree(ptr -> molecule_ids ,ASNCODE_INTVAL_SLOT);
4488    AsnGenericBaseSeqOfFree(ptr -> residue_ids ,ASNCODE_INTVAL_SLOT);
4489    return MemFree(ptr);
4490 }
4491 
4492 
4493 /**************************************************
4494 *
4495 *    ResidueExplicitPntrsAsnRead()
4496 *
4497 **************************************************/
4498 NLM_EXTERN
4499 ResidueExplicitPntrsPtr LIBCALL
ResidueExplicitPntrsAsnRead(AsnIoPtr aip,AsnTypePtr orig)4500 ResidueExplicitPntrsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4501 {
4502    DataVal av;
4503    AsnTypePtr atp;
4504    Boolean isError = FALSE;
4505    AsnReadFunc func;
4506    ResidueExplicitPntrsPtr ptr;
4507 
4508    if (! loaded)
4509    {
4510       if (! objmmdb3AsnLoad()) {
4511          return NULL;
4512       }
4513    }
4514 
4515    if (aip == NULL) {
4516       return NULL;
4517    }
4518 
4519    if (orig == NULL) {         /* ResidueExplicitPntrs ::= (self contained) */
4520       atp = AsnReadId(aip, amp, RESIDUE_EXPLICIT_PNTRS);
4521    } else {
4522       atp = AsnLinkType(orig, RESIDUE_EXPLICIT_PNTRS);
4523    }
4524    /* link in local tree */
4525    if (atp == NULL) {
4526       return NULL;
4527    }
4528 
4529    ptr = ResidueExplicitPntrsNew();
4530    if (ptr == NULL) {
4531       goto erret;
4532    }
4533    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4534       goto erret;
4535    }
4536 
4537    atp = AsnReadId(aip,amp, atp);
4538    func = NULL;
4539 
4540    if (atp == RESIDUE_EXPLICIT_PNTRS_number_of_ptrs) {
4541       if ( AsnReadVal(aip, atp, &av) <= 0) {
4542          goto erret;
4543       }
4544       ptr -> number_of_ptrs = av.intvalue;
4545       atp = AsnReadId(aip,amp, atp);
4546    }
4547    if (atp == RESIDUE_EXPLICIT_PNTRS_molecule_ids) {
4548       ptr -> molecule_ids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
4549       if (isError && ptr -> molecule_ids == NULL) {
4550          goto erret;
4551       }
4552       atp = AsnReadId(aip,amp, atp);
4553    }
4554    if (atp == RESIDUE_EXPLICIT_PNTRS_residue_ids) {
4555       ptr -> residue_ids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
4556       if (isError && ptr -> residue_ids == NULL) {
4557          goto erret;
4558       }
4559       atp = AsnReadId(aip,amp, atp);
4560    }
4561 
4562    if (AsnReadVal(aip, atp, &av) <= 0) {
4563       goto erret;
4564    }
4565    /* end struct */
4566 
4567 ret:
4568    AsnUnlinkType(orig);       /* unlink local tree */
4569    return ptr;
4570 
4571 erret:
4572    aip -> io_failure = TRUE;
4573    ptr = ResidueExplicitPntrsFree(ptr);
4574    goto ret;
4575 }
4576 
4577 
4578 
4579 /**************************************************
4580 *
4581 *    ResidueExplicitPntrsAsnWrite()
4582 *
4583 **************************************************/
4584 NLM_EXTERN Boolean LIBCALL
ResidueExplicitPntrsAsnWrite(ResidueExplicitPntrsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4585 ResidueExplicitPntrsAsnWrite(ResidueExplicitPntrsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4586 {
4587    DataVal av;
4588    AsnTypePtr atp;
4589    Boolean retval = FALSE;
4590 
4591    if (! loaded)
4592    {
4593       if (! objmmdb3AsnLoad()) {
4594          return FALSE;
4595       }
4596    }
4597 
4598    if (aip == NULL) {
4599       return FALSE;
4600    }
4601 
4602    atp = AsnLinkType(orig, RESIDUE_EXPLICIT_PNTRS);   /* link local tree */
4603    if (atp == NULL) {
4604       return FALSE;
4605    }
4606 
4607    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4608    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4609    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4610       goto erret;
4611    }
4612 
4613    av.intvalue = ptr -> number_of_ptrs;
4614    retval = AsnWrite(aip, RESIDUE_EXPLICIT_PNTRS_number_of_ptrs,  &av);
4615    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> molecule_ids ,ASNCODE_INTVAL_SLOT, aip, RESIDUE_EXPLICIT_PNTRS_molecule_ids, RESIDUE_EXPLICIT_PNTRS_molecule_ids_E);
4616    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> residue_ids ,ASNCODE_INTVAL_SLOT, aip, RESIDUE_EXPLICIT_PNTRS_residue_ids, RESIDUE_EXPLICIT_PNTRS_residue_ids_E);
4617    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4618       goto erret;
4619    }
4620    retval = TRUE;
4621 
4622 erret:
4623    AsnUnlinkType(orig);       /* unlink local tree */
4624    return retval;
4625 }
4626 
4627 
4628 
4629 /**************************************************
4630 *
4631 *    ResidueIntervalPntrNew()
4632 *
4633 **************************************************/
4634 NLM_EXTERN
4635 ResidueIntervalPntrPtr LIBCALL
ResidueIntervalPntrNew(void)4636 ResidueIntervalPntrNew(void)
4637 {
4638    ResidueIntervalPntrPtr ptr = MemNew((size_t) sizeof(ResidueIntervalPntr));
4639 
4640    return ptr;
4641 
4642 }
4643 
4644 
4645 /**************************************************
4646 *
4647 *    ResidueIntervalPntrFree()
4648 *
4649 **************************************************/
4650 NLM_EXTERN
4651 ResidueIntervalPntrPtr LIBCALL
ResidueIntervalPntrFree(ResidueIntervalPntrPtr ptr)4652 ResidueIntervalPntrFree(ResidueIntervalPntrPtr ptr)
4653 {
4654 
4655    if(ptr == NULL) {
4656       return NULL;
4657    }
4658    return MemFree(ptr);
4659 }
4660 
4661 
4662 /**************************************************
4663 *
4664 *    ResidueIntervalPntrAsnRead()
4665 *
4666 **************************************************/
4667 NLM_EXTERN
4668 ResidueIntervalPntrPtr LIBCALL
ResidueIntervalPntrAsnRead(AsnIoPtr aip,AsnTypePtr orig)4669 ResidueIntervalPntrAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4670 {
4671    DataVal av;
4672    AsnTypePtr atp;
4673    AsnReadFunc func;
4674    ResidueIntervalPntrPtr ptr;
4675 
4676    if (! loaded)
4677    {
4678       if (! objmmdb3AsnLoad()) {
4679          return NULL;
4680       }
4681    }
4682 
4683    if (aip == NULL) {
4684       return NULL;
4685    }
4686 
4687    if (orig == NULL) {         /* ResidueIntervalPntr ::= (self contained) */
4688       atp = AsnReadId(aip, amp, RESIDUE_INTERVAL_PNTR);
4689    } else {
4690       atp = AsnLinkType(orig, RESIDUE_INTERVAL_PNTR);
4691    }
4692    /* link in local tree */
4693    if (atp == NULL) {
4694       return NULL;
4695    }
4696 
4697    ptr = ResidueIntervalPntrNew();
4698    if (ptr == NULL) {
4699       goto erret;
4700    }
4701    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4702       goto erret;
4703    }
4704 
4705    atp = AsnReadId(aip,amp, atp);
4706    func = NULL;
4707 
4708    if (atp == RESIDUE_INTERVAL_PNTR_molecule_id) {
4709       if ( AsnReadVal(aip, atp, &av) <= 0) {
4710          goto erret;
4711       }
4712       ptr -> molecule_id = av.intvalue;
4713       atp = AsnReadId(aip,amp, atp);
4714    }
4715    if (atp == RESIDUE_INTERVAL_PNTR_from) {
4716       if ( AsnReadVal(aip, atp, &av) <= 0) {
4717          goto erret;
4718       }
4719       ptr -> from = av.intvalue;
4720       atp = AsnReadId(aip,amp, atp);
4721    }
4722    if (atp == RESIDUE_INTERVAL_PNTR_to) {
4723       if ( AsnReadVal(aip, atp, &av) <= 0) {
4724          goto erret;
4725       }
4726       ptr -> to = av.intvalue;
4727       atp = AsnReadId(aip,amp, atp);
4728    }
4729 
4730    if (AsnReadVal(aip, atp, &av) <= 0) {
4731       goto erret;
4732    }
4733    /* end struct */
4734 
4735 ret:
4736    AsnUnlinkType(orig);       /* unlink local tree */
4737    return ptr;
4738 
4739 erret:
4740    aip -> io_failure = TRUE;
4741    ptr = ResidueIntervalPntrFree(ptr);
4742    goto ret;
4743 }
4744 
4745 
4746 
4747 /**************************************************
4748 *
4749 *    ResidueIntervalPntrAsnWrite()
4750 *
4751 **************************************************/
4752 NLM_EXTERN Boolean LIBCALL
ResidueIntervalPntrAsnWrite(ResidueIntervalPntrPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4753 ResidueIntervalPntrAsnWrite(ResidueIntervalPntrPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4754 {
4755    DataVal av;
4756    AsnTypePtr atp;
4757    Boolean retval = FALSE;
4758 
4759    if (! loaded)
4760    {
4761       if (! objmmdb3AsnLoad()) {
4762          return FALSE;
4763       }
4764    }
4765 
4766    if (aip == NULL) {
4767       return FALSE;
4768    }
4769 
4770    atp = AsnLinkType(orig, RESIDUE_INTERVAL_PNTR);   /* link local tree */
4771    if (atp == NULL) {
4772       return FALSE;
4773    }
4774 
4775    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4776    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4777    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4778       goto erret;
4779    }
4780 
4781    av.intvalue = ptr -> molecule_id;
4782    retval = AsnWrite(aip, RESIDUE_INTERVAL_PNTR_molecule_id,  &av);
4783    av.intvalue = ptr -> from;
4784    retval = AsnWrite(aip, RESIDUE_INTERVAL_PNTR_from,  &av);
4785    av.intvalue = ptr -> to;
4786    retval = AsnWrite(aip, RESIDUE_INTERVAL_PNTR_to,  &av);
4787    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4788       goto erret;
4789    }
4790    retval = TRUE;
4791 
4792 erret:
4793    AsnUnlinkType(orig);       /* unlink local tree */
4794    return retval;
4795 }
4796 
4797 
4798 
4799 /**************************************************
4800 *
4801 *    RegionCoordinatesNew()
4802 *
4803 **************************************************/
4804 NLM_EXTERN
4805 RegionCoordinatesPtr LIBCALL
RegionCoordinatesNew(void)4806 RegionCoordinatesNew(void)
4807 {
4808    RegionCoordinatesPtr ptr = MemNew((size_t) sizeof(RegionCoordinates));
4809 
4810    return ptr;
4811 
4812 }
4813 
4814 
4815 /**************************************************
4816 *
4817 *    RegionCoordinatesFree()
4818 *
4819 **************************************************/
4820 NLM_EXTERN
4821 RegionCoordinatesPtr LIBCALL
RegionCoordinatesFree(RegionCoordinatesPtr ptr)4822 RegionCoordinatesFree(RegionCoordinatesPtr ptr)
4823 {
4824 
4825    if(ptr == NULL) {
4826       return NULL;
4827    }
4828    AsnGenericBaseSeqOfFree(ptr -> coordinate_indices ,ASNCODE_INTVAL_SLOT);
4829    return MemFree(ptr);
4830 }
4831 
4832 
4833 /**************************************************
4834 *
4835 *    RegionCoordinatesAsnRead()
4836 *
4837 **************************************************/
4838 NLM_EXTERN
4839 RegionCoordinatesPtr LIBCALL
RegionCoordinatesAsnRead(AsnIoPtr aip,AsnTypePtr orig)4840 RegionCoordinatesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4841 {
4842    DataVal av;
4843    AsnTypePtr atp;
4844    Boolean isError = FALSE;
4845    AsnReadFunc func;
4846    RegionCoordinatesPtr ptr;
4847 
4848    if (! loaded)
4849    {
4850       if (! objmmdb3AsnLoad()) {
4851          return NULL;
4852       }
4853    }
4854 
4855    if (aip == NULL) {
4856       return NULL;
4857    }
4858 
4859    if (orig == NULL) {         /* RegionCoordinates ::= (self contained) */
4860       atp = AsnReadId(aip, amp, REGION_COORDINATES);
4861    } else {
4862       atp = AsnLinkType(orig, REGION_COORDINATES);
4863    }
4864    /* link in local tree */
4865    if (atp == NULL) {
4866       return NULL;
4867    }
4868 
4869    ptr = RegionCoordinatesNew();
4870    if (ptr == NULL) {
4871       goto erret;
4872    }
4873    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4874       goto erret;
4875    }
4876 
4877    atp = AsnReadId(aip,amp, atp);
4878    func = NULL;
4879 
4880    if (atp == REGION_COORDINATES_model_coord_set_id) {
4881       if ( AsnReadVal(aip, atp, &av) <= 0) {
4882          goto erret;
4883       }
4884       ptr -> model_coord_set_id = av.intvalue;
4885       atp = AsnReadId(aip,amp, atp);
4886    }
4887    if (atp == REGION_COORDINATES_number_of_coords) {
4888       if ( AsnReadVal(aip, atp, &av) <= 0) {
4889          goto erret;
4890       }
4891       ptr -> number_of_coords = av.intvalue;
4892       ptr -> OBbits__ |= 1<<0;
4893       atp = AsnReadId(aip,amp, atp);
4894    }
4895    if (atp == REGION_COORDINATES_coordinate_indices) {
4896       ptr -> coordinate_indices = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
4897       if (isError && ptr -> coordinate_indices == NULL) {
4898          goto erret;
4899       }
4900       atp = AsnReadId(aip,amp, atp);
4901    }
4902 
4903    if (AsnReadVal(aip, atp, &av) <= 0) {
4904       goto erret;
4905    }
4906    /* end struct */
4907 
4908 ret:
4909    AsnUnlinkType(orig);       /* unlink local tree */
4910    return ptr;
4911 
4912 erret:
4913    aip -> io_failure = TRUE;
4914    ptr = RegionCoordinatesFree(ptr);
4915    goto ret;
4916 }
4917 
4918 
4919 
4920 /**************************************************
4921 *
4922 *    RegionCoordinatesAsnWrite()
4923 *
4924 **************************************************/
4925 NLM_EXTERN Boolean LIBCALL
RegionCoordinatesAsnWrite(RegionCoordinatesPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4926 RegionCoordinatesAsnWrite(RegionCoordinatesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4927 {
4928    DataVal av;
4929    AsnTypePtr atp;
4930    Boolean retval = FALSE;
4931 
4932    if (! loaded)
4933    {
4934       if (! objmmdb3AsnLoad()) {
4935          return FALSE;
4936       }
4937    }
4938 
4939    if (aip == NULL) {
4940       return FALSE;
4941    }
4942 
4943    atp = AsnLinkType(orig, REGION_COORDINATES);   /* link local tree */
4944    if (atp == NULL) {
4945       return FALSE;
4946    }
4947 
4948    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4949    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
4950    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4951       goto erret;
4952    }
4953 
4954    av.intvalue = ptr -> model_coord_set_id;
4955    retval = AsnWrite(aip, REGION_COORDINATES_model_coord_set_id,  &av);
4956    if (ptr -> number_of_coords || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> number_of_coords;
4957       retval = AsnWrite(aip, REGION_COORDINATES_number_of_coords,  &av);
4958    }
4959    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> coordinate_indices ,ASNCODE_INTVAL_SLOT, aip, REGION_COORDINATES_coordinate_indices, REGION_COORDINATES_coordinate_indices_E);
4960    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4961       goto erret;
4962    }
4963    retval = TRUE;
4964 
4965 erret:
4966    AsnUnlinkType(orig);       /* unlink local tree */
4967    return retval;
4968 }
4969 
4970 
4971 
4972 /**************************************************
4973 *
4974 *    RegionBoundaryFree()
4975 *
4976 **************************************************/
4977 NLM_EXTERN
4978 RegionBoundaryPtr LIBCALL
RegionBoundaryFree(ValNodePtr anp)4979 RegionBoundaryFree(ValNodePtr anp)
4980 {
4981    Pointer pnt;
4982 
4983    if (anp == NULL) {
4984       return NULL;
4985    }
4986 
4987    pnt = anp->data.ptrvalue;
4988    switch (anp->choice)
4989    {
4990    default:
4991       break;
4992    case RegionBoundary_sphere:
4993       SphereFree(anp -> data.ptrvalue);
4994       break;
4995    case RegionBoundary_cone:
4996       ConeFree(anp -> data.ptrvalue);
4997       break;
4998    case RegionBoundary_cylinder:
4999       CylinderFree(anp -> data.ptrvalue);
5000       break;
5001    case RegionBoundary_brick:
5002       BrickFree(anp -> data.ptrvalue);
5003       break;
5004    }
5005    return MemFree(anp);
5006 }
5007 
5008 
5009 /**************************************************
5010 *
5011 *    RegionBoundaryAsnRead()
5012 *
5013 **************************************************/
5014 NLM_EXTERN
5015 RegionBoundaryPtr LIBCALL
RegionBoundaryAsnRead(AsnIoPtr aip,AsnTypePtr orig)5016 RegionBoundaryAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5017 {
5018    DataVal av;
5019    AsnTypePtr atp;
5020    ValNodePtr anp;
5021    Uint1 choice;
5022    Boolean nullIsError = FALSE;
5023    AsnReadFunc func;
5024 
5025    if (! loaded)
5026    {
5027       if (! objmmdb3AsnLoad()) {
5028          return NULL;
5029       }
5030    }
5031 
5032    if (aip == NULL) {
5033       return NULL;
5034    }
5035 
5036    if (orig == NULL) {         /* RegionBoundary ::= (self contained) */
5037       atp = AsnReadId(aip, amp, REGION_BOUNDARY);
5038    } else {
5039       atp = AsnLinkType(orig, REGION_BOUNDARY);    /* link in local tree */
5040    }
5041    if (atp == NULL) {
5042       return NULL;
5043    }
5044 
5045    anp = ValNodeNew(NULL);
5046    if (anp == NULL) {
5047       goto erret;
5048    }
5049    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
5050       goto erret;
5051    }
5052 
5053    func = NULL;
5054 
5055    atp = AsnReadId(aip, amp, atp);  /* find the choice */
5056    if (atp == NULL) {
5057       goto erret;
5058    }
5059    if (atp == REGION_BOUNDARY_sphere) {
5060       choice = RegionBoundary_sphere;
5061       func = (AsnReadFunc) SphereAsnRead;
5062    }
5063    else if (atp == REGION_BOUNDARY_cone) {
5064       choice = RegionBoundary_cone;
5065       func = (AsnReadFunc) ConeAsnRead;
5066    }
5067    else if (atp == REGION_BOUNDARY_cylinder) {
5068       choice = RegionBoundary_cylinder;
5069       func = (AsnReadFunc) CylinderAsnRead;
5070    }
5071    else if (atp == REGION_BOUNDARY_brick) {
5072       choice = RegionBoundary_brick;
5073       func = (AsnReadFunc) BrickAsnRead;
5074    }
5075    anp->choice = choice;
5076    if (func != NULL)
5077    {
5078       anp->data.ptrvalue = (* func)(aip, atp);
5079       if (aip -> io_failure) goto erret;
5080 
5081       if (nullIsError && anp->data.ptrvalue == NULL) {
5082          goto erret;
5083       }
5084    }
5085 
5086 ret:
5087    AsnUnlinkType(orig);       /* unlink local tree */
5088    return anp;
5089 
5090 erret:
5091    anp = MemFree(anp);
5092    aip -> io_failure = TRUE;
5093    goto ret;
5094 }
5095 
5096 
5097 /**************************************************
5098 *
5099 *    RegionBoundaryAsnWrite()
5100 *
5101 **************************************************/
5102 NLM_EXTERN Boolean LIBCALL
RegionBoundaryAsnWrite(RegionBoundaryPtr anp,AsnIoPtr aip,AsnTypePtr orig)5103 RegionBoundaryAsnWrite(RegionBoundaryPtr anp, AsnIoPtr aip, AsnTypePtr orig)
5104 
5105 {
5106    DataVal av;
5107    AsnTypePtr atp, writetype = NULL;
5108    Pointer pnt;
5109    AsnWriteFunc func = NULL;
5110    Boolean retval = FALSE;
5111 
5112    if (! loaded)
5113    {
5114       if (! objmmdb3AsnLoad())
5115       return FALSE;
5116    }
5117 
5118    if (aip == NULL)
5119    return FALSE;
5120 
5121    atp = AsnLinkType(orig, REGION_BOUNDARY);   /* link local tree */
5122    if (atp == NULL) {
5123       return FALSE;
5124    }
5125 
5126    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5127    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5128    av.ptrvalue = (Pointer)anp;
5129    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
5130       goto erret;
5131    }
5132 
5133    pnt = anp->data.ptrvalue;
5134    switch (anp->choice)
5135    {
5136    case RegionBoundary_sphere:
5137       writetype = REGION_BOUNDARY_sphere;
5138       func = (AsnWriteFunc) SphereAsnWrite;
5139       break;
5140    case RegionBoundary_cone:
5141       writetype = REGION_BOUNDARY_cone;
5142       func = (AsnWriteFunc) ConeAsnWrite;
5143       break;
5144    case RegionBoundary_cylinder:
5145       writetype = REGION_BOUNDARY_cylinder;
5146       func = (AsnWriteFunc) CylinderAsnWrite;
5147       break;
5148    case RegionBoundary_brick:
5149       writetype = REGION_BOUNDARY_brick;
5150       func = (AsnWriteFunc) BrickAsnWrite;
5151       break;
5152    }
5153    if (writetype != NULL) {
5154       retval = (* func)(pnt, aip, writetype);   /* write it out */
5155    }
5156    if (!retval) {
5157       goto erret;
5158    }
5159    retval = TRUE;
5160 
5161 erret:
5162    AsnUnlinkType(orig);       /* unlink local tree */
5163    return retval;
5164 }
5165 
5166 
5167 /**************************************************
5168 *
5169 *    AlignStatsNew()
5170 *
5171 **************************************************/
5172 NLM_EXTERN
5173 AlignStatsPtr LIBCALL
AlignStatsNew(void)5174 AlignStatsNew(void)
5175 {
5176    AlignStatsPtr ptr = MemNew((size_t) sizeof(AlignStats));
5177 
5178    return ptr;
5179 
5180 }
5181 
5182 
5183 /**************************************************
5184 *
5185 *    AlignStatsFree()
5186 *
5187 **************************************************/
5188 NLM_EXTERN
5189 AlignStatsPtr LIBCALL
AlignStatsFree(AlignStatsPtr ptr)5190 AlignStatsFree(AlignStatsPtr ptr)
5191 {
5192 
5193    if(ptr == NULL) {
5194       return NULL;
5195    }
5196    MemFree(ptr -> descr);
5197    return MemFree(ptr);
5198 }
5199 
5200 
5201 /**************************************************
5202 *
5203 *    AlignStatsAsnRead()
5204 *
5205 **************************************************/
5206 NLM_EXTERN
5207 AlignStatsPtr LIBCALL
AlignStatsAsnRead(AsnIoPtr aip,AsnTypePtr orig)5208 AlignStatsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5209 {
5210    DataVal av;
5211    AsnTypePtr atp;
5212    AsnReadFunc func;
5213    AlignStatsPtr ptr;
5214 
5215    if (! loaded)
5216    {
5217       if (! objmmdb3AsnLoad()) {
5218          return NULL;
5219       }
5220    }
5221 
5222    if (aip == NULL) {
5223       return NULL;
5224    }
5225 
5226    if (orig == NULL) {         /* AlignStats ::= (self contained) */
5227       atp = AsnReadId(aip, amp, ALIGN_STATS);
5228    } else {
5229       atp = AsnLinkType(orig, ALIGN_STATS);
5230    }
5231    /* link in local tree */
5232    if (atp == NULL) {
5233       return NULL;
5234    }
5235 
5236    ptr = AlignStatsNew();
5237    if (ptr == NULL) {
5238       goto erret;
5239    }
5240    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5241       goto erret;
5242    }
5243 
5244    atp = AsnReadId(aip,amp, atp);
5245    func = NULL;
5246 
5247    if (atp == ALIGN_STATS_descr) {
5248       if ( AsnReadVal(aip, atp, &av) <= 0) {
5249          goto erret;
5250       }
5251       ptr -> descr = av.ptrvalue;
5252       atp = AsnReadId(aip,amp, atp);
5253    }
5254    if (atp == ALIGN_STATS_scale_factor) {
5255       if ( AsnReadVal(aip, atp, &av) <= 0) {
5256          goto erret;
5257       }
5258       ptr -> scale_factor = av.intvalue;
5259       ptr -> OBbits__ |= 1<<0;
5260       atp = AsnReadId(aip,amp, atp);
5261    }
5262    if (atp == ALIGN_STATS_vast_score) {
5263       if ( AsnReadVal(aip, atp, &av) <= 0) {
5264          goto erret;
5265       }
5266       ptr -> vast_score = av.intvalue;
5267       ptr -> OBbits__ |= 1<<1;
5268       atp = AsnReadId(aip,amp, atp);
5269    }
5270    if (atp == ALIGN_STATS_vast_mlogp) {
5271       if ( AsnReadVal(aip, atp, &av) <= 0) {
5272          goto erret;
5273       }
5274       ptr -> vast_mlogp = av.intvalue;
5275       ptr -> OBbits__ |= 1<<2;
5276       atp = AsnReadId(aip,amp, atp);
5277    }
5278    if (atp == ALIGN_STATS_align_res) {
5279       if ( AsnReadVal(aip, atp, &av) <= 0) {
5280          goto erret;
5281       }
5282       ptr -> align_res = av.intvalue;
5283       ptr -> OBbits__ |= 1<<3;
5284       atp = AsnReadId(aip,amp, atp);
5285    }
5286    if (atp == ALIGN_STATS_rmsd) {
5287       if ( AsnReadVal(aip, atp, &av) <= 0) {
5288          goto erret;
5289       }
5290       ptr -> rmsd = av.intvalue;
5291       ptr -> OBbits__ |= 1<<4;
5292       atp = AsnReadId(aip,amp, atp);
5293    }
5294    if (atp == ALIGN_STATS_blast_score) {
5295       if ( AsnReadVal(aip, atp, &av) <= 0) {
5296          goto erret;
5297       }
5298       ptr -> blast_score = av.intvalue;
5299       ptr -> OBbits__ |= 1<<5;
5300       atp = AsnReadId(aip,amp, atp);
5301    }
5302    if (atp == ALIGN_STATS_blast_mlogp) {
5303       if ( AsnReadVal(aip, atp, &av) <= 0) {
5304          goto erret;
5305       }
5306       ptr -> blast_mlogp = av.intvalue;
5307       ptr -> OBbits__ |= 1<<6;
5308       atp = AsnReadId(aip,amp, atp);
5309    }
5310    if (atp == ALIGN_STATS_other_score) {
5311       if ( AsnReadVal(aip, atp, &av) <= 0) {
5312          goto erret;
5313       }
5314       ptr -> other_score = av.intvalue;
5315       ptr -> OBbits__ |= 1<<7;
5316       atp = AsnReadId(aip,amp, atp);
5317    }
5318 
5319    if (AsnReadVal(aip, atp, &av) <= 0) {
5320       goto erret;
5321    }
5322    /* end struct */
5323 
5324 ret:
5325    AsnUnlinkType(orig);       /* unlink local tree */
5326    return ptr;
5327 
5328 erret:
5329    aip -> io_failure = TRUE;
5330    ptr = AlignStatsFree(ptr);
5331    goto ret;
5332 }
5333 
5334 
5335 
5336 /**************************************************
5337 *
5338 *    AlignStatsAsnWrite()
5339 *
5340 **************************************************/
5341 NLM_EXTERN Boolean LIBCALL
AlignStatsAsnWrite(AlignStatsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)5342 AlignStatsAsnWrite(AlignStatsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5343 {
5344    DataVal av;
5345    AsnTypePtr atp;
5346    Boolean retval = FALSE;
5347 
5348    if (! loaded)
5349    {
5350       if (! objmmdb3AsnLoad()) {
5351          return FALSE;
5352       }
5353    }
5354 
5355    if (aip == NULL) {
5356       return FALSE;
5357    }
5358 
5359    atp = AsnLinkType(orig, ALIGN_STATS);   /* link local tree */
5360    if (atp == NULL) {
5361       return FALSE;
5362    }
5363 
5364    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5365    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5366    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5367       goto erret;
5368    }
5369 
5370    if (ptr -> descr != NULL) {
5371       av.ptrvalue = ptr -> descr;
5372       retval = AsnWrite(aip, ALIGN_STATS_descr,  &av);
5373    }
5374    if (ptr -> scale_factor || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> scale_factor;
5375       retval = AsnWrite(aip, ALIGN_STATS_scale_factor,  &av);
5376    }
5377    if (ptr -> vast_score || (ptr -> OBbits__ & (1<<1) )){   av.intvalue = ptr -> vast_score;
5378       retval = AsnWrite(aip, ALIGN_STATS_vast_score,  &av);
5379    }
5380    if (ptr -> vast_mlogp || (ptr -> OBbits__ & (1<<2) )){   av.intvalue = ptr -> vast_mlogp;
5381       retval = AsnWrite(aip, ALIGN_STATS_vast_mlogp,  &av);
5382    }
5383    if (ptr -> align_res || (ptr -> OBbits__ & (1<<3) )){   av.intvalue = ptr -> align_res;
5384       retval = AsnWrite(aip, ALIGN_STATS_align_res,  &av);
5385    }
5386    if (ptr -> rmsd || (ptr -> OBbits__ & (1<<4) )){   av.intvalue = ptr -> rmsd;
5387       retval = AsnWrite(aip, ALIGN_STATS_rmsd,  &av);
5388    }
5389    if (ptr -> blast_score || (ptr -> OBbits__ & (1<<5) )){   av.intvalue = ptr -> blast_score;
5390       retval = AsnWrite(aip, ALIGN_STATS_blast_score,  &av);
5391    }
5392    if (ptr -> blast_mlogp || (ptr -> OBbits__ & (1<<6) )){   av.intvalue = ptr -> blast_mlogp;
5393       retval = AsnWrite(aip, ALIGN_STATS_blast_mlogp,  &av);
5394    }
5395    if (ptr -> other_score || (ptr -> OBbits__ & (1<<7) )){   av.intvalue = ptr -> other_score;
5396       retval = AsnWrite(aip, ALIGN_STATS_other_score,  &av);
5397    }
5398    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5399       goto erret;
5400    }
5401    retval = TRUE;
5402 
5403 erret:
5404    AsnUnlinkType(orig);       /* unlink local tree */
5405    return retval;
5406 }
5407 
5408 
5409 
5410 /**************************************************
5411 *
5412 *    RealValueNew()
5413 *
5414 **************************************************/
5415 NLM_EXTERN
5416 RealValuePtr LIBCALL
RealValueNew(void)5417 RealValueNew(void)
5418 {
5419    RealValuePtr ptr = MemNew((size_t) sizeof(RealValue));
5420 
5421    return ptr;
5422 
5423 }
5424 
5425 
5426 /**************************************************
5427 *
5428 *    RealValueFree()
5429 *
5430 **************************************************/
5431 NLM_EXTERN
5432 RealValuePtr LIBCALL
RealValueFree(RealValuePtr ptr)5433 RealValueFree(RealValuePtr ptr)
5434 {
5435 
5436    if(ptr == NULL) {
5437       return NULL;
5438    }
5439    return MemFree(ptr);
5440 }
5441 
5442 
5443 /**************************************************
5444 *
5445 *    RealValueAsnRead()
5446 *
5447 **************************************************/
5448 NLM_EXTERN
5449 RealValuePtr LIBCALL
RealValueAsnRead(AsnIoPtr aip,AsnTypePtr orig)5450 RealValueAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5451 {
5452    DataVal av;
5453    AsnTypePtr atp;
5454    AsnReadFunc func;
5455    RealValuePtr ptr;
5456 
5457    if (! loaded)
5458    {
5459       if (! objmmdb3AsnLoad()) {
5460          return NULL;
5461       }
5462    }
5463 
5464    if (aip == NULL) {
5465       return NULL;
5466    }
5467 
5468    if (orig == NULL) {         /* RealValue ::= (self contained) */
5469       atp = AsnReadId(aip, amp, REALVALUE);
5470    } else {
5471       atp = AsnLinkType(orig, REALVALUE);
5472    }
5473    /* link in local tree */
5474    if (atp == NULL) {
5475       return NULL;
5476    }
5477 
5478    ptr = RealValueNew();
5479    if (ptr == NULL) {
5480       goto erret;
5481    }
5482    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5483       goto erret;
5484    }
5485 
5486    atp = AsnReadId(aip,amp, atp);
5487    func = NULL;
5488 
5489    if (atp == REALVALUE_scale_factor) {
5490       if ( AsnReadVal(aip, atp, &av) <= 0) {
5491          goto erret;
5492       }
5493       ptr -> scale_factor = av.intvalue;
5494       atp = AsnReadId(aip,amp, atp);
5495    }
5496    if (atp == REALVALUE_scaled_integer_value) {
5497       if ( AsnReadVal(aip, atp, &av) <= 0) {
5498          goto erret;
5499       }
5500       ptr -> scaled_integer_value = av.intvalue;
5501       atp = AsnReadId(aip,amp, atp);
5502    }
5503 
5504    if (AsnReadVal(aip, atp, &av) <= 0) {
5505       goto erret;
5506    }
5507    /* end struct */
5508 
5509 ret:
5510    AsnUnlinkType(orig);       /* unlink local tree */
5511    return ptr;
5512 
5513 erret:
5514    aip -> io_failure = TRUE;
5515    ptr = RealValueFree(ptr);
5516    goto ret;
5517 }
5518 
5519 
5520 
5521 /**************************************************
5522 *
5523 *    RealValueAsnWrite()
5524 *
5525 **************************************************/
5526 NLM_EXTERN Boolean LIBCALL
RealValueAsnWrite(RealValuePtr ptr,AsnIoPtr aip,AsnTypePtr orig)5527 RealValueAsnWrite(RealValuePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5528 {
5529    DataVal av;
5530    AsnTypePtr atp;
5531    Boolean retval = FALSE;
5532 
5533    if (! loaded)
5534    {
5535       if (! objmmdb3AsnLoad()) {
5536          return FALSE;
5537       }
5538    }
5539 
5540    if (aip == NULL) {
5541       return FALSE;
5542    }
5543 
5544    atp = AsnLinkType(orig, REALVALUE);   /* link local tree */
5545    if (atp == NULL) {
5546       return FALSE;
5547    }
5548 
5549    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5550    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5551    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5552       goto erret;
5553    }
5554 
5555    av.intvalue = ptr -> scale_factor;
5556    retval = AsnWrite(aip, REALVALUE_scale_factor,  &av);
5557    av.intvalue = ptr -> scaled_integer_value;
5558    retval = AsnWrite(aip, REALVALUE_scaled_integer_value,  &av);
5559    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5560       goto erret;
5561    }
5562    retval = TRUE;
5563 
5564 erret:
5565    AsnUnlinkType(orig);       /* unlink local tree */
5566    return retval;
5567 }
5568 
5569 
5570 
5571 /**************************************************
5572 *
5573 *    ModelSpacePointNew()
5574 *
5575 **************************************************/
5576 NLM_EXTERN
5577 ModelSpacePointPtr LIBCALL
ModelSpacePointNew(void)5578 ModelSpacePointNew(void)
5579 {
5580    ModelSpacePointPtr ptr = MemNew((size_t) sizeof(ModelSpacePoint));
5581 
5582    return ptr;
5583 
5584 }
5585 
5586 
5587 /**************************************************
5588 *
5589 *    ModelSpacePointFree()
5590 *
5591 **************************************************/
5592 NLM_EXTERN
5593 ModelSpacePointPtr LIBCALL
ModelSpacePointFree(ModelSpacePointPtr ptr)5594 ModelSpacePointFree(ModelSpacePointPtr ptr)
5595 {
5596 
5597    if(ptr == NULL) {
5598       return NULL;
5599    }
5600    return MemFree(ptr);
5601 }
5602 
5603 
5604 /**************************************************
5605 *
5606 *    ModelSpacePointAsnRead()
5607 *
5608 **************************************************/
5609 NLM_EXTERN
5610 ModelSpacePointPtr LIBCALL
ModelSpacePointAsnRead(AsnIoPtr aip,AsnTypePtr orig)5611 ModelSpacePointAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5612 {
5613    DataVal av;
5614    AsnTypePtr atp;
5615    AsnReadFunc func;
5616    ModelSpacePointPtr ptr;
5617 
5618    if (! loaded)
5619    {
5620       if (! objmmdb3AsnLoad()) {
5621          return NULL;
5622       }
5623    }
5624 
5625    if (aip == NULL) {
5626       return NULL;
5627    }
5628 
5629    if (orig == NULL) {         /* ModelSpacePoint ::= (self contained) */
5630       atp = AsnReadId(aip, amp, MODEL_SPACE_POINT);
5631    } else {
5632       atp = AsnLinkType(orig, MODEL_SPACE_POINT);
5633    }
5634    /* link in local tree */
5635    if (atp == NULL) {
5636       return NULL;
5637    }
5638 
5639    ptr = ModelSpacePointNew();
5640    if (ptr == NULL) {
5641       goto erret;
5642    }
5643    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5644       goto erret;
5645    }
5646 
5647    atp = AsnReadId(aip,amp, atp);
5648    func = NULL;
5649 
5650    if (atp == MODEL_SPACE_POINT_scale_factor) {
5651       if ( AsnReadVal(aip, atp, &av) <= 0) {
5652          goto erret;
5653       }
5654       ptr -> scale_factor = av.intvalue;
5655       atp = AsnReadId(aip,amp, atp);
5656    }
5657    if (atp == MODEL_SPACE_POINT_x) {
5658       if ( AsnReadVal(aip, atp, &av) <= 0) {
5659          goto erret;
5660       }
5661       ptr -> x = av.intvalue;
5662       atp = AsnReadId(aip,amp, atp);
5663    }
5664    if (atp == MODEL_SPACE_POINT_y) {
5665       if ( AsnReadVal(aip, atp, &av) <= 0) {
5666          goto erret;
5667       }
5668       ptr -> y = av.intvalue;
5669       atp = AsnReadId(aip,amp, atp);
5670    }
5671    if (atp == MODEL_SPACE_POINT_z) {
5672       if ( AsnReadVal(aip, atp, &av) <= 0) {
5673          goto erret;
5674       }
5675       ptr -> z = av.intvalue;
5676       atp = AsnReadId(aip,amp, atp);
5677    }
5678 
5679    if (AsnReadVal(aip, atp, &av) <= 0) {
5680       goto erret;
5681    }
5682    /* end struct */
5683 
5684 ret:
5685    AsnUnlinkType(orig);       /* unlink local tree */
5686    return ptr;
5687 
5688 erret:
5689    aip -> io_failure = TRUE;
5690    ptr = ModelSpacePointFree(ptr);
5691    goto ret;
5692 }
5693 
5694 
5695 
5696 /**************************************************
5697 *
5698 *    ModelSpacePointAsnWrite()
5699 *
5700 **************************************************/
5701 NLM_EXTERN Boolean LIBCALL
ModelSpacePointAsnWrite(ModelSpacePointPtr ptr,AsnIoPtr aip,AsnTypePtr orig)5702 ModelSpacePointAsnWrite(ModelSpacePointPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
5703 {
5704    DataVal av;
5705    AsnTypePtr atp;
5706    Boolean retval = FALSE;
5707 
5708    if (! loaded)
5709    {
5710       if (! objmmdb3AsnLoad()) {
5711          return FALSE;
5712       }
5713    }
5714 
5715    if (aip == NULL) {
5716       return FALSE;
5717    }
5718 
5719    atp = AsnLinkType(orig, MODEL_SPACE_POINT);   /* link local tree */
5720    if (atp == NULL) {
5721       return FALSE;
5722    }
5723 
5724    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5725    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5726    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
5727       goto erret;
5728    }
5729 
5730    av.intvalue = ptr -> scale_factor;
5731    retval = AsnWrite(aip, MODEL_SPACE_POINT_scale_factor,  &av);
5732    av.intvalue = ptr -> x;
5733    retval = AsnWrite(aip, MODEL_SPACE_POINT_x,  &av);
5734    av.intvalue = ptr -> y;
5735    retval = AsnWrite(aip, MODEL_SPACE_POINT_y,  &av);
5736    av.intvalue = ptr -> z;
5737    retval = AsnWrite(aip, MODEL_SPACE_POINT_z,  &av);
5738    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
5739       goto erret;
5740    }
5741    retval = TRUE;
5742 
5743 erret:
5744    AsnUnlinkType(orig);       /* unlink local tree */
5745    return retval;
5746 }
5747 
5748 
5749 
5750 /**************************************************
5751 *
5752 *    MoveFree()
5753 *
5754 **************************************************/
5755 NLM_EXTERN
5756 MovePtr LIBCALL
MoveFree(ValNodePtr anp)5757 MoveFree(ValNodePtr anp)
5758 {
5759    Pointer pnt;
5760 
5761    if (anp == NULL) {
5762       return NULL;
5763    }
5764 
5765    pnt = anp->data.ptrvalue;
5766    switch (anp->choice)
5767    {
5768    default:
5769       break;
5770    case Move_rotate:
5771       RotMatrixFree(anp -> data.ptrvalue);
5772       break;
5773    case Move_translate:
5774       TransMatrixFree(anp -> data.ptrvalue);
5775       break;
5776    }
5777    return MemFree(anp);
5778 }
5779 
5780 
5781 /**************************************************
5782 *
5783 *    MoveAsnRead()
5784 *
5785 **************************************************/
5786 NLM_EXTERN
5787 MovePtr LIBCALL
MoveAsnRead(AsnIoPtr aip,AsnTypePtr orig)5788 MoveAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5789 {
5790    DataVal av;
5791    AsnTypePtr atp;
5792    ValNodePtr anp;
5793    Uint1 choice;
5794    Boolean nullIsError = FALSE;
5795    AsnReadFunc func;
5796 
5797    if (! loaded)
5798    {
5799       if (! objmmdb3AsnLoad()) {
5800          return NULL;
5801       }
5802    }
5803 
5804    if (aip == NULL) {
5805       return NULL;
5806    }
5807 
5808    if (orig == NULL) {         /* Move ::= (self contained) */
5809       atp = AsnReadId(aip, amp, MOVE);
5810    } else {
5811       atp = AsnLinkType(orig, MOVE);    /* link in local tree */
5812    }
5813    if (atp == NULL) {
5814       return NULL;
5815    }
5816 
5817    anp = ValNodeNew(NULL);
5818    if (anp == NULL) {
5819       goto erret;
5820    }
5821    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
5822       goto erret;
5823    }
5824 
5825    func = NULL;
5826 
5827    atp = AsnReadId(aip, amp, atp);  /* find the choice */
5828    if (atp == NULL) {
5829       goto erret;
5830    }
5831    if (atp == MOVE_rotate) {
5832       choice = Move_rotate;
5833       func = (AsnReadFunc) RotMatrixAsnRead;
5834    }
5835    else if (atp == MOVE_translate) {
5836       choice = Move_translate;
5837       func = (AsnReadFunc) TransMatrixAsnRead;
5838    }
5839    anp->choice = choice;
5840    if (func != NULL)
5841    {
5842       anp->data.ptrvalue = (* func)(aip, atp);
5843       if (aip -> io_failure) goto erret;
5844 
5845       if (nullIsError && anp->data.ptrvalue == NULL) {
5846          goto erret;
5847       }
5848    }
5849 
5850 ret:
5851    AsnUnlinkType(orig);       /* unlink local tree */
5852    return anp;
5853 
5854 erret:
5855    anp = MemFree(anp);
5856    aip -> io_failure = TRUE;
5857    goto ret;
5858 }
5859 
5860 
5861 /**************************************************
5862 *
5863 *    MoveAsnWrite()
5864 *
5865 **************************************************/
5866 NLM_EXTERN Boolean LIBCALL
MoveAsnWrite(MovePtr anp,AsnIoPtr aip,AsnTypePtr orig)5867 MoveAsnWrite(MovePtr anp, AsnIoPtr aip, AsnTypePtr orig)
5868 
5869 {
5870    DataVal av;
5871    AsnTypePtr atp, writetype = NULL;
5872    Pointer pnt;
5873    AsnWriteFunc func = NULL;
5874    Boolean retval = FALSE;
5875 
5876    if (! loaded)
5877    {
5878       if (! objmmdb3AsnLoad())
5879       return FALSE;
5880    }
5881 
5882    if (aip == NULL)
5883    return FALSE;
5884 
5885    atp = AsnLinkType(orig, MOVE);   /* link local tree */
5886    if (atp == NULL) {
5887       return FALSE;
5888    }
5889 
5890    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
5891    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
5892    av.ptrvalue = (Pointer)anp;
5893    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
5894       goto erret;
5895    }
5896 
5897    pnt = anp->data.ptrvalue;
5898    switch (anp->choice)
5899    {
5900    case Move_rotate:
5901       writetype = MOVE_rotate;
5902       func = (AsnWriteFunc) RotMatrixAsnWrite;
5903       break;
5904    case Move_translate:
5905       writetype = MOVE_translate;
5906       func = (AsnWriteFunc) TransMatrixAsnWrite;
5907       break;
5908    }
5909    if (writetype != NULL) {
5910       retval = (* func)(pnt, aip, writetype);   /* write it out */
5911    }
5912    if (!retval) {
5913       goto erret;
5914    }
5915    retval = TRUE;
5916 
5917 erret:
5918    AsnUnlinkType(orig);       /* unlink local tree */
5919    return retval;
5920 }
5921 
5922 
5923 /**************************************************
5924 *
5925 *    RotMatrixNew()
5926 *
5927 **************************************************/
5928 NLM_EXTERN
5929 RotMatrixPtr LIBCALL
RotMatrixNew(void)5930 RotMatrixNew(void)
5931 {
5932    RotMatrixPtr ptr = MemNew((size_t) sizeof(RotMatrix));
5933 
5934    return ptr;
5935 
5936 }
5937 
5938 
5939 /**************************************************
5940 *
5941 *    RotMatrixFree()
5942 *
5943 **************************************************/
5944 NLM_EXTERN
5945 RotMatrixPtr LIBCALL
RotMatrixFree(RotMatrixPtr ptr)5946 RotMatrixFree(RotMatrixPtr ptr)
5947 {
5948 
5949    if(ptr == NULL) {
5950       return NULL;
5951    }
5952    return MemFree(ptr);
5953 }
5954 
5955 
5956 /**************************************************
5957 *
5958 *    RotMatrixAsnRead()
5959 *
5960 **************************************************/
5961 NLM_EXTERN
5962 RotMatrixPtr LIBCALL
RotMatrixAsnRead(AsnIoPtr aip,AsnTypePtr orig)5963 RotMatrixAsnRead(AsnIoPtr aip, AsnTypePtr orig)
5964 {
5965    DataVal av;
5966    AsnTypePtr atp;
5967    AsnReadFunc func;
5968    RotMatrixPtr ptr;
5969 
5970    if (! loaded)
5971    {
5972       if (! objmmdb3AsnLoad()) {
5973          return NULL;
5974       }
5975    }
5976 
5977    if (aip == NULL) {
5978       return NULL;
5979    }
5980 
5981    if (orig == NULL) {         /* RotMatrix ::= (self contained) */
5982       atp = AsnReadId(aip, amp, ROT_MATRIX);
5983    } else {
5984       atp = AsnLinkType(orig, ROT_MATRIX);
5985    }
5986    /* link in local tree */
5987    if (atp == NULL) {
5988       return NULL;
5989    }
5990 
5991    ptr = RotMatrixNew();
5992    if (ptr == NULL) {
5993       goto erret;
5994    }
5995    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
5996       goto erret;
5997    }
5998 
5999    atp = AsnReadId(aip,amp, atp);
6000    func = NULL;
6001 
6002    if (atp == ROT_MATRIX_scale_factor) {
6003       if ( AsnReadVal(aip, atp, &av) <= 0) {
6004          goto erret;
6005       }
6006       ptr -> scale_factor = av.intvalue;
6007       atp = AsnReadId(aip,amp, atp);
6008    }
6009    if (atp == ROT_MATRIX_rot_11) {
6010       if ( AsnReadVal(aip, atp, &av) <= 0) {
6011          goto erret;
6012       }
6013       ptr -> rot_11 = av.intvalue;
6014       atp = AsnReadId(aip,amp, atp);
6015    }
6016    if (atp == ROT_MATRIX_rot_12) {
6017       if ( AsnReadVal(aip, atp, &av) <= 0) {
6018          goto erret;
6019       }
6020       ptr -> rot_12 = av.intvalue;
6021       atp = AsnReadId(aip,amp, atp);
6022    }
6023    if (atp == ROT_MATRIX_rot_13) {
6024       if ( AsnReadVal(aip, atp, &av) <= 0) {
6025          goto erret;
6026       }
6027       ptr -> rot_13 = av.intvalue;
6028       atp = AsnReadId(aip,amp, atp);
6029    }
6030    if (atp == ROT_MATRIX_rot_21) {
6031       if ( AsnReadVal(aip, atp, &av) <= 0) {
6032          goto erret;
6033       }
6034       ptr -> rot_21 = av.intvalue;
6035       atp = AsnReadId(aip,amp, atp);
6036    }
6037    if (atp == ROT_MATRIX_rot_22) {
6038       if ( AsnReadVal(aip, atp, &av) <= 0) {
6039          goto erret;
6040       }
6041       ptr -> rot_22 = av.intvalue;
6042       atp = AsnReadId(aip,amp, atp);
6043    }
6044    if (atp == ROT_MATRIX_rot_23) {
6045       if ( AsnReadVal(aip, atp, &av) <= 0) {
6046          goto erret;
6047       }
6048       ptr -> rot_23 = av.intvalue;
6049       atp = AsnReadId(aip,amp, atp);
6050    }
6051    if (atp == ROT_MATRIX_rot_31) {
6052       if ( AsnReadVal(aip, atp, &av) <= 0) {
6053          goto erret;
6054       }
6055       ptr -> rot_31 = av.intvalue;
6056       atp = AsnReadId(aip,amp, atp);
6057    }
6058    if (atp == ROT_MATRIX_rot_32) {
6059       if ( AsnReadVal(aip, atp, &av) <= 0) {
6060          goto erret;
6061       }
6062       ptr -> rot_32 = av.intvalue;
6063       atp = AsnReadId(aip,amp, atp);
6064    }
6065    if (atp == ROT_MATRIX_rot_33) {
6066       if ( AsnReadVal(aip, atp, &av) <= 0) {
6067          goto erret;
6068       }
6069       ptr -> rot_33 = av.intvalue;
6070       atp = AsnReadId(aip,amp, atp);
6071    }
6072 
6073    if (AsnReadVal(aip, atp, &av) <= 0) {
6074       goto erret;
6075    }
6076    /* end struct */
6077 
6078 ret:
6079    AsnUnlinkType(orig);       /* unlink local tree */
6080    return ptr;
6081 
6082 erret:
6083    aip -> io_failure = TRUE;
6084    ptr = RotMatrixFree(ptr);
6085    goto ret;
6086 }
6087 
6088 
6089 
6090 /**************************************************
6091 *
6092 *    RotMatrixAsnWrite()
6093 *
6094 **************************************************/
6095 NLM_EXTERN Boolean LIBCALL
RotMatrixAsnWrite(RotMatrixPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6096 RotMatrixAsnWrite(RotMatrixPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6097 {
6098    DataVal av;
6099    AsnTypePtr atp;
6100    Boolean retval = FALSE;
6101 
6102    if (! loaded)
6103    {
6104       if (! objmmdb3AsnLoad()) {
6105          return FALSE;
6106       }
6107    }
6108 
6109    if (aip == NULL) {
6110       return FALSE;
6111    }
6112 
6113    atp = AsnLinkType(orig, ROT_MATRIX);   /* link local tree */
6114    if (atp == NULL) {
6115       return FALSE;
6116    }
6117 
6118    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6119    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6120    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6121       goto erret;
6122    }
6123 
6124    av.intvalue = ptr -> scale_factor;
6125    retval = AsnWrite(aip, ROT_MATRIX_scale_factor,  &av);
6126    av.intvalue = ptr -> rot_11;
6127    retval = AsnWrite(aip, ROT_MATRIX_rot_11,  &av);
6128    av.intvalue = ptr -> rot_12;
6129    retval = AsnWrite(aip, ROT_MATRIX_rot_12,  &av);
6130    av.intvalue = ptr -> rot_13;
6131    retval = AsnWrite(aip, ROT_MATRIX_rot_13,  &av);
6132    av.intvalue = ptr -> rot_21;
6133    retval = AsnWrite(aip, ROT_MATRIX_rot_21,  &av);
6134    av.intvalue = ptr -> rot_22;
6135    retval = AsnWrite(aip, ROT_MATRIX_rot_22,  &av);
6136    av.intvalue = ptr -> rot_23;
6137    retval = AsnWrite(aip, ROT_MATRIX_rot_23,  &av);
6138    av.intvalue = ptr -> rot_31;
6139    retval = AsnWrite(aip, ROT_MATRIX_rot_31,  &av);
6140    av.intvalue = ptr -> rot_32;
6141    retval = AsnWrite(aip, ROT_MATRIX_rot_32,  &av);
6142    av.intvalue = ptr -> rot_33;
6143    retval = AsnWrite(aip, ROT_MATRIX_rot_33,  &av);
6144    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6145       goto erret;
6146    }
6147    retval = TRUE;
6148 
6149 erret:
6150    AsnUnlinkType(orig);       /* unlink local tree */
6151    return retval;
6152 }
6153 
6154 
6155 
6156 /**************************************************
6157 *
6158 *    TransMatrixNew()
6159 *
6160 **************************************************/
6161 NLM_EXTERN
6162 TransMatrixPtr LIBCALL
TransMatrixNew(void)6163 TransMatrixNew(void)
6164 {
6165    TransMatrixPtr ptr = MemNew((size_t) sizeof(TransMatrix));
6166 
6167    return ptr;
6168 
6169 }
6170 
6171 
6172 /**************************************************
6173 *
6174 *    TransMatrixFree()
6175 *
6176 **************************************************/
6177 NLM_EXTERN
6178 TransMatrixPtr LIBCALL
TransMatrixFree(TransMatrixPtr ptr)6179 TransMatrixFree(TransMatrixPtr ptr)
6180 {
6181 
6182    if(ptr == NULL) {
6183       return NULL;
6184    }
6185    return MemFree(ptr);
6186 }
6187 
6188 
6189 /**************************************************
6190 *
6191 *    TransMatrixAsnRead()
6192 *
6193 **************************************************/
6194 NLM_EXTERN
6195 TransMatrixPtr LIBCALL
TransMatrixAsnRead(AsnIoPtr aip,AsnTypePtr orig)6196 TransMatrixAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6197 {
6198    DataVal av;
6199    AsnTypePtr atp;
6200    AsnReadFunc func;
6201    TransMatrixPtr ptr;
6202 
6203    if (! loaded)
6204    {
6205       if (! objmmdb3AsnLoad()) {
6206          return NULL;
6207       }
6208    }
6209 
6210    if (aip == NULL) {
6211       return NULL;
6212    }
6213 
6214    if (orig == NULL) {         /* TransMatrix ::= (self contained) */
6215       atp = AsnReadId(aip, amp, TRANS_MATRIX);
6216    } else {
6217       atp = AsnLinkType(orig, TRANS_MATRIX);
6218    }
6219    /* link in local tree */
6220    if (atp == NULL) {
6221       return NULL;
6222    }
6223 
6224    ptr = TransMatrixNew();
6225    if (ptr == NULL) {
6226       goto erret;
6227    }
6228    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6229       goto erret;
6230    }
6231 
6232    atp = AsnReadId(aip,amp, atp);
6233    func = NULL;
6234 
6235    if (atp == TRANS_MATRIX_scale_factor) {
6236       if ( AsnReadVal(aip, atp, &av) <= 0) {
6237          goto erret;
6238       }
6239       ptr -> scale_factor = av.intvalue;
6240       atp = AsnReadId(aip,amp, atp);
6241    }
6242    if (atp == TRANS_MATRIX_tran_1) {
6243       if ( AsnReadVal(aip, atp, &av) <= 0) {
6244          goto erret;
6245       }
6246       ptr -> tran_1 = av.intvalue;
6247       atp = AsnReadId(aip,amp, atp);
6248    }
6249    if (atp == TRANS_MATRIX_tran_2) {
6250       if ( AsnReadVal(aip, atp, &av) <= 0) {
6251          goto erret;
6252       }
6253       ptr -> tran_2 = av.intvalue;
6254       atp = AsnReadId(aip,amp, atp);
6255    }
6256    if (atp == TRANS_MATRIX_tran_3) {
6257       if ( AsnReadVal(aip, atp, &av) <= 0) {
6258          goto erret;
6259       }
6260       ptr -> tran_3 = av.intvalue;
6261       atp = AsnReadId(aip,amp, atp);
6262    }
6263 
6264    if (AsnReadVal(aip, atp, &av) <= 0) {
6265       goto erret;
6266    }
6267    /* end struct */
6268 
6269 ret:
6270    AsnUnlinkType(orig);       /* unlink local tree */
6271    return ptr;
6272 
6273 erret:
6274    aip -> io_failure = TRUE;
6275    ptr = TransMatrixFree(ptr);
6276    goto ret;
6277 }
6278 
6279 
6280 
6281 /**************************************************
6282 *
6283 *    TransMatrixAsnWrite()
6284 *
6285 **************************************************/
6286 NLM_EXTERN Boolean LIBCALL
TransMatrixAsnWrite(TransMatrixPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6287 TransMatrixAsnWrite(TransMatrixPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6288 {
6289    DataVal av;
6290    AsnTypePtr atp;
6291    Boolean retval = FALSE;
6292 
6293    if (! loaded)
6294    {
6295       if (! objmmdb3AsnLoad()) {
6296          return FALSE;
6297       }
6298    }
6299 
6300    if (aip == NULL) {
6301       return FALSE;
6302    }
6303 
6304    atp = AsnLinkType(orig, TRANS_MATRIX);   /* link local tree */
6305    if (atp == NULL) {
6306       return FALSE;
6307    }
6308 
6309    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6310    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6311    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6312       goto erret;
6313    }
6314 
6315    av.intvalue = ptr -> scale_factor;
6316    retval = AsnWrite(aip, TRANS_MATRIX_scale_factor,  &av);
6317    av.intvalue = ptr -> tran_1;
6318    retval = AsnWrite(aip, TRANS_MATRIX_tran_1,  &av);
6319    av.intvalue = ptr -> tran_2;
6320    retval = AsnWrite(aip, TRANS_MATRIX_tran_2,  &av);
6321    av.intvalue = ptr -> tran_3;
6322    retval = AsnWrite(aip, TRANS_MATRIX_tran_3,  &av);
6323    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6324       goto erret;
6325    }
6326    retval = TRUE;
6327 
6328 erret:
6329    AsnUnlinkType(orig);       /* unlink local tree */
6330    return retval;
6331 }
6332 
6333 
6334 
6335 /**************************************************
6336 *
6337 *    GLMatrixNew()
6338 *
6339 **************************************************/
6340 NLM_EXTERN
6341 GLMatrixPtr LIBCALL
GLMatrixNew(void)6342 GLMatrixNew(void)
6343 {
6344    GLMatrixPtr ptr = MemNew((size_t) sizeof(GLMatrix));
6345 
6346    return ptr;
6347 
6348 }
6349 
6350 
6351 /**************************************************
6352 *
6353 *    GLMatrixFree()
6354 *
6355 **************************************************/
6356 NLM_EXTERN
6357 GLMatrixPtr LIBCALL
GLMatrixFree(GLMatrixPtr ptr)6358 GLMatrixFree(GLMatrixPtr ptr)
6359 {
6360 
6361    if(ptr == NULL) {
6362       return NULL;
6363    }
6364    return MemFree(ptr);
6365 }
6366 
6367 
6368 /**************************************************
6369 *
6370 *    GLMatrixAsnRead()
6371 *
6372 **************************************************/
6373 NLM_EXTERN
6374 GLMatrixPtr LIBCALL
GLMatrixAsnRead(AsnIoPtr aip,AsnTypePtr orig)6375 GLMatrixAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6376 {
6377    DataVal av;
6378    AsnTypePtr atp;
6379    AsnReadFunc func;
6380    GLMatrixPtr ptr;
6381 
6382    if (! loaded)
6383    {
6384       if (! objmmdb3AsnLoad()) {
6385          return NULL;
6386       }
6387    }
6388 
6389    if (aip == NULL) {
6390       return NULL;
6391    }
6392 
6393    if (orig == NULL) {         /* GLMatrix ::= (self contained) */
6394       atp = AsnReadId(aip, amp, GL_MATRIX);
6395    } else {
6396       atp = AsnLinkType(orig, GL_MATRIX);
6397    }
6398    /* link in local tree */
6399    if (atp == NULL) {
6400       return NULL;
6401    }
6402 
6403    ptr = GLMatrixNew();
6404    if (ptr == NULL) {
6405       goto erret;
6406    }
6407    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6408       goto erret;
6409    }
6410 
6411    atp = AsnReadId(aip,amp, atp);
6412    func = NULL;
6413 
6414    if (atp == GL_MATRIX_scale) {
6415       if ( AsnReadVal(aip, atp, &av) <= 0) {
6416          goto erret;
6417       }
6418       ptr -> scale = av.intvalue;
6419       atp = AsnReadId(aip,amp, atp);
6420    }
6421    if (atp == GL_MATRIX_m11) {
6422       if ( AsnReadVal(aip, atp, &av) <= 0) {
6423          goto erret;
6424       }
6425       ptr -> m11 = av.intvalue;
6426       atp = AsnReadId(aip,amp, atp);
6427    }
6428    if (atp == GL_MATRIX_m12) {
6429       if ( AsnReadVal(aip, atp, &av) <= 0) {
6430          goto erret;
6431       }
6432       ptr -> m12 = av.intvalue;
6433       atp = AsnReadId(aip,amp, atp);
6434    }
6435    if (atp == GL_MATRIX_m13) {
6436       if ( AsnReadVal(aip, atp, &av) <= 0) {
6437          goto erret;
6438       }
6439       ptr -> m13 = av.intvalue;
6440       atp = AsnReadId(aip,amp, atp);
6441    }
6442    if (atp == GL_MATRIX_m14) {
6443       if ( AsnReadVal(aip, atp, &av) <= 0) {
6444          goto erret;
6445       }
6446       ptr -> m14 = av.intvalue;
6447       atp = AsnReadId(aip,amp, atp);
6448    }
6449    if (atp == GL_MATRIX_m21) {
6450       if ( AsnReadVal(aip, atp, &av) <= 0) {
6451          goto erret;
6452       }
6453       ptr -> m21 = av.intvalue;
6454       atp = AsnReadId(aip,amp, atp);
6455    }
6456    if (atp == GL_MATRIX_m22) {
6457       if ( AsnReadVal(aip, atp, &av) <= 0) {
6458          goto erret;
6459       }
6460       ptr -> m22 = av.intvalue;
6461       atp = AsnReadId(aip,amp, atp);
6462    }
6463    if (atp == GL_MATRIX_m23) {
6464       if ( AsnReadVal(aip, atp, &av) <= 0) {
6465          goto erret;
6466       }
6467       ptr -> m23 = av.intvalue;
6468       atp = AsnReadId(aip,amp, atp);
6469    }
6470    if (atp == GL_MATRIX_m24) {
6471       if ( AsnReadVal(aip, atp, &av) <= 0) {
6472          goto erret;
6473       }
6474       ptr -> m24 = av.intvalue;
6475       atp = AsnReadId(aip,amp, atp);
6476    }
6477    if (atp == GL_MATRIX_m31) {
6478       if ( AsnReadVal(aip, atp, &av) <= 0) {
6479          goto erret;
6480       }
6481       ptr -> m31 = av.intvalue;
6482       atp = AsnReadId(aip,amp, atp);
6483    }
6484    if (atp == GL_MATRIX_m32) {
6485       if ( AsnReadVal(aip, atp, &av) <= 0) {
6486          goto erret;
6487       }
6488       ptr -> m32 = av.intvalue;
6489       atp = AsnReadId(aip,amp, atp);
6490    }
6491    if (atp == GL_MATRIX_m33) {
6492       if ( AsnReadVal(aip, atp, &av) <= 0) {
6493          goto erret;
6494       }
6495       ptr -> m33 = av.intvalue;
6496       atp = AsnReadId(aip,amp, atp);
6497    }
6498    if (atp == GL_MATRIX_m34) {
6499       if ( AsnReadVal(aip, atp, &av) <= 0) {
6500          goto erret;
6501       }
6502       ptr -> m34 = av.intvalue;
6503       atp = AsnReadId(aip,amp, atp);
6504    }
6505    if (atp == GL_MATRIX_m41) {
6506       if ( AsnReadVal(aip, atp, &av) <= 0) {
6507          goto erret;
6508       }
6509       ptr -> m41 = av.intvalue;
6510       atp = AsnReadId(aip,amp, atp);
6511    }
6512    if (atp == GL_MATRIX_m42) {
6513       if ( AsnReadVal(aip, atp, &av) <= 0) {
6514          goto erret;
6515       }
6516       ptr -> m42 = av.intvalue;
6517       atp = AsnReadId(aip,amp, atp);
6518    }
6519    if (atp == GL_MATRIX_m43) {
6520       if ( AsnReadVal(aip, atp, &av) <= 0) {
6521          goto erret;
6522       }
6523       ptr -> m43 = av.intvalue;
6524       atp = AsnReadId(aip,amp, atp);
6525    }
6526    if (atp == GL_MATRIX_m44) {
6527       if ( AsnReadVal(aip, atp, &av) <= 0) {
6528          goto erret;
6529       }
6530       ptr -> m44 = av.intvalue;
6531       atp = AsnReadId(aip,amp, atp);
6532    }
6533 
6534    if (AsnReadVal(aip, atp, &av) <= 0) {
6535       goto erret;
6536    }
6537    /* end struct */
6538 
6539 ret:
6540    AsnUnlinkType(orig);       /* unlink local tree */
6541    return ptr;
6542 
6543 erret:
6544    aip -> io_failure = TRUE;
6545    ptr = GLMatrixFree(ptr);
6546    goto ret;
6547 }
6548 
6549 
6550 
6551 /**************************************************
6552 *
6553 *    GLMatrixAsnWrite()
6554 *
6555 **************************************************/
6556 NLM_EXTERN Boolean LIBCALL
GLMatrixAsnWrite(GLMatrixPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6557 GLMatrixAsnWrite(GLMatrixPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6558 {
6559    DataVal av;
6560    AsnTypePtr atp;
6561    Boolean retval = FALSE;
6562 
6563    if (! loaded)
6564    {
6565       if (! objmmdb3AsnLoad()) {
6566          return FALSE;
6567       }
6568    }
6569 
6570    if (aip == NULL) {
6571       return FALSE;
6572    }
6573 
6574    atp = AsnLinkType(orig, GL_MATRIX);   /* link local tree */
6575    if (atp == NULL) {
6576       return FALSE;
6577    }
6578 
6579    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6580    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6581    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6582       goto erret;
6583    }
6584 
6585    av.intvalue = ptr -> scale;
6586    retval = AsnWrite(aip, GL_MATRIX_scale,  &av);
6587    av.intvalue = ptr -> m11;
6588    retval = AsnWrite(aip, GL_MATRIX_m11,  &av);
6589    av.intvalue = ptr -> m12;
6590    retval = AsnWrite(aip, GL_MATRIX_m12,  &av);
6591    av.intvalue = ptr -> m13;
6592    retval = AsnWrite(aip, GL_MATRIX_m13,  &av);
6593    av.intvalue = ptr -> m14;
6594    retval = AsnWrite(aip, GL_MATRIX_m14,  &av);
6595    av.intvalue = ptr -> m21;
6596    retval = AsnWrite(aip, GL_MATRIX_m21,  &av);
6597    av.intvalue = ptr -> m22;
6598    retval = AsnWrite(aip, GL_MATRIX_m22,  &av);
6599    av.intvalue = ptr -> m23;
6600    retval = AsnWrite(aip, GL_MATRIX_m23,  &av);
6601    av.intvalue = ptr -> m24;
6602    retval = AsnWrite(aip, GL_MATRIX_m24,  &av);
6603    av.intvalue = ptr -> m31;
6604    retval = AsnWrite(aip, GL_MATRIX_m31,  &av);
6605    av.intvalue = ptr -> m32;
6606    retval = AsnWrite(aip, GL_MATRIX_m32,  &av);
6607    av.intvalue = ptr -> m33;
6608    retval = AsnWrite(aip, GL_MATRIX_m33,  &av);
6609    av.intvalue = ptr -> m34;
6610    retval = AsnWrite(aip, GL_MATRIX_m34,  &av);
6611    av.intvalue = ptr -> m41;
6612    retval = AsnWrite(aip, GL_MATRIX_m41,  &av);
6613    av.intvalue = ptr -> m42;
6614    retval = AsnWrite(aip, GL_MATRIX_m42,  &av);
6615    av.intvalue = ptr -> m43;
6616    retval = AsnWrite(aip, GL_MATRIX_m43,  &av);
6617    av.intvalue = ptr -> m44;
6618    retval = AsnWrite(aip, GL_MATRIX_m44,  &av);
6619    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6620       goto erret;
6621    }
6622    retval = TRUE;
6623 
6624 erret:
6625    AsnUnlinkType(orig);       /* unlink local tree */
6626    return retval;
6627 }
6628 
6629 
6630 
6631 /**************************************************
6632 *
6633 *    BiostrucScriptStepNew()
6634 *
6635 **************************************************/
6636 NLM_EXTERN
6637 BiostrucScriptStepPtr LIBCALL
BiostrucScriptStepNew(void)6638 BiostrucScriptStepNew(void)
6639 {
6640    BiostrucScriptStepPtr ptr = MemNew((size_t) sizeof(BiostrucScriptStep));
6641 
6642    ptr -> pause = 10;
6643    return ptr;
6644 
6645 }
6646 
6647 
6648 /**************************************************
6649 *
6650 *    BiostrucScriptStepFree()
6651 *
6652 **************************************************/
6653 NLM_EXTERN
6654 BiostrucScriptStepPtr LIBCALL
BiostrucScriptStepFree(BiostrucScriptStepPtr ptr)6655 BiostrucScriptStepFree(BiostrucScriptStepPtr ptr)
6656 {
6657 
6658    if(ptr == NULL) {
6659       return NULL;
6660    }
6661    MemFree(ptr -> step_name);
6662    AsnGenericUserSeqOfFree(ptr -> feature_do, (AsnOptFreeFunc) OtherFeatureFree);
6663    TransformFree(ptr -> camera_move);
6664    return MemFree(ptr);
6665 }
6666 
6667 
6668 /**************************************************
6669 *
6670 *    BiostrucScriptStepAsnRead()
6671 *
6672 **************************************************/
6673 NLM_EXTERN
6674 BiostrucScriptStepPtr LIBCALL
BiostrucScriptStepAsnRead(AsnIoPtr aip,AsnTypePtr orig)6675 BiostrucScriptStepAsnRead(AsnIoPtr aip, AsnTypePtr orig)
6676 {
6677    DataVal av;
6678    AsnTypePtr atp;
6679    Boolean isError = FALSE;
6680    AsnReadFunc func;
6681    BiostrucScriptStepPtr ptr;
6682 
6683    if (! loaded)
6684    {
6685       if (! objmmdb3AsnLoad()) {
6686          return NULL;
6687       }
6688    }
6689 
6690    if (aip == NULL) {
6691       return NULL;
6692    }
6693 
6694    if (orig == NULL) {         /* BiostrucScriptStep ::= (self contained) */
6695       atp = AsnReadId(aip, amp, BIOSTRUC_SCRIPT_STEP);
6696    } else {
6697       atp = AsnLinkType(orig, BIOSTRUC_SCRIPT_STEP);
6698    }
6699    /* link in local tree */
6700    if (atp == NULL) {
6701       return NULL;
6702    }
6703 
6704    ptr = BiostrucScriptStepNew();
6705    if (ptr == NULL) {
6706       goto erret;
6707    }
6708    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
6709       goto erret;
6710    }
6711 
6712    atp = AsnReadId(aip,amp, atp);
6713    func = NULL;
6714 
6715    if (atp == BIOSTRUC_SCRIPT_STEP_step_id) {
6716       if ( AsnReadVal(aip, atp, &av) <= 0) {
6717          goto erret;
6718       }
6719       ptr -> step_id = av.intvalue;
6720       atp = AsnReadId(aip,amp, atp);
6721    }
6722    if (atp == BIOSTRUC_SCRIPT_STEP_step_name) {
6723       if ( AsnReadVal(aip, atp, &av) <= 0) {
6724          goto erret;
6725       }
6726       ptr -> step_name = av.ptrvalue;
6727       atp = AsnReadId(aip,amp, atp);
6728    }
6729    if (atp == BIOSTRUC_SCRIPT_STEP_feature_do) {
6730       ptr -> feature_do = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) OtherFeatureAsnRead, (AsnOptFreeFunc) OtherFeatureFree);
6731       if (isError && ptr -> feature_do == NULL) {
6732          goto erret;
6733       }
6734       atp = AsnReadId(aip,amp, atp);
6735    }
6736    if (atp == BIOSTRUC_SCRIPT_STEP_camera_move) {
6737       ptr -> camera_move = TransformAsnRead(aip, atp);
6738       if (aip -> io_failure) {
6739          goto erret;
6740       }
6741       atp = AsnReadId(aip,amp, atp);
6742    }
6743    if (atp == BIOSTRUC_SCRIPT_STEP_pause) {
6744       if ( AsnReadVal(aip, atp, &av) <= 0) {
6745          goto erret;
6746       }
6747       ptr -> pause = av.intvalue;
6748       atp = AsnReadId(aip,amp, atp);
6749    }
6750    if (atp == BIOSTRUC_SCRIPT_STEP_waitevent) {
6751       if ( AsnReadVal(aip, atp, &av) <= 0) {
6752          goto erret;
6753       }
6754       ptr -> waitevent = av.boolvalue;
6755       atp = AsnReadId(aip,amp, atp);
6756    }
6757    if (atp == BIOSTRUC_SCRIPT_STEP_extra) {
6758       if ( AsnReadVal(aip, atp, &av) <= 0) {
6759          goto erret;
6760       }
6761       ptr -> extra = av.intvalue;
6762       atp = AsnReadId(aip,amp, atp);
6763    }
6764    if (atp == BIOSTRUC_SCRIPT_STEP_jump) {
6765       if ( AsnReadVal(aip, atp, &av) <= 0) {
6766          goto erret;
6767       }
6768       ptr -> jump = av.intvalue;
6769       ptr -> OBbits__ |= 1<<0;
6770       atp = AsnReadId(aip,amp, atp);
6771    }
6772 
6773    if (AsnReadVal(aip, atp, &av) <= 0) {
6774       goto erret;
6775    }
6776    /* end struct */
6777 
6778 ret:
6779    AsnUnlinkType(orig);       /* unlink local tree */
6780    return ptr;
6781 
6782 erret:
6783    aip -> io_failure = TRUE;
6784    ptr = BiostrucScriptStepFree(ptr);
6785    goto ret;
6786 }
6787 
6788 
6789 
6790 /**************************************************
6791 *
6792 *    BiostrucScriptStepAsnWrite()
6793 *
6794 **************************************************/
6795 NLM_EXTERN Boolean LIBCALL
BiostrucScriptStepAsnWrite(BiostrucScriptStepPtr ptr,AsnIoPtr aip,AsnTypePtr orig)6796 BiostrucScriptStepAsnWrite(BiostrucScriptStepPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
6797 {
6798    DataVal av;
6799    AsnTypePtr atp;
6800    Boolean retval = FALSE;
6801 
6802    if (! loaded)
6803    {
6804       if (! objmmdb3AsnLoad()) {
6805          return FALSE;
6806       }
6807    }
6808 
6809    if (aip == NULL) {
6810       return FALSE;
6811    }
6812 
6813    atp = AsnLinkType(orig, BIOSTRUC_SCRIPT_STEP);   /* link local tree */
6814    if (atp == NULL) {
6815       return FALSE;
6816    }
6817 
6818    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
6819    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
6820    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
6821       goto erret;
6822    }
6823 
6824    av.intvalue = ptr -> step_id;
6825    retval = AsnWrite(aip, BIOSTRUC_SCRIPT_STEP_step_id,  &av);
6826    if (ptr -> step_name != NULL) {
6827       av.ptrvalue = ptr -> step_name;
6828       retval = AsnWrite(aip, BIOSTRUC_SCRIPT_STEP_step_name,  &av);
6829    }
6830    AsnGenericUserSeqOfAsnWrite(ptr -> feature_do, (AsnWriteFunc) OtherFeatureAsnWrite, aip, BIOSTRUC_SCRIPT_STEP_feature_do, BIOSTRUC_SCRIPT_STEP_feature_do_E);
6831    if (ptr -> camera_move != NULL) {
6832       if ( ! TransformAsnWrite(ptr -> camera_move, aip, BIOSTRUC_SCRIPT_STEP_camera_move)) {
6833          goto erret;
6834       }
6835    }
6836    av.intvalue = ptr -> pause;
6837    retval = AsnWrite(aip, BIOSTRUC_SCRIPT_STEP_pause,  &av);
6838    av.boolvalue = ptr -> waitevent;
6839    retval = AsnWrite(aip, BIOSTRUC_SCRIPT_STEP_waitevent,  &av);
6840    av.intvalue = ptr -> extra;
6841    retval = AsnWrite(aip, BIOSTRUC_SCRIPT_STEP_extra,  &av);
6842    if (ptr -> jump || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> jump;
6843       retval = AsnWrite(aip, BIOSTRUC_SCRIPT_STEP_jump,  &av);
6844    }
6845    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
6846       goto erret;
6847    }
6848    retval = TRUE;
6849 
6850 erret:
6851    AsnUnlinkType(orig);       /* unlink local tree */
6852    return retval;
6853 }
6854 
6855