Commit f9e11802 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

from  Benoît Perrot  <benoit@lrde.epita.fr>
        * src/shell/cmd.hh,
        * src/shell/shell.cc, src/shell/shell.hh:
        Use references instead of pointers for aggregated attributes.
parent bd66c316
2004-04-25 Benot Perrot <benoit@lrde.epita.fr>
* src/shell/cmd.hh,
* src/shell/shell.cc, src/shell/shell.hh:
Use references instead of pointers for aggregated attributes.
2004-04-25 Benot Perrot <benoit@lrde.epita.fr>
Use coprocessor to raise exception.
......
......@@ -2,24 +2,21 @@
(Created-By-Prcs-Version 1 3 2)
(Project-Description "")
(Project-Version mipsy 0 89)
(Parent-Version mipsy 0 88)
(Project-Version mipsy 0 90)
(Parent-Version mipsy 0 89)
(Version-Log
"Index: ChangeLog
from Benot Perrot <benoit@lrde.epita.fr>
Use coprocessor to raise exception.
* src/vm/cp0.hh:
(raise_overflow) Raise an arithmetic overflow exception.
* src/vm/cpu.cc:
Call raise_overflow when an arithmetic overflow occurs.
* src/shell/cmd.hh,
* src/shell/shell.cc, src/shell/shell.hh:
Use references instead of pointers for aggregated attributes.
")
(New-Version-Log
"")
(Checkin-Time "Sun, 25 Apr 2004 18:22:46 +0200")
(Checkin-Time "Sun, 25 Apr 2004 18:43:32 +0200")
(Checkin-Login benoit)
(Files
......@@ -27,7 +24,7 @@ from Beno
;; ./
(AUTHORS (mipsy/0_AUTHORS 1.2 644))
(COPYING (mipsy/1_COPYING 1.1 644))
(ChangeLog (mipsy/2_ChangeLog 1.83 604))
(ChangeLog (mipsy/2_ChangeLog 1.84 604))
(INSTALL (mipsy/b/12_INSTALL 1.1 604))
(Makefile.am (mipsy/3_Makefile.a 1.9 604))
(NEWS (mipsy/b/25_NEWS 1.10 604))
......@@ -102,11 +99,11 @@ from Beno
;; ./src/shell/
(src/shell/Makefile.am (mipsy/b/17_Makefile.a 1.1 644))
(src/shell/cmd.hh (mipsy/b/18_cmd.hh 1.1 644))
(src/shell/cmd.hh (mipsy/b/18_cmd.hh 1.2 644))
(src/shell/shell-tasks.cc (mipsy/b/19_shell-task 1.1 644))
(src/shell/shell-tasks.hh (mipsy/c/22_shell-task 1.2 644))
(src/shell/shell.cc (mipsy/c/23_shell.cc 1.1 644))
(src/shell/shell.hh (mipsy/c/24_shell.hh 1.1 644))
(src/shell/shell.cc (mipsy/c/23_shell.cc 1.2 644))
(src/shell/shell.hh (mipsy/c/24_shell.hh 1.2 644))
;; ./src/task/
(src/task/Makefile.am (mipsy/45_Makefile.a 1.2 644))
......
......@@ -73,7 +73,7 @@ namespace shell
\{ */
public:
/// Construct a Cmd.
Cmd(const cmd_type_type cmd_type, Shell* sh):
Cmd(const cmd_type_type cmd_type, Shell &sh):
cmd_type_(cmd_type),
sh_(sh),
list_args_()
......@@ -167,7 +167,7 @@ namespace shell
parse::tasks::parse();
inst::tasks::prg_solve();
sh_->vm_->load_program(* parse::tasks::program);
sh_.vm_.load_program(* parse::tasks::program);
}
void e_run()
......@@ -178,14 +178,14 @@ namespace shell
return;
}
if (sh_->vm_->get_status() != vm::VirtualMachine::halt)
sh_->vm_->set_runnable();
if (sh_.vm_.get_status() != vm::VirtualMachine::halt)
sh_.vm_.set_runnable();
else
{
sh_->vm_->reset();
sh_->vm_->set_runnable();
sh_.vm_.reset();
sh_.vm_.set_runnable();
}
sh_->vm_->execute(false);
sh_.vm_.execute(false);
}
void e_continue()
......@@ -196,10 +196,10 @@ namespace shell
return;
}
if (sh_->vm_->get_status() != vm::VirtualMachine::halt)
if (sh_.vm_.get_status() != vm::VirtualMachine::halt)
{
sh_->vm_->set_runnable();
sh_->vm_->execute(false);
sh_.vm_.set_runnable();
sh_.vm_.execute(false);
}
else
std::cerr << "The program is not being run." << std::endl;
......@@ -213,10 +213,10 @@ namespace shell
return;
}
if (sh_->vm_->get_status() != vm::VirtualMachine::halt)
if (sh_.vm_.get_status() != vm::VirtualMachine::halt)
{
sh_->vm_->set_run_next();
sh_->vm_->execute(true);
sh_.vm_.set_run_next();
sh_.vm_.execute(true);
}
else
std::cerr << "The program is not being run." << std::endl;
......@@ -232,31 +232,31 @@ namespace shell
const std::string* label = *(list_args_.begin());
//std::cerr <<"#DEBUG: label = " << *label << std::endl;
// sh_->vm_->add_break(*label);
sh_->vm_->add_breakpoint(*label);
// sh_.vm_.add_break(*label);
sh_.vm_.add_breakpoint(*label);
}
void e_display()
{
const std::string* r = *(list_args_.begin());
const std::string* rr = new std::string(*r);
sh_->add_display(rr);
sh_.add_display(rr);
}
void e_undisplay()
{
sh_->remove_display(*(list_args_.begin()));
sh_.remove_display(*(list_args_.begin()));
}
void e_dump()
{
std::cout << *(sh_->vm_) << std::endl;
std::cout << sh_.vm_ << std::endl;
}
void e_print()
{
const std::string* r = *(list_args_.begin());
std::cout << *r << " = " << sh_->get_register(*r) << std::endl;
std::cout << *r << " = " << sh_.get_register(*r) << std::endl;
}
void e_fill_delay_slot()
......@@ -267,7 +267,7 @@ namespace shell
void e_mem()
{
const std::string* addr = *(list_args_.begin());
//std::cout << "addr: " << *addr << " = " << sh_->vm_->get_memory_offset(atoi(addr->c_str())) << std::endl;
//std::cout << "addr: " << *addr << " = " << sh_.vm_.get_memory_offset(atoi(addr->c_str())) << std::endl;
}
void e_error() const
......@@ -311,8 +311,10 @@ namespace shell
private:
/// The command type.
cmd_type_type cmd_type_;
/// Link to shell class.
Shell* sh_;
Shell &sh_;
/// List of arguments.
list_args_type list_args_;
};
......
......@@ -27,10 +27,10 @@ namespace shell
{
Shell::Shell():
vm_(true, false),
cmd_buf_(0),
pos_(0)
{
vm_ = new vm::VirtualMachine(true, false);
map_token_["run"] = RUN;
map_token_["r"] = RUN;
......@@ -94,7 +94,7 @@ namespace shell
Shell::run()
{
char* res = 0;
Cmd* command = new Cmd(Cmd::cmd_null, this);
Cmd* command = new Cmd(Cmd::cmd_null, *this);
Cmd* old_command = command;
bool ndone = true;
......@@ -137,10 +137,10 @@ namespace shell
switch (eat_word())
{
case QUIT:
return new Cmd(Cmd::cmd_quit, this);
return new Cmd(Cmd::cmd_quit, *this);
case RUN:
{
command = new Cmd(Cmd::cmd_run, this);
command = new Cmd(Cmd::cmd_run, *this);
const std::string* tmp = 0;
while ((tmp = get_next_word()) != 0)
command->push_arg(*tmp);
......@@ -148,7 +148,7 @@ namespace shell
}
case BREAK:
{
command = new Cmd(Cmd::cmd_break, this);
command = new Cmd(Cmd::cmd_break, *this);
const std::string* tmp = get_next_word();
if (tmp == 0)
{
......@@ -166,14 +166,14 @@ namespace shell
break;
}
case CONTINUE:
return new Cmd(Cmd::cmd_continue, this);
return new Cmd(Cmd::cmd_continue, *this);
case NEXT:
return new Cmd(Cmd::cmd_next, this);
return new Cmd(Cmd::cmd_next, *this);
case DUMP:
return new Cmd(Cmd::cmd_dump, this);
return new Cmd(Cmd::cmd_dump, *this);
case LOAD:
{
command = new Cmd(Cmd::cmd_load, this);
command = new Cmd(Cmd::cmd_load, *this);
const std::string* tmp = get_next_word();
if (tmp == 0)
{
......@@ -185,7 +185,7 @@ namespace shell
}
case PRINT:
{
command = new Cmd(Cmd::cmd_print, this);
command = new Cmd(Cmd::cmd_print, *this);
const std::string* tmp = get_next_word();
if (tmp == 0)
{
......@@ -204,7 +204,7 @@ namespace shell
}
case DISPLAY:
{
command = new Cmd(Cmd::cmd_display, this);
command = new Cmd(Cmd::cmd_display, *this);
const std::string* tmp = get_next_word();
if (tmp == 0)
{
......@@ -223,7 +223,7 @@ namespace shell
}
case UNDISPLAY:
{
command = new Cmd(Cmd::cmd_undisplay, this);
command = new Cmd(Cmd::cmd_undisplay, *this);
const std::string* tmp = get_next_word();
if (tmp == 0)
{
......@@ -242,7 +242,7 @@ namespace shell
}
case MEM:
{
command = new Cmd(Cmd::cmd_mem, this);
command = new Cmd(Cmd::cmd_mem, *this);
const std::string* tmp = get_next_word();
if (tmp == 0)
{
......@@ -254,15 +254,15 @@ namespace shell
return command;
}
case FILL_DELAY_SLOT:
return new Cmd(Cmd::cmd_fill_delay_slot, this);
return new Cmd(Cmd::cmd_fill_delay_slot, *this);
case HELP:
return new Cmd(Cmd::cmd_help, this);
return new Cmd(Cmd::cmd_help, *this);
case TERROR:
case EOL:
break;
}
return new Cmd(Cmd::cmd_unknown, this);
return new Cmd(Cmd::cmd_unknown, *this);
}
} // namespace shell
......@@ -95,11 +95,9 @@ namespace shell
/// Destroy a Shell.
~Shell()
{
for (list_disp_type::iterator i = list_displayable_.begin();
i != list_displayable_.end();
++i)
for (list_disp_type::iterator
i = list_displayable_.begin(); i != list_displayable_.end(); ++i)
delete *i;
delete vm_;
}
/** \} */
......@@ -115,8 +113,8 @@ namespace shell
int get_register(const std::string& r)
{
if (r == "pc")
return vm_->get_cpu_pc();
return vm_->get_cpu_register(map_register_[r.c_str()]);
return vm_.get_cpu_pc();
return vm_.get_cpu_register(map_register_[r.c_str()]);
}
/** \name Display list
......@@ -218,7 +216,7 @@ namespace shell
private:
/// virtual machine link.
vm::VirtualMachine* vm_;
vm::VirtualMachine vm_;
/// command line link.
const char* cmd_buf_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment