Changeset 655

Show
Ignore:
Timestamp:
20/06/02 16:08:07 (10 years ago)
Author:
westram
Message:

Mac OSX patches from Ben Hines

Location:
trunk
Files:
183 modified

Legend:

Unmodified
Added
Removed
  • trunk/AISC/aisc.c

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <string.h> 
    55#include "aisc.h" 
     
    1515                if (gl->lastchar == '\n') gl->line_cnt++;} 
    1616 
    17 char *read_aisc_file(char *path)  
     17char *read_aisc_file(char *path) 
    1818{ 
    1919    FILE *input; 
     
    3838 
    3939 
    40 void  
     40void 
    4141aisc_init() 
    4242{ 
     
    8888        if ((i == (int) ' ') || 
    8989            (i == (int) '\t') || 
    90             (i == (int) '\n')  
     90            (i == (int) '\n') 
    9191            ) { 
    9292            gl->s3_tab[i] = 1; 
     
    107107    } 
    108108    gl->outtab['n'] = '\n'; 
    109     gl->outtab['t'] = '\t';      
    110     gl->outtab['0'] = 0;         
    111     gl->outtab['1'] = 0;         
    112     gl->outtab['2'] = 0;         
    113     gl->outtab['3'] = 0;         
    114     gl->outtab['4'] = 0;         
    115     gl->outtab['5'] = 0;         
    116     gl->outtab['6'] = 0;         
    117     gl->outtab['7'] = 0;         
    118     gl->outtab['8'] = 0;         
    119     gl->outtab['9'] = 0;         
     109    gl->outtab['t'] = '\t'; 
     110    gl->outtab['0'] = 0; 
     111    gl->outtab['1'] = 0; 
     112    gl->outtab['2'] = 0; 
     113    gl->outtab['3'] = 0; 
     114    gl->outtab['4'] = 0; 
     115    gl->outtab['5'] = 0; 
     116    gl->outtab['6'] = 0; 
     117    gl->outtab['7'] = 0; 
     118    gl->outtab['8'] = 0; 
     119    gl->outtab['9'] = 0; 
    120120    gl->outtab['\\'] = 0; 
    121121} 
    122 void  
     122void 
    123123p_err_eof(void) 
    124124{ 
     
    127127    gl->error_flag = 1; 
    128128} 
    129 void  
     129void 
    130130p_error_brih(void) 
    131131{ 
     
    134134    gl->error_flag = 1; 
    135135} 
    136 void  
     136void 
    137137p_error_nobr(void) 
    138138{ 
     
    141141    gl->error_flag = 1; 
    142142} 
    143 void  
     143void 
    144144p_error_nocbr(void) 
    145145{ 
     
    148148    gl->error_flag = 1; 
    149149} 
    150 void  
     150void 
    151151p_error_emwbr(void) 
    152152{ 
     
    155155    gl->error_flag = 1; 
    156156} 
    157 void  
     157void 
    158158p_error_hewnoid(void) 
    159159{ 
     
    162162    gl->error_flag = 1; 
    163163} 
    164 void  
     164void 
    165165p_error_mixhnh(void) 
    166166{ 
     
    169169    gl->error_flag = 1; 
    170170} 
    171 void  
     171void 
    172172p_error_misscom() 
    173173{ 
     
    176176    gl->error_flag = 1; 
    177177} 
    178 void  
     178void 
    179179p_error_missco() 
    180180{ 
     
    427427                                } 
    428428                                break; 
    429                             case 4:      
     429                            case 4: 
    430430                            case 5: 
    431431                                item->val = strdup(""); 
  • trunk/AISC/aisc_commands.c

    r2 r655  
    33#include <string.h> 
    44#include <unistd.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66#include <memory.h> 
    77 
     
    2121    register const char  *s; 
    2222    register char  *d; 
    23      
     23 
    2424    i = len; 
    2525    s = source; 
     
    6767    char *lastbr; 
    6868    char c; 
    69      
     69 
    7070    ld = find_string(&str[2], "$("); 
    7171    fi = 0; 
     
    162162 
    163163 
    164 int  
     164int 
    165165calc_line(char *str, char *buf) 
    166166{ 
     
    181181} 
    182182 
    183 int  
     183int 
    184184calc_line2(char *str, char *buf) 
    185185{                               /* erstes $( nicht auswerten ) !!! */ 
     
    207207} 
    208208 
    209 void  
     209void 
    210210write_aisc(AD * ad, FILE * out, int deep) 
    211211{ 
     
    235235} 
    236236 
    237 void  
     237void 
    238238write_prg(CL * cl, FILE * out, int deep) 
    239239{ 
     
    248248 
    249249 
    250 int  
     250int 
    251251do_com_dbg(char *str) 
    252252{ 
     
    255255    return 0; 
    256256} 
    257 int  
     257int 
    258258do_com_data(char *str) 
    259259{ 
     
    277277} 
    278278 
    279 int  
     279int 
    280280do_com_write(FILE * out, char *str) 
    281281{ 
     
    345345} 
    346346 
    347 int  
     347int 
    348348do_com_print(char *str) 
    349349{ 
     
    351351    return 0; 
    352352} 
    353 int  
     353int 
    354354do_com_print2(char *str) 
    355355{ 
     
    358358} 
    359359 
    360 int  
     360int 
    361361do_com_tabstop(char *str) 
    362362{ 
     
    373373} 
    374374 
    375 int  
     375int 
    376376do_com_tab(char *str) 
    377377{ 
     
    394394} 
    395395 
    396 int  
     396int 
    397397do_com_error(char *str) 
    398398{ 
     
    726726    } 
    727727    gl->pc = fun = (CL *)atol(fn); 
    728          
     728 
    729729    err = calc_line(gl->pc->str, gl->linebuf); 
    730730    if (err)    return err; 
     
    748748        return 1; 
    749749        } 
    750         write_hash(gl->st->hs, fpara, para);     
     750        write_hash(gl->st->hs, fpara, para); 
    751751    } 
    752752    if (*fpara) { 
     
    785785} 
    786786 
    787 int  
     787int 
    788788do_com_for(char *str) 
    789789{ 
     
    888888                &&!strncmp(string,str,len)) { char *s=str+len;\ 
    889889                if (func(s)) break; continue;} 
    890 int  
     890int 
    891891run_prg(void) 
    892892{ 
  • trunk/AISC/aisc_mix.c

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55 
    66#include "aisc.h" 
     
    6666                    co ->next = cod; 
    6767                    co->str = NULL; 
    68                     co->path = strdup(co->path);                         
     68                    co->path = strdup(co->path); 
    6969                    aif->ELSE=co; 
    7070                    aelse = co; 
     
    130130            default: 
    131131                break; 
    132                          
     132 
    133133        } 
    134134        co = co->next; 
     
    246246    register const char *p; 
    247247    register char c; 
    248      
     248 
    249249    p = key; 
    250250    x = 1; 
     
    315315                e->val = 0; 
    316316            } 
    317              
     317 
    318318            return str2; 
    319319        } 
  • trunk/AISC/aisc_var_ref.c

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include "aisc.h" 
    66#include "aisc_proto.h" 
  • trunk/AISC_COM/C/aisc_server.h

    r2 r655  
    88#endif 
    99#include <string.h> 
    10 #include <malloc.h> 
     10// #include <malloc.h> 
    1111#include <memory.h> 
    1212int aisc_make_sets(long *obj);  /* sets in a create request */ 
  • trunk/AISC_COM/C/client.c

    r238 r655  
    22#include <stdio.h> 
    33#include <stdlib.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <unistd.h> 
    66#include <errno.h> 
  • trunk/AISC_COM/C/debug.c

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <ad_varargs.h> 
    66#include <aisc_com.h> 
     
    3232    static bytestring gbs; 
    3333    bptr = &buf[0]; 
    34     va_start(parg,str);  
     34    va_start(parg,str); 
    3535    sm = sc = strdup(str); 
    3636    if (aisc_get(link,AISC_COMMON,object, 
     
    5757        sprintf(bptr,"%30s,",sc); 
    5858        bptr += strlen(bptr); 
    59         sc += strlen(sc)+1;      
     59        sc += strlen(sc)+1; 
    6060        type = code & 0xff000000; 
    6161        er = (long *)aisc_debug_info(link,key,object,(int)code); 
     
    107107                         COMMON_CNT, &anz, 
    108108                         NULL)) return "connection problems"; 
    109             sprintf(bptr,"  %s (%li) */\n",keystr,anz);                  
     109            sprintf(bptr,"  %s (%li) */\n",keystr,anz); 
    110110            bptr += strlen(bptr); 
    111111        }else{ 
  • trunk/AISC_COM/C/server.c

    r555 r655  
    22#include <stdio.h> 
    33#include <stdlib.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <unistd.h> 
    66#include <errno.h> 
     
    2525# endif 
    2626#else 
    27 # if defined(HP) || defined(LINUX) || defined(DIGITAL) 
     27# if defined(HP) || defined(LINUX) || defined(DIGITAL) || defined(DARWIN) 
    2828#  define SIG_PF void (*)(int) 
    2929# endif 
  • trunk/AISC_COM/C/struct_man.c

    r33 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <string.h> 
    55#include "aisc.h" 
     
    351351    bs->size = 0; 
    352352    if (pb->cnt == 0) return 0; 
    353          
     353 
    354354    bs->size = sizeof(int) * pb->cnt; 
    355355    ptr = (int *)malloc(bs->size); 
     
    374374    bs->size = 0; 
    375375    if (pb->cnt == 0) return 0; 
    376          
     376 
    377377    size = sizeof(int) * (pb->cnt+1); 
    378378    stringlenghts = 0; 
  • trunk/ALIV3/BI_helix.cxx

    r65 r655  
    33#include <string.h> 
    44#include <ctype.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <arbdb.h> 
    77#include <arbdbt.h> 
  • trunk/ALIV3/a3_bihelix.cxx

    r2 r655  
    77#include <string.h> 
    88#include <ctype.h> 
    9 #include <malloc.h> 
     9// #include <malloc.h> 
    1010 
    1111#include "a3_bihelix.hxx" 
     
    3232        long                            pos; 
    3333        BI_PAIR_TYPE            type; 
    34         char                            c;       
     34        char                            c; 
    3535} 
    3636#ifdef LINUX 
     
    9191        pairs[HELIX_PAIR]         = strdup("AU GU"); 
    9292        char_bind[HELIX_PAIR] = strdup("-"); 
    93   
     93 
    9494        pairs[HELIX_WEAK_PAIR]     = strdup("GA GT"); 
    9595        char_bind[HELIX_WEAK_PAIR] = strdup("."); 
     
    164164        return 0; 
    165165} 
    166   
     166 
    167167// ----------------------------------------------------------------------------- 
    168168        char *A3_BI_Helix::init ( char *helix_nr, 
     
    217217                                                if (isdigit(c)) continue; 
    218218                                        } 
    219                                          
     219 
    220220                                        break; 
    221221                                } 
    222222                        } 
    223223                } 
    224                  
     224 
    225225                c = helix[pos]; 
    226226 
     
    292292                        } 
    293293 
    294                         entries[pos].helix_nr            = sident+1;                     
     294                        entries[pos].helix_nr            = sident+1; 
    295295                        entries[stack->pos].helix_nr = sident; 
    296296                } 
  • trunk/ARBDB/EXAMPLES/write_all_species.c

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include <arbdb.h> 
    44int main(int argc,char **argv) 
     
    88    GB_ERROR fehler; 
    99        char *species_name; 
    10     if(argc==1) path=":";  
     10    if(argc==1) path=":"; 
    1111    else path=argv[1]; 
    1212    gb_main=GB_open(path,"r"); 
     
    1717    } 
    1818    fehler=GB_begin_transaction(gb_main); 
    19     if(fehler)  
     19    if(fehler) 
    2020    { 
    2121        printf("fehler:%s\n",fehler); 
     
    3131        gb_speciesname=GB_search(gb_species,"full_name",GB_FIND); 
    3232        if(!gb_speciesname) printf("\n"); 
    33         else  
     33        else 
    3434        { 
    3535            species_name=GB_read_string(gb_speciesname); 
    3636            printf("   %s\n",species_name); 
    3737            free(species_name); 
    38         }    
     38        } 
    3939    } 
    4040    GB_commit_transaction(gb_main); 
    41  
    42     
     41} 
    4342 
     43 
  • trunk/ARBDB/ad_core.c

    r566 r655  
    33 
    44#include <string.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66 
    77/*#include "arbdb.h"*/ 
  • trunk/ARBDB/ad_load.c

    r501 r655  
    33#include <errno.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66#include <ctype.h> 
    77#include <sys/stat.h> 
  • trunk/ARBDB/ad_save_load.c

    r454 r655  
    33#include <errno.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66#include <ctype.h> 
    77#include <sys/stat.h> 
  • trunk/ARBDB/adcompr.c

    r318 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <memory.h> 
    55#include <string.h> 
  • trunk/ARBDB/adhash.c

    r2 r655  
    55#include <stdio.h> 
    66#include <stdlib.h> 
    7 #include <malloc.h> 
     7/* #include <malloc.h> */ 
    88#include <string.h> 
    99#include <ctype.h> 
     
    136136        } 
    137137        val = atoi(dp+1); 
    138         GBS_write_hash_no_strdup(hash,str,val);  
     138        GBS_write_hash_no_strdup(hash,str,val); 
    139139    } 
    140140 
     
    200200        return i2; 
    201201    } 
    202          
     202 
    203203    if (val == 0) return 0; 
    204204 
     
    236236        return i2; 
    237237    } 
    238          
     238 
    239239    e = (struct gbs_hash_entry *)gbm_get_mem(sizeof(struct gbs_hash_entry),GBM_HASH_INDEX); 
    240240    e->next = hs->entries[i]; 
     
    283283    for (i = 0; i < e2; i++) { 
    284284        for (e = hs->entries[i]; e; e = ee) { 
    285             free(e->key);  
     285            free(e->key); 
    286286            ee = e->next; 
    287287            gbm_free_mem((char *)e,sizeof(struct gbs_hash_entry),GBM_HASH_INDEX); 
     
    377377    hs->loop_entry = 0; 
    378378} 
    379              
     379 
    380380void GBS_hash_first_element(GB_HASH *hs,const char **key, long *val){ 
    381381    struct gbs_hash_entry *e; 
     
    402402extern "C" { 
    403403#endif 
    404      
     404 
    405405    long g_bs_compare_two_items(void *v0, void *v1, char *unused) { 
    406406        struct gbs_hash_entry *e0 = (struct gbs_hash_entry*)v0; 
    407407        struct gbs_hash_entry *e1 = (struct gbs_hash_entry*)v1; 
    408408        GBUSE(unused); 
    409      
     409 
    410410        return gbh_sort_func(e0->key, e0->val, e1->key, e1->val); 
    411411    } 
     
    619619    register long i; 
    620620    char *data = 0; 
    621      
     621 
    622622    while ( ( (!cs->firstfree_entry) || ( needed_size + cs->sum_data_size >= max_data_size)) 
    623623            && cs->oldest_entry) { 
     
    660660    register long i; 
    661661    char *data = 0; 
    662          
     662 
    663663    data = delete_old_cache_entries(cs, size, cs->max_data_size); /* delete enough old memory */ 
    664664 
     
    685685    cs->entries[i].gbd = gbd; 
    686686    gbd->cache_index = (short)i; 
    687      
     687 
    688688    return data; 
    689689} 
  • trunk/ARBDB/adlang1.c

    r641 r655  
    33#include <unistd.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66#include <ctype.h> 
    77 
  • trunk/ARBDB/adlmacros.h

    r566 r655  
    1919#define GB_DELETE(a)            if (a) GB_FREE(a); a = 0 
    2020 
    21 #if defined(HP) || defined(DIGITAL) 
     21#if defined(HP) || defined(DIGITAL) || defined(DARWIN) 
    2222# undef GB_MEMALIGN 
    2323# define GB_MEMALIGN(a,b) malloc(b) 
  • trunk/ARBDB/admalloc.c

    r2 r655  
    22#include <stdlib.h> 
    33#include <unistd.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <string.h> 
    66#include <limits.h> 
     
    5757 
    5858 
    59 #define GBB_INCR        11              /* memsize increment in percent between  
     59#define GBB_INCR        11              /* memsize increment in percent between 
    6060                                   adjacent clusters */ 
    6161#define GBB_CLUSTERS    64              /* # of different clusters */ 
    6262#define GBB_ALIGN       GBM_LD_ALIGNED  /* align memsize of clusters (# of bits) */ 
    6363#define GBB_MINSIZE     GBM_MAX_SIZE            /* minimal size of allocated big block */ 
    64 #define GBB_MAX_TRIALS  4               /* maximal number of clusters to search  
     64#define GBB_MAX_TRIALS  4               /* maximal number of clusters to search 
    6565                                           for an unused block */ 
    6666#define GBB_MAGIC       0x67823747 
     
    7676struct gbb_data 
    7777{ 
    78         size_t  size;                   /* real size of memblock  
     78        size_t  size;                   /* real size of memblock 
    7979                               (from `content` to end of block) */ 
    8080        long    allocFromSystem;        /* ==0 -> it`s a block imported by gbm_put_mem */ 
    8181 
    82         struct  gbb_freedata content; /* startposition of block returned to user  
     82        struct  gbb_freedata content; /* startposition of block returned to user 
    8383                                     or chain info for free blocks */ 
    8484}; 
     
    8989{ 
    9090    size_t size;  /* minimum size of memblocks in this cluster */ 
    91     struct gbb_data *first; /* first free block */                                                       
    92      
     91    struct gbb_data *first; /* first free block */ 
     92 
    9393} gbb_cluster[GBB_CLUSTERS+1]; 
    9494 
     
    9898    size_t size = nelem*elsize; 
    9999    void *mem = malloc(size); 
    100      
     100 
    101101    if (mem) { 
    102102        memset(mem,0,size); 
     
    118118    size_t nsize = nelem*elsize; 
    119119    void *mem = malloc(nsize); 
    120      
     120 
    121121    if (mem) { 
    122122        size_t osize = oelem*elsize; 
    123          
     123 
    124124        if (nsize>=osize) { 
    125125            memmove(mem, ptr, osize); 
     
    133133    } 
    134134    else { 
    135         fprintf(stderr,"Panic Error:    Unsufficient memory: tried to get %i*%i bytes : Increase Swap space\n",nelem,elsize);    
    136     } 
    137      
     135        fprintf(stderr,"Panic Error:    Unsufficient memory: tried to get %i*%i bytes : Increase Swap space\n",nelem,elsize); 
     136    } 
     137 
    138138    return mem; 
    139139} 
     
    148148 
    149149    flag = 1; 
    150     for (i=0;i<GBM_MAX_INDEX;i++)  
     150    for (i=0;i<GBM_MAX_INDEX;i++) 
    151151    { 
    152152        memset((char *)&gbm_global[i],0,sizeof(struct gbm_struct)); 
     
    155155    gbm_global2.old_sbrk = (char *)sbrk(0); 
    156156 
    157     /* init GBB:  
     157    /* init GBB: 
    158158     * --------- */ 
    159159 
     
    162162 
    163163    for (i=1; i<GBB_CLUSTERS; i++) 
    164     {    
     164    { 
    165165        long nextSize = gbb_cluster[i-1].size * (100+GBB_INCR); 
    166                  
     166 
    167167        nextSize /= 100; 
    168168        nextSize >>= GBB_ALIGN; 
     
    178178    /* last cluster contains ALL bigger blocks */ 
    179179 
    180     gbb_cluster[GBB_CLUSTERS].size  = INT_MAX;   
     180    gbb_cluster[GBB_CLUSTERS].size  = INT_MAX; 
    181181    gbb_cluster[GBB_CLUSTERS].first = NULL; 
    182182 
     
    184184 
    185185#if (defined(DEBUG) && 0) 
    186     {    
    187  
    188         int i;   
     186    { 
     187 
     188        int i; 
    189189 
    190190        for (i=200; i<3000; i+=1) 
    191191        { 
    192192            char *someMem = (char*)calloc(1,(size_t)i); 
    193                          
     193 
    194194            if (someMem) gbb_put_memblk(someMem,i); 
    195195        } 
    196196    } 
    197 #endif      
     197#endif 
    198198} 
    199199 
    200200void GB_memerr(void) 
    201 {        
     201{ 
    202202    GB_internal_error("memory allocation error - maybe you're out of swap space?"); 
    203203} 
     
    215215        struct gbb_Cluster *cl = &(gbb_cluster[idx]); 
    216216        struct gbb_data *blk = cl->first; 
    217                                  
     217 
    218218        while (blk) 
    219219        { 
     
    241241} 
    242242 
    243 static int getClusterIndex(size_t size) /* searches the index of the  
    244                                            lowest cluster for that:  
    245                                            size <= cluster->size */  
     243static int getClusterIndex(size_t size) /* searches the index of the 
     244                                           lowest cluster for that: 
     245                                           size <= cluster->size */ 
    246246{ 
    247247        int l,m,h; 
     
    251251        l = 1; 
    252252        h = GBB_CLUSTERS; 
    253          
     253 
    254254        while (l!=h) 
    255255        { 
     
    257257                if (gbb_cluster[m].size < size)  l = m+1; 
    258258                else                             h = m; 
    259         }                
     259        } 
    260260 
    261261        ad_assert(l<=GBB_CLUSTERS); 
     
    264264} 
    265265 
    266 void gbb_put_memblk(char *memblk, size_t size) /* gives any memory block (allocated or not)  
     266void gbb_put_memblk(char *memblk, size_t size) /* gives any memory block (allocated or not) 
    267267                                                  into the responsibility of this module; 
    268268                                                  the block has to be aligned!!! */ 
    269269{ 
    270         struct gbb_data  *block;                 
     270        struct gbb_data  *block; 
    271271        int idx; 
    272272 
     
    277277#endif 
    278278 
    279         if (size<(GBB_HEADER_SIZE+GBB_MINSIZE))  
    280         {        
    281                 GB_internal_error("gmb_put_memblk() called with size below %i bytes",  
     279        if (size<(GBB_HEADER_SIZE+GBB_MINSIZE)) 
     280        { 
     281                GB_internal_error("gmb_put_memblk() called with size below %i bytes", 
    282282                          GBB_HEADER_SIZE+GBB_MINSIZE); 
    283283                return; 
     
    286286        block                  = (struct gbb_data *)memblk; 
    287287        block->size            = size-GBB_HEADER_SIZE; 
    288         block->allocFromSystem = 0;      
    289          
    290         idx = getClusterIndex(block->size)-1;    
     288        block->allocFromSystem = 0; 
     289 
     290        idx = getClusterIndex(block->size)-1; 
    291291        ad_assert(idx>=0); 
    292          
     292 
    293293        block->content.next     = gbb_cluster[idx].first; 
    294294        block->content.magic    = GBB_MAGIC; 
    295         gbb_cluster[idx].first  = block;                 
     295        gbb_cluster[idx].first  = block; 
    296296 
    297297        ad_assert(idx==GBB_CLUSTERS || block->size>=gbb_cluster[idx].size); 
     
    303303        struct gbb_data  *block = NULL; 
    304304        int               trials = GBB_MAX_TRIALS, 
    305         idx;     
     305        idx; 
    306306 
    307307        TEST(); 
     
    309309        idx = getClusterIndex(size); 
    310310        ad_assert(gbb_cluster[idx].size>=size); 
    311          
     311 
    312312        while (trials--)        /* search a cluster containing a block */ 
    313313        { 
     
    318318 
    319319        if (!block) /* if no unused block -> allocate from system */ 
    320         {        
     320        { 
    321321                int allocationSize; 
    322322 
     
    331331 
    332332                block->size = allocationSize-GBB_HEADER_SIZE; 
    333                 block->allocFromSystem = 1;                              
     333                block->allocFromSystem = 1; 
    334334 
    335335                ad_assert(block->size>=size); 
     
    347347                        while ((block=*blockPtr)!=NULL && block->size<size) 
    348348                                blockPtr = &(block->content.next); 
    349                          
     349 
    350350                        if (!block) goto allocFromSys; 
    351351                        ad_assert(block->size>=size); 
     
    384384        nsize = (size + (GBM_ALIGNED - 1)) & (-GBM_ALIGNED); 
    385385 
    386         if (nsize > GBM_MAX_SIZE)  
     386        if (nsize > GBM_MAX_SIZE) 
    387387        { 
    388388                ggi->extern_data_size += nsize; 
    389389                ggi->extern_data_items++; 
    390                  
     390 
    391391                erg = gbb_get_memblk((size_t)nsize); 
    392392                return erg; 
     
    394394 
    395395        pos = nsize >> GBM_LD_ALIGNED; 
    396         if ( (gds = ggi->tables[pos]) )  
     396        if ( (gds = ggi->tables[pos]) ) 
    397397        { 
    398398                ggi->tablecnt[pos]--; 
    399399                erg = (char *)gds; 
    400                 if (gds->magic != GBM_MAGIC)  
     400                if (gds->magic != GBM_MAGIC) 
    401401                { 
    402402                    printf("%lX!= %lX\n",gds->magic,(long)GBM_MAGIC); 
     
    405405                } 
    406406                ggi->tables[pos] = ggi->tables[pos]->next; 
    407         }  
    408         else  
    409         { 
    410                 if (ggi->size < nsize)  
     407        } 
     408        else 
     409        { 
     410                if (ggi->size < nsize) 
    411411                { 
    412412                        struct gbm_table_struct *gts = (struct gbm_table_struct *)GB_MEMALIGN(gbm_system_page_size, GBM_TABLE_SIZE); 
     
    428428        ggi->useditems[pos]++; 
    429429        GB_MEMSET(erg,0,nsize); 
    430          
     430 
    431431        return erg; 
    432432} 
     
    443443        nsize = (size + (GBM_ALIGNED - 1)) & (-GBM_ALIGNED); 
    444444 
    445         if (nsize > GBM_MAX_SIZE)  
     445        if (nsize > GBM_MAX_SIZE) 
    446446        { 
    447447                struct gbb_data *block; 
     
    453453                        block->size = size-GBB_HEADER_SIZE; 
    454454                        block->allocFromSystem = 0; 
    455                          
     455 
    456456                        /* printf("put mapped Block (size=%li)\n", size); */ 
    457457 
    458458                        if (size>=(GBB_HEADER_SIZE+GBB_MINSIZE)) 
    459459                                gbb_put_memblk((char*)block, size); 
    460                  
     460 
    461461                } 
    462462                else 
    463463                { 
    464                         block = (struct gbb_data *)(data-GBB_HEADER_SIZE);               
    465                  
     464                        block = (struct gbb_data *)(data-GBB_HEADER_SIZE); 
     465 
    466466                        ggi->extern_data_size -= (size_t)nsize; 
    467467                        ggi->extern_data_items--; 
     
    469469                        if (block->size<size) { imemerr("block size does not mach"); return; } 
    470470 
    471                         if (block->allocFromSystem)  
     471                        if (block->allocFromSystem) 
    472472                        { 
    473473                                /* printf("free %li bytes\n", size);  */ 
    474474                                free((char *)block); 
    475475                        } 
    476                         else  
     476                        else 
    477477                        { 
    478478                                /* printf("put unused block (size=%li block->size=%li)\n", 
     
    481481                        } 
    482482                } 
    483         }  
    484         else  
     483        } 
     484        else 
    485485        { 
    486486            if (gb_isMappedMemory(data)) return;        /*       @@@ reason: size may be shorter */ 
    487                 if ( ((struct gbm_data_struct *)data)->magic == GBM_MAGIC)  
     487                if ( ((struct gbm_data_struct *)data)->magic == GBM_MAGIC) 
    488488                        /* double free */ 
    489                 {        
     489                { 
    490490                        imemerr("double free"); 
    491491                        return; 
     
    510510    long index_total; 
    511511    struct gbm_struct *ggi; 
    512      
     512 
    513513    printf("Memory Debug Information:\n"); 
    514514    for (index = 0; index < GBM_MAX_INDEX; index++) 
     
    555555        } 
    556556    } 
    557      
     557 
    558558    { 
    559559        char *topofmem = (char *)sbrk(0); 
  • trunk/ARBDB/admath.c

    r2 r655  
    11#include <stdlib.h> 
    22#include <stdio.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <string.h> 
    55#include <math.h> 
     
    1313    static double *res = 0; 
    1414    if (n<=1) return 0.0;       /* log 1 = 0 */ 
    15      
     15 
    1616    if (n >= max_n){ 
    1717        double sum = 0; 
  • trunk/ARBDB/adquery.c

    r500 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <ctype.h> 
    66 
  • trunk/ARBDB/adseqcompr.c

    r518 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55 
    66#include <adlocal.h> 
     
    1818    unsigned char *data = (unsigned char *)GB_calloc(sizeof(char)*256,len); 
    1919    gcon->len = len; 
    20      
     20 
    2121    for (i=0;i<256;i++){ 
    2222        gcon->con[i] = data + len*i; 
     
    8686 
    8787    memset(seq,'@',gcon->len); 
    88      
     88 
    8989    for (c = 1; c<256;c++){     /* Find maximum frequency of non run */ 
    9090        if (!gcon->used[c]) continue; 
     
    258258    long len = seq_len; 
    259259    d = buffer = (unsigned char *)GB_give_other_buffer(seq,seq_len); 
    260   
     260 
    261261    if (seq_len > master_len){ 
    262262        rest = seq_len - master_len; 
    263263        len = master_len; 
    264264    } 
    265      
     265 
    266266    last = -1000;               /* Convert Sequence relative to Master */ 
    267267    for( i = len; i>0; i--){ 
     
    288288        g_b_put_number2(master_index,&dest2); /* Tags */ 
    289289        g_b_put_number2(q,&dest2); 
    290          
     290 
    291291        gb_compress_equal_bytes_2((char *)buffer,seq_len,memsize,(char *)dest2); /* append runlength compressed sequences to tags */ 
    292          
     292 
    293293        *memsize = *memsize + (dest2-buffer2); 
    294294        return (char *)buffer2; 
     
    320320    GB_MAIN_TYPE *Main = GB_MAIN(gb_main); 
    321321    q = gb_key_2_quark(Main,ali_name); 
    322      
     322 
    323323    do { 
    324324        long seq_len = GBT_get_alignment_len(gb_main,(char *)ali_name); 
     
    330330        leafcount = g_b_count_leafs(tree); 
    331331        if (!leafcount) return 0; 
    332          
     332 
    333333        g_b_number_of_sequences_to_compress = (1 + leafcount) * (2.0 + 1.0 / MAX_SEQUENCE_PER_MASTER); 
    334334        g_b_counter_of_sequences_to_compress = 0; 
     
    353353        g_b_create_master(tree,seqs,masters,-1,ali_name,seq_len); 
    354354    } while(0); 
    355      
     355 
    356356    /* Now compress everything !!! */ 
    357357    { 
     
    371371            GB_Master *master = masters[mi]; 
    372372            GBDATA *gbd = seqs[si].gbd; 
    373              
     373 
    374374            char *seqm = GB_read_string(master->gbd); 
    375375            int master_len = GB_read_string_count(master->gbd); 
     
    385385            ss = gb_compress_sequence_by_master(gbd,seqm,master_len,mi,q,seq,seq_len,&sizes); 
    386386            gb_write_compressed_pntr(gbd,ss,sizes,seq_len); 
    387              
     387 
    388388            GB_status( (++g_b_counter_of_sequences_to_compress) / g_b_number_of_sequences_to_compress); 
    389389 
     
    438438                ss = gb_compress_sequence_by_master(gbd,seqm,master_len,mi,q,seq,seq_len,&sizes); 
    439439                gb_write_compressed_pntr(gbd,ss,sizes,seq_len); 
    440              
     440 
    441441                g_b_counter_of_sequences_to_compress++; 
    442442                GB_status(g_b_counter_of_sequences_to_compress / g_b_number_of_sequences_to_compress); 
    443              
     443 
    444444                sumnew+= sizes; 
    445445                free(seqm); 
     
    471471    if (Main->transaction>0){ 
    472472        GB_internal_error("Internal Error: Compress Sequences called during a running transacton"); 
    473         return GB_export_error("Internal Error: Compress Sequences called during a running transacton");  
     473        return GB_export_error("Internal Error: Compress Sequences called during a running transacton"); 
    474474    } 
    475475    GB_request_undo_type(gb_main,GB_UNDO_KILL); 
     
    604604 
    605605char *gb_uncompress_by_sequence(GBDATA *gbd, const char *s,long size, GB_ERROR *error){ 
    606     register char *dest;     
     606    register char *dest; 
    607607    GB_MAIN_TYPE *Main; 
    608608    GBDATA *gb_main; 
     
    613613    long master_size; 
    614614    char *to_free; 
    615      
     615 
    616616    *error = 0; 
    617      
     617 
    618618    if (!GB_FATHER(gbd)) { 
    619619        *error = "Cannot uncompress this sequence: Sequence has no father"; 
    620620        return 0; 
    621621    } 
    622      
     622 
    623623    Main = GB_MAIN(gbd); 
    624624    gb_main = (GBDATA *)Main->data; 
    625625 
    626626    to_free = gb_check_out_buffer(s); /* Get our own buffer, maybe load_single_key_data will destroy it */ 
    627          
     627 
    628628    index = g_b_read_number2((unsigned char **)&s); 
    629629    quark = g_b_read_number2((unsigned char **)&s); 
    630          
     630 
    631631    if (!Main->keys[quark].gb_master_ali){ 
    632632        gb_load_single_key_data(gb_main,quark); 
     
    636636        return 0; 
    637637    } 
    638          
     638 
    639639    gb_master = gb_find_by_nr(Main->keys[quark].gb_master_ali,index); 
    640640    if (!gb_master){ 
  • trunk/ARBDB/adsocket.c

    r569 r655  
    66#include <sys/time.h> 
    77#include <errno.h> 
    8 #include <malloc.h> 
     8/* #include <malloc.h> */ 
    99#include <string.h> 
    1010#include <memory.h> 
  • trunk/ARBDB/adsort.c

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <memory.h> 
    55 
     
    1212        compare(2,3) should be  <0; 
    1313        compare(x,x)            = 0; 
    14         compare(4,3)            >0;  
     14        compare(4,3)            >0; 
    1515 
    1616*/ 
     
    7979    while(i<mid) buffer[dest++] = array[i++]; 
    8080    while(j<end) buffer[dest++] = array[j++]; 
    81      
     81 
    8282    memcpy( (char *)(array+start),(char *)buffer,(int)size * sizeof(void *)); 
    83      
     83 
    8484    if (size>=256) free((char *)buffer); 
    85      
     85 
    8686    return error; 
    8787} 
  • trunk/ARBDB/adstring.c

    r569 r655  
    33#include <string.h> 
    44#include <ctype.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66 
    77#include "adlocal.h" 
  • trunk/ARBDB/adsystem.c

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55 
    66#include <sys/types.h> 
     
    2424    size = GB_read_bytes_count(gb_dict); 
    2525    GB_write_security_write(gb_dict,7); 
    26      
     26 
    2727    idata = (GB_NINT *)data; 
    28     dict->words = ntohl(*idata++);                       
     28    dict->words = ntohl(*idata++); 
    2929    dict->textlen = (int)(size - sizeof(GB_NINT)*(1+dict->words*2)); 
    30      
    31     dict->offsets = idata;       
     30 
     31    dict->offsets = idata; 
    3232    dict->resort =  idata+dict->words; 
    33     dict->text = (unsigned char*)(idata+2*dict->words);  
     33    dict->text = (unsigned char*)(idata+2*dict->words); 
    3434 
    3535    return dict; 
     
    4848        Main->keys[q].dictionary = 0; 
    4949        Main->keys[q].gb_key = 0; 
    50     }else{  
     50    }else{ 
    5151        gb_load_single_key_data(gbd,q); 
    5252    } 
     
    7171        return; 
    7272    } 
    73      
     73 
    7474    gb_main = (GBDATA *)Main->data; 
    7575    if (key[0] == '@'){ 
     
    8585        if (gb_name){ 
    8686            gb_key= GB_get_father(gb_name); 
    87         }else{   
     87        }else{ 
    8888            gb_key = gb_create_container(gb_key_data,"@key"); 
    8989            gb_name = gb_create(gb_key,"@name",GB_STRING); 
    9090            GB_write_string(gb_name,key); 
    9191        } 
    92          
     92 
    9393        GB_ensure_callback(gb_key,(GB_CB_TYPE)(GB_CB_CHANGED|GB_CB_DELETE),gb_system_key_changed_cb,(int *)q); 
    94          
     94 
    9595        ks->compression_mask = (int)GBT_read_int2(gb_key,"compression_mask",-1); 
    9696        gb_dict = GB_find(gb_key,"@dictionary",0,down_level); 
     
    134134        if (gb_name){ 
    135135            gb_key= GB_get_father(gb_name); 
    136         }else{   
     136        }else{ 
    137137            gb_key = gb_create_container(gb_key_data,"@key"); 
    138138            gb_name = gb_create(gb_key,"@name",GB_STRING); 
    139139            GB_write_string(gb_name,key); 
    140140        } 
    141         gb_dict = gb_search(gb_key,"@dictionary",GB_BYTES,1);  
     141        gb_dict = gb_search(gb_key,"@dictionary",GB_BYTES,1); 
    142142        error = GB_write_bytes(gb_dict,dict,size); 
    143143        GB_pop_my_security(gb_main); 
     
    155155    GBDATA *gb_key,*gb_next_key=0; 
    156156    int key; 
    157      
     157 
    158158    Main->gb_key_data = gb_key_data; 
    159159    if (!Main->local_mode) return 0;    /* do not create anything at the client side */ 
     
    181181    gb_key_2_quark(Main,"@dictionary"); 
    182182    gb_key_2_quark(Main,"compression_mask"); 
    183      
     183 
    184184    for (key=1;key<Main->sizeofkeys;key++){ 
    185185        char *k = Main->keys[key].key; 
     
    187187        gb_load_single_key_data(gb_main,key); 
    188188    } 
    189      
     189 
    190190 
    191191    GB_pop_my_security(gb_main); 
  • trunk/ARBDB/adtools.c

    r651 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <memory.h> 
    66#include <math.h> 
  • trunk/ARBDB/arbdb.c

    r297 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <sys/types.h> 
    66#include <netinet/in.h> 
     
    2222{ 
    2323    if (!rel_adress) return NULL; 
    24     return (char*)struct_adress+rel_adress;      
     24    return (char*)struct_adress+rel_adress; 
    2525} 
    2626/******************************************************************************************** 
     
    6161 
    6262/******************************************************************************************** 
    63                                         compression tables  
     63                                        compression tables 
    6464********************************************************************************************/ 
    6565int gb_convert_type_2_compression_flags[] = { 
     
    269269                return 0; 
    270270    } 
    271      
     271 
    272272    do { 
    273273                if (index_pos<0 ) break; 
     
    368368    data = GB_GETDATA(gbd); 
    369369    if (!data) return 0; 
    370     if (gbd->flags.compressed_data) {   /* uncompressed data return pntr to  
     370    if (gbd->flags.compressed_data) {   /* uncompressed data return pntr to 
    371371                                                                                   database entry       */ 
    372372                char *ca = gb_read_cache(gbd); 
     
    446446    size = GB_GETSIZE(gbd); 
    447447    if (!size) return 0; 
    448     {    
     448    { 
    449449                char *ca = gb_read_cache(gbd); 
    450450                char *da; 
     
    661661} 
    662662 
    663 int gb_get_compression_mask(GB_MAIN_TYPE *Main, GBQUARK key, int gb_type)  
     663int gb_get_compression_mask(GB_MAIN_TYPE *Main, GBQUARK key, int gb_type) 
    664664{ 
    665665    struct gb_key_struct *ks = &Main->keys[key]; 
     
    676676} 
    677677 
    678 GB_ERROR GB_write_pntr(GBDATA *gbd,const char *s, long bytes_size, long stored_size)  
     678GB_ERROR GB_write_pntr(GBDATA *gbd,const char *s, long bytes_size, long stored_size) 
    679679{ 
    680680    GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
     
    683683    int compression_mask; 
    684684    long memsize; 
    685      
     685 
    686686    gb_free_cache(Main,gbd); 
    687687    gb_save_extern_data_in_ts(gbd); 
    688688 
    689689    compression_mask = gb_get_compression_mask(Main, key, GB_TYPE(gbd)); 
    690      
     690 
    691691    if (compression_mask){ 
    692692                d = gb_compress_data(gbd, key, s, bytes_size, &memsize, compression_mask, GB_FALSE); 
     
    705705    gb_touch_entry(gbd,gb_changed); 
    706706    GB_DO_CALLBACKS(gbd); 
    707      
     707 
    708708    return 0; 
    709709} 
     
    711711GB_ERROR GB_write_string(GBDATA *gbd,const char *s) 
    712712{ 
    713     long size;     
     713    long size; 
    714714    /*fprintf(stderr, "GB_write_string(%p, %s);\n", gbd, s);*/ 
    715715    GB_TEST_WRITE(gbd,GB_STRING,"GB_write_string"); 
     
    773773    GB_TEST_WRITE(gbd,GB_INTS,"GB_write_ints"); 
    774774    GB_TEST_NON_BUFFER((char *)i,"GB_write_ints");              /* compress will destroy the other buffer */ 
    775      
     775 
    776776    if ( 0x01020304 != htonl((GB_UINT4)0x01020304) ) { 
    777777                register long j; 
     
    857857    GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
    858858    GB_TEST_TRANSACTION(gbd); 
    859          
     859 
    860860    if (GB_GET_SECURITY_WRITE(gbd)>Main->security_level) 
    861861                return gb_security_error(gbd); 
     
    870870    GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
    871871    GB_TEST_TRANSACTION(gbd); 
    872     if (GB_GET_SECURITY_WRITE(gbd)>Main->security_level)  
     872    if (GB_GET_SECURITY_WRITE(gbd)>Main->security_level) 
    873873                return gb_security_error(gbd); 
    874874    if (GB_GET_SECURITY_READ(gbd) == level) return 0; 
     
    883883    GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
    884884    GB_TEST_TRANSACTION(gbd); 
    885     if (GB_GET_SECURITY_WRITE(gbd)>Main->security_level)   
     885    if (GB_GET_SECURITY_WRITE(gbd)>Main->security_level) 
    886886                return gb_security_error(gbd); 
    887887    if (GB_GET_SECURITY_DELETE(gbd) == level) return 0; 
     
    895895    GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
    896896    GB_TEST_TRANSACTION(gbd); 
    897     if (GB_GET_SECURITY_WRITE(gbd)>Main->security_level)   
     897    if (GB_GET_SECURITY_WRITE(gbd)>Main->security_level) 
    898898                return gb_security_error(gbd); 
    899899    GB_PUT_SECURITY_WRITE(gbd,writelevel); 
     
    924924                return 0; 
    925925    } 
    926      
     926 
    927927    Main->old_security_level = Main->security_level; 
    928928    Main->security_level = 7; 
     
    10061006 
    10071007GBDATA *GB_get_father(GBDATA *gbd) /* Get the father of an entry */ 
    1008 {        
     1008{ 
    10091009    GBDATA *father; 
    10101010 
     
    11071107{ 
    11081108    GBDATA *gb_main; 
    1109      
     1109 
    11101110    GB_TEST_TRANSACTION(source); 
    11111111    if (GB_GET_SECURITY_DELETE(source)>GB_MAIN(source)->security_level) { 
    11121112                return GB_export_error("Security error in GB_delete: %s",GB_read_key_pntr(source)); 
    11131113    } 
    1114      
    1115     gb_main = GB_get_root(source);  
    1116      
     1114 
     1115    gb_main = GB_get_root(source); 
     1116 
    11171117    if (source->flags.compressed_data) { 
    11181118                GB_set_compression(gb_main, 0); /* disable compression */ 
    1119                 gb_set_compression(source); /* write data w/o compression (otherwise GB_read_old_value... won't work) */  
     1119                gb_set_compression(source); /* write data w/o compression (otherwise GB_read_old_value... won't work) */ 
    11201120                GB_set_compression(gb_main, -1); /* allow all types of compressions */ 
    11211121    } 
    1122          
     1122 
    11231123    if (GB_MAIN(source)->transaction<0){ 
    11241124                gb_delete_entry(source); 
    1125                 gb_do_callback_list(gb_main);  
     1125                gb_do_callback_list(gb_main); 
    11261126    }else{ 
    11271127                gb_touch_entry(source,gb_deleted); 
     
    11731173                case GB_LINK:           /* No local compression */ 
    11741174                        error = GB_write_link(dest,GB_read_link_pntr(source)); 
    1175                         break;   
     1175                        break; 
    11761176                case GB_BITS:           /* only local compressions for the following types */ 
    11771177                case GB_BYTES: 
     
    11831183                                                        GB_GETDATA(source)); 
    11841184                        dest->flags.compressed_data     = source->flags.compressed_data; 
    1185          
     1185 
    11861186                        break; 
    11871187                case GB_DB: 
    1188          
     1188 
    11891189                        destc = (GBCONTAINER *)dest; 
    11901190                        sourcec = (GBCONTAINER *)source; 
    1191          
     1191 
    11921192                        if (GB_TYPE(destc) != GB_DB) 
    11931193                        { 
     
    11971197                                return err; 
    11981198                        } 
    1199          
     1199 
    12001200                        if (source->flags2.folded_container)    gb_unfold((GBCONTAINER *)source,-1,-1); 
    12011201                        if (dest->flags2.folded_container)      gb_unfold((GBCONTAINER *)dest,0,-1); 
     
    12061206                        { 
    12071207                                GB_TYPES type2 = (GB_TYPES)GB_TYPE(gb_p); 
    1208              
     1208 
    12091209                                key = GB_read_key_pntr(gb_p); 
    12101210                                if (type2 == GB_DB) 
    12111211                                { 
    12121212                                        gb_d = GB_create_container(dest,key); 
    1213                                         gb_create_header_array((GBCONTAINER *)gb_d, ((GBCONTAINER *)gb_p)->d.size);  
     1213                                        gb_create_header_array((GBCONTAINER *)gb_d, ((GBCONTAINER *)gb_p)->d.size); 
    12141214                                } 
    12151215                                else 
     
    12171217                                        gb_d = GB_create(dest,key,type2); 
    12181218                                } 
    1219                  
     1219 
    12201220                                if (!gb_d) return GB_get_error(); 
    12211221                                error = GB_copy(gb_d, gb_p); 
     
    12251225                        destc->flags3 = sourcec->flags3; 
    12261226                        break; 
    1227                                  
     1227 
    12281228                default: 
    1229                         error = GB_export_error("GB_copy error unknown type");  
     1229                        error = GB_export_error("GB_copy error unknown type"); 
    12301230    } 
    12311231    if (error) return error; 
     
    12501250    long type; 
    12511251    char *result = 0; 
    1252      
     1252 
    12531253    GB_TEST_TRANSACTION(gbd); 
    12541254    type = GB_TYPE(gbd); 
    1255      
     1255 
    12561256    if (type==GB_DB) { /* we are a container */ 
    12571257                GBCONTAINER *gbc = (GBCONTAINER*)gbd; 
    12581258                GBDATA *gbp; 
    12591259                int result_length = 0; 
    1260          
     1260 
    12611261                if (gbc->flags2.folded_container) { 
    12621262                        gb_unfold(gbc, -1, -1); 
    12631263                } 
    1264          
     1264 
    12651265                for (gbp = GB_find(gbd, 0, 0, down_level); 
    12661266                         gbp; 
     
    12691269                        const char *key = GB_read_key_pntr(gbp); 
    12701270                        int keylen = strlen(key); 
    1271              
     1271 
    12721272                        if (result) { 
    12731273                                char *neu_result = (char*)malloc(result_length+keylen+1+1); 
    1274                  
     1274 
    12751275                                if (neu_result) { 
    12761276                                        char *p = stpcpy(neu_result, result); 
     
    12781278                                        *p++ = ';'; 
    12791279                                        p[0] = 0; 
    1280                      
     1280 
    12811281                                        free(result); 
    12821282                                        result = neu_result; 
     
    12961296                        } 
    12971297                } 
    1298     }    
     1298    } 
    12991299    else { 
    13001300                result = GB_strdup(";"); 
    13011301    } 
    1302      
     1302 
    13031303    return result; 
    13041304} 
     
    13951395 
    13961396GB_ERROR GB_push_local_transaction(GBDATA *gbd){ /* Starts a read only transaction !!; 
    1397                                                                                                         be shure that all data is cached  
     1397                                                                                                        be shure that all data is cached 
    13981398                                                                                                        be extremely carefull !!!!! */ 
    13991399    GB_MAIN_TYPE *Main = GB_MAIN(gbd); 
     
    14681468                if (error) return error; 
    14691469    } 
    1470     gb_do_callback_list(gbd);           /* do all callbacks  
    1471                                                                            cb that change the db are no problem  
     1470    gb_do_callback_list(gbd);           /* do all callbacks 
     1471                                                                           cb that change the db are no problem 
    14721472                                                                           'cause it's the beginning of a ta */ 
    14731473    Main->clock ++; 
     
    16351635    gb_add_ref_gb_transaction_save(old); 
    16361636    cbl->old = old; 
    1637      
     1637 
    16381638    return 0; 
    16391639} 
     
    17021702    data = GB_GETDATA_TS(ts); 
    17031703    if (!data) return 0; 
    1704     if (ts->flags.compressed_data) {    /* uncompressed data return pntr to  
     1704    if (ts->flags.compressed_data) {    /* uncompressed data return pntr to 
    17051705                                                                                   database entry       */ 
    17061706                size = GB_GETSIZE_TS(ts) * gb_convert_type_2_sizeof[type] + gb_convert_type_2_appendix_size[type]; 
     
    17131713void *GB_read_old_value(){ 
    17141714    char *data; 
    1715      
     1715 
    17161716    if (!g_b_old_callback_list) { 
    17171717                GB_export_error("You cannot call GB_read_old_value outside a ARBDB callback"); 
     
    17241724    data = GB_GETDATA_TS(g_b_old_callback_list->old); 
    17251725    if (!data) return 0; 
    1726      
     1726 
    17271727    return gb_read_pntr_ts(g_b_old_callback_list->gbd, g_b_old_callback_list->old); 
    17281728} 
     
    17951795                } 
    17961796    } 
    1797     return GB_add_callback(gbd,type,func,clientdata);  
     1797    return GB_add_callback(gbd,type,func,clientdata); 
    17981798} 
    17991799/******************************************************************************************** 
     
    18701870    GBCONTAINER *father; 
    18711871    struct gb_header_list_struct *hl, h; 
    1872      
     1872 
    18731873    if (GB_read_clients(gb_main)<0) 
    18741874                return GB_export_error("Sorry: this program is not the arbdb server, you cannot resort your data"); 
     
    18771877                return GB_export_error("There are %i clients (editors, tree programms) connected to this server,\n" 
    18781878                                                           "please close clients and rerun operation", 
    1879                                                            GB_read_clients(gb_main));  
     1879                                                           GB_read_clients(gb_main)); 
    18801880 
    18811881    if (listsize <=0) return 0; 
    1882      
     1882 
    18831883    father = GB_FATHER(new_order_list[0]); 
    18841884    GB_disable_quicksave(gb_main,"some entries in the database got a new order"); 
    18851885    hl = GB_DATA_LIST_HEADER(father->d); 
    18861886 
    1887     for (new_index= 0 ; new_index< listsize; new_index++ )  
     1887    for (new_index= 0 ; new_index< listsize; new_index++ ) 
    18881888    { 
    18891889                long old_index = new_order_list[new_index]->index; 
     
    18981898                        ogb = GB_HEADER_LIST_GBD(hl[old_index]); 
    18991899                        ngb = GB_HEADER_LIST_GBD(hl[new_index]); 
    1900              
     1900 
    19011901                        h = hl[new_index]; 
    19021902                        hl[new_index] = hl[old_index]; 
     
    19051905                        SET_GB_HEADER_LIST_GBD(hl[old_index], ngb ); 
    19061906                        SET_GB_HEADER_LIST_GBD(hl[new_index], ogb ); 
    1907              
     1907 
    19081908                        if ( ngb )      ngb->index = old_index; 
    19091909                        if ( ogb )      ogb->index = new_index; 
     
    19991999    prev = GB_ARRAY_FLAGS(gbc).flags; 
    20002000    gbd->flags.saved_flags = prev; 
    2001      
     2001 
    20022002    if (flag){ 
    20032003                GB_ARRAY_FLAGS(gbc).flags |= ubit; 
     
    20432043    printf("\nDump %p (%i Byte):\n", data, size); 
    20442044 
    2045     while (size--)  
     2045    while (size--) 
    20462046    { 
    20472047                const char *hex = "0123456789abcdef"; 
    20482048                char c = *data++; 
    2049                  
     2049 
    20502050                printf("%c%c ", hex[(c&0xf0)>>4], hex[c&0x0f]); 
    20512051 
     
    20862086    int         size ; 
    20872087    GB_MAIN_TYPE *Main; 
    2088          
     2088 
    20892089    if (gbd==NULL) { printf("NULL\n"); return -1; } 
    20902090    GB_push_transaction(gbd); 
     
    20942094                printf("        "); 
    20952095    } 
    2096      
     2096 
    20972097    printf("(GBDATA*)0x%lx (GBCONTAINER*)0x%lx ",(long)gbd,(long)gbd); 
    2098      
     2098 
    20992099    if (gbd->rel_father==0)     { printf("father=NULL\n"); return -1; } 
    21002100 
     
    21132113                        size = gbc->d.size; 
    21142114                        printf("Size %i nheader %i hmemsize %i", gbc->d.size, gbc->d.nheader, gbc->d.headermemsize); 
    2115                         printf(" father=(GBDATA*)0x%lx\n", (long)GB_FATHER(gbd));  
     2115                        printf(" father=(GBDATA*)0x%lx\n", (long)GB_FATHER(gbd)); 
    21162116                        if (size < GB_info_deep){ 
    21172117                                int index; 
     
    21282128                        data = GB_read_as_string(gbd); 
    21292129                        if (data) {printf("%s",data); free(data);} 
    2130                         printf(" father=(GBDATA*)0x%lx\n", (long)GB_FATHER(gbd));  
     2130                        printf(" father=(GBDATA*)0x%lx\n", (long)GB_FATHER(gbd)); 
    21312131    } 
    21322132 
    21332133 
    21342134    GB_pop_transaction(gbd); 
    2135      
    2136     return 0; 
    2137 } 
    2138  
    2139  
    2140 int GB_info(GBDATA *gbd)  
     2135 
     2136    return 0; 
     2137} 
     2138 
     2139 
     2140int GB_info(GBDATA *gbd) 
    21412141{ 
    21422142    return gb_info(gbd,0); 
     
    21472147    GBCONTAINER *gbc; 
    21482148    GB_TYPES type = (GB_TYPES)GB_TYPE(gbd); 
    2149      
     2149 
    21502150    switch(type) 
    21512151    { 
    2152                 case GB_DB:                     /* @@@ client size < actual size!!! => use GB_rescan_number_of_subentries() from client */  
     2152                case GB_DB:                     /* @@@ client size < actual size!!! => use GB_rescan_number_of_subentries() from client */ 
    21532153                        gbc = (GBCONTAINER *)gbd; 
    21542154                        return gbc->d.size; 
     
    21602160long GB_rescan_number_of_subentries(GBDATA *gbd) { 
    21612161        /* this is just a workaround for the above function, cause GB_number_of_subentries does not work in clients; it's used in ARB_EDIT4 */ 
    2162      
     2162 
    21632163    GBCONTAINER *gbc = (GBCONTAINER *)gbd; 
    21642164    /*    int userbit = GBCONTAINER_MAIN(gbc)->users[0]->userbit; */ 
  • trunk/ARBDBPP/adseq.cxx

    r2 r655  
    88#include <stdlib.h> 
    99#include <memory.h> 
    10 #include <malloc.h> 
     10// #include <malloc.h> 
    1111#include <string.h> 
    1212#include <ctype.h> 
     
    9898    gb_markdata = 0; 
    9999    inited_object = 0; 
    100     return 0;  
    101 } 
    102          
     100    return 0; 
     101} 
     102 
    103103AD_ERR * AD_STAT::initpntr() { 
    104104    if (gb_markdata == 0) { 
     
    152152    } 
    153153    return 0; 
    154 }        
     154} 
    155155 
    156156AD_ERR * AD_STAT::first() { 
     
    242242    // behandelt ein update der Markierung in der Datenbank 
    243243    // problem -> wenn editiert wird ni 
    244     //  
     244    // 
    245245    // 
    246246{ 
     
    251251        ad_mark->gb_markdata = gb_char_mark; 
    252252        ad_mark->initpntr(); 
    253          
     253 
    254254    } 
    255255    if (gb_char_mark == ad_mark->GB_FLOAT_mark) { 
     
    261261        ad_mark->initpntr(); 
    262262    } 
    263          
     263 
    264264    ad_mark->updated = 1;       // flag setzen 
    265265    return 0; 
    266266} 
    267267 
    268          
     268 
    269269char * AD_STAT::getbits() { 
    270270    if (marktype != ad_bits) { 
     
    294294AD_ERR *AD_STAT::put() { 
    295295    char *error; 
    296     if (gb_char_mark == 0 && GB_FLOAT_mark == 0 && GB_INT_mark == 0)  
    297         return new AD_ERR("AD_SEQ::write not possible!");        
     296    if (gb_char_mark == 0 && GB_FLOAT_mark == 0 && GB_INT_mark == 0) 
     297        return new AD_ERR("AD_SEQ::write not possible!"); 
    298298    if (GB_FLOAT_mark != 0) { 
    299299        error = (char *)GB_write_floats(GB_FLOAT_mark,markdatafloat,nmark); 
     
    306306        if (error != 0) { 
    307307            return new AD_ERR(error); 
    308         }        
     308        } 
    309309    } 
    310310    if  (GB_INT_mark != 0) { 
     
    312312        if (error != 0) { 
    313313            return new AD_ERR(error); 
    314         }        
    315     }            
     314        } 
     315    } 
    316316    return 0; 
    317317} 
     
    346346    return 0; 
    347347} 
    348          
     348 
    349349AD_ERR *AD_STAT::put(GB_UINT4 *markings, int len) { 
    350350    if (marktype != ad_ints) { 
    351351        return new AD_ERR("*AD_STAT::put(int * ... WRONG TYPE",CORE); 
    352     }    
     352    } 
    353353    markdataint = markings; 
    354354    nmark = len; 
     
    359359AD_TYPES AD_STAT::type() { 
    360360    return marktype; 
    361 }        
    362  
    363  
    364          
     361} 
     362 
     363 
     364 
    365365 
    366366/********************* 
     
    377377    // behandelt ein update der sequenz in der Datenbank 
    378378    // problem -> wenn editiert wird ni 
    379     //  
    380379    // 
     380    // 
    381381{ 
    382382    long new_time_stamp; 
    383     if (gb_seq != ad_seq->gb_seq)  
     383    if (gb_seq != ad_seq->gb_seq) 
    384384        new AD_ERR("AD_SEQ: WRONG update callback",CORE); 
    385385    new_time_stamp = GB_read_clock(gb_seq); 
     
    401401AD_SEQ::AD_SEQ() 
    402402{ 
    403     memset(this,0,sizeof(AD_SEQ));      // no virtual members !!!  
     403    memset(this,0,sizeof(AD_SEQ));      // no virtual members !!! 
    404404} 
    405405 
     
    411411        delete seq; 
    412412        seq = 0; 
    413     }    
     413    } 
    414414} 
    415415 
     
    447447        gbdataptr = gb_seq; 
    448448        return 0; 
    449     } else       
    450         return new      AD_ERR("AD_SEQ: exit() without init()");         
     449    } else 
     450        return new      AD_ERR("AD_SEQ: exit() without init()"); 
    451451} 
    452452 
     
    469469        else    gb_seq = 0; 
    470470    } 
    471          
     471 
    472472    if (gb_seq) { 
    473473        if (!nseq_but_filter) { 
     
    512512    delete seq; 
    513513    seq = (char *)malloc((size_t)seq_len + 1); 
    514     strncpy(seq,sequenz,(int)seq_len);   
     514    strncpy(seq,sequenz,(int)seq_len); 
    515515    for ( i = laenge; i < seq_len; i++) { 
    516516        seq[i] = SEQ_POINT; 
     
    521521    return 0; 
    522522} 
    523          
     523 
    524524char * AD_SEQ::get() 
    525525{ 
     
    535535{ 
    536536    char *error; 
    537     if (gb_seq == 0)  
     537    if (gb_seq == 0) 
    538538        return new AD_ERR("AD_SEQ::write not possible!"); 
    539539    if (nseq_but_filter) { 
     
    580580        } 
    581581        for (i = seq_len - text_len; i<seq_len; i++) { 
    582             if (!ADPP_IS_ALIGN_CHARACTER(seq[i])) {  
     582            if (!ADPP_IS_ALIGN_CHARACTER(seq[i])) { 
    583583                return new AD_ERR("AD_SEQ::insert: end of alignment reached !"); 
    584584            } 
     
    587587            seq[i+text_len] = seq[i]; 
    588588        } 
    589          
     589 
    590590        for (i = 0 ;i<text_len;i++) { 
    591591            seq[position + i] = text[i]; 
     
    596596        } 
    597597        for (i = 0; i<text_len; i++) { 
    598             if (!ADPP_IS_ALIGN_CHARACTER(seq[i])) {  
     598            if (!ADPP_IS_ALIGN_CHARACTER(seq[i])) { 
    599599                return new AD_ERR("AD_SEQ::insert: start of alignment reached !"); 
    600600            } 
     
    603603            seq[i] = seq[i+text_len]; 
    604604        } 
    605          
     605 
    606606        for (i = 0 ;i<text_len;i++) { 
    607607            seq[position - i -1] = text[i]; 
     
    609609    } 
    610610    return 0; 
    611 }        
    612   
     611} 
     612 
    613613AD_ERR  * AD_SEQ::remove(int len,long position, int direction) { 
    614614    long new_len; 
     
    640640    return 0; 
    641641} 
    642          
     642 
    643643 
    644644AD_ERR * AD_SEQ::replace(char *text,long position, int direction) { 
     
    933933                    changed_flag = 1; 
    934934                    cursorpos += direction; 
    935                 }                                        
     935                } 
    936936            }else{ 
    937937                if (ADPP_IS_ALIGN_CHARACTER(seq[cursorpos+offset])){ 
     
    944944        default: 
    945945            break; 
    946                                  
     946 
    947947    } 
    948948    if (ad_err) cursorpos = oldcursorpos; 
     
    963963    return this->get_ad_main()->mode; 
    964964} 
    965          
     965 
    966966 
    967967 
     
    969969 
    970970/*************************** 
    971 AD_CONT  
     971AD_CONT 
    972972container wird mit spezies,alignment initialisiert 
    973973entspricht ungefaehr dem ali_xxx container der ARB DB 
     
    993993{ 
    994994    if (!con_insert(adptr1,adptr2)) // test ob container schoneinmal initialisiert 
    995         return new AD_ERR("AD_CONT::init  ONLY ONE AD_CONT PER SPECIES/ALIGN");  
     995        return new AD_ERR("AD_CONT::init  ONLY ONE AD_CONT PER SPECIES/ALIGN"); 
    996996    ad_species = adptr1; 
    997997    ad_ali      = adptr2; 
  • trunk/ARBDBPP/adt_edit.cxx

    r2 r655  
    33#include <stdlib.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <memory.h> 
    77#include <arbdb.h> 
     
    5454                local_char_array[i] = (char) i; 
    5555        } 
    56         return local_char_array;         
     56        return local_char_array; 
    5757} 
    5858 
     
    6060AD_ERR * ADT_COMPLEMENT::complement_compile(void) {  //Veraendert Zeichensatz 
    6161 
    62         delete char_array;                       
     62        delete char_array; 
    6363        char_array = make_char_array(); 
    6464 
     
    127127 
    128128        seq_buff = (char *)calloc( ((int)buffer_len + 1), sizeof(char) ); 
    129         memset(seq_buff, (int)'.', ((int)buffer_len));  
     129        memset(seq_buff, (int)'.', ((int)buffer_len)); 
    130130        sequence_buffer = seq_buff; 
    131131 
    132          
     132 
    133133        ind_buff = (long *) calloc( ((int)buffer_len + 1), sizeof(long) ); 
    134134        ind_buff[buffer_len] = -1; 
     
    175175        mistakes_allowed        = 0; 
    176176        gaps                    = -1;           //gaps werden nicht ignoriert 
    177         upper_eq_lower          =  0;           //gross/KLEIN-Schreibung,  
    178         t_equal_u               =  0;           //t und u gleichbehandeln,  
     177        upper_eq_lower          =  0;           //gross/KLEIN-Schreibung, 
     178        t_equal_u               =  0;           //t und u gleichbehandeln, 
    179179        search_start_cursor_pos =  0; 
    180180        replace_start_cursor_pos=  0; 
     
    200200                search_array[i] = (char) i; 
    201201        } 
    202         return search_array;     
     202        return search_array; 
    203203} 
    204204 
    205205//*********************************** 
    206206                        //Veraendert Zeichensatz, Liefert Matchpattern ohne Gaps 
    207 AD_ERR * ADT_SEARCH::compile(void) {             
    208         delete search_array;                     
     207AD_ERR * ADT_SEARCH::compile(void) { 
     208        delete search_array; 
    209209        search_array = show_search_array(); 
    210210 
     
    230230                        char    *matchp_buffer_start, *matchp_buffer_loop; 
    231231 
    232                         matchp_buffer_start = matchp_buffer_loop =  
     232                        matchp_buffer_start = matchp_buffer_loop = 
    233233                                                        matchpattern_buffer; 
    234234 
    235                         for( matchp_copy_loop = matchpattern ;  
    236                                 *matchp_copy_loop != '\0' ;  
     235                        for( matchp_copy_loop = matchpattern ; 
     236                                *matchp_copy_loop != '\0' ; 
    237237                                                        matchp_copy_loop++ ) { 
    238238                                if(*matchp_copy_loop != '-') { 
     
    255255// 
    256256//************************************************************************** 
    257 AD_ERR * ADT_SEQUENCE::make_sequence_buffer(ADT_SEARCH  
     257AD_ERR * ADT_SEQUENCE::make_sequence_buffer(ADT_SEARCH 
    258258                                      *ptr_adt_search, ADT_EDIT *ptr_adt_edit) { 
    259259 
     
    270270        seq_buffer_start = (char *)calloc(strlen(seq_anfang)+1,sizeof(char)); 
    271271 
    272         if (!seq_buffer_start) {  
     272        if (!seq_buffer_start) { 
    273273//              printf("\n**** ERROR sequence-buffer no memory allocated"); 
    274274        } 
     
    279279        seq_index_start = (long *) calloc(strlen(seq_anfang)+1,sizeof(long)); 
    280280 
    281         if (!seq_index_start) {  
     281        if (!seq_index_start) { 
    282282//              printf("\n**** ERROR index-buffer no memory allocated"); 
    283283        } 
     
    290290                if(*seq_copy_loop != '-') { 
    291291                        *(seq_buffer_loop++) = source;  //kopiert Zeichen 
    292                         *(seq_index_loop++)  = seq_copy_loop - seq_anfang;       
     292                        *(seq_index_loop++)  = seq_copy_loop - seq_anfang; 
    293293                                                        //Index des Zeichens 
    294294                        } 
     
    296296        *seq_buffer_loop        = '\0'; 
    297297        *seq_index_loop         = -1; 
    298         ptr_adt_search->seq_anfang = seq_buffer_start; //SEQUENCE START  
     298        ptr_adt_search->seq_anfang = seq_buffer_start; //SEQUENCE START 
    299299        //--------------------------------------------------end sequencebuffer 
    300300 
     
    305305        long    buffer_index = 0;               //zaehlvariable fuer 
    306306                                                //Cursorberechnung 
    307         for(  buffer_index = 0 ;  
    308                         (seq_index_start[buffer_index] <  
    309                                                        var_cursorpos_editor) &&  
     307        for(  buffer_index = 0 ; 
     308                        (seq_index_start[buffer_index] < 
     309                                                       var_cursorpos_editor) && 
    310310                                  (seq_index_start[buffer_index] != -1 ) ; 
    311311                                                        buffer_index++ ) { 
     
    321321                if( (seq_index_start[buffer_index] == var_cursorpos_editor) && 
    322322                                                 (var_cursorpos_editor > 0) ) { 
    323                         ptr_adt_search->search_start_cursor_pos =  
     323                        ptr_adt_search->search_start_cursor_pos = 
    324324                                                           buffer_index + 1; 
    325325                } 
    326326                else { 
    327                         ptr_adt_search->search_start_cursor_pos =  
     327                        ptr_adt_search->search_start_cursor_pos = 
    328328                                                               buffer_index; 
    329                 }        
     329                } 
    330330        } // end if 
    331331        else { 
     
    346346// 
    347347//************************************************************************** 
    348 AD_ERR * ADT_SEQUENCE::rewrite_from_sequence_buffer(ADT_SEARCH  
     348AD_ERR * ADT_SEQUENCE::rewrite_from_sequence_buffer(ADT_SEARCH 
    349349                                    *ptr_adt_search, ADT_EDIT  *ptr_adt_edit) { 
    350350 
     
    355355 
    356356        //--------------------------------found_cursor_pos nach Suche ohne Gaps 
    357         if (( ptr_adt_edit->found_matchp == 1 ) &&  
     357        if (( ptr_adt_edit->found_matchp == 1 ) && 
    358358                        ( ptr_adt_search->replace_option == ADT_NO_REPLACE )) { 
    359                 ptr_adt_search->found_cursor_pos =  
     359                ptr_adt_search->found_cursor_pos = 
    360360                      ptr_adt_search->seq_index_start[found_cursor_pos_buffer]; 
    361361        } 
     
    364364        //---------------------------------------rewrite Seq-Puffer auf Sequenz 
    365365        if( ptr_adt_search->replace_option != ADT_NO_REPLACE )  { 
    366                 seq_buffer_start = ptr_adt_search->seq_anfang;   
     366                seq_buffer_start = ptr_adt_search->seq_anfang; 
    367367                seq_index_start  = ptr_adt_search->seq_index_start; 
    368368                seq_anfang = get(); 
    369369 
    370                 long    buffer_index = 0;               //zaehlvariable  
     370                long    buffer_index = 0;               //zaehlvariable 
    371371                register char source; 
    372372 
    373                 for( ; (source = seq_buffer_start[buffer_index]) ;  
     373                for( ; (source = seq_buffer_start[buffer_index]) ; 
    374374                                                             buffer_index++ ) { 
    375375                        *(seq_anfang + seq_index_start[buffer_index]) = source; 
     
    379379 
    380380                char    *replace_anfang = ptr_adt_search->replace_string; 
    381                 long    var_start_cursor_pos =   
     381                long    var_start_cursor_pos = 
    382382                                       ptr_adt_search->replace_start_cursor_pos; 
    383383 
    384384                //--------------------------------------------cursorpos_editor 
    385                 long  buffer_end_replace =  
     385                long  buffer_end_replace = 
    386386                        var_start_cursor_pos + strlen(replace_anfang); 
    387          
    388                 ptr_adt_edit->actual_cursorpos_editor =  
     387 
     388                ptr_adt_edit->actual_cursorpos_editor = 
    389389                        ptr_adt_search->seq_index_start[buffer_end_replace-1]; 
    390                                         //  nur bei Suchrichtung  
     390                                        //  nur bei Suchrichtung 
    391391                                        //  "Vorwaerts" !!! 
    392392                //----------------------------------------end cursorpos_editor 
     
    411411// 
    412412//************************************************************************** 
    413 AD_ERR * ADT_SEQUENCE::show_edit_seq_search(ADT_SEARCH *ptr_adt_search,  
     413AD_ERR * ADT_SEQUENCE::show_edit_seq_search(ADT_SEARCH *ptr_adt_search, 
    414414                                                     ADT_EDIT *ptr_adt_edit) { 
    415415        AD_ERR  *ad_err; 
     
    421421 
    422422 
    423                                         // Sicherheitsabfrage fuer die  
     423                                        // Sicherheitsabfrage fuer die 
    424424                                        // Rueckwaertssuche !! 
    425         if(ptr_adt_search->search_start_cursor_pos > len()) {    
     425        if(ptr_adt_search->search_start_cursor_pos > len()) { 
    426426                                                //Cursorpos > Sequenzlaenge? 
    427427                ptr_adt_search->search_start_cursor_pos = len() - 1; 
     
    430430        //-----------------------------------------------------Sequenz puffern 
    431431        if( (ptr_adt_search->gaps == 0) ||  (ptr_adt_search->gaps == 1) ) { 
    432                 make_sequence_buffer(ptr_adt_search, ptr_adt_edit);  
     432                make_sequence_buffer(ptr_adt_search, ptr_adt_edit); 
    433433                /////////////////////////////////////////////////// 
    434434        } //end if,  >>Sequenz<< OHNE Gaps. 
    435         //---------------------------------------------------- end seq puffern  
     435        //---------------------------------------------------- end seq puffern 
    436436 
    437437        //---------------------------------Sicherungskopie der Seq fuer REPLACE 
     
    442442 
    443443        //---------------------------------------korrigiert die Start Cursorpos 
    444                                 // bis Ende.., da erst search(), dann replace()  
     444                                // bis Ende.., da erst search(), dann replace() 
    445445        if( ( (ptr_adt_search->replace_option == ADT_REPLACE_ONLY)         || 
    446446              (ptr_adt_search->replace_option == ADT_REPLACE_AND_SEARCH_NEXT)|| 
     
    454454 
    455455        //==================================================================== 
    456         //=================================================while(replace_loop)  
     456        //=================================================while(replace_loop) 
    457457        long max_loop = this->seq_len; 
    458458        do {                                             // END Sequenz/Editor 
    459459 
    460                 //------------------------------------------------------SEARCH   
     460                //------------------------------------------------------SEARCH 
    461461                ptr_adt_edit->found_matchp = 0; 
    462                                                  
     462 
    463463                show_edit_search(ptr_adt_search, ptr_adt_edit); 
    464464                ////////////////////////////////////////////// 
    465                 //------------------------------------------------- END SEARCH  
     465                //------------------------------------------------- END SEARCH 
    466466 
    467467                if( ((ptr_adt_search->replace_option == ADT_REPLACE_ONLY) || 
     
    474474 
    475475                else { 
    476                         ptr_adt_search->replace_start_cursor_pos =  
     476                        ptr_adt_search->replace_start_cursor_pos = 
    477477                                              ptr_adt_search->found_cursor_pos; 
    478478                } 
    479479 
    480                 //---------------------------------------------------- REPLACE  
    481                 if( (ptr_adt_edit->found_matchp == 1) &&  
     480                //---------------------------------------------------- REPLACE 
     481                if( (ptr_adt_edit->found_matchp == 1) && 
    482482                        (ptr_adt_search->replace_option != ADT_NO_REPLACE) ) { 
    483                                                  
     483 
    484484                        ad_err = show_edit_replace(ptr_adt_search,ptr_adt_edit); 
    485                                  //////////////////////////////////////////////  
     485                                 ////////////////////////////////////////////// 
    486486                        if(ad_err)      return ad_err; 
    487487                } 
     
    492492                    (ptr_adt_search->string_replace == 1) )                 { 
    493493                        ptr_adt_search->string_replace = 0; 
    494                         ptr_adt_search->search_start_cursor_pos =  
     494                        ptr_adt_search->search_start_cursor_pos = 
    495495                                ptr_adt_edit->actual_cursorpos_editor + 1; 
    496496                        ptr_adt_search->replace_option = ADT_NO_REPLACE; 
    497497                } 
    498498                                                //---------end repl/find next 
    499                 else  {  
     499                else  { 
    500500                        if( (ptr_adt_search->replace_option ==  ADT_REPLACE_REST_SEQUENCE) || 
    501501                            (ptr_adt_search->replace_option ==  ADT_REPLACE_REST_EDITOR) )  { 
    502502 
    503503                                replace_loop = ptr_adt_search->replace_loop_sequence; 
    504                                 ptr_adt_search->search_start_cursor_pos =  
     504                                ptr_adt_search->search_start_cursor_pos = 
    505505                                                ( ptr_adt_edit->actual_cursorpos_editor + 1 ); 
    506506 
     
    508508                                if( replace_loop == ADT_STOPP_REPLACE ) { 
    509509                                        ptr_adt_edit->found_matchp = 1; 
    510                                 }  
     510                                } 
    511511                                if (max_loop-- <0) replace_loop = ADT_STOPP_REPLACE; 
    512512                        } else { 
     
    536536                        return  ad_err; 
    537537                } 
    538                  
     538 
    539539                show_update(); 
    540540        } 
    541541        //---------------------------------------------------end write into DB 
    542542 
    543         if( (ptr_adt_edit->found_matchp == 1) &&  
    544                                       (ptr_adt_search->string_replace == 0) ) {  
    545                 ptr_adt_edit->actual_cursorpos_editor =  
     543        if( (ptr_adt_edit->found_matchp == 1) && 
     544                                      (ptr_adt_search->string_replace == 0) ) { 
     545                ptr_adt_edit->actual_cursorpos_editor = 
    546546                                               ptr_adt_search->found_cursor_pos; 
    547547        } 
     
    549549                                        //   nichts gefunden, 
    550550        //---------------------------------- cursorpos in next sequence 
    551         if( (ptr_adt_edit->found_matchp == 0)  ||   
     551        if( (ptr_adt_edit->found_matchp == 0)  || 
    552552            (ptr_adt_search->replace_option == ADT_REPLACE_REST_EDITOR) ) { 
    553553                if( ptr_adt_search->search_direction == ADT_SEARCH_FORWARD ) { 
     
    574574// 
    575575//************************************************************************** 
    576 AD_ERR * ADT_SEQUENCE::show_edit_search(ADT_SEARCH *ptr_adt_search,  
     576AD_ERR * ADT_SEQUENCE::show_edit_search(ADT_SEARCH *ptr_adt_search, 
    577577                                                      ADT_EDIT *ptr_adt_edit) { 
    578578 
    579579        char    *seq_anfang, *seq_loop_start, *seq_loop_ptr;    // Suche Sequenz 
    580         char    *matchp_anfang, *matchp_loop_ptr;               // Suche  
     580        char    *matchp_anfang, *matchp_loop_ptr;               // Suche 
    581581                                                                // Matchpattern 
    582582 
     
    584584        long    vorgabefehler, realfehler=0, equal_chars; 
    585585        long    seq_empty_var; 
    586         long    search_var;      
     586        long    search_var; 
    587587 
    588588        search_var      =  ptr_adt_search->search_direction; 
     
    600600 
    601601        //---------------------------------------------------------start search 
    602         for(  ; (*seq_loop_start != '\0') &&  
     602        for(  ; (*seq_loop_start != '\0') && 
    603603                                (seq_loop_start >= seq_anfang) ; 
    604604                                 seq_loop_start+=search_var )     { 
     
    609609                for( matchp_loop_ptr=matchp_anfang ; *matchp_loop_ptr != '\0' ; 
    610610                                                        matchp_loop_ptr++ ) { 
    611                          
     611 
    612612                       unsigned char index_seq = *(unsigned char *)seq_loop_ptr; 
    613613                       unsigned char index_mat=*(unsigned char*)matchp_loop_ptr; 
    614614                        char i_s = ptr_adt_search->search_array[(int)index_seq]; 
    615                         char i_m = ptr_adt_search->search_array[(int)index_mat];                         
     615                        char i_m = ptr_adt_search->search_array[(int)index_mat]; 
    616616                        if( i_m == '?' ) {      // Wilde Karten 
    617617                                equal_chars++; 
     
    624624                                        equal_chars++; 
    625625                                } 
    626                                                 //   mehr Fehler als erlaubt?    
     626                                                //   mehr Fehler als erlaubt? 
    627627                        if(realfehler > vorgabefehler) { 
    628628                                ptr_adt_edit->found_matchp = 0; 
    629629                                break; 
    630630                        } 
    631                                         //gefunden? (noetig, da Restsequenz  
    632                                         //kuerzer  
    633                                         //als Suchstringlaenge sein kann.)    
    634                                         //Fehler + Uebereinstimmungen = Laenge  
     631                                        //gefunden? (noetig, da Restsequenz 
     632                                        //kuerzer 
     633                                        //als Suchstringlaenge sein kann.) 
     634                                        //Fehler + Uebereinstimmungen = Laenge 
    635635                                        //des Matchpatterns 
    636636                        if(realfehler+equal_chars == matchp_len) { 
     
    641641 
    642642                        seq_loop_ptr++;         //  Ende der Sequenz erreicht? 
    643                         if( *seq_loop_ptr == '\0') {            //  
     643                        if( *seq_loop_ptr == '\0') {            // 
    644644                                seq_empty_var = 1; 
    645645                                break; 
     
    648648                } // end for() 
    649649 
    650                 if( *(seq_loop_ptr+1) == '\0') {         
    651                         ptr_adt_search->replace_loop_sequence =  
     650                if( *(seq_loop_ptr+1) == '\0') { 
     651                        ptr_adt_search->replace_loop_sequence = 
    652652                                                            ADT_STOPP_REPLACE; 
    653653                } 
     
    656656                //---------------------------------found cursorpos in sequence 
    657657                if( ptr_adt_edit->found_matchp == 1)  { 
    658                         ptr_adt_search->found_cursor_pos =  
     658                        ptr_adt_search->found_cursor_pos = 
    659659                                                  seq_loop_start - seq_anfang; 
    660660                        break; 
     
    663663 
    664664                if( (ptr_adt_search->replace_option == ADT_REPLACE_ONLY) || 
    665                     (ptr_adt_search->replace_option ==  
     665                    (ptr_adt_search->replace_option == 
    666666                                               ADT_REPLACE_AND_SEARCH_NEXT)) { 
    667667                        break;           //for schleife nur einmal ausfuehren. 
     
    679679//************************************************************************** 
    680680// 
    681 //      Ueberprueft zuerst, ob die Sequenz ab der Cursorposition mit dem  
     681//      Ueberprueft zuerst, ob die Sequenz ab der Cursorposition mit dem 
    682682//      Matchpattern uebereinstimmt. Wenn ja, dann erfolgt die Ersetzung. 
    683683//      Mit GAPS: durch remove(), und insert() der AD_SEQ-Klasse; 
    684 //      Ohne Gaps: direktes ueberschreiben im Sequenzpuffer, danach  
     684//      Ohne Gaps: direktes ueberschreiben im Sequenzpuffer, danach 
    685685//              ueberschreiben der Sequenzkopie im Cache. 
    686 //      Beide Varianten schreiben die geaenderte Sequenz mittels put() in  
     686//      Beide Varianten schreiben die geaenderte Sequenz mittels put() in 
    687687//      die Datenbank zurueck. (Security-Level nicht vergessen!!) 
    688 //  
    689 //************************************************************************** 
    690 AD_ERR * ADT_SEQUENCE::show_edit_replace(ADT_SEARCH *ptr_adt_search,  
    691                                                         ADT_EDIT *ptr_adt_edit)  
     688// 
     689//************************************************************************** 
     690AD_ERR * ADT_SEQUENCE::show_edit_replace(ADT_SEARCH *ptr_adt_search, 
     691                                                        ADT_EDIT *ptr_adt_edit) 
    692692 
    693693{ 
     
    701701        seq_anfang                      =  ptr_adt_search->seq_anfang; 
    702702 
    703         ptr_adt_search->string_replace = 0;  
    704         long    var_start_cursor_pos    =   
     703        ptr_adt_search->string_replace = 0; 
     704        long    var_start_cursor_pos    = 
    705705                                       ptr_adt_search->replace_start_cursor_pos; 
    706706 
     
    718718                //----------------------------------------------------replace 
    719719                seq_loop_ptr = seq_loop_start; 
    720                 for( replace_loop_ptr = replace_anfang ;  
     720                for( replace_loop_ptr = replace_anfang ; 
    721721                            *replace_loop_ptr != '\0' ; replace_loop_ptr++ ) { 
    722722                        *seq_loop_ptr = *replace_loop_ptr; 
     
    724724                } // end for() 
    725725        } // end if(match_len == replace_len) 
    726          
     726 
    727727        else { 
    728728                //-----------------------------------------------------remove 
     
    737737 
    738738                //-----------------------------------------------------insert 
    739                 else if( strlen(replace_anfang) != 0 ){                  
    740                         ad_err = insert( replace_anfang,  
     739                else if( strlen(replace_anfang) != 0 ){ 
     740                        ad_err = insert( replace_anfang, 
    741741                                        (int)var_start_cursor_pos ,1 ); 
    742742 
     
    750750                } 
    751751        } 
    752         //========================================================END REPLACE  
     752        //========================================================END REPLACE 
    753753        //-------------------------------------------------- Cursorpos Editor 
    754         ptr_adt_edit->actual_cursorpos_editor =  
    755                                    ptr_adt_search->replace_start_cursor_pos +  
     754        ptr_adt_edit->actual_cursorpos_editor = 
     755                                   ptr_adt_search->replace_start_cursor_pos + 
    756756                                                   strlen(replace_anfang) - 1; 
    757757        //-----------------------------------------------------END Cursorpos 
     
    781781        //-------------------------------------------------------- border check 
    782782        if( ptr_adt_complement->take_borders == YES ) { 
    783                 if( (ptr_adt_complement->sequence_length - 1) <  
     783                if( (ptr_adt_complement->sequence_length - 1) < 
    784784                                                        ptr_adt_complement->right_border )  { 
    785                         ptr_adt_complement->right_border =  
     785                        ptr_adt_complement->right_border = 
    786786                                                        ptr_adt_complement->sequence_length - 1; 
    787787                } 
    788                 if( (ptr_adt_complement->sequence_length - 1) <  
     788                if( (ptr_adt_complement->sequence_length - 1) < 
    789789                                                        ptr_adt_complement->left_border )  { 
    790790                        return 0; 
     
    819819                        return  ad_err; 
    820820                } 
    821                  
     821 
    822822                show_update(); 
    823823        } 
     
    836836//printf("SEQUENCE:   (ab Cursorpos 200)\n"); 
    837837        //seq_loop+=200; 
    838         for(int k=0; (k<100) && (*seq_loop); k++) {  
     838        for(int k=0; (k<100) && (*seq_loop); k++) { 
    839839                printf("%c", *seq_loop); 
    840840                seq_loop++; 
     
    842842        printf("\n"); 
    843843printf("alignment_length:       %d\n", ptr_adt_complement->alignment_length ); 
    844 printf("Borders [left..right]:  [%d  ..  %d]\n",  
     844printf("Borders [left..right]:  [%d  ..  %d]\n", 
    845845        ptr_adt_complement->left_border, ptr_adt_complement->right_border ); 
    846846printf("seq_is_complemented:    %d\n", ptr_adt_complement->seq_is_complemented ); 
     
    885885 
    886886        //-------------------------------------------------erledigt complement 
    887         for( compl_loop = compl_start;  
     887        for( compl_loop = compl_start; 
    888888             (*compl_loop) && (compl_loop <= right_border) ; compl_loop++ )  { 
    889889                *compl_loop = ptr_adt_complement->char_array[(int)*compl_loop]; 
     
    949949 
    950950        //========================================== kopieren der Seq in Puffer 
    951         for( sequence_loop = sequence_loop_start;  
     951        for( sequence_loop = sequence_loop_start; 
    952952                ( source = *sequence_loop) && (sequence_loop <= right_border) ; 
    953953                                                                                         sequence_loop++ ) { 
    954                 if( !((source == '-') || (source == '.')) )    
     954                if( !((source == '-') || (source == '.')) ) 
    955955                {       *( seq_buffer_loop++ )  = source; 
    956956                        *( index_buffer_loop++ )        = sequence_loop - sequence; 
     
    993993 
    994994        if(ptr_adt_complement->remove_gaps_points == YES) { 
    995                 for( seq_buffer_loop = seq_buffer_loop_start ;  
     995                for( seq_buffer_loop = seq_buffer_loop_start ; 
    996996                    (source = *seq_buffer_loop) && (seq_buffer_loop <= right_border); 
    997                                                                                          seq_buffer_loop++ ) {  
     997                                                                                         seq_buffer_loop++ ) { 
    998998                        *(sequence_loop++) = source; 
    999999                } 
    10001000        } 
    10011001        else {          //////////// ptr_adt_complement->remove_gaps_points == NO 
    1002                 for(    ; (source = seq_buffer[buffer_index]) &&  
     1002                for(    ; (source = seq_buffer[buffer_index]) && 
    10031003                                (seq_buffer[buffer_index] != '.'); 
    10041004                        buffer_index++) { 
    10051005                        *(sequence + index_buffer[buffer_index]) = source; 
    1006                          
    1007                 }  
    1008         }                
     1006 
     1007                } 
     1008        } 
    10091009        //=========================================== end ueberschreiben der Seq 
    10101010        ptr_adt_complement->seq_is_inverted = YES; 
  • trunk/ARBDBPP/adtali.cxx

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <arbdb.h> 
    55#include "adtools.hxx" 
     
    2626        // testversion leerer gap 
    2727        for (int i = 0; i < len; i++) { 
    28                 gapsequence[i] = NOGAP_SYMBOL;  
     28                gapsequence[i] = NOGAP_SYMBOL; 
    2929                gapshowoffset[i] = 0; 
    3030                gaprealoffset[i] = 0; 
    3131                } 
    3232        gapshowoffset_len = len; 
    33         inited = 1;      
     33        inited = 1; 
    3434} 
    3535 
     
    4141int offset_sum = 1; 
    4242int i,counter = 0; 
    43         if (!((position+length > AD_ALI::len()) || gap_inside(position,position + length))) {   
    44                 for (i = position;i<position +length;i++) {     // gapsequence  
     43        if (!((position+length > AD_ALI::len()) || gap_inside(position,position + length))) { 
     44                for (i = position;i<position +length;i++) {     // gapsequence 
    4545                        gapsequence[i]  = GAP_SYMBOL; 
    4646                        } 
     
    4848                        offset_sum = -length-1; 
    4949                        } 
    50                 for (i = 0; i<AD_ALI::len(); i++) {             // gaprealoffset                          
     50                for (i = 0; i<AD_ALI::len(); i++) {             // gaprealoffset 
    5151                        if (gapsequence[i] == GAP_SYMBOL) { 
    52                                 offset_sum ++;  }                
    53                         gaprealoffset[i] = offset_sum;   
     52                                offset_sum ++;  } 
     53                        gaprealoffset[i] = offset_sum; 
    5454                } 
    5555 
     
    6161                        } else { 
    6262                                offset_sum ++; 
    63                         }                        
     63                        } 
    6464                } 
    6565                gapshowoffset_len = counter-1; 
     
    6767                return 0; 
    6868        } else { 
    69                 return new AD_ERR("ADT_ALI::gap_make(int position,int length) ungueltige parameter");    
    70         }        
     69                return new AD_ERR("ADT_ALI::gap_make(int position,int length) ungueltige parameter"); 
     70        } 
    7171} 
    72                  
    73                  
     72 
     73 
    7474AD_ERR  * ADT_ALI::gap_delete(int showposition) { 
    7575        // showposition zeigt auf die position vor dem gap 
     
    8181                gapsequence[i] = NOGAP_SYMBOL; 
    8282                } 
    83         for (i = 0; i<AD_ALI::len(); i++) {             // gaprealoffset                          
     83        for (i = 0; i<AD_ALI::len(); i++) {             // gaprealoffset 
    8484                        if (gapsequence[i] == GAP_SYMBOL) { 
    85                                 offset_sum ++;  }                
    86                         gaprealoffset[i] = offset_sum;   
     85                                offset_sum ++;  } 
     86                        gaprealoffset[i] = offset_sum; 
    8787                } 
    8888 
     
    9494                } else { 
    9595                        offset_sum ++; 
    96                 }                        
     96                } 
    9797        } 
    98          
     98 
    9999        gapshowoffset_len = gapshowoffset_len + endpos-startpos; 
    100         return 0;                        
     100        return 0; 
    101101} 
    102102 
     
    106106        return 0; 
    107107} 
    108          
     108 
    109109char * ADT_ALI::gap_make_real_sequence(char *realseq,const char *showseq) { 
    110110        realseq=realseq;showseq=showseq; 
    111         return 0;        
     111        return 0; 
    112112} 
    113113 
     
    126126 
    127127int ADT_ALI::gap_inside(int showposition1,int showposition2) { 
    128 //      if (gapshowoffset[showposition1] != gapshowoffset[showposition2])        
     128//      if (gapshowoffset[showposition1] != gapshowoffset[showposition2]) 
    129129//              return 1; 
    130130    GBUSE(showposition1);GBUSE(showposition2); 
     
    139139    GBUSE(showposition); 
    140140        return 0; 
    141 }                
     141} 
    142142 
    143143int ADT_ALI::gap_realpos(int showposition) { 
     
    150150//      return (realposition - gaprealoffset[realposition]); 
    151151} 
    152                          
     152 
    153153#if 0 
    154154void ADT_ALI::operator = (ADT_ALI &adtali) 
  • trunk/ARBDBPP/adtsequence.cxx

    r2 r655  
    1 #include <malloc.h> 
     1// #include <malloc.h> 
    22#include <memory.h> 
    33#include <string.h> 
    4 #include <stdio.h> 
     4// #include <stdio.h> 
    55 
    66#include <arbdb.h> 
     
    2222        AD_SEQ::init(adcont); 
    2323        show_timestamp = timestamp; 
    24          
     24 
    2525} 
    2626 
     
    3939        ; 
    4040} 
    41          
     41 
    4242int ADT_SEQUENCE::show_len() { 
    4343        return seq_len; 
  • trunk/ARBDB_COMPRESS/AC_main.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    4242        AC_SEQUENCE_INFO        *new_ac_seq_info; 
    4343        int count = 0; 
    44          
     44 
    4545#ifdef COMMENT 
    4646        printf("\nStart reading DB : \n\n"); 
     
    6363                        ac_sequence = new AC_SEQUENCE_UNALIGNED(gb_data);// gbdata !!!!!!! 
    6464                } 
    65                 new_ac_seq_info = (AC_SEQUENCE_INFO *)  
     65                new_ac_seq_info = (AC_SEQUENCE_INFO *) 
    6666                                                        calloc(sizeof(AC_SEQUENCE_INFO),1); 
    6767                new_ac_seq_info->gb_species = gb_species; 
     
    7171                //-------------------------------------------------------- 
    7272                sequence_work = new_ac_seq_info->seq;           // Pointer auf Class AC_SEQUENCE 
    73                 sequence_work->quality = sequence_work->get_quality();           
     73                sequence_work->quality = sequence_work->get_quality(); 
    7474                //-------------------------------------------------------- 
    7575                this->insert(new_ac_seq_info); 
    7676                //-------------------------------------------------------- 
    77                  
     77 
    7878#ifdef COMMENT 
    7979                if (count % 100 == 0) { 
     
    112112        printf("\f"); 
    113113#endif 
    114          
     114 
    115115        AC_DBDATA_STATE ac_dbdata_state = ALIGNED_SEQUENCES; 
    116116 
     
    141141#ifdef PRINT_TREE 
    142142                printf("\n"); 
    143         root->print_tree();      
     143        root->print_tree(); 
    144144                printf("\n"); 
    145145#endif 
    146146#ifdef PRINT_FORMATED_DBTREE 
    147147                printf("\n"); 
    148         root->print_formated_dbtree();   
     148        root->print_formated_dbtree(); 
    149149                printf("\n"); 
    150150#endif 
    151          
     151 
    152152 
    153153 
  • trunk/ARBDB_COMPRESS/AC_sequence.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <ctype.h> 
     
    7777//      class AC_SEQUENCE_ALIGNED::get_distance() 
    7878// 
    79 //              liefert die Distanz zwischen der aktuellen Sequenz und  
     79//              liefert die Distanz zwischen der aktuellen Sequenz und 
    8080//              der Referenzsequenz. 
    8181//              Es muessen zwei vergleichbare Zeichen (= Buchstaben) 
     
    8585//********************************************************************* 
    8686double AC_SEQUENCE_ALIGNED::get_distance(AC_SEQUENCE *that)  { 
    87          
     87 
    8888        register long   distance, equals; 
    8989        register char   *revptr, *seqptr; 
     
    105105                } // endif 
    106106        } // endfor 
    107          
     107 
    108108        return distance/(distance + equals + 1.0); 
    109109 
  • trunk/ARBDB_COMPRESS/AC_toys_n_tools.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <math.h> 
     
    1515 
    1616 
    17          
    18 //********************************************************************* 
    19 // 
    20 //      zur Festlegung der Sortierrichtung des ARRAYS bei dem  
     17 
     18//********************************************************************* 
     19// 
     20//      zur Festlegung der Sortierrichtung des ARRAYS bei dem 
    2121//      Funktionsaufruf von: 
    2222// 
     
    4444//********************************************************************* 
    4545// 
    46 //              get_intersection_expglaettg                
    47 //               
     46//              get_intersection_expglaettg 
     47// 
    4848//      diese Funktion bestimmt den Schnittpunkt folgendermassen: 
    4949// 
    5050// 
    5151//********************************************************************* 
    52          
     52 
    5353double  get_intersection_expglaettg(AC_SEQUENCE_INFO **sort_array, double number_of) 
    5454{ 
    55          
     55 
    5656        AC_SEQUENCE_INFO        **array_ptr = sort_array; 
    5757 
     
    6464        double  nenner  = 0; 
    6565        double  zaehler = 0; 
    66         double  potenz_nenner  = 0;      
    67         double  potenz_zaehler = 0;      
     66        double  potenz_nenner  = 0; 
     67        double  potenz_zaehler = 0; 
    6868        double  intersection_value = 0;         // Schnittpunkt 
    69         long    anzahl_aller_seq  = 0;  
     69        long    anzahl_aller_seq  = 0; 
    7070        long    anzahl_seq_links  = 0; 
    7171        long    anzahl_seq_rechts = 0; 
     
    7474        double  min_x  = 0;             // Min Relationship -> Schnittpunkt 
    7575        double  min_zpar   = 0;                 // Minimum 
    76         double  min_max_anzahl_lire_product = 0;  // maximales Produkt aus  
    77                                                   //    AnzahlLinkerSeqs x AnzahlRechterSeqs  
     76        double  min_max_anzahl_lire_product = 0;  // maximales Produkt aus 
     77                                                  //    AnzahlLinkerSeqs x AnzahlRechterSeqs 
    7878                                                  //    eines Minimums !!! 
    7979        long    min_sequenznumber  = 0;         // Nummer der Sequenz 
    8080 
    8181        dekrement    = number_of; 
    82         anzahl_aller_seq  = number_of;   
     82        anzahl_aller_seq  = number_of; 
    8383        anzahl_seq_links  = 0; 
    8484        anzahl_seq_rechts = anzahl_aller_seq;   // schnittpkt wird die erste seq des re knotens 
     
    9191        //-------------------------------- f(x[i]) = f(x[i-1]) * ( 1/32^[f(x[i])-f(x[i-1])] +1 ) 
    9292        for( array_ptr,dekrement; 0 < dekrement; )  { 
    93                  
     93 
    9494                //------------------------------------------ Zuweisung Relationship 
    9595                x = (*array_ptr)->relationship; 
     
    9999                y = x - prev_x; 
    100100                //----------------------------------- Ende Bestimmung der Abstaende 
    101                  
     101 
    102102                //------------------------------------------------ Glaettungsfunktion 
    103103                if( dekrement == number_of )  {         // NUR BEI erster Sequenz "LEFTEND" !! 
     
    135135 
    136136                //------------------------------------- Bestimmung des Schnittpunktes 
    137                 if(   (zpar < min_zpar) ||  
     137                if(   (zpar < min_zpar) || 
    138138                     ((zpar == min_zpar) && (anzahl_lire_product > min_max_anzahl_lire_product))   )  { 
    139139                        min_x = x; 
     
    161161 
    162162                prev_y = y; 
    163                 prev_x = x;  
     163                prev_x = x; 
    164164                prev_z  = z; 
    165165 
  • trunk/ARBDB_COMPRESS/AC_tree.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <math.h> 
     
    4343//      class AC_SEQUENCE_LIST:: remove_sequence() 
    4444// 
    45 //              gibt den Speicher der Liste wieder frei          
     45//              gibt den Speicher der Liste wieder frei 
    4646// 
    4747//********************************************************************* 
     
    6262//      class AC_SEQUENCE_LIST:: remove_sequence_list() 
    6363// 
    64 //              gibt den Speicher der Liste wieder frei          
     64//              gibt den Speicher der Liste wieder frei 
    6565// 
    6666//********************************************************************* 
     
    9797        this->sequences = new_seq; 
    9898        new_seq->previous = NULL; 
    99          
     99 
    100100        this->nsequences = ++this->nsequences; 
    101101 
     
    129129 
    130130        for( ptr = ac_sequence_info ; ptr ; ptr = ptr->next ) 
    131         {        
     131        { 
    132132                if( maximum < ptr->seq->quality ) { 
    133133                        maximum = ptr->seq->quality; 
     
    143143 
    144144        } // endfor 
    145          
     145 
    146146//printf("\n\nMaxQuality :  %d\n\n", maximum); 
    147147 
     
    159159//      class AC_SEQUENCE_LIST::determine_distances_to() 
    160160// 
    161 //              bestimmt die reale_Distanz und  
     161//              bestimmt die reale_Distanz und 
    162162//              bestimmt die relative Distanz 
    163163//              zwischen zwei Sequenzen. 
     
    206206//      class AC_SEQUENCE_LIST::get_seq_with_max_dist_to() 
    207207// 
    208 //              liefert die erste Sequence mit  
     208//              liefert die erste Sequence mit 
    209209//                      dem groessten Abstand 
    210210//              bei 
     
    225225 
    226226        for( ptr = ac_sequence_info ; ptr ; ptr = ptr->next ) 
    227         {        
     227        { 
    228228                product = ptr->relative_leftdistance * ptr->seq->quality; 
    229229                if( maxvalue <= product ) { 
     
    232232                } // endif 
    233233        } // endfor 
    234          
     234 
    235235        if( 0 == maxvalue )  seq_with_max_dist = NULL; 
    236236 
     
    245245//      class AC_SEQUENCE_LIST::determine_basepoints() 
    246246// 
    247 //               
     247// 
    248248//              betrachte die Kanten vom Leftend zum Rightend, 
    249249//                      der Abstand relative_leftdistance vom Rightend 
    250250//                      ist die Summe der Kanten. 
    251251// 
    252 //              berechne ueber ein Gleichungssystem den Schnittpunkt  
     252//              berechne ueber ein Gleichungssystem den Schnittpunkt 
    253253//                      der aktuellen Sequenz mit obiger Gerade. 
    254 //                        
    255 //                       
     254// 
     255// 
    256256// 
    257257//********************************************************************* 
    258258void    AC_SEQUENCE_LIST::determine_basepoints()  { 
    259259 
    260          
     260 
    261261        AC_SEQUENCE_INFO        *ac_sequence_info; 
    262262        AC_SEQUENCE_INFO        *ptr; 
     
    265265 
    266266        ac_sequence_info = this->sequences; 
    267          
     267 
    268268        baseline = this->rightend->relative_leftdistance; // baseline = Abstand zwischen 
    269269                                                          // Leftend und Rightend 
     
    275275 
    276276        for( ptr = ac_sequence_info ; ptr ; ptr = ptr->next ) 
    277         {        
     277        { 
    278278                li = ptr->relative_leftdistance; 
    279279                re = ptr->relative_rightdistance; 
     
    300300//      class AC_SEQUENCE_LIST::reset_AC_SEQUENCE_INFO_struct_values() 
    301301// 
    302 //              Setzt folgende Werte im Struct AC_SEQUENCE_INFO auf die   
     302//              Setzt folgende Werte im Struct AC_SEQUENCE_INFO auf die 
    303303//              Default-Werte zurueck: 
    304304//                      AC_SEQUENCE_INFO_STATE  state, 
    305 //                      long            real_leftdistance;                       
    306 //                      double          relative_leftdistance;                   
     305//                      long            real_leftdistance; 
     306//                      double          relative_leftdistance; 
    307307//                      long            real_rightdistance; 
    308 //                      double          relative_rightdistance;  
    309 //                      double          relationship;    
     308//                      double          relative_rightdistance; 
     309//                      double          relationship; 
    310310// 
    311311//********************************************************************* 
     
    318318 
    319319        for(ptr = ac_sequence_info; ptr; ptr = ptr->next ) { 
    320                 ptr->state                      = ORDINARY;      
     320                ptr->state                      = ORDINARY; 
    321321                ptr->real_leftdistance          = 0; 
    322322                ptr->relative_leftdistance      = 0.0; 
    323323                ptr->real_rightdistance         = 0; 
    324324                ptr->relative_rightdistance     = 0.0; 
    325                 ptr->relationship               = 0;  
     325                ptr->relationship               = 0; 
    326326        } // endfor 
    327327 
     
    369369//      class AC_TREE:: remove_tree() 
    370370// 
    371 //              hier wird rekursiv der Clusterbaum geloescht     
     371//              hier wird rekursiv der Clusterbaum geloescht 
    372372// 
    373373//********************************************************************* 
     
    377377 
    378378        if(this)  { 
    379                  
     379 
    380380                sequence_list = this->sequences; 
    381                 if(sequence_list)  {                     
     381                if(sequence_list)  { 
    382382                         remove_sequence_list(sequence_list); 
    383383                } 
    384          
    385  
    386                 if(this->left) this->left->remove_tree();  
     384 
     385 
     386                if(this->left) this->left->remove_tree(); 
    387387                if(this->right) this->right->remove_tree(); 
    388388                free (this); 
     
    400400//      class AC_TREE::print_tree() 
    401401// 
    402 //              hier wird rekursiv der Clusterbaum rausgeschrieben       
     402//              hier wird rekursiv der Clusterbaum rausgeschrieben 
    403403// 
    404404//********************************************************************* 
     
    420420                } 
    421421        } 
    422         if(this->left) this->left->print_tree();  
     422        if(this->left) this->left->print_tree(); 
    423423        if(this->right) this->right->print_tree(); 
    424424 
     
    434434//      class AC_TREE::print_formated_dbtree() 
    435435// 
    436 //              hier wird rekursiv der Clusterbaum rausgeschrieben  
     436//              hier wird rekursiv der Clusterbaum rausgeschrieben 
    437437//              und das in dem wunderbaren ARB-Format 
    438438//              (Knoten,Knoten) oder so ?? 
     
    445445        if(this->node_state == I_NODE)  { 
    446446                printf("\n("); 
    447                 this->left->print_formated_dbtree();  
    448  
    449                 if( (this->right->node_state == I_NODE) ||  
    450                                         ( (this->right->node_state == LEAF) &&  
     447                this->left->print_formated_dbtree(); 
     448 
     449                if( (this->right->node_state == I_NODE) || 
     450                                        ( (this->right->node_state == LEAF) && 
    451451                                             (this->right->sequences != NULL) )  )  { 
    452452                        printf(","); 
     
    485485// 
    486486//              hier wird rekursiv der Clusterbaum aufgebaut. 
    487 //              Die Sequenzliste am root Knoten ist nicht leer.          
     487//              Die Sequenzliste am root Knoten ist nicht leer. 
    488488// 
    489489//********************************************************************* 
     
    496496 
    497497        if ( (this->node_state == I_NODE) ) { 
    498                 this->left->make_clustertree();  
     498                this->left->make_clustertree(); 
    499499                this->right->make_clustertree(); 
    500500        } 
     
    510510//      class AC_TREE::split() 
    511511// 
    512 //              bestimme LEFTEND                 
     512//              bestimme LEFTEND 
    513513//              bestimme Distanzen zum LEFTEND (real/relativ) 
    514514//              bestimme RIGHTEND 
     
    519519//              legen den Schnittpunkt fest 
    520520//              generiere zwei neue Knoten 
    521 //              teile die Sequenzliste auf die Knoten auf        
     521//              teile die Sequenzliste auf die Knoten auf 
    522522// 
    523523//********************************************************************* 
     
    532532                this->rightend = get_seq_with_max_dist_to(); 
    533533 
    534                 if( this->rightend != NULL )  {  
     534                if( this->rightend != NULL )  { 
    535535                        this->rightend->state = RIGHTEND; 
    536536                        this->determine_distances_to(rightend, RIGHTEND); // real,relative 
     
    548548                        //---------------------------------------------- zwei neue Soehne = I_Nodes 
    549549                        AC_TREE *inode_left = new AC_TREE; 
    550                         this->left = inode_left;         
     550                        this->left = inode_left; 
    551551                        AC_TREE *inode_right    = new AC_TREE; 
    552552                        this->right     = inode_right; 
     
    556556 
    557557                        //========================== Abbruchsbedingung fuer Seqenz-Listenaufteilung 
    558                         if( (this->left->max_relationship <= breakcondition_relationship_distance) ||  
     558                        if( (this->left->max_relationship <= breakcondition_relationship_distance) || 
    559559                            (this->left->nsequences <= breakcondition_min_sequencenumber) ) { 
    560560                                this->left->node_state = LEAF; 
     
    567567 
    568568                } //endif 
    569                  
     569 
    570570                else {  this->node_state = LEAF;        // kein rightend gefunden 
    571571                } 
     
    573573} // end AC_TREE::split() 
    574574//********************************************************************* 
    575   
     575 
    576576 
    577577 
     
    583583//              allokiert Speicher fuer das Sortier-Array 
    584584//              liest die Werte in das Array ein 
    585 //               
    586 // 
    587 //********************************************************************* 
    588 void AC_TREE::divide_sequence_list(AC_TREE *that, AC_TREE *inode_left,  
     585// 
     586// 
     587//********************************************************************* 
     588void AC_TREE::divide_sequence_list(AC_TREE *that, AC_TREE *inode_left, 
    589589                                                  AC_TREE *inode_right)  { 
    590590 
     
    595595        sort_array = (AC_SEQUENCE_INFO **)calloc(sizeof(void *),number_of); 
    596596 
    597 #ifdef DEBUG_print_unsorted_array        
    598         printf("\n\nunsorted array: \n\n");  
     597#ifdef DEBUG_print_unsorted_array 
     598        printf("\n\nunsorted array: \n\n"); 
    599599#endif 
    600600        //------------------------------------------------------ einlesen der seqenptr in array 
     
    630630// zum GNUPLOT Ausdruck 
    631631long dekrement; 
    632 #ifdef GNUPLOT_print_sorted_array  
     632#ifdef GNUPLOT_print_sorted_array 
    633633//      long    dekrement; 
    634634        dekrement = number_of; 
     
    638638//              printf("%f      10\n", (*array_ptr)->relationship); 
    639639//              printf("%f      ", (*array_ptr)->relationship); 
    640         }  
    641         printf("\n\n"); 
    642 #endif 
    643  
    644 #ifdef GNUPLOT_print_sorted_left_right_reldist  
    645 //      long dekrement;  
    646         dekrement = number_of;  
     640        } 
     641        printf("\n\n"); 
     642#endif 
     643 
     644#ifdef GNUPLOT_print_sorted_left_right_reldist 
     645//      long dekrement; 
     646        dekrement = number_of; 
    647647        printf("\n\nsorted array relative left/right distances : \n\n"); 
    648648        for(array_ptr = sort_array; 0 < dekrement; array_ptr++, dekrement--)  { 
    649649                printf("%f ", 
    650650                (*array_ptr)->relative_leftdistance); 
    651                 printf("%f\n",  
     651                printf("%f\n", 
    652652                (*array_ptr)->relative_rightdistance); 
    653         }  
     653        } 
    654654        printf("\n\n"); 
    655655#endif 
     
    677677//      class AC_TREE::separate_sequencelist() 
    678678// 
    679 //              geht das sortierte array durch und haengt den ersten Teil an  
    680 //              den linken Knoten,  
    681 //              den zweiten Knoten, d.h. das Element das den intersection_value  
     679//              geht das sortierte array durch und haengt den ersten Teil an 
     680//              den linken Knoten, 
     681//              den zweiten Knoten, d.h. das Element das den intersection_value 
    682682//              liefert sammt Rest an den zweiten Knoten. 
    683683//              Zu merken ist der Verwandtschaftsgrad der beiden Seqs zu den 
    684684//              aktuellen Referenz-Sequenzen. 
    685685// 
    686 //                                                       
    687 // 
    688 //********************************************************************* 
    689 void AC_TREE::separate_sequencelist(AC_SEQUENCE_INFO **sort_array,  
     686// 
     687// 
     688//********************************************************************* 
     689void AC_TREE::separate_sequencelist(AC_SEQUENCE_INFO **sort_array, 
    690690                                                double intersection_value ) 
    691691{ 
     
    696696 
    697697        for( array_ptr,dekrement; 0 < dekrement; array_ptr++, dekrement--) { 
    698                 basepoint = (*array_ptr)->relationship;                  
    699  
    700                 if( (*array_ptr)->state != ORDINARY ) {  
     698                basepoint = (*array_ptr)->relationship; 
     699 
     700                if( (*array_ptr)->state != ORDINARY ) { 
    701701                        if( (*array_ptr)->state == LEFTEND ) {          // LEFTEND nach links 
    702702                                inode = this->left; 
    703                         }  
     703                        } 
    704704                        else if( (*array_ptr)->state == RIGHTEND ) {    // RIGHTEND nach rechts 
    705705                                inode = this->right; 
    706                         }  
     706                        } 
    707707                } 
    708708 
     
    711711                        if( (basepoint < intersection_value) || (0 == basepoint) ) { 
    712712                                inode = this->left; 
    713                         }  
     713                        } 
    714714                        else if( intersection_value == basepoint ) { 
    715715                                inode = this->right; 
     
    717717                        else if( basepoint >= intersection_value) { 
    718718                                inode = this->right; 
    719                         }  
    720                 }  
     719                        } 
     720                } 
    721721 
    722722                inode->insert(*array_ptr);      // einfuegen des listenelements nach left oder right 
    723723//              inode->nsequences++;            // wird bereits von insert() erledigt ! 
    724724 
    725                 if( basepoint < intersection_value ) {  // Abbruchsbedingung groesster Abstand zu  
     725                if( basepoint < intersection_value ) {  // Abbruchsbedingung groesster Abstand zu 
    726726                        this->left->max_relationship = basepoint;       // LEFTEND/RIGHTEND 
    727727                } 
     
    729729                        this->right->max_relationship = abs(100 - intersection_value); 
    730730                } 
    731         }  
     731        } 
    732732        this->sequences = NULL;                 // sicher ist sicher !!! 
    733                                                 // d.h. am aktuellen Knoten haengt  
     733                                                // d.h. am aktuellen Knoten haengt 
    734734                                                // keine !! Sequenzenliste mehr 
    735735 
     
    746746        printf("Anzahl Seqs LEFT/RIGHT:         %d              ", this->left->nsequences); 
    747747        printf("%d", this->right->nsequences); 
    748          
     748 
    749749        printf("\n\n"); 
    750750        printf("Relationship zu LEFT/RIGHT:     %f      ", this->left->max_relationship); 
     
    766766                printf("left_side : %f\n", subnode_list->relationship); 
    767767                subnode_list = subnode_list->next; 
    768         }                
     768        } 
    769769        printf("\n\n"); 
    770770        subnode_list = this->right->sequences; 
    771         for( subnode_list; subnode_list; ) {  
     771        for( subnode_list; subnode_list; ) { 
    772772                printf("Seq_Nr : %d             ", subnode_list->number); 
    773773                printf("right_side : %f\n", subnode_list->relationship); 
  • trunk/ARBDB_COMPRESS/DEBUG_tools.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    3535                AC_SEQUENCE_INFO        *run_ptr = NULL; 
    3636                for( run_ptr = root->sequences; run_ptr ; 
    37                         run_ptr = run_ptr->next )   
     37                        run_ptr = run_ptr->next ) 
    3838                { 
    3939                        printf("Nr: %5i  ", run_ptr->number); 
     
    7171                AC_SEQUENCE_INFO        *run_ptr = NULL; 
    7272                for( run_ptr = root->sequences; run_ptr ; 
    73                         run_ptr = run_ptr->next )   
     73                        run_ptr = run_ptr->next ) 
    7474                { 
    7575                        printf("Nr: %5i  ", run_ptr->number); 
     
    101101                AC_SEQUENCE_INFO        *run_ptr = NULL; 
    102102                for( run_ptr = root->sequences; run_ptr ; 
    103                         run_ptr = run_ptr->next )   
     103                        run_ptr = run_ptr->next ) 
    104104                { 
    105105                        if(run_ptr->state == LEFTEND) printf("LEFTEND           "); 
  • trunk/ARB_GDE/GDE.cxx

    r550 r655  
    55#include <arbdb.h> 
    66#include <arbdbt.h> 
    7 #include <malloc.h> 
     7// #include <malloc.h> 
    88#include <aw_root.hxx> 
    99#include <aw_device.hxx> 
  • trunk/ARB_GDE/GDE_FileIO.cxx

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <string.h> 
    55 
     
    3939        alignment->element[j].groupb = NULL; 
    4040    } 
    41          
     41 
    4242    for (group = 1;group <= alignment->numgroups;group++) 
    4343    { 
     
    4848                if(last != -1) 
    4949                { 
    50                     alignment->element[j].groupb =  
     50                    alignment->element[j].groupb = 
    5151                        &(alignment->element[last]); 
    52                     alignment->element[last].groupf =  
     52                    alignment->element[last].groupf = 
    5353                        &(alignment->element[j]); 
    5454                } 
     
    135135 
    136136/* 
    137 LoadData():  
     137LoadData(): 
    138138        Load a data set from the command line argument. 
    139139 
     
    269269        FILE *file; 
    270270        char in_line[GBUFSIZ]; 
    271          
     271 
    272272        file = fopen(name,"r"); 
    273273        *dtype=0; 
     
    396396        { 
    397397                for(j=0;j<aln->numelements;j++) 
    398                         if(seqs[j].elementtype == MASK &&  
     398                        if(seqs[j].elementtype == MASK && 
    399399                            seqs[j].selected) 
    400400                                mask = j; 
     
    420420                else 
    421421                        offset_str[0] = '\0'; 
    422                  
    423                 if((((int)j!=mask) && (seqs[j].selected) && method != SELECT_REGION)  
     422 
     423                if((((int)j!=mask) && (seqs[j].selected) && method != SELECT_REGION) 
    424424                || (method == SELECT_REGION && seqs[j].subselected) 
    425425                || method == ALL) 
     
    713713            if(IGNORE_DASH && (indx != -1)) 
    714714            { 
    715                 for(jj=0,j=0;(j<curlen) &&  
     715                for(jj=0,j=0;(j<curlen) && 
    716716                        (jj<aln->element[indx].seqlen);j++,jj++) 
    717717                { 
     
    729729 * 
    730730 *      The allocated space is equal the seqlen of the matched sequence. 
    731  *       
     731 * 
    732732 */ 
    733733                    if(aln->element[indx].tmatrix) 
     
    883883                return(1); 
    884884 
    885 /*       
     885/* 
    886886        NAdd = (NA_DisplayData*)((NA_Alignment*)DataSet)->na_ddata; 
    887887        if(NAdd == NULL) 
    888888                return(1); 
    889 */               
     889*/ 
    890890 
    891891        file = fopen(filename,"w"); 
     
    945945        FILE *file; 
    946946        filename=0; 
    947          
     947 
    948948        char in_line[GBUFSIZ],head[GBUFSIZ]; 
    949949        file = fopen(filename,"r"); 
     
    966966                } 
    967967        } 
    968          
     968 
    969969*/ 
    970970} 
     
    10211021    { 
    10221022        for(j=0;j<aln->numelements;j++) 
    1023             if(seqs[j].elementtype == MASK &&  
     1023            if(seqs[j].elementtype == MASK && 
    10241024               seqs[j].selected) 
    10251025                mask = j; 
     
    10431043        else 
    10441044            offset_str[0] = '\0'; 
    1045                  
    1046         if((((int)j!=mask) && (seqs[j].selected) && method != SELECT_REGION)  
     1045 
     1046        if((((int)j!=mask) && (seqs[j].selected) && method != SELECT_REGION) 
    10471047           || (method == SELECT_REGION && seqs[j].subselected) 
    10481048           || method == ALL) 
  • trunk/ARB_GDE/GDE_Genbank.cxx

    r344 r655  
    11#include <sys/time.h> 
    22#include <stdio.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <string.h> 
    55#include <time.h> 
  • trunk/ARB_GDE/GDE_HGLfile.cxx

    r344 r655  
    22#include <stdio.h> 
    33#include <stdlib.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <time.h> 
  • trunk/ARB_GDE/GDE_ParseMenu.cxx

    r335 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <ctype.h> 
    66#include <assert.h> 
  • trunk/ARB_GDE/GDE_arbdb_io.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <memory.h> 
    66 
     
    5454int InsertDatainGDE(NA_Alignment *dataset,GBDATA **the_species,unsigned char **the_names,unsigned char **the_sequences, 
    5555                    unsigned long numberspecies,unsigned long maxalignlen,AP_filter *filter, long compress) 
    56 {  
     56{ 
    5757    GBDATA *gb_name; 
    5858    GBDATA *gb_species; 
     
    6060    int newfiltercreated=0; 
    6161    NA_Sequence *this_elem; 
    62      
     62 
    6363    gde_assert((the_species==0) != (the_names==0)); 
    64   
    65     if(filter==0)  
     64 
     65    if(filter==0) 
    6666    { 
    6767        filter = new AP_filter; 
     
    7575        } 
    7676    } 
    77          
     77 
    7878    size_t *seqlen=(size_t *)calloc((unsigned int)numberspecies,sizeof(size_t)); 
    7979    // sequences may have different length 
     
    8282        for(i=0;i<numberspecies;i++){ 
    8383            seqlen[i] = strlen((char *)the_sequences[i]); 
    84         }        
    85     } 
    86  
    87          
     84        } 
     85    } 
     86 
     87 
    8888    uchar **sequfilt=(uchar**)calloc((unsigned int)numberspecies+1,sizeof(uchar*)); 
    8989    if(compress==2)  // compress all gaps and filter positions 
     
    133133            sequfilt[i][len] = 0; 
    134134            memset(sequfilt[i],'.',len);                // Generate empty sequences 
    135              
     135 
    136136            size_t col; 
    137137            for(col=0;(col<maxalignlen)&&(c=the_sequences[i][col]);col++){ 
     
    150150        delete string; 
    151151    } 
    152          
     152 
    153153    delete seqlen; 
    154154 
    155155    long number=0; 
    156156    int curelem; 
    157      
     157 
    158158    if (the_species) { 
    159159        for (gb_species = the_species[number]; gb_species; gb_species = the_species[++number] ) { 
     
    172172 
    173173            strncpy(this_elem->short_name,GB_read_char_pntr(gb_name),31); 
    174                  
     174 
    175175            gbd = GB_find(gb_species,"author",0,down_level); 
    176176            if (gbd)    strncpy(this_elem->authority,GB_read_char_pntr(gbd),79); 
     
    185185                delete sequfilt[number]; sequfilt[number] = 0; 
    186186            } 
    187                  
     187 
    188188            this_elem->comments = strdup("no comments"); 
    189189            this_elem->comments_maxlen = 1 + (this_elem->comments_len = strlen(this_elem->comments)); 
     
    210210    else {      // use the_names 
    211211        unsigned char *species_name; 
    212          
     212 
    213213        for (species_name=the_names[number]; species_name; species_name=the_names[++number]) { 
    214214            if ((number/10)*10==number) { 
     
    217217                } 
    218218            } 
    219              
     219 
    220220            curelem = Arbdb_get_curelem(dataset); 
    221221            this_elem = &(dataset->element[curelem]); 
     
    223223            this_elem->attr = DEFAULT_X_ATTR; 
    224224            this_elem->gb_species = 0; 
    225              
     225 
    226226            strncpy((char*)this_elem->short_name, (char*)species_name, 31); 
    227227            this_elem->authority[0] = 0; 
    228228            this_elem->seq_name[0] = 0; 
    229229            this_elem->id[0] = 0; 
    230              
     230 
    231231            { 
    232232                AppendNA((NA_Base *)sequfilt[number],strlen((const char *)sequfilt[number]),this_elem); 
    233233                delete sequfilt[number]; sequfilt[number] = 0; 
    234234            } 
    235                  
     235 
    236236            this_elem->comments = strdup("no comments"); 
    237237            this_elem->comments_maxlen = 1 + (this_elem->comments_len = strlen(this_elem->comments)); 
     
    245245        } 
    246246    } 
    247      
     247 
    248248    { 
    249249        unsigned long i; 
     
    273273{ 
    274274        dataset->gb_main = gb_main; 
    275         GBDATA **the_species;  
     275        GBDATA **the_species; 
    276276        long maxalignlen; 
    277277        long numberspecies=0; 
     
    281281                                             the_species, the_names, the_sequences, 
    282282                                             numberspecies, maxalignlen); 
    283          
     283 
    284284        gde_assert((the_species==0) != (the_names==0)); 
    285          
     285 
    286286        if (error) { 
    287287                aw_message(error); 
  • trunk/ARB_GDE/GDE_event.cxx

    r551 r655  
    1111#include <arbdb.h> 
    1212#include <arbdbt.h> 
    13 #include <malloc.h> 
     13// #include <malloc.h> 
    1414#include <aw_root.hxx> 
    1515#include <aw_device.hxx> 
  • trunk/AWDEMO/demo.cxx

    r2 r655  
    77#include <demo.hxx> 
    88#include <memory.h> 
    9 #include <malloc.h> 
     9// #include <malloc.h> 
    1010#include <string.h> 
    1111 
  • trunk/AWT/AWT_codon_table.cxx

    r2 r655  
    1 #include <malloc.h> 
     1// #include <malloc.h> 
    22#include <string.h> 
    33#include <ctype.h> 
     
    1111    //  "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",  base2 
    1212    //  "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"   base3 
    13     {  
     13    { 
    1414        "Standard Code", 
    1515        "FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
    1616        "---M---------------M---------------M----------------------------" 
    17     },  
    18     {  
    19         "Bacterial Code",  
    20         "FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    21         "---M---------------M------------MMMM---------------M------------"  
    22     },  
    23     {  
    24         "Vertebrate Mitochondrial Code",   
    25         "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSS**VVVVAAAADDEEGGGG",  
     17    }, 
     18    { 
     19        "Bacterial Code", 
     20        "FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     21        "---M---------------M------------MMMM---------------M------------" 
     22    }, 
     23    { 
     24        "Vertebrate Mitochondrial Code", 
     25        "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSS**VVVVAAAADDEEGGGG", 
    2626        "--------------------------------MMMM---------------M------------" 
    27     },  
    28     {  
    29         "Invertebrate Mitochondrial Code",  
    30         "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSSSVVVVAAAADDEEGGGG",  
    31         "---M----------------------------MMMM---------------M------------"  
    32     },  
    33     {  
    34         "Yeast Mitochondrial Code",  
    35         "FFLLSSSSYY**CCWWTTTTPPPPHHQQRRRRIIMMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    36         "-----------------------------------M----------------------------"  
    37     },  
    38     {  
     27    }, 
     28    { 
     29        "Invertebrate Mitochondrial Code", 
     30        "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSSSVVVVAAAADDEEGGGG", 
     31        "---M----------------------------MMMM---------------M------------" 
     32    }, 
     33    { 
     34        "Yeast Mitochondrial Code", 
     35        "FFLLSSSSYY**CCWWTTTTPPPPHHQQRRRRIIMMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     36        "-----------------------------------M----------------------------" 
     37    }, 
     38    { 
    3939        "Mold/Protozoan/Coelenterate Mitochondrial Code", // identical with "Mycoplasma/Spiroplasma Code" (split because of name-length) 
    40         "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    41         "--MM---------------M------------MMMM---------------M------------"  
    42     },  
    43     {  
    44         "Echinoderm Mitochondrial Code",  
    45         "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG",  
    46         "-----------------------------------M----------------------------"  
    47     },  
    48     {  
    49         "Ascidian Mitochondrial Code",  
    50         "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSGGVVVVAAAADDEEGGGG",  
    51         "-----------------------------------M----------------------------"  
    52     },  
    53     {  
    54         "Flatworm Mitochondrial Code",  
    55         "FFLLSSSSYYY*CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG",  
    56         "-----------------------------------M----------------------------"  
    57     },  
    58     {  
     40        "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     41        "--MM---------------M------------MMMM---------------M------------" 
     42    }, 
     43    { 
     44        "Echinoderm Mitochondrial Code", 
     45        "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG", 
     46        "-----------------------------------M----------------------------" 
     47    }, 
     48    { 
     49        "Ascidian Mitochondrial Code", 
     50        "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSGGVVVVAAAADDEEGGGG", 
     51        "-----------------------------------M----------------------------" 
     52    }, 
     53    { 
     54        "Flatworm Mitochondrial Code", 
     55        "FFLLSSSSYYY*CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG", 
     56        "-----------------------------------M----------------------------" 
     57    }, 
     58    { 
    5959        "Mycoplasma/Spiroplasma Code", // identical with "Mold/Protozoan/Coelenterate Mitochondrial Code" (split because of name-length) 
    60         "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    61         "--MM---------------M------------MMMM---------------M------------"  
    62     },  
    63     {  
    64         "Ciliate, Dasycladacean and Hexamita Nuclear Code",  
    65         "FFLLSSSSYYQQCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    66         "-----------------------------------M----------------------------"  
    67     },  
    68     {  
    69         "Euplotid Nuclear Code",  
    70         "FFLLSSSSYY**CCCWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    71         "-----------------------------------M----------------------------"  
    72     },  
    73     {  
    74         "Alternative Yeast Nuclear Code",  
    75         "FFLLSSSSYY**CC*WLLLSPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    76         "-------------------M---------------M----------------------------"  
    77     },  
    78     {  
    79         "Blepharisma Nuclear Code",  
    80         "FFLLSSSSYY*QCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",  
    81         "-----------------------------------M----------------------------"  
    82     },  
    83      
     60        "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     61        "--MM---------------M------------MMMM---------------M------------" 
     62    }, 
     63    { 
     64        "Ciliate, Dasycladacean and Hexamita Nuclear Code", 
     65        "FFLLSSSSYYQQCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     66        "-----------------------------------M----------------------------" 
     67    }, 
     68    { 
     69        "Euplotid Nuclear Code", 
     70        "FFLLSSSSYY**CCCWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     71        "-----------------------------------M----------------------------" 
     72    }, 
     73    { 
     74        "Alternative Yeast Nuclear Code", 
     75        "FFLLSSSSYY**CC*WLLLSPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     76        "-------------------M---------------M----------------------------" 
     77    }, 
     78    { 
     79        "Blepharisma Nuclear Code", 
     80        "FFLLSSSSYY*QCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG", 
     81        "-----------------------------------M----------------------------" 
     82    }, 
     83 
    8484    { 0, 0, 0 } // end of table-marker 
    8585}; 
     
    9191void AWT_initialize_codon_tables() { 
    9292    if (codon_tables_initialized) return; 
    93      
    94     int codon_nr;  
     93 
     94    int codon_nr; 
    9595    int code_nr; 
    96      
     96 
    9797    for (codon_nr=0; codon_nr<AWT_MAX_CODONS; codon_nr++) { 
    9898        ambiguous_codons[codon_nr] = 0; 
    9999    } 
    100      
     100 
    101101    awt_assert(AWT_CODON_CODES>=1); 
    102102    memcpy(definite_translation, AWT_codon_def[0].aa, AWT_MAX_CODONS); // only one translation is really definite 
    103      
     103 
    104104    awt_assert(AWT_codon_def[AWT_CODON_CODES].aa==NULL); // Error in AWT_codon_def or AWT_CODON_CODES 
    105      
     105 
    106106    for (code_nr=1; code_nr<AWT_CODON_CODES; code_nr++) { 
    107107        const char *translation = AWT_codon_def[code_nr].aa; 
    108          
     108 
    109109        for (codon_nr=0; codon_nr<AWT_MAX_CODONS; codon_nr++) { 
    110110            if (definite_translation[codon_nr]!='?') { // is definite till now 
     
    114114                    amb[0] = definite_translation[0]; 
    115115                    amb[1] = translation[codon_nr]; 
    116                      
     116 
    117117                    ambiguous_codons[codon_nr] = amb; 
    118118                    definite_translation[codon_nr] = '?'; 
     
    134134        } 
    135135    } 
    136      
     136 
    137137    codon_tables_initialized = 1; 
    138138} 
     
    142142    switch (c) { 
    143143        case 'T': case 't': 
    144         case 'U': case 'u': return 0;  
     144        case 'U': case 'u': return 0; 
    145145        case 'C': case 'c': return 1; 
    146146        case 'A': case 'a': return 2; 
     
    159159    int i2 = dna2idx(dna[1]); 
    160160    int i3 = dna2idx(dna[2]); 
    161          
     161 
    162162    if (i1==4||i2==4||i3==4) return AWT_MAX_CODONS; // is not a codon 
    163      
     163 
    164164    int codon_nr = i1*16 + i2*4 + i3; 
    165165    awt_assert(codon_nr>=0 && codon_nr<=AWT_MAX_CODONS); 
     
    169169inline void build_codon(int codon_nr, char *to_buffer) { 
    170170    awt_assert(codon_nr>=0 && codon_nr<AWT_MAX_CODONS); 
    171      
     171 
    172172    to_buffer[0] = idx2dna((codon_nr>>4)&3); 
    173173    to_buffer[1] = idx2dna((codon_nr>>2)&3); 
    174     to_buffer[2] = idx2dna(codon_nr&3);  
     174    to_buffer[2] = idx2dna(codon_nr&3); 
    175175} 
    176176 
     
    182182static const char *protein_name[26+1] = { 
    183183    "Ala", // A 
    184         "Asx", // B      
     184        "Asx", // B 
    185185        "Cys", // C 
    186186        "Asp", // D 
     
    213213    if (protein=='*') return "End"; 
    214214    if (protein=='-') return "---"; 
    215      
     215 
    216216    awt_assert(protein>='A' && protein<='Z'); 
    217217    awt_assert(protein_name[protein-'A']!=0); 
     
    234234void AWT_dump_codons() { 
    235235    AWT_allowedCode allowed_code; 
    236      
     236 
    237237    for (char c='*'; c<='Z'; c++) { 
    238         printf("Codes for '%c': ", c);  
     238        printf("Codes for '%c': ", c); 
    239239        int first_line = 1; 
    240240        int found = 0; 
     
    245245                    dna[0]=b1; 
    246246                    dna[1]=b2; 
    247                     dna[2]=b3;  
     247                    dna[2]=b3; 
    248248                    dna[3]=0; 
    249                      
     249 
    250250                    AWT_allowedCode allowed_code_left; 
    251251                    if (AWT_is_codon(c, dna, allowed_code, allowed_code_left)) { 
    252                         if (!first_line) printf("\n               ");  
     252                        if (!first_line) printf("\n               "); 
    253253                        first_line = 0; 
    254254                        printf("%s (", dna); 
    255                          
     255 
    256256                        int first=1; 
    257257                        for (int code=0; code<AWT_CODON_CODES; code++) { 
     
    262262                            } 
    263263                        } 
    264                         printf(") ");  
    265                          
     264                        printf(") "); 
     265 
    266266                        found = 1; 
    267267                    } 
     
    281281 
    282282int AWT_is_codon(char protein, const char *dna, const AWT_allowedCode& allowed_code, AWT_allowedCode& allowed_code_left) { 
    283     awt_assert(codon_tables_initialized);  
    284      
     283    awt_assert(codon_tables_initialized); 
     284 
    285285    protein = toupper(protein); 
    286286    if (protein=='B') { // B is a shortcut for Asp(=D) or Asn(=N) 
    287287        return 
    288             AWT_is_codon('D', dna, allowed_code, allowed_code_left) ||  
    289             AWT_is_codon('N', dna, allowed_code, allowed_code_left);  
    290     } 
    291     else if (protein=='Z') { // Z is a shortcut for Glu(=E) or Gln(=Q)  
     288            AWT_is_codon('D', dna, allowed_code, allowed_code_left) || 
     289            AWT_is_codon('N', dna, allowed_code, allowed_code_left); 
     290    } 
     291    else if (protein=='Z') { // Z is a shortcut for Glu(=E) or Gln(=Q) 
    292292        return 
    293293            AWT_is_codon('E', dna, allowed_code, allowed_code_left) || 
    294             AWT_is_codon('Q', dna, allowed_code, allowed_code_left);     
    295     } 
    296      
     294            AWT_is_codon('Q', dna, allowed_code, allowed_code_left); 
     295    } 
     296 
    297297    int codon_nr = calc_codon_nr(dna); 
    298298    if (codon_nr==AWT_MAX_CODONS) { // dna is not a clean codon (it contains iupac-codes) 
    299299        int error_positions = 0; 
    300         int first_error_pos = -1;  
     300        int first_error_pos = -1; 
    301301        { 
    302302            int iupac_pos; 
     
    305305                    if (first_error_pos==-1) first_error_pos = iupac_pos; 
    306306                    error_positions++; 
    307                 }  
    308             }  
    309         }  
    310         gb_assert(error_positions);  
     307                } 
     308            } 
     309        } 
     310        gb_assert(error_positions); 
    311311        if (error_positions==3) { // don't accept codons with 3 errors 
    312312            return 0; 
    313313        } 
    314          
    315         const char *decoded_iupac = AWT_decode_iupac(dna[first_error_pos], GB_AT_DNA, 0);  
    316         char dna_copy[4];  
     314 
     315        const char *decoded_iupac = AWT_decode_iupac(dna[first_error_pos], GB_AT_DNA, 0); 
     316        char dna_copy[4]; 
    317317        memcpy(dna_copy, dna, 3); 
    318318        dna_copy[3] = 0; 
    319          
     319 
    320320#if defined(DEBUG) && 0 
    321321        printf("Check if '%s' is a codon for '%c'\n", dna_copy, protein); 
    322322#endif 
    323          
     323 
    324324        int all_are_codons = 1; 
    325325        AWT_allowedCode allowed_code_copy; 
    326326        allowed_code_copy = allowed_code; 
    327          
     327 
    328328        for (int i=0; decoded_iupac[i]; i++) { 
    329329            dna_copy[first_error_pos] = decoded_iupac[i]; 
     
    331331                all_are_codons = 0; 
    332332                break; 
    333             }  
     333            } 
    334334            allowed_code_copy = allowed_code_left; 
    335335        } 
    336          
     336 
    337337        if (all_are_codons) { 
    338338            allowed_code_left = allowed_code_copy; 
     
    346346        return all_are_codons; 
    347347    } 
    348      
     348 
    349349    if (definite_translation[codon_nr]!='?') { 
    350         int ok = definite_translation[codon_nr]==protein;  
    351          
     350        int ok = definite_translation[codon_nr]==protein; 
     351 
    352352        if (ok) allowed_code_left = allowed_code; 
    353         else allowed_code_left.forbidAll();  
    354          
     353        else allowed_code_left.forbidAll(); 
     354 
    355355        return ok; 
    356356    } 
    357      
     357 
    358358    if (strchr(ambiguous_codons[codon_nr], protein)==0) { 
    359359        allowed_code_left.forbidAll(); 
    360         return 0;  
    361     } 
    362      
     360        return 0; 
     361    } 
     362 
    363363    // search for allowed correct translation possibity: 
    364     int found = 0;  
     364    int found = 0; 
    365365    for (int code_nr=0; code_nr<AWT_CODON_CODES; code_nr++) { 
    366366        if (allowed_code.is_allowed(code_nr) &&  // is this code allowed? 
     
    373373        } 
    374374    } 
    375      
     375 
    376376    return found; 
    377377} 
     
    382382{ 
    383383    char codon[64]; // index is calculated with calc_codon_nr 
    384      
     384 
    385385public: 
    386386    Codon_Group(char protein, int code_nr); 
    387387    ~Codon_Group() {} 
    388      
     388 
    389389    //    static int idx(int x, int y, int z) const { return (((x<<2)+y)<<2)+z; } 
    390390    //    static int is_idx(int idx) { return idx>=0 && idx<AWT_MAX_CODONS; } 
    391      
    392     //    void add_member(int idx) { awt_assert(is_idx(idx)); codon[idx] = 1; }     
     391 
     392    //    void add_member(int idx) { awt_assert(is_idx(idx)); codon[idx] = 1; } 
    393393    Codon_Group& operator+=(const Codon_Group& other); 
    394394    int expand(char *to_buffer) const; 
    395395}; 
    396396 
    397 Codon_Group::Codon_Group(char protein, int code_nr) {     
    398     protein = toupper(protein);  
     397Codon_Group::Codon_Group(char protein, int code_nr) { 
     398    protein = toupper(protein); 
    399399    awt_assert(protein=='*' || isalpha(protein)); 
    400400    awt_assert(code_nr>=0 && code_nr<AWT_CODON_CODES); 
    401      
     401 
    402402    const char *amino_table = AWT_codon_def[code_nr].aa; 
    403403    for (int i=0; i<AWT_MAX_CODONS; i++) { 
     
    413413} 
    414414 
    415 inline int legal_dna_no(int i) { return i>=0 && i<4; }  
     415inline int legal_dna_no(int i) { return i>=0 && i<4; } 
    416416inline void my_memcpy(char *dest, const char *source, size_t length) { for (size_t l=0; l<length; l++) { dest[l] = source[l]; } } 
    417417 
     
    420420    int mismatch_index = -1; 
    421421    static char buf[4]; 
    422      
     422 
    423423    for (int i=0; i<3; i++) { 
    424424        if (con1[i]!=con2[i]) { 
    425425            mismatches++; 
    426             mismatch_index = i;  
    427         }  
     426            mismatch_index = i; 
     427        } 
    428428        else { 
    429429            buf[i] = con1[i]; 
    430430        } 
    431431    } 
    432      
    433     if (mismatches==1) { // exactly one position differs between codons  
     432 
     433    if (mismatches==1) { // exactly one position differs between codons 
    434434        awt_assert(mismatch_index!=-1); 
    435435        buf[mismatch_index] = AWT_iupac_add(con1[mismatch_index], con2[mismatch_index], GB_AT_DNA); 
     
    444444    const char *con1, *con2; 
    445445    int added = 0; 
    446      
     446 
    447447    for (i=0; i<no_of_condons; i++) { 
    448448        con1 = bufferStart+3*i; 
    449          
     449 
    450450        for (j=i+1; j<no_of_condons; j++) { 
    451451            con2 = bufferStart+3*j; 
    452452            const char *result = buildMixedCodon(con1, con2); 
    453453            if (result) { 
    454                 to_buffer[0] = 0;  
     454                to_buffer[0] = 0; 
    455455                // do we already have this codon? 
    456456                const char *found; 
     
    464464                } 
    465465 
    466                 if (!found) {  
     466                if (!found) { 
    467467                    my_memcpy(to_buffer, result, 3); to_buffer+=3; 
    468468                    added++; 
     
    478478    int i; 
    479479    char *org_to_buffer = to_buffer; 
    480      
     480 
    481481    for (i=0; i<AWT_MAX_CODONS; i++) { 
    482482        if (codon[i]) { 
     
    486486        } 
    487487    } 
    488      
     488 
    489489#if defined(DEBUG) && 0 
    490490    to_buffer[0] = 0; 
    491491    printf("codons = '%s'\n", org_to_buffer); 
    492492#endif 
    493      
     493 
    494494    for (;;) { 
    495495        int new_count = expandMore(org_to_buffer, count, to_buffer); 
     
    499499        to_buffer[0] = 0; 
    500500        printf("codons (expandedMore) = '%s'\n", org_to_buffer); 
    501 #endif  
    502     } 
    503      
    504     awt_assert(count==(int(to_buffer-org_to_buffer)/3));  
    505      
     501#endif 
     502    } 
     503 
     504    awt_assert(count==(int(to_buffer-org_to_buffer)/3)); 
     505 
    506506    return count; 
    507507} 
    508          
     508 
    509509 
    510510// -------------------------------------------------------------------------------- 
     
    517517    awt_assert(code_nr>=0 && code_nr<AWT_CODON_CODES); 
    518518    protein = toupper(protein); 
    519     awt_assert(isalpha(protein) || protein=='*');  
    520     awt_assert(codon_tables_initialized);     
    521      
     519    awt_assert(isalpha(protein) || protein=='*'); 
     520    awt_assert(codon_tables_initialized); 
     521 
    522522    Codon_Group *cgroup = 0; 
    523      
     523 
    524524    if (protein=='B') { 
    525525        cgroup = new Codon_Group('D', code_nr); 
     
    530530        cgroup = new Codon_Group('E', code_nr); 
    531531        Codon_Group Q('Q', code_nr); 
    532         *cgroup += Q;    
     532        *cgroup += Q; 
    533533    } 
    534534    else { 
    535535        cgroup = new Codon_Group(protein, code_nr); 
    536536    } 
    537      
    538     awt_assert(cgroup);     
    539      
    540     static char buffer[MAX_CODON_LIST_LENGTH];  
     537 
     538    awt_assert(cgroup); 
     539 
     540    static char buffer[MAX_CODON_LIST_LENGTH]; 
    541541    int offset = 3*cgroup->expand(buffer); 
    542     awt_assert(offset<MAX_CODON_LIST_LENGTH);     
    543     buffer[offset] = 0;  
    544      
    545     delete cgroup;  
    546      
     542    awt_assert(offset<MAX_CODON_LIST_LENGTH); 
     543    buffer[offset] = 0; 
     544 
     545    delete cgroup; 
     546 
    547547    return buffer; 
    548548} 
  • trunk/AWT/AWT_file_selection.cxx

    r528 r655  
    44#include <time.h> 
    55#include <string.h> 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77#include <memory.h> 
    88 
  • trunk/AWT/AWT_nds.cxx

    r466 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
  • trunk/AWT/AWT_nei.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <memory.h> 
    66#include <arbdb.h> 
     
    226226        // lower triangular matrix 
    227227        // size: size of matrix 
    228          
     228 
    229229 
    230230        PH_NEIGHBOURJOINING *nj = new PH_NEIGHBOURJOINING(m,size); 
  • trunk/AWT/AWT_pro_a_nucs.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <ctype.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    1010#include <awt_codon_table.hxx> 
    1111 
    12 struct arb_r2a_struct *awt_pro_a_nucs = 0;  
     12struct arb_r2a_struct *awt_pro_a_nucs = 0; 
    1313 
    1414char *AP_create_dna_to_ap_bases(void){ 
     
    144144                if ( nucs->nucbits[1] != n1 ) c++; 
    145145                if ( nucs->nucbits[2] != n2 ) c++; 
    146                 if (c <= 1) break;  
     146                if (c <= 1) break; 
    147147        } 
    148148        if (!nucs) { 
     
    150150                nucs->next = str->nucs; 
    151151                str->nucs = nucs; 
    152         }        
     152        } 
    153153        nucs->nucbits[0] |= n0; 
    154154        nucs->nucbits[1] |= n1; 
     
    207207    awt_pro_a_nucs->nuc_2_bitset = AP_create_dna_to_ap_bases(); 
    208208    awt_pro_a_nucs->t2i_hash = GBS_create_hash(1024,1); // case insensitive 
    209      
     209 
    210210    AWT_initialize_codon_tables(); 
    211211 
    212     int code_nr = GBT_read_int(gb_main,AP_PRO_TYPE_AWAR);     
    213      
     212    int code_nr = GBT_read_int(gb_main,AP_PRO_TYPE_AWAR); 
     213 
    214214    { 
    215215        char *D_codons = GB_strdup(AWT_get_codons('D', code_nr)); 
     
    217217        char *E_codons = GB_strdup(AWT_get_codons('E', code_nr)); 
    218218        char *Q_codons = GB_strdup(AWT_get_codons('Q', code_nr)); 
    219          
     219 
    220220        char protein; 
    221221        for (protein='*'; protein<='Z'; protein = (protein=='*' ? 'A' : protein+1)) { 
    222222            if (protein!='J' && protein!='O' && protein!='U') { // JOU are no aminos 
    223                 const char *codons;  
     223                const char *codons; 
    224224                if (protein=='D')       codons = D_codons; 
    225225                else if (protein=='N')  codons = N_codons; 
    226226                else if (protein=='E')  codons = E_codons; 
    227227                else if (protein=='Q')  codons = Q_codons; 
    228                 else                    codons = AWT_get_codons(protein, code_nr);  
     228                else                    codons = AWT_get_codons(protein, code_nr); 
    229229                // codons now contains a 0-terminated-string containing all possible codons for protein 
    230                  
     230 
    231231                const char *protein_name = AWT_get_protein_name(protein); 
    232              
     232 
    233233                for (int off=0; codons[off]; off+=3) { 
    234                     char codon[4];  
     234                    char codon[4]; 
    235235                    memcpy(codon, codons+off, 3); 
    236236                    codon[3] = 0; 
    237                      
     237 
    238238                    if (protein=='B') { 
    239239                        if (!codon_defined_in(codon, D_codons) && !codon_defined_in(codon, N_codons)) { 
     
    252252            } 
    253253        } 
    254      
    255          
     254 
     255 
    256256        free(Q_codons); 
    257257        free(E_codons); 
     
    259259        free(D_codons); 
    260260    } 
    261      
    262     T('-', "---", "---");  
     261 
     262    T('-', "---", "---"); 
    263263    T('.', "...", "..."); 
    264264    T('.', "???", "???"); 
    265265    T('X', "NNN", "NNN"); 
    266266 
    267      
    268 /*     
     267 
     268/* 
    269269    T("A","Ala","GCT"); 
    270270    T("A","Ala","GCC"); 
     
    276276    T("R","Arg","CGA"); 
    277277    T("R","Arg","CGG");                         T("R","Arg","CGX"); 
    278      
     278 
    279279        T("R","Arg","AGA"); 
    280280        T("R","Arg","AGG"); 
     
    283283        T("N","Asn","AAT"); 
    284284        T("N","Asn","AAC");                     T("N","Asn","AAY"); 
    285          
     285 
    286286        T("D","Asp","GAT"); 
    287287        T("D","Asp","GAC");                     T("D","Asp","GAY"); 
    288          
     288 
    289289        T("C","Cys","TGT"); 
    290290        T("C","Cys","TGC");                     T("C","Cys","TGY"); 
    291          
     291 
    292292        T("Q","Gln","CAA"); 
    293293        if ( code_nr == AP_YEASTMITO ) { 
     
    295295            T("Q","Gln","CAG");                 T("Q","Gln","CAR"); 
    296296        } 
    297          
     297 
    298298        T("E","Glu","GAA"); 
    299299        if (code_nr == AP_MITO || 
     
    324324        T("L","Leu","CTG");             T("L","Leu","CTX"); 
    325325                                        T("L","Leu","YTR"); 
    326                                          
     326 
    327327        T("K","Lys","AAA"); 
    328328        T("K","Lys","AAG");             T("K","Lys","AAR"); 
     
    335335            T("M","Met","ATG"); 
    336336        } 
    337              
     337 
    338338        T("F","Phe","TTT"); 
    339339        T("F","Phe","TTC");                     T("F","Phe","TTY"); 
    340          
     340 
    341341        T("P","Pro","CCT"); 
    342342        T("P","Pro","CCC"); 
    343343        T("P","Pro","CCA"); 
    344344        T("P","Pro","CCG");                     T("P","Pro","CCX"); 
    345          
     345 
    346346        T("s","Ser","TCT");             // Special insertion, why?? see phylip 
    347347        T("s","Ser","TCC"); 
    348348        T("s","Ser","TCG"); 
    349349        T("s","Ser","TCA");                     T("s","Ser","TCX"); 
    350          
     350 
    351351        T("S","Ser","AGT"); 
    352352        T("S","Ser","AGC");                     T("S","Ser","AGY"); 
    353          
     353 
    354354        T("T","Thr","ACT"); 
    355355        T("T","Thr","ACC"); 
    356356        T("T","Thr","ACA"); 
    357357        T("T","Thr","ACG");                     T("T","Thr","ACX"); 
    358          
     358 
    359359        if (    code_nr == AP_YEASTMITO ){ 
    360360            T("T","Thr","CAG"); 
    361361        } 
    362          
     362 
    363363        T("W","Trp","TGG"); 
    364364        if (code_nr == AP_MITO || 
     
    372372        T("Y","Tyr","TAC");                     T("Y","Tyr","TAY"); 
    373373 
    374          
     374 
    375375        T("V","Val","GTA"); 
    376376        T("V","Val","GTC"); 
     
    381381            }else{ 
    382382                T("V","Val","GTT");             T("V","Val","GTH"); 
    383             }        
     383            } 
    384384        }else{ 
    385385            T("V","Val","GTT"); 
    386386            T("V","Val","GTG");                 T("V","Val","GTX"); 
    387387        } 
    388          
     388 
    389389        T("*","End","TAA"); 
    390390        T("*","End","TAG"); 
     
    395395            T("*","End","GTG"); 
    396396        } 
    397          
     397 
    398398        if (    code_nr == AP_VERTMITO ){ 
    399399            T("*","End","GTT"); 
    400400        } 
    401              
     401 
    402402                awt_pro_a_nucs->realmax_aa = awt_pro_a_nucs->max_aa; 
    403403        T("-","---","---"); 
    404              
    405              
     404 
     405 
    406406        // T("B","Asx","AAC"); 
    407407        // T("B","Asx","AAT"); 
     
    414414                T("B","Asx","RAY"); 
    415415        T("Z","Glx","SAR"); 
    416                  
     416 
    417417        T(".","...","..."); 
    418418        T(".","???","???"); 
    419419        T(".","NNN","NNN"); 
    420 */       
    421          
     420*/ 
     421 
    422422        awt_pro_a_nucs->pro_2_bitset = awt_nuc_create_pro_to_bits(); 
    423423} 
     
    452452                                // check bits should not be present in distpad 
    453453                if (s<awt_pro_a_nucs->realmax_aa) for (i=0;i<2;i++) { 
    454                         if (    awt_pro_a_nucs->dist[s]->patd[i] &  
     454                        if (    awt_pro_a_nucs->dist[s]->patd[i] & 
    455455                                ~awt_pro_a_nucs->dist[s]->patd[i+1]) GB_CORE; 
    456456                } 
     
    519519#ifndef NDEBUG 
    520520        awt_pro_a_nucs_debug(); 
    521 #endif   
    522 } 
     521#endif 
     522} 
  • trunk/AWT/AWT_query_and_functions.cxx

    r622 r655  
    44#include <time.h> 
    55#include <string.h> 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77#include <memory.h> 
    88#include <ctype.h> 
  • trunk/AWT/AWT_sel_boxes.cxx

    r463 r655  
    44#include <time.h> 
    55#include <string.h> 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77#include <memory.h> 
    88 
  • trunk/AWT/AWT_seq_colors.cxx

    r169 r655  
    33#include <string.h> 
    44#include <ctype.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <arbdb.h> 
    77#include <arbdbt.h> 
  • trunk/AWT/AWT_species_sel_box.cxx

    r540 r655  
    44#include <time.h> 
    55#include <string.h> 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77#include <memory.h> 
    88 
  • trunk/AWT/AWT_tables.cxx

    r210 r655  
    44#include <time.h> 
    55#include <string.h> 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77#include <memory.h> 
    88 
  • trunk/AWT/AWT_tree.cxx

    r377 r655  
    33#include <stdlib.h> 
    44 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <math.h> 
    77#include <string.h> 
  • trunk/AWT/AWT_tree_cmp.cxx

    r608 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2// #include <malloc.h> 
    33#include <memory.h> 
    44#include <string.h> 
  • trunk/AWT/AWT_www.cxx

    r566 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
  • trunk/AWT/BI_helix.cxx

    r2 r655  
    33#include <string.h> 
    44#include <ctype.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <arbdb.h> 
    77#include <arbdbt.h> 
     
    2626    long        pos; 
    2727    BI_PAIR_TYPE type; 
    28     char        c;       
     28    char        c; 
    2929}; 
    3030 
     
    6464    entries = 0; 
    6565    size = 0; 
    66          
     66 
    6767    pairs[HELIX_NONE]=strdup(""); 
    6868    char_bind[HELIX_NONE] = strdup(" "); 
     
    175175    char *sident; 
    176176    struct helix_stack *laststack = 0,*stack; 
    177          
     177 
    178178    size = sizei; 
    179179 
     
    220220        } 
    221221        c = helix[pos]; 
    222         if (strchr(LEFT_HELIX,c) || strchr(LEFT_NONS,c)  ){     // push  
     222        if (strchr(LEFT_HELIX,c) || strchr(LEFT_NONS,c)  ){     // push 
    223223            laststack = (struct helix_stack *)GBS_read_hash(hash,ident); 
    224224            stack = new helix_stack; 
     
    228228            GBS_write_hash(hash,ident,(long)stack); 
    229229        } 
    230         else if (strchr(RIGHT_HELIX,c) || strchr(RIGHT_NONS,c) ){       // pop  
     230        else if (strchr(RIGHT_HELIX,c) || strchr(RIGHT_NONS,c) ){       // pop 
    231231            stack = (struct helix_stack *)GBS_read_hash(hash,ident); 
    232232            if (!stack) { 
     
    310310        GBDATA *gb_helix = 0; 
    311311        GBDATA *gb_helix_nr = 0; 
    312          
     312 
    313313        if (gb_helix_nr_con)    gb_helix_nr = GBT_read_sequence(gb_helix_nr_con,alignment_name); 
    314314        if (gb_helix_con)       gb_helix = GBT_read_sequence(gb_helix_con,alignment_name); 
    315          
     315 
    316316        err = init(gb_helix_nr, gb_helix, size2); 
    317317    } 
     
    423423    char *buffer = GB_give_buffer(size+1); 
    424424    register unsigned long i,j,k; 
    425          
     425 
    426426    for (k=0; k<size; k++) { 
    427427        i = k+start; 
     
    465465    aws->at_newline(); 
    466466 
    467     aws->label_length( 18 );     
     467    aws->label_length( 18 ); 
    468468    int i; 
    469469    int j; 
     
    472472    for (j=0; helix_awars[j].awar; j++){ 
    473473 
    474         aws->label_length( 25 );         
     474        aws->label_length( 25 ); 
    475475        i = helix_awars[j].pair_type; 
    476476 
  • trunk/AWTC/AWTC_ClustalV.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <stdio.h> 
     
    4141#define MAXN_2_assert(xxx)      awtc_assert(xxx) 
    4242#else 
    43 #define MAXN_2(xxx)              
     43#define MAXN_2(xxx) 
    4444#define MAXN_2_assert(xxx) 
    4545#endif 
     
    6464static int pos1; 
    6565static int pos2; 
    66 static int **naa1;              // naa1[basetype][position]     counts bases for each position of all sequences in group1        
     66static int **naa1;              // naa1[basetype][position]     counts bases for each position of all sequences in group1 
    6767static int **naa2;              // naa2[basetype][position]     same for group2 
    68 static int **naas;              //  
     68static int **naas;              // 
    6969static int seqlen_array[MAXN+1];// length of all sequences 
    7070static char *seq_array[MAXN+1]; // the sequences 
    71 static int group[MAXN+1];       // group of sequence  
     71static int group[MAXN+1];       // group of sequence 
    7272static int alist[MAXN+1];       // indices of sequences to be aligned 
    73 static int fst_list[MAXN+1];     
     73static int fst_list[MAXN+1]; 
    7474static int snd_list[MAXN+1]; 
    7575static int nseqs;               // # of sequences 
     
    102102static inline int master_gap_open(int beforePosition) 
    103103{ 
    104 #ifdef DYNAMIC_PENALTIES     
     104#ifdef DYNAMIC_PENALTIES 
    105105    long gaps = gapsBeforePosition[beforePosition-1]; 
    106    return (gaps)? MASTER_GAP_OPEN - MAX_GAP_OPEN_DISCOUNT : MASTER_GAP_OPEN;  
    107      
     106   return (gaps)? MASTER_GAP_OPEN - MAX_GAP_OPEN_DISCOUNT : MASTER_GAP_OPEN; 
     107 
    108108/*    return 
    109109        gaps >= MAX_GAP_OPEN_DISCOUNT 
     
    112112#else 
    113113    return DEFAULT_GAP_OPEN; 
    114 #endif     
     114#endif 
    115115} 
    116116static inline int master_gap_extend(int beforePosition) 
    117117{ 
    118 #ifdef DYNAMIC_PENALTIES     
     118#ifdef DYNAMIC_PENALTIES 
    119119    long gaps = gapsBeforePosition[beforePosition-1]; 
    120      
     120 
    121121 return (gaps)? MASTER_GAP_EXTEND - MAX_GAP_EXTEND_DISCOUNT : MASTER_GAP_EXTEND; 
    122122/*    return 
     
    126126#else 
    127127    return DEFAULT_GAP_EXTEND; 
    128 #endif     
     128#endif 
    129129} 
    130130 
     
    133133    if (length<=0) 
    134134        return 0; 
    135      
     135 
    136136    int beforePosition = atPosition, 
    137137        afterPosition = atPosition-1; 
     
    140140    { 
    141141        int p1,p2; 
    142          
     142 
    143143        if ((p1=master_gap_extend(beforePosition)) < (p2=master_gap_extend(afterPosition+1)) && 
    144144            beforePosition>1) 
     
    207207{ 
    208208#define COMPARABLE_BASES 5 
    209      
     209 
    210210    if (c1==c2) return 0; 
    211211 
     
    217217        c2 = c3; 
    218218    } 
    219      
    220     if (c2<=COMPARABLE_BASES)  
     219 
     220    if (c2<=COMPARABLE_BASES) 
    221221    { 
    222222        awtc_assert(c1<=COMPARABLE_BASES); 
     
    237237    int i; 
    238238    int bestMatch = 3; 
    239      
     239 
    240240    if (c1<=COMPARABLE_BASES) 
    241241    { 
     
    293293    return 0; 
    294294} 
    295      
     295 
    296296static char *result[3];         // result buffers 
    297297 
     
    372372{ 
    373373    int len = strlen(amino_acid_order); 
    374      
     374 
    375375    for (int i=1; i<=l && naseq[i]; i++) 
    376376    { 
     
    385385{ 
    386386    int len = strlen(nucleic_acid_order); 
    387      
     387 
    388388    for (int i=1; i<=l && naseq[i]; i++) 
    389389    { 
     
    414414 
    415415    if (error) return; 
    416          
     416 
    417417    naa1 = (int **)ckalloc(21 * sizeof (int *) ); 
    418418    for(i=0;i<21;i++) naa1[i]=(int *)ckalloc( (max_seq_length+1)*sizeof (int)); 
    419419    if (error) return; 
    420      
     420 
    421421    naa2 = (int **)ckalloc(21 * sizeof (int *) ); 
    422422    for(i=0;i<21;i++) naa2[i]=(int *)ckalloc( (max_seq_length+1)*sizeof (int)); 
    423423    if (error) return; 
    424      
     424 
    425425    naas = (int **)ckalloc(21 * sizeof (int *) ); 
    426426    for(i=0;i<21;i++) naas[i]=(int *)ckalloc( (max_seq_length+1)*sizeof (int)); 
     
    431431{ 
    432432    register int i,c; 
    433          
     433 
    434434    little_pam=big_pam=matptr[0]; 
    435435    for(i=0;i<210;++i) { 
     
    452452{ 
    453453    register int i,j,pos; 
    454          
     454 
    455455    pos=0; 
    456          
     456 
    457457    for(i=0;i<20;++i) 
    458458        for(j=0;j<=i;++j) 
    459459            pam[i][j]=pamo[pos++]; 
    460          
     460 
    461461    for(i=0;i<20;++i) 
    462462        for(j=0;j<=i;++j) 
    463463            pam[j][i]=pam[i][j]; 
    464          
     464 
    465465    if(dnaflag) 
    466466    { 
     
    520520        displ[print_ptr++] = last_print; 
    521521    } 
    522     else {  
     522    else { 
    523523        last_print = displ[print_ptr++] = v; 
    524524    } 
     
    531531    int j = seq_array[alist[1]][v2+jat-1]; 
    532532    return j>0 ? naas[j][v1+iat-1] : 0; 
    533 #else     
     533#else 
    534534    int sum,i,j,lookn,ret; 
    535535    int ipos,jpos; 
    536          
     536 
    537537    ipos = v1 + iat -1; 
    538538    jpos = v2 + jat -1; 
    539      
     539 
    540540    ret = 0; 
    541541    sum = lookn = 0; 
     
    551551                ++lookn; 
    552552            } 
    553         }        
     553        } 
    554554    } 
    555555    else 
     
    567567    if (sum>0) ret = sum/lookn; 
    568568    return ret; 
    569 #endif   
     569#endif 
    570570} 
    571571 
     
    631631 
    632632#ifdef DEBUG 
    633 # ifdef MATRIX_DUMP     
     633# ifdef MATRIX_DUMP 
    634634    int display_matrix = 0; 
    635      
     635 
    636636    awtc_assert(v3<=(DISPLAY_MATRIX_SIZE+2));   // width 
    637637    awtc_assert(v4<=(DISPLAY_MATRIX_SIZE));             // height 
    638638 
    639639# define DISPLAY_MATRIX_ELEMENTS ((DISPLAY_MATRIX_SIZE+2)*(DISPLAY_MATRIX_SIZE+2)) 
    640      
     640 
    641641    memset(vertical, -1, DISPLAY_MATRIX_ELEMENTS*sizeof(int)); 
    642642    memset(verticalOpen, -1, DISPLAY_MATRIX_ELEMENTS*sizeof(int)); 
     
    644644    memset(horizontal, -1, DISPLAY_MATRIX_ELEMENTS*sizeof(int)); 
    645645    memset(horizontalOpen, -1, DISPLAY_MATRIX_ELEMENTS*sizeof(int)); 
    646      
     646 
    647647# endif 
    648 #endif     
     648#endif 
    649649    static int deep; 
    650650    deep++; 
     
    665665        printf("slave  = '%s'\n", d); 
    666666    } 
    667 #endif     
     667#endif 
    668668 
    669669    // q  = gap_open + gap_extend;              // q is replaced for local positions 
    670      
     670 
    671671    if(v4<=0) {                                                 // if slave sequence is empty 
    672672        if(v3>0) { 
     
    675675            } 
    676676            else { 
    677                 last_print = displ[print_ptr++] = -(v3);        // .. or insert gap of length 'v3' into slave  
     677                last_print = displ[print_ptr++] = -(v3);        // .. or insert gap of length 'v3' into slave 
    678678            } 
    679679        } 
    680680 
    681681        deep--; 
    682         return master_gapAt(v1,v3);  
    683     } 
    684      
    685     if(v3<=1) {                  
     682        return master_gapAt(v1,v3); 
     683    } 
     684 
     685    if(v3<=1) { 
    686686        if(v3<=0) {                                             // if master sequence is empty 
    687687            add(v4);                                            // ??? insert gap length 'v4' into master ??? 
     
    702702            ctrc = slave_gapAtWithOpenPenalty(v2,v4,st); 
    703703            ctrj = 0; 
    704          
     704 
    705705            for(j=1;j<=v4;++j) 
    706706            { 
     
    732732 
    733733    awtc_assert(v3>=1 && v4>=1); 
    734      
     734 
    735735    // slave length  >= 1 
    736736    // master length >= 1 
     
    742742        zza[0] = 0; 
    743743    p = master_gap_open(v1); 
    744     for(j=1; j<=v4; j++)                 
     744    for(j=1; j<=v4; j++) 
    745745    { 
    746746        p += master_gap_extend(v1); 
     
    750750            zzb[j] = p + master_gap_open(v1); 
    751751    } 
    752      
     752 
    753753    // left half of the matrix 
    754754    p = st; 
    755     ctri = v3 / 2;  
    756     for(i=1; i<=ctri; i++)       
     755    ctri = v3 / 2; 
     756    for(i=1; i<=ctri; i++) 
    757757    { 
    758758        n = zza[0]; 
     
    762762            zza[0] = k; 
    763763        l = p + master_gap_open(v1+i+AF); 
    764          
     764 
    765765        for(j=1; j<=v4; j++) 
    766766        { 
     
    777777            // diagonal (no gaps) 
    778778            IF_MATRIX_DUMP(diagonal[i][j]=)             k = n + calc_weight(i,j,v1,v2);                                 // (5) 
    779             if(l<k) k = l;       
     779            if(l<k) k = l; 
    780780            if(m<k) k = m;      // k = minimum of all paths 
    781              
     781 
    782782            n = zza[j];         // minimum of same row; one column to the left 
    783783            zza[j] = k;         // minimum of all paths to this matrix position 
     
    788788# define MHO 1  // X-Offset for second half of matrix-arrays (only used to insert MID-column into dumpMatrix()) 
    789789# define BO  1  // Offset for second half of matrix (cause now the indices i and j are smaller as above) 
    790      
     790 
    791791    // last column of matrix: 
    792      
     792 
    793793    zzb[0]=zza[0]; 
    794794    IF_MATRIX_DUMP(vertical[v3+1+MHO][v4+1]=) 
     
    803803            zzd[j] = p+master_gap_open(v1+v3); 
    804804    } 
    805      
     805 
    806806    // right half of matrix (backwards): 
    807807    p = en; 
    808     for(i=v3-1;i>=ctri;i--)      
     808    for(i=v3-1;i>=ctri;i--) 
    809809    { 
    810810        n = zzc[v4]; 
     
    814814            zzc[v4] = k; 
    815815        l = p+master_gap_open(v1+i); 
    816          
     816 
    817817        for(j=v4-1; j>=0; j--) 
    818818        { 
     
    831831            if(l<k) k = l; 
    832832            if(m<k) k = m;      // k = minimum of all paths 
    833              
     833 
    834834            n = zzc[j];         // minimum of same row; one column to the right 
    835835            zzc[j] = k;         // minimum of all paths to this matrix position 
     
    839839 
    840840#undef BO 
    841      
     841 
    842842    // connect rightmost column of first half (column ctri) 
    843843    // with leftmost column of second half (column ctri+1) 
    844          
     844 
    845845    zzd[v4] = zzc[v4]; 
    846846 
    847847    ctrc = INT_MAX; 
    848848    flag = 0; 
    849      
     849 
    850850    for(j=(ctri?0:1);j<=v4;j++) // was j=0;...  (this was erroneous cause it splitted zero-length subsequences) 
    851851    { 
    852852        IF_MATRIX_DUMP(vertical[ctri+MHO][j]=) 
    853853            k = zza[j] + zzc[j];                // sum up both calculations (=diagonal=no gaps) 
    854          
     854 
    855855        if (k<ctrc || ((k==ctrc) && (zza[j]!=zzb[j]) && (zzc[j]==zzd[j]))) 
    856856        { 
     
    861861    } 
    862862 
    863     for(j=v4;j>=(ctri?0:1);j--)  
     863    for(j=v4;j>=(ctri?0:1);j--) 
    864864    { 
    865865        IF_MATRIX_DUMP(verticalOpen[ctri+MHO][j]=) 
    866866            k = zzb[j] + zzd[j]                 // paths where gaps were inserted into slave (left and right side!) 
    867867            - slave_gap_open(j);                // subtract gap_open-penalty which was added twice (at left and right end of gap) 
    868          
     868 
    869869        if(k<ctrc) 
    870870        { 
     
    877877    awtc_assert(flag>=1 && flag<=2); 
    878878 
    879 #undef MHO     
    880      
    881 #ifdef MATRIX_DUMP     
     879#undef MHO 
     880 
     881#ifdef MATRIX_DUMP 
    882882    if (display_matrix) 
    883883        dumpMatrix(v1,v2,v3,v4,ctri); 
    884884#endif 
    885      
     885 
    886886    /* Conquer recursively around midpoint  */ 
    887887 
    888888    if(flag==1)                 /* Type 1 gaps  */ 
    889     {      
     889    { 
    890890        diff(v1,v2,ctri,ctrj,st,master_gap_open(v1+ctri));                      // includes midpoint ctri and ctrj 
    891891        diff(v1+ctri,v2+ctrj,v3-ctri,v4-ctrj,master_gap_open(v1+ctri),en); 
     
    894894    { 
    895895        diff(v1,v2,ctri-1,ctrj,st,0);                                           // includes midpoint ctrj 
    896          
     896 
    897897        if(last_print<0)                         /* Delete 2 */ 
    898898            last_print = displ[print_ptr-1] -= 2; 
    899899        else 
    900900            last_print = displ[print_ptr++] = -2; 
    901          
    902         diff(v1+ctri+1,v2+ctrj,v3-ctri-1,v4-ctrj,0,en);  
     901 
     902        diff(v1+ctri+1,v2+ctrj,v3-ctri-1,v4-ctrj,0,en); 
    903903    } 
    904904 
     
    916916    // clear statistics 
    917917 
    918     for(i=1;i<=act_seq_length;++i)               
     918    for(i=1;i<=act_seq_length;++i) 
    919919    { 
    920920        for(j=0;j<21;++j) naa1[j][i]=naa2[j][i]=0; 
     
    924924    // create position statistics for each group 
    925925    // [here every group contains only one seq] 
    926      
     926 
    927927    for(i=1;i<=nseqs;++i) 
    928928    { 
     
    933933                if(seq_array[i][j]>0) 
    934934                { 
    935                     ++naa1[seq_array[i][j]][j];          
     935                    ++naa1[seq_array[i][j]][j]; 
    936936                    ++naa1[0][j]; 
    937937                } 
     
    984984                    naas[i][n]=t_arr[i]/k; 
    985985        } 
    986 #endif   
     986#endif 
    987987    } 
    988988 
     
    994994{ 
    995995    int i,j,k,xtra; 
    996          
     996 
    997997    for(i=1;i<=nseqs;++i) 
    998998        if(group[i] == sclass) 
     
    10161016{ 
    10171017    int i,j,k,pos,to_do; 
    1018      
     1018 
    10191019    pos=1; 
    10201020    to_do=print_ptr; 
    1021          
    1022     for(i=0;i<to_do;++i)        // was: 1 .. <=to_do  
     1021 
     1022    for(i=0;i<to_do;++i)        // was: 1 .. <=to_do 
    10231023    { 
    10241024        if(displ[i]==0) 
     
    10511051    } 
    10521052 
    1053 #ifdef DEBUG     
     1053#ifdef DEBUG 
    10541054    result[1][pos] = 0; 
    10551055    result[2][pos] = 0; 
    1056 #endif     
    1057          
     1056#endif 
     1057 
    10581058    return pos-1; 
    10591059} 
     
    10781078    { 
    10791079        int c = res_index(amino_acid_order,seq[i]); 
    1080          
     1080 
    10811081        if (!c) 
    10821082        { 
    10831083            if (seq[i]!='?') { // consensus contains ??? 
    10841084                char buf[100]; 
    1085                 sprintf(buf, "Illegal character '%c' in sequence data", seq[i]);         
     1085                sprintf(buf, "Illegal character '%c' in sequence data", seq[i]); 
    10861086                aw_message(buf); 
    10871087            } 
    1088              
    1089             c = res_index(amino_acid_order, 'X');        
    1090         } 
    1091          
     1088 
     1089            c = res_index(amino_acid_order, 'X'); 
     1090        } 
     1091 
    10921092        awtc_assert(c>0); 
    10931093        naseq[i] = c; 
     
    10971097} 
    10981098 
    1099 static GB_ERROR n_encode(const char *seq,char *naseq,int l)              
     1099static GB_ERROR n_encode(const char *seq,char *naseq,int l) 
    11001100{                                       /* code seq as ints .. use -2 for gap */ 
    11011101    int i; 
    11021102/*      static char *nucs="ACGTU";      */ 
    11031103    int warned = 0; 
    1104          
     1104 
    11051105    for(i=1; i<=l; i++) 
    11061106    { 
     
    11121112                if (!warned) { 
    11131113                    char buf[100]; 
    1114                     sprintf(buf, "Illegal character '%c' in sequence data", seq[i]);     
     1114                    sprintf(buf, "Illegal character '%c' in sequence data", seq[i]); 
    11151115                    aw_message(buf); 
    11161116                    warned = 1; 
     
    11191119            c = res_index(nucleic_acid_order, 'N'); 
    11201120        } 
    1121          
     1121 
    11221122        awtc_assert(c>0); 
    11231123        naseq[i] = c; 
     
    11321132                             const int *gapsBefore1, 
    11331133                             int max_seq_length, 
    1134                              char **resultPtr1,  
     1134                             char **resultPtr1, 
    11351135                             char **resultPtr2, 
    11361136                             int *resLengthPtr, 
     
    11391139    error = 0; 
    11401140    gapsBeforePosition = gapsBefore1; 
    1141      
     1141 
    11421142    if (!module_initialized)            // initialize only once 
    11431143    { 
    11441144        dnaflag = is_dna; 
    11451145        is_weight = weighted; 
    1146          
     1146 
    11471147        init_myers(max_seq_length); 
    11481148        init_show_pair(max_seq_length); 
    11491149        make_pamo(0); 
    11501150        fill_pam(); 
    1151          
     1151 
    11521152        for (int i=1; i<=2; i++) 
    11531153        { 
     
    11581158 
    11591159        if (error) goto ende; 
    1160          
     1160 
    11611161        module_initialized = 1; 
    11621162    } 
     
    11781178    memset(&seq_array[2][1], 0, max_seq_length*sizeof(seq_array[2][1])); 
    11791179    memset(&displ[1], 0xff, max_seq_length*sizeof(displ[1])); 
    1180     seq_array[1][0] = '_';       
     1180    seq_array[1][0] = '_'; 
    11811181    seq_array[2][0] = '_'; 
    1182 #endif     
     1182#endif 
    11831183 
    11841184    { 
     
    11881188        if (error) goto ende; 
    11891189        seqlen_array[1] = length1; 
    1190      
     1190 
    11911191        error = encode(seq2-1, seq_array[2], length2); 
    11921192        if (error) goto ende; 
     
    12021202    } 
    12031203 
    1204 ende:     
     1204ende: 
    12051205 
    12061206    return error; 
  • trunk/AWTC/AWTC_rename.cxx

    r205 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <arbdb.h> 
    66#include <arbdbt.h> 
  • trunk/AWTI/AWTI_export.cxx

    r640 r655  
    33#include <unistd.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <arbdb.h> 
    77#include <arbdbt.h> 
  • trunk/AWTI/AWTI_import.cxx

    r636 r655  
    33#include <unistd.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <memory.h> 
    77#include <limits.h> 
  • trunk/CAT/CAT_tree.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <memory.h> 
    66 
     
    1313const char *CAT_field_names[CAT_FIELD_MAX];     // Fields which are extracted from the arb database 
    1414                        // syntax:      field[:word/(range of words] 
    15                         // ex   full_name  
     15                        // ex   full_name 
    1616 
    1717double CATL_tree_max_deep(GBT_TREE *tree){ 
     
    8585                        return GB_export_error("Disk Full"); 
    8686                } 
    87         }        
     87        } 
    8888        return 0; 
    8989} 
     
    107107                cat_tree->nodes[node->leftson].father = nodec; 
    108108                cat_tree->nodes[node->rightson].father = nodec; 
    109                  
     109 
    110110                double l = tree->leftlen; 
    111111                double r = tree->rightlen; 
    112                  
     112 
    113113                if (l<0) l = 0.0; 
    114114                if (r<0) r = 0.0; 
    115                  
     115 
    116116                cat_tree->nodes[node->leftson].branch_length_float = l; 
    117117                cat_tree->nodes[node->rightson].branch_length_float = r; 
     
    119119                l *= scale; 
    120120                r *= scale; 
    121                 if (l>0 && l<1) l = 1;  
     121                if (l>0 && l<1) l = 1; 
    122122                if (r>0 && r<1) r = 1; 
    123123 
    124124                if (l> 255) l = 255; 
    125125                if (r > 255) l = 255; 
    126                  
     126 
    127127                cat_tree->nodes[node->leftson].branch_length_byte = (unsigned char)l; 
    128128                cat_tree->nodes[node->rightson].branch_length_byte = (unsigned char)r; 
     
    164164                            fullname = name; 
    165165                        } 
    166                          
     166 
    167167                        node->field_offsets[CAT_FIELD_NAME] = GBS_memoffset(cat_mem_files[CAT_FIELD_NAME]); 
    168168                        GBS_strcat(cat_mem_files[CAT_FIELD_NAME],name); 
    169169                        GBS_chrcat(cat_mem_files[CAT_FIELD_NAME],1);    // seperated by '^A' 
    170                          
     170 
    171171                        node->field_offsets[CAT_FIELD_FULL_NAME] = GBS_memoffset(cat_mem_files[CAT_FIELD_FULL_NAME]); 
    172172                        GBS_strcat(cat_mem_files[CAT_FIELD_FULL_NAME],fullname); 
     
    207207 
    208208        double scale = 255/CATL_tree_max_deep(tree); 
    209         cat_convert_tree_2_cat_rek(tree, cat_tree, 0,scale,  
     209        cat_convert_tree_2_cat_rek(tree, cat_tree, 0,scale, 
    210210                                level_counter, leaf_counter, node_counter); 
    211211        int i; 
     
    228228                CAT_node *node = & cat_tree->nodes[i]; 
    229229                printf("%4i f%4li l%4li r%4li lfn%4li lvl%4li d%4li bl%4i    ", 
    230                         i,  
     230                        i, 
    231231                        node->father, 
    232232                        node->leftson, 
     
    240240                        if (node->field_offsets[j]) { 
    241241                                printf("%15s ",cat_tree->data+node->field_offsets[j]); 
    242                         }        
     242                        } 
    243243                } 
    244244                printf("\n"); 
  • trunk/DIST/PH_matr.cxx

    r102 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
  • trunk/DIST/PH_mldist.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    170170                    d2p = 0.0; 
    171171                    predict(tt, b1, b2); 
    172                  
     172 
    173173                    if (p > 0.0){ 
    174174                        double ip = 1.0/p; 
  • trunk/DIST/PH_protdist.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    791791                        code(); 
    792792                        pameigen(); 
    793                         break;                   
     793                        break; 
    794794                default: 
    795795                        code(); 
  • trunk/DIST/PH_save_matr.cxx

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <memory.h> 
    55#include <string.h> 
     
    5959                double max = min; 
    6060                double sum = 0.0; 
    61                          
     61 
    6262                make_node_text_init(gb_main); 
    6363                for (row = 0; row<nentries;row++){ 
  • trunk/DIST/distanalyse.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    103103 
    104104} 
    105          
    106          
    107                  
     105 
     106 
     107 
  • trunk/EDIT/edit.cxx

    r435 r655  
    22#include <stdlib.h> // wegen exit(); 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
  • trunk/EDIT4/ED4_base.cxx

    r584 r655  
    33#include <string.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <assert.h> 
    77 
  • trunk/EDIT4/ED4_edit_string.cxx

    r535 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <memory.h> 
    55#include <string.h> 
  • trunk/EDIT4/ED4_main.cxx

    r583 r655  
    33#include <string.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66 
    77#include <arbdb.h> 
  • trunk/EDIT4/ED4_manager.cxx

    r629 r655  
    33#include <string.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <math.h> 
    77 
  • trunk/EDIT4/ED4_members.cxx

    r584 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55 
    66#include <arbdb.h> 
  • trunk/EDIT4/ED4_terminal.cxx

    r68 r655  
    33#include <string.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <assert.h> 
    77 
  • trunk/EDIT4/ED4_text_terminals.cxx

    r581 r655  
    33#include <string.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66 
    77#include <arbdb.h> 
  • trunk/GDE/CLUSTALW/clustalw.h

    r176 r655  
    1 /*#include "/us1/user/julie/dmalloc/malloc.h"*/ 
    21/*********************CLUSTALW.H*********************************************/ 
    32/****************************************************************************/ 
     
    1413/*#define MSDOS 1               Turbo C for PC's */ 
    1514 
    16 #define UNIX 1                /*Ultrix/Decstation, Gnu C for  
     15#define UNIX 1                /*Ultrix/Decstation, Gnu C for 
    1716                                Sun, IRIX/SGI, OSF1/ALPHA */ 
    1817 
     
    2625#define MAXTITLES               60      /* Title length */ 
    2726#define FILENAMELEN     256             /* Max. file name length */ 
    28          
     27 
    2928#define UNKNOWN   0 
    3029#define EMBLSWISS 1 
     
    5756#ifdef VMS                                              /* Defaults for VAX VMS */ 
    5857#define COMMANDSEP '/' 
    59 #define DIRDELIM ']'            /* Last character before file name in full file  
     58#define DIRDELIM ']'            /* Last character before file name in full file 
    6059                                                           specs */ 
    6160#define INT_SCALE_FACTOR 1000 /* Scaling factor to convert float to integer for profile scores */ 
     
    114113 
    115114typedef struct { 
    116         int llimit;      
     115        int llimit; 
    117116        int ulimit; 
    118117        short *matptr; 
     
    124123        SeriesMat mat[MAXMAT]; 
    125124} UserMatSeries; 
    126          
     125 
    127126 
    128127/* 
     
    166165                   sint prf_length, sint gapcoef, sint lencoef); 
    167166/* calcprf1.c */ 
    168 void calc_prf1(sint **profile, char **alignment, sint *gaps, sint matrix[NUMRES ][NUMRES ],  
     167void calc_prf1(sint **profile, char **alignment, sint *gaps, sint matrix[NUMRES ][NUMRES ], 
    169168               sint *seq_weight, sint prf_length, sint first_seq, sint last_seq); 
    170169/* calcprf2.c */ 
  • trunk/GDE/CORE/BasicDisplay.c

    r2 r655  
    1 #include <malloc.h> 
     1/* #include <malloc.h> */ 
    22#include <X11/X.h> 
    33#include <X11/Xlib.h> 
     
    6969                /* 
    7070*       For all menus defined in the .GDEmenu file, create a corresponding 
    71 *       menu on the menu bar, and tie its XView object to the internal  
     71*       menu on the menu bar, and tie its XView object to the internal 
    7272*       menu structure. 
    7373*/ 
     
    378378            OPENWIN_SPLIT_INIT_PROC,InitEditSplit, 
    379379            OPENWIN_SPLIT_DESTROY_PROC,DestroySplit, 
    380             NULL,  
     380            NULL, 
    381381            WIN_INHERIT_COLORS,FALSE, 
    382382            WIN_BELOW,menubar, 
     
    588588                    CANVAS_RETAINED,FALSE, 
    589589                    0); 
    590          
     590 
    591591                xv_set(NamCan, 
    592592                    WIN_HEIGHT,MIN(MAX_STARTUP_CANVAS_HEIGHT, 
  • trunk/GDE/CORE/BuiltIn.c

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include <string.h> 
    44#include <xview/xview.h> 
     
    127127        popup = xv_get(pframe,FRAME_CMD_PANEL); 
    128128        (void)xv_create (popup,PANEL_BUTTON, 
    129             PANEL_LABEL_STRING,"OK",  
    130             PANEL_NOTIFY_PROC,SaveAsFileName,     
     129            PANEL_LABEL_STRING,"OK", 
     130            PANEL_NOTIFY_PROC,SaveAsFileName, 
    131131            0); 
    132132 
    133133        (void)xv_create (popup,PANEL_BUTTON, 
    134             PANEL_LABEL_STRING,"Cancel",  
    135             PANEL_NOTIFY_PROC,DONT,     
     134            PANEL_LABEL_STRING,"Cancel", 
     135            PANEL_NOTIFY_PROC,DONT, 
    136136            0); 
    137137 
     
    404404        (void)xv_set(popup,PANEL_LAYOUT,PANEL_VERTICAL,0); 
    405405 
    406         (void)xv_create(popup,PANEL_CHOICE_STACK,     
     406        (void)xv_create(popup,PANEL_CHOICE_STACK, 
    407407            PANEL_LAYOUT,PANEL_VERTICAL, 
    408408            PANEL_LABEL_STRING,"Color type", 
     
    441441        } 
    442442 
    443         (void)xv_create(popup,PANEL_CHOICE_STACK,     
     443        (void)xv_create(popup,PANEL_CHOICE_STACK, 
    444444            PANEL_LAYOUT,PANEL_VERTICAL, 
    445445            PANEL_NOTIFY_PROC,ChFontSize, 
     
    469469            "Inverted","Lock vertical scroll","Key clicks","Message panel", 
    470470            0, 
    471             PANEL_NOTIFY_PROC,ChDisAttr,  
    472             PANEL_VALUE,DisplayAttr,   
     471            PANEL_NOTIFY_PROC,ChDisAttr, 
     472            PANEL_VALUE,DisplayAttr, 
    473473            0); 
    474474 
     
    830830        DrawNANames(dpy,xv_get(canvas_paint_window(EditNameCan),XV_XID)); 
    831831        view = (Xv_window)xv_get(EditCan,OPENWIN_NTH_VIEW,0); 
    832          
     832 
    833833        OPENWIN_EACH_VIEW(EditCan,view) 
    834834                JumpTo(view, 0,lastselected); 
     
    11561156            PANEL_CHOICE_STRINGS, 
    11571157            "RNA", 
    1158             "DNA",  
     1158            "DNA", 
    11591159            "TEXT", 
    11601160            "MASK", 
     
    11741174        (void)xv_create(popup,PANEL_CHOICE_STACK, 
    11751175            PANEL_NOTIFY_PROC,ChAttrType, 
    1176             PANEL_LABEL_STRING,"Strand",  
     1176            PANEL_LABEL_STRING,"Strand", 
    11771177            PANEL_CHOICE_STRINGS, 
    11781178            "Primary", 
     
    11951195            PANEL_LAYOUT,PANEL_HORIZONTAL, 
    11961196            PANEL_NOTIFY_PROC,ChAttrType, 
    1197             PANEL_LABEL_STRING,"Direction",  
     1197            PANEL_LABEL_STRING,"Direction", 
    11981198            PANEL_CHOICE_STRINGS, 
    11991199            "5' to 3'", 
     
    12451245#ifdef HGL 
    12461246        if(sel_count == 1) 
    1247                 (void)xv_create(popup,PANEL_TEXT,  
    1248                     PANEL_VALUE_DISPLAY_LENGTH,40,  
     1247                (void)xv_create(popup,PANEL_TEXT, 
     1248                    PANEL_VALUE_DISPLAY_LENGTH,40, 
    12491249                    PANEL_LABEL_STRING,"Membrane  ", 
    12501250                    PANEL_VALUE,this_elem->membrane, 
     
    12571257 
    12581258        if(sel_count == 1) 
    1259                 (void)xv_create(popup,PANEL_TEXT,  
    1260                     PANEL_VALUE_DISPLAY_LENGTH,40,  
     1259                (void)xv_create(popup,PANEL_TEXT, 
     1260                    PANEL_VALUE_DISPLAY_LENGTH,40, 
    12611261                    PANEL_LABEL_STRING,"Author    ", 
    12621262                    PANEL_VALUE,this_elem->authority, 
     
    12691269#ifdef HGL 
    12701270        if(sel_count == 1) 
    1271                 (void)xv_create(popup,PANEL_TEXT,  
    1272                     PANEL_VALUE_DISPLAY_LENGTH,40,  
     1271                (void)xv_create(popup,PANEL_TEXT, 
     1272                    PANEL_VALUE_DISPLAY_LENGTH,40, 
    12731273                    PANEL_LABEL_STRING,"Barcode   ", 
    12741274                    PANEL_VALUE,this_elem->barcode, 
     
    13481348                            WIN_INHERIT_COLORS,TRUE, 
    13491349                            WIN_BELOW,comments_tsw, 
    1350                             XV_X,0, XV_HEIGHT,90,    
     1350                            XV_X,0, XV_HEIGHT,90, 
    13511351                            TEXTSW_CONTENTS,this_elem->baggage? 
    13521352                            this_elem->baggage:"", 
     
    13851385                Cfree(DataSet->element[lastselected].comments); 
    13861386 
    1387                 DataSet->element[lastselected].comments =  
     1387                DataSet->element[lastselected].comments = 
    13881388                    Calloc(xv_get(client,TEXTSW_LENGTH)+1,sizeof(char)); 
    13891389 
     
    13911391                    strlen(DataSet->element[lastselected].comments); 
    13921392 
    1393                 DataSet->element[lastselected].comments_maxlen =  
     1393                DataSet->element[lastselected].comments_maxlen = 
    13941394                    xv_get(client,TEXTSW_LENGTH); 
    13951395 
     
    19821982                        for(i=0;i<slen;i++) 
    19831983                        { 
    1984                                 rev_seq[i] =  
     1984                                rev_seq[i] = 
    19851985                                    (NA_Base)getelem(&(element[j]), 
    19861986                                    slen+offset - i - 1); 
  • trunk/GDE/CORE/CutCopyPaste.c

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include <string.h> 
    44#include <xview/xview.h> 
     
    1111#include "defines.h" 
    1212    extern Canvas EditCan,EditNameCan; 
    13     extern Panel_item left_foot,right_foot;  
     13    extern Panel_item left_foot,right_foot; 
    1414        extern Frame frame; 
    1515        extern NA_Alignment *DataSet,*Clipboard; 
     
    4848                                Clipboard->maxnumelements*sizeof(NA_Sequence)); 
    4949                        } 
    50                         Clipboard->element[(Clipboard->numelements)] =   
     50                        Clipboard->element[(Clipboard->numelements)] = 
    5151                        DataSet->element[j]; 
    5252/* 
     
    127127                                strdup(DataSet->element[j].comments); 
    128128                                Clipboard->element[this].comments_maxlen = 
    129                                 Clipboard->element[this].comments_len;  
     129                                Clipboard->element[this].comments_len; 
    130130                        } 
    131131/* 
     
    134134                        if(DataSet->element[j].baggage) 
    135135                        { 
    136                                 Clipboard->element[this].baggage = (char*)  
     136                                Clipboard->element[this].baggage = (char*) 
    137137                                strdup(DataSet->element[j].baggage); 
    138138                                Clipboard->element[this].baggage_maxlen = 
    139                                 Clipboard->element[this].baggage_len;  
     139                                Clipboard->element[this].baggage_len; 
    140140                        } 
    141141 
     
    174174Event *event; 
    175175{ 
    176          
     176 
    177177        extern Frame frame; 
    178178        extern Canvas EditCan,EditNameCan; 
     
    209209 
    210210        for(j=DataSet->numelements-1;j>=last+1;j--) 
    211         DataSet->element[j+Clipboard->numelements] =  
     211        DataSet->element[j+Clipboard->numelements] = 
    212212        DataSet->element[j]; 
    213213 
    214214        for(j=0;j<Clipboard->numelements;j++) 
    215215        { 
    216                 DataSet->element[last+1+j] = Clipboard->element[j];  
     216                DataSet->element[last+1+j] = Clipboard->element[j]; 
    217217/* 
    218218*       be sure to bring them back into alignment with the rest 
     
    255255                alignment->element[j].groupb = NULL; 
    256256        } 
    257          
     257 
    258258        for(group = 1;group <= alignment->numgroups;group++) 
    259259        { 
     
    264264                                if(last != -1) 
    265265                                { 
    266                                         alignment->element[j].groupb =  
     266                                        alignment->element[j].groupb = 
    267267                                        &(alignment->element[last]); 
    268                                         alignment->element[last].groupf =  
     268                                        alignment->element[last].groupf = 
    269269                                        &(alignment->element[j]); 
    270270                                } 
     
    337337*       Need to check protections 
    338338*/ 
    339                          
     339 
    340340                        for(i=0,blank_space = 0;i<this_elem->offset;i++) 
    341341                                if(DataSet->selection_mask[i] == '1') 
    342342                                        TextClip[numselected][blank_space++] = 
    343                                                 (char)getelem(this_elem,i);  
     343                                                (char)getelem(this_elem,i); 
    344344 
    345345 
     
    362362                                if((k!=0) && (i<this_elem->seqlen-1)) 
    363363                                { 
    364                                         this_elem->sequence[1+i-k] =  
     364                                        this_elem->sequence[1+i-k] = 
    365365                                        this_elem->sequence[1+i]; 
    366366                                        if(this_elem->cmask) 
    367367                                        { 
    368                                                 this_elem->cmask[1+i-k] =  
     368                                                this_elem->cmask[1+i-k] = 
    369369                                                this_elem->cmask[1+i]; 
    370370                                        } 
     
    417417                            if(DataSet->selection_mask[i] == '1') 
    418418                            { 
    419                                 base = (char)getelem(this_elem,i);  
     419                                base = (char)getelem(this_elem,i); 
    420420                                if(this_elem->tmatrix) 
    421421                                        tbase = (this_elem->tmatrix[base])|32; 
     
    446446                                                        GAP = TRUE; 
    447447                                                else 
    448                                                         UNAMB = TRUE;    
     448                                                        UNAMB = TRUE; 
    449449                                                break; 
    450450                                        default: 
     
    496496                return(XV_OK); 
    497497        } 
    498          
     498 
    499499        for(j=0;j<TextClipSize;j++) 
    500500        { 
     
    511511                } 
    512512        } 
    513          
     513 
    514514        RepaintAll(TRUE); 
    515515        sprintf(buffer,"%d bytes in Text Clipboard",TextClipLength * 
     
    578578*       Need to check protections 
    579579*/ 
    580                          
     580 
    581581                        for(i=0,blank_space = 0;i<this_elem->offset;i++) 
    582582                                if(DataSet->selection_mask[i] == '1') 
    583583                                        TextClip[numselected][blank_space++] = 
    584                                                 (char)getelem(this_elem,i);  
     584                                                (char)getelem(this_elem,i); 
    585585 
    586586 
  • trunk/GDE/CORE/DrawNA.c

    r2 r655  
    1 #include <malloc.h> 
     1/* #include <malloc.h> */ 
    22#include <X11/X.h> 
    33#include <X11/Xlib.h> 
     
    239239                        wid -= j; 
    240240                        j=0; 
    241                         buffer[j] = tmat?  
     241                        buffer[j] = tmat? 
    242242                            tmat[base]:base; 
    243243/* 
  • trunk/GDE/CORE/EventHandler.c

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include <string.h> 
    44#include <xview/xview.h> 
     
    125125                            PANEL_LAYOUT,PANEL_HORIZONTAL, 
    126126                            PANEL_LABEL_STRING,thisitem->arg[j].label, 
    127                             PANEL_NOTIFY_PROC, HandleMenuItem,  
     127                            PANEL_NOTIFY_PROC, HandleMenuItem, 
    128128                                PANEL_CHOICE_STRING, 
    129129                            0,thisitem->arg[j].choice[0].label, 
     
    177177 
    178178 
    179                 default:  
     179                default: 
    180180                        break; 
    181181                }; 
     
    213213values returned from the dialog box so that they can be used for calling 
    214214the external function. 
    215          
     215 
    216216Copyright (c) 1989-1990, University of Illinois board of trustees.  All 
    217217rights reserved.  Written by Steven Smith at the Center for Prokaryote Genome 
     
    312312                select_mode = TestSelection(); 
    313313 
    314 /*       
     314/* 
    315315        Make sure that we are still in a writeable directory 
    316316*/ 
     
    519519*       The basic idea is to replace all of the symbols in the method 
    520520*       string with the values picked in the dialog box.  The method 
    521 *       is the general command line structure.  All arguements have three  
     521*       is the general command line structure.  All arguements have three 
    522522*       parts, a label, a method, and a value.  The method never changes, and 
    523 *       is used to represent '-flag's for a given function.  Values are the  
    524 *       associated arguements that some flags require.  All symbols that  
     523*       is used to represent '-flag's for a given function.  Values are the 
     524*       associated arguements that some flags require.  All symbols that 
    525525*       require argvalue replacement should have a '$' infront of the symbol 
    526526*       name in the itemmethod definition.  All symbols without the '$' will 
     
    551551*               argchoice:Argument_label:Argument_method 
    552552* 
    553 *        
     553* 
    554554*/ 
    555555        char *symbol,*method,*textvalue,buf1[GBUFSIZ],buf2[GBUFSIZ],*temp; 
     
    872872                            PANEL_LAYOUT,PANEL_HORIZONTAL, 
    873873                            PANEL_LABEL_STRING,thisitem->arg[j].label, 
    874                             PANEL_NOTIFY_PROC, HandleMenuItem,  
     874                            PANEL_NOTIFY_PROC, HandleMenuItem, 
    875875                            PANEL_CHOICE_STRING, 
    876876                            0,thisitem->arg[j].choice[0].label, 
     
    905905 
    906906 
    907                 default:  
     907                default: 
    908908                        break; 
    909909                }; 
  • trunk/GDE/CORE/FileIO.c

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include <xview/xview.h> 
    44#include <xview/notice.h> 
     
    373373        { 
    374374                for(j=0;j<aln->numelements;j++) 
    375                         if(seqs[j].elementtype == MASK &&  
     375                        if(seqs[j].elementtype == MASK && 
    376376                            seqs[j].selected) 
    377377                                mask = j; 
     
    395395                else 
    396396                        offset_str[0] = '\0'; 
    397                  
    398                 if(((j!=mask) && (seqs[j].selected) && method != SELECT_REGION)  
     397 
     398                if(((j!=mask) && (seqs[j].selected) && method != SELECT_REGION) 
    399399                || (method == SELECT_REGION && seqs[j].subselected) 
    400400                || method == ALL) 
     
    688688                        if(IGNORE_DASH && (indx != -1)) 
    689689                        { 
    690                                 for(jj=0,j=0;(j<curlen) &&  
     690                                for(jj=0,j=0;(j<curlen) && 
    691691                                    (jj<aln->element[indx].seqlen);j++,jj++) 
    692692                                { 
     
    704704* 
    705705*       The allocated space is equal the seqlen of the matched sequence. 
    706 *        
     706* 
    707707*/ 
    708708                                        if(aln->element[indx].tmatrix) 
     
    946946                } 
    947947        } 
    948          
     948 
    949949*/ 
    950950} 
     
    10001000        { 
    10011001                for(j=0;j<aln->numelements;j++) 
    1002                         if(seqs[j].elementtype == MASK &&  
     1002                        if(seqs[j].elementtype == MASK && 
    10031003                            seqs[j].selected) 
    10041004                                mask = j; 
     
    10221022                else 
    10231023                        offset_str[0] = '\0'; 
    1024                  
    1025                 if(((j!=mask) && (seqs[j].selected) && method != SELECT_REGION)  
     1024 
     1025                if(((j!=mask) && (seqs[j].selected) && method != SELECT_REGION) 
    10261026                || (method == SELECT_REGION && seqs[j].subselected) 
    10271027                || method == ALL) 
  • trunk/GDE/CORE/Free.c

    r2 r655  
    22#include <xview/defaults.h> 
    33#include <xview/xview.h> 
    4 #include <xview/panel.h>                          
    5 #include <xview/window.h>                          
    6 #include <xview/icon.h>                          
    7 #include <pixrect/pixrect.h>                          
    8 #include <malloc.h> 
     4#include <xview/panel.h> 
     5#include <xview/window.h> 
     6#include <xview/icon.h> 
     7#include <pixrect/pixrect.h> 
     8/* #include <malloc.h> */ 
    99#include "menudefs.h" 
    1010#include "defines.h" 
  • trunk/GDE/CORE/Genbank.c

    r344 r655  
    11#include <sys/time.h> 
    22#include <stdio.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <time.h> 
    55#include <xview/xview.h> 
  • trunk/GDE/CORE/HGLfile.c

    r2 r655  
    11#include <sys/time.h> 
    22#include <stdio.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <xview/xview.h> 
    55#include <xview/panel.h> 
     
    234234                                        if(line[j] == '"') done = TRUE; 
    235235 
    236                                         else  
     236                                        else 
    237237                                                buffer[len++] = line[j]; 
    238238                                } 
     
    464464*       non-'0' space in the mask. 
    465465*/ 
    466                                         for(k=this_elem->offset;k<aln->selection_mask_len &&  
     466                                        for(k=this_elem->offset;k<aln->selection_mask_len && 
    467467                                        aln->selection_mask[k] == '0';k++); 
    468468                                        fprintf(file,"offset        %d\n", aln->rel_offset+k); 
     
    536536                                                if(k%60 == 0) 
    537537                                                        putc('\n',file); 
    538                                                 if(method == SELECT_REGION)  
     538                                                if(method == SELECT_REGION) 
    539539                                                { 
    540                             if(aln->selection_mask[k] == '1')  
     540                            if(aln->selection_mask[k] == '1') 
    541541                                                                putc(this_elem->tmatrix[getelem(this_elem,k)], 
    542542                                                    file); 
     
    571571                                                if(k%60 == 0) 
    572572                                                        putc('\n',file); 
    573                                                 if(method == SELECT_REGION)  
     573                                                if(method == SELECT_REGION) 
    574574                                                { 
    575                             if(aln->selection_mask[k] == '1')  
     575                            if(aln->selection_mask[k] == '1') 
    576576                                putc(getelem(this_elem,k),file); 
    577577                                                } 
     
    754754                        that->baggage_maxlen += this->baggage_maxlen; 
    755755                        if(that->baggage) 
    756                                 that->baggage =  
     756                                that->baggage = 
    757757                                Realloc(that->baggage,that->baggage_maxlen*sizeof(char)); 
    758758                        else 
     
    765765                        that->comments_maxlen += this->comments_maxlen; 
    766766                        if(that->comments) 
    767                                 that->comments =  
     767                                that->comments = 
    768768                                Realloc(that->comments,that->comments_maxlen*sizeof(char)); 
    769769                        else 
  • trunk/GDE/CORE/ParseMenu.c

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include <xview/xview.h> 
    44#include <xview/panel.h> 
     
    9696                                curmenu = num_menus++; 
    9797                                thismenu = &menu[curmenu]; 
    98                                 thismenu->label =  
     98                                thismenu->label = 
    9999                                (char*)calloc(strlen(temp)+1,sizeof(char)); 
    100100 
     
    153153                { 
    154154                        crop(Inline,head,temp); 
    155                         thisitem->method =  
     155                        thisitem->method = 
    156156                        (char*)calloc(strlen(temp)+1,sizeof(char)); 
    157157                        if(thisitem->method == NULL) 
     
    177177                { 
    178178                        crop(Inline,head,temp); 
    179                         thisitem->meta = temp[0];  
     179                        thisitem->meta = temp[0]; 
    180180                } 
    181181/* 
     
    194194                                resize = realloc(thisitem->arg, 
    195195                                thisitem->numargs*sizeof(GmenuItemArg) ); 
    196                                  
     196 
    197197 
    198198                        if(resize == NULL) 
     
    392392                        thisitem->output = (GfileFormat*)resize; 
    393393                        thisoutput = &(thisitem->output)[curoutput]; 
    394                         thisoutput->save = FALSE;  
     394                        thisoutput->save = FALSE; 
    395395                        thisoutput->overwrite = FALSE; 
    396396                        thisoutput->format = 0; 
     
    446446                        if(thisoutput == NULL) 
    447447                                Error("Problem with GDEmenus"); 
    448                         crop(Inline,head,tail);  
    449                         if(Find(tail,"genbank"))  
    450                                 thisoutput->format = GENBANK;  
     448                        crop(Inline,head,tail); 
     449                        if(Find(tail,"genbank")) 
     450                                thisoutput->format = GENBANK; 
    451451                        else if(Find(tail,"gde")) 
    452452                                thisoutput->format = GDE; 
     
    547547Crop(): 
    548548        Split "this:that[:the_other]" 
    549         into: "this" and "that[:the_other]"  
     549        into: "this" and "that[:the_other]" 
    550550*/ 
    551551 
  • trunk/GDE/CORE/Scroll.c

    r2 r655  
    1 #include <malloc.h> 
     1/* #include <malloc.h> */ 
    22#include <X11/X.h> 
    33#include <X11/Xlib.h> 
     
    138138                deltax=(int)xv_get(hsc,SCROLLBAR_VIEW_LENGTH); 
    139139 
    140                 lasty=(int)xv_get(vsc,   
     140                lasty=(int)xv_get(vsc, 
    141141                SCROLLBAR_LAST_VIEW_START); 
    142142 
     
    181181                return(XV_OK); 
    182182        } 
    183          
     183 
    184184/* 
    185185        test for hsc && vsc attempts to fix warnings at split 
    186186*/ 
    187187        else if ((event_action(event) == ACTION_SPLIT_HORIZONTAL || 
    188         event_action(event) == ACTION_SPLIT_VERTICAL ) &&  
     188        event_action(event) == ACTION_SPLIT_VERTICAL ) && 
    189189        hsc && vsc) 
    190190        { 
     
    209209        Xv_xrectlist area; 
    210210        Xv_window win; 
    211          
     211 
    212212        hsc = (Scrollbar)xv_get(EditCan,OPENWIN_HORIZONTAL_SCROLLBAR,view); 
    213213        vsc = (Scrollbar)xv_get(EditCan,OPENWIN_VERTICAL_SCROLLBAR,view); 
  • trunk/GDE/CORE/main.c

    r2 r655  
    22#include <xview/defaults.h> 
    33#include <xview/xview.h> 
    4 #include <xview/panel.h>                          
    5 #include <xview/window.h>                          
    6 #include <xview/icon.h>                          
    7 #include <pixrect/pixrect.h>                          
    8 #include <malloc.h> 
     4#include <xview/panel.h> 
     5#include <xview/window.h> 
     6#include <xview/icon.h> 
     7#include <pixrect/pixrect.h> 
     8/* #include <malloc.h> */ 
    99#include "menudefs.h" 
    1010#include "defines.h" 
     
    169169 
    170170        xv_set(frame, 
    171             FRAME_ICON,tool_icon,        
     171            FRAME_ICON,tool_icon, 
    172172            0); 
    173173 
  • trunk/GDE/HGL_SRC/Alloc.c

    r2 r655  
    11#include <stdio.h> 
    22#include "global_defs.h" 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44 
    55/* 
     
    6767#ifdef SUN4 
    6868            if(free(block) == 0) 
    69               Warning("Error in Cfree...");  
     69              Warning("Error in Cfree..."); 
    7070#endif 
    7171        } 
     
    104104 
    105105/* 
    106 *       Replace the array element at seq[indx] with elem.  The index  
    107 *       is relative to the alignment.  
     106*       Replace the array element at seq[indx] with elem.  The index 
     107*       is relative to the alignment. 
    108108*/ 
    109109 
     
    190190    c[0]=ch; 
    191191    c[1] = '\0'; 
    192         
     192 
    193193    return (InsertElems(a,b,c)); 
    194194} 
     
    274274 
    275275        seq->direction *= -1; 
    276          
     276 
    277277        SeqNormal(seq); 
    278278        return; 
    279 }  
     279} 
    280280 
    281281 
     
    289289        static int tmatr[16] = {'-','a','c','m','g','r','s','v', 
    290290                        't','w','y','h','k','d','b','n'}; 
    291   
     291 
    292292        static int matr[128] = { 
    293293        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00, 
     
    298298        0,0,0,0,0x00,0 
    299299        }; 
    300   
     300 
    301301        c = seq->c_elem; 
    302302        for(j=0;j<seq->seqlen;j++) 
     
    328328                            0; 
    329329        return; 
    330                  
    331 } 
     330 
     331} 
  • trunk/GDE/HGL_SRC/MakeCons.c

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include "global_defs.h" 
    44 
     
    1717    { 
    1818        fprintf(stderr, "Usage:\n"); 
    19         fprintf(stderr,  
     19        fprintf(stderr, 
    2020                "%s %s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n", 
    2121                av[0], 
    22                 "sequence-file",  
     22                "sequence-file", 
    2323                "[-iupac]            IUPAC consensus. Default", 
    2424                "[-majority percent] Majority consensus (default percent: 75)", 
     
    3232 
    3333    InitRecord(&cons); 
    34      
     34 
    3535    if((file = fopen(av[1],"r")) == NULL) 
    3636    { 
     
    3939    } 
    4040 
    41      
     41 
    4242    master = (Sequence*)Calloc(maxsize,sizeof(Sequence)); 
    4343 
     
    128128            fprintf(maskout_fp, "start:\n"); 
    129129        } 
    130          
     130 
    131131        if((cons_type == 'i' && 
    132132            MakeConsensus(master,cursize,&cons,0,cons_type)==FALSE) || 
     
    147147        } 
    148148 
    149         /*WriteRecord(stdout, &cons, NULL, 0);  
     149        /*WriteRecord(stdout, &cons, NULL, 0); 
    150150        printf("\n\n");*/ 
    151          
     151 
    152152        if(maskout_fp == NULL) 
    153153        { 
  • trunk/GDE/HGL_SRC/Translate.c

    r256 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2/* #include <malloc.h> */ 
    33#include <string.h> 
    44#include "global_defs.h" 
     
    227227 
    228228        /* save_name = malloc(80); */ 
    229          
     229 
    230230        strncpy(save_name, seq->name, 80); 
    231231        temp=(char*)Calloc(seq->seqlen+1,sizeof(char)); 
     
    250250        } 
    251251 
    252 /*  
    253 *       Skip over r_frame valid characters (skip ' ','-','~')  
     252/* 
     253*       Skip over r_frame valid characters (skip ' ','-','~') 
    254254*/ 
    255255        for(true_start=0,i=0; i<r_frame&&true_start< 
     
    299299                                fptr = 0; 
    300300/* 
    301 *       Check to see if it is a valid ORF  
     301*       Check to see if it is a valid ORF 
    302302*/ 
    303303                                if((strncmp("Ter",&(temp[start]),3) == 0) || 
     
    318318*       If reading from stop to stop, leave the elading stop codon 
    319319*/ 
    320                                             if(temp[last_start]=='*' ||  
     320                                            if(temp[last_start]=='*' || 
    321321                                               strncmp("Ter",&(temp[last_start]),3) == 0) 
    322322                                              for(i=last_start+3;i<start+3;i++) 
     
    343343                                            save_c_elem = seq->c_elem; 
    344344                                            seq->c_elem = temp; 
    345                                             WriteRecord(stdout,seq,NULL,0);  
     345                                            WriteRecord(stdout,seq,NULL,0); 
    346346                                            strncpy(seq->name, save_name, 80); 
    347347                                            seq->c_elem = save_c_elem; 
     
    368368        { 
    369369          seq->c_elem = temp; 
    370           WriteRecord(stdout,seq,NULL,0);  
     370          WriteRecord(stdout,seq,NULL,0); 
    371371        } 
    372372        Cfree(temp); 
  • trunk/GDE/HGL_SRC/global_defs.h

    r2 r655  
    33#include <limits.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <time.h> 
    77 
     
    7272 
    7373/*** 
    74  ***  Elements in at[] and e_tags should be IN THE SAME ORDER.  
     74 ***  Elements in at[] and e_tags should be IN THE SAME ORDER. 
    7575 ***/ 
    7676 
     
    9494  "baggage", 
    9595  "group-number", 
    96   "barcode",  
     96  "barcode", 
    9797  "orig_direction", 
    9898  "orig_strand", 
  • trunk/GDE/LOOPTOOL/Draw.c

    r2 r655  
    55#include <xview/panel.h> 
    66#include <string.h> 
    7 #include <malloc.h> 
     7/* #include <malloc.h> */ 
    88#include "loop.h" 
    99#include "globals.h" 
     
    205205                                                SetPos(nuc_sel1,nuc_sel2,x,y); 
    206206                                                break; 
    207          
     207 
    208208                                            case ANGULAR: 
    209209                                                SetAng(nuc_sel1,nuc_sel2,x,y); 
    210210                                                break; 
    211          
     211 
    212212                                            case DISTANCE: 
    213213                                                SetDist(nuc_sel1,nuc_sel2,x,y); 
     
    223223                                UnHiLite(nuc_sel2); 
    224224                                select_state=0; 
    225                                 nuc_sel1= -1;  
     225                                nuc_sel1= -1; 
    226226                                nuc_sel2= -1; 
    227227                                select_state=0; 
     
    246246} 
    247247 
    248 UnHiLite(nuc)  
    249 int nuc;  
    250 {  
     248UnHiLite(nuc) 
     249int nuc; 
     250{ 
    251251        if(nuc == -1) return; 
    252252        baselist[nuc].attr &= ~HILITE; 
     
    308308 
    309309SetPos(nuc1,nuc2,x,y) 
    310 int nuc1,nuc2;  
    311 double x,y;  
    312 {  
     310int nuc1,nuc2; 
     311double x,y; 
     312{ 
    313313        int i,nuc,pair; 
    314314        double dx,dy,sqrt(); 
     
    344344 
    345345SetAng(nuc1,nuc2,x,y) 
    346 int nuc1,nuc2;  
    347 double x,y;  
    348 {  
     346int nuc1,nuc2; 
     347double x,y; 
     348{ 
    349349        int i,j; 
    350350        double dist,theta; 
     
    543543int nucnum; 
    544544Pixwin *pw; 
    545 {        
     545{ 
    546546        Base *b; 
    547547        int j; 
     
    577577 
    578578                x = b->x+label->dist*cos(theta)-xc; 
    579                 y = b->y+label->dist*sin(theta)-yc;  
     579                y = b->y+label->dist*sin(theta)-yc; 
    580580        } 
    581581        label -> x=x; 
     
    594594        return; 
    595595} 
    596          
     596 
    597597 
    598598IsLoop(n1,n2) 
  • trunk/GDE/LOOPTOOL/ReadData.c

    r2 r655  
    33#include <stdio.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66#include "loop.h" 
    77#include "globals.h" 
     
    130130        (*blist)[pos-1].y=0.0; 
    131131        (*blist)[pos-1].known=TRUE; 
    132          
     132 
    133133        *seqlen=pos; 
    134134        for(j=19;j<pos;j+=20) 
  • trunk/GDE/LOOPTOOL/Window.c

    r2 r655  
    77#include <xview/panel.h> 
    88#include <string.h> 
    9 #include <malloc.h> 
     9/* #include <malloc.h> */ 
    1010#include <math.h> 
    1111#include "loop.h" 
     
    6161*       Open font for screen operations. 
    6262*/ 
    63         page=xv_create(NULL,FRAME,       
     63        page=xv_create(NULL,FRAME, 
    6464                FRAME_LABEL,    "LoopTool", 
    6565                WIN_INHERIT_COLORS,TRUE, 
     
    8787                PANEL_LABEL_STRING,"Data File:", 
    8888                PANEL_VALUE,"", 
    89                 PANEL_NOTIFY_PROC,SetFile,  
     89                PANEL_NOTIFY_PROC,SetFile, 
    9090                0); 
    9191 
     
    150150/* 
    151151*       Pagecan is the canvas used for the primary display. 
    152 */       
     152*/ 
    153153        pagecan=xv_create(page,CANVAS, 
    154154                WIN_INHERIT_COLORS,TRUE, 
     
    201201                        XV_AUTO_CREATE,FALSE, 
    202202                        0); 
    203                            
     203 
    204204 
    205205               if(colmap == NULL) 
     
    213213                WIN_CMS_NAME,"GDE Palette", 
    214214                WIN_CMS, colmap, 
    215                 WIN_FOREGROUND_COLOR,8,   
     215                WIN_FOREGROUND_COLOR,8, 
    216216                WIN_BACKGROUND_COLOR,15, 
    217217                WIN_INHERIT_COLORS,FALSE, 
     
    224224        window_fit_width(page); 
    225225 
    226         fdlg=xv_create(file_dialog,PANEL,  
     226        fdlg=xv_create(file_dialog,PANEL, 
    227227                XV_WIDTH,300, 
    228228                XV_HEIGHT,200, 
     
    230230                0); 
    231231 
    232         pdlg=xv_create(print_dialog,PANEL,  
    233                 XV_WIDTH,300,  
     232        pdlg=xv_create(print_dialog,PANEL, 
     233                XV_WIDTH,300, 
    234234                XV_HEIGHT,200, 
    235                 PANEL_LAYOUT,PANEL_HORIZONTAL,  
     235                PANEL_LAYOUT,PANEL_HORIZONTAL, 
    236236                0); 
    237237 
     
    337337                xmin = 99999.99; 
    338338                ymin = 99999.99; 
    339                  
     339 
    340340                for(nucpos=0;nucpos<seqlen;nucpos++) 
    341341                { 
     
    392392                                PlaceLabel(baselist[nucpos].label,nucpos,pw); 
    393393                } 
    394                  
     394 
    395395        } 
    396396        if(sho_con) 
     
    409409 
    410410 
    411 /*  
     411/* 
    412412*       BuildLoopStack:  Build a stack of bases that make a subloop of 
    413413*       the structure.  Unknown bases are pushed on the stack until a known 
     
    430430        stk[stkp=0].nucnum=nuc; 
    431431        stk[stkp++].dist=0.0; 
    432          
     432 
    433433 
    434434        current=NextBase(nuc,blist,&dist); 
     
    507507                else 
    508508                { 
    509                         if(pair<=forw)  
    510                         {        
    511                                 next = pair;  
    512                                 *dist=Spacing(here.nuc,blist[next].nuc);  
    513                         }  
    514                         else  
    515                         {        
     509                        if(pair<=forw) 
     510                        { 
     511                                next = pair; 
     512                                *dist=Spacing(here.nuc,blist[next].nuc); 
     513                        } 
     514                        else 
     515                        { 
    516516                                next = forw; 
    517                                 *dist = here.dforw.dist;  
    518                         }  
    519                 }  
     517                                *dist = here.dforw.dist; 
     518                        } 
     519                } 
    520520        } 
    521521 
     
    689689                        if(blist[stk[i].nucnum].posnum != -1) 
    690690                                PosConFix(blist[stk[i].nucnum]); 
    691                 }        
     691                } 
    692692        } 
    693693} 
  • trunk/GDE/LOOPTOOL/WriteData.c

    r2 r655  
    44#include <stdio.h> 
    55#include <string.h> 
    6 #include <malloc.h> 
     6/* #include <malloc.h> */ 
    77#include "loop.h" 
    88#include "globals.h" 
     
    1313        FILE *outfile; 
    1414        Base base; 
    15          
     15 
    1616        outfile = fopen("loop.temp","w"); 
    1717        if(outfile == NULL) 
  • trunk/GDE/MOLPHY/Nucml.c

    r2 r655  
    623623        getfreqepm(Seqchar, Freqemp, Maxspc, Maxsite); 
    624624        alias = new_ivector(Maxsite); 
    625         radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
     625        a_radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
    626626        Seqconint = new_imatrix(Maxspc, Numptrn); 
    627627        Weight = new_ivector(Numptrn); 
     
    12011201                for (Cnotree = 0; Cnotree < Numqltree; Cnotree++) { 
    12021202                        Alklptrn = Lklptrn[Cnotree]; 
    1203                         if (Cnotree == 0)  
     1203                        if (Cnotree == 0) 
    12041204                                initturn(Ctree); 
    12051205                        else 
  • trunk/GDE/MOLPHY/Nucst.c

    r2 r655  
    203203        getfreqepm(Seqchar, Freqemp, Maxspc, Maxsite); 
    204204        alias = new_ivector(Maxsite); 
    205         radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
     205        a_radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
    206206        Seqconint = new_imatrix(Maxspc, Numptrn); 
    207207        Weight = new_ivector(Numptrn); 
  • trunk/GDE/MOLPHY/Nuctpm.c

    r2 r655  
    624624        getfreqepm(Seqchar, Freqemp, Maxspc, Maxsite); 
    625625        alias = new_ivector(Maxsite); 
    626         radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
     626        a_radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
    627627        Seqconint = new_imatrix(Maxspc, Numptrn); 
    628628        Weight = new_ivector(Numptrn); 
     
    12031203                for (Cnotree = 0; Cnotree < Numqltree; Cnotree++) { 
    12041204                        Alklptrn = Lklptrn[Cnotree]; 
    1205                         if (Cnotree == 0)  
     1205                        if (Cnotree == 0) 
    12061206                                initturn(Ctree); 
    12071207                        else 
  • trunk/GDE/MOLPHY/Prottpm.c

    r2 r655  
    624624        getfreqepm(Seqchar, Freqemp, Maxspc, Maxsite); 
    625625        alias = new_ivector(Maxsite); 
    626         radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
     626        a_radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
    627627        Seqconint = new_imatrix(Maxspc, Numptrn); 
    628628        Weight = new_ivector(Numptrn); 
     
    12031203                for (Cnotree = 0; Cnotree < Numqltree; Cnotree++) { 
    12041204                        Alklptrn = Lklptrn[Cnotree]; 
    1205                         if (Cnotree == 0)  
     1205                        if (Cnotree == 0) 
    12061206                                initturn(Ctree); 
    12071207                        else 
  • trunk/GDE/MOLPHY/prot_tml.h

    r2 r655  
    2525void getfreqepm P_((cmatrix seqchar, double *freqemp, int maxspc, int maxsite)); 
    2626void convfreq P_((double *freqemp)); 
    27 void radixsort P_((cmatrix seqchar, ivector alias, int maxspc, int maxsite, int *numptrn)); 
     27void a_radixsort P_((cmatrix seqchar, ivector alias, int maxspc, int maxsite, int *numptrn)); 
    2828void condenceseq P_((cmatrix seqchar, ivector alias, imatrix seqconint, ivector weight, int maxspc, int maxsite, int numptrn)); 
    2929void getnumsites P_((imatrix seqconint, ivector numsites, ivector weight, int numspc, int numptrn)); 
  • trunk/GDE/MOLPHY/protml.c

    r2 r655  
    624624        getfreqepm(Seqchar, Freqemp, Maxspc, Maxsite); 
    625625        alias = new_ivector(Maxsite); 
    626         radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
     626        a_radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
    627627        Seqconint = new_imatrix(Maxspc, Numptrn); 
    628628        Weight = new_ivector(Numptrn); 
     
    12031203                for (Cnotree = 0; Cnotree < Numqltree; Cnotree++) { 
    12041204                        Alklptrn = Lklptrn[Cnotree]; 
    1205                         if (Cnotree == 0)  
     1205                        if (Cnotree == 0) 
    12061206                                initturn(Ctree); 
    12071207                        else 
  • trunk/GDE/MOLPHY/protst.c

    r2 r655  
    203203        getfreqepm(Seqchar, Freqemp, Maxspc, Maxsite); 
    204204        alias = new_ivector(Maxsite); 
    205         radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
     205        a_radixsort(Seqchar, alias, Maxspc, Maxsite, &Numptrn); 
    206206        Seqconint = new_imatrix(Maxspc, Numptrn); 
    207207        Weight = new_ivector(Numptrn); 
  • trunk/GDE/MOLPHY/seqproc.c

    r2 r655  
    3030        } putchar('\n'); 
    3131        } 
    32 #endif   
     32#endif 
    3333} /*_ convseq */ 
    3434 
     
    9494 
    9595 
    96 void 
    97 radixsort(seqchar, alias, maxspc, maxsite, numptrn) 
     96void a_radixsort(seqchar, alias, maxspc, maxsite, numptrn) 
    9897cmatrix seqchar; 
    9998ivector alias; 
     
    148147        } 
    149148#endif 
    150 } /*_ radixsort */ 
     149} /*_ a_radixsort */ 
    151150 
    152151 
     
    213212                numsites[i] = n; 
    214213        /*      printf("numsites %3d %5d\n", i ,n); */ 
    215          }  
     214         } 
    216215} /* getnumsites */ 
    217216 
     
    234233                putchar('\n'); 
    235234                for (i = 0; i < numspc; i++) { 
    236                         fputid(stdout, identif[i], 10);  
     235                        fputid(stdout, identif[i], 10); 
    237236                        putchar(' '); 
    238237                        for (j = k; j < maxj; j++) { 
  • trunk/GDE/SUPPORT/Flatio.c

    r2 r655  
    1 #include <malloc.h> 
     1/* #include <malloc.h> */ 
    22#include <stdio.h> 
    33#define TRUE 1 
  • trunk/GDE/SUPPORT/lsadt.c

    r2 r655  
    11/* 
    2         PROGRAM LSADT 
    3 Fortran->C conversion by Mike Maciukenas, CPGA, Microbiology at University 
     2  PROGRAM LSADT 
     3  Fortran->C conversion by Mike Maciukenas, CPGA, Microbiology at University 
    44  of Illinois. 
    5 C----------------------------------------------------------------------- 
    6 C 
    7 C       LEAST SQUARES ALGORITHM FOR FITTING ADDITIVE TREES TO 
    8 C       PROXIMITY DATA 
    9 C 
    10 C       GEERT DE SOETE  --  VERSION 1.01 - FEB. 1983 
    11 C                           VERSION 1.02 - JUNE 1983 
    12 C                           VERSION 1.03 - JULY 1983 
    13 C 
    14 C       REFERENCE: DE SOETE, G. A LEAST SQUARES ALGORITHM FOR FITTING 
    15 C          ADDITIVE TREES TO PROXIMITY DATA. PSYCHOMETRIKA, 1983, 48, 
    16 C          621-626. 
    17 C          DE SOETE, G. ADDITIVE TREE REPRESENTATIONS OF INCOMPLETE 
    18 C          DISSIMILARITY DATA. QUALITY AND QUANTITY, 1984, 18, 
    19 C          387-393. 
    20 C       REMARKS 
    21 C       ------- 
    22 C       2) UNIFORMLY DISTRIBUTED RANDOM NUMBERS ARE GENERATED BY A 
    23 C          PROCEDURE DUE TO SCHRAGE. CF. 
    24 C          SCHRAGE, L.  A MORE PORTABLE FORTRAN RANDOM NUMBER GENERATOR. 
    25 C          ACM TRANS. ON MATH. SOFTW., 1979, 5, 132-138. 
    26 C       3) SUBROUTINES VA14AD AND VA14AC (translated into minfungra) ARE 
    27 C          ADAPTED FROM THE HARWELL SUBROUTINE LIBRARY (1979 EDITION). 
    28 C       4) ALTHOUGH THIS PROGRAM HAS BEEN CAREFULLY TESTED, THE 
    29 C          AUTHOR DISCLAIMS ANY RESPONSABILITY FOR POSSIBLE 
    30 C          ERRORS. 
    31 C 
    32 C----------------------------------------------------------------------- 
     5  C----------------------------------------------------------------------- 
     6  C 
     7  C       LEAST SQUARES ALGORITHM FOR FITTING ADDITIVE TREES TO 
     8  C       PROXIMITY DATA 
     9  C 
     10  C       GEERT DE SOETE  --  VERSION 1.01 - FEB. 1983 
     11  C                           VERSION 1.02 - JUNE 1983 
     12  C                           VERSION 1.03 - JULY 1983 
     13  C 
     14  C       REFERENCE: DE SOETE, G. A LEAST SQUARES ALGORITHM FOR FITTING 
     15  C          ADDITIVE TREES TO PROXIMITY DATA. PSYCHOMETRIKA, 1983, 48, 
     16  C          621-626. 
     17  C          DE SOETE, G. ADDITIVE TREE REPRESENTATIONS OF INCOMPLETE 
     18  C          DISSIMILARITY DATA. QUALITY AND QUANTITY, 1984, 18, 
     19  C          387-393. 
     20  C       REMARKS 
     21  C       ------- 
     22  C       2) UNIFORMLY DISTRIBUTED RANDOM NUMBERS ARE GENERATED BY A 
     23  C          PROCEDURE DUE TO SCHRAGE. CF. 
     24  C          SCHRAGE, L.  A MORE PORTABLE FORTRAN RANDOM NUMBER GENERATOR. 
     25  C          ACM TRANS. ON MATH. SOFTW., 1979, 5, 132-138. 
     26  C       3) SUBROUTINES VA14AD AND VA14AC (translated into minfungra) ARE 
     27  C          ADAPTED FROM THE HARWELL SUBROUTINE LIBRARY (1979 EDITION). 
     28  C       4) ALTHOUGH THIS PROGRAM HAS BEEN CAREFULLY TESTED, THE 
     29  C          AUTHOR DISCLAIMS ANY RESPONSABILITY FOR POSSIBLE 
     30  C          ERRORS. 
     31  C 
     32  C----------------------------------------------------------------------- 
    3333*/ 
    3434#include <stdio.h> 
    3535#include <math.h> 
     36 
     37#ifdef DARWIN 
     38#include <float.h> 
     39#define MAXDOUBLE DBL_MAX 
     40#define MINDOUBLE DBL_MIN 
     41#else 
    3642#include <values.h> 
     43#endif 
     44 
    3745#include <ctype.h> 
    3846#include <fcntl.h> 
     
    5967 
    6068double dabs(a) 
    61 double a; 
     69     double a; 
    6270{ 
    6371        return((a<0.0) ? -a : a); 
     
    6573 
    6674double sqr(a) 
    67 double a; 
     75     double a; 
    6876{ 
    6977        return(a*a); 
     
    7179 
    7280double max(a, b) 
    73 double a; 
    74 double b; 
     81     double a; 
     82     double b; 
    7583{ 
    7684        return((a>b)?a:b); 
     
    7886 
    7987int imin(a, b) 
    80 int a; 
    81 int b; 
     88     int a; 
     89     int b; 
    8290{ 
    8391        return((a<b)?a:b); 
     
    8593 
    8694double min(a, b) 
    87 double a; 
    88 double b; 
     95     double a; 
     96     double b; 
    8997{ 
    9098        return((a<b)?a:b); 
     
    100108        int xhi, xalo, leftlo, fhi, k; 
    101109        float t1, t2; 
    102          
     110 
    103111        xhi = seed/B16; 
    104112        xalo = (seed - (xhi * B16)) * A; 
     
    140148        } 
    141149} 
    142 #define gd(i,j)  ( (j<i)? d[i][j] : d[j][i] )  
     150#define gd(i,j)  ( (j<i)? d[i][j] : d[j][i] ) 
    143151 
    144152#if 0 
    145153double gd(i, j) 
    146 int i, j; 
     154     int i, j; 
    147155{ 
    148156        if(j<i) 
     
    153161                show_error("gd: i=j -- programmer screwed up!"); 
    154162} 
    155 #endif  
     163#endif 
    156164 
    157165char *repeatch(string, ch, num) 
    158 char *string; 
    159 int ch; 
    160 int num; 
     166     char *string; 
     167     int ch; 
     168     int num; 
    161169{ 
    162170        for(string[num--] = '\0'; num >= 0; string[num--] = ch); 
     
    165173 
    166174int getachar() 
    167 /* skips comments! */ 
     175     /* skips comments! */ 
    168176{ 
    169177        static int oldchar = '\0'; 
     
    197205 
    198206int getaword(string, len) 
    199 /* 0 if failed, 1 if data was read, -1 if data read to end of file */ 
    200 char *string; 
    201 int len; 
     207     /* 0 if failed, 1 if data was read, -1 if data read to end of file */ 
     208     char *string; 
     209     int len; 
    202210{ 
    203211        int i; 
     
    222230 
    223231int readtobar(string, len) 
    224 /* 0 if failed, 1 if data was read */ 
    225 char *string; 
    226 int len; 
     232     /* 0 if failed, 1 if data was read */ 
     233     char *string; 
     234     int len; 
    227235{ 
    228236        int i; 
     
    253261 
    254262int readtobarorcolon(string, len) 
    255 /* 0 if failed, 1 if data was read */ 
    256 char *string; 
    257 int len; 
     263     /* 0 if failed, 1 if data was read */ 
     264     char *string; 
     265     int len; 
    258266{ 
    259267        int i; 
     
    284292 
    285293char *getmem(nelem, elsize) 
    286 unsigned nelem, elsize; 
     294     unsigned nelem, elsize; 
    287295{ 
    288296        char *temp; 
     
    294302 
    295303int get_parms(argc, argv) 
    296 int argc; 
    297 char **argv; 
     304     int argc; 
     305     char **argv; 
    298306{ 
    299307        int i; 
     
    322330        for(i=1; i<argc; i++) 
    323331                switch(cur_arg) { 
    324                 case 0: 
    325                         if(strcmp(argv[i],"-d")==0) 
    326                                 dissim = 0; 
    327                         else if(strcmp(argv[i],"-s")==0) 
    328                                 dissim = 1; 
    329                         else if(strcmp(argv[i],"-print")==0) 
    330                                 cur_arg = 1; 
    331                         else if(strcmp(argv[i],"-init")==0) 
    332                                 cur_arg = 2; 
    333                         else if(strcmp(argv[i],"-save")==0) 
    334                                 save = 1; 
    335                         else if(strcmp(argv[i],"-seed")==0) 
    336                                 cur_arg = 3; 
    337                         else if(strcmp(argv[i],"-ps1")==0) 
    338                                 cur_arg = 4; 
    339                         else if(strcmp(argv[i],"-ps2")==0) 
    340                                 cur_arg = 5; 
    341                         else if(strcmp(argv[i],"-empty")==0) 
    342                                 cur_arg = 6; 
    343                         else if(strcmp(argv[i],"-f")==0) 
    344                                 cur_arg = 7; 
    345                         else if(strcmp(argv[i],"-help")==0) 
    346                                 show_help(); 
    347                         else 
    348                         { 
    349                                 printf("\nlsadt: bad option\n"); 
    350                                 show_help(); 
    351                         } 
    352                         break; 
    353                 case 1: 
    354                         pr = atoi(argv[i]); 
    355                         cur_arg = 0; 
    356                         break; 
    357                 case 2: 
    358                         start = atoi(argv[i]); 
    359                         cur_arg = 0; 
    360                         break; 
    361                 case 3: 
    362                         seed = atoi(argv[i]); 
    363                         cur_arg = 0; 
    364                         break; 
    365                 case 4: 
    366                         ps1 = atof(argv[i]); 
    367                         cur_arg = 0; 
    368                         break; 
    369                 case 5: 
    370                         ps2 = atof(argv[i]); 
    371                         cur_arg = 0; 
    372                         break; 
    373                 case 6: 
    374                         empty = atof(argv[i]); 
    375                         cur_arg = 0; 
    376                         break; 
    377                 case 7: 
    378                         strcpy(fname, argv[i]); 
    379                         cur_arg = 0; 
    380                         break; 
    381                 default: 
    382                         printf("\nlsadt: bad option\n"); 
    383                         show_help(); 
    384                         break; 
    385                 } 
    386  
    387  
    388 /* check validity of parameters */ 
     332            case 0: 
     333                if(strcmp(argv[i],"-d")==0) 
     334                    dissim = 0; 
     335                else if(strcmp(argv[i],"-s")==0) 
     336                    dissim = 1; 
     337                else if(strcmp(argv[i],"-print")==0) 
     338                    cur_arg = 1; 
     339                else if(strcmp(argv[i],"-init")==0) 
     340                    cur_arg = 2; 
     341                else if(strcmp(argv[i],"-save")==0) 
     342                    save = 1; 
     343                else if(strcmp(argv[i],"-seed")==0) 
     344                    cur_arg = 3; 
     345                else if(strcmp(argv[i],"-ps1")==0) 
     346                    cur_arg = 4; 
     347                else if(strcmp(argv[i],"-ps2")==0) 
     348                    cur_arg = 5; 
     349                else if(strcmp(argv[i],"-empty")==0) 
     350                    cur_arg = 6; 
     351                else if(strcmp(argv[i],"-f")==0) 
     352                    cur_arg = 7; 
     353                else if(strcmp(argv[i],"-help")==0) 
     354                    show_help(); 
     355                else 
     356                { 
     357                    printf("\nlsadt: bad option\n"); 
     358                    show_help(); 
     359                } 
     360                break; 
     361            case 1: 
     362                pr = atoi(argv[i]); 
     363                cur_arg = 0; 
     364                break; 
     365            case 2: 
     366                start = atoi(argv[i]); 
     367                cur_arg = 0; 
     368                break; 
     369            case 3: 
     370                seed = atoi(argv[i]); 
     371                cur_arg = 0; 
     372                break; 
     373            case 4: 
     374                ps1 = atof(argv[i]); 
     375                cur_arg = 0; 
     376                break; 
     377            case 5: 
     378                ps2 = atof(argv[i]); 
     379                cur_arg = 0; 
     380                break; 
     381            case 6: 
     382                empty = atof(argv[i]); 
     383                cur_arg = 0; 
     384                break; 
     385            case 7: 
     386                strcpy(fname, argv[i]); 
     387                cur_arg = 0; 
     388                break; 
     389            default: 
     390                printf("\nlsadt: bad option\n"); 
     391                show_help(); 
     392                break; 
     393                } 
     394 
     395 
     396    /* check validity of parameters */ 
    389397        if(ps1<0.0) ps1 = 0.0001; 
    390398        if(ps2<0.0) ps2 = 0.0001; 
     
    394402        if(seed < 0) seed = 12345; 
    395403 
    396 /*printf("dissim=%d\n", dissim);*/ 
    397 /*printf("pr=%d\n", pr);*/ 
    398 /*printf("start=%d\n", start);*/ 
    399 /*printf("save=%d\n", save);*/ 
    400 /*printf("seed=%d\n", seed);*/ 
    401 /*printf("ps1=%f\n", ps1);*/ 
    402 /*printf("ps2=%f\n", ps2);*/ 
    403 /*printf("empty=%f\n", empty);*/ 
     404    /*printf("dissim=%d\n", dissim);*/ 
     405    /*printf("pr=%d\n", pr);*/ 
     406    /*printf("start=%d\n", start);*/ 
     407    /*printf("save=%d\n", save);*/ 
     408    /*printf("seed=%d\n", seed);*/ 
     409    /*printf("ps1=%f\n", ps1);*/ 
     410    /*printf("ps2=%f\n", ps2);*/ 
     411    /*printf("empty=%f\n", empty);*/ 
    404412} 
    405413 
     
    412420        int result; 
    413421        double temp, nfactor, datmin, datmax; 
    414          
     422 
    415423 
    416424        nempty = n = 0; 
     
    542550                                                t2 = gd(j,k); 
    543551                                                if(t1!=empty && t2!=empty) 
    544                                                   dmax = min(dmax, max(t1,t2)); 
     552                            dmax = min(dmax, max(t1,t2)); 
    545553                                        } 
    546554                                        if(dmax!=MAXDOUBLE) 
     
    617625                                        } 
    618626                                        else 
    619                                         if((djilk>=dkilj)&& 
    620                                            (dlikj>=dkilj)) 
    621                                         { 
    622                                                 wijkl=djilk-dlikj; 
    623                                                 fitp+=wijkl*wijkl; 
    624                                                 fw = fac*wijkl; 
    625                                                 gji+=fw; 
    626                                                 g[l][k]+=fw; 
    627                                                 gkj-=fw; 
    628                                                 g[l][i]-=fw; 
    629                                         }else{ 
    630                                                 wijkl=dkilj-dlikj; 
    631                                                 fitp+=wijkl*wijkl; 
    632                                                 fw = fac*wijkl; 
    633                                                 gki+=fw; 
    634                                                 g[l][j]+=fw; 
    635                                                 g[l][i]-=fw; 
    636                                                 gkj-=fw; 
    637                                         } 
     627                        if((djilk>=dkilj)&& 
     628                           (dlikj>=dkilj)) 
     629                        { 
     630                            wijkl=djilk-dlikj; 
     631                            fitp+=wijkl*wijkl; 
     632                            fw = fac*wijkl; 
     633                            gji+=fw; 
     634                            g[l][k]+=fw; 
     635                            gkj-=fw; 
     636                            g[l][i]-=fw; 
     637                        }else{ 
     638                            wijkl=dkilj-dlikj; 
     639                            fitp+=wijkl*wijkl; 
     640                            fw = fac*wijkl; 
     641                            gki+=fw; 
     642                            g[l][j]+=fw; 
     643                            g[l][i]-=fw; 
     644                            gkj-=fw; 
     645                        } 
    638646                                } /* l */ 
    639647                                g[k][i] += gki; 
     
    649657static int iterc, prc; 
    650658print_iter(maxfnc, f) 
    651 int maxfnc; 
    652 double f; 
     659     int maxfnc; 
     660     double f; 
    653661{ 
    654662        int i, j; 
     
    693701 
    694702minfungra(dfn, acc, maxfn) 
    695 double dfn, acc; 
    696 int maxfn; 
     703     double dfn, acc; 
     704     int maxfn; 
    697705{ 
    698706        double beta, c, clt, dginit, dgstep, dtest, finit; 
     
    709717        goto L190; 
    710718 
    711         L10: 
     719 L10: 
    712720        xnew = dabs(dfn+dfn)/gsumsq; 
    713721        dgstep = -gsumsq; 
    714722        itcrs = m+1; 
    715         L30: 
     723 L30: 
    716724        if(maxfnk<maxfnc) 
    717725        { 
     
    735743                        for(j=1;j<i;j++) 
    736744                                d1[i][j] = -g[i][j]; 
    737                                 } 
     745    } 
    738746        print_iter(maxfnc, f); 
    739747        dginit = 0.0; 
     
    766774        xnew = xnew * min(1.0, dgstep/dginit); 
    767775        dgstep = dginit; 
    768         L170: 
     776 L170: 
    769777        c = xnew-xmin; 
    770778        dtest = 0.0; 
     
    781789        } 
    782790        if(max(xbound, xmin-c) < 0.0) { 
    783         clt = 0.1; 
     791        clt = 0.1; 
    784792        } 
    785793        maxfnc++; 
    786         L190: 
     794 L190: 
    787795        fungra(); 
    788796 
     
    792800                        for(j=1;j<i;j++) 
    793801                                gnew += d1[i][j]*g[i][j]; 
    794                                 } 
     802    } 
    795803        if(maxfnc<=1 || 
    796804           (maxfnc>1 && f<fmin) || 
     
    831839                        ggstar += gs[i][j]*g[i][j]; 
    832840        beta = (gsumsq-ggstar)/(gm-dginit); 
    833         L300: 
     841 L300: 
    834842        if(dabs(gm)>clt*dabs(dginit) || 
    835843           (dabs(gm)<=clt*dabs(dginit) && dabs(gm*beta) >= clt*gsumsq)) 
    836844        { 
    837                 L310: 
     845    L310: 
    838846                clt += 0.3; 
    839847                if(clt>0.8) 
     
    856864                        xnew = 10.0*xold; 
    857865                        if(xbound>=0.0) { 
    858                         xnew = 0.5*(xold+xbound); 
     866                xnew = 0.5*(xold+xbound); 
    859867                        } 
    860868                } 
    861869                c = gnew-(3.0*gnew + gmin-4.0*(f-fmin)/(xold-xmin))* 
    862                         (xold-xnew)/(xold-xmin); 
     870            (xold-xnew)/(xold-xmin); 
    863871                if(maxfnk>=maxfnc) 
    864872                { 
    865873                        if(gmin*gnew<=0.0) { 
    866                         xbound = xmin; 
     874                xbound = xmin; 
    867875                        } 
    868876                        xmin = xold; 
     
    895903                                        for(j=1;j<i;j++) 
    896904                                                d1[i][j] = -gg[i][j] + 
    897                                                                 beta*d1[i][j] + 
    898                                                                 gamma*dr[i][j]; 
     905                            beta*d1[i][j] + 
     906                            gamma*dr[i][j]; 
    899907                                itcrs++; 
    900908                        } 
     
    926934                goto L30; 
    927935        } 
    928         else  
     936        else 
    929937        { 
    930938                retry = -retry; 
     
    10341042        for(i=1;i<=nm3;i++) 
    10351043            for(j=i+1;j<=nm2;j++) 
    1036                 for(k=j+1;k<=nm1;k++) 
    1037                     for(l=k+1;l<=nm0;l++) 
    1038                         if((d[j][i]+d[l][k]>=d[l][i]+d[k][j])&& 
    1039                            (d[k][i]+d[l][j]>=d[l][i]+d[k][j])) 
    1040                                 result=max(result, 
    1041                                     dabs(d[j][i]+d[l][k]-d[k][i]-d[l][j])); 
    1042                         else 
    1043                         if((d[j][i]+d[l][k]>=d[k][i]+d[l][j])&& 
    1044                            (d[l][i]+d[k][j]>=d[k][i]+d[l][j])) 
    1045                                 result=max(result, 
    1046                                     dabs(d[j][i]+d[l][k]-d[l][i]-d[k][j])); 
    1047                         else 
    1048                         if((d[k][i]+d[l][j]>=d[j][i]+d[l][k])&& 
    1049                            (d[l][i]+d[k][j]>=d[j][i]+d[l][k])) 
    1050                                 result=max(result, 
    1051                                     dabs(d[k][i]+d[l][j]-d[l][i]-d[k][j])); 
     1044            for(k=j+1;k<=nm1;k++) 
     1045                for(l=k+1;l<=nm0;l++) 
     1046                    if((d[j][i]+d[l][k]>=d[l][i]+d[k][j])&& 
     1047                       (d[k][i]+d[l][j]>=d[l][i]+d[k][j])) 
     1048                        result=max(result, 
     1049                                   dabs(d[j][i]+d[l][k]-d[k][i]-d[l][j])); 
     1050                    else 
     1051                        if((d[j][i]+d[l][k]>=d[k][i]+d[l][j])&& 
     1052                           (d[l][i]+d[k][j]>=d[k][i]+d[l][j])) 
     1053                            result=max(result, 
     1054                                       dabs(d[j][i]+d[l][k]-d[l][i]-d[k][j])); 
     1055                        else 
     1056                            if((d[k][i]+d[l][j]>=d[j][i]+d[l][k])&& 
     1057                               (d[l][i]+d[k][j]>=d[j][i]+d[l][k])) 
     1058                                result=max(result, 
     1059                                           dabs(d[k][i]+d[l][j]-d[l][i]-d[k][j])); 
    10521060        return(result); 
    10531061} 
     
    10741082        else 
    10751083                return((fn*scp-sumx*sumy)/ 
    1076                         sqrt((fn*ssqx-sqr(sumx))*(fn*ssqy-sqr(sumy)))); 
     1084               sqrt((fn*ssqx-sqr(sumx))*(fn*ssqy-sqr(sumy)))); 
    10771085} 
    10781086 
     
    10961104                                if(k!=i && k!=j) 
    10971105                                        c=max(c,gd( i, j)- 
    1098                                                 gd( i, k)- 
    1099                                                 gd( j, k)); 
     1106                          gd( i, k)- 
     1107                          gd( j, k)); 
    11001108        if(report) 
    11011109                fprintf(reportf, "Additive Constant: %15.10f\n", c); 
     
    11301138            maxcnt=-1; 
    11311139            for(i=1;i<=nnode;i++) if(!act[i]) 
    1132                 for(j=1;j<i;j++) if(!act[j]) 
    1133                 { 
    1134                     count=0; 
    1135                     arci=0.0; 
    1136                     arcj=0.0; 
    1137                     for(k=2;k<=nnode;k++) if(!act[k] && k!=i && k!=j) 
    1138                         for(l=1;l<k;l++) if(!act[l] && l!= i && l!= j) 
    1139                             if(gd(i,j)+gd(k,l)<=gd(i,k)+gd(j,l) && 
    1140                                 gd(i,j)+gd(k,l)<=gd(i,l)+gd(j,k)) 
    1141                             { 
    1142                                 count++; 
    1143                                 arci+=(gd(i,j)+gd(i,k)-gd(j,k))/2.0; 
    1144                                 arcj+=(gd(i,j)+gd(j,l)-gd(i,l))/2.0; 
    1145                             } 
    1146                     if(count>maxcnt) 
    1147                     { 
    1148                         maxcnt = count; 
    1149                         arcim=max(0.0, arci/count); 
    1150                         arcjm=max(0.0, arcj/count); 
    1151                         im=i; 
    1152                         jm=j; 
    1153                     } 
    1154                 } 
    1155                  
     1140            for(j=1;j<i;j++) if(!act[j]) 
     1141            { 
     1142                count=0; 
     1143                arci=0.0; 
     1144                arcj=0.0; 
     1145                for(k=2;k<=nnode;k++) if(!act[k] && k!=i && k!=j) 
     1146                    for(l=1;l<k;l++) if(!act[l] && l!= i && l!= j) 
     1147                        if(gd(i,j)+gd(k,l)<=gd(i,k)+gd(j,l) && 
     1148                           gd(i,j)+gd(k,l)<=gd(i,l)+gd(j,k)) 
     1149                        { 
     1150                            count++; 
     1151                            arci+=(gd(i,j)+gd(i,k)-gd(j,k))/2.0; 
     1152                            arcj+=(gd(i,j)+gd(j,l)-gd(i,l))/2.0; 
     1153                        } 
     1154                if(count>maxcnt) 
     1155                { 
     1156                    maxcnt = count; 
     1157                    arcim=max(0.0, arci/count); 
     1158                    arcjm=max(0.0, arcj/count); 
     1159                    im=i; 
     1160                    jm=j; 
     1161                } 
     1162            } 
     1163 
    11561164            nnode++; 
    11571165            if(nnode+2>maxnode) 
     
    11731181        for(i=1;act[i];i++) 
    11741182            if(i>nnode) 
    1175                 show_error("get_tree: can't find last two invisible nodes"); 
     1183            show_error("get_tree: can't find last two invisible nodes"); 
    11761184        im=i; 
    11771185        for(i=im+1;act[i];i++) 
    11781186            if(i>nnode) 
    1179                 show_error("get_tree: can't find last two invisible nodes"); 
     1187            show_error("get_tree: can't find last two invisible nodes"); 
    11801188        jm=i; 
    11811189        for(i=jm+1;act[i];i++) 
    11821190            if(i>nnode) 
    1183                 show_error("get_tree: can't find last two invisible nodes"); 
     1191            show_error("get_tree: can't find last two invisible nodes"); 
    11841192        km=i; 
    11851193        for(i=km+1;act[i];i++) 
    11861194            if(i>nnode) 
    1187                 show_error("get_tree: can't find last two invisible nodes"); 
     1195            show_error("get_tree: can't find last two invisible nodes"); 
    11881196        lm=i; 
    11891197        if(gd(im,jm)+gd(km,lm)<=gd(im,km)+gd(jm,lm)+tol && 
     
    12311239 
    12321240print_node(node, dist, indent) 
    1233 int node; 
    1234 double dist; 
    1235 int indent; 
     1241     int node; 
     1242     double dist; 
     1243     int indent; 
    12361244{ 
    12371245        static char buf[BUFLEN]; 
     
    12391247        if(node<=n) 
    12401248                printf("%s%s:%6.4f", 
    1241                         repeatch(buf, '\t', indent), 
    1242                         names[node], 
    1243                         dist/nfac); 
     1249               repeatch(buf, '\t', indent), 
     1250               names[node], 
     1251               dist/nfac); 
    12441252        else 
    12451253        { 
    12461254                printf("%s(\n", 
    1247                         repeatch(buf, '\t', indent)); 
     1255               repeatch(buf, '\t', indent)); 
    12481256                print_node(mergei[node-n], gd(node, mergei[node-n]), indent+1); 
    12491257                printf(",\n"); 
    12501258                print_node(mergej[node-n], gd(node, mergej[node-n]), indent+1); 
    12511259                printf("\n%s):%6.4f", repeatch(buf, '\t', indent), 
    1252                         dist/nfac); 
     1260               dist/nfac); 
    12531261        } 
    12541262} 
     
    12971305 
    12981306show_error(message) 
    1299 char *message; 
     1307     char *message; 
    13001308{ 
    13011309        printf("\n>>>>ERROR:\n>>>>%s\n", message); 
     
    13041312 
    13051313main(argc, argv) 
    1306 int argc; 
    1307 char **argv; 
     1314     int argc; 
     1315     char **argv; 
    13081316{ 
    13091317        int i; 
  • trunk/GDE/TREEPUZZLE/src/ml.h

    r191 r655  
    3030#define MAXCAT 16 
    3131 
    32 #define RMHROOT    5.0     /* upper relative bound for height of root         */     
     32#define RMHROOT    5.0     /* upper relative bound for height of root         */ 
    3333#define MAXARC     900.0   /* upper limit on branch length (PAM) = 6.0        */ 
    3434#define MINARC     0.001   /* lower limit on branch length (PAM) = 0.00001    */ 
     
    133133EXTERN int Converg;        /* flag for ML convergence (no clock)              */ 
    134134EXTERN int Convergc;       /* flag for ML convergence (clock)                 */ 
    135 EXTERN int data_optn;      /* type of sequence input data                     */   
     135EXTERN int data_optn;      /* type of sequence input data                     */ 
    136136EXTERN int Dayhf_optn;     /* Dayhoff model                                   */ 
    137137EXTERN int HKY_optn;       /* use HKY model                                   */ 
     
    174174 
    175175void convfreq(dvector); 
    176 void radixsort(cmatrix, ivector, int, int, int *); 
     176void a_radixsort(cmatrix, ivector, int, int, int *); 
    177177void condenceseq(cmatrix, ivector, cmatrix, ivector, int, int, int); 
    178178void countconstantsites(cmatrix, ivector, int, int, int *, int*); 
  • trunk/GDE/TREEPUZZLE/src/ml1.c

    r191 r655  
    6767        } 
    6868        freqemp[maxi] += 1.0 - sum; 
    69          
     69 
    7070        for (i = 0; i < tpmradix - 1; i++) { 
    7171                for (j = i + 1; j < tpmradix; j++) { 
     
    7979 
    8080/* sort site patters of original input data */ 
    81 void radixsort(cmatrix seqchar, ivector ali, int maxspc, int maxsite, 
     81void a_radixsort(cmatrix seqchar, ivector ali, int maxspc, int maxsite, 
    8282        int *numptrn) 
    8383{ 
     
    192192 
    193193void evaluateseqs() 
    194 {        
     194{ 
    195195        ivector ali; 
    196196 
    197197        convfreq(Freqtpm); /* make all frequencies slightly different */ 
    198198        ali = new_ivector(Maxsite); 
    199         radixsort(Seqchar, ali, Maxspc, Maxsite, &Numptrn); 
     199        a_radixsort(Seqchar, ali, Maxspc, Maxsite, &Numptrn); 
    200200        Seqpat = new_cmatrix(Maxspc, Numptrn); 
    201201        constpat = new_ivector(Numptrn); 
     
    204204        free_ivector(ali); 
    205205        countconstantsites(Seqpat, Weight, Maxspc, Numptrn, &Numconst, &Numconstpat); 
    206         fracconstpat = (double) Numconstpat / (double) Numptrn;  
    207         fracconst    = (double) Numconst / (double) Maxsite;     
     206        fracconstpat = (double) Numconstpat / (double) Numptrn; 
     207        fracconst    = (double) Numconst / (double) Maxsite; 
    208208} 
    209209 
     
    617617                                                                y = h[i + 1][i]; 
    618618                                                                vr = (wr[i] - p) * (wr[i] - p); 
    619                                                                 vr = vr + wi[i] * wi[i] - q * q;         
     619                                                                vr = vr + wi[i] * wi[i] - q * q; 
    620620                                                                vi = (wr[i] - p) * 2.0 * q; 
    621621                                                                if (vr == 0.0 && vi == 0.0) { 
     
    735735 
    736736        rtfdata(a, forg); /* get relative transition matrix and frequencies */ 
    737          
     737 
    738738        onepamratematrix(a); /* make 1 PAM rate matrix */ 
    739          
     739 
    740740        /* copy a to b */ 
    741741        for (i = 0; i < tpmradix; i++) 
     
    746746        eltran(a, evec, ordr, tpmradix); 
    747747        hqr2(tpmradix, 1, tpmradix, a, evec, eval, evali); 
    748          
     748 
    749749        /* check eigenvalue equation */ 
    750750        error = FALSE; 
     
    754754                        zero -= eval[j] * evec[i][j]; 
    755755                        if (fabs(zero) > 1.0e-5) 
    756                                 error = TRUE;    
     756                                error = TRUE; 
    757757                } 
    758758        } 
     
    777777        dmatrix omtrx; 
    778778 
    779          
     779 
    780780        index = new_ivector(tpmradix); 
    781781        omtrx = new_dmatrix(tpmradix,tpmradix); 
    782          
     782 
    783783        /* copy inmat to omtrx */ 
    784784        for (i = 0; i < tpmradix; i++) 
    785785                for (j = 0; j < tpmradix; j++) 
    786786                        omtrx[i][j] = inmat[i][j]; 
    787          
     787 
    788788        wk = (double *) malloc((unsigned)size * sizeof(double)); 
    789789        aw = 1.0; 
     
    956956        fv = 1.0-fracinv; 
    957957        fv2 = (1.0-fracinv)/(double) numcats; 
    958          
     958 
    959959        if (numcats == 1) { 
    960960 
    961                 for (k = 0; k < Numptrn; k++) {  
    962                  
     961                for (k = 0; k < Numptrn; k++) { 
     962 
    963963                        /* compute likelihood for pattern k */ 
    964964                        sitelkl = cdl[0][k]*fv; 
    965965                        if (constpat[k] == TRUE) 
    966966                                sitelkl += fracinv*Freqtpm[(int) Seqpat[0][k]]; 
    967                  
     967 
    968968                        /* total log-likelihood */ 
    969969                        loglkl += log(sitelkl)*Weight[k]; 
    970                  
     970 
    971971                } 
    972972 
    973973        } else { 
    974          
     974 
    975975                for (k = 0; k < Numptrn; k++) { 
    976                          
    977                         /* this general routine works always but it's better  
     976 
     977                        /* this general routine works always but it's better 
    978978               to run it only when it's really necessary */ 
    979                  
     979 
    980980                        /* compute likelihood for pattern k */ 
    981981                        sitelkl = 0.0; 
     
    985985                        if (constpat[k] == TRUE) 
    986986                                sitelkl += fracinv*Freqtpm[(int) Seqpat[0][k]]; 
    987                  
     987 
    988988                        /* total log-likelihood */ 
    989989                        loglkl += log(sitelkl)*Weight[k]; 
    990                  
    991                 } 
    992  
    993         } 
    994          
     990 
     991                } 
     992 
     993        } 
     994 
    995995        return loglkl; 
    996996} 
    997997 
    998998 
    999 /* computes the site log-likelihoods  
     999/* computes the site log-likelihoods 
    10001000   input: likelihoods for each site and non-zero rate 
    10011001   output: log-likelihood for each site */ 
     
    10071007        fv = 1.0-fracinv; 
    10081008        fv2 = (1.0-fracinv)/(double) numcats; 
    1009          
     1009 
    10101010        if (numcats == 1) { 
    10111011 
    1012                 for (k = 0; k < Numptrn; k++) {  
    1013                  
     1012                for (k = 0; k < Numptrn; k++) { 
     1013 
    10141014                        /* compute likelihood for pattern k */ 
    10151015                        sitelkl = cdl[0][k]*fv; 
    10161016                        if (constpat[k] == TRUE) 
    10171017                                sitelkl += fracinv*Freqtpm[(int) Seqpat[0][k]]; 
    1018                  
     1018 
    10191019                        /* site log-likelihood */ 
    10201020                        aslkl[k] = log(sitelkl); 
     
    10221022 
    10231023        } else { 
    1024          
     1024 
    10251025                for (k = 0; k < Numptrn; k++) { 
    1026                          
    1027                         /* this general routine works always but it's better  
     1026 
     1027                        /* this general routine works always but it's better 
    10281028               to run it only when it's really necessary */ 
    1029                  
     1029 
    10301030                        /* compute likelihood for pattern k */ 
    10311031                        sitelkl = 0.0; 
     
    10351035                        if (constpat[k] == TRUE) 
    10361036                                sitelkl += fracinv*Freqtpm[(int) Seqpat[0][k]]; 
    1037                  
     1037 
    10381038                        /* total log-likelihood */ 
    10391039                        aslkl[k] = log(sitelkl); 
    1040                  
     1040 
    10411041                } 
    10421042        } 
     
    10521052        double loglkl, fv, sitelkl; 
    10531053 
    1054          
     1054 
    10551055        /* compute tpms */ 
    10561056        for (r = 0; r < numcats; r++) 
     
    10601060        loglkl = 0.0; 
    10611061        fv = 1.0-fracinv; 
    1062          
     1062 
    10631063        if (numcats == 1) { 
    10641064 
    1065                 for (k = 0; k < Numptrn; k++) {  
    1066                  
     1065                for (k = 0; k < Numptrn; k++) { 
     1066 
    10671067                        /* compute likelihood for site k */ 
    10681068                        ci = seqchi[k]; 
     
    10741074                        if (ci == cj && ci != tpmradix) 
    10751075                                sitelkl += fracinv*Freqtpm[ci]; 
    1076                  
     1076 
    10771077                        /* total log-likelihood */ 
    10781078                        loglkl += log(sitelkl)*Weight[k]; 
    1079                  
     1079 
    10801080                } 
    10811081 
    10821082        } else { 
    1083          
     1083 
    10841084                for (k = 0; k < Numptrn; k++) { 
    1085                          
    1086                         /* this general routine works always but it's better  
     1085 
     1086                        /* this general routine works always but it's better 
    10871087               to run it only when it's really necessary */ 
    1088                  
     1088 
    10891089                        /* compute likelihood for site k */ 
    10901090                        ci = seqchi[k]; 
     
    10941094                                for (r = 0; r < numcats; r++) 
    10951095                                        sitelkl += ltprobr[r][ci][cj]; 
    1096                                 sitelkl = fv*sitelkl/(double) numcats;   
     1096                                sitelkl = fv*sitelkl/(double) numcats; 
    10971097                        } else 
    10981098                                sitelkl = fv; 
    10991099                        if (ci == cj && ci != tpmradix) 
    11001100                                sitelkl += fracinv*Freqtpm[ci]; 
    1101                  
     1101 
    11021102                        /* total log-likelihood */ 
    11031103                        loglkl += log(sitelkl)*Weight[k]; 
    1104                  
    1105                 } 
    1106  
    1107         } 
    1108          
     1104 
     1105                } 
     1106 
     1107        } 
     1108 
    11091109        /* return negative log-likelihood as we use a minimizing procedure */ 
    11101110        return -loglkl; 
     
    11191119{ 
    11201120        double dist, fx, f2x; 
    1121          
     1121 
    11221122        if (i == j) return 0.0; 
    1123          
    1124         /* use old distance as start value */    
     1123 
     1124        /* use old distance as start value */ 
    11251125        dist = Distanmat[i][j]; 
    11261126 
     
    11321132        if (dist <= MINARC) dist = MINARC+1.0; 
    11331133        if (dist >= MAXARC) dist = MAXARC-1.0; 
    1134          
     1134 
    11351135        dist = onedimenmin(MINARC, dist, MAXARC, pairlkl, EPSILON, &fx, &f2x); 
    1136          
     1136 
    11371137        return dist; 
    11381138} 
     
    11441144        int i, j, k, diff, x, y; 
    11451145        double obs, temp; 
    1146          
     1146 
    11471147        for (i = 0; i < Maxspc; i++) { 
    11481148                Distanmat[i][i] = 0.0; 
     
    11501150                        seqchi = Seqpat[i]; 
    11511151                        seqchj = Seqpat[j]; 
    1152                          
     1152 
    11531153                        /* count observed differences */ 
    11541154                        diff = 0; 
     
    12401240                } 
    12411241        } 
    1242          
     1242 
    12431243        oprob = op->partials; 
    12441244        cprob = op->kinp->isop->partials; 
     
    12971297        do { 
    12981298                cp = cp->isop->kinp; 
    1299                 if (cp->isop == NULL) { /* external node */                      
     1299                if (cp->isop == NULL) { /* external node */ 
    13001300                        cp = cp->kinp; /* not descen */ 
    13011301                        partialsexternal(cp); 
    1302                 } else { /* internal node */     
     1302                } else { /* internal node */ 
    13031303                        if (!cp->descen) { 
    13041304                                productpartials(cp->kinp->isop); 
     
    13251325                for (s = 0; s < Numptrn; s++) { 
    13261326                        sumlk = 0.0; 
    1327                         for (i = 0; i < tpmradix; i++) {                         
     1327                        for (i = 0; i < tpmradix; i++) { 
    13281328                                slk = 0.0; 
    1329                                 for (j = 0; j < tpmradix; j++)  
    1330                                         slk += partialj[r][s][j] * ltprobr[r][i][j];             
    1331                                 sumlk += Freqtpm[i] * partiali[r][s][i] * slk;   
     1329                                for (j = 0; j < tpmradix; j++) 
     1330                                        slk += partialj[r][s][j] * ltprobr[r][i][j]; 
     1331                                sumlk += Freqtpm[i] * partiali[r][s][i] * slk; 
    13321332                        } 
    13331333                        cdl[r][s] = sumlk; 
     
    13551355        op->kinp->length = arc; 
    13561356        op->length = arc; 
    1357          
     1357 
    13581358        /* variance of branch length */ 
    13591359        f2x = fabs(f2x); 
     
    13731373        dvector opb; 
    13741374        dmatrix cdl; 
    1375          
     1375 
    13761376        cdl = Ctree->condlkl; 
    13771377        for (r = 0; r < numcats; r++) { 
     
    13921392                } 
    13931393        } 
    1394          
     1394 
    13951395        /* compute total log-likelihood for current tree */ 
    13961396        Ctree->lklhd = comptotloglkl(cdl); 
     
    14121412        op->kinp->length = arc; 
    14131413        op->length = arc; 
    1414          
     1414 
    14151415         /* variance of branch length */ 
    14161416        f2x = fabs(f2x); 
     
    14441444                                        slk += partialj[r][k][j] * ltprobr[r][i][j]; 
    14451445                                sumlk += Freqtpm[i] * partiali[r][k][i] * slk; 
    1446                         }                        
     1446                        } 
    14471447                        cdl[r][k] = sumlk; 
    14481448                } 
     
    14601460        int nconv; 
    14611461        double lendiff; 
    1462          
     1462 
    14631463        clockmode = 0; /* nonclocklike branch lengths */ 
    14641464        nconv = 0; 
     
    14661466        initpartials(tr); 
    14671467        for (Numit = 1; (Numit <= MAXIT) && (!Converg); Numit++) { 
    1468                  
     1468 
    14691469                cp = rp = tr->rootp; 
    14701470                do { 
    14711471                        cp = cp->isop->kinp; 
    14721472                        productpartials(cp->kinp->isop); 
    1473                         if (cp->isop == NULL) { /* external node */      
     1473                        if (cp->isop == NULL) { /* external node */ 
    14741474                                cp = cp->kinp; /* not descen */ 
    1475                                  
     1475 
    14761476                                lendiff = cp->length; 
    14771477                                optexternalbranch(cp); 
    14781478                                lendiff = fabs(lendiff - cp->length); 
    14791479                                if (lendiff < EPSILON) nconv++; 
    1480                                 else nconv = 0;                          
    1481                                  
     1480                                else nconv = 0; 
     1481 
    14821482                                partialsexternal(cp); 
    14831483                        } else { /* internal node */ 
     
    14851485                                        partialsinternal(cp); 
    14861486                                } else { 
    1487                                          
     1487 
    14881488                                        lendiff = cp->length; 
    14891489                                        optinternalbranch(cp); 
     
    14911491                                        if (lendiff < EPSILON) nconv++; 
    14921492                                        else nconv = 0; 
    1493                                          
     1493 
    14941494                                        /* eventually compute likelihoods for each site */ 
    14951495                                        if ((cp->number == Numibrnch-1 && lendiff < EPSILON) || 
     
    14981498                                        partialsinternal(cp); 
    14991499                                } 
    1500                         }                        
     1500                        } 
    15011501                        if (nconv >= Numbrnch) { /* convergence */ 
    15021502                                Converg = TRUE; 
     
    15341534                        cdl[r][k] = sumlk; 
    15351535                } 
    1536         }        
    1537          
     1536        } 
     1537 
    15381538        /* return total log-likelihood for current tree */ 
    15391539        return comptotloglkl(cdl); 
     
    16351635 
    16361636/* least square estimation of branch lengths 
    1637    used for the approximate ML and as starting point  
     1637   used for the approximate ML and as starting point 
    16381638   in the calculation of the exact value of the ML */ 
    16391639void lslength(Tree *tr, dvector distanvec, int numspc, int numibrnch, dvector Brnlength) 
     
    17131713                        ebp[i]->length = leng; 
    17141714                        ebp[i]->kinp->length = leng; 
    1715                 }        
     1715                } 
    17161716                Brnlength[i] = leng; 
    17171717        } 
  • trunk/GENOM/GEN_db.cxx

    r474 r655  
    1 #include <malloc.h> 
     1// #include <malloc.h> 
    22 
    33#include <arbdb.h> 
  • trunk/Makefile

    r649 r655  
    5454endif 
    5555 
     56   PREFIX = 
     57   LIBDIR = /usr/lib 
    5658   XHOME = /usr/X11 
    5759 
     
    7981endif 
    8082 
     83#********************* Darwin gcc enviroments ***************** 
     84ifdef DARWIN 
     85 
     86   XHOME = /usr/X11R6 
     87   havebool = -DHAVE_BOOL 
     88   lflags = $(LDFLAGS) -force_flat_namespace 
     89   DARWIN_SPECIALS = -DNO_REGEXPR  -no-cpp-precomp -DHAVE_BOOL 
     90   CPP = cc -D$(MACH) $(DARWIN_SPECIALS) 
     91   ACC = cc -D$(MACH) $(DARWIN_SPECIALS) 
     92   CCLIB = cc -fno-common -D$(MACH) $(DARWIN_SPECIALS) 
     93   CCPLIB = cc -fno-common -D$(MACH) $(DARWIN_SPECIALS) 
     94   AR = ld -r $(lflags) -o#                     # Archive Linker 
     95   ARLIB = ld -r $(lflags)  -o#                 # Archive Linker shared libs. 
     96#  ARLIB = cc -bundle -flat_namespace -undefined suppress -o 
     97   SHARED_LIB_SUFFIX = a# 
     98# .. Just building shared libraries static, i was having problems otherwise 
     99 
     100   GMAKE = make -j 3 -r 
     101   SYSLIBS = -lstdc++ 
     102 
     103   MOTIF_LIBNAME = libXm.3.dylib 
     104   MOTIF_LIBPATH = $(LIBDIR)/$(MOTIF_LIBNAME) 
     105   XINCLUDES = -I/usr/X11R6/include 
     106   XLIBS = -L$(XHOME)/lib $(SYSLIBS) -lXm -lXt -lX11 -lXext -lXp  -lc 
     107 
     108   PERLBIN = /usr/bin 
     109   PERLLIB = /usr/lib 
     110   CRYPTLIB = -L/usr/lib -lcrypt 
     111 
     112endif 
     113 
    81114#********************* Linux and gcc enviroments ***************** 
    82115ifdef LINUX 
     
    95128   GMAKE = make -j 3 -r 
    96129   SYSLIBS = -lm 
    97  
    98130ifndef DEBIAN 
    99131   XINCLUDES = -I/usr/X11/include -I/usr/X11/include/Xm -I/usr/openwin/include 
     
    711743#       (cd LIBLINK; for i in *.s*; do if test -r $$i; then cp $$i  ../lib; fi; done ) 
    712744 
     745# the following lib is not provided with the source 
     746# you need to install Motif (NOT lesstif) and correct 
     747# MOTIF_LIBPATH 
     748 
     749ifndef MOTIF_LIBNAME 
     750MOTIF_LIBNAME=libXm.so.2 
     751endif 
     752ifndef MOTIF_LIBPATH 
     753MOTIF_LIBPATH=Motif/$(MOTIF_LIBNAME) 
     754endif 
     755 
    713756ifndef DEBIAN 
    714757libs:   lib/libARBDB.$(SHARED_LIB_SUFFIX) \ 
     
    717760        lib/libAW.$(SHARED_LIB_SUFFIX) \ 
    718761        lib/libAWT.$(SHARED_LIB_SUFFIX) \ 
    719         lib/libXm.so.2 
     762        lib/$(MOTIF_LIBNAME) 
    720763else 
    721764libs:   lib/libARBDB.$(SHARED_LIB_SUFFIX) \ 
     
    729772        cp $< $@ 
    730773 
    731 # the following lib is not provided with the source 
    732 # you need to install Motif (NOT lesstif) and correct 
    733 # MOTIF_LIBPATH 
    734  
    735 MOTIF_LIBPATH=LIBLINK/libXm.so.2 
    736 #MOTIF_LIBPATH=/usr/X11R6/lib/libXm.so.2 
    737  
    738 lib/libXm.so.2:  $(MOTIF_LIBPATH) 
     774lib/$(MOTIF_LIBNAME):  $(MOTIF_LIBPATH) 
    739775        cp $< $@ 
    740776 
  • trunk/NALIGNER/ali_aligner.hxx

    r2 r655  
    44#define _ALI_ALIGNER_INC_ 
    55 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77 
    88#include "ali_solution.hxx" 
     
    2828   float d1, d2, d3; 
    2929   ALI_TARRAY<ali_pathmap_up_pointer> *starts; 
    30     
     30 
    3131        ali_aligner_cell(void) { 
    3232                d1 = d2 = d3 = 0.0; 
     
    7878        unsigned char operation; 
    7979 
    80    ali_aligner_dellist_elem(unsigned long s = 0, float c = 0.0,  
     80   ali_aligner_dellist_elem(unsigned long s = 0, float c = 0.0, 
    8181                                                                         unsigned char op = 0) { 
    8282      start = s; 
     
    158158        } 
    159159        float update(unsigned long position); 
    160         ALI_TARRAY<ali_pathmap_up_pointer> *starts(float costs,  
     160        ALI_TARRAY<ali_pathmap_up_pointer> *starts(float costs, 
    161161                                                                                                                         unsigned long y_offset); 
    162         void optimize(unsigned long position);  
     162        void optimize(unsigned long position); 
    163163}; 
    164164 
     
    213213      insert_up(0, ALI_LEFT, cost); 
    214214        } 
    215         void update_left(ali_aligner_cell *akt_cell, unsigned long akt_pos,  
     215        void update_left(ali_aligner_cell *akt_cell, unsigned long akt_pos, 
    216216                                        unsigned long start_x, unsigned long end_x) { 
    217217                float min; 
     
    227227                                                min + profile->w_ins_multi_cheap(start_x + akt_pos, end_x)); 
    228228        } 
    229         void update_up(ali_aligner_cell *akt_cell, unsigned long akt_pos,  
     229        void update_up(ali_aligner_cell *akt_cell, unsigned long akt_pos, 
    230230                                 unsigned long start_y, unsigned long end_y) { 
    231231                float min; 
     
    400400 
    401401public: 
    402         ALI_ALIGNER(ALI_ALIGNER_CONTEXT *context, ALI_PROFILE *profile,  
     402        ALI_ALIGNER(ALI_ALIGNER_CONTEXT *context, ALI_PROFILE *profile, 
    403403                                        unsigned long start_x, unsigned long end_x, 
    404404                                        unsigned long start_y, unsigned long end_y); 
     
    409409        } 
    410410}; 
    411                                                          
     411 
    412412 
    413413 
  • trunk/NALIGNER/ali_pathmap.cxx

    r2 r655  
    11 
    2 #include <malloc.h> 
     2// #include <malloc.h> 
    33#include <stdlib.h> 
    44 
  • trunk/NALIGNER/ali_postree.cxx

    r2 r655  
    11 
    2 #include <malloc.h> 
     2// #include <malloc.h> 
    33 
    44#include "ali_misc.hxx" 
     
    1515 
    1616 
    17 ALI_POSTREE_NODE::ALI_POSTREE_NODE(ALI_POSTREE_NODE_TYPE t,  
    18                                                        unsigned long nochild_position)  
     17ALI_POSTREE_NODE::ALI_POSTREE_NODE(ALI_POSTREE_NODE_TYPE t, 
     18                                                       unsigned long nochild_position) 
    1919{ 
    2020        typ = t; 
    2121        if (typ == Node) { 
    2222                node.number_of_children = nochild_position; 
    23                 node.children = (ALI_POSTREE_NODE *(*) [])  
     23                node.children = (ALI_POSTREE_NODE *(*) []) 
    2424                                                          CALLOC((unsigned int) nochild_position, 
    2525                                                                                sizeof(ALI_POSTREE_NODE *)); 
     
    3333} 
    3434 
    35 ALI_POSTREE_NODE::~ALI_POSTREE_NODE(void)  
     35ALI_POSTREE_NODE::~ALI_POSTREE_NODE(void) 
    3636{ 
    3737        if (typ == Node) { 
     
    4444} 
    4545 
    46 ALI_POSTREE_NODE *ALI_POSTREE_NODE::leftmost_leaf(void)  
     46ALI_POSTREE_NODE *ALI_POSTREE_NODE::leftmost_leaf(void) 
    4747{ 
    4848        ALI_POSTREE_NODE *n = this; 
     
    5050 
    5151        while (n->typ == Node) { 
    52                 for (i = 0;  
     52                for (i = 0; 
    5353                          i < n->node.number_of_children && !(*n->node.children)[i]; i++); 
    5454                if (i < n->node.number_of_children) 
     
    6161} 
    6262 
    63 ALI_POSTREE_NODE *ALI_POSTREE_NODE::rightmost_leaf(void)  
     63ALI_POSTREE_NODE *ALI_POSTREE_NODE::rightmost_leaf(void) 
    6464{ 
    6565        ALI_POSTREE_NODE *n = this; 
     
    6767 
    6868        while (n->typ == Node) { 
    69                 for (i = (long) n->node.number_of_children - 1;  
     69                for (i = (long) n->node.number_of_children - 1; 
    7070                          i >= 0 && !(*n->node.children)[i]; i--); 
    7171                if (i >= 0) 
     
    7878} 
    7979 
    80 ALI_POSTREE_NODE *ALI_POSTREE_NODE::link_leafs(ALI_POSTREE_NODE *last)  
     80ALI_POSTREE_NODE *ALI_POSTREE_NODE::link_leafs(ALI_POSTREE_NODE *last) 
    8181{ 
    8282   long i; 
     
    149149        unsigned long position; 
    150150 
    151    for (position = 0; *pos != terminal && *pos < number_of_branches;  
     151   for (position = 0; *pos != terminal && *pos < number_of_branches; 
    152152                  position++, pos++) { 
    153153      akt = pos; 
     
    161161       * Make a unique leaf for the new prefix 
    162162       */ 
    163       if (!(*v->node.children)[*akt])  
     163      if (!(*v->node.children)[*akt]) 
    164164         (*v->node.children)[*akt] = new ALI_POSTREE_NODE(Leaf,position); 
    165165      else { 
    166166         ALI_POSTREE_NODE *old_leaf = (*v->node.children)[*akt]; 
    167          unsigned char *akt2 = (unsigned char *)  
    168                                ((int) seq + (int) old_leaf->leaf.position +  
     167         unsigned char *akt2 = (unsigned char *) 
     168                               ((int) seq + (int) old_leaf->leaf.position + 
    169169                                (int) akt - (int) pos); 
    170170         /* 
     
    179179         } 
    180180         (*v->node.children)[*akt2] = old_leaf; 
    181          (*v->node.children)[*akt] = new ALI_POSTREE_NODE(Leaf,position);   
     181         (*v->node.children)[*akt] = new ALI_POSTREE_NODE(Leaf,position); 
    182182      } 
    183183   } 
     
    246246 
    247247 
    248 unsigned long ALI_POSTREE::maximal_position(ALI_POSTREE_NODE *first,  
     248unsigned long ALI_POSTREE::maximal_position(ALI_POSTREE_NODE *first, 
    249249                                                                                                                  ALI_POSTREE_NODE *last) 
    250250{ 
     
    385385                                                        stack->push(ALI_POSTREE_STACK_SUB); 
    386386                                                   finder((*n->node.children)[i],seq,seq_len,seq_pos + 1, 
    387                                                                  im_seq_len + 1, min_pos, max_pos, errors - 1,  
     387                                                                 im_seq_len + 1, min_pos, max_pos, errors - 1, 
    388388                                                                         stack, sol_list); 
    389389                                                        stack->pop(); 
     
    395395        } 
    396396} 
    397                  
    398  
    399  
    400                  
     397 
     398 
     399 
     400 
    401401 
    402402/***************************************************************************** 
     
    410410ALI_POSTREE::ALI_POSTREE(unsigned long branches, 
    411411                                                                 unsigned char *seq, unsigned long seq_len, 
    412                                                                  unsigned char terminal)   
     412                                                                 unsigned char terminal) 
    413413{ 
    414414        unsigned char *seq_buffer; 
     
    504504                                printf(", %d",pos_list->next()); 
    505505                } 
    506                 else  
     506                else 
    507507                        printf("%2d : empty",i); 
    508508                printf("\n"); 
  • trunk/NALIGNER/ali_postree.hxx

    r2 r655  
    55 
    66#include <string.h> 
    7 #include <malloc.h> 
     7// #include <malloc.h> 
    88 
    99#include "ali_misc.hxx" 
     
    3232   }; 
    3333 
    34    ALI_POSTREE_NODE(ALI_POSTREE_NODE_TYPE t,  
     34   ALI_POSTREE_NODE(ALI_POSTREE_NODE_TYPE t, 
    3535                                             unsigned long nochild_position = 0); 
    3636   ~ALI_POSTREE_NODE(void); 
     
    118118                                                                                         ALI_POSTREE_NODE *last); 
    119119        void handle_remaining_sequence( 
    120                                         unsigned char *seq, unsigned long seq_len,  
     120                                        unsigned char *seq, unsigned long seq_len, 
    121121                                        unsigned long seq_pos, unsigned long im_seq_len, 
    122122                                        unsigned long min_pos, unsigned long max_pos, 
     
    125125                                        ALI_TLIST<ali_postree_sol *> *sol_list); 
    126126        void finder(ALI_POSTREE_NODE *n, 
    127                                         unsigned char *seq, unsigned long seq_len,  
     127                                        unsigned char *seq, unsigned long seq_len, 
    128128                                        unsigned long seq_pos, unsigned long im_seq_len, 
    129129                                        unsigned long min_pos, unsigned long max_pos, 
    130                                         unsigned long errors,  
     130                                        unsigned long errors, 
    131131                                        ALI_TSTACK<char> *stack, 
    132132                                        ALI_TLIST<ali_postree_sol *> *sol_list); 
    133133 
    134134public: 
    135    ALI_POSTREE(unsigned long branches,  
     135   ALI_POSTREE(unsigned long branches, 
    136136                                        unsigned char *seq, unsigned long seq_len, 
    137137                                        unsigned char terminal = 4); 
  • trunk/NALIGNER/ali_profile.cxx

    r2 r655  
    11 
    22#include <ctype.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <stdlib.h> 
    55 
     
    8282 
    8383    /* 
    84      * calculate the extension of the family  
     84     * calculate the extension of the family 
    8585     */ 
    8686    number = 0; 
     
    181181     * allocate memory for costs 
    182182     */ 
    183      
     183 
    184184    base_weights = (float (**) [4]) CALLOC((unsigned int) prof_len,     sizeof(float [4])); 
    185185    //base_weights = (float (*) [1][4]) CALLOC((unsigned int) prof_len, sizeof(float [4])); 
     
    193193    gap_percents = (float***) CALLOC((unsigned int) prof_len,           sizeof(float *)); 
    194194    //gap_percents = (float*(*)[1]) CALLOC((unsigned int) prof_len,             sizeof(float *)); 
    195     if (binding_costs == 0 || sub_costs == 0 || lmin == 0 || lmax == 0 ||  
     195    if (binding_costs == 0 || sub_costs == 0 || lmin == 0 || lmax == 0 || 
    196196        gap_costs == 0 || gap_percents == 0 || base_weights == 0) { 
    197197        ali_fatal_error("Out of memory"); 
     
    219219        for (i = 0; i < 7; i++) 
    220220            a[i] = w[i] = sm[5][i] = sm[i][5] = sm[6][i] = sm[i][6] = 0.0; 
    221         for (i = 0; i < 6; i++)  
     221        for (i = 0; i < 6; i++) 
    222222            (*sub_costs)[p][i] = 0.0; 
    223223        w_sum = 0.0; 
     
    245245         * Relative weight of bases 
    246246         */ 
    247         if (w_sum != 0)  
     247        if (w_sum != 0) 
    248248            for (i = 0; i < 4; i++) 
    249249                (*base_weights)[p][i] = w[i] / w_sum; 
     
    392392 * find the next helix 
    393393 */ 
    394 int ALI_PROFILE::find_next_helix(char h[], unsigned long h_len,  
     394int ALI_PROFILE::find_next_helix(char h[], unsigned long h_len, 
    395395                                 unsigned long pos, 
    396396                                 unsigned long *helix_nr, 
     
    400400 
    401401    for (i = pos; i < h_len && !isdigit(h[i]); i++); 
    402     if (i >= h_len)  
     402    if (i >= h_len) 
    403403        return -1; 
    404404 
     
    424424    do { 
    425425        for (; i < h_len && !isdigit(h[i]); i++); 
    426         if (i >= h_len)  
     426        if (i >= h_len) 
    427427            return -1; 
    428428        *start = i; 
     
    457457    unsigned long last1, last2; 
    458458 
    459     if (end1 >= h_len || end2 >= h_len || start1 > end1 || start2 > end2)  
     459    if (end1 >= h_len || end2 >= h_len || start1 > end1 || start2 > end2) 
    460460        ali_fatal_error("Inconsistent parameters","ALI_PROFILE::map_helix()"); 
    461461 
     
    509509    helix_borders = (char **) CALLOC((unsigned int) helix_len, sizeof(long)); 
    510510    //helix_borders = (char (*) [1]) CALLOC((unsigned int) helix_len, sizeof(long)); 
    511     if (helix == 0 || helix_borders == 0)  
     511    if (helix == 0 || helix_borders == 0) 
    512512        ali_fatal_error("Out of memory"); 
    513513 
     
    523523 
    524524 
    525 ALI_PROFILE::ALI_PROFILE(ALI_SEQUENCE *sequence, ALI_PROFILE_CONTEXT *context)  
    526 {  
     525ALI_PROFILE::ALI_PROFILE(ALI_SEQUENCE *sequence, ALI_PROFILE_CONTEXT *context) 
     526{ 
    527527    char message_buffer[100]; 
    528528    ali_family_member *family_member; 
     
    604604 * test whether a position is inside a helix 
    605605 */ 
    606 int ALI_PROFILE::is_in_helix(unsigned long pos,  
     606int ALI_PROFILE::is_in_helix(unsigned long pos, 
    607607                             unsigned long *first, unsigned long *last) { 
    608608    long i; 
     
    655655 * test, whether a position is outside a helix 
    656656 */ 
    657 int ALI_PROFILE::is_outside_helix(unsigned long pos,  
     657int ALI_PROFILE::is_outside_helix(unsigned long pos, 
    658658                                  unsigned long *first, unsigned long *last) { 
    659659    long i; 
     
    704704char *ALI_PROFILE::cheapest_sequence(void) 
    705705{ 
    706     
     706 
    707707    char *seq; 
    708708    size_t p; 
     
    745745 * calculate the costs of a binding 
    746746 */ 
    747 float ALI_PROFILE::w_binding(unsigned long first_seq_pos,  
    748                              ALI_SEQUENCE *sequence)  
     747float ALI_PROFILE::w_binding(unsigned long first_seq_pos, 
     748                             ALI_SEQUENCE *sequence) 
    749749{ 
    750750    unsigned long pos_1_seq, pos_2_seq, last_seq_pos; 
     
    768768    return costs; 
    769769} 
    770                  
    771                    
     770 
     771 
  • trunk/NALIGNER/ali_sequence.cxx

    r2 r655  
    33#include <string.h> 
    44#include <stdlib.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66 
    77#include "ali_misc.hxx" 
     
    9595} 
    9696 
    97 ALI_NORM_SEQUENCE::ALI_NORM_SEQUENCE(ALI_SEQUENCE *sequence)  
     97ALI_NORM_SEQUENCE::ALI_NORM_SEQUENCE(ALI_SEQUENCE *sequence) 
    9898{ 
    9999   unsigned long counter, pos; 
     
    102102        unsigned char *str; 
    103103 
    104         for (counter = pos = 0, str = sequence->sequence();  
     104        for (counter = pos = 0, str = sequence->sequence(); 
    105105                  pos < sequence->length(); pos++, str++) 
    106106                if (ali_is_base(*str)) 
     
    118118   dot_flag = 0; 
    119119        (*dots)[0] |= (unsigned char) (1<<7); 
    120         for (counter = pos = 0, str = sequence->sequence(), s = seq;  
     120        for (counter = pos = 0, str = sequence->sequence(), s = seq; 
    121121                  pos < sequence->length(); str++, pos++) { 
    122122                if (ali_is_base(*str)) { 
  • trunk/NALIGNER/ali_sequence.hxx

    r2 r655  
    44 
    55#include <string.h> 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77 
    88#include "ali_misc.hxx" 
     
    3939        } 
    4040        int check(void); 
    41         char *string(void);  
     41        char *string(void); 
    4242        char *name(void) { 
    4343                return seq_name; 
  • trunk/NALIGNER/ali_solution.cxx

    r2 r655  
    11 
    22 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <stdlib.h> 
    55#include "ali_misc.hxx" 
     
    7373                if ((*mapping)[i-1] >= (*mapping)[i]) 
    7474                        return 0; 
    75          
     75 
    7676        return 1; 
    7777} 
     
    8585   unsigned char *seq, *seq_buffer; 
    8686 
    87         seq_buffer = (unsigned char *) CALLOC((unsigned int)  
    88                        (last_ref_base - first_ref_base + insert_counter + 1),  
     87        seq_buffer = (unsigned char *) CALLOC((unsigned int) 
     88                       (last_ref_base - first_ref_base + insert_counter + 1), 
    8989                                                sizeof(unsigned char)); 
    9090 
     
    138138   unsigned char *seq, *seq_buffer; 
    139139 
    140         seq_buffer = (unsigned char *) CALLOC((unsigned int)  
     140        seq_buffer = (unsigned char *) CALLOC((unsigned int) 
    141141                       (last_ref_base - first_ref_base + 1), sizeof(unsigned char)); 
    142142        if (seq_buffer == 0) 
     
    183183   unsigned long map_pos; 
    184184        ALI_MAP *inv_map; 
    185   
    186    inv_map = new ALI_MAP(first_ref_base, last_ref_base,  
     185 
     186   inv_map = new ALI_MAP(first_ref_base, last_ref_base, 
    187187                                                            first_seq_base, last_seq_base); 
    188188 
     
    194194      } 
    195195   } 
    196   
     196 
    197197   return inv_map; 
    198198} 
     
    204204   char *seq, *seq_buffer; 
    205205 
    206         seq_buffer = (char *) CALLOC( (last_ref_base - first_ref_base + insert_counter + 2),  
     206        seq_buffer = (char *) CALLOC( (last_ref_base - first_ref_base + insert_counter + 2), 
    207207                                                sizeof(char)); 
    208208 
     
    336336} 
    337337 
    338 unsigned long ALI_SUB_SOLUTION::number_of_free_areas(void)  
     338unsigned long ALI_SUB_SOLUTION::number_of_free_areas(void) 
    339339{ 
    340340   ALI_MAP *map; 
     
    347347        counter = 0; 
    348348        map = map_list.first(); 
    349         if (map->first_base() > 0 && map->first_reference_base() > 0)  
     349        if (map->first_base() > 0 && map->first_reference_base() > 0) 
    350350                counter++; 
    351351 
     
    365365 
    366366 
    367 int ALI_SUB_SOLUTION::is_konsistent(ALI_MAP *in_map)  
     367int ALI_SUB_SOLUTION::is_konsistent(ALI_MAP *in_map) 
    368368{ 
    369369        ALI_MAP *map; 
     
    387387        while (map_list.is_next()) { 
    388388                map = map_list.next(); 
    389                 if (last_of_prev < in_map->first_base() &&  
     389                if (last_of_prev < in_map->first_base() && 
    390390                         in_map->last_base() < map->first_base() && 
    391391                         last_of_prev_ref < in_map->first_reference_base() && 
     
    510510   new_map = new ALI_MAP(first_base_of_first,last_base_of_last, 
    511511                                                                 first_reference_of_first,last_reference_of_last); 
    512          
     512 
    513513        map = map_list.first(); 
    514514        do { 
     
    524524 
    525525                        if (map->is_inserted(i)) 
    526             new_map->set(i,map->first_reference_base() +  
     526            new_map->set(i,map->first_reference_base() + 
    527527                                                                        map->position(i) - first_reference_of_first,1); 
    528528                        else 
    529                                 new_map->set(i,map->first_reference_base() +  
     529                                new_map->set(i,map->first_reference_base() + 
    530530                                                                        map->position(i) - first_reference_of_first,0); 
    531531                } 
     
    560560 
    561561 
    562                  
    563  
    564  
    565   
    566                  
    567  
     562 
     563 
     564 
     565 
     566 
     567 
  • trunk/NALIGNER/ali_solution.hxx

    r2 r655  
    66 
    77 
    8 #include <malloc.h> 
     8// #include <malloc.h> 
    99 
    1010#include "ali_profile.hxx" 
     
    129129    int is_equal(ALI_MAP *map) { 
    130130        unsigned long i; 
    131         if (first_seq_base != map->first_seq_base ||  
     131        if (first_seq_base != map->first_seq_base || 
    132132            last_seq_base != map->last_seq_base || 
    133133            first_ref_base != map->first_ref_base || 
    134             last_ref_base != map->last_ref_base)  
     134            last_ref_base != map->last_ref_base) 
    135135            return 0; 
    136136        for (i = 0; i < last_seq_base - first_seq_base + 1; i++) 
     
    187187void print(void); 
    188188}; 
    189        
     189 
    190190 
    191191#endif 
  • trunk/NALIGNER/ali_tarray.hxx

    r2 r655  
    44#define _ALI_TARRAY_INC_ 
    55 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77 
    88#include "ali_misc.hxx" 
  • trunk/NALIGNER/ali_tstack.hxx

    r2 r655  
    44#define _ALI_TSTACK_INC_ 
    55 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77#include "ali_misc.hxx" 
    88 
  • trunk/NAMES/names_client.c

    r36 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4/* #include <malloc.h> */ 
    55#include <names_client.h> 
    66#include <arbdb.h> 
     
    7878    if (err) return err; 
    7979 
    80          
     80 
    8181    gb_species_data = GB_search(gb_main,"species_data",GB_CREATE_CONTAINER); 
    8282 
  • trunk/NTREE/AP_consensus.cxx

    r572 r655  
    5151#include <arbdb.h> 
    5252#include <arbdbt.h> 
    53 #include <malloc.h> 
     53// #include <malloc.h> 
    5454#include <aw_root.hxx> 
    5555#include <aw_device.hxx> 
  • trunk/NTREE/AP_cprofile.cxx

    r2 r655  
    88 * Global Functions:              x 
    99 * 
    10  * Global Variables:         
     10 * Global Variables: 
    1111 *                                  AWARS 
    1212 *               AW_STRING, "cpro/alignment" : name of alignment 
    1313 *               AW_STRING, "cpro/which_species" : all/marked 
    1414 *               AW_STRING, "cpro/countgaps" : if off, drop gaps 
    15  *               AW_FLOAT, "cpro/rateofgroup" : how to rate, when two  
     15 *               AW_FLOAT, "cpro/rateofgroup" : how to rate, when two 
    1616 *                 characters belong to the same group [ 0.0 means don't rate ] 
    17  *               AW_INT, AWAR_CURSOR_POSITION:  
     17 *               AW_INT, AWAR_CURSOR_POSITION: 
    1818 *                           column shown in func. CPRO_drawstatistic_cb 
    1919 * 
     
    3030 * 
    3131 * Description:                   x 
    32  *  
     32 * 
    3333 * Integration Notes: The main function using this module must have a 
    3434 *                    callback to the function 
     
    4444#include <string.h> 
    4545#include <memory.h> 
    46 #include <malloc.h> 
     46// #include <malloc.h> 
    4747#include <math.h> 
    4848#include <arbdb.h> 
     
    7979        long memneeded;            // memory required for this statistic 
    8080        char which_species[20];    // "marked vs all" , ... 
    81         char drawmode;             // smoothing  
     81        char drawmode;             // smoothing 
    8282        char alignname[80];        // name of alignment 
    8383        char statisticexists;      // was there yet a statistic calculated/loaded ? 
     
    8888 
    8989struct CPRO_struct { 
    90         long numspecies;           // number of species  
     90        long numspecies;           // number of species 
    9191        long maxresneeded;         // not yet used (max distance of calculation) 
    9292        long partition;            // size of partition in matrix of compares 
     
    9494        char *agonist;             // list of species that contribute to statistic 
    9595        char *antagonist;          // -^- 
    96         char convtable[256];         // converts character to a token  
     96        char convtable[256];         // converts character to a token 
    9797        char grouptable[MAX_AMINOS]; // gives number of group, in which token is 
    98                                      // member  
     98                                     // member 
    9999        float grouprate;           // ratio between transitions and transversions 
    100100        float distancecorrection;  // results out of grouprate 
     
    110110 
    111111/* ----------------------------------------------------------------- 
    112  * Function:                     CPRO_readandallocate  
     112 * Function:                     CPRO_readandallocate 
    113113 * 
    114114 * Arguments:                    char versus,char *align (name of alignment) 
    115115 * 
    116  * Returns:                      modifies:    
     116 * Returns:                      modifies: 
    117117 *                               char **&speciesdata,GBDATA **&speciesdatabase 
    118118 * 
     
    120120 *                  'agonist' and 'antagonist' is allocated. 
    121121 *                  Pointers to the sequences in the database are 
    122  *                  read into array 'speciesdatabase'.  
    123  *                  
     122 *                  read into array 'speciesdatabase'. 
     123 * 
    124124 * 
    125125 * NOTE:                         . 
     
    132132 * 
    133133 * AWARs modified:               x 
    134  *  
    135  * Dependencies:                 .   
     134 * 
     135 * Dependencies:                 . 
    136136 * ----------------------------------------------------------------- 
    137137 */ 
     
    147147        gb_species = GBT_first_species_rel_species_data(gb_species_data); 
    148148        while(gb_species) 
    149         {                
     149        { 
    150150                if(GBT_read_sequence(gb_species,align)){ 
    151151                        nrofspecies++;    } 
    152                 gb_species = GBT_next_species(gb_species);       
     152                gb_species = GBT_next_species(gb_species); 
    153153        } 
    154154        CPRO.numspecies=nrofspecies; 
     
    164164        gb_species = GBT_first_species_rel_species_data(gb_species_data); 
    165165        while(gb_species) 
    166         {                
    167                 if( (alidata=GBT_read_sequence(gb_species,align)) )  
     166        { 
     167                if( (alidata=GBT_read_sequence(gb_species,align)) ) 
    168168                        { 
    169                         speciesdatabase[countspecies++]=alidata;           
     169                        speciesdatabase[countspecies++]=alidata; 
    170170                        } 
    171                 gb_species = GBT_next_species(gb_species);       
     171                gb_species = GBT_next_species(gb_species); 
    172172        } 
    173173 
     
    183183                { 
    184184                        CPRO.antagonist[j]=0; 
    185                         if(GB_read_flag(GB_get_father(GB_get_father(speciesdatabase[j]))))  
     185                        if(GB_read_flag(GB_get_father(GB_get_father(speciesdatabase[j])))) 
    186186                                        CPRO.antagonist[j]=(char)1; 
    187187                } 
     
    214214                    (size_t)CPRO.result[which_statistic].resolution*3+3, 
    215215                                sizeof(STATTYPE *)); 
    216                 for(long i=0;i<CPRO.result[which_statistic].resolution*3;i++)  
     216                for(long i=0;i<CPRO.result[which_statistic].resolution*3;i++) 
    217217                { 
    218218                        CPRO.result[which_statistic].statistic[i]=(STATTYPE *)calloc( 
    219219                        (size_t)CPRO.result[which_statistic].maxalignlen, 
    220                                 sizeof(STATTYPE));  
     220                                sizeof(STATTYPE)); 
    221221                } 
    222222} 
     
    263263                                CPRO.result[which_statistic].maxaccu=sum; 
    264264                                colmax=column; 
    265                         }  
     265                        } 
    266266                } 
    267267                if(hits) memneeded+=CPRO.result[which_statistic].maxalignlen; 
     
    283283 
    284284/* ----------------------------------------------------------------- 
    285  * Function:          CPRO_maketables            
     285 * Function:          CPRO_maketables 
    286286 * 
    287287 * Arguments:         char isamino 
    288288 * 
    289  * Returns:           modifies: char *CPRO.convtable,  
     289 * Returns:           modifies: char *CPRO.convtable, 
    290290 *                              char *CPRO.grouptable 
    291291 * 
    292  * Description:       Fills tables CPRO.convtable and CPRO.grouptable, that are  
     292 * Description:       Fills tables CPRO.convtable and CPRO.grouptable, that are 
    293293 *                    used later, when making the statistic. Meaning of tables: 
    294  *                    E.g. CPRO.convtable['a']=BAS_A means that char. 'a' is  
     294 *                    E.g. CPRO.convtable['a']=BAS_A means that char. 'a' is 
    295295 *                    converted into number BAS_A. Then CPRO.grouptable[BAS_A]=1 
    296296 *                    and CPRO.grouptable[BAS_G]=1 means, that characters 'a' 
    297   *                   and 'g' are both members of group 1.  
     297  *                   and 'g' are both members of group 1. 
    298298 * 
    299299 * NOTE:                         . 
     
    301301 * Global Variables referenced:  . 
    302302 * 
    303  * Global Variables modified:    char *CPRO.convtable, char *CPRO.grouptable  
     303 * Global Variables modified:    char *CPRO.convtable, char *CPRO.grouptable 
    304304 * 
    305305 * AWARs referenced:             . 
    306306 * 
    307307 * AWARs modified:               x 
    308  *  
    309  * Dependencies:                 .   
     308 * 
     309 * Dependencies:                 . 
    310310 * ----------------------------------------------------------------- 
    311311 */ 
     
    313313{ 
    314314        long i; 
    315         for(i=0;i<256;i++)  {  
     315        for(i=0;i<256;i++)  { 
    316316                CPRO.convtable[i]=0; } 
    317317        if(!isamino) 
     
    324324                CPRO.convtable['u']=BAS_T;      CPRO.convtable['U']=BAS_T; 
    325325 
    326                 for(i=0;i<MAX_AMINOS;i++) {  
     326                for(i=0;i<MAX_AMINOS;i++) { 
    327327                        CPRO.grouptable[i]=0; } 
    328328                CPRO.grouptable[BAS_A]=1;       CPRO.grouptable[BAS_G]=1; 
    329                 CPRO.grouptable[BAS_C]=2;       CPRO.grouptable[BAS_T]=2;                
     329                CPRO.grouptable[BAS_C]=2;       CPRO.grouptable[BAS_T]=2; 
    330330        } 
    331331        else 
     
    351351                SC(5,'F');SC(5,'Y');SC(5,'W'); 
    352352                                       /* FYW */ 
    353 #undef SC                
     353#undef SC 
    354354        } 
    355355} 
     
    366366        float distance=0.0; 
    367367 
    368          
     368 
    369369        if(elemx==elemy) return; 
    370370        if(!(CPRO.agonist[elemx])) return; 
    371371        if(!(CPRO.antagonist[elemy])) return; 
    372         if((CPRO.agonist[elemy])&&(CPRO.antagonist[elemx])&&(elemy<elemx)) return;       
     372        if((CPRO.agonist[elemy])&&(CPRO.antagonist[elemx])&&(elemy<elemx)) return; 
    373373 
    374374        //add similarities (added 1.0 means equal, 0.0 means different) 
     
    379379                { 
    380380                        numofcolumns++; 
    381                         if(value1==value2) {  
     381                        if(value1==value2) { 
    382382                                rate=rate+1.0; } 
    383383                        else if(CPRO.grouptable[value1]==CPRO.grouptable[value2]) { 
    384                                         rate=rate+CPRO.grouprate; } // add transition weighted  
     384                                        rate=rate+CPRO.grouprate; } // add transition weighted 
    385385                                                                                                // between 1.0 and 0.0 
    386386                } 
     
    396396 
    397397        if (column < 0 || column>= CPRO.result[which_statistic].resolution) return; 
    398          
     398 
    399399        register STATTYPE *equalentry= 
    400400                                CPRO.result[which_statistic].statistic[3*column]; 
     
    408408        for(counter=0;counter<CPRO.result[which_statistic].maxalignlen;counter++) 
    409409        { 
    410                 if((value1=*firstseq)&&(value2=*secondseq))   
     410                if((value1=*firstseq)&&(value2=*secondseq)) 
    411411                // when gap or unaligned base goto next position 
    412412                { 
     
    421421                samegroupentry++; 
    422422                differententry++; 
    423         }        
    424          
     423        } 
     424 
    425425 
    426426 
     
    428428 
    429429// is used by function CPRO_makestatistic 
    430 // reads sequences of a segment into memory, converts them  
     430// reads sequences of a segment into memory, converts them 
    431431// and frees older sequences 
    432432void CPRO_readneededdata(char **speciesdata,GBDATA **speciesdatabase, 
     
    437437        for(i=0;i<CPRO.numspecies;i++) 
    438438        { 
    439                 if((speciesdata[i])&&(i<elemy1)&&(i>elemy2)&&(i<elemx1)&&(i>elemx2))  
    440                 {  
    441                          delete(speciesdata[i]); speciesdata[i]=0;  
    442                 } 
    443         }        
     439                if((speciesdata[i])&&(i<elemy1)&&(i>elemy2)&&(i<elemx1)&&(i>elemx2)) 
     440                { 
     441                         delete(speciesdata[i]); speciesdata[i]=0; 
     442                } 
     443        } 
    444444 
    445445        if(elemx1<CPRO.numspecies) 
    446446        { 
    447                 for(i=elemx1;(i<=elemx2 && i<CPRO.numspecies);i++)  
     447                for(i=elemx1;(i<=elemx2 && i<CPRO.numspecies);i++) 
    448448                { 
    449449                        if( (CPRO.agonist[i])&&(!(speciesdata[i])) ) 
     
    457457                } 
    458458        } 
    459         if(elemy1<CPRO.numspecies)               
    460         { 
    461                 for(i=elemy1;(i<=elemy2 && i<CPRO.numspecies);i++)  
     459        if(elemy1<CPRO.numspecies) 
     460        { 
     461                for(i=elemy1;(i<=elemy2 && i<CPRO.numspecies);i++) 
    462462                { 
    463463                        if( (CPRO.antagonist[i])&&(!(speciesdata[i])) ) 
     
    465465                                tempdata=GB_read_char_pntr(speciesdatabase[i]); 
    466466                                speciesdata[i]=(char*)calloc((unsigned int) 
    467                                                 CPRO.result[which_statistic].maxalignlen,1);  
     467                                                CPRO.result[which_statistic].maxalignlen,1); 
    468468                                for(j=0;j<CPRO.result[which_statistic].maxalignlen;j++)  { 
    469469                                        speciesdata[i][j]=CPRO.convtable[tempdata[j]];  } 
     
    475475 
    476476/* ----------------------------------------------------------------- 
    477  * Function:                     CPRO_makestatistic  
     477 * Function:                     CPRO_makestatistic 
    478478 * 
    479479 * Arguments:                    char **speciesdata, 
    480  *                               GBDATA **speciesdatabase  
    481  * 
    482  * Returns:                      1 if successful, 0 if user abort  
    483  *                                   (without consequences)  
     480 *                               GBDATA **speciesdatabase 
     481 * 
     482 * Returns:                      1 if successful, 0 if user abort 
     483 *                                   (without consequences) 
    484484 * 
    485485 * Description:    This function compares every sequence with every sequence. 
     
    489489 *                 When a new segment is entered, the corresponding 
    490490 *                 sequences are loaded into array 'speciesdata' by the function 
    491  *                 CPRO_readneededdata. 'speciesdatabase' contains pointers of  
     491 *                 CPRO_readneededdata. 'speciesdatabase' contains pointers of 
    492492 *                 sequences to the database. Comparison and evaluation of two 
    493493 *                 sequences is done by function CPRO_entryinstatistic. 
     
    495495 * NOTE:                         . 
    496496 * 
    497  * Global Variables referenced:  
    498  *      CPRO.numspecies,CPRO.result[which_statistic].maxalignlen  
    499  *                                 
    500  * Global Variables modified:    x  
     497 * Global Variables referenced: 
     498 *      CPRO.numspecies,CPRO.result[which_statistic].maxalignlen 
     499 * 
     500 * Global Variables modified:    x 
    501501 * 
    502502 * AWARs referenced:             . 
    503503 * 
    504504 * AWARs modified:          CPRO.result[which_statistic].statistic  is modified 
    505  *  
    506  * Dependencies:                 CPRO_entryinstatistic , CPRO_readneededdata   
     505 * 
     506 * Dependencies:                 CPRO_entryinstatistic , CPRO_readneededdata 
    507507 * ----------------------------------------------------------------- 
    508508 */ 
    509509char CPRO_makestatistic(char **speciesdata,GBDATA **speciesdatabase, 
    510                             char which_statistic)  
     510                            char which_statistic) 
    511511{ 
    512512        long widthmatrix=CPRO.partition; 
     
    548548                                                                      elemx,elemy,which_statistic); 
    549549                                                compares++; 
    550                                                 if(((compares/30)*30)==compares)  
     550                                                if(((compares/30)*30)==compares) 
    551551                                                { 
    552552                                                        if(aw_status((double)compares 
     
    581581 * Global Variables referenced:  . 
    582582 * 
    583  * Global Variables modified:    x  
     583 * Global Variables modified:    x 
    584584 * 
    585585 * AWARs referenced:             cpro/alignment , cpro/which_species 
     
    587587 * 
    588588 * AWARs modified:               x 
    589  *  
    590  * Dependencies:   CPRO_readandallocate , CPRO_makestatistic , CPRO_deallocate  
     589 * 
     590 * Dependencies:   CPRO_readandallocate , CPRO_makestatistic , CPRO_deallocate 
    591591 * ----------------------------------------------------------------- 
    592592 */ 
     
    621621        else strcpy(CPRO.result[which_statistic].which_species,"all vs all\0"); 
    622622 
    623         if( (faultmessage=GB_push_transaction(gb_main)) )  
     623        if( (faultmessage=GB_push_transaction(gb_main)) ) 
    624624        { 
    625625                aw_message(faultmessage,"OK,EXIT"); 
     
    640640        aw_openstatus("calculating");aw_status((double)0); 
    641641 
    642         GBDATA **speciesdatabase; // array of GBDATA-pointers to the species  
    643         char **speciesdata;//array of pointers to strings that hold data of species  
    644  
    645 // allocate memory for 'CPRO.statistic','speciesdata' and fill  
     642        GBDATA **speciesdatabase; // array of GBDATA-pointers to the species 
     643        char **speciesdata;//array of pointers to strings that hold data of species 
     644 
     645// allocate memory for 'CPRO.statistic','speciesdata' and fill 
    646646//                'speciesdatabase','agonist' and 'antagonist' 
    647647        CPRO_readandallocate(speciesdata,speciesdatabase,versus,align); 
     
    668668        CPRO_deallocate(speciesdata,speciesdatabase); 
    669669        delete   align; 
    670         if( (faultmessage=GB_pop_transaction(gb_main)) )  
     670        if( (faultmessage=GB_pop_transaction(gb_main)) ) 
    671671        { 
    672672                aw_message(faultmessage,"OK,EXIT"); 
    673673                return; 
    674         }        
     674        } 
    675675 
    676676        CPRO_memrequirement_cb(awr,0,0); 
     
    696696        aw_root->awar("tmp/cpro/which1")->write_string(CPRO.result[0].which_species); 
    697697        aw_root->awar("tmp/cpro/which2")->write_string(CPRO.result[1].which_species); 
    698          
     698 
    699699        sprintf(buf,"%5ld",CPRO.result[0].resolution); 
    700700        aw_root->awar("tmp/cpro/nowres1")->write_string(buf); 
     
    704704        if(!(CPRO.result[0].statisticexists)) 
    705705                        aw_root->awar("tmp/cpro/memfor1")->write_string("0KB\0"); 
    706         else  
     706        else 
    707707        { 
    708708                sprintf(buf,"%ldKB",CPRO.result[0].memneeded/1024); 
     
    712712        if(!(CPRO.result[1].statisticexists)) 
    713713                        aw_root->awar("tmp/cpro/memfor2")->write_string("0KB\0"); 
    714         else  
     714        else 
    715715        { 
    716716                sprintf(buf,"%ldKB",CPRO.result[1].memneeded/1024); 
     
    718718        } 
    719719 
    720         if( (faultmessage=GB_push_transaction(gb_main)) )  
     720        if( (faultmessage=GB_push_transaction(gb_main)) ) 
    721721        { 
    722722                aw_message(faultmessage,"OK,EXIT"); 
     
    744744        } 
    745745        while(gb_species) 
    746         {                
     746        { 
    747747                if(GBT_read_sequence(gb_species,align)){ 
    748                         nrofspecies++;     
     748                        nrofspecies++; 
    749749                } 
    750750                if (versus==1) { 
     
    752752                }else{ 
    753753                        gb_species = GBT_next_species(gb_species); 
    754                 }        
     754                } 
    755755        } 
    756756        CPRO.numspecies=nrofspecies; */ 
     
    759759        /*if(CPRO.numspecies<=2*CPRO.partition) mem=CPRO.numspecies*len; 
    760760        else mem=CPRO.partition*2*len; */ 
    761         mem=CPRO.partition*len*2;    // *2, because of row and column in matrix  
     761        mem=CPRO.partition*len*2;    // *2, because of row and column in matrix 
    762762        sprintf(buf,"%ldKB",mem/1024); 
    763763        aw_root->awar("tmp/cpro/mempartition")->write_string(buf); 
    764          
     764 
    765765        mem+=resolution*3*sizeof(STATTYPE)*len; 
    766766        sprintf(buf,"%ldKB",mem/1024); 
    767767        aw_root->awar("tmp/cpro/memstatistic")->write_string(buf); 
    768          
     768 
    769769        delete align; 
    770770        if( (faultmessage=GB_pop_transaction(gb_main)) ) 
     
    794794        aw_root->awar_int( "cpro/firstreachedstep",4,aw_def); 
    795795        aw_root->awar_int( "cpro/leastcompares",300,aw_def); 
    796         aw_root->awar_string("tmp/cpro/mempartition","",aw_def);         
     796        aw_root->awar_string("tmp/cpro/mempartition","",aw_def); 
    797797        aw_root->awar_int( "cpro/gridhorizontal",20,aw_def); 
    798798        aw_root->awar_int( "cpro/gridvertical",20,aw_def); 
     
    852852 
    853853        sum=hits+group+different; 
    854          
     854 
    855855        if(!(mode)) 
    856856        { 
    857                 if(sum)  
     857                if(sum) 
    858858                { 
    859859                        equal=(float)hits/(float)sum; 
    860                         ingroup=((float)hits+(float)group)/(float)sum;  
    861                 } 
    862                 else  
     860                        ingroup=((float)hits+(float)group)/(float)sum; 
     861                } 
     862                else 
    863863                { 
    864864                        equal=1.0; 
    865                         ingroup=1.0;  
     865                        ingroup=1.0; 
    866866                } 
    867867        return; 
     
    871871                float accu=pow(sum/(float)CPRO.result[which_statistic].maxaccu,0.0675); 
    872872                float distance=(float)CPRO.result[which_statistic].drawmode*.01* 
    873                                CPRO.result[which_statistic].resolution;  
     873                               CPRO.result[which_statistic].resolution; 
    874874                float alpha=0.0;   // alpha=0.0 no smoothing; alpha=0.99 high smoothing 
    875                 if(distance>0.0000001)  
     875                if(distance>0.0000001) 
    876876                { 
    877877                        alpha=1.0-accu/distance; 
     
    879879                } 
    880880 
    881                 if(res==0)  
     881                if(res==0) 
    882882                { 
    883883                        CPRO.Z_it_group=1.0; 
     
    904904void CPRO_box(AW_device *device,int gc,float l,float t,float width,float high) 
    905905{ 
    906         device->line(gc,l,t,l+width,t,1,(AW_CL)0,(AW_CL)0);      
    907         device->line(gc,l+width,t,l+width,t+high,1,(AW_CL)0,(AW_CL)0);   
    908         device->line(gc,l,t+high,l+width,t+high,1,(AW_CL)0,(AW_CL)0);    
    909         device->line(gc,l,t,l,t+high,1,(AW_CL)0,(AW_CL)0);       
     906        device->line(gc,l,t,l+width,t,1,(AW_CL)0,(AW_CL)0); 
     907        device->line(gc,l+width,t,l+width,t+high,1,(AW_CL)0,(AW_CL)0); 
     908        device->line(gc,l,t+high,l+width,t+high,1,(AW_CL)0,(AW_CL)0); 
     909        device->line(gc,l,t,l,t+high,1,(AW_CL)0,(AW_CL)0); 
    910910} 
    911911 
     
    935935        float betweendistance=30.0; 
    936936        float firstavailable=.65; 
    937         float secondavailable=.35;  
     937        float secondavailable=.35; 
    938938        /* points are in the areas and without the frame */ 
    939939        float topfirst, leftfirst, widthfirst, highfirst; 
     
    952952        widthfirst=(rect.r-rect.l)-leftdistance-1-rightdistance; 
    953953        widthsecond=(rect.r-rect.l)-leftdistance-1-rightdistance; 
    954         highboth=(rect.b-rect.t)-topdistance-bottomdistance-betweendistance-4;  
     954        highboth=(rect.b-rect.t)-topdistance-bottomdistance-betweendistance-4; 
    955955        if((highboth<12.0)||(widthfirst<10.0)) return; 
    956956 
     
    967967        CPRO_box(device,GC_black,leftsecond-1,topsecond-1, 
    968968                    widthsecond+2,highsecond+2); 
    969          
     969 
    970970        device->text(GC_black,"column",leftdistance+82,14,0,1,0,0); 
    971971 
     
    985985                sprintf(buf,"%3ld%%",gridy); 
    986986                device->text(GC_black,buf,xpos-27,ypos+4,0,1,0,0); 
    987         }                
     987        } 
    988988        device->text(GC_black,"100%",leftdistance-26,topdistance+5,0,1,0,0); 
    989989 
     
    998998        { 
    999999                xpos=leftdistance+1+(float)gridx*0.01/CPRO.maxdistance*widthfirst; 
    1000                 if((float)gridx*0.01<1.0*CPRO.maxdistance)  
     1000                if((float)gridx*0.01<1.0*CPRO.maxdistance) 
    10011001                                device->line(GC_grid,xpos,ypos,xpos,ypos+highfirst,1,0,0); 
    10021002                sprintf(buf,"%3ld%%",gridx); 
     
    10301030                        // do not draw outside canvas-box 
    10311031                        if(xpos+linelength > leftfirst+widthfirst+1) continue; 
    1032                          
     1032 
    10331033                        confidinterval=highfirst* 
    10341034                                CPRO_confidinterval(firstx,CPRO.column-1,which_statistic,mode); 
    1035          
     1035 
    10361036                        ytop=ypos-confidinterval; 
    1037                         if(ytop>=topfirst) {  
     1037                        if(ytop>=topfirst) { 
    10381038                                device->line(GC_blue,xpos,ytop,xpos+linelength,ytop,1,0,0); } 
    10391039                        else { ytop=topfirst; } 
     
    10411041 
    10421042                        ybottom=ypos+confidinterval; 
    1043                         if(ybottom<topfirst+highfirst) {  
     1043                        if(ybottom<topfirst+highfirst) { 
    10441044                                device->line(GC_blue,xpos,ybottom,xpos+linelength,ybottom,1,0,0);} 
    10451045                        else { ybottom=topfirst+highfirst-1; } 
     
    10481048                        ypos=topfirst+ingroup*highfirst; 
    10491049                        ytop=ypos-confidinterval; 
    1050                         if(ytop>=topfirst) {  
     1050                        if(ytop>=topfirst) { 
    10511051                                device->line(GC_green,xpos,ytop,xpos+linelength,ytop,1,0,0); } 
    10521052                        else { ytop=topfirst; } 
    10531053                        device->line(GC_green,xpos+linelength/2,ytop,xpos+linelength/2,ypos,1,0,0); 
    1054                  
     1054 
    10551055                        ybottom=ypos+confidinterval; 
    1056                         if(ybottom<topfirst+highfirst){  
     1056                        if(ybottom<topfirst+highfirst){ 
    10571057                                device->line(GC_green,xpos,ybottom,xpos+linelength,ybottom,1,0,0);} 
    10581058                        else { ybottom=topfirst+highfirst-1; } 
    10591059                        device->line(GC_green,xpos+linelength/2,ybottom,xpos+linelength/2,ypos,1,0,0); 
    1060                  
     1060 
    10611061                } 
    10621062        } 
    10631063 
    10641064        float resaccu; 
    1065         float rate;             
     1065        float rate; 
    10661066        sprintf(buf," %5ld",CPRO.result[which_statistic].maxaccu); 
    10671067        device->text(GC_black,"   max",leftsecond-50,topsecond,0,1,0,0); 
     
    10931093        AW_device *device=aws->get_device(AW_INFO_AREA); 
    10941094        device->reset(); 
    1095         CPRO_drawstatistic(device,(char)which_statistic);        
    1096 } 
    1097          
     1095        CPRO_drawstatistic(device,(char)which_statistic); 
     1096} 
     1097 
    10981098void CPRO_expose_cb( AW_window *aws,AW_CL which_statistic, AW_CL cd2) 
    10991099{ 
     
    11131113 
    11141114        AW_device *device=aws->get_device (AW_INFO_AREA); 
    1115         CPRO_drawstatistic(device,(char)which_statistic);        
    1116 }        
     1115        CPRO_drawstatistic(device,(char)which_statistic); 
     1116} 
    11171117 
    11181118void CPRO_column_cb(AW_root *awr,AW_window *aws,AW_CL which_statistic) 
     
    11671167        GB_write_int(gb_param,CPRO.result[which_statistic].resolution); 
    11681168        gb_param=GB_create(newbase,"cpro_maxalignlen",GB_INT); 
    1169         GB_write_int(gb_param,CPRO.result[which_statistic].maxalignlen);         
     1169        GB_write_int(gb_param,CPRO.result[which_statistic].maxalignlen); 
    11701170        gb_param=GB_create(newbase,"cpro_maxaccu",GB_INT); 
    11711171        GB_write_int(gb_param,CPRO.result[which_statistic].maxaccu); 
     
    11751175        GB_write_string(gb_param,CPRO.result[which_statistic].alignname); 
    11761176        gb_param=GB_create(newbase,"cpro_which_species",GB_STRING); 
    1177         GB_write_string(gb_param,CPRO.result[which_statistic].which_species);    
     1177        GB_write_string(gb_param,CPRO.result[which_statistic].which_species); 
    11781178        gb_param=GB_create(newbase,"cpro_ratio",GB_FLOAT); 
    11791179        GB_write_float(gb_param,CPRO.result[which_statistic].ratio); 
     
    11811181        GB_write_int(gb_param,CPRO.result[which_statistic].countgaps); 
    11821182 
    1183          
    1184         long maxalignlen=CPRO.result[which_statistic].maxalignlen;       
     1183 
     1184        long maxalignlen=CPRO.result[which_statistic].maxalignlen; 
    11851185 
    11861186        GBDATA *gb_colrescontainer; 
     
    12061206                } 
    12071207        } 
    1208                  
     1208 
    12091209        if( (error=GB_commit_transaction(newbase)) ) 
    12101210        { 
     
    12781278        gb_param=GB_search(oldbase,"cpro_which_species",GB_FIND); 
    12791279        if(gb_param) strcpy(CPRO.result[which_statistic].which_species, 
    1280                GB_read_char_pntr(gb_param));     
     1280               GB_read_char_pntr(gb_param)); 
    12811281 
    12821282        CPRO.result[which_statistic].statistic=(STATTYPE **)calloc( 
     
    13281328 
    13291329        aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    1330         aws->create_button("CLOSE","CLOSE","C");                            
     1330        aws->create_button("CLOSE","CLOSE","C"); 
    13311331 
    13321332        aws->at("save");aws->callback(CPRO_savestatistic_cb,which_statistic); 
    1333         aws->create_button("SAVE","SAVE","S");                      
     1333        aws->create_button("SAVE","SAVE","S"); 
    13341334 
    13351335        aws->callback( (AW_CB0)AW_POPDOWN); 
    13361336        aws->at("cancel"); 
    1337         aws->create_button("CANCEL","CANCEL","C");                          
     1337        aws->create_button("CANCEL","CANCEL","C"); 
    13381338 
    13391339        awt_create_selection_box((AW_window *)aws,"cpro/save"); 
     
    13491349 
    13501350        aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    1351         aws->create_button("CLOSE","CLOSE","C");                            
     1351        aws->create_button("CLOSE","CLOSE","C"); 
    13521352 
    13531353        aws->at("save");aws->callback(CPRO_loadstatistic_cb,which_statistic); 
    1354         aws->create_button("LOAD","LOAD","S");                      
     1354        aws->create_button("LOAD","LOAD","S"); 
    13551355 
    13561356        awt_create_selection_box((AW_window *)aws,"cpro/load"); 
     
    13611361// search point of resolution when half maximum if reached (for condense) 
    13621362float CPRO_gethalfmaximum(long column,float maximum,float firsttoreach, 
    1363                           char transversion,char which_statistic,char mode)  
     1363                          char transversion,char which_statistic,char mode) 
    13641364{ 
    13651365        float equal,ingroup,interest; 
     
    13851385        } 
    13861386        halfmax=(float)res/(float)CPRO.result[which_statistic].resolution; 
    1387         return(halfmax-(float)CPRO.result[which_statistic].drawmode*0.01);  
     1387        return(halfmax-(float)CPRO.result[which_statistic].drawmode*0.01); 
    13881388               // delay depending on drawmode 
    13891389} 
     
    14151415        AW_root *aw_root = aw->get_root(); 
    14161416        char mode=CPRO.result[which_statistic].drawmode; 
    1417         if(!(CPRO.result[which_statistic].statisticexists))  
     1417        if(!(CPRO.result[which_statistic].statisticexists)) 
    14181418        { 
    14191419                aw_message("statistic doesn't exist !"); 
     
    14321432 
    14331433        char *savename=aw_root->awar("cpro/condensename")->read_string(); 
    1434         if(savename[0]==0)  
     1434        if(savename[0]==0) 
    14351435        { 
    14361436                delete savename; 
     
    14441444        float maximum; 
    14451445        float reachedhalf; 
    1446         char steps;  
     1446        char steps; 
    14471447        for(long column=0;column<maxcol;column++) 
    14481448        { 
     
    14511451                if(maximum<-100.0) result[column]='.'; 
    14521452                else if(maximum<=0.0) result[column]='-'; 
    1453                 else  
     1453                else 
    14541454                { 
    14551455                        if(maximum>=leastmax) result[column]='A'; 
     
    14581458                                                   transversion,(char)which_statistic,mode); 
    14591459                        for(steps=0;(reachedhalf>firstreachedstep)&&(steps<'Y'-'A');steps++) 
    1460                                 reachedhalf-=firstreachedstep;   
     1460                                reachedhalf-=firstreachedstep; 
    14611461                        result[column]+=steps; 
    14621462                } 
     
    15091509 
    15101510        aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    1511         aws->create_button("CLOSE","CLOSE","C");                            
     1511        aws->create_button("CLOSE","CLOSE","C"); 
    15121512 
    15131513        aws->at( "which_result" ); 
     
    15191519        aws->button_length(11); 
    15201520        aws->at("begin");aws->callback(CPRO_condense_cb,which_statistic); 
    1521         aws->create_button("CONDENSE_AND_EXPORT", "CONDENSE\nAND EXPORT","E");   
     1521        aws->create_button("CONDENSE_AND_EXPORT", "CONDENSE\nAND EXPORT","E"); 
    15221522 
    15231523        aws->at("name");aws->create_input_field("cpro/condensename",11); 
     
    15401540 
    15411541        aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    1542         aws->create_button("CLOSE","CLOSE","C");                            
    1543          
     1542        aws->create_button("CLOSE","CLOSE","C"); 
     1543 
    15441544        aws->at("partition"); 
    15451545        aws->create_input_field("cpro/partition",6); 
     
    15831583 
    15841584        aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    1585         aws->create_button("CLOSE","CLOSE","C");                            
     1585        aws->create_button("CLOSE","CLOSE","C"); 
    15861586 
    15871587        //aws->at("xpert");aws->callback(AW_POPUP,(AW_CL)CPRO_xpert_cb,0); 
     
    15901590        aws->at("column"); 
    15911591        aws->create_input_field(AWAR_CURSOR_POSITION,4); 
    1592          
     1592 
    15931593        aws->button_length(3); 
    15941594        aws->at("d");aws->callback((AW_CB0)CPRO_columnminus_cb); 
     
    15961596        aws->at("u");aws->callback((AW_CB2)CPRO_columnplus_cb,which_statistic,0); 
    15971597        aws->create_button(0,"+","2"); 
    1598          
     1598 
    15991599        sprintf(buf,"cpro/drawmode%d",(int)which_statistic); 
    16001600        aws->at("drawmode");aws->create_option_menu(buf); 
    1601                 aws->insert_option( "no smoothing", "n",0);  
    1602                 aws->insert_option( "smoothing 1", "1",1);  
    1603                 aws->insert_option( "smoothing 2", "2",2);  
    1604                 aws->insert_option( "smoothing 3", "3",3);  
    1605                 aws->insert_option( "smoothing 5", "5",5);  
    1606                 aws->insert_option( "smoothing 10", "6",10);  
     1601                aws->insert_option( "no smoothing", "n",0); 
     1602                aws->insert_option( "smoothing 1", "1",1); 
     1603                aws->insert_option( "smoothing 2", "2",2); 
     1604                aws->insert_option( "smoothing 3", "3",3); 
     1605                aws->insert_option( "smoothing 5", "5",5); 
     1606                aws->insert_option( "smoothing 10", "6",10); 
    16071607                aws->insert_option( "smoothing 15", "7",15); 
    1608         aws->update_option_menu();  
     1608        aws->update_option_menu(); 
    16091609 
    16101610        aw_root->awar(buf)->add_callback( 
    1611                 (AW_RCB)CPRO_column_cb,(AW_CL)aws,which_statistic);      
     1611                (AW_RCB)CPRO_column_cb,(AW_CL)aws,which_statistic); 
    16121612        aw_root->awar("cpro/gridhorizontal")->add_callback( 
    1613                 (AW_RCB)CPRO_column_cb,(AW_CL)aws,which_statistic);      
     1613                (AW_RCB)CPRO_column_cb,(AW_CL)aws,which_statistic); 
    16141614        aw_root->awar("cpro/gridvertical")->add_callback( 
    1615                 (AW_RCB)CPRO_column_cb,(AW_CL)aws,which_statistic);      
     1615                (AW_RCB)CPRO_column_cb,(AW_CL)aws,which_statistic); 
    16161616 
    16171617        aws->at("maxdistance"); 
     
    16281628                                (AW_CL)aws,which_statistic); 
    16291629        aw_root->awar("cpro/maxdistance")->add_callback((AW_RCB)CPRO_column_cb, 
    1630                                 (AW_CL)aws,which_statistic);     
     1630                                (AW_CL)aws,which_statistic); 
    16311631        aws->button_length( 6); 
    16321632 
     
    16401640        device->new_gc( GC_blue ); 
    16411641        device->set_line_attributes(GC_blue,0.3,AW_SOLID); 
    1642         device->set_foreground_color(GC_blue,AW_WINDOW_C1);      
     1642        device->set_foreground_color(GC_blue,AW_WINDOW_C1); 
    16431643        device->new_gc( GC_green ); 
    16441644        device->set_line_attributes(GC_green,0.3,AW_SOLID); 
     
    16471647        device->set_line_attributes(GC_grid,0.3,AW_DOTTED); 
    16481648        device->set_foreground_color(GC_grid,AW_WINDOW_C3); 
    1649          
     1649 
    16501650        return (AW_window *)aws; 
    16511651} 
     
    16611661 
    16621662        aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    1663         aws->create_button("CLOSE","CLOSE","C");                            
     1663        aws->create_button("CLOSE","CLOSE","C"); 
    16641664 
    16651665        aws->at("resolution"); 
     
    16791679        aws->at("calculate"); 
    16801680                aws->callback(CPRO_calculate_cb,(AW_CL)which_statistic); 
    1681         aws->create_button("CALCULATE","CALCULATE","A");                            
     1681        aws->create_button("CALCULATE","CALCULATE","A"); 
    16821682 
    16831683        aws->at( "which_species" ); 
     
    17151715 * Global Variables referenced:  . 
    17161716 * 
    1717  * Global Variables modified:    x  
     1717 * Global Variables modified:    x 
    17181718 * 
    17191719 * AWARs referenced:             . 
    17201720 * 
    17211721 * AWARs modified:               x 
    1722  *  
    1723  * Dependencies:      Needs xfig file cprofile.fig   
     1722 * 
     1723 * Dependencies:      Needs xfig file cprofile.fig 
    17241724 * ----------------------------------------------------------------- 
    17251725 */ 
     
    17351735 
    17361736        aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    1737         aws->create_button("CLOSE","CLOSE","C");                            
    1738          
     1737        aws->create_button("CLOSE","CLOSE","C"); 
     1738 
    17391739        aws->at("help");aws->callback(AW_POPUP_HELP,(AW_CL)"pos_variability.ps"); 
    1740         aws->create_button("HELP","HELP","H");                      
    1741          
     1740        aws->create_button("HELP","HELP","H"); 
     1741 
    17421742        aws->button_length(10); 
    17431743        aws->at("xpert");aws->callback(AW_POPUP,(AW_CL)CPRO_xpert_cb,0); 
     
    17491749        aws->create_button("GO_STAT_1", "calculate as\nstatistic 1 ...","c"); 
    17501750        aws->at("calculate2");aws->callback(AW_POPUP,(AW_CL)CPRO_calculatewin_cb,1); 
    1751         aws->create_button("GO_STAT_2", "calculate as\nstatistic 2 ...","a");    
     1751        aws->create_button("GO_STAT_2", "calculate as\nstatistic 2 ...","a"); 
    17521752 
    17531753        aws->button_length(17); 
     
    17881788                (AW_RCB)CPRO_memrequirement_cb,0,0); 
    17891789        aw_root->awar("cpro/which_species")->add_callback( 
    1790                 (AW_RCB)CPRO_memrequirement_cb,0,0);     
     1790                (AW_RCB)CPRO_memrequirement_cb,0,0); 
    17911791 
    17921792        GB_pop_transaction(gb_main); 
  • trunk/NTREE/AP_pos_var_pars.cxx

    r2 r655  
    33#include <ctype.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <memory.h> 
    77#include <math.h> 
     
    5656        GBDATA *gb_data = GBT_read_sequence(tree->gb_node,ali_name); 
    5757        if (!gb_data) return 0;         // no sequence 
    58         if (GB_read_string_count(gb_data) < seq_len)  
     58        if (GB_read_string_count(gb_data) < seq_len) 
    5959            seq_len = GB_read_string_count(gb_data); 
    6060        sequence = GB_read_char_pntr(gb_data); 
     
    114114// Calculate the positional variability: control procedure 
    115115GB_ERROR AP_pos_var::retrieve( GBT_TREE *tree){ 
    116     GB_ERROR error = 0;  
     116    GB_ERROR error = 0; 
    117117    int i; 
    118118 
     
    190190    GBDATA *gb_extended = GBT_create_SAI(gb_main,sai_name); 
    191191 
    192          
     192 
    193193    {   sprintf(buffer,"%s/_TYPE",ali_name); 
    194194    GBDATA *gb_description  = GB_search( gb_extended, buffer, GB_STRING); 
     
    256256        sprintf(buffer,"%s/_CATEGORIES",ali_name); 
    257257        GBDATA *gb_categories  = GB_search( gb_extended, buffer, GB_STRING); 
    258         GB_write_string(gb_categories, h);  
     258        GB_write_string(gb_categories, h); 
    259259        delete h; 
    260260    } 
     
    281281            return; 
    282282        } 
    283         GBT_link_tree(tree,gb_main, GB_TRUE);            
     283        GBT_link_tree(tree,gb_main, GB_TRUE); 
    284284    } 
    285285    aw_status("Counting Mutations"); 
    286          
     286 
    287287    char *ali_name = GBT_get_default_alignment(gb_main); 
    288288    long ali_len = GBT_get_alignment_len(gb_main,ali_name); 
     
    301301        //          isdna = 1; 
    302302        //      delete ali_type; 
    303          
     303 
    304304        GB_alignment_type at = GBT_get_alignment_type(gb_main, ali_name); 
    305305        isdna = at==GB_AT_DNA || at==GB_AT_RNA; 
     
    337337 
    338338    aws->at("close");aws->callback((AW_CB0)AW_POPDOWN); 
    339     aws->create_button("CLOSE","CLOSE","C");                    
    340          
     339    aws->create_button("CLOSE","CLOSE","C"); 
     340 
    341341    aws->at("help");aws->callback(AW_POPUP_HELP,(AW_CL)"pos_var_pars.hlp"); 
    342     aws->create_button("HELP","HELP","H");                      
     342    aws->create_button("HELP","HELP","H"); 
    343343 
    344344    aws->at("name"); 
     
    354354    aws->highlight(); 
    355355    aws->callback(AP_calc_pos_var_pars); 
    356     aws->create_button("GO","GO");                      
     356    aws->create_button("GO","GO"); 
    357357 
    358358    return (AW_window *)aws; 
  • trunk/NTREE/ETC_check_gcg.cxx

    r247 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <arbdb.h> 
    66#include <arbdbt.h> 
  • trunk/NTREE/NT_main.cxx

    r566 r655  
    22#include <stdio.h> 
    33#include <stdlib.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <arbdb.h> 
    66#include <arbdbt.h> 
  • trunk/NTREE/NT_sort.cxx

    r421 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <arbdb.h> 
    66#include <arbdbt.h> 
  • trunk/NTREE/ad_ali.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    126126 
    127127        error = GBT_rename_alignment(gb_main,source,dest,(int)copy,(int)dele); 
    128          
     128 
    129129        if (!error){ 
    130130            char *nfield = strdup(GBS_global_string("%s/data",dest)); 
     
    149149        aws->callback( (AW_CB0)AW_POPDOWN); 
    150150        aws->at("close"); 
    151         aws->create_button("CLOSE","CLOSE","C");                            
     151        aws->create_button("CLOSE","CLOSE","C"); 
    152152 
    153153        aws->at("label"); 
     
    159159        aws->at("ok"); 
    160160        aws->callback(aa_copy_delete_rename,1,0); 
    161         aws->create_button("GO","GO","G");                          
     161        aws->create_button("GO","GO","G"); 
    162162 
    163163        return (AW_window *)aws; 
     
    171171        aws->callback( (AW_CB0)AW_POPDOWN); 
    172172        aws->at("close"); 
    173         aws->create_button("CLOSE","CLOSE","C");                            
     173        aws->create_button("CLOSE","CLOSE","C"); 
    174174 
    175175        aws->at("label"); 
     
    181181        aws->at("ok"); 
    182182        aws->callback(aa_copy_delete_rename,1,1); 
    183         aws->create_button("GO","GO","G");                          
     183        aws->create_button("GO","GO","G"); 
    184184 
    185185        return (AW_window *)aws; 
     
    203203        }else{ 
    204204            GB_abort_transaction(gb_main); 
    205         }                
     205        } 
    206206        if (error) aw_message(error); 
    207207        delete name; 
     
    216216        aws->callback( (AW_CB0)AW_POPDOWN); 
    217217        aws->at("close"); 
    218         aws->create_button("CLOSE","CLOSE","C");                            
     218        aws->create_button("CLOSE","CLOSE","C"); 
    219219 
    220220        aws->at("label"); 
     
    226226        aws->at("ok"); 
    227227        aws->callback(aa_create_alignment); 
    228         aws->create_button("GO","GO","G");                          
     228        aws->create_button("GO","GO","G"); 
    229229 
    230230        return (AW_window *)aws; 
     
    240240        aws->callback( (AW_CB0)AW_POPDOWN); 
    241241        aws->at("close"); 
    242         aws->create_button("CLOSE","CLOSE","C");                            
     242        aws->create_button("CLOSE","CLOSE","C"); 
    243243 
    244244        aws->callback( AW_POPUP_HELP,(AW_CL)"ad_align.hlp"); 
    245245        aws->at("help"); 
    246         aws->create_button("HELP","HELP","H");                      
     246        aws->create_button("HELP","HELP","H"); 
    247247 
    248248        aws->button_length(13); 
     
    250250        aws->at("delete"); 
    251251        aws->callback(ad_al_delete_cb); 
    252         aws->create_button("DELETE","DELETE","D");                          
     252        aws->create_button("DELETE","DELETE","D"); 
    253253 
    254254        aws->at("rename"); 
    255255        aws->callback(AW_POPUP,(AW_CL)create_alignment_rename_window,0); 
    256         aws->create_button("RENAME","RENAME","R");                          
     256        aws->create_button("RENAME","RENAME","R"); 
    257257 
    258258        aws->at("create"); 
    259259        aws->callback(AW_POPUP,(AW_CL)create_alignment_create_window,0); 
    260         aws->create_button("CREATE","CREATE","N");                          
     260        aws->create_button("CREATE","CREATE","N"); 
    261261 
    262262        aws->at("copy"); 
    263263        aws->callback(AW_POPUP,(AW_CL)create_alignment_copy_window,0); 
    264         aws->create_button("COPY","COPY","C");                      
     264        aws->create_button("COPY","COPY","C"); 
    265265 
    266266        aws->at("check_len"); 
    267267        aws->callback(ed_al_check_len_cb); 
    268         aws->create_button("CHECK_LEN","CHECK LEN","L");                            
     268        aws->create_button("CHECK_LEN","CHECK LEN","L"); 
    269269 
    270270        aws->at("align"); 
    271271        aws->callback(ed_al_align_cb); 
    272         aws->create_button("FORMAT","FORMAT","F");                          
     272        aws->create_button("FORMAT","FORMAT","F"); 
    273273 
    274274        aws->at("list"); 
  • trunk/NTREE/ad_ext.cxx

    r142 r655  
    11#include <stdio.h> 
    22#include <memory.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <string.h> 
    55 
  • trunk/NTREE/ad_trees.cxx

    r635 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <assert.h> 
  • trunk/ORS_CGI/ORS_C_PT.cxx

    r2 r655  
    1 /*  
     1/* 
    22################################# 
    33#                               # 
     
    99#include <stdlib.h> 
    1010#include <memory.h> 
    11 #include <malloc.h> 
     11// #include <malloc.h> 
    1212#include <string.h> 
    1313#include <arbdb.h> 
     
    3030 
    3131// results of probe match 
    32 struct result_struct {   
     32struct result_struct { 
    3333        T_PT_MATCHLIST match_list; 
    3434        long match_list_cnt; 
     
    6666 
    6767/****************************************************************************** 
    68   PROBE MATCH:  
     68  PROBE MATCH: 
    6969                Send probe request to server and receive probe match results 
    7070*******************************************************************************/ 
     
    106106        pt_result.bs.data = 0; 
    107107 
    108         aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs,  
     108        aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs, 
    109109                LOCS_MATCH_LIST,        &pt_result.match_list,          // short names of species 
    110110                LOCS_MATCH_LIST_CNT,    &pt_result.match_list_cnt,      // count of species short names 
    111                 LOCS_MATCH_STRING,      &pt_result.bs,                  // output of pt_Server  
     111                LOCS_MATCH_STRING,      &pt_result.bs,                  // output of pt_Server 
    112112                LOCS_ERROR,             &locs_error, 
    113113                0); 
     
    123123 
    124124/****************************************************************************** 
    125   PROBE FIND:  
     125  PROBE FIND: 
    126126                Send probe request to server and receive probe match results 
    127127*******************************************************************************/ 
     
    155155        pt_result.bs.data = 0; 
    156156 
    157         aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs,  
     157        aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs, 
    158158                LOCS_MATCH_LIST,        &pt_result.match_list,          // short names of species 
    159159                LOCS_MATCH_LIST_CNT,    &pt_result.match_list_cnt,      // count of species short names 
    160                 LOCS_MATCH_STRING,      &pt_result.bs,                  // output of pt_Server  
     160                LOCS_MATCH_STRING,      &pt_result.bs,                  // output of pt_Server 
    161161                LOCS_ERROR,             &locs_error, 
    162162                0); 
  • trunk/ORS_CGI/ORS_C_java.cxx

    r2 r655  
    1 /*  
     1/* 
    22####################################### 
    33#                                     # 
     
    1010#include <string.h> 
    1111#include <memory.h> 
    12 #include <malloc.h> 
     12// #include <malloc.h> 
    1313#include <arbdb.h> 
    1414#include <arbdbt.h> 
     
    5353                fputc(o,t2j_out); 
    5454                t2j_last_nibble = -1; 
    55         }        
     55        } 
    5656} 
    5757 
     
    308308        Sideeffects: no !!!! 
    309309***********************************************************************/ 
    310 GB_ERROR T2J_transform(char *path_of_tree, char *modifier_string,  
    311                 struct T2J_transfer_struct *data,  
     310GB_ERROR T2J_transform(char *path_of_tree, char *modifier_string, 
     311                struct T2J_transfer_struct *data, 
    312312                CAT_node_id focus, FILE *out){ 
    313313        if (!cat_tree)  cat_tree = load_CAT_tree(path_of_tree); 
     
    385385    } 
    386386} 
    387      
     387 
    388388GB_ERROR T2J_send_newick_tree(char *path_of_tree, FILE *out){ 
    389389    if (!cat_tree)      cat_tree = load_CAT_tree(path_of_tree); // 3 lines that should never be deleted 
     
    396396} 
    397397 
    398      
    399 /*********************************************************************** 
    400         Send the tree.   level numbering !!! branch lengths from 0-15  
     398 
     399/*********************************************************************** 
     400        Send the tree.   level numbering !!! branch lengths from 0-15 
    401401        Sideeffects: writes to out 
    402402***********************************************************************/ 
     
    571571                        node->user_data = cat_tree->data + node->field_offsets[CAT_FIELD_GROUP_NAME]; 
    572572                } 
    573                  
     573 
    574574        } 
    575575        return T2J_send_tree(0,0); 
    576576} 
    577577 
    578 long    t2j_get_deepest_node_that_contains_all_selected(CAT_node_id nn,  
     578long    t2j_get_deepest_node_that_contains_all_selected(CAT_node_id nn, 
    579579                        char *selected_ids,long nselected, CAT_node_id *focusout){ 
    580580        CAT_node *node = & cat_tree->nodes[nn]; 
     
    615615        if (!cat_tree) return 0; 
    616616        CAT_node_id *levelindex = t2j_mcreate_level_indexing(); 
    617          
     617 
    618618        char *readp = sel; 
    619619        int nselected = 0; 
     
    625625        GBS_strcat(memfile,varname); 
    626626        readp = sel; 
    627         c = *(readp++);  
     627        c = *(readp++); 
    628628        int last = 0; 
    629629        for (; c >='A' && c <='Z'; ){ 
     
    645645                if (s >= cat_tree->nnodes) e = cat_tree->nnodes-1; 
    646646                last = e; 
    647                  
     647 
    648648                if (all_nodes) { 
    649649                        for (;s<e;s++) { 
     
    656656                        } 
    657657                }else{ 
    658                         GBS_strcat(memfile,cat_tree->data +  
     658                        GBS_strcat(memfile,cat_tree->data + 
    659659                                cat_tree->nodes[levelindex[s]].field_offsets[CAT_FIELD_NAME]); 
    660660                                        // thats one of my favourites statements 
     
    673673                        t2j_get_deepest_node_that_contains_all_selected( 
    674674                                                0,selected_ids,nselected,focusout); 
    675                                 if (maxnodeout ) *maxnodeout = cat_tree->data +  
     675                                if (maxnodeout ) *maxnodeout = cat_tree->data + 
    676676                                        cat_tree->nodes[*focusout]. 
    677677                                        field_offsets[CAT_FIELD_NAME]; 
     
    682682                        CAT_node_id nextuppderlabeldnode = *focusout; 
    683683 
    684                         while ( nextuppderlabeldnode > 0  
     684                        while ( nextuppderlabeldnode > 0 
    685685                                        && cat_tree->nodes[nextuppderlabeldnode]. 
    686686                                                field_offsets[CAT_FIELD_GROUP_NAME] == 0 ) { 
     
    688688                        } 
    689689                        if (nextuppderlabeldnode) {     // get the name of the node 
    690                                 if (maxnodeout ) *maxnodeout = cat_tree->data +  
     690                                if (maxnodeout ) *maxnodeout = cat_tree->data + 
    691691                                        cat_tree->nodes[nextuppderlabeldnode]. 
    692692                                        field_offsets[CAT_FIELD_GROUP_NAME]; 
     
    703703        TEST TEST TEST ... 
    704704***********************************************************************/ 
    705 #if 0  
     705#if 0 
    706706int main(int argc, char **argv) { 
    707707        if (argc != 3) { 
  • trunk/ORS_CGI/ORS_C_lib.cxx

    r2 r655  
    99#include <unistd.h> 
    1010#include <memory.h> 
    11 #include <malloc.h> 
     11// #include <malloc.h> 
    1212#include <string.h> 
    1313#include <arbdb.h> 
     
    6868        if (comment) fprintf(fd,"\t%s",comment); 
    6969        fprintf(fd,"\n"); 
    70          
     70 
    7171        fclose(fd); 
    7272        return; 
     
    117117 
    118118        if( !(servername=(char *)ORS_look_for_server()) ){ 
    119                 quit_with_error(ORS_export_error("Cannot find server"));                 
     119                quit_with_error(ORS_export_error("Cannot find server")); 
    120120        } 
    121121 
     
    126126                // system("tb/bla -b -d &"); 
    127127                // sleep(3); 
    128                 // quit_with_error(ORS_export_error("Link to server failed. Restarting server... try reloading this page."));            
    129                 quit_with_error(ORS_export_error("Link to server failed. Server will be restarted later."));             
     128                // quit_with_error(ORS_export_error("Link to server failed. Restarting server... try reloading this page.")); 
     129                quit_with_error(ORS_export_error("Link to server failed. Server will be restarted later.")); 
    130130 
    131131        } 
    132132        if (init_local_com_struct() ) { 
    133                 quit_with_error(ORS_export_error("Local comm struct failed"));           
     133                quit_with_error(ORS_export_error("Local comm struct failed")); 
    134134        } 
    135135 
     
    187187        while (*pos) { 
    188188                if (*pos >= 'a' && *pos <= 'z') *pos = *pos - 'a' + 'A'; 
    189                 if (!strchr(allowed_bases, *pos))  
     189                if (!strchr(allowed_bases, *pos)) 
    190190                        quit_with_error(ORS_export_error("Base '%c' at position %i is not allowed! Allowed are: '%s' (norm)", *pos, (int)(pos-seq)+1, allowed_bases)); 
    191191                pos++; 
     
    194194 
    195195/****************************************************** 
    196   CALC SEQ & TARGET:  
     196  CALC SEQ & TARGET: 
    197197                        deletes and mallocs target 
    198198                        quit_with_error on error 
     
    213213        if (!*seq1 || !**seq1) { tar = *seq1; seq = *seq2; direction=1; } 
    214214                          else { tar = *seq2; seq = *seq1; direction=2; } 
    215          
     215 
    216216        delete tar; 
    217217        tar = (char *)calloc(sizeof(char), strlen(seq) + 1); 
     
    239239                        case 'N': *tpos = 'X'; break; 
    240240                        case '.': *tpos = '.'; break; 
    241                         default:  
     241                        default: 
    242242                        quit_with_error(ORS_export_error( 
    243243                                "Base '%c' at position %i is not allowed! Allowed are: '%s' (calc_seq)", *spos, (int)(spos-seq)+1, allowed_bases)); 
  • trunk/ORS_CGI/ORS_C_main.cxx

    r2 r655  
    1111#include <stdlib.h> 
    1212#include <memory.h> 
    13 #include <malloc.h> 
     13// #include <malloc.h> 
    1414#include <string.h> 
    1515#include <arbdb.h> 
     
    3535 
    3636        ors_gl.remote_host = getenv("REMOTE_HOST"); 
    37         if (!ors_gl.remote_host) quit_with_error(ORS_export_error("REMOTE_HOST not set"));               
     37        if (!ors_gl.remote_host) quit_with_error(ORS_export_error("REMOTE_HOST not set")); 
    3838 
    3939        ors_gl.remote_user = getenv("REMOTE_USER"); 
    40         if (ors_gl.remote_user == NULL) ors_gl.remote_user = "unknown";  
     40        if (ors_gl.remote_user == NULL) ors_gl.remote_user = "unknown"; 
    4141 
    4242        ors_gl.path_info   = getenv("PATH_INFO"); 
     
    5151        else if (!strcmp(request_method,"POST")) { 
    5252                char *temp; 
    53                 if(!(temp=getenv("CONTENT_LENGTH")))  
    54                         quit_with_error(ORS_export_error("CONTENT_LENGTH not set"));             
     53                if(!(temp=getenv("CONTENT_LENGTH"))) 
     54                        quit_with_error(ORS_export_error("CONTENT_LENGTH not set")); 
    5555                int len=atoi(temp); 
    5656                indata=new char[len+1]; 
    5757                indata[len]=0; 
    5858                fread(indata,len,1,stdin); 
    59         }  
    60         else quit_with_error(ORS_export_error("Unknown REQUEST_METHOD: %s",request_method));             
     59        } 
     60        else quit_with_error(ORS_export_error("Unknown REQUEST_METHOD: %s",request_method)); 
    6161 
    6262        char *pos1, *pos2; 
    63         int i;  
     63        int i; 
    6464 
    6565        int ands    = ORS_str_char_count(indata, '&'); // number of '&' 
     
    7474                ors_gl.cgi_vars[i] = pos1; 
    7575        } 
    76          
    77         // transform path_info into cgi string array (appending)  
    78         // take only: /taken/taken/dismissed  
     76 
     77        // transform path_info into cgi string array (appending) 
     78        // take only: /taken/taken/dismissed 
    7979        for (pos1 = ors_gl.path_info + 1; pos1; pos1=pos2, i++) { 
    8080                pos2 = strchr(pos1,'/'); 
     
    9696                        switch(*pos1) { 
    9797                                case '+': c=' '; pos1++; break; 
    98                                 case '%': hex[2]=*(pos1+1); hex[3]=*(pos1+2); hex[4]=0;  
     98                                case '%': hex[2]=*(pos1+1); hex[3]=*(pos1+2); hex[4]=0; 
    9999                                          pos1+=3; 
    100100                                          sscanf(hex, "%i", &h); 
     
    126126                len=strlen(name); 
    127127                if (!pos2) pos2 = name + len; 
    128          
     128 
    129129                for (i=0; ors_gl.cgi_vars[i]; i++) { 
    130130                        if (!strncasecmp(ors_gl.cgi_vars[i],pos,pos2-pos) && ors_gl.cgi_vars[i][pos2-pos] == '=' 
     
    154154                len=strlen(name); 
    155155                if (!pos2) pos2 = name + len; 
    156          
     156 
    157157                for (i=0; ors_gl.cgi_vars[i]; i++) { 
    158158                        if (!strncasecmp(ors_gl.cgi_vars[i],pos,pos2-pos) && ors_gl.cgi_vars[i][pos2-pos] == '=') { 
     
    262262 
    263263int main(int /*argc*/, char **/*argv*/) { 
    264    
     264 
    265265        char *debug_command; 
    266266        char *html_new; 
     
    287287 
    288288        init_server_communication(); 
    289          
     289 
    290290        if (!JAVA) { // Debug-Mode: Output Variables 
    291291                if (ors_gl.debug) {print_content_lines("ANFANG"); } 
     
    305305        else OC_dailypw_2_userpath(); 
    306306 
    307         if (ors_gl.userpath == NULL || *(ors_gl.userpath) == 0 ||  
     307        if (ors_gl.userpath == NULL || *(ors_gl.userpath) == 0 || 
    308308            ors_gl.dailypw  == NULL || *(ors_gl.dailypw)  == 0) { 
    309309                ors_gl.userpath="";  // no admin functionality in html output! 
     
    372372                ors_gl.password         = cgi_var("password");          //! password, entered by user (login, preferences) 
    373373                password2               = cgi_var("password2");         //! reentered password (must be equal) 
    374                 if (     (!*(ors_gl.password) || !*(password2) )  
    375                      && !(!*(ors_gl.password) && !*(password2) ) )  
     374                if (     (!*(ors_gl.password) || !*(password2) ) 
     375                     && !(!*(ors_gl.password) && !*(password2) ) ) 
    376376                                        quit_with_error(ORS_export_error("You have to enter password two times!")); 
    377                 if (ORS_strcmp(ors_gl.password,password2))  
     377                if (ORS_strcmp(ors_gl.password,password2)) 
    378378                                        quit_with_error(ORS_export_error("Reentered password differs!")); 
    379379                work_on_user(); 
     
    401401                ors_gl.sel_password = cgi_var("sel_password");                  //! password, entered for sel_user (create/modify sel_user) 
    402402                password2           = cgi_var("sel_password2");                 //! reentered password (must be equal to password) 
    403                 if (*(ors_gl.sel_password) && *(password2) && strcmp(ors_gl.sel_password,password2))  
     403                if (*(ors_gl.sel_password) && *(password2) && strcmp(ors_gl.sel_password,password2)) 
    404404                        quit_with_error(ORS_export_error("Reentered password differs!")); 
    405405 
     
    440440                if (*ors_gl.sequence)   OC_normalize_seq(ors_gl.sequence, ors_gl.allowed_bases); 
    441441                if (*ors_gl.target_seq) OC_normalize_seq(ors_gl.target_seq, ors_gl.allowed_bases); 
    442                 if (*ors_gl.sequence && *ors_gl.target_seq && !ORS_seq_matches_target_seq(ors_gl.sequence, ors_gl.target_seq, 1))  
     442                if (*ors_gl.sequence && *ors_gl.target_seq && !ORS_seq_matches_target_seq(ors_gl.sequence, ors_gl.target_seq, 1)) 
    443443                        quit_with_error("Sequence and target sequence do not match! Just enter one field, the other is being calculated."); 
    444444 
     
    451451                        OC_send_pdb_fields_to_server("entered");        // send the sequence to probedb server 
    452452                        ors_gl.list_of_probes = OC_probe_query(100);    // and look for equal seqs 
    453          
     453 
    454454                        if (ors_gl.list_of_probes && *ors_gl.list_of_probes) { 
    455455                                OC_output_html_page("probe_seq_exists");        //! show probes with equal sequence information 
     
    630630                subject = cgi_var("subject");           //! subject of mail message 
    631631                body    = cgi_var("body");              //! body of mail message 
    632                  
     632 
    633633                // TODO: mail verschicken 
    634634 
  • trunk/ORS_CGI/ORS_C_probe.cxx

    r2 r655  
    1 /*  
     1/* 
    22################################# 
    33#                               # 
     
    1010#include <stdlib.h> 
    1111#include <memory.h> 
    12 #include <malloc.h> 
     12// #include <malloc.h> 
    1313#include <string.h> 
    1414#include <arbdb.h> 
     
    2828void OC_save_probedb(void) { 
    2929 
    30         char *locs_error = 0;  
    31  
    32         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    33                 LOCAL_DAILYPW,          ors_gl.dailypw,  
     30        char *locs_error = 0; 
     31 
     32        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     33                LOCAL_DAILYPW,          ors_gl.dailypw, 
    3434                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    35                 LOCAL_SAVE_PROBEDB,     "",  
    36                 NULL)) { 
    37                 quit_with_error(ORS_export_error("Server communication failed (save_probedb)"));  
    38         } 
    39  
    40         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     35                LOCAL_SAVE_PROBEDB,     "", 
     36                NULL)) { 
     37                quit_with_error(ORS_export_error("Server communication failed (save_probedb)")); 
     38        } 
     39 
     40        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    4141                LOCAL_ERROR       , &locs_error, 
    4242                NULL)) { 
    43                 quit_with_error(ORS_export_error("Server communication failed (save_probedb2)"));  
     43                quit_with_error(ORS_export_error("Server communication failed (save_probedb2)")); 
    4444        } 
    4545        OC_server_error_if_not_empty(locs_error); 
     
    5252void OC_put_probe_field(char *field_section, char *field_name, char *field_data) { 
    5353 
    54         char *locs_error = 0;  
     54        char *locs_error = 0; 
    5555        static bytestring bs = {0,0}; 
    5656        delete bs.data; 
     
    6666 
    6767        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    68                 LOCAL_PROBE_FIELD_DATA,         bs,  
    69                 LOCAL_PROBE_FIELD_SECTION,      field_section,  
    70                 LOCAL_PUT_PROBE_FIELD,          field_name,  
    71                 NULL)) { 
    72                 quit_with_error(ORS_export_error("Server communication failed (put_probe_field:%s/%s)",field_section,field_name));  
    73         } 
    74  
    75         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     68                LOCAL_PROBE_FIELD_DATA,         bs, 
     69                LOCAL_PROBE_FIELD_SECTION,      field_section, 
     70                LOCAL_PUT_PROBE_FIELD,          field_name, 
     71                NULL)) { 
     72                quit_with_error(ORS_export_error("Server communication failed (put_probe_field:%s/%s)",field_section,field_name)); 
     73        } 
     74 
     75        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    7676                LOCAL_ERROR       , &locs_error, 
    7777                NULL)) { 
    78                 quit_with_error(ORS_export_error("Server communication failed (put_probe_field2:%s/%s)",field_section,field_name));  
     78                quit_with_error(ORS_export_error("Server communication failed (put_probe_field2:%s/%s)",field_section,field_name)); 
    7979        } 
    8080        OC_server_error_if_not_empty(locs_error); 
     
    8686void OC_put_probe_ta_id(int ta_id) { 
    8787 
    88         char *locs_error = 0;  
    89  
    90         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    91                 LOCAL_PROBE_TA_ID,      ta_id,  
    92                 NULL)) { 
    93                 quit_with_error(ORS_export_error("Server communication failed (put_probe_ta_id)"));  
    94         } 
    95  
    96         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     88        char *locs_error = 0; 
     89 
     90        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     91                LOCAL_PROBE_TA_ID,      ta_id, 
     92                NULL)) { 
     93                quit_with_error(ORS_export_error("Server communication failed (put_probe_ta_id)")); 
     94        } 
     95 
     96        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    9797                LOCAL_ERROR       , &locs_error, 
    9898                NULL)) { 
    99                 quit_with_error(ORS_export_error("Server communication failed (put_probe_ta_id2)"));  
     99                quit_with_error(ORS_export_error("Server communication failed (put_probe_ta_id2)")); 
    100100        } 
    101101        OC_server_error_if_not_empty(locs_error); 
     
    108108char *OC_get_probe_field(char *field_section, char *field_name) { 
    109109 
    110         char *locs_error = 0;  
     110        char *locs_error = 0; 
    111111        char *field_data; 
    112112        static bytestring bs = {0,0}; 
     
    117117 
    118118        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    119                 LOCAL_PROBE_FIELD_SECTION,      field_section,  
    120                 LOCAL_PROBE_FIELD_NAME,         field_name,  
    121                 NULL)) { 
    122                 quit_with_error(ORS_export_error("Server communication failed (get_probe_field:%s/%s)",field_section,field_name));  
    123         } 
    124  
    125         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     119                LOCAL_PROBE_FIELD_SECTION,      field_section, 
     120                LOCAL_PROBE_FIELD_NAME,         field_name, 
     121                NULL)) { 
     122                quit_with_error(ORS_export_error("Server communication failed (get_probe_field:%s/%s)",field_section,field_name)); 
     123        } 
     124 
     125        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    126126                LOCAL_ERROR,                    &locs_error, 
    127                 LOCAL_GET_PROBE_FIELD,          &bs,  
    128                 NULL)) { 
    129                 quit_with_error(ORS_export_error("Server communication failed (get_probe_field2:%s/%s)",field_section,field_name));  
     127                LOCAL_GET_PROBE_FIELD,          &bs, 
     128                NULL)) { 
     129                quit_with_error(ORS_export_error("Server communication failed (get_probe_field2:%s/%s)",field_section,field_name)); 
    130130        } 
    131131        OC_server_error_if_not_empty(locs_error); 
     
    139139int OC_get_probe_ta_id(void) { 
    140140 
    141         char *locs_error = 0;  
     141        char *locs_error = 0; 
    142142        int field_data; 
    143143 
    144         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     144        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    145145                LOCAL_ERROR,                    &locs_error, 
    146                 LOCAL_PROBE_TA_ID,              &field_data,  
    147                 NULL)) { 
    148                 quit_with_error(ORS_export_error("Server communication failed (get_probe_ta_id)"));  
     146                LOCAL_PROBE_TA_ID,              &field_data, 
     147                NULL)) { 
     148                quit_with_error(ORS_export_error("Server communication failed (get_probe_ta_id)")); 
    149149        } 
    150150        OC_server_error_if_not_empty(locs_error); 
     
    158158void OC_work_on_probe(char *action) { 
    159159 
    160         char *locs_error = 0;  
    161         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    162                 LOCAL_DAILYPW,          ors_gl.dailypw,  
     160        char *locs_error = 0; 
     161        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     162                LOCAL_DAILYPW,          ors_gl.dailypw, 
    163163                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    164                 LOCAL_WORK_ON_PROBE,            action,  
    165                 NULL)) { 
    166                 quit_with_error(ORS_export_error("Server communication failed (work_on_probe:%s)",action));  
    167         } 
    168  
    169         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     164                LOCAL_WORK_ON_PROBE,            action, 
     165                NULL)) { 
     166                quit_with_error(ORS_export_error("Server communication failed (work_on_probe:%s)",action)); 
     167        } 
     168 
     169        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    170170                LOCAL_ERROR       , &locs_error, 
    171171                NULL)) { 
    172                 quit_with_error(ORS_export_error("Server communication failed (work_on_probe2:%s)",action));  
     172                quit_with_error(ORS_export_error("Server communication failed (work_on_probe2:%s)",action)); 
    173173        } 
    174174        OC_server_error_if_not_empty(locs_error); 
     
    188188void OC_probe_select(char *probe_id ) { 
    189189 
    190         char *locs_error = 0;  
    191         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    192                 LOCAL_DAILYPW,          ors_gl.dailypw,  
     190        char *locs_error = 0; 
     191        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     192                LOCAL_DAILYPW,          ors_gl.dailypw, 
    193193                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    194                 LOCAL_PROBE_SELECT,     probe_id,  
    195                 NULL)) { 
    196                 quit_with_error(ORS_export_error("Server communication failed (select_probe)"));  
    197         } 
    198  
    199         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     194                LOCAL_PROBE_SELECT,     probe_id, 
     195                NULL)) { 
     196                quit_with_error(ORS_export_error("Server communication failed (select_probe)")); 
     197        } 
     198 
     199        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    200200                LOCAL_ERROR, &locs_error, 
    201201                NULL)) { 
    202                 quit_with_error(ORS_export_error("Server communication failed (select_probe2)"));  
     202                quit_with_error(ORS_export_error("Server communication failed (select_probe2)")); 
    203203        } 
    204204        OC_server_error_if_not_empty(locs_error); 
     
    215215        delete result.data; 
    216216 
    217         char *locs_error = 0;  
    218         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    219                 LOCAL_DAILYPW,                  ors_gl.dailypw,  
     217        char *locs_error = 0; 
     218        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     219                LOCAL_DAILYPW,                  ors_gl.dailypw, 
    220220                LOCAL_REMOTE_HOST,              ors_gl.remote_host, 
    221                 LOCAL_PROBE_LIST_TYPE,          10,  
    222                 LOCAL_PROBE_LIST_MAX_COUNT,     max_count,  
    223                 NULL)) { 
    224                 quit_with_error(ORS_export_error("Server communication failed (probe_query)"));  
    225         } 
    226  
    227         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
    228                 LOCAL_PROBE_QUERY,      &result,  
     221                LOCAL_PROBE_LIST_TYPE,          10, 
     222                LOCAL_PROBE_LIST_MAX_COUNT,     max_count, 
     223                NULL)) { 
     224                quit_with_error(ORS_export_error("Server communication failed (probe_query)")); 
     225        } 
     226 
     227        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     228                LOCAL_PROBE_QUERY,      &result, 
    229229                LOCAL_ERROR,            &locs_error, 
    230230                NULL)) { 
    231                 quit_with_error(ORS_export_error("Server communication failed (probe_query2)"));  
     231                quit_with_error(ORS_export_error("Server communication failed (probe_query2)")); 
    232232        } 
    233233        OC_server_error_if_not_empty(locs_error); 
     
    241241char * OC_get_probe_list(int type, int count) { 
    242242 
    243         char *locs_error = 0;  
     243        char *locs_error = 0; 
    244244        static bytestring result = {0,0}; 
    245245        delete result.data; 
    246246 
    247247        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    248                 LOCAL_PROBE_LIST_TYPE,          type,  
    249                 LOCAL_PROBE_LIST_MAX_COUNT,     count,  
    250                 NULL)) { 
    251                 quit_with_error(ORS_export_error("Server communication failed (get_probe_list)"));  
    252         } 
    253  
    254         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     248                LOCAL_PROBE_LIST_TYPE,          type, 
     249                LOCAL_PROBE_LIST_MAX_COUNT,     count, 
     250                NULL)) { 
     251                quit_with_error(ORS_export_error("Server communication failed (get_probe_list)")); 
     252        } 
     253 
     254        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    255255                LOCAL_GET_PROBE_LIST,   &result, 
    256256                LOCAL_ERROR,            &locs_error, 
    257257                NULL)) { 
    258                 quit_with_error(ORS_export_error("Server communication failed (get_probe_list2)"));  
     258                quit_with_error(ORS_export_error("Server communication failed (get_probe_list2)")); 
    259259        } 
    260260        OC_server_error_if_not_empty(locs_error); 
     
    267267*****************************************************************************/ 
    268268OC_pdb_list *OC_create_pdb_list_elem(void) { 
    269          
     269 
    270270        OC_pdb_list *THIS               = (OC_pdb_list *)calloc(sizeof(OC_pdb_list), 1); 
    271271        if(!THIS) quit_with_error(ORS_export_error("Malloc error in OC_create_pdb_list_elem!")); 
    272         return THIS;  
     272        return THIS; 
    273273} 
    274274 
     
    377377                        } 
    378378                        pdb_list_elem = OC_create_pdb_list_elem(); 
    379          
     379 
    380380                        tmp = strtok(buffer,",");       // extract section/name or name 
    381381                        if (strchr(tmp,'/')) { 
     
    414414 
    415415                        // printf("name=%s, type=%s, width=%i <BR>",pdb_list_elem->name, pdb_list_elem->type, pdb_list_elem->width); 
    416          
     416 
    417417                        OC_pdb_list_insert(&ors_gl.pdb_list, pdb_list_elem);    // put element into list 
    418418                } 
     
    425425*****************************************************************************/ 
    426426void OC_clear_pdb_fields_in_server(void) { 
    427         char *locs_error = 0;  
     427        char *locs_error = 0; 
    428428        char *dummy; 
    429429 
    430         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     430        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    431431                LOCAL_CLEAR_PROBE_FIELDS,       &dummy, 
    432432                LOCAL_ERROR,                    &locs_error, 
    433433                NULL)) { 
    434                 quit_with_error(ORS_export_error("Server communication failed (clear_pdb_fields)"));  
     434                quit_with_error(ORS_export_error("Server communication failed (clear_pdb_fields)")); 
    435435        } 
    436436        OC_server_error_if_not_empty(locs_error); 
     
    601601void OC_probe_user_transfer(char *from_userpath, char *to_userpath, char *probe_id) { 
    602602 
    603         char *locs_error = 0;  
    604         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    605                 LOCAL_DAILYPW,                  ors_gl.dailypw,  
     603        char *locs_error = 0; 
     604        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     605                LOCAL_DAILYPW,                  ors_gl.dailypw, 
    606606                LOCAL_REMOTE_HOST,              ors_gl.remote_host, 
    607607                LOCAL_SEL_USERPATH,             from_userpath, 
    608                 LOCAL_PROBE_USER_TRANSFER,      to_userpath,  
    609                 NULL)) { 
    610                 quit_with_error(ORS_export_error("Server communication failed (probe_transfer)"));  
    611         } 
    612  
    613         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     608                LOCAL_PROBE_USER_TRANSFER,      to_userpath, 
     609                NULL)) { 
     610                quit_with_error(ORS_export_error("Server communication failed (probe_transfer)")); 
     611        } 
     612 
     613        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    614614                LOCAL_ERROR, &locs_error, 
    615615                NULL)) { 
    616                 quit_with_error(ORS_export_error("Server communication failed (probe_transfer2)"));  
    617         } 
    618         OC_server_error_if_not_empty(locs_error); 
    619 } 
     616                quit_with_error(ORS_export_error("Server communication failed (probe_transfer2)")); 
     617        } 
     618        OC_server_error_if_not_empty(locs_error); 
     619} 
  • trunk/ORS_CGI/ORS_C_scripts.cxx

    r241 r655  
    22# include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <ctype.h> 
     
    3434 
    3535FILE *ors_tcp_open(char *mach_name, int socket_id) { 
    36          
     36 
    3737        int      so; 
    3838        struct in_addr  addr;   /* union -> u_long  */ 
     
    109109        int i; 
    110110        register int c; 
    111         while ( (c = getc(fd)) != EOF) GBS_chrcat(memfile,c);    
     111        while ( (c = getc(fd)) != EOF) GBS_chrcat(memfile,c); 
    112112        int size = GBS_memoffset(memfile);              // sizeof data 
    113113        char *data = GBS_strclose(memfile,0); 
    114         // ** Now I would like to use perl, instead I have to use this ugly C  
     114        // ** Now I would like to use perl, instead I have to use this ugly C 
    115115        // Lets check the content type first 
    116116        char *nl = strchr(data,'\n'); 
     
    127127        if ( !ORS_strncasecmp(data,"ascii")){ 
    128128                if (!source_is_java)    printf("Content-type: text/plain\n\n%s",nl); 
    129                 else                    printf("A%s",nl);               // write ASCII-TAG + DATA  
     129                else                    printf("A%s",nl);               // write ASCII-TAG + DATA 
    130130                return 0; 
    131131        }else   if ( !ORS_strncasecmp(data,"error")){ 
    132132                if (!source_is_java)    printf("Content-type: text/plain\n\n%s",nl); 
    133                 else                    printf("E%s",nl);               // write ASCII-TAG + DATA        
     133                else                    printf("E%s",nl);               // write ASCII-TAG + DATA 
    134134                return 0; 
    135135        }else   if ( !ORS_strncasecmp(data,"form")){ 
    136136                return ors_form_2_java(nl);     // parse the form that means removing all spaces!! 
    137137        }else   if ( !ORS_strncasecmp(data,"link")){ 
    138                 printf("l%s",nl);               // write ASCII-TAG + DATA  
     138                printf("l%s",nl);               // write ASCII-TAG + DATA 
    139139                return 0; 
    140140        }else   if ( !ORS_strncasecmp(data,"ovp/")){ 
     
    163163                                } 
    164164                                ors_ovp_2_java(data+4,nl,tree,out); 
    165                                 fclose(out);                             
     165                                fclose(out); 
    166166                                printf("Goto the java window and press 'Get last netscape query'\n"); 
    167167                        }else{ 
     
    221221} 
    222222 
    223 GB_ERROR  
     223GB_ERROR 
    224224ORS_C_exec_script(char *tree, char *command) 
    225225{ 
  • trunk/ORS_CGI/ORS_C_user.cxx

    r2 r655  
    1 /*  
     1/* 
    22################################# 
    33#                               # 
     
    1010#include <stdlib.h> 
    1111#include <memory.h> 
    12 #include <malloc.h> 
     12// #include <malloc.h> 
    1313#include <string.h> 
    1414#include <arbdb.h> 
     
    2828void OC_save_userdb(void) { 
    2929 
    30         char *locs_error = 0;  
    31  
    32         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    33                 LOCAL_DAILYPW,          ors_gl.dailypw,  
    34                 LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    35                 LOCAL_SAVE_USERDB,      "",  
    36                 NULL)) { 
    37                 quit_with_error(ORS_export_error("Server communication failed (save_userdb)"));  
    38         } 
    39  
    40         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
    41                 LOCAL_ERROR       , &locs_error, 
    42                 NULL)) { 
    43                 quit_with_error(ORS_export_error("Server communication failed (save_userdb2)"));  
     30        char *locs_error = 0; 
     31 
     32        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     33                LOCAL_DAILYPW,          ors_gl.dailypw, 
     34                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
     35                LOCAL_SAVE_USERDB,      "", 
     36                NULL)) { 
     37                quit_with_error(ORS_export_error("Server communication failed (save_userdb)")); 
     38        } 
     39 
     40        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     41                LOCAL_ERROR       , &locs_error, 
     42                NULL)) { 
     43                quit_with_error(ORS_export_error("Server communication failed (save_userdb2)")); 
    4444        } 
    4545        OC_server_error_if_not_empty(locs_error); 
     
    5252void OC_login_user(char * password) { 
    5353 
    54         char *locs_error = 0;  
     54        char *locs_error = 0; 
    5555        ors_gl.dailypw   = 0;  // server might free variable 
    5656        static char *crypted_pw = 0; 
     
    6060 
    6161        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    62                 LOCAL_USERPATH,         ors_gl.userpath,  
    63                 LOCAL_PASSWORD,         crypted_pw,  
    64                 LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    65                 LOCAL_REMOTE_USER,      ors_gl.remote_user,  
     62                LOCAL_USERPATH,         ors_gl.userpath, 
     63                LOCAL_PASSWORD,         crypted_pw, 
     64                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
     65                LOCAL_REMOTE_USER,      ors_gl.remote_user, 
    6666                LOCAL_DEBUG,            ors_gl.debug, NULL)) { 
    67                 quit_with_error(ORS_export_error("Server communication failed (login_user1)"));  
    68         } 
    69  
    70         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     67                quit_with_error(ORS_export_error("Server communication failed (login_user1)")); 
     68        } 
     69 
     70        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    7171                LOCAL_CALC_DAILYPW,     &ors_gl.dailypw, 
    7272                LOCAL_USERNAME,         &ors_gl.username, 
     
    8484void OC_logout_user(void) { 
    8585 
    86         char *locs_error = 0;  
     86        char *locs_error = 0; 
    8787 
    8888        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    8989                LOCAL_LOGOUT_USER,      ors_gl.dailypw, 
    9090                NULL)) { 
    91                 quit_with_error(ORS_export_error("Server communication failed (logout1)"));  
    92         } 
    93  
    94         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     91                quit_with_error(ORS_export_error("Server communication failed (logout1)")); 
     92        } 
     93 
     94        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    9595                LOCAL_ERROR       , &locs_error, 
    9696                NULL)) { 
     
    108108void OC_dailypw_2_userpath(void) { 
    109109 
    110         char *locs_error = 0;  
    111  
    112         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    113                 LOCAL_DAILYPW,          ors_gl.dailypw,  
    114                 LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    115                 NULL)) { 
    116                 quit_with_error(ORS_export_error("Server communication failed (3)"));  
    117         } 
    118  
    119         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     110        char *locs_error = 0; 
     111 
     112        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     113                LOCAL_DAILYPW,          ors_gl.dailypw, 
     114                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
     115                NULL)) { 
     116                quit_with_error(ORS_export_error("Server communication failed (3)")); 
     117        } 
     118 
     119        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    120120                LOCAL_DAILYPW_2_USERPATH,       &ors_gl.userpath, 
    121121                LOCAL_USERNAME,                 &ors_gl.username, 
     
    134134        } 
    135135        // too many fields (>=16) 
    136         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     136        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    137137                LOCAL_MAX_USER_DEPTH,           &ors_gl.max_user_depth, 
    138138                LOCAL_IS_AUTHOR,                &ors_gl.is_author, 
     
    153153void OC_get_sel_userdata_from_server(void) { 
    154154 
    155         char *locs_error = 0;  
     155        char *locs_error = 0; 
    156156 
    157157        // at creation time there is no sel_userpath 
    158158        // --> we only set init values 
    159         if (!ors_gl.sel_userpath) {  
     159        if (!ors_gl.sel_userpath) { 
    160160                if (ors_gl.sel_user) { 
    161                         if (!ors_gl.sel_par_userpath)  
     161                        if (!ors_gl.sel_par_userpath) 
    162162                                ors_gl.sel_par_userpath = strdup(ors_gl.userpath); 
    163163                        ors_gl.sel_pub_exist_max   = strdup(ors_gl.sel_user); 
     
    168168 
    169169        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    170                 LOCAL_DAILYPW,          ors_gl.dailypw,  
    171                 LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    172                 LOCAL_SEL_USERPATH,     ors_gl.sel_userpath,  
    173                 NULL)) { 
    174                 quit_with_error(ORS_export_error("Server communication failed (dpw2sel_ud1)"));  
    175         } 
    176  
    177         if (aisc_get(ors_gl.link, ORS_LOCAL,    ors_gl.locs,  
     170                LOCAL_DAILYPW,          ors_gl.dailypw, 
     171                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
     172                LOCAL_SEL_USERPATH,     ors_gl.sel_userpath, 
     173                NULL)) { 
     174                quit_with_error(ORS_export_error("Server communication failed (dpw2sel_ud1)")); 
     175        } 
     176 
     177        if (aisc_get(ors_gl.link, ORS_LOCAL,    ors_gl.locs, 
    178178                LOCAL_GET_SEL_USERDATA,         &ors_gl.userpath, 
    179179                // LOCAL_USERNAME,                      &ors_gl.username, 
     
    189189                quit_with_error(ORS_export_error("Server communication failed (dpw2sel_ud2)")); 
    190190        } 
    191         if (aisc_get(ors_gl.link, ORS_LOCAL,    ors_gl.locs,  
     191        if (aisc_get(ors_gl.link, ORS_LOCAL,    ors_gl.locs, 
    192192                LOCAL_SEL_MAX_USERS,            &ors_gl.sel_max_users, 
    193193                LOCAL_SEL_MAX_USER_DEPTH,       &ors_gl.sel_max_user_depth, 
     
    215215                //if (!ors_gl.sel_user || !*ors_gl.sel_user) {  // only calculate sel_user when not read from cgi_var 
    216216                        delete ors_gl.sel_user; 
    217                         if (pos < ors_gl.sel_userpath + strlen(ors_gl.sel_userpath) - 1)  
     217                        if (pos < ors_gl.sel_userpath + strlen(ors_gl.sel_userpath) - 1) 
    218218                                ors_gl.sel_user = strdup(pos + 1); 
    219                         else  
     219                        else 
    220220                                ors_gl.sel_user = strdup(ors_gl.sel_userpath); 
    221221                //} 
     
    237237char * OC_read_user_field(char *sel_userpath, char *fieldname) { 
    238238 
    239         char *locs_error = 0;  
     239        char *locs_error = 0; 
    240240        char *field_data; 
    241241 
    242         if (!sel_userpath)      quit_with_error(ORS_export_error("read_user_field: sel_userpath == (null)"));  
    243  
    244         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    245                 LOCAL_DAILYPW,          ors_gl.dailypw,  
    246                 LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
    247                 LOCAL_SEL_USERPATH,     sel_userpath,  
    248                 LOCAL_FIELDNAME,        fieldname,  
    249                 NULL)) { 
    250                 quit_with_error(ORS_export_error("Server communication failed (10)"));  
    251         } 
    252  
    253         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     242        if (!sel_userpath)      quit_with_error(ORS_export_error("read_user_field: sel_userpath == (null)")); 
     243 
     244        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     245                LOCAL_DAILYPW,          ors_gl.dailypw, 
     246                LOCAL_REMOTE_HOST,      ors_gl.remote_host, 
     247                LOCAL_SEL_USERPATH,     sel_userpath, 
     248                LOCAL_FIELDNAME,        fieldname, 
     249                NULL)) { 
     250                quit_with_error(ORS_export_error("Server communication failed (10)")); 
     251        } 
     252 
     253        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    254254                LOCAL_READ_USER_FIELD, &field_data, 
    255255                LOCAL_ERROR       , &locs_error, 
     
    264264*****************************************************************************/ 
    265265char * list_of_users(char *keyword) { 
    266         char *locs_error = 0;  
     266        char *locs_error = 0; 
    267267        char *list; 
    268268 
    269         if (!ors_gl.userpath)           quit_with_error(ORS_export_error("Userpath not set!!"));  
     269        if (!ors_gl.userpath)           quit_with_error(ORS_export_error("Userpath not set!!")); 
    270270        if (!ors_gl.sel_userpath)       ors_gl.sel_userpath=""; // not needed 
    271         if (!keyword)                   quit_with_error(ORS_export_error("List Type keyword not set!!"));  
    272  
    273         if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    274                 LOCAL_USERPATH,         ors_gl.userpath,  
    275                 LOCAL_SEL_USERPATH,     ors_gl.sel_userpath,  
     271        if (!keyword)                   quit_with_error(ORS_export_error("List Type keyword not set!!")); 
     272 
     273        if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     274                LOCAL_USERPATH,         ors_gl.userpath, 
     275                LOCAL_SEL_USERPATH,     ors_gl.sel_userpath, 
    276276                LOCAL_LIST_TYPE,        keyword, 
    277277                NULL)) { 
    278                 quit_with_error(ORS_export_error("Server communication failed (l_of_su1)"));  
    279         } 
    280  
    281         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     278                quit_with_error(ORS_export_error("Server communication failed (l_of_su1)")); 
     279        } 
     280 
     281        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    282282                LOCAL_LIST_OF_USERS, &list, 
    283283                LOCAL_ERROR,            &locs_error, 
     
    293293void work_on_user(void) { 
    294294        char *locs_error = 0, *dummy=0; 
    295         if (!ors_gl.userpath)           quit_with_error(ORS_export_error("Userpath not set!!"));  
     295        if (!ors_gl.userpath)           quit_with_error(ORS_export_error("Userpath not set!!")); 
    296296 
    297297        static char *crypted_pw = 0; 
     
    312312                LOCAL_WORK_ON_USER,     "", 
    313313                NULL)) { 
    314                 quit_with_error(ORS_export_error("Server communication failed (work_on_user1)"));  
    315         } 
    316  
    317         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     314                quit_with_error(ORS_export_error("Server communication failed (work_on_user1)")); 
     315        } 
     316 
     317        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    318318                LOCAL_ERROR       , &locs_error, 
    319319                 NULL)) { 
     
    334334  char *locs_error = 0, *dummy=0; 
    335335 
    336   if (!ors_gl.userpath)         quit_with_error(ORS_export_error("Userpath not set!!"));  
     336  if (!ors_gl.userpath)         quit_with_error(ORS_export_error("Userpath not set!!")); 
    337337 
    338338  if (!strcasecmp(action,"CREATE") || !strcasecmp(action,"MODIFY")) { 
    339339 
    340         if (!ors_gl.sel_password)       ors_gl.sel_password ="";  
    341         if (!ors_gl.sel_mail_addr)      ors_gl.sel_mail_addr="";  
    342         if (!ors_gl.sel_user_info)      ors_gl.sel_user_info="";  
    343         if (!ors_gl.sel_username)       ors_gl.sel_username ="";  
     340        if (!ors_gl.sel_password)       ors_gl.sel_password =""; 
     341        if (!ors_gl.sel_mail_addr)      ors_gl.sel_mail_addr=""; 
     342        if (!ors_gl.sel_user_info)      ors_gl.sel_user_info=""; 
     343        if (!ors_gl.sel_username)       ors_gl.sel_username =""; 
    344344 
    345345        static char *crypted_pw = 0; 
     
    351351        *********************************************************************/ 
    352352        if (!strcasecmp(action,"CREATE")) { 
    353                 if (!ors_gl.sel_user)           quit_with_error(ORS_export_error("Sel_User not set!!"));  
    354                 if (!ors_gl.sel_par_userpath)   quit_with_error(ORS_export_error("Sel_Par_Userpath not set!!"));  
    355                 if (!*(ors_gl.sel_username))    quit_with_error(ORS_export_error("You must supply a full name."));  
     353                if (!ors_gl.sel_user)           quit_with_error(ORS_export_error("Sel_User not set!!")); 
     354                if (!ors_gl.sel_par_userpath)   quit_with_error(ORS_export_error("Sel_Par_Userpath not set!!")); 
     355                if (!*(ors_gl.sel_username))    quit_with_error(ORS_export_error("You must supply a full name.")); 
    356356                if (!*(ors_gl.sel_password))    quit_with_error(ORS_export_error("You must supply a password!")); 
    357357                if (strlen(ors_gl.sel_password) < PASSWORD_MIN_LENGTH && !ors_gl.is_superuser) 
     
    370370                        LOCAL_SEL_PUB_CONTENT_MAX,ors_gl.sel_pub_content_max, 
    371371                        NULL)) { 
    372                         quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user1)"));  
     372                        quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user1)")); 
    373373                } 
    374374                if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     
    380380                        LOCAL_WORK_ON_SEL_USER, action, 
    381381                        NULL)) { 
    382                         quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user1)"));  
    383                 } 
    384  
    385                 if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     382                        quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user1)")); 
     383                } 
     384 
     385                if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    386386                        LOCAL_ERROR       , &locs_error, 
    387387                        NULL)) { 
     
    395395        *********************************************************************/ 
    396396        else if (!strcasecmp(action,"MODIFY")) { 
    397                 if (!ors_gl.sel_userpath)       quit_with_error(ORS_export_error("Sel_Userpath not set!!"));  
     397                if (!ors_gl.sel_userpath)       quit_with_error(ORS_export_error("Sel_Userpath not set!!")); 
    398398 
    399399                if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     
    410410                        LOCAL_SEL_PUB_CONTENT_MAX,ors_gl.sel_pub_content_max, 
    411411                        NULL)) { 
    412                         quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user5)"));  
     412                        quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user5)")); 
    413413                } 
    414414                if (aisc_nput(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
     
    420420                        LOCAL_WORK_ON_SEL_USER, action, 
    421421                        NULL)) { 
    422                         quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user3)"));  
    423                 } 
    424  
    425                 if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     422                        quit_with_error(ORS_export_error("Server communication failed (work_on_sel_user3)")); 
     423                } 
     424 
     425                if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    426426                        LOCAL_ERROR       , &locs_error, 
    427427                        NULL)) { 
     
    441441                LOCAL_WORK_ON_SEL_USER, action, 
    442442                NULL)) { 
    443                 quit_with_error(ORS_export_error("Server communication failed (work_on_user5)"));  
    444         } 
    445  
    446         if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs,  
     443                quit_with_error(ORS_export_error("Server communication failed (work_on_user5)")); 
     444        } 
     445 
     446        if (aisc_get(ors_gl.link, ORS_LOCAL, ors_gl.locs, 
    447447                LOCAL_ERROR       , &locs_error, 
    448448                 NULL)) { 
  • trunk/ORS_CGI/ORS_lib.cxx

    r2 r655  
    33#include <unistd.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <string.h> 
    77#include <arbdb.h> 
     
    6161        // sprintf (buffer,"ORS ERROR: "); 
    6262        p += strlen(p); 
    63         va_start(parg,templat);  
     63        va_start(parg,templat); 
    6464 
    6565        vsprintf(p,templat,parg); 
     
    7777        va_list parg; 
    7878        p += strlen(p); 
    79         va_start(parg,templat);  
     79        va_start(parg,templat); 
    8080 
    8181        vsprintf(p,templat,parg); 
     
    8888        Time & Date Strings 
    8989                                type determines output format 
    90                                 time = desired time/date value or 0      
     90                                time = desired time/date value or 0 
    9191********************************************************************************/ 
    9292char *ORS_time_and_date_string(int type, long time) { 
     
    133133*******************************************************/ 
    134134int ORS_strncase_tail_cmp(char *str1, char *str2) { 
    135          
     135 
    136136        if (!str1 || !str2) return 1; 
    137137 
     
    143143*******************************************************/ 
    144144int ORS_strncasecmp(char *str1, char *str2) { 
    145          
     145 
    146146        if (!str1 || !str2) return 1; 
    147147 
     
    177177        char    *pos = buffer; 
    178178        int     len; 
    179          
     179 
    180180        if (!word || !buffer) return 0; 
    181181 
     
    184184                pos = strstr(pos, word); 
    185185                if (!pos) break; 
    186                 if ( (pos == buffer || *(pos-1) == seperator) && (*(pos+len) == seperator || *(pos+len) == 0 ) )  
     186                if ( (pos == buffer || *(pos-1) == seperator) && (*(pos+len) == seperator || *(pos+len) == 0 ) ) 
    187187                        return 1;  // found it! 
    188188                pos++; 
     
    276276        while (*pos) { 
    277277                switch(*pos) { 
    278                         case 'G':  
    279                         case 'C':  
     278                        case 'G': 
     279                        case 'C': 
    280280                        case 'S': min++; break; 
    281281                        default: break; 
     
    289289        while (*pos) { 
    290290                switch(*pos) { 
    291                         case 'G':  
    292                         case 'C':  
    293                         case 'M':  
    294                         case 'R':  
    295                         case 'S':  
    296                         case 'Y':  
    297                         case 'K':  
    298                         case 'V':  
    299                         case 'H':  
    300                         case 'D':  
    301                         case 'B':  
    302                         case 'X':  
     291                        case 'G': 
     292                        case 'C': 
     293                        case 'M': 
     294                        case 'R': 
     295                        case 'S': 
     296                        case 'Y': 
     297                        case 'K': 
     298                        case 'V': 
     299                        case 'H': 
     300                        case 'D': 
     301                        case 'B': 
     302                        case 'X': 
    303303                        case 'N': max++; break; 
    304304                        default: break; 
     
    313313 
    314314/****************************************************** 
    315   STRCMP: can compare NULL-pointers!  
     315  STRCMP: can compare NULL-pointers! 
    316316        NULL == NULL 
    317317        NULL == "" 
     
    361361 
    362362        if (!user1 || !*user1 || !user2 || !*user2) return 0; 
    363          
     363 
    364364        if (!strcmp(user1,ROOT_USERPATH)) return 1; // root ist everybody's father 
    365365        int len1=strlen(user1); 
  • trunk/ORS_COM/ORS_lib.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <arbdb.h> 
     
    5959        // sprintf (buffer,"ORS ERROR: "); 
    6060        p += strlen(p); 
    61         va_start(parg,templat);  
     61        va_start(parg,templat); 
    6262 
    6363        vsprintf(p,templat,parg); 
     
    7575        va_list parg; 
    7676        p += strlen(p); 
    77         va_start(parg,templat);  
     77        va_start(parg,templat); 
    7878 
    7979        vsprintf(p,templat,parg); 
     
    8686        Time & Date Strings 
    8787                                type determines output format 
    88                                 time = desired time/date value or 0      
     88                                time = desired time/date value or 0 
    8989********************************************************************************/ 
    9090char *ORS_time_and_date_string(int type, long time) { 
     
    131131*******************************************************/ 
    132132int ORS_strncase_tail_cmp(char *str1, char *str2) { 
    133          
     133 
    134134        if (!str1 || !str2) return 1; 
    135135 
     
    165165        char    *pos = buffer; 
    166166        int     len; 
    167          
     167 
    168168        if (!word || !buffer) return 0; 
    169169 
     
    172172                pos = strstr(pos, word); 
    173173                if (!pos) break; 
    174                 if ( (pos == buffer || *(pos-1) == seperator) && (*(pos+len) == seperator || *(pos+len) == 0 ) )  
     174                if ( (pos == buffer || *(pos-1) == seperator) && (*(pos+len) == seperator || *(pos+len) == 0 ) ) 
    175175                        return 1;  // found it! 
    176176                pos++; 
     
    264264        while (*pos) { 
    265265                switch(*pos) { 
    266                         case 'G':  
    267                         case 'C':  
     266                        case 'G': 
     267                        case 'C': 
    268268                        case 'S': min++; break; 
    269269                        default: break; 
     
    277277        while (*pos) { 
    278278                switch(*pos) { 
    279                         case 'G':  
    280                         case 'C':  
    281                         case 'M':  
    282                         case 'R':  
    283                         case 'S':  
    284                         case 'Y':  
    285                         case 'K':  
    286                         case 'V':  
    287                         case 'H':  
    288                         case 'D':  
    289                         case 'B':  
    290                         case 'X':  
     279                        case 'G': 
     280                        case 'C': 
     281                        case 'M': 
     282                        case 'R': 
     283                        case 'S': 
     284                        case 'Y': 
     285                        case 'K': 
     286                        case 'V': 
     287                        case 'H': 
     288                        case 'D': 
     289                        case 'B': 
     290                        case 'X': 
    291291                        case 'N': max++; break; 
    292292                        default: break; 
     
    301301 
    302302/****************************************************** 
    303   STRCMP: can compare NULL-pointers!  
     303  STRCMP: can compare NULL-pointers! 
    304304        NULL == NULL 
    305305        NULL == "" 
     
    349349 
    350350        if (!user1 || !*user1 || !user2 || !*user2) return 0; 
    351          
     351 
    352352        if (!strcmp(user1,ROOT_USERPATH)) return 1; // root ist everybody's father 
    353353        int len1=strlen(user1); 
  • trunk/ORS_SERVER/ORS_S_probedb.cxx

    r2 r655  
    1 /*  
     1/* 
    22################################# 
    33#                               # 
     
    1212#include <memory.h> 
    1313 
    14 #include <malloc.h> 
     14// #include <malloc.h> 
    1515#include <math.h> 
    1616 
     
    112112  open the probe database 
    113113*************************************************************************************/ 
    114 GB_ERROR OS_open_probedb(void){  
    115  
    116         char *name = ORS_read_a_line_in_a_file(ORS_LIB_PATH "CONFIG","PROBE_DB");   
     114GB_ERROR OS_open_probedb(void){ 
     115 
     116        char *name = ORS_read_a_line_in_a_file(ORS_LIB_PATH "CONFIG","PROBE_DB"); 
    117117        if (!name) ORS_export_error("Missing 'PROBE_DB' in '" ORS_LIB_PATH "CONFIG'"); 
    118118 
     
    273273  WRITE PROBE FIELD INFORMATION into user database WITH EXISTING GB_PROBE 
    274274        a non existing field is being created (if content is not empty) 
    275                                                         return error message or NULL  
     275                                                        return error message or NULL 
    276276                                                        no authorisation here! 
    277277*************************************************************************************/ 
     
    290290/************************************************************************************* 
    291291  READ PROBE FIELD INFORMATION from user database WITH EXISTING GB_PROBE 
    292                                                         return value or NULL  
     292                                                        return value or NULL 
    293293                                                        no authorisation here! 
    294294*************************************************************************************/ 
     
    333333        static char buffer[20]; 
    334334        int next_probe_id; 
    335          
     335 
    336336        GBDATA *gb_id = GB_search(gb_probedb, "next_probe_id", GB_INT);         // creates field if not available 
    337         next_probe_id = GB_read_int(gb_id);      
     337        next_probe_id = GB_read_int(gb_id); 
    338338        GB_write_int(gb_id, ++next_probe_id); 
    339339        sprintf(buffer,"%i", next_probe_id); 
    340          
     340 
    341341        return strdup(buffer); 
    342342} 
     
    412412 
    413413                        gb_probe = GB_get_father(gb_probe_field); 
    414          
     414 
    415415                        // allowed to see existance? 
    416416                        gb_field = GB_find(gb_probe,"p_pub_exist",0,down_level); 
     
    418418                        read_data = GB_read_string(gb_field); 
    419419                        if (!OS_read_access_allowed(locs->userpath, read_data)) continue; 
    420          
     420 
    421421                        struct OS_probe *probe_struct = (struct OS_probe *)calloc(sizeof(struct OS_probe), 1); 
    422422                        probes[num_probes++] = probe_struct; 
    423          
     423 
    424424                        gb_field = GB_find(gb_probe,"probe_id",0,down_level); 
    425425                        if (gb_field) probe_struct->probe_id            = GB_read_string(gb_field); 
    426          
     426 
    427427                        gb_field = GB_find(gb_probe,"p_author_date",0,down_level);              //! creation date of this probe 
    428428                        if (gb_field) probe_struct->author_date         = GB_read_string(gb_field); 
    429          
     429 
    430430                        gb_field = GB_find(gb_probe,"p_probe_name",0,down_level);               //! name of this probe 
    431431                        if (gb_field) probe_struct->probe_name  = GB_read_string(gb_field); 
    432          
    433                         gb_field = GB_find(gb_probe,"p_probe_info",0,down_level);               //! short description of probe           
     432 
     433                        gb_field = GB_find(gb_probe,"p_probe_info",0,down_level);               //! short description of probe 
    434434                        if (gb_field) probe_struct->probe_info  = GB_read_string(gb_field); 
    435435 
     
    470470 
    471471                        gb_probe = GB_get_father(gb_probe_field); 
    472          
     472 
    473473                        // allowed to see existance? 
    474474                        gb_field = GB_find(gb_probe,"p_pub_exist",0,down_level); 
     
    476476                        read_data = GB_read_string(gb_field); 
    477477                        if (!OS_read_access_allowed(locs->userpath, read_data)) continue; 
    478          
     478 
    479479                        struct OS_probe *probe_struct = (struct OS_probe *)calloc(sizeof(struct OS_probe), 1); 
    480480                        probes[num_probes++] = probe_struct; 
     
    482482                        gb_field = GB_find(gb_probe,"probe_id",0,down_level); 
    483483                        if (gb_field) probe_struct->probe_id            = GB_read_string(gb_field); 
    484          
     484 
    485485                        gb_field = GB_find(gb_probe,"p_author",0,down_level);                   //! author of this probe 
    486486                        if (gb_field) probe_struct->author              = GB_read_string(gb_field); 
    487          
     487 
    488488                        gb_field = GB_find(gb_probe,"p_probe_name",0,down_level); 
    489489                        if (gb_field) probe_struct->probe_name  = GB_read_string(gb_field); 
    490          
    491                         gb_field = GB_find(gb_probe,"p_probe_info",0,down_level);                
     490 
     491                        gb_field = GB_find(gb_probe,"p_probe_info",0,down_level); 
    492492                        if (gb_field) probe_struct->probe_info  = GB_read_string(gb_field); 
    493493 
     
    544544                        gb_probe; 
    545545                        gb_probe = GB_find(gb_probe, "probe", 0, this_level | search_next) ) { // search 1 level down but parallel 
    546          
     546 
    547547                        gb_field = GB_find(gb_probe,"p_pub_exist",0,down_level); 
    548548                        delete read_data; 
    549549                        read_data = GB_read_string(gb_field); 
    550550                        if (!OS_read_access_allowed(locs->userpath, read_data)) continue; 
    551          
     551 
    552552                        if (search_any_only) { 
    553553                                found_any=0; 
     
    580580                                if (locs->search_any_field && *locs->search_any_field && !found_any) continue; 
    581581                        } 
    582          
    583          
     582 
     583 
    584584                        struct OS_probe *probe_struct = (struct OS_probe *)calloc(sizeof(struct OS_probe), 1); 
    585585                        probes[num_probes++] = probe_struct; 
    586          
     586 
    587587                        gb_field = GB_find(gb_probe,"probe_id",0,down_level); 
    588588                        if (gb_field) probe_struct->probe_id            = GB_read_string(gb_field); 
    589          
     589 
    590590                        gb_field = GB_find(gb_probe,"p_author",0,down_level);                   //! author of this probe 
    591591                        if (gb_field) probe_struct->author              = GB_read_string(gb_field); 
    592          
     592 
    593593                        gb_field = GB_find(gb_probe,"p_probe_name",0,down_level); 
    594594                        if (gb_field) probe_struct->probe_name  = GB_read_string(gb_field); 
    595          
    596                         gb_field = GB_find(gb_probe,"p_probe_info",0,down_level);                
     595 
     596                        gb_field = GB_find(gb_probe,"p_probe_info",0,down_level); 
    597597                        if (gb_field) probe_struct->probe_info  = GB_read_string(gb_field); 
    598598 
     
    643643*****************************************************************************/ 
    644644//void OS_probe_change_of_userpath(char *old_userpath, char *new_userpath) { 
    645         // TODO: funktion wird gebraucht!        
     645        // TODO: funktion wird gebraucht! 
    646646//} 
    647647 
     
    678678                gb_probe = GB_get_father(gb_probe_id); 
    679679        } 
    680          
     680 
    681681        for (pdb_elem = ors_main->pdb_list; pdb_elem; pdb_elem = OS_next_pdb_list_elem(ors_main->pdb_list, pdb_elem)) { 
    682682                if (!pdb_elem->content) continue; 
     
    716716        GBDATA *gb_probe_id = GB_find(gb_probedb,"probe_id",locs->probe_id,down_2_level); 
    717717        if (!gb_probe_id) return 0; 
    718          
     718 
    719719        GBDATA *gb_probe = GB_get_father(gb_probe_id); 
    720720        //GBDATA *gb_field; 
     
    758758        return total; 
    759759} 
    760          
     760 
    761761/************************************************************ 
    762762  TRANSFER PROBES of one user to another 
     
    779779                        gb_probe_field; 
    780780                        gb_probe_field = GB_find(gb_probe, "p_author", from_userpath, down_level | search_next) ) { // search 1 level down but parallel 
    781          
     781 
    782782                        gb_probe = GB_get_father(gb_probe_field); 
    783783                        OS_write_gb_probe_info_string(gb_probe, "p_author", to_userpath); 
  • trunk/ORS_SERVER/ORS_lib.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <arbdb.h> 
     
    5858        // sprintf (buffer,"ORS ERROR: "); 
    5959        p += strlen(p); 
    60         va_start(parg,templat);  
     60        va_start(parg,templat); 
    6161 
    6262        vsprintf(p,templat,parg); 
     
    7474        va_list parg; 
    7575        p += strlen(p); 
    76         va_start(parg,templat);  
     76        va_start(parg,templat); 
    7777 
    7878        vsprintf(p,templat,parg); 
     
    8585        Time & Date Strings 
    8686                                type determines output format 
    87                                 time = desired time/date value or 0      
     87                                time = desired time/date value or 0 
    8888********************************************************************************/ 
    8989char *ORS_time_and_date_string(int type, long time) { 
     
    130130*******************************************************/ 
    131131int ORS_strncase_tail_cmp(char *str1, char *str2) { 
    132          
     132 
    133133        if (!str1 || !str2) return 1; 
    134134 
     
    164164        char    *pos = buffer; 
    165165        int     len; 
    166          
     166 
    167167        if (!word || !buffer) return 0; 
    168168 
     
    171171                pos = strstr(pos, word); 
    172172                if (!pos) break; 
    173                 if ( (pos == buffer || *(pos-1) == seperator) && (*(pos+len) == seperator || *(pos+len) == 0 ) )  
     173                if ( (pos == buffer || *(pos-1) == seperator) && (*(pos+len) == seperator || *(pos+len) == 0 ) ) 
    174174                        return 1;  // found it! 
    175175                pos++; 
     
    263263        while (*pos) { 
    264264                switch(*pos) { 
    265                         case 'G':  
    266                         case 'C':  
     265                        case 'G': 
     266                        case 'C': 
    267267                        case 'S': min++; break; 
    268268                        default: break; 
     
    276276        while (*pos) { 
    277277                switch(*pos) { 
    278                         case 'G':  
    279                         case 'C':  
    280                         case 'M':  
    281                         case 'R':  
    282                         case 'S':  
    283                         case 'Y':  
    284                         case 'K':  
    285                         case 'V':  
    286                         case 'H':  
    287                         case 'D':  
    288                         case 'B':  
    289                         case 'X':  
     278                        case 'G': 
     279                        case 'C': 
     280                        case 'M': 
     281                        case 'R': 
     282                        case 'S': 
     283                        case 'Y': 
     284                        case 'K': 
     285                        case 'V': 
     286                        case 'H': 
     287                        case 'D': 
     288                        case 'B': 
     289                        case 'X': 
    290290                        case 'N': max++; break; 
    291291                        default: break; 
     
    300300 
    301301/****************************************************** 
    302   STRCMP: can compare NULL-pointers!  
     302  STRCMP: can compare NULL-pointers! 
    303303        NULL == NULL 
    304304        NULL == "" 
     
    348348 
    349349        if (!user1 || !*user1 || !user2 || !*user2) return 0; 
    350          
     350 
    351351        if (!strcmp(user1,ROOT_USERPATH)) return 1; // root ist everybody's father 
    352352        int len1=strlen(user1); 
  • trunk/PARSIMONY/AP_main.cxx

    r2 r655  
    11#include <stdio.h> 
    22#include <iostream.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <memory.h> 
    55#include <math.h> 
     
    1414 
    1515/********************************************* 
    16 AP_ERR  
     16AP_ERR 
    1717*************************/ 
    1818 
     
    5353 
    5454AP_ERR::AP_ERR (const char *pntr, const int core) 
    55     // setzt den Fehlertext  
    56     // bricht ab  
     55    // setzt den Fehlertext 
     56    // bricht ab 
    5757{ 
    5858    text = pntr; 
     
    8585    if (stack) delete stack; 
    8686} 
    87                          
     87 
    8888char *AP_main::open(char *db_server) 
    8989{ 
     
    9393    if (!gb_main) return (char *)GB_get_error(); 
    9494    if (error) return error; 
    95          
     95 
    9696    return 0; 
    9797} 
     
    111111    return; 
    112112} 
    113          
     113 
    114114void AP_main::push(void) { 
    115115    // if count > 1 the nodes are buffered more than once 
     
    129129        return; 
    130130    } 
    131     while ( (knoten = stack->pop()) ) {                  
     131    while ( (knoten = stack->pop()) ) { 
    132132        if (stack_level != knoten->stack_level) { 
    133133            GB_internal_error("AP_main::pop","Error in stack_level"); 
     
    146146        user_push_counter = 0; 
    147147    } 
    148     return;      
    149 }        
     148    return; 
     149} 
    150150 
    151151void AP_main::clear(void) { 
    152152    // removes count elements from the list 
    153153    // because the current tree is used 
    154     //  
     154    // 
    155155    // if stack_counter greater than last user_push then 
    156156    // moves all not previous buffered nodes in the 
     
    190190            new AP_ERR("AP_main::clear"); 
    191191        } 
    192     }            
     192    } 
    193193    stack_level --; 
    194194    if (stack) user_push_counter = stack->last_user_buffer; 
     
    196196 
    197197} 
    198                  
     198 
    199199void AP_main::push_node(AP_tree * node,AP_STACK_MODE mode) { 
    200200    // 
    201     //  stores node  
    202     //  
     201    //  stores node 
     202    // 
    203203    if (!stack) { 
    204204        if (mode & SEQUENCE)    node->unhash_sequence(); 
     
    214214} 
    215215 
    216          
     216 
    217217void AP_main::set_tree_root(AP_tree *new_root) { 
    218218    // removes old root and sets it 
  • trunk/PARSIMONY/AP_tree_nlen.cxx

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2#include <stdlib.h> 
     3// #include <malloc.h> 
    34#include <string.h> 
    45#include <iostream.h> 
     
    3334    kernighan = AP_NONE; 
    3435    sequence  = NULL; 
    35      
     36 
    3637    edge[0] = edge[1] = edge[2] = NULL; 
    3738        index[0] = index[1] = index[2] = 0; 
    38     distance = INT_MAX;          
    39      
    40 //    cout << "AP_tree_nlen-constructor\n";  
     39    distance = INT_MAX; 
     40 
     41//    cout << "AP_tree_nlen-constructor\n"; 
    4142} 
    4243 
    4344AP_tree_nlen::~AP_tree_nlen(void) 
    4445{ 
    45      
     46 
    4647    //cout << "AP_tree_nlen - destructor " << counter++ << '\n'; 
    47      
     48 
    4849} 
    4950 
     
    5657{ 
    5758    AP_UPDATE_FLAGS res = this->AP_tree::check_update(); 
    58      
     59 
    5960    if (res == AP_UPDATE_RELOADED) 
    6061    { 
     
    6263        return AP_UPDATE_OK; 
    6364    } 
    64      
     65 
    6566    return res; 
    6667} 
    6768 
    68 void AP_tree_nlen::copy(AP_tree_nlen *tree)  
     69void AP_tree_nlen::copy(AP_tree_nlen *tree) 
    6970{ 
    7071    // like = operator 
    7172    // but copies sequence if is leaf 
    72      
     73 
    7374    this->is_leaf = tree->is_leaf; 
    7475    this->leftlen = tree->leftlen; 
    7576    this->rightlen = tree->rightlen; 
    7677    this->gb_node = tree->gb_node; 
    77      
    78     if(tree->name != NULL)  
     78 
     79    if(tree->name != NULL) 
    7980    { 
    8081        this->name = strdup(tree->name); 
    8182    } 
    82     else  
     83    else 
    8384    { 
    8485        this->name = NULL; 
    8586    } 
    86      
    87     if (is_leaf == AP_TRUE)  
    88     { 
    89         if (tree->sequence)  
     87 
     88    if (is_leaf == AP_TRUE) 
     89    { 
     90        if (tree->sequence) 
    9091        { 
    9192            this->sequence = tree->sequence; 
    92         }  
    93         else  
     93        } 
     94        else 
    9495        { 
    9596            cout << "empty sequence at leaf"; 
     
    102103{ 
    103104    //    return out << " (" << (const void*)(&node) << '=' << node.fullname() << ") "; 
    104      
     105 
    105106    static int notTooDeep; 
    106      
    107     out << ' ';  
    108      
     107 
     108    out << ' '; 
     109 
    109110    if (&node==NULL) 
    110111    { 
    111         out << "NULL";  
     112        out << "NULL"; 
    112113    } 
    113114    if (node.is_leaf) 
     
    115116        out << ((void *)&node) << '(' << node.name << ')'; 
    116117    } 
    117     else  
     118    else 
    118119    { 
    119120        if (notTooDeep) 
    120121        { 
    121122            out << ((void *)&node); 
    122             if (!node.father) out << " (ROOT)";  
     123            if (!node.father) out << " (ROOT)"; 
    123124        } 
    124125        else 
    125126        { 
    126             notTooDeep = 1;  
    127              
    128             out << "NODE(" << ((void *)&node);  
    129              
     127            notTooDeep = 1; 
     128 
     129            out << "NODE(" << ((void *)&node); 
     130 
    130131            if (!node.father) 
    131132            { 
    132                 out << " (ROOT)";  
     133                out << " (ROOT)"; 
    133134            } 
    134135            else 
    135136            { 
    136                 out << ", father=" << node.father;  
    137             } 
    138              
    139             out << ", leftson=" << node.leftson  
    140             << ", rightson=" << node.rightson  
     137                out << ", father=" << node.father; 
     138            } 
     139 
     140            out << ", leftson=" << node.leftson 
     141            << ", rightson=" << node.rightson 
    141142            << ", edge[0]=" << *(node.edge[0]) 
    142143            << ", edge[1]=" << *(node.edge[1]) 
     
    147148        } 
    148149    } 
    149      
    150     return out << ' ';  
     150 
     151    return out << ' '; 
    151152} 
    152153 
     
    165166int AP_tree_nlen::unusedEdge() const 
    166167{ 
    167     int e;  
    168      
    169     for (e=0; e<3; e++) if (edge[e]==NULL) return e;  
    170      
     168    int e; 
     169 
     170    for (e=0; e<3; e++) if (edge[e]==NULL) return e; 
     171 
    171172    cout << "No unused edge found at" << *this << '\n'; 
    172     return -1;  
     173    return -1; 
    173174} 
    174175 
    175176AP_tree_edge* AP_tree_nlen::edgeTo(const AP_tree_nlen *neighbour) const 
    176177{ 
    177     int e;  
    178      
     178    int e; 
     179 
    179180    for (e=0; e<3; e++) 
    180181    { 
    181         if (edge[e]!=NULL && edge[e]->node[1-index[e]]==neighbour)  
     182        if (edge[e]!=NULL && edge[e]->node[1-index[e]]==neighbour) 
    182183        { 
    183184            return edge[e]; 
    184         }     
     185        } 
    185186    } 
    186187    GB_CORE; 
    187188    cout << "AP_tree_nlen::edgeTo: " << *this << "\nhas no edge to " << *neighbour << '\n'; 
    188     return NULL;  
     189    return NULL; 
    189190} 
    190191 
     
    200201void AP_tree_nlen::unlinkAllEdges(AP_tree_edge **edgePtr1, AP_tree_edge **edgePtr2, AP_tree_edge **edgePtr3) 
    201202{ 
    202     assert(edge[0]!=NULL);  
    203     assert(edge[1]!=NULL);  
    204     assert(edge[2]!=NULL);  
    205      
    206     *edgePtr1 = edge[0]->unlink();  
    207     *edgePtr2 = edge[1]->unlink();  
    208     *edgePtr3 = edge[2]->unlink();  
     203    assert(edge[0]!=NULL); 
     204    assert(edge[1]!=NULL); 
     205    assert(edge[2]!=NULL); 
     206 
     207    *edgePtr1 = edge[0]->unlink(); 
     208    *edgePtr2 = edge[1]->unlink(); 
     209    *edgePtr3 = edge[2]->unlink(); 
    209210} 
    210211 
    211212void AP_tree_nlen::linkAllEdges(AP_tree_edge *edge1, AP_tree_edge *edge2, AP_tree_edge *edge3) 
    212213{ 
    213     assert(edge[0]==NULL);  
    214     assert(edge[1]==NULL);  
    215     assert(edge[2]==NULL);  
    216      
    217     edge1->relink(this,Father()->Father() ? Father() : Brother());  
    218     edge2->relink(this,Leftson());  
    219     edge3->relink(this,Rightson());  
     214    assert(edge[0]==NULL); 
     215    assert(edge[1]==NULL); 
     216    assert(edge[2]==NULL); 
     217 
     218    edge1->relink(this,Father()->Father() ? Father() : Brother()); 
     219    edge2->relink(this,Leftson()); 
     220    edge3->relink(this,Rightson()); 
    220221} 
    221222 
     
    243244    // 
    244245    // 
    245      
     246 
    246247    AP_tree             *pntr; 
    247248    GB_ERROR error = 0; 
    248     AP_tree_nlen        *newBrother = (AP_tree_nlen*)new_brother;  
     249    AP_tree_nlen        *newBrother = (AP_tree_nlen*)new_brother; 
    249250    AP_tree_edge        *oldEdge; 
    250      
    251 //    cout << "insert " << *this << "\nto new_brother " << *newBrother << '\n';  
    252      
     251 
     252//    cout << "insert " << *this << "\nto new_brother " << *newBrother << '\n'; 
     253 
    253254//    for (pntr = new_brother->father; pntr; pntr = pntr->father) 
    254255//    { 
     
    258259//    if (new_brother->father) ap_main->push_node(new_brother->father, BOTH); 
    259260//    ap_main->push_node(new_brother, STRUCTURE); 
    260      
    261     ap_main->push_node(new_brother, STRUCTURE);  
     261 
     262    ap_main->push_node(new_brother, STRUCTURE); 
    262263 
    263264    if (new_brother->father) 
    264265    { 
    265         ap_main->push_node(new_brother->father, BOTH);  
     266        ap_main->push_node(new_brother->father, BOTH); 
    266267        for (pntr = new_brother->father->father; pntr; pntr = pntr->father) 
    267268        { 
    268             ap_main->push_node(pntr, SEQUENCE);  
    269         } 
    270          
     269            ap_main->push_node(pntr, SEQUENCE); 
     270        } 
     271 
    271272        if (new_brother->father->father) 
    272273        { 
    273274            oldEdge = newBrother->edgeTo(newBrother->Father())->unlink(); 
    274275            error = this->AP_tree::insert(new_brother); 
    275             oldEdge->relink(Father(),Father()->Father());  
     276            oldEdge->relink(Father(),Father()->Father()); 
    276277        } 
    277278        else    // insert to son of root 
     
    281282            oldEdge->relink(Father(),Father()->Brother()); 
    282283        } 
    283          
     284 
    284285        new AP_tree_edge(this,Father()); 
    285286        new AP_tree_edge(Father(),newBrother); 
     
    288289    { 
    289290        AP_tree_nlen    *lson = newBrother->Leftson(), 
    290                         *rson = newBrother->Rightson();  
    291          
    292         ap_main->push_node(lson, STRUCTURE);  
     291                        *rson = newBrother->Rightson(); 
     292 
     293        ap_main->push_node(lson, STRUCTURE); 
    293294        ap_main->push_node(rson, STRUCTURE); 
    294          
    295         oldEdge = lson->edgeTo(rson)->unlink();  
    296         cout << "old Edge = " << oldEdge << '\n';  
    297          
     295 
     296        oldEdge = lson->edgeTo(rson)->unlink(); 
     297        cout << "old Edge = " << oldEdge << '\n'; 
     298 
    298299        error = this->AP_tree::insert(new_brother); 
    299          
     300 
    300301        oldEdge->relink(this,newBrother); 
    301         new AP_tree_edge(newBrother,rson);  
     302        new AP_tree_edge(newBrother,rson); 
    302303        new AP_tree_edge(newBrother,lson); 
    303304    } 
    304      
     305 
    305306    return error; 
    306307} 
     
    311312// 
    312313// Removes the node and its father from the tree: 
    313 //  
     314// 
    314315//           grandpa                            grandpa 
    315316//           /                                    / 
     
    321322// 
    322323// One of the edges is relinked between brother and grandpa. 
    323 // The other two edges are lost. This is not very relevant in respect to  
    324 // memory usage because very few remove()s are really performed - the majority  
     324// The other two edges are lost. This is not very relevant in respect to 
     325// memory usage because very few remove()s are really performed - the majority 
    325326// is undone by a pop(). 
    326 // In the last case the two unlinked edges will be re-used, cause their  
     327// In the last case the two unlinked edges will be re-used, cause their 
    327328// memory location was stored in the tree-stack. 
    328329// 
     
    330331    GB_ERROR error = 0; 
    331332    AP_tree             *pntr; 
    332     AP_tree_edge        *oldEdge;  
    333     AP_tree_nlen        *oldBrother = Brother();  
    334      
    335      
    336     if (father == 0)  
     333    AP_tree_edge        *oldEdge; 
     334    AP_tree_nlen        *oldBrother = Brother(); 
     335 
     336 
     337    if (father == 0) 
    337338    { 
    338339        return (char *)GB_export_error("AP_tree_nlen::remove(void) Tried to remove ROOT "); 
    339340    } 
    340      
     341 
    341342    ap_main->push_node(this, STRUCTURE); 
    342343    ap_main->push_node(brother(), STRUCTURE); 
    343      
     344 
    344345    for (pntr = father->father; pntr; pntr = pntr->father) 
    345346    { 
    346347        ap_main->push_node(pntr, SEQUENCE); 
    347348    } 
    348      
     349 
    349350    if (father->father) 
    350351    { 
    351         AP_tree_nlen *grandPa = Father()->Father();  
    352          
     352        AP_tree_nlen *grandPa = Father()->Father(); 
     353 
    353354        ap_main->push_node(father, BOTH); 
    354355        ap_main->push_node(grandPa, STRUCTURE); 
    355          
    356         edgeTo(Father())->unlink();  
    357         Father()->edgeTo(oldBrother)->unlink();  
    358          
     356 
     357        edgeTo(Father())->unlink(); 
     358        Father()->edgeTo(oldBrother)->unlink(); 
     359 
    359360        if (grandPa->father) 
    360361        { 
    361             oldEdge = Father()->edgeTo(grandPa)->unlink();  
     362            oldEdge = Father()->edgeTo(grandPa)->unlink(); 
    362363            error = this->AP_tree::remove(); 
    363             oldEdge->relink(oldBrother,grandPa);  
     364            oldEdge->relink(oldBrother,grandPa); 
    364365        } 
    365366        else    // remove grandson of root 
    366367        { 
    367             AP_tree_nlen *uncle = Father()->Brother();  
    368             ap_main->push_node(uncle,STRUCTURE);  
    369              
    370             oldEdge = Father()->edgeTo(uncle)->unlink();  
     368            AP_tree_nlen *uncle = Father()->Brother(); 
     369            ap_main->push_node(uncle,STRUCTURE); 
     370 
     371            oldEdge = Father()->edgeTo(uncle)->unlink(); 
    371372            error = this->AP_tree::remove(); 
    372             oldEdge->relink(oldBrother,uncle);  
    373         } 
    374     }  
     373            oldEdge->relink(oldBrother,uncle); 
     374        } 
     375    } 
    375376    else        // remove son of root 
    376377    { 
    377         AP_tree_nlen *lson = Brother()->Leftson();  
     378        AP_tree_nlen *lson = Brother()->Leftson(); 
    378379        AP_tree_nlen *rson = Brother()->Rightson(); 
    379          
    380         ap_main->push_node(lson,STRUCTURE);  
    381         ap_main->push_node(rson,STRUCTURE);  
     380 
     381        ap_main->push_node(lson,STRUCTURE); 
     382        ap_main->push_node(rson,STRUCTURE); 
    382383        ap_main->push_node(father, ROOT); 
    383          
     384 
    384385        ap_main->set_tree_root(oldBrother); 
    385          
    386 //      delete edgeTo(oldBrother);  
     386 
     387//      delete edgeTo(oldBrother); 
    387388        oldBrother->edgeTo(lson)->unlink(); 
    388 //      delete oldBrother->edgeTo(lson);  
    389         oldEdge = oldBrother->edgeTo(rson)->unlink();  
     389//      delete oldBrother->edgeTo(lson); 
     390        oldEdge = oldBrother->edgeTo(rson)->unlink(); 
    390391        error = this->AP_tree::remove(); 
    391         oldEdge->relink(lson,rson);  
    392     } 
    393      
     392        oldEdge->relink(lson,rson); 
     393    } 
     394 
    394395    return error; 
    395396} 
     
    402403    // mode AP_LEFT exchanges leftson with brother 
    403404    // mode AP_RIGHT exchanges rightson with brother 
    404      
     405 
    405406    AP_tree *pntr; 
    406     AP_tree_nlen *oldBrother, *movedSon;  
    407     GB_ERROR error = 0;  
    408     AP_tree_edge *edge1, *edge2;  
    409      
     407    AP_tree_nlen *oldBrother, *movedSon; 
     408    GB_ERROR error = 0; 
     409    AP_tree_edge *edge1, *edge2; 
     410 
    410411//    cout << "swap" << *this << '\n'; 
    411      
     412 
    412413    if (is_leaf == AP_TRUE)     return AP_tree::swap_assymetric(mode); 
    413414    if (father == 0)            return AP_tree::swap_assymetric(mode); 
    414      
     415 
    415416    oldBrother = Brother(); 
    416      
     417 
    417418    switch (mode) 
    418     {     
    419      case AP_LEFT: movedSon = Leftson(); break;  
     419    { 
     420     case AP_LEFT: movedSon = Leftson(); break; 
    420421     case AP_RIGHT: movedSon = Rightson();  break; 
    421      default: movedSon = NULL;  break;  
    422     } 
    423      
     422     default: movedSon = NULL;  break; 
     423    } 
     424 
    424425    if (!father->father) 
    425426    { 
     
    428429 
    429430        if (oldBrother->is_leaf == AP_TRUE) return 0; // no swap needed ! 
    430          
    431         AP_tree_nlen *nephew = oldBrother->Leftson();  
    432          
     431 
     432        AP_tree_nlen *nephew = oldBrother->Leftson(); 
     433 
    433434        ap_main->push_node(this, BOTH); 
    434         ap_main->push_node(movedSon,STRUCTURE);  
     435        ap_main->push_node(movedSon,STRUCTURE); 
    435436        ap_main->push_node(father, SEQUENCE); 
    436437        ap_main->push_node(nephew, STRUCTURE); 
    437438        ap_main->push_node(oldBrother, BOTH); 
    438          
    439         edge1 = edgeTo(movedSon)->unlink();  
    440         edge2 = oldBrother->edgeTo(nephew)->unlink();  
    441          
     439 
     440        edge1 = edgeTo(movedSon)->unlink(); 
     441        edge2 = oldBrother->edgeTo(nephew)->unlink(); 
     442 
    442443        error = this->AP_tree::swap_assymetric(mode); 
    443          
     444 
    444445        edge1->relink(this,nephew); 
    445         edge2->relink(oldBrother,movedSon);  
     446        edge2->relink(oldBrother,movedSon); 
    446447    } 
    447448    else 
     
    450451        ap_main->push_node(father, BOTH); 
    451452        ap_main->push_node(oldBrother, STRUCTURE); 
    452         ap_main->push_node(movedSon,STRUCTURE);  
    453          
     453        ap_main->push_node(movedSon,STRUCTURE); 
     454 
    454455        // from father to root buffer all sequences 
    455          
    456         for (pntr = father->father; pntr ; pntr = pntr->father)  
     456 
     457        for (pntr = father->father; pntr ; pntr = pntr->father) 
    457458        { 
    458459            ap_main->push_node(pntr, SEQUENCE); 
    459460        } 
    460          
    461         edge1 = edgeTo(movedSon)->unlink();  
    462         edge2 = Father()->edgeTo(oldBrother)->unlink();  
    463          
     461 
     462        edge1 = edgeTo(movedSon)->unlink(); 
     463        edge2 = Father()->edgeTo(oldBrother)->unlink(); 
     464 
    464465        error = AP_tree::swap_assymetric(mode); 
    465          
    466         edge1->relink(this,oldBrother);  
    467         edge2->relink(Father(),movedSon);  
    468     } 
    469      
    470     return error;  
     466 
     467        edge1->relink(this,oldBrother); 
     468        edge2->relink(Father(),movedSon); 
     469    } 
     470 
     471    return error; 
    471472} 
    472473 
     
    478479{ 
    479480    AP_tree   *pntr; 
    480      
     481 
    481482    // cout << "set_root" << *this << '\n'; 
    482      
     483 
    483484    if (!father || !father->father)     // already root 
    484485    { 
    485         return 0;  
    486     } 
    487      
     486        return 0; 
     487    } 
     488 
    488489    // from this to root buffer the nodes 
    489      
     490 
    490491    ap_main->push_node(this , STRUCTURE); 
    491492    AP_tree *old_brother = 0; 
    492      
    493     for  (pntr = father; pntr->father; pntr = pntr->father)  
     493 
     494    for  (pntr = father; pntr->father; pntr = pntr->father) 
    494495    { 
    495496        ap_main->push_node( pntr, BOTH); 
    496497        old_brother= pntr; 
    497498    } 
    498      
     499 
    499500    AP_tree *old_root = pntr; 
    500      
    501     if (old_brother)  
     501 
     502    if (old_brother) 
    502503    { 
    503504        old_brother = old_brother->brother(); 
    504505        ap_main->push_node( old_brother , STRUCTURE); 
    505506    } 
    506      
     507 
    507508    ap_main->push_node(old_root, ROOT); 
    508      
     509 
    509510    return this->AP_tree::set_root(); 
    510511} 
     
    517518    if ((*e1)->Age() > (*e2)->Age()) 
    518519    { 
    519         AP_tree_edge *tmp = *e1;  
    520         *e1 = *e2;  
    521         *e2 = tmp;  
    522     } 
    523 } 
    524      
     520        AP_tree_edge *tmp = *e1; 
     521        *e1 = *e2; 
     522        *e2 = tmp; 
     523    } 
     524} 
     525 
    525526GB_INLINE void sort(AP_tree_edge **e1, AP_tree_edge **e2, AP_tree_edge **e3) 
    526527{ 
    527     sort(e1,e2);  
    528     sort(e2,e3);  
    529     sort(e1,e2);  
     528    sort(e1,e2); 
     529    sort(e2,e3); 
     530    sort(e1,e2); 
    530531} 
    531532 
     
    533534{ 
    534535    AP_tree *pntr; 
    535      
     536 
    536537//    cout << "move" << *this << "to new_brother" << *((AP_tree_nlen*)new_brother) << rel_pos << '\n'; 
    537      
    538     if (!father)  
     538 
     539    if (!father) 
    539540    { 
    540541        AW_ERROR ("AP_tree_nlen::move: You cannot move the root"); 
    541542        return "You cannot move the root"; 
    542543    } 
    543      
    544     if (!new_brother->father)  
     544 
     545    if (!new_brother->father) 
    545546    { 
    546547        AW_ERROR ("AP_tree_nlen::move: You cannot move to the root"); 
    547548        return "You cannot move to the root"; 
    548549    } 
    549      
     550 
    550551    ap_main->push_node(this , STRUCTURE); 
    551552    ap_main->push_node(brother(), STRUCTURE); 
    552      
    553     if (father->father)  
    554     { 
    555         AP_tree *grandpa = father->father;  
    556          
     553 
     554    if (father->father) 
     555    { 
     556        AP_tree *grandpa = father->father; 
     557 
    557558        ap_main->push_node(father , BOTH); 
    558          
     559 
    559560        if (grandpa->father) 
    560561        { 
    561562            ap_main->push_node(grandpa, BOTH); 
    562             for  (pntr = grandpa->father; pntr; pntr = pntr->father)  
     563            for  (pntr = grandpa->father; pntr; pntr = pntr->father) 
    563564            { 
    564565                ap_main->push_node( pntr, SEQUENCE); 
     
    574575    { 
    575576        ap_main->push_node(father , ROOT); 
    576          
     577 
    577578        if (!brother()->is_leaf) 
    578579        { 
     
    581582        } 
    582583    } 
    583      
     584 
    584585    ap_main->push_node(new_brother , STRUCTURE); 
    585     if (new_brother->father)  
     586    if (new_brother->father) 
    586587    { 
    587588        if (new_brother->father->father) 
     
    592593        { 
    593594            ap_main->push_node(new_brother->father , BOTH); 
    594             ap_main->push_node(new_brother->brother(), STRUCTURE);  
    595         } 
    596          
    597         for  (pntr = new_brother->father->father; pntr; pntr = pntr->father)  
     595            ap_main->push_node(new_brother->brother(), STRUCTURE); 
     596        } 
     597 
     598        for  (pntr = new_brother->father->father; pntr; pntr = pntr->father) 
    598599        { 
    599600            ap_main->push_node( pntr, SEQUENCE); 
    600601        } 
    601602    } 
    602      
     603 
    603604    const char *res = "Da fehlt wohl was..."; 
    604605    AP_tree_nlen    *thisFather = Father(), 
     
    606607                    *grandFather = thisFather->Father(), 
    607608                    *oldBrother = Brother(), 
    608                     *newBrothersFather = newBrother->Father();  
    609     int edgesChange = ! (father==new_brother ||  
    610                          new_brother->father==this->father);  
    611     AP_tree_edge *e1,*e2,*e3,*e4;  
    612          
     609                    *newBrothersFather = newBrother->Father(); 
     610    int edgesChange = ! (father==new_brother || 
     611                         new_brother->father==this->father); 
     612    AP_tree_edge *e1,*e2,*e3,*e4; 
     613 
    613614    if (edgesChange) 
    614615    { 
     
    619620                if(grandFather->Father()) 
    620621                { 
    621 //                  cout << "son -> son of brother\n";  
    622                      
    623                     thisFather->unlinkAllEdges(&e1,&e2,&e3);  
    624                     e4 = newBrother->edgeTo(oldBrother)->unlink();  
    625                      
     622//                  cout << "son -> son of brother\n"; 
     623 
     624                    thisFather->unlinkAllEdges(&e1,&e2,&e3); 
     625                    e4 = newBrother->edgeTo(oldBrother)->unlink(); 
     626 
    626627                    res = this->AP_tree::move(new_brother,rel_pos); 
    627                      
     628 
    628629                    sort(&e1,&e2,&e3);                          // sort by age (e1==oldest edge) 
    629630                    e1->relink(oldBrother,grandFather);         // use oldest edge at remove position 
    630                     thisFather->linkAllEdges(e2,e3,e4);  
     631                    thisFather->linkAllEdges(e2,e3,e4); 
    631632                } 
    632633                else                                    // grandson of root -> son of brother 
    633634                { 
    634 //                  cout << "grandson of root -> son of brother\n";  
    635                      
    636                     AP_tree_nlen *uncle = thisFather->Brother();  
    637                      
    638                     thisFather->unlinkAllEdges(&e1,&e2,&e3);  
    639                     e4 = newBrother->edgeTo(oldBrother)->unlink();  
    640                      
     635//                  cout << "grandson of root -> son of brother\n"; 
     636 
     637                    AP_tree_nlen *uncle = thisFather->Brother(); 
     638 
     639                    thisFather->unlinkAllEdges(&e1,&e2,&e3); 
     640                    e4 = newBrother->edgeTo(oldBrother)->unlink(); 
     641 
    641642                    res = this->AP_tree::move(new_brother,rel_pos); 
    642                      
     643 
    643644                    sort(&e1,&e2,&e3);  // sort by age (e1==oldest edge) 
    644645                    e1->relink(oldBrother,uncle); 
    645                     thisFather->linkAllEdges(e2,e3,e4);  
     646                    thisFather->linkAllEdges(e2,e3,e4); 
    646647                } 
    647648            } 
    648649            else        // son of root -> grandson of root 
    649650            { 
    650 //              cout << "son of root -> grandson of root\n";  
    651                  
     651//              cout << "son of root -> grandson of root\n"; 
     652 
    652653                oldBrother->unlinkAllEdges(&e1,&e2,&e3); 
    653654                res = this->AP_tree::move(new_brother,rel_pos); 
    654                 thisFather->linkAllEdges(e1,e2,e3);  
     655                thisFather->linkAllEdges(e1,e2,e3); 
    655656            } 
    656657        } 
    657658        else if (grandFather==newBrothersFather)        // son -> brother of father 
    658659        { 
    659             if (grandFather->father)     
     660            if (grandFather->father) 
    660661            { 
    661 //              cout << "son -> brother of father\n";  
    662                  
    663                 thisFather->unlinkAllEdges(&e1,&e2,&e3);  
    664                 e4 = grandFather->edgeTo(newBrother)->unlink();  
    665                  
     662//              cout << "son -> brother of father\n"; 
     663 
     664                thisFather->unlinkAllEdges(&e1,&e2,&e3); 
     665                e4 = grandFather->edgeTo(newBrother)->unlink(); 
     666 
    666667                res = this->AP_tree::move(new_brother,rel_pos); 
    667                  
    668                 sort(&e1,&e2,&e3);  
    669                 e1->relink(oldBrother,grandFather);  
    670                 thisFather->linkAllEdges(e2,e3,e4);  
     668 
     669                sort(&e1,&e2,&e3); 
     670                e1->relink(oldBrother,grandFather); 
     671                thisFather->linkAllEdges(e2,e3,e4); 
    671672            } 
    672673            else 
    673674            { 
    674675                // no edges change if we move grandson of root -> son of root 
    675                  
     676 
    676677                res = this->AP_tree::move(new_brother,rel_pos); 
    677678            } 
    678679        } 
    679         else     
    680         { 
    681             //  now we are sure, the minimal distance  
     680        else 
     681        { 
     682            //  now we are sure, the minimal distance 
    682683            //  between 'this' and 'newBrother' is 4 edges 
    683684            //  or if the root-edge is between them, the 
    684685            //  minimal distance is 3 edges 
    685              
     686 
    686687            if (!grandFather)                   // son of root 
    687688            { 
    688                 cout << "move son of root\n";  
    689                  
     689                cout << "move son of root\n"; 
     690 
    690691                oldBrother->unlinkAllEdges(&e1,&e2,&e3); 
    691692                e4 = newBrother->edgeTo(newBrothersFather)->unlink(); 
    692                  
     693 
    693694                res = this->AP_tree::move(new_brother,rel_pos); 
    694                  
    695                 sort(&e1,&e2,&e3);  
     695 
     696                sort(&e1,&e2,&e3); 
    696697                e1->relink(oldBrother->Leftson(),oldBrother->Rightson()); // new root-edge 
    697698                thisFather->linkAllEdges(e2,e3,e4);     // old root 
     
    701702                if (newBrothersFather->Father()->Father()==NULL)        // grandson of root -> grandson of root 
    702703                { 
    703 //                  cout << "grandson of root -> grandson of root\n";  
    704                      
    705                     thisFather->unlinkAllEdges(&e1,&e2,&e3);  
    706                     e4 = newBrother->edgeTo(newBrothersFather)->unlink();  
    707                      
     704//                  cout << "grandson of root -> grandson of root\n"; 
     705 
     706                    thisFather->unlinkAllEdges(&e1,&e2,&e3); 
     707                    e4 = newBrother->edgeTo(newBrothersFather)->unlink(); 
     708 
    708709                    res = this->AP_tree::move(new_brother,rel_pos); 
    709                      
    710                     sort(&e1,&e2,&e3);  
     710 
     711                    sort(&e1,&e2,&e3); 
    711712                    e1->relink(oldBrother,newBrothersFather);   // new root-edge 
    712                     thisFather->linkAllEdges(e2,e3,e4);  
     713                    thisFather->linkAllEdges(e2,e3,e4); 
    713714                } 
    714715                else 
    715716                { 
    716 //                  cout << "move grandson of root\n";  
    717                      
    718                     AP_tree_nlen *uncle = thisFather->Brother();  
    719                      
    720                     thisFather->unlinkAllEdges(&e1,&e2,&e3);  
    721                     e4 = newBrother->edgeTo(newBrothersFather)->unlink();  
    722                      
     717//                  cout << "move grandson of root\n"; 
     718 
     719                    AP_tree_nlen *uncle = thisFather->Brother(); 
     720 
     721                    thisFather->unlinkAllEdges(&e1,&e2,&e3); 
     722                    e4 = newBrother->edgeTo(newBrothersFather)->unlink(); 
     723 
    723724                    res = this->AP_tree::move(new_brother,rel_pos); 
    724                      
    725                     sort(&e1,&e2,&e3);  
     725 
     726                    sort(&e1,&e2,&e3); 
    726727                    e1->relink(oldBrother,uncle); 
    727                     thisFather->linkAllEdges(e2,e3,e4);  
    728                 } 
    729             } 
    730             else  
     728                    thisFather->linkAllEdges(e2,e3,e4); 
     729                } 
     730            } 
     731            else 
    731732            { 
    732                 if (newBrothersFather->Father()==NULL)          // move to son of root                                               
     733                if (newBrothersFather->Father()==NULL)          // move to son of root 
    733734                { 
    734 //                  cout << "Move to son of root\n";  
    735                      
    736                     AP_tree_nlen *newBrothersBrother = newBrother->Brother();  
    737                      
    738                     thisFather->unlinkAllEdges(&e1,&e2,&e3);  
    739                     e4 = newBrother->edgeTo(newBrothersBrother)->unlink();  
    740                      
     735//                  cout << "Move to son of root\n"; 
     736 
     737                    AP_tree_nlen *newBrothersBrother = newBrother->Brother(); 
     738 
     739                    thisFather->unlinkAllEdges(&e1,&e2,&e3); 
     740                    e4 = newBrother->edgeTo(newBrothersBrother)->unlink(); 
     741 
    741742                    res = this->AP_tree::move(new_brother,rel_pos); 
    742                      
    743                     sort(&e1,&e2,&e3);  
    744                     e1->relink(oldBrother,grandFather);  
    745                     thisFather->linkAllEdges(e2,e3,e4);  
     743 
     744                    sort(&e1,&e2,&e3); 
     745                    e1->relink(oldBrother,grandFather); 
     746                    thisFather->linkAllEdges(e2,e3,e4); 
    746747                } 
    747748                else                                            // simple independent move 
    748749                { 
    749 //                  cout << "Independet move\n";  
    750                      
    751                     thisFather->unlinkAllEdges(&e1,&e2,&e3);  
    752                     e4 = newBrother->edgeTo(newBrothersFather)->unlink();  
    753                      
     750//                  cout << "Independet move\n"; 
     751 
     752                    thisFather->unlinkAllEdges(&e1,&e2,&e3); 
     753                    e4 = newBrother->edgeTo(newBrothersFather)->unlink(); 
     754 
    754755                    res = this->AP_tree::move(new_brother,rel_pos); 
    755                      
    756                     sort(&e1,&e2,&e3);  
    757                     e1->relink(oldBrother,grandFather);  
    758                     thisFather->linkAllEdges(e2,e3,e4);  
     756 
     757                    sort(&e1,&e2,&e3); 
     758                    e1->relink(oldBrother,grandFather); 
     759                    thisFather->linkAllEdges(e2,e3,e4); 
    759760                } 
    760761            } 
     
    763764    else        // edgesChange==0 
    764765    { 
    765 //      cout << "No edges changed\n";  
     766//      cout << "No edges changed\n"; 
    766767        res = this->AP_tree::move(new_brother,rel_pos); 
    767768    } 
    768      
    769     return res;  
     769 
     770    return res; 
    770771} 
    771772 
     
    796797    //removes the current sequence 
    797798    //(not leaf) 
    798      
    799     if (sequence != 0)  
    800     { 
    801         if (!is_leaf)  
     799 
     800    if (sequence != 0) 
     801    { 
     802        if (!is_leaf) 
    802803        { 
    803804            sequence->is_set_flag = AP_FALSE; 
    804805        } 
    805806    } 
    806      
     807 
    807808    return; 
    808809} 
     
    813814    // AP_FALSE if it is copied into the previous level 
    814815    // according if user_buffer is greater than datum 
    815      
    816 //    cout << "clear\n";  
    817      
     816 
     817//    cout << "clear\n"; 
     818 
    818819    AP_tree_buffer * buff; 
    819820    AP_BOOL         result; 
    820      
     821 
    821822    if (!this->stack_level == datum) 
    822823    { 
     
    824825        return AP_FALSE; 
    825826    } 
    826      
     827 
    827828    buff = stack.pop(); 
    828      
    829     if (buff->controll == datum - 1 || user_buffer_count >= datum)  
     829 
     830    if (buff->controll == datum - 1 || user_buffer_count >= datum) 
    830831    { 
    831832        //previous node is buffered 
    832          
    833         if (buff->mode & SEQUENCE)  
     833 
     834        if (buff->mode & SEQUENCE) 
    834835        { 
    835836            delete buff->sequence; 
    836837        } 
    837          
     838 
    838839        stack_level = buff->controll; 
    839840        delete  buff; 
    840841        result = AP_TRUE; 
    841     }  
    842     else  
     842    } 
     843    else 
    843844    { 
    844845        stack_level = datum - 1; 
     
    846847        result = AP_FALSE; 
    847848    } 
    848      
     849 
    849850    return result; 
    850851} 
     
    853854AP_BOOL AP_tree_nlen::push(AP_STACK_MODE mode, unsigned long datum) 
    854855{ 
    855     // according to mode  
     856    // according to mode 
    856857    // tree_structure / sequence is buffered in the node 
    857      
     858 
    858859    AP_tree_buffer *new_buff; 
    859860    AP_BOOL ret; 
    860      
     861 
    861862    if (is_leaf && !(STRUCTURE & mode)) return AP_FALSE;        // tips push only structure 
    862      
    863     if (this->stack_level == datum)  
     863 
     864    if (this->stack_level == datum) 
    864865    { 
    865866        AP_tree_buffer *last_buffer = stack.get_first(); 
    866867        if (sequence &&(mode & SEQUENCE)) sequence->is_set_flag = AP_FALSE; 
    867868        if (0 == (mode & ~last_buffer->mode))   // already buffered 
    868         {        
     869        { 
    869870            return AP_FALSE; 
    870871        } 
     
    878879        new_buff->controll = stack_level; 
    879880        new_buff->mode = NOTHING; 
    880          
     881 
    881882        stack.push(new_buff); 
    882883        this->stack_level = datum; 
    883884        ret = AP_TRUE; 
    884885    } 
    885      
    886     if ( (mode & STRUCTURE) && !(new_buff->mode & STRUCTURE) )  
     886 
     887    if ( (mode & STRUCTURE) && !(new_buff->mode & STRUCTURE) ) 
    887888    { 
    888889//      cout << "push structure " << *this << '\n'; 
     
    893894        new_buff->rightlen = rightlen; 
    894895        new_buff->gb_node = gb_node; 
    895         new_buff->distance = distance;  
    896          
    897         for (int e=0; e<3; e++)  
    898         { 
    899             new_buff->edge[e]      = edge[e];  
    900             new_buff->edgeIndex[e] = index[e];  
     896        new_buff->distance = distance; 
     897 
     898        for (int e=0; e<3; e++) 
     899        { 
     900            new_buff->edge[e]      = edge[e]; 
     901            new_buff->edgeIndex[e] = index[e]; 
    901902            if (edge[e]) 
    902903            { 
     
    905906        } 
    906907    } 
    907      
    908     if ( (mode & SEQUENCE) && !(new_buff->mode & SEQUENCE) )  
    909     { 
    910         if (sequence)  
     908 
     909    if ( (mode & SEQUENCE) && !(new_buff->mode & SEQUENCE) ) 
     910    { 
     911        if (sequence) 
    911912        { 
    912913            new_buff->sequence = sequence; 
     
    914915            mutation_rate = 0.0; 
    915916            sequence = 0; 
    916         }  
    917         else  
     917        } 
     918        else 
    918919        { 
    919920            new_buff->sequence = 0; 
     
    921922        } 
    922923    } 
    923      
     924 
    924925    new_buff->mode = (AP_STACK_MODE)(new_buff->mode|mode); 
    925      
     926 
    926927    return ret; 
    927928} 
     
    930931{                               /* pop old tree costs */ 
    931932    AP_tree_buffer *buff; 
    932      
    933     if (stack_level != datum)  
     933 
     934    if (stack_level != datum) 
    934935    { 
    935936        // new AP_ERR("AP_tree_nlen::pop()", "Error in Node Stack"); 
    936937    } 
    937      
     938 
    938939    buff = stack.pop(); 
    939      
     940 
    940941    AP_STACK_MODE   mode = buff->mode; 
    941      
    942     if (mode&STRUCTURE)  
     942 
     943    if (mode&STRUCTURE) 
    943944    { 
    944945//      cout << "pop structure " << this << '\n'; 
    945          
     946 
    946947        father = buff->father; 
    947948        leftson = buff->leftson; 
     
    950951        rightlen = buff->rightlen; 
    951952        gb_node = buff->gb_node; 
    952         distance = buff->distance;  
    953          
    954         for (int e=0; e<3; e++)  
    955         { 
    956             edge[e] = buff->edge[e];  
    957              
     953        distance = buff->distance; 
     954 
     955        for (int e=0; e<3; e++) 
     956        { 
     957            edge[e] = buff->edge[e]; 
     958 
    958959            if (edge[e]) 
    959960            { 
    960                 index[e] = buff->edgeIndex[e];  
    961                  
    962                 edge[e]->index[index[e]] = e;  
     961                index[e] = buff->edgeIndex[e]; 
     962 
     963                edge[e]->index[index[e]] = e; 
    963964                edge[e]->node[index[e]]  = this; 
    964                 edge[e]->data            = buff->edgeData[e];  
    965             } 
    966         } 
    967     } 
    968      
    969     if (mode&SEQUENCE)  
     965                edge[e]->data            = buff->edgeData[e]; 
     966            } 
     967        } 
     968    } 
     969 
     970    if (mode&SEQUENCE) 
    970971    { 
    971972        if (sequence) delete sequence; 
    972          
     973 
    973974        sequence      = buff->sequence; 
    974975        mutation_rate = buff->mutation_rate; 
    975976    } 
    976      
    977     if (ROOT==mode)  
    978     { 
    979 //      cout << "root popped:" << this << "\n";  
     977 
     978    if (ROOT==mode) 
     979    { 
     980//      cout << "root popped:" << this << "\n"; 
    980981        ap_main->set_tree_root(this); 
    981982    } 
    982      
     983 
    983984    stack_level = buff->controll; 
    984985    delete buff; 
     
    993994    AP_tree_nlen   *lefts = (AP_tree_nlen *) leftson; 
    994995    AP_tree_nlen   *rights = (AP_tree_nlen *) rightson; 
    995      
     996 
    996997    if (sequence && sequence->is_set_flag) return; 
    997      
    998     if (is_leaf)  
     998 
     999    if (is_leaf) 
    9991000    { 
    10001001        sequence->is_set_flag = AP_TRUE; 
    10011002        return; 
    10021003    } 
    1003      
     1004 
    10041005    if (!lefts->sequence || !lefts->sequence->is_set_flag  ) lefts->parsimony_rek(); 
    10051006    if (!rights->sequence|| !rights->sequence->is_set_flag ) rights->parsimony_rek(); 
    1006      
    1007     if (!lefts->sequence->is_set_flag || !rights->sequence->is_set_flag)  
     1007 
     1008    if (!lefts->sequence->is_set_flag || !rights->sequence->is_set_flag) 
    10081009    { 
    10091010        AW_ERROR("AP_tree_nlen::parsimony_rek:  Cannot set sequence"); 
    10101011        return; 
    10111012    } 
    1012      
     1013 
    10131014    if (sequence == 0) sequence = tree_root->sequence_template->dup(); 
    1014      
     1015 
    10151016    mutation_rate = leftson->mutation_rate + rightson->mutation_rate + 
    10161017        sequence->combine(lefts->sequence, rights->sequence); 
     
    10281029        return rootEdge()->nni_rek(openclosestatus,Abort,deep,skip_hidden,mode); 
    10291030    } 
    1030      
     1031 
    10311032    if (!father->father) 
    10321033    { 
    1033         AP_tree_edge *e = rootEdge();  
    1034          
     1034        AP_tree_edge *e = rootEdge(); 
     1035 
    10351036        return e->nni_rek(openclosestatus,Abort,deep,skip_hidden,mode,e->otherNode(this)); 
    10361037    } 
    1037      
     1038 
    10381039    return edgeTo(Father())->nni_rek(openclosestatus,Abort,deep,skip_hidden,mode,Father()); 
    10391040} 
     
    11261127        //parsimony werte bestimmen 
    11271128        // 
    1128          
     1129 
    11291130        // Wurzel setzen 
    1130          
     1131 
    11311132        ap_main->push(); 
    11321133        this->set_root(); 
     
    11381139            pars_ref[i] = i; 
    11391140            pars[i] = -1; 
    1140              
     1141 
    11411142            if (!pars_refpntr[i])       continue; 
    11421143            if (pars_refpntr[i]->is_leaf) continue; 
     
    11441145            if (pars_refpntr[i]->gr.hidden) continue; 
    11451146            if (pars_refpntr[i]->father->gr.hidden) continue; 
    1146              
     1147 
    11471148            //nur wenn kein Blatt ist 
    11481149            ap_main->push(); 
     
    11951196        //Darstellen 
    11961197 
    1197          
     1198 
    11981199//      for (i=0;i<visited_subtrees;i++)  cout << "  " << pars[i]; 
    1199          
     1200 
    12001201 
    12011202        if (rek_deep < rek_2_width_max) { 
     
    12181219                } 
    12191220 
    1220         }                
     1221        } 
    12211222 
    12221223        if (rek_width > visited_subtrees)       rek_width = visited_subtrees; 
     
    13211322                if (rightson->refUp.init == AP_FALSE) 
    13221323                        rightson->createListRekUp(list,cn); 
    1323                  
     1324 
    13241325                refUp.init = AP_TRUE; 
    13251326                refUp.isLeaf = AP_FALSE; 
    13261327                refUp.refNode = *cn; 
    13271328                (*cn)++; 
    1328                          
    1329  
    1330                 addToList(list,cn,this,leftson->refUp,rightson->refUp);  
     1329 
     1330 
     1331                addToList(list,cn,this,leftson->refUp,rightson->refUp); 
    13311332                if (father == 0) { // at root 
    13321333                        refRight.init = rightson->refUp.init; 
    1333                         if ((refRight.isLeaf = rightson->refUp.isLeaf) == AP_TRUE)  
     1334                        if ((refRight.isLeaf = rightson->refUp.isLeaf) == AP_TRUE) 
    13341335                                refRight.refLeaf = rightson->refUp.refLeaf; 
    1335                         else  
     1336                        else 
    13361337                                refRight.refNode = rightson->refUp.refNode; 
    13371338                        refLeft.init = leftson->refUp.init; 
    1338                         if ((refLeft.isLeaf = leftson->refUp.isLeaf) == AP_TRUE)  
     1339                        if ((refLeft.isLeaf = leftson->refUp.isLeaf) == AP_TRUE) 
    13391340                                refLeft.refLeaf = leftson->refUp.refLeaf; 
    1340                         else  
     1341                        else 
    13411342                                refLeft.refNode = leftson->refUp.refNode; 
    13421343                } 
     
    13531354                refRight.refNode = *cn; 
    13541355                (*cn)++; 
    1355                          
     1356 
    13561357                if (father->leftson == this) { 
    13571358                        if (father->refLeft.init == AP_FALSE) 
     
    13831384 
    13841385 
    1385 AP_CO_LIST * AP_tree_nlen::createList(int *size)  
     1386AP_CO_LIST * AP_tree_nlen::createList(int *size) 
    13861387{ 
    13871388    // returns an list with all 
     
    13891390    AP_CO_LIST *list; 
    13901391    int number = 0; 
    1391     if (father !=0)  
     1392    if (father !=0) 
    13921393    { 
    13931394        AW_ERROR("AP_tree_nlen::createList may be called with damaged tree"); 
     
    14021403    return list; 
    14031404} 
    1404      
     1405 
    14051406#endif 
    1406      
     1407 
    14071408/************************************************************************* 
    14081409Section Misc stuff: 
     
    14131414 
    14141415**************************************************************************/ 
    1415      
     1416 
    14161417const char* AP_tree_nlen::sortByName() 
    14171418{ 
    14181419    if (name) return name;      // leaves 
    1419      
     1420 
    14201421    const char *n1 = Leftson()->sortByName(); 
    14211422    const char *n2 = Rightson()->sortByName(); 
    1422      
    1423     if (strcmp(n1,n2)<0) return n1;  
    1424      
     1423 
     1424    if (strcmp(n1,n2)<0) return n1; 
     1425 
    14251426    AP_tree::swap_sons(); 
    1426      
    1427     return n2;  
    1428 } 
    1429      
     1427 
     1428    return n2; 
     1429} 
     1430 
    14301431int AP_tree_nlen::test(void) const 
    14311432{ 
    1432     int edges = 0;  
    1433      
     1433    int edges = 0; 
     1434 
    14341435    { for (int e=0; e<3; e++) if (edge[e]!=NULL) edges++; } 
    1435      
     1436 
    14361437    if (!sequence) 
    14371438    { 
    1438         cout << "Node" << *this << "has no sequence\n";  
    1439     } 
    1440      
    1441     if (father)     
     1439        cout << "Node" << *this << "has no sequence\n"; 
     1440    } 
     1441 
     1442    if (father) 
    14421443    { 
    14431444        if (father->father == (AP_tree *)this) 
    14441445        { 
    1445             cout << "Ooops! I am my own grandfather! How is this possible?\n" <<  
     1446            cout << "Ooops! I am my own grandfather! How is this possible?\n" << 
    14461447            *this << '\n' << 
    1447             *Father() << '\n';  
    1448         } 
    1449          
     1448            *Father() << '\n'; 
     1449        } 
     1450 
    14501451        if (is_leaf) 
    14511452        { 
     
    14621463            } 
    14631464        } 
    1464          
     1465 
    14651466        int e; 
    1466          
     1467 
    14671468        for (e=0; e<3; e++) 
    14681469        { 
     
    14711472                if (edge[e]->isConnectedTo(this)) 
    14721473                { 
    1473                     AP_tree_nlen *neighbour = edge[e]->otherNode(this);  
    1474                      
    1475                     if ( ! (neighbour==father ||  
    1476                             neighbour==leftson ||  
     1474                    AP_tree_nlen *neighbour = edge[e]->otherNode(this); 
     1475 
     1476                    if ( ! (neighbour==father || 
     1477                            neighbour==leftson || 
    14771478                            neighbour==rightson)) 
    14781479                    { 
     
    14891490                            cout << "Edge " << edge[e] << " connects the nodes" 
    14901491                                        << *this << "and" << *(edge[e]->otherNode(this)) 
    1491                                         << "(they are not neighbours)\n";  
     1492                                        << "(they are not neighbours)\n"; 
    14921493                        } 
    14931494                    } 
     
    14951496                else 
    14961497                { 
    1497                     cout << "Node" << *this  
     1498                    cout << "Node" << *this 
    14981499                                << "is connected to wrong edge" 
    14991500                                << edge[e] << '\n'; 
     
    15091510        } 
    15101511    } 
    1511      
     1512 
    15121513    test_tree();        // AP_tree:: 
    1513      
    1514     return 0;  
     1514 
     1515    return 0; 
    15151516} 
    15161517 
     
    15191520    if (!name) 
    15201521    { 
    1521         static char *buffer;  
     1522        static char *buffer; 
    15221523        char *lName = strdup(Leftson()->fullname()), 
    1523              *rName = strdup(Rightson()->fullname());  
    1524         int len = strlen(lName)+strlen(rName)+4;  
    1525          
    1526         if (buffer) free(buffer);  
    1527          
    1528         buffer = (char*)malloc(len);  
    1529          
    1530         strcpy(buffer,"[");  
    1531         strcat(buffer,lName);  
     1524             *rName = strdup(Rightson()->fullname()); 
     1525        int len = strlen(lName)+strlen(rName)+4; 
     1526 
     1527        if (buffer) free(buffer); 
     1528 
     1529        buffer = (char*)malloc(len); 
     1530 
     1531        strcpy(buffer,"["); 
     1532        strcat(buffer,lName); 
    15321533        strcat(buffer,","); 
    1533         strcat(buffer,rName);  
     1534        strcat(buffer,rName); 
    15341535        strcat(buffer,"]"); 
    1535      
    1536         free(lName);  
    1537         free(rName);  
    1538      
    1539         return buffer;  
    1540     } 
    1541      
    1542     return name;  
    1543 } 
    1544      
    1545 char* AP_tree_nlen::getSequence()  
    1546 {     
    1547     char *s;     
    1548          
    1549     costs();  
    1550     AP_sequence_parsimony *pseq = (AP_sequence_parsimony*)sequence;  
    1551     assert(pseq->is_set_flag);  
    1552     s = new char[pseq->sequence_len];  
    1553     memcpy(s,pseq->sequence,(unsigned int)pseq->sequence_len);  
    1554      
    1555     return s;  
    1556 } 
    1557      
     1536 
     1537        free(lName); 
     1538        free(rName); 
     1539 
     1540        return buffer; 
     1541    } 
     1542 
     1543    return name; 
     1544} 
     1545 
     1546char* AP_tree_nlen::getSequence() 
     1547{ 
     1548    char *s; 
     1549 
     1550    costs(); 
     1551    AP_sequence_parsimony *pseq = (AP_sequence_parsimony*)sequence; 
     1552    assert(pseq->is_set_flag); 
     1553    s = new char[pseq->sequence_len]; 
     1554    memcpy(s,pseq->sequence,(unsigned int)pseq->sequence_len); 
     1555 
     1556    return s; 
     1557} 
     1558 
  • trunk/PARSIMONY/GA_genetic.cxx

    r2 r655  
    55#include <stdio.h> 
    66#include <memory.h> 
    7 #include <malloc.h> 
     7// #include <malloc.h> 
    88#include <iostream.h> 
    99#include "AP_buffer.hxx" 
     
    2828 
    2929GA_genetic::~GA_genetic(void) { 
    30         if (fout) {  
     30        if (fout) { 
    3131                if (fclose(fout) != 0) { 
    3232                        new AP_ERR("~GA_genetic","coldnt close output"); 
     
    4343        gb_tree_opt = GB_find(gb_genetic,"tree_opt",NULL,down_level); 
    4444        gb_joblist = GB_find(gb_genetic,"job_list",NULL,down_level); 
    45         gb_bestTree = GB_find(gb_presets,"bestTree",NULL,down_level);    
     45        gb_bestTree = GB_find(gb_presets,"bestTree",NULL,down_level); 
    4646        gb_jobCount = GB_find(gb_presets,"jobCount",NULL,down_level); 
    4747        gb_maxTree = GB_find(gb_presets,"maxTree",NULL,down_level); 
    4848        gb_treeName = GB_find(gb_presets,"treeName",NULL,down_level); 
    49          
     49 
    5050        if (gb_presets == 0) { 
    5151                new AP_ERR("init","No presets defined"); 
    52                 return;  
     52                return; 
    5353        } 
    5454        if (gb_joblist == 0){ 
     
    7474        } 
    7575        max_cluster = (int)GB_read_int(gbp); 
    76          
     76 
    7777          if ( (gbp = GB_find(gb_presets,"maxTree",NULL,down_level)) == 0) { 
    7878          new AP_ERR("GA_init","some preset not found"); 
     
    8181          } 
    8282          maxTree = (int)GB_read_int(gbp); 
    83         
     83 
    8484        if ( (gbp = GB_find(gb_presets,"max_jobs",NULL,down_level)) == 0) { 
    8585                new AP_ERR("GA_init","some preset not found"); 
     
    8888        } 
    8989        max_jobs = (int)GB_read_int(gbp); 
    90          
     90 
    9191        // allocate memory 
    9292        treelist = (long **)calloc((size_t)max_cluster+1,sizeof(long **)); 
     
    9595        } 
    9696        treePerCluster = (int *)calloc((size_t)max_cluster+1,sizeof(int)); 
    97          
     97 
    9898        GB_pop_transaction(gb_main); 
    9999        // 
     
    116116        gb_tree_opt = GB_create_container(gb_genetic,0,"trees_opt"); 
    117117        gb_joblist = GB_create_container(gb_genetic,0,"job_list"); 
    118          
    119         
     118 
     119 
    120120 
    121121        // write presets 
     
    142142 
    143143        GB_pop_transaction(gb_main); 
    144          
     144 
    145145        tree_prototype = (AP_tree *) new AP_tree_nlen; 
    146146        return; 
     
    152152AP_ERR * GA_genetic::read_presets() { 
    153153        GBDATA *gbp; 
    154         if (gb_presets == 0)  
     154        if (gb_presets == 0) 
    155155                return new AP_ERR("GA_genetic","not inited"); 
    156156        if ( (gbp = GB_find(gb_presets,"jobOpt",NULL,down_level)) == 0) { 
     
    170170        if (gb_bestTree) bestTree = GB_read_APfloat(gb_bestTree); 
    171171        if (gb_maxTree) maxTree = (int)GB_read_int(gb_maxTree); 
    172                          
     172 
    173173        return 0; 
    174174} 
     
    247247        char treename[20]; 
    248248        long id; 
    249          
     249 
    250250        if (container == 0) { 
    251251                new AP_ERR("get_tree","container valid !"); 
     
    325325                node->rightlen = AP_atof(*data); 
    326326                *data = p1; 
    327                  
     327 
    328328                node->leftson = read_tree_rek(data); 
    329329                if (!node->leftson) { 
     
    378378                ga_tree->id = GB_read_int(gb_treeName); 
    379379                GB_write_int(gb_treeName,1+ga_tree->id); 
    380         }  
     380        } 
    381381        if ((gb_tree = get_tree(gb_cluster,ga_tree->id))==0) { 
    382382                 gb_tree = GB_create_container(gb_cluster,0,"tree"); 
    383         }  
    384          
     383        } 
     384 
    385385        gb_ref_count = GB_create(gb_tree,0,"ref_count"); 
    386386        gb_criteria = GB_create(gb_tree,0,"criteria"); 
    387387        gb_id = GB_create(gb_tree,0,"id"); 
    388          
     388 
    389389        GB_write_int(gb_ref_count,ga_tree->ref_count); 
    390390        GB_write_APfloat(gb_criteria, ga_tree->criteria); 
     
    417417 
    418418GA_tree *GA_genetic::read_tree(GBDATA *gb_cluster,long tree_id) 
    419         /* read a tree  
     419        /* read a tree 
    420420           and removes it if no referenz is existing */ 
    421421{ 
     
    428428        char *cptr[1]; 
    429429        GA_tree *tree; 
    430          
     430 
    431431        gb_count = GB_find(gb_cluster,"count",0,down_level); 
    432432        count = (int)GB_read_int(gb_count); 
    433         
     433 
    434434        gb_tree = get_tree(gb_cluster,tree_id); 
    435435        if(gb_tree == 0) { 
     
    446446        GBDATA *gb_criteria = GB_search(gb_tree,"criteria",GB_FIND); 
    447447        GBDATA *gb_id = GB_search(gb_tree,"id",GB_FIND); 
    448          
     448 
    449449        if (gb_ref_count) 
    450450                tree->ref_count = (int)GB_read_int(gb_ref_count); 
     
    455455 
    456456        gb_treedata = GB_search(gb_tree,"tree_data",GB_FIND); 
    457         if (gb_treedata) {       
     457        if (gb_treedata) { 
    458458                fbuf =cptr[0] = GB_read_string(gb_treedata); 
    459459                tree->tree = (AP_tree_nlen *)read_tree_rek(cptr); 
     
    462462        delete_tree(gb_cluster,gb_tree); 
    463463        GBT_link_tree((GBT_TREE*)tree->tree,gb_main); 
    464         return tree;             
     464        return tree; 
    465465} 
    466466 
     
    493493                return new AP_ERR("put_start_tree","cluster unvalid"); 
    494494        } 
    495          
     495 
    496496        if (gb_tree_start == 0) { 
    497497                GB_pop_transaction(gb_main); 
     
    500500        } 
    501501        gb_cluster = get_cluster(gb_tree_start,cluster); 
    502          
     502 
    503503        if (gb_cluster ==0) { 
    504504                char clustername[20]; 
     
    520520        ga_tree->id = tree_id; 
    521521        ga_tree->tree = (AP_tree_nlen *)tree; 
    522      
     522 
    523523        ap_err = write_tree(gb_cluster,ga_tree); 
    524          
     524 
    525525        if (ap_err == 0) { 
    526526                anzahl ++; 
     
    560560        int anzahl = 0; 
    561561        GBDATA *gb_anzahl; 
    562          
     562 
    563563        GB_push_transaction(gb_main); 
    564564        gb_cluster = this->get_cluster(gb_tree_opt,cluster); 
     
    574574                GB_write_int(gb_anzahl,0); 
    575575        } 
    576          
     576 
    577577        gb_anzahl = GB_find(gb_cluster,"count",0,down_level); 
    578578        anzahl = (int)GB_read_int(gb_anzahl); 
     
    580580                remove_job(gb_cluster); 
    581581        } 
    582          
     582 
    583583        // baum speichern und anzahl erhoehen 
    584584        // kreire jobs 
     
    587587        anzahl ++; 
    588588        GB_write_int(gb_anzahl,anzahl); 
    589         create_jobs(tree,cluster);       
     589        create_jobs(tree,cluster); 
    590590        GB_pop_transaction(gb_main); 
    591591        return 0; 
     
    598598                return new AP_ERR("delete_tree","no tree given"); 
    599599        } 
    600          
     600 
    601601        GBDATA *gb_ref_count = GB_search(gb_tree,"ref_count",GB_FIND); 
    602602        if (gb_ref_count) { 
     
    617617Alles was mit jobs zu tuen hat 
    618618**************************************************/ 
    619    
     619 
    620620GA_job * GA_genetic::get_job(int cluster) { 
    621621        int count; 
     
    635635                return 0; 
    636636        } 
    637          
     637 
    638638        count = (int)GB_read_int(gb_jobCount); // globaler zaehler 
    639639        if (count <= 0) { 
     
    642642                return 0; 
    643643        } 
    644                  
     644 
    645645        // 
    646646        // suche besten job aus cluster und liefer ihn zurueck 
     
    661661 
    662662        gb_best_job = gbp_job = GB_find(gb_cluster,"job",0,down_level); 
    663         if (gbp_job != 0)  
     663        if (gbp_job != 0) 
    664664                gbp_criteria = GB_find(gbp_job,"criteria",0,down_level); 
    665          
     665 
    666666        if (gbp_criteria != 0) 
    667667                crit_best = GB_read_APfloat(gbp_criteria); 
    668          
     668 
    669669        while ((gbp_job = GB_find(gbp_job,"job",0,this_level|search_next)) !=0) { 
    670670                gbp_criteria = GB_find(gbp_job,"criteria",0,down_level); 
     
    672672                if (crit_next > crit_best ) { 
    673673                        crit_best = crit_next; 
    674                         gb_best_job = gbp_job;   
     674                        gb_best_job = gbp_job; 
    675675                } 
    676676        } 
     
    700700        gb_cluster = get_cluster(gb_tree_opt,job->cluster0); 
    701701        job->tree0 = read_tree(gb_cluster,job->id0); 
    702          
    703         if (job->id1 != -1 ){ // falls zweiter baum angegeben  
     702 
     703        if (job->id1 != -1 ){ // falls zweiter baum angegeben 
    704704                gb_cluster = get_cluster(gb_tree_opt,job->cluster1); 
    705705                job->tree1 = read_tree(gb_cluster,job->id1); 
     
    726726        char *err =0; 
    727727        GBDATA *gbp; 
    728          
     728 
    729729        if (job == 0) { 
    730730                return new AP_ERR("put_job","no job given !"); 
     
    737737        gb_jobcluster = gb_cluster = get_cluster(gb_joblist,job->cluster0); 
    738738        gb_anzahl = GB_find(gb_cluster,"count",0,down_level); 
    739         anzahl =GB_read_int(gb_anzahl);  
     739        anzahl =GB_read_int(gb_anzahl); 
    740740        // Criteria Ausrechnen !! 
    741741        if (job->id1 >= 0) { 
     
    772772        gbp =  GB_search(gb_job,"id1",GB_CREATE); 
    773773        err = GB_write_int(gbp,job->id1); 
    774          
     774 
    775775        if (err !=0) { 
    776776                aperr = new AP_ERR("put job","error while writing job to database"); 
     
    792792 
    793793        jobCount = (int)GB_read_int(gb_jobCount); 
    794          
     794 
    795795        while (jobCount >= max_jobs) { 
    796796                remove_job(0); 
    797797        } 
    798          
     798 
    799799        GB_pop_transaction(gb_main); 
    800800        job->printl(); 
     
    813813        GBDATA *jobcl; 
    814814 
    815         if (gb_job == 0)  
     815        if (gb_job == 0) 
    816816                return new AP_ERR("delete_job","no job given !"); 
    817817        jobcl = GB_get_father(gb_job); 
     
    829829        // Der erste Baum ist im selben Cluster ! 
    830830        gbcl = gb_cluster = get_cluster(gb_tree_opt,job->cluster0); 
    831          
     831 
    832832        gbt = get_tree(gb_cluster,job->id0); 
    833833        delete_tree(gb_cluster,gbt); 
    834         if (job->id1 != -1 ){ // falls zweiter baum angegeben  
     834        if (job->id1 != -1 ){ // falls zweiter baum angegeben 
    835835                gb_cluster = get_cluster(gb_tree_opt,job->cluster1); 
    836836                gbt = get_tree(gb_cluster,job->id1); 
     
    875875                } 
    876876        } 
    877          
     877 
    878878        gbjob = GB_find(gb_cluster,"job",0,down_level); 
    879          
     879 
    880880        if (gbjob != 0) { 
    881881                gbp_criteria = GB_find(gbjob,"criteria",0,down_level); 
     
    889889                        if (crit_next > crit_worst ) { 
    890890                                crit_worst = crit_next; 
    891                                 gbworst = gbjob;         
     891                                gbworst = gbjob; 
    892892                        } 
    893893                } 
     
    897897                return new AP_ERR("remove_job","No job found"); 
    898898        } 
    899          
     899 
    900900        delete_job(gbworst); 
    901901        return 0; 
    902902} 
    903   
     903 
    904904 
    905905 
     
    913913 
    914914        read_presets(); 
    915          
     915 
    916916        /* 
    917917          for (i=0;i<jobOpt;i++){       // Optimierungsjobs 
     
    922922          job->id1 = -1; 
    923923          job->modus = GA_KERNIGHAN; 
    924           if (put_job(job->cluster0,job) !=0)  
     924          if (put_job(job->cluster0,job) !=0) 
    925925          ; 
    926926          delete job; 
     
    958958        cout << "\n"; 
    959959        cout.flush(); 
    960          
     960 
    961961        for (i=0;i<jobCrossover;i++){   // Crossoverjobs 
    962962                if (treePerCluster[cluster] > 1) { // in same cluster 
     
    993993                                // search random cluster other than cluster 
    994994                rcl = (int)random()%clusterCount; 
    995                  
     995 
    996996                int safty = 0; 
    997997                while ((rcl == cluster) || (treePerCluster[rcl] < 1) )  { 
     
    10081008                //      while (treelist[rcl][treeid] == job->id0) { 
    10091009                        treeid = (int)random()%treePerCluster[rcl]; 
    1010                  
     1010 
    10111011                //}; 
    1012          
     1012 
    10131013                // remove it from treelist by a swap 
    10141014                job->id1 = treelist[rcl][treeid]; 
     
    10201020                        jc++; 
    10211021                delete job; 
    1022         }        
     1022        } 
    10231023        if (jc < 1) {   // create jobs falls keine anderen aufgetaucht sind 
    10241024                job = new GA_job; 
  • trunk/PARSIMONY/GA_main.cxx

    r2 r655  
    55#include <stdio.h> 
    66#include <memory.h> 
    7 #include <malloc.h> 
     7// #include <malloc.h> 
    88#include <iostream.h> 
    99#include "AP_buffer.hxx" 
     
    3636        // root is tree with species (needed to build a list of species) 
    3737        AP_tree **list; 
    38          
     38 
    3939        if (root->sequence_proto == 0) tree_init(root); 
    4040 
     
    4747 
    4848        list = (AP_tree **)calloc(root->gr.leave_sum +1,sizeof(AP_tree *)); 
    49          
     49 
    5050        buildRandomTreeRek(root,list,&count); 
    5151        count--; 
     
    9393        list0 = tree0->createList(&size0); 
    9494        list1 = tree1->createList(&size1); 
    95          
     95 
    9696        fprintf(GAgenetic->fout,"\ncrossover tree %d %d size %d %d", 
    9797                tree0,tree1,size0,size1); 
    98          
     98 
    9999        // ruft crossover auf 
    100100        return tree0; 
     
    122122                GAgenetic->init(gbmain); 
    123123        } 
    124          
     124 
    125125        maxcluster = GAgenetic->getMaxCluster(); 
    126126        while (i<maxcluster) { 
     
    143143        fclose(GAgenetic->fout); 
    144144} 
    145   
     145 
    146146void start_genetic(GBDATA *gbmain) { 
    147         //  
     147        // 
    148148        // the genetic algorithm is implemented here 
    149149        // 
    150          
     150 
    151151        GA_tree * starttree; 
    152152        GA_job *job; 
    153153        int cluster; 
    154154 
    155          
     155 
    156156        if (GAgenetic == 0) { 
    157157                GAgenetic = new GA_genetic; 
     
    168168 
    169169        while (i<GAgenetic->getMaxCluster()) { 
    170                 cluster = i;     
     170                cluster = i; 
    171171                while ((starttree = GAgenetic->get_start_tree(cluster)) != 0){ 
    172172                        if (starttree != 0) { 
     
    196196                                GA_tree * gaTree = new GA_tree; 
    197197                                gaTree->tree = crossover(job->tree0->tree,job->tree1->tree); 
    198                                  
     198 
    199199                                GB_push_transaction(gb_main); 
    200200                                char *use =GBT_get_default_alignment(gb_main); 
     
    229229        } 
    230230} 
    231                  
    232  
    233  
    234  
     231 
     232 
     233 
     234 
  • trunk/PARSIMONY/GA_window.cxx

    r2 r655  
    1313#include <aw_display.hxx> 
    1414#include <awt.hxx> 
    15 #include <malloc.h> 
     15// #include <malloc.h> 
    1616#include "AP_buffer.hxx" 
    1717#include "parsimony.hxx" 
     
    3737        AWUSE(cld1); 
    3838        AW_root *aw_root = aww->get_root(); 
    39          
     39 
    4040} 
    4141 
     
    7373} 
    7474 
    75 AW_window *create_genetic_window(AW_root *aw_root,AW_display *awd)  
     75AW_window *create_genetic_window(AW_root *aw_root,AW_display *awd) 
    7676{ 
    77      
     77 
    7878        AW_window_simple *aws = new AW_window_simple; 
    7979        aws->init( aw_root, "GENETIC_MAIN", "Kernighan", 10, 10 ); 
    8080        aws->load_xfig("ph_gen.fig"); 
    8181        aws->button_length( 10 ); 
    82          
     82 
    8383        aws->at("close"); 
    8484        aws->callback((AW_CB0)AW_POPDOWN); 
    85         aws->create_button("CLOSE","CLOSE","C");                            
    86          
     85        aws->create_button("CLOSE","CLOSE","C"); 
     86 
    8787 
    8888        aws->at("start"); 
    8989        aws->callback((AW_CB1)start_genetic_cb,(AW_CL)awd); 
    90         aws->create_button("START","START","S");                            
    91          
     90        aws->create_button("START","START","S"); 
     91 
    9292        aws->at("save"); 
    9393        aws->callback((AW_CB1)save_genetic_cb,(AW_CL)aw_root); 
    94         aws->create_button("SAVE","SAVE","S");                      
    95          
     94        aws->create_button("SAVE","SAVE","S"); 
     95 
    9696        aws->at("quit"); 
    9797        aws->callback((AW_CB1)quit_genetic_cb,(AW_CL)aw_root); 
    98         aws->create_button("QUIT","QUIT","Q");                      
     98        aws->create_button("QUIT","QUIT","Q"); 
    9999 
    100100        aws->at("savetree"); 
    101101        aws->callback((AW_CB1)savetree_genetic_cb,(AW_CL)aw_root); 
    102         aws->create_button("SAVETREE","SaveTree","Q");                      
     102        aws->create_button("SAVETREE","SaveTree","Q"); 
    103103 
    104104        aws->at("jobs"); 
     
    113113        aws->create_input_field("genetic/presets/jobOther",8); 
    114114        aws->at("curCluster"); 
    115         aws->create_input_field("genetic/presets/curCluster",8);         
     115        aws->create_input_field("genetic/presets/curCluster",8); 
    116116        aws->at("maxTree"); 
    117117        aws->create_input_field("genetic/presets/maxTree",8); 
     
    121121        aws->at("jobCount"); 
    122122        aws->create_label("genetic/presets/jobCount",8); 
    123         
     123 
    124124        return (AW_window *)aws; 
    125125 
    126126} 
    127          
     127 
  • trunk/PARSIMONY/PARS_klprops.cxx

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <arbdb.h> 
    55#include <arbdbt.h> 
     
    2828 
    2929AW_window *create_kernighan_window(AW_root *aw_root) { 
    30      
     30 
    3131        AW_window_simple *aws = new AW_window_simple; 
    3232        aws->init( aw_root, "OPTIMIZATION_PROPS", "Kernighan Lin Properties", 10, 10 ); 
    3333        aws->load_xfig("PARS/kernlin.fig"); 
    3434        aws->button_length( 10 ); 
    35          
     35 
    3636        aws->at("close"); 
    3737        aws->callback((AW_CB0)AW_POPDOWN); 
    38         aws->create_button("CLOSE","CLOSE","C");                            
    39          
    40          
     38        aws->create_button("CLOSE","CLOSE","C"); 
     39 
     40 
    4141        aws->at("help"); 
    4242        aws->callback((AW_CB1)AW_POPUP_HELP,(AW_CL)"kernlin.hlp"); 
    43         aws->create_button("HELP","HELP","H");                      
    44          
     43        aws->create_button("HELP","HELP","H"); 
     44 
    4545        aws->button_length( 6 ); 
    4646 
     
    6868        aws->create_input_field("genetic/kh/static/depth4"); 
    6969 
    70          
     70 
    7171        aws->at("dynamic"); 
    7272        aws->create_toggle("genetic/kh/dynamic/enable"); 
     
    8080        aws->create_input_field("genetic/kh/dynamic/maxy"); 
    8181 
    82 #if 0    
     82#if 0 
    8383        aws->at("button_4"); 
    8484        aws->create_option_menu("genetic/kh/function_type",0,""); 
     
    9090        return (AW_window *)aws; 
    9191} 
    92          
     92 
  • trunk/PARSIMONY/PARS_main.cxx

    r563 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <iostream.h> 
    66#include <limits.h> 
  • trunk/PHYLO/include.hxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <iostream.h> 
  • trunk/PRIMER_DESIGN/primer_design.cxx

    r478 r655  
    151151#endif 
    152152        } 
     153 
     154#ifdef DARWIN 
     155                // This seems to generate an internal compiler error with gcc 2.95 on OSX 
     156#else 
    153157        catch (string& s) { 
    154158            error = GBS_global_string(s.c_str()); 
    155159        } 
     160#endif 
    156161        catch (...) { 
    157162            error = "Unknown error (maybe out of memory ? )"; 
  • trunk/PROBE/PT_buildtree.cxx

    r244 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <unistd.h> 
    66#include <PT_server.h> 
  • trunk/PROBE/PT_etc.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <memory.h> 
    66#include <PT_server.h> 
     
    1515    int i; 
    1616    psg.w_N_mismatches[0] = 0; 
    17     psg.w_N_mismatches[1] = 0;   
    18     psg.w_N_mismatches[2] = 1;   
     17    psg.w_N_mismatches[1] = 0; 
     18    psg.w_N_mismatches[2] = 1; 
    1919    psg.w_N_mismatches[3] = 2; 
    2020    psg.w_N_mismatches[4] = 4; 
     
    3232{ 
    3333    return psg.data[ml->name].name; 
    34 }        
     34} 
    3535 
    3636extern "C" char *virt_fullname(PT_probematch * ml) { 
     
    4141    } 
    4242} 
    43      
     43 
    4444/* copy one mismatch table to a new one allocating memory */ 
    4545int *table_copy(int *mis_table, int length) 
     
    4747    int *result_table; 
    4848    int i; 
    49          
     49 
    5050    result_table = (int *)calloc(length, sizeof(int)); 
    5151    for (i=0; i<length; i++) 
     
    6060        mis_tabled[i] += mis_tables[i]; 
    6161} 
    62   
     62 
    6363/* read the name list seperated by # and set the flag for the group members, + returns a list of names which have not been found */ 
    6464char *ptpd_read_names(PT_local * locs, char *names_listi, char *checksumsi) 
     
    173173            if (!i) str[i]=255; /* end flag */ 
    174174        }else{ 
    175             break;       
     175            break; 
    176176        } 
    177177    } 
    178 }        
     178} 
  • trunk/PROBE/PT_family.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <PT_server.h> 
    66#include <struct_man.h> 
     
    5050             */ 
    5151            while (mismatches <= max_mismatches && *probe) { 
    52                 if (psg.data[ref_name].data[ref_pos++] != *probe) {      
     52                if (psg.data[ref_name].data[ref_pos++] != *probe) { 
    5353                    mismatches++; 
    5454                } 
     
    8989    return 0; 
    9090} 
    91   
     91 
    9292/* Clear all informations in psg.data[i].stat */ 
    9393void clear_statistic(){ 
     
    124124        struct probe_input_data *d1 = (struct probe_input_data*)pid_ptr1; 
    125125        struct probe_input_data *d2 = (struct probe_input_data*)pid_ptr2; 
    126      
     126 
    127127        if (d1->stat.match_count < d2->stat.match_count) return 1; 
    128128        if (d1->stat.match_count == d2->stat.match_count) return 0; 
     
    133133        struct probe_input_data *d1 = (struct probe_input_data*)pid_ptr1; 
    134134        struct probe_input_data *d2 = (struct probe_input_data*)pid_ptr2; 
    135      
     135 
    136136        if (d1->stat.rel_match_count < d2->stat.rel_match_count) return 1; 
    137137        if (d1->stat.rel_match_count == d2->stat.rel_match_count) return 0; 
     
    172172        fl->matches = my_list[i]->stat.match_count; 
    173173        fl->rel_matches = my_list[i]->stat.rel_match_count; 
    174         aisc_link((struct_dllpublic_ext*)&locs->pfl,(struct_dllheader_ext*)fl);  
     174        aisc_link((struct_dllpublic_ext*)&locs->pfl,(struct_dllheader_ext*)fl); 
    175175    } 
    176176    free((char *)my_list); 
     
    223223                                        mark_all_matches(locs,psg.pt,probe,probe_len,0,0,mismatch_nr); 
    224224        } 
    225                  
     225 
    226226    make_match_statistic(locs->pr_len); 
    227227    make_PT_family_list(locs); 
  • trunk/PROBE/PT_findEx.cxx

    r133 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55 
    66#include <PT_server.h> 
  • trunk/PROBE/PT_io.cxx

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <memory.h> 
    55#include <string.h> 
     
    1111 
    1212 
    13 /* change a sequence with normal bases the PT_? format and delete all other signs */  
     13/* change a sequence with normal bases the PT_? format and delete all other signs */ 
    1414int compress_data(char *probestring) 
    1515{ 
     
    1818        *dest; 
    1919    dest = src = probestring; 
    20          
     20 
    2121    while((c=*(src++))) 
    2222    { 
     
    3636            default: break; 
    3737        } 
    38                  
     38 
    3939    } 
    4040    *dest = PT_QU; 
     
    5050    if (!len) len = strlen(id_string); 
    5151    dest = src = id_string; 
    52          
     52 
    5353    while((len--)>0){ 
    5454        c=*(src++); 
     
    6262            default: *(dest++) = c;break; 
    6363        } 
    64                  
     64 
    6565    } 
    6666    *dest = '\0'; 
     
    100100        tab['T'] = tab['t'] = PT_T; 
    101101        tab['U'] = tab['u'] = PT_T; 
    102         tab['.'] = PT_QU;                 
    103     } 
    104                  
     102        tab['.'] = PT_QU; 
     103    } 
     104 
    105105    char *dest; 
    106106    uchar c; 
  • trunk/PROBE/PT_new_design.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55 
    66#include <PT_server.h> 
     
    4949    PT_tprobes *tprobe1 = (PT_tprobes*)PT_tprobes_ptr1; 
    5050    PT_tprobes *tprobe2 = (PT_tprobes*)PT_tprobes_ptr2; 
    51          
     51 
    5252    if (tprobe1->quality < tprobe2->quality) return 1; 
    5353    return -1; 
     
    5656    PT_tprobes *tprobe1 = (PT_tprobes*)PT_tprobes_ptr1; 
    5757    PT_tprobes *tprobe2 = (PT_tprobes*)PT_tprobes_ptr2; 
    58          
     58 
    5959    return strcmp(tprobe1->sequence,tprobe2->sequence); 
    60 }     
     60} 
    6161 
    6262void ptnd_sort_probes_by(PT_pdc *pdc, int mode) /* mode 0 quality 
     
    8484            break; 
    8585    } 
    86                          
     86 
    8787    for (i=0;i<list_len;i++) { 
    8888        aisc_unlink((struct_dllheader_ext*)my_list[i]); 
     
    174174***********************************************************************/ 
    175175/* count all mishits for a probe */ 
    176          
     176 
    177177int ptnd_chain_count_mishits(int name, int apos, int rpos, long dummy) 
    178178{ 
     
    192192    return 0; 
    193193} 
    194          
     194 
    195195/* go down the tree to chains and leafs; count the species that are in the non member group */ 
    196196int ptnd_count_mishits2(POS_TREE *pt) 
     
    199199    int name; 
    200200    int mishits = 0; 
    201          
     201 
    202202    if (pt == NULL) 
    203203        return 0; 
     
    206206        int apos = PT_read_apos(psg.ptmain,pt); 
    207207        if (apos>psg.apos) psg.apos = apos; 
    208         if (!psg.data[name].is_group)   return 1;        
     208        if (!psg.data[name].is_group)   return 1; 
    209209        return 0; 
    210210    }else if (PT_read_type(pt) == PT_NT_CHAIN) { 
     
    216216        for (base = PT_QU; base< PT_B_MAX; base++) { 
    217217            mishits += ptnd_count_mishits2(PT_read_son(psg.ptmain,pt,(PT_BASES)base)); 
    218         }                
     218        } 
    219219        return mishits; 
    220220    } 
     
    308308    s += strlen(s); 
    309309 
    310     sprintf(s,"%2s %4s   %4s ","le","apos","ecol");  
     310    sprintf(s,"%2s %4s   %4s ","le","apos","ecol"); 
    311311    s += strlen(s); 
    312312 
     
    325325 
    326326    return buffer; 
    327 }     
     327} 
    328328 
    329329/* search down the tree to find matching species for the given probe */ 
     
    346346    } 
    347347    if (*probe) { 
    348         if (PT_read_type(pt) == PT_NT_LEAF) {  
     348        if (PT_read_type(pt) == PT_NT_LEAF) { 
    349349            pos = PT_read_rpos(psg.ptmain,pt) + height; 
    350350            name = PT_read_name(psg.ptmain,pt); 
    351351            if (pos + (int)(strlen(probe)) >= psg.data[name].size)              /* after end */ 
    352352                return 0; 
    353                          
     353 
    354354            while (*probe) { 
    355355                if (psg.data[name].data[pos++] != *(probe++)) 
     
    362362            PT_read_chain(psg.ptmain,pt, ptnd_chain_count_mishits, 0); 
    363363            return ptnd.mishits; 
    364         }        
    365     } 
    366     return ptnd_count_mishits2(pt);      
     364        } 
     365    } 
     366    return ptnd_count_mishits2(pt); 
    367367} 
    368368 
     
    470470    for (i = PT_A; i <=PT_T; i++) { 
    471471        sequence[deep] = i; 
    472         if ( (split = ptnd_check_split(pdc, insequence, deep, i)) < 0.0) continue;  
     472        if ( (split = ptnd_check_split(pdc, insequence, deep, i)) < 0.0) continue; 
    473473        /* this mismatch splits the probe in several domains */ 
    474474        ndt = split + dt; 
     
    486486    while (( parts = pdc->parts )) 
    487487        destroy_PT_probeparts(parts);   /* delete the source */ 
    488          
     488 
    489489    while (( parts = pdc->dparts )) 
    490490    { 
     
    500500    PT_probeparts *tprobe1 = (PT_probeparts*)PT_probeparts_ptr1; 
    501501    PT_probeparts *tprobe2 = (PT_probeparts*)PT_probeparts_ptr2; 
    502          
     502 
    503503    return strcmp(tprobe1->sequence,tprobe2->sequence); 
    504504} 
     
    520520    } 
    521521    GB_mergesort((void **)my_list,0,list_len,ptnd_compare_parts,0); 
    522                          
     522 
    523523    for (i=0;i<list_len;i++) { 
    524524        aisc_unlink((struct_dllheader_ext*)my_list[i]); 
     
    560560    char        *probe; 
    561561    int split; 
    562          
     562 
    563563    if (( start = parts->start )) {             /* look backwards */ 
    564564        probe = parts->source->sequence; 
     
    576576        } 
    577577    } 
    578     ndt =       (       dt * pdc->dt +  
     578    ndt =       (       dt * pdc->dt + 
    579579                (tprobe->sum_bonds - sum_bonds)*pdc->dte        ) 
    580580        /tprobe->seq_len; 
     
    607607{ 
    608608    PT_tprobes *tprobe = parts->source; 
    609     double ndt =        (       dt * pdc->dt +  
     609    double ndt =        (       dt * pdc->dt + 
    610610                        (tprobe->sum_bonds - sum_bonds)*pdc->dte        ) 
    611611        /tprobe->seq_len; 
     
    614614    return 0; 
    615615} 
    616          
     616 
    617617int ptnd_chain_check_part(int name, int apos, int rpos, long split) 
    618618{ 
     
    627627    if (probe) { 
    628628        pos = rpos+psg.height; 
    629         while (probe[height] && (base = psg.data[name].data[pos])) {     
     629        while (probe[height] && (base = psg.data[name].data[pos])) { 
    630630            if (!split && (h = ptnd_check_split(ptnd.pdc, probe, height, 
    631631                                                base) < 0.0) ){ 
     
    642642    return 0; 
    643643} 
    644          
     644 
    645645/* go down the tree to chains and leafs; check all  */ 
    646646void ptnd_check_part_all(POS_TREE *pt, double dt, double sum_bonds) 
     
    648648    int base; 
    649649    int name, apos, rpos; 
    650          
     650 
    651651    if (pt == NULL) 
    652652        return; 
     
    666666        for (base = PT_QU; base< PT_B_MAX; base++) { 
    667667            ptnd_check_part_all(PT_read_son(psg.ptmain,pt,(PT_BASES)base),dt,sum_bonds); 
    668         }                
     668        } 
    669669    } 
    670670} 
     
    680680    int ref; 
    681681    if (!pt) return; 
    682     if (dt/ptnd.parts->source->seq_len > PERC_SIZE) return;     /* out of scope */  
     682    if (dt/ptnd.parts->source->seq_len > PERC_SIZE) return;     /* out of scope */ 
    683683    if (PT_read_type(pt) == PT_NT_NODE && probe[height]) { 
    684684        if (split && ptnd_check_inc_mode(ptnd.pdc ,ptnd.parts, dt, sum_bonds)) return; 
     
    700700                    }else{ 
    701701                        ndt = dt + h; 
    702                         nsum_bonds +=  
    703                             ptnd_check_max_bond(ptnd.pdc,probe[height]) - h;     
     702                        nsum_bonds += 
     703                            ptnd_check_max_bond(ptnd.pdc,probe[height]) - h; 
    704704                    } 
    705705                } 
     
    711711    } 
    712712    if (probe[height]) { 
    713         if (PT_read_type(pt) == PT_NT_LEAF) {  
     713        if (PT_read_type(pt) == PT_NT_LEAF) { 
    714714            name = PT_read_name(psg.ptmain,pt); 
    715715            if (!ptnd.new_match && psg.data[name].is_group)     return; 
     
    743743            PT_read_chain(psg.ptmain,pt, ptnd_chain_check_part, split); 
    744744            return; 
    745         }        
    746     } 
    747     ptnd_check_part_all(pt,dt,sum_bonds);        
     745        } 
     746    } 
     747    ptnd_check_part_all(pt,dt,sum_bonds); 
    748748} 
    749749void ptnd_check_probepart(PT_pdc *pdc) 
     
    802802} 
    803803 
    804 void ptnd_add_sequence_to_hash(PT_pdc *pdc, GB_HASH *hash, register char *sequence, int seq_len, register int probe_len, char *prefix, int prefix_len){  
     804void ptnd_add_sequence_to_hash(PT_pdc *pdc, GB_HASH *hash, register char *sequence, int seq_len, register int probe_len, char *prefix, int prefix_len){ 
    805805    register int pos; 
    806806    register int c; 
     
    847847    PT_init_base_string_counter(partstring,PT_A,partsize); 
    848848    while (!PT_base_string_counter_eof(partstring)) { 
    849         hash = GBS_create_hash(defhash,0); // count in how many groups/sequences the tprobe occurs  
    850          
     849        hash = GBS_create_hash(defhash,0); // count in how many groups/sequences the tprobe occurs 
     850 
    851851        for (name = 0; name < psg.data_count; name++) { 
    852852            if(psg.data[name].is_group<=0) continue; 
    853              
     853 
    854854            GB_HASH *hash_one = GBS_create_hash(defhash,0); // count tprobe occurances for one group/sequence 
    855855            ptnd_add_sequence_to_hash(pdc, hash_one, psg.data[name].data, psg.data[name].size, pdc->probelen, partstring, partsize); 
     
    925925    ptnd_probe_delete_all_but(pdc,pdc->clipresult); 
    926926    /* ptnd_print_probes(pdc); */ 
    927      
     927 
    928928    return 0; 
    929 }     
     929} 
    930930 
    931931void ptnd_new_match(PT_local * locs, char *probestring) 
  • trunk/PROBE/PT_prefixtree.cxx

    r237 r655  
    33#include <sys/types.h> 
    44#include <sys/mman.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <memory.h> 
    77#include <PT_server.h> 
  • trunk/PROBE/PT_secundaer.cxx

    r2 r655  
    11#include <stdio.h> 
    2 #include <malloc.h> 
     2// #include <malloc.h> 
    33#include <stdlib.h> 
    44#include <string.h> 
  • trunk/PROBE_COM/PT_extern.c

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3/* #include <malloc.h> */ 
    44#include <string.h> 
    55#include "PT_server.h" 
     
    1111// this source is compiled as C++ !!! 
    1212 
    13 extern "C" int pt_init_bond_matrix(PT_pdc *THIS); 
     13#ifdef __cplusplus 
     14extern "C" { 
     15#endif 
     16 
     17    int pt_init_bond_matrix(PT_pdc *THIS); 
     18 
     19#ifdef __cplusplus 
     20} 
     21#endif 
    1422 
    1523int init_bond_matrix(PT_pdc *THIS) { 
     
    2129extern "C" { 
    2230#endif 
    23      
     31 
    2432    //    aisc_callback_func_proto(destroy_PT_local); /* prototyp */ 
    2533 
     
    2735        destroy_PT_local(THIS); 
    2836    } 
    29      
     37 
    3038#ifdef __cplusplus 
    3139} 
    3240#endif 
    33      
     41 
    3442int pt_init_socket(PT_local *THIS) { 
    3543    return aisc_add_destroy_callback((aisc_callback_func)pt_destroy_locs,(long)THIS); 
    3644} 
    3745 
    38 void  pt_destroy_socket(PT_local *THIS){         
     46void  pt_destroy_socket(PT_local *THIS){ 
    3947    THIS = THIS; 
    4048    aisc_remove_destroy_callback(); 
  • trunk/PROBE_DESIGN/probe_design.cxx

    r569 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66#include <ctype.h> 
  • trunk/SERVERCNTRL/servercntrl.c

    r599 r655  
    33#include <unistd.h> 
    44#include <string.h> 
    5 #include <malloc.h> 
     5/* #include <malloc.h> */ 
    66#include <client_privat.h> 
    77#include <client.h> 
  • trunk/SOURCE_TOOLS/generate_all_links.sh

    r642 r655  
    1 #!/bin/sh 
     1#!/bin/tcsh 
    22 
    33# Liblink 
     
    2626 
    2727# Motif stuff 
    28 ln -s ../Motif/libXm.so.2 LIBLINK/libXm.so.2 
    29 ln -s /usr/lib/Motif1.2/libXm.1 LIBLINK/libXm.sl 
     28ln -s $MOTIF_LIBPATH LIBLINK/libXm.so.3 
     29ln -s $LIBDIR/libXm.1.dylib LIBLINK/libXm.sl 
    3030 
    3131# Links in bin directory 
  • trunk/STAT/ST_ml.cxx

    r645 r655  
    44#include <math.h> 
    55#include <memory.h> 
    6 #include <malloc.h> 
     6// #include <malloc.h> 
    77#include <ctype.h> 
    88#include <arbdb.h> 
  • trunk/TEST/test_pt_compress.cxx

    r2 r655  
    22#include <string.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <arbdb.h> 
    66#include <arbdbt.h> 
     
    116116                rel_2_abs = (long *)calloc(sizeof(long),memsize); 
    117117        } 
    118          
     118 
    119119        if (rel >= memsize) { 
    120120                memsize = memsize * MEM_ALLOC_FACTOR; 
     
    137137 
    138138void client_gap_compress::basic_write(long rel, long x, long y){ 
    139          
     139 
    140140        if (rel >= memsize) { 
    141141                memsize = (int)rel * MEM_ALLOC_FACTOR; 
     
    172172                cgc_search_by_divide: 
    173173                long l; 
    174                 l = 0; r = master->len-1;        
     174                l = 0; r = master->len-1; 
    175175                while (l<r-1) {                 // search the masters rel_2_abs[?] == abs 
    176176                        m = (l+r)>>1; 
     
    188188} 
    189189 
    190         // remove (eval. ) duplicated entries in client compress  
     190        // remove (eval. ) duplicated entries in client compress 
    191191        //  eg.   (4,20,5) (5,21,5) -> delete second 
    192192 
     
    383383        master->ref_cnt++; 
    384384 
    385         if (nmasters >= MAX_MASTERS) {  // maximum masters exceeded delete  
     385        if (nmasters >= MAX_MASTERS) {  // maximum masters exceeded delete 
    386386                int j;                  // search single refed masters and search new master 
    387387                                        // for the only single child 
     
    403403                        nmasters--; 
    404404                        delete masters[i]; 
    405                 }        
     405                } 
    406406        } 
    407407 
     
    583583 
    584584        // pt_species_class::set destroys the sequence !!!!!! 
    585         // name and fullname must be a new copy  
     585        // name and fullname must be a new copy 
    586586void pt_species_class::set(char *sequence, long seq_len, char *name, char *fullname){ 
    587587        delete this->fullname; 
     
    621621                        case 'T': 
    622622                        case 't': *(dest++) = PT_T;*(abs++) = '+';SET_NN; break; 
    623                         case '.': *(dest)++ = PT_QU;*(abs++) = '+';  
     623                        case '.': *(dest)++ = PT_QU;*(abs++) = '+'; 
    624624                                        while (*src =='.') { src++; *(abs++) = '-'; } 
    625625                                        SET_NN; 
     
    637637                                break; 
    638638                } 
    639                  
     639 
    640640        } 
    641641        *dest = PT_QU; 
     
    717717 
    718718pt_main_class::~pt_main_class(void) { 
    719         GB_CORE;         
     719        GB_CORE; 
    720720} 
    721721 
     
    925925} 
    926926 
    927 int  
     927int 
    928928main(int argc, char **argv) 
    929929{ 
     
    956956} 
    957957 
    958 #if 0  
     958#if 0 
    959959        char            *cmp; 
    960960        int             i; 
  • trunk/TESTAWT/TB_main.cxx

    r2 r655  
    33 * 
    44 * Description: demonstration of the use of AWT and WINDOW libraries, as 
    5  *              a testbed for the vectorfont functions  
    6  *  
     5 *              a testbed for the vectorfont functions 
     6 * 
    77 * Integration Notes: use the callback in TB_extern.cxx for your own stuff 
    88 * 
     
    1414 * 
    1515 * $Log$ 
    16  * Revision 1.1  2000/11/23 09:41:16  westram 
    17  * Initial revision 
     16 * Revision 1.2  2002/06/20 14:08:06  westram 
     17 * Mac OSX patches from Ben Hines 
     18 * 
     19 * Revision 1.1.1.1  2000/11/23 09:41:16  westram 
     20 * Erster Import 
    1821 * 
    1922 * Revision 1.2  1995/03/13  16:53:19  jakobi 
     
    2629#include <stdio.h> 
    2730#include <stdlib.h> 
    28 #include <malloc.h> 
     31// #include <malloc.h> 
    2932 
    3033 
     
    4447 
    4548// my own stuff 
    46 #define EXTERNAL  
     49#define EXTERNAL 
    4750#include "tb_extern.hxx" 
    4851 
     
    5356 
    5457// required dummy for AWT, even if you don't use trees... 
    55 void AD_map_viewer(gb_data_base_type *dummy)  
     58void AD_map_viewer(gb_data_base_type *dummy) 
    5659{ 
    5760     AWUSE(dummy); 
     
    6669        AW_default aw_default; 
    6770        AW_window *aww; 
    68          
     71 
    6972        // db is *not* used, so we don't care about transactions 
    7073        // for getting an non-empty db for getting an empty tree for getting the canvas ... 
     
    108111        aw_root->create_float("tbd_alignmenty",&tbd_alignmenty,aw_default,0.0); 
    109112        aw_root->create_float("tbd_rotation",&tbd_rotation,aw_default,0.0); 
    110          
    111         // open the main window  
     113 
     114        // open the main window 
    112115        aww = create_tb_main_window(aw_root); 
    113116        aww->show(); 
  • trunk/TESTVECTORFONT/TB_main.cxx

    r2 r655  
    33 * 
    44 * Description: demonstration of the use of AWT and WINDOW libraries, as 
    5  *              a testbed for the vectorfont functions  
    6  *  
     5 *              a testbed for the vectorfont functions 
     6 * 
    77 * Integration Notes: use the callback in TB_extern.cxx for your own stuff 
    88 * 
     
    1414 * 
    1515 * $Log$ 
    16  * Revision 1.1  2000/11/23 09:41:16  westram 
    17  * Initial revision 
     16 * Revision 1.2  2002/06/20 14:08:06  westram 
     17 * Mac OSX patches from Ben Hines 
     18 * 
     19 * Revision 1.1.1.1  2000/11/23 09:41:16  westram 
     20 * Erster Import 
    1821 * 
    1922 * Revision 1.2  1995/03/13  16:53:19  jakobi 
     
    2629#include <stdio.h> 
    2730#include <stdlib.h> 
    28 #include <malloc.h> 
     31// #include <malloc.h> 
    2932 
    3033 
     
    4548 
    4649// my own stuff 
    47 #define EXTERNAL  
     50#define EXTERNAL 
    4851#include "tb_extern.hxx" 
    4952 
     
    5457 
    5558// required dummy for AWT, even if you don't use trees... 
    56 void AD_map_viewer(gb_data_base_type *dummy)  
     59void AD_map_viewer(gb_data_base_type *dummy) 
    5760{ 
    5861     AWUSE(dummy); 
     
    6770        AW_default aw_default; 
    6871        AW_window *aww; 
    69          
     72 
    7073        // db is *not* used, so we don't care about transactions 
    7174        // for getting an non-empty db for getting an empty tree for getting the canvas ... 
     
    109112        aw_root->create_float("tbd_alignmenty",&tbd_alignmenty,aw_default,0.0); 
    110113        aw_root->create_float("tbd_rotation",&tbd_rotation,aw_default,0.0); 
    111          
    112         // open the main window  
     114 
     115        // open the main window 
    113116        aww = create_tb_main_window(aw_root); 
    114117        aww->show(); 
  • trunk/TOOLS/arb_count_chars.cxx

    r2 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <string.h> 
    55#include <ctype.h> 
     
    1818 
    1919    printf("Counting the number of different chars of all marked sequences\n"); 
    20      
     20 
    2121    GBDATA *gb_main     = GB_open(":","rw");    // open database 
    2222    if (!gb_main){ 
     
    2424        return -1; 
    2525    } 
    26      
     26 
    2727    GB_begin_transaction(gb_main); // open transaction 
    2828 
     
    5858    int slider = 0; 
    5959    int all_marked = GBT_count_marked_species(gb_main); 
    60      
     60 
    6161    for (GBDATA *gb_species = GBT_first_marked_species(gb_main); 
    6262         gb_species; 
     
    9494        } 
    9595    } 
    96      
     96 
    9797    {                           // save result as SAI  counted_chars 
    9898            GBDATA *gb_sai = GBT_create_SAI(gb_main,RESULTNAME); 
     
    110110    GB_close(gb_main);          // politely disconnect from server 
    111111    return 0; 
    112              
     112 
    113113} 
  • trunk/TOOLS/arb_dnarates.c

    r618 r655  
    2121#include <stdlib.h> 
    2222#include <unistd.h> 
    23 #include <malloc.h> 
     23/* #include <malloc.h> */ 
    2424#include <string.h> 
    2525#include <math.h> 
  • trunk/TOOLS/arb_primer.cxx

    r646 r655  
    11#include <stdio.h> 
    22#include <stdlib.h> 
    3 #include <malloc.h> 
     3// #include <malloc.h> 
    44#include <string.h> 
    55#include <arbdb.h> 
  • trunk/TOOLS/arb_probe.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <string.h> 
    66 
     
    9898    T_PT_TPROBE tprobe; 
    9999    bytestring bs; 
    100     char *match_info;  
     100    char *match_info; 
    101101 
    102102    if( !(servername=(char *)probe_pt_look_for_server()) ){ 
     
    150150                    0); 
    151151    } 
    152          
     152 
    153153    aisc_put(pd_gl.link,PT_PDC, pdc, 
    154154             PDC_NAMES,&bs, 
     
    158158    { 
    159159        char *locs_error = 0; 
    160         if (aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs,  
     160        if (aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs, 
    161161                      LOCS_ERROR        ,&locs_error, 
    162162                      0)){ 
     
    170170    } 
    171171 
    172     aisc_get( pd_gl.link, PT_PDC, pdc,  
     172    aisc_get( pd_gl.link, PT_PDC, pdc, 
    173173              PDC_TPROBE, &tprobe, 
    174174              0); 
    175175 
    176          
     176 
    177177    if (tprobe) { 
    178178        aisc_get( pd_gl.link, PT_TPROBE, tprobe, 
     
    250250    bytestring bs; 
    251251    bs.data = 0; 
    252     aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs,  
     252    aisc_get( pd_gl.link, PT_LOCS, pd_gl.locs, 
    253253              LOCS_MATCH_LIST,  &match_list, 
    254254              LOCS_MATCH_LIST_CNT,      &match_list_cnt, 
  • trunk/TREEGEN/defines.h

    r2 r655  
    22#define __DEFINES_H 
    33 
    4 #ifndef __MALLOC_H 
    5     #include <malloc.h> 
    6 #endif 
     4// #ifndef __MALLOC_H 
     5//     #include <malloc.h> 
     6// #endif 
    77#ifndef __STDIO_H 
    88    #include <stdio.h> 
  • trunk/TREE_COMPRESS/TC_main.cxx

    r2 r655  
    22#include <string.h> 
    33#include <memory.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <arbdb.h> 
    66#include <arbdbt.h> 
     
    116116                rel_2_abs = (long *)calloc(sizeof(long),memsize); 
    117117        } 
    118          
     118 
    119119        if (rel >= memsize) { 
    120120                memsize = memsize * MEM_ALLOC_FACTOR; 
     
    137137 
    138138void client_gap_compress::basic_write(long rel, long x, long y){ 
    139          
     139 
    140140        if (rel >= memsize) { 
    141141                memsize = (int)rel * MEM_ALLOC_FACTOR; 
     
    172172                cgc_search_by_divide: 
    173173                long l; 
    174                 l = 0; r = master->len-1;        
     174                l = 0; r = master->len-1; 
    175175                while (l<r-1) {                 // search the masters rel_2_abs[?] == abs 
    176176                        m = (l+r)>>1; 
     
    188188} 
    189189 
    190         // remove (eval. ) duplicated entries in client compress  
     190        // remove (eval. ) duplicated entries in client compress 
    191191        //  eg.   (4,20,5) (5,21,5) -> delete second 
    192192 
     
    383383        master->ref_cnt++; 
    384384 
    385         if (nmasters >= MAX_MASTERS) {  // maximum masters exceeded delete  
     385        if (nmasters >= MAX_MASTERS) {  // maximum masters exceeded delete 
    386386                int j;                  // search single refed masters and search new master 
    387387                                        // for the only single child 
     
    403403                        nmasters--; 
    404404                        delete masters[i]; 
    405                 }        
     405                } 
    406406        } 
    407407 
     
    583583 
    584584        // pt_species_class::set destroys the sequence !!!!!! 
    585         // name and fullname must be a new copy  
     585        // name and fullname must be a new copy 
    586586void pt_species_class::set(char *sequence, long seq_len, char *name, char *fullname){ 
    587587        delete this->fullname; 
     
    621621                        case 'T': 
    622622                        case 't': *(dest++) = PT_T;*(abs++) = '+';SET_NN; break; 
    623                         case '.': *(dest)++ = PT_QU;*(abs++) = '+';  
     623                        case '.': *(dest)++ = PT_QU;*(abs++) = '+'; 
    624624                                        while (*src =='.') { src++; *(abs++) = '-'; } 
    625625                                        SET_NN; 
     
    637637                                break; 
    638638                } 
    639                  
     639 
    640640        } 
    641641        *dest = PT_QU; 
     
    717717 
    718718pt_main_class::~pt_main_class(void) { 
    719         GB_CORE;         
     719        GB_CORE; 
    720720} 
    721721 
     
    925925} 
    926926 
    927 int  
     927int 
    928928main(int argc, char **argv) 
    929929{ 
     
    956956} 
    957957 
    958 #if 0  
     958#if 0 
    959959        char            *cmp; 
    960960        int             i; 
  • trunk/TRS/tree_lib.cxx

    r2 r655  
    1 /*  
     1/* 
    22####################################### 
    33#                                     # 
     
    1111#include <string.h> 
    1212#include <memory.h> 
    13 #include <malloc.h> 
     13// #include <malloc.h> 
    1414#include <stdarg.h> 
    1515#include <sys/stat.h> 
     
    4040    sprintf (buffer,"ARB ERROR: "); 
    4141    p += strlen(p); 
    42     va_start(parg,templat);      
     42    va_start(parg,templat); 
    4343 
    4444    vsprintf(p,templat,parg); 
     
    159159                                        read a file to memory 
    160160********************************************************************************************/ 
    161 char *TRS_read_file(const char *path)  
     161char *TRS_read_file(const char *path) 
    162162{ 
    163163    FILE *input; 
     
    267267        fputc(o,t2j_out); 
    268268        t2j_last_nibble = -1; 
    269     }    
     269    } 
    270270} 
    271271 
     
    571571} 
    572572/*********************************************************************** 
    573         Send the tree.   level numbering !!! branch lengths from 0-15  
     573        Send the tree.   level numbering !!! branch lengths from 0-15 
    574574        Sideeffects: writes to out 
    575575***********************************************************************/ 
     
    607607        if node.color == 0 -> prune node 
    608608        add addbl to branch length 
    609          
     609 
    610610***********************************************************************/ 
    611611#define SEPERATOR '\'' 
     
    635635        } 
    636636    } 
    637      
     637 
    638638    CAT_node *ln = &cat_tree->nodes[node->leftson]; 
    639639    CAT_node *rn = &cat_tree->nodes[node->rightson]; 
    640      
     640 
    641641    if ( (ln->color & rn->color ) == 0){        // prune tree, descend into only one branch 
    642642        if (ln->color != 0){ 
     
    647647        return; 
    648648    } 
    649      
     649 
    650650    if (!node->is_grouped){ 
    651651        fprintf(out,"("); 
     
    733733} 
    734734 
    735              
     735 
    736736char *T2J_send_newick_tree(const char *path_of_tree, 
    737737                           char *changedNodes, 
     
    750750        } 
    751751    } 
    752      
     752 
    753753    T2J_set_color_of_selection(selectedNodes); 
    754      
     754 
    755755    { 
    756756        int i; 
     
    920920            node->user_data = cat_tree->data + node->field_offsets[CAT_FIELD_GROUP_NAME]; 
    921921        } 
    922                  
     922 
    923923    } 
    924924    return T2J_send_tree(0); 
    925925} 
    926926 
    927 long    t2j_get_deepest_node_that_contains_all_selected(CAT_node_id nn,  
     927long    t2j_get_deepest_node_that_contains_all_selected(CAT_node_id nn, 
    928928                                                        char *selected_ids,long nselected, CAT_node_id *focusout){ 
    929929    CAT_node *node = & cat_tree->nodes[nn]; 
     
    967967        if (sel == cat_tree->nnodes) break;     // no more selections 
    968968        // search a non selected terminal 
    969          
     969 
    970970        int nsel; 
    971971        for (nsel = sel; nsel < cat_tree->nnodes; nsel++){ 
     
    977977        int last = nsel; 
    978978        if (nsel < cat_tree->nnodes) last = cat_tree->nodes[nsel].numbering[CAT_NUMBERING_LEVELS]; 
    979          
     979 
    980980        int h = lastWritten; 
    981981        lastWritten = last; 
     
    984984 
    985985        t2j_out_number( first,'A' ); 
    986         t2j_out_number( last,'a' );      
     986        t2j_out_number( last,'a' ); 
    987987    } 
    988988    printf("\n"); 
     
    997997        varname                 a string that is prepended to the output 
    998998        all_nodes               output = all nodes or just ranges 
    999         field_name              which field should be placed in the output CAT_FIELD_NAME/CAT_FIELD_FULL_NAME ...  
     999        field_name              which field should be placed in the output CAT_FIELD_NAME/CAT_FIELD_FULL_NAME ... 
    10001000 
    10011001        if all_nodes >0 then the programm calculates: 
     
    10101010    if (!cat_tree) return 0; 
    10111011    CAT_node_id *levelindex = t2j_mcreate_level_indexing(); 
    1012          
     1012 
    10131013    char *readp = sel; 
    10141014    int nselected = 0; 
     
    10201020    TRS_strcat(memfile,varname); 
    10211021    readp = sel; 
    1022     c = *(readp++);  
     1022    c = *(readp++); 
    10231023    int last = 0; 
    10241024    for (; c >='A' && c <='Z'; ){ 
     
    10401040        if (s >= cat_tree->nnodes) e = cat_tree->nnodes-1; 
    10411041        last = e; 
    1042                  
     1042 
    10431043        if (all_nodes) { 
    10441044            for (;s<e;s++) { 
     
    10511051            } 
    10521052        }else{ 
    1053             TRS_strcat(memfile,cat_tree->data +  
     1053            TRS_strcat(memfile,cat_tree->data + 
    10541054                       cat_tree->nodes[levelindex[s]].field_offsets[field_name]); 
    10551055            // thats one of my favourite statements 
     
    10681068            t2j_get_deepest_node_that_contains_all_selected( 
    10691069                                                            0,selected_ids,nselected,focusout); 
    1070             if (maxnodeout ) *maxnodeout = cat_tree->data +  
     1070            if (maxnodeout ) *maxnodeout = cat_tree->data + 
    10711071                                 cat_tree->nodes[*focusout]. 
    10721072                                 field_offsets[CAT_FIELD_NAME]; 
     
    10771077            CAT_node_id nextuppderlabeldnode = *focusout; 
    10781078 
    1079             while ( nextuppderlabeldnode > 0  
     1079            while ( nextuppderlabeldnode > 0 
    10801080                    && cat_tree->nodes[nextuppderlabeldnode]. 
    10811081                    field_offsets[CAT_FIELD_GROUP_NAME] == 0 ) { 
     
    10831083            } 
    10841084            if (nextuppderlabeldnode) { // get the name of the node 
    1085                 if (maxnodeout ) *maxnodeout = cat_tree->data +  
     1085                if (maxnodeout ) *maxnodeout = cat_tree->data + 
    10861086                                     cat_tree->nodes[nextuppderlabeldnode]. 
    10871087                                     field_offsets[CAT_FIELD_GROUP_NAME]; 
     
    11401140    } 
    11411141 
    1142                    
    1143     c = *(readp++);  
     1142 
     1143    c = *(readp++); 
    11441144    for (; c >='A' && c <='Z'; ){ 
    11451145        fac = 1;s = last; 
     
    11601160        if (s >= cat_tree->nnodes) e = cat_tree->nnodes-1; 
    11611161        last = e; 
    1162                  
     1162 
    11631163        for (;s<e;s++) { 
    11641164            cat_tree->nodes[levelindex[s]].color = 1; 
  • trunk/TRS/trs_hash.cxx

    r2 r655  
    55#include <stdio.h> 
    66#include <stdlib.h> 
    7 #include <malloc.h> 
     7// #include <malloc.h> 
    88#include <string.h> 
    99#include <ctype.h> 
     
    216216} 
    217217 
    218 long  
     218long 
    219219TRS_free_hash_entries(long hash) 
    220220{ 
     
    235235} 
    236236 
    237 long  
     237long 
    238238TRS_free_hash(long hash) 
    239239{ 
     
    244244        return 0; 
    245245} 
    246 long  
     246long 
    247247TRS_free_hash_entries_free_pointer(long hash) 
    248248{ 
     
    263263        return 0; 
    264264} 
    265 long  
     265long 
    266266TRS_free_hash_free_pointer(long hash) 
    267267{ 
  • trunk/TRS/trs_server.cxx

    r2 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55 
    66char *TRS_map_file(const char *path,int writeable); 
     
    3030                } else if (!strcmp(request_method,"POST")) { 
    3131                        char *temp; 
    32                         if(!(temp=getenv("CONTENT_LENGTH")))  
    33                                 quit_with_error(TRS_export_error("CONTENT_LENGTH not set"));             
     32                        if(!(temp=getenv("CONTENT_LENGTH"))) 
     33                                quit_with_error(TRS_export_error("CONTENT_LENGTH not set")); 
    3434                        int len=atoi(temp); 
    3535                        indata=new char[len+1]; 
     
    195195                        "       only name,fullname,accession is allowed"); 
    196196                        goto end; 
    197                 }        
     197                } 
    198198                char *dat = TRS_read_file("-"); 
    199199                struct T2J_transfer_struct *transfer = T2J_read_query_result_from_data(dat,catfield); 
     
    216216            } 
    217217        } 
    218                  
     218 
    219219end: 
    220220        if (error) { 
  • trunk/WINDOW/AW_Xm.cxx

    r579 r655  
    33#include <string.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <math.h> 
    77#include <X11/X.h> 
     
    5555                } 
    5656        } 
    57      
    58     AUTO_FLUSH(this); 
    59      
     57 
     58    AUTO_FLUSH(this); 
     59 
    6060        return drawflag; 
    6161} 
     
    7171        XDrawString(device->common->display, device->common->window_id, device->common->gcs[gc]->gc, 
    7272                AW_INT(X), AW_INT(Y), str + start , (int)size); 
    73      
     73 
    7474    AUTO_FLUSH(device); 
    75      
     75 
    7676        return 1; 
    7777} 
     
    8181        return text_overlay(gc,str,opt_strlen,x,y,alignment,filteri,(AW_CL)this, cd1,cd2,0.0,0.0,AW_draw_string_on_screen); 
    8282} 
    83   
     83 
    8484int AW_device_Xm::box(int gc, AW_pos x0,AW_pos y0,AW_pos width,AW_pos height, AW_bitset filteri, AW_CL cd1, AW_CL cd2) { 
    8585        AWUSE(cd1);AWUSE(cd2); 
     
    107107                } 
    108108        } 
    109      
    110     AUTO_FLUSH(this); 
    111      
     109 
     110    AUTO_FLUSH(this); 
     111 
    112112        return 0; 
    113113} 
     
    148148                } 
    149149        } 
    150      
    151     AUTO_FLUSH(this); 
    152      
     150 
     151    AUTO_FLUSH(this); 
     152 
    153153        return 0; 
    154154} 
     
    156156void AW_device_Xm::clear() { 
    157157        XClearWindow(common->display,common->window_id); 
    158      
     158 
    159159    AUTO_FLUSH(this); 
    160160} 
     
    183183 
    184184        XClearArea(common->display,common->window_id,(int)X,(int)Y,(int)width,(int)height,False); 
    185      
    186     AUTO_FLUSH(this);     
     185 
     186    AUTO_FLUSH(this); 
    187187} 
    188188 
     
    216216        XClearArea(common->display, common->window_id, 
    217217               (int)X,(int)Y-(int)xfs->max_bounds.ascent,(int)width,(int)height,False); 
    218      
     218 
    219219    AUTO_FLUSH(this); 
    220220} 
  • trunk/WINDOW/AW_click.cxx

    r2 r655  
    33#include <string.h> 
    44#include <memory.h> 
    5 #include <malloc.h> 
     5// #include <malloc.h> 
    66#include <X11/X.h> 
    77#include <X11/Xlib.h> 
     
    6363        //stimmen die Kreise um die Punkte ? 
    6464 
    65                  
     65 
    6666 
    6767        // distance to the second point of the line 
     
    149149                } 
    150150 
    151                 if(this->clip_rect.b == common->screen.b) {  
     151                if(this->clip_rect.b == common->screen.b) { 
    152152                        if (Yt > this->clip_rect.b) return 0; 
    153153                }else { 
     
    174174                        if(mouse_y < Yt - max_distance_text ){ 
    175175                                return 0; 
    176                         } else {                                 
     176                        } else { 
    177177                                not_optimal = AW_TRUE; 
    178178                                best_dist = Yt - mouse_y; 
    179                         }  
     179                        } 
    180180                } 
    181181 
     
    187187                text_width = (int)get_string_size(gc,str,len); 
    188188                X0 = common->x_alignment(X0,text_width,alignment); 
    189                 text_width += xfs->max_bounds.width*2;   
     189                text_width += xfs->max_bounds.width*2; 
    190190 
    191191                        /**************** check against left right clipping areas *********/ 
    192192                if (X0 + text_width< this->clip_rect.l) return 0; 
    193193                if (X0 > this->clip_rect.r + xfs->max_bounds.width) return 0; 
    194                  
     194 
    195195                        /***************** left of text  ***************************/ 
    196196                if(mouse_x < (X0 - (xfs->max_bounds.width)) ) { 
  • trunk/WINDOW/AW_xfont.cxx

    r444 r655  
    22#include <stdlib.h> 
    33#include <string.h> 
    4 #include <malloc.h> 
     4// #include <malloc.h> 
    55#include <memory.h> 
    66#include <ctype.h> 
  • trunk/config.makefile.template

    r649 r655  
    1515 
    1616# export DEBIAN = 1 
     17 
     18#********* Mac OSX ******** 
     19 
     20# MACH   = DARWIN# 
     21# DARWIN = 1 
    1722 
    1823#********* SUN4 / acc CC / dynamic ********