CharCode,
CharType,
CharsToNumber,
- ClearAttributeGoals,
- CloneAttributeGoals,
CodesToNumber,
CopyTermWithoutAttrVars,
CheckCutPoint,
DeleteAttribute,
DeleteHeadAttribute,
DynamicModuleResolution(usize),
- EnqueueAttributeGoal,
EnqueueAttributedVar,
FetchGlobalVar,
FirstStream,
&SystemClauseType::CharType => clause_name!("$char_type"),
&SystemClauseType::CharsToNumber => clause_name!("$chars_to_number"),
&SystemClauseType::CheckCutPoint => clause_name!("$check_cp"),
- &SystemClauseType::ClearAttributeGoals => clause_name!("$clear_attribute_goals"),
- &SystemClauseType::CloneAttributeGoals => clause_name!("$clone_attribute_goals"),
&SystemClauseType::CodesToNumber => clause_name!("$codes_to_number"),
&SystemClauseType::CopyTermWithoutAttrVars => {
clause_name!("$copy_term_without_attr_vars")
&SystemClauseType::DeleteAttribute => clause_name!("$del_attr_non_head"),
&SystemClauseType::DeleteHeadAttribute => clause_name!("$del_attr_head"),
&SystemClauseType::DynamicModuleResolution(_) => clause_name!("$module_call"),
- &SystemClauseType::EnqueueAttributeGoal => clause_name!("$enqueue_attribute_goal"),
&SystemClauseType::EnqueueAttributedVar => clause_name!("$enqueue_attr_var"),
&SystemClauseType::FetchGlobalVar => clause_name!("$fetch_global_var"),
&SystemClauseType::FirstStream => clause_name!("$first_stream"),
("$char_code", 2) => Some(SystemClauseType::CharCode),
("$char_type", 2) => Some(SystemClauseType::CharType),
("$chars_to_number", 2) => Some(SystemClauseType::CharsToNumber),
- ("$clear_attribute_goals", 0) => Some(SystemClauseType::ClearAttributeGoals),
- ("$clone_attribute_goals", 1) => Some(SystemClauseType::CloneAttributeGoals),
("$codes_to_number", 2) => Some(SystemClauseType::CodesToNumber),
("$copy_term_without_attr_vars", 2) => Some(SystemClauseType::CopyTermWithoutAttrVars),
("$create_partial_string", 3) => Some(SystemClauseType::CreatePartialString),
("$lookup_db_ref", 3) => Some(SystemClauseType::LookupDBRef),
("$lookup_op_db_ref", 4) => Some(SystemClauseType::LookupOpDBRef),
("$module_call", _) => Some(SystemClauseType::DynamicModuleResolution(arity - 2)),
- ("$enqueue_attribute_goal", 1) => Some(SystemClauseType::EnqueueAttributeGoal),
("$enqueue_attr_var", 1) => Some(SystemClauseType::EnqueueAttributedVar),
("$partial_string_tail", 2) => Some(SystemClauseType::PartialStringTail),
("$peek_byte", 2) => Some(SystemClauseType::PeekByte),
#[derive(Debug)]
pub(super) struct AttrVarInitializer {
- pub(super) attribute_goals: Vec<Addr>,
pub(super) attr_var_queue: Vec<usize>,
pub(super) bindings: Bindings,
pub(super) cp: LocalCodePtr,
impl AttrVarInitializer {
pub(super) fn new(verify_attrs_loc: usize) -> Self {
AttrVarInitializer {
- attribute_goals: vec![],
attr_var_queue: vec![],
bindings: vec![],
instigating_p: LocalCodePtr::default(),
#[inline]
pub(super) fn reset(&mut self) {
- self.attribute_goals.clear();
self.attr_var_queue.clear();
self.bindings.clear();
}
sort(Modules0, Modules),
call_project_attributes(Modules, QueryVars, AttrVars).
-enqueue_goals(Goals0) :-
- nonvar(Goals0),
- Goals0 = [Goal | Goals],
- nonvar(Goal),
- !,
- '$enqueue_attribute_goal'(Goal),
- enqueue_goals(Goals).
-enqueue_goals(_).
-
'$print_project_attributes_exception'(Module, E) :-
( ( E = error(existence_error(procedure, project_attributes/2), _)
; E = error(evaluation_error((Module:project_attributes)/2), _)
call_attribute_goals([], _, _).
call_attribute_goals([Module|Modules], GoalCaller, AttrVars) :-
call(GoalCaller, AttrVars, Module, Goals),
- enqueue_goals(Goals),
call_attribute_goals(Modules, GoalCaller, AttrVars).
'$print_attribute_goals_exception'(Module, E) :-
call_attribute_goals_with_module_prefix([], _, _, []).
call_attribute_goals_with_module_prefix([Module | Modules], GoalCaller, AttrVars, Goals) :-
call(GoalCaller, AttrVars, Module, Goals0),
- enqueue_goals(Goals0),
module_prefixed_goals(Goals0, Module, Goals, Gs),
call_attribute_goals_with_module_prefix(Modules, GoalCaller, AttrVars, Gs).
use ref_thread_local::RefThreadLocal;
-use std::cmp;
use std::collections::BTreeSet;
use std::convert::TryFrom;
use std::env;
Ok(())
}
- fn fetch_attribute_goals(&mut self, mut attr_goals: Vec<Addr>) {
- attr_goals.sort_unstable_by(|a1, a2| {
- self.compare_term_test(a1, a2)
- .unwrap_or(cmp::Ordering::Less)
- });
-
- self.term_dedup(&mut attr_goals);
-
- let attr_goals = Addr::HeapCell(self.heap.to_list(attr_goals.into_iter()));
- let target = self[temp_v!(1)];
-
- (self.unify_fn)(self, attr_goals, target);
- }
-
fn call_continuation_chunk(&mut self, chunk: Addr, return_p: LocalCodePtr) -> LocalCodePtr {
let chunk = self.store(self.deref(chunk));
}
}
}
- &SystemClauseType::EnqueueAttributeGoal => {
- let addr = self[temp_v!(1)];
- self.attr_var_init.attribute_goals.push(addr);
- }
&SystemClauseType::EnqueueAttributedVar => {
let addr = self[temp_v!(1)];
_ => {}
}
}
- /*
- &SystemClauseType::ExpandGoal => {
- self.p = CodePtr::Local(LocalCodePtr::UserGoalExpansion(0));
- return Ok(());
- }
- &SystemClauseType::ExpandTerm => {
- self.p = CodePtr::Local(LocalCodePtr::UserTermExpansion(0));
- return Ok(());
- }
- */
&SystemClauseType::GetNextDBRef => {
let a1 = self[temp_v!(1)];
&SystemClauseType::TruncateIfNoLiftedHeapGrowth => {
self.truncate_if_no_lifted_heap_diff(|_| Addr::EmptyList)
}
- &SystemClauseType::ClearAttributeGoals => {
- self.attr_var_init.attribute_goals.clear();
- }
- &SystemClauseType::CloneAttributeGoals => {
- let attr_goals = self.attr_var_init.attribute_goals.clone();
- self.fetch_attribute_goals(attr_goals);
- }
&SystemClauseType::GetAttributedVariableList => {
let attr_var = self.store(self.deref(self[temp_v!(1)]));
let attr_var_list = match attr_var {
submit_query_and_print_results_(_, _) :-
% clear attribute goal lists, which may be populated by
% copy_term/3 prior to failure.
- '$clear_attribute_goals',
write('false.'),
nl.