NCBI C Toolkit Cross Reference

C/object/objalignloc.c


  1 #include <asn.h>
  2 
  3 #define NLM_GENERATED_CODE_PROTO
  4 
  5 #include <alignloc.h>
  6 #include <objalignloc.h>
  7 
  8 static Boolean loaded = FALSE;
  9 
 10 #include <objgen.h>
 11 
 12 #ifndef NLM_EXTERN_LOADS
 13 #define NLM_EXTERN_LOADS {}
 14 #endif
 15 
 16 NLM_EXTERN Boolean LIBCALL
 17 objalignlocAsnLoad(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-Alignloc
 35 *    Generated using ASNCODE Revision: 6.8 at Aug 13, 1999  2:44 PM
 36 *
 37 **************************************************/
 38 
 39 
 40 /**************************************************
 41 *
 42 *    AlignLocSetFree()
 43 *
 44 **************************************************/
 45 NLM_EXTERN 
 46 AlignLocSetPtr LIBCALL
 47 AlignLocSetFree(AlignLocSetPtr ptr)
 48 {
 49 
 50    if(ptr == NULL) {
 51       return NULL;
 52    }
 53    AsnGenericUserSeqOfFree(ptr,  (AsnOptFreeFunc) AlignLocFree);
 54    return NULL;
 55 }
 56 
 57 
 58 /**************************************************
 59 *
 60 *    AlignLocSetAsnRead()
 61 *
 62 **************************************************/
 63 NLM_EXTERN 
 64 AlignLocSetPtr LIBCALL
 65 AlignLocSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
 66 {
 67    AsnTypePtr atp;
 68    Boolean isError = FALSE;
 69    AsnReadFunc func;
 70    AlignLocSetPtr ptr;
 71 
 72    if (! loaded)
 73    {
 74       if (! objalignlocAsnLoad()) {
 75          return NULL;
 76       }
 77    }
 78 
 79    if (aip == NULL) {
 80       return NULL;
 81    }
 82 
 83    if (orig == NULL) {         /* AlignLocSet ::= (self contained) */
 84       atp = AsnReadId(aip, amp, ALIGN_LOC_SET);
 85    } else {
 86       atp = AsnLinkType(orig, ALIGN_LOC_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) AlignLocAsnRead, (AsnOptFreeFunc) AlignLocFree);
 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 = AlignLocSetFree(ptr);
109    goto ret;
110 }
111 
112 
113 
114 /**************************************************
115 *
116 *    AlignLocSetAsnWrite()
117 *
118 **************************************************/
119 NLM_EXTERN Boolean LIBCALL 
120 AlignLocSetAsnWrite(AlignLocSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
121 {
122    AsnTypePtr atp;
123    Boolean retval = FALSE;
124 
125    if (! loaded)
126    {
127       if (! objalignlocAsnLoad()) {
128          return FALSE;
129       }
130    }
131 
132    if (aip == NULL) {
133       return FALSE;
134    }
135 
136    atp = AsnLinkType(orig, ALIGN_LOC_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) AlignLocAsnWrite, aip, atp, ALIGN_LOC_SET_E);
143    retval = TRUE;
144 
145 erret:
146    AsnUnlinkType(orig);       /* unlink local tree */
147    return retval;
148 }
149 
150 
151 
152 /**************************************************
153 *
154 *    AlignLocNew()
155 *
156 **************************************************/
157 NLM_EXTERN 
158 AlignLocPtr LIBCALL
159 AlignLocNew(void)
160 {
161    AlignLocPtr ptr = MemNew((size_t) sizeof(AlignLoc));
162 
163    return ptr;
164 
165 }
166 
167 
168 /**************************************************
169 *
170 *    AlignLocFree()
171 *
172 **************************************************/
173 NLM_EXTERN 
174 AlignLocPtr LIBCALL
175 AlignLocFree(AlignLocPtr ptr)
176 {
177 
178    if(ptr == NULL) {
179       return NULL;
180    }
181    AlignIdFree(ptr -> id);
182    Loc_locFree(ptr -> Loc_loc);
183    return MemFree(ptr);
184 }
185 
186 
187 /**************************************************
188 *
189 *    Loc_locFree()
190 *
191 **************************************************/
192 static 
193 Loc_locPtr LIBCALL
194 Loc_locFree(ValNodePtr anp)
195 {
196    Pointer pnt;
197 
198    if (anp == NULL) {
199       return NULL;
200    }
201 
202    pnt = anp->data.ptrvalue;
203    switch (anp->choice)
204    {
205    default:
206       break;
207    case Loc_loc_box:
208       AlignBoxFree(anp -> data.ptrvalue);
209       break;
210    case Loc_loc_rows:
211       AlignRowsFree(anp -> data.ptrvalue);
212       break;
213    case Loc_loc_columns:
214       AlignColumnsFree(anp -> data.ptrvalue);
215       break;
216    }
217    return MemFree(anp);
218 }
219 
220 
221 /**************************************************
222 *
223 *    AlignLocAsnRead()
224 *
225 **************************************************/
226 NLM_EXTERN 
227 AlignLocPtr LIBCALL
228 AlignLocAsnRead(AsnIoPtr aip, AsnTypePtr orig)
229 {
230    DataVal av;
231    AsnTypePtr atp;
232    Boolean isError = FALSE;
233    AsnReadFunc func;
234    AlignLocPtr ptr;
235 
236    if (! loaded)
237    {
238       if (! objalignlocAsnLoad()) {
239          return NULL;
240       }
241    }
242 
243    if (aip == NULL) {
244       return NULL;
245    }
246 
247    if (orig == NULL) {         /* AlignLoc ::= (self contained) */
248       atp = AsnReadId(aip, amp, ALIGN_LOC);
249    } else {
250       atp = AsnLinkType(orig, ALIGN_LOC);
251    }
252    /* link in local tree */
253    if (atp == NULL) {
254       return NULL;
255    }
256 
257    ptr = AlignLocNew();
258    if (ptr == NULL) {
259       goto erret;
260    }
261    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
262       goto erret;
263    }
264 
265    atp = AsnReadId(aip,amp, atp);
266    func = NULL;
267 
268    if (atp == ALIGN_LOC_id) {
269       ptr -> id = AlignIdAsnRead(aip, atp);
270       if (aip -> io_failure) {
271          goto erret;
272       }
273       atp = AsnReadId(aip,amp, atp);
274    }
275    if (atp == ALIGN_LOC_loc) {
276       ptr -> Loc_loc = Loc_locAsnRead(aip, atp);
277       if (aip -> io_failure) {
278          goto erret;
279       }
280       atp = AsnReadId(aip,amp, atp);
281    }
282 
283    if (AsnReadVal(aip, atp, &av) <= 0) {
284       goto erret;
285    }
286    /* end struct */
287 
288 ret:
289    AsnUnlinkType(orig);       /* unlink local tree */
290    return ptr;
291 
292 erret:
293    aip -> io_failure = TRUE;
294    ptr = AlignLocFree(ptr);
295    goto ret;
296 }
297 
298 
299 
300 /**************************************************
301 *
302 *    Loc_locAsnRead()
303 *
304 **************************************************/
305 static 
306 Loc_locPtr LIBCALL
307 Loc_locAsnRead(AsnIoPtr aip, AsnTypePtr orig)
308 {
309    DataVal av;
310    AsnTypePtr atp;
311    ValNodePtr anp;
312    Uint1 choice;
313    Boolean isError = FALSE;
314    Boolean nullIsError = FALSE;
315    AsnReadFunc func;
316 
317    if (! loaded)
318    {
319       if (! objalignlocAsnLoad()) {
320          return NULL;
321       }
322    }
323 
324    if (aip == NULL) {
325       return NULL;
326    }
327 
328    if (orig == NULL) {         /* Loc_loc ::= (self contained) */
329       atp = AsnReadId(aip, amp, ALIGN_LOC_loc);
330    } else {
331       atp = AsnLinkType(orig, ALIGN_LOC_loc);    /* link in local tree */
332    }
333    if (atp == NULL) {
334       return NULL;
335    }
336 
337    anp = ValNodeNew(NULL);
338    if (anp == NULL) {
339       goto erret;
340    }
341    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
342       goto erret;
343    }
344 
345    func = NULL;
346 
347    atp = AsnReadId(aip, amp, atp);  /* find the choice */
348    if (atp == NULL) {
349       goto erret;
350    }
351    if (atp == ALIGN_LOC_loc_whole) {
352       choice = Loc_loc_whole;
353       if (AsnReadVal(aip, atp, &av) <= 0) {
354          goto erret;
355       }
356       anp->data.boolvalue = av.boolvalue;
357    }
358    else if (atp == ALIGN_LOC_loc_box) {
359       choice = Loc_loc_box;
360       func = (AsnReadFunc) AlignBoxAsnRead;
361    }
362    else if (atp == ALIGN_LOC_loc_rows) {
363       choice = Loc_loc_rows;
364       func = (AsnReadFunc) AlignRowsAsnRead;
365    }
366    else if (atp == ALIGN_LOC_loc_columns) {
367       choice = Loc_loc_columns;
368       func = (AsnReadFunc) AlignColumnsAsnRead;
369    }
370    anp->choice = choice;
371    if (func != NULL)
372    {
373       anp->data.ptrvalue = (* func)(aip, atp);
374       if (aip -> io_failure) goto erret;
375 
376       if (nullIsError && anp->data.ptrvalue == NULL) {
377          goto erret;
378       }
379    }
380 
381 ret:
382    AsnUnlinkType(orig);       /* unlink local tree */
383    return anp;
384 
385 erret:
386    anp = MemFree(anp);
387    aip -> io_failure = TRUE;
388    goto ret;
389 }
390 
391 
392 /**************************************************
393 *
394 *    AlignLocAsnWrite()
395 *
396 **************************************************/
397 NLM_EXTERN Boolean LIBCALL 
398 AlignLocAsnWrite(AlignLocPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
399 {
400    AsnTypePtr atp;
401    Boolean retval = FALSE;
402 
403    if (! loaded)
404    {
405       if (! objalignlocAsnLoad()) {
406          return FALSE;
407       }
408    }
409 
410    if (aip == NULL) {
411       return FALSE;
412    }
413 
414    atp = AsnLinkType(orig, ALIGN_LOC);   /* link local tree */
415    if (atp == NULL) {
416       return FALSE;
417    }
418 
419    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
420    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
421       goto erret;
422    }
423 
424    if (ptr -> id != NULL) {
425       if ( ! AlignIdAsnWrite(ptr -> id, aip, ALIGN_LOC_id)) {
426          goto erret;
427       }
428    }
429    if (ptr -> Loc_loc != NULL) {
430       if ( ! Loc_locAsnWrite(ptr -> Loc_loc, aip, ALIGN_LOC_loc)) {
431          goto erret;
432       }
433    }
434    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
435       goto erret;
436    }
437    retval = TRUE;
438 
439 erret:
440    AsnUnlinkType(orig);       /* unlink local tree */
441    return retval;
442 }
443 
444 
445 
446 /**************************************************
447 *
448 *    Loc_locAsnWrite()
449 *
450 **************************************************/
451 static Boolean LIBCALL 
452 Loc_locAsnWrite(Loc_locPtr anp, AsnIoPtr aip, AsnTypePtr orig)
453 
454 {
455    DataVal av;
456    AsnTypePtr atp, writetype = NULL;
457    Pointer pnt;
458    AsnWriteFunc func = NULL;
459    Boolean retval = FALSE;
460 
461    if (! loaded)
462    {
463       if (! objalignlocAsnLoad())
464       return FALSE;
465    }
466 
467    if (aip == NULL)
468    return FALSE;
469 
470    atp = AsnLinkType(orig, ALIGN_LOC_loc);   /* link local tree */
471    if (atp == NULL) {
472       return FALSE;
473    }
474 
475    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
476 
477    av.ptrvalue = (Pointer)anp;
478    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
479       goto erret;
480    }
481 
482    pnt = anp->data.ptrvalue;
483    switch (anp->choice)
484    {
485    case Loc_loc_whole:
486       av.boolvalue = anp->data.boolvalue;
487       retval = AsnWrite(aip, ALIGN_LOC_loc_whole, &av);
488       break;
489    case Loc_loc_box:
490       writetype = ALIGN_LOC_loc_box;
491       func = (AsnWriteFunc) AlignBoxAsnWrite;
492       break;
493    case Loc_loc_rows:
494       writetype = ALIGN_LOC_loc_rows;
495       func = (AsnWriteFunc) AlignRowsAsnWrite;
496       break;
497    case Loc_loc_columns:
498       writetype = ALIGN_LOC_loc_columns;
499       func = (AsnWriteFunc) AlignColumnsAsnWrite;
500       break;
501    }
502    if (writetype != NULL) {
503       retval = (* func)(pnt, aip, writetype);   /* write it out */
504    }
505    if (!retval) {
506       goto erret;
507    }
508    retval = TRUE;
509 
510 erret:
511    AsnUnlinkType(orig);       /* unlink local tree */
512    return retval;
513 }
514 
515 
516 /**************************************************
517 *
518 *    AlignIdFree()
519 *
520 **************************************************/
521 NLM_EXTERN 
522 AlignIdPtr LIBCALL
523 AlignIdFree(ValNodePtr anp)
524 {
525    Pointer pnt;
526 
527    if (anp == NULL) {
528       return NULL;
529    }
530 
531    pnt = anp->data.ptrvalue;
532    switch (anp->choice)
533    {
534    default:
535       break;
536    case AlignId_id:
537       ObjectIdFree(anp -> data.ptrvalue);
538       break;
539    }
540    return MemFree(anp);
541 }
542 
543 
544 /**************************************************
545 *
546 *    AlignIdAsnRead()
547 *
548 **************************************************/
549 NLM_EXTERN 
550 AlignIdPtr LIBCALL
551 AlignIdAsnRead(AsnIoPtr aip, AsnTypePtr orig)
552 {
553    DataVal av;
554    AsnTypePtr atp;
555    ValNodePtr anp;
556    Uint1 choice;
557    Boolean isError = FALSE;
558    Boolean nullIsError = FALSE;
559    AsnReadFunc func;
560 
561    if (! loaded)
562    {
563       if (! objalignlocAsnLoad()) {
564          return NULL;
565       }
566    }
567 
568    if (aip == NULL) {
569       return NULL;
570    }
571 
572    if (orig == NULL) {         /* AlignId ::= (self contained) */
573       atp = AsnReadId(aip, amp, ALIGN_ID);
574    } else {
575       atp = AsnLinkType(orig, ALIGN_ID);    /* link in local tree */
576    }
577    if (atp == NULL) {
578       return NULL;
579    }
580 
581    anp = ValNodeNew(NULL);
582    if (anp == NULL) {
583       goto erret;
584    }
585    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
586       goto erret;
587    }
588 
589    func = NULL;
590 
591    atp = AsnReadId(aip, amp, atp);  /* find the choice */
592    if (atp == NULL) {
593       goto erret;
594    }
595    if (atp == ALIGN_ID_id) {
596       choice = AlignId_id;
597       func = (AsnReadFunc) ObjectIdAsnRead;
598    }
599    else if (atp == ALIGN_ID_itemid) {
600       choice = AlignId_itemid;
601       if (AsnReadVal(aip, atp, &av) <= 0) {
602          goto erret;
603       }
604       anp->data.intvalue = av.intvalue;
605    }
606    else if (atp == ALIGN_ID_gi) {
607       choice = AlignId_gi;
608       if (AsnReadVal(aip, atp, &av) <= 0) {
609          goto erret;
610       }
611       anp->data.intvalue = av.intvalue;
612    }
613    anp->choice = choice;
614    if (func != NULL)
615    {
616       anp->data.ptrvalue = (* func)(aip, atp);
617       if (aip -> io_failure) goto erret;
618 
619       if (nullIsError && anp->data.ptrvalue == NULL) {
620          goto erret;
621       }
622    }
623 
624 ret:
625    AsnUnlinkType(orig);       /* unlink local tree */
626    return anp;
627 
628 erret:
629    anp = MemFree(anp);
630    aip -> io_failure = TRUE;
631    goto ret;
632 }
633 
634 
635 /**************************************************
636 *
637 *    AlignIdAsnWrite()
638 *
639 **************************************************/
640 NLM_EXTERN Boolean LIBCALL 
641 AlignIdAsnWrite(AlignIdPtr anp, AsnIoPtr aip, AsnTypePtr orig)
642 
643 {
644    DataVal av;
645    AsnTypePtr atp, writetype = NULL;
646    Pointer pnt;
647    AsnWriteFunc func = NULL;
648    Boolean retval = FALSE;
649 
650    if (! loaded)
651    {
652       if (! objalignlocAsnLoad())
653       return FALSE;
654    }
655 
656    if (aip == NULL)
657    return FALSE;
658 
659    atp = AsnLinkType(orig, ALIGN_ID);   /* link local tree */
660    if (atp == NULL) {
661       return FALSE;
662    }
663 
664    if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
665 
666    av.ptrvalue = (Pointer)anp;
667    if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
668       goto erret;
669    }
670 
671    pnt = anp->data.ptrvalue;
672    switch (anp->choice)
673    {
674    case AlignId_id:
675       writetype = ALIGN_ID_id;
676       func = (AsnWriteFunc) ObjectIdAsnWrite;
677       break;
678    case AlignId_itemid:
679       av.intvalue = anp->data.intvalue;
680       retval = AsnWrite(aip, ALIGN_ID_itemid, &av);
681       break;
682    case AlignId_gi:
683       av.intvalue = anp->data.intvalue;
684       retval = AsnWrite(aip, ALIGN_ID_gi, &av);
685       break;
686    }
687    if (writetype != NULL) {
688       retval = (* func)(pnt, aip, writetype);   /* write it out */
689    }
690    if (!retval) {
691       goto erret;
692    }
693    retval = TRUE;
694 
695 erret:
696    AsnUnlinkType(orig);       /* unlink local tree */
697    return retval;
698 }
699 
700 
701 /**************************************************
702 *
703 *    AlignBoxNew()
704 *
705 **************************************************/
706 NLM_EXTERN 
707 AlignBoxPtr LIBCALL
708 AlignBoxNew(void)
709 {
710    AlignBoxPtr ptr = MemNew((size_t) sizeof(AlignBox));
711 
712    return ptr;
713 
714 }
715 
716 
717 /**************************************************
718 *
719 *    AlignBoxFree()
720 *
721 **************************************************/
722 NLM_EXTERN 
723 AlignBoxPtr LIBCALL
724 AlignBoxFree(AlignBoxPtr ptr)
725 {
726 
727    if(ptr == NULL) {
728       return NULL;
729    }
730    return MemFree(ptr);
731 }
732 
733 
734 /**************************************************
735 *
736 *    AlignBoxAsnRead()
737 *
738 **************************************************/
739 NLM_EXTERN 
740 AlignBoxPtr LIBCALL
741 AlignBoxAsnRead(AsnIoPtr aip, AsnTypePtr orig)
742 {
743    DataVal av;
744    AsnTypePtr atp;
745    Boolean isError = FALSE;
746    AsnReadFunc func;
747    AlignBoxPtr ptr;
748 
749    if (! loaded)
750    {
751       if (! objalignlocAsnLoad()) {
752          return NULL;
753       }
754    }
755 
756    if (aip == NULL) {
757       return NULL;
758    }
759 
760    if (orig == NULL) {         /* AlignBox ::= (self contained) */
761       atp = AsnReadId(aip, amp, ALIGN_BOX);
762    } else {
763       atp = AsnLinkType(orig, ALIGN_BOX);
764    }
765    /* link in local tree */
766    if (atp == NULL) {
767       return NULL;
768    }
769 
770    ptr = AlignBoxNew();
771    if (ptr == NULL) {
772       goto erret;
773    }
774    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
775       goto erret;
776    }
777 
778    atp = AsnReadId(aip,amp, atp);
779    func = NULL;
780 
781    if (atp == ALIGN_BOX_row_from) {
782       if ( AsnReadVal(aip, atp, &av) <= 0) {
783          goto erret;
784       }
785       ptr -> row_from = av.intvalue;
786       atp = AsnReadId(aip,amp, atp);
787    }
788    if (atp == ALIGN_BOX_row_to) {
789       if ( AsnReadVal(aip, atp, &av) <= 0) {
790          goto erret;
791       }
792       ptr -> row_to = av.intvalue;
793       atp = AsnReadId(aip,amp, atp);
794    }
795    if (atp == ALIGN_BOX_column_from) {
796       if ( AsnReadVal(aip, atp, &av) <= 0) {
797          goto erret;
798       }
799       ptr -> column_from = av.intvalue;
800       atp = AsnReadId(aip,amp, atp);
801    }
802    if (atp == ALIGN_BOX_column_to) {
803       if ( AsnReadVal(aip, atp, &av) <= 0) {
804          goto erret;
805       }
806       ptr -> column_to = av.intvalue;
807       atp = AsnReadId(aip,amp, atp);
808    }
809 
810    if (AsnReadVal(aip, atp, &av) <= 0) {
811       goto erret;
812    }
813    /* end struct */
814 
815 ret:
816    AsnUnlinkType(orig);       /* unlink local tree */
817    return ptr;
818 
819 erret:
820    aip -> io_failure = TRUE;
821    ptr = AlignBoxFree(ptr);
822    goto ret;
823 }
824 
825 
826 
827 /**************************************************
828 *
829 *    AlignBoxAsnWrite()
830 *
831 **************************************************/
832 NLM_EXTERN Boolean LIBCALL 
833 AlignBoxAsnWrite(AlignBoxPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
834 {
835    DataVal av;
836    AsnTypePtr atp;
837    Boolean retval = FALSE;
838 
839    if (! loaded)
840    {
841       if (! objalignlocAsnLoad()) {
842          return FALSE;
843       }
844    }
845 
846    if (aip == NULL) {
847       return FALSE;
848    }
849 
850    atp = AsnLinkType(orig, ALIGN_BOX);   /* link local tree */
851    if (atp == NULL) {
852       return FALSE;
853    }
854 
855    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
856    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
857       goto erret;
858    }
859 
860    av.intvalue = ptr -> row_from;
861    retval = AsnWrite(aip, ALIGN_BOX_row_from,  &av);
862    av.intvalue = ptr -> row_to;
863    retval = AsnWrite(aip, ALIGN_BOX_row_to,  &av);
864    av.intvalue = ptr -> column_from;
865    retval = AsnWrite(aip, ALIGN_BOX_column_from,  &av);
866    av.intvalue = ptr -> column_to;
867    retval = AsnWrite(aip, ALIGN_BOX_column_to,  &av);
868    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
869       goto erret;
870    }
871    retval = TRUE;
872 
873 erret:
874    AsnUnlinkType(orig);       /* unlink local tree */
875    return retval;
876 }
877 
878 
879 
880 /**************************************************
881 *
882 *    AlignRowsNew()
883 *
884 **************************************************/
885 NLM_EXTERN 
886 AlignRowsPtr LIBCALL
887 AlignRowsNew(void)
888 {
889    AlignRowsPtr ptr = MemNew((size_t) sizeof(AlignRows));
890 
891    return ptr;
892 
893 }
894 
895 
896 /**************************************************
897 *
898 *    AlignRowsFree()
899 *
900 **************************************************/
901 NLM_EXTERN 
902 AlignRowsPtr LIBCALL
903 AlignRowsFree(AlignRowsPtr ptr)
904 {
905 
906    if(ptr == NULL) {
907       return NULL;
908    }
909    return MemFree(ptr);
910 }
911 
912 
913 /**************************************************
914 *
915 *    AlignRowsAsnRead()
916 *
917 **************************************************/
918 NLM_EXTERN 
919 AlignRowsPtr LIBCALL
920 AlignRowsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
921 {
922    DataVal av;
923    AsnTypePtr atp;
924    Boolean isError = FALSE;
925    AsnReadFunc func;
926    AlignRowsPtr ptr;
927 
928    if (! loaded)
929    {
930       if (! objalignlocAsnLoad()) {
931          return NULL;
932       }
933    }
934 
935    if (aip == NULL) {
936       return NULL;
937    }
938 
939    if (orig == NULL) {         /* AlignRows ::= (self contained) */
940       atp = AsnReadId(aip, amp, ALIGN_ROWS);
941    } else {
942       atp = AsnLinkType(orig, ALIGN_ROWS);
943    }
944    /* link in local tree */
945    if (atp == NULL) {
946       return NULL;
947    }
948 
949    ptr = AlignRowsNew();
950    if (ptr == NULL) {
951       goto erret;
952    }
953    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
954       goto erret;
955    }
956 
957    atp = AsnReadId(aip,amp, atp);
958    func = NULL;
959 
960    if (atp == ALIGN_ROWS_from) {
961       if ( AsnReadVal(aip, atp, &av) <= 0) {
962          goto erret;
963       }
964       ptr -> from = av.intvalue;
965       atp = AsnReadId(aip,amp, atp);
966    }
967    if (atp == ALIGN_ROWS_to) {
968       if ( AsnReadVal(aip, atp, &av) <= 0) {
969          goto erret;
970       }
971       ptr -> to = av.intvalue;
972       atp = AsnReadId(aip,amp, atp);
973    }
974 
975    if (AsnReadVal(aip, atp, &av) <= 0) {
976       goto erret;
977    }
978    /* end struct */
979 
980 ret:
981    AsnUnlinkType(orig);       /* unlink local tree */
982    return ptr;
983 
984 erret:
985    aip -> io_failure = TRUE;
986    ptr = AlignRowsFree(ptr);
987    goto ret;
988 }
989 
990 
991 
992 /**************************************************
993 *
994 *    AlignRowsAsnWrite()
995 *
996 **************************************************/
997 NLM_EXTERN Boolean LIBCALL 
998 AlignRowsAsnWrite(AlignRowsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
999 {
1000    DataVal av;
1001    AsnTypePtr atp;
1002    Boolean retval = FALSE;
1003 
1004    if (! loaded)
1005    {
1006       if (! objalignlocAsnLoad()) {
1007          return FALSE;
1008       }
1009    }
1010 
1011    if (aip == NULL) {
1012       return FALSE;
1013    }
1014 
1015    atp = AsnLinkType(orig, ALIGN_ROWS);   /* link local tree */
1016    if (atp == NULL) {
1017       return FALSE;
1018    }
1019 
1020    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1021    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1022       goto erret;
1023    }
1024 
1025    av.intvalue = ptr -> from;
1026    retval = AsnWrite(aip, ALIGN_ROWS_from,  &av);
1027    av.intvalue = ptr -> to;
1028    retval = AsnWrite(aip, ALIGN_ROWS_to,  &av);
1029    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1030       goto erret;
1031    }
1032    retval = TRUE;
1033 
1034 erret:
1035    AsnUnlinkType(orig);       /* unlink local tree */
1036    return retval;
1037 }
1038 
1039 
1040 
1041 /**************************************************
1042 *
1043 *    AlignColumnsNew()
1044 *
1045 **************************************************/
1046 NLM_EXTERN 
1047 AlignColumnsPtr LIBCALL
1048 AlignColumnsNew(void)
1049 {
1050    AlignColumnsPtr ptr = MemNew((size_t) sizeof(AlignColumns));
1051 
1052    return ptr;
1053 
1054 }
1055 
1056 
1057 /**************************************************
1058 *
1059 *    AlignColumnsFree()
1060 *
1061 **************************************************/
1062 NLM_EXTERN 
1063 AlignColumnsPtr LIBCALL
1064 AlignColumnsFree(AlignColumnsPtr ptr)
1065 {
1066 
1067    if(ptr == NULL) {
1068       return NULL;
1069    }
1070    return MemFree(ptr);
1071 }
1072 
1073 
1074 /**************************************************
1075 *
1076 *    AlignColumnsAsnRead()
1077 *
1078 **************************************************/
1079 NLM_EXTERN 
1080 AlignColumnsPtr LIBCALL
1081 AlignColumnsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1082 {
1083    DataVal av;
1084    AsnTypePtr atp;
1085    Boolean isError = FALSE;
1086    AsnReadFunc func;
1087    AlignColumnsPtr ptr;
1088 
1089    if (! loaded)
1090    {
1091       if (! objalignlocAsnLoad()) {
1092          return NULL;
1093       }
1094    }
1095 
1096    if (aip == NULL) {
1097       return NULL;
1098    }
1099 
1100    if (orig == NULL) {         /* AlignColumns ::= (self contained) */
1101       atp = AsnReadId(aip, amp, ALIGN_COLUMNS);
1102    } else {
1103       atp = AsnLinkType(orig, ALIGN_COLUMNS);
1104    }
1105    /* link in local tree */
1106    if (atp == NULL) {
1107       return NULL;
1108    }
1109 
1110    ptr = AlignColumnsNew();
1111    if (ptr == NULL) {
1112       goto erret;
1113    }
1114    if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1115       goto erret;
1116    }
1117 
1118    atp = AsnReadId(aip,amp, atp);
1119    func = NULL;
1120 
1121    if (atp == ALIGN_COLUMNS_from) {
1122       if ( AsnReadVal(aip, atp, &av) <= 0) {
1123          goto erret;
1124       }
1125       ptr -> from = av.intvalue;
1126       atp = AsnReadId(aip,amp, atp);
1127    }
1128    if (atp == ALIGN_COLUMNS_to) {
1129       if ( AsnReadVal(aip, atp, &av) <= 0) {
1130          goto erret;
1131       }
1132       ptr -> to = av.intvalue;
1133       atp = AsnReadId(aip,amp, atp);
1134    }
1135 
1136    if (AsnReadVal(aip, atp, &av) <= 0) {
1137       goto erret;
1138    }
1139    /* end struct */
1140 
1141 ret:
1142    AsnUnlinkType(orig);       /* unlink local tree */
1143    return ptr;
1144 
1145 erret:
1146    aip -> io_failure = TRUE;
1147    ptr = AlignColumnsFree(ptr);
1148    goto ret;
1149 }
1150 
1151 
1152 
1153 /**************************************************
1154 *
1155 *    AlignColumnsAsnWrite()
1156 *
1157 **************************************************/
1158 NLM_EXTERN Boolean LIBCALL 
1159 AlignColumnsAsnWrite(AlignColumnsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1160 {
1161    DataVal av;
1162    AsnTypePtr atp;
1163    Boolean retval = FALSE;
1164 
1165    if (! loaded)
1166    {
1167       if (! objalignlocAsnLoad()) {
1168          return FALSE;
1169       }
1170    }
1171 
1172    if (aip == NULL) {
1173       return FALSE;
1174    }
1175 
1176    atp = AsnLinkType(orig, ALIGN_COLUMNS);   /* link local tree */
1177    if (atp == NULL) {
1178       return FALSE;
1179    }
1180 
1181    if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1182    if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1183       goto erret;
1184    }
1185 
1186    av.intvalue = ptr -> from;
1187    retval = AsnWrite(aip, ALIGN_COLUMNS_from,  &av);
1188    av.intvalue = ptr -> to;
1189    retval = AsnWrite(aip, ALIGN_COLUMNS_to,  &av);
1190    if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1191       goto erret;
1192    }
1193    retval = TRUE;
1194 
1195 erret:
1196    AsnUnlinkType(orig);       /* unlink local tree */
1197    return retval;
1198 }
1199 
1200 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.