This commit is contained in:
Vitor Santos Costa 2018-06-27 23:49:42 +01:00
parent 1caeb168e9
commit af1fcdac19
6 changed files with 27 additions and 16 deletions

View File

@ -923,27 +923,30 @@ bool Yap_LateInit(const char s[]) {
return false;
}
/// whether Yap is under control of some other system
bool Yap_embedded = true;
struct ssz_t {
size_t Heap, Stack, Trail;
};
bool Yap_Embedded;
static void init_hw(YAP_init_args *yap_init, struct ssz_t *spt) {
Yap_page_size = Yap_InitPageSize(); /* init memory page size, required by
later functions */
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
Yap_init_yapor_global_local_memory();
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
if (!yap_init->Embedded) {
if (yap_init->Embedded) {
yap_init->install = false;
GLOBAL_PrologShouldHandleInterrupts =
!yap_init->PrologCannotHandleInterrupts;
yap_init->PrologCannotHandleInterrupts = true;
} else {
GLOBAL_PrologShouldHandleInterrupts =
!yap_init->PrologCannotHandleInterrupts;
}
Yap_InitSysbits(0); /* init signal handling and time, required by later
functions */
GLOBAL_argv = yap_init->Argv;
GLOBAL_argc = yap_init->Argc;
}
#if __ANDROID__
@ -1005,7 +1008,7 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
if (!LOCAL_TextBuffer)
LOCAL_TextBuffer = Yap_InitTextAllocator();
Yap_embedded = yap_init->Embedded;
Yap_Embedded = yap_init->Embedded;
minfo.Trail = 0, minfo.Stack = 0, minfo.Trail = 0;
init_hw(yap_init, &minfo);

View File

@ -177,6 +177,7 @@ public:
YAPEngineArgs() {
// const std::string *s = new std::string("startup.yss");
Embedded = true;
install = false;
Yap_InitDefaults(this, nullptr, 0, nullptr);
#if YAP_PYTHON
Embedded = true;
@ -202,9 +203,13 @@ public:
inline void setMaxTrailSize(bool fl) { MaxTrailSize = fl; };
inline bool getMaxTrailSize() { return MaxTrailSize; };
inline bool getMaxTrailSize() { return MaxTrailSize; };
inline void setPLDIR(const char *fl) {
inline void createSavedState(bool fl) { install = fl; };
inline bool creatingSavedState() { return install; };
inline void setPLDIR(const char *fl) {
LIBDIR = (const char *)malloc(strlen(fl) + 1);
strcpy((char *)LIBDIR, fl);
};

View File

@ -1,4 +1,4 @@
/*************************************************************************
/*************************************************************************
* *
* YAP Prolog %W% %G% *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
@ -11,7 +11,7 @@
* mods: *
* comments: main header file for YAP *
* version: $Id: Yap.h,v 1.38 2008-06-18 10:02:27 vsc Exp $ *
*************************************************************************/
********** ***************************************************************/
#ifndef YAP_H
@ -826,7 +826,7 @@ inline static void LOG0(const char *f, int l, const char *fmt, ...) {
#include "GitSHA1.h"
extern bool Yap_embedded, Yap_Server;
extern bool Yap_Embedded, Yap_Server;
#include "YapText.h"

View File

@ -176,7 +176,8 @@
]).
:- use_module(library(lists),[
append/3
append/3,
member/2
]).

View File

@ -82,6 +82,9 @@
c_odbc_row/3
]).
:- use_module( library(lists)).
:- meta_predicate db_import(+,+,:), db_import(+,:).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -96,10 +99,9 @@ db_import(Connection,RelationName,PredName0) :-
table_arity( Con, ConType, RelationName, Arity ),
strip_module(PredName0, Module, PredName),
not c_db_check_if_exists_pred(PredName,Arity,Module),
R=..[relation,PredName,Arity,RelationName],
% assert relation fact
assert(myddas_prolog2sql:R),
assert(user:R),
Size is 2*Arity,
length(TypesList, Size),

View File

@ -673,7 +673,7 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
X_API void init_sqlite3(void) {
Term cm = CurrentModule;
CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
CurrentModule = MkAtomTerm(Yap_LookupAtom("user"));
Yap_InitMYDDAS_SQLITE3Preds();