DeleteFromAttributedVarList,
#[strum_discriminants(strum(props(Arity = "1", Name = "$delete_all_attributes_from_var")))]
DeleteAllAttributesFromVar,
+ #[strum_discriminants(strum(props(Arity = "1", Name = "$unattributed_var")))]
+ UnattributedVar,
REPL(REPLCodePtr),
}
&Instruction::CallMakeDirectoryPath(_) |
&Instruction::CallDeleteFile(_) |
&Instruction::CallRenameFile(_) |
- &Instruction::CallFileCopy(_) |
+ &Instruction::CallFileCopy(_) |
&Instruction::CallWorkingDirectory(_) |
&Instruction::CallDeleteDirectory(_) |
&Instruction::CallPathCanonical(_) |
&Instruction::CallPutToAttributedVarList(_) |
&Instruction::CallDeleteFromAttributedVarList(_) |
&Instruction::CallDeleteAllAttributesFromVar(_) |
+ &Instruction::CallUnattributedVar(_) |
&Instruction::CallFetchGlobalVar(_) |
&Instruction::CallFirstStream(_) |
&Instruction::CallFlushOutput(_) |
&Instruction::ExecutePutToAttributedVarList(_) |
&Instruction::ExecuteDeleteFromAttributedVarList(_) |
&Instruction::ExecuteDeleteAllAttributesFromVar(_) |
+ &Instruction::ExecuteUnattributedVar(_) |
&Instruction::ExecuteFetchGlobalVar(_) |
&Instruction::ExecuteFirstStream(_) |
&Instruction::ExecuteFlushOutput(_) |
length_rundown(Xs, 0) :- !, Xs = [].
length_rundown(Vs, N) :-
- \+ \+ '$project_atts':copy_term(Vs,Vs,[]), % unconstrained
+ '$unattributed_var'(Vs), % unconstrained
!,
'$det_length_rundown'(Vs, N).
length_rundown([_|Xs], N) :- % force unification
length(Xs, N1). % maybe some new info on Xs
failingvarskip(Xs) :-
- \+ \+ '$project_atts':copy_term(Xs,Xs,[]), % unconstrained
+ '$unattributed_var'(Xs), % unconstrained
!.
failingvarskip([_|Xs0]) :- % force unification
'$skip_max_list'(_, _, Xs0,Xs),
self.delete_all_attributes_from_var();
self.machine_st.p = self.machine_st.cp;
}
+ &Instruction::CallUnattributedVar(_) => {
+ self.machine_st.unattributed_var();
+ step_or_fail!(self, self.machine_st.p += 1);
+ }
+ &Instruction::ExecuteUnattributedVar(_) => {
+ self.machine_st.unattributed_var();
+ step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
+ }
}
}
}
impl MachineState {
+ #[inline(always)]
+ pub(crate) fn unattributed_var(&mut self) {
+ let attr_var = self.store(self.deref(self.registers[1]));
+
+ if !attr_var.is_var() {
+ self.fail = true;
+ return;
+ }
+
+ read_heap_cell!(attr_var,
+ (HeapCellValueTag::AttrVar, h) => {
+ let list_cell = self.store(self.deref(self.heap[h+1]));
+ self.fail = list_cell.get_tag() == HeapCellValueTag::Lis;
+ }
+ _ => {
+ }
+ );
+ }
+
pub(crate) fn get_attr_var_list(&mut self, attr_var: HeapCellValue) -> Option<usize> {
read_heap_cell!(attr_var,
(HeapCellValueTag::AttrVar, h) => {