---
 software/include/fpvm/ast.h      |   76 ++++++++++++++++++++++++++++++++
 software/libfpvm/Makefile        |   13 +++---
 software/libfpvm/ast.h           |   88 --------------------------------------
 software/libfpvm/fpvm-export.c   |    2 +-
 software/libfpvm/fpvm.c          |    3 +-
 software/libfpvm/parser.y        |    3 +-
 software/libfpvm/parser_helper.c |    3 +-
 software/libfpvm/parser_helper.h |    2 +-
 software/libfpvm/parser_itf.h    |   33 ++++++++++++++
 9 files changed, 123 insertions(+), 100 deletions(-)
 create mode 100644 software/include/fpvm/ast.h
 delete mode 100644 software/libfpvm/ast.h
 create mode 100644 software/libfpvm/parser_itf.h

diff --git a/software/include/fpvm/ast.h b/software/include/fpvm/ast.h
new file mode 100644
index 0000000..2d4be83
--- /dev/null
+++ b/software/include/fpvm/ast.h
@@ -0,0 +1,76 @@
+/*
+ * Milkymist SoC (Software)
+ * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
+ *
+ * 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, version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __FPVM_AST_H
+#define __FPVM_AST_H
+
+enum ast_op {
+       op_trouble,     /* null value */
+       op_ident,
+       op_constant,
+       op_plus,
+       op_minus,
+       op_multiply,
+       op_divide,
+       op_percent,
+       op_abs,
+       op_isin,
+       op_icos,
+       op_sin,
+       op_cos,
+       op_above,
+       op_below,
+       op_equal,
+       op_i2f,
+       op_f2i,
+       op_if,
+       op_tsign,
+       op_quake,
+       op_not,
+       op_sqr,
+       op_sqrt,
+       op_invsqrt,
+       op_min,
+       op_max,
+       op_int,
+};
+
+/* maximum supported arity is 3 */
+struct ast_branches {
+       struct ast_node *a;
+       struct ast_node *b;
+       struct ast_node *c;
+};
+
+struct ast_node {
+       enum ast_op op;
+       /*
+        * label is an empty string:
+        *   node is a constant
+        * label is not an empty string and branch A is null:
+        *   node is variable "label"
+        * label is not an empty string and branch A is not null:
+        *   node is function/operator "label"
+        */
+       const char *label;
+       union {
+               struct ast_branches branches;
+               float constant;
+       } contents;
+};
+
+#endif /* __FPVM_AST_H */
diff --git a/software/libfpvm/Makefile b/software/libfpvm/Makefile
index 1ba0afd..cb2a03e 100644
--- a/software/libfpvm/Makefile
+++ b/software/libfpvm/Makefile
@@ -42,12 +42,12 @@ clean:
 
 # DO NOT DELETE
 
-fpvm-emigree.o: ../../software/include/fpvm/fpvm.h
-fpvm-emigree.o: ../../software/include/fpvm/is.h ast.h unique.h
-fpvm-emigree.o: parser_helper.h
+fpvm-export.o: ../../software/include/fpvm/fpvm.h
+fpvm-export.o: ../../software/include/fpvm/is.h
+fpvm-export.o: ../../software/include/fpvm/ast.h unique.h parser_helper.h
 fpvm.o: ../../software/include/base/version.h
 fpvm.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
-fpvm.o: ast.h
+fpvm.o: ../../software/include/fpvm/ast.h
 gfpus.o: ../../software/include/fpvm/is.h ../../software/include/fpvm/fpvm.h
 gfpus.o: ../../software/include/fpvm/pfpu.h
 gfpus.o: ../../software/include/fpvm/schedulers.h
@@ -56,8 +56,9 @@ lnfpus.o: ../../software/include/fpvm/is.h 
../../software/include/fpvm/fpvm.h
 lnfpus.o: ../../software/include/fpvm/pfpu.h
 lnfpus.o: ../../software/include/fpvm/schedulers.h
 lnfpus.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
-parser.o: ast.h parser.h
-parser_helper.o: scanner.h parser.h ast.h parser_helper.h
+parser.o: ../../software/include/fpvm/ast.h parser_itf.h parser.h
+parser_helper.o: ../../software/include/fpvm/ast.h scanner.h parser.h
+parser_helper.o: parser_itf.h parser_helper.h
 pfpu.o: ../../software/include/hw/pfpu.h ../../software/include/hw/common.h
 pfpu.o: ../../software/include/fpvm/fpvm.h ../../software/include/fpvm/is.h
 pfpu.o: ../../software/include/fpvm/pfpu.h
