]> mj.ucw.cz Git - libucw.git/commitdiff
First bits of the sorter infrastructure.
authorMartin Mares <mj@ucw.cz>
Wed, 31 Jan 2007 18:23:50 +0000 (19:23 +0100)
committerMartin Mares <mj@ucw.cz>
Wed, 31 Jan 2007 18:23:50 +0000 (19:23 +0100)
Configuration is shared with the old sorter.

lib/Makefile
lib/sorter-globals.h
lib/sorter.c
lib/sorter/Makefile [new file with mode: 0644]
lib/sorter/common.h [new file with mode: 0644]
lib/sorter/config.c [new file with mode: 0644]

index d6988b33b0b336af4ee9a63c9f616ece319c959f..0d2b9acf507197dd07a6a3cda507e0a4c0e9dc2a 100644 (file)
@@ -1,6 +1,7 @@
-# Makefile for the UCW Library (c) 1997--2006 Martin Mares <mj@ucw.cz>
+# Makefile for the UCW Library (c) 1997--2007 Martin Mares <mj@ucw.cz>
 
 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))
index a2dae0f4f67cb1a51244dc6ee403a14dc86ffc85..de649b34afd13c5d237b9953256e680ea8d1c92d 100644 (file)
@@ -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;
 
index 55d242a5d012e0ab87af5fa3a92743599ca0eaac..20db9ef1974e3b86ea9866b1f303bcad63534df6 100644 (file)
@@ -8,29 +8,6 @@
  */
 
 #include "lib/lib.h"
-#include "lib/conf.h"
-#include "lib/fastbuf.h"
 #include "lib/sorter-globals.h"
 
-#include <unistd.h>
-#include <sys/fcntl.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);
-}
-
 uns sorter_pass_counter;
diff --git a/lib/sorter/Makefile b/lib/sorter/Makefile
new file mode 100644 (file)
index 0000000..b138889
--- /dev/null
@@ -0,0 +1,5 @@
+# Makefile for the UCW Sorter (c) 2007 Martin Mares <mj@ucw.cz>
+
+DIRS+=lib/sorter
+
+LIBUCW_MODS+=sorter/config
diff --git a/lib/sorter/common.h b/lib/sorter/common.h
new file mode 100644 (file)
index 0000000..76d3e8c
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ *     UCW Library -- Universal Sorter
+ *
+ *     (c) 2007 Martin Mares <mj@ucw.cz>
+ *
+ *     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 (file)
index 0000000..1587207
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ *     UCW Library -- Universal Sorter -- Configuration
+ *
+ *     (c) 2007 Martin Mares <mj@ucw.cz>
+ *
+ *     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);
+}