1 #ifndef _PHYLIP_H_ 2 #define _PHYLIP_H_ 3 4 /* version 3.696. 5 Written by Joseph Felsenstein, Akiko Fuseki, Sean Lamont, Andrew Keeffe, 6 Mike Palczewski, Doug Buxton and Dan Fineman. 7 8 Copyright (c) 1980-2014, Joseph Felsenstein 9 All rights reserved. 10 11 Redistribution and use in source and binary forms, with or without 12 modification, are permitted provided that the following conditions are met: 13 14 1. Redistributions of source code must retain the above copyright notice, 15 this list of conditions and the following disclaimer. 16 17 2. Redistributions in binary form must reproduce the above copyright notice, 18 this list of conditions and the following disclaimer in the documentation 19 and/or other materials provided with the distribution. 20 21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #define VERSION "3.696" 35 36 /* Debugging options */ 37 /* Define this to disable assertions */ 38 #define NDEBUG 39 40 /* Define this to enable debugging code */ 41 /* #define DEBUG */ 42 43 /* machine-specific stuff: 44 based on a number of factors in the library stdlib.h, we will try 45 to determine what kind of machine/compiler this program is being 46 built on. However, it doesn't always succeed. However, if you have 47 ANSI conforming C, it will probably work. 48 49 We will try to figure out machine type 50 based on defines in stdio, and compiler-defined things as well.: */ 51 52 #include <stdio.h> 53 #include <stdlib.h> 54 55 #ifdef WIN32 56 #include <windows.h> 57 58 void phyClearScreen(void); 59 void phySaveConsoleAttributes(void); 60 void phySetConsoleAttributes(void); 61 void phyRestoreConsoleAttributes(void); 62 void phyFillScreenColor(void); 63 64 #endif 65 66 #ifdef GNUDOS 67 #define DJGPP 68 #define DOS 69 #endif 70 71 #ifdef THINK_C 72 #define MAC 73 #endif 74 #ifdef __MWERKS__ 75 #ifndef WIN32 76 #define MAC 77 #endif 78 #endif 79 80 #ifdef __CMS_OPEN 81 #define CMS 82 #define EBCDIC true 83 #define INFILE "infile data" 84 #define OUTFILE "outfile data" 85 #define FONTFILE "fontfile data" 86 #define PLOTFILE "plotfile data" 87 #define INTREE "intree data" 88 #define INTREE2 "intree data 2" 89 #define OUTTREE "outtree data" 90 #define CATFILE "categories data" 91 #define WEIGHTFILE "weights data" 92 #define ANCFILE "ancestors data" 93 #define MIXFILE "mixture data" 94 #define FACTFILE "factors data" 95 #else 96 #define EBCDIC false 97 #define INFILE "infile" 98 #define OUTFILE "outfile" 99 #define FONTFILE "fontfile" /* on unix this might be /usr/local/lib/fontfile */ 100 #define PLOTFILE "plotfile" 101 #define INTREE "intree" 102 #define INTREE2 "intree2" 103 #define OUTTREE "outtree" 104 #define CATFILE "categories" 105 #define WEIGHTFILE "weights" 106 #define ANCFILE "ancestors" 107 #define MIXFILE "mixture" 108 #define FACTFILE "factors" 109 #endif 110 111 #ifdef L_ctermid /* try and detect for sysV or V7. */ 112 #define SYSTEM_FIVE 113 #endif 114 115 #ifdef sequent 116 #define SYSTEM_FIVE 117 #endif 118 119 #ifndef SYSTEM_FIVE 120 #include <stdlib.h> 121 # if defined(_STDLIB_H_) || defined(_H_STDLIB) || defined(H_SCCSID) || defined(unix) 122 # define UNIX 123 # define MACHINE_TYPE "BSD Unix C" 124 # endif 125 #endif 126 127 128 #ifdef __STDIO_LOADED 129 #define VMS 130 #define MACHINE_TYPE "VAX/VMS C" 131 #endif 132 133 #ifdef __WATCOMC__ 134 #define QUICKC 135 #define WATCOM 136 #define DOS 137 #include "graph.h" 138 #endif 139 /* watcom-c has graphics library calls that are almost identical to * 140 * quick-c, so the "QUICKC" symbol name stays. */ 141 142 143 #ifdef _QC 144 #define MACHINE_TYPE "MS-DOS / Quick C" 145 #define QUICKC 146 #include "graph.h" 147 #define DOS 148 #endif 149 150 #ifdef _DOS_MODE 151 #define MACHINE_TYPE "MS-DOS /Microsoft C " 152 #define DOS /* DOS is always defined if on a DOS machine */ 153 #define MSC /* MSC is defined for microsoft C */ 154 #endif 155 156 #ifdef __MSDOS__ /* TURBO c compiler, ONLY (no other DOS C compilers) */ 157 #define DOS 158 #define TURBOC 159 #include <stdlib.h> 160 #include <graphics.h> 161 #endif 162 163 #ifdef DJGPP /* DJ Delorie's original gnu C/C++ port */ 164 #include <graphics.h> 165 #endif 166 167 #ifndef MACHINE_TYPE 168 #define MACHINE_TYPE "ANSI C" 169 #endif 170 171 #ifdef DOS 172 #define MALLOCRETURN void 173 #else 174 #define MALLOCRETURN void 175 #endif 176 #ifdef VMS 177 #define signed /* signed doesn't exist in VMS */ 178 #endif 179 180 /* default screen types */ 181 /* if on a DOS but not a Windows system can use IBM PC screen controls */ 182 #ifdef DOS 183 #ifndef WIN32 184 #define IBMCRT true 185 #define ANSICRT false 186 #endif 187 #endif 188 /* if on a Mac cannot use screen controls */ 189 #ifdef MAC 190 #define IBMCRT false 191 #define ANSICRT false 192 #endif 193 /* if on a Windows system can use IBM PC screen controls */ 194 #ifdef WIN32 195 #define IBMCRT true 196 #define ANSICRT false 197 #endif 198 /* otherwise, let's assume we are on a Linux or Unix system 199 with ANSI terminal controls */ 200 #ifndef MAC 201 #ifndef DOS 202 #ifndef WIN32 203 #define IBMCRT false 204 #define ANSICRT true 205 #endif 206 #endif 207 #endif 208 209 #ifdef DJGPP 210 #undef MALLOCRETURN 211 #define MALLOCRETURN void 212 #endif 213 214 215 /* includes: */ 216 #ifdef UNIX 217 #include <strings.h> 218 #else 219 #include <string.h> 220 #endif 221 222 #include <assert.h> 223 #include <math.h> 224 #include <ctype.h> 225 226 /* 227 #ifdef MAC 228 #ifdef DRAW 229 #include "interface.h" 230 #else 231 #include "macface.h" 232 #endif 233 #define getch gettch 234 #endif 235 */ 236 237 /* directory delimiters */ 238 #ifdef MAC 239 #define DELIMITER ':' 240 #else 241 #ifdef WIN32 242 #define DELIMITER '\\' 243 #else 244 #define DELIMITER '/' 245 #endif 246 #endif 247 248 249 #define FClose(file) if (file) fclose(file) ; file=NULL 250 #define Malloc(x) mymalloc((long)x) 251 252 typedef void *Anyptr; 253 #define Signed signed 254 #define Const const 255 #define Volatile volatile 256 #define Char char /* Characters (not bytes) */ 257 #define Static static /* Private global funcs and vars */ 258 #define Local static /* Nested functions */ 259 260 typedef unsigned char boolean; 261 262 #define true 1 263 #define false 0 264 265 /* Number of items per machine word in set. 266 * Used in consensus programs and clique */ 267 #define SETBITS 31 268 269 MALLOCRETURN *mymalloc(long); 270 271 /*** UI behavior ***/ 272 273 /* Set to 1 to not ask before overwriting files */ 274 #define OVERWRITE_FILES 0 275 276 /*** Static memory parameters ***/ 277 278 #define FNMLNGTH 200 /* length of array to store a file name */ 279 //#define nmlngth 10 /* number of characters in species name */ 280 #define MAXNCH 20 /* must be greater than or equal to nmlngth */ 281 #define maxcategs 9 /* maximum number of site types */ 282 #define maxcategs2 11 /* maximum number of site types + 2 */ 283 #define point "." 284 #define pointe '.' 285 #define down 2 286 #define MAXSHIMOTREES 100 287 288 /*** Maximum likelihood parameters ***/ 289 290 291 /* Used in proml, promlk, dnaml, dnamlk, etc. */ 292 #define UNDEFINED 1.0 /* undefined or invalid likelihood */ 293 #define smoothings 4 /* number of passes through smoothing algorithm */ 294 #define iterations 8 /* number of iterates for each branch */ 295 #define epsilon 0.0001 /* small number used in makenewv */ 296 #define EPSILON 0.00001 /* small number used in hermite root-finding */ 297 #define initialv 0.1 /* starting branch length unless otherwise */ 298 #define INSERT_MIN_TYME 0.0001 /* Minimum tyme between nodes during inserts */ 299 #define over 60 /* maximum width all branches of tree on screen */ 300 #define LIKE_EPSILON 1e-10 /* Estimate of round-off error in likelihood 301 * calculations. */ 302 303 /*** Math constants ***/ 304 305 #define SQRTPI 1.7724538509055160273 306 #define SQRT2 1.4142135623730950488 307 308 /*** Rearrangement parameters ***/ 309 310 #define NLRSAVES 5 /* number of views that need to be saved during local * 311 * rearrangement */ 312 313 /*** Output options ***/ 314 315 /* Number of significant figures to display in numeric output */ 316 #define PRECISION 6 317 318 /* Maximum line length of matrix output - 0 for unlimited */ 319 #define OUTPUT_TEXTWIDTH 78 320 321 /** output_matrix() flags **/ 322 323 /* Block output: Matrices are vertically split into blocks that 324 * fit within OUTPUT_TEXTWIDTH columns */ 325 #define MAT_BLOCK 0x1 326 /* Lower triangle: Values on or above the diagonal are not printed */ 327 #define MAT_LOWER 0x2 328 /* Print a border between headings and data */ 329 #define MAT_BORDER 0x4 330 /* Do not print the column header */ 331 #define MAT_NOHEAD 0x8 332 /* Output the number of columns before the matrix */ 333 #define MAT_PCOLS 0x10 334 /* Do not enforce maximum line width */ 335 #define MAT_NOBREAK 0x20 336 /* Pad row header with spaces to 10 char */ 337 #define MAT_PADHEAD 0x40 338 /* Human-readable format. */ 339 #define MAT_HUMAN MAT_BLOCK 340 /* Machine-readable format. */ 341 #define MAT_MACHINE (MAT_PCOLS | MAT_NOHEAD | MAT_PADHEAD) 342 /* Lower-triangular format. */ 343 #define MAT_LOWERTRI (MAT_LOWER | MAT_MACHINE) 344 345 //boolean javarun; 346 347 typedef long *steptr; 348 typedef long longer[6]; 349 typedef char naym[MAXNCH]; 350 typedef long *bitptr; 351 typedef double raterootarray[maxcategs2][maxcategs2]; 352 353 typedef struct bestelm { 354 long *btree; 355 boolean gloreange; 356 boolean locreange; 357 boolean collapse; 358 } bestelm; 359 360 extern FILE *infile, *outfile, *intree, *intree2, *outtree, 361 *weightfile, *catfile, *ancfile, *mixfile, *factfile; 362 extern long spp, words, bits; 363 extern boolean ibmpc, ansi, tranvsp; 364 //extern naym *nayme; /* names of species */ 365 extern char* *nayme; /* names of species */ 366 //boolean firstplotblock; // for debugging BMP output 367 368 #define ebcdic EBCDIC 369 370 typedef Char plotstring[MAXNCH]; 371 372 /* Approx. 1GB, used to test for memory request errors */ 373 #define TOO_MUCH_MEMORY 1000000000 374 375 376 /* The below pre-processor commands define the type used to store 377 group arrays. We can't use #elif for metrowerks, so we use 378 cascaded if statements */ 379 #include <limits.h> 380 381 /* minimum double we feel safe with, anything less will be considered 382 underflow */ 383 #define MIN_DOUBLE 10e-100 384 385 /* K&R says that there should be a plus in front of the number, but no 386 machine we've seen actually uses one; we'll include it just in 387 case. */ 388 #define MAX_32BITS 2147483647 389 #define MAX_32BITS_PLUS +2147483647 390 391 /* If ints are 4 bytes, use them */ 392 #if INT_MAX == MAX_32BITS 393 typedef int group_type; 394 395 #else 396 #if INT_MAX == MAX_32BITS_PLUS 397 typedef int group_type; 398 399 #else 400 /* Else, if longs are 4 bytes, use them */ 401 #if LONG_MAX == MAX_32BITS 402 typedef long group_type; 403 404 #else 405 #if LONG_MAX == MAX_32BITS_PLUS 406 typedef long group_type; 407 408 /* Default to longs */ 409 #else 410 typedef long group_type; 411 #endif 412 413 #endif 414 #endif 415 #endif 416 417 /* for many programs */ 418 419 #define maxuser 1000 /* maximum number of user-defined trees */ 420 421 typedef Char **sequence; 422 423 typedef enum { 424 A, C, G, T, O 425 } bases; 426 427 typedef enum { 428 alanine, arginine, asparagine, aspartic, cysteine, 429 glutamine, glutamic, glycine, histidine, isoleucine, 430 leucine, lysine, methionine, phenylalanine, proline, 431 serine, threonine, tryptophan, tyrosine, valine 432 } acids; 433 434 /* for Pars */ 435 436 typedef enum { 437 zero = 0, one, two, three, four, five, six, seven 438 } discbases; 439 440 /* for Protpars */ 441 442 typedef enum { 443 ala, arg, asn, asp, cys, gln, glu, gly, his, ileu, leu, lys, met, phe, pro, 444 ser1, ser2, thr, trp, tyr, val, del, stop, asx, glx, ser, unk, quest 445 } aas; 446 447 typedef double sitelike[(long)T - (long)A + 1]; /* used in dnaml, dnadist */ 448 typedef double psitelike[(long)valine - (long)alanine + 1]; 449 /* used in proml */ 450 451 typedef long *baseptr; /* baseptr used in dnapars, dnacomp & dnapenny */ 452 typedef long *baseptr2; /* baseptr used in dnamove */ 453 typedef unsigned char *discbaseptr; /* discbaseptr used in pars */ 454 typedef sitelike *ratelike; /* used in dnaml ... */ 455 typedef psitelike *pratelike; /* used in proml */ 456 typedef ratelike *phenotype; /* phenotype used in dnaml, dnamlk, dnadist */ 457 typedef pratelike *pphenotype; /* phenotype used in proml */ 458 typedef double *sitelike2; 459 typedef sitelike2 *phenotype2; /* phenotype2 used in restml */ 460 typedef double *phenotype3; /* for continuous char programs */ 461 462 typedef double *vector; /* used in distance programs */ 463 464 typedef long nucarray[(long)O - (long)A + 1]; 465 typedef long discnucarray[(long)seven - (long)zero + 1]; 466 467 typedef enum { nocollap, tocollap, undefined } collapstates; 468 469 typedef enum { bottom, nonbottom, hslength, tip, iter, length, 470 hsnolength, treewt, unittrwt } initops; 471 472 473 typedef double **transmatrix; 474 typedef transmatrix *transptr; /* transptr used in restml */ 475 476 typedef long sitearray[3]; 477 typedef sitearray *seqptr; /* seqptr used in protpars */ 478 479 typedef struct node { 480 struct node *next, *back; 481 plotstring nayme; 482 long naymlength, tipsabove, index; 483 double times_in_tree; /* Previously known as cons_index */ 484 double xcoord, ycoord; 485 long long_xcoord, long_ycoord; /* for use in cons. */ 486 double oldlen, length, r, theta, oldtheta, width, depth, 487 tipdist, lefttheta, righttheta; 488 group_type *nodeset; /* used by accumulate -plc */ 489 long ymin, ymax; /* used by printree -plc */ 490 boolean haslength; /* haslength used in dnamlk */ 491 boolean iter; /* iter used in dnaml, fitch & restml */ 492 boolean initialized; /* initialized used in dnamlk & restml */ 493 long branchnum; /* branchnum used in restml */ 494 phenotype x; /* x used in dnaml, dnamlk, dnadist */ 495 phenotype2 x2; /* x2 used in restml */ 496 phenotype3 view; /* contml etc */ 497 pphenotype protx; /* protx used in proml */ 498 aas *seq; /* the sequence used in protpars */ 499 seqptr siteset; /* temporary storage for aa's used in protpars*/ 500 double v, deltav, ssq; /* ssq used only in contrast */ 501 double bigv; /* bigv used in contml */ 502 double tyme, oldtyme; /* used in dnamlk */ 503 double t; /* time in kitsch */ 504 boolean sametime; /* bookkeeps scrunched nodes in kitsch */ 505 double weight; /* weight of node used by scrunch in kitsch */ 506 boolean processed; /* used by evaluate in kitsch */ 507 boolean deleted; /* true if node is deleted (retree) */ 508 boolean hasname; /* true if tip has a name (retree) */ 509 double beyond; /* distance beyond this node to most distant tip */ 510 /* (retree) */ 511 boolean deadend; /* true if no undeleted nodes beyond this node */ 512 /* (retree) */ 513 boolean onebranch; /* true if there is one undeleted node beyond */ 514 /* this node (retree) */ 515 struct node *onebranchnode; 516 /* if there is, a pointer to that node (retree)*/ 517 double onebranchlength; /* if there is, the distance from here to there*/ 518 /* (retree) */ 519 boolean onebranchhaslength; /* true if there is a valid combined length*/ 520 /* from here to there (retree) */ 521 collapstates collapse; /* used in dnapars & dnacomp */ 522 boolean tip; 523 boolean bottom; /* used in dnapars & dnacomp, disc char */ 524 boolean visited; /* used in dnapars & dnacomp disc char */ 525 baseptr base; /* the sequence in dnapars/comp/penny */ 526 discbaseptr discbase; /* the sequence in pars */ 527 baseptr2 base2; /* the sequence in dnamove */ 528 baseptr oldbase; /* record previous sequence */ 529 discbaseptr olddiscbase; /* record previous sequence */ 530 long numdesc; /* number of immediate descendants */ 531 nucarray *numnuc; /* bookkeeps number of nucleotides */ 532 discnucarray *discnumnuc; /* bookkeeps number of nucleotides */ 533 steptr numsteps; /* bookkeeps steps */ 534 steptr oldnumsteps; /* record previous steps */ 535 double sumsteps; /* bookkeeps sum of steps */ 536 nucarray cumlengths; /* bookkeeps cummulative minimum lengths */ 537 discnucarray disccumlengths; /* bookkeeps cummulative minimum lengths */ 538 nucarray numreconst; /* bookkeeps number of reconstructions */ 539 discnucarray discnumreconst; /* bookkeeps number of reconstructions */ 540 vector d, w; /* for distance matrix programs */ 541 double dist; /* dist used in fitch */ 542 bitptr stateone, statezero; /* discrete char programs */ 543 long maxpos; /* maxpos used in Clique */ 544 Char state; /* state used in Dnamove, Dolmove & Move */ 545 double* underflows; /* used to record underflow */ 546 } node; 547 548 typedef node **pointarray; 549 550 551 /*** tree structure ***/ 552 553 typedef struct tree { 554 555 /* An array of pointers to nodes. Each tip node and ring of nodes has a 556 * unique index starting from one. The nodep array contains pointers to each 557 * one, starting from 0. In the case of internal nodes, the entries in nodep 558 * point to the rootward node in the group. Since the trees are otherwise 559 * entirely symmetrical, except at the root, this is the only way to resolve 560 * parent, child, and sibling relationships. 561 * 562 * Indices in range [0, spp) point to tips, while indices [spp, nonodes) 563 * point to fork nodes 564 */ 565 pointarray nodep; 566 567 /* A pointer to the first node. Typically, root is used when the tree is rooted, 568 * and points to an internal node with no back link. */ 569 node *root; 570 571 /* start is used when trees are unrooted. It points to an internal node whose 572 * back link typically points to the outgroup leaf. */ 573 node *start; 574 575 /* In maximum likelihood programs, the most recent evaluation is stored here */ 576 double likelihood; 577 578 /* Branch transition matrices for restml */ 579 transptr trans; /* all transition matrices */ 580 long *freetrans; /* an array of indexes of free matrices */ 581 long transindex; /* index of last valid entry in freetrans[] */ 582 } tree; 583 584 typedef void (*initptr)(node **, node **, node *, long, long, 585 long *, long *, initops, pointarray, 586 pointarray, Char *, Char *, FILE *); 587 588 589 #ifndef OLDC 590 /* function prototypes */ 591 void scan_eoln(FILE *); 592 boolean eoff(FILE *); 593 boolean eoln(FILE *); 594 int filexists(char *); 595 const char* get_command_name (const char *); 596 void EOF_error(void); 597 void getstryng(char *); 598 void openfile(FILE **,const char *,const char *,const char *,const char *, 599 char *); 600 void cleerhome(void); 601 void loopcount(long *, long); 602 double randum(longer); 603 void randumize(longer, long *); 604 double normrand(longer); 605 long readlong(const char *); 606 607 void uppercase(Char *); 608 void initseed(long *, long *, longer); 609 void initjumble(long *, long *, longer, long *); 610 void initoutgroup(long *, long); 611 void initthreshold(double *); 612 void initcatn(long *); 613 void initcategs(long, double *); 614 void initprobcat(long, double *, double *); 615 double logfac (long); 616 double halfroot(double (*func)(long , double), long, double, double); 617 double hermite(long, double); 618 void initlaguerrecat(long, double, double *, double *); 619 void root_hermite(long, double *); 620 void hermite_weight(long, double *, double *); 621 void inithermitcat(long, double, double *, double *); 622 void lgr(long, double, raterootarray); 623 double glaguerre(long, double, double); 624 void initgammacat(long, double, double *, double *); 625 void inithowmany(long *, long); 626 void inithowoften(long *); 627 628 void initlambda(double *); 629 void initfreqs(double *, double *, double *, double *); 630 void initratio(double *); 631 void initpower(double *); 632 void initdatasets(long *); 633 void justweights(long *); 634 void initterminal(boolean *, boolean *); 635 void initnumlines(long *); 636 void initbestrees(bestelm *, long, boolean); 637 void newline(FILE *, long, long, long); 638 639 void inputnumbers(long *, long *, long *, long); 640 void inputnumbersold(long *, long *, long *, long); 641 void inputnumbers2(long *, long *, long n); 642 void inputnumbers3(long *, long *); 643 void samenumsp(long *, long); 644 void samenumsp2(long); 645 void readoptions(long *, const char *); 646 void matchoptions(Char *, const char *); 647 void inputweights(long, steptr, boolean *); 648 void inputweightsold(long, steptr, boolean *); 649 void inputweights2(long, long, long *, steptr, boolean *, const char *); 650 void printweights(FILE *, long, long, steptr, const char *); 651 652 void inputcategs(long, long, steptr, long, const char *); 653 void printcategs(FILE *, long, steptr, const char *); 654 void inputfactors(long, Char *, boolean *); 655 void inputfactorsnew(long, Char *, boolean *); 656 void printfactors(FILE *, long, Char *, const char *); 657 void headings(long, const char *, const char *); 658 void initname(long); 659 void findtree(boolean *,long *,long,long *,bestelm *); 660 void addtree(long,long *,boolean,long *,bestelm *); 661 long findunrearranged(bestelm *, long, boolean); 662 boolean torearrange(bestelm *, long); 663 664 void reducebestrees(bestelm *, long *); 665 void shellsort(double *, long *, long); 666 void getch(Char *, long *, FILE *); 667 void getch2(Char *, long *); 668 void findch(Char, Char *, long); 669 void findch2(Char, long *, long *, Char *); 670 void findch3(Char, Char *, long, long); 671 void processlength(double *,double *,Char *,boolean *,FILE *,long *); 672 void writename(long, long, long *); 673 void memerror(void); 674 675 void odd_malloc(long); 676 677 void gnu(node **, node **); 678 void chuck(node **, node *); 679 void zeronumnuc(node *, long); 680 void zerodiscnumnuc(node *, long); 681 void allocnontip(node *, long *, long); 682 void allocdiscnontip(node *, long *, unsigned char *, long ); 683 void allocnode(node **, long *, long); 684 void allocdiscnode(node **, long *, unsigned char *, long ); 685 void gnutreenode(node **, node **, long, long, long *); 686 void gnudisctreenode(node **, node **, long , long, long *, 687 unsigned char *); 688 689 void setupnode(node *, long); 690 node * pnode(tree *t, node *p); 691 long count_sibs (node *); 692 void inittrav (node *); 693 void commentskipper(FILE ***, long *); 694 long countcomma(FILE **, long *); 695 long countsemic(FILE **); 696 void hookup(node *, node *); 697 void unhookup(node *, node *); 698 void link_trees(long, long , long, pointarray); 699 void allocate_nodep(pointarray *, FILE **, long *); 700 701 void malloc_pheno(node *, long, long); 702 void malloc_ppheno(node *, long, long); 703 long take_name_from_tree (Char *, Char *, FILE *); 704 void match_names_to_data (Char *, pointarray, node **, long); 705 void addelement(node **, node *, Char *, long *, FILE *, pointarray, 706 boolean *, boolean *, pointarray, long *, long *, boolean *, 707 node **, initptr,boolean,long); 708 void treeread (FILE *, node **, pointarray, boolean *, boolean *, 709 pointarray, long *, boolean *, node **, initptr,boolean,long); 710 void addelement2(node *, Char *, long *, FILE *, pointarray, boolean, 711 double *, boolean *, long *, long *, long, boolean *,boolean, 712 long); 713 void treeread2 (FILE *, node **, pointarray, boolean, double *, 714 boolean *, boolean *, long *,boolean,long); 715 void exxit (int); 716 void countup(long *loopcount, long maxcount); 717 char gettc(FILE* file); 718 void unroot_r(node* p,node ** nodep, long nonodes); 719 void unroot(tree* t,long nonodes); 720 void unroot_here(node* root, node** nodep, long nonodes); 721 void clear_connections(tree *t, long nonodes); 722 void init(int argc, char** argv); 723 char **stringnames_new(void); 724 void stringnames_delete(char **names); 725 int fieldwidth_double(double val, unsigned int precision); 726 void output_matrix_d(FILE *fp, double **matrix, 727 unsigned long rows, unsigned long cols, 728 char **row_head, char **col_head, int flags); 729 void debugtree (tree *, FILE *); 730 void debugtree2 (pointarray, long, FILE *); 731 #endif /* OLDC */ 732 #endif /* _PHYLIP_H_ */ 733