Commit 63785fc1 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

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

        * src/mipsy-tasks.hh,
        * src/vm/vm-tasks.hh,
        * src/shell/shell-tasks.hh:
        Add short options.
        * src/task/task_register.hh, src/task/task_register.cc:
        Support concatenated short options.
        * NEWS, doc/mipsy.texi:
        Document this.
parent 6f851c4e
2004-04-25 Benot Perrot <benoit@lrde.epita.fr>
* src/mipsy-tasks.hh,
* src/vm/vm-tasks.hh,
* src/shell/shell-tasks.hh:
Add short options.
* src/task/task_register.hh, src/task/task_register.cc:
Support concatenated short options.
* NEWS, doc/mipsy.texi:
Document this.
2004-04-24 Benot Perrot <benoit@lrde.epita.fr>
Enhance readline detection.
......
-*- text -*-
New in 0.6:
* Option engine now supports concatenated short options. The command:
mipsy -Fue file.s
executes `file.s' with disabled delay slots and unlimited registers support.
* Thanks to Jérémy Demeule (demeul_j@epita.fr), Mipsy now comes with
an interactive shell!
......
......@@ -149,7 +149,7 @@ where @file{file.s} is a simple text file, and @var{options} is any
combination of the following options:
@table @code
@item -?
@item -h
@itemx --help
Display a help message and exit successfully.
@item -V
......@@ -171,7 +171,9 @@ Parse a file.
Trace the scanning.
@item --trace-parse
Trace the parse.
@item --fill-delay-slot
@item -F
@itemx --fill-delay-slot
To avoid a bubble in their pipeline, MIPS processors execute the
instruction immediately following a branch; this instruction is said
to be in the delay slot (FIXME: see further). This option fills the
......@@ -179,7 +181,8 @@ delay slot of branch instructions with a NOP, disabling the delay
slot, simplifying the task of assembly programmers how do not care
about writing optimized code.
@item --unlimited-regs
@item -u
@itemx --unlimited-regs
During last stages of a compiler, the intermediate representation of a
source file (which mainly consists in a generic, architecture
independent assembly code) is progressively translated into an
......@@ -201,11 +204,17 @@ Resolve jump offsets and check bounds of immediates.
@item --check-callee-save
Warn if a callee save register is not preserved across a call.
@item --execute
@item -e
@itemx --execute
Execute the program on virtual machine.
@item --trace-exec
@item -E
@itemx --trace-exec
Trace the execution.
@item -i
@itemx --shell
Launch interactive shell.
@end table
......
......@@ -2,25 +2,26 @@
(Created-By-Prcs-Version 1 3 2)
(Project-Description "")
(Project-Version mipsy 0 87)
(Parent-Version mipsy 0 86)
(Project-Version mipsy 0 88)
(Parent-Version mipsy 0 87)
(Version-Log
"Index: ChangeLog
from Benot Perrot <benoit@lrde.epita.fr>
Enhance readline detection.
* config/readline.m4:
Provide AC_CHECK_READLINE.
* configure.ac, src/Makefile.am:
Use AC_CHECK_READLINE to check readline library presence and
usability.
* src/mipsy-tasks.hh,
* src/vm/vm-tasks.hh,
* src/shell/shell-tasks.hh:
Add short options.
* src/task/task_register.hh, src/task/task_register.cc:
Support concatenated short options.
* NEWS, doc/mipsy.texi:
Document this.
")
(New-Version-Log
"")
(Checkin-Time "Sat, 24 Apr 2004 23:54:54 +0200")
(Checkin-Time "Sun, 25 Apr 2004 16:59:39 +0200")
(Checkin-Login benoit)
(Files
......@@ -28,10 +29,10 @@ from Beno
;; ./
(AUTHORS (mipsy/0_AUTHORS 1.2 644))
(COPYING (mipsy/1_COPYING 1.1 644))
(ChangeLog (mipsy/2_ChangeLog 1.81 604))
(ChangeLog (mipsy/2_ChangeLog 1.82 604))
(INSTALL (mipsy/b/12_INSTALL 1.1 604))
(Makefile.am (mipsy/3_Makefile.a 1.9 604))
(NEWS (mipsy/b/25_NEWS 1.9 604))
(NEWS (mipsy/b/25_NEWS 1.10 604))
(README (mipsy/4_README 1.3 604))
(TODO (mipsy/5_TODO 1.3 604))
(bootstrap (mipsy/b/14_bootstrap 1.3 705))
......@@ -57,13 +58,13 @@ from Beno
(doc/Makefile.am (mipsy/b/9_Makefile.a 1.4 604))
(doc/fdl.texi (mipsy/b/11_fdl.texi 1.2 604))
(doc/macros.texi (mipsy/c/20_macros.tex 1.1 604))
(doc/mipsy.texi (mipsy/b/10_mipsy.texi 1.6 604))
(doc/mipsy.texi (mipsy/b/10_mipsy.texi 1.7 604))
;; ./src/
(src/Makefile.am (mipsy/18_Makefile.a 1.4 644))
(src/common.hh (mipsy/19_common.hh 1.5 644))
(src/mipsy-tasks.cc (mipsy/20_mipsy-task 1.3 644))
(src/mipsy-tasks.hh (mipsy/21_mipsy-task 1.3 644))
(src/mipsy-tasks.hh (mipsy/21_mipsy-task 1.4 644))
(src/mipsy.cc (mipsy/22_mipsy.cc 1.5 604))
(src/modules.hh (mipsy/23_modules.hh 1.4 644))
......@@ -99,13 +100,13 @@ from Beno
(src/parse/libparse.cc (mipsy/41_libparse.c 1.5 644))
(src/parse/libparse.hh (mipsy/42_libparse.h 1.5 644))
(src/parse/parse-tasks.cc (mipsy/43_parse-task 1.7 644))
(src/parse/parse-tasks.hh (mipsy/44_parse-task 1.5 644))
(src/parse/parse-tasks.hh (mipsy/44_parse-task 1.6 644))
;; ./src/shell/
(src/shell/Makefile.am (mipsy/b/17_Makefile.a 1.1 644))
(src/shell/cmd.hh (mipsy/b/18_cmd.hh 1.1 644))
(src/shell/shell-tasks.cc (mipsy/b/19_shell-task 1.1 644))
(src/shell/shell-tasks.hh (mipsy/c/22_shell-task 1.1 644))
(src/shell/shell-tasks.hh (mipsy/c/22_shell-task 1.2 644))
(src/shell/shell.cc (mipsy/c/23_shell.cc 1.1 644))
(src/shell/shell.hh (mipsy/c/24_shell.hh 1.1 644))
......@@ -115,8 +116,8 @@ from Beno
(src/task/task-tasks.hh (mipsy/47_task-tasks 1.3 644))
(src/task/task.cc (mipsy/48_task.cc 1.5 644))
(src/task/task.hh (mipsy/49_task.hh 1.7 604))
(src/task/task_register.cc (mipsy/50_task_regis 1.8 604))
(src/task/task_register.hh (mipsy/51_task_regis 1.5 604))
(src/task/task_register.cc (mipsy/50_task_regis 1.9 604))
(src/task/task_register.hh (mipsy/51_task_regis 1.6 604))
;; ./src/vm/
(src/vm/Makefile.am (mipsy/b/0_Makefile.a 1.5 604))
......@@ -129,7 +130,7 @@ from Beno
(src/vm/table.hh (mipsy/b/4_table.hh 1.5 604))
(src/vm/virtual_machine.hh (mipsy/b/6_virtual_ma 1.18 604))
(src/vm/vm-tasks.cc (mipsy/b/7_vm-tasks.c 1.7 604))
(src/vm/vm-tasks.hh (mipsy/b/8_vm-tasks.h 1.4 604))
(src/vm/vm-tasks.hh (mipsy/b/8_vm-tasks.h 1.5 604))
;; ./tests/
(tests/Makefile.am (mipsy/b/26_Makefile.a 1.1 644))
......
......@@ -33,7 +33,7 @@ namespace mipsy
usage, "");
TASK_DECLARE ("V|version", "Print program version",
version, "");
TASK_DECLARE ("?|help", "Give this help list",
TASK_DECLARE ("h|help", "Give this help list",
help, "usage version");
} // namespace tasks
......
......@@ -34,12 +34,12 @@ namespace parse
TASK_DECLARE ("trace-scan", "Trace the scanning",
trace_scan, "");
TASK_DECLARE ("unlimited-regs", "Authorize unlimited registers",
TASK_DECLARE ("u|unlimited-regs", "Authorize unlimited registers",
unlimited_regs, "");
TASK_DECLARE ("trace-parse", "Trace the parse",
trace_parse, "");
TASK_DECLARE ("fill-delay-slot",
TASK_DECLARE ("F|fill-delay-slot",
"Fill delay slot of native branch instructions with NOP",
fill_delay_slot, "");
TASK_DECLARE ("parse", "Parse a file",
......
......@@ -29,7 +29,7 @@ namespace shell
TASK_MODULE ("4. Shell");
TASK_DECLARE ("shell", "Enable shell interpreter",
TASK_DECLARE ("i|shell", "Enable shell interpreter",
shell_exec, "");
} // namespace tasks
......
......@@ -105,52 +105,90 @@ namespace task
}
// Find a task given its name
TaskRegister::const_task_iterator
TaskRegister::find_task(const std::string &option)
{
TaskRegister::const_task_iterator it = tasks_.lower_bound(option);
if (it == tasks_.end() || it->first.find(option) != 0)
{
std::cerr << program_name << ": unrecognized option `"
<< option << "'" << std::endl;
it = tasks_.end();
}
else
{
TaskRegister::const_task_iterator next(it);
++next;
if (next != tasks_.end() && next->first.find(option) == 0)
{
std::cerr << program_name << ": ambiguous option `"
<< option << "'" << std::endl;
it = tasks_.end();
}
}
return it;
}
// Parse arguments
char*
TaskRegister::parse_args (int argc, char *argv[])
{
char* res = 0;
const Task* task = 0;
// const Task *task = 0;
for (int i = 1; i < argc; ++i)
{
std::string arg = argv[i];
// if (task != 0)
// {
// enable_task(*task, arg);
// task = 0;
// continue;
// }
if ((arg[0] == '-') && (arg.size () > 1))
if ((1 < arg.size ()) && (arg[0] == '-'))
{
// FIXME: split on '=' for =ARG forms
std::map<std::string, Task const*>::const_iterator
it = tasks_.lower_bound(arg), nit = it;
if (it == tasks_.end() || it->first.find(arg) != 0)
TaskRegister::const_task_iterator it(tasks_.end());
if (arg[1] == '-')
// Long option
{
std::cerr << program_name << ": unrecognized option `"
<< arg << "'" << std::endl;
continue;
}
++nit;
if (nit != tasks_.end() && nit->first.find(arg) == 0)
it = find_task(arg);
if (it != tasks_.end())
{
std::cerr << program_name << ": ambiguous option `"
<< arg << "'" << std::endl;
continue;
}
task = (*it).second;
// task = (*it).second;
// if (task->has_arg())
// continue;
enable_task(*task);
task = 0;
enable_task(*(it->second));
// task = 0;
}
}
else
// Short option
for (unsigned l = 1; l < arg.size(); ++l)
{
std::string short_option("-");
short_option += arg[l];
it = find_task(short_option);
if (it != tasks_.end())
enable_task(*(it->second));
}
}
else
res = argv[i];
}
// if (task != 0)
// std::cerr << program_name
// << ": option `" << task->long_opt() << "' takes an argument"
// << std::endl;
return res;
}
......
......@@ -31,6 +31,10 @@ namespace task
class TaskRegister
{
protected:
typedef std::map<std::string,
Task const*>::const_iterator const_task_iterator;
private:
TaskRegister() {}
public:
......@@ -51,6 +55,8 @@ namespace task
void enable_task (const Task& task);
void enable_task (std::string task_name);
protected:
const_task_iterator find_task(const std::string &option);
public:
char* parse_args (int argc, char *argv[]);
......
......@@ -34,9 +34,9 @@ namespace vm
"is not preserved across a call",
check_callee_save, "");
TASK_DECLARE ("trace-exec", "Trace the execution",
TASK_DECLARE ("E|trace-exec", "Trace the execution",
trace_exec, "");
TASK_DECLARE ("execute", "Execute the program on virtual machine",
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