summaryrefslogtreecommitdiff
path: root/src/qcommon/q_platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon/q_platform.h')
-rw-r--r--src/qcommon/q_platform.h112
1 files changed, 82 insertions, 30 deletions
diff --git a/src/qcommon/q_platform.h b/src/qcommon/q_platform.h
index 84b87b9..b72d285 100644
--- a/src/qcommon/q_platform.h
+++ b/src/qcommon/q_platform.h
@@ -1,13 +1,14 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
+Copyright (C) 2000-2013 Darklegion Development
+Copyright (C) 2015-2019 GrangerHub
This file is part of Tremulous.
Tremulous is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
+published by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
Tremulous is distributed in the hope that it will be
@@ -16,20 +17,27 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+along with Tremulous; if not, see <https://www.gnu.org/licenses/>
+
===========================================================================
*/
-//
+
#ifndef __Q_PLATFORM_H
#define __Q_PLATFORM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// this is for determining if we have an asm version of a C function
+#define idx64 0
+
#ifdef Q3_VM
#define id386 0
#define idppc 0
#define idppc_altivec 0
+#define idsparc 0
#else
@@ -59,12 +67,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define idppc_altivec 0
#endif
+#if defined(__sparc__) && !defined(C_ONLY)
+#define idsparc 1
+#else
+#define idsparc 0
+#endif
+
#endif
#ifndef __ASM_I386__ // don't include the C bits if included from qasm.h
// for windows fastcall option
#define QDECL
+#define QCALL
//================================================================= WIN64/32 ===
@@ -101,7 +116,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// For cl_updates.cpp
#define RELEASE_PACKAGE_NAME ( "release-mingw32-" ARCH_STRING ".zip" )
-
+ #define RELEASE_SIGNATURE_NAME ( "release-mingw32-" ARCH_STRING ".zip.sig" )
+ #define GRANGER_EXE ( "granger" EXE_EXT )
+
#elif defined(_WIN32) || defined(__WIN32__)
#undef QDECL
@@ -132,7 +149,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// For cl_updates.cpp
#define RELEASE_PACKAGE_NAME ( "release-mingw32-" ARCH_STRING ".zip" )
-
+ #define RELEASE_SIGNATURE_NAME ( "release-mingw32-" ARCH_STRING ".zip.sig" )
+ #define GRANGER_EXE ( "granger" EXE_EXT )
+
#endif
@@ -162,7 +181,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// For cl_updates.cpp
#define RELEASE_PACKAGE_NAME ( "release-darwin-" ARCH_STRING ".zip" )
-
+ #define RELEASE_SIGNATURE_NAME ( "release-darwin-" ARCH_STRING ".zip.sig" )
+ #define GRANGER_EXE ( "granger" EXE_EXT )
+
#endif
//================================================================= LINUX ===
@@ -194,6 +215,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# define Q3_LITTLE_ENDIAN
#undef idx64
#define idx64 1
+ #elif defined __arm__
+ # if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ # error "Big endian ARM is not supported"
+ # endif
+ # if defined __armhf__
+ # define ARCH_STRING "armhf"
+ # define Q3_LITTLE_ENDIAN
+ # else
+ # define ARCH_STRING "armel"
+ # define Q3_LITTLE_ENDIAN
+ # endif
+ #elif defined __aarch64__
+ # if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ # error "Big endian ARM is not supported"
+ # endif
+ # define ARCH_STRING "aarch64"
+ # define Q3_LITTLE_ENDIAN
#endif
#define DLL_EXT ".so"
@@ -201,6 +239,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// For cl_updates.cpp
#define RELEASE_PACKAGE_NAME ( "release-linux-" ARCH_STRING ".zip" )
+ #define RELEASE_SIGNATURE_NAME ( "release-linux-" ARCH_STRING ".zip.sig" )
+ #define GRANGER_EXE ( "granger" EXE_EXT )
#endif
@@ -336,51 +376,63 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//endianness
+void CopyShortSwap (void *dest, void *src);
+void CopyLongSwap (void *dest, void *src);
short ShortSwap (short l);
int LongSwap (int l);
float FloatSwap (const float *f);
#if defined( Q3_BIG_ENDIAN ) && defined( Q3_LITTLE_ENDIAN )
-#error "Endianness defined as both big and little"
+ #error "Endianness defined as both big and little"
#elif defined( Q3_BIG_ENDIAN )
-#define LittleShort(x) ShortSwap(x)
-#define LittleLong(x) LongSwap(x)
-#define LittleFloat(x) FloatSwap(&x)
-#define BigShort
-#define BigLong
-#define BigFloat
+ #define CopyLittleShort(dest, src) CopyShortSwap(dest, src)
+ #define CopyLittleLong(dest, src) CopyLongSwap(dest, src)
+ #define LittleShort(x) ShortSwap(x)
+ #define LittleLong(x) LongSwap(x)
+ #define LittleFloat(x) FloatSwap(&x)
+ #define BigShort
+ #define BigLong
+ #define BigFloat
#elif defined( Q3_LITTLE_ENDIAN )
-#define LittleShort
-#define LittleLong
-#define LittleFloat
-#define BigShort(x) ShortSwap(x)
-#define BigLong(x) LongSwap(x)
-#define BigFloat(x) FloatSwap(&x)
+ #define CopyLittleShort(dest, src) memcpy(dest, src, 2)
+ #define CopyLittleLong(dest, src) memcpy(dest, src, 4)
+ #define LittleShort
+ #define LittleLong
+ #define LittleFloat
+ #define BigShort(x) ShortSwap(x)
+ #define BigLong(x) LongSwap(x)
+ #define BigFloat(x) FloatSwap(&x)
#elif defined( Q3_VM )
-#define LittleShort
-#define LittleLong
-#define LittleFloat
-#define BigShort
-#define BigLong
-#define BigFloat
+ #define LittleShort
+ #define LittleLong
+ #define LittleFloat
+ #define BigShort
+ #define BigLong
+ #define BigFloat
#else
-#error "Endianness not defined"
+
+ #error "Endianness not defined"
+
#endif
//platform string
#ifdef NDEBUG
-#define PLATFORM_STRING OS_STRING "-" ARCH_STRING
+ #define PLATFORM_STRING OS_STRING "-" ARCH_STRING
#else
-#define PLATFORM_STRING OS_STRING "-" ARCH_STRING "-debug"
+ #define PLATFORM_STRING OS_STRING "-" ARCH_STRING "-debug"
+#endif
+
#endif
+#ifdef __cplusplus
+}
#endif
#endif