google_hash 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/ChangeLog.txt +2 -0
  2. data/VERSION +1 -1
  3. data/ext/clean.bat +0 -0
  4. data/ext/clean.sh +4 -0
  5. data/ext/extconf.rb +4 -5
  6. data/ext/go.bat +0 -0
  7. data/ext/sparsehash-2.0.2/AUTHORS +2 -0
  8. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/COPYING +0 -0
  9. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/ChangeLog +60 -0
  10. data/ext/sparsehash-2.0.2/INSTALL +365 -0
  11. data/ext/sparsehash-2.0.2/Makefile +1336 -0
  12. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/Makefile.am +97 -40
  13. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/Makefile.in +538 -256
  14. data/ext/sparsehash-2.0.2/NEWS +188 -0
  15. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/README +4 -10
  16. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/README_windows.txt +3 -3
  17. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/TODO +0 -0
  18. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/aclocal.m4 +266 -166
  19. data/ext/sparsehash-2.0.2/allocator.patch +31 -0
  20. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/config.guess +235 -234
  21. data/ext/sparsehash-2.0.2/config.status +1238 -0
  22. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/config.sub +198 -64
  23. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/configure +1118 -1000
  24. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/configure.ac +4 -5
  25. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/depcomp +136 -36
  26. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/dense_hash_map.html +182 -67
  27. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/dense_hash_set.html +173 -74
  28. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/designstyle.css +0 -6
  29. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/implementation.html +0 -0
  30. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/index.html +4 -5
  31. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/performance.html +1 -1
  32. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/sparse_hash_map.html +190 -58
  33. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/sparse_hash_set.html +180 -65
  34. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/doc/sparsetable.html +1 -1
  35. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/experimental/Makefile +0 -0
  36. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/experimental/README +0 -0
  37. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/experimental/example.c +1 -0
  38. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/experimental/libchash.c +1 -0
  39. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/experimental/libchash.h +1 -0
  40. data/ext/sparsehash-2.0.2/install-sh +520 -0
  41. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/m4/acx_pthread.m4 +34 -0
  42. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/m4/google_namespace.m4 +0 -0
  43. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/m4/namespaces.m4 +0 -0
  44. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/m4/stl_hash.m4 +0 -0
  45. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/m4/stl_hash_fun.m4 +0 -0
  46. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/missing +60 -44
  47. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb.sh +0 -0
  48. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb/README +0 -0
  49. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb/changelog +42 -0
  50. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb/compat +0 -0
  51. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb/control +1 -1
  52. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb/copyright +5 -4
  53. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb/docs +0 -0
  54. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/deb/rules +0 -0
  55. data/ext/sparsehash-2.0.2/packages/deb/sparsehash.dirs +5 -0
  56. data/ext/sparsehash-2.0.2/packages/deb/sparsehash.install +6 -0
  57. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/rpm.sh +1 -1
  58. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/packages/rpm/rpm.spec +5 -3
  59. data/ext/{sparsehash-1.8.1/google-sparsehash.sln → sparsehash-2.0.2/sparsehash.sln} +0 -0
  60. data/ext/sparsehash-2.0.2/src/config.h +132 -0
  61. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/config.h.in +0 -3
  62. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/config.h.include +0 -1
  63. data/ext/sparsehash-2.0.2/src/google/dense_hash_map +34 -0
  64. data/ext/sparsehash-2.0.2/src/google/dense_hash_set +34 -0
  65. data/ext/sparsehash-2.0.2/src/google/sparse_hash_map +34 -0
  66. data/ext/sparsehash-2.0.2/src/google/sparse_hash_set +34 -0
  67. data/ext/sparsehash-2.0.2/src/google/sparsehash/densehashtable.h +34 -0
  68. data/ext/sparsehash-2.0.2/src/google/sparsehash/hashtable-common.h +34 -0
  69. data/ext/sparsehash-2.0.2/src/google/sparsehash/libc_allocator_with_realloc.h +34 -0
  70. data/ext/sparsehash-2.0.2/src/google/sparsehash/sparsehashtable.h +34 -0
  71. data/ext/sparsehash-2.0.2/src/google/sparsetable +34 -0
  72. data/ext/sparsehash-2.0.2/src/google/template_util.h +34 -0
  73. data/ext/sparsehash-2.0.2/src/google/type_traits.h +34 -0
  74. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/hash_test_interface.h +64 -37
  75. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/hashtable_test.cc +415 -141
  76. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/libc_allocator_with_realloc_test.cc +16 -23
  77. data/ext/sparsehash-2.0.2/src/simple_compat_test.cc +106 -0
  78. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/simple_test.cc +8 -5
  79. data/ext/{sparsehash-1.8.1/src/google → sparsehash-2.0.2/src/sparsehash}/dense_hash_map +80 -37
  80. data/ext/{sparsehash-1.8.1/src/google → sparsehash-2.0.2/src/sparsehash}/dense_hash_set +64 -34
  81. data/ext/{sparsehash-1.8.1/src/google/sparsehash → sparsehash-2.0.2/src/sparsehash/internal}/densehashtable.h +247 -173
  82. data/ext/sparsehash-2.0.2/src/sparsehash/internal/hashtable-common.h +381 -0
  83. data/ext/{sparsehash-1.8.1/src/google/sparsehash → sparsehash-2.0.2/src/sparsehash/internal}/libc_allocator_with_realloc.h +5 -7
  84. data/ext/{sparsehash-1.8.1/src/google/sparsehash → sparsehash-2.0.2/src/sparsehash/internal}/sparsehashtable.h +154 -93
  85. data/ext/{sparsehash-1.8.1/src/google → sparsehash-2.0.2/src/sparsehash}/sparse_hash_map +96 -36
  86. data/ext/{sparsehash-1.8.1/src/google → sparsehash-2.0.2/src/sparsehash}/sparse_hash_set +85 -32
  87. data/ext/{sparsehash-1.8.1/src/google → sparsehash-2.0.2/src/sparsehash}/sparsetable +520 -258
  88. data/ext/sparsehash-2.0.2/src/sparsehash/template_util.h +134 -0
  89. data/ext/{sparsehash-1.8.1/src/google → sparsehash-2.0.2/src/sparsehash}/type_traits.h +153 -35
  90. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/sparsetable_unittest.cc +108 -22
  91. data/ext/sparsehash-2.0.2/src/stamp-h1 +1 -0
  92. data/ext/sparsehash-2.0.2/src/template_util_unittest.cc +134 -0
  93. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/testutil.h +16 -1
  94. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/time_hash_map.cc +259 -94
  95. data/ext/sparsehash-2.0.2/src/type_traits_unittest.cc +636 -0
  96. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/windows/config.h +4 -4
  97. data/ext/sparsehash-2.0.2/src/windows/google/sparsehash/sparseconfig.h +49 -0
  98. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/windows/port.cc +1 -0
  99. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/src/windows/port.h +4 -13
  100. data/ext/sparsehash-2.0.2/src/windows/sparsehash/internal/sparseconfig.h +49 -0
  101. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/vsprojects/hashtable_test/hashtable_test.vcproj +11 -11
  102. data/ext/sparsehash-2.0.2/vsprojects/libc_allocator_with_realloc_test/libc_allocator_with_realloc_test.vcproj +161 -0
  103. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/vsprojects/simple_test/simple_test.vcproj +10 -10
  104. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/vsprojects/sparsetable_unittest/sparsetable_unittest.vcproj +4 -4
  105. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/vsprojects/time_hash_map/time_hash_map.vcproj +10 -10
  106. data/ext/{sparsehash-1.8.1 → sparsehash-2.0.2}/vsprojects/type_traits_unittest/type_traits_unittest.vcproj +3 -3
  107. data/ext/spec.bat +0 -0
  108. data/ext/template/google_hash.cpp.erb +6 -5
  109. metadata +106 -86
  110. data/ext/sparsehash-1.8.1/AUTHORS +0 -2
  111. data/ext/sparsehash-1.8.1/INSTALL +0 -236
  112. data/ext/sparsehash-1.8.1/NEWS +0 -71
  113. data/ext/sparsehash-1.8.1/compile +0 -99
  114. data/ext/sparsehash-1.8.1/install-sh +0 -323
  115. data/ext/sparsehash-1.8.1/m4/stl_namespace.m4 +0 -25
  116. data/ext/sparsehash-1.8.1/mkinstalldirs +0 -158
  117. data/ext/sparsehash-1.8.1/packages/deb/sparsehash.dirs +0 -2
  118. data/ext/sparsehash-1.8.1/packages/deb/sparsehash.install +0 -2
  119. data/ext/sparsehash-1.8.1/src/google/sparsehash/hashtable-common.h +0 -178
  120. data/ext/sparsehash-1.8.1/src/type_traits_unittest.cc +0 -502
  121. data/ext/sparsehash-1.8.1/src/windows/google/sparsehash/sparseconfig.h +0 -32
@@ -4,7 +4,7 @@
4
4
  # make sure we're interpreted by some minimal autoconf
5
5
  AC_PREREQ(2.57)
6
6
 
7
- AC_INIT(sparsehash, 1.8.1, opensource@google.com)
7
+ AC_INIT(sparsehash, 2.0.2, google-sparsehash@googlegroups.com)
8
8
  # The argument here is just something that should be in the current directory
9
9
  # (for sanity checking)
10
10
  AC_CONFIG_SRCDIR(README)
@@ -12,9 +12,9 @@ AM_INIT_AUTOMAKE([dist-zip])
12
12
  AM_CONFIG_HEADER(src/config.h)
13
13
 
14
14
  # Checks for programs.
15
+ AC_PROG_CXX
15
16
  AC_PROG_CC
16
17
  AC_PROG_CPP
17
- AC_PROG_CXX
18
18
  AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
19
19
 
20
20
  # Check whether some low-level functions/files are available
@@ -51,9 +51,8 @@ AC_SUBST(tcmalloc_libs)
51
51
  AC_CXX_STL_HASH
52
52
  AC_CXX_STL_HASH_FUN
53
53
 
54
- # Find out what namespace 'normal' STL code lives in, and also what namespace
55
- # the user wants our classes to be defined in
56
- AC_CXX_STL_NAMESPACE
54
+ # Find out what namespace the user wants our classes to be defined in.
55
+ # TODO(csilvers): change this to default to sparsehash instead.
57
56
  AC_DEFINE_GOOGLE_NAMESPACE(google)
