diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-08 01:06:43 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-08 01:06:43 -0800 |
| commit | 03c790d5b61ecc07a34e6d113a5b434b72c835fe (patch) | |
| tree | c6e1423f4083c62aabd36c22b36ea8c3fba54054 | |
| parent | 668c7baf55d07cb429b30b92ea8ce302f9de053a (diff) | |
Renamed viz -> printing, and tidied up the code a bit
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | bp.c | 2 | ||||
| -rw-r--r-- | printing.c (renamed from viz.c) | 9 | ||||
| -rw-r--r-- | printing.h (renamed from viz.h) | 16 | ||||
| -rw-r--r-- | vm.h | 5 |
5 files changed, 18 insertions, 16 deletions
@@ -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) @@ -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 = ( @@ -1,16 +1,21 @@ /* - * viz.c - Visualize matches. + * printing.c - Code for printing and visualizing matches. */ #include <stdio.h> #include <stdlib.h> #include <string.h> +#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; @@ -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); @@ -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); |
