- Pretty-indenting code

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@674 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-06-29 08:44:30 +00:00
parent 7aecc910ba
commit 6b27a8461b
94 changed files with 3073 additions and 3066 deletions

11
config/indenter Executable file
View File

@ -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

View File

@ -33,7 +33,8 @@
#include "config.h"
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
#define SG_CONSTRUCTOR __attribute__ ((constructor))

View File

@ -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);

View File

@ -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
}

View File

@ -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)

View File

@ -27,8 +27,7 @@ using namespace sgpem;
DynamicResource::DynamicResource(StaticResource *core) :
_static_resource(core)
{
}
{}
Glib::ustring
DynamicResource::get_name() const

View File

@ -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

View File

@ -112,8 +112,7 @@ namespace sgpem
void set_state(state s);
void serialize(SerializeVisitor& translator) const
{
}
{}
/** \brief Returns a pointer to the schedulable object
*

View File

@ -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()

View File

@ -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>;

View File

@ -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)
{}

View File

@ -24,8 +24,7 @@ using namespace sgpem;
ObservedSubject::~ObservedSubject()
{
}
{}
/**
Calls update() in each Observer

View File

@ -57,7 +57,8 @@ namespace sgpem
private:
SG_DLLLOCAL Plugin();
}; //~ class Plugin
}
; //~ class Plugin
} //~ namespace sgpem

View File

@ -107,8 +107,7 @@ PoliciesGatekeeper::activate_policy(History *history, Policy* policy)
}
PoliciesGatekeeper::PoliciesGatekeeper()
{
}
{}
void
PoliciesGatekeeper::deactivate_policies(PolicyManager* manager)

View File

@ -24,8 +24,7 @@ using namespace sgpem;
using namespace memory;
Policy::~Policy()
{
}
{}
int
Policy::get_id() const

View File

@ -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;

View File

@ -23,6 +23,5 @@
using namespace sgpem;
Process::~Process()
{
}
{}

View File

@ -23,6 +23,5 @@
using namespace sgpem;
Request::~Request()
{
}
{}

View File

@ -23,6 +23,5 @@
using namespace sgpem;
Resource::~Resource()
{
}
{}

View File

@ -23,6 +23,5 @@
using namespace sgpem;
Schedulable::~Schedulable()
{
}
{}

View File

@ -27,8 +27,7 @@ using namespace std;
using namespace memory;
SchedulableQueue::SchedulableQueue()
{
}
{}
DynamicSchedulable*
SchedulableQueue::top()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -23,6 +23,5 @@
using namespace sgpem;
SubRequest::~SubRequest()
{
}
{}

View File

@ -23,6 +23,5 @@
using namespace sgpem;
Thread::~Thread()
{
}
{}

View File

@ -29,7 +29,8 @@
#include <stdexcept>
namespace sgpem {
namespace sgpem
{
class UserInterruptException;
class SG_DLLEXPORT UserInterruptException : public std::runtime_error

View File

@ -33,7 +33,8 @@
#include "io_manager.hh"
#include "graphical_terminal_io.hh"
namespace sgpem {
namespace sgpem
{
class GraphicalSimulation;

View File

@ -36,7 +36,8 @@
#include <memory>
namespace sgpem {
namespace sgpem
{
// ---------------------------------------------

View File

@ -26,7 +26,8 @@
#include <glibmm/ustring.h>
namespace sgpem {
namespace sgpem
{
class IOManager;

View File

@ -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;

View File

@ -26,7 +26,8 @@
#include <gtkmm/window.h>
namespace sgpem {
namespace sgpem
{
// ---------------------------------------------

View File

@ -23,10 +23,8 @@
using namespace sgpem;
Observer::Observer()
{
}
{}
Observer::~Observer()
{
}
{}

View File

@ -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

View File

@ -29,7 +29,8 @@
#include "io_manager.hh"
namespace sgpem {
namespace sgpem
{
class StandardIO;

View File

@ -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

View File

@ -48,7 +48,8 @@ namespace sgpem
private:
static Instantiated_class* _instance;
static Glib::StaticMutex SG_DLLLOCAL _mutex;
}; //~ class Singleton
}
; //~ class Singleton
} //~ namespace sgpem

View File

@ -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;
};
}

View File

@ -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;

View File

@ -98,7 +98,8 @@ namespace sgpem
int
main(int, char**) {
main(int, char**)
{
using namespace sgpem;
Scheduler::get_instance(); // Forces initialization of scheduler.

View File

@ -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;

View File

@ -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