Merge /home/vsc/yap

This commit is contained in:
Vitor Santos Costa 2018-06-27 23:27:08 +01:00
commit 1caeb168e9
34 changed files with 426 additions and 395 deletions

View File

@ -76,12 +76,13 @@ void *my_malloc(size_t sz) {
p = malloc(sz);
// Yap_DebugPuts(stderr,"gof\n");
if (Yap_do_low_level_trace)
if (Yap_do_low_level_trace) {
#if __ANDROID__
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "+ %d %p", write_malloc,p);
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "+ %d %p", write_malloc,p);
#else
fprintf(stderr, "+s %p\n @%p %ld\n", p, TR, LCL0 - (CELL *)LCL0);
fprintf(stderr, "+s %p\n @%p %ld\n", p, TR, LCL0 - (CELL *)LCL0);
#endif
}
return p;
}
@ -89,12 +90,12 @@ void *my_realloc(void *ptr, size_t sz) {
void *p;
p = realloc(ptr, sz);
if (Yap_do_low_level_trace)
//if (Yap_do_low_level_trace)
// fprintf(stderr, "+ %p -> %p : " Sizet_F "\n", ptr, p, sz);
// Yap_DebugPuts(stderr,"gof\n");
if (sz > 500 && write_malloc++ > 0)
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p",
write_malloc, p);
// if (sz > 500 && write_malloc++ > 0)
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p",
// write_malloc, p);
return p;
}
@ -102,9 +103,9 @@ void my_free(void *p) {
// printf("f %p\n",p);
if (Yap_do_low_level_trace)
fprintf(stderr, "- %p\n @%p %ld\n", p, TR, (long int)(LCL0 - (CELL *)B) );
if (write_malloc && write_malloc++ > 0)
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc,
p);
//if (write_malloc && write_malloc++ > 0)
// __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc,
// p);
free(p);
// Yap_DebugPuts(stderr,"gof\n");

View File

@ -2105,7 +2105,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
CACHE_REGS
int sno;
BACKUP_MACHINE_REGS();
char *fl = NULL;
const char *fl = NULL;
int lvl = push_text_stack();
if (mode == YAP_BOOT_MODE) {
mode = YAP_CONSULT_MODE; }
@ -2126,10 +2126,12 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
}
lvl = push_text_stack();
bool consulted = (mode == YAP_CONSULT_MODE);
char *d = Malloc(strlen(fl)+1);
strcpy(d,fl);
bool consulted = (mode == YAP_CONSULT_MODE);
sno = Yap_OpenStream(MkStringTerm(fl), "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
if (sno < 0 ||
!Yap_ChDir(dirname((char *)fl))) {
if (sno < 0 ||
!Yap_ChDir(dirname((char *)d))) {
pop_text_stack(lvl);
*full = NULL;
return -1;
@ -2167,12 +2169,16 @@ X_API FILE *YAP_TermToStream(Term t) {
X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
BACKUP_MACHINE_REGS();
Yap_CloseStream(sno);
Yap_ChDir(dirname(full));
int lvl = push_text_stack();
char *d = Malloc(strlen(full)+1);
strcpy(d,full);
Yap_ChDir(dirname(d));
if (osnop >= 0)
Yap_AddAlias(AtomLoopStream, *osnop);
Yap_end_consult();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s(%d), %d", full, *osnop, sno);
// LOCAL_CurSlot);
pop_text_stack(lvl);
RECOVER_MACHINE_REGS();
}

View File

@ -2043,7 +2043,7 @@ static Int p_compile(USES_REGS1) { /* '$compile'(+C,+Flags,+C0,-Ref) */
Yap_addclause(t, code_adr, t1, mod, &ARG5);
YAPLeaveCriticalSection();
}
if (LOCAL_ErrorMessage) {
if (LOCAL_ErrorMessage ) {
Yap_Error(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
YAPLeaveCriticalSection();
return false;

View File

@ -3575,7 +3575,7 @@ yamop *Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod,
cglobs.space_op->rnd1 = cglobs.space_used;
#ifdef DEBUG
if (GLOBAL_Option['g' - 96])
if (GLOBAL_Option['g' - 96] )
Yap_ShowCode(&cglobs.cint);
#endif
} else {

View File

@ -321,6 +321,8 @@ bool Yap_PrintWarning(Term twarning) {
CACHE_REGS
PredEntry *pred = RepPredProp(PredPropByFunc(
FunctorPrintMessage, PROLOG_MODULE)); // PROCEDURE_print_message2;
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " warning(%s)",
Yap_TermToBuffer(twarning, ENC_ISO_UTF8,Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f));
Term cmod = (CurrentModule == PROLOG_MODULE ? TermProlog : CurrentModule);
bool rc;
Term ts[2], err;
@ -334,7 +336,6 @@ bool Yap_PrintWarning(Term twarning) {
return false;
}
LOCAL_PrologMode |= InErrorMode;
LOCAL_DoingUndefp = true;
if (pred->OpcodeOfPred == UNDEF_OPCODE || pred->OpcodeOfPred == FAIL_OPCODE) {
fprintf(stderr, "warning message:\n");
Yap_DebugPlWrite(twarning);
@ -854,6 +855,7 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function,
if (LOCAL_delay)
return P;
if (LOCAL_DoingUndefp) {
LOCAL_DoingUndefp = false;
LOCAL_Signals = 0;
Yap_PrintWarning(MkErrorTerm(Yap_GetException(LOCAL_ActiveError)));
return P;
@ -872,6 +874,7 @@ static Int close_error(USES_REGS1) {
if (!LOCAL_CommittedError)
return true;
LOCAL_CommittedError->errorNo = YAP_NO_ERROR;
LOCAL_ErrorMessage = NULL;
free(LOCAL_CommittedError);
LOCAL_CommittedError = NULL;
return true;
@ -967,6 +970,7 @@ bool Yap_RaiseException(void) {
LOCAL_ActiveError->errorNo == YAP_NO_ERROR)
return false;
Yap_RestartYap(5);
return false;
//return Yap_JumpToEnv();
}
@ -1061,14 +1065,22 @@ yap_error_descriptor_t *event(Term t, yap_error_descriptor_t *i) {
yap_error_descriptor_t *Yap_UserError(Term t, yap_error_descriptor_t *i) {
Term n = t;
bool found = false, wellformed = true;
if (!IsApplTerm(t) || FunctorOfTerm(t) != FunctorError) {
LOCAL_Error_TYPE = THROW_EVENT;
LOCAL_ActiveError->errorClass = EVENT;
LOCAL_ActiveError->errorAsText = Yap_errorName(THROW_EVENT);
LOCAL_ActiveError->classAsText =
Yap_errorClassName(Yap_errorClass(THROW_EVENT));
LOCAL_ActiveError->errorRawTerm = Yap_SaveTerm(t);
LOCAL_ActiveError->culprit = NULL;
if (!IsApplTerm(t) || FunctorOfTerm(t) != FunctorError) {
LOCAL_Error_TYPE = THROW_EVENT;
LOCAL_ActiveError->errorClass = EVENT;
LOCAL_ActiveError->errorAsText = Yap_errorName(THROW_EVENT);
LOCAL_ActiveError->classAsText =
Yap_errorClassName(Yap_errorClass(THROW_EVENT));
LOCAL_ActiveError->errorRawTerm = Yap_SaveTerm(t);
LOCAL_ActiveError->culprit = NULL;
} else if (i->errorNo != YAP_NO_ERROR && i->errorNo != ERROR_EVENT) {
LOCAL_Error_TYPE = i->errorNo;
LOCAL_ActiveError->errorClass = Yap_errorClass(i->errorNo);
LOCAL_ActiveError->errorAsText = Yap_errorName(i->errorNo);
LOCAL_ActiveError->classAsText =
Yap_errorClassName(Yap_errorClass(i->errorNo));
LOCAL_ActiveError->errorRawTerm = Yap_SaveTerm(t);
LOCAL_ActiveError->culprit = NULL;
} else {
Term t1, t2;
t1 = ArgOfTerm(1, t);

View File

@ -1435,6 +1435,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
/* otherwise, SetDBForThrow will fail entering critical mode */
// LOCAL_ActiveError = err_info;
LOCAL_PrologMode = UserMode;
LOCAL_DoingUndefp = false;
/* find out where to cut to */
/* siglongjmp resets the TR hardware register */
/* TR and B are crucial, they might have been changed, or not */
@ -1464,6 +1465,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
getAtomicGlobalPrologFlag(ARITHMETIC_EXCEPTIONS_FLAG));
P = (yamop *)FAILCODE;
LOCAL_PrologMode = UserMode;
LOCAL_DoingUndefp = false;
Yap_CloseSlots(sls);
} break;
case 3: { /* saved state */
@ -1472,7 +1474,8 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
LOCAL_CBorder = OldBorder;
LOCAL_RestartEnv = sighold;
LOCAL_PrologMode = UserMode;
Yap_CloseSlots(sls);
LOCAL_DoingUndefp = false;
Yap_CloseSlots(sls);
return false;
}
case 4:
@ -1487,7 +1490,8 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
Yap_JumpToEnv();
}
LOCAL_PrologMode = UserMode;
P = (yamop *)FAILCODE;
LOCAL_DoingUndefp = false;
P = (yamop *)FAILCODE;
LOCAL_RestartEnv = sighold;
Yap_CloseSlots(sls);
pop_text_stack(i+1);
@ -2092,6 +2096,7 @@ static Int JumpToEnv(USES_REGS1) {
B = handler;
P = FAILCODE;
LOCAL_DoingUndefp = false;
return true;
}
@ -2110,6 +2115,9 @@ static Int jump_env(USES_REGS1) {
"throw/1 must be called instantiated");
}
// Yap_DebugPlWriteln(t);
// char *buf = Yap_TermToBuffer(t, ENC_ISO_UTF8,
// Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " throw(%s)", buf);
LOCAL_ActiveError = Yap_UserError(t0, LOCAL_ActiveError);
bool out = JumpToEnv(PASS_REGS1);
if (B != NULL && P == FAILCODE && B->cp_ap == NOCODE &&

View File

@ -1327,10 +1327,6 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
tarr->at = MkIntTerm(atol(YAP_NUMERIC_VERSION));
return true;
}
if (!strcmp(ss, "YAP_NUMERIC_VERSION")) {
tarr->at = MkIntTerm(atol(YAP_NUMERIC_VERSION));
return true;
}
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, TermNil,
"~s should be either true (on) or false (off)", s);
return false;

View File

@ -351,6 +351,11 @@ static inline void clean_dirty_tr(tr_fr_ptr TR0 USES_REGS) {
}
}
#define expand_stack(S0,SP,SF,TYPE) \
size_t sz = SF-S0, used = SP-S0; \
S0 = Realloc(S0, (1024+sz)*sizeof(TYPE) PASS_REGS); \
SP = S0+used; SF = S0+sz;
static int copy_complex_term(register CELL *pt0, register CELL *pt0_end,
int share, int copy_att_vars, CELL *ptf,
CELL *HLow USES_REGS) {
@ -365,6 +370,7 @@ static int copy_complex_term(register CELL *pt0, register CELL *pt0_end,
HB = HLow;
to_visit0 = to_visit;
to_visit_max = to_visit+1024;
loop:
while (pt0 < pt0_end) {
register CELL d0;
@ -384,8 +390,8 @@ loop:
*ptf = AbsPair(HR);
ptf++;
#ifdef RATIONAL_TREES
if (to_visit >= to_visit_max) {
goto heap_overflow;
if (to_visit >= to_visit_max-32) {
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
}
to_visit->start_cp = pt0;
to_visit->end_cp = pt0_end;
@ -397,8 +403,9 @@ loop:
to_visit++;
#else
if (pt0 < pt0_end) {
if (to_visit + 1 >= (CELL **)AuxSp) {
goto heap_overflow;
if (to_visit + 32 >= to_visit_max - 32) {
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
}
to_visit->start_cp = pt0;
to_visit->end_cp = pt0_end;
@ -496,7 +503,7 @@ loop:
/* store the terms to visit */
#ifdef RATIONAL_TREES
if (to_visit + 1 >= to_visit_max) {
goto heap_overflow;
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
}
to_visit->start_cp = pt0;
to_visit->end_cp = pt0_end;
@ -509,7 +516,7 @@ loop:
#else
if (pt0 < pt0_end) {
if (to_visit++ >= (CELL **)AuxSp) {
goto heap_overflow;
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
}
to_visit->start_cp = pt0;
to_visit->end_cp = pt0_end;
@ -617,25 +624,6 @@ overflow:
pop_text_stack(lvl);
return -1;
heap_overflow:
/* oops, we're in trouble */
HR = HLow;
/* we've done it */
/* restore our nice, friendly, term to its original state */
HB = HB0;
#ifdef RATIONAL_TREES
while (to_visit > to_visit0) {
to_visit--;
pt0 = to_visit->start_cp;
pt0_end = to_visit->end_cp;
ptf = to_visit->to;
*pt0 = to_visit->oldv;
}
#endif
reset_trail(TR0);
pop_text_stack(lvl);
return -2;
trail_overflow:
/* oops, we're in trouble */
HR = HLow;

View File

@ -656,7 +656,7 @@ static Int code_in_pred(PredEntry *pp, Atom *pat, UInt *parity,
PELOCK(40, pp);
/* check if the codeptr comes from the indexing code */
if (pp->PredFlags & IndexedPredFlag) {
if (pp->PredFlags & IndexedPredFlag && pp->OpcodeOfPred != INDEX_OPCODE) {
if (pp->PredFlags & LogUpdatePredFlag) {
if (code_in_pred_lu_index(
ClauseCodeToLogUpdIndex(pp->cs.p_code.TrueCodeOfPred), codeptr,

View File

@ -92,7 +92,7 @@ void *pop_output_text_stack__(int i, const void *export) {
struct mblock *np = p->next;
if (p + 1 == export) {
size_t sz = p->sz - sizeof(struct mblock);
memcpy(p, p + 1, sz);
memmove(p, p + 1, sz);
export = p;
} else {
free(p);
@ -437,10 +437,10 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
LOCAL_Error_TYPE = TYPE_ERROR_TEXT;
}
}
LOCAL_ActiveError->errorRawTerm = inp->val.t;
LOCAL_ActiveError->errorRawTerm = MkUStringTerm(inp->val.uc);
}
if (LOCAL_Error_TYPE != YAP_NO_ERROR) {
Yap_ThrowError(LOCAL_Error_TYPE, inp->val.t, "Converting to text from term ");
Yap_ThrowError(LOCAL_Error_TYPE, LOCAL_ActiveError->errorRawTerm, "Converting to text from term ");
return NULL;
}
@ -458,7 +458,6 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
return at->UStrOfAE;
}
size_t sz = strlen(at->StrOfAE);
inp->type |= YAP_STRING_IN_TMP;
void *o = Malloc(sz + 1);
strcpy(o, at->StrOfAE);
return pop_output_text_stack(lvl, o);

View File

@ -604,12 +604,10 @@ InitReverseLookupOpcode(void)
int hash_size_mask = OP_HASH_SIZE-1;
UInt sz = OP_HASH_SIZE*sizeof(struct opcode_tab_entry);
while (OP_RTABLE == NULL) {
if ((OP_RTABLE = (op_entry *)Yap_AllocCodeSpace(sz)) == NULL) {
if (!Yap_growheap(FALSE, sz, NULL)) {
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
"Couldn't obtain space for the reverse translation opcode table");
}
}
}
memset(OP_RTABLE, 0, sz);

View File

@ -1,3 +1,4 @@
/*************************************************************************
* *
* Yap Prolog *
@ -15,7 +16,6 @@
* *
*************************************************************************/
/* static char SccsId[] = "X 4.3.3"; */
#include "config.h"
#include "Yap.h"
#include "YapHeap.h"
#include "YapInterface.h"
@ -1038,6 +1038,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
init_globals(yap_init);
start_modules();
CurrentModule = PROLOG_MODULE;
TermEof = MkAtomTerm( Yap_LookupAtom("end_of_file"));
consult(Yap_BOOTSTRAP PASS_REGS);
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,

View File

@ -37,7 +37,7 @@ X_API bool do_init_python(void);
static void YAPCatchError()
{
if (LOCAL_CommittedError != nullptr &&
LOCAL_CommittedError->errorNo != YAP_NO_ERROR ) {
LOCAL_CommittedError->errorNo != YAP_NO_ERROR ) {
// Yap_PopTermFromDB(info->errorTerm);
// throw throw YAPError( );
Term es[2];
@ -47,7 +47,18 @@ static void YAPCatchError()
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
// Yap_PopTermFromDB(info->errorTerm);
// throw throw YAPError( SOURCE(), );
}
} else if (LOCAL_ActiveError != nullptr &&
LOCAL_ActiveError->errorNo != YAP_NO_ERROR ) {
// Yap_PopTermFromDB(info->errorTerm);
// throw throw YAPError( );
Term es[2];
es[0] = TermError;
es[1] = MkErrorTerm(LOCAL_ActiveError);
Functor f = Yap_MkFunctor(Yap_LookupAtom("print_message"), 2);
YAP_RunGoalOnce(Yap_MkApplTerm(f, 2, es));
// Yap_PopTermFromDB(info->errorTerm);
// throw throw YAPError( SOURCE(), );
}
}
YAPPredicate::YAPPredicate(Term &t, Term &tmod, CELL *&ts, const char *pname) {
@ -549,7 +560,7 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
bool result;
// allow Prolog style exception handling
// don't forget, on success these guys may create slots
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
result = (bool)YAP_EnterGoal(ap, nullptr, &q);
YAP_LeaveGoal(result && !release, &q);
@ -611,7 +622,7 @@ Term YAPEngine::fun(Term t) {
q.cp = CP;
// make sure this is safe
// allow Prolog style exception handling
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
bool result = (bool)YAP_EnterGoal(ap, nullptr, &q);
YAPCatchError();

View File

@ -114,7 +114,7 @@ public:
/// It i;
///};
/// build a query from a term
YAPQuery(YAPTerm t) : YAPPredicate((goal = t.term()), nts) {
YAPQuery(YAPTerm t) : YAPPredicate((goal = t.term()), (nts = &ARG1)) {
BACKUP_MACHINE_REGS();
openQuery();
names = YAPPairTerm(TermNil) ;

View File

@ -56,26 +56,28 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
~~~
*/
#if __APPLE__
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL), /**<
read-only boolean, a machine running an Apple Operating System */
#endif
/**< `answer_format` how to present answers, default is `~p`. */
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
/**< how to present answers, default is `~p`. */
#if __ANDROID__
YAP_FLAG(ANDROID_FLAG, "android", false, booleanFlag, "true", NULL), /**<
read-only boolean, a machine running an Google's Android version of the Linux Operating System */
#endif
#if __APPLE__
YAP_FLAG(APPLE_FLAG, "apple", false, booleanFlag, "true", NULL), /**<
read-only boolean, a machine running an Apple Operating System */
#endif
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL), /**<
`apple`: read-only atom, it describes the ISA used in this version of YAP.
read-only atom, it describes the ISA used in this version of YAP.
Available from YAP_AEH.
*/
YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL),
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
booleanFlag, "true", NULL),
/**< `arithmetic_exceptions`
Read-write flag telling whether arithmetic exceptions generate
@ -96,57 +98,54 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
It is `true` by default, but it is disabled by packages like CLP(BN) and
ProbLog.
*/
YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true,
booleanFlag, "true", NULL),
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
/**>
If _Value_ is unbound, tell whether a back quoted list of characters
token is converted to a list of atoms, `chars`, to a list of integers,
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
the corresponding behavior. The default value is `string`
*/
YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", NULL),
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false", NULL),
/**< `bounded` is iso
Read-only flag telling whether integers are bounded. The value depends
on whether YAP uses the GMP library or not.
*/
YAP_FLAG(BOUNDED_FLAG, "bounded", false, booleanFlag, "false", NULL),
YAP_FLAG(C_CC_FLAG, "c_cc", false, isatom, C_CC, NULL),
YAP_FLAG(C_CFLAGS_FLAG, "c_cflags", false, isatom, C_CFLAGS, NULL),
YAP_FLAG(C_LDFLAGS_FLAG, "c_ldflags", false, isatom, C_LDFLAGS, NULL),
YAP_FLAG(C_LIBPLSO_FLAG, "c_libplso", false, isatom, C_LIBPLSO, NULL),
YAP_FLAG(C_LIBS_FLAG, "c_libs", false, isatom, C_LIBS, NULL),
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
"false", NULL),
/**< `char_conversion is iso`
Writable flag telling whether a character conversion table is used when
reading terms. The default value for this flag is `off` except in
`sicstus` and `iso` language modes, where it is `on`.
*/
YAP_FLAG(CHAR_CONVERSION_FLAG, "char_conversion", true, booleanFlag,
"false", NULL),
/**< `character_escapes is iso `
Writable flag telling whether a character escapes are enables,
`true`, or disabled, `false`. The default value for this flag is
`true`. */
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
"true", NULL),
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context", true, booleanFlag, "true", NULL),
/**< `
Writable flag telling whether a character escapes are enabled,
`true`, or disabled, `false`. The default value for this flag is
`true`. */
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context", true, booleanFlag, "true", NULL),
/**< `compiled_at `
Read-only flag that gives the time when the main YAP binary was compiled. It
is obtained staight from the __TIME__ macro, as defined in the C99.
*/
YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
Read-only flag that gives the time when the main YAP binary was compiled. It
is obtained staight from the __TIME__ macro, as defined in the C99.
*/ YAP_FLAG(COMPILED_AT_FLAG, "compiled_at", false, isatom, YAP_COMPILED_AT,
NULL),
/**< `debug is iso `
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false", NULL),
/**<
If _Value_ is unbound, tell whether debugging is `true` or
`false`. If _Value_ is bound to `true` enable debugging, and if
it is bound to `false` disable debugging.
*/
YAP_FLAG(DEBUG_FLAG, "debug", true, booleanFlag, "false", NULL),
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, booleanFlag, "true", NULL),
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
NULL),
@ -160,53 +159,53 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
NULL),
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
booleanFlag, "false", NULL),
/**< `dialect `
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
/**<
Read-only flag that always returns `yap`.
*/
YAP_FLAG(DIALECT_FLAG, "dialect", false, ro, "yap", NULL),
/**< `discontiguous_warnings `
If `true` (default `true`) YAP checks for definitions of the same predicate
that are separated by clauses for other predicates. This may indicate that
different procedures have the same name.
The declaration discontiguous/1 disables this warning for user-specified
predicates.
*/
YAP_FLAG(DISCONTIGUOUS_WARNINGS_FLAG, "discontiguous_warnings", true,
booleanFlag, "true", NULL),
/**< `dollar_as_lower_case `
/**<
If `true` (default `true`) YAP checks for definitions of the same predicate
that are separated by clauses for other predicates. This may indicate that
different procedures have the same name.
The declaration discontiguous/1 disables this warning for user-specified
predicates.
*/
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
booleanFlag, "false", NULL),
/**<
If `off` (default) consider the character `$` a control character, if
`on` consider `$` a lower case character.
*/
YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true,
booleanFlag, "false", NULL),
/**< `double_quotes is iso `
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs),
/**< iso
If _Value_ is unbound, tell whether a double quoted list of characters
token is converted to a list of atoms, `chars`, to a list of integers,
`codes`, or to a single atom, `atom`. If _Value_ is bound, set to
the corresponding behavior. The default value is `codes`. */
YAP_FLAG(DOUBLE_QUOTES_FLAG, "double_quotes", true, isatom, "codes", dqs),
YAP_FLAG(EDITOR_FLAG, "editor", true, isatom, "$EDITOR", NULL),
/**< `executable `
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
/**<
Read-only flag. It unifies with an atom that gives the
original program path.
*/
YAP_FLAG(EXECUTABLE_FLAG, "executable", false, executable, "@boot", NULL),
/**< `fast `
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
/**<
If `on` allow fast machine code, if `off` (default) disable it. Only
available in experimental implementations.
*/
YAP_FLAG(FAST_FLAG, "fast", true, booleanFlag, "false", NULL),
YAP_FLAG(FILE_NAME_VARIABLES_FLAG, "file_name_variables", true, booleanFlag,
"true", NULL),
/**< + `float_format `
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", NULL),
/**<
C-library `printf()` format specification used by write/1 and
friends to determine how floating point numbers are printed. The
@ -215,21 +214,21 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
printed, `%g` will print all floats using 6 digits instead of the
default 15.
*/
YAP_FLAG(FLOAT_FORMAT_FLAG, "float_format", true, isatom, "%.16f", NULL),
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
/**< `gc`
If `on` allow garbage collection (default), if `off` disable it.
*/
YAP_FLAG(GC_FLAG, "gc", true, booleanFlag, "on", NULL),
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),
/**< `gc_margin `
Set or show the minimum free stack before starting garbage
collection. The default depends on total stack size.
*/
YAP_FLAG(GC_MARGIN_FLAG, "gc_margin", true, nat, "0", gc_margin),
/**< `gc_trace `
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
/**<
*
If `off` (default) do not show information on garbage collection
and stack shifts, if `on` inform when a garbage collection or stack
shift happened, if verbose give detailed information on garbage
@ -237,8 +236,9 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
information on data-structures found during the garbage collection
process, namely, on choice-points.
*/
YAP_FLAG(GC_TRACE_FLAG, "gc_trace", true, isatom, "off", NULL),
/**< `generate_debug_info `
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
booleanFlag, "true", NULL),
/**< `
If `true` (default) generate debugging information for
procedures, including source mode. If `false` predicates no
@ -246,36 +246,36 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
source mode is disabled.
*/
YAP_FLAG(GENERATE_DEBUGGING_INFO_FLAG, "generate_debug_info", true,
booleanFlag, "true", NULL),
YAP_FLAG(GMP_VERSION_FLAG, "gmp_version", false, isatom, "4.8.12", NULL),
YAP_FLAG(HALT_AFTER_CONSULT_FLAG, "halt_after_consult", false, booleanFlag,
"false", NULL),
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL),
/**< home `
the root of the YAP installation, by default `/usr/local` in Unix or
`c:\Yap` in Windows system. Can only be set at configure time
*/
YAP_FLAG(HOME_FLAG, "home", false, isatom, YAP_ROOTDIR, NULL),
the root of the YAP installation, by default `/usr/local` in Unix or
`c:\Yap` in Windows system. Can only be set at configure time
*/
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS, NULL),
/**< host_type `
Return `configure` system information, including the machine-id
for which YAP was compiled and Operating System information.
*/
YAP_FLAG(HOST_TYPE_FLAG, "host_type", false, isatom, HOST_ALIAS, NULL),
YAP_FLAG(INDEX_FLAG, "index", true, indexer, "multi", NULL),
/**< `index `
If `on` allow indexing (default), if `off` disable it, if
`single` allow on first argument only.
*/
YAP_FLAG(INDEX_FLAG, "index", true, indexer, "multi", NULL),
/**< `Index_sub_term_search_depth `
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
true, nat, "0", NULL),
/**< `Index_sub_term_search_depth `
Maximum bound on searching sub-terms for indexing, if `0` (default) no
bound.
*/
YAP_FLAG(INDEX_SUB_TERM_SEARCH_DEPTH_FLAG, "index_sub_term_search_depth",
true, nat, "0", NULL),
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
isatom, "normal", NULL),
/**< `informational_messages `
If `on` allow printing of informational messages, such as the ones
@ -283,16 +283,15 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
these messages. It is `on` by default except if YAP is booted with
the `-L` flag.
*/
YAP_FLAG(INFORMATIONAL_MESSAGES_FLAG, "informational_messages", true,
isatom, "normal", NULL),
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
isatom, "toward_zero", NULL),
/**< `integer_rounding_function is iso `
Read-only flag telling the rounding function used for integers. Takes the
value `toward_zero` for the current version of YAP.
*/
YAP_FLAG(INTEGER_ROUNDING_FUNCTION_FLAG, "integer_rounding_function", true,
isatom, "toward_zero", NULL),
YAP_FLAG(ISO_FLAG, "iso", true, booleanFlag, "false", NULL),
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap", NULL),
/**< `language `
Choose whether YAP follows native, closer to C-Prolog, `yap`, iso-prolog,
@ -302,24 +301,22 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
are interpreted, when to use dynamic, character escapes, and how files
are consulted. Also check the `dialect` option.
*/
YAP_FLAG(LANGUAGE_FLAG, "language", true, isatom, "yap", NULL),
/**< if defined, first location where YAP expects to find the YAP Prolog
library. Takes precedence over library_directory */
YAP_FLAG(PROLOG_LIBRARY_DIRECTORY_FLAG, "prolog_library_directory", true,
isatom, "", NULL),
/**< if defined, first location where YAP expects to find the YAP Prolog
shared libraries (DLLS). Takes precedence over executable_directory/2. */
library. Takes precedence over library_directory */
YAP_FLAG(PROLOG_FOREIGN_DIRECTORY_FLAG, "prolog_foreign_directory", true,
isatom, "", NULL),
/**< if defined, first location where YAP expects to find the YAP Prolog
shared libraries (DLLS). Takes precedence over executable_directory/2. */
/**< `max_arity is iso `
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded", NULL),
Read-only flag telling the maximum arity of a functor. Takes the value
`unbounded` for the current version of YAP.
*/
YAP_FLAG(MAX_ARITY_FLAG, "max_arity", false, isatom, "unbounded", NULL),
YAP_FLAG(MAX_TAGGED_INTEGER_FLAG, "max_tagged_integer", false, at2n,
YAP_FLAG(MAX_TAGGED_INTEGER_FLAG, "max_tagged_integer", false, at2n,
"INT_MAX", NULL),
YAP_FLAG(MAX_THREADS_FLAG, "max_threads", false, at2n, "MAX_THREADS", NULL),
YAP_FLAG(MAX_WORKERS_FLAG, "max_workers", false, at2n, "MAX_WORKERS", NULL),
@ -329,45 +326,47 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
"256", NULL),
YAP_FLAG(OCCURS_CHECK_FLAG, "occurs_check", true, booleanFlag, "false",
NULL),
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
booleanFlag, "false", NULL),
/**< `open_expands_filename `
If `true` the open/3 builtin performs filename-expansion
before opening a file (SICStus Prolog like). If `false` it does not
(SWI-Prolog like).
*/
YAP_FLAG(OPEN_EXPANDS_FILENAME_FLAG, "open_expands_filename", true,
booleanFlag, "false", NULL),
/**< `open_shared_object `
If true, `open_shared_object/2` and friends are implemented,
providing access to shared libraries (`.so` files) or to dynamic link
libraries (`.DLL` files).
*/
YAP_FLAG(OPEN_SHARED_OBJECT_FLAG, "open_shared_object", true, booleanFlag,
"true", NULL),
/**< `module_independent_operators `
/**< `open_shared_object `
If true, `open_shared_object/2` and friends are implemented,
providing access to shared libraries (`.so` files) or to dynamic link
libraries (`.DLL` files).
*/
/**< `module_independent_operators `
If `true` an operator declaration will be valid for every module in the
program. This is for compatibility with old software that
might expect module-independent operators.
*/
// YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
// "module_independent_operators", true, booleanFlag,
// "false", NULL),
YAP_FLAG(MODULE_INDEPENDENT_OPERATORS_FLAG,
"module_independent_operators", true, booleanFlag,
"false", NULL),
YAP_FLAG(OPTIMISE_FLAG, "optimise", true, booleanFlag, "false", NULL),
YAP_FLAG(OS_ARGV_FLAG, "os_argv", false, os_argv, "@boot", NULL),
YAP_FLAG(PID_FLAG, "pid", false, sys_pid, "@boot", NULL),
YAP_FLAG(PIPE_FLAG, "pipe", true, booleanFlag, "true", NULL),
YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false", NULL),
/**< `profiling `
If `off` (default) do not compile call counting information for
procedures. If `on` compile predicates so that they calls and
retries to the predicate may be counted. Profiling data can be read through
the call_count_data/3 built-in.
*/
YAP_FLAG(PROFILING_FLAG, "profiling", true, booleanFlag, "false", NULL),
/**< `prompt_alternatives_on(atom,
If `off` (default) do not compile call counting information for
procedures. If `on` compile predicates so that they calls and
retries to the predicate may be counted. Profiling data can be read through
the call_count_data/3 built-in.
*/
YAP_FLAG(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true,
isatom, "determinism", NULL),
/**< `prompt_alternatives_on(atom,
changeable) `
SWI-Compatible option, determines prompting for alternatives in the Prolog
@ -375,66 +374,65 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
and only if the query contains variables. The alternative, default in
SWI-Prolog is <tt>determinism</tt> which implies the system prompts for
alternatives if the goal succeeded while leaving choicepoints. */
YAP_FLAG(PROMPT_ALTERNATIVES_ON_FLAG, "prompt_alternatives_on", true,
isatom, "determinism", NULL),
YAP_FLAG(QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, booleanFlag,
"true", NULL),
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
Yap_InitReadline),
/**< `readline(boolean, changeable)`
}
enable the use of the readline library for console interactions, true by
default if readline was found. */
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false",
Yap_InitReadline),
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true",
NULL),
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
YAP_BOOTSTRAP, NULL),
/**<`resource_database`
Name of the resource file (saved-state or Prolog file) used to construct
the YAP
run-time environment.
*/
YAP_FLAG(RESOURCE_DATABASE_FLAG, "resource_database", false, isatom,
YAP_BOOTSTRAP, NULL),
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
NULL),
/**<`saved_program`
if `true` YAP booted from a `yss` file, usually `startup.yss'. If
`false`, YAP booted from a Prolog file, by default `boot.yap`.
*/
YAP_FLAG(SAVED_PROGRAM_FLAG, "saved_program", false, booleanFlag, "false",
NULL),
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
isatom, SO_EXT, NULL),
/**< `shared_object_extension `
Suffix associated with loadable code.
*/
YAP_FLAG(SHARED_OBJECT_EXTENSION_FLAG, "shared_object_extension", false,
isatom, SO_EXT, NULL),
/**< `shared_object_search_path `
Name of the environment variable used by the system to search for shared
objects.
*/
YAP_FLAG(SHARED_OBJECT_SEARCH_PATH_FLAG, "shared_object_search_path", true,
isatom, SO_PATH, NULL),
/**< `shared_object_search_path `
Name of the environment variable used by the system to search for shared
objects.
*/
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom", sqf),
/**< `single_quoted text is usuallly interpreted as atoms. This flagTerm
allows other inerpretations such as strings_contains_strings */
YAP_FLAG(SINGLE_QUOTES_FLAG, "single_quotes", true, isatom, "atom", sqf),
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),
/**< `signals`
If `true` (default) YAP handles Signals such as `^C`
(`SIGINT`).
*/
YAP_FLAG(SIGNALS_FLAG, "signals", true, booleanFlag, "true", NULL),
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL),
/**< `source`
If `true` maintain the source for all clauses. Notice that this is trivially
supported for facts, and always supported for dynamic code.
*/
YAP_FLAG(SOURCE_FLAG, "source", true, booleanFlag, "true", NULL),
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL),
/**< `strict_iso `
If _Value_ is unbound, tell whether strict ISO compatibility mode
@ -457,7 +455,8 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
depends on a Prolog's platform specific features.
*/
YAP_FLAG(STRICT_ISO_FLAG, "strict_iso", true, booleanFlag, "false", NULL),
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
SYSTEM_OPTIONS, NULL),
/**< `system_options `
This read only flag tells which options were used to compile
@ -466,21 +465,22 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
`or-parallelism`, `rational_trees`, `readline`, `tabling`,
`threads`, or the `wam_profiler`.
*/
YAP_FLAG(SYSTEM_OPTIONS_FLAG, "system_options", false, options,
SYSTEM_OPTIONS, NULL),
YAP_FLAG(SYSTEM_THREAD_ID_FLAG, "system_thread_id", false, sys_thread_id,
"@boot", NULL),
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]", NULL),
/**< `tabling_mode`
Sets or reads the tabling mode for all tabled predicates. Please
(see Tabling) for the list of options.
*/
YAP_FLAG(TABLING_MODE_FLAG, "tabling_mode", true, isatom, "[]", NULL),
YAP_FLAG(THREADS_FLAG, "threads", false, ro, "MAX_THREADS", NULL),
YAP_FLAG(TIMEZONE_FLAG, "timezone", false, ro, "18000", NULL),
YAP_FLAG(TOPLEVEL_PRINT_ANON_FLAG, "toplevel_print_anon", true, booleanFlag,
"true", NULL),
YAP_FLAG(TOPLEVEL_HOOK_FLAG, "toplevel_hook", true,
booleanFlag, "true",
NULL),
/**< `toplevel_hook `
If bound, set the argument to a goal to be executed before entering the
@ -495,13 +495,13 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
YAP_FLAG(TOPLEVEL_PROMPT_FLAG, "toplevel_prompt", true, isatom, "?- ",
mkprompt),
YAP_FLAG(TTY_CONTROL_FLAG, "tty_control", true, booleanFlag, "true", NULL),
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
/**< `unix`
Read-only BooleanFlag flag that unifies with `true` if YAP is
running on an Unix system. Defined if the C-compiler used to compile
this version of YAP either defines `__unix__` or `unix`.
*/
YAP_FLAG(UNIX_FLAG, "unix", false, ro, "true", NULL),
/**< `update_semantics `
Define whether YAP should follow `immediate` update
@ -513,28 +513,29 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
*/
YAP_FLAG(UPDATE_SEMANTICS_FLAG, "update_semantics", true, isatom, "logical",
NULL),
/**<
`user_flags `
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
are `silent`, `warning` and `error`. The first two create the flag
on-the-fly, with `warning` printing a message. The value `error` is
consistent with ISO: it raises an existence error and does not create the
flag. See also `create_prolog_flag/3`. The default is`error`, and developers
are encouraged to use `create_prolog_flag/3` to create flags for their
library.
*/
YAP_FLAG(USER_FLAGS_FLAG, "user_flags", true, isatom, "error", NULL),
/**<
`user_flags `
Define the behaviour of set_prolog_flag/2 if the flag is not known. Values
are `silent`, `warning` and `error`. The first two create the flag
on-the-fly, with `warning` printing a message. The value `error` is
consistent with ISO: it raises an existence error and does not create the
flag. See also `create_prolog_flag/3`. The default is`error`, and developers
are encouraged to use `create_prolog_flag/3` to create flags for their
library.
*/
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error", Yap_unknown),
/**< `unknown is iso`
Corresponds to calling the unknown/2 built-in. Possible ISO values
are `error`, `fail`, and `warning`. Yap includes the following extensions:
`fast_fail` does not invoke any handler.
*/
YAP_FLAG(UNKNOWN_FLAG, "unknown", true, isatom, "error", Yap_unknown),
YAP_FLAG(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG,
"variable_names_may_end_with_quotes", true, booleanFlag, "false",
NULL),
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
/**< `verbose `
If `normal` allow printing of informational and banner messages,
@ -543,8 +544,7 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
YAP is booted with the `-q` or `-L` flag.
*/
YAP_FLAG(VERBOSE_FLAG, "verbose", true, isatom, "normal", NULL),
YAP_FLAG(VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, booleanFlag,
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
"false", NULL),
/**< `verbose_file_search `
@ -553,23 +553,14 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
is `false` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG(VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, booleanFlag,
"false", NULL),
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal", NULL),
/**< `verbose_load `
If `true` allow printing of informational messages when
consulting files. If `false` disable printing these messages. It
is `normal` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal", NULL),
/**< `version_data `
Read-only flag that unifies with a number of the form
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
_Major_ is the major version, _Minor_ is the minor version,
and _Patch_ is the patch number.
*/
If `true` allow printing of informational messages when
consulting files. If `false` disable printing these messages. It
is `normal` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),
/**<
`version ` Read-only flag that returns a compound term with the
@ -579,13 +570,20 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
*/
YAP_FLAG(VERSION_DATA_FLAG, "version_data", false, ro, YAP_TVERSION, NULL),
/**< `version_data `
Read-only flag that unifies with a number of the form
`_Major_ * 100000 + _Minor_ *100 + _Patch_`, where
_Major_ is the major version, _Minor_ is the minor version,
and _Patch_ is the patch number.
*/
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
NULL),
/**< `version_git `
`
this is the unique identifier for the last commit of the current GIT HEAD,
it xan be used to identify versions that differ on small (or large) updates.
*/
YAP_FLAG(VERSION_GIT_FLAG, "version_git", false, isatom, YAP_GIT_HEAD,
NULL),
YAP_FLAG(WRITE_ATTRIBUTES_FLAG, "write_attributes", true, isatom, "ignore",
NULL),
#if __WINDOWS__
@ -596,6 +594,9 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
*/
YAP_FLAG(WINDOWS_FLAG, "windows", false, ro, "true", NULL),
#endif
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
NULL),
/**< `write_strings `
Writable flag telling whether the system should write lists of
@ -603,9 +604,6 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
is `on` if enables or `off` if disabled. The default value for
this flag is `off`.
*/
YAP_FLAG(WRITE_STRINGS_FLAG, "write_strings", true, booleanFlag, "false",
NULL),
END_GLOBAL_FLAGS
//! @}

View File

@ -1345,9 +1345,9 @@ static inline const unsigned char *Yap_TextToUTF8Buffer(Term t0 USES_REGS) {
inp.val.t = t0;
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
YAP_STRING_ATOMS_CODES | YAP_STRING_MALLOC;
YAP_STRING_ATOMS_CODES;
out.val.uc = NULL;
out.type = YAP_STRING_CHARS;
out.type = YAP_STRING_CHARS | YAP_STRING_MALLOC;
out.enc = ENC_ISO_UTF8;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))

View File

@ -65,7 +65,7 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
const void *buf;
AAsset *am = NULL;
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s-%s <%s>", fname, me->prefix,io_mode);
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s-%s <%s>", fname, me->prefix,io_mode);
if (strchr(io_mode, 'B')) {
mode = AASSET_MODE_BUFFER;
} else {
@ -78,10 +78,9 @@ open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
// strcpy(dir, fname);
// char *d = basename(dir);
am = AAssetManager_open(Yap_assetManager(), fname, mode);
if (am==NULL)
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "failed open %s <%s>", fname, strerror(errno) );
//if (am==NULL)
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "failed open %s <%s>", fname, strerror(errno) );
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", fname, io_mode );
// while (dp) {
// char *f = AAssetDir_getNextFileName(dp);
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", f, d);
@ -189,7 +188,7 @@ bool is_dir_a(VFS_t *me, const char *dirName) {
if (d == NULL || AAssetDir_getNextFileName(d) == NULL)
return false;
(AAssetDir_close(d));
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "isdir %s <%p>", dirName, d);
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "isdir %s <%p>", dirName, d);
return true;
}
@ -199,7 +198,7 @@ bool exists_a(VFS_t *me, const char *dirName) {
dirName += strlen(me->prefix) + 1;
// try not to use it as an asset
AAsset *d = AAssetManager_open(Yap_assetManager(), dirName, AASSET_MODE_UNKNOWN);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%p>", dirName, d);
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%p>", dirName, d);
if (d == NULL)
return false;
AAsset_close(d);
@ -219,7 +218,7 @@ static bool set_cwd(VFS_t *me, const char *dirName) {
dirName = dirname(dirName);
GLOBAL_cwd = malloc(strlen(dirName)+1);
strcpy(GLOBAL_cwd, dirName);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", GLOBAL_cwd);
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", GLOBAL_cwd);
return true;
}

View File

@ -1130,7 +1130,9 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
Term file_name, encoding_t encoding, stream_flags_t flags,
void *vfs) {
StreamDesc *st = &GLOBAL_Stream[sno];
if (io_mode == NULL)
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "init %s %s stream <%d>",io_mode,name,
sno);
if (io_mode == NULL)
Yap_Error(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, MkIntegerTerm(sno),
"File opened with NULL Permissions");
if (strchr(io_mode, 'a')) {
@ -1315,8 +1317,6 @@ static bool fill_stream(int sno, StreamDesc *st, Term tin, const char *io_mode,
}
Yap_initStream(sno, st->file, fname, io_mode, user_name, LOCAL_encoding,
st->status, vfsp);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%d>", fname,
sno);
return true;
}
@ -1469,7 +1469,6 @@ if (args[OPEN_BOM].used) {
// interactive streams do not have a start, so they probably don't have
// a BOM
avoid_bom = avoid_bom || (st->status & Tty_Stream_f);
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s", fname);
if (needs_bom && !write_bom(sno, st)) {
return false;
} else if (open_mode == AtomRead && !avoid_bom) {
@ -1865,17 +1864,13 @@ static Int always_prompt_user(USES_REGS1) {
return (TRUE);
}
static Int close1 /** @pred close(+ _S_) is iso
/** @pred close(+ _S_) is iso
Closes the stream _S_. If _S_ does not stand for a stream
currently opened an error is reported. The streams user_input,
user_output, and user_error can never be closed.
*/
(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
*/
static Int close1(USES_REGS1) { /* '$close'(+GLOBAL_Stream) */
int sno = CheckStream(
ARG1, (Input_Stream_f | Output_Stream_f | Socket_Stream_f), "close/2");
if (sno < 0)
@ -2057,13 +2052,13 @@ void Yap_InitPlIO(struct yap_boot_params *argi) {
Int i;
if (argi->inp > 0)
Yap_stdin = fdopen(argi->inp - 1, "r");
else if (argi->inp)
else if (argi->inp < 0)
Yap_stdin = NULL;
else
Yap_stdin = stdin;
if (argi->out > 0)
Yap_stdout = fdopen(argi->out - 1, "a");
else if (argi->out)
else if (argi->out < 0)
Yap_stdout = NULL;
else
Yap_stdout = stdout;

View File

@ -1545,8 +1545,8 @@ static Int read_term_from_string(USES_REGS1) {
static Int atomic_to_term(USES_REGS1) {
Term t1 = Deref(ARG1);
int l = push_text_stack();
const char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
Int rc = Yap_BufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
const unsigned char *s = Yap_TextToUTF8Buffer(t1 PASS_REGS);
Int rc = Yap_UBufferToTerm(s, add_output(ARG2, add_names(ARG3, TermNil)));
pop_text_stack(l);
return rc;
}

View File

@ -995,6 +995,8 @@ static void CloseStream(int sno) {
CACHE_REGS
// fflush(NULL);
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "close stream <%d>",
// sno);
VFS_t *me;
if ((me = GLOBAL_Stream[sno].vfs) != NULL &&
GLOBAL_Stream[sno].file == NULL) {
@ -1034,6 +1036,7 @@ static void CloseStream(int sno) {
GLOBAL_Stream[sno].vfs = NULL;
GLOBAL_Stream[sno].file = NULL;
GLOBAL_Stream[sno].status = Free_Stream_f;
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "close stream <%d>", sno);
/* if (st->status == Socket_Stream_f|Input_Stream_f|Output_Stream_f) {
Yap_CloseSocket();

View File

@ -355,7 +355,7 @@ bool Yap_ChDir(const char *path) {
int lvl = push_text_stack();
const char *qpath = Yap_AbsoluteFile(path, true);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", path);
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", path);
VFS_t *v;
if ((v = vfs_owner(qpath))) {
rc = v->chdir(v, (qpath));
@ -398,7 +398,7 @@ static char *clean_path(const char *path) {
const char *p, *p0;
int lvl = push_text_stack();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " looking at %s", path);
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " looking at %s", path);
char *o0 = Malloc(FILENAME_MAX + 1), *o = o0;
int ch;
char *b0 = Malloc(FILENAME_MAX + 1), *b = b0;
@ -423,8 +423,8 @@ static char *clean_path(const char *path) {
if (o == o0)
*o++ = '/';
*o = '\0';
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " %s at %s, %p-%p", p0, o0,
o, o0);
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " %s at %s, %p-%p", p0, o0,
// o, o0);
return pop_output_text_stack(lvl, o0);
}
@ -1146,7 +1146,7 @@ const char *Yap_getcwd(char *cwd, size_t cwdlen) {
return (char *)cwd;
#endif
const char *rc = getcwd(cwd, FILENAME_MAX);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", rc);
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", rc);
return rc;
}

View File

@ -127,9 +127,7 @@
%% SWI end
:- use_module(library(dialect/hprolog)).
:- use_module(pairlist).
:- start_low_level_trace.
:- include(chr_op).
:- stop_low_level_trace.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%

View File

@ -72,7 +72,7 @@ foreach (driver ${MYDDAS_DBMS})
cpp_driver(MYDDAS_YAP ${driver} myddas_driver.ypp)
endforeach ()
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/test.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
list (APPEND MYDDAS_YAP ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/sqlitest.yap ${CMAKE_CURRENT_SOURCE_DIR}/../sqlite3/chinook.db)
add_to_group(MYDDAS_YAP pl_library )
add_custom_target(plmyddas ALL DEPENDS ${MYDDAS_YAP} )

View File

@ -15,7 +15,7 @@
* *
*************************************************************************/
//:- load_foreign_files([myddas], [], init_myddas).
%%:- load_foreign_files([myddas], [], init_myddas).
/* Initialize MYDDAS GLOBAL STRUCTURES */
:- c_db_initialize_myddas.
@ -135,12 +135,12 @@
:- use_module(myddas_sqlite3,[
% myddas_mysql.ypp
c_sqlite3_connect/4,
c_sqlite3_disconnect/1,
c_sqlite3_query/5,
%c_sqlite3_connect/4,
%c_sqlite3_disconnect/1,
%c_sqlite3_query/5,
sqlite3_result_set/1,
c_sqlite3_number_of_fields/3,
c_sqlite3_get_attributes_types/3,
%c_sqlite3_number_of_fields/3,
%c_sqlite3_get_attributes_types/3,
sqlite3_describe/3,
sqlite3_show_tables/2,
sqlite3_row/3
@ -188,7 +188,6 @@
%
%% @pred db_open(+Interface,-Handle,+HostDb,+User,+Password)
%% @pred db_open(+Interface,+HostDb,+User,+Password)
%
@ -369,7 +368,7 @@ db_sql_(ConType, Con, SQL,LA):-
c_postgres_query(SQL,ResultSet,Con,Mode,Arity)
;ConType == sqlite3 ->
sqlite3_result_set(Mode),
c_sqlite3_query(SQL,ResultSet,Con,Mode,Arity)
myddas_myddas_sqlite3:c_sqlite3_query(SQL,ResultSet,Con,Mode,Arity)
;
c_odbc_query(SQL,ResultSet,Arity,LA,Con),
c_odbc_number_of_fields_in_query(SQL,Con,Arity)
@ -459,7 +458,7 @@ db_assert(Connection,PredName):-
c_postgres_query(SQL,_,Con,Mode,_)
;ConType == sqlite3 ->
sqlite3_result_set(Mode),
c_sqlite3_query(SQL,_,Con,Mode,_)
myddas_myddas_sqlite3:c_sqlite3_query(SQL,_,Con,Mode,_)
;
c_odbc_query(SQL,_,_,_,Con)
).
@ -488,7 +487,7 @@ db_create_table(Connection,TableName,FieldsInf):-
c_postsgres_query(FinalSQL,_,Con,Mode,_)
;ConType == sqlite3 ->
sqlite3_result_set(Mode),
c_sqlite3_query(FinalSQL,_,Con,Mode,_)
myddas_myddas_sqlite3:c_sqlite3_query(FinalSQL,_,Con,Mode,_)
;
c_odbc_query(FinalSQL,_,_,_,Con)
).
@ -565,7 +564,7 @@ db_update(Connection,WherePred-SetPred):-
;
ConType == sqlite3 ->
sqlite3_result_set(Mode),
c_sqlite3_query(SQL,_,Conn,Mode,_)
myddas_sqlite3:c_sqlite3_query(SQL,_,Conn,Mode,_)
;
ConType == odbc ->
odbc_result_set(Mode),

View File

@ -19,27 +19,28 @@
#define DBMS(x) sqlite3_##x
#define c_DBMS(x) c_sqlite3_##x
#define NAME() 'libYapsqlite3'
#define MODULE() myddas_sqlite3
#define MODULE() user
#define INIT() init_sqlite3
#elif defined( odbc )
#undef odbc
#define DBMS(x) odbc_##x
#define c_DBMS(x) c_odbc_##x
#define NAME() 'libYapodbc'
#define MODULE() myddas_odbc
#define MODULE() user
#define INIT() init_odbc
#elif defined( postgres )
#undef postgres
#define DBMS(x) postgres_##x
#define c_DBMS(x) c_postgres_##x
#define NAME() 'libYappostgres'
#define MODULE() myddas_postgres
#define MODULE() user
#define INIT() init_odbc
#endif
#if defined(DBMS)
:- module(MODULE(),[
/*
c_DBMS(change_database)/2,
c_DBMS(connect)/4,
c_DBMS(disconnect)/1,
@ -49,6 +50,7 @@
c_DBMS(get_next_result_set)/3,
c_DBMS(query)/5,
c_DBMS(number_of_fields)/3,
*/
DBMS(describe)/3,
DBMS(show_tables)/2,
DBMS(row)/3
@ -69,7 +71,7 @@
'$make_a_list'/2,
'$write_or_not'/1
]).
:- load_foreign_files( [NAME()], [], INIT()).
% :- load_foreign_files( [NAME()], [], INIT()).
%--------------------------------------------------------
% Public Predicates

View File

@ -2,7 +2,7 @@ message( " * Sqlite3 Data-Base (http://www.sqlite3ql.org), distributed with MY
set (SQLITE_EXTRA
chinook.db
test.yap)
sqlitest.yap)
set( YAPSQLITE3_SOURCES
myddas_sqlite3.c
@ -61,5 +61,3 @@ endif()
install(FILES ${SQLITE_EXTRA}
DESTINATION ${libpl}
)
# file (INSTALL chinook.db test.yap DESTINATION ${libpl})

View File

@ -672,14 +672,13 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
}
X_API void init_sqlite3(void) {
Term cm = CurrentModule;
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
Term cm = CurrentModule;
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
Yap_InitMYDDAS_SQLITE3Preds();
Yap_InitBackMYDDAS_SQLITE3Preds();
CurrentModule = cm;
CurrentModule = cm;
}

View File

@ -0,0 +1,92 @@
:- stop_low_level_trace.
:- use_module(library(maplist)).
:- use_module(library(myddas)).
main :-
init,
main_,
close.
main_ :-
go,
fail.
main_ .
init :-
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
writeln('chinook has landed').
go :-
writeln(('db_import')),
db_import('artists', artists),
writeln(('artist -> artists')),
db_import('albums', albums),
writeln(('albums -> albums')),
db_import('tracks', tracks),
writeln(('tracks -> tracks')).
go :-
start_low_level_trace,
writeln(db_get_attributes_types),
db_get_attributes_types(albums,Als),
format('~w -> ~w~n',[albums,Als]),
db_get_attributes_types(tracks,Ts),
format('~w -> ~w~n',[tracks,Ts]),
db_get_attributes_types(artists,As),
format('~w -> ~w~n',[artists,As]).
go :-
writeln(db_number_of_fields),
db_number_of_fields(albums,Als),
db_number_of_fields(tracks,Ts),
db_number_of_fields(artists,As),
writeln(As:Als:Ts).
go :-
db_describe(albums, Desc), writeln(albums:Desc).
go :-
db_describe(tracks, Desc), writeln(tracks:Desc).
go :-
db_describe(artists, Desc), writeln(artists:Desc).
go :-
db_show_tables(Desc), writeln(tables:Desc).
go :-
db_show_tables(table(T)),
db_describe(T,tableinfo(FieldID,Type,Null,Primary,Default,'')),
writeln(T:tableinfo(FieldID,Type,Null,Primary,Default,'')).
go :-
go_cut0.
go :-
%stop_low_level_trace,
findall(X:Y,artists(X,Y),Ls),
length(Ls,Total),
sort(Ls, LLs),
length(LLs, T),
writeln(T:Total).
go :-
go_cut1.
go :-
X=1,
artists(X,Y),
writeln(X:Y).
go_cut0 :-
% start_low_level_trace,
artists(X,Y),
writeln(X:Y),
!.
go_cut1 :-
X=1,
artists(X,Y),
writeln(X:Y),
!.
close :-
db_close.
:- main.

View File

@ -1,85 +0,0 @@
:- compile(library(maplist)).
:- use_module(library(myddas)).
main :-
init,
main_,
close.
main_ :-
go,
fail.
main_ .
%init :-
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
writeln('chinook has landed'),
db_import('Artist', artist),
writeln('Artist -> artist'),
db_import('Album', album),
writeln('Album -> album'),
db_import('Track', track).
writeln('Track -> track').
go :-
db_get_attributes_types(album,Als),
format('~w -> ~w~n'.[album,Als]),
db_get_attributes_types(track,Ts),
format('~w -> ~w~n'.[track,Ts]),
db_get_attributes_types(artist,As),
format('~w -> ~w~n'.[artist,As]).
go :-
db_number_of_fields(album,Als),
db_number_of_fields(track,Ts),
db_number_of_fields(artist,As),
writeln(As:Als:Ts).
go :-
db_describe(album, Desc), writeln(album:Desc) ;
db_describe(track, Desc), writeln(track:Desc) ;
db_describe(artist, Desc), writeln(artist:Desc).
go :-
db_show_tables(Desc), writeln(tables:Desc).
go :-
db_show_tables(table(T)),
db_describe(T,tableinfo(FieldID,Type,Null,Primary,Default,'')),
writeln(T:tableinfo(FieldID,Type,Null,Primary,Default,'')).
go :-
go_cut0.
go :-
%stop_low_level_trace,
findall(X:Y,artist(X,Y),Ls),
length(Ls,Total),
sort(Ls, LLs),
length(LLs, T),
writeln(T:Total).
go :-
go_cut1.
go :-
X=1,
artist(X,Y),
writeln(X:Y).
go_cut0 :-
% start_low_level_trace,
artist(X,Y),
writeln(X:Y),
!.
go_cut1 :-
X=1,
artist(X,Y),
writeln(X:Y),
!.
close :-
db_close.
:- main.

View File

@ -59,10 +59,9 @@ and_close(int sno) {
static int
and_put(int sno, int ch) {
buff0 += ch;
if (ch=='\n' || buff0.length() == 128) { //buff0+= '\0';
streamerInstance->display(buff0);
buff0.clear();
}
buff0.clear();
return ch;
}

View File

@ -323,7 +323,6 @@ version(yap,[6,4]).
:- dynamic 'extensions_to_present_answer'/1.
:- ['arrays.yap'].
%:- start_low_level_trace.
:- multifile user:portray_message/2.
@ -482,5 +481,4 @@ If this hook preodicate succeeds it must instantiate the _Action_ argument to t
:- ensure_loaded('../pl/pathconf.yap').
:- yap_flag(user:unknown,error).
%% @}

View File

@ -740,6 +740,7 @@ db_files(Fs) :-
true
),
'$loop'(Stream,Reconsult),
'$lf_opt'(imports, TOpts, Imports),
'$import_to_current_module'(File, ContextModule, Imports, _, TOpts),
'$current_module'(Mod, SourceModule),

View File

@ -26,11 +26,10 @@
*
*/
:- module(system('$messages'),
:- module(system('$messages',[]),
[system_message/4,
prefix/6,
prefix/5,
prefix/2,
%prefix/5,
file_location/3]).
/**
@ -221,7 +220,7 @@ compose_message( loaded(included,AbsFileName,Mod,Time,Space), _Level) --> !,
[ '~a included in module ~a, ~d msec ~d bytes' -
[AbsFileName,Mod,Time,Space] ].
compose_message( loaded(What,AbsoluteFileName,Mod,Time,Space), _Level) --> !,
[ '~a ~a in module ~a, ~d msec ~d bytes' -
[ '~a ~a in module ~a, ~d msec ~g bytes' -
[What, AbsoluteFileName,Mod,Time,Space] ].
compose_message(signal(SIG,_), _) -->
!,
@ -252,9 +251,9 @@ compose_message(Throw, _Leve) -->
location(error(syntax_error(_),info(between(_,LN,_), FileName, _ChrPos, _Err)), _ , _) -->
!,
[ '~a:~d:~d ' - [FileName,LN,0] ] .
location(style_check(_,LN,FileName,_ ), Level , LC) -->
location(style_check(A,LN,FileName,B ), Level , LC) -->
!,
display_consulting( FileName, Level, LC ),
display_consulting( FileName, Level,style_check(A,LN,FileName,B ), LC ),
[ '~a:~d:0 ~a ' - [FileName,LN,Level] ] .
location( error(_,Info), Level, LC ) -->
{ '$error_descriptor'(Info, Desc) },
@ -266,7 +265,7 @@ location( error(_,Info), Level, LC ) -->
'$query_exception'(prologPredArity, Desc, Ar)
},
!,
display_consulting( File, Level, LC ),
display_consulting( File, Level, Info, LC ),
[ '~s:~d:0 ~a in ~s:~s/~d:'-[File, FilePos,Level,M,Na,Ar] ].
location( error(_,Info), Level, LC ) -->
{ '$error_descriptor'(Info, Desc) },
@ -827,6 +826,15 @@ prefix(help, '~N'-[]).
prefix(query, '~N'-[]).
prefix(debug, '~N'-[]).
prefix(warning, '~N'-[]).
prefix(error, '~N'-[]).
prefix(banner, '~N'-[]).
prefix(informational, '~N~*|% '-[LC]) :-
'$show_consult_level'(LC),
LC > 0,
!.
prefix(informational, '~N'-[]).
prefix(debug(_), '~N'-[]).
/* { thread_self(Id) },
( { Id == main }
-> [ 'warning, ' - [] ]
@ -835,7 +843,7 @@ prefix(warning, '~N'-[]).
; ['warning [Thread ~d ], ' - [Id] ]
).
*/
prefix(error, '~N'-[]).
/*
{ thread_self(Id) },
( { Id == main }
@ -853,11 +861,7 @@ prefix(error, '', user_error) -->
; [ 'error [ Thread ~d ] ' - [Id], nl ]
).
*/
prefix(banner, '~N'-[]).
prefix(informational, '~N~*|% '-[LC]) :-
'$show_consult_level'(LC).
prefix(debug(_), '~N% '-[]).
prefix(information, '~N% '-[]).
clause_to_indicator(T, MNameArity) :-
@ -1015,15 +1019,15 @@ prolog:print_message(force(_Severity), Msg) :- !,
print(user_error,Msg).
% This predicate has more hooks than a pirate ship!
prolog:print_message(Severity, Term) :-
prolog:message( Term,Lines0, [ end(Id)]),
message( Term,Lines0, [ end(Id)]),
Lines = [begin(Severity, Id)| Lines0],
(
user:message_hook(Term, Severity, Lines)
->
true
;
prefix( Severity, Prefix ),
prolog:print_message_lines(user_error, Prefix, Lines)
ignore((prefix( Severity, Prefix ),
prolog:print_message_lines(user_error, Prefix, Lines)))
),
!.
prolog:print_message(Severity, Term) :-
@ -1034,12 +1038,16 @@ prolog:print_message(Severity, Term) :-
->
true
;
prefix( Severity, Prefix ),
prolog:print_message_lines(user_error, Prefix, Lines)
ignore(( prefix( Severity, Prefix ),
prolog:print_message_lines(user_error, Prefix, Lines)))
),
!.
prolog:print_message(_Severity, _Term) :-
format(user_error,'failed to print ~w: ~w~n' ,[ _Severity, _Term]).
'$error_descriptor'( Info, Info ).
/**
@}
*/

View File

@ -309,6 +309,13 @@ meta_predicate(P) :-
'$expand_goals'(\+A,\+A1,(AO-> false;true),HM,SM,BM,HVars) :- !,
'$expand_goals'(A,A1,AOO,HM,SM,BM,HVars),
'$clean_cuts'(AOO, AO).
'$expand_goals'(not(G),not(G),A\=B,_HM,_BM,_SM,_HVars) :-
nonvar(G),
G = (A = B),
!.
'$expand_goals'(not(A),not(A1),(AO-> false;true),HM,SM,BM,HVars) :- !,
'$expand_goals'(A,A1,AOO,HM,SM,BM,HVars),
'$clean_cuts'(AOO, AO).
'$expand_goals'(once(A),once(A1),
('$current_choice_point'(CP),AO,'$$cut_by'(CP)),HM,SM,BM,HVars) :- !,
'$expand_goals'(A,A1,AO0,HM,SM,BM,HVars),