~ubuntu-branches/ubuntu/saucy/ncbi-tools6/saucy-proposed

« back to all changes in this revision

Viewing changes to object/objvalid.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2009-08-11 22:03:47 UTC
  • mfrom: (1.4.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090811220347-g4b6lzdvphvvbpiu
* New upstream release.
* debian/libncbi6.symbols: update accordingly.
* debian/control: clean up obsolete or redundant relationship declarations.

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 <objvalid.h>
 
6
 
 
7
static Boolean loaded = FALSE;
 
8
 
 
9
#include <asnvalid.h>
 
10
 
 
11
#ifndef NLM_EXTERN_LOADS
 
12
#define NLM_EXTERN_LOADS {}
 
13
#endif
 
14
 
 
15
NLM_EXTERN Boolean LIBCALL
 
16
objvalidAsnLoad(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-Structured-comment-validation
 
34
*    Generated using ASNCODE Revision: 6.16 at Apr 7, 2009  1:38 PM
 
35
*
 
36
**************************************************/
 
37
 
 
38
 
 
39
/**************************************************
 
40
*
 
41
*    FieldRuleNew()
 
42
*
 
43
**************************************************/
 
44
NLM_EXTERN 
 
45
FieldRulePtr LIBCALL
 
46
FieldRuleNew(void)
 
47
{
 
48
   FieldRulePtr ptr = MemNew((size_t) sizeof(FieldRule));
 
49
 
 
50
   ptr -> required = 0;
 
51
   return ptr;
 
52
 
 
53
}
 
54
 
 
55
 
 
56
/**************************************************
 
57
*
 
58
*    FieldRuleFree()
 
59
*
 
60
**************************************************/
 
61
NLM_EXTERN 
 
62
FieldRulePtr LIBCALL
 
63
FieldRuleFree(FieldRulePtr ptr)
 
64
{
 
65
 
 
66
   if(ptr == NULL) {
 
67
      return NULL;
 
68
   }
 
69
   MemFree(ptr -> field_name);
 
70
   MemFree(ptr -> match_expression);
 
71
   return MemFree(ptr);
 
72
}
 
73
 
 
74
 
 
75
/**************************************************
 
76
*
 
77
*    FieldRuleAsnRead()
 
78
*
 
79
**************************************************/
 
80
NLM_EXTERN 
 
81
FieldRulePtr LIBCALL
 
82
FieldRuleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
83
{
 
84
   DataVal av;
 
85
   AsnTypePtr atp;
 
86
   Boolean isError = FALSE;
 
87
   AsnReadFunc func;
 
88
   FieldRulePtr ptr;
 
89
 
 
90
   if (! loaded)
 
91
   {
 
92
      if (! objvalidAsnLoad()) {
 
93
         return NULL;
 
94
      }
 
95
   }
 
96
 
 
97
   if (aip == NULL) {
 
98
      return NULL;
 
99
   }
 
100
 
 
101
   if (orig == NULL) {         /* FieldRule ::= (self contained) */
 
102
      atp = AsnReadId(aip, amp, FIELD_RULE);
 
103
   } else {
 
104
      atp = AsnLinkType(orig, FIELD_RULE);
 
105
   }
 
106
   /* link in local tree */
 
107
   if (atp == NULL) {
 
108
      return NULL;
 
109
   }
 
110
 
 
111
   ptr = FieldRuleNew();
 
112
   if (ptr == NULL) {
 
113
      goto erret;
 
114
   }
 
115
   if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
 
116
      goto erret;
 
117
   }
 
118
 
 
119
   atp = AsnReadId(aip,amp, atp);
 
120
   func = NULL;
 
121
 
 
122
   if (atp == FIELD_RULE_field_name) {
 
123
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
124
         goto erret;
 
125
      }
 
126
      ptr -> field_name = av.ptrvalue;
 
127
      atp = AsnReadId(aip,amp, atp);
 
128
   }
 
129
   if (atp == FIELD_RULE_match_expression) {
 
130
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
131
         goto erret;
 
132
      }
 
133
      ptr -> match_expression = av.ptrvalue;
 
134
      atp = AsnReadId(aip,amp, atp);
 
135
   }
 
