aboutsummaryrefslogtreecommitdiffstats
path: root/src/debug.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-03 19:57:54 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-03 20:28:55 +0200
commit74ca21a41bcb5a49d19e65c9ba88f1f864cb7095 (patch)
tree4774587e47abc0ff20453abbf714b63c36697f26 /src/debug.c
parent30ae5fd4f65f48009e6956e42ccc2c9d9ad80901 (diff)
downloadblogc-74ca21a41bcb5a49d19e65c9ba88f1f864cb7095.tar.gz
blogc-74ca21a41bcb5a49d19e65c9ba88f1f864cb7095.tar.bz2
blogc-74ca21a41bcb5a49d19e65c9ba88f1f864cb7095.zip
*: big code reorganization.
- source and tests are now splitted by target - utils lib is now called common still pending move error.c from blogc to common
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/debug.c b/src/debug.c
deleted file mode 100644
index 9689028..0000000
--- a/src/debug.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * blogc: A blog compiler.
- * Copyright (C) 2015-2016 Rafael G. Martins <rafael@rafaelmartins.eng.br>
- *
- * This program can be distributed under the terms of the BSD License.
- * See the file LICENSE.
- */
-
-#include <stdio.h>
-
-#include "template-parser.h"
-#include "utils.h"
-#include "debug.h"
-
-
-static const char*
-get_operator(blogc_template_stmt_operator_t op)
-{
- if (op & BLOGC_TEMPLATE_OP_NEQ)
- return "!=";
- if (op & BLOGC_TEMPLATE_OP_EQ) {
- if (op & BLOGC_TEMPLATE_OP_LT)
- return "<=";
- else if (op & BLOGC_TEMPLATE_OP_GT)
- return ">=";
- return "==";
- }
- if (op & BLOGC_TEMPLATE_OP_LT)
- return "<";
- else if (op & BLOGC_TEMPLATE_OP_GT)
- return ">";
- return "";
-}
-
-
-void
-blogc_debug_template(sb_slist_t *stmts)
-{
- for (sb_slist_t *tmp = stmts; tmp != NULL; tmp = tmp->next) {
- blogc_template_stmt_t *data = tmp->data;
- fprintf(stderr, "DEBUG: <TEMPLATE ");
- switch (data->type) {
- case BLOGC_TEMPLATE_IFDEF_STMT:
- fprintf(stderr, "IFDEF: %s", data->value);
- break;
- case BLOGC_TEMPLATE_IFNDEF_STMT:
- fprintf(stderr, "IFNDEF: %s", data->value);
- break;
- case BLOGC_TEMPLATE_IF_STMT:
- fprintf(stderr, "IF: %s %s %s", data->value,
- get_operator(data->op), data->value2);
- break;
- case BLOGC_TEMPLATE_ELSE_STMT:
- fprintf(stderr, "ELSE");
- break;
- case BLOGC_TEMPLATE_ENDIF_STMT:
- fprintf(stderr, "ENDIF");
- break;
- case BLOGC_TEMPLATE_FOREACH_STMT:
- fprintf(stderr, "FOREACH: %s", data->value);
- break;
- case BLOGC_TEMPLATE_ENDFOREACH_STMT:
- fprintf(stderr, "ENDFOREACH");
- break;
- case BLOGC_TEMPLATE_BLOCK_STMT:
- fprintf(stderr, "BLOCK: %s", data->value);
- break;
- case BLOGC_TEMPLATE_ENDBLOCK_STMT:
- fprintf(stderr, "ENDBLOCK");
- break;
- case BLOGC_TEMPLATE_VARIABLE_STMT:
- fprintf(stderr, "VARIABLE: %s", data->value);
- break;
- case BLOGC_TEMPLATE_CONTENT_STMT:
- fprintf(stderr, "CONTENT: `%s`", data->value);
- break;
- }
- fprintf(stderr, ">\n");
- }
-}