[Debtags-commits] [svn] r1680 - in tagcoll/2.0: . bench tagcoll tests tools

Enrico Zini enrico at costa.debian.org
Mon May 1 13:21:14 UTC 2006


Author: enrico
Date: Mon May  1 13:21:12 2006
New Revision: 1680

Added:
   tagcoll/2.0/tools/TagcollParser.h
   tagcoll/2.0/tools/TagidxParser.h
Removed:
   tagcoll/2.0/tests/dump-tdbdi.cc
   tagcoll/2.0/tools/TagcollOptions.h
   tagcoll/2.0/tools/TagidxOptions.h
Modified:
   tagcoll/2.0/   (props changed)
   tagcoll/2.0/Makefile.am
   tagcoll/2.0/bench/Benchmark.cc
   tagcoll/2.0/bench/bench-main.cc
   tagcoll/2.0/bench/collection.cc
   tagcoll/2.0/tagcoll/MMapIndex.cc
   tagcoll/2.0/tests/Makefile.am
   tagcoll/2.0/tests/mkgraph.cc
   tagcoll/2.0/tests/normalize.cc
   tagcoll/2.0/tools/Makefile.am
   tagcoll/2.0/tools/manpage.cc
Log:
 r2532 at viaza:  enrico | 2006-05-01 15:19:32 +0200
 More refactoring
 removed dump-tdbi now that tdb isn't used anymore


Modified: tagcoll/2.0/Makefile.am
==============================================================================
--- tagcoll/2.0/Makefile.am	(original)
+++ tagcoll/2.0/Makefile.am	Mon May  1 13:21:12 2006
@@ -8,14 +8,11 @@
 m4dir = $(datadir)/aclocal
 m4_DATA = libtagcoll.m4
 
-man_MANS = tagcoll.1 taggrep.1 tagidx.1
+man_MANS = tagcoll.1 tagidx.1
 
 tagcoll.1: tools/manpage doc/tagcoll-man-hooks
 	tools/manpage tagcoll doc/tagcoll-man-hooks > $@ || rm $@
 
-taggrep.1: tools/manpage doc/taggrep-man-hooks
-	tools/manpage taggrep doc/taggrep-man-hooks > $@ || rm $@
-
 tagidx.1: tools/manpage doc/tagidx-man-hooks
 	tools/manpage tagidx doc/tagidx-man-hooks > $@ || rm $@
 

Modified: tagcoll/2.0/bench/Benchmark.cc
==============================================================================
--- tagcoll/2.0/bench/Benchmark.cc	(original)
+++ tagcoll/2.0/bench/Benchmark.cc	Mon May  1 13:21:12 2006
@@ -1,12 +1,11 @@
 #include "Benchmark.h"
-#include <tagcoll/Exception.h>
+#include <wibble/exception.h>
 
 #include <stdarg.h>
 #include <time.h>
 #include <iostream>
 
 using namespace std;
-using namespace Tagcoll;
 
 Timer::~Timer()
 {
@@ -54,7 +53,7 @@
 			if ((*i)->name() == child)
 				return (*i)->run(nextpath);
 	}
-	throw NotFoundException("looking for child " + path + " at " + fullName());
+	throw wibble::exception::Consistency("looking for benchmark " + path + " at " + fullName(), "benchmark not found");
 }
 
 // Run all subtests and this test

Modified: tagcoll/2.0/bench/bench-main.cc
==============================================================================
--- tagcoll/2.0/bench/bench-main.cc	(original)
+++ tagcoll/2.0/bench/bench-main.cc	Mon May  1 13:21:12 2006
@@ -1,10 +1,8 @@
 #include "Benchmark.h"
-#include <tagcoll/Exception.h>
 
 #include <iostream>
 
 using namespace std;
-using namespace Tagcoll;
 
 int main(int argc, const char* argv[])
 {
@@ -24,12 +22,10 @@
 		}
 
 		return 0;
-	} catch (Exception& e) {
-		cerr << e.type() << ": " << e.desc() << endl;
-	} catch (exception& e) {
+	} catch (std::exception& e) {
 		cerr << e.what() << endl;
+		return 1;
 	}
-	return 1;
 }
 
 /* vim:set ts=4 sw=4: */

Modified: tagcoll/2.0/bench/collection.cc
==============================================================================
--- tagcoll/2.0/bench/collection.cc	(original)
+++ tagcoll/2.0/bench/collection.cc	Mon May  1 13:21:12 2006
@@ -4,7 +4,6 @@
 #include <tagcoll/TextFormat.h>
 #include <tagcoll/BasicStringDiskIndex.h>
 #include <tagcoll/TDBIndexer.h>
-#include <tagcoll/TDBReadonlyDiskIndex.h>
 #include <tagcoll/CardinalityStore.h>
 
 #include <vector>
@@ -240,7 +239,7 @@
 	}
 };
 
-
+#if 0
 class benchTDBReadonlyDiskIndex : public CollectionBench
 {
 protected:
@@ -282,6 +281,7 @@
 		unlink("bench-TDBReadonlyDiskIndex2.tmp");
 	}
 };
+#endif
 
 class benchTDBIndexer : public CollectionBench
 {
@@ -335,7 +335,7 @@
 	{
 		addChild(new benchInputMerger());
 		addChild(new benchBasicStringDiskIndex());
-		addChild(new benchTDBReadonlyDiskIndex());
+		//addChild(new benchTDBReadonlyDiskIndex());
 		addChild(new benchTDBIndexer());
 		addChild(new benchCardinalityStore());
 	}

Modified: tagcoll/2.0/tagcoll/MMapIndex.cc
==============================================================================
--- tagcoll/2.0/tagcoll/MMapIndex.cc	(original)
+++ tagcoll/2.0/tagcoll/MMapIndex.cc	Mon May  1 13:21:12 2006
@@ -266,4 +266,6 @@
 }
 
 #endif
+
+#include <wibble/exception.tcc>
 // vim:set ts=4 sw=4:

Modified: tagcoll/2.0/tests/Makefile.am
==============================================================================
--- tagcoll/2.0/tests/Makefile.am	(original)
+++ tagcoll/2.0/tests/Makefile.am	Mon May  1 13:21:12 2006
@@ -3,22 +3,18 @@
 libtagcoll_test_SOURCES = tut-main.cpp
 # Disabled: it failed, but it also looks meaningless as it is
 # test-textformat.cc
-libtagcoll_test_LDADD = -dlpreopen ../tagcoll/libtagcoll.la ../tagcoll/tagexpr/libtagexpr.la -ltdb
+libtagcoll_test_LDADD = -dlpreopen ../tagcoll/libtagcoll.la ../tagcoll/tagexpr/libtagexpr.la
 
-noinst_PROGRAMS = dump-tdbdi normalize mkgraph
+noinst_PROGRAMS = normalize mkgraph
 # test-tagset
 
-dump_tdbdi_SOURCES = \
-	dump-tdbdi.cc
-dump_tdbdi_LDADD = ../tagcoll/libtagcoll.la -ltdb
-
 normalize_SOURCES = \
 	normalize.cc
-normalize_LDADD = ../tagcoll/libtagcoll.la -ltdb
+normalize_LDADD = ../tagcoll/libtagcoll.la
 
 mkgraph_SOURCES = \
 	mkgraph.cc
-mkgraph_LDADD = ../tagcoll/libtagcoll.la -ltdb
+mkgraph_LDADD = ../tagcoll/libtagcoll.la
 
 #test_tagset_SOURCES = \
 	#test-tagset.cc

Modified: tagcoll/2.0/tests/mkgraph.cc
==============================================================================
--- tagcoll/2.0/tests/mkgraph.cc	(original)
+++ tagcoll/2.0/tests/mkgraph.cc	Mon May  1 13:21:12 2006
@@ -5,8 +5,6 @@
 
 #include <iostream>
 
-#include <stdarg.h>
-
 using namespace std;
 using namespace Tagcoll;
 
@@ -14,7 +12,7 @@
 {
 	try {
 		// Install the handler for unexpected exceptions
-		InstallUnexpected installUnexpected;
+		wibble::exception::InstallUnexpected installUnexpected;
 		TrivialConverter<string, string> conv;
 		Graph<string, string> graph;
 		StdioParserInput in(stdin, "(stdin)");
@@ -27,8 +25,9 @@
 		//graph.output(writer);
 
 		return 0;
-	} catch (Exception& e) {
-		fprintf(stderr, "%s: %.*s\n", e.type(), PFSTR(e.desc()));
+	} catch (std::exception& e) {
+		cerr << e.what() << endl;
+		return 1;
 	}
 }
 

Modified: tagcoll/2.0/tests/normalize.cc
==============================================================================
--- tagcoll/2.0/tests/normalize.cc	(original)
+++ tagcoll/2.0/tests/normalize.cc	Mon May  1 13:21:12 2006
@@ -3,7 +3,7 @@
 #include <tagcoll/TextFormat.h>
 #include <tagcoll/StdioParserInput.h>
 
