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
1 changed files with 14 additions and 12 deletions

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
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)
{