- Pretty-indenting code
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@674 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
7aecc910ba
commit
6b27a8461b
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
#find . -name "*.cc" -or -name "*.hh" -or -name "*.tcc" | \
|
||||
# xargs indent -v -sc -psl -bls -bad -bap -bbb -nsob \
|
||||
# -bli0 -cli0 -cbi0 -npcs -cs -nsaf -nsai -nsaw \
|
||||
# -nprs -i2 -lp -ppi2 -l80 -nbbo -hnl -ss -di8 -nbc
|
||||
|
||||
|
||||
find . -name "*.cc" -or -name "*.hh" -or -name "*.tcc" | \
|
||||
xargs astyle --style=ansi -s2 -b -N -L -p -O -V \
|
||||
--mode=c
|
|
@ -33,7 +33,8 @@
|
|||
#include "config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define SG_CONSTRUCTOR __attribute__ ((constructor))
|
||||
|
|
|
@ -39,28 +39,33 @@
|
|||
// FIXME: Eeeeh? Why does this work without explicit namespace resolving?
|
||||
// Is there some using declaration in included HEADERS?? Aaaaagh!
|
||||
|
||||
class TestPythonPolicyManager : public PythonPolicyManager {
|
||||
class TestPythonPolicyManager : public PythonPolicyManager
|
||||
{
|
||||
public:
|
||||
void test_init(const char* policy_name) {
|
||||
void test_init(const char* policy_name)
|
||||
{
|
||||
init();
|
||||
_python_policy = new PythonPolicy(policy_name);
|
||||
|
||||
}
|
||||
|
||||
Policy& get_policy() {
|
||||
Policy& get_policy()
|
||||
{
|
||||
return *_python_policy;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
using namespace sgpem;
|
||||
using namespace std;
|
||||
|
||||
int successes = 0;
|
||||
|
||||
if(argc != 2) {
|
||||
if(argc != 2)
|
||||
{
|
||||
std::cout << "[EE] Usage:\n\t" << argv[0] <<
|
||||
" path/to/uninstalled/policies" << std::endl;
|
||||
exit(-1);
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
therein. See "info libtool": "dlopened modules"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
@ -38,12 +39,10 @@ extern "C" {
|
|||
#define SG_DESTRUCTOR __attribute__ ((destructor))
|
||||
|
||||
void SG_DLLEXPORT SG_CONSTRUCTOR hook_ctor(void)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void SG_DLLEXPORT SG_DESTRUCTOR hook_dtor(void)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ using std::vector;
|
|||
|
||||
DynamicProcess::DynamicProcess(StaticProcess* core) :
|
||||
DynamicSchedulable(*core)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
DynamicProcess::DynamicProcess(const DynamicProcess &other) :
|
||||
Schedulable(), DynamicSchedulable(other), Process()
|
||||
|
@ -85,7 +84,8 @@ DynamicProcess::get_state() const
|
|||
|
||||
// TODO Is this OK? Must be tested...
|
||||
|
||||
switch(thread_state) {
|
||||
switch(thread_state)
|
||||
{
|
||||
case state_running: // (a)
|
||||
return state_running;
|
||||
case state_ready: // (b)
|
||||
|
|
|
@ -27,8 +27,7 @@ using namespace sgpem;
|
|||
|
||||
DynamicResource::DynamicResource(StaticResource *core) :
|
||||
_static_resource(core)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Glib::ustring
|
||||
DynamicResource::get_name() const
|
||||
|
|
|
@ -29,8 +29,7 @@ DynamicSchedulable::DynamicSchedulable(StaticSchedulable& obj) :
|
|||
_time_left(obj.get_total_cpu_time()), _ref(&obj), _last_acquisition(-1),
|
||||
_last_release(-1), _priority_push(0), _last(-1),
|
||||
_my_state(state_future)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool
|
||||
DynamicSchedulable::operator==(const DynamicSchedulable& dx) const
|
||||
|
|
|
@ -112,8 +112,7 @@ namespace sgpem
|
|||
void set_state(state s);
|
||||
|
||||
void serialize(SerializeVisitor& translator) const
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/** \brief Returns a pointer to the schedulable object
|
||||
*
|
||||
|
|
|
@ -31,8 +31,7 @@ using std::vector;
|
|||
|
||||
DynamicThread::DynamicThread(StaticThread* core, DynamicProcess* parent) :
|
||||
DynamicSchedulable(*core), _state(state_future), _parent(parent)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
DynamicThread::DynamicThread(const DynamicThread &other) :
|
||||
Schedulable(), DynamicSchedulable(other), Thread()
|
||||
|
|
|
@ -29,13 +29,15 @@
|
|||
// Do not include complete template definition here:
|
||||
#include "singleton.hh"
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
class GlobalPreferences;
|
||||
}
|
||||
|
||||
#include "config.h"
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
class SG_DLLEXPORT GlobalPreferences : public Singleton<GlobalPreferences>
|
||||
{
|
||||
friend class Singleton<GlobalPreferences>;
|
||||
|
|
|
@ -42,7 +42,8 @@ template class SG_DLLEXPORT smart_ptr<DynamicSchedulable>;
|
|||
of the simulation which must begin at instant -1 and live for 1 instant.
|
||||
*/
|
||||
History::History() //private constructor.
|
||||
:_total_time_elapsed(-1)
|
||||
:
|
||||
_total_time_elapsed(-1)
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ using namespace sgpem;
|
|||
|
||||
|
||||
ObservedSubject::~ObservedSubject()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
Calls update() in each Observer
|
||||
|
|
|
@ -57,7 +57,8 @@ namespace sgpem
|
|||
|
||||
private:
|
||||
SG_DLLLOCAL Plugin();
|
||||
}; //~ class Plugin
|
||||
}
|
||||
; //~ class Plugin
|
||||
|
||||
} //~ namespace sgpem
|
||||
|
||||
|
|
|
@ -107,8 +107,7 @@ PoliciesGatekeeper::activate_policy(History *history, Policy* policy)
|
|||
}
|
||||
|
||||
PoliciesGatekeeper::PoliciesGatekeeper()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
PoliciesGatekeeper::deactivate_policies(PolicyManager* manager)
|
||||
|
|
|
@ -24,8 +24,7 @@ using namespace sgpem;
|
|||
using namespace memory;
|
||||
|
||||
Policy::~Policy()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
int
|
||||
Policy::get_id() const
|
||||
|
|
|
@ -33,8 +33,7 @@ namespace sgpem
|
|||
class PolicyParametersException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
PolicyParametersException(char* msg): std::runtime_error(msg) {}
|
||||
};
|
||||
PolicyParametersException(char* msg): std::runtime_error(msg) {}};
|
||||
class PolicyParameters;
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,5 @@
|
|||
using namespace sgpem;
|
||||
|
||||
Process::~Process()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
|
|
@ -23,6 +23,5 @@
|
|||
using namespace sgpem;
|
||||
|
||||
Request::~Request()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
|
|
@ -23,6 +23,5 @@
|
|||
using namespace sgpem;
|
||||
|
||||
Resource::~Resource()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
|
|
@ -23,6 +23,5 @@
|
|||
using namespace sgpem;
|
||||
|
||||
Schedulable::~Schedulable()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ using namespace std;
|
|||
using namespace memory;
|
||||
|
||||
SchedulableQueue::SchedulableQueue()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
DynamicSchedulable*
|
||||
SchedulableQueue::top()
|
||||
|
|
|
@ -25,8 +25,7 @@ using namespace std;
|
|||
|
||||
Slice::Slice(const int& start, const int& duration, const SchedulableQueue& status)
|
||||
: _ref(status), _started_at(start), _duration(duration)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
const SchedulableQueue*
|
||||
Slice::get_simulation_status() const
|
||||
|
|
|
@ -24,12 +24,10 @@ using namespace sgpem;
|
|||
|
||||
StaticProcess::StaticProcess(const Glib::ustring& name, const unsigned int& arrival, const unsigned int& total, const int& priority)
|
||||
: StaticSchedulable(name, arrival, total, priority)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
StaticProcess::~StaticProcess()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Glib::ustring
|
||||
StaticProcess::get_type() const
|
||||
|
|
|
@ -25,8 +25,7 @@ using namespace sgpem;
|
|||
StaticResource::StaticResource(const Glib::ustring& name,
|
||||
unsigned int places) :
|
||||
_name(name), _places(places)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Glib::ustring
|
||||
StaticResource::get_name() const
|
||||
|
|
|
@ -27,12 +27,10 @@ StaticSchedulable::StaticSchedulable(const Glib::ustring& name,
|
|||
const unsigned int& total,
|
||||
const int& priority) :
|
||||
_name(name), _arrival_time(arrival), _total_time(total), _priority(priority)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
StaticSchedulable::~StaticSchedulable()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
unsigned int
|
||||
StaticSchedulable::get_arrival_time() const
|
||||
|
|
|
@ -33,8 +33,7 @@ StaticThread::StaticThread(const Glib::ustring& name,
|
|||
StaticSchedulable(name, arrival_time, 0, base_priority),
|
||||
_start_time_delta(arrival_time), _required_cpu_time(0),
|
||||
_process(&process)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
unsigned int
|
||||
StaticThread::get_total_cpu_time() const
|
||||
|
|
|
@ -23,6 +23,5 @@
|
|||
using namespace sgpem;
|
||||
|
||||
SubRequest::~SubRequest()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
|
|
@ -23,6 +23,5 @@
|
|||
using namespace sgpem;
|
||||
|
||||
Thread::~Thread()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
class UserInterruptException;
|
||||
|
||||
class SG_DLLEXPORT UserInterruptException : public std::runtime_error
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
#include "io_manager.hh"
|
||||
#include "graphical_terminal_io.hh"
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
|
||||
|
||||
class GraphicalSimulation;
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
|
||||
class IOManager;
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ using namespace memory;
|
|||
using Glib::ustring;
|
||||
|
||||
|
||||
static void load_pyloader_plugin() {
|
||||
static void load_pyloader_plugin()
|
||||
{
|
||||
// FIXME: this will need to be moved to an
|
||||
// appropriate PluginManager class in the backend,
|
||||
// and the Makefile fixed accordingly (partly done).
|
||||
|
@ -66,7 +67,8 @@ static void load_pyloader_plugin() {
|
|||
|
||||
GlobalPreferences& prefs = GlobalPreferences::get_instance();
|
||||
GlobalPreferences::dir_iterator it = prefs.modules_dir_begin();
|
||||
while(it != prefs.modules_dir_end()) {
|
||||
while(it != prefs.modules_dir_end())
|
||||
{
|
||||
std::string pyloader_path = Module::build_path(*it, "pyloader");
|
||||
pyloader = new Module(pyloader_path);
|
||||
if(*pyloader) break;
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
#include <gtkmm/window.h>
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
using namespace sgpem;
|
||||
|
||||
Observer::Observer()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Observer::~Observer()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ using namespace memory;
|
|||
using Glib::usleep;
|
||||
|
||||
Simulation::Simulation(): _state(state_paused), _mode(true), _timer_interval(1000)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void
|
||||
Simulation::set_timer(const int& t)
|
||||
|
@ -97,7 +96,8 @@ Simulation::run() throw(UserInterruptException)
|
|||
|
||||
if (_mode)
|
||||
{
|
||||
do {
|
||||
do
|
||||
{
|
||||
// chech for termination
|
||||
bool all_term = true;
|
||||
smart_ptr<SchedulableQueue> left = h.get_simulation_status_at(h.get_current_time());
|
||||
|
@ -135,7 +135,8 @@ Simulation::run() throw(UserInterruptException)
|
|||
if (_state == state_stopped || _state == state_paused)
|
||||
return;
|
||||
|
||||
} while(true);
|
||||
}
|
||||
while(true);
|
||||
}
|
||||
|
||||
//******* STEP by STEP
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
#include "io_manager.hh"
|
||||
|
||||
namespace sgpem {
|
||||
namespace sgpem
|
||||
{
|
||||
|
||||
|
||||
class StandardIO;
|
||||
|
|
|
@ -30,8 +30,7 @@ using namespace sgpem;
|
|||
template<typename T>
|
||||
PolicyParameters::Parameter<T>::Parameter(Glib::ustring name, const T& value, const T& lower_bound, const T& upper_bound, const bool& required, const T& default_value)
|
||||
: _name(name), _value(value), _lower_bound(lower_bound), _upper_bound(upper_bound), _is_required(required), _default(default_value)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
template<typename T>
|
||||
Glib::ustring
|
||||
|
|
|
@ -48,7 +48,8 @@ namespace sgpem
|
|||
private:
|
||||
static Instantiated_class* _instance;
|
||||
static Glib::StaticMutex SG_DLLLOCAL _mutex;
|
||||
}; //~ class Singleton
|
||||
}
|
||||
; //~ class Singleton
|
||||
|
||||
} //~ namespace sgpem
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
#include <new>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace memory {
|
||||
namespace memory
|
||||
{
|
||||
|
||||
/** \brief A simple reference counted smart pointer
|
||||
*
|
||||
|
@ -43,7 +44,8 @@ namespace memory {
|
|||
* from it: its destructor isn't virtual, either.
|
||||
*/
|
||||
template<typename T, bool isArray = false>
|
||||
class smart_ptr {
|
||||
class smart_ptr
|
||||
{
|
||||
|
||||
template<typename T2, bool isArray2>
|
||||
friend class smart_ptr;
|
||||
|
@ -153,10 +155,12 @@ namespace memory {
|
|||
template<typename U>
|
||||
smart_ptr(const smart_ptr<U, isArray>& sptr) throw(std::bad_cast);
|
||||
|
||||
struct contents_type {
|
||||
struct contents_type
|
||||
{
|
||||
T* ptr;
|
||||
unsigned int rc;
|
||||
}* _contents;
|
||||
}
|
||||
* _contents;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
#include "smartp.hh"
|
||||
|
||||
namespace memory {
|
||||
namespace memory
|
||||
{
|
||||
|
||||
template<typename T, bool isArray>
|
||||
const smart_ptr<T, isArray> smart_ptr<T, isArray>::null = 0;
|
||||
|
|
|
@ -98,7 +98,8 @@ namespace sgpem
|
|||
|
||||
|
||||
int
|
||||
main(int, char**) {
|
||||
main(int, char**)
|
||||
{
|
||||
using namespace sgpem;
|
||||
|
||||
Scheduler::get_instance(); // Forces initialization of scheduler.
|
||||
|
|
|
@ -74,12 +74,10 @@ namespace sgpem
|
|||
}
|
||||
|
||||
virtual ~Policy()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
virtual void configure()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
virtual void sort_queue() const throw(UserInterruptException)
|
||||
{ // here a lot of fun, exactly O(n^2) fun!
|
||||
|
@ -150,8 +148,7 @@ namespace sgpem
|
|||
return PRRPolicy.get_instance();
|
||||
}
|
||||
virtual void init()
|
||||
{
|
||||
}
|
||||
{}
|
||||
static PolicyManager& get_registered_manager();
|
||||
|
||||
private:
|
||||
|
@ -217,13 +214,13 @@ namespace sgpem
|
|||
class StepForwardTester
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// from here and further until the bottom, all to throw away I suppose
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
|
||||
using namespace sgpem;
|
||||
using Glib::Module;
|
||||
|
|
|
@ -34,8 +34,7 @@ using Glib::ustring;
|
|||
#include "smartp.tcc"
|
||||
|
||||
TextSimulation::~TextSimulation()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
Adds an IO_device and creates a thread which loops the read-parse-execute process
|
||||
|
|
Loading…
Reference in New Issue