~ubuntu-branches/ubuntu/precise/ncbi-tools6/precise

« back to all changes in this revision

Viewing changes to object/objinsdseq.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <asn.h>
 
2
 
 
3
#define NLM_GENERATED_CODE_PROTO
 
4
 
 
5
#include <objinsdseq.h>
 
6
 
 
7
static Boolean loaded = FALSE;
 
8
 
 
9
#include <asninsdseq.h>
 
10
 
 
11
#ifndef NLM_EXTERN_LOADS
 
12
#define NLM_EXTERN_LOADS {}
 
13
#endif
 
14
 
 
15
NLM_EXTERN Boolean LIBCALL
 
16
objinsdseqAsnLoad(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 INSD-INSDSeq
 
34
*    Generated using ASNCODE Revision: 6.14 at Jun 1, 2004 11:01 AM
 
35
*
 
36
**************************************************/
 
37
 
 
38
 
 
39
/**************************************************
 
40
*
 
41
*    INSDSeqNew()
 
42
*
 
43
**************************************************/
 
44
NLM_EXTERN 
 
45
INSDSeqPtr LIBCALL
 
46
INSDSeqNew(void)
 
47
{
 
48
   INSDSeqPtr ptr = MemNew((size_t) sizeof(INSDSeq));
 
49
 
 
50
   return ptr;
 
51
 
 
52
}
 
53
 
 
54
 
 
55
/**************************************************
 
56
*
 
57
*    INSDSeqFree()
 
58
*
 
59
**************************************************/
 
60
NLM_EXTERN 
 
61
INSDSeqPtr LIBCALL
 
62
INSDSeqFree(INSDSeqPtr ptr)
 
63
{
 
64
 
 
65
   if(ptr == NULL) {
 
66
      return NULL;
 
67
   }
 
68
   MemFree(ptr -> locus);
 
69
   MemFree(ptr -> strandedness);
 
70
   MemFree(ptr -> moltype);
 
71
   MemFree(ptr -> topology);
 
72
   MemFree(ptr -> division);
 
73
   MemFree(ptr -> update_date);
 
74
   MemFree(ptr -> create_date);
 
75
   MemFree(ptr -> update_release);
 
76
   MemFree(ptr -> create_release);
 
77
   MemFree(ptr -> definition);
 
78
   MemFree(ptr -> primary_accession);
 
79
   MemFree(ptr -> entry_version);
 
80
   MemFree(ptr -> accession_version);
 
81
   AsnGenericBaseSeqOfFree(ptr -> other_seqids ,ASNCODE_PTRVAL_SLOT);
 
82
   AsnGenericBaseSeqOfFree(ptr -> secondary_accessions ,ASNCODE_PTRVAL_SLOT);
 
83
   AsnGenericBaseSeqOfFree(ptr -> keywords ,ASNCODE_PTRVAL_SLOT);
 
84
   MemFree(ptr -> segment);
 
85
   MemFree(ptr -> source);
 
86
   MemFree(ptr -> organism);
 
87
   MemFree(ptr -> taxonomy);
 
88
   AsnGenericUserSeqOfFree(ptr -> references, (AsnOptFreeFunc) INSDReferenceFree);
 
89
   MemFree(ptr -> comment);
 
90
   MemFree(ptr -> primary);
 
91
   MemFree(ptr -> source_db);
 
92
   MemFree(ptr -> database_reference);
 
93
   AsnGenericUserSeqOfFree(ptr -> feature_table, (AsnOptFreeFunc) INSDFeatureFree);
 
94
   MemFree(ptr -> sequence);
 
95
   MemFree(ptr -> contig);
 
96
   return MemFree(ptr);
 
97
}
 
98
 
 
99
 
 
100
/**************************************************
 
101
*
 
102
*    INSDSeqAsnRead()
 
103
*
 
104
**************************************************/
 
105
NLM_EXTERN 
 
106
INSDSeqPtr LIBCALL
 
107
INSDSeqAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
108
{
 
109
   DataVal av;
 
110
   AsnTypePtr atp;
 
111
   Boolean isError = FALSE;
 
112
   AsnReadFunc func;
 
113
   INSDSeqPtr ptr;
 
114
 
 
115
   if (! loaded)
 
116
   {
 
117
      if (! objinsdseqAsnLoad()) {
 
118
         return NULL;
 
119
      }
 
120
   }
 
121
 
 
122
   if (aip == NULL) {
 
123
      return NULL;
 
124
   }
 
125
 
 
126
   if (orig == NULL) {         /* INSDSeq ::= (self contained) */
 
127
      atp = AsnReadId(aip, amp, INSDSEQ);
 
128
   } else {
 
129
      atp = AsnLinkType(orig, INSDSEQ);
 
130
   }
 
131
   /* link in local tree */
 
132
   if (atp == NULL) {
 
133
      return NULL;
 
134
   }
 
135
 
 
136
   ptr = INSDSeqNew();
 
137
   if (ptr == NULL) {
 
138
      goto erret;
 
139
   }
 
140
   if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
 
141
      goto erret;
 
142
   }
 
143
 
 
144
   atp = AsnReadId(aip,amp, atp);
 
145
   func = NULL;
 
146
 
 
147
   if (atp == INSDSEQ_locus) {
 
148
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
149
         goto erret;
 
150
      }
 
151
      ptr -> locus = av.ptrvalue;
 
152
      atp = AsnReadId(aip,amp, atp);
 
153
   }
 
154
   if (atp == INSDSEQ_length) {
 
155
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
156
         goto erret;
 
157
      }
 
158
      ptr -> length = av.intvalue;
 
159
      atp = AsnReadId(aip,amp, atp);
 
160
   }
 
161
   if (atp == INSDSEQ_strandedness) {
 
162
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
163
         goto erret;
 
164
      }
 
165
      ptr -> strandedness = av.ptrvalue;
 
166
      atp = AsnReadId(aip,amp, atp);
 
167
   }
 
168
   if (atp == INSDSEQ_moltype) {
 
169
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
170
         goto erret;
 
171
      }
 
172
      ptr -> moltype = av.ptrvalue;
 
173
      atp = AsnReadId(aip,amp, atp);
 
174
   }
 
175
   if (atp == INSDSEQ_topology) {
 
176
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
177
         goto erret;
 
178
      }
 
179
      ptr -> topology = av.ptrvalue;
 
180
      atp = AsnReadId(aip,amp, atp);
 
181
   }
 
182
   if (atp == INSDSEQ_division) {
 
183
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
184
         goto erret;
 
185
      }
 
186
      ptr -> division = av.ptrvalue;
 
