📄 addelementlen.c
字号:
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <math.h>#include "fastDNAml_types.h"#include "fastDNAml_funcs.h"boolean addElementLen (FILE *fp, tree *tr, nodeptr p) { /* addElementLen */ double z, branch; nodeptr q; int n, ch; if ((ch = treeGetCh(fp)) == '(') { /* A new internal node */ n = (tr->nextnode)++; if (n > 2*(tr->mxtips) - 2) { if (tr->rooted || n > 2*(tr->mxtips) - 1) { printf("ERROR: Too many internal nodes. Is tree rooted?\n"); printf(" Deepest splitting should be a trifurcation.\n"); return FALSE; } else { tr->rooted = TRUE; } } q = tr->nodep[n]; if (! addElementLen(fp, tr, q->next)) return FALSE; if (! treeNeedCh(fp, ',', "in")) return FALSE; if (! addElementLen(fp, tr, q->next->next)) return FALSE; if (! treeNeedCh(fp, ')', "in")) return FALSE; (void) treeFlushLabel(fp); } else { /* A new tip */ ungetc(ch, fp); if ((n = treeFindTipName(fp, tr)) <= 0) return FALSE; q = tr->nodep[n]; if (tr->start->number > n) tr->start = q; (tr->ntips)++; } /* End of tip processing */ if (tr->userlen) { if (! treeNeedCh(fp, ':', "in")) return FALSE; if (! treeProcessLength(fp, & branch)) return FALSE; z = exp(-branch / tr->rdta->fracchange); if (z > zmax) z = zmax; hookup(p, q, z); } else { if (! treeFlushLen(fp)) return FALSE; hookup(p, q, defaultz); } return TRUE; } /* addElementLen */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -