From 0f7b650cd1edfc1706f1c9dffd746f7fae2d35e3 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 7 Nov 2015 01:37:03 -0800 Subject: Allow customization of config.h via config.def.h --- .gitignore | 1 + Makefile | 3 +++ choices.c | 1 + config.def.h | 10 ++++++++++ config.h | 10 ---------- 5 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 config.def.h delete mode 100644 config.h diff --git a/.gitignore b/.gitignore index 8a74f1f..0a47f55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ fzy fzytest *.o +config.h diff --git a/Makefile b/Makefile index 9018404..41ea0c7 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ fzy: fzy.o match.o tty.o choices.o %.o: %.c config.h $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +config.h: + cp config.def.h config.h + install: fzy mkdir -p $(DESTDIR)$(BINDIR) cp fzy $(DESTDIR)$(BINDIR)/ diff --git a/choices.c b/choices.c index 455aacc..25b9217 100644 --- a/choices.c +++ b/choices.c @@ -89,6 +89,7 @@ const char *choices_get(choices_t *c, size_t n) { return NULL; } } + double choices_getscore(choices_t *c, size_t n) { return c->results[n].score; } diff --git a/config.def.h b/config.def.h new file mode 100644 index 0000000..98cc915 --- /dev/null +++ b/config.def.h @@ -0,0 +1,10 @@ +#define TTY_COLOR_HIGHLIGHT TTY_COLOR_YELLOW + +#define SCORE_GAP_LEADING -0.005 +#define SCORE_GAP_TRAILING -0.005 +#define SCORE_GAP_INNER -0.01 +#define SCORE_MATCH_CONSECUTIVE 1.0 +#define SCORE_MATCH_SLASH 0.9 +#define SCORE_MATCH_WORD 0.8 +#define SCORE_MATCH_CAPITAL 0.7 +#define SCORE_MATCH_DOT 0.6 diff --git a/config.h b/config.h deleted file mode 100644 index 98cc915..0000000 --- a/config.h +++ /dev/null @@ -1,10 +0,0 @@ -#define TTY_COLOR_HIGHLIGHT TTY_COLOR_YELLOW - -#define SCORE_GAP_LEADING -0.005 -#define SCORE_GAP_TRAILING -0.005 -#define SCORE_GAP_INNER -0.01 -#define SCORE_MATCH_CONSECUTIVE 1.0 -#define SCORE_MATCH_SLASH 0.9 -#define SCORE_MATCH_WORD 0.8 -#define SCORE_MATCH_CAPITAL 0.7 -#define SCORE_MATCH_DOT 0.6 -- cgit v1.2.3