Add documentation
This commit is contained in:
95
C/attvar.c
95
C/attvar.c
@@ -30,9 +30,9 @@ static char SccsId[] = "%W% %G%";
|
||||
|
||||
/** @{ */
|
||||
|
||||
/** @defgroup Attribute_Variables_Builtins Implementation of Attribute
|
||||
/** @defgroup AttributeVariables_Builtins Implementation of Attribute
|
||||
Declarations
|
||||
@ingroup Attributed_Variables
|
||||
@ingroup AttributeVariables
|
||||
*/
|
||||
|
||||
#ifdef COROUTINING
|
||||
@@ -408,7 +408,7 @@ static Term GetAllAtts(attvar_record *attv) {
|
||||
return attv->Atts;
|
||||
}
|
||||
|
||||
static Int p_put_att(USES_REGS1) {
|
||||
static Int put_att(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -456,7 +456,7 @@ static Int p_put_att(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_put_att_term(USES_REGS1) {
|
||||
static Int put_att_term(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -486,7 +486,7 @@ static Int p_put_att_term(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_rm_att(USES_REGS1) {
|
||||
static Int rm_att(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -530,7 +530,7 @@ static Int p_rm_att(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_put_atts(USES_REGS1) {
|
||||
static Int put_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
|
||||
@@ -577,7 +577,7 @@ static Int p_put_atts(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_del_atts(USES_REGS1) {
|
||||
static Int del_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
Term otatts;
|
||||
@@ -604,7 +604,7 @@ static Int p_del_atts(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_del_all_atts(USES_REGS1) {
|
||||
static Int del_all_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
|
||||
@@ -618,7 +618,7 @@ static Int p_del_all_atts(USES_REGS1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int p_get_att(USES_REGS1) {
|
||||
static Int get_att(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -647,7 +647,7 @@ static Int p_get_att(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_free_att(USES_REGS1) {
|
||||
static Int free_att(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -674,7 +674,8 @@ static Int p_free_att(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_get_atts(USES_REGS1) {
|
||||
|
||||
static Int get_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -714,7 +715,7 @@ static Int p_get_atts(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_has_atts(USES_REGS1) {
|
||||
static Int has_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -738,7 +739,7 @@ static Int p_has_atts(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_bind_attvar(USES_REGS1) {
|
||||
static Int bind_attvar(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -755,7 +756,7 @@ static Int p_bind_attvar(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_unbind_attvar(USES_REGS1) {
|
||||
static Int unbind_attvar(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -772,7 +773,7 @@ static Int p_unbind_attvar(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_get_all_atts(USES_REGS1) {
|
||||
static Int get_all_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -800,7 +801,7 @@ static int ActiveAtt(Term tatt, UInt ar) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Int p_modules_with_atts(USES_REGS1) {
|
||||
static Int modules_with_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
/* if this is unbound, ok */
|
||||
@@ -835,7 +836,7 @@ static Int p_modules_with_atts(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_swi_all_atts(USES_REGS1) {
|
||||
static Int swi_all_atts(USES_REGS1) {
|
||||
/* receive a variable in ARG1 */
|
||||
Term inp = Deref(ARG1);
|
||||
Functor attf = FunctorAtt1;
|
||||
@@ -933,7 +934,7 @@ static Term AllAttVars(USES_REGS1) {
|
||||
}
|
||||
}
|
||||
|
||||
static Int p_all_attvars(USES_REGS1) {
|
||||
static Int all_attvars(USES_REGS1) {
|
||||
do {
|
||||
Term out;
|
||||
|
||||
@@ -956,23 +957,23 @@ static Int p_all_attvars(USES_REGS1) {
|
||||
|
||||
|
||||
*/
|
||||
static Int p_is_attvar(USES_REGS1) {
|
||||
static Int is_attvar(USES_REGS1) {
|
||||
Term t = Deref(ARG1);
|
||||
return (IsVarTerm(t) && IsAttVar(VarOfTerm(t)));
|
||||
}
|
||||
|
||||
/* check if we are not redoing effort */
|
||||
static Int p_attvar_bound(USES_REGS1) {
|
||||
static Int attvar_bound(USES_REGS1) {
|
||||
Term t = Deref(ARG1);
|
||||
return IsVarTerm(t) && IsAttachedTerm(t) &&
|
||||
!IsUnboundVar(&(RepAttVar(VarOfTerm(t))->Done));
|
||||
}
|
||||
|
||||
static Int p_void_term(USES_REGS1) { return Yap_unify(ARG1, TermVoidAtt); }
|
||||
static Int void_term(USES_REGS1) { return Yap_unify(ARG1, TermVoidAtt); }
|
||||
|
||||
static Int p_free_term(USES_REGS1) { return Yap_unify(ARG1, TermFreeTerm); }
|
||||
static Int free_term(USES_REGS1) { return Yap_unify(ARG1, TermFreeTerm); }
|
||||
|
||||
static Int p_fast_unify(USES_REGS1) {
|
||||
static Int fast_unify(USES_REGS1) {
|
||||
/*
|
||||
Case we want to unify two variables, but we do not
|
||||
think there is a point in waking them up
|
||||
@@ -995,11 +996,11 @@ static Int p_fast_unify(USES_REGS1) {
|
||||
|
||||
#else
|
||||
|
||||
static Int p_all_attvars(USES_REGS1) { return FALSE; }
|
||||
static Int all_attvars(USES_REGS1) { return FALSE; }
|
||||
|
||||
static Int p_is_attvar(USES_REGS1) { return FALSE; }
|
||||
static Int is_attvar(USES_REGS1) { return FALSE; }
|
||||
|
||||
static Int p_attvar_bound(USES_REGS1) { return FALSE; }
|
||||
static Int attvar_bound(USES_REGS1) { return FALSE; }
|
||||
|
||||
#endif /* COROUTINING */
|
||||
|
||||
@@ -1013,30 +1014,30 @@ void Yap_InitAttVarPreds(void) {
|
||||
GLOBAL_attas[attvars_ext].to_term_op = AttVarToTerm;
|
||||
GLOBAL_attas[attvars_ext].term_to_op = TermToAttVar;
|
||||
GLOBAL_attas[attvars_ext].mark_op = mark_attvar;
|
||||
Yap_InitCPred("get_att", 4, p_get_att, SafePredFlag);
|
||||
Yap_InitCPred("get_module_atts", 2, p_get_atts, SafePredFlag);
|
||||
Yap_InitCPred("has_module_atts", 2, p_has_atts, SafePredFlag);
|
||||
Yap_InitCPred("get_all_atts", 2, p_get_all_atts, SafePredFlag);
|
||||
Yap_InitCPred("get_all_swi_atts", 2, p_swi_all_atts, SafePredFlag);
|
||||
Yap_InitCPred("free_att", 3, p_free_att, SafePredFlag);
|
||||
Yap_InitCPred("put_att", 5, p_put_att, 0);
|
||||
Yap_InitCPred("put_att_term", 2, p_put_att_term, 0);
|
||||
Yap_InitCPred("put_module_atts", 2, p_put_atts, 0);
|
||||
Yap_InitCPred("del_all_module_atts", 2, p_del_atts, 0);
|
||||
Yap_InitCPred("del_all_atts", 1, p_del_all_atts, 0);
|
||||
Yap_InitCPred("rm_att", 4, p_rm_att, 0);
|
||||
Yap_InitCPred("bind_attvar", 1, p_bind_attvar, SafePredFlag);
|
||||
Yap_InitCPred("unbind_attvar", 1, p_unbind_attvar, SafePredFlag);
|
||||
Yap_InitCPred("modules_with_attributes", 2, p_modules_with_atts,
|
||||
Yap_InitCPred("get_att", 4, get_att, SafePredFlag);
|
||||
Yap_InitCPred("get_module_atts", 2, get_atts, SafePredFlag);
|
||||
Yap_InitCPred("has_module_atts", 2, has_atts, SafePredFlag);
|
||||
Yap_InitCPred("get_all_atts", 2, get_all_atts, SafePredFlag);
|
||||
Yap_InitCPred("get_all_swi_atts", 2, swi_all_atts, SafePredFlag);
|
||||
Yap_InitCPred("free_att", 3, free_att, SafePredFlag);
|
||||
Yap_InitCPred("put_att", 5, put_att, 0);
|
||||
Yap_InitCPred("put_att_term", 2, put_att_term, 0);
|
||||
Yap_InitCPred("put_module_atts", 2, put_atts, 0);
|
||||
Yap_InitCPred("del_all_module_atts", 2, del_atts, 0);
|
||||
Yap_InitCPred("del_all_atts", 1, del_all_atts, 0);
|
||||
Yap_InitCPred("rm_att", 4, rm_att, 0);
|
||||
Yap_InitCPred("bind_attvar", 1, bind_attvar, SafePredFlag);
|
||||
Yap_InitCPred("unbind_attvar", 1, unbind_attvar, SafePredFlag);
|
||||
Yap_InitCPred("modules_with_attributes", 2, modules_with_atts,
|
||||
SafePredFlag);
|
||||
Yap_InitCPred("void_term", 1, p_void_term, SafePredFlag);
|
||||
Yap_InitCPred("free_term", 1, p_free_term, SafePredFlag);
|
||||
Yap_InitCPred("fast_unify_attributed", 2, p_fast_unify, 0);
|
||||
Yap_InitCPred("void_term", 1, void_term, SafePredFlag);
|
||||
Yap_InitCPred("free_term", 1, free_term, SafePredFlag);
|
||||
Yap_InitCPred("fast_unify_attributed", 2, fast_unify, 0);
|
||||
#endif /* COROUTINING */
|
||||
Yap_InitCPred("all_attvars", 1, p_all_attvars, 0);
|
||||
Yap_InitCPred("all_attvars", 1, all_attvars, 0);
|
||||
CurrentModule = OldCurrentModule;
|
||||
Yap_InitCPred("attvar", 1, p_is_attvar, SafePredFlag | TestPredFlag);
|
||||
Yap_InitCPred("$att_bound", 1, p_attvar_bound, SafePredFlag | TestPredFlag);
|
||||
Yap_InitCPred("attvar", 1, is_attvar, SafePredFlag | TestPredFlag);
|
||||
Yap_InitCPred("$att_bound", 1, attvar_bound, SafePredFlag | TestPredFlag);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
@@ -15,7 +15,8 @@
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
/** @file flags.c
|
||||
|
||||
/** @file C/flags.c
|
||||
|
||||
@ingroup Flags
|
||||
@{
|
||||
|
23
C/globals.c
23
C/globals.c
@@ -19,8 +19,16 @@ static char SccsId[] = "%W% %G%";
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file globals.c
|
||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
||||
* @date Tue Nov 17 23:16:17 2015
|
||||
*
|
||||
* @brief support for backtrable and non-backtrackable variables in Prolog.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@file globals.c
|
||||
/**
|
||||
|
||||
@defgroup Global_Variables Global Variables
|
||||
@ingroup builtins
|
||||
@@ -1413,6 +1421,7 @@ Int Yap_DeleteGlobal(Atom at) {
|
||||
return nbdelete(at PASS_REGS);
|
||||
}
|
||||
|
||||
|
||||
static Int p_nb_delete(USES_REGS1) {
|
||||
Term t = Deref(ARG1);
|
||||
|
||||
@@ -1522,9 +1531,16 @@ static Int p_nb_create2(USES_REGS1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/// @{
|
||||
|
||||
/// @addtogroup nb
|
||||
|
||||
/* a non-backtrackable queue is a term of the form $array(Arena,Start,End,Size)
|
||||
* plus an Arena. */
|
||||
|
||||
|
||||
|
||||
static Int nb_queue(UInt arena_sz USES_REGS) {
|
||||
Term queue_arena, queue, ar[QUEUE_FUNCTOR_ARITY], *nar;
|
||||
Term t = Deref(ARG1);
|
||||
@@ -2542,6 +2558,8 @@ static Int p_nb_beam_size(USES_REGS1) {
|
||||
return Yap_unify(ARG2, qd[HEAP_SIZE]);
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
static Int cont_current_nb(USES_REGS1) {
|
||||
Int unif;
|
||||
GlobalEntry *ge = (GlobalEntry *)IntegerOfTerm(EXTRA_CBACK_ARG(1, 1));
|
||||
@@ -2760,6 +2778,8 @@ void Yap_InitGlobals(void) {
|
||||
Yap_InitCPred("nb_create", 4, p_nb_create2, 0L);
|
||||
Yap_InitCPredBack("$nb_current", 1, 1, init_current_nb, cont_current_nb,
|
||||
SafePredFlag);
|
||||
/// @{
|
||||
/// @addtogroup nb
|
||||
CurrentModule = GLOBALS_MODULE;
|
||||
Yap_InitCPred("nb_queue", 1, p_nb_queue, 0L);
|
||||
Yap_InitCPred("nb_queue", 2, p_nb_queue_sized, 0L);
|
||||
@@ -2792,6 +2812,7 @@ void Yap_InitGlobals(void) {
|
||||
Yap_InitCPred("nb_beam_check", 1, p_nb_beam_check, SafePredFlag);
|
||||
#endif
|
||||
Yap_InitCPred("nb_beam_size", 2, p_nb_beam_size, SafePredFlag);
|
||||
/// @}
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
||||
|
20
C/inlines.c
20
C/inlines.c
@@ -997,8 +997,24 @@ p_erroneous_call( USES_REGS1 )
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @genarg( ?_Index_, +_Term_ , -_Arg_ )
|
||||
*
|
||||
* Similar to arg/3, but it can also backtrack through _T_'s arguments, that is:
|
||||
|
||||
~~~~~~~~~
|
||||
?- arg:genarg(I, f(a,b), A).
|
||||
A = a,
|
||||
I = 1.
|
||||
;
|
||||
A = b,
|
||||
I = 2.
|
||||
~~~~~~~~~
|
||||
*
|
||||
* Note: SWI-Prolog defines arg/3 as genarg/3.
|
||||
*/
|
||||
static Int
|
||||
init_genarg( USES_REGS1 )
|
||||
genarg( USES_REGS1 )
|
||||
{ /* getarg(?Atom) */
|
||||
Term t0 = Deref(ARG1);
|
||||
Term t1 = Deref(ARG2);
|
||||
@@ -1110,7 +1126,7 @@ Yap_InitInlines(void)
|
||||
Yap_InitAsmPred("functor", 3, _functor, p_functor, 0);
|
||||
Yap_InitAsmPred("$label_ctl", 2, _p_label_ctl, p_erroneous_call, SafePredFlag);
|
||||
CurrentModule = ARG_MODULE;
|
||||
Yap_InitCPredBack("genarg", 3, 3, init_genarg, cont_genarg,SafePredFlag);
|
||||
Yap_InitCPredBack("genarg", 3, 3, genarg, cont_genarg,SafePredFlag);
|
||||
CurrentModule = cm;
|
||||
}
|
||||
|
||||
|
@@ -149,7 +149,12 @@ Yap_LoadForeignFile(char *file, int flags)
|
||||
}
|
||||
out = (void *)dlopen(LOCAL_FileNameBuf, flags);
|
||||
if (out == NULL) {
|
||||
Yap_Error(SYSTEM_ERROR_INTERNAL, ARG1, "dlopen failed for %s: %s\n", file, dlerror());
|
||||
char *m_os = dlerror();
|
||||
if (m_os) {
|
||||
LOCAL_ErrorMessage = dlerror();
|
||||
} else {
|
||||
LOCAL_ErrorMessage = "dlopen failed";
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user