Changeset 8313
- Timestamp:
- 20/12/11 15:11:49 (5 months ago)
- Location:
- trunk
- Files:
-
- 1 removed
- 48 modified
-
AISC_COM/C/client.c (modified) (3 diffs)
-
AISC_COM/C/server.c (modified) (2 diffs)
-
AISC_COM/C/struct_man.c (modified) (1 diff)
-
ARBDB/adExperiment.cxx (modified) (1 diff)
-
ARBDB/adGene.cxx (modified) (3 diffs)
-
ARBDB/adcache.cxx (modified) (1 diff)
-
ARBDB/adstring.cxx (modified) (3 diffs)
-
ARBDB/adtree.cxx (modified) (2 diffs)
-
ARBDB/arbdb.cxx (modified) (2 diffs)
-
AWT/AWT_sel_boxes.cxx (modified) (1 diff)
-
AWTC/AWTC_next_neighbours.cxx (modified) (1 diff)
-
CONSENSUS_TREE/CT_hash.cxx (modified) (1 diff)
-
CONSENSUS_TREE/CT_part.cxx (modified) (1 diff)
-
CORE/arb_msg.cxx (modified) (1 diff)
-
CORE/arb_strarray.cxx (modified) (1 diff)
-
EDIT4/ED4_main.cxx (modified) (3 diffs)
-
EDIT4/ED4_no_class.cxx (modified) (1 diff)
-
EDIT4/ED4_root.cxx (modified) (2 diffs)
-
EDIT4/ED4_visualizeSAI.cxx (modified) (1 diff)
-
GL/glpng/glpng.c (modified) (2 diffs)
-
MERGE/MG_species.cxx (modified) (1 diff)
-
MULTI_PROBE/MP_main.cxx (modified) (1 diff)
-
MULTI_PROBE/MP_noclass.cxx (modified) (1 diff)
-
MULTI_PROBE/MP_permute.cxx (modified) (1 diff)
-
MULTI_PROBE/MP_probe_combi_statistic.cxx (modified) (1 diff)
-
NALIGNER/ali_prealigner.cxx (modified) (1 diff)
-
NTREE/AP_consensus.cxx (modified) (3 diffs)
-
NTREE/AP_conservProfile2Gnuplot.cxx (modified) (1 diff)
-
NTREE/AP_cprofile.cxx (modified) (1 diff)
-
NTREE/Makefile (modified) (1 diff)
-
NTREE/NT_extern.cxx (modified) (5 diffs)
-
NTREE/ad_ali.cxx (modified) (1 diff)
-
NTREE/ad_transpro.cxx (modified) (1 diff)
-
NTREE/ap_consensus.hxx (deleted)
-
NTREE/nt_internal.h (modified) (1 diff)
-
PGT/arb_interface.cxx (modified) (2 diffs)
-
PGT/config_dialog.cxx (modified) (1 diff)
-
PHYLO/PH_display.cxx (modified) (1 diff)
-
PHYLO/PH_main.cxx (modified) (1 diff)
-
PHYLO/PH_matr.cxx (modified) (1 diff)
-
PROBE/PT_etc.cxx (modified) (2 diffs)
-
PROBE/PT_prefixtree.cxx (modified) (3 diffs)
-
PROBE/pt_prototypes.h (modified) (1 diff)
-
PROBE_DESIGN/probe_design.cxx (modified) (1 diff)
-
PROBE_SET/ps_detect_weak_differences.cxx (modified) (2 diffs)
-
SEQ_QUALITY/SQ_functions.cxx (modified) (2 diffs)
-
SL/NDS/nds.cxx (modified) (1 diff)
-
SL/PRONUC/AP_codon_table.cxx (modified) (1 diff)
-
SL/TREEDISP/TreeCallbacks.cxx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/AISC_COM/C/client.c
r8309 r8313 32 32 static const char *err_connection_problems = "CONNECTION PROBLEMS"; 33 33 34 int aisc_core_on_error = 1; 35 static char *aisc_error; 34 int aisc_core_on_error = 1; 36 35 37 36 #define CORE() \ … … 426 425 return 0; 427 426 } 428 429 430 static int aisc_get_message(aisc_com *link)431 {432 int anz, len;433 long size, magic_number;434 struct timeval timeout;435 fd_set set;436 timeout.tv_sec = 0;437 timeout.tv_usec = 0;438 FD_ZERO (&set);439 FD_SET (link->socket, &set);440 441 if (link->message) free(link->message);442 link->message_type = 0;443 link->message = 0;444 445 anz = select(FD_SETSIZE, &set, NULL, NULL, &timeout);446 447 if (anz) {448 len = aisc_c_read(link->socket, (char *)(link->aisc_mes_buffer), 2*sizeof(long));449 if (len != 2*sizeof(long)) {450 link->error = err_connection_problems;451 PRTERR("AISC_ERROR");452 return -1;453 }454 if (!link->aisc_mes_buffer[0]) {455 link->error = err_connection_problems;456 PRTERR("AISC_ERROR");457 return -1;458 }459 magic_number = link->aisc_mes_buffer[1]-link->magic;460 if (magic_number != AISC_CCOM_MESSAGE) {461 link->error = err_connection_problems;462 PRTERR("AISC_ERROR");463 return -1;464 }465 size = link->aisc_mes_buffer[0];466 if (aisc_add_message_queue(link, size*sizeof(long))) return -1;467 }468 if (link->message_queue) {469 client_msg_queue *msg = (client_msg_queue *)link->message_queue;470 link->message_queue = (int *)msg->next;471 link->message = msg->message;472 link->message_type = msg->message_type;473 free(msg);474 return link->message_type;475 }476 return 0;477 }478 479 480 427 481 428 int aisc_get(aisc_com *link, int o_type, long object, ...) … … 850 797 } 851 798 852 static int aisc_copy(aisc_com *link, int s_type, long source, int father_type,853 long father, int attribute, int object_type, long *object, ...)854 {855 // goes to header: __ATTR__SENTINEL856 int mes_cnt;857 int len;858 va_list parg;859 *object = 0;860 if (s_type != object_type) {861 link->error = "OBJECT_TYPE IS DIFFERENT FROM SOURCE_TYPE";862 PRTERR("AISC_COPY_ERROR");863 CORE();864 return 1;865 }866 867 mes_cnt = 2;868 if ((father_type&0xff00ffff)) {869 link->error = "FATHER UNKNOWN";870 PRTERR("AISC_COPY_ERROR");871 CORE();872 return 1;873 }874 link->aisc_mes_buffer[mes_cnt++] = source;875 link->aisc_mes_buffer[mes_cnt++] = father_type;876 link->aisc_mes_buffer[mes_cnt++] = father;877 link->aisc_mes_buffer[mes_cnt++] = attribute;878 link->aisc_mes_buffer[mes_cnt++] = object_type;879 if (father_type != (attribute & AISC_OBJ_TYPE_MASK)) {880 link->error = "ATTRIBUTE TYPE DON'T FIT OBJECT";881 PRTERR("AISC_COPY_ERROR");882 CORE();883 return 1;884 }885 va_start(parg, object);886 if (!(mes_cnt = aisc_collect_sets(link, mes_cnt, parg, object_type, 9))) return 1;887 link->aisc_mes_buffer[0] = mes_cnt - 2;888 link->aisc_mes_buffer[1] = AISC_COPY+link->magic;889 len = aisc_c_write(link->socket, (const char *)(link->aisc_mes_buffer), mes_cnt * sizeof(long));890 if (!len) {891 link->error = err_connection_problems;892 PRTERR("AISC_COPY_ERROR");893 return 1;894 }895 if (aisc_c_send_bytes_queue(link)) return 1;896 if (aisc_check_error(link)) return 1;897 *object = link->aisc_mes_buffer[0];898 return 0;899 }900 901 902 903 static int aisc_delete(aisc_com *link, int object_type, long source)904 {905 int len, mes_cnt;906 907 mes_cnt = 2;908 link->aisc_mes_buffer[mes_cnt++] = object_type;909 link->aisc_mes_buffer[mes_cnt++] = source;910 link->aisc_mes_buffer[0] = mes_cnt - 2;911 link->aisc_mes_buffer[1] = AISC_DELETE+link->magic;912 len = aisc_c_write(link->socket, (const char *)(link->aisc_mes_buffer), mes_cnt * sizeof(long));913 if (!len) {914 link->error = err_connection_problems;915 PRTERR("AISC_DELETE_ERROR");916 return 1;917 }918 return aisc_check_error(link);919 }920 921 922 static int aisc_find(aisc_com *link,923 int father_type,924 long father,925 int attribute,926 int object_type,927 long *object,928 char *ident)929 {930 int mes_cnt;931 int i, len;932 char *to_free = 0;933 object_type = object_type;934 *object = 0;935 mes_cnt = 2;936 if ((father_type&0xff00ffff)) {937 link->error = "FATHER_TYPE UNKNOWN";938 PRTERR("AISC_FIND_ERROR");939 CORE();940 return 1;941 }942 if (father_type != (attribute & AISC_OBJ_TYPE_MASK)) {943 link->error = "ATTRIBUTE TYPE DON'T MACH FATHER";944 PRTERR("AISC_FIND_ERROR");945 CORE();946 }947 link->aisc_mes_buffer[mes_cnt++] = father_type;948 link->aisc_mes_buffer[mes_cnt++] = father;949 link->aisc_mes_buffer[mes_cnt++] = attribute;950 if (!ident) {951 link->error = "IDENT == NULL";952 PRTERR("AISC_FIND_ERROR");953 CORE();954 return 1;955 }956 len = strlen(ident);957 if (len >= 32) {958 sprintf(errbuf, "len(\'%s\') > 32)", ident);959 link->error = errbuf;960 PRTERR("AISC_FIND_ERROR");961 return 1;962 }963 if (((long)ident) & 3) {964 to_free = ident = strdup(ident);965 }966 len = (len+1)/sizeof(long)+1;967 link->aisc_mes_buffer[mes_cnt++] = len;968 for (i=0; i<len; i++) {969 link->aisc_mes_buffer[mes_cnt++] = ((long *)ident)[i];970 }971 link->aisc_mes_buffer[0] = mes_cnt - 2;972 link->aisc_mes_buffer[1] = AISC_FIND+link->magic;973 len = aisc_c_write(link->socket, (const char *)(link->aisc_mes_buffer), mes_cnt * sizeof(long));974 if (!len) {975 link->error = err_connection_problems;976 PRTERR("AISC_FIND_ERROR");977 return 1;978 }979 if (aisc_check_error(link)) return 1;980 *object = link->aisc_mes_buffer[0];981 if (to_free) free(to_free);982 return 0;983 }984 985 799 /* -------------------------------------------------------------------------------- 986 800 * Note: it's not possible to define unit tests here - they won't execute -
trunk/AISC_COM/C/server.c
r8309 r8313 102 102 103 103 const char *aisc_server_error; 104 static int mdba_make_core = 1;105 104 106 105 const int ERRORBUFSIZE = 256; … … 1167 1166 return 0; 1168 1167 } 1169 1170 static int aisc_talking_count;1171 1168 1172 1169 #ifdef __cplusplus -
trunk/AISC_COM/C/struct_man.c
r8309 r8313 356 356 } 357 357 358 // ------------------------------359 // bytestring functions360 361 static int aisc_server_dllint_2_bytestring(dllpublic_ext * pb, bytestring *bs, int offset)362 {363 int *ptr;364 dllheader_ext * mh;365 if (bs->data) free(bs->data);366 bs->data = 0;367 bs->size = 0;368 if (pb->cnt == 0) return 0;369 370 bs->size = sizeof(int) * pb->cnt;371 ptr = (int *)malloc(bs->size);372 bs->data = (char *)ptr;373 374 for (mh=pb->first; mh; mh=mh->next) {375 *(ptr++) = *(int *) (((char *)mh)+offset);376 }377 return 0;378 }379 380 static int aisc_server_dllstring_2_bytestring(dllpublic_ext * pb, bytestring *bs, int offset)381 {382 int size;383 int *ptr;384 dllheader_ext * mh;385 char *strptr, *str;386 int stringlengths;387 388 if (bs->data) free(bs->data);389 bs->data = 0;390 bs->size = 0;391 if (pb->cnt == 0) return 0;392 393 size = sizeof(int) * (pb->cnt+1);394 stringlengths = 0;395 for (mh=pb->first; mh; mh=mh->next) {396 str = *(char **) (((char *)mh)+offset);397 if (str) {398 stringlengths += strlen(str)+1;399 }400 }401 bs->size = size+stringlengths;402 ptr = (int *)malloc(bs->size);403 bs->data = (char *)ptr;404 strptr = ((char *)ptr)+size;405 406 for (mh=pb->first; mh; mh=mh->next) {407 str = *(char **) (((char *)mh)+offset);408 if (str) {409 size = strlen(str);410 memcpy(strptr, str, size+1);411 *(ptr++) = strptr - bs->data;412 strptr += size + 1;413 }414 else {415 *(ptr++) = 0;416 }417 }418 *(ptr++) = -1;419 return 0;420 } -
trunk/ARBDB/adExperiment.cxx
r8309 r8313 25 25 return EXP_find_experiment_rel_exp_data(EXP_get_experiment_data(gb_species), name); 26 26 } 27 static GBDATA* EXP_expect_experiment(GBDATA *gb_species, const char *name) {28 // find existing experiment29 return GBT_expect_item_rel_item_data(EXP_get_experiment_data(gb_species), "name", name);30 }31 32 27 GBDATA* EXP_first_experiment_rel_exp_data(GBDATA *gb_experiment_data) { 33 28 return GB_entry(gb_experiment_data, "experiment"); -
trunk/ARBDB/adGene.cxx
r8309 r8313 90 90 } 91 91 92 static GBDATA* GEN_create_nonexisting_gene(GBDATA *gb_species, const char *name) {93 return GEN_create_nonexisting_gene_rel_gene_data(GEN_findOrCreate_gene_data(gb_species), name);94 }95 96 92 GBDATA* GEN_find_or_create_gene_rel_gene_data(GBDATA *gb_gene_data, const char *name) { 97 93 GBDATA *gb_gene = 0; … … 122 118 } 123 119 return gb_gene; 124 }125 126 static GBDATA* GEN_find_or_create_gene(GBDATA *gb_species, const char *name) {127 return GEN_find_or_create_gene_rel_gene_data(GEN_findOrCreate_gene_data(gb_species), name);128 120 } 129 121 … … 699 691 } 700 692 701 static GBDATA* GEN_first_pseudo_species_rel_species_data(GBDATA *gb_species_data) {702 GBDATA *gb_species = GBT_first_species_rel_species_data(gb_species_data);703 704 if (!gb_species || GEN_is_pseudo_gene_species(gb_species)) return gb_species;705 return GEN_next_pseudo_species(gb_species);706 }707 708 693 GBDATA* GEN_next_pseudo_species(GBDATA *gb_species) { 709 694 if (gb_species) { -
trunk/ARBDB/adcache.cxx
r8309 r8313 284 284 } 285 285 286 static void gb_flush_cache(GBDATA *gbd) {287 gb_cache& cache = GB_MAIN(gbd)->cache;288 289 while (cache.oldest_entry) {290 gb_cache_idx index = cache.oldest_entry;291 unlink_cache_entry(cache, index);292 flush_cache_entry(cache, index);293 }294 295 gb_assert(cache.sum_data_size == 0);296 }297 298 286 char *GB_set_cache_size(GBDATA *gbd, size_t size) { 299 287 gb_cache& cache = GB_MAIN(gbd)->cache; -
trunk/ARBDB/adstring.cxx
r8309 r8313 71 71 } 72 72 73 static void gbs_uppercase(char *str) {74 char c;75 while ((c=*str)) {76 if ((c<='z') && (c>='a')) *str = c - 'a' + 'A';77 str++;78 }79 }80 81 #if defined(WARN_TODO)82 #warning replace/implement gbs_memcopy by memmove83 #endif84 static void gbs_memcopy(char *dest, const char *source, long len) {85 long i;86 const char *s;87 char *d;88 89 i = len;90 s = source;91 d = dest;92 if (s < d) {93 s += i;94 d += i;95 while (i--) {96 *(--d) = *(--s);97 }98 }99 else {100 while (i--) {101 *(d++) = *(s++);102 }103 }104 }105 106 73 char *GB_memdup(const char *source, size_t len) { 107 74 char *dest = (char *)malloc(len); … … 199 166 200 167 return err; 201 }202 203 static char *gbs_add_path(char *path, char *name) {204 long i, len, found;205 char *erg;206 if (!name) return name;207 if (!path) {208 return 0;209 }210 if (*name == '/') return name;211 found = 0;212 len = strlen(path);213 for (i=0; i<len; i++) {214 if (path[i] == '/') found = i+1;215 }216 len = found + strlen(name);217 erg = (char *)GB_calloc(sizeof(char), (size_t)(len + 1));218 for (i=0; i<found; i++) {219 erg[i] = path[i];220 }221 for (i=found; i<len; i++) {222 erg[i] = name[i-found];223 }224 return erg;225 168 } 226 169 … … 897 840 */ 898 841 899 static char *GBS_fread_string(FILE *in) { 842 static char *GBS_fread_string(FILE *in) { // @@@ should be used when reading things written by GBS_fwrite_string, but it's unused! 900 843 GBS_strstruct *strstr = GBS_stropen(1024); 901 844 int x; -
trunk/ARBDB/adtree.cxx
r8309 r8313 351 351 return gbt_write_tree(gb_main, gb_tree, tree_name, tree, 0); 352 352 } 353 static GB_ERROR GBT_write_plain_tree(GBDATA *gb_main, GBDATA *gb_tree, char *tree_name, GBT_TREE *tree) {354 return gbt_write_tree(gb_main, gb_tree, tree_name, tree, 1);355 }356 357 353 GB_ERROR GBT_write_tree_rem(GBDATA *gb_main, const char *tree_name, const char *remark) { 358 354 return GBT_write_string(GBT_get_tree(gb_main, tree_name), "remark", remark); … … 560 556 } 561 557 562 static GBT_TREE *GBT_read_plain_tree(GBDATA *gb_main, GBDATA *gb_ctree, long structure_size, GB_ERROR *error) {563 GBT_TREE *t;564 565 gb_assert(error && !*error); // expect cleared error566 567 GB_push_transaction(gb_main);568 t = read_tree_and_size_internal(0, gb_ctree, structure_size, 0, error);569 GB_pop_transaction(gb_main);570 571 return t;572 }573 574 558 size_t GBT_count_leafs(const GBT_TREE *tree) { 575 559 if (tree->is_leaf) { -
trunk/ARBDB/arbdb.cxx
r8309 r8313 152 152 } while (0) 153 153 154 155 static char *GB_rel(void *struct_address, long rel_address)156 {157 if (!rel_address) return NULL;158 return (char*)struct_address+rel_address;159 }160 154 161 155 static GB_ERROR GB_safe_atof(const char *str, double *res) { … … 959 953 } 960 954 961 static float *GB_read_floats(GBDATA *gbd) 955 static float *GB_read_floats(GBDATA *gbd) // @@@ unused - check usage of floats 962 956 { 963 957 GB_CFLOAT *f; -
trunk/AWT/AWT_sel_boxes.cxx
r8309 r8313 768 768 } 769 769 770 static void awt_set_long(AW_window *aws, AW_CL varname, AW_CL value) // set an awar771 {772 aws->get_root()->awar((char *)varname)->write_int((long) value);773 }774 775 static void awt_write_string(AW_window *aws, AW_CL varname, AW_CL value) // set an awar776 {777 aws->get_root()->awar((char *)varname)->write_string((char *)value);778 }779 780 781 -
trunk/AWTC/AWTC_next_neighbours.cxx
r8309 r8313 39 39 return dup; 40 40 } 41 42 static void awtc_ff_message(const char *msg) {43 GB_warning(msg);44 }45 46 41 47 42 // ------------------- -
trunk/CONSENSUS_TREE/CT_hash.cxx
r8309 r8313 182 182 } 183 183 184 185 static void hash_print() {186 //! testfunction to print the hashtable187 int i;188 HNODE *hnp;189 190 printf("\n HASHtable \n");191 192 for (i=0; i< HASH_MAX; i++) {193 printf("Key: %d \n", i);194 hnp = Hashlist[i];195 while (hnp) {196 printf("node: count %d node ", hnp->part->percent);197 part_print(hnp->part); printf(" (%d)\n", hnp->part->p[0]);198 hnp = hnp->next;199 }200 }201 }202 203 204 static void sorted_print() {205 //! testfunction to print the sorted linear list206 HNODE *hnp;207 208 printf("\n sorted HASHlist \n");209 210 hnp = Sortedlist;211 while (hnp) {212 printf("node: count %d node ", hnp->part->percent);213 part_print(hnp->part); printf("\n");214 hnp = hnp->next;215 }216 } -
trunk/CONSENSUS_TREE/CT_part.cxx
r8309 r8313 187 187 188 188 189 static void part_setperc(PART *p, int perc) {190 //! set the percentaged appearance of this part in "entrytrees"191 p->percent = perc;192 }193 194 195 static void part_addperc(PART *p, int perc) {196 //! add 'perc' on percent of p197 p->percent += perc;198 }199 200 189 void part_copy(PART *source, PART *destination) { 201 190 //! copy source into destination -
trunk/CORE/arb_msg.cxx
r8310 r8313 156 156 } 157 157 158 static size_t GBS_last_global_string_size() {159 return last_global_string_size;160 }161 162 158 char *GBS_global_string_copy(const char *templat, ...) { 163 159 // goes to header: __ATTR__FORMAT(1) -
trunk/CORE/arb_strarray.cxx
r8309 r8313 126 126 } 127 127 } 128 static void GBT_names_add(StrArray& names, int insert_before, const char *name) {128 void GBT_names_add(ConstStrArray& names, int insert_before, const char *name) { 129 129 // insert a new 'name' before position 'insert_before' 130 130 // if 'insert_before' == -1 (or bigger than array size) -> append at end 131 names.put(strdup(name));132 move_last_elem(names, insert_before);133 }134 void GBT_names_add(ConstStrArray& names, int insert_before, const char *name) {135 131 names.put(name); 136 132 move_last_elem(names, insert_before); -
trunk/EDIT4/ED4_main.cxx
r8309 r8313 43 43 AW_HEADER_MAIN 44 44 45 ED4_root *ED4_ROOT; 46 GBDATA *GLOBAL_gb_main = NULL; // global gb_main for arb_edit4 47 static ED4_database *main_db; 45 ED4_root *ED4_ROOT; 46 GBDATA *GLOBAL_gb_main = NULL; // global gb_main for arb_edit4 48 47 49 48 int TERMINALHEIGHT; // this variable replaces the define … … 68 67 bool last_window_reached; // needed for refreshing all windows (if TRUE refresh/...-flags will be cleared) 69 68 70 static void ED4_config_change_cb(AW_root *) 71 { 72 // @@@ FIXME: ok to be empty ? check! 73 } 74 75 inline void replaceChars(char *s, char o, char n) 76 { 69 inline void replaceChars(char *s, char o, char n) { 77 70 while (1) { 78 71 char c = *s++; … … 153 146 154 147 level--; 155 }156 157 static void baum(const char *id)158 {159 baum(ED4_ROOT->root_group_man->search_ID(id));160 148 } 161 149 -
trunk/EDIT4/ED4_no_class.cxx
r8309 r8313 838 838 ED4_ROOT->get_aww()->hide(); 839 839 ED4_ROOT->get_ed4w()->is_hidden = true; 840 }841 842 static void ED4_load_data(AW_window *aww, AW_CL /*cd1*/, AW_CL /*cd2*/) {843 ED4_ROOT->use_window(aww);844 }845 846 static void ED4_save_data(AW_window *aww, AW_CL /*cd1*/, AW_CL /*cd2*/) {847 ED4_ROOT->use_window(aww);848 840 } 849 841 -
trunk/EDIT4/ED4_root.cxx
r8309 r8313 901 901 } 902 902 903 static void ED4_turnSpecies(AW_window *aw, AW_CL, AW_CL) {904 GB_ERROR error = GB_begin_transaction(GLOBAL_gb_main);905 906 if (!error) {907 AW_root *root = aw->get_root();908 char *name = root->awar(AWAR_SPECIES_NAME)->read_string();909 char *ali = ED4_ROOT->alignment_name;910 GBDATA *gb_species = GBT_expect_species(GLOBAL_gb_main, name);911 GBDATA *gbd = gb_species ? GBT_read_sequence(gb_species, ali) : NULL;912 char *data = gbd ? GB_read_string(gbd) : NULL;913 914 if (!data) error = GB_await_error();915 else {916 long length = GB_read_string_count(gbd);917 918 char T_or_U;919 error = GBT_determine_T_or_U(ED4_ROOT->alignment_type, &T_or_U, "reverse-complement");920 if (!error) {921 GBT_reverseComplementNucSequence(data, length, T_or_U);922 error = GB_write_string(gbd, data);923 }924 }925 926 free(data);927 free(name);928 }929 930 GB_end_transaction_show_error(GLOBAL_gb_main, error, aw_message);931 }932 933 934 903 #if defined(DEBUG) && 0 935 904 … … 1436 1405 1437 1406 #if !defined(NDEBUG) && 0 1438 awmm->insert_menu_topic("turn_sequence", "Turn Sequence", "T", 0, AWM_ALL, ED4_turnSpecies, 1, 0);1439 1407 awmm->insert_menu_topic(0, "Test (test split & merge)", "T", 0, AWM_ALL, ED4_testSplitNMerge, 1, 0); 1440 1408 #endif -
trunk/EDIT4/ED4_visualizeSAI.cxx
r8309 r8313 812 812 } 813 813 814 static bool ED4_SAIs_visualized() {815 return ED4_ROOT->visualizeSAI;816 } -
trunk/GL/glpng/glpng.c
r8309 r8313 251 251 } 252 252 253 static int APIENTRY pngLoadRawF(FILE *fp, pngRawInfo *pinfo) {254 unsigned char header[8];255 png_structp png;256 png_infop info;257 png_infop endinfo;258 png_bytep data;259 png_bytep *row_p;260 double fileGamma;261 262 png_uint_32 width, height;263 int depth, color;264 265 png_uint_32 i;266 267 if (pinfo == NULL) return 0;268 269 fread(header, 1, 8, fp);270 if (!PNG_CHECK_SIG(header, 8)) return 0;271 272 png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);273 info = png_create_info_struct(png);274 endinfo = png_create_info_struct(png);275 276 // DH: added following lines277 if (setjmp(png->jmpbuf))278 {279 png_destroy_read_struct(&png, &info, &endinfo);280 return 0;281 }282 // ~DH283 284 png_init_io(png, fp);285 png_set_sig_bytes(png, 8);286 png_read_info(png, info);287 png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL);288 289 pinfo->Width = width;290 pinfo->Height = height;291 pinfo->Depth = depth;292 293 // --GAMMA--294 checkForGammaEnv();295 if (png_get_gAMA(png, info, &fileGamma))296 png_set_gamma(png, screenGamma, fileGamma);297 else298 png_set_gamma(png, screenGamma, 1.0/2.2);299 300 png_read_update_info(png, info);301 302 data = (png_bytep) malloc(png_get_rowbytes(png, info)*height);303 row_p = (png_bytep *) malloc(sizeof(png_bytep)*height);304 305 for (i = 0; i < height; i++) {306 if (StandardOrientation)307 row_p[height - 1 - i] = &data[png_get_rowbytes(png, info)*i];308 else309 row_p[i] = &data[png_get_rowbytes(png, info)*i];310 }311 312 png_read_image(png, row_p);313 free(row_p);314 315 if (color == PNG_COLOR_TYPE_PALETTE) {316 int cols;317 unsigned char **palette = &pinfo->Palette;318 png_get_PLTE(png, info, (png_colorp *) palette, &cols);319 }320 else {321 pinfo->Palette = NULL;322 }323 324 if (color&PNG_COLOR_MASK_ALPHA) {325 if (color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY_ALPHA)326 pinfo->Components = 2;327 else328 pinfo->Components = 4;329 pinfo->Alpha = 8;330 }331 else {332 if (color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY)333 pinfo->Components = 1;334 else335 pinfo->Components = 3;336 pinfo->Alpha = 0;337 }338 339 pinfo->Data = data;340 341 png_read_end(png, endinfo);342 png_destroy_read_struct(&png, &info, &endinfo);343 344 return 1;345 }346 347 static int APIENTRY pngLoadRaw(const char *filename, pngRawInfo *pinfo) {348 int result;349 FILE *fp = fopen(filename, "rb");350 if (fp == NULL) return 0;351 352 result = pngLoadRawF(fp, pinfo);353 354 if (fclose(fp) != 0) {355 if (result) {356 free(pinfo->Data);357 free(pinfo->Palette);358 }359 return 0;360 }361 362 return result;363 }364 365 253 static int APIENTRY pngLoadF(FILE *fp, int mipmap, int trans, pngInfo *pinfo) { 366 254 GLint pack, unpack; … … 689 577 } 690 578 691 static unsigned int APIENTRY pngBindF(FILE *file, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter) {692 unsigned int id = SetParams(wrapst, magfilter, minfilter);693 694 if (id != 0 && pngLoadF(file, mipmap, trans, info))695 return id;696 return 0;697 }698 699 static void APIENTRY pngSetStencil(unsigned char red, unsigned char green, unsigned char blue) {700 StencilRed = red, StencilGreen = green, StencilBlue = blue;701 }702 703 static void APIENTRY pngSetAlphaCallback(unsigned char (*callback)(unsigned char red, unsigned char green, unsigned char blue)) {704 if (callback == NULL)705 AlphaCallback = DefaultAlphaCallback;706 else707 AlphaCallback = callback;708 }709 710 static void APIENTRY pngSetViewingGamma(double viewingGamma) {711 if (viewingGamma > 0) {712 gammaExplicit = 1;713 screenGamma = 2.2/viewingGamma;714 }715 else {716 gammaExplicit = 0;717 screenGamma = 2.2;718 }719 }720 721 static void APIENTRY pngSetStandardOrientation(int standardorientation) {722 StandardOrientation = standardorientation;723 } -
trunk/MERGE/MG_species.cxx
r8309 r8313 44 44 45 45 const char *MG_left_AWAR_SPECIES_NAME() { return AWAR_SPECIES1; } 46 static const char *MG_right_AWAR_SPECIES_NAME() { return AWAR_SPECIES2; }47 46 48 47 void MG_create_species_awars(AW_root *aw_root, AW_default aw_def) -
trunk/MULTI_PROBE/MP_main.cxx
r8309 r8313 25 25 int anz_elem_marked = 0; 26 26 int anz_elem_unmarked = 0; 27 static int outside_mismatches = 0;28 27 bool pt_server_different = false; 29 30 static double MAXMARKEDFACTOR = 1.0;31 static double MINUNMARKEDFACTOR = 1.0;32 static double SUMMARKEDFACTOR = 1.0;33 static double SUMUNMARKEDFACTOR = 1.0;34 35 28 36 29 MP_Main::MP_Main(AW_root *awr, AWT_canvas *canvas) { -
trunk/MULTI_PROBE/MP_noclass.cxx
r8309 r8313 873 873 874 874 return result; 875 }876 877 static char *MP_remove_comment(char *old_str)878 {879 char *result = strrchr(old_str, '#');880 char *help;881 char *ret_res;882 883 if (!result)884 return strdup(old_str);885 886 *result = 0;887 help = old_str;888 while (*help == ' ' || *help == '\t')889 help ++;890 891 ret_res = strdup(help);892 *result = '#';893 894 return ret_res;895 875 } 896 876 -
trunk/MULTI_PROBE/MP_permute.cxx
r8309 r8313 134 134 } 135 135 136 137 138 static void permutation(int k, int n)139 {140 int h, i, j;141 int c[1000];142 143 c[0] = -1;144 for (i=1; i<k+1; i++)145 c[i] = i;146 147 j = 1;148 149 while (j != 0)150 {151 for (h=1; h<k+1; h++)152 printf("%d ", c[h]);153 printf("\n");154 155 j = k;156 while (c[j] == n-k+j)157 j = j-1;158 c[j] = c[j]+1;159 for (i=j+1; i< k+1; i++)160 c[i] = c[i-1] + 1;161 }162 }163 164 static void permute (int k, int n)165 {166 int i;167 for (i=1; i<k+1; i++)168 {169 printf("\nPermutation k aus n, k = %d, n = %d\n", i, n);170 permutation(i, n);171 }172 173 } -
trunk/MULTI_PROBE/MP_probe_combi_statistic.cxx
r6595 r8313 12 12 #include "MultiProbe.hxx" 13 13 14 extern double MAXMARKEDFACTOR;15 extern double MINUNMARKEDFACTOR;16 extern double SUMMARKEDFACTOR;17 extern double SUMUNMARKEDFACTOR;18 19 14 probe_combi_statistic::probe_combi_statistic(probe **pc, probe_tabs *ps, double exp, double fit, int life_cnt) 20 15 { -
trunk/NALIGNER/ali_prealigner.cxx
r8309 r8313 11 11 #include "ali_prealigner.hxx" 12 12 #include "ali_aligner.hxx" 13 14 static unsigned long random_stat[6] = { 0, 0, 0, 0, 0, 0 };15 13 16 14 void ali_prealigner_mask::insert(ALI_MAP * in_map, float costs) { -
trunk/NTREE/AP_consensus.cxx
r8309 r8313 41 41 * callback to the function 42 42 * AW_window *AP_open_consensus_window( AW_root *aw_root) 43 * and the function void create_consensus_var43 * and the function void AP_create_consensus_var 44 44 * (AW_root *aw_root, AW_default aw_def) has to be called. 45 45 * … … 707 707 } 708 708 709 void create_consensus_var(AW_root *aw_root, AW_default aw_def)709 void AP_create_consensus_var(AW_root *aw_root, AW_default aw_def) 710 710 { 711 711 GB_transaction dummy(GLOBAL_gb_main); … … 816 816 return aws; 817 817 } 818 819 820 /* -----------------------------------------------------------------821 * Function: AP_open_consensus_window( AW_root *aw_root)822 *823 * Arguments:824 *825 * Returns:826 *827 * Description: Draws window, initializes callback for most important828 * function, CON_calculate_cb.829 *830 * NOTE:831 *832 * Global Variables referenced:833 *834 * Global Variables modified:835 *836 * AWARs referenced:837 *838 * AWARs modified:839 *840 * Dependencies: Needs xfig files consens.fig and CON_groups.fig841 * -----------------------------------------------------------------842 */843 static AW_window * AP_open_consensus_window(AW_root *aw_root)844 {845 AW_window_simple *aws = new AW_window_simple;846 aws->init(aw_root, "SIMPLE_CONSENSUS", "SIMPLE CONSENSUS");847 aws->load_xfig("consensus/main.fig");848 849 GB_push_transaction(GLOBAL_gb_main);850 851 aws->button_length(6);852 853 aws->at("cancel"); aws->callback((AW_CB0)AW_POPDOWN);854 aws->create_button("CLOSE", "CLOSE", "C");855 856 aws->at("help"); aws->callback(AW_POPUP_HELP, (AW_CL)"consensus.hlp");857 aws->create_button("HELP", "HELP", "H");858 859 aws->button_length(15);860 aws->at("showgroups"); aws->callback(AW_POPUP, (AW_CL)CON_showgroupswin_cb, 0);861 aws->create_button("SHOW_IUPAC", "show IUPAC...", "s");862 aws->button_length(10);863 864 aws->at("which_species");865 aws->create_toggle_field("tmp/con/which_species", NULL, "");866 aws->insert_toggle("all", "1", "all");867 aws->insert_default_toggle("marked", "1", "marked");868 aws->update_toggle_field();869 870 aws->at("which_alignment");871 awt_create_selection_list_on_alignments(GLOBAL_gb_main, (AW_window *)aws, "tmp/con/alignment", "*=");872 873 aws->button_length(15);874 875 // activation of consensus calculation by button ...876 aws->at("calculate"); aws->callback((AW_CB0)CON_calculate_cb);877 aws->create_button("CALCULATE", "CALCULATE", "C");878 879 aws->at("expert"); aws->callback(AW_POPUP, (AW_CL)AP_open_con_expert_window, 0);880 aws->create_button("EXPERT", "expert...", "e");881 882 aws->at("group");883 aws->create_toggle_field("con/group", NULL, "");884 aws->insert_toggle("on", "1", "on");885 aws->insert_default_toggle("off", "1", "off");886 aws->update_toggle_field();887 888 aws->at("name");889 aws->create_input_field("tmp/con/name", 10);890 891 aws->at("save_box");892 awt_create_selection_list_on_extendeds(GLOBAL_gb_main, aws, "tmp/con/name");893 894 GB_pop_transaction(GLOBAL_gb_main);895 896 return aws;897 }898 899 818 900 819 /* ----------------------------------------------------------------- -
trunk/NTREE/AP_conservProfile2Gnuplot.cxx
r8309 r8313 65 65 66 66 67 static AW_window *AP_createConservationProfileWindow(AW_root *root) { 67 static AW_window *AP_createConservationProfileWindow(AW_root *root) { // @@@ unused! test and add to menu if useful 68 68 69 69 AW_window_simple *aws = new AW_window_simple; -
trunk/NTREE/AP_cprofile.cxx
r8309 r8313 34 34 * callback to the function 35 35 * AW_window *AP_open_cprofile_window( AW_root *aw_root) 36 * and the function void create_consensus_var36 * and the function void AP_create_consensus_var 37 37 * (AW_root *aw_root, AW_default aw_def) has to be called. 38 38 * -
trunk/NTREE/Makefile
r8103 r8313 499 499 500 500 NT_extern.o: ad_trees.hxx 501 NT_extern.o: ap_consensus.hxx502 501 NT_extern.o: map_viewer.hxx 503 502 NT_extern.o: nt_internal.h -
trunk/NTREE/NT_extern.cxx
r8309 r8313 13 13 #include "ntree.hxx" 14 14 #include "ad_trees.hxx" 15 #include "ap_consensus.hxx"16 15 #include "seq_quality.h" 17 16 #include "nt_join.hxx" … … 65 64 AW_window *create_insertchar_window(AW_root *root, AW_default def); 66 65 67 AW_window *AP_open_cprofile_window(AW_root *root);68 69 66 AW_window *create_tree_window(AW_root *aw_root, AWT_graphic *awd); 70 71 static void nt_test_ascii_print(AW_window *aww) {72 AWT_create_ascii_print_window(aww->get_root(), "hello world", "Just a test");73 }74 67 75 68 static void nt_changesecurity(AW_root *aw_root) { … … 211 204 create_trees_var(awr, def); 212 205 DBUI::create_dbui_awars(awr, def); 213 create_consensus_var(awr, def);206 AP_create_consensus_var(awr, def); 214 207 GDE_create_var(awr, def, GLOBAL_gb_main); 215 208 create_cprofile_var(awr, def); … … 291 284 } 292 285 293 static void NT_save_cb(AW_window *aww) {294 char *filename = aww->get_root()->awar(AWAR_DB_PATH)->read_string();295 GB_ERROR error = GB_save(GLOBAL_gb_main, filename, "b");296 delete filename;297 if (error) aw_message(error);298 else AW_refresh_fileselection(aww->get_root(), "tmp/nt/arbdb");299 }300 301 302 286 static void NT_save_quick_cb(AW_window *aww) { 303 287 char *filename = aww->get_root()->awar(AWAR_DB_PATH)->read_string(); … … 467 451 ((AWT_canvas *)ntw)->refresh(); 468 452 } 469 }470 471 static void NT_undo_info_cb(AW_window *, AW_CL undo_type) {472 char *undo_info = GB_undo_info(GLOBAL_gb_main, (GB_UNDO_TYPE)undo_type);473 if (undo_info) {474 aw_message(undo_info);475 }476 delete undo_info;477 453 } 478 454 -
trunk/NTREE/ad_ali.cxx
r8309 r8313 111 111 free(use); 112 112 } 113 static void ed_al_export_sec_cb(AW_window */*aww*/) { 114 aw_message("This Function is not implemented,\nPlease press 'CHECK' to do this"); 115 } 116 static void ed_al_align_cb(AW_window *aww) 117 { 113 114 static void ed_al_align_cb(AW_window *aww) { 118 115 char *use = aww->get_root()->awar("presets/use")->read_string(); 119 116 GB_begin_transaction(GLOBAL_gb_main); -
trunk/NTREE/ad_transpro.cxx
r8309 r8313 748 748 749 749 750 static void create_transpro_menus(AW_window *awmm) {751 awmm->insert_menu_topic("dna_2_pro", "Translate Nucleic to Amino Acid ...", "T", "translate_dna_2_pro.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_dna_2_pro_window, 0);752 awmm->insert_menu_topic("realign_dna", "Realign Nucleic Acid according to Aligned Protein ...", "r", "realign_dna.hlp", AWM_ALL, AW_POPUP, (AW_CL)NT_create_realign_dna_window, 0);753 }754 755 750 void NT_create_transpro_variables(AW_root *root, AW_default db1) 756 751 { -
trunk/NTREE/nt_internal.h
r8309 r8313 18 18 #endif 19 19 20 void AP_create_consensus_var(AW_root *aw_root, AW_default aw_def); 20 21 AW_window *AP_open_con_expert_window(AW_root *aw_root); 21 22 AW_window *AP_open_max_freq_window(AW_root *aw_root); -
trunk/PGT/arb_interface.cxx
r8309 r8313 154 154 } 155 155 156 157 /****************************************************************************158 * REQUEST ARB CONNECTION STATE159 ****************************************************************************/160 static bool ARB_connected() { return global_ARB_available; }161 162 163 156 /**************************************************************************** 164 157 * RETURN CURRENT GBDATA ENTRY … … 728 721 char *get_protein_AWAR() { return get_AWAR(AWAR_PROTEIN_NAME); } 729 722 char *get_gene_AWAR() { return get_AWAR(AWAR_GENE_NAME); } 730 static char *get_config_AWAR() { return get_AWAR(AWAR_CONFIG_CHANGED); }731 723 732 724 -
trunk/PGT/config_dialog.cxx
r8309 r8313 357 357 358 358 /**************************************************************************** 359 * CONVERT INT RGB -> HEX COLOR STRING360 ****************************************************************************/361 static char *rgb2hex(int r, int g, int b)362 {363 // ALL INPUT VALUES IN RANGE?364 if((r < 0) || (g < 0) || (b < 0) ||365 (r > 255) || (g > 255) || (b > 255)) return NULL;366 367 // ALLOCATE MEM FOR HEX COLOR STRING368 char *hex= (char *)malloc(8 * sizeof(char));369 if(!hex) return NULL;370 371 // WRITE COLORS INTO MEM372 if(sprintf(hex, "#%2X%2X%2X", r, g, b) != 3) return NULL;373 374 // RETURN POINTER TO HEX STRING375 return hex;376 }377 378 379 /****************************************************************************380 359 * CONVERT HEX STRING -> INT RGB 381 360 ****************************************************************************/ -
trunk/PHYLO/PH_display.cxx
r8309 r8313 28 28 { 29 29 PH_display::ph_display->monitor_horizontal_scroll_cb(aww); 30 }31 32 void ph_view_matrix_cb(AW_window */*aww*/)33 {34 AW_window *main_win = PH_used_windows::windowList->phylo_main_window;35 36 PH_display::ph_display->initialize(matrix_dpy);37 PH_display::ph_display->display();38 main_win->set_vertical_change_callback((AW_CB2)vertical_change_cb, 0, 0);39 main_win->set_horizontal_change_callback((AW_CB2)horizontal_change_cb, 0, 0);40 30 } 41 31 -
trunk/PHYLO/PH_main.cxx
r8309 r8313 29 29 extern void ph_view_species_cb(AW_window *, AW_CL, AW_CL); 30 30 extern void ph_view_filter_cb(AW_window *, AW_CL, AW_CL); 31 extern void ph_calculate_matrix_cb(AW_window *, AW_CL, AW_CL);31 // extern void ph_calculate_matrix_cb(AW_window *, AW_CL, AW_CL); 32 32 extern void PH_create_save_matrix_window(AW_root *, char *); 33 33 extern void display_status(AW_window *, AW_CL, AW_CL); -
trunk/PHYLO/PH_matr.cxx
r8309 r8313 84 84 } 85 85 86 87 88 89 static void ph_calculate_matrix_cb(AW_window *aww, AW_CL /*cb1*/, AW_CL /*cb2*/) {90 char *cancel, *transformation;91 92 if (!PHDATA::ROOT) {93 aw_message("data_base not opened !!");94 return;95 }96 AW_root *aw_root = aww->get_root();97 98 PH_TRANSFORMATION trans = PH_TRANSFORMATION_NONE;99 transformation=strdup(PH_TRANSFORMATION_JUKES_CANTOR_STRING);100 101 double alpha = 1.0;102 cancel = aw_root->awar("phyl/cancel/chars")->read_string();103 104 printf("\ntransformation: %s", transformation);105 printf("\ncancel: %s\n", cancel);106 107 if (!strcmp(transformation, PH_TRANSFORMATION_JUKES_CANTOR_STRING)) trans = PH_TRANSFORMATION_JUKES_CANTOR;108 else if (!strcmp(transformation, PH_TRANSFORMATION_KIMURA_STRING)) trans = PH_TRANSFORMATION_KIMURA;109 else if (!strcmp(transformation, PH_TRANSFORMATION_TAJIMA_NEI_STRING)) trans = PH_TRANSFORMATION_TAJIMA_NEI;110 else if (!strcmp(transformation, PH_TRANSFORMATION_TAJIMA_NEI_PAIRWISE_STRING)) trans = PH_TRANSFORMATION_TAJIMA_NEI_PAIRWISE;111 else if (!strcmp(transformation, PH_TRANSFORMATION_BANDELT_STRING)) trans = PH_TRANSFORMATION_BANDELT;112 else if (!strcmp(transformation, PH_TRANSFORMATION_BANDELT_JC_STRING)) trans = PH_TRANSFORMATION_BANDELT_JC;113 else if (!strcmp(transformation, PH_TRANSFORMATION_BANDELT2_STRING)) trans = PH_TRANSFORMATION_BANDELT2;114 else if (!strcmp(transformation, PH_TRANSFORMATION_BANDELT2_JC_STRING)) trans = PH_TRANSFORMATION_BANDELT2_JC;115 116 GB_ERROR error = PHDATA::ROOT->calculate_matrix(".-", alpha, trans);117 118 if (error) aw_message(error);119 delete transformation;120 delete cancel;121 if (!error) ph_view_matrix_cb(aww); // call callback directly to see what you did122 }123 124 static void ph_save_matrix_cb(AW_window *aww)125 {126 // save the matrix127 if (PHDATA::ROOT) {128 PHDATA::ROOT->print();129 char *filename = aww->get_root()->awar("tmp/phyl/save_matrix/file_name")->read_string();130 GB_ERROR error = PHDATA::ROOT->save(filename);131 free(filename);132 aww->hide_or_notify(error);133 }134 }135 136 static AW_window *PH_create_save_matrix_window(AW_root *aw_root, char *base_name)137 {138 AW_window_simple *aws = new AW_window_simple;139 aws->init(aw_root, "SAVE_MATRIX", "SAVE MATRIX TO FILE");140 aws->load_xfig("sel_box.fig");141 142 aws->at("close"); aws->callback((AW_CB0)AW_POPDOWN);143 aws->create_button("CLOSE", "CLOSE", "C");144 145 aws->at("save"); aws->callback(ph_save_matrix_cb);146 aws->create_button("SAVE", "SAVE", "S");147 148 aws->callback((AW_CB0)AW_POPDOWN);149 aws->at("cancel");150 aws->create_button("CANCEL", "CANCEL", "C");151 152 AW_create_fileselection(aws, base_name);153 154 return aws;155 }156 157 158 static AW_window *awt_create_select_cancel_window(AW_root *aw_root)159 {160 AW_window_simple *aws = new AW_window_simple;161 aws->init(aw_root, "CANCEL_SELECT", "CANCEL SELECT");162 aws->load_xfig("phylo/cancel.fig");163 164 aws->at("close"); aws->callback((AW_CB0)AW_POPDOWN);165 aws->create_button("CLOSE", "CLOSE", "C");166 167 aws->at("cancel");168 aws->create_input_field("phyl/cancel/chars", 12);169 170 return aws;171 }172 173 174 static AW_window *PH_create_matrix_window(AW_root *aw_root)175 {176 AW_window_simple *aws = new AW_window_simple;177 aws->init(aw_root, "DISTANCE_TABLE", "DistanceTable");178 aws->load_xfig("phylo/matrix.fig");179 aws->button_length(10);180 181 aws->at("close"); aws->callback((AW_CB0)AW_POPDOWN);182 aws->create_button("CLOSE", "CLOSE", "C");183 184 aws->at("point_opts");185 aws->create_option_menu("phyl/matrix/point", "'.'", "0");186 aws->insert_option("forget pair for distancematrix", "0", 0);187 aws->insert_option("use distancetable", "0", 1);188 aws->update_option_menu();189 190 aws->at("minus_opts");191 aws->create_option_menu("phyl/matrix/minus", "'-'", "0");192 aws->insert_option("forget pair for distancematrix", "0", 0);193 aws->insert_option("use distancetable", "0", 1);194 aws->update_option_menu();195 196 aws->at("rest_opts");197 aws->create_option_menu("phyl/matrix/rest", "ambiguity codes", "0");198 aws->insert_option("forget pair for distancematrix", "0", 0);199 aws->insert_option("use distancetable", "0", 1);200 aws->update_option_menu();201 202 aws->at("lower_opts");203 aws->create_option_menu("phyl/matrix/lower", "lowercase chars", "0");204 aws->insert_option("forget pair for distancematrix", "0", 0);205 aws->insert_option("use distancetable", "0", 1);206 aws->update_option_menu();207 208 return (AW_window *)aws;209 } -
trunk/PROBE/PT_etc.cxx
r8309 r8313 96 96 } 97 97 98 static int *table_copy(int *mis_table, int length)99 {100 // copy one mismatch table to a new one allocating memory101 int *result_table;102 int i;103 104 result_table = (int *)calloc(length, sizeof(int));105 for (i=0; i<length; i++)106 result_table[i] = mis_table[i];107 return result_table;108 }109 static void table_add(int *mis_tabled, int *mis_tables, int length)110 {111 // add the values of a source table to a destination table112 int i;113 for (i=0; i<length; i++)114 mis_tabled[i] += mis_tables[i];115 }116 117 98 #define MAX_LIST_PART_SIZE 50 118 99 … … 255 236 } 256 237 257 static int get_clip_max_from_length(int length) {258 // compute clip max using the probe length259 260 int data_size;261 int i;262 double hitperc_zero_mismatches;263 double half_mismatches;264 data_size = psg.data_count * psg.max_size;265 hitperc_zero_mismatches = (double)data_size;266 for (i = 0; i < length; i++) {267 hitperc_zero_mismatches *= .25;268 }269 for (half_mismatches = 0; half_mismatches < 100; half_mismatches++) {270 if (hitperc_zero_mismatches > 1.0 / (3.0 * length))271 break;272 hitperc_zero_mismatches *= (3.0 * length);273 }274 return (int) (half_mismatches);275 }276 277 278 238 void PT_init_base_string_counter(char *str, char initval, int size) 279 239 { -
trunk/PROBE/PT_prefixtree.cxx
r8309 r8313 113 113 } 114 114 115 static int PTM_destroy_mem() {116 //! destroys all leftover memory sources117 int pos;118 long i;119 int sum;120 121 sum = 0;122 for (pos=0; pos<=PTM_MAX_TABLES; pos++) {123 while (PTM.tables[pos]) {124 sum += pos;125 PT_READ_PNTR(((char *)PTM.tables[pos]), i);126 PTM.tables[pos] = (char *)i;127 }128 }129 pt_assert(sum >= 0);130 return sum;131 }132 133 115 static void PTM_free_mem(char *data, int size) { 134 116 //! free memory allocated by PTM_get_mem() … … 153 135 PTM.tables[pos] = data; 154 136 } 155 }156 157 static void PTM_debug_mem()158 {159 #ifdef PTM_DEBUG160 int i;161 for (i=1; i<(PTM_MAX_SIZE>>PTM_LD_ALIGNED); i++) {162 if (PTM.debug[i]) {163 printf("Size %5i used %5li times\n", i, PTM.debug[i]);164 }165 }166 #endif167 137 } 168 138 … … 558 528 } 559 529 560 static void PTD_debug_nodes() 561 { 530 void PTD_debug_nodes() { 562 531 #ifdef ARB_64 563 532 printf ("Inner Node Statistic:\n"); -
trunk/PROBE/pt_prototypes.h
r8309 r8313 83 83 void PTD_put_int(FILE *out, ULONG i); 84 84 void PTD_put_short(FILE *out, ULONG i); 85 void PTD_debug_nodes(void); 85 86 long PTD_write_leafs_to_disk(FILE *out, POS_TREE *node, long pos, long *pnodepos, int *pblock, ARB_ERROR &error); 86 87 ARB_ERROR PTD_read_leafs_from_disk(const char *fname, POS_TREE **pnode) __ATTR__USERESULT; -
trunk/PROBE_DESIGN/probe_design.cxx
r8309 r8313 1332 1332 } 1333 1333 1334 static void print_event(AW_window *aww, AW_CL selection_id, AW_CL name) {1335 char *filename = (char *)name;1336 aww->save_selection_list((AW_selection_list *)selection_id, filename);1337 }1338 1339 1334 // ------------------------------------------------------------------- 1340 1341 1335 1342 1336 inline void my_strupr(char *s) { -
trunk/PROBE_SET/ps_detect_weak_differences.cxx
r8311 r8313 34 34 35 35 #if defined(DEBUG) 36 static void PS_print_path() {36 void PS_debug_print_path() { 37 37 printf("__PATH %3zu :", __PATH->size()); 38 38 int c = 1; … … 44 44 } 45 45 46 static void PS_print_inverse_path() {46 void PS_debug_print_inverse_path() { 47 47 printf("__INVERSE_PATH %3zu :", __INVERSE_PATH->size()); 48 48 int c = 1; -
trunk/SEQ_QUALITY/SQ_functions.cxx
r8309 r8313 52 52 } 53 53 54 static GB_ERROR SQ_reset_quality_calcstate(GBDATA * gb_main) {55 GB_push_transaction(gb_main);56 57 GB_ERROR error = NULL;58 char *alignment_name = GBT_get_default_alignment(gb_main);59 60 for (GBDATA * gb_species = GBT_first_species(gb_main); gb_species && !error; gb_species61 = GBT_next_species(gb_species)) {62 GBDATA *gb_quality = GB_search(gb_species, "quality",63 GB_CREATE_CONTAINER);64 if (!gb_quality)65 error = GB_get_error();66 else {67 GBDATA *gb_quality_ali = GB_search(gb_quality, alignment_name,68 GB_CREATE_CONTAINER);69 if (!gb_quality_ali) {70 error = no_data_error(gb_quality, alignment_name);71 }72 else {73 GBDATA *gb_calcstate = GB_search(gb_quality_ali, "calcstate",74 GB_INT);75 if (!gb_calcstate)76 error = GB_get_error();77 else {78 GB_write_int(gb_calcstate, CS_CLEAR); // clear calculation state79 }80 }81 }82 }83 free(alignment_name);84 85 if (error)86 GB_abort_transaction(gb_main);87 else88 GB_pop_transaction(gb_main);89 90 return error;91 }92 93 54 GB_ERROR SQ_remove_quality_entries(GBDATA *gb_main) { 94 55 GB_push_transaction(gb_main); … … 106 67 GB_pop_transaction(gb_main); 107 68 return error; 108 }109 110 static int SQ_get_value(GBDATA * gb_main, const char *option) {111 int result = 0;112 char *alignment_name;113 114 GBDATA *gb_species;115 GBDATA *gb_name;116 GBDATA *(*getFirst)(GBDATA *) = 0;117 GBDATA *(*getNext)(GBDATA *) = 0;118 119 GB_push_transaction(gb_main);120 alignment_name = GBT_get_default_alignment(gb_main); seq_assert(alignment_name);121 122 // marked_only123 getFirst = GBT_first_marked_species;124 getNext = GBT_next_marked_species;125 126 for (gb_species = getFirst(gb_main); gb_species; gb_species = getNext(gb_species)) {127 gb_name = GB_entry(gb_species, "name");128 129 if (gb_name) {130 GBDATA *gb_quality = GB_entry(gb_species, "quality");131 if (gb_quality) {132 GBDATA *gb_quality_ali = GB_entry(gb_quality, alignment_name);133 if (gb_quality_ali) {134 GBDATA *gb_result1 = GB_search(gb_quality_ali, option, GB_INT);135 result = GB_read_int(gb_result1);136 }137 }138 }139 }140 free(alignment_name);141 142 GB_pop_transaction(gb_main);143 return result;144 }145 146 static int SQ_get_value_no_tree(GBDATA * gb_main, const char *option) {147 int result = 0;148 char *alignment_name;149 150 GBDATA *read_sequence = 0;151 GBDATA *gb_species;152 GBDATA *gb_name;153 GBDATA *(*getFirst)(GBDATA *) = 0;154 GBDATA *(*getNext)(GBDATA *) = 0;155 156 GB_push_transaction(gb_main);157 alignment_name = GBT_get_default_alignment(gb_main); seq_assert(alignment_name);158 159 // marked_only160 getFirst = GBT_first_marked_species;161 getNext = GBT_next_marked_species;162 163 for (gb_species = getFirst(gb_main); gb_species; gb_species = getNext(gb_species)) {164 gb_name = GB_entry(gb_species, "name");165 if (gb_name) {166 167 GBDATA *gb_ali = GB_entry(gb_species, alignment_name);168 if (gb_ali)169 read_sequence = GB_entry(gb_ali, "data");170 171 GBDATA *gb_quality = GB_search(gb_species, "quality",172 GB_CREATE_CONTAINER);173 if (gb_quality && read_sequence) {174 GBDATA *gb_quality_ali = GB_search(gb_quality, alignment_name,175 GB_CREATE_CONTAINER);176 if (gb_quality_ali) {177 GBDATA *gb_result1 = GB_search(gb_quality_ali, option,178 GB_INT);179 result = GB_read_int(gb_result1);180 }181 }182 }183 }184 free(alignment_name);185 186 GB_pop_transaction(gb_main);187 return result;188 69 } 189 70 -
trunk/SL/NDS/nds.cxx
r8309 r8313 755 755 } 756 756 757 static char *make_node_text_list(GBDATA * gbd, FILE *fp)758 {759 // if mode==0 screen else file760 char *bp;761 const char *p;762 GBDATA *gbe;763 long i;764 long cp;765 char c = 0;766 char fieldname[50];767 768 bp = awt_nds_ms->buf;769 if (!gbd) {770 *bp = 0;771 return awt_nds_ms->buf;772 }773 774 fprintf(fp, "\n------------------- %s\n", GBT_read_name(gbd));775 776 for (i = 0; i < awt_nds_ms->count; i++) {777 if (awt_nds_ms->rek[i]) { // hierarchical key778 gbe = GB_search(gbd, awt_nds_ms->dkeys[i], GB_FIND);779 }780 else { // flat entry781 gbe = GB_entry(gbd, awt_nds_ms->dkeys[i]);782 }783 if (!gbe) continue;784 785 // get field info786 switch (GB_read_type(gbe)) {787 case GB_INT:788 sprintf(bp, "%li", GB_read_int(gbe));789 break;790 case GB_STRING:791 p = GB_read_char_pntr(gbe);792 sprintf(bp, "%s", p);793 break;794 case GB_FLOAT:795 sprintf(bp, "%4.4f", GB_read_float(gbe));796 break;797 default:798 sprintf(bp, "'default:' make_node_text_list!");799 break;800 }801 802 strcpy(fieldname, awt_nds_ms->dkeys[i]); // get fieldname803 804 // print fieldname + start of line805 cp = strlen (bp);806 if (cp>=60) {807 c = bp[60];808 bp[60] = 0;809 }810 fprintf(fp, "%18s: %s\n", fieldname+1, bp);811 if (cp>=60) bp[60] = c;812 813 while (cp > 60) {814 cp -= 60;815 bp += 60;816 if (cp>=60) {817 c = bp[60];818 bp[60] = 0;819 }820 fprintf(fp, "%18s %s\n", "", bp);821 if (cp>=60) bp[60] = c;822 }823 }824 *bp = 0;825 return awt_nds_ms->buf;826 }827 -
trunk/SL/PRONUC/AP_codon_table.cxx
r8309 r8313 742 742 } 743 743 744 745 // get a IUPAC-triple generated by mixing all codons belonging to 'protein'746 static const char *AWT_get_protein_iupac(char protein, int code_nr) {747 if (protein == 'X') return "NNN";748 if (protein == '.') return "...";749 if (protein == '-') return "---";750 751 const char *codons = AP_get_codons(protein, code_nr);752 static char result[] = "xxx";753 754 pn_assert(codons && strlen(codons) >= 3);755 memcpy(result, codons, 3);756 for (int off = 3; codons[off]; off += 3) {757 for (int base = 0; base<3; ++base) {758 result[base] = iupac::combine(result[base], codons[off+base], GB_AT_DNA);759 }760 }761 762 return result;763 }764 765 766 static unsigned char protein_index_def[] = "ABCDEFGHIKLMNPQRSTVWXYZ.-*";767 static char protein_index[256]; // index of protein in protein_2_iupac_table768 static bool protein_index_initialized = 0;769 770 // #define PROTEIN_TABLE_SIZE (26-3+3) // all chars - "JOU" + ".-*"771 #define PROTEIN_TABLE_SIZE sizeof(protein_index_def)772 773 static void initialize_protein_index() {774 memset(protein_index, char(-1), sizeof(protein_index));775 776 for (int i = 0; protein_index_def[i]; ++i) {777 protein_index[protein_index_def[i]] = protein_index[tolower(protein_index_def[i])] = i*3;778 }779 protein_index_initialized = true;780 }781 782 static int protein_2_iupac_tables_initialized_4_code = -1;783 static char protein_2_iupac_table[3*PROTEIN_TABLE_SIZE];784 785 static void initialize_protein_2_iupac_tables(int code_nr) {786 if (!protein_index_initialized) initialize_protein_index();787 if (!codon_tables_initialized) AP_initialize_codon_tables();788 789 memset(protein_2_iupac_table, 0, sizeof(protein_2_iupac_table));790 for (int i = 0; protein_index_def[i]; ++i) {791 char c = protein_index_def[i];792 const char *expanded = AWT_get_protein_iupac(c, code_nr);793 size_t off = i*3;794 795 for (int j = 0; j<3; ++j) {796 protein_2_iupac_table[off+j] = expanded[j]; // write to table797 }798 }799 800 protein_2_iupac_tables_initialized_4_code = code_nr;801 }802 // --------------------------------------------------------------------------------803 // converts a protein sequence to a DNA sequence containing IUPAC codes804 // Example for standard code :805 // 'ABCZ' -> 'GCN RAY TGY SRN'806 // if prot_len == 0 -> prot_len gets calculated807 808 static char *AWT_proteinSeq_2_iupac(const char *proteinSeq, size_t prot_len, int code_nr) {809 if (protein_2_iupac_tables_initialized_4_code != code_nr) {810 initialize_protein_2_iupac_tables(code_nr);811 }812 if (prot_len == 0) prot_len = strlen(proteinSeq);813 814 size_t dna_len = prot_len*3;815 char *result = (char*)malloc(dna_len+1);816 817 size_t didx = 0;818 for (size_t pidx = 0; pidx<prot_len; ++pidx, didx += 3) {819 char prot_idx = protein_index[(unsigned char)proteinSeq[pidx]];820 821 if (prot_idx == -1) { // illegal character822 memcpy(result+didx, "???", 3);823 }824 else {825 memcpy(result+didx, protein_2_iupac_table+prot_idx, 3);826 }827 }828 result[didx] = 0;829 830 return result;831 }832 -
trunk/SL/TREEDISP/TreeCallbacks.cxx
r8309 r8313 267 267 268 268 ntw->refresh(); 269 }270 271 static void NT_mark_color_cb(AW_window *, AW_CL cl_ntw, AW_CL cl_mark_mode)272 {273 AWT_canvas *ntw = (AWT_canvas*)cl_ntw;274 int mark_mode = (int)cl_mark_mode;275 276 GB_transaction gb_dummy(ntw->gb_main);277 278 int color_group = mark_mode>>4;279 td_assert(mark_mode&(4|8)); // either 4 or 8 has to be set280 bool mark_matching = (mark_mode&4) == 4;281 mark_mode = mark_mode&3;282 283 for (GBDATA *gb_species = GBT_first_species(ntw->gb_main); gb_species; gb_species = GBT_next_species(gb_species)) {284 int my_color_group = AW_find_color_group(gb_species, true);285 286 if (mark_matching == (color_group == my_color_group)) {287 switch (mark_mode) {288 case 0: GB_write_flag(gb_species, 0); break;289 case 1: GB_write_flag(gb_species, 1); break;290 case 2: GB_write_flag(gb_species, !GB_read_flag(gb_species)); break;291 default: td_assert(0); break;292 }293 }294 }295 296 ntw->refresh();297 }298 299 300 static void NT_insert_color_mark_submenu(AW_window_menu_modes *awm, AWT_canvas *ntree_canvas, const char *menuname, int mark_basemode) {301 #define MAXLABEL 40302 #define MAXENTRY 20303 awm->insert_sub_menu(menuname, "");304 305 char label_buf[MAXLABEL+1];306 char entry_buf[MAXENTRY+1];307 char hotkey[] = "x";308 const char *hotkeys = "N1234567890 ";309 310 const char *label_base = 0;311 switch (mark_basemode) {312 case 0: label_base = "all_unmark_color"; break;313 case 1: label_base = "all_mark_color"; break;314 case 2: label_base = "all_invert_mark_color"; break;315 default: td_assert(0); break;316 }317 318 for (int all_but = 0; all_but <= 1; ++all_but) {319 const char *entry_prefix;320 if (all_but) entry_prefix = "all but";321 else entry_prefix = "all of";322 323 for (int i = 0; i <= AW_COLOR_GROUPS; ++i) {324 sprintf(label_buf, "%s_%i", label_base, i);325 326 if (i) {327 char *color_group_name = AW_get_color_group_name(awm->get_root(), i);328 sprintf(entry_buf, "%s '%s'", entry_prefix, color_group_name);329 free(color_group_name);330 }331 else {332 sprintf(entry_buf, "%s no color group", entry_prefix);333 }334 335 hotkey[0] = hotkeys[i];336 if (hotkey[0] == ' ' || all_but) hotkey[0] = 0;337 338 awm->insert_menu_topic(label_buf, entry_buf, hotkey, "markcolor.hlp", AWM_ALL,339 NT_mark_color_cb,340 (AW_CL)ntree_canvas,341 (AW_CL)mark_basemode|((all_but == 0) ? 4 : 8)|(i*16));342 }343 if (!all_but) awm->insert_separator();344 }345 346 awm->close_sub_menu();347 #undef MAXLABEL348 #undef MAXENTRY349 269 } 350 270
