]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Initial setup for ast driven debugging graphitemaster/ast-driven-debug
authorDale Weiler <killfieldengine@gmail.com>
Sun, 1 Dec 2013 15:59:22 +0000 (10:59 -0500)
committerDale Weiler <killfieldengine@gmail.com>
Sun, 1 Dec 2013 15:59:22 +0000 (10:59 -0500)
debug.c [new file with mode: 0644]
include.mk

diff --git a/debug.c b/debug.c
new file mode 100644 (file)
index 0000000..c7d6198
--- /dev/null
+++ b/debug.c
@@ -0,0 +1,18 @@
+#include "ast.h"
+
+#if 0
+static void debug_traverse(ast_function *fun) {
+    ast_node    *at;
+    size_t       depth;
+    ast_iterator iter;
+    ast_iterator_begin(&iter, (ast_node*)fun);
+
+    for (at = (ast_node*)fun; at; at = ast_iterator_next(&iter)) {
+        for (depth = vec_size(iter.path); depth; --depth)
+            con_out("> ");
+        con_out("ast_%s (%p)\n", ast_node_type_name[at->nodetype], at);
+    }
+
+    ast_iterator_delete(&iter);
+}
+#endif
index 2bc2a839a339161f796b9721ccddb5dec6b1d11b..d97747b2fcce2bcffbcc6981c7ee04736fe1f7e1 100644 (file)
@@ -17,7 +17,7 @@ LIBS    += -lm
 COMMON   = ansi.o util.o stat.o fs.o opts.o conout.o
 
 #objects
-OBJ_C = $(COMMON) main.o lexer.o parser.o code.o ast.o ir.o ftepp.o utf8.o correct.o fold.o intrin.o
+OBJ_C = $(COMMON) main.o lexer.o parser.o code.o ast.o ir.o ftepp.o utf8.o correct.o fold.o intrin.o debug.o
 OBJ_P = $(COMMON) pak.o
 OBJ_T = $(COMMON) test.o
 OBJ_X = $(COMMON) exec.o