Index: trunk/ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/task/task.hh, src/task/task.cc:
Split in...
* src/task/function_task.hh, src/task/function_task.cc,
* src/task/libtask.hh:
These new files.
* src/task/Makefile.am:
Distribute new files.
* src/task/task-tasks.hh, src/shell/shell-tasks.hh,
* src/parse/parse-tasks.hh, src/nolimips-tasks.hh,
* src/inst/inst-tasks.hh, src/vm/vm-tasks.hh:
Include libtask.hh instead of task/task.hh
Test invalid access to memory.
Index: trunk/src/task/task.hh
--- trunk/src/task/task.hh (revision 120)
+++ trunk/src/task/task.hh (revision 121)
@@ -72,44 +72,6 @@
deps_type dependencies_;
};
-
- class FunctionTask : public Task
- {
- public:
- FunctionTask (void (*execute) (void),
- const std::string& option, const std::string& module_name,
- const std::string& desc, const std::string& deps = ""):
- Task (option, module_name, desc, deps),
- execute_ (execute)
- {
- }
-
- public:
- virtual void execute() const;
-
- private:
- void (*execute_) (void);
- };
-
-
-#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)
-#else // !NOLIMIPS_CC_
-
-# define TASK_MODULE(Name)
-# define TASK_DECLARE(Name, Help, Routine, Dependencies) \
- extern void (Routine) (void)
-
-#endif // NOLIMIPS_CC_
-
} // namespace task
#endif // !TASK_TASK_HH
-
Index: trunk/src/task/task-tasks.hh
--- trunk/src/task/task-tasks.hh (revision 120)
+++ trunk/src/task/task-tasks.hh (revision 121)
@@ -19,7 +19,7 @@
#ifndef TASK_TASK_TASKS_HH
# define TASK_TASK_TASKS_HH
-# include "task/task.hh"
+# include "task/libtask.hh"
namespace task
{
Index: trunk/src/task/function_task.hh
--- trunk/src/task/function_task.hh (revision 0)
+++ trunk/src/task/function_task.hh (revision 121)
@@ -0,0 +1,44 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 2004 Akim Demaille <akim(a)epita.fr> and
+// Benoit Perrot <benoit(a)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_FUNCTION_TASK_HH
+# define TASK_FUNCTION_TASK_HH
+
+#include "task/task.hh"
+
+namespace task
+{
+
+ class FunctionTask: public Task
+ {
+ public:
+ FunctionTask(void (*execute) (void),
+ const std::string& option, const std::string& module_name,
+ const std::string& desc, const std::string& deps = "");
+
+ public:
+ virtual void execute() const;
+
+ private:
+ void (*execute_) (void);
+ };
+
+} // namespace task
+
+#endif // !TASK_FUNCTION_TASK_HH
Index: trunk/src/task/task.cc
--- trunk/src/task/task.cc (revision 120)
+++ trunk/src/task/task.cc (revision 121)
@@ -71,11 +71,4 @@
// std::cout << "\t" << *i << std::endl;
// }
-
- void
- FunctionTask::execute() const
- {
- execute_();
- }
-
} // namespace task
Index: trunk/src/task/libtask.hh
--- trunk/src/task/libtask.hh (revision 0)
+++ trunk/src/task/libtask.hh (revision 121)
@@ -0,0 +1,43 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 2004 Akim Demaille <akim(a)epita.fr> and
+// Benoit Perrot <benoit(a)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_LIBTASK_HH
+# define TASK_LIBTASK_HH
+
+# include "task/function_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)
+# else // !NOLIMIPS_CC_
+
+# define TASK_MODULE(Name)
+# define TASK_DECLARE(Name, Help, Routine, Dependencies) \
+ extern void (Routine) (void)
+
+# endif // NOLIMIPS_CC_
+
+#endif // !TASK_LIBTASK_HH
Index: trunk/src/task/Makefile.am
--- trunk/src/task/Makefile.am (revision 120)
+++ trunk/src/task/Makefile.am (revision 121)
@@ -3,5 +3,7 @@
noinst_LIBRARIES = libtask.a
libtask_a_SOURCES = \
task.hh task.cc \
+ function_task.hh function_task.cc \
task_register.hh task_register.cc \
+ libtask.hh \
task-tasks.hh task-tasks.cc
Index: trunk/src/task/function_task.cc
--- trunk/src/task/function_task.cc (revision 0)
+++ trunk/src/task/function_task.cc (revision 121)
@@ -0,0 +1,41 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 2004 Akim Demaille <akim(a)epita.fr> and
+// Benoit Perrot <benoit(a)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/function_task.hh"
+
+namespace task
+{
+
+ FunctionTask::FunctionTask(void (*execute) (void),
+ const std::string& option,
+ const std::string& module_name,
+ const std::string& desc,
+ const std::string& deps):
+ Task(option, module_name, desc, deps),
+ execute_(execute)
+ {}
+
+ void
+ FunctionTask::execute() const
+ {
+ execute_();
+ }
+
+} // namespace task
Index: trunk/src/vm/vm-tasks.hh
--- trunk/src/vm/vm-tasks.hh (revision 120)
+++ trunk/src/vm/vm-tasks.hh (revision 121)
@@ -19,7 +19,7 @@
#ifndef VM_VM_TASKS_HH
# define VM_VM_TASKS_HH
-# include "task/task.hh"
+# include "task/libtask.hh"
namespace vm
{
Index: trunk/src/shell/shell-tasks.hh
--- trunk/src/shell/shell-tasks.hh (revision 120)
+++ trunk/src/shell/shell-tasks.hh (revision 121)
@@ -19,7 +19,7 @@
#ifndef SHELL_SHELL_TASKS_HH
# define SHELL_SHELL_TASKS_HH
-# include "task/task.hh"
+# include "task/libtask.hh"
namespace shell
{
Index: trunk/src/parse/parse-tasks.hh
--- trunk/src/parse/parse-tasks.hh (revision 120)
+++ trunk/src/parse/parse-tasks.hh (revision 121)
@@ -19,7 +19,7 @@
#ifndef PARSE_PARSE_TASKS_HH
# define PARSE_PARSE_TASKS_HH
-# include "task/task.hh"
+# include "task/libtask.hh"
namespace inst { class Program; }
Index: trunk/src/nolimips-tasks.hh
--- trunk/src/nolimips-tasks.hh (revision 120)
+++ trunk/src/nolimips-tasks.hh (revision 121)
@@ -19,7 +19,7 @@
#ifndef NOLIMIPS_TASKS_HH
# define NOLIMIPS_TASKS_HH
-# include "task/task.hh"
+# include "task/libtask.hh"
namespace nolimips
{
Index: trunk/src/inst/inst-tasks.hh
--- trunk/src/inst/inst-tasks.hh (revision 120)
+++ trunk/src/inst/inst-tasks.hh (revision 121)
@@ -19,7 +19,7 @@
#ifndef INST_INST_TASKS_HH
# define INST_INST_TASKS_HH
-# include "task/task.hh"
+# include "task/libtask.hh"
namespace inst
{