make write always protect operators when they are not used as operators so as to follow standard (#150).

This commit is contained in:
Vítor Manuel de Morais Santos Costa 2009-11-27 16:09:48 +00:00
parent 69988d0718
commit 506da0b1bf
3 changed files with 12 additions and 5 deletions

View File

@ -2869,11 +2869,19 @@ init_current_predicate_for_atom(void)
static OpEntry *
NextOp(OpEntry *pp)
{
while (!EndOfPAEntr(pp) && pp->KindOfPE != OpProperty)
while (!EndOfPAEntr(pp) && pp->KindOfPE != OpProperty &&
(pp->OpModule != PROLOG_MODULE || pp->OpModule != CurrentModule))
pp = RepOpProp(pp->NextOfPE);
return (pp);
}
int
Yap_IsOp(Atom at)
{
OpEntry *op = NextOp(RepOpProp((Prop)(RepAtom(at)->PropsOfAE)));
return (!EndOfPAEntr(op));
}
static Int
unify_op(OpEntry *op)
{

View File

@ -216,14 +216,12 @@ legalAtom(unsigned char *s) /* Is this a legal atom ? */
static int LeftOpToProtect(Atom at, int p)
{
int op, rp;
return Yap_IsPrefixOp(at, &op, &rp);
return Yap_IsOp(at);
}
static int RightOpToProtect(Atom at, int p)
{
int op, lp;
return Yap_IsPosfixOp(at, &op, &lp);
return Yap_IsOp(at);
}
static wtype

View File

@ -491,6 +491,7 @@ typedef enum
OpEntry *STD_PROTO(Yap_GetOpProp,(Atom, op_type));
int STD_PROTO(Yap_IsPrefixOp,(Atom,int *,int *));
int STD_PROTO(Yap_IsOp,(Atom));
int STD_PROTO(Yap_IsInfixOp,(Atom,int *,int *,int *));
int STD_PROTO(Yap_IsPosfixOp,(Atom,int *,int *));