~ubuntu-branches/ubuntu/quantal/ncbi-tools6/quantal

« back to all changes in this revision

Viewing changes to object/objfeat.c

Tags: upstream-6.1.20070822
ImportĀ upstreamĀ versionĀ 6.1.20070822

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*   
30
30
* Version Creation Date: 4/1/91
31
31
*
32
 
* $Revision: 6.30 $
 
32
* $Revision: 6.32 $
33
33
*
34
34
* File Description:  Object manager for module NCBI-SeqFeat
35
35
*
197
197
NLM_EXTERN SeqFeatPtr LIBCALL SeqFeatFree (SeqFeatPtr sfp)
198
198
{
199
199
        ValNodePtr vnp, next=NULL;
 
200
  UserObjectPtr uop, unp = NULL;
200
201
 
201
202
    if (sfp == NULL)
202
203
        return (SeqFeatPtr)NULL;
218
219
                MemFree(vnp);
219
220
        }
220
221
        MemFree(sfp->except_text);
 
222
        for (vnp = sfp->ids; vnp != NULL; vnp = next)
 
223
        {
 
224
                next = vnp->next;
 
225
                SeqFeatIdFree((ChoicePtr)(vnp->data.ptrvalue));
 
226
                MemFree(vnp);
 
227
        }
 
228
        /*
221
229
        AsnGenericChoiceSeqOfFree (sfp->ids, (AsnOptFreeFunc) SeqFeatIdFree);
222
 
        AsnGenericUserSeqOfFree (sfp->exts, (AsnOptFreeFunc) UserObjectFree);
 
230
        */
 
231
        for (uop = sfp->exts; uop != NULL; uop = unp)
 
232
        {
 
233
                unp = uop->next;
 
234
                UserObjectFree(uop);
 
235
        }
 
236
        /*
 
237
  AsnGenericUserSeqOfFree (sfp->exts, (AsnOptFreeFunc) UserObjectFree);
 
238
  */
223
239
 
224
240
        ObjMgrDelete(OBJ_SEQFEAT, (Pointer)sfp);
225
241
 
241
257
    Boolean retval = FALSE;
242
258
        SeqFeatXrefPtr sfxp;
243
259
        ValNodePtr vnp;
 
260
  UserObjectPtr uop;
244
261
 
245
262
        if (! loaded)
246
263
        {
377
394
    }
378
395
    if (sfp->ids != NULL)
379
396
    {
 
397
        if (! AsnOpenStruct(aip, SEQ_FEAT_ids, (Pointer)sfp->ids))
 
398
            goto erret;
 
399
        vnp = sfp->ids;
 
400
        while (vnp != NULL)
 
401
        {
 
402
            if (! SeqFeatIdAsnWrite((ChoicePtr)(vnp->data.ptrvalue), aip, SEQ_FEAT_ids_E))
 
403
                goto erret;
 
404
            vnp = vnp->next;
 
405
        }
 
406
                if (! AsnCloseStruct(aip, SEQ_FEAT_ids, (Pointer)sfp->ids))
 
407
            goto erret;
 
408
        /*
380
409
        AsnGenericChoiceSeqOfAsnWrite (sfp->ids, (AsnWriteFunc) SeqFeatIdAsnWrite, aip, SEQ_FEAT_ids, SEQ_FEAT_ids_E);
 
410
        */
381
411
    }
382
412
    if (sfp->exts != NULL)
383
413
    {
 
414
        if (! AsnOpenStruct(aip, SEQ_FEAT_exts, (Pointer)sfp->exts))
 
415
            goto erret;
 
416
        uop = sfp->exts;
 
417
        while (uop != NULL)
 
418
        {
 
419
            if (! UserObjectAsnWrite(uop, aip, SEQ_FEAT_exts_E))
 
420
                goto erret;
 
421
            uop = uop->next;
 
422
        }
 
423
                if (! AsnCloseStruct(aip, SEQ_FEAT_exts, (Pointer)sfp->exts))
 
424
            goto erret;
 
425
        /*
384
426
        AsnGenericUserSeqOfAsnWrite (sfp->exts, (AsnWriteFunc) UserObjectAsnWrite, aip, SEQ_FEAT_exts, SEQ_FEAT_exts_E);
 
427
        */
385
428
    }
386
429
    if (! AsnCloseStruct(aip, atp, (Pointer)sfp))
387
430
        goto erret;
409
452
        SeqFeatXrefPtr sfxp, sfxplast = NULL;
410
453
        ValNodePtr vnp, vnplast = NULL;
411
454
        DbtagPtr dbtp;
412
 
        Boolean isError = FALSE;
 
455
  Choice id;
 
456
  ChoicePtr cp;
 
457
        UserObjectPtr  uop, last = NULL;
413
458
 
414
459
        if (! loaded)
415
460
        {
501
546
                }
502
547
                else if (atp == SEQ_FEAT_ids)
503
548
                {
 
549
        atp = AsnLinkType (SEQ_FEAT_ids, FEAT_ID);
 
550
        if (atp == NULL) goto erret;
 
551
        if (AsnReadVal(aip, atp, &av) <= 0) goto erret;    /* read the SEQUENCE */
 
552
                    while ((atp = AsnReadId(aip, amp, atp)) == SEQ_FEAT_ids_E) {
 
553
                if (! SeqFeatIdAsnRead(aip, atp, &id))
 
554
                    goto erret;
 
555
                cp = (ChoicePtr) MemNew (sizeof (Choice));
 
556
                if (cp == NULL) goto erret;
 
557
                cp->choice = id.choice;
 
558
                if (id.choice) {
 
559
                    cp->value.intvalue = id.value.intvalue;
 
560
                } else {
 
561
                    cp->value.ptrvalue = id.value.ptrvalue;
 
562
                }
 
563
                ValNodeAddPointer (&(sfp->ids), 0, (Pointer) cp);
 
564
                    }
 
565
        if (AsnReadVal(aip, atp, &av) <= 0) goto erret;    /* read the END STRUCT */
 
566
        AsnUnlinkType (SEQ_FEAT_ids);
 
567
                    /*
504
568
                    sfp->ids = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqFeatIdAsnRead, (AsnOptFreeFunc) SeqFeatIdFree);
505
569
            if (isError && sfp->ids == NULL) {
506
570
                goto erret;
507
571
            }
508
 
        }
509
 
        else if (atp == SEQ_FEAT_exts)
510
 
        {
 
572
            */
 
573
    }
 
574
    else if (atp == SEQ_FEAT_exts)
 
575
    {
 
576
        atp = AsnLinkType (SEQ_FEAT_exts, FEAT_ID);
 
577
        if (atp == NULL) goto erret;
 
578
        if (AsnReadVal(aip, atp, &av) <= 0) goto erret;    /* read the SEQUENCE */
 
579
                    while ((atp = AsnReadId(aip, amp, atp)) == SEQ_FEAT_exts_E) {
 
580
            uop = UserObjectAsnRead (aip, atp);
 
581
            if (uop == NULL) goto erret;
 
582
            if (last != NULL) {
 
583
              last->next = uop;
 
584
            }
 
585
            if (sfp->exts == NULL) {
 
586
              sfp->exts = uop;
 
587
            }
 
588
            last = uop;
 
589
                    }
 
590
        if (AsnReadVal(aip, atp, &av) <= 0) goto erret;    /* read the END STRUCT */
 
591
        AsnUnlinkType (SEQ_FEAT_exts);
 
592
            /*
511
593
            sfp->exts = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) UserObjectAsnRead, (AsnOptFreeFunc) UserObjectFree);
512
594
            if (isError && sfp->exts == NULL) {
513
595
                goto erret;
514
596
            }
 
597
            */
515
598
        }
516
599
        else
517
600
        {