← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1823: 1. Remove rests of Preferences.

 

------------------------------------------------------------
revno: 1823
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Sun 2009-11-29 17:11:36 +0100
message:
  1. Remove rests of Preferences.
  2. Remove HUP emergency saving (was disabled since long anyway)
removed:
  core/Preferences.cpp
  core/Preferences.hpp
modified:
  core/Omega.hpp
  core/SConscript
  core/main/main.cpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'core/Omega.hpp'
--- core/Omega.hpp	2009-11-29 11:03:25 +0000
+++ core/Omega.hpp	2009-11-29 16:11:36 +0000
@@ -48,7 +48,6 @@
 
 class MetaBody;
 class ThreadRunner;
-class Preferences;
 
 using namespace boost;
 using namespace boost::posix_time;
@@ -94,7 +93,6 @@
 		boost::mutex loadingSimulationMutex;
 
 	public :
-		shared_ptr<Preferences> preferences;
 		string 				 yadeConfigPath;	// FIXME - must be private and more clean
 		string 				 yadeVersionName;	// FIXME - public ?
 

=== removed file 'core/Preferences.cpp'
--- core/Preferences.cpp	2009-05-24 17:22:30 +0000
+++ core/Preferences.cpp	1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2004 by Olivier Galizzi                                 *
-*  olivier.galizzi@xxxxxxx                                               *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#include "Preferences.hpp"
-
-Preferences::Preferences (){}
-

=== removed file 'core/Preferences.hpp'
--- core/Preferences.hpp	2009-08-03 10:02:11 +0000
+++ core/Preferences.hpp	1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-/*************************************************************************
-*  Copyright (C) 2004 by Olivier Galizzi                                 *
-*  olivier.galizzi@xxxxxxx                                               *
-*                                                                        *
-*  This program is free software; it is licensed under the terms of the  *
-*  GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-
-#pragma once
-
-#include <iostream>
-#include <vector>
-
-#include<yade/lib-serialization/Serializable.hpp>
-
-using namespace std;
-
-class Preferences : public Serializable{
-	public :
-		string		 defaultGUILibName;
-		Preferences ();
-	REGISTER_ATTRIBUTES(Serializable,(defaultGUILibName));
-	REGISTER_CLASS_AND_BASE(Preferences,Serializable);
-};
-REGISTER_SERIALIZABLE(Preferences);
-
-

=== modified file 'core/SConscript'
--- core/SConscript	2009-11-29 11:03:25 +0000
+++ core/SConscript	2009-11-29 16:11:36 +0000
@@ -31,7 +31,6 @@
 			'MetaEngine.cpp',
 			'NullGUI.cpp',
 			'Omega.cpp',
-			'Preferences.cpp',
 			'SimulationFlow.cpp',
 			'State.cpp',
 			'ThreadRunner.cpp',

=== modified file 'core/main/main.cpp'
--- core/main/main.cpp	2009-11-29 11:03:25 +0000
+++ core/main/main.cpp	2009-11-29 16:11:36 +0000
@@ -25,9 +25,6 @@
 #include<yade/lib-base/Logging.hpp>
 #include<yade/core/Omega.hpp>
 #include<yade/core/FrontEnd.hpp>
-// #include<yade/core/Preferences.hpp>
-
-// #define YADE_HUP_EMERGENCY_SAVE
 
 using namespace std;
 
@@ -83,53 +80,9 @@
 			raise(sig); // reemit signal after exiting gdb
 			break;
 	#endif
-
-	#ifdef YADE_HUP_EMERGENCY_SAVE
-	case SIGHUP:
-		signal(SIGHUP,SIG_DFL);
-		LOG_INFO("Received SIGHUP.");
-		if(Omega::instance().getRootBody()){
-			LOG_INFO("Attempting emergency save to "<<Omega::instance().recoveryFilename);
-			Omega::instance().stopSimulationLoop();
-			Omega::instance().joinSimulationLoop();
-			Omega::instance().saveSimulation(Omega::instance().recoveryFilename);
-		} else LOG_INFO("Nothing to save.");
-		LOG_INFO("Emergency exit.");
-		exit(1);
-	#endif
-
-	}
-}
-
-#if 0
-void firstRunSetup(shared_ptr<Preferences>& pref)
-{
-	string cfgFile=Omega::instance().yadeConfigPath+"/preferences.xml";
-	LOG_INFO("Creating default configuration file: "<<cfgFile<<". Tune by hand if needed.");
-	#ifdef YADE_OPENGL
-		pref->defaultGUILibName="QtGUI";
-	#else
-		pref->defaultGUILibName="PythonUI";
-	#endif
-	LOG_INFO("Setting GUI: "<<pref->defaultGUILibName);
-	IOFormatManager::saveToFile("XMLFormatManager",cfgFile,"preferences",pref);
-}
-#endif
-
-#ifdef YADE_HUP_EMERGENCY_SAVE
-	string findRecoveryCandidate(filesystem::path dir, string start){
-	#if BOOST_VERSION > 103400
-		if(!filesystem::exists(dir)) return false;
-		filesystem::directory_iterator end;
-		for(filesystem::directory_iterator I(dir); I!=end; ++I){
-			if(filesystem::is_regular(I->status()) && I->path().leaf().find(start)==0 ){
-				return (I->path()).string();
-			}
-		}
-	#endif
-		return "";
-	}
-#endif
+	}
+}
+
 
 void printHelp()
 {
@@ -235,7 +188,6 @@
 		else if (verbose>=2) logger->setLevel(debugLevel);
 	#endif
 
-	// Omega::instance().preferences    = shared_ptr<Preferences>(new Preferences);
 	Omega::instance().yadeConfigPath = configPath; 
 	filesystem::path yadeConfigPath  = filesystem::path(Omega::instance().yadeConfigPath, filesystem::native);
 #if 0
@@ -297,20 +249,6 @@
 	Omega::instance().initTemps();
 	Omega::instance().setSimulationFileName(simulationFileName); //init() resets to "";
 
-	#ifdef YADE_HUP_EMERGENCY_SAVE
-		// recovery file pattern
-		Omega::instance().recoveryFilename=(yadeConfigPath/"recovery-pid").string()+lexical_cast<string>(getpid())+".xml";
-		signal(SIGHUP,sigHandler);
-
-		string recoveryCandidate=findRecoveryCandidate(/* directory */ yadeConfigPath, /* beginning of the filename */ "recovery-pid");
-		if(!recoveryCandidate.empty()){
-			if(!simulationFileName.empty()) LOG_WARN("Skipping recovery of `"<<recoveryCandidate<<"', since the file `"<<simulationFileName<<"' was given on the command-line.")
-			else {
-				LOG_INFO("Will recover simulation from `"<<recoveryCandidate<<"'.");
-				Omega::instance().setSimulationFileName(recoveryCandidate);
-			}
-		}
-	#endif
 
 	// handle this a little more inteligently, use FrontEnd::available to chec kif the GUI will really run (QtGUi without DISPLAY and similar)
 	// if(gui.size()==0) gui=Omega::instance().preferences->defaultGUILibName;
@@ -345,7 +283,7 @@
 	// Py_Finalize();
 	#ifdef YADE_DEBUG
 		if(useGdb){
-			signal(SIGABRT,SIG_DFL); signal(SIGHUP,SIG_DFL); // default handlers
+			signal(SIGABRT,SIG_DFL); // default handlers
 			unlink(Omega::instance().gdbCrashBatch.c_str());
 			signal(SIGSEGV,termHandler);
 		}