diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-18 17:28:21 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-18 17:28:21 -0700 |
commit | 00e8069b4e228af1bf3e2ae282f368676efbe0db (patch) | |
tree | 25c9a67c9e016cd87bd6ac3bf792a6dd2d1ad450 | |
parent | 23b369a57c05d863eb5c2f471f52359fe287b17f (diff) |
Move scoring constants into config.h
-rw-r--r-- | config.h | 9 | ||||
-rw-r--r-- | match.c | 11 |
2 files changed, 11 insertions, 9 deletions
@@ -1 +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 @@ -7,6 +7,8 @@ #include "match.h" +#include "config.h" + int has_match(const char *needle, const char *haystack){ while(*needle){ char nch = tolower(*needle++); @@ -75,15 +77,6 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio * M[][] Stores the best possible score at this position. */ -#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 - /* Which positions are beginning of words */ char last_ch = '\0'; for(int i = 0; i < m; i++){ |