WIN32 patches

This commit is contained in:
U-WIN-ENP104VVO3U\Vítor Santos Costa 2011-03-21 17:07:58 +00:00
parent 417bbd6d46
commit 7670ce631b
18 changed files with 2296 additions and 2175 deletions

View File

@ -862,7 +862,7 @@ ExtendWorkSpace(Int s, int fixed_allocation)
} }
brk = (LPVOID) ((Int) b + s); brk = (LPVOID) ((Int) b + s);
#if DEBUG_WIN32_ALLOC #if DEBUG_WIN32_ALLOC
fprintf(stderr,"OK: %p--%p %lx\n",b, brk, s); fprintf(stderr,"OK: %p--%p " Int_FORMAT "\n",b, brk, s);
#endif #endif
Yap_PrologMode = OldPrologMode; Yap_PrologMode = OldPrologMode;
return TRUE; return TRUE;

View File

@ -1200,8 +1200,8 @@ Yap_InitThread(int new_id)
static void static void
InitFirstWorkerThreadHandle(void) InitFirstWorkerThreadHandle(void)
{ {
CACHE_REGS
#ifdef THREADS #ifdef THREADS
CACHE_REGS
ThreadHandle.id = 0; ThreadHandle.id = 0;
ThreadHandle.in_use = TRUE; ThreadHandle.in_use = TRUE;
ThreadHandle.default_yaam_regs = ThreadHandle.default_yaam_regs =
@ -1256,8 +1256,8 @@ static void
InitCodes(void) InitCodes(void)
{ {
CACHE_REGS CACHE_REGS
int wid;
#if THREADS #if THREADS
int wid;
for (wid = 1; wid < MAX_INITS; wid++) { for (wid = 1; wid < MAX_INITS; wid++) {
Yap_WLocal[wid] = NULL; Yap_WLocal[wid] = NULL;
} }
@ -1268,9 +1268,7 @@ InitCodes(void)
#endif #endif
InitGlobal(); InitGlobal();
InitWorker(0); InitWorker(0);
#if THREADS
InitFirstWorkerThreadHandle(); InitFirstWorkerThreadHandle();
#endif
/* make sure no one else can use these two atoms */ /* make sure no one else can use these two atoms */
CurrentModule = 0; CurrentModule = 0;
Yap_ReleaseAtom(AtomOfTerm(TermReFoundVar)); Yap_ReleaseAtom(AtomOfTerm(TermReFoundVar));

5
H/TermExt.h Normal file → Executable file
View File

@ -515,7 +515,7 @@ IsAttachedTerm (Term t)
return (Int) ((IsVarTerm (t) && IsAttVar(VarOfTerm(t)))); return (Int) ((IsVarTerm (t) && IsAttVar(VarOfTerm(t))));
} }
inline EXTERN Int IsAttachedTerm (Term); inline EXTERN Int GlobalIsAttachedTerm (Term);
inline EXTERN Int inline EXTERN Int
GlobalIsAttachedTerm (Term t) GlobalIsAttachedTerm (Term t)
@ -523,9 +523,6 @@ GlobalIsAttachedTerm (Term t)
return (Int) ((IsVarTerm (t) && GlobalIsAttVar(VarOfTerm(t)))); return (Int) ((IsVarTerm (t) && GlobalIsAttVar(VarOfTerm(t))));
} }
inline EXTERN Int SafeIsAttachedTerm (Term); inline EXTERN Int SafeIsAttachedTerm (Term);
inline EXTERN Int inline EXTERN Int

View File

@ -269,7 +269,7 @@
#define FileAliases Yap_heap_regs->file_aliases #define FileAliases Yap_heap_regs->file_aliases
#define AtPrompt Yap_heap_regs->atprompt #define AtPrompt Yap_heap_regs->atprompt
#define Prompt Yap_heap_regs->prompt #define YapPrompt Yap_heap_regs->_prompt
#define CharConversionTable Yap_heap_regs->char_conversion_table #define CharConversionTable Yap_heap_regs->char_conversion_table
#define CharConversionTable2 Yap_heap_regs->char_conversion_table2 #define CharConversionTable2 Yap_heap_regs->char_conversion_table2

View File

@ -269,7 +269,7 @@
struct AliasDescS *file_aliases; struct AliasDescS *file_aliases;
Atom atprompt; Atom atprompt;
char prompt[MAX_PROMPT]; char _prompt[MAX_PROMPT];
char *char_conversion_table; char *char_conversion_table;
char *char_conversion_table2; char *char_conversion_table2;

View File

