- Android fixes

- null pointers
This commit is contained in:
Vitor Santos Costa 2018-06-22 23:55:50 +01:00
parent 58136ead22
commit 81b165d3dc
21 changed files with 171 additions and 166 deletions

View File

@ -2167,7 +2167,7 @@ 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(full);
Yap_ChDir(dirname(full));
if (osnop >= 0)
Yap_AddAlias(AtomLoopStream, *osnop);
Yap_end_consult();

View File

@ -351,18 +351,26 @@ 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) {
struct cp_frame *to_visit0,
*to_visit = (struct cp_frame *)Yap_PreAllocCodeSpace();
int lvl = push_text_stack();
struct cp_frame *to_visit0, *to_visit = Malloc(1024*sizeof(struct cp_frame));
struct cp_frame *to_visit_max;
CELL *HB0 = HB;
tr_fr_ptr TR0 = TR;
int ground = TRUE;
HB = HLow;
to_visit0 = to_visit;
to_visit_max = to_visit+1024;
loop:
while (pt0 < pt0_end) {
register CELL d0;
@ -382,8 +390,8 @@ loop:
*ptf = AbsPair(HR);
ptf++;
#ifdef RATIONAL_TREES
if (to_visit + 1 >= (struct cp_frame *)AuxSp) {
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;
@ -395,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;
@ -493,8 +502,8 @@ loop:
ptf++;
/* store the terms to visit */
#ifdef RATIONAL_TREES
if (to_visit + 1 >= (struct cp_frame *)AuxSp) {
goto heap_overflow;
if (to_visit + 1 >= to_visit_max) {
expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame);
}
to_visit->start_cp = pt0;
to_visit->end_cp = pt0_end;
@ -507,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;
@ -593,6 +602,7 @@ loop:
HB = HB0;
clean_dirty_tr(TR0 PASS_REGS);
/* follow chain of multi-assigned variables */
pop_text_stack(lvl);
return 0;
overflow:
@ -611,26 +621,9 @@ overflow:
}
#endif
reset_trail(TR0);
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);
return -2;
trail_overflow:
/* oops, we're in trouble */
HR = HLow;
@ -647,6 +640,7 @@ trail_overflow:
}
#endif
reset_trail(TR0);
pop_text_stack(lvl);
return -4;
}

View File

