summaryrefslogtreecommitdiff
path: root/src/3rdparty
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-05-11 20:16:37 +0000
committerrubidium <rubidium@openttd.org>2014-05-11 20:16:37 +0000
commit39e90ec6e01f56cea5923de2da05d7467bef20ab (patch)
tree68a5fa377c2bf12082f455ead2c10fce63513558 /src/3rdparty
parent6e99a559285947ef76f856c2b541a22562bd5457 (diff)
downloadopenttd-39e90ec6e01f56cea5923de2da05d7467bef20ab.tar.xz
(svn r26584) -Codechange: [Squirrel] Make the internal integer for scripts always 64 bits, so scripts behave the same on 32 or 64 bits architectures
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/squirrel/include/squirrel.h38
-rw-r--r--src/3rdparty/squirrel/squirrel/sqdebug.cpp6
-rw-r--r--src/3rdparty/squirrel/squirrel/sqfuncstate.cpp6
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.cpp6
4 files changed, 11 insertions, 45 deletions
diff --git a/src/3rdparty/squirrel/include/squirrel.h b/src/3rdparty/squirrel/include/squirrel.h
index 1fe023dff..6da1f744d 100644
--- a/src/3rdparty/squirrel/include/squirrel.h
+++ b/src/3rdparty/squirrel/include/squirrel.h
@@ -49,33 +49,14 @@ extern "C" {
#define SQUIRREL_API extern
#endif
-#if (defined(_WIN64) || defined(_LP64))
-#ifndef _SQ64
-#define _SQ64
-#endif
+#if defined(__GNUC__)
+ #define __int64 long long
#endif
-#ifdef _SQ64
-#ifdef _MSC_VER
typedef __int64 SQInteger;
typedef unsigned __int64 SQUnsignedInteger;
typedef unsigned __int64 SQHash; /*should be the same size of a pointer*/
-#elif defined(_WIN32)
-typedef long long SQInteger;
-typedef unsigned long long SQUnsignedInteger;
-typedef unsigned long long SQHash; /*should be the same size of a pointer*/
-#else
-typedef long SQInteger;
-typedef unsigned long SQUnsignedInteger;
-typedef unsigned long SQHash; /*should be the same size of a pointer*/
-#endif
typedef int SQInt32;
-#else
-typedef int SQInteger;
-typedef int SQInt32; /*must be 32 bits(also on 64bits processors)*/
-typedef unsigned int SQUnsignedInteger;
-typedef unsigned int SQHash; /*should be the same size of a pointer*/
-#endif
#ifdef SQUSEDOUBLE
@@ -84,17 +65,8 @@ typedef double SQFloat;
typedef float SQFloat;
#endif
-#if defined(SQUSEDOUBLE) && !defined(_SQ64) || !defined(SQUSEDOUBLE) && defined(_SQ64)
-#ifdef _MSC_VER
typedef __int64 SQRawObjectVal; //must be 64bits
-#else
-typedef long long SQRawObjectVal; //must be 64bits
-#endif
#define SQ_OBJECT_RAWINIT() { _unVal.raw = 0; }
-#else
-typedef SQUnsignedInteger SQRawObjectVal; //is 32 bits on 32 bits builds and 64 bits otherwise
-#define SQ_OBJECT_RAWINIT()
-#endif
typedef void* SQUserPointer;
typedef SQUnsignedInteger SQBool;
@@ -186,6 +158,12 @@ typedef char SQChar;
#define MAX_CHAR 0xFFFF
#endif
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ #define SQ_PRINTF64 _SC("%I64d")
+#else
+ #define SQ_PRINTF64 _SC("%lld")
+#endif
+
#define SQUIRREL_VERSION _SC("Squirrel 2.2.5 stable - With custom OpenTTD modifications")
#define SQUIRREL_COPYRIGHT _SC("Copyright (C) 2003-2010 Alberto Demichelis")
#define SQUIRREL_AUTHOR _SC("Alberto Demichelis")
diff --git a/src/3rdparty/squirrel/squirrel/sqdebug.cpp b/src/3rdparty/squirrel/squirrel/sqdebug.cpp
index c683697d7..77f88d1c4 100644
--- a/src/3rdparty/squirrel/squirrel/sqdebug.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqdebug.cpp
@@ -75,11 +75,7 @@ SQString *SQVM::PrintObjVal(const SQObject &o)
switch(type(o)) {
case OT_STRING: return _string(o);
case OT_INTEGER:
-#if defined(_SQ64)
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%ld"), _integer(o));
-#else
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), _SC("%d"), _integer(o));
-#endif
+ scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)), SQ_PRINTF64, _integer(o));
return SQString::Create(_ss(this), _spval);
break;
case OT_FLOAT:
diff --git a/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp b/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
index b4f354173..f48185377 100644
--- a/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
@@ -80,11 +80,7 @@ void DumpLiteral(SQObjectPtr &o)
switch(type(o)){
case OT_STRING: scprintf(_SC("\"%s\""),_stringval(o));break;
case OT_FLOAT: scprintf(_SC("{%f}"),_float(o));break;
-#if defined(_SQ64)
- case OT_INTEGER: scprintf(_SC("{%ld}"),_integer(o));break;
-#else
- case OT_INTEGER: scprintf(_SC("{%d}"),_integer(o));break;
-#endif
+ case OT_INTEGER: scprintf(_SC("{") SQ_PRINTF64 _SC("}"),_integer(o));break;
case OT_BOOL: scprintf(_SC("%s"),_integer(o)?_SC("true"):_SC("false"));break;
default: scprintf(_SC("(%s %p)"),GetTypeName(o),(void*)_rawval(o));break; break; //shut up compiler
}
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index c8f4db674..f7c6f4d13 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -259,11 +259,7 @@ void SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%g"),_float(o));
break;
case OT_INTEGER:
-#if defined(_SQ64)
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%ld"),_integer(o));
-#else
- scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),_SC("%d"),_integer(o));
-#endif
+ scsprintf(_sp(rsl(NUMBER_MAX_CHAR+1)),SQ_PRINTF64,_integer(o));
break;
case OT_BOOL:
scsprintf(_sp(rsl(6)),_integer(o)?_SC("true"):_SC("false"));