Nicolas Desprès <nicolas.despres(a)gmail.com> disait le 10/24/05 :
> On 10/24/05, olivier <olivier.gournet(a)lrde.epita.fr> wrote:
>> Yop,
>>
>> J'ai un warning bizarre avec vcs depuis aujourd'hui, qui se repete
>> assez souvent:
>>
>> /usr/lib/ruby/gems/1.8/gems/ruby_ex-0.3.0/lib/commands/runners/exec.rb:16:
>> warning: Insecure world writable dir /work, mode 041777
>>
>
> Peut-être devrais-tu adopter la même politique de droit que /tmp.
?
C'est la meme, et c'est fait pour !
Yop,
J'ai un warning bizarre avec vcs depuis aujourd'hui, qui se repete
assez souvent:
/usr/lib/ruby/gems/1.8/gems/ruby_ex-0.3.0/lib/commands/runners/exec.rb:16:
warning: Insecure world writable dir /work, mode 041777
Oui, ben oui, /work est en 1777, c'est pas nouveau et c'est tant
mieux.
ChangeLog | 13 ++++++++++++
NEWS | 6 +++++
src/task/Makefile.am | 1
src/task/libtask.hh | 11 +++++++++-
src/task/string_task.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++
src/task/string_task.hh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
src/vm-tasks.cc | 36 ++++++++++++++++++++++++++++++++--
src/vm-tasks.hh | 11 +++++++++-
8 files changed, 171 insertions(+), 4 deletions(-)
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Provide --system-library option.
* src/task/string_task.hh, src/task/string_task.cc:
New.
* src/task/libtask.hh, src/task/Makefile.am:
Distribute them.
* src/vm-tasks.hh, src/vm-tasks.hh:
(select_system_library): Implement builtin system library
selection.
* NEWS: Update.
Index: src/vm-tasks.cc
--- src/vm-tasks.cc (révision 198)
+++ src/vm-tasks.cc (révision 199)
@@ -21,6 +21,7 @@
#include "inst/program.hh"
#include "vm/spim_system_library.hh"
+#include "vm/nolimips_system_library.hh"
#include "vm/virtual_machine.hh"
#include "parse-tasks.hh"
@@ -33,14 +34,45 @@
namespace tasks
{
+ // Default system library
+ static vm::SystemLibrary *system_library =
+ new vm::SpimSystemLibrary(std::cin, std::cout);
+
+ void
+ select_system_library(const std::string &library_name)
+ {
+ if (library_name == "nolimips")
+ {
+ delete system_library;
+ system_library = new vm::NolimipsSystemLibrary(std::cin,
+ std::cout, std::cerr);
+ }
+ else if (library_name == "spim")
+ {
+// delete system_library;
+// system_library = new vm::SpimSystemLibrary(std::cin, std::cout);
+ }
+ else if (library_name == "none")
+ {
+ delete system_library;
+ system_library = 0;
+ }
+ else
+ {
+ std::cerr << program_name
+ << ": `" << library_name << "': no such system library"
+ << std::endl;
+ exit_set (exit_failure);
+ }
+ }
+
void
execute ()
{
- vm::SpimSystemLibrary l(std::cin, std::cout);
vm::VirtualMachine vm;
vm.get_cpu().set_check_callee_save(check_callee_save_p);
vm.get_cpu().set_trace(trace_exec_p);
- vm.set_system_library(&l);
+ vm.set_system_library(system_library);
vm.load_program(* parse::tasks::program);
if (exit_status != exit_success)
exit(exit_status);
Index: src/task/string_task.hh
--- src/task/string_task.hh (révision 0)
+++ src/task/string_task.hh (révision 199)
@@ -0,0 +1,50 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 2005 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_STRING_TASK_HH
+# define TASK_STRING_TASK_HH
+
+# include <string>
+
+# include "task/task.hh"
+
+namespace task
+{
+
+ class StringTask: public Task
+ {
+ public:
+ StringTask(void (*execute) (const std::string &),
+ const std::string &option, const std::string &module_name,
+ const std::string &desc, const std::string &deps = "");
+
+ public:
+ virtual bool set_value(const std::string &value) const;
+
+ virtual void execute() const;
+
+ private:
+ void (*execute_) (const std::string &);
+
+ mutable std::string s_;
+ };
+
+} // namespace task
+
+#endif // !TASK_STRING_TASK_HH
Index: src/task/libtask.hh
--- src/task/libtask.hh (révision 198)
+++ src/task/libtask.hh (révision 199)
@@ -1,6 +1,6 @@
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
-// Copyright (C) 2004 Akim Demaille <akim(a)epita.fr> and
+// Copyright (C) 2004, 2005 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
@@ -24,6 +24,7 @@
# include "task/function_task.hh"
# include "task/boolean_task.hh"
# include "task/int_task.hh"
+# include "task/string_task.hh"
# ifdef NOLIMIPS_CC_
@@ -48,6 +49,12 @@
Option, module_name, \
Desc, Deps)
+# define STRING_TASK_DECLARE(Option, Desc, Routine, Default, Deps) \
+ extern void (Routine) (const std::string &); \
+ static task::StringTask task_##Routine(Routine, \
+ Option, module_name, \
+ Desc, Deps)
+
# else // !NOLIMIPS_CC_
@@ -58,6 +65,8 @@
extern bool Flag
# define INT_TASK_DECLARE(Option, Desc, Var, Default, Min, Max, Deps) \
extern int Var
+# define STRING_TASK_DECLARE(Option, Desc, Routine, Default, Deps) \
+ extern void (Routine) (const std::string &)
# endif // NOLIMIPS_CC_
Index: src/task/Makefile.am
--- src/task/Makefile.am (révision 198)
+++ src/task/Makefile.am (révision 199)
@@ -6,5 +6,6 @@
function_task.hh function_task.cc \
boolean_task.hh boolean_task.cc \
int_task.hh int_task.cc \
+ string_task.hh string_task.cc \
task_register.hh task_register.cc \
libtask.hh
Index: src/task/string_task.cc
--- src/task/string_task.cc (révision 0)
+++ src/task/string_task.cc (révision 199)
@@ -0,0 +1,47 @@
+//
+// 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/string_task.hh"
+
+namespace task
+{
+
+ StringTask::StringTask(void (*execute) (const std::string &),
+ const std::string &option,
+ const std::string &module_name,
+ const std::string &desc,
+ const std::string &deps):
+ Task(option, module_name, desc, deps, true),
+ execute_(execute)
+ {}
+
+ bool
+ StringTask::set_value(const std::string &value) const
+ {
+ s_ = value;
+ return true;
+ }
+
+ void
+ StringTask::execute() const
+ {
+ execute_(s_);
+ }
+
+} //namespace task
Index: src/vm-tasks.hh
--- src/vm-tasks.hh (révision 198)
+++ src/vm-tasks.hh (révision 199)
@@ -1,6 +1,6 @@
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
-// Copyright (C) 2003, 2004 Benoit Perrot <benoit(a)lrde.epita.fr>
+// Copyright (C) 2003, 2004, 2005 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
@@ -37,6 +37,15 @@
BOOLEAN_TASK_DECLARE ("profile", "Enable program profiling",
profile_p, "");
+ STRING_TASK_DECLARE ("l|system-library",
+ "\n"
+ "\t\t\tSpecify the builtin system library to use;\n"
+ "\t\t\tvalid library names are: `spim' (default), "
+ "`nolimips', \n"
+ "\t\t\tand `none'\n",
+ select_system_library, "spim",
+ "");
+
BOOLEAN_TASK_DECLARE ("E|trace-exec", "Trace the execution",
trace_exec_p, "");
TASK_DECLARE ("e|execute", "Execute the program on virtual machine",
Index: NEWS
--- NEWS (révision 198)
+++ NEWS (révision 199)
@@ -1,3 +1,9 @@
+New in 0.8a:
+* `--system-library' option provides builtin system library selection,
+ so the user can use a spim-like or the nolimips-original syscall set.
+
+* `--argument-registers' is the new name of `--args'.
+
New in 0.8, 2005-07-11:
* The shell now has (some) completion.
https://svn.lrde.epita.fr/svn/lrdetools/trunk
Index: ChangeLog
from Nicolas Pouillard <ertai(a)lrde.epita.fr>
Add --force to common_commit.
* vcs/lib/vcs/common_commit.rb:
The --force option bypass the rule with unrecognized files.
Inform the user that an update is done.
Make the message for +commited files shorter.
common_commit.rb | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
Index: vcs/lib/vcs/common_commit.rb
--- vcs/lib/vcs/common_commit.rb (revision 272)
+++ vcs/lib/vcs/common_commit.rb (working copy)
@@ -11,8 +11,12 @@
raise Failure, "No `#{CL}', you are probably not in a valid directory."
end
+ force = opts[:force]
+ opts.delete :force
+
@@subject_format = subject_format
+ logger.info { 'Updating your working copy...' }
update!
have_unrecognized_files = false
@@ -24,7 +28,7 @@
end
end
if have_unrecognized_files
- raise Failure, "
+ message = "
|You have unrecognized files in your working copy!
|This meant that these files won't be commited!
|You have some solutions to comply with the rule:
@@ -43,9 +47,15 @@
| ------------ .vcs ------------
|- You can also perform a partial commit and specify which files
| and directories commit. For example this command:
- | #{@command} commit foo.c bar/
+ | #{(a)cmd.command} commit foo.c bar/
|
- |Commit failed".head_cut!
+ |".head_cut!
+ if force
+ logger.warn { message }
+ else
+ logger.error { message }
+ commit_failed
+ end
end
Vcs.commited = edit_form!(files)
@@ -82,23 +92,25 @@
block[iform['subject']] if block_given?
- logger.info 'Deleting junk files...'
+ logger.info { 'Deleting junk files...' }
TMP_CL.delete if TMP_CL.exist?
destdir = '+commited'.to_path/iform['revision'].to_s
destdir.mkpath unless destdir.directory?
+ moved = PathList.new
[LogEntry, Form, IForm, Message, MAIL, NEWS].each do |path|
next unless path.exist?
dest = destdir/path
- logger.info "Moving `#{path}' to `#{dest}'..."
+ moved << path
path.rename(dest)
end
+ logger.info { "Moving `#{moved.join('\', `')}' to `#{destdir}'..." }
end
protected :common_commit!
def commit_failed ( ex=nil )
- logger.error "Aborting #{ex}"
- logger.info 'You can rerun the same command to resume the commit'
+ logger.error { "Aborting #{ex}" }
+ logger.info { 'You can rerun the same command to resume the commit' }
raise 'Commit failed'
end