This commit is contained in:
Vitor Santos Costa 2016-06-03 17:05:18 +01:00
parent 31abcd01c3
commit 99b3d0db99
5 changed files with 34 additions and 46 deletions

View File

@ -53,7 +53,7 @@ static char SccsId[] = "%W% %G%";
* It must always be interactive. * It must always be interactive.
*/ */
#include "Yap.h" #include "sysbits.h"
#if HAVE_FCNTL_H #if HAVE_FCNTL_H
/* for O_BINARY and O_TEXT in WIN32 */ /* for O_BINARY and O_TEXT in WIN32 */
#include <fcntl.h> #include <fcntl.h>
@ -98,25 +98,18 @@ static char SccsId[] = "%W% %G%";
#include <signal.h> #include <signal.h>
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
// WIN32 API support
#if HAVE_IO_H #if HAVE_IO_H
/* Windows */ /* Windows */
#include <io.h> #include <io.h>
#endif #endif
#endif #endif
#if !HAVE_STRNCAT
#define strncat(X,Y,Z) strcat(X,Y)
#endif
#if !HAVE_STRNCPY
#define strncpy(X,Y,Z) strcpy(X,Y)
#endif
#if _MSC_VER || defined(__MINGW32__) #if _MSC_VER || defined(__MINGW32__)
#if HAVE_SOCKET #if HAVE_SOCKET
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#include <windows.h> #include <windows.h>
#ifndef S_ISDIR
#define S_ISDIR(x) (((x)&_S_IFDIR)==_S_IFDIR)
#endif
#endif #endif
#include "iopreds.h" #include "iopreds.h"

View File

@ -1192,7 +1192,7 @@ void Yap_InitCharsio(void) {
Yap_InitCPred("put_char", 2, put_char, SafePredFlag | SyncPredFlag); Yap_InitCPred("put_char", 2, put_char, SafePredFlag | SyncPredFlag);
Yap_InitCPred("put_char1", 1, put_char_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("put_char1", 1, put_char_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("tab", 2, tab, SafePredFlag | SyncPredFlag); Yap_InitCPred("tab", 2, tab, SafePredFlag | SyncPredFlag);
Yap_InitCPred("tab1", 1, tab_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("tab", 1, tab_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("nl", 0, nl_1, SafePredFlag | SyncPredFlag); Yap_InitCPred("nl", 0, nl_1, SafePredFlag | SyncPredFlag);
Yap_InitCPred("nl", 1, nl, SafePredFlag | SyncPredFlag); Yap_InitCPred("nl", 1, nl, SafePredFlag | SyncPredFlag);

View File

@ -1,7 +1,19 @@
#include "sysbits.h" #include "sysbits.h"
#if HAVE_SIGNAL || __ANDROID__ #if HAVE_SIGINFO_H
#include <siginfo.h>
#endif
#if HAVE_SYS_UCONTEXT_H
#include <sys/ucontext.h>
#endif
#if HAVE_FPU_CONTROL_H
#include <fpu_control.h>
#endif
#if HAVE_SIGNAL
#ifdef MSH #ifdef MSH
@ -24,7 +36,7 @@ static void HandleMatherr(int sig, void *sipv, void *uapv);
#endif #endif
#define SIG_GC (SIG_PROLOG_OFFSET + 2) #define SIG_GC (SIG_PROLOG_OFFSET + 2)
#ifdef THREADS #ifdef THREADS
#define SIG_THREAD_SIGNAL (SIG_PROLOG_OFFSET + 3) #define SIG_THREAD_SIGNAL (SIG_PROLOG_OFFSET + 3)b
#endif #endif
#define SIG_FREECLAUSES (SIG_PROLOG_OFFSET + 4) #define SIG_FREECLAUSES (SIG_PROLOG_OFFSET + 4)
#define SIG_PLABORT (SIG_PROLOG_OFFSET + 5) #define SIG_PLABORT (SIG_PROLOG_OFFSET + 5)
@ -178,13 +190,6 @@ int Yap_signal_index(const char *name) {
return -1; return -1;
} }
#if HAVE_SIGINFO_H
#include <siginfo.h>
#endif
#if HAVE_SYS_UCONTEXT_H
#include <sys/ucontext.h>
#endif
#if HAVE_SIGSEGV #if HAVE_SIGSEGV
static void SearchForTrailFault(void *ptr, int sure) { static void SearchForTrailFault(void *ptr, int sure) {
@ -241,10 +246,6 @@ static void HandleSIGSEGV(int sig, void *sipv, void *uap) {
#if HAVE_SIGFPE #if HAVE_SIGFPE
#if HAVE_FPU_CONTROL_H
#include <fpu_control.h>
#endif
/* by default Linux with glibc is IEEE compliant anyway..., but we will pretend /* by default Linux with glibc is IEEE compliant anyway..., but we will pretend
* it is not. */ * it is not. */
static bool set_fpu_exceptions(Term flag) { static bool set_fpu_exceptions(Term flag) {
@ -795,7 +796,6 @@ VaxFixFrame(dummy) {
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h>
int WINAPI win_yap(HANDLE, DWORD, LPVOID); int WINAPI win_yap(HANDLE, DWORD, LPVOID);
@ -881,9 +881,7 @@ void Yap_InitSignalPreds(void) {
CACHE_REGS CACHE_REGS
Term cm = CurrentModule; Term cm = CurrentModule;
#ifndef __ANDROID__
Yap_InitCPred("$fpe_error", 0, fpe_error, 0); Yap_InitCPred("$fpe_error", 0, fpe_error, 0);
#endif
Yap_InitCPred("$alarm", 4, alarm4, SafePredFlag | SyncPredFlag); Yap_InitCPred("$alarm", 4, alarm4, SafePredFlag | SyncPredFlag);
CurrentModule = HACKS_MODULE; CurrentModule = HACKS_MODULE;
Yap_InitCPred("virtual_alarm", 4, virtual_alarm, SafePredFlag | SyncPredFlag); Yap_InitCPred("virtual_alarm", 4, virtual_alarm, SafePredFlag | SyncPredFlag);

View File

@ -27,6 +27,8 @@
#include "Yatom.h" #include "Yatom.h"
#include "eval.h" #include "eval.h"
#include "yapio.h" #include "yapio.h"
// Win32 InputOutput Support
#if _WIN32 || defined(__MINGW32__) #if _WIN32 || defined(__MINGW32__)
#include <winsock2.h> #include <winsock2.h>
/* Windows */ /* Windows */
@ -34,7 +36,12 @@
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>
#include <windows.h> #include <windows.h>
#ifndef S_ISDIR
#define S_ISDIR(x) (((x)&_S_IFDIR)==_S_IFDIR)
#endif #endif
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -43,14 +50,10 @@
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#if HAVE_SYS_PARAM_H #if HAVE_SYS_PARAM_Hb
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#ifdef FENV_H
#include <fenv.h>
#endif
#define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
#if HAVE_STDARG_H #if HAVE_STDARG_H
#include <stdarg.h> #include <stdarg.h>
#endif #endif
@ -96,10 +99,16 @@
#include "iopreds.h" #include "iopreds.h"
#if HAVE_SIGNAL_H #if HAVE_SIGNAL_H
#include <signal.h> #include <signal.h>
#endif #endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
/* CYGWIN seems to include this automatically */
#if HAVE_FENV_H // && !defined(__CYGWIN__)
#include <fenv.h>
#endif
#ifdef MPW #ifdef MPW
#define signal sigset #define signal sigset
#endif #endif
@ -132,12 +141,6 @@
#if HAVE_FCNTL_H #if HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#if _MSC_VER || defined(__MINGW32__)
#endif
/* CYGWIN seems to include this automatically */
#if HAVE_FENV_H && !defined(__CYGWIN__)
#include <fenv.h>
#endif
#if HAVE_WORDEXP_H #if HAVE_WORDEXP_H
#include <wordexp.h> #include <wordexp.h>
#endif #endif

View File

@ -139,12 +139,6 @@ void Yap_plwrite(Term t, struct stream_desc *mywrite, int max_depth, int flags,
int Yap_CheckSocketStream(Term stream, const char *error); int Yap_CheckSocketStream(Term stream, const char *error);
void Yap_init_socks(char *host, long interface_port); void Yap_init_socks(char *host, long interface_port);
#ifdef HAVE_ERRNO_H
#include <errno.h>
#else
extern int errno;
#endif
uint64_t HashFunction(const unsigned char *); uint64_t HashFunction(const unsigned char *);
uint64_t WideHashFunction(wchar_t *); uint64_t WideHashFunction(wchar_t *);