Changeset 6669 for trunk

Show
Ignore:
Timestamp:
26/05/10 19:45:11 (21 months ago)
Author:
westram
Message:
  • don't warn when reporting probe matches to field 'tmp' twice. append instead.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/PROBE_DESIGN/probe_design.cxx

    r6666 r6669  
    898898 
    899899                        if (write_2_tmp) { 
     900                            // write or append to field 'tmp' 
     901                         
    900902                            GBDATA   *gb_tmp = 0; 
    901                             GB_ERROR  error2  = 0; 
     903                            GB_ERROR  error2 = 0; 
     904                            bool      append = true; 
    902905                            { 
    903906                                GBDATA *gb_parent = gene_flag ? gb_gene : gb_species; 
    904907                                gb_tmp            = GB_search(gb_parent, "tmp", GB_FIND); 
    905                                 if (gb_tmp) { 
    906                                     const char *name    = "<unknown>"; 
    907                                     GBDATA     *gb_name = GB_search(gb_parent, "name", GB_FIND); 
    908                                     if (gb_name) name   = GB_read_char_pntr(gb_name); 
    909                                     error2               = GBS_global_string("field 'tmp' already exists for %s '%s'", gene_flag ? "gene" : "species", name); 
    910                                     gb_tmp              = 0; // don't overwrite 
     908                                if (!gb_tmp) { 
     909                                    append              = false; 
     910                                    gb_tmp              = GB_search(gb_parent, "tmp", GB_STRING); 
     911                                    if (!gb_tmp) error2 = GB_await_error(); 
     912                                } 
     913                            } 
     914 
     915                            if (!error2) { 
     916                                pd_assert(gb_tmp); 
     917                                if (append) { 
     918                                    char *prevContent = GB_read_string(gb_tmp); 
     919                                    if (!prevContent) { 
     920                                        error2 = GB_await_error(); 
     921                                    } 
     922                                    else { 
     923                                        char *concatenatedContent = (char *)malloc(strlen(prevContent)+1+strlen(match_info)+1); 
     924                                        sprintf(concatenatedContent, "%s\n%s", prevContent, match_info); 
     925                                        error2 = GB_write_string(gb_tmp, concatenatedContent); 
     926                                        free(concatenatedContent); 
     927                                        free(prevContent); 
     928                                    } 
    911929                                } 
    912930                                else { 
    913                                     gb_tmp = GB_search(gb_species, "tmp", GB_STRING); 
     931                                    error2 = GB_write_string(gb_tmp, match_info); 
    914932                                } 
    915                             } 
    916  
    917                             if (!error2) { 
    918                                 pd_assert(gb_tmp); 
    919                                 error2 = GB_write_string(gb_tmp, match_info); 
    920933                            } 
    921934