aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-01-13 22:18:32 +0100
committerThomas White <taw@bitwiz.org.uk>2014-01-13 22:18:32 +0100
commitcc3e2244796a54a394d534e19149bc53fe2b3b71 (patch)
tree8ab75dd9b2ef525432dd3a2be2154bde26135980
parent0f030d0268fc72d6a52ea221e876ff0386ebb226 (diff)
Debugging improvements
-rw-r--r--src/sc_interp.c5
-rw-r--r--src/sc_parse.c29
-rw-r--r--src/sc_parse.h1
3 files changed, 22 insertions, 13 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c
index 0aae963..4b74fef 100644
--- a/src/sc_interp.c
+++ b/src/sc_interp.c
@@ -258,6 +258,11 @@ int sc_interp_add_blocks(SCInterpreter *scin, const SCBlock *bl)
} /* else go away and sulk about it */
#endif
+ } else {
+
+ fprintf(stderr, "Don't know what to do with this:\n");
+ show_sc_block(bl, "");
+
}
bl = sc_block_next(bl);
diff --git a/src/sc_parse.c b/src/sc_parse.c
index 328e397..b94f548 100644
--- a/src/sc_parse.c
+++ b/src/sc_parse.c
@@ -135,22 +135,25 @@ void sc_block_free(SCBlock *bl)
static void recursive_show_sc_blocks(const char *prefix, const SCBlock *bl)
{
while ( bl != NULL ) {
+ show_sc_block(bl, prefix);
+ bl = bl->next;
+ }
+}
- printf("%s", prefix);
- if ( bl->name != NULL ) printf("\\%s ", bl->name);
- if ( bl->options != NULL ) printf("[%s] ", bl->options);
- if ( bl->contents != NULL ) printf("{%s}", bl->contents);
- printf("\n");
-
- if ( bl->child != NULL ) {
- char new_prefix[strlen(prefix)+3];
- strcpy(new_prefix, " ");
- strcat(new_prefix, prefix);
- recursive_show_sc_blocks(new_prefix, bl->child);
- }
- bl = bl->next;
+void show_sc_block(const SCBlock *bl, const char *prefix)
+{
+ printf("%s", prefix);
+ if ( bl->name != NULL ) printf("\\%s ", bl->name);
+ if ( bl->options != NULL ) printf("[%s] ", bl->options);
+ if ( bl->contents != NULL ) printf("{%s}", bl->contents);
+ printf("\n");
+ if ( bl->child != NULL ) {
+ char new_prefix[strlen(prefix)+3];
+ strcpy(new_prefix, " ");
+ strcat(new_prefix, prefix);
+ recursive_show_sc_blocks(new_prefix, bl->child);
}
}
diff --git a/src/sc_parse.h b/src/sc_parse.h
index 7640970..fd3e221 100644
--- a/src/sc_parse.h
+++ b/src/sc_parse.h
@@ -40,5 +40,6 @@ extern const char *sc_block_options(const SCBlock *bl);
extern const char *sc_block_contents(const SCBlock *bl);
extern void show_sc_blocks(const SCBlock *bl);
+extern void show_sc_block(const SCBlock *bl, const char *prefix);
#endif /* SC_PARSE_H */