diff --git a/Makefile.am b/Makefile.am index a59a792..22415ef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -501,7 +501,9 @@ src_testsuite_test_statistics_LDFLAGS = \ src_testsuite_test_statistics_SOURCES = \ src/backend/statistics.cc \ src/backend/concrete_process_statistics.cc \ + src/backend/concrete_thread_statistics.cc \ src/backend/concrete_simulation_statistics.cc \ + src/backend/concrete_statistics.cc \ src/testsuite/test-statistics.cc diff --git a/plugins/pyloader/m4/ac_python_devel.m4 b/plugins/pyloader/m4/ac_python_devel.m4 index 1be1740..56cd191 100644 --- a/plugins/pyloader/m4/ac_python_devel.m4 +++ b/plugins/pyloader/m4/ac_python_devel.m4 @@ -240,11 +240,10 @@ $ac_distutils_result]) LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" AC_LANG_PUSH([C]) - AC_TRY_LINK(AC_LANG_PROGRAM([ - #include - ],[ - Py_Initialize(); - ]),[pythonexists=yes],[pythonexists=no]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], + [[Py_Initialize();]]) + ],[pythonexists=yes],[pythonexists=no]) AC_LANG_POP([C]) # turn back to default flags CPPFLAGS="$ac_save_CPPFLAGS" diff --git a/plugins/pyloader/src/python_cpu_policy.cc b/plugins/pyloader/src/python_cpu_policy.cc index fc20cd4..50acb0b 100644 --- a/plugins/pyloader/src/python_cpu_policy.cc +++ b/plugins/pyloader/src/python_cpu_policy.cc @@ -91,12 +91,12 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio PythonCPUPolicy::~PythonCPUPolicy() { - if (_adapter) Py_DECREF(_adapter); + if (_adapter) { Py_DECREF(_adapter); } // We keep this alive until dtor time, because // the user may have defined some static global-space // variables and they make use of them. - if (_upolicy_dict) Py_DECREF(_upolicy_dict); + if (_upolicy_dict) { Py_DECREF(_upolicy_dict); } } void @@ -135,7 +135,7 @@ PythonCPUPolicy::configure() throw(UserInterruptException, MalformedPolicyExcept Glib::RecMutex::Lock lock(_mtx);; set_callback_policy(const_cast(this)); - PyObject* retval = PyObject_CallMethod(_adapter, "async_configure", NULL); + PyObject* retval = PyObject_CallMethod(_adapter, const_cast("async_configure"), NULL); Py_DECREF(retval); wait_unlock(); @@ -150,7 +150,7 @@ PythonCPUPolicy::sort_queue() const throw(UserInterruptException, MalformedPolic Glib::RecMutex::Lock lock(_mtx);; set_callback_policy(const_cast(this)); - PyObject* retval = PyObject_CallMethod(_adapter, "async_sort_queue", NULL); + PyObject* retval = PyObject_CallMethod(_adapter, const_cast("async_sort_queue"), NULL); // Do minimal debugging if (!retval) PyErr_Print(); @@ -181,13 +181,13 @@ PythonCPUPolicy::is_pre_emptive() const throw(UserInterruptException, MalformedP Glib::RecMutex::Lock lock(_mtx);; set_callback_policy(const_cast(this)); - PyObject* retval = PyObject_CallMethod(_adapter, "async_is_preemptive", NULL); + PyObject* retval = PyObject_CallMethod(_adapter, const_cast("async_is_preemptive"), NULL); Py_DECREF(retval); wait_unlock(); // Parse return value stored in global Python object - retval = PyObject_CallMethod(_adapter, "get_return_value", NULL); + retval = PyObject_CallMethod(_adapter, const_cast("get_return_value"), NULL); assert(retval); bool ret = PyObject_IsTrue(retval); Py_DECREF(retval); @@ -203,7 +203,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP Glib::RecMutex::Lock lock(_mtx);; set_callback_policy(const_cast(this)); - PyObject* retval = PyObject_CallMethod(_adapter, "async_get_time_slice", NULL); + PyObject* retval = PyObject_CallMethod(_adapter, const_cast("async_get_time_slice"), NULL); // Do minimal debugging if (!retval) PyErr_Print(); @@ -212,7 +212,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP wait_unlock(); // Parse return value stored in global Python object - retval = PyObject_CallMethod(_adapter, "get_return_value", NULL); + retval = PyObject_CallMethod(_adapter, const_cast("get_return_value"), NULL); assert(retval); long tmp = PyInt_AsLong(retval); Py_DECREF(retval); @@ -239,7 +239,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli Glib::usleep(wait_for); // hack'a'ton! magggggiccc nummmbeeerrrrrs!! Py_BLOCK_THREADS; - PyObject* retval = PyObject_CallMethod(_adapter, "mutex_test_lock", NULL); + PyObject* retval = PyObject_CallMethod(_adapter, const_cast("mutex_test_lock"), NULL); assert(retval); still_locked = PyObject_IsTrue(retval); Py_DECREF(retval); @@ -263,7 +263,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli // check if there were unhandled exception in the user-defined code - PyObject* pException = PyObject_CallMethod(_adapter, "get_last_exception", NULL); + PyObject* pException = PyObject_CallMethod(_adapter, const_cast("get_last_exception"), NULL); if(pException != NULL) { @@ -325,9 +325,9 @@ PythonCPUPolicy::get_exception_information() else msg = string(_("no available information for this error")); - if (pType != NULL) Py_DECREF(pType); - if (pValue != NULL) Py_DECREF(pValue); - if (pTraceback != NULL) Py_DECREF(pTraceback); + if (pType != NULL) { Py_DECREF(pType); } + if (pValue != NULL) { Py_DECREF(pValue); } + if (pTraceback != NULL) { Py_DECREF(pTraceback); } PyErr_Clear(); diff --git a/plugins/xmlsave/src/xml_serializer.cc b/plugins/xmlsave/src/xml_serializer.cc index 4adb83d..c1729a6 100644 --- a/plugins/xmlsave/src/xml_serializer.cc +++ b/plugins/xmlsave/src/xml_serializer.cc @@ -138,67 +138,14 @@ void XMLSerializer::fill_doc(xmlDocPtr doc, const History& hist) * Creates a DTD declaration. Isn't mandatory. */ xmlDtdPtr dtd = xmlCreateIntSubset(doc, (const xmlChar *) "sgpem", NULL, (const xmlChar *) "sgpem.dtd"); + + //TODO: check for DTD compliance?? XMLVisitor xvisit(root_node); xvisit.from_history(hist); - /* - // - // xmlNewChild() creates a new node, which is "attached" as child node - // of root_node node. - // - xmlNodePtr resources_node = xmlNewChild(root_node, NULL, (const xmlChar *) "resources", NULL); - // - // The same as above, but the new child node doesn't have a content - // - xmlNodePtr schedulables_node = xmlNewChild(root_node, NULL, (const xmlChar *) "schedulables", NULL); - - fill_resources(resources_node, hist); - fill_schedulables(schedulables_node, hist); - */ + } -/* -void XMLSerializer::fill_resources(xmlNodePtr resources_node, const History& hist) -{ - - - const Environment& env = hist.get_last_environment(); - - const Environment::Resources& rvect = env.get_resources(); - typedef Environment::Resources::const_iterator res_iterator; - - res_iterator iter = rvect.begin(); - res_iterator end = rvect.end(); - while(iter!=end) - { - XMLVisitor xvisit(resources_node); - Glib::ustring key; - int_to_string((int)(*iter).first, key); - xvisit.from_resource(*((*iter).second), key); - iter++; - } -} - -void XMLSerializer::fill_schedulables(xmlNodePtr schedulables_node, const History& hist) -{ - - - const Environment& env = hist.get_last_environment(); - - const Environment::Processes& pvect = env.get_processes(); - typedef std::vector::const_iterator proc_iterator; - - proc_iterator iter = pvect.begin(); - proc_iterator end = pvect.end(); - while(iter!=end) - { - XMLVisitor xvisit(schedulables_node); - xvisit.from_process(*(*iter)); - iter++; - } -} -*/ - void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(SerializerError) { /* diff --git a/plugins/xmlsave/src/xml_serializer_factory.cc b/plugins/xmlsave/src/xml_serializer_factory.cc index b8c9cc7..bb3be89 100644 --- a/plugins/xmlsave/src/xml_serializer_factory.cc +++ b/plugins/xmlsave/src/xml_serializer_factory.cc @@ -86,7 +86,7 @@ XMLSerializerFactory::create_resource(Parameters& parameters) int arrival_time = 0; int how_many = 1; bool preemptable = false; - int old_key; + int old_key = 0; Parameters::iterator pos; // read "name" property diff --git a/plugins/xmlsave/src/xml_visitor.cc b/plugins/xmlsave/src/xml_visitor.cc index 6b37961..d8baca3 100644 --- a/plugins/xmlsave/src/xml_visitor.cc +++ b/plugins/xmlsave/src/xml_visitor.cc @@ -44,7 +44,7 @@ XMLVisitor::~XMLVisitor() { } -void XMLVisitor::from_resource(const Resource& obj) throw(SerializerError) +void XMLVisitor::from_resource(const Resource& /*obj*/) throw(SerializerError) { throw SerializerError( _("XMLVisitor: unsupported method from_resource(const Resource& obj)") @@ -203,8 +203,7 @@ void XMLVisitor::from_process(xmlNodePtr parent, const Process& obj) throw(Seria while (iter != end) { const Thread* t = *iter; - - from_thread(threads_node, *(*iter)); + from_thread(threads_node, *t); iter++; } } @@ -244,8 +243,7 @@ void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) throw(Seriali while (iter != end) { const Request* r = *iter; - - from_request(requests_node, *(*iter)); + from_request(requests_node, *r); iter++; } } @@ -278,7 +276,7 @@ void XMLVisitor::from_request(xmlNodePtr parent, const Request& obj) throw(Seria while (iter != end) { const SubRequest* sr = *iter; - from_subrequest(request_node, *(*iter)); + from_subrequest(request_node, *sr); iter++; } } diff --git a/src/backend/concrete_history.cc b/src/backend/concrete_history.cc index 63e04e5..4a510d5 100644 --- a/src/backend/concrete_history.cc +++ b/src/backend/concrete_history.cc @@ -307,9 +307,9 @@ ConcreteHistory::clear() ConcreteHistory::ResourcePair ConcreteHistory::add_resource(const Glib::ustring& name, - bool preemptable, + bool /*preemptable*/, size_t places, - size_t availability) + size_t /*availability*/) { typedef ConcreteEnvironment::Resources Resources; typedef ConcreteEnvironment::SubRequestQueue SubRequestQueue; @@ -341,9 +341,9 @@ ConcreteHistory::add_resource(const Glib::ustring& name, void ConcreteHistory::edit_resource(Resource& resource, const Glib::ustring& name, - bool preemptable, + bool /*preemptable*/, size_t places, - size_t availability) + size_t /*availability*/) { // And preemptable and availability?? FIXME! diff --git a/src/backend/concrete_process_statistics.hh b/src/backend/concrete_process_statistics.hh index 4f5e7b9..3902835 100644 --- a/src/backend/concrete_process_statistics.hh +++ b/src/backend/concrete_process_statistics.hh @@ -37,7 +37,7 @@ namespace sgpem This class is a direct subclass of the abstract class ProcessStatistics. For the documentation af all methods refere to it. */ - class ConcreteProcessStatistics : public ProcessStatistics + class SG_DLLLOCAL ConcreteProcessStatistics : public ProcessStatistics { public: friend class ConcreteStatistics; diff --git a/src/backend/concrete_simulation.cc b/src/backend/concrete_simulation.cc index 54ff511..7cb2635 100644 --- a/src/backend/concrete_simulation.cc +++ b/src/backend/concrete_simulation.cc @@ -167,11 +167,13 @@ ConcreteSimulation::step() { // step forward bool yet_to_finish = true; - if (_history.get_front() == _history.get_size() - 1) - if(!_history.is_sealed()) - yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy(), *get_resource_policy()); - else - yet_to_finish = false; + if (_history.get_front() == _history.get_size() - 1) + { + if(!_history.is_sealed()) + yet_to_finish = Scheduler::get_instance().step_forward(_history, *get_policy(), *get_resource_policy()); + else + yet_to_finish = false; + } if (!yet_to_finish) _history.seal(); diff --git a/src/backend/concrete_simulation.hh b/src/backend/concrete_simulation.hh index c045c8e..0df21ab 100644 --- a/src/backend/concrete_simulation.hh +++ b/src/backend/concrete_simulation.hh @@ -22,7 +22,6 @@ #define CONCRETE_SIMULATION_HH 1 - #include #include "concrete_history.hh" @@ -35,7 +34,7 @@ namespace sgpem { class ConcreteSimulation; - class ConcreteSimulation : public Simulation + class SG_DLLLOCAL ConcreteSimulation : public Simulation { public: ConcreteSimulation(); diff --git a/src/backend/concrete_simulation_statistics.hh b/src/backend/concrete_simulation_statistics.hh index 3065d48..907eb35 100644 --- a/src/backend/concrete_simulation_statistics.hh +++ b/src/backend/concrete_simulation_statistics.hh @@ -36,7 +36,7 @@ namespace sgpem This class is a direct subclass of the abstract class SimulationStatistics. For the documentation af all methods refere to it. */ - class ConcreteSimulationStatistics : public SimulationStatistics + class SG_DLLLOCAL ConcreteSimulationStatistics : public SimulationStatistics { public: friend class ConcreteStatistics; diff --git a/src/backend/concrete_statistics.hh b/src/backend/concrete_statistics.hh index ca27000..8b8baea 100644 --- a/src/backend/concrete_statistics.hh +++ b/src/backend/concrete_statistics.hh @@ -38,7 +38,7 @@ namespace sgpem This class is a direct subclass of the abstract class Statistics. For the documentation af all methods refere to it. */ - class ConcreteStatistics : public Statistics + class SG_DLLLOCAL ConcreteStatistics : public Statistics { public: ConcreteStatistics(); diff --git a/src/backend/concrete_thread_statistics.hh b/src/backend/concrete_thread_statistics.hh index 1bcc496..49bf903 100644 --- a/src/backend/concrete_thread_statistics.hh +++ b/src/backend/concrete_thread_statistics.hh @@ -38,7 +38,7 @@ namespace sgpem This class is a direct subclass of the abstract class ThreadStatistics. For the documentation af all methods refere to it. */ - class ConcreteThreadStatistics : public ThreadStatistics + class SG_DLLLOCAL ConcreteThreadStatistics : public ThreadStatistics { public: friend class ConcreteProcessStatistics; diff --git a/src/backend/cpp_resource_policy_manager.hh b/src/backend/cpp_resource_policy_manager.hh index b7eef25..0e7d652 100644 --- a/src/backend/cpp_resource_policy_manager.hh +++ b/src/backend/cpp_resource_policy_manager.hh @@ -37,7 +37,7 @@ namespace sgpem /** ResourcePolicyManager is the Abstract Factory for \ref ResourcePolicy objects. */ - class CppResourcePolicyManager : public ResourcePolicyManager + class SG_DLLLOCAL CppResourcePolicyManager : public ResourcePolicyManager { public: /** \brief CppResourcePolicyManager constructor diff --git a/src/backend/cpu_policies_gatekeeper.cc b/src/backend/cpu_policies_gatekeeper.cc index 2ab96cb..d29fa9c 100644 --- a/src/backend/cpu_policies_gatekeeper.cc +++ b/src/backend/cpu_policies_gatekeeper.cc @@ -41,7 +41,7 @@ using std::runtime_error; using namespace sgpem; // Explicit template instantiation to allow to export symbols from the DSO. -template class SG_DLLEXPORT Singleton; +template class Singleton; typedef vector::iterator ManagerIterator; typedef map::iterator ActiveIterator; diff --git a/src/backend/global_preferences.cc b/src/backend/global_preferences.cc index f31c46c..0ee8bad 100644 --- a/src/backend/global_preferences.cc +++ b/src/backend/global_preferences.cc @@ -40,7 +40,7 @@ using namespace sgpem; // Explicit template instantiation to allow to export symbols from the DSO. -template class SG_DLLEXPORT Singleton; +template class Singleton; GlobalPreferences::GlobalPreferences() : _mod_dirs(1, PLUGDIR), _pol_dirs(1, POLDIR), _speed(1000) diff --git a/src/backend/global_preferences_serializer.hh b/src/backend/global_preferences_serializer.hh index 06e971a..bfab47d 100644 --- a/src/backend/global_preferences_serializer.hh +++ b/src/backend/global_preferences_serializer.hh @@ -1,4 +1,4 @@ -// src/backend/key_file.hh - Copyright 2005, 2006, University +// src/backend/global_preferences_serializer.hh - Copyright 2005, 2006, University // of Padova, dept. of Pure and Applied // Mathematics // @@ -36,7 +36,7 @@ namespace sgpem * in the form of: key=value rows. * */ - class SG_DLLEXPORT GlobalPreferencesSerializer : public KeyFile + class SG_DLLLOCAL GlobalPreferencesSerializer : public KeyFile { public: diff --git a/src/backend/plugin_manager.cc b/src/backend/plugin_manager.cc index b716318..1d19d8c 100644 --- a/src/backend/plugin_manager.cc +++ b/src/backend/plugin_manager.cc @@ -35,7 +35,7 @@ using namespace sgpem; -template class SG_DLLEXPORT Singleton; +template class Singleton; std::vector diff --git a/src/backend/resource_policies_gatekeeper.cc b/src/backend/resource_policies_gatekeeper.cc index 158ecd6..d68a697 100644 --- a/src/backend/resource_policies_gatekeeper.cc +++ b/src/backend/resource_policies_gatekeeper.cc @@ -40,7 +40,7 @@ using std::runtime_error; using namespace sgpem; // Explicit template instantiation to allow to export symbols from the DSO. -template class SG_DLLEXPORT Singleton; +template class Singleton; typedef vector::iterator ManagerIterator; typedef map::iterator PolicyIterator; diff --git a/src/backend/resource_policy_fifo.cc b/src/backend/resource_policy_fifo.cc index 7e4831d..4892300 100644 --- a/src/backend/resource_policy_fifo.cc +++ b/src/backend/resource_policy_fifo.cc @@ -35,7 +35,7 @@ ResourcePolicyFiFo::configure() } void -ResourcePolicyFiFo::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) +ResourcePolicyFiFo::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException) { typedef Environment::SubRequestQueue SubRequestQueue; diff --git a/src/backend/resource_policy_fifo.hh b/src/backend/resource_policy_fifo.hh index 6856e8e..bf68b76 100644 --- a/src/backend/resource_policy_fifo.hh +++ b/src/backend/resource_policy_fifo.hh @@ -36,7 +36,7 @@ namespace sgpem It's a Strategy wich stay for a resource allocating algorithm. It implements the related resource allocation policy. */ - class ResourcePolicyFiFo : public ResourcePolicy + class SG_DLLLOCAL ResourcePolicyFiFo : public ResourcePolicy { public: virtual ~ResourcePolicyFiFo(); diff --git a/src/backend/resource_policy_lifo.cc b/src/backend/resource_policy_lifo.cc index 35a67cd..6f3dd5f 100644 --- a/src/backend/resource_policy_lifo.cc +++ b/src/backend/resource_policy_lifo.cc @@ -34,7 +34,7 @@ ResourcePolicyLiFo::configure() } void -ResourcePolicyLiFo::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) +ResourcePolicyLiFo::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException) { typedef Environment::SubRequestQueue SubRequestQueue; diff --git a/src/backend/resource_policy_lifo.hh b/src/backend/resource_policy_lifo.hh index a6affeb..dd82a36 100644 --- a/src/backend/resource_policy_lifo.hh +++ b/src/backend/resource_policy_lifo.hh @@ -37,7 +37,7 @@ namespace sgpem It's a Strategy wich stay for a resource allocating algorithm. It implements the related resource allocation policy. */ - class ResourcePolicyLiFo : public ResourcePolicy + class SG_DLLLOCAL ResourcePolicyLiFo : public ResourcePolicy { public: virtual ~ResourcePolicyLiFo(); diff --git a/src/backend/resource_policy_priority.cc b/src/backend/resource_policy_priority.cc index a6f720b..ae4bc6f 100644 --- a/src/backend/resource_policy_priority.cc +++ b/src/backend/resource_policy_priority.cc @@ -36,7 +36,7 @@ ResourcePolicyPriority::configure() } void -ResourcePolicyPriority::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) +ResourcePolicyPriority::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException) { typedef Environment::SubRequestQueue SubRequestQueue; diff --git a/src/backend/resource_policy_priority.hh b/src/backend/resource_policy_priority.hh index f49b437..16f9cf5 100644 --- a/src/backend/resource_policy_priority.hh +++ b/src/backend/resource_policy_priority.hh @@ -40,7 +40,7 @@ namespace sgpem /// following the priority of the owners of the requests. class ResourcePolicyPriority; - class ResourcePolicyPriority : public ResourcePolicy + class SG_DLLLOCAL ResourcePolicyPriority : public ResourcePolicy { public: diff --git a/src/backend/resource_policy_priority_inheritance.cc b/src/backend/resource_policy_priority_inheritance.cc index 7463142..9915664 100644 --- a/src/backend/resource_policy_priority_inheritance.cc +++ b/src/backend/resource_policy_priority_inheritance.cc @@ -35,7 +35,7 @@ ResourcePolicyPriorityInheritance::configure() } void -ResourcePolicyPriorityInheritance::enforce(Environment& environment, Environment::SubRequestQueue& queue, SubRequest& sr) +ResourcePolicyPriorityInheritance::enforce(Environment& /*environment*/, Environment::SubRequestQueue& queue, SubRequest& sr) throw(UserInterruptException) { typedef Environment::SubRequestQueue SubRequestQueue; diff --git a/src/backend/resource_policy_priority_inheritance.hh b/src/backend/resource_policy_priority_inheritance.hh index 79ad243..7d803a1 100644 --- a/src/backend/resource_policy_priority_inheritance.hh +++ b/src/backend/resource_policy_priority_inheritance.hh @@ -34,7 +34,7 @@ namespace sgpem * \brief It's a Strategy wich stay for a resource allocating algorithm. * It implements the related resource allocation policy. */ - class ResourcePolicyPriorityInheritance : public ResourcePolicy + class SG_DLLLOCAL ResourcePolicyPriorityInheritance : public ResourcePolicy { public: diff --git a/src/backend/scheduler.cc b/src/backend/scheduler.cc index a9fe215..a6e68e4 100644 --- a/src/backend/scheduler.cc +++ b/src/backend/scheduler.cc @@ -49,7 +49,7 @@ using namespace std; using namespace sgpem; // Explicit template instantiation to allow to export symbols from the DSO. -template class SG_DLLEXPORT Singleton; +template class Singleton; typedef std::vector Processes; @@ -69,8 +69,6 @@ static void terminate_all_requests_of(DynamicThread& thread, ConcreteEnvironment static void update_allocated_requests(DynamicThread& running_thread, ConcreteEnvironment& environment); static void raise_new_requests(DynamicThread& running_thread, ConcreteEnvironment& environment, ResourcePolicy& resource_policy); static void look_for_mutant_request_states(ConcreteEnvironment& environment, unsigned int& alive_threads); -static void determine_subr_allocable_status(const DynamicRequest& req, DynamicSubRequest& subr, - const Resource& res, SubRequestQueue& queue); static void determine_subr_allocable_status(const Resource& res, const SubRequestQueue& queue); @@ -268,69 +266,6 @@ raise_new_requests(DynamicThread& running_thread, ConcreteEnvironment& environme } -// The following loop determines how many places in the resource are -// really available for a thread, and how many places for a specific -// resource a thread really needs. Admittedly, it's a bit of a hack (in -// the way it's written, not conceptually!) -void -determine_subr_allocable_status(const DynamicRequest& req, DynamicSubRequest& subr, - const Resource& res, SubRequestQueue& queue) -{ - unsigned int total_places = res.get_places(); - unsigned int free_places = total_places; - unsigned int needed_places = 0; - - unsigned int position_in_queue = 0; - bool too_far_in_the_queue = false; - const SubRequestQueue& const_queue = queue; - for(Iseq queue_it = iseq(const_queue); - queue_it && free_places >= needed_places; queue_it++, position_in_queue++) - { - SubRequest& sr = **queue_it; - if(sr.get_state() == Request::state_allocated) - { - assert(free_places > 0); // Just to be sure... - free_places--; - } - // Okay, this won't win a beauty contest... - if(&sr.get_request() == &req) - needed_places++; - // Well, and what about this, then? - if(&sr == &subr && position_in_queue + 1 > total_places) - too_far_in_the_queue = true; - - } //~ for(over subrequest queue) - - // If the number of places this thread need for a resource are - // less or equal the places left free, it's allocable. - if(needed_places <= free_places && !too_far_in_the_queue) - subr.set_state(Request::state_allocable); - else - { - subr.set_state(Request::state_unallocable); -/* - // Okay, this is difficult to understand, so read carefully: - // when we make a subrequest unallocable, it means that the - // whole request is unallocable. However, it may happen that - // there are other subrequests just marked allocable for - // a given resource. Since a request is atomic, either we're - // given *all* the places we asked for in a resource, or none. - // This doesn't affect the state for other subrequests on other - // resources, which may stay (atomically) allocable. - // (Maybe it was better to implement the number of "places" - // needed directly into subrequests, after all...) - for(Iseq queue_it = iseq(queue); queue_it; queue_it++) - { - DynamicSubRequest& x = static_cast(**queue_it); - if(&x.get_request() == &req && x.get_state() == Request::state_allocable) - x.set_state(Request::state_unallocable); - } -*/ - } - -} - - // The following loop updates the states of the subrequests depending // on their position in the queue void diff --git a/src/backend/sgpemv2/policy_parameters.hh b/src/backend/sgpemv2/policy_parameters.hh index ccc63e3..9e663d4 100644 --- a/src/backend/sgpemv2/policy_parameters.hh +++ b/src/backend/sgpemv2/policy_parameters.hh @@ -24,6 +24,7 @@ #include #include +#include #include #include "glibmm/ustring.h" @@ -34,7 +35,7 @@ namespace sgpem class SG_DLLEXPORT PolicyParametersException : public std::runtime_error { public: - PolicyParametersException(char* msg): std::runtime_error(msg) {} + PolicyParametersException(std::string msg): std::runtime_error(msg) {} }; diff --git a/src/backend/simulation.cc b/src/backend/simulation.cc index cdf14c6..3152c59 100644 --- a/src/backend/simulation.cc +++ b/src/backend/simulation.cc @@ -33,7 +33,7 @@ using namespace sgpem; // Explicit template instantiation to allow to export symbols from the DSO. -template class SG_DLLEXPORT Singleton; +template class Singleton; Simulation::Simulation() : _notify(true) diff --git a/src/backend/static_process.hh b/src/backend/static_process.hh index 1af3c26..1334a8b 100644 --- a/src/backend/static_process.hh +++ b/src/backend/static_process.hh @@ -38,7 +38,7 @@ namespace sgpem It IS a Schedulable object. */ - class StaticProcess : public StaticSchedulable + class SG_DLLLOCAL StaticProcess : public StaticSchedulable { public: /** \brief Creates a new object with the given parameters. */ diff --git a/src/backend/static_request.hh b/src/backend/static_request.hh index 2abfa69..0c31b82 100644 --- a/src/backend/static_request.hh +++ b/src/backend/static_request.hh @@ -31,7 +31,7 @@ namespace sgpem class StaticRequest; class SerializeVisitor; - class StaticRequest + class SG_DLLLOCAL StaticRequest { public: StaticRequest(StaticThread* thread, unsigned int instant); diff --git a/src/backend/static_resource.hh b/src/backend/static_resource.hh index b44fceb..ee4c5f0 100644 --- a/src/backend/static_resource.hh +++ b/src/backend/static_resource.hh @@ -21,6 +21,7 @@ #ifndef STATIC_RESOURCE_HH #define STATIC_RESOURCE_HH 1 +#include #include "glibmm/ustring.h" @@ -39,7 +40,7 @@ namespace sgpem /// copy constructor private. This makes clear that if you want to edit a /// static entity, you should reset the ::History, remove the old static /// entity, and create a new dynamic entity for the new static one. - class StaticResource + class SG_DLLLOCAL StaticResource { public: /// \brief Constructor taking a defined name and a number of places. diff --git a/src/backend/static_schedulable.hh b/src/backend/static_schedulable.hh index 56d443f..8bf1509 100644 --- a/src/backend/static_schedulable.hh +++ b/src/backend/static_schedulable.hh @@ -21,6 +21,7 @@ #ifndef STATIC_SCHEDULABLE_HH #define STATIC_SCHEDULABLE_HH 1 +#include #include "glibmm/ustring.h" @@ -38,7 +39,7 @@ namespace sgpem * * \see DynamicSchedulable */ - class StaticSchedulable + class SG_DLLLOCAL StaticSchedulable { public: /** \brief Create a new object with the given parameters */ diff --git a/src/backend/static_sub_request.hh b/src/backend/static_sub_request.hh index 09c7d59..3556a7e 100644 --- a/src/backend/static_sub_request.hh +++ b/src/backend/static_sub_request.hh @@ -45,7 +45,7 @@ namespace sgpem class StaticRequest; class StaticResource; - class StaticSubRequest + class SG_DLLLOCAL StaticSubRequest { public: typedef SubRequest::resource_key_t resource_key_t; diff --git a/src/backend/static_thread.hh b/src/backend/static_thread.hh index fe1a34c..0ed49d2 100644 --- a/src/backend/static_thread.hh +++ b/src/backend/static_thread.hh @@ -65,7 +65,7 @@ namespace sgpem /// at which its creation in the operating system is simulated. class StaticThread; - class StaticThread : public StaticSchedulable + class SG_DLLLOCAL StaticThread : public StaticSchedulable { public: diff --git a/src/cairo_widget.cc b/src/cairo_widget.cc index 9ba8955..3fb3fab 100644 --- a/src/cairo_widget.cc +++ b/src/cairo_widget.cc @@ -25,7 +25,7 @@ #include - +#include #include #include @@ -110,8 +110,10 @@ CairoWidget::on_realize() set_window(window); window->set_user_data(gobj()); - gtk_style_attach(get_style()->gobj(), window->gobj()); - get_style()->set_background(window, Gtk::STATE_ACTIVE); + + Glib::RefPtr style = get_style (); + style = style->attach (window); + style->set_background(window, Gtk::STATE_ACTIVE); } /* diff --git a/src/testsuite/test-key_file.cc b/src/testsuite/test-key_file.cc index 9827c95..c64899b 100644 --- a/src/testsuite/test-key_file.cc +++ b/src/testsuite/test-key_file.cc @@ -25,6 +25,7 @@ #include +#include #include int diff --git a/src/text_simulation.cc b/src/text_simulation.cc index b684ea0..b89bd16 100644 --- a/src/text_simulation.cc +++ b/src/text_simulation.cc @@ -45,6 +45,7 @@ #include #include +#include #include #include #include