be less enthusiastsis about writing (op).

This commit is contained in:
Vitor Santos Costa 2010-02-26 14:14:10 +00:00
parent b4481ca98c
commit 5778730b62
3 changed files with 19 additions and 2 deletions

View File

@ -2960,6 +2960,22 @@ Yap_IsOp(Atom at)
return (!EndOfPAEntr(op)); return (!EndOfPAEntr(op));
} }
int
Yap_IsOpMaxPrio(Atom at)
{
OpEntry *op = NextOp(RepOpProp((Prop)(RepAtom(at)->PropsOfAE)));
int max;
if (EndOfPAEntr(op))
return 0;
max = (op->Prefix & 0xfff);
if ((op->Infix & 0xfff) > max)
max = op->Infix & 0xfff;
if ((op->Posfix & 0xfff) > max)
max = op->Posfix & 0xfff;
return max;
}
static Int static Int
unify_op(OpEntry *op) unify_op(OpEntry *op)
{ {

View File

@ -214,12 +214,12 @@ legalAtom(unsigned char *s) /* Is this a legal atom ? */
static int LeftOpToProtect(Atom at, int p) static int LeftOpToProtect(Atom at, int p)
{ {
return Yap_IsOp(at); return Yap_IsOpMaxPrio(at) > p;
} }
static int RightOpToProtect(Atom at, int p) static int RightOpToProtect(Atom at, int p)
{ {
return Yap_IsOp(at); return Yap_IsOpMaxPrio(at) > p;
} }
static wtype static wtype

View File

@ -316,6 +316,7 @@ void STD_PROTO(Yap_InitCPreds,(void));
void STD_PROTO(Yap_show_statistics,(void)); void STD_PROTO(Yap_show_statistics,(void));
void STD_PROTO(Yap_signal,(yap_signals)); void STD_PROTO(Yap_signal,(yap_signals));
void STD_PROTO(Yap_undo_signal,(yap_signals)); void STD_PROTO(Yap_undo_signal,(yap_signals));
int STD_PROTO(Yap_IsOpMaxPrio,(Atom));
/* sysbits.c */ /* sysbits.c */
void STD_PROTO(Yap_set_fpu_exceptions,(int)); void STD_PROTO(Yap_set_fpu_exceptions,(int));