swi compatibility support
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2294 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -10,8 +10,11 @@
|
||||
* File: c_interface.c *
|
||||
* comments: c_interface primitives definition *
|
||||
* *
|
||||
* Last rev: $Date: 2008-07-24 16:02:00 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2008-08-01 21:44:24 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.121 2008/07/24 16:02:00 vsc
|
||||
* improve C-interface and SWI comptaibility a bit.
|
||||
*
|
||||
* Revision 1.120 2008/07/11 17:02:07 vsc
|
||||
* fixes by Bart and Tom: mostly libraries but nasty one in indexing
|
||||
* compilation.
|
||||
@@ -476,6 +479,7 @@ X_API void *STD_PROTO(YAP_ExtraSpaceCut,(void));
|
||||
#endif
|
||||
X_API Term STD_PROTO(YAP_CurrentModule,(void));
|
||||
X_API Term STD_PROTO(YAP_CreateModule,(Atom));
|
||||
X_API Term STD_PROTO(YAP_StripModule,(Term, Term *));
|
||||
X_API int STD_PROTO(YAP_ThreadSelf,(void));
|
||||
X_API int STD_PROTO(YAP_GetThreadRefCount,(int));
|
||||
X_API void STD_PROTO(YAP_SetThreadRefCount,(int,int));
|
||||
@@ -2288,6 +2292,39 @@ YAP_CreateModule(Atom at)
|
||||
|
||||
}
|
||||
|
||||
X_API Term
|
||||
YAP_StripModule(Term t, Term *modp)
|
||||
{
|
||||
Term tmod;
|
||||
|
||||
tmod = CurrentModule;
|
||||
restart:
|
||||
if (IsVarTerm(t)) {
|
||||
return 0L;
|
||||
} else if (IsAtomTerm(t)) {
|
||||
*modp = tmod;
|
||||
return t;
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor fun = FunctorOfTerm(t);
|
||||
if (fun == FunctorModule) {
|
||||
tmod = ArgOfTerm(1, t);
|
||||
if (IsVarTerm(tmod) ) {
|
||||
return 0L;
|
||||
}
|
||||
if (!IsAtomTerm(tmod) ) {
|
||||
return 0L;
|
||||
}
|
||||
t = ArgOfTerm(2, t);
|
||||
goto restart;
|
||||
}
|
||||
*modp = tmod;
|
||||
return t;
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
|
||||
X_API int
|
||||
YAP_ThreadSelf(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user