summaryrefslogtreecommitdiff
path: root/src/keyword.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2002-11-04 12:09:45 +0000
committerBruno Haible <bruno@clisp.org>2002-11-04 12:09:45 +0000
commit8797dd362b7ca7fe57e9716120f80943b758710a (patch)
tree29040c994652795b0c0bd19b91f29fcf10898175 /src/keyword.h
parent5db232cb09345df1bcfcd399dc029df62b64bc7d (diff)
downloadgperf-8797dd362b7ca7fe57e9716120f80943b758710a.tar.gz
Introduce class KeywordExt.
Diffstat (limited to 'src/keyword.h')
-rw-r--r--src/keyword.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/keyword.h b/src/keyword.h
index aa2ebfc..d52dce3 100644
--- a/src/keyword.h
+++ b/src/keyword.h
@@ -30,7 +30,7 @@ struct Keyword
/* Constructor. */
Keyword (const char *allchars, int allchars_length, const char *rest);
- /* Data members. */
+ /* Data members defined immediately by the input file. */
/* The keyword as a string, possibly containing NUL bytes. */
const char *const allchars;
const int allchars_length;
@@ -38,6 +38,28 @@ struct Keyword
const char *const rest;
};
+/* A keyword, in the context of a given keyposition list. */
+struct KeywordExt : public Keyword
+{
+ /* Constructor. */
+ KeywordExt (const char *allchars, int allchars_length, const char *rest);
+
+ /* Data members depending on the keyposition list. */
+ /* The selected characters that participate for the hash function,
+ reordered according to the keyposition list. */
+ const char * selchars;
+ int selchars_length;
+ /* Chained list of keywords having the same selchars. */
+ KeywordExt * duplicate_link;
+
+ /* Data members used by the algorithm. */
+ int occurrence; /* A metric for frequency of key set occurrences. */
+ int hash_value; /* Hash value for the key. */
+
+ /* Data members used by the output routines. */
+ int final_index;
+};
+
/* A factory for creating Keyword instances. */
class Keyword_Factory
{
@@ -45,8 +67,8 @@ public:
Keyword_Factory ();
virtual ~Keyword_Factory ();
/* Creates a new Keyword. */
- virtual Keyword create_keyword (const char *allchars, int allchars_length,
- const char *rest) = 0;
+ virtual Keyword * create_keyword (const char *allchars, int allchars_length,
+ const char *rest) = 0;
};
#endif