This commit is contained in:
Vitor Santos Costa 2018-06-19 12:29:16 +01:00
parent 3e5cd4b4f1
commit 25faa8f67c

View File

@ -15,11 +15,12 @@
* * * *
*************************************************************************/ *************************************************************************/
/* static char SccsId[] = "X 4.3.3"; */ /* static char SccsId[] = "X 4.3.3"; */
#include "config.h"
#include "Yap.h" #include "Yap.h"
#include "YapHeap.h" #include "YapHeap.h"
#include "YapInterface.h" #include "YapInterface.h"
#include "YapStreams.h" #include "YapStreams.h"
#include "config.h"
#include "iopreds.h" #include "iopreds.h"
#if HAVE_UNISTD_H #if HAVE_UNISTD_H
@ -158,15 +159,15 @@ static void consult(const char *b_file USES_REGS) {
Functor functor_query = Yap_MkFunctor(Yap_LookupAtom("?-"), 1); Functor functor_query = Yap_MkFunctor(Yap_LookupAtom("?-"), 1);
Functor functor_command1 = Yap_MkFunctor(Yap_LookupAtom(":-"), 1); Functor functor_command1 = Yap_MkFunctor(Yap_LookupAtom(":-"), 1);
Functor functor_compile2 = Yap_MkFunctor(Yap_LookupAtom("c_compile"), 1); Functor functor_compile2 = Yap_MkFunctor(Yap_LookupAtom("c_compile"), 1);
char *full;
/* consult in C */ /* consult in C */
int lvl = push_text_stack(); int lvl = push_text_stack();
char *full = Malloc(YAP_FILENAME_MAX + 1); - char *full = Malloc(YAP_FILENAME_MAX + 1);
full[0] = '\0'; full[0] = '\0';
/* the consult mode does not matter here, really */ /* the consult mode does not matter here, really */
if ((osno = Yap_CheckAlias(AtomLoopStream)) < 0) { vvvif ((osno = Yap_CheckAlias(AtomLoopStream)) < 0)
osno = 0; osno = 0;
}
c_stream = YAP_InitConsult(YAP_BOOT_MODE, b_file, &full, &oactive); c_stream = YAP_InitConsult(YAP_BOOT_MODE, b_file, &full, &oactive);
if (c_stream < 0) { if (c_stream < 0) {
fprintf(stderr, "[ FATAL ERROR: could not open file %s ]\n", b_file); fprintf(stderr, "[ FATAL ERROR: could not open file %s ]\n", b_file);
@ -184,7 +185,7 @@ static void consult(const char *b_file USES_REGS) {
Yap_StartSlots(); Yap_StartSlots();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "read %s <%d>", b_file, __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "read %s <%d>", b_file,
GLOBAL_Stream[c_stream].linecount); GLOBAL_Stream[c_stream].linecount);
Term vs = MkVarTerm(), pos = MkVarTerm(); Term vs = YAP_MkVarTerm(), pos = MkVarTerm();
t = YAP_ReadClauseFromStream(c_stream, vs, pos); t = YAP_ReadClauseFromStream(c_stream, vs, pos);
// Yap_GetNèwSlot(t); // Yap_GetNèwSlot(t);
if (t == 0) { if (t == 0) {
@ -317,7 +318,7 @@ static void Yap_set_locations(YAP_init_args *iap) {
/// BOOTPLDIR: where we can find Prolog bootstrap files /// BOOTPLDIR: where we can find Prolog bootstrap files
Yap_BOOTSTRAP = sel(true, iap->BOOTSTRAP != NULL, iap->BOOTSTRAP, true, Yap_BOOTSTRAP = sel(true, iap->BOOTSTRAP != NULL, iap->BOOTSTRAP, true,
#if __ANDROID__ #if __ANDROID__
"/assets/Yap/pl/boot.yap", "/assets/Yap/pl/boot,yap",
#else #else
join(getenv("DESTDIR"), YAP_BOOTSTRAP), join(getenv("DESTDIR"), YAP_BOOTSTRAP),
#endif #endif
@ -977,7 +978,7 @@ static void end_init(YAP_init_args *iap) {
YAP_initialized = true; YAP_initialized = true;
if (iap->HaltAfterBoot) Yap_exit(0); if (iap->HaltAfterBoot) Yap_exit(0);
LOCAL_PrologMode &= ~BootMode; LOCAL_PrologMode &= ~BootMode;
CurrentModule = USER_MODULE; CurrentModule = USER_MODULE
} }
static void start_modules(void) { static void start_modules(void) {
@ -1054,8 +1055,9 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
YAP_RunGoalOnce(TermInitProlog); YAP_RunGoalOnce(TermInitProlog);
if (yap_init->install && Yap_OUTPUT_STARTUP) { if (yap_init->install && Yap_OUTPUT_STARTUP) {
>>>>>>> ff2b867ec3c3831e10b8465e0a9e3c1a03e3d4d2
Term t = MkAtomTerm(Yap_LookupAtom(Yap_OUTPUT_STARTUP)); Term t = MkAtomTerm(Yap_LookupAtom(Yap_OUTPUT_STARTUP));
Term g = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("qsave_program"), 1), Term g = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("qsave_program"), 1),
1, &t); 1, &t);
YAP_RunGoalOnce(g); YAP_RunGoalOnce(g);