Browse code

Move scoring constants into config.h

John Hawthorn authored on 19/09/2014 00:28:21
Showing 2 changed files

  • config.h index 7b56ce9..8fa5284 100644
  • match.c index 2721179..7e56072 100644
... ...
@@ -1 +1,10 @@
1 1
 #define TTY_COLOR_HIGHLIGHT TTY_COLOR_YELLOW
2
+
3
+#define SCORE_GAP_LEADING      -0.005
4
+#define SCORE_GAP_TRAILING     -0.005
5
+#define SCORE_GAP_INNER        -0.01
6
+#define SCORE_MATCH_CONSECUTIVE 1.0
7
+#define SCORE_MATCH_SLASH       0.9
8
+#define SCORE_MATCH_WORD        0.8
9
+#define SCORE_MATCH_CAPITAL     0.7
10
+#define SCORE_MATCH_DOT         0.6
... ...
@@ -7,6 +7,8 @@
7 7
 
8 8
 #include "match.h"
9 9
 
10
+#include "config.h"
11
+
10 12
 int has_match(const char *needle, const char *haystack){
11 13
 	while(*needle){
12 14
 		char nch = tolower(*needle++);
... ...
@@ -75,15 +77,6 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio
75 77
 	 * M[][] Stores the best possible score at this position.
76 78
 	 */
77 79
 
78
-#define SCORE_GAP_LEADING      -0.005
79
-#define SCORE_GAP_TRAILING     -0.005
80
-#define SCORE_GAP_INNER        -0.01
81
-#define SCORE_MATCH_CONSECUTIVE 1.0
82
-#define SCORE_MATCH_SLASH       0.9
83
-#define SCORE_MATCH_WORD        0.8
84
-#define SCORE_MATCH_CAPITAL     0.7
85
-#define SCORE_MATCH_DOT         0.6
86
-
87 80
 	/* Which positions are beginning of words */
88 81
 	char last_ch = '\0';
89 82
 	for(int i = 0; i < m; i++){