mirror of https://github.com/OpenTTD/OpenTTD
(svn r26772) -Cleanup [Squirrel]: remove traces to SQUNICODE define
parent
7c4e9dd71d
commit
ad315ef6d9
|
@ -10,11 +10,7 @@
|
|||
#pragma comment (lib ,"sqstdlib.lib")
|
||||
#endif
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#define scvprintf vwprintf
|
||||
#else
|
||||
#define scvprintf vprintf
|
||||
#endif
|
||||
|
||||
void printfunc(HSQUIRRELVM v, const SQChar *s, ...)
|
||||
{
|
||||
|
|
|
@ -89,46 +89,6 @@ struct SQClass;
|
|||
struct SQInstance;
|
||||
struct SQDelegable;
|
||||
|
||||
//#ifdef _UNICODE
|
||||
//#define SQUNICODE
|
||||
//#endif
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#if (defined(_MSC_VER) && _MSC_VER >= 1400) // 1400 = VS8
|
||||
|
||||
#ifndef _WCHAR_T_DEFINED //this is if the compiler considers wchar_t as native type
|
||||
typedef unsigned short wchar_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef wchar_t SQChar;
|
||||
#define _SC(a) L##a
|
||||
#define scstrcmp wcscmp
|
||||
#define scsprintf swprintf
|
||||
#define scsnprintf _snwprintf
|
||||
#define scstrlen wcslen
|
||||
#define scstrtod wcstod
|
||||
#define scstrtol wcstol
|
||||
#define scatoi _wtoi
|
||||
#define scstrtoul wcstoul
|
||||
#define scvsprintf vswprintf
|
||||
#define scstrstr wcsstr
|
||||
#define scisspace iswspace
|
||||
#define scisdigit iswdigit
|
||||
#define scisxdigit iswxdigit
|
||||
#define scisalpha iswalpha
|
||||
#define sciscntrl iswcntrl
|
||||
#define scisalnum iswalnum
|
||||
#define scprintf wprintf
|
||||
#define scfprintf fwprintf
|
||||
#define scvprintf vwprintf
|
||||
#define scvfprintf vfwprintf
|
||||
#define scvsnprintf _vsnwprintf
|
||||
#define scstrdup _wcsdup
|
||||
#define scstrrchr wcsrchr
|
||||
#define scstrcat wcscat
|
||||
#define MAX_CHAR 0xFFFF
|
||||
#else
|
||||
typedef char SQChar;
|
||||
#define _SC(a) a
|
||||
#define scstrcmp strcmp
|
||||
|
@ -156,7 +116,6 @@ typedef char SQChar;
|
|||
#define scstrrchr strrchr
|
||||
#define scstrcat strcat
|
||||
#define MAX_CHAR 0xFFFF
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define SQ_PRINTF64 _SC("%I64d")
|
||||
|
|
|
@ -17,15 +17,9 @@
|
|||
#include <sqstdstring.h>
|
||||
#include <sqstdaux.h>
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#define scfprintf fwprintf
|
||||
#define scfopen _wfopen
|
||||
#define scvprintf vwprintf
|
||||
#else
|
||||
#define scfprintf fprintf
|
||||
#define scfopen fopen
|
||||
#define scvprintf vprintf
|
||||
#endif
|
||||
|
||||
|
||||
void PrintVersionInfos();
|
||||
|
@ -131,12 +125,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[])
|
|||
|
||||
if(arg<argc) {
|
||||
const SQChar *filename=NULL;
|
||||
#ifdef SQUNICODE
|
||||
mbstowcs(temp,argv[arg],strlen(argv[arg]));
|
||||
filename=temp;
|
||||
#else
|
||||
filename=argv[arg];
|
||||
#endif
|
||||
|
||||
arg++;
|
||||
sq_pushroottable(v);
|
||||
|
@ -145,14 +134,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[])
|
|||
for(i=arg;i<argc;i++)
|
||||
{
|
||||
const SQChar *a;
|
||||
#ifdef SQUNICODE
|
||||
int alen=(int)strlen(argv[i]);
|
||||
a=sq_getscratchpad(v,(int)(alen*sizeof(SQChar)));
|
||||
mbstowcs(sq_getscratchpad(v,-1),argv[i],alen);
|
||||
sq_getscratchpad(v,-1)[alen] = _SC('\0');
|
||||
#else
|
||||
a=argv[i];
|
||||
#endif
|
||||
sq_pushstring(v,a,-1);
|
||||
|
||||
sq_arrayappend(v,-2);
|
||||
|
@ -163,13 +145,7 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[])
|
|||
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,SQTrue))){
|
||||
SQChar *outfile = _SC("out.cnut");
|
||||
if(output) {
|
||||
#ifdef SQUNICODE
|
||||
int len = (int)(strlen(output)+1);
|
||||
mbstowcs(sq_getscratchpad(v,len*sizeof(SQChar)),output,len);
|
||||
outfile = sq_getscratchpad(v,-1);
|
||||
#else
|
||||
outfile = output;
|
||||
#endif
|
||||
}
|
||||
if(SQ_SUCCEEDED(sqstd_writeclosuretofile(v,outfile)))
|
||||
return _DONE;
|
||||
|
|
|
@ -9,11 +9,7 @@
|
|||
//basic API
|
||||
SQFILE sqstd_fopen(const SQChar *filename ,const SQChar *mode)
|
||||
{
|
||||
#ifndef SQUNICODE
|
||||
return (SQFILE)fopen(filename,mode);
|
||||
#else
|
||||
return (SQFILE)_wfopen(filename,mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
SQInteger sqstd_fread(void* buffer, SQInteger size, SQInteger count, SQFILE file)
|
||||
|
|
|
@ -8,15 +8,9 @@
|
|||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#define scstrchr wcschr
|
||||
#define scatoi _wtoi
|
||||
#define scstrtok wcstok
|
||||
#else
|
||||
#define scstrchr strchr
|
||||
#define scatoi atoi
|
||||
#define scstrtok strtok
|
||||
#endif
|
||||
#define MAX_FORMAT_LEN 20
|
||||
#define MAX_WFORMAT_LEN 3
|
||||
#define ADDITIONAL_FORMAT_SPACE (100*sizeof(SQChar))
|
||||
|
|
|
@ -5,20 +5,11 @@
|
|||
#include <stdio.h>
|
||||
#include <sqstdsystem.h>
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#include <wchar.h>
|
||||
#define scgetenv _wgetenv
|
||||
#define scsystem _wsystem
|
||||
#define scasctime _wasctime
|
||||
#define scremove _wremove
|
||||
#define screname _wrename
|
||||
#else
|
||||
#define scgetenv getenv
|
||||
#define scsystem system
|
||||
#define scasctime asctime
|
||||
#define scremove remove
|
||||
#define screname rename
|
||||
#endif
|
||||
|
||||
static SQInteger _system_getenv(HSQUIRRELVM v)
|
||||
{
|
||||
|
|
|
@ -123,11 +123,7 @@ private:
|
|||
#define _instance_ddel _table(_sharedstate->_instance_default_delegate)
|
||||
#define _weakref_ddel _table(_sharedstate->_weakref_default_delegate)
|
||||
|
||||
#ifdef SQUNICODE //rsl REAL STRING LEN
|
||||
#define rsl(l) ((l)<<1)
|
||||
#else
|
||||
#define rsl(l) (l)
|
||||
#endif
|
||||
|
||||
extern SQObjectPtr _null_;
|
||||
extern SQObjectPtr _true_;
|
||||
|
|
Loading…
Reference in New Issue