expand_goal_cases((Module:Goals0), _, ExpandedGoals, HeadVars) :-
expand_goal(Goals0, Module, Goals1, HeadVars),
ExpandedGoals = (Module:Goals1).
-expand_goal_cases(call(Goals0), _, ExpandedGoals, HeadVars) :-
- expand_goal(Goals0, Module, Goals1, HeadVars),
- ExpandedGoals = call(Goals1).
expand_goal(UnexpandedGoals, Module, ExpandedGoals, HeadVars) :-
( var(UnexpandedGoals) ->
- UnexpandedGoals = ExpandedGoals
- % expand_module_names(call(UnexpandedGoals), [0], Module, ExpandedGoals, HeadVars)
+ expand_module_names(call(UnexpandedGoals), [0], Module, ExpandedGoals, HeadVars)
; goal_expansion(UnexpandedGoals, Module, UnexpandedGoals1),
( Module \== user ->
goal_expansion(UnexpandedGoals1, user, Goals)
Compound,
}
-// the position-dependent heap template:
-
-/*
- read_heap_cell!(
- (HeapCellValueTag::AttrVar, n) => {
- }
- (HeapCellValueTag::Lis, n) => {
- }
- (HeapCellValueTag::Var, n) => {
- }
- (HeapCellValueTag::Str, n) => {
- }
- (HeapCellValueTag::PStrOffset, n) => {
- }
- _ => {
- }
- )
-*/
-
impl PartialEq<Ref> for HeapCellValue {
fn eq(&self, r: &Ref) -> bool {
self.as_var() == Some(*r)
_ => Some(Ordering::Greater),
}
}
- (HeapCellValueTag::Var | HeapCellValueTag::AttrVar, h1) => {
+ (HeapCellValueTag::AttrVar | HeapCellValueTag::Var, h1) => {
+ // _ if self.is_ref() => {
+ // let h1 = self.get_value();
+
match r.get_tag() {
RefTag::StackCell => Some(Ordering::Less),
_ => {
}
#[inline]
- pub fn is_string_terminator(self, heap: &[HeapCellValue]) -> bool {
- read_heap_cell!(self,
- (HeapCellValueTag::Atom, (name, arity)) => {
- name == atom!("[]") && arity == 0
- }
- (HeapCellValueTag::CStr) => {
- true
- }
- (HeapCellValueTag::PStrOffset, pstr_offset) => {
- heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
- }
- _ => {
- false
- }
- )
+ pub fn is_string_terminator(mut self, heap: &[HeapCellValue]) -> bool {
+ loop {
+ return read_heap_cell!(self,
+ (HeapCellValueTag::Atom, (name, arity)) => {
+ name == atom!("[]") && arity == 0
+ }
+ (HeapCellValueTag::CStr) => {
+ true
+ }
+ (HeapCellValueTag::PStrLoc, h) => {
+ self = heap[h];
+ continue;
+ }
+ (HeapCellValueTag::PStrOffset, pstr_offset) => {
+ heap[pstr_offset].get_tag() == HeapCellValueTag::CStr
+ }
+ _ => {
+ false
+ }
+ );
+ }
}
#[inline(always)]