add current_output, printing of stream terms
This commit is contained in:
@@ -673,6 +673,7 @@ impl MachineState {
|
||||
call_policy: &mut Box<dyn CallPolicy>,
|
||||
cut_policy: &mut Box<dyn CutPolicy>,
|
||||
current_input_stream: &mut Stream,
|
||||
current_output_stream: &mut Stream,
|
||||
) -> CallResult {
|
||||
match ct {
|
||||
&SystemClauseType::AbolishClause => {
|
||||
@@ -748,6 +749,32 @@ impl MachineState {
|
||||
}
|
||||
}
|
||||
}
|
||||
&SystemClauseType::CurrentOutput => {
|
||||
let addr = self.store(self.deref(self[temp_v!(1)].clone()));
|
||||
let stream = current_output_stream.clone();
|
||||
|
||||
match addr {
|
||||
addr if addr.is_ref() => {
|
||||
self.unify(Addr::Stream(stream), addr);
|
||||
}
|
||||
Addr::Stream(other_stream) => {
|
||||
self.fail = stream != other_stream;
|
||||
}
|
||||
addr => {
|
||||
let stub = MachineError::functor_stub(
|
||||
clause_name!("current_input"),
|
||||
1,
|
||||
);
|
||||
|
||||
let err = MachineError::domain_error(
|
||||
DomainError::Stream,
|
||||
addr,
|
||||
);
|
||||
|
||||
return Err(self.error_form(err, stub));
|
||||
}
|
||||
}
|
||||
}
|
||||
&SystemClauseType::AtEndOfExpansion => {
|
||||
if self.cp == LocalCodePtr::TopLevel(0, 0) {
|
||||
self.at_end_of_expansion = true;
|
||||
|
||||
Reference in New Issue
Block a user