more Android debugging.
This commit is contained in:
parent
3929fc9009
commit
aefb7b3668
@ -301,15 +301,4 @@ typedef enum
|
||||
} yap_flag_t;
|
||||
|
||||
|
||||
#if __ANDROID__
|
||||
#include <android/asset_manager.h>
|
||||
#include <android/asset_manager_jni.h>
|
||||
#include <android/log.h>
|
||||
#else
|
||||
inline void __android_log_print(int i, const char loc[], const char msg[], ...) {}
|
||||
#define ANDROID_LOG_INFO 0
|
||||
#define ANDROID_LOG_ERROR 0
|
||||
#define ANDROID_LOG_DEBUG 0
|
||||
#endif
|
||||
|
||||
#endif /* _YAPDEFS_H */
|
||||
|
26
os/pl-os.c
26
os/pl-os.c
@ -1527,6 +1527,9 @@ PL_changed_cwd(void)
|
||||
UNLOCK();
|
||||
}
|
||||
|
||||
#if __ANDROID__
|
||||
char *Yap_InAssetDir;
|
||||
#endif
|
||||
|
||||
static char *
|
||||
cwd_unlocked(char *cwd, size_t cwdlen)
|
||||
@ -1546,6 +1549,11 @@ to be implemented directly. What about other Unixes?
|
||||
#undef HAVE_GETCWD
|
||||
#endif
|
||||
|
||||
#if __ANDROID__
|
||||
if (Yap_InAssetDir) {
|
||||
rval = strncpy(buf, Yap_InAssetDir, sizeof(buf));
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_GETWD) && !defined(HAVE_GETCWD)
|
||||
rval = getwd(buf);
|
||||
#else
|
||||
@ -1650,7 +1658,7 @@ ChDir(const char *path)
|
||||
succeed;
|
||||
|
||||
AbsoluteFile(path, tmp);
|
||||
__android_log_print(ANDROID_LOG_INFO, __FUNCTION__, "ChDir %s ",osPath);
|
||||
__android_log_print(ANDROID_LOG_INFO, __FUNCTION__, " %s ",ospath);
|
||||
#if __ANDROID__
|
||||
/* treat "/assets" as a directory (actually as a mounted file system).
|
||||
*
|
||||
@ -1668,12 +1676,24 @@ ChDir(const char *path)
|
||||
hyper_path = FALSE;
|
||||
} else if (!strcmp(ospath, "/assets"))
|
||||
hyper_path = TRUE;
|
||||
if (hyper_path) {
|
||||
if (Yap_InAssetDir) {
|
||||
free(Yap_InAssetDir);
|
||||
Yap_InAssetDir = NULL;
|
||||
}
|
||||
Yap_InAssetDir = (char *)malloc(strlen(ospath)+1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( hyper_path ||
|
||||
chdir(ospath) == 0 )
|
||||
{ size_t len;
|
||||
|
||||
#if __ANDROID__
|
||||
if (Yap_InAssetDir) {
|
||||
free(Yap_InAssetDir);
|
||||
Yap_InAssetDir = NULL;
|
||||
}
|
||||
#endif
|
||||
len = strlen(tmp);
|
||||
if ( len == 0 || tmp[len-1] != '/' )
|
||||
{ tmp[len++] = '/';
|
||||
@ -1700,7 +1720,7 @@ ChDir(const char *path)
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
struct tm *PL_localtime_r(time_t time, struct tm *r)
|
||||
|
||||
Convert time in Unix internal form (seconds since Jan 1 1970) into a
|
||||
Convert tunlime in Unix internal form (seconds since Jan 1 1970) into a
|
||||
structure providing easier access to the time.
|
||||
|
||||
For non-Unix systems: struct time is supposed to look like this.
|
||||
|
@ -38,6 +38,18 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if __ANDROID__
|
||||
#include <android/asset_manager.h>
|
||||
#include <android/asset_manager_jni.h>
|
||||
#include <android/log.h>
|
||||
#else
|
||||
inline void __android_log_print(int i, const char loc[], const char msg[], ...) {}
|
||||
#define ANDROID_LOG_INFO 0
|
||||
#define ANDROID_LOG_ERROR 0
|
||||
#define ANDROID_LOG_DEBUG 0
|
||||
#endif
|
||||
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
This modules defines the SWI-Prolog I/O streams. These streams are
|
||||
provided to gain common access to any type of character data: files,
|
||||
|
@ -64,7 +64,7 @@ android/jni/yap_wrap.cpp: $(srcdir)/yap.i
|
||||
cp -r ../../../startup.yss assets/lib/Yap;\
|
||||
cp -r $(DESTDIR)$(SOLIBDIR)/*.so jni;\
|
||||
cp ../Android.mk jni ;\
|
||||
ndk-build; \
|
||||
NDK_DEBUG=1 ndk-build ; \
|
||||
ant debug \
|
||||
)
|
||||
|
||||
|
@ -2,3 +2,4 @@
|
||||
NDK_TOOLCHAIN_VERSION = 4.8
|
||||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
APP_OPTIM := debug
|
||||
|
@ -92,8 +92,8 @@ public class SwigSimple extends Activity
|
||||
outputText.append( "no\n" );
|
||||
}
|
||||
} else {
|
||||
int i=1;
|
||||
while (q.next()) {
|
||||
int i=1;
|
||||
// outputText.append(Integer.toString(i++) + ": " + vs.text() +"\n");
|
||||
while(!vs.nil()){
|
||||
YAPTerm eq = vs.car();
|
||||
|
Reference in New Issue
Block a user