From a537d60571bbf736e5e0d3f4ea9216d190c7215e Mon Sep 17 00:00:00 2001 From: lvezzaro Date: Sun, 30 Jan 2011 14:14:28 +0000 Subject: [PATCH] Fixed compilation on Visual C++. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1351 3ecf2c5c-341e-0410-92b4-d18e462d057c --- distro/win32/_sgpem.vcproj | 9 ++++++--- distro/win32/backend.vcproj | 4 ++-- distro/win32/config/config.h | 2 +- distro/win32/pyloader.vcproj | 7 ++++--- distro/win32/sgpemv2.sln | 20 +++++++++---------- distro/win32/sgpemv2.vcproj | 19 +++++++++--------- distro/win32/xmlsave.vcproj | 3 ++- .../pyloader/src/python_cpu_policy_manager.cc | 17 ++++++++++++++++ src/backend/sgpemv2/templates/down_cast.tcc | 4 ++-- src/configure_policy_dialog.cc | 2 +- src/simulation_controller.cc | 9 ++++++++- 11 files changed, 63 insertions(+), 33 deletions(-) diff --git a/distro/win32/_sgpem.vcproj b/distro/win32/_sgpem.vcproj index 397c68c..616bdcb 100644 --- a/distro/win32/_sgpem.vcproj +++ b/distro/win32/_sgpem.vcproj @@ -1,7 +1,7 @@ diff --git a/distro/win32/backend.vcproj b/distro/win32/backend.vcproj index effc87a..32f523a 100644 --- a/distro/win32/backend.vcproj +++ b/distro/win32/backend.vcproj @@ -1,7 +1,7 @@ #include +#ifdef _MSC_VER + #include +#endif + #include #include #include @@ -71,11 +75,24 @@ PythonCPUPolicyManager::PythonCPUPolicyManager() GlobalPreferences& prefs = GlobalPreferences::get_instance(); +#ifdef _MSC_VER + // Ensure relocation is possible on WIN32, relative paths don't appear + // to work anymore + Glib::ustring wdir = Glib::get_current_dir(); +#endif + Glib::ustring importdirs = "import sys; sys.path[:0] = [ "; for_each(prefs.get_policy_dirs().begin(), prefs.get_policy_dirs().end(), pol_dirs_concat(importdirs)); + +#ifdef _MSC_VER + // Ensure relocation is possible on WIN32, relative paths don't appear + // to work anymore + importdirs += Glib::ustring(" '") + wdir + SHAREDIR + "' ]\n"; +#else importdirs += " '" SHAREDIR "' ]\n"; +#endif PyRun_SimpleString(importdirs.c_str()); diff --git a/src/backend/sgpemv2/templates/down_cast.tcc b/src/backend/sgpemv2/templates/down_cast.tcc index 31a78e4..4aa2c92 100644 --- a/src/backend/sgpemv2/templates/down_cast.tcc +++ b/src/backend/sgpemv2/templates/down_cast.tcc @@ -22,7 +22,7 @@ #ifndef DOWN_CAST_TCC #define DOWN_CAST_TCC 1 -#if not defined(NDEBUG) && not defined(_MSC_VER) +#if !defined(NDEBUG) && !defined(_MSC_VER) #include #include #include @@ -115,7 +115,7 @@ namespace sgpem template inline To* operator()(From* obj) const { -#if not defined(NDEBUG) && not defined(_MSC_VER) +#if !defined(NDEBUG) && !defined(_MSC_VER) To* check_ptr = dynamic_cast(obj); if(check_ptr == NULL) { diff --git a/src/configure_policy_dialog.cc b/src/configure_policy_dialog.cc index 64d04d1..4996713 100644 --- a/src/configure_policy_dialog.cc +++ b/src/configure_policy_dialog.cc @@ -128,7 +128,7 @@ ConfigurePolicyDialog::ConfigurePolicyDialog(const Glib::ustring& title, // Add final buttons, and we're done. add_button(Stock::CANCEL, RESPONSE_CANCEL); - HButtonBox& bbox = *get_action_area(); + ButtonBox& bbox = *get_action_area(); Button& okay_bt = *manage(new Button(Stock::OK)); okay_bt.set_flags(CAN_DEFAULT); set_default(okay_bt); diff --git a/src/simulation_controller.cc b/src/simulation_controller.cc index 411eff3..5b43be8 100644 --- a/src/simulation_controller.cc +++ b/src/simulation_controller.cc @@ -213,11 +213,18 @@ SimulationController::run_simulation_adaptor() } catch(const CPUPolicyException& cpe) { +#ifndef _MSC_VER // Fatal error. We should never get here. + // Won't compile on Visual C++, what an idiotic compiler. Apparently he can't symphatize with the way + // Glib::ustring::compose() is written... std::cerr << Glib::ustring::compose( _(" [EE] Fatal error. Impossible to deactivate the policy in file %1:%2"), __FILE__, __LINE__) << std::endl << _(" [EE] ") << cpe.what() << std::endl; - ; +#else + // Fatal error. We should never get here. + std::cerr << _(" [EE] Fatal error. Impossible to deactivate the policy in file ") << __FILE__ << ":" << __LINE__ + << std::endl << _(" [EE] ") << cpe.what() << std::endl; +#endif abort(); } }