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
{
Index: ChangeLog
from Akim Demaille <akim(a)epita.fr>
* prcs2svn/prcs2svn.py (Main.parse_opt): Handle --no-check.
(Informations.check_conversion): New.
(repository_cmp): Use it.
Use the svn project descriptor as argument instead of passing
parts of it.
(Prcs2svn.convert_project): Adjust.
Index: prcs2svn/prcs2svn.py
--- prcs2svn/prcs2svn.py (revision 111)
+++ prcs2svn/prcs2svn.py (working copy)
@@ -240,6 +240,9 @@
# Delete files after a merge
keep_deleted_files = False
+ # Check the consistence bw PRCS and Subversion
+ check_conversion = True
+
# Translate Populate-Ignores
translate_ignores = True
@@ -471,10 +474,11 @@
# Main to compare two repositories.
-def repository_cmp (prcs_project, svn_project, svn_repo, prcs_revision="",
- svn_revision=""):
- repo_cmp = repositoryCmp (prcs_project, svn_project)
- repo_cmp.doit (svn_repo, prcs_revision, svn_revision)
+def repository_cmp (prcs_project, svn, prcs_revision="", svn_revision=""):
+ if infos.check_conversion:
+ debug (" > Check working copy coherency")
+ repo_cmp = repositoryCmp (prcs_project, svn.name)
+ repo_cmp.doit (svn.repository, prcs_revision, svn_revision)
# Don't rely on the dtor, since it is non deterministically called!
xrm (repo_cmp.tmp)
@@ -901,15 +905,12 @@
prcsProject.create_date)
for prcs_version in prcs_versions:
self.convert_project_of_revision(prcsProject, prcs_version)
- debug(" > Check working copy coherency")
- repository_cmp(prcsProject.name, self.svn.name,
- self.svn.repository,
+ repository_cmp (prcsProject.name, self.svn,
prcsProject.prj.version.name(),
str(self.svn.revision))
- repository_cmp(prcsProject.name, self.svn.name, self.svn.repository)
+ repository_cmp (prcsProject.name, self.svn)
self.prcs_to_svn_list.append(self.prcs_to_svn)
-
# Ask user to convert a revision.
def ask_revision_proceed(self):
if not infos.force:
@@ -1230,6 +1231,8 @@
infos.keep_deleted_files = True
elif o == "--svn-root":
infos.svn_root = a
+ elif o == "--no-check":
+ infos.check_conversion = False
elif o == "--no-ignores":
infos.translate_ignores = False
elif o == "--no-rekey":
@@ -1259,6 +1262,7 @@
print " [--copy-prcs]"
print " [--copy-svn]"
print " [--keep-deleted-files]"
+ print " [--no-check]"
print " [--no-ignores]"
print " [--no-rekey]"
print " [--preserve-dates]"
@@ -1292,11 +1296,16 @@
--copy-svn copy svn repository of a project and extend this copy
(need a svn root beginning with 'file' and not 'http').
--keep-deleted-files preserve deleted files after a merge operation
+
+Development Options:
+ --no-check do not check that PRCS and Subversion trees are equal
--no-ignores do not translate PRCS Populate-IGnore into Subversion
- svn:ignore property.
- This is useful to speed up tests.
- --no-rekey do not translate PRCS keywords into Subversion keywords.
- This is useful to speed up tests.
+ svn:ignore property
+ --no-rekey do not translate PRCS keywords into Subversion keywords
+
+These options are useful to speed up tests. Do not use them to perform
+real conversion.
+
Subversion destination repository and project:
--svn-root=URL set subversion repository root to URL
Index: ChangeLog
from Akim Demaille <akim(a)epita.fr>
* prcs2svn/prcs2svn.py
Introduce --no-rekey, and spare useless keyword translations.
* prcs2svn/prcs2svn.py (Informations.translate_keywords): New.
(Main.parse_opt): Handle --no-rekey.
(Svn.change_keywords): Rename as...
(Svn.change_keywords_): this.
(Svn.change_keywords): New wrapper, taking
Informations.translate_keywords into account.
(Svn.changes_commit): Do not call change_keywords here, since some
commit do not need keyword translation.
(Prcs2svn.synchronize): Do it here, when the files are actually
coming from PRCS.
Index: prcs2svn/prcs2svn.py
--- prcs2svn/prcs2svn.py (revision 107)
+++ prcs2svn/prcs2svn.py (working copy)
@@ -233,6 +233,9 @@
# Delete files after a merge
keep_deleted_files = False
+ # Translate the $Id$ etc. keywords.
+ translate_keywords = True
+
infos = Informations()
# Keywords.
@@ -540,14 +543,14 @@
prcs_to_svn_keywords[keyword] + " " + f)
return line
- def change_keywords (self, path):
+ def change_keywords_ (self, path):
"Rewrite each file replacing PRCS keywords with Subversion's."
pwd = os.getcwd ()
xchdir (path)
for f in glob.glob ("*"):
st = os.stat (f)
if stat.S_ISDIR (st.st_mode):
- self.change_keywords (f)
+ self.change_keywords_ (f)
else:
fout, rekeyed = TempDir().mkfile ("%s.re-keyed" % f)
fin = open (f, "r")
@@ -560,6 +563,12 @@
xmove (rekeyed, f)
xchdir (pwd)
+ def change_keywords (self):
+ "Rewrite each file replacing PRCS keywords with Subversion's."
+ if infos.translate_keywords:
+ info("> Translating keywords")
+ self.change_keywords_ (self.workdir)
+
def env_to_preserve_dates (self):
"Return the environment assignment needed to preserve checkin dates."
res = ""
@@ -585,7 +594,6 @@
# Write version log in a temporary file.
# Do commit.
# FIXME: `encoding' must be a command line option.
- self.change_keywords(self.workdir)
env = self.env_to_preserve_dates ()
msg = xcat (env + "svn commit --encoding latin1 " + \
"--username " + quote (checkin_login) + \
@@ -1017,8 +1025,12 @@
prcsProject.prj.version_log,
prcsProject.prj.checkin_time)
self.ignore_set(prcsProject.name)
+ # FIXME: Brute force keyword translation: using a list of files
+ # would be more intelligent.
+ self.svn.change_keywords ()
self.svn.changes_commit(prcsProject.prj.checkin_login,
- prcsProject.prj.version_log, prcsProject.prj.checkin_time)
+ prcsProject.prj.version_log,
+ prcsProject.prj.checkin_time)
# Convert a revision of a project.
def convert_project_of_revision(self, prcsProject, prcs_version):
@@ -1174,7 +1186,8 @@
"preserve-date", "copy-prcs",
"svn-root=", "copy-svn",
"svn-project=", "subdir=",
- "keep-deleted-files"])
+ "keep-deleted-files",
+ "no-rekey"])
except getopt.GetoptError, error_msg:
raise ScanOpt(str(error_msg))
@@ -1184,31 +1197,33 @@
sys.exit(0)
if o == "--usage":
self.usage(); sys.exit(0)
- if o in ("-V", "--version"):
+ elif o in ("-V", "--version"):
self.version()
sys.exit(0)
- if o in ("-t", "--trace"):
+ elif o in ("-t", "--trace"):
if not a in trace_levels:
self.usage()
raise ParseOpt()
infos.trace_level = trace_levels[a]
if o in ("-f", "--force"):
infos.force = True
- if o in ("-p", "--preserve-date"):
+ elif o in ("-p", "--preserve-date"):
infos.preserve_dates = True
- if o in ("-n", "--no-action"):
+ elif o in ("-n", "--no-action"):
infos.action = False
- if o in ("-c", "--copy-prcs"):
+ elif o in ("-c", "--copy-prcs"):
infos.copy_prcs = True
- if o == "--copy-svn":
+ elif o == "--copy-svn":
infos.copy_svn = True
- if o == "--keep-deleted-files":
+ elif o == "--keep-deleted-files":
infos.keep_deleted_files = True
- if o == "--svn-root":
+ elif o == "--svn-root":
infos.svn_root = a
- if o == "--svn-project":
+ elif o == "--no-rekey":
+ infos.translate_keywords = False
+ elif o == "--svn-project":
infos.svn_project = a
- if o == "--subdir":
+ elif o == "--subdir":
infos.subdir = a
if len(args) < 1:
@@ -1235,6 +1250,7 @@
print " [--svn-root=URL]"
print " [--svn-project=NAME]"
print " [--subdir=PATH]"
+ print " [--no-rekey]"
print " <project prcs> ..."
def version(self):
@@ -1262,6 +1278,8 @@
--copy-svn copy svn repository of a project and extend this copy
(need a svn root beginning with 'file' and not 'http').
--keep-deleted-files preserve deleted files after a merge operation
+ --no-rekey do not translate PRCS keywords into Subversion keywords.
+ This is useful to speed up tests.
Subversion destination repository and project:
--svn-root=URL set subversion repository root to URL