merge ssh://ssh.dcc.fc.up.pt:31064/home/vsc/yap
This commit is contained in:
commit
52df4c02ac
@ -1155,15 +1155,6 @@ p_binary_is( USES_REGS1 )
|
||||
Yap_ClearExs();
|
||||
t1 = Yap_Eval(Deref(ARG3));
|
||||
t2 = Yap_Eval(Deref(ARG4));
|
||||
{
|
||||
Atom name;
|
||||
if (IsIntTerm(t)) {
|
||||
Int i = IntOfTerm(t);
|
||||
name = Yap_NameOfBinaryOp(i);
|
||||
} else {
|
||||
name = AtomOfTerm(Deref(ARG2));
|
||||
}
|
||||
}
|
||||
if (IsIntTerm(t)) {
|
||||
Int i = IntOfTerm(t);
|
||||
bool go;
|
||||
|
@ -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();
|
||||
const char *fl = NULL;
|
||||
char *fl = NULL;
|
||||
int lvl = push_text_stack();
|
||||
if (mode == YAP_BOOT_MODE) {
|
||||
mode = YAP_CONSULT_MODE; }
|
||||
@ -2118,8 +2118,14 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
|
||||
pop_text_stack(lvl);
|
||||
*full = NULL;
|
||||
return -1;
|
||||
} else {
|
||||
*full = pop_output_text_stack(lvl,fl);
|
||||
}
|
||||
} else {
|
||||
pop_text_stack(lvl);
|
||||
}
|
||||
|
||||
lvl = push_text_stack();
|
||||
bool consulted = (mode == YAP_CONSULT_MODE);
|
||||
sno = Yap_OpenStream(MkStringTerm(fl), "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
|
||||
if (sno < 0 ||
|
||||
@ -2161,11 +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);
|
||||
#if __unix__
|
||||
Yap_ChDir(dirname(full));
|
||||
#else
|
||||
Yap_ChDir(full);
|
||||
#endif
|
||||
if (osnop >= 0)
|
||||
Yap_AddAlias(AtomLoopStream, *osnop);
|
||||
Yap_end_consult();
|
||||
|
@ -1932,7 +1932,7 @@ fprintf(stderr, "%% \n%% -------------------------------------\n%%\n");
|
||||
}
|
||||
if (b_ptr) {
|
||||
if (!max_count--) {
|
||||
fprintf(stderr, "\** .....\n");
|
||||
fprintf(stderr, "// .....\n");
|
||||
return;
|
||||
}
|
||||
if (b_ptr->cp_ap && /* tabling */
|
||||
|
14
C/yap-args.c
14
C/yap-args.c
@ -153,7 +153,7 @@ const char *Yap_BINDIR, *Yap_ROOTDIR, *Yap_SHAREDIR, *Yap_LIBDIR, *Yap_DLLDIR,
|
||||
* consult loop in C: used to boot the system, butt supports goal execution and recursive consulting.
|
||||
*
|
||||
* */
|
||||
static void consult(const char *b_file USES_REGS) {
|
||||
static bool consult(const char *b_file USES_REGS) {
|
||||
Term t;
|
||||
int c_stream, osno, oactive;
|
||||
Functor functor_query = Yap_MkFunctor(Yap_LookupAtom("?-"), 1);
|
||||
@ -176,7 +176,7 @@ static void consult(const char *b_file USES_REGS) {
|
||||
}
|
||||
if (!Yap_AddAlias(AtomLoopStream, c_stream)) {
|
||||
pop_text_stack(lvl);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
do {
|
||||
@ -188,6 +188,8 @@ static void consult(const char *b_file USES_REGS) {
|
||||
Term vs = YAP_MkVarTerm(), pos = MkVarTerm();
|
||||
t = YAP_ReadClauseFromStream(c_stream, vs, pos);
|
||||
// Yap_GetNèwSlot(t);
|
||||
if (t == TermEof)
|
||||
break;
|
||||
if (t == 0) {
|
||||
fprintf(stderr, "[ SYNTAX ERROR: while parsing stream %s at line %ld ]\n",
|
||||
b_file, GLOBAL_Stream[c_stream].linecount);
|
||||
@ -205,16 +207,17 @@ static void consult(const char *b_file USES_REGS) {
|
||||
} else {
|
||||
YAP_CompileClause(t);
|
||||
}
|
||||
} while (true);
|
||||
yap_error_descriptor_t *errd;
|
||||
if ((errd =
|
||||
Yap_GetException(LOCAL_ActiveError))) {
|
||||
fprintf(stderr, "%s:%ld:0: Error %s %s Found\n", errd->errorFile, (long int) errd->errorLine, errd->classAsText,
|
||||
errd->errorAsText);
|
||||
}
|
||||
} while (t != TermEof);
|
||||
BACKUP_MACHINE_REGS();
|
||||
YAP_EndConsult(c_stream, &osno, full);
|
||||
pop_text_stack(lvl);
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
@ -1038,6 +1041,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
|
||||
init_globals(yap_init);
|
||||
|
||||
start_modules();
|
||||
TermEof = MkAtomTerm( Yap_LookupAtom("end_of_file"));
|
||||
consult(Yap_BOOTSTRAP PASS_REGS);
|
||||
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
||||
MkAtomTerm(Yap_LookupAtom(Yap_BOOTFILE)));
|
||||
@ -1052,8 +1056,8 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
|
||||
MkAtomTerm(Yap_LookupAtom(Yap_INPUT_STARTUP)));
|
||||
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, true);
|
||||
}
|
||||
}
|
||||
YAP_RunGoalOnce(TermInitProlog);
|
||||
|
||||
if (yap_init->install && Yap_OUTPUT_STARTUP) {
|
||||
>>>>>>> ff2b867ec3c3831e10b8465e0a9e3c1a03e3d4d2
|
||||
Term t = MkAtomTerm(Yap_LookupAtom(Yap_OUTPUT_STARTUP));
|
||||
@ -1062,7 +1066,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
|
||||
|
||||
YAP_RunGoalOnce(g);
|
||||
}
|
||||
}
|
||||
|
||||
end_init(yap_init);
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ ${CMAKE_SOURCE_DIR}/packages/gecode/3.7.2
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/3.7.1
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/3.7.0
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/3.6.0
|
||||
${CMAKE_SOURCE_DIR}/packages/problog
|
||||
${CMAKE_SOURCE_DIR}/packages/gecode/dev
|
||||
${CMAKE_SOURCE_DIR}/C/traced_absmi_insts.h
|
||||
${CMAKE_SOURCE_DIR}/H/globals.h
|
||||
|
@ -1062,6 +1062,7 @@ X_API void init_sys(void) {
|
||||
YAP_UserCPredicate("pid", pid, 2);
|
||||
YAP_UserCPredicate("kill", p_kill, 3);
|
||||
YAP_UserCPredicate("mktemp", p_mktemp, 3);
|
||||
YAP_UserCPredicate("list_directory", list_directory, 3);
|
||||
YAP_UserCPredicate("tmpnam", p_tmpnam, 2);
|
||||
YAP_UserCPredicate("tmpdir", p_tmpdir, 2);
|
||||
YAP_UserCPredicate("rename_file", rename_file, 3);
|
||||
|
Reference in New Issue
Block a user