|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/object/objmdrs.c |
source navigation diff markup identifier search freetext search file search |
1 #include <asn.h>
2
3 #define NLM_GENERATED_CODE_PROTO
4
5 #include <objmdrs.h>
6
7 static Boolean loaded = FALSE;
8
9 #include <asnmdrs.h>
10
11 #ifndef NLM_EXTERN_LOADS
12 #define NLM_EXTERN_LOADS {}
13 #endif
14
15 NLM_EXTERN Boolean LIBCALL
16 objmdrsAsnLoad(void)
17 {
18
19 if ( ! loaded) {
20 NLM_EXTERN_LOADS
21
22 if ( ! AsnLoad ())
23 return FALSE;
24 loaded = TRUE;
25 }
26
27 return TRUE;
28 }
29
30
31
32 /**************************************************
33 * Generated object loaders for Module NCBI-Medlars
34 * Generated using ASNCODE Revision: 5.2 at Jan 30, 1997 10:13 AM
35 *
36 **************************************************/
37
38
39 /**************************************************
40 *
41 * MedlarsEntryNew()
42 *
43 **************************************************/
44 NLM_EXTERN
45 MedlarsEntryPtr LIBCALL
46 MedlarsEntryNew(void)
47 {
48 MedlarsEntryPtr ptr = MemNew((size_t) sizeof(MedlarsEntry));
49
50 return ptr;
51
52 }
53
54
55 /**************************************************
56 *
57 * MedlarsEntryFree()
58 *
59 **************************************************/
60 NLM_EXTERN
61 MedlarsEntryPtr LIBCALL
62 MedlarsEntryFree(MedlarsEntryPtr ptr)
63 {
64
65 if(ptr == NULL) {
66 return NULL;
67 }
68 AsnGenericUserSeqOfFree(ptr -> recs, (AsnOptFreeFunc) MedlarsRecordFree);
69 return MemFree(ptr);
70 }
71
72
73 /**************************************************
74 *
75 * MedlarsEntryAsnRead()
76 *
77 **************************************************/
78 NLM_EXTERN
79 MedlarsEntryPtr LIBCALL
80 MedlarsEntryAsnRead(AsnIoPtr aip, AsnTypePtr orig)
81 {
82 DataVal av;
83 AsnTypePtr atp;
84 Boolean isError = FALSE;
85 AsnReadFunc func;
86 MedlarsEntryPtr ptr;
87
88 if (! loaded)
89 {
90 if (! objmdrsAsnLoad()) {
91 return NULL;
92 }
93 }
94
95 if (aip == NULL) {
96 return NULL;
97 }
98
99 if (orig == NULL) { /* MedlarsEntry ::= (self contained) */
100 atp = AsnReadId(aip, amp, MEDLARS_ENTRY);
101 } else {
102 atp = AsnLinkType(orig, MEDLARS_ENTRY);
103 }
104 /* link in local tree */
105 if (atp == NULL) {
106 return NULL;
107 }
108
109 ptr = MedlarsEntryNew();
110 if (ptr == NULL) {
111 goto erret;
112 }
113 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
114 goto erret;
115 }
116
117 atp = AsnReadId(aip,amp, atp);
118 func = NULL;
119
120 if (atp == MEDLARS_ENTRY_pmid) {
121 if ( AsnReadVal(aip, atp, &av) <= 0) {
122 goto erret;
123 }
124 ptr -> pmid = av.intvalue;
125 atp = AsnReadId(aip,amp, atp);
126 }
127 if (atp == MEDLARS_ENTRY_muid) {
128 if ( AsnReadVal(aip, atp, &av) <= 0) {
129 goto erret;
130 }
131 ptr -> muid = av.intvalue;
132 atp = AsnReadId(aip,amp, atp);
133 }
134 if (atp == MEDLARS_ENTRY_recs) {
135 ptr -> recs = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MedlarsRecordAsnRead, (AsnOptFreeFunc) MedlarsRecordFree);
136 if (isError && ptr -> recs == NULL) {
137 goto erret;
138 }
139 atp = AsnReadId(aip,amp, atp);
140 }
141
142 if (AsnReadVal(aip, atp, &av) <= 0) {
143 goto erret;
144 }
145 /* end struct */
146
147 ret:
148 AsnUnlinkType(orig); /* unlink local tree */
149 return ptr;
150
151 erret:
152 aip -> io_failure = TRUE;
153 ptr = MedlarsEntryFree(ptr);
154 goto ret;
155 }
156
157
158
159 /**************************************************
160 *
161 * MedlarsEntryAsnWrite()
162 *
163 **************************************************/
164 NLM_EXTERN Boolean LIBCALL
165 MedlarsEntryAsnWrite(MedlarsEntryPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
166 {
167 DataVal av;
168 AsnTypePtr atp;
169 Boolean retval = FALSE;
170
171 if (! loaded)
172 {
173 if (! objmdrsAsnLoad()) {
174 return FALSE;
175 }
176 }
177
178 if (aip == NULL) {
179 return FALSE;
180 }
181
182 atp = AsnLinkType(orig, MEDLARS_ENTRY); /* link local tree */
183 if (atp == NULL) {
184 return FALSE;
185 }
186
187 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
188 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
189 goto erret;
190 }
191
192 av.intvalue = ptr -> pmid;
193 retval = AsnWrite(aip, MEDLARS_ENTRY_pmid, &av);
194 av.intvalue = ptr -> muid;
195 retval = AsnWrite(aip, MEDLARS_ENTRY_muid, &av);
196 AsnGenericUserSeqOfAsnWrite(ptr -> recs, (AsnWriteFunc) MedlarsRecordAsnWrite, aip, MEDLARS_ENTRY_recs, MEDLARS_ENTRY_recs_E);
197 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
198 goto erret;
199 }
200 retval = TRUE;
201
202 erret:
203 AsnUnlinkType(orig); /* unlink local tree */
204 return retval;
205 }
206
207
208
209 /**************************************************
210 *
211 * MedlarsRecordNew()
212 *
213 **************************************************/
214 NLM_EXTERN
215 MedlarsRecordPtr LIBCALL
216 MedlarsRecordNew(void)
217 {
218 MedlarsRecordPtr ptr = MemNew((size_t) sizeof(MedlarsRecord));
219
220 return ptr;
221
222 }
223
224
225 /**************************************************
226 *
227 * MedlarsRecordFree()
228 *
229 **************************************************/
230 NLM_EXTERN
231 MedlarsRecordPtr LIBCALL
232 MedlarsRecordFree(MedlarsRecordPtr ptr)
233 {
234
235 if(ptr == NULL) {
236 return NULL;
237 }
238 MemFree(ptr -> abbr);
239 MemFree(ptr -> data);
240 return MemFree(ptr);
241 }
242
243
244 /**************************************************
245 *
246 * MedlarsRecordAsnRead()
247 *
248 **************************************************/
249 NLM_EXTERN
250 MedlarsRecordPtr LIBCALL
251 MedlarsRecordAsnRead(AsnIoPtr aip, AsnTypePtr orig)
252 {
253 DataVal av;
254 AsnTypePtr atp;
255 Boolean isError = FALSE;
256 AsnReadFunc func;
257 MedlarsRecordPtr ptr;
258
259 if (! loaded)
260 {
261 if (! objmdrsAsnLoad()) {
262 return NULL;
263 }
264 }
265
266 if (aip == NULL) {
267 return NULL;
268 }
269
270 if (orig == NULL) { /* MedlarsRecord ::= (self contained) */
271 atp = AsnReadId(aip, amp, MEDLARS_RECORD);
272 } else {
273 atp = AsnLinkType(orig, MEDLARS_RECORD);
274 }
275 /* link in local tree */
276 if (atp == NULL) {
277 return NULL;
278 }
279
280 ptr = MedlarsRecordNew();
281 if (ptr == NULL) {
282 goto erret;
283 }
284 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
285 goto erret;
286 }
287
288 atp = AsnReadId(aip,amp, atp);
289 func = NULL;
290
291 if (atp == MEDLARS_RECORD_code) {
292 if ( AsnReadVal(aip, atp, &av) <= 0) {
293 goto erret;
294 }
295 ptr -> code = av.intvalue;
296 atp = AsnReadId(aip,amp, atp);
297 }
298 if (atp == MEDLARS_RECORD_abbr) {
299 if ( AsnReadVal(aip, atp, &av) <= 0) {
300 goto erret;
301 }
302 ptr -> abbr = av.ptrvalue;
303 atp = AsnReadId(aip,amp, atp);
304 }
305 if (atp == MEDLARS_RECORD_data) {
306 if ( AsnReadVal(aip, atp, &av) <= 0) {
307 goto erret;
308 }
309 ptr -> data = av.ptrvalue;
310 atp = AsnReadId(aip,amp, atp);
311 }
312
313 if (AsnReadVal(aip, atp, &av) <= 0) {
314 goto erret;
315 }
316 /* end struct */
317
318 ret:
319 AsnUnlinkType(orig); /* unlink local tree */
320 return ptr;
321
322 erret:
323 aip -> io_failure = TRUE;
324 ptr = MedlarsRecordFree(ptr);
325 goto ret;
326 }
327
328
329
330 /**************************************************
331 *
332 * MedlarsRecordAsnWrite()
333 *
334 **************************************************/
335 NLM_EXTERN Boolean LIBCALL
336 MedlarsRecordAsnWrite(MedlarsRecordPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
337 {
338 DataVal av;
339 AsnTypePtr atp;
340 Boolean retval = FALSE;
341
342 if (! loaded)
343 {
344 if (! objmdrsAsnLoad()) {
345 return FALSE;
346 }
347 }
348
349 if (aip == NULL) {
350 return FALSE;
351 }
352
353 atp = AsnLinkType(orig, MEDLARS_RECORD); /* link local tree */
354 if (atp == NULL) {
355 return FALSE;
356 }
357
358 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
359 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
360 goto erret;
361 }
362
363 av.intvalue = ptr -> code;
364 retval = AsnWrite(aip, MEDLARS_RECORD_code, &av);
365 if (ptr -> abbr != NULL) {
366 av.ptrvalue = ptr -> abbr;
367 retval = AsnWrite(aip, MEDLARS_RECORD_abbr, &av);
368 }
369 if (ptr -> data != NULL) {
370 av.ptrvalue = ptr -> data;
371 retval = AsnWrite(aip, MEDLARS_RECORD_data, &av);
372 }
373 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
374 goto erret;
375 }
376 retval = TRUE;
377
378 erret:
379 AsnUnlinkType(orig); /* unlink local tree */
380 return retval;
381 }
382
383 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |