fix win32 warnings: unsigned long != CELL, IOSTREAM with sace restore, _ffsll and _isatty, fp patches
This commit is contained in:
parent
461dae09f7
commit
f7fe32a03c
44
C/arith1.c
44
C/arith1.c
@ -330,22 +330,32 @@ msb(Int inp USES_REGS) /* calculate the most significant bit for an integer */
|
|||||||
"msb/1 received %d", inp);
|
"msb/1 received %d", inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if HAVE__BUILTIN_FFSLL
|
||||||
|
out = __builtin_ffsll(inp);
|
||||||
|
#elif HAVE_FFSLL
|
||||||
|
out = ffsll(inp);
|
||||||
#else
|
#else
|
||||||
int off = sizeof(CELL)*4;
|
if (inp==0)
|
||||||
while (off) {
|
return 0L;
|
||||||
Int limit = ((CELL)1) << (off);
|
#if SIZEOF_INT_P == 8
|
||||||
if (inp >= limit) {
|
if (inp & ((CELL)0xffffffffLL << 32)) {inp >>= 32; out += 32;}
|
||||||
out += off;
|
|
||||||
inp >>= off;
|
|
||||||
}
|
|
||||||
off >>= 1;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return(out);
|
if (inp & ((CELL)0xffffL << 16)) {inp >>= 16; out += 16;}
|
||||||
|
if (inp & ((CELL)0xffL << 8)) {inp >>= 8; out += 8;}
|
||||||
|
if (inp & ((CELL)0xfL << 4)) {inp >>= 4; out += 4;}
|
||||||
|
if (inp & ((CELL)0x3L << 2)) {inp >>= 2; out += 2;}
|
||||||
|
if (inp & ((CELL)0x1 << 1)) out++;
|
||||||
|
#endif
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Int
|
||||||
|
Yap_msb(Int inp USES_REGS) /* calculate the most significant bit for an integer */
|
||||||
|
{
|
||||||
|
return msb(inp PASS_REGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */
|
lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */
|
||||||
{
|
{
|
||||||
@ -359,12 +369,12 @@ lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */
|
|||||||
if (inp==0)
|
if (inp==0)
|
||||||
return 0L;
|
return 0L;
|
||||||
#if SIZEOF_INT_P == 8
|
#if SIZEOF_INT_P == 8
|
||||||
if (!(inp & 0xffffffffLL)) {inp >>= 32; out += 32;}
|
if (!(inp & (CELL)0xffffffffLL)) {inp >>= 32; out += 32;}
|
||||||
#endif
|
#endif
|
||||||
if (!(inp & 0xffffL)) {inp >>= 16; out += 16;}
|
if (!(inp & (CELL)0xffffL)) {inp >>= 16; out += 16;}
|
||||||
if (!(inp & 0xffL)) {inp >>= 8; out += 8;}
|
if (!(inp & (CELL)0xffL)) {inp >>= 8; out += 8;}
|
||||||
if (!(inp & 0xfL)) {inp >>= 4; out += 4;}
|
if (!(inp & (CELL)0xfL)) {inp >>= 4; out += 4;}
|
||||||
if (!(inp & 0x3L)) {inp >>= 2; out += 2;}
|
if (!(inp & (CELL)0x3L)) {inp >>= 2; out += 2;}
|
||||||
if (!(inp & ((CELL)0x1))) out++;
|
if (!(inp & ((CELL)0x1))) out++;
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
#define PL_KERNEL 1
|
#define PL_KERNEL 1
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#if HAVE_SYS_TIMES_H
|
||||||
|
#include <sys/times.h>
|
||||||
|
#endif
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#include "Yatom.h"
|
#include "Yatom.h"
|
||||||
#include "pl-incl.h"
|
#include "pl-incl.h"
|
||||||
|
80
C/save.c
80
C/save.c
@ -19,8 +19,6 @@ static char SccsId[] = "@(#)save.c 1.3 3/15/90";
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "absmi.h"
|
|
||||||
#include "SWI-Stream.h"
|
|
||||||
#if _MSC_VER || defined(__MINGW32__)
|
#if _MSC_VER || defined(__MINGW32__)
|
||||||
#if HAVE_WINSOCK2_H
|
#if HAVE_WINSOCK2_H
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
@ -28,6 +26,8 @@ static char SccsId[] = "@(#)save.c 1.3 3/15/90";
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "absmi.h"
|
||||||
|
#include "SWI-Stream.h"
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#if USE_DL_MALLOC
|
#if USE_DL_MALLOC
|
||||||
#include "dlmalloc.h"
|
#include "dlmalloc.h"
|
||||||
@ -89,9 +89,9 @@ void initIO(void);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int myread(int, char *, Int);
|
static int myread(IOSTREAM *, char *, Int);
|
||||||
static Int mywrite(int, char *, Int);
|
static Int mywrite(IOSTREAM *, char *, Int);
|
||||||
static int open_file(char *, int);
|
static IOSTREAM *open_file(char *, int);
|
||||||
static int close_file(void);
|
static int close_file(void);
|
||||||
static Int putout(CELL);
|
static Int putout(CELL);
|
||||||
static Int putcellptr(CELL *);
|
static Int putcellptr(CELL *);
|
||||||
@ -187,11 +187,11 @@ do_system_error(yap_error_number etype, const char *msg)
|
|||||||
|
|
||||||
|
|
||||||
inline static
|
inline static
|
||||||
int myread(int fd, char *buffer, Int len) {
|
int myread(IOSTREAM *fd, char *buffer, Int len) {
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
nread = read(fd, buffer, (int)len);
|
nread = Sfread(buffer, 1, (int)len, fd);
|
||||||
if (nread < 1) {
|
if (nread < 1) {
|
||||||
return do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"bad read on saved state");
|
return do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"bad read on saved state");
|
||||||
}
|
}
|
||||||
@ -203,11 +203,11 @@ int myread(int fd, char *buffer, Int len) {
|
|||||||
|
|
||||||
inline static
|
inline static
|
||||||
Int
|
Int
|
||||||
mywrite(int fd, char *buff, Int len) {
|
mywrite(IOSTREAM *fd, char *buff, Int len) {
|
||||||
ssize_t nwritten;
|
ssize_t nwritten;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
nwritten = write(fd, buff, (size_t)len);
|
nwritten = Sfwrite(buff, 1, (size_t)len, fd);
|
||||||
if (nwritten < 0) {
|
if (nwritten < 0) {
|
||||||
return do_system_error(SYSTEM_ERROR,"bad write on saved state");
|
return do_system_error(SYSTEM_ERROR,"bad write on saved state");
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ mywrite(int fd, char *buff, Int len) {
|
|||||||
|
|
||||||
typedef CELL *CELLPOINTER;
|
typedef CELL *CELLPOINTER;
|
||||||
|
|
||||||
static int splfild = 0;
|
static IOSTREAM *splfild = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
@ -242,10 +242,12 @@ static Int OldHeapUsed;
|
|||||||
static CELL which_save;
|
static CELL which_save;
|
||||||
|
|
||||||
/* Open a file to read or to write */
|
/* Open a file to read or to write */
|
||||||
static int
|
static IOSTREAM *
|
||||||
open_file(char *my_file, int flag)
|
open_file(char *my_file, int flag)
|
||||||
{
|
{
|
||||||
int splfild;
|
IOSTREAM *splfild;
|
||||||
|
char flags[6];
|
||||||
|
int i=0;
|
||||||
|
|
||||||
#if __ANDROID__
|
#if __ANDROID__
|
||||||
if (strstr(my_file, "/assets/") == my_file) {
|
if (strstr(my_file, "/assets/") == my_file) {
|
||||||
@ -253,34 +255,32 @@ open_file(char *my_file, int flag)
|
|||||||
my_file += strlen("/assets/");
|
my_file += strlen("/assets/");
|
||||||
AAsset* asset = AAssetManager_open(GLOBAL_assetManager, my_file, AASSET_MODE_UNKNOWN);
|
AAsset* asset = AAssetManager_open(GLOBAL_assetManager, my_file, AASSET_MODE_UNKNOWN);
|
||||||
if (!asset)
|
if (!asset)
|
||||||
return -1;
|
return NULL;
|
||||||
AAsset_close( asset );
|
AAsset_close( asset );
|
||||||
return 0; // usually the file will be compressed, so there is no point in actually trying to open it.
|
return NULL; // usually the file will be compressed, so there is no point in actually trying to open it.
|
||||||
}
|
}
|
||||||
return -1;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef M_WILLIAMS
|
if (flag & O_RDONLY) {
|
||||||
if (flag & O_CREAT)
|
flags[i++] = 'r';
|
||||||
splfild = creat(my_file, flag);
|
|
||||||
else
|
|
||||||
splfild = open(my_file, flag);
|
|
||||||
if (splfild < 0) {
|
|
||||||
#else
|
|
||||||
#ifdef O_BINARY
|
|
||||||
#if _MSC_VER
|
|
||||||
if ((splfild = _open(my_file, flag | O_BINARY), _S_IREAD | _S_IWRITE) < 0)
|
|
||||||
#else
|
|
||||||
if ((splfild = open(my_file, flag | O_BINARY, 0775)) < 0)
|
|
||||||
#endif
|
|
||||||
#else /* O_BINARY */
|
|
||||||
if ((splfild = open(my_file, flag, 0755)) < 0)
|
|
||||||
#endif /* O_BINARY */
|
|
||||||
#endif /* M_WILLIAMS */
|
|
||||||
{
|
|
||||||
splfild = -1; /* We do not have an open file */
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
if (flag & O_CREAT) {
|
||||||
|
flags[i++] = 'w';
|
||||||
|
}
|
||||||
|
if (flag & O_WRONLY) {
|
||||||
|
flags[i++] = 'w';
|
||||||
|
}
|
||||||
|
if (flag & O_APPEND) {
|
||||||
|
flags[i++] = 'a';
|
||||||
|
}
|
||||||
|
#if _WIN32
|
||||||
|
if (flag & O_BINARY) {
|
||||||
|
flags[i++] = 'b';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
flags[i] = '\0';
|
||||||
|
splfild = Sopen_file( my_file, flags);
|
||||||
#ifdef undf0
|
#ifdef undf0
|
||||||
fprintf(errout, "Opened file %s\n", my_file);
|
fprintf(errout, "Opened file %s\n", my_file);
|
||||||
#endif
|
#endif
|
||||||
@ -292,7 +292,7 @@ close_file(void)
|
|||||||
{
|
{
|
||||||
if (splfild == 0)
|
if (splfild == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (close(splfild) < 0)
|
if (Sclose(splfild) < 0)
|
||||||
return do_system_error(SYSTEM_ERROR,"bad close on saved state");
|
return do_system_error(SYSTEM_ERROR,"bad close on saved state");
|
||||||
splfild = 0;
|
splfild = 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -326,9 +326,9 @@ static CELL
|
|||||||
get_header_cell(void)
|
get_header_cell(void)
|
||||||
{
|
{
|
||||||
CELL l;
|
CELL l;
|
||||||
int count = 0, n;
|
size_t count = 0, n;
|
||||||
while (count < sizeof(CELL)) {
|
while (count < sizeof(CELL)) {
|
||||||
if ((n = read(splfild, &l, sizeof(CELL)-count)) < 0) {
|
if ((n = Sfread(&l, 1, sizeof(CELL)-count, splfild)) < 0) {
|
||||||
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to read saved state header");
|
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to read saved state header");
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
@ -684,7 +684,7 @@ check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap USES_REGS)
|
|||||||
/* skip the first line */
|
/* skip the first line */
|
||||||
pp[0] = '\0';
|
pp[0] = '\0';
|
||||||
do {
|
do {
|
||||||
if ((n = read(splfild, pp, 1)) <= 0) {
|
if ((n = Sfread(pp, 1, 1, splfild)) <= 0) {
|
||||||
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan first line from saved state");
|
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan first line from saved state");
|
||||||
return FAIL_RESTORE;
|
return FAIL_RESTORE;
|
||||||
}
|
}
|
||||||
@ -694,7 +694,7 @@ check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap USES_REGS)
|
|||||||
{
|
{
|
||||||
int count = 0, n, to_read = Unsigned(strlen(msg) + 1);
|
int count = 0, n, to_read = Unsigned(strlen(msg) + 1);
|
||||||
while (count < to_read) {
|
while (count < to_read) {
|
||||||
if ((n = read(splfild, pp, to_read-count)) <= 0) {
|
if ((n = Sfread(pp, 1, to_read-count, splfild)) <= 0) {
|
||||||
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan version info from saved state");
|
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan version info from saved state");
|
||||||
return FAIL_RESTORE;
|
return FAIL_RESTORE;
|
||||||
}
|
}
|
||||||
|
16
C/signals.c
16
C/signals.c
@ -21,6 +21,10 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#define HAS_CACHE_REGS 1
|
#define HAS_CACHE_REGS 1
|
||||||
|
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
|
#if _WIN32
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
#include "Yatom.h"
|
#include "Yatom.h"
|
||||||
#include "YapHeap.h"
|
#include "YapHeap.h"
|
||||||
#include "eval.h"
|
#include "eval.h"
|
||||||
@ -105,7 +109,11 @@ ProcessSIGINT(void)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int ch, out;
|
int ch, out;
|
||||||
#if HAVE_ISATTY
|
#if _WIN32
|
||||||
|
if (!_isatty(0)) {
|
||||||
|
return YAP_INT_SIGNAL;
|
||||||
|
}
|
||||||
|
#elif HAVE_ISATTY
|
||||||
if (!isatty(0)) {
|
if (!isatty(0)) {
|
||||||
return YAP_INT_SIGNAL;
|
return YAP_INT_SIGNAL;
|
||||||
}
|
}
|
||||||
@ -318,7 +326,13 @@ p_first_signal( USES_REGS1 )
|
|||||||
uint64_t mask = LOCAL_Signals;
|
uint64_t mask = LOCAL_Signals;
|
||||||
if (mask == 0)
|
if (mask == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#if HAVE___BUILTIN_FFSLL
|
||||||
|
x sig = __builtin_ffsll(mask);
|
||||||
|
#elif HAVE_FFSLL
|
||||||
sig = ffsll(mask);
|
sig = ffsll(mask);
|
||||||
|
#else
|
||||||
|
sig = Yap_msb( mask );
|
||||||
|
#endif
|
||||||
if (get_signal(sig PASS_REGS)) {
|
if (get_signal(sig PASS_REGS)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
34
C/sysbits.c
34
C/sysbits.c
@ -1419,12 +1419,36 @@ HandleSIGSEGV(int sig, void *sipv, void *uap)
|
|||||||
yap_error_number
|
yap_error_number
|
||||||
Yap_MathException__( USES_REGS1 )
|
Yap_MathException__( USES_REGS1 )
|
||||||
{
|
{
|
||||||
|
#if HAVE_FETESTEXCEPT
|
||||||
int raised;
|
int raised;
|
||||||
|
|
||||||
#if HAVE_FETESTEXCEPT
|
|
||||||
// #pragma STDC FENV_ACCESS ON
|
// #pragma STDC FENV_ACCESS ON
|
||||||
if ((raised = fetestexcept( FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)) ) {
|
if ((raised = fetestexcept( FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)) ) {
|
||||||
|
|
||||||
|
feclearexcept(FE_ALL_EXCEPT);
|
||||||
|
if (raised & FE_OVERFLOW) {
|
||||||
|
return EVALUATION_ERROR_FLOAT_OVERFLOW;
|
||||||
|
} else if (raised & FE_DIVBYZERO) {
|
||||||
|
return EVALUATION_ERROR_ZERO_DIVISOR;
|
||||||
|
} else if (raised & FE_UNDERFLOW) {
|
||||||
|
return EVALUATION_ERROR_FLOAT_UNDERFLOW;
|
||||||
|
//} else if (raised & (FE_INVALID|FE_INEXACT)) {
|
||||||
|
// return EVALUATION_ERROR_UNDEFINED;
|
||||||
|
} else {
|
||||||
|
return EVALUATION_ERROR_UNDEFINED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif _WIN32
|
||||||
|
unsigned int raised;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
// Show original FP control word and do calculation.
|
||||||
|
err = _controlfp_s(&raised, 0, 0);
|
||||||
|
if (err) {
|
||||||
|
return EVALUATION_ERROR_UNDEFINED;
|
||||||
|
}
|
||||||
|
if (raised ) {
|
||||||
|
|
||||||
feclearexcept(FE_ALL_EXCEPT);
|
feclearexcept(FE_ALL_EXCEPT);
|
||||||
if (raised & FE_OVERFLOW) {
|
if (raised & FE_OVERFLOW) {
|
||||||
return EVALUATION_ERROR_FLOAT_OVERFLOW;
|
return EVALUATION_ERROR_FLOAT_OVERFLOW;
|
||||||
@ -1522,7 +1546,7 @@ my_signal(int sig, void * handler)
|
|||||||
static void
|
static void
|
||||||
my_signal(int sig, void *handler)
|
my_signal(int sig, void *handler)
|
||||||
{
|
{
|
||||||
signal(sig, void *handler);
|
signal(sig, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2544,6 +2568,9 @@ set_fpu_exceptions(bool flag)
|
|||||||
#elif HAVE_FEENABLEEXCEPT
|
#elif HAVE_FEENABLEEXCEPT
|
||||||
/* I shall ignore de-normalization and precision errors */
|
/* I shall ignore de-normalization and precision errors */
|
||||||
feenableexcept(FE_DIVBYZERO| FE_INVALID|FE_OVERFLOW);
|
feenableexcept(FE_DIVBYZERO| FE_INVALID|FE_OVERFLOW);
|
||||||
|
#elif _WIN32
|
||||||
|
// Enable zero-divide, overflow and underflow exception
|
||||||
|
_controlfp_s(0, ~(_EM_ZERODIVIDE|_EM_UNDERFLOW|_EM_OVERFLOW), _MCW_EM); // Line B
|
||||||
#elif defined(__hpux)
|
#elif defined(__hpux)
|
||||||
# if HAVE_FESETTRAPENABLE
|
# if HAVE_FESETTRAPENABLE
|
||||||
/* From HP-UX 11.0 onwards: */
|
/* From HP-UX 11.0 onwards: */
|
||||||
@ -2580,6 +2607,9 @@ set_fpu_exceptions(bool flag)
|
|||||||
#elif HAVE_FEENABLEEXCEPT
|
#elif HAVE_FEENABLEEXCEPT
|
||||||
/* I shall ignore de-normalization and precision errors */
|
/* I shall ignore de-normalization and precision errors */
|
||||||
feenableexcept(0);
|
feenableexcept(0);
|
||||||
|
#elif _WIN32
|
||||||
|
// Enable zero-divide, overflow and underflow exception
|
||||||
|
_controlfp_s(0, (_EM_ZERODIVIDE|_EM_UNDERFLOW|_EM_OVERFLOW), _MCW_EM); // Line B
|
||||||
#elif defined(__hpux)
|
#elif defined(__hpux)
|
||||||
# if HAVE_FESETTRAPENABLE
|
# if HAVE_FESETTRAPENABLE
|
||||||
fesettrapenable(FE_ALL_EXCEPT);
|
fesettrapenable(FE_ALL_EXCEPT);
|
||||||
|
@ -83,6 +83,10 @@ SIGNAL_TO_BIT( yap_signals sig)
|
|||||||
|
|
||||||
INLINE_ONLY inline EXTERN int Yap_has_a_signal__ ( USES_REGS1 );
|
INLINE_ONLY inline EXTERN int Yap_has_a_signal__ ( USES_REGS1 );
|
||||||
|
|
||||||
|
INLINE_ONLY inline EXTERN int Yap_has_signal__ ( yap_signals sig USES_REGS );
|
||||||
|
|
||||||
|
INLINE_ONLY inline EXTERN int Yap_only_has_signal__(yap_signals sig USES_REGS);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN int
|
INLINE_ONLY inline EXTERN int
|
||||||
Yap_has_a_signal__ (USES_REGS1)
|
Yap_has_a_signal__ (USES_REGS1)
|
||||||
{
|
{
|
||||||
|
@ -1581,6 +1581,8 @@ INLINE_ONLY EXTERN inline Prop GetPredPropByFuncAndModHavingLock(FunctorEntry *,
|
|||||||
INLINE_ONLY EXTERN inline Prop PredPropByFuncAndMod(FunctorEntry *, Term);
|
INLINE_ONLY EXTERN inline Prop PredPropByFuncAndMod(FunctorEntry *, Term);
|
||||||
INLINE_ONLY EXTERN inline Prop PredPropByAtomAndMod(Atom, Term);
|
INLINE_ONLY EXTERN inline Prop PredPropByAtomAndMod(Atom, Term);
|
||||||
INLINE_ONLY EXTERN inline Prop GetPredPropByFuncHavingLock(FunctorEntry *, Term);
|
INLINE_ONLY EXTERN inline Prop GetPredPropByFuncHavingLock(FunctorEntry *, Term);
|
||||||
|
INLINE_ONLY EXTERN inline Prop PredPropByFunc (Functor fe, Term cur_mod);
|
||||||
|
INLINE_ONLY EXTERN inline Prop PredPropByAtom (Atom at, Term cur_mod);
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
|
|
||||||
|
4
H/eval.h
4
H/eval.h
@ -566,6 +566,10 @@ add_int(Int i, Int j USES_REGS)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* calculate the most significant bit for an integer */
|
||||||
|
Int
|
||||||
|
Yap_msb(Int inp USES_REGS);
|
||||||
|
|
||||||
static inline Term
|
static inline Term
|
||||||
p_plus(Term t1, Term t2 USES_REGS) {
|
p_plus(Term t1, Term t2 USES_REGS) {
|
||||||
switch (ETypeOfTerm(t1)) {
|
switch (ETypeOfTerm(t1)) {
|
||||||
|
@ -149,7 +149,7 @@ static struct trie_statistics{
|
|||||||
#define CHECK_DECREMENT_GLOBAL_TRIE_REFERENCE(REF,MODE) \
|
#define CHECK_DECREMENT_GLOBAL_TRIE_REFERENCE(REF,MODE) \
|
||||||
if (MODE == TRAVERSE_MODE_NORMAL && IsVarTerm(REF) && REF > VarIndexOfTableTerm(MAX_TABLE_VARS)) { \
|
if (MODE == TRAVERSE_MODE_NORMAL && IsVarTerm(REF) && REF > VarIndexOfTableTerm(MAX_TABLE_VARS)) { \
|
||||||
register gt_node_ptr gt_node = (gt_node_ptr) (REF); \
|
register gt_node_ptr gt_node = (gt_node_ptr) (REF); \
|
||||||
TrNode_child(gt_node) = (gt_node_ptr) ((unsigned long int) TrNode_child(gt_node) - 1); \
|
TrNode_child(gt_node) = (gt_node_ptr) ((uintptr_t) TrNode_child(gt_node) - 1); \
|
||||||
if (TrNode_child(gt_node) == 0) \
|
if (TrNode_child(gt_node) == 0) \
|
||||||
FREE_GLOBAL_TRIE_BRANCH(gt_node,TRAVERSE_MODE_NORMAL); \
|
FREE_GLOBAL_TRIE_BRANCH(gt_node,TRAVERSE_MODE_NORMAL); \
|
||||||
}
|
}
|
||||||
@ -842,7 +842,7 @@ static void traverse_global_trie(gt_node_ptr current_node, char *str, int str_in
|
|||||||
else {
|
else {
|
||||||
TrStat_gt_terms++;
|
TrStat_gt_terms++;
|
||||||
str[str_index] = 0;
|
str[str_index] = 0;
|
||||||
SHOW_TABLE_STRUCTURE(" TERMx%ld: %s\n", (unsigned long int) TrNode_child(current_node), str);
|
SHOW_TABLE_STRUCTURE(" TERMx" UInt_FORMAT ": %s\n", (CELL) TrNode_child(current_node), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore the initial state and continue with sibling nodes */
|
/* restore the initial state and continue with sibling nodes */
|
||||||
@ -913,11 +913,7 @@ static inline void traverse_trie_node(Term t, char *str, int *str_index_ptr, int
|
|||||||
mode = TRAVERSE_MODE_NORMAL;
|
mode = TRAVERSE_MODE_NORMAL;
|
||||||
} else if (mode == TRAVERSE_MODE_LONGINT) {
|
} else if (mode == TRAVERSE_MODE_LONGINT) {
|
||||||
Int li = (Int) t;
|
Int li = (Int) t;
|
||||||
#if SHORT_INTS
|
str_index += sprintf(& str[str_index], Int_FORMAT, li);
|
||||||
str_index += sprintf(& str[str_index], "%ld", li);
|
|
||||||
#else
|
|
||||||
str_index += sprintf(& str[str_index], "%d", li);
|
|
||||||
#endif /* SHORT_INTS */
|
|
||||||
traverse_update_arity(str, &str_index, arity);
|
traverse_update_arity(str, &str_index, arity);
|
||||||
if (type == TRAVERSE_TYPE_SUBGOAL)
|
if (type == TRAVERSE_TYPE_SUBGOAL)
|
||||||
mode = TRAVERSE_MODE_NORMAL;
|
mode = TRAVERSE_MODE_NORMAL;
|
||||||
@ -955,11 +951,7 @@ static inline void traverse_trie_node(Term t, char *str, int *str_index_ptr, int
|
|||||||
traverse_update_arity(str, &str_index, arity);
|
traverse_update_arity(str, &str_index, arity);
|
||||||
}
|
}
|
||||||
} else if (IsIntTerm(t)) {
|
} else if (IsIntTerm(t)) {
|
||||||
#if SHORT_INTS
|
str_index += sprintf(& str[str_index], Int_FORMAT, IntOfTerm(t));
|
||||||
str_index += sprintf(& str[str_index], "%ld", IntOfTerm(t));
|
|
||||||
#else
|
|
||||||
str_index += sprintf(& str[str_index], "%d", IntOfTerm(t));
|
|
||||||
#endif /* SHORT_INTS */
|
|
||||||
traverse_update_arity(str, &str_index, arity);
|
traverse_update_arity(str, &str_index, arity);
|
||||||
} else if (IsAtomTerm(t)) {
|
} else if (IsAtomTerm(t)) {
|
||||||
#ifndef TRIE_COMPACT_PAIRS
|
#ifndef TRIE_COMPACT_PAIRS
|
||||||
|
@ -535,6 +535,9 @@
|
|||||||
/* Define to 1 if you have the `NSLinkModule' function. */
|
/* Define to 1 if you have the `NSLinkModule' function. */
|
||||||
#undef HAVE_NSLINKMODULE
|
#undef HAVE_NSLINKMODULE
|
||||||
|
|
||||||
|
/* c++ nullptr support */
|
||||||
|
#undef HAVE_NULLPTR
|
||||||
|
|
||||||
/* Define to 1 if you have the `opendir' function. */
|
/* Define to 1 if you have the `opendir' function. */
|
||||||
#undef HAVE_OPENDIR
|
#undef HAVE_OPENDIR
|
||||||
|
|
||||||
@ -938,6 +941,9 @@
|
|||||||
/* Define to 1 if you have the `_NSGetEnviron' function. */
|
/* Define to 1 if you have the `_NSGetEnviron' function. */
|
||||||
#undef HAVE__NSGETENVIRON
|
#undef HAVE__NSGETENVIRON
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `__builtin_ffsll' function. */
|
||||||
|
#undef HAVE___BUILTIN_FFSLL
|
||||||
|
|
||||||
/* what is the configure host name */
|
/* what is the configure host name */
|
||||||
#undef HOST_ALIAS
|
#undef HOST_ALIAS
|
||||||
|
|
||||||
|
15
configure
vendored
15
configure
vendored
@ -4433,7 +4433,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$ac_cv_nullptr" = true -o $_MSC_VER -ge 1600; then
|
if test "$ac_cv_nullptr" = true -o $_MSC_VER -ge 1600; then
|
||||||
$as_echo "#define HAVE_NULLPTR 1" >>confdefs.h
|
|
||||||
|
$as_echo "#define HAVE_NULLPTR /**/" >>confdefs.h
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
$as_echo "yes" >&6; }
|
$as_echo "yes" >&6; }
|
||||||
@ -9575,7 +9576,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_func in feenableexcept fesetexceptflag fesettrapenable fesetround ffsl ffsll fgetpos finite
|
for ac_func in feenableexcept fesetexceptflag fesettrapenable fesetround ffsl ffsll __builtin_ffsll fgetpos finite
|
||||||
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"
|
||||||
@ -12343,7 +12344,7 @@ if test "$PKG_ODBC" != ""; then
|
|||||||
# Check whether --with-odbc was given.
|
# Check whether --with-odbc was given.
|
||||||
if test "${with_odbc+set}" = set; then :
|
if test "${with_odbc+set}" = set; then :
|
||||||
withval=$with_odbc; case $withval in
|
withval=$with_odbc; case $withval in
|
||||||
no|yes) echo 'Specify dir for XPM please';
|
no|yes) echo 'Specify dir for ODBC please';
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
*) ODBC_DIR=${withval}
|
*) ODBC_DIR=${withval}
|
||||||
esac
|
esac
|
||||||
@ -13952,7 +13953,7 @@ else
|
|||||||
JAVA_TEST=Test.java
|
JAVA_TEST=Test.java
|
||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* #line 13955 "configure" */
|
/* #line 13956 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -14128,7 +14129,7 @@ EOF
|
|||||||
if uudecode$EXEEXT Test.uue; then
|
if uudecode$EXEEXT Test.uue; then
|
||||||
ac_cv_prog_uudecode_base64=yes
|
ac_cv_prog_uudecode_base64=yes
|
||||||
else
|
else
|
||||||
echo "configure: 14131: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
echo "configure: 14132: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
||||||
echo "configure: failed file was:" >&5
|
echo "configure: failed file was:" >&5
|
||||||
cat Test.uue >&5
|
cat Test.uue >&5
|
||||||
ac_cv_prog_uudecode_base64=no
|
ac_cv_prog_uudecode_base64=no
|
||||||
@ -14259,7 +14260,7 @@ else
|
|||||||
JAVA_TEST=Test.java
|
JAVA_TEST=Test.java
|
||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* #line 14262 "configure" */
|
/* #line 14263 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -14294,7 +14295,7 @@ JAVA_TEST=Test.java
|
|||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
TEST=Test
|
TEST=Test
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* [#]line 14297 "configure" */
|
/* [#]line 14298 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
public static void main (String args[]) {
|
public static void main (String args[]) {
|
||||||
System.exit (0);
|
System.exit (0);
|
||||||
|
@ -122,7 +122,7 @@ AC_CACHE_VAL(ac_cv_nullptr,
|
|||||||
[ac_cv_nullptr=true],
|
[ac_cv_nullptr=true],
|
||||||
[ac_cv_nullptr=false])])
|
[ac_cv_nullptr=false])])
|
||||||
if test "$ac_cv_nullptr" = true -o $_MSC_VER -ge 1600; then
|
if test "$ac_cv_nullptr" = true -o $_MSC_VER -ge 1600; then
|
||||||
AC_DEFINE(HAVE_NULLPTR)
|
AC_DEFINE(HAVE_NULLPTR, [], [c++ nullptr support])
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
@ -1650,7 +1650,7 @@ AC_CHECK_FUNCS(_NSGetEnviron _chsize_s access acosh)
|
|||||||
AC_CHECK_FUNCS(alloca asinh atanh chdir clock clock_gettime)
|
AC_CHECK_FUNCS(alloca asinh atanh chdir clock clock_gettime)
|
||||||
AC_CHECK_FUNCS(ctime dlopen dup2)
|
AC_CHECK_FUNCS(ctime dlopen dup2)
|
||||||
AC_CHECK_FUNCS(erf feclearexcept)
|
AC_CHECK_FUNCS(erf feclearexcept)
|
||||||
AC_CHECK_FUNCS(feenableexcept fesetexceptflag fesettrapenable fesetround ffsl ffsll fgetpos finite)
|
AC_CHECK_FUNCS(feenableexcept fesetexceptflag fesettrapenable fesetround ffsl ffsll __builtin_ffsll fgetpos finite)
|
||||||
AC_CHECK_FUNCS(flsl flsll fpclass ftime ftruncate getcwd getenv)
|
AC_CHECK_FUNCS(flsl flsll fpclass ftime ftruncate getcwd getenv)
|
||||||
AC_CHECK_FUNCS(getexecname)
|
AC_CHECK_FUNCS(getexecname)
|
||||||
AC_CHECK_FUNCS(gethostbyname gethostent gethostid gethostname)
|
AC_CHECK_FUNCS(gethostbyname gethostent gethostid gethostname)
|
||||||
|
2
misc/mkwin
Executable file → Normal file
2
misc/mkwin
Executable file → Normal file
@ -19,6 +19,8 @@
|
|||||||
# http://nsis.sourceforge.net/Main_Page
|
# http://nsis.sourceforge.net/Main_Page
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
TOP=$HOME
|
||||||
|
TOP="/z"
|
||||||
VERSION=6.3.4
|
VERSION=6.3.4
|
||||||
# by default, compile without threads
|
# by default, compile without threads
|
||||||
THREADS=no
|
THREADS=no
|
||||||
|
@ -1043,13 +1043,17 @@ PRED_IMPL("win_registry_get_value", 3, win_registry_get_value, 0)
|
|||||||
DEBUG(9, Sdprintf("key = %p, name = %s\n", key, name));
|
DEBUG(9, Sdprintf("key = %p, name = %s\n", key, name));
|
||||||
if ( RegQueryValueExW(key, name, NULL, &type, data, &len) == ERROR_SUCCESS )
|
if ( RegQueryValueExW(key, name, NULL, &type, data, &len) == ERROR_SUCCESS )
|
||||||
{ RegCloseKey(key);
|
{ RegCloseKey(key);
|
||||||
|
DWORD *datap;
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{ case REG_SZ:
|
{ case REG_SZ:
|
||||||
return PL_unify_wchars(Value, PL_ATOM,
|
return PL_unify_wchars(Value, PL_ATOM,
|
||||||
len/sizeof(wchar_t)-1, (wchar_t*)data);
|
len/sizeof(wchar_t)-1, (wchar_t*)data);
|
||||||
case REG_DWORD:
|
case REG_DWORD:
|
||||||
return PL_unify_integer(Value, *((DWORD *)data));
|
{
|
||||||
|
datap = (DWORD *)data;
|
||||||
|
return PL_unify_integer(Value, datap[0]);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
warning("get_registry_value/2: Unknown registry-type: %d", type);
|
warning("get_registry_value/2: Unknown registry-type: %d", type);
|
||||||
fail;
|
fail;
|
||||||
@ -1089,7 +1093,8 @@ setStacksFromKey(HKEY key)
|
|||||||
{ if ( RegQueryValueEx(key, rd->name, NULL, &type, data, &len) ==
|
{ if ( RegQueryValueEx(key, rd->name, NULL, &type, data, &len) ==
|
||||||
ERROR_SUCCESS &&
|
ERROR_SUCCESS &&
|
||||||
type == REG_DWORD )
|
type == REG_DWORD )
|
||||||
{ DWORD v = *((DWORD *)data);
|
{ DWORD v, *datap = (DWORD *)data;
|
||||||
|
v = datap[0];
|
||||||
|
|
||||||
*rd->address = (int)v;
|
*rd->address = (int)v;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,11 @@ If you find this file and know better, please contact info@swi-prolog.org.
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include "pl-utf8.h"
|
#include "pl-utf8.h"
|
||||||
|
|
||||||
|
DWORD RunSilent(const char* strCommand);
|
||||||
|
FILE *pt_popen(const char *cmd, const char *mode);
|
||||||
|
int pt_pclose(FILE *fd);
|
||||||
|
|
||||||
|
|
||||||
DWORD RunSilent(const char* strCommand)
|
DWORD RunSilent(const char* strCommand)
|
||||||
{
|
{
|
||||||
STARTUPINFO StartupInfo;
|
STARTUPINFO StartupInfo;
|
||||||
|
Reference in New Issue
Block a user