- Give code a round of indentation. Thank astyle, not me.
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@837 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
aaf8e068d3
commit
d3c7b46853
108 changed files with 3196 additions and 3180 deletions
|
@ -48,9 +48,9 @@ parse_options(int argc, char** argv)
|
|||
using Glib::OptionGroup;
|
||||
|
||||
print_license();
|
||||
|
||||
|
||||
// Prepare the option entries
|
||||
|
||||
|
||||
OptionEntry no_gui;
|
||||
OptionEntry policies_dir;
|
||||
OptionEntry modules_dir;
|
||||
|
@ -63,99 +63,99 @@ parse_options(int argc, char** argv)
|
|||
no_gui.set_long_name("no-gui");
|
||||
policies_dir.set_long_name("policies-dir");
|
||||
modules_dir.set_long_name("modules_dir");
|
||||
filename.set_long_name(G_OPTION_REMAINING);
|
||||
filename.set_long_name(G_OPTION_REMAINING);
|
||||
|
||||
no_gui.set_description(_("starts the program in command line mode"));
|
||||
policies_dir.set_description(_("adds this directory to the default modules search path"));
|
||||
modules_dir.set_description(_("adds this directory to default plugin search path"));
|
||||
filename.set_description(_("a list of savefiles; only the first will be opened"));
|
||||
|
||||
modules_dir.set_description(_("adds this directory to default plugin search path"));
|
||||
filename.set_description(_("a list of savefiles; only the first will be opened"));
|
||||
|
||||
// Places where araguments will be saved
|
||||
bool no_gui_enabled = false;
|
||||
OptionGroup::vecustrings policies_dir_val;
|
||||
OptionGroup::vecustrings modules_dir_val;
|
||||
OptionGroup::vecstrings fnames;
|
||||
OptionGroup::vecstrings fnames;
|
||||
|
||||
no_gui.set_flags(OptionEntry::FLAG_NO_ARG);
|
||||
filename.set_flags(OptionEntry::FLAG_FILENAME | OptionEntry::FLAG_OPTIONAL_ARG);
|
||||
no_gui.set_flags(OptionEntry::FLAG_NO_ARG);
|
||||
filename.set_flags(OptionEntry::FLAG_FILENAME | OptionEntry::FLAG_OPTIONAL_ARG);
|
||||
|
||||
// Create the only group
|
||||
OptionGroup group("options", "options");
|
||||
OptionGroup group("options", "options");
|
||||
|
||||
group.add_entry(no_gui, no_gui_enabled);
|
||||
group.add_entry(policies_dir, policies_dir_val);
|
||||
group.add_entry(modules_dir, modules_dir_val);
|
||||
group.add_entry_filename(filename, fnames);
|
||||
group.add_entry_filename(filename, fnames);
|
||||
|
||||
// Create context
|
||||
// Create context
|
||||
OptionContext context(_("SGPEMv2, a graphical simulator for process "
|
||||
"scheduling in a multitasking computer"));
|
||||
"scheduling in a multitasking computer"));
|
||||
|
||||
context.set_main_group(group);
|
||||
context.set_help_enabled(true);
|
||||
context.set_ignore_unknown_options(false);
|
||||
|
||||
try
|
||||
{
|
||||
// Parse options, initialising the Gtk::Main at the same time
|
||||
Gtk::Main main_loop(argc, argv, context);
|
||||
|
||||
GlobalPreferences& prefs = GlobalPreferences::get_instance();
|
||||
|
||||
for(Glib::OptionGroup::vecustrings::const_iterator it = policies_dir_val.begin();
|
||||
it != policies_dir_val.end(); ++it)
|
||||
prefs.add_policies_dir(*it);
|
||||
|
||||
for(Glib::OptionGroup::vecustrings::const_iterator it = modules_dir_val.begin();
|
||||
it != modules_dir_val.end(); ++it)
|
||||
prefs.add_modules_dir(*it);
|
||||
|
||||
|
||||
// Now that GlobalPreferences has been initialized properly,
|
||||
// initialize plugins, too
|
||||
vector<Module*> modules = PluginManager::get_instance().get_module_list();
|
||||
{
|
||||
// Parse options, initialising the Gtk::Main at the same time
|
||||
Gtk::Main main_loop(argc, argv, context);
|
||||
|
||||
for(vector<Module*>::iterator it = modules.begin(); it != modules.end(); ++it)
|
||||
(*it)->set_enabled(true);
|
||||
GlobalPreferences& prefs = GlobalPreferences::get_instance();
|
||||
|
||||
vector<CPUPolicyManager*> managers = CPUPoliciesGatekeeper::get_instance().get_registered();
|
||||
for (Glib::OptionGroup::vecustrings::const_iterator it = policies_dir_val.begin();
|
||||
it != policies_dir_val.end(); ++it)
|
||||
prefs.add_policies_dir(*it);
|
||||
|
||||
for(vector<CPUPolicyManager*>::iterator it = managers.begin(); it != managers.end(); ++it)
|
||||
(*it)->init();
|
||||
|
||||
|
||||
if(no_gui_enabled)
|
||||
{
|
||||
// We don't return to main, instead we
|
||||
// initialize the command line version
|
||||
// of sgpemv2
|
||||
TextSimulation sim;
|
||||
std::string str;
|
||||
for (Glib::OptionGroup::vecustrings::const_iterator it = modules_dir_val.begin();
|
||||
it != modules_dir_val.end(); ++it)
|
||||
prefs.add_modules_dir(*it);
|
||||
|
||||
std::cout << std::endl << "% ";
|
||||
while(getline(std::cin, str))
|
||||
{
|
||||
// Enter main loop
|
||||
TextSimulation::parse_command(sim, str);
|
||||
std::cout << std::endl << "% ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiBuilder* gui = new GuiBuilder();
|
||||
if(fnames.begin() != fnames.end())
|
||||
gui->open_file(*fnames.begin());
|
||||
main_loop.run(gui->get_initial_window());
|
||||
delete gui;
|
||||
}
|
||||
|
||||
} // ~ try
|
||||
catch(Glib::OptionError e)
|
||||
{
|
||||
std::cout << _("Bad invocation: ") << e.what() << std::endl;
|
||||
std::cout << _("Use the `-?' or `--help' option to see the help") << std::endl;
|
||||
}
|
||||
}
|
||||
// Now that GlobalPreferences has been initialized properly,
|
||||
// initialize plugins, too
|
||||
vector<Module*> modules = PluginManager::get_instance().get_module_list();
|
||||
|
||||
for (vector<Module*>::iterator it = modules.begin(); it != modules.end(); ++it)
|
||||
(*it)->set_enabled(true);
|
||||
|
||||
vector<CPUPolicyManager*> managers = CPUPoliciesGatekeeper::get_instance().get_registered();
|
||||
|
||||
for (vector<CPUPolicyManager*>::iterator it = managers.begin(); it != managers.end(); ++it)
|
||||
(*it)->init();
|
||||
|
||||
|
||||
if (no_gui_enabled)
|
||||
{
|
||||
// We don't return to main, instead we
|
||||
// initialize the command line version
|
||||
// of sgpemv2
|
||||
TextSimulation sim;
|
||||
std::string str;
|
||||
|
||||
std::cout << std::endl << "% ";
|
||||
while (getline(std::cin, str))
|
||||
{
|
||||
// Enter main loop
|
||||
TextSimulation::parse_command(sim, str);
|
||||
std::cout << std::endl << "% ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiBuilder* gui = new GuiBuilder();
|
||||
if (fnames.begin() != fnames.end())
|
||||
gui->open_file(*fnames.begin());
|
||||
main_loop.run(gui->get_initial_window());
|
||||
delete gui;
|
||||
}
|
||||
|
||||
} // ~ try
|
||||
catch (Glib::OptionError e)
|
||||
{
|
||||
std::cout << _("Bad invocation: ") << e.what() << std::endl;
|
||||
std::cout << _("Use the `-?' or `--help' option to see the help") << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue