From 5dc795f2a5fb4ba44345f26293b50564356bc8dc Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 1 Jun 2006 04:12:48 +0200 Subject: [PATCH] More color and attribute maps closer to the users --- tig.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tig.c b/tig.c index f541697..4a4ce9a 100644 --- a/tig.c +++ b/tig.c @@ -452,30 +452,6 @@ parse_options(int argc, char *argv[]) } -static struct int_map color_map[] = { -#define COLOR_MAP(name) { #name, STRING_SIZE(#name), COLOR_##name } - COLOR_MAP(DEFAULT), - COLOR_MAP(BLACK), - COLOR_MAP(BLUE), - COLOR_MAP(CYAN), - COLOR_MAP(GREEN), - COLOR_MAP(MAGENTA), - COLOR_MAP(RED), - COLOR_MAP(WHITE), - COLOR_MAP(YELLOW), -}; - -static struct int_map attr_map[] = { -#define ATTR_MAP(name) { #name, STRING_SIZE(#name), A_##name } - ATTR_MAP(NORMAL), - ATTR_MAP(BLINK), - ATTR_MAP(BOLD), - ATTR_MAP(DIM), - ATTR_MAP(REVERSE), - ATTR_MAP(STANDOUT), - ATTR_MAP(UNDERLINE), -}; - #define LINE_INFO \ LINE(DIFF_HEADER, "diff --git ", COLOR_YELLOW, COLOR_DEFAULT, 0), \ LINE(DIFF_CHUNK, "@@", COLOR_MAGENTA, COLOR_DEFAULT, 0), \ @@ -620,9 +596,33 @@ struct line { * User config file handling. */ +static struct int_map color_map[] = { +#define COLOR_MAP(name) { #name, STRING_SIZE(#name), COLOR_##name } + COLOR_MAP(DEFAULT), + COLOR_MAP(BLACK), + COLOR_MAP(BLUE), + COLOR_MAP(CYAN), + COLOR_MAP(GREEN), + COLOR_MAP(MAGENTA), + COLOR_MAP(RED), + COLOR_MAP(WHITE), + COLOR_MAP(YELLOW), +}; + #define set_color(color, name, namelen) \ set_from_int_map(color_map, ARRAY_SIZE(color_map), color, name, namelen) +static struct int_map attr_map[] = { +#define ATTR_MAP(name) { #name, STRING_SIZE(#name), A_##name } + ATTR_MAP(NORMAL), + ATTR_MAP(BLINK), + ATTR_MAP(BOLD), + ATTR_MAP(DIM), + ATTR_MAP(REVERSE), + ATTR_MAP(STANDOUT), + ATTR_MAP(UNDERLINE), +}; + #define set_attribute(attr, name, namelen) \ set_from_int_map(attr_map, ARRAY_SIZE(attr_map), attr, name, namelen) -- 2.32.0.93.g670b81a890