1 #include <asn.h>
2 
3 #define NLM_GENERATED_CODE_PROTO
4 
5 #include <mapproj.h>
6 #include <objproj.h>
7 
8 static Boolean loaded = FALSE;
9 
10 #include <asnproj.h>
11 
12 #ifndef NLM_EXTERN_LOADS
13 #define NLM_EXTERN_LOADS {}
14 #endif
15 
ProjectNewFunc(void)16 static Pointer LIBCALLBACK ProjectNewFunc (void)
17 {
18    return (Pointer) ProjectNew();
19 }
20 
ProjectFreeFunc(Pointer data)21 static Pointer LIBCALLBACK ProjectFreeFunc (Pointer data)
22 {
23    return (Pointer) ProjectFree ((ProjectPtr) data);
24 }
25 
ProjectAsnWriteFunc(Pointer data,AsnIoPtr aip,AsnTypePtr atp)26 static Boolean LIBCALLBACK ProjectAsnWriteFunc (Pointer data, AsnIoPtr aip, AsnTypePtr atp)
27 {
28    return ProjectAsnWrite ((ProjectPtr) data, aip, atp);
29 }
30 
ProjectAsnReadFunc(AsnIoPtr aip,AsnTypePtr atp)31 static Pointer LIBCALLBACK ProjectAsnReadFunc (AsnIoPtr aip, AsnTypePtr atp)
32 {
33    return (Pointer) ProjectAsnRead (aip, atp);
34 }
35 
ProjectLabelFunc(Pointer data,CharPtr buffer,Int2 buflen,Uint1 content)36 static Int2 LIBCALLBACK ProjectLabelFunc (Pointer data, CharPtr buffer, Int2 buflen, Uint1 content)
37 {
38    return ProjectLabel ((ProjectPtr) data, buffer, buflen, content);
39 }
40 
41 NLM_EXTERN Boolean LIBCALL
objprojAsnLoad(void)42 objprojAsnLoad(void)
43 {
44 
45    if ( ! loaded) {
46       NLM_EXTERN_LOADS
47 
48       if ( ! AsnLoad ())
49       return FALSE;
50       loaded = TRUE;
51    }
52 
53    ObjMgrTypeLoad (OBJ_PROJECT, "Project", "Project", "NCBI Project",
54    PROJECT, ProjectNewFunc, ProjectAsnReadFunc, ProjectAsnWriteFunc,
55    ProjectFreeFunc, ProjectLabelFunc, ProjectSubTypeFunc);
56 
57    return TRUE;
58 }
59 
60 
61 
62 /**************************************************
63 *    Generated object loaders for Module NCBI-Project
64 *    Generated using ASNCODE Revision: 6.1 at Mar 25, 1998  6:32 PM
65 *
66 **************************************************/
67 
68 
69 /**************************************************
70 *
71 *    ProjectNew()
72 *
73 **************************************************/
74 NLM_EXTERN
75 ProjectPtr LIBCALL
ProjectNew(void)76 ProjectNew(void)
77 {
78    ProjectPtr ptr = MemNew((size_t) sizeof(Project));
79 
80    return ptr;
81 
82 }
83 
84 
85 /**************************************************
86 *
87 *    ProjectFree()
88 *
89 **************************************************/
90 NLM_EXTERN
91 ProjectPtr LIBCALL
ProjectFree(ProjectPtr ptr)92 ProjectFree(ProjectPtr ptr)
93 {
94 
95    if(ptr == NULL) {
96       return NULL;
97    }
98    ProjectDescrFree(ptr -> descr);
99    ProjectItemFree(ptr -> data);
100    return MemFree(ptr);
101 }
102 
103 
104 /**************************************************
105 *
106 *    ProjectAsnRead()
107 *
108 **************************************************/
109 NLM_EXTERN
110 ProjectPtr LIBCALL
ProjectAsnRead(AsnIoPtr aip,AsnTypePtr orig)111 ProjectAsnRead(AsnIoPtr aip, AsnTypePtr orig)
112 {
113    DataVal av;
114    AsnTypePtr atp;
115    Boolean isError = FALSE;
116    AsnReadFunc func;
117    ProjectPtr ptr;
118 
119    if (! loaded)
120    {
121       if (! objprojAsnLoad()) {
122          return NULL;
123       }
124    }
125 
126    if (aip == NULL) {
127       return NULL;
128    }
129 
130    if (orig == NULL) {         /* Project ::= (self contained) */
131       atp = AsnReadId(aip, amp, PROJECT);
132    } else {
133       atp = AsnLinkType(orig, PROJECT);
134    }
135    /* link in local tree */
136    if (atp == NULL) {
137       return NULL;
138    }
139 
140    ptr = ProjectNew();
141    if (ptr == NULL) {
142       goto erret;
143    }
144    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
145       goto erret;
146    }
147 
148    atp = AsnReadId(aip,amp, atp);
149    func = NULL;
150 
151    if (atp == PROJECT_descr) {
152       ptr -> descr = ProjectDescrAsnRead(aip, atp);
153       if (aip -> io_failure) {
154          goto erret;
155       }
156       atp = AsnReadId(aip,amp, atp);
157    }
158    if (atp == PROJECT_data) {
159       ptr -> data = ProjectItemAsnRead(aip, atp);
160       if (aip -> io_failure) {
161          goto erret;
162       }
163       atp = AsnReadId(aip,amp, atp);
164    }
165 
166    if (AsnReadVal(aip, atp, &av) <= 0) {
167       goto erret;
168    }
169    /* end struct */
170 
171 ret:
172    AsnUnlinkType(orig);       /* unlink local tree */
173    return ptr;
174 
175 erret:
176    aip -> io_failure = TRUE;
177    ptr = ProjectFree(ptr);
178    goto ret;
179 }
180 
181 
182 
183 /**************************************************
184 *
185 *    ProjectAsnWrite()
186 *
187 **************************************************/
188 NLM_EXTERN Boolean LIBCALL
ProjectAsnWrite(ProjectPtr ptr,AsnIoPtr aip,AsnTypePtr orig)189 ProjectAsnWrite(ProjectPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
190 {
191    AsnTypePtr atp;
192    Boolean retval = FALSE;
193 
194    if (! loaded)
195    {
196       if (! objprojAsnLoad()) {
197          return FALSE;
198       }
199    }
200 
201    if (aip == NULL) {
202       return FALSE;
203    }
204 
205    atp = AsnLinkType(orig, PROJECT);   /* link local tree */
206    if (atp == NULL) {
207       return FALSE;
208    }
209 
210    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
211    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
212       goto erret;
213    }
214 
215    if (ptr -> descr != NULL) {
216       if ( ! ProjectDescrAsnWrite(ptr -> descr, aip, PROJECT_descr)) {
217          goto erret;
218       }
219    }
220    if (ptr -> data != NULL) {
221       if ( ! ProjectItemAsnWrite(ptr -> data, aip, PROJECT_data)) {
222          goto erret;
223       }
224    }
225    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
226       goto erret;
227    }
228    retval = TRUE;
229 
230 erret:
231    AsnUnlinkType(orig);       /* unlink local tree */
232    return retval;
233 }
234 
235 
236 
237 /**************************************************
238 *
239 *    ProjectItemFree()
240 *
241 **************************************************/
242 NLM_EXTERN
243 ProjectItemPtr LIBCALL
ProjectItemFree(ValNodePtr anp)244 ProjectItemFree(ValNodePtr anp)
245 {
246    Pointer pnt;
247 
248    if (anp == NULL) {
249       return NULL;
250    }
251 
252    pnt = anp->data.ptrvalue;
253    switch (anp->choice)
254    {
255    default:
256       break;
257    case ProjectItem_pmuid:
258       AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
259       break;
260    case ProjectItem_protuid:
261       AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
262       break;
263    case ProjectItem_nucuid:
264       AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
265       break;
266    case ProjectItem_sequid:
267       AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
268       break;
269    case ProjectItem_genomeuid:
270       AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
271       break;
272    case ProjectItem_structuid:
273       AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
274       break;
275    case ProjectItem_pmid:
276       AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
277       break;
278    case ProjectItem_protid:
279       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
280       break;
281    case ProjectItem_nucid:
282       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
283       break;
284    case ProjectItem_seqid:
285       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
286       break;
287    case ProjectItem_genomeid:
288       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
289       break;
290    case ProjectItem_pment:
291       AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) PubmedEntryFree);
292       break;
293    case ProjectItem_protent:
294       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
295       break;
296    case ProjectItem_nucent:
297       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
298       break;
299    case ProjectItem_seqent:
300       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
301       break;
302    case ProjectItem_genomeent:
303       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
304       break;
305    case ProjectItem_seqannot:
306       AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqAnnotFree);
307       break;
308    case ProjectItem_loc:
309       AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqLocFree);
310       break;
311    case ProjectItem_proj:
312       AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) ProjectFree);
313       break;
314    }
315    return MemFree(anp);
316 }
317 
318 
319 /**************************************************
320 *
321 *    ProjectItemAsnRead()
322 *
323 **************************************************/
324 NLM_EXTERN
325 ProjectItemPtr LIBCALL
ProjectItemAsnRead(AsnIoPtr aip,AsnTypePtr orig)326 ProjectItemAsnRead(AsnIoPtr aip, AsnTypePtr orig)
327 {
328    DataVal av;
329    AsnTypePtr atp;
330    ValNodePtr anp;
331    Uint1 choice;
332    Boolean isError = FALSE;
333    Boolean nullIsError = FALSE;
334    AsnReadFunc func;
335 
336    if (! loaded)
337    {
338       if (! objprojAsnLoad()) {
339          return NULL;
340       }
341    }
342 
343    if (aip == NULL) {
344       return NULL;
345    }
346 
347    if (orig == NULL) {         /* ProjectItem ::= (self contained) */
348       atp = AsnReadId(aip, amp, PROJECT_ITEM);
349    } else {
350       atp = AsnLinkType(orig, PROJECT_ITEM);    /* link in local tree */
351    }
352    if (atp == NULL) {
353       return NULL;
354    }
355 
356    anp = ValNodeNew(NULL);
357    if (anp == NULL) {
358       goto erret;
359    }
360    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
361       goto erret;
362    }
363 
364    func = NULL;
365 
366    atp = AsnReadId(aip, amp, atp);  /* find the choice */
367    if (atp == NULL) {
368       goto erret;
369    }
370    if (atp == PROJECT_ITEM_pmuid) {
371       choice = ProjectItem_pmuid;
372       anp -> data.ptrvalue =
373       AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
374       if (isError && anp -> data.ptrvalue == NULL) {
375          goto erret;
376       }
377    }
378    else if (atp == PROJECT_ITEM_protuid) {
379       choice = ProjectItem_protuid;
380       anp -> data.ptrvalue =
381       AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
382       if (isError && anp -> data.ptrvalue == NULL) {
383          goto erret;
384       }
385    }
386    else if (atp == PROJECT_ITEM_nucuid) {
387       choice = ProjectItem_nucuid;
388       anp -> data.ptrvalue =
389       AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
390       if (isError && anp -> data.ptrvalue == NULL) {
391          goto erret;
392       }
393    }
394    else if (atp == PROJECT_ITEM_sequid) {
395       choice = ProjectItem_sequid;
396       anp -> data.ptrvalue =
397       AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
398       if (isError && anp -> data.ptrvalue == NULL) {
399          goto erret;
400       }
401    }
402    else if (atp == PROJECT_ITEM_genomeuid) {
403       choice = ProjectItem_genomeuid;
404       anp -> data.ptrvalue =
405       AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
406       if (isError && anp -> data.ptrvalue == NULL) {
407          goto erret;
408       }
409    }
410    else if (atp == PROJECT_ITEM_structuid) {
411       choice = ProjectItem_structuid;
412       anp -> data.ptrvalue =
413       AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
414       if (isError && anp -> data.ptrvalue == NULL) {
415          goto erret;
416       }
417    }
418    else if (atp == PROJECT_ITEM_pmid) {
419       choice = ProjectItem_pmid;
420       anp -> data.ptrvalue =
421       AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
422       if (isError && anp -> data.ptrvalue == NULL) {
423          goto erret;
424       }
425    }
426    else if (atp == PROJECT_ITEM_protid) {
427       choice = ProjectItem_protid;
428       anp -> data.ptrvalue =
429       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead,             (AsnOptFreeFunc) SeqIdFree);
430       if (isError && anp -> data.ptrvalue == NULL) {
431          goto erret;
432       }
433    }
434    else if (atp == PROJECT_ITEM_nucid) {
435       choice = ProjectItem_nucid;
436       anp -> data.ptrvalue =
437       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead,             (AsnOptFreeFunc) SeqIdFree);
438       if (isError && anp -> data.ptrvalue == NULL) {
439          goto erret;
440       }
441    }
442    else if (atp == PROJECT_ITEM_seqid) {
443       choice = ProjectItem_seqid;
444       anp -> data.ptrvalue =
445       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead,             (AsnOptFreeFunc) SeqIdFree);
446       if (isError && anp -> data.ptrvalue == NULL) {
447          goto erret;
448       }
449    }
450    else if (atp == PROJECT_ITEM_genomeid) {
451       choice = ProjectItem_genomeid;
452       anp -> data.ptrvalue =
453       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead,             (AsnOptFreeFunc) SeqIdFree);
454       if (isError && anp -> data.ptrvalue == NULL) {
455          goto erret;
456       }
457    }
458    else if (atp == PROJECT_ITEM_structid) {
459       choice = ProjectItem_structid;
460       if (AsnReadVal(aip, atp, &av) <= 0) {
461          goto erret;
462       }
463       anp->data.boolvalue = av.boolvalue;
464    }
465    else if (atp == PROJECT_ITEM_pment) {
466       choice = ProjectItem_pment;
467       anp -> data.ptrvalue =
468       AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) PubmedEntryAsnRead,             (AsnOptFreeFunc) PubmedEntryFree);
469       if (isError && anp -> data.ptrvalue == NULL) {
470          goto erret;
471       }
472    }
473    else if (atp == PROJECT_ITEM_protent) {
474       choice = ProjectItem_protent;
475       anp -> data.ptrvalue =
476       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead,             (AsnOptFreeFunc) SeqEntryFree);
477       if (isError && anp -> data.ptrvalue == NULL) {
478          goto erret;
479       }
480    }
481    else if (atp == PROJECT_ITEM_nucent) {
482       choice = ProjectItem_nucent;
483       anp -> data.ptrvalue =
484       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead,             (AsnOptFreeFunc) SeqEntryFree);
485       if (isError && anp -> data.ptrvalue == NULL) {
486          goto erret;
487       }
488    }
489    else if (atp == PROJECT_ITEM_seqent) {
490       choice = ProjectItem_seqent;
491       anp -> data.ptrvalue =
492       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead,             (AsnOptFreeFunc) SeqEntryFree);
493       if (isError && anp -> data.ptrvalue == NULL) {
494          goto erret;
495       }
496    }
497    else if (atp == PROJECT_ITEM_genomeent) {
498       choice = ProjectItem_genomeent;
499       anp -> data.ptrvalue =
500       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead,             (AsnOptFreeFunc) SeqEntryFree);
501       if (isError && anp -> data.ptrvalue == NULL) {
502          goto erret;
503       }
504    }
505    else if (atp == PROJECT_ITEM_structent) {
506       choice = ProjectItem_structent;
507       if (AsnReadVal(aip, atp, &av) <= 0) {
508          goto erret;
509       }
510       anp->data.boolvalue = av.boolvalue;
511    }
512    else if (atp == PROJECT_ITEM_seqannot) {
513       choice = ProjectItem_seqannot;
514       anp -> data.ptrvalue =
515       AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqAnnotAsnRead,             (AsnOptFreeFunc) SeqAnnotFree);
516       if (isError && anp -> data.ptrvalue == NULL) {
517          goto erret;
518       }
519    }
520    else if (atp == PROJECT_ITEM_loc) {
521       choice = ProjectItem_loc;
522       anp -> data.ptrvalue =
523       AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead,             (AsnOptFreeFunc) SeqLocFree);
524       if (isError && anp -> data.ptrvalue == NULL) {
525          goto erret;
526       }
527    }
528    else if (atp == PROJECT_ITEM_proj) {
529       choice = ProjectItem_proj;
530       anp -> data.ptrvalue =
531       AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ProjectAsnRead,             (AsnOptFreeFunc) ProjectFree);
532       if (isError && anp -> data.ptrvalue == NULL) {
533          goto erret;
534       }
535    }
536    anp->choice = choice;
537    if (func != NULL)
538    {
539       anp->data.ptrvalue = (* func)(aip, atp);
540       if (aip -> io_failure) goto erret;
541 
542       if (nullIsError && anp->data.ptrvalue == NULL) {
543          goto erret;
544       }
545    }
546 
547 ret:
548    AsnUnlinkType(orig);       /* unlink local tree */
549    return anp;
550 
551 erret:
552    anp = MemFree(anp);
553    aip -> io_failure = TRUE;
554    goto ret;
555 }
556 
557 
558 /**************************************************
559 *
560 *    ProjectItemAsnWrite()
561 *
562 **************************************************/
563 NLM_EXTERN Boolean LIBCALL
ProjectItemAsnWrite(ProjectItemPtr anp,AsnIoPtr aip,AsnTypePtr orig)564 ProjectItemAsnWrite(ProjectItemPtr anp, AsnIoPtr aip, AsnTypePtr orig)
565 
566 {
567    DataVal av;
568    AsnTypePtr atp, writetype = NULL;
569    Pointer pnt;
570    AsnWriteFunc func = NULL;
571    Boolean retval = FALSE;
572 
573    if (! loaded)
574    {
575       if (! objprojAsnLoad())
576       return FALSE;
577    }
578 
579    if (aip == NULL)
580    return FALSE;
581 
582    atp = AsnLinkType(orig, PROJECT_ITEM);   /* link local tree */
583    if (atp == NULL) {
584       return FALSE;
585    }
586 
587    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
588 
589     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
590 
591    av.ptrvalue = (Pointer)anp;
592    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
593       goto erret;
594    }
595 
596    pnt = anp->data.ptrvalue;
597    switch (anp->choice)
598    {
599    case ProjectItem_pmuid:
600       retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_pmuid, PROJECT_ITEM_pmuid_E);            break;
601    case ProjectItem_protuid:
602       retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_protuid, PROJECT_ITEM_protuid_E);            break;
603    case ProjectItem_nucuid:
604       retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_nucuid, PROJECT_ITEM_nucuid_E);            break;
605    case ProjectItem_sequid:
606       retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_sequid, PROJECT_ITEM_sequid_E);            break;
607    case ProjectItem_genomeuid:
608       retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_genomeuid, PROJECT_ITEM_genomeuid_E);            break;
609    case ProjectItem_structuid:
610       retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_structuid, PROJECT_ITEM_structuid_E);            break;
611    case ProjectItem_pmid:
612       retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_pmid, PROJECT_ITEM_pmid_E);            break;
613    case ProjectItem_protid:
614       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_protid, PROJECT_ITEM_protid_E);
615       break;
616    case ProjectItem_nucid:
617       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_nucid, PROJECT_ITEM_nucid_E);
618       break;
619    case ProjectItem_seqid:
620       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_seqid, PROJECT_ITEM_seqid_E);
621       break;
622    case ProjectItem_genomeid:
623       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_genomeid, PROJECT_ITEM_genomeid_E);
624       break;
625    case ProjectItem_structid:
626       av.boolvalue = anp->data.boolvalue;
627       retval = AsnWrite(aip, PROJECT_ITEM_structid, &av);
628       break;
629    case ProjectItem_pment:
630       retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) PubmedEntryAsnWrite, aip, PROJECT_ITEM_pment, PROJECT_ITEM_pment_E);
631       break;
632    case ProjectItem_protent:
633       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_protent, PROJECT_ITEM_protent_E);
634       break;
635    case ProjectItem_nucent:
636       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_nucent, PROJECT_ITEM_nucent_E);
637       break;
638    case ProjectItem_seqent:
639       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_seqent, PROJECT_ITEM_seqent_E);
640       break;
641    case ProjectItem_genomeent:
642       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_genomeent, PROJECT_ITEM_genomeent_E);
643       break;
644    case ProjectItem_structent:
645       av.boolvalue = anp->data.boolvalue;
646       retval = AsnWrite(aip, PROJECT_ITEM_structent, &av);
647       break;
648    case ProjectItem_seqannot:
649       retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqAnnotAsnWrite, aip, PROJECT_ITEM_seqannot, PROJECT_ITEM_seqannot_E);
650       break;
651    case ProjectItem_loc:
652       retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqLocAsnWrite, aip, PROJECT_ITEM_loc, PROJECT_ITEM_loc_E);
653       break;
654    case ProjectItem_proj:
655       retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) ProjectAsnWrite, aip, PROJECT_ITEM_proj, PROJECT_ITEM_proj_E);
656       break;
657    }
658    if (writetype != NULL) {
659       retval = (* func)(pnt, aip, writetype);   /* write it out */
660    }
661    if (!retval) {
662       goto erret;
663    }
664    retval = TRUE;
665 
666 erret:
667    AsnUnlinkType(orig);       /* unlink local tree */
668    return retval;
669 }
670 
671 
672 /**************************************************
673 *
674 *    ProjectDescrNew()
675 *
676 **************************************************/
677 NLM_EXTERN
678 ProjectDescrPtr LIBCALL
ProjectDescrNew(void)679 ProjectDescrNew(void)
680 {
681    ProjectDescrPtr ptr = MemNew((size_t) sizeof(ProjectDescr));
682 
683    return ptr;
684 
685 }
686 
687 
688 /**************************************************
689 *
690 *    ProjectDescrFree()
691 *
692 **************************************************/
693 NLM_EXTERN
694 ProjectDescrPtr LIBCALL
ProjectDescrFree(ProjectDescrPtr ptr)695 ProjectDescrFree(ProjectDescrPtr ptr)
696 {
697 
698    if(ptr == NULL) {
699       return NULL;
700    }
701    AsnGenericBaseSeqOfFree(ptr -> id ,ASNCODE_PTRVAL_SLOT);
702    MemFree(ptr -> name);
703    AsnGenericChoiceSeqOfFree(ptr -> descr, (AsnOptFreeFunc) ProjdescFree);
704    return MemFree(ptr);
705 }
706 
707 
708 /**************************************************
709 *
710 *    ProjectDescrAsnRead()
711 *
712 **************************************************/
713 NLM_EXTERN
714 ProjectDescrPtr LIBCALL
ProjectDescrAsnRead(AsnIoPtr aip,AsnTypePtr orig)715 ProjectDescrAsnRead(AsnIoPtr aip, AsnTypePtr orig)
716 {
717    DataVal av;
718    AsnTypePtr atp;
719    Boolean isError = FALSE;
720    AsnReadFunc func;
721    ProjectDescrPtr ptr;
722 
723    if (! loaded)
724    {
725       if (! objprojAsnLoad()) {
726          return NULL;
727       }
728    }
729 
730    if (aip == NULL) {
731       return NULL;
732    }
733 
734    if (orig == NULL) {         /* ProjectDescr ::= (self contained) */
735       atp = AsnReadId(aip, amp, PROJECT_DESCR);
736    } else {
737       atp = AsnLinkType(orig, PROJECT_DESCR);
738    }
739    /* link in local tree */
740    if (atp == NULL) {
741       return NULL;
742    }
743 
744    ptr = ProjectDescrNew();
745    if (ptr == NULL) {
746       goto erret;
747    }
748    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
749       goto erret;
750    }
751 
752    atp = AsnReadId(aip,amp, atp);
753    func = NULL;
754 
755    if (atp == PROJECT_DESCR_id) {
756       ptr -> id = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
757       if (isError && ptr -> id == NULL) {
758          goto erret;
759       }
760       atp = AsnReadId(aip,amp, atp);
761    }
762    if (atp == PROJECT_DESCR_name) {
763       if ( AsnReadVal(aip, atp, &av) <= 0) {
764          goto erret;
765       }
766       ptr -> name = av.ptrvalue;
767       atp = AsnReadId(aip,amp, atp);
768    }
769    if (atp == PROJECT_DESCR_descr) {
770       ptr -> descr = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ProjdescAsnRead, (AsnOptFreeFunc) ProjdescFree);
771       if (isError && ptr -> descr == NULL) {
772          goto erret;
773       }
774       atp = AsnReadId(aip,amp, atp);
775    }
776 
777    if (AsnReadVal(aip, atp, &av) <= 0) {
778       goto erret;
779    }
780    /* end struct */
781 
782 ret:
783    AsnUnlinkType(orig);       /* unlink local tree */
784    return ptr;
785 
786 erret:
787    aip -> io_failure = TRUE;
788    ptr = ProjectDescrFree(ptr);
789    goto ret;
790 }
791 
792 
793 
794 /**************************************************
795 *
796 *    ProjectDescrAsnWrite()
797 *
798 **************************************************/
799 NLM_EXTERN Boolean LIBCALL
ProjectDescrAsnWrite(ProjectDescrPtr ptr,AsnIoPtr aip,AsnTypePtr orig)800 ProjectDescrAsnWrite(ProjectDescrPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
801 {
802    DataVal av;
803    AsnTypePtr atp;
804    Boolean retval = FALSE;
805 
806    if (! loaded)
807    {
808       if (! objprojAsnLoad()) {
809          return FALSE;
810       }
811    }
812 
813    if (aip == NULL) {
814       return FALSE;
815    }
816 
817    atp = AsnLinkType(orig, PROJECT_DESCR);   /* link local tree */
818    if (atp == NULL) {
819       return FALSE;
820    }
821 
822    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
823 
824     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
825 
826    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
827       goto erret;
828    }
829 
830    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> id ,ASNCODE_PTRVAL_SLOT, aip, PROJECT_DESCR_id, PROJECT_DESCR_id_E);
831    if (ptr -> name != NULL) {
832       av.ptrvalue = ptr -> name;
833       retval = AsnWrite(aip, PROJECT_DESCR_name,  &av);
834    }
835    AsnGenericChoiceSeqOfAsnWrite(ptr -> descr, (AsnWriteFunc) ProjdescAsnWrite, aip, PROJECT_DESCR_descr, PROJECT_DESCR_descr_E);
836    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
837       goto erret;
838    }
839    retval = TRUE;
840 
841 erret:
842    AsnUnlinkType(orig);       /* unlink local tree */
843    return retval;
844 }
845 
846 
847 
848 /**************************************************
849 *
850 *    ProjdescFree()
851 *
852 **************************************************/
853 NLM_EXTERN
854 ProjdescPtr LIBCALL
ProjdescFree(ValNodePtr anp)855 ProjdescFree(ValNodePtr anp)
856 {
857    Pointer pnt;
858 
859    if (anp == NULL) {
860       return NULL;
861    }
862 
863    pnt = anp->data.ptrvalue;
864    switch (anp->choice)
865    {
866    default:
867       break;
868    case Projdesc_pub:
869       PubdescFree(anp -> data.ptrvalue);
870       break;
871    case Projdesc_date:
872       DateFree(anp -> data.ptrvalue);
873       break;
874    case Projdesc_comment:
875       MemFree(anp -> data.ptrvalue);
876       break;
877    case Projdesc_title:
878       MemFree(anp -> data.ptrvalue);
879       break;
880    }
881    return MemFree(anp);
882 }
883 
884 
885 /**************************************************
886 *
887 *    ProjdescAsnRead()
888 *
889 **************************************************/
890 NLM_EXTERN
891 ProjdescPtr LIBCALL
ProjdescAsnRead(AsnIoPtr aip,AsnTypePtr orig)892 ProjdescAsnRead(AsnIoPtr aip, AsnTypePtr orig)
893 {
894    DataVal av;
895    AsnTypePtr atp;
896    ValNodePtr anp;
897    Uint1 choice;
898    Boolean isError = FALSE;
899    Boolean nullIsError = FALSE;
900    AsnReadFunc func;
901 
902    if (! loaded)
903    {
904       if (! objprojAsnLoad()) {
905          return NULL;
906       }
907    }
908 
909    if (aip == NULL) {
910       return NULL;
911    }
912 
913    if (orig == NULL) {         /* Projdesc ::= (self contained) */
914       atp = AsnReadId(aip, amp, PROJDESC);
915    } else {
916       atp = AsnLinkType(orig, PROJDESC);    /* link in local tree */
917    }
918    if (atp == NULL) {
919       return NULL;
920    }
921 
922    anp = ValNodeNew(NULL);
923    if (anp == NULL) {
924       goto erret;
925    }
926    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
927       goto erret;
928    }
929 
930    func = NULL;
931 
932    atp = AsnReadId(aip, amp, atp);  /* find the choice */
933    if (atp == NULL) {
934       goto erret;
935    }
936    if (atp == PROJDESC_pub) {
937       choice = Projdesc_pub;
938       func = (AsnReadFunc) PubdescAsnRead;
939    }
940    else if (atp == PROJDESC_date) {
941       choice = Projdesc_date;
942       func = (AsnReadFunc) DateAsnRead;
943    }
944    else if (atp == PROJDESC_comment) {
945       choice = Projdesc_comment;
946       if (AsnReadVal(aip, atp, &av) <= 0) {
947          goto erret;
948       }
949       anp->data.ptrvalue = av.ptrvalue;
950    }
951    else if (atp == PROJDESC_title) {
952       choice = Projdesc_title;
953       if (AsnReadVal(aip, atp, &av) <= 0) {
954          goto erret;
955       }
956       anp->data.ptrvalue = av.ptrvalue;
957    }
958    anp->choice = choice;
959    if (func != NULL)
960    {
961       anp->data.ptrvalue = (* func)(aip, atp);
962       if (aip -> io_failure) goto erret;
963 
964       if (nullIsError && anp->data.ptrvalue == NULL) {
965          goto erret;
966       }
967    }
968 
969 ret:
970    AsnUnlinkType(orig);       /* unlink local tree */
971    return anp;
972 
973 erret:
974    anp = MemFree(anp);
975    aip -> io_failure = TRUE;
976    goto ret;
977 }
978 
979 
980 /**************************************************
981 *
982 *    ProjdescAsnWrite()
983 *
984 **************************************************/
985 NLM_EXTERN Boolean LIBCALL
ProjdescAsnWrite(ProjdescPtr anp,AsnIoPtr aip,AsnTypePtr orig)986 ProjdescAsnWrite(ProjdescPtr anp, AsnIoPtr aip, AsnTypePtr orig)
987 
988 {
989    DataVal av;
990    AsnTypePtr atp, writetype = NULL;
991    Pointer pnt;
992    AsnWriteFunc func = NULL;
993    Boolean retval = FALSE;
994 
995    if (! loaded)
996    {
997       if (! objprojAsnLoad())
998       return FALSE;
999    }
1000 
1001    if (aip == NULL)
1002    return FALSE;
1003 
1004    atp = AsnLinkType(orig, PROJDESC);   /* link local tree */
1005    if (atp == NULL) {
1006       return FALSE;
1007    }
1008 
1009    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1010 
1011     MemSet ((Pointer) (&av), 0, sizeof (DataVal));
1012 
1013    av.ptrvalue = (Pointer)anp;
1014    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1015       goto erret;
1016    }
1017 
1018    pnt = anp->data.ptrvalue;
1019    switch (anp->choice)
1020    {
1021    case Projdesc_pub:
1022       writetype = PROJDESC_pub;
1023       func = (AsnWriteFunc) PubdescAsnWrite;
1024       break;
1025    case Projdesc_date:
1026       writetype = PROJDESC_date;
1027       func = (AsnWriteFunc) DateAsnWrite;
1028       break;
1029    case Projdesc_comment:
1030       av.ptrvalue = anp->data.ptrvalue;
1031       retval = AsnWrite(aip, PROJDESC_comment, &av);
1032       break;
1033    case Projdesc_title:
1034       av.ptrvalue = anp->data.ptrvalue;
1035       retval = AsnWrite(aip, PROJDESC_title, &av);
1036       break;
1037    }
1038    if (writetype != NULL) {
1039       retval = (* func)(pnt, aip, writetype);   /* write it out */
1040    }
1041    if (!retval) {
1042       goto erret;
1043    }
1044    retval = TRUE;
1045 
1046 erret:
1047    AsnUnlinkType(orig);       /* unlink local tree */
1048    return retval;
1049 }
1050