X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/1059e1cc0c2ecfa237406949aa26155b6a5b9154..66f23d4fabf89ad09adbd4dfc15ac6b5b2b7da83:/interpreter/preprocessor/faust-0.9.47mr3/compiler/tlib/tree.hh
diff --git a/interpreter/preprocessor/faust-0.9.47mr3/compiler/tlib/tree.hh b/interpreter/preprocessor/faust-0.9.47mr3/compiler/tlib/tree.hh
new file mode 100644
index 0000000..9ab6170
--- /dev/null
+++ b/interpreter/preprocessor/faust-0.9.47mr3/compiler/tlib/tree.hh
@@ -0,0 +1,267 @@
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+
+/*****************************************************************************
+******************************************************************************/
+
+/** \file tree.hh
+ * A tree library with hashconsing and maximal sharing capabilities.
+ *
+ * A tree library with hashconsing and maximal sharing capabilities.
+ *
+ * API:
+ *
+ * \li tree (n) : tree of node n with no branch
+ * \li tree (n, t1) : tree of node n with a branch t
+ * \li tree (n, t1,...,tm) : tree of node n with m branches t1,...,tm
+ *
+ * Useful conversions :
+ *
+ * \li int tree2int (t) : if t has a node of type int, return it otherwise error
+ * \li float tree2float (t) : if t has a node of type float, return it otherwise error
+ * \li const char* tree2str (t) : if t has a node of type symbol, return its name otherwise error
+ * \li void* tree2ptr (t) : if t has a node of type ptr, return it otherwise error
+ *
+ * Pattern matching :
+ *
+ * \li if (isTree (t, n)) ... : t has node n and no branches;
+ * \li if (isTree (t, n, &t1) ... : t has node n and 1 branch, t1 is set accordingly;
+ * \li if (isTree (t, n, &t1...&tm)... : t has node n and m branches, ti's are set accordingly;
+ *
+ * Accessors :
+ *
+ * \li t->node() : the node of t { return fNode; }
+ * \li t->height() : lambda height such that H(x)=0, H(\x.e)=1+H(e), H(e*f)=max(H(e),H(f))
+ * \li t->arity() : the number of branches of t { return fArity; }
+ * \li t->branch(i) : the ith branch of t
+ *
+ * Attributs :
+ *
+ * \li t->attribut() : return the attribut (also a tree) of t
+ * \li t->attribut(t') : set the attribut of t to t'
+ *
+ *
+ * Properties:
+ *
+ * If p and q are two CTree pointers :
+ * p != q <=> *p != *q
+ *
+ **/
+
+/*****************************************************************************
+******************************************************************************/
+
+
+
+#ifndef __TREE__
+#define __TREE__
+
+#include "symbol.hh"
+#include "node.hh"
+#include
+#include