export getval to C-code.
This commit is contained in:
parent
99948c5acc
commit
6ae0c450b3
24
C/globals.c
24
C/globals.c
@ -1398,6 +1398,30 @@ p_nb_getval( USES_REGS1 )
|
||||
}
|
||||
|
||||
|
||||
Term
|
||||
Yap_GetGlobal( Atom at )
|
||||
{
|
||||
CACHE_REGS
|
||||
GlobalEntry *ge;
|
||||
Term to;
|
||||
|
||||
ge = FindGlobalEntry(at PASS_REGS);
|
||||
if (!ge)
|
||||
return 0L;
|
||||
READ_LOCK(ge->GRWLock);
|
||||
to = ge->global;
|
||||
if (IsVarTerm(to) && IsUnboundVar(VarOfTerm(to))) {
|
||||
Term t = MkVarTerm();
|
||||
YapBind(VarOfTerm(to), t);
|
||||
to = t;
|
||||
}
|
||||
READ_UNLOCK(ge->GRWLock);
|
||||
if (to == TermFoundVar) {
|
||||
return 0;
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
static Int
|
||||
nbdelete(Atom at USES_REGS)
|
||||
{
|
||||
|
Reference in New Issue
Block a user