Removed fingerprint methods and fixed pending bugs.
This commit is contained in:
parent
6c22c28319
commit
7ad2151315
93
src/Makefile
93
src/Makefile
@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
# Makefile.in generated by automake 1.10.1 from Makefile.am.
|
||||||
# src/Makefile. Generated from Makefile.in by configure.
|
# src/Makefile. Generated from Makefile.in by configure.
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@ -32,8 +32,8 @@ POST_INSTALL = :
|
|||||||
NORMAL_UNINSTALL = :
|
NORMAL_UNINSTALL = :
|
||||||
PRE_UNINSTALL = :
|
PRE_UNINSTALL = :
|
||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
build_triplet = x86_64-unknown-linux-gnu
|
build_triplet = i686-pc-linux-gnu
|
||||||
host_triplet = x86_64-unknown-linux-gnu
|
host_triplet = i686-pc-linux-gnu
|
||||||
bin_PROGRAMS = cmph$(EXEEXT)
|
bin_PROGRAMS = cmph$(EXEEXT)
|
||||||
subdir = src
|
subdir = src
|
||||||
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
|
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
|
||||||
@ -59,8 +59,8 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
|||||||
libcmph_la_LIBADD =
|
libcmph_la_LIBADD =
|
||||||
am_libcmph_la_OBJECTS = bitbool.lo hash.lo jenkins_hash.lo vstack.lo \
|
am_libcmph_la_OBJECTS = bitbool.lo hash.lo jenkins_hash.lo vstack.lo \
|
||||||
vqueue.lo graph.lo cmph.lo cmph_structs.lo chm.lo bmz.lo \
|
vqueue.lo graph.lo cmph.lo cmph_structs.lo chm.lo bmz.lo \
|
||||||
bmz8.lo bdz.lo buffer_manager.lo buffer_entry.lo brz.lo fch.lo \
|
bmz8.lo bdz.lo bdz_ph.lo buffer_manager.lo buffer_entry.lo \
|
||||||
fch_buckets.lo
|
brz.lo fch.lo fch_buckets.lo
|
||||||
libcmph_la_OBJECTS = $(am_libcmph_la_OBJECTS)
|
libcmph_la_OBJECTS = $(am_libcmph_la_OBJECTS)
|
||||||
libcmph_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
libcmph_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
@ -89,16 +89,16 @@ HEADERS = $(include_HEADERS)
|
|||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
ACLOCAL = ${SHELL} /home/fbotelho/doutorado/algoritmos/cmph/missing --run aclocal-1.10
|
ACLOCAL = ${SHELL} /home/davi/cvs/cmph2/cmph/missing --run aclocal-1.10
|
||||||
AMTAR = ${SHELL} /home/fbotelho/doutorado/algoritmos/cmph/missing --run tar
|
AMTAR = ${SHELL} /home/davi/cvs/cmph2/cmph/missing --run tar
|
||||||
AR = ar
|
AR = ar
|
||||||
AUTOCONF = ${SHELL} /home/fbotelho/doutorado/algoritmos/cmph/missing --run autoconf
|
AUTOCONF = ${SHELL} /home/davi/cvs/cmph2/cmph/missing --run autoconf
|
||||||
AUTOHEADER = ${SHELL} /home/fbotelho/doutorado/algoritmos/cmph/missing --run autoheader
|
AUTOHEADER = ${SHELL} /home/davi/cvs/cmph2/cmph/missing --run autoheader
|
||||||
AUTOMAKE = ${SHELL} /home/fbotelho/doutorado/algoritmos/cmph/missing --run automake-1.10
|
AUTOMAKE = ${SHELL} /home/davi/cvs/cmph2/cmph/missing --run automake-1.10
|
||||||
AWK = mawk
|
AWK = gawk
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CCDEPMODE = depmode=gcc3
|
CCDEPMODE = depmode=gcc3
|
||||||
CFLAGS = -Wall -Werror -lm
|
CFLAGS = -g -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
|
||||||
CPP = gcc -E
|
CPP = gcc -E
|
||||||
CPPFLAGS =
|
CPPFLAGS =
|
||||||
CXX = g++
|
CXX = g++
|
||||||
@ -108,14 +108,15 @@ CXXFLAGS = -g -O2
|
|||||||
CYGPATH_W = echo
|
CYGPATH_W = echo
|
||||||
DEFS = -DHAVE_CONFIG_H
|
DEFS = -DHAVE_CONFIG_H
|
||||||
DEPDIR = .deps
|
DEPDIR = .deps
|
||||||
|
DSYMUTIL =
|
||||||
ECHO = echo
|
ECHO = echo
|
||||||
ECHO_C =
|
ECHO_C =
|
||||||
ECHO_N = -n
|
ECHO_N = -n
|
||||||
ECHO_T =
|
ECHO_T =
|
||||||
EGREP = /bin/grep -E
|
EGREP = /bin/grep -E
|
||||||
EXEEXT =
|
EXEEXT =
|
||||||
F77 =
|
F77 = gfortran
|
||||||
FFLAGS =
|
FFLAGS = -g -O2
|
||||||
GETCONF = getconf
|
GETCONF = getconf
|
||||||
GREP = /bin/grep
|
GREP = /bin/grep
|
||||||
INSTALL = /usr/bin/install -c
|
INSTALL = /usr/bin/install -c
|
||||||
@ -123,14 +124,15 @@ INSTALL_DATA = ${INSTALL} -m 644
|
|||||||
INSTALL_PROGRAM = ${INSTALL}
|
INSTALL_PROGRAM = ${INSTALL}
|
||||||
INSTALL_SCRIPT = ${INSTALL}
|
INSTALL_SCRIPT = ${INSTALL}
|
||||||
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
|
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
|
||||||
LDFLAGS =
|
LDFLAGS = -lm
|
||||||
LIBOBJS =
|
LIBOBJS =
|
||||||
LIBS =
|
LIBS =
|
||||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||||
LN_S = ln -s
|
LN_S = ln -s
|
||||||
LTLIBOBJS =
|
LTLIBOBJS =
|
||||||
MAKEINFO = ${SHELL} /home/fbotelho/doutorado/algoritmos/cmph/missing --run makeinfo
|
MAKEINFO = ${SHELL} /home/davi/cvs/cmph2/cmph/missing --run makeinfo
|
||||||
MKDIR_P = /bin/mkdir -p
|
MKDIR_P = /bin/mkdir -p
|
||||||
|
NMEDIT =
|
||||||
OBJEXT = o
|
OBJEXT = o
|
||||||
PACKAGE = cmph
|
PACKAGE = cmph
|
||||||
PACKAGE_BUGREPORT =
|
PACKAGE_BUGREPORT =
|
||||||
@ -142,42 +144,42 @@ PATH_SEPARATOR = :
|
|||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
SED = /bin/sed
|
SED = /bin/sed
|
||||||
SET_MAKE =
|
SET_MAKE =
|
||||||
SHELL = /bin/bash
|
SHELL = /bin/sh
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
VERSION = 0.7
|
VERSION = 0.8
|
||||||
abs_builddir = /home/fbotelho/doutorado/algoritmos/cmph/src
|
abs_builddir = /home/davi/cvs/cmph2/cmph/src
|
||||||
abs_srcdir = /home/fbotelho/doutorado/algoritmos/cmph/src
|
abs_srcdir = /home/davi/cvs/cmph2/cmph/src
|
||||||
abs_top_builddir = /home/fbotelho/doutorado/algoritmos/cmph
|
abs_top_builddir = /home/davi/cvs/cmph2/cmph
|
||||||
abs_top_srcdir = /home/fbotelho/doutorado/algoritmos/cmph
|
abs_top_srcdir = /home/davi/cvs/cmph2/cmph
|
||||||
ac_ct_CC = gcc
|
ac_ct_CC = gcc
|
||||||
ac_ct_CXX = g++
|
ac_ct_CXX = g++
|
||||||
ac_ct_F77 =
|
ac_ct_F77 = gfortran
|
||||||
am__include = include
|
am__include = include
|
||||||
am__leading_dot = .
|
am__leading_dot = .
|
||||||
am__quote =
|
am__quote =
|
||||||
am__tar = ${AMTAR} chof - "$$tardir"
|
am__tar = ${AMTAR} chof - "$$tardir"
|
||||||
am__untar = ${AMTAR} xf -
|
am__untar = ${AMTAR} xf -
|
||||||
bindir = ${exec_prefix}/bin
|
bindir = ${exec_prefix}/bin
|
||||||
build = x86_64-unknown-linux-gnu
|
build = i686-pc-linux-gnu
|
||||||
build_alias =
|
build_alias =
|
||||||
build_cpu = x86_64
|
build_cpu = i686
|
||||||
build_os = linux-gnu
|
build_os = linux-gnu
|
||||||
build_vendor = unknown
|
build_vendor = pc
|
||||||
builddir = .
|
builddir = .
|
||||||
datadir = ${datarootdir}
|
datadir = ${datarootdir}
|
||||||
datarootdir = ${prefix}/share
|
datarootdir = ${prefix}/share
|
||||||
docdir = ${datarootdir}/doc/${PACKAGE}
|
docdir = ${datarootdir}/doc/${PACKAGE}
|
||||||
dvidir = ${docdir}
|
dvidir = ${docdir}
|
||||||
exec_prefix = ${prefix}
|
exec_prefix = ${prefix}
|
||||||
host = x86_64-unknown-linux-gnu
|
host = i686-pc-linux-gnu
|
||||||
host_alias =
|
host_alias =
|
||||||
host_cpu = x86_64
|
host_cpu = i686
|
||||||
host_os = linux-gnu
|
host_os = linux-gnu
|
||||||
host_vendor = unknown
|
host_vendor = pc
|
||||||
htmldir = ${docdir}
|
htmldir = ${docdir}
|
||||||
includedir = ${prefix}/include
|
includedir = ${prefix}/include
|
||||||
infodir = ${datarootdir}/info
|
infodir = ${datarootdir}/info
|
||||||
install_sh = $(SHELL) /home/fbotelho/doutorado/algoritmos/cmph/install-sh
|
install_sh = $(SHELL) /home/davi/cvs/cmph2/cmph/install-sh
|
||||||
libdir = ${exec_prefix}/lib
|
libdir = ${exec_prefix}/lib
|
||||||
libexecdir = ${exec_prefix}/libexec
|
libexecdir = ${exec_prefix}/libexec
|
||||||
localedir = ${datarootdir}/locale
|
localedir = ${datarootdir}/locale
|
||||||
@ -186,7 +188,7 @@ mandir = ${datarootdir}/man
|
|||||||
mkdir_p = /bin/mkdir -p
|
mkdir_p = /bin/mkdir -p
|
||||||
oldincludedir = /usr/include
|
oldincludedir = /usr/include
|
||||||
pdfdir = ${docdir}
|
pdfdir = ${docdir}
|
||||||
prefix = /usr/local
|
prefix = /usr
|
||||||
program_transform_name = s,x,x,
|
program_transform_name = s,x,x,
|
||||||
psdir = ${docdir}
|
psdir = ${docdir}
|
||||||
sbindir = ${exec_prefix}/sbin
|
sbindir = ${exec_prefix}/sbin
|
||||||
@ -212,6 +214,7 @@ libcmph_la_SOURCES = debug.h\
|
|||||||
bmz.h bmz_structs.h bmz.c\
|
bmz.h bmz_structs.h bmz.c\
|
||||||
bmz8.h bmz8_structs.h bmz8.c\
|
bmz8.h bmz8_structs.h bmz8.c\
|
||||||
bdz.h bdz_structs.h bdz.c\
|
bdz.h bdz_structs.h bdz.c\
|
||||||
|
bdz_ph.h bdz_structs_ph.h bdz_ph.c\
|
||||||
buffer_manager.h buffer_manager.c\
|
buffer_manager.h buffer_manager.c\
|
||||||
buffer_entry.h buffer_entry.c\
|
buffer_entry.h buffer_entry.c\
|
||||||
brz.h brz_structs.h brz.c\
|
brz.h brz_structs.h brz.c\
|
||||||
@ -260,8 +263,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
|||||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
if test -f $$p; then \
|
if test -f $$p; then \
|
||||||
f=$(am__strip_dir) \
|
f=$(am__strip_dir) \
|
||||||
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
|
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
|
||||||
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
|
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
|
||||||
else :; fi; \
|
else :; fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -269,8 +272,8 @@ uninstall-libLTLIBRARIES:
|
|||||||
@$(NORMAL_UNINSTALL)
|
@$(NORMAL_UNINSTALL)
|
||||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
p=$(am__strip_dir) \
|
p=$(am__strip_dir) \
|
||||||
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
|
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
|
||||||
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
|
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
|
||||||
done
|
done
|
||||||
|
|
||||||
clean-libLTLIBRARIES:
|
clean-libLTLIBRARIES:
|
||||||
@ -292,8 +295,8 @@ install-binPROGRAMS: $(bin_PROGRAMS)
|
|||||||
|| test -f $$p1 \
|
|| test -f $$p1 \
|
||||||
; then \
|
; then \
|
||||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
|
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
|
||||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
|
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
|
||||||
else :; fi; \
|
else :; fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -322,6 +325,7 @@ distclean-compile:
|
|||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
include ./$(DEPDIR)/bdz.Plo
|
include ./$(DEPDIR)/bdz.Plo
|
||||||
|
include ./$(DEPDIR)/bdz_ph.Plo
|
||||||
include ./$(DEPDIR)/bitbool.Plo
|
include ./$(DEPDIR)/bitbool.Plo
|
||||||
include ./$(DEPDIR)/bmz.Plo
|
include ./$(DEPDIR)/bmz.Plo
|
||||||
include ./$(DEPDIR)/bmz8.Plo
|
include ./$(DEPDIR)/bmz8.Plo
|
||||||
@ -390,8 +394,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
mkid -fID $$unique
|
mkid -fID $$unique
|
||||||
tags: TAGS
|
tags: TAGS
|
||||||
|
|
||||||
@ -403,8 +407,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
test -n "$$unique" || unique=$$empty_fix; \
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
@ -414,13 +418,12 @@ ctags: CTAGS
|
|||||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
tags=; \
|
tags=; \
|
||||||
here=`pwd`; \
|
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||||
$$tags $$unique
|
$$tags $$unique
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
# Makefile.in generated by automake 1.10.1 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@ -59,8 +59,8 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
|||||||
libcmph_la_LIBADD =
|
libcmph_la_LIBADD =
|
||||||
am_libcmph_la_OBJECTS = bitbool.lo hash.lo jenkins_hash.lo vstack.lo \
|
am_libcmph_la_OBJECTS = bitbool.lo hash.lo jenkins_hash.lo vstack.lo \
|
||||||
vqueue.lo graph.lo cmph.lo cmph_structs.lo chm.lo bmz.lo \
|
vqueue.lo graph.lo cmph.lo cmph_structs.lo chm.lo bmz.lo \
|
||||||
bmz8.lo bdz.lo buffer_manager.lo buffer_entry.lo brz.lo fch.lo \
|
bmz8.lo bdz.lo bdz_ph.lo buffer_manager.lo buffer_entry.lo \
|
||||||
fch_buckets.lo
|
brz.lo fch.lo fch_buckets.lo
|
||||||
libcmph_la_OBJECTS = $(am_libcmph_la_OBJECTS)
|
libcmph_la_OBJECTS = $(am_libcmph_la_OBJECTS)
|
||||||
libcmph_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
libcmph_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
@ -70,7 +70,7 @@ PROGRAMS = $(bin_PROGRAMS)
|
|||||||
am_cmph_OBJECTS = main.$(OBJEXT) wingetopt.$(OBJEXT)
|
am_cmph_OBJECTS = main.$(OBJEXT) wingetopt.$(OBJEXT)
|
||||||
cmph_OBJECTS = $(am_cmph_OBJECTS)
|
cmph_OBJECTS = $(am_cmph_OBJECTS)
|
||||||
cmph_DEPENDENCIES = libcmph.la
|
cmph_DEPENDENCIES = libcmph.la
|
||||||
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
|
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
am__depfiles_maybe = depfiles
|
am__depfiles_maybe = depfiles
|
||||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
@ -108,6 +108,7 @@ CXXFLAGS = @CXXFLAGS@
|
|||||||
CYGPATH_W = @CYGPATH_W@
|
CYGPATH_W = @CYGPATH_W@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
DEPDIR = @DEPDIR@
|
DEPDIR = @DEPDIR@
|
||||||
|
DSYMUTIL = @DSYMUTIL@
|
||||||
ECHO = @ECHO@
|
ECHO = @ECHO@
|
||||||
ECHO_C = @ECHO_C@
|
ECHO_C = @ECHO_C@
|
||||||
ECHO_N = @ECHO_N@
|
ECHO_N = @ECHO_N@
|
||||||
@ -131,6 +132,7 @@ LN_S = @LN_S@
|
|||||||
LTLIBOBJS = @LTLIBOBJS@
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
MKDIR_P = @MKDIR_P@
|
MKDIR_P = @MKDIR_P@
|
||||||
|
NMEDIT = @NMEDIT@
|
||||||
OBJEXT = @OBJEXT@
|
OBJEXT = @OBJEXT@
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
@ -212,6 +214,7 @@ libcmph_la_SOURCES = debug.h\
|
|||||||
bmz.h bmz_structs.h bmz.c\
|
bmz.h bmz_structs.h bmz.c\
|
||||||
bmz8.h bmz8_structs.h bmz8.c\
|
bmz8.h bmz8_structs.h bmz8.c\
|
||||||
bdz.h bdz_structs.h bdz.c\
|
bdz.h bdz_structs.h bdz.c\
|
||||||
|
bdz_ph.h bdz_structs_ph.h bdz_ph.c\
|
||||||
buffer_manager.h buffer_manager.c\
|
buffer_manager.h buffer_manager.c\
|
||||||
buffer_entry.h buffer_entry.c\
|
buffer_entry.h buffer_entry.c\
|
||||||
brz.h brz_structs.h brz.c\
|
brz.h brz_structs.h brz.c\
|
||||||
@ -260,8 +263,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
|||||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
if test -f $$p; then \
|
if test -f $$p; then \
|
||||||
f=$(am__strip_dir) \
|
f=$(am__strip_dir) \
|
||||||
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
|
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
|
||||||
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
|
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
|
||||||
else :; fi; \
|
else :; fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -269,8 +272,8 @@ uninstall-libLTLIBRARIES:
|
|||||||
@$(NORMAL_UNINSTALL)
|
@$(NORMAL_UNINSTALL)
|
||||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
p=$(am__strip_dir) \
|
p=$(am__strip_dir) \
|
||||||
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
|
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
|
||||||
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
|
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
|
||||||
done
|
done
|
||||||
|
|
||||||
clean-libLTLIBRARIES:
|
clean-libLTLIBRARIES:
|
||||||
@ -292,8 +295,8 @@ install-binPROGRAMS: $(bin_PROGRAMS)
|
|||||||
|| test -f $$p1 \
|
|| test -f $$p1 \
|
||||||
; then \
|
; then \
|
||||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
|
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
|
||||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
|
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
|
||||||
else :; fi; \
|
else :; fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -322,6 +325,7 @@ distclean-compile:
|
|||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdz.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdz.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdz_ph.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitbool.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitbool.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmz.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmz.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmz8.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmz8.Plo@am__quote@
|
||||||
@ -390,8 +394,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
mkid -fID $$unique
|
mkid -fID $$unique
|
||||||
tags: TAGS
|
tags: TAGS
|
||||||
|
|
||||||
@ -403,8 +407,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||||
test -n "$$unique" || unique=$$empty_fix; \
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
@ -414,13 +418,12 @@ ctags: CTAGS
|
|||||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
$(TAGS_FILES) $(LISP)
|
$(TAGS_FILES) $(LISP)
|
||||||
tags=; \
|
tags=; \
|
||||||
here=`pwd`; \
|
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
END { for (i in files) print i; }'`; \
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||||
$$tags $$unique
|
$$tags $$unique
|
||||||
|
27
src/bdz.c
27
src/bdz.c
@ -599,33 +599,6 @@ void bdz_destroy(cmph_t *mphf)
|
|||||||
free(mphf);
|
free(mphf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** cmph_uint32 bdz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 bdz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
register cmph_uint32 vertex;
|
|
||||||
register bdz_data_t *bdz = mphf->data;
|
|
||||||
cmph_uint32 hl[3];
|
|
||||||
|
|
||||||
hash_vector(bdz->hl, key, keylen, hl);
|
|
||||||
memcpy(fingerprint, hl, sizeof(hl));
|
|
||||||
hl[0] = hl[0] % bdz->r;
|
|
||||||
hl[1] = hl[1] % bdz->r + bdz->r;
|
|
||||||
hl[2] = hl[2] % bdz->r + (bdz->r << 1);
|
|
||||||
vertex = hl[(GETVALUE(bdz->g, hl[0]) + GETVALUE(bdz->g, hl[1]) + GETVALUE(bdz->g, hl[2])) % 3];
|
|
||||||
return rank(bdz->b, bdz->ranktable, bdz->g, vertex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
14
src/bdz.h
14
src/bdz.h
@ -17,20 +17,6 @@ int bdz_dump(cmph_t *mphf, FILE *f);
|
|||||||
void bdz_destroy(cmph_t *mphf);
|
void bdz_destroy(cmph_t *mphf);
|
||||||
cmph_uint32 bdz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint32 bdz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint32 bdz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 bdz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
38
src/bdz_ph.c
38
src/bdz_ph.c
@ -527,44 +527,6 @@ void bdz_ph_destroy(cmph_t *mphf)
|
|||||||
free(mphf);
|
free(mphf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** cmph_uint32 bdz_ph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 bdz_ph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
register bdz_ph_data_t *bdz_ph = mphf->data;
|
|
||||||
cmph_uint32 hl[3];
|
|
||||||
register cmph_uint8 byte0, byte1, byte2;
|
|
||||||
register cmph_uint32 vertex;
|
|
||||||
|
|
||||||
hash_vector(bdz_ph->hl, key, keylen,hl);
|
|
||||||
memcpy(fingerprint, hl, sizeof(hl));
|
|
||||||
|
|
||||||
hl[0] = hl[0] % bdz_ph->r;
|
|
||||||
hl[1] = hl[1] % bdz_ph->r + bdz_ph->r;
|
|
||||||
hl[2] = hl[2] % bdz_ph->r + (bdz_ph->r << 1);
|
|
||||||
|
|
||||||
byte0 = bdz_ph->g[hl[0]/5];
|
|
||||||
byte1 = bdz_ph->g[hl[1]/5];
|
|
||||||
byte2 = bdz_ph->g[hl[2]/5];
|
|
||||||
|
|
||||||
byte0 = lookup_table[hl[0]%5][byte0];
|
|
||||||
byte1 = lookup_table[hl[1]%5][byte1];
|
|
||||||
byte2 = lookup_table[hl[2]%5][byte2];
|
|
||||||
vertex = hl[(byte0 + byte1 + byte2)%3];
|
|
||||||
|
|
||||||
return vertex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \fn void bdz_ph_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bdz_ph_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
14
src/bdz_ph.h
14
src/bdz_ph.h
@ -16,20 +16,6 @@ int bdz_ph_dump(cmph_t *mphf, FILE *f);
|
|||||||
void bdz_ph_destroy(cmph_t *mphf);
|
void bdz_ph_destroy(cmph_t *mphf);
|
||||||
cmph_uint32 bdz_ph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint32 bdz_ph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint32 bdz_ph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 bdz_ph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
/** \fn void bdz_ph_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bdz_ph_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
31
src/bmz.c
31
src/bmz.c
@ -22,7 +22,7 @@ static void bmz_traverse_non_critical_nodes(bmz_config_data_t *bmz, cmph_uint8 *
|
|||||||
|
|
||||||
bmz_config_data_t *bmz_config_new()
|
bmz_config_data_t *bmz_config_new()
|
||||||
{
|
{
|
||||||
bmz_config_data_t *bmz;
|
bmz_config_data_t *bmz = NULL;
|
||||||
bmz = (bmz_config_data_t *)malloc(sizeof(bmz_config_data_t));
|
bmz = (bmz_config_data_t *)malloc(sizeof(bmz_config_data_t));
|
||||||
assert(bmz);
|
assert(bmz);
|
||||||
memset(bmz, 0, sizeof(bmz_config_data_t));
|
memset(bmz, 0, sizeof(bmz_config_data_t));
|
||||||
@ -539,35 +539,6 @@ void bmz_destroy(cmph_t *mphf)
|
|||||||
free(mphf);
|
free(mphf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** cmph_uint32 bmz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 bmz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
bmz_data_t *bmz = mphf->data;
|
|
||||||
cmph_uint32 h1, h2;
|
|
||||||
|
|
||||||
hash_vector(bmz->hashes[0], key, keylen, fingerprint);
|
|
||||||
h1 = fingerprint[2] % bmz->n;
|
|
||||||
|
|
||||||
hash_vector(bmz->hashes[1], key, keylen, fingerprint);
|
|
||||||
h2 = fingerprint[2] % bmz->n;
|
|
||||||
|
|
||||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
|
||||||
if (h1 == h2 && ++h2 > bmz->n) h2 = 0;
|
|
||||||
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, bmz->g[h1], bmz->g[h2], bmz->m);
|
|
||||||
return bmz->g[h1] + bmz->g[h2];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \fn void bmz_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bmz_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
14
src/bmz.h
14
src/bmz.h
@ -16,20 +16,6 @@ int bmz_dump(cmph_t *mphf, FILE *f);
|
|||||||
void bmz_destroy(cmph_t *mphf);
|
void bmz_destroy(cmph_t *mphf);
|
||||||
cmph_uint32 bmz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint32 bmz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint32 bmz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 bmz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
/** \fn void bmz_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bmz_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
29
src/bmz8.c
29
src/bmz8.c
@ -548,35 +548,6 @@ void bmz8_destroy(cmph_t *mphf)
|
|||||||
free(mphf);
|
free(mphf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** cmph_uint8 bmz8_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint8 bmz8_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
bmz8_data_t *bmz8 = mphf->data;
|
|
||||||
cmph_uint8 h1, h2;
|
|
||||||
|
|
||||||
hash_vector(bmz8->hashes[0], key, keylen, fingerprint);
|
|
||||||
h1 = fingerprint[2] % bmz8->n;
|
|
||||||
|
|
||||||
hash_vector(bmz8->hashes[1], key, keylen, fingerprint);
|
|
||||||
h2 = fingerprint[2] % bmz8->n;
|
|
||||||
|
|
||||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
|
||||||
if (h1 == h2 && ++h2 > bmz8->n) h2 = 0;
|
|
||||||
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, bmz8->g[h1], bmz8->g[h2], bmz8->m);
|
|
||||||
return bmz8->g[h1] + bmz8->g[h2];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \fn void bmz8_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bmz8_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
14
src/bmz8.h
14
src/bmz8.h
@ -16,20 +16,6 @@ int bmz8_dump(cmph_t *mphf, FILE *f);
|
|||||||
void bmz8_destroy(cmph_t *mphf);
|
void bmz8_destroy(cmph_t *mphf);
|
||||||
cmph_uint8 bmz8_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint8 bmz8_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint8 bmz8_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint8 bmz8_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
/** \fn void bmz8_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void bmz8_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
28
src/brz.c
28
src/brz.c
@ -712,32 +712,6 @@ void brz_destroy(cmph_t *mphf)
|
|||||||
free(mphf);
|
free(mphf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** cmph_uint32 brz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 brz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
brz_data_t *brz = mphf->data;
|
|
||||||
switch(brz->algo)
|
|
||||||
{
|
|
||||||
case CMPH_FCH:
|
|
||||||
return brz_fch_search(brz, key, keylen, fingerprint);
|
|
||||||
case CMPH_BMZ8:
|
|
||||||
return brz_bmz8_search(brz, key, keylen, fingerprint);
|
|
||||||
default: assert(0);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \fn void brz_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void brz_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
@ -791,7 +765,7 @@ void brz_pack(cmph_t *mphf, void *packed_mphf)
|
|||||||
#if defined (__ia64) || defined (__x86_64__)
|
#if defined (__ia64) || defined (__x86_64__)
|
||||||
cmph_uint64 * g_is_ptr = (cmph_uint64 *)ptr;
|
cmph_uint64 * g_is_ptr = (cmph_uint64 *)ptr;
|
||||||
#else
|
#else
|
||||||
cmph_uint32 * g_is_ptr = ptr;
|
cmph_uint32 * g_is_ptr = (cmph_uint32 *)ptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmph_uint8 * g_i = (cmph_uint8 *) (g_is_ptr + data->k);
|
cmph_uint8 * g_i = (cmph_uint8 *) (g_is_ptr + data->k);
|
||||||
|
14
src/brz.h
14
src/brz.h
@ -21,20 +21,6 @@ int brz_dump(cmph_t *mphf, FILE *f);
|
|||||||
void brz_destroy(cmph_t *mphf);
|
void brz_destroy(cmph_t *mphf);
|
||||||
cmph_uint32 brz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint32 brz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint32 brz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 brz_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
/** \fn void brz_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void brz_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
32
src/chm.c
32
src/chm.c
@ -19,7 +19,7 @@ static void chm_traverse(chm_config_data_t *chm, cmph_uint8 *visited, cmph_uint3
|
|||||||
|
|
||||||
chm_config_data_t *chm_config_new()
|
chm_config_data_t *chm_config_new()
|
||||||
{
|
{
|
||||||
chm_config_data_t *chm;
|
chm_config_data_t *chm = NULL;
|
||||||
chm = (chm_config_data_t *)malloc(sizeof(chm_config_data_t));
|
chm = (chm_config_data_t *)malloc(sizeof(chm_config_data_t));
|
||||||
assert(chm);
|
assert(chm);
|
||||||
memset(chm, 0, sizeof(chm_config_data_t));
|
memset(chm, 0, sizeof(chm_config_data_t));
|
||||||
@ -293,36 +293,6 @@ void chm_destroy(cmph_t *mphf)
|
|||||||
free(mphf);
|
free(mphf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** cmph_uint32 chm_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 chm_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
chm_data_t *chm = mphf->data;
|
|
||||||
cmph_uint32 h1, h2;
|
|
||||||
|
|
||||||
hash_vector(chm->hashes[0], key, keylen, fingerprint);
|
|
||||||
h1 = fingerprint[2] % chm->n;
|
|
||||||
|
|
||||||
hash_vector(chm->hashes[1], key, keylen, fingerprint);
|
|
||||||
h2 = fingerprint[2] % chm->n;
|
|
||||||
|
|
||||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
|
||||||
if (h1 == h2 && ++h2 >= chm->n) h2 = 0;
|
|
||||||
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, chm->g[h1], chm->g[h2], chm->m);
|
|
||||||
return (chm->g[h1] + chm->g[h2]) % chm->m;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \fn void chm_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void chm_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
14
src/chm.h
14
src/chm.h
@ -16,20 +16,6 @@ int chm_dump(cmph_t *mphf, FILE *f);
|
|||||||
void chm_destroy(cmph_t *mphf);
|
void chm_destroy(cmph_t *mphf);
|
||||||
cmph_uint32 chm_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint32 chm_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint32 chm_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 chm_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
/** \fn void chm_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void chm_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
48
src/cmph.c
48
src/cmph.c
@ -612,54 +612,6 @@ cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** cmph_uint32 cmph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 cmph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
DEBUGP("mphf algorithm: %u \n", mphf->algo);
|
|
||||||
switch(mphf->algo)
|
|
||||||
{
|
|
||||||
case CMPH_CHM:
|
|
||||||
return chm_search_fingerprint(mphf, key, keylen, fingerprint);
|
|
||||||
case CMPH_BMZ: /* included -- Fabiano */
|
|
||||||
DEBUGP("bmz algorithm search\n");
|
|
||||||
return bmz_search_fingerprint(mphf, key, keylen, fingerprint);
|
|
||||||
case CMPH_BMZ8: /* included -- Fabiano */
|
|
||||||
DEBUGP("bmz8 algorithm search\n");
|
|
||||||
return bmz8_search_fingerprint(mphf, key, keylen, fingerprint);
|
|
||||||
case CMPH_BRZ: /* included -- Fabiano */
|
|
||||||
DEBUGP("brz algorithm search\n");
|
|
||||||
return brz_search_fingerprint(mphf, key, keylen, fingerprint);
|
|
||||||
case CMPH_FCH: /* included -- Fabiano */
|
|
||||||
DEBUGP("fch algorithm search\n");
|
|
||||||
return fch_search_fingerprint(mphf, key, keylen, fingerprint);
|
|
||||||
case CMPH_BDZ: /* included -- Fabiano */
|
|
||||||
DEBUGP("bdz algorithm search\n");
|
|
||||||
return bdz_search_fingerprint(mphf, key, keylen, fingerprint);
|
|
||||||
case CMPH_BDZ_PH: /* included -- Fabiano */
|
|
||||||
DEBUGP("bdz_ph algorithm search\n");
|
|
||||||
return bdz_ph_search_fingerprint(mphf, key, keylen, fingerprint);
|
|
||||||
default:
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
assert(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cmph_uint32 cmph_size(cmph_t *mphf)
|
cmph_uint32 cmph_size(cmph_t *mphf)
|
||||||
{
|
{
|
||||||
return mphf->size;
|
return mphf->size;
|
||||||
|
16
src/cmph.h
16
src/cmph.h
@ -69,22 +69,6 @@ cmph_t *cmph_new(cmph_config_t *mph);
|
|||||||
*/
|
*/
|
||||||
cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint32 cmph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e.,
|
|
||||||
* \brief figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 cmph_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
|
|
||||||
cmph_uint32 cmph_size(cmph_t *mphf);
|
cmph_uint32 cmph_size(cmph_t *mphf);
|
||||||
void cmph_destroy(cmph_t *mphf);
|
void cmph_destroy(cmph_t *mphf);
|
||||||
|
|
||||||
|
27
src/fch.c
27
src/fch.c
@ -411,33 +411,6 @@ void fch_destroy(cmph_t *mphf)
|
|||||||
free(mphf);
|
free(mphf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** cmph_uint32 fch_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 fch_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint)
|
|
||||||
{
|
|
||||||
register fch_data_t *fch = mphf->data;
|
|
||||||
|
|
||||||
hash_vector(fch->h1, key, keylen, fingerprint);
|
|
||||||
register cmph_uint32 h1 = fingerprint[2] % fch->m;
|
|
||||||
|
|
||||||
hash_vector(fch->h2, key, keylen, fingerprint);
|
|
||||||
register cmph_uint32 h2 = fingerprint[2] % fch->m;
|
|
||||||
|
|
||||||
h1 = mixh10h11h12 (fch->b, fch->p1, fch->p2, h1);
|
|
||||||
//DEBUGP("key: %s h1: %u h2: %u g[h1]: %u\n", key, h1, h2, fch->g[h1]);
|
|
||||||
return (h2 + fch->g[h1]) % fch->m;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \fn void fch_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void fch_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
14
src/fch.h
14
src/fch.h
@ -22,20 +22,6 @@ int fch_dump(cmph_t *mphf, FILE *f);
|
|||||||
void fch_destroy(cmph_t *mphf);
|
void fch_destroy(cmph_t *mphf);
|
||||||
cmph_uint32 fch_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
cmph_uint32 fch_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||||
|
|
||||||
/** cmph_uint32 fch_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
* \brief Computes the mphf value and a fingerprint of 12 bytes (i.e., figerprint should be a prealocated area to fit three 4-byte integers).
|
|
||||||
* \param mphf pointer to the resulting function
|
|
||||||
* \param key is the key to be hashed
|
|
||||||
* \param keylen is the key legth in bytes
|
|
||||||
* \return The mphf value
|
|
||||||
*
|
|
||||||
* Computes the mphf value and a fingerprint of 12 bytes. The figerprint pointer should be
|
|
||||||
* a prealocated area to fit three 4-byte integers. You don't need to use all the 12 bytes
|
|
||||||
* as fingerprint. According to the application, just few bits can be enough, once mphf does
|
|
||||||
* not allow collisions for the keys previously known.
|
|
||||||
*/
|
|
||||||
cmph_uint32 fch_search_fingerprint(cmph_t *mphf, const char *key, cmph_uint32 keylen, cmph_uint32 * fingerprint);
|
|
||||||
|
|
||||||
/** \fn void fch_pack(cmph_t *mphf, void *packed_mphf);
|
/** \fn void fch_pack(cmph_t *mphf, void *packed_mphf);
|
||||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||||
* \param mphf pointer to the resulting mphf
|
* \param mphf pointer to the resulting mphf
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "../wingetopt.h"
|
#include "wingetopt.h"
|
||||||
#else
|
#else
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
noinst_PROGRAMS = graph_tests packed_mphf_tests mphf_tests mphf_fingerprint_tests
|
noinst_PROGRAMS = graph_tests packed_mphf_tests mphf_tests
|
||||||
|
|
||||||
INCLUDES = -I../src/
|
INCLUDES = -I../src/
|
||||||
|
|
||||||
@ -10,6 +10,3 @@ packed_mphf_tests_LDADD = ../src/libcmph.la
|
|||||||
|
|
||||||
mphf_tests_SOURCES = mphf_tests.c
|
mphf_tests_SOURCES = mphf_tests.c
|
||||||
mphf_tests_LDADD = ../src/libcmph.la
|
mphf_tests_LDADD = ../src/libcmph.la
|
||||||
|
|
||||||
mphf_fingerprint_tests_SOURCES = mphf_fingerprint_tests.c
|
|
||||||
mphf_fingerprint_tests_LDADD = ../src/libcmph.la
|
|
||||||
|
@ -1,162 +0,0 @@
|
|||||||
#ifdef WIN32
|
|
||||||
#include "../wingetopt.h"
|
|
||||||
#else
|
|
||||||
#include <getopt.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <cmph.h>
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define VERSION "0.8"
|
|
||||||
#else
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void usage(const char *prg)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: %s [-v] [-h] [-V] [-k nkeys] [-m file.mph] keysfile\n", prg);
|
|
||||||
}
|
|
||||||
void usage_long(const char *prg)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: %s [-v] [-h] [-V] [-k nkeys] [-m file.mph] keysfile\n", prg);
|
|
||||||
fprintf(stderr, "Packed MPHFs testing tool\n\n");
|
|
||||||
fprintf(stderr, " -h\t print this help message\n");
|
|
||||||
fprintf(stderr, " -V\t print version number and exit\n");
|
|
||||||
fprintf(stderr, " -v\t increase verbosity (may be used multiple times)\n");
|
|
||||||
fprintf(stderr, " -k\t number of keys\n");
|
|
||||||
fprintf(stderr, " -m\t minimum perfect hash function file \n");
|
|
||||||
fprintf(stderr, " keysfile\t line separated file with keys\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
char verbosity = 0;
|
|
||||||
char *mphf_file = NULL;
|
|
||||||
const char *keys_file = NULL;
|
|
||||||
FILE *mphf_fd = stdout;
|
|
||||||
FILE *keys_fd;
|
|
||||||
cmph_uint32 nkeys = UINT_MAX;
|
|
||||||
cmph_uint32 i = 0;
|
|
||||||
cmph_t *mphf = NULL;
|
|
||||||
cmph_io_adapter_t *source;
|
|
||||||
cmph_uint32 fingerprint[3];
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
char ch = getopt(argc, argv, "hVvk:m:");
|
|
||||||
if (ch == -1) break;
|
|
||||||
switch (ch)
|
|
||||||
{
|
|
||||||
case 'k':
|
|
||||||
{
|
|
||||||
char *endptr;
|
|
||||||
nkeys = strtoul(optarg, &endptr, 10);
|
|
||||||
if(*endptr != 0) {
|
|
||||||
fprintf(stderr, "Invalid number of keys %s\n", optarg);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'm':
|
|
||||||
mphf_file = strdup(optarg);
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
++verbosity;
|
|
||||||
break;
|
|
||||||
case 'V':
|
|
||||||
printf("%s\n", VERSION);
|
|
||||||
return 0;
|
|
||||||
case 'h':
|
|
||||||
usage_long(argv[0]);
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
usage(argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optind != argc - 1)
|
|
||||||
{
|
|
||||||
usage(argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
keys_file = argv[optind];
|
|
||||||
|
|
||||||
int ret = 0;
|
|
||||||
if (mphf_file == NULL)
|
|
||||||
{
|
|
||||||
mphf_file = (char *)malloc(strlen(keys_file) + 5);
|
|
||||||
memcpy(mphf_file, keys_file, strlen(keys_file));
|
|
||||||
memcpy(mphf_file + strlen(keys_file), ".mph\0", (size_t)5);
|
|
||||||
}
|
|
||||||
|
|
||||||
keys_fd = fopen(keys_file, "r");
|
|
||||||
|
|
||||||
if (keys_fd == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Unable to open file %s: %s\n", keys_file, strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nkeys == UINT_MAX) source = cmph_io_nlfile_adapter(keys_fd);
|
|
||||||
else source = cmph_io_nlnkfile_adapter(keys_fd, nkeys);
|
|
||||||
|
|
||||||
cmph_uint8 * hashtable = NULL;
|
|
||||||
mphf_fd = fopen(mphf_file, "r");
|
|
||||||
if (mphf_fd == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Unable to open input file %s: %s\n", mphf_file, strerror(errno));
|
|
||||||
free(mphf_file);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
mphf = cmph_load(mphf_fd);
|
|
||||||
fclose(mphf_fd);
|
|
||||||
if (!mphf)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Unable to parser input file %s\n", mphf_file);
|
|
||||||
free(mphf_file);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
cmph_uint32 siz = cmph_size(mphf);
|
|
||||||
hashtable = (cmph_uint8*)malloc(siz*sizeof(cmph_uint8));
|
|
||||||
memset(hashtable, 0, (size_t)siz);
|
|
||||||
//check all keys
|
|
||||||
for (i = 0; i < source->nkeys; ++i)
|
|
||||||
{
|
|
||||||
cmph_uint32 h;
|
|
||||||
char *buf;
|
|
||||||
cmph_uint32 buflen = 0;
|
|
||||||
source->read(source->data, &buf, &buflen);
|
|
||||||
h = cmph_search_fingerprint(mphf, buf, buflen, fingerprint);
|
|
||||||
if (!(h < siz))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Unknown key %*s in the input.\n", buflen, buf);
|
|
||||||
ret = 1;
|
|
||||||
} else if(hashtable[h])
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Duplicated or unknown key %*s in the input\n", buflen, buf);
|
|
||||||
ret = 1;
|
|
||||||
} else hashtable[h] = 1;
|
|
||||||
|
|
||||||
if (verbosity)
|
|
||||||
{
|
|
||||||
printf("%s -> %u -- fingerprint: %u %u %u\n", buf, h, fingerprint[0], fingerprint[1], fingerprint[2]);
|
|
||||||
}
|
|
||||||
source->dispose(source->data, buf, buflen);
|
|
||||||
}
|
|
||||||
|
|
||||||
cmph_destroy(mphf);
|
|
||||||
free(hashtable);
|
|
||||||
|
|
||||||
fclose(keys_fd);
|
|
||||||
free(mphf_file);
|
|
||||||
cmph_io_nlfile_adapter_destroy(source);
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
|
179
wingetopt.c
179
wingetopt.c
@ -1,179 +0,0 @@
|
|||||||
#ifdef WIN32
|
|
||||||
/*****************************************************************************
|
|
||||||
*
|
|
||||||
* MODULE NAME : GETOPT.C
|
|
||||||
*
|
|
||||||
* COPYRIGHTS:
|
|
||||||
* This module contains code made available by IBM
|
|
||||||
* Corporation on an AS IS basis. Any one receiving the
|
|
||||||
* module is considered to be licensed under IBM copyrights
|
|
||||||
* to use the IBM-provided source code in any way he or she
|
|
||||||
* deems fit, including copying it, compiling it, modifying
|
|
||||||
* it, and redistributing it, with or without
|
|
||||||
* modifications. No license under any IBM patents or
|
|
||||||
* patent applications is to be implied from this copyright
|
|
||||||
* license.
|
|
||||||
*
|
|
||||||
* A user of the module should understand that IBM cannot
|
|
||||||
* provide technical support for the module and will not be
|
|
||||||
* responsible for any consequences of use of the program.
|
|
||||||
*
|
|
||||||
* Any notices, including this one, are not to be removed
|
|
||||||
* from the module without the prior written consent of
|
|
||||||
* IBM.
|
|
||||||
*
|
|
||||||
* AUTHOR: Original author:
|
|
||||||
* G. R. Blair (BOBBLAIR at AUSVM1)
|
|
||||||
* Internet: bobblair@bobblair.austin.ibm.com
|
|
||||||
*
|
|
||||||
* Extensively revised by:
|
|
||||||
* John Q. Walker II, Ph.D. (JOHHQ at RALVM6)
|
|
||||||
* Internet: johnq@ralvm6.vnet.ibm.com
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* getopt()
|
|
||||||
*
|
|
||||||
* The getopt() function is a command line parser. It returns the next
|
|
||||||
* option character in argv that matches an option character in opstring.
|
|
||||||
*
|
|
||||||
* The argv argument points to an array of argc+1 elements containing argc
|
|
||||||
* pointers to character strings followed by a null pointer.
|
|
||||||
*
|
|
||||||
* The opstring argument points to a string of option characters; if an
|
|
||||||
* option character is followed by a colon, the option is expected to have
|
|
||||||
* an argument that may or may not be separated from it by white space.
|
|
||||||
* The external variable optarg is set to point to the start of the option
|
|
||||||
* argument on return from getopt().
|
|
||||||
*
|
|
||||||
* The getopt() function places in optind the argv index of the next argument
|
|
||||||
* to be processed. The system initializes the external variable optind to
|
|
||||||
* 1 before the first call to getopt().
|
|
||||||
*
|
|
||||||
* When all options have been processed (that is, up to the first nonoption
|
|
||||||
* argument), getopt() returns EOF. The special option "--" may be used to
|
|
||||||
* delimit the end of the options; EOF will be returned, and "--" will be
|
|
||||||
* skipped.
|
|
||||||
*
|
|
||||||
* The getopt() function returns a question mark (?) when it encounters an
|
|
||||||
* option character not included in opstring. This error message can be
|
|
||||||
* disabled by setting opterr to zero. Otherwise, it returns the option
|
|
||||||
* character that was detected.
|
|
||||||
*
|
|
||||||
* If the special option "--" is detected, or all options have been
|
|
||||||
* processed, EOF is returned.
|
|
||||||
*
|
|
||||||
* Options are marked by either a minus sign (-) or a slash (/).
|
|
||||||
*
|
|
||||||
* No errors are defined.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include <stdio.h> /* for EOF */
|
|
||||||
#include <string.h> /* for strchr() */
|
|
||||||
|
|
||||||
/* static (global) variables that are specified as exported by getopt() */
|
|
||||||
extern char *optarg; /* pointer to the start of the option argument */
|
|
||||||
extern int optind; /* number of the next argv[] to be evaluated */
|
|
||||||
extern int opterr; /* non-zero if a question mark should be returned
|
|
||||||
when a non-valid option character is detected */
|
|
||||||
|
|
||||||
/* handle possible future character set concerns by putting this in a macro */
|
|
||||||
#define _next_char(string) (char)(*(string+1))
|
|
||||||
|
|
||||||
int getopt(int argc, char *argv[], char *opstring)
|
|
||||||
{
|
|
||||||
static char *pIndexPosition = NULL; /* place inside current argv string */
|
|
||||||
char *pArgString = NULL; /* where to start from next */
|
|
||||||
char *pOptString; /* the string in our program */
|
|
||||||
|
|
||||||
|
|
||||||
if (pIndexPosition != NULL) {
|
|
||||||
/* we last left off inside an argv string */
|
|
||||||
if (*(++pIndexPosition)) {
|
|
||||||
/* there is more to come in the most recent argv */
|
|
||||||
pArgString = pIndexPosition;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pArgString == NULL) {
|
|
||||||
/* we didn't leave off in the middle of an argv string */
|
|
||||||
if (optind >= argc) {
|
|
||||||
/* more command-line arguments than the argument count */
|
|
||||||
pIndexPosition = NULL; /* not in the middle of anything */
|
|
||||||
return EOF; /* used up all command-line arguments */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------
|
|
||||||
* If the next argv[] is not an option, there can be no more options.
|
|
||||||
*-------------------------------------------------------------------*/
|
|
||||||
pArgString = argv[optind++]; /* set this to the next argument ptr */
|
|
||||||
|
|
||||||
if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */
|
|
||||||
('-' != *pArgString)) {
|
|
||||||
--optind; /* point to current arg once we're done */
|
|
||||||
optarg = NULL; /* no argument follows the option */
|
|
||||||
pIndexPosition = NULL; /* not in the middle of anything */
|
|
||||||
return EOF; /* used up all the command-line flags */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check for special end-of-flags markers */
|
|
||||||
if ((strcmp(pArgString, "-") == 0) ||
|
|
||||||
(strcmp(pArgString, "--") == 0)) {
|
|
||||||
optarg = NULL; /* no argument follows the option */
|
|
||||||
pIndexPosition = NULL; /* not in the middle of anything */
|
|
||||||
return EOF; /* encountered the special flag */
|
|
||||||
}
|
|
||||||
|
|
||||||
pArgString++; /* look past the / or - */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (':' == *pArgString) { /* is it a colon? */
|
|
||||||
/*---------------------------------------------------------------------
|
|
||||||
* Rare case: if opterr is non-zero, return a question mark;
|
|
||||||
* otherwise, just return the colon we're on.
|
|
||||||
*-------------------------------------------------------------------*/
|
|
||||||
return (opterr ? (int)'?' : (int)':');
|
|
||||||
}
|
|
||||||
else if ((pOptString = strchr(opstring, *pArgString)) == 0) {
|
|
||||||
/*---------------------------------------------------------------------
|
|
||||||
* The letter on the command-line wasn't any good.
|
|
||||||
*-------------------------------------------------------------------*/
|
|
||||||
optarg = NULL; /* no argument follows the option */
|
|
||||||
pIndexPosition = NULL; /* not in the middle of anything */
|
|
||||||
return (opterr ? (int)'?' : (int)*pArgString);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/*---------------------------------------------------------------------
|
|
||||||
* The letter on the command-line matches one we expect to see
|
|
||||||
*-------------------------------------------------------------------*/
|
|
||||||
if (':' == _next_char(pOptString)) { /* is the next letter a colon? */
|
|
||||||
/* It is a colon. Look for an argument string. */
|
|
||||||
if ('\0' != _next_char(pArgString)) { /* argument in this argv? */
|
|
||||||
optarg = &pArgString[1]; /* Yes, it is */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/*-------------------------------------------------------------
|
|
||||||
* The argument string must be in the next argv.
|
|
||||||
* But, what if there is none (bad input from the user)?
|
|
||||||
* In that case, return the letter, and optarg as NULL.
|
|
||||||
*-----------------------------------------------------------*/
|
|
||||||
if (optind < argc)
|
|
||||||
optarg = argv[optind++];
|
|
||||||
else {
|
|
||||||
optarg = NULL;
|
|
||||||
return (opterr ? (int)'?' : (int)*pArgString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pIndexPosition = NULL; /* not in the middle of anything */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* it's not a colon, so just return the letter */
|
|
||||||
optarg = NULL; /* no argument follows the option */
|
|
||||||
pIndexPosition = pArgString; /* point to the letter we're on */
|
|
||||||
}
|
|
||||||
return (int)*pArgString; /* return the letter that matched */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //WIN32
|
|
25
wingetopt.h
25
wingetopt.h
@ -1,25 +0,0 @@
|
|||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <getopt.h>
|
|
||||||
#else
|
|
||||||
#ifndef _GETOPT_
|
|
||||||
#define _GETOPT_
|
|
||||||
|
|
||||||
#include <stdio.h> /* for EOF */
|
|
||||||
#include <string.h> /* for strchr() */
|
|
||||||
|
|
||||||
char *optarg = NULL; /* pointer to the start of the option argument */
|
|
||||||
int optind = 1; /* number of the next argv[] to be evaluated */
|
|
||||||
int opterr = 1; /* non-zero if a question mark should be returned */
|
|
||||||
|
|
||||||
int getopt(int argc, char *argv[], char *opstring);
|
|
||||||
#endif //_GETOPT_
|
|
||||||
#endif //WIN32
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user