- fixed a number of bugs
- added dummy_policy written in C++ - the interpreter is now finished (hopefully) git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@366 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
ea70e2f092
commit
4482b98df7
17 changed files with 230 additions and 106 deletions
|
@ -95,7 +95,7 @@ check:
|
|||
" depending the mode configured with SetMode (default=continuous)"));
|
||||
return;
|
||||
}
|
||||
obj->_devices[quale]->write_buffer("\n\tRUN!!");
|
||||
obj->run();
|
||||
}
|
||||
else if (arguments[param] == "PAUSE")
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ check:
|
|||
"\n-- PAUSE COMMAND --\nPauses the simulation. The next call to RUN will restart it."));
|
||||
return;
|
||||
}
|
||||
obj->_devices[quale]->write_buffer("\n\tPAUSE!!");
|
||||
obj->pause();
|
||||
}
|
||||
else if (arguments[param] == "STOP")
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ check:
|
|||
"bring the simulation to the FIRST instant and start it."));
|
||||
return;
|
||||
}
|
||||
obj->_devices[quale]->write_buffer("\n\tSTOP!!");
|
||||
obj->stop();
|
||||
}
|
||||
else if (arguments[param] == "RESET")
|
||||
{
|
||||
|
@ -126,8 +126,7 @@ check:
|
|||
"\n-- RESET COMMAND --\nResets the simulation jumping back to the first instant."));
|
||||
return;
|
||||
}
|
||||
obj->_devices[quale]->write_buffer("\n\tRESET!!");
|
||||
|
||||
obj->reset();
|
||||
}
|
||||
else if (arguments[param] == "QUIT")
|
||||
{
|
||||
|
@ -145,7 +144,8 @@ check:
|
|||
if (show_help)
|
||||
{
|
||||
obj->_devices[quale]->write_buffer(_(
|
||||
"\n-- YOU ARE JOKING ME --\nYou're really too dummy!!!\n"));
|
||||
"\n-- Do you really want me to explain what HELP means? --"
|
||||
"\n ************** YOU ARE JOKING ME !!! ************\n\n"));
|
||||
exit(1);
|
||||
}
|
||||
if (arguments.size() == 1)
|
||||
|
@ -293,13 +293,31 @@ check:
|
|||
int_to_string(i_i->second.get_value(), temp);
|
||||
obj->_devices[quale]->write_buffer("\tvalue=" + temp);
|
||||
int_to_string(i_i->second.get_lower_bound(), temp);
|
||||
obj->_devices[quale]->write_buffer(" lower=" + temp);
|
||||
obj->_devices[quale]->write_buffer("\t\tlower=" + temp);
|
||||
int_to_string(i_i->second.get_upper_bound(), temp);
|
||||
obj->_devices[quale]->write_buffer(" upper=" + temp);
|
||||
obj->_devices[quale]->write_buffer("\t\tupper=" + temp);
|
||||
if (i_i->second.is_required())
|
||||
obj->_devices[quale]->write_buffer(" required=true");
|
||||
obj->_devices[quale]->write_buffer("\t\trequired=true");
|
||||
else
|
||||
obj->_devices[quale]->write_buffer(" required=false");
|
||||
obj->_devices[quale]->write_buffer("\t\trequired=false");
|
||||
}
|
||||
|
||||
map<ustring, PolicyParameters::Parameter<float> > map_f = param.get_registered_float_parameters();
|
||||
map<ustring, PolicyParameters::Parameter<float> >::iterator i_f = map_f.begin();
|
||||
|
||||
for(; i_f != map_f.end(); i_f++)
|
||||
{
|
||||
obj->_devices[quale]->write_buffer("\nfloat\t" + i_f->second.get_name());
|
||||
float_to_string(i_f->second.get_value(), temp);
|
||||
obj->_devices[quale]->write_buffer("\tvalue=" + temp);
|
||||
float_to_string(i_f->second.get_lower_bound(), temp);
|
||||
obj->_devices[quale]->write_buffer("\t\tlower=" + temp);
|
||||
float_to_string(i_f->second.get_upper_bound(), temp);
|
||||
obj->_devices[quale]->write_buffer("\t\tupper=" + temp);
|
||||
if (i_f->second.is_required())
|
||||
obj->_devices[quale]->write_buffer("\t\trequired=true");
|
||||
else
|
||||
obj->_devices[quale]->write_buffer("\t\trequired=false");
|
||||
}
|
||||
|
||||
map<ustring, PolicyParameters::Parameter<ustring> > map_s = param.get_registered_string_parameters();
|
||||
|
@ -314,11 +332,13 @@ check:
|
|||
else
|
||||
obj->_devices[quale]->write_buffer(" required=false");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
obj->_devices[quale]->write_buffer("\nCommand not recognized: ");
|
||||
obj->_devices[quale]->write_buffer(_("\nCommand not recognized: "));
|
||||
obj->_devices[quale]->write_buffer(arguments[param]);
|
||||
obj->_devices[quale]->write_buffer(_("\nTyper HELP for a list of avaiable commands."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -327,7 +347,69 @@ check:
|
|||
void
|
||||
TextSimulation::update()
|
||||
{
|
||||
History& h = History::get_instance();
|
||||
int when, pri;
|
||||
ustring temp;
|
||||
|
||||
when = h.get_current_time();
|
||||
smart_ptr<SchedulableList> ll = h.get_simulation_status_at(when);
|
||||
|
||||
int_to_string(when, temp);
|
||||
if (when<10)
|
||||
_devices[0]->write_buffer("\n ");
|
||||
else
|
||||
_devices[0]->write_buffer("\n");
|
||||
_devices[0]->write_buffer(temp + ") [RUNS]");
|
||||
|
||||
//insert the RUNNING ONE
|
||||
smart_ptr<SchedulableStatus> running = h.get_scheduled_at(when);
|
||||
if (running)
|
||||
{
|
||||
pri = running->get_schedulable()->get_priority();
|
||||
int_to_string(pri, temp);
|
||||
_devices[0]->write_buffer(" " + running->get_schedulable()->get_name() + "_(" + temp + ")");
|
||||
}
|
||||
|
||||
_devices[0]->write_buffer(" --[READY]");
|
||||
//insert the READY ones
|
||||
for (uint i = 0; i < ll->size(); i++)
|
||||
if (ll->get_item_at(i)->get_state() == SchedulableStatus::state_ready)
|
||||
{
|
||||
pri = ll->get_item_at(i)->get_schedulable()->get_priority();
|
||||
int_to_string(pri, temp);
|
||||
_devices[0]->write_buffer(" " + ll->get_item_at(i)->get_schedulable()->get_name() + "_(" + temp + ")");
|
||||
}
|
||||
|
||||
_devices[0]->write_buffer(" --[BLOCKED]");
|
||||
//insert the BLOCKED ones
|
||||
for (uint i = 0; i < ll->size(); i++)
|
||||
if (ll->get_item_at(i)->get_state() == SchedulableStatus::state_blocked)
|
||||
{
|
||||
pri = ll->get_item_at(i)->get_schedulable()->get_priority();
|
||||
int_to_string(pri, temp);
|
||||
_devices[0]->write_buffer(" " + ll->get_item_at(i)->get_schedulable()->get_name() + "_(" + temp + ")");
|
||||
}
|
||||
|
||||
_devices[0]->write_buffer(" --[FUTURE]");
|
||||
//insert the FUTURE ones
|
||||
for (uint i = 0; i < ll->size(); i++)
|
||||
if (ll->get_item_at(i)->get_state() == SchedulableStatus::state_future)
|
||||
{
|
||||
pri = ll->get_item_at(i)->get_schedulable()->get_priority();
|
||||
int_to_string(pri, temp);
|
||||
_devices[0]->write_buffer(" " + ll->get_item_at(i)->get_schedulable()->get_name() + "_(" + temp + ")");
|
||||
}
|
||||
|
||||
_devices[0]->write_buffer(" --[TERM]");
|
||||
//insert the TERMINATED ones
|
||||
for (uint i = 0; i < ll->size(); i++)
|
||||
if (ll->get_item_at(i)->get_state() == SchedulableStatus::state_terminated)
|
||||
{
|
||||
pri = ll->get_item_at(i)->get_schedulable()->get_priority();
|
||||
int_to_string(pri, temp);
|
||||
_devices[0]->write_buffer(" " + ll->get_item_at(i)->get_schedulable()->get_name() + "_(" + temp + ")");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -351,4 +433,3 @@ TextSimulation::_io_loop(pair<TextSimulation* , int > pun)
|
|||
pun.first->parse_command(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue