summaryrefslogtreecommitdiffstats
path: root/dimension/main.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-20 16:31:52 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-20 16:31:52 -0500
commit86cce76328041c18fc17df4ccb7556879a6761de (patch)
treeb3743e9ed0f50b64bd1327af78508f14c1e3af8e /dimension/main.c
parent5ef725abc3a403bd51a061a88d93e9096ddb49bb (diff)
downloaddimension-86cce76328041c18fc17df4ccb7556879a6761de.tar.xz
Fix tests.
Diffstat (limited to 'dimension/main.c')
-rw-r--r--dimension/main.c19
1 files changed, 16 insertions, 3 deletions
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 <stdbool.h>
#include <stdlib.h>
#include <getopt.h>
@@ -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);