summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-03-18 10:22:37 +0000
committerBruno Haible <bruno@clisp.org>2003-03-18 10:22:37 +0000
commit6d268d095b4cb2bab821e82b785a4b74810b01a6 (patch)
tree5b3f7f60909fc6a7d5f4697c9d4ae58f947f0a7a
parent40f37680ac107a61bbe14efe6213f70c91c6b461 (diff)
downloadgperf-6d268d095b4cb2bab821e82b785a4b74810b01a6.tar.gz
Completely new asso_values search algorithm.
-rw-r--r--ChangeLog45
-rw-r--r--NEWS13
-rw-r--r--doc/gperf.texi47
-rw-r--r--src/keyword-list.cc2
-rw-r--r--src/keyword-list.h2
-rw-r--r--src/keyword.h1
-rw-r--r--src/options.cc40
-rw-r--r--src/options.h53
-rw-r--r--src/options.icc7
-rw-r--r--src/search.cc1073
-rw-r--r--src/search.h39
-rw-r--r--tests/c-parse.exp204
-rw-r--r--tests/chill.exp1164
-rw-r--r--tests/cplusplus.exp275
-rw-r--r--tests/gpc.exp101
-rw-r--r--tests/java.exp145
-rw-r--r--tests/modula2.exp180
-rw-r--r--tests/objc.exp163
-rw-r--r--tests/test-4.exp208
-rw-r--r--tests/test-6.exp9
20 files changed, 1786 insertions, 1985 deletions
diff --git a/ChangeLog b/ChangeLog
index 0d80f47..4cc74fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,50 @@
2002-12-08 Bruno Haible <bruno@clisp.org>
+ Completely new asso_values search algorithm.
+ * src/search.h (Search::compute_occurrence, Search::clear_determined,
+ Search::set_determined, Search::already_determined, Search::reorder):
+ Remove functions.
+ (Search::init_asso_values, Search::sort_by_occurrence,
+ Search::compute_occurrence, Search::sort_by_occurrence,
+ Search::has_collisions, Search::collision_prior_to): Remove functions.
+ (Search::compute_partition, Search::count_possible_collisions,
+ Search::unchanged_partition): New method declarations.
+ (Search::_determined): Remove field.
+ * src/search.cc (Search::prepare): Don't initialize _determined.
+ (Search::compute_occurrence, greater_by_occurrence,
+ Search::clear_determined, Search::set_determined,
+ Search::already_determined, Search::reorder): Remove functions.
+ (Search::init_asso_values, compute_disjoint_union,
+ Search::sort_by_occurrence, Search::compute_occurrence,
+ Search::sort_by_occurrence, Search::has_collisions,
+ Search::collision_prior_to): Remove functions.
+ (StackEntry): Remove class.
+ (EquivalenceClass, Step): New classes.
+ (equals, Search::compute_partition, delete_partition,
+ Search::count_possible_collisions, Search::unchanged_partition): New
+ functions.
+ (Search::find_asso_values): Completely rewritten.
+ (Search::find_good_asso_values): Don't call reorder().
+ (Search::~Search): Don't free _determined.
+ * src/keyword.h (KeywordExt::_occurrence): Remove field.
+ * src/options.h (ORDER, FAST, OPT_CHOICE): Remove enum values.
+ (Options::_iterations): Remove field.
+ * src/options.icc (Options::get_iterations): Remove method.
+ * src/options.cc (Options::long_usage): Remove mention of -f and -o.
+ (Options::Options): Don't initialize _iterations.
+ (Options::~Options): Update.
+ (Options::parse_options): Do nothing for options -f, -o, -O.
+ * doc/gperf.texi: (Contributors): Update.
+ (Algorithmic Details): Remove options -f and -o. Update description
+ of option -s.
+ * tests/c-parse.exp, tests/chill.exp, tests/cplusplus.exp,
+ tests/gpc.exp, tests/java.exp, tests/modula2.exp, tests/objc.exp,
+ tests/test-4.exp): Regenerated, smaller than before.
+ * tests/test-6.exp: Update.
+ * NEWS: Update.
+
+2002-12-08 Bruno Haible <bruno@clisp.org>
+
* src/search.h (Search::_alpha_size): Change type to 'unsigned int'.
(Search::_asso_value_max): Likewise.
* src/search.cc (Search::prepare_asso_values): Update.
diff --git a/NEWS b/NEWS
index cdfe72b..ae74ffb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,5 @@
-New in 2.8:
+New in 2.96:
-* Added option -m/--multiple-iterations that reduces the size of the
- generated table.
* Added option --output that allows to specify the output file name.
* Some options have been renamed:
--hash-fn-name=NAME --> --hash-function-name=NAME
@@ -34,9 +32,14 @@ New in 2.8:
* Some keyword sets containing permutations, like { "xy", "yx", "xz", "zx" }
or { "abc", "acb", "bca", "cab" }, are now handled by gperf without
requiring the option -D.
+* The generated table is usually much smaller than it was with earlier
+ versions of gperf.
+* Added option -m/--multiple-iterations that allows to further reduce the
+ size of the generated table.
* When the search for a good hash function is not immediately successful,
- backtracking is now used to continue the search. Earlier versions of gperf
- bailed out with an "Internal error, duplicate hash code value".
+ the table's size will grow as needed. Earlier versions of gperf bailed
+ out with an "Internal error, duplicate hash code value".
+* The options -f/--fast and -o/--occurrence-sort have no effect any more.
* Bug fixes.
New in 2.7.2:
diff --git a/doc/gperf.texi b/doc/gperf.texi
index c925cfc..dd4df04 100644
--- a/doc/gperf.texi
+++ b/doc/gperf.texi
@@ -7,7 +7,7 @@
@c some day we should @include version.texi instead of defining
@c these values at hand.
-@set UPDATED 20 November 2002
+@set UPDATED 8 December 2002
@set EDITION 2.7.2
@set VERSION 2.7.2
@c ---------------------
@@ -169,8 +169,9 @@ In addition, Adam de Boor and Nels Olson provided many tips and insights
that greatly helped improve the quality and functionality of @code{gperf}.
@item
-A testsuite was added by Bruno Haible. He also rewrote the input routines
-and the output routines for better reliability.
+Bruno Haible enhanced and optimized the search algorithm. He also rewrote
+the input routines and the output routines for better reliability, and
+added a testsuite.
@end itemize
@node Motivation, Search Structures, Contributors, Top
@@ -1005,15 +1006,6 @@ Using this option usually means that the generated hash function is no
longer perfect. On the other hand, it permits @code{gperf} to work on
keyword sets that it otherwise could not handle.
-@item -f @var{iteration-amount}
-@itemx --fast=@var{iteration-amount}
-Generate the perfect hash function ``fast''. This decreases
-@code{gperf}'s running time at the cost of minimizing generated
-table-size. The iteration amount represents the number of times to
-iterate when resolving a collision. `0' means iterate by the number of
-keywords. This option is probably most useful when used in conjunction
-with option @samp{-o} for @emph{large} keyword sets.
-
@item -m @var{iterations}
@itemx --multiple-iterations=@var{iterations}
Perform multiple choices of the @samp{-i} and @samp{-j} values, and
@@ -1043,24 +1035,6 @@ Instructs the generator not to include the length of a keyword when
computing its hash value. This may save a few assembly instructions in
the generated lookup table.
-@item -o
-@itemx --occurrence-sort
-Reorders the keywords by sorting the keywords so that keywords containing
-frequently occuring byte values appear first. A second reordering
-pass follows so that keywords with ``already determined values'' are placed
-towards the front of the keyword list. This may decrease the time required
-to generate a perfect hash function for many keyword sets, and also
-produce more minimal perfect hash functions. The reason for this is
-that the reordering helps prune the search time by handling inevitable
-collisions early in the search process. On the other hand, in practice,
-a decreased search time also means a less minimal hash function, and a
-higher frequency of backtracking. Furthermore, if the
-number of keywords is @emph{very} large using @samp{-o} may
-@emph{increase} @code{gperf}'s execution time, since collisions will
-begin earlier and continue throughout the remainder of keyword
-processing. See Cichelli's paper from the January 1980 Communications
-of the ACM for details.
-
@item -r
@itemx --random
Utilizes randomness to initialize the associated values table. This
@@ -1092,10 +1066,7 @@ The default value is 1, thus the default maximum associated value about
the same size as the number of keywords (for efficiency, the maximum
associated value is always rounded up to a power of 2). The actual
table size may vary somewhat, since this technique is essentially a
-heuristic. In particular, setting this value too high slows down
-@code{gperf}'s runtime, since it must search through a much larger range
-of values. Judicious use of the @samp{-f} option helps alleviate this
-overhead, however.
+heuristic.
@end table
@node Verbosity, , Algorithmic Details, Options
@@ -1188,19 +1159,19 @@ C and C++ routines.
[1] Chang, C.C.: @i{A Scheme for Constructing Ordered Minimal Perfect
Hashing Functions} Information Sciences 39(1986), 187-195.
-
+
[2] Cichelli, Richard J. @i{Author's Response to ``On Cichelli's Minimal Perfect Hash
Functions Method''} Communications of the ACM, 23, 12(December 1980), 729.
-
+
[3] Cichelli, Richard J. @i{Minimal Perfect Hash Functions Made Simple}
Communications of the ACM, 23, 1(January 1980), 17-19.
-
+
[4] Cook, C. R. and Oldehoeft, R.R. @i{A Letter Oriented Minimal
Perfect Hashing Function} SIGPLAN Notices, 17, 9(September 1982), 18-27.
[5] Cormack, G. V. and Horspool, R. N. S. and Kaiserwerth, M.
@i{Practical Perfect Hashing} Computer Journal, 28, 1(January 1985), 54-58.
-
+
[6] Jaeschke, G. @i{Reciprocal Hashing: A Method for Generating Minimal
Perfect Hashing Functions} Communications of the ACM, 24, 12(December
1981), 829-833.
diff --git a/src/keyword-list.cc b/src/keyword-list.cc
index 4f27117..d4b55f9 100644
--- a/src/keyword-list.cc
+++ b/src/keyword-list.cc
@@ -35,7 +35,7 @@ Keyword_List::Keyword_List (Keyword *car)
/* ------------------------- KeywordExt_List class ------------------------- */
-/* Unused constructor. */
+/* Constructor. */
KeywordExt_List::KeywordExt_List (KeywordExt *car)
: Keyword_List (car)
{
diff --git a/src/keyword-list.h b/src/keyword-list.h
index 664f7de..d371022 100644
--- a/src/keyword-list.h
+++ b/src/keyword-list.h
@@ -48,7 +48,7 @@ protected:
class KeywordExt_List : public Keyword_List
{
public:
- /* Unused constructor. */
+ /* Constructor. */
KeywordExt_List (KeywordExt *car);
/* Access to first element of list. */
diff --git a/src/keyword.h b/src/keyword.h
index de89730..02e0364 100644
--- a/src/keyword.h
+++ b/src/keyword.h
@@ -75,7 +75,6 @@ struct KeywordExt : public Keyword
void delete_selchars ();
/* Data members used by the algorithm. */
- int _occurrence; /* Frequency of key set occurrences. */
int _hash_value; /* Hash value for the keyword. */
/* Data members used by the output routines. */
diff --git a/src/options.cc b/src/options.cc
index e5428e5..88dacf2 100644
--- a/src/options.cc
+++ b/src/options.cc
@@ -196,13 +196,6 @@ Options::long_usage (FILE * stream) const
" -D, --duplicates Handle keywords that hash to duplicate values. This\n"
" is useful for certain highly redundant keyword sets.\n");
fprintf (stream,
- " -f, --fast=ITERATIONS Generate the gen-perf.hash function \"fast\". This\n"
- " decreases gperf's running time at the cost of\n"
- " minimizing generated table size. The numeric\n"
- " argument represents the number of times to iterate\n"
- " when resolving a collision. '0' means \"iterate by\n"
- " the number of keywords\".\n");
- fprintf (stream,
" -m, --multiple-iterations=ITERATIONS\n"
" Perform multiple choices of the -i and -j values,\n"
" and choose the best results. This increases the\n"
@@ -221,10 +214,6 @@ Options::long_usage (FILE * stream) const
" -n, --no-strlen Do not include the length of the keyword when\n"
" computing the hash function.\n");
fprintf (stream,
- " -o, --occurrence-sort Reorders input keys by frequency of occurrence of\n"
- " the key sets. This should decrease the search time\n"
- " dramatically.\n");
- fprintf (stream,
" -r, --random Utilizes randomness to initialize the associated\n"
" values table.\n");
fprintf (stream,
@@ -429,7 +418,6 @@ Options::Options ()
_input_file_name (NULL),
_output_file_name (NULL),
_language (NULL),
- _iterations (0),
_jump (DEFAULT_JUMP_VALUE),
_initial_asso_value (0),
_asso_iterations (0),
@@ -454,14 +442,12 @@ Options::~Options ()
{
fprintf (stderr, "\ndumping Options:"
"\nDEBUG is.......: %s"
- "\nORDER is.......: %s"
"\nTYPE is........: %s"
"\nRANDOM is......: %s"
"\nSWITCH is......: %s"
"\nNOLENGTH is....: %s"
"\nLENTABLE is....: %s"
"\nDUP is.........: %s"
- "\nFAST is........: %s"
"\nCOMP is........: %s"
"\nNOTYPE is......: %s"
"\nGLOBAL is......: %s"
@@ -473,8 +459,6 @@ Options::~Options ()
"\nENUM is........: %s"
"\nINCLUDE is.....: %s"
"\nSEVENBIT is....: %s"
- "\nOPT_CHOICE is..: %s"
- "\niterations = %d"
"\nlookup function name = %s"
"\nhash function name = %s"
"\nword list name = %s"
@@ -487,14 +471,12 @@ Options::~Options ()
"\ndelimiters = %s"
"\nnumber of switch statements = %d\n",
_option_word & DEBUG ? "enabled" : "disabled",
- _option_word & ORDER ? "enabled" : "disabled",
_option_word & TYPE ? "enabled" : "disabled",
_option_word & RANDOM ? "enabled" : "disabled",
_option_word & SWITCH ? "enabled" : "disabled",
_option_word & NOLENGTH ? "enabled" : "disabled",
_option_word & LENTABLE ? "enabled" : "disabled",
_option_word & DUP ? "enabled" : "disabled",
- _option_word & FAST ? "enabled" : "disabled",
_option_word & COMP ? "enabled" : "disabled",
_option_word & NOTYPE ? "enabled" : "disabled",
_option_word & GLOBAL ? "enabled" : "disabled",
@@ -506,8 +488,6 @@ Options::~Options ()
_option_word & ENUM ? "enabled" : "disabled",
_option_word & INCLUDE ? "enabled" : "disabled",
_option_word & SEVENBIT ? "enabled" : "disabled",
- _option_word & OPT_CHOICE ? "enabled" : "disabled",
- _iterations,
_function_name, _hash_name, _wordlist_name, _slot_name,
_initializer_suffix, _asso_iterations, _jump, _size_multiple,
_initial_asso_value, _delimiters, _total_switches);
@@ -711,15 +691,7 @@ Options::parse_options (int argc, char *argv[])
break;
}
case 'f': /* Generate the hash table "fast". */
- {
- _option_word |= FAST;
- if ((_iterations = atoi (/*getopt*/optarg)) < 0)
- {
- fprintf (stderr, "iterations value must not be negative, assuming 0\n");
- _iterations = 0;
- }
- break;
- }
+ break; /* Not needed any more. */
case 'F':
{
_initializer_suffix = /*getopt*/optarg;
@@ -861,15 +833,9 @@ Options::parse_options (int argc, char *argv[])
break;
}
case 'o': /* Order input by frequency of key set occurrence. */
- {
- _option_word |= ORDER;
- break;
- }
+ break; /* Not needed any more. */
case 'O': /* Optimized choice during collision resolution. */
- {
- _option_word |= OPT_CHOICE;
- break;
- }
+ break; /* Not needed any more. */
case 'p': /* Generated lookup function a pointer instead of int. */
break; /* This is now the default. */
case 'r': /* Utilize randomness to initialize the associated values table. */
diff --git a/src/options.h b/src/options.h
index bad6966..9d37201 100644
--- a/src/options.h
+++ b/src/options.h
@@ -39,72 +39,63 @@ enum Option_Type
/* Enable debugging (prints diagnostics to stderr). */
DEBUG = 1 << 0,
- /* Apply ordering heuristic to speed-up search time. */
- ORDER = 1 << 1,
-
/* Use the given key positions. */
- POSITIONS = 1 << 2,
+ POSITIONS = 1 << 1,
/* Use all characters in hash function. */
- ALLCHARS = 1 << 3,
+ ALLCHARS = 1 << 2,
/* Handle user-defined type structured keyword input. */
- TYPE = 1 << 4,
+ TYPE = 1 << 3,
/* Randomly initialize the associated values table. */
- RANDOM = 1 << 5,
+ RANDOM = 1 << 4,
/* Generate switch output to save space. */
- SWITCH = 1 << 6,
+ SWITCH = 1 << 5,
/* Don't include keyword length in hash computations. */
- NOLENGTH = 1 << 7,
+ NOLENGTH = 1 << 6,
/* Generate a length table for string comparison. */
- LENTABLE = 1 << 8,
+ LENTABLE = 1 << 7,
/* Handle duplicate hash values for keywords. */
- DUP = 1 << 9,
-
- /* Generate the hash function "fast". */
- FAST = 1 << 10,
+ DUP = 1 << 8,
/* Don't include user-defined type definition in output -- it's already
defined elsewhere. */
- NOTYPE = 1 << 11,
+ NOTYPE = 1 << 9,
/* Generate strncmp rather than strcmp. */
- COMP = 1 << 12,
+ COMP = 1 << 10,
/* Make the keyword table a global variable. */
- GLOBAL = 1 << 13,
+ GLOBAL = 1 << 11,
/* Make the generated tables readonly (const). */
- CONST = 1 << 14,
+ CONST = 1 << 12,
/* Generate K&R C code: no prototypes, no const. */
- KRC = 1 << 15,
+ KRC = 1 << 13,
/* Generate C code: no prototypes, but const (user can #define it away). */
- C = 1 << 16,
+ C = 1 << 14,
/* Generate ISO/ANSI C code: prototypes and const, but no class. */
- ANSIC = 1 << 17,
+ ANSIC = 1 << 15,
/* Generate C++ code: prototypes, const, class, inline, enum. */
- CPLUSPLUS = 1 << 18,
+ CPLUSPLUS = 1 << 16,
/* Use enum for constants. */
- ENUM = 1 << 19,
+ ENUM = 1 << 17,
/* Generate #include statements. */
- INCLUDE = 1 << 20,
+ INCLUDE = 1 << 18,
/* Assume 7-bit, not 8-bit, characters. */
- SEVENBIT = 1 << 21,
-
- /* Apply optimized collision resolution to speed-up search time. */
- OPT_CHOICE = 1 << 22
+ SEVENBIT = 1 << 19
};
/* Class manager for gperf program Options. */
@@ -140,9 +131,6 @@ public:
/* Sets the output language, if not already set. */
void set_language (const char *language);
- /* Returns the iterations value. */
- int get_iterations () const;
-
/* Returns the jump value. */
int get_jump () const;
@@ -222,9 +210,6 @@ private:
/* The output language. */
const char * _language;
- /* Amount to iterate when a collision occurs. */
- int _iterations;
-
/* Jump length when trying alternative values. */
int _jump;
diff --git a/src/options.icc b/src/options.icc
index c54af90..a9295a0 100644
--- a/src/options.icc
+++ b/src/options.icc
@@ -51,13 +51,6 @@ Options::get_output_file_name () const
return _output_file_name;
}
-/* Returns the iterations value. */
-INLINE int
-Options::get_iterations () const
-{
- return _iterations;
-}
-
/* Returns the jump value. */
INLINE int
Options::get_jump () const
diff --git a/src/search.cc b/src/search.cc
index 705827e..8fc1f7c 100644
--- a/src/search.cc
+++ b/src/search.cc
@@ -634,140 +634,6 @@ Search::prepare ()
/* Memory allocation. */
_asso_values = new int[_alpha_size];
- _determined = new bool[_alpha_size];
-}
-
-/* ---------------- Reordering the Keyword list (optional) ----------------- */
-
-/* Computes the sum of occurrences of the _selchars of a keyword.
- This is a kind of correlation measure: Keywords which have many
- selected characters in common with other keywords have a high
- occurrence sum. Keywords whose selected characters don't occur
- in other keywords have a low occurrence sum. */
-
-inline int
-Search::compute_occurrence (KeywordExt *ptr) const
-{
- int value = 0;
-
- const unsigned int *p = ptr->_selchars;
- unsigned int i = ptr->_selchars_length;
- for (; i > 0; p++, i--)
- value += _occurrences[*p];
-
- return value;
-}
-
-/* Comparison function for sorting by decreasing _occurrence valuation. */
-static bool
-greater_by_occurrence (KeywordExt *keyword1, KeywordExt *keyword2)
-{
- return keyword1->_occurrence > keyword2->_occurrence;
-}
-
-/* Auxiliary function for reorder():
- Sets all alphabet characters as undetermined. */
-
-inline void
-Search::clear_determined ()
-{
- memset (_determined, 0, _alpha_size * sizeof (_determined[0]));
-}
-
-/* Auxiliary function for reorder():
- Sets all selected characters of the keyword as determined. */
-
-inline void
-Search::set_determined (KeywordExt *keyword)
-{
- const unsigned int *p = keyword->_selchars;
- unsigned int i = keyword->_selchars_length;
- for (; i > 0; p++, i--)
- _determined[*p] = true;
-}
-
-/* Auxiliary function for reorder():
- Returns true if the keyword's selected characters are all determined. */
-
-inline bool
-Search::already_determined (KeywordExt *keyword) const
-{
- const unsigned int *p = keyword->_selchars;
- unsigned int i = keyword->_selchars_length;
- for (; i > 0; p++, i--)
- if (!_determined[*p])
- return false;
-
- return true;
-}
-
-/* Reorders the keyword list so as to minimize search times.
- First the list is reordered so that frequently occuring keys appear first.
- Then the list is reordered so that keys whose values are already determined
- will be placed towards the front of the list. This helps prune the search
- time by handling inevitable collisions early in the search process. See
- Cichelli's paper from Jan 1980 JACM for details.... */
-
-void
-Search::reorder ()
-{
- KeywordExt_List *ptr;
-
- /* Compute the _occurrence valuation of every keyword on the list. */
- for (ptr = _head; ptr; ptr = ptr->rest())
- {
- KeywordExt *keyword = ptr->first();
-
- keyword->_occurrence = compute_occurrence (keyword);
- }
-
- /* Sort the list by decreasing _occurrence valuation. */
- _head = mergesort_list (_head, greater_by_occurrence);
-
- /* Reorder the list to maximize the efficiency of the search. */
-
- /* At the beginning, consider that no asso_values[c] is fixed. */
- clear_determined ();
- for (ptr = _head; ptr != NULL && ptr->rest() != NULL; ptr = ptr->rest())
- {
- KeywordExt *keyword = ptr->first();
-
- /* Then we'll fix asso_values[c] for all c occurring in this keyword. */
- set_determined (keyword);
-
- /* Then we wish to test for hash value collisions the remaining keywords
- whose hash value is completely determined, as quickly as possible.
- For this purpose, move all the completely determined keywords in the
- remaining list immediately past this keyword. */
- KeywordExt_List *curr_ptr;
- KeywordExt_List *next_ptr; /* = curr_ptr->rest() */
- for (curr_ptr = ptr, next_ptr = curr_ptr->rest();
- next_ptr != NULL;
- next_ptr = curr_ptr->rest())
- {
- KeywordExt *next_keyword = next_ptr->first();
-
- if (already_determined (next_keyword))
- {
- if (curr_ptr == ptr)
- /* Keep next_ptr where it is. */
- curr_ptr = next_ptr;
- else
- {
- /* Remove next_ptr from its current list position... */
- curr_ptr->rest() = next_ptr->rest();
- /* ... and insert it right after ptr. */
- next_ptr->rest() = ptr->rest();
- ptr->rest() = next_ptr;
- }
-
- /* Advance ptr. */
- ptr = ptr->rest();
- }
- else
- curr_ptr = next_ptr;
- }
- }
}
/* ------------------------------------------------------------------------- */
@@ -873,515 +739,585 @@ Search::prepare_asso_values ()
_jump = option.get_jump ();
}
-/* Puts a first guess into asso_values[]. */
+/* Finds some _asso_values[] that fit. */
-void
-Search::init_asso_values ()
+/* The idea is to choose the _asso_values[] one by one, in a way that
+ a choice that has been made never needs to be undone later. This
+ means that we split the work into several steps. Each step chooses
+ one or more _asso_values[c]. The result of choosing one or more
+ _asso_values[c] is that the partitioning of the keyword set gets
+ broader.
+ Look at this partitioning: After every step, the _asso_values[] of a
+ certain set C of characters are undetermined. (At the beginning, C
+ is the set of characters c with _occurrences[c] > 0. At the end, C
+ is empty.) To each keyword K, we associate the multiset of _selchars
+ for which the _asso_values[] are undetermined:
+ K --> K->_selchars intersect C.
+ Consider two keywords equivalent if their value under this mapping is
+ the same. This introduces an equivalence relation on the set of
+ keywords. The equivalence classes partition the keyword set. (At the
+ beginning, the partition is the finest possible: each K is an equivalence
+ class by itself, because all K have a different _selchars. At the end,
+ all K have been merged into a single equivalence class.)
+ The partition before a step is always a refinement of the partition
+ after the step.
+ We choose the steps in such a way that the partition really becomes
+ broader at each step. (A step that only chooses an _asso_values[c]
+ without changing the partition is better merged with the previous step,
+ to avoid useless backtracking.) */
+
+struct EquivalenceClass
{
- if (_initial_asso_value < 0)
- {
- for (unsigned int i = 0; i < _alpha_size; i++)
- _asso_values[i] = rand () & (_asso_value_max - 1);
- }
- else
- {
- int asso_value = _initial_asso_value;
-
- asso_value = asso_value & (_asso_value_max - 1);
- for (unsigned int i = 0; i < _alpha_size; i++)
- _asso_values[i] = asso_value;
- }
-}
-
-/* Computes a keyword's hash value, relative to the current _asso_values[],
- and stores it in keyword->_hash_value.
- This is called very frequently, and needs to be fast! */
+ /* The keywords in this equivalence class. */
+ KeywordExt_List * _keywords;
+ KeywordExt_List * _keywords_last;
+ /* The number of keywords in this equivalence class. */
+ unsigned int _cardinality;
+ /* The undetermined selected characters for the keywords in this
+ equivalence class, as a canonically reordered multiset. */
+ unsigned int * _undetermined_chars;
+ unsigned int _undetermined_chars_length;
+
+ EquivalenceClass * _next;
+};
-inline int
-Search::compute_hash (KeywordExt *keyword) const
+struct Step
{
- int sum = option[NOLENGTH] ? 0 : keyword->_allchars_length;
-
- const unsigned int *p = keyword->_selchars;
- int i = keyword->_selchars_length;
- for (; i > 0; p++, i--)
- sum += _asso_values[*p];
-
- return keyword->_hash_value = sum;
-}
-
-/* Computes the disjoint union of two multisets of characters, i.e.
- the set of characters that are contained with a different multiplicity
- in set_1 and set_2. This includes those characters which are contained
- in one of the sets but not both.
- Both sets set_1[0..size_1-1] and set_2[0..size_2-1] are given ordered.
- The result, an ordered set (not multiset!) is stored in set_3[0...].
- Returns the size of the resulting set. */
+ /* The characters whose values are being determined in this step. */
+ unsigned int _changing_count;
+ unsigned int * _changing;
+ /* Exclusive upper bound for the _asso_values[c] of this step.
+ A power of 2. */
+ unsigned int _asso_value_max;
+ /* The characters whose values will be determined after this step. */
+ bool * _undetermined;
+ /* The keyword set partition after this step. */
+ EquivalenceClass * _partition;
+ /* The expected number of iterations in this step. */
+ double _expected_lower;
+ double _expected_upper;
+
+ Step * _next;
+};
-inline int
-compute_disjoint_union (const unsigned int *set_1, int size_1,
- const unsigned int *set_2, int size_2,
- unsigned int *set_3)
+static inline bool
+equals (const unsigned int *ptr1, const unsigned int *ptr2, unsigned int len)
{
- unsigned int *base = set_3;
-
- while (size_1 > 0 && size_2 > 0)
- if (*set_1 == *set_2)
- {
- set_1++, size_1--;
- set_2++, size_2--;
- }
- else
- {
- unsigned int next;
- if (*set_1 < *set_2)
- next = *set_1++, size_1--;
- else
- next = *set_2++, size_2--;
- if (set_3 == base || next != set_3[-1])
- *set_3++ = next;
- }
-
- while (size_1 > 0)
- {
- unsigned int next;
- next = *set_1++, size_1--;
- if (set_3 == base || next != set_3[-1])
- *set_3++ = next;
- }
-
- while (size_2 > 0)
+ while (len > 0)
{
- unsigned int next;
- next = *set_2++, size_2--;
- if (set_3 == base || next != set_3[-1])
- *set_3++ = next;
+ if (*ptr1 != *ptr2)
+ return false;
+ ptr1++;
+ ptr2++;
+ len--;
}
- return set_3 - base;
+ return true;
}
-/* Sorts the given set in increasing frequency of _occurrences[]. */
-
-inline void
-Search::sort_by_occurrence (unsigned int *set, unsigned int len) const
+EquivalenceClass *
+Search::compute_partition (bool *undetermined) const
{
- /* Use bubble sort, since the set is typically short. */
- for (unsigned int i = 1; i < len; i++)
+ EquivalenceClass *partition = NULL;
+ EquivalenceClass *partition_last = NULL;
+ for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
{
- unsigned int j;
- unsigned int tmp;
+ KeywordExt *keyword = temp->first();
- for (j = i, tmp = set[j];
- j > 0 && _occurrences[tmp] < _occurrences[set[j-1]];
- j--)
- set[j] = set[j - 1];
+ /* Compute the undetermined characters for this keyword. */
+ unsigned int *undetermined_chars =
+ new unsigned int[keyword->_selchars_length];
+ unsigned int undetermined_chars_length = 0;
+
+ for (int i = 0; i < keyword->_selchars_length; i++)
+ if (undetermined[keyword->_selchars[i]])
+ undetermined_chars[undetermined_chars_length++] = keyword->_selchars[i];
+
+ /* Look up the equivalence class to which this keyword belongs. */
+ EquivalenceClass *equclass;
+ for (equclass = partition; equclass; equclass = equclass->_next)
+ if (equclass->_undetermined_chars_length == undetermined_chars_length
+ && equals (equclass->_undetermined_chars, undetermined_chars,
+ undetermined_chars_length))
+ break;
+ if (equclass == NULL)
+ {
+ equclass = new EquivalenceClass();
+ equclass->_keywords = NULL;
+ equclass->_keywords_last = NULL;
+ equclass->_cardinality = 0;
+ equclass->_undetermined_chars = undetermined_chars;
+ equclass->_undetermined_chars_length = undetermined_chars_length;
+ equclass->_next = NULL;
+ if (partition)
+ partition_last->_next = equclass;
+ else
+ partition = equclass;
+ partition_last = equclass;
+ }
+ else
+ delete[] undetermined_chars;
- set[j] = tmp;
+ /* Add the keyword to the equivalence class. */
+ KeywordExt_List *cons = new KeywordExt_List(keyword);
+ if (equclass->_keywords)
+ equclass->_keywords_last->rest() = cons;
+ else
+ equclass->_keywords = cons;
+ equclass->_keywords_last = cons;
+ equclass->_cardinality++;
}
+
+ /* Free some of the allocated memory. The caller doesn't need it. */
+ for (EquivalenceClass *cls = partition; cls; cls = cls->_next)
+ delete[] cls->_undetermined_chars;
+
+ return partition;
}
-/* Computes the frequency of occurrence of a character among the keywords
- up to the given keyword. */
-inline unsigned int
-Search::compute_occurrence (unsigned int c, KeywordExt *curr) const
+static void
+delete_partition (EquivalenceClass *partition)
{
- unsigned int occurrence = 0;
-
- for (KeywordExt_List *temp = _head; ; temp = temp->rest())
+ while (partition != NULL)
{
- KeywordExt *keyword = temp->first();
-
- int m = keyword->_selchars_length;
- for (int i = 0; i < m; i++)
- if (keyword->_selchars[i] == c)
- {
- occurrence++;
- break;
- }
-
- if (keyword == curr)
- break;
+ EquivalenceClass *equclass = partition;
+ partition = equclass->_next;
+ delete_list (equclass->_keywords);
+ //delete[] equclass->_undetermined_chars; // already freed above
+ delete equclass;
}
-
- return occurrence;
}
-/* Sorts the given set in increasing frequency of occurrences among the
- keywords up to the given keyword. */
-
-inline void
-Search::sort_by_occurrence (unsigned int *set, unsigned int len, KeywordExt *curr) const
+/* Compute the possible number of collisions when _asso_values[c] is
+ chosen, leading to the given partition. */
+unsigned int
+Search::count_possible_collisions (EquivalenceClass *partition, unsigned int c) const
{
- unsigned int occurrences[len];
-
- for (unsigned int j = 0; j < len; j++)
- occurrences[j] = 0;
- for (KeywordExt_List *temp = _head; ; temp = temp->rest())
+ /* Every equivalence class p is split according to the frequency of
+ occurrence of c, leading to equivalence classes p1, p2, ...
+ This leads to (|p|^2 - |p1|^2 - |p2|^2 - ...)/2 possible collisions.
+ Return the sum of this expression over all equivalence classes. */
+ unsigned int sum = 0;
+ unsigned int m = get_max_keysig_size();
+ unsigned int split_cardinalities[m+1];
+ for (EquivalenceClass *cls = partition; cls; cls = cls->_next)
{
- KeywordExt *keyword = temp->first();
+ for (unsigned int i = 0; i <= m; i++)
+ split_cardinalities[i] = 0;
- int m = keyword->_selchars_length;
- for (unsigned int j = 0; j < len; j++)
+ for (KeywordExt_List *temp = cls->_keywords; temp; temp = temp->rest())
{
- unsigned int c = set[j];
+ KeywordExt *keyword = temp->first();
- for (int i = 0; i < m; i++)
+ unsigned int count = 0;
+ for (int i = 0; i < keyword->_selchars_length; i++)
if (keyword->_selchars[i] == c)
- {
- occurrences[j]++;
- break;
- }
+ count++;
+
+ split_cardinalities[count]++;
}
- if (keyword == curr)
- break;
+ sum += cls->_cardinality * cls->_cardinality;
+ for (unsigned int i = 0; i <= m; i++)
+ sum -= split_cardinalities[i] * split_cardinalities[i];
}
+ return sum;
+}
- /* Use bubble sort, since the set is typically short. */
- for (unsigned int i = 1; i < len; i++)
+/* Test whether adding c to the undetermined characters changes the given
+ partition. */
+bool
+Search::unchanged_partition (EquivalenceClass *partition, unsigned int c) const
+{
+ for (EquivalenceClass *cls = partition; cls; cls = cls->_next)
{
- unsigned int j;
- unsigned int set_tmp, occ_tmp;
+ unsigned int first_count = UINT_MAX;
- for (j = i, set_tmp = set[j], occ_tmp = occurrences[j];
- j > 0 && occ_tmp < occurrences[j-1];
- j--)
+ for (KeywordExt_List *temp = cls->_keywords; temp; temp = temp->rest())
{
- set[j] = set[j - 1];
- occurrences[j] = occurrences[j - 1];
- }
+ KeywordExt *keyword = temp->first();
+
+ unsigned int count = 0;
+ for (int i = 0; i < keyword->_selchars_length; i++)
+ if (keyword->_selchars[i] == c)
+ count++;
- set[j] = set_tmp;
- occurrences[j] = occ_tmp;
+ if (temp == cls->_keywords)
+ first_count = count;
+ else if (count != first_count)
+ /* c would split this equivalence class. */
+ return false;
+ }
}
+ return true;
}
-/* Returns true if the recomputed hash values for the keywords from
- _head->first() to curr - inclusive - give at least one collision.
- This is called very frequently, and needs to be fast! */
-bool
-Search::has_collisions (KeywordExt *curr)
+void
+Search::find_asso_values ()
{
- /* Iteration Number array is a win, O(1) initialization time! */
- _collision_detector->clear ();
+ Step *steps;
- for (KeywordExt_List *ptr = _head; ; ptr = ptr->rest())
- {
- KeywordExt *keyword = ptr->first();
+ /* Determine the steps, starting with the last one. */
+ {
+ bool *undetermined;
+ bool *determined;
- /* Compute new hash code for the keyword, and see whether it
- collides with another keyword's hash code. If we have too
- many collisions, we can safely abort the fruitless loop. */
- if (_collision_detector->set_bit (compute_hash (keyword)))
- return true;
+ steps = NULL;
- if (keyword == curr)
- return false;
- }
-}
+ undetermined = new bool[_alpha_size];
+ for (unsigned int c = 0; c < _alpha_size; c++)
+ undetermined[c] = false;
-/* Tests whether the given keyword has the same hash value as another one
- earlier in the list. If yes, this earlier keyword is returned (more
- precisely, the first one of them, but it doesn't really matter which one).
- If no collision is present, NULL is returned. */
-KeywordExt *
-Search::collision_prior_to (KeywordExt *curr)
-{
- for (KeywordExt_List *prior_ptr = _head;
- prior_ptr->first() != curr;
- prior_ptr = prior_ptr->rest())
- {
- KeywordExt *prior = prior_ptr->first();
+ determined = new bool[_alpha_size];
+ for (unsigned int c = 0; c < _alpha_size; c++)
+ determined[c] = true;
- if (prior->_hash_value == curr->_hash_value)
- return prior;
- }
- return NULL;
-}
+ for (;;)
+ {
+ /* Compute the partition that needs to be refined. */
+ EquivalenceClass *partition = compute_partition (undetermined);
+
+ /* Determine the main character to be chosen in this step.
+ Choosing such a character c has the effect of splitting every
+ equivalence class (according the the frequency of occurrence of c).
+ We choose the c with the minimum number of possible collisions,
+ so that characters which lead to a large number of collisions get
+ handled early during the search. */
+ unsigned int chosen_c;
+ unsigned int chosen_possible_collisions;
+ {
+ unsigned int best_c = 0;
+ unsigned int best_possible_collisions = UINT_MAX;
+ for (unsigned int c = 0; c < _alpha_size; c++)
+ if (_occurrences[c] > 0 && determined[c])
+ {
+ unsigned int possible_collisions =
+ count_possible_collisions (partition, c);
+ if (possible_collisions < best_possible_collisions)
+ {
+ best_c = c;
+ best_possible_collisions = possible_collisions;
+ }
+ }
+ if (best_possible_collisions == UINT_MAX)
+ {
+ /* All c with _occurrences[c] > 0 are undetermined. We are
+ are the starting situation and don't need any more step. */
+ delete_partition (partition);
+ break;
+ }
+ chosen_c = best_c;
+ chosen_possible_collisions = best_possible_collisions;
+ }
-/* Finding good asso_values is normally straightforwards, but needs
- backtracking in some cases. The recurse/backtrack depth can be at most
- _list_len. Since we cannot assume that the C stack is large enough,
- we perform the processing without recursion, and simulate the stack. */
-struct StackEntry
-{
- /* The current keyword. */
- KeywordExt * _curr;
+ /* We need one more step. */
+ Step *step = new Step();
- /* The prior keyword, with which curr collides. */
- KeywordExt * _prior;
+ step->_undetermined = new bool[_alpha_size];
+ memcpy (step->_undetermined, undetermined, _alpha_size*sizeof(bool));
- /* Scratch set. */
- unsigned int * _union_set;
- unsigned int _union_set_length;
+ step->_partition = partition;
- /* Current index into the scratch set. */
- unsigned int _union_index;
+ /* Now determine how the equivalence classes will be before this
+ step. */
+ undetermined[chosen_c] = true;
+ partition = compute_partition (undetermined);
- /* Trying a different value for _asso_values[_c]. */
- unsigned int _c;
+ /* Now determine which other characters should be determined in this
+ step, because they will not change the equivalence classes at
+ this point. It is the set of all c which, for all equivalence
+ classes, have the same frequency of occurrence in every keyword
+ of the equivalence class. */
+ for (unsigned int c = 0; c < _alpha_size; c++)
+ if (_occurrences[c] > 0 && determined[c]
+ && unchanged_partition (partition, c))
+ {
+ undetermined[c] = true;
+ determined[c] = false;
+ }
- /* The original value of _asso_values[_c]. */
- unsigned int _original_asso_value;
+ /* main_c must be one of these. */
+ if (determined[chosen_c])
+ abort ();
- /* Remaining number of iterations. */
- int _iter;
-};
+ /* Now the set of changing characters of this step. */
+ unsigned int changing_count;
-/* Finds some _asso_values[] that fit. */
+ changing_count = 0;
+ for (unsigned int c = 0; c < _alpha_size; c++)
+ if (undetermined[c] && !step->_undetermined[c])
+ changing_count++;
-void
-Search::find_asso_values ()
-{
- /* Add one keyword after the other and see whether its hash value collides
- with one of the previous hash values. If so, change some asso_values[]
- entry until the number of collisions so far is reduced. Then continue
- with the next keyword. */
-
- init_asso_values ();
-
- int iterations =
- !option[FAST]
- ? _asso_value_max /* Try all possible values of _asso_values[c]. */
- : option.get_iterations ()
- ? option.get_iterations ()
- : keyword_list_length ();
-
- /* Allocate stack. */
- StackEntry *stack = new StackEntry[_list_len];
- {
- KeywordExt_List *ptr = _head;
- for (int i = 0; i < _list_len; i++, ptr = ptr->rest())
- {
- stack[i]._curr = ptr->first();
- stack[i]._union_set = new unsigned int [2 * get_max_keysig_size ()];
- }
- }
+ unsigned int *changing = new unsigned int[changing_count];
+ changing_count = 0;
+ for (unsigned int c = 0; c < _alpha_size; c++)
+ if (undetermined[c] && !step->_undetermined[c])
+ changing[changing_count++] = c;
- /* Backtracking according to the standard Prolog call pattern:
+ step->_changing = changing;
+ step->_changing_count = changing_count;
- +------------------+
- -------CALL------>| |-------RETURN------>
- | |
- <------FAIL-------| |<------REDO---------
- +------------------+
+ step->_asso_value_max = _asso_value_max;
- A CALL and RETURN increase the stack pointer, FAIL and REDO decrease it.
- */
- {
- /* Current stack pointer. */
- StackEntry *sp = &stack[0];
-
- /* Local variables corresponding to *sp. */
- /* The current keyword. */
- KeywordExt *curr;
- /* The prior keyword, with which curr collides. */
- KeywordExt *prior;
- /* Scratch set. */
- unsigned int *union_set;
- unsigned int union_set_length;
- /* Current index into the scratch set. */
- unsigned int union_index;
- /* Trying a different value for _asso_values[c]. */
- unsigned int c;
- /* The original value of _asso_values[c]. */
- unsigned int original_asso_value;
- /* Remaining number of iterations. */
- int iter;
-
- /* ==== CALL ==== */
- CALL:
-
- /* Next keyword from the list. */
- curr = sp->_curr;
-
- /* Compute this keyword's hash value. */
- compute_hash (curr);
-
- /* See if it collides with a prior keyword. */
- prior = collision_prior_to (curr);
-
- if (prior != NULL)
- {
- /* Handle collision: Attempt to change an _asso_value[], in order to
- resolve a hash value collision between the two given keywords. */
+ step->_expected_lower =
+ exp (static_cast<double>(chosen_possible_collisions)
+ / static_cast<double>(_max_hash_value));
+ step->_expected_upper =
+ exp (static_cast<double>(chosen_possible_collisions)
+ / static_cast<double>(_asso_value_max));
- if (option[DEBUG])
- {
- fprintf (stderr, "collision on keyword #%d, prior = \"%.*s\", curr = \"%.*s\" hash = %d\n",
- sp - stack + 1,
- prior->_allchars_length, prior->_allchars,
- curr->_allchars_length, curr->_allchars,
- curr->_hash_value);
- fflush (stderr);
- }
+ delete_partition (partition);
- /* To achieve that the two hash values become different, we have to
- change an _asso_values[c] for a character c that contributes to the
- hash functions of prior and curr with different multiplicity.
- So we compute the set of such c. */
- union_set = sp->_union_set;
- union_set_length =
- compute_disjoint_union (prior->_selchars, prior->_selchars_length,
- curr->_selchars, curr->_selchars_length,
- union_set);
-
- /* Sort by decreasing occurrence: Try least-used characters c first.
- The idea is that this reduces the number of freshly introduced
- collisions. */
- if (option[OPT_CHOICE])
- sort_by_occurrence (union_set, union_set_length, curr);
- else
- sort_by_occurrence (union_set, union_set_length);
+ step->_next = steps;
+ steps = step;
+ }
- for (union_index = 0; union_index < union_set_length; union_index++)
- {
- c = union_set[union_index];
+ delete[] determined;
+ delete[] undetermined;
+ }
- if (option[DEBUG])
- {
- unsigned int n = sp - stack + 1;
- unsigned int o = compute_occurrence (c, curr);
- fprintf (stderr, "Expected number of iterations between %g and %g\n",
- exp (static_cast<double>((2*n-o)*o)
- / static_cast<double>(2*_max_hash_value)),
- exp (static_cast<double>((2*n-o)*o)
- / static_cast<double>(2*_asso_value_max)));
- }
+ if (option[DEBUG])
+ {
+ unsigned int stepno = 0;
+ for (Step *step = steps; step; step = step->_next)
+ {
+ stepno++;
+ fprintf (stderr, "Step %u chooses _asso_values[", stepno);
+ for (unsigned int i = 0; i < step->_changing_count; i++)
+ {
+ if (i > 0)
+ fprintf (stderr, ",");
+ fprintf (stderr, "'%c'", step->_changing[i]);
+ }
+ fprintf (stderr, "], expected number of iterations between %g and %g.\n",
+ step->_expected_lower, step->_expected_upper);
+ fprintf (stderr, "Keyword equivalence classes:\n");
+ for (EquivalenceClass *cls = step->_partition; cls; cls = cls->_next)
+ {
+ fprintf (stderr, "\n");
+ for (KeywordExt_List *temp = cls->_keywords; temp; temp = temp->rest())
+ {
+ KeywordExt *keyword = temp->first();
+ fprintf (stderr, " %.*s\n",
+ keyword->_allchars_length, keyword->_allchars);
+ }
+ }
+ fprintf (stderr, "\n");
+ }
+ }
- /* Try various other values for _asso_values[c]. A value is
- successful if, with it, the recomputed hash values for the
- keywords from _head->first() to curr - inclusive - give no
- collisions. Up to the given number of iterations are performed.
- If successful, _asso_values[c] is changed, and the recursion
- continues. If all iterations are unsuccessful, _asso_values[c]
- is restored and we backtrack, trying the next union_index. */
+ /* Initialize _asso_values[]. (The value given here matters only
+ for those c which occur in all keywords with equal multiplicity.) */
+ for (unsigned int c = 0; c < _alpha_size; c++)
+ _asso_values[c] = 0;
- original_asso_value = _asso_values[c];
+ unsigned int stepno = 0;
+ for (Step *step = steps; step; step = step->_next)
+ {
+ stepno++;
- /* Try many valid associated values. */
- for (iter = iterations; iter > 0; iter--)
- {
- /* Try next value. Wrap around mod _asso_value_max. */
- _asso_values[c] =
- (_asso_values[c] + (_jump != 0 ? _jump : rand ()))
- & (_asso_value_max - 1);
+ /* Initialize the asso_values[]. */
+ unsigned int k = step->_changing_count;
+ for (unsigned int i = 0; i < k; i++)
+ {
+ unsigned int c = step->_changing[i];
+ _asso_values[c] =
+ (_initial_asso_value < 0 ? rand () : _initial_asso_value)
+ & (step->_asso_value_max - 1);
+ }
+
+ unsigned int iterations = 0;
+ unsigned int iter[k];
+ for (unsigned int i = 0; i < k; i++)
+ iter[i] = 0;
+ unsigned int ii = (_jump != 0 ? k - 1 : 0);
+
+ for (;;)
+ {
+ /* Test whether these asso_values[] lead to collisions among
+ the equivalence classes that should be collision-free. */
+ bool has_collision = false;
+ for (EquivalenceClass *cls = step->_partition; cls; cls = cls->_next)
+ {
+ /* Iteration Number array is a win, O(1) initialization time! */
+ _collision_detector->clear ();
- if (!has_collisions (curr))
+ for (KeywordExt_List *ptr = cls->_keywords; ptr; ptr = ptr->rest())
+ {
+ KeywordExt *keyword = ptr->first();
+
+ /* Compute the new hash code for the keyword, leaving apart
+ the yet undetermined asso_values[]. */
+ int hashcode;
{
- /* Good, this _asso_values[] modification reduces the
- number of collisions so far.
- All keyword->_hash_value up to curr - inclusive -
- have been updated. */
- if (option[DEBUG])
- {
- fprintf (stderr, "- resolved after %d iterations by "
- "changing asso_value['%c'] (char #%d) to %d\n",
- iterations - iter + 1, c,
- union_index + 1, _asso_values[c]);
- fflush (stderr);
- }
- goto RECURSE_COLLISION;
- BACKTRACK_COLLISION:
- if (option[DEBUG])
- {
- fprintf (stderr, "back to collision on keyword #%d, prior = \"%.*s\", curr = \"%.*s\" hash = %d\n",
- sp - stack + 1,
- prior->_allchars_length, prior->_allchars,
- curr->_allchars_length, curr->_allchars,
- curr->_hash_value);
- fflush (stderr);
- }
+ int sum = option[NOLENGTH] ? 0 : keyword->_allchars_length;
+ const unsigned int *p = keyword->_selchars;
+ int i = keyword->_selchars_length;
+ for (; i > 0; p++, i--)
+ if (!step->_undetermined[*p])
+ sum += _asso_values[*p];
+ hashcode = sum;
}
- }
- /* Restore original values, no more tries. */
- _asso_values[c] = original_asso_value;
- }
+ /* See whether it collides with another keyword's hash code,
+ from the same equivalence class. */
+ if (_collision_detector->set_bit (hashcode))
+ {
+ has_collision = true;
+ break;
+ }
+ }
- /* Failed to resolve a collision. */
+ /* Don't need to continue looking at the other equivalence
+ classes if we already have found a collision. */
+ if (has_collision)
+ break;
+ }
- /* Recompute all keyword->_hash_value up to curr - exclusive -. */
- for (KeywordExt_List *ptr = _head; ; ptr = ptr->rest())
- {
- KeywordExt* keyword = ptr->first();
- if (keyword == curr)
- break;
- compute_hash (keyword);
- }
+ iterations++;
+ if (!has_collision)
+ break;
- if (option[DEBUG])
- {
- fprintf (stderr, "** collision not resolved after %d iterations of asso_value[",
- iterations);
- for (union_index = 0; union_index < union_set_length; union_index++)
+ /* Try other asso_values[]. */
+ if (_jump != 0)
+ {
+ /* The way we try various values for
+ asso_values[step->_changing[0],...step->_changing[k-1]]
+ is like this:
+ for (bound = 0,1,...)
+ for (ii = 0,...,k-1)
+ iter[ii] := bound
+ iter[0..ii-1] := values <= bound
+ iter[ii+1..k-1] := values < bound
+ and
+ asso_values[step->_changing[i]] =
+ _initial_asso_value + iter[i] * _jump.
+ This makes it more likely to find small asso_values[].
+ */
+ unsigned int bound = iter[ii];
+ unsigned int i = 0;
+ while (i < ii)
+ {
+ unsigned int c = step->_changing[i];
+ iter[i]++;
+ _asso_values[c] =
+ (_asso_values[c] + _jump) & (step->_asso_value_max - 1);
+ if (iter[i] <= bound)
+ goto found_next;
+ _asso_values[c] =
+ (_asso_values[c] - iter[i] * _jump)
+ & (step->_asso_value_max - 1);
+ iter[i] = 0;
+ i++;
+ }
+ i = ii + 1;
+ while (i < k)
+ {
+ unsigned int c = step->_changing[i];
+ iter[i]++;
+ _asso_values[c] =
+ (_asso_values[c] + _jump) & (step->_asso_value_max - 1);
+ if (iter[i] < bound)
+ goto found_next;
+ _asso_values[c] =
+ (_asso_values[c] - iter[i] * _jump)
+ & (step->_asso_value_max - 1);
+ iter[i] = 0;
+ i++;
+ }
+ /* Switch from one ii to the next. */
{
- if (union_index > 0)
- fprintf (stderr, ",");
- fprintf(stderr, "'%c'", union_set[union_index]);
+ unsigned int c = step->_changing[ii];
+ _asso_values[c] =
+ (_asso_values[c] - bound * _jump)
+ & (step->_asso_value_max - 1);
+ iter[ii] = 0;
}
- fprintf (stderr, "], backtracking...\n");
- fflush (stderr);
- }
- }
- else
- {
- /* Nothing to do, just recurse. */
- goto RECURSE_NO_COLLISION;
- BACKTRACK_NO_COLLISION: ;
- }
+ /* Here all iter[i] == 0. */
+ ii++;
+ if (ii == k)
+ {
+ ii = 0;
+ bound++;
+ if (bound == step->_asso_value_max)
+ {
+ /* Out of search space! We can either backtrack, or
+ increase the available search space of this step.
+ It seems simpler to choose the latter solution. */
+ step->_asso_value_max = 2 * step->_asso_value_max;
+ if (step->_asso_value_max > _asso_value_max)
+ {
+ _asso_value_max = step->_asso_value_max;
+ /* Reinitialize _max_hash_value. */
+ _max_hash_value =
+ (option[NOLENGTH] ? 0 : max_key_length ())
+ + (_asso_value_max - 1) * get_max_keysig_size ();
+ /* Reinitialize _collision_detector. */
+ delete _collision_detector;
+ _collision_detector =
+ new Bool_Array (_max_hash_value + 1);
+ }
+ }
+ }
+ {
+ unsigned int c = step->_changing[ii];
+ iter[ii] = bound;
+ _asso_values[c] =
+ (_asso_values[c] + bound * _jump)
+ & (step->_asso_value_max - 1);
+ }
+ found_next: ;
+ }
+ else
+ {
+ /* Random. */
+ unsigned int c = step->_changing[ii];
+ _asso_values[c] =
+ (_asso_values[c] + rand ()) & (step->_asso_value_max - 1);
+ /* Next time, change the next c. */
+ ii++;
+ if (ii == k)
+ ii = 0;
+ }
+ }
+ if (option[DEBUG])
+ {
+ fprintf (stderr, "Step %u chose _asso_values[", stepno);
+ for (unsigned int i = 0; i < step->_changing_count; i++)
+ {
+ if (i > 0)
+ fprintf (stderr, ",");
+ fprintf (stderr, "'%c'", step->_changing[i]);
+ }
+ fprintf (stderr, "] in %u iterations.\n", iterations);
+ }
+ }
- /* ==== FAIL ==== */
- if (sp != stack)
- {
- sp--;
- /* ==== REDO ==== */
- curr = sp->_curr;
- prior = sp->_prior;
- if (prior == NULL)
- goto BACKTRACK_NO_COLLISION;
- union_set = sp->_union_set;
- union_set_length = sp->_union_set_length;
- union_index = sp->_union_index;
- c = sp->_c;
- original_asso_value = sp->_original_asso_value;
- iter = sp->_iter;
- goto BACKTRACK_COLLISION;
- }
+ /* Free allocated memory. */
+ while (steps != NULL)
+ {
+ Step *step = steps;
+ steps = step->_next;
+ delete[] step->_changing;
+ delete[] step->_undetermined;
+ delete_partition (step->_partition);
+ delete step;
+ }
+}
- /* No solution found after an exhaustive search!
- We should ideally turn off option[FAST] and, if that doesn't help,
- multiply _asso_value_max by 2. */
- fprintf (stderr,
- "\nBig failure, always got duplicate hash code values.\n");
- if (option[POSITIONS])
- fprintf (stderr, "try options -m or -r, or use new key positions.\n\n");
- else
- fprintf (stderr, "try options -m or -r.\n\n");
- exit (1);
-
- RECURSE_COLLISION:
- /*sp->_union_set = union_set;*/ // redundant
- sp->_union_set_length = union_set_length;
- sp->_union_index = union_index;
- sp->_c = c;
- sp->_original_asso_value = original_asso_value;
- sp->_iter = iter;
- RECURSE_NO_COLLISION:
- /*sp->_curr = curr;*/ // redundant
- sp->_prior = prior;
- /* ==== RETURN ==== */
- sp++;
- if (sp - stack < _list_len)
- goto CALL;
- }
+/* Computes a keyword's hash value, relative to the current _asso_values[],
+ and stores it in keyword->_hash_value. */
- /* Deallocate stack. */
- {
- for (int i = 0; i < _list_len; i++)
- delete[] stack[i]._union_set;
- }
- delete[] stack;
+inline int
+Search::compute_hash (KeywordExt *keyword) const
+{
+ int sum = option[NOLENGTH] ? 0 : keyword->_allchars_length;
+
+ const unsigned int *p = keyword->_selchars;
+ int i = keyword->_selchars_length;
+ for (; i > 0; p++, i--)
+ sum += _asso_values[*p];
+
+ return keyword->_hash_value = sum;
}
/* Finds good _asso_values[]. */
@@ -1390,8 +1326,6 @@ void
Search::find_good_asso_values ()
{
prepare ();
- if (option[ORDER])
- reorder ();
prepare_asso_values ();
/* Search for good _asso_values[]. */
@@ -1529,7 +1463,6 @@ Search::optimize ()
Search::~Search ()
{
delete _collision_detector;
- delete[] _determined;
if (option[DEBUG])
{
fprintf (stderr, "\ndumping occurrence and associated values tables\n");
diff --git a/src/search.h b/src/search.h
index 2ff3f78..ada14d2 100644
--- a/src/search.h
+++ b/src/search.h
@@ -30,6 +30,8 @@
#include "positions.h"
#include "bool-array.h"
+struct EquivalenceClass;
+
class Search
{
public:
@@ -62,16 +64,6 @@ private:
void prepare ();
- /* Computes the sum of occurrences of the _selchars of a keyword. */
- int compute_occurrence (KeywordExt *ptr) const;
-
- /* Auxiliary functions used by Search::reorder(). */
- void clear_determined ();
- void set_determined (KeywordExt *keyword);
- bool already_determined (KeywordExt *keyword) const;
- /* Reorders the keyword list so as to minimize search times. */
- void reorder ();
-
/* Returns the length of keyword list. */
int keyword_list_length () const;
@@ -83,30 +75,20 @@ private:
/* Initializes the asso_values[] related parameters. */
void prepare_asso_values ();
- /* Puts a first guess into asso_values[]. */
- void init_asso_values ();
-
- /* Computes a keyword's hash value, relative to the current _asso_values[],
- and stores it in keyword->_hash_value. */
- int compute_hash (KeywordExt *keyword) const;
- /* Computes the frequency of occurrence of a character among the keywords
- up to the given keyword. */
- unsigned int compute_occurrence (unsigned int c, KeywordExt *curr) const;
+ EquivalenceClass * compute_partition (bool *undetermined) const;
- /* Sorts the given set in increasing frequency of _occurrences[]. */
- void sort_by_occurrence (unsigned int *set, unsigned int len) const;
- /* Sorts the given set in increasing frequency of occurrences among the
- keywords up to the given keyword. */
- void sort_by_occurrence (unsigned int *set, unsigned int len, KeywordExt *curr) const;
+ unsigned int count_possible_collisions (EquivalenceClass *partition, unsigned int c) const;
- bool has_collisions (KeywordExt *curr);
-
- KeywordExt * collision_prior_to (KeywordExt *curr);
+ bool unchanged_partition (EquivalenceClass *partition, unsigned int c) const;
/* Finds some _asso_values[] that fit. */
void find_asso_values ();
+ /* Computes a keyword's hash value, relative to the current _asso_values[],
+ and stores it in keyword->_hash_value. */
+ int compute_hash (KeywordExt *keyword) const;
+
/* Finds good _asso_values[]. */
void find_good_asso_values ();
@@ -152,9 +134,6 @@ private:
/* Length of _head list. Number of keywords, not counting duplicates. */
int _list_len;
- /* Vector used during Search::reorder(). */
- bool * _determined;
-
/* Exclusive upper bound for every _asso_values[c]. A power of 2. */
unsigned int _asso_value_max;
diff --git a/tests/c-parse.exp b/tests/c-parse.exp
index 9d229ba..405be7b 100644
--- a/tests/c-parse.exp
+++ b/tests/c-parse.exp
@@ -7,9 +7,9 @@ struct resword { const char *name; short token; enum rid rid; };
#define TOTAL_KEYWORDS 83
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 20
-#define MIN_HASH_VALUE 8
-#define MAX_HASH_VALUE 141
-/* maximum key range = 134, duplicates = 0 */
+#define MIN_HASH_VALUE 12
+#define MAX_HASH_VALUE 125
+/* maximum key range = 114, duplicates = 0 */
#ifdef __GNUC__
__inline
@@ -25,32 +25,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 35, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 1, 142, 90, 1, 28,
- 40, 6, 1, 24, 3, 13, 142, 36, 60, 14,
- 49, 3, 6, 142, 19, 8, 1, 50, 33, 11,
- 2, 23, 4, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 19, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 1, 126, 12, 50, 17,
+ 22, 18, 51, 37, 5, 10, 126, 15, 35, 49,
+ 27, 40, 28, 126, 2, 20, 1, 33, 64, 7,
+ 11, 4, 7, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126
};
register int hval = len;
@@ -71,112 +71,102 @@ static struct resword wordlist[] =
{
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"out", TYPE_QUAL, RID_OUT},
- {"", 0, 0},
- {"float", TYPESPEC, RID_FLOAT},
- {"__typeof", TYPEOF, NORID},
- {"", 0, 0},
+ {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"__real__", REALPART, NORID},
{"__typeof__", TYPEOF, NORID},
- {"typeof", TYPEOF, NORID},
- {"typedef", SCSPEC, RID_TYPEDEF},
- {"if", IF, NORID},
- {"short", TYPESPEC, RID_SHORT},
+ {"__restrict", TYPE_QUAL, RID_RESTRICT},
{"int", TYPESPEC, RID_INT},
- {"sizeof", SIZEOF, NORID},
- {"__signed__", TYPESPEC, RID_SIGNED},
- {"__extension__", EXTENSION, NORID},
- {"inout", TYPE_QUAL, RID_INOUT},
+ {"__restrict__", TYPE_QUAL, RID_RESTRICT},
+ {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__imag__", IMAGPART, NORID},
- {"else", ELSE, NORID},
+ {"__asm__", ASM_KEYWORD, NORID},
{"__inline__", SCSPEC, RID_INLINE},
- {"byref", TYPE_QUAL, RID_BYREF},
+ {"__iterator", SCSPEC, RID_ITERATOR},
{"__iterator__", SCSPEC, RID_ITERATOR},
- {"__inline", SCSPEC, RID_INLINE},
- {"__real__", REALPART, NORID},
- {"switch", SWITCH, NORID},
- {"__restrict", TYPE_QUAL, RID_RESTRICT},
- {"goto", GOTO, NORID},
- {"__restrict__", TYPE_QUAL, RID_RESTRICT},
- {"struct", STRUCT, NORID},
- {"while", WHILE, NORID},
- {"restrict", TYPE_QUAL, RID_RESTRICT},
+ {"__alignof__", ALIGNOF, NORID},
{"__const", TYPE_QUAL, RID_CONST},
- {"oneway", TYPE_QUAL, RID_ONEWAY},
+ {"__attribute__", ATTRIBUTE, NORID},
{"__const__", TYPE_QUAL, RID_CONST},
- {"__complex", TYPESPEC, RID_COMPLEX},
+ {"struct", STRUCT, NORID},
{"__complex__", TYPESPEC, RID_COMPLEX},
- {"for", FOR, NORID},
- {"__iterator", SCSPEC, RID_ITERATOR},
- {"__imag", IMAGPART, NORID},
- {"do", DO, NORID},
- {"case", CASE, NORID},
- {"__volatile__", TYPE_QUAL, RID_VOLATILE},
- {"break", BREAK, NORID},
- {"default", DEFAULT, NORID},
- {"__volatile", TYPE_QUAL, RID_VOLATILE},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"@defs", DEFS, NORID},
+ {"restrict", TYPE_QUAL, RID_RESTRICT},
+ {"__signed__", TYPESPEC, RID_SIGNED},
+ {"__extension__", EXTENSION, NORID},
{"id", OBJECTNAME, RID_ID},
- {"", 0, 0},
- {"__signed", TYPESPEC, RID_SIGNED},
- {"bycopy", TYPE_QUAL, RID_BYCOPY},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"extern", SCSPEC, RID_EXTERN},
- {"", 0, 0},
+ {"char", TYPESPEC, RID_CHAR},
+ {"return", RETURN, NORID},
+ {"__inline", SCSPEC, RID_INLINE},
+ {"__complex", TYPESPEC, RID_COMPLEX},
{"in", TYPE_QUAL, RID_IN},
+ {"while", WHILE, NORID},
+ {"switch", SWITCH, NORID},
+ {"__attribute", ATTRIBUTE, NORID},
{"", 0, 0},
- {"@compatibility_alias", ALIAS, NORID},
- {"", 0, 0},
+ {"__real", REALPART, NORID},
+ {"out", TYPE_QUAL, RID_OUT},
+ {"__label__", LABEL, NORID},
{"@private", PRIVATE, NORID},
{"@selector", SELECTOR, NORID},
{"register", SCSPEC, RID_REGISTER},
- {"__label__", LABEL, NORID},
- {"", 0, 0}, {"", 0, 0},
- {"enum", ENUM, NORID},
- {"return", RETURN, NORID},
- {"", 0, 0}, {"", 0, 0},
- {"signed", TYPESPEC, RID_SIGNED},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"const", TYPE_QUAL, RID_CONST},
- {"", 0, 0},
+ {"__signed", TYPESPEC, RID_SIGNED},
+ {"extern", SCSPEC, RID_EXTERN},
+ {"@protected", PROTECTED, NORID},
+ {"__imag", IMAGPART, NORID},
+ {"static", SCSPEC, RID_STATIC},
+ {"inout", TYPE_QUAL, RID_INOUT},
+ {"auto", SCSPEC, RID_AUTO},
+ {"for", FOR, NORID},
+ {"case", CASE, NORID},
+ {"else", ELSE, NORID},
+ {"__typeof", TYPEOF, NORID},
+ {"@defs", DEFS, NORID},
+ {"if", IF, NORID},
+ {"do", DO, NORID},
+ {"@protocol", PROTOCOL, NORID},
+ {"short", TYPESPEC, RID_SHORT},
+ {"__asm", ASM_KEYWORD, NORID},
+ {"oneway", TYPE_QUAL, RID_ONEWAY},
{"inline", SCSPEC, RID_INLINE},
- {"__real", REALPART, NORID},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"void", TYPESPEC, RID_VOID},
{"continue", CONTINUE, NORID},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0},
{"@encode", ENCODE, NORID},
- {"auto", SCSPEC, RID_AUTO},
- {"__asm__", ASM_KEYWORD, NORID},
- {"@interface", INTERFACE, NORID},
+ {"@end", END, NORID},
{"__alignof", ALIGNOF, NORID},
+ {"@interface", INTERFACE, NORID},
+ {"union", UNION, NORID},
+ {"@public", PUBLIC, NORID},
+ {"bycopy", TYPE_QUAL, RID_BYCOPY},
+ {"__volatile__", TYPE_QUAL, RID_VOLATILE},
{"double", TYPESPEC, RID_DOUBLE},
- {"__alignof__", ALIGNOF, NORID},
- {"@protected", PROTECTED, NORID},
- {"__attribute__", ATTRIBUTE, NORID},
- {"unsigned", TYPESPEC, RID_UNSIGNED},
- {"volatile", TYPE_QUAL, RID_VOLATILE},
- {"__attribute", ATTRIBUTE, NORID},
{"@class", CLASS, NORID},
- {"__asm", ASM_KEYWORD, NORID},
+ {"default", DEFAULT, NORID},
+ {"goto", GOTO, NORID},
+ {"unsigned", TYPESPEC, RID_UNSIGNED},
+ {"sizeof", SIZEOF, NORID},
+ {"signed", TYPESPEC, RID_SIGNED},
+ {"typeof", TYPEOF, NORID},
+ {"typedef", SCSPEC, RID_TYPEDEF},
+ {"break", BREAK, NORID},
+ {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"__volatile", TYPE_QUAL, RID_VOLATILE},
+ {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"float", TYPESPEC, RID_FLOAT},
+ {"", 0, 0},
+ {"@compatibility_alias", ALIAS, NORID},
+ {"void", TYPESPEC, RID_VOID},
{"", 0, 0}, {"", 0, 0},
- {"@implementation", IMPLEMENTATION, NORID},
+ {"long", TYPESPEC, RID_LONG},
+ {"enum", ENUM, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"union", UNION, NORID},
+ {"byref", TYPE_QUAL, RID_BYREF},
+ {"", 0, 0},
+ {"@implementation", IMPLEMENTATION, NORID},
{"", 0, 0}, {"", 0, 0},
- {"@public", PUBLIC, NORID},
{"asm", ASM_KEYWORD, NORID},
- {"", 0, 0},
- {"@protocol", PROTOCOL, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"@end", END, NORID},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"static", SCSPEC, RID_STATIC},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"long", TYPESPEC, RID_LONG},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"char", TYPESPEC, RID_CHAR}
+ {"volatile", TYPE_QUAL, RID_VOLATILE}
};
#ifdef __GNUC__
diff --git a/tests/chill.exp b/tests/chill.exp
index dfb4293..089843f 100644
--- a/tests/chill.exp
+++ b/tests/chill.exp
@@ -7,7 +7,7 @@ struct resword {
enum toktype { RESERVED, DIRECTIVE, PREDEF } flags;
};
extern tree ridpointers [];
-/* maximum key range = 2275, duplicates = 0 */
+/* maximum key range = 1046, duplicates = 0 */
#ifdef __GNUC__
__inline
@@ -23,32 +23,32 @@ hash (str, len)
{
static unsigned short asso_values[] =
{
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 300, 9, 14, 11, 1,
- 16, 321, 2, 33, 199, 9, 7, 99, 64, 56,
- 93, 7, 7, 123, 1, 122, 10, 8, 71, 45,
- 26, 2291, 2291, 2291, 2291, 1, 2291, 126, 89, 22,
- 204, 1, 230, 158, 1, 7, 71, 2, 125, 17,
- 6, 25, 13, 7, 4, 71, 1, 157, 14, 122,
- 4, 132, 66, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291,
- 2291, 2291, 2291, 2291, 2291, 2291, 2291
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 40, 45, 59, 88, 61,
+ 11, 128, 5, 2, 199, 8, 102, 101, 8, 11,
+ 24, 33, 11, 13, 4, 34, 10, 105, 83, 75,
+ 155, 1050, 1050, 1050, 1050, 5, 1050, 10, 33, 19,
+ 43, 14, 4, 52, 1, 1, 232, 116, 28, 78,
+ 7, 2, 1, 63, 5, 3, 1, 10, 143, 186,
+ 244, 75, 139, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
+ 1050, 1050, 1050, 1050, 1050, 1050, 1050
};
register int hval = len;
@@ -133,312 +133,312 @@ in_word_set (str, len)
TOTAL_KEYWORDS = 300,
MIN_WORD_LENGTH = 2,
MAX_WORD_LENGTH = 30,
- MIN_HASH_VALUE = 16,
- MAX_HASH_VALUE = 2290
+ MIN_HASH_VALUE = 4,
+ MAX_HASH_VALUE = 1049
};
static struct resword wordlist[] =
{
{"to", TO, NORID, RESERVED},
- {"then", THEN, NORID, RESERVED},
- {"EVER", EVER, NORID, RESERVED},
- {"not", NOT, NORID, RESERVED},
- {"xor", XOR, NORID, RESERVED},
- {"od", OD, NORID, RESERVED},
- {"DCL", DCL, NORID, RESERVED},
{"in", IN, RID_IN, RESERVED},
- {"FAR", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"BY", BY, NORID, RESERVED},
- {"CALL", CALL, NORID, RESERVED},
- {"REF", REF, NORID, RESERVED},
- {"out", PARAMATTR, RID_OUT, RESERVED},
- {"init", INIT, NORID, RESERVED},
{"on", ON, NORID, RESERVED},
- {"context", CONTEXT, NORID, RESERVED},
- {"OD", OD, NORID, RESERVED},
- {"BUFFER", BUFFER, NORID, RESERVED},
- {"CYCLE", CYCLE, NORID, RESERVED},
- {"OUT", PARAMATTR, RID_OUT, RESERVED},
- {"END", END, NORID, RESERVED},
- {"EVEN", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"EVENT", EVENT, NORID, RESERVED},
- {"EXIT", EXIT, NORID, RESERVED},
- {"WHILE", WHILE, NORID, RESERVED},
- {"RECEIVE", RECEIVE, NORID, RESERVED},
- {"this", THIS, NORID, RESERVED},
- {"IN", IN, RID_IN, RESERVED},
- {"TEXT", TEXT, NORID, RESERVED},
- {"else", ELSE, NORID, RESERVED},
- {"TO", TO, NORID, RESERVED},
{"or", OR, NORID, RESERVED},
{"pos", POS, NORID, RESERVED},
- {"THEN", THEN, NORID, RESERVED},
- {"spec", SPEC, NORID, RESERVED},
- {"DO", DO, NORID, RESERVED},
- {"ROW", ROW, NORID, RESERVED},
- {"ON", ON, NORID, RESERVED},
- {"LOC", LOC, NORID, RESERVED},
- {"FOR", FOR, NORID, RESERVED},
- {"REM", REM, NORID, RESERVED},
+ {"init", INIT, NORID, RESERVED},
+ {"this", THIS, NORID, RESERVED},
+ {"set", SET, NORID, RESERVED},
+ {"not", NOT, NORID, RESERVED},
+ {"for", FOR, NORID, RESERVED},
+ {"orif", ORIF, NORID, RESERVED},
+ {"IN", IN, RID_IN, RESERVED},
+ {"ref", REF, NORID, RESERVED},
+ {"od", OD, NORID, RESERVED},
+ {"stop", STOP, NORID, RESERVED},
+ {"inout", PARAMATTR, RID_INOUT, RESERVED},
+ {"at", AT, NORID, RESERVED},
{"INIT", INIT, NORID, RESERVED},
- {"PACK", PACK, NORID, RESERVED},
- {"pack", PACK, NORID, RESERVED},
- {"UP", UP, NORID, RESERVED},
- {"ever", EVER, NORID, RESERVED},
- {"even", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"ON", ON, NORID, RESERVED},
+ {"THIS", THIS, NORID, RESERVED},
+ {"OR", OR, NORID, RESERVED},
+ {"then", THEN, NORID, RESERVED},
+ {"OUT", PARAMATTR, RID_OUT, RESERVED},
{"proc", PROC, NORID, RESERVED},
- {"event", EVENT, NORID, RESERVED},
- {"optimize", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"row", ROW, NORID, RESERVED},
+ {"TO", TO, NORID, RESERVED},
{"SET", SET, NORID, RESERVED},
- {"exit", EXIT, NORID, RESERVED},
- {"syn", SYN, NORID, RESERVED},
- {"asm", ASM_KEYWORD, NORID, RESERVED},
- {"SPEC", SPEC, NORID, RESERVED},
- {"CASE", CASE, NORID, RESERVED},
- {"BUFFER_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"esac", ESAC, NORID, RESERVED},
- {"by", BY, NORID, RESERVED},
- {"BASED", BASED, NORID, RESERVED},
+ {"step", STEP, NORID, RESERVED},
+ {"start", START, NORID, RESERVED},
+ {"REF", REF, NORID, RESERVED},
+ {"return", RETURN, NORID, RESERVED},
{"NOT", NOT, NORID, RESERVED},
- {"BODY", BODY, NORID, RESERVED},
+ {"assert", ASSERT, NORID, RESERVED},
+ {"ORIF", ORIF, NORID, RESERVED},
+ {"returns", RETURNS, NORID, RESERVED},
+ {"chars", CHARS, NORID, RESERVED},
+ {"nonref", NONREF, NORID, RESERVED},
+ {"far", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"do", DO, NORID, RESERVED},
+ {"nolist", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"esac", ESAC, NORID, RESERVED},
+ {"FOR", FOR, NORID, RESERVED},
+ {"static", STATIC, NORID, RESERVED},
{"loc", LOC, NORID, RESERVED},
- {"bit", BOOLS, RID_BOOLS, PREDEF},
- {"up", UP, NORID, RESERVED},
+ {"process", PROCESS, NORID, RESERVED},
+ {"struct", STRUCT, NORID, RESERVED},
{"if", IF, NORID, RESERVED},
- {"EVENT_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"bin", BIN, NORID, RESERVED},
- {"XOR", XOR, NORID, RESERVED},
- {"FORBID", FORBID, NORID, RESERVED},
- {"inline", INLINE, RID_INLINE, RESERVED},
- {"DOWN", DOWN, NORID, RESERVED},
- {"OR", OR, NORID, RESERVED},
{"of", OF, NORID, RESERVED},
- {"REMOTE", REMOTE, NORID, RESERVED},
- {"case", CASE, NORID, RESERVED},
- {"nopack", NOPACK, NORID, RESERVED},
- {"empty_on", EMPTY_ON, NORID, DIRECTIVE},
- {"THIS", THIS, NORID, RESERVED},
- {"with", WITH, NORID, RESERVED},
- {"INLINE", INLINE, RID_INLINE, RESERVED},
+ {"result", RESULT, NORID, RESERVED},
+ {"and", AND, NORID, RESERVED},
+ {"inline", INLINE, RID_INLINE, RESERVED},
{"goto", GOTO, NORID, RESERVED},
- {"SEIZE", SEIZE, NORID, RESERVED},
- {"MOD", MOD, NORID, RESERVED},
- {"assert", ASSERT, NORID, RESERVED},
- {"BIT", BOOLS, RID_BOOLS, PREDEF},
- {"WITH", WITH, NORID, RESERVED},
- {"SYN", SYN, NORID, RESERVED},
- {"FI", FI, NORID, RESERVED},
- {"SEND", SEND, NORID, RESERVED},
- {"do", DO, NORID, RESERVED},
- {"inout", PARAMATTR, RID_INOUT, RESERVED},
+ {"send", SEND, NORID, RESERVED},
+ {"end", END, NORID, RESERVED},
+ {"reentrant", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"POS", POS, NORID, RESERVED},
+ {"andif", ANDIF, NORID, RESERVED},
+ {"read", READ, RID_READ, RESERVED},
+ {"INOUT", PARAMATTR, RID_INOUT, RESERVED},
{"continue", CONTINUE, NORID, RESERVED},
+ {"UP", UP, NORID, RESERVED},
+ {"FAR", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"bools", BOOLS, RID_BOOLS, RESERVED},
+ {"case", CASE, NORID, RESERVED},
+ {"OD", OD, NORID, RESERVED},
+ {"up", UP, NORID, RESERVED},
+ {"AT", AT, NORID, RESERVED},
+ {"region", REGION, NORID, RESERVED},
+ {"grant", GRANT, NORID, RESERVED},
+ {"THEN", THEN, NORID, RESERVED},
+ {"small", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"ccitt_os", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"cause", CAUSE, NORID, RESERVED},
{"RETURN", RETURN, NORID, RESERVED},
- {"ELSE", ELSE, NORID, RESERVED},
- {"nolist", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"ORIF", ORIF, NORID, RESERVED},
- {"end", END, NORID, RESERVED},
- {"powerset", POWERSET, NORID, RESERVED},
- {"chars", CHARS, NORID, RESERVED},
- {"mod", MOD, NORID, RESERVED},
- {"text", TEXT, NORID, RESERVED},
- {"cycle", CYCLE, NORID, RESERVED},
- {"step", STEP, NORID, RESERVED},
- {"CCITT_OS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"for", FOR, NORID, RESERVED},
- {"NONREF", NONREF, NORID, RESERVED},
- {"CONTEXT", CONTEXT, NORID, RESERVED},
+ {"STOP", STOP, NORID, RESERVED},
+ {"after", AFTER, NORID, RESERVED},
{"rem", REM, NORID, RESERVED},
- {"NEWMODE", NEWMODE, NORID, RESERVED},
- {"range", RANGE, NORID, RESERVED},
- {"OPTIMIZE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"page", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"nonref", NONREF, NORID, RESERVED},
- {"while", WHILE, NORID, RESERVED},
+ {"asm", ASM_KEYWORD, NORID, RESERVED},
+ {"forbid", FORBID, NORID, RESERVED},
+ {"exit", EXIT, NORID, RESERVED},
+ {"state_routine", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"priority", PRIORITY, NORID, RESERVED},
- {"stop", STOP, NORID, RESERVED},
- {"all", ALL, NORID, RESERVED},
- {"list", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"INOUT", PARAMATTR, RID_INOUT, RESERVED},
- {"CAUSE", CAUSE, NORID, RESERVED},
- {"BIN", BIN, NORID, RESERVED},
- {"ELSIF", ELSIF, NORID, RESERVED},
- {"timeout", TIMEOUT, NORID, RESERVED},
- {"process", PROCESS, NORID, RESERVED},
- {"RESULT", RESULT, NORID, RESERVED},
+ {"access", ACCESS, NORID, RESERVED},
+ {"RETURNS", RETURNS, NORID, RESERVED},
+ {"begin", BEGINTOKEN, NORID, RESERVED},
+ {"spec", SPEC, NORID, RESERVED},
+ {"page", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"elsif", ELSIF, NORID, RESERVED},
+ {"TEXT", TEXT, NORID, RESERVED},
+ {"START", START, NORID, RESERVED},
+ {"array", ARRAY, NORID, RESERVED},
{"remote", REMOTE, NORID, RESERVED},
- {"at", AT, NORID, RESERVED},
- {"receive", RECEIVE, NORID, RESERVED},
- {"exceptions", EXCEPTIONS, NORID, RESERVED},
{"PROC", PROC, NORID, RESERVED},
- {"BOOLS", BOOLS, RID_BOOLS, RESERVED},
- {"after", AFTER, NORID, RESERVED},
+ {"call", CALL, NORID, RESERVED},
+ {"else", ELSE, NORID, RESERVED},
+ {"DO", DO, NORID, RESERVED},
+ {"print_o_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"range", RANGE, NORID, RESERVED},
+ {"dcl", DCL, NORID, RESERVED},
+ {"all", ALL, NORID, RESERVED},
+ {"empty_on", EMPTY_ON, NORID, DIRECTIVE},
+ {"XOR", XOR, NORID, RESERVED},
+ {"empty_off", EMPTY_OFF, NORID, DIRECTIVE},
+ {"SEND", SEND, NORID, RESERVED},
+ {"mod", MOD, NORID, RESERVED},
+ {"REM", REM, NORID, RESERVED},
+ {"general", GENERAL, NORID, RESERVED},
+ {"NONREF", NONREF, NORID, RESERVED},
+ {"CHARS", CHARS, NORID, RESERVED},
+ {"based", BASED, NORID, RESERVED},
+ {"IF", IF, NORID, RESERVED},
{"range_on", RANGE_ON, NORID, DIRECTIVE},
- {"EMPTY_OFF", EMPTY_OFF, NORID, DIRECTIVE},
- {"fi", FI, NORID, RESERVED},
- {"simple", SIMPLE, NORID, RESERVED},
- {"set", SET, NORID, RESERVED},
- {"POS", POS, NORID, RESERVED},
- {"ESAC", ESAC, NORID, RESERVED},
- {"far", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"NOLIST", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"bools", BOOLS, RID_BOOLS, RESERVED},
- {"elsif", ELSIF, NORID, RESERVED},
- {"EMPTY_ON", EMPTY_ON, NORID, DIRECTIVE},
- {"LIST", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"POWERSET", POWERSET, NORID, RESERVED},
- {"orif", ORIF, NORID, RESERVED},
- {"READ", READ, RID_READ, RESERVED},
- {"MODULE", MODULE, NORID, RESERVED},
- {"ccitt_os", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"optimize_runtime", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"RECURSIVE", RECURSIVE, NORID, RESERVED},
+ {"range_off", RANGE_OFF, NORID, DIRECTIVE},
{"STEP", STEP, NORID, RESERVED},
- {"cause", CAUSE, NORID, RESERVED},
- {"RETURNS", RETURNS, NORID, RESERVED},
- {"down", DOWN, NORID, RESERVED},
- {"LARGE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"IF", IF, NORID, RESERVED},
- {"PREFIXED", PREFIXED, NORID, RESERVED},
- {"and", AND, NORID, RESERVED},
- {"start", START, NORID, RESERVED},
- {"call", CALL, NORID, RESERVED},
- {"grant", GRANT, NORID, RESERVED},
- {"AND", AND, NORID, RESERVED},
- {"OF", OF, NORID, RESERVED},
- {"seize", SEIZE, NORID, RESERVED},
- {"USE_SEIZE_FILE", USE_SEIZE_FILE, NORID, DIRECTIVE},
{"large", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"DELAY", DELAY, NORID, RESERVED},
- {"MEDIUM", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"SYNMODE", SYNMODE, NORID, RESERVED},
- {"reentrant", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"print_o_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"static", STATIC, NORID, RESERVED},
- {"no_overlap_check", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"event_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"STRUCT", STRUCT, NORID, RESERVED},
- {"synmode", SYNMODE, NORID, RESERVED},
- {"STOP", STOP, NORID, RESERVED},
- {"PRIORITY", PRIORITY, NORID, RESERVED},
- {"CONTINUE", CONTINUE, NORID, RESERVED},
+ {"reentrant_all", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"ASSERT", ASSERT, NORID, RESERVED},
+ {"PACK", PACK, NORID, RESERVED},
+ {"OF", OF, NORID, RESERVED},
+ {"AND", AND, NORID, RESERVED},
+ {"ROW", ROW, NORID, RESERVED},
+ {"EXIT", EXIT, NORID, RESERVED},
+ {"exceptions", EXCEPTIONS, NORID, RESERVED},
{"ASM", ASM_KEYWORD, NORID, RESERVED},
- {"RANGE", RANGE, NORID, RESERVED},
- {"return", RETURN, NORID, RESERVED},
- {"ALL", ALL, NORID, RESERVED},
- {"varying", VARYING, NORID, RESERVED},
- {"struct", STRUCT, NORID, RESERVED},
- {"ANDIF", ANDIF, NORID, RESERVED},
- {"AT", AT, NORID, RESERVED},
- {"PAGE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"out", PARAMATTR, RID_OUT, RESERVED},
+ {"PRIORITY", PRIORITY, NORID, RESERVED},
+ {"short_pred_succ", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"syn", SYN, NORID, RESERVED},
{"process_type", PROCESS_TYPE_TOKEN, NORID, DIRECTIVE},
- {"region", REGION, NORID, RESERVED},
- {"ASSERT", ASSERT, NORID, RESERVED},
- {"EXCEPTIONS", EXCEPTIONS, NORID, RESERVED},
+ {"READ", READ, RID_READ, RESERVED},
+ {"BUFFER", BUFFER, NORID, RESERVED},
{"body", BODY, NORID, RESERVED},
- {"BEGIN", BEGINTOKEN, NORID, RESERVED},
- {"dynamic", DYNAMIC, RID_DYNAMIC, RESERVED},
- {"small", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"based", BASED, NORID, RESERVED},
- {"array", ARRAY, NORID, RESERVED},
- {"PRINT_O_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"ref", REF, NORID, RESERVED},
+ {"ANDIF", ANDIF, NORID, RESERVED},
+ {"STATIC", STATIC, NORID, RESERVED},
+ {"NOLIST", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"nopack", NOPACK, NORID, RESERVED},
+ {"STRUCT", STRUCT, NORID, RESERVED},
+ {"END", END, NORID, RESERVED},
+ {"delay", DELAY, NORID, RESERVED},
+ {"seize", SEIZE, NORID, RESERVED},
{"REENTRANT", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"ESAC", ESAC, NORID, RESERVED},
+ {"NOPACK", NOPACK, NORID, RESERVED},
+ {"SPEC", SPEC, NORID, RESERVED},
{"GOTO", GOTO, NORID, RESERVED},
- {"returns", RETURNS, NORID, RESERVED},
- {"CHARS", CHARS, NORID, RESERVED},
- {"TIMEOUT", TIMEOUT, NORID, RESERVED},
- {"begin", BEGINTOKEN, NORID, RESERVED},
- {"VARYING", VARYING, NORID, RESERVED},
- {"RANGE_OFF", RANGE_OFF, NORID, DIRECTIVE},
- {"access", ACCESS, NORID, RESERVED},
+ {"pack", PACK, NORID, RESERVED},
+ {"by", BY, NORID, RESERVED},
{"REGION", REGION, NORID, RESERVED},
- {"SMALL", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"send", SEND, NORID, RESERVED},
- {"recursive", RECURSIVE, NORID, RESERVED},
+ {"SYN", SYN, NORID, RESERVED},
{"module", MODULE, NORID, RESERVED},
- {"SIMPLE", SIMPLE, NORID, RESERVED},
- {"RANGE_ON", RANGE_ON, NORID, DIRECTIVE},
- {"dcl", DCL, NORID, RESERVED},
- {"prefixed", PREFIXED, NORID, RESERVED},
- {"PROCESS", PROCESS, NORID, RESERVED},
+ {"RESULT", RESULT, NORID, RESERVED},
+ {"CASE", CASE, NORID, RESERVED},
{"all_static_on", ALL_STATIC_ON, NORID, DIRECTIVE},
- {"forbid", FORBID, NORID, RESERVED},
- {"DYNAMIC", DYNAMIC, RID_DYNAMIC, RESERVED},
- {"START", START, NORID, RESERVED},
- {"signal", SIGNAL, NORID, RESERVED},
- {"read", READ, RID_READ, RESERVED},
- {"state_routine", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"ARRAY", ARRAY, NORID, RESERVED},
+ {"all_static_off", ALL_STATIC_OFF, NORID, DIRECTIVE},
+ {"FORBID", FORBID, NORID, RESERVED},
+ {"LOC", LOC, NORID, RESERVED},
+ {"INLINE", INLINE, RID_INLINE, RESERVED},
+ {"ELSIF", ELSIF, NORID, RESERVED},
+ {"CCITT_OS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"row", ROW, NORID, RESERVED},
+ {"GRANT", GRANT, NORID, RESERVED},
+ {"BEGIN", BEGINTOKEN, NORID, RESERVED},
+ {"BOOLS", BOOLS, RID_BOOLS, RESERVED},
+ {"PROCESS", PROCESS, NORID, RESERVED},
+ {"BY", BY, NORID, RESERVED},
+ {"EMPTY_ON", EMPTY_ON, NORID, DIRECTIVE},
+ {"REMOTE", REMOTE, NORID, RESERVED},
+ {"receive", RECEIVE, NORID, RESERVED},
+ {"CONTINUE", CONTINUE, NORID, RESERVED},
{"buffer", BUFFER, NORID, RESERVED},
- {"ACCESS", ACCESS, NORID, RESERVED},
- {"NOPACK", NOPACK, NORID, RESERVED},
- {"USE_SEIZE_FILE_RESTRICTED", USE_SEIZE_FILE_RESTRICTED, NORID, DIRECTIVE},
- {"result", RESULT, NORID, RESERVED},
- {"andif", ANDIF, NORID, RESERVED},
- {"STATIC", STATIC, NORID, RESERVED},
- {"OPTIMIZE_RUNTIME", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"newmode", NEWMODE, NORID, RESERVED},
- {"short_pred_succ", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"SHORT_PRED_SUCC", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"AFTER", AFTER, NORID, RESERVED},
- {"extra_const_seg", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"debug_lines", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"FI", FI, NORID, RESERVED},
+ {"recursive", RECURSIVE, NORID, RESERVED},
+ {"MOD", MOD, NORID, RESERVED},
+ {"CAUSE", CAUSE, NORID, RESERVED},
+ {"EMPTY_OFF", EMPTY_OFF, NORID, DIRECTIVE},
{"medium", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"empty_off", EMPTY_OFF, NORID, DIRECTIVE},
- {"general", GENERAL, NORID, RESERVED},
+ {"RECURSIVE", RECURSIVE, NORID, RESERVED},
+ {"RECEIVE", RECEIVE, NORID, RESERVED},
+ {"ever", EVER, NORID, RESERVED},
+ {"cycle", CYCLE, NORID, RESERVED},
+ {"even", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"only_for_target", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"event", EVENT, NORID, RESERVED},
+ {"DOWN", DOWN, NORID, RESERVED},
+ {"extra_const_seg", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"powerset", POWERSET, NORID, RESERVED},
+ {"while", WHILE, NORID, RESERVED},
+ {"BODY", BODY, NORID, RESERVED},
+ {"fi", FI, NORID, RESERVED},
+ {"EVEN", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"ELSE", ELSE, NORID, RESERVED},
+ {"down", DOWN, NORID, RESERVED},
+ {"EVER", EVER, NORID, RESERVED},
+ {"EVENT", EVENT, NORID, RESERVED},
+ {"ALL", ALL, NORID, RESERVED},
+ {"SEIZE", SEIZE, NORID, RESERVED},
+ {"AFTER", AFTER, NORID, RESERVED},
+ {"CONTEXT", CONTEXT, NORID, RESERVED},
+ {"BIT", BOOLS, RID_BOOLS, PREDEF},
+ {"debug_types", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"xor", XOR, NORID, RESERVED},
+ {"text", TEXT, NORID, RESERVED},
+ {"BIN", BIN, NORID, RESERVED},
+ {"BASED", BASED, NORID, RESERVED},
+ {"RANGE", RANGE, NORID, RESERVED},
+ {"PAGE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"generate_set_names", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"use_seize_file", USE_SEIZE_FILE, NORID, DIRECTIVE},
- {"PROCESS_TYPE", PROCESS_TYPE_TOKEN, NORID, DIRECTIVE},
- {"NO_OVERLAP_CHECK", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"DEBUG_LINES", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"GENERAL", GENERAL, NORID, RESERVED},
- {"multiple_const_segs", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"range_off", RANGE_OFF, NORID, DIRECTIVE},
- {"DEBUG_TYPES", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"reentrant_all", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"ARRAY", ARRAY, NORID, RESERVED},
- {"REENTRANT_ALL", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"optimization_window", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"GRANT", GRANT, NORID, RESERVED},
- {"signal_code", SIGNAL_CODE, NORID, DIRECTIVE},
- {"delay", DELAY, NORID, RESERVED},
+ {"list", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"bit", BOOLS, RID_BOOLS, PREDEF},
+ {"SMALL", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"bin", BIN, NORID, RESERVED},
+ {"WHILE", WHILE, NORID, RESERVED},
+ {"ACCESS", ACCESS, NORID, RESERVED},
+ {"DCL", DCL, NORID, RESERVED},
+ {"RANGE_ON", RANGE_ON, NORID, DIRECTIVE},
+ {"VARYING", VARYING, NORID, RESERVED},
+ {"only_for_simulation", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"synmode", SYNMODE, NORID, RESERVED},
+ {"context", CONTEXT, NORID, RESERVED},
{"buffer_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"generate_set_names", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"RANGE_OFF", RANGE_OFF, NORID, DIRECTIVE},
{"STATE_ROUTINE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"only_for_target", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"grant_file_size", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"ONLY_FOR_TARGET", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"OPTIMIZATION_WINDOW", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"PRINT_O_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"dynamic", DYNAMIC, RID_DYNAMIC, RESERVED},
+ {"optimize", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"POWERSET", POWERSET, NORID, RESERVED},
+ {"CALL", CALL, NORID, RESERVED},
+ {"event_code", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"WITH", WITH, NORID, RESERVED},
+ {"DELAY", DELAY, NORID, RESERVED},
+ {"LIST", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"varying", VARYING, NORID, RESERVED},
+ {"EXCEPTIONS", EXCEPTIONS, NORID, RESERVED},
+ {"prefixed", PREFIXED, NORID, RESERVED},
+ {"signal", SIGNAL, NORID, RESERVED},
+ {"generate_all_set_names", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"newmode", NEWMODE, NORID, RESERVED},
+ {"MEDIUM", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"timeout", TIMEOUT, NORID, RESERVED},
{"print_symbol_table", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"DEBUG_SYMBOLS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"ALL_STATIC_OFF", ALL_STATIC_OFF, NORID, DIRECTIVE},
- {"PRINT_SYMBOL_TABLE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"all_static_off", ALL_STATIC_OFF, NORID, DIRECTIVE},
+ {"PREFIXED", PREFIXED, NORID, RESERVED},
+ {"LARGE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"simple", SIMPLE, NORID, RESERVED},
+ {"GENERAL", GENERAL, NORID, RESERVED},
+ {"send_buffer_default_priority", SEND_BUFFER_DEFAULT_PRIORITY, NORID, DIRECTIVE},
+ {"PROCESS_TYPE", PROCESS_TYPE_TOKEN, NORID, DIRECTIVE},
+ {"OPTIMIZE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"debug_symbols", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"BUFFER_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"use_seize_file_restricted", USE_SEIZE_FILE_RESTRICTED, NORID, DIRECTIVE},
+ {"NEWMODE", NEWMODE, NORID, RESERVED},
+ {"send_signal_default_priority", SEND_SIGNAL_DEFAULT_PRIORITY, NORID, DIRECTIVE},
+ {"no_overlap_check", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"ALL_STATIC_ON", ALL_STATIC_ON, NORID, DIRECTIVE},
- {"signal_max_length", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"support_causing_address", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"SHORT_PRED_SUCC", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"MODULE", MODULE, NORID, RESERVED},
+ {"REENTRANT_ALL", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"TIMEOUT", TIMEOUT, NORID, RESERVED},
+ {"ALL_STATIC_OFF", ALL_STATIC_OFF, NORID, DIRECTIVE},
+ {"with", WITH, NORID, RESERVED},
+ {"signal_code", SIGNAL_CODE, NORID, DIRECTIVE},
+ {"multiple_const_segs", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"optimize_runtime", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"CYCLE", CYCLE, NORID, RESERVED},
+ {"SYNMODE", SYNMODE, NORID, RESERVED},
+ {"multiple_data_segs", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"DYNAMIC", DYNAMIC, RID_DYNAMIC, RESERVED},
+ {"EVENT_CODE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"SIGNAL", SIGNAL, NORID, RESERVED},
- {"debug_lines", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"GRANT_FILE_SIZE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"debug_types", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"DEBUG_TYPES", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"ONLY_FOR_TARGET", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"SIMPLE", SIMPLE, NORID, RESERVED},
+ {"DEBUG_LINES", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"NO_OVERLAP_CHECK", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"EXTRA_CONST_SEG", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"multiple_data_segs", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"MULTIPLE_CONST_SEGS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"ONLY_FOR_SIMULATION", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"make_publics_for_discrete_syns", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"USE_SEIZE_FILE", USE_SEIZE_FILE, NORID, DIRECTIVE},
+ {"OPTIMIZE_RUNTIME", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"GRANT_FILE_SIZE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"GENERATE_SET_NAMES", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"PRINT_SYMBOL_TABLE", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"DEBUG_SYMBOLS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"OPTIMIZATION_WINDOW", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"SIGNAL_CODE", SIGNAL_CODE, NORID, DIRECTIVE},
- {"only_for_simulation", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"SUPPORT_CAUSING_ADDRESS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"MULTIPLE_CONST_SEGS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"optimization_window", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"signal_max_length", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"SEND_BUFFER_DEFAULT_PRIORITY", SEND_BUFFER_DEFAULT_PRIORITY, NORID, DIRECTIVE},
- {"MAKE_PUBLICS_FOR_DISCRETE_SYNS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"generate_all_set_names", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"debug_symbols", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"support_causing_address", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"GENERATE_SET_NAMES", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"MULTIPLE_DATA_SEGS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"make_publics_for_discrete_syns", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
{"GENERATE_ALL_SET_NAMES", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"USE_SEIZE_FILE_RESTRICTED", USE_SEIZE_FILE_RESTRICTED, NORID, DIRECTIVE},
{"SEND_SIGNAL_DEFAULT_PRIORITY", SEND_SIGNAL_DEFAULT_PRIORITY, NORID, DIRECTIVE},
- {"SIGNAL_MAX_LENGTH", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"SUPPORT_CAUSING_ADDRESS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
- {"send_signal_default_priority", SEND_SIGNAL_DEFAULT_PRIORITY, NORID, DIRECTIVE},
- {"send_buffer_default_priority", SEND_BUFFER_DEFAULT_PRIORITY, NORID, DIRECTIVE}
+ {"MAKE_PUBLICS_FOR_DISCRETE_SYNS", IGNORED_DIRECTIVE, NORID, DIRECTIVE},
+ {"SIGNAL_MAX_LENGTH", IGNORED_DIRECTIVE, NORID, DIRECTIVE}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -451,906 +451,906 @@ in_word_set (str, len)
register struct resword *wordendptr;
register struct resword *resword;
- switch (key - 16)
+ switch (key - 4)
{
case 0:
resword = &wordlist[0];
goto compare;
- case 3:
+ case 1:
resword = &wordlist[1];
goto compare;
- case 5:
+ case 2:
resword = &wordlist[2];
goto compare;
- case 7:
+ case 3:
resword = &wordlist[3];
goto compare;
- case 8:
+ case 4:
resword = &wordlist[4];
goto compare;
- case 12:
+ case 5:
resword = &wordlist[5];
goto compare;
- case 16:
+ case 6:
resword = &wordlist[6];
goto compare;
- case 18:
+ case 7:
resword = &wordlist[7];
goto compare;
- case 19:
+ case 8:
resword = &wordlist[8];
goto compare;
- case 21:
+ case 9:
resword = &wordlist[9];
goto compare;
- case 25:
+ case 10:
resword = &wordlist[10];
goto compare;
- case 26:
+ case 11:
resword = &wordlist[11];
goto compare;
- case 27:
+ case 12:
resword = &wordlist[12];
goto compare;
- case 28:
+ case 14:
resword = &wordlist[13];
goto compare;
- case 36:
+ case 16:
resword = &wordlist[14];
goto compare;
- case 39:
+ case 17:
resword = &wordlist[15];
goto compare;
- case 43:
+ case 18:
resword = &wordlist[16];
goto compare;
- case 49:
+ case 19:
resword = &wordlist[17];
goto compare;
- case 51:
+ case 20:
resword = &wordlist[18];
goto compare;
- case 54:
+ case 21:
resword = &wordlist[19];
goto compare;
- case 55:
+ case 22:
resword = &wordlist[20];
goto compare;
- case 62:
+ case 23:
resword = &wordlist[21];
goto compare;
- case 64:
+ case 24:
resword = &wordlist[22];
goto compare;
- case 68:
+ case 25:
resword = &wordlist[23];
goto compare;
- case 71:
+ case 26:
resword = &wordlist[24];
goto compare;
- case 73:
+ case 27:
resword = &wordlist[25];
goto compare;
- case 74:
+ case 28:
resword = &wordlist[26];
goto compare;
- case 75:
+ case 30:
resword = &wordlist[27];
goto compare;
- case 77:
+ case 32:
resword = &wordlist[28];
goto compare;
- case 78:
+ case 34:
resword = &wordlist[29];
goto compare;
- case 80:
+ case 35:
resword = &wordlist[30];
goto compare;
- case 82:
+ case 36:
resword = &wordlist[31];
goto compare;
- case 84:
+ case 37:
resword = &wordlist[32];
goto compare;
- case 87:
+ case 38:
resword = &wordlist[33];
goto compare;
- case 89:
+ case 39:
resword = &wordlist[34];
goto compare;
- case 90:
+ case 40:
resword = &wordlist[35];
goto compare;
- case 95:
+ case 41:
resword = &wordlist[36];
goto compare;
- case 98:
+ case 42:
resword = &wordlist[37];
goto compare;
- case 101:
+ case 43:
resword = &wordlist[38];
goto compare;
- case 103:
+ case 44:
resword = &wordlist[39];
goto compare;
- case 109:
+ case 45:
resword = &wordlist[40];
goto compare;
- case 111:
+ case 46:
resword = &wordlist[41];
goto compare;
- case 113:
+ case 47:
resword = &wordlist[42];
goto compare;
- case 114:
+ case 48:
resword = &wordlist[43];
goto compare;
- case 115:
+ case 50:
resword = &wordlist[44];
goto compare;
- case 116:
+ case 51:
resword = &wordlist[45];
goto compare;
- case 118:
+ case 52:
resword = &wordlist[46];
goto compare;
- case 119:
+ case 53:
resword = &wordlist[47];
goto compare;
- case 120:
+ case 54:
resword = &wordlist[48];
goto compare;
- case 123:
+ case 55:
resword = &wordlist[49];
goto compare;
- case 126:
+ case 56:
resword = &wordlist[50];
goto compare;
- case 127:
+ case 57:
resword = &wordlist[51];
goto compare;
- case 129:
+ case 58:
resword = &wordlist[52];
goto compare;
- case 130:
+ case 59:
resword = &wordlist[53];
goto compare;
- case 131:
+ case 60:
resword = &wordlist[54];
goto compare;
- case 133:
+ case 61:
resword = &wordlist[55];
goto compare;
- case 135:
+ case 62:
resword = &wordlist[56];
goto compare;
- case 137:
+ case 63:
resword = &wordlist[57];
goto compare;
- case 138:
+ case 64:
resword = &wordlist[58];
goto compare;
- case 141:
+ case 65:
resword = &wordlist[59];
goto compare;
- case 142:
+ case 66:
resword = &wordlist[60];
goto compare;
- case 145:
+ case 68:
resword = &wordlist[61];
goto compare;
- case 146:
+ case 69:
resword = &wordlist[62];
goto compare;
- case 147:
+ case 70:
resword = &wordlist[63];
goto compare;
- case 148:
+ case 71:
resword = &wordlist[64];
goto compare;
- case 150:
+ case 72:
resword = &wordlist[65];
goto compare;
- case 151:
+ case 73:
resword = &wordlist[66];
goto compare;
- case 152:
+ case 74:
resword = &wordlist[67];
goto compare;
- case 153:
+ case 75:
resword = &wordlist[68];
goto compare;
- case 158:
+ case 77:
resword = &wordlist[69];
goto compare;
- case 159:
+ case 79:
resword = &wordlist[70];
goto compare;
- case 161:
+ case 80:
resword = &wordlist[71];
goto compare;
- case 164:
+ case 81:
resword = &wordlist[72];
goto compare;
- case 165:
+ case 82:
resword = &wordlist[73];
goto compare;
- case 169:
+ case 83:
resword = &wordlist[74];
goto compare;
- case 170:
+ case 86:
resword = &wordlist[75];
goto compare;
- case 171:
+ case 88:
resword = &wordlist[76];
goto compare;
- case 172:
+ case 89:
resword = &wordlist[77];
goto compare;
- case 177:
+ case 91:
resword = &wordlist[78];
goto compare;
- case 178:
+ case 92:
resword = &wordlist[79];
goto compare;
- case 183:
+ case 93:
resword = &wordlist[80];
goto compare;
- case 184:
+ case 94:
resword = &wordlist[81];
goto compare;
- case 185:
+ case 95:
resword = &wordlist[82];
goto compare;
- case 188:
+ case 98:
resword = &wordlist[83];
goto compare;
- case 190:
+ case 99:
resword = &wordlist[84];
goto compare;
- case 194:
+ case 100:
resword = &wordlist[85];
goto compare;
- case 196:
+ case 101:
resword = &wordlist[86];
goto compare;
- case 198:
+ case 102:
resword = &wordlist[87];
goto compare;
- case 200:
+ case 103:
resword = &wordlist[88];
goto compare;
- case 201:
+ case 104:
resword = &wordlist[89];
goto compare;
- case 202:
+ case 106:
resword = &wordlist[90];
goto compare;
- case 203:
+ case 107:
resword = &wordlist[91];
goto compare;
- case 204:
+ case 108:
resword = &wordlist[92];
goto compare;
- case 205:
+ case 109:
resword = &wordlist[93];
goto compare;
- case 207:
+ case 110:
resword = &wordlist[94];
goto compare;
- case 212:
+ case 111:
resword = &wordlist[95];
goto compare;
- case 213:
+ case 112:
resword = &wordlist[96];
goto compare;
- case 216:
+ case 113:
resword = &wordlist[97];
goto compare;
- case 217:
+ case 115:
resword = &wordlist[98];
goto compare;
- case 218:
+ case 116:
resword = &wordlist[99];
goto compare;
- case 219:
+ case 117:
resword = &wordlist[100];
goto compare;
- case 221:
+ case 118:
resword = &wordlist[101];
goto compare;
- case 224:
+ case 120:
resword = &wordlist[102];
goto compare;
- case 225:
+ case 121:
resword = &wordlist[103];
goto compare;
- case 230:
+ case 122:
resword = &wordlist[104];
goto compare;
- case 232:
+ case 123:
resword = &wordlist[105];
goto compare;
- case 234:
+ case 125:
resword = &wordlist[106];
goto compare;
- case 235:
+ case 126:
resword = &wordlist[107];
goto compare;
- case 236:
+ case 127:
resword = &wordlist[108];
goto compare;
- case 238:
+ case 128:
resword = &wordlist[109];
goto compare;
- case 246:
+ case 129:
resword = &wordlist[110];
goto compare;
- case 247:
+ case 131:
resword = &wordlist[111];
goto compare;
- case 248:
+ case 132:
resword = &wordlist[112];
goto compare;
- case 249:
+ case 133:
resword = &wordlist[113];
goto compare;
- case 250:
+ case 134:
resword = &wordlist[114];
goto compare;
- case 251:
+ case 135:
resword = &wordlist[115];
goto compare;
- case 252:
+ case 136:
resword = &wordlist[116];
goto compare;
- case 254:
+ case 137:
resword = &wordlist[117];
goto compare;
- case 255:
+ case 138:
resword = &wordlist[118];
goto compare;
- case 256:
+ case 139:
resword = &wordlist[119];
goto compare;
- case 257:
+ case 142:
resword = &wordlist[120];
goto compare;
- case 258:
+ case 143:
resword = &wordlist[121];
goto compare;
- case 259:
+ case 144:
resword = &wordlist[122];
goto compare;
- case 261:
+ case 145:
resword = &wordlist[123];
goto compare;
- case 264:
+ case 146:
resword = &wordlist[124];
goto compare;
- case 265:
+ case 147:
resword = &wordlist[125];
goto compare;
- case 266:
+ case 148:
resword = &wordlist[126];
goto compare;
- case 268:
+ case 149:
resword = &wordlist[127];
goto compare;
- case 269:
+ case 150:
resword = &wordlist[128];
goto compare;
- case 270:
+ case 151:
resword = &wordlist[129];
goto compare;
- case 273:
+ case 152:
resword = &wordlist[130];
goto compare;
- case 274:
+ case 153:
resword = &wordlist[131];
goto compare;
- case 277:
+ case 154:
resword = &wordlist[132];
goto compare;
- case 279:
+ case 155:
resword = &wordlist[133];
goto compare;
- case 282:
+ case 156:
resword = &wordlist[134];
goto compare;
- case 286:
+ case 157:
resword = &wordlist[135];
goto compare;
- case 287:
+ case 159:
resword = &wordlist[136];
goto compare;
- case 288:
+ case 161:
resword = &wordlist[137];
goto compare;
- case 289:
+ case 162:
resword = &wordlist[138];
goto compare;
- case 296:
+ case 163:
resword = &wordlist[139];
goto compare;
- case 304:
+ case 164:
resword = &wordlist[140];
goto compare;
- case 310:
+ case 165:
resword = &wordlist[141];
goto compare;
- case 311:
+ case 166:
resword = &wordlist[142];
goto compare;
- case 312:
+ case 167:
resword = &wordlist[143];
goto compare;
- case 315:
+ case 169:
resword = &wordlist[144];
goto compare;
- case 317:
+ case 170:
resword = &wordlist[145];
goto compare;
- case 318:
+ case 173:
resword = &wordlist[146];
goto compare;
- case 319:
+ case 175:
resword = &wordlist[147];
goto compare;
- case 321:
+ case 176:
resword = &wordlist[148];
goto compare;
- case 322:
+ case 177:
resword = &wordlist[149];
goto compare;
- case 323:
+ case 178:
resword = &wordlist[150];
goto compare;
- case 324:
+ case 179:
resword = &wordlist[151];
goto compare;
- case 325:
+ case 180:
resword = &wordlist[152];
goto compare;
- case 326:
+ case 181:
resword = &wordlist[153];
goto compare;
- case 327:
+ case 183:
resword = &wordlist[154];
goto compare;
- case 329:
+ case 184:
resword = &wordlist[155];
goto compare;
- case 331:
+ case 188:
resword = &wordlist[156];
goto compare;
- case 333:
+ case 189:
resword = &wordlist[157];
goto compare;
- case 334:
+ case 190:
resword = &wordlist[158];
goto compare;
- case 340:
+ case 191:
resword = &wordlist[159];
goto compare;
- case 341:
+ case 194:
resword = &wordlist[160];
goto compare;
- case 342:
+ case 195:
resword = &wordlist[161];
goto compare;
- case 348:
+ case 196:
resword = &wordlist[162];
goto compare;
- case 349:
+ case 197:
resword = &wordlist[163];
goto compare;
- case 351:
+ case 198:
resword = &wordlist[164];
goto compare;
- case 354:
+ case 200:
resword = &wordlist[165];
goto compare;
- case 363:
+ case 201:
resword = &wordlist[166];
goto compare;
- case 364:
+ case 203:
resword = &wordlist[167];
goto compare;
- case 365:
+ case 204:
resword = &wordlist[168];
goto compare;
- case 366:
+ case 205:
resword = &wordlist[169];
goto compare;
- case 368:
+ case 207:
resword = &wordlist[170];
goto compare;
- case 370:
+ case 208:
resword = &wordlist[171];
goto compare;
- case 371:
+ case 209:
resword = &wordlist[172];
goto compare;
- case 372:
+ case 212:
resword = &wordlist[173];
goto compare;
- case 373:
+ case 213:
resword = &wordlist[174];
goto compare;
- case 374:
+ case 215:
resword = &wordlist[175];
goto compare;
- case 377:
+ case 216:
resword = &wordlist[176];
goto compare;
- case 378:
+ case 217:
resword = &wordlist[177];
goto compare;
- case 379:
+ case 218:
resword = &wordlist[178];
goto compare;
- case 381:
+ case 219:
resword = &wordlist[179];
goto compare;
- case 382:
+ case 220:
resword = &wordlist[180];
goto compare;
- case 383:
+ case 221:
resword = &wordlist[181];
goto compare;
- case 384:
+ case 222:
resword = &wordlist[182];
goto compare;
- case 387:
+ case 223:
resword = &wordlist[183];
goto compare;
- case 391:
+ case 225:
resword = &wordlist[184];
goto compare;
- case 392:
+ case 227:
resword = &wordlist[185];
goto compare;
- case 393:
+ case 229:
resword = &wordlist[186];
goto compare;
- case 401:
+ case 231:
resword = &wordlist[187];
goto compare;
- case 402:
+ case 232:
resword = &wordlist[188];
goto compare;
- case 405:
+ case 234:
resword = &wordlist[189];
goto compare;
- case 408:
+ case 235:
resword = &wordlist[190];
goto compare;
- case 412:
+ case 236:
resword = &wordlist[191];
goto compare;
- case 418:
+ case 237:
resword = &wordlist[192];
goto compare;
- case 420:
+ case 238:
resword = &wordlist[193];
goto compare;
- case 423:
+ case 240:
resword = &wordlist[194];
goto compare;
- case 425:
+ case 242:
resword = &wordlist[195];
goto compare;
- case 426:
+ case 243:
resword = &wordlist[196];
goto compare;
- case 432:
+ case 245:
resword = &wordlist[197];
goto compare;
- case 439:
+ case 246:
resword = &wordlist[198];
goto compare;
- case 442:
+ case 247:
resword = &wordlist[199];
goto compare;
- case 443:
+ case 248:
resword = &wordlist[200];
goto compare;
- case 448:
+ case 249:
resword = &wordlist[201];
goto compare;
- case 450:
+ case 250:
resword = &wordlist[202];
goto compare;
- case 451:
+ case 251:
resword = &wordlist[203];
goto compare;
- case 454:
+ case 253:
resword = &wordlist[204];
goto compare;
- case 459:
+ case 254:
resword = &wordlist[205];
goto compare;
- case 464:
+ case 258:
resword = &wordlist[206];
goto compare;
- case 466:
+ case 261:
resword = &wordlist[207];
goto compare;
- case 470:
+ case 263:
resword = &wordlist[208];
goto compare;
- case 479:
+ case 264:
resword = &wordlist[209];
goto compare;
- case 480:
+ case 265:
resword = &wordlist[210];
goto compare;
- case 484:
+ case 266:
resword = &wordlist[211];
goto compare;
- case 485:
+ case 271:
resword = &wordlist[212];
goto compare;
- case 487:
+ case 273:
resword = &wordlist[213];
goto compare;
- case 490:
+ case 276:
resword = &wordlist[214];
goto compare;
- case 499:
+ case 277:
resword = &wordlist[215];
goto compare;
- case 503:
+ case 281:
resword = &wordlist[216];
goto compare;
- case 507:
+ case 282:
resword = &wordlist[217];
goto compare;
- case 512:
+ case 284:
resword = &wordlist[218];
goto compare;
- case 515:
+ case 289:
resword = &wordlist[219];
goto compare;
- case 520:
+ case 290:
resword = &wordlist[220];
goto compare;
- case 523:
+ case 293:
resword = &wordlist[221];
goto compare;
- case 524:
+ case 296:
resword = &wordlist[222];
goto compare;
- case 526:
+ case 297:
resword = &wordlist[223];
goto compare;
- case 537:
+ case 298:
resword = &wordlist[224];
goto compare;
- case 538:
+ case 299:
resword = &wordlist[225];
goto compare;
- case 542:
+ case 300:
resword = &wordlist[226];
goto compare;
- case 547:
+ case 303:
resword = &wordlist[227];
goto compare;
- case 552:
+ case 307:
resword = &wordlist[228];
goto compare;
- case 555:
+ case 308:
resword = &wordlist[229];
goto compare;
- case 558:
+ case 311:
resword = &wordlist[230];
goto compare;
- case 562:
+ case 313:
resword = &wordlist[231];
goto compare;
- case 563:
+ case 317:
resword = &wordlist[232];
goto compare;
- case 576:
+ case 318:
resword = &wordlist[233];
goto compare;
- case 578:
+ case 319:
resword = &wordlist[234];
goto compare;
- case 581:
+ case 324:
resword = &wordlist[235];
goto compare;
- case 583:
+ case 328:
resword = &wordlist[236];
goto compare;
- case 584:
+ case 334:
resword = &wordlist[237];
goto compare;
- case 596:
+ case 336:
resword = &wordlist[238];
goto compare;
- case 603:
+ case 337:
resword = &wordlist[239];
goto compare;
- case 606:
+ case 339:
resword = &wordlist[240];
goto compare;
- case 619:
+ case 341:
resword = &wordlist[241];
goto compare;
- case 620:
+ case 342:
resword = &wordlist[242];
goto compare;
- case 622:
+ case 347:
resword = &wordlist[243];
goto compare;
- case 632:
+ case 348:
resword = &wordlist[244];
goto compare;
- case 641:
+ case 358:
resword = &wordlist[245];
goto compare;
- case 668:
+ case 364:
resword = &wordlist[246];
goto compare;
- case 670:
+ case 367:
resword = &wordlist[247];
goto compare;
- case 673:
+ case 371:
resword = &wordlist[248];
goto compare;
- case 703:
+ case 373:
resword = &wordlist[249];
goto compare;
- case 707:
+ case 378:
resword = &wordlist[250];
goto compare;
- case 734:
+ case 380:
resword = &wordlist[251];
goto compare;
- case 737:
+ case 385:
resword = &wordlist[252];
goto compare;
- case 738:
+ case 388:
resword = &wordlist[253];
goto compare;
- case 753:
+ case 398:
resword = &wordlist[254];
goto compare;
- case 764:
+ case 402:
resword = &wordlist[255];
goto compare;
- case 773:
+ case 403:
resword = &wordlist[256];
goto compare;
- case 785:
+ case 408:
resword = &wordlist[257];
goto compare;
- case 798:
+ case 411:
resword = &wordlist[258];
goto compare;
- case 805:
+ case 412:
resword = &wordlist[259];
goto compare;
- case 806:
+ case 416:
resword = &wordlist[260];
goto compare;
- case 816:
+ case 417:
resword = &wordlist[261];
goto compare;
- case 825:
+ case 418:
resword = &wordlist[262];
goto compare;
- case 829:
+ case 420:
resword = &wordlist[263];
goto compare;
- case 858:
+ case 422:
resword = &wordlist[264];
goto compare;
- case 871:
+ case 423:
resword = &wordlist[265];
goto compare;
- case 875:
+ case 432:
resword = &wordlist[266];
goto compare;
- case 893:
+ case 437:
resword = &wordlist[267];
goto compare;
- case 903:
+ case 440:
resword = &wordlist[268];
goto compare;
- case 939:
+ case 454:
resword = &wordlist[269];
goto compare;
- case 966:
+ case 456:
resword = &wordlist[270];
goto compare;
- case 975:
+ case 469:
resword = &wordlist[271];
goto compare;
- case 981:
+ case 492:
resword = &wordlist[272];
goto compare;
- case 996:
+ case 495:
resword = &wordlist[273];
goto compare;
- case 997:
+ case 501:
resword = &wordlist[274];
goto compare;
- case 999:
+ case 502:
resword = &wordlist[275];
goto compare;
- case 1004:
+ case 504:
resword = &wordlist[276];
goto compare;
- case 1044:
+ case 505:
resword = &wordlist[277];
goto compare;
- case 1050:
+ case 509:
resword = &wordlist[278];
goto compare;
- case 1052:
+ case 574:
resword = &wordlist[279];
goto compare;
- case 1058:
+ case 581:
resword = &wordlist[280];
goto compare;
- case 1065:
+ case 587:
resword = &wordlist[281];
goto compare;
- case 1082:
+ case 607:
resword = &wordlist[282];
goto compare;
- case 1086:
+ case 621:
resword = &wordlist[283];
goto compare;
- case 1092:
+ case 649:
resword = &wordlist[284];
goto compare;
- case 1113:
+ case 674:
resword = &wordlist[285];
goto compare;
- case 1133:
+ case 680:
resword = &wordlist[286];
goto compare;
- case 1162:
+ case 712:
resword = &wordlist[287];
goto compare;
- case 1206:
+ case 721:
resword = &wordlist[288];
goto compare;
- case 1366:
+ case 724:
resword = &wordlist[289];
goto compare;
- case 1378:
+ case 741:
resword = &wordlist[290];
goto compare;
- case 1427:
+ case 751:
resword = &wordlist[291];
goto compare;
- case 1435:
+ case 790:
resword = &wordlist[292];
goto compare;
- case 1461:
+ case 812:
resword = &wordlist[293];
goto compare;
- case 1746:
+ case 817:
resword = &wordlist[294];
goto compare;
- case 1810:
+ case 902:
resword = &wordlist[295];
goto compare;
- case 1883:
+ case 917:
resword = &wordlist[296];
goto compare;
- case 1945:
+ case 932:
resword = &wordlist[297];
goto compare;
- case 2056:
+ case 981:
resword = &wordlist[298];
goto compare;
- case 2274:
+ case 1045:
resword = &wordlist[299];
goto compare;
}
diff --git a/tests/cplusplus.exp b/tests/cplusplus.exp
index 71c88ff..598e95f 100644
--- a/tests/cplusplus.exp
+++ b/tests/cplusplus.exp
@@ -8,8 +8,8 @@ struct resword { const char *name; short token; enum rid rid;};
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 16
#define MIN_HASH_VALUE 4
-#define MAX_HASH_VALUE 250
-/* maximum key range = 247, duplicates = 0 */
+#define MAX_HASH_VALUE 163
+/* maximum key range = 160, duplicates = 0 */
#ifdef __GNUC__
__inline
@@ -25,32 +25,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 0, 251, 64, 93, 3,
- 0, 0, 74, 35, 0, 26, 251, 2, 31, 65,
- 23, 76, 7, 19, 45, 37, 6, 64, 12, 38,
- 14, 4, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 0, 164, 44, 58, 15,
+ 55, 0, 24, 23, 25, 2, 164, 4, 26, 75,
+ 36, 11, 40, 74, 14, 23, 1, 45, 45, 90,
+ 50, 50, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+ 164, 164, 164, 164, 164, 164
};
register int hval = len;
@@ -84,162 +84,141 @@ is_reserved_word (str, len)
{
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"else", ELSE, NORID,},
+ {"true", CXX_TRUE, NORID,},
+ {"int", TYPESPEC, RID_INT,},
{"", 0, 0},
- {"delete", DELETE, NORID,},
- {"case", CASE, NORID,},
{"__real__", REALPART, NORID},
{"", 0, 0},
- {"true", CXX_TRUE, NORID,},
- {"catch", CATCH, NORID,},
- {"typeid", TYPEID, NORID,},
- {"try", TRY, NORID,},
- {"", 0, 0}, {"", 0, 0},
- {"void", TYPESPEC, RID_VOID,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0},
- {"private", VISSPEC, RID_PRIVATE,},
- {"template", TEMPLATE, RID_TEMPLATE,},
- {"protected", VISSPEC, RID_PROTECTED,},
- {"extern", SCSPEC, RID_EXTERN,},
- {"", 0, 0}, {"", 0, 0},
- {"not", '!', NORID,},
+ {"inline", SCSPEC, RID_INLINE,},
{"", 0, 0},
- {"__signed", TYPESPEC, RID_SIGNED},
- {"int", TYPESPEC, RID_INT,},
{"__signed__", TYPESPEC, RID_SIGNED},
- {"__real", REALPART, NORID},
{"", 0, 0},
- {"xor_eq", ASSIGN, NORID,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__attribute", ATTRIBUTE, NORID},
- {"__asm__", ASM_KEYWORD, NORID},
+ {"", 0, 0},
{"__attribute__", ATTRIBUTE, NORID},
- {"compl", '~', NORID,},
- {"public", VISSPEC, RID_PUBLIC,},
- {"not_eq", EQCOMPARE, NORID,},
- {"switch", SWITCH, NORID,},
- {"__extension__", EXTENSION, NORID},
+ {"", 0, 0},
+ {"export", SCSPEC, RID_EXPORT,},
+ {"case", CASE, NORID,},
+ {"__const", CV_QUALIFIER, RID_CONST},
+ {"__const__", CV_QUALIFIER, RID_CONST},
+ {"__volatile", CV_QUALIFIER, RID_VOLATILE},
+ {"", 0, 0},
+ {"__volatile__", CV_QUALIFIER, RID_VOLATILE},
+ {"__restrict", CV_QUALIFIER, RID_RESTRICT},
+ {"__restrict__", CV_QUALIFIER, RID_RESTRICT},
+ {"or", OROR, NORID,},
+ {"if", IF, NORID,},
+ {"", 0, 0},
+ {"__asm__", ASM_KEYWORD, NORID},
+ {"typeof", TYPEOF, NORID,},
+ {"__real", REALPART, NORID},
+ {"", 0, 0}, {"", 0, 0},
+ {"__sigof__", SIGOF, NORID /* Extension */,},
+ {"static_cast", STATIC_CAST, NORID,},
+ {"explicit", SCSPEC, RID_EXPLICIT,},
+ {"register", SCSPEC, RID_REGISTER,},
+ {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,},
+ {"not", '!', NORID,},
+ {"for", FOR, NORID,},
+ {"extern", SCSPEC, RID_EXTERN,},
+ {"short", TYPESPEC, RID_SHORT,},
{"const", CV_QUALIFIER, RID_CONST,},
{"static", SCSPEC, RID_STATIC,},
{"", 0, 0},
- {"__inline", SCSPEC, RID_INLINE},
+ {"char", TYPESPEC, RID_CHAR,},
+ {"__complex__", TYPESPEC, RID_COMPLEX},
+ {"goto", GOTO, NORID,},
+ {"template", TEMPLATE, RID_TEMPLATE,},
+ {"this", THIS, NORID,},
+ {"false", CXX_FALSE, NORID,},
+ {"sizeof", SIZEOF, NORID,},
+ {"try", TRY, NORID,},
+ {"switch", SWITCH, NORID,},
+ {"typedef", SCSPEC, RID_TYPEDEF,},
{"", 0, 0},
- {"__inline__", SCSPEC, RID_INLINE},
- {"__restrict__", CV_QUALIFIER, RID_RESTRICT},
- {"inline", SCSPEC, RID_INLINE,},
+ {"operator", OPERATOR, NORID,},
+ {"__signature__", AGGR, RID_SIGNATURE /* Extension */,},
+ {"catch", CATCH, NORID,},
+ {"delete", DELETE, NORID,},
+ {"typeid", TYPEID, NORID,},
+ {"sigof", SIGOF, NORID /* Extension */,},
{"const_cast", CONST_CAST, NORID,},
- {"static_cast", STATIC_CAST, NORID,},
- {"__restrict", CV_QUALIFIER, RID_RESTRICT},
+ {"__signed", TYPESPEC, RID_SIGNED},
+ {"class", AGGR, RID_CLASS,},
{"xor", '^', NORID,},
- {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,},
- {"new", NEW, NORID,},
+ {"do", DO, NORID,},
+ {"continue", CONTINUE, NORID,},
+ {"auto", SCSPEC, RID_AUTO,},
+ {"__typeof__", TYPEOF, NORID},
+ {"", 0, 0},
{"__alignof__", ALIGNOF, NORID},
- {"signed", TYPESPEC, RID_SIGNED,},
- {"and", ANDAND, NORID,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"explicit", SCSPEC, RID_EXPLICIT,},
+ {"float", TYPESPEC, RID_FLOAT,},
+ {"struct", AGGR, RID_RECORD,},
+ {"long", TYPESPEC, RID_LONG,},
+ {"__null", CONSTANT, RID_NULL},
{"", 0, 0},
+ {"__label__", LABEL, NORID},
+ {"__inline", SCSPEC, RID_INLINE},
+ {"reinterpret_cast", REINTERPRET_CAST, NORID,},
+ {"__inline__", SCSPEC, RID_INLINE},
{"__imag__", IMAGPART, NORID},
- {"while", WHILE, NORID,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"do", DO, NORID,},
{"typename", TYPENAME_KEYWORD, NORID,},
{"friend", SCSPEC, RID_FRIEND,},
- {"continue", CONTINUE, NORID,},
- {"class", AGGR, RID_CLASS,},
- {"default", DEFAULT, NORID,},
- {"this", THIS, NORID,},
- {"dynamic_cast", DYNAMIC_CAST, NORID,},
- {"typeof", TYPEOF, NORID,},
- {"virtual", SCSPEC, RID_VIRTUAL,},
- {"export", SCSPEC, RID_EXPORT,},
- {"and_eq", ASSIGN, NORID,},
- {"__typeof__", TYPEOF, NORID},
- {"__const__", CV_QUALIFIER, RID_CONST},
- {"__volatile", CV_QUALIFIER, RID_VOLATILE},
- {"short", TYPESPEC, RID_SHORT,},
- {"__volatile__", CV_QUALIFIER, RID_VOLATILE},
- {"__const", CV_QUALIFIER, RID_CONST},
+ {"compl", '~', NORID,},
+ {"public", VISSPEC, RID_PUBLIC,},
+ {"bitor", '|', NORID,},
{"namespace", NAMESPACE, NORID,},
- {"char", TYPESPEC, RID_CHAR,},
- {"unsigned", TYPESPEC, RID_UNSIGNED,},
- {"double", TYPESPEC, RID_DOUBLE,},
{"or_eq", ASSIGN, NORID,},
- {"__null", CONSTANT, RID_NULL},
- {"if", IF, NORID,},
- {"__signature__", AGGR, RID_SIGNATURE /* Extension */,},
- {"__label__", LABEL, NORID},
- {"long", TYPESPEC, RID_LONG,},
- {"__imag", IMAGPART, NORID},
- {"__asm", ASM_KEYWORD, NORID},
- {"", 0, 0},
- {"__sigof__", SIGOF, NORID /* Extension */,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"struct", AGGR, RID_RECORD,},
{"", 0, 0},
- {"volatile", CV_QUALIFIER, RID_VOLATILE,},
- {"false", CXX_FALSE, NORID,},
- {"sizeof", SIZEOF, NORID,},
- {"__complex__", TYPESPEC, RID_COMPLEX},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"for", FOR, NORID,},
- {"or", OROR, NORID,},
- {"register", SCSPEC, RID_REGISTER,},
- {"throw", THROW, NORID,},
+ {"private", VISSPEC, RID_PRIVATE,},
+ {"__typeof", TYPEOF, NORID},
{"", 0, 0},
- {"using", USING, NORID,},
- {"", 0, 0}, {"", 0, 0},
+ {"__alignof", ALIGNOF, NORID},
{"__complex", TYPESPEC, RID_COMPLEX},
+ {"union", AGGR, RID_UNION,},
+ {"", 0, 0},
+ {"__extension__", EXTENSION, NORID},
{"", 0, 0},
- {"asm", ASM_KEYWORD, NORID,},
- {"signature", AGGR, RID_SIGNATURE /* Extension */,},
- {"enum", ENUM, NORID,},
- {"reinterpret_cast", REINTERPRET_CAST, NORID,},
- {"mutable", SCSPEC, RID_MUTABLE,},
- {"__alignof", ALIGNOF, NORID},
{"return", RETURN_KEYWORD, NORID,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0},
- {"float", TYPESPEC, RID_FLOAT,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"and", ANDAND, NORID,},
+ {"__asm", ASM_KEYWORD, NORID},
+ {"__imag", IMAGPART, NORID},
+ {"virtual", SCSPEC, RID_VIRTUAL,},
+ {"protected", VISSPEC, RID_PROTECTED,},
+ {"throw", THROW, NORID,},
+ {"default", DEFAULT, NORID,},
+ {"using", USING, NORID,},
+ {"unsigned", TYPESPEC, RID_UNSIGNED,},
+ {"break", BREAK, NORID,},
{"", 0, 0},
+ {"signature", AGGR, RID_SIGNATURE /* Extension */,},
{"bool", TYPESPEC, RID_BOOL,},
{"", 0, 0},
- {"typedef", SCSPEC, RID_TYPEDEF,},
- {"__typeof", TYPEOF, NORID},
- {"bitand", '&', NORID,},
- {"break", BREAK, NORID,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"union", AGGR, RID_UNION,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0},
- {"goto", GOTO, NORID,},
- {"sigof", SIGOF, NORID /* Extension */,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"not_eq", EQCOMPARE, NORID,},
{"", 0, 0}, {"", 0, 0},
- {"bitor", '|', NORID,},
- {"auto", SCSPEC, RID_AUTO,},
- {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"double", TYPESPEC, RID_DOUBLE,},
+ {"signed", TYPESPEC, RID_SIGNED,},
+ {"while", WHILE, NORID,},
+ {"asm", ASM_KEYWORD, NORID,},
+ {"volatile", CV_QUALIFIER, RID_VOLATILE,},
+ {"and_eq", ASSIGN, NORID,},
+ {"", 0, 0},
+ {"mutable", SCSPEC, RID_MUTABLE,},
+ {"dynamic_cast", DYNAMIC_CAST, NORID,},
+ {"", 0, 0},
+ {"new", NEW, NORID,},
+ {"xor_eq", ASSIGN, NORID,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"enum", ENUM, NORID,},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
- {"", 0, 0},
- {"operator", OPERATOR, NORID,}
+ {"void", TYPESPEC, RID_VOID,},
+ {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
+ {"bitand", '&', NORID,}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/tests/gpc.exp b/tests/gpc.exp
index 4f9723d..62ec8fd 100644
--- a/tests/gpc.exp
+++ b/tests/gpc.exp
@@ -17,8 +17,8 @@ struct resword { char *name; short token; short iclass;};
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 9
#define MIN_HASH_VALUE 2
-#define MAX_HASH_VALUE 43
-/* maximum key range = 42, duplicates = 0 */
+#define MAX_HASH_VALUE 37
+/* maximum key range = 36, duplicates = 0 */
#ifdef __GNUC__
__inline
@@ -34,32 +34,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 18, 29, 14, 6, 7,
- 10, 20, 44, 28, 44, 44, 28, 19, 22, 15,
- 0, 44, 9, 23, 0, 23, 26, 2, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 0, 0, 13, 44, 30, 44, 44, 44, 0, 25,
- 1, 0, 44, 44, 0, 44, 1, 44, 25, 44,
- 44, 0, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 14, 32, 16, 13, 9,
+ 1, 32, 38, 9, 38, 38, 22, 26, 16, 3,
+ 2, 38, 7, 23, 0, 19, 25, 23, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 5, 1, 5, 38, 3, 38, 38, 38, 8, 16,
+ 0, 0, 38, 38, 3, 38, 7, 38, 8, 38,
+ 38, 4, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 38, 38, 38
};
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
}
@@ -77,41 +77,40 @@ is_reserved_word (str, len)
{""}, {""},
{"To", TO, PASCAL_ISO},
{""},
- {"Type", TYPE, PASCAL_ISO},
{"Then", THEN, PASCAL_ISO},
+ {"Type", TYPE, PASCAL_ISO},
+ {"File", FILE_, PASCAL_ISO},
+ {"For", FOR, PASCAL_ISO},
+ {"Or", OR, PASCAL_ISO},
+ {"Function", FUNCTION, PASCAL_ISO},
+ {"Of", OF, PASCAL_ISO},
+ {"In", IN, PASCAL_ISO},
+ {"Procedure", PROCEDURE, PASCAL_ISO},
{"Packed", PACKED, PASCAL_ISO},
- {"While", WHILE, PASCAL_ISO},
+ {"Else", ELSE, PASCAL_ISO},
{"Do", DO, PASCAL_ISO},
- {"Procedure", PROCEDURE, PASCAL_ISO},
+ {"If", IF, PASCAL_ISO},
{"End", END, PASCAL_ISO},
- {"Else", ELSE, PASCAL_ISO},
- {"Downto", DOWNTO, PASCAL_ISO},
- {"For", FOR, PASCAL_ISO},
- {"File", FILE_, PASCAL_ISO},
{"Record", RECORD, PASCAL_ISO},
+ {"Downto", DOWNTO, PASCAL_ISO},
{"Repeat", REPEAT, PASCAL_ISO},
- {"Or", OR, PASCAL_ISO},
{"Case", CASE, PASCAL_ISO},
- {"Function", FUNCTION, PASCAL_ISO},
- {"Const", CONST, PASCAL_ISO},
{"And", AND, PASCAL_ISO},
- {"Mod", MOD, PASCAL_ISO},
{"Array", ARRAY, PASCAL_ISO},
- {"Goto", GOTO, PASCAL_ISO},
- {"Nil", NIL, PASCAL_ISO},
+ {"Div", DIV, PASCAL_ISO},
+ {"Program",PROGRAM,PASCAL_ISO},
{"Not", NOT, PASCAL_ISO},
- {"Set", SET, PASCAL_ISO},
- {"Until", UNTIL, PASCAL_ISO},
+ {"Nil", NIL, PASCAL_ISO},
+ {"Const", CONST, PASCAL_ISO},
+ {"While", WHILE, PASCAL_ISO},
+ {"With", WITH, PASCAL_ISO},
{"Var", VAR, PASCAL_ISO},
- {"Of", OF, PASCAL_ISO},
- {"In", IN, PASCAL_ISO},
- {"Program",PROGRAM,PASCAL_ISO},
+ {"Until", UNTIL, PASCAL_ISO},
+ {"Set", SET, PASCAL_ISO},
+ {"Mod", MOD, PASCAL_ISO},
{"Label", LABEL, PASCAL_ISO},
- {"Div", DIV, PASCAL_ISO},
- {"Begin", BEGIN_, PASCAL_ISO},
- {"With", WITH, PASCAL_ISO},
- {""}, {""}, {""}, {""}, {""}, {""},
- {"If", IF, PASCAL_ISO}
+ {"Goto", GOTO, PASCAL_ISO},
+ {"Begin", BEGIN_, PASCAL_ISO}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/tests/java.exp b/tests/java.exp
index a711b70..e2ca0c6 100644
--- a/tests/java.exp
+++ b/tests/java.exp
@@ -31,9 +31,9 @@ struct java_keyword { const char *name; int token; };
#define TOTAL_KEYWORDS 50
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 12
-#define MIN_HASH_VALUE 6
-#define MAX_HASH_VALUE 86
-/* maximum key range = 81, duplicates = 0 */
+#define MIN_HASH_VALUE 7
+#define MAX_HASH_VALUE 76
+/* maximum key range = 70, duplicates = 0 */
#ifdef __GNUC__
__inline
@@ -49,32 +49,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 18, 37, 38,
- 27, 1, 30, 3, 12, 8, 87, 2, 11, 87,
- 8, 1, 5, 87, 24, 1, 1, 30, 2, 36,
- 87, 1, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 7, 30, 7,
+ 12, 1, 14, 28, 41, 3, 77, 16, 11, 77,
+ 16, 23, 1, 77, 15, 1, 1, 34, 30, 18,
+ 77, 11, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77
};
register int hval = len;
@@ -102,70 +102,63 @@ java_keyword (str, len)
static struct java_keyword wordlist[] =
{
{"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"try", TRY_TK},
+ {"", 0},
{"else", ELSE_TK},
- {"short", SHORT_TK},
- {"goto", GOTO_TK},
- {"extends", EXTENDS_TK},
- {"", 0}, {"", 0},
{"int", INT_TK},
{"this", THIS_TK},
- {"", 0},
- {"native", NATIVE_TK},
- {"", 0}, {"", 0},
- {"interface", INTERFACE_TK},
+ {"extends", EXTENDS_TK},
{"import", IMPORT_TK},
{"private", PRIVATE_TK},
- {"volatile", VOLATILE_TK},
- {"", 0},
+ {"case", CASE_TK},
+ {"interface", INTERFACE_TK},
{"implements", IMPLEMENTS_TK},
- {"", 0},
- {"long", LONG_TK},
- {"switch", SWITCH_TK},
+ {"package", PACKAGE_TK},
{"abstract", ABSTRACT_TK},
{"transient", TRANSIENT_TK},
- {"do", DO_TK},
- {"", 0},
- {"throws", THROWS_TK},
- {"", 0},
- {"null", NULL_TK},
+ {"if", IF_TK},
+ {"class", CLASS_TK},
+ {"static", STATIC_TK},
{"super", SUPER_TK},
- {"true", TRUE_TK},
- {"float", FLOAT_TK},
+ {"throws", THROWS_TK},
+ {"native", NATIVE_TK},
{"", 0},
- {"return", RETURN_TK},
- {"if", IF_TK},
- {"void", VOID_TK},
- {"protected", PROTECTED_TK},
- {"byte", BYTE_TK},
- {"case", CASE_TK},
- {"break", BREAK_TK},
- {"finally", FINALLY_TK},
- {"false", FALSE_TK},
- {"synchronized", SYNCHRONIZED_TK},
- {"instanceof", INSTANCEOF_TK},
+ {"try", TRY_TK},
{"while", WHILE_TK},
- {"package", PACKAGE_TK},
+ {"instanceof", INSTANCEOF_TK},
{"const", CONST_TK},
- {"boolean", BOOLEAN_TK},
- {"final", FINAL_TK},
+ {"short", SHORT_TK},
+ {"false", FALSE_TK},
{"continue", CONTINUE_TK},
- {"catch", CATCH_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"class", CLASS_TK},
- {"static", STATIC_TK},
- {"double", DOUBLE_TK},
+ {"char", CHAR_TK},
{"default", DEFAULT_TK},
+ {"", 0},
+ {"byte", BYTE_TK},
+ {"do", DO_TK},
+ {"return", RETURN_TK},
{"throw", THROW_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0}, {"", 0},
+ {"true", TRUE_TK},
+ {"synchronized", SYNCHRONIZED_TK},
+ {"null", NULL_TK},
+ {"float", FLOAT_TK},
+ {"public", PUBLIC_TK},
+ {"protected", PROTECTED_TK},
+ {"final", FINAL_TK},
{"for", FOR_TK},
- {"", 0},
+ {"finally", FINALLY_TK},
+ {"void", VOID_TK},
+ {"volatile", VOLATILE_TK},
+ {"switch", SWITCH_TK},
+ {"break", BREAK_TK},
+ {"double", DOUBLE_TK},
+ {"catch", CATCH_TK},
{"new", NEW_TK},
- {"char", CHAR_TK},
- {"", 0},
- {"public", PUBLIC_TK}
+ {"goto", GOTO_TK},
+ {"", 0}, {"", 0},
+ {"long", LONG_TK},
+ {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
+ {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
+ {"", 0}, {"", 0}, {"", 0}, {"", 0},
+ {"boolean", BOOLEAN_TK}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/tests/modula2.exp b/tests/modula2.exp
index e13f352..f0f033d 100644
--- a/tests/modula2.exp
+++ b/tests/modula2.exp
@@ -5,8 +5,8 @@
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 14
#define MIN_HASH_VALUE 1
-#define MAX_HASH_VALUE 256
-/* maximum key range = 256, duplicates = 0 */
+#define MAX_HASH_VALUE 155
+/* maximum key range = 155, duplicates = 0 */
#ifdef __GNUC__
__inline
@@ -20,34 +20,34 @@ hash (str, len)
register const char *str;
register unsigned int len;
{
- static unsigned short asso_values[] =
+ static unsigned char asso_values[] =
{
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 25, 30, 35, 21, 0,
- 30, 15, 30, 45, 257, 257, 0, 5, 45, 0,
- 10, 0, 1, 20, 25, 15, 30, 40, 15, 5,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
- 257, 257, 257, 257, 257, 257
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 1, 10, 30, 25, 0,
+ 10, 55, 6, 0, 156, 156, 15, 15, 35, 15,
+ 30, 0, 5, 1, 0, 45, 21, 45, 6, 1,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156
};
register int hval = 0;
@@ -85,108 +85,90 @@ in_word_set (str, len)
{
static unsigned char lengthtable[] =
{
- 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 2, 3, 0,
- 0, 0, 2, 3, 0, 0, 0, 2, 4, 0, 0, 0, 4, 6,
- 0, 0, 0, 3, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
- 3, 5, 6, 0, 0, 6, 0, 0, 0, 0, 3, 0, 0, 0,
- 3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 0, 9,
- 0, 4, 6, 6, 0, 0, 2, 3, 0, 0, 0, 5, 3, 0,
- 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
- 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
- 7, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0,
- 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 4, 0, 0, 0, 2, 2, 0, 5,
+ 0, 2, 4, 0, 0, 0, 2, 0, 0, 0, 0, 2, 5, 3,
+ 0, 0, 3, 4, 4, 0, 0, 2, 6, 0, 0, 0, 2, 4,
+ 0, 0, 0, 4, 3, 0, 0, 0, 3, 4, 0, 0, 0, 3,
+ 6, 0, 0, 0, 3, 3, 0, 0, 0, 6, 5, 0, 0, 0,
+ 10, 9, 0, 0, 0, 4, 0, 0, 0, 0, 6, 5, 0, 0,
+ 0, 7, 0, 0, 0, 0, 6, 0, 0, 0, 0, 5, 0, 0,
+ 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
+ 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 10
+ 0, 9
};
static const char * wordlist[] =
{
"",
- "OR",
- "", "", "", "", "", "", "", "",
- "LOOP",
- "", "", "", "", "", "", "", "", "",
- "ELSE",
- "DO",
+ "SET",
+ "", "", "", "",
+ "EXIT",
"", "", "",
+ "IF",
+ "BY",
+ "",
+ "ARRAY",
+ "",
"TO",
- "MOD",
+ "ELSE",
"", "", "",
+ "OR",
+ "", "", "", "",
"OF",
+ "ELSIF",
+ "VAR",
+ "", "",
"FOR",
+ "TYPE",
+ "CASE",
+ "", "",
+ "IN",
+ "REPEAT",
+ "", "", "",
+ "DO",
+ "THEN",
"", "", "",
- "BY",
"FROM",
+ "DIV",
"", "", "",
- "TYPE",
- "MODULE",
+ "NOT",
+ "WITH",
"", "", "",
- "SET",
- "", "", "", "", "",
+ "MOD",
"EXPORT",
- "", "", "", "",
- "VAR",
- "ARRAY",
- "RECORD",
- "", "",
- "REPEAT",
- "", "", "", "",
+ "", "", "",
"END",
+ "AND",
"", "", "",
- "NOT",
- "", "", "", "",
- "IF",
- "", "", "", "",
- "CASE",
- "", "",
- "PROCEDURE",
- "",
- "EXIT",
"IMPORT",
- "RETURN",
- "", "",
- "IN",
- "AND",
+ "WHILE",
"", "", "",
- "ELSIF",
- "DIV",
+ "DEFINITION",
+ "QUALIFIED",
"", "", "",
- "THEN",
- "", "", "", "", "", "", "", "", "",
- "IMPLEMENTATION",
+ "LOOP",
"", "", "", "",
- "WHILE",
- "", "", "", "", "", "", "", "", "",
+ "RECORD",
"CONST",
- "POINTER",
"", "", "",
+ "POINTER",
+ "", "", "", "",
+ "RETURN",
+ "", "", "", "",
"UNTIL",
"", "", "", "",
"BEGIN",
- "", "", "", "",
- "WITH",
- "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "",
- "",
- "QUALIFIED",
- "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
+ "IMPLEMENTATION",
+ "", "", "", "",
+ "MODULE",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
- "", "", "", "", "",
- "DEFINITION"
+ "", "", "",
+ "PROCEDURE"
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/tests/objc.exp b/tests/objc.exp
index b2eaba4..6d604da 100644
--- a/tests/objc.exp
+++ b/tests/objc.exp
@@ -7,8 +7,8 @@ struct resword { char *name; short token; enum rid rid; };
#define TOTAL_KEYWORDS 59
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 15
-#define MIN_HASH_VALUE 11
-#define MAX_HASH_VALUE 98
+#define MIN_HASH_VALUE 8
+#define MAX_HASH_VALUE 95
/* maximum key range = 88, duplicates = 0 */
#ifdef __GNUC__
@@ -25,32 +25,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 16, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 1, 99, 2, 1, 32,
- 1, 5, 19, 36, 25, 13, 99, 1, 8, 37,
- 2, 41, 34, 99, 27, 12, 1, 42, 21, 28,
- 99, 99, 12, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 19, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 2, 96, 2, 1, 10,
+ 26, 1, 23, 27, 27, 24, 96, 1, 25, 36,
+ 10, 34, 23, 96, 10, 6, 8, 11, 41, 2,
+ 96, 96, 23, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 96, 96
};
register int hval = len;
@@ -77,77 +77,76 @@ is_reserved_word (str, len)
{
static struct resword wordlist[] =
{
- {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
- {""}, {""},
- {"__asm__", ASM, NORID},
+ {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{"break", BREAK, NORID},
- {"__typeof__", TYPEOF, NORID},
- {"extern", SCSPEC, RID_EXTERN},
- {"__alignof__", ALIGNOF, NORID},
- {""},
- {"__attribute__", ATTRIBUTE, NORID},
- {"int", TYPESPEC, RID_INT},
+ {""}, {""}, {""},
+ {"else", ELSE, NORID},
+ {"__asm__", ASM, NORID},
+ {""}, {""},
{"__attribute", ATTRIBUTE, NORID},
+ {"__alignof__", ALIGNOF, NORID},
{"__extension__", EXTENSION, NORID},
- {""},
- {"__signed", TYPESPEC, RID_SIGNED},
- {"@end", END, NORID},
+ {"__attribute__", ATTRIBUTE, NORID},
{"__signed__", TYPESPEC, RID_SIGNED},
- {"__inline__", SCSPEC, RID_INLINE},
- {"else", ELSE, NORID},
+ {"case", CASE, NORID},
+ {"__typeof__", TYPEOF, NORID},
+ {"__const__", TYPE_QUAL, RID_CONST},
+ {"static", SCSPEC, RID_STATIC},
+ {"extern", SCSPEC, RID_EXTERN},
+ {"char", TYPESPEC, RID_CHAR},
+ {"__const", TYPE_QUAL, RID_CONST},
+ {""},
+ {"continue", CONTINUE, NORID},
+ {"struct", STRUCT, NORID},
+ {"@defs", DEFS, NORID},
+ {"while", WHILE, NORID},
+ {"const", TYPE_QUAL, RID_CONST},
+ {"return", RETURN, NORID},
{"__inline", SCSPEC, RID_INLINE},
- {"default", DEFAULT, NORID},
- {"__typeof", TYPEOF, NORID},
- {"@encode", ENCODE, NORID},
{"__alignof", ALIGNOF, NORID},
- {"inline", SCSPEC, RID_INLINE},
+ {"@encode", ENCODE, NORID},
+ {"__inline__", SCSPEC, RID_INLINE},
+ {"@selector", SELECTOR, NORID},
{"@interface", INTERFACE, NORID},
- {"if", IF, NORID},
- {"__volatile__", TYPE_QUAL, RID_VOLATILE},
- {"return", RETURN, NORID},
- {"__volatile", TYPE_QUAL, RID_VOLATILE},
- {"@defs", DEFS, NORID},
- {"void", TYPESPEC, RID_VOID},
- {"const", TYPE_QUAL, RID_CONST},
- {"__const", TYPE_QUAL, RID_CONST},
- {"volatile", TYPE_QUAL, RID_VOLATILE},
- {"__const__", TYPE_QUAL, RID_CONST},
- {"do", DO, NORID},
+ {"__typeof", TYPEOF, NORID},
+ {"__signed", TYPESPEC, RID_SIGNED},
+ {"int", TYPESPEC, RID_INT},
+ {"double", TYPESPEC, RID_DOUBLE},
{"__asm", ASM, NORID},
- {"struct", STRUCT, NORID},
- {"continue", CONTINUE, NORID},
+ {"for", FOR, NORID},
+ {"@public", PUBLIC, NORID},
{"auto", SCSPEC, RID_AUTO},
- {"sizeof", SIZEOF, NORID},
- {"long", TYPESPEC, RID_LONG},
- {"while", WHILE, NORID},
- {"static", SCSPEC, RID_STATIC},
- {"case", CASE, NORID},
- {"double", TYPESPEC, RID_DOUBLE},
- {"signed", TYPESPEC, RID_SIGNED},
- {"switch", SWITCH, NORID},
- {"@selector", SELECTOR, NORID},
- {""},
+ {"if", IF, NORID},
+ {"union", UNION, NORID},
+ {"unsigned", TYPESPEC, RID_UNSIGNED},
+ {"enum", ENUM, NORID},
{"short", TYPESPEC, RID_SHORT},
+ {"__volatile", TYPE_QUAL, RID_VOLATILE},
+ {"register", SCSPEC, RID_REGISTER},
+ {"inline", SCSPEC, RID_INLINE},
+ {"__volatile__", TYPE_QUAL, RID_VOLATILE},
+ {"sizeof", SIZEOF, NORID},
+ {"@end", END, NORID},
{"typeof", TYPEOF, NORID},
{"typedef", SCSPEC, RID_TYPEDEF},
- {"union", UNION, NORID},
- {"unsigned", TYPESPEC, RID_UNSIGNED},
- {""},
- {"char", TYPESPEC, RID_CHAR},
- {"float", TYPESPEC, RID_FLOAT},
+ {"do", DO, NORID},
+ {"switch", SWITCH, NORID},
+ {"default", DEFAULT, NORID},
+ {"signed", TYPESPEC, RID_SIGNED},
+ {"long", TYPESPEC, RID_LONG},
{""}, {""}, {""},
- {"@implementation", IMPLEMENTATION, NORID},
- {""}, {""}, {""}, {""}, {""},
- {"for", FOR, NORID},
+ {"float", TYPESPEC, RID_FLOAT},
{""}, {""},
+ {"goto", GOTO, NORID},
+ {""},
+ {"volatile", TYPE_QUAL, RID_VOLATILE},
+ {""},
{"asm", ASM, NORID},
{""}, {""},
- {"goto", GOTO, NORID},
+ {"@implementation", IMPLEMENTATION, NORID},
+ {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""},
- {"enum", ENUM, NORID},
- {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
- {"@public", PUBLIC, NORID},
- {"register", SCSPEC, RID_REGISTER}
+ {"void", TYPESPEC, RID_VOID}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/tests/test-4.exp b/tests/test-4.exp
index 03bb87e..b72fcac 100644
--- a/tests/test-4.exp
+++ b/tests/test-4.exp
@@ -7,9 +7,9 @@ struct resword { const char *name; short token; enum rid rid; };
#define TOTAL_KEYWORDS 83
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 20
-#define MIN_HASH_VALUE 6
-#define MAX_HASH_VALUE 170
-/* maximum key range = 165, duplicates = 8 */
+#define MIN_HASH_VALUE 4
+#define MAX_HASH_VALUE 127
+/* maximum key range = 124, duplicates = 8 */
#ifdef __GNUC__
__inline
@@ -25,32 +25,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 30, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 0, 171, 10, 80, 60,
- 15, 20, 85, 45, 0, 30, 171, 0, 40, 35,
- 45, 20, 171, 171, 60, 0, 10, 15, 35, 0,
- 5, 60, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 0, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 5, 128, 0, 15, 50,
+ 55, 0, 15, 35, 65, 60, 128, 40, 0, 60,
+ 65, 10, 128, 128, 15, 20, 30, 20, 40, 0,
+ 20, 15, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128
};
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
}
@@ -65,7 +65,17 @@ in_word_set (str, len)
{
static struct resword wordlist[] =
{
- {"switch", SWITCH, NORID},
+ {"else", ELSE, NORID},
+ {"while", WHILE, NORID},
+ {"@encode", ENCODE, NORID},
+ {"@private", PRIVATE, NORID},
+ {"@protocol", PROTOCOL, NORID},
+ {"@interface", INTERFACE, NORID},
+ {"__real", REALPART, NORID},
+ {"__inline", SCSPEC, RID_INLINE},
+ {"auto", SCSPEC, RID_AUTO},
+ {"__volatile", TYPE_QUAL, RID_VOLATILE},
+ {"__attribute", ATTRIBUTE, NORID},
{"__asm__", ASM_KEYWORD, NORID},
{"__imag__", IMAGPART, NORID},
{"__real__", REALPART, NORID},
@@ -81,99 +91,83 @@ in_word_set (str, len)
{"__restrict__", TYPE_QUAL, RID_RESTRICT},
{"__attribute__", ATTRIBUTE, NORID},
{"__extension__", EXTENSION, NORID},
- {"__complex", TYPESPEC, RID_COMPLEX},
- {"short", TYPESPEC, RID_SHORT},
- {"struct", STRUCT, NORID},
- {"__const", TYPE_QUAL, RID_CONST},
- {"__restrict", TYPE_QUAL, RID_RESTRICT},
- {"signed", TYPESPEC, RID_SIGNED},
- {"__signed", TYPESPEC, RID_SIGNED},
- {"while", WHILE, NORID},
- {"__inline", SCSPEC, RID_INLINE},
- {"__volatile", TYPE_QUAL, RID_VOLATILE},
- {"__attribute", ATTRIBUTE, NORID},
- {"default", DEFAULT, NORID},
- {"out", TYPE_QUAL, RID_OUT},
- {"auto", SCSPEC, RID_AUTO},
+ {"@selector", SELECTOR, NORID},
{"@defs", DEFS, NORID},
{"@class", CLASS, NORID},
- {"do", DO, NORID},
- {"unsigned", TYPESPEC, RID_UNSIGNED},
- {"__asm", ASM_KEYWORD, NORID},
- {"double", TYPESPEC, RID_DOUBLE},
- {"int", TYPESPEC, RID_INT},
- {"else", ELSE, NORID},
- {"inout", TYPE_QUAL, RID_INOUT},
- {"__real", REALPART, NORID},
- {"id", OBJECTNAME, RID_ID},
- {"asm", ASM_KEYWORD, NORID},
- {"@end", END, NORID},
+ {"__typeof", TYPEOF, NORID},
+ {"__alignof", ALIGNOF, NORID},
+ {"__iterator", SCSPEC, RID_ITERATOR},
+ {"oneway", TYPE_QUAL, RID_ONEWAY},
+ {"for", FOR, NORID},
+ {"__complex", TYPESPEC, RID_COMPLEX},
+ {"byref", TYPE_QUAL, RID_BYREF},
+ {"bycopy", TYPE_QUAL, RID_BYCOPY},
+ {"register", SCSPEC, RID_REGISTER},
+ {"long", TYPESPEC, RID_LONG},
{"@compatibility_alias", ALIAS, NORID},
+ {"sizeof", SIZEOF, NORID},
+ {"__const", TYPE_QUAL, RID_CONST},
+ {"out", TYPE_QUAL, RID_OUT},
+ {"__restrict", TYPE_QUAL, RID_RESTRICT},
{"__imag", IMAGPART, NORID},
- {"void", TYPESPEC, RID_VOID},
- {"@protected", PROTECTED, NORID},
- {"inline", SCSPEC, RID_INLINE},
- {"@encode", ENCODE, NORID},
- {"@private", PRIVATE, NORID},
- {"enum", ENUM, NORID},
- {"@interface", INTERFACE, NORID},
{"volatile", TYPE_QUAL, RID_VOLATILE},
- {"union", UNION, NORID},
- {"static", SCSPEC, RID_STATIC},
{"goto", GOTO, NORID},
- {"__iterator", SCSPEC, RID_ITERATOR},
- {"extern", SCSPEC, RID_EXTERN},
- {"const", TYPE_QUAL, RID_CONST},
- {"in", TYPE_QUAL, RID_IN},
+ {"float", TYPESPEC, RID_FLOAT},
+ {"typeof", TYPEOF, NORID},
+ {"typedef", SCSPEC, RID_TYPEDEF},
{"restrict", TYPE_QUAL, RID_RESTRICT},
- {"@protocol", PROTOCOL, NORID},
{"case", CASE, NORID},
- {"break", BREAK, NORID},
- {"oneway", TYPE_QUAL, RID_ONEWAY},
+ {"short", TYPESPEC, RID_SHORT},
+ {"struct", STRUCT, NORID},
+ {"@public", PUBLIC, NORID},
{"continue", CONTINUE, NORID},
- {"long", TYPESPEC, RID_LONG},
+ {"@end", END, NORID},
+ {"break", BREAK, NORID},
+ {"double", TYPESPEC, RID_DOUBLE},
+ {"asm", ASM_KEYWORD, NORID},
+ {"enum", ENUM, NORID},
+ {"@protected", PROTECTED, NORID},
+ {"inline", SCSPEC, RID_INLINE},
+ {"do", DO, NORID},
+ {"__signed", TYPESPEC, RID_SIGNED},
+ {"char", TYPESPEC, RID_CHAR},
+ {"__asm", ASM_KEYWORD, NORID},
+ {"extern", SCSPEC, RID_EXTERN},
+ {"static", SCSPEC, RID_STATIC},
+ {"if", IF, NORID},
{"@implementation", IMPLEMENTATION, NORID},
- {"sizeof", SIZEOF, NORID},
- {"__typeof", TYPEOF, NORID},
- {"__alignof", ALIGNOF, NORID},
- {"@public", PUBLIC, NORID},
- {"@selector", SELECTOR, NORID},
- {"float", TYPESPEC, RID_FLOAT},
- {"typeof", TYPEOF, NORID},
- {"typedef", SCSPEC, RID_TYPEDEF},
+ {"signed", TYPESPEC, RID_SIGNED},
+ {"unsigned", TYPESPEC, RID_UNSIGNED},
+ {"const", TYPE_QUAL, RID_CONST},
{"return", RETURN, NORID},
- {"if", IF, NORID},
- {"char", TYPESPEC, RID_CHAR},
- {"register", SCSPEC, RID_REGISTER},
- {"bycopy", TYPE_QUAL, RID_BYCOPY},
- {"for", FOR, NORID},
- {"byref", TYPE_QUAL, RID_BYREF}
+ {"union", UNION, NORID},
+ {"switch", SWITCH, NORID},
+ {"default", DEFAULT, NORID},
+ {"int", TYPESPEC, RID_INT},
+ {"inout", TYPE_QUAL, RID_INOUT},
+ {"void", TYPESPEC, RID_VOID},
+ {"id", OBJECTNAME, RID_ID},
+ {"in", TYPE_QUAL, RID_IN}
};
static short lookup[] =
{
- -1, -1, -1, -1, -1, -1, 0, 1,
- -156, -151, -145, -136, -110, -102, 16, 17,
- 18, 19, -69, -2, 20, 21, -1, 22,
- -1, 23, -72, -3, 24, -1, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, -1,
- 34, 35, -1, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, -74, -2, 45, 46,
- 47, 48, 49, 50, 51, -77, -3, 52,
- -1, 53, 54, -79, -2, 55, 56, 57,
- -81, -2, -1, 58, -1, 59, 60, 61,
- -1, -1, -1, -1, 62, 63, 64, -1,
- 65, 66, 67, 68, -1, 69, 70, -1,
- -1, 71, -1, 72, 73, 74, 75, -1,
- -1, -1, -1, -1, -1, -1, -1, 76,
- -1, -1, -1, -1, -1, 77, -1, -1,
- -1, -1, -1, -1, 78, -1, -1, -1,
- 79, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 80, -1, 81, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 0, 1, -1, 2,
+ 3, 4, 5, 6, -1, 7, 8, 9,
+ 10, 11, -184, -180, -171, -162, -158, -156,
+ 26, 27, 28, -1, 29, 30, 31, 32,
+ -1, 33, 34, 35, 36, -1, 37, 38,
+ 39, 40, 41, 42, -1, 43, 44, -1,
+ 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, -1, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67,
+ -59, -2, -62, -3, 68, 69, -64, -2,
+ 70, 71, -1, 72, -1, 73, 74, -67,
+ -3, -1, 75, 76, 77, 78, -1, 79,
+ -69, -2, -1, 80, -71, -2, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 82
+ -1, -1, -1, -1, -1, 81, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 82
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/tests/test-6.exp b/tests/test-6.exp
index 1fa9072..a6180e6 100644
--- a/tests/test-6.exp
+++ b/tests/test-6.exp
@@ -87,12 +87,6 @@ Algorithm employed by gperf:
$,1,2,4,6-10.
-D, --duplicates Handle keywords that hash to duplicate values. This
is useful for certain highly redundant keyword sets.
- -f, --fast=ITERATIONS Generate the gen-perf.hash function "fast". This
- decreases gperf's running time at the cost of
- minimizing generated table size. The numeric
- argument represents the number of times to iterate
- when resolving a collision. '0' means "iterate by
- the number of keywords".
-m, --multiple-iterations=ITERATIONS
Perform multiple choices of the -i and -j values,
and choose the best results. This increases the
@@ -106,9 +100,6 @@ Algorithm employed by gperf:
be an odd number, default is 5.
-n, --no-strlen Do not include the length of the keyword when
computing the hash function.
- -o, --occurrence-sort Reorders input keys by frequency of occurrence of
- the key sets. This should decrease the search time
- dramatically.
-r, --random Utilizes randomness to initialize the associated
values table.
-s, --size-multiple=N Affects the size of the generated hash table. The