diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/squirrel/include/squirrel.h | 38 | ||||
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqdebug.cpp | 6 | ||||
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqfuncstate.cpp | 6 | ||||
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqvm.cpp | 6 | ||||
-rw-r--r-- | src/script/squirrel.cpp | 6 |
5 files changed, 12 insertions, 50 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")); diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index aa25166b7..7b80b24b6 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -31,11 +31,7 @@ void Squirrel::CompileError(HSQUIRRELVM vm, const SQChar *desc, const SQChar *so { SQChar buf[1024]; -#ifdef _SQ64 - scsnprintf(buf, lengthof(buf), _SC("Error %s:%ld/%ld: %s"), source, line, column, desc); -#else - scsnprintf(buf, lengthof(buf), _SC("Error %s:%d/%d: %s"), source, line, column, desc); -#endif + scsnprintf(buf, lengthof(buf), _SC("Error %s:") SQ_PRINTF64 _SC("/") SQ_PRINTF64 _SC(": %s"), source, line, column, desc); /* Check if we have a custom print function */ Squirrel *engine = (Squirrel *)sq_getforeignptr(vm); |