ChangeLog   [plain text]

2007-04-30  Brendan Kehoe  <>

	* gperf-3.0.3 released.
	* src/ Bump to 3.0.3.
	* tests/*.exp: Bump to 3.0.3 in header.
	* doc/gperf.1: Regenerate with gperf 3.0.3.

2007-04-06  Bruno Haible  <>

	Improve support for mingw.
	* tests/ (check-c, check-ada, check-modula3, check-pascal,
	check-lang-utf8, check-lang-ucs2): Remove '\r' from output before diff.
	(check-test): Use it to postprocess output before diff.

2007-04-04  Bruno Haible  <>

	Support for newer GNU standards.
	* doc/ (mandir): Remove assignment.
	* doc/ (datarootdir): New variable.
	(docdir, dvidir, psdir, pdfdir, htmldir): Use value determined by
	* Require autoconf >= 2.60.
	* doc/ Likewise.
	* lib/ Likewise.
	* src/ Likewise.
	* tests/ Likewise.
	* configure: Regenerated with autoconf-2.61.
	* doc/configure: Likewise.
	* lib/configure: Likewise.
	* src/configure: Likewise.
	* tests/configure: Likewise.
	* src/ Likewise.
	* src/config.h.msvc: Likewise.
	* src/config.h_vms: Likewise.

2007-04-04  Bruno Haible  <>

	* doc/ (MAKEINFO): Disable also the LC_MESSAGES and LC_ALL
	environment variables.

2007-04-04  Bruno Haible  <>

	* Renamed from
	* doc/ Renamed from doc/
	* lib/ Renamed from lib/
	* src/ Renamed from src/
	* tests/ Renamed from tests/
	* Makefile.devel: Update.
	* INSTALL: Update.

2007-03-31  Bruno Haible  <>

	* tests/test.c (in_word_set): New declaration.
	* tests/test2.c (in_word_set): Likewise.

2007-03-31  Bruno Haible  <>

	* src/ (Options::parse_options): Bump copyright year.

2007-03-31  Bruno Haible  <>

	* doc/gperf.texi: Fix typo.

2007-03-31  Bruno Haible  <>

	Change generated code after the meaning of __inline is changed in
	GCC 4.3.
	* src/ (Output::output_lookup_function): Emit an inline
	marker that also works with gcc-4.3 in c99 or gnu99 mode.
	* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
	tests/cplusplus.exp, tests/gpc.exp, tests/incomplete.exp,
	tests/java.exp, tests/languages.exp, tests/modula2.exp,
	tests/objc.exp, tests/permut2.exp, tests/permut3.exp,
	tests/permutc2.exp, tests/test-4.exp: Update.
	Reported by Bruce Korb <>.

2006-06-29  Brendan Kehoe  <>

	* gperf-3.0.2 released.

	* doc/ (all): No longer depend on dvi.

2006-01-22  Brendan Kehoe  <>

	* doc/gperf.texi: Update copyright to be 1989-2006.
	(UPDATED): Change to 22 January 2006.
	* doc/gperf.1 (TH): Fix date.
	* Update copyright years.
	* configure: Regenerate.
	* src/ Update copyright years.

	* doc/gperf.{dvi,ps,pdf}: Regenerated by manually invoking tex
	instead of trying to use texi2dvi, whose run of etex ends up
	actually always running pdfetex, thus always recreating gperf.pdf.

2006-01-13  Brendan Kehoe  <>

	* NEWS: Add note about #line directive fix.
	* doc/gperf.1: Regenerate with Makefile.devel.

	* doc/gperf.texi (UPDATED): Correct to be today.
	* doc: Regenerated by doing make in a configured tree.
	Requires makeinfo, texi2dvi, texi2pdf, and texi2html.

	* lib/ (OBJEXT): Define for subst.
	(OBJECTS): Use $(OBJEXT) instead of '.o'.
	* src/ Make dependencies use $(OBJEXT).
	(OBJEXT, EXEEXT): Define for subst.
	(OBJECTS): Use $(OBJEXT) instead of '.o'.
	(clean): Remove *.$(OBJEXT) instead of *.o.

2006-01-13  Bruno Haible  <>

	Fix #line directives for filenames containing backslashes.
	* src/ (output_line_directive): New function.
	(output_keyword_entry, Output::output): Use it.
	Reported by Alexander <>.

	* src/ (Options::parse_options): Update years in --version

2005-08-29  Brendan Kehoe  <>

	* src/ Tweak comment to avoid nesting.

2005-08-27  Bruno Haible  <>

	Fix missing ranlib detection when cross-compiling.
	* aclocal.m4 (CL_PROG_RANLIB): Remove macro.
	* lib/ Use AC_PROG_RANLIB instead of CL_PROG_RANLIB.

2005-07-30  Bruno Haible  <>

	* src/ Bump version number to 3.0.2.
	* doc/gperf.texi: Likewise.
	* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
	tests/cplusplus.exp, tests/gpc.exp, tests/incomplete.exp,
	tests/java.exp, tests/languages.exp, tests/modula2.exp,
	tests/objc.exp, tests/permut2.exp, tests/permut3.exp,
	tests/permutc2.exp, tests/test-4.exp: Update.

2005-07-30  Bruno Haible  <>

	* src/positions.h: Add forward declarations of friend classes.
	Needed for compilation with g++ 4.0.

2004-08-22  Bruno Haible  <>

	* tests/ (check-lang-syntax): Add test for the
	--length-table-name option.
	* tests/test-6.exp: Update.

2004-08-21  Bruce Lilly <>

	* src/ (Input::read_input): Accept length-table-name
	* src/options.h (Options::get_lengthtable_name,
	Options::set_lengthtable_name): New declarations.
	(Options): Add field _lengthtable_name.
	* src/options.icc (Options::get_lengthtable_name): New inline method.
	* src/ (DEFAULT_LENGTHTABLE_NAME): New constant.
	(Options::long_usage): Document --length-table-name option.
	(Options::Options): Initialize _lengthtable_name field.
	(Options::~Options): Update.
	(Options::set_lengthtable_name): New method.
	(long_options): Add option --length-table-name.
	(Options::parse_options): Implement --length-table-name option.
	* src/ (Output::output_keylength_table, output_switch_case,
	Output::output_lookup_function_body): Use option.get_lengthtable_name.
	* doc/gperf.texi (Gperf Declarations): Document %define
	(Output Details): Document --length-table-name option.

2003-06-12  Bruno Haible  <>

	* gperf-3.0.1 released.

	* src/ Bump version number to 3.0.1.
	* doc/gperf.texi: Likewise.
	* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
	tests/cplusplus.exp, tests/gpc.exp, tests/incomplete.exp,
	tests/java.exp, tests/languages.exp, tests/modula2.exp,
	tests/objc.exp, tests/permut2.exp, tests/permut3.exp,
	tests/permutc2.exp, tests/test-4.exp: Update.

2003-05-31  Bruno Haible  <>

	* doc/gperf.texi (User-supplied Struct): Mention the possibility of an
	abbreviated struct declaration.
	* src/ (Input::read_input): Support struct declarations of the
	form "struct foo;".
	* tests/incomplete.gperf: New file.
	* tests/incomplete.exp: New file.
	* tests/ (check-test): Check incomplete.gperf too.
	Reported by Rob Leslie <>.

2003-05-20  Bruno Haible  <>

	* doc/ ( Don't use $< in a target rule.

2003-05-27  Bruno Haible  <>

	* Makefile.vms (CC): Correct value.
	(getopt.obj, getopt1.obj, getline.obj, hash.obj): Don't set

2003-05-17  Bruno Haible  <>

	* Makefile.msvc (DEBUGFLAGS): New variable.
	(gperf.exe): Use it, and MFLAGS too.

2003-05-08  Bruno Haible  <>

	* gperf-3.0 released.

2003-05-07  Bruno Haible  <>

	* src/ Bump version number to 3.0.
	* doc/gperf.texi: Likewise.
	* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
	tests/cplusplus.exp, tests/gpc.exp, tests/java.exp,
	tests/languages.exp, tests/modula2.exp, tests/objc.exp,
	tests/permut2.exp, tests/permut3.exp, tests/permutc2.exp,
	tests/test-4.exp: Update.

	* src/ Fix AC_INIT argument.

	* Makefile.devel (configure, lib/configure, src/configure,
	tests/configure, doc/configure): Use the newest autoconf.
	(src/ Use the newest autoheader.

2003-05-03  Bruno Haible  <>

	* doc/gperf.texi: Use two spaces as sentence separator, as recommended
	by the texinfo manual.

2003-04-12  Bruno Haible  <>

	* doc/ (mandir): Change default value.
	* doc/ (docdir): Use datadir instead of prefix.
	* Makefile.msvc (datadir): New variable.
	(mandir, docdir): Use it instead of prefix.
	(install, installdirs): Update.
	* Makefile.vms (datadir): New variable.
	(mandir, docdir): Use it instead of prefix.
	(install, installdirs): Update.

2003-04-12  Bruno Haible  <>

	* README.vms: New file.
	* Makefile.vms: New file.
	* Makefile.devel (src/config.h_vms): New rule.
	(all): Depend on it.

2003-03-19  Bruno Haible  <>

	* src/ (Input::read_input): Ignore comments at the beginning
	of the declarations section.
	* doc/gperf.texi (Controls for GNU indent): New section.
	Reported by Bruce Lilly <>.

2003-03-19  Bruno Haible  <>

	* src/ (Output::output_hash_function): Avoid lint warning if
	not all arguments of the hash function are used. Avoid lint warning
	for fallthrough in switch.
	* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
	tests/cplusplus.exp, tests/java.exp, tests/languages.exp,
	tests/modula2.exp, tests/objc.exp: All /*FALLTHROUGH*/ to expected
	Reported by Bruce Lilly <>.

2003-03-01  Bruno Haible  <>

	* src/options.h (Options::set_initializer_suffix): New declaration.
	* src/ (Options::set_initializer_suffix): New method.
	* src/ (Input::read_input): Recognize %define
	* doc/gperf.texi (Gperf Declarations): Document %define
	* NEWS: Update.

2003-02-26  Bruno Haible  <>

	* Makefile.msvc: New file.
	* README.woe32: New file.
	* Makefile.devel (all): Depend on src/config.h.msvc.
	(src/config.h.msvc): New rule.

2003-01-07  Bruno Haible  <>

	* src/input.h (Input::_charset_dependent): New field.
	* src/ (Input::read_input): Also set _charset_dependent.
	* src/ (main): Pass _charset_dependent from Input to Output.
	* src/output.h (Output::Output): Add charset_dependent argument.
	(Output::_charset_dependent): New field.
	* src/ (Output::Output): Add charset_dependent argument.
	(Output::output): Provoke a compilation error if the execution
	character set doesn't match the expectations.
	* tests/c-parse.exp, tests/charsets.exp, tests/chill.exp,
	tests/cplusplus.exp, tests/gpc.exp, tests/java.exp,
	tests/languages.exp, tests/modula2.exp, tests/objc.exp,
	tests/permut2.exp, tests/permut3.exp, tests/permutc2.exp,
	tests/test-4.exp: Update.

	* src/ (Options::long_usage): Change bug report address to
	* tests/test-6.exp: Update.

	* src/ (USE_DOWNCASE_TABLE): New macro.
	(output_upperlower_table): New function.
	(output_upperlower_strcmp, output_upperlower_strncmp,
	output_upperlower_memcmp): Emit gperf_downcase array accesses.
	(Output::output): Call output_upperlower_table.
	* tests/permutc2.exp: Update.

	* src/keyword-list.icc (KeywordExt_List::rest): Use a portable cast.
	(Only in GCC a cast of an lvalue is an lvalue.)

2003-01-01  Bruno Haible  <>

	* src/ (Options::parse_options): Update copyright year.

	* doc/gperf.texi (@author): Add me.

	* src/options.h (NULLSTRINGS): New enum value.
	(Options::get_stringpool_name, Options::set_stringpool_name): New
	method declarations.
	(Options::_stringpool_name): New field.
	* src/options.icc (Options::get_stringpool_name): New method.
	* src/ (DEFAULT_STRINGPOOL_NAME): New variable.
	(Options::long_usage): Document -Q and --null-strings.
	(Options::Options): Initialize _stringpool_name.
	(Options::~Options): Output _stringpool_name, NULLSTRINGS values too.
	(Options::set_stringpool_name): New method.
	(long_options): Add options --string-pool-name, --null-strings.
	(Options::parse_options): Implement options -P, -Q and --null-strings.
	* src/ (Input::read_input): Recognize declarations %pic,
	%define string-pool-name, %null-strings.
	* src/output.h (Output::output_string_pool,
	Output::output_lookup_pools): New method declarations.
	(Output::_wordlist_eltype): New field.
	* src/ (Output::output_keylength_table): Trivial
	(Output::output_string_pool): New method.
	(output_keyword_entry): Add stringpool_index argument. For SHAREDLIB,
	use struct offsets.
	(output_keyword_blank_entries): For SHAREDLIB, use -1 instead of "".
	(Output::output_keyword_table): Use _wordlist_eltype instead of
	_struct_tag. Compute stringpool_index for output_keyword_entry.
	(Output::output_lookup_pools): New method.
	(Output::output_lookup_function_body): Use _wordlist_eltype instead of
	_struct_tag. For SHAREDLIB, use "+ stringpool" to convert offsets to
	strings. Use "o >= 0" to test for nonempty table entry.
	(Output::output_lookup_function): Call output_lookup_pools.
	(Output::output): Initialize _wordlist_eltype. Call
	* tests/jstest4.gperf: New file.
	* tests/test-6.exp: Update.
	* tests/ (check-lang-syntax): Drop test of -p. Add tests of
	-P and -Q.
	* doc/gperf.texi (User-supplied Struct): Mention that first field has
	to be of type 'int' if -P is given.
	(Gperf Declarations): Document %pic, %define string-pool-name,
	(Output Details): Update description of option -P. Document options -Q
	and --null-strings.

	* tests/ (check-link-c, check-ada, check-pascal,
	check-test): Omit option -p.
	* tests/c-parse.exp: Regenerated.
	* tests/chill.exp: Regenerated.
	* tests/cplusplus.exp: Regenerated.
	* tests/gpc.exp: Regenerated.
	* tests/java.exp: Regenerated.
	* tests/objc.exp: Regenerated.
	* tests/test-4.exp: Regenerated.

	* src/ (Output::output_lookup_function_body): Omit the
	multicompare code section and its variables when it is not used.
	* tests/chill.exp: Regenerated.

	* src/output.c (Output_Compare::output_firstchar_comparison): New
	Output_Compare_Memcmp::output_comparison): Use it.
	* tests/permutc2.exp: Update.

	* tests/smtp.gperf: New file, based on a contribution by Bruce Lilly.
	* tests/ (check-smtp): New rule.
	(check): Depend on it.
	(clean): Update.