diff --git a/software/libfpvm/ast.h b/software/libfpvm/ast.h
deleted file mode 100644
index 95cb902..0000000
--- a/software/libfpvm/ast.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Milkymist SoC (Software)
- * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
- *
- * 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, version 3 of the License.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __AST_H
-#define __AST_H
-
-#define NDEBUG
-
-enum ast_op {
-       op_trouble,     /* null value */
-       op_ident,
-       op_constant,
-       op_plus,
-       op_minus,
-       op_multiply,
-       op_divide,
-       op_percent,
-       op_abs,
-       op_isin,
-       op_icos,
-       op_sin,
-       op_cos,
-       op_above,
-       op_below,
-       op_equal,
-       op_i2f,
-       op_f2i,
-       op_if,
-       op_tsign,
-       op_quake,
-       op_not,
-       op_sqr,
-       op_sqrt,
-       op_invsqrt,
-       op_min,
-       op_max,
-       op_int,
-};
-
-struct id {
-       int token;
-       const char *label;
-       float constant;
-};
-
-/* maximum supported arity is 3 */
-struct ast_branches {
-       struct ast_node *a;
-       struct ast_node *b;
-       struct ast_node *c;
-};
-
-struct ast_node {
-       enum ast_op op;
-       /*
-        * label is an empty string:
-        *   node is a constant
-        * label is not an empty string and branch A is null:
-        *   node is variable "label"
-        * label is not an empty string and branch A is not null:
-        *   node is function/operator "label"
-        */
-       const char *label;
-       union {
-               struct ast_branches branches;
-               float constant;
-       } contents;
-};
-
-void *ParseAlloc(void *(*mallocProc)(size_t));
-void ParseFree(void *p, void (*freeProc)(void*));
-void Parse(void *yyp, int yymajor, struct id *yyminor, struct ast_node **p);
-
-#endif /* __AST_H */
diff --git a/software/libfpvm/fpvm-export.c b/software/libfpvm/fpvm-export.c
index be9af09..bf1ca1f 100644
--- a/software/libfpvm/fpvm-export.c
+++ b/software/libfpvm/fpvm-export.c
@@ -18,8 +18,8 @@
 #include <stdio.h>
 
 #include <fpvm/fpvm.h>
+#include <fpvm/ast.h>
 
-#include "ast.h"
 #include "unique.h"
 #include "parser_helper.h"
 
diff --git a/software/libfpvm/fpvm.c b/software/libfpvm/fpvm.c
index decaf68..2824169 100644
--- a/software/libfpvm/fpvm.c
+++ b/software/libfpvm/fpvm.c
@@ -20,8 +20,7 @@
 
 #include <fpvm/is.h>
 #include <fpvm/fpvm.h>
-
-#include "ast.h"
+#include <fpvm/ast.h>
 
 
 const char *_Xi, *_Yi, *_Xo, *_Yo; /* unique, provided by user of libfpvm */
diff --git a/software/libfpvm/parser.y b/software/libfpvm/parser.y
index cfd2013..6ed6b13 100644
--- a/software/libfpvm/parser.y
+++ b/software/libfpvm/parser.y
@@ -21,7 +21,8 @@
        #include <stdlib.h>
        #include <malloc.h>
        #include <math.h>
-       #include "ast.h"
+       #include "fpvm/ast.h"
+       #include "parser_itf.h"
        #include "parser.h"
 
 
diff --git a/software/libfpvm/parser_helper.c b/software/libfpvm/parser_helper.c
index cb7c3a9..4092dc7 100644
--- a/software/libfpvm/parser_helper.c
+++ b/software/libfpvm/parser_helper.c
@@ -17,9 +17,10 @@
 
 #include <stdio.h>
 #include <malloc.h>
+#include <fpvm/ast.h>
 
 #include "scanner.h"
-#include "ast.h"
+#include "parser_itf.h"
 #include "parser_helper.h"
 
 struct ast_node *fpvm_parse(const char *expr)
diff --git a/software/libfpvm/parser_helper.h b/software/libfpvm/parser_helper.h
index 5f95ca0..d436312 100644
--- a/software/libfpvm/parser_helper.h
+++ b/software/libfpvm/parser_helper.h
@@ -18,7 +18,7 @@
 #ifndef __PARSER_HELPER_H
 #define __PARSER_HELPER_H
 
-#include "ast.h"
+#include <fpvm/ast.h>
 
 struct ast_node *fpvm_parse(const char *expr);
 void fpvm_parse_free(struct ast_node *node);
diff --git a/software/libfpvm/parser_itf.h b/software/libfpvm/parser_itf.h
new file mode 100644
index 0000000..895da5f
--- /dev/null
+++ b/software/libfpvm/parser_itf.h
@@ -0,0 +1,33 @@
+/*
+ * Milkymist SoC (Software)
+ * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
+ *
+ * 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, version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __PARSER_ITF_H
+#define __PARSER_ITF_H
+
+#define NDEBUG
+
+struct id {
+       int token;
+       const char *label;
+       float constant;
+};
+
+void *ParseAlloc(void *(*mallocProc)(size_t));
+void ParseFree(void *p, void (*freeProc)(void*));
+void Parse(void *yyp, int yymajor, struct id *yyminor, struct ast_node **p);
+
+#endif /* __PARSER_ITF_H */
-- 
1.7.1

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to