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.
*/
#include "Yap.h"
#include "sysbits.h"
#if HAVE_FCNTL_H
/* for O_BINARY and O_TEXT in WIN32 */
#include <fcntl.h>
@ -98,25 +98,18 @@ static char SccsId[] = "%W% %G%";
#include <signal.h>
#endif
#ifdef _WIN32
// WIN32 API support
#if HAVE_IO_H
/* Windows */
#include <io.h>
#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 HAVE_SOCKET
#include <winsock2.h>
#endif
#include <windows.h>
#ifndef S_ISDIR
#define S_ISDIR(x) (((x)&_S_IFDIR)==_S_IFDIR)
#endif
#endif
#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_char1", 1, put_char_1, 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", 1, nl, SafePredFlag | SyncPredFlag);

View File

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

View File

@ -27,6 +27,8 @@
#include "Yatom.h"
#include "eval.h"
#include "yapio.h"
// Win32 InputOutput Support
#if _WIN32 || defined(__MINGW32__)
#include <winsock2.h>
/* Windows */
@ -34,7 +36,12 @@
#include <direct.h>
#include <io.h>
#include <windows.h>
#ifndef S_ISDIR
#define S_ISDIR(x) (((x)&_S_IFDIR)==_S_IFDIR)
#endif
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -43,14 +50,10 @@
#endif
#include <stdlib.h>
#if HAVE_SYS_PARAM_H
#if HAVE_SYS_PARAM_Hb
#include <sys/param.h>
#endif
#ifdef FENV_H
#include <fenv.h>
#endif
#define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
#if HAVE_STDARG_H
#include <stdarg.h>
#endif
@ -96,10 +99,16 @@
#include "iopreds.h"
#if HAVE_SIGNAL_H
#include <signal.h>
#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
#define signal sigset
#endif
@ -132,12 +141,6 @@
#if HAVE_FCNTL_H
#include <fcntl.h>
#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
#include <wordexp.h>
#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);
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 WideHashFunction(wchar_t *);