1 #include <asn.h>
2 
3 #define NLM_GENERATED_CODE_PROTO
4 
5 #include <strimprt.h>
6 #include <objmmdb2.h>
7 
8 static Boolean loaded = FALSE;
9 
10 #include <mmdb2.h>
11 
12 #ifndef NLM_EXTERN_LOADS
13 #define NLM_EXTERN_LOADS {}
14 #endif
15 
16 Boolean LIBCALL
objmmdb2AsnLoad(void)17 objmmdb2AsnLoad(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-Structural-model
35 *    Generated using ASNCODE Revision: 4.2 at Aug 1, 1996  4:27 PM
36 *
37 **************************************************/
38 
39 
40 /**************************************************
41 *
42 *    BiostrucModelNew()
43 *
44 **************************************************/
45 
46 BiostrucModelPtr LIBCALL
BiostrucModelNew(void)47 BiostrucModelNew(void)
48 {
49    BiostrucModelPtr ptr = MemNew((size_t) sizeof(BiostrucModel));
50 
51    return ptr;
52 
53 }
54 
55 
56 /**************************************************
57 *
58 *    BiostrucModelFree()
59 *
60 **************************************************/
61 
62 BiostrucModelPtr LIBCALL
BiostrucModelFree(BiostrucModelPtr ptr)63 BiostrucModelFree(BiostrucModelPtr ptr)
64 {
65 
66    if(ptr == NULL) {
67       return NULL;
68    }
69    AsnGenericChoiceSeqOfFree(ptr -> descr, (AsnOptFreeFunc) ModelDescrFree);
70    ModelSpaceFree(ptr -> model_space);
71    AsnGenericUserSeqOfFree(ptr -> model_coordinates, (AsnOptFreeFunc) ModelCoordinateSetFree);
72    return MemFree(ptr);
73 }
74 
75 
76 /**************************************************
77 *
78 *    BiostrucModelAsnRead()
79 *
80 **************************************************/
81 
82 BiostrucModelPtr LIBCALL
BiostrucModelAsnRead(AsnIoPtr aip,AsnTypePtr orig)83 BiostrucModelAsnRead(AsnIoPtr aip, AsnTypePtr orig)
84 {
85    DataVal av;
86    AsnTypePtr atp;
87    Boolean isError = FALSE;
88    AsnReadFunc func;
89    BiostrucModelPtr ptr;
90 
91    if (! loaded)
92    {
93       if (! objmmdb2AsnLoad()) {
94          return NULL;
95       }
96    }
97 
98    if (aip == NULL) {
99       return NULL;
100    }
101 
102    if (orig == NULL) {         /* BiostrucModel ::= (self contained) */
103       atp = AsnReadId(aip, amp, BIOSTRUC_MODEL);
104    } else {
105       atp = AsnLinkType(orig, BIOSTRUC_MODEL);
106    }
107    /* link in local tree */
108    if (atp == NULL) {
109       return NULL;
110    }
111 
112    ptr = BiostrucModelNew();
113    if (ptr == NULL) {
114       goto erret;
115    }
116    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
117       goto erret;
118    }
119 
120    atp = AsnReadId(aip,amp, atp);
121    func = NULL;
122 
123    if (atp == BIOSTRUC_MODEL_id) {
124       if ( AsnReadVal(aip, atp, &av) <= 0) {
125          goto erret;
126       }
127       ptr -> id = av.intvalue;
128       atp = AsnReadId(aip,amp, atp);
129    }
130    if (atp == BIOSTRUC_MODEL_type) {
131       if ( AsnReadVal(aip, atp, &av) <= 0) {
132          goto erret;
133       }
134       ptr -> type = av.intvalue;
135       atp = AsnReadId(aip,amp, atp);
136    }
137    if (atp == BIOSTRUC_MODEL_descr) {
138       ptr -> descr = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ModelDescrAsnRead, (AsnOptFreeFunc) ModelDescrFree);
139       if (isError && ptr -> descr == NULL) {
140          goto erret;
141       }
142       atp = AsnReadId(aip,amp, atp);
143    }
144    if (atp == BIOSTRUC_MODEL_model_space) {
145       ptr -> model_space = ModelSpaceAsnRead(aip, atp);
146       if (aip -> io_failure) {
147          goto erret;
148       }
149       atp = AsnReadId(aip,amp, atp);
150    }
151    if (atp == BIOSTRUC_MODEL_model_coordinates) {
152       ptr -> model_coordinates = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ModelCoordinateSetAsnRead, (AsnOptFreeFunc) ModelCoordinateSetFree);
153       if (isError && ptr -> model_coordinates == NULL) {
154          goto erret;
155       }
156       atp = AsnReadId(aip,amp, atp);
157    }
158 
159    if (AsnReadVal(aip, atp, &av) <= 0) {
160       goto erret;
161    }
162    /* end struct */
163 
164 ret:
165    AsnUnlinkType(orig);       /* unlink local tree */
166    return ptr;
167 
168 erret:
169    aip -> io_failure = TRUE;
170    ptr = BiostrucModelFree(ptr);
171    goto ret;
172 }
173 
174 
175 
176 /**************************************************
177 *
178 *    BiostrucModelAsnWrite()
179 *
180 **************************************************/
181 Boolean LIBCALL
BiostrucModelAsnWrite(BiostrucModelPtr ptr,AsnIoPtr aip,AsnTypePtr orig)182 BiostrucModelAsnWrite(BiostrucModelPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
183 {
184    DataVal av;
185    AsnTypePtr atp;
186    Boolean retval = FALSE;
187 
188    if (! loaded)
189    {
190       if (! objmmdb2AsnLoad()) {
191          return FALSE;
192       }
193    }
194 
195    if (aip == NULL) {
196       return FALSE;
197    }
198 
199    atp = AsnLinkType(orig, BIOSTRUC_MODEL);   /* link local tree */
200    if (atp == NULL) {
201       return FALSE;
202    }
203 
204    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
205    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
206    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
207       goto erret;
208    }
209 
210    av.intvalue = ptr -> id;
211    retval = AsnWrite(aip, BIOSTRUC_MODEL_id,  &av);
212    av.intvalue = ptr -> type;
213    retval = AsnWrite(aip, BIOSTRUC_MODEL_type,  &av);
214    AsnGenericChoiceSeqOfAsnWrite(ptr -> descr, (AsnWriteFunc) ModelDescrAsnWrite, aip, BIOSTRUC_MODEL_descr, BIOSTRUC_MODEL_descr_E);
215    if (ptr -> model_space != NULL) {
216       if ( ! ModelSpaceAsnWrite(ptr -> model_space, aip, BIOSTRUC_MODEL_model_space)) {
217          goto erret;
218       }
219    }
220    AsnGenericUserSeqOfAsnWrite(ptr -> model_coordinates, (AsnWriteFunc) ModelCoordinateSetAsnWrite, aip, BIOSTRUC_MODEL_model_coordinates, BIOSTRUC_MODEL_model_coordinates_E);
221    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
222       goto erret;
223    }
224    retval = TRUE;
225 
226 erret:
227    AsnUnlinkType(orig);       /* unlink local tree */
228    return retval;
229 }
230 
231 
232 
233 /**************************************************
234 *
235 *    ModelDescrFree()
236 *
237 **************************************************/
238 
239 ModelDescrPtr LIBCALL
ModelDescrFree(ValNodePtr anp)240 ModelDescrFree(ValNodePtr anp)
241 {
242    Pointer pnt;
243 
244    if (anp == NULL) {
245       return NULL;
246    }
247 
248    pnt = anp->data.ptrvalue;
249    switch (anp->choice)
250    {
251    default:
252       break;
253    case ModelDescr_name:
254       MemFree(anp -> data.ptrvalue);
255       break;
256    case ModelDescr_pdb_reso:
257       MemFree(anp -> data.ptrvalue);
258       break;
259    case ModelDescr_pdb_method:
260       MemFree(anp -> data.ptrvalue);
261       break;
262    case ModelDescr_pdb_comment:
263       MemFree(anp -> data.ptrvalue);
264       break;
265    case ModelDescr_other_comment:
266       MemFree(anp -> data.ptrvalue);
267       break;
268    case ModelDescr_attribution:
269       PubFree(anp -> data.ptrvalue);
270       break;
271    }
272    return MemFree(anp);
273 }
274 
275 
276 /**************************************************
277 *
278 *    ModelDescrAsnRead()
279 *
280 **************************************************/
281 
282 ModelDescrPtr LIBCALL
ModelDescrAsnRead(AsnIoPtr aip,AsnTypePtr orig)283 ModelDescrAsnRead(AsnIoPtr aip, AsnTypePtr orig)
284 {
285    DataVal av;
286    AsnTypePtr atp;
287    ValNodePtr anp;
288    Uint1 choice;
289    Boolean isError = FALSE;
290    Boolean nullIsError = FALSE;
291    AsnReadFunc func;
292 
293    if (! loaded)
294    {
295       if (! objmmdb2AsnLoad()) {
296          return NULL;
297       }
298    }
299 
300    if (aip == NULL) {
301       return NULL;
302    }
303 
304    if (orig == NULL) {         /* ModelDescr ::= (self contained) */
305       atp = AsnReadId(aip, amp, MODEL_DESCR);
306    } else {
307       atp = AsnLinkType(orig, MODEL_DESCR);    /* link in local tree */
308    }
309    if (atp == NULL) {
310       return NULL;
311    }
312 
313    anp = ValNodeNew(NULL);
314    if (anp == NULL) {
315       goto erret;
316    }
317    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
318       goto erret;
319    }
320 
321    func = NULL;
322 
323    atp = AsnReadId(aip, amp, atp);  /* find the choice */
324    if (atp == NULL) {
325       goto erret;
326    }
327    if (atp == MODEL_DESCR_name) {
328       choice = ModelDescr_name;
329       if (AsnReadVal(aip, atp, &av) <= 0) {
330          goto erret;
331       }
332       anp->data.ptrvalue = av.ptrvalue;
333    }
334    else if (atp == MODEL_DESCR_pdb_reso) {
335       choice = ModelDescr_pdb_reso;
336       if (AsnReadVal(aip, atp, &av) <= 0) {
337          goto erret;
338       }
339       anp->data.ptrvalue = av.ptrvalue;
340    }
341    else if (atp == MODEL_DESCR_pdb_method) {
342       choice = ModelDescr_pdb_method;
343       if (AsnReadVal(aip, atp, &av) <= 0) {
344          goto erret;
345       }
346       anp->data.ptrvalue = av.ptrvalue;
347    }
348    else if (atp == MODEL_DESCR_pdb_comment) {
349       choice = ModelDescr_pdb_comment;
350       if (AsnReadVal(aip, atp, &av) <= 0) {
351          goto erret;
352       }
353       anp->data.ptrvalue = av.ptrvalue;
354    }
355    else if (atp == MODEL_DESCR_other_comment) {
356       choice = ModelDescr_other_comment;
357       if (AsnReadVal(aip, atp, &av) <= 0) {
358          goto erret;
359       }
360       anp->data.ptrvalue = av.ptrvalue;
361    }
362    else if (atp == MODEL_DESCR_attribution) {
363       choice = ModelDescr_attribution;
364       func = (AsnReadFunc) PubAsnRead;
365    }
366    anp->choice = choice;
367    if (func != NULL)
368    {
369       anp->data.ptrvalue = (* func)(aip, atp);
370       if (aip -> io_failure) goto erret;
371 
372       if (nullIsError && anp->data.ptrvalue == NULL) {
373          goto erret;
374       }
375    }
376 
377 ret:
378    AsnUnlinkType(orig);       /* unlink local tree */
379    return anp;
380 
381 erret:
382    anp = MemFree(anp);
383    aip -> io_failure = TRUE;
384    goto ret;
385 }
386 
387 
388 /**************************************************
389 *
390 *    ModelDescrAsnWrite()
391 *
392 **************************************************/
393 Boolean LIBCALL
ModelDescrAsnWrite(ModelDescrPtr anp,AsnIoPtr aip,AsnTypePtr orig)394 ModelDescrAsnWrite(ModelDescrPtr anp, AsnIoPtr aip, AsnTypePtr orig)
395 
396 {
397    DataVal av;
398    AsnTypePtr atp, writetype = NULL;
399    Pointer pnt;
400    AsnWriteFunc func = NULL;
401    Boolean retval = FALSE;
402 
403    if (! loaded)
404    {
405       if (! objmmdb2AsnLoad())
406       return FALSE;
407    }
408 
409    if (aip == NULL)
410    return FALSE;
411 
412    atp = AsnLinkType(orig, MODEL_DESCR);   /* link local tree */
413    if (atp == NULL) {
414       return FALSE;
415    }
416 
417    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
418    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
419    av.ptrvalue = (Pointer)anp;
420    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
421       goto erret;
422    }
423 
424    pnt = anp->data.ptrvalue;
425    switch (anp->choice)
426    {
427    case ModelDescr_name:
428       av.ptrvalue = anp->data.ptrvalue;
429       retval = AsnWrite(aip, MODEL_DESCR_name, &av);
430       break;
431    case ModelDescr_pdb_reso:
432       av.ptrvalue = anp->data.ptrvalue;
433       retval = AsnWrite(aip, MODEL_DESCR_pdb_reso, &av);
434       break;
435    case ModelDescr_pdb_method:
436       av.ptrvalue = anp->data.ptrvalue;
437       retval = AsnWrite(aip, MODEL_DESCR_pdb_method, &av);
438       break;
439    case ModelDescr_pdb_comment:
440       av.ptrvalue = anp->data.ptrvalue;
441       retval = AsnWrite(aip, MODEL_DESCR_pdb_comment, &av);
442       break;
443    case ModelDescr_other_comment:
444       av.ptrvalue = anp->data.ptrvalue;
445       retval = AsnWrite(aip, MODEL_DESCR_other_comment, &av);
446       break;
447    case ModelDescr_attribution:
448       writetype = MODEL_DESCR_attribution;
449       func = (AsnWriteFunc) PubAsnWrite;
450       break;
451    }
452    if (writetype != NULL) {
453       retval = (* func)(pnt, aip, writetype);   /* write it out */
454    }
455    if (!retval) {
456       goto erret;
457    }
458    retval = TRUE;
459 
460 erret:
461    AsnUnlinkType(orig);       /* unlink local tree */
462    return retval;
463 }
464 
465 
466 /**************************************************
467 *
468 *    ModelSpaceNew()
469 *
470 **************************************************/
471 
472 ModelSpacePtr LIBCALL
ModelSpaceNew(void)473 ModelSpaceNew(void)
474 {
475    ModelSpacePtr ptr = MemNew((size_t) sizeof(ModelSpace));
476 
477    return ptr;
478 
479 }
480 
481 
482 /**************************************************
483 *
484 *    ModelSpaceFree()
485 *
486 **************************************************/
487 
488 ModelSpacePtr LIBCALL
ModelSpaceFree(ModelSpacePtr ptr)489 ModelSpaceFree(ModelSpacePtr ptr)
490 {
491 
492    if(ptr == NULL) {
493       return NULL;
494    }
495    ReferenceFrameFree(ptr -> reference_frame);
496    return MemFree(ptr);
497 }
498 
499 
500 /**************************************************
501 *
502 *    ModelSpaceAsnRead()
503 *
504 **************************************************/
505 
506 ModelSpacePtr LIBCALL
ModelSpaceAsnRead(AsnIoPtr aip,AsnTypePtr orig)507 ModelSpaceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
508 {
509    DataVal av;
510    AsnTypePtr atp;
511    Boolean isError = FALSE;
512    AsnReadFunc func;
513    ModelSpacePtr ptr;
514 
515    if (! loaded)
516    {
517       if (! objmmdb2AsnLoad()) {
518          return NULL;
519       }
520    }
521 
522    if (aip == NULL) {
523       return NULL;
524    }
525 
526    if (orig == NULL) {         /* ModelSpace ::= (self contained) */
527       atp = AsnReadId(aip, amp, MODEL_SPACE);
528    } else {
529       atp = AsnLinkType(orig, MODEL_SPACE);
530    }
531    /* link in local tree */
532    if (atp == NULL) {
533       return NULL;
534    }
535 
536    ptr = ModelSpaceNew();
537    if (ptr == NULL) {
538       goto erret;
539    }
540    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
541       goto erret;
542    }
543 
544    atp = AsnReadId(aip,amp, atp);
545    func = NULL;
546 
547    if (atp == MODEL_SPACE_coordinate_units) {
548       if ( AsnReadVal(aip, atp, &av) <= 0) {
549          goto erret;
550       }
551       ptr -> coordinate_units = av.intvalue;
552       atp = AsnReadId(aip,amp, atp);
553    }
554    if (atp == MODEL_SPACE_thermal_factor_units) {
555       if ( AsnReadVal(aip, atp, &av) <= 0) {
556          goto erret;
557       }
558       ptr -> thermal_factor_units = av.intvalue;
559       ptr -> OBbits__ |= 1<<0;
560       atp = AsnReadId(aip,amp, atp);
561    }
562    if (atp == MODEL_SPACE_occupancy_factor_units) {
563       if ( AsnReadVal(aip, atp, &av) <= 0) {
564          goto erret;
565       }
566       ptr -> occupancy_factor_units = av.intvalue;
567       ptr -> OBbits__ |= 1<<1;
568       atp = AsnReadId(aip,amp, atp);
569    }
570    if (atp == MODEL_SPACE_density_units) {
571       if ( AsnReadVal(aip, atp, &av) <= 0) {
572          goto erret;
573       }
574       ptr -> density_units = av.intvalue;
575       ptr -> OBbits__ |= 1<<2;
576       atp = AsnReadId(aip,amp, atp);
577    }
578    if (atp == MODEL_SPACE_reference_frame) {
579       ptr -> reference_frame = ReferenceFrameAsnRead(aip, atp);
580       if (aip -> io_failure) {
581          goto erret;
582       }
583       atp = AsnReadId(aip,amp, atp);
584    }
585 
586    if (AsnReadVal(aip, atp, &av) <= 0) {
587       goto erret;
588    }
589    /* end struct */
590 
591 ret:
592    AsnUnlinkType(orig);       /* unlink local tree */
593    return ptr;
594 
595 erret:
596    aip -> io_failure = TRUE;
597    ptr = ModelSpaceFree(ptr);
598    goto ret;
599 }
600 
601 
602 
603 /**************************************************
604 *
605 *    ModelSpaceAsnWrite()
606 *
607 **************************************************/
608 Boolean LIBCALL
ModelSpaceAsnWrite(ModelSpacePtr ptr,AsnIoPtr aip,AsnTypePtr orig)609 ModelSpaceAsnWrite(ModelSpacePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
610 {
611    DataVal av;
612    AsnTypePtr atp;
613    Boolean retval = FALSE;
614 
615    if (! loaded)
616    {
617       if (! objmmdb2AsnLoad()) {
618          return FALSE;
619       }
620    }
621 
622    if (aip == NULL) {
623       return FALSE;
624    }
625 
626    atp = AsnLinkType(orig, MODEL_SPACE);   /* link local tree */
627    if (atp == NULL) {
628       return FALSE;
629    }
630 
631    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
632    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
633    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
634       goto erret;
635    }
636 
637    av.intvalue = ptr -> coordinate_units;
638    retval = AsnWrite(aip, MODEL_SPACE_coordinate_units,  &av);
639    if (ptr -> thermal_factor_units || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> thermal_factor_units;
640       retval = AsnWrite(aip, MODEL_SPACE_thermal_factor_units,  &av);
641    }
642    if (ptr -> occupancy_factor_units || (ptr -> OBbits__ & (1<<1) )){   av.intvalue = ptr -> occupancy_factor_units;
643       retval = AsnWrite(aip, MODEL_SPACE_occupancy_factor_units,  &av);
644    }
645    if (ptr -> density_units || (ptr -> OBbits__ & (1<<2) )){   av.intvalue = ptr -> density_units;
646       retval = AsnWrite(aip, MODEL_SPACE_density_units,  &av);
647    }
648    if (ptr -> reference_frame != NULL) {
649       if ( ! ReferenceFrameAsnWrite(ptr -> reference_frame, aip, MODEL_SPACE_reference_frame)) {
650          goto erret;
651       }
652    }
653    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
654       goto erret;
655    }
656    retval = TRUE;
657 
658 erret:
659    AsnUnlinkType(orig);       /* unlink local tree */
660    return retval;
661 }
662 
663 
664 
665 /**************************************************
666 *
667 *    ModelCoordinateSetNew()
668 *
669 **************************************************/
670 
671 ModelCoordinateSetPtr LIBCALL
ModelCoordinateSetNew(void)672 ModelCoordinateSetNew(void)
673 {
674    ModelCoordinateSetPtr ptr = MemNew((size_t) sizeof(ModelCoordinateSet));
675 
676    return ptr;
677 
678 }
679 
680 
681 /**************************************************
682 *
683 *    ModelCoordinateSetFree()
684 *
685 **************************************************/
686 
687 ModelCoordinateSetPtr LIBCALL
ModelCoordinateSetFree(ModelCoordinateSetPtr ptr)688 ModelCoordinateSetFree(ModelCoordinateSetPtr ptr)
689 {
690 
691    if(ptr == NULL) {
692       return NULL;
693    }
694    AsnGenericChoiceSeqOfFree(ptr -> descr, (AsnOptFreeFunc) ModelDescrFree);
695    Coordinates_coordinatesFree(ptr -> Coordinates_coordinates);
696    return MemFree(ptr);
697 }
698 
699 
700 /**************************************************
701 *
702 *    Coordinates_coordinatesFree()
703 *
704 **************************************************/
705 static
706 Coordinates_coordinatesPtr LIBCALL
Coordinates_coordinatesFree(ValNodePtr anp)707 Coordinates_coordinatesFree(ValNodePtr anp)
708 {
709    Pointer pnt;
710 
711    if (anp == NULL) {
712       return NULL;
713    }
714 
715    pnt = anp->data.ptrvalue;
716    switch (anp->choice)
717    {
718    default:
719       break;
720    case Coordinates_coordinates_literal:
721       CoordinatesFree(anp -> data.ptrvalue);
722       break;
723    case Coordinates_coordinates_reference:
724       ChemGraphAlignmentFree(anp -> data.ptrvalue);
725       break;
726    }
727    return MemFree(anp);
728 }
729 
730 
731 /**************************************************
732 *
733 *    ModelCoordinateSetAsnRead()
734 *
735 **************************************************/
736 
737 ModelCoordinateSetPtr LIBCALL
ModelCoordinateSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)738 ModelCoordinateSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
739 {
740    DataVal av;
741    AsnTypePtr atp;
742    Boolean isError = FALSE;
743    AsnReadFunc func;
744    ModelCoordinateSetPtr ptr;
745 
746    if (! loaded)
747    {
748       if (! objmmdb2AsnLoad()) {
749          return NULL;
750       }
751    }
752 
753    if (aip == NULL) {
754       return NULL;
755    }
756 
757    if (orig == NULL) {         /* ModelCoordinateSet ::= (self contained) */
758       atp = AsnReadId(aip, amp, MODEL_COORDINATE_SET);
759    } else {
760       atp = AsnLinkType(orig, MODEL_COORDINATE_SET);
761    }
762    /* link in local tree */
763    if (atp == NULL) {
764       return NULL;
765    }
766 
767    ptr = ModelCoordinateSetNew();
768    if (ptr == NULL) {
769       goto erret;
770    }
771    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
772       goto erret;
773    }
774 
775    atp = AsnReadId(aip,amp, atp);
776    func = NULL;
777 
778    if (atp == MODEL_COORDINATE_SET_id) {
779       if ( AsnReadVal(aip, atp, &av) <= 0) {
780          goto erret;
781       }
782       ptr -> id = av.intvalue;
783       ptr -> OBbits__ |= 1<<0;
784       atp = AsnReadId(aip,amp, atp);
785    }
786    if (atp == MODEL_COORDINATE_SET_descr) {
787       ptr -> descr = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ModelDescrAsnRead, (AsnOptFreeFunc) ModelDescrFree);
788       if (isError && ptr -> descr == NULL) {
789          goto erret;
790       }
791       atp = AsnReadId(aip,amp, atp);
792    }
793    if (atp == MODEL_COORDINATE_SET_coordinates) {
794       ptr -> Coordinates_coordinates = Coordinates_coordinatesAsnRead(aip, atp);
795       if (aip -> io_failure) {
796          goto erret;
797       }
798       atp = AsnReadId(aip,amp, atp);
799    }
800 
801    if (AsnReadVal(aip, atp, &av) <= 0) {
802       goto erret;
803    }
804    /* end struct */
805 
806 ret:
807    AsnUnlinkType(orig);       /* unlink local tree */
808    return ptr;
809 
810 erret:
811    aip -> io_failure = TRUE;
812    ptr = ModelCoordinateSetFree(ptr);
813    goto ret;
814 }
815 
816 
817 
818 /**************************************************
819 *
820 *    Coordinates_coordinatesAsnRead()
821 *
822 **************************************************/
823 static
824 Coordinates_coordinatesPtr LIBCALL
Coordinates_coordinatesAsnRead(AsnIoPtr aip,AsnTypePtr orig)825 Coordinates_coordinatesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
826 {
827    DataVal av;
828    AsnTypePtr atp;
829    ValNodePtr anp;
830    Uint1 choice;
831    Boolean isError = FALSE;
832    Boolean nullIsError = FALSE;
833    AsnReadFunc func;
834 
835    if (! loaded)
836    {
837       if (! objmmdb2AsnLoad()) {
838          return NULL;
839       }
840    }
841 
842    if (aip == NULL) {
843       return NULL;
844    }
845 
846    if (orig == NULL) {         /* Coordinates_coordinates ::= (self contained) */
847       atp = AsnReadId(aip, amp, MODEL_COORDINATE_SET_coordinates);
848    } else {
849       atp = AsnLinkType(orig, MODEL_COORDINATE_SET_coordinates);    /* link in local tree */
850    }
851    if (atp == NULL) {
852       return NULL;
853    }
854 
855    anp = ValNodeNew(NULL);
856    if (anp == NULL) {
857       goto erret;
858    }
859    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
860       goto erret;
861    }
862 
863    func = NULL;
864 
865    atp = AsnReadId(aip, amp, atp);  /* find the choice */
866    if (atp == NULL) {
867       goto erret;
868    }
869    if (atp == MODEL_COORDINATE_SET_coordinates_literal) {
870       choice = Coordinates_coordinates_literal;
871       func = (AsnReadFunc) CoordinatesAsnRead;
872    }
873    else if (atp == MODEL_COORDINATE_SET_coordinates_reference) {
874       choice = Coordinates_coordinates_reference;
875       func = (AsnReadFunc) ChemGraphAlignmentAsnRead;
876    }
877    anp->choice = choice;
878    if (func != NULL)
879    {
880       anp->data.ptrvalue = (* func)(aip, atp);
881       if (aip -> io_failure) goto erret;
882 
883       if (nullIsError && anp->data.ptrvalue == NULL) {
884          goto erret;
885       }
886    }
887 
888 ret:
889    AsnUnlinkType(orig);       /* unlink local tree */
890    return anp;
891 
892 erret:
893    anp = MemFree(anp);
894    aip -> io_failure = TRUE;
895    goto ret;
896 }
897 
898 
899 /**************************************************
900 *
901 *    ModelCoordinateSetAsnWrite()
902 *
903 **************************************************/
904 Boolean LIBCALL
ModelCoordinateSetAsnWrite(ModelCoordinateSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)905 ModelCoordinateSetAsnWrite(ModelCoordinateSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
906 {
907    DataVal av;
908    AsnTypePtr atp;
909    Boolean retval = FALSE;
910 
911    if (! loaded)
912    {
913       if (! objmmdb2AsnLoad()) {
914          return FALSE;
915       }
916    }
917 
918    if (aip == NULL) {
919       return FALSE;
920    }
921 
922    atp = AsnLinkType(orig, MODEL_COORDINATE_SET);   /* link local tree */
923    if (atp == NULL) {
924       return FALSE;
925    }
926 
927    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
928    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
929    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
930       goto erret;
931    }
932 
933    if (ptr -> id || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> id;
934       retval = AsnWrite(aip, MODEL_COORDINATE_SET_id,  &av);
935    }
936    AsnGenericChoiceSeqOfAsnWrite(ptr -> descr, (AsnWriteFunc) ModelDescrAsnWrite, aip, MODEL_COORDINATE_SET_descr, MODEL_COORDINATE_SET_descr_E);
937    if (ptr -> Coordinates_coordinates != NULL) {
938       if ( ! Coordinates_coordinatesAsnWrite(ptr -> Coordinates_coordinates, aip, MODEL_COORDINATE_SET_coordinates)) {
939          goto erret;
940       }
941    }
942    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
943       goto erret;
944    }
945    retval = TRUE;
946 
947 erret:
948    AsnUnlinkType(orig);       /* unlink local tree */
949    return retval;
950 }
951 
952 
953 
954 /**************************************************
955 *
956 *    Coordinates_coordinatesAsnWrite()
957 *
958 **************************************************/
959 static Boolean LIBCALL
Coordinates_coordinatesAsnWrite(Coordinates_coordinatesPtr anp,AsnIoPtr aip,AsnTypePtr orig)960 Coordinates_coordinatesAsnWrite(Coordinates_coordinatesPtr anp, AsnIoPtr aip, AsnTypePtr orig)
961 
962 {
963    DataVal av;
964    AsnTypePtr atp, writetype = NULL;
965    Pointer pnt;
966    AsnWriteFunc func = NULL;
967    Boolean retval = FALSE;
968 
969    if (! loaded)
970    {
971       if (! objmmdb2AsnLoad())
972       return FALSE;
973    }
974 
975    if (aip == NULL)
976    return FALSE;
977 
978    atp = AsnLinkType(orig, MODEL_COORDINATE_SET_coordinates);   /* link local tree */
979    if (atp == NULL) {
980       return FALSE;
981    }
982 
983    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
984    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
985    av.ptrvalue = (Pointer)anp;
986    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
987       goto erret;
988    }
989 
990    pnt = anp->data.ptrvalue;
991    switch (anp->choice)
992    {
993    case Coordinates_coordinates_literal:
994       writetype = MODEL_COORDINATE_SET_coordinates_literal;
995       func = (AsnWriteFunc) CoordinatesAsnWrite;
996       break;
997    case Coordinates_coordinates_reference:
998       writetype = MODEL_COORDINATE_SET_coordinates_reference;
999       func = (AsnWriteFunc) ChemGraphAlignmentAsnWrite;
1000       break;
1001    }
1002    if (writetype != NULL) {
1003       retval = (* func)(pnt, aip, writetype);   /* write it out */
1004    }
1005    if (!retval) {
1006       goto erret;
1007    }
1008    retval = TRUE;
1009 
1010 erret:
1011    AsnUnlinkType(orig);       /* unlink local tree */
1012    return retval;
1013 }
1014 
1015 
1016 /**************************************************
1017 *
1018 *    ReferenceFrameNew()
1019 *
1020 **************************************************/
1021 
1022 ReferenceFramePtr LIBCALL
ReferenceFrameNew(void)1023 ReferenceFrameNew(void)
1024 {
1025    ReferenceFramePtr ptr = MemNew((size_t) sizeof(ReferenceFrame));
1026 
1027    return ptr;
1028 
1029 }
1030 
1031 
1032 /**************************************************
1033 *
1034 *    ReferenceFrameFree()
1035 *
1036 **************************************************/
1037 
1038 ReferenceFramePtr LIBCALL
ReferenceFrameFree(ReferenceFramePtr ptr)1039 ReferenceFrameFree(ReferenceFramePtr ptr)
1040 {
1041 
1042    if(ptr == NULL) {
1043       return NULL;
1044    }
1045    BiostrucIdFree(ptr -> biostruc_id);
1046    TransformFree(ptr -> rotation_translation);
1047    return MemFree(ptr);
1048 }
1049 
1050 
1051 /**************************************************
1052 *
1053 *    ReferenceFrameAsnRead()
1054 *
1055 **************************************************/
1056 
1057 ReferenceFramePtr LIBCALL
ReferenceFrameAsnRead(AsnIoPtr aip,AsnTypePtr orig)1058 ReferenceFrameAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1059 {
1060    DataVal av;
1061    AsnTypePtr atp;
1062    Boolean isError = FALSE;
1063    AsnReadFunc func;
1064    ReferenceFramePtr ptr;
1065 
1066    if (! loaded)
1067    {
1068       if (! objmmdb2AsnLoad()) {
1069          return NULL;
1070       }
1071    }
1072 
1073    if (aip == NULL) {
1074       return NULL;
1075    }
1076 
1077    if (orig == NULL) {         /* ReferenceFrame ::= (self contained) */
1078       atp = AsnReadId(aip, amp, REFERENCE_FRAME);
1079    } else {
1080       atp = AsnLinkType(orig, REFERENCE_FRAME);
1081    }
1082    /* link in local tree */
1083    if (atp == NULL) {
1084       return NULL;
1085    }
1086 
1087    ptr = ReferenceFrameNew();
1088    if (ptr == NULL) {
1089       goto erret;
1090    }
1091    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1092       goto erret;
1093    }
1094 
1095    atp = AsnReadId(aip,amp, atp);
1096    func = NULL;
1097 
1098    if (atp == REFERENCE_FRAME_biostruc_id) {
1099       ptr -> biostruc_id = BiostrucIdAsnRead(aip, atp);
1100       if (aip -> io_failure) {
1101          goto erret;
1102       }
1103       atp = AsnReadId(aip,amp, atp);
1104    }
1105    if (atp == REFERENCE_FRAME_rotation_translation) {
1106       ptr -> rotation_translation = TransformAsnRead(aip, atp);
1107       if (aip -> io_failure) {
1108          goto erret;
1109       }
1110       atp = AsnReadId(aip,amp, atp);
1111    }
1112 
1113    if (AsnReadVal(aip, atp, &av) <= 0) {
1114       goto erret;
1115    }
1116    /* end struct */
1117 
1118 ret:
1119    AsnUnlinkType(orig);       /* unlink local tree */
1120    return ptr;
1121 
1122 erret:
1123    aip -> io_failure = TRUE;
1124    ptr = ReferenceFrameFree(ptr);
1125    goto ret;
1126 }
1127 
1128 
1129 
1130 /**************************************************
1131 *
1132 *    ReferenceFrameAsnWrite()
1133 *
1134 **************************************************/
1135 Boolean LIBCALL
ReferenceFrameAsnWrite(ReferenceFramePtr ptr,AsnIoPtr aip,AsnTypePtr orig)1136 ReferenceFrameAsnWrite(ReferenceFramePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1137 {
1138    AsnTypePtr atp;
1139    Boolean retval = FALSE;
1140 
1141    if (! loaded)
1142    {
1143       if (! objmmdb2AsnLoad()) {
1144          return FALSE;
1145       }
1146    }
1147 
1148    if (aip == NULL) {
1149       return FALSE;
1150    }
1151 
1152    atp = AsnLinkType(orig, REFERENCE_FRAME);   /* link local tree */
1153    if (atp == NULL) {
1154       return FALSE;
1155    }
1156 
1157    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1158    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1159       goto erret;
1160    }
1161 
1162    if (ptr -> biostruc_id != NULL) {
1163       if ( ! BiostrucIdAsnWrite(ptr -> biostruc_id, aip, REFERENCE_FRAME_biostruc_id)) {
1164          goto erret;
1165       }
1166    }
1167    if (ptr -> rotation_translation != NULL) {
1168       if ( ! TransformAsnWrite(ptr -> rotation_translation, aip, REFERENCE_FRAME_rotation_translation)) {
1169          goto erret;
1170       }
1171    }
1172    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1173       goto erret;
1174    }
1175    retval = TRUE;
1176 
1177 erret:
1178    AsnUnlinkType(orig);       /* unlink local tree */
1179    return retval;
1180 }
1181 
1182 
1183 
1184 /**************************************************
1185 *
1186 *    CoordinatesFree()
1187 *
1188 **************************************************/
1189 
1190 CoordinatesPtr LIBCALL
CoordinatesFree(ValNodePtr anp)1191 CoordinatesFree(ValNodePtr anp)
1192 {
1193    Pointer pnt;
1194 
1195    if (anp == NULL) {
1196       return NULL;
1197    }
1198 
1199    pnt = anp->data.ptrvalue;
1200    switch (anp->choice)
1201    {
1202    default:
1203       break;
1204    case Coordinates_atomic:
1205       AtomicCoordinatesFree(anp -> data.ptrvalue);
1206       break;
1207    case Coordinates_surface:
1208       SurfaceCoordinatesFree(anp -> data.ptrvalue);
1209       break;
1210    case Coordinates_density:
1211       DensityCoordinatesFree(anp -> data.ptrvalue);
1212       break;
1213    }
1214    return MemFree(anp);
1215 }
1216 
1217 
1218 /**************************************************
1219 *
1220 *    CoordinatesAsnRead()
1221 *
1222 **************************************************/
1223 
1224 CoordinatesPtr LIBCALL
CoordinatesAsnRead(AsnIoPtr aip,AsnTypePtr orig)1225 CoordinatesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1226 {
1227    DataVal av;
1228    AsnTypePtr atp;
1229    ValNodePtr anp;
1230    Uint1 choice;
1231    Boolean isError = FALSE;
1232    Boolean nullIsError = FALSE;
1233    AsnReadFunc func;
1234 
1235    if (! loaded)
1236    {
1237       if (! objmmdb2AsnLoad()) {
1238          return NULL;
1239       }
1240    }
1241 
1242    if (aip == NULL) {
1243       return NULL;
1244    }
1245 
1246    if (orig == NULL) {         /* Coordinates ::= (self contained) */
1247       atp = AsnReadId(aip, amp, COORDINATES);
1248    } else {
1249       atp = AsnLinkType(orig, COORDINATES);    /* link in local tree */
1250    }
1251    if (atp == NULL) {
1252       return NULL;
1253    }
1254 
1255    anp = ValNodeNew(NULL);
1256    if (anp == NULL) {
1257       goto erret;
1258    }
1259    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1260       goto erret;
1261    }
1262 
1263    func = NULL;
1264 
1265    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1266    if (atp == NULL) {
1267       goto erret;
1268    }
1269    if (atp == COORDINATES_atomic) {
1270       choice = Coordinates_atomic;
1271       func = (AsnReadFunc) AtomicCoordinatesAsnRead;
1272    }
1273    else if (atp == COORDINATES_surface) {
1274       choice = Coordinates_surface;
1275       func = (AsnReadFunc) SurfaceCoordinatesAsnRead;
1276    }
1277    else if (atp == COORDINATES_density) {
1278       choice = Coordinates_density;
1279       func = (AsnReadFunc) DensityCoordinatesAsnRead;
1280    }
1281    anp->choice = choice;
1282    if (func != NULL)
1283    {
1284       anp->data.ptrvalue = (* func)(aip, atp);
1285       if (aip -> io_failure) goto erret;
1286 
1287       if (nullIsError && anp->data.ptrvalue == NULL) {
1288          goto erret;
1289       }
1290    }
1291 
1292 ret:
1293    AsnUnlinkType(orig);       /* unlink local tree */
1294    return anp;
1295 
1296 erret:
1297    anp = MemFree(anp);
1298    aip -> io_failure = TRUE;
1299    goto ret;
1300 }
1301 
1302 
1303 /**************************************************
1304 *
1305 *    CoordinatesAsnWrite()
1306 *
1307 **************************************************/
1308 Boolean LIBCALL
CoordinatesAsnWrite(CoordinatesPtr anp,AsnIoPtr aip,AsnTypePtr orig)1309 CoordinatesAsnWrite(CoordinatesPtr anp, AsnIoPtr aip, AsnTypePtr orig)
1310 
1311 {
1312    DataVal av;
1313    AsnTypePtr atp, writetype = NULL;
1314    Pointer pnt;
1315    AsnWriteFunc func = NULL;
1316    Boolean retval = FALSE;
1317 
1318    if (! loaded)
1319    {
1320       if (! objmmdb2AsnLoad())
1321       return FALSE;
1322    }
1323 
1324    if (aip == NULL)
1325    return FALSE;
1326 
1327    atp = AsnLinkType(orig, COORDINATES);   /* link local tree */
1328    if (atp == NULL) {
1329       return FALSE;
1330    }
1331 
1332    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1333    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1334    av.ptrvalue = (Pointer)anp;
1335    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1336       goto erret;
1337    }
1338 
1339    pnt = anp->data.ptrvalue;
1340    switch (anp->choice)
1341    {
1342    case Coordinates_atomic:
1343       writetype = COORDINATES_atomic;
1344       func = (AsnWriteFunc) AtomicCoordinatesAsnWrite;
1345       break;
1346    case Coordinates_surface:
1347       writetype = COORDINATES_surface;
1348       func = (AsnWriteFunc) SurfaceCoordinatesAsnWrite;
1349       break;
1350    case Coordinates_density:
1351       writetype = COORDINATES_density;
1352       func = (AsnWriteFunc) DensityCoordinatesAsnWrite;
1353       break;
1354    }
1355    if (writetype != NULL) {
1356       retval = (* func)(pnt, aip, writetype);   /* write it out */
1357    }
1358    if (!retval) {
1359       goto erret;
1360    }
1361    retval = TRUE;
1362 
1363 erret:
1364    AsnUnlinkType(orig);       /* unlink local tree */
1365    return retval;
1366 }
1367 
1368 
1369 /**************************************************
1370 *
1371 *    AtomicCoordinatesNew()
1372 *
1373 **************************************************/
1374 
1375 AtomicCoordinatesPtr LIBCALL
AtomicCoordinatesNew(void)1376 AtomicCoordinatesNew(void)
1377 {
1378    AtomicCoordinatesPtr ptr = MemNew((size_t) sizeof(AtomicCoordinates));
1379 
1380    return ptr;
1381 
1382 }
1383 
1384 
1385 /**************************************************
1386 *
1387 *    AtomicCoordinatesFree()
1388 *
1389 **************************************************/
1390 
1391 AtomicCoordinatesPtr LIBCALL
AtomicCoordinatesFree(AtomicCoordinatesPtr ptr)1392 AtomicCoordinatesFree(AtomicCoordinatesPtr ptr)
1393 {
1394 
1395    if(ptr == NULL) {
1396       return NULL;
1397    }
1398    AtomPntrsFree(ptr -> atoms);
1399    ModelSpacePointsFree(ptr -> sites);
1400    AtomicTemperatureFactorsFree(ptr -> temperature_factors);
1401    AtomicOccupanciesFree(ptr -> occupancies);
1402    AlternateConformationIdsFree(ptr -> alternate_conf_ids);
1403    AsnGenericUserSeqOfFree(ptr -> conf_ensembles, (AsnOptFreeFunc) ConformationEnsembleFree);
1404    return MemFree(ptr);
1405 }
1406 
1407 
1408 /**************************************************
1409 *
1410 *    AtomicCoordinatesAsnRead()
1411 *
1412 **************************************************/
1413 
1414 AtomicCoordinatesPtr LIBCALL
AtomicCoordinatesAsnRead(AsnIoPtr aip,AsnTypePtr orig)1415 AtomicCoordinatesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1416 {
1417    DataVal av;
1418    AsnTypePtr atp;
1419    Boolean isError = FALSE;
1420    AsnReadFunc func;
1421    AtomicCoordinatesPtr ptr;
1422 
1423    if (! loaded)
1424    {
1425       if (! objmmdb2AsnLoad()) {
1426          return NULL;
1427       }
1428    }
1429 
1430    if (aip == NULL) {
1431       return NULL;
1432    }
1433 
1434    if (orig == NULL) {         /* AtomicCoordinates ::= (self contained) */
1435       atp = AsnReadId(aip, amp, ATOMIC_COORDINATES);
1436    } else {
1437       atp = AsnLinkType(orig, ATOMIC_COORDINATES);
1438    }
1439    /* link in local tree */
1440    if (atp == NULL) {
1441       return NULL;
1442    }
1443 
1444    ptr = AtomicCoordinatesNew();
1445    if (ptr == NULL) {
1446       goto erret;
1447    }
1448    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1449       goto erret;
1450    }
1451 
1452    atp = AsnReadId(aip,amp, atp);
1453    func = NULL;
1454 
1455    if (atp == ATOMIC_COORDINATES_number_of_points) {
1456       if ( AsnReadVal(aip, atp, &av) <= 0) {
1457          goto erret;
1458       }
1459       ptr -> number_of_points = av.intvalue;
1460       atp = AsnReadId(aip,amp, atp);
1461    }
1462    if (atp == ATOMIC_COORDINATES_atoms) {
1463       ptr -> atoms = AtomPntrsAsnRead(aip, atp);
1464       if (aip -> io_failure) {
1465          goto erret;
1466       }
1467       atp = AsnReadId(aip,amp, atp);
1468    }
1469    if (atp == ATOMIC_COORDINATES_sites) {
1470       ptr -> sites = ModelSpacePointsAsnRead(aip, atp);
1471       if (aip -> io_failure) {
1472          goto erret;
1473       }
1474       atp = AsnReadId(aip,amp, atp);
1475    }
1476    if (atp == ATOMIC_COORDINATES_temperature_factors) {
1477       ptr -> temperature_factors = AtomicTemperatureFactorsAsnRead(aip, atp);
1478       if (aip -> io_failure) {
1479          goto erret;
1480       }
1481       atp = AsnReadId(aip,amp, atp);
1482    }
1483    if (atp == ATOMIC_COORDINATES_occupancies) {
1484       ptr -> occupancies = AtomicOccupanciesAsnRead(aip, atp);
1485       if (aip -> io_failure) {
1486          goto erret;
1487       }
1488       atp = AsnReadId(aip,amp, atp);
1489    }
1490    if (atp == ATOMIC_COORDINATES_alternate_conf_ids) {
1491       ptr -> alternate_conf_ids = AlternateConformationIdsAsnRead(aip, atp);
1492       if (aip -> io_failure) {
1493          goto erret;
1494       }
1495       atp = AsnReadId(aip,amp, atp);
1496    }
1497    if (atp == ATOMIC_COORDINATES_conf_ensembles) {
1498       ptr -> conf_ensembles = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ConformationEnsembleAsnRead, (AsnOptFreeFunc) ConformationEnsembleFree);
1499       if (isError && ptr -> conf_ensembles == NULL) {
1500          goto erret;
1501       }
1502       atp = AsnReadId(aip,amp, atp);
1503    }
1504 
1505    if (AsnReadVal(aip, atp, &av) <= 0) {
1506       goto erret;
1507    }
1508    /* end struct */
1509 
1510 ret:
1511    AsnUnlinkType(orig);       /* unlink local tree */
1512    return ptr;
1513 
1514 erret:
1515    aip -> io_failure = TRUE;
1516    ptr = AtomicCoordinatesFree(ptr);
1517    goto ret;
1518 }
1519 
1520 
1521 
1522 /**************************************************
1523 *
1524 *    AtomicCoordinatesAsnWrite()
1525 *
1526 **************************************************/
1527 Boolean LIBCALL
AtomicCoordinatesAsnWrite(AtomicCoordinatesPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1528 AtomicCoordinatesAsnWrite(AtomicCoordinatesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1529 {
1530    DataVal av;
1531    AsnTypePtr atp;
1532    Boolean retval = FALSE;
1533 
1534    if (! loaded)
1535    {
1536       if (! objmmdb2AsnLoad()) {
1537          return FALSE;
1538       }
1539    }
1540 
1541    if (aip == NULL) {
1542       return FALSE;
1543    }
1544 
1545    atp = AsnLinkType(orig, ATOMIC_COORDINATES);   /* link local tree */
1546    if (atp == NULL) {
1547       return FALSE;
1548    }
1549 
1550    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1551    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1552    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1553       goto erret;
1554    }
1555 
1556    av.intvalue = ptr -> number_of_points;
1557    retval = AsnWrite(aip, ATOMIC_COORDINATES_number_of_points,  &av);
1558    if (ptr -> atoms != NULL) {
1559       if ( ! AtomPntrsAsnWrite(ptr -> atoms, aip, ATOMIC_COORDINATES_atoms)) {
1560          goto erret;
1561       }
1562    }
1563    if (ptr -> sites != NULL) {
1564       if ( ! ModelSpacePointsAsnWrite(ptr -> sites, aip, ATOMIC_COORDINATES_sites)) {
1565          goto erret;
1566       }
1567    }
1568    if (ptr -> temperature_factors != NULL) {
1569       if ( ! AtomicTemperatureFactorsAsnWrite(ptr -> temperature_factors, aip, ATOMIC_COORDINATES_temperature_factors)) {
1570          goto erret;
1571       }
1572    }
1573    if (ptr -> occupancies != NULL) {
1574       if ( ! AtomicOccupanciesAsnWrite(ptr -> occupancies, aip, ATOMIC_COORDINATES_occupancies)) {
1575          goto erret;
1576       }
1577    }
1578    if (ptr -> alternate_conf_ids != NULL) {
1579       if ( ! AlternateConformationIdsAsnWrite(ptr -> alternate_conf_ids, aip, ATOMIC_COORDINATES_alternate_conf_ids)) {
1580          goto erret;
1581       }
1582    }
1583    AsnGenericUserSeqOfAsnWrite(ptr -> conf_ensembles, (AsnWriteFunc) ConformationEnsembleAsnWrite, aip, ATOMIC_COORDINATES_conf_ensembles, ATOMIC_COORDINATES_conf_ensembles_E);
1584    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1585       goto erret;
1586    }
1587    retval = TRUE;
1588 
1589 erret:
1590    AsnUnlinkType(orig);       /* unlink local tree */
1591    return retval;
1592 }
1593 
1594 
1595 
1596 /**************************************************
1597 *
1598 *    SurfaceCoordinatesNew()
1599 *
1600 **************************************************/
1601 
1602 SurfaceCoordinatesPtr LIBCALL
SurfaceCoordinatesNew(void)1603 SurfaceCoordinatesNew(void)
1604 {
1605    SurfaceCoordinatesPtr ptr = MemNew((size_t) sizeof(SurfaceCoordinates));
1606 
1607    return ptr;
1608 
1609 }
1610 
1611 
1612 /**************************************************
1613 *
1614 *    SurfaceCoordinatesFree()
1615 *
1616 **************************************************/
1617 
1618 SurfaceCoordinatesPtr LIBCALL
SurfaceCoordinatesFree(SurfaceCoordinatesPtr ptr)1619 SurfaceCoordinatesFree(SurfaceCoordinatesPtr ptr)
1620 {
1621 
1622    if(ptr == NULL) {
1623       return NULL;
1624    }
1625    ChemGraphPntrsFree(ptr -> contents);
1626    Surface_surfaceFree(ptr -> Surface_surface);
1627    return MemFree(ptr);
1628 }
1629 
1630 
1631 /**************************************************
1632 *
1633 *    Surface_surfaceFree()
1634 *
1635 **************************************************/
1636 static
1637 Surface_surfacePtr LIBCALL
Surface_surfaceFree(ValNodePtr anp)1638 Surface_surfaceFree(ValNodePtr anp)
1639 {
1640    Pointer pnt;
1641 
1642    if (anp == NULL) {
1643       return NULL;
1644    }
1645 
1646    pnt = anp->data.ptrvalue;
1647    switch (anp->choice)
1648    {
1649    default:
1650       break;
1651    case Surface_surface_sphere:
1652       SphereFree(anp -> data.ptrvalue);
1653       break;
1654    case Surface_surface_cone:
1655       ConeFree(anp -> data.ptrvalue);
1656       break;
1657    case Surface_surface_cylinder:
1658       CylinderFree(anp -> data.ptrvalue);
1659       break;
1660    case Surface_surface_brick:
1661       BrickFree(anp -> data.ptrvalue);
1662       break;
1663    case Surface_surface_tmesh:
1664       TMeshFree(anp -> data.ptrvalue);
1665       break;
1666    case Surface_surface_triangles:
1667       TrianglesFree(anp -> data.ptrvalue);
1668       break;
1669    }
1670    return MemFree(anp);
1671 }
1672 
1673 
1674 /**************************************************
1675 *
1676 *    SurfaceCoordinatesAsnRead()
1677 *
1678 **************************************************/
1679 
1680 SurfaceCoordinatesPtr LIBCALL
SurfaceCoordinatesAsnRead(AsnIoPtr aip,AsnTypePtr orig)1681 SurfaceCoordinatesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1682 {
1683    DataVal av;
1684    AsnTypePtr atp;
1685    Boolean isError = FALSE;
1686    AsnReadFunc func;
1687    SurfaceCoordinatesPtr ptr;
1688 
1689    if (! loaded)
1690    {
1691       if (! objmmdb2AsnLoad()) {
1692          return NULL;
1693       }
1694    }
1695 
1696    if (aip == NULL) {
1697       return NULL;
1698    }
1699 
1700    if (orig == NULL) {         /* SurfaceCoordinates ::= (self contained) */
1701       atp = AsnReadId(aip, amp, SURFACE_COORDINATES);
1702    } else {
1703       atp = AsnLinkType(orig, SURFACE_COORDINATES);
1704    }
1705    /* link in local tree */
1706    if (atp == NULL) {
1707       return NULL;
1708    }
1709 
1710    ptr = SurfaceCoordinatesNew();
1711    if (ptr == NULL) {
1712       goto erret;
1713    }
1714    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1715       goto erret;
1716    }
1717 
1718    atp = AsnReadId(aip,amp, atp);
1719    func = NULL;
1720 
1721    if (atp == SURFACE_COORDINATES_contents) {
1722       ptr -> contents = ChemGraphPntrsAsnRead(aip, atp);
1723       if (aip -> io_failure) {
1724          goto erret;
1725       }
1726       atp = AsnReadId(aip,amp, atp);
1727    }
1728    if (atp == SURFACE_COORDINATES_surface) {
1729       ptr -> Surface_surface = Surface_surfaceAsnRead(aip, atp);
1730       if (aip -> io_failure) {
1731          goto erret;
1732       }
1733       atp = AsnReadId(aip,amp, atp);
1734    }
1735 
1736    if (AsnReadVal(aip, atp, &av) <= 0) {
1737       goto erret;
1738    }
1739    /* end struct */
1740 
1741 ret:
1742    AsnUnlinkType(orig);       /* unlink local tree */
1743    return ptr;
1744 
1745 erret:
1746    aip -> io_failure = TRUE;
1747    ptr = SurfaceCoordinatesFree(ptr);
1748    goto ret;
1749 }
1750 
1751 
1752 
1753 /**************************************************
1754 *
1755 *    Surface_surfaceAsnRead()
1756 *
1757 **************************************************/
1758 static
1759 Surface_surfacePtr LIBCALL
Surface_surfaceAsnRead(AsnIoPtr aip,AsnTypePtr orig)1760 Surface_surfaceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1761 {
1762    DataVal av;
1763    AsnTypePtr atp;
1764    ValNodePtr anp;
1765    Uint1 choice;
1766    Boolean isError = FALSE;
1767    Boolean nullIsError = FALSE;
1768    AsnReadFunc func;
1769 
1770    if (! loaded)
1771    {
1772       if (! objmmdb2AsnLoad()) {
1773          return NULL;
1774       }
1775    }
1776 
1777    if (aip == NULL) {
1778       return NULL;
1779    }
1780 
1781    if (orig == NULL) {         /* Surface_surface ::= (self contained) */
1782       atp = AsnReadId(aip, amp, SURFACE_COORDINATES_surface);
1783    } else {
1784       atp = AsnLinkType(orig, SURFACE_COORDINATES_surface);    /* link in local tree */
1785    }
1786    if (atp == NULL) {
1787       return NULL;
1788    }
1789 
1790    anp = ValNodeNew(NULL);
1791    if (anp == NULL) {
1792       goto erret;
1793    }
1794    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1795       goto erret;
1796    }
1797 
1798    func = NULL;
1799 
1800    atp = AsnReadId(aip, amp, atp);  /* find the choice */
1801    if (atp == NULL) {
1802       goto erret;
1803    }
1804    if (atp == SURFACE_COORDINATES_surface_sphere) {
1805       choice = Surface_surface_sphere;
1806       func = (AsnReadFunc) SphereAsnRead;
1807    }
1808    else if (atp == SURFACE_COORDINATES_surface_cone) {
1809       choice = Surface_surface_cone;
1810       func = (AsnReadFunc) ConeAsnRead;
1811    }
1812    else if (atp == SURFACE_COORDINATES_surface_cylinder) {
1813       choice = Surface_surface_cylinder;
1814       func = (AsnReadFunc) CylinderAsnRead;
1815    }
1816    else if (atp == SURFACE_COORDINATES_surface_brick) {
1817       choice = Surface_surface_brick;
1818       func = (AsnReadFunc) BrickAsnRead;
1819    }
1820    else if (atp == SURFACE_COORDINATES_surface_tmesh) {
1821       choice = Surface_surface_tmesh;
1822       func = (AsnReadFunc) TMeshAsnRead;
1823    }
1824    else if (atp == SURFACE_COORDINATES_surface_triangles) {
1825       choice = Surface_surface_triangles;
1826       func = (AsnReadFunc) TrianglesAsnRead;
1827    }
1828    anp->choice = choice;
1829    if (func != NULL)
1830    {
1831       anp->data.ptrvalue = (* func)(aip, atp);
1832       if (aip -> io_failure) goto erret;
1833 
1834       if (nullIsError && anp->data.ptrvalue == NULL) {
1835          goto erret;
1836       }
1837    }
1838 
1839 ret:
1840    AsnUnlinkType(orig);       /* unlink local tree */
1841    return anp;
1842 
1843 erret:
1844    anp = MemFree(anp);
1845    aip -> io_failure = TRUE;
1846    goto ret;
1847 }
1848 
1849 
1850 /**************************************************
1851 *
1852 *    SurfaceCoordinatesAsnWrite()
1853 *
1854 **************************************************/
1855 Boolean LIBCALL
SurfaceCoordinatesAsnWrite(SurfaceCoordinatesPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1856 SurfaceCoordinatesAsnWrite(SurfaceCoordinatesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1857 {
1858    AsnTypePtr atp;
1859    Boolean retval = FALSE;
1860 
1861    if (! loaded)
1862    {
1863       if (! objmmdb2AsnLoad()) {
1864          return FALSE;
1865       }
1866    }
1867 
1868    if (aip == NULL) {
1869       return FALSE;
1870    }
1871 
1872    atp = AsnLinkType(orig, SURFACE_COORDINATES);   /* link local tree */
1873    if (atp == NULL) {
1874       return FALSE;
1875    }
1876 
1877    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1878    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1879       goto erret;
1880    }
1881 
1882    if (ptr -> contents != NULL) {
1883       if ( ! ChemGraphPntrsAsnWrite(ptr -> contents, aip, SURFACE_COORDINATES_contents)) {
1884          goto erret;
1885       }
1886    }
1887    if (ptr -> Surface_surface != NULL) {
1888       if ( ! Surface_surfaceAsnWrite(ptr -> Surface_surface, aip, SURFACE_COORDINATES_surface)) {
1889          goto erret;
1890       }
1891    }
1892    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1893       goto erret;
1894    }
1895    retval = TRUE;
1896 
1897 erret:
1898    AsnUnlinkType(orig);       /* unlink local tree */
1899    return retval;
1900 }
1901 
1902 
1903 
1904 /**************************************************
1905 *
1906 *    Surface_surfaceAsnWrite()
1907 *
1908 **************************************************/
1909 static Boolean LIBCALL
Surface_surfaceAsnWrite(Surface_surfacePtr anp,AsnIoPtr aip,AsnTypePtr orig)1910 Surface_surfaceAsnWrite(Surface_surfacePtr anp, AsnIoPtr aip, AsnTypePtr orig)
1911 
1912 {
1913    DataVal av;
1914    AsnTypePtr atp, writetype = NULL;
1915    Pointer pnt;
1916    AsnWriteFunc func = NULL;
1917    Boolean retval = FALSE;
1918 
1919    if (! loaded)
1920    {
1921       if (! objmmdb2AsnLoad())
1922       return FALSE;
1923    }
1924 
1925    if (aip == NULL)
1926    return FALSE;
1927 
1928    atp = AsnLinkType(orig, SURFACE_COORDINATES_surface);   /* link local tree */
1929    if (atp == NULL) {
1930       return FALSE;
1931    }
1932 
1933    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1934    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1935    av.ptrvalue = (Pointer)anp;
1936    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1937       goto erret;
1938    }
1939 
1940    pnt = anp->data.ptrvalue;
1941    switch (anp->choice)
1942    {
1943    case Surface_surface_sphere:
1944       writetype = SURFACE_COORDINATES_surface_sphere;
1945       func = (AsnWriteFunc) SphereAsnWrite;
1946       break;
1947    case Surface_surface_cone:
1948       writetype = SURFACE_COORDINATES_surface_cone;
1949       func = (AsnWriteFunc) ConeAsnWrite;
1950       break;
1951    case Surface_surface_cylinder:
1952       writetype = SURFACE_COORDINATES_surface_cylinder;
1953       func = (AsnWriteFunc) CylinderAsnWrite;
1954       break;
1955    case Surface_surface_brick:
1956       writetype = SURFACE_COORDINATES_surface_brick;
1957       func = (AsnWriteFunc) BrickAsnWrite;
1958       break;
1959    case Surface_surface_tmesh:
1960       writetype = SURFACE_COORDINATES_surface_tmesh;
1961       func = (AsnWriteFunc) TMeshAsnWrite;
1962       break;
1963    case Surface_surface_triangles:
1964       writetype = SURFACE_COORDINATES_surface_triangles;
1965       func = (AsnWriteFunc) TrianglesAsnWrite;
1966       break;
1967    }
1968    if (writetype != NULL) {
1969       retval = (* func)(pnt, aip, writetype);   /* write it out */
1970    }
1971    if (!retval) {
1972       goto erret;
1973    }
1974    retval = TRUE;
1975 
1976 erret:
1977    AsnUnlinkType(orig);       /* unlink local tree */
1978    return retval;
1979 }
1980 
1981 
1982 /**************************************************
1983 *
1984 *    DensityCoordinatesNew()
1985 *
1986 **************************************************/
1987 
1988 DensityCoordinatesPtr LIBCALL
DensityCoordinatesNew(void)1989 DensityCoordinatesNew(void)
1990 {
1991    DensityCoordinatesPtr ptr = MemNew((size_t) sizeof(DensityCoordinates));
1992 
1993    return ptr;
1994 
1995 }
1996 
1997 
1998 /**************************************************
1999 *
2000 *    DensityCoordinatesFree()
2001 *
2002 **************************************************/
2003 
2004 DensityCoordinatesPtr LIBCALL
DensityCoordinatesFree(DensityCoordinatesPtr ptr)2005 DensityCoordinatesFree(DensityCoordinatesPtr ptr)
2006 {
2007 
2008    if(ptr == NULL) {
2009       return NULL;
2010    }
2011    ChemGraphPntrsFree(ptr -> contents);
2012    BrickFree(ptr -> grid_corners);
2013    AsnGenericBaseSeqOfFree(ptr -> density ,ASNCODE_INTVAL_SLOT);
2014    return MemFree(ptr);
2015 }
2016 
2017 
2018 /**************************************************
2019 *
2020 *    DensityCoordinatesAsnRead()
2021 *
2022 **************************************************/
2023 
2024 DensityCoordinatesPtr LIBCALL
DensityCoordinatesAsnRead(AsnIoPtr aip,AsnTypePtr orig)2025 DensityCoordinatesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2026 {
2027    DataVal av;
2028    AsnTypePtr atp;
2029    Boolean isError = FALSE;
2030    AsnReadFunc func;
2031    DensityCoordinatesPtr ptr;
2032 
2033    if (! loaded)
2034    {
2035       if (! objmmdb2AsnLoad()) {
2036          return NULL;
2037       }
2038    }
2039 
2040    if (aip == NULL) {
2041       return NULL;
2042    }
2043 
2044    if (orig == NULL) {         /* DensityCoordinates ::= (self contained) */
2045       atp = AsnReadId(aip, amp, DENSITY_COORDINATES);
2046    } else {
2047       atp = AsnLinkType(orig, DENSITY_COORDINATES);
2048    }
2049    /* link in local tree */
2050    if (atp == NULL) {
2051       return NULL;
2052    }
2053 
2054    ptr = DensityCoordinatesNew();
2055    if (ptr == NULL) {
2056       goto erret;
2057    }
2058    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2059       goto erret;
2060    }
2061 
2062    atp = AsnReadId(aip,amp, atp);
2063    func = NULL;
2064 
2065    if (atp == DENSITY_COORDINATES_contents) {
2066       ptr -> contents = ChemGraphPntrsAsnRead(aip, atp);
2067       if (aip -> io_failure) {
2068          goto erret;
2069       }
2070       atp = AsnReadId(aip,amp, atp);
2071    }
2072    if (atp == DENSITY_COORDINATES_grid_corners) {
2073       ptr -> grid_corners = BrickAsnRead(aip, atp);
2074       if (aip -> io_failure) {
2075          goto erret;
2076       }
2077       atp = AsnReadId(aip,amp, atp);
2078    }
2079    if (atp == DENSITY_COORDINATES_grid_steps_x) {
2080       if ( AsnReadVal(aip, atp, &av) <= 0) {
2081          goto erret;
2082       }
2083       ptr -> grid_steps_x = av.intvalue;
2084       atp = AsnReadId(aip,amp, atp);
2085    }
2086    if (atp == DENSITY_COORDINATES_grid_steps_y) {
2087       if ( AsnReadVal(aip, atp, &av) <= 0) {
2088          goto erret;
2089       }
2090       ptr -> grid_steps_y = av.intvalue;
2091       atp = AsnReadId(aip,amp, atp);
2092    }
2093    if (atp == DENSITY_COORDINATES_grid_steps_z) {
2094       if ( AsnReadVal(aip, atp, &av) <= 0) {
2095          goto erret;
2096       }
2097       ptr -> grid_steps_z = av.intvalue;
2098       atp = AsnReadId(aip,amp, atp);
2099    }
2100    if (atp == DENSITY_COORDINATES_fastest_varying) {
2101       if ( AsnReadVal(aip, atp, &av) <= 0) {
2102          goto erret;
2103       }
2104       ptr -> fastest_varying = av.intvalue;
2105       atp = AsnReadId(aip,amp, atp);
2106    }
2107    if (atp == DENSITY_COORDINATES_slowest_varying) {
2108       if ( AsnReadVal(aip, atp, &av) <= 0) {
2109          goto erret;
2110       }
2111       ptr -> slowest_varying = av.intvalue;
2112       atp = AsnReadId(aip,amp, atp);
2113    }
2114    if (atp == DENSITY_COORDINATES_scale_factor) {
2115       if ( AsnReadVal(aip, atp, &av) <= 0) {
2116          goto erret;
2117       }
2118       ptr -> scale_factor = av.intvalue;
2119       atp = AsnReadId(aip,amp, atp);
2120    }
2121    if (atp == DENSITY_COORDINATES_density) {
2122       ptr -> density = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
2123       if (isError && ptr -> density == NULL) {
2124          goto erret;
2125       }
2126       atp = AsnReadId(aip,amp, atp);
2127    }
2128 
2129    if (AsnReadVal(aip, atp, &av) <= 0) {
2130       goto erret;
2131    }
2132    /* end struct */
2133 
2134 ret:
2135    AsnUnlinkType(orig);       /* unlink local tree */
2136    return ptr;
2137 
2138 erret:
2139    aip -> io_failure = TRUE;
2140    ptr = DensityCoordinatesFree(ptr);
2141    goto ret;
2142 }
2143 
2144 
2145 
2146 /**************************************************
2147 *
2148 *    DensityCoordinatesAsnWrite()
2149 *
2150 **************************************************/
2151 Boolean LIBCALL
DensityCoordinatesAsnWrite(DensityCoordinatesPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2152 DensityCoordinatesAsnWrite(DensityCoordinatesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2153 {
2154    DataVal av;
2155    AsnTypePtr atp;
2156    Boolean retval = FALSE;
2157 
2158    if (! loaded)
2159    {
2160       if (! objmmdb2AsnLoad()) {
2161          return FALSE;
2162       }
2163    }
2164 
2165    if (aip == NULL) {
2166       return FALSE;
2167    }
2168 
2169    atp = AsnLinkType(orig, DENSITY_COORDINATES);   /* link local tree */
2170    if (atp == NULL) {
2171       return FALSE;
2172    }
2173 
2174    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2175    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2176    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2177       goto erret;
2178    }
2179 
2180    if (ptr -> contents != NULL) {
2181       if ( ! ChemGraphPntrsAsnWrite(ptr -> contents, aip, DENSITY_COORDINATES_contents)) {
2182          goto erret;
2183       }
2184    }
2185    if (ptr -> grid_corners != NULL) {
2186       if ( ! BrickAsnWrite(ptr -> grid_corners, aip, DENSITY_COORDINATES_grid_corners)) {
2187          goto erret;
2188       }
2189    }
2190    av.intvalue = ptr -> grid_steps_x;
2191    retval = AsnWrite(aip, DENSITY_COORDINATES_grid_steps_x,  &av);
2192    av.intvalue = ptr -> grid_steps_y;
2193    retval = AsnWrite(aip, DENSITY_COORDINATES_grid_steps_y,  &av);
2194    av.intvalue = ptr -> grid_steps_z;
2195    retval = AsnWrite(aip, DENSITY_COORDINATES_grid_steps_z,  &av);
2196    av.intvalue = ptr -> fastest_varying;
2197    retval = AsnWrite(aip, DENSITY_COORDINATES_fastest_varying,  &av);
2198    av.intvalue = ptr -> slowest_varying;
2199    retval = AsnWrite(aip, DENSITY_COORDINATES_slowest_varying,  &av);
2200    av.intvalue = ptr -> scale_factor;
2201    retval = AsnWrite(aip, DENSITY_COORDINATES_scale_factor,  &av);
2202    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> density ,ASNCODE_INTVAL_SLOT, aip, DENSITY_COORDINATES_density, DENSITY_COORDINATES_density_E);
2203    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2204       goto erret;
2205    }
2206    retval = TRUE;
2207 
2208 erret:
2209    AsnUnlinkType(orig);       /* unlink local tree */
2210    return retval;
2211 }
2212 
2213 
2214 
2215 /**************************************************
2216 *
2217 *    ModelSpacePointsNew()
2218 *
2219 **************************************************/
2220 
2221 ModelSpacePointsPtr LIBCALL
ModelSpacePointsNew(void)2222 ModelSpacePointsNew(void)
2223 {
2224    ModelSpacePointsPtr ptr = MemNew((size_t) sizeof(ModelSpacePoints));
2225 
2226    return ptr;
2227 
2228 }
2229 
2230 
2231 /**************************************************
2232 *
2233 *    ModelSpacePointsFree()
2234 *
2235 **************************************************/
2236 
2237 ModelSpacePointsPtr LIBCALL
ModelSpacePointsFree(ModelSpacePointsPtr ptr)2238 ModelSpacePointsFree(ModelSpacePointsPtr ptr)
2239 {
2240 
2241    if(ptr == NULL) {
2242       return NULL;
2243    }
2244    AsnGenericBaseSeqOfFree(ptr -> x ,ASNCODE_INTVAL_SLOT);
2245    AsnGenericBaseSeqOfFree(ptr -> y ,ASNCODE_INTVAL_SLOT);
2246    AsnGenericBaseSeqOfFree(ptr -> z ,ASNCODE_INTVAL_SLOT);
2247    return MemFree(ptr);
2248 }
2249 
2250 
2251 /**************************************************
2252 *
2253 *    ModelSpacePointsAsnRead()
2254 *
2255 **************************************************/
2256 
2257 ModelSpacePointsPtr LIBCALL
ModelSpacePointsAsnRead(AsnIoPtr aip,AsnTypePtr orig)2258 ModelSpacePointsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2259 {
2260    DataVal av;
2261    AsnTypePtr atp;
2262    Boolean isError = FALSE;
2263    AsnReadFunc func;
2264    ModelSpacePointsPtr ptr;
2265 
2266    if (! loaded)
2267    {
2268       if (! objmmdb2AsnLoad()) {
2269          return NULL;
2270       }
2271    }
2272 
2273    if (aip == NULL) {
2274       return NULL;
2275    }
2276 
2277    if (orig == NULL) {         /* ModelSpacePoints ::= (self contained) */
2278       atp = AsnReadId(aip, amp, MODEL_SPACE_POINTS);
2279    } else {
2280       atp = AsnLinkType(orig, MODEL_SPACE_POINTS);
2281    }
2282    /* link in local tree */
2283    if (atp == NULL) {
2284       return NULL;
2285    }
2286 
2287    ptr = ModelSpacePointsNew();
2288    if (ptr == NULL) {
2289       goto erret;
2290    }
2291    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2292       goto erret;
2293    }
2294 
2295    atp = AsnReadId(aip,amp, atp);
2296    func = NULL;
2297 
2298    if (atp == MODEL_SPACE_POINTS_scale_factor) {
2299       if ( AsnReadVal(aip, atp, &av) <= 0) {
2300          goto erret;
2301       }
2302       ptr -> scale_factor = av.intvalue;
2303       atp = AsnReadId(aip,amp, atp);
2304    }
2305    if (atp == MODEL_SPACE_POINTS_x) {
2306       ptr -> x = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
2307       if (isError && ptr -> x == NULL) {
2308          goto erret;
2309       }
2310       atp = AsnReadId(aip,amp, atp);
2311    }
2312    if (atp == MODEL_SPACE_POINTS_y) {
2313       ptr -> y = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
2314       if (isError && ptr -> y == NULL) {
2315          goto erret;
2316       }
2317       atp = AsnReadId(aip,amp, atp);
2318    }
2319    if (atp == MODEL_SPACE_POINTS_z) {
2320       ptr -> z = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
2321       if (isError && ptr -> z == NULL) {
2322          goto erret;
2323       }
2324       atp = AsnReadId(aip,amp, atp);
2325    }
2326 
2327    if (AsnReadVal(aip, atp, &av) <= 0) {
2328       goto erret;
2329    }
2330    /* end struct */
2331 
2332 ret:
2333    AsnUnlinkType(orig);       /* unlink local tree */
2334    return ptr;
2335 
2336 erret:
2337    aip -> io_failure = TRUE;
2338    ptr = ModelSpacePointsFree(ptr);
2339    goto ret;
2340 }
2341 
2342 
2343 
2344 /**************************************************
2345 *
2346 *    ModelSpacePointsAsnWrite()
2347 *
2348 **************************************************/
2349 Boolean LIBCALL
ModelSpacePointsAsnWrite(ModelSpacePointsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2350 ModelSpacePointsAsnWrite(ModelSpacePointsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2351 {
2352    DataVal av;
2353    AsnTypePtr atp;
2354    Boolean retval = FALSE;
2355 
2356    if (! loaded)
2357    {
2358       if (! objmmdb2AsnLoad()) {
2359          return FALSE;
2360       }
2361    }
2362 
2363    if (aip == NULL) {
2364       return FALSE;
2365    }
2366 
2367    atp = AsnLinkType(orig, MODEL_SPACE_POINTS);   /* link local tree */
2368    if (atp == NULL) {
2369       return FALSE;
2370    }
2371 
2372    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2373    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2374    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2375       goto erret;
2376    }
2377 
2378    av.intvalue = ptr -> scale_factor;
2379    retval = AsnWrite(aip, MODEL_SPACE_POINTS_scale_factor,  &av);
2380    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> x ,ASNCODE_INTVAL_SLOT, aip, MODEL_SPACE_POINTS_x, MODEL_SPACE_POINTS_x_E);
2381    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> y ,ASNCODE_INTVAL_SLOT, aip, MODEL_SPACE_POINTS_y, MODEL_SPACE_POINTS_y_E);
2382    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> z ,ASNCODE_INTVAL_SLOT, aip, MODEL_SPACE_POINTS_z, MODEL_SPACE_POINTS_z_E);
2383    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2384       goto erret;
2385    }
2386    retval = TRUE;
2387 
2388 erret:
2389    AsnUnlinkType(orig);       /* unlink local tree */
2390    return retval;
2391 }
2392 
2393 
2394 
2395 /**************************************************
2396 *
2397 *    AtomicTemperatureFactorsFree()
2398 *
2399 **************************************************/
2400 
2401 AtomicTemperatureFactorsPtr LIBCALL
AtomicTemperatureFactorsFree(ValNodePtr anp)2402 AtomicTemperatureFactorsFree(ValNodePtr anp)
2403 {
2404    Pointer pnt;
2405 
2406    if (anp == NULL) {
2407       return NULL;
2408    }
2409 
2410    pnt = anp->data.ptrvalue;
2411    switch (anp->choice)
2412    {
2413    default:
2414       break;
2415    case AtomicTemperatureFactors_isotropic:
2416       IsotropicTemperatureFactorsFree(anp -> data.ptrvalue);
2417       break;
2418    case AtomicTemperatureFactors_anisotropic:
2419       AnisotropicTemperatureFactorsFree(anp -> data.ptrvalue);
2420       break;
2421    }
2422    return MemFree(anp);
2423 }
2424 
2425 
2426 /**************************************************
2427 *
2428 *    AtomicTemperatureFactorsAsnRead()
2429 *
2430 **************************************************/
2431 
2432 AtomicTemperatureFactorsPtr LIBCALL
AtomicTemperatureFactorsAsnRead(AsnIoPtr aip,AsnTypePtr orig)2433 AtomicTemperatureFactorsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2434 {
2435    DataVal av;
2436    AsnTypePtr atp;
2437    ValNodePtr anp;
2438    Uint1 choice;
2439    Boolean isError = FALSE;
2440    Boolean nullIsError = FALSE;
2441    AsnReadFunc func;
2442 
2443    if (! loaded)
2444    {
2445       if (! objmmdb2AsnLoad()) {
2446          return NULL;
2447       }
2448    }
2449 
2450    if (aip == NULL) {
2451       return NULL;
2452    }
2453 
2454    if (orig == NULL) {         /* AtomicTemperatureFactors ::= (self contained) */
2455       atp = AsnReadId(aip, amp, ATOMIC_TEMPERATURE_FACTORS);
2456    } else {
2457       atp = AsnLinkType(orig, ATOMIC_TEMPERATURE_FACTORS);    /* link in local tree */
2458    }
2459    if (atp == NULL) {
2460       return NULL;
2461    }
2462 
2463    anp = ValNodeNew(NULL);
2464    if (anp == NULL) {
2465       goto erret;
2466    }
2467    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
2468       goto erret;
2469    }
2470 
2471    func = NULL;
2472 
2473    atp = AsnReadId(aip, amp, atp);  /* find the choice */
2474    if (atp == NULL) {
2475       goto erret;
2476    }
2477    if (atp == ATOMIC_TEMPERATURE_FACTORS_isotropic) {
2478       choice = AtomicTemperatureFactors_isotropic;
2479       func = (AsnReadFunc) IsotropicTemperatureFactorsAsnRead;
2480    }
2481    else if (atp == ATOMIC_TEMPERATURE_FACTORS_anisotropic) {
2482       choice = AtomicTemperatureFactors_anisotropic;
2483       func = (AsnReadFunc) AnisotropicTemperatureFactorsAsnRead;
2484    }
2485    anp->choice = choice;
2486    if (func != NULL)
2487    {
2488       anp->data.ptrvalue = (* func)(aip, atp);
2489       if (aip -> io_failure) goto erret;
2490 
2491       if (nullIsError && anp->data.ptrvalue == NULL) {
2492          goto erret;
2493       }
2494    }
2495 
2496 ret:
2497    AsnUnlinkType(orig);       /* unlink local tree */
2498    return anp;
2499 
2500 erret:
2501    anp = MemFree(anp);
2502    aip -> io_failure = TRUE;
2503    goto ret;
2504 }
2505 
2506 
2507 /**************************************************
2508 *
2509 *    AtomicTemperatureFactorsAsnWrite()
2510 *
2511 **************************************************/
2512 Boolean LIBCALL
AtomicTemperatureFactorsAsnWrite(AtomicTemperatureFactorsPtr anp,AsnIoPtr aip,AsnTypePtr orig)2513 AtomicTemperatureFactorsAsnWrite(AtomicTemperatureFactorsPtr anp, AsnIoPtr aip, AsnTypePtr orig)
2514 
2515 {
2516    DataVal av;
2517    AsnTypePtr atp, writetype = NULL;
2518    Pointer pnt;
2519    AsnWriteFunc func = NULL;
2520    Boolean retval = FALSE;
2521 
2522    if (! loaded)
2523    {
2524       if (! objmmdb2AsnLoad())
2525       return FALSE;
2526    }
2527 
2528    if (aip == NULL)
2529    return FALSE;
2530 
2531    atp = AsnLinkType(orig, ATOMIC_TEMPERATURE_FACTORS);   /* link local tree */
2532    if (atp == NULL) {
2533       return FALSE;
2534    }
2535 
2536    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2537    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2538    av.ptrvalue = (Pointer)anp;
2539    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
2540       goto erret;
2541    }
2542 
2543    pnt = anp->data.ptrvalue;
2544    switch (anp->choice)
2545    {
2546    case AtomicTemperatureFactors_isotropic:
2547       writetype = ATOMIC_TEMPERATURE_FACTORS_isotropic;
2548       func = (AsnWriteFunc) IsotropicTemperatureFactorsAsnWrite;
2549       break;
2550    case AtomicTemperatureFactors_anisotropic:
2551       writetype = ATOMIC_TEMPERATURE_FACTORS_anisotropic;
2552       func = (AsnWriteFunc) AnisotropicTemperatureFactorsAsnWrite;
2553       break;
2554    }
2555    if (writetype != NULL) {
2556       retval = (* func)(pnt, aip, writetype);   /* write it out */
2557    }
2558    if (!retval) {
2559       goto erret;
2560    }
2561    retval = TRUE;
2562 
2563 erret:
2564    AsnUnlinkType(orig);       /* unlink local tree */
2565    return retval;
2566 }
2567 
2568 
2569 /**************************************************
2570 *
2571 *    AtomicOccupanciesNew()
2572 *
2573 **************************************************/
2574 
2575 AtomicOccupanciesPtr LIBCALL
AtomicOccupanciesNew(void)2576 AtomicOccupanciesNew(void)
2577 {
2578    AtomicOccupanciesPtr ptr = MemNew((size_t) sizeof(AtomicOccupancies));
2579 
2580    return ptr;
2581 
2582 }
2583 
2584 
2585 /**************************************************
2586 *
2587 *    AtomicOccupanciesFree()
2588 *
2589 **************************************************/
2590 
2591 AtomicOccupanciesPtr LIBCALL
AtomicOccupanciesFree(AtomicOccupanciesPtr ptr)2592 AtomicOccupanciesFree(AtomicOccupanciesPtr ptr)
2593 {
2594 
2595    if(ptr == NULL) {
2596       return NULL;
2597    }
2598    AsnGenericBaseSeqOfFree(ptr -> o ,ASNCODE_INTVAL_SLOT);
2599    return MemFree(ptr);
2600 }
2601 
2602 
2603 /**************************************************
2604 *
2605 *    AtomicOccupanciesAsnRead()
2606 *
2607 **************************************************/
2608 
2609 AtomicOccupanciesPtr LIBCALL
AtomicOccupanciesAsnRead(AsnIoPtr aip,AsnTypePtr orig)2610 AtomicOccupanciesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2611 {
2612    DataVal av;
2613    AsnTypePtr atp;
2614    Boolean isError = FALSE;
2615    AsnReadFunc func;
2616    AtomicOccupanciesPtr ptr;
2617 
2618    if (! loaded)
2619    {
2620       if (! objmmdb2AsnLoad()) {
2621          return NULL;
2622       }
2623    }
2624 
2625    if (aip == NULL) {
2626       return NULL;
2627    }
2628 
2629    if (orig == NULL) {         /* AtomicOccupancies ::= (self contained) */
2630       atp = AsnReadId(aip, amp, ATOMIC_OCCUPANCIES);
2631    } else {
2632       atp = AsnLinkType(orig, ATOMIC_OCCUPANCIES);
2633    }
2634    /* link in local tree */
2635    if (atp == NULL) {
2636       return NULL;
2637    }
2638 
2639    ptr = AtomicOccupanciesNew();
2640    if (ptr == NULL) {
2641       goto erret;
2642    }
2643    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2644       goto erret;
2645    }
2646 
2647    atp = AsnReadId(aip,amp, atp);
2648    func = NULL;
2649 
2650    if (atp == ATOMIC_OCCUPANCIES_scale_factor) {
2651       if ( AsnReadVal(aip, atp, &av) <= 0) {
2652          goto erret;
2653       }
2654       ptr -> scale_factor = av.intvalue;
2655       atp = AsnReadId(aip,amp, atp);
2656    }
2657    if (atp == ATOMIC_OCCUPANCIES_o) {
2658       ptr -> o = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
2659       if (isError && ptr -> o == NULL) {
2660          goto erret;
2661       }
2662       atp = AsnReadId(aip,amp, atp);
2663    }
2664 
2665    if (AsnReadVal(aip, atp, &av) <= 0) {
2666       goto erret;
2667    }
2668    /* end struct */
2669 
2670 ret:
2671    AsnUnlinkType(orig);       /* unlink local tree */
2672    return ptr;
2673 
2674 erret:
2675    aip -> io_failure = TRUE;
2676    ptr = AtomicOccupanciesFree(ptr);
2677    goto ret;
2678 }
2679 
2680 
2681 
2682 /**************************************************
2683 *
2684 *    AtomicOccupanciesAsnWrite()
2685 *
2686 **************************************************/
2687 Boolean LIBCALL
AtomicOccupanciesAsnWrite(AtomicOccupanciesPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2688 AtomicOccupanciesAsnWrite(AtomicOccupanciesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2689 {
2690    DataVal av;
2691    AsnTypePtr atp;
2692    Boolean retval = FALSE;
2693 
2694    if (! loaded)
2695    {
2696       if (! objmmdb2AsnLoad()) {
2697          return FALSE;
2698       }
2699    }
2700 
2701    if (aip == NULL) {
2702       return FALSE;
2703    }
2704 
2705    atp = AsnLinkType(orig, ATOMIC_OCCUPANCIES);   /* link local tree */
2706    if (atp == NULL) {
2707       return FALSE;
2708    }
2709 
2710    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2711    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2712    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2713       goto erret;
2714    }
2715 
2716    av.intvalue = ptr -> scale_factor;
2717    retval = AsnWrite(aip, ATOMIC_OCCUPANCIES_scale_factor,  &av);
2718    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> o ,ASNCODE_INTVAL_SLOT, aip, ATOMIC_OCCUPANCIES_o, ATOMIC_OCCUPANCIES_o_E);
2719    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2720       goto erret;
2721    }
2722    retval = TRUE;
2723 
2724 erret:
2725    AsnUnlinkType(orig);       /* unlink local tree */
2726    return retval;
2727 }
2728 
2729 
2730 
2731 /**************************************************
2732 *
2733 *    AlternateConformationIdsFree()
2734 *
2735 **************************************************/
2736 
2737 AlternateConformationIdsPtr LIBCALL
AlternateConformationIdsFree(AlternateConformationIdsPtr ptr)2738 AlternateConformationIdsFree(AlternateConformationIdsPtr ptr)
2739 {
2740 
2741    if(ptr == NULL) {
2742       return NULL;
2743    }
2744    AsnGenericBaseSeqOfFree(ptr,ASNCODE_PTRVAL_SLOT);
2745    return NULL;
2746 }
2747 
2748 
2749 /**************************************************
2750 *
2751 *    AlternateConformationIdsAsnRead()
2752 *
2753 **************************************************/
2754 
2755 AlternateConformationIdsPtr LIBCALL
AlternateConformationIdsAsnRead(AsnIoPtr aip,AsnTypePtr orig)2756 AlternateConformationIdsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2757 {
2758    AsnTypePtr atp;
2759    Boolean isError = FALSE;
2760    AsnReadFunc func;
2761    AlternateConformationIdsPtr ptr;
2762 
2763    if (! loaded)
2764    {
2765       if (! objmmdb2AsnLoad()) {
2766          return NULL;
2767       }
2768    }
2769 
2770    if (aip == NULL) {
2771       return NULL;
2772    }
2773 
2774    if (orig == NULL) {         /* AlternateConformationIds ::= (self contained) */
2775       atp = AsnReadId(aip, amp, ALTERNATE_CONFORMATION_IDS);
2776    } else {
2777       atp = AsnLinkType(orig, ALTERNATE_CONFORMATION_IDS);
2778    }
2779    /* link in local tree */
2780    if (atp == NULL) {
2781       return NULL;
2782    }
2783 
2784    func = NULL;
2785 
2786    ptr  = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
2787    if (isError && ptr  == NULL) {
2788       goto erret;
2789    }
2790 
2791 
2792 
2793 ret:
2794    AsnUnlinkType(orig);       /* unlink local tree */
2795    return ptr;
2796 
2797 erret:
2798    aip -> io_failure = TRUE;
2799    ptr = AlternateConformationIdsFree(ptr);
2800    goto ret;
2801 }
2802 
2803 
2804 
2805 /**************************************************
2806 *
2807 *    AlternateConformationIdsAsnWrite()
2808 *
2809 **************************************************/
2810 Boolean LIBCALL
AlternateConformationIdsAsnWrite(AlternateConformationIdsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2811 AlternateConformationIdsAsnWrite(AlternateConformationIdsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2812 {
2813    AsnTypePtr atp;
2814    Boolean retval = FALSE;
2815 
2816    if (! loaded)
2817    {
2818       if (! objmmdb2AsnLoad()) {
2819          return FALSE;
2820       }
2821    }
2822 
2823    if (aip == NULL) {
2824       return FALSE;
2825    }
2826 
2827    atp = AsnLinkType(orig, ALTERNATE_CONFORMATION_IDS);   /* link local tree */
2828    if (atp == NULL) {
2829       return FALSE;
2830    }
2831 
2832    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2833    retval = AsnGenericBaseSeqOfAsnWrite(ptr, ASNCODE_PTRVAL_SLOT, aip, atp, ALTERNATE_CONFORMATION_IDS_E);
2834    retval = TRUE;
2835 
2836 erret:
2837    AsnUnlinkType(orig);       /* unlink local tree */
2838    return retval;
2839 }
2840 
2841 
2842 
2843 /**************************************************
2844 *
2845 *    ConformationEnsembleNew()
2846 *
2847 **************************************************/
2848 
2849 ConformationEnsemblePtr LIBCALL
ConformationEnsembleNew(void)2850 ConformationEnsembleNew(void)
2851 {
2852    ConformationEnsemblePtr ptr = MemNew((size_t) sizeof(ConformationEnsemble));
2853 
2854    return ptr;
2855 
2856 }
2857 
2858 
2859 /**************************************************
2860 *
2861 *    ConformationEnsembleFree()
2862 *
2863 **************************************************/
2864 
2865 ConformationEnsemblePtr LIBCALL
ConformationEnsembleFree(ConformationEnsemblePtr ptr)2866 ConformationEnsembleFree(ConformationEnsemblePtr ptr)
2867 {
2868 
2869    if(ptr == NULL) {
2870       return NULL;
2871    }
2872    MemFree(ptr -> name);
2873    AsnGenericBaseSeqOfFree(ptr -> alt_conf_ids ,ASNCODE_PTRVAL_SLOT);
2874    return MemFree(ptr);
2875 }
2876 
2877 
2878 /**************************************************
2879 *
2880 *    ConformationEnsembleAsnRead()
2881 *
2882 **************************************************/
2883 
2884 ConformationEnsemblePtr LIBCALL
ConformationEnsembleAsnRead(AsnIoPtr aip,AsnTypePtr orig)2885 ConformationEnsembleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2886 {
2887    DataVal av;
2888    AsnTypePtr atp;
2889    Boolean isError = FALSE;
2890    AsnReadFunc func;
2891    ConformationEnsemblePtr ptr;
2892 
2893    if (! loaded)
2894    {
2895       if (! objmmdb2AsnLoad()) {
2896          return NULL;
2897       }
2898    }
2899 
2900    if (aip == NULL) {
2901       return NULL;
2902    }
2903 
2904    if (orig == NULL) {         /* ConformationEnsemble ::= (self contained) */
2905       atp = AsnReadId(aip, amp, CONFORMATION_ENSEMBLE);
2906    } else {
2907       atp = AsnLinkType(orig, CONFORMATION_ENSEMBLE);
2908    }
2909    /* link in local tree */
2910    if (atp == NULL) {
2911       return NULL;
2912    }
2913 
2914    ptr = ConformationEnsembleNew();
2915    if (ptr == NULL) {
2916       goto erret;
2917    }
2918    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2919       goto erret;
2920    }
2921 
2922    atp = AsnReadId(aip,amp, atp);
2923    func = NULL;
2924 
2925    if (atp == CONFORMATION_ENSEMBLE_name) {
2926       if ( AsnReadVal(aip, atp, &av) <= 0) {
2927          goto erret;
2928       }
2929       ptr -> name = av.ptrvalue;
2930       atp = AsnReadId(aip,amp, atp);
2931    }
2932    if (atp == CONFORMATION_ENSEMBLE_alt_conf_ids) {
2933       ptr -> alt_conf_ids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
2934       if (isError && ptr -> alt_conf_ids == NULL) {
2935          goto erret;
2936       }
2937       atp = AsnReadId(aip,amp, atp);
2938    }
2939 
2940    if (AsnReadVal(aip, atp, &av) <= 0) {
2941       goto erret;
2942    }
2943    /* end struct */
2944 
2945 ret:
2946    AsnUnlinkType(orig);       /* unlink local tree */
2947    return ptr;
2948 
2949 erret:
2950    aip -> io_failure = TRUE;
2951    ptr = ConformationEnsembleFree(ptr);
2952    goto ret;
2953 }
2954 
2955 
2956 
2957 /**************************************************
2958 *
2959 *    ConformationEnsembleAsnWrite()
2960 *
2961 **************************************************/
2962 Boolean LIBCALL
ConformationEnsembleAsnWrite(ConformationEnsemblePtr ptr,AsnIoPtr aip,AsnTypePtr orig)2963 ConformationEnsembleAsnWrite(ConformationEnsemblePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2964 {
2965    DataVal av;
2966    AsnTypePtr atp;
2967    Boolean retval = FALSE;
2968 
2969    if (! loaded)
2970    {
2971       if (! objmmdb2AsnLoad()) {
2972          return FALSE;
2973       }
2974    }
2975 
2976    if (aip == NULL) {
2977       return FALSE;
2978    }
2979 
2980    atp = AsnLinkType(orig, CONFORMATION_ENSEMBLE);   /* link local tree */
2981    if (atp == NULL) {
2982       return FALSE;
2983    }
2984 
2985    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2986    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
2987    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2988       goto erret;
2989    }
2990 
2991    if (ptr -> name != NULL) {
2992       av.ptrvalue = ptr -> name;
2993       retval = AsnWrite(aip, CONFORMATION_ENSEMBLE_name,  &av);
2994    }
2995    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> alt_conf_ids ,ASNCODE_PTRVAL_SLOT, aip, CONFORMATION_ENSEMBLE_alt_conf_ids, CONFORMATION_ENSEMBLE_alt_conf_ids_E);
2996    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2997       goto erret;
2998    }
2999    retval = TRUE;
3000 
3001 erret:
3002    AsnUnlinkType(orig);       /* unlink local tree */
3003    return retval;
3004 }
3005 
3006 
3007 
3008 /**************************************************
3009 *
3010 *    IsotropicTemperatureFactorsNew()
3011 *
3012 **************************************************/
3013 
3014 IsotropicTemperatureFactorsPtr LIBCALL
IsotropicTemperatureFactorsNew(void)3015 IsotropicTemperatureFactorsNew(void)
3016 {
3017    IsotropicTemperatureFactorsPtr ptr = MemNew((size_t) sizeof(IsotropicTemperatureFactors));
3018 
3019    return ptr;
3020 
3021 }
3022 
3023 
3024 /**************************************************
3025 *
3026 *    IsotropicTemperatureFactorsFree()
3027 *
3028 **************************************************/
3029 
3030 IsotropicTemperatureFactorsPtr LIBCALL
IsotropicTemperatureFactorsFree(IsotropicTemperatureFactorsPtr ptr)3031 IsotropicTemperatureFactorsFree(IsotropicTemperatureFactorsPtr ptr)
3032 {
3033 
3034    if(ptr == NULL) {
3035       return NULL;
3036    }
3037    AsnGenericBaseSeqOfFree(ptr -> b ,ASNCODE_INTVAL_SLOT);
3038    return MemFree(ptr);
3039 }
3040 
3041 
3042 /**************************************************
3043 *
3044 *    IsotropicTemperatureFactorsAsnRead()
3045 *
3046 **************************************************/
3047 
3048 IsotropicTemperatureFactorsPtr LIBCALL
IsotropicTemperatureFactorsAsnRead(AsnIoPtr aip,AsnTypePtr orig)3049 IsotropicTemperatureFactorsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3050 {
3051    DataVal av;
3052    AsnTypePtr atp;
3053    Boolean isError = FALSE;
3054    AsnReadFunc func;
3055    IsotropicTemperatureFactorsPtr ptr;
3056 
3057    if (! loaded)
3058    {
3059       if (! objmmdb2AsnLoad()) {
3060          return NULL;
3061       }
3062    }
3063 
3064    if (aip == NULL) {
3065       return NULL;
3066    }
3067 
3068    if (orig == NULL) {         /* IsotropicTemperatureFactors ::= (self contained) */
3069       atp = AsnReadId(aip, amp, ISOTROPIC_TEMPERATURE_FACTORS);
3070    } else {
3071       atp = AsnLinkType(orig, ISOTROPIC_TEMPERATURE_FACTORS);
3072    }
3073    /* link in local tree */
3074    if (atp == NULL) {
3075       return NULL;
3076    }
3077 
3078    ptr = IsotropicTemperatureFactorsNew();
3079    if (ptr == NULL) {
3080       goto erret;
3081    }
3082    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3083       goto erret;
3084    }
3085 
3086    atp = AsnReadId(aip,amp, atp);
3087    func = NULL;
3088 
3089    if (atp == ISOTROPIC_TEMPERATURE_FACTORS_scale_factor) {
3090       if ( AsnReadVal(aip, atp, &av) <= 0) {
3091          goto erret;
3092       }
3093       ptr -> scale_factor = av.intvalue;
3094       atp = AsnReadId(aip,amp, atp);
3095    }
3096    if (atp == ISOTROPIC_TEMPERATURE_FACTORS_b) {
3097       ptr -> b = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3098       if (isError && ptr -> b == NULL) {
3099          goto erret;
3100       }
3101       atp = AsnReadId(aip,amp, atp);
3102    }
3103 
3104    if (AsnReadVal(aip, atp, &av) <= 0) {
3105       goto erret;
3106    }
3107    /* end struct */
3108 
3109 ret:
3110    AsnUnlinkType(orig);       /* unlink local tree */
3111    return ptr;
3112 
3113 erret:
3114    aip -> io_failure = TRUE;
3115    ptr = IsotropicTemperatureFactorsFree(ptr);
3116    goto ret;
3117 }
3118 
3119 
3120 
3121 /**************************************************
3122 *
3123 *    IsotropicTemperatureFactorsAsnWrite()
3124 *
3125 **************************************************/
3126 Boolean LIBCALL
IsotropicTemperatureFactorsAsnWrite(IsotropicTemperatureFactorsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3127 IsotropicTemperatureFactorsAsnWrite(IsotropicTemperatureFactorsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3128 {
3129    DataVal av;
3130    AsnTypePtr atp;
3131    Boolean retval = FALSE;
3132 
3133    if (! loaded)
3134    {
3135       if (! objmmdb2AsnLoad()) {
3136          return FALSE;
3137       }
3138    }
3139 
3140    if (aip == NULL) {
3141       return FALSE;
3142    }
3143 
3144    atp = AsnLinkType(orig, ISOTROPIC_TEMPERATURE_FACTORS);   /* link local tree */
3145    if (atp == NULL) {
3146       return FALSE;
3147    }
3148 
3149    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3150    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3151    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3152       goto erret;
3153    }
3154 
3155    av.intvalue = ptr -> scale_factor;
3156    retval = AsnWrite(aip, ISOTROPIC_TEMPERATURE_FACTORS_scale_factor,  &av);
3157    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> b ,ASNCODE_INTVAL_SLOT, aip, ISOTROPIC_TEMPERATURE_FACTORS_b, ISOTROPIC_TEMPERATURE_FACTORS_b_E);
3158    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3159       goto erret;
3160    }
3161    retval = TRUE;
3162 
3163 erret:
3164    AsnUnlinkType(orig);       /* unlink local tree */
3165    return retval;
3166 }
3167 
3168 
3169 
3170 /**************************************************
3171 *
3172 *    AnisotropicTemperatureFactorsNew()
3173 *
3174 **************************************************/
3175 
3176 AnisotropicTemperatureFactorsPtr LIBCALL
AnisotropicTemperatureFactorsNew(void)3177 AnisotropicTemperatureFactorsNew(void)
3178 {
3179    AnisotropicTemperatureFactorsPtr ptr = MemNew((size_t) sizeof(AnisotropicTemperatureFactors));
3180 
3181    return ptr;
3182 
3183 }
3184 
3185 
3186 /**************************************************
3187 *
3188 *    AnisotropicTemperatureFactorsFree()
3189 *
3190 **************************************************/
3191 
3192 AnisotropicTemperatureFactorsPtr LIBCALL
AnisotropicTemperatureFactorsFree(AnisotropicTemperatureFactorsPtr ptr)3193 AnisotropicTemperatureFactorsFree(AnisotropicTemperatureFactorsPtr ptr)
3194 {
3195 
3196    if(ptr == NULL) {
3197       return NULL;
3198    }
3199    AsnGenericBaseSeqOfFree(ptr -> b_11 ,ASNCODE_INTVAL_SLOT);
3200    AsnGenericBaseSeqOfFree(ptr -> b_12 ,ASNCODE_INTVAL_SLOT);
3201    AsnGenericBaseSeqOfFree(ptr -> b_13 ,ASNCODE_INTVAL_SLOT);
3202    AsnGenericBaseSeqOfFree(ptr -> b_22 ,ASNCODE_INTVAL_SLOT);
3203    AsnGenericBaseSeqOfFree(ptr -> b_23 ,ASNCODE_INTVAL_SLOT);
3204    AsnGenericBaseSeqOfFree(ptr -> b_33 ,ASNCODE_INTVAL_SLOT);
3205    return MemFree(ptr);
3206 }
3207 
3208 
3209 /**************************************************
3210 *
3211 *    AnisotropicTemperatureFactorsAsnRead()
3212 *
3213 **************************************************/
3214 
3215 AnisotropicTemperatureFactorsPtr LIBCALL
AnisotropicTemperatureFactorsAsnRead(AsnIoPtr aip,AsnTypePtr orig)3216 AnisotropicTemperatureFactorsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3217 {
3218    DataVal av;
3219    AsnTypePtr atp;
3220    Boolean isError = FALSE;
3221    AsnReadFunc func;
3222    AnisotropicTemperatureFactorsPtr ptr;
3223 
3224    if (! loaded)
3225    {
3226       if (! objmmdb2AsnLoad()) {
3227          return NULL;
3228       }
3229    }
3230 
3231    if (aip == NULL) {
3232       return NULL;
3233    }
3234 
3235    if (orig == NULL) {         /* AnisotropicTemperatureFactors ::= (self contained) */
3236       atp = AsnReadId(aip, amp, ANISOTROPIC_TEMPERATURE_FACTORS);
3237    } else {
3238       atp = AsnLinkType(orig, ANISOTROPIC_TEMPERATURE_FACTORS);
3239    }
3240    /* link in local tree */
3241    if (atp == NULL) {
3242       return NULL;
3243    }
3244 
3245    ptr = AnisotropicTemperatureFactorsNew();
3246    if (ptr == NULL) {
3247       goto erret;
3248    }
3249    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3250       goto erret;
3251    }
3252 
3253    atp = AsnReadId(aip,amp, atp);
3254    func = NULL;
3255 
3256    if (atp == ANISOTROPIC_TEMPERATURE_FACTORS_scale_factor) {
3257       if ( AsnReadVal(aip, atp, &av) <= 0) {
3258          goto erret;
3259       }
3260       ptr -> scale_factor = av.intvalue;
3261       atp = AsnReadId(aip,amp, atp);
3262    }
3263    if (atp == ANISOTROPIC_TEMPERATURE_FACTORS_b_11) {
3264       ptr -> b_11 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3265       if (isError && ptr -> b_11 == NULL) {
3266          goto erret;
3267       }
3268       atp = AsnReadId(aip,amp, atp);
3269    }
3270    if (atp == ANISOTROPIC_TEMPERATURE_FACTORS_b_12) {
3271       ptr -> b_12 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3272       if (isError && ptr -> b_12 == NULL) {
3273          goto erret;
3274       }
3275       atp = AsnReadId(aip,amp, atp);
3276    }
3277    if (atp == ANISOTROPIC_TEMPERATURE_FACTORS_b_13) {
3278       ptr -> b_13 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3279       if (isError && ptr -> b_13 == NULL) {
3280          goto erret;
3281       }
3282       atp = AsnReadId(aip,amp, atp);
3283    }
3284    if (atp == ANISOTROPIC_TEMPERATURE_FACTORS_b_22) {
3285       ptr -> b_22 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3286       if (isError && ptr -> b_22 == NULL) {
3287          goto erret;
3288       }
3289       atp = AsnReadId(aip,amp, atp);
3290    }
3291    if (atp == ANISOTROPIC_TEMPERATURE_FACTORS_b_23) {
3292       ptr -> b_23 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3293       if (isError && ptr -> b_23 == NULL) {
3294          goto erret;
3295       }
3296       atp = AsnReadId(aip,amp, atp);
3297    }
3298    if (atp == ANISOTROPIC_TEMPERATURE_FACTORS_b_33) {
3299       ptr -> b_33 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3300       if (isError && ptr -> b_33 == NULL) {
3301          goto erret;
3302       }
3303       atp = AsnReadId(aip,amp, atp);
3304    }
3305 
3306    if (AsnReadVal(aip, atp, &av) <= 0) {
3307       goto erret;
3308    }
3309    /* end struct */
3310 
3311 ret:
3312    AsnUnlinkType(orig);       /* unlink local tree */
3313    return ptr;
3314 
3315 erret:
3316    aip -> io_failure = TRUE;
3317    ptr = AnisotropicTemperatureFactorsFree(ptr);
3318    goto ret;
3319 }
3320 
3321 
3322 
3323 /**************************************************
3324 *
3325 *    AnisotropicTemperatureFactorsAsnWrite()
3326 *
3327 **************************************************/
3328 Boolean LIBCALL
AnisotropicTemperatureFactorsAsnWrite(AnisotropicTemperatureFactorsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3329 AnisotropicTemperatureFactorsAsnWrite(AnisotropicTemperatureFactorsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3330 {
3331    DataVal av;
3332    AsnTypePtr atp;
3333    Boolean retval = FALSE;
3334 
3335    if (! loaded)
3336    {
3337       if (! objmmdb2AsnLoad()) {
3338          return FALSE;
3339       }
3340    }
3341 
3342    if (aip == NULL) {
3343       return FALSE;
3344    }
3345 
3346    atp = AsnLinkType(orig, ANISOTROPIC_TEMPERATURE_FACTORS);   /* link local tree */
3347    if (atp == NULL) {
3348       return FALSE;
3349    }
3350 
3351    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3352    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3353    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3354       goto erret;
3355    }
3356 
3357    av.intvalue = ptr -> scale_factor;
3358    retval = AsnWrite(aip, ANISOTROPIC_TEMPERATURE_FACTORS_scale_factor,  &av);
3359    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> b_11 ,ASNCODE_INTVAL_SLOT, aip, ANISOTROPIC_TEMPERATURE_FACTORS_b_11, ANISOTROPIC_TEMPERATURE_FACTORS_b_11_E);
3360    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> b_12 ,ASNCODE_INTVAL_SLOT, aip, ANISOTROPIC_TEMPERATURE_FACTORS_b_12, ANISOTROPIC_TEMPERATURE_FACTORS_b_12_E);
3361    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> b_13 ,ASNCODE_INTVAL_SLOT, aip, ANISOTROPIC_TEMPERATURE_FACTORS_b_13, ANISOTROPIC_TEMPERATURE_FACTORS_b_13_E);
3362    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> b_22 ,ASNCODE_INTVAL_SLOT, aip, ANISOTROPIC_TEMPERATURE_FACTORS_b_22, ANISOTROPIC_TEMPERATURE_FACTORS_b_22_E);
3363    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> b_23 ,ASNCODE_INTVAL_SLOT, aip, ANISOTROPIC_TEMPERATURE_FACTORS_b_23, ANISOTROPIC_TEMPERATURE_FACTORS_b_23_E);
3364    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> b_33 ,ASNCODE_INTVAL_SLOT, aip, ANISOTROPIC_TEMPERATURE_FACTORS_b_33, ANISOTROPIC_TEMPERATURE_FACTORS_b_33_E);
3365    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3366       goto erret;
3367    }
3368    retval = TRUE;
3369 
3370 erret:
3371    AsnUnlinkType(orig);       /* unlink local tree */
3372    return retval;
3373 }
3374 
3375 
3376 
3377 /**************************************************
3378 *
3379 *    TMeshNew()
3380 *
3381 **************************************************/
3382 
3383 TMeshPtr LIBCALL
TMeshNew(void)3384 TMeshNew(void)
3385 {
3386    TMeshPtr ptr = MemNew((size_t) sizeof(TMesh));
3387 
3388    return ptr;
3389 
3390 }
3391 
3392 
3393 /**************************************************
3394 *
3395 *    TMeshFree()
3396 *
3397 **************************************************/
3398 
3399 TMeshPtr LIBCALL
TMeshFree(TMeshPtr ptr)3400 TMeshFree(TMeshPtr ptr)
3401 {
3402 
3403    if(ptr == NULL) {
3404       return NULL;
3405    }
3406    AsnGenericBaseSeqOfFree(ptr -> swap ,ASNCODE_BOOLVAL_SLOT);
3407    AsnGenericBaseSeqOfFree(ptr -> x ,ASNCODE_INTVAL_SLOT);
3408    AsnGenericBaseSeqOfFree(ptr -> y ,ASNCODE_INTVAL_SLOT);
3409    AsnGenericBaseSeqOfFree(ptr -> z ,ASNCODE_INTVAL_SLOT);
3410    return MemFree(ptr);
3411 }
3412 
3413 
3414 /**************************************************
3415 *
3416 *    TMeshAsnRead()
3417 *
3418 **************************************************/
3419 
3420 TMeshPtr LIBCALL
TMeshAsnRead(AsnIoPtr aip,AsnTypePtr orig)3421 TMeshAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3422 {
3423    DataVal av;
3424    AsnTypePtr atp;
3425    Boolean isError = FALSE;
3426    AsnReadFunc func;
3427    TMeshPtr ptr;
3428 
3429    if (! loaded)
3430    {
3431       if (! objmmdb2AsnLoad()) {
3432          return NULL;
3433       }
3434    }
3435 
3436    if (aip == NULL) {
3437       return NULL;
3438    }
3439 
3440    if (orig == NULL) {         /* TMesh ::= (self contained) */
3441       atp = AsnReadId(aip, amp, T_MESH);
3442    } else {
3443       atp = AsnLinkType(orig, T_MESH);
3444    }
3445    /* link in local tree */
3446    if (atp == NULL) {
3447       return NULL;
3448    }
3449 
3450    ptr = TMeshNew();
3451    if (ptr == NULL) {
3452       goto erret;
3453    }
3454    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3455       goto erret;
3456    }
3457 
3458    atp = AsnReadId(aip,amp, atp);
3459    func = NULL;
3460 
3461    if (atp == T_MESH_number_of_points) {
3462       if ( AsnReadVal(aip, atp, &av) <= 0) {
3463          goto erret;
3464       }
3465       ptr -> number_of_points = av.intvalue;
3466       atp = AsnReadId(aip,amp, atp);
3467    }
3468    if (atp == T_MESH_scale_factor) {
3469       if ( AsnReadVal(aip, atp, &av) <= 0) {
3470          goto erret;
3471       }
3472       ptr -> scale_factor = av.intvalue;
3473       atp = AsnReadId(aip,amp, atp);
3474    }
3475    if (atp == T_MESH_swap) {
3476       ptr -> swap = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_BOOLVAL_SLOT, &isError);
3477       if (isError && ptr -> swap == NULL) {
3478          goto erret;
3479       }
3480       atp = AsnReadId(aip,amp, atp);
3481    }
3482    if (atp == T_MESH_x) {
3483       ptr -> x = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3484       if (isError && ptr -> x == NULL) {
3485          goto erret;
3486       }
3487       atp = AsnReadId(aip,amp, atp);
3488    }
3489    if (atp == T_MESH_y) {
3490       ptr -> y = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3491       if (isError && ptr -> y == NULL) {
3492          goto erret;
3493       }
3494       atp = AsnReadId(aip,amp, atp);
3495    }
3496    if (atp == T_MESH_z) {
3497       ptr -> z = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3498       if (isError && ptr -> z == NULL) {
3499          goto erret;
3500       }
3501       atp = AsnReadId(aip,amp, atp);
3502    }
3503 
3504    if (AsnReadVal(aip, atp, &av) <= 0) {
3505       goto erret;
3506    }
3507    /* end struct */
3508 
3509 ret:
3510    AsnUnlinkType(orig);       /* unlink local tree */
3511    return ptr;
3512 
3513 erret:
3514    aip -> io_failure = TRUE;
3515    ptr = TMeshFree(ptr);
3516    goto ret;
3517 }
3518 
3519 
3520 
3521 /**************************************************
3522 *
3523 *    TMeshAsnWrite()
3524 *
3525 **************************************************/
3526 Boolean LIBCALL
TMeshAsnWrite(TMeshPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3527 TMeshAsnWrite(TMeshPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3528 {
3529    DataVal av;
3530    AsnTypePtr atp;
3531    Boolean retval = FALSE;
3532 
3533    if (! loaded)
3534    {
3535       if (! objmmdb2AsnLoad()) {
3536          return FALSE;
3537       }
3538    }
3539 
3540    if (aip == NULL) {
3541       return FALSE;
3542    }
3543 
3544    atp = AsnLinkType(orig, T_MESH);   /* link local tree */
3545    if (atp == NULL) {
3546       return FALSE;
3547    }
3548 
3549    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3550    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3551    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3552       goto erret;
3553    }
3554 
3555    av.intvalue = ptr -> number_of_points;
3556    retval = AsnWrite(aip, T_MESH_number_of_points,  &av);
3557    av.intvalue = ptr -> scale_factor;
3558    retval = AsnWrite(aip, T_MESH_scale_factor,  &av);
3559    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> swap ,ASNCODE_BOOLVAL_SLOT, aip, T_MESH_swap, T_MESH_swap_E);
3560    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> x ,ASNCODE_INTVAL_SLOT, aip, T_MESH_x, T_MESH_x_E);
3561    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> y ,ASNCODE_INTVAL_SLOT, aip, T_MESH_y, T_MESH_y_E);
3562    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> z ,ASNCODE_INTVAL_SLOT, aip, T_MESH_z, T_MESH_z_E);
3563    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3564       goto erret;
3565    }
3566    retval = TRUE;
3567 
3568 erret:
3569    AsnUnlinkType(orig);       /* unlink local tree */
3570    return retval;
3571 }
3572 
3573 
3574 
3575 /**************************************************
3576 *
3577 *    TrianglesNew()
3578 *
3579 **************************************************/
3580 
3581 TrianglesPtr LIBCALL
TrianglesNew(void)3582 TrianglesNew(void)
3583 {
3584    TrianglesPtr ptr = MemNew((size_t) sizeof(Triangles));
3585 
3586    return ptr;
3587 
3588 }
3589 
3590 
3591 /**************************************************
3592 *
3593 *    TrianglesFree()
3594 *
3595 **************************************************/
3596 
3597 TrianglesPtr LIBCALL
TrianglesFree(TrianglesPtr ptr)3598 TrianglesFree(TrianglesPtr ptr)
3599 {
3600 
3601    if(ptr == NULL) {
3602       return NULL;
3603    }
3604    AsnGenericBaseSeqOfFree(ptr -> x ,ASNCODE_INTVAL_SLOT);
3605    AsnGenericBaseSeqOfFree(ptr -> y ,ASNCODE_INTVAL_SLOT);
3606    AsnGenericBaseSeqOfFree(ptr -> z ,ASNCODE_INTVAL_SLOT);
3607    AsnGenericBaseSeqOfFree(ptr -> v1 ,ASNCODE_INTVAL_SLOT);
3608    AsnGenericBaseSeqOfFree(ptr -> v2 ,ASNCODE_INTVAL_SLOT);
3609    AsnGenericBaseSeqOfFree(ptr -> v3 ,ASNCODE_INTVAL_SLOT);
3610    return MemFree(ptr);
3611 }
3612 
3613 
3614 /**************************************************
3615 *
3616 *    TrianglesAsnRead()
3617 *
3618 **************************************************/
3619 
3620 TrianglesPtr LIBCALL
TrianglesAsnRead(AsnIoPtr aip,AsnTypePtr orig)3621 TrianglesAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3622 {
3623    DataVal av;
3624    AsnTypePtr atp;
3625    Boolean isError = FALSE;
3626    AsnReadFunc func;
3627    TrianglesPtr ptr;
3628 
3629    if (! loaded)
3630    {
3631       if (! objmmdb2AsnLoad()) {
3632          return NULL;
3633       }
3634    }
3635 
3636    if (aip == NULL) {
3637       return NULL;
3638    }
3639 
3640    if (orig == NULL) {         /* Triangles ::= (self contained) */
3641       atp = AsnReadId(aip, amp, TRIANGLES);
3642    } else {
3643       atp = AsnLinkType(orig, TRIANGLES);
3644    }
3645    /* link in local tree */
3646    if (atp == NULL) {
3647       return NULL;
3648    }
3649 
3650    ptr = TrianglesNew();
3651    if (ptr == NULL) {
3652       goto erret;
3653    }
3654    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3655       goto erret;
3656    }
3657 
3658    atp = AsnReadId(aip,amp, atp);
3659    func = NULL;
3660 
3661    if (atp == TRIANGLES_number_of_points) {
3662       if ( AsnReadVal(aip, atp, &av) <= 0) {
3663          goto erret;
3664       }
3665       ptr -> number_of_points = av.intvalue;
3666       atp = AsnReadId(aip,amp, atp);
3667    }
3668    if (atp == TRIANGLES_scale_factor) {
3669       if ( AsnReadVal(aip, atp, &av) <= 0) {
3670          goto erret;
3671       }
3672       ptr -> scale_factor = av.intvalue;
3673       atp = AsnReadId(aip,amp, atp);
3674    }
3675    if (atp == TRIANGLES_x) {
3676       ptr -> x = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3677       if (isError && ptr -> x == NULL) {
3678          goto erret;
3679       }
3680       atp = AsnReadId(aip,amp, atp);
3681    }
3682    if (atp == TRIANGLES_y) {
3683       ptr -> y = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3684       if (isError && ptr -> y == NULL) {
3685          goto erret;
3686       }
3687       atp = AsnReadId(aip,amp, atp);
3688    }
3689    if (atp == TRIANGLES_z) {
3690       ptr -> z = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3691       if (isError && ptr -> z == NULL) {
3692          goto erret;
3693       }
3694       atp = AsnReadId(aip,amp, atp);
3695    }
3696    if (atp == TRIANGLES_number_of_triangles) {
3697       if ( AsnReadVal(aip, atp, &av) <= 0) {
3698          goto erret;
3699       }
3700       ptr -> number_of_triangles = av.intvalue;
3701       atp = AsnReadId(aip,amp, atp);
3702    }
3703    if (atp == TRIANGLES_v1) {
3704       ptr -> v1 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3705       if (isError && ptr -> v1 == NULL) {
3706          goto erret;
3707       }
3708       atp = AsnReadId(aip,amp, atp);
3709    }
3710    if (atp == TRIANGLES_v2) {
3711       ptr -> v2 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3712       if (isError && ptr -> v2 == NULL) {
3713          goto erret;
3714       }
3715       atp = AsnReadId(aip,amp, atp);
3716    }
3717    if (atp == TRIANGLES_v3) {
3718       ptr -> v3 = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
3719       if (isError && ptr -> v3 == NULL) {
3720          goto erret;
3721       }
3722       atp = AsnReadId(aip,amp, atp);
3723    }
3724 
3725    if (AsnReadVal(aip, atp, &av) <= 0) {
3726       goto erret;
3727    }
3728    /* end struct */
3729 
3730 ret:
3731    AsnUnlinkType(orig);       /* unlink local tree */
3732    return ptr;
3733 
3734 erret:
3735    aip -> io_failure = TRUE;
3736    ptr = TrianglesFree(ptr);
3737    goto ret;
3738 }
3739 
3740 
3741 
3742 /**************************************************
3743 *
3744 *    TrianglesAsnWrite()
3745 *
3746 **************************************************/
3747 Boolean LIBCALL
TrianglesAsnWrite(TrianglesPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3748 TrianglesAsnWrite(TrianglesPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3749 {
3750    DataVal av;
3751    AsnTypePtr atp;
3752    Boolean retval = FALSE;
3753 
3754    if (! loaded)
3755    {
3756       if (! objmmdb2AsnLoad()) {
3757          return FALSE;
3758       }
3759    }
3760 
3761    if (aip == NULL) {
3762       return FALSE;
3763    }
3764 
3765    atp = AsnLinkType(orig, TRIANGLES);   /* link local tree */
3766    if (atp == NULL) {
3767       return FALSE;
3768    }
3769 
3770    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3771    MemSet ((Pointer) (&av), 0, sizeof (DataVal));
3772    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3773       goto erret;
3774    }
3775 
3776    av.intvalue = ptr -> number_of_points;
3777    retval = AsnWrite(aip, TRIANGLES_number_of_points,  &av);
3778    av.intvalue = ptr -> scale_factor;
3779    retval = AsnWrite(aip, TRIANGLES_scale_factor,  &av);
3780    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> x ,ASNCODE_INTVAL_SLOT, aip, TRIANGLES_x, TRIANGLES_x_E);
3781    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> y ,ASNCODE_INTVAL_SLOT, aip, TRIANGLES_y, TRIANGLES_y_E);
3782    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> z ,ASNCODE_INTVAL_SLOT, aip, TRIANGLES_z, TRIANGLES_z_E);
3783    av.intvalue = ptr -> number_of_triangles;
3784    retval = AsnWrite(aip, TRIANGLES_number_of_triangles,  &av);
3785    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> v1 ,ASNCODE_INTVAL_SLOT, aip, TRIANGLES_v1, TRIANGLES_v1_E);
3786    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> v2 ,ASNCODE_INTVAL_SLOT, aip, TRIANGLES_v2, TRIANGLES_v2_E);
3787    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> v3 ,ASNCODE_INTVAL_SLOT, aip, TRIANGLES_v3, TRIANGLES_v3_E);
3788    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3789       goto erret;
3790    }
3791    retval = TRUE;
3792 
3793 erret:
3794    AsnUnlinkType(orig);       /* unlink local tree */
3795    return retval;
3796 }
3797 
3798