58
57
 
59
58
  # In unix-based systems, hash is always defined as hash<> (in namespace.
@@ -1,9 +1,10 @@
1
1
  #! /bin/sh
2
2
  # depcomp - compile a program generating dependencies as side-effects
3
3
 
4
- scriptversion=2005-07-09.11
4
+ scriptversion=2009-04-28.21; # UTC
5
5
 
6
- # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
6
+ # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
7
+ # Software Foundation, Inc.
7
8
 
8
9
  # This program is free software; you can redistribute it and/or modify
9
10
  # it under the terms of the GNU General Public License as published by
@@ -16,9 +17,7 @@ scriptversion=2005-07-09.11
16
17
  # GNU General Public License for more details.
17
18
 
18
19
  # You should have received a copy of the GNU General Public License
19
- # along with this program; if not, write to the Free Software
20
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
- # 02110-1301, USA.
20
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
22
21
 
23
22
  # As a special exception to the GNU General Public License, if you
24
23
  # distribute this file as part of a program that contains a
@@ -86,12 +85,34 @@ if test "$depmode" = dashXmstdout; then
86
85
  depmode=dashmstdout
87
86
  fi
88
87
 
88
+ cygpath_u="cygpath -u -f -"
89
+ if test "$depmode" = msvcmsys; then
90
+ # This is just like msvisualcpp but w/o cygpath translation.
91
+ # Just convert the backslash-escaped backslashes to single forward
92
+ # slashes to satisfy depend.m4
93
+ cygpath_u="sed s,\\\\\\\\,/,g"
94
+ depmode=msvisualcpp
95
+ fi
96
+
89
97
  case "$depmode" in
90
98
  gcc3)
91
99
  ## gcc 3 implements dependency tracking that does exactly what
92
100
  ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
93
101
  ## it if -MD -MP comes after the -MF stuff. Hmm.
94
- "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
102
+ ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
103
+ ## the command line argument order; so add the flags where they
104
+ ## appear in depend2.am. Note that the slowdown incurred here
105
+ ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
106
+ for arg
107
+ do
108
+ case $arg in
109
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
110
+ *) set fnord "$@" "$arg" ;;
111
+ esac
112
+ shift # fnord
113
+ shift # $arg
114
+ done
115
+ "$@"
95
116
  stat=$?
96
117
  if test $stat -eq 0; then :
97
118
  else
@@ -178,14 +199,14 @@ sgi)
178
199
  ' < "$tmpdepfile" \
179
200
  | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
180
201
  tr '
181
- ' ' ' >> $depfile
182
- echo >> $depfile
202
+ ' ' ' >> "$depfile"
203
+ echo >> "$depfile"
183
204
 
184
205
  # The second pass generates a dummy entry for each header file.
185
206
  tr ' ' '
186
207
  ' < "$tmpdepfile" \
187
208
  | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
188
- >> $depfile
209
+ >> "$depfile"
189
210
  else
190
211
  # The sourcefile does not contain any dependencies, so just
191
212
  # store a dummy comment line, to avoid errors with the Makefile
@@ -201,34 +222,39 @@ aix)
201
222
  # current directory. Also, the AIX compiler puts `$object:' at the
202
223
  # start of each line; $object doesn't have directory information.
203
224
  # Version 6 uses the directory in both cases.
204
- stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
205
- tmpdepfile="$stripped.u"
225
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
226
+ test "x$dir" = "x$object" && dir=
227
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
206
228
  if test "$libtool" = yes; then
229
+ tmpdepfile1=$dir$base.u
230
+ tmpdepfile2=$base.u
231
+ tmpdepfile3=$dir.libs/$base.u
207
232
  "$@" -Wc,-M
208
233
  else
234
+ tmpdepfile1=$dir$base.u
235
+ tmpdepfile2=$dir$base.u
236
+ tmpdepfile3=$dir$base.u
209
237
  "$@" -M
210
238
  fi
211
239
  stat=$?
212
240
 
213
- if test -f "$tmpdepfile"; then :
214
- else
215
- stripped=`echo "$stripped" | sed 's,^.*/,,'`
216
- tmpdepfile="$stripped.u"
217
- fi
218
-
219
241
  if test $stat -eq 0; then :
220
242
  else
221
- rm -f "$tmpdepfile"
243
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
222
244
  exit $stat
223
245
  fi
224
246
 
247
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
248
+ do
249
+ test -f "$tmpdepfile" && break
250
+ done
225
251
  if test -f "$tmpdepfile"; then
226
- outname="$stripped.o"
227
252
  # Each line is of the form `foo.o: dependent.h'.
