correct peek_code/2, don't set stream position in peek functions
This commit is contained in:
@@ -2437,17 +2437,15 @@ impl Machine {
|
|||||||
let addr = self.deref_register(2);
|
let addr = self.deref_register(2);
|
||||||
|
|
||||||
if stream.at_end_of_stream() {
|
if stream.at_end_of_stream() {
|
||||||
stream.set_past_end_of_stream(true);
|
|
||||||
|
|
||||||
self.machine_st.unify_fixnum(
|
self.machine_st.unify_fixnum(
|
||||||
Fixnum::build_with(-1),
|
Fixnum::build_with(-1),
|
||||||
addr,
|
addr,
|
||||||
);
|
);
|
||||||
|
|
||||||
if !self.machine_st.fail {
|
if self.machine_st.fail {
|
||||||
return Ok(());
|
|
||||||
} else {
|
|
||||||
self.machine_st.fail = false;
|
self.machine_st.fail = false;
|
||||||
|
} else {
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2538,7 +2536,6 @@ impl Machine {
|
|||||||
|
|
||||||
if stream.at_end_of_stream() {
|
if stream.at_end_of_stream() {
|
||||||
let end_of_file = atom!("end_of_file");
|
let end_of_file = atom!("end_of_file");
|
||||||
stream.set_past_end_of_stream(true);
|
|
||||||
|
|
||||||
self.machine_st.unify_atom(
|
self.machine_st.unify_atom(
|
||||||
end_of_file,
|
end_of_file,
|
||||||
@@ -2634,16 +2631,17 @@ impl Machine {
|
|||||||
let a2 = self.deref_register(2);
|
let a2 = self.deref_register(2);
|
||||||
|
|
||||||
if stream.at_end_of_stream() {
|
if stream.at_end_of_stream() {
|
||||||
let end_of_file = atom!("end_of_file");
|
self.machine_st.unify_fixnum(
|
||||||
stream.set_past_end_of_stream(true);
|
Fixnum::build_with(-1),
|
||||||
|
|
||||||
self.machine_st.unify_atom(
|
|
||||||
end_of_file,
|
|
||||||
a2,
|
a2,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if self.machine_st.fail {
|
||||||
|
self.machine_st.fail = false;
|
||||||
|
} else {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let addr = read_heap_cell!(a2,
|
let addr = read_heap_cell!(a2,
|
||||||
(HeapCellValueTag::Var | HeapCellValueTag::StackVar | HeapCellValueTag::AttrVar) => {
|
(HeapCellValueTag::Var | HeapCellValueTag::StackVar | HeapCellValueTag::AttrVar) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user