Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rewritten the core of the memory model to greatly improve performance…

… and capacity

 - the score pools are now a binary search tree
 - the linked lists of items are now double-linked and head and tail are kept track of to speed in adding and removal
 - the score pools hold the head and tail of a list
 - this has yeilded a queue that is from 10x - 5000x+ faster...the largest gain coming from very large populated queue
  • Loading branch information...
commit 1549776a32f7bc38e5190d4fd336569e581f506f 1 parent fa05d33
Dwayn Matthies authored committed
232 Makefile.in
View
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# 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, 2009 Free Software Foundation,
+# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,8 +16,9 @@
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -46,6 +48,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -57,6 +60,9 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
@@ -64,9 +70,34 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
- { test ! -d $(distdir) \
- || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -fr $(distdir); }; }
+ { test ! -d "$(distdir)" \
+ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr "$(distdir)"; }; }
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
@@ -114,6 +145,7 @@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
@@ -122,8 +154,12 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -166,7 +202,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -179,6 +214,7 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src . tests
@@ -193,15 +229,15 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
- cd $(srcdir) && $(AUTOMAKE) --foreign \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -217,9 +253,10 @@ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENC
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
- cd $(srcdir) && $(AUTOCONF)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
@@ -231,7 +268,7 @@ stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
- cd $(top_srcdir) && $(AUTOHEADER)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
@@ -245,7 +282,7 @@ clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
- -rm -f libtool
+ -rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -254,7 +291,7 @@ distclean-libtool:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @failcom='exit 1'; \
+ @fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
@@ -271,7 +308,7 @@ $(RECURSIVE_TARGETS):
else \
local_target="$$target"; \
fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
@@ -279,7 +316,7 @@ $(RECURSIVE_TARGETS):
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
- @failcom='exit 1'; \
+ @fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
@@ -305,16 +342,16 @@ $(RECURSIVE_CLEAN_TARGETS):
else \
local_target="$$target"; \
fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -322,14 +359,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
@@ -341,46 +378,50 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
- tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
- test -d $(distdir) || mkdir $(distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -396,38 +437,55 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
- distdir=`$(am__cd) $(distdir) && pwd`; \
- top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
- (cd $$subdir && \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$top_distdir" \
- distdir="$$distdir/$$subdir" \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
+ am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
- || chmod -R a+r $(distdir)
+ || chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
@@ -436,6 +494,14 @@ dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
@@ -459,13 +525,17 @@ dist dist-all: distdir
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
- GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
- bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
- GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
@@ -473,9 +543,11 @@ distcheck: dist
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
- && cd $(distdir)/_build \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
@@ -497,13 +569,15 @@ distcheck: dist
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
- @cd $(distuninstallcheck_dir) \
+ @$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
@@ -545,6 +619,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -565,6 +640,8 @@ dvi-am:
html: html-recursive
+html-am:
+
info: info-recursive
info-am:
@@ -573,18 +650,28 @@ install-data-am:
install-dvi: install-dvi-recursive
+install-dvi-am:
+
install-exec-am:
install-html: install-html-recursive
+install-html-am:
+
install-info: install-info-recursive
+install-info-am:
+
install-man:
install-pdf: install-pdf-recursive
+install-pdf-am:
+
install-ps: install-ps-recursive
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-recursive
@@ -607,24 +694,25 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
- install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ ctags-recursive install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
- dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
- distclean-generic distclean-hdr distclean-libtool \
- distclean-tags distcleancheck distdir distuninstallcheck dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags tags-recursive uninstall uninstall-am
+ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
+ distcheck distclean distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
18 README
View
@@ -4,6 +4,24 @@ Barbershop is a fast, lightweight priority queue system. The goal is to
create a dead simple network service with libevent to manage priority
queue.
+# Dependencies
+check >= 0.8.2
+libevent >= 1.4.13
+pkgconfig >= 0.25 (possibly lower versions would work)
+
+# Compilitaion Notes
+
+Normally all that should be needed is to compile:
+./bootstrap.sh
+./configure
+make
+
+If there is issues with libtool versions when running make, you can run:
+libtoolize [or glibtoolize]
+./bootstrap.sh
+./configure
+make
+
# Usage
This application exists to allow priority queue workers to scale out. The
1,799 aclocal.m4
View
1,024 additions, 775 deletions not shown
4 bootstrap.sh
View
@@ -1,5 +1,5 @@
#!/bin/sh
-
+libtoolize
aclocal
automake --gnu --add-missing
-autoconf
+autoconf
3  config.h.in
View
@@ -62,6 +62,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
/* Define to the version of this package. */
#undef PACKAGE_VERSION
9,296 configure
View
4,330 additions, 4,966 deletions not shown
3  configure.ac
View
@@ -28,7 +28,8 @@ AC_CHECK_LIB([pthread], [pthread_create])
# CHECK_LIBS accordingly.
# AM_PATH_CHECK([MINIMUM-VERSION,
# [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-AM_PATH_CHECK()
+# AM_PATH_CHECK()
+PKG_CHECK_MODULES([CHECK], [check >= 0.8.2])
LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
AC_CHECK_LIB(event, event_set, , [AC_MSG_ERROR(libevent is required. You can get it from $LIBEVENT_URL)])
12 src/Makefile.am
View
@@ -1,11 +1,11 @@
## Process this file with automake to produce Makefile.in
-bin_PROGRAMS = barbershop client benchmark
-barbershop_SOURCES = barbershop.c barbershop.h bst.c bst.h scores.c scores.h stats.h commands.c commands.h
+bin_PROGRAMS = barbershop barbershop-client barbershop-benchmark
+barbershop_SOURCES = barbershop.c barbershop.h stats.h commands.c commands.h pqueue.c pqueue.h
barbershop_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
-client_SOURCES = client.c
-client_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
+barbershop_client_SOURCES = client.c
+barbershop_client_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
-benchmark_SOURCES = benchmark.c
-benchmark_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
+barbershop_benchmark_SOURCES = benchmark.c
+barbershop_benchmark_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
311 src/Makefile.in
View
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# 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, 2009 Free Software Foundation,
+# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -32,7 +34,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-bin_PROGRAMS = barbershop$(EXEEXT) client$(EXEEXT) benchmark$(EXEEXT)
+bin_PROGRAMS = barbershop$(EXEEXT) barbershop-client$(EXEEXT) \
+ barbershop-benchmark$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -42,32 +45,35 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_barbershop_OBJECTS = barbershop-barbershop.$(OBJEXT) \
- barbershop-bst.$(OBJEXT) barbershop-scores.$(OBJEXT) \
- barbershop-commands.$(OBJEXT)
+ barbershop-commands.$(OBJEXT) barbershop-pqueue.$(OBJEXT)
barbershop_OBJECTS = $(am_barbershop_OBJECTS)
barbershop_LDADD = $(LDADD)
barbershop_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(barbershop_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_benchmark_OBJECTS = benchmark-benchmark.$(OBJEXT)
-benchmark_OBJECTS = $(am_benchmark_OBJECTS)
-benchmark_LDADD = $(LDADD)
-benchmark_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(benchmark_CFLAGS) \
- $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_client_OBJECTS = client-client.$(OBJEXT)
-client_OBJECTS = $(am_client_OBJECTS)
-client_LDADD = $(LDADD)
-client_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(client_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+am_barbershop_benchmark_OBJECTS = \
+ barbershop_benchmark-benchmark.$(OBJEXT)
+barbershop_benchmark_OBJECTS = $(am_barbershop_benchmark_OBJECTS)
+barbershop_benchmark_LDADD = $(LDADD)
+barbershop_benchmark_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(barbershop_benchmark_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+am_barbershop_client_OBJECTS = barbershop_client-client.$(OBJEXT)
+barbershop_client_OBJECTS = $(am_barbershop_client_OBJECTS)
+barbershop_client_LDADD = $(LDADD)
+barbershop_client_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(barbershop_client_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -77,9 +83,10 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(barbershop_SOURCES) $(benchmark_SOURCES) $(client_SOURCES)
-DIST_SOURCES = $(barbershop_SOURCES) $(benchmark_SOURCES) \
- $(client_SOURCES)
+SOURCES = $(barbershop_SOURCES) $(barbershop_benchmark_SOURCES) \
+ $(barbershop_client_SOURCES)
+DIST_SOURCES = $(barbershop_SOURCES) $(barbershop_benchmark_SOURCES) \
+ $(barbershop_client_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -126,6 +133,7 @@ MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
@@ -134,8 +142,12 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -178,7 +190,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -191,14 +202,15 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-barbershop_SOURCES = barbershop.c barbershop.h bst.c bst.h scores.c scores.h stats.h commands.c commands.h
+barbershop_SOURCES = barbershop.c barbershop.h stats.h commands.c commands.h pqueue.c pqueue.h
barbershop_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
-client_SOURCES = client.c
-client_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
-benchmark_SOURCES = benchmark.c
-benchmark_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
+barbershop_client_SOURCES = client.c
+barbershop_client_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
+barbershop_benchmark_SOURCES = benchmark.c
+barbershop_benchmark_CFLAGS = $(OPTIMIZATION) -Wall $(ARCH) $(PROF)
all: all-am
.SUFFIXES:
@@ -207,14 +219,14 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign src/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -232,43 +244,59 @@ $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- if test -f $$p \
- || test -f $$p1 \
- ; then \
- f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
- else :; fi; \
- done
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
- rm -f "$(DESTDIR)$(bindir)/$$f"; \
- done
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
barbershop$(EXEEXT): $(barbershop_OBJECTS) $(barbershop_DEPENDENCIES)
@rm -f barbershop$(EXEEXT)
$(barbershop_LINK) $(barbershop_OBJECTS) $(barbershop_LDADD) $(LIBS)
-benchmark$(EXEEXT): $(benchmark_OBJECTS) $(benchmark_DEPENDENCIES)
- @rm -f benchmark$(EXEEXT)
- $(benchmark_LINK) $(benchmark_OBJECTS) $(benchmark_LDADD) $(LIBS)
-client$(EXEEXT): $(client_OBJECTS) $(client_DEPENDENCIES)
- @rm -f client$(EXEEXT)
- $(client_LINK) $(client_OBJECTS) $(client_LDADD) $(LIBS)
+barbershop-benchmark$(EXEEXT): $(barbershop_benchmark_OBJECTS) $(barbershop_benchmark_DEPENDENCIES)
+ @rm -f barbershop-benchmark$(EXEEXT)
+ $(barbershop_benchmark_LINK) $(barbershop_benchmark_OBJECTS) $(barbershop_benchmark_LDADD) $(LIBS)
+barbershop-client$(EXEEXT): $(barbershop_client_OBJECTS) $(barbershop_client_DEPENDENCIES)
+ @rm -f barbershop-client$(EXEEXT)
+ $(barbershop_client_LINK) $(barbershop_client_OBJECTS) $(barbershop_client_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -277,116 +305,101 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barbershop-barbershop.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barbershop-bst.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barbershop-commands.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barbershop-scores.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark-benchmark.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client-client.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barbershop-pqueue.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barbershop_benchmark-benchmark.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/barbershop_client-client.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
barbershop-barbershop.o: barbershop.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-barbershop.o -MD -MP -MF $(DEPDIR)/barbershop-barbershop.Tpo -c -o barbershop-barbershop.o `test -f 'barbershop.c' || echo '$(srcdir)/'`barbershop.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-barbershop.Tpo $(DEPDIR)/barbershop-barbershop.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop-barbershop.Tpo $(DEPDIR)/barbershop-barbershop.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='barbershop.c' object='barbershop-barbershop.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-barbershop.o `test -f 'barbershop.c' || echo '$(srcdir)/'`barbershop.c
barbershop-barbershop.obj: barbershop.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-barbershop.obj -MD -MP -MF $(DEPDIR)/barbershop-barbershop.Tpo -c -o barbershop-barbershop.obj `if test -f 'barbershop.c'; then $(CYGPATH_W) 'barbershop.c'; else $(CYGPATH_W) '$(srcdir)/barbershop.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-barbershop.Tpo $(DEPDIR)/barbershop-barbershop.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop-barbershop.Tpo $(DEPDIR)/barbershop-barbershop.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='barbershop.c' object='barbershop-barbershop.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-barbershop.obj `if test -f 'barbershop.c'; then $(CYGPATH_W) 'barbershop.c'; else $(CYGPATH_W) '$(srcdir)/barbershop.c'; fi`
-barbershop-bst.o: bst.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-bst.o -MD -MP -MF $(DEPDIR)/barbershop-bst.Tpo -c -o barbershop-bst.o `test -f 'bst.c' || echo '$(srcdir)/'`bst.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-bst.Tpo $(DEPDIR)/barbershop-bst.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bst.c' object='barbershop-bst.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-bst.o `test -f 'bst.c' || echo '$(srcdir)/'`bst.c
-
-barbershop-bst.obj: bst.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-bst.obj -MD -MP -MF $(DEPDIR)/barbershop-bst.Tpo -c -o barbershop-bst.obj `if test -f 'bst.c'; then $(CYGPATH_W) 'bst.c'; else $(CYGPATH_W) '$(srcdir)/bst.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-bst.Tpo $(DEPDIR)/barbershop-bst.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bst.c' object='barbershop-bst.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-bst.obj `if test -f 'bst.c'; then $(CYGPATH_W) 'bst.c'; else $(CYGPATH_W) '$(srcdir)/bst.c'; fi`
-
-barbershop-scores.o: scores.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-scores.o -MD -MP -MF $(DEPDIR)/barbershop-scores.Tpo -c -o barbershop-scores.o `test -f 'scores.c' || echo '$(srcdir)/'`scores.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-scores.Tpo $(DEPDIR)/barbershop-scores.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scores.c' object='barbershop-scores.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-scores.o `test -f 'scores.c' || echo '$(srcdir)/'`scores.c
-
-barbershop-scores.obj: scores.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-scores.obj -MD -MP -MF $(DEPDIR)/barbershop-scores.Tpo -c -o barbershop-scores.obj `if test -f 'scores.c'; then $(CYGPATH_W) 'scores.c'; else $(CYGPATH_W) '$(srcdir)/scores.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-scores.Tpo $(DEPDIR)/barbershop-scores.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scores.c' object='barbershop-scores.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-scores.obj `if test -f 'scores.c'; then $(CYGPATH_W) 'scores.c'; else $(CYGPATH_W) '$(srcdir)/scores.c'; fi`
-
barbershop-commands.o: commands.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-commands.o -MD -MP -MF $(DEPDIR)/barbershop-commands.Tpo -c -o barbershop-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-commands.Tpo $(DEPDIR)/barbershop-commands.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop-commands.Tpo $(DEPDIR)/barbershop-commands.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='commands.c' object='barbershop-commands.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c
barbershop-commands.obj: commands.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-commands.obj -MD -MP -MF $(DEPDIR)/barbershop-commands.Tpo -c -o barbershop-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/barbershop-commands.Tpo $(DEPDIR)/barbershop-commands.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop-commands.Tpo $(DEPDIR)/barbershop-commands.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='commands.c' object='barbershop-commands.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi`
-benchmark-benchmark.o: benchmark.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(benchmark_CFLAGS) $(CFLAGS) -MT benchmark-benchmark.o -MD -MP -MF $(DEPDIR)/benchmark-benchmark.Tpo -c -o benchmark-benchmark.o `test -f 'benchmark.c' || echo '$(srcdir)/'`benchmark.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/benchmark-benchmark.Tpo $(DEPDIR)/benchmark-benchmark.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='benchmark.c' object='benchmark-benchmark.o' libtool=no @AMDEPBACKSLASH@
+barbershop-pqueue.o: pqueue.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-pqueue.o -MD -MP -MF $(DEPDIR)/barbershop-pqueue.Tpo -c -o barbershop-pqueue.o `test -f 'pqueue.c' || echo '$(srcdir)/'`pqueue.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop-pqueue.Tpo $(DEPDIR)/barbershop-pqueue.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pqueue.c' object='barbershop-pqueue.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(benchmark_CFLAGS) $(CFLAGS) -c -o benchmark-benchmark.o `test -f 'benchmark.c' || echo '$(srcdir)/'`benchmark.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-pqueue.o `test -f 'pqueue.c' || echo '$(srcdir)/'`pqueue.c
-benchmark-benchmark.obj: benchmark.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(benchmark_CFLAGS) $(CFLAGS) -MT benchmark-benchmark.obj -MD -MP -MF $(DEPDIR)/benchmark-benchmark.Tpo -c -o benchmark-benchmark.obj `if test -f 'benchmark.c'; then $(CYGPATH_W) 'benchmark.c'; else $(CYGPATH_W) '$(srcdir)/benchmark.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/benchmark-benchmark.Tpo $(DEPDIR)/benchmark-benchmark.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='benchmark.c' object='benchmark-benchmark.obj' libtool=no @AMDEPBACKSLASH@
+barbershop-pqueue.obj: pqueue.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -MT barbershop-pqueue.obj -MD -MP -MF $(DEPDIR)/barbershop-pqueue.Tpo -c -o barbershop-pqueue.obj `if test -f 'pqueue.c'; then $(CYGPATH_W) 'pqueue.c'; else $(CYGPATH_W) '$(srcdir)/pqueue.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop-pqueue.Tpo $(DEPDIR)/barbershop-pqueue.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pqueue.c' object='barbershop-pqueue.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(benchmark_CFLAGS) $(CFLAGS) -c -o benchmark-benchmark.obj `if test -f 'benchmark.c'; then $(CYGPATH_W) 'benchmark.c'; else $(CYGPATH_W) '$(srcdir)/benchmark.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_CFLAGS) $(CFLAGS) -c -o barbershop-pqueue.obj `if test -f 'pqueue.c'; then $(CYGPATH_W) 'pqueue.c'; else $(CYGPATH_W) '$(srcdir)/pqueue.c'; fi`
-client-client.o: client.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(client_CFLAGS) $(CFLAGS) -MT client-client.o -MD -MP -MF $(DEPDIR)/client-client.Tpo -c -o client-client.o `test -f 'client.c' || echo '$(srcdir)/'`client.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/client-client.Tpo $(DEPDIR)/client-client.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client.c' object='client-client.o' libtool=no @AMDEPBACKSLASH@
+barbershop_benchmark-benchmark.o: benchmark.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_benchmark_CFLAGS) $(CFLAGS) -MT barbershop_benchmark-benchmark.o -MD -MP -MF $(DEPDIR)/barbershop_benchmark-benchmark.Tpo -c -o barbershop_benchmark-benchmark.o `test -f 'benchmark.c' || echo '$(srcdir)/'`benchmark.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop_benchmark-benchmark.Tpo $(DEPDIR)/barbershop_benchmark-benchmark.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='benchmark.c' object='barbershop_benchmark-benchmark.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(client_CFLAGS) $(CFLAGS) -c -o client-client.o `test -f 'client.c' || echo '$(srcdir)/'`client.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_benchmark_CFLAGS) $(CFLAGS) -c -o barbershop_benchmark-benchmark.o `test -f 'benchmark.c' || echo '$(srcdir)/'`benchmark.c
-client-client.obj: client.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(client_CFLAGS) $(CFLAGS) -MT client-client.obj -MD -MP -MF $(DEPDIR)/client-client.Tpo -c -o client-client.obj `if test -f 'client.c'; then $(CYGPATH_W) 'client.c'; else $(CYGPATH_W) '$(srcdir)/client.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/client-client.Tpo $(DEPDIR)/client-client.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client.c' object='client-client.obj' libtool=no @AMDEPBACKSLASH@
+barbershop_benchmark-benchmark.obj: benchmark.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_benchmark_CFLAGS) $(CFLAGS) -MT barbershop_benchmark-benchmark.obj -MD -MP -MF $(DEPDIR)/barbershop_benchmark-benchmark.Tpo -c -o barbershop_benchmark-benchmark.obj `if test -f 'benchmark.c'; then $(CYGPATH_W) 'benchmark.c'; else $(CYGPATH_W) '$(srcdir)/benchmark.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop_benchmark-benchmark.Tpo $(DEPDIR)/barbershop_benchmark-benchmark.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='benchmark.c' object='barbershop_benchmark-benchmark.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(client_CFLAGS) $(CFLAGS) -c -o client-client.obj `if test -f 'client.c'; then $(CYGPATH_W) 'client.c'; else $(CYGPATH_W) '$(srcdir)/client.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_benchmark_CFLAGS) $(CFLAGS) -c -o barbershop_benchmark-benchmark.obj `if test -f 'benchmark.c'; then $(CYGPATH_W) 'benchmark.c'; else $(CYGPATH_W) '$(srcdir)/benchmark.c'; fi`
+
+barbershop_client-client.o: client.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_client_CFLAGS) $(CFLAGS) -MT barbershop_client-client.o -MD -MP -MF $(DEPDIR)/barbershop_client-client.Tpo -c -o barbershop_client-client.o `test -f 'client.c' || echo '$(srcdir)/'`client.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop_client-client.Tpo $(DEPDIR)/barbershop_client-client.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client.c' object='barbershop_client-client.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_client_CFLAGS) $(CFLAGS) -c -o barbershop_client-client.o `test -f 'client.c' || echo '$(srcdir)/'`client.c
+
+barbershop_client-client.obj: client.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_client_CFLAGS) $(CFLAGS) -MT barbershop_client-client.obj -MD -MP -MF $(DEPDIR)/barbershop_client-client.Tpo -c -o barbershop_client-client.obj `if test -f 'client.c'; then $(CYGPATH_W) 'client.c'; else $(CYGPATH_W) '$(srcdir)/client.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/barbershop_client-client.Tpo $(DEPDIR)/barbershop_client-client.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client.c' object='barbershop_client-client.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(barbershop_client_CFLAGS) $(CFLAGS) -c -o barbershop_client-client.obj `if test -f 'client.c'; then $(CYGPATH_W) 'client.c'; else $(CYGPATH_W) '$(srcdir)/client.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
@@ -399,45 +412,49 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -458,13 +475,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -495,6 +516,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -515,6 +537,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -523,18 +547,28 @@ install-data-am:
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am: install-binPROGRAMS
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -573,6 +607,7 @@ uninstall-am: uninstall-binPROGRAMS
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
66 src/barbershop.c
View
@@ -39,14 +39,14 @@ THE SOFTWARE.
#include <time.h>
#include <unistd.h>
-#include "scores.h"
-#include "bst.h"
+#include "pqueue.h"
#include "barbershop.h"
#include "stats.h"
#include <event.h>
#include "commands.h"
-void on_read(int fd, short ev, void *arg) {
+void on_read(int fd, short ev, void *arg)
+{
struct client *client = (struct client *)arg;
char buf[64];
int len = read(fd, buf, sizeof(buf));
@@ -65,7 +65,8 @@ void on_read(int fd, short ev, void *arg) {
process_request(fd, buf);
}
-void on_accept(int fd, short ev, void *arg) {
+void on_accept(int fd, short ev, void *arg)
+{
int client_fd;
struct sockaddr_in client_addr;
socklen_t client_len = sizeof(client_addr);
@@ -86,7 +87,8 @@ void on_accept(int fd, short ev, void *arg) {
event_add(&client->ev_read, NULL);
}
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
int port = SERVER_PORT;
timeout = 60;
static int daemon_mode = 0;
@@ -133,9 +135,8 @@ int main(int argc, char **argv) {
sync_file = "barbershop.snapshot";
}
- items = MakeEmpty(NULL);
- scores = NULL;
-
+ initializePriorityQueue();
+
load_snapshot(sync_file);
time(&app_stats.started_at);
@@ -169,7 +170,8 @@ int main(int argc, char **argv) {
return 0;
}
-int setnonblock(int fd) {
+int setnonblock(int fd)
+{
int flags;
flags = fcntl(fd, F_GETFL);
if (flags < 0) {
@@ -182,36 +184,43 @@ int setnonblock(int fd) {
return 0;
}
-void gc_thread() {
+void gc_thread()
+{
while (1) {
sleep(timeout);
pthread_mutex_lock(&scores_mutex);
- sync_to_disk(scores, sync_file);
+ sync_to_disk(sync_file);
pthread_mutex_unlock(&scores_mutex);
}
pthread_exit(0);
}
-void load_snapshot(char *filename) {
+void load_snapshot(char *filename)
+{
FILE *file_in;
file_in = fopen(filename, "r");
- if (file_in == NULL) {
+ if (file_in == NULL)
+ {
return;
}
char line[80];
int item_id, score;
- pthread_mutex_lock(&scores_mutex);
- while(fgets(line, 80, file_in) != NULL) {
+ while(fgets(line, 80, file_in) != NULL)
+ {
sscanf(line, "%d %d", &item_id, &score);
- items = Insert(item_id, score, items);
- scores = promoteItem(scores, score, item_id, -1);
- app_stats.items += 1;
+ pthread_mutex_lock(&scores_mutex);
+ int success = update(item_id, score);
+ if(success >= 0)
+ app_stats.updates += 1;
+ if(success == 1);
+ app_stats.items += 1;
+ pthread_mutex_unlock(&scores_mutex);
}
- pthread_mutex_unlock(&scores_mutex);
fclose(file_in);
}
-void sync_to_disk(PoolNode *head, char *filename) {
+void sync_to_disk(char *filename)
+{
FILE *out_file;
time_t now;
time(&now);
@@ -223,21 +232,14 @@ void sync_to_disk(PoolNode *head, char *filename) {
fprintf(stderr, "Can not open output file\n");
exit (8);
}
- MemberNode *member;
- while (head) {
- member = head->members;
- while (member) {
- fprintf(out_file, "%d %d\n", member->item, head->score);
- member = member->next;
- }
- head = head->next;
- }
+ outputScores(out_file);
fclose(out_file);
rename(tmp_file, filename);
return;
}
-void daemonize() {
+void daemonize()
+{
int i,lfp;
char str[10];
/* already a daemon */
@@ -270,6 +272,7 @@ void daemonize() {
sprintf(str, "%d\n", getpid());
write(lfp, str, strlen(str));
signal(SIGCHLD, SIG_IGN);
+ signal(SIGPIPE, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
@@ -279,7 +282,8 @@ void daemonize() {
// TODO: on SIGHUP import data from snapshot.
// TODO: on SIGTERM exit.
-void signal_handler(int sig) {
+void signal_handler(int sig)
+{
switch(sig) {
case SIGHUP:
break;
5 src/barbershop.h
View
@@ -34,9 +34,6 @@ struct client {
struct event ev_read;
};
-SearchTree items;
-PoolNode *scores;
-
pthread_mutex_t scores_mutex;
int timeout;
char *sync_file;
@@ -48,7 +45,7 @@ void on_accept(int fd, short ev, void *arg);
int setnonblock(int fd);
void gc_thread();
void load_snapshot(char *filename);
-void sync_to_disk(PoolNode *head, char *filename);
+void sync_to_disk(char *filename);
void daemonize();
void signal_handler(int sig);
129 src/bst.c
View
@@ -1,129 +0,0 @@
-/*
-Copyright (c) 2010 Nick Gerakines <nick at gerakines dot net>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "bst.h"
-#include "stats.h"
-
-SearchTree MakeEmpty(SearchTree tree) {
- if (tree != NULL) {
- MakeEmpty(tree->left);
- MakeEmpty(tree->right);
- free(tree);
- }
- return NULL;
-}
-
-Position Find(int key, SearchTree tree) {
- if (tree == NULL) {
- return NULL;
- }
- if (key < tree->item) {
- return Find(key, tree->left);
- } else if (key > tree->item) {
- return Find(key, tree->right);
- }
- return tree;
-}
-
-Position FindMin(SearchTree tree) {
- if (tree == NULL) {
- return NULL;
- } else if (tree->left == NULL) {
- return tree;
- }
- return FindMin(tree->left);
-}
-
-Position FindMax(SearchTree tree) {
- if (tree != NULL) {
- while (tree->right != NULL) {
- tree = tree->right;
- }
- }
- return tree;
-}
-
-void DumpItems(SearchTree tree) {
- if (tree == NULL) { return; }
- DumpItems(tree->left);
- printf("%d (%d) - %d - %d\n", tree->item, tree->score,
- tree->left ? tree->left->item : -1,
- tree->right ? tree->right->item : -1);
- DumpItems(tree->right);
-}
-
-SearchTree Insert(int key, int score, SearchTree tree ) {
- if ( tree == NULL) {
- tree = malloc( sizeof( struct TreeNode ) );
- if (tree == NULL ) {
- // FatalError( "Out of space!!!" );
- } else {
- tree->item = key;
- tree->score = score;
- tree->left = tree->right = NULL;
- }
- } else {
- if ( key < tree->item ) {
- tree->left = Insert(key, score, tree->left );
- } else if( key > tree->item ) {
- tree->right = Insert(key, score, tree->right );
- }
- }
- return tree;
-}
-
-SearchTree Delete(int key, SearchTree tree) {
- Position TmpCell;
- if (tree == NULL) {
- // Error( "Element not found" );
- } else {
- if (key < tree->item) { /* Go left */
- tree->left = Delete(key, tree->left );
- } else if ( key > tree->item) { /* Go right */
- tree->right = Delete(key, tree->right );
- } else if (tree->left && tree->right) { /* Two children */
- /* Replace with smallest in right subtree */
- TmpCell = FindMin(tree->right);
- tree->item = TmpCell->item;
- tree->right = Delete(tree->item, tree->right );
- } else { /* One or zero children */
- TmpCell = tree;
- if (tree->left == NULL) { /* Also handles 0 children */
- tree = tree->right;
- } else if (tree->right == NULL) {
- tree = tree->left;
- }
- free( TmpCell );
- }
- }
- return tree;
-}
-
-int RetrieveItem(Position P) {
- return P->item;
-}
-
-int RetrieveScore(Position P) {
- return P->item;
-}
47 src/bst.h
View
@@ -1,47 +0,0 @@
-/*
-Copyright (c) 2010 Nick Gerakines <nick at gerakines dot net>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef _Tree_H
-#define _Tree_H
-
-struct TreeNode;
-typedef struct TreeNode *Position;
-typedef struct TreeNode *SearchTree;
-
-struct TreeNode {
- int item;
- int score;
- SearchTree left;
- SearchTree right;
-};
-
-SearchTree MakeEmpty(SearchTree tree);
-Position Find(int key, SearchTree tree);
-Position FindMin(SearchTree tree);
-Position FindMax(SearchTree tree);
-SearchTree Insert(int key, int score, SearchTree tree);
-SearchTree Delete(int key, SearchTree tree);
-int RetrieveItem(Position P);
-int RetrieveScore(Position P);
-void DumpItems(SearchTree tree);
-
-#endif
62 src/commands.c
View
@@ -1,4 +1,6 @@
/*
+ Modified by Dwayn Matthies <dwayn(dot)matthies(at)gmail(dot)com>
+ to use pqueue.h to handle the priority queue
Copyright (c) 2010 Nick Gerakines <nick at gerakines dot net>
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -40,8 +42,7 @@ THE SOFTWARE.
#include <unistd.h>
#include "commands.h"
-#include "scores.h"
-#include "bst.h"
+#include "pqueue.h"
#include "stats.h"
#include "barbershop.h"
@@ -56,51 +57,32 @@ void command_update(int fd, token_t *tokens) {
reply(fd, "-ERROR INVALID SCORE\r\n");
return;
}
- Position lookup = Find(item_id, items);
- if (lookup == NULL) {
- items = Insert(item_id, score, items);
- pthread_mutex_lock(&scores_mutex);
- scores = promoteItem(scores, score, item_id, -1);
- pthread_mutex_unlock(&scores_mutex);
- app_stats.items += 1;
- } else {
- int old_score = lookup->score;
- if (old_score == -1) {
- lookup->score = 1;
- } else {
- lookup->score += score;
- }
- assert(lookup->score > old_score);
- pthread_mutex_lock(&scores_mutex);
- scores = promoteItem(scores, lookup->score, item_id, old_score);
- pthread_mutex_unlock(&scores_mutex);
- }
- app_stats.updates += 1;
- reply(fd, "+OK\r\n");
+
+ pthread_mutex_lock(&scores_mutex);
+ int success = update(item_id, score);
+ pthread_mutex_unlock(&scores_mutex);
+
+ if(success >= 0)
+ reply(fd, "+OK\r\n");
+ else
+ reply(fd, "-ERROR UPDATE FAILED\r\n");
}
void command_next(int fd, token_t *tokens) {
int next;
pthread_mutex_lock(&scores_mutex);
- scores = NextItem(scores, &next);
+ next = getNext();
pthread_mutex_unlock(&scores_mutex);
- if (next != -1) {
- Position lookup = Find( next, items );
- if (lookup != NULL) {
- lookup->score = -1;
- }
- app_stats.items -= 1;
- }
+
char msg[32];
sprintf(msg, "+%d\r\n", next);
reply(fd, msg);
-
}
void command_peek(int fd, token_t *tokens) {
int next;
pthread_mutex_lock(&scores_mutex);
- PeekNext(scores, &next);
+ next = peekNext();
pthread_mutex_unlock(&scores_mutex);
char msg[32];
sprintf(msg, "+%d\r\n", next);
@@ -113,25 +95,23 @@ void command_score(int fd, token_t *tokens) {
reply(fd, "-ERROR INVALID ITEM ID\r\n");
return;
}
- Position lookup = Find(item_id, items);
- if (lookup == NULL) {
- reply(fd, "+-1\r\n");
- } else {
- char msg[32];
- sprintf(msg, "+%d\r\n", lookup->score);
- reply(fd, msg);
- }
+ int score = getScore(item_id);
+ char msg[32];
+ sprintf(msg, "+%d\r\n", score);
+ reply(fd, msg);
}
void command_info(int fd, token_t *tokens) {
char out[128];
time_t current_time;
time(&current_time);
+ pthread_mutex_lock(&scores_mutex);
sprintf(out, "uptime:%d\r\n", (int)(current_time - app_stats.started_at)); reply(fd, out);
sprintf(out, "version:%s\r\n", app_stats.version); reply(fd, out);
sprintf(out, "updates:%u\r\n", app_stats.updates); reply(fd, out);
sprintf(out, "items:%u\r\n", app_stats.items); reply(fd, out);
sprintf(out, "pools:%u\r\n", app_stats.pools); reply(fd, out);
+ pthread_mutex_unlock(&scores_mutex);
}
// TODO: Clean the '\r\n' scrub code.
2  src/commands.h
View
@@ -1,4 +1,6 @@
/*
+ Modified by Dwayn Matthies <dwayn(dot)matthies(at)gmail(dot)com>
+ to use pqueue.h to handle the priority queue
Copyright (c) 2010 Nick Gerakines <nick at gerakines dot net>
Permission is hereby granted, free of charge, to any person obtaining a copy
294 src/scores.c
View
@@ -1,294 +0,0 @@
-/*
-Copyright (c) 2010 Nick Gerakines <nick at gerakines dot net>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#include "scores.h"
-#include "stats.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-PoolNode *pool_create(int score) {
- PoolNode *node;
- if (! (node = malloc(sizeof(PoolNode)))) {
- return NULL;
- }
- node->score = score;
- node->count = 0;
- node->members = NULL;
- node->next = NULL;
- return node;
-}
-
-int pool_remove(PoolNode *list, PoolNode *node) {
- while (list->next && list->next != node) {
- list = list->next;
- }
- if (list->next) {
- list->next = node->next;
- free(node);
- return 0;
- } else {
- return -1;
- }
-}
-
-int pool_foreach(PoolNode *node, int(*func)(int, int, MemberNode*)) {
- while (node) {
- if (func(node->score, node->count, node->members) != 0) {
- return -1;
- }
- node = node->next;
- }
- return 0;
-}
-
-PoolNode *pool_find(PoolNode *node, int(*func)(int, MemberNode*, int), int data) {
- while (node) {
- if (func(node->score, node->members, data) > 0) {
- return node;
- }
- node = node->next;
- }
- return NULL;
-}
-
-MemberNode *member_create(int item) {
- MemberNode *node;
- if (! (node = malloc(sizeof(MemberNode)))) {
- return NULL;
- }
- node->item = item;
- node->next = NULL;
- return node;
-}
-
-MemberNode *member_push(MemberNode *list, int item) {
- MemberNode *newnode;
- newnode = member_create(item);
- newnode->next = list;
- return newnode;
-}
-
-int member_remove(MemberNode *list, MemberNode *node) {
- while (list->next && list->next != node) {
- list = list->next;
- }
- if (list->next) {
- list->next = node->next;
- free(node);
- return 0;
- } else {
- return -1;
- }
-}
-
-int member_foreach(MemberNode *node, int(*func)(int)) {
- while (node) {
- if (func(node->item) != 0) {
- return -1;
- }
- node = node->next;
- }
- return 0;
-}
-
-MemberNode *member_find(MemberNode *node, int(*func)(int, int), int data) {
- while (node) {
- if (func(node->item, data) > 0) {
- return node;
- }
- node = node->next;
- }
- return NULL;
-}
-
-MemberNode *member_last(MemberNode *node) {
- while (node) {
- if (node->next == NULL) {
- return node;
- }
- node = node->next;
- }
- return NULL;
-}
-
-int find_by_score(int score, MemberNode *members, int query) {
- return score == query;
-}
-
-int find_item(int item, int query) {
- return item == query;
-}
-
-#ifdef DEBUG
-int pool_print(int score, int count, MemberNode *members) {
- printf("Pool %d (count %d)\n", score, count);
- member_foreach(members, member_print);
- return 0;
-}
-
-int member_print(int item) {
- printf(" -> item %d\n", item);
- return 0;
-}
-#endif
-
-PoolNode *preparePromotion(PoolNode *head, int item, int score) {
- MemberNode *memberMatch;
- if (head->score == score) {
- if (head->members->item == item) {
- memberMatch = head->members;
- head->members = memberMatch->next;
- head->count -= 1;
- } else {
- if ((memberMatch = member_find(head->members, find_item, item))) {
- head->count -= 1;
- assert(member_remove(head->members, memberMatch) == 0);
- }
- }
- if (head->count == 0) {
- app_stats.pools -= 1;
- return head->next;
- }
- } else {
- PoolNode *listMatch;
- if ((listMatch = pool_find(head, find_by_score, score))) {
- if (listMatch->count == 1) {
- assert(pool_remove(head, listMatch) == 0);
- } else {
- if (listMatch->members->item == item) {
- memberMatch = listMatch->members;
- listMatch->members = memberMatch->next;
- listMatch->count -= 1;
- } else {
- if ((memberMatch = member_find(listMatch->members, find_item, item))) {
- listMatch->count -= 1;
- assert(member_remove(listMatch->members, memberMatch) == 0);
- } else {
- assert(1);
- }
- }
- }
- } else {
- assert(1);
- }
- }
- return head;
-}
-
-PoolNode *promoteItem(PoolNode *list, int score, int item, int old_score) {
- if (old_score != -1) {
- list = preparePromotion(list, item, old_score);
- }
- if (list == NULL) {
- PoolNode *newPool = pool_create(score);
- MemberNode *newMember;
- newMember = member_create(item);
- newPool->members = newMember;
- newPool->count++;
- return newPool;
- }
- PoolNode *listMatch;
- if ((listMatch = pool_find(list, find_by_score, score))) {
- MemberNode *memberMatch;
- if (! (memberMatch = member_find(listMatch->members, find_item, item))) {
- listMatch->members = member_push(listMatch->members, item);
- listMatch->count++;
- }
- return list;
- } else {
- // Score pool doesn't exist
- PoolNode *newPool;
- newPool = pool_create(score);
- app_stats.pools += 1;
- MemberNode *newMember;
- newMember = member_create(item);
- newPool->members = newMember;
- newPool->count++;
- if (list->score < score) {
- // The new pool is larger than the head, set as new head
- newPool->next = list;
- return newPool;
- } else if (list->next == NULL && list->score > score) {
- // There is only one member in the head and the head is larger
- // than score, set head->next to newPool and return head.
- list->next = newPool;
- return list;
- } else {
- // There are more than two items in the list, find where to
- // create the new pool
- PoolNode *head = list;
- while (head) {
- if (score < head->score) {
- if (head->next == NULL) {
- head->next = newPool;
- newPool->next = NULL;
- break;
- }
- if (head->next != NULL && score < head->score && score > head->next->score) {
- PoolNode *tmp;
- tmp = head->next;
- newPool->next = tmp;
- head->next = newPool;
- break;
- }
- }
- head = head->next;
- }
- return list;
- }
- }
- return NULL;
-}
-
-void PeekNext(PoolNode *head, int *next_item) {
- if (head == NULL) {
- *next_item = -1;
- return;
- }
- if (head->count == 1) {
- *next_item = head->members->item;
- return;
- } else {
- MemberNode *last = member_last(head->members);
- *next_item = last->item;
- return;
- }
-}
-
-PoolNode *NextItem(PoolNode *head, int *next_item) {
- if (head == NULL) {
- *next_item = -1;
- return NULL;
- }
- if (head->count == 1) {
- *next_item = head->members->item;
- app_stats.pools -= 1;
- return head->next;
- } else {
- MemberNode *last = member_last(head->members);
- *next_item = last->item;
- assert(member_remove(head->members, last) == 0);
- head->count -= 1;
- return head;
- }
-}
63 src/scores.h
View
@@ -1,63 +0,0 @@
-/*
-Copyright (c) 2010 Nick Gerakines <nick at gerakines dot net>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef __SCORES_H__
-#define __SCORES_H__
-
-typedef struct node_member {
- int item;
- struct node_member *next;
-} MemberNode;
-
-typedef struct node_pool {
- int score;
- struct node_member *members;
- int count;
- struct node_pool *next;
-} PoolNode;
-
-PoolNode *pool_create(int score);
-int pool_remove(PoolNode *list, PoolNode *node);
-int pool_foreach(PoolNode *node, int(*func)(int, int, MemberNode*));
-PoolNode *pool_find(PoolNode *node, int(*func)(int, MemberNode*, int), int data);
-
-MemberNode *member_create(int item);
-MemberNode *member_push(MemberNode *list, int item);
-int member_remove(MemberNode *list, MemberNode *node);
-int member_foreach(MemberNode *node, int(*func)(int));
-MemberNode *member_find(MemberNode *node, int(*func)(int, int), int data);
-MemberNode *member_last(MemberNode *node);
-
-int find_by_score(int score, MemberNode *members, int query);
-int find_item(int item, int query);
-
-PoolNode *preparePromotion(PoolNode *head, int item, int score);
-PoolNode *promoteItem(PoolNode *list, int score, int item, int old_score);
-void PeekNext(PoolNode *head, int *next_item);
-PoolNode *NextItem(PoolNode *list, int *next_item);
-
-#ifdef DEBUG
-int pool_print(int score, int count, MemberNode *members);
-int member_print(int item);
-#endif
-
-#endif
Please sign in to comment.
Something went wrong with that request. Please try again.