From: Martin Mares Date: Wed, 31 Jan 2007 18:23:50 +0000 (+0100) Subject: First bits of the sorter infrastructure. X-Git-Tag: holmes-import~506^2~13^2~181 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=116954d49373438c669eadd764e03ee8ac4211bb;p=libucw.git First bits of the sorter infrastructure. Configuration is shared with the old sorter. --- diff --git a/lib/Makefile b/lib/Makefile index d6988b33..0d2b9acf 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,6 +1,7 @@ -# Makefile for the UCW Library (c) 1997--2006 Martin Mares +# Makefile for the UCW Library (c) 1997--2007 Martin Mares DIRS+=lib +LIBUCW=$(o)/lib/libucw.$(LS) ifdef CONFIG_UCW_DBTOOL PROGS+=$(o)/lib/db-tool @@ -66,7 +67,8 @@ ifdef CONFIG_OWN_REGEX include $(s)/lib/regex/Makefile endif -LIBUCW=$(o)/lib/libucw.$(LS) +include $(s)/lib/sorter/Makefile + LIBUCW_MOD_PATHS=$(addprefix $(o)/lib/,$(LIBUCW_MODS)) $(o)/lib/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS)) diff --git a/lib/sorter-globals.h b/lib/sorter-globals.h index a2dae0f4..de649b34 100644 --- a/lib/sorter-globals.h +++ b/lib/sorter-globals.h @@ -11,9 +11,8 @@ #ifndef _UCW_SORTER_GLOBALS_H #define _UCW_SORTER_GLOBALS_H -extern uns sorter_trace; -extern uns sorter_presort_bufsize; -extern uns sorter_stream_bufsize; +/* The old sorter shares configuration with the new one */ +#include "lib/sorter/common.h" extern uns sorter_pass_counter; diff --git a/lib/sorter.c b/lib/sorter.c index 55d242a5..20db9ef1 100644 --- a/lib/sorter.c +++ b/lib/sorter.c @@ -8,29 +8,6 @@ */ #include "lib/lib.h" -#include "lib/conf.h" -#include "lib/fastbuf.h" #include "lib/sorter-globals.h" -#include -#include - -uns sorter_trace; -uns sorter_presort_bufsize = 65536; -uns sorter_stream_bufsize = 65536; - -static struct cf_section sorter_config = { - CF_ITEMS { - CF_UNS("Trace", &sorter_trace), - CF_UNS("PresortBuffer", &sorter_presort_bufsize), - CF_UNS("StreamBuffer", &sorter_stream_bufsize), - CF_END - } -}; - -static void CONSTRUCTOR sorter_init_config(void) -{ - cf_declare_section("Sorter", &sorter_config, 0); -} - uns sorter_pass_counter; diff --git a/lib/sorter/Makefile b/lib/sorter/Makefile new file mode 100644 index 00000000..b1388898 --- /dev/null +++ b/lib/sorter/Makefile @@ -0,0 +1,5 @@ +# Makefile for the UCW Sorter (c) 2007 Martin Mares + +DIRS+=lib/sorter + +LIBUCW_MODS+=sorter/config diff --git a/lib/sorter/common.h b/lib/sorter/common.h new file mode 100644 index 00000000..76d3e8c8 --- /dev/null +++ b/lib/sorter/common.h @@ -0,0 +1,16 @@ +/* + * UCW Library -- Universal Sorter + * + * (c) 2007 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. + */ + +#ifndef _UCW_SORTER_COMMON_H +#define _UCW_SORTER_COMMON_H + +/* Configuration, some of the variables are used by the old sorter, too. */ +extern uns sorter_trace, sorter_presort_bufsize, sorter_stream_bufsize; + +#endif diff --git a/lib/sorter/config.c b/lib/sorter/config.c new file mode 100644 index 00000000..15872076 --- /dev/null +++ b/lib/sorter/config.c @@ -0,0 +1,31 @@ +/* + * UCW Library -- Universal Sorter -- Configuration + * + * (c) 2007 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. + */ + +#include "lib/lib.h" +#include "lib/conf.h" +#include "lib/fastbuf.h" +#include "lib/sorter/common.h" + +uns sorter_trace; +uns sorter_presort_bufsize = 65536; +uns sorter_stream_bufsize = 65536; + +static struct cf_section sorter_config = { + CF_ITEMS { + CF_UNS("Trace", &sorter_trace), + CF_UNS("PresortBuffer", &sorter_presort_bufsize), + CF_UNS("StreamBuffer", &sorter_stream_bufsize), + CF_END + } +}; + +static void CONSTRUCTOR sorter_init_config(void) +{ + cf_declare_section("Sorter", &sorter_config, 0); +}