228
253
  # Do two passes, one to just change these to
229
254
  # `$object: dependent.h' and one to simply `dependent.h:'.
230
- sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
231
- sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
255
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
256
+ # That's a tab and a space in the [].
257
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
232
258
  else
233
259
  # The sourcefile does not contain any dependencies, so just
234
260
  # store a dummy comment line, to avoid errors with the Makefile
@@ -276,6 +302,51 @@ icc)
276
302
  rm -f "$tmpdepfile"
277
303
  ;;
278
304
 
305
+ hp2)
306
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
307
+ # compilers, which have integrated preprocessors. The correct option
308
+ # to use with these is +Maked; it writes dependencies to a file named
309
+ # 'foo.d', which lands next to the object file, wherever that
310
+ # happens to be.
311
+ # Much of this is similar to the tru64 case; see comments there.
312
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
313
+ test "x$dir" = "x$object" && dir=
314
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
315
+ if test "$libtool" = yes; then
316
+ tmpdepfile1=$dir$base.d
317
+ tmpdepfile2=$dir.libs/$base.d
318
+ "$@" -Wc,+Maked
319
+ else
320
+ tmpdepfile1=$dir$base.d
321
+ tmpdepfile2=$dir$base.d
322
+ "$@" +Maked
323
+ fi
324
+ stat=$?
325
+ if test $stat -eq 0; then :
326
+ else
327
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
328
+ exit $stat
329
+ fi
330
+
331
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
332
+ do
333
+ test -f "$tmpdepfile" && break
334
+ done
335
+ if test -f "$tmpdepfile"; then
336
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
337
+ # Add `dependent.h:' lines.
338
+ sed -ne '2,${
339
+ s/^ *//
340
+ s/ \\*$//
341
+ s/$/:/
342
+ p
343
+ }' "$tmpdepfile" >> "$depfile"
344
+ else
345
+ echo "#dummy" > "$depfile"
346
+ fi
347
+ rm -f "$tmpdepfile" "$tmpdepfile2"
348
+ ;;
349
+
279
350
  tru64)
280
351
  # The Tru64 compiler uses -MD to generate dependencies as a side
281
352
  # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@@ -288,13 +359,13 @@ tru64)
288
359
 
289
360
  if test "$libtool" = yes; then
290
361
  # With Tru64 cc, shared objects can also be used to make a
291
- # static library. This mecanism is used in libtool 1.4 series to
362
+ # static library. This mechanism is used in libtool 1.4 series to
292
363
  # handle both shared and static libraries in a single compilation.
293
364
  # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
294
365
  #
295
366
  # With libtool 1.5 this exception was removed, and libtool now
296
367
  # generates 2 separate objects for the 2 libraries. These two
297
- # compilations output dependencies in in $dir.libs/$base.o.d and
368
+ # compilations output dependencies in $dir.libs/$base.o.d and
298
369
  # in $dir$base.o.d. We have to check for both files, because
299
370
  # one of the two compilations can be disabled. We should prefer
300
371
  # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
@@ -345,7 +416,7 @@ dashmstdout)
345
416
 
346
417
  # Remove the call to Libtool.
347
418
  if test "$libtool" = yes; then
348
- while test $1 != '--mode=compile'; do
419
+ while test "X$1" != 'X--mode=compile'; do
349
420
  shift
350
421
  done
351
422
  shift
@@ -396,32 +467,39 @@ makedepend)
396
467
  "$@" || exit $?
397
468
  # Remove any Libtool call
398
469
  if test "$libtool" = yes; then
399
- while test $1 != '--mode=compile'; do
470
+ while test "X$1" != 'X--mode=compile'; do
400
471
  shift
401
472
  done
402
473
  shift
403
474
  fi
404
475
  # X makedepend
405
476
  shift
406
- cleared=no
407
- for arg in "$@"; do
477
+ cleared=no eat=no
478
+ for arg
479
+ do
408
480
  case $cleared in
409
481
  no)
410
482
  set ""; shift
411
483
  cleared=yes ;;
412
484
  esac
485
+ if test $eat = yes; then
486
+ eat=no
487
+ continue
488
+ fi
413
489
  case "$arg" in
414
490
  -D*|-I*)
415
491
  set fnord "$@" "$arg"; shift ;;
416
492
  # Strip any option that makedepend may not understand. Remove
417
493
  # the object too, otherwise makedepend will parse it as a source file.
494
+ -arch)
495
+ eat=yes ;;
418
496
  -*|$object)
419
497
  ;;
420
498
  *)
421
499
  set fnord "$@" "$arg"; shift ;;
422
500
  esac
423
501
  done
424
- obj_suffix="`echo $object | sed 's/^.*\././'`"
502
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
425
503
  touch "$tmpdepfile"
426
504
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
427
505
  rm -f "$depfile"
@@ -441,7 +519,7 @@ cpp)
441
519
 
442
520
  # Remove the call to Libtool.
443
521
  if test "$libtool" = yes; then
444
- while test $1 != '--mode=compile'; do
522
+ while test "X$1" != 'X--mode=compile'; do
445
523
  shift
