diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-09 21:50:38 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-09 21:50:38 +0200 |
| commit | deca6f4d03d36e4980715ae6709f244f381b1175 (patch) | |
| tree | e8e8b61824fb4341976c4e010edb89b65d17a770 | |
| parent | 6d2e43b8142e17f4dd0a578a961b1d8cc98894bb (diff) | |
| download | vis-deca6f4d03d36e4980715ae6709f244f381b1175.tar.gz vis-deca6f4d03d36e4980715ae6709f244f381b1175.tar.xz | |
Cleanup header files
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | editor.h | 30 | ||||
| -rw-r--r-- | syntax.h | 28 | ||||
| -rw-r--r-- | text.h | 2 | ||||
| -rw-r--r-- | vis.c | 2 | ||||
| -rw-r--r-- | window.c | 5 | ||||
| -rw-r--r-- | window.h | 4 |
7 files changed, 41 insertions, 32 deletions
@@ -1,7 +1,7 @@ include config.mk SRC = editor.c window.c text.c text-motions.c text-objects.c register.c -HDR := ${SRC:.c=.h} util.h config.def.h +HDR := ${SRC:.c=.h} syntax.h util.h config.def.h SRC += vis.c colors.c OBJ = ${SRC:.c=.o} ALL = ${SRC} ${HDR} config.mk Makefile LICENSE README vis.1 @@ -1,12 +1,12 @@ #ifndef EDITOR_H #define EDITOR_H +#include <curses.h> #include <stddef.h> -#include <regex.h> -#include "text-motions.h" -#include "text-objects.h" +#include <stdbool.h> #include "window.h" #include "register.h" +#include "syntax.h" typedef struct Editor Editor; typedef struct EditorWin EditorWin; @@ -103,30 +103,6 @@ struct Editor { bool running; /* (TODO move elsewhere?) */ }; - -typedef struct { - short fg, bg; /* fore and background color */ - int attr; /* curses attributes */ -} Color; - -typedef struct { - char *rule; /* regex to search for */ - int cflags; /* compilation flags (REG_*) used when compiling */ - Color color; /* settings to apply in case of a match */ - regex_t regex; /* compiled form of the above rule */ -} SyntaxRule; - -#define SYNTAX_REGEX_RULES 10 - -typedef struct Syntax Syntax; - -struct Syntax { /* a syntax definition */ - char *name; /* syntax name */ - char *file; /* apply to files matching this regex */ - regex_t file_regex; /* compiled file name regex */ - SyntaxRule rules[SYNTAX_REGEX_RULES]; /* all rules for this file type */ -}; - Editor *editor_new(int width, int height); void editor_free(Editor*); void editor_resize(Editor*, int width, int height); diff --git a/syntax.h b/syntax.h new file mode 100644 index 0000000..a945389 --- /dev/null +++ b/syntax.h @@ -0,0 +1,28 @@ +#ifndef SYNTAX_H +#define SYNTAX_H + +#include <regex.h> + +#define SYNTAX_REGEX_RULES 10 + +typedef struct { + short fg, bg; /* fore and background color */ + int attr; /* curses attributes */ +} Color; + +typedef struct { + char *rule; /* regex to search for */ + int cflags; /* compilation flags (REG_*) used when compiling */ + Color color; /* settings to apply in case of a match */ + regex_t regex; /* compiled form of the above rule */ +} SyntaxRule; + +typedef struct Syntax Syntax; +struct Syntax { /* a syntax definition */ + char *name; /* syntax name */ + char *file; /* apply to files matching this regex */ + regex_t file_regex; /* compiled file name regex */ + SyntaxRule rules[SYNTAX_REGEX_RULES]; /* all rules for this file type */ +}; + +#endif @@ -4,6 +4,8 @@ #include <stdbool.h> #include <stddef.h> +typedef size_t Filepos; + typedef struct { size_t start, end; /* range in bytes from start of file */ } Filerange; @@ -13,6 +13,8 @@ #include <sys/mman.h> #include "editor.h" +#include "text-motions.h" +#include "text-objects.h" #include "util.h" #ifdef PDCURSES @@ -19,11 +19,12 @@ #include <wchar.h> #include <ctype.h> #include <errno.h> -#include "editor.h" +#include <regex.h> +#include <curses.h> #include "window.h" +#include "syntax.h" #include "text.h" #include "text-motions.h" -#include "text-objects.h" #include "util.h" typedef struct { /* used to calculate the display width of a character */ @@ -1,12 +1,12 @@ #ifndef WINDOW_H #define WINDOW_H -#include <curses.h> +#include <stddef.h> +#include <stdbool.h> #include "text.h" typedef struct Syntax Syntax; typedef struct Win Win; -typedef size_t Filepos; Win *window_new(Text*); void window_free(Win*); |
