Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tiger
nolimips
Commits
db7743f6
Commit
db7743f6
authored
Jun 24, 2003
by
Benoit Perrot
Browse files
VM: Use variable input and output streams.
parent
9aacb73f
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
db7743f6
2003-07-17 Benot Perrot <benoit@lrde.epita.fr>
* src/inst/section.hh: Export types.
* src/vm/virtual_machine.cc, src/vm/virtual_machine.hh:
Use variable input and output streams.
2003-07-17 Benot Perrot <benoit@lrde.epita.fr>
* src/inst/section.hh: Add a const accessor to Section's labels.
2003-07-12 Benot Perrot <benoit@lrde.epita.fr>
...
...
src/inst/section.hh
View file @
db7743f6
...
...
@@ -33,6 +33,8 @@ namespace inst
{
protected:
typedef
std
::
list
<
const
Label
*>
label_list_t
;
public:
typedef
std
::
map
<
int
,
label_list_t
>
offset_label_t
;
typedef
std
::
map
<
const
Label
,
int
>
label_offset_t
;
...
...
src/vm/virtual_machine.cc
View file @
db7743f6
...
...
@@ -507,7 +507,7 @@ namespace vm
{
// print_int (integer: $a0)
case
1
:
st
d
::
cout
<<
cpu
.
get_a0
();
o
st
r
<<
cpu
.
get_a0
();
break
;
// print_string (buffer: $a0)
...
...
@@ -517,7 +517,7 @@ namespace vm
char
b
=
memory
.
load_byte
(
i
);
if
(
b
==
0
)
break
;
st
d
::
cout
<<
b
;
o
st
r
<<
b
;
}
break
;
...
...
@@ -528,8 +528,8 @@ namespace vm
int
c
=
0
;
for
(;
(
i
<
cpu
.
get_a1
()
-
1
)
&&
(
c
!=
'\n'
)
&&
(
c
!=
'\r'
)
;
++
i
)
{
c
=
st
d
::
cin
.
get
();
if
(
st
d
::
cin
.
eof
())
c
=
i
st
r
.
get
();
if
(
i
st
r
.
eof
())
break
;
memory
.
store_byte
(
cpu
.
get_a0
()
+
i
,
c
);
}
...
...
@@ -550,7 +550,7 @@ namespace vm
default:
assertion
(
!
"syscall: Not implemented yet"
);
};
st
d
::
cout
.
flush
();
o
st
r
.
flush
();
}
}
// namespace vm
src/vm/virtual_machine.hh
View file @
db7743f6
...
...
@@ -19,6 +19,8 @@
#ifndef VM_VIRTUAL_MACHINE_HH
# define VM_VIRTUAL_MACHINE_HH
# include <iostream>
# include "misc/contract.hh"
# include "common.hh"
...
...
@@ -35,7 +37,9 @@ namespace vm
protected
inst
::
ConstVisitor
{
public:
VirtualMachine
()
:
VirtualMachine
(
std
::
istream
&
istr
=
std
::
cin
,
std
::
ostream
&
ostr
=
std
::
cout
)
:
istr
(
istr
),
ostr
(
ostr
),
program
(
0
),
text_section
(
0
)
{
}
...
...
@@ -149,6 +153,9 @@ namespace vm
protected:
bool
halt
;
std
::
istream
&
istr
;
std
::
ostream
&
ostr
;
protected:
Cpu
cpu
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment