docd
This commit is contained in:
parent
d7c4ac95e0
commit
bdf7088665
147
C/errors.c
147
C/errors.c
@ -639,6 +639,69 @@ void Yap_ThrowExistingError(void) {
|
||||
Yap_exit(5);
|
||||
}
|
||||
|
||||
bool Yap_MkErrorRecord( yap_error_descriptor_t *r,
|
||||
const char *file, const char *function,
|
||||
int lineno, yap_error_number type, Term where,
|
||||
const char *s) {
|
||||
if (!Yap_pc_add_location(r, CP, B, ENV))
|
||||
Yap_env_add_location(r, CP, B, ENV, 0);
|
||||
if (where == 0L || where == TermNil||type==INSTANTIATION_ERROR) {
|
||||
r->culprit = NULL;
|
||||
} else {
|
||||
r->culprit = Yap_TermToBuffer(
|
||||
where, ENC_ISO_UTF8, Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||
}
|
||||
r->errorNo = type;
|
||||
r->errorAsText = Yap_errorName(type);
|
||||
r->errorClass = Yap_errorClass(type);
|
||||
r->classAsText =
|
||||
Yap_errorClassName(r->errorClass);
|
||||
r->errorLine = lineno;
|
||||
r->errorFunction = function;
|
||||
r->errorFile = file;
|
||||
Yap_prolog_add_culprit(r PASS_REGS1);
|
||||
LOCAL_PrologMode |= InErrorMode;
|
||||
Yap_ClearExs();
|
||||
// first, obtain current location
|
||||
// sprintf(LOCAL_FileNameBuf, "%s:%d in C-function %s ", file, lineno,
|
||||
// function);
|
||||
// tf = MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf));
|
||||
#if DEBUG_STRICT
|
||||
if (Yap_heap_regs && !(LOCAL_PrologMode & BootMode))
|
||||
fprintf(stderr, "***** Processing Error %d (%lx,%x) %s***\n", type,
|
||||
(unsigned long int)LOCAL_Signals, LOCAL_PrologMode, fmt);
|
||||
else
|
||||
fprintf(stderr, "***** Processing Error %d (%x) %s***\n", type,
|
||||
LOCAL_PrologMode, fmt);
|
||||
#endif
|
||||
if (r->errorNo == SYNTAX_ERROR) {
|
||||
r->errorClass = SYNTAX_ERROR_CLASS;
|
||||
} else if (r->errorNo == SYNTAX_ERROR_NUMBER) {
|
||||
r->errorClass = SYNTAX_ERROR_CLASS;
|
||||
r->errorNo = SYNTAX_ERROR;
|
||||
}
|
||||
if (type == INTERRUPT_EVENT) {
|
||||
fprintf(stderr, "%% YAP exiting: cannot handle signal %d\n",
|
||||
(int)IntOfTerm(where));
|
||||
Yap_exit(1);
|
||||
}
|
||||
// fprintf(stderr, "warning: ");
|
||||
if (s[0]) {
|
||||
r->errorMsgLen = strlen(s) + 1;
|
||||
r->errorMsg = malloc(r->errorMsgLen);
|
||||
strcpy(r->errorMsg, s);
|
||||
} else if (LOCAL_ErrorMessage && LOCAL_ErrorMessage[0]) {
|
||||
r->errorMsgLen = strlen(LOCAL_ErrorMessage) + 1;
|
||||
r->errorMsg = malloc(r->errorMsgLen);
|
||||
strcpy(r->errorMsg, LOCAL_ErrorMessage);
|
||||
} else {
|
||||
r->errorMsgLen = 0;
|
||||
r->errorMsg = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Yap_Error
|
||||
* This function handles errors in the C code. Check errors.yap for the
|
||||
@ -666,6 +729,7 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function,
|
||||
va_list ap;
|
||||
char *fmt;
|
||||
char s[MAXPATHLEN];
|
||||
|
||||
switch (type) {
|
||||
case SYSTEM_ERROR_INTERNAL: {
|
||||
fprintf(stderr, "%% Internal YAP Error: %s exiting....\n", tmpbuf);
|
||||
@ -737,71 +801,6 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function,
|
||||
LOCAL_PrologMode &= ~InErrorMode;
|
||||
return P;
|
||||
default:
|
||||
if (!Yap_pc_add_location(LOCAL_ActiveError, CP, B, ENV))
|
||||
Yap_env_add_location(LOCAL_ActiveError, CP, B, ENV, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
yap_error_number err = LOCAL_ActiveError->errorNo;
|
||||
/* disallow recursive error handling */
|
||||
if (LOCAL_PrologMode & InErrorMode && err) {
|
||||
fprintf(stderr, "%% ERROR %s %s WITHIN ERROR %s %s\n",
|
||||
Yap_errorClassName(Yap_errorClass(type)), Yap_errorName(type),
|
||||
Yap_errorClassName(Yap_errorClass(err)), Yap_errorName(err));
|
||||
return P;
|
||||
}
|
||||
if (LOCAL_PrologMode & BootMode || type == SYSTEM_ERROR_FATAL) {
|
||||
/* crash in flames! */
|
||||
fprintf(stderr,
|
||||
"%s:%d:0 YAP Fatal Error %d in function %s:\n %s exiting....\n",
|
||||
file, lineno, type, function, s);
|
||||
error_exit_yap(1);
|
||||
}
|
||||
if (LOCAL_DoingUndefp && type == EVALUATION_ERROR_UNDEFINED) {
|
||||
P = FAILCODE;
|
||||
CalculateStackGap(PASS_REGS1);
|
||||
return P;
|
||||
}
|
||||
if (where == 0L || where == TermNil||type==INSTANTIATION_ERROR) {
|
||||
LOCAL_ActiveError->culprit = NULL;
|
||||
} else {
|
||||
LOCAL_ActiveError->culprit = Yap_TermToBuffer(
|
||||
where, ENC_ISO_UTF8, Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||
}
|
||||
LOCAL_ActiveError->errorNo = type;
|
||||
LOCAL_ActiveError->errorAsText = Yap_errorName(type);
|
||||
LOCAL_ActiveError->errorClass = Yap_errorClass(type);
|
||||
LOCAL_ActiveError->classAsText =
|
||||
Yap_errorClassName(LOCAL_ActiveError->errorClass);
|
||||
LOCAL_ActiveError->errorLine = lineno;
|
||||
LOCAL_ActiveError->errorFunction = function;
|
||||
LOCAL_ActiveError->errorFile = file;
|
||||
Yap_prolog_add_culprit(LOCAL_ActiveError PASS_REGS1);
|
||||
LOCAL_PrologMode |= InErrorMode;
|
||||
Yap_ClearExs();
|
||||
// first, obtain current location
|
||||
// sprintf(LOCAL_FileNameBuf, "%s:%d in C-function %s ", file, lineno,
|
||||
// function);
|
||||
// tf = MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf));
|
||||
#if DEBUG_STRICT
|
||||
if (Yap_heap_regs && !(LOCAL_PrologMode & BootMode))
|
||||
fprintf(stderr, "***** Processing Error %d (%lx,%x) %s***\n", type,
|
||||
(unsigned long int)LOCAL_Signals, LOCAL_PrologMode, fmt);
|
||||
else
|
||||
fprintf(stderr, "***** Processing Error %d (%x) %s***\n", type,
|
||||
LOCAL_PrologMode, fmt);
|
||||
#endif
|
||||
if (LOCAL_ActiveError->errorNo == SYNTAX_ERROR) {
|
||||
LOCAL_ActiveError->errorClass = SYNTAX_ERROR_CLASS;
|
||||
} else if (LOCAL_ActiveError->errorNo == SYNTAX_ERROR_NUMBER) {
|
||||
LOCAL_ActiveError->errorClass = SYNTAX_ERROR_CLASS;
|
||||
LOCAL_ActiveError->errorNo = SYNTAX_ERROR;
|
||||
}
|
||||
if (type == INTERRUPT_EVENT) {
|
||||
fprintf(stderr, "%% YAP exiting: cannot handle signal %d\n",
|
||||
(int)IntOfTerm(where));
|
||||
Yap_exit(1);
|
||||
}
|
||||
va_start(ap, where);
|
||||
fmt = va_arg(ap, char *);
|
||||
if (fmt != NULL) {
|
||||
@ -810,21 +809,11 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function,
|
||||
#else
|
||||
(void)vsprintf(s, fmt, ap);
|
||||
#endif
|
||||
// fprintf(stderr, "warning: ");
|
||||
if (s[0]) {
|
||||
LOCAL_ActiveError->errorMsgLen = strlen(s) + 1;
|
||||
LOCAL_ActiveError->errorMsg = malloc(LOCAL_ActiveError->errorMsgLen);
|
||||
strcpy(LOCAL_ActiveError->errorMsg, s);
|
||||
} else if (LOCAL_ErrorMessage && LOCAL_ErrorMessage[0]) {
|
||||
LOCAL_ActiveError->errorMsgLen = strlen(LOCAL_ErrorMessage) + 1;
|
||||
LOCAL_ActiveError->errorMsg = malloc(LOCAL_ActiveError->errorMsgLen);
|
||||
strcpy(LOCAL_ActiveError->errorMsg, LOCAL_ErrorMessage);
|
||||
} else {
|
||||
LOCAL_ActiveError->errorMsgLen = 0;
|
||||
LOCAL_ActiveError->errorMsg = 0;
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Yap_MkErrorRecord(LOCAL_ActiveError, file, function, lineno, type, where, s);
|
||||
if (where == 0 || where == TermNil) {
|
||||
LOCAL_ActiveError->culprit = 0;
|
||||
}
|
||||
|
1
C/exec.c
1
C/exec.c
@ -54,7 +54,6 @@ static choiceptr cp_from_integer(Term cpt USES_REGS) {
|
||||
/**
|
||||
* Represents a choice-point as an offset to the top of local stack. This should
|
||||
* *be stable acroos gc or stack shifts.
|
||||
* @procedure Yap_cp_as_integer
|
||||
* @param cp pointer to choice-point
|
||||
* @return Term with offset
|
||||
*/
|
||||
|
156
CXX/yapi.cpp
156
CXX/yapi.cpp
@ -36,7 +36,7 @@ YAPPredicate::YAPPredicate(Term &t, Term &tmod, CELL *&ts, const char *pname) {
|
||||
ap = nullptr;
|
||||
restart:
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t0, pname);
|
||||
throw YAPError( SOURCE(), INSTANTIATION_ERROR, t0, pname);
|
||||
} else if (IsAtomTerm(t)) {
|
||||
ap = RepPredProp(Yap_GetPredPropByAtom(AtomOfTerm(t), tmod));
|
||||
ts = nullptr;
|
||||
@ -49,15 +49,15 @@ restart:
|
||||
} else if (IsApplTerm(t)) {
|
||||
Functor fun = FunctorOfTerm(t);
|
||||
if (IsExtensionFunctor(fun)) {
|
||||
Yap_Error(TYPE_ERROR_CALLABLE, Yap_PredicateIndicator(t, tmod), pname);
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_CALLABLE, Yap_PredicateIndicator(t, tmod), pname);
|
||||
}
|
||||
if (fun == FunctorModule) {
|
||||
tmod = ArgOfTerm(1, t);
|
||||
if (IsVarTerm(tmod)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, t0, pname);
|
||||
throw YAPError( SOURCE(), INSTANTIATION_ERROR, t0, pname);
|
||||
}
|
||||
if (!IsAtomTerm(tmod)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM, t0, pname);
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_ATOM, t0, pname);
|
||||
}
|
||||
t = ArgOfTerm(2, t);
|
||||
goto restart;
|
||||
@ -65,10 +65,33 @@ restart:
|
||||
ap = RepPredProp(Yap_GetPredPropByFunc(fun, tmod));
|
||||
ts = RepAppl(t) + 1;
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_CALLABLE, t0, pname);
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_CALLABLE, t0, pname);
|
||||
}
|
||||
}
|
||||
|
||||
Term YAPTerm::getArg(arity_t i) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term tf = 0;
|
||||
Term t0 = gt();
|
||||
|
||||
if (IsApplTerm(t0)) {
|
||||
if (i > ArityOfFunctor(FunctorOfTerm(t0)))
|
||||
throw YAPError( SOURCE(), DOMAIN_ERROR_OUT_OF_RANGE, t0, "t0.getArg()");
|
||||
tf = (ArgOfTerm(i, t0));
|
||||
} else if (IsPairTerm(t0)) {
|
||||
if (i == 1)
|
||||
tf = (HeadOfTerm(t0));
|
||||
else if (i == 2)
|
||||
tf = (TailOfTerm(t0));
|
||||
else
|
||||
throw YAPError( SOURCE(), DOMAIN_ERROR_OUT_OF_RANGE, t0, "t0.getArg()");
|
||||
} else {
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_COMPOUND, t0, "t0.getArg()");
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return tf;
|
||||
}
|
||||
|
||||
YAPAtomTerm::YAPAtomTerm(char s[]) { // build string
|
||||
BACKUP_H();
|
||||
|
||||
@ -242,7 +265,7 @@ Term &YAPTerm::operator[](arity_t i) {
|
||||
tf = RepPair(t0) + 1;
|
||||
RECOVER_MACHINE_REGS();
|
||||
} else {
|
||||
Yap_Error(TYPE_ERROR_COMPOUND, t0, "");
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_COMPOUND, t0, "");
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return *tf;
|
||||
@ -279,6 +302,24 @@ YAPPairTerm::YAPPairTerm() {
|
||||
RECOVER_H();
|
||||
}
|
||||
|
||||
std::vector<Term> YAPPairTerm::listToArray() {
|
||||
Term *tailp;
|
||||
Term t1 = gt();
|
||||
Int l = Yap_SkipList(&t1, &tailp);
|
||||
if (l < 0) {
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_LIST, (t), nullptr);
|
||||
}
|
||||
std::vector<Term> o = std::vector<Term>(l);
|
||||
int i = 0;
|
||||
Term t = gt();
|
||||
while (t != TermNil) {
|
||||
o[i++] = HeadOfTerm(t);
|
||||
t = TailOfTerm(t);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
YAP_tag_t YAPTerm::tag() {
|
||||
Term tt = gt();
|
||||
if (IsVarTerm(tt)) {
|
||||
@ -333,6 +374,16 @@ Term YAPTerm::deepCopy() {
|
||||
return (tn);
|
||||
}
|
||||
|
||||
Term YAPListTerm::cdr() {
|
||||
Term to = gt();
|
||||
if (IsPairTerm(to))
|
||||
return (TailOfTerm(to));
|
||||
else if (to == TermNil)
|
||||
return TermNil;
|
||||
/* error */
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_LIST, to, "");
|
||||
}
|
||||
|
||||
Term YAPListTerm::dup() {
|
||||
yhandle_t tn;
|
||||
BACKUP_MACHINE_REGS();
|
||||
@ -380,7 +431,7 @@ Term YAPListTerm::car() {
|
||||
if (IsPairTerm(to))
|
||||
return (HeadOfTerm(to));
|
||||
else {
|
||||
Yap_Error(TYPE_ERROR_LIST, to, "");
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_LIST, to, "");
|
||||
return TermUnique;
|
||||
}
|
||||
}
|
||||
@ -437,8 +488,8 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) {
|
||||
if (LOCAL_CommittedError != nullptr) {
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< YAPError( LOCAL_CommittedError).text() << ").\n Forwarded...\n\n";
|
||||
// Yap_PopTermFromDB(LOCAL_ActiveError->errorTerm);
|
||||
// throw YAPError();
|
||||
// Yap_PopTermFromDB(info->errorTerm);
|
||||
// throw throw YAPError( SOURCE(), );
|
||||
}
|
||||
Yap_CloseHandles(q.CurSlot);
|
||||
RECOVER_MACHINE_REGS();
|
||||
@ -454,6 +505,7 @@ bool YAPEngine::mgoal(Term t, Term tmod) {
|
||||
CACHE_REGS
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term *ts = nullptr;
|
||||
try {
|
||||
if (IsStringTerm(tmod))
|
||||
tmod = MkAtomTerm(Yap_LookupAtom(StringOfTerm(tmod)));
|
||||
PredEntry *ap = (new YAPPredicate(t, tmod, ts, "C++"))->ap;
|
||||
@ -480,17 +532,23 @@ bool YAPEngine::mgoal(Term t, Term tmod) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
|
||||
|
||||
result = (bool)YAP_EnterGoal(ap, nullptr, &q);
|
||||
if (LOCAL_CommittedError != nullptr) {
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< YAPError(LOCAL_CommittedError).text() << ").\n Forwarded...\n\n";
|
||||
if (LOCAL_CommittedError != nullptr &&
|
||||
LOCAL_CommittedError->errorNo != YAP_NO_ERROR) {
|
||||
throw YAPError( LOCAL_CommittedError);
|
||||
}
|
||||
|
||||
{
|
||||
YAP_LeaveGoal(result, &q);
|
||||
// PyEval_RestoreThread(_save);
|
||||
RECOVER_MACHINE_REGS();
|
||||
return result;
|
||||
}
|
||||
} catch ( ... ) {
|
||||
if (LOCAL_CommittedError != nullptr &&
|
||||
LOCAL_CommittedError->errorNo != YAP_NO_ERROR) {
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< YAPError( LOCAL_CommittedError).text() << ").\n Forwarded...\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void YAPEngine::release() {
|
||||
@ -527,7 +585,7 @@ Term YAPEngine::fun(Term t) {
|
||||
name = AtomDot;
|
||||
f = FunctorDot;
|
||||
} else {
|
||||
Yap_ThrowError(TYPE_ERROR_CALLABLE, t, 0);
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_CALLABLE, t, 0);
|
||||
return 0L;
|
||||
}
|
||||
XREGS[arity + 1] = MkVarTerm();
|
||||
@ -549,8 +607,8 @@ Term YAPEngine::fun(Term t) {
|
||||
if (LOCAL_CommittedError != nullptr) {
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< YAPError( LOCAL_CommittedError).text() << ").\n Forwarded...\n\n";
|
||||
// Yap_PopTermFromDB(LOCAL_ActiveError->errorTerm);
|
||||
// throw YAPError();
|
||||
// Yap_PopTermFromDB(info->errorTerm);
|
||||
// throw throw YAPError( SOURCE(), );
|
||||
}
|
||||
{
|
||||
YAP_LeaveGoal(result, &q);
|
||||
@ -668,15 +726,15 @@ bool YAPQuery::next() {
|
||||
Yap_CloseHandles(q_handles);
|
||||
q_open = false;
|
||||
if (LOCAL_CommittedError != nullptr) {
|
||||
// Yap_PopTermFromDB(LOCAL_ActiveError->errorTerm);
|
||||
// throw YAPError();
|
||||
// Yap_PopTermFromDB(info->errorTerm);
|
||||
// throw throw YAPError( );
|
||||
Term es[2];
|
||||
es[0] = TermError;
|
||||
es[1] = MkErrorTerm(LOCAL_CommittedError);
|
||||
Functor f = Yap_MkFunctor(Yap_LookupAtom("print_message"), 2);
|
||||
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
|
||||
// Yap_PopTermFromDB(LOCAL_ActiveError->errorTerm);
|
||||
// throw YAPError();
|
||||
// Yap_PopTermFromDB(info->errorTerm);
|
||||
// throw throw YAPError( SOURCE(), );
|
||||
}
|
||||
} else {
|
||||
q_handles = Yap_StartSlots();
|
||||
@ -806,7 +864,7 @@ void YAPEngine::doInit(YAP_file_type_t BootMode, YAPEngineArgs *engineArgs) {
|
||||
YAP_Init(engineArgs);
|
||||
/* Begin preprocessor code */
|
||||
/* live */
|
||||
// yerror = YAPError();
|
||||
// yerror = throw YAPError( SOURCE(), );
|
||||
#if YAP_PYTHON
|
||||
do_init_python();
|
||||
#endif
|
||||
@ -853,13 +911,15 @@ PredEntry *YAPPredicate::getPred(YAPTerm &tt, CELL *&outp) {
|
||||
CACHE_REGS
|
||||
Term m = Yap_CurrentModule(), t = tt.term();
|
||||
t = Yap_StripModule(t, &m);
|
||||
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< tt.text() << ").\n Forwarded...\n\n";
|
||||
|
||||
if (IsVarTerm(t) || IsNumTerm(t)) {
|
||||
if (IsVarTerm(t))
|
||||
Yap_ThrowError(INSTANTIATION_ERROR, tt.term(), 0);
|
||||
throw YAPError( SOURCE(), INSTANTIATION_ERROR, tt.term(), 0);
|
||||
else if (IsNumTerm(t))
|
||||
Yap_ThrowError(TYPE_ERROR_CALLABLE, tt.term(), 0);
|
||||
std::cerr << "Exception received by " << __func__ << "( "
|
||||
<< YAPTerm(tt).text() << ").\n Forwarded...\n\n";
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_CALLABLE, tt.term(), 0);
|
||||
}
|
||||
tt.put(t);
|
||||
if (IsAtomTerm(t)) {
|
||||
@ -878,7 +938,7 @@ PredEntry *YAPPredicate::getPred(YAPTerm &tt, CELL *&outp) {
|
||||
}
|
||||
Functor f = FunctorOfTerm(t);
|
||||
if (IsExtensionFunctor(f)) {
|
||||
Yap_ThrowError(TYPE_ERROR_CALLABLE, t, 0);
|
||||
throw YAPError( SOURCE(), TYPE_ERROR_CALLABLE, t, 0);
|
||||
} else {
|
||||
ap = RepPredProp(PredPropByFunc(f, m));
|
||||
outp = RepAppl(t) + 1;
|
||||
@ -943,34 +1003,41 @@ void *YAPPrologPredicate::retractClause(YAPTerm skeleton, bool all) {
|
||||
std::string YAPError::text() {
|
||||
char buf[256];
|
||||
std::string s = "";
|
||||
if (LOCAL_ActiveError->errorFunction) {
|
||||
s += LOCAL_ActiveError->errorFile;
|
||||
if (info->errorNo == YAP_NO_ERROR)
|
||||
return 0;
|
||||
if (info->errorFunction) {
|
||||
s += info->errorFile;
|
||||
s += ":";
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError->errorLine);
|
||||
sprintf(buf, "%ld", (long int)info->errorLine);
|
||||
s += buf;
|
||||
s += ":0 in C-code";
|
||||
}
|
||||
if (LOCAL_ActiveError->prologPredLine) {
|
||||
if (info->prologPredLine) {
|
||||
s += "\n";
|
||||
s += LOCAL_ActiveError->prologPredFile;
|
||||
s += info->prologPredFile;
|
||||
s += ":";
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError->prologPredLine);
|
||||
s += buf; // std::to_string(LOCAL_ActiveError->prologPredLine) ;
|
||||
// YAPIntegerTerm(LOCAL_ActiveError->prologPredLine).text();
|
||||
sprintf(buf, "%ld", (long int)info->prologPredLine);
|
||||
s += buf; // std::to_string(info->prologPredLine) ;
|
||||
// YAPIntegerTerm(info->prologPredLine).text();
|
||||
s += ":0 ";
|
||||
s += LOCAL_ActiveError->prologPredModule;
|
||||
s += info->prologPredModule;
|
||||
s += ":";
|
||||
s += (LOCAL_ActiveError->prologPredName);
|
||||
s += (info->prologPredName);
|
||||
s += "/";
|
||||
sprintf(buf, "%ld", (long int)LOCAL_ActiveError->prologPredArity);
|
||||
s += // std::to_string(LOCAL_ActiveError->prologPredArity);
|
||||
sprintf(buf, "%ld", (long int)info->prologPredArity);
|
||||
s += // std::to_string(info->prologPredArity);
|
||||
buf;
|
||||
}
|
||||
s += " error ";
|
||||
if (LOCAL_ActiveError->classAsText != nullptr)
|
||||
s += LOCAL_ActiveError->classAsText;
|
||||
if (info->classAsText == nullptr)
|
||||
info->classAsText = Yap_errorClassName(info->errorClass);
|
||||
if (info->classAsText != nullptr)
|
||||
s += info->classAsText;
|
||||
s += ".";
|
||||
s += LOCAL_ActiveError->errorAsText;
|
||||
if (info->errorAsText == nullptr)
|
||||
info->errorAsText = Yap_errorName(info->errorNo);
|
||||
if (info->errorAsText != nullptr)
|
||||
s += info->errorAsText;
|
||||
s += ".\n";
|
||||
// printf("%s\n", s.c_str());
|
||||
return s.c_str();
|
||||
@ -996,11 +1063,6 @@ void YAPEngine::reSet() {
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
|
||||
YAPError::YAPError(yap_error_number id, YAPTerm culprit, std::string txt) {
|
||||
ID = id;
|
||||
goal = culprit.text();
|
||||
info = txt;
|
||||
}
|
||||
|
||||
Term YAPEngine::top_level(std::string s) {
|
||||
/// parse string s and make term with var names
|
||||
@ -1010,7 +1072,7 @@ Term YAPEngine::top_level(std::string s) {
|
||||
ARG2 = tp;
|
||||
ARG3 = MkVarTerm();
|
||||
if (ARG1 == 0)
|
||||
Yap_Error(SYNTAX_ERROR, ARG1, "in input query");
|
||||
throw YAPError( SOURCE(), SYNTAX_ERROR, ARG1, "in input query");
|
||||
YAPPredicate p = YAPPredicate(YAP_TopGoal());
|
||||
YAPQuery *Q = new YAPQuery(p, 0);
|
||||
Term ts[2];
|
||||
|
@ -121,6 +121,7 @@ class YAPModule;
|
||||
class YAPError;
|
||||
class YAPPredicate;
|
||||
|
||||
|
||||
#include "yapa.hh"
|
||||
|
||||
#include "yapie.hh"
|
||||
|
64
CXX/yapie.hh
64
CXX/yapie.hh
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file yapie.hh
|
||||
*
|
||||
* @defgroup yap-cplus-error-hanadlinge Errir Handling in the YAP interface.
|
||||
* @defgroup yap-cplus-error-hanadlinge Error Handling in the YAP interface.
|
||||
*
|
||||
* @brief this is an attempt at supporting error
|
||||
* @brief error handling in C++ and OO languages
|
||||
*
|
||||
* @ingroup yap-cplus-interface
|
||||
* @tableofcontents
|
||||
*
|
||||
*
|
||||
* @{
|
||||
*
|
||||
@ -15,7 +15,7 @@
|
||||
* YAP itself. One can also define one's own error objects.
|
||||
*
|
||||
* Errors will be thrown from the `C++` code, and may be processed in
|
||||
* very different ways. The error object should provide as much data asa
|
||||
* very different ways. The error object should provide as much data as
|
||||
* possible.
|
||||
*/
|
||||
|
||||
@ -24,43 +24,65 @@
|
||||
#define YAPIE_HH
|
||||
|
||||
class X_API YAPPPredicate;
|
||||
class X_API YAPTerm;
|
||||
|
||||
|
||||
|
||||
/// take information on a Prolog error:
|
||||
class X_API YAPError {
|
||||
yap_error_number ID;
|
||||
std::string goal, info;
|
||||
int swigcode;
|
||||
yap_error_descriptor_t *info;
|
||||
|
||||
public:
|
||||
/// wraps the default error descriptor
|
||||
YAPError() {
|
||||
if (LOCAL_ActiveError == nullptr)
|
||||
return;
|
||||
ID = LOCAL_ActiveError->errorNo;
|
||||
if (ID != YAP_NO_ERROR) {};
|
||||
std::cerr << "Error detected" << ID << "\n";
|
||||
info = LOCAL_ActiveError;
|
||||
if (!info)
|
||||
LOCAL_ActiveError = info = (yap_error_descriptor_t *)calloc( sizeof( yap_error_descriptor_t ), 1);
|
||||
// if (info->errorNo != YAP_NO_ERROR) {};
|
||||
//std::cerr << "Error detected" << info->errorNo << "\n";
|
||||
}
|
||||
/// if des != nullptr, wrap a preexisting error descriptor;
|
||||
/// otherwise, generate a new one
|
||||
YAPError(yap_error_descriptor_t *des) {
|
||||
ID = des->errorNo;
|
||||
if (ID != YAP_NO_ERROR) {};
|
||||
std::cerr << "Error detected" << ID << "\n";
|
||||
if (des)
|
||||
info= des;
|
||||
else info = (yap_error_descriptor_t *)calloc( sizeof( yap_error_descriptor_t ), 1);
|
||||
// if (info->errorNo != YAP_NO_ERROR) {};
|
||||
//std::cerr << "Error detected" << info->errorNo << "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// error handler object with initial data when receiving the error term
|
||||
YAPError(yap_error_number id, YAPTerm culprit, std::string txt);
|
||||
// YAPError( std::string file, std::string function, int lineno,
|
||||
// yap_error_number id, YAPTerm culprit, std::string txt) {
|
||||
// info = new yap_error_descriptor_t;
|
||||
// Yap_MkErrorRecord(info, file.c_str(), function.c_str(), lineno, id, culprit.term(), txt.c_str());
|
||||
//}
|
||||
|
||||
/// error handler object with initial data when receiving the error term
|
||||
YAPError( const char * file, const char * function, int lineno,
|
||||
yap_error_number id, YAP_Term culprit, const char * txt) {
|
||||
info = (yap_error_descriptor_t *)calloc( sizeof( yap_error_descriptor_t ), 1);
|
||||
Yap_MkErrorRecord(info, file, function, lineno, id, culprit, txt);
|
||||
}
|
||||
|
||||
/// short version
|
||||
#define SOURCE() __FILE__, __FUNCTION__, __LINE__
|
||||
|
||||
/// we just know the error number
|
||||
/// exact error ID
|
||||
yap_error_number getID() { return LOCAL_ActiveError->errorNo; };
|
||||
yap_error_number getID() { return info->errorNo; };
|
||||
/// class of error
|
||||
yap_error_class_number getErrorClass() {
|
||||
return Yap_errorClass(LOCAL_ActiveError->errorNo);
|
||||
return Yap_errorClass(info->errorNo);
|
||||
};
|
||||
/// where in the code things happened;
|
||||
const char *getFile() { return LOCAL_ActiveError->errorFile; };
|
||||
const char *getFile() { return info->errorFile; };
|
||||
/// predicate things happened;
|
||||
Int getLine() { return LOCAL_ActiveError->errorLine; };
|
||||
Int getLine() { return info->errorLine; };
|
||||
/// the term that caused the bug
|
||||
// YAPTerm getCulprit(LOCAL_ActiveError->errorFile){};
|
||||
// YAPTerm getCulprit(info->errorFile){};
|
||||
/// text describing the Error
|
||||
std::string text();
|
||||
};
|
||||
|
50
CXX/yapt.hh
50
CXX/yapt.hh
@ -195,28 +195,7 @@ public:
|
||||
virtual bool isList() { return Yap_IsListTerm(gt()); } /// term is a list
|
||||
|
||||
/// extract the argument i of the term, where i in 1...arityvoid *Yap_RepStreamFromId(int sno)
|
||||
virtual Term getArg(arity_t i) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Term tf = 0;
|
||||
Term t0 = gt();
|
||||
|
||||
if (IsApplTerm(t0)) {
|
||||
if (i > ArityOfFunctor(FunctorOfTerm(t0)))
|
||||
YAPError(DOMAIN_ERROR_OUT_OF_RANGE, t0, "t0.getArg()");
|
||||
tf = (ArgOfTerm(i, t0));
|
||||
} else if (IsPairTerm(t0)) {
|
||||
if (i == 1)
|
||||
tf = (HeadOfTerm(t0));
|
||||
else if (i == 2)
|
||||
tf = (TailOfTerm(t0));
|
||||
else
|
||||
YAPError(DOMAIN_ERROR_OUT_OF_RANGE, t0, "t0.getArg()");
|
||||
} else {
|
||||
YAPError(TYPE_ERROR_COMPOUND, t0, "t0.getArg()");
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return tf;
|
||||
}
|
||||
virtual Term getArg(arity_t i);
|
||||
|
||||
/// extract the arity of the term
|
||||
/// variables have arity 0
|
||||
@ -375,22 +354,7 @@ public:
|
||||
YAPTerm car() { return YAPTerm(HeadOfTerm(gt())); }
|
||||
bool nil() { return gt() == TermNil; }
|
||||
YAPPairTerm cdr() { return YAPPairTerm(TailOfTerm(gt())); }
|
||||
std::vector<Term> listToArray() {
|
||||
Term *tailp;
|
||||
Term t1 = gt();
|
||||
Int l = Yap_SkipList(&t1, &tailp);
|
||||
if (l < 0) {
|
||||
throw YAPError(TYPE_ERROR_LIST, YAPTerm(t), "");
|
||||
}
|
||||
std::vector<Term> o = std::vector<Term>(l);
|
||||
int i = 0;
|
||||
Term t = gt();
|
||||
while (t != TermNil) {
|
||||
o[i++] = HeadOfTerm(t);
|
||||
t = TailOfTerm(t);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
std::vector<Term> listToArray();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -455,15 +419,7 @@ public:
|
||||
/// Extract the tail elements of a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
Term cdr() {
|
||||
Term to = gt();
|
||||
if (IsPairTerm(to))
|
||||
return (TailOfTerm(to));
|
||||
else if (to == TermNil)
|
||||
return TermNil;
|
||||
/* error */
|
||||
throw YAPError(TYPE_ERROR_LIST, YAPTerm(to), "");
|
||||
}
|
||||
Term cdr();
|
||||
/// copy a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
|
@ -239,9 +239,9 @@ Set or read system properties for _Param_:
|
||||
|
||||
|
||||
#define YAP_FLAG(ITEM, NAME, WRITABLE, DEF, INIT, HELPER) ITEM
|
||||
#define START_LOCAL_FLAGS enum {
|
||||
#define START_LOCAL_FLAGS enum THREAD_LOCAL_FLAGS {
|
||||
#define END_LOCAL_FLAGS };
|
||||
#define START_GLOBAL_FLAGS enum {
|
||||
#define START_GLOBAL_FLAGS enum GLOBAL_FLAGS {
|
||||
#define END_GLOBAL_FLAGS };
|
||||
|
||||
/* */
|
||||
@ -250,6 +250,7 @@ Set or read system properties for _Param_:
|
||||
/* Local flags */
|
||||
#include "YapLFlagInfo.h"
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
#undef YAP_FLAG
|
||||
#undef START_LOCAL_FLAGS
|
||||
@ -257,6 +258,8 @@ Set or read system properties for _Param_:
|
||||
#undef START_GLOBAL_FLAGS
|
||||
#undef END_GLOBAL_FLAGS
|
||||
|
||||
#endif
|
||||
|
||||
bool setYapFlag(Term tflag, Term t2);
|
||||
Term getYapFlag(Term tflag);
|
||||
|
||||
|
@ -17,11 +17,10 @@
|
||||
|
||||
/** @file YapGFlagInfo.h
|
||||
|
||||
@addtogroup YAPGFlags YAPGlobalFlags
|
||||
@ingroup builtins
|
||||
@addtogroup YAPFlags
|
||||
@{
|
||||
|
||||
@enum global_flags_setup Global Flags supported by YAP
|
||||
@enum GLOBAL_FLAGS Global Flags supported by YAP
|
||||
@brief global flags and their values.
|
||||
*/
|
||||
|
||||
|
@ -24,7 +24,8 @@
|
||||
@{
|
||||
|
||||
|
||||
@enum local_flags_setup thread-local flag:
|
||||
@enum THREAD_LOCAL_FLAGS Local Flags supported by YAP
|
||||
@brief local flags and their values.
|
||||
*/
|
||||
|
||||
START_LOCAL_FLAGS
|
||||
|
@ -354,10 +354,8 @@ typedef enum {
|
||||
YAP_STRING_INT = 0x40, /// target is an integer term
|
||||
YAP_STRING_FLOAT = 0x80, /// target is a floar term
|
||||
YAP_STRING_BIG = 0x100, /// target is an big num term
|
||||
YAP_STRING_DATUM =
|
||||
0x200, /// associated with previous 3, use actual object if type, not tern
|
||||
YAP_STRING_LENGTH =
|
||||
0x400, /// input: length is fixed; output: return integer with length
|
||||
YAP_STRING_DATUM = 0x200, /// associated with previous 3, use actual object if type, not tern
|
||||
YAP_STRING_LENGTH = 0x400, /// input: length is fixed; output: return integer with length
|
||||
YAP_STRING_NTH = 0x800, /// input: ignored; output: nth char
|
||||
YAP_STRING_TERM = 0x1000, // Generic term, if nothing else given
|
||||
YAP_STRING_DIFF = 0x2000, // difference list
|
||||
|
@ -59,12 +59,19 @@ ${CMAKE_SOURCE_DIR}/packages/prosqlite
|
||||
${CMAKE_SOURCE_DIR}/packages/pyswip
|
||||
${CMAKE_SOURCE_DIR}/packages/yap-lbfgs/liblbfgs-1.10
|
||||
${CMAKE_SOURCE_DIR}/library/dialect/swi/os
|
||||
${CMAKE_SOURCE_DIR}/packages/python
|
||||
${CMAKE_SOURCE_DIR}/*/bprolog/*
|
||||
${CMAKE_SOURCE_DIR}/*/prism/*
|
||||
${CMAKE_SOURCE_DIR}/*/gecodde/[345]*
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode3_yap.cc
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode4_yap.cc
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode5_yap.cc
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode3.yap
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode4.yap
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode5.yap
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode3_yap_hand_written.yap
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode4_yap_hand_written.yap
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/gecode5_yap_hand_written.yap
|
||||
*/CMakeFiles/* *~ */#*
|
||||
|
||||
)
|
||||
@ -97,6 +104,7 @@ endforeach(i ${DOCS_EXCLUDE_})
|
||||
${CMAKE_SOURCE_DIR}/os
|
||||
${CMAKE_SOURCE_DIR}/library
|
||||
${CMAKE_SOURCE_DIR}/swi/library
|
||||
${CMAKE_SOURCE_DIR}/packages
|
||||
)
|
||||
|
||||
foreach(i ${DOC_INPUT_FILES_})
|
||||
|
@ -98,7 +98,7 @@ OUTPUT_LANGUAGE = English
|
||||
# documentation (similar to Javadoc). Set to NO to disable this.
|
||||
# The default value is: YES.
|
||||
|
||||
BRIEF_MEMBER_DESC = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
|
||||
# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
|
||||
# description of a member or function before the detailed description
|
||||
@ -107,7 +107,7 @@ BRIEF_MEMBER_DESC = NO
|
||||
# brief descriptions will be completely suppressed.
|
||||
# The default value is: YES.
|
||||
|
||||
REPEAT_BRIEF = NO
|
||||
REPEAT_BRIEF = YES
|
||||
|
||||
# This tag implements a quasi-intelligent brief description abbreviator that is
|
||||
# used to form the text in various listings. Each string in this list, if found
|
||||
@ -900,14 +900,7 @@ EXCLUDE_SYMLINKS = NO
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS = @PROJECT_SOURCE_DIR@/*/bprolog/* \
|
||||
@PROJECT_SOURCE_DIR@/*/prism/* \
|
||||
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap.cc \
|
||||
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3.yap \
|
||||
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4.yap \
|
||||
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3_yap_hand_written.yap \
|
||||
\ \
|
||||
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap_hand_written.yap
|
||||
EXCLUDE_PATTERNS = @DOCS_EXCLUDE@
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
@ -2071,7 +2064,7 @@ ENABLE_PREPROCESSING = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
MACRO_EXPANSION = NO
|
||||
MACRO_EXPANSION = YES
|
||||
|
||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
|
||||
# the macro expansion is limited to the macros specified with the PREDEFINED and
|
||||
@ -2079,14 +2072,14 @@ MACRO_EXPANSION = NO
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
|
||||
# If the SEARCH_INCLUDES tag is set to YES, the include files in the
|
||||
# INCLUDE_PATH will be searched if a #include is found.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
SEARCH_INCLUDES = YES
|
||||
SEARCH_INCLUDES = NO
|
||||
|
||||
# The INCLUDE_PATH tag can be used to specify one or more directories that
|
||||
# contain include files that are not input files but should be processed by the
|
||||
@ -2117,6 +2110,19 @@ INCLUDE_FILE_PATTERNS =
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED =
|
||||
YAP_FLAG(ITEM,NAME,WRITABLE,DEF,INIT,HELPER)=ITEM \
|
||||
START_LOCAL_FLAGS="enum THREAD_LOCAL_FLAGS {" \
|
||||
END_LOCAL_FLAGS=" };"\
|
||||
START_GLOBAL_FLAGS="enum GLOBAL_FLAGS {" \
|
||||
END_GLOBAL_FLAGS="};" \
|
||||
LOCAL(A, B)="A B" \
|
||||
LOCAL_INIT(A, B, C)="A B;B = C" \
|
||||
LOCAL_ARRAY(A, B, C)="A B[C]" \
|
||||
LOCAL_ARRAY_ARRAY(A, B, C,D)="A B[C][D]"\
|
||||
LOCAL_INIT(A, B, C, D)="A B[C][D]"\
|
||||
LOCAL_INITF(A, B, C)=" A B; C"\
|
||||
LOCAL_INIT_RESTORE(A,B,C,D)="A B; C; D;"\
|
||||
PREG=Yap_REGS.P_
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
|
@ -60,7 +60,7 @@ $( document ).ready(function() {
|
||||
$('div.fragment.well div.line:last').css('margin-bottom', '15px');
|
||||
|
||||
$('table.doxtable').removeClass('doxtable').addClass('table table-striped table-bordered table-small;').each(function(){
|
||||
$(this).prepend('<thead></thead>');
|
||||
$(this).prepend('<thead><th scope="col">first</th><th scope="col">Last</th>s</thead>');
|
||||
$(this).find('tbody > tr:first').prependTo($(this).find('thead'));
|
||||
$(this).bootstrapTable('remove', {class: 'separator'});
|
||||
$(this).find('td > span.success').parent().addClass('success');
|
||||
|
@ -1,12 +1,11 @@
|
||||
lDownloading and Installing YAP {#INSTALL}
|
||||
Downloading and Installing YAP {#INSTALL}
|
||||
===========================
|
||||
|
||||
This text includes instructions to download and install YAP.
|
||||
|
||||
[TOC]
|
||||
|
||||
Downloading YAP {#Download}
|
||||
----------------
|
||||
## Downloading YAP {#Download}
|
||||
|
||||
The latest development version of Yap-6 is available source-only
|
||||
through GIT repositories. The main reference repository is at
|
||||
@ -32,7 +31,10 @@ The first argument is the repository, the last argument is the (optional) target
|
||||
It may be useful to know:
|
||||
|
||||
+ If you are have limited bandwith or disk spaceq, consider using
|
||||
`git clone --depth XX` to only include the last `XX` commits.
|
||||
~~~~~
|
||||
git clone --depth XX
|
||||
~~~~~
|
||||
to only include the last `XX` commits.
|
||||
|
||||
+ Older versions of YAP were distributed with modules. YAP-6.3.5 is
|
||||
a single package, and it does not need `git submodule`.
|
||||
@ -42,16 +44,16 @@ It may be useful to know:
|
||||
version of doxygen adapted to Prolog that was used to generate
|
||||
these documents.
|
||||
|
||||
Compiling YAP {#CompilingYAP}
|
||||
----------------
|
||||
## CompilingYAP Compiling YAP
|
||||
|
||||
|
||||
YAP-6.3.4 is a [cmake](www.cmake.org) based
|
||||
system. We use `cmake` because it supports mosts popular software, can
|
||||
generate Makefiles, Ninja, Apple's XCode, VisualStudio and ANdroid
|
||||
Studio, and because it includes packaging suppport, The steps required
|
||||
to install core YAP under `cmake`:
|
||||
to install core YAP under `cmake` are presented in detail next.
|
||||
|
||||
### The compiler
|
||||
### Compilation The compiler
|
||||
|
||||
*Status as of early 2017*
|
||||
|
||||
@ -104,7 +106,7 @@ available at GitHub.
|
||||
|
||||
+ make sure to install Python-3, and not Python-2,
|
||||
|
||||
### Compile and Install
|
||||
### Compiling Compile and Install
|
||||
|
||||
1: Create a directory, say `Build` and `cd` to the directory (`cd Build`).
|
||||
*YAP should not be compiled at its rootxo directory, some packages do not allow for that.
|
||||
|
@ -1,7 +1,7 @@
|
||||
YAP packages {#packages}
|
||||
============
|
||||
|
||||
+ @subpage realxplxc
|
||||
+ @subpage realmd
|
||||
|
||||
+ @subpage BDDs
|
||||
|
||||
|
@ -241,7 +241,10 @@ INLINE_ONLY extern inline Term Yap_ensure_atom__(const char *fu, const char *fi,
|
||||
#define LOCAL_ErrorMessage LOCAL_ActiveError->errorMsg
|
||||
|
||||
extern void Yap_ThrowExistingError(void);
|
||||
|
||||
extern bool Yap_MkErrorRecord( yap_error_descriptor_t *r,
|
||||
const char *file, const char *function,
|
||||
int lineno, yap_error_number type, YAP_Term where,
|
||||
const char *msg);
|
||||
|
||||
extern yap_error_descriptor_t * Yap_pc_add_location(yap_error_descriptor_t *t, void *pc0, void *b_ptr0, void *env0);
|
||||
extern yap_error_descriptor_t *Yap_env_add_location(yap_error_descriptor_t *t,void *cp0, void * b_ptr0, void *env0, YAP_Int ignore_first);
|
||||
|
@ -5,7 +5,6 @@
|
||||
*
|
||||
* @brief Stub for maplist and friends
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@ -24,10 +23,9 @@
|
||||
]).
|
||||
|
||||
/**
|
||||
@defgroup apply_stub Apply Predicates
|
||||
|
||||
@ingroup library
|
||||
|
||||
@defgroup ApplyMaplist Appy Stub for maplist Predicates
|
||||
@ingroup maplist
|
||||
|
||||
@{
|
||||
|
||||
@ -37,14 +35,14 @@ predicate to all elements of a list.
|
||||
The apply library is a _stub_, it just forwards definitions to the
|
||||
@ref maplist library. The predicates forwarded are:
|
||||
|
||||
* maplist:maplist/2,
|
||||
* maplist:maplist/3,
|
||||
* maplist:maplist/4,
|
||||
* maplist:maplist/5,
|
||||
* maplist:include/3,
|
||||
* maplist:exclude/3,
|
||||
* maplist:partition/4,
|
||||
* maplist:partition/5
|
||||
* maplist/2,
|
||||
* maplist/3,
|
||||
* maplist/4,
|
||||
* maplist/5,
|
||||
* include/3,
|
||||
* exclude/3,
|
||||
* partition/4,
|
||||
* partition/5
|
||||
|
||||
*/
|
||||
|
||||
|
@ -6,11 +6,12 @@
|
||||
%% of a list or to all sub-terms of a term.
|
||||
|
||||
:- module(apply_macros, []).
|
||||
%% @namespace maplist
|
||||
|
||||
/**
|
||||
|
||||
@defgroup apply_macros Apply Interface to maplist
|
||||
@ingroup library
|
||||
@ingroup maplist
|
||||
@{
|
||||
|
||||
This library provides a SWI-compatible set of utilities for applying a
|
||||
@ -19,14 +20,15 @@ predicate to all elements of a list.
|
||||
The apply library just forwards
|
||||
definitions to the @ref maplist library, these include:
|
||||
|
||||
- maplist/2,
|
||||
- maplist/3,
|
||||
- maplist/4,
|
||||
- maplist/5,
|
||||
- include/3,
|
||||
- exclude/3,
|
||||
- partition/4,
|
||||
- partition/5
|
||||
|
||||
+ maplist/2,
|
||||
+ maplist/3,
|
||||
+ maplist/4,
|
||||
+ maplist/5,
|
||||
+ include/3,
|
||||
+ exclude/3,
|
||||
+ partition/4,
|
||||
+ partition/5
|
||||
|
||||
|
||||
*/
|
||||
|
@ -44,83 +44,6 @@
|
||||
sumnodes/4
|
||||
]).
|
||||
|
||||
/**
|
||||
* @defgroup maplist Map List and Term Operations
|
||||
* @ingroup library
|
||||
* @{
|
||||
*
|
||||
* This library provides a set of utilities for applying a predicate to
|
||||
* all elements of a list. They allow one to easily perform the most common do-loop constructs in Prolog.
|
||||
* To avoid performance degradation, each call creates an
|
||||
* equivalent Prolog program, without meta-calls, which is executed by
|
||||
* the Prolog engine instead. The library was based on code
|
||||
* by Joachim Schimpf and on code from SWI-Prolog, and it is also inspired by the GHC
|
||||
* libraries.
|
||||
*
|
||||
* The routines are available once included with the
|
||||
* `use_module(library(apply_macros))` command.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Examples:
|
||||
|
||||
~~~~
|
||||
|
||||
given the progran:
|
||||
|
||||
~~~~
|
||||
plus(X,Y,Z) :- Z is X + Y.
|
||||
|
||||
plus_if_pos(X,Y,Z) :- Y > 0, Z is X + Y.
|
||||
|
||||
vars(X, Y, [X|Y]) :- var(X), !.
|
||||
vars(_, Y, Y).
|
||||
|
||||
trans(TermIn, TermOut) :-
|
||||
nonvar(TermIn),
|
||||
TermIn =.. [p|Args],
|
||||
TermOut =..[q|Args], !.
|
||||
trans(X,X).
|
||||
~~~~
|
||||
%success
|
||||
|
||||
?- maplist(plus(1), [1,2,3,4], [2,3,4,5]).
|
||||
|
||||
?- checklist(var, [X,Y,Z]).
|
||||
|
||||
?- selectlist(<(0), [-1,0,1], [1]).
|
||||
|
||||
?- convlist(plus_if_pos(1), [-1,0,1], [2]).
|
||||
|
||||
?- sumlist(plus, [1,2,3,4], 1, 11).
|
||||
|
||||
?- maplist(mapargs(number_atom),[c(1),s(1,2,3)],[c('1'),s('1','2','3')]).
|
||||
~~~~
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/** @pred maplist( 2:Pred, + _List1_,+ _List2_)
|
||||
|
||||
Apply _Pred_ on all successive pairs of elements from
|
||||
_List1_ and
|
||||
_List2_. Fails if _Pred_ can not be applied to a
|
||||
pair. See the example above.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/** @pred maplist(3:Pred,+ List1,+ List2,+ List4)
|
||||
|
||||
Apply _Pred_ on all successive triples of elements from _List1_,
|
||||
_List2_ and _List3_. Fails if _Pred_ can not be applied to a
|
||||
triple. See the example above.
|
||||
|
||||
*/
|
||||
|
||||
:- meta_predicate
|
||||
selectlist(2,+,-),
|
||||
selectlist(3,+,+,-),
|
||||
@ -161,6 +84,73 @@ triple. See the example above.
|
||||
:- use_module(library(charsio), [format_to_chars/3, read_from_chars/2]).
|
||||
:- use_module(library(occurs), [sub_term/2]).
|
||||
|
||||
/**
|
||||
* @defgroup maplist Map List and Term Operations
|
||||
* @ingroup library
|
||||
* @{
|
||||
*
|
||||
* This library provides a set of utilities for applying a predicate to
|
||||
* all elements of a list. They allow one to easily perform the most common do-loop constructs in Prolog.
|
||||
* To avoid performance degradation, each call creates an
|
||||
* equivalent Prolog program, without meta-calls, which is executed by
|
||||
* the Prolog engine instead. The library was based on code
|
||||
* by Joachim Schimpf and on code from SWI-Prolog, and it is also inspired by the GHC
|
||||
* libraries.
|
||||
*
|
||||
* The routines are available once included with the
|
||||
* `use_module(library(maplist))` command.
|
||||
* Examples:
|
||||
*
|
||||
* ~~~~
|
||||
* plus(X,Y,Z) :- Z is X + Y.
|
||||
*
|
||||
* plus_if_pos(X,Y,Z) :- Y > 0, Z is X + Y.
|
||||
*
|
||||
* vars(X, Y, [X|Y]) :- var(X), !.
|
||||
* vars(_, Y, Y).
|
||||
*
|
||||
* trans(TermIn, TermOut) :-
|
||||
* nonvar(TermIn),
|
||||
* TermIn =.. [p|Args],
|
||||
* TermOut =..[q|Args], !.
|
||||
* trans(X,X).
|
||||
* ~~~~
|
||||
* %success
|
||||
*
|
||||
* ?- maplist(plus(1), [1,2,3,4], [2,3,4,5]).
|
||||
*
|
||||
* ?- checklist(var, [X,Y,Z]).
|
||||
*
|
||||
* ?- selectlist(<(0), [-1,0,1], [1]).
|
||||
*
|
||||
* ?- convlist(plus_if_pos(1), [-1,0,1], [2]).
|
||||
*
|
||||
* ?- sumlist(plus, [1,2,3,4], 1, 11).
|
||||
*
|
||||
* ?- maplist(mapargs(number_atom),[c(1),s(1,2,3)],[c('1'),s('1','2','3')]).
|
||||
* ~~~~
|
||||
*
|
||||
**/
|
||||
|
||||
/** @pred maplist( 2:Pred, + _List1_,+ _List2_)
|
||||
|
||||
Apply _Pred_ on all successive pairs of elements from
|
||||
_List1_ and
|
||||
_List2_. Fails if _Pred_ can not be applied to a
|
||||
pair. See the example above.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/** @pred maplist(3:Pred,+ List1,+ List2,+ List4)
|
||||
|
||||
Apply _Pred_ on all successive triples of elements from _List1_,
|
||||
_List2_ and _List3_. Fails if _Pred_ can not be applied to a
|
||||
triple. See the example above.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% Definitions for Metacalls
|
||||
|
@ -1,5 +1,7 @@
|
||||
site_name: 'YAP'
|
||||
theme: 'readthedocs'
|
||||
markdown_extensions:
|
||||
use_directory_urls: false
|
||||
plugins:
|
||||
- search
|
||||
- awesome-pages:
|
||||
|
@ -287,7 +287,8 @@ Instead of probabilities every fact has a t( ) prefix. The t stands for tunable
|
||||
~~~~
|
||||
t(0.5)::heads(_).
|
||||
~~~~
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
/** @defgroup ProbLogPredicates ProbLog Predicates
|
||||
@ingroup ProbLog1
|
||||
@ -300,7 +301,6 @@ In the description of the arguments of functors the following notation will be u
|
||||
+ a preceding minus sign will denote an "output argument"
|
||||
+ an argument with no preceding symbol can be used in both ways
|
||||
|
||||
@{
|
||||
|
||||
/**
|
||||
* @pred problog_max(+G, -Prob, -FactsUsed)
|
||||
@ -344,7 +344,6 @@ This predicate returns the lower and upper bound of the probability of achieving
|
||||
This predicate returns the lower bound of the probability of achieving the goal G obtained by cutting the sld tree at the given probability for each branch.
|
||||
*/
|
||||
|
||||
%% @}
|
||||
|
||||
/**
|
||||
@defgroup ProbLogParameterLearning ProbLog Parameter Learning Predicates
|
||||
@ -4188,3 +4187,4 @@ user:term_expansion(Term,ExpandedTerm) :-
|
||||
problog:term_expansion_intern(Term,Mod,ExpandedTerm).
|
||||
|
||||
%% @}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
|
||||
@file bdd.yap
|
||||
@file bdd/bdd.yap
|
||||
|
||||
@defgroup BDDsPL Binary Decision Diagrams and Friends
|
||||
@ingroup BDDs
|
||||
|
@ -68,6 +68,15 @@
|
||||
%% * Added initialization directives for saved-states
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%% @file chr_runtime.pl
|
||||
%% @brief CHR runtime
|
||||
|
||||
%% @namespace locked
|
||||
%% @brief internal CHR space
|
||||
|
||||
%% @namespace error_locked
|
||||
%% @brief internal CHR space
|
||||
|
||||
%% @addtogroup CHR_Rule_Types Rule Types
|
||||
%% @ingroup CHR
|
||||
%
|
||||
|
@ -29,6 +29,12 @@
|
||||
the GNU General Public License.
|
||||
*/
|
||||
|
||||
%% @file chr_swi.pl
|
||||
%% @brief CHR SWI specific
|
||||
|
||||
%% @namespace check
|
||||
%% @brief internal space
|
||||
|
||||
%% SWI begin
|
||||
%% @addtogroup CHR chr
|
||||
%% @ingroup packages
|
||||
|
@ -1341,3 +1341,6 @@ keep_list_(_, X) :-
|
||||
(Space += maximize(X,Y)) :- !, maximize(Space,X,Y).
|
||||
|
||||
(Space += keep(X)) :- !, keep_(Space,X).
|
||||
|
||||
%! @}
|
||||
|
||||
|
@ -1341,3 +1341,5 @@ keep_list_(_, X) :-
|
||||
(Space += maximize(X,Y)) :- !, maximize(Space,X,Y).
|
||||
|
||||
(Space += keep(X)) :- !, keep_(Space,X).
|
||||
|
||||
%! @}
|
||||
|
@ -1,3 +1,19 @@
|
||||
|
||||
/**
|
||||
* @file real.c
|
||||
* @date Sat May 19 13:44:04 2018
|
||||
*
|
||||
* @brief Prolog to R interface
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup realI Interface Prolog to R
|
||||
* @ brief How to call R from YAP
|
||||
* @ingroup realm
|
||||
* @{
|
||||
*/
|
||||
#define CSTACK_DEFNS
|
||||
#include "rconfig.h"
|
||||
#if HAVE_R_H || !defined(_YAP_NOT_INSTALLED_)
|
||||
@ -2210,3 +2226,5 @@ install_real(void) { /* FUNCTOR_dot2 = PL_new_functor(PL_new_atom("."), 2); */
|
||||
}
|
||||
|
||||
#endif /* R_H */
|
||||
/// @}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
The R Prolog Programming Interface {#realxplxc}
|
||||
===================================
|
||||
|
||||
@file real.md
|
||||
@author Nicos Angelopoulos
|
||||
@ -7,6 +5,10 @@ The R Prolog Programming Interface {#realxplxc}
|
||||
@version 1:0:4, 2013/12/25, sinter_class
|
||||
@license Perl Artistic License
|
||||
|
||||
@defgroup realmd The R Prolog Programming Interface
|
||||
@ingroup packages
|
||||
@{
|
||||
|
||||
+ @ref realpl
|
||||
|
||||
This library enables the communication with an R process started as a shared library.
|
||||
@ -42,7 +44,10 @@ The main modes for utilising the interface are
|
||||
|
||||
Pass Prolog data to R, pass R data to Prolog or assign an R expression to
|
||||
an assignable R expression.
|
||||
### Testing Real {#TestingR}
|
||||
|
||||
@defgroup TestingR Testing Real
|
||||
@ingroup realmd
|
||||
@{
|
||||
|
||||
There is a raft of examples packed in a single file that tests the library.
|
||||
|
||||
@ -53,7 +58,10 @@ There is a raft of examples packed in a single file that tests the library.
|
||||
|
||||
?- edit( pack(real/examples/for_real) ).
|
||||
~~~~
|
||||
### Prolog and R Syntax {#RSyntax}
|
||||
@}
|
||||
@defgroup RSyntax Prolog and R Syntax
|
||||
@ingroup realmd
|
||||
@{
|
||||
|
||||
There are syntactic conventions in R that make unparsable prolog code.
|
||||
Notably function and variable names are allowed to contain dots, square brackets are used
|
||||
@ -155,7 +163,11 @@ This is only advisable for short data structures. For instance,
|
||||
|
||||
Through this interface it is more convenient to be explicit about R chars by Prolog prepending
|
||||
atoms or codes with + as in the above example.
|
||||
### Examples {#RealExamples}
|
||||
|
||||
@}
|
||||
@defgroup RealExamples Examples
|
||||
@ingroup realmd
|
||||
@{
|
||||
|
||||
~~~~
|
||||
|
||||
@ -202,7 +214,12 @@ logical :-
|
||||
|
||||
~~~~
|
||||
|
||||
#### Info
|
||||
|
||||
@}
|
||||
@defgroup RealInfo Real Information
|
||||
@ingroup realmd
|
||||
@{
|
||||
|
||||
|
||||
@see http://stoics.org.uk/~nicos/sware/real
|
||||
@see pack(real/examples/for_real)
|
||||
@ -211,10 +228,233 @@ logical :-
|
||||
@see pack(real/doc/padl2013-real.pdf)
|
||||
@see http://www.r-project.org/
|
||||
|
||||
Also @subpaage yap-real describes the YAP specfic details in real.
|
||||
Also @ref yap-real describes the YAP specfic details in real.
|
||||
|
||||
@file real.md
|
||||
'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll@}
|
||||
@defgroup yap_real Development of real in YAP
|
||||
@ingroup realmd
|
||||
@{
|
||||
|
||||
*/Development of real in YAP (#yap_real)
|
||||
---------------------------
|
||||
|
||||
YAP includes a development version of real, designed to experiment
|
||||
with the internals of the implementation of R. It includes major
|
||||
@ -264,3 +504,6 @@ in~\cite{}. Their major differences:
|
||||
- Updates: Nicos Angelopoulos, Dec. 2013, March, 2014
|
||||
|
||||
- Updates: Vitor Santos Costa Dec. 2015
|
||||
|
||||
@}
|
||||
@}
|
||||
|
@ -14,7 +14,7 @@
|
||||
* @file real.pl
|
||||
* @brief Prolog component of r_interface
|
||||
* @defgroup realpl Prolog component of r_interface
|
||||
* @ingroup real
|
||||
* @ingroup realmd
|
||||
* @{
|
||||
* Initialization code and key predicares for R-Prolog interface.
|
||||
*
|
||||
@ -950,4 +950,5 @@ prolog:message( r_root ) -->
|
||||
|
||||
:- initialization( set_prolog_flag( double_quotes, string) ).
|
||||
|
||||
%%% @}
|
||||
%% @}
|
||||
|
||||
|
@ -278,3 +278,4 @@ print_param(Name,Value,Text,Dom) :-
|
||||
format(user,'~w~10+~w~19+~w~15+~w~30+~n',[Dom,Name,Value,Text]).
|
||||
|
||||
|
||||
%% @}
|
||||
|
@ -14,7 +14,7 @@
|
||||
@author L.Damas, V.S.Costa
|
||||
|
||||
@defgroup AbsoluteFileName File Name Resolution
|
||||
@ingroup builtins
|
||||
@ingroup load_files
|
||||
|
||||
Support for file name resolution through absolute_file_name/3 and
|
||||
friends. These utility built-ins describe a list of directories that
|
||||
|
@ -7,7 +7,9 @@
|
||||
* @brief support Prolog dialects
|
||||
*
|
||||
* @defgroup Dialects Compatibilty with other Prolog dialects
|
||||
* @ingroup builtins
|
||||
* @ingroup extensions
|
||||
* @{
|
||||
* @brief Prolog dialects
|
||||
*
|
||||
*/
|
||||
|
||||
@ -54,7 +56,7 @@ check_dialect(Dialect) :-
|
||||
check_dialect(Dialect) :-
|
||||
'$do_error'(domain_error(dialect,Dialect),(:- expects_dialect(Dialect))).
|
||||
|
||||
%% exists_source(+Source) is semidet.
|
||||
%% @pred exists_source(+Source) is semidet.
|
||||
%
|
||||
% True if Source (a term valid for load_files/2) exists. Fails
|
||||
% without error if this is not the case. The predicate is intended
|
||||
@ -77,8 +79,8 @@ exists_source(Source, Path) :-
|
||||
file_errors(fail)
|
||||
]).
|
||||
|
||||
%% source_exports(+Source, +Export) is semidet.
|
||||
%% source_exports(+Source, -Export) is nondet.
|
||||
%% @pred source_exports(+Source, +Export) is semidet.
|
||||
%% @pred source_exports(+Source, -Export) is nondet.
|
||||
%
|
||||
% True if Source exports Export. Fails without error if this is
|
||||
% not the case. See also exists_source/1.
|
||||
@ -93,7 +95,7 @@ source_exports(Source, Export) :-
|
||||
; lists:member(Export, Exports)
|
||||
).
|
||||
|
||||
%% open_source(+Source, -In:stream) is semidet.
|
||||
%% @pred open_source(+Source, -In:stream) is semidet.
|
||||
%
|
||||
% Open a source location.
|
||||
|
||||
@ -108,3 +110,5 @@ open_source(File, In) :-
|
||||
exports(In, Exports) :-
|
||||
read(In, Term),
|
||||
Term = (:- module(_Name, Exports)).
|
||||
|
||||
@}
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
/**
|
||||
* @defgroup DebSet Debugger Control
|
||||
* @ingroup builtins Deb_Interaction
|
||||
* @ingroup Deb_Interaction
|
||||
|
||||
@{
|
||||
The
|
||||
|
@ -16,7 +16,7 @@
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
* @file utils.yap
|
||||
* @file pl/utils.yap
|
||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP-2.lan>
|
||||
* @date Thu Oct 19 12:21:01 2017
|
||||
*
|
||||
|
@ -35,6 +35,12 @@
|
||||
* @defgroup ypp Yap PreProcessing
|
||||
* @ingroup library
|
||||
*
|
||||
* This program_continuation can be used as a preprocessor in the
|
||||
* style of the `C` language. Currently, it must be used through
|
||||
* ypp_consult and or ypp_reconsult.
|
||||
*
|
||||
* Notice that ypp uses `#` commands.
|
||||
*
|
||||
*/
|
||||
|
||||
%====================================================================================
|
||||
|
Reference in New Issue
Block a user