-#include <stdarg.h>
+#include <iostream>
 
 using namespace std;
 using namespace Tagcoll;
@@ -12,7 +12,7 @@
 {
 	try {
 		// Install the handler for unexpected exceptions
-		InstallUnexpected installUnexpected;
+		wibble::exception::InstallUnexpected installUnexpected;
 		TrivialConverter<string, string> conv;
 		Normalizer<string, string> norm(1.0);
 		StdioParserInput in(stdin, "(stdin)");
@@ -31,8 +31,9 @@
 		norm.output(writer);
 
 		return 0;
-	} catch (Exception& e) {
-		fprintf(stderr, "%s: %.*s\n", e.type(), PFSTR(e.desc()));
+	} catch (std::exception& e) {
+		cerr << e.what() << endl;
+		return 1;
 	}
 }
 

Modified: tagcoll/2.0/tools/Makefile.am
==============================================================================
--- tagcoll/2.0/tools/Makefile.am	(original)
+++ tagcoll/2.0/tools/Makefile.am	Mon May  1 13:21:12 2006
@@ -14,4 +14,4 @@
 
 INCLUDES = -I$(top_srcdir)
 
-EXTRA_DIST = CommandlineParser.h TagcollOptions.h TaggrepOptions.h TagidxOptions.h
+EXTRA_DIST = CommandlineParser.h TagcollParser.h TagidxParser.h

Modified: tagcoll/2.0/tools/manpage.cc
==============================================================================
--- tagcoll/2.0/tools/manpage.cc	(original)
+++ tagcoll/2.0/tools/manpage.cc	Mon May  1 13:21:12 2006
@@ -19,58 +19,49 @@
  */
 
 #include <config.h>
-#include "TagcollOptions.h"
-#include "TaggrepOptions.h"
-#include "TagidxOptions.h"
+#include <wibble/commandline/doc.h>
+#include "TagcollParser.h"
+#include "TagidxParser.h"
 #include <iostream>
 
 using namespace std;
-using namespace Tagcoll;
 
 int main(int argc, const char* argv[])
 {
 	try {
 		if (argc == 1)
-			throw commandline::BadOption("no arguments provided");
+			throw wibble::exception::BadOption("no arguments provided");
 
 		string cmd(argv[1]);
 		string hooks(argc > 2 ? argv[2] : "");
 
 		if (cmd == "tagcoll")
 		{
-			commandline::TagcollOptions opts;
-			commandline::Manpage help("tagcoll", VERSION);
+			wibble::commandline::TagcollParser opts;
+			wibble::commandline::Manpage help("tagcoll", VERSION, 1, "enrico at enricozini.org");
 			if (!hooks.empty())
 				help.readHooks(hooks);
-			help.output(cout, opts, 1);
-		}
-		else if (cmd == "taggrep")
-		{
-			commandline::TaggrepOptions opts;
-			commandline::Manpage help("taggrep", VERSION);
-			if (!hooks.empty())
-				help.readHooks(hooks);
-			help.output(cout, opts, 1);
+			help.output(cout, opts);
 		}
 		else if (cmd == "tagidx")
 		{
-			commandline::TagidxOptions opts;
-			commandline::Manpage help("tagidx", VERSION);
+			wibble::commandline::TagidxParser opts;
+			wibble::commandline::Manpage help("tagidx", VERSION, 1, "enrico at enricozini.org");
 			if (!hooks.empty())
 				help.readHooks(hooks);
-			help.output(cout, opts, 1);
+			help.output(cout, opts);
 		}
 		else
-			throw commandline::BadOption("unknown command " + cmd);
+			throw wibble::exception::BadOption("unknown command " + cmd);
 
 		return 0;
-	} catch (commandline::BadOption& e) {
+	} catch (wibble::exception::BadOption& e) {
 		cerr << e.desc() << endl << endl;
 		cerr << "Usage: manpage <command>" << endl << endl;
-		cerr << "Supported commands are: tagcoll" << endl;
+		cerr << "Supported commands are tagcoll and taggrep" << endl;
 		return 1;
-	} catch (Exception& e) {
-		fprintf(stderr, "%s: %.*s\n", e.type(), PFSTR(e.desc()));
+	} catch (std::exception& e) {
+		cerr << e.what() << endl;
 		return 1;
 	}
 }



More information about the Debtags-commits mailing list