187
      atp = AsnReadId(aip,amp, atp);
 
188
   }
 
189
   if (atp == INSDSEQ_update_date) {
 
190
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
191
         goto erret;
 
192
      }
 
193
      ptr -> update_date = av.ptrvalue;
 
194
      atp = AsnReadId(aip,amp, atp);
 
195
   }
 
196
   if (atp == INSDSEQ_create_date) {
 
197
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
198
         goto erret;
 
199
      }
 
200
      ptr -> create_date = av.ptrvalue;
 
201
      atp = AsnReadId(aip,amp, atp);
 
202
   }
 
203
   if (atp == INSDSEQ_update_release) {
 
204
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
205
         goto erret;
 
206
      }
 
207
      ptr -> update_release = av.ptrvalue;
 
208
      atp = AsnReadId(aip,amp, atp);
 
209
   }
 
210
   if (atp == INSDSEQ_create_release) {
 
211
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
212
         goto erret;
 
213
      }
 
214
      ptr -> create_release = av.ptrvalue;
 
215
      atp = AsnReadId(aip,amp, atp);
 
216
   }
 
217
   if (atp == INSDSEQ_definition) {
 
218
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
219
         goto erret;
 
220
      }
 
221
      ptr -> definition = av.ptrvalue;
 
222
      atp = AsnReadId(aip,amp, atp);
 
223
   }
 
224
   if (atp == INSDSEQ_primary_accession) {
 
225
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
226
         goto erret;
 
227
      }
 
228
      ptr -> primary_accession = av.ptrvalue;
 
229
      atp = AsnReadId(aip,amp, atp);
 
230
   }
 
231
   if (atp == INSDSEQ_entry_version) {
 
232
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
233
         goto erret;
 
234
      }
 
235
      ptr -> entry_version = av.ptrvalue;
 
236
      atp = AsnReadId(aip,amp, atp);
 
237
   }
 
238
   if (atp == INSDSEQ_accession_version) {
 
239
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
240
         goto erret;
 
241
      }
 
242
      ptr -> accession_version = av.ptrvalue;
 
243
      atp = AsnReadId(aip,amp, atp);
 
244
   }
 
245
   if (atp == INSDSEQ_other_seqids) {
 
246
      ptr -> other_seqids = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
 
247
      if (isError && ptr -> other_seqids == NULL) {
 
248
         goto erret;
 
249
      }
 
250
      atp = AsnReadId(aip,amp, atp);
 
251
   }
 
252
   if (atp == INSDSEQ_secondary_accessions) {
 
253
      ptr -> secondary_accessions = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
 
254
      if (isError && ptr -> secondary_accessions == NULL) {
 
255
         goto erret;
 
256
      }
 
257
      atp = AsnReadId(aip,amp, atp);
 
258
   }
 
259
   if (atp == INSDSEQ_keywords) {
 
260
      ptr -> keywords = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
 
261
      if (isError && ptr -> keywords == NULL) {
 
262
         goto erret;
 
263
      }
 
264
      atp = AsnReadId(aip,amp, atp);
 
265
   }
 
266
   if (atp == INSDSEQ_segment) {
 
267
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
268
         goto erret;
 
269
      }
 
270
      ptr -> segment = av.ptrvalue;
 
271
      atp = AsnReadId(aip,amp, atp);
 
272
   }
 
273
   if (atp == INSDSEQ_source) {
 
274
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
275
         goto erret;
 
276
      }
 
277
      ptr -> source = av.ptrvalue;
 
278
      atp = AsnReadId(aip,amp, atp);
 
279
   }
 
280
   if (atp == INSDSEQ_organism) {
 
281
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
282
         goto erret;
 
283
      }
 
284
      ptr -> organism = av.ptrvalue;
 
285
      atp = AsnReadId(aip,amp, atp);
 
286
   }
 
287
   if (atp == INSDSEQ_taxonomy) {
 
288
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
289
         goto erret;
 
290
      }
 
291
      ptr -> taxonomy = av.ptrvalue;
 
292
      atp = AsnReadId(aip,amp, atp);
 
293
   }
 
294
   if (atp == INSDSEQ_references) {
 
295
      ptr -> references = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) INSDReferenceAsnRead, (AsnOptFreeFunc) INSDReferenceFree);
 
296
      if (isError && ptr -> references == NULL) {
 
297
         goto erret;
 
298
      }
 
299
      atp = AsnReadId(aip,amp, atp);
 
300
   }
 
301
   if (atp == INSDSEQ_comment) {
 
302
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
303
         goto erret;
 
304
      }
 
305
      ptr -> comment = av.ptrvalue;
 
306
      atp = AsnReadId(aip,amp, atp);
 
307
   }
 
308
   if (atp == INSDSEQ_primary) {
 
309
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
310
         goto erret;
 
311
      }
 
312
      ptr -> primary = av.ptrvalue;
 
313
      atp = AsnReadId(aip,amp, atp);
 
314
   }
 
315
   if (atp == INSDSEQ_source_db) {
 
316
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
317
         goto erret;
 
318
      }
 
319
      ptr -> source_db = av.ptrvalue;
 
320
      atp = AsnReadId(aip,amp, atp);
 
321
   }
 
322
   if (atp == INSDSEQ_database_reference) {
 
323
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
324
         goto erret;
 
325
      }
 
326
      ptr -> database_reference = av.ptrvalue;
 
327
      atp = AsnReadId(aip,amp, atp);
 
328
   }
 
329
   if (atp == INSDSEQ_feature_table) {
 
330
      ptr -> feature_table = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) INSDFeatureAsnRead, (AsnOptFreeFunc) INSDFeatureFree);
 
331
      if (isError && ptr -> feature_table == NULL) {
 
332
         goto erret;
 
333
      }
 
334
      atp = AsnReadId(aip,amp, atp);
 
335
   }
 
336
   if (atp == INSDSEQ_sequence) {
 
337
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
338
         goto erret;
 
339
      }
 
340
      ptr -> sequence = av.ptrvalue;
 
341
      atp = AsnReadId(aip,amp, atp);
 
342
   }
 
343
   if (atp == INSDSEQ_contig) {
 
344
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
345
         goto erret;
 
346
      }
 
347
      ptr -> contig = av.ptrvalue;
 
348
      atp = AsnReadId(aip,amp, atp);
 
349
   }
 
350
 
 
351
   if (AsnReadVal(aip, atp, &av) <= 0) {
 
352
      goto erret;
 
353
   }
 
354
   /* end struct */
 
355
 
 
356
ret:
 
357
   AsnUnlinkType(orig);       /* unlink local tree */
 
358
   return ptr;
 
359
 
 
360
erret:
 
361
   aip -> io_failure = TRUE;
 
362
   ptr = INSDSeqFree(ptr);
 
363
   goto ret;
 
364
}
 
365
 
 
366
 
 
367
 
 
368
/**************************************************
 
369
*
 
370
*    INSDSeqAsnWrite()
 
371
*
 
372
**************************************************/
 
373
NLM_EXTERN Boolean LIBCALL 
 
374
INSDSeqAsnWrite(INSDSeqPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
375
{
 
376
   DataVal av;
 
377
   AsnTypePtr atp;
 
378
   Boolean retval = FALSE;
 
379
 
 
380
   if (! loaded)
 
381
   {
 
382
      if (! objinsdseqAsnLoad()) {
 
383
         return FALSE;
 
384
      }
 
385
   }
 
386
 
 
387
   if (aip == NULL) {
 
388
      return FALSE;
 
389
   }
 
390
 
 
391
   atp = AsnLinkType(orig, INSDSEQ);   /* link local tree */
 
392
   if (atp == NULL) {
 
393
      return FALSE;
 
394
   }
 
395
 
 
396
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
397
   if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
 
398
      goto erret;
 
399
   }
 
400
 
 
401
   if (ptr -> locus != NULL) {
 
402
      av.ptrvalue = ptr -> locus;
 
403
      retval = AsnWrite(aip, INSDSEQ_locus,  &av);
 
404
   }
 
405
   av.intvalue = ptr -> length;
 
406
   retval = AsnWrite(aip, INSDSEQ_length,  &av);
 
407
   if (ptr -> strandedness != NULL) {
 
408
      av.ptrvalue = ptr -> strandedness;
 
409
      retval = AsnWrite(aip, INSDSEQ_strandedness,  &av);
 
410
   }
 
411
   if (ptr -> moltype != NULL) {
 
412
      av.ptrvalue = ptr -> moltype;
 
413
      retval = AsnWrite(aip, INSDSEQ_moltype,  &av);
 
414
   }
 
415
   if (ptr -> topology != NULL) {
 
416
      av.ptrvalue = ptr -> topology;
 
417
      retval = AsnWrite(aip, INSDSEQ_topology,  &av);
 
418
   }
 
419
   if (ptr -> division != NULL) {
 
420
      av.ptrvalue = ptr -> division;
 
421
      retval = AsnWrite(aip, INSDSEQ_division,  &av);
 
422
   }
 
423
   if (ptr -> update_date != NULL) {
 
424
      av.ptrvalue = ptr -> update_date;
 
425
      retval = AsnWrite(aip, INSDSEQ_update_date,  &av);
 
426
   }
 
427
   if (ptr -> create_date != NULL) {
 
428
      av.ptrvalue = ptr -> create_date;
 
429
      retval = AsnWrite(aip, INSDSEQ_create_date,  &av);
 
430
   }
 
431
   if (ptr -> update_release != NULL) {
 
432
      av.ptrvalue = ptr -> update_release;
 
433
      retval = AsnWrite(aip, INSDSEQ_update_release,  &av);
 
434
   }
 
435
   if (ptr -> create_release != NULL) {
 
436
      av.ptrvalue = ptr -> create_release;
 
437
      retval = AsnWrite(aip, INSDSEQ_create_release,  &av);
 
438
   }
 
439
   if (ptr -> definition != NULL) {
 
440
      av.ptrvalue = ptr -> definition;
 
441
      retval = AsnWrite(aip, INSDSEQ_definition,  &av);
 
442
   }
 
443
   if (ptr -> primary_accession != NULL) {
 
444
      av.ptrvalue = ptr -> primary_accession;
 
445
      retval = AsnWrite(aip, INSDSEQ_primary_accession,  &av);
 
446
   }
 
447
   if (ptr -> entry_version != NULL) {
 
448
      av.ptrvalue = ptr -> entry_version;
 
449
      retval = AsnWrite(aip, INSDSEQ_entry_version,  &av);
 
450
   }
 
451
   if (ptr -> accession_version != NULL) {
 
452
      av.ptrvalue = ptr -> accession_version;
 
453
      retval = AsnWrite(aip, INSDSEQ_accession_version,  &av);
 
454
   }
 
455
   retval = AsnGenericBaseSeqOfAsnWrite(ptr -> other_seqids ,ASNCODE_PTRVAL_SLOT, aip, INSDSEQ_other_seqids, INSDSEQ_other_seqids_E);
 
456
   retval = AsnGenericBaseSeqOfAsnWrite(ptr -> secondary_accessions ,ASNCODE_PTRVAL_SLOT, aip, INSDSEQ_secondary_accessions, INSDSEQ_secondary_accessions_E);
 
457
   retval = AsnGenericBaseSeqOfAsnWrite(ptr -> keywords ,ASNCODE_PTRVAL_SLOT, aip, INSDSEQ_keywords, INSDSEQ_keywords_E);
 
458
   if (ptr -> segment != NULL) {
 
459
      av.ptrvalue = ptr -> segment;
 
460
      retval = AsnWrite(aip, INSDSEQ_segment,  &av);
 
461
   }
 
462
   if (ptr -> source != NULL) {
 
463
      av.ptrvalue = ptr -> source;
 
464
      retval = AsnWrite(aip, INSDSEQ_source,  &av);
 
465
   }
 
466
   if (ptr -> organism != NULL) {
 
467
      av.ptrvalue = ptr -> organism;
 
468
      retval = AsnWrite(aip, INSDSEQ_organism,  &av);
 
469
   }
 
470
   if (ptr -> taxonomy != NULL) {
 
471
      av.ptrvalue = ptr -> taxonomy;
 
472
      retval = AsnWrite(aip, INSDSEQ_taxonomy,  &av);
 
473
   }
 
474
   AsnGenericUserSeqOfAsnWrite(ptr -> references, (AsnWriteFunc) INSDReferenceAsnWrite, aip, INSDSEQ_references, INSDSEQ_references_E);
 
475
   if (ptr -> comment != NULL) {
 
476
      av.ptrvalue = ptr -> comment;
 
477
      retval = AsnWrite(aip, INSDSEQ_comment,  &av);
 
478
   }
 
479
   if (ptr -> primary != NULL) {
 
480
      av.ptrvalue = ptr -> primary;
 
481
      retval = AsnWrite(aip, INSDSEQ_primary,  &av);
 
482
   }
 
483
   if (ptr -> source_db != NULL) {
 
484
      av.ptrvalue = ptr -> source_db;
 
485
      retval = AsnWrite(aip, INSDSEQ_source_db,  &av);
 
486
   }
 
487
   if (ptr -> database_reference != NULL) {
 
488
      av.ptrvalue = ptr -> database_reference;
 
489
      retval = AsnWrite(aip, INSDSEQ_database_reference,  &av);
 
490
   }
 
491
   AsnGenericUserSeqOfAsnWrite(ptr -> feature_table, (AsnWriteFunc) INSDFeatureAsnWrite, aip, INSDSEQ_feature_table, INSDSEQ_feature_table_E);
 
492
   if (ptr -> sequence != NULL) {
 
493
      av.ptrvalue = ptr -> sequence;
 
494
      retval = AsnWrite(aip, INSDSEQ_sequence,  &av);
 
495
   }
 
496
   if (ptr -> contig != NULL) {
 
497
      av.ptrvalue = ptr -> contig;
 
498
      retval = AsnWrite(aip, INSDSEQ_contig,  &av);
 
499
   }
 
500
   if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
 
501
      goto erret;
 
502
   }
 
503
   retval = TRUE;
 
504
 
 
505
erret:
 
506
   AsnUnlinkType(orig);       /* unlink local tree */
 
507
   return retval;
 
508
}
 
509
 
 
510
 
 
511
 
 
512
/**************************************************
 
513
*
 
514
*    INSDReferenceNew()
 
515
*
 
516
**************************************************/
 
517
NLM_EXTERN 
 
518
INSDReferencePtr LIBCALL
 
519
INSDReferenceNew(void)
 
520
{
 
521
   INSDReferencePtr ptr = MemNew((size_t) sizeof(INSDReference));
 
522
 
 
523
   return ptr;
 
524
 
 
525
}
 
526
 
 
527
 
 
528
/**************************************************
 
529
*
 
530
*    INSDReferenceFree()
 
531
*
 
532
**************************************************/
 
533
NLM_EXTERN 
 
534
INSDReferencePtr LIBCALL
 
535
INSDReferenceFree(INSDReferencePtr ptr)
 
536
{
 
537
 
 
538
   if(ptr == NULL) {
 
539
      return NULL;
 
540
   }
 
541
   MemFree(ptr -> reference);
 
542
   AsnGenericBaseSeqOfFree(ptr -> authors ,ASNCODE_PTRVAL_SLOT);
 
543
   MemFree(ptr -> consortium);
 
544
   MemFree(ptr -> title);
 
545
   MemFree(ptr -> journal);
 
546
   MemFree(ptr -> remark);
 
547
   return MemFree(ptr);
 
548
}
 
549
 
 
550
 
 
551
/**************************************************
 
552
*
 
553
*    INSDReferenceAsnRead()
 
554
*
 
555
**************************************************/
 
556
NLM_EXTERN 
 
557
INSDReferencePtr LIBCALL
 
558
INSDReferenceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
559
{
 
560
   DataVal av;
 
561
   AsnTypePtr atp;
 
562
   Boolean isError = FALSE;
 
563
   AsnReadFunc func;
 
564
   INSDReferencePtr ptr;
 
565
 
 
566
   if (! loaded)
 
567
   {
 
568
      if (! objinsdseqAsnLoad()) {
 
569
         return NULL;
 
570
      }
 
571
   }
 
572
 
 
573
   if (aip == NULL) {
 
574
      return NULL;
 
575
   }
 
576
 
 
577
   if (orig == NULL) {         /* INSDReference ::= (self contained) */
 
578
      atp = AsnReadId(aip, amp, INSDREFERENCE);
 
579
   } else {
 
580
      atp = AsnLinkType(orig, INSDREFERENCE);
 
581
   }
 
582
   /* link in local tree */
 
583
   if (atp == NULL) {
 
584
      return NULL;
 
585
   }
 
586
 
 
587
   ptr = INSDReferenceNew();
 
588
   if (ptr == NULL) {
 
589
      goto erret;
 
590
   }
 
591
   if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
 
592
      goto erret;
 
593
   }
 
594
 
 
595
   atp = AsnReadId(aip,amp, atp);
 
596
   func = NULL;
 
597
 
 
598
   if (atp == INSDREFERENCE_reference) {
 
599
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
600
         goto erret;
 
601
      }
 
602
      ptr -> reference = av.ptrvalue;
 
603
      atp = AsnReadId(aip,amp, atp);
 
604
   }
 
605
   if (atp == INSDREFERENCE_authors) {
 
606
      ptr -> authors = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
 
607
      if (isError && ptr -> authors == NULL) {
 
608
         goto erret;
 
609
      }
 
610
      atp = AsnReadId(aip,amp, atp);
 
611
   }
 
612
   if (atp == INSDREFERENCE_consortium) {
 
613
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
614
         goto erret;
 
615
      }
 
616
      ptr -> consortium = av.ptrvalue;
 
617
      atp = AsnReadId(aip,amp, atp);
 
618
   }
 
619
   if (atp == INSDREFERENCE_title) {
 
620
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
621
         goto erret;
 
622
      }
 
623
      ptr -> title = av.ptrvalue;
 
624
      atp = AsnReadId(aip,amp, atp);
 
625
   }
 
626
   if (atp == INSDREFERENCE_journal) {
 
627
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
628
         goto erret;
 
629
      }
 
630
      ptr -> journal = av.ptrvalue;
 
631
      atp = AsnReadId(aip,amp, atp);
 
632
   }
 
633
   if (atp == INSDREFERENCE_medline) {
 
634
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
635
         goto erret;
 
636
      }
 
637
      ptr -> medline = av.intvalue;
 
638
      ptr -> OBbits__ |= 1<<0;
 
639
      atp = AsnReadId(aip,amp, atp);
 
640
   }
 
641
   if (atp == INSDREFERENCE_pubmed) {
 
642
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
643
         goto erret;
 
644
      }
 
645
      ptr -> pubmed = av.intvalue;
 
646
      ptr -> OBbits__ |= 1<<1;
 
647
      atp = AsnReadId(aip,amp, atp);
 
648
   }
 
649
   if (atp == INSDREFERENCE_remark) {
 
650
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
651
         goto erret;
 
652
      }
 
653
      ptr -> remark = av.ptrvalue;
 
654
      atp = AsnReadId(aip,amp, atp);
 
655
   }
 
656
 
 
657
   if (AsnReadVal(aip, atp, &av) <= 0) {
 
658
      goto erret;
 
659
   }
 
660
   /* end struct */
 
661
 
 
662
ret:
 
