diff --git a/Makefile b/Makefile index 90b3c40..39ea023 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ CWARN=-Wall -Wpedantic -Wextra -Wsign-conversion -Wtype-limits -Wunused-result G= O=-O3 -CFILES=compiler.c grammar.c utils.c vm.c file_loader.c viz.c json.c +CFILES=compiler.c grammar.c utils.c vm.c file_loader.c printing.c json.c OBJFILES=$(CFILES:.c=.o) all: $(NAME) diff --git a/bp.c b/bp.c index a9ffe01..cefb5aa 100644 --- a/bp.c +++ b/bp.c @@ -15,8 +15,8 @@ #include "file_loader.h" #include "grammar.h" #include "json.h" +#include "printing.h" #include "utils.h" -#include "viz.h" #include "vm.h" static const char *usage = ( diff --git a/viz.c b/printing.c similarity index 98% rename from viz.c rename to printing.c index a4aa565..68faf22 100644 --- a/viz.c +++ b/printing.c @@ -1,16 +1,21 @@ /* - * viz.c - Visualize matches. + * printing.c - Code for printing and visualizing matches. */ #include #include #include +#include "printing.h" #include "types.h" #include "utils.h" -#include "viz.h" #include "vm.h" +typedef struct match_node_s { + match_t *m; + struct match_node_s *next; +} match_node_t; + typedef struct { size_t line, printed_line; const char *color; diff --git a/viz.h b/printing.h similarity index 51% rename from viz.h rename to printing.h index 8b11bcc..7059562 100644 --- a/viz.h +++ b/printing.h @@ -1,13 +1,15 @@ /* - * Header file for viz.c (visualizing matches) + * Header file for printing.c (printing/visualizing matches) */ -#ifndef VIZ__H -#define VIZ__H +#ifndef PRINTING__H +#define PRINTING__H -typedef struct match_node_s { - match_t *m; - struct match_node_s *next; -} match_node_t; +#include "types.h" + +typedef enum { + PRINT_COLOR = 1<<0, + PRINT_LINE_NUMBERS = 1<<1, +} print_options_t; __attribute__((nonnull)) void visualize_match(match_t *m); diff --git a/vm.h b/vm.h index 2c17743..148f2b5 100644 --- a/vm.h +++ b/vm.h @@ -8,11 +8,6 @@ #include "types.h" -typedef enum { - PRINT_COLOR = 1<<0, - PRINT_LINE_NUMBERS = 1<<1, -} print_options_t; - const char *opcode_name(enum VMOpcode o); __attribute__((hot, nonnull)) match_t *match(grammar_t *g, file_t *f, const char *str, vm_op_t *op, unsigned int flags);