@ -325,6 +325,7 @@ YAPDOCS=$(srcdir)/docs/yap.tex $(srcdir)/docs/chr.tex \
IOLIB_OBJECTS=pl-buffer.o pl-codelist.o pl-ctype.o pl-dtoa.o pl-error.o \ IOLIB_OBJECTS=pl-buffer.o pl-codelist.o pl-ctype.o pl-dtoa.o pl-error.o \
pl-file.o pl-files.o pl-fmt.o \ pl-file.o pl-files.o pl-fmt.o \
pl-glob.o pl-option.o \ pl-glob.o pl-option.o \
pl-nt.o \
pl-os.o pl-privitf.o \ pl-os.o pl-privitf.o \
pl-read.o \ pl-read.o \
pl-rl.o \ pl-rl.o \
@ -384,7 +385,6 @@ LIB_OBJECTS = $(ENGINE_OBJECTS) $(C_INTERFACE_OBJECTS) $(OR_OBJECTS) $(BEAM_OBJE
OBJECTS = yap.o $(LIB_OBJECTS) OBJECTS = yap.o $(LIB_OBJECTS)
PLCONS_OBJECTS = \ PLCONS_OBJECTS = \
pl-nt.o \
pl-ntcon.o \ pl-ntcon.o \
pl-ntconsole.o \ pl-ntconsole.o \
pl-ntmain.o pl-ntmain.o
@ -552,8 +552,8 @@ regfree.o: $(srcdir)/library/regex/regfree.c $(srcdir)/library/regex/regex2.h co
regexec.o: $(srcdir)/library/regex/regexec.c config.h regexec.o: $(srcdir)/library/regex/regexec.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regexec.c -o regexec.o $(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regexec.c -o regexec.o
pl-nt.o: $(srcdir)/console/LGPL/pl-nt.c config.h pl-nt.o: $(srcdir)/packages/PLStream/pl-nt.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/packages/PLStream $(srcdir)/console/LGPL/pl-nt.c -o $@ $(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/packages/PLStream @EXTRA_INCLUDES_FOR_WIN32@ $(srcdir)/packages/PLStream/pl-nt.c -o $@
pl-ntcon.o: $(srcdir)/console/LGPL/pl-ntcon.c config.h pl-ntcon.o: $(srcdir)/console/LGPL/pl-ntcon.c config.h
$(CC) -c $(CFLAGS) -I$(srcdir)/include $(srcdir)/console/LGPL/pl-ntcon.c -o $@ $(CC) -c $(CFLAGS) -I$(srcdir)/include $(srcdir)/console/LGPL/pl-ntcon.c -o $@

View File

@ -176,6 +176,8 @@
#undef HAVE_ASINH #undef HAVE_ASINH
#undef HAVE_ATANH #undef HAVE_ATANH
#undef HAVE_CHDIR #undef HAVE_CHDIR
#undef HAVE_CLOCK
#undef HAVE_CLOCK_GETTIME
#undef HAVE_CTIME #undef HAVE_CTIME
#undef HAVE_DLOPEN #undef HAVE_DLOPEN
#undef HAVE_DUP2 #undef HAVE_DUP2
@ -291,6 +293,9 @@
#define TYPE_SELECT_ #define TYPE_SELECT_
#define MYTYPE(X) MYTYPE1#X #define MYTYPE(X) MYTYPE1#X
#undef HAVE_VAR_TIMEZONE
#undef HAVE_STRUCT_TIME_TM_GMTOFF
/* define how to pass the address of a function */ /* define how to pass the address of a function */
#define FunAdr(Fn) Fn #define FunAdr(Fn) Fn

184
configure vendored
View File

@ -813,9 +813,6 @@ LIBS
CPPFLAGS CPPFLAGS
CXX CXX
CXXFLAGS CXXFLAGS
LDFLAGS
LIBS
CPPFLAGS
CCC CCC
CPP' CPP'
@ -2136,60 +2133,6 @@ rm -f conftest.val
} # ac_fn_c_compute_int } # ac_fn_c_compute_int
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_c_check_type ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof ($2))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof (($2)))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
eval "$3=yes"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ---------------------------------------------------- # ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including # Tries to find if the field MEMBER exists in type AGGR, after including
@ -2246,6 +2189,60 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_member } # ac_fn_c_check_member
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_c_check_type ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof ($2))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof (($2)))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
eval "$3=yes"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
cat >config.log <<_ACEOF cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
@ -5060,6 +5057,7 @@ fi
if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" if test "$target_os" = "cygwin" -o "$target_os" = "mingw32"
then then
INSTALL_COMMAND=install_win32 INSTALL_COMMAND=install_win32
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
if test "$cygwin" = "no" -o "$target_os" = "mingw32" if test "$cygwin" = "no" -o "$target_os" = "mingw32"
then then
if test "$target_win64" = yes if test "$target_win64" = yes
@ -5104,8 +5102,7 @@ _ACEOF
fi fi
EXTRA_LIBS_FOR_DLLS="-lws2_32 \$(abs_top_builddir)/yap.dll" EXTRA_LIBS_FOR_DLLS="-lws2_32"
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
elif test "$target_os" = "cygwin" elif test "$target_os" = "cygwin"
then then
CC="${CC} -mno-cygwin" CC="${CC} -mno-cygwin"
@ -5149,8 +5146,6 @@ _ACEOF
fi fi
EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll"
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lwsock32" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lwsock32" >&5
$as_echo_n "checking for main in -lwsock32... " >&6; } $as_echo_n "checking for main in -lwsock32... " >&6; }
@ -5191,8 +5186,8 @@ _ACEOF
fi fi
EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll"
fi fi
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS \$(abs_top_builddir)/yap.dll"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpsapi" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpsapi" >&5
$as_echo_n "checking for main in -lpsapi... " >&6; } $as_echo_n "checking for main in -lpsapi... " >&6; }
if ${ac_cv_lib_psapi_main+:} false; then : if ${ac_cv_lib_psapi_main+:} false; then :
@ -8733,6 +8728,57 @@ $as_echo "#define HAVE_SIGINFO 0" >>confdefs.h
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking \"variable timezone in tzset\"" >&5
$as_echo_n "checking \"variable timezone in tzset\"... " >&6; }
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming no" >&5
$as_echo "assuming no" >&6; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
#include <stdlib.h>
#ifdef __CYGWIN__
#define timezone _timezone
#endif
extern long timezone;
main()
{ tzset();
if ( timezone > -15*3600 &&
timezone < 15*3600 &&
timezone % 60 == 0 )
return 0;
exit(1);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_VAR_TIMEZONE 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include <time.h>
"
if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then :
$as_echo "#define HAVE_STRUCT_TIME_TM_GMTOFF /**/" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking union wait" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking union wait" >&5
$as_echo_n "checking union wait... " >&6; } $as_echo_n "checking union wait... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -8840,7 +8886,19 @@ _ACEOF
fi fi
done done
for ac_func in alloca asinh atanh chdir ctime dlopen dup2 for ac_func in alloca asinh atanh chdir clock clock_gettime
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 ctime dlopen dup2
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@ -559,24 +559,22 @@ dnl
if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" if test "$target_os" = "cygwin" -o "$target_os" = "mingw32"
then then
INSTALL_COMMAND=install_win32 INSTALL_COMMAND=install_win32
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
if test "$cygwin" = "no" -o "$target_os" = "mingw32" if test "$cygwin" = "no" -o "$target_os" = "mingw32"
then then
if test "$target_win64" = yes if test "$target_win64" = yes
then then
AC_CHECK_LIB(ws2_32,main) AC_CHECK_LIB(ws2_32,main)
EXTRA_LIBS_FOR_DLLS="-lws2_32 \$(abs_top_builddir)/yap.dll" EXTRA_LIBS_FOR_DLLS="-lws2_32"
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
elif test "$target_os" = "cygwin" elif test "$target_os" = "cygwin"
then then
CC="${CC} -mno-cygwin" CC="${CC} -mno-cygwin"
CXX="${CXX} -mno-cygwin" CXX="${CXX} -mno-cygwin"
AC_CHECK_LIB(wsock32,main) AC_CHECK_LIB(wsock32,main)
EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll"
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
else else
AC_CHECK_LIB(wsock32,main) AC_CHECK_LIB(wsock32,main)
EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll"
fi fi
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS \$(abs_top_builddir)/yap.dll"
AC_CHECK_LIB(psapi,main) AC_CHECK_LIB(psapi,main)
yap_cv_readline=no yap_cv_readline=no
if test "$target_win64" = yes if test "$target_win64" = yes
@ -1639,6 +1637,38 @@ else
AC_DEFINE(HAVE_SIGINFO,0) AC_DEFINE(HAVE_SIGINFO,0)
fi fi
AC_MSG_CHECKING("variable timezone in tzset")
AC_TRY_RUN(
[ #include <time.h>
#include <stdlib.h>
#ifdef __CYGWIN__
#define timezone _timezone
#endif
extern long timezone;
main()
{ tzset();
if ( timezone > -15*3600 &&
timezone < 15*3600 &&
timezone % 60 == 0 )
return 0;
exit(1);
}
],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_VAR_TIMEZONE, 1,
[Define if tzset sets timezone variable]),
AC_MSG_RESULT(no),
AC_MSG_RESULT(assuming no))
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
AC_DEFINE(HAVE_STRUCT_TIME_TM_GMTOFF, [],
[Define is struct tm has tm_gmtoff]),
[],
[#include <time.h>])
dnl this is copied from the Tcl code dnl this is copied from the Tcl code
dnl this code checks whether the system defines an union wait dnl this code checks whether the system defines an union wait
AC_MSG_CHECKING([union wait]) AC_MSG_CHECKING([union wait])
@ -1667,7 +1697,8 @@ fi
dnl Checks for library functions. dnl Checks for library functions.
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_CHECK_FUNCS(_NSGetEnviron access acosh) AC_CHECK_FUNCS(_NSGetEnviron access acosh)
AC_CHECK_FUNCS(alloca asinh atanh chdir ctime dlopen dup2) AC_CHECK_FUNCS(alloca asinh atanh chdir clock clock_gettime)
AC_CHECK_FUNCS(ctime dlopen dup2)
AC_CHECK_FUNCS(erf feclearexcept) AC_CHECK_FUNCS(erf feclearexcept)
AC_CHECK_FUNCS(fesettrapenable fgetpos finite fpclass ftime getcwd getenv) AC_CHECK_FUNCS(fesettrapenable fgetpos finite fpclass ftime getcwd getenv)
AC_CHECK_FUNCS(gethostbyname gethostent gethostid gethostname) AC_CHECK_FUNCS(gethostbyname gethostent gethostid gethostname)

2
misc/HEAPFIELDS Normal file → Executable file
View File

@ -303,7 +303,7 @@ struct AliasDescS *file_aliases FileAliases =NULL RestoreAliases()
/* prompting */ /* prompting */
Atom atprompt AtPrompt =AtomNil AtomAdjust Atom atprompt AtPrompt =AtomNil AtomAdjust
char prompt[MAX_PROMPT] Prompt void void char _prompt[MAX_PROMPT] YapPrompt void void
/* ISO char conversion: I will make no comments */ /* ISO char conversion: I will make no comments */
char *char_conversion_table CharConversionTable =NULL CodeCharPAdjust char *char_conversion_table CharConversionTable =NULL CodeCharPAdjust

View File

@ -22,13 +22,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifdef _YAP_NOT_INSTALLED_ #ifdef __MINGW32__
#define __WINDOWS__ 1 #define __WINDOWS__ 1
#endif #endif
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#define _WIN32_WINNT 0x0400 #define _WIN32_WINNT 0x0400
#if (_MSC_VER >= 1300) #if (_MSC_VER >= 1300) || defined(__MINGW32__)
#include <winsock2.h> /* Needed on VC8 */ #include <winsock2.h> /* Needed on VC8 */
#include <windows.h> #include <windows.h>
#else #else
@ -244,7 +244,6 @@ ftruncate(int fileno, int64_t length)
} }
#ifndef _YAP_NOT_INSTALLED_
/******************************* /*******************************
* QUERY CPU TIME * * QUERY CPU TIME *
*******************************/ *******************************/
@ -280,7 +279,6 @@ CpuTime(cputime_kind which)
return t; return t;
} }
#endif
static int static int
CpuCount() CpuCount()
@ -367,7 +365,7 @@ get_showCmd(term_t show, int *cmd)
succeed; succeed;
} }
if ( !PL_get_chars_ex(show, &s, CVT_ATOM) ) if ( !PL_get_chars(show, &s, CVT_ATOM|CVT_EXCEPTION) )
fail; fail;
for(st=types; st->name; st++) for(st=types; st->name; st++)
{ if ( streq(st->name, s) ) { if ( streq(st->name, s) )
@ -574,7 +572,7 @@ pl_win_module_file(term_t module, term_t file)
char *m; char *m;
char *f; char *f;
if ( !PL_get_chars_ex(module, &m, CVT_ALL) ) if ( !PL_get_chars(module, &m, CVT_ALL|CVT_EXCEPTION) )
fail; fail;
if ( (f = findExecutable(m, buf)) ) if ( (f = findExecutable(m, buf)) )
return PL_unify_atom_chars(file, f); return PL_unify_atom_chars(file, f);

View File

@ -62,6 +62,40 @@ extern long timezone;
#endif #endif
#endif #endif
#if defined(__MINGW32__)
#include <stdlib.h>
#include <time.h>
#include <string.h>
struct tm *localtime_r (const time_t *, struct tm *);
struct tm *gmtime_r (const time_t *, struct tm *);
struct tm *
localtime_r (const time_t *timer, struct tm *result)
{
struct tm *local_result;
local_result = localtime (timer);
if (local_result == NULL || result == NULL)
return NULL;
memcpy (result, local_result, sizeof (result));
return result;
}
struct tm *
gmtime_r (const time_t *timer, struct tm *result)
{
struct tm *local_result;
local_result = gmtime (timer);
if (local_result == NULL || result == NULL)
return NULL;
memcpy (result, local_result, sizeof (result));
return result;
}
#endif
#define TAI_UTC_OFFSET LL(4611686018427387914) #define TAI_UTC_OFFSET LL(4611686018427387914)