1 #include <asn.h>
2
3 #define NLM_GENERATED_CODE_PROTO
4
5 #include <egkludge.h>
6 #include <objentgene.h>
7
8 static Boolean loaded = FALSE;
9
10 #include <asnentgene.h>
11
12 #ifndef NLM_EXTERN_LOADS
13 #define NLM_EXTERN_LOADS {}
14 #endif
15
16 NLM_EXTERN Boolean LIBCALL
objentgeneAsnLoad(void)17 objentgeneAsnLoad(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 NCBI-Entrezgene
35 * Generated using ASNCODE Revision: 6.19 at Mar 23, 2015 6:20 PM
36 *
37 **************************************************/
38
39
40 /**************************************************
41 *
42 * EntrezgeneNew()
43 *
44 **************************************************/
45 NLM_EXTERN
46 EntrezgenePtr LIBCALL
EntrezgeneNew(void)47 EntrezgeneNew(void)
48 {
49 EntrezgenePtr ptr = MemNew((size_t) sizeof(Entrezgene));
50
51 return ptr;
52
53 }
54
55
56 /**************************************************
57 *
58 * EntrezgeneFree()
59 *
60 **************************************************/
61 NLM_EXTERN
62 EntrezgenePtr LIBCALL
EntrezgeneFree(EntrezgenePtr ptr)63 EntrezgeneFree(EntrezgenePtr ptr)
64 {
65
66 if(ptr == NULL) {
67 return NULL;
68 }
69 GeneTrackFree(ptr -> track_info);
70 BioSourceFree(ptr -> source);
71 GeneRefFree(ptr -> gene);
72 ProtRefFree(ptr -> prot);
73 RNARefFree(ptr -> rna);
74 MemFree(ptr -> summary);
75 AsnGenericUserSeqOfFree(ptr -> location, (AsnOptFreeFunc) MapsFree);
76 GeneSourceFree(ptr -> gene_source);
77 AsnGenericUserSeqOfFree(ptr -> locus, (AsnOptFreeFunc) GeneCommentaryFree);
78 AsnGenericUserSeqOfFree(ptr -> properties, (AsnOptFreeFunc) GeneCommentaryFree);
79 AsnGenericUserSeqOfFree(ptr -> refgene, (AsnOptFreeFunc) GeneCommentaryFree);
80 AsnGenericUserSeqOfFree(ptr -> homology, (AsnOptFreeFunc) GeneCommentaryFree);
81 AsnGenericUserSeqOfFree(ptr -> comments, (AsnOptFreeFunc) GeneCommentaryFree);
82 AsnGenericUserSeqOfFree(ptr -> unique_keys, (AsnOptFreeFunc) DbtagFree);
83 AsnGenericBaseSeqOfFree(ptr -> xtra_index_terms ,ASNCODE_PTRVAL_SLOT);
84 AsnGenericUserSeqOfFree(ptr -> xtra_properties, (AsnOptFreeFunc) XtraTermsFree);
85 AsnGenericUserSeqOfFree(ptr -> xtra_iq, (AsnOptFreeFunc) XtraTermsFree);
86 AsnGenericUserSeqOfFree(ptr -> non_unique_keys, (AsnOptFreeFunc) DbtagFree);
87 return MemFree(ptr);
88 }
89
90
91 /**************************************************
92 *
93 * EntrezgeneAsnRead()
94 *
95 **************************************************/
96 NLM_EXTERN
97 EntrezgenePtr LIBCALL
EntrezgeneAsnRead(AsnIoPtr aip,AsnTypePtr orig)98 EntrezgeneAsnRead(AsnIoPtr aip, AsnTypePtr orig)
99 {
100 DataVal av;
101 AsnTypePtr atp;
102 Boolean isError = FALSE;
103 AsnReadFunc func;
104 EntrezgenePtr ptr;
105
106 if (! loaded)
107 {
108 if (! objentgeneAsnLoad()) {
109 return NULL;
110 }
111 }
112
113 if (aip == NULL) {
114 return NULL;
115 }
116
117 if (orig == NULL) { /* Entrezgene ::= (self contained) */
118 atp = AsnReadId(aip, amp, ENTREZGENE);
119 } else {
120 atp = AsnLinkType(orig, ENTREZGENE);
121 }
122 /* link in local tree */
123 if (atp == NULL) {
124 return NULL;
125 }
126
127 ptr = EntrezgeneNew();
128 if (ptr == NULL) {
129 goto erret;
130 }
131 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
132 goto erret;
133 }
134
135 atp = AsnReadId(aip,amp, atp);
136 func = NULL;
137
138 if (atp == ENTREZGENE_track_info) {
139 ptr -> track_info = GeneTrackAsnRead(aip, atp);
140 if (aip -> io_failure) {
141 goto erret;
142 }
143 atp = AsnReadId(aip,amp, atp);
144 }
145 if (atp == ENTREZGENE_type) {
146 if ( AsnReadVal(aip, atp, &av) <= 0) {
147 goto erret;
148 }
149 ptr -> type = av.intvalue;
150 atp = AsnReadId(aip,amp, atp);
151 }
152 if (atp == ENTREZGENE_source) {
153 ptr -> source = BioSourceAsnRead(aip, atp);
154 if (aip -> io_failure) {
155 goto erret;
156 }
157 atp = AsnReadId(aip,amp, atp);
158 }
159 if (atp == ENTREZGENE_gene) {
160 ptr -> gene = GeneRefAsnRead(aip, atp);
161 if (aip -> io_failure) {
162 goto erret;
163 }
164 atp = AsnReadId(aip,amp, atp);
165 }
166 if (atp == ENTREZGENE_prot) {
167 ptr -> prot = ProtRefAsnRead(aip, atp);
168 if (aip -> io_failure) {
169 goto erret;
170 }
171 atp = AsnReadId(aip,amp, atp);
172 }
173 if (atp == ENTREZGENE_rna) {
174 ptr -> rna = RNARefAsnRead(aip, atp);
175 if (aip -> io_failure) {
176 goto erret;
177 }
178 atp = AsnReadId(aip,amp, atp);
179 }
180 if (atp == ENTREZGENE_summary) {
181 if ( AsnReadVal(aip, atp, &av) <= 0) {
182 goto erret;
183 }
184 ptr -> summary = av.ptrvalue;
185 atp = AsnReadId(aip,amp, atp);
186 }
187 if (atp == ENTREZGENE_location) {
188 ptr -> location = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MapsAsnRead, (AsnOptFreeFunc) MapsFree);
189 if (isError && ptr -> location == NULL) {
190 goto erret;
191 }
192 atp = AsnReadId(aip,amp, atp);
193 }
194 if (atp == ENTREZGENE_gene_source) {
195 ptr -> gene_source = GeneSourceAsnRead(aip, atp);
196 if (aip -> io_failure) {
197 goto erret;
198 }
199 atp = AsnReadId(aip,amp, atp);
200 }
201 if (atp == ENTREZGENE_locus) {
202 ptr -> locus = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
203 if (isError && ptr -> locus == NULL) {
204 goto erret;
205 }
206 atp = AsnReadId(aip,amp, atp);
207 }
208 if (atp == ENTREZGENE_properties) {
209 ptr -> properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
210 if (isError && ptr -> properties == NULL) {
211 goto erret;
212 }
213 atp = AsnReadId(aip,amp, atp);
214 }
215 if (atp == ENTREZGENE_refgene) {
216 ptr -> refgene = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
217 if (isError && ptr -> refgene == NULL) {
218 goto erret;
219 }
220 atp = AsnReadId(aip,amp, atp);
221 }
222 if (atp == ENTREZGENE_homology) {
223 ptr -> homology = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
224 if (isError && ptr -> homology == NULL) {
225 goto erret;
226 }
227 atp = AsnReadId(aip,amp, atp);
228 }
229 if (atp == ENTREZGENE_comments) {
230 ptr -> comments = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
231 if (isError && ptr -> comments == NULL) {
232 goto erret;
233 }
234 atp = AsnReadId(aip,amp, atp);
235 }
236 if (atp == ENTREZGENE_unique_keys) {
237 ptr -> unique_keys = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) DbtagAsnRead, (AsnOptFreeFunc) DbtagFree);
238 if (isError && ptr -> unique_keys == NULL) {
239 goto erret;
240 }
241 atp = AsnReadId(aip,amp, atp);
242 }
243 if (atp == ENTREZGENE_xtra_index_terms) {
244 ptr -> xtra_index_terms = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
245 if (isError && ptr -> xtra_index_terms == NULL) {
246 goto erret;
247 }
248 atp = AsnReadId(aip,amp, atp);
249 }
250 if (atp == ENTREZGENE_xtra_properties) {
251 ptr -> xtra_properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) XtraTermsAsnRead, (AsnOptFreeFunc) XtraTermsFree);
252 if (isError && ptr -> xtra_properties == NULL) {
253 goto erret;
254 }
255 atp = AsnReadId(aip,amp, atp);
256 }
257 if (atp == ENTREZGENE_xtra_iq) {
258 ptr -> xtra_iq = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) XtraTermsAsnRead, (AsnOptFreeFunc) XtraTermsFree);
259 if (isError && ptr -> xtra_iq == NULL) {
260 goto erret;
261 }
262 atp = AsnReadId(aip,amp, atp);
263 }
264 if (atp == ENTREZGENE_non_unique_keys) {
265 ptr -> non_unique_keys = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) DbtagAsnRead, (AsnOptFreeFunc) DbtagFree);
266 if (isError && ptr -> non_unique_keys == NULL) {
267 goto erret;
268 }
269 atp = AsnReadId(aip,amp, atp);
270 }
271
272 if (AsnReadVal(aip, atp, &av) <= 0) {
273 goto erret;
274 }
275 /* end struct */
276
277 ret:
278 AsnUnlinkType(orig); /* unlink local tree */
279 return ptr;
280
281 erret:
282 aip -> io_failure = TRUE;
283 ptr = EntrezgeneFree(ptr);
284 goto ret;
285 }
286
287
288
289 /**************************************************
290 *
291 * EntrezgeneAsnWrite()
292 *
293 **************************************************/
294 NLM_EXTERN Boolean LIBCALL
EntrezgeneAsnWrite(EntrezgenePtr ptr,AsnIoPtr aip,AsnTypePtr orig)295 EntrezgeneAsnWrite(EntrezgenePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
296 {
297 DataVal av;
298 AsnTypePtr atp;
299 Boolean retval = FALSE;
300
301 if (! loaded)
302 {
303 if (! objentgeneAsnLoad()) {
304 return FALSE;
305 }
306 }
307
308 if (aip == NULL) {
309 return FALSE;
310 }
311
312 atp = AsnLinkType(orig, ENTREZGENE); /* link local tree */
313 if (atp == NULL) {
314 return FALSE;
315 }
316
317 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
318 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
319 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
320 goto erret;
321 }
322
323 if (ptr -> track_info != NULL) {
324 if ( ! GeneTrackAsnWrite(ptr -> track_info, aip, ENTREZGENE_track_info)) {
325 goto erret;
326 }
327 }
328 av.intvalue = ptr -> type;
329 retval = AsnWrite(aip, ENTREZGENE_type, &av);
330 if (ptr -> source != NULL) {
331 if ( ! BioSourceAsnWrite(ptr -> source, aip, ENTREZGENE_source)) {
332 goto erret;
333 }
334 }
335 if (ptr -> gene != NULL) {
336 if ( ! GeneRefAsnWrite(ptr -> gene, aip, ENTREZGENE_gene)) {
337 goto erret;
338 }
339 }
340 if (ptr -> prot != NULL) {
341 if ( ! ProtRefAsnWrite(ptr -> prot, aip, ENTREZGENE_prot)) {
342 goto erret;
343 }
344 }
345 if (ptr -> rna != NULL) {
346 if ( ! RNARefAsnWrite(ptr -> rna, aip, ENTREZGENE_rna)) {
347 goto erret;
348 }
349 }
350 if (ptr -> summary != NULL) {
351 av.ptrvalue = ptr -> summary;
352 retval = AsnWrite(aip, ENTREZGENE_summary, &av);
353 }
354 AsnGenericUserSeqOfAsnWrite(ptr -> location, (AsnWriteFunc) MapsAsnWrite, aip, ENTREZGENE_location, ENTREZGENE_location_E);
355 if (ptr -> gene_source != NULL) {
356 if ( ! GeneSourceAsnWrite(ptr -> gene_source, aip, ENTREZGENE_gene_source)) {
357 goto erret;
358 }
359 }
360 AsnGenericUserSeqOfAsnWrite(ptr -> locus, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_locus, ENTREZGENE_locus_E);
361 AsnGenericUserSeqOfAsnWrite(ptr -> properties, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_properties, ENTREZGENE_properties_E);
362 AsnGenericUserSeqOfAsnWrite(ptr -> refgene, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_refgene, ENTREZGENE_refgene_E);
363 AsnGenericUserSeqOfAsnWrite(ptr -> homology, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_homology, ENTREZGENE_homology_E);
364 AsnGenericUserSeqOfAsnWrite(ptr -> comments, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, ENTREZGENE_comments, ENTREZGENE_comments_E);
365 AsnGenericUserSeqOfAsnWrite(ptr -> unique_keys, (AsnWriteFunc) DbtagAsnWrite, aip, ENTREZGENE_unique_keys, ENTREZGENE_unique_keys_E);
366 retval = AsnGenericBaseSeqOfAsnWrite(ptr -> xtra_index_terms ,ASNCODE_PTRVAL_SLOT, aip, ENTREZGENE_xtra_index_terms, ENTREZGENE_xtra_index_terms_E);
367 AsnGenericUserSeqOfAsnWrite(ptr -> xtra_properties, (AsnWriteFunc) XtraTermsAsnWrite, aip, ENTREZGENE_xtra_properties, ENTREZGENE_xtra_properties_E);
368 AsnGenericUserSeqOfAsnWrite(ptr -> xtra_iq, (AsnWriteFunc) XtraTermsAsnWrite, aip, ENTREZGENE_xtra_iq, ENTREZGENE_xtra_iq_E);
369 AsnGenericUserSeqOfAsnWrite(ptr -> non_unique_keys, (AsnWriteFunc) DbtagAsnWrite, aip, ENTREZGENE_non_unique_keys, ENTREZGENE_non_unique_keys_E);
370 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
371 goto erret;
372 }
373 retval = TRUE;
374
375 erret:
376 AsnUnlinkType(orig); /* unlink local tree */
377 return retval;
378 }
379
380
381
382 /**************************************************
383 *
384 * EntrezgeneSetFree()
385 *
386 **************************************************/
387 NLM_EXTERN
388 EntrezgeneSetPtr LIBCALL
EntrezgeneSetFree(EntrezgeneSetPtr ptr)389 EntrezgeneSetFree(EntrezgeneSetPtr ptr)
390 {
391
392 if(ptr == NULL) {
393 return NULL;
394 }
395 AsnGenericUserSeqOfFree(ptr, (AsnOptFreeFunc) EntrezgeneFree);
396 return NULL;
397 }
398
399
400 /**************************************************
401 *
402 * EntrezgeneSetAsnRead()
403 *
404 **************************************************/
405 NLM_EXTERN
406 EntrezgeneSetPtr LIBCALL
EntrezgeneSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)407 EntrezgeneSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
408 {
409 DataVal av;
410 AsnTypePtr atp;
411 Boolean isError = FALSE;
412 AsnReadFunc func;
413 EntrezgeneSetPtr ptr;
414
415 if (! loaded)
416 {
417 if (! objentgeneAsnLoad()) {
418 return NULL;
419 }
420 }
421
422 if (aip == NULL) {
423 return NULL;
424 }
425
426 if (orig == NULL) { /* EntrezgeneSet ::= (self contained) */
427 atp = AsnReadId(aip, amp, ENTREZGENE_SET);
428 } else {
429 atp = AsnLinkType(orig, ENTREZGENE_SET);
430 }
431 /* link in local tree */
432 if (atp == NULL) {
433 return NULL;
434 }
435
436 func = NULL;
437
438 ptr = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) EntrezgeneAsnRead, (AsnOptFreeFunc) EntrezgeneFree);
439 if (isError && ptr == NULL) {
440 goto erret;
441 }
442
443
444
445 ret:
446 AsnUnlinkType(orig); /* unlink local tree */
447 return ptr;
448
449 erret:
450 aip -> io_failure = TRUE;
451 ptr = EntrezgeneSetFree(ptr);
452 goto ret;
453 }
454
455
456
457 /**************************************************
458 *
459 * EntrezgeneSetAsnWrite()
460 *
461 **************************************************/
462 NLM_EXTERN Boolean LIBCALL
EntrezgeneSetAsnWrite(EntrezgeneSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)463 EntrezgeneSetAsnWrite(EntrezgeneSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
464 {
465 DataVal av;
466 AsnTypePtr atp;
467 Boolean retval = FALSE;
468
469 if (! loaded)
470 {
471 if (! objentgeneAsnLoad()) {
472 return FALSE;
473 }
474 }
475
476 if (aip == NULL) {
477 return FALSE;
478 }
479
480 atp = AsnLinkType(orig, ENTREZGENE_SET); /* link local tree */
481 if (atp == NULL) {
482 return FALSE;
483 }
484
485 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
486 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
487 retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) EntrezgeneAsnWrite, aip, atp, ENTREZGENE_SET_E);
488 retval = TRUE;
489
490 erret:
491 AsnUnlinkType(orig); /* unlink local tree */
492 return retval;
493 }
494
495
496
497 /**************************************************
498 *
499 * GeneTrackNew()
500 *
501 **************************************************/
502 NLM_EXTERN
503 GeneTrackPtr LIBCALL
GeneTrackNew(void)504 GeneTrackNew(void)
505 {
506 GeneTrackPtr ptr = MemNew((size_t) sizeof(GeneTrack));
507
508 ptr -> status = 0;
509 return ptr;
510
511 }
512
513
514 /**************************************************
515 *
516 * GeneTrackFree()
517 *
518 **************************************************/
519 NLM_EXTERN
520 GeneTrackPtr LIBCALL
GeneTrackFree(GeneTrackPtr ptr)521 GeneTrackFree(GeneTrackPtr ptr)
522 {
523
524 if(ptr == NULL) {
525 return NULL;
526 }
527 AsnGenericUserSeqOfFree(ptr -> current_id, (AsnOptFreeFunc) DbtagFree);
528 DateFree(ptr -> create_date);
529 DateFree(ptr -> update_date);
530 DateFree(ptr -> discontinue_date);
531 return MemFree(ptr);
532 }
533
534
535 /**************************************************
536 *
537 * GeneTrackAsnRead()
538 *
539 **************************************************/
540 NLM_EXTERN
541 GeneTrackPtr LIBCALL
GeneTrackAsnRead(AsnIoPtr aip,AsnTypePtr orig)542 GeneTrackAsnRead(AsnIoPtr aip, AsnTypePtr orig)
543 {
544 DataVal av;
545 AsnTypePtr atp;
546 Boolean isError = FALSE;
547 AsnReadFunc func;
548 GeneTrackPtr ptr;
549
550 if (! loaded)
551 {
552 if (! objentgeneAsnLoad()) {
553 return NULL;
554 }
555 }
556
557 if (aip == NULL) {
558 return NULL;
559 }
560
561 if (orig == NULL) { /* GeneTrack ::= (self contained) */
562 atp = AsnReadId(aip, amp, GENE_TRACK);
563 } else {
564 atp = AsnLinkType(orig, GENE_TRACK);
565 }
566 /* link in local tree */
567 if (atp == NULL) {
568 return NULL;
569 }
570
571 ptr = GeneTrackNew();
572 if (ptr == NULL) {
573 goto erret;
574 }
575 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
576 goto erret;
577 }
578
579 atp = AsnReadId(aip,amp, atp);
580 func = NULL;
581
582 if (atp == GENE_TRACK_geneid) {
583 if ( AsnReadVal(aip, atp, &av) <= 0) {
584 goto erret;
585 }
586 ptr -> geneid = av.intvalue;
587 atp = AsnReadId(aip,amp, atp);
588 }
589 if (atp == GENE_TRACK_status) {
590 if ( AsnReadVal(aip, atp, &av) <= 0) {
591 goto erret;
592 }
593 ptr -> status = av.intvalue;
594 atp = AsnReadId(aip,amp, atp);
595 }
596 if (atp == GENE_TRACK_current_id) {
597 ptr -> current_id = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) DbtagAsnRead, (AsnOptFreeFunc) DbtagFree);
598 if (isError && ptr -> current_id == NULL) {
599 goto erret;
600 }
601 atp = AsnReadId(aip,amp, atp);
602 }
603 if (atp == GENE_TRACK_create_date) {
604 ptr -> create_date = DateAsnRead(aip, atp);
605 if (aip -> io_failure) {
606 goto erret;
607 }
608 atp = AsnReadId(aip,amp, atp);
609 }
610 if (atp == GENE_TRACK_update_date) {
611 ptr -> update_date = DateAsnRead(aip, atp);
612 if (aip -> io_failure) {
613 goto erret;
614 }
615 atp = AsnReadId(aip,amp, atp);
616 }
617 if (atp == GENE_TRACK_discontinue_date) {
618 ptr -> discontinue_date = DateAsnRead(aip, atp);
619 if (aip -> io_failure) {
620 goto erret;
621 }
622 atp = AsnReadId(aip,amp, atp);
623 }
624
625 if (AsnReadVal(aip, atp, &av) <= 0) {
626 goto erret;
627 }
628 /* end struct */
629
630 ret:
631 AsnUnlinkType(orig); /* unlink local tree */
632 return ptr;
633
634 erret:
635 aip -> io_failure = TRUE;
636 ptr = GeneTrackFree(ptr);
637 goto ret;
638 }
639
640
641
642 /**************************************************
643 *
644 * GeneTrackAsnWrite()
645 *
646 **************************************************/
647 NLM_EXTERN Boolean LIBCALL
GeneTrackAsnWrite(GeneTrackPtr ptr,AsnIoPtr aip,AsnTypePtr orig)648 GeneTrackAsnWrite(GeneTrackPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
649 {
650 DataVal av;
651 AsnTypePtr atp;
652 Boolean retval = FALSE;
653
654 if (! loaded)
655 {
656 if (! objentgeneAsnLoad()) {
657 return FALSE;
658 }
659 }
660
661 if (aip == NULL) {
662 return FALSE;
663 }
664
665 atp = AsnLinkType(orig, GENE_TRACK); /* link local tree */
666 if (atp == NULL) {
667 return FALSE;
668 }
669
670 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
671 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
672 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
673 goto erret;
674 }
675
676 av.intvalue = ptr -> geneid;
677 retval = AsnWrite(aip, GENE_TRACK_geneid, &av);
678 av.intvalue = ptr -> status;
679 retval = AsnWrite(aip, GENE_TRACK_status, &av);
680 AsnGenericUserSeqOfAsnWrite(ptr -> current_id, (AsnWriteFunc) DbtagAsnWrite, aip, GENE_TRACK_current_id, GENE_TRACK_current_id_E);
681 if (ptr -> create_date != NULL) {
682 if ( ! DateAsnWrite(ptr -> create_date, aip, GENE_TRACK_create_date)) {
683 goto erret;
684 }
685 }
686 if (ptr -> update_date != NULL) {
687 if ( ! DateAsnWrite(ptr -> update_date, aip, GENE_TRACK_update_date)) {
688 goto erret;
689 }
690 }
691 if (ptr -> discontinue_date != NULL) {
692 if ( ! DateAsnWrite(ptr -> discontinue_date, aip, GENE_TRACK_discontinue_date)) {
693 goto erret;
694 }
695 }
696 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
697 goto erret;
698 }
699 retval = TRUE;
700
701 erret:
702 AsnUnlinkType(orig); /* unlink local tree */
703 return retval;
704 }
705
706
707
708 /**************************************************
709 *
710 * GeneCommentaryNew()
711 *
712 **************************************************/
713 NLM_EXTERN
714 GeneCommentaryPtr LIBCALL
GeneCommentaryNew(void)715 GeneCommentaryNew(void)
716 {
717 GeneCommentaryPtr ptr = MemNew((size_t) sizeof(GeneCommentary));
718
719 return ptr;
720
721 }
722
723
724 /**************************************************
725 *
726 * GeneCommentaryFree()
727 *
728 **************************************************/
729 NLM_EXTERN
730 GeneCommentaryPtr LIBCALL
GeneCommentaryFree(GeneCommentaryPtr ptr)731 GeneCommentaryFree(GeneCommentaryPtr ptr)
732 {
733
734 if(ptr == NULL) {
735 return NULL;
736 }
737 MemFree(ptr -> heading);
738 MemFree(ptr -> label);
739 MemFree(ptr -> text);
740 MemFree(ptr -> accession);
741 AsnGenericUserSeqOfFree(ptr -> xtra_properties, (AsnOptFreeFunc) XtraTermsFree);
742 AsnGenericChoiceSeqOfFree(ptr -> refs, (AsnOptFreeFunc) PubFree);
743 AsnGenericUserSeqOfFree(ptr -> source, (AsnOptFreeFunc) OtherSourceFree);
744 AsnGenericChoiceSeqOfFree(ptr -> genomic_coords, (AsnOptFreeFunc) SeqLocFree);
745 AsnGenericChoiceSeqOfFree(ptr -> seqs, (AsnOptFreeFunc) SeqLocFree);
746 AsnGenericUserSeqOfFree(ptr -> products, (AsnOptFreeFunc) GeneCommentaryFree);
747 AsnGenericUserSeqOfFree(ptr -> properties, (AsnOptFreeFunc) GeneCommentaryFree);
748 AsnGenericUserSeqOfFree(ptr -> comment, (AsnOptFreeFunc) GeneCommentaryFree);
749 DateFree(ptr -> create_date);
750 DateFree(ptr -> update_date);
751 RNARefFree(ptr -> rna);
752 return MemFree(ptr);
753 }
754
755
756 /**************************************************
757 *
758 * GeneCommentaryAsnRead()
759 *
760 **************************************************/
761 NLM_EXTERN
762 GeneCommentaryPtr LIBCALL
GeneCommentaryAsnRead(AsnIoPtr aip,AsnTypePtr orig)763 GeneCommentaryAsnRead(AsnIoPtr aip, AsnTypePtr orig)
764 {
765 DataVal av;
766 AsnTypePtr atp;
767 Boolean isError = FALSE;
768 AsnReadFunc func;
769 GeneCommentaryPtr ptr;
770
771 if (! loaded)
772 {
773 if (! objentgeneAsnLoad()) {
774 return NULL;
775 }
776 }
777
778 if (aip == NULL) {
779 return NULL;
780 }
781
782 if (orig == NULL) { /* GeneCommentary ::= (self contained) */
783 atp = AsnReadId(aip, amp, GENE_COMMENTARY);
784 } else {
785 atp = AsnLinkType(orig, GENE_COMMENTARY);
786 }
787 /* link in local tree */
788 if (atp == NULL) {
789 return NULL;
790 }
791
792 ptr = GeneCommentaryNew();
793 if (ptr == NULL) {
794 goto erret;
795 }
796 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
797 goto erret;
798 }
799
800 atp = AsnReadId(aip,amp, atp);
801 func = NULL;
802
803 if (atp == GENE_COMMENTARY_type) {
804 if ( AsnReadVal(aip, atp, &av) <= 0) {
805 goto erret;
806 }
807 ptr -> type = av.intvalue;
808 atp = AsnReadId(aip,amp, atp);
809 }
810 if (atp == GENE_COMMENTARY_heading) {
811 if ( AsnReadVal(aip, atp, &av) <= 0) {
812 goto erret;
813 }
814 ptr -> heading = av.ptrvalue;
815 atp = AsnReadId(aip,amp, atp);
816 }
817 if (atp == GENE_COMMENTARY_label) {
818 if ( AsnReadVal(aip, atp, &av) <= 0) {
819 goto erret;
820 }
821 ptr -> label = av.ptrvalue;
822 atp = AsnReadId(aip,amp, atp);
823 }
824 if (atp == GENE_COMMENTARY_text) {
825 if ( AsnReadVal(aip, atp, &av) <= 0) {
826 goto erret;
827 }
828 ptr -> text = av.ptrvalue;
829 atp = AsnReadId(aip,amp, atp);
830 }
831 if (atp == GENE_COMMENTARY_accession) {
832 if ( AsnReadVal(aip, atp, &av) <= 0) {
833 goto erret;
834 }
835 ptr -> accession = av.ptrvalue;
836 atp = AsnReadId(aip,amp, atp);
837 }
838 if (atp == GENE_COMMENTARY_version) {
839 if ( AsnReadVal(aip, atp, &av) <= 0) {
840 goto erret;
841 }
842 ptr -> version = av.intvalue;
843 atp = AsnReadId(aip,amp, atp);
844 }
845 if (atp == GENE_COMMENTARY_xtra_properties) {
846 ptr -> xtra_properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) XtraTermsAsnRead, (AsnOptFreeFunc) XtraTermsFree);
847 if (isError && ptr -> xtra_properties == NULL) {
848 goto erret;
849 }
850 atp = AsnReadId(aip,amp, atp);
851 }
852 if (atp == GENE_COMMENTARY_refs) {
853 ptr -> refs = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) PubAsnRead, (AsnOptFreeFunc) PubFree);
854 if (isError && ptr -> refs == NULL) {
855 goto erret;
856 }
857 atp = AsnReadId(aip,amp, atp);
858 }
859 if (atp == GENE_COMMENTARY_source) {
860 ptr -> source = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) OtherSourceAsnRead, (AsnOptFreeFunc) OtherSourceFree);
861 if (isError && ptr -> source == NULL) {
862 goto erret;
863 }
864 atp = AsnReadId(aip,amp, atp);
865 }
866 if (atp == GENE_COMMENTARY_genomic_coords) {
867 ptr -> genomic_coords = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
868 if (isError && ptr -> genomic_coords == NULL) {
869 goto erret;
870 }
871 atp = AsnReadId(aip,amp, atp);
872 }
873 if (atp == GENE_COMMENTARY_seqs) {
874 ptr -> seqs = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
875 if (isError && ptr -> seqs == NULL) {
876 goto erret;
877 }
878 atp = AsnReadId(aip,amp, atp);
879 }
880 if (atp == GENE_COMMENTARY_products) {
881 ptr -> products = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
882 if (isError && ptr -> products == NULL) {
883 goto erret;
884 }
885 atp = AsnReadId(aip,amp, atp);
886 }
887 if (atp == GENE_COMMENTARY_properties) {
888 ptr -> properties = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
889 if (isError && ptr -> properties == NULL) {
890 goto erret;
891 }
892 atp = AsnReadId(aip,amp, atp);
893 }
894 if (atp == GENE_COMMENTARY_comment) {
895 ptr -> comment = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) GeneCommentaryAsnRead, (AsnOptFreeFunc) GeneCommentaryFree);
896 if (isError && ptr -> comment == NULL) {
897 goto erret;
898 }
899 atp = AsnReadId(aip,amp, atp);
900 }
901 if (atp == GENE_COMMENTARY_create_date) {
902 ptr -> create_date = DateAsnRead(aip, atp);
903 if (aip -> io_failure) {
904 goto erret;
905 }
906 atp = AsnReadId(aip,amp, atp);
907 }
908 if (atp == GENE_COMMENTARY_update_date) {
909 ptr -> update_date = DateAsnRead(aip, atp);
910 if (aip -> io_failure) {
911 goto erret;
912 }
913 atp = AsnReadId(aip,amp, atp);
914 }
915 if (atp == GENE_COMMENTARY_rna) {
916 ptr -> rna = RNARefAsnRead(aip, atp);
917 if (aip -> io_failure) {
918 goto erret;
919 }
920 atp = AsnReadId(aip,amp, atp);
921 }
922
923 if (AsnReadVal(aip, atp, &av) <= 0) {
924 goto erret;
925 }
926 /* end struct */
927
928 ret:
929 AsnUnlinkType(orig); /* unlink local tree */
930 return ptr;
931
932 erret:
933 aip -> io_failure = TRUE;
934 ptr = GeneCommentaryFree(ptr);
935 goto ret;
936 }
937
938
939
940 /**************************************************
941 *
942 * GeneCommentaryAsnWrite()
943 *
944 **************************************************/
945 NLM_EXTERN Boolean LIBCALL
GeneCommentaryAsnWrite(GeneCommentaryPtr ptr,AsnIoPtr aip,AsnTypePtr orig)946 GeneCommentaryAsnWrite(GeneCommentaryPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
947 {
948 DataVal av;
949 AsnTypePtr atp;
950 Boolean retval = FALSE;
951
952 if (! loaded)
953 {
954 if (! objentgeneAsnLoad()) {
955 return FALSE;
956 }
957 }
958
959 if (aip == NULL) {
960 return FALSE;
961 }
962
963 atp = AsnLinkType(orig, GENE_COMMENTARY); /* link local tree */
964 if (atp == NULL) {
965 return FALSE;
966 }
967
968 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
969 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
970 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
971 goto erret;
972 }
973
974 av.intvalue = ptr -> type;
975 retval = AsnWrite(aip, GENE_COMMENTARY_type, &av);
976 if (ptr -> heading != NULL) {
977 av.ptrvalue = ptr -> heading;
978 retval = AsnWrite(aip, GENE_COMMENTARY_heading, &av);
979 }
980 if (ptr -> label != NULL) {
981 av.ptrvalue = ptr -> label;
982 retval = AsnWrite(aip, GENE_COMMENTARY_label, &av);
983 }
984 if (ptr -> text != NULL) {
985 av.ptrvalue = ptr -> text;
986 retval = AsnWrite(aip, GENE_COMMENTARY_text, &av);
987 }
988 if (ptr -> accession != NULL) {
989 av.ptrvalue = ptr -> accession;
990 retval = AsnWrite(aip, GENE_COMMENTARY_accession, &av);
991 }
992 av.intvalue = ptr -> version;
993 retval = AsnWrite(aip, GENE_COMMENTARY_version, &av);
994 AsnGenericUserSeqOfAsnWrite(ptr -> xtra_properties, (AsnWriteFunc) XtraTermsAsnWrite, aip, GENE_COMMENTARY_xtra_properties, COMMENTARY_xtra_properties_E);
995 AsnGenericChoiceSeqOfAsnWrite(ptr -> refs, (AsnWriteFunc) PubAsnWrite, aip, GENE_COMMENTARY_refs, GENE_COMMENTARY_refs_E);
996 AsnGenericUserSeqOfAsnWrite(ptr -> source, (AsnWriteFunc) OtherSourceAsnWrite, aip, GENE_COMMENTARY_source, GENE_COMMENTARY_source_E);
997 AsnGenericChoiceSeqOfAsnWrite(ptr -> genomic_coords, (AsnWriteFunc) SeqLocAsnWrite, aip, GENE_COMMENTARY_genomic_coords, COMMENTARY_genomic_coords_E);
998 AsnGenericChoiceSeqOfAsnWrite(ptr -> seqs, (AsnWriteFunc) SeqLocAsnWrite, aip, GENE_COMMENTARY_seqs, GENE_COMMENTARY_seqs_E);
999 AsnGenericUserSeqOfAsnWrite(ptr -> products, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, GENE_COMMENTARY_products, GENE_COMMENTARY_products_E);
1000 AsnGenericUserSeqOfAsnWrite(ptr -> properties, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, GENE_COMMENTARY_properties, GENE_COMMENTARY_properties_E);
1001 AsnGenericUserSeqOfAsnWrite(ptr -> comment, (AsnWriteFunc) GeneCommentaryAsnWrite, aip, GENE_COMMENTARY_comment, GENE_COMMENTARY_comment_E);
1002 if (ptr -> create_date != NULL) {
1003 if ( ! DateAsnWrite(ptr -> create_date, aip, GENE_COMMENTARY_create_date)) {
1004 goto erret;
1005 }
1006 }
1007 if (ptr -> update_date != NULL) {
1008 if ( ! DateAsnWrite(ptr -> update_date, aip, GENE_COMMENTARY_update_date)) {
1009 goto erret;
1010 }
1011 }
1012 if (ptr -> rna != NULL) {
1013 if ( ! RNARefAsnWrite(ptr -> rna, aip, GENE_COMMENTARY_rna)) {
1014 goto erret;
1015 }
1016 }
1017 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1018 goto erret;
1019 }
1020 retval = TRUE;
1021
1022 erret:
1023 AsnUnlinkType(orig); /* unlink local tree */
1024 return retval;
1025 }
1026
1027
1028
1029 /**************************************************
1030 *
1031 * MapsNew()
1032 *
1033 **************************************************/
1034 NLM_EXTERN
1035 MapsPtr LIBCALL
MapsNew(void)1036 MapsNew(void)
1037 {
1038 MapsPtr ptr = MemNew((size_t) sizeof(Maps));
1039
1040 return ptr;
1041
1042 }
1043
1044
1045 /**************************************************
1046 *
1047 * MapsFree()
1048 *
1049 **************************************************/
1050 NLM_EXTERN
1051 MapsPtr LIBCALL
MapsFree(MapsPtr ptr)1052 MapsFree(MapsPtr ptr)
1053 {
1054
1055 if(ptr == NULL) {
1056 return NULL;
1057 }
1058 MemFree(ptr -> display_str);
1059 Method_methodFree(ptr -> Method_method);
1060 return MemFree(ptr);
1061 }
1062
1063
1064 /**************************************************
1065 *
1066 * Method_methodFree()
1067 *
1068 **************************************************/
1069 static
1070 Method_methodPtr LIBCALL
Method_methodFree(ValNodePtr anp)1071 Method_methodFree(ValNodePtr anp)
1072 {
1073 Pointer pnt;
1074
1075 if (anp == NULL) {
1076 return NULL;
1077 }
1078
1079 pnt = anp->data.ptrvalue;
1080 switch (anp->choice)
1081 {
1082 default:
1083 break;
1084 case Method_method_proxy:
1085 MemFree(anp -> data.ptrvalue);
1086 break;
1087 }
1088 return MemFree(anp);
1089 }
1090
1091
1092 /**************************************************
1093 *
1094 * MapsAsnRead()
1095 *
1096 **************************************************/
1097 NLM_EXTERN
1098 MapsPtr LIBCALL
MapsAsnRead(AsnIoPtr aip,AsnTypePtr orig)1099 MapsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1100 {
1101 DataVal av;
1102 AsnTypePtr atp;
1103 Boolean isError = FALSE;
1104 AsnReadFunc func;
1105 MapsPtr ptr;
1106
1107 if (! loaded)
1108 {
1109 if (! objentgeneAsnLoad()) {
1110 return NULL;
1111 }
1112 }
1113
1114 if (aip == NULL) {
1115 return NULL;
1116 }
1117
1118 if (orig == NULL) { /* Maps ::= (self contained) */
1119 atp = AsnReadId(aip, amp, MAPS);
1120 } else {
1121 atp = AsnLinkType(orig, MAPS);
1122 }
1123 /* link in local tree */
1124 if (atp == NULL) {
1125 return NULL;
1126 }
1127
1128 ptr = MapsNew();
1129 if (ptr == NULL) {
1130 goto erret;
1131 }
1132 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1133 goto erret;
1134 }
1135
1136 atp = AsnReadId(aip,amp, atp);
1137 func = NULL;
1138
1139 if (atp == MAPS_display_str) {
1140 if ( AsnReadVal(aip, atp, &av) <= 0) {
1141 goto erret;
1142 }
1143 ptr -> display_str = av.ptrvalue;
1144 atp = AsnReadId(aip,amp, atp);
1145 }
1146 if (atp == MAPS_method) {
1147 ptr -> Method_method = Method_methodAsnRead(aip, atp);
1148 if (aip -> io_failure) {
1149 goto erret;
1150 }
1151 atp = AsnReadId(aip,amp, atp);
1152 }
1153
1154 if (AsnReadVal(aip, atp, &av) <= 0) {
1155 goto erret;
1156 }
1157 /* end struct */
1158
1159 ret:
1160 AsnUnlinkType(orig); /* unlink local tree */
1161 return ptr;
1162
1163 erret:
1164 aip -> io_failure = TRUE;
1165 ptr = MapsFree(ptr);
1166 goto ret;
1167 }
1168
1169
1170
1171 /**************************************************
1172 *
1173 * Method_methodAsnRead()
1174 *
1175 **************************************************/
1176 static
1177 Method_methodPtr LIBCALL
Method_methodAsnRead(AsnIoPtr aip,AsnTypePtr orig)1178 Method_methodAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1179 {
1180 DataVal av;
1181 AsnTypePtr atp;
1182 ValNodePtr anp;
1183 Uint1 choice;
1184 Boolean isError = FALSE;
1185 Boolean nullIsError = FALSE;
1186 AsnReadFunc func;
1187
1188 if (! loaded)
1189 {
1190 if (! objentgeneAsnLoad()) {
1191 return NULL;
1192 }
1193 }
1194
1195 if (aip == NULL) {
1196 return NULL;
1197 }
1198
1199 if (orig == NULL) { /* Method_method ::= (self contained) */
1200 atp = AsnReadId(aip, amp, MAPS_method);
1201 } else {
1202 atp = AsnLinkType(orig, MAPS_method); /* link in local tree */
1203 }
1204 if (atp == NULL) {
1205 return NULL;
1206 }
1207
1208 anp = ValNodeNew(NULL);
1209 if (anp == NULL) {
1210 goto erret;
1211 }
1212 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1213 goto erret;
1214 }
1215
1216 func = NULL;
1217
1218 atp = AsnReadId(aip, amp, atp); /* find the choice */
1219 if (atp == NULL) {
1220 goto erret;
1221 }
1222 if (atp == MAPS_method_proxy) {
1223 choice = Method_method_proxy;
1224 if (AsnReadVal(aip, atp, &av) <= 0) {
1225 goto erret;
1226 }
1227 anp->data.ptrvalue = av.ptrvalue;
1228 }
1229 else if (atp == MAPS_method_map_type) {
1230 choice = Method_method_map_type;
1231 if (AsnReadVal(aip, atp, &av) <= 0) {
1232 goto erret;
1233 }
1234 anp->data.intvalue = av.intvalue;
1235 }
1236 anp->choice = choice;
1237 if (func != NULL)
1238 {
1239 anp->data.ptrvalue = (* func)(aip, atp);
1240 if (aip -> io_failure) goto erret;
1241
1242 if (nullIsError && anp->data.ptrvalue == NULL) {
1243 goto erret;
1244 }
1245 }
1246
1247 ret:
1248 AsnUnlinkType(orig); /* unlink local tree */
1249 return anp;
1250
1251 erret:
1252 anp = MemFree(anp);
1253 aip -> io_failure = TRUE;
1254 goto ret;
1255 }
1256
1257
1258 /**************************************************
1259 *
1260 * MapsAsnWrite()
1261 *
1262 **************************************************/
1263 NLM_EXTERN Boolean LIBCALL
MapsAsnWrite(MapsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1264 MapsAsnWrite(MapsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1265 {
1266 DataVal av;
1267 AsnTypePtr atp;
1268 Boolean retval = FALSE;
1269
1270 if (! loaded)
1271 {
1272 if (! objentgeneAsnLoad()) {
1273 return FALSE;
1274 }
1275 }
1276
1277 if (aip == NULL) {
1278 return FALSE;
1279 }
1280
1281 atp = AsnLinkType(orig, MAPS); /* link local tree */
1282 if (atp == NULL) {
1283 return FALSE;
1284 }
1285
1286 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1287 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1288 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1289 goto erret;
1290 }
1291
1292 if (ptr -> display_str != NULL) {
1293 av.ptrvalue = ptr -> display_str;
1294 retval = AsnWrite(aip, MAPS_display_str, &av);
1295 }
1296 if (ptr -> Method_method != NULL) {
1297 if ( ! Method_methodAsnWrite(ptr -> Method_method, aip, MAPS_method)) {
1298 goto erret;
1299 }
1300 }
1301 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1302 goto erret;
1303 }
1304 retval = TRUE;
1305
1306 erret:
1307 AsnUnlinkType(orig); /* unlink local tree */
1308 return retval;
1309 }
1310
1311
1312
1313 /**************************************************
1314 *
1315 * Method_methodAsnWrite()
1316 *
1317 **************************************************/
1318 static Boolean LIBCALL
Method_methodAsnWrite(Method_methodPtr anp,AsnIoPtr aip,AsnTypePtr orig)1319 Method_methodAsnWrite(Method_methodPtr anp, AsnIoPtr aip, AsnTypePtr orig)
1320
1321 {
1322 DataVal av;
1323 AsnTypePtr atp, writetype = NULL;
1324 Pointer pnt;
1325 AsnWriteFunc func = NULL;
1326 Boolean retval = FALSE;
1327
1328 if (! loaded)
1329 {
1330 if (! objentgeneAsnLoad())
1331 return FALSE;
1332 }
1333
1334 if (aip == NULL)
1335 return FALSE;
1336
1337 atp = AsnLinkType(orig, MAPS_method); /* link local tree */
1338 if (atp == NULL) {
1339 return FALSE;
1340 }
1341
1342 if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1343 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1344 av.ptrvalue = (Pointer)anp;
1345 if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1346 goto erret;
1347 }
1348
1349 pnt = anp->data.ptrvalue;
1350 switch (anp->choice)
1351 {
1352 case Method_method_proxy:
1353 av.ptrvalue = anp->data.ptrvalue;
1354 retval = AsnWrite(aip, MAPS_method_proxy, &av);
1355 break;
1356 case Method_method_map_type:
1357 av.intvalue = anp->data.intvalue;
1358 retval = AsnWrite(aip, MAPS_method_map_type, &av);
1359 break;
1360 }
1361 if (writetype != NULL) {
1362 retval = (* func)(pnt, aip, writetype); /* write it out */
1363 }
1364 if (!retval) {
1365 goto erret;
1366 }
1367 retval = TRUE;
1368
1369 erret:
1370 AsnUnlinkType(orig); /* unlink local tree */
1371 return retval;
1372 }
1373
1374
1375 /**************************************************
1376 *
1377 * GeneSourceNew()
1378 *
1379 **************************************************/
1380 NLM_EXTERN
1381 GeneSourcePtr LIBCALL
GeneSourceNew(void)1382 GeneSourceNew(void)
1383 {
1384 GeneSourcePtr ptr = MemNew((size_t) sizeof(GeneSource));
1385
1386 ptr -> gene_display = 0;
1387 ptr -> locus_display = 0;
1388 ptr -> extra_terms = 0;
1389 return ptr;
1390
1391 }
1392
1393
1394 /**************************************************
1395 *
1396 * GeneSourceFree()
1397 *
1398 **************************************************/
1399 NLM_EXTERN
1400 GeneSourcePtr LIBCALL
GeneSourceFree(GeneSourcePtr ptr)1401 GeneSourceFree(GeneSourcePtr ptr)
1402 {
1403
1404 if(ptr == NULL) {
1405 return NULL;
1406 }
1407 MemFree(ptr -> src);
1408 MemFree(ptr -> src_str1);
1409 MemFree(ptr -> src_str2);
1410 return MemFree(ptr);
1411 }
1412
1413
1414 /**************************************************
1415 *
1416 * GeneSourceAsnRead()
1417 *
1418 **************************************************/
1419 NLM_EXTERN
1420 GeneSourcePtr LIBCALL
GeneSourceAsnRead(AsnIoPtr aip,AsnTypePtr orig)1421 GeneSourceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1422 {
1423 DataVal av;
1424 AsnTypePtr atp;
1425 Boolean isError = FALSE;
1426 AsnReadFunc func;
1427 GeneSourcePtr ptr;
1428
1429 if (! loaded)
1430 {
1431 if (! objentgeneAsnLoad()) {
1432 return NULL;
1433 }
1434 }
1435
1436 if (aip == NULL) {
1437 return NULL;
1438 }
1439
1440 if (orig == NULL) { /* GeneSource ::= (self contained) */
1441 atp = AsnReadId(aip, amp, GENE_SOURCE);
1442 } else {
1443 atp = AsnLinkType(orig, GENE_SOURCE);
1444 }
1445 /* link in local tree */
1446 if (atp == NULL) {
1447 return NULL;
1448 }
1449
1450 ptr = GeneSourceNew();
1451 if (ptr == NULL) {
1452 goto erret;
1453 }
1454 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1455 goto erret;
1456 }
1457
1458 atp = AsnReadId(aip,amp, atp);
1459 func = NULL;
1460
1461 if (atp == GENE_SOURCE_src) {
1462 if ( AsnReadVal(aip, atp, &av) <= 0) {
1463 goto erret;
1464 }
1465 ptr -> src = av.ptrvalue;
1466 atp = AsnReadId(aip,amp, atp);
1467 }
1468 if (atp == GENE_SOURCE_src_int) {
1469 if ( AsnReadVal(aip, atp, &av) <= 0) {
1470 goto erret;
1471 }
1472 ptr -> src_int = av.intvalue;
1473 atp = AsnReadId(aip,amp, atp);
1474 }
1475 if (atp == GENE_SOURCE_src_str1) {
1476 if ( AsnReadVal(aip, atp, &av) <= 0) {
1477 goto erret;
1478 }
1479 ptr -> src_str1 = av.ptrvalue;
1480 atp = AsnReadId(aip,amp, atp);
1481 }
1482 if (atp == GENE_SOURCE_src_str2) {
1483 if ( AsnReadVal(aip, atp, &av) <= 0) {
1484 goto erret;
1485 }
1486 ptr -> src_str2 = av.ptrvalue;
1487 atp = AsnReadId(aip,amp, atp);
1488 }
1489 if (atp == GENE_SOURCE_gene_display) {
1490 if ( AsnReadVal(aip, atp, &av) <= 0) {
1491 goto erret;
1492 }
1493 ptr -> gene_display = av.boolvalue;
1494 atp = AsnReadId(aip,amp, atp);
1495 }
1496 if (atp == GENE_SOURCE_locus_display) {
1497 if ( AsnReadVal(aip, atp, &av) <= 0) {
1498 goto erret;
1499 }
1500 ptr -> locus_display = av.boolvalue;
1501 atp = AsnReadId(aip,amp, atp);
1502 }
1503 if (atp == GENE_SOURCE_extra_terms) {
1504 if ( AsnReadVal(aip, atp, &av) <= 0) {
1505 goto erret;
1506 }
1507 ptr -> extra_terms = av.boolvalue;
1508 atp = AsnReadId(aip,amp, atp);
1509 }
1510
1511 if (AsnReadVal(aip, atp, &av) <= 0) {
1512 goto erret;
1513 }
1514 /* end struct */
1515
1516 ret:
1517 AsnUnlinkType(orig); /* unlink local tree */
1518 return ptr;
1519
1520 erret:
1521 aip -> io_failure = TRUE;
1522 ptr = GeneSourceFree(ptr);
1523 goto ret;
1524 }
1525
1526
1527
1528 /**************************************************
1529 *
1530 * GeneSourceAsnWrite()
1531 *
1532 **************************************************/
1533 NLM_EXTERN Boolean LIBCALL
GeneSourceAsnWrite(GeneSourcePtr ptr,AsnIoPtr aip,AsnTypePtr orig)1534 GeneSourceAsnWrite(GeneSourcePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1535 {
1536 DataVal av;
1537 AsnTypePtr atp;
1538 Boolean retval = FALSE;
1539
1540 if (! loaded)
1541 {
1542 if (! objentgeneAsnLoad()) {
1543 return FALSE;
1544 }
1545 }
1546
1547 if (aip == NULL) {
1548 return FALSE;
1549 }
1550
1551 atp = AsnLinkType(orig, GENE_SOURCE); /* link local tree */
1552 if (atp == NULL) {
1553 return FALSE;
1554 }
1555
1556 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1557 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1558 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1559 goto erret;
1560 }
1561
1562 if (ptr -> src != NULL) {
1563 av.ptrvalue = ptr -> src;
1564 retval = AsnWrite(aip, GENE_SOURCE_src, &av);
1565 }
1566 av.intvalue = ptr -> src_int;
1567 retval = AsnWrite(aip, GENE_SOURCE_src_int, &av);
1568 if (ptr -> src_str1 != NULL) {
1569 av.ptrvalue = ptr -> src_str1;
1570 retval = AsnWrite(aip, GENE_SOURCE_src_str1, &av);
1571 }
1572 if (ptr -> src_str2 != NULL) {
1573 av.ptrvalue = ptr -> src_str2;
1574 retval = AsnWrite(aip, GENE_SOURCE_src_str2, &av);
1575 }
1576 av.boolvalue = ptr -> gene_display;
1577 retval = AsnWrite(aip, GENE_SOURCE_gene_display, &av);
1578 av.boolvalue = ptr -> locus_display;
1579 retval = AsnWrite(aip, GENE_SOURCE_locus_display, &av);
1580 av.boolvalue = ptr -> extra_terms;
1581 retval = AsnWrite(aip, GENE_SOURCE_extra_terms, &av);
1582 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1583 goto erret;
1584 }
1585 retval = TRUE;
1586
1587 erret:
1588 AsnUnlinkType(orig); /* unlink local tree */
1589 return retval;
1590 }
1591
1592
1593
1594 /**************************************************
1595 *
1596 * XtraTermsNew()
1597 *
1598 **************************************************/
1599 NLM_EXTERN
1600 XtraTermsPtr LIBCALL
XtraTermsNew(void)1601 XtraTermsNew(void)
1602 {
1603 XtraTermsPtr ptr = MemNew((size_t) sizeof(XtraTerms));
1604
1605 return ptr;
1606
1607 }
1608
1609
1610 /**************************************************
1611 *
1612 * XtraTermsFree()
1613 *
1614 **************************************************/
1615 NLM_EXTERN
1616 XtraTermsPtr LIBCALL
XtraTermsFree(XtraTermsPtr ptr)1617 XtraTermsFree(XtraTermsPtr ptr)
1618 {
1619
1620 if(ptr == NULL) {
1621 return NULL;
1622 }
1623 MemFree(ptr -> tag);
1624 MemFree(ptr -> value);
1625 return MemFree(ptr);
1626 }
1627
1628
1629 /**************************************************
1630 *
1631 * XtraTermsAsnRead()
1632 *
1633 **************************************************/
1634 NLM_EXTERN
1635 XtraTermsPtr LIBCALL
XtraTermsAsnRead(AsnIoPtr aip,AsnTypePtr orig)1636 XtraTermsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1637 {
1638 DataVal av;
1639 AsnTypePtr atp;
1640 Boolean isError = FALSE;
1641 AsnReadFunc func;
1642 XtraTermsPtr ptr;
1643
1644 if (! loaded)
1645 {
1646 if (! objentgeneAsnLoad()) {
1647 return NULL;
1648 }
1649 }
1650
1651 if (aip == NULL) {
1652 return NULL;
1653 }
1654
1655 if (orig == NULL) { /* XtraTerms ::= (self contained) */
1656 atp = AsnReadId(aip, amp, XTRA_TERMS);
1657 } else {
1658 atp = AsnLinkType(orig, XTRA_TERMS);
1659 }
1660 /* link in local tree */
1661 if (atp == NULL) {
1662 return NULL;
1663 }
1664
1665 ptr = XtraTermsNew();
1666 if (ptr == NULL) {
1667 goto erret;
1668 }
1669 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1670 goto erret;
1671 }
1672
1673 atp = AsnReadId(aip,amp, atp);
1674 func = NULL;
1675
1676 if (atp == XTRA_TERMS_tag) {
1677 if ( AsnReadVal(aip, atp, &av) <= 0) {
1678 goto erret;
1679 }
1680 ptr -> tag = av.ptrvalue;
1681 atp = AsnReadId(aip,amp, atp);
1682 }
1683 if (atp == XTRA_TERMS_value) {
1684 if ( AsnReadVal(aip, atp, &av) <= 0) {
1685 goto erret;
1686 }
1687 ptr -> value = av.ptrvalue;
1688 atp = AsnReadId(aip,amp, atp);
1689 }
1690
1691 if (AsnReadVal(aip, atp, &av) <= 0) {
1692 goto erret;
1693 }
1694 /* end struct */
1695
1696 ret:
1697 AsnUnlinkType(orig); /* unlink local tree */
1698 return ptr;
1699
1700 erret:
1701 aip -> io_failure = TRUE;
1702 ptr = XtraTermsFree(ptr);
1703 goto ret;
1704 }
1705
1706
1707
1708 /**************************************************
1709 *
1710 * XtraTermsAsnWrite()
1711 *
1712 **************************************************/
1713 NLM_EXTERN Boolean LIBCALL
XtraTermsAsnWrite(XtraTermsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1714 XtraTermsAsnWrite(XtraTermsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1715 {
1716 DataVal av;
1717 AsnTypePtr atp;
1718 Boolean retval = FALSE;
1719
1720 if (! loaded)
1721 {
1722 if (! objentgeneAsnLoad()) {
1723 return FALSE;
1724 }
1725 }
1726
1727 if (aip == NULL) {
1728 return FALSE;
1729 }
1730
1731 atp = AsnLinkType(orig, XTRA_TERMS); /* link local tree */
1732 if (atp == NULL) {
1733 return FALSE;
1734 }
1735
1736 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1737 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1738 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1739 goto erret;
1740 }
1741
1742 if (ptr -> tag != NULL) {
1743 av.ptrvalue = ptr -> tag;
1744 retval = AsnWrite(aip, XTRA_TERMS_tag, &av);
1745 }
1746 if (ptr -> value != NULL) {
1747 av.ptrvalue = ptr -> value;
1748 retval = AsnWrite(aip, XTRA_TERMS_value, &av);
1749 }
1750 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1751 goto erret;
1752 }
1753 retval = TRUE;
1754
1755 erret:
1756 AsnUnlinkType(orig); /* unlink local tree */
1757 return retval;
1758 }
1759
1760
1761
1762 /**************************************************
1763 *
1764 * OtherSourceNew()
1765 *
1766 **************************************************/
1767 NLM_EXTERN
1768 OtherSourcePtr LIBCALL
OtherSourceNew(void)1769 OtherSourceNew(void)
1770 {
1771 OtherSourcePtr ptr = MemNew((size_t) sizeof(OtherSource));
1772
1773 return ptr;
1774
1775 }
1776
1777
1778 /**************************************************
1779 *
1780 * OtherSourceFree()
1781 *
1782 **************************************************/
1783 NLM_EXTERN
1784 OtherSourcePtr LIBCALL
OtherSourceFree(OtherSourcePtr ptr)1785 OtherSourceFree(OtherSourcePtr ptr)
1786 {
1787
1788 if(ptr == NULL) {
1789 return NULL;
1790 }
1791 DbtagFree(ptr -> src);
1792 MemFree(ptr -> pre_text);
1793 MemFree(ptr -> anchor);
1794 MemFree(ptr -> url);
1795 MemFree(ptr -> post_text);
1796 return MemFree(ptr);
1797 }
1798
1799
1800 /**************************************************
1801 *
1802 * OtherSourceAsnRead()
1803 *
1804 **************************************************/
1805 NLM_EXTERN
1806 OtherSourcePtr LIBCALL
OtherSourceAsnRead(AsnIoPtr aip,AsnTypePtr orig)1807 OtherSourceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1808 {
1809 DataVal av;
1810 AsnTypePtr atp;
1811 Boolean isError = FALSE;
1812 AsnReadFunc func;
1813 OtherSourcePtr ptr;
1814
1815 if (! loaded)
1816 {
1817 if (! objentgeneAsnLoad()) {
1818 return NULL;
1819 }
1820 }
1821
1822 if (aip == NULL) {
1823 return NULL;
1824 }
1825
1826 if (orig == NULL) { /* OtherSource ::= (self contained) */
1827 atp = AsnReadId(aip, amp, OTHER_SOURCE);
1828 } else {
1829 atp = AsnLinkType(orig, OTHER_SOURCE);
1830 }
1831 /* link in local tree */
1832 if (atp == NULL) {
1833 return NULL;
1834 }
1835
1836 ptr = OtherSourceNew();
1837 if (ptr == NULL) {
1838 goto erret;
1839 }
1840 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1841 goto erret;
1842 }
1843
1844 atp = AsnReadId(aip,amp, atp);
1845 func = NULL;
1846
1847 if (atp == OTHER_SOURCE_src) {
1848 ptr -> src = DbtagAsnRead(aip, atp);
1849 if (aip -> io_failure) {
1850 goto erret;
1851 }
1852 atp = AsnReadId(aip,amp, atp);
1853 }
1854 if (atp == OTHER_SOURCE_pre_text) {
1855 if ( AsnReadVal(aip, atp, &av) <= 0) {
1856 goto erret;
1857 }
1858 ptr -> pre_text = av.ptrvalue;
1859 atp = AsnReadId(aip,amp, atp);
1860 }
1861 if (atp == OTHER_SOURCE_anchor) {
1862 if ( AsnReadVal(aip, atp, &av) <= 0) {
1863 goto erret;
1864 }
1865 ptr -> anchor = av.ptrvalue;
1866 atp = AsnReadId(aip,amp, atp);
1867 }
1868 if (atp == OTHER_SOURCE_url) {
1869 if ( AsnReadVal(aip, atp, &av) <= 0) {
1870 goto erret;
1871 }
1872 ptr -> url = av.ptrvalue;
1873 atp = AsnReadId(aip,amp, atp);
1874 }
1875 if (atp == OTHER_SOURCE_post_text) {
1876 if ( AsnReadVal(aip, atp, &av) <= 0) {
1877 goto erret;
1878 }
1879 ptr -> post_text = av.ptrvalue;
1880 atp = AsnReadId(aip,amp, atp);
1881 }
1882
1883 if (AsnReadVal(aip, atp, &av) <= 0) {
1884 goto erret;
1885 }
1886 /* end struct */
1887
1888 ret:
1889 AsnUnlinkType(orig); /* unlink local tree */
1890 return ptr;
1891
1892 erret:
1893 aip -> io_failure = TRUE;
1894 ptr = OtherSourceFree(ptr);
1895 goto ret;
1896 }
1897
1898
1899
1900 /**************************************************
1901 *
1902 * OtherSourceAsnWrite()
1903 *
1904 **************************************************/
1905 NLM_EXTERN Boolean LIBCALL
OtherSourceAsnWrite(OtherSourcePtr ptr,AsnIoPtr aip,AsnTypePtr orig)1906 OtherSourceAsnWrite(OtherSourcePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1907 {
1908 DataVal av;
1909 AsnTypePtr atp;
1910 Boolean retval = FALSE;
1911
1912 if (! loaded)
1913 {
1914 if (! objentgeneAsnLoad()) {
1915 return FALSE;
1916 }
1917 }
1918
1919 if (aip == NULL) {
1920 return FALSE;
1921 }
1922
1923 atp = AsnLinkType(orig, OTHER_SOURCE); /* link local tree */
1924 if (atp == NULL) {
1925 return FALSE;
1926 }
1927
1928 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1929 MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1930 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1931 goto erret;
1932 }
1933
1934 if (ptr -> src != NULL) {
1935 if ( ! DbtagAsnWrite(ptr -> src, aip, OTHER_SOURCE_src)) {
1936 goto erret;
1937 }
1938 }
1939 if (ptr -> pre_text != NULL) {
1940 av.ptrvalue = ptr -> pre_text;
1941 retval = AsnWrite(aip, OTHER_SOURCE_pre_text, &av);
1942 }
1943 if (ptr -> anchor != NULL) {
1944 av.ptrvalue = ptr -> anchor;
1945 retval = AsnWrite(aip, OTHER_SOURCE_anchor, &av);
1946 }
1947 if (ptr -> url != NULL) {
1948 av.ptrvalue = ptr -> url;
1949 retval = AsnWrite(aip, OTHER_SOURCE_url, &av);
1950 }
1951 if (ptr -> post_text != NULL) {
1952 av.ptrvalue = ptr -> post_text;
1953 retval = AsnWrite(aip, OTHER_SOURCE_post_text, &av);
1954 }
1955 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1956 goto erret;
1957 }
1958 retval = TRUE;
1959
1960 erret:
1961 AsnUnlinkType(orig); /* unlink local tree */
1962 return retval;
1963 }
1964
1965