2002-12-12  Bruno Haible  <>

	* src/search.h (Search::init_selchars_tuple,
	Search::count_duplicates_tuple): Add alpha_unify argument.
	(Search::count_duplicates_tuple): New method declaration.
	* src/ (Search::init_selchars_tuple,
	Search::count_duplicates_tuple): Add alpha_unify argument.
	(Search::find_positions): Update.
	(Search::count_duplicates_tuple): New method.
	(Search::count_duplicates_multiset): Free temp alpha_unify vector.
	(Search::find_alpha_inc): Call count_duplicates_tuple.

	* src/ Add test for stack-allocated variable-size arrays.
	* src/ Regenerated.
	* src/ Include config.h.
	(Search::find_alpha_inc, Search::count_possible_collisions,
	Search::find_asso_values): Use them.
	* src/ (search.o): Depend on config.h.

	* src/search.h (Search::keyword_list_length, Search::max_key_length,
	Search::get_max_keysig_size, Search::prepare): Remove declarations.
	(Search::prepare): Renamed from Search::preprepare.
	(Search::_max_selchars_length): New field.
	* src/ (Search::prepare): Renamed from Search::preprepare.
	(Search::prepare_asso_values): Merged with old Search::prepare.
	Initialize _max_selchars_length.
	(Search::keyword_list_length): Remove function. Use _list_len instead.
	(Search::max_key_length): Remove function. Use _max_key_len instead.
	(Search::get_max_keysig_size): Remove function. Use
	_max_selchars_length instead.
	(Search::count_possible_collisions, Search::find_asso_values): Update.
	(Search::find_good_asso_values): Call just prepare_asso_values.
	(Search::~Search): Update.

	* src/output.h (Output::output_asso_values_ref): New declaration.
	* src/ (char_to_index): Remove variable.
	(Output::output_asso_values_ref): New function.
	(Output::output_hash_function): Use it.
	(Output::output): Update.

	* src/positions.h (Positions::is_useall, Positions::set_useall,
	Positions::iterator, Positions::reviterator): New method declarations.
	(Positions::_useall): New field.
	(PositionIterator): Make constructor private. Add a constructor and a
	copy constructor.
	(PositionIterator::remaining): New declaration.
	(PositionReverseIterator): Make constructor private. Add a constructor
	and a copy constructor.
	(PositionReverseIterator::remaining): New declaration.
	(PositionReverseIterator::_minindex): New field.
	* src/positions.icc (Positions::Positions): Initialize _useall.
	(Positions::operator=): Likewise.
	(Positions::is_useall, Positions::set_useall): New methods.
	(Positions::sort): Do nothing if _useall is set.
	(Positions::iterator, Positions::reviterator): New methods.
	(PositionIterator::PositionIterator): New constructor.
	(PositionIterator::remaining): New method.
	(PositionReverseIterator::PositionReverseIterator): New constructor.
	(PositionReverseIterator::next): Use _minindex as bound.
	(PositionReverseIterator::remaining): New method.
	* src/ (Positions::add, Positions::remove): Reset the
	useall flag.
	(Positions::print): Handle the useall case.
	* src/options.h (ALLCHARS): Remove.
	* src/ (Options::~Options): Update.
	(Options::parse_options): Use Positions::set_useall().
	* src/keyword.h (KeywordExt::init_selchars_tuple,
	KeywordExt::init_selchars_multiset, KeywordExt::init_selchars_low):
	Remove use_all_chars argument.
	* src/ (KeywordExt::init_selchars_low): Remove use_all_chars
	argument. Tell the position iterator to stop at _allchars_length.
	Remove special case code for -k'*'.
	(KeywordExt::init_selchars_tuple, KeywordExt::init_selchars_multiset):
	Remove use_all_chars argument.
	* src/search.h (Search::init_selchars_tuple): Remove use_all_chars
	(Search::init_selchars_multiset): Likewise.
	* src/ (Search::init_selchars_tuple): Remove use_all_chars
	(Search::count_duplicates_tuple, Search::find_positions): Update.
	(Search::compute_alpha_unify): Remove special case code for -k'*'.
	(Search::init_selchars_multiset): Remove use_all_chars argument.
	(Search::count_duplicates_multiset): Update.
	(Search::find_alpha_inc): Remove special case code for -k'*'.
	(Search::prepare): Update.
	(Search::get_max_keysig_size): Update.
	* src/ (Output::output_hash_function): Remove special case
	code for -k'*'.
	* tests/chill.exp: Regenerated.

2002-12-11  Bruno Haible  <>

	Change the positions to be 0-based, instead of 1-based.
	* src/positions.h (Positions::LASTCHAR): Set to -1.
	(Positions::MAX_SIZE): New constant.
	(Positions::pointer): Change return type.
	(Positions::_positions): Change element type.
	(PositionIterator::EOS, PositionReverseIterator::EOS): Set to -2.
	* src/positions.icc (Positions::pointer): Change return type.
	(Positions::sort): Update.
	* src/ (Positions::contains, Positions::add,
	Positions::remove): Update.
	(Positions::print): Update. Fix off-by-one bug.
	* src/ (Options::~Options): Update.
	(Options::parse_options): Set BAD_VALUE to -3. Update.
	* src/ (KeywordExt::init_selchars_low): Update.
	* src/ (Search::find_positions, Search::compute_alpha_unify,
	Search::find_alpha_inc): Update.
	* src/ (Output::output_hash_function): Update. Don't emit
	a 'case' statement right after 'default:'.
	* tests/c-parse.exp: Regenerated.
	* tests/charsets.exp: Regenerated.
	* tests/cplusplus.exp: Regenerated.
	* tests/java.exp: Regenerated.
	* tests/languages.exp: Regenerated.
	* tests/modula2.exp: Regenerated.
	* tests/objc.exp: Regenerated.

2002-12-10  Bruno Haible  <>

	* src/options.h: Reorder enum values.
	(Options::short_usage, Options::long_usage): Make static.
	* src/ (Options::short_usage); No longer print a monster
	usage line.
	(Options::print_options): Improve output of options like
	(Options::~Options): Update.

	* src/options.h (UPPERLOWER): New enum value.
	* src/ (Options::long_usage): Document option --ignore-case.
	(Options::~Options): Update.
	(long_options): Add option --ignore-case.
	(Options::parse_options): Handle option --ignore-case.
	* src/ (Input::read_input): Recognize option %ignore-case.
	* src/keyword.h (KeywordExt::init_selchars_tuple,
	KeywordExt::init_selchars_multiset, KeywordExt::init_selchars_low):
	Add alpha_unify argument.
	* src/ (KeywordExt::init_selchars_low): Add alpha_unify
	(KeywordExt::init_selchars_tuple): Add alpha_unify argument.
	(KeywordExt::init_selchars_multiset): Add alpha_unify argument.
	* src/search.h (Search::compute_alpha_size,
	Search::compute_alpha_unify): New declarations.
	(Search::init_selchars_multiset): Add alpha_unify argument.
	(Search::_alpha_unify): New field.
	* src/ (Search::compute_alpha_size,
	Search::compute_alpha_unify): New functions.
	(Search::init_selchars_tuple): Update.
	(Search::find_positions): Temporarily set _alpha_unify. Perform a
	case insensitive comparison if needed.
	(Search::init_selchars_multiset): Add alpha_unify argument.
	(Search::count_duplicates_multiset): Call compute_alpha_unify.
	(Search::find_alpha_inc): Temporarily set _alpha_unify. At the end,
	set _alpha_size and _alpha_unify.
	(Search::prepare): Update. Don't compute _alpga_size here.
	(Search::optimize): Propagate unified asso_values.
	(Search::~Search) Delete _alpha_unify.
	* src/ (output_upperlower_strcmp, output_upperlower_strncmp,
	output_upperlower_memcmp): New functions.
	Output_Compare_Memcmp::output_comparison): Use the case-insensitive
	comparison function if --ignore-case was given.
	(Output::output): Emit the auxiliary case-insensitive comparison
	function if needed.
	* tests/permutc2.gperf, tests/permutc2.exp: New files.
	* tests/ (check-test): Also check permutc2.gperf.
	* tests/test-6.exp: Update.
	* doc/gperf.texi (Gperf Declarations): Document %ignore-case.
	(Input Details): Document option --ignore-case.
	* NEWS: Update.

	* src/ (Search::optimize): Fill unused asso_values[] entries
	with a large value.
	* src/output.h (Output::Output): Remove occurrences argument.
	(Output::_occurrences): Remove field.
	* src/ (Output::Output): Remove occurrences argument.
	(Output::output_hash_function): Ignore _occurrences.
	* src/ (main): Don't pass the _occurrences to Output.

	* src/ (Search::preprepare): Exit if keywords contain
	out-of-range characters.

	* src/ (for): Define so as to avoid errors with old compilers.

	* src/options.h (SHAREDLIB): New enum value.
	* src/ (Options::short_usage): Mention option -P.
	(Options::long_usage): Document option -P.
	(long_options): Add option --pic.
	(Options::parse_options): Handle option -P/--pic.
	* src/ (output_keyword_blank_entries): When SHAREDLIB is
	specified, emit NULL pointers instead of "".
	(Output::output_lookup_function_body): When SHAREDLIB is specified
	and SWITCH and DUP and not specified, test the table entry against
	NULL before the string comparison.
	* tests/test-6.exp: Update.
	* doc/gperf.texi (Output Details): Document option -P.
	* NEWS: Update.
	Suggested by Ulrich Drepper.

