Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Updates sparsehash to 2.0.3 dating from 2015-10-12 #55

Merged
merged 4 commits into from May 9, 2017
View
@@ -42,7 +42,7 @@ getrel:
$(PKG).spec:
perl -pe 's/%RELEASE%/${REL}/' $(PKG).spex > $(PKG).spec
-$(PKG).tar.gz: Makefile $(TOOLS) $(SRC) $(PKG).spec fastq-lib.cpp fastq-lib.h sam-stats.cpp fastq-stats.cpp gcModel.cpp gcModel.h varcall.cpp utils.h README CHANGES sparsehash-2.0.2 samtools/*.c t
+$(PKG).tar.gz: Makefile $(TOOLS) $(SRC) $(PKG).spec fastq-lib.cpp fastq-lib.h sam-stats.cpp fastq-stats.cpp gcModel.cpp gcModel.h varcall.cpp utils.h README CHANGES sparsehash-2.0.3 samtools/*.c t
rm -rf $(PKG).${VER}-${REL}
mkdir $(PKG).${VER}-${REL}
mkdir $(PKG).${VER}-${REL}/tidx
@@ -68,10 +68,10 @@ $(PKG).${VER}-${REL}.tar.gz: $(PKG).tar.gz
%: %.cpp fastq-lib.cpp fastq-lib.h sparsehash
$(CC) $(CFLAGS) $< fastq-lib.cpp -o $@
-sparsehash: sparsehash-2.0.2
- cd sparsehash-2.0.2; ./configure; make
+sparsehash: sparsehash-2.0.3
+ cd sparsehash-2.0.3; ./configure; make
mkdir sparsehash
- cp -r sparsehash-2.0.2/src/sparsehash/* sparsehash/
+ cp -r sparsehash-2.0.3/src/sparsehash/* sparsehash/
# why the libbam.a doesn't work? not sure... *.o works
sam-stats: sam-stats.cpp samtools/libbam.a samtools/bam.h fastq-lib.h sparsehash
File renamed without changes.
File renamed without changes.
@@ -1,3 +1,8 @@
+Mon Oct 12 21:00:00 2015 Google Inc. <google-sparsehash@googlegroups.com>
+
+ * sparsehash: version 2.0.3
+ * Fix compilation on modern compilers and operating systems
+
Thu Feb 23 23:47:18 2012 Google Inc. <google-sparsehash@googlegroups.com>
* sparsehash: version 2.0.2
File renamed without changes.
@@ -1,4 +1,9 @@
-== 23 Ferbruary 2012 ==
+== 12 October 2015 ==
+
+Various small fixes to ensure compilation on modern compilers and operating
+systems. Tagged as 2.0.3
+
+== 23 February 2012 ==
A backwards incompatibility arose from flattening the include headers
structure for the <google> folder.
File renamed without changes.
@@ -1,25 +1,25 @@
-This project has been ported to Windows. A working solution file
-exists in this directory:
- sparsehash.sln
-
-You can load this solution file into either VC++ 7.1 (Visual Studio
-2003) or VC++ 8.0 (Visual Studio 2005) -- in the latter case, it will
-automatically convert the files to the latest format for you.
-
-When you build the solution, it will create a number of
-unittests,which you can run by hand (or, more easily, under the Visual
-Studio debugger) to make sure everything is working properly on your
-system. The binaries will end up in a directory called "debug" or
-"release" in the top-level directory (next to the .sln file).
-
-Note that these systems are set to build in Debug mode by default.
-You may want to change them to Release mode.
-
-I have little experience with Windows programming, so there may be
-better ways to set this up than I've done! If you run across any
-problems, please post to the google-sparsehash Google Group, or report
-them on the sparsehash Google Code site:
- http://groups.google.com/group/google-sparsehash
- http://code.google.com/p/sparsehash/issues/list
-
--- craig
+This project has been ported to Windows. A working solution file
+exists in this directory:
+ sparsehash.sln
+
+You can load this solution file into either VC++ 7.1 (Visual Studio
+2003) or VC++ 8.0 (Visual Studio 2005) -- in the latter case, it will
+automatically convert the files to the latest format for you.
+
+When you build the solution, it will create a number of
+unittests,which you can run by hand (or, more easily, under the Visual
+Studio debugger) to make sure everything is working properly on your
+system. The binaries will end up in a directory called "debug" or
+"release" in the top-level directory (next to the .sln file).
+
+Note that these systems are set to build in Debug mode by default.
+You may want to change them to Release mode.
+
+I have little experience with Windows programming, so there may be
+better ways to set this up than I've done! If you run across any
+problems, please post to the google-sparsehash Google Group, or report
+them on the sparsehash Google Code site:
+ http://groups.google.com/group/google-sparsehash
+ http://code.google.com/p/sparsehash/issues/list
+
+-- craig
File renamed without changes.
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# Before using, you should figure out all the .m4 macros that your
+# configure.m4 script needs and make sure they exist in the m4/
+# directory.
+#
+# These are the files that this script might edit:
+# aclocal.m4 configure Makefile.in src/config.h.in \
+# compile config.guess config.sub depcomp install-sh missing mkinstalldirs
+#
+# Here's a command you can run to see what files aclocal will import:
+# aclocal -I ../autoconf --output=- | sed -n 's/^m4_include..\([^]]*\).*/\1/p'
+
+set -ex
+rm -rf autom4te.cache
+
+aclocal --force -I m4
+autoconf -f -W all,no-obsolete
+autoheader -f -W all
+automake -a -c -f -W all
+
+rm -rf autom4te.cache
+exit 0
File renamed without changes.
@@ -0,0 +1,9 @@
+example: example.o libchash.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+.SUFFIXES: .c .o .h
+.c.o:
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+example.o: example.c libchash.h
+libchash.o: libchash.c libchash.h
@@ -0,0 +1,14 @@
+This is a C version of sparsehash (and also, maybe, densehash) that I
+wrote way back when, and served as the inspiration for the C++
+version. The API for the C version is much uglier than the C++,
+because of the lack of template support. I believe the class works,
+but I'm not convinced it's really flexible or easy enough to use.
+
+It would be nice to rework this C class to follow the C++ API as
+closely as possible (eg have a set_deleted_key() instead of using a
+#define like this code does now). I believe the code compiles and
+runs, if anybody is interested in using it now, but it's subject to
+major change in the future, as people work on it.
+
+Craig Silverstein
+20 March 2005
@@ -0,0 +1,55 @@
+#include <sparsehash/internal/sparseconfig.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include "libchash.h"
+
+static void TestInsert() {
+ struct HashTable* ht;
+ HTItem* bck;
+
+ ht = AllocateHashTable(1, 0); /* value is 1 byte, 0: don't copy keys */
+
+ HashInsert(ht, PTR_KEY(ht, "January"), 31); /* 0: don't overwrite old val */
+ bck = HashInsert(ht, PTR_KEY(ht, "February"), 28);
+ bck = HashInsert(ht, PTR_KEY(ht, "March"), 31);
+
+ bck = HashFind(ht, PTR_KEY(ht, "February"));
+ assert(bck);
+ assert(bck->data == 28);
+
+ FreeHashTable(ht);
+}
+
+static void TestFindOrInsert() {
+ struct HashTable* ht;
+ int i;
+ int iterations = 1000000;
+ int range = 30; /* random number between 1 and 30 */
+
+ ht = AllocateHashTable(4, 0); /* value is 4 bytes, 0: don't copy keys */
+
+ /* We'll test how good rand() is as a random number generator */
+ for (i = 0; i < iterations; ++i) {
+ int key = rand() % range;
+ HTItem* bck = HashFindOrInsert(ht, key, 0); /* initialize to 0 */
+ bck->data++; /* found one more of them */
+ }
+
+ for (i = 0; i < range; ++i) {
+ HTItem* bck = HashFind(ht, i);
+ if (bck) {
+ printf("%3d: %d\n", bck->key, bck->data);
+ } else {
+ printf("%3d: 0\n", i);
+ }
+ }
+
+ FreeHashTable(ht);
+}
+
+int main(int argc, char** argv) {
+ TestInsert();
+ TestFindOrInsert();
+ return 0;
+}
Oops, something went wrong.