446
524
  done
447
525
  shift
@@ -479,13 +557,27 @@ cpp)
479
557
 
480
558
  msvisualcpp)
481
559
  # Important note: in order to support this mode, a compiler *must*
482
- # always write the preprocessed file to stdout, regardless of -o,
483
- # because we must use -o when running libtool.
560
+ # always write the preprocessed file to stdout.
484
561
  "$@" || exit $?
562
+
563
+ # Remove the call to Libtool.
564
+ if test "$libtool" = yes; then
565
+ while test "X$1" != 'X--mode=compile'; do
566
+ shift
567
+ done
568
+ shift
569
+ fi
570
+
485
571
  IFS=" "
486
572
  for arg
487
573
  do
488
574
  case "$arg" in
575
+ -o)
576
+ shift
577
+ ;;
578
+ $object)
579
+ shift
580
+ ;;
489
581
  "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
490
582
  set fnord "$@"
491
583
  shift
@@ -498,16 +590,23 @@ msvisualcpp)
498
590
  ;;
499
591
  esac
500
592
  done
501
- "$@" -E |
502
- sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
593
+ "$@" -E 2>/dev/null |
594
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
503
595
  rm -f "$depfile"
504
596
  echo "$object : \\" > "$depfile"
505
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
597
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
506
598
  echo " " >> "$depfile"
507
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
599
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
508
600
  rm -f "$tmpdepfile"
509
601
  ;;
510
602
 
603
+ msvcmsys)
604
+ # This case exists only to let depend.m4 do its work. It works by
605
+ # looking at the text of this script. This case will never be run,
606
+ # since it is checked for above.
607
+ exit 1
608
+ ;;
609
+
511
610
  none)
512
611
  exec "$@"
513
612
  ;;
@@ -526,5 +625,6 @@ exit 0
526
625
  # eval: (add-hook 'write-file-hooks 'time-stamp)
527
626
  # time-stamp-start: "scriptversion="
528
627
  # time-stamp-format: "%:y-%02m-%02d.%02H"
529
- # time-stamp-end: "$"
628
+ # time-stamp-time-zone: "UTC"
629
+ # time-stamp-end: "; # UTC"
530
630
  # End:
@@ -88,7 +88,7 @@ details.)
88
88
 
89
89
  <pre>
90
90
  #include &lt;iostream&gt;
91
- #include &lt;google/dense_hash_map&gt;
91
+ #include &lt;sparsehash/dense_hash_map&gt;
92
92
 
93
93
  using google::dense_hash_map; // namespace where class lives by default
94
94
  using std::cout;
@@ -1240,7 +1240,8 @@ key_type&amp; k) </pre>
1240
1240
 
1241
1241
  <TR>
1242
1242
  <TD VAlign=top>
1243
- <tt>bool write_metadata(FILE *fp)</tt>
1243
+ <tt>template &lt;ValueSerializer, OUTPUT&gt;
1244
+ bool serialize(ValueSerializer serializer, OUTPUT *fp)</tt>
1244
1245
  </TD>
1245
1246
  <TD VAlign=top>
1246
1247
  <tt>dense_hash_map</tt>
@@ -1252,7 +1253,8 @@ key_type&amp; k) </pre>
1252
1253
 
1253
1254
  <TR>
1254
1255
  <TD VAlign=top>
1255
- <tt>bool read_metadata(FILE *fp)</tt>
1256
+ <tt>template &lt;ValueSerializer, INPUT&gt;
1257
+ bool unserialize(ValueSerializer serializer, INPUT *fp)</tt>
1256
1258
  </TD>
1257
1259
  <TD VAlign=top>
1258
1260
  <tt>dense_hash_map</tt>
@@ -1264,7 +1266,7 @@ key_type&amp; k) </pre>
1264
1266
 
1265
1267
  <TR>
1266
1268
  <TD VAlign=top>
1267
- <tt>bool write_nopointer_data(FILE *fp)</tt>
1269
+ <tt>NopointerSerializer</tt>
1268
1270
  </TD>
1269
1271
  <TD VAlign=top>
1270
1272
  <tt>dense_hash_map</tt>
@@ -1274,6 +1276,42 @@ key_type&amp; k) </pre>
1274
1276
  </TD>
1275
1277
  </TR>
1276
1278
 
1279
+ <TR>
1280
+ <TD VAlign=top>
1281
+ <tt>bool write_metadata(FILE *fp)</tt>
1282
+ </TD>
1283
+ <TD VAlign=top>
1284
+ <tt>dense_hash_map</tt>
1285
+ </TD>
1286
+ <TD VAlign=top>
1287
+ DEPRECATED. <A HREF="#new">See below</A>.
1288
+ </TD>
1289
+ </TR>
1290
+
1291
+ <TR>
1292
+ <TD VAlign=top>
1293
+ <tt>bool read_metadata(FILE *fp)</tt>
1294
+ </TD>
1295
+ <TD VAlign=top>
1296
+ <tt>dense_hash_map</tt>
1297
+ </TD>
1298
+ <TD VAlign=top>
1299
+ DEPRECATED. <A HREF="#new">See below</A>.
1300
+ </TD>
1301
+ </TR>
1302
+
1303
+ <TR>
1304
+ <TD VAlign=top>
1305
+ <tt>bool write_nopointer_data(FILE *fp)</tt>
1306
+ </TD>
1307
+ <TD VAlign=top>
1308
+ <tt>dense_hash_map</tt>
1309
+ </TD>
1310
+ <TD VAlign=top>
1311
+ DEPRECATED. <A HREF="#new">See below</A>.
1312
+ </TD>
1313
+ </TR>
1314
+
1277
1315
  <TR>
1278
1316
  <TD VAlign=top>
1279
1317
  <tt>bool read_nopointer_data(FILE *fp)</tt>
@@ -1282,7 +1320,7 @@ key_type&amp; k) </pre>
1282
1320
  <tt>dense_hash_map</tt>
1283
1321
  </TD>
1284
1322
  <TD VAlign=top>
1285
- <A HREF="#new">See below</A>.
1323
+ DEPRECATED. <A HREF="#new">See below</A>.
1286
1324
  </TD>
1287
1325
  </TR>
1288
1326
 
@@ -1390,12 +1428,35 @@ href="http://www.sgi.com/tech/stl/#3">[3]</A>
1390
1428
  </TD>
1391
1429
  </TR>
1392
1430
 
1431
+ <TR>
1432
+ <TD VAlign=top>
1433
+ <tt>template &lt;ValueSerializer, OUTPUT&gt;
1434
+ bool serialize(ValueSerializer serializer, OUTPUT *fp)</tt>
1435
+ </TD>
1436
+ <TD VAlign=top>
1437
+ Emit a serialization of the hash_map to a stream.
1438
+ See <A HREF="#io">below</A>.
1439
+ </TD>
1440
+ </TR>
1441
+
1442
+ <TR>
1443
+ <TD VAlign=top>
1444
+ <tt>template &lt;ValueSerializer, INPUT&gt;
1445
+ bool unserialize(ValueSerializer serializer, INPUT *fp)</tt>
1446
+ </TD>
1447
+ <TD VAlign=top>
1448
+ Read in a serialization of a hash_map from a stream, replacing the
1449
+ existing hash_map contents with the serialized contents.
1450
+ See <A HREF="#io">below</A>.
1451
+ </TD>
1452
+ </TR>
1453
+
1393
1454
  <TR>
1394
1455
  <TD VAlign=top>
1395
1456
  <tt>bool write_metadata(FILE *fp)</tt>
1396
1457
  </TD>
1397
1458
  <TD VAlign=top>
1398
- Write hashtable metadata to <tt>fp</tt>. See <A HREF="#io">below</A>.
1459
+ This function is DEPRECATED. See <A HREF="#io">below</A>.
1399
1460
  </TD>
1400
1461
  </TR>
1401
1462
 
@@ -1404,7 +1465,7 @@ href="http://www.sgi.com/tech/stl/#3">[3]</A>
1404
1465
  <tt>bool read_metadata(FILE *fp)</tt>
1405
1466
  </TD>
1406
1467
  <TD VAlign=top>
1407
- Read hashtable metadata from <tt>fp</tt>. See <A HREF="#io">below</A>.
1468
+ This function is DEPRECATED. See <A HREF="#io">below</A>.
1408
1469
  </TD>
1409
1470
  </TR>
1410
1471
 
@@ -1413,8 +1474,7 @@ href="http://www.sgi.com/tech/stl/#3">[3]</A>
1413
1474
  <tt>bool write_nopointer_data(FILE *fp)</tt>
1414
1475
  </TD>
1415
1476
  <TD VAlign=top>
1416
- Write hashtable contents to <tt>fp</tt>. This is valid only if the
1417
- hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1477
+ This function is DEPRECATED. See <A HREF="#io">below</A>.
1418
1478
  </TD>
1419
1479
  </TR>
1420
1480
 
@@ -1423,8 +1483,7 @@ href="http://www.sgi.com/tech/stl/#3">[3]</A>
1423
1483
  <tt>bool read_nopointer_data(FILE *fp)</tt>
1424
1484
  </TD>
1425
1485
  <TD VAlign=top>
1426
- Read hashtable contents to <tt>fp</tt>. This is valid only if the
1427
- hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1486
+ This function is DEPRECATED. See <A HREF="#io">below</A>.
1428
1487
  </TD>
1429
1488
  </TR>
1430
1489
 
@@ -1542,69 +1601,125 @@ constructor, there are several workarounds:</p>
1542
1601
  </ul>
1543
1602
 
1544
1603
 
1545
- <h3><A NAME=io>Input/Output</A></h3>
1546
-
1547
- <table border=1 cellpadding=5><tr><td>
1548
- <p><b>IMPORTANT IMPLEMENTATION NOTE:</b> In the current version of
1549
- this code, the input/output routines for <tt>dense_hash_map</tt> have
1550
- <b>not yet been implemented</b>. This section explains the API, but
1551
- note that all calls to these routines will fail (return
1552
- <tt>false</tt>). It is a TODO to remedy this situation.</p>
1553
- </td></tr></table>
1604
+ <h3><A NAME="io">Input/Output</A></h3>
1554
1605
 
