IsCompound(RegType),
IsInteger(RegType),
IsRational(RegType),
- IsString(RegType),
IsFloat(RegType),
IsNonVar(RegType),
IsVar(RegType),
m.insert(("compound", 1), ClauseType::Inlined(InlinedClauseType::IsCompound(r1)));
m.insert(("integer", 1), ClauseType::Inlined(InlinedClauseType::IsInteger(r1)));
m.insert(("rational", 1), ClauseType::Inlined(InlinedClauseType::IsRational(r1)));
- m.insert(("string", 1), ClauseType::Inlined(InlinedClauseType::IsString(r1)));
m.insert(("float", 1), ClauseType::Inlined(InlinedClauseType::IsFloat(r1)));
m.insert(("nonvar", 1), ClauseType::Inlined(InlinedClauseType::IsNonVar(r1)));
m.insert(("var", 1), ClauseType::Inlined(InlinedClauseType::IsVar(r1)));
&InlinedClauseType::IsCompound(..) => "compound",
&InlinedClauseType::IsInteger(..) => "integer",
&InlinedClauseType::IsRational(..) => "rational",
- &InlinedClauseType::IsString(..) => "string",
&InlinedClauseType::IsFloat(..) => "float",
&InlinedClauseType::IsNonVar(..) => "nonvar",
&InlinedClauseType::IsVar(..) => "var",
code.push(fail!());
}
},
- &InlinedClauseType::IsString(..) => match terms[0].as_ref() {
- &Term::Constant(_, Constant::String(..)) => {
- code.push(succeed!());
- }
- &Term::Var(ref vr, ref name) => {
- let r = self.mark_non_callable(name.clone(), 1, term_loc, vr, code);
- code.push(is_string!(r));
- }
- _ => {
- code.push(fail!());
- }
- },
&InlinedClauseType::IsNonVar(..) => match terms[0].as_ref() {
&Term::AnonVar => {
code.push(fail!());
Some(iter.first_to_expire)
}
- pub(super) fn reset_block(&mut self, addr: Addr) {
+ pub(super)
+ fn reset_block(&mut self, addr: Addr) {
match self.store(addr) {
Addr::Usize(b) => self.block = b,
_ => self.fail = true,
};
}
- pub(super) fn execute_inlined(&mut self, inlined: &InlinedClauseType) {
+ pub(super)
+ fn execute_inlined(&mut self, inlined: &InlinedClauseType) {
match inlined {
&InlinedClauseType::CompareNumber(cmp, ref at_1, ref at_2) => {
let n1 = try_or_fail!(self, self.get_number(at_1));
}
};
}
- &InlinedClauseType::IsString(r1) => {
- let d = self.store(self.deref(self[r1]));
-
- match d {
- Addr::PStrLocation(..) => self.p += 1,
- _ => self.fail = true,
- };
- }
&InlinedClauseType::IsNonVar(r1) => {
let d = self.store(self.deref(self[r1]));
}
}
&SystemClauseType::IsPartialString => {
- let pstr = self.store(self.deref(self[temp_v!(1)]));
+ let mut heap_pstr_iter = self.heap_pstr_iter(self[temp_v!(1)]);
- match pstr {
- Addr::PStrLocation(..) => {
- }
- _ => {
- self.fail = true;
- }
- }
+ while let Some(_) = heap_pstr_iter.next() {}
+
+ self.fail =
+ match heap_pstr_iter.focus() {
+ Addr::AttrVar(_) | Addr::HeapCell(_) | Addr::StackCell(..) |
+ Addr::EmptyList => {
+ false
+ }
+ _ => {
+ true
+ }
+ };
}
&SystemClauseType::PartialStringTail => {
let pstr = self.store(self.deref(self[temp_v!(1)]));
};
}
-macro_rules! is_string {
- ($r:expr) => {
- call_clause!(ClauseType::Inlined(InlinedClauseType::IsString($r)), 1, 0)
- };
-}
-
macro_rules! is_var {
($r:expr) => {
call_clause!(ClauseType::Inlined(InlinedClauseType::IsVar($r)), 1, 0)