indenting

This commit is contained in:
Vítor Santos Costa 2015-10-22 00:25:11 +01:00
parent 7f8ebe18d0
commit d6148eb8ad

View File

@ -36,22 +36,20 @@ static char SccsId[] = "%W% %G%";
/* this routine must be run at least having a read lock on ae */
static Prop
GetFunctorProp(AtomEntry *ae, unsigned int arity)
{ /* look property list of atom a for kind */
GetFunctorProp(AtomEntry *ae,
unsigned int arity) { /* look property list of atom a for kind */
FunctorEntry *pp;
pp = RepFunctorProp(ae->PropsOfAE);
while (!EndOfPAEntr(pp) &&
(!IsFunctorProperty(pp->KindOfPE) ||
pp->ArityOfFE != arity))
(!IsFunctorProperty(pp->KindOfPE) || pp->ArityOfFE != arity))
pp = RepFunctorProp(pp->NextOfPE);
return (AbsFunctorProp(pp));
}
/* vsc: We must guarantee that IsVarTerm(functor) returns true! */
static inline Functor
InlinedUnlockedMkFunctor(AtomEntry *ae, unsigned int arity)
{
static inline Functor InlinedUnlockedMkFunctor(AtomEntry *ae,
unsigned int arity) {
FunctorEntry *p;
Prop p0;
@ -72,16 +70,12 @@ InlinedUnlockedMkFunctor(AtomEntry *ae, unsigned int arity)
return ((Functor)p);
}
Functor
Yap_UnlockedMkFunctor(AtomEntry *ae, unsigned int arity)
{
Functor Yap_UnlockedMkFunctor(AtomEntry *ae, unsigned int arity) {
return (InlinedUnlockedMkFunctor(ae, arity));
}
/* vsc: We must guarantee that IsVarTerm(functor) returns true! */
Functor
Yap_MkFunctor(Atom ap, unsigned int arity)
{
Functor Yap_MkFunctor(Atom ap, unsigned int arity) {
AtomEntry *ae = RepAtom(ap);
Functor f;
@ -92,9 +86,7 @@ Yap_MkFunctor(Atom ap, unsigned int arity)
}
/* vsc: We must guarantee that IsVarTerm(functor) returns true! */
void
Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p)
{
void Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p) {
AtomEntry *ae = RepAtom(ap);
WRITE_LOCK(ae->ARWLock);
@ -105,9 +97,7 @@ Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p)
WRITE_UNLOCK(ae->ARWLock);
}
inline static Atom
SearchInInvisible(const unsigned char *atom)
{
inline static Atom SearchInInvisible(const unsigned char *atom) {
AtomEntry *chain;
READ_LOCK(INVISIBLECHAIN.AERWLock);
@ -122,8 +112,7 @@ SearchInInvisible(const unsigned char *atom)
return (AbsAtom(chain));
}
static inline Atom
SearchAtom(const unsigned char *p, Atom a) {
static inline Atom SearchAtom(const unsigned char *p, Atom a) {
AtomEntry *ae;
/* search atom in chain */
@ -137,8 +126,7 @@ SearchAtom(const unsigned char *p, Atom a) {
return (NIL);
}
static inline Atom
SearchWideAtom(const wchar_t *p, Atom a) {
static inline Atom SearchWideAtom(const wchar_t *p, Atom a) {
AtomEntry *ae;
/* search atom in chain */
@ -153,8 +141,7 @@ SearchWideAtom(const wchar_t *p, Atom a) {
}
static Atom
LookupAtom(const unsigned char *atom)
{ /* lookup atom in atom table */
LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
UInt hash;
const unsigned char *p;
Atom a, na;
@ -188,7 +175,8 @@ LookupAtom(const unsigned char *atom)
}
#endif
/* add new atom to start of chain */
ae = (AtomEntry *) Yap_AllocAtomSpace((sizeof *ae) + strlen((const char *)atom) + 1);
ae = (AtomEntry *)Yap_AllocAtomSpace((sizeof *ae) +
strlen((const char *)atom) + 1);
if (ae == NULL) {
WRITE_UNLOCK(HashChain[hash].AERWLock);
return NIL;
@ -209,10 +197,8 @@ LookupAtom(const unsigned char *atom)
return na;
}
static Atom
LookupWideAtom(const wchar_t *atom)
{ /* lookup atom in atom table */
LookupWideAtom(const wchar_t *atom) { /* lookup atom in atom table */
CELL hash;
wchar_t *p;
Atom a, na;
@ -248,7 +234,8 @@ LookupWideAtom(const wchar_t *atom)
#endif
/* add new atom to start of chain */
sz = wcslen(atom);
ae = (AtomEntry *) Yap_AllocAtomSpace((size_t)(((AtomEntry *)NULL)+1) + sizeof(wchar_t)*(sz + 1));
ae = (AtomEntry *)Yap_AllocAtomSpace((size_t)(((AtomEntry *)NULL) + 1) +
sizeof(wchar_t) * (sz + 1));
if (ae == NULL) {
WRITE_UNLOCK(WideHashChain[hash].AERWLock);
return NIL;
@ -277,16 +264,16 @@ LookupWideAtom(const wchar_t *atom)
return na;
}
Atom
Yap_LookupMaybeWideAtom(const wchar_t *atom)
{ /* lookup atom in atom table */
Atom Yap_LookupMaybeWideAtom(
const wchar_t *atom) { /* lookup atom in atom table */
wchar_t *p = (wchar_t *)atom, c;
size_t len = 0;
unsigned char *ptr, *ptr0;
Atom at;
while ((c = *p++)) {
if (c > 255) return LookupWideAtom(atom);
if (c > 255)
return LookupWideAtom(atom);
len++;
}
/* not really a wide atom */
@ -294,15 +281,15 @@ Yap_LookupMaybeWideAtom(const wchar_t *atom)
ptr0 = ptr = Yap_AllocCodeSpace(len + 1);
if (!ptr)
return NIL;
while ((*ptr++ = *p++));
while ((*ptr++ = *p++))
;
at = LookupAtom(ptr0);
Yap_FreeCodeSpace(ptr0);
return at;
}
Atom
Yap_LookupMaybeWideAtomWithLength(const wchar_t *atom, size_t len0)
{ /* lookup atom in atom table */
Atom Yap_LookupMaybeWideAtomWithLength(
const wchar_t *atom, size_t len0) { /* lookup atom in atom table */
Atom at;
int wide = FALSE;
size_t i = 0;
@ -346,9 +333,8 @@ Yap_LookupMaybeWideAtomWithLength(const wchar_t *atom, size_t len0)
}
}
Atom
Yap_LookupAtomWithLength(const char *atom, size_t len0)
{ /* lookup atom in atom table */
Atom Yap_LookupAtomWithLength(const char *atom,
size_t len0) { /* lookup atom in atom table */
Atom at;
unsigned char *ptr;
@ -363,27 +349,20 @@ Yap_LookupAtomWithLength(const char *atom, size_t len0)
return at;
}
Atom
Yap_LookupAtom(const char *atom)
{ /* lookup atom in atom table */
Atom Yap_LookupAtom(const char *atom) { /* lookup atom in atom table */
return LookupAtom((const unsigned char *)atom);
}
Atom
Yap_ULookupAtom(const unsigned char *atom)
{ /* lookup atom in atom table */
Atom Yap_ULookupAtom(
const unsigned char *atom) { /* lookup atom in atom table */
return LookupAtom(atom);
}
Atom
Yap_LookupWideAtom(const wchar_t *atom)
{ /* lookup atom in atom table */
Atom Yap_LookupWideAtom(const wchar_t *atom) { /* lookup atom in atom table */
return LookupWideAtom(atom);
}
Atom
Yap_FullLookupAtom(const char *atom)
{ /* lookup atom in atom table */
Atom Yap_FullLookupAtom(const char *atom) { /* lookup atom in atom table */
Atom t;
if ((t = SearchInInvisible((const unsigned char *)atom)) != NIL) {
@ -392,10 +371,8 @@ Yap_FullLookupAtom(const char *atom)
return (LookupAtom((const unsigned char *)atom));
}
void
Yap_LookupAtomWithAddress(const char *atom,
AtomEntry *ae)
{ /* lookup atom in atom table */
void Yap_LookupAtomWithAddress(const char *atom,
AtomEntry *ae) { /* lookup atom in atom table */
register CELL hash;
register const unsigned char *p;
Atom a;
@ -403,12 +380,14 @@ Yap_LookupAtomWithAddress(const char *atom,
/* compute hash */
p = (const unsigned char *)atom;
hash = HashFunction(p) % AtomHashTableSize;
/* ask for a WRITE lock because it is highly unlikely we shall find anything */
/* ask for a WRITE lock because it is highly unlikely we shall find anything
*/
WRITE_LOCK(HashChain[hash].AERWLock);
a = HashChain[hash].Entry;
/* search atom in chain */
if (SearchAtom(p, a) != NIL) {
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"repeated initialisation for atom %s", ae);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
"repeated initialization for atom %s", ae);
WRITE_UNLOCK(HashChain[hash].AERWLock);
return;
}
@ -422,9 +401,7 @@ Yap_LookupAtomWithAddress(const char *atom,
WRITE_UNLOCK(HashChain[hash].AERWLock);
}
void
Yap_ReleaseAtom(Atom atom)
{ /* Releases an atom from the hash chain */
void Yap_ReleaseAtom(Atom atom) { /* Releases an atom from the hash chain */
register Int hash;
register const unsigned char *p;
AtomEntry *inChain;
@ -452,8 +429,8 @@ Yap_ReleaseAtom(Atom atom)
}
static Prop
GetAPropHavingLock(AtomEntry *ae, PropFlags kind)
{ /* look property list of atom a for kind */
GetAPropHavingLock(AtomEntry *ae,
PropFlags kind) { /* look property list of atom a for kind */
PropEntry *pp;
pp = RepProp(ae->PropsOfAE);
@ -462,15 +439,13 @@ GetAPropHavingLock(AtomEntry *ae, PropFlags kind)
return (AbsProp(pp));
}
Prop
Yap_GetAPropHavingLock(AtomEntry *ae, PropFlags kind)
{ /* look property list of atom a for kind */
Prop Yap_GetAPropHavingLock(
AtomEntry *ae, PropFlags kind) { /* look property list of atom a for kind */
return GetAPropHavingLock(ae, kind);
}
static Prop
GetAProp(Atom a, PropFlags kind)
{ /* look property list of atom a for kind */
GetAProp(Atom a, PropFlags kind) { /* look property list of atom a for kind */
AtomEntry *ae = RepAtom(a);
Prop out;
@ -480,22 +455,19 @@ GetAProp(Atom a, PropFlags kind)
return (out);
}
Prop
Yap_GetAProp(Atom a, PropFlags kind)
{ /* look property list of atom a for kind */
Prop Yap_GetAProp(Atom a,
PropFlags kind) { /* look property list of atom a for kind */
return GetAProp(a, kind);
}
OpEntry *
Yap_GetOpPropForAModuleHavingALock(Atom a, Term mod)
{ /* look property list of atom a for kind */
OpEntry *Yap_GetOpPropForAModuleHavingALock(
Atom a, Term mod) { /* look property list of atom a for kind */
AtomEntry *ae = RepAtom(a);
PropEntry *pp;
pp = RepProp(ae->PropsOfAE);
while (!EndOfPAEntr(pp) &&
(pp->KindOfPE != OpProperty ||
((OpEntry *)pp)->OpModule != mod))
(pp->KindOfPE != OpProperty || ((OpEntry *)pp)->OpModule != mod))
pp = RepProp(pp->NextOfPE);
if (EndOfPAEntr(pp)) {
return NULL;
@ -503,16 +475,13 @@ Yap_GetOpPropForAModuleHavingALock(Atom a, Term mod)
return (OpEntry *)pp;
}
int
Yap_HasOp(Atom a)
{ /* look property list of atom a for kind */
int Yap_HasOp(Atom a) { /* look property list of atom a for kind */
AtomEntry *ae = RepAtom(a);
PropEntry *pp;
READ_LOCK(ae->ARWLock);
pp = RepProp(ae->PropsOfAE);
while (!EndOfPAEntr(pp) &&
( pp->KindOfPE != OpProperty))
while (!EndOfPAEntr(pp) && (pp->KindOfPE != OpProperty))
pp = RepProp(pp->NextOfPE);
READ_UNLOCK(ae->ARWLock);
if (EndOfPAEntr(pp)) {
@ -523,8 +492,8 @@ Yap_HasOp(Atom a)
}
OpEntry *
Yap_OpPropForModule(Atom a, Term mod)
{ /* look property list of atom a for kind */
Yap_OpPropForModule(Atom a,
Term mod) { /* look property list of atom a for kind */
AtomEntry *ae = RepAtom(a);
PropEntry *pp;
OpEntry *info = NULL;
@ -561,8 +530,9 @@ Yap_OpPropForModule(Atom a, Term mod)
}
OpEntry *
Yap_GetOpProp(Atom a, op_type type USES_REGS)
{ /* look property list of atom a for kind */
Yap_GetOpProp(Atom a,
op_type type
USES_REGS) { /* look property list of atom a for kind */
AtomEntry *ae = RepAtom(a);
PropEntry *pp;
OpEntry *oinfo = NULL;
@ -576,8 +546,7 @@ Yap_GetOpProp(Atom a, op_type type USES_REGS)
continue;
}
info = (OpEntry *)pp;
if (info->OpModule != CurrentModule &&
info->OpModule != PROLOG_MODULE) {
if (info->OpModule != CurrentModule && info->OpModule != PROLOG_MODULE) {
pp = RepProp(pp->NextOfPE);
continue;
}
@ -617,9 +586,7 @@ Yap_GetOpProp(Atom a, op_type type USES_REGS)
return NULL;
}
inline static Prop
GetPredPropByAtomHavingLock(AtomEntry* ae, Term cur_mod)
inline static Prop GetPredPropByAtomHavingLock(AtomEntry *ae, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
@ -642,8 +609,7 @@ GetPredPropByAtomHavingLock(AtomEntry* ae, Term cur_mod)
return (NIL);
}
Prop
Yap_GetPredPropByAtom(Atom at, Term cur_mod)
Prop Yap_GetPredPropByAtom(Atom at, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
@ -655,9 +621,8 @@ Yap_GetPredPropByAtom(Atom at, Term cur_mod)
return (p0);
}
inline static Prop
GetPredPropByAtomHavingLockInThisModule(AtomEntry* ae, Term cur_mod)
inline static Prop GetPredPropByAtomHavingLockInThisModule(AtomEntry *ae,
Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
@ -679,8 +644,7 @@ GetPredPropByAtomHavingLockInThisModule(AtomEntry* ae, Term cur_mod)
return (NIL);
}
Prop
Yap_GetPredPropByAtomInThisModule(Atom at, Term cur_mod)
Prop Yap_GetPredPropByAtomInThisModule(Atom at, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
@ -692,9 +656,7 @@ Yap_GetPredPropByAtomInThisModule(Atom at, Term cur_mod)
return (p0);
}
Prop
Yap_GetPredPropByFunc(Functor f, Term cur_mod)
Prop Yap_GetPredPropByFunc(Functor f, Term cur_mod)
/* get predicate entry for ap/arity; */
{
Prop p0;
@ -706,8 +668,7 @@ Yap_GetPredPropByFunc(Functor f, Term cur_mod)
return (p0);
}
Prop
Yap_GetPredPropByFuncInThisModule(Functor f, Term cur_mod)
Prop Yap_GetPredPropByFuncInThisModule(Functor f, Term cur_mod)
/* get predicate entry for ap/arity; */
{
Prop p0;
@ -718,8 +679,7 @@ Yap_GetPredPropByFuncInThisModule(Functor f, Term cur_mod)
return (p0);
}
Prop
Yap_GetPredPropHavingLock(Atom ap, unsigned int arity, Term mod)
Prop Yap_GetPredPropHavingLock(Atom ap, unsigned int arity, Term mod)
/* get predicate entry for ap/arity; */
{
Prop p0;
@ -737,9 +697,7 @@ Yap_GetPredPropHavingLock(Atom ap, unsigned int arity, Term mod)
}
/* get expression entry for at/arity; */
Prop
Yap_GetExpProp(Atom at, unsigned int arity)
{
Prop Yap_GetExpProp(Atom at, unsigned int arity) {
Prop p0;
AtomEntry *ae = RepAtom(at);
ExpEntry *p;
@ -753,9 +711,7 @@ Yap_GetExpProp(Atom at, unsigned int arity)
}
/* get expression entry for at/arity, at is already locked; */
Prop
Yap_GetExpPropHavingLock(AtomEntry *ae, unsigned int arity)
{
Prop Yap_GetExpPropHavingLock(AtomEntry *ae, unsigned int arity) {
Prop p0;
ExpEntry *p;
@ -766,12 +722,11 @@ Yap_GetExpPropHavingLock(AtomEntry *ae, unsigned int arity)
return (p0);
}
static int
ExpandPredHash(void)
{
static int ExpandPredHash(void) {
UInt new_size = PredHashTableSize + PredHashIncrement;
PredEntry **oldp = PredHash;
PredEntry **np = (PredEntry **) Yap_AllocAtomSpace(sizeof(PredEntry **)*new_size);
PredEntry **np =
(PredEntry **)Yap_AllocAtomSpace(sizeof(PredEntry **) * new_size);
UInt i;
if (!np) {
@ -798,9 +753,7 @@ ExpandPredHash(void)
}
/* fe is supposed to be locked */
Prop
Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
{
Prop Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod) {
CACHE_REGS
PredEntry *p = (PredEntry *)Yap_AllocAtomSpace(sizeof(*p));
@ -889,18 +842,19 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
}
FUNC_WRITE_UNLOCK(fe);
{
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_FUNC);
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred) + 1, p,
GPROF_NEW_PRED_FUNC);
if (!(p->PredFlags & (CPredFlag | AsmPredFlag))) {
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_FUNC);
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode),
&(p->cs.p_code.ExpandCode) + 1, p,
GPROF_NEW_PRED_FUNC);
}
}
return AbsPredProp(p);
}
#if THREADS
Prop
Yap_NewThreadPred(PredEntry *ap USES_REGS)
{
Prop Yap_NewThreadPred(PredEntry *ap USES_REGS) {
PredEntry *p = (PredEntry *)Yap_AllocAtomSpace(sizeof(*p));
if (p == NULL) {
@ -933,23 +887,26 @@ Yap_NewThreadPred(PredEntry *ap USES_REGS)
p->NextOfPE = AbsPredProp(LOCAL_ThreadHandle.local_preds);
LOCAL_ThreadHandle.local_preds = p;
p->FunctorOfPred = ap->FunctorOfPred;
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_THREAD);
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred) + 1, p,
GPROF_NEW_PRED_THREAD);
if (falseGlobalPrologFlag(DEBUG_INFO_FLAG)) {
p->PredFlags |= (NoSpyPredFlag | NoTracePredFlag);
}
if (!(p->PredFlags & (CPredFlag | AsmPredFlag))) {
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_THREAD);
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode),
&(p->cs.p_code.ExpandCode) + 1, p,
GPROF_NEW_PRED_THREAD);
}
return AbsPredProp(p);
}
#endif
Prop
Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
{ Prop p0;
Prop Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod) {
Prop p0;
PredEntry *p = (PredEntry *)Yap_AllocAtomSpace(sizeof(*p));
/* Printf("entering %s:%s/0\n", RepAtom(AtomOfTerm(cur_mod))->StrOfAE, ae->StrOfAE); */
/* Printf("entering %s:%s/0\n", RepAtom(AtomOfTerm(cur_mod))->StrOfAE,
* ae->StrOfAE); */
if (p == NULL) {
WRITE_UNLOCK(ae->ARWLock);
@ -1002,16 +959,18 @@ Yap_NewPredPropByAtom(AtomEntry *ae, Term cur_mod)
}
WRITE_UNLOCK(ae->ARWLock);
{
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_ATOM);
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred) + 1, p,
GPROF_NEW_PRED_ATOM);
if (!(p->PredFlags & (CPredFlag | AsmPredFlag))) {
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode), &(p->cs.p_code.ExpandCode)+1, p, GPROF_NEW_PRED_ATOM);
Yap_inform_profiler_of_clause(&(p->cs.p_code.ExpandCode),
&(p->cs.p_code.ExpandCode) + 1, p,
GPROF_NEW_PRED_ATOM);
}
}
return p0;
}
Prop
Yap_PredPropByFunctorNonThreadLocal(Functor f, Term cur_mod)
Prop Yap_PredPropByFunctorNonThreadLocal(Functor f, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
PredEntry *p;
@ -1022,9 +981,7 @@ Yap_PredPropByFunctorNonThreadLocal(Functor f, Term cur_mod)
if ((p->ModuleOfPred == cur_mod || !(p->ModuleOfPred))) {
/* don't match multi-files */
if (!(p->PredFlags & MultiFileFlag) ||
p->ModuleOfPred ||
!cur_mod ||
if (!(p->PredFlags & MultiFileFlag) || p->ModuleOfPred || !cur_mod ||
cur_mod == TermProlog) {
FUNC_WRITE_UNLOCK(f);
return AbsPredProp(p);
@ -1036,9 +993,7 @@ Yap_PredPropByFunctorNonThreadLocal(Functor f, Term cur_mod)
p = PredHash[hash];
while (p) {
if (p->FunctorOfPred == f &&
p->ModuleOfPred == cur_mod)
{
if (p->FunctorOfPred == f && p->ModuleOfPred == cur_mod) {
READ_UNLOCK(PredHashRWLock);
FUNC_WRITE_UNLOCK(f);
return AbsPredProp(p);
@ -1050,8 +1005,7 @@ Yap_PredPropByFunctorNonThreadLocal(Functor f, Term cur_mod)
return Yap_NewPredPropByFunctor(f, cur_mod);
}
Prop
Yap_PredPropByAtomNonThreadLocal(Atom at, Term cur_mod)
Prop Yap_PredPropByAtomNonThreadLocal(Atom at, Term cur_mod)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
@ -1064,9 +1018,7 @@ Yap_PredPropByAtomNonThreadLocal(Atom at, Term cur_mod)
if (pe->KindOfPE == PEProp &&
(pe->ModuleOfPred == cur_mod || !pe->ModuleOfPred)) {
/* don't match multi-files */
if (!(pe->PredFlags & MultiFileFlag) ||
pe->ModuleOfPred ||
!cur_mod ||
if (!(pe->PredFlags & MultiFileFlag) || pe->ModuleOfPred || !cur_mod ||
cur_mod == TermProlog) {
WRITE_UNLOCK(ae->ARWLock);
return (p0);
@ -1077,11 +1029,7 @@ Yap_PredPropByAtomNonThreadLocal(Atom at, Term cur_mod)
return Yap_NewPredPropByAtom(ae, cur_mod);
}
Term
Yap_GetValue(Atom a)
{
Term Yap_GetValue(Atom a) {
Prop p0 = GetAProp(a, ValProperty);
Term out;
@ -1111,9 +1059,7 @@ Yap_GetValue(Atom a)
return (out);
}
void
Yap_PutValue(Atom a, Term v)
{
void Yap_PutValue(Atom a, Term v) {
AtomEntry *ae = RepAtom(a);
Prop p0;
ValEntry *p;
@ -1157,7 +1103,8 @@ Yap_PutValue(Atom a, Term v)
if (IsApplTerm(t0)) {
Yap_FreeCodeSpace((char *)(RepAppl(t0)));
}
pt = (CELL *) Yap_AllocAtomSpace(sizeof(CELL)*(1 + 2*sizeof(Float)/sizeof(CELL)));
pt = (CELL *)Yap_AllocAtomSpace(sizeof(CELL) *
(1 + 2 * sizeof(Float) / sizeof(CELL)));
if (pt == NULL) {
WRITE_UNLOCK(ae->ARWLock);
return;
@ -1192,8 +1139,7 @@ Yap_PutValue(Atom a, Term v)
#ifdef USE_GMP
} else if (IsBigIntTerm(v)) {
CELL *ap = RepAppl(v);
Int sz =
sizeof(MP_INT)+sizeof(CELL)+
Int sz = sizeof(MP_INT) + sizeof(CELL) +
(((MP_INT *)(ap + 1))->_mp_alloc * sizeof(mp_limb_t));
CELL *pt = (CELL *)Yap_AllocAtomSpace(sz);
@ -1209,8 +1155,7 @@ Yap_PutValue(Atom a, Term v)
#endif
} else if (IsStringTerm(v)) {
CELL *ap = RepAppl(v);
Int sz =
sizeof(CELL)*(3+ap[1]);
Int sz = sizeof(CELL) * (3 + ap[1]);
CELL *pt = (CELL *)Yap_AllocAtomSpace(sz);
if (pt == NULL) {
@ -1232,9 +1177,7 @@ Yap_PutValue(Atom a, Term v)
WRITE_UNLOCK(p->VRWLock);
}
bool
Yap_PutAtomTranslation(Atom a, arity_t arity, Int i)
{
bool Yap_PutAtomTranslation(Atom a, arity_t arity, Int i) {
AtomEntry *ae = RepAtom(a);
Prop p0;
TranslationEntry *p;
@ -1258,9 +1201,7 @@ Yap_PutAtomTranslation(Atom a, arity_t arity, Int i)
return true;
}
bool
Yap_PutFunctorTranslation(Atom a, arity_t arity, Int i)
{
bool Yap_PutFunctorTranslation(Atom a, arity_t arity, Int i) {
AtomEntry *ae = RepAtom(a);
Prop p0;
TranslationEntry *p;
@ -1284,9 +1225,7 @@ Yap_PutFunctorTranslation(Atom a, arity_t arity, Int i)
return true;
}
bool
Yap_PutAtomMutex(Atom a, void * i)
{
bool Yap_PutAtomMutex(Atom a, void *i) {
AtomEntry *ae = RepAtom(a);
Prop p0;
MutexEntry *p;
@ -1309,9 +1248,7 @@ Yap_PutAtomMutex(Atom a, void * i)
return true;
}
Term
Yap_ArrayToList(register Term *tp, size_t nof)
{
Term Yap_ArrayToList(register Term *tp, size_t nof) {
CACHE_REGS
register Term *pt = tp + nof;
register Term t;
@ -1329,9 +1266,7 @@ Yap_ArrayToList(register Term *tp, size_t nof)
return (t);
}
int
Yap_GetName(char *s, UInt max, Term t)
{
int Yap_GetName(char *s, UInt max, Term t) {
register Term Head;
register Int i;
@ -1356,9 +1291,7 @@ Yap_GetName(char *s, UInt max, Term t)
#ifdef SFUNC
Term
MkSFTerm(Functor f, int n, Term *a, empty_value)
{
Term MkSFTerm(Functor f, int n, Term *a, empty_value) {
Term t, p = AbsAppl(H);
int i;
@ -1376,9 +1309,7 @@ MkSFTerm(Functor f, int n, Term *a, empty_value)
return (p);
}
CELL *
ArgsOfSFTerm(Term t)
{
CELL *ArgsOfSFTerm(Term t) {
CELL *p = RepAppl(t) + 1;
while (*p != (CELL)p)
@ -1388,10 +1319,7 @@ ArgsOfSFTerm(Term t)
#endif
static HoldEntry *
InitAtomHold(void)
{
static HoldEntry *InitAtomHold(void) {
HoldEntry *x = (HoldEntry *)Yap_AllocAtomSpace(sizeof(struct hold_entry));
if (x == NULL) {
return NULL;
@ -1402,17 +1330,14 @@ InitAtomHold(void)
return x;
}
int
Yap_AtomIncreaseHold(Atom at)
{
int Yap_AtomIncreaseHold(Atom at) {
AtomEntry *ae = RepAtom(at);
HoldEntry *pp;
Prop *opp = &(ae->PropsOfAE);
WRITE_LOCK(ae->ARWLock);
pp = RepHoldProp(ae->PropsOfAE);
while (!EndOfPAEntr(pp)
&& pp->KindOfPE != HoldProperty) {
while (!EndOfPAEntr(pp) && pp->KindOfPE != HoldProperty) {
opp = &(pp->NextOfPE);
pp = RepHoldProp(pp->NextOfPE);
}
@ -1430,17 +1355,14 @@ Yap_AtomIncreaseHold(Atom at)
return TRUE;
}
int
Yap_AtomDecreaseHold(Atom at)
{
int Yap_AtomDecreaseHold(Atom at) {
AtomEntry *ae = RepAtom(at);
HoldEntry *pp;
Prop *opp = &(ae->PropsOfAE);
WRITE_LOCK(ae->ARWLock);
pp = RepHoldProp(ae->PropsOfAE);
while (!EndOfPAEntr(pp)
&& pp->KindOfPE != HoldProperty) {
while (!EndOfPAEntr(pp) && pp->KindOfPE != HoldProperty) {
opp = &(pp->NextOfPE);
pp = RepHoldProp(pp->NextOfPE);
}
@ -1456,4 +1378,3 @@ Yap_AtomDecreaseHold(Atom at)
WRITE_UNLOCK(ae->ARWLock);
return TRUE;
}