summaryrefslogtreecommitdiff
path: root/src/search.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-02-11 11:09:27 +0000
committerBruno Haible <bruno@clisp.org>2003-02-11 11:09:27 +0000
commit810fef43aebd9cd1d58d9a6a412c49835d3e8471 (patch)
treee00cbf3d2754cfbdfa69af299f91b21fe7e8e326 /src/search.h
parent6202aaadb1a2904f456c2ee55623bf4a1a951ad7 (diff)
downloadgperf-810fef43aebd9cd1d58d9a6a412c49835d3e8471.tar.gz
When the option -k is not given, the default key positions are now computed
depending on the set of keywords.
Diffstat (limited to 'src/search.h')
-rw-r--r--src/search.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/search.h b/src/search.h
index 7e1f781..0d67458 100644
--- a/src/search.h
+++ b/src/search.h
@@ -27,6 +27,7 @@
#define search_h 1
#include "keyword-list.h"
+#include "options.h"
#include "bool-array.h"
class Search
@@ -36,6 +37,18 @@ public:
~Search ();
void optimize ();
private:
+ void preprepare ();
+
+ /* Initializes each keyword's _selchars array. */
+ void init_selchars (bool use_all_chars, const Positions& positions) const;
+ /* Deletes each keyword's _selchars array. */
+ void delete_selchars () const;
+
+ /* Count the duplicate keywords that occur with a given set of positions. */
+ unsigned int count_duplicates (const Positions& positions) const;
+
+ void find_positions ();
+
void prepare ();
/* Computes the sum of occurrences of the _selchars of a keyword. */
@@ -90,16 +103,19 @@ public:
/* Total number of keywords, counting duplicates. */
int _total_keys;
- /* Total number of duplicates that have been moved to _duplicate_link lists
- (not counting their representatives which stay on the main list). */
- int _total_duplicates;
-
/* Maximum length of the longest keyword. */
int _max_key_len;
/* Minimum length of the shortest keyword. */
int _min_key_len;
+ /* User-specified or computed key positions. */
+ Positions _key_positions;
+
+ /* Total number of duplicates that have been moved to _duplicate_link lists
+ (not counting their representatives which stay on the main list). */
+ int _total_duplicates;
+
/* Size of alphabet. */
int const _alpha_size;