From 9e3d16022ae70fd719786279c7407f05b64f0a20 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Mon, 21 May 2012 17:24:40 +0100 Subject: [PATCH] fix YAP_AttOfVar beautify get atts --- C/c_interface.c | 5 +++-- packages/udi/rtree_udi.c | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/C/c_interface.c b/C/c_interface.c index 1336906fe..25fed0c9d 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -3762,9 +3762,10 @@ YAP_AttsOfVar(Term t) t = Deref(t); if (!IsVarTerm(t)) return TermNil; - if (IsAttVar(VarOfTerm(t))) + if(!IsAttVar(VarOfTerm(t))) return TermNil; - attv = (attvar_record *)VarOfTerm(t); + attv = RepAttVar(VarOfTerm(t)); + Yap_DebugPlWrite(attv->Atts); return attv->Atts; } diff --git a/packages/udi/rtree_udi.c b/packages/udi/rtree_udi.c index 141d64ee7..e9c092c98 100644 --- a/packages/udi/rtree_udi.c +++ b/packages/udi/rtree_udi.c @@ -125,12 +125,13 @@ void *RtreeUdiSearch (control_t *control) /*RTreePrint ((*control)[0].tree);*/ - for (i = 0; i < NARGS && (*control)[i].arg != 0 ; i++) - if (YAP_IsAttVar(YAP_A((*control)[i].arg))) + for (i = 0; i < NARGS && (*control)[i].arg != 0 ; i++) { + YAP_Term t = YAP_A((*control)[i].arg); + if (YAP_IsAttVar(t)) { - + fprintf(stderr,"i=%ld\n",i); /*get the constraits rect*/ - Constraints = YAP_AttsOfVar(YAP_A((*control)[i].arg)); + Constraints = YAP_AttsOfVar(t); /* Yap_DebugPlWrite(Constraints); */ r = RectOfTerm(YAP_ArgOfTerm(2,Constraints)); @@ -155,7 +156,7 @@ void *RtreeUdiSearch (control_t *control) return Yap_ClauseListCode(c->cl); } - + } return NULL; /*YAP FALLBACK*/ }