1 #include <asn.h>
2 
3 #define NLM_GENERATED_CODE_PROTO
4 
5 #include <fdlKludge.h>
6 #include <fdlobj.h>
7 
8 static Boolean loaded = FALSE;
9 
10 #include <fastadl.h>
11 
12 #ifndef NLM_EXTERN_LOADS
13 #define NLM_EXTERN_LOADS {}
14 #endif
15 
16 NLM_EXTERN Boolean LIBCALL
fdlobjAsnLoad(void)17 fdlobjAsnLoad(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-BlastDL
35 *    Generated using ASNCODE Revision: 6.12 at Nov 2, 2001  5:01 PM
36 *
37 **************************************************/
38 
39 
40 /**************************************************
41 *
42 *    BlastDefLineSetFree()
43 *
44 **************************************************/
45 NLM_EXTERN
46 BlastDefLineSetPtr LIBCALL
BlastDefLineSetFree(BlastDefLineSetPtr ptr)47 BlastDefLineSetFree(BlastDefLineSetPtr ptr)
48 {
49 
50    if(ptr == NULL) {
51       return NULL;
52    }
53    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) BlastDefLineFree);
54    return NULL;
55 }
56 
57 
58 /**************************************************
59 *
60 *    BlastDefLineSetAsnRead()
61 *
62 **************************************************/
63 NLM_EXTERN
64 BlastDefLineSetPtr LIBCALL
BlastDefLineSetAsnRead(AsnIoPtr aip,AsnTypePtr orig)65 BlastDefLineSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
66 {
67    AsnTypePtr atp;
68    Boolean isError = FALSE;
69    AsnReadFunc func;
70    BlastDefLineSetPtr ptr;
71 
72    if (! loaded)
73    {
74       if (! fdlobjAsnLoad()) {
75          return NULL;
76       }
77    }
78 
79    if (aip == NULL) {
80       return NULL;
81    }
82 
83    if (orig == NULL) {         /* BlastDefLineSet ::= (self contained) */
84       atp = AsnReadId(aip, amp, BLAST_DEF_LINE_SET);
85    } else {
86       atp = AsnLinkType(orig, BLAST_DEF_LINE_SET);
87    }
88    /* link in local tree */
89    if (atp == NULL) {
90       return NULL;
91    }
92 
93    func = NULL;
94 
95    ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BlastDefLineAsnRead, (AsnOptFreeFunc) BlastDefLineFree);
96    if (isError && ptr  == NULL) {
97       goto erret;
98    }
99 
100 
101 
102 ret:
103    AsnUnlinkType(orig);       /* unlink local tree */
104    return ptr;
105 
106 erret:
107    aip -> io_failure = TRUE;
108    ptr = BlastDefLineSetFree(ptr);
109    goto ret;
110 }
111 
112 
113 
114 /**************************************************
115 *
116 *    BlastDefLineSetAsnWrite()
117 *
118 **************************************************/
119 NLM_EXTERN Boolean LIBCALL
BlastDefLineSetAsnWrite(BlastDefLineSetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)120 BlastDefLineSetAsnWrite(BlastDefLineSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
121 {
122    AsnTypePtr atp;
123    Boolean retval = FALSE;
124 
125    if (! loaded)
126    {
127       if (! fdlobjAsnLoad()) {
128          return FALSE;
129       }
130    }
131 
132    if (aip == NULL) {
133       return FALSE;
134    }
135 
136    atp = AsnLinkType(orig, BLAST_DEF_LINE_SET);   /* link local tree */
137    if (atp == NULL) {
138       return FALSE;
139    }
140 
141    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
142    retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) BlastDefLineAsnWrite, aip, atp, BLAST_DEF_LINE_SET_E);
143    retval = TRUE;
144 
145 erret:
146    AsnUnlinkType(orig);       /* unlink local tree */
147    return retval;
148 }
149 
150 
151 
152 /**************************************************
153 *
154 *    BlastDefLineNew()
155 *
156 **************************************************/
157 NLM_EXTERN
158 BlastDefLinePtr LIBCALL
BlastDefLineNew(void)159 BlastDefLineNew(void)
160 {
161    BlastDefLinePtr ptr = MemNew((size_t) sizeof(BlastDefLine));
162 
163    return ptr;
164 
165 }
166 
167 
168 /**************************************************
169 *
170 *    BlastDefLineFree()
171 *
172 **************************************************/
173 NLM_EXTERN
174 BlastDefLinePtr LIBCALL
BlastDefLineFree(BlastDefLinePtr ptr)175 BlastDefLineFree(BlastDefLinePtr ptr)
176 {
177 
178    if(ptr == NULL) {
179       return NULL;
180    }
181    MemFree(ptr -> title);
182    AsnGenericChoiceSeqOfFree(ptr -> seqid, (AsnOptFreeFunc) SeqIdFree);
183    AsnGenericBaseSeqOfFree(ptr -> memberships ,ASNCODE_INTVAL_SLOT);
184    AsnGenericBaseSeqOfFree(ptr -> links ,ASNCODE_INTVAL_SLOT);
185    AsnGenericBaseSeqOfFree(ptr -> other_info ,ASNCODE_INTVAL_SLOT);
186    return MemFree(ptr);
187 }
188 
189 
190 /**************************************************
191 *
192 *    BlastDefLineAsnRead()
193 *
194 **************************************************/
195 NLM_EXTERN
196 BlastDefLinePtr LIBCALL
BlastDefLineAsnRead(AsnIoPtr aip,AsnTypePtr orig)197 BlastDefLineAsnRead(AsnIoPtr aip, AsnTypePtr orig)
198 {
199    DataVal av;
200    AsnTypePtr atp;
201    Boolean isError = FALSE;
202    AsnReadFunc func;
203    BlastDefLinePtr ptr;
204 
205    if (! loaded)
206    {
207       if (! fdlobjAsnLoad()) {
208          return NULL;
209       }
210    }
211 
212    if (aip == NULL) {
213       return NULL;
214    }
215 
216    if (orig == NULL) {         /* BlastDefLine ::= (self contained) */
217       atp = AsnReadId(aip, amp, BLAST_DEF_LINE);
218    } else {
219       atp = AsnLinkType(orig, BLAST_DEF_LINE);
220    }
221    /* link in local tree */
222    if (atp == NULL) {
223       return NULL;
224    }
225 
226    ptr = BlastDefLineNew();
227    if (ptr == NULL) {
228       goto erret;
229    }
230    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
231       goto erret;
232    }
233 
234    atp = AsnReadId(aip,amp, atp);
235    func = NULL;
236 
237    if (atp == BLAST_DEF_LINE_title) {
238       if ( AsnReadVal(aip, atp, &av) <= 0) {
239          goto erret;
240       }
241       ptr -> title = av.ptrvalue;
242       atp = AsnReadId(aip,amp, atp);
243    }
244    if (atp == BLAST_DEF_LINE_seqid) {
245       ptr -> seqid = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead, (AsnOptFreeFunc) SeqIdFree);
246       if (isError && ptr -> seqid == NULL) {
247          goto erret;
248       }
249       atp = AsnReadId(aip,amp, atp);
250    }
251    if (atp == BLAST_DEF_LINE_taxid) {
252       if ( AsnReadVal(aip, atp, &av) <= 0) {
253          goto erret;
254       }
255       ptr -> taxid = av.intvalue;
256       atp = AsnReadId(aip,amp, atp);
257    }
258    if (atp == BLAST_DEF_LINE_memberships) {
259       ptr -> memberships = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
260       if (isError && ptr -> memberships == NULL) {
261          goto erret;
262       }
263       atp = AsnReadId(aip,amp, atp);
264    }
265    if (atp == BLAST_DEF_LINE_links) {
266       ptr -> links = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
267       if (isError && ptr -> links == NULL) {
268          goto erret;
269       }
270       atp = AsnReadId(aip,amp, atp);
271    }
272    if (atp == BLAST_DEF_LINE_other_info) {
273       ptr -> other_info = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
274       if (isError && ptr -> other_info == NULL) {
275          goto erret;
276       }
277       atp = AsnReadId(aip,amp, atp);
278    }
279 
280    if (AsnReadVal(aip, atp, &av) <= 0) {
281       goto erret;
282    }
283    /* end struct */
284 
285 ret:
286    AsnUnlinkType(orig);       /* unlink local tree */
287    return ptr;
288 
289 erret:
290    aip -> io_failure = TRUE;
291    ptr = BlastDefLineFree(ptr);
292    goto ret;
293 }
294 
295 
296 
297 /**************************************************
298 *
299 *    BlastDefLineAsnWrite()
300 *
301 **************************************************/
302 NLM_EXTERN Boolean LIBCALL
BlastDefLineAsnWrite(BlastDefLinePtr ptr,AsnIoPtr aip,AsnTypePtr orig)303 BlastDefLineAsnWrite(BlastDefLinePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
304 {
305    DataVal av;
306    AsnTypePtr atp;
307    Boolean retval = FALSE;
308 
309    if (! loaded)
310    {
311       if (! fdlobjAsnLoad()) {
312          return FALSE;
313       }
314    }
315 
316    if (aip == NULL) {
317       return FALSE;
318    }
319 
320    atp = AsnLinkType(orig, BLAST_DEF_LINE);   /* link local tree */
321    if (atp == NULL) {
322       return FALSE;
323    }
324 
325    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
326    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
327       goto erret;
328    }
329 
330    if (ptr -> title != NULL) {
331       av.ptrvalue = ptr -> title;
332       retval = AsnWrite(aip, BLAST_DEF_LINE_title,  &av);
333    }
334    AsnGenericChoiceSeqOfAsnWrite(ptr -> seqid, (AsnWriteFunc) SeqIdAsnWrite, aip, BLAST_DEF_LINE_seqid, BLAST_DEF_LINE_seqid_E);
335    av.intvalue = ptr -> taxid;
336    retval = AsnWrite(aip, BLAST_DEF_LINE_taxid,  &av);
337    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> memberships ,ASNCODE_INTVAL_SLOT, aip, BLAST_DEF_LINE_memberships, BLAST_DEF_LINE_memberships_E);
338    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> links ,ASNCODE_INTVAL_SLOT, aip, BLAST_DEF_LINE_links, BLAST_DEF_LINE_links_E);
339    retval = AsnGenericBaseSeqOfAsnWrite(ptr -> other_info ,ASNCODE_INTVAL_SLOT, aip, BLAST_DEF_LINE_other_info, BLAST_DEF_LINE_other_info_E);
340    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
341       goto erret;
342    }
343    retval = TRUE;
344 
345 erret:
346    AsnUnlinkType(orig);       /* unlink local tree */
347    return retval;
348 }
349 
350