win32 patches

This commit is contained in:
Vítor Santos Costa 2014-10-28 12:56:26 +00:00
parent 6b93b8ee5a
commit 546af97345
9 changed files with 172 additions and 69 deletions

View File

@ -338,7 +338,8 @@ Yap_gmp_ior_int_big(Int i, Term t)
}
#if USE_GMP
#if !defined(HAVE_MPZ_XOR)
// cross-compilers...
#if !defined(HAVE_MPZ_XOR) && !defined(mpz_xor)
static void
mpz_xor(MP_INT *new, MP_INT *r1, MP_INT *r2)
{

View File

@ -276,7 +276,7 @@ Yap_InitSysPath(void) {
/* couldn't find it where it was supposed to be,
let's try using the executable */
if (!GetModuleFileName( GetCurrentProcess(), LOCAL_FileNameBuf, YAP_FILENAME_MAX)) {
if (!GetModuleFileName( NULL, LOCAL_FileNameBuf, YAP_FILENAME_MAX)) {
Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "could not find executable name");
/* do nothing */
return;
@ -1438,7 +1438,7 @@ Yap_MathException__( USES_REGS1 )
return EVALUATION_ERROR_UNDEFINED;
}
}
#elif _WIN32
#elif _WIN32 && FALSE
unsigned int raised;
int err;

16
H/Yap.h
View File

@ -217,6 +217,22 @@ typedef int _Bool;
#define LOW_PROF 1
#endif
#if !defined(HAVE_STRNLEN)
INLINE_ONLY inline EXTERN size_t
strnlen(const char *s, size_t maxlen);
INLINE_ONLY inline EXTERN size_t
strnlen(const char *s, size_t maxlen)
{
size_t i = 0;
while (s[i]) {
if (i == maxlen)
return i;
i++;
}
return i;
}
#endif
/* #define FORCE_SECOND_QUADRANT 1 */

View File

@ -337,6 +337,9 @@
/* Define to 1 if you have the <ieeefp.h> header file. */
#undef HAVE_IEEEFP_H
/* Define to 1 if you have the <IntSafe.h> header file. */
#undef HAVE_INTSAFE_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@ -794,6 +797,9 @@
/* Define to 1 if you have the `strncpy' function. */
#undef HAVE_STRNCPY
/* Define to 1 if you have the `strnlen' function. */
#undef HAVE_STRNLEN
/* Define to 1 if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H
@ -923,6 +929,9 @@
/* Define to 1 if you have the <windef.h> header file. */
#undef HAVE_WINDEF_H
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H

47
configure vendored
View File

@ -6936,6 +6936,31 @@ fi
fi
for ac_header in IntSafe.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "IntSafe.h" "ac_cv_header_IntSafe_h" "$ac_includes_default"
if test "x$ac_cv_header_IntSafe_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_INTSAFE_H 1
_ACEOF
fi
done
for ac_header in windows.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default"
if test "x$ac_cv_header_windows_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_WINDOWS_H 1
_ACEOF
fi
done
if test "$threads" = yes
then
for ac_header in pthread.h
@ -9792,7 +9817,19 @@ _ACEOF
fi
done
for ac_func in strchr strerror stricmp strlwr strncat strncpy strtod
for ac_func in strchr strerror stricmp
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"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in strnlen strlwr strncat strncpy strtod
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"
@ -14042,7 +14079,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 14045 "configure" */
/* #line 14082 "configure" */
public class Test {
}
EOF
@ -14218,7 +14255,7 @@ EOF
if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes
else
echo "configure: 14221: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: 14258: 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
@ -14349,7 +14386,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
/* #line 14352 "configure" */
/* #line 14389 "configure" */
public class Test {
}
EOF
@ -14384,7 +14421,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class
TEST=Test
cat << \EOF > $JAVA_TEST
/* [#]line 14387 "configure" */
/* [#]line 14424 "configure" */
public class Test {
public static void main (String args[]) {
System.exit (0);

View File

@ -660,6 +660,9 @@ if test "$yap_cv_judy" != "no"; then
AC_CHECK_LIB(Judy, Judy1Set,,[AC_MSG_RESULT([libJudy not found, UDI will only work with one Index at a time])])
fi
AC_CHECK_HEADERS(IntSafe.h)
AC_CHECK_HEADERS(windows.h)
if test "$threads" = yes
then
AC_CHECK_HEADERS(pthread.h)
@ -1659,7 +1662,8 @@ AC_CHECK_FUNCS(rename rint sbrk select setbuf setlinebuf)
AC_CHECK_FUNCS(setitimer setsid setlinebuf sigaction)
AC_CHECK_FUNCS(siggetmask siginterrupt)
AC_CHECK_FUNCS(signal sigprocmask socket srand srandom stat)
AC_CHECK_FUNCS(strchr strerror stricmp strlwr strncat strncpy strtod)
AC_CHECK_FUNCS(strchr strerror stricmp)
AC_CHECK_FUNCS(strnlen strlwr strncat strncpy strtod)
AC_CHECK_FUNCS(time times tmpnam usleep utime vsnprintf wcsdup wcsnlen)
# android does not really have locale stuff..

148
misc/mkwin Normal file → Executable file
View File

@ -19,9 +19,10 @@
# http://nsis.sourceforge.net/Main_Page
#
#
TOP=$HOME
TOP="/z"
VERSION=6.3.4
#cross-compiler for OSX, see http://mxe.cc/
#notice that OSX does not allow WIN64 emulation (wine64)
MXE=$HOME/Yap/mxe/usr
# by default, compile without threads
THREADS=no
# use 64 bits
@ -39,18 +40,18 @@ while test $I -gt 0
do
if test $1 = threads
then
THREADS=yes
THREADS=yes
elif test $1 = no_threads
then
THREADS=no
THREADS=no
elif test $1 = 32
then
ABI=32
ABI=32
elif test $1 = 64
then
ABI=64
ABI=64
else
echo "received \"$1\", should be one of threads, no_threads, 32, 64"
echo "received \"$1\", should be one of threads, no_threads, 32, 64"
fi
I=$(( $I - 1 ))
done
@ -73,45 +74,53 @@ else
fi
if test $ABI = 64; then
#GCC_PATH=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64
GCC_PATH=$HOME/mxe/usr/bin
PATH=$PATH:$GCC_PATH
HOST="--host=x86_64-w64-mingw32"
# ok.
#GCC_PATH=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64
case $( uname ) in
*Darwin*)
GCC_PATH="$MXE"/bin
PATH=$PATH:$GCC_PATH
HOST="x86_64-w64-mingw32"
LIB_PATH="$MXE"/"$HOST"/lib
;;
esac
# ok.
CUDD=no # BDD compiler package. Get version that compiles on Windows from Vitor!
GECODE=no #does not link with mingw64, VC++ trouble
GMP=yes # Compile it for infinite precision numbers and rationals
JAVA=no # for JPL only
PYTHON=no # does not work in Windows anyway (currently)
REAL=no # interface to R
CUDD=no # BDD compiler package. Get version that compiles on Windows from Vitor!
GECODE=no #does not link with mingw64, VC++ trouble
GMP=yes # Compile it for infinite precision numbers and rationals
JAVA=no # for JPL only
PYTHON=no # does not work in Windows anyway (currently)
REAL=no # interface to R
# it seems python2.7 does not support mingw64
PYTHON_PATH="/c/Python33-64"
export PATH="$GCC_PATH"/bin:"$PATH"
export PATH="$PYTHON_PATH"/bin:"$PATH"
GECODE_PATH="/c/Program Files/Gecode"
# GMP=/l/Work/noth/msys/1.0/local
# GMP=/l/Work/noth/msys/1.0/local
GMP=yes
CUDD_PATH=/c/cygwin/Yap/cudd-2.5.0-mingw64
JAVA_PATH="/c/Program Files/Java/jdk1.7.0_51"
R_PATH="/c/Program Files/R/R-3.1.0"
if test $THREADS = yes
then
cp "$GCC_PATH/x86_64-w64-mingw32/lib/libwinpthread-1.dll" . # interface from posix threads to windows native threads
cp libwinpthread-1.dll pthreadGC2.dll
fi
fi
# HOME WIN32 configuration
if test $ABI = 32; then
GCC_PATH="/c/TDM-GCC-64"
CUDD=yes
GECODE=no # install only allows one of 32 or 64 bits
GMP=yes
JAVA=yes
PYTHON=no
REAL=yes
case $( uname ) in
*Darwin*)
#use mxe as a cross compiler
echo $( uname )
GCC_PATH="$MXE"/bin
PATH="$GCC_PATH":"$PATH"
HOST="i686-pc-mingw32"
LIB_PATH="$MXE"/"$HOST"/lib
CUDD=yes
GECODE=no # install only allows one of 32 or 64 bits
GMP=yes
JAVA=no
PYTHON=no
REAL=no
;;
esac
PYTHON_PATH="/c/Python27"
export PATH="$GCC_PATH"/bin:$PATH
@ -120,32 +129,42 @@ REAL=yes
CUDD_PATH=/c/cygwin/Yap/cudd-2.5.0-mingw32
JAVA_PATH="/c/Program Files (x86)/Java/jdk1.7.0_51"
R_PATH="/c/Program Files/R/R-3.0.2"
HOST="--enable-abi=32"
HOST+=" --enable-abi=32"
cp $GCC_PATH/bin/libwinpthread-1.dll .
fi
if test $THREADS = yes
then
cp "$LIB_PATH"/libwinpthread-1.dll .
cp libwinpthread-1.dll pthreadGC2.dll
fi
if test $CUDD = yes
if test $CUDD != no
then
CUDD="$CUDD_PATH"
BDDLIB="--enable-bddlib"
BDDLIB="yes"
CPLINT="yes"
else
BDDLIB=""
BDDLIB="no"
CPLINT="no"
fi
if test $GECODE = yes
then
export PATH="$PATH":"$GECODE_PATH"/bin
fi
if test $JAVA = yes
then
export PATH="$PATH":"$JAVA_PATH"/bin
fi
if test $PYTHON = yes
then
export PATH="$PATH":"$PYTHON_PATH"
fi
if test $REAL = yes
then
if test $ABI = 32; then
@ -159,26 +178,39 @@ fi
export INSTALL_SH=$SRC/yap-6.3/install.sh
# avoid using relative paths
if test "$do_compile" = true; then
"$CONFIGURE" $HOST \
--prefix=$TARGET \
--with-R="$REAL" \
--with-java="$JAVA" \
--with-gmp="$GMP" \
--with-python="$PYTHON" \
--with-cudd="$CUDD" "$BDDLIB" \
--enable-gecode="$GECODE" \
--enable-threads="$THREADS" --enable-pthread-locking \
--enable-debug-yap --enable-low-level-tracer
make -j 4 install
"$CONFIGURE" --host=$HOST \
--prefix=$TARGET \
--with-R="$REAL" \
--with-java="$JAVA" \
--with-gmp="$GMP" \
--with-python="$PYTHON" \
--with-cudd="$CUDD" --enable-bddlib="$BDDLIB" --with-cplint="$CPLINT" \
--with-gecode="$GECODE" \
--enable-threads="$THREADS" --enable-pthread-locking \
--enable-debug-yap --enable-low-level-tracer
make #-j 4 install
fi
if test "$do_install" = true; then
if test $ABI = 64; then
cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 -DROOTDIR=$TARGET -DABI="$ABI" -DVERSION="$FULL_VERSION" -DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" -DOUT_DIR=".." -D"WIN64=1" -NOCD $SRC/yap-6.3/misc/Yap.nsi
else
cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog -DROOTDIR=$TARGET -DABI="$ABI" -DVERSION="$FULL_VERSION" -DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" -DOUT_DIR=".." -NOCD $SRC/yap-6.3/misc/Yap.nsi
fi
if test $ABI = 64; then
cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \
-DROOTDIR=$TARGET \
-DABI="$ABI" \
-DVERSION="$FULL_VERSION" \
-DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" \
-DOUT_DIR=".." -D"WIN64=1" \
-NOCD $SRC/yap-6.3/misc/Yap.nsi
else
cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \
-DROOTDIR=$TARGET \
-DABI="$ABI" \
-DVERSION="$FULL_VERSION" \
-DOPTIONS="$SRC_WIN\\yap-6.3\\misc\\options.ini" \
-DOUT_DIR=".." \
-NOCD $SRC/yap-6.3/misc/Yap.nsi
fi
fi

View File

@ -196,15 +196,19 @@ int_mbscoll(const char *s1, const char *s2, int icase)
mbstate_t mbs;
int rc;
#if HAVE_ALLOCA
if ( l1 < 1024 && (w1 = alloca(sizeof(wchar_t)*(l1+1))) )
{ ml1 = FALSE;
} else
#endif
{ w1 = PL_malloc_atomic(sizeof(wchar_t)*(l1+1));
ml1 = TRUE;
}
#if HAVE_ALLOCA
if ( l2 < 1024 && (w2 = alloca(sizeof(wchar_t)*(l2+1))) )
{ ml2 = FALSE;
} else
#endif
{ w2 = PL_malloc_atomic(sizeof(wchar_t)*(l2+1));
ml2 = TRUE;
}

View File

@ -25,9 +25,9 @@
#ifndef PL_STRING_H_INCLUDED
#define PL_STRING_H_INCLUDED
COMMON(char *) store_string(const char *s);
COMMON(char *) store_string(const char *s);
COMMON(void) remove_string(char *s);
COMMON(char) digitName(int n, int small);
COMMON(char) digitName(int n, int smll);
COMMON(int) digitValue(int b, int c);
COMMON(bool) strprefix(const char *string, const char *prefix);
COMMON(bool) strpostfix(const char *string, const char *postfix);