Unify preprocessor checks for win32
<https://sourceforge.net/p/predef/wiki/OperatingSystems/> says that _WIN32 is always defined for both 32-bit and 64-bit versions of Windows.
This commit is contained in:
parent
267cd00146
commit
e9d6ca265c
|
@ -3,9 +3,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#define alloca _alloca
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dtypes.h"
|
#include "dtypes.h"
|
||||||
|
|
|
@ -34,13 +34,13 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "dtypes.h"
|
#ifdef _WIN32
|
||||||
#include "bitvector.h"
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "dtypes.h"
|
||||||
|
#include "bitvector.h"
|
||||||
|
|
||||||
uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz,
|
uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz,
|
||||||
int initzero)
|
int initzero)
|
||||||
{
|
{
|
||||||
|
|
|
@ -345,7 +345,7 @@ static value_t fl_path_cwd(value_t *args, uint32_t nargs)
|
||||||
return FL_T;
|
return FL_T;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#define stat _stat
|
#define stat _stat
|
||||||
#endif
|
#endif
|
||||||
static value_t fl_path_exists(value_t *args, uint32_t nargs)
|
static value_t fl_path_exists(value_t *args, uint32_t nargs)
|
||||||
|
|
16
c/dtypes.h
16
c/dtypes.h
|
@ -13,24 +13,10 @@
|
||||||
We assume the LP64 convention for 64-bit platforms.
|
We assume the LP64 convention for 64-bit platforms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__gnu_linux__)
|
|
||||||
#define LINUX
|
|
||||||
#elif defined(__APPLE__) && defined(__MACH__)
|
|
||||||
#define MACOSX
|
|
||||||
#elif defined(__OpenBSD__)
|
|
||||||
#define OPENBSD
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
#define FREEBSD
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#define WIN32
|
|
||||||
#else
|
|
||||||
#error "unknown platform"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef BITS32 // TODO
|
#undef BITS32 // TODO
|
||||||
#define BITS64 // TODO
|
#define BITS64 // TODO
|
||||||
|
|
||||||
#if defined(WIN32)
|
#ifdef _WIN32
|
||||||
#define STDCALL __stdcall
|
#define STDCALL __stdcall
|
||||||
#if defined(IMPORT_EXPORTS)
|
#if defined(IMPORT_EXPORTS)
|
||||||
#define DLLEXPORT __declspec(dllimport)
|
#define DLLEXPORT __declspec(dllimport)
|
||||||
|
|
|
@ -2624,7 +2624,7 @@ static void lisp_init(size_t initial_heapsize)
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
set(symbol("*os-name*"), symbol("linux"));
|
set(symbol("*os-name*"), symbol("linux"));
|
||||||
#elif defined(WIN32) || defined(WIN64)
|
#elif defined(_WIN32)
|
||||||
set(symbol("*os-name*"), symbol("win32"));
|
set(symbol("*os-name*"), symbol("win32"));
|
||||||
#elif defined(MACOSX)
|
#elif defined(MACOSX)
|
||||||
set(symbol("*os-name*"), symbol("macos"));
|
set(symbol("*os-name*"), symbol("macos"));
|
||||||
|
|
4
c/ios.c
4
c/ios.c
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "dtypes.h"
|
#include "dtypes.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -43,7 +43,7 @@ static void *our_memrchr(const void *s, int c, size_t n)
|
||||||
// poll for read, unless forwrite!=0
|
// poll for read, unless forwrite!=0
|
||||||
static void _fd_poll(long fd, int forwrite)
|
static void _fd_poll(long fd, int forwrite)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
fd_set set;
|
fd_set set;
|
||||||
|
|
||||||
FD_ZERO(&set);
|
FD_ZERO(&set);
|
||||||
|
|
|
@ -107,7 +107,7 @@ int open_any_udp_port(short *portno)
|
||||||
return sockfd;
|
return sockfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
void closesocket(int fd) { close(fd); }
|
void closesocket(int fd) { close(fd); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
10
c/socket.h
10
c/socket.h
|
@ -1,4 +1,4 @@
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -8,6 +8,10 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
void closesocket(int fd);
|
||||||
|
#endif
|
||||||
|
|
||||||
int open_tcp_port(short portno);
|
int open_tcp_port(short portno);
|
||||||
int open_any_tcp_port(short *portno);
|
int open_any_tcp_port(short *portno);
|
||||||
int open_any_udp_port(short *portno);
|
int open_any_udp_port(short *portno);
|
||||||
|
@ -17,7 +21,3 @@ int sendall(int sockfd, char *buffer, int bufLen, int flags);
|
||||||
int readall(int sockfd, char *buffer, int bufLen, int flags);
|
int readall(int sockfd, char *buffer, int bufLen, int flags);
|
||||||
int addr_eq(struct sockaddr_in *a, struct sockaddr_in *b);
|
int addr_eq(struct sockaddr_in *a, struct sockaddr_in *b);
|
||||||
int socket_ready(int sock);
|
int socket_ready(int sock);
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
void closesocket(int fd);
|
|
||||||
#endif
|
|
||||||
|
|
4
c/utf8.c
4
c/utf8.c
|
@ -23,7 +23,7 @@
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
@ -253,7 +253,7 @@ size_t u8_strlen(const char *s)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WIN32__)
|
#ifdef _WIN32
|
||||||
#include "wcwidth.h"
|
#include "wcwidth.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue