Commit 287fa5dd authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

from  Benoît Perrot  <benoit@lrde.epita.fr>

	Factor boolean tasks.
	
	* src/task/boolean_task.hh, src/task/boolean_task.cc:
	* src/task/Makefile.am:
	Distribute new files.
	* src/vm/vm-tasks.hh, src/vm/vm-tasks.cc,
	* src/task/libtask.hh:
	Use boolean tasks.
parent 33139f44
2004-09-18 Benot Perrot <benoit@lrde.epita.fr>
Factor boolean tasks.
* src/task/boolean_task.hh, src/task/boolean_task.cc:
* src/task/Makefile.am:
Distribute new files.
* src/vm/vm-tasks.hh, src/vm/vm-tasks.cc,
* src/task/libtask.hh:
Use boolean tasks.
2004-09-18 Benot Perrot <benoit@lrde.epita.fr>
* src/task/task.hh, src/task/task.cc:
......
......@@ -4,6 +4,7 @@ noinst_LIBRARIES = libtask.a
libtask_a_SOURCES = \
task.hh task.cc \
function_task.hh function_task.cc \
boolean_task.hh boolean_task.cc \
task_register.hh task_register.cc \
libtask.hh \
task-tasks.hh task-tasks.cc
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2004 Akim Demaille <akim@epita.fr> and
// Benoit Perrot <benoit@lrde.epita.fr>
//
// Nolimips is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#include "task/boolean_task.hh"
namespace task
{
BooleanTask::BooleanTask(bool &flag,
const std::string& option,
const std::string& module_name,
const std::string& desc,
const std::string& deps):
Task(option, module_name, desc, deps),
flag_(flag)
{}
void
BooleanTask::execute (void) const
{
flag_ = true;
}
} //namespace task
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2004 Akim Demaille <akim@epita.fr> and
// Benoit Perrot <benoit@lrde.epita.fr>
//
// Nolimips is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#ifndef TASK_BOOLEAN_TASK_HH
# define TASK_BOOLEAN_TASK_HH
#include "task/task.hh"
namespace task
{
class BooleanTask: public Task
{
public:
BooleanTask(bool &flag,
const std::string& option, const std::string& module_name,
const std::string& desc, const std::string& deps = "");
public:
virtual void execute() const;
private:
mutable bool &flag_;
};
} // namespace task
#endif // !TASK_BOOLEAN_TASK_HH
......@@ -22,21 +22,32 @@
# define TASK_LIBTASK_HH
# include "task/function_task.hh"
# include "task/boolean_task.hh"
# ifdef NOLIMIPS_CC_
# define TASK_MODULE(Name) \
const char module_name [] = Name;
# define TASK_DECLARE(Option, Desc, Routine, Deps) \
extern void (Routine) (void); \
task::FunctionTask task_##Routine (Routine, \
Option, module_name, \
Desc, Deps)
# define TASK_DECLARE(Option, Desc, Routine, Deps) \
extern void (Routine) (void); \
static task::FunctionTask task_##Routine (Routine, \
Option, module_name, \
Desc, Deps)
# define BOOLEAN_TASK_DECLARE(Option, Desc, Flag, Deps) \
bool Flag; \
static task::BooleanTask task_##Flag(Flag, \
Option, module_name, \
Desc, Deps)
# else // !NOLIMIPS_CC_
# define TASK_MODULE(Name)
# define TASK_DECLARE(Name, Help, Routine, Dependencies) \
extern void (Routine) (void)
# define BOOLEAN_TASK_DECLARE(Name, Help, Flag, Dependencies)\
extern bool Flag
# endif // NOLIMIPS_CC_
......
......@@ -29,20 +29,6 @@ namespace vm
namespace tasks
{
static bool check_callee_save_p = false;
void
check_callee_save ()
{
check_callee_save_p = true;
}
static bool trace_exec_p = false;
void
trace_exec ()
{
trace_exec_p = true;
}
void
execute ()
{
......
......@@ -29,13 +29,13 @@ namespace vm
TASK_MODULE ("3. Virtual Machine");
TASK_DECLARE ("check-callee-save",
"Warn if a callee save register "
"is not preserved across a call",
check_callee_save, "");
BOOLEAN_TASK_DECLARE ("check-callee-save",
"Warn if a callee save register "
"is not preserved across a call",
check_callee_save_p, "");
TASK_DECLARE ("E|trace-exec", "Trace the execution",
trace_exec, "");
BOOLEAN_TASK_DECLARE ("E|trace-exec", "Trace the execution",
trace_exec_p, "");
TASK_DECLARE ("e|execute", "Execute the program on virtual machine",
execute, "prg-solve");
......
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