iroutine to add new operator in certain module.
This commit is contained in:
parent
9993ca2f3a
commit
083c88a91d
17
C/adtdefs.c
17
C/adtdefs.c
@ -493,21 +493,23 @@ Yap_OpPropForModule(Atom a, Term mod)
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
AtomEntry *ae = RepAtom(a);
|
AtomEntry *ae = RepAtom(a);
|
||||||
PropEntry *pp;
|
PropEntry *pp;
|
||||||
OpEntry *info;
|
OpEntry *info = NULL;
|
||||||
|
|
||||||
if (mod == TermProlog)
|
if (mod == TermProlog)
|
||||||
mod = PROLOG_MODULE;
|
mod = PROLOG_MODULE;
|
||||||
WRITE_LOCK(ae->ARWLock);
|
WRITE_LOCK(ae->ARWLock);
|
||||||
pp = RepProp(ae->PropsOfAE);
|
pp = RepProp(ae->PropsOfAE);
|
||||||
while (!EndOfPAEntr(pp)) {
|
while (!EndOfPAEntr(pp)) {
|
||||||
OpEntry *info = NULL;
|
|
||||||
if ( pp->KindOfPE == OpProperty) {
|
if ( pp->KindOfPE == OpProperty) {
|
||||||
info = (OpEntry *)pp;
|
info = (OpEntry *)pp;
|
||||||
if (info->OpModule == mod)
|
if (info->OpModule == mod) {
|
||||||
|
WRITE_LOCK(info->OpRWLock);
|
||||||
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (EndOfPAEntr(info)) {
|
pp = pp->NextOfPE;
|
||||||
|
}
|
||||||
info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
|
info = (OpEntry *) Yap_AllocAtomSpace(sizeof(OpEntry));
|
||||||
info->KindOfPE = Ord(OpProperty);
|
info->KindOfPE = Ord(OpProperty);
|
||||||
info->OpModule = mod;
|
info->OpModule = mod;
|
||||||
@ -521,12 +523,7 @@ Yap_OpPropForModule(Atom a, Term mod)
|
|||||||
WRITE_LOCK(info->OpRWLock);
|
WRITE_LOCK(info->OpRWLock);
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
info->Prefix = info->Infix = info->Posfix = 0;
|
info->Prefix = info->Infix = info->Posfix = 0;
|
||||||
} else {
|
return info;
|
||||||
WRITE_LOCK(info->OpRWLock);
|
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OpEntry *
|
OpEntry *
|
||||||
|
Reference in New Issue
Block a user