2002-12-08  Bruno Haible  <>

	* tests/permut2.gperf, tests/permut2.exp: New files.
	* tests/permut3.gperf, tests/permut3.exp: New files.
	* tests/charsets.gperf: New file, from Bruce Lilly.
	* tests/charsets.exp: New file.
	* tests/languages.gperf: New file, from Bruce Lilly.
	* tests/languages.exp: New file.
	* (check-test): Test them all.

	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::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
	(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::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  <>

	* src/search.h (Search::_alpha_size): Change type to 'unsigned int'.
	(Search::_asso_value_max): Likewise.
	* src/ (Search::prepare_asso_values): Update.
	(Search::init_asso_values): Update.
	(Search::~Search): Update.
	* src/output.h (Output::Output): Change alpha_size type to
	'unsigned int'.
	(Output::_alpha_size): Change type to 'unsigned int'.
	* src/ (Output::Output): Change alpha_size type to
	'unsigned int'.
	(Output::output_hash_function): Update.

2002-12-07  Bruno Haible  <>

	* src/options.h (OPT_CHOICE): New enum value.
	* src/ (Options::~Options): Update.
	(long_options): New option --optimized-collision-resolution.
	(Options::parse_options): Accept option -O.
	* src/search.h (Search::sort_by_occurrence): Change argument to
	'unsigned int'.
	(Search::compute_occurrence, Search::sort_by_occurrence): New method
	* src/ (Search::sort_by_occurrence): Change argument to
	'unsigned int'.
	(Search::compute_occurrence, Search::sort_by_occurrence): New methods.
	(Search::find_asso_values): Implement OPT_CHOICE. More debugging

	* src/ (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
	(Options::_size_multiple): Change type to float.
	* src/options.icc (Options::get_size_multiple): Change return type to
	* src/ (Options::long_usage): Update description of option
	(Options::~Options): Update.
	(Options::parse_options): For option -s, accept a fraction.
	* src/ (Search::prepare_asso_values): Use get_size_multiple
	as it is.
	* tests/test-6.exp: Update.
	* doc/gperf.texi (Algorithmic Details): Update description of option

2002-12-04  Bruno Haible  <>

	Improve debugging output.
	* src/hash-table.h (Hash_Table::dump): New method.
	* src/ (Hash_Table::dump): New method, extracted from
	(Hash_Table::~Hash_Table): No longer print the contents.
	* src/positions.h (PositionReverseIterator): New class.
	* src/positions.icc (PositionReverseIterator::PositionReverseIterator,
	PositionReverseIterator::next): New methods.
	* src/ (Search::find_positions): If debugging, print the
	(Search::find_alpha_inc): If debugging, print the result.
	(Search::prepare): Explicitly dump the hash table's contents here.

	Portability fixes.
	* src/positions.h (Positions::LASTCHAR, Positions::MAX_KEY_POS,
	PositionIterator::EOS): Define as compile-time constants using enum.
	* src/ (Bool_Array::~Bool_Array): Remove const qualifier
	of pointer to be deleted.
	* src/ (Input::~Input): Likewise.
	* src/ (KeywordExt::delete_selchars): Likewise.
	* src/ (main): Likewise.
	* src/ (Hash_Table::~Hash_Table): Limit scope of 'for'
	* src/ (Search::prepare_asso_values): Use a static_cast to
	convert from time_t to long. This is possible because ISO C 99 says
	time_t is a numeric type.

2002-11-20  Bruno Haible  <>

	* src/ (Search::find_asso_values): Avoid gcc warnings about
	uninitialized variables.

	Implement backtracking.
	* src/search.h (Search::has_collisions): Renamed from
	Search::less_collisions. Return a boolean.
	* src/ (Search::has_collisions): Renamed from
	Search::less_collisions. Return a boolean.
	(StackEntry): Remove field _collisions_so_far.
	(Search::find_asso_values): Backtrack when encountering an unresolved
	collision. Assume collisions_so_far is always zero.
	(Search::optimize): Exit if there are accidental duplicates at the end.
	* src/ (Output::num_hash_values): Simply return the list
	(Output::output_keylength_table): Remove handling of accidental
	(Output::output_keyword_table, Output::output_lookup_array): Likewise.
	(output_switch_case, output_switches): Likewise.
	* doc/gperf.texi (Algorithmic Details): Adjust description of options
	-D, -f, -o, -r.
	(Bugs): Remove note about missing backtracking.
	(Projects): Likewise.

2002-11-19  Bruno Haible  <>

	Prepare for backtracking.
	* src/search.h (Search::try_asso_value, Search::change_some_asso_value):
	Remove declarations.
	(Search::less_collisions, Search::collision_prior_to): New declarations.
	(Search::_fewest_collisions, Search::_union_set, Search::_num_done):
	Remove fields.
	* src/ (Search::prepare_asso_values): Don't initialize
	(Search::try_asso_value, Search::change_some_asso_value): Remove
	(Search::less_collisions, Search::collision_prior_to): New methods.
	(StackEntry): New class.
	(Search::find_asso_values): Reorganized to use pseudo-recursion.
	(Search::~Search): Don't free _union_set.

	* src/search.h (Search::find_good_asso_values): New declaration.
	* src/ Add comments about the basic structure of the
	(Search::find_positions): Move the option[POSITIONS] test to here.
	(Search::find_good_asso_values): New method, extracted from
	(Search::optimize): Remove option[POSITIONS] test. Call

2002-11-17  Bruno Haible  <>

	* src/ (Options::parse_options): Include copyright notice
	and authors in --version output.

	Avoid artificial duplicates.
	* src/keyword.h (KeywordExt::init_selchars_tuple): New declaration.
	(KeywordExt::init_selchars_multiset): Renamed from
	(KeywordExt::init_selchars_low): New declaration.
	* src/ (KeywordExt::init_selchars_low): Renamed from
	KeywordExt::init_selchars. Add alpha_inc argument. Remove sorting.
	(KeywordExt::init_selchars_tuple): New method.
	(KeywordExt::init_selchars_multiset): New method, replaces
	* src/search.h (Search::init_selchars_tuple): Renamed from
	(Search::count_duplicates_tuple): Renamed from Search::count_duplicates.
	(Search::init_selchars_multiset, Search::count_duplicates_multiset,
	Search::find_alpha_inc): New declarations.
	(Search::_alpha_inc): New field.
	(Search::_alpha_size, Search::_occurrences, Search::_asso_values,
	Search::_determined): Make non-const.
	* src/ (Search::Search): Don't initialize _key_positions,
	_alpha_size, _occurrences, _asso_values, _determined here.
	(Search::init_selchars_tuple): Renamed from Search::init_selchars.
	(Search::count_duplicates_tuple): Renamed from Search::count_duplicates.
	(Search::find_positions): Update.
	(Search::init_selchars_multiset, Search::count_duplicates_multiset,
	Search::find_alpha_inc): New methods.
	(Search::prepare): Move preprepare, find_positions calls away.
	Initialize _alpha_size, _occurrences, _asso_values, _determined here.
	(Search::optimize): Call preprepare, find_positions here. Initialize
	_key_positions here.
	(Search::~Search): Deallocate _alpha_inc.
	* src/ (Output::Output): Add alpha_inc argument.
	(Output::output_hash_function): Use _alpha_inc.
	* src/output.h (Output::Output): Add alpha_inc argument.
	(Output::_alpha_inc): New field.
	* src/ (main): Pass _alpha_inc from Search to Output.
	* tests/chill.exp: Update.
	* doc/gperf.texi (Algorithmic Details): Remove description of
	artificial duplicates.

	* src/keyword.h (KeywordExt::_selchars): Change type to
	'const unsigned int *'.
	* src/ (sort_char_set): Change argument type to
	'unsigned int *'.
	(KeywordExt::init_selchars): Update.
	* src/search.h (Search::sort_by_occurrence): Change argument type to
	'unsigned int *'.
	(Search::try_asso_value): Change argument type to 'unsigned int'.
	(Search::_union_set): Change type to 'unsigned int *'.
	* src/ (Search::prepare, Search::compute_occurrence,
	Search::set_determined, Search::already_determined,
	Search::prepare_asso_values, Search::compute_hash): Update.
	(compute_disjoint_union): Change argument types to 'unsigned int *'.
	(Search::sort_by_occurrence): Likewise.
	(Search::try_asso_value): Change argument type to 'unsigned int'.
	(Search::change_some_asso_value, Search::~Search): Update.
	* src/ (Hash_Table::~Hash_Table, Hash_Table::equal,
	Hash_Table::insert): Update.

	* src/positions.h: New file, extracted from options.h.
	* src/positions.icc: New file, extracted from options.icc.
	* src/ New file, extracted from
	* src/options.h: Include positions.h. Move classes Positions and
	PositionsIterator away.
	* src/options.icc: Move classes Positions and PositionsIterator away.
	* src/ Move class Positions away.
	* src/ Include positions.h instead of options.h.
	* src/output.h: Include positions.h instead of options.h.
	* src/search.h: Include positions.h instead of options.h.
	* src/ (OBJECTS): Add positions.o.
	(POSITIONS_H): New variable.
	(OPTIONS_H, SEARCH_H, OUTPUT_H, keyword.o): Use it.
	(positions.o): New rule.

	* src/options.h (POSITIONS): New enum value.
	(Positions::Positions): New copy constructor.
	(Positions::operator=, Positions::contains, Position::add,
	Positions::remove, Positions::print): New method declaration.
	(Options::get_max_keysig_size): Remove method.
	* src/options.icc (Positions::Positions): New copy constructor.
	(Positions::operator=): New method.
	(Options::get_max_keysig_size): Remove method.
	* src/ (Options::Options): Initialize _key_positions
	(Options::parse_options): Option -k sets POSITIONS.
	(Positions::contains, Positions::add, Positions::remove,
	Positions::print): New methods.
	* src/ (Hash_Table::~Hash_Table): Compute the field
	width explicitly, instead of using Options::get_max_keysig_size.
	* src/keyword.h (KeywordExt::init_selchars): Add arguments
	use_all_chars, positions.
	(KeywordExt::delete_selchars): New declaration.
	* src/ (KeywordExt::init_selchars): Add arguments
	use_all_chars, positions. Remove error message if there are no key
	(KeywordExt::delete_selchars): New method.
	* src/search.h: Include options.h.
	(Search::preprepare, Search::init_selchars, Search::delete_selchars,
	Search::count_duplicates, Search::find_positions): New declarations.
	(Search::_key_positions): New field.
	* src/ (Search::Search): Initialize _key_positions.
	(Search::preprepare, Search::init_selchars, Search::delete_selchars,
	Search::count_duplicates, Search::find_positions): New functions.
	(Search::prepare): Call preprepare and find_positions. Tweak error
	(Search::get_max_keysig_size): Use _key_positions instead of
	(Search::optimize): Tweak error message.
	* src/output.h: Include options.h.
	(Output::Output): Add Positions argument.
	(Output::_key_positions): New field.
	* src/ (Output::Output): Add Positions argument.
	(Output::output_hash_function): Omit the table if there are no
	positions at all. Use _key_positions instead of
	(Output::output): Output the computed positions as a comment.
	* src/ (main): Pass the Positions from Searcher to Output.
	* src/ (SEARCH_H, OUTPUT_H): Include OPTIONS_H.
	* tests/ (check-test): Pass key positions explicitly.
	* tests/gpc.exp: Update.
	* tests/test-4.exp: Update.
	* doc/gperf.texi (Algorithmic Details): Mention that -k is not needed

2002-11-16  Bruno Haible  <>

	* src/options.h (Options::get_slot_name): Renamed from
	(Options::set, Options::set_language, Options::set_total_switches,
	Options::set_function_name, Options::set_slot_name,
	Options::set_class_name, Options::set_hash_name,
	Options::set_wordlist_name, Options::set_delimiters): New method
	(Options::_language): New field.
	(Options::_slot_name): Renamed from Options::_key_name.
	* src/options.icc (Options::set): New method.
	(Options::get_slot_name): Renamed from Options::get_key_name.
	(Options::Options): Initialize _language. Update.
	(Options::~Options): Update.
	(Options::set_language, Options::set_total_switches,
	Options::set_function_name, Options::set_slot_name,
	Options::set_class_name, Options::set_hash_name,
	Options::set_wordlist_name, Options::set_delimiters): New methods.
	(Options::parse_options): Call set_language. Update.
	* src/ (is_declaration, is_declaration_with_arg,
	is_define_declaration): New functions.
	(Input::read_input): Accept %DECL declarations.
	* src/ (Output::output_lookup_function_body): Update.
	* doc/gperf.texi (Declarations): Add new subnodes.
	(User-supplied Struct, Gperf Declarations, C Code Inclusion): New
	(Keywords, Output Format, Binary Strings, Options): Mention %
	declarations as being equivalent to the command line options.

	* src/ (Options::long_usage): Rename options -H, -N, -l, -G.
	(long_options): Add --hash-function-name, --lookup-function-name,
	* doc/gperf.texi (Output Details): Rename options -H, -N, -l, -G.
	* tests/test-6.exp: Update.

	* src/ (DEFAULT_DELIMITERS): Remove newline.
	* src/ (Options::long_usage): Change default --delimiters.
	* doc/gperf.texi (Input Details): Likewise.
	* tests/test-6.exp: Update.

	* doc/gperf.texi: Move description of option -l from section
	Algorithmic Details to section Output Details.
	* src/ (Options::long_usage): Likewise.
	* tests/test-6.exp: Update.

2002-11-12  Bruno Haible  <>

	* src/options.h (Output::get_output_file_name): New method.
	(Output::_output_file_name): New field.
	* src/options.icc (Options::get_output_file_name): New method.
	* src/ (Options::long_usage): Document option --output-file.
	(Options::Options): Initialize _output_file_name.
	(long_options): Add --output-file.
	(Options::parse_options): Handle it.
	* src/ (main): Open the output file if given by name.
	* doc/gperf.texi (Output File): New section.
	* tests/test-6.exp: Update.

2002-11-10  Bruno Haible  <>

	* src/ (pretty_input_file_name): New function.
	(read_input): Use it in all error and warning messages.

	* src/keyword.h (Keyword::_lineno): New field.
	* src/input.h (Input::_struct_decl_lineno): New field.
	* src/ (Input::read_input): Set _struct_decl_lineno. Fill
	each keyword's _lineno field.
	* src/ (main): Pass _struct_decl_lineno from Input to Output.
	* src/output.h (Output::Output) Add struct_decl_lineno argument.
	(Output::_struct_decl_lineno): New field.
	* src/ (Output::Output) Add struct_decl_lineno argument.
	(output_keyword_entry): Emit #line directive before table entry.
	(Output::output): Emit #line directive before _struct_decl.

	Fix memory leaks.
	* src/keyword.h (empty_string): New declaration.
	* src/ (empty_string): New variable.
	* src/input.h (Input::_input): Make public.
	(Input::_input_end): New field.
	* src/ (read_input): When removing leading whitespace from
	struct_decl, reallocate it. For rest, use empty_string instead of "".
	Set _input_end.
	(Input::~Input): Delete _struct_decl, _struct_tag, _return_type.
	* src/ (Search::prepare): When removing an element from
	the keyword list, delete the list node.
	(Search::~Search): Delete _occurrences, _asso_values.
	* src/ (main): Between Search::~Search and Input::~Input,
	destroy the keyword list.

	Rewrite the input routines.
	* src/input.h: Don't include read-line.h.
	(Input): Don't inherit from class Read_Line.
	(Input::read_keys, Input::strcspn, Input::set_output_types,
	Input::get_array_type, Input::save_include_src,
	Input::get_special_input): Remove declarations.
	(Input::read_input): New declaration.
	(Input::_struct_decl): Renamed from Input::_array_type.
	(Input::_verbatim_declarations): Renamed from Input::_include_src.
	(Input::_verbatim_code): Replaces Input::_additional_code.
	* src/ Completely rewritten.
	* src/output.h (Output::Output): Update the verbatim_* arguments.
	(Output::_struct_decl): Renamed from Output::_array_type.
	(Output::_verbatim_declarations): Renamed from Output::_include_src.
	(Output::_verbatim_code): Replaces Output::_additional_code.
	* src/ (Output::Output): Update the verbatim_* arguments.
	(Output::output): Output the verbatim_* code pieces with #line.
	* src/ (main): Call Input::read_input instead of
	Input::read_keys. Update Output::Output arguments.
	* src/read-line.h: Remove file.
	* src/, src/read-line.icc: Remove files.
	* src/ (OBJECTS): Remove read-line.o.
	(READ_LINE_H): Remove variable.
	(INPUT_H): Update.
	(read-line.o): Remove rule.
	* doc/gperf.texi (Declarations): Correct the example.
	(Keywords): Mention that lines starting with % are forbidden here.
	* tests/c-parse.exp: Update.
	* tests/cplusplus.exp: Update.
	* tests/gpc.exp: Update.
	* tests/java.exp: Update.
	* tests/objc.exp: Update.
	* tests/test-4.exp: Update.

	* src/options.h (Options::get_input_file_name): New declaration.
	(Options::_input_file_name): New field.
	* src/options.icc (Options::get_input_file_name): New method.
	* src/ (Options::Options): Initialize _input_file_name.
	(Options::parse_options): Don't open input file, only store it in
	* src/ (main): Open input file here.
	Print an error message upon write error on the output file.

	Upgrade to autoconf-2.52.
	* Makefile.devel (configure, lib/configure, src/configure,
	tests/configure, doc/configure): Use autoconf-2.52.

2002-11-09  Bruno Haible  <>

	* doc/gperf.texi: Talk about "bytes" instead of "characters". Talk
	about "keywords", not "keys". Talk about "input file", not "keyfile".
	(@menu): Fix a menu entry.
	(Contributors): Don't mention cperf.
	(Motivation): Fix an off-by-one error in the definition of "minimal".
	Mention GNU Java. Recommend http URL instead of anonymous ftp.
	(Search Structures): Mention GNU Java.
	(Output Format): Drop reference to node 'Implementation'.
	(Output Details): Talk about "slot-name" instead of "key name".
	(Algorithmic Details): Talk about "selected byte positons", not
	"key positions". Upper limit is now 255. Explain a third reason
	why duplicates can occur. Describe negative effects of
	(Implementation): Remove chapter.

2002-11-07  Bruno Haible  <>

	* src/ (Bool_Array::~Bool_Array): Free _storage_array.
	* src/ (Search::~Search): Free _union_set, _determined.

	* tests/ (check-test): Don't redirect stderr.

2002-11-05  Bruno Haible  <>

	* src/keyword-list.h (mergesort_list): New declarations.
	* src/ (Keyword_Comparison): New type.
	(merge, mergesort_list): New functions, moved here from
	* src/search.h (Search::merge, Search::merge_sort): Remove methods.
	(Search::_occurrence_sort, Search::_hash_sort): Remove fields.
	* src/ (Search::merge, Search::merge_sort): Remove methods.
	(greater_by_occurrence, less_by_hash_value): New functions.
	(Search::reorder, Search::sort): Use mergesort_list.

2002-11-04  Bruno Haible  <>

	* src/options.h (Options::_asso_iterations): New field.
	(Options::get_asso_iterations): New method declaration.
	* src/options.icc (Options::get_asso_iterations): New method.
	* src/ (Options::short_usage): Mention j<jump> and m<num>.
	(Options::long_usage): Document option -m.
	(Options::Options): Initialize _asso_iterations.
	(Options::~Options): Print _asso_iterations too.
	(long_options): Add --multiple-iterations.
	(Options::parse_options): Handle option -m.
	* src/keyword-list.h (copy_list, delete_list): New declarations.
	* src/ (copy_list, delete_list): New functions.
	* src/search.h (Search::_initial_asso_value, Search::_jump): New fields.
	* src/ (Search::prepare_asso_values): Initialize
	_initial_asso_value and _jump here.
	(Search::init_asso_values): Use _initial_asso_value.
	(Search::try_asso_value): Use _jump.
	(Search::optimize): If option -m was given, iterate over different
	values for _initial_asso_value and _jump.
	* doc/gperf.texi (Algorithmic Details): Document option -m.
	* tests/test-6.exp: Update.

2002-11-03  Bruno Haible  <>

	Bug fix: When option -j 0 was used without option -r, the output was
	not random.
	* src/search.h (Search::prepare_asso_values): New method declaration.
	* src/ (Search::prepare_asso_values): New method, extracted
	from Search::init_asso_values. Call srand also when "-j 0" was given.
	(Search::optimize): Call prepare_asso_values().

	* src/hash-table.h (Hash_Table::_ignore_length, Hash_Table::equal):
	Declare as const.
	* src/ (Hash_Table::equal): Declare as const.
	* src/input.h (Input::_factory): Declare as const.
	* src/keyword-list.h (Keyword_List::first, KeywordExt_List::first):
	Declare as const.
	* src/keyword-list.icc (Keyword_List::first, KeywordExt_List::first):
	Declare as const.
	* src/output.h (Output::num_hash_values, Output::output_constants,
	Output::output_hash_function, Output::output_keylength_table,
	Output::output_keyword_table, Output::output_lookup_array,
	Output::output_lookup_tables, Output::output_lookup_function_body,
	Output::output_lookup_function, Output::_array_type,
	Output::_additional_code, Output::_include_src, Output::_total_keys,
	Output::_total_duplicates, Output::_max_key_len, Output::_min_key_len):
	Declare as const.
	* src/ (Output::num_hash_values, Output::output_constants,
	Output::output_hash_function, Output::output_keylength_table,
	Output::output_keyword_table, Output::output_lookup_array,
	Output::output_lookup_tables, Output::output_lookup_function_body,
	Output::output_lookup_function): Declare as const.
	* src/search.h (Search::merge, Search::merge_sort,
	Search::compute_occurrence, Search::already_determined,
	Search::keyword_list_length, Search::max_key_length,
	Search::get_max_keysig_size, Search::compute_hash,
	Search::sort_by_occurrence): Declare as const.
	* src/ (Search::merge, Search::merge_sort,
	Search::compute_occurrence, Search::already_determined,
	Search::keyword_list_length, Search::max_key_length,
	Search::get_max_keysig_size, Search::compute_hash,
	Search::sort_by_occurrence): Declare as const.

	* src/ (Output::output): Set char_to_index to a cast in all
	cases. Avoids gcc warnings on the generated code.

	* src/ (Output_Enum): Prepend an underscore to field names.
	(Output_Expr1): Likewise.
	(Output::output_hash_function): Simplify the special case for "-k 1,$".

	* src/search.h (Search::init_asso_values, Search::find_asso_values):
	New declarations.
	(Search::try_asso_value): Renamed from Search::affects_prev.
	(Search::change_some_asso_value): Renamed from Search::change.
	(Search::set_asso_max, Search::get_asso_max): Remove methods.
	(Search::_union_set): New field.
	* src/ (Search::init_asso_values): New method, extracted
	from Search::optimize.
	(Search::try_asso_value): Renamed from Search::affects_prev. Take the
	iteration count as argument.
	(Search::change_some_asso_value): Renamed from Search::change. Don't
	make union_set static. Don't increment _fewest_collisions here.
	(Search::find_asso_values): New method, extracted from
	(Search::optimize); Update.

	* src/search.h (Search::compute_hash): Renamed from Search::hash.
	(Search::compute_disjoint_union): Remove declaration.
	(Search::sort_by_occurrence): Renamed from Search::sort_set.
	* src/ (Search::compute_hash): Renamed from Search::hash.
	(compute_disjoint_union): Renamed from Search::compute_disjoint_union.
	(Search::sort_by_occurrence): Renamed from Search::sort_set.
	(Search::change): Simplify loop.

	* src/search.h (Search::clear_determined): New declaration.
	* src/ (Search::clear_determined): New method.
	(Search::already_determined): Optimize.
	(Search::reorder): Even when the next keyword after the current one
	is completely determined, move all determined keywords after the
	current one.

	Compute the occurrences after removal of duplicates, not before.
	* src/keyword.h (KeywordExt::init_selchars): Remove occurrences
	* src/ (KeywordExt::init_selchars): Likewise.
	* src/ (Search::prepare): Reorder the code. Compute the
	occurrences after removal of duplicates.
	(Search::merge_sort): Optimize the loop.
	(Search::compute_occurrence): Renamed from Search::get_occurrence.
	* src/search.h (Search::compute_occurrence): Renamed from
	* tests/chill.exp: Regenerated.

	Bug fix: The hash table could fail to detect duplicates, between
	keywords of different length, when option -n (option[NOLENGTH]) was
	* src/hash-table.h (Hash_Table::Hash_Table): Pass table size, not
	vector and vector size as arguments.
	(Hash_Table::_log_size): New field.
	(Hash_Table::equal): New declaration.
	* src/ (size_factor): New variable.
	(Hash_Table::Hash_Table): Pass table size, not vector and vector size
	as arguments. Allocate the vector here.
	(Hash_Table::~Hash_Table): Deallocate the vector here.
	(Hash_Table::equal): New function.
	(Hash_Table::insert): Use it. Don't use item->_allchars_length for the
	increment if _ignore_length is true.
	* src/ (TABLE_MULTIPLE): Remove variable.
	(Search::prepare): Update.

2002-11-02  Bruno Haible  <>

	Provide documentation also in PDF format.
	* doc/ (pdfdir, TEXI2PDF): New variables.
	(all): Depend on pdf.
	(pdf, gperf.pdf): New rules.
	(maintainer-clean): Remove the PDF file.

	* src/keyword-list.icc: New file, extracted from keyword-list.h.
	* src/keyword-list.h: Include keyword-list.icc. Move inline methods
	to there.
	* src/ Include keyword-list.icc.
	* src/ (KEYWORD_LIST_H): Add keyword-list.icc.

	* lib/hashpjw.h (hashpjw): Change argument type to 'unsigned char *'.
	* lib/ (hashpjw): Likewise.
	* src/keyword.icc: New file.
	* src/keyword.h: Include keyword.icc.
	(KeywordExt::_selchars): Change type to 'unsigned char *'.
	* src/ Include keyword.icc.
	(Keyword::Keyword, KeywordExt::KeywordExt): Move to keyword.icc.
	(sort_char_set): Change argument type to 'unsigned char *'.
	(KeywordExt::init_selchars): Update.
	* src/search.h (Search::compute_disjoint_union): Change argument types
	to 'unsigned char *'.
	(Search::sort_set): Likewise.
	(Search::affects_prev): Change argument type to 'unsigned char'.
	* src/ (Search::prepare): Initialize _duplicate_link here.
	(Search::get_occurrence, Search::set_determined,
	Search::already_determined, Search::hash): Update.
	(Search::compute_disjoint_union): Change argument types to
	'unsigned char *'.
	(Search::sort_set): Likewise.
	(Search::affects_prev): Change argument type to 'unsigned char'.
	(Search::change): Update.
	* src/ (KEYWORD_H): Add keyword.icc.

	* src/ (Options::parse_options): Fix error message.

	* src/read-line.h (Read_Line::Read_Line): Make FILE* argument
	mandatory. Move body to read-line.icc.
	* src/read-line.icc (Read_Line::Read_Line): New constructor.
	* src/input.h (Input::Input): Add FILE* argument.
	* src/ (Input::Input): Likewise.
	* src/ (main): Pass stdin to Input constructor.

	* src/options.h (DEFAULTCHARS): Remove.
	(Positions::MAX_KEY_POS): Set to 255.
	(Positions::_positions): Increase array size.
	(PositionIterator::EOS): Set to -1.
	(PositionIterator::_index): Change type to 'unsigned int'.
	* src/options.icc (Positions::Positions): Don't store
	(PositionIterator::next): Produce PositionIterator::EOS here.
	* src/ (Options::long_usage): Use MAX_KEY_POS, not
	(PositionStringParser): Rename field _size to _in_range. Rename
	field _curr_value to _range_curr_value. Rename field _upper_bound
	to _range_upper_bound.
	(PositionStringParser::nextPosition): Comments.
	(Options::Options): Update.
	(Options::~Options): Update.
	(long_options): Use NULL, not 0.
	(Options::parse_options): Set BAD_VALUE to -2; -1 is now EOS. Bug fix:
	Check against array overflow when more than MAX_KEY_POS positions are
	given. Don't store PositionIterator::EOS.
	Check against extra arguments before opening the input file.
	* src/ (Output::output_hash_function): Change test which
	was for option[DEFAULTCHARS].
	* tests/test-6.exp: Update.

	* src/options.h (Options::get_delimiters): Renamed from
	* src/options.icc (Options::get_delimiters): Renamed from
	* src/ (Input::read_keys): Update.

	Bug fix.
	* src/ (Options::print_options): Escape backquote inside
	double-quoted strings.

	Bug fix.
	* src/ (KeywordExt::init_selchars): Avoid comparison with
	uninitialized member variable. Found with 'valgrind'.

	* src/ Include version.h.
	* src/ (OBJECTS): Reorder.
	(HASH_TABLE_H): Update.
	(options.o, read-line.o, keyword.o, keyword-list.o, input.o, search.o,
	output.o, main.o): Update dependencies.

	* src/vectors.h: Remove file.
	* src/ Remove file.
	* src/search.h: Don't include vectors.h.
	(Search): Don't inherit from Vectors. New fields _alpha_size,
	_occurrences, _asso_values.
	(Search::_determined, Search::get_occurrence, Search::set_determined,
	Search::already_determined, Search::hash, Search::sort_set): Make
	* src/ (Search::Search): Initialize _alpha_size, _occurrences,
	_asso_values, _determined.
	(Search::optimize, Search::~Search): Update.
	* src/output.h: Don't include vectors.h.
	(Output): Remove field _v. New fields _alpha_size, _occurrences,
	(Output::Output): Replace Vectors* argument with alpha_size,
	occurrences, asso_values.
	* src/ (Output::Output): Replace Vectors* argument with
	alpha_size, occurrences, asso_values.
	(Output::output_hash_function): Update.
	* src/ (main): Don't set Vectors::ALPHA_SIZE.
	Pass _alpha_size, _occurrences, _asso_values from Search to Output.
	* src/keyword.h: Don't include vectors.h.
	* src/ (OBJECTS): Remove vectors.o.
	(VECTORS_H): Remove variable.
	(vectors.o): Remove rule.

	* src/search.h: New file, combines src/key-list.h, src/gen-perf.h.
	* src/search,cc: New file, combines src/, src/
	* src/key-list.h: Remove file.
	* src/ Remove file.
	* src/gen-perf.h: Remove file.
	* src/ Remove file.
	* src/ (KeywordExt_Factory): Moved here from
	(main): Inline some code from
	* src/keyword.h (KeywordExt::init_selchars): Take the occurrences
	vector as argument.
	* src/ (KeywordExt::init_selchars): Take the occurrences
	vector as argument.
	* src/ (Input::set_output_types): Initialize _array_type,
	_return_type, _struct_tag.
	(Input::read_keys): Initialize _additional_code.
	* src/ (OBJECTS): Add search.o.
	Remove key-list.o, gen-perf.o.
	(KEY_LIST_H, GEN_PERF_H): Remove variables.
	(gen-perf.o, key-list.o): Remove rules.
	(search.o): New rule.

	* *, */*: Update copyright notice to GPL version 2.

	* src/keyword-list.h (Keyword_List): New class.
	(KeywordExt_List): Inherit from it.
	* src/ (Keyword_List::Keyword_List): New constructor.
	(KeywordExt_List::KeywordExt_List): Update.
	* src/input.h (Input::Input): Add Keyword_Factory argument.
	(Input::_factory): New field.
	(Input::_head): Change type to Keyword_List*.
	(Input::parse_line): New declaration.
	* src/ (Input::Input): New constructor.
	(Input::parse_line): Renamed from parse_line. Use the _factory.
	(Input::read_keys): Update.
	* src/ (KeywordExt_Factory): New class.
	(Key_List::read_keys): Pass a KeywordExt_Factory as Input constructor

	Avoid g++ -Wold-style-cast warnings.
	* src/bool-array.icc: Use new-style casts.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise. Remove (char *) cast in memset argument.

	* src/keyword-list.h (KeywordExt_List): Don't inherit from KeywordExt.
	(KeywordExt_List::KeywordExt_List): Take a KeywordExt* as argument.
	(KeywordExt_List::_car): New field.
	(KeywordExt_List::first): Use it.
	* src/ (KeywordExt_List::KeywordExt_List): Take a
	KeywordExt* as argument.
	* src/ (parse_line): Create the KeywordExt separately.

	Start using bool.
	* src/bool-array.h (Bool_Array::set_bit): Change return type to bool.
	* src/bool-array.icc (Bool_Array::set_bit): Likewise.
	* src/gen-perf.h (Gen_Perf::affects_prev): Likewise.
	* src/ (Gen_Perf::affects_prev): Likewise.
	* src/hash-table.h (Hash_Table::_ignore_length): Change type to bool.
	(Hash_Table::Hash_Table): Change 3rd argument type to bool.
	* src/ (Hash_Table::Hash_Table): Likewise.
	* src/input.h (Input::_additional_code): Change type to bool.
	* src/ (Input::read_keys): Update.
	* src/key-list.h (Key_List::_occurrence_sort, Key_List::_hash_sort,
	Key_List::_additional_code): Change type to bool.
	(Key_List::_determined): Change element type to bool.
	(Key_List::already_determined): Change return type to bool.
	* src/ (Key_List::_determined): Change element type to bool.
	(Key_List::set_determined): Update.
	(Key_List::already_determined): Change return type to bool.
	(Key_List::reorder, Key_List::sort, Key_List::Key_List): Update.
	* src/options.h (Positions::sort): Change return type to bool.
	(Options::operator[]): Likewise.
	* src/options.icc (Positions::sort): Change return type to bool.
	(Options::operator[]): Likewise.
	* src/output.h (Output::Output): Change 5th argument type to bool.
	(Output::_additional_code): Change type to bool.
	* src/ (Output::Output): Change 5th argument type to bool.

2002-10-16  Bruno Haible  <>

	* src/*.h: Align all member names at column 24.

2002-10-15  Bruno Haible  <>

	* src/input.h: New file.
	* src/ New file, extracted from
	* src/key-list.h (Key_List): Don't inherit from Read_Line.
	Key_List::save_include_src, Key_List::get_array_type,
	Key_List::strcspn, Key_List::set_output_types): Remove methods.
	* src/ (Key_List::get_special_input,
	Key_List::save_include_src, Key_List::get_array_type,
	Key_List::strcspn, Key_List::set_output_types, parse_line): Move to
	(Key_List::read_keys): Use Input::read_keys.
	(Key_List::Key_List): Update.
	* src/ Update.
	* src/ (OBJECTS): Add input.o.
	(input.o): New rule.

2002-10-14  Bruno Haible  <>

	* src/ Don't include "vector.h".
	(Options::parse_options): Don't initialize Vectors::ALPHA_SIZE here.
	* src/ (Vectors::ALPHA_SIZE): Don't initialize here.
	* src/ (Gen_Perf::Gen_Perf): Initialize Vectors::ALPHA_SIZE.

	* src/options.h (Positions): New class.
	(PositionIterator): New class.
	(Options::parse_options): Renamed from Options::operator().
	(Options::get_asso_max, Options::set_asso_max): Move to class Key_List.
	(Options::reset, Options::get): Remove, replaced by class
	(Options::get_initial_asso_value): Renamed from Options::initial_value.
	(Options::key_sort): Remove, replaced by Positions::sort.
	(Options): Make all fields and methods non-static.
	* src/options.icc (Positions::Positions, Positions::operator[],
	Positions::get_size, Positions::pointer, Positions::set_size,
	Positions::sort, PositionIterator::PositionIterator,
	PositionIterator::next): New methods.
	(Options::get_initial_asso_value): Renamed from Options::initial_value.
	(Options::get_size_multiple): New method.
	(Options::get_key_positions): New method.
	(Options::get_max_keysig_size): Implement using _key_positions.
	* src/ (Options::long_usage): Split big string into small
	(PositionStringParser): Prefix field names with _.
	(Options::Options): Update.
	(Options::~Options): Fix explanation of of _size_multiple. Don't print
	_key_positions if it is effectively ignored.
	(Options::parse_options): Renamed from Options::operator(). Update.
	* src/key-list.h (Key_List): New field _size. New methods get_asso_max,
	set_asso_max, get_max_keysig_size.
	* src/ (Key_List::read_keys): Don't make side effects on
	(Key_List::dump): Use Key_List::get_max_keysig_size() instead of
	(Key_List::get_max_keysig_size): New function.
	* src/ (Hash_Table::~Hash_Table): Compute the field
	width on the fly if option[ALLCHARS].
	* src/ (Gen_Perf::Gen_Perf): Update,
	Use Options::get_size_multiple() instead of Options::get_asso_max().
	Use Key_List::get_asso_max() instead of Options::get_asso_max(). Use
	Key_List::get_max_keysig_size() instead of
	(Gen_Perf::affects_prev): Likewise.
	(Gen_Perf::change): Likewise.
	* src/ Update.
	* src/ Update.
	* src/ Update.
	* tests/test-6.exp: Update.

2002-10-13  Bruno Haible  <>

	* src/bool-array.*: Some polishing.

	* src/options.h (Options::operator=, Options::operator!=): Remove
	unused methods.
	* src/options.icc (Options::operator=, Options::operator!=): Remove.

	* src/*.h: Prefix all field names with _.
	* src/*.cc, src/*.icc: Update.

	* src/*: Simplify declarations of functions without arguments.

2002-10-04  Bruno Haible  <>

	* src/output.h: New file, extracted from key-list.h.
	* src/ New file, extracted from
	* src/key-list.h (Key_List): Make some fields protected. Move output
	routines to src/output.h.
	* src/ Move output routines to src/
	* src/ (Gen_Perf::doit_all): Use class Output.
	* src/ (OBJECTS): Add output.o.
	(output.o): New rule.

2002-10-03  Bruno Haible  <>

	* src/iterator.h: Remove file.
	* src/ Remove file.
	* src/ (PositionStringParser): New class, taken from old
	* src/ (OBJECTS): Remove iterator.o.
	(ITERATOR_H): Remove variable.
	(iterator.o): Remove rule.

	* src/keyword-list.h: New file.
	* src/ New file.
	* src/list-node.h: Remove file.
	* src/ Remove file.
	* src/keyword.h (KeywordExt::init_selchars): New declaration.
	* src/ (sort_char_set, KeywordExt::init_selchars): New, from
	* src/ Replace List_Node by KeywordExt or KeywordExt_List,
	as appropriate.
	* src/hash-table.h: Likewise.
	* src/key-list.h: Likewise.
	* src/ Likewise.
	* src/ (OBJECTS): Remove list-node.o, add keyword-list.o.
	(LIST_NODE_H): Remove macro.
	(list-node.o): Remove rule.
	(keyword-list.o): New rule.

	* src/keyword.h (KeywordExt): New class.
	* src/ (KeywordExt): New constructor.
	* src/list-node.h (List_Node): Inherit from KeywordExt.
	* src/ Update.
	* src/ Update.
	* src/ Update.
	* src/ Update.
	(output_keyword_entry): Change argument type to KeywordExt*.

	* src/keyword.h: New file.
	* src/ New file.
	* src/list-node.h (List_Node): Extend Keyword.
	* src/ Update.
	* src/ Update.
	* src/ Update.
	* src/ Update.
	* src/ (OBJECTS): Add keyword.o.
	(keyword.o): New rule.

	* src/ (Key_List::read_keys): Allocate the memory for the
	hash table using 'new'.
	(Key_List::output_lookup_array): Allocate the memory for the duplicates
	array using 'new'.
	* src/options.h (LARGE_STACK_ARRAYS): Remove definition.
	* src/ (main): Remove setrlimit call.
	* src/ Don't test for unistd.h, sys/time.h,
	sys/resource.h, getrlimit, setrlimit.

	* src/bool-array.h (Bool_Array): Make all members non-static.
	Add an argument to the constructor. Remove init(), rename reset() to
	clear(), rename find() to set_bit().
	* src/bool-array.icc: Move init() code into the constructor.
	Rename reset() to clear(), rename find() to set_bit().
	* src/gen-perf.h (Gen_Perf): Add collision_detector member.
	* src/ Update.

	* src/gen-perf.h (Gen_Perf::doit_all): Renamed from
	Gen_Perf::operator ().
	* src/ (Gen_Perf::doit_all): Renamed from
	Gen_Perf::operator ().
	* src/ Update.

	* src/read-line.h (Read_Line::read_next_line): Renamed from
	* src/read-line.icc: Likewise.
	* src/ Update.
	* src/ Update.

	* lib/getline.h: New file.
	* lib/ New file.
	* lib/ (OBJECTS): Add getline.o.
	(getline.o): New rule.
	* src/read-line.h (Read_Line::readln_aux): Remove declaration.
	* src/ (Read_Line::readln_aux): Remove function.
	* src/read-line.icc (Read_Line::get_line): Use ::get_line.
	* src/options.h (LARGE_STACK): Remove macro.

	* src/bool-array.h (STORAGE_TYPE): Remove type.
	Use 'unsigned int' instead of STORAGE_TYPE.
	* src/ Likewise.
	* src/bool-array.icc: Likewise.
	* src/ Likewise.

	* src/ Remove file.
	* src/ (OBJECTS): Remove new.o.
	(new.o): Remove rule.
	* src/ Remove test for HAVE_THROW_DECL.
	* acconfig.h: Remove file.

	* src/trace.h: Remove file.
	* src/ Remove file.
	* src/ (OBJECTS): Remove trace.o.
	(TRACE_H): Remove variable.
	(trace.o): Remove rule.
	Update all dependencies.
	* src/bool-array.h, src/, src/bool-array.icc: Don't use T.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/ Likewise.
	* src/options.h, src/, src/options.icc: Likewise.
	* src/read-line.h, src/, src/read-line.icc: Likewise.

	* tests/ Use gperf option -I, to avoid gcc-3.x warnings.
	* tests/test.c: Don't use gets(), to avoid warnings.

2001-08-02  Bruno Haible  <>

	* doc/gperf.texi: Change bug report address to <>.
	* README: Updated.

2000-12-18  Bruno Haible  <>

        * src/ Add check for rand() in libm. Needed for BeOS.
        * src/ (LIBS): Use @GPERF_LIBM@ instead of hardwiring -lm.

2000-11-20  Bruno Haible  <>

        * doc/help2man: Update to version 1.23.

2000-09-26  Bruno Haible  <>

        * gperf-2.7.2 released.

        * doc/gperf.texi: Add a second bug report address
        * README: Updated.

2000-08-28  Bruno Haible  <>

        * lib/getopt.h (struct option): Use "const" also when compiling in
          C++ mode. Avoids warnings from Sun CC and HP-UX aCC.

        * doc/ (docdir): Change from $(datadir)/doc/@PACKAGE@ to
          $(prefix)/doc/@PACKAGE@, following the newest GNU standards.

2000-08-20  Bruno Haible  <>

        * src/ Bump version number to 2.7.2.
        * doc/gperf.texi: Likewise.

        * doc/texinfo.tex: Update to post-texinfo-4.0 version. @code in the
          title page now chooses a larger font. The overall layout of the
          text is denser.

        * AUTHORS: New file.

        * tests/ (all): Add check-lang-utf8 and check-lang-ucs2.
          (check-lang-utf8, check-lang-ucs2): New targets.
          (clean): Remove lu8out and lu2out.
        * tests/lang-utf8.gperf, tests/lang-utf8.exp: New files.
        * tests/lang-ucs2.gperf, tests/test2.c, tests/,
          tests/lang-ucs2.exp: New files.

        Allow the use of embedded NULs in keys.
        * lib/hash.h (hashpjw): Add a length argument.
        * lib/ (hashpjw): Likewise. Don't stop when encountering a NUL
        * src/hash-table.h (Hash_Table constructor): Add ignore_len argument.
          (Hash_Table::ignore_length): New field.
          (Hash_Table::insert): Renamed from Hash_Table::operator(). Remove
          ignore_length argument.
        * src/ (NIL): Remove macro.
          (Hash_Table constructor): Add ignore_len argument. Use it to
          initialize ignore_length.
          (Hash_Table destructor): Specify explicit length of char_set and
          (Hash_Table::insert): Renamed from Hash_Table::operator(). Remove
          ignore_length argument. Pass explicit length to hashpjw. Compare
          char_set using memcmp, not strcmp.
        * src/list-node.h (List_Node): Rename field length to key_length.
          New field char_set_length.
          (List_Node constructor): Accept key and rest, not the entire line.
        * src/ (List_Node constructor): Accept key and rest, not
          the entire line. Don't NUL terminate key and char_set. Specify
          explicit length of key. Initialize char_set_length field.
        * src/ Include <ctype.h>.
          (parse_line): New function.
          (Key_List::read_keys): Call parse_line instead of new List_Node.
          Pass option[NOLENGTH] to Hash_Table constructor, not
          Hash_Table::insert. Specify explicit length of key and char_set.
          (Key_List::get_occurrence): Use explicit length of char_set.
          (Key_List::set_determined): Likewise.
          (Key_List::already_determined): Likewise.
          (output_string): Add length argument. Output unprintable characters
          using octal escape sequence.
          (output_keyword_entry): Use explicit length of key.
          (Key_List::output_lookup_array): Specify explicit length of key.
          (output_switch_case): Likewise.
          (Key_List::dump): Likewise.
        * src/gen-perf.h (Gen_Perf::compute_disjoint_union): Add two length
        * src/ (Gen_Perf::compute_disjoint_union): Likewise. Don't
          stop when encountering NUL characters. Don't NUL terminate the
          (Gen_Perf::hash): Use explicit length of char_set.
          (Gen_Perf::change): Specify explicit length of key.
        * doc/gperf.texi: Document it.

        * doc/help2man: New file, help2man version 1.022.
        * Makefile.devel (all): Add doc/gperf.1.
          (doc/gperf.1): New target.
        * doc/gperf.1: Automatically generated.

        * mkinstalldirs: New file, from automake-1.4, grep-2.4.1, guile-1.4,
          libtool-1.3.3, make-3.79.1, tar-1.13.
        * src/ (MKINSTALLDIRS): New variable.
          (install, installdirs): Use it instead of mkdir.
        * doc/ (MKINSTALLDIRS): New variable.
          (install, installdirs): Use it instead of mkdir.

        * INSTALL: Update.

2000-08-19  Bruno Haible  <>

        * src/ (Output_Compare_Memcmp): New class.
          (Key_List::output_lookup_function): When option -l is given, use
          memcmp instead of strcmp or strncmp.

        * doc/gperf.texi: The bug report address is <>.
          The download address is Remove mention of -a and -g
          options (now nops). Explain effect of -c option.

        * doc/ (PACKAGE): New variable.
        * doc/ (datadir, docdir): New variables.
          (dvidir, htmldir): Change values.
          (install, installdirs): Update.

        * src/ Rename cache variable gp_cxx_throw_decl to

        * src/ (Key_List::output_hash_function): When outputting
          __inline, take advantage of C++ compilers which have inline.

        * src/ (Output_Compare_Strncmp::output_comparison):
          After the call to strncmp, verify that expr2 is not longer than
          Reported by Carlo Wood <>.

        * src/ (Key_List::output_lookup_function_body): Avoid
          emitting the loop for dealing with duplicates if
          total_duplicates == 0.

        * src/ (Key_List::read_keys): Don't accept an empty key.

        * src/ (install, installdirs, uninstall): Respect
        * doc/ (install, installdirs, uninstall): Likewise.

        * src/ (Options::print_options): Escape the arguments which
          contain special characters.

        * tests/c-parse.gperf: Updated from gcc-2.95.2/gcc/c-parse.gperf.
        * tests/objc.gperf: New file, from gcc-2.95.2/gcc/objc/objc.gperf.
        * tests/chill.gperf: New file, from gcc-2.95.2/gcc/ch/gperf.
        * tests/cplusplus.gperf: New file, from gcc-2.95.2/gcc/cp/gxx.gperf.
        * tests/gplus.gperf: Remove file.
        * tests/java.gperf: New file, from gcc-2.95.2/gcc/java/keyword.gperf.
        * tests/Makefile: Check them all.
        * tests/c-parse.exp: Renamed from tests/test-1.exp.
        * tests/modula2.exp: Renamed from tests/test-2.exp.
        * tests/cplusplus.exp: Renamed from tests/test-3.exp.
        * tests/gpc.exp: Renamed from tests/test-5.exp.

        * src/ (output_switch_case): Add trailing semicolon to
          lengthptr assignment line. Fixes bug with -D and -S.
          From Reini Urban <>. Also reported by
          David Hunter.
        * tests/ (check-lang-syntax): Perform each test with -D
          once without and once with duplicates.

        * src/ (output_keyword_entry): Avoid outputting a struct
          initializer of the form {"key",}.

        * src/ Don't include <stream.h>.
          From Michael Deutschmann <>.

        * tests/ (VALIDATE, check-lang-syntax): Use $(srcdir) where
          Reported by Andreas Schwab <>.

        * tests/validate: Don't run -traditional tests by default.

        * src/ (main): Check for write error on stdout before returning.

        * src/ (LDFLAGS): New definition, to catch the value given
          at configure time.

        Make the structure initializers customizable. Based on a patch by
        Kaveh R. Ghazi <>.
        * src/options.h (Options::get_initializer_suffix,
          Options::initializer_suffix): New declarations.
        * src/options.icc (Options::get_initializer_suffix): New function.
        * src/ (DEFAULT_INITIALIZER_SUFFIX): New constant.
          (Options::initializer_suffix): New variable.
          (Options::short_usage): Document option "-F".
          (Options::long_usage): Document option "-F".
          (Options constructor): Initialize initializer_suffix.
          (Options destructor): Dump initializer_suffix.
          (long_options): Add option "-F".
          (Options::operator()): Accept option "-F". Sets initializer_suffix.
        * src/ (output_keyword_blank_entries): Output
        * doc/gperf.texi: Document option "-F".

        * COPYING: Replace with GPL version 2 (with new FSF address and Y2K
          safe year format).

        * doc/gpl.texinfo: New file.
        * doc/gperf.texi: Document it.
        * doc/ (, gperf.dvi, gperf.html, gperf_toc.html):
          Update dependencies.

        * doc/ (MAKEINFO): Unset LANG while running makeinfo.

1998-05-20  Bruno Haible  <>

        * doc/ (gperf.dvi, clean): Remove gperf.cps.
          (install, installdirs, uninstall): Don't install gperf.dvi. The
          info and HTML documentations are sufficient for on-line use, and
          users who wish to print the documentation (in PS or DVI format)
          can do this directly off the source distribution.
          (DVIPS): Use "-D600" instead of "-Pljfour", for portability.

1998-05-20  Akim Demaille  <>

        * doc/gperf.texi: Many modifications:
          (Output Format): Declare `hash' and `in_word_set' as functions.
          (Concept Index): New section.
          (Title page): Use standard presentation.
          (Top): Use @top instead of @unnumbered so that automatic master
          update works.
          (Motivation): Avoid spaces in @var.
          (Options): Use the standard name ``Invoking ...''.
          (Options): Declare also the long form of the options.
          (Options): Remove redundant @itemize when @table is used.

1998-05-08  Andreas Schwab  <>

        * aclocal.m4 (CL_PROG_INSTALL): Set cl_cv_path_install, not

Sat May  2 13:20:54 1998  Bruno Haible  <>

        * gperf-2.7 released.

Sat May  2 12:31:51 1998  Bruno Haible  <>

        * src/ (version_string): Remove the "(C++ version)" suffix.
          It's redundant: the early C versions of gperf are called cperf.
          Reported by Karl Berry.
        * src/ (Options::operator()): Trim the output of "gperf -v".

Thu Apr 16 13:22:16 1998  Bruno Haible  <>

        * lib/, src/ Don't use $(TARGET_ARCH).
          Solaris "make" sets it to a value not understood by "cc".

Wed Apr 15 23:52:14 1998  Bruno Haible  <>

        * lib/, src/ Don't use implicit rules. Don't
          use $<. AIX "make" and OSF/1 "make" have problems with both.
        * src/, src/ Cast free() argument to char*,
          otherwise it doesn't compile on SunOS 4.
        * src/key-list.h: Declare structs outside of other declarations,
          needed for OSF/1 cxx 5.5.
        * lib/getopt.h: Use prototypes if __STDC__ || __cplusplus.
          Don't give a prototype for getopt(), to avoid error on SunOS 4.
        * lib/getopt.c: Declare strncmp, to avoid warnings.

Tue Apr 14 23:24:07 1998  Bruno Haible  <>

        * lib/GetOpt.{h,cc}: Remove files.
        * lib/getopt.{h,c}, lib/getopt1.c: New files, from GNU libc.
        * lib/ (AC_INIT): Search for, not
        * lib/ (OBJECTS): Remove GetOpt.o, add getopt.o, getopt1.o.
          (getopt.o, getopt1.o, hash.o): Use explicit building rules. Some
          "make"s don't support to have both implicit rules for "%.o : %.c"
          and "%.o :" in the same Makefile.
        * lib/hash.{h,cc}: Remove #pragma; there are no templates here.
        * src/option.h (Options::usage): Remove.
          (Options::short_usage, Options::long_usage): Declare.
        * src/ (Options::usage): Remove.
          (Options::short_usage, Options::long_usage): New functions.
          (long_options): New array.
          (Options::operator()): Use getopt_long instead of GetOpt::operator(),
          change all references to GetOpt members.

        * src/std-err.{h,cc}: Remove files.
        * src/, src/,,,
          Call fprintf(stderr) instead of Std_Err::report_error().
        * src/key-list.h, src/list-node.h, src/options.h: Don't use class
          Std_Err any more.
        * src/ (program_name): New variable.
        * src/ Remove STD_ERR_H.
          (OBJECTS): Remove std-err.o.

Mon Mar 23 01:03:35 1998  Bruno Haible  <>

        * aclocal.m4, {lib,src,tests}/ Remove CL_CC_WORKS and
          CL_CXX_WORKS, already contained in autoconf 2.12.

        * src/, src/ Move some code from
          Gen_Perf::Gen_Perf() to Key_List::output().
        * src/ Update dependencies.

        * src/options.{h,cc}: Remove option "-p".
        * src/ (Key_List::set_output_types): Rewrite.
          (default_array_type, default_return_type): Remove.
        * src/ Adjust "const" handling.
          + With option "-t" [TYPE], don't emit wrong code if there is no
            space before the struct's opening brace.

Sun Mar 22 16:59:15 1998  Bruno Haible  <>

        * src/key-list.{h,cc}: Completely reorganized the output routines.
          Rewrote from scratch the output_switch() function. Use classes
          (Output_Constants, Output_Expr, Output_Compare) for abstraction.
          In particular:
          + Don't emit trailing whitespace and spurious blank lines.
          + Adjust indentation of the arrays.
          + Don't emit commas at the end of array initializers and
            struct initializers.
          + With option "-l" [LENTABLE], compare the length before
            fetching the word from memory.
          + With option "-S" [SWITCH], emit the comparison code just once,
            not once in every switch statement.
          + With option "-S" [SWITCH], choose the right switch statement
            through a binary search, not a linear search.
          + With option "-S" [SWITCH], emit straightforward comparisons
            instead of switch statements with just one "case" label.
          + With options "-S -p -t" [SWITCH, POINTER, TYPE], don't emit
            spurious empty elements at the beginning of the wordlist array.
          + With option "-D" [DUP] and not option "-S" [SWITCH], if there
            is no more room for duplicate entries in the lookup array,
            don't call `assert (i != 0)'. Instead, make the array larger :-)
          + With option "-D" [DUP], if there are no duplicates, don't
            automatically fall back to the non-"-D" algorithm. If the user
            wants the non-"-D" algorithm, he can just not specify "-D".
          + With option "-D" [DUP] and either options "-p -t" [POINTER, TYPE]
            or not option "-S" [SWITCH], don't emit spurious empty elements
            at the beginning of the wordlist array.
          + With option "-D" [DUP], simplify the detection and processing
            of duplicate entries in the lookup array.
          + With options "-D -l" [DUP, LENTABLE] and not option "-S" [SWITCH],
            don't forget to emit the lengthtable array.
          + With options "-D -l -S" [DUP, LENTABLE, SWITCH], don't forget to
            compare the lengths before comparing the strings.

        * src/ No need to include <assert.h>.
        * src/ Likewise.

        * src/ Don't use `errno' after freopen failed.
        * src/ `report_error' doesn't call strerror(errno) any
          more. No need to include <string.h> and <errno.h>.

        * tests/ (check-*): Any difference between .exp and .out
          is a failure. Don't ignore whitespace differences.

        * tests/ (check-lang-syntax): Add some more checks.

Fri Mar 20 00:54:54 1998  Bruno Haible  <>

        * tests/jscript.gperf: Renamed from tests/javascript.gperf, because
          of Minix and SVR2 14-character filename limit.
        * src/ (output_string): New function.
          (Key_List::output_switch, Key_List::output_keyword_table): Call it.

        * src/options.{h,icc,cc} (get_wordlist_name): New function. Add
          option -W.
        * src/ (Key_List::output_switch,
          Key_List::output_keyword_table, Key_List::output_lookup_function):
          Use it.
        Patch from William Bader <wbader@CSEE.Lehigh.Edu>.

        * src/ Bump version number directly from 2.5 to 2.7,
          because Schmidt's last release from 1991 carries version number 2.6.

Tue Jul 30 00:02:39 1991  Douglas C. Schmidt  (schmidt at

        * Fixed a small bug in the Key_List::output_keyword_table routine
          that caused an extra newline to be printed if there where no
          leading blank entries... (who cares, right?!)

Mon Jul 29 22:05:40 1991  Douglas C. Schmidt  (schmidt at

        * Modified the handling of the -E (emit enums rather than
          #defines) option in conjunction with the -G option.  Now, if -G
          and -E are given the enums are generated outside the lookup
          function, rather than within it!

Mon Apr  8 18:17:04 1991  Doug Schmidt  (schmidt at

        * Yucko, there was a bug in the handling of -c (and of course the
          new -I command in  Apparently when I added the
          super-duper hack that provided support for duplicate keys I
          forgot to update the strcmp output...

Mon Mar  9 02:19:04 1998  Bruno Haible  <>

        * Moved the documentation to doc/, put the stuff borrowed from
          libg++ into lib/.
        * Rewrote all's for better compliance with GNU standards.
        * Autoconf based configuration. Rewrote all's. Added
          aclocal.m4, with macros from CLISP and CLN. Added Makefile.devel.
        * src/depend: Removed. Dependencies are now in src/

        * src/bool-array.icc: New file, contains inline functions, from both
          src/bool-array.h and src/
        * src/options.icc: New file, contains inline functions, from both
          src/options.h and src/
        * src/read-line.icc: New file, contains inline functions, from both
          src/read-line.h and src/

        * src/bool-array.h: Don't include <std.h>.
        * src/ Include <string.h>.
        * src/ No need to include <ctype.h>. Don't include
        * src/ Don't include <std.h> and <builtin.h>. Include
          <string.h> and lib/hash.h instead.
        * src/ Don't include <std.h>.
        * src/ Don't include <builtin.h>. Include <string.h> and
          <stdlib.h> instead.
        * src/ Don't include <std.h>. Include <stdlib.h> instead.
          Remove `index' hack.
        * src/ Don't include <_G_config.h>.
        * src/ Don't include <std.h>. Include <stdlib.h> instead.
        * src/ Don't include <builtin.h>. Include <string.h> and
          <stdlib.h> instead.
        * src/ Don't include <builtin.h>. Include <stdlib.h>
        * src/ Don't include <std.h>. Include <string.h> (for Irix).
        * src/vectors.h: No need to include <stdio.h>.
        * src/ No need to include <stdio.h>.

        * src/bool-array.h: Change `STORAGE_TYPE' from int to unsigned int.
        * src/bool-array.{h,cc}: Change type of `Bool_Array::size' from int
          to unsigned int.
        * src/bool-array.{h,cc}: Change type of `Bool_Array::init' argument
          from STORAGE_TYPE to unsigned int.
        * src/gen-perf.{h,cc}: Change two `Gen_Perf::compute_disjoint_union'
          argument types from `char *' to `const char *'.
        * src/iterator.h: Change type of `Iterator::str' and argument of
          `Iterator::Iterator' from `char *' to `const char *'.
        * src/ Cast to `unsigned char' before calling `isdigit'.
        * src/key-list.{h,cc}: Change type of `Key_List::array_type',
          `Key_List::return_type', `Key_List::struct_tag',
          `Key_List::include_src', `default_array_type', `default_return_type'
          and return type of `Key_List::get_array_type',
          `Key_List::get_special_input', `Key_List::save_include_src' from
          `char *' to `const char *'.
        * src/ Change "pretty gross" assignment.
        * src/ Don't use `alloca', HP-UX CC lacks it.
        * lib/ Likewise.
        * src/ (merge): Use iteration instead of recursion.
        * src/list-node.{h,cc}: Change type of `List_Node::key',
          `List_Node::rest', `List_Node::char_set' from `char *' to
          `const char *'.
        * src/ Don't use BUFSIZ. Conditionalize the throw() declaration.
        * src/read-line.h: Don't use BUFSIZ.
        * src/ Make CHUNK_SIZE a constant, and use allocate the
          buffers on the stack by default. Use memcpy for copying buffers.
          Include <string.h>.
        * src/read-line.icc (get_line): Use iteration instead of tail recursion.
          Don't call ungetc(EOF,stdin).
        * src/std-err.{h,cc}: Change type of `Std_Err::program_name' and of
          argument `Std_Err::report_error' from `char *' to `const char *'.
        * src/ `report_error' doesn't call `exit' any more. All
          callers changed to do that themselves.
        * src/trace.h: Make constructor/destructor calls non-inline.

        * src/ (output_hash_function): If option[CPLUSPLUS],
          always make the hash function inline.
          (output): Declare the hash function inline, with the right name.
        * src/options.{h,cc}, src/, src/ Remove
          options -g, making it on by default. Remove option -a. Instead,
          introduce "-L KR-C", "-L C", "-L ANSI-C", "-L C++".
        * src/options.{h,cc}, src/ Add option -I.
        * src/ Don't emit "const" if compiling in mode "-L KR-C".
        * src/ Don't emit a comma at the end of an enum list.
        * src/ Remove COUNT_TIME code.
        * src/vectors.h, src/, src/, src/
          ALPHA_SIZE defaults to 256 now. Add option -7.

        * tests/javascript.gperf: New file.
        * tests/jstest*.gperf, tests/validate: New tests.

Sat Jan 31 01:38:11 1998  Alexandre Oliva <>

	* src/ ($(TARGETPROG)): Add $(CFLAGS).

Wed Jan 28 01:56:00 1998  Manfred Hollstein  <>

	* (package_makefile_rules_frag): New and
	redirect stderr from ${srcdir}/config.shared to
	* src/ Ditto.
	* tests/ Ditto.

Fri Jan 23 08:00:41 1998  H.J. Lu  (

	* gperf.texi (@ichapter): Changed to @chapter.

Wed Jan 14 09:16:48 1998  H.J. Lu  (

	* src/, src/key-list.h (Key_List::strcspn): Don't
	define if strcspn is defined.

Fri Jan 24 13:23:47 1997  Mike Stump  <>

	* src/ (operator delete): Add the exception specification.

Mon Feb  5 19:29:16 1996  Per Bothner  <>

	* src/ (Read_Line::readln_aux):  Handle EOF if last	line
	has a length which is an exact multiple of CHUNK_SIZE.  (Used to throw
	away the line's contents.)  From Bruno Haible <>.
	* src/ ($(TARGETPROG)):  Add -lm to link line.

Tue Jun 11 13:43:50 1996  Brendan Kehoe  <>

	* src/ (List_Node): Reorder init of nodes to
	match declaration order.
	* src/ (Hash_Table): Likewise.

Tue Oct 10 16:37:28 1995  Mike Stump  <>

	* src/ Since malloc/delete are not paired, we cannot call

Wed Jan  4 12:40:14 1995  Per Bothner  <>

	* src/ ($(TARGETPROG)):  Link with $(LDFLAGS).
	Patch from John Interrante <>.

Sat Nov  5 19:12:48 1994  Jason Merrill  (

	* src/ (LIBS): Remove.

Tue Oct 18 17:51:14 1994  Per Bothner  <>

	* src/  Use stderror, instead of the non-standard
	sys_nerr and sys_errlist.

Sat Sep 17 22:02:13 1994  Per Bothner  (

	* src/ (output_hash_function):
	Patch from William Bader <wbader@CSEE.Lehigh.Edu>.

Fri Jul 15 09:38:11 1994  Per Bothner  (

	* src/  #include <errno.h>, and only declare
	extern int errno if errno is not a macro.

Mon May 30 17:29:34 1994  Per Bothner  (

	* (src_all, install):  Make sure to add '/' after
	`pwd` in $rootme, as expected by FLAGS_TO_PASS.

Wed May 11 00:47:22 1994  Jason Merrill  (

	Make libg++ build with gcc -ansi -pedantic-errors
	* src/options.h: Lose commas at end of enumerator lists.

Sun Dec  5 19:16:40 1993  Brendan Kehoe  (

	* src/ (Hash_Table::~Hash_Table): Don't pass an
	argument to fprintf, since it's not expecting one.

Fri Nov 26 19:03:18 1993  Per Bothner  (

	* src/  #undef index, for the sake of broken NeXT,

Thu Nov  4 11:16:03 1993  Per Bothner  (

	* (install):  Use INSTALL_DATA for gperf.1.

Mon Oct 25 18:40:51 1993  Per Bothner  (

	* src/ (Key_List::read_keys):  Use POW macro
	to increase hash table size to power of 2.

	* options.h (LARGE_STACK_ARRAYS):  New flag.  Defaults to zero.
	Only stack-allocate large arrays if LARGE_STACK_ARRAYS is set.
	* (main):  Only call setrlimit (RLIMIT_STACK, ...)

Mon Oct  4 17:45:08 1993  Per Bothner  (

	* src/  Always use ANSI rand/srand instead of BSDisms.

Wed Aug 18 12:19:53 1993  Per Bothner  (

	* (src_all):  Make less verbose output.

Fri May 28 14:01:18 1993  Per Bothner  (

	* src/ (Gen_Perf::change):  Don't use gcc-specific
	2-operand conditional expression.
	* src/ (Key_List::output_lookup_array):
	Don't use variable-size stack arrays, unless compiled by g++.

Tue May  4 14:08:44 1993  Per Bothner  (

	Changes (mostly from Peter Schauer) to permit compilation
	using cfront 3.0 and otherwise be ARM-conforming.
	* src/key-list.h:  class Key_List must use public derivation
	of base class Std_Err (because Gen_Perf::operator() in
	calls Std_Err::report_error).
	* src/ (Gen_Perf::affects_prev), src/
	(Hash_Table::operator()):  Don't use gcc-specific 2-operand
	conditional expression.
	* src/ (Iterator::operator()):  Don't use gcc-specific
	range construct in case label.
	* (Key_List::output_lookup_array, Key_List::read_keys),
	src/ (Gen_Perf::operator(), src/
	(Read_Line::readln_aux):  If not gcc, don't allocate
	variable-sized arrays on stack.
	* src/ (operator new):  Argument type should be size_t.
	* (Key_List::output_lookup_array, Key_List::read_keys),
	new/cc (::operator new): Don't use non-standard >?= operator.

Tue Apr 27 20:11:30 1993  Per Bothner  (

	* src/  Define TARGETPROG, and use it.

Mon Apr 19 00:29:18 1993  Per Bothner  (

	*,  Re-vamped configure scheme.
	* gperf.texinfo:  Renamed to gperf.texi.
	* src/bool-array.{h,cc}:  ANSIfy bzero->memset.

Sat Jan 30 20:21:28 1993  Brendan Kehoe  (

	* tests/ (mostlyclean): Also delete aout, cout, m3out,
	pout, and preout.

Tue Dec 29 08:58:17 1992  Ian Lance Taylor  (

	* pass $(FLAGS_TO_PASS) to all calls to make.

Mon Dec 21 18:46:46 1992  Per Bothner  (

	* tests/expected.* renamed to *.exp to fit in 14 chars.
	* tests/  Update accordingly.
	Also rename output.* to *.out.
	* src/ (clean):  Remove gperf program.

Wed Dec  9 14:33:34 1992  Per Bothner  (

	* src/, src/bool-array.h: ANSIfy bzero->memset.

Thu Dec  3 19:34:12 1992  Per Bothner  (

	* (distclean, realclean): Don't delete
	Makefile before recursing.

Fri Nov  6 13:41:49 1992  Per Bothner  (

	* key-list.{h,cc}:  Remove MAX_INT (and similar) constant
	fields from Key_List class, and use INT_MAX (etc) from limits.h.
	* key-list.{h,cc}, options.{h,cc}, vectors.h:  Removed all
	uses of initialized const fields, as they are non-standard
	- and their use was easy to do away with.  Mostly, just
	made the constants static non-fields in the .cc file.

Mon Nov  2 13:10:11 1992  Per Bothner  (

	* tests/  When generating cinset.c, don't pass -C,
	since -C assumes an ANSI compiler.  Add the -C flag (with -a)
	when generating test.out.3 instead.
	* tests/expected.out.3:  Update accordingly.

Wed Aug 12 11:47:54 1992  Per Bothner  (

	*  Factor out common flags into $(FLAGS_TO_PASS).
	*  'install-info' depends on

Mon Aug 10 11:39:52 1992  Ian Lance Taylor  (

	*, src/ always create installation

Mon Jul 20 15:33:21 1992  Mike Stump  (

	* src/ (operator new):  Add cast from void * to char *,
	since it is not a standard conversion.

Wed Jun 17 16:25:30 1992  Per Bothner  (

	* src/  #include <_G_config.h> for _G_SYSV.
	* src/  alloca() hair.
	* src/ (main):  Only call getrlimit if _G_HAVE_SYS_RESOURCE.
	* Makefile,in, {src,test}/  Fix *clean rules.

Fri May 29 13:21:13 1992  Per Bothner  (

	* src/  Replace USG -> _G_SYSV.

Thu May 14 13:58:36 1992  Per Bothner  (

	* src/  Don't pass obsolete flag -DUNLIMIT_STACK.
	* tests/ (clean): Fix.

Sat Mar  7 00:03:56 1992  K. Richard Pixley  (

	* gperf.texinfo: added menu item hook.

Wed Feb 26 18:04:40 1992  K. Richard Pixley  (

	*, removed traces of namesubdir,
	  -subdirs, $(subdir), $(unsubdir), some rcs triggers.  Forced
	  copyrights to '92, changed some from Cygnus to FSF.

Sun Jan 26 19:21:58 1992  Per Bothner  (bothner at

	* tests/  Use re-directed stdin instead of file
	name in argv.  This allows us to remove the filename
	from the output, the expected output, and hence the diffs.
	(Note that the input file is in $(srcdir), which we cannot
	place in the expected out files.)
	* tests/expected.out.[1235]:  Edit out input filename,
	to match new output.

Thu Jun 28 16:17:27 1990  Doug Schmidt  (schmidt at brilliant)

	* Wow, first fix on the new job!  There was a dumb error
	  in Key_List::output_lookup_function, where I printed the
	  string "&wordlist[key]" instead of the correct "&wordlist[index]".
	* Added a couple of #ifdefs for USG support.
Sun Jun  3 17:16:36 1990  Doug Schmidt  (schmidt at

        * Updated the version number to 2.5 and sent to Doug Lea for release
          with the latest GNU libg++.

        * Changed the error handling when a keyword file cannot be opened
          (now calls perror).

Wed May 30 14:49:40 1990  Doug Schmidt  (schmidt at

        * Instrumented the source code with trace statements automagically
          inserted using my new automated trace instrumentation tool!

Wed May  9 11:47:41 1990  Doug Schmidt  (schmidt at

        * Really fixed the previous bug.  Turns out that a small amount
          of logic had to be duplicated to handle static links that occur
          as part of dynamic link chains.  What a pain!!!

Tue May  8 23:11:44 1990  Doug Schmidt  (schmidt at

        * Fixed a stupid bug in Key_List::output_lookup_array that was
          causing incorrect counts to be generated when there were both
          static and dynamic links occurring for the same hash value.
          Also simplified the code that performs the logic in this routine.

Mon Apr 30 17:37:24 1990  Doug Schmidt  (schmidt at

        * Fixed stupid bug in Key_List::output_lookup_array that was
          making the generated lookup[] array contain `chars' even
          when the values stored in the chars are greater than 127!

        * Changed the behavior of the -G (global table) option so that it
          will output the `length[]' array in the global scope along with
          the `word_list[]' array.

        * Fixed a stupid bug in Key_List::output_lookup_function that
          would always output the complicated `duplicate-handling' lookup
          logic, even when there were no duplicates in the input!

        * Yikes, had to modify a bunch of stuff in to correctly
          handle duplicate entries.  Changed the generated code so that
          the MIN_HASH_VALUE is no longer subtracted off when calculating
          the hash value for a keyword.  This required changing some other
          code by substituting MAX_HASH_VALUE for TOTAL_KEYS in several places.
          Finally, this means that the generated tables may contain leading 
          null entries, but I suppose it is better to trade-off space to get 
          faster performance...

Mon Mar 26 13:08:43 1990  Doug Schmidt  (schmidt at

        * Updated version number to 2.4 to reflect the latest changes.

        * Changed the main program so that it always prints out gperf's
          execution timings to the generated output file.
Sun Mar 25 12:39:30 1990  Doug Schmidt  (schmidt at

        * Added the -Z option so that users can specify the name of the
          generated class explicitly.  Updated documentation to reflect
          this change.
        * Modified the generated C++ class interface so that the functions
          are declared static (to remove the overhead of passing the `this'
          pointer).  This means that operator()() can no longer be used,
          since it only works on non-static member functions.
          Also changed things so that there is no constructor (why waste
          the extra call, when it doesn't do anything, eh?)

        * Modified the behavior of Key_List::output when the -L C++ option
          is enabled.  Previously the code generated use const data members
          to record MIN_WORD_LENGTH, MIN_HASH_VALUE, etc.  However, as
          pointed out by James Clark this may result in suboptimal behavior
          on the part of C++ compilers that can't inline these values.
          Therefore, the new behavior is identical to what happens with
          -L C, i.e., either #defines or function-specific enums are used.
          Why sacrifice speed for some abstract notion of `code purity?' ;-)

Tue Mar  6 18:17:42 1990  Doug Schmidt  (schmidt at

        * Added the -E option that defines constant values using an enum
          local to the lookup function rather than with #defines.  This
          also means that different lookup functions can reside in the
          same file.  Thanks to James Clark ( 

Sat Mar  3 20:19:00 1990  Doug Schmidt  (schmidt at

        * Added a special case to key_list::output_switch that doesn't
          generate extra comparisons when the `-S' is given an argument
          of 1 (the normal case).  This should speed up the generated
          code output a tad...

Fri Feb 23 14:21:28 1990  Doug Schmidt  (schmidt at

        * Renamed all instances of member function get_keysig_size
          to get_max_keysig_size, since this is more precise...

        * Changed all occurrences of charset to keysig (stands for ``key
          signature'') to reflect the new naming convention used in the 
          USENIX paper.

Thu Feb 22 11:28:36 1990  Doug Schmidt  (schmidt at

        * Changed the name of the generated associated values table from
          asso_value to asso_values to reflect conventions in the USENIX
          C++ paper.

Thu Feb 15 23:29:03 1990  Doug Schmidt  (schmidt at

        * Updated the gperf.texinfo file to fix some formatting problems
          that had crept in since last time.

Wed Feb 14 23:27:24 1990  Doug Schmidt  (schmidt at

        * Fixed stupid bug in (get_special_input), wher
          gperf replaced each '%' with the succeeding character.

        * Added support for multiple target language generation.  Currently
          handled languages are C and C++, with C as the default.  Updated
          documentation and option handler to reflect the changes.

        * Added a global destructor to and removed the #ifdef, since
          the bloody thing now works with libg++.

Mon Feb 14 13:00:00 1990  Doug Schmidt  (schmidt at

        * Found out that my gperf paper was accepted at the upcoming
          USENIX C++ Conference in San Francisco.  Yow!

Tue Jan 30 09:00:29 1990  Doug Schmidt  (schmidt at

        * #ifdef'd out the memory allocator, since there are
          problems with this and the libg++ stuff.

        * Changed key-list.h so that class Vectors is a public (rather
          than private) base class for class Key_List.  The previous
          form was illegal C++, but wasn't being caught by the old
          g++ compiler.  Should work now... ;-)

Sun Dec 10 14:08:23 1989  Doug Schmidt  (schmidt at

        * Added several changes from  These changes
          help to automate the build process.

Wed Nov 15 15:49:33 1989  Doug Schmidt  (schmidt at

        * Removed conditional compilation for GATHER_STATISTICS.  There's
          really no good reason to avoid collecting this info at run-time,
          since that section of code is *hardly* the bottleneck... ;-)

        * Simplified the C output routines in Key_List::set_output_types
          and Key_List::output_keyword_table a bit in order to
          speed-up and clean up the code generation.

        * Modified function Key_List::get_special_input so that it does
          not try to `delete' a buffer that turned out to be too short.
          This is important since the new memory management scheme
          does not handle deletions.  However, adding a small amount of
          garbage won't hurt anything, since we generally don't do this
          operation more than a couple times *at most*!

        * Created a new file ( which includes my own overloaded
          operator new.  This function should dramatically reduce the
          number of calls to malloc since it grabs large chunks and
          doles them out in small pieces.  As a result of this change
          the class-specific `operator new' was removed from class List_Node.

Tue Nov 14 21:45:30 1989  Doug Schmidt  (schmidt at

        * Continued to refine the great hack.  The latest trick is to
          try and replace most uses of dynamic memory (i.e., calls to
          new) with uses of gcc dynamic arrays (i.e., an alloca solution).
          This makes life much easier for the overall process-size, since 
          it reduces the amount of overhead for memory management.  As a
          side-effect from this change there is no reason to have the
          Bool_Array::dispose member function, so it's outta here!

        * Fixed a stupid bug that was an disaster waiting to happen...
          Instead of making the boolean array large enough to index
          max_hash_value it was only large enough to index max_hash_value
          - 1.  Once again, an off-by-one mistake in C/C++!!!!

Mon Nov 13 19:38:27 1989  Doug Schmidt  (schmidt at

        * Added the final great hack!  This allows us to generate hash tables
          for near-perfect hash functions that contain duplicates, *without*
          having to use switch statements!  Since many compilers die on large
          switch statements this feature is essential.  Furthermore, it appears
          that the generated code is often *smaller* than that put out by
          compilers, even though a large, sparse array must be created.
          Here's the general idea:

             a. Generate the wordlist as a contiguous block of keywords, 
                just as before when using a switch statement.  This
                wordlist *must* be sorted by hash value. 

             b. Generate the lookup array, which is an array of signed
                {chars,shorts,ints}, (which ever allows full coverage of
                the wordlist dimensions).  If the value v, where v =
                lookup[hash(str,len)], is >= 0 and < TOTAL_KEYWORDS, then we
                simply use this result as a direct access into the wordlist 
                array to snag the keyword for comparison.  

             c. Otherwise, if v is < -TOTAL_KEYWORDS or > TOTAL_KEYWORDS
                this is an indication that we'll need to search through
                some number of duplicates hash values.  Using a hash
                linking scheme we'd then index into a different part of
                the hash table that provides the starting index and total
                length of the duplicate entries to find via linear search!

Sun Nov 12 13:48:10 1989  Doug Schmidt  (schmidt at

        * Simplified Key_List::output_min_max considerably by recognizing
          that since the keyword list was already sorted by hash value finding 
          the min and max values is trivial!

        * Improved the debugging diagnostics considerably in classes Key_List,
          Hash_Table, and Gen_Perf.

        * Modified the `-s' option so that a negative argument is now 
          interpreted to mean `allow the maximum associated value to be
          about x times *smaller* than the number of input keys.'  This
          should help prevent massive explosion of generated hash table
          size for large keysets.

Sat Nov 11 11:31:13 1989  Doug Schmidt  (schmidt at

        * Added a field in class Key_List that counts the total number
          of duplicate keywords, both static and dynamic.

        * Added a new member function Bool_Array that deletes the dynamic
          memory allocated to Bool_Array::storage_array.  This space may
          be needed for subsequent options, so it made sense to free it as
          soon as possible...
        * Renamed file/class Alpha_Vectors to Vectors, to avoid problems
          with 14 character length filenames on SYSV.  Also changed file
          adapredefined.gperf to adadefs.gperf in the ./tests directory.

        * Modified class Options by changing the member function
          Options::total_positions to Options::get_charset_size and
          Options::set_charset_size.  These two routines now either return
          the total charset size *or* the length of the largest keyword
          if the user specifies the -k'*' (ALLCHARS) option.  This change
          cleans up client code.

        * Merged all the cperf changes into gperf.
        * Made sure to explicitly initialize perfect.fewest_collisions to

        * Cleaned up some loose ends noticed by Nels Olson.
          1.  Removed `if (collisions <= perfect.fewest_collisions)'
              from Gen_Perf::affects_prev since it was superfluous.
          2.  Removed the fields best_char_value and best_asso_value
              from Gen_Perf.  There were also unnecessary.
          3.  Fixed a braino in the Bool_Array::bool_array_reset
              function.  Since iteration numbers can never be zero
              the `if (bool_array.iteration_number++ == 0)' must be
              `if (++bool_array.iteration_number == 0).'
          4.  Modified Std_Err::report_error so that it correctly handles

        * It is important to note that -D no longer enables -S.
          There is a good reason for this change, which will become
          manifested in the next release... (suspense!).

        * Made some subtle changes to Key_List::print_switch so that if finally
          seems to work correctly.  Needs more stress testing, however...

        * Made a major change to the Key_List::print_switch function.
          The user can now specify the number of switch statements to generate
          via an argument to the -S option, i.e., -S1 means `generate 1
          switch statement with all keywords in it,' -S2 means generate
          2 switch statements with 1/2 the elements in each one, etc.
          Hopefully this will fix the problem with C compilers not being
          able to generate code for giant switch statements (but don't
          hold your breath!)

        * Changed Key_List::length function to Key_List::keyword_list_length.

        * Added a feature to main.c that prints out the starting wall-clock
          time before the program begins and prints out the ending wall-clock
          time when the program is finished.

        * Added the GATHER_STATISTICS code in hash-table.c so we can
          keep track of how well double hashing is doing.  Eventually,
          GATHER_STATISTICS will be added so that all instrumentation
          code can be conditionally compiled in.

        * Fixed a stupid bug in Key_List::print_switch routine.  This
          was necessary to make sure the generated switch statement worked
          correctly when *both* `natural,' i.e., static links and dynamic
          links, i.e., unresolved duplicates, hash to the same value.

        * Modified Bool_Array::~Bool_Array destructor so that
          it now frees the bool_array.storage_array when it is no longer
          needed.  Since this array is generally very large it makes sense
          to return the memory to the freelist when it is no longer in use.

        * Changed the interface to constructor Hash_Table::Hash_Table.  This 
          constructor now passed a pointer to a power-of-two sized buffer that 
          serve as storage for the hash table.  Although this weakens information
          hiding a little bit it greatly reduces dynamic memory fragmentation,
          since we can now obtain the memory via a call to alloca, rather
          than malloc.  This change modified Key_List::read_keys calling

        * Since alloca is now being used more aggressively a conditional
          compilation section was added in main.c. Taken from GNU GCC,
          this code gets rid of any avoidable limit on stack size so that
          alloca does not fail.  It is only used if the -DRLIMIT_STACK
          symbol is defined when gperf is compiled. 

        * Added warnings in option.c so that user's would be informed
          that -r superceeds -i on the command-line.
        * Rewrote Gen_Perf::affects_prev.  First, the code structure
          was cleaned up considerably (removing the need for a dreaded
          goto!).  Secondly, a major change occurred so that Gen_Perf::affects_prev
          returns FALSE (success) when fewest_hits gets down to whatever
          it was after inserting the previous key (instead of waiting for
          it to reach 0).  In other words, it stops trying if it can
          resolve the new collisions added by a key, even if there are
          still other old, unresolved collisions.  This modification was
          suggested by Nels Olson and seems to *greatly* increase the
          speed of gperf for large keyfiles.  Thanks Nels!

        * In a similar vein, inside the Gen_Perf::change routine 
          the variable `perfect.fewest_collisions is no longer initialized
          with the length of the keyword list.  Instead it starts out at
          0 and is incremented by 1 every time change () is called.
          The rationale for this behavior is that there are times when a
          collision causes the number of duplicates (collisions) to
          increase by a large amount when it would presumably just have
          gone up by 1 if none of the asso_values were changed.  That is,
          at the beginning of change(), you could initialize fewest_hits
          to 1+(previous value of fewest_hits) instead of to the number of
          keys.  Thanks again, Nels.

        * Replaced alloca with new in the Gen_Perf::change function.
          This should eliminate some overhead at the expense of a little
          extra memory that is never reclaimed.

        * Renamed Gen_Perf::merge_sets to Gen_Perf::compute_disjoint_union
          to reflect the change in behavior.

        * Added the -e option so users can supply a string containing
          the characters used to separate keywords from their attributes.
          The default behavior is ",\n".

        * Removed the char *uniq_set field from LIST_NODE and modified
          uses of uniq_set in perfect.c and keylist.c.  Due to changes
          to Gen_Perf::compute_disjoint_sets this field was no longer
          necessary, and its removal makes the program smaller and
          potentially faster. 
        * Added lots of changes/fixes suggested by Nels Olson
          (umls.UUCP!  In particular:
          1.  Changed Bool_Array so that it would dynamically create
              an array of unsigned shorts rather than ints if the 
              LO_CAL symbol was defined during program compilation.
              This cuts the amount of dynamic memory usage in half,
              which is important for large keyfile input.
          2.  Added some additional debugging statements that print extra
              info to stderr when the -d option is enabled.
          3.  Fixed a really stupid bug in Key_List::print_switch
              A right paren was placed at the wrong location, which broke
              strlen ().
          4.  Fixed a subtle problem with printing case values when keylinks
              appear.  The logic failed to account for the fact that there
              can be keylinks *and* regular node info also!
          5.  Changed the behavior of Key_List::read_keys so that it would
              honor -D unequivocally, i.e., it doesn't try to turn off dup
              handling if the user requests it, even if there are no
              immediate links in the keyfile input. 
          6.  Modified the -j option so that -j 0 means `try random values
              when searching for a way to resolve collisions.'
          7.  Added a field `num_done' to the Gen_Perf struct.  This is used
              to report information collected when trying to resolve
              hash collisions.
          8.  Modified the merge_sets algorithm to perform a disjoint
              union of two multisets.  This ensures that subsequent
              processing in Gen_Perf::affect_prev doesn't
              waste time trying to change an associated value that is
              shared between two conflicting keywords.
          9.  Modified Gen_Perf::affects_prev so that it doesn't try
              random jump values unless the -j 0 option is enabled.
          10. Fixed a silly bug in Gen_Perf::change.  This problem caused
              gperf to seg fault when the -k* option was given and the
              keyfile file had long keywords.
Sun Oct 29 00:18:55 1989  Doug Schmidt  (schmidt at

        * Modified class-specific new operations for Read_Line and
          List_Node so they don't fail if SIZE is larger than twice
          the previous buffer size.  Note we double buffer size
          everytime the previous buffer runs out, as a heuristic
          to reduce future calls to malloc.

Sun Oct 22 13:49:43 1989  Doug Schmidt  (schmidt at

        * Updated gperf version number to 2.0.  Send to Doug Lea for
          incorporation into the long-awaited `official' libg++ 1.36

        * Thanks to Nels Olson a silly bug in Gen_Perf::change ()
          was fixed.  This problem caused gperf to seg fault when
          the -k* option was given and the keyfile file had long
        * Modified Key_List::print_hash_function so that it output
          max_hash_value + 1 (rather than just max_hash_value) for
          any associated value entries that don't correspond to
          keyword charset characters.  This should speed up rejection
          of non-keyword strings a little in some cases.

Sat Oct 21 19:28:36 1989  Doug Schmidt  (schmidt at

        * Fixed Key_List::print_hash_function so that it no longer output
          things like `return 0 + ...'  Although this probably gets
          optimized away by even the worst C compilers there isn't any
          point tempting fate... ;-)

        * Fixed class List_Node's constructor so that it wouldn't a priori
          refuse to consider trying to hash keys whose length is less
          than the smallest user-specified key position.  It turns out
          this is not a problem unless the user also specifies the -n
          (NOLENGTH) option, in which case such keys most likely
          don't have a prayer of being hashed correctly!

        * Changed the name of the generated lookup table from `Hash_Table'
          to `asso_value' to be consistent with the gperf paper.

Tue Oct 17 14:19:48 1989  Doug Schmidt  (schmidt at

        * Added a flag GATHER_STATISTICS in the Makefile.  If defined
          during compilation this turns on certain collection facilities
          that track the performance of gperf during its execution.  In
          particular, I want to see how many collisions occur for the
          double hashing Hash_Table.

        * Added a safety check so that we don't screw up if the total
          number of `resets' of the Bool_Array exceeds MAX_INT.  Since
          this number is around 2^31 it is unlikely that this would ever
          occur for most input, but why take the risk?

        * Changed the behavior for the -a (ANSI) option so that the
          generated prototypes use int rather than size_t for the LEN 
          parameter.  It was too ugly having to #include <stddef.h> all
          over the place...

Mon Oct 16 11:00:35 1989  Doug Schmidt  (schmidt at

        * Continued to work on the gperf paper for the USENIX C++
          conference.  At some point this will be merged back into
          the gperf documentation...

Sat Oct 14 20:29:43 1989  Doug Schmidt  (schmidt at

        * Added a majorly neat hack to Bool_Array, suggested by rfg.
          The basic idea was to throw away the Ullman array technique.
          The Ullman array was used to remove the need to reinitialize all 
          the Bool_Array elements to zero everytime we needed to determine
          whether there were duplicate hash values in the keyword list.  
          The current trick uses an `iteration number' scheme, which takes
          about 1/3 the space and reduces the overall program running a 
          time by about 20 percent for large input!  The hack works as 
          1. Dynamically allocation 1 boolean array of size k.
          2. Initialize the boolean array to zeros, and consider the first
             iteration to be iteration 1.
          2. Then on all subsequent iterations we `reset' the bool array by
             kicking the iteration count by 1. 
          3. When it comes time to check whether a hash value is currently
             in the boolean array we simply check its index location.  If
             the value stored there is *not* equal to the current iteration
             number then the item is clearly *not* in the set.  In that
             case we assign the iteration number to that array's index
             location for future reference.  Otherwise, if the item at
             the index location *is* equal to the iteration number we've
             found a duplicate.  No muss, no fuss!
Mon Oct  2 12:30:54 1989  Doug Schmidt  (schmidt at

        * Changed some consts in options.h to enumerals, since g++
          doesn't seem to like them at the moment!

Sat Sep 30 12:55:24 1989  Doug Schmidt  (schmidt at

        * Fixed a stupid bug in Key_List::print_hash_function that manifested
          itself if the `-k$' option was given (i.e., only use the key[length]
          character in the hash function).

        * Added support for the -C option.  This makes the contents of
          all generated tables `readonly'.

        * Changed the handling of generated switches so that there is
          only one call to str[n]?cmp.  This *greatly* reduces the size of
          the generated assembly code on all compilers I've seen.

        * Fixed a subtle bug that occurred when the -l and -S option
          was given.  Code produced looked something like:

          if (len != key_len || !strcmp (s1, resword->name)) return resword;

          which doesn't make any sense.  Clearly, this should be:

          if (len == key_len && !strcmp (s1, resword->name)) return resword;

Tue Sep 26 10:36:50 1989  Doug Schmidt  (schmidt at

        * Changed class Read_Line's definition so that it no longer
          needs to know about the buffering scheme used to speed up 
          dynamic memory allocation of input keywords and their
          associated attributes.  This means that operator new is no longer
          a friend of Read_Line.

Mon Sep 25 23:17:10 1989  Doug Schmidt  (schmidt at

        * Decided that Obstacks had too much overhead, so they were
          removed in favor of super-efficient, low-overhead buffered
          storage allocation hacks in Read_Line and List_Node.

        * No longer try to inline functions that g++ complains about
          (Key_List::Merge and Key_List::Merge_Sort).

Sun Sep 24 13:11:24 1989  Doug Schmidt  (schmidt at

        * Changed classes Read_Line and List_Node to use Obstacks in order
          to cache memory allocation for keyword strings and List_Nodes.
        * Continued to experiment with inheritance schemes.
        * Added a new file `alpha.h', that declares static data shared
          (i.e., inherited) between classes List_Node and Key_List.

Tue Sep 12 16:14:41 1989  Doug Schmidt  (schmidt at

        * Made numerous changes to incorporate multiple inheritance in 

Wed Aug 16 23:04:08 1989  Doug Schmidt  (schmidt at

        * Added the -DCOMPILER_FIXED flag to the ./src/Makefile.  This
          implies that people trying to compile gperf need to have a
          working version of the new g++ compiler (1.36.0).

        * Removed some extra spaces that were being added in the generated
          C code.

Mon Jul 24 17:09:46 1989  Doug Schmidt  (schmidt at

        * Fixed PRINT_HASH_FUNCTION and PRINT_LOOKUP_FUNCTION in keylist.c
          so that the generated functions take an unsigned int length argument.
          If -a is enabled the prototype is (const char *str, size_t len).

Fri Jul 21 13:06:15 1989  Doug Schmidt  (schmidt at

        * Fixed a typo in PRINT_KEYWORD_TABLE in that prevented
          the indentation from working correctly.

        * Fixed a horrible typo in PRINT_KEYWORD_TABLE in
          that prevented links from being printed correctly.

Tue Jul 18 16:04:31 1989  Doug Schmidt  (schmidt at

        * Fixed up and readline.h so that they work OK
          with g++ compilers that aren't completely up-to-date.
          If symbol COMPILER_FIXED is defined then the behavior
          that works on my more recent version of g++ is enabled.

Sun Jul  9 17:53:28 1989  Doug Schmidt  (schmidt at

        * Changed the ./tests subdirectory Makefile so that it 
          uses $(CC) instead of gcc.

Sun Jul  2 21:52:15 1989  Doug Schmidt  (schmidt at

        * Fixed a number of subtle bugs that occurred when -S was
          combined with various and sundry options.

        * Added the -G option, that makes the generated keyword table
          a global static variable, rather than hiding it inside
          the lookup function.  This allows other functions to directly
          access the contents in this table.

        * Added the "#" feature, that allows comments inside the keyword
          list from the input file. Comment handling takes place in readline.c.  
          This simplifies the code and reduces the number of malloc calls.
        * Also added the -H option (user can give the name of the hash
          function) and the -T option (prevents the transfer of the type decl
          to the output file, which is useful if the type is already defined

Thu Jun 22 20:39:39 1989  Doug Schmidt  (schmidt at

        * Modified many classes so that they would inherit Std_Err as
          a base class.  This makes things more abstract...

Fri Jun 16 14:23:00 1989  Doug Schmidt  (schmidt at

        * Modified the -f (FAST) option.  This now takes an argument.
          The argument corresponds to the number of iterations used
          to resolve collisions.  -f 0 uses the length of the
          keyword list (which is what -f did before).  This makes
          life much easier when dealing with large keyword files.

Tue Jun  6 17:53:27 1989  Doug Schmidt  (schmidt at

        * Added the -c (comparison) option.  Enabling this
          will use the strncmp function for string comparisons.
          The default is to use strcmp.

        * Fixed a typo in (PRINT_SWITCH).  This caused
          faulty C code to be generated when the -D, -p, and -t
          options were all enabled.

Thu May 25 14:07:21 1989  Doug Schmidt  (schmidt at

        * Once again, changed class Read_Line to overload global operator
          new.  Hopefully, this will work...!

Sun May 21 01:51:45 1989  Doug Schmidt  (schmidt at

        * Modified Key_List::print_hash_function () so that it properly
          formats the associated values in the hash table according to
          the maximum number of digits required to represent the largest

        * Removed the named return value from class Hash_Table's
          operator (), since this causes a seg fault when -O is enabled.
          No sense tripping subtle g++ bugs if we don't have to.... ;-)

        * Removed the operator new hack from Read_Line, since this seemed
          to create horrible bus error problems.
        * Changed many class member functions and data members to be `static', 
          if they don't manipulate this!
Fri May 12 23:06:56 1989  Doug Schmidt  (schmidt at

        * Changed class Std_Err to use static member functions, a la
          Ada or Modula 2.  This eliminates the need for an explicit
          error-handler class object.

        * Added the ``named return value'' feature to Hash_Table::operator ()
          and Bool_Array::operator [], just for the heck of it.... ;-)

        * Changed the previous hack in Read_Line so that we now use
          the overloaded global `new' instead of NEW_STRING!

Wed May  3 17:36:55 1989  Doug Schmidt  (schmidt at

        * Updated to version 1.7.  This reflects the recent major changes
          and the new C port.

        * Modified the GNU routine to have a class-based interface.

        * Fixed a typo in ~Perfect that prevented the actual maximum
          hash table size from being printed (maybe the stream classes
          weren't so bad after all.... ;-).

        * Added support for the -f option.  This generates the perfect
          hash function ``fast.''  It reduces the execution time of
          gperf, at the cost of minimizing the range of hash values.

Tue May  2 16:23:29 1989  Doug Schmidt  (schmidt at

        * Added an efficiency hack to Read_Line.  Instead of making
          a call to operator NEW (a.k.a. malloc) for each input string
          a new member function NEW_STRING stores a large buffer from
          which new strings are carved out, growing the buffer if
          necessary.  It might be useful to add this throughout the

        * Removed all unnecessary calls to DELETE.  If the program is about
          to exit it is silly to waste time freeing memory.

        * Added the GNU getopt program to the distribution.  This makes
          GPERF portable to systems that don't include getopt in libc.
        * Added a strcspn member to class Key_List.  This also increases

        * Added the get_include_src function from keylist.c as a member
          function in class Key_List.  Hopefully every function is 
          now associated with a class.  This aids abstraction and

        * Ported gperf to C.  From now on both K&R C and GNU G++ versions
          will be supported.  There will be two ChangeLog files, one
          for each version of the program.

Mon May  1 16:41:45 1989  Doug Schmidt  (schmidt at

        * Fixed a bug with -k'*'.  This now prints out *all* the cases
          up to the length of the longest word in the keyword set.

Sun Apr 30 12:15:25 1989  Doug Schmidt  (schmidt at

        * Removed all use of the stream classes.  Too ugly, slow, and
          not handled by the c++-mode formatter....

        * Modified the handling of links (i.e., keywords that have
          identical hash values as other keywords).  This should 
          speed up hash function generation for keyword sets with
          many duplicate entries.  The trick is to treat duplicate
          values as equivalence classes, so that each set of duplicate
          values is represented only once in the main list processing.

        * Fixed some capitialization typos and indentations mistakes in 

Sat Apr 29 12:04:03 1989  Doug Schmidt  (schmidt at

        * Fixed a typo/logico in Key_List::print_switch that prevented
          the last keyword in the keyword list to be print out.  This
          requires further examination.....

        * Fixed a stupid bug in List_Node::List_node.  If the -k'*' option
          was enabled the KEY_SET string wasn't getting terminated with

Fri Apr 28 12:38:35 1989  Doug Schmidt  (schmidt at

        * Renamed strexp.h and to iterator.h and
          Also changed the strexp class to iterator.  Continued to work
          on style...

        * Updated the version number to 1.6.  This reflects all the 
          recent changes.

Thu Apr 27 00:14:51 1989  Doug Schmidt  (schmidt at

        * Added the -D option that properly handles keyword sets that
          contain duplicate hash values.

        * Continued the stylistic changes.  Added the #pragma once
          directive to all the *.h files.  Removed all #defines and
          replaced them with static consts.  Also moved the key_sort
          routine from into the options class as a 
          member function.

Mon Apr  3 13:26:55 1989  Doug Schmidt  (schmidt at

        * Made massive stylistic changes to bring source code into
          conformance with GNU style guidelines.

Thu Mar 30 23:28:45 1989  Doug Schmidt  (schmidt at

        * Fixed up the output routines so that they generate code
          corresponding to the GNU style guidelines.

Sat Mar 11 13:12:37 1989  Doug Schmidt  (schmidt at

        * Fixed Stderr constructors so that they wouldn't try to
          use the base class initializer syntax for the static 
          class variable Program_Name.  G++ 1.34 is stricter in
          enforcing the rules!

Fri Mar 10 11:24:14 1989  Doug Schmidt  (schmidt at

        * Removed -v and ``| more'' from the Makefile to keep rfg happy...

Thu Mar  2 12:37:30 1989  Doug Schmidt  (schmidt at

        * Sent latest GNU gperf version 1.5 to Doug Lea for inclusion
          into libg++ 1.34.  Note that there is a small bug with
          the new %{ ... %} source inclusion facility, since it doesn't
          understand comments and will barf if %{ or %} appear nested
          inside the outermost delimiters.  This is too trivial of
          a defect to fix at the moment...

Tue Feb 28 11:19:58 1989  Doug Schmidt  (schmidt at

        * Added the -K option, which allows the user to provide a
          alternative name for the keyword structure component.
          The default is still ``name.''

        * Added the LEX and YACC-like ability to include arbitrary
          text at the beginning of the generated C source code output.
          This required two new functions Get_Special_Input, 

        * Fixed memory allocation bug in Key_List::Set_Types.
          Variable Return_Type needs 1 additional location
          to store the "*" if the -p option is used.
        * Added code to NULL terminate both Struct_Tag and Return_Type,
          *after* the strncpy (stupid mistake).
Mon Feb 27 14:39:51 1989  Doug Schmidt  (schmidt at

        * Added a new option -N.  This allows the user to specify the
          name to be used for the generated lookup function.  The
          default name is still ``in_word_set.''  This makes it
          possible to completely automate the perfect hash function
          generation process!

Mon Feb 20 23:33:14 1989  Doug Schmidt  (schmidt at

        * Corrected the Hash_Table::operator () function so that
          *it* is responsible for deciding when a new key has the
          same signature as a previously seen key.  The key length 
          information is now used internally to this function to
          decide whether to add to the hash table those keys with
          the same key sets, but different lengths.  Before, this
          was handled by the Key_List::Read_Keys function.  However,
          this failed to work for certain duplicate keys, since
          they weren't being entered into the hash table properly.

Sun Feb 19 16:02:51 1989  Doug Schmidt  (schmidt at

        * Modified class Options by moving the enum Option_Type out
          of the class.  This is to satisfy the new enumeration
          scope rules in C++.

Sun Jan 15 15:12:09 1989  Doug Schmidt  (schmidt at

        * Incremented the version number upto 1.4 to reflect the new 
          options that affect the generated code.  Send the new 
          distribution off to Michael for use with g++ 1.33.

        * Added a fix to Key_List::Read_Keys so that it checks for links
          properly when the -n option is used.  Previously, it didn't
          catch obvious links, which caused it to spend large amount
          of time searching for a solution that could never occur!

        * Modified the Key_List data structure to record *both* the 
          minimum and the maximum key lengths.  This information
          is now computed in Key_List::Read_Keys, and thus 
          Key_List::Print_Min_Max doesn't need to bother.

        * Modifed the key position iterator scheme in to
          eliminate the need for member function Options::Advance.
          Now, the Options::Get function performs the advancement
          automatically, obviating the need for an extra function call.

        * Added the new function Options::Print_Options, to print out
          the user-specified command line options to generated C
          output file.

        * Added a new function, Key_List::Print_Keylength_Table,
          which creates a table of lengths for use in speeding
          up the keyword search.  This also meant that a new
          option, -l (LENTABLE) is recognized.  It controls 
          whether the length table is printed and the comparison
          made in the generated function ``in_word_set.''

        * Added a comment at the top of the generated C code
          output file that tells what version of gperf was used.
          Next, I'll also dump out the command line options
          as a comment too.  Thanks to Michael Tiemann for the
          feedback on this.

        * Fixed the -n option to make it work correctly with
          other parts of the program (most notably the Perfect::Hash
          function and the computation of minimum and maximum lengths.

Fri Jan 13 21:25:27 1989  Doug Schmidt  (schmidt at

        * Realized the the need to add a test that will enable
          optimziation of the generated C code in the ``hash'' function
          by checking whether all the requested key positions are
          guaranteed to exist due to the comparison in `in_word_set.''
          I'll put this in soon....

Thu Jan 12 20:09:21 1989  Doug Schmidt  (schmidt at

        * Added pascal, modula3, and modula2 tests inputs to the 
        * Recognised that there is a bug with the -n option.  However
          I'm too busy to fix it properly, right now.  The problem 
          is that the generated #define end up being 0, since that's
          my hack to make -n work.  This needs complete rethinking!

Tue Jan 10 00:08:16 1989  Doug Schmidt  (schmidt at

        * Added a new option, -n, that instructs gperf to not use the
          length of an identifier when computing the hash functions.
          I'm not sure how useful this is!
        * Retransmitted the distribution to  Hopefully,
          this will work!

        * Began fixing the indentation and capitalization to conform
          to the GNU coding guidelines.

Mon Jan  9 22:23:18 1989  Doug Schmidt  (schmidt at

        * Fixed horrible bug in Read_Line::Readln_Aux.  This was
          a subtle and pernicous off-by-1 error, that overwrote
          past the last character of the input string buffer.  I
          think this fault was killing the vax!

        * Yow, fixed an oversight in List_Node::List_Node, where the
          pointer field Next was uninitialized.  Luckily, the new routine
          seems to return 0 filled objects the first time through!

Sun Jan  8 13:43:14 1989  Doug Schmidt  (schmidt at

        * Modified the ``key linked'' diagnostic in Key_List::Read_Keys
          to be more helpful and easy to read.

        * Fixed the List_Node::List_Node so that it would ignore trailing
          fields if the -t option was not enabled.

        * Moved the List_Node declarations out of keylist.h and
          into a file of its own, called and listnode.h
          Made Set_Sort a member function of class List_Node.

        * Massively updated the documentation in the gperf.texinfo file.
        * Polished off the major revision to the print functions,
          added a few new tests in the Makefile to check for the
          validity of the program and ftp'ed the entire distribution
          off to Doug Lea for libg++. ( changed it to
          1.3 to reflect the major changes with the generated
          C code ).

        * Fixed Key_List::Print_Switch to deal with the -p and -t options.
          This meant that the ``still-born'' function Key_List::
          Print_Type_Switch was superflous, so I removed it.
          Also, removed the restriction in Option that the -p and
          -t options couldn't be used simultaneously.

        * Modified List_Node::List_Node, to perform only 1 call to 
          ``new'' when dynamically allocating memory for the Key_Set
          and the Uniq_Set.

Sat Jan  7 14:10:51 1989  Doug Schmidt  (schmidt at

        * Fixed a big bug with the new policy of nesting the
          wordlist inside of generated function ``in_word_set.''
          I'd forgotten to declare the wordlist array as static!
          ( arrgh ).

        * Added a new function Key_List::Set_Types, that figures out
          the return type for generated function ``in_word_set,''
          the user-defined ``struct tag,'' if one is used, and also
          formates the array type for the static local array.

        * Changed the print routines to take advantage of the
          new -p option.

        * Began adding the hooks to allow the return of a pointer
          to a user defined struct location from the generated
          ``in_word_set'' function instead of the current 0 or 1
          return value.  Created function Key_List::Print_Type_Switch
          and added option -p to class Option, allowing the user to 
          request generation of the aforementioned pointers returned 
          instead of booleans.

        * Put in checks in class Option to make sure that -S and -t
          options are not used simultaneously.  This restriction
          will be removed in subsequent releases, once I decide on
          a clean way to implement it.

        * Sent version 1.2 to Doug Lea for possible inclusion into
          the libg++ distribution.
        * Moved the static word_list array inside the generated function
          in_word_set.  This supports better data hiding.

        * Added a texinfo file, gperf.texinfo
        * Revised the Makefile to cleanup the droppings from texinfo
          and changed the name of and gperf.h to
          and perfect.h.

Fri Jan  6 13:04:45 1989  Doug Schmidt  (schmidt at

        * Implemented the switch statement output format.  Much better
          for large datasets in terms of space used.

        * Added new functions to break up the Key_List::Output function.
          Functions added were Key_List::Print_Switch, Key_List::Print_Min_Max,
          Key_List::Print_Keyword_Table, Key_List::Print_Hash_Function,
          and Key_List::Print_Lookup_Function.  This simplifies the
          big mess in Key_List::Output considerably!
        * Added switch statement option to Options, which potentially 
          trades time for space in the generated lookup code.

Thu Jan  5 22:46:34 1989  Doug Schmidt  (schmidt at

        * Released version 1.1
        * Fixed a bug with Gperf::Merge_Set, it was skipping letters shared
          between the Set_1 and Set_2.

        * Added the optimal min/max algorithm in Key_List::Output.  This
          runs in O ( 3n/2 ), rather than O ( 2n ) time.

        * Changed Gperf::Sort_Set to use insertion sort, rather than
          bubble sort.
        * Added a check in Key_List::Output for the special case where
          the keys used are 1,$.  It is possible to generate more
          efficient C code in this case.