663
   AsnUnlinkType(orig);       /* unlink local tree */
 
664
   return ptr;
 
665
 
 
666
erret:
 
667
   aip -> io_failure = TRUE;
 
668
   ptr = INSDReferenceFree(ptr);
 
669
   goto ret;
 
670
}
 
671
 
 
672
 
 
673
 
 
674
/**************************************************
 
675
*
 
676
*    INSDReferenceAsnWrite()
 
677
*
 
678
**************************************************/
 
679
NLM_EXTERN Boolean LIBCALL 
 
680
INSDReferenceAsnWrite(INSDReferencePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
681
{
 
682
   DataVal av;
 
683
   AsnTypePtr atp;
 
684
   Boolean retval = FALSE;
 
685
 
 
686
   if (! loaded)
 
687
   {
 
688
      if (! objinsdseqAsnLoad()) {
 
689
         return FALSE;
 
690
      }
 
691
   }
 
692
 
 
693
   if (aip == NULL) {
 
694
      return FALSE;
 
695
   }
 
696
 
 
697
   atp = AsnLinkType(orig, INSDREFERENCE);   /* link local tree */
 
698
   if (atp == NULL) {
 
699
      return FALSE;
 
700
   }
 
701
 
 
702
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
703
   if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
 
704
      goto erret;
 
705
   }
 
706
 
 
707
   if (ptr -> reference != NULL) {
 
708
      av.ptrvalue = ptr -> reference;
 
709
      retval = AsnWrite(aip, INSDREFERENCE_reference,  &av);
 
710
   }
 
711
   retval = AsnGenericBaseSeqOfAsnWrite(ptr -> authors ,ASNCODE_PTRVAL_SLOT, aip, INSDREFERENCE_authors, INSDREFERENCE_authors_E);
 
712
   if (ptr -> consortium != NULL) {
 
713
      av.ptrvalue = ptr -> consortium;
 
714
      retval = AsnWrite(aip, INSDREFERENCE_consortium,  &av);
 
715
   }
 
716
   if (ptr -> title != NULL) {
 
717
      av.ptrvalue = ptr -> title;
 
718
      retval = AsnWrite(aip, INSDREFERENCE_title,  &av);
 
719
   }
 
720
   if (ptr -> journal != NULL) {
 
721
      av.ptrvalue = ptr -> journal;
 
722
      retval = AsnWrite(aip, INSDREFERENCE_journal,  &av);
 
723
   }
 
724
   if (ptr -> medline || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> medline;
 
725
      retval = AsnWrite(aip, INSDREFERENCE_medline,  &av);
 
726
   }
 
727
   if (ptr -> pubmed || (ptr -> OBbits__ & (1<<1) )){   av.intvalue = ptr -> pubmed;
 
728
      retval = AsnWrite(aip, INSDREFERENCE_pubmed,  &av);
 
729
   }
 
730
   if (ptr -> remark != NULL) {
 
731
      av.ptrvalue = ptr -> remark;
 
732
      retval = AsnWrite(aip, INSDREFERENCE_remark,  &av);
 
733
   }
 
734
   if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
 
735
      goto erret;
 
736
   }
 
737
   retval = TRUE;
 
738
 
 
739
erret:
 
740
   AsnUnlinkType(orig);       /* unlink local tree */
 
741
   return retval;
 
742
}
 
743
 
 
744
 
 
745
 
 
746
/**************************************************
 
747
*
 
748
*    INSDFeatureNew()
 
749
*
 
750
**************************************************/
 
751
NLM_EXTERN 
 
752
INSDFeaturePtr LIBCALL
 
753
INSDFeatureNew(void)
 
754
{
 
755
   INSDFeaturePtr ptr = MemNew((size_t) sizeof(INSDFeature));
 
756
 
 
757
   return ptr;
 
758
 
 
759
}
 
760
 
 
761
 
 
762
/**************************************************
 
763
*
 
764
*    INSDFeatureFree()
 
765
*
 
766
**************************************************/
 
767
NLM_EXTERN 
 
768
INSDFeaturePtr LIBCALL
 
769
INSDFeatureFree(INSDFeaturePtr ptr)
 
770
{
 
771
 
 
772
   if(ptr == NULL) {
 
773
      return NULL;
 
774
   }
 
775
   MemFree(ptr -> key);
 
776
   MemFree(ptr -> location);
 
777
   AsnGenericUserSeqOfFree(ptr -> intervals, (AsnOptFreeFunc) INSDIntervalFree);
 
778
   AsnGenericUserSeqOfFree(ptr -> quals, (AsnOptFreeFunc) INSDQualifierFree);
 
779
   return MemFree(ptr);
 
780
}
 
781
 
 
782
 
 
783
/**************************************************
 
784
*
 
785
*    INSDFeatureAsnRead()
 
786
*
 
787
**************************************************/
 
788
NLM_EXTERN 
 
789
INSDFeaturePtr LIBCALL
 
790
INSDFeatureAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
791
{
 
792
   DataVal av;
 
793
   AsnTypePtr atp;
 
794
   Boolean isError = FALSE;
 
795
   AsnReadFunc func;
 
796
   INSDFeaturePtr ptr;
 
797
 
 
798
   if (! loaded)
 
799
   {
 
800
      if (! objinsdseqAsnLoad()) {
 
801
         return NULL;
 
802
      }
 
803
   }
 
804
 
 
805
   if (aip == NULL) {
 
806
      return NULL;
 
807
   }
 
808
 
 
809
   if (orig == NULL) {         /* INSDFeature ::= (self contained) */
 
810
      atp = AsnReadId(aip, amp, INSDFEATURE);
 
811
   } else {
 
812
      atp = AsnLinkType(orig, INSDFEATURE);
 
813
   }
 
814
   /* link in local tree */
 
815
   if (atp == NULL) {
 
816
      return NULL;
 
817
   }
 
818
 
 
819
   ptr = INSDFeatureNew();
 
820
   if (ptr == NULL) {
 
821
      goto erret;
 
822
   }
 
823
   if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
 
824
      goto erret;
 
825
   }
 
826
 
 
827
   atp = AsnReadId(aip,amp, atp);
 
828
   func = NULL;
 
829
 
 
830
   if (atp == INSDFEATURE_key) {
 
831
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
832
         goto erret;
 
833
      }
 
834
      ptr -> key = av.ptrvalue;
 
835
      atp = AsnReadId(aip,amp, atp);
 
836
   }
 
837
   if (atp == INSDFEATURE_location) {
 
838
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
839
         goto erret;
 
840
      }
 
841
      ptr -> location = av.ptrvalue;
 
