Changeset 1003

Show
Ignore:
Timestamp:
04/12/02 13:52:55 (9 years ago)
Author:
westram
Message:

valgrind fixes

Location:
trunk
Files:
73 modified

Legend:

Unmodified
Added
Removed
  • trunk/ARBDB/ad_load.c

    r714 r1003  
    651651                                }else{ 
    652652                                        GB_SETEXTERN(gb2); 
    653                                         p = gbm_get_mem((size_t)memsize,GB_GBM_INDEX(gb2)); 
     653                                        p = gbm_get_mem((size_t)memsize+1,GB_GBM_INDEX(gb2)); // ralf: added +1 because decompress ran out of this block 
    654654                                } 
    655655                                i = fread(p,1,(size_t)memsize,in); 
  • trunk/ARBDB/ad_lpro.h

    r832 r1003  
    1616GB_ERROR gbl_remove P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 
    1717GB_ERROR gbl_keep P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 
     18GB_ERROR gbl_translate P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 
    1819GB_ERROR gbl_echo P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 
    1920GB_ERROR _gbl_mid P_((int argcinput, GBL *argvinput, int *argcout, GBL **argvout, int start, int mstart, int end, int relend)); 
  • trunk/ARBDB/ad_prot.h

    r989 r1003  
    2323void GB_clear_error P_((void)); 
    2424GB_CSTR GBS_global_string P_((const char *templat, ...)); 
     25char *GBS_global_string_copy P_((const char *templat, ...)); 
    2526char *GBS_string_2_key_with_exclusions P_((const char *str, const char *additional)); 
    2627char *GBS_string_2_key P_((const char *str)); 
  • trunk/ARBDB/adcompr.c

    r887 r1003  
    559559        dest = buffer = GB_give_other_buffer((char *)source,size); 
    560560 
     561#if defined(DEBUG) 
     562    printf("gb_uncompress_equal_bytes(size=%li):\n", size); 
     563#endif /* DEBUG */ 
     564 
    561565        for (i=size;i;) { 
    562566                j = *(source++); 
    563                 if (j>0) {              /* uncompressed data block */ 
     567#if defined(DEBUG) 
     568        printf("size=%li (code=%i)\n", i, (int)j); 
     569#endif /* DEBUG */ 
     570                if (j>0) {                      /* uncompressed data block */ 
    564571                        if (j>i) j=i; 
    565572                        i -= j; 
  • trunk/ARBDB/adseqcompr.c

    r655 r1003  
    335335        seqs = (GB_Sequence *)GB_calloc(sizeof(GB_Sequence),leafcount); 
    336336        masters = (GB_Master **)GB_calloc(sizeof(void *),leafcount); 
    337         masterfoldername = strdup(GBS_global_string("%s/@master_data/@%s",GB_SYSTEM_FOLDER,ali_name)); 
     337        masterfoldername = GBS_global_string_copy("%s/@master_data/@%s",GB_SYSTEM_FOLDER,ali_name); 
    338338        old_gb_master_ali = GB_search( gb_main, masterfoldername,GB_FIND); 
    339339        free(masterfoldername); 
    340340        { 
    341             char *master_data_name = strdup(GBS_global_string("%s/@master_data",GB_SYSTEM_FOLDER)); 
    342             char *master_name = strdup(GBS_global_string("@%s",ali_name)); 
     341            char *master_data_name = GBS_global_string_copy("%s/@master_data",GB_SYSTEM_FOLDER); 
     342            char *master_name = GBS_global_string_copy("@%s",ali_name); 
    343343            GBDATA *gb_master_data = gb_search( gb_main, master_data_name,GB_CREATE_CONTAINER,1); 
    344344            gb_master_ali = gb_create_container( gb_master_data, master_name);           /* create a master container always, 
  • trunk/ARBDB/adstring.c

    r996 r1003  
    307307/* } */ 
    308308 
    309 static char *gb_global_string = 0; 
     309/* static char *gb_global_string = 0; */ 
     310 
     311 
     312 
     313 
     314static GB_CSTR gbs_vglobal_string(const char *templat, va_list parg) 
     315{ 
     316    static char buffer[2][GBS_GLOBAL_STRING_SIZE+2]; // two buffers - used alternately 
     317    static int  idx = 0; 
     318 
     319    int psize; 
     320    idx = 1-idx; // use other buffer 
     321 
     322#ifdef LINUX 
     323    psize = vsnprintf(buffer[idx],GBS_GLOBAL_STRING_SIZE,templat,parg); 
     324#else 
     325    psize = vsprintf(buffer[idx],templat,parg); 
     326#endif 
     327 
     328    if (psize == -1 || psize >= GBS_GLOBAL_STRING_SIZE) { 
     329        ad_assert(0);              // buffer overflow (increase GBS_GLOBAL_STRING_SIZE or use your own buffer) 
     330        GB_CORE; 
     331    } 
     332 
     333    return buffer[idx]; 
     334 
     335/*     if (gb_global_string) free(gb_global_string); */ 
     336/*     gb_global_string = GB_STRDUP(buffer); */ 
     337/*     return gb_global_string; */ 
     338} 
    310339 
    311340GB_CSTR GBS_global_string(const char *templat, ...) 
    312341{ 
    313     char buffer[GBS_GLOBAL_STRING_SIZE+2]; 
    314 #ifndef LINUX 
    315     int psize; 
    316 #endif 
    317342    va_list     parg; 
     343    GB_CSTR result; 
     344 
    318345    va_start(parg,templat); 
    319  
    320 #ifdef LINUX 
    321     vsnprintf(buffer,GBS_GLOBAL_STRING_SIZE,templat,parg); 
    322 #else 
    323     psize = vsprintf(buffer,templat,parg); 
    324     if (psize>=GBS_GLOBAL_STRING_SIZE) { 
    325         gb_assert(0); 
    326         GB_CORE; 
    327     } 
    328 #endif 
    329  
    330     if (gb_global_string) free(gb_global_string); 
    331     gb_global_string = GB_STRDUP(buffer); 
    332     return gb_global_string; 
     346    result = gbs_vglobal_string(templat, parg); 
     347    va_end(parg); 
     348 
     349    return result; 
     350} 
     351 
     352char *GBS_global_string_copy(const char *templat, ...) { 
     353    va_list     parg; 
     354    GB_CSTR result; 
     355 
     356    va_start(parg,templat); 
     357    result = gbs_vglobal_string(templat, parg); 
     358    result = gbs_vglobal_string(templat, parg); 
     359    va_end(parg); 
     360 
     361    return GB_STRDUP(result); 
    333362} 
    334363 
     
    902931void GBS_strnprintf(void *strstruct, long len, const char *templat, ...){ 
    903932    struct GBS_strstruct *strstr = (struct GBS_strstruct *)strstruct; 
    904     char *buffer; 
     933    char                 *buffer; 
     934    int                   psize; 
     935 
    905936    va_list     parg; 
    906937    va_start(parg,templat); 
    907938    gbs_strensure_mem(strstruct,len+2); 
     939 
    908940    buffer = strstr->GBS_strcat_data+strstr->GBS_strcat_pos; 
     941 
    909942#ifdef LINUX 
    910     vsnprintf(buffer,len,templat,parg); 
     943    psize = vsnprintf(buffer,len,templat,parg); 
    911944#else 
    912     vsprintf(buffer,templat,parg); 
     945    psize = vsprintf(buffer,templat,parg); 
    913946#endif 
     947    if (psize == -1 || psize>len) { 
     948        ad_assert(0); 
     949        GB_CORE; 
     950    } 
     951 
    914952    strstr->GBS_strcat_pos += strlen(buffer); 
    915953} 
  • trunk/ARB_GDE/GDE.cxx

    r989 r1003  
    7272                { 
    7373                        awr->awar("tmp/gde/helptext")->write_string(helptext); 
    74                         delete helptext; 
     74                        free(helptext); 
    7575                } 
    7676                else awr->awar("tmp/gde/helptext")->write_string("can not find help file\0"); 
     
    104104 
    105105        sprintf(name,"gde/%s/%s/%s",gmenu,gmenuitem,arg); 
    106         delete gmenu; 
    107         delete gmenuitem; 
    108         delete arg; 
     106        free(gmenu); 
     107        free(gmenuitem); 
     108        free(arg); 
    109109 
    110110        return(strdup(name)); 
     
    284284            GDE_create_infieldwithpm(aws,newawar,SLIDERWIDTH); 
    285285            // maybe bound checking // 
    286             delete newawar; 
     286            free(newawar); 
    287287        } 
    288288        else if(itemarg.type==CHOOSER) { 
     
    316316            free(curr_value); 
    317317            aws->update_toggle_field(); 
    318             delete newawar; 
     318            free(newawar); 
    319319        } 
    320320        else if(itemarg.type==CHOICE_MENU) { 
     
    335335            free(curr_value); 
    336336            aws->update_option_menu(); 
    337             delete newawar; 
     337            free(newawar); 
    338338        } 
    339339        else if(itemarg.type==TEXTFIELD) { 
     
    343343            aws->label(AWinfo->gmenuitem->arg[i].label); 
    344344            aws->create_input_field(newawar,itemarg.textwidth/*TEXTFIELDWIDTH*/); 
    345             delete newawar; 
     345            free(newawar); 
    346346        } 
    347347        else if(itemarg.type==CHOICE_TREE) { 
  • trunk/ARB_GDE/GDE_FileIO.cxx

    r655 r1003  
    9494char *Realloc(char *block,int size) 
    9595{ 
    96         char *temp; 
     96        char       *temp; 
    9797#ifdef SeeAlloc 
    98         extern int TotalRealloc; 
     98        extern int  TotalRealloc; 
    9999        TotalRealloc += size; 
    100100        fprintf(stderr,"Realloc %d\n",TotalRealloc); 
    101101#endif 
    102         temp=(char *)realloc(block,size); 
    103         ErrorOut(0!=temp,"Cannot change memory size"); 
     102        temp          = (char *)realloc(block,size); 
     103        ErrorOut(0   != temp,"Cannot change memory size"); 
     104 
    104105        return(temp); 
    105106} 
  • trunk/ARB_GDE/GDE_arbdb_io.cxx

    r655 r1003  
    4545                dataset->element = (NA_Sequence *) 
    4646                        Realloc((char *)dataset->element, 
    47                              dataset->maxnumelements * sizeof(NA_Sequence)); 
     47                    dataset->maxnumelements * sizeof(NA_Sequence)); 
    4848        } 
    4949        return curelem; 
     
    5353 
    5454int InsertDatainGDE(NA_Alignment *dataset,GBDATA **the_species,unsigned char **the_names,unsigned char **the_sequences, 
    55                     unsigned long numberspecies,unsigned long maxalignlen,AP_filter *filter, long compress) 
     55                    unsigned long numberspecies,unsigned long maxalignlen,AP_filter *filter, long compress) 
    5656{ 
    5757    GBDATA *gb_name; 
     
    6565    if(filter==0) 
    6666    { 
    67         filter = new AP_filter; 
    68         filter->init(maxalignlen); 
    69         newfiltercreated=1; 
     67        filter = new AP_filter; 
     68        filter->init(maxalignlen); 
     69        newfiltercreated=1; 
    7070    }else{ 
    71         size_t fl = filter->filter_len; 
    72         if (fl < maxalignlen){ 
    73             aw_message("Warning Your filter is shorter than the alignment len"); 
    74             maxalignlen = fl; 
    75         } 
     71        size_t fl = filter->filter_len; 
     72        if (fl < maxalignlen){ 
     73            aw_message("Warning Your filter is shorter than the alignment len"); 
     74            maxalignlen = fl; 
     75        } 
    7676    } 
    7777 
     
    7979    // sequences may have different length 
    8080    { 
    81         unsigned long i; 
    82         for(i=0;i<numberspecies;i++){ 
    83             seqlen[i] = strlen((char *)the_sequences[i]); 
    84         } 
     81        unsigned long i; 
     82        for(i=0;i<numberspecies;i++){ 
     83            seqlen[i] = strlen((char *)the_sequences[i]); 
     84        } 
    8585    } 
    8686 
     
    8989    if(compress==2)  // compress all gaps and filter positions 
    9090    { 
    91         long len=filter->real_len; 
    92         unsigned long i; 
    93         for(i=0;i<numberspecies;i++) 
    94         { 
    95             sequfilt[i]=(uchar*)calloc((unsigned int)len+1,sizeof(uchar)); 
    96             char c; 
    97             long newcount=0; 
    98             for(unsigned long col=0;(col<maxalignlen);col++)    { 
    99                 if(!(c=the_sequences[i][col]))  break; 
    100                 if ( (filter->filter_mask[col]) && (c!='-') && (c!='.') ) 
    101                     sequfilt[i][newcount++]=the_sequences[i][col]; 
    102             } 
    103         } 
     91        long len=filter->real_len; 
     92        unsigned long i; 
     93        for(i=0;i<numberspecies;i++) 
     94        { 
     95            sequfilt[i]=(uchar*)calloc((unsigned int)len+1,sizeof(uchar)); 
     96            char c; 
     97            long newcount=0; 
     98            for(unsigned long col=0;(col<maxalignlen);col++)    { 
     99                if(!(c=the_sequences[i][col]))  break; 
     100                if ( (filter->filter_mask[col]) && (c!='-') && (c!='.') ) 
     101                    sequfilt[i][newcount++]=the_sequences[i][col]; 
     102            } 
     103        } 
    104104    }else{ 
    105         if(compress==1){  // compress vertical gaps (and '.') 
    106             long allaregaps; 
    107             unsigned long i; 
    108             for(i=0;i<maxalignlen;i++)  { 
    109                 if (filter->filter_mask[i]) { 
    110                     allaregaps=1; 
    111                     for(size_t n=0;n<numberspecies;n++){ 
    112                         if(i >= seqlen[n]) continue; // end of sequence exceeded 
    113                         char c=the_sequences[n][i]; 
    114                         if((c!='-')&&(c!='.')){ 
    115                             allaregaps=0; 
    116                             break; 
    117                         } 
    118                     } 
    119                     if(allaregaps){ 
    120                         filter->filter_mask[i]=0; 
    121                         filter->real_len--; 
    122                     } 
    123                 } 
    124             } 
    125         } 
    126         long len=filter->real_len; 
    127         size_t i; 
    128         for(i=0;i<numberspecies;i++) 
    129         { 
    130             int c; 
    131             long newcount=0; 
    132             sequfilt[i]=(uchar*)malloc((unsigned int)len+1); 
    133             sequfilt[i][len] = 0; 
    134             memset(sequfilt[i],'.',len);                // Generate empty sequences 
    135  
    136             size_t col; 
    137             for(col=0;(col<maxalignlen)&&(c=the_sequences[i][col]);col++){ 
    138                 if ( filter->filter_mask[col] ) 
    139                     sequfilt[i][newcount++]=filter->simplify[c]; 
    140             } 
    141         } 
     105        if(compress==1){  // compress vertical gaps (and '.') 
     106            long allaregaps; 
     107            unsigned long i; 
     108            for(i=0;i<maxalignlen;i++)  { 
     109                if (filter->filter_mask[i]) { 
     110                    allaregaps=1; 
     111                    for(size_t n=0;n<numberspecies;n++){ 
     112                        if(i >= seqlen[n]) continue; // end of sequence exceeded 
     113                        char c=the_sequences[n][i]; 
     114                        if((c!='-')&&(c!='.')){ 
     115                            allaregaps=0; 
     116                            break; 
     117                        } 
     118                    } 
     119                    if(allaregaps){ 
     120                        filter->filter_mask[i]=0; 
     121                        filter->real_len--; 
     122                    } 
     123                } 
     124            } 
     125        } 
     126        long len=filter->real_len; 
     127        size_t i; 
     128        for(i=0;i<numberspecies;i++) 
     129        { 
     130            int c; 
     131            long newcount=0; 
     132            sequfilt[i]=(uchar*)malloc((unsigned int)len+1); 
     133            sequfilt[i][len] = 0; 
     134            memset(sequfilt[i],'.',len);                // Generate empty sequences 
     135 
     136            size_t col; 
     137            for(col=0;(col<maxalignlen)&&(c=the_sequences[i][col]);col++){ 
     138                if ( filter->filter_mask[col] ) 
     139                    sequfilt[i][newcount++]=filter->simplify[c]; 
     140            } 
     141        } 
    142142    } 
    143143 
    144144    { 
    145         GBDATA *gb_filter; 
    146         GB_transaction dummy(gb_main); 
    147         gb_filter = GB_search(gb_main,AWAR_GDE_EXPORT_FILTER,GB_STRING); 
    148         char *string = filter->to_string(); 
    149         GB_write_string(gb_filter,string); 
    150         delete string; 
    151     } 
    152  
    153     delete seqlen; 
     145        GBDATA *gb_filter; 
     146        GB_transaction dummy(gb_main); 
     147        gb_filter = GB_search(gb_main,AWAR_GDE_EXPORT_FILTER,GB_STRING); 
     148        char *string = filter->to_string(); 
     149        GB_write_string(gb_filter,string); 
     150        delete [] string; 
     151    } 
     152 
     153    free(seqlen); 
    154154 
    155155    long number=0; 
     
    157157 
    158158    if (the_species) { 
    159         for (gb_species = the_species[number]; gb_species; gb_species = the_species[++number] ) { 
    160             if((number/10)*10==number) 
    161                 if(aw_status((double)number/(double)numberspecies)) 
    162                 { 
    163                     return(1); 
    164                 } 
    165             gb_name = GB_find(gb_species,"name",0,down_level); 
    166  
    167             curelem = Arbdb_get_curelem(dataset); 
    168             this_elem = &(dataset->element[curelem]); 
    169             InitNASeq(this_elem,RNA); 
    170             this_elem->attr = DEFAULT_X_ATTR; 
    171             this_elem->gb_species = gb_species; 
    172  
    173             strncpy(this_elem->short_name,GB_read_char_pntr(gb_name),31); 
    174  
    175             gbd = GB_find(gb_species,"author",0,down_level); 
    176             if (gbd)    strncpy(this_elem->authority,GB_read_char_pntr(gbd),79); 
    177             gbd = GB_find(gb_species,"full_name",0,down_level); 
    178             if (gbd)    strncpy(this_elem->seq_name,GB_read_char_pntr(gbd),79); 
    179             gbd = GB_find(gb_species,"acc",0,down_level); 
    180             if (gbd){ 
    181                 strncpy(this_elem->id,GB_read_char_pntr(gbd),79); 
    182             } 
    183             { 
    184                 AppendNA((NA_Base *)sequfilt[number],strlen((const char *)sequfilt[number]),this_elem); 
    185                 delete sequfilt[number]; sequfilt[number] = 0; 
    186             } 
    187  
    188             this_elem->comments = strdup("no comments"); 
    189             this_elem->comments_maxlen = 1 + (this_elem->comments_len = strlen(this_elem->comments)); 
    190  
    191 //              if (this_elem->rmatrix && 
    192 //                  IS_REALLY_AA == AW_FALSE) { 
    193 //                      if (IS_REALLY_AA == AW_FALSE) 
    194 //                              Ascii2NA((char *)this_elem->sequence, 
    195 //                                       this_elem->seqlen, 
    196 //                                       this_elem->rmatrix); 
    197 //                      else 
    198             /* 
    199              * Force the sequence to be AA 
    200              */ 
    201             { 
    202                 this_elem->elementtype = TEXT; 
    203                 this_elem->rmatrix = NULL; 
    204                 this_elem->tmatrix = NULL; 
    205                 this_elem->col_lut = Default_PROColor_LKUP; 
    206             } 
    207 //              } 
    208         } 
     159        for (gb_species = the_species[number]; gb_species; gb_species = the_species[++number] ) { 
     160            if((number/10)*10==number) 
     161                if(aw_status((double)number/(double)numberspecies)) 
     162                { 
     163                    return(1); 
     164                } 
     165            gb_name = GB_find(gb_species,"name",0,down_level); 
     166 
     167            curelem = Arbdb_get_curelem(dataset); 
     168            this_elem = &(dataset->element[curelem]); 
     169            InitNASeq(this_elem,RNA); 
     170            this_elem->attr = DEFAULT_X_ATTR; 
     171            this_elem->gb_species = gb_species; 
     172 
     173            strncpy(this_elem->short_name,GB_read_char_pntr(gb_name),31); 
     174 
     175            gbd = GB_find(gb_species,"author",0,down_level); 
     176            if (gbd)    strncpy(this_elem->authority,GB_read_char_pntr(gbd),79); 
     177            gbd = GB_find(gb_species,"full_name",0,down_level); 
     178            if (gbd)    strncpy(this_elem->seq_name,GB_read_char_pntr(gbd),79); 
     179            gbd = GB_find(gb_species,"acc",0,down_level); 
     180            if (gbd){ 
     181                strncpy(this_elem->id,GB_read_char_pntr(gbd),79); 
     182            } 
     183            { 
     184                AppendNA((NA_Base *)sequfilt[number],strlen((const char *)sequfilt[number]),this_elem); 
     185                free(sequfilt[number]); 
     186                sequfilt[number] = 0; 
     187            } 
     188 
     189            this_elem->comments = strdup("no comments"); 
     190            this_elem->comments_maxlen = 1 + (this_elem->comments_len = strlen(this_elem->comments)); 
     191 
     192            //          if (this_elem->rmatrix && 
     193            //              IS_REALLY_AA == AW_FALSE) { 
     194            //                  if (IS_REALLY_AA == AW_FALSE) 
     195            //                          Ascii2NA((char *)this_elem->sequence, 
     196            //                                   this_elem->seqlen, 
     197            //                                   this_elem->rmatrix); 
     198            //                  else 
     199            /* 
     200             * Force the sequence to be AA 
     201             */ 
     202            { 
     203                this_elem->elementtype = TEXT; 
     204                this_elem->rmatrix = NULL; 
     205                this_elem->tmatrix = NULL; 
     206                this_elem->col_lut = Default_PROColor_LKUP; 
     207            } 
     208            //          } 
     209        } 
    209210    } 
    210211    else {      // use the_names 
    211         unsigned char *species_name; 
    212  
    213         for (species_name=the_names[number]; species_name; species_name=the_names[++number]) { 
    214             if ((number/10)*10==number) { 
    215                 if (aw_status((double)number/(double)numberspecies)) { 
    216                     return 1; 
    217                 } 
    218             } 
    219  
    220             curelem = Arbdb_get_curelem(dataset); 
    221             this_elem = &(dataset->element[curelem]); 
    222             InitNASeq(this_elem, RNA); 
    223             this_elem->attr = DEFAULT_X_ATTR; 
    224             this_elem->gb_species = 0; 
    225  
    226             strncpy((char*)this_elem->short_name, (char*)species_name, 31); 
    227             this_elem->authority[0] = 0; 
    228             this_elem->seq_name[0] = 0; 
    229             this_elem->id[0] = 0; 
    230  
    231             { 
    232                 AppendNA((NA_Base *)sequfilt[number],strlen((const char *)sequfilt[number]),this_elem); 
    233                 delete sequfilt[number]; sequfilt[number] = 0; 
    234             } 
    235  
    236             this_elem->comments = strdup("no comments"); 
    237             this_elem->comments_maxlen = 1 + (this_elem->comments_len = strlen(this_elem->comments)); 
    238  
    239             { 
    240                 this_elem->elementtype = TEXT; 
    241                 this_elem->rmatrix = NULL; 
    242                 this_elem->tmatrix = NULL; 
    243                 this_elem->col_lut = Default_PROColor_LKUP; 
    244             } 
    245         } 
     212        unsigned char *species_name; 
     213 
     214        for (species_name=the_names[number]; species_name; species_name=the_names[++number]) { 
     215            if ((number/10)*10==number) { 
     216                if (aw_status((double)number/(double)numberspecies)) { 
     217                    return 1; 
     218                } 
     219            } 
     220 
     221            curelem = Arbdb_get_curelem(dataset); 
     222            this_elem = &(dataset->element[curelem]); 
     223            InitNASeq(this_elem, RNA); 
     224            this_elem->attr = DEFAULT_X_ATTR; 
     225            this_elem->gb_species = 0; 
     226 
     227            strncpy((char*)this_elem->short_name, (char*)species_name, 31); 
     228            this_elem->authority[0] = 0; 
     229            this_elem->seq_name[0] = 0; 
     230            this_elem->id[0] = 0; 
     231 
     232            { 
     233                AppendNA((NA_Base *)sequfilt[number],strlen((const char *)sequfilt[number]),this_elem); 
     234                delete sequfilt[number]; sequfilt[number] = 0; 
     235            } 
     236 
     237            this_elem->comments = strdup("no comments"); 
     238            this_elem->comments_maxlen = 1 + (this_elem->comments_len = strlen(this_elem->comments)); 
     239 
     240            { 
     241                this_elem->elementtype = TEXT; 
     242                this_elem->rmatrix = NULL; 
     243                this_elem->tmatrix = NULL; 
     244                this_elem->col_lut = Default_PROColor_LKUP; 
     245            } 
     246        } 
    246247    } 
    247248 
    248249    { 
    249         unsigned long i; 
    250         for(i=0;i<dataset->numelements;i++) 
    251             dataset->maxlen = MAX(dataset->maxlen, 
    252                                   dataset->element[i].seqlen+dataset->element[i].offset); 
     250        unsigned long i; 
     251        for(i=0;i<dataset->numelements;i++) 
     252            dataset->maxlen = MAX(dataset->maxlen, 
     253                                  dataset->element[i].seqlen+dataset->element[i].offset); 
    253254    } 
    254255    { 
    255         unsigned long i; 
    256         for(i=0;i<numberspecies;i++) 
    257         { 
    258             delete sequfilt[i]; 
    259         } 
    260         delete sequfilt; 
     256        unsigned long i; 
     257        for(i=0;i<numberspecies;i++) 
     258        { 
     259            delete sequfilt[i]; 
     260        } 
     261        free(sequfilt); 
    261262    } 
    262263    if(newfiltercreated) delete filter; 
     
    279280        uchar **the_names; 
    280281        char *error = gde_cgss.get_sequences(gde_cgss.THIS, 
    281                                              the_species, the_names, the_sequences, 
    282                                              numberspecies, maxalignlen); 
     282                                         the_species, the_names, the_sequences, 
     283                                         numberspecies, maxalignlen); 
    283284 
    284285        gde_assert((the_species==0) != (the_names==0)); 
     
    366367        } 
    367368        InsertDatainGDE(dataset,the_species,0,(unsigned char **)the_sequences, 
    368                 numberspecies,maxalignlen,filter,compress); 
    369         for(i=0;i<numberspecies;i++) 
    370         { 
    371                 delete the_sequences[i]; 
    372         } 
    373         delete the_sequences; 
    374         delete the_species; 
     369                    numberspecies,maxalignlen,filter,compress); 
     370        for(i=0;i<numberspecies;i++) { 
     371                free(the_sequences[i]); 
     372        } 
     373        free(the_sequences); 
     374        free(the_species); 
    375375 
    376376        return 0; 
     
    407407                                this_elem->gb_species = 
    408408                                        GBT_create_species_rel_species_data(gb_species_data, 
    409                                                      this_elem->short_name); 
     409                                                        this_elem->short_name); 
    410410                        } 
    411411                } 
    412412                gb_data = GBT_add_data(this_elem->gb_species,aln->alignment_name, "data", GB_STRING); 
    413413                buffer = (char *) calloc(sizeof(char), 
    414                                      this_elem->seqlen + this_elem->offset+1); 
     414                                 this_elem->seqlen + this_elem->offset+1); 
    415415                for (k = 0; k < this_elem->seqlen + this_elem->offset; k++) { 
    416416                        buffer[k] = this_elem->tmatrix[getelem(this_elem, k)]; 
     
    432432 
    433433/*void Updata_Arbdb(Panel_item item,Event *event) 
    434 { 
    435         extern NA_Alignment *DataSet; 
    436         WriteArbdb(DataSet,0,ALL,AW_FALSE); 
    437 }*/ 
     434  { 
     435  extern NA_Alignment *DataSet; 
     436  WriteArbdb(DataSet,0,ALL,AW_FALSE); 
     437  }*/ 
    438438 
    439439 
     
    445445                switch(a->elementtype) 
    446446                { 
    447                 case DNA: 
    448                 case RNA: 
    449                         return(0); 
    450                 case PROTEIN: 
    451                 case TEXT: 
    452                         return('~'); 
    453                 case MASK: 
    454                         return('0'); 
    455                 default: 
    456                         return('-'); 
     447            case DNA: 
     448            case RNA: 
     449                return(0); 
     450            case PROTEIN: 
     451            case TEXT: 
     452                return('~'); 
     453            case MASK: 
     454                return('0'); 
     455            default: 
     456                return('-'); 
    457457                } 
    458458        else 
     
    505505        { 
    506506                temp =(NA_Base*)Calloc(a->seqmaxlen+a->offset-b, 
    507                     sizeof(NA_Base)); 
     507                               sizeof(NA_Base)); 
    508508                switch (a->elementtype) 
    509509                { 
    510510                        /* 
    511 *       Pad out with gap characters fron the point of insertion to the offset 
    512 */ 
    513                 case MASK: 
    514                         for(j=b;j<a->offset;j++) 
    515                                 temp[j-b]='0'; 
    516                         break; 
    517                 case DNA: 
    518                 case RNA: 
    519                         for(j=b;j<a->offset;j++) 
    520                                 temp[j-b]='\0'; 
    521                         break; 
    522                 case PROTEIN: 
    523                         for(j=b;j<a->offset;j++) 
    524                                 temp[j-b]='-'; 
    525                         break; 
    526                 case TEXT: 
    527                 default: 
    528                         for(j=b;j<a->offset;j++) 
    529                                 temp[j-b]=' '; 
    530                         break; 
     511             *  Pad out with gap characters fron the point of insertion to the offset 
     512             */ 
     513            case MASK: 
     514                for(j=b;j<a->offset;j++) 
     515                    temp[j-b]='0'; 
     516                break; 
     517            case DNA: 
     518            case RNA: 
     519                for(j=b;j<a->offset;j++) 
     520                    temp[j-b]='\0'; 
     521                break; 
     522            case PROTEIN: 
     523                for(j=b;j<a->offset;j++) 
     524                    temp[j-b]='-'; 
     525                break; 
     526            case TEXT: 
     527            default: 
     528                for(j=b;j<a->offset;j++) 
     529                    temp[j-b]=' '; 
     530                break; 
    531531                } 
    532532 
  • trunk/ARB_GDE/GDE_event.cxx

    r791 r1003  
    346346        delete DataSet->alignment_name; 
    347347        DataSet->alignment_name = GBT_get_default_alignment(DataSet->gb_main); 
    348         delete alignment_name; 
     348        free(alignment_name); 
    349349        alignment_name = strdup(DataSet->alignment_name); 
    350350 
     
    485485 startaction_end: 
    486486    aw_closestatus(); 
    487     delete alignment_name; 
     487    free(alignment_name); 
    488488    delete filter2; 
    489     delete filter_name; 
     489    free(filter_name); 
    490490 
    491491    GDE_freeali(DataSet); 
    492     delete DataSet; 
     492    free(DataSet); 
    493493    DataSet=0; 
    494494    DataSet = (NA_Alignment *) Calloc(1,sizeof(NA_Alignment)); 
     
    625625        } 
    626626    } 
    627     delete textvalue; 
    628     delete method; 
     627    free(textvalue); 
     628    free(method); 
    629629    return(Action); 
    630630} 
  • trunk/AWT/AWT_advice.cxx

    r743 r1003  
    33//    File      : awt_advice.cpp                                         // 
    44//    Purpose   :                                                        // 
    5 //    Time-stamp: <Fri Jul/05/2002 15:00 MET Coder@ReallySoft.de>        // 
     5//    Time-stamp: <Tue Dec/03/2002 03:10 MET Coder@ReallySoft.de>        // 
    66//                                                                       // 
    77//                                                                       // 
     
    9191    char *disabled_list = var->read_string(); 
    9292    bool  is_disabled   = strstr(disabled_list, GBS_global_string(";%s;", id)) != 0; 
    93     delete disabled_list; 
     93    free(disabled_list); 
    9494    return is_disabled; 
    9595} 
  • trunk/AWT/AWT_asciiprint.cxx

    r361 r1003  
    252252        } 
    253253        char *header = awr->awar(AWAR_APRINT_TITLE)->read_string(); 
    254         a2ps_call = strdup(GBS_global_string("arb_a2ps -ns -nP '-H%s' %s -l%i %s", 
    255                                              header, 
    256                                              oristring, 
    257                                              default_lpp, 
    258                                              tmp_file)); 
     254        a2ps_call = GBS_global_string_copy("arb_a2ps -ns -nP '-H%s' %s -l%i %s", 
     255                                           header, oristring, default_lpp, tmp_file); 
    259256        delete header; 
    260257    } 
  • trunk/AWT/AWT_config_manager.cxx

    r927 r1003  
    33//    File      : AWT_config_manager.cxx                                 // 
    44//    Purpose   :                                                        // 
    5 //    Time-stamp: <Thu Nov/07/2002 19:55 MET Coder@ReallySoft.de>        // 
     5//    Time-stamp: <Tue Dec/03/2002 19:16 MET Coder@ReallySoft.de>        // 
    66//                                                                       // 
    77//                                                                       // 
     
    102102// --------------------------------------------------------- 
    103103static char *correct_key_name(const char *name) { 
    104     return GBS_string_2_key(name); 
     104    char *corrected = GBS_string_2_key(name); 
     105 
     106    if (strcmp(corrected, "__") == 0) { 
     107        free(corrected); 
     108        corrected = strdup(""); 
     109    } 
     110 
     111    return corrected; 
    105112} 
    106113 
     
    114121    config->get_awar_value("current"); // create! 
    115122    bool               reopen           = false; 
    116     char              *title            = strdup(GBS_global_string("Configurations for '%s'", aww->window_name)); 
    117  
    118     char   *result    = aw_string_selection(title, "Enter a new or select an existing config", config->get_awar_name("current").c_str(), 0, existing_configs.c_str(), "RESTORE,STORE,DELETE,CANCEL,HELP", correct_key_name); 
     123    char              *title            = GBS_global_string_copy("Configurations for '%s'", aww->window_name); 
     124 
     125    char   *result    = aw_string_selection(title, "Enter a new or select an existing config", config->get_awar_name("current").c_str(), 0, existing_configs.c_str(), "RESTORE,STORE,DELETE,CLOSE,HELP", correct_key_name); 
    119126    int     button    = aw_string_selection_button(); 
    120127    string  awar_name = string("cfg_")+result; 
     
    132139            else existing_configs                           = result; 
    133140 
    134             config->set_awar_value(awar_name, config->Store()); 
     141            char *config_string = config->Store(); 
     142            config->set_awar_value(awar_name, config_string); 
     143            free(config_string); 
    135144            config->set_awar_value("current", result); 
    136145            config->set_awar_value("existing", existing_configs); 
     146            reopen = true; 
    137147            break; 
    138148        } 
     
    146156            break; 
    147157        } 
    148         case 3:  {              // CANCEL 
     158        case 3:  {              // CLOSE 
    149159            break; 
    150160        } 
  • trunk/AWT/AWT_file_selection.cxx

    r947 r1003  
    258258    } 
    259259    else { 
    260         char *mask = strdup(GBS_global_string("*%s", filter)); 
     260        char *mask = GBS_global_string_copy("*%s", filter); 
    261261        awt_fill_selection_box_recursive(fulldir, strlen(fulldir)+1, mask, false, cbs->show_dir, cbs->aws, cbs->id); 
    262262        free(mask); 
  • trunk/AWT/AWT_filter.cxx

    r525 r1003  
    11#include <stdio.h> 
     2#include <stdlib.h> 
    23#include <string.h> 
    34#include <arbdb.h> 
     
    113114        delete data; 
    114115    } 
    115     delete to_free_target; 
    116     delete use; 
     116    free(to_free_target); 
     117    free(use); 
    117118    GB_pop_transaction(cbs->gb_main); 
    118119} 
     
    144145            char *str; 
    145146            if (count){ 
    146                 str  = strdup(GBS_global_string("%s%-20s SEQ_%i   %s",  pre,name,count+1,TYPE)); 
     147                str  = GBS_global_string_copy("%s%-20s SEQ_%i   %s",    pre,name,count+1,TYPE); 
    147148            }else{ 
    148                 str = strdup(GBS_global_string("%s%-20s     %s",        pre,name,TYPE)); 
     149                str = GBS_global_string_copy("%s%-20s     %s",  pre,name,TYPE); 
    149150            } 
    150151            char *target = (char *)GBS_global_string("%c%s%c%s",tpre,GB_read_key_pntr(gb_data),1,name); 
     
    188189    awt_create_select_filter_window_aw_cb(0,cbs); 
    189190    GB_pop_transaction(cbs->gb_main); 
    190     delete use; 
     191    free(use); 
    191192} 
    192193 
     
    240241        char *fname = aw_root->awar(acbs->def_name)->read_string(); 
    241242        const char *fsname = GBS_global_string(" data%c%s",1,fname); 
    242         delete fname; 
     243        free(fname); 
    243244        aw_root->awar(acbs->def_subname)->write_string(fsname);         // cause an callback 
    244245    } 
     
    288289 
    289290char *AWT_get_combined_filter_name(AW_root *aw_root, GB_CSTR prefix) { 
    290     char *combined_name = strdup(aw_root->awar(GBS_global_string("%s/filter/name", prefix))->read_string()); // "gde/filter/name" 
    291     const char *awar_prefix = "tmp/gde/filter"; 
     291    char       *combined_name = aw_root->awar(GBS_global_string("%s/filter/name", prefix))->read_string(); // "gde/filter/name" 
     292    const char *awar_prefix   = "tmp/gde/filter"; 
    292293    const char *awar_repeated = "/2filter"; 
    293     const char *awar_postfix = "/name"; 
    294     int prefix_len = strlen(awar_prefix); 
    295     int repeated_len = strlen(awar_repeated); 
    296     int postfix_len = strlen(awar_postfix); 
    297     int count; 
     294    const char *awar_postfix  = "/name"; 
     295    int         prefix_len    = strlen(awar_prefix); 
     296    int         repeated_len = strlen(awar_repeated); 
     297    int         postfix_len  = strlen(awar_postfix); 
     298    int         count; 
    298299 
    299300    for (count = 1; ; ++count) { 
     
    305306 
    306307        AW_awar *awar_found = aw_root->awar_no_error(awar_name); 
    307         delete awar_name; 
     308        delete [] awar_name; 
    308309 
    309310        if (!awar_found) break; // no more filters defined 
     
    311312 
    312313        if (strstr(content, "none")==0) { // don't add filters named 'none' 
    313             char *new_combined_name = new char[strlen(combined_name)+1+strlen(content)+1]; 
     314            char *new_combined_name = (char*)malloc(strlen(combined_name)+1+strlen(content)+1); 
    314315            sprintf(new_combined_name, "%s/%s", combined_name, content); 
    315             delete combined_name; 
     316            free(combined_name); 
    316317            combined_name = new_combined_name; 
    317318        } 
     
    388389    char *use = aw_root->awar(acbs->def_alignment)->read_string(); 
    389390    len = GBT_get_alignment_len(acbs->gb_main,use); 
    390     delete use; 
     391    free(use); 
    391392    filter->init(filter_string,"0",len); 
    392393 
    393394    int sim = aw_root->awar(acbs->def_simplify)->read_int(); 
    394395    filter->enable_simplify((AWT_FILTER_SIMPLIFY)sim); 
    395     delete filter_string; 
     396    free(filter_string); 
    396397 
    397398    GB_pop_transaction(acbs->gb_main); 
  • trunk/AWT/AWT_nds.cxx

    r889 r1003  
    173173                aw_root->awar(AWAR_SELECT_ACISRT)->write_string(str); 
    174174        } 
    175         delete str; 
     175        free(str); 
    176176} 
    177177void AWT_create_select_srtaci_window(AW_window *aww,AW_CL awar_acisrt,AW_CL awar_short) 
     
    202202                char *filename = AWT_unfold_path("lib/sellists/srt_aci*.sellst","ARBHOME"); 
    203203                GB_ERROR error = aws->load_selection_list(id,filename); 
    204                 delete filename; 
     204                free(filename); 
    205205                if (error) aw_message(error); 
    206206 
  • trunk/AWT/AWT_query_and_functions.cxx

    r998 r1003  
    657657                    } 
    658658                } 
    659                 delete data; 
     659                free(data); 
    660660            } 
    661661        } 
     
    701701//     GBS_free_hash(hash); 
    702702 
    703     delete key; 
     703    free(key); 
    704704    awt_query_update_list(0,cbs); 
    705705} 
     
    769769                if (aw_message(AW_ERROR_BUFFER,"Create Field (Type STRING),Cancel")){ 
    770770                        GB_abort_transaction(cbs->gb_main); 
    771                         delete command; 
    772                         delete key; 
     771                        free(command); 
     772                        free(key); 
    773773                        return; 
    774774                } 
     
    802802            long use_tag = cbs->aws->get_root()->awar(cbs->awar_use_tag)->read_int(); 
    803803            if (!use_tag || !strlen(tag)) { 
    804                 delete tag; 
     804                free(tag); 
    805805                tag = 0; 
    806806            } 
     
    855855                    if (!parsed) { 
    856856                        error = GB_get_error(); 
    857                         delete str; 
     857                        free(str); 
    858858                        break; 
    859859                    } 
    860860                    if (!strcmp(parsed,str)){   // nothing changed 
    861                         delete str; 
    862                         delete parsed; 
     861                        free(str); 
     862                        free(parsed); 
    863863                        continue; 
    864864                    } 
     
    875875                        } 
    876876                    } 
    877                     delete str; 
    878                     delete parsed; 
     877                    free(str); 
     878                    free(parsed); 
    879879                } 
    880880            } 
     
    949949        aw_closestatus(); 
    950950        delete tag; 
    951         delete deftag; 
     951        free(deftag); 
    952952    } 
    953953 
     
    958958                GB_commit_transaction(cbs->gb_main); 
    959959        } 
    960         delete key; 
    961         delete command; 
     960        free(key); 
     961        free(command); 
    962962} 
    963963 
     
    971971                    GB_transaction valid_transaction(cbs->gb_main); 
    972972                    char *use = GBT_get_default_alignment(cbs->gb_main); 
    973                     kv = strdup(GBS_global_string("%s/data",use)); 
    974                     delete use; 
     973                    kv = GBS_global_string_copy("%s/data",use); 
     974                    free(use); 
    975975                } 
    976976                aw_root->awar(cbs->awar_parskey)->write_string( kv); 
    977                 if (kv != str) delete kv; 
     977                if (kv != str) free(kv); 
    978978                aw_root->awar(cbs->awar_parsvalue)->write_string( brk); 
    979979        }else{ 
    980980                aw_root->awar(cbs->awar_parsvalue)->write_string( str); 
    981981        } 
    982         delete str; 
     982        free(str); 
    983983} 
    984984 
     
    11161116 
    11171117    { 
    1118         char *macro_name  = strdup(GBS_global_string("COLORIZE_%s", Sel->items_name)); 
    1119         char *window_name = strdup(GBS_global_string("Colorize %s %s", what, Sel->items_name)); 
     1118        char *macro_name  = GBS_global_string_copy("COLORIZE_%s", Sel->items_name); 
     1119        char *window_name = GBS_global_string_copy("Colorize %s %s", what, Sel->items_name); 
    11201120 
    11211121        aws->init( aw_root, macro_name, window_name, 300, 0 ); 
     
    12311231 
    12321232    { 
    1233         char *macro_name = strdup(GBS_global_string("MODIFY_DATABASE_FIELD_%s", cbs->selector->items_name)); 
    1234         char *window_name = strdup(GBS_global_string("MODIFY DATABASE FIELD of listed %s", cbs->selector->items_name)); 
     1233        char *macro_name = GBS_global_string_copy("MODIFY_DATABASE_FIELD_%s", cbs->selector->items_name); 
     1234        char *window_name = GBS_global_string_copy("MODIFY DATABASE FIELD of listed %s", cbs->selector->items_name); 
    12351235 
    12361236        aws->init( aw_root, macro_name, window_name, 600, 0 ); 
     
    12891289 
    12901290        GB_ERROR error = filename ? aws->load_selection_list(id,filename) : "No default selection list for query-type"; 
    1291         delete filename; 
     1291        free(filename); 
    12921292        if (error) { 
    12931293        aw_message(error); 
     
    13131313    char *value = cbs->aws->get_root()->awar(cbs->awar_setvalue)->read_string(); 
    13141314    if (!strlen(value)) { 
    1315         delete value; 
     1315        free(value); 
    13161316        value = 0; 
    13171317    } 
     
    13251325        aw_message(); 
    13261326        delete value; 
    1327         delete key; 
     1327        free(key); 
    13281328        GB_commit_transaction(cbs->gb_main); 
    13291329        return; 
     
    13531353                                char *v = GBS_strclose(strstr,0); 
    13541354                                error = GB_write_as_string(gb_new,v); 
    1355                                 delete v; 
     1355                                free(v); 
    13561356                            }else{ 
    13571357                                char *name = GBT_read_string(gb_item,"name"); 
    13581358                                error = GB_export_error("Field '%s' of %s '%s' has incombatible type", key, cbs->selector->item_name, name); 
    1359                                 delete name; 
     1359                                free(name); 
    13601360                            } 
    13611361                        }else{ 
     
    14271427        GB_commit_transaction(cbs->gb_main); 
    14281428    } 
    1429     delete key; 
    1430     delete value; 
     1429    free(key); 
     1430    free(value); 
    14311431} 
    14321432 
     
    15221522                GB_commit_transaction(cbs->gb_main); 
    15231523        } 
    1524         delete key; 
     1524        free(key); 
    15251525} 
    15261526 
     
    18411841 
    18421842        { 
    1843             char    *this_awar_name = strdup(GBS_global_string("tmp/arbdb_query_%i/select", query_id)); 
     1843            char    *this_awar_name = GBS_global_string_copy("tmp/arbdb_query_%i/select", query_id); 
    18441844            AW_awar *awar           = aw_root->awar_string( this_awar_name, "", AW_ROOT_DEFAULT); 
    18451845 
     
    19611961        } 
    19621962 
     1963    free(Items); 
     1964 
    19631965        query_id++; 
    19641966        GB_pop_transaction(gb_main); 
  • trunk/AWT/AWT_sel_boxes.cxx

    r989 r1003  
    4343                        cbs->aws->insert_selection( cbs->id, alignment_name, alignment_name ); 
    4444                } 
    45                 delete str; 
    46                 delete alignment_type; 
    47                 delete alignment_name; 
     45                free(str); 
     46                free(alignment_type); 
     47                free(alignment_name); 
    4848        } 
    4949        cbs->aws->insert_default_selection( cbs->id, "????", "????" ); 
     
    675675 
    676676    if (!toggle){ 
    677         char *sac = strdup(GBS_global_string("%s/%s",aww->window_defaults_name,AWAR_MACRO_RECORDING_MACRO_TEXT)); 
     677        char *sac = GBS_global_string_copy("%s/%s",aww->window_defaults_name,AWAR_MACRO_RECORDING_MACRO_TEXT); 
    678678        char *mn  = awt_get_selected_fullname(awr, AWAR_MACRO_BASE); 
    679679        error     = awr->start_macro_recording(mn,application_name_for_macros,sac); 
     
    708708//         path = strdup(mn); 
    709709//     }else{ 
    710 //         path = strdup(GBS_global_string("%s/%s",GB_getenvARBMACROHOME(),mn)); 
     710//         path = GBS_global_string_copy("%s/%s",GB_getenvARBMACROHOME(),mn); 
    711711//     } 
    712712    char *path = awt_get_selected_fullname(aww->get_root(), AWAR_MACRO_BASE); 
  • trunk/AWT/AWT_species_sel_box.cxx

    r989 r1003  
    478478    char *value = cbs->aws->get_root()->awar(cbs->def_dest)->read_string(); 
    479479    int vlen = strlen(value); 
    480     while (value[vlen-1] == '\n') vlen--;               // remove trailing newlines 
     480    while (vlen>0 && value[vlen-1] == '\n') vlen--;             // remove trailing newlines 
    481481    value[vlen] = 0; 
    482482    // read the value from the window 
     
    484484    GB_ERROR error = 0; 
    485485    if (!gbd) { 
    486         aw_message("Sorry, cannot perform your operation, please redo it\n(Hint: Select an item first or 'enable edit'"); 
    487     }else if (!cbs->aws->get_root()->awar(cbs->def_filter)->read_int()) {       // edit disabled 
    488         if (strlen(value)){ 
    489             aw_message("Write disabled"); 
     486        error = "Sorry, cannot perform your operation, please redo it\n(Hint: No item or fields selected or 'enable edit' is unchecked)"; 
     487        if (!cbs->aws->get_root()->awar(cbs->def_filter)->read_int()) { // edit disabled 
    490488            cbs->aws->get_root()->awar(cbs->def_dest)->write_string(""); 
    491489        } 
    492     }else{ 
     490    } 
     491//     else if (!cbs->aws->get_root()->awar(cbs->def_filter)->read_int()) {     // edit disabled 
     492//         if (strlen(value)){ 
     493//             error = "Write disabled"; 
     494//             cbs->aws->get_root()->awar(cbs->def_dest)->write_string(""); 
     495//         } 
     496//     } 
     497    else { 
     498        awt_assert(cbs->aws->get_root()->awar(cbs->def_filter)->read_int() != 0); // edit is enabled (disabled causes gdb to be 0) 
     499 
    493500        GBDATA *gb_key_name; 
    494         char *key_name = 0; 
     501        char   *key_name = 0; 
    495502        if (awt_check_scanner_key_data(cbs,gbd)) {              // not exist, create new element 
    496503            gb_key_name = GB_find(gbd,CHANGEKEY_NAME,0,down_level); 
     
    510517        } else {                // change old element 
    511518            key_name = GB_read_key(gbd); 
    512             if (GB_get_father(gbd) == cbs->gb_user &&!strcmp(key_name, "name")) {               // This is a real rename !!! 
    513                 GBT_begin_rename_session(cbs->gb_main,0); 
    514                 GBDATA *gb_name = GB_find(cbs->gb_user,"name",0,down_level); 
    515                 if (gb_name) { 
    516                     char *name = GB_read_string(gb_name); 
    517                     error = GBT_rename_species( name,value); 
    518                     delete name; 
    519                 }else{ 
    520                     error = GB_export_error("harmless internal error: Please try again"); 
    521                 } 
    522                 if (error) { 
    523                     GBT_abort_rename_session(); 
    524                 }else{ 
    525                     GBT_commit_rename_session(0); 
     519            if (GB_get_father(gbd) == cbs->gb_user &&!strcmp(key_name, "name")) { // This is a real rename !!! 
     520                int answer = aw_message("Changing the 'name' field may harm your database! Really continue?", "Yes,No", true); 
     521                if (answer == 0) { 
     522                    GBT_begin_rename_session(cbs->gb_main,0); 
     523                    GBDATA *gb_name = GB_find(cbs->gb_user,"name",0,down_level); 
     524                    if (gb_name) { 
     525                        char *name = GB_read_string(gb_name); 
     526                        error = GBT_rename_species( name,value); 
     527                        free(name); 
     528                    }else{ 
     529                        error = GB_export_error("harmless internal error: Please try again"); 
     530                    } 
     531                    if (error) { 
     532                        GBT_abort_rename_session(); 
     533                    }else{ 
     534                        GBT_commit_rename_session(0); 
     535                    } 
    526536                } 
    527537            }else{ 
     
    549559        GB_commit_transaction(cbs->gb_main); 
    550560    } 
    551     delete value; 
     561    free(value); 
    552562} 
    553563/********************* get the container of a species key description ***************/ 
     
    828838                        memcpy(p,data,ssize); 
    829839                        p[ssize] = 0; 
    830                         delete data; 
     840                        free(data); 
    831841                    } 
    832842                    cbs->aws->insert_selection( cbs->id, buffer, (long)gbd ); 
  • trunk/AWT/AWT_tables.cxx

    r832 r1003  
    219219    table_name = strdup(itable_name); 
    220220    char *tname = GBS_string_2_key(table_name); 
    221     this->awar_field_reorder_source = strdup(GBS_global_string(AWAR_TABLE_FIELD_REORDER_SOURCE_TEMPLATE,tname)); 
    222     this->awar_field_reorder_dest = strdup(GBS_global_string(AWAR_TABLE_FIELD_REORDER_DEST_TEMPLATE,tname)); 
    223     this->awar_field_rem = strdup(GBS_global_string(AWAR_TABLE_FIELD_REM_TEMPLATE,tname)); 
    224     this->awar_field_new_name = strdup(GBS_global_string(AWAR_TABLE_FIELD_NEW_NAME_TEMPLATE,tname)); 
    225     this->awar_field_new_type = strdup(GBS_global_string(AWAR_TABLE_FIELD_NEW_TYPE_TEMPLATE,tname)); 
    226     this->awar_selected_field = strdup(GBS_global_string(AWAR_TABLE_SELECTED_FIELD_TEMPLATE,tname)); 
     221    this->awar_field_reorder_source = GBS_global_string_copy(AWAR_TABLE_FIELD_REORDER_SOURCE_TEMPLATE,tname); 
     222    this->awar_field_reorder_dest = GBS_global_string_copy(AWAR_TABLE_FIELD_REORDER_DEST_TEMPLATE,tname); 
     223    this->awar_field_rem = GBS_global_string_copy(AWAR_TABLE_FIELD_REM_TEMPLATE,tname); 
     224    this->awar_field_new_name = GBS_global_string_copy(AWAR_TABLE_FIELD_NEW_NAME_TEMPLATE,tname); 
     225    this->awar_field_new_type = GBS_global_string_copy(AWAR_TABLE_FIELD_NEW_TYPE_TEMPLATE,tname); 
     226    this->awar_selected_field = GBS_global_string_copy(AWAR_TABLE_SELECTED_FIELD_TEMPLATE,tname); 
    227227 
    228228    awr->awar_string(awar_field_reorder_source,""); 
  • trunk/AWT/AWT_tree.cxx

    r989 r1003  
    8383AP_filter::~AP_filter(void){ 
    8484    delete bootstrap; 
    85     delete filter_mask; 
     85    delete [] filter_mask; 
    8686    delete filterpos_2_seqpos; 
    8787} 
  • trunk/AWT/AWT_tree_cb.cxx

    r989 r1003  
    228228 
    229229            if (i) { 
    230                 const char *color_group_name = AW_get_color_group_name(awm->get_root(), i); 
     230                char *color_group_name = AW_get_color_group_name(awm->get_root(), i); 
    231231                sprintf(entry_buf, "%s '%s'", entry_prefix, color_group_name); 
     232                free(color_group_name); 
    232233            } 
    233234            else { 
     
    346347 
    347348        if (i) { 
    348             const char *color_group_name = AW_get_color_group_name(awm->get_root(), i); 
     349            char *color_group_name = AW_get_color_group_name(awm->get_root(), i); 
    349350            sprintf(entry_buf, "group '%s'", color_group_name); 
     351            free(color_group_name); 
    350352        } 
    351353        else { 
  • trunk/AWTC/AWTC_next_neighbours.cxx

    r2 r1003  
    2222 
    2323AWTC_FIND_FAMILY_MEMBER::~AWTC_FIND_FAMILY_MEMBER(){ 
    24     delete name; 
     24    free(name); 
    2525} 
    2626 
     
    117117     */ 
    118118 
    119     if (aisc_put(link, PT_LOCS, locs,  
     119    if (aisc_put(link, PT_LOCS, locs, 
    120120                 LOCS_FIND_TYPE, find_type, 
    121121                 LOCS_FIND_FAMILY, &bs,0)){ 
     
    134134        fl->next = family_list; 
    135135        family_list = fl; 
    136          
     136 
    137137        aisc_get(link, PT_FAMILYLIST, f_list, 
    138138                 FAMILYLIST_NAME,&fl->name, 
  • trunk/AWTI/AWTI_import.cxx

    r989 r1003  
    103103        struct input_format_struct   *ifo; 
    104104        struct input_format_per_line *pl = 0; 
    105         ifo                              = awtcig.ifo = new input_format_struct; 
    106105        char                         *s1 = 0,*s2=0; 
     106 
     107    if (awtcig.ifo) { delete awtcig.ifo; awtcig.ifo = 0; } 
     108        ifo = awtcig.ifo = new input_format_struct; 
    107109 
    108110        while (!awtc_read_string_pair(in,s1,s2)){ 
     
    173175        } 
    174176 
     177    free(s2); 
     178    free(s1); 
     179 
    175180        fclose(in); 
    176181        return 0; 
     
    207212        free(ifo->sequenceaci); 
    208213        free(ifo->end); 
    209         delete ifo->b1; 
    210         delete ifo->b2; 
     214        free(ifo->b1); 
     215        free(ifo->b2); 
    211216} 
    212217 
     
    249254                                buffer[size] = 0; 
    250255                                if (!GBS_string_cmp(buffer,autodetect,0)){      // format found 
    251                                         delete autodetect; 
     256                                        free(autodetect); 
    252257                                        break; 
    253258                                } 
     
    290295                                delete sys; continue; 
    291296                        } 
    292                         delete sys; 
     297                        free(sys); 
    293298                        origin_file_name = mid_file_name; 
    294299                }else{ 
     
    455460                char *nstr = GBT_create_unique_species_name(awtcig.gb_main,str); 
    456461                GB_write_string(gbk,nstr); 
    457                 delete nstr; 
     462                free(nstr); 
    458463                    }else{ 
    459464                GB_write_string(gbk,str); 
     
    465470        strin  = GB_read_char_pntr(gbk); 
    466471        len    = strlen(str) + strlen(strin); 
    467     taglen = tag ? (strlen(tag)+3) : 0; 
    468         buf    = (char *)GB_calloc(sizeof(char),len+2+taglen); 
     472    taglen = tag ? (strlen(tag)+2) : 0; 
     473        buf    = (char *)GB_calloc(sizeof(char),len+2+taglen+1); 
    469474 
    470475    if (tag) { 
    471         char *regexp = (char*)GB_calloc(sizeof(char), taglen+1); 
     476        char *regexp = (char*)GB_calloc(sizeof(char), taglen+3); 
    472477        sprintf(regexp, "*[%s]*", tag); 
    473478 
     
    604609                            dup = dele; 
    605610                            dele = s = GB_command_interpreter(GB_MAIN, s,expanded.c_str(),gb_species); 
    606                             delete dup; 
     611                            free(dup); 
    607612                            if (!s) return GB_get_error(); 
    608613                        } 
     
    639644                            variables[pl->setvar[0]]  = s; 
    640645                        } 
    641                         delete dele; 
     646                        free(dele); 
    642647                    } 
    643648                } 
     
    671676                char *h = GBS_string_eval(sequence,ifo->sequencesrt,gb_species); 
    672677                if (!h) return GB_get_error(); 
    673                 delete sequence; 
     678                free(sequence); 
    674679                sequence = h; 
    675680            } 
     
    678683                char *h = GB_command_interpreter(GB_MAIN, 
    679684                                                 sequence,ifo->sequenceaci,gb_species); 
    680                 delete sequence; 
     685                free(sequence); 
    681686                if (!h) return GB_get_error(); 
    682687                sequence = h; 
     
    694699                GB_write_string(gb_acc,buf); 
    695700            } 
    696             delete sequence; 
     701            free(sequence); 
    697702        } 
    698703        while (1){                              // go to the start of an species 
     
    761766        char *ali = awr->awar(AWAR_ALI)->read_string(); 
    762767        ali_name = GBS_string_eval(ali,"*=ali_*1:ali_ali_=ali_",0); 
    763         delete ali; 
     768        free(ali); 
    764769    } 
    765770 
     
    776781            GBT_create_alignment(GB_MAIN,ali_name,2000,0,4,ali_type); 
    777782        } 
    778         delete ali_type; 
     783        free(ali_type); 
    779784    } 
    780785    int toggle_value = (awr->awar(AWAR_READ_GENOM_DB)->read_int()); 
     
    813818            char *f = awr->awar(AWAR_FILE)->read_string(); 
    814819            awtcig.filenames = GBS_read_dir(f,0); 
    815             delete f; 
     820            free(f); 
    816821 
    817822            if (awtcig.filenames[0] == 0){ 
     
    847852         } 
    848853    } 
    849     delete ali_name; 
     854    free(ali_name); 
    850855 
    851856    if (error) { 
     
    907912    } 
    908913    else { 
    909         if (strcmp(awr->awar(AWAR_ALI)->read_string(), "genom") == 0) { 
     914        char *ali = awr->awar(AWAR_ALI)->read_string(); 
     915 
     916        if (strcmp(ali, "genom") == 0) { 
    910917            awr->awar(AWAR_ALI)->write_string("ali_16s"); 
    911918            awr->awar(AWAR_ALI_TYPE)->write_string("rna"); 
    912919        } 
    913920        awr->awar_string(AWAR_FORM"/filter",".ift"); 
     921 
     922        free(ali); 
    914923    } 
    915924} 
  • trunk/GDE/CORE/BasicDisplay.c

    r655 r1003  
    2222        extern int num_menus; 
    2323 
    24 Panel menubar = NULL; 
     24Panel menubar = 0; 
    2525 
    2626/* 
     
    3838        extern Frame frame; 
    3939 
    40 QuitGDE() 
     40int QuitGDE() 
    4141{ 
    4242        extern Frame    frame; 
     
    5252} 
    5353 
    54 QuitGDE_update(Panel_item item, Event *event) 
     54int QuitGDE_update(Panel_item item, Event *event) 
    5555{ 
    5656        Updata_Arbdb(item,event); 
    57         QuitGDE(); 
     57        return QuitGDE(); 
    5858} 
    5959 
     
    6161NA_Alignment *DataSet; 
    6262{ 
    63         int i,j,k; 
    64  
    65         if(menubar == NULL) 
     63/*      int i,j,k; */ 
     64        int j; 
     65 
     66        if (!menubar) 
    6667        { 
    6768                menubar = xv_create(frame,PANEL, 
     
    8687*/ 
    8788        MakeNAADisplay(); 
    88         return; 
     89        return menubar; 
    8990} 
    9091 
     
    126127*/ 
    127128 
    128 GenMenu(type) 
     129void GenMenu(type) 
    129130int type; 
    130131{ 
    131         int i,j,k; 
    132         int curmenu,curitem,curarg,curinput,curoutput,curchoice; 
     132/*      int i,j,k; */ 
     133        int curmenu,curitem/*,curarg,curinput,curoutput,curchoice*/; 
    133134        extern Gmenu menu[]; 
    134135        extern Frame frame; 
     
    142143        { 
    143144                thismenu = &(menu[curmenu]); 
    144                 thismenu->X = xv_create(NULL,MENU,0); 
     145                thismenu->X = xv_create(0,MENU,0); 
    145146                if(strcmp(thismenu->label,"File")==0) 
    146147                { 
     
    301302*/ 
    302303 
    303 MakeNAADisplay() 
     304void MakeNAADisplay() 
    304305{ 
    305306        extern Panel menubar; 
     
    307308        extern Frame frame; 
    308309        extern Canvas EditCan; 
    309         extern NA_Alignment *DataSet; 
     310/*      extern NA_Alignment *DataSet; */ 
    310311        extern Xv_singlecolor Default_Colors[]; 
    311312        Scrollbar hscroll,vscroll; 
     
    421422 
    422423 
    423                 if(colmap == NULL) 
    424                         colmap = (Cms)xv_create(NULL,CMS, 
     424                if(colmap == 0) 
     425                        colmap = (Cms)xv_create(0,CMS, 
    425426                            CMS_TYPE,XV_STATIC_CMS, 
    426427                            CMS_SIZE,16, 
     
    466467        gcv.font = (Font)xv_get(font,XV_XID); 
    467468 
    468         if(gcv.font != NULL) 
     469        if(gcv.font != 0) 
    469470                XChangeGC(dpy,gc,GCFont,&gcv); 
    470471 
     
    506507 
    507508        extern Frame frame; 
    508         extern int Default_Color_LKUP[]; 
    509         extern DisplayAttr; 
     509/*      extern int Default_Color_LKUP[]; */ 
     510/*      extern DisplayAttr; */ 
    510511 
    511512        int reset_all; 
     
    603604 
    604605 
    605 DummyRepaint(can,win,dpy,xwin,area) 
    606 Canvas can; 
    607 Xv_window win; 
    608 Display *dpy; 
    609 Window xwin; 
    610 Xv_xrectlist *area; 
     606int DummyRepaint(can,win,dpy,xwin,area) 
     607     Canvas        can; 
     608     Xv_window    win; 
     609     Display      *dpy; 
     610     Window        xwin; 
     611     Xv_xrectlist *area; 
    611612{ 
    612613        DrawNANames(dpy,xwin); 
     
    614615} 
    615616 
    616 DrawNANames(dpy,xwin) 
    617 Display *dpy; 
    618 Window xwin; 
     617int DrawNANames(dpy,xwin) 
     618     Display *dpy; 
     619     Window  xwin; 
    619620{ 
    620621        extern NA_Alignment *DataSet; 
     
    623624        NA_Alignment *aln; 
    624625        NA_Sequence *element; 
    625         int maxseq,minseq,maxnoseq,i,j; 
     626        int maxseq,minseq,maxnoseq,/*i,*/j; 
    626627        unsigned long *pixels; 
    627628        char buffer[GBUFSIZ]; 
     
    677678 
    678679 
    679 RepaintNACan(can,win,dpy,xwin,area) 
    680 Canvas can; 
    681 Xv_window win; 
    682 Display *dpy; 
    683 Window xwin; 
    684 Xv_xrectlist *area; 
     680int RepaintNACan(can,win,dpy,xwin,area) 
     681     Canvas        can; 
     682     Xv_window    win; 
     683     Display      *dpy; 
     684     Window        xwin; 
     685     Xv_xrectlist *area; 
    685686{ 
    686687        extern NA_Alignment *DataSet; 
     
    697698        gc = DefaultGC(dpy,scrn); 
    698699 
    699         if(DataSet == NULL || can == NULL) 
    700                 return XV_OK; 
     700        if(DataSet == 0 || can == 0) 
     701        return XV_OK; 
    701702 
    702703        NAdd = (NA_DisplayData*)(DataSet)->na_ddata; 
    703704        if(NAdd == NULL) 
    704                 return XV_OK; 
     705        return XV_OK; 
    705706        for(;xv_get(can,CANVAS_RETAINED)==TRUE;) 
    706707                xv_set(can,CANVAS_RETAINED,FALSE,0); 
     
    795796        (void)window_fit(EditNameCan); 
    796797        (void)window_fit(frame); 
    797         return; 
     798        return XV_OK; 
    798799} 
    799800 
    800801        extern NA_Alignment *DataSet; 
    801802 
    802 SetNACursor(NAdd,can,win,xwin,dpy,gc) 
    803 NA_DisplayData *NAdd; 
    804 Canvas can; 
    805 Xv_window win; 
    806 Window xwin; 
    807 Display *dpy; 
    808 GC gc; 
    809 { 
    810         extern int repeat_cnt,EditMode,SCALE; 
    811         extern Panel_item left_foot,right_foot; 
     803void SetNACursor(NAdd,can,win,xwin,dpy,gc) 
     804     NA_DisplayData *NAdd; 
     805     Canvas          can; 
     806     Xv_window      win; 
     807     Window          xwin; 
     808     Display        *dpy; 
     809     GC              gc; 
     810{ 
     811        extern int repeat_cnt,EditMode/*,SCALE*/; 
     812        extern Panel_item left_foot/*,right_foot*/; 
    812813        extern Frame frame; 
    813814 
     
    868869 
    869870 
    870 UnsetNACursor(NAdd,can,win,xwin,dpy,gc) 
    871 NA_DisplayData *NAdd; 
    872 Canvas can; 
    873 Xv_window win; 
    874 Window xwin; 
    875 Display *dpy; 
    876 GC gc; 
    877 { 
    878         NA_DisplayData *ddata; 
     871void UnsetNACursor(NAdd,can,win,xwin,dpy,gc) 
     872     NA_DisplayData *NAdd; 
     873     Canvas          can; 
     874     Xv_window      win; 
     875     Window          xwin; 
     876     Display        *dpy; 
     877     GC              gc; 
     878{ 
     879/*      NA_DisplayData *ddata; */ 
    879880        NA_Alignment *aln; 
    880         Scrollbar vscroll=NULL,hscroll=NULL; 
     881        Scrollbar vscroll=0,hscroll=0; 
    881882        Xv_window view; 
    882         extern int SCALE; 
     883/*      extern int SCALE; */ 
    883884        int x,y,xx,yy,j; 
    884885 
     
    911912 
    912913 
    913 ResizeNACan(canvas,wd,ht) 
    914 Canvas canvas; 
    915 int wd,ht; 
     914int ResizeNACan(canvas,wd,ht) 
     915     Canvas canvas; 
     916     int    wd,ht; 
    916917{ 
    917918        int dy; 
  • trunk/GDE/CORE/ChooseFile.c

    r2 r1003  
    55Woese. 
    66*/ 
    7 /* File picker by Mike Maciukenas  
    8 ** Allows the user to search up and down the directory tree, and choose a  
    9 **  file.   
     7/* File picker by Mike Maciukenas 
     8** Allows the user to search up and down the directory tree, and choose a 
     9**  file. 
    1010** "Open" descends down into a directory, or chooses a file (depending **  on what is selected).  The user may also press return after choosing 
    1111**  a file or directory, to do the same thing. 
    12 ** "Up Dir" ascends to the parent directory.   
     12** "Up Dir" ascends to the parent directory. 
    1313** "Cancel" cancels the operation. 
    1414** The user may also type a directory into the "Directory:" field.  When the 
     
    182182  XSetForeground(display,fl_gc,BlackPixel(display,DefaultScreen(display))); 
    183183  XSetBackground(display,fl_gc,WhitePixel(display,DefaultScreen(display))); 
    184    
     184 
    185185 
    186186  /* set up the extra trailing node for the linked list, makes insertion 
     
    331331FILE *file; 
    332332char *buf; 
    333 {   
     333{ 
    334334        int ic; 
    335335        int i = 0; 
    336336 
    337         while (((ic=getc(file)) != EOF) && ((char)ic != '\n'))   
     337        while (((ic=getc(file)) != EOF) && ((char)ic != '\n')) 
    338338            buf[i++]= (char)ic; 
    339339        buf[i] = '\0'; 
    340340} 
    341341 
    342 int fl_make_list()  
     342int fl_make_list() 
    343343/* Creates a list of files, out of the current working directory.  It then 
    344344** tells the file list canvas to refresh itself.  The list sits attached to 
     
    349349  int i, list_len, cur_pos; 
    350350  char dirname[GBUFSIZ], tempbuf[GBUFSIZ]; 
    351   NameData *current, *temp;                     /* structures for reading  
     351  NameData *current, *temp;                     /* structures for reading 
    352352                                                ** and sorting file names */ 
    353353  int notdone; 
     
    526526  xwin = (Window)xv_get(paint_window, XV_XID); 
    527527 
    528   /* clear the area given us by Xview, for simplicity, we clear the  
     528  /* clear the area given us by Xview, for simplicity, we clear the 
    529529  ** smallest rectangle that encloses all of the destroyed areas, the 
    530530  ** rl_bound rectangle */ 
     
    581581                { 
    582582                picked = (event_y(event) - 1)  / fl_cell_h; 
    583                 /* make sure the file picked is on screen.  if it is not,  
     583                /* make sure the file picked is on screen.  if it is not, 
    584584                ** we just ignore it.  this avoids wierd stuff, like being 
    585585                ** able to pick files that aren't shown on screen */ 
     
    611611                 } 
    612612                } 
    613         /* user may have pressed return, then just call the open button  
     613        /* user may have pressed return, then just call the open button 
    614614        ** callback procedure.  PANEL_FIRST_ITEM gets the pointer to the 
    615         ** open button itself, since it happens to be the first item on  
    616         ** the panel. fl_open_btn doesn't really use this parameter, but  
     615        ** open button itself, since it happens to be the first item on 
     616        ** the panel. fl_open_btn doesn't really use this parameter, but 
    617617        ** just in case it ever does, we include it. */ 
    618618        else if((event_is_ascii(event))&&(event_action(event) == '\r')) 
     
    629629Notify_value 
    630630fl_free_mem(client, status) 
    631 /* clean up when the frame is destroyed.  Frees up the memory used in the  
     631/* clean up when the frame is destroyed.  Frees up the memory used in the 
    632632** linked list of file names, and sets the Frame variable (getframe) to null */ 
    633633Notify_client client; 
  • trunk/GDE/CORE/EventHandler.c

    r655 r1003  
    3636{ 
    3737 
    38         int i,j,k,curmenu,curitem; 
     38        int i,j,/*k,*/curmenu,curitem; 
    3939        Gmenu *thismenu; 
    4040        GmenuItem *thisitem; 
    41         Panel choice; 
     41/*      Panel choice; */ 
    4242        char *label1; 
    4343 
  • trunk/GDE/CORE/FileIO.c

    r655 r1003  
    2828        extern char FileName[]; 
    2929 
    30 LoadData(filename) 
     30void LoadData(filename) 
    3131char *filename; 
    3232{ 
     
    111111*/ 
    112112 
    113 LoadFile(filename,dataset,type,format) 
    114 char *filename; 
    115 NA_Alignment *dataset; 
    116 int type,format; 
     113void LoadFile(filename,dataset,type,format) 
     114     char        *filename; 
     115     NA_Alignment *dataset; 
     116     int          type,format; 
    117117{ 
    118118        extern int DataType; 
     
    157157 
    158158/* 
    159 *       Print error message, and die 
    160 */ 
    161 ErrorOut(code,string) 
    162 int code; 
    163 char *string; 
     159 *      Print error message, and die 
     160 */ 
     161void ErrorOut(code,string) 
     162     int  code; 
     163     const char *string; 
    164164{ 
    165165        if (code == 0) 
     
    178178int count,size; 
    179179{ 
    180         char *temp; 
     180        char       *temp; 
    181181#ifdef SeeAlloc 
    182         extern int TotalCalloc; 
     182        extern int  TotalCalloc; 
    183183        TotalCalloc += count*size; 
    184184        fprintf(stderr,"Calloc %d %d\n",count*size,TotalCalloc); 
    185185#endif 
    186         temp = calloc(count,size); 
    187         ErrorOut(temp,"Cannot allocate memory"); 
     186        temp         = calloc(count,size); 
     187        ErrorOut(temp == 0,"Cannot allocate memory"); 
    188188        return(temp); 
    189189} 
     
    193193int size; 
    194194{ 
    195         char *temp; 
     195        char       *temp; 
    196196#ifdef SeeAlloc 
    197         extern int TotalRealloc; 
     197        extern int  TotalRealloc; 
    198198        TotalRealloc += size; 
    199199        fprintf(stderr,"Realloc %d\n",TotalRealloc); 
    200200#endif 
    201         temp=realloc(block,size); 
    202         ErrorOut(temp,"Cannot change memory size"); 
     201        temp          = realloc(block,size); 
     202        ErrorOut(temp == 0,"Cannot change memory size"); 
    203203        return(temp); 
    204204} 
    205205 
    206 Cfree(block) 
     206void Cfree(block) 
    207207char* block; 
    208208{ 
    209         if (block) 
    210         { 
    211                 cfree(block); 
    212         } 
    213         else 
    214                 Warning("Error in Cfree, NULL block"); 
    215         return; 
     209        if (block) cfree(block); 
     210        else Warning("Error in Cfree, NULL block"); 
    216211} 
    217212 
     
    232227 
    233228 
    234 FindType(name,dtype,ftype) 
     229int FindType(name,dtype,ftype) 
    235230char *name; 
    236231int *dtype,*ftype; 
     
    303298} 
    304299 
    305 AppendNA(buffer,len,seq) 
     300void AppendNA(buffer,len,seq) 
    306301NA_Base *buffer; 
    307302int len; 
     
    309304{ 
    310305        int curlen=0,j; 
    311         NA_Base *temp; 
     306/*      NA_Base *temp; */ 
    312307 
    313308        if(seq->seqlen+len >= seq->seqmaxlen) 
     
    333328} 
    334329 
    335 Ascii2NA(buffer,len,matrix) 
    336 char *buffer; 
    337 int len; 
    338 int matrix[16]; 
     330void Ascii2NA(buffer,len,matrix) 
     331     char *buffer; 
     332     int  len; 
     333     int  matrix[16]; 
    339334{ 
    340335        /* 
     
    342337*       encode the buffer. 
    343338*/ 
    344         register i; 
     339        register int i; 
    345340        if(matrix != NULL) 
    346341                for(i=0;i<len;i++) 
     
    350345 
    351346WriteNA_Flat(aln,filename,method,maskable) 
    352 NA_Alignment *aln; 
    353 char *filename; 
    354 int method,maskable; 
     347     NA_Alignment *aln; 
     348     char        *filename; 
     349     int          method,maskable; 
    355350{ 
    356351        int j,kk,mask = -1,k,offset,min_offset= -999999; 
     
    504499 
    505500 
    506 Warning(s) 
    507 char *s; 
     501void Warning(s) 
     502     const char *s; 
    508503{ 
    509504        extern Frame frame; 
  • trunk/GDE/CORE/Genbank.c

    r655 r1003  
    427427} 
    428428 
    429  
    430 SetTime(a) 
    431 struct 
    432 { 
    433         int yy; 
    434         int mm; 
    435         int dd; 
    436         int hr; 
    437         int mn; 
    438         int sc; 
    439 } *a; 
     429SetTime(struct gde_time *a) 
    440430{ 
    441431        struct tm *tim,*localtime(); 
  • trunk/GDE/CORE/Makefile

    r887 r1003  
    1515update: $(ARBHOME)/bin/arb_gde 
    1616 
    17 proto: 
     17proto: functions.h 
     18 
     19$(CCOBJS) : functions.h 
     20 
     21functions.h: $(CCOBJS:.o=.c) 
    1822        rm -f functions.h 
    1923        ../../MAKEBIN/aisc_mkpt -C *.c >functions.h 
  • trunk/GDE/CORE/ParseMenu.c

    r655 r1003  
    2323int num_menus; 
    2424 
    25 ParseMenu() 
     25void ParseMenu() 
    2626{ 
    2727        int j,curmenu = -1,curitem = 0; 
     
    229229                                        Error("Calloc"); 
    230230                        } 
    231                         else if(strcmp(temp,"choice_list")==0) 
    232                                 thisarg->type=CHOICE_LIST; 
    233                         else if(strcmp(temp,"choice_menu")==0) 
    234                                 thisarg->type=CHOICE_MENU; 
    235                         else if(strcmp(temp,"chooser")==0) 
    236                                 thisarg->type=CHOOSER; 
    237                         else if(strcmp(temp,"slider")==0) 
    238                                 thisarg->type=SLIDER; 
    239                         else 
    240                                 Error(sprintf(head,"Unknown argtype %s",temp)); 
     231                        else if(strcmp(temp,"choice_list") == 0) 
     232                                thisarg->type                   = CHOICE_LIST; 
     233                        else if(strcmp(temp,"choice_menu") == 0) 
     234                                thisarg->type                   = CHOICE_MENU; 
     235                        else if(strcmp(temp,"chooser")     == 0) 
     236                                thisarg->type                   = CHOOSER; 
     237                        else if(strcmp(temp,"slider")      == 0) 
     238                                thisarg->type                   = SLIDER; 
     239                        else { 
     240                sprintf(head,"Unknown argtype %s",temp); 
     241                                Error(head); 
     242            } 
    241243                } 
    242244/* 
     
    483485Find(): Search the target string for the given key 
    484486*/ 
    485 Find(target,key) 
    486 char *key,*target; 
     487int Find(target,key) 
     488char *target; 
     489const char *key; 
    487490{ 
    488491        int i,j,len1,dif,flag = FALSE; 
     
    501504 
    502505 
    503 Find2(target,key) 
    504 char *key,*target; 
    505 /* 
    506 *       Like find, but returns the index of the leftmost 
    507 *       occurence, and -1 if not found. 
    508 */ 
     506int Find2(target,key) 
     507     char       *target; 
     508     const char *key; 
     509     /* 
     510      * Like find, but returns the index of the leftmost 
     511      * occurence, and -1 if not found. 
     512      */ 
    509513{ 
    510514        int i,j,len1,dif,flag = FALSE; 
     
    523527 
    524528 
    525 Error(msg) 
    526 char *msg; 
     529void Error(msg) 
     530     const char *msg; 
    527531{ 
    528532        (void)fprintf(stderr,"%s\n",msg); 
     
    550554*/ 
    551555 
    552 crop(input,head,tail) 
     556void crop(input,head,tail) 
    553557char input[],head[],tail[]; 
    554558{ 
  • trunk/GDE/CORE/arbdb_io.c

    r2 r1003  
    1010        extern Frame frame; 
    1111 
    12 int  
     12int 
    1313Arbdb_get_curelem(NA_Alignment *dataset) 
    1414{ 
     
    3030extern int Default_PROColor_LKUP[],Default_NAColor_LKUP[]; 
    3131 
    32 ReadArbdb(filename,dataset,type) 
     32void ReadArbdb(filename,dataset,type) 
    3333char *filename; 
    3434NA_Alignment *dataset; 
     
    7878 
    7979                gbd = GB_find(gb_species,"author",0,down_level); 
    80                 if (gbd)  
     80                if (gbd) 
    8181                        strncpy(this_elem->authority,GB_read_char_pntr(gbd),79); 
    8282                gbd = GB_find(gb_species,"full_name",0,down_level); 
    83                 if (gbd)  
     83                if (gbd) 
    8484                        strncpy(this_elem->seq_name,GB_read_char_pntr(gbd),79); 
    8585                gbd = GB_find(gb_species,"acc",0,down_level); 
    86                 if (gbd)  
     86                if (gbd) 
    8787                        strncpy(this_elem->id,GB_read_char_pntr(gbd),79); 
    8888                AppendNA((NA_Base *)GB_read_char_pntr(gb_data), 
     
    9090                                this_elem); 
    9191                this_elem->comments = strdup("no comments"); 
    92                 this_elem->comments_maxlen = 1 +  
     92                this_elem->comments_maxlen = 1 + 
    9393                (this_elem->comments_len = strlen("no comments")); 
    9494 
     
    120120 
    121121WriteArbdb(aln,filename,method,maskable) 
    122 NA_Alignment *aln; 
    123 char *filename; 
    124 int method,maskable; 
     122     NA_Alignment *aln; 
     123     char        *filename; 
     124     int          method,maskable; 
    125125{ 
    126126        int     j,k; 
    127         GBDATA *gb_ali; 
     127/*      GBDATA *gb_ali; */ 
    128128        GBDATA *gb_data; 
    129         GBDATA *gb_name; 
     129/*      GBDATA *gb_name; */ 
    130130        GBDATA *gb_species_data; 
    131131        GBDATA  *gbd; 
     
    171171                                case 2: 
    172172                                        this_elem->gb_species = 0; 
    173                                         continue;                                
     173                                        continue; 
    174174                                } 
    175175                        }else{ 
     
    191191                                default: 
    192192                                        continue; 
    193                                 }                                
    194                         }                                        
     193                                } 
     194                        } 
    195195                }else if (this_elem->gb_species != gb_species) {        /* a copied species */ 
    196196                        if (gb_species) { 
     
    213213                                default: 
    214214                                        continue; 
    215                                 }        
     215                                } 
    216216                        }else{ 
    217217                                int select_mode = notice_prompt(frame,NULL,NOTICE_MESSAGE_STRINGS, 
     
    233233                                default: 
    234234                                        continue; 
    235                                 }        
     235                                } 
    236236                        } 
    237237                } 
     
    285285} 
    286286 
    287 Updata_Arbdb(item,event) 
     287void Updata_Arbdb(item,event) 
    288288Panel_item item; 
    289289Event *event; 
  • trunk/GDE/CORE/defines.h

    r2 r1003  
    119119#define IS_ORIG_3_TO_5  0x400   /* Original sequence was 3_to_5 */ 
    120120 
    121 #ifdef HGL  
     121#ifdef HGL 
    122122#define DEFAULT_X_ATTR  0 
    123 #else  
     123#else 
    124124#define DEFAULT_X_ATTR  IS_5_TO_3+IS_PRIMARY; 
    125125#endif 
     
    244244        NA_Sequence **group;            /* link to array of pointers into 
    245245                                           each group */ 
    246         char *na_ddata;                 /* display data */  
     246        char *na_ddata;                 /* display data */ 
    247247        int format;                     /* default file format */ 
    248248        char *selection_mask;           /* Sub sequence selection mask */ 
     
    287287} NA_DisplayData; 
    288288 
     289struct gde_time { int yy; int mm; int dd; int hr; int mn; int sc; }; 
     290 
    289291 
    290292#define getcmask(a,b) (b < ((a)->offset))?0:((a)->cmask[(b-(a)->offset)]) 
  • trunk/GDE/CORE/functions.h

    r2 r1003  
    11#ifndef P_ 
    2 #if defined(__STDC__) || defined(__cplusplus) 
    3 # define P_(s) s 
     2# if defined(__STDC__) || defined(__cplusplus) 
     3#  define P_(s) s 
     4# else 
     5#  define P_(s) () 
     6# endif 
    47#else 
    5 # define P_(s) () 
    6 #endif 
     8# error P_ already defined elsewhere 
    79#endif 
    810 
     11#ifdef __cplusplus 
     12extern "C" { 
     13#endif 
    914 
    1015/* BasicDisplay.c */ 
     16int QuitGDE P_((void)); 
     17int QuitGDE_update P_((Panel_item item, Event *event)); 
    1118Panel BasicDisplay P_((NA_Alignment *DataSet)); 
    1219void bailout P_((void)); 
    13 int GenMenu P_((int type)); 
    14 int MakeNAADisplay P_((void)); 
     20void GenMenu P_((int type)); 
     21void MakeNAADisplay P_((void)); 
    1522NA_DisplayData *SetNADData P_((NA_Alignment *aln, Canvas Can, Canvas NamCan)); 
    16 int DummyRepaint (); 
     23int DummyRepaint(); 
    1724int DrawNANames P_((Display *dpy, Window xwin)); 
    18 int RepaintNACan (); 
    19 int SetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc)); 
    20 int UnsetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc)); 
     25int RepaintNACan(); 
     26void SetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc)); 
     27void UnsetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc)); 
    2128int ResizeNACan P_((Canvas canvas, int wd, int ht)); 
    22 int QuitGDE P_((void)); 
    2329 
    2430/* BuiltIn.c */ 
     
    122128 
    123129/* FileIO.c */ 
    124 int LoadData P_((char *filename)); 
    125 int LoadFile P_((char *filename, NA_Alignment *dataset, int type, int format)); 
    126 int ErrorOut P_((int code, char *string)); 
     130void LoadData P_((char *filename)); 
     131void LoadFile P_((char *filename, NA_Alignment *dataset, int type, int format)); 
     132void ErrorOut P_((int code, const char *string)); 
    127133char *Calloc P_((int count, int size)); 
    128134char *Realloc P_((char *block, int size)); 
    129 int Cfree P_((char *block)); 
     135void Cfree P_((char *block)); 
    130136char *String P_((char *string)); 
    131137int FindType P_((char *name, int *dtype, int *ftype)); 
    132 int AppendNA P_((NA_Base *buffer, int len, NA_Sequence *seq)); 
    133 int Ascii2NA P_((char *buffer, int len, int matrix[16 ])); 
     138void AppendNA P_((NA_Base *buffer, int len, NA_Sequence *seq)); 
     139void Ascii2NA P_((char *buffer, int len, int matrix[16 ])); 
    134140int WriteNA_Flat P_((NA_Alignment *aln, char *filename, int method, int maskable)); 
    135 int Warning P_((char *s)); 
     141void Warning P_((const char *s)); 
    136142int InitNASeq P_((NA_Sequence *seq, int type)); 
    137143int ReadCMask P_((char *filename)); 
     
    149155/* Genbank.c */ 
    150156int ReadGen P_((char *filename, NA_Alignment *dataset, int type)); 
     157int WriteGen P_((NA_Alignment *aln, char *filename, int method, int maskable)); 
     158int SetTime P_((struct gde_time *a)); 
     159int CheckType P_((char *seq, int len)); 
    151160 
    152161/* HGLfile.c */ 
     
    160169 
    161170/* ParseMenu.c */ 
    162 int ParseMenu P_((void)); 
    163 int Find P_((char *target, char *key)); 
    164 int Find2 P_((char *target, char *key)); 
    165 int Error P_((char *msg)); 
     171void ParseMenu P_((void)); 
     172int Find P_((char *target, const char *key)); 
     173int Find2 P_((char *target, const char *key)); 
     174void Error P_((const char *msg)); 
    166175int getline P_((FILE *file, char string[])); 
    167 int crop P_((char input[], char head[], char tail[])); 
     176void crop P_((char input[], char head[], char tail[])); 
    168177 
    169178/* Scroll.c */ 
     
    176185/* arbdb_io.c */ 
    177186int Arbdb_get_curelem P_((NA_Alignment *dataset)); 
    178 int ReadArbdb P_((char *filename, NA_Alignment *dataset, int type)); 
     187void ReadArbdb P_((char *filename, NA_Alignment *dataset, int type)); 
    179188int WriteArbdb P_((NA_Alignment *aln, char *filename, int method, int maskable)); 
    180 int Updata_Arbdb P_((Panel_item item, Event *event)); 
     189void Updata_Arbdb P_((Panel_item item, Event *event)); 
    181190 
    182191/* main.c */ 
    183192int main P_((int argc, char **argv)); 
    184193 
     194#ifdef __cplusplus 
     195} 
     196#endif 
     197 
    185198#undef P_ 
  • trunk/GDE/CORE/main.c

    r655 r1003  
    11#include <stdio.h> 
     2#include <unistd.h> 
    23#include <xview/defaults.h> 
    34#include <xview/xview.h> 
     
    4950mpr_static(iconpr,64,64,1,GDEicon); 
    5051 
    51 main(argc,argv) 
    52 int argc; 
    53 char **argv; 
     52int main(argc,argv) 
     53     int    argc; 
     54     char **argv; 
    5455{ 
    5556 
     
    7677*/ 
    7778 
    78         frame = xv_create(NULL,FRAME, 
     79        frame = xv_create(0,FRAME, 
    7980            FRAME_NO_CONFIRM,FALSE, 
    8081            FRAME_LABEL,    "Genetic Data Environment 2.2", 
     
    163164                    ((NA_Alignment*)DataSet,EditCan,EditNameCan); 
    164165 
    165         tool_icon = xv_create(NULL,ICON, 
     166        tool_icon = xv_create(0,ICON, 
    166167            ICON_IMAGE,&iconpr, 
    167168            ICON_LABEL,strlen(FileName)>0?FileName:"GDE", 
  • trunk/GENOM/GEN_map.cxx

    r972 r1003  
    406406            gen_assert(ask_to_overwrite_alignment); 
    407407 
    408             char *question = strdup(GBS_global_string("Already have a gene-species for %s/%s ('%s')", species_name, gene_name, existing_name)); 
     408            char *question = GBS_global_string_copy("Already have a gene-species for %s/%s ('%s')", species_name, gene_name, existing_name); 
    409409            int   answer   = ask_about_existing_gene_species->get_answer(question, "Overwrite species,Insert new alignment,Skip,Create new", "all", true); 
    410410 
     
    421421                    GBDATA *gb_ali = GB_find(gb_exist_geneSpec, ali, 0, down_level); 
    422422                    if (gb_ali) { // the alignment already exists 
    423                         char *question2        = strdup(GBS_global_string("Gene-species '%s' already has data in '%s'", existing_name, ali)); 
     423                        char *question2        = GBS_global_string_copy("Gene-species '%s' already has data in '%s'", existing_name, ali); 
    424424                        int   overwrite_answer = ask_to_overwrite_alignment->get_answer(question2, "Overwrite data,Skip", "all", true); 
    425425 
  • trunk/HELP_SOURCE/oldhelp/macro.hlp

    r387 r1003  
    1414 
    1515DESCRIPTION     Macros are used to combine a set of menu-actions. They work like 
    16                 a tape recorder, which records all buttons presses. 
     16                a tape recorder, which records all buttons presses, every input 
     17                to data fields, ... 
    1718 
    1819                To execute an existing macro select a macro and press <EXECUTE> 
     
    3435BUGS            -       Only buttons, values and menus are recorded 
    3536                -       When recording a macro you have to open a subwindow 
    36                         before you can press the buttons within.  
     37                        before you can press the buttons within. 
    3738                        Hint: Close all subwindows before you start to build a 
    3839                        macro. 
    3940                -       Only value changes are recorded. If you open a subwindow 
    40                         and just press the go button, all user changeable  
     41                        and just press the go button, all user changeable 
    4142                        parameters are unchanged. If you want a parameter set 
    4243                        to a certain value, you have to change it. Sometimes it 
    4344                        is necessary to change it to any value and than back to 
    44                         the real value, just to ensure that it is recorded in  
     45                        the real value, just to ensure that it is recorded in 
    4546                        the macros. 
    4647                -       Only actions within the main application are recorded. 
  • trunk/HELP_SOURCE/oldhelp/scandb.hlp

    r941 r1003  
    1212TITLE           Scan Database for all Fields 
    1313 
    14 OCCURRENCE      ARB_NT/Species|Genes|Experiments/Info/FIELDS/Unhide all fields 
    15                 ARB_NT/Species|Genes|Experiments/Info/FIELDS/Delete unused fields 
    16                 ARB_NT/Species|Genes|Experiments/Info/FIELDS/Rebuild fields 
     14OCCURRENCE      ARB_NT/Species|Genes|Experiments/Info/FIELDS/Show all hidden fields 
     15                ARB_NT/Species|Genes|Experiments/Info/FIELDS/Scan unknown fields 
     16                ARB_NT/Species|Genes|Experiments/Info/FIELDS/Remove unused fields 
    1717 
    1818DESCRIPTION     Each function scans the database to detect all existing fields. 
    1919 
    20                 The first function adds all unknown/hidden fields to the list 
    21                 of known fields. 
     20                - 'Show all hidden fields' unhides all currently hidden fields. 
    2221 
    23                 The second function removes all non-existant fields. 
     22                - 'Scan unknown fields' scans the database for fields that are not listed 
     23                  in the field list and adds them to that list. 
    2424 
    25                 The third functions does both. It additionally resets the field sort order. 
     25                - 'Remove unused fields' deletes all fields from the field-list which are 
     26                  not used anywhere in the database. 
    2627 
    27                 Normally it is not necessary to run any of this procedures unless 
     28NOTE            Normally it is not necessary to run 'Scan unknown fields' unless 
    2829                some external programs generate new and yet unknown fields 
    29                 or if the ARB programmers forgot to mark a field as known. 
     30                or if the ARB programmers forgot to announce a field as known. 
    3031 
    3132                In the latter case please write to LINK{devel@arb-home.de} and describe which 
    3233                fields was created by doing what. 
    33  
    34 NOTES           None 
    3534 
    3635EXAMPLES        None 
  • trunk/HELP_SOURCE/oldhelp/set_protection.hlp

    r387 r1003  
    1111TITLE           Set Protection Level of Field of Listed Species 
    1212 
    13 OCCURRENCE      <ARB_NT/Species/Search/Do On Listed/Set Protection ...> 
     13OCCURRENCE      <ARB_NT/Species/Search&Query/More functions/Set Protection ...> 
    1414 
    1515DESCRIPTION     Set the protection level of one field of listed species. 
  • trunk/HELP_SOURCE/oldhelp/sp_search.hlp

    r941 r1003  
    9191 
    9292WARNINGS        If the hitlist becomes too long, it will be truncated. 
     93                Nevertheless all operations work on non-truncated hitlist! 
    9394 
    9495BUGS            No bugs known 
  • trunk/HELP_SOURCE/oldhelp/version.hlp

    r387 r1003  
    33 
    44#Please insert subtopic references  (line starts with keyword SUB) 
    5 #SUB    subtopic.hlp 
     5SUB     changes.hlp 
    66 
    77# Hypertext links in helptext can be added like this: {ref.hlp:visible_text} 
     
    1010TITLE           Version Info 
    1111 
    12  
     12NOTE            See LINK{changes.hlp} for info about current versions. 
    1313 
    1414SECTION OLD VERSION LIST 
  • trunk/MERGE/MG_gene_species.cxx

    r868 r1003  
    44//    Purpose   : Transfer fields from organism and gene when            // 
    55//                tranferring gene species                               // 
    6 //    Time-stamp: <Fri Aug/23/2002 22:09 MET Coder@ReallySoft.de>        // 
     6//    Time-stamp: <Tue Dec/03/2002 15:01 MET Coder@ReallySoft.de>        // 
    77//                                                                       // 
    88//                                                                       // 
     
    294294    if (error) { 
    295295        free(result); 
    296         result = strdup(GBS_global_string("<%s>", error)); 
     296        result = GBS_global_string_copy("<%s>", error); 
    297297    } 
    298298 
  • trunk/MERGE/MG_species.cxx

    r823 r1003  
    308308                } 
    309309                awt_add_new_changekey(gb_dest,name,(int)GB_read_int(gb_key_type)); 
    310                 delete name; 
     310                free(name); 
    311311        } 
    312312} 
     
    946946            D_alignment_names[d++] = D_alignment_names[s]; 
    947947        }else{ 
    948             delete D_alignment_names[s]; 
     948            free(D_alignment_names[s]); 
    949949            D_alignment_names[s] = 0; 
    950950        } 
     
    984984            } 
    985985            dest = D_alignment_names[aliid]; 
    986             delete b; 
     986            free(b); 
    987987            break; 
    988988    }; 
     
    994994    } 
    995995 mg_eq_end: 
    996     delete type; 
     996    free(type); 
    997997    GBT_free_names(M_alignment_names); 
    998998    GBT_free_names(D_alignment_names); 
     
    10211021    GBDATA *M_species; 
    10221022    GBDATA *D_species; 
    1023     delete m_name; m_name = 0; 
     1023    free(m_name); m_name = 0; 
    10241024    for (       M_species       = GB_find(M_species_data,"species",0,down_level); 
    10251025            M_species; 
    10261026            M_species   = GB_find(M_species,"species",0,this_level | search_next)){ 
    10271027        GBDATA *M_name = GB_search(M_species,"name",GB_STRING); 
    1028         delete m_name; 
     1028        free(m_name); 
    10291029        m_name = GB_read_string(M_name); 
    10301030        int count = 1; 
  • trunk/MULTI_PROBE/MP_noclass.cxx

    r982 r1003  
    449449    //     aw_message(GBS_global_string("backward='%i'", int(backward))); 
    450450 
    451     aww->move_selection(result_probes_list, mp_main->get_aw_root()->awar(MP_AWAR_RESULTPROBES), backward ? -1 : 1); 
     451    //     aww->move_selection(result_probes_list, mp_main->get_aw_root()->awar(MP_AWAR_RESULTPROBES), backward ? -1 : 1); 
     452    aww->move_selection(result_probes_list, MP_AWAR_RESULTPROBES, backward ? -1 : 1); 
    452453 
    453454    MP_show_probes_in_tree(aww); 
  • trunk/Makefile

    r989 r1003  
    827827pa:             $(PARSIMONY) 
    828828tg:             $(TREEGEN) 
    829 se:             $(SECEDIT) 
     829#se:            $(SECEDIT) 
    830830acc:    $(ACORR) 
    831831 
     
    842842 
    843843te:             $(TEST) 
    844 sec:    $(SECEDIT) 
     844#sec:   $(SECEDIT) 
    845845de:             $(AWDEMO) 
    846846 
  • trunk/NTREE/NT_cb.cxx

    r805 r1003  
    7373    if (ltree){ 
    7474        aww->get_root()->awar(awar_tree)->write_string(ltree); 
    75         delete ltree; 
     75        free(ltree); 
    7676    } 
    7777} 
  • trunk/NTREE/NT_concatenate.cxx

    r1000 r1003  
    7272    AW_root *aw_root = cas->aws->get_root(); 
    7373    char *ali_type   = aw_root->awar(AWAR_CON_SEQUENCE_TYPE)->read_string(); 
    74     ali_type         = strdup(GBS_global_string("%s=", ali_type)); 
     74    ali_type         = GBS_global_string_copy("%s=", ali_type); 
    7575 
    7676        cas->aws->clear_selection_list(cas->db_id); //clearing the selection list 
     
    129129    AW_root *aw_root  = aws->get_root(); 
    130130    char    *ali_type = aw_root->awar(AWAR_CON_SEQUENCE_TYPE)->read_string();  //reading sequence type from the concatenation window 
    131     ali_type          = strdup(GBS_global_string("%s=", ali_type));            // copying the awar with '=' appended to it 
     131    ali_type          = GBS_global_string_copy("%s=", ali_type);            // copying the awar with '=' appended to it 
    132132 
    133133        db_alignment_list = aws->create_selection_list(awarName,0,"",10,20); 
     
    330330            else { 
    331331                gb_assert(ask_about_missing_alignment); 
    332                 char *question = strdup(GBS_global_string("\"%s\" alignment doesn`t exist in \"%s\"!", ali_name, GB_read_string(GB_find(gb_species, "full_name", 0, down_level)))); 
     332                char *question = GBS_global_string_copy("\"%s\" alignment doesn`t exist in \"%s\"!", ali_name, GB_read_string(GB_find(gb_species, "full_name", 0, down_level))); 
    333333                int skip_ali = ask_about_missing_alignment->get_answer(question, "Insert Gaps for Missing Alignment,Skip Missing Alignment", "all", true); 
    334334                if(!skip_ali){ 
  • trunk/NTREE/NT_extern.cxx

    r997 r1003  
    118118        GB_textprint(name); 
    119119    } 
    120     delete name; 
     120    free(name); 
    121121} 
    122122 
     
    530530} 
    531531 
    532 void NT_submit_mail(AW_window *aww){ 
    533     char *address = aww->get_root()->awar("/tmp/nt/register/mail")->read_string(); 
     532void NT_submit_mail(AW_window *aww, AW_CL cl_awar_base) { 
     533    char *awar_base = (char*)cl_awar_base; 
     534    char *address   = aww->get_root()->awar(GBS_global_string("%s/address", awar_base))->read_string(); 
     535    char *text      = aww->get_root()->awar(GBS_global_string("%s/text", awar_base))->read_string(); 
    534536    char *plainaddress = GBS_string_eval(address,"\"=:'=\\=",0); // Remove all dangerous symbols 
    535     char *text = aww->get_root()->awar("/tmp/nt/register/text")->read_string(); 
     537 
    536538    char buffer[256]; 
    537539    sprintf(buffer,"/tmp/arb_bugreport_%s",GB_getenvUSER()); 
     540 
    538541    FILE *mail = fopen(buffer,"w"); 
    539542    if (!mail){ 
    540543        aw_message(GB_export_error("Cannot write file %s",buffer)); 
    541     }else{ 
     544    } 
     545    else{ 
    542546        fprintf(mail,"%s\n",text); 
     547        fprintf(mail,"------------------------------\n"); 
    543548        fprintf(mail,"VERSION           :" DATE "\n"); 
    544549        fprintf(mail,"SYSTEMINFO        :\n"); 
     
    548553        system(GBS_global_string("date  >>%s",buffer)); 
    549554        const char *command = GBS_global_string("mail '%s' <%s",plainaddress,buffer); 
     555        printf("%s\n",command); 
    550556        system(command); 
    551         printf("%s\n",command); 
    552         GB_unlink(buffer); 
     557        // GB_unlink(buffer); 
    553558        aww->hide(); 
    554559    } 
    555     delete text; 
    556     delete address; 
    557     delete plainaddress; 
     560 
     561    free(plainaddress); 
     562    free(text); 
     563    free(address); 
    558564} 
    559565 
    560566AW_window *NT_submit_bug(AW_root *aw_root, int bug_report){ 
    561         static AW_window_simple *aws = 0; 
    562         if (aws) return (AW_window *)aws; 
    563  
    564         aws = new AW_window_simple; 
    565         aws->init( aw_root, "SUBMIT_BUG", "SUBMIT INFO", 10, 10 ); 
     567        static AW_window_simple *awss[2] = { 0, 0 }; 
     568        if (awss[bug_report]) return (AW_window *)awss[bug_report]; 
     569 
     570        AW_window_simple *aws = new AW_window_simple; 
     571    if (bug_report) { 
     572        aws->init( aw_root, "SUBMIT_BUG", "Submit a bug", 10, 10 ); 
     573    } 
     574    else { 
     575        aws->init( aw_root, "SUBMIT_REG", "Submit registration", 10, 10 ); 
     576    } 
    566577        aws->load_xfig("bug_report.fig"); 
    567578 
    568         aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
     579        aws->at("close"); 
     580    aws->callback((AW_CB0)AW_POPDOWN); 
    569581        aws->create_button("CLOSE","CLOSE","C"); 
    570582 
    571         aws->at("help");aws->callback(AW_POPUP_HELP,(AW_CL)"registration.hlp"); 
     583        aws->at("help"); 
     584    aws->callback(AW_POPUP_HELP,(AW_CL)"registration.hlp"); 
    572585        aws->create_button("HELP","HELP","H"); 
    573586 
    574         aw_root->awar_string("/tmp/nt/register/mail","arb@arb-home.de"); 
    575         aws->at("mail"); 
    576         aws->create_input_field("/tmp/nt/register/mail"); 
    577  
    578         if (bug_report){ 
    579             aw_root->awar_string("/tmp/nt/register/text","Enter your bug report here:\n"); 
    580         }else{ 
    581             aw_root->awar_string("/tmp/nt/register/text", 
    582                              "******* Registration *******\n" 
    583                              "\n" 
    584                              "Name           :\n" 
    585                              "Department         :\n" 
    586                              "How many users :\n" 
    587                              "Why do you want to use arb ?\n" 
    588                              ); 
    589         } 
    590         aws->at("box"); 
    591         aws->create_text_field("/tmp/nt/register/text"); 
    592  
     587    aws->at("what"); 
     588    aws->create_button("WHAT", (bug_report ? "Bug report" : "ARB Registration")); 
     589 
     590    char *awar_name_start = GBS_global_string_copy("/tmp/nt/feedback/%s", bug_report ? "bugreport" : "registration"); 
     591 
     592    { 
     593        const char *awar_name_address = GBS_global_string("%s/address", awar_name_start); 
     594        aw_root->awar_string(awar_name_address, "arb@arb-home.de"); 
     595 
     596        aws->at("mail"); 
     597        aws->create_input_field(awar_name_address); 
     598    } 
     599 
     600    { 
     601        const char *awar_name_text = GBS_global_string("%s/text", awar_name_start); 
     602 
     603        if (bug_report){ 
     604            aw_root->awar_string(awar_name_text, 
     605                                 "Bug occurred in: [which part of ARB?]\n" 
     606                                 "The bug [ ] is reproducable\n" 
     607                                 "        [ ] occurs randomly\n" 
     608                                 "        [ ] occurs with specific data\n" 
     609                                 "\n" 
     610                                 "Detailed description:\n" 
     611                                 "\n" 
     612                                 ); 
     613        } 
     614        else { 
     615            aw_root->awar_string(awar_name_text, 
     616                                 GBS_global_string("******* Registration *******\n" 
     617                                                   "\n" 
     618                                                   "Name           : %s\n" 
     619                                                   "Department     :\n" 
     620                                                   "How many users :\n" 
     621                                                   "\n" 
     622                                                   "Why do you want to use arb ?\n" 
     623                                                   "\n", 
     624                                                   GB_getenvUSER()) 
     625                                 ); 
     626        } 
     627 
     628        aws->at("box"); 
     629        aws->create_text_field(awar_name_text); 
     630    } 
    593631 
    594632        aws->at("go"); 
    595         aws->callback(NT_submit_mail); 
     633        aws->callback(NT_submit_mail, (AW_CL)awar_name_start); // do not free awar_name_start 
    596634        aws->create_button("SEND","SEND"); 
     635 
     636    awss[bug_report] = aws; // store for further use 
    597637 
    598638        return aws; 
     
    782822    awm->button_length(5); 
    783823 
    784     AW_init_color_group_defaults("arb_ntree"); 
     824    if (!clone) AW_init_color_group_defaults("arb_ntree"); 
    785825 
    786826    nt.tree         = (AWT_graphic_tree*)NT_generate_tree(awr,gb_main); 
  • trunk/NTREE/ad_ali.cxx

    r655 r1003  
    128128 
    129129        if (!error){ 
    130             char *nfield = strdup(GBS_global_string("%s/data",dest)); 
     130            char *nfield = GBS_global_string_copy("%s/data",dest); 
    131131            awt_add_new_changekey( gb_main,nfield,GB_STRING); 
    132132            delete nfield; 
     
    199199            char *nfield = strdup(GBS_global_string("%s/data",name)); 
    200200            awt_add_new_changekey( gb_main,nfield,GB_STRING); 
    201             delete nfield; 
     201            free(nfield); 
    202202            GB_commit_transaction(gb_main); 
    203203        }else{ 
     
    205205        } 
    206206        if (error) aw_message(error); 
    207         delete name; 
     207        free(name); 
    208208} 
    209209 
  • trunk/NTREE/ad_ext.cxx

    r1001 r1003  
    11#include <stdio.h> 
     2#include <stdlib.h> 
    23#include <memory.h> 
    34// #include <malloc.h> 
  • trunk/NTREE/ad_spec.cxx

    r996 r1003  
    5252    else        GBT_abort_rename_session(); 
    5353    if (error) aw_message(error); 
    54     delete source; 
    55     delete dest; 
     54    free(source); 
     55    free(dest); 
    5656} 
    5757 
     
    8787    } 
    8888    if (error) aw_message(error); 
    89     delete source; 
    90     delete dest; 
     89    free(source); 
     90    free(dest); 
    9191} 
    9292 
     
    117117    else        GB_abort_transaction(gb_main); 
    118118    if (error) aw_message(error); 
    119     delete source; 
     119    free(source); 
    120120} 
    121121 
     
    139139    else        GB_abort_transaction(gb_main); 
    140140    if (error) aw_message(error); 
    141     delete dest; 
     141    free(dest); 
    142142} 
    143143 
     
    225225 
    226226    if (error) aw_message(error); 
    227     delete source; 
     227    free(source); 
    228228} 
    229229static AW_CL    ad_global_scannerid      = 0; 
     
    295295} 
    296296 
    297 void ad_list_reorder_cb(AW_window *aws, AW_CL cl_item_selector) { 
     297void ad_list_reorder_cb(AW_window *aws, AW_CL cl_cbs1, AW_CL cl_cbs2) { 
    298298 
    299299    GB_begin_transaction(gb_main); 
     
    302302    GB_ERROR  warning = 0; 
    303303 
    304     const ad_item_selector *selector    = (const ad_item_selector*)cl_item_selector; 
     304    const adawcbstruct     *cbs1        = (const adawcbstruct*)cl_cbs1; 
     305    const adawcbstruct     *cbs2        = (const adawcbstruct*)cl_cbs2; 
     306    const ad_item_selector *selector    = cbs1->selector; 
    305307    GBDATA                 *gb_source   = awt_get_key(gb_main,source, selector->change_key_path); 
    306308    GBDATA                 *gb_dest     = awt_get_key(gb_main,dest, selector->change_key_path); 
    307309    GBDATA                 *gb_key_data = GB_search(gb_main, selector->change_key_path, GB_CREATE_CONTAINER); 
    308310 
     311    int left_index  = aws->get_index_of_current_element(cbs1->id, AWAR_FIELD_REORDER_SOURCE); 
     312    int right_index = aws->get_index_of_current_element(cbs2->id, AWAR_FIELD_REORDER_DEST); 
     313 
    309314    if (!gb_source) { 
    310315        aw_message("Please select an item you want to move (left box)"); 
     
    314319    } 
    315320    if (gb_source && gb_dest && (gb_dest !=gb_source) ) { 
     321        nt_assert(left_index != right_index); 
     322 
    316323        GBDATA **new_order; 
    317324        int nitems = 0; 
     
    335342        } 
    336343        warning = GB_resort_data_base(gb_main,new_order,nitems); 
    337         delete new_order; 
    338     } 
    339  
    340     delete source; 
    341     delete dest; 
     344        delete [] new_order; 
     345 
     346        if (left_index>right_index) { left_index++; right_index++; } // in one case increment indices 
     347    } 
     348 
     349    free(source); 
     350    free(dest); 
     351 
    342352    GB_commit_transaction(gb_main); 
    343     if (warning) aw_message(warning); 
     353 
     354    if (warning) { 
     355        aw_message(warning); 
     356    } 
     357    else { 
     358        aws->select_index(cbs1->id, AWAR_FIELD_REORDER_SOURCE, left_index); 
     359        aws->select_index(cbs2->id, AWAR_FIELD_REORDER_DEST, right_index); 
     360    } 
    344361} 
    345362 
     
    361378    aws->create_button("CLOSE","CLOSE","C"); 
    362379 
     380    AW_CL cbs1 = awt_create_selection_list_on_scandb(gb_main, (AW_window*)aws, AWAR_FIELD_REORDER_SOURCE, AWT_NDS_FILTER, "source", 0, selector, 20, 10); 
     381    AW_CL cbs2 = awt_create_selection_list_on_scandb(gb_main, (AW_window*)aws, AWAR_FIELD_REORDER_DEST,   AWT_NDS_FILTER, "dest",   0, selector, 20, 10); 
     382 
    363383    aws->at("doit"); 
    364384    aws->button_length(0); 
    365     aws->callback(ad_list_reorder_cb, cl_item_selector); 
     385//     aws->callback(ad_list_reorder_cb, cl_item_selector); 
     386    aws->callback(ad_list_reorder_cb, cbs1, cbs2); 
    366387    aws->help_text("spaf_reorder.hlp"); 
    367388    aws->create_button("MOVE_TO_NEW_POSITION", "MOVE  SELECTED LEFT  ITEM\nAFTER SELECTED RIGHT ITEM","P"); 
    368389 
    369     awt_create_selection_list_on_scandb(gb_main, (AW_window*)aws, AWAR_FIELD_REORDER_SOURCE, AWT_NDS_FILTER, "source", 0, selector, 20, 10); 
    370     awt_create_selection_list_on_scandb(gb_main, (AW_window*)aws, AWAR_FIELD_REORDER_DEST,   AWT_NDS_FILTER, "dest",   0, selector, 20, 10); 
    371  
    372390    return (AW_window *)aws; 
    373391} 
    374392 
    375 void ad_hide_field(AW_window *aws, AW_CL cl_item_selector, AW_CL cl_hide) 
     393void ad_hide_field(AW_window *aws, AW_CL cl_cbs, AW_CL cl_hide) 
    376394{ 
    377395    AWUSE(aws); 
     
    380398    char                   *source    = aws->get_root()->awar(AWAR_FIELD_DELETE)->read_string(); 
    381399    GB_ERROR                error     = 0; 
    382     const ad_item_selector *selector  = (const ad_item_selector*)cl_item_selector; 
     400    const adawcbstruct     *cbs       = (const adawcbstruct*)cl_cbs; 
     401    const ad_item_selector *selector  = cbs->selector; 
    383402    GBDATA                 *gb_source = awt_get_key(gb_main,source, selector->change_key_path); 
    384403 
     
    391410    } 
    392411 
    393     delete source; 
     412    free(source); 
    394413 
    395414    if (error) { 
     
    398417    }else{ 
    399418        GB_commit_transaction(gb_main); 
    400     } 
    401 } 
    402  
    403 void ad_field_delete(AW_window *aws, AW_CL cl_item_selector) 
     419        aws->move_selection(cbs->id, AWAR_FIELD_DELETE, 1); 
     420    } 
     421} 
     422 
     423void ad_field_delete(AW_window *aws, AW_CL cl_cbs) 
    404424{ 
    405425    AWUSE(aws); 
     
    409429    char                   *source    = aws->get_root()->awar(AWAR_FIELD_DELETE)->read_string(); 
    410430    GB_ERROR                error     = 0; 
    411     const ad_item_selector *selector  = (const ad_item_selector *)cl_item_selector; 
     431    const adawcbstruct     *cbs       = (const adawcbstruct*)cl_cbs; 
     432    const ad_item_selector *selector  = cbs->selector; 
    412433    GBDATA                 *gb_source = awt_get_key(gb_main,source, selector->change_key_path); 
     434 
     435    int curr_index = aws->get_index_of_current_element(cbs->id, AWAR_FIELD_DELETE); 
    413436 
    414437    if (!gb_source) { 
     
    431454    } 
    432455 
    433  
    434     delete source; 
     456    free(source); 
     457 
    435458    if (error) { 
    436459        GB_abort_transaction(gb_main); 
     
    439462        GB_commit_transaction(gb_main); 
    440463    } 
     464 
     465    aws->select_index(cbs->id, AWAR_FIELD_DELETE, curr_index); // current(deleted) item has disappeared, so this selects the next one 
    441466} 
    442467 
     
    462487    aws->create_button("HELP","HELP","H"); 
    463488 
     489    AW_CL cbs = awt_create_selection_list_on_scandb(gb_main, 
     490                                                    (AW_window*)aws,AWAR_FIELD_DELETE, 
     491                                                    -1, 
     492                                                    "source",0, selector, 20, 10, 
     493                                                    false, false, true); 
     494 
    464495    aws->button_length(13); 
    465496    aws->at("hide"); 
    466     aws->callback(ad_hide_field, (AW_CL)selector, (AW_CL)1); 
     497    aws->callback(ad_hide_field, cbs, (AW_CL)1); 
    467498    aws->help_text("rm_field_only.hlp"); 
    468499    aws->create_button("HIDE_FIELD","Hide field","H"); 
    469500 
    470501    aws->at("unhide"); 
    471     aws->callback(ad_hide_field, (AW_CL)selector, (AW_CL)0); 
     502    aws->callback(ad_hide_field, cbs, (AW_CL)0); 
    472503    aws->help_text("rm_field_only.hlp"); 
    473504    aws->create_button("UNHIDE_FIELD","Unhide field","U"); 
    474505 
    475506    aws->at("delf"); 
    476     aws->callback(ad_field_delete, (AW_CL)selector); 
     507    aws->callback(ad_field_delete, cbs); 
    477508    aws->help_text("rm_field_cmpt.hlp"); 
    478509    aws->create_button("DELETE_FIELD", "DELETE FIELD\n(DATA DELETED)","C"); 
    479  
    480     awt_create_selection_list_on_scandb(gb_main, 
    481                                         (AW_window*)aws,AWAR_FIELD_DELETE, 
    482                                         -1, 
    483                                         "source",0, selector, 20, 10, 
    484                                         false, false, true); 
    485510 
    486511    return (AW_window *)aws; 
     
    508533        aws->hide(); 
    509534    } 
    510     delete name; 
     535    free(name); 
    511536    GB_pop_transaction(gb_main); 
    512537} 
     
    655680            aw_message(GBS_global_string("Species '%s' has no sequence '%s'",sel_species,ali_name)); 
    656681        } 
    657         delete sel_species; 
    658         delete ali_name; 
     682        free(sel_species); 
     683        free(ali_name); 
    659684        if (!gb_data) return; 
    660685        sequence = GB_read_string(gb_data); 
     
    663688    AWTC_FIND_FAMILY ff(gb_main); 
    664689    GB_ERROR error = ff.go(pts,sequence,GB_TRUE,max_hits); 
    665     delete sequence; 
     690    free(sequence); 
    666691    AW_selection_list* sel = (AW_selection_list *)id; 
    667692    aww->clear_selection_list(sel); 
  • trunk/NTREE/ad_transpro.cxx

    r913 r1003  
    7676    gb_dest = GBT_get_alignment(gbmain,ali_dest); 
    7777    if (!gb_dest) { 
    78         char *msg = strdup(GBS_global_string("You have not selected a destination alingment\n" 
    79                                              "May I create one ('%s_pro') for you?",ali_source)); 
     78        char *msg = GBS_global_string_copy("You have not selected a destination alingment\n" 
     79                                             "May I create one ('%s_pro') for you?",ali_source); 
    8080        if (aw_message(msg,"CREATE,CANCEL")){ 
    8181            delete msg; 
     
    8484        long slen = GBT_get_alignment_len(gbmain,ali_source); 
    8585        delete msg; 
    86         ali_dest = strdup(GBS_global_string("%s_pro",ali_source)); 
     86        ali_dest = GBS_global_string_copy("%s_pro",ali_source); 
    8787        gb_dest = GBT_create_alignment(gbmain,ali_dest,slen/3+1,0,1,"ami"); 
    8888        { 
    89             char *fname = strdup(GBS_global_string("%s/data",ali_dest)); 
     89            char *fname = GBS_global_string_copy("%s/data",ali_dest); 
    9090            awt_add_new_changekey(      gbmain,fname,GB_STRING); 
    9191            delete fname; 
  • trunk/NTREE/ad_trees.cxx

    r989 r1003  
    477477    char *t1 = aww->get_root()->awar(AWAR_TREE_NAME)->read_string(); 
    478478    char *t2 = aww->get_root()->awar(AWAR_TREE_DEST)->read_string(); 
    479     char *log_file = strdup(GBS_global_string("/tmp/arb_log_%s_%i",GB_getenvUSER(),GB_getuid())); 
     479    char *log_file = GBS_global_string_copy("/tmp/arb_log_%s_%i",GB_getenvUSER(),GB_getuid()); 
    480480 
    481481    AW_BOOL compare_node_info = mode==1; 
  • trunk/ORS_CGI/ORS_C_html.cxx

    r2 r1003  
    1 /*  
     1/* 
    22################################# 
    33#                               # 
     
    55#    html output functions      # 
    66#                               # 
    7 #################################  
     7################################# 
    88 
    99there are comments in this file, which are used for automatic documentation generating! 
     
    7575***********************************/ 
    7676void print_header(void) { 
    77         if (JAVA)  
     77        if (JAVA) 
    7878                printf("Content-type: text/plain\n\n"); 
    7979        else 
     
    117117                        end=strchr(read,1); 
    118118                        if (!end) end=strchr(read,0); 
    119                         if (!end) break;         
    120                         read=end+1;      
     119                        if (!end) break; 
     120                        read=end+1; 
    121121                } 
    122122 
     
    130130                putchar('"'); 
    131131 
    132                 if (selected &&  
     132                if (selected && 
    133133                    !ORS_strncmp(read,selected) && 
    134134                    strlen(selected) == end-read) printf(" SELECTED"); 
     
    151151 
    152152                printf("\n"); 
    153                 if (!*end) break;        
    154                 read=end+1;      
     153                if (!*end) break; 
     154                read=end+1; 
    155155 
    156156                // jump over "every" fields 
     
    159159                        end=strchr(read,1); 
    160160                        if (!end) end=strchr(read,0); 
    161                         if (!end || !*end) break;        
    162                         read=end+1;      
     161                        if (!end || !*end) break; 
     162                        read=end+1; 
    163163                } 
    164164        } 
     
    235235                                        delete content[column]; 
    236236                                        content[column] = strdup(buffer); 
    237                                 }  
     237                                } 
    238238                                else break;     // EOList 
    239                                  
     239 
    240240                                list_col++; 
    241241                                columns++; 
     
    253253                        if (header) { 
    254254                                char *start, *end; 
    255          
     255 
    256256                                start = header; end = 0; 
    257257                                printf("<TR ALIGN="); 
     
    280280                        else                    printf("<td>"); 
    281281 
    282                         if (f_set[column])  
     282                        if (f_set[column]) 
    283283                                f[column](content[other_col[column]], col_mode[column], col_param[column], row, column);        // start column function 
    284284 
     
    308308        //                2: <a href=www_home>full name</a> 
    309309        //                3: <a href=www_home>param</a> 
    310         // param        =  
     310        // param        = 
    311311void OC_html_www_home(char *content, int mode, char *param, int row, int col) { 
    312          
     312 
    313313                if (!content || !*content) { 
    314314                        printf("(empty)"); 
     
    316316                } 
    317317                printf("<A HREF=\"http://%s\">",OC_read_user_field_if_userpath_set(content, "www_home")); 
    318          
     318 
    319319                if (mode == 1) { 
    320320                        printf("%s",content); 
     
    326326                else printf("unknown mode %i for www_home",mode); 
    327327                printf("</A>"); 
    328          
     328 
    329329                row = row;      col = col;      // not needed 
    330330        }; 
    331          
     331 
    332332        /***************************************************************************** 
    333333          HTML: PROBE_ID LINK 
     
    336336        // param        = e.g. "EDIT", "CLONE" 
    337337void OC_html_probe_id_link(char *content, int mode, char *param, int row, int col) { 
    338          
     338 
    339339                if (!param) param = "(no param)"; 
    340340                if (!ORS_strcmp(param, "CLONE")) { 
     
    357357        void OC_html_userpath_link(char *content, int mode, char *param, int row, int col) { 
    358358                char *new_html; 
    359          
     359 
    360360                if (!content || !*content) { 
    361361                        printf("(empty)"); 
     
    398398 
    399399 
    400                 if (!*end1) break;       
    401                 if (!*end2) break;       
    402                 read1=end1+1;    
    403                 read2=end2+1;    
     400                if (!*end1) break; 
     401                if (!*end2) break; 
     402                read1=end1+1; 
     403                read2=end2+1; 
    404404        } 
    405405} 
     
    411411********************************************************************************/ 
    412412void output_list_as_2_col_table(char *list1, int width1, char *between, char *eol) { 
    413          
     413 
    414414        char *read=list1,  *end; 
    415415        if (!list1) return; 
     
    425425                printf("%s",between); 
    426426 
    427                 if (!*end) break;        
    428                 read=end+1;      
     427                if (!*end) break; 
     428                read=end+1; 
    429429 
    430430                end=strchr(read,1); 
     
    435435                printf("%s",eol); 
    436436 
    437                 if (!*end) break;        
    438                 read=end+1;      
     437                if (!*end) break; 
     438                read=end+1; 
    439439        } 
    440440} 
     
    462462 
    463463        owner_elem = OS_find_pdb_list_elem_by_name(ors_gl.pdb_list, "", "p_owner"); 
    464         if (owner_elem && owner_elem->content && *(owner_elem->content)) main_owner = owner_elem->content;  
     464        if (owner_elem && owner_elem->content && *(owner_elem->content)) main_owner = owner_elem->content; 
    465465        else { 
    466466                owner_elem = OS_find_pdb_list_elem_by_name(ors_gl.pdb_list, "", "p_author"); 
    467                 if (owner_elem && owner_elem->content && *(owner_elem->content)) main_owner = owner_elem->content;  
     467                if (owner_elem && owner_elem->content && *(owner_elem->content)) main_owner = owner_elem->content; 
    468468                else { 
    469469                        if (!strcmp(select,"create"))   main_owner = ors_gl.userpath; 
     
    530530                        // get owner of this section (or use owner of main section) 
    531531                        owner_elem = OS_find_pdb_list_elem_by_name(ors_gl.pdb_list, pointer->section, "p_owner"); 
    532                         if (owner_elem && owner_elem->content && *(owner_elem->content)) owner = owner_elem->content;  
     532                        if (owner_elem && owner_elem->content && *(owner_elem->content)) owner = owner_elem->content; 
    533533                                                                                    else owner = main_owner; 
    534534                        if (table) printf("</table>"); 
     
    541541                                for (temp = pointer; temp; temp=OC_next_pdb_list_elem(list, temp)) { 
    542542                                        if (ORS_strcmp(temp->section, section_memo)) break;   // end of section 
    543                                         if (temp->content && *temp->content  
     543                                        if (temp->content && *temp->content 
    544544                                                          && ORS_strcmp(temp->name,"p_owner") 
    545545                                                          && ORS_strcmp(temp->name,"p_last_mod") ) {found=1; break; } // content found 
    546546                                } 
    547                                 if (!found) {  
     547                                if (!found) { 
    548548                                        if (temp) { 
    549549                                                pointer = temp->prev;   // jump over this section 
    550550                                                continue; 
    551                                         }  
     551                                        } 
    552552                                        else break; 
    553553                                } 
    554554                        } 
    555                          
     555 
    556556                        // not empty -> output next section 
    557557                        printf("<A NAME=\"%s\"></A>",pointer->section); // href on same page 
     
    605605 
    606606                else if (strchr(elem->rights,'V'))              content=elem->content; 
    607         }        
     607        } 
    608608        else if (!strcmp(select,"show")) { 
    609609                content=elem->content; 
     
    616616        else {  // use existing values from environment 
    617617                delete content; 
    618                 if (elem->content && !select_owner)      
     618                if (elem->content && !select_owner) 
    619619                        content = strdup(elem->content); 
    620                 else  
    621                         content = strdup("");    
    622         } 
    623  
    624         if (update && !search && !create && !(ORS_is_parent_or_equal(ors_gl.userpath, owner) ||  
     620                else 
     621                        content = strdup(""); 
     622        } 
     623 
     624        if (update && !search && !create && !(ORS_is_parent_or_equal(ors_gl.userpath, owner) || 
    625625                !strcmp(owner,"")) ) update = 0;        // special case: old data may have "" as owner 
    626626 
     
    658658                        if (update) { 
    659659                                printf("\">"); 
    660                                 if (www_home)  
     660                                if (www_home) 
    661661                                        printf(" <A HREF=\"http://%s\">homepage</A>",OC_read_user_field_if_userpath_set(content,"www_home")); 
    662                                 if (info_link && content)  
     662                                if (info_link && content) 
    663663                                        printf(" <A HREF=\"http:sel_user_info?sel_userpath=%s\">infopage</A>",content); 
    664664                        } else if (strcmp(select,"show")) { 
     
    687687 
    688688                        if (!strcmp(elem->init,"pub_exist_def")) { 
    689                                 if (create)     output_list_as_html_options(list_of_pub_parents(ors_gl.pub_exist_max, ors_gl.userpath),  
     689                                if (create)     output_list_as_html_options(list_of_pub_parents(ors_gl.pub_exist_max, ors_gl.userpath), 
    690690                                                                                                ors_gl.pub_exist_def, 1); 
    691                                 else            output_list_as_html_options(list_of_pub_parents(ors_gl.pub_exist_max, ors_gl.userpath),  
     691                                else            output_list_as_html_options(list_of_pub_parents(ors_gl.pub_exist_max, ors_gl.userpath), 
    692692                                                                                                elem->content, 1); 
    693693                        } 
    694694                        else if (!strcmp(elem->init,"pub_content_def")) { 
    695                                 if (create)     output_list_as_html_options(list_of_pub_parents(ors_gl.pub_content_max, ors_gl.userpath),  
     695                                if (create)     output_list_as_html_options(list_of_pub_parents(ors_gl.pub_content_max, ors_gl.userpath), 
    696696                                                                                                ors_gl.pub_content_def, 1); 
    697                                 else            output_list_as_html_options(list_of_pub_parents(ors_gl.pub_content_max, ors_gl.userpath),  
     697                                else            output_list_as_html_options(list_of_pub_parents(ors_gl.pub_content_max, ors_gl.userpath), 
    698698                                                                                                elem->content, 1); 
    699699                        } 
     
    709709                                else    output_list_as_html_options(OC_read_file_into_list( 
    710710                                                                ORS_LIB_PATH "target_genes"), //! possible target gene names for main section 
    711                                                                 elem->content, 0);  
     711                                                                elem->content, 0); 
    712712                        } 
    713713                        printf("</SELECT>"); 
     
    787787        if (strlen(highest) < strlen(lowest)) { 
    788788                if (!strncmp(highest, lowest, strlen(highest))) { 
    789                         hi=highest;  
     789                        hi=highest; 
    790790                        lo=lowest; 
    791791                } 
     
    811811        char *pos1=lo+strlen(hi); 
    812812        char *pos2=lo+strlen(lo); 
    813          
     813 
    814814        while(1) { 
    815815                pos2=strchr(pos1,'/'); 
     
    836836                return strdup(me); 
    837837        } 
    838         if (!strcmp(dad,"/"))  
    839                 return strdup(GBS_global_string("/%s", me)); 
    840         return strdup(GBS_global_string("%s/%s", dad, me)); 
     838        if (!strcmp(dad,"/")) return GBS_global_string_copy("/%s", me); 
     839        return GBS_global_string_copy("%s/%s", dad, me); 
    841840} 
    842841 
  • trunk/ORS_CGI/ORS_C_java_main.cxx

    r2 r1003  
    3232        //////// BIN_TREE (JAVA) ///////// 
    3333        char *bin_tree_file = OC_cgi_var_2_filename("bt","tree_names","BIN_TREE"); 
    34         char *bin_tree_path = strdup(GBS_global_string(ORS_LIB_PATH "%s",bin_tree_file)); 
     34        char *bin_tree_path = GBS_global_string_copy(ORS_LIB_PATH "%s",bin_tree_file); 
    3535        GB_ERROR error = 0; 
    3636                        // look for predefined datas 
  • trunk/ORS_CGI/ORS_C_main.cxx

    r655 r1003  
    211211        char *seek_name = cgi_var(cv); 
    212212        if (!*seek_name) quit_with_error(ORS_export_error("cgi_var '%s' missing at %s",cv,kontext)); 
    213         char *result=ORS_read_a_line_in_a_file(strdup(GBS_global_string(ORS_LIB_PATH "%s",lib_file)) ,seek_name); 
     213        char *result=ORS_read_a_line_in_a_file(GBS_global_string_copy(ORS_LIB_PATH "%s",lib_file) ,seek_name); 
    214214        if (!*result) quit_with_error(ORS_export_error("'%s' not found in " ORS_LIB_PATH "%s at %s",seek_name,lib_file,kontext)); 
    215215        return result; 
     
    586586                        delete ffile; 
    587587                        char *bin_tree_file = OC_cgi_var_2_filename("bt","tree_names","BIN_TREE"); 
    588                         char *bin_tree_path = strdup(GBS_global_string(ORS_LIB_PATH "%s",bin_tree_file)); 
     588                        char *bin_tree_path = GBS_global_string_copy(ORS_LIB_PATH "%s",bin_tree_file); 
    589589 
    590590                        output_java_match_result(tmpfile,bin_tree_path); 
  • trunk/ORS_SERVER/ORS_S_userdb.cxx

    r2 r1003  
    1 /*  
     1/* 
    22################################# 
    33#                               # 
     
    2323GBDATA *gb_userdb; 
    2424 
    25 // class functions  
     25// class functions 
    2626//void ugl_struct::clear(void){ 
    2727//      memset((char *)this,0,sizeof(ugl_struct)); 
    2828//} 
    29 // contructor  
     29// contructor 
    3030//ugl_struct::ugl_struct(void){ 
    3131//      clear(); 
     
    3939  open the user database 
    4040*************************************************************************************/ 
    41 GB_ERROR OS_open_userdb(void){   
     41GB_ERROR OS_open_userdb(void){ 
    4242 
    4343        char *name = ORS_read_a_line_in_a_file(ORS_LIB_PATH "CONFIG","USER_DB"); //arb.user.db 
     
    209209        empty_pw = ORS_crypt(""); 
    210210 
    211         if (locs->password        && *locs->password && ORS_strcmp(locs->password, empty_pw))            
     211        if (locs->password        && *locs->password && ORS_strcmp(locs->password, empty_pw)) 
    212212                                                                OS_write_gb_user_info_string(gb_user,"password",        locs->password); 
    213213        if (locs->username        && *locs->username)           OS_write_gb_user_info_string(gb_user,"username",        locs->username); 
     
    242242        gb_field = GB_find(gb_user,"ta_id",0,down_level); 
    243243        int read_ta_id = GB_read_int(gb_field); 
    244         if (read_ta_id != locs->sel_user_ta_id)  
     244        if (read_ta_id != locs->sel_user_ta_id) 
    245245                return strdup("User data has been changed in the meantime. Please reload your update page."); 
    246246 
     
    269269        delete read_data; 
    270270 
    271         if (locs->sel_password    && *locs->sel_password && ORS_strcmp(locs->sel_password, empty_pw))            
     271        if (locs->sel_password    && *locs->sel_password && ORS_strcmp(locs->sel_password, empty_pw)) 
    272272                                                                        OS_write_gb_user_info_string(gb_user,"password",        locs->sel_password); 
    273273        if (locs->sel_username          && *locs->sel_username)         OS_write_gb_user_info_string(gb_user,"username",        locs->sel_username); 
     
    370370char * OS_find_user_and_password(char *user, char *password){ 
    371371        GB_transaction dummy(gb_userdb);  // keep transaction open until var scope ends 
    372          
     372 
    373373        //char *userpath=0; 
    374374        GBDATA *gb_userpath; 
     
    406406  WRITE USER FIELD INFORMATION into user database 
    407407        a non existing field is being created 
    408                                                         return error message or NULL  
     408                                                        return error message or NULL 
    409409                                                        no authorisation here! 
    410410*************************************************************************************/ 
     
    423423  WRITE USER FIELD INFORMATION (INTEGER) into user database 
    424424        a non existing field is being created 
    425                                                         return error message or NULL  
     425                                                        return error message or NULL 
    426426                                                        no authorisation here! 
    427427*************************************************************************************/ 
     
    440440  WRITE USER FIELD INFORMATION into user database WITH EXISTING GB_USER 
    441441        a non existing field is being created 
    442                                                         return error message or NULL  
     442                                                        return error message or NULL 
    443443                                                        no authorisation here! 
    444444*************************************************************************************/ 
     
    454454  WRITE USER FIELD INFORMATION INT into user database WITH EXISTING GB_USER 
    455455        a non existing field is being created 
    456                                                         return error message or NULL  
     456                                                        return error message or NULL 
    457457                                                        no authorisation here! 
    458458*************************************************************************************/ 
     
    478478        if (!gb_date) return ORS_export_error("Dailypw_date does not exist"); 
    479479        GB_read_string(gb_date); 
    480         // TODO: if (gb_date < today)  
     480        // TODO: if (gb_date < today) 
    481481 
    482482        GBDATA *gb_field = GB_find(gb_user,fieldname,0,down_level); 
     
    487487/***************************************************************************** 
    488488  RETURN LIST OF SUBUSERS of a userpath 
    489                 "levels" levels down, excluding "exclude",  
     489                "levels" levels down, excluding "exclude", 
    490490                                      excluding all down from "exclude_from" 
    491491                        list has format as follows:     name 1 name 1 ... 0 
     
    499499        char *users[500]; 
    500500        int num_users=0; 
    501         GBDATA *subuser;  
     501        GBDATA *subuser; 
    502502        GBDATA *subuser_name; 
    503503        char *newpath, *read_data; 
    504         int my_level_count = ORS_str_char_count(userpath,'/'),  
     504        int my_level_count = ORS_str_char_count(userpath,'/'), 
    505505            level_count, 
    506506            exclude_from_len; 
     
    510510                newpath = GBS_string_eval(userpath,"*=*1/\\*",0); 
    511511                if (!exclude || strcmp(userpath,exclude)) 
    512                         users[num_users++]=strdup(userpath);  // can't GB_find userpath  
     512                        users[num_users++]=strdup(userpath);  // can't GB_find userpath 
    513513        } 
    514514 
     
    523523                read_data=GB_read_string(subuser_name); 
    524524                level_count=ORS_str_char_count(read_data,'/'); 
    525                 // exclude  
    526                 if (level_count <= my_level_count + levels  
    527                         && (!exclude || strcmp(read_data,exclude))  
    528                         && (!exclude_from || strncmp(read_data,exclude_from,exclude_from_len))  
     525                // exclude 
     526                if (level_count <= my_level_count + levels 
     527                        && (!exclude || strcmp(read_data,exclude)) 
     528                        && (!exclude_from || strncmp(read_data,exclude_from,exclude_from_len)) 
    529529                        ) { 
    530530                        users[num_users++]=read_data; 
     
    551551                if (i<num_users-1) *(write-1)=1; 
    552552        } 
    553          
     553 
    554554        return result; 
    555555} 
     
    560560***********************/ 
    561561char *OS_set_dailypw(char */*userpath*/, char */*dailypw*/) { 
    562          
     562 
    563563        return "not implemented: set dailypw for user"; 
    564564} 
     
    600600                max_user_depth = OS_read_user_info_int(userpath,"max_user_depth"); 
    601601                if (max_users <= curr_users) return ORS_export_error("Your parent user %s is not allowed to create more users.", userpath); 
    602                 if (new_depth > max_user_depth)  
     602                if (new_depth > max_user_depth) 
    603603                        return ORS_export_error("Your parent user %s is not allowed to have users down to that hierarchie depth.", userpath); 
    604604        } 
     
    609609  CONSTRUCT SEL_USERPATH 
    610610        add a parent path and a name 
    611                                                         return strdup  
     611                                                        return strdup 
    612612*****************************************************************************/ 
    613613char *OS_construct_sel_userpath(char *sel_par_userpath, char *sel_user) { 
    614         if (!strcmp(sel_par_userpath,"/"))  
    615                 return strdup(GBS_global_string("/%s",sel_user)); 
    616         return strdup(GBS_global_string("%s/%s", sel_par_userpath, sel_user)); 
     614        if (!strcmp(sel_par_userpath,"/")) 
     615                return GBS_global_string_copy("/%s",sel_user); 
     616        return GBS_global_string_copy("%s/%s", sel_par_userpath, sel_user); 
    617617} 
    618618 
     
    658658                } 
    659659        } 
    660          
     660 
    661661        return val; // do NOT remove item from list! 
    662662} 
     
    668668        who_file=GBS_stropen(10000);  // open memory file 
    669669        if (userpath) { 
    670                 if (ORS_str_char_count(userpath, '/') >= 2)  
     670                if (ORS_str_char_count(userpath, '/') >= 2) 
    671671                        who_userpath = ORS_get_parent_of(userpath); 
    672672                else    who_userpath = strdup(userpath); 
     
    687687int OS_user_has_sub_users(char *userpath) { 
    688688        GB_transaction dummy(gb_userdb);  // keep transaction open until var scope ends 
    689          
     689 
    690690        char *user_pattern = ORS_sprintf("%s/*",userpath); 
    691691        GBDATA *sub_userpath = GB_find(gb_userdb,"userpath",user_pattern,down_2_level); 
  • trunk/PARSIMONY/PARS_main.cxx

    r922 r1003  
    428428        leaf->remove(); 
    429429        isits.currentspecies--; 
    430         char *label = strdup(GBS_global_string("2:%s",leaf->name)); 
     430        char *label = GBS_global_string_copy("2:%s",leaf->name); 
    431431        insert_species_in_tree(label,leaf);     // reinsert species 
    432432        delete label; 
    433433        isits.currentspecies--; 
    434         label = strdup(GBS_global_string("shortseq:%s",brother->name)); 
     434        label = GBS_global_string_copy("shortseq:%s",brother->name); 
    435435        insert_species_in_tree(label,brother);  // reinsert short sequence 
    436436        delete label; 
  • trunk/PROBE_DESIGN/probe_design.cxx

    r655 r1003  
    860860    if (!(server = strtok(server,":"))) server = empty; 
    861861    sprintf(choice,"%-8s: %s",server,file+2); 
    862     delete fr; 
     862    free(fr); 
    863863 
    864864    return strdup(choice); 
     
    886886                aws->insert_option( choice, "", i ); 
    887887            } 
    888             delete choice; 
     888            free(choice); 
    889889        } 
    890890    } 
  • trunk/SECEDIT/SEC_graphic.cxx

    r996 r1003  
    8383                     (AW_CL)ntw, 
    8484                     cd2, 
    85                      false, 
     85                     false, 
    8686                     "#777777", 
    8787                     "Loop$#ffffaa", 
     
    9393                     "-Cursor$#ff0000", 
    9494 
    95                      "+-User1$#B8E2F8",  //used in secondary editor to change search pattern COLORS 
    96                      "+-User2$#B8E2F8", 
    97                      "-Probe$#B8E2F8", 
    98                      "+-Primer(l)$#A9FE54", 
    99                      "+-Primer(r)$#A9FE54", 
    100                      "-Primer(g)$#A9FE54", 
    101                      "+-Sig(l)$#DBB0FF", 
    102                      "+-Sig(r)$#DBB0FF", 
    103                      "-Sig(g)$#DBB0FF", 
    104                      "+-Skeleton Helix$#B8E2F8", 
    105                      "+-Skeleton Loop$#DBB0FF", 
    106                      "-Skeleton NonHelix$#A9FE54", 
    107                      "+-MISMATCHES$#FF9AFF", 
     95                     "+-User1$#B8E2F8",  //used in secondary editor to change search pattern COLORS 
     96                     "+-User2$#B8E2F8", 
     97                     "-Probe$#B8E2F8", 
     98                     "+-Primer(l)$#A9FE54", 
     99                     "+-Primer(r)$#A9FE54", 
     100                     "-Primer(g)$#A9FE54", 
     101                     "+-Sig(l)$#DBB0FF", 
     102                     "+-Sig(r)$#DBB0FF", 
     103                     "-Sig(g)$#DBB0FF", 
     104                     "+-Skeleton Helix$#B8E2F8", 
     105                     "+-Skeleton Loop$#DBB0FF", 
     106                     "-Skeleton NonHelix$#A9FE54", 
     107                     "+-MISMATCHES$#FF9AFF", 
    108108                     0 ); 
    109109 
     
    138138 
    139139static GB_ERROR change_constraints(GB_CSTR constraint_type, GB_CSTR element_type, double& lower_constraint, double& upper_constraint) { 
    140     char *question = strdup(GBS_global_string("%s-constraints for %s", constraint_type, element_type)); 
     140    char *question = GBS_global_string_copy("%s-constraints for %s", constraint_type, element_type); 
    141141    char *default_input; 
    142142    { 
     
    144144        GB_CSTR f2 = double2string(upper_constraint); 
    145145 
    146         default_input = strdup(GBS_global_string("%s-%s", f1, f2)); 
     146        default_input = GBS_global_string_copy("%s-%s", f1, f2); 
    147147        free(f1); 
    148148    } 
     
    198198 
    199199    switch (cmd) { 
    200         /* ******************************************************** */ 
    201     case AWT_MODE_ZOOM: { 
    202         break; 
    203     } 
    204         /* ******************************************************** */ 
    205     case AWT_MODE_STRETCH: { 
    206         if(button==AWT_M_MIDDLE) { 
    207             break; 
    208         } 
    209  
    210         SEC_Base *base; 
    211         SEC_helix_strand *strand; 
    212         SEC_helix *helix_info; 
    213         SEC_segment *segment; 
    214         SEC_loop *loop; 
    215  
    216         double fixpoint_x, fixpoint_y; 
    217         double loopCentre_x, loopCentre_y; 
    218         double initialLengthConstraint, finalLengthConstraint; 
    219         double initialRadiusConstraint, finalRadiusConstraint; 
    220         double startDist, endDist; 
    221  
    222         if(button==AWT_M_LEFT) { 
    223             switch(type){ 
    224             case AW_Mouse_Press: { 
    225                 base = (SEC_Base*)ct->client_data1; 
    226                 if (base) { 
    227                     if(base->getType()==SEC_HELIX_STRAND) { 
    228                         strand     = (SEC_helix_strand*)base; 
    229                         helix_info = strand->get_helix_info(); 
    230                         fixpoint_x = strand->get_fixpoint_x(); 
    231                         fixpoint_y = strand->get_fixpoint_y(); 
    232                         startDist  = sqrt(((fixpoint_x-world_x)*(fixpoint_x-world_x))+((fixpoint_y- world_y)*(fixpoint_y- world_y))); 
    233                         //      initialLengthConstraint = helix_info->get_length(); 
    234                     } 
    235                     if(base->getType()==SEC_SEGMENT) { 
    236                         segment      = (SEC_segment*)base; 
    237                         loop         = segment->get_loop(); 
    238                         loopCentre_x = loop->get_x_loop(); 
    239                         loopCentre_y = loop->get_y_loop(); 
    240                         startDist    = sqrt(((loopCentre_x-world_x)*(loopCentre_x-world_x))+((loopCentre_y- world_y)*(loopCentre_y- world_y))); 
    241                         //initialRadiusConstraint = loop->get_min_radius(); 
    242                     } 
    243                 } 
    244                 break; 
    245             } 
    246             case AW_Mouse_Drag:{ 
    247                 base = (SEC_Base*)ct->client_data1; 
    248                 if (base) { 
    249                     if(base->getType()==SEC_HELIX_STRAND) { 
    250                         strand     = (SEC_helix_strand*)base; 
    251                         helix_info = strand->get_helix_info(); 
    252                         fixpoint_x = strand->get_fixpoint_x(); 
    253                         fixpoint_y = strand->get_fixpoint_y(); 
    254                         endDist    = sqrt(((fixpoint_x-world_x)*(fixpoint_x-world_x))+((fixpoint_y- world_y)*(fixpoint_y- world_y))); 
    255                         finalLengthConstraint            = ((endDist/startDist) + endDist); 
    256                         helix_info->get_min_length_ref() = finalLengthConstraint; 
    257                     } 
    258                     if(base->getType()==SEC_SEGMENT) { 
    259                         segment      = (SEC_segment*)base; 
    260                         loop         = segment->get_loop(); 
    261                         loopCentre_x = loop->get_x_loop(); 
    262                         loopCentre_y = loop->get_y_loop(); 
    263                         endDist      = sqrt(((loopCentre_x-world_x)*(loopCentre_x-world_x))+((loopCentre_y- world_y)*(loopCentre_y- world_y))); 
    264                         //      finalRadiusConstraint      = ((endDist/startDist) * initialRadiusConstraint); 
    265                         loop->get_min_radius_ref() = endDist;//finalRadiusConstraint; 
    266                     } 
    267                 } 
    268                 sec_root->update(); 
    269                 exports.refresh = 1; 
    270                 exports.save    = 1; 
    271                 break; 
    272             } 
    273             default: 
    274                 break; 
    275             } 
    276         } 
    277         break; 
    278     } 
    279  
    280         // -------------------------------------------------------------------------------- 
    281  
    282     case AWT_MODE_PROINFO: { 
    283         if(button==AWT_M_MIDDLE) { 
    284             break; 
    285         } 
    286         if (button==AWT_M_LEFT) { // should paint the pattern which user selects 
    287             if (type==AW_Mouse_Press) { 
    288                 SEC_Base *base  = (SEC_Base*)ct->client_data1; 
    289                 int clicked_pos = ct->client_data2; 
    290                 if (base) 
    291                     sec_root->paintSearchPatternStrings(device, clicked_pos, world_x+1, world_y); 
    292             } 
    293         } 
    294         if(button==AWT_M_RIGHT) { 
    295             exports.refresh = 1; 
    296             sec_root->update(0); 
    297             //awmm->callback(AW_POPUP, (AW_CL)ED4_create_search_window, (AW_CL)probe); 
    298             break; // should popup probe search pattern window 
    299         } 
    300         break; 
    301     } 
    302  
    303         // -------------------------------------------------------------------------------- 
    304  
    305     case AWT_MODE_MOVE: { // helix<->loop-exchange-modus 
    306         if(button==AWT_M_MIDDLE) { 
    307             break; 
    308         } 
    309         if (button==AWT_M_LEFT) { 
    310             switch(type) { 
    311             case AW_Mouse_Press: { 
    312                 if (!(ct && ct->exists)) { 
    313                     break; 
    314                 } 
    315  
    316                 { 
    317                     //check security level @@@ 
    318                     SEC_Base *base = (SEC_Base *)ct->client_data1; 
    319                     if (base) { 
     200        /* ******************************************************** */ 
     201        case AWT_MODE_ZOOM: { 
     202            break; 
     203        } 
     204            /* ******************************************************** */ 
     205        case AWT_MODE_STRETCH: { 
     206            if(button==AWT_M_MIDDLE) { 
     207                break; 
     208            } 
     209 
     210            SEC_Base *base; 
     211            SEC_helix_strand *strand; 
     212            SEC_helix *helix_info; 
     213            SEC_segment *segment; 
     214            SEC_loop *loop; 
     215 
     216            double fixpoint_x, fixpoint_y; 
     217            double loopCentre_x, loopCentre_y; 
     218            double finalLengthConstraint; 
     219            //  double initialLengthConstraint; 
     220            //  double initialRadiusConstraint, finalRadiusConstraint; 
     221            double startDist, endDist; 
     222 
     223            if(button==AWT_M_LEFT) { 
     224                switch(type){ 
     225                    case AW_Mouse_Press: { 
     226                        base = (SEC_Base*)ct->client_data1; 
     227                        if (base) { 
     228                            if(base->getType()==SEC_HELIX_STRAND) { 
     229                                strand     = (SEC_helix_strand*)base; 
     230                                helix_info = strand->get_helix_info(); 
     231                                fixpoint_x = strand->get_fixpoint_x(); 
     232                                fixpoint_y = strand->get_fixpoint_y(); 
     233                                startDist  = sqrt(((fixpoint_x-world_x)*(fixpoint_x-world_x))+((fixpoint_y- world_y)*(fixpoint_y- world_y))); 
     234                                //      initialLengthConstraint = helix_info->get_length(); 
     235                            } 
     236                            if(base->getType()==SEC_SEGMENT) { 
     237                                segment      = (SEC_segment*)base; 
     238                                loop         = segment->get_loop(); 
     239                                loopCentre_x = loop->get_x_loop(); 
     240                                loopCentre_y = loop->get_y_loop(); 
     241                                startDist    = sqrt(((loopCentre_x-world_x)*(loopCentre_x-world_x))+((loopCentre_y- world_y)*(loopCentre_y- world_y))); 
     242                                //initialRadiusConstraint = loop->get_min_radius(); 
     243                            } 
     244                        } 
     245                        break; 
     246                    } 
     247                    case AW_Mouse_Drag:{ 
     248                        base = (SEC_Base*)ct->client_data1; 
     249                        if (base) { 
     250                            if(base->getType()==SEC_HELIX_STRAND) { 
     251                                strand     = (SEC_helix_strand*)base; 
     252                                helix_info = strand->get_helix_info(); 
     253                                fixpoint_x = strand->get_fixpoint_x(); 
     254                                fixpoint_y = strand->get_fixpoint_y(); 
     255                                endDist    = sqrt(((fixpoint_x-world_x)*(fixpoint_x-world_x))+((fixpoint_y- world_y)*(fixpoint_y- world_y))); 
     256                                finalLengthConstraint            = ((endDist/startDist) + endDist); 
     257                                helix_info->get_min_length_ref() = finalLengthConstraint; 
     258                            } 
     259                            if(base->getType()==SEC_SEGMENT) { 
     260                                segment      = (SEC_segment*)base; 
     261                                loop         = segment->get_loop(); 
     262                                loopCentre_x = loop->get_x_loop(); 
     263                                loopCentre_y = loop->get_y_loop(); 
     264                                endDist      = sqrt(((loopCentre_x-world_x)*(loopCentre_x-world_x))+((loopCentre_y- world_y)*(loopCentre_y- world_y))); 
     265                                //      finalRadiusConstraint      = ((endDist/startDist) * initialRadiusConstraint); 
     266                                loop->get_min_radius_ref() = endDist;//finalRadiusConstraint; 
     267                            } 
     268                        } 
     269                        sec_root->update(); 
     270                        exports.refresh = 1; 
     271                        exports.save    = 1; 
     272                        break; 
     273                    } 
     274                    default: 
     275                        break; 
     276                } 
     277            } 
     278            break; 
     279        } 
     280 
     281            // -------------------------------------------------------------------------------- 
     282 
     283        case AWT_MODE_PROINFO: { 
     284            if(button==AWT_M_MIDDLE) { 
     285                break; 
     286            } 
     287            if (button==AWT_M_LEFT) { // should paint the pattern which user selects 
     288                if (type==AW_Mouse_Press) { 
     289                    SEC_Base *base  = (SEC_Base*)ct->client_data1; 
     290                    int clicked_pos = ct->client_data2; 
     291                    if (base) 
     292                        sec_root->paintSearchPatternStrings(device, clicked_pos, world_x+1, world_y); 
     293                } 
     294            } 
     295            if(button==AWT_M_RIGHT) { 
     296                exports.refresh = 1; 
     297                sec_root->update(0); 
     298                //awmm->callback(AW_POPUP, (AW_CL)ED4_create_search_window, (AW_CL)probe); 
     299                break; // should popup probe search pattern window 
     300            } 
     301            break; 
     302        } 
     303 
     304            // -------------------------------------------------------------------------------- 
     305 
     306        case AWT_MODE_MOVE: { // helix<->loop-exchange-modus 
     307            if(button==AWT_M_MIDDLE) { 
     308                break; 
     309            } 
     310            if (button==AWT_M_LEFT) { 
     311                switch(type) { 
     312                    case AW_Mouse_Press: { 
     313                        if (!(ct && ct->exists)) { 
     314                            break; 
     315                        } 
     316 
     317                        { 
     318                            //check security level @@@ 
     319                            SEC_Base *base = (SEC_Base *)ct->client_data1; 
     320                            if (base) { 
    320321#if defined(DEBUG) && 1 
    321                         const char *whatAmI; 
    322                         SEC_region *reg = 0; 
    323  
    324                         switch (base->getType()) { 
    325                         case SEC_SEGMENT: { 
    326                             whatAmI = "Segment"; 
    327                             SEC_segment *segment = (SEC_segment*)base; 
    328                             reg = segment->get_region(); 
    329                             break; 
    330                         } 
    331                         case SEC_HELIX_STRAND: { 
    332                             whatAmI = "Strand"; 
    333                             SEC_helix_strand *strand = (SEC_helix_strand*)base; 
    334                             reg = strand->get_region(); 
    335                             break; 
    336                         } 
    337                         case SEC_LOOP: { 
    338                             whatAmI = "Loop"; 
    339                             break; 
    340                         } 
    341                         default: { 
    342                             whatAmI = "unknown"; 
    343                             break; 
    344                         } 
    345                         } 
    346  
    347                         GB_CSTR msg; 
    348                         if (reg) { 
    349                             msg = GBS_global_string("Clicked on %s : positions[%i, %i]", (char*)whatAmI, reg->get_sequence_start(), reg->get_sequence_end()); 
    350                         } 
    351                         else { 
    352                             msg = GBS_global_string("Clicked on %s - should not happen!?!", (char*)whatAmI); 
    353                         } 
    354                         aw_message(msg); 
     322                                const char *whatAmI; 
     323                                SEC_region *reg = 0; 
     324 
     325                                switch (base->getType()) { 
     326                                    case SEC_SEGMENT: { 
     327                                        whatAmI = "Segment"; 
     328                                        SEC_segment *segment = (SEC_segment*)base; 
     329                                        reg = segment->get_region(); 
     330                                        break; 
     331                                    } 
     332                                    case SEC_HELIX_STRAND: { 
     333                                        whatAmI = "Strand"; 
     334                                        SEC_helix_strand *strand = (SEC_helix_strand*)base; 
     335                                        reg = strand->get_region(); 
     336                                        break; 
     337                                    } 
     338                                    case SEC_LOOP: { 
     339                                        whatAmI = "Loop"; 
     340                                        break; 
     341                                    } 
     342                                    default: { 
     343                                        whatAmI = "unknown"; 
     344                                        break; 
     345                                    } 
     346                                } 
     347 
     348                                GB_CSTR msg; 
     349                                if (reg) { 
     350                                    msg = GBS_global_string("Clicked on %s : positions[%i, %i]", (char*)whatAmI, reg->get_sequence_start(), reg->get_sequence_end()); 
     351                                } 
     352                                else { 
     353                                    msg = GBS_global_string("Clicked on %s - should not happen!?!", (char*)whatAmI); 
     354                                } 
     355                                aw_message(msg); 
    355356#endif 
    356                         if (base->getType() == SEC_SEGMENT) { 
    357                             int clicked_pos = ct->client_data2; 
    358                             if (clicked_pos > int(sec_root->helix->size)) { 
    359                                 aw_message("Index of clicked Base is out of range"); 
    360                                 break; 
    361                             } 
    362                             if (sec_root->helix->entries[clicked_pos].pair_type == HELIX_NONE) { 
    363                                 aw_message("Selected Base is not suitable to split"); 
    364                                 break; 
    365                             } 
    366  
    367                             char *clicked_helix_nr = sec_root->helix->entries[clicked_pos].helix_nr; 
    368                             char *helix_nr; 
    369                             int i, min_index=(-1), max_index=(-1); 
    370                             for (i=0; i<int(sec_root->helix->size); i++) { 
    371                                 helix_nr = sec_root->helix->entries[i].helix_nr; 
    372                                 if ( (helix_nr != NULL) && (clicked_helix_nr != NULL) ) { 
    373                                     if(!strcmp(helix_nr, clicked_helix_nr)) { 
    374                                         if (min_index<0) { 
    375                                             min_index = i; 
    376                                         } 
    377                                         max_index = i; 
    378                                     } 
    379                                 } 
    380                             } 
    381                             int min_index_partner = sec_root->helix->entries[min_index].pair_pos; 
    382                             int max_index_partner = sec_root->helix->entries[max_index].pair_pos; 
    383  
    384                             //prevent "going backwards through the sequence" 
    385                             if (min_index > max_index_partner) { 
    386                                 sec_root->split_loop(max_index_partner, min_index_partner+1, min_index, max_index+1); 
    387                             } 
    388                             else { 
    389                                 sec_root->split_loop(min_index, max_index+1, max_index_partner, min_index_partner+1); 
    390                             } 
    391  
    392                             exports.refresh = 1; 
    393                             exports.save = 1; 
    394                             exports.resize = 1; 
    395                         }else{ 
    396                             aw_message("You can only split loops"); 
    397                         } 
    398                         this->rot_ct = *ct; 
    399                     } 
    400                 } 
    401                 break; 
    402             } 
    403             default: { 
    404                 break; 
    405             } 
    406             } 
    407         } 
    408         else if (button==AWT_M_RIGHT) { 
    409             switch(type) { 
    410             case AW_Mouse_Press: { 
    411                 if( !(ct && ct->exists) ) { 
    412                     break; 
    413                 } 
    414  
    415                 /*** check security level @@@ ***/ 
    416                 SEC_Base *base = (SEC_Base *)ct->client_data1; 
    417                 if (base) { 
    418                     if (base->getType() == SEC_HELIX_STRAND) { 
    419                         sec_root->unsplit_loop((SEC_helix_strand *) base); 
     357                                if (base->getType() == SEC_SEGMENT) { 
     358                                    int clicked_pos = ct->client_data2; 
     359                                    if (clicked_pos > int(sec_root->helix->size)) { 
     360                                        aw_message("Index of clicked Base is out of range"); 
     361                                        break; 
     362                                    } 
     363                                    if (sec_root->helix->entries[clicked_pos].pair_type == HELIX_NONE) { 
     364                                        aw_message("Selected Base is not suitable to split"); 
     365                                        break; 
     366                                    } 
     367 
     368                                    char *clicked_helix_nr = sec_root->helix->entries[clicked_pos].helix_nr; 
     369                                    char *helix_nr; 
     370                                    int i, min_index=(-1), max_index=(-1); 
     371                                    for (i=0; i<int(sec_root->helix->size); i++) { 
     372                                        helix_nr = sec_root->helix->entries[i].helix_nr; 
     373                                        if ( (helix_nr != NULL) && (clicked_helix_nr != NULL) ) { 
     374                                            if(!strcmp(helix_nr, clicked_helix_nr)) { 
     375                                                if (min_index<0) { 
     376                                                    min_index = i; 
     377                                                } 
     378                                                max_index = i; 
     379                                            } 
     380                                        } 
     381                                    } 
     382                                    int min_index_partner = sec_root->helix->entries[min_index].pair_pos; 
     383                                    int max_index_partner = sec_root->helix->entries[max_index].pair_pos; 
     384 
     385                                    //prevent "going backwards through the sequence" 
     386                                    if (min_index > max_index_partner) { 
     387                                        sec_root->split_loop(max_index_partner, min_index_partner+1, min_index, max_index+1); 
     388                                    } 
     389                                    else { 
     390                                        sec_root->split_loop(min_index, max_index+1, max_index_partner, min_index_partner+1); 
     391                                    } 
     392 
     393                                    exports.refresh = 1; 
     394                                    exports.save = 1; 
     395                                    exports.resize = 1; 
     396                                }else{ 
     397                                    aw_message("You can only split loops"); 
     398                                } 
     399                                this->rot_ct = *ct; 
     400                            } 
     401                        } 
     402                        break; 
     403                    } 
     404                    default: { 
     405                        break; 
     406                    } 
     407                } 
     408            } 
     409            else if (button==AWT_M_RIGHT) { 
     410                switch(type) { 
     411                    case AW_Mouse_Press: { 
     412                        if( !(ct && ct->exists) ) { 
     413                            break; 
     414                        } 
     415 
     416                        /*** check security level @@@ ***/ 
     417                        SEC_Base *base = (SEC_Base *)ct->client_data1; 
     418                        if (base) { 
     419                            if (base->getType() == SEC_HELIX_STRAND) { 
     420                                sec_root->unsplit_loop((SEC_helix_strand *) base); 
    420421 
    421422#if defined(DEBUG) && 0 
    422                         ofstream fout("unsplit_test", ios::out); 
    423                         fout << sec_root->write_data(); 
    424                         fout.close(); 
     423                                ofstream fout("unsplit_test", ios::out); 
     424                                fout << sec_root->write_data(); 
     425                                fout.close(); 
    425426#endif 
    426427 
    427                         exports.refresh = 1; 
    428                         exports.save = 1; 
    429                         exports.resize = 1; 
    430                     } 
    431                     else { 
    432                         aw_message("You can only unsplit helices"); 
    433                     } 
    434                     this->rot_ct = *ct; 
    435                 } 
    436                 break;   // break of case AW_Mouse_Press 
    437             } 
    438             default: { 
    439                 break; 
    440             } 
    441             } 
    442         } 
    443         break; //break for case AWT_MODE_MOVE 
    444     } 
    445         /* ******************************************************** */ 
    446     case AWT_MODE_SETROOT: { // set-root-mode 
    447         if(button==AWT_M_MIDDLE) { 
    448             break; 
    449         } 
    450         switch(type) { 
    451         case AW_Mouse_Press: { 
    452             if( !(ct && ct->exists) ) { 
    453                 break; 
    454             } 
    455  
    456             /*** check security level @@@ ***/ 
    457  
    458             SEC_Base *base = (SEC_Base *)ct->client_data1; 
    459             if(base) { 
    460                 sec_root->set_root(base); 
    461                 exports.refresh = 1; 
    462                 exports.save = 1; 
    463                 exports.resize = 1; 
    464                 this->rot_ct = *ct; 
    465                 sec_root->update(0); 
    466             } 
    467             break; 
    468         } 
    469         default: { 
    470             break; 
    471         } 
    472         } 
    473         break; 
    474     } 
    475         /* ******************************************************** */ 
    476     case AWT_MODE_ROT: { // rotate-branches-mode 
    477         if(button==AWT_M_MIDDLE) { 
    478             break; 
    479         } 
    480         if(button==AWT_M_LEFT) { 
    481             sec_root->drag_recursive = 1; 
    482         } 
    483  
    484         double end_angle, dif_angle, delta; 
    485         double fixpoint_x, fixpoint_y; 
    486         SEC_helix_strand *strand_pointer; 
    487         SEC_helix *helix_info; 
    488         SEC_Base *base; 
    489  
    490         switch(type) { 
    491         case AW_Mouse_Press: { 
    492             base = (SEC_Base *)ct->client_data1; 
    493             if (base) { 
    494                 if (base->getType() == SEC_HELIX_STRAND) { 
    495                     strand_pointer = (SEC_helix_strand *) base; 
    496                     sec_root->rotateBranchesMode = 1; 
    497  
    498                     //special treating for root_loop's caller 
    499                     SEC_loop *root_loop = (sec_root->get_root_segment())->get_loop(); 
    500                     /* if (strand_pointer == root_loop->get_segment()->get_next_helix()) { 
    501                     //turn around root_loop caller's angle  -- warum?? 
    502                     helix_info = strand_pointer->get_helix_info(); 
    503                     double tmp_delta = helix_info->get_delta(); 
    504                     helix_info->set_delta(tmp_delta + M_PI); 
    505                     }*/ 
    506  
    507                     fixpoint_x = strand_pointer->get_fixpoint_x(); 
    508                     fixpoint_y = strand_pointer->get_fixpoint_y(); 
    509                     strand_pointer->start_angle = (2*M_PI) + atan2( (world_y - fixpoint_y), (world_x - fixpoint_x) ); 
    510                     helix_info = strand_pointer->get_helix_info(); 
    511                     strand_pointer->old_delta = helix_info->get_delta(); 
    512                 } 
    513                 else { 
    514                     aw_message("Only helix-strands can be dragged"); 
    515                 } 
    516             } 
    517             break; 
    518         } 
    519         case AW_Mouse_Drag: { 
    520             base = (SEC_Base *)ct->client_data1; 
    521             if(base) { 
    522                 if (base->getType() == SEC_HELIX_STRAND) { 
    523                     strand_pointer = (SEC_helix_strand *) base; 
    524  
    525                     fixpoint_x = strand_pointer->get_fixpoint_x(); 
    526                     fixpoint_y = strand_pointer->get_fixpoint_y(); 
    527                     end_angle = (2*M_PI) + atan2( (world_y - fixpoint_y), (world_x - fixpoint_x) ); 
    528                     dif_angle = end_angle - strand_pointer->start_angle; 
    529  
    530                     if (sec_root->drag_recursive) { 
    531                         strand_pointer->update(fixpoint_x, fixpoint_y, dif_angle); 
    532                         helix_info = strand_pointer->get_helix_info(); 
    533                         strand_pointer->compute_attachment_points(helix_info->get_delta()); 
    534                         strand_pointer->start_angle = end_angle; 
    535                     } 
    536                     else { 
    537                         delta = strand_pointer->old_delta; 
    538                         delta = delta + dif_angle + (2*M_PI);  //adding 2 PI converts negative angles into positive ones 
    539                         helix_info = strand_pointer->get_helix_info(); 
    540                         helix_info->set_delta(delta); 
    541                         strand_pointer->compute_attachment_points(delta); 
    542                         strand_pointer->update(fixpoint_x, fixpoint_y, 0); 
    543                     } 
    544  
    545                     SEC_loop *root_loop = (sec_root->get_root_segment())->get_loop(); 
    546                     if (strand_pointer != root_loop->get_segment()->get_next_helix()) { 
    547                         sec_root->update(0); 
    548                     } 
    549                     exports.refresh = 1; 
    550                 } 
    551             } 
    552             break; 
    553         } 
    554         case AW_Mouse_Release: { 
    555             sec_root->drag_recursive = 0; 
    556             exports.refresh = 1; 
    557             exports.save = 1; 
    558  
    559             base = (SEC_Base *)ct->client_data1; 
    560             if(base) { 
    561                 if (base->getType() == SEC_HELIX_STRAND) { 
    562                     strand_pointer = (SEC_helix_strand *) base; 
    563  
    564                     //special treating for root_loop's caller 
    565                     SEC_loop *root_loop = (sec_root->get_root_segment())->get_loop(); 
    566                     /*  if (strand_pointer == root_loop->get_segment()->get_next_helix()) { 
    567                         helix_info = strand_pointer->get_helix_info(); 
    568                         double tmp_delta = helix_info->get_delta(); 
    569                         helix_info->set_delta(tmp_delta + M_PI ); 
    570                         }*/ 
    571                 } 
    572             } 
    573             sec_root->update(0); 
    574             sec_root->rotateBranchesMode = 0; 
    575             break; 
    576         } 
    577         default: { 
    578             break; 
    579         } 
    580         } 
    581         break; 
    582     } 
    583         /* ******************************************************** */ 
    584     case AWT_MODE_MOD: { // show constraints 
    585         exports.refresh = 1; 
    586         if(button==AWT_M_MIDDLE) { 
    587             break; 
    588         } 
    589         if(button==AWT_M_LEFT) { 
    590             if (type==AW_Mouse_Press) { 
    591                 SEC_Base *base = (SEC_Base*)ct->client_data1; 
    592  
    593                 if (base) { 
    594                     switch (base->getType()) { 
    595                     case SEC_HELIX_STRAND: { 
    596                         SEC_helix_strand *strand = (SEC_helix_strand*)base; 
    597                         SEC_helix *helix_info = strand->get_helix_info(); 
    598                         if (change_constraints("length", "strand", helix_info->get_min_length_ref(), helix_info->get_max_length_ref())==0) { 
    599                             sec_root->update(); 
    600                         } 
    601                         break; 
    602                     } 
    603                     case SEC_SEGMENT: { 
    604                         SEC_segment *segment = (SEC_segment*)base; 
    605                         SEC_loop *loop = segment->get_loop(); 
    606                         if (change_constraints("radius", "loop", loop->get_min_radius_ref(), loop->get_max_radius_ref())==0) { 
    607                             sec_root->update(); 
    608                         } 
    609                         break; 
    610                     } 
    611                     default: { 
     428                                exports.refresh = 1; 
     429                                exports.save = 1; 
     430                                exports.resize = 1; 
     431                            } 
     432                            else { 
     433                                aw_message("You can only unsplit helices"); 
     434                            } 
     435                            this->rot_ct = *ct; 
     436                        } 
     437                        break;   // break of case AW_Mouse_Press 
     438                    } 
     439                    default: { 
     440                        break; 
     441                    } 
     442                } 
     443            } 
     444            break; //break for case AWT_MODE_MOVE 
     445        } 
     446            /* ******************************************************** */ 
     447        case AWT_MODE_SETROOT: { // set-root-mode 
     448            if(button==AWT_M_MIDDLE) { 
     449                break; 
     450            } 
     451            switch(type) { 
     452                case AW_Mouse_Press: { 
     453                    if( !(ct && ct->exists) ) { 
     454                        break; 
     455                    } 
     456 
     457                    /*** check security level @@@ ***/ 
     458 
     459                    SEC_Base *base = (SEC_Base *)ct->client_data1; 
     460                    if(base) { 
     461                        sec_root->set_root(base); 
     462                        exports.refresh = 1; 
     463                        exports.save = 1; 
     464                        exports.resize = 1; 
     465                        this->rot_ct = *ct; 
     466                        sec_root->update(0); 
     467                    } 
     468                    break; 
     469                } 
     470                default: { 
     471                    break; 
     472                } 
     473            } 
     474            break; 
     475        } 
     476            /* ******************************************************** */ 
     477        case AWT_MODE_ROT: { // rotate-branches-mode 
     478            if(button==AWT_M_MIDDLE) { 
     479                break; 
     480            } 
     481            if(button==AWT_M_LEFT) { 
     482                sec_root->drag_recursive = 1; 
     483            } 
     484 
     485            double end_angle, dif_angle, delta; 
     486            double fixpoint_x, fixpoint_y; 
     487            SEC_helix_strand *strand_pointer; 
     488            SEC_helix *helix_info; 
     489            SEC_Base *base; 
     490 
     491            switch(type) { 
     492                case AW_Mouse_Press: { 
     493                    base = (SEC_Base *)ct->client_data1; 
     494                    if (base) { 
     495                        if (base->getType() == SEC_HELIX_STRAND) { 
     496                            strand_pointer = (SEC_helix_strand *) base; 
     497                            sec_root->rotateBranchesMode = 1; 
     498 
     499                            //special treating for root_loop's caller 
     500                            //              SEC_loop *root_loop = (sec_root->get_root_segment())->get_loop(); 
     501 
     502                            /* if (strand_pointer == root_loop->get_segment()->get_next_helix()) { 
     503                            //turn around root_loop caller's angle  -- warum?? 
     504                            helix_info = strand_pointer->get_helix_info(); 
     505                            double tmp_delta = helix_info->get_delta(); 
     506                            helix_info->set_delta(tmp_delta + M_PI); 
     507                            }*/ 
     508 
     509                            fixpoint_x = strand_pointer->get_fixpoint_x(); 
     510                            fixpoint_y = strand_pointer->get_fixpoint_y(); 
     511                            strand_pointer->start_angle = (2*M_PI) + atan2( (world_y - fixpoint_y), (world_x - fixpoint_x) ); 
     512                            helix_info = strand_pointer->get_helix_info(); 
     513                            strand_pointer->old_delta = helix_info->get_delta(); 
     514                        } 
     515                        else { 
     516                            aw_message("Only helix-strands can be dragged"); 
     517                        } 
     518                    } 
     519                    break; 
     520                } 
     521                case AW_Mouse_Drag: { 
     522                    base = (SEC_Base *)ct->client_data1; 
     523                    if(base) { 
     524                        if (base->getType() == SEC_HELIX_STRAND) { 
     525                            strand_pointer = (SEC_helix_strand *) base; 
     526 
     527                            fixpoint_x = strand_pointer->get_fixpoint_x(); 
     528                            fixpoint_y = strand_pointer->get_fixpoint_y(); 
     529                            end_angle = (2*M_PI) + atan2( (world_y - fixpoint_y), (world_x - fixpoint_x) ); 
     530                            dif_angle = end_angle - strand_pointer->start_angle; 
     531 
     532                            if (sec_root->drag_recursive) { 
     533                                strand_pointer->update(fixpoint_x, fixpoint_y, dif_angle); 
     534                                helix_info = strand_pointer->get_helix_info(); 
     535                                strand_pointer->compute_attachment_points(helix_info->get_delta()); 
     536                                strand_pointer->start_angle = end_angle; 
     537                            } 
     538                            else { 
     539                                delta = strand_pointer->old_delta; 
     540                                delta = delta + dif_angle + (2*M_PI);  //adding 2 PI converts negative angles into positive ones 
     541                                helix_info = strand_pointer->get_helix_info(); 
     542                                helix_info->set_delta(delta); 
     543                                strand_pointer->compute_attachment_points(delta); 
     544                                strand_pointer->update(fixpoint_x, fixpoint_y, 0); 
     545                            } 
     546 
     547                            SEC_loop *root_loop = (sec_root->get_root_segment())->get_loop(); 
     548                            if (strand_pointer != root_loop->get_segment()->get_next_helix()) { 
     549                                sec_root->update(0); 
     550                            } 
     551                            exports.refresh = 1; 
     552                        } 
     553                    } 
     554                    break; 
     555                } 
     556                case AW_Mouse_Release: { 
     557                    sec_root->drag_recursive = 0; 
     558                    exports.refresh = 1; 
     559                    exports.save = 1; 
     560 
     561                    base = (SEC_Base *)ct->client_data1; 
     562                    if(base) { 
     563                        if (base->getType() == SEC_HELIX_STRAND) { 
     564                            strand_pointer = (SEC_helix_strand *) base; 
     565 
     566                            //special treating for root_loop's caller 
     567                            //              SEC_loop *root_loop = (sec_root->get_root_segment())->get_loop(); 
     568 
     569                            /*  if (strand_pointer == root_loop->get_segment()->get_next_helix()) { 
     570                                helix_info = strand_pointer->get_helix_info(); 
     571                                double tmp_delta = helix_info->get_delta(); 
     572                                helix_info->set_delta(tmp_delta + M_PI ); 
     573                                }*/ 
     574                        } 
     575                    } 
     576                    sec_root->update(0); 
     577                    sec_root->rotateBranchesMode = 0; 
     578                    break; 
     579                } 
     580                default: { 
     581                    break; 
     582                } 
     583            } 
     584            break; 
     585        } 
     586            /* ******************************************************** */ 
     587        case AWT_MODE_MOD: { // show constraints 
     588            exports.refresh = 1; 
     589            if(button==AWT_M_MIDDLE) { 
     590                break; 
     591            } 
     592            if(button==AWT_M_LEFT) { 
     593                if (type==AW_Mouse_Press) { 
     594                    SEC_Base *base = (SEC_Base*)ct->client_data1; 
     595 
     596                    if (base) { 
     597                        switch (base->getType()) { 
     598                            case SEC_HELIX_STRAND: { 
     599                                SEC_helix_strand *strand = (SEC_helix_strand*)base; 
     600                                SEC_helix *helix_info = strand->get_helix_info(); 
     601                                if (change_constraints("length", "strand", helix_info->get_min_length_ref(), helix_info->get_max_length_ref())==0) { 
     602                                    sec_root->update(); 
     603                                } 
     604                                break; 
     605                            } 
     606                            case SEC_SEGMENT: { 
     607                                SEC_segment *segment = (SEC_segment*)base; 
     608                                SEC_loop *loop = segment->get_loop(); 
     609                                if (change_constraints("radius", "loop", loop->get_min_radius_ref(), loop->get_max_radius_ref())==0) { 
     610                                    sec_root->update(); 
     611                                } 
     612                                break; 
     613                            } 
     614                            default: { 
    612615#if defined(DEBUG) 
    613                         sec_assert(0); 
     616                                sec_assert(0); 
    614617#endif // DEBUG 
    615                         break; 
    616                     } 
    617                     } 
    618                 } 
    619             } 
    620         } 
    621  
    622         break;  //break for case AWT_MODE_MOD 
    623     } 
    624         /* ******************************************************** */ 
    625  
    626     case AWT_MODE_LINE: { // set-cursor-mode (in ARB_EDIT4) 
    627         if (button==AWT_M_MIDDLE) { 
    628             break; 
    629         } 
    630         if (button==AWT_M_LEFT) { 
    631             if (type==AW_Mouse_Press) { 
    632                 SEC_Base *base = (SEC_Base*)ct->client_data1; 
    633                 int clicked_pos = ct->client_data2; 
    634  
    635                 if (base) { 
    636                     if (clicked_pos>int(sec_root->helix->size)) { 
    637                         aw_message("Index of clicked Base is out of range"); 
    638                         break; 
    639                     } 
     618                                break; 
     619                            } 
     620                        } 
     621                    } 
     622                } 
     623            } 
     624 
     625            break;  //break for case AWT_MODE_MOD 
     626        } 
     627            /* ******************************************************** */ 
     628 
     629        case AWT_MODE_LINE: { // set-cursor-mode (in ARB_EDIT4) 
     630            if (button==AWT_M_MIDDLE) { 
     631                break; 
     632            } 
     633            if (button==AWT_M_LEFT) { 
     634                if (type==AW_Mouse_Press) { 
     635                    SEC_Base *base = (SEC_Base*)ct->client_data1; 
     636                    int clicked_pos = ct->client_data2; 
     637 
     638                    if (base) { 
     639                        if (clicked_pos>int(sec_root->helix->size)) { 
     640                            aw_message("Index of clicked Base is out of range"); 
     641                            break; 
     642                        } 
    640643#if defined(DEBUG) && 1 
    641                     printf("Clicked pos = %i\n", clicked_pos); 
     644                        printf("Clicked pos = %i\n", clicked_pos); 
    642645#endif 
    643                     aw_root->awar_int(AWAR_SET_CURSOR_POSITION)->write_int(clicked_pos+1); // sequence position is starting with 1 !!! 
    644                 } 
    645             } 
    646         } 
    647         break; 
    648     } 
    649         /* ******************************************************** */ 
    650     default: { 
     646                        aw_root->awar_int(AWAR_SET_CURSOR_POSITION)->write_int(clicked_pos+1); // sequence position is starting with 1 !!! 
     647                    } 
     648                } 
     649            } 
     650            break; 
     651        } 
     652            /* ******************************************************** */ 
     653        default: { 
    651654#if defined(DEBUG) 
    652         sec_assert(0); 
     655            sec_assert(0); 
    653656#endif // DEBUG 
    654         break; 
    655     } 
     657            break; 
     658        } 
    656659    } 
    657660} 
  • trunk/SECEDIT/secedit.hxx

    r875 r1003  
    295295    void clear_last_drawed_cursor_position() { set_last_drawed_cursor_position(0, 0, 0, 0); } 
    296296 
    297     void setRootAngle(double rtAngle) {  
    298         while(rtAngle >= (2*M_PI)){ 
    299             rtAngle -= (2*M_PI); 
    300         } 
    301         rootAngle = rtAngle;  
     297    void setRootAngle(double rtAngle) { 
     298        while(rtAngle >= (2*M_PI)){ 
     299            rtAngle -= (2*M_PI); 
     300        } 
     301        rootAngle = rtAngle; 
    302302    } 
    303303    double getRootAngle()             { return rootAngle;    } 
     
    483483 
    484484    double delta; 
    485     double deltaIn;  
     485    double deltaIn; 
    486486    double max_length, min_length; // constraints 
    487487 
     
    502502 
    503503    double get_delta ()                 { return delta; } 
    504     double get_deltaIn ()               { return deltaIn;}  
     504    double get_deltaIn ()               { return deltaIn;} 
    505505 
    506506    double& get_max_length_ref()        { return max_length; } 
     
    520520            deltaIn_ -= (2*M_PI); 
    521521        } 
    522         deltaIn = deltaIn_;  
    523     }  
     522        deltaIn = deltaIn_; 
     523    } 
    524524}; 
    525525 
  • trunk/SEER/SEER_to_seer.cxx

    r2 r1003  
    2727        const char *key = GB_read_key_pntr(gbd); 
    2828        sprintf(end_of_prefix,GB_read_key_pntr(gbd)); 
    29          
     29 
    3030        if (!strcmp(prefix,"name")) continue; 
    3131        if (!strcmp(prefix,SEER_KEY_FLAG)) continue; 
     
    3333        if (!at) continue; 
    3434        if (at->element_for_upload==0) continue; 
    35          
     35 
    3636        if (GB_read_clock(gbd) <= transaction_limit){ 
    3737            continue; 
    3838        } 
    39          
     39 
    4040        GB_TYPES type = GB_read_type(gbd); 
    4141        if (type == GB_DB){ 
     
    6868    int count_exported_items = 0; 
    6969    if (GB_read_clock(gb_ali) <= transaction_limit) return 0; 
    70      
     70 
    7171    for (gb_data = GB_find(gb_ali,0,0,down_level); 
    7272         gb_data; 
     
    7676        const char *key = GB_read_key_pntr(gb_data); 
    7777        if (!strcmp(key,"data")) key = "Sequence"; 
    78          
     78 
    7979        switch(type){ 
    8080        case GB_STRING: 
     
    141141    } 
    142142    delete sd; 
    143          
    144 }        
     143 
     144} 
    145145 
    146146void seer_upload_all_species(AW_root *awr,int sequence_flag, int SAI_flag){ 
    147     GBDATA *gb_species; 
    148     GBDATA *gb_next_species; 
    149     SEER_SAVE_WHAT_TYPE save_what = (SEER_SAVE_WHAT_TYPE)awr->awar(AWAR_SEER_UPLOAD_WHAT)->read_int(); 
    150     SEER_SAVE_TYPE save_type = (SEER_SAVE_TYPE)awr->awar(AWAR_SEER_UPLOAD_TYPE)->read_int(); 
    151     char *alignment_name = awr->awar(AWAR_SEER_ALIGNMENT_NAME)->read_string(); 
    152     char *arb_alignment_name = strdup(GBS_global_string("ali_%s",alignment_name)); 
     147    GBDATA              *gb_species; 
     148    GBDATA              *gb_next_species; 
     149    SEER_SAVE_WHAT_TYPE  save_what          = (SEER_SAVE_WHAT_TYPE)awr->awar(AWAR_SEER_UPLOAD_WHAT)->read_int(); 
     150    SEER_SAVE_TYPE       save_type          = (SEER_SAVE_TYPE)awr->awar(AWAR_SEER_UPLOAD_TYPE)->read_int(); 
     151    char                *alignment_name     = awr->awar(AWAR_SEER_ALIGNMENT_NAME)->read_string(); 
     152    char                *arb_alignment_name = GBS_global_string_copy("ali_%s",alignment_name); 
     153 
    153154    aw_openstatus("Sequence Data"); 
    154155    int max_i = 1; 
     
    330331            if (GB_read_int(gb_type) != GB_STRING) continue; 
    331332            at = new SeerInterfaceAttribute(); 
    332              
     333 
    333334            key_name = GB_search(gb_key,CHANGEKEY_NAME,GB_STRING); 
    334335            at->name = GB_read_string(key_name); 
     
    344345        // 
    345346        // 
    346          
     347 
    347348    } 
    348349    {   // put arb_attribute_hash to selection list 
     
    367368        aw_root->awar_int(AWAR_SEER_SAVE_SEQUENCES,1); 
    368369        aw_root->awar_int(AWAR_SEER_SAVE_SAI,1); 
    369              
     370 
    370371        seer_global.seer_upload_window = aws = new AW_window_simple; 
    371372        aws->init( aw_root, "UPLOAD_ARB_2_SEER", "SEER UPLOAD_DATA", 400, 100 ); 
    372373        aws->load_xfig("seer/upload.fig"); 
    373374 
    374          
     375 
    375376        aws->callback( AW_POPDOWN); 
    376377        aws->at("close"); 
    377         aws->create_button("CANCEL","CANCEL","C");                          
     378        aws->create_button("CANCEL","CANCEL","C"); 
    378379 
    379380        aws->at("help"); 
     
    412413                sprintf(at_buffer,"table_%i",table_nr); 
    413414                sprintf(awar_buffer,"%s/%s",AWAR_SEER_UPLOAD_TABLE_PREFIX,td->tablename); 
    414                  
     415 
    415416                aws->at(at_buffer); 
    416417                aw_root->awar_int(awar_buffer,0); 
     
    427428            aws->callback(seer_select_all_export_attributes,1); 
    428429            aws->create_button("INVERT_ALL_ATTRIBUTES","Invert All"); 
    429          
     430 
    430431            aws->at("deselect"); 
    431432            aws->callback(seer_select_all_export_attributes,0); 
    432433            aws->create_button("DESELECT_ALL_ATTRIBUTES","Deselect All"); 
    433          
     434 
    434435            aws->at("auto"); 
    435436            aws->callback(seer_check_upload_attribute_list); 
    436437            aws->create_button("AUTO_SELECT_ATTRIBUTES","Auto Select"); 
    437          
     438 
    438439            aws->at("sequence_save"); 
    439440            aws->create_toggle(AWAR_SEER_SAVE_SEQUENCES); 
    440      
     441 
    441442            aws->at("SAI_save"); 
    442443            aws->create_toggle(AWAR_SEER_SAVE_SAI); 
    443          
     444 
    444445            aws->at("go"); 
    445446            aws->button_length(15); 
  • trunk/SOURCE_TOOLS/arb_valgrind

    r997 r1003  
    1717    echo '    Updates the source file list (needed to create correct error message)' 
    1818    echo '' 
     19    echo 'Environment:' 
     20    echo '' 
     21    echo '      $ARBHOME     a directory which has to contain a subdirectory SOURCE_TOOLS.' 
     22    echo '                   SOURCE_TOOLS has to contain valgrind2grep and has to be writeable for the user' 
     23    echo '' 
     24    echo '      $ARB_VALGRIND_SOURCE_ROOT       down from here the script scans for sources' 
     25    echo '                                      (defaults to $ARBHOME if empty)' 
     26    echo '' 
    1927    echo 'Note: I use this from inside emacs as follows:' 
    2028    echo '          M-x compile' 
     
    2230    echo '          (cd $ARBHOME;make nt) && arb_valgrind arb_ntree ~/ARB/demo.arb' 
    2331    echo '' 
     32 
    2433else 
     34    if [ -z $ARB_VALGRIND_SOURCE_ROOT ] ; then 
     35        ARB_VALGRIND_SOURCE_ROOT=$ARBHOME 
     36    fi 
     37 
    2538    DIR=$ARBHOME/SOURCE_TOOLS 
    2639    LIST=$DIR/valgrind2grep.lst 
     
    4962 
    5063    if [ $UPDATE = 1 ] ; then 
    51         echo 'Creating source file list...' 
    52         find $ARBHOME -name "*.[ch]" -o -name "*.[ch]xx" > $LIST 
     64        echo "Creating list of source files starting in $ARB_VALGRIND_SOURCE_ROOT ..." 
     65        find $ARB_VALGRIND_SOURCE_ROOT -name "*.[ch]" -o -name "*.[ch]xx" -o -name "*.[ch]pp" > $LIST 
    5366        echo 'done.' 
    5467    fi 
     
    5770        echo "CALLERS='$CALLERS'" 
    5871        echo "FILTER ='$FILTER'" 
    59         valgrind --leak-check=yes --num-callers=10 $* 2>&1 >/dev/null | $DIR/valgrind2grep $CALLERS "$FILTER" 
     72        valgrind --leak-check=yes --num-callers=10 $* 2>&1 >/tmp/arb_valgrind_$USER.stdout | $DIR/valgrind2grep $CALLERS "$FILTER" 
    6073        echo 'valgrind done.' 
    6174    fi 
  • trunk/WINDOW/AW_button.cxx

    r996 r1003  
    216216            char *value = vus->awar->read_as_string(); 
    217217            GBS_fwrite_string(value,root->prvt->recording_macro_file); 
    218             delete value; 
     218            free(value); 
    219219            fprintf(root->prvt->recording_macro_file,");\n"); 
    220220        } 
     
    323323    { 
    324324        if (macro_name){ 
    325             _callback->id = strdup(GBS_global_string("%s/%s",this->window_defaults_name,macro_name)); 
     325            _callback->id = GBS_global_string_copy("%s/%s",this->window_defaults_name,macro_name); 
    326326            GBS_write_hash(this->get_root()->prvt->action_hash,_callback->id,(long)_callback); 
    327327        }else{ 
     
    515515    char *path; 
    516516    if (var[0] == '0' || var[0] == 'n') { 
    517         path = strdup(GBS_global_string("%s/lib/pixmaps/%s",GB_getenvARBHOME(),bitmaps[0]+1)); 
     517        path = GBS_global_string_copy("%s/lib/pixmaps/%s",GB_getenvARBHOME(),bitmaps[0]+1); 
    518518    }else{ 
    519         path = strdup(GBS_global_string("%s/lib/pixmaps/%s",GB_getenvARBHOME(),bitmaps[1]+1)); 
     519        path = GBS_global_string_copy("%s/lib/pixmaps/%s",GB_getenvARBHOME(),bitmaps[1]+1); 
    520520    } 
    521521    XtVaSetValues( (Widget)wgt, RES_CONVERT( XmNlabelPixmap, path ), NULL ); 
     
    641641                      (XtCallbackProc) AW_server_callback, 
    642642                      (XtPointer) _d_callback ); 
    643         _d_callback->id = strdup(GBS_global_string("INPUT:%s",var_name)); 
     643        _d_callback->id = GBS_global_string_copy("INPUT:%s",var_name); 
    644644        GBS_write_hash(this->get_root()->prvt->action_hash,_d_callback->id,(long)_d_callback); 
    645645    } 
     
    11271127} 
    11281128 
    1129 int AW_window::move_selection(AW_selection_list *selection_list, AW_awar *list_awar, int offset) { 
    1130     int curr_idx; 
    1131     { 
    1132         char *curr_value = list_awar->read_string(); 
    1133  
    1134         curr_idx = get_index_of_element(selection_list, curr_value); 
    1135         free(curr_value); 
    1136     } 
    1137  
    1138     if (curr_idx == -1) { 
    1139         curr_idx = 0; 
     1129int AW_window::get_index_of_current_element(AW_selection_list *selection_list, const char *awar_name) { 
     1130    // returns -1 if no entry is selected 
     1131    AW_root *aw_root    = get_root(); 
     1132    char    *curr_value = aw_root->awar(awar_name)->read_string(); 
     1133    int      index      = get_index_of_element(selection_list, curr_value); 
     1134 
     1135#if defined(DEBUG) && 0 
     1136    printf("get_index_of_current_element: curr_value='%s' index=%i\n", curr_value, index); 
     1137#endif // DEBUG 
     1138 
     1139    free(curr_value); 
     1140    return index; 
     1141} 
     1142 
     1143void AW_window::select_index(AW_selection_list *selection_list, const char *awar_name, int wanted_index) { 
     1144    AW_root    *aw_root      = get_root(); 
     1145    const char *wanted_value = get_element_of_index(selection_list, wanted_index); 
     1146 
     1147#if defined(DEBUG) && 0 
     1148    printf("select_index : wanted_index=%i wanted_value='%s'\n", wanted_index, wanted_value); 
     1149#endif // DEBUG 
     1150 
     1151    if (wanted_value) { 
     1152        aw_root->awar(awar_name)->write_string(wanted_value); 
    11401153    } 
    11411154    else { 
    1142         curr_idx += offset; 
    1143     } 
    1144  
    1145     const char *new_value = get_element_of_index(selection_list, curr_idx); 
    1146     if (new_value) { 
    1147         list_awar->write_string(new_value); 
    1148     } 
    1149     return 0; 
     1155        aw_root->awar(awar_name)->write_string(""); 
     1156    } 
     1157} 
     1158 
     1159void AW_window::move_selection(AW_selection_list *selection_list, const char *awar_name, int offset) { 
     1160    int index = get_index_of_current_element(selection_list, awar_name); 
     1161    select_index(selection_list, awar_name, index+offset); 
     1162 
     1163    //     int curr_idx; 
     1164    //     { 
     1165    //         char *curr_value = list_awar->read_string(); 
     1166 
     1167    //         curr_idx = get_index_of_element(selection_list, curr_value); 
     1168    //         free(curr_value); 
     1169    //     } 
     1170 
     1171    //     if (curr_idx == -1) { 
     1172    //         curr_idx = 0; 
     1173    //     } 
     1174    //     else { 
     1175    //         curr_idx += offset; 
     1176    //     } 
     1177 
     1178    //     const char *new_value = get_element_of_index(selection_list, curr_idx); 
     1179    //     if (new_value) { 
     1180    //         list_awar->write_string(new_value); 
     1181    //     } 
     1182    //     return 0; 
    11501183} 
    11511184 
     
    11581191 
    11591192    while (listEntry) { 
    1160         if (GBS_strscmp(listEntry, searched_value) == 0) { 
     1193        if (strcmp(listEntry, searched_value) == 0) { 
    11611194            found_index = element_index; 
    11621195            break;              // found 
     
    16351668            if (ko[0] && pl[0] != '#') this->insert_selection(selection_list,pl,ko); 
    16361669        } 
    1637         delete data; 
     1670        free(data); 
    16381671    } 
    16391672    GBS_free_names(fnames); 
  • trunk/WINDOW/AW_preset.cxx

    r996 r1003  
    323323} 
    324324 
    325 const char *AW_get_color_group_name(AW_root *awr, int color_group) { 
     325char *AW_get_color_group_name(AW_root *awr, int color_group) { 
    326326    aw_assert(color_groups_initialized); 
    327327    aw_assert(color_group>0 && color_group <= AW_COLOR_GROUPS); 
     
    674674            if (is_color_group) { 
    675675                aw_assert(color_group > 0); 
    676                 aws->label(AW_get_color_group_name(aw_root, color_group)); 
     676                char *color_group_name = AW_get_color_group_name(aw_root, color_group); 
     677                aws->label(color_group_name); 
     678                free(color_group_name); 
    677679            } 
    678680            else { 
  • trunk/WINDOW/AW_question.cxx

    r859 r1003  
    33//    File      : aw_question.cpp                                        // 
    44//    Purpose   :                                                        // 
    5 //    Time-stamp: <Thu Aug/22/2002 19:48 MET Coder@ReallySoft.de>        // 
     5//    Time-stamp: <Tue Dec/03/2002 15:01 MET Coder@ReallySoft.de>        // 
    66//                                                                       // 
    77//                                                                       // 
     
    4747            char       *w       = new_buttons; 
    4848            const char *r       = buttons; 
    49             char       *all     = strdup(GBS_global_string(" (%s)", to_all)); 
     49            char       *all     = GBS_global_string_copy(" (%s)", to_all); 
    5050            int         all_len = strlen(all); 
    5151 
  • trunk/WINDOW/AW_status.cxx

    r989 r1003  
    808808                aw_msg->create_button(word, word, ""); 
    809809            } 
     810 
     811            free(but); 
    810812        } 
    811813        else { 
     
    867869    } 
    868870 
     871    free(last_input); 
    869872 
    870873    root->disable_callbacks = AW_FALSE; 
     
    959962    GB_CSTR  result             = 0; 
    960963    char    *user_doc_path      = strdup(GB_getenvDOCPATH()); 
    961     char    *devel_doc_path     = strdup(GBS_global_string("%s/HELP_SOURCE/oldhelp", GB_getenvARBHOME())); 
     964    char    *devel_doc_path     = GBS_global_string_copy("%s/HELP_SOURCE/oldhelp", GB_getenvARBHOME()); 
    962965    size_t   user_doc_path_len  = strlen(user_doc_path); 
    963966    size_t   devel_doc_path_len = strlen(devel_doc_path); 
     
    10271030 
    10281031    if (!GBS_string_cmp(ref,"*.ps",0) ){        // Postscript file 
    1029         return strdup(GBS_global_string("Postscript: %s",ref)); 
     1032        return GBS_global_string_copy("Postscript: %s",ref); 
    10301033    } 
    10311034 
     
    10691072        } 
    10701073        else { 
    1071             char *compressed = strdup(GBS_global_string("%s.gz", help_file)); 
     1074            char *compressed = GBS_global_string_copy("%s.gz", help_file); 
    10721075 
    10731076            if (stat(compressed, &st) == 0) { // *.ps.gz exists 
  • trunk/WINDOW/AW_window.cxx

    r996 r1003  
    24562456                  (XtPointer) cbs); 
    24572457 
    2458 //     cbs->id = strdup(GBS_global_string("%s/%s",this->window_defaults_name,id)); 
    2459     cbs->id = strdup(GBS_global_string("%s",id)); 
     2458//     cbs->id = GBS_global_string_copy("%s/%s",this->window_defaults_name,id); 
     2459    cbs->id = GBS_global_string_copy("%s",id); 
    24602460    GBS_write_hash(this->get_root()->prvt->action_hash,id,(long)cbs); 
    24612461    if(!(mask&this->get_root()->global_mask)){ 
     
    28302830        path = strdup(file); 
    28312831    }else{ 
    2832         path = strdup(GBS_global_string("%s/%s",GB_getenvARBMACROHOME(),file)); 
     2832        path = GBS_global_string_copy("%s/%s",GB_getenvARBMACROHOME(),file); 
    28332833    } 
    28342834    char *macro_header = GB_read_file("$(ARBHOME)/lib/macro.head"); 
     
    28472847 
    28482848    fprintf(prvt->recording_macro_file,"%s",macro_header); 
    2849     delete macro_header; 
     2849    free(macro_header); 
    28502850    return 0; 
    28512851} 
     
    28572857    fprintf(prvt->recording_macro_file,"ARB::close($gb_main);"); 
    28582858    fclose(prvt->recording_macro_file); 
     2859 
    28592860    long mode = GB_mode_of_file(prvt->recording_macro_path); 
     2861 
    28602862    GB_set_mode_of_file(prvt->recording_macro_path,mode | ((mode >> 2)& 0111)); 
    28612863    prvt->recording_macro_file = 0; 
    2862     delete(prvt->recording_macro_path);             prvt->recording_macro_path = 0; 
    2863     delete(prvt->stop_action_name);                 prvt->stop_action_name = 0; 
    2864     delete prvt->application_name_for_macros;       prvt->application_name_for_macros = 0; 
     2864 
     2865    free(prvt->recording_macro_path); 
     2866    free(prvt->stop_action_name); 
     2867    free(prvt->application_name_for_macros); 
     2868 
     2869    prvt->recording_macro_path        = 0; 
     2870    prvt->stop_action_name            = 0; 
     2871    prvt->application_name_for_macros = 0; 
     2872 
    28652873    return 0; 
    28662874} 
     
    28712879        path = strdup(file); 
    28722880    }else{ 
    2873         path = strdup(GBS_global_string("%s/%s",GB_getenvARBMACROHOME(),file)); 
     2881        path = GBS_global_string_copy("%s/%s",GB_getenvARBMACROHOME(),file); 
    28742882    } 
    28752883    const char *com = GBS_global_string("%s/bin/perl %s &",GB_getenvARBHOME(),path); 
     
    28782886        aw_message(GBS_global_string("Calling '%s' failed",com)); 
    28792887    } 
    2880     delete path; 
     2888    free(path); 
    28812889    return 0; 
    28822890} 
     
    29742982        GBT_write_string(gb_main,awar_action,""); // this works as READY-signal for perl-client (remote_action) 
    29752983    } 
    2976     delete awar; 
    2977     delete value; 
    2978     delete action; 
     2984    free(awar); 
     2985    free(value); 
     2986    free(action); 
    29792987    return 0; 
    29802988} 
  • trunk/WINDOW/aw_color_groups.hxx

    r893 r1003  
    33//    File      : aw_color_groups.cxx                               // 
    44//    Purpose   :                                                   // 
    5 //    Time-stamp: <Fri Oct/11/2002 17:17 MET Coder@ReallySoft.de>   // 
     5//    Time-stamp: <Tue Dec/03/2002 00:24 MET Coder@ReallySoft.de>   // 
    66//                                                                  // 
    77//    Coded by Ralf Westram (coder@reallysoft.de) in June 2001      // 
     
    5050#define AW_COLOR_GROUPS      12 
    5151 
    52 GB_ERROR    AW_set_color_group(GBDATA *gbd, long color_group); 
    53 long        AW_find_color_group(GBDATA *gbd, AW_BOOL ignore_usage_flag = false); 
    54 const char *AW_get_color_group_name(AW_root *awr, int color_group); 
     52GB_ERROR  AW_set_color_group(GBDATA *gbd, long color_group); 
     53long      AW_find_color_group(GBDATA *gbd, AW_BOOL ignore_usage_flag = false); 
     54char    *AW_get_color_group_name(AW_root *awr, int color_group); 
    5555 
    5656void AW_init_color_group_defaults(const char *for_program); 
  • trunk/WINDOW/aw_window.hxx

    r961 r1003  
    424424    int         get_index_of_element(AW_selection_list *selection_list, const char *selected_element); 
    425425    const char *get_element_of_index(AW_selection_list *selection_list, int  index); 
    426     int         move_selection(AW_selection_list *selection_list, AW_awar *list_awar, int offset); 
     426 
     427    int  get_index_of_current_element(AW_selection_list *selection_list, const char *awar_name); 
     428    void select_index(AW_selection_list *selection_list, const char *awar_name, int wanted_index); 
     429    void  move_selection(AW_selection_list *selection_list, const char *awar_name, int offset); 
    427430 
    428431 
  • trunk/lib/macros/test.amc

    r546 r1003  
    1010} 
    1111 
    12 BIO::remote_action($gb_main,"ARB_NT","ARB_NT/new_arb_edit4"); 
     12BIO::remote_action($gb_main,"ARB_NT","probe_match"); 
     13BIO::remote_action($gb_main,"ARB_NT","probe_design"); 
    1314ARB::close($gb_main); 
  • trunk/lib/pictures/ad_align.fig

    r2 r1003  
    1 #FIG 2.1 
    2 80 2 
    3 2 2 0 1 -1 0 0 0 0.000 0 0 0 
    4          564 484 564 34 39 34 39 484 564 484 9999 9999 
    5 2 2 0 1 -1 0 0 0 0.000 0 0 0 
    6          549 474 549 289 54 289 54 474 549 474 9999 9999 
    7 2 2 0 1 -1 0 0 0 0.000 0 0 0 
    8          444 259 444 99 54 99 54 259 444 259 9999 9999 
    9 4 1 18 13 0 -1 0 0.00000 4 15 45 383 124 $delete 
    10 4 1 18 13 0 -1 0 0.00000 4 15 54 383 149 $rename 
    11 4 1 18 13 0 -1 0 0.00000 4 15 45 383 174 $create 
    12 4 1 18 13 0 -1 0 0.00000 4 15 37 383 199 $copy 
    13 4 1 18 13 0 -1 0 0.00000 4 15 70 383 224 $check_len 
    14 4 1 18 13 0 -1 0 0.00000 4 15 38 383 249 $align 
    15 4 2 18 14 0 -1 0 0.00000 4 16 46 322 254 $to:list 
    16 4 0 18 14 0 -1 0 0.00000 4 16 28 59 124 $list 
    17 4 0 18 13 0 -1 0 0.00000 4 15 40 54 64 $close 
    18 4 2 18 12 0 -1 0 0.00000 4 15 31 549 64 $help 
    19 4 1 18 14 0 -1 0 0.00000 4 18 77 99 94 Alignments 
    20 4 0 18 13 0 -1 0 0.00000 4 17 140 64 314 Maximum Seq. Length 
    21 4 2 18 13 0 -1 0 0.00000 4 17 26 279 319 $len 
    22 4 2 18 13 0 -1 0 0.00000 4 17 53 539 319 $aligned 
    23 4 2 18 12 0 -1 0 0.00000 4 15 45 544 464 $to:rem 
    24 4 0 18 13 0 -1 0 0.00000 4 17 118 304 314 The Sequences are 
    25 4 0 18 12 0 -1 0 0.00000 4 15 87 64 369 User Comment 
    26 4 0 18 12 0 -1 0 0.00000 4 15 30 59 394 $rem 
    27 4 0 18 13 0 -1 0 0.00000 4 15 147 304 344 Default Write Protection 
    28 4 2 18 13 0 -1 0 0.00000 4 17 56 539 349 $security 
    29 4 2 18 13 0 -1 0 0.00000 4 17 33 279 349 $type 
    30 4 0 18 13 0 -1 0 0.00000 4 15 122 64 344 Type of Sequences: 
    31 4 0 18 12 0 -1 0 0.00000 4 15 202 59 284 INFO BOX for selected ALIGNMENT 
     1#FIG 3.2 
     2Landscape 
     3Center 
     4Metric 
     5A4       
     6100.00 
     7Single 
     8-2 
     91200 2 
     102 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 0 0 5 
     11         8475 7275 8475 525 600 525 600 7275 8475 7275 
     122 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 0 0 5 
     13         8250 7125 8250 4350 825 4350 825 7125 8250 7125 
     142 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 0 0 5 
     15         6675 3900 6675 1500 825 1500 825 3900 6675 3900 
     164 1 -1 0 0 18 13 0.0000 4 195 750 5760 1875 $delete\001 
     174 1 -1 0 0 18 13 0.0000 4 195 885 5760 2250 $rename\001 
     184 1 -1 0 0 18 13 0.0000 4 195 765 5760 2625 $create\001 
     194 1 -1 0 0 18 13 0.0000 4 210 630 5760 3000 $copy\001 
     204 1 -1 0 0 18 13 0.0000 4 210 1170 5760 3375 $check_len\001 
     214 1 -1 0 0 18 13 0.0000 4 210 630 5760 3750 $align\001 
     224 2 -1 0 0 18 14 0.0000 4 195 720 4845 3825 $to:list\001 
     234 0 -1 0 0 18 14 0.0000 4 195 435 900 1875 $list\001 
     244 0 -1 0 0 18 13 0.0000 4 195 675 825 975 $close\001 
     254 2 -1 0 0 18 12 0.0000 4 180 465 8250 975 $help\001 
     264 1 -1 0 0 18 14 0.0000 4 210 1170 1500 1425 Alignments\001 
     274 0 -1 0 0 18 13 0.0000 4 210 2280 975 4725 Maximum Seq. Length\001 
     284 2 -1 0 0 18 13 0.0000 4 210 885 8100 4800 $aligned\001 
     294 2 -1 0 0 18 12 0.0000 4 165 690 8175 6975 $to:rem\001 
     304 0 -1 0 0 18 13 0.0000 4 210 1980 4575 4725 The Sequences are\001 
     314 0 -1 0 0 18 12 0.0000 4 135 1320 975 5550 User Comment\001 
     324 0 -1 0 0 18 12 0.0000 4 165 450 900 5925 $rem\001 
     334 0 -1 0 0 18 13 0.0000 4 165 2505 4575 5175 Default Write Protection\001 
     344 2 -1 0 0 18 13 0.0000 4 210 960 8100 5250 $security\001 
     354 0 -1 0 0 18 13 0.0000 4 210 2040 975 5175 Type of Sequences:\001 
     364 0 -1 0 0 18 12 0.0000 4 135 3210 900 4275 INFO BOX for selected ALIGNMENT\001 
     374 0 -1 0 0 18 13 0.0000 4 210 570 3735 5250 $type\001 
     384 0 -1 0 0 18 13 0.0000 4 195 435 3735 4800 $len\001 
  • trunk/lib/pictures/bug_report.fig

    r2 r1003  
    1 #FIG 2.1 
    2 80 2 
    3 2 1 0 1 -1 0 0 0 0.000 -1 0 0 
    4          119 24 9999 9999 
    5 2 1 0 1 -1 0 0 0 0.000 -1 0 0 
    6          479 399 9999 9999 
    7 4 0 18 13 0 -1 0 0.00000 4 15 40 129 59 $close 
    8 4 2 18 13 0 -1 0 0.00000 4 15 56 224 59 $to:close 
    9 4 0 18 13 0 -1 0 0.00000 4 14 31 409 54 $help 
    10 4 2 18 13 0 -1 0 0.00000 4 14 45 469 54 $to:help 
    11 4 1 18 12 0 -1 0 0.00000 4 15 187 299 89 Send Registration and Bugreport 
    12 4 0 18 12 0 -1 0 0.00000 4 15 84 134 119 Email Address 
    13 4 0 18 12 0 -1 0 0.00000 4 15 31 134 144 $mail 
    14 4 2 18 12 0 -1 0 0.00000 4 15 46 464 139 $to:mail 
    15 4 0 18 12 0 -1 0 0.00000 4 15 239 139 169 Bug Description / Registration Information 
    16 4 0 18 13 0 -1 0 0.00000 4 17 30 129 199 $box 
    17 4 2 18 13 0 -1 0 0.00000 4 17 68 464 359 $to:XY:box 
    18 4 2 18 12 0 -1 0 0.00000 4 15 48 194 389 $to:Y:go 
    19 4 0 18 12 0 -1 0 0.00000 4 15 33 134 389 $Y:go 
     1#FIG 3.2 
     2Landscape 
     3Center 
     4Metric 
     5A4       
     6100.00 
     7Single 
     8-2 
     91200 2 
     102 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 1 
     11         1800 375 
     122 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 1 
     13         7200 6000 
     144 0 -1 0 0 18 13 0.0000 4 195 675 1950 900 $close\001 
     154 2 -1 0 0 18 13 0.0000 4 195 960 3375 900 $to:close\001 
     164 0 -1 0 0 18 13 0.0000 4 210 570 6150 825 $help\001 
     174 2 -1 0 0 18 13 0.0000 4 210 855 7050 825 $to:help\001 
     184 2 -1 0 0 18 12 0.0000 4 165 705 6975 2100 $to:mail\001 
     194 0 -1 0 0 18 13 0.0000 4 195 495 1935 3000 $box\001 
     204 2 -1 0 0 18 13 0.0000 4 195 1140 6975 5400 $to:XY:box\001 
     214 2 -1 0 0 18 12 0.0000 4 180 735 2925 5850 $to:Y:go\001 
     224 0 -1 0 0 18 12 0.0000 4 180 495 2025 5850 $Y:go\001 
     234 0 -1 0 0 18 12 0.0000 4 180 4905 2070 2550 Text to submit (info about your system will be added!)\001 
     244 0 -1 0 0 18 12 0.0000 4 165 555 2115 1350 $what\001 
     254 0 -1 0 0 18 12 0.0000 4 165 465 1935 2160 $mail\001 
     264 0 -1 0 0 18 12 0.0000 4 135 1260 2115 1755 Email Address\001