@ -217,8 +217,7 @@ void *Yap_InitTextAllocator(void) {
static size_t MaxTmp(USES_REGS1) {
return ((char *)LOCAL_TextBuffer->buf + LOCAL_TextBuffer->sz) -
(char *)LOCAL_TextBuffer->ptr;
return 1025;
}
static Term Globalize(Term v USES_REGS) {
@ -282,7 +281,7 @@ static void *codes2buf(Term t0, void *b0, bool *get_codes USES_REGS) {
return NULL;
}
if (!IsAtomTerm(hd)) {
Yap_ThrowError(TYPE_ERROR_CHARACTER, hd, "scanning list of atoms");
Yap_ThrowError(TYPE_ERROR_CHARACTER, hd, "scanning list of texts");
return NULL;
}
const char *code = RepAtom(AtomOfTerm(hd))->StrOfAE;
@ -441,7 +440,7 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
LOCAL_ActiveError->errorRawTerm = inp->val.t;
}
if (LOCAL_Error_TYPE != YAP_NO_ERROR) {
pop_text_stack(lvl);
Yap_ThrowError(LOCAL_Error_TYPE, inp->val.t, "Converting to text from term ");
return NULL;
}
@ -508,7 +507,6 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
s = Malloc(2 * MaxTmp(PASS_REGS1));
if (snprintf(s, MaxTmp(PASS_REGS1) - 1, Int_FORMAT,
IntegerOfTerm(inp->val.t)) < 0) {
pop_text_stack(lvl);
AUX_ERROR(inp->val.t, 2 * MaxTmp(PASS_REGS1), s, char);
}
return pop_output_text_stack(lvl, s);
@ -528,7 +526,6 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
char *s;
s = Malloc(MaxTmp());
if (!Yap_mpz_to_string(Yap_BigIntOfTerm(inp->val.t), s, MaxTmp() - 1, 10)) {
pop_text_stack(lvl);
AUX_ERROR(inp->val.t, MaxTmp(PASS_REGS1), s, char);
}
return inp->val.uc = pop_output_text_stack(lvl, s);

View File

@ -182,8 +182,6 @@ static bool consult(const char *b_file USES_REGS) {
CACHE_REGS
YAP_Reset(YAP_FULL_RESET, false);
Yap_StartSlots();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "read %s <%d>", b_file,
GLOBAL_Stream[c_stream].linecount);
Term vs = MkVarTerm(), pos = MkVarTerm();
t = YAP_ReadClauseFromStream(c_stream, vs, pos);
// Yap_GetNèwSlot(t);

View File

@ -161,6 +161,7 @@ public:
// fprintf(stderr,"ap=%p arity=%d text=%s", ap, ap->ArityOfPE, s);
// Yap_DebugPlWrite(out);
if (tout == 0L) {
return;
throw YAPError();
}
ap = getPred(tout, nts);

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

@ -289,7 +289,7 @@ public:
/**
* @brief Compound Term
*/
class X_API YAPApplTerm : public YAPTerm {
class X_API YAPApplTerm : public YAPTerm {
friend class YAPTerm;
public:

View File

@ -56,14 +56,20 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
~~~
*/
/**< `answer_format` how to present answers, default is `~p`. */
YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL),
#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),
#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
YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL), /**<
`apple`: read-only atom, it describes the ISA used in this version of YAP.
Available from YAP_AEH.

View File

@ -114,7 +114,8 @@ INLINE_ONLY Term Yap_ensure_atom__(const char *fu, const char *fi,
#define AUX_ERROR(t, n, s, TYPE) \
if (s + (n + 1) > (TYPE *)AuxSp) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK; \
pop_text_stack(lvl); \
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK; \
LOCAL_Error_Size = n * sizeof(TYPE); \
return NULL; \
}

View File

@ -215,6 +215,8 @@ static bool set_cwd(VFS_t *me, const char *dirName) {
if (GLOBAL_cwd) {
free(GLOBAL_cwd);
}
if (!is_dir_a(me,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);

View File

@ -639,72 +639,67 @@ static Int file_directory_name(USES_REGS1) { /* file_directory_name(Stream,N) */
static Int list_directory(USES_REGS1) {
Term tf = MkAtomTerm(Yap_LookupAtom("[]"));
yhandle_t sl = Yap_InitSlot(tf);
VFS_t *vfsp;
char *buf = (char *)AtomName(AtomOfTerm(ARG1));
#if defined(__MINGW32__) || _MSC_VER
struct _finddata_t c_file;
char bs[BUF_SIZE];
long hFile;
if ((vfsp = vfs_owner(buf))) {
void *de;
const char *dp;
bs[0] = '\0';
#if HAVE_STRNCPY
strncpy(bs, buf, BUF_SIZE);
#else
strcpy(bs, buf);
#endif
#if HAVE_STRNCAT
strncat(bs, "/*", BUF_SIZE);
#else
strcat(bs, "/*");
#endif
if ((hFile = _findfirst(bs, &c_file)) == -1L) {
return (Yap_Unify(ARD2, tf));
}
YAP_PutInSlot(sl, YAP_MkPairTerm(YAP_MkAtomTerm(YAP_LookupAtom(c_file.name)),
YAP_GetFromSlot(sl)));
while (_findnext(hFile, &c_file) == 0) {
YAP_Term ti = YAP_MkAtomTerm(YAP_LookupAtom(c_file.name));
YAP_PutInSlot(sl, YAP_MkPairTerm(ti, YAP_GetFromSlot(sl)));
}
_findclose(hFile);
#else
#if __ANDROID__
{
const char *dirName = buf + strlen("/assets/");
AAssetManager *mgr = GLOBAL_VFS->priv;
AAssetDir *de;
const char *dp;
if ((de = AAssetManager_openDir(mgr, dirName)) == NULL) {
if ((de = vfsp->opendir(vfsp, buf)) == NULL) {
PlIOError(PERMISSION_ERROR_INPUT_STREAM, ARG1, "%s in list_directory",
strerror(errno));
}
while ((dp = AAssetDir_getNextFileName(de))) {
while ((dp = vfsp->nextdir( de))) {
YAP_Term ti = MkAtomTerm(Yap_LookupAtom(dp));
Yap_PutInHandle(sl, MkPairTerm(ti, Yap_GetFromHandle(sl)));
}
AAssetDir_close(de);
}
vfsp->closedir( de);
} else {
#if defined(__MINGW32__) || _MSC_VER
struct _finddata_t c_file;
char bs[BUF_SIZE];
long hFile;
bs[0] = '\0';
#if HAVE_STRNCPY
strncpy(bs, buf, BUF_SIZE);
#else
strcpy(bs, buf);
#endif
#if HAVE_OPENDIR
{
DIR *de;
struct dirent *dp;
#if HAVE_STRNCAT
strncat(bs, "/*", BUF_SIZE);
#else
strcat(bs, "/*");
#endif
if ((hFile = _findfirst(bs, &c_file)) == -1L) {
return (Yap_Unify(ARD2, tf));
}
YAP_PutInSlot(sl, YAP_MkPairTerm(YAP_MkAtomTerm(YAP_LookupAtom(c_file.name)),
YAP_GetFromSlot(sl)));
while (_findnext(hFile, &c_file) == 0) {
YAP_Term ti = YAP_MkAtomTerm(YAP_LookupAtom(c_file.name));
YAP_PutInSlot(sl, YAP_MkPairTerm(ti, YAP_GetFromSlot(sl)));
}
_findclose(hFile);
#elif HAVE_OPENDIR
{
DIR *de;
struct dirent *dp;
if ((de = opendir(buf)) == NULL) {
PlIOError(PERMISSION_ERROR_INPUT_STREAM, ARG1, "%s in list_directory",
strerror(errno));
if ((de = opendir(buf)) == NULL) {
PlIOError(PERMISSION_ERROR_INPUT_STREAM, ARG1, "%s in list_directory",
strerror(errno));
return false;
}
while ((dp = readdir(de))) {
Term ti = MkAtomTerm(Yap_LookupAtom(dp->d_name));
Yap_PutInSlot(sl, MkPairTerm(ti, Yap_GetFromSlot(sl)));
}
closedir(de);
}
return false;
}
while ((dp = readdir(de))) {
Term ti = MkAtomTerm(Yap_LookupAtom(dp->d_name));
Yap_PutInSlot(sl, MkPairTerm(ti, Yap_GetFromSlot(sl)));
}
closedir(de);
}
#endif /* HAVE_OPENDIR */
#endif
}
tf = Yap_GetFromSlot(sl);
return Yap_unify(ARG2, tf);
}

View File

@ -1398,7 +1398,7 @@ Term Yap_BufferToTerm(const char *s, Term opts) {
Term rval;
int sno;
encoding_t l = ENC_ISO_UTF8;
sno = Yap_open_buf_read_stream((char *)s, strlen((const char *)s), &l,
sno = Yap_open_buf_read_stream((char *)s, strlen((const char *)s)+1, &l,
MEM_BUF_USER);
GLOBAL_Stream[sno].status |= CloseOnException_Stream_f;
@ -1544,17 +1544,11 @@ static Int read_term_from_string(USES_REGS1) {
static Int atomic_to_term(USES_REGS1) {
Term t1 = Deref(ARG1);
if (IsVarTerm(t1)) {
Yap_Error(INSTANTIATION_ERROR, t1, "read_term_from_string/3");
return (FALSE);
} else if (!IsAtomicTerm(t1)) {
Yap_Error(TYPE_ERROR_ATOMIC, t1, "read_term_from_atomic/3");
return (FALSE);
} else {
Term t = Yap_AtomicToString(t1 PASS_REGS);
const unsigned char *us = UStringOfTerm(t);
return Yap_UBufferToTerm(us, add_output(ARG2, add_names(ARG3, TermNil)));
}
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)));
pop_text_stack(l);
return rc;
}
static Int atom_to_term(USES_REGS1) {

View File

@ -92,29 +92,37 @@ bool Yap_isDirectory(const char *FileName) {
#endif
}
Int exists_directory(USES_REGS1) {
int lvl = push_text_stack();
const char *path = Yap_AbsoluteFile(Yap_TextTermToText(Deref(ARG1) PASS_REGS),true);
bool rc = Yap_isDirectory(path);
pop_text_stack(lvl);
return rc;
}
bool Yap_Exists(const char *f) {
VFS_t *vfs;
f = Yap_VFAlloc(f);
if ((vfs = vfs_owner(f))) {
return vfs->exists(vfs, f);
}
VFS_t *vfs;
f = Yap_VFAlloc(f);
if ((vfs = vfs_owner(f))) {
return vfs->exists(vfs, f);
}
#if _WIN32
if (_access(f, 0) == 0)
if (_access(f, 0) == 0)
return true;
if (errno == EINVAL) {
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "bad flags to access");
}
return false;
#elif HAVE_ACCESS
if (access(f, F_OK) == 0) {
return true;
}
if (errno == EINVAL) {
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "bad flags to access");
}
return false;
if (access(f, F_OK) == 0) {
return true;
}
if (errno == EINVAL) {
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "bad flags to access");
}
return false;
#else
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
"access not available in this configuration");
return false;
#endif
@ -346,14 +354,14 @@ bool Yap_ChDir(const char *path) {
bool rc = false;
int lvl = push_text_stack();
const char *qpath = Yap_AbsoluteFile(path, true);
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "chdir %s", path);
VFS_t *v;
if ((v = vfs_owner(path))) {
rc = v->chdir(v, path);
if ((v = vfs_owner(qpath))) {
rc = v->chdir(v, (qpath));
pop_text_stack(lvl);
return rc;
}
const char *qpath = Yap_AbsoluteFile(path, true);
#if _WIN32
rc = true;
if (qpath != NULL && qpath[0] &&
@ -615,6 +623,8 @@ do_glob(const char *spec, bool glob_vs_wordexp) {
}
return tf;
}
#elif __ANDROID__
return MkPairTerm(MkAtomTerm(Yap_LookupAtom(spec)), TermNil);
#elif HAVE_WORDEXP || HAVE_GLOB
char u[YAP_FILENAME_MAX + 1];
const char *espec = u;
@ -1866,7 +1876,8 @@ void Yap_InitSysPreds(void) {
Yap_InitCPred("$yap_paths", 3, p_yap_paths, SafePredFlag);
Yap_InitCPred("$dir_separator", 1, p_dir_sp, SafePredFlag);
Yap_InitCPred("libraries_directories", 2, libraries_directories, 0);
Yap_InitCPred("system_library", 1, system_library, 0);
Yap_InitCPred("system_library", 1, system_library, 0);
Yap_InitCPred("exists_directory", 1, exists_directory, 0);
Yap_InitCPred("commons_library", 1, commons_library, 0);
Yap_InitCPred("$getenv", 2, p_getenv, SafePredFlag);
Yap_InitCPred("$putenv", 2, p_putenv, SafePredFlag | SyncPredFlag);

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/test.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

@ -1,5 +1,6 @@
:- compile(library(myddas)).
:- compile(library(maplist)).
:- use_module(library(myddas)).
main :-
init,
@ -11,19 +12,27 @@ main_ :-
main_ .
init :-
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
db_open(sqlite3, '/assets/Yap/chinook.db', _, _),
writeln('chinook has landed'),
start_low_level_trace,
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
writeln('chinook has landed').
go :-
stop_low_level_trace,
db_import('Artist', artist),
writeln(('Artist -> artist')),
db_import('Album', album),
db_import('Track', track).
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),
db_get_attributes_types(artist,As),
writeln(As:Als: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),
@ -31,11 +40,13 @@ go :-
writeln(As:Als:Ts).
go :-
db_describe(album, Desc), writeln(Desc) ;
db_describe(track, Desc), writeln(Desc) ;
db_describe(artist, Desc), writeln(Desc).
db_describe(album, Desc), writeln(album:Desc).
go :-
db_show_tables(Desc), writeln(Desc).
db_describe(track, Desc), writeln(track:Desc).
go :-
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,'')),