1555
1606
  <p>It is possible to save and restore <tt>dense_hash_map</tt> objects
1556
- to disk. Storage takes place in two steps. The first writes the
1557
- hashtable metadata. The second writes the actual data.</p>
1558
-
1559
- <p>To write a hashtable to disk, first call <tt>write_metadata()</tt>
1560
- on an open file pointer. This saves the hashtable information in a
1561
- byte-order-independent format.</p>
1562
-
1563
- <p>After the metadata has been written to disk, you must write the
1564
- actual data stored in the hash-map to disk. If both the key and data
1565
- are "simple" enough, you can do this by calling
1566
- <tt>write_nopointer_data()</tt>. "Simple" data is data that can be
1567
- safely copied to disk via <tt>fwrite()</tt>. Native C data types fall
1568
- into this category, as do structs of native C data types. Pointers
1569
- and STL objects do not.</p>
1570
-
1571
- <p>Note that <tt>write_nopointer_data()</tt> does not do any endian
1607
+ to an arbitrary stream (such as a disk file) using the
1608
+ <tt>serialize()</tt> and <tt>unserialize()</tt> methods.</p>
1609
+
1610
+ <p>Each of these methods takes two arguments: a <i>serializer</i>,
1611
+ which says how to write hashtable items to disk, and a <i>stream</i>,
1612
+ which can be a C++ stream (<tt>istream</tt> or its subclasses for
1613
+ input, <tt>ostream</tt> or its subclasses for output), a
1614
+ <tt>FILE*</tt>, or a user-defined type (as described below).</p>
1615
+
1616
+ <p>The <it>serializer</i> is a functor that takes a stream and a
1617
+ single hashtable element (a <tt>value_type</tt>, which is a pair of
1618
+ the key and data) and copies the hashtable element to the stream (for
1619
+ <tt>serialize()</tt>) or fills the hashtable element contents from the
1620
+ stream (for <tt>unserialize()</tt>), and returns true on success or
1621
+ false on error. The copy-in and copy-out functions can be provided in
1622
+ a single functor. Here is a sample serializer that read/writes a hashtable
1623
+ element for an int-to-string hash_map to a <tt>FILE*</tt>:</p>
1624
+
1625
+ <pre>
1626
+ struct StringToIntSerializer {
1627
+ bool operator()(FILE* fp, const std::pair&lt;const int, std::string&gt;&amp; value) const {
1628
+ // Write the key. We ignore endianness for this example.
1629
+ if (fwrite(&amp;value.first, sizeof(value.first), 1, fp) != 1)
1630
+ return false;
1631
+ // Write the value.
1632
+ assert(value.second.length() &lt;= 255); // we only support writing small strings
1633
+ const unsigned char size = value.second.length();
1634
+ if (fwrite(&amp;size, 1, 1, fp) != 1)
1635
+ return false;
1636
+ if (fwrite(value.second.data(), size, 1, fp) != 1)
1637
+ return false;
1638
+ return true;
1639
+ }
1640
+ bool operator()(FILE* fp, std::pair&lt;const int, std::string&gt;* value) const {
1641
+ // Read the key. Note the need for const_cast to get around
1642
+ // the fact hash_map keys are always const.
1643
+ if (fread(const_cast&lt;int*&gt;(&amp;value-&gt;first), sizeof(value-&gt;first), 1, fp) != 1)
1644
+ return false;
1645
+ // Read the value.
1646
+ unsigned char size; // all strings are &lt;= 255 chars long
1647
+ if (fread(&amp;size, 1, 1, fp) != 1)
1648
+ return false;
1649
+ char* buf = new char[size];
1650
+ if (fread(buf, size, 1, fp) != 1) {
1651
+ delete[] buf;
1652
+ return false;
1653
+ }
1654
+ value-&gt;second.assign(buf, size);
1655
+ delete[] buf;
1656
+ return true;
1657
+ }
1658
+ };
1659
+ </pre>
1660
+
1661
+ <p>Here is the functor being used in code (error checking omitted):</p>
1662
+ <pre>
1663
+ dense_hash_map&lt;string, int&gt; mymap = CreateMap();
1664
+ FILE* fp = fopen("hashtable.data", "w");
1665
+ mymap.serialize(StringToIntSerializer(), fp);
1666
+ fclose(fp);
1667
+
1668
+ dense_hash_map&lt;string, int&gt; mymap2;
1669
+ FILE* fp_in = fopen("hashtable.data", "r");
1670
+ mymap2.unserialize(StringToIntSerializer(), fp_in);
1671
+ fclose(fp_in);
1672
+ assert(mymap == mymap2);
1673
+ </pre>
1674
+
1675
+ <p>Note that this example serializer can only serialize to a FILE*.
1676
+ If you want to also be able to use this serializer with C++ streams,
1677
+ you will need to write two more overloads of <tt>operator()</tt>'s,
1678
+ one that reads from an <tt>istream</tt>, and one that writes to an
1679
+ <tt>ostream</tt>. Likewise if you want to support serializing to a
1680
+ custom class.</p>
1681
+
1682
+ <p>If both the key and data are "simple" enough, you can use the
1683
+ pre-supplied functor <tt>NopointerSerializer</tt>. This copies the
1684
+ hashtable data using the equivalent of a <tt>memcpy<></tt>. Native C
1685
+ data types can be serialized this way, as can structs of native C data
1686
+ types. Pointers and STL objects cannot.</p>
1687
+
1688
+ <p>Note that <tt>NopointerSerializer()</tt> does not do any endian
1572
1689
  conversion. Thus, it is only appropriate when you intend to read the
