From 99b3d0db99141a82669a2e93b15367535450eee7 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 3 Jun 2016 17:05:18 +0100 Subject: [PATCH] android --- os/alias.c | 13 +++---------- os/charsio.c | 2 +- os/sig.c | 30 ++++++++++++++---------------- os/sysbits.h | 29 ++++++++++++++++------------- os/yapio.h | 6 ------ 5 files changed, 34 insertions(+), 46 deletions(-) diff --git a/os/alias.c b/os/alias.c index 6b844bc3a..267e488dc 100644 --- a/os/alias.c +++ b/os/alias.c @@ -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 @@ -98,25 +98,18 @@ static char SccsId[] = "%W% %G%"; #include #endif #ifdef _WIN32 +// WIN32 API support #if HAVE_IO_H /* Windows */ #include #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 #endif #include -#ifndef S_ISDIR -#define S_ISDIR(x) (((x)&_S_IFDIR)==_S_IFDIR) -#endif #endif #include "iopreds.h" diff --git a/os/charsio.c b/os/charsio.c index 9db8a0102..33adaf395 100644 --- a/os/charsio.c +++ b/os/charsio.c @@ -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); diff --git a/os/sig.c b/os/sig.c index 7df2094a0..d388f4d3a 100644 --- a/os/sig.c +++ b/os/sig.c @@ -1,7 +1,19 @@ #include "sysbits.h" -#if HAVE_SIGNAL || __ANDROID__ +#if HAVE_SIGINFO_H +#include +#endif +#if HAVE_SYS_UCONTEXT_H +#include +#endif + +#if HAVE_FPU_CONTROL_H +#include +#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 -#endif -#if HAVE_SYS_UCONTEXT_H -#include -#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 -#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 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); diff --git a/os/sysbits.h b/os/sysbits.h index b8e07b41f..8c0dac6c2 100644 --- a/os/sysbits.h +++ b/os/sysbits.h @@ -27,6 +27,8 @@ #include "Yatom.h" #include "eval.h" #include "yapio.h" + +// Win32 InputOutput Support #if _WIN32 || defined(__MINGW32__) #include /* Windows */ @@ -34,7 +36,12 @@ #include #include #include +#ifndef S_ISDIR +#define S_ISDIR(x) (((x)&_S_IFDIR)==_S_IFDIR) #endif +#endif + + #ifdef HAVE_UNISTD_H #include #endif @@ -43,14 +50,10 @@ #endif #include -#if HAVE_SYS_PARAM_H +#if HAVE_SYS_PARAM_Hb #include #endif -#ifdef FENV_H -#include -#endif -#define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR) #if HAVE_STDARG_H #include #endif @@ -96,10 +99,16 @@ #include "iopreds.h" #if HAVE_SIGNAL_H - #include - #endif +#ifdef HAVE_ERRNO_H +#include +#endif +/* CYGWIN seems to include this automatically */ +#if HAVE_FENV_H // && !defined(__CYGWIN__) +#include +#endif + #ifdef MPW #define signal sigset #endif @@ -132,12 +141,6 @@ #if HAVE_FCNTL_H #include #endif -#if _MSC_VER || defined(__MINGW32__) -#endif -/* CYGWIN seems to include this automatically */ -#if HAVE_FENV_H && !defined(__CYGWIN__) -#include -#endif #if HAVE_WORDEXP_H #include #endif diff --git a/os/yapio.h b/os/yapio.h index 61c8fde0a..da408a24d 100644 --- a/os/yapio.h +++ b/os/yapio.h @@ -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 -#else -extern int errno; -#endif - uint64_t HashFunction(const unsigned char *); uint64_t WideHashFunction(wchar_t *);