-//#include <stdio.h>
-//#include <stdlib.h>
-//#include <math.h>
-//#include <string.h>
-//#include <sys/types.h>
-//#include <sys/stat.h>
-//#include "main.h"
-//#include "graph.h"
+/* me.h 2012-04-30 */
+
+/* Copyright 2007-2008 Vincent Lefort, modified by Emmanuel Paradis */
+
+/* This file is part of the R-package `ape'. */
+/* See the file ../COPYING for licensing issues. */
+
#include <R.h>
#ifndef NONE
#ifndef MAX_LABEL_LENGTH
#define MAX_LABEL_LENGTH 30
#endif
-#ifndef NODE_LABEL_LENGTH
-#define NODE_LABEL_LENGTH 30
-#endif
+//#ifndef NODE_LABEL_LENGTH
+//#define NODE_LABEL_LENGTH 30
+//#endif
#ifndef EDGE_LABEL_LENGTH
#define EDGE_LABEL_LENGTH 30
#endif
#ifndef MAX_DIGITS
#define MAX_DIGITS 20
#endif
-#ifndef INPUT_SIZE
-#define INPUT_SIZE 100
-#endif
+/* #ifndef INPUT_SIZE */
+/* #define INPUT_SIZE 100 */
+/* #endif */
#ifndef MAX_INPUT_SIZE
#define MAX_INPUT_SIZE 100000
#endif
{
char name[MAX_LABEL_LENGTH];
struct word *suiv;
-}WORD;
+} WORD;
typedef struct pointers
{
WORD *head;
WORD *tail;
-}POINTERS;
+} POINTERS;
typedef struct node {
- char label[NODE_LABEL_LENGTH];
+ int label; /* char label[NODE_LABEL_LENGTH]; */
struct edge *parentEdge;
struct edge *leftEdge;
struct edge *middleEdge;
struct set *secondNode;
} set;
-void me_b(double *X, int *N, char **labels, char **treeStr, int *nni);
-void me_o(double *X, int *N, char **labels, char **treeStr, int *nni);
-int whiteSpace(char c);
+void me_b(double *X, int *N, int *labels, int *nni, int *spr, int *tbr, int *edge1, int *edge2, double *el);
+void me_o(double *X, int *N, int *labels, int *nni, int *edge1, int *edge2, double *el);
double **initDoubleMatrix(int d);
-double **loadMatrix (double *X, char **labels, int n, set *S);
+double **loadMatrix (double *X, int *labels, int n, set *S);
set *addToSet(node *v, set *X);
-node *makeNewNode(char *label, int i);
-node *makeNode(char *label, edge *parentEdge, int index);
+node *makeNewNode(int label, int i);
+node *makeNode(int label, edge *parentEdge, int index);
node *copyNode(node *v);
edge *siblingEdge(edge *e);
edge *makeEdge(char *label, node *tail, node *head, double weight);
void freeTree(tree *T);
void freeSubTree(edge *e);
int leaf(node *v);
-tree *readNewickString (char *str, int numLeaves);
-node *decodeNewickSubtree(char *treeString, tree *T, int *uCount);
-void NewickPrintSubtree(tree *T, edge *e, char *str);
-void NewickPrintBinaryTree(tree *T, char *str);
-void NewickPrintTrinaryTree(tree *T, char *str);
-void NewickPrintTreeStr(tree *T, char *str);
-
+/* int whiteSpace(char c); */
+/* node *decodeNewickSubtree(char *treeString, tree *T, int *uCount); */
+/* tree *readNewickString (char *str, int numLeaves); */
+void subtree2phylo(node *parent, int *edge1, int *edge2, double *el, int *ilab);
+void tree2phylo(tree *T, int *edge1, int *edge2, double *el, int *ilab, int n);