android
This commit is contained in:
parent
3688819ea2
commit
690f1d3830
@ -2133,7 +2133,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char *full,
|
||||
return -1;
|
||||
}
|
||||
Yap_init_consult(consulted, bfp);
|
||||
sno = Yap_OpenStream(fl, AtomRead);
|
||||
sno = Yap_OpenStream(fl,"r");
|
||||
*osnop = Yap_CheckAlias(AtomLoopStream);
|
||||
if (!Yap_AddAlias(AtomLoopStream, sno)) {
|
||||
Yap_CloseStream(sno);
|
||||
|
14
CXX/yapi.cpp
14
CXX/yapi.cpp
@ -934,12 +934,6 @@ void YAPEngine::doInit(YAP_file_type_t BootMode)
|
||||
}
|
||||
/* Begin preprocessor code */
|
||||
/* live */
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "initialize_prolog");
|
||||
#if __ANDROID__
|
||||
Yap_AndroidBufp = (char *)malloc(Yap_AndroidMax = 4096);
|
||||
Yap_AndroidBufp[0] = '\0';
|
||||
Yap_AndroidSz = 0;
|
||||
#endif
|
||||
//yerror = YAPError();
|
||||
#if YAP_PYTHON
|
||||
do_init_python();
|
||||
@ -1015,9 +1009,11 @@ YAPEngine::YAPEngine(int argc, char *argv[],
|
||||
else if (IsPairTerm(t))
|
||||
{
|
||||
Term ts[2];
|
||||
ts[0] = t;
|
||||
ts[1] = m;
|
||||
t = Yap_MkApplTerm(FunctorCsult, 2, ts);
|
||||
Functor FunctorConsult = Yap_MkFunctor(Yap_LookupAtom("consult"), 1);
|
||||
ts[1] = t;
|
||||
ts[0] = m;
|
||||
t = Yap_MkApplTerm(FunctorModule, 2, ts);
|
||||
t = Yap_MkApplTerm(FunctorConsult, 1, &t);
|
||||
tt.put(t);
|
||||
outp = RepAppl(t) + 1;
|
||||
}
|
||||
|
12
os/assets.c
12
os/assets.c
@ -170,13 +170,16 @@ bool exists_a(VFS_t *me, const char *dirName) {
|
||||
}
|
||||
|
||||
|
||||
extern char virtual_cwd[YAP_FILENAME_MAX + 1];
|
||||
|
||||
static bool set_cwd(VFS_t *me, const char *dirName) {
|
||||
|
||||
chdir("/assets");
|
||||
if (!me->virtual_cwd)
|
||||
me->virtual_cwd = malloc(YAP_FILENAME_MAX + 1);
|
||||
strcpy(me->virtual_cwd, dirName);
|
||||
return true;
|
||||
strcpy(virtual_cwd, dirName);
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid",
|
||||
"chdir %s", virtual_cwd);
|
||||
Yap_do_low_level_trace = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -210,7 +213,6 @@ Yap_InitAssetManager(void) {
|
||||
me->enc = ENC_ISO_UTF8; /// how the file is encoded.
|
||||
me->parsers = NULL; /// a set of parsers that can read the stream and generate a term
|
||||
me->writers = NULL;
|
||||
me->virtual_cwd = NULL;
|
||||
LOCK(BGL);
|
||||
me->next = GLOBAL_VFS;
|
||||
GLOBAL_VFS = me;
|
||||
|
20
os/sysbits.c
20
os/sysbits.c
@ -34,13 +34,6 @@ static void FileError(yap_error_number type, Term where, const char *format,
|
||||
}
|
||||
}
|
||||
|
||||
/// Allocate a temporary buffer
|
||||
static char *getFileNameBuffer(void) {
|
||||
|
||||
return Yap_AllocAtomSpace(YAP_FILENAME_MAX);
|
||||
}
|
||||
|
||||
static void freeFileNameBuffer(char *s) { Yap_FreeCodeSpace(s); }
|
||||
|
||||
static Int p_sh(USES_REGS1);
|
||||
static Int p_shell(USES_REGS1);
|
||||
@ -345,6 +338,8 @@ static char *PrologPath(const char *Y, char *X) { return (char *)Y; }
|
||||
#define HAVE_REALPATH 1
|
||||
#endif
|
||||
|
||||
char virtual_cwd[YAP_FILENAME_MAX + 1];
|
||||
|
||||
bool Yap_ChDir(const char *path) {
|
||||
bool rc = false;
|
||||
char qp[FILENAME_MAX + 1];
|
||||
@ -1136,13 +1131,12 @@ static int volume_header(char *file) {
|
||||
int Yap_volume_header(char *file) { return volume_header(file); }
|
||||
|
||||
const char *Yap_getcwd(const char *cwd, size_t cwdlen) {
|
||||
VFS_t *me = GLOBAL_VFS;
|
||||
while(me) {
|
||||
if (me->virtual_cwd) {
|
||||
strcpy(cwd, me->virtual_cwd);
|
||||
return cwd;
|
||||
if (virtual_cwd[0]) {
|
||||
if (!cwd) {
|
||||
cwd = malloc(cwdlen+1);
|
||||
}
|
||||
me = me->next;
|
||||
strcpy( cwd, virtual_cwd);
|
||||
return cwd;
|
||||
}
|
||||
#if _WIN32 || defined(__MINGW32__)
|
||||
if (GetCurrentDirectory(cwdlen, (char *)cwd) == 0) {
|
||||
|
Reference in New Issue
Block a user