Atrinik Client 2.5
include/porting.h
Go to the documentation of this file.
00001 /************************************************************************
00002 *            Atrinik, a Multiplayer Online Role Playing Game            *
00003 *                                                                       *
00004 *    Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team    *
00005 *                                                                       *
00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game)     *
00007 * and Crossfire (Multiplayer game for X-windows).                       *
00008 *                                                                       *
00009 * This program is free software; you can redistribute it and/or modify  *
00010 * it under the terms of the GNU General Public License as published by  *
00011 * the Free Software Foundation; either version 2 of the License, or     *
00012 * (at your option) any later version.                                   *
00013 *                                                                       *
00014 * This program is distributed in the hope that it will be useful,       *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00017 * GNU General Public License for more details.                          *
00018 *                                                                       *
00019 * You should have received a copy of the GNU General Public License     *
00020 * along with this program; if not, write to the Free Software           *
00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             *
00022 *                                                                       *
00023 * The author can be reached at admin@atrinik.org                        *
00024 ************************************************************************/
00025 
00030 #ifndef PORTING_H
00031 #define PORTING_H
00032 
00033 #ifdef WIN32
00034 #   ifndef STRICT
00035 #       define STRICT
00036 #   endif
00037 
00038 #   if _MSC_VER > 1000
00039 #       pragma once
00040 #   endif
00041 
00042 #   define WIN32_LEAN_AND_MEAN
00043 
00044 #   include <windows.h>
00045 #   include <windowsx.h>
00046 #   include <mmsystem.h>
00047 #   include <winsock2.h>
00048 #   include <io.h>
00049 #   include <malloc.h>
00050 #   include <direct.h>
00051 #   include <shellapi.h>
00052 
00053 #   ifdef MINGW
00054 #       define HAVE_DIRENT_H
00055 #   endif
00056 
00057 #   define mkdir(__a, __b) _mkdir(__a)
00058 #   define socklen_t int
00059 
00060 #   define HAVE_STRICMP
00061 #   define HAVE_STRNICMP
00062 #   define HAVE_SDL
00063 #   define HAVE_SDL_IMAGE
00064 #   define HAVE_SDL_TTF
00065 #   define HAVE_CURL
00066 #   define HAVE_ZLIB
00067 #   define HAVE_SDL_MIXER
00068 #   define HAVE_STRERROR
00069 #   define HAVE_SRAND
00070 #   define HAVE_FCNTL_H
00071 #   define HAVE_TIME_H
00072 #   define HAVE_STDDEF_H
00073 #else
00074 #   include <cmake.h>
00075 #endif
00076 
00077 /* Figure out the size of 64-bit integer. */
00078 #ifdef WIN32
00079     typedef unsigned __int64            uint64;
00080     typedef signed __int64              sint64;
00081 #   define atoll                        _atoi64
00082 #   define FMT64                        "I64d"
00083 #   define FMT64U                       "I64u"
00084 #else
00085 #   if SIZEOF_LONG == 8
00086         typedef unsigned long           uint64;
00087         typedef signed long             sint64;
00088 #       define FMT64                    "ld"
00089 #       define FMT64U                   "lu"
00090 
00091 #   elif SIZEOF_LONG_LONG == 8
00092         typedef unsigned long long      uint64;
00093         typedef signed long long        sint64;
00094 #       define FMT64                    "lld"
00095 #       define FMT64U                   "llu"
00096 
00097 #   else
00098 #       error Do not know how to get a 64 bit value on this system.
00099 #       error Correct and send email to the Atrinik Team on how to do this.
00100 #   endif
00101 #endif
00102 
00103 /* Only C99 has lrint. */
00104 #ifndef _ISOC99_SOURCE
00105 #   define lrint(x) (floor((x) + ((x) > 0) ? 0.5 : -0.5))
00106 #endif
00107 
00108 /* Make sure M_PI is defined. */
00109 #ifndef M_PI
00110 #   define M_PI 3.141592654
00111 #endif
00112 
00113 #ifndef F_OK
00114 #   define F_OK 6
00115 #endif
00116 
00117 #ifndef R_OK
00118 #   define R_OK 6
00119 #endif
00120 
00121 #ifndef W_OK
00122 #   define W_OK 2
00123 #endif
00124 
00125 #ifndef HAVE_STRTOK_R
00126 char *strtok_r(char *s, const char *delim, char **save_ptr);
00127 #endif
00128 
00129 #endif