From 86cce76328041c18fc17df4ccb7556879a6761de Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 20 Nov 2009 16:31:52 -0500 Subject: Fix tests. --- dimension/main.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'dimension/main.c') diff --git a/dimension/main.c b/dimension/main.c index 3f1c807..42661e7 100644 --- a/dimension/main.c +++ b/dimension/main.c @@ -22,6 +22,7 @@ #include "realize.h" #include "progressbar.h" #include "../libdimension/dimension.h" +#include #include #include @@ -77,6 +78,8 @@ main(int argc, char **argv) { }; } + bool debugging = tokenize || parse; + if (optind == argc - 1) { if (input) { dmnsn_error(DMNSN_SEVERITY_HIGH, "Multiple input files specified."); @@ -88,13 +91,17 @@ main(int argc, char **argv) { "Invalid extranious command line options."); } - if (!output && !(tokenize || parse)) { + if (!output && !debugging) { dmnsn_error(DMNSN_SEVERITY_HIGH, "No output file specified."); } if (!input) { dmnsn_error(DMNSN_SEVERITY_HIGH, "No input file specified."); } + /* + * Now do the work + */ + /* Open the input file */ input_file = fopen(input, "r"); if (!input_file) { @@ -102,7 +109,10 @@ main(int argc, char **argv) { } /* Tokenize the input file */ - printf("Tokenizing input...\n"); + + if (!debugging) + printf("Tokenizing input...\n"); + dmnsn_array *tokens = dmnsn_tokenize(input, input_file); if (!tokens) { fclose(input_file); @@ -121,7 +131,10 @@ main(int argc, char **argv) { } /* Parse the input */ - printf("Parsing input...\n"); + + if (!debugging) + printf("Parsing input...\n"); + dmnsn_array *astree = dmnsn_parse(tokens); if (!astree) { dmnsn_delete_tokens(tokens); -- cgit v1.2.3