delete_attributes deletes v as an attvar.

This commit is contained in:
Vitor Santos Costa 2010-03-27 10:57:21 +00:00
parent 568c541874
commit 9869ffebfd

View File

@ -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 static void
DelAtts(attvar_record *attv, Term oatt) DelAtts(attvar_record *attv, Term oatt)
{ {
Term t = ArgOfTerm(1,oatt);
if (attv->Atts == oatt) { if (attv->Atts == oatt) {
if (IsVarTerm(t)) {
DelAllAtts(attv);
return;
}
if (RepAppl(attv->Atts) >= HB) if (RepAppl(attv->Atts) >= HB)
attv->Atts = ArgOfTerm(1,oatt); attv->Atts = t;
else else
MaBind(&(attv->Atts), ArgOfTerm(1,oatt)); MaBind(&(attv->Atts), t);
} else { } else {
Term *wherep = &attv->Atts; Term *wherep = &attv->Atts;
do { do {
if (*wherep == oatt) { if (*wherep == oatt) {
MaBind(wherep, ArgOfTerm(1,oatt)); MaBind(wherep, t);
return; return;
} else { } else {
wherep = RepAppl(Deref(*wherep))+1; 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 static void
PutAtt(Int pos, Term atts, Term att) PutAtt(Int pos, Term atts, Term att)
{ {