From 9869ffebfd46bab04e533fdca0f260d02ecb3339 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sat, 27 Mar 2010 10:57:21 +0000 Subject: [PATCH] delete_attributes deletes v as an attvar. --- C/attvar.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/C/attvar.c b/C/attvar.c index 3fefd0597..f6422784f 100644 --- a/C/attvar.c +++ b/C/attvar.c @@ -325,20 +325,31 @@ ReplaceAtts(attvar_record *attv, Term oatt, Term att) } } +static void +DelAllAtts(attvar_record *attv) +{ + MaBind(&(attv->Done), attv->Value); +} + static void DelAtts(attvar_record *attv, Term oatt) { + Term t = ArgOfTerm(1,oatt); if (attv->Atts == oatt) { + if (IsVarTerm(t)) { + DelAllAtts(attv); + return; + } if (RepAppl(attv->Atts) >= HB) - attv->Atts = ArgOfTerm(1,oatt); + attv->Atts = t; else - MaBind(&(attv->Atts), ArgOfTerm(1,oatt)); + MaBind(&(attv->Atts), t); } else { Term *wherep = &attv->Atts; do { if (*wherep == oatt) { - MaBind(wherep, ArgOfTerm(1,oatt)); + MaBind(wherep, t); return; } else { wherep = RepAppl(Deref(*wherep))+1; @@ -347,15 +358,6 @@ DelAtts(attvar_record *attv, Term oatt) } } -static void -DelAllAtts(attvar_record *attv) -{ - if (RepAppl(attv->Atts) >= HB) - RESET_VARIABLE(&attv->Atts); - else - MaBind(&(attv->Atts), MkVarTerm()); -} - static void PutAtt(Int pos, Term atts, Term att) {