View File

@ -61,6 +61,7 @@ and_put(int sno, int ch) {
buff0 += ch;
if (ch=='\n' || buff0.length() == 128) { //buff0+= '\0';
streamerInstance->display(buff0);
buff0.clear();
}
return ch;
}

View File

@ -14,6 +14,14 @@
%include std_string.i
%include std_vector.i
#if __ANDROID__
%include "arrays_java.i";
// %inline %{
static YAPTerm Temp[1];
// %}
// %typemap(javapackage) std::vector<YAPTerm> "pt.up.yap.YAPTerm"
//%template(VectorOfTerm) std::vector<YAPTerm>;
#endif
%feature("novaluewrapper") std::vector<Term>;
@ -34,10 +42,6 @@ class YAPEngine;
#if __ANDROID__
#endif
#ifdef SWIGPYTHON
#include <py4yap.h>
@ -60,10 +64,6 @@ class YAPEngine;
return NULL;
}
#endif
#ifdef SWIGJAVA0
%typemap(javapackage) std::vector<YAPTerm> "pt.up.yap.YAPTerm"
%template(VectorOfTerm) std::vector<YAPTerm>;
#endif
}
%}

View File

@ -55,8 +55,8 @@
+ specialise versions for some built-ins, if we are aware of the
run-time execution mode
The user has some control over this process, through some
built-ins and through execution flsgs.
The user has control over this process, through
built-ins and through prolog flags.
*/
@ -93,7 +93,7 @@ compile_expressions :- set_value('$c_arith',true).
After a call to this predicate, arithmetical expressions will not be compiled.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~
?- source, do_not_compile_expressions.
yes
?- [user].
@ -111,8 +111,8 @@ p(A):-
q(A):-
A is 22.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~
*/
do_not_compile_expressions :- set_value('$c_arith',[]).
@ -132,6 +132,7 @@ do_c_built_in('$do_error'( Error, Goal), M, Head,
throw(error(Error,M:(Head :- Goal)))
) :- !.
do_c_built_in(system_error( Error, Goal), M, Head, ErrorG) :-
!,
do_c_built_in('$do_error'( Error, Goal), M, Head, ErrorG).
do_c_built_in(X is Y, M, H, P) :-
primitive(X), !,
@ -149,8 +150,10 @@ do_c_built_in(X is Y, _, _, P) :-
'$drop_is'(X0, X, P0, P)
).
do_c_built_in(phrase(NT,Xs), Mod, H, NTXsNil) :-
!,
'$_arith':do_c_built_in(phrase(NT,Xs,[]), Mod, H, NTXsNil).
do_c_built_in(phrase(NT,Xs0,Xs), Mod, _, NewGoal) :-
!,
'$c_built_in_phrase'(NT, Xs0, Xs, Mod, NewGoal ).
do_c_built_in(Comp0, _, _, R) :- % now, do it for comparisons

View File

@ -303,8 +303,8 @@ initialize_prolog :-
'qly.yap',
'spy.yap',
'udi.yap'].
%:- stop_low_level_trace.
%:- start_low_level_trace.
:- meta_predicate(log_event(+,:)).
@ -316,14 +316,13 @@ initialize_prolog :-
:- ['protect.yap'].
version(yap,[6,3]).
version(yap,[6,4]).
:- op(1150,fx,(mode)).
:- dynamic 'extensions_to_present_answer'/1.
:- ['arrays.yap'].
%:- start_low_level_trace.
:- multifile user:portray_message/2.
@ -396,6 +395,7 @@ yap_hacks:cut_by(CP) :- '$$cut_by'(CP).
:- style_check([+discontiguous,+multiple,+single_var]).
%
% moved this to init_gc in gc.c to separate the alpha
%
@ -479,5 +479,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

@ -252,9 +252,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 +266,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) },

View File

@ -74,17 +74,9 @@ Prints a list of all files in the current directory.
*/
ls :-
getcwd(X),
'$load_system_ls'(X,L),
list_directory(X, L),
'$do_print_files'(L).
'$load_system_ls'(X,L) :-
'$undefined'(directory_files(X, L), system),
load_files(library(system),[silent(true)]),
fail.
'$load_system_ls'(X,L) :-
system:directory_files(X, L).
'$do_print_files'([]) :-
nl.
'$do_print_files'([F| Fs]) :-