# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1208883121 -3600
# Node ID 95d905b6e33d825e1d1e325b3913990da5dd1117
# Parent  356930927a719bc19c1d04cece555f3e926920ee# Parent  4e626dbbe408151cffbebc90dafd85b823a05980
Merge

diff -r 356930927a71 -r 95d905b6e33d .hgignore
--- a/.hgignore	Tue Apr 22 15:07:04 2008 +0200
+++ b/.hgignore	Tue Apr 22 17:52:01 2008 +0100
@@ -34,3 +34,8 @@
 ^objs.*/.*
 ^test/[a-z_]*$
 ^demo/.*_demo$
+^build/.*
+CMakeFiles
+DartTestfile.txt
+cmake_install.cmake
+CMakeCache.txt
diff -r 356930927a71 -r 95d905b6e33d CMakeLists.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CMakeLists.txt	Tue Apr 22 17:52:01 2008 +0100
@@ -0,0 +1,5 @@
+project (LEMON)
+enable_testing ()
+add_subdirectory (lemon)
+add_subdirectory (demo)
+add_subdirectory (test)
diff -r 356930927a71 -r 95d905b6e33d benchmark/Makefile
--- a/benchmark/Makefile	Tue Apr 22 15:07:04 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-all:
-	$(MAKE) -C ..
diff -r 356930927a71 -r 95d905b6e33d demo/CMakeLists.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/CMakeLists.txt	Tue Apr 22 17:52:01 2008 +0100
@@ -0,0 +1,13 @@
+include_directories (${LEMON_SOURCE_DIR})
+
+link_directories (${LEMON_BINARY_DIR}/lemon)
+
+set (DEMOS
+  arg_parser_demo
+  graph_to_eps_demo
+  lgf_demo)
+
+foreach (DEMO_NAME ${DEMOS})
+  add_executable (${DEMO_NAME} ${DEMO_NAME}.cc)
+  target_link_libraries (${DEMO_NAME} lemon)
+  endforeach (DEMO_NAME)
diff -r 356930927a71 -r 95d905b6e33d demo/Makefile
--- a/demo/Makefile	Tue Apr 22 15:07:04 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-all:
-	$(MAKE) -C ..
diff -r 356930927a71 -r 95d905b6e33d demo/lgf_demo.cc
--- a/demo/lgf_demo.cc	Tue Apr 22 15:07:04 2008 +0200
+++ b/demo/lgf_demo.cc	Tue Apr 22 17:52:01 2008 +0100
@@ -37,7 +37,7 @@
 
 int main(int argc, const char *argv[]) {
   const int n = argc > 1 ? std::atoi(argv[1]) : 20;
-  const int e = argc > 2 ? std::atoi(argv[2]) : static_cast<int>(n * log(n));
+  const int e = argc > 2 ? std::atoi(argv[2]) : static_cast<int>(n * std::log(double(n)));
   const int m = argc > 3 ? std::atoi(argv[3]) : 100;
 
   SmartDigraph digraph;
diff -r 356930927a71 -r 95d905b6e33d doc/Makefile
--- a/doc/Makefile	Tue Apr 22 15:07:04 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-all:
-	$(MAKE) -C ..
diff -r 356930927a71 -r 95d905b6e33d lemon/CMakeLists.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lemon/CMakeLists.txt	Tue Apr 22 17:52:01 2008 +0100
@@ -0,0 +1,2 @@
+include_directories (${LEMON_SOURCE_DIR})
+add_library (lemon arg_parser.cc base.cc color.cc random.cc)
diff -r 356930927a71 -r 95d905b6e33d lemon/Makefile
--- a/lemon/Makefile	Tue Apr 22 15:07:04 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-all:
-	$(MAKE) -C ..
diff -r 356930927a71 -r 95d905b6e33d lemon/assert.h
--- a/lemon/assert.h	Tue Apr 22 15:07:04 2008 +0200
+++ b/lemon/assert.h	Tue Apr 22 17:52:01 2008 +0100
@@ -103,7 +103,13 @@
 #endif
 
 #ifndef LEMON_FUNCTION_NAME
-#  define LEMON_FUNCTION_NAME (__PRETTY_FUNCTION__)
+#  if defined __GNUC__
+#    define LEMON_FUNCTION_NAME (__PRETTY_FUNCTION__)
+#  elif defined _MSC_VER
+#    define LEMON_FUNCTION_NAME (__FUNCSIG__)
+#  else
+#    define LEMON_FUNCTION_NAME (__func__)
+#  endif
 #endif
 
 #ifdef DOXYGEN
diff -r 356930927a71 -r 95d905b6e33d lemon/graph_to_eps.h
--- a/lemon/graph_to_eps.h	Tue Apr 22 15:07:04 2008 +0200
+++ b/lemon/graph_to_eps.h	Tue Apr 22 17:52:01 2008 +0100
@@ -29,6 +29,8 @@
 #include<sys/time.h>
 #include<ctime>
 #else
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
 #include<windows.h>
 #endif
 
diff -r 356930927a71 -r 95d905b6e33d lemon/path.h
--- a/lemon/path.h	Tue Apr 22 15:07:04 2008 +0200
+++ b/lemon/path.h	Tue Apr 22 17:52:01 2008 +0100
@@ -903,20 +903,34 @@
   namespace _path_bits {
 
     template <typename Path, typename Enable = void>
-    struct RevTagIndicator {
+    struct RevPathTagIndicator {
       static const bool value = false;
     };
 
-    template <typename Digraph>
-    struct RevTagIndicator<
-      Digraph, 
-      typename enable_if<typename Digraph::RevTag, void>::type
+    template <typename Path>
+    struct RevPathTagIndicator<
+      Path, 
+      typename enable_if<typename Path::RevPathTag, void>::type
+      > {
+      static const bool value = true;
+    };
+
+    template <typename Path, typename Enable = void>
+    struct BuildTagIndicator {
+      static const bool value = false;
+    };
+
+    template <typename Path>
+    struct BuildTagIndicator<
+      Path, 
+      typename enable_if<typename Path::BuildTag, void>::type
     > {
       static const bool value = true;
     };
 
     template <typename Target, typename Source,
-              typename BuildEnable = void, typename RevEnable = void>
+	      bool buildEnable = BuildTagIndicator<Target>::value, 
+	      bool revEnable = RevPathTagIndicator<Source>::value>
     struct PathCopySelector {
       static void copy(Target& target, const Source& source) {
         target.clear();
@@ -926,10 +940,8 @@
       }
     };
 
-    template <typename Target, typename Source, typename BuildEnable>
-    struct PathCopySelector<
-      Target, Source, BuildEnable, 
-      typename enable_if<typename Source::RevPathTag, void>::type> {
+    template <typename Target, typename Source>
+    struct PathCopySelector<Target, Source, false, true> {
       static void copy(Target& target, const Source& source) {
         target.clear();
         for (typename Source::RevArcIt it(source); it != INVALID; ++it) {
@@ -938,10 +950,8 @@
       }
     };
 
-    template <typename Target, typename Source, typename RevEnable>
-    struct PathCopySelector<
-      Target, Source, 
-      typename enable_if<typename Target::BuildTag, void>::type, RevEnable> {
+    template <typename Target, typename Source>
+    struct PathCopySelector<Target, Source, true, false> {
       static void copy(Target& target, const Source& source) {
         target.clear();
         target.build(source);
@@ -949,10 +959,7 @@
     };
 
     template <typename Target, typename Source>
-    struct PathCopySelector<
-      Target, Source, 
-      typename enable_if<typename Target::BuildTag, void>::type,
-      typename enable_if<typename Source::RevPathTag, void>::type> {
+    struct PathCopySelector<Target, Source, true, true> {
       static void copy(Target& target, const Source& source) {
         target.clear();
         target.buildRev(source);
diff -r 356930927a71 -r 95d905b6e33d lemon/time_measure.h
--- a/lemon/time_measure.h	Tue Apr 22 15:07:04 2008 +0200
+++ b/lemon/time_measure.h	Tue Apr 22 17:52:01 2008 +0100
@@ -24,6 +24,8 @@
 ///\brief Tools for measuring cpu usage
 
 #ifdef WIN32
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
 #include <windows.h>
 #include <cmath>
 #else
@@ -31,6 +33,7 @@
 #include <sys/time.h>
 #endif
 
+#include <string>
 #include <fstream>
 #include <iostream>
 
diff -r 356930927a71 -r 95d905b6e33d test/CMakeLists.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/CMakeLists.txt	Tue Apr 22 17:52:01 2008 +0100
@@ -0,0 +1,24 @@
+include_directories (${LEMON_SOURCE_DIR})
+
+link_directories (${LEMON_BINARY_DIR}/lemon)
+
+set (TESTS
+  bfs_test
+  counter_test
+  dfs_test
+  digraph_test
+  dim_test
+  error_test
+  graph_test
+  kruskal_test
+  maps_test
+  random_test
+  path_test
+  time_measure_test
+  unionfind_test)
+
+foreach (TEST_NAME ${TESTS})
+  add_executable (${TEST_NAME} ${TEST_NAME}.cc)
+  target_link_libraries (${TEST_NAME} lemon)
+  add_test(${TEST_NAME} ${TEST_NAME})
+endforeach (TEST_NAME)
diff -r 356930927a71 -r 95d905b6e33d test/Makefile
--- a/test/Makefile	Tue Apr 22 15:07:04 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-all:
-	$(MAKE) -C ..
diff -r 356930927a71 -r 95d905b6e33d tools/Makefile
--- a/tools/Makefile	Tue Apr 22 15:07:04 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-all:
-	$(MAKE) -C ..