https://svn.lrde.epita.fr/svn/nolimips/trunk
ChangeLog | 11 +++
src/vm-tasks.cc | 4 -
src/vm/Makefile.am | 2
src/vm/nolimips_system_library.cc | 115 +++++++++++++++++++++++++++++++++++++
src/vm/nolimips_system_library.hh | 57 ++++++++++++++++++
src/vm/nolimips_system_library.hxx | 36 +++++++++++
6 files changed, 224 insertions(+), 1 deletion(-)
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Introduce nolimips system library.
* src/vm/nolimips_system_library.hh,
* src/vm/nolimips_system_library.hxx,
* src/vm/nolimips_system_library.cc:
Provide a set of some libc functions as syscalls.
* src/vm/Makefile.am: Distribute these new files.
* src/vm-tasks.cc: Fix missing include.
Index: src/vm/nolimips_system_library.hh
--- src/vm/nolimips_system_library.hh (revision 0)
+++ src/vm/nolimips_system_library.hh (revision 197)
@@ -0,0 +1,57 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 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
+// 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 VM_NOLIMIPS_SYSTEM_LIBRARY_HH
+# define VM_NOLIMIPS_SYSTEM_LIBRARY_HH
+
+# include <iostream>
+# include <map>
+
+# include "vm/system_library.hh"
+
+namespace vm
+{
+
+ class Mmu;
+
+ class NolimipsSystemLibrary: public SystemLibrary
+ {
+ public:
+ NolimipsSystemLibrary(std::istream &istr,
+ std::ostream &ostr,
+ std::ostream &estr);
+ virtual ~NolimipsSystemLibrary();
+
+ public:
+ virtual void invoke(Cpu &cpu);
+
+ protected:
+ int read(int fd, Mmu &mmu, int offset, int count);
+ int write(int fd, const Mmu &mmu, int offset, int count);
+
+ protected:
+ std::istream &istr_;
+ std::ostream &ostr_;
+ std::ostream &estr_;
+ };
+
+} // namespace vm
+
+# include "vm/nolimips_system_library.hxx"
+
+#endif // !VM_NOLIMIPS_SYSTEM_LIBRARY_HH
Index: src/vm/nolimips_system_library.hxx
--- src/vm/nolimips_system_library.hxx (revision 0)
+++ src/vm/nolimips_system_library.hxx (revision 197)
@@ -0,0 +1,36 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 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
+// 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 VM_NOLIMIPS_SYSTEM_LIBRARY_HXX
+# define VM_NOLIMIPS_SYSTEM_LIBRARY_HXX
+
+# include "vm/nolimips_system_library.hh"
+
+namespace vm
+{
+
+ inline
+ NolimipsSystemLibrary::NolimipsSystemLibrary(std::istream &istr,
+ std::ostream &ostr,
+ std::ostream &estr):
+ istr_(istr), ostr_(ostr), estr_(estr)
+ {}
+
+} // namespace vm
+
+#endif // !VM_NOLIMIPS_SYSTEM_LIBRARY_HXX
Index: src/vm/nolimips_system_library.cc
--- src/vm/nolimips_system_library.cc (revision 0)
+++ src/vm/nolimips_system_library.cc (revision 197)
@@ -0,0 +1,115 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 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
+// 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 "common.hh"
+
+#include "vm/nolimips_system_library.hh"
+#include "vm/cpu.hh"
+#include "vm/mmu.hh"
+
+namespace vm
+{
+
+ NolimipsSystemLibrary::~NolimipsSystemLibrary()
+ {}
+
+ int
+ NolimipsSystemLibrary::read(int fd, Mmu &mmu, int offset, int count)
+ {
+ std::istream *istr = 0;
+
+ if (fd == 0)
+ istr = &istr_;
+
+ int i = -1;
+ if (istr)
+ {
+ for (i = 0; i < count; ++i, ++offset)
+ {
+ int c = istr->get();
+ if (istr->eof())
+ break;
+
+ mmu.data_store_byte(offset, c);
+ }
+ }
+
+ return i;
+ }
+
+ int
+ NolimipsSystemLibrary::write(int fd, const Mmu &mmu, int offset, int count)
+ {
+ std::ostream *ostr = 0;
+
+ if (fd == 1)
+ ostr = &ostr_;
+ else if (fd == 2)
+ ostr = &estr_;
+
+ int i = -1;
+ if (ostr)
+ {
+ for (i = 0; i < count; ++i, ++offset)
+ ostr->put(static_cast<char>(mmu.data_load_byte(offset)));
+ }
+
+ return i;
+ }
+
+ void
+ NolimipsSystemLibrary::invoke(Cpu &cpu)
+ {
+ switch (cpu.get_register(Cpu::v0))
+ {
+ case 0x02: // read(fd: $a0, buf: $a1, count: $a2): $v0
+ {
+ cpu.set_register(Cpu::v0,
+ read(cpu.get_register(Cpu::a0),
+ cpu.get_mmu(), cpu.get_register(Cpu::a1),
+ cpu.get_register(Cpu::a2)));
+ }
+ break;
+
+ case 0x03: // write(fd: $a0, buf: $a1, count: $a2): $v0
+ {
+ cpu.set_register(Cpu::v0,
+ write(cpu.get_register(Cpu::a0),
+ cpu.get_mmu(), cpu.get_register(Cpu::a1),
+ cpu.get_register(Cpu::a2)));
+ }
+ break;
+
+ case 0x06: // exit(status: $a0)
+ cpu.get_cp0().set_fatal_exception();
+ if (!exit_status)
+ exit_status = (exit_type) cpu.get_register(Cpu::a0);
+ break;
+
+ case 0x33: // malloc(size: $a0)
+ cpu.set_register(Cpu::v0,
+ cpu.get_mmu().data_sbrk(cpu.get_register(Cpu::a0)));
+ break;
+
+ default:
+ assertion(!"syscall: Not implemented yet");
+ break;
+ }
+ }
+
+} // namespace vm
Index: src/vm/Makefile.am
--- src/vm/Makefile.am (revision 196)
+++ src/vm/Makefile.am (revision 197)
@@ -10,4 +10,6 @@
system_library.hh system_library.cc \
spim_system_library.hh spim_system_library.hxx \
spim_system_library.cc \
+ nolimips_system_library.hh nolimips_system_library.hxx \
+ nolimips_system_library.cc \
virtual_machine.hh virtual_machine.cc
Index: src/vm-tasks.cc
--- src/vm-tasks.cc (revision 196)
+++ src/vm-tasks.cc (revision 197)
@@ -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
@@ -18,6 +18,8 @@
//
#include "common.hh"
+#include "inst/program.hh"
+
#include "vm/spim_system_library.hh"
#include "vm/virtual_machine.hh"
>>> "Nicolas" == Nicolas Pouillard <nicolas.pouillard(a)gmail.com> writes:
> On 10/5/05, Akim Demaille <akim(a)lrde.epita.fr> wrote:
>> >>> "Olivier" == Olivier Gournet <olivier.gournet(a)lrde.epita.fr> writes:
>>
>> > Nicolas Pouillard <nicolas.pouillard(a)gmail.com> disait le 10/03/05 :
>> >> - svn junk: This command use `list' to remove all junk files.
>>
>> > And directories ?
>>
>> This action name is wrong. It looks like "list the junk", not "trash
>> the junk". "vcs clean" seems more appropriate.
>>
> Ok.
> But it's just a shortcut for svn list --junk --do 'rm -rf'.
So what? I still don't care about implementation details.
Nicolas Pouillard <nicolas.pouillard(a)gmail.com> disait le 10/03/05 :
> - svn junk: This command use `list' to remove all junk files.
And directories ?
$ svn junk
[vcs] info: Remove ,messages
[...]
[vcs] info: Remove sdf-detgen/,messages
Are you sure? (y/n)
y
[vcs] info: Removing ,messages...
[vcs] error: Is a directory - ,messages
> - vcs back: find the youngest revision that passes a given test.
> This feature is Based on prcs-back (LrdeTools) from Akim Demaille.
How it is working ?
$ vcs back
Usage: blabla...
$ svn back 1300
[vcs] warn: Your command fail on revision 1314
[vcs] warn: Your command fail on revision 1313
[vcs] warn: Your command fail on revision 1312
....
What kind of test should we provide ?
> - svn ignore: an helper for the svn:ignore property.
Great !
But again, something like:
$ svn help ignore
should give the basic usage.
I know you don't like documenting, but, as features come in an
exponentional way, don't lose your users :)
Hi, you can now update your vcs (as root):
gem update --system
gem install vcs -y --no-rdoc
New in 0.4:
* Vcs now supports ruby 1.8.3.
* Vcs extensions files:
- Protocol version:
You can now add `protocol_version "0.1"' in your extensions. Thus
you will be warned when the format changes. Thanks to Akim Demaille
for this idea.
- Default commit:
By adding `default_commit :your_commit_method' you override the
default commit method with yours. So you can call `commit' and `ci',
but also your old aliases. Of course you can call the real commit
with `commit_' or `ci_'.
* Status & User Configuration File:
All .vcs files between your current path and root will be honored.
Example of configuration file.
>>>> ~/.vcs <<<<
---
exclude: # Excluded Files:
- !re ,messages # not displayed (default ^-.*$)
unmask: # Unmasked Files:
- !re \bdoc # displayed with a `\' (default ^\\.*$)
precious: # Precious Files:
- !re .*\.(diff|patch)$ # displayed with a `+' (default ^\+.*$)
# .vcs files are also treat as precious
junk: # Junk Files:
- !re ... # displayed with a `,' (default ^,.*$)
>>>> ~/.vcsrc <<<<
* Color:
- Status: the status output is now colored depending of the meaning of
the status. The color activation can be choose in your configuration
file (auto, never, always).
- Logger: messages displayed by the Vcs logger are new colored.
cyan (info), yellow (warnings), red (errors), blinking red (fatal).
* ,messages is now +commited: You can rename your ,messages and keep just
one directory for commited meta information.
* GnuPG signature is now optional:
In a .vcs configuration file you can disable the signature option.
For this just add this "sign: false" to .vcs configuration file.
However it's better to keep this option set.
* Commands:
- svn list:
- Now supports category listing:
- list all junk files in foo:
svn list --junk foo
- list all precious, and unmasked files:
svn list --precious --unmask
- Action supports (--do switch):
- svn list --junk --do rm
- svn list --precious --do wc
- svn list --unrecognize --do 'vcs-svn add'
- svn list --missing --do 'vcs-svn remove'
- svn junk: This command use `list' to remove all junk files.
- vcs back: find the youngest revision that passes a given test.
This feature is Based on prcs-back (LrdeTools) from Akim Demaille.
- svn ignore: an helper for the svn:ignore property.
* Sorted outputs:
- Vcs now supports sorting:
In a .vcs configuration file you can add a `sorting' key which
contains a list of regular expressions (Thanks to Akim Demaille and
Alexandre Borghi for this idea).
For example:
>>>> ~/.vcs <<<<
---
sorting:
- !re (NEWS|README|TODO) # These files first
- !re src/ # Then the src directory
- !re test/ # Then the test directory
- !re parse/ # parse and ast are subdirectories
- !re ast/ # present in both src and test
- !re \.cc$ # directories. Thus you will get
- !re \.hh$ # something like:
# - NEWS
# - src/parse/a.hh
# - src/parse/b.hh
# - src/parse/a.cc
# - src/parse/b.cc
# - src/ast/a.hh
# - src/ast/b.hh
# - src/ast/a.cc
# - src/ast/b.cc
# - test/parse/a.hh
# - test/parse/a.cc
# - test/ast/a.hh
# - test/ast/a.cc
- Concerned commands:
- status
- diffw (a more human readable diff)
- mk_log_entry
- mk_changelog_entry
- mk_message_entry
- diffstat
- message
- mk_form
- mk_iform
--
Nicolas Pouillard aka Ertai <ertai(a)feydakins.org>
http://uttk.org Uttk -- Unified Test Tool Kit
https://svn.lrde.epita.fr/svn/lrdetools/trunk
Index: ChangeLog
from Nicolas Pouillard <ertai(a)lrde.epita.fr>
Update meta-information.
* vcs/lib/vcs/vcs.rb, vcs/SPEC.dyn.yml: Update.
* vcs/SPEC.yml: Change a little the title.
SPEC.dyn.yml | 2 +-
SPEC.yml | 4 ++--
lib/vcs/vcs.rb | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
Index: vcs/lib/vcs/vcs.rb
--- vcs/lib/vcs/vcs.rb (revision 268)
+++ vcs/lib/vcs/vcs.rb (working copy)
@@ -44,7 +44,7 @@
# checkout_!
#
class Vcs
- @@version ||= '0.3.0'
+ @@version ||= '0.4.0'
@@user_conf ||= OpenStruct.new(
:exclude => [/^-/],
:unmask => [/^\\/],
Index: vcs/SPEC.dyn.yml
--- vcs/SPEC.dyn.yml (revision 268)
+++ vcs/SPEC.dyn.yml (working copy)
@@ -6,5 +6,5 @@
build: 0
major: 0
minor: 4
- revision: 267
+ revision: 268
:url: https://svn.lrde.epita.fr/svn/lrdetools/trunk/vcs
Index: vcs/SPEC.yml
--- vcs/SPEC.yml (revision 268)
+++ vcs/SPEC.yml (working copy)
@@ -5,8 +5,8 @@
name: vcs
-title: Vcs -- A wrapper over any version control system
-summary: A wrapper over any version control system
+title: Vcs -- A wrapper over Version Control Systems
+summary: A wrapper over Version Control Systems
description: |
Version control systems (Subversion, CVS, PRCS...), however useful, are not
very extensible: adding new features can be cumbersome, especially if you
>>> "Nicolas" == Nicolas Pouillard <ertai(a)lrde.epita.fr> writes:
> Add svn ignore, an helper for the svn:ignore property.
Je suppose que ça marche aussi pour cvs ? C'est exactement le genre
d'abstraction qu'on attend de vcs.
Par ailleurs au niveau de l'interface, c'est assez incomplet. On
souhaite :
- pouvoir éditer interactivement
- pouvoir spécifier une liste de répertoires
- pouvoir passer -R