This commit is contained in:
Vítor Santos Costa 2014-06-11 19:36:50 +01:00
parent 6de73e6469
commit 059884bc03
19 changed files with 166 additions and 101 deletions

17
H/Yap.h
View File

@ -49,6 +49,13 @@
/* bzero */
#include <strings.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
/*
@ -445,16 +452,6 @@ extern ADDR Yap_HeapBase;
#ifdef DEBUG
extern int Yap_output_msg;
#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, char *loc, char *msg, ...) {}
#define ANDROID_LOG_INFO 0
#define ANDROID_LOG_ERROR 0
#define ANDROID_LOG_DEBUG 0
#endif
/*************************************************************************************************
variables concerned with atoms table

View File

@ -28,13 +28,13 @@ hence providing a way to access terms without being exposed to stack shifts or g
of a function. Hence, slots should always be used as local variables.
Slots are organized as follows:
---- Offset of next pointer in chain (tagged as an Int)
---- Number of entries (tagged as Int), in the example TAG(INT,4)
---- Offset of next pointer in chain (tagged as an handle_t)
---- Number of entries (tagged as handle_t), in the example TAG(INT,4)
Entry
Entry
Entry
Entry
---- Number of entries (tagged as Int), in the example TAG(INT,4)
---- Number of entries (tagged as handle_t), in the example TAG(INT,4)
Slots are not known to the yaam. Instead, A new set of slots is created when the emulator calls user C-code.
(see YAP_Execute* functions). They are also created:
@ -49,9 +49,9 @@ This section lists the main internal functions for slot management. These functi
*************************************************************************************************/
/// @brief start a new set of slots, linking them to the last active slots (who may, or not, be active).
static inline Int
static inline handle_t
Yap_StartSlots( USES_REGS1 ) {
Int CurSlot = LOCAL_CurSlot;
handle_t CurSlot = LOCAL_CurSlot;
// if (CurSlot == LCL0-(ASP+(IntOfTerm(ASP[0])+2)))
// return CurSlot;
/* new slot */
@ -65,56 +65,56 @@ Yap_StartSlots( USES_REGS1 ) {
/// @brief reset slots to a well-known position in the stack
static inline void
Yap_CloseSlots( Int slot USES_REGS ) {
Yap_CloseSlots( handle_t slot USES_REGS ) {
LOCAL_CurSlot = slot;
}
/// @brief report the current position of the slots, assuming that they occupy the top of the stack.
static inline Int
static inline handle_t
Yap_CurrentSlot( USES_REGS1 ) {
return IntOfTerm(ASP[0]);
}
/// @brief read from a slot.
static inline Term
Yap_GetFromSlot(Int slot USES_REGS)
Yap_GetFromSlot(handle_t slot USES_REGS)
{
return(Deref(LCL0[slot]));
}
/// @brief read from a slot. but does not try to dereference the slot.
static inline Term
Yap_GetDerefedFromSlot(Int slot USES_REGS)
Yap_GetDerefedFromSlot(handle_t slot USES_REGS)
{
return LCL0[slot];
}
/// @brief read the object in a slot. but do not try to dereference the slot.
static inline Term
Yap_GetPtrFromSlot(Int slot USES_REGS)
Yap_GetPtrFromSlot(handle_t slot USES_REGS)
{
return(LCL0[slot]);
}
/// @brief get the memory address of a slot
static inline Term *
Yap_AddressFromSlot(Int slot USES_REGS)
Yap_AddressFromSlot(handle_t slot USES_REGS)
{
return(LCL0+slot);
}
/// @brief store term in a slot
static inline void
Yap_PutInSlot(Int slot, Term t USES_REGS)
Yap_PutInSlot(handle_t slot, Term t USES_REGS)
{
LCL0[slot] = t;
}
/// @brief allocate n empty new slots
static inline Int
static inline handle_t
Yap_NewSlots(int n USES_REGS)
{
Int old_slots = IntOfTerm(ASP[0]), oldn = n;
handle_t old_slots = IntOfTerm(ASP[0]), oldn = n;
while (n > 0) {
RESET_VARIABLE(ASP);
ASP--;
@ -128,7 +128,7 @@ Yap_NewSlots(int n USES_REGS)
static inline Int
Yap_InitSlot(Term t USES_REGS)
{
Int old_slots = IntOfTerm(ASP[0]);
handle_t old_slots = IntOfTerm(ASP[0]);
*ASP = t;
ASP--;
ASP[old_slots+2] = ASP[0] = MkIntTerm(old_slots+1);
@ -137,9 +137,9 @@ Yap_InitSlot(Term t USES_REGS)
/// @brief Succeeds if it is to recover the space allocated for $n$ contiguos slots starting at topSlot.
static inline int
Yap_RecoverSlots(int n, Int topSlot USES_REGS)
Yap_RecoverSlots(int n, handle_t topSlot USES_REGS)
{
Int old_slots = IntOfTerm(ASP[0]);
handle_t old_slots = IntOfTerm(ASP[0]);
if (old_slots < n) {
return FALSE;
}

View File

@ -16,6 +16,13 @@
#ifndef YAP_H
#include "YapTermConfig.h"
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
typedef void *Functor;
typedef void *Atom;
@ -31,11 +38,12 @@ typedef void *Atom;
/* defines integer types Int and UInt (unsigned) with the same size as a ptr
** and integer types Short and UShort with half the size of a ptr */
/* */ typedef intptr_t Int;
/* */ typedef uintptr_t UInt;
#if SIZEOF_INT_P==4
#if SIZEOF_INT==4
/* */ typedef int Int;
/* */ typedef unsigned int UInt;
#define Int_FORMAT "%d"
#define UInt_FORMAT "%u"
@ -62,23 +70,17 @@ typedef void *Atom;
#elif SIZEOF_INT_P==8
#if SIZEOF_INT==8
/* */ typedef int Int;
/* */ typedef unsigned int UInt;
#define Int_FORMAT "%d"
#define UInt_FORMAT "%u"
#elif SIZEOF_LONG_INT==8
/* */ typedef long int Int;
/* */ typedef unsigned long int UInt;
#define Int_FORMAT "%ld"
#define UInt_FORMAT "%lu"
# elif SIZEOF_LONG_LONG_INT==8
/* */ typedef long long int Int;
/* */ typedef unsigned long long int UInt;
/
#define Int_FORMAT "%I64d"
#define UInt_FORMAT "%I64u"
@ -129,6 +131,8 @@ typedef UInt BITS32;
typedef CELL Term;
typedef Int handle_t;
/* */ typedef double Float;
#if SIZEOF_INT<SIZEOF_INT_P

View File

@ -369,7 +369,7 @@ int Yap_signal_index(const char *);
#ifdef MAC
void Yap_SetTextFile(char *);
#endif
int Yap_getcwd(const char *, int);
char *Yap_getcwd(const char *, size_t);
void Yap_cputime_interval(Int *,Int *);
void Yap_systime_interval(Int *,Int *);
void Yap_walltime_interval(Int *,Int *);

View File

@ -376,7 +376,7 @@
FunctorContext2 = Yap_MkFunctor(AtomContext,2);
FunctorConsistencyError = Yap_MkFunctor(AtomConsistencyError,1);
FunctorCreep = Yap_MkFunctor(AtomCreep,1);
FunctorCsult = Yap_MkFunctor(AtomCsult,1);
FunctorCsult = Yap_MkFunctor(AtomCsult,2);
FunctorCurrentModule = Yap_MkFunctor(AtomCurrentModule,1);
FunctorCutBy = Yap_MkFunctor(AtomCutBy,1);
FunctorDBREF = Yap_MkFunctor(AtomDBREF,1);

View File

@ -28,6 +28,7 @@
#endif
#endif
// SWI Options
#define O_STRING 1
#define O_QUASIQUOTATIONS 1
@ -383,5 +384,4 @@ CloseList(Term t0, Term tail)
}
#endif /* PL_SHARED_INCLUDE */

View File

@ -267,6 +267,7 @@ int Yap_GetCharForSIGINT(void);
Int Yap_StreamToFileNo(Term);
Term Yap_OpenStream(FILE *,char *,Term,int);
char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length, int *encoding, int flags);
char *Yap_HandleToString(term_t l, size_t sz, size_t *length, int *encoding, int flags);
int Yap_GetFreeStreamD(void);
int Yap_GetFreeStreamDForReading(void);

View File

@ -514,9 +514,6 @@ c_interface.i: C/c_interface.c include/c_interface.h
$(CC) -E $(C_INTERF_FLAGS) C/c_interface.c > $@
#
mycb: mycb.c
$(CC) $(CFLAGS) mycb.c -o mycb
INSTALLED_PACKAGES= \
library/matrix \
library/random \
@ -572,7 +569,7 @@ all: startup.yss
-rm -f startup.yss
echo "bootstrap('$(srcdir)/pl/init.yap'). module(user). qsave_program('startup.yss')." | @PRE_INSTALL_ENV@ ./yap@EXEC_SUFFIX@ -b $(srcdir)/pl/boot.yap
yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@
yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@ libYap.a
$(MPI_CC) $(EXECUTABLE_CFLAGS) $(LDFLAGS) -o yap@EXEC_SUFFIX@ yap.o @YAPLIB@ $(LIBS)
yap-win: yap-win@EXEC_SUFFIX@
@ -583,27 +580,29 @@ yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@
(cd swi/console; $(MAKE))
$(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win@EXEC_SUFFIX@ $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) -lgdi32 @MPILDF@
libYap.a: $(LIB_OBJECTS)
libYap.a: $(LIB_OBJECTS) yapi.o
-rm -f libYap.a
$(AR) rc libYap.a $(LIB_OBJECTS)
$(AR) rc libYap.a $(LIB_OBJECTS) yapi.o
$(RANLIB) libYap.a
@DYNYAPLIB@: $(LIB_OBJECTS) yapi.o libYap.a
@YAPLIB_LD@ -o @YAPLIB@ $(LIB_OBJECTS) $(LIBS) $(LDFLAGS) $(SONAMEFLAG)
@DYNYAPLIB@: $(LIB_OBJECTS)
@SHLIB_LD@ -o @YAPLIB@ $(LIB_OBJECTS) $(LIBS) $(LDFLAGS) $(SONAMEFLAG)
for p in $(EXTRAYAPLIBS); do \
$(LN_S) -f @DYNYAPLIB@ $$p; \
done
@STARTUP_ANDROID@startup.yss: yap@EXEC_SUFFIX@ @DYNYAPLIB@ $(PL_SOURCES) $(SWI_LIB_SOURCES) install_unix
@STARTUP_ANDROID@startup.yss: yap@EXEC_SUFFIX@ @DYNYAPLIB@ $(PL_SOURCES) $(SWI_LIB_SOURCES)
adb shell mkdir -p /data/yap
adb shell mkdir -p /data/yap/pl
adb shell mkdir -p /data/yap/swi/library
adb push yap /data/yap/
adb push @DYNYAPLIB@ /data/yap/
adb push $(GMPDIR)/lib/libgmp.so data/yap/
adb push $(srcdir)/swi/library /data/yap/swi/library
adb push $(srcdir)/pl /data/yap/pl/
adb shell "echo \"bootstrap('/data/yap/pl/init.yap'). module(user). qsave_program('/data/yap/startup.yss').\" | LD_LIBRARY_PATH=/data/yap /data/yap/yap@EXEC_SUFFIX@ -b /data/yap/pl/boot.yap"
adb pull /data/yap/startup.yss
$(MAKE) install_unix
install: @INSTALL_COMMAND@ install_startup install_common
@ -733,11 +732,11 @@ install_info:
fi; \
$(INSTALL_INFO) --quiet --section "Programming Languages" --entry="`cat pillow_doc.infoindex`" --info-dir=$(DESTDIR)$(INFODIR) pillow_doc.info
install_docs:
install_docs: doxygen
$(MAKE) pdf
$(MAKE) html
$(INSTALL_DATA) yap.html* $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) yap.pdf $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) html $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) pdf $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) README.TXT $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) Artistic $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) COPYING $(DESTDIR)$(DOCSDIR)
@ -746,6 +745,8 @@ install_docs:
$(INSTALL_DATA) changes-5.1.html $(DESTDIR)$(DOCSDIR)
$(INSTALL_DATA) changes-6.0.html $(DESTDIR)$(DOCSDIR)
doxygen:
doxygen $(srcdir)/docs/doxygen.rc
info: yap.info

View File

@ -12,4 +12,12 @@
#undef SIZEOF_FLOAT
#undef SIZEOF_DOUBLE
#ifndef HAVE_INTTYPES_H
#undef HAVE_INTTYPES_H
#endif
#ifndef HAVE_STDINT_H
#undef HAVE_STDINT_H
#endif
#endif

View File

@ -507,6 +507,9 @@
/* Define to 1 if you have the `pthread_mutexattr_settype' function. */
#undef HAVE_PTHREAD_MUTEXATTR_SETTYPE
/* Define to 1 if you have the `pthread_setconcurrency' function. */
#undef HAVE_PTHREAD_SETCONCURRENCY
/* Define to 1 if you have the `putenv' function. */
#undef HAVE_PUTENV

54
configure vendored
View File

@ -707,6 +707,7 @@ TARGETS
IN_SWI
IN_YAP
PROLOG_SYSTEM
GCC_VERSION
M4GENABSMI
SAVED_STATE_PREFIX
INSTALL_PRISM
@ -865,7 +866,7 @@ enable_chr
enable_clpqr
enable_april
enable_dlcompat
enable_clpbn_horus
enable_horus
with_gmp
with_R
with_judy
@ -1543,7 +1544,7 @@ Optional Features:
--enable-clpqr install clpqr library
--enable-april compile Yap to support April ILP system
--enable-dlcompat use dlcompat library for dynamic loading on Mac OS X
--enable-clpbn-horus enable CLPBN HORUS library.
--enable-horus enable CLPBN HORUS library.
--enable-myddas[=DIR] enable the MYDDAS library
--enable-myddas-stats enable the MYDDAS library statistics support
--enable-myddas-top-level enable the MYDDAS top-level support to MySQL
@ -4527,11 +4528,11 @@ else
fi
# Check whether --enable-clpbn-horus was given.
if test "${enable_clpbn_horus+set}" = set; then :
enableval=$enable_clpbn_horus; yap_cv_clpbn_horus="$enableval"
# Check whether --enable-horus was given.
if test "${enable_horus+set}" = set; then :
enableval=$enable_horus; yap_cv_horus="$enableval"
else
horus=yes
yap_cv_horus=yes
fi
@ -4784,7 +4785,7 @@ else
INSTALL_PRISM="packages/prism/src/c packages/prism/src/prolog"
fi
if test "$yap_cv_clpbn_bp"="yes"; then
if test "$yap_cv_horus"="yes"; then
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -4813,7 +4814,7 @@ $as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
yap_cv_clpbn_bp=no
yap_cv_horus=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@ -4826,7 +4827,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
if test "$yap_cv_clpbn_bp" = no
if test "$yap_cv_horus" = no
then
PKG_CLPBN="packages/CLPBN"
else
@ -6256,7 +6257,7 @@ fi
fi
else
if test "$prefix" = "NONE"
if test "$prefix" = "NONE" -a x"$SYSROOT" = x
then
prefix=/usr/local
fi
@ -6264,8 +6265,11 @@ else
then
LDFLAGS="$LDFLAGS -L${prefix}/lib64"
fi
LDFLAGS="$LDFLAGS -L${prefix}/lib"
CPPFLAGS="$CPPFLAGS -I${prefix}/include"
if test x"$SYSROOT" = x
then
LDFLAGS="$LDFLAGS -L${prefix}/lib"
CPPFLAGS="$CPPFLAGS -I${prefix}/include"
fi
if test "$exec_prefix" != "NONE" -a "$exec_prefix" != "$prefix"
then
if test -d "${exec_prefix}/lib64" -a "$YAP_TARGET" = amd64; then
@ -6317,7 +6321,7 @@ _ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -llog" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -llog" >&5
$as_echo_n "checking for main in -llog... " >&6; }
if ${ac_cv_lib_log_main+:} false; then :
$as_echo_n "(cached) " >&6
@ -6990,7 +6994,7 @@ fi
done
for ac_func in pthread_mutexattr_setkind_np pthread_mutexattr_settype
for ac_func in pthread_mutexattr_setkind_np pthread_mutexattr_settype pthread_setconcurrency
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -8041,7 +8045,7 @@ fi
done
for ac_header in float.h fpu_control.h ieeefp.h io.h limits.h
for ac_header in float.h fpu_control.h ieeefp.h inttypes.h io.h limits.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -9567,6 +9571,8 @@ case "$host" in
*android*)
echo "no locale"
SAVED_STATE_PREFIX="/assets/lib/Yap/"
;;
**)
for ac_header in locale.h
@ -10699,7 +10705,11 @@ case "$CPP" in
*) ACPP="$CPP"
esac
( CC=$ACC; LD=$ALD; CPP=$ACPP; CFLAGS=$SHLIB_CFLAGS; LDFLAGS=$LDFLAGS;
( if test x"$SYSROOT" != x; then
CC="$ACC --sysroot=$SYSROOT"; LD=$ALD; CPP="$ACPP --sysroot=$SYSROOT"; CFLAGS=$SHLIB_CFLAGS; LDFLAGS=$LDFLAGS;
else
CC=$ACC; LD=$ALD; CPP=$ACPP; CFLAGS=$SHLIB_CFLAGS; LDFLAGS=$LDFLAGS;
fi
export CC LD CFLAGS LDFLAGS;
mkdir -p packages/clib/maildrop/rfc822;
mkdir -p packages/clib/maildrop/rfc2045;
@ -12629,7 +12639,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 12632 "configure" */
/* #line 12642 "configure" */
public class Test {
}
EOF
@ -12805,7 +12815,7 @@ EOF
if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes
else
echo "configure: 12808: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: 12818: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5
cat Test.uue >&5
ac_cv_prog_uudecode_base64=no
@ -12936,7 +12946,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 12939 "configure" */
/* #line 12949 "configure" */
public class Test {
}
EOF
@ -12971,7 +12981,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class
TEST=Test
cat << \EOF > $JAVA_TEST
/* [#]line 12974 "configure" */
/* [#]line 12984 "configure" */
public class Test {
public static void main (String args[]) {
System.exit (0);
@ -15741,7 +15751,7 @@ else
fi
if test -d /usr/local/include/gecode; then
if test -d /usr/local/include/gecode -a x$SYSROOT = x; then
CFLAGS="$CFLAGS -I/usr/local/include"
SHLIB_CXXFLAGS="$SHLIB_CXXFLAGS -I/usr/local/include"
GECODE_EXTRALIBS="-L/usr/local/lib"
@ -15961,7 +15971,7 @@ _ACEOF
cat >>confdefs.h <<_ACEOF
#define C_CFLAGS "$CFLAGS $YAP_EXTRAS $DEFS -D_YAP_NOT_INSTALLED_=1 $CPPFLAGS -I. -I$srcdir/H -I$srcdir/include -I$srcdir/os -I$srcdir/OPTYap -I$srcdir/BEAM"
#define C_CFLAGS "$CFLAGS $YAP_EXTRAS $ -D_YAP_NOT_INSTALLED_=1 $CPPFLAGS -I. -I$srcdir/H -I$srcdir/include -I$srcdir/os -I$srcdir/OPTYap -I$srcdir/BEAM"
_ACEOF

View File

@ -184,9 +184,9 @@ AC_ARG_ENABLE(dlcompat,
[ --enable-dlcompat use dlcompat library for dynamic loading on Mac OS X],
use_dlcompat="$enableval", use_dlcompat=no)
AC_ARG_ENABLE(clpbn-horus,
[ --enable-clpbn-horus enable CLPBN HORUS library. ],
yap_cv_clpbn_horus="$enableval", horus=yes)
AC_ARG_ENABLE(horus,
[ --enable-horus enable CLPBN HORUS library. ],
yap_cv_horus="$enableval", yap_cv_horus=yes)
AC_ARG_WITH(gmp,
[ --with-gmp[=DIR] use GNU Multiple Precision in DIR],
@ -368,7 +368,7 @@ else
INSTALL_PRISM="packages/prism/src/c packages/prism/src/prolog"
fi
if test "$yap_cv_clpbn_bp"="yes"; then
if test "$yap_cv_horus"="yes"; then
AC_LANG_PUSH([C++])
my_save_cxxflags="$CXXFLAGS"
CXXFLAGS=-std=c++0x
@ -376,13 +376,13 @@ if test "$yap_cv_clpbn_bp"="yes"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
[yap_cv_clpbn_bp=no]
[yap_cv_horus=no]
)
CXXFLAGS="$my_save_cxxflags"
AC_LANG_POP()
fi
if test "$yap_cv_clpbn_bp" = no
if test "$yap_cv_horus" = no
then
PKG_CLPBN="packages/CLPBN"
else
@ -597,7 +597,7 @@ then
AC_CHECK_LIB(pthread,pthread_create)
fi
else
if test "$prefix" = "NONE"
if test "$prefix" = "NONE" -a x"$SYSROOT" = x
then
prefix=/usr/local
fi
@ -605,8 +605,11 @@ else
then
LDFLAGS="$LDFLAGS -L${prefix}/lib64"
fi
LDFLAGS="$LDFLAGS -L${prefix}/lib"
CPPFLAGS="$CPPFLAGS -I${prefix}/include"
if test x"$SYSROOT" = x
then
LDFLAGS="$LDFLAGS -L${prefix}/lib"
CPPFLAGS="$CPPFLAGS -I${prefix}/include"
fi
if test "$exec_prefix" != "NONE" -a "$exec_prefix" != "$prefix"
then
if test -d "${exec_prefix}/lib64" -a "$YAP_TARGET" = amd64; then
@ -620,7 +623,7 @@ else
case "$host" in
*android*)
AC_CHECK_LIB(android,main)
AC_CHECK_LIB(log,main)
AC_CHECK_LIB(log,main)
;;
**)
STARTUP_ANDROID="x"
@ -672,7 +675,7 @@ fi
if test "$threads" = yes
then
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_FUNCS(pthread_mutexattr_setkind_np pthread_mutexattr_settype)
AC_CHECK_FUNCS(pthread_mutexattr_setkind_np pthread_mutexattr_settype pthread_setconcurrency)
if test "$pthreadlocking" = yes
then
AC_DEFINE(USE_PTHREAD_LOCKING, 1, [do not use our own locking routines])
@ -1238,7 +1241,7 @@ AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(arpa/inet.h alloca.h crtdbg.h crypt.h)
AC_CHECK_HEADERS(ctype.h direct.h dirent.h dlfcn.h)
AC_CHECK_HEADERS(errno.h execinfo.h fcntl.h fenv.h)
AC_CHECK_HEADERS(float.h fpu_control.h ieeefp.h io.h limits.h)
AC_CHECK_HEADERS(float.h fpu_control.h ieeefp.h inttypes.h io.h limits.h)
AC_CHECK_HEADERS(malloc.h math.h memory.h)
AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/tcp.h pwd.h regex.h shlobj.h)
AC_CHECK_HEADERS(siginfo.h signal.h stdarg.h stdint.h string.h stropts.h)
@ -1655,6 +1658,8 @@ case "$host" in
*android*)
echo "no locale"
SAVED_STATE_PREFIX="/assets/lib/Yap/"
AC_SUBST(C_PARSER_FLAGS)
AC_SUBST(GCC_VERSION)
;;
**)
AC_CHECK_HEADERS(locale.h)
@ -2027,7 +2032,7 @@ yap_nversion=`expr $YAP_MAJOR_VERSION \* 10000 + $YAP_MINOR_VERSION \* 100 + $YA
yap_startup=startup.yss
AC_DEFINE_UNQUOTED( C_CC, [ "$CC" ], [c-compiler used])
AC_DEFINE_UNQUOTED( C_CFLAGS, ["$CFLAGS $YAP_EXTRAS $DEFS -D_YAP_NOT_INSTALLED_=1 $CPPFLAGS -I. -I$srcdir/H -I$srcdir/include -I$srcdir/os -I$srcdir/OPTYap -I$srcdir/BEAM" ], [compilation flags])
AC_DEFINE_UNQUOTED( C_CFLAGS, ["$CFLAGS $YAP_EXTRAS $ -D_YAP_NOT_INSTALLED_=1 $CPPFLAGS -I. -I$srcdir/H -I$srcdir/include -I$srcdir/os -I$srcdir/OPTYap -I$srcdir/BEAM" ], [compilation flags])
AC_DEFINE_UNQUOTED( C_LDFLAGS, [ "$LDFLAGS" ], [linking flags])
AC_DEFINE_UNQUOTED( C_LIBS, [ "$LIBS" ], [main libs for YAP])
AC_DEFINE_UNQUOTED( C_LIBPLSO, [ "$LIBS $EXTRA_LIBS_FOR_DLLS" ], [libs for linking with DLLs])

View File

@ -136,7 +136,7 @@ typedef unsigned long uintptr_t;
#ifndef PL_HAVE_TERM_T
#define PL_HAVE_TERM_T
typedef uintptr_t term_t;
typedef intptr_t term_t;
#endif
typedef struct mod_entry *module_t;
typedef struct DB_STRUCT *record_t;
@ -505,7 +505,7 @@ extern X_API int PL_compare(term_t, term_t);
/* begin PL_unify_* functions =============================*/
extern X_API int PL_unify(term_t, term_t);
extern X_API int PL_unify_atom(term_t, atom_t);
extern X_API int PL_unify_arg(int, term_t, atom_t);
extern X_API int PL_unify_arg(int, term_t, term_t);
extern X_API int PL_unify_atom_chars(term_t, const char *);
extern X_API int PL_unify_atom_nchars(term_t, size_t len, const char *);
extern X_API int PL_unify_float(term_t, double);

View File

@ -43,6 +43,8 @@ typedef Term YAP_Module;
typedef int YAP_Bool;
typedef handle_t YAP_handle_t;
#define YAP_PredEntryPtr struct pred_entry *
#define YAP_UserCPred CPredicate
@ -91,6 +93,8 @@ typedef double YAP_Float;
#define FALSE 0
#endif
typedef YAP_Int YAP_handle_t;
typedef struct YAP_pred_entry *YAP_PredEntryPtr;
typedef YAP_Bool (* YAP_UserCPred)(void);
@ -110,6 +114,9 @@ typedef struct YAP_thread_attr_struct {
YAP_Term egoal, alias;
} YAP_thread_attr;
#ifdef YAP_H
#include <threads.h>
#endif
typedef enum {
YAP_TAG_ATT = 0x1,
@ -293,4 +300,16 @@ typedef enum
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
} 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 */

View File

@ -420,31 +420,31 @@ extern X_API void YAP_FlushAllStreams(void);
#define YAP_SEEKABLE_STREAM 0x80
/* YAP_Term *YAP_NewSlots() */
extern X_API YAP_Int YAP_NewSlots(int);
extern X_API YAP_handle_t YAP_NewSlots(int);
/* YAP_Int YAP_CurrentSlot() */
extern X_API YAP_Int YAP_CurrentSlot(void);
extern X_API YAP_handle_t YAP_CurrentSlot(void);
/* YAP_Term *YAP_InitSlot() */
extern X_API YAP_Int YAP_InitSlot(YAP_Term);
extern X_API YAP_handle_t YAP_InitSlot(YAP_Term);
/* YAP_Term YAP_GetFromSlots(t) */
extern X_API YAP_Term YAP_GetFromSlot(YAP_Int);
extern X_API YAP_Term YAP_GetFromSlot(YAP_handle_t);
/* YAP_Term *YAP_AddressFromSlots(t) */
extern X_API YAP_Term *YAP_AddressFromSlot(YAP_Int);
extern X_API YAP_Term *YAP_AddressFromSlot(YAP_handle_t);
/* YAP_Term *YAP_AddressOfTermInSlot(t) */
extern X_API YAP_Term *YAP_AddressOfTermInSlot(YAP_Int);
extern X_API YAP_Term *YAP_AddressOfTermInSlot(YAP_handle_t);
/* YAP_Term YAP_PutInSlots(t) */
extern X_API void YAP_PutInSlot(YAP_Int, YAP_Term);
extern X_API void YAP_PutInSlot(YAP_handle_t, YAP_Term);
extern X_API int YAP_RecoverSlots(int n, YAP_Int top_slot);
extern X_API int YAP_RecoverSlots(int n, YAP_handle_t top_slot);
extern X_API YAP_Int YAP_ArgsToSlots(int);
extern X_API YAP_handle_t YAP_ArgsToSlots(int);
extern X_API void YAP_SlotsToArgs(int, YAP_Int);
extern X_API void YAP_SlotsToArgs(int, YAP_handle_t);
/* void YAP_Throw() */
extern X_API void YAP_Throw(YAP_Term);

View File

@ -295,6 +295,23 @@ list_directory(void)
YAP_PutInSlot(sl,YAP_MkPairTerm(ti, YAP_GetFromSlot(sl)));
}
_findclose( hFile );
#elif __ANDROID__
{
extern AAssetManager *assetManager;
const char *dirName = buf+strlen("/assets/");
AAssetManager* mgr = assetManager;
AAssetDir *de;
const char* dp;
if ((de = AAssetManager_openDir(mgr, dirName)) == NULL) {
return(YAP_Unify(YAP_ARG3, YAP_MkIntTerm(errno)));
}
while (( dp = AAssetDir_getNextFileName(de))) {
YAP_Term ti = YAP_MkAtomTerm(YAP_LookupAtom(dp));
YAP_PutInSlot(sl,YAP_MkPairTerm(ti, YAP_GetFromSlot(sl)));
}
AAssetDir_close(de);
}
#elif HAVE_OPENDIR
{
DIR *de;

View File

@ -381,7 +381,7 @@ F CommentHook CommentHook 3
F Context2 Context 2
F ConsistencyError ConsistencyError 1
F Creep Creep 1
F Csult Csult 1
F Csult Csult 2
F CurrentModule CurrentModule 1
F CutBy CutBy 1
F DBREF DBREF 1

View File

@ -269,7 +269,7 @@ UInt exo_arg =0
struct scan_atoms* search_atoms void
// Slots
Int CurSlot =0
handle_t CurSlot =0
Term SourceModule =0

View File

@ -5,7 +5,7 @@ AC_ARG_ENABLE(gecode,
[use_gecode="$enableval"], use_gecode=no)
dnl gecode is usually in /usr/local
if test -d /usr/local/include/gecode; then
if test -d /usr/local/include/gecode -a x$SYSROOT = x; then
CFLAGS="$CFLAGS -I/usr/local/include"
SHLIB_CXXFLAGS="$SHLIB_CXXFLAGS -I/usr/local/include"
GECODE_EXTRALIBS="-L/usr/local/lib"