diff options
author | 2010-03-30 15:49:16 -0700 | |
---|---|---|
committer | 2010-07-13 19:00:56 +0000 | |
commit | 7ac4fa3f14eaf1088bf65cab2243d2015f004e52 (patch) | |
tree | 9237775528539ae29a5eaf1be2b1bf924fc191cd /test-inspect.c | |
parent | inspect: add some example inspect for symbol and statement (diff) | |
download | sparse-7ac4fa3f14eaf1088bf65cab2243d2015f004e52.tar.gz sparse-7ac4fa3f14eaf1088bf65cab2243d2015f004e52.tar.bz2 sparse-7ac4fa3f14eaf1088bf65cab2243d2015f004e52.zip |
inspect: Add test-inspect program
The test program will launch a gtk treeview windows to
display the symbol node in the AST.
Signed-Off-By: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'test-inspect.c')
-rw-r--r-- | test-inspect.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test-inspect.c b/test-inspect.c new file mode 100644 index 0000000..e437e11 --- /dev/null +++ b/test-inspect.c @@ -0,0 +1,43 @@ + +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> +#include <fcntl.h> + +#include "lib.h" +#include "allocate.h" +#include "token.h" +#include "parse.h" +#include "symbol.h" +#include "expression.h" + +#include "ast-view.h" + +static void expand_symbols(struct symbol_list *list) +{ + struct symbol *sym; + FOR_EACH_PTR(list, sym) { + expand_symbol(sym); + } END_FOR_EACH_PTR(sym); +} + +int main(int argc, char **argv) +{ + struct string_list *filelist = NULL; + char *file; + struct symbol_list *view_syms = NULL; + + gtk_init(&argc,&argv); + expand_symbols(sparse_initialize(argc, argv, &filelist)); + FOR_EACH_PTR_NOTAG(filelist, file) { + struct symbol_list *syms = sparse(file); + expand_symbols(syms); + concat_symbol_list(syms, &view_syms); + } END_FOR_EACH_PTR_NOTAG(file); + treeview_main(view_syms); + return 0; +} + |