aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-11-08 09:37:13 +0100
committerCamil Staps2016-11-08 09:37:13 +0100
commit95f715a61017a48584ac9dc953bfa0ab92aba13f (patch)
treee069cc0cd9334333419fd82f8ef12f169d2d5e6f
parentexamples (diff)
Remove leading underscore from _FUSPEL_DEBUG and _FUSPEL_CLI
-rw-r--r--interpreter/Makefile2
-rw-r--r--interpreter/code.c2
-rw-r--r--interpreter/code.h2
-rw-r--r--interpreter/eval.c16
-rw-r--r--interpreter/eval.h2
-rw-r--r--interpreter/fuspel.c22
-rw-r--r--interpreter/print.c4
-rw-r--r--interpreter/print.h2
8 files changed, 26 insertions, 26 deletions
diff --git a/interpreter/Makefile b/interpreter/Makefile
index 745b01e..eb7c812 100644
--- a/interpreter/Makefile
+++ b/interpreter/Makefile
@@ -1,4 +1,4 @@
-override CFLAGS+=-Werror -Wall -Wextra -Wno-missing-field-initializers -O3 -D_FUSPEL_CLI -D_FUSPEL_DEBUG
+override CFLAGS+=-Werror -Wall -Wextra -Wno-missing-field-initializers -O3 -DFUSPEL_CLI -DFUSPEL_DEBUG -g
DEPS=fuspel.h lex.h syntax.h print.h parse.h eval.h mem.h code.h graphs.h
OBJ=fuspel.o lex.o syntax.o print.o parse.o eval.o mem.o code.o graphs.o
diff --git a/interpreter/code.c b/interpreter/code.c
index b20b2ba..88f58b7 100644
--- a/interpreter/code.c
+++ b/interpreter/code.c
@@ -139,7 +139,7 @@ unsigned char code_find(char *name, void **function) {
return 0;
}
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
char *code_find_name(void *f) {
struct code_mapping *entry = code_table;
while (entry) {
diff --git a/interpreter/code.h b/interpreter/code.h
index 0703fc5..250c240 100644
--- a/interpreter/code.h
+++ b/interpreter/code.h
@@ -10,7 +10,7 @@ typedef void (Code_2) (struct node**, struct node*, struct node*);
unsigned char code_find(char *name, void **function);
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
char *code_find_name(void *f);
#endif
diff --git a/interpreter/eval.c b/interpreter/eval.c
index 4387c96..aa70e5a 100644
--- a/interpreter/eval.c
+++ b/interpreter/eval.c
@@ -7,7 +7,7 @@
#include "graphs.h"
#include "mem.h"
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
#include "print.h"
#endif
@@ -208,7 +208,7 @@ void eval_code_app(struct fuspel *rules, struct node **node) {
my_free(args);
}
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
struct node **root_node;
bool debug_graphs;
#endif
@@ -223,7 +223,7 @@ void eval(struct fuspel *rules, struct node **node, bool to_rnf) {
repls = my_calloc(1, sizeof(struct replacements));
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
if (!root_node && debug_graphs) {
root_node = node;
print_node_to_file(*root_node, NULL, NULL);
@@ -231,7 +231,7 @@ void eval(struct fuspel *rules, struct node **node, bool to_rnf) {
#endif
do {
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
bool print_graph = debug_graphs;
#endif
rerun = false;
@@ -293,7 +293,7 @@ void eval(struct fuspel *rules, struct node **node, bool to_rnf) {
free_node(_repls->replacement.node, 1, 1);
rerun = true;
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
if (is_code_app(*node))
print_graph = false;
#endif
@@ -334,7 +334,7 @@ void eval(struct fuspel *rules, struct node **node, bool to_rnf) {
break;
}
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
if (rerun && print_graph)
print_node_to_file(*root_node, NULL, NULL);
#endif
@@ -345,14 +345,14 @@ void eval(struct fuspel *rules, struct node **node, bool to_rnf) {
}
struct expression *eval_main(struct fuspel *rules
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
, bool debug_graphs_enabled
#endif
) {
struct node *main_node = my_calloc(1, sizeof(struct node));
struct expression *expr = my_calloc(1, sizeof(struct expression));
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
root_node = NULL;
debug_graphs = debug_graphs_enabled;
#endif
diff --git a/interpreter/eval.h b/interpreter/eval.h
index 7afe56e..8c72115 100644
--- a/interpreter/eval.h
+++ b/interpreter/eval.h
@@ -4,7 +4,7 @@
#include "syntax.h"
struct expression *eval_main(struct fuspel*
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
, bool debug_graphs
#endif
);
diff --git a/interpreter/fuspel.c b/interpreter/fuspel.c
index a2b8591..93e31db 100644
--- a/interpreter/fuspel.c
+++ b/interpreter/fuspel.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <string.h>
-#ifdef _FUSPEL_CLI
+#ifdef FUSPEL_CLI
#include <argp.h>
#include <stdbool.h>
#endif
@@ -61,24 +61,24 @@ struct fuspel *import(struct fuspel *already_parsed, char *fname) {
return pgm;
}
-#ifdef _FUSPEL_CLI
+#ifdef FUSPEL_CLI
const char *argp_prog_version = "fuspel";
const char *argp_prog_bugs = "<info@camilstaps.nl>";
static char doc[] = "Interpret a fuspel program";
static char args_doc[] = "MODULE [MODULE [MODULE [..]]]";
static struct argp_option options[] = {
{ "print-program", 'P', 0, 0, "Print the parsed program before execution" },
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
{ "debug-graphs", 'g', 0, 0, "Make a dot graph after every rewriting step" },
-#endif // _FUSPEL_DEBUG
+#endif // FUSPEL_DEBUG
{ 0 }
};
struct environment {
struct fuspel *program;
bool printProgram;
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
bool debugGraphs;
-#endif // _FUSPEL_DEBUG
+#endif // FUSPEL_DEBUG
};
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
@@ -87,11 +87,11 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case 'P':
env->printProgram = true;
break;
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
case 'g':
env->debugGraphs = true;
break;
-#endif // _FUSPEL_DEBUG
+#endif // FUSPEL_DEBUG
case ARGP_KEY_ARG:
env->program = import(env->program, arg);
break;
@@ -113,7 +113,7 @@ int main(int argc, char *argv[]) {
env.printProgram = false;
env.program = NULL;
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
env.debugGraphs = false;
#endif
@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
printf("\n\n");
}
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
result = eval_main(env.program, env.debugGraphs);
#else
result = eval_main(env.program);
@@ -143,4 +143,4 @@ int main(int argc, char *argv[]) {
return 0;
}
-#endif // _FUSPEL_CLI
+#endif // FUSPEL_CLI
diff --git a/interpreter/print.c b/interpreter/print.c
index e1ed9ed..d5134c9 100644
--- a/interpreter/print.c
+++ b/interpreter/print.c
@@ -1,6 +1,6 @@
#include "print.h"
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
@@ -135,7 +135,7 @@ void print_node(struct node *node) {
my_free(e);
}
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
static unsigned int file_count = 0;
void free_visited_nodes(struct visited_nodes *list) {
diff --git a/interpreter/print.h b/interpreter/print.h
index 43a9d19..aaf12db 100644
--- a/interpreter/print.h
+++ b/interpreter/print.h
@@ -15,7 +15,7 @@ void print_fuspel(struct fuspel*);
void print_node(struct node*);
-#ifdef _FUSPEL_DEBUG
+#ifdef FUSPEL_DEBUG
struct visited_nodes {
struct node *node;
struct visited_nodes *next;