Am Freitag, 21. Juli 2006 19:00 schrieb Bo Peng: > Really? Last time I compiled 1.4.2 with cygwin/boost1.33.1, I got lots > of compile errors like include file not found.
Yes, you are right, my memories where wrong. I tried it now, and the attached patch makes 1.4 compile with both boost 1.33 and 1.34svn. Georg
Index: src/frontends/qt2/QtView.C =================================================================== --- src/frontends/qt2/QtView.C (Revision 14491) +++ src/frontends/qt2/QtView.C (Arbeitskopie) @@ -20,6 +20,10 @@ #include "support/filetools.h" +#include <boost/version.hpp> +#if BOOST_VERSION >= 103300 && BOOST_VERSION < 103400 +#include <boost/visit_each.hpp> +#endif #include <boost/bind.hpp> #include "QtView.h" Index: src/frontends/controllers/biblio.C =================================================================== --- src/frontends/controllers/biblio.C (Revision 14491) +++ src/frontends/controllers/biblio.C (Arbeitskopie) @@ -376,13 +376,13 @@ string const escape_special_chars(string // Note that '[' and '\' must be escaped. // This is a limitation of boost::regex, but all other chars in BREs // are assumed literal. - boost::RegEx reg("[].|*?+(){}^$\\[\\\\]"); + boost::regex reg("[].|*?+(){}^$\\[\\\\]"); // $& is a perl-like expression that expands to all of the current match // The '$' must be prefixed with the escape character '\' for // boost to treat it as a literal. // Thus, to prefix a matched expression with '\', we use: - return reg.Merge(expr, "\\\\$&"); + return boost::regex_replace(expr, reg, "\\\\$&"); } @@ -409,14 +409,14 @@ public: // Attempts to find a match for the current RE // somewhere in data. - return regex_.Search(data); + return boost::regex_search(data, regex_); } bool validRE() const { return regex_.error_code() == 0; } private: InfoMap const map_; - mutable boost::RegEx regex_; + mutable boost::regex regex_; }; } // namespace anon Index: src/support/path.h =================================================================== --- src/support/path.h (Revision 14491) +++ src/support/path.h (Arbeitskopie) @@ -54,9 +54,10 @@ private: // Path p("/tmp"); // right // we add this macro: /// -#ifndef PATH_C -#define Path(x) unnamed_Path; -#endif +// With boost 1.34 this is not usable anymore +//#ifndef PATH_C +//#define Path(x) unnamed_Path; +//#endif // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal } // namespace support Index: src/support/translator.h =================================================================== --- src/support/translator.h (Revision 14491) +++ src/support/translator.h (Arbeitskopie) @@ -13,6 +13,10 @@ #define TRANSLATOR_H #include <boost/assert.hpp> +#include <boost/version.hpp> +#if BOOST_VERSION >= 103300 && BOOST_VERSION < 103400 +#include <boost/visit_each.hpp> +#endif #include <boost/bind.hpp> #include <vector> Index: src/support/filetools.C =================================================================== --- src/support/filetools.C (Revision 14491) +++ src/support/filetools.C (Arbeitskopie) @@ -599,42 +599,16 @@ string const ExpandPath(string const & p // Also converts paths like /foo//bar ==> /foo/bar string const NormalizePath(string const & path) { - string TempBase; - string RTemp; - string Temp; + // Normalize paths like /foo//bar ==> /foo/bar + static boost::regex regex("/{2,}"); + string const tmppath = boost::regex_merge(path, regex, "/"); - if (os::is_absolute_path(path)) - RTemp = path; - else - // Make implicit current directory explicit - RTemp = "./" + path; + fs::path const npath = fs::path(tmppath, fs::no_check).normalize(); - // Normalise paths like /foo//bar ==> /foo/bar - boost::RegEx regex("/{2,}"); - RTemp = regex.Merge(RTemp, "/"); - - while (!RTemp.empty()) { - // Split by next / - RTemp = split(RTemp, Temp, '/'); - - if (Temp == ".") { - TempBase = "./"; - } else if (Temp == "..") { - // Remove one level of TempBase - string::difference_type i = TempBase.length() - 2; - while (i > 0 && TempBase[i] != '/') - --i; - if (i >= 0 && TempBase[i] == '/') - TempBase.erase(i + 1, string::npos); - else - TempBase = "../"; - } else { - TempBase += Temp + '/'; - } - } + if (!npath.is_complete()) + return "./" + npath.string() + '/'; - // returns absolute path - return TempBase; + return npath.string() + '/'; } Index: src/support/fs_extras.C =================================================================== --- src/support/fs_extras.C (Revision 14491) +++ src/support/fs_extras.C (Arbeitskopie) @@ -17,6 +17,7 @@ #include <boost/filesystem/exception.hpp> #include <boost/detail/workaround.hpp> #include <boost/throw_exception.hpp> +#include <boost/version.hpp> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> @@ -45,6 +46,22 @@ namespace fs = boost::filesystem; namespace boost { namespace filesystem { +#if BOOST_VERSION >= 103400 +#include <cerrno> +#define filesystem_error filesystem_path_error +namespace detail { + fs::errno_type system_error_code() + { +#ifdef BOOST_POSIX + return fs::lookup_errno(errno); +#endif +#ifdef BOOST_WINDOWS + return fs::detail::system_error_code(errno); +#endif + } +} +#endif + bool is_readable(path const & ph) { #ifdef BOOST_POSIX Index: src/support/debugstream.h =================================================================== --- src/support/debugstream.h (Revision 14491) +++ src/support/debugstream.h (Arbeitskopie) @@ -14,7 +14,13 @@ #include <iostream> -#include <boost/test/detail/nullstream.hpp> +#include <boost/version.hpp> + +#if BOOST_VERSION < 103300 +# include <boost/test/detail/nullstream.hpp> +#else +# include <boost/test/utils/nullstream.hpp> +#endif #ifdef DEBUG # define TEMPORARY_DEBUG_MACRO DEBUG Index: src/client/client.C =================================================================== --- src/client/client.C (Revision 14491) +++ src/client/client.C (Arbeitskopie) @@ -18,6 +18,7 @@ #include <boost/filesystem/operations.hpp> #include <boost/lexical_cast.hpp> #include <boost/scoped_ptr.hpp> +#include <boost/version.hpp> // getpid(), getppid() #ifdef HAVE_SYS_TYPES_H @@ -93,7 +94,11 @@ vector<fs::path> lyxSockets(string const for (; beg != end; ++beg) { if (prefixIs(beg->leaf(), "lyx_tmpdir" + pid)) { +#if BOOST_VERSION >= 103400 + fs::path lyxsocket = beg->path() / "lyxsocket"; +#else fs::path lyxsocket = *beg / "lyxsocket"; +#endif if (fs::exists(lyxsocket)) { dirlist.push_back(lyxsocket); }