summaryrefslogtreecommitdiffstats
path: root/contrib/gperf/src
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-10-13 12:04:55 +0000
committerobrien <obrien@FreeBSD.org>2000-10-13 12:04:55 +0000
commitd415827ca360fa27bf0af6104e649b30d4df5224 (patch)
tree1da9cb0dfdb8e324499740e1529a5cb44f2d1d33 /contrib/gperf/src
parent78febb770f5e3e21f28c400f72a248c8dd94948e (diff)
parent0bdce46a07b97a95e39e8b8ff75500596236ec27 (diff)
downloadFreeBSD-src-d415827ca360fa27bf0af6104e649b30d4df5224.zip
FreeBSD-src-d415827ca360fa27bf0af6104e649b30d4df5224.tar.gz
This commit was generated by cvs2svn to compensate for changes in r67064,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/gperf/src')
-rw-r--r--contrib/gperf/src/Makefile.in13
-rwxr-xr-xcontrib/gperf/src/configure269
-rw-r--r--contrib/gperf/src/configure.in10
-rw-r--r--contrib/gperf/src/gen-perf.cc65
-rw-r--r--contrib/gperf/src/gen-perf.h4
-rw-r--r--contrib/gperf/src/hash-table.cc36
-rw-r--r--contrib/gperf/src/hash-table.h7
-rw-r--r--contrib/gperf/src/iterator.cc3
-rw-r--r--contrib/gperf/src/key-list.cc421
-rw-r--r--contrib/gperf/src/list-node.cc29
-rw-r--r--contrib/gperf/src/list-node.h7
-rw-r--r--contrib/gperf/src/main.cc6
-rw-r--r--contrib/gperf/src/options.cc71
-rw-r--r--contrib/gperf/src/options.h4
-rw-r--r--contrib/gperf/src/options.icc10
-rw-r--r--contrib/gperf/src/version.cc4
16 files changed, 686 insertions, 273 deletions
diff --git a/contrib/gperf/src/Makefile.in b/contrib/gperf/src/Makefile.in
index ec1e682..60f73c7 100644
--- a/contrib/gperf/src/Makefile.in
+++ b/contrib/gperf/src/Makefile.in
@@ -1,6 +1,6 @@
# Makefile for gperf/src
-# Copyright (C) 1989, 1992, 1993, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1989, 1992, 1993, 1998, 2000 Free Software Foundation, Inc.
# written by Douglas C. Schmidt (schmidt@ics.uci.edu)
#
# This file is part of GNU GPERF.
@@ -39,6 +39,8 @@ CPP = @CPP@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CXXCPP = @CXXCPP@
+# Both C and C++ compiler
+LDFLAGS = @LDFLAGS@
# Other
MV = mv
LN = ln
@@ -49,6 +51,7 @@ RM = rm -f
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = $(SHELL) $(srcdir)/../mkinstalldirs
#### End of system configuration section. ####
@@ -119,14 +122,14 @@ version.o : version.cc $(VERSION_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/version.cc
install : all force
- if [ ! -d $(bindir) ] ; then mkdir $(bindir) ; fi
- $(INSTALL_PROGRAM) $(TARGETPROG) $(bindir)/$(TARGETPROG)
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+ $(INSTALL_PROGRAM) $(TARGETPROG) $(DESTDIR)$(bindir)/$(TARGETPROG)
installdirs : force
- if [ ! -d $(bindir) ] ; then mkdir $(bindir) ; fi
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
uninstall : force
- $(RM) $(bindir)/$(TARGETPROG)
+ $(RM) $(DESTDIR)$(bindir)/$(TARGETPROG)
check : all
diff --git a/contrib/gperf/src/configure b/contrib/gperf/src/configure
index d3d1091..edd1fd7 100755
--- a/contrib/gperf/src/configure
+++ b/contrib/gperf/src/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12
+# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -49,6 +49,7 @@ mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
@@ -332,7 +333,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12"
+ echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
@@ -502,9 +503,11 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
+ac_exeext=
+ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -520,7 +523,7 @@ fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:524: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:527: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -549,15 +552,16 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:553: checking for $ac_word" >&5
+echo "configure:556: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@@ -578,16 +582,17 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:582: checking for $ac_word" >&5
+echo "configure:586: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -622,25 +627,61 @@ else
echo "$ac_t""no" 1>&6
fi
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:637: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:630: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:669: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-cat > conftest.$ac_ext <<EOF
-#line 640 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 680 "configure"
#include "confdefs.h"
+
main(){return(0);}
EOF
-if { (eval echo configure:644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -654,18 +695,24 @@ else
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:664: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:711: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:669: checking whether we are using GNU C" >&5
+echo "configure:716: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -674,7 +721,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -685,11 +732,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:693: checking whether ${CC-cc} accepts -g" >&5
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:744: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -704,20 +755,24 @@ rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
- CFLAGS="-O2"
+ CFLAGS="-g"
fi
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:721: checking how to run the C preprocessor" >&5
+echo "configure:776: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -732,14 +787,14 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 736 "configure"
+#line 791 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -749,14 +804,31 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 753 "configure"
+#line 808 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 825 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -769,6 +841,8 @@ fi
rm -f conftest*
fi
rm -f conftest*
+fi
+rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
CPP="$ac_cv_prog_CPP"
@@ -777,20 +851,21 @@ else
fi
echo "$ac_t""$CPP" 1>&6
- for ac_prog in $CCC c++ g++ gcc CC cxx cc++
+ for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:786: checking for $ac_word" >&5
+echo "configure:860: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CXX="$ac_prog"
@@ -813,21 +888,23 @@ test -n "$CXX" || CXX="gcc"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:817: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:892: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
-cat > conftest.$ac_ext <<EOF
-#line 827 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 903 "configure"
#include "confdefs.h"
-main(){return(0);}
+
+int main(){return(0);}
EOF
-if { (eval echo configure:831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -845,7 +922,7 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
@@ -853,12 +930,12 @@ if test $ac_cv_prog_cxx_works = no; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:857: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:934: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:862: checking whether we are using GNU C++" >&5
+echo "configure:939: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -867,7 +944,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@@ -878,11 +955,15 @@ echo "$ac_t""$ac_cv_prog_gxx" 1>&6
if test $ac_cv_prog_gxx = yes; then
GXX=yes
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS=
- echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:886: checking whether ${CXX-g++} accepts -g" >&5
+else
+ GXX=
+fi
+
+ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ac_save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS=
+echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
+echo "configure:967: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -897,20 +978,24 @@ rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
- if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
- elif test $ac_cv_prog_cxx_g = yes; then
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
- CXXFLAGS="-O2"
+ CXXFLAGS="-g"
fi
else
- GXX=
- test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
fi
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:914: checking how to run the C++ preprocessor" >&5
+echo "configure:999: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -919,17 +1004,17 @@ else
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 927 "configure"
+#line 1012 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:932: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -945,7 +1030,7 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
fi
fi
@@ -963,7 +1048,7 @@ echo "$ac_t""$CXXCPP" 1>&6
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:967: checking for a BSD compatible install" >&5
+echo "configure:1052: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'cl_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -988,7 +1073,7 @@ else
# AIX installbsd doesn't work without option "-g".
:
else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
+ cl_cv_path_install="$ac_dir/$ac_prog -c"
break 2
fi
fi
@@ -1016,8 +1101,8 @@ if test -z "$INSTALL_DATA"; then
fi
echo $ac_n "checking for working throw()""... $ac_c" 1>&6
-echo "configure:1020: checking for working throw()" >&5
-if eval "test \"`echo '$''{'gp_cxx_throw_decl'+set}'`\" = set"; then
+echo "configure:1105: checking for working throw()" >&5
+if eval "test \"`echo '$''{'gp_cv_cxx_throw_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1026,11 +1111,11 @@ ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF
-#line 1034 "configure"
+#line 1119 "configure"
#include "confdefs.h"
#include <stdlib.h>
void operator delete (void* ptr) throw() {}
@@ -1038,28 +1123,28 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:1042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- gp_cxx_throw_decl=yes
+ gp_cv_cxx_throw_decl=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- gp_cxx_throw_decl=no
+ gp_cv_cxx_throw_decl=no
fi
rm -f conftest*
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
fi
-echo "$ac_t""$gp_cxx_throw_decl" 1>&6
-if test $gp_cxx_throw_decl = yes; then
+echo "$ac_t""$gp_cv_cxx_throw_decl" 1>&6
+if test $gp_cv_cxx_throw_decl = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_THROW_DECL 1
EOF
@@ -1069,18 +1154,18 @@ for ac_hdr in unistd.h sys/time.h sys/resource.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1073: checking for $ac_hdr" >&5
+echo "configure:1158: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1078 "configure"
+#line 1163 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1083: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -1109,12 +1194,12 @@ done
for ac_func in getrlimit
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1113: checking for $ac_func" >&5
+echo "configure:1198: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1118 "configure"
+#line 1203 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1137,7 +1222,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1165,12 +1250,12 @@ done
for ac_func in setrlimit
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1169: checking for $ac_func" >&5
+echo "configure:1254: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1174 "configure"
+#line 1259 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1193,7 +1278,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1242,7 +1327,7 @@ EOF
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
- case `(ac_space=' '; set) 2>&1` in
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
@@ -1309,7 +1394,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12"
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -1328,9 +1413,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
+s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
diff --git a/contrib/gperf/src/configure.in b/contrib/gperf/src/configure.in
index 68d267c..e8880d5 100644
--- a/contrib/gperf/src/configure.in
+++ b/contrib/gperf/src/configure.in
@@ -1,6 +1,6 @@
dnl autoconf configuration for gperf/src
-dnl Copyright (C) 1998 Free Software Foundation, Inc.
+dnl Copyright (C) 1998, 2000 Free Software Foundation, Inc.
dnl written by Douglas C. Schmidt (schmidt@ics.uci.edu)
dnl
dnl This file is part of GNU GPERF.
@@ -40,16 +40,16 @@ dnl
dnl checks for compiler characteristics
dnl
AC_MSG_CHECKING([for working throw()])
-AC_CACHE_VAL(gp_cxx_throw_decl,[
+AC_CACHE_VAL(gp_cv_cxx_throw_decl,[
AC_LANG_SAVE()
AC_LANG_CPLUSPLUS()
AC_TRY_COMPILE([#include <stdlib.h>
void operator delete (void* ptr) throw() {}], [],
-gp_cxx_throw_decl=yes, gp_cxx_throw_decl=no)
+gp_cv_cxx_throw_decl=yes, gp_cv_cxx_throw_decl=no)
AC_LANG_RESTORE()
])
-AC_MSG_RESULT([$]gp_cxx_throw_decl)
-if test [$]gp_cxx_throw_decl = yes; then
+AC_MSG_RESULT([$]gp_cv_cxx_throw_decl)
+if test [$]gp_cv_cxx_throw_decl = yes; then
AC_DEFINE(HAVE_THROW_DECL)
fi
dnl
diff --git a/contrib/gperf/src/gen-perf.cc b/contrib/gperf/src/gen-perf.cc
index 0d0ad41..0b5109d 100644
--- a/contrib/gperf/src/gen-perf.cc
+++ b/contrib/gperf/src/gen-perf.cc
@@ -1,6 +1,6 @@
/* Provides high-level routines to manipulate the keywork list
structures the code generation output.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -81,37 +81,45 @@ Gen_Perf::Gen_Perf (void)
}
/* Merge two disjoint hash key multisets to form the ordered disjoint union of the sets.
- (In a multiset, an element can occur multiple times).
+ (In a multiset, an element can occur multiple times.)
Precondition: both set_1 and set_2 must be ordered. Returns the length
of the combined set. */
inline int
-Gen_Perf::compute_disjoint_union (const char *set_1, const char *set_2, char *set_3)
+Gen_Perf::compute_disjoint_union (const char *set_1, int size_1, const char *set_2, int size_2, char *set_3)
{
T (Trace t ("Gen_Perf::compute_disjoint_union");)
char *base = set_3;
- while (*set_1 && *set_2)
+ while (size_1 > 0 && size_2 > 0)
if (*set_1 == *set_2)
- set_1++, set_2++;
+ set_1++, size_1--, set_2++, size_2--;
else
{
- *set_3 = *set_1 < *set_2 ? *set_1++ : *set_2++;
- if (set_3 == base || *set_3 != *(set_3-1)) set_3++;
+ char next;
+ if (*set_1 < *set_2)
+ next = *set_1++, size_1--;
+ else
+ next = *set_2++, size_2--;
+ if (set_3 == base || next != set_3[-1])
+ *set_3++ = next;
}
- while (*set_1)
+ while (size_1 > 0)
{
- *set_3 = *set_1++;
- if (set_3 == base || *set_3 != *(set_3-1)) set_3++;
+ char next;
+ next = *set_1++, size_1--;
+ if (set_3 == base || next != set_3[-1])
+ *set_3++ = next;
}
- while (*set_2)
+ while (size_2 > 0)
{
- *set_3 = *set_2++;
- if (set_3 == base || *set_3 != *(set_3-1)) set_3++;
+ char next;
+ next = *set_2++, size_2--;
+ if (set_3 == base || next != set_3[-1])
+ *set_3++ = next;
}
- *set_3 = '\0';
return set_3 - base;
}
@@ -146,10 +154,12 @@ inline int
Gen_Perf::hash (List_Node *key_node)
{
T (Trace t ("Gen_Perf::hash");)
- int sum = option[NOLENGTH] ? 0 : key_node->length;
+ int sum = option[NOLENGTH] ? 0 : key_node->key_length;
- for (const char *ptr = key_node->char_set; *ptr; ptr++)
- sum += asso_values[(unsigned char)(*ptr)];
+ const char *p = key_node->char_set;
+ int i = key_node->char_set_length;
+ for (; i > 0; p++, i--)
+ sum += asso_values[(unsigned char)(*p)];
return key_node->hash_value = sum;
}
@@ -209,28 +219,35 @@ Gen_Perf::change (List_Node *prior, List_Node *curr)
{
T (Trace t ("Gen_Perf::change");)
static char *union_set;
+ int union_set_length;
if (!union_set)
- union_set = new char [2 * option.get_max_keysig_size () + 1];
+ union_set = new char [2 * option.get_max_keysig_size ()];
if (option[DEBUG])
{
- fprintf (stderr, "collision on keyword #%d, prior = \"%s\", curr = \"%s\" hash = %d\n",
- num_done, prior->key, curr->key, curr->hash_value);
+ fprintf (stderr, "collision on keyword #%d, prior = \"%.*s\", curr = \"%.*s\" hash = %d\n",
+ num_done,
+ prior->key_length, prior->key,
+ curr->key_length, curr->key,
+ curr->hash_value);
fflush (stderr);
}
- sort_set (union_set, compute_disjoint_union (prior->char_set, curr->char_set, union_set));
+ union_set_length = compute_disjoint_union (prior->char_set, prior->char_set_length, curr->char_set, curr->char_set_length, union_set);
+ sort_set (union_set, union_set_length);
/* Try changing some values, if change doesn't alter other values continue normal action. */
fewest_collisions++;
- for (char *temp = union_set; *temp; temp++)
- if (!affects_prev (*temp, curr))
+ const char *p = union_set;
+ int i = union_set_length;
+ for (; i > 0; p++, i--)
+ if (!affects_prev (*p, curr))
{
if (option[DEBUG])
{
fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n",
- *temp, temp - union_set + 1, asso_values[(unsigned char)(*temp)]);
+ *p, p - union_set + 1, asso_values[(unsigned char)(*p)]);
fflush (stderr);
}
return; /* Good, doesn't affect previous hash values, we'll take it. */
diff --git a/contrib/gperf/src/gen-perf.h b/contrib/gperf/src/gen-perf.h
index 09b8727..602d160 100644
--- a/contrib/gperf/src/gen-perf.h
+++ b/contrib/gperf/src/gen-perf.h
@@ -3,7 +3,7 @@
/* Provides high-level routines to manipulate the keyword list
structures the code generation output.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -38,7 +38,7 @@ private:
void change (List_Node *prior, List_Node *curr);
int affects_prev (char c, List_Node *curr);
static int hash (List_Node *key_node);
- static int compute_disjoint_union (const char *set_1, const char *set_2, char *set_3);
+ static int compute_disjoint_union (const char *set_1, int size_1, const char *set_2, int size_2, char *set_3);
static void sort_set (char *union_set, int len);
public:
diff --git a/contrib/gperf/src/hash-table.cc b/contrib/gperf/src/hash-table.cc
index db8d6dd..a147674 100644
--- a/contrib/gperf/src/hash-table.cc
+++ b/contrib/gperf/src/hash-table.cc
@@ -1,5 +1,5 @@
/* Hash table for checking keyword links. Implemented using double hashing.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -26,8 +26,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "options.h"
#include "trace.h"
-#define NIL(TYPE) (TYPE *)0
-
/* The size of the hash table is always the smallest power of 2 >= the size
indicated by the user. This allows several optimizations, including
the use of double hashing and elimination of the mod instruction.
@@ -37,8 +35,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
This compromises information hiding somewhat, but greatly reduces
memory fragmentation, since we can now use alloca! */
-Hash_Table::Hash_Table (List_Node **table_ptr, int s):
- table (table_ptr), size (s), collisions (0)
+Hash_Table::Hash_Table (List_Node **table_ptr, int s, int ignore_len):
+ table (table_ptr), size (s), collisions (0), ignore_length (ignore_len)
{
T (Trace t ("Hash_Table::Hash_Table");)
memset ((char *) table, 0, size * sizeof (*table));
@@ -60,8 +58,10 @@ Hash_Table::~Hash_Table (void)
for (int i = size - 1; i >= 0; i--)
if (table[i])
- fprintf (stderr, "%8d, %*s, %s\n",
- i, field_width, table[i]->char_set, table[i]->key);
+ fprintf (stderr, "%8d, %*.*s, %.*s\n",
+ i,
+ field_width, table[i]->char_set_length, table[i]->char_set,
+ table[i]->key_length, table[i]->key);
fprintf (stderr, "\nend dumping hash table\n\n");
}
@@ -72,20 +72,24 @@ Hash_Table::~Hash_Table (void)
Uses double hashing. */
List_Node *
-Hash_Table::operator() (List_Node *item, int ignore_length)
+Hash_Table::insert (List_Node *item)
{
T (Trace t ("Hash_Table::operator()");)
- unsigned hash_val = hashpjw (item->char_set);
- int probe = hash_val & size - 1;
- int increment = (hash_val ^ item->length | 1) & size - 1;
+ unsigned hash_val = hashpjw (item->char_set, item->char_set_length);
+ int probe = hash_val & (size - 1);
+ int increment = ((hash_val ^ item->key_length) | 1) & (size - 1);
- while (table[probe]
- && (strcmp (table[probe]->char_set, item->char_set)
- || (!ignore_length && table[probe]->length != item->length)))
+ while (table[probe])
{
+ if (table[probe]->char_set_length == item->char_set_length
+ && memcmp (table[probe]->char_set, item->char_set, item->char_set_length) == 0
+ && (ignore_length || table[probe]->key_length == item->key_length))
+ return table[probe];
+
collisions++;
- probe = probe + increment & size - 1;
+ probe = (probe + increment) & (size - 1);
}
- return table[probe] ? table[probe] : (table[probe] = item, NIL (List_Node));
+ table[probe] = item;
+ return (List_Node *) 0;
}
diff --git a/contrib/gperf/src/hash-table.h b/contrib/gperf/src/hash-table.h
index 7d23999..86438d0 100644
--- a/contrib/gperf/src/hash-table.h
+++ b/contrib/gperf/src/hash-table.h
@@ -2,7 +2,7 @@
/* Hash table used to check for duplicate keyword entries.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -32,11 +32,12 @@ private:
List_Node **table; /* Vector of pointers to linked lists of List_Node's. */
int size; /* Size of the vector. */
int collisions; /* Find out how well our double hashing is working! */
+ int ignore_length;
public:
- Hash_Table (List_Node **t, int s);
+ Hash_Table (List_Node **t, int s, int ignore_len);
~Hash_Table (void);
- List_Node *operator () (List_Node *item, int ignore_length);
+ List_Node *insert (List_Node *item);
};
#endif
diff --git a/contrib/gperf/src/iterator.cc b/contrib/gperf/src/iterator.cc
index dd9d27e..ca66bbb 100644
--- a/contrib/gperf/src/iterator.cc
+++ b/contrib/gperf/src/iterator.cc
@@ -1,5 +1,5 @@
/* Provides an Iterator for keyword characters.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -20,7 +20,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "iterator.h"
-#include <stream.h>
#include <ctype.h>
#include "trace.h"
diff --git a/contrib/gperf/src/key-list.cc b/contrib/gperf/src/key-list.cc
index 38341f3..1c941a4 100644
--- a/contrib/gperf/src/key-list.cc
+++ b/contrib/gperf/src/key-list.cc
@@ -1,5 +1,5 @@
/* Routines for building, ordering, and printing the keyword list.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -21,6 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <stdio.h>
#include <string.h> /* declares strncpy(), strchr() */
#include <stdlib.h> /* declares malloc(), free(), abs(), exit(), abort() */
+#include <ctype.h> /* declares isprint() */
#include <assert.h> /* defines assert() */
#include <limits.h> /* defines SCHAR_MAX etc. */
#include "options.h"
@@ -209,6 +210,144 @@ Key_List::set_output_types (void)
}
}
+/* Extracts a key from an input line and creates a new List_Node for it. */
+
+static List_Node *
+parse_line (const char *line, const char *delimiters)
+{
+ if (*line == '"')
+ {
+ /* Parse a string in ANSI C syntax. */
+ char *key = new char[strlen(line)];
+ char *kp = key;
+ const char *lp = line + 1;
+
+ for (; *lp;)
+ {
+ char c = *lp;
+
+ if (c == '\0')
+ {
+ fprintf (stderr, "unterminated string: %s\n", line);
+ exit (1);
+ }
+ else if (c == '\\')
+ {
+ c = *++lp;
+ switch (c)
+ {
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ {
+ int code = 0;
+ int count = 0;
+ while (count < 3 && *lp >= '0' && *lp <= '7')
+ {
+ code = (code << 3) + (*lp - '0');
+ lp++;
+ count++;
+ }
+ if (code > UCHAR_MAX)
+ fprintf (stderr, "octal escape out of range: %s\n", line);
+ *kp = (char) code;
+ break;
+ }
+ case 'x':
+ {
+ int code = 0;
+ int count = 0;
+ lp++;
+ while ((*lp >= '0' && *lp <= '9')
+ || (*lp >= 'A' && *lp <= 'F')
+ || (*lp >= 'a' && *lp <= 'f'))
+ {
+ code = (code << 4)
+ + (*lp >= 'A' && *lp <= 'F' ? *lp - 'A' + 10 :
+ *lp >= 'a' && *lp <= 'f' ? *lp - 'a' + 10 :
+ *lp - '0');
+ lp++;
+ count++;
+ }
+ if (count == 0)
+ fprintf (stderr, "hexadecimal escape without any hex digits: %s\n", line);
+ if (code > UCHAR_MAX)
+ fprintf (stderr, "hexadecimal escape out of range: %s\n", line);
+ *kp = (char) code;
+ break;
+ }
+ case '\\': case '\'': case '"':
+ *kp = c;
+ lp++;
+ break;
+ case 'n':
+ *kp = '\n';
+ lp++;
+ break;
+ case 't':
+ *kp = '\t';
+ lp++;
+ break;
+ case 'r':
+ *kp = '\r';
+ lp++;
+ break;
+ case 'f':
+ *kp = '\f';
+ lp++;
+ break;
+ case 'b':
+ *kp = '\b';
+ lp++;
+ break;
+ case 'a':
+ *kp = '\a';
+ lp++;
+ break;
+ case 'v':
+ *kp = '\v';
+ lp++;
+ break;
+ default:
+ fprintf (stderr, "invalid escape sequence in string: %s\n", line);
+ exit (1);
+ }
+ }
+ else if (c == '"')
+ break;
+ else
+ {
+ *kp = c;
+ lp++;
+ }
+ kp++;
+ }
+ lp++;
+ if (*lp != '\0')
+ {
+ if (strchr (delimiters, *lp) == NULL)
+ {
+ fprintf (stderr, "string not followed by delimiter: %s\n", line);
+ exit (1);
+ }
+ lp++;
+ }
+ return new List_Node (key, kp - key, option[TYPE] ? lp : "");
+ }
+ else
+ {
+ /* Not a string. Look for the delimiter. */
+ int len = strcspn (line, delimiters);
+ const char *rest;
+
+ if (line[len] == '\0')
+ rest = "";
+ else
+ /* Skip the first delimiter. */
+ rest = &line[len + 1];
+ return new List_Node (line, len, option[TYPE] ? rest : "");
+ }
+}
+
/* Reads in all keys from standard input and creates a linked list pointed
to by Head. This list is then quickly checked for ``links,'' i.e.,
unhashable elements possessing identical key sets and lengths. */
@@ -235,13 +374,13 @@ Key_List::read_keys (void)
const char *delimiter = option.get_delimiter ();
List_Node *temp, *trail = 0;
- head = new List_Node (ptr, strcspn (ptr, delimiter));
+ head = parse_line (ptr, delimiter);
for (temp = head;
(ptr = Read_Line::get_line ()) && strcmp (ptr, "%%");
temp = temp->next)
{
- temp->next = new List_Node (ptr, strcspn (ptr, delimiter));
+ temp->next = parse_line (ptr, delimiter);
total_keys++;
}
@@ -266,14 +405,14 @@ Key_List::read_keys (void)
#endif
/* Make large hash table for efficiency. */
- Hash_Table found_link (table, table_size);
+ Hash_Table found_link (table, table_size, option[NOLENGTH]);
/* Test whether there are any links and also set the maximum length of
an identifier in the keyword list. */
for (temp = head; temp; temp = temp->next)
{
- List_Node *ptr = found_link (temp, option[NOLENGTH]);
+ List_Node *ptr = found_link.insert (temp);
/* Check for links. We deal with these by building an equivalence class
of all duplicate values (i.e., links) so that only 1 keyword is
@@ -290,17 +429,19 @@ Key_List::read_keys (void)
/* Complain if user hasn't enabled the duplicate option. */
if (!option[DUP] || option[DEBUG])
- fprintf (stderr, "Key link: \"%s\" = \"%s\", with key set \"%s\".\n",
- temp->key, ptr->key, temp->char_set);
+ fprintf (stderr, "Key link: \"%.*s\" = \"%.*s\", with key set \"%.*s\".\n",
+ temp->key_length, temp->key,
+ ptr->key_length, ptr->key,
+ temp->char_set_length, temp->char_set);
}
else
trail = temp;
/* Update minimum and maximum keyword length, if needed. */
- if (max_key_len < temp->length)
- max_key_len = temp->length;
- if (min_key_len > temp->length)
- min_key_len = temp->length;
+ if (max_key_len < temp->key_length)
+ max_key_len = temp->key_length;
+ if (min_key_len > temp->key_length)
+ min_key_len = temp->key_length;
}
#if !LARGE_STACK_ARRAYS
@@ -320,6 +461,13 @@ Key_List::read_keys (void)
exit (1);
}
}
+ /* Exit program if an empty string is used as key, since the comparison
+ expressions don't work correctly for looking up an empty string. */
+ if (min_key_len == 0)
+ {
+ fprintf (stderr, "Empty input key is not allowed.\nTo recognize an empty input key, your code should check for\nlen == 0 before calling the gperf generated lookup function.\n");
+ exit (1);
+ }
if (option[ALLCHARS])
option.set_keysig_size (max_key_len);
}
@@ -400,8 +548,10 @@ Key_List::get_occurrence (List_Node *ptr)
T (Trace t ("Key_List::get_occurrence");)
int value = 0;
- for (const char *temp = ptr->char_set; *temp; temp++)
- value += occurrences[(unsigned char)(*temp)];
+ const char *p = ptr->char_set;
+ unsigned int i = ptr->char_set_length;
+ for (; i > 0; p++, i--)
+ value += occurrences[(unsigned char)(*p)];
return value;
}
@@ -413,8 +563,11 @@ inline void
Key_List::set_determined (List_Node *ptr)
{
T (Trace t ("Key_List::set_determined");)
- for (const char *temp = ptr->char_set; *temp; temp++)
- determined[(unsigned char)(*temp)] = 1;
+
+ const char *p = ptr->char_set;
+ unsigned int i = ptr->char_set_length;
+ for (; i > 0; p++, i--)
+ determined[(unsigned char)(*p)] = 1;
}
/* Returns TRUE if PTR's key set is already completely determined. */
@@ -425,8 +578,10 @@ Key_List::already_determined (List_Node *ptr)
T (Trace t ("Key_List::already_determined");)
int is_determined = 1;
- for (const char *temp = ptr->char_set; is_determined && *temp; temp++)
- is_determined = determined[(unsigned char)(*temp)];
+ const char *p = ptr->char_set;
+ unsigned int i = ptr->char_set_length;
+ for (; is_determined && i > 0; p++, i--)
+ is_determined = determined[(unsigned char)(*p)];
return is_determined;
}
@@ -653,20 +808,34 @@ Key_List::output_constants (struct Output_Constants& style)
/* ------------------------------------------------------------------------- */
/* Outputs a keyword, as a string: enclosed in double quotes, escaping
- backslashes and double quote characters. */
+ backslashes, double quote and unprintable characters. */
static void
-output_string (const char *key)
+output_string (const char *key, int len)
{
T (Trace t ("output_string");)
- char c;
putchar ('"');
- while (c = *key++, c != '\0')
+ for (; len > 0; len--)
{
- if (c == '"' || c == '\\')
- putchar ('\\');
- putchar (c);
+ unsigned char c = (unsigned char) *key++;
+ if (isprint (c))
+ {
+ if (c == '"' || c == '\\')
+ putchar ('\\');
+ putchar (c);
+ }
+ else
+ {
+ /* Use octal escapes, not hexadecimal escapes, because some old
+ C compilers didn't understand hexadecimal escapes, and because
+ hexadecimal escapes are not limited to 2 digits, thus needing
+ special care if the following character happens to be a digit. */
+ putchar ('\\');
+ putchar ('0' + ((c >> 6) & 7));
+ putchar ('0' + ((c >> 3) & 7));
+ putchar ('0' + (c & 7));
+ }
}
putchar ('"');
}
@@ -798,6 +967,36 @@ void Output_Compare_Strncmp::output_comparison (const Output_Expr& expr1,
expr1.output_expr ();
printf (" + 1, ");
expr2.output_expr ();
+ printf (" + 1, len - 1) && ");
+ expr2.output_expr ();
+ printf ("[len] == '\\0'");
+}
+
+/* This class outputs a comparison using memcmp.
+ Note that the length of expr1 (available through the local variable `len')
+ must be verified to be equal to the length of expr2 prior to this
+ comparison. */
+
+struct Output_Compare_Memcmp : public Output_Compare
+{
+ virtual void output_comparison (const Output_Expr& expr1,
+ const Output_Expr& expr2) const;
+ Output_Compare_Memcmp () {}
+ virtual ~Output_Compare_Memcmp () {}
+};
+
+void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
+ const Output_Expr& expr2) const
+{
+ T (Trace t ("Output_Compare_Memcmp::output_comparison");)
+ printf ("*");
+ expr1.output_expr ();
+ printf (" == *");
+ expr2.output_expr ();
+ printf (" && !memcmp (");
+ expr1.output_expr ();
+ printf (" + 1, ");
+ expr2.output_expr ();
printf (" + 1, len - 1)");
}
@@ -824,6 +1023,10 @@ Key_List::output_hash_function (void)
else if (option[KRC] | option[C] | option[ANSIC])
printf ("#ifdef __GNUC__\n"
"__inline\n"
+ "#else\n"
+ "#ifdef __cplusplus\n"
+ "inline\n"
+ "#endif\n"
"#endif\n");
if (option[KRC] | option[C] | option[ANSIC])
@@ -1013,7 +1216,7 @@ Key_List::output_keylength_table (void)
printf (",");
if ((column++ % columns) == 0)
printf("\n%s ", indent);
- printf ("%3d", temp->length);
+ printf ("%3d", temp->key_length);
/* Deal with links specially. */
if (temp->link) // implies option[DUP]
@@ -1023,7 +1226,7 @@ Key_List::output_keylength_table (void)
printf (",");
if ((column++ % columns) == 0)
printf("\n%s ", indent);
- printf ("%3d", links->length);
+ printf ("%3d", links->key_length);
}
index++;
@@ -1042,9 +1245,13 @@ output_keyword_entry (List_Node *temp, const char *indent)
printf ("%s ", indent);
if (option[TYPE])
printf ("{");
- output_string (temp->key);
+ output_string (temp->key, temp->key_length);
if (option[TYPE])
- printf (",%s}", temp->rest);
+ {
+ if (strlen (temp->rest) > 0)
+ printf (",%s", temp->rest);
+ printf ("}");
+ }
if (option[DEBUG])
printf (" /* hash value = %d, index = %d */",
temp->hash_value, temp->index);
@@ -1053,7 +1260,17 @@ output_keyword_entry (List_Node *temp, const char *indent)
static void
output_keyword_blank_entries (int count, const char *indent)
{
- const int columns = 9;
+ int columns;
+ if (option[TYPE])
+ {
+ columns = 58 / (6 + strlen (option.get_initializer_suffix()));
+ if (columns == 0)
+ columns = 1;
+ }
+ else
+ {
+ columns = 9;
+ }
int column = 0;
for (int i = 0; i < count; i++)
{
@@ -1069,7 +1286,7 @@ output_keyword_blank_entries (int count, const char *indent)
printf (", ");
}
if (option[TYPE])
- printf ("{\"\"}");
+ printf ("{\"\"%s}", option.get_initializer_suffix());
else
printf ("\"\"");
column++;
@@ -1183,8 +1400,8 @@ Key_List::output_lookup_array (void)
int hash_value = temp->hash_value;
lookup_array[hash_value] = temp->index;
if (option[DEBUG])
- fprintf (stderr, "keyword = %s, index = %d\n",
- temp->key, temp->index);
+ fprintf (stderr, "keyword = %.*s, index = %d\n",
+ temp->key_length, temp->key, temp->index);
if (temp->link
|| (temp->next && hash_value == temp->next->hash_value))
{
@@ -1200,8 +1417,8 @@ Key_List::output_lookup_array (void)
dup_ptr->count++;
if (option[DEBUG])
fprintf (stderr,
- "static linked keyword = %s, index = %d\n",
- ptr->key, ptr->index);
+ "static linked keyword = %.*s, index = %d\n",
+ ptr->key_length, ptr->key, ptr->index);
}
if (!(temp->next && hash_value == temp->next->hash_value))
@@ -1211,8 +1428,8 @@ Key_List::output_lookup_array (void)
dup_ptr->count++;
if (option[DEBUG])
- fprintf (stderr, "dynamic linked keyword = %s, index = %d\n",
- temp->key, temp->index);
+ fprintf (stderr, "dynamic linked keyword = %.*s, index = %d\n",
+ temp->key_length, temp->key, temp->index);
}
assert (dup_ptr->count >= 2);
dup_ptr++;
@@ -1349,15 +1566,15 @@ output_switch_case (List_Node *list, int indent, int *jumps_away)
T (Trace t ("output_switch_case");)
if (option[DEBUG])
- printf ("%*s/* hash value = %4d, keyword = \"%s\" */\n",
- indent, "", list->hash_value, list->key);
+ printf ("%*s/* hash value = %4d, keyword = \"%.*s\" */\n",
+ indent, "", list->hash_value, list->key_length, list->key);
if (option[DUP]
&& (list->link
|| (list->next && list->hash_value == list->next->hash_value)))
{
if (option[LENTABLE])
- printf ("%*slengthptr = &lengthtable[%d]\n",
+ printf ("%*slengthptr = &lengthtable[%d];\n",
indent, "", list->index);
printf ("%*swordptr = &%s[%d];\n",
indent, "", option.get_wordlist_name (), list->index);
@@ -1383,7 +1600,7 @@ output_switch_case (List_Node *list, int indent, int *jumps_away)
{
printf ("%*sif (len == %d)\n"
"%*s {\n",
- indent, "", list->length,
+ indent, "", list->key_length,
indent, "");
indent += 4;
}
@@ -1392,7 +1609,7 @@ output_switch_case (List_Node *list, int indent, int *jumps_away)
if (option[TYPE])
printf ("&%s[%d]", option.get_wordlist_name (), list->index);
else
- output_string (list->key);
+ output_string (list->key, list->key_length);
printf (";\n");
printf ("%*sgoto compare;\n",
indent, "");
@@ -1654,60 +1871,64 @@ Key_List::output_lookup_function_body (const Output_Compare& comparison)
indent -= 4;
printf ("%*s }\n", indent, "");
}
- printf ("%*s else if (index < -TOTAL_KEYWORDS)\n"
- "%*s {\n"
- "%*s register int offset = - 1 - TOTAL_KEYWORDS - index;\n",
- indent, "", indent, "", indent, "");
- if (option[LENTABLE])
- printf ("%*s register %s%s *lengthptr = &lengthtable[TOTAL_KEYWORDS + lookup[offset]];\n",
- indent, "", const_always, smallest_integral_type (max_key_len));
- printf ("%*s register ",
- indent, "");
- output_const_type (const_readonly_array, struct_tag);
- printf ("*wordptr = &%s[TOTAL_KEYWORDS + lookup[offset]];\n",
- option.get_wordlist_name ());
- printf ("%*s register ",
- indent, "");
- output_const_type (const_readonly_array, struct_tag);
- printf ("*wordendptr = wordptr + -lookup[offset + 1];\n\n");
- printf ("%*s while (wordptr < wordendptr)\n"
- "%*s {\n",
- indent, "", indent, "");
- if (option[LENTABLE])
+ if (total_duplicates > 0)
{
- printf ("%*s if (len == *lengthptr)\n"
- "%*s {\n",
+ printf ("%*s else if (index < -TOTAL_KEYWORDS)\n"
+ "%*s {\n"
+ "%*s register int offset = - 1 - TOTAL_KEYWORDS - index;\n",
+ indent, "", indent, "", indent, "");
+ if (option[LENTABLE])
+ printf ("%*s register %s%s *lengthptr = &lengthtable[TOTAL_KEYWORDS + lookup[offset]];\n",
+ indent, "", const_always, smallest_integral_type (max_key_len));
+ printf ("%*s register ",
+ indent, "");
+ output_const_type (const_readonly_array, struct_tag);
+ printf ("*wordptr = &%s[TOTAL_KEYWORDS + lookup[offset]];\n",
+ option.get_wordlist_name ());
+ printf ("%*s register ",
+ indent, "");
+ output_const_type (const_readonly_array, struct_tag);
+ printf ("*wordendptr = wordptr + -lookup[offset + 1];\n\n");
+ printf ("%*s while (wordptr < wordendptr)\n"
+ "%*s {\n",
indent, "", indent, "");
- indent += 4;
- }
- printf ("%*s register %schar *s = ",
- indent, "", const_always);
- if (option[TYPE])
- printf ("wordptr->%s", option.get_key_name ());
- else
- printf ("*wordptr");
- printf (";\n\n"
- "%*s if (",
- indent, "");
- comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("s"));
- printf (")\n"
- "%*s return %s;\n",
- indent, "",
- option[TYPE] ? "wordptr" : "s");
- if (option[LENTABLE])
- {
- indent -= 4;
- printf ("%*s }\n",
+ if (option[LENTABLE])
+ {
+ printf ("%*s if (len == *lengthptr)\n"
+ "%*s {\n",
+ indent, "", indent, "");
+ indent += 4;
+ }
+ printf ("%*s register %schar *s = ",
+ indent, "", const_always);
+ if (option[TYPE])
+ printf ("wordptr->%s", option.get_key_name ());
+ else
+ printf ("*wordptr");
+ printf (";\n\n"
+ "%*s if (",
indent, "");
+ comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("s"));
+ printf (")\n"
+ "%*s return %s;\n",
+ indent, "",
+ option[TYPE] ? "wordptr" : "s");
+ if (option[LENTABLE])
+ {
+ indent -= 4;
+ printf ("%*s }\n",
+ indent, "");
+ }
+ if (option[LENTABLE])
+ printf ("%*s lengthptr++;\n",
+ indent, "");
+ printf ("%*s wordptr++;\n"
+ "%*s }\n"
+ "%*s }\n",
+ indent, "", indent, "", indent, "");
}
- if (option[LENTABLE])
- printf ("%*s lengthptr++;\n",
- indent, "");
- printf ("%*s wordptr++;\n"
- "%*s }\n"
- "%*s }\n"
- "%*s}\n",
- indent, "", indent, "", indent, "", indent, "");
+ printf ("%*s}\n",
+ indent, "");
}
else
{
@@ -1789,10 +2010,15 @@ Key_List::output_lookup_function (void)
if (!option[GLOBAL])
output_lookup_tables ();
- if (option[COMP])
- output_lookup_function_body (Output_Compare_Strncmp ());
+ if (option[LENTABLE])
+ output_lookup_function_body (Output_Compare_Memcmp ());
else
- output_lookup_function_body (Output_Compare_Strcmp ());
+ {
+ if (option[COMP])
+ output_lookup_function_body (Output_Compare_Strncmp ());
+ else
+ output_lookup_function_body (Output_Compare_Strcmp ());
+ }
printf ("}\n");
}
@@ -1916,9 +2142,10 @@ Key_List::dump ()
field_width, "char_set");
for (List_Node *ptr = head; ptr; ptr = ptr->next)
- fprintf (stderr, "%11d,%11d,%6d, %*s, %s\n",
- ptr->hash_value, ptr->length, ptr->index,
- field_width, ptr->char_set, ptr->key);
+ fprintf (stderr, "%11d,%11d,%6d, %*.*s, %.*s\n",
+ ptr->hash_value, ptr->key_length, ptr->index,
+ field_width, ptr->char_set_length, ptr->char_set,
+ ptr->key_length, ptr->key);
}
/* Simple-minded constructor action here... */
diff --git a/contrib/gperf/src/list-node.cc b/contrib/gperf/src/list-node.cc
index 6c78889..57a04a0 100644
--- a/contrib/gperf/src/list-node.cc
+++ b/contrib/gperf/src/list-node.cc
@@ -1,5 +1,5 @@
/* Creates and initializes a new list node.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -57,23 +57,21 @@ List_Node::set_sort (char *base, int len)
of the total number of keys seen so far. This is used to initialize
the INDEX field to some useful value. */
-List_Node::List_Node (char *k, int len): link (0), next (0),
- key (k), rest (option[TYPE] ? k + len + 1 : ""), length (len), index (0)
+List_Node::List_Node (const char *k, int len, const char *r):
+ link (0), next (0), key (k), key_length (len), rest (r), index (0)
{
T (Trace t ("List_Node::List_Node");)
- char *ptr = new char[(option[ALLCHARS] ? len : option.get_max_keysig_size ()) + 1];
- char *key_set = ptr;
- k[len] = '\0'; /* Null terminate KEY to separate it from REST. */
+ char *key_set = new char[(option[ALLCHARS] ? len : option.get_max_keysig_size ())];
+ char *ptr = key_set;
+ int i;
- if (option[ALLCHARS]) /* Use all the character position in the KEY. */
- for (; *k; k++, ptr++)
+ if (option[ALLCHARS]) /* Use all the character positions in the KEY. */
+ for (i = len; i > 0; k++, ptr++, i--)
++occurrences[(unsigned char)(*ptr = *k)];
else /* Only use those character positions specified by the user. */
{
- int i;
-
- /* Iterate thru the list of key_positions, initializing occurrences table
- and char_set (via char * pointer ptr). */
+ /* Iterate through the list of key_positions, initializing occurrences table
+ and char_set (via char * pointer ptr). */
for (option.reset (); (i = option.get ()) != EOS; )
{
@@ -90,12 +88,15 @@ List_Node::List_Node (char *k, int len): link (0), next (0),
keylength, so there are essentially no usable hash positions! */
if (ptr == char_set && option[NOLENGTH])
{
- fprintf (stderr, "Can't hash keyword %s with chosen key positions.\n", key);
+ fprintf (stderr, "Can't hash keyword %.*s with chosen key positions.\n",
+ key_length, key);
exit (1);
}
}
- *ptr = '\0'; /* Terminate this bastard.... */
+
/* Sort the KEY_SET items alphabetically. */
set_sort (key_set, ptr - key_set);
+
char_set = key_set;
+ char_set_length = ptr - key_set;
}
diff --git a/contrib/gperf/src/list-node.h b/contrib/gperf/src/list-node.h
index 630d91a..3bd21b3 100644
--- a/contrib/gperf/src/list-node.h
+++ b/contrib/gperf/src/list-node.h
@@ -2,7 +2,7 @@
/* Data and function members for defining values and operations of a list node.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -31,14 +31,15 @@ struct List_Node : private Vectors
List_Node *link; /* TRUE if key has an identical KEY_SET as another key. */
List_Node *next; /* Points to next element on the list. */
const char *key; /* Each keyword string stored here. */
+ int key_length; /* Length of the key. */
const char *rest; /* Additional information for building hash function. */
const char *char_set; /* Set of characters to hash, specified by user. */
- int length; /* Length of the key. */
+ int char_set_length; /* Length of char_set. */
int hash_value; /* Hash value for the key. */
int occurrence; /* A metric for frequency of key set occurrences. */
int index; /* Position of this node relative to other nodes. */
- List_Node (char *key, int len);
+ List_Node (const char *key, int len, const char *rest);
static void set_sort (char *base, int len);
};
diff --git a/contrib/gperf/src/main.cc b/contrib/gperf/src/main.cc
index 4e08633..03b6c7e 100644
--- a/contrib/gperf/src/main.cc
+++ b/contrib/gperf/src/main.cc
@@ -1,5 +1,5 @@
/* Driver program for the Gen_Perf hash function generator
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -67,6 +67,10 @@ main (int argc, char *argv[])
/* Generates and prints the Gen_Perf hash table. */
int status = generate_table ();
+ /* Check for write error on stdout. */
+ if (fflush (stdout) || ferror (stdout))
+ status = 1;
+
/* Don't use exit() here, it skips the destructors. */
return status;
}
diff --git a/contrib/gperf/src/options.cc b/contrib/gperf/src/options.cc
index 7be9746..d15e21c 100644
--- a/contrib/gperf/src/options.cc
+++ b/contrib/gperf/src/options.cc
@@ -1,5 +1,5 @@
/* Handles parsing the Options provided to the user.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -43,6 +43,9 @@ static const char *const DEFAULT_NAME = "in_word_set";
/* Default name for the key component. */
static const char *const DEFAULT_KEY = "name";
+/* Default struct initializer suffix. */
+static const char *const DEFAULT_INITIALIZER_SUFFIX = "";
+
/* Default name for the generated class. */
static const char *const DEFAULT_CLASS_NAME = "Perfect_Hash";
@@ -67,6 +70,7 @@ int Options::iterations;
char **Options::argument_vector;
const char *Options::function_name;
const char *Options::key_name;
+const char *Options::initializer_suffix;
const char *Options::class_name;
const char *Options::hash_name;
const char *Options::wordlist_name;
@@ -79,7 +83,7 @@ void
Options::short_usage (FILE * strm)
{
T (Trace t ("Options::short_usage");)
- fprintf (strm, "Usage: %s [-cCdDef[num]GhH<hashname>i<init>Ijk<keys>K<keyname>lL<language>nN<function name>ors<size>S<switches>tTvW<wordlistname>Z<class name>7] [input-file]\n"
+ fprintf (strm, "Usage: %s [-cCdDef[num]F<initializers>GhH<hashname>i<init>Ijk<keys>K<keyname>lL<language>nN<function name>ors<size>S<switches>tTvW<wordlistname>Z<class name>7] [input-file]\n"
"Try `%s --help' for more information.\n",
program_name, program_name);
}
@@ -116,6 +120,9 @@ Options::long_usage (FILE * strm)
"Details in the output code:\n"
" -K, --slot-name=NAME Select name of the keyword component in the keyword\n"
" structure.\n"
+ " -F, --initializer-suffix=INITIALIZERS\n"
+ " Initializers for additional components in the keyword\n"
+ " structure.\n"
" -H, --hash-fn-name=NAME\n"
" Specify name of generated hash function. Default is\n"
" `hash'.\n"
@@ -222,7 +229,50 @@ Options::print_options (void)
printf ("/* Command-line: ");
for (i = 0; i < argument_count; i++)
- printf ("%s ", argument_vector[i]);
+ {
+ const char *arg = argument_vector[i];
+
+ /* Escape arg if it contains shell metacharacters. */
+ if (*arg == '-')
+ {
+ putchar (*arg);
+ arg++;
+ if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <= 'z')
+ {
+ putchar (*arg);
+ arg++;
+ }
+ }
+ if (strpbrk (arg, "\t\n !\"#$&'()*;<>?[\\]`{|}~") != NULL)
+ {
+ if (strchr (arg, '\'') != NULL)
+ {
+ putchar ('"');
+ for (; *arg; arg++)
+ {
+ if (*arg == '\"' || *arg == '\\' || *arg == '$')
+ putchar ('\\');
+ putchar (*arg);
+ }
+ putchar ('"');
+ }
+ else
+ {
+ putchar ('\'');
+ for (; *arg; arg++)
+ {
+ if (*arg == '\\')
+ putchar ('\\');
+ putchar (*arg);
+ }
+ putchar ('\'');
+ }
+ }
+ else
+ printf ("%s", arg);
+
+ printf (" ");
+ }
printf (" */");
}
@@ -266,6 +316,7 @@ Options::Options (void)
option_word = DEFAULTCHARS | C;
function_name = DEFAULT_NAME;
key_name = DEFAULT_KEY;
+ initializer_suffix = DEFAULT_INITIALIZER_SUFFIX;
hash_name = DEFAULT_HASH_NAME;
wordlist_name = DEFAULT_WORDLIST_NAME;
class_name = DEFAULT_CLASS_NAME;
@@ -309,6 +360,7 @@ Options::~Options (void)
"\nhash function name = %s"
"\nword list name = %s"
"\nkey name = %s"
+ "\ninitializer suffix = %s"
"\njump value = %d"
"\nmax associated value = %d"
"\ninitial associated value = %d"
@@ -337,7 +389,8 @@ Options::~Options (void)
option_word & SEVENBIT ? "enabled" : "disabled",
iterations,
function_name, hash_name, wordlist_name, key_name,
- jump, size - 1, initial_asso_value, delimiters, total_switches);
+ initializer_suffix, jump, size - 1, initial_asso_value,
+ delimiters, total_switches);
if (option_word & ALLCHARS)
fprintf (stderr, "all characters are used in the hash function\n");
@@ -363,6 +416,7 @@ static const struct option long_options[] =
{ "struct-type", no_argument, 0, 't' },
{ "language", required_argument, 0, 'L' },
{ "slot-name", required_argument, 0, 'K' },
+ { "initializer-suffix", required_argument, 0, 'F' },
{ "hash-fn-name", required_argument, 0, 'H' },
{ "lookup-fn-name", required_argument, 0, 'N' },
{ "class-name", required_argument, 0, 'Z' },
@@ -403,7 +457,7 @@ Options::operator() (int argc, char *argv[])
while ((option_char =
getopt_long (argument_count, argument_vector,
- "adcCDe:Ef:gGhH:i:Ij:k:K:lL:nN:oprs:S:tTvW:Z:7",
+ "adcCDe:Ef:F:gGhH:i:Ij:k:K:lL:nN:oprs:S:tTvW:Z:7",
long_options, (int *)0))
!= -1)
{
@@ -453,11 +507,16 @@ Options::operator() (int argc, char *argv[])
}
break;
}
+ case 'F':
+ {
+ initializer_suffix = /*getopt*/optarg;
+ break;
+ }
case 'g': /* Use the ``inline'' keyword for generated sub-routines, ifdef __GNUC__. */
break; /* This is now the default. */
case 'G': /* Make the keyword table a global variable. */
{
- option_word |= GLOBAL;
+ option_word |= GLOBAL;
break;
}
case 'h': /* Displays a list of helpful Options to the user. */
diff --git a/contrib/gperf/src/options.h b/contrib/gperf/src/options.h
index a81afe6..9025c86 100644
--- a/contrib/gperf/src/options.h
+++ b/contrib/gperf/src/options.h
@@ -2,7 +2,7 @@
/* Handles parsing the Options provided to the user.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -98,6 +98,7 @@ public:
static int get_total_switches (void);
static const char *get_function_name (void);
static const char *get_key_name (void);
+ static const char *get_initializer_suffix (void);
static const char *get_class_name (void);
static const char *get_hash_name (void);
static const char *get_wordlist_name (void);
@@ -116,6 +117,7 @@ private:
static char **argument_vector; /* Stores a pointer to command-line vector. */
static const char *function_name; /* Names used for generated lookup function. */
static const char *key_name; /* Name used for keyword key. */
+ static const char *initializer_suffix; /* Suffix for empty struct initializers. */
static const char *class_name; /* Name used for generated C++ class. */
static const char *hash_name; /* Name used for generated hash function. */
static const char *wordlist_name; /* Name used for hash table array. */
diff --git a/contrib/gperf/src/options.icc b/contrib/gperf/src/options.icc
index 0d9668f..82fe537 100644
--- a/contrib/gperf/src/options.icc
+++ b/contrib/gperf/src/options.icc
@@ -1,6 +1,6 @@
/* Inline Functions for options.{h,cc}.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -118,6 +118,14 @@ Options::get_key_name (void)
return key_name;
}
+/* Returns the struct initializer suffix. */
+INLINE const char *
+Options::get_initializer_suffix (void)
+{
+ T (Trace t ("Options::get_initializer_suffix");)
+ return initializer_suffix;
+}
+
/* Returns the hash function name. */
INLINE const char *
Options::get_hash_name (void)
diff --git a/contrib/gperf/src/version.cc b/contrib/gperf/src/version.cc
index 2e5cf68..8f07c69 100644
--- a/contrib/gperf/src/version.cc
+++ b/contrib/gperf/src/version.cc
@@ -1,6 +1,6 @@
/* Current program version number.
- Copyright (C) 1989-1998 Free Software Foundation, Inc.
+ Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -19,4 +19,4 @@ You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-const char *version_string = "2.7";
+const char *version_string = "2.7.2";
OpenPOWER on IntegriCloud