1573
1690
  data on the same endian architecture as you write the data.</p>
1574
1691
 
1575
- <p>If you cannot use <tt>write_nopointer_data()</tt> for any reason,
1576
- you can write the data yourself by iterating over the
1577
- <tt>dense_hash_map</tt> with a <tt>const_iterator</tt> and writing
1578
- the key and data in any manner you wish.</p>
1579
-
1580
- <p>To read the hashtable information from disk, first you must create
1581
- a <tt>dense_hash_map</tt> object. Then open a file pointer to point
1582
- to the saved hashtable, and call <tt>read_metadata()</tt>. If you
1583
- saved the data via <tt>write_nopointer_data()</tt>, you can follow the
1584
- <tt>read_metadata()</tt> call with a call to
1585
- <tt>read_nopointer_data()</tt>. This is all that is needed.</p>
1586
-
1587
- <p>If you saved the data through a custom write routine, you must call
1588
- a custom read routine to read in the data. To do this, iterate over
1589
- the <tt>dense_hash_map</tt> with an <tt>iterator</tt>; this operation
1590
- is sensical because the metadata has already been set up. For each
1591
- iterator item, you can read the key and value from disk, and set it
1592
- appropriately. You will need to do a <tt>const_cast</tt> on the
1593
- iterator, since <tt>it-&gt;first</tt> is always <tt>const</tt>. You
1594
- will also need to use placement-new if the key or value is a C++
1595
- object. The code might look like this:</p>
1692
+ <p>If you wish to serialize to your own stream type, you can do so by
1693
+ creating an object which supports two methods:</p>
1596
1694
  <pre>
1597
- for (dense_hash_map&lt;int*, ComplicatedClass&gt;::iterator it = ht.begin();
1598
- it != ht.end(); ++it) {
1599
- // The key is stored in the dense_hash_map as a pointer
1600
- const_cast&lt;int*&gt;(it-&gt;first) = new int;
1601
- fread(const_cast&lt;int*&gt;(it-&gt;first), sizeof(int), 1, fp);
1602
- // The value is a complicated C++ class that takes an int to construct
1603
- int ctor_arg;
1604
- fread(&ctor_arg, sizeof(int), 1, fp);
1605
- new (&it-&gt;second) ComplicatedClass(ctor_arg); // "placement new"
1606
- }
1695
+ bool Write(const void* data, size_t length);
1696
+ bool Read(void* data, size_t length);
1607
1697
  </pre>
1698
+ <p><tt>Write()</tt> writes <tt>length</tt> bytes of <tt>data</tt> to a
1699
+ stream (presumably a stream owned by the object), while
1700
+ <tt>Read()</tt> reads <tt>data</tt> bytes from the stream into
1701
+ <tt>data</tt>. Both return true on success or false on error.</p>
1702
+
1703
+ <p>To unserialize a hashtable from a stream, you wil typically create
1704
+ a new <tt>dense_hash_map</tt> object, then call <tt>unserialize()</tt>
1705
+ on it. <tt>unserialize()</tt> destroys the old contents of the
1706
+ object. You must pass in the appropriate <tt>ValueSerializer</tt> for
1707
+ the data being read in.</p>
1708
+
1709
+ <p>Both <tt>serialize()</tt> and <tt>unserialize()</tt> return
1710
+ <tt>true</tt> on success, or <tt>false</tt> if there was an error
1711
+ streaming the data.</p>
1712
+
1713
+ <p>Note that <tt>serialize()</tt> is not a const method, since it
1714
+ purges deleted elements before serializing. It is not safe to
1715
+ serialize from two threads at once, without synchronization.</p>
1716
+
1717
+ <p>NOTE: older versions of <tt>dense_hash_map</tt> provided a
1718
+ different API, consisting of <tt>read_metadata()</tt>,
1719
+ <tt>read_nopointer_data()</tt>, <tt>write_metadata()</tt>,
1720
+ <tt>write_nopointer_data()</tt>. These methods were never implemented
1721
+ and always did nothing but return <tt>false</tt>. You should
1722
+ exclusively use the new API for serialization.</p>
1608
1723
 
1609
1724
 
1610
1725
  <h3><A NAME=iter>Validity of Iterators</A></h3>