842
      atp = AsnReadId(aip,amp, atp);
 
843
   }
 
844
   if (atp == INSDFEATURE_intervals) {
 
845
      ptr -> intervals = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) INSDIntervalAsnRead, (AsnOptFreeFunc) INSDIntervalFree);
 
846
      if (isError && ptr -> intervals == NULL) {
 
847
         goto erret;
 
848
      }
 
849
      atp = AsnReadId(aip,amp, atp);
 
850
   }
 
851
   if (atp == INSDFEATURE_quals) {
 
852
      ptr -> quals = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) INSDQualifierAsnRead, (AsnOptFreeFunc) INSDQualifierFree);
 
853
      if (isError && ptr -> quals == NULL) {
 
854
         goto erret;
 
855
      }
 
856
      atp = AsnReadId(aip,amp, atp);
 
857
   }
 
858
 
 
859
   if (AsnReadVal(aip, atp, &av) <= 0) {
 
860
      goto erret;
 
861
   }
 
862
   /* end struct */
 
863
 
 
864
ret:
 
865
   AsnUnlinkType(orig);       /* unlink local tree */
 
866
   return ptr;
 
867
 
 
868
erret:
 
869
   aip -> io_failure = TRUE;
 
870
   ptr = INSDFeatureFree(ptr);
 
871
   goto ret;
 
872
}
 
873
 
 
874
 
 
875
 
 
876
/**************************************************
 
877
*
 
878
*    INSDFeatureAsnWrite()
 
879
*
 
880
**************************************************/
 
881
NLM_EXTERN Boolean LIBCALL 
 
882
INSDFeatureAsnWrite(INSDFeaturePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
883
{
 
884
   DataVal av;
 
885
   AsnTypePtr atp;
 
886
   Boolean retval = FALSE;
 
887
 
 
888
   if (! loaded)
 
889
   {
 
890
      if (! objinsdseqAsnLoad()) {
 
891
         return FALSE;
 
892
      }
 
893
   }
 
894
 
 
895
   if (aip == NULL) {
 
896
      return FALSE;
 
897
   }
 
898
 
 
899
   atp = AsnLinkType(orig, INSDFEATURE);   /* link local tree */
 
900
   if (atp == NULL) {
 
901
      return FALSE;
 
902
   }
 
903
 
 
904
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
905
   if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
 
906
      goto erret;
 
907
   }
 
908
 
 
909
   if (ptr -> key != NULL) {
 
910
      av.ptrvalue = ptr -> key;
 
911
      retval = AsnWrite(aip, INSDFEATURE_key,  &av);
 
912
   }
 
913
   if (ptr -> location != NULL) {
 
914
      av.ptrvalue = ptr -> location;
 
915
      retval = AsnWrite(aip, INSDFEATURE_location,  &av);
 
916
   }
 
917
   AsnGenericUserSeqOfAsnWrite(ptr -> intervals, (AsnWriteFunc) INSDIntervalAsnWrite, aip, INSDFEATURE_intervals, INSDFEATURE_intervals_E);
 
918
   AsnGenericUserSeqOfAsnWrite(ptr -> quals, (AsnWriteFunc) INSDQualifierAsnWrite, aip, INSDFEATURE_quals, INSDFEATURE_quals_E);
 
919
   if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
 
920
      goto erret;
 
921
   }
 
922
   retval = TRUE;
 
923
 
 
924
erret:
 
925
   AsnUnlinkType(orig);       /* unlink local tree */
 
926
   return retval;
 
927
}
 
928
 
 
929
 
 
930
 
 
931
/**************************************************
 
932
*
 
933
*    INSDIntervalNew()
 
934
*
 
935
**************************************************/
 
936
NLM_EXTERN 
 
937
INSDIntervalPtr LIBCALL
 
938
INSDIntervalNew(void)
 
939
{
 
940
   INSDIntervalPtr ptr = MemNew((size_t) sizeof(INSDInterval));
 
941
 
 
942
   return ptr;
 
943
 
 
944
}
 
945
 
 
946
 
 
947
/**************************************************
 
948
*
 
949
*    INSDIntervalFree()
 
950
*
 
951
**************************************************/
 
952
NLM_EXTERN 
 
953
INSDIntervalPtr LIBCALL
 
954
INSDIntervalFree(INSDIntervalPtr ptr)
 
955
{
 
956
 
 
957
   if(ptr == NULL) {
 
958
      return NULL;
 
959
   }
 
960
   MemFree(ptr -> accession);
 
961
   return MemFree(ptr);
 
962
}
 
963
 
 
964
 
 
965
/**************************************************
 
966
*
 
967
*    INSDIntervalAsnRead()
 
968
*
 
969
**************************************************/
 
970
NLM_EXTERN 
 
971
INSDIntervalPtr LIBCALL
 
972
INSDIntervalAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
973
{
 
974
   DataVal av;
 
975
   AsnTypePtr atp;
 
976
   Boolean isError = FALSE;
 
977
   AsnReadFunc func;
 
978
   INSDIntervalPtr ptr;
 
979
 
 
980
   if (! loaded)
 
981
   {
 
982
      if (! objinsdseqAsnLoad()) {
 
983
         return NULL;
 
984
      }
 
985
   }
 
986
 
 
987
   if (aip == NULL) {
 
988
      return NULL;
 
989
   }
 
990
 
 
991
   if (orig == NULL) {         /* INSDInterval ::= (self contained) */
 
992
      atp = AsnReadId(aip, amp, INSDINTERVAL);
 
993
   } else {
 
994
      atp = AsnLinkType(orig, INSDINTERVAL);
 
995
   }
 
996
   /* link in local tree */
 
997
   if (atp == NULL) {
 
998
      return NULL;
 
999
   }
 
1000
 
 
1001
   ptr = INSDIntervalNew();
 
1002
   if (ptr == NULL) {
 
1003
      goto erret;
 
1004
   }
 
1005
   if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
 
1006
      goto erret;
 
1007
   }
 
1008
 
 
1009
   atp = AsnReadId(aip,amp, atp);
 
1010
   func = NULL;
 
1011
 
 
1012
   if (atp == INSDINTERVAL_from) {
 
1013
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
1014
         goto erret;
 
1015
      }
 
1016
      ptr -> from = av.intvalue;
 
1017
      ptr -> OBbits__ |= 1<<0;
 
1018
      atp = AsnReadId(aip,amp, atp);
 
1019
   }
 
1020
   if (atp == INSDINTERVAL_to) {
 
1021
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
1022
         goto erret;
 
1023
      }
 
1024
      ptr -> to = av.intvalue;
 
1025
      ptr -> OBbits__ |= 1<<1;
 
1026
      atp = AsnReadId(aip,amp, atp);
 
1027
   }
 
1028
   if (atp == INSDINTERVAL_point) {
 
1029
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
1030
         goto erret;
 
1031
      }
 
1032
      ptr -> point = av.intvalue;
 
1033
      ptr -> OBbits__ |= 1<<2;
 
1034
      atp = AsnReadId(aip,amp, atp);
 
1035
   }
 
1036
   if (atp == INSDINTERVAL_accession) {
 
1037
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
1038
         goto erret;
 
1039
      }
 
1040
      ptr -> accession = av.ptrvalue;
 
1041
      atp = AsnReadId(aip,amp, atp);
 
1042
   }
 
1043
 
 
1044
   if (AsnReadVal(aip, atp, &av) <= 0) {
 
1045
      goto erret;
 
1046
   }
 
1047
   /* end struct */
 
1048
 
 
1049
ret:
 
1050
   AsnUnlinkType(orig);       /* unlink local tree */
 
1051
   return ptr;
 
1052
 
 
1053
erret:
 
1054
   aip -> io_failure = TRUE;
 
1055
   ptr = INSDIntervalFree(ptr);
 
1056
   goto ret;
 
1057
}
 
1058
 
 
1059
 
 
1060
 
 
1061
/**************************************************
 
1062
*
 
1063
*    INSDIntervalAsnWrite()
 
1064
*
 
1065
**************************************************/
 
1066
NLM_EXTERN Boolean LIBCALL 
 
1067
INSDIntervalAsnWrite(INSDIntervalPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
1068
{
 
1069
   DataVal av;
 
1070
   AsnTypePtr atp;
 
1071
   Boolean retval = FALSE;
 
1072
 
 
1073
   if (! loaded)
 
1074
   {
 
1075
      if (! objinsdseqAsnLoad()) {
 
1076
         return FALSE;
 
1077
      }
 
1078
   }
 
1079
 
 
1080
   if (aip == NULL) {
 
1081
      return FALSE;
 
1082
   }
 
1083
 
 
1084
   atp = AsnLinkType(orig, INSDINTERVAL);   /* link local tree */
 
1085
   if (atp == NULL) {
 
1086
      return FALSE;
 
1087
   }
 
1088
 
 
1089
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
1090
   if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
 
1091
      goto erret;
 
1092
   }
 
1093
 
 
1094
   if (ptr -> from || (ptr -> OBbits__ & (1<<0) )){   av.intvalue = ptr -> from;
 
1095
      retval = AsnWrite(aip, INSDINTERVAL_from,  &av);
 
1096
   }
 
1097
   if (ptr -> to || (ptr -> OBbits__ & (1<<1) )){   av.intvalue = ptr -> to;
 
1098
      retval = AsnWrite(aip, INSDINTERVAL_to,  &av);
 
1099
   }
 
1100
   if (ptr -> point || (ptr -> OBbits__ & (1<<2) )){   av.intvalue = ptr -> point;
 
1101
      retval = AsnWrite(aip, INSDINTERVAL_point,  &av);
 
1102
   }
 
1103
   if (ptr -> accession != NULL) {
 
1104
      av.ptrvalue = ptr -> accession;
 
1105
      retval = AsnWrite(aip, INSDINTERVAL_accession,  &av);
 
1106
   }
 
1107
   if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
 
1108
      goto erret;
 
1109
   }
 
1110
   retval = TRUE;
 
1111
 
 
1112
erret:
 
1113
   AsnUnlinkType(orig);       /* unlink local tree */
 
1114
   return retval;
 
1115
}
 
1116
 
 
1117
 
 
1118
 
 
1119
/**************************************************
 
1120
*
 
1121
*    INSDQualifierNew()
 
1122
*
 
1123
**************************************************/
 
1124
NLM_EXTERN 
 
1125
INSDQualifierPtr LIBCALL
 
1126
INSDQualifierNew(void)
 
1127
{
 
1128
   INSDQualifierPtr ptr = MemNew((size_t) sizeof(INSDQualifier));
 
1129
 
 
1130
   return ptr;
 
1131
 
 
1132
}
 
1133
 
 
1134
 
 
1135
/**************************************************
 
1136
*
 
1137
*    INSDQualifierFree()
 
1138
*
 
1139
**************************************************/
 
1140
NLM_EXTERN 
 
1141
INSDQualifierPtr LIBCALL
 
1142
INSDQualifierFree(INSDQualifierPtr ptr)
 
1143
{
 
1144
 
 
1145
   if(ptr == NULL) {
 
1146
      return NULL;
 
1147
   }
 
1148
   MemFree(ptr -> name);
 
1149
   MemFree(ptr -> value);
 
1150
   return MemFree(ptr);
 
1151
}
 
1152
 
 
1153
 
 
1154
/**************************************************
 
1155
*
 
1156
*    INSDQualifierAsnRead()
 
1157
*
 
1158
**************************************************/
 
1159
NLM_EXTERN 
 
1160
INSDQualifierPtr LIBCALL
 
1161
INSDQualifierAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
1162
{
 
1163
   DataVal av;
 
1164
   AsnTypePtr atp;
 
1165
   Boolean isError = FALSE;
 
1166
   AsnReadFunc func;
 
1167
   INSDQualifierPtr ptr;
 
1168
 
 
1169
   if (! loaded)
 
1170
   {
 
1171
      if (! objinsdseqAsnLoad()) {
 
1172
         return NULL;
 
1173
      }
 
1174
   }
 
1175
 
 
1176
   if (aip == NULL) {
 
1177
      return NULL;
 
1178
   }
 
1179
 
 
1180
   if (orig == NULL) {         /* INSDQualifier ::= (self contained) */
 
1181
      atp = AsnReadId(aip, amp, INSDQUALIFIER);
 
1182
   } else {
 
1183
      atp = AsnLinkType(orig, INSDQUALIFIER);
 
1184
   }
 
1185
   /* link in local tree */
 
1186
   if (atp == NULL) {
 
1187
      return NULL;
 
1188
   }
 
1189
 
 
1190
   ptr = INSDQualifierNew();
 
1191
   if (ptr == NULL) {
 
1192
      goto erret;
 
1193
   }
 
1194
   if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
 
1195
      goto erret;
 
1196
   }
 
1197
 
 
1198
   atp = AsnReadId(aip,amp, atp);
 
1199
   func = NULL;
 
1200
 
 
1201
   if (atp == INSDQUALIFIER_name) {
 
1202
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
1203
         goto erret;
 
1204
      }
 
1205
      ptr -> name = av.ptrvalue;
 
1206
      atp = AsnReadId(aip,amp, atp);
 
1207
   }
 
1208
   if (atp == INSDQUALIFIER_value) {
 
1209
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
1210
         goto erret;
 
1211
      }
 
1212
      ptr -> value = av.ptrvalue;
 
1213
      atp = AsnReadId(aip,amp, atp);
 
1214
   }
 
1215
 
 
1216
   if (AsnReadVal(aip, atp, &av) <= 0) {
 
1217
      goto erret;
 
1218
   }
 
1219
   /* end struct */
 
1220
 
 
1221
ret:
 
1222
   AsnUnlinkType(orig);       /* unlink local tree */
 
1223
   return ptr;
 
1224
 
 
1225
erret:
 
1226
   aip -> io_failure = TRUE;
 
1227
   ptr = INSDQualifierFree(ptr);
 
1228
   goto ret;
 
1229
}
 
1230
 
 
1231
 
 
1232
 
 
1233
/**************************************************
 
1234
*
 
1235
*    INSDQualifierAsnWrite()
 
1236
*
 
1237
**************************************************/
 
1238
NLM_EXTERN Boolean LIBCALL 
 
1239
INSDQualifierAsnWrite(INSDQualifierPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
1240
{
 
1241
   DataVal av;
 
1242
   AsnTypePtr atp;
 
1243
   Boolean retval = FALSE;
 
1244
 
 
1245
   if (! loaded)
 
1246
   {
 
1247
      if (! objinsdseqAsnLoad()) {
 
1248
         return FALSE;
 
1249
      }
 
1250
   }
 
1251
 
 
1252
   if (aip == NULL) {
 
1253
      return FALSE;
 
1254
   }
 
1255
 
 
1256
   atp = AsnLinkType(orig, INSDQUALIFIER);   /* link local tree */
 
1257
   if (atp == NULL) {
 
1258
      return FALSE;
 
1259
   }
 
1260
 
 
1261
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
1262
   if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
 
1263
      goto erret;
 
1264
   }
 
1265
 
 
1266
   if (ptr -> name != NULL) {
 
1267
      av.ptrvalue = ptr -> name;
 
1268
      retval = AsnWrite(aip, INSDQUALIFIER_name,  &av);
 
1269
   }
 
1270
   if (ptr -> value != NULL) {
 
1271
      av.ptrvalue = ptr -> value;
 
1272
      retval = AsnWrite(aip, INSDQUALIFIER_value,  &av);
 
1273
   }
 
1274
   if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
 
1275
      goto erret;
 
1276
   }
 
1277
   retval = TRUE;
 
1278
 
 
1279
erret:
 
1280
   AsnUnlinkType(orig);       /* unlink local tree */
 
1281
   return retval;
 
1282
}
 
1283
 
 
1284
 
 
1285
 
 
1286
/**************************************************
 
1287
*
 
1288
*    INSDSetFree()
 
1289
*
 
1290
**************************************************/
 
1291
NLM_EXTERN 
 
1292
INSDSetPtr LIBCALL
 
1293
INSDSetFree(INSDSetPtr ptr)
 
1294
{
 
1295
 
 
1296
   if(ptr == NULL) {
 
1297
      return NULL;
 
1298
   }
 
1299
   AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) INSDSeqFree);
 
1300
   return NULL;
 
1301
}
 
1302
 
 
1303
 
 
1304
/**************************************************
 
1305
*
 
1306
*    INSDSetAsnRead()
 
1307
*
 
1308
**************************************************/
 
1309
NLM_EXTERN 
 
1310
INSDSetPtr LIBCALL
 
1311
INSDSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
1312
{
 
1313
   AsnTypePtr atp;
 
1314
   Boolean isError = FALSE;
 
1315
   AsnReadFunc func;
 
1316
   INSDSetPtr ptr;
 
1317
 
 
1318
   if (! loaded)
 
1319
   {
 
1320
      if (! objinsdseqAsnLoad()) {
 
1321
         return NULL;
 
1322
      }
 
1323
   }
 
1324
 
 
1325
   if (aip == NULL) {
 
1326
      return NULL;
 
1327
   }
 
1328
 
 
1329
   if (orig == NULL) {         /* INSDSet ::= (self contained) */
 
1330
      atp = AsnReadId(aip, amp, INSDSET);
 
1331
   } else {
 
1332
      atp = AsnLinkType(orig, INSDSET);
 
1333
   }
 
1334
   /* link in local tree */
 
1335
   if (atp == NULL) {
 
1336
      return NULL;
 
1337
   }
 
1338
 
 
1339
   func = NULL;
 
1340
 
 
1341
   ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) INSDSeqAsnRead, (AsnOptFreeFunc) INSDSeqFree);
 
1342
   if (isError && ptr  == NULL) {
 
1343
      goto erret;
 
1344
   }
 
1345
 
 
1346
 
 
1347
 
 
1348
ret:
 
1349
   AsnUnlinkType(orig);       /* unlink local tree */
 
1350
   return ptr;
 
1351
 
 
1352
erret:
 
1353
   aip -> io_failure = TRUE;
 
1354
   ptr = INSDSetFree(ptr);
 
1355
   goto ret;
 
1356
}
 
1357
 
 
1358
 
 
1359
 
 
1360
/**************************************************
 
1361
*
 
1362
*    INSDSetAsnWrite()
 
1363
*
 
1364
**************************************************/
 
1365
NLM_EXTERN Boolean LIBCALL 
 
1366
INSDSetAsnWrite(INSDSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
1367
{
 
1368
   AsnTypePtr atp;
 
1369
   Boolean retval = FALSE;
 
1370
 
 
1371
   if (! loaded)
 
1372
   {
 
1373
      if (! objinsdseqAsnLoad()) {
 
1374
         return FALSE;
 
1375
      }
 
1376
   }
 
1377
 
 
1378
   if (aip == NULL) {
 
1379
      return FALSE;
 
1380
   }
 
1381
 
 
1382
   atp = AsnLinkType(orig, INSDSET);   /* link local tree */
 
1383
   if (atp == NULL) {
 
1384
      return FALSE;
 
1385
   }
 
1386
 
 
1387
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
1388
   retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) INSDSeqAsnWrite, aip, atp, INSDSET_E);
 
1389
   retval = TRUE;
 
1390
 
 
1391
erret:
 
1392
   AsnUnlinkType(orig);       /* unlink local tree */
 
1393
   return retval;
 
1394
}
 
1395