mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Better debugging output.
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
2002-12-07 Bruno Haible <bruno@clisp.org>
|
2002-12-07 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
|
* src/search.cc (Search::prepare_asso_values) [DEBUG]: Also print
|
||||||
|
the keyword list in order.
|
||||||
|
(Search::find_asso_values) [DEBUG]: Upon failure, print the union_set.
|
||||||
|
|
||||||
* src/options.h (Options::get_size_multiple): Change return type to
|
* src/options.h (Options::get_size_multiple): Change return type to
|
||||||
float.
|
float.
|
||||||
(Options::_size_multiple): Change type to float.
|
(Options::_size_multiple): Change type to float.
|
||||||
|
|||||||
@@ -830,10 +830,40 @@ Search::prepare_asso_values ()
|
|||||||
_collision_detector = new Bool_Array (_max_hash_value + 1);
|
_collision_detector = new Bool_Array (_max_hash_value + 1);
|
||||||
|
|
||||||
if (option[DEBUG])
|
if (option[DEBUG])
|
||||||
|
{
|
||||||
fprintf (stderr, "total non-linked keys = %d\nmaximum associated value is %d"
|
fprintf (stderr, "total non-linked keys = %d\nmaximum associated value is %d"
|
||||||
"\nmaximum size of generated hash table is %d\n",
|
"\nmaximum size of generated hash table is %d\n",
|
||||||
non_linked_length, asso_value_max, _max_hash_value);
|
non_linked_length, asso_value_max, _max_hash_value);
|
||||||
|
|
||||||
|
int field_width;
|
||||||
|
|
||||||
|
field_width = 0;
|
||||||
|
{
|
||||||
|
for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
|
||||||
|
{
|
||||||
|
KeywordExt *keyword = temp->first();
|
||||||
|
if (field_width < keyword->_selchars_length)
|
||||||
|
field_width = keyword->_selchars_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (stderr, "\ndumping the keyword list without duplicates\n");
|
||||||
|
fprintf (stderr, "keyword #, %*s, keyword\n", field_width, "keysig");
|
||||||
|
int i = 0;
|
||||||
|
for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
|
||||||
|
{
|
||||||
|
KeywordExt *keyword = temp->first();
|
||||||
|
fprintf (stderr, "%9d, ", ++i);
|
||||||
|
if (field_width > keyword->_selchars_length)
|
||||||
|
fprintf (stderr, "%*s", field_width - keyword->_selchars_length, "");
|
||||||
|
for (int j = 0; j < keyword->_selchars_length; j++)
|
||||||
|
putc (keyword->_selchars[j], stderr);
|
||||||
|
fprintf (stderr, ", %.*s\n",
|
||||||
|
keyword->_allchars_length, keyword->_allchars);
|
||||||
|
}
|
||||||
|
fprintf (stderr, "\nend of keyword list\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (option[RANDOM] || option.get_jump () == 0)
|
if (option[RANDOM] || option.get_jump () == 0)
|
||||||
/* We will use rand(), so initialize the random number generator. */
|
/* We will use rand(), so initialize the random number generator. */
|
||||||
srand (static_cast<long>(time (0)));
|
srand (static_cast<long>(time (0)));
|
||||||
@@ -1191,8 +1221,15 @@ Search::find_asso_values ()
|
|||||||
|
|
||||||
if (option[DEBUG])
|
if (option[DEBUG])
|
||||||
{
|
{
|
||||||
fprintf (stderr, "** collision not resolved after %d iterations, backtracking...\n",
|
fprintf (stderr, "** collision not resolved after %d iterations of asso_value[",
|
||||||
iterations);
|
iterations);
|
||||||
|
for (union_index = 0; union_index < union_set_length; union_index++)
|
||||||
|
{
|
||||||
|
if (union_index > 0)
|
||||||
|
fprintf (stderr, ",");
|
||||||
|
fprintf(stderr, "'%c'", union_set[union_index]);
|
||||||
|
}
|
||||||
|
fprintf (stderr, "], backtracking...\n");
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user