136
   if (atp == FIELD_RULE_required) {
 
137
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
138
         goto erret;
 
139
      }
 
140
      ptr -> required = av.boolvalue;
 
141
      atp = AsnReadId(aip,amp, atp);
 
142
   }
 
143
 
 
144
   if (AsnReadVal(aip, atp, &av) <= 0) {
 
145
      goto erret;
 
146
   }
 
147
   /* end struct */
 
148
 
 
149
ret:
 
150
   AsnUnlinkType(orig);       /* unlink local tree */
 
151
   return ptr;
 
152
 
 
153
erret:
 
154
   aip -> io_failure = TRUE;
 
155
   ptr = FieldRuleFree(ptr);
 
156
   goto ret;
 
157
}
 
158
 
 
159
 
 
160
 
 
161
/**************************************************
 
162
*
 
163
*    FieldRuleAsnWrite()
 
164
*
 
165
**************************************************/
 
166
NLM_EXTERN Boolean LIBCALL 
 
167
FieldRuleAsnWrite(FieldRulePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
168
{
 
169
   DataVal av;
 
170
   AsnTypePtr atp;
 
171
   Boolean retval = FALSE;
 
172
 
 
173
   if (! loaded)
 
174
   {
 
175
      if (! objvalidAsnLoad()) {
 
176
         return FALSE;
 
177
      }
 
178
   }
 
179
 
 
180
   if (aip == NULL) {
 
181
      return FALSE;
 
182
   }
 
183
 
 
184
   atp = AsnLinkType(orig, FIELD_RULE);   /* link local tree */
 
185
   if (atp == NULL) {
 
186
      return FALSE;
 
187
   }
 
188
 
 
189
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
190
   if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
 
191
      goto erret;
 
192
   }
 
193
 
 
194
   if (ptr -> field_name != NULL) {
 
195
      av.ptrvalue = ptr -> field_name;
 
196
      retval = AsnWrite(aip, FIELD_RULE_field_name,  &av);
 
197
   }
 
198
   if (ptr -> match_expression != NULL) {
 
199
      av.ptrvalue = ptr -> match_expression;
 
200
      retval = AsnWrite(aip, FIELD_RULE_match_expression,  &av);
 
201
   }
 
202
   av.boolvalue = ptr -> required;
 
203
   retval = AsnWrite(aip, FIELD_RULE_required,  &av);
 
204
   if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
 
205
      goto erret;
 
206
   }
 
207
   retval = TRUE;
 
208
 
 
209
erret:
 
210
   AsnUnlinkType(orig);       /* unlink local tree */
 
211
   return retval;
 
212
}
 
213
 
 
214
 
 
215
 
 
216
/**************************************************
 
217
*
 
218
*    FieldSetFree()
 
219
*
 
220
**************************************************/
 
221
NLM_EXTERN 
 
222
FieldSetPtr LIBCALL
 
223
FieldSetFree(FieldSetPtr ptr)
 
224
{
 
225
 
 
226
   if(ptr == NULL) {
 
227
      return NULL;
 
228
   }
 
229
   AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) FieldRuleFree);
 
230
   return NULL;
 
231
}
 
232
 
 
233
 
 
234
/**************************************************
 
235
*
 
236
*    FieldSetAsnRead()
 
237
*
 
238
**************************************************/
 
239
NLM_EXTERN 
 
240
FieldSetPtr LIBCALL
 
241
FieldSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
242
{
 
243
   DataVal av;
 
244
   AsnTypePtr atp;
 
245
   Boolean isError = FALSE;
 
246
   AsnReadFunc func;
 
247
   FieldSetPtr ptr;
 
248
 
 
249
   if (! loaded)
 
250
   {
 
251
      if (! objvalidAsnLoad()) {
 
252
         return NULL;
 
253
      }
 
254
   }
 
255
 
 
256
   if (aip == NULL) {
 
257
      return NULL;
 
258
   }
 
259
 
 
260
   if (orig == NULL) {         /* FieldSet ::= (self contained) */
 
261
      atp = AsnReadId(aip, amp, FIELD_SET);
 
262
   } else {
 
263
      atp = AsnLinkType(orig, FIELD_SET);
 
264
   }
 
265
   /* link in local tree */
 
266
   if (atp == NULL) {
 
267
      return NULL;
 
268
   }
 
269
 
 
270
   func = NULL;
 
271
 
 
272
   ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) FieldRuleAsnRead, (AsnOptFreeFunc) FieldRuleFree);
 
273
   if (isError && ptr  == NULL) {
 
274
      goto erret;
 
275
   }
 
276
 
 
277
 
 
278
 
 
279
ret:
 
280
   AsnUnlinkType(orig);       /* unlink local tree */
 
281
   return ptr;
 
282
 
 
283
erret:
 
284
   aip -> io_failure = TRUE;
 
285
   ptr = FieldSetFree(ptr);
 
286
   goto ret;
 
287
}
 
288
 
 
289
 
 
290
 
 
291
/**************************************************
 
292
*
 
293
*    FieldSetAsnWrite()
 
294
*
 
295
**************************************************/
 
296
NLM_EXTERN Boolean LIBCALL 
 
297
FieldSetAsnWrite(FieldSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
298
{
 
299
   DataVal av;
 
300
   AsnTypePtr atp;
 
301
   Boolean retval = FALSE;
 
302
 
 
303
   if (! loaded)
 
304
   {
 
305
      if (! objvalidAsnLoad()) {
 
306
         return FALSE;
 
307
      }
 
308
   }
 
309
 
 
310
   if (aip == NULL) {
 
311
      return FALSE;
 
312
   }
 
313
 
 
314
   atp = AsnLinkType(orig, FIELD_SET);   /* link local tree */
 
315
   if (atp == NULL) {
 
316
      return FALSE;
 
317
   }
 
318
 
 
319
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
320
   retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) FieldRuleAsnWrite, aip, atp, FIELD_SET_E);
 
321
   retval = TRUE;
 
322
 
 
323
erret:
 
324
   AsnUnlinkType(orig);       /* unlink local tree */
 
325
   return retval;
 
326
}
 
327
 
 
328
 
 
329
 
 
330
/**************************************************
 
331
*
 
332
*    CommentRuleNew()
 
333
*
 
334
**************************************************/
 
335
NLM_EXTERN 
 
336
CommentRulePtr LIBCALL
 
337
CommentRuleNew(void)
 
338
{
 
339
   CommentRulePtr ptr = MemNew((size_t) sizeof(CommentRule));
 
340
 
 
341
   ptr -> updated = 0;
 
342
   return ptr;
 
343
 
 
344
}
 
345
 
 
346
 
 
347
/**************************************************
 
348
*
 
349
*    CommentRuleFree()
 
350
*
 
351
**************************************************/
 
352
NLM_EXTERN 
 
353
CommentRulePtr LIBCALL
 
354
CommentRuleFree(CommentRulePtr ptr)
 
355
{
 
356
 
 
357
   if(ptr == NULL) {
 
358
      return NULL;
 
359
   }
 
360
   MemFree(ptr -> prefix);
 
361
   FieldSetFree(ptr -> fields);
 
362
   return MemFree(ptr);
 
363
}
 
364
 
 
365
 
 
366
/**************************************************
 
367
*
 
368
*    CommentRuleAsnRead()
 
369
*
 
370
**************************************************/
 
371
NLM_EXTERN 
 
372
CommentRulePtr LIBCALL
 
373
CommentRuleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
374
{
 
375
   DataVal av;
 
376
   AsnTypePtr atp;
 
377
   Boolean isError = FALSE;
 
378
   AsnReadFunc func;
 
379
   CommentRulePtr ptr;
 
380
 
 
381
   if (! loaded)
 
382
   {
 
383
      if (! objvalidAsnLoad()) {
 
384
         return NULL;
 
385
      }
 
386
   }
 
387
 
 
388
   if (aip == NULL) {
 
389
      return NULL;
 
390
   }
 
391
 
 
392
   if (orig == NULL) {         /* CommentRule ::= (self contained) */
 
393
      atp = AsnReadId(aip, amp, COMMENT_RULE);
 
394
   } else {
 
395
      atp = AsnLinkType(orig, COMMENT_RULE);
 
396
   }
 
397
   /* link in local tree */
 
398
   if (atp == NULL) {
 
399
      return NULL;
 
400
   }
 
401
 
 
402
   ptr = CommentRuleNew();
 
403
   if (ptr == NULL) {
 
404
      goto erret;
 
405
   }
 
406
   if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
 
407
      goto erret;
 
408
   }
 
409
 
 
410
   atp = AsnReadId(aip,amp, atp);
 
411
   func = NULL;
 
412
 
 
413
   if (atp == COMMENT_RULE_prefix) {
 
414
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
415
         goto erret;
 
416
      }
 
417
      ptr -> prefix = av.ptrvalue;
 
418
      atp = AsnReadId(aip,amp, atp);
 
419
   }
 
420
   if (atp == COMMENT_RULE_updated) {
 
421
      if ( AsnReadVal(aip, atp, &av) <= 0) {
 
422
         goto erret;
 
423
      }
 
424
      ptr -> updated = av.boolvalue;
 
425
      atp = AsnReadId(aip,amp, atp);
 
426
   }
 
427
   if (atp == COMMENT_RULE_fields) {
 
428
      ptr -> fields = FieldSetAsnRead(aip, atp);
 
429
      if (aip -> io_failure) {
 
430
         goto erret;
 
431
      }
 
432
      atp = AsnReadId(aip,amp, atp);
 
433
   }
 
434
 
 
435
   if (AsnReadVal(aip, atp, &av) <= 0) {
 
436
      goto erret;
 
437
   }
 
438
   /* end struct */
 
439
 
 
440
ret:
 
441
   AsnUnlinkType(orig);       /* unlink local tree */
 
442
   return ptr;
 
443
 
 
444
erret:
 
445
   aip -> io_failure = TRUE;
 
446
   ptr = CommentRuleFree(ptr);
 
447
   goto ret;
 
448
}
 
449
 
 
450
 
 
451
 
 
452
/**************************************************
 
453
*
 
454
*    CommentRuleAsnWrite()
 
455
*
 
456
**************************************************/
 
457
NLM_EXTERN Boolean LIBCALL 
 
458
CommentRuleAsnWrite(CommentRulePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
459
{
 
460
   DataVal av;
 
461
   AsnTypePtr atp;
 
462
   Boolean retval = FALSE;
 
463
 
 
464
   if (! loaded)
 
465
   {
 
466
      if (! objvalidAsnLoad()) {
 
467
         return FALSE;
 
468
      }
 
469
   }
 
470
 
 
471
   if (aip == NULL) {
 
472
      return FALSE;
 
473
   }
 
474
 
 
475
   atp = AsnLinkType(orig, COMMENT_RULE);   /* link local tree */
 
476
   if (atp == NULL) {
 
477
      return FALSE;
 
478
   }
 
479
 
 
480
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
481
   if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
 
482
      goto erret;
 
483
   }
 
484
 
 
485
   if (ptr -> prefix != NULL) {
 
486
      av.ptrvalue = ptr -> prefix;
 
487
      retval = AsnWrite(aip, COMMENT_RULE_prefix,  &av);
 
488
   }
 
489
   av.boolvalue = ptr -> updated;
 
490
   retval = AsnWrite(aip, COMMENT_RULE_updated,  &av);
 
491
   if (ptr -> fields != NULL) {
 
492
      if ( ! FieldSetAsnWrite(ptr -> fields, aip, COMMENT_RULE_fields)) {
 
493
         goto erret;
 
494
      }
 
495
   }
 
496
   if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
 
497
      goto erret;
 
498
   }
 
499
   retval = TRUE;
 
500
 
 
501
erret:
 
502
   AsnUnlinkType(orig);       /* unlink local tree */
 
503
   return retval;
 
504
}
 
505
 
 
506
 
 
507
 
 
508
/**************************************************
 
509
*
 
510
*    CommentSetFree()
 
511
*
 
512
**************************************************/
 
513
NLM_EXTERN 
 
514
CommentSetPtr LIBCALL
 
515
CommentSetFree(CommentSetPtr ptr)
 
516
{
 
517
 
 
518
   if(ptr == NULL) {
 
519
      return NULL;
 
520
   }
 
521
   AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) CommentRuleFree);
 
522
   return NULL;
 
523
}
 
524
 
 
525
 
 
526
/**************************************************
 
527
*
 
528
*    CommentSetAsnRead()
 
529
*
 
530
**************************************************/
 
531
NLM_EXTERN 
 
532
CommentSetPtr LIBCALL
 
533
CommentSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 
534
{
 
535
   DataVal av;
 
536
   AsnTypePtr atp;
 
537
   Boolean isError = FALSE;
 
538
   AsnReadFunc func;
 
539
   CommentSetPtr ptr;
 
540
 
 
541
   if (! loaded)
 
542
   {
 
543
      if (! objvalidAsnLoad()) {
 
544
         return NULL;
 
545
      }
 
546
   }
 
547
 
 
548
   if (aip == NULL) {
 
549
      return NULL;
 
550
   }
 
551
 
 
552
   if (orig == NULL) {         /* CommentSet ::= (self contained) */
 
553
      atp = AsnReadId(aip, amp, COMMENT_SET);
 
554
   } else {
 
555
      atp = AsnLinkType(orig, COMMENT_SET);
 
556
   }
 
557
   /* link in local tree */
 
558
   if (atp == NULL) {
 
559
      return NULL;
 
560
   }
 
561
 
 
562
   func = NULL;
 
563
 
 
564
   ptr  = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) CommentRuleAsnRead, (AsnOptFreeFunc) CommentRuleFree);
 
565
   if (isError && ptr  == NULL) {
 
566
      goto erret;
 
567
   }
 
568
 
 
569
 
 
570
 
 
571
ret:
 
572
   AsnUnlinkType(orig);       /* unlink local tree */
 
573
   return ptr;
 
574
 
 
575
erret:
 
576
   aip -> io_failure = TRUE;
 
577
   ptr = CommentSetFree(ptr);
 
578
   goto ret;
 
579
}
 
580
 
 
581
 
 
582
 
 
583
/**************************************************
 
584
*
 
585
*    CommentSetAsnWrite()
 
586
*
 
587
**************************************************/
 
588
NLM_EXTERN Boolean LIBCALL 
 
589
CommentSetAsnWrite(CommentSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
 
590
{
 
591
   DataVal av;
 
592
   AsnTypePtr atp;
 
593
   Boolean retval = FALSE;
 
594
 
 
595
   if (! loaded)
 
596
   {
 
597
      if (! objvalidAsnLoad()) {
 
598
         return FALSE;
 
599
      }
 
600
   }
 
601
 
 
602
   if (aip == NULL) {
 
603
      return FALSE;
 
604
   }
 
605
 
 
606
   atp = AsnLinkType(orig, COMMENT_SET);   /* link local tree */
 
607
   if (atp == NULL) {
 
608
      return FALSE;
 
609
   }
 
610
 
 
611
   if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
 
612
   retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) CommentRuleAsnWrite, aip, atp, COMMENT_SET_E);
 
613
   retval = TRUE;
 
614
 
 
615
erret:
 
616
   AsnUnlinkType(orig);       /* unlink local tree */
 
617
   return retval;
 
618
}
 
619