updated arch_def.h and net_sys.h from uhexen2

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@687 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2012-06-25 11:51:23 +00:00
parent 6a8c9824d5
commit 498fa8e1f9
2 changed files with 111 additions and 72 deletions

View file

@ -1,27 +1,28 @@
/* /*
arch_def.h * arch_def.h
platform specific definitions * platform specific definitions
* - standalone header
Copyright (C) 2007 O.Sezer <sezero@users.sourceforge.net> * - doesn't and must not include any other headers
* - shouldn't depend on compiler.h, q_stdinc.h, or
This program is free software; you can redistribute it and/or * any other headers
modify it under the terms of the GNU General Public License *
as published by the Free Software Foundation; either version 2 * Copyright (C) 2007-2012 O.Sezer <sezero@users.sourceforge.net>
of the License, or (at your option) any later version. *
* This program is free software; you can redistribute it and/or modify
This program is distributed in the hope that it will be useful, * it under the terms of the GNU General Public License as published by
but WITHOUT ANY WARRANTY; without even the implied warranty of * the Free Software Foundation; either version 2 of the License, or (at
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * your option) any later version.
*
See the GNU General Public License for more details. * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
You should have received a copy of the GNU General Public License * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
along with this program; if not, write to: *
* See the GNU General Public License for more details.
Free Software Foundation, Inc. *
51 Franklin St, Fifth Floor, * You should have received a copy of the GNU General Public License along
Boston, MA 02110-1301 USA * with this program; if not, write to the Free Software Foundation, Inc.,
*/ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __ARCH_DEFS__ #ifndef __ARCH_DEFS__
#define __ARCH_DEFS__ #define __ARCH_DEFS__
@ -78,12 +79,18 @@
# define PLATFORM_MAC 1 # define PLATFORM_MAC 1
# endif # endif
#elif defined(__MORPHOS__) || defined(__AMIGA__) #elif defined(__MORPHOS__) || defined(__AMIGA__) || defined(__AROS__)
# if !defined(PLATFORM_AMIGA) # if !defined(PLATFORM_AMIGA)
# define PLATFORM_AMIGA 1 # define PLATFORM_AMIGA 1
# endif # endif
#elif defined(__riscos__)
# if !defined(PLATFORM_RISCOS)
# define PLATFORM_RISCOS 1
# endif
#else /* here goes the unix platforms */ #else /* here goes the unix platforms */
#if defined(__unix) || defined(__unix__) || defined(unix) || \ #if defined(__unix) || defined(__unix__) || defined(unix) || \
@ -101,8 +108,8 @@
#endif /* end of PLATFORM_ definitions */ #endif /* end of PLATFORM_ definitions */
/* Hack section: Platforms that are mostly fine when /* Platforms that are (mostly) fine
* classified under PLATFORM_UNIX : * when classified as PLATFORM_UNIX :
*/ */
#if defined(__MACOSX__) #if defined(__MACOSX__)
@ -110,7 +117,7 @@
# define PLATFORM_UNIX 2 # define PLATFORM_UNIX 2
# endif # endif
#endif /* end of PLATFORM_UNIX hacks */ #endif /* end of (pseudo) PLATFORM_UNIX */
#endif /* __ARCH_DEFS__ */ #endif /* __ARCH_DEFS__ */

View file

