Changeset 1003
- Timestamp:
- 04/12/02 13:52:55 (9 years ago)
- Location:
- trunk
- Files:
-
- 73 modified
-
ARBDB/ad_load.c (modified) (1 diff)
-
ARBDB/ad_lpro.h (modified) (1 diff)
-
ARBDB/ad_prot.h (modified) (1 diff)
-
ARBDB/adcompr.c (modified) (1 diff)
-
ARBDB/adseqcompr.c (modified) (1 diff)
-
ARBDB/adstring.c (modified) (2 diffs)
-
ARB_GDE/GDE.cxx (modified) (6 diffs)
-
ARB_GDE/GDE_FileIO.cxx (modified) (1 diff)
-
ARB_GDE/GDE_arbdb_io.cxx (modified) (12 diffs)
-
ARB_GDE/GDE_event.cxx (modified) (3 diffs)
-
AWT/AWT_advice.cxx (modified) (2 diffs)
-
AWT/AWT_asciiprint.cxx (modified) (1 diff)
-
AWT/AWT_config_manager.cxx (modified) (5 diffs)
-
AWT/AWT_file_selection.cxx (modified) (1 diff)
-
AWT/AWT_filter.cxx (modified) (9 diffs)
-
AWT/AWT_nds.cxx (modified) (2 diffs)
-
AWT/AWT_query_and_functions.cxx (modified) (19 diffs)
-
AWT/AWT_sel_boxes.cxx (modified) (3 diffs)
-
AWT/AWT_species_sel_box.cxx (modified) (5 diffs)
-
AWT/AWT_tables.cxx (modified) (1 diff)
-
AWT/AWT_tree.cxx (modified) (1 diff)
-
AWT/AWT_tree_cb.cxx (modified) (2 diffs)
-
AWTC/AWTC_next_neighbours.cxx (modified) (3 diffs)
-
AWTI/AWTI_import.cxx (modified) (17 diffs)
-
GDE/CORE/BasicDisplay.c (modified) (20 diffs)
-
GDE/CORE/ChooseFile.c (modified) (8 diffs)
-
GDE/CORE/EventHandler.c (modified) (1 diff)
-
GDE/CORE/FileIO.c (modified) (12 diffs)
-
GDE/CORE/Genbank.c (modified) (1 diff)
-
GDE/CORE/Makefile (modified) (1 diff)
-
GDE/CORE/ParseMenu.c (modified) (6 diffs)
-
GDE/CORE/arbdb_io.c (modified) (10 diffs)
-
GDE/CORE/defines.h (modified) (3 diffs)
-
GDE/CORE/functions.h (modified) (5 diffs)
-
GDE/CORE/main.c (modified) (4 diffs)
-
GENOM/GEN_map.cxx (modified) (2 diffs)
-
HELP_SOURCE/oldhelp/macro.hlp (modified) (2 diffs)
-
HELP_SOURCE/oldhelp/scandb.hlp (modified) (1 diff)
-
HELP_SOURCE/oldhelp/set_protection.hlp (modified) (1 diff)
-
HELP_SOURCE/oldhelp/sp_search.hlp (modified) (1 diff)
-
HELP_SOURCE/oldhelp/version.hlp (modified) (2 diffs)
-
MERGE/MG_gene_species.cxx (modified) (2 diffs)
-
MERGE/MG_species.cxx (modified) (5 diffs)
-
MULTI_PROBE/MP_noclass.cxx (modified) (1 diff)
-
Makefile (modified) (2 diffs)
-
NTREE/NT_cb.cxx (modified) (1 diff)
-
NTREE/NT_concatenate.cxx (modified) (3 diffs)
-
NTREE/NT_extern.cxx (modified) (4 diffs)
-
NTREE/ad_ali.cxx (modified) (3 diffs)
-
NTREE/ad_ext.cxx (modified) (1 diff)
-
NTREE/ad_spec.cxx (modified) (20 diffs)
-
NTREE/ad_transpro.cxx (modified) (2 diffs)
-
NTREE/ad_trees.cxx (modified) (1 diff)
-
ORS_CGI/ORS_C_html.cxx (modified) (30 diffs)
-
ORS_CGI/ORS_C_java_main.cxx (modified) (1 diff)
-
ORS_CGI/ORS_C_main.cxx (modified) (2 diffs)
-
ORS_SERVER/ORS_S_userdb.cxx (modified) (23 diffs)
-
PARSIMONY/PARS_main.cxx (modified) (1 diff)
-
PROBE_DESIGN/probe_design.cxx (modified) (2 diffs)
-
SECEDIT/SEC_graphic.cxx (modified) (5 diffs)
-
SECEDIT/secedit.hxx (modified) (4 diffs)
-
SEER/SEER_to_seer.cxx (modified) (10 diffs)
-
SOURCE_TOOLS/arb_valgrind (modified) (4 diffs)
-
WINDOW/AW_button.cxx (modified) (7 diffs)
-
WINDOW/AW_preset.cxx (modified) (2 diffs)
-
WINDOW/AW_question.cxx (modified) (2 diffs)
-
WINDOW/AW_status.cxx (modified) (5 diffs)
-
WINDOW/AW_window.cxx (modified) (7 diffs)
-
WINDOW/aw_color_groups.hxx (modified) (2 diffs)
-
WINDOW/aw_window.hxx (modified) (1 diff)
-
lib/macros/test.amc (modified) (1 diff)
-
lib/pictures/ad_align.fig (modified) (1 diff)
-
lib/pictures/bug_report.fig (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ARBDB/ad_load.c
r714 r1003 651 651 }else{ 652 652 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 654 654 } 655 655 i = fread(p,1,(size_t)memsize,in); -
trunk/ARBDB/ad_lpro.h
r832 r1003 16 16 GB_ERROR gbl_remove P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 17 17 GB_ERROR gbl_keep P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 18 GB_ERROR gbl_translate P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 18 19 GB_ERROR gbl_echo P_((GBDATA *gb_species, char *com, int argcinput, GBL *argvinput, int argcparam, GBL *argvparam, int *argcout, GBL **argvout)); 19 20 GB_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 23 23 void GB_clear_error P_((void)); 24 24 GB_CSTR GBS_global_string P_((const char *templat, ...)); 25 char *GBS_global_string_copy P_((const char *templat, ...)); 25 26 char *GBS_string_2_key_with_exclusions P_((const char *str, const char *additional)); 26 27 char *GBS_string_2_key P_((const char *str)); -
trunk/ARBDB/adcompr.c
r887 r1003 559 559 dest = buffer = GB_give_other_buffer((char *)source,size); 560 560 561 #if defined(DEBUG) 562 printf("gb_uncompress_equal_bytes(size=%li):\n", size); 563 #endif /* DEBUG */ 564 561 565 for (i=size;i;) { 562 566 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 */ 564 571 if (j>i) j=i; 565 572 i -= j; -
trunk/ARBDB/adseqcompr.c
r655 r1003 335 335 seqs = (GB_Sequence *)GB_calloc(sizeof(GB_Sequence),leafcount); 336 336 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); 338 338 old_gb_master_ali = GB_search( gb_main, masterfoldername,GB_FIND); 339 339 free(masterfoldername); 340 340 { 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); 343 343 GBDATA *gb_master_data = gb_search( gb_main, master_data_name,GB_CREATE_CONTAINER,1); 344 344 gb_master_ali = gb_create_container( gb_master_data, master_name); /* create a master container always, -
trunk/ARBDB/adstring.c
r996 r1003 307 307 /* } */ 308 308 309 static char *gb_global_string = 0; 309 /* static char *gb_global_string = 0; */ 310 311 312 313 314 static 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 } 310 339 311 340 GB_CSTR GBS_global_string(const char *templat, ...) 312 341 { 313 char buffer[GBS_GLOBAL_STRING_SIZE+2];314 #ifndef LINUX315 int psize;316 #endif317 342 va_list parg; 343 GB_CSTR result; 344 318 345 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 352 char *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); 333 362 } 334 363 … … 902 931 void GBS_strnprintf(void *strstruct, long len, const char *templat, ...){ 903 932 struct GBS_strstruct *strstr = (struct GBS_strstruct *)strstruct; 904 char *buffer; 933 char *buffer; 934 int psize; 935 905 936 va_list parg; 906 937 va_start(parg,templat); 907 938 gbs_strensure_mem(strstruct,len+2); 939 908 940 buffer = strstr->GBS_strcat_data+strstr->GBS_strcat_pos; 941 909 942 #ifdef LINUX 910 vsnprintf(buffer,len,templat,parg);943 psize = vsnprintf(buffer,len,templat,parg); 911 944 #else 912 vsprintf(buffer,templat,parg);945 psize = vsprintf(buffer,templat,parg); 913 946 #endif 947 if (psize == -1 || psize>len) { 948 ad_assert(0); 949 GB_CORE; 950 } 951 914 952 strstr->GBS_strcat_pos += strlen(buffer); 915 953 } -
trunk/ARB_GDE/GDE.cxx
r989 r1003 72 72 { 73 73 awr->awar("tmp/gde/helptext")->write_string(helptext); 74 delete helptext;74 free(helptext); 75 75 } 76 76 else awr->awar("tmp/gde/helptext")->write_string("can not find help file\0"); … … 104 104 105 105 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); 109 109 110 110 return(strdup(name)); … … 284 284 GDE_create_infieldwithpm(aws,newawar,SLIDERWIDTH); 285 285 // maybe bound checking // 286 delete newawar;286 free(newawar); 287 287 } 288 288 else if(itemarg.type==CHOOSER) { … … 316 316 free(curr_value); 317 317 aws->update_toggle_field(); 318 delete newawar;318 free(newawar); 319 319 } 320 320 else if(itemarg.type==CHOICE_MENU) { … … 335 335 free(curr_value); 336 336 aws->update_option_menu(); 337 delete newawar;337 free(newawar); 338 338 } 339 339 else if(itemarg.type==TEXTFIELD) { … … 343 343 aws->label(AWinfo->gmenuitem->arg[i].label); 344 344 aws->create_input_field(newawar,itemarg.textwidth/*TEXTFIELDWIDTH*/); 345 delete newawar;345 free(newawar); 346 346 } 347 347 else if(itemarg.type==CHOICE_TREE) { -
trunk/ARB_GDE/GDE_FileIO.cxx
r655 r1003 94 94 char *Realloc(char *block,int size) 95 95 { 96 char *temp;96 char *temp; 97 97 #ifdef SeeAlloc 98 extern int TotalRealloc;98 extern int TotalRealloc; 99 99 TotalRealloc += size; 100 100 fprintf(stderr,"Realloc %d\n",TotalRealloc); 101 101 #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 104 105 return(temp); 105 106 } -
trunk/ARB_GDE/GDE_arbdb_io.cxx
r655 r1003 45 45 dataset->element = (NA_Sequence *) 46 46 Realloc((char *)dataset->element, 47 dataset->maxnumelements * sizeof(NA_Sequence));47 dataset->maxnumelements * sizeof(NA_Sequence)); 48 48 } 49 49 return curelem; … … 53 53 54 54 int 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) 56 56 { 57 57 GBDATA *gb_name; … … 65 65 if(filter==0) 66 66 { 67 filter = new AP_filter;68 filter->init(maxalignlen);69 newfiltercreated=1;67 filter = new AP_filter; 68 filter->init(maxalignlen); 69 newfiltercreated=1; 70 70 }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 } 76 76 } 77 77 … … 79 79 // sequences may have different length 80 80 { 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 } 85 85 } 86 86 … … 89 89 if(compress==2) // compress all gaps and filter positions 90 90 { 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 } 104 104 }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 exceeded113 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 sequences135 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 } 142 142 } 143 143 144 144 { 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 deletestring;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); 154 154 155 155 long number=0; … … 157 157 158 158 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 } 209 210 } 210 211 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 } 246 247 } 247 248 248 249 { 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); 253 254 } 254 255 { 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); 261 262 } 262 263 if(newfiltercreated) delete filter; … … 279 280 uchar **the_names; 280 281 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); 283 284 284 285 gde_assert((the_species==0) != (the_names==0)); … … 366 367 } 367 368 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); 375 375 376 376 return 0; … … 407 407 this_elem->gb_species = 408 408 GBT_create_species_rel_species_data(gb_species_data, 409 this_elem->short_name);409 this_elem->short_name); 410 410 } 411 411 } 412 412 gb_data = GBT_add_data(this_elem->gb_species,aln->alignment_name, "data", GB_STRING); 413 413 buffer = (char *) calloc(sizeof(char), 414 this_elem->seqlen + this_elem->offset+1);414 this_elem->seqlen + this_elem->offset+1); 415 415 for (k = 0; k < this_elem->seqlen + this_elem->offset; k++) { 416 416 buffer[k] = this_elem->tmatrix[getelem(this_elem, k)]; … … 432 432 433 433 /*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 }*/ 438 438 439 439 … … 445 445 switch(a->elementtype) 446 446 { 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('-'); 457 457 } 458 458 else … … 505 505 { 506 506 temp =(NA_Base*)Calloc(a->seqmaxlen+a->offset-b, 507 sizeof(NA_Base));507 sizeof(NA_Base)); 508 508 switch (a->elementtype) 509 509 { 510 510 /* 511 * Pad out with gap characters fron the point of insertion to the offset512 */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; 531 531 } 532 532 -
trunk/ARB_GDE/GDE_event.cxx
r791 r1003 346 346 delete DataSet->alignment_name; 347 347 DataSet->alignment_name = GBT_get_default_alignment(DataSet->gb_main); 348 delete alignment_name;348 free(alignment_name); 349 349 alignment_name = strdup(DataSet->alignment_name); 350 350 … … 485 485 startaction_end: 486 486 aw_closestatus(); 487 delete alignment_name;487 free(alignment_name); 488 488 delete filter2; 489 delete filter_name;489 free(filter_name); 490 490 491 491 GDE_freeali(DataSet); 492 delete DataSet;492 free(DataSet); 493 493 DataSet=0; 494 494 DataSet = (NA_Alignment *) Calloc(1,sizeof(NA_Alignment)); … … 625 625 } 626 626 } 627 delete textvalue;628 delete method;627 free(textvalue); 628 free(method); 629 629 return(Action); 630 630 } -
trunk/AWT/AWT_advice.cxx
r743 r1003 3 3 // File : awt_advice.cpp // 4 4 // 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> // 6 6 // // 7 7 // // … … 91 91 char *disabled_list = var->read_string(); 92 92 bool is_disabled = strstr(disabled_list, GBS_global_string(";%s;", id)) != 0; 93 delete disabled_list;93 free(disabled_list); 94 94 return is_disabled; 95 95 } -
trunk/AWT/AWT_asciiprint.cxx
r361 r1003 252 252 } 253 253 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); 259 256 delete header; 260 257 } -
trunk/AWT/AWT_config_manager.cxx
r927 r1003 3 3 // File : AWT_config_manager.cxx // 4 4 // Purpose : // 5 // Time-stamp: <T hu Nov/07/2002 19:55MET Coder@ReallySoft.de> //5 // Time-stamp: <Tue Dec/03/2002 19:16 MET Coder@ReallySoft.de> // 6 6 // // 7 7 // // … … 102 102 // --------------------------------------------------------- 103 103 static 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; 105 112 } 106 113 … … 114 121 config->get_awar_value("current"); // create! 115 122 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,C ANCEL,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); 119 126 int button = aw_string_selection_button(); 120 127 string awar_name = string("cfg_")+result; … … 132 139 else existing_configs = result; 133 140 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); 135 144 config->set_awar_value("current", result); 136 145 config->set_awar_value("existing", existing_configs); 146 reopen = true; 137 147 break; 138 148 } … … 146 156 break; 147 157 } 148 case 3: { // C ANCEL158 case 3: { // CLOSE 149 159 break; 150 160 } -
trunk/AWT/AWT_file_selection.cxx
r947 r1003 258 258 } 259 259 else { 260 char *mask = strdup(GBS_global_string("*%s", filter));260 char *mask = GBS_global_string_copy("*%s", filter); 261 261 awt_fill_selection_box_recursive(fulldir, strlen(fulldir)+1, mask, false, cbs->show_dir, cbs->aws, cbs->id); 262 262 free(mask); -
trunk/AWT/AWT_filter.cxx
r525 r1003 1 1 #include <stdio.h> 2 #include <stdlib.h> 2 3 #include <string.h> 3 4 #include <arbdb.h> … … 113 114 delete data; 114 115 } 115 delete to_free_target;116 delete use;116 free(to_free_target); 117 free(use); 117 118 GB_pop_transaction(cbs->gb_main); 118 119 } … … 144 145 char *str; 145 146 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); 147 148 }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); 149 150 } 150 151 char *target = (char *)GBS_global_string("%c%s%c%s",tpre,GB_read_key_pntr(gb_data),1,name); … … 188 189 awt_create_select_filter_window_aw_cb(0,cbs); 189 190 GB_pop_transaction(cbs->gb_main); 190 delete use;191 free(use); 191 192 } 192 193 … … 240 241 char *fname = aw_root->awar(acbs->def_name)->read_string(); 241 242 const char *fsname = GBS_global_string(" data%c%s",1,fname); 242 delete fname;243 free(fname); 243 244 aw_root->awar(acbs->def_subname)->write_string(fsname); // cause an callback 244 245 } … … 288 289 289 290 char *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"; 292 293 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; 298 299 299 300 for (count = 1; ; ++count) { … … 305 306 306 307 AW_awar *awar_found = aw_root->awar_no_error(awar_name); 307 delete awar_name;308 delete [] awar_name; 308 309 309 310 if (!awar_found) break; // no more filters defined … … 311 312 312 313 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); 314 315 sprintf(new_combined_name, "%s/%s", combined_name, content); 315 delete combined_name;316 free(combined_name); 316 317 combined_name = new_combined_name; 317 318 } … … 388 389 char *use = aw_root->awar(acbs->def_alignment)->read_string(); 389 390 len = GBT_get_alignment_len(acbs->gb_main,use); 390 delete use;391 free(use); 391 392 filter->init(filter_string,"0",len); 392 393 393 394 int sim = aw_root->awar(acbs->def_simplify)->read_int(); 394 395 filter->enable_simplify((AWT_FILTER_SIMPLIFY)sim); 395 delete filter_string;396 free(filter_string); 396 397 397 398 GB_pop_transaction(acbs->gb_main); -
trunk/AWT/AWT_nds.cxx
r889 r1003 173 173 aw_root->awar(AWAR_SELECT_ACISRT)->write_string(str); 174 174 } 175 delete str;175 free(str); 176 176 } 177 177 void AWT_create_select_srtaci_window(AW_window *aww,AW_CL awar_acisrt,AW_CL awar_short) … … 202 202 char *filename = AWT_unfold_path("lib/sellists/srt_aci*.sellst","ARBHOME"); 203 203 GB_ERROR error = aws->load_selection_list(id,filename); 204 delete filename;204 free(filename); 205 205 if (error) aw_message(error); 206 206 -
trunk/AWT/AWT_query_and_functions.cxx
r998 r1003 657 657 } 658 658 } 659 delete data;659 free(data); 660 660 } 661 661 } … … 701 701 // GBS_free_hash(hash); 702 702 703 delete key;703 free(key); 704 704 awt_query_update_list(0,cbs); 705 705 } … … 769 769 if (aw_message(AW_ERROR_BUFFER,"Create Field (Type STRING),Cancel")){ 770 770 GB_abort_transaction(cbs->gb_main); 771 delete command;772 delete key;771 free(command); 772 free(key); 773 773 return; 774 774 } … … 802 802 long use_tag = cbs->aws->get_root()->awar(cbs->awar_use_tag)->read_int(); 803 803 if (!use_tag || !strlen(tag)) { 804 delete tag;804 free(tag); 805 805 tag = 0; 806 806 } … … 855 855 if (!parsed) { 856 856 error = GB_get_error(); 857 delete str;857 free(str); 858 858 break; 859 859 } 860 860 if (!strcmp(parsed,str)){ // nothing changed 861 delete str;862 delete parsed;861 free(str); 862 free(parsed); 863 863 continue; 864 864 } … … 875 875 } 876 876 } 877 delete str;878 delete parsed;877 free(str); 878 free(parsed); 879 879 } 880 880 } … … 949 949 aw_closestatus(); 950 950 delete tag; 951 delete deftag;951 free(deftag); 952 952 } 953 953 … … 958 958 GB_commit_transaction(cbs->gb_main); 959 959 } 960 delete key;961 delete command;960 free(key); 961 free(command); 962 962 } 963 963 … … 971 971 GB_transaction valid_transaction(cbs->gb_main); 972 972 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); 975 975 } 976 976 aw_root->awar(cbs->awar_parskey)->write_string( kv); 977 if (kv != str) delete kv;977 if (kv != str) free(kv); 978 978 aw_root->awar(cbs->awar_parsvalue)->write_string( brk); 979 979 }else{ 980 980 aw_root->awar(cbs->awar_parsvalue)->write_string( str); 981 981 } 982 delete str;982 free(str); 983 983 } 984 984 … … 1116 1116 1117 1117 { 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); 1120 1120 1121 1121 aws->init( aw_root, macro_name, window_name, 300, 0 ); … … 1231 1231 1232 1232 { 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); 1235 1235 1236 1236 aws->init( aw_root, macro_name, window_name, 600, 0 ); … … 1289 1289 1290 1290 GB_ERROR error = filename ? aws->load_selection_list(id,filename) : "No default selection list for query-type"; 1291 delete filename;1291 free(filename); 1292 1292 if (error) { 1293 1293 aw_message(error); … … 1313 1313 char *value = cbs->aws->get_root()->awar(cbs->awar_setvalue)->read_string(); 1314 1314 if (!strlen(value)) { 1315 delete value;1315 free(value); 1316 1316 value = 0; 1317 1317 } … … 1325 1325 aw_message(); 1326 1326 delete value; 1327 delete key;1327 free(key); 1328 1328 GB_commit_transaction(cbs->gb_main); 1329 1329 return; … … 1353 1353 char *v = GBS_strclose(strstr,0); 1354 1354 error = GB_write_as_string(gb_new,v); 1355 delete v;1355 free(v); 1356 1356 }else{ 1357 1357 char *name = GBT_read_string(gb_item,"name"); 1358 1358 error = GB_export_error("Field '%s' of %s '%s' has incombatible type", key, cbs->selector->item_name, name); 1359 delete name;1359 free(name); 1360 1360 } 1361 1361 }else{ … … 1427 1427 GB_commit_transaction(cbs->gb_main); 1428 1428 } 1429 delete key;1430 delete value;1429 free(key); 1430 free(value); 1431 1431 } 1432 1432 … … 1522 1522 GB_commit_transaction(cbs->gb_main); 1523 1523 } 1524 delete key;1524 free(key); 1525 1525 } 1526 1526 … … 1841 1841 1842 1842 { 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); 1844 1844 AW_awar *awar = aw_root->awar_string( this_awar_name, "", AW_ROOT_DEFAULT); 1845 1845 … … 1961 1961 } 1962 1962 1963 free(Items); 1964 1963 1965 query_id++; 1964 1966 GB_pop_transaction(gb_main); -
trunk/AWT/AWT_sel_boxes.cxx
r989 r1003 43 43 cbs->aws->insert_selection( cbs->id, alignment_name, alignment_name ); 44 44 } 45 delete str;46 delete alignment_type;47 delete alignment_name;45 free(str); 46 free(alignment_type); 47 free(alignment_name); 48 48 } 49 49 cbs->aws->insert_default_selection( cbs->id, "????", "????" ); … … 675 675 676 676 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); 678 678 char *mn = awt_get_selected_fullname(awr, AWAR_MACRO_BASE); 679 679 error = awr->start_macro_recording(mn,application_name_for_macros,sac); … … 708 708 // path = strdup(mn); 709 709 // }else{ 710 // path = strdup(GBS_global_string("%s/%s",GB_getenvARBMACROHOME(),mn));710 // path = GBS_global_string_copy("%s/%s",GB_getenvARBMACROHOME(),mn); 711 711 // } 712 712 char *path = awt_get_selected_fullname(aww->get_root(), AWAR_MACRO_BASE); -
trunk/AWT/AWT_species_sel_box.cxx
r989 r1003 478 478 char *value = cbs->aws->get_root()->awar(cbs->def_dest)->read_string(); 479 479 int vlen = strlen(value); 480 while (v alue[vlen-1] == '\n') vlen--; // remove trailing newlines480 while (vlen>0 && value[vlen-1] == '\n') vlen--; // remove trailing newlines 481 481 value[vlen] = 0; 482 482 // read the value from the window … … 484 484 GB_ERROR error = 0; 485 485 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 490 488 cbs->aws->get_root()->awar(cbs->def_dest)->write_string(""); 491 489 } 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 493 500 GBDATA *gb_key_name; 494 char *key_name = 0;501 char *key_name = 0; 495 502 if (awt_check_scanner_key_data(cbs,gbd)) { // not exist, create new element 496 503 gb_key_name = GB_find(gbd,CHANGEKEY_NAME,0,down_level); … … 510 517 } else { // change old element 511 518 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 } 526 536 } 527 537 }else{ … … 549 559 GB_commit_transaction(cbs->gb_main); 550 560 } 551 delete value;561 free(value); 552 562 } 553 563 /********************* get the container of a species key description ***************/ … … 828 838 memcpy(p,data,ssize); 829 839 p[ssize] = 0; 830 delete data;840 free(data); 831 841 } 832 842 cbs->aws->insert_selection( cbs->id, buffer, (long)gbd ); -
trunk/AWT/AWT_tables.cxx
r832 r1003 219 219 table_name = strdup(itable_name); 220 220 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); 227 227 228 228 awr->awar_string(awar_field_reorder_source,""); -
trunk/AWT/AWT_tree.cxx
r989 r1003 83 83 AP_filter::~AP_filter(void){ 84 84 delete bootstrap; 85 delete filter_mask;85 delete [] filter_mask; 86 86 delete filterpos_2_seqpos; 87 87 } -
trunk/AWT/AWT_tree_cb.cxx
r989 r1003 228 228 229 229 if (i) { 230 c onst 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); 231 231 sprintf(entry_buf, "%s '%s'", entry_prefix, color_group_name); 232 free(color_group_name); 232 233 } 233 234 else { … … 346 347 347 348 if (i) { 348 c onst 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); 349 350 sprintf(entry_buf, "group '%s'", color_group_name); 351 free(color_group_name); 350 352 } 351 353 else { -
trunk/AWTC/AWTC_next_neighbours.cxx
r2 r1003 22 22 23 23 AWTC_FIND_FAMILY_MEMBER::~AWTC_FIND_FAMILY_MEMBER(){ 24 delete name;24 free(name); 25 25 } 26 26 … … 117 117 */ 118 118 119 if (aisc_put(link, PT_LOCS, locs, 119 if (aisc_put(link, PT_LOCS, locs, 120 120 LOCS_FIND_TYPE, find_type, 121 121 LOCS_FIND_FAMILY, &bs,0)){ … … 134 134 fl->next = family_list; 135 135 family_list = fl; 136 136 137 137 aisc_get(link, PT_FAMILYLIST, f_list, 138 138 FAMILYLIST_NAME,&fl->name, -
trunk/AWTI/AWTI_import.cxx
r989 r1003 103 103 struct input_format_struct *ifo; 104 104 struct input_format_per_line *pl = 0; 105 ifo = awtcig.ifo = new input_format_struct;106 105 char *s1 = 0,*s2=0; 106 107 if (awtcig.ifo) { delete awtcig.ifo; awtcig.ifo = 0; } 108 ifo = awtcig.ifo = new input_format_struct; 107 109 108 110 while (!awtc_read_string_pair(in,s1,s2)){ … … 173 175 } 174 176 177 free(s2); 178 free(s1); 179 175 180 fclose(in); 176 181 return 0; … … 207 212 free(ifo->sequenceaci); 208 213 free(ifo->end); 209 delete ifo->b1;210 delete ifo->b2;214 free(ifo->b1); 215 free(ifo->b2); 211 216 } 212 217 … … 249 254 buffer[size] = 0; 250 255 if (!GBS_string_cmp(buffer,autodetect,0)){ // format found 251 delete autodetect;256 free(autodetect); 252 257 break; 253 258 } … … 290 295 delete sys; continue; 291 296 } 292 delete sys;297 free(sys); 293 298 origin_file_name = mid_file_name; 294 299 }else{ … … 455 460 char *nstr = GBT_create_unique_species_name(awtcig.gb_main,str); 456 461 GB_write_string(gbk,nstr); 457 delete nstr;462 free(nstr); 458 463 }else{ 459 464 GB_write_string(gbk,str); … … 465 470 strin = GB_read_char_pntr(gbk); 466 471 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); 469 474 470 475 if (tag) { 471 char *regexp = (char*)GB_calloc(sizeof(char), taglen+ 1);476 char *regexp = (char*)GB_calloc(sizeof(char), taglen+3); 472 477 sprintf(regexp, "*[%s]*", tag); 473 478 … … 604 609 dup = dele; 605 610 dele = s = GB_command_interpreter(GB_MAIN, s,expanded.c_str(),gb_species); 606 delete dup;611 free(dup); 607 612 if (!s) return GB_get_error(); 608 613 } … … 639 644 variables[pl->setvar[0]] = s; 640 645 } 641 delete dele;646 free(dele); 642 647 } 643 648 } … … 671 676 char *h = GBS_string_eval(sequence,ifo->sequencesrt,gb_species); 672 677 if (!h) return GB_get_error(); 673 delete sequence;678 free(sequence); 674 679 sequence = h; 675 680 } … … 678 683 char *h = GB_command_interpreter(GB_MAIN, 679 684 sequence,ifo->sequenceaci,gb_species); 680 delete sequence;685 free(sequence); 681 686 if (!h) return GB_get_error(); 682 687 sequence = h; … … 694 699 GB_write_string(gb_acc,buf); 695 700 } 696 delete sequence;701 free(sequence); 697 702 } 698 703 while (1){ // go to the start of an species … … 761 766 char *ali = awr->awar(AWAR_ALI)->read_string(); 762 767 ali_name = GBS_string_eval(ali,"*=ali_*1:ali_ali_=ali_",0); 763 delete ali;768 free(ali); 764 769 } 765 770 … … 776 781 GBT_create_alignment(GB_MAIN,ali_name,2000,0,4,ali_type); 777 782 } 778 delete ali_type;783 free(ali_type); 779 784 } 780 785 int toggle_value = (awr->awar(AWAR_READ_GENOM_DB)->read_int()); … … 813 818 char *f = awr->awar(AWAR_FILE)->read_string(); 814 819 awtcig.filenames = GBS_read_dir(f,0); 815 delete f;820 free(f); 816 821 817 822 if (awtcig.filenames[0] == 0){ … … 847 852 } 848 853 } 849 delete ali_name;854 free(ali_name); 850 855 851 856 if (error) { … … 907 912 } 908 913 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) { 910 917 awr->awar(AWAR_ALI)->write_string("ali_16s"); 911 918 awr->awar(AWAR_ALI_TYPE)->write_string("rna"); 912 919 } 913 920 awr->awar_string(AWAR_FORM"/filter",".ift"); 921 922 free(ali); 914 923 } 915 924 } -
trunk/GDE/CORE/BasicDisplay.c
r655 r1003 22 22 extern int num_menus; 23 23 24 Panel menubar = NULL;24 Panel menubar = 0; 25 25 26 26 /* … … 38 38 extern Frame frame; 39 39 40 QuitGDE()40 int QuitGDE() 41 41 { 42 42 extern Frame frame; … … 52 52 } 53 53 54 QuitGDE_update(Panel_item item, Event *event)54 int QuitGDE_update(Panel_item item, Event *event) 55 55 { 56 56 Updata_Arbdb(item,event); 57 QuitGDE();57 return QuitGDE(); 58 58 } 59 59 … … 61 61 NA_Alignment *DataSet; 62 62 { 63 int i,j,k; 64 65 if(menubar == NULL) 63 /* int i,j,k; */ 64 int j; 65 66 if (!menubar) 66 67 { 67 68 menubar = xv_create(frame,PANEL, … … 86 87 */ 87 88 MakeNAADisplay(); 88 return ;89 return menubar; 89 90 } 90 91 … … 126 127 */ 127 128 128 GenMenu(type)129 void GenMenu(type) 129 130 int type; 130 131 { 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*/; 133 134 extern Gmenu menu[]; 134 135 extern Frame frame; … … 142 143 { 143 144 thismenu = &(menu[curmenu]); 144 thismenu->X = xv_create( NULL,MENU,0);145 thismenu->X = xv_create(0,MENU,0); 145 146 if(strcmp(thismenu->label,"File")==0) 146 147 { … … 301 302 */ 302 303 303 MakeNAADisplay()304 void MakeNAADisplay() 304 305 { 305 306 extern Panel menubar; … … 307 308 extern Frame frame; 308 309 extern Canvas EditCan; 309 extern NA_Alignment *DataSet; 310 /* extern NA_Alignment *DataSet; */ 310 311 extern Xv_singlecolor Default_Colors[]; 311 312 Scrollbar hscroll,vscroll; … … 421 422 422 423 423 if(colmap == NULL)424 colmap = (Cms)xv_create( NULL,CMS,424 if(colmap == 0) 425 colmap = (Cms)xv_create(0,CMS, 425 426 CMS_TYPE,XV_STATIC_CMS, 426 427 CMS_SIZE,16, … … 466 467 gcv.font = (Font)xv_get(font,XV_XID); 467 468 468 if(gcv.font != NULL)469 if(gcv.font != 0) 469 470 XChangeGC(dpy,gc,GCFont,&gcv); 470 471 … … 506 507 507 508 extern Frame frame; 508 extern int Default_Color_LKUP[]; 509 extern DisplayAttr; 509 /* extern int Default_Color_LKUP[]; */ 510 /* extern DisplayAttr; */ 510 511 511 512 int reset_all; … … 603 604 604 605 605 DummyRepaint(can,win,dpy,xwin,area)606 Canvascan;607 Xv_windowwin;608 Display*dpy;609 Windowxwin;610 Xv_xrectlist *area;606 int DummyRepaint(can,win,dpy,xwin,area) 607 Canvas can; 608 Xv_window win; 609 Display *dpy; 610 Window xwin; 611 Xv_xrectlist *area; 611 612 { 612 613 DrawNANames(dpy,xwin); … … 614 615 } 615 616 616 DrawNANames(dpy,xwin)617 Display *dpy;618 Windowxwin;617 int DrawNANames(dpy,xwin) 618 Display *dpy; 619 Window xwin; 619 620 { 620 621 extern NA_Alignment *DataSet; … … 623 624 NA_Alignment *aln; 624 625 NA_Sequence *element; 625 int maxseq,minseq,maxnoseq, i,j;626 int maxseq,minseq,maxnoseq,/*i,*/j; 626 627 unsigned long *pixels; 627 628 char buffer[GBUFSIZ]; … … 677 678 678 679 679 RepaintNACan(can,win,dpy,xwin,area)680 Canvascan;681 Xv_windowwin;682 Display*dpy;683 Windowxwin;684 Xv_xrectlist *area;680 int RepaintNACan(can,win,dpy,xwin,area) 681 Canvas can; 682 Xv_window win; 683 Display *dpy; 684 Window xwin; 685 Xv_xrectlist *area; 685 686 { 686 687 extern NA_Alignment *DataSet; … … 697 698 gc = DefaultGC(dpy,scrn); 698 699 699 if(DataSet == NULL || can == NULL)700 return XV_OK;700 if(DataSet == 0 || can == 0) 701 return XV_OK; 701 702 702 703 NAdd = (NA_DisplayData*)(DataSet)->na_ddata; 703 704 if(NAdd == NULL) 704 return XV_OK;705 return XV_OK; 705 706 for(;xv_get(can,CANVAS_RETAINED)==TRUE;) 706 707 xv_set(can,CANVAS_RETAINED,FALSE,0); … … 795 796 (void)window_fit(EditNameCan); 796 797 (void)window_fit(frame); 797 return ;798 return XV_OK; 798 799 } 799 800 800 801 extern NA_Alignment *DataSet; 801 802 802 SetNACursor(NAdd,can,win,xwin,dpy,gc)803 NA_DisplayData *NAdd;804 Canvascan;805 Xv_windowwin;806 Windowxwin;807 Display*dpy;808 GCgc;809 { 810 extern int repeat_cnt,EditMode ,SCALE;811 extern Panel_item left_foot ,right_foot;803 void 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*/; 812 813 extern Frame frame; 813 814 … … 868 869 869 870 870 UnsetNACursor(NAdd,can,win,xwin,dpy,gc)871 NA_DisplayData *NAdd;872 Canvascan;873 Xv_windowwin;874 Windowxwin;875 Display*dpy;876 GCgc;877 { 878 NA_DisplayData *ddata; 871 void 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; */ 879 880 NA_Alignment *aln; 880 Scrollbar vscroll= NULL,hscroll=NULL;881 Scrollbar vscroll=0,hscroll=0; 881 882 Xv_window view; 882 extern int SCALE; 883 /* extern int SCALE; */ 883 884 int x,y,xx,yy,j; 884 885 … … 911 912 912 913 913 ResizeNACan(canvas,wd,ht)914 Canvas canvas;915 intwd,ht;914 int ResizeNACan(canvas,wd,ht) 915 Canvas canvas; 916 int wd,ht; 916 917 { 917 918 int dy; -
trunk/GDE/CORE/ChooseFile.c
r2 r1003 5 5 Woese. 6 6 */ 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. 10 10 ** "Open" descends down into a directory, or chooses a file (depending ** on what is selected). The user may also press return after choosing 11 11 ** 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. 13 13 ** "Cancel" cancels the operation. 14 14 ** The user may also type a directory into the "Directory:" field. When the … … 182 182 XSetForeground(display,fl_gc,BlackPixel(display,DefaultScreen(display))); 183 183 XSetBackground(display,fl_gc,WhitePixel(display,DefaultScreen(display))); 184 184 185 185 186 186 /* set up the extra trailing node for the linked list, makes insertion … … 331 331 FILE *file; 332 332 char *buf; 333 { 333 { 334 334 int ic; 335 335 int i = 0; 336 336 337 while (((ic=getc(file)) != EOF) && ((char)ic != '\n')) 337 while (((ic=getc(file)) != EOF) && ((char)ic != '\n')) 338 338 buf[i++]= (char)ic; 339 339 buf[i] = '\0'; 340 340 } 341 341 342 int fl_make_list() 342 int fl_make_list() 343 343 /* Creates a list of files, out of the current working directory. It then 344 344 ** tells the file list canvas to refresh itself. The list sits attached to … … 349 349 int i, list_len, cur_pos; 350 350 char dirname[GBUFSIZ], tempbuf[GBUFSIZ]; 351 NameData *current, *temp; /* structures for reading 351 NameData *current, *temp; /* structures for reading 352 352 ** and sorting file names */ 353 353 int notdone; … … 526 526 xwin = (Window)xv_get(paint_window, XV_XID); 527 527 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 529 529 ** smallest rectangle that encloses all of the destroyed areas, the 530 530 ** rl_bound rectangle */ … … 581 581 { 582 582 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, 584 584 ** we just ignore it. this avoids wierd stuff, like being 585 585 ** able to pick files that aren't shown on screen */ … … 611 611 } 612 612 } 613 /* user may have pressed return, then just call the open button 613 /* user may have pressed return, then just call the open button 614 614 ** 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 617 617 ** just in case it ever does, we include it. */ 618 618 else if((event_is_ascii(event))&&(event_action(event) == '\r')) … … 629 629 Notify_value 630 630 fl_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 632 632 ** linked list of file names, and sets the Frame variable (getframe) to null */ 633 633 Notify_client client; -
trunk/GDE/CORE/EventHandler.c
r655 r1003 36 36 { 37 37 38 int i,j, k,curmenu,curitem;38 int i,j,/*k,*/curmenu,curitem; 39 39 Gmenu *thismenu; 40 40 GmenuItem *thisitem; 41 Panel choice; 41 /* Panel choice; */ 42 42 char *label1; 43 43 -
trunk/GDE/CORE/FileIO.c
r655 r1003 28 28 extern char FileName[]; 29 29 30 LoadData(filename)30 void LoadData(filename) 31 31 char *filename; 32 32 { … … 111 111 */ 112 112 113 LoadFile(filename,dataset,type,format)114 char*filename;115 NA_Alignment *dataset;116 inttype,format;113 void LoadFile(filename,dataset,type,format) 114 char *filename; 115 NA_Alignment *dataset; 116 int type,format; 117 117 { 118 118 extern int DataType; … … 157 157 158 158 /* 159 * Print error message, and die160 */161 ErrorOut(code,string)162 intcode;163 char *string;159 * Print error message, and die 160 */ 161 void ErrorOut(code,string) 162 int code; 163 const char *string; 164 164 { 165 165 if (code == 0) … … 178 178 int count,size; 179 179 { 180 char *temp;180 char *temp; 181 181 #ifdef SeeAlloc 182 extern int TotalCalloc;182 extern int TotalCalloc; 183 183 TotalCalloc += count*size; 184 184 fprintf(stderr,"Calloc %d %d\n",count*size,TotalCalloc); 185 185 #endif 186 temp = calloc(count,size);187 ErrorOut(temp ,"Cannot allocate memory");186 temp = calloc(count,size); 187 ErrorOut(temp == 0,"Cannot allocate memory"); 188 188 return(temp); 189 189 } … … 193 193 int size; 194 194 { 195 char *temp;195 char *temp; 196 196 #ifdef SeeAlloc 197 extern int TotalRealloc;197 extern int TotalRealloc; 198 198 TotalRealloc += size; 199 199 fprintf(stderr,"Realloc %d\n",TotalRealloc); 200 200 #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"); 203 203 return(temp); 204 204 } 205 205 206 Cfree(block)206 void Cfree(block) 207 207 char* block; 208 208 { 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"); 216 211 } 217 212 … … 232 227 233 228 234 FindType(name,dtype,ftype)229 int FindType(name,dtype,ftype) 235 230 char *name; 236 231 int *dtype,*ftype; … … 303 298 } 304 299 305 AppendNA(buffer,len,seq)300 void AppendNA(buffer,len,seq) 306 301 NA_Base *buffer; 307 302 int len; … … 309 304 { 310 305 int curlen=0,j; 311 NA_Base *temp; 306 /* NA_Base *temp; */ 312 307 313 308 if(seq->seqlen+len >= seq->seqmaxlen) … … 333 328 } 334 329 335 Ascii2NA(buffer,len,matrix)336 char *buffer;337 intlen;338 intmatrix[16];330 void Ascii2NA(buffer,len,matrix) 331 char *buffer; 332 int len; 333 int matrix[16]; 339 334 { 340 335 /* … … 342 337 * encode the buffer. 343 338 */ 344 register i ;339 register int i; 345 340 if(matrix != NULL) 346 341 for(i=0;i<len;i++) … … 350 345 351 346 WriteNA_Flat(aln,filename,method,maskable) 352 NA_Alignment *aln;353 char*filename;354 intmethod,maskable;347 NA_Alignment *aln; 348 char *filename; 349 int method,maskable; 355 350 { 356 351 int j,kk,mask = -1,k,offset,min_offset= -999999; … … 504 499 505 500 506 Warning(s)507 char *s;501 void Warning(s) 502 const char *s; 508 503 { 509 504 extern Frame frame; -
trunk/GDE/CORE/Genbank.c
r655 r1003 427 427 } 428 428 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; 429 SetTime(struct gde_time *a) 440 430 { 441 431 struct tm *tim,*localtime(); -
trunk/GDE/CORE/Makefile
r887 r1003 15 15 update: $(ARBHOME)/bin/arb_gde 16 16 17 proto: 17 proto: functions.h 18 19 $(CCOBJS) : functions.h 20 21 functions.h: $(CCOBJS:.o=.c) 18 22 rm -f functions.h 19 23 ../../MAKEBIN/aisc_mkpt -C *.c >functions.h -
trunk/GDE/CORE/ParseMenu.c
r655 r1003 23 23 int num_menus; 24 24 25 ParseMenu()25 void ParseMenu() 26 26 { 27 27 int j,curmenu = -1,curitem = 0; … … 229 229 Error("Calloc"); 230 230 } 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 } 241 243 } 242 244 /* … … 483 485 Find(): Search the target string for the given key 484 486 */ 485 Find(target,key) 486 char *key,*target; 487 int Find(target,key) 488 char *target; 489 const char *key; 487 490 { 488 491 int i,j,len1,dif,flag = FALSE; … … 501 504 502 505 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 */ 506 int 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 */ 509 513 { 510 514 int i,j,len1,dif,flag = FALSE; … … 523 527 524 528 525 Error(msg)526 char *msg;529 void Error(msg) 530 const char *msg; 527 531 { 528 532 (void)fprintf(stderr,"%s\n",msg); … … 550 554 */ 551 555 552 crop(input,head,tail)556 void crop(input,head,tail) 553 557 char input[],head[],tail[]; 554 558 { -
trunk/GDE/CORE/arbdb_io.c
r2 r1003 10 10 extern Frame frame; 11 11 12 int 12 int 13 13 Arbdb_get_curelem(NA_Alignment *dataset) 14 14 { … … 30 30 extern int Default_PROColor_LKUP[],Default_NAColor_LKUP[]; 31 31 32 ReadArbdb(filename,dataset,type)32 void ReadArbdb(filename,dataset,type) 33 33 char *filename; 34 34 NA_Alignment *dataset; … … 78 78 79 79 gbd = GB_find(gb_species,"author",0,down_level); 80 if (gbd) 80 if (gbd) 81 81 strncpy(this_elem->authority,GB_read_char_pntr(gbd),79); 82 82 gbd = GB_find(gb_species,"full_name",0,down_level); 83 if (gbd) 83 if (gbd) 84 84 strncpy(this_elem->seq_name,GB_read_char_pntr(gbd),79); 85 85 gbd = GB_find(gb_species,"acc",0,down_level); 86 if (gbd) 86 if (gbd) 87 87 strncpy(this_elem->id,GB_read_char_pntr(gbd),79); 88 88 AppendNA((NA_Base *)GB_read_char_pntr(gb_data), … … 90 90 this_elem); 91 91 this_elem->comments = strdup("no comments"); 92 this_elem->comments_maxlen = 1 + 92 this_elem->comments_maxlen = 1 + 93 93 (this_elem->comments_len = strlen("no comments")); 94 94 … … 120 120 121 121 WriteArbdb(aln,filename,method,maskable) 122 NA_Alignment *aln;123 char*filename;124 intmethod,maskable;122 NA_Alignment *aln; 123 char *filename; 124 int method,maskable; 125 125 { 126 126 int j,k; 127 GBDATA *gb_ali; 127 /* GBDATA *gb_ali; */ 128 128 GBDATA *gb_data; 129 GBDATA *gb_name; 129 /* GBDATA *gb_name; */ 130 130 GBDATA *gb_species_data; 131 131 GBDATA *gbd; … … 171 171 case 2: 172 172 this_elem->gb_species = 0; 173 continue; 173 continue; 174 174 } 175 175 }else{ … … 191 191 default: 192 192 continue; 193 } 194 } 193 } 194 } 195 195 }else if (this_elem->gb_species != gb_species) { /* a copied species */ 196 196 if (gb_species) { … … 213 213 default: 214 214 continue; 215 } 215 } 216 216 }else{ 217 217 int select_mode = notice_prompt(frame,NULL,NOTICE_MESSAGE_STRINGS, … … 233 233 default: 234 234 continue; 235 } 235 } 236 236 } 237 237 } … … 285 285 } 286 286 287 Updata_Arbdb(item,event)287 void Updata_Arbdb(item,event) 288 288 Panel_item item; 289 289 Event *event; -
trunk/GDE/CORE/defines.h
r2 r1003 119 119 #define IS_ORIG_3_TO_5 0x400 /* Original sequence was 3_to_5 */ 120 120 121 #ifdef HGL 121 #ifdef HGL 122 122 #define DEFAULT_X_ATTR 0 123 #else 123 #else 124 124 #define DEFAULT_X_ATTR IS_5_TO_3+IS_PRIMARY; 125 125 #endif … … 244 244 NA_Sequence **group; /* link to array of pointers into 245 245 each group */ 246 char *na_ddata; /* display data */ 246 char *na_ddata; /* display data */ 247 247 int format; /* default file format */ 248 248 char *selection_mask; /* Sub sequence selection mask */ … … 287 287 } NA_DisplayData; 288 288 289 struct gde_time { int yy; int mm; int dd; int hr; int mn; int sc; }; 290 289 291 290 292 #define getcmask(a,b) (b < ((a)->offset))?0:((a)->cmask[(b-(a)->offset)]) -
trunk/GDE/CORE/functions.h
r2 r1003 1 1 #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 4 7 #else 5 # define P_(s) () 6 #endif 8 # error P_ already defined elsewhere 7 9 #endif 8 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 9 14 10 15 /* BasicDisplay.c */ 16 int QuitGDE P_((void)); 17 int QuitGDE_update P_((Panel_item item, Event *event)); 11 18 Panel BasicDisplay P_((NA_Alignment *DataSet)); 12 19 void bailout P_((void)); 13 intGenMenu P_((int type));14 intMakeNAADisplay P_((void));20 void GenMenu P_((int type)); 21 void MakeNAADisplay P_((void)); 15 22 NA_DisplayData *SetNADData P_((NA_Alignment *aln, Canvas Can, Canvas NamCan)); 16 int DummyRepaint ();23 int DummyRepaint(); 17 24 int DrawNANames P_((Display *dpy, Window xwin)); 18 int RepaintNACan ();19 intSetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc));20 intUnsetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc));25 int RepaintNACan(); 26 void SetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc)); 27 void UnsetNACursor P_((NA_DisplayData *NAdd, Canvas can, Xv_window win, Window xwin, Display *dpy, GC gc)); 21 28 int ResizeNACan P_((Canvas canvas, int wd, int ht)); 22 int QuitGDE P_((void));23 29 24 30 /* BuiltIn.c */ … … 122 128 123 129 /* FileIO.c */ 124 intLoadData P_((char *filename));125 intLoadFile P_((char *filename, NA_Alignment *dataset, int type, int format));126 int ErrorOut P_((int code,char *string));130 void LoadData P_((char *filename)); 131 void LoadFile P_((char *filename, NA_Alignment *dataset, int type, int format)); 132 void ErrorOut P_((int code, const char *string)); 127 133 char *Calloc P_((int count, int size)); 128 134 char *Realloc P_((char *block, int size)); 129 intCfree P_((char *block));135 void Cfree P_((char *block)); 130 136 char *String P_((char *string)); 131 137 int FindType P_((char *name, int *dtype, int *ftype)); 132 intAppendNA P_((NA_Base *buffer, int len, NA_Sequence *seq));133 intAscii2NA P_((char *buffer, int len, int matrix[16 ]));138 void AppendNA P_((NA_Base *buffer, int len, NA_Sequence *seq)); 139 void Ascii2NA P_((char *buffer, int len, int matrix[16 ])); 134 140 int WriteNA_Flat P_((NA_Alignment *aln, char *filename, int method, int maskable)); 135 int Warning P_((char *s));141 void Warning P_((const char *s)); 136 142 int InitNASeq P_((NA_Sequence *seq, int type)); 137 143 int ReadCMask P_((char *filename)); … … 149 155 /* Genbank.c */ 150 156 int ReadGen P_((char *filename, NA_Alignment *dataset, int type)); 157 int WriteGen P_((NA_Alignment *aln, char *filename, int method, int maskable)); 158 int SetTime P_((struct gde_time *a)); 159 int CheckType P_((char *seq, int len)); 151 160 152 161 /* HGLfile.c */ … … 160 169 161 170 /* ParseMenu.c */ 162 intParseMenu P_((void));163 int Find P_((char *target, c har *key));164 int Find2 P_((char *target, c har *key));165 int Error P_((char *msg));171 void ParseMenu P_((void)); 172 int Find P_((char *target, const char *key)); 173 int Find2 P_((char *target, const char *key)); 174 void Error P_((const char *msg)); 166 175 int getline P_((FILE *file, char string[])); 167 intcrop P_((char input[], char head[], char tail[]));176 void crop P_((char input[], char head[], char tail[])); 168 177 169 178 /* Scroll.c */ … … 176 185 /* arbdb_io.c */ 177 186 int Arbdb_get_curelem P_((NA_Alignment *dataset)); 178 intReadArbdb P_((char *filename, NA_Alignment *dataset, int type));187 void ReadArbdb P_((char *filename, NA_Alignment *dataset, int type)); 179 188 int WriteArbdb P_((NA_Alignment *aln, char *filename, int method, int maskable)); 180 intUpdata_Arbdb P_((Panel_item item, Event *event));189 void Updata_Arbdb P_((Panel_item item, Event *event)); 181 190 182 191 /* main.c */ 183 192 int main P_((int argc, char **argv)); 184 193 194 #ifdef __cplusplus 195 } 196 #endif 197 185 198 #undef P_ -
trunk/GDE/CORE/main.c
r655 r1003 1 1 #include <stdio.h> 2 #include <unistd.h> 2 3 #include <xview/defaults.h> 3 4 #include <xview/xview.h> … … 49 50 mpr_static(iconpr,64,64,1,GDEicon); 50 51 51 main(argc,argv)52 intargc;53 char **argv;52 int main(argc,argv) 53 int argc; 54 char **argv; 54 55 { 55 56 … … 76 77 */ 77 78 78 frame = xv_create( NULL,FRAME,79 frame = xv_create(0,FRAME, 79 80 FRAME_NO_CONFIRM,FALSE, 80 81 FRAME_LABEL, "Genetic Data Environment 2.2", … … 163 164 ((NA_Alignment*)DataSet,EditCan,EditNameCan); 164 165 165 tool_icon = xv_create( NULL,ICON,166 tool_icon = xv_create(0,ICON, 166 167 ICON_IMAGE,&iconpr, 167 168 ICON_LABEL,strlen(FileName)>0?FileName:"GDE", -
trunk/GENOM/GEN_map.cxx
r972 r1003 406 406 gen_assert(ask_to_overwrite_alignment); 407 407 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); 409 409 int answer = ask_about_existing_gene_species->get_answer(question, "Overwrite species,Insert new alignment,Skip,Create new", "all", true); 410 410 … … 421 421 GBDATA *gb_ali = GB_find(gb_exist_geneSpec, ali, 0, down_level); 422 422 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); 424 424 int overwrite_answer = ask_to_overwrite_alignment->get_answer(question2, "Overwrite data,Skip", "all", true); 425 425 -
trunk/HELP_SOURCE/oldhelp/macro.hlp
r387 r1003 14 14 15 15 DESCRIPTION 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, ... 17 18 18 19 To execute an existing macro select a macro and press <EXECUTE> … … 34 35 BUGS - Only buttons, values and menus are recorded 35 36 - 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. 37 38 Hint: Close all subwindows before you start to build a 38 39 macro. 39 40 - 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 41 42 parameters are unchanged. If you want a parameter set 42 43 to a certain value, you have to change it. Sometimes it 43 44 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 45 46 the macros. 46 47 - Only actions within the main application are recorded. -
trunk/HELP_SOURCE/oldhelp/scandb.hlp
r941 r1003 12 12 TITLE Scan Database for all Fields 13 13 14 OCCURRENCE ARB_NT/Species|Genes|Experiments/Info/FIELDS/ Unhide allfields15 ARB_NT/Species|Genes|Experiments/Info/FIELDS/ Delete unusedfields16 ARB_NT/Species|Genes|Experiments/Info/FIELDS/Re build fields14 OCCURRENCE 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 17 17 18 18 DESCRIPTION Each function scans the database to detect all existing fields. 19 19 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. 22 21 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. 24 24 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. 26 27 27 Normally it is not necessary to run any of this proceduresunless28 NOTE Normally it is not necessary to run 'Scan unknown fields' unless 28 29 some external programs generate new and yet unknown fields 29 or if the ARB programmers forgot to marka field as known.30 or if the ARB programmers forgot to announce a field as known. 30 31 31 32 In the latter case please write to LINK{devel@arb-home.de} and describe which 32 33 fields was created by doing what. 33 34 NOTES None35 34 36 35 EXAMPLES None -
trunk/HELP_SOURCE/oldhelp/set_protection.hlp
r387 r1003 11 11 TITLE Set Protection Level of Field of Listed Species 12 12 13 OCCURRENCE <ARB_NT/Species/Search /Do On Listed/Set Protection ...>13 OCCURRENCE <ARB_NT/Species/Search&Query/More functions/Set Protection ...> 14 14 15 15 DESCRIPTION Set the protection level of one field of listed species. -
trunk/HELP_SOURCE/oldhelp/sp_search.hlp
r941 r1003 91 91 92 92 WARNINGS If the hitlist becomes too long, it will be truncated. 93 Nevertheless all operations work on non-truncated hitlist! 93 94 94 95 BUGS No bugs known -
trunk/HELP_SOURCE/oldhelp/version.hlp
r387 r1003 3 3 4 4 #Please insert subtopic references (line starts with keyword SUB) 5 #SUB subtopic.hlp5 SUB changes.hlp 6 6 7 7 # Hypertext links in helptext can be added like this: {ref.hlp:visible_text} … … 10 10 TITLE Version Info 11 11 12 12 NOTE See LINK{changes.hlp} for info about current versions. 13 13 14 14 SECTION OLD VERSION LIST -
trunk/MERGE/MG_gene_species.cxx
r868 r1003 4 4 // Purpose : Transfer fields from organism and gene when // 5 5 // tranferring gene species // 6 // Time-stamp: < Fri Aug/23/2002 22:09MET Coder@ReallySoft.de> //6 // Time-stamp: <Tue Dec/03/2002 15:01 MET Coder@ReallySoft.de> // 7 7 // // 8 8 // // … … 294 294 if (error) { 295 295 free(result); 296 result = strdup(GBS_global_string("<%s>", error));296 result = GBS_global_string_copy("<%s>", error); 297 297 } 298 298 -
trunk/MERGE/MG_species.cxx
r823 r1003 308 308 } 309 309 awt_add_new_changekey(gb_dest,name,(int)GB_read_int(gb_key_type)); 310 delete name;310 free(name); 311 311 } 312 312 } … … 946 946 D_alignment_names[d++] = D_alignment_names[s]; 947 947 }else{ 948 delete D_alignment_names[s];948 free(D_alignment_names[s]); 949 949 D_alignment_names[s] = 0; 950 950 } … … 984 984 } 985 985 dest = D_alignment_names[aliid]; 986 delete b;986 free(b); 987 987 break; 988 988 }; … … 994 994 } 995 995 mg_eq_end: 996 delete type;996 free(type); 997 997 GBT_free_names(M_alignment_names); 998 998 GBT_free_names(D_alignment_names); … … 1021 1021 GBDATA *M_species; 1022 1022 GBDATA *D_species; 1023 delete m_name; m_name = 0;1023 free(m_name); m_name = 0; 1024 1024 for ( M_species = GB_find(M_species_data,"species",0,down_level); 1025 1025 M_species; 1026 1026 M_species = GB_find(M_species,"species",0,this_level | search_next)){ 1027 1027 GBDATA *M_name = GB_search(M_species,"name",GB_STRING); 1028 delete m_name;1028 free(m_name); 1029 1029 m_name = GB_read_string(M_name); 1030 1030 int count = 1; -
trunk/MULTI_PROBE/MP_noclass.cxx
r982 r1003 449 449 // aw_message(GBS_global_string("backward='%i'", int(backward))); 450 450 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); 452 453 453 454 MP_show_probes_in_tree(aww); -
trunk/Makefile
r989 r1003 827 827 pa: $(PARSIMONY) 828 828 tg: $(TREEGEN) 829 se: $(SECEDIT)829 #se: $(SECEDIT) 830 830 acc: $(ACORR) 831 831 … … 842 842 843 843 te: $(TEST) 844 sec: $(SECEDIT)844 #sec: $(SECEDIT) 845 845 de: $(AWDEMO) 846 846 -
trunk/NTREE/NT_cb.cxx
r805 r1003 73 73 if (ltree){ 74 74 aww->get_root()->awar(awar_tree)->write_string(ltree); 75 delete ltree;75 free(ltree); 76 76 } 77 77 } -
trunk/NTREE/NT_concatenate.cxx
r1000 r1003 72 72 AW_root *aw_root = cas->aws->get_root(); 73 73 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); 75 75 76 76 cas->aws->clear_selection_list(cas->db_id); //clearing the selection list … … 129 129 AW_root *aw_root = aws->get_root(); 130 130 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 it131 ali_type = GBS_global_string_copy("%s=", ali_type); // copying the awar with '=' appended to it 132 132 133 133 db_alignment_list = aws->create_selection_list(awarName,0,"",10,20); … … 330 330 else { 331 331 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))); 333 333 int skip_ali = ask_about_missing_alignment->get_answer(question, "Insert Gaps for Missing Alignment,Skip Missing Alignment", "all", true); 334 334 if(!skip_ali){ -
trunk/NTREE/NT_extern.cxx
r997 r1003 118 118 GB_textprint(name); 119 119 } 120 delete name;120 free(name); 121 121 } 122 122 … … 530 530 } 531 531 532 void NT_submit_mail(AW_window *aww){ 533 char *address = aww->get_root()->awar("/tmp/nt/register/mail")->read_string(); 532 void 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(); 534 536 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 536 538 char buffer[256]; 537 539 sprintf(buffer,"/tmp/arb_bugreport_%s",GB_getenvUSER()); 540 538 541 FILE *mail = fopen(buffer,"w"); 539 542 if (!mail){ 540 543 aw_message(GB_export_error("Cannot write file %s",buffer)); 541 }else{ 544 } 545 else{ 542 546 fprintf(mail,"%s\n",text); 547 fprintf(mail,"------------------------------\n"); 543 548 fprintf(mail,"VERSION :" DATE "\n"); 544 549 fprintf(mail,"SYSTEMINFO :\n"); … … 548 553 system(GBS_global_string("date >>%s",buffer)); 549 554 const char *command = GBS_global_string("mail '%s' <%s",plainaddress,buffer); 555 printf("%s\n",command); 550 556 system(command); 551 printf("%s\n",command); 552 GB_unlink(buffer); 557 // GB_unlink(buffer); 553 558 aww->hide(); 554 559 } 555 delete text; 556 delete address; 557 delete plainaddress; 560 561 free(plainaddress); 562 free(text); 563 free(address); 558 564 } 559 565 560 566 AW_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 } 566 577 aws->load_xfig("bug_report.fig"); 567 578 568 aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 579 aws->at("close"); 580 aws->callback((AW_CB0)AW_POPDOWN); 569 581 aws->create_button("CLOSE","CLOSE","C"); 570 582 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"); 572 585 aws->create_button("HELP","HELP","H"); 573 586 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 } 593 631 594 632 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 596 634 aws->create_button("SEND","SEND"); 635 636 awss[bug_report] = aws; // store for further use 597 637 598 638 return aws; … … 782 822 awm->button_length(5); 783 823 784 AW_init_color_group_defaults("arb_ntree");824 if (!clone) AW_init_color_group_defaults("arb_ntree"); 785 825 786 826 nt.tree = (AWT_graphic_tree*)NT_generate_tree(awr,gb_main); -
trunk/NTREE/ad_ali.cxx
r655 r1003 128 128 129 129 if (!error){ 130 char *nfield = strdup(GBS_global_string("%s/data",dest));130 char *nfield = GBS_global_string_copy("%s/data",dest); 131 131 awt_add_new_changekey( gb_main,nfield,GB_STRING); 132 132 delete nfield; … … 199 199 char *nfield = strdup(GBS_global_string("%s/data",name)); 200 200 awt_add_new_changekey( gb_main,nfield,GB_STRING); 201 delete nfield;201 free(nfield); 202 202 GB_commit_transaction(gb_main); 203 203 }else{ … … 205 205 } 206 206 if (error) aw_message(error); 207 delete name;207 free(name); 208 208 } 209 209 -
trunk/NTREE/ad_ext.cxx
r1001 r1003 1 1 #include <stdio.h> 2 #include <stdlib.h> 2 3 #include <memory.h> 3 4 // #include <malloc.h> -
trunk/NTREE/ad_spec.cxx
r996 r1003 52 52 else GBT_abort_rename_session(); 53 53 if (error) aw_message(error); 54 delete source;55 delete dest;54 free(source); 55 free(dest); 56 56 } 57 57 … … 87 87 } 88 88 if (error) aw_message(error); 89 delete source;90 delete dest;89 free(source); 90 free(dest); 91 91 } 92 92 … … 117 117 else GB_abort_transaction(gb_main); 118 118 if (error) aw_message(error); 119 delete source;119 free(source); 120 120 } 121 121 … … 139 139 else GB_abort_transaction(gb_main); 140 140 if (error) aw_message(error); 141 delete dest;141 free(dest); 142 142 } 143 143 … … 225 225 226 226 if (error) aw_message(error); 227 delete source;227 free(source); 228 228 } 229 229 static AW_CL ad_global_scannerid = 0; … … 295 295 } 296 296 297 void ad_list_reorder_cb(AW_window *aws, AW_CL cl_ item_selector) {297 void ad_list_reorder_cb(AW_window *aws, AW_CL cl_cbs1, AW_CL cl_cbs2) { 298 298 299 299 GB_begin_transaction(gb_main); … … 302 302 GB_ERROR warning = 0; 303 303 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; 305 307 GBDATA *gb_source = awt_get_key(gb_main,source, selector->change_key_path); 306 308 GBDATA *gb_dest = awt_get_key(gb_main,dest, selector->change_key_path); 307 309 GBDATA *gb_key_data = GB_search(gb_main, selector->change_key_path, GB_CREATE_CONTAINER); 308 310 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 309 314 if (!gb_source) { 310 315 aw_message("Please select an item you want to move (left box)"); … … 314 319 } 315 320 if (gb_source && gb_dest && (gb_dest !=gb_source) ) { 321 nt_assert(left_index != right_index); 322 316 323 GBDATA **new_order; 317 324 int nitems = 0; … … 335 342 } 336 343 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 342 352 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 } 344 361 } 345 362 … … 361 378 aws->create_button("CLOSE","CLOSE","C"); 362 379 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 363 383 aws->at("doit"); 364 384 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); 366 387 aws->help_text("spaf_reorder.hlp"); 367 388 aws->create_button("MOVE_TO_NEW_POSITION", "MOVE SELECTED LEFT ITEM\nAFTER SELECTED RIGHT ITEM","P"); 368 389 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 372 390 return (AW_window *)aws; 373 391 } 374 392 375 void ad_hide_field(AW_window *aws, AW_CL cl_ item_selector, AW_CL cl_hide)393 void ad_hide_field(AW_window *aws, AW_CL cl_cbs, AW_CL cl_hide) 376 394 { 377 395 AWUSE(aws); … … 380 398 char *source = aws->get_root()->awar(AWAR_FIELD_DELETE)->read_string(); 381 399 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; 383 402 GBDATA *gb_source = awt_get_key(gb_main,source, selector->change_key_path); 384 403 … … 391 410 } 392 411 393 delete source;412 free(source); 394 413 395 414 if (error) { … … 398 417 }else{ 399 418 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 423 void ad_field_delete(AW_window *aws, AW_CL cl_cbs) 404 424 { 405 425 AWUSE(aws); … … 409 429 char *source = aws->get_root()->awar(AWAR_FIELD_DELETE)->read_string(); 410 430 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; 412 433 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); 413 436 414 437 if (!gb_source) { … … 431 454 } 432 455 433 434 delete source; 456 free(source); 457 435 458 if (error) { 436 459 GB_abort_transaction(gb_main); … … 439 462 GB_commit_transaction(gb_main); 440 463 } 464 465 aws->select_index(cbs->id, AWAR_FIELD_DELETE, curr_index); // current(deleted) item has disappeared, so this selects the next one 441 466 } 442 467 … … 462 487 aws->create_button("HELP","HELP","H"); 463 488 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 464 495 aws->button_length(13); 465 496 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); 467 498 aws->help_text("rm_field_only.hlp"); 468 499 aws->create_button("HIDE_FIELD","Hide field","H"); 469 500 470 501 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); 472 503 aws->help_text("rm_field_only.hlp"); 473 504 aws->create_button("UNHIDE_FIELD","Unhide field","U"); 474 505 475 506 aws->at("delf"); 476 aws->callback(ad_field_delete, (AW_CL)selector);507 aws->callback(ad_field_delete, cbs); 477 508 aws->help_text("rm_field_cmpt.hlp"); 478 509 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);485 510 486 511 return (AW_window *)aws; … … 508 533 aws->hide(); 509 534 } 510 delete name;535 free(name); 511 536 GB_pop_transaction(gb_main); 512 537 } … … 655 680 aw_message(GBS_global_string("Species '%s' has no sequence '%s'",sel_species,ali_name)); 656 681 } 657 delete sel_species;658 delete ali_name;682 free(sel_species); 683 free(ali_name); 659 684 if (!gb_data) return; 660 685 sequence = GB_read_string(gb_data); … … 663 688 AWTC_FIND_FAMILY ff(gb_main); 664 689 GB_ERROR error = ff.go(pts,sequence,GB_TRUE,max_hits); 665 delete sequence;690 free(sequence); 666 691 AW_selection_list* sel = (AW_selection_list *)id; 667 692 aww->clear_selection_list(sel); -
trunk/NTREE/ad_transpro.cxx
r913 r1003 76 76 gb_dest = GBT_get_alignment(gbmain,ali_dest); 77 77 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); 80 80 if (aw_message(msg,"CREATE,CANCEL")){ 81 81 delete msg; … … 84 84 long slen = GBT_get_alignment_len(gbmain,ali_source); 85 85 delete msg; 86 ali_dest = strdup(GBS_global_string("%s_pro",ali_source));86 ali_dest = GBS_global_string_copy("%s_pro",ali_source); 87 87 gb_dest = GBT_create_alignment(gbmain,ali_dest,slen/3+1,0,1,"ami"); 88 88 { 89 char *fname = strdup(GBS_global_string("%s/data",ali_dest));89 char *fname = GBS_global_string_copy("%s/data",ali_dest); 90 90 awt_add_new_changekey( gbmain,fname,GB_STRING); 91 91 delete fname; -
trunk/NTREE/ad_trees.cxx
r989 r1003 477 477 char *t1 = aww->get_root()->awar(AWAR_TREE_NAME)->read_string(); 478 478 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()); 480 480 481 481 AW_BOOL compare_node_info = mode==1; -
trunk/ORS_CGI/ORS_C_html.cxx
r2 r1003 1 /* 1 /* 2 2 ################################# 3 3 # # … … 5 5 # html output functions # 6 6 # # 7 ################################# 7 ################################# 8 8 9 9 there are comments in this file, which are used for automatic documentation generating! … … 75 75 ***********************************/ 76 76 void print_header(void) { 77 if (JAVA) 77 if (JAVA) 78 78 printf("Content-type: text/plain\n\n"); 79 79 else … … 117 117 end=strchr(read,1); 118 118 if (!end) end=strchr(read,0); 119 if (!end) break; 120 read=end+1; 119 if (!end) break; 120 read=end+1; 121 121 } 122 122 … … 130 130 putchar('"'); 131 131 132 if (selected && 132 if (selected && 133 133 !ORS_strncmp(read,selected) && 134 134 strlen(selected) == end-read) printf(" SELECTED"); … … 151 151 152 152 printf("\n"); 153 if (!*end) break; 154 read=end+1; 153 if (!*end) break; 154 read=end+1; 155 155 156 156 // jump over "every" fields … … 159 159 end=strchr(read,1); 160 160 if (!end) end=strchr(read,0); 161 if (!end || !*end) break; 162 read=end+1; 161 if (!end || !*end) break; 162 read=end+1; 163 163 } 164 164 } … … 235 235 delete content[column]; 236 236 content[column] = strdup(buffer); 237 } 237 } 238 238 else break; // EOList 239 239 240 240 list_col++; 241 241 columns++; … … 253 253 if (header) { 254 254 char *start, *end; 255 255 256 256 start = header; end = 0; 257 257 printf("<TR ALIGN="); … … 280 280 else printf("<td>"); 281 281 282 if (f_set[column]) 282 if (f_set[column]) 283 283 f[column](content[other_col[column]], col_mode[column], col_param[column], row, column); // start column function 284 284 … … 308 308 // 2: <a href=www_home>full name</a> 309 309 // 3: <a href=www_home>param</a> 310 // param = 310 // param = 311 311 void OC_html_www_home(char *content, int mode, char *param, int row, int col) { 312 312 313 313 if (!content || !*content) { 314 314 printf("(empty)"); … … 316 316 } 317 317 printf("<A HREF=\"http://%s\">",OC_read_user_field_if_userpath_set(content, "www_home")); 318 318 319 319 if (mode == 1) { 320 320 printf("%s",content); … … 326 326 else printf("unknown mode %i for www_home",mode); 327 327 printf("</A>"); 328 328 329 329 row = row; col = col; // not needed 330 330 }; 331 331 332 332 /***************************************************************************** 333 333 HTML: PROBE_ID LINK … … 336 336 // param = e.g. "EDIT", "CLONE" 337 337 void OC_html_probe_id_link(char *content, int mode, char *param, int row, int col) { 338 338 339 339 if (!param) param = "(no param)"; 340 340 if (!ORS_strcmp(param, "CLONE")) { … … 357 357 void OC_html_userpath_link(char *content, int mode, char *param, int row, int col) { 358 358 char *new_html; 359 359 360 360 if (!content || !*content) { 361 361 printf("(empty)"); … … 398 398 399 399 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; 404 404 } 405 405 } … … 411 411 ********************************************************************************/ 412 412 void output_list_as_2_col_table(char *list1, int width1, char *between, char *eol) { 413 413 414 414 char *read=list1, *end; 415 415 if (!list1) return; … … 425 425 printf("%s",between); 426 426 427 if (!*end) break; 428 read=end+1; 427 if (!*end) break; 428 read=end+1; 429 429 430 430 end=strchr(read,1); … … 435 435 printf("%s",eol); 436 436 437 if (!*end) break; 438 read=end+1; 437 if (!*end) break; 438 read=end+1; 439 439 } 440 440 } … … 462 462 463 463 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; 465 465 else { 466 466 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; 468 468 else { 469 469 if (!strcmp(select,"create")) main_owner = ors_gl.userpath; … … 530 530 // get owner of this section (or use owner of main section) 531 531 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; 533 533 else owner = main_owner; 534 534 if (table) printf("</table>"); … … 541 541 for (temp = pointer; temp; temp=OC_next_pdb_list_elem(list, temp)) { 542 542 if (ORS_strcmp(temp->section, section_memo)) break; // end of section 543 if (temp->content && *temp->content 543 if (temp->content && *temp->content 544 544 && ORS_strcmp(temp->name,"p_owner") 545 545 && ORS_strcmp(temp->name,"p_last_mod") ) {found=1; break; } // content found 546 546 } 547 if (!found) { 547 if (!found) { 548 548 if (temp) { 549 549 pointer = temp->prev; // jump over this section 550 550 continue; 551 } 551 } 552 552 else break; 553 553 } 554 554 } 555 555 556 556 // not empty -> output next section 557 557 printf("<A NAME=\"%s\"></A>",pointer->section); // href on same page … … 605 605 606 606 else if (strchr(elem->rights,'V')) content=elem->content; 607 } 607 } 608 608 else if (!strcmp(select,"show")) { 609 609 content=elem->content; … … 616 616 else { // use existing values from environment 617 617 delete content; 618 if (elem->content && !select_owner) 618 if (elem->content && !select_owner) 619 619 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) || 625 625 !strcmp(owner,"")) ) update = 0; // special case: old data may have "" as owner 626 626 … … 658 658 if (update) { 659 659 printf("\">"); 660 if (www_home) 660 if (www_home) 661 661 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) 663 663 printf(" <A HREF=\"http:sel_user_info?sel_userpath=%s\">infopage</A>",content); 664 664 } else if (strcmp(select,"show")) { … … 687 687 688 688 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), 690 690 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), 692 692 elem->content, 1); 693 693 } 694 694 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), 696 696 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), 698 698 elem->content, 1); 699 699 } … … 709 709 else output_list_as_html_options(OC_read_file_into_list( 710 710 ORS_LIB_PATH "target_genes"), //! possible target gene names for main section 711 elem->content, 0); 711 elem->content, 0); 712 712 } 713 713 printf("</SELECT>"); … … 787 787 if (strlen(highest) < strlen(lowest)) { 788 788 if (!strncmp(highest, lowest, strlen(highest))) { 789 hi=highest; 789 hi=highest; 790 790 lo=lowest; 791 791 } … … 811 811 char *pos1=lo+strlen(hi); 812 812 char *pos2=lo+strlen(lo); 813 813 814 814 while(1) { 815 815 pos2=strchr(pos1,'/'); … … 836 836 return strdup(me); 837 837 } 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); 841 840 } 842 841 -
trunk/ORS_CGI/ORS_C_java_main.cxx
r2 r1003 32 32 //////// BIN_TREE (JAVA) ///////// 33 33 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); 35 35 GB_ERROR error = 0; 36 36 // look for predefined datas -
trunk/ORS_CGI/ORS_C_main.cxx
r655 r1003 211 211 char *seek_name = cgi_var(cv); 212 212 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); 214 214 if (!*result) quit_with_error(ORS_export_error("'%s' not found in " ORS_LIB_PATH "%s at %s",seek_name,lib_file,kontext)); 215 215 return result; … … 586 586 delete ffile; 587 587 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); 589 589 590 590 output_java_match_result(tmpfile,bin_tree_path); -
trunk/ORS_SERVER/ORS_S_userdb.cxx
r2 r1003 1 /* 1 /* 2 2 ################################# 3 3 # # … … 23 23 GBDATA *gb_userdb; 24 24 25 // class functions 25 // class functions 26 26 //void ugl_struct::clear(void){ 27 27 // memset((char *)this,0,sizeof(ugl_struct)); 28 28 //} 29 // contructor 29 // contructor 30 30 //ugl_struct::ugl_struct(void){ 31 31 // clear(); … … 39 39 open the user database 40 40 *************************************************************************************/ 41 GB_ERROR OS_open_userdb(void){ 41 GB_ERROR OS_open_userdb(void){ 42 42 43 43 char *name = ORS_read_a_line_in_a_file(ORS_LIB_PATH "CONFIG","USER_DB"); //arb.user.db … … 209 209 empty_pw = ORS_crypt(""); 210 210 211 if (locs->password && *locs->password && ORS_strcmp(locs->password, empty_pw)) 211 if (locs->password && *locs->password && ORS_strcmp(locs->password, empty_pw)) 212 212 OS_write_gb_user_info_string(gb_user,"password", locs->password); 213 213 if (locs->username && *locs->username) OS_write_gb_user_info_string(gb_user,"username", locs->username); … … 242 242 gb_field = GB_find(gb_user,"ta_id",0,down_level); 243 243 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) 245 245 return strdup("User data has been changed in the meantime. Please reload your update page."); 246 246 … … 269 269 delete read_data; 270 270 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)) 272 272 OS_write_gb_user_info_string(gb_user,"password", locs->sel_password); 273 273 if (locs->sel_username && *locs->sel_username) OS_write_gb_user_info_string(gb_user,"username", locs->sel_username); … … 370 370 char * OS_find_user_and_password(char *user, char *password){ 371 371 GB_transaction dummy(gb_userdb); // keep transaction open until var scope ends 372 372 373 373 //char *userpath=0; 374 374 GBDATA *gb_userpath; … … 406 406 WRITE USER FIELD INFORMATION into user database 407 407 a non existing field is being created 408 return error message or NULL 408 return error message or NULL 409 409 no authorisation here! 410 410 *************************************************************************************/ … … 423 423 WRITE USER FIELD INFORMATION (INTEGER) into user database 424 424 a non existing field is being created 425 return error message or NULL 425 return error message or NULL 426 426 no authorisation here! 427 427 *************************************************************************************/ … … 440 440 WRITE USER FIELD INFORMATION into user database WITH EXISTING GB_USER 441 441 a non existing field is being created 442 return error message or NULL 442 return error message or NULL 443 443 no authorisation here! 444 444 *************************************************************************************/ … … 454 454 WRITE USER FIELD INFORMATION INT into user database WITH EXISTING GB_USER 455 455 a non existing field is being created 456 return error message or NULL 456 return error message or NULL 457 457 no authorisation here! 458 458 *************************************************************************************/ … … 478 478 if (!gb_date) return ORS_export_error("Dailypw_date does not exist"); 479 479 GB_read_string(gb_date); 480 // TODO: if (gb_date < today) 480 // TODO: if (gb_date < today) 481 481 482 482 GBDATA *gb_field = GB_find(gb_user,fieldname,0,down_level); … … 487 487 /***************************************************************************** 488 488 RETURN LIST OF SUBUSERS of a userpath 489 "levels" levels down, excluding "exclude", 489 "levels" levels down, excluding "exclude", 490 490 excluding all down from "exclude_from" 491 491 list has format as follows: name 1 name 1 ... 0 … … 499 499 char *users[500]; 500 500 int num_users=0; 501 GBDATA *subuser; 501 GBDATA *subuser; 502 502 GBDATA *subuser_name; 503 503 char *newpath, *read_data; 504 int my_level_count = ORS_str_char_count(userpath,'/'), 504 int my_level_count = ORS_str_char_count(userpath,'/'), 505 505 level_count, 506 506 exclude_from_len; … … 510 510 newpath = GBS_string_eval(userpath,"*=*1/\\*",0); 511 511 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 513 513 } 514 514 … … 523 523 read_data=GB_read_string(subuser_name); 524 524 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)) 529 529 ) { 530 530 users[num_users++]=read_data; … … 551 551 if (i<num_users-1) *(write-1)=1; 552 552 } 553 553 554 554 return result; 555 555 } … … 560 560 ***********************/ 561 561 char *OS_set_dailypw(char */*userpath*/, char */*dailypw*/) { 562 562 563 563 return "not implemented: set dailypw for user"; 564 564 } … … 600 600 max_user_depth = OS_read_user_info_int(userpath,"max_user_depth"); 601 601 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) 603 603 return ORS_export_error("Your parent user %s is not allowed to have users down to that hierarchie depth.", userpath); 604 604 } … … 609 609 CONSTRUCT SEL_USERPATH 610 610 add a parent path and a name 611 return strdup 611 return strdup 612 612 *****************************************************************************/ 613 613 char *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); 617 617 } 618 618 … … 658 658 } 659 659 } 660 660 661 661 return val; // do NOT remove item from list! 662 662 } … … 668 668 who_file=GBS_stropen(10000); // open memory file 669 669 if (userpath) { 670 if (ORS_str_char_count(userpath, '/') >= 2) 670 if (ORS_str_char_count(userpath, '/') >= 2) 671 671 who_userpath = ORS_get_parent_of(userpath); 672 672 else who_userpath = strdup(userpath); … … 687 687 int OS_user_has_sub_users(char *userpath) { 688 688 GB_transaction dummy(gb_userdb); // keep transaction open until var scope ends 689 689 690 690 char *user_pattern = ORS_sprintf("%s/*",userpath); 691 691 GBDATA *sub_userpath = GB_find(gb_userdb,"userpath",user_pattern,down_2_level); -
trunk/PARSIMONY/PARS_main.cxx
r922 r1003 428 428 leaf->remove(); 429 429 isits.currentspecies--; 430 char *label = strdup(GBS_global_string("2:%s",leaf->name));430 char *label = GBS_global_string_copy("2:%s",leaf->name); 431 431 insert_species_in_tree(label,leaf); // reinsert species 432 432 delete label; 433 433 isits.currentspecies--; 434 label = strdup(GBS_global_string("shortseq:%s",brother->name));434 label = GBS_global_string_copy("shortseq:%s",brother->name); 435 435 insert_species_in_tree(label,brother); // reinsert short sequence 436 436 delete label; -
trunk/PROBE_DESIGN/probe_design.cxx
r655 r1003 860 860 if (!(server = strtok(server,":"))) server = empty; 861 861 sprintf(choice,"%-8s: %s",server,file+2); 862 delete fr;862 free(fr); 863 863 864 864 return strdup(choice); … … 886 886 aws->insert_option( choice, "", i ); 887 887 } 888 delete choice;888 free(choice); 889 889 } 890 890 } -
trunk/SECEDIT/SEC_graphic.cxx
r996 r1003 83 83 (AW_CL)ntw, 84 84 cd2, 85 false,85 false, 86 86 "#777777", 87 87 "Loop$#ffffaa", … … 93 93 "-Cursor$#ff0000", 94 94 95 "+-User1$#B8E2F8", //used in secondary editor to change search pattern COLORS96 "+-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", 108 108 0 ); 109 109 … … 138 138 139 139 static 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); 141 141 char *default_input; 142 142 { … … 144 144 GB_CSTR f2 = double2string(upper_constraint); 145 145 146 default_input = strdup(GBS_global_string("%s-%s", f1, f2));146 default_input = GBS_global_string_copy("%s-%s", f1, f2); 147 147 free(f1); 148 148 } … … 198 198 199 199 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) { 320 321 #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); 355 356 #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); 420 421 421 422 #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(); 425 426 #endif 426 427 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: { 612 615 #if defined(DEBUG) 613 sec_assert(0);616 sec_assert(0); 614 617 #endif // DEBUG 615 break;616 }617 }618 }619 }620 }621 622 break; //break for case AWT_MODE_MOD623 }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 } 640 643 #if defined(DEBUG) && 1 641 printf("Clicked pos = %i\n", clicked_pos);644 printf("Clicked pos = %i\n", clicked_pos); 642 645 #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: { 651 654 #if defined(DEBUG) 652 sec_assert(0);655 sec_assert(0); 653 656 #endif // DEBUG 654 break;655 }657 break; 658 } 656 659 } 657 660 } -
trunk/SECEDIT/secedit.hxx
r875 r1003 295 295 void clear_last_drawed_cursor_position() { set_last_drawed_cursor_position(0, 0, 0, 0); } 296 296 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; 302 302 } 303 303 double getRootAngle() { return rootAngle; } … … 483 483 484 484 double delta; 485 double deltaIn; 485 double deltaIn; 486 486 double max_length, min_length; // constraints 487 487 … … 502 502 503 503 double get_delta () { return delta; } 504 double get_deltaIn () { return deltaIn;} 504 double get_deltaIn () { return deltaIn;} 505 505 506 506 double& get_max_length_ref() { return max_length; } … … 520 520 deltaIn_ -= (2*M_PI); 521 521 } 522 deltaIn = deltaIn_; 523 } 522 deltaIn = deltaIn_; 523 } 524 524 }; 525 525 -
trunk/SEER/SEER_to_seer.cxx
r2 r1003 27 27 const char *key = GB_read_key_pntr(gbd); 28 28 sprintf(end_of_prefix,GB_read_key_pntr(gbd)); 29 29 30 30 if (!strcmp(prefix,"name")) continue; 31 31 if (!strcmp(prefix,SEER_KEY_FLAG)) continue; … … 33 33 if (!at) continue; 34 34 if (at->element_for_upload==0) continue; 35 35 36 36 if (GB_read_clock(gbd) <= transaction_limit){ 37 37 continue; 38 38 } 39 39 40 40 GB_TYPES type = GB_read_type(gbd); 41 41 if (type == GB_DB){ … … 68 68 int count_exported_items = 0; 69 69 if (GB_read_clock(gb_ali) <= transaction_limit) return 0; 70 70 71 71 for (gb_data = GB_find(gb_ali,0,0,down_level); 72 72 gb_data; … … 76 76 const char *key = GB_read_key_pntr(gb_data); 77 77 if (!strcmp(key,"data")) key = "Sequence"; 78 78 79 79 switch(type){ 80 80 case GB_STRING: … … 141 141 } 142 142 delete sd; 143 144 } 143 144 } 145 145 146 146 void 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 153 154 aw_openstatus("Sequence Data"); 154 155 int max_i = 1; … … 330 331 if (GB_read_int(gb_type) != GB_STRING) continue; 331 332 at = new SeerInterfaceAttribute(); 332 333 333 334 key_name = GB_search(gb_key,CHANGEKEY_NAME,GB_STRING); 334 335 at->name = GB_read_string(key_name); … … 344 345 // 345 346 // 346 347 347 348 } 348 349 { // put arb_attribute_hash to selection list … … 367 368 aw_root->awar_int(AWAR_SEER_SAVE_SEQUENCES,1); 368 369 aw_root->awar_int(AWAR_SEER_SAVE_SAI,1); 369 370 370 371 seer_global.seer_upload_window = aws = new AW_window_simple; 371 372 aws->init( aw_root, "UPLOAD_ARB_2_SEER", "SEER UPLOAD_DATA", 400, 100 ); 372 373 aws->load_xfig("seer/upload.fig"); 373 374 374 375 375 376 aws->callback( AW_POPDOWN); 376 377 aws->at("close"); 377 aws->create_button("CANCEL","CANCEL","C"); 378 aws->create_button("CANCEL","CANCEL","C"); 378 379 379 380 aws->at("help"); … … 412 413 sprintf(at_buffer,"table_%i",table_nr); 413 414 sprintf(awar_buffer,"%s/%s",AWAR_SEER_UPLOAD_TABLE_PREFIX,td->tablename); 414 415 415 416 aws->at(at_buffer); 416 417 aw_root->awar_int(awar_buffer,0); … … 427 428 aws->callback(seer_select_all_export_attributes,1); 428 429 aws->create_button("INVERT_ALL_ATTRIBUTES","Invert All"); 429 430 430 431 aws->at("deselect"); 431 432 aws->callback(seer_select_all_export_attributes,0); 432 433 aws->create_button("DESELECT_ALL_ATTRIBUTES","Deselect All"); 433 434 434 435 aws->at("auto"); 435 436 aws->callback(seer_check_upload_attribute_list); 436 437 aws->create_button("AUTO_SELECT_ATTRIBUTES","Auto Select"); 437 438 438 439 aws->at("sequence_save"); 439 440 aws->create_toggle(AWAR_SEER_SAVE_SEQUENCES); 440 441 441 442 aws->at("SAI_save"); 442 443 aws->create_toggle(AWAR_SEER_SAVE_SAI); 443 444 444 445 aws->at("go"); 445 446 aws->button_length(15); -
trunk/SOURCE_TOOLS/arb_valgrind
r997 r1003 17 17 echo ' Updates the source file list (needed to create correct error message)' 18 18 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 '' 19 27 echo 'Note: I use this from inside emacs as follows:' 20 28 echo ' M-x compile' … … 22 30 echo ' (cd $ARBHOME;make nt) && arb_valgrind arb_ntree ~/ARB/demo.arb' 23 31 echo '' 32 24 33 else 34 if [ -z $ARB_VALGRIND_SOURCE_ROOT ] ; then 35 ARB_VALGRIND_SOURCE_ROOT=$ARBHOME 36 fi 37 25 38 DIR=$ARBHOME/SOURCE_TOOLS 26 39 LIST=$DIR/valgrind2grep.lst … … 49 62 50 63 if [ $UPDATE = 1 ] ; then 51 echo 'Creating source file list...'52 find $ARB HOME -name "*.[ch]" -o -name "*.[ch]xx" > $LIST64 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 53 66 echo 'done.' 54 67 fi … … 57 70 echo "CALLERS='$CALLERS'" 58 71 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" 60 73 echo 'valgrind done.' 61 74 fi -
trunk/WINDOW/AW_button.cxx
r996 r1003 216 216 char *value = vus->awar->read_as_string(); 217 217 GBS_fwrite_string(value,root->prvt->recording_macro_file); 218 delete value;218 free(value); 219 219 fprintf(root->prvt->recording_macro_file,");\n"); 220 220 } … … 323 323 { 324 324 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); 326 326 GBS_write_hash(this->get_root()->prvt->action_hash,_callback->id,(long)_callback); 327 327 }else{ … … 515 515 char *path; 516 516 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); 518 518 }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); 520 520 } 521 521 XtVaSetValues( (Widget)wgt, RES_CONVERT( XmNlabelPixmap, path ), NULL ); … … 641 641 (XtCallbackProc) AW_server_callback, 642 642 (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); 644 644 GBS_write_hash(this->get_root()->prvt->action_hash,_d_callback->id,(long)_d_callback); 645 645 } … … 1127 1127 } 1128 1128 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; 1129 int 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 1143 void 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); 1140 1153 } 1141 1154 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 1159 void 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; 1150 1183 } 1151 1184 … … 1158 1191 1159 1192 while (listEntry) { 1160 if ( GBS_strscmp(listEntry, searched_value) == 0) {1193 if (strcmp(listEntry, searched_value) == 0) { 1161 1194 found_index = element_index; 1162 1195 break; // found … … 1635 1668 if (ko[0] && pl[0] != '#') this->insert_selection(selection_list,pl,ko); 1636 1669 } 1637 delete data;1670 free(data); 1638 1671 } 1639 1672 GBS_free_names(fnames); -
trunk/WINDOW/AW_preset.cxx
r996 r1003 323 323 } 324 324 325 c onst char *AW_get_color_group_name(AW_root *awr, int color_group) {325 char *AW_get_color_group_name(AW_root *awr, int color_group) { 326 326 aw_assert(color_groups_initialized); 327 327 aw_assert(color_group>0 && color_group <= AW_COLOR_GROUPS); … … 674 674 if (is_color_group) { 675 675 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); 677 679 } 678 680 else { -
trunk/WINDOW/AW_question.cxx
r859 r1003 3 3 // File : aw_question.cpp // 4 4 // Purpose : // 5 // Time-stamp: <T hu Aug/22/2002 19:48MET Coder@ReallySoft.de> //5 // Time-stamp: <Tue Dec/03/2002 15:01 MET Coder@ReallySoft.de> // 6 6 // // 7 7 // // … … 47 47 char *w = new_buttons; 48 48 const char *r = buttons; 49 char *all = strdup(GBS_global_string(" (%s)", to_all));49 char *all = GBS_global_string_copy(" (%s)", to_all); 50 50 int all_len = strlen(all); 51 51 -
trunk/WINDOW/AW_status.cxx
r989 r1003 808 808 aw_msg->create_button(word, word, ""); 809 809 } 810 811 free(but); 810 812 } 811 813 else { … … 867 869 } 868 870 871 free(last_input); 869 872 870 873 root->disable_callbacks = AW_FALSE; … … 959 962 GB_CSTR result = 0; 960 963 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()); 962 965 size_t user_doc_path_len = strlen(user_doc_path); 963 966 size_t devel_doc_path_len = strlen(devel_doc_path); … … 1027 1030 1028 1031 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); 1030 1033 } 1031 1034 … … 1069 1072 } 1070 1073 else { 1071 char *compressed = strdup(GBS_global_string("%s.gz", help_file));1074 char *compressed = GBS_global_string_copy("%s.gz", help_file); 1072 1075 1073 1076 if (stat(compressed, &st) == 0) { // *.ps.gz exists -
trunk/WINDOW/AW_window.cxx
r996 r1003 2456 2456 (XtPointer) cbs); 2457 2457 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); 2460 2460 GBS_write_hash(this->get_root()->prvt->action_hash,id,(long)cbs); 2461 2461 if(!(mask&this->get_root()->global_mask)){ … … 2830 2830 path = strdup(file); 2831 2831 }else{ 2832 path = strdup(GBS_global_string("%s/%s",GB_getenvARBMACROHOME(),file));2832 path = GBS_global_string_copy("%s/%s",GB_getenvARBMACROHOME(),file); 2833 2833 } 2834 2834 char *macro_header = GB_read_file("$(ARBHOME)/lib/macro.head"); … … 2847 2847 2848 2848 fprintf(prvt->recording_macro_file,"%s",macro_header); 2849 delete macro_header;2849 free(macro_header); 2850 2850 return 0; 2851 2851 } … … 2857 2857 fprintf(prvt->recording_macro_file,"ARB::close($gb_main);"); 2858 2858 fclose(prvt->recording_macro_file); 2859 2859 2860 long mode = GB_mode_of_file(prvt->recording_macro_path); 2861 2860 2862 GB_set_mode_of_file(prvt->recording_macro_path,mode | ((mode >> 2)& 0111)); 2861 2863 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 2865 2873 return 0; 2866 2874 } … … 2871 2879 path = strdup(file); 2872 2880 }else{ 2873 path = strdup(GBS_global_string("%s/%s",GB_getenvARBMACROHOME(),file));2881 path = GBS_global_string_copy("%s/%s",GB_getenvARBMACROHOME(),file); 2874 2882 } 2875 2883 const char *com = GBS_global_string("%s/bin/perl %s &",GB_getenvARBHOME(),path); … … 2878 2886 aw_message(GBS_global_string("Calling '%s' failed",com)); 2879 2887 } 2880 delete path;2888 free(path); 2881 2889 return 0; 2882 2890 } … … 2974 2982 GBT_write_string(gb_main,awar_action,""); // this works as READY-signal for perl-client (remote_action) 2975 2983 } 2976 delete awar;2977 delete value;2978 delete action;2984 free(awar); 2985 free(value); 2986 free(action); 2979 2987 return 0; 2980 2988 } -
trunk/WINDOW/aw_color_groups.hxx
r893 r1003 3 3 // File : aw_color_groups.cxx // 4 4 // Purpose : // 5 // Time-stamp: < Fri Oct/11/2002 17:17MET Coder@ReallySoft.de> //5 // Time-stamp: <Tue Dec/03/2002 00:24 MET Coder@ReallySoft.de> // 6 6 // // 7 7 // Coded by Ralf Westram (coder@reallysoft.de) in June 2001 // … … 50 50 #define AW_COLOR_GROUPS 12 51 51 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 c onst char*AW_get_color_group_name(AW_root *awr, int color_group);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 char *AW_get_color_group_name(AW_root *awr, int color_group); 55 55 56 56 void AW_init_color_group_defaults(const char *for_program); -
trunk/WINDOW/aw_window.hxx
r961 r1003 424 424 int get_index_of_element(AW_selection_list *selection_list, const char *selected_element); 425 425 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); 427 430 428 431 -
trunk/lib/macros/test.amc
r546 r1003 10 10 } 11 11 12 BIO::remote_action($gb_main,"ARB_NT","ARB_NT/new_arb_edit4"); 12 BIO::remote_action($gb_main,"ARB_NT","probe_match"); 13 BIO::remote_action($gb_main,"ARB_NT","probe_design"); 13 14 ARB::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 2 Landscape 3 Center 4 Metric 5 A4 6 100.00 7 Single 8 -2 9 1200 2 10 2 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 12 2 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 14 2 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 16 4 1 -1 0 0 18 13 0.0000 4 195 750 5760 1875 $delete\001 17 4 1 -1 0 0 18 13 0.0000 4 195 885 5760 2250 $rename\001 18 4 1 -1 0 0 18 13 0.0000 4 195 765 5760 2625 $create\001 19 4 1 -1 0 0 18 13 0.0000 4 210 630 5760 3000 $copy\001 20 4 1 -1 0 0 18 13 0.0000 4 210 1170 5760 3375 $check_len\001 21 4 1 -1 0 0 18 13 0.0000 4 210 630 5760 3750 $align\001 22 4 2 -1 0 0 18 14 0.0000 4 195 720 4845 3825 $to:list\001 23 4 0 -1 0 0 18 14 0.0000 4 195 435 900 1875 $list\001 24 4 0 -1 0 0 18 13 0.0000 4 195 675 825 975 $close\001 25 4 2 -1 0 0 18 12 0.0000 4 180 465 8250 975 $help\001 26 4 1 -1 0 0 18 14 0.0000 4 210 1170 1500 1425 Alignments\001 27 4 0 -1 0 0 18 13 0.0000 4 210 2280 975 4725 Maximum Seq. Length\001 28 4 2 -1 0 0 18 13 0.0000 4 210 885 8100 4800 $aligned\001 29 4 2 -1 0 0 18 12 0.0000 4 165 690 8175 6975 $to:rem\001 30 4 0 -1 0 0 18 13 0.0000 4 210 1980 4575 4725 The Sequences are\001 31 4 0 -1 0 0 18 12 0.0000 4 135 1320 975 5550 User Comment\001 32 4 0 -1 0 0 18 12 0.0000 4 165 450 900 5925 $rem\001 33 4 0 -1 0 0 18 13 0.0000 4 165 2505 4575 5175 Default Write Protection\001 34 4 2 -1 0 0 18 13 0.0000 4 210 960 8100 5250 $security\001 35 4 0 -1 0 0 18 13 0.0000 4 210 2040 975 5175 Type of Sequences:\001 36 4 0 -1 0 0 18 12 0.0000 4 135 3210 900 4275 INFO BOX for selected ALIGNMENT\001 37 4 0 -1 0 0 18 13 0.0000 4 210 570 3735 5250 $type\001 38 4 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 2 Landscape 3 Center 4 Metric 5 A4 6 100.00 7 Single 8 -2 9 1200 2 10 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 1 11 1800 375 12 2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 1 13 7200 6000 14 4 0 -1 0 0 18 13 0.0000 4 195 675 1950 900 $close\001 15 4 2 -1 0 0 18 13 0.0000 4 195 960 3375 900 $to:close\001 16 4 0 -1 0 0 18 13 0.0000 4 210 570 6150 825 $help\001 17 4 2 -1 0 0 18 13 0.0000 4 210 855 7050 825 $to:help\001 18 4 2 -1 0 0 18 12 0.0000 4 165 705 6975 2100 $to:mail\001 19 4 0 -1 0 0 18 13 0.0000 4 195 495 1935 3000 $box\001 20 4 2 -1 0 0 18 13 0.0000 4 195 1140 6975 5400 $to:XY:box\001 21 4 2 -1 0 0 18 12 0.0000 4 180 735 2925 5850 $to:Y:go\001 22 4 0 -1 0 0 18 12 0.0000 4 180 495 2025 5850 $Y:go\001 23 4 0 -1 0 0 18 12 0.0000 4 180 4905 2070 2550 Text to submit (info about your system will be added!)\001 24 4 0 -1 0 0 18 12 0.0000 4 165 555 2115 1350 $what\001 25 4 0 -1 0 0 18 12 0.0000 4 165 465 1935 2160 $mail\001 26 4 0 -1 0 0 18 12 0.0000 4 135 1260 2115 1755 Email Address\001
