summaryrefslogtreecommitdiff
path: root/src/3rdparty
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-07 06:46:03 +0000
committerrubidium <rubidium@openttd.org>2014-09-07 06:46:03 +0000
commitf41b4a8e1bc6176670cf31b06e90c14a93a378f7 (patch)
treeb67731aa5dd57be36a608ae88b998bccd219d3b9 /src/3rdparty
parent6bf8a63ed99f17098f185b84886200af9afa6379 (diff)
downloadopenttd-f41b4a8e1bc6176670cf31b06e90c14a93a378f7.tar.xz
(svn r26784) -Codechange [Squirrel]: use WChar for the lexer
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/squirrel/include/squirrel.h4
-rw-r--r--src/3rdparty/squirrel/squirrel/sqapi.cpp2
-rw-r--r--src/3rdparty/squirrel/squirrel/sqlexer.cpp12
-rw-r--r--src/3rdparty/squirrel/squirrel/sqlexer.h8
4 files changed, 13 insertions, 13 deletions
diff --git a/src/3rdparty/squirrel/include/squirrel.h b/src/3rdparty/squirrel/include/squirrel.h
index b71de1473..adb2390fc 100644
--- a/src/3rdparty/squirrel/include/squirrel.h
+++ b/src/3rdparty/squirrel/include/squirrel.h
@@ -31,6 +31,8 @@ to the following restrictions:
#ifndef _SQUIRREL_H_
#define _SQUIRREL_H_
+#include "../../../string_type.h"
+
typedef __int64 SQInteger;
typedef unsigned __int64 SQUnsignedInteger;
typedef unsigned __int64 SQHash; /*should be the same size of a pointer*/
@@ -178,7 +180,7 @@ typedef void (*SQPRINTFUNCTION)(HSQUIRRELVM,const SQChar * ,...);
typedef SQInteger (*SQWRITEFUNC)(SQUserPointer,SQUserPointer,SQInteger);
typedef SQInteger (*SQREADFUNC)(SQUserPointer,SQUserPointer,SQInteger);
-typedef SQInteger (*SQLEXREADFUNC)(SQUserPointer);
+typedef WChar (*SQLEXREADFUNC)(SQUserPointer);
typedef struct tagSQRegFunction{
const SQChar *name;
diff --git a/src/3rdparty/squirrel/squirrel/sqapi.cpp b/src/3rdparty/squirrel/squirrel/sqapi.cpp
index 179df117f..a1c91e567 100644
--- a/src/3rdparty/squirrel/squirrel/sqapi.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqapi.cpp
@@ -1264,7 +1264,7 @@ struct BufState{
SQInteger size;
};
-SQInteger buf_lexfeed(SQUserPointer file)
+WChar buf_lexfeed(SQUserPointer file)
{
BufState *buf=(BufState*)file;
if(buf->size<(buf->ptr+1))
diff --git a/src/3rdparty/squirrel/squirrel/sqlexer.cpp b/src/3rdparty/squirrel/squirrel/sqlexer.cpp
index 286963db4..902427bbf 100644
--- a/src/3rdparty/squirrel/squirrel/sqlexer.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqlexer.cpp
@@ -27,11 +27,11 @@ SQLexer::~SQLexer()
_keywords->Release();
}
-void SQLexer::APPEND_CHAR(LexChar c)
+void SQLexer::APPEND_CHAR(WChar c)
{
char buf[4];
- int chars = Utf8Encode(buf, c);
- for (int i = 0; i < chars; i++) {
+ size_t chars = Utf8Encode(buf, c);
+ for (size_t i = 0; i < chars; i++) {
_longstr.push_back(buf[i]);
}
}
@@ -96,10 +96,10 @@ void SQLexer::Error(const SQChar *err)
void SQLexer::Next()
{
- SQInteger t = _readf(_up);
+ WChar t = _readf(_up);
if(t > MAX_CHAR) Error("Invalid character");
if(t != 0) {
- _currdata = (LexChar)t;
+ _currdata = t;
return;
}
_currdata = SQUIRREL_EOB;
@@ -285,7 +285,7 @@ SQInteger SQLexer::GetIDType(SQChar *s)
}
-SQInteger SQLexer::ReadString(LexChar ndelim,bool verbatim)
+SQInteger SQLexer::ReadString(WChar ndelim,bool verbatim)
{
INIT_TEMP_STRING();
NEXT();
diff --git a/src/3rdparty/squirrel/squirrel/sqlexer.h b/src/3rdparty/squirrel/squirrel/sqlexer.h
index 7145dce90..5600b5f0e 100644
--- a/src/3rdparty/squirrel/squirrel/sqlexer.h
+++ b/src/3rdparty/squirrel/squirrel/sqlexer.h
@@ -2,8 +2,6 @@
#ifndef _SQLEXER_H_
#define _SQLEXER_H_
-typedef unsigned short LexChar;
-
struct SQLexer
{
SQLexer();
@@ -14,7 +12,7 @@ struct SQLexer
const SQChar *Tok2Str(SQInteger tok);
private:
SQInteger GetIDType(SQChar *s);
- SQInteger ReadString(LexChar ndelim,bool verbatim);
+ SQInteger ReadString(WChar ndelim,bool verbatim);
SQInteger ReadNumber();
void LexBlockComment();
SQInteger ReadID();
@@ -22,7 +20,7 @@ private:
SQInteger _curtoken;
SQTable *_keywords;
void INIT_TEMP_STRING() { _longstr.resize(0); }
- void APPEND_CHAR(LexChar c);
+ void APPEND_CHAR(WChar c);
void TERMINATE_BUFFER() { _longstr.push_back('\0'); }
public:
@@ -35,7 +33,7 @@ public:
SQFloat _fvalue;
SQLEXREADFUNC _readf;
SQUserPointer _up;
- LexChar _currdata;
+ WChar _currdata;
SQSharedState *_sharedstate;
sqvector<SQChar> _longstr;
CompilerErrorFunc _errfunc;