@ -1,27 +1,26 @@
/* /*
net_sys.h * net_sys.h
common network system header * common network system header
* - depends on arch_def.h
Copyright (C) 2007-2010 O.Sezer <sezero@users.sourceforge.net> * - may depend on q_stdinc.h
*
This program is free software; you can redistribute it and/or * Copyright (C) 2007-2012 O.Sezer <sezero@users.sourceforge.net>
modify it under the terms of the GNU General Public License *
as published by the Free Software Foundation; either version 2 * This program is free software; you can redistribute it and/or modify
of the License, or (at your option) any later version. * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
This program is distributed in the hope that it will be useful, * your option) any later version.
but WITHOUT ANY WARRANTY; without even the implied warranty of *
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
See the GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
You should have received a copy of the GNU General Public License * See the GNU General Public License for more details.
along with this program; if not, write to: *
* You should have received a copy of the GNU General Public License along
Free Software Foundation, Inc. * with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Boston, MA 02110-1301 USA */
*/
#if defined(_USE_SDLNET) #if defined(_USE_SDLNET)
@ -62,13 +61,16 @@
#if defined(__FreeBSD__) || defined(__DragonFly__) || \ #if defined(__FreeBSD__) || defined(__DragonFly__) || \
defined(__OpenBSD__) || defined(__NetBSD__) || \ defined(__OpenBSD__) || defined(__NetBSD__) || \
defined(__MACOSX__) || defined(__FreeBSD_kernel__) defined(PLATFORM_AMIGA) /* bsdsocket.library */ || \
defined(__MACOSX__) || defined(__FreeBSD_kernel__) || \
defined(__riscos__)
/* struct sockaddr has unsigned char sa_len as the first member in BSD /* struct sockaddr has unsigned char sa_len as the first member in BSD
* variants and the family member is also an unsigned char instead of an * variants and the family member is also an unsigned char instead of an
* unsigned short. This should matter only when PLATFORM_UNIX is defined, * unsigned short. This should matter only when PLATFORM_UNIX is defined,
* however, checking for the offset of sa_family in every platform that * however, checking for the offset of sa_family in every platform that
* provide a struct sockaddr doesn't hurt either (see down below for the * provide a struct sockaddr doesn't hurt either (see down below for the
* compile time asserts.) */ * compile time asserts.) */
/* FIXME : GET RID OF THIS ABOMINATION !!! */
#define HAVE_SA_LEN 1 #define HAVE_SA_LEN 1
#define SA_FAM_OFFSET 1 #define SA_FAM_OFFSET 1
#else #else
@ -77,7 +79,7 @@
#endif /* BSD, sockaddr */ #endif /* BSD, sockaddr */
/* unix includes and compatibility macros */ /* unix includes and compatibility macros */
#if defined(PLATFORM_UNIX) || defined(PLATFORM_AMIGA) #if defined(PLATFORM_UNIX) || defined(PLATFORM_RISCOS)
#include <sys/param.h> #include <sys/param.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -85,11 +87,9 @@
#if defined(__sun) || defined(sun) #if defined(__sun) || defined(sun)
#include <sys/filio.h> #include <sys/filio.h>
#include <sys/sockio.h>
#endif /* __sunos__ */ #endif /* __sunos__ */
#if defined(PLATFORM_AMIGA)
#include <proto/socket.h>
#endif
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -100,16 +100,11 @@ typedef int sys_socket_t;
#define INVALID_SOCKET (-1) #define INVALID_SOCKET (-1)
#define SOCKET_ERROR (-1) #define SOCKET_ERROR (-1)
#if defined(PLATFORM_AMIGA)
typedef int socklen_t;
#define SOCKETERRNO Errno()
#define ioctlsocket IoctlSocket
#define closesocket CloseSocket
#else
#define SOCKETERRNO errno #define SOCKETERRNO errno
#define ioctlsocket ioctl #define ioctlsocket ioctl
#define closesocket close #define closesocket close
#endif #define selectsocket select
#define IOCTLARG_P(x) /* (char *) */ x
#define NET_EWOULDBLOCK EWOULDBLOCK #define NET_EWOULDBLOCK EWOULDBLOCK
#define NET_ECONNREFUSED ECONNREFUSED #define NET_ECONNREFUSED ECONNREFUSED
@ -122,6 +117,50 @@ COMPILE_TIME_ASSERT(sockaddr, offsetof(struct sockaddr, sa_family) == SA_FAM_OFF
#endif /* end of unix stuff */ #endif /* end of unix stuff */
/* amiga includes and compatibility macros */
#if defined(PLATFORM_AMIGA) /* Amiga bsdsocket.library */
#include <sys/param.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <proto/exec.h>
#include <proto/socket.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
typedef int sys_socket_t;
#define INVALID_SOCKET (-1)
#define SOCKET_ERROR (-1)
#if !defined(__AROS__)
typedef int socklen_t;
#endif
typedef unsigned int in_addr_t; /* u_int32_t */
#define SOCKETERRNO Errno()
#define ioctlsocket IoctlSocket
#define closesocket CloseSocket
#define selectsocket(_N,_R,_W,_E,_T) \
WaitSelect((_N),(_R),(_W),(_E),(_T),NULL)
#define IOCTLARG_P(x) (char *) x
#define NET_EWOULDBLOCK EWOULDBLOCK
#define NET_ECONNREFUSED ECONNREFUSED
#define socketerror(x) strerror((x))
/* there is h_errno but no hstrerror() */
#define hstrerror(x) strerror((x))
/* Verify that we defined HAVE_SA_LEN correctly: */
COMPILE_TIME_ASSERT(sockaddr, offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET);
#endif /* end of amiga bsdsocket.library stuff */
/* windows includes and compatibility macros */ /* windows includes and compatibility macros */
#if defined(PLATFORM_WINDOWS) #if defined(PLATFORM_WINDOWS)
@ -144,6 +183,9 @@ typedef int socklen_t;
typedef SOCKET sys_socket_t; typedef SOCKET sys_socket_t;
#define selectsocket select
#define IOCTLARG_P(x) /* (u_long *) */ x
#define SOCKETERRNO WSAGetLastError() #define SOCKETERRNO WSAGetLastError()
#define NET_EWOULDBLOCK WSAEWOULDBLOCK #define NET_EWOULDBLOCK WSAEWOULDBLOCK
#define NET_ECONNREFUSED WSAECONNREFUSED #define NET_ECONNREFUSED WSAECONNREFUSED
@ -156,16 +198,6 @@ COMPILE_TIME_ASSERT(sockaddr, offsetof(struct sockaddr, sa_family) == SA_FAM_OFF
#endif /* end of windows stuff */ #endif /* end of windows stuff */
/* dos includes and compatibility macros */
#if defined(PLATFORM_DOS)
/* our local headers : */
#include "dos/dos_inet.h"
#include "dos/dos_sock.h"
#endif /* end of dos stuff. */
/* macros which may still be missing */ /* macros which may still be missing */
#if !defined(INADDR_NONE) #if !defined(INADDR_NONE)