From: Ingo Ruhnke Date: Wed, 13 Aug 2014 00:45:28 +0000 (+0200) Subject: A few quick hacks to get the Squirrel debugger sqdbg to compile on Linux X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0034881e8c26573ee833494b6cb00e8bb3d34e10;p=supertux.git A few quick hacks to get the Squirrel debugger sqdbg to compile on Linux --- diff --git a/external/squirrel/sqdbg/sqdbgserver.cpp b/external/squirrel/sqdbg/sqdbgserver.cpp index c7909c810..f7c4aacd3 100755 --- a/external/squirrel/sqdbg/sqdbgserver.cpp +++ b/external/squirrel/sqdbg/sqdbgserver.cpp @@ -1,9 +1,17 @@ #include #include +#include +#include +#include #include #include "sqrdbg.h" #include "sqdbgserver.h" +#ifndef _WIN32 +# define Sleep sleep +# include +# include +#endif #ifndef _UNICODE #define scstrcpy strcpy @@ -633,7 +641,7 @@ void SQDbgServer::EndDocument() //this can be done much better/faster(do we need that?) const SQChar *SQDbgServer::escape_xml(const SQChar *s) { - SQChar *temp=sq_getscratchpad(_v,((SQInteger)scstrlen(s)*6) + sizeof SQChar); + SQChar *temp=sq_getscratchpad(_v,((SQInteger)scstrlen(s)*6) + sizeof(SQChar)); SQChar *dest=temp; while(*s!=_SC('\0')){ @@ -659,4 +667,4 @@ const SQChar *SQDbgServer::escape_xml(const SQChar *s) *dest=_SC('\0'); return temp; -} \ No newline at end of file +} diff --git a/external/squirrel/sqdbg/sqdbgserver.h b/external/squirrel/sqdbg/sqdbgserver.h index 272fce367..20f398d63 100755 --- a/external/squirrel/sqdbg/sqdbgserver.h +++ b/external/squirrel/sqdbg/sqdbgserver.h @@ -8,7 +8,13 @@ #include #include #include -#include +#ifdef _WIN32 +# include +#else +# include +# define SOCKET int +# define INVALID_SOCKET (-1) +#endif typedef std::basic_string SQDBGString; @@ -148,4 +154,4 @@ public: #define sqdbg_closesocket(x) close((x)) #endif -#endif //_SQ_DBGSERVER_H_ \ No newline at end of file +#endif //_SQ_DBGSERVER_H_ diff --git a/external/squirrel/sqdbg/sqrdbg.cpp b/external/squirrel/sqdbg/sqrdbg.cpp index 542b0486c..eb9130ed1 100755 --- a/external/squirrel/sqdbg/sqrdbg.cpp +++ b/external/squirrel/sqdbg/sqrdbg.cpp @@ -1,5 +1,16 @@ #include -#include +#ifdef _WIN32 +# include +#else +# include +# include +# include +# include +# define SOCKET_ERROR (-1) +# define TIMEVAL struct timeval +#endif +#include +#include #include #include #include "sqrdbg.h" @@ -11,9 +22,9 @@ SQInteger error_handler(HSQUIRRELVM v); HSQREMOTEDBG sq_rdbg_init(HSQUIRRELVM v,unsigned short port,SQBool autoupdate) { - WSADATA wsadata; - sockaddr_in bindaddr; + struct sockaddr_in bindaddr; #ifdef _WIN32 + WSADATA wsadata; if (WSAStartup (MAKEWORD(2,2), &wsadata) != 0){ return NULL; } @@ -48,7 +59,7 @@ SQRESULT sq_rdbg_waitforconnections(HSQREMOTEDBG rdbg) sq_pop(rdbg->_v,1); sockaddr_in cliaddr; - int addrlen=sizeof(cliaddr); + socklen_t addrlen=sizeof(cliaddr); if(listen(rdbg->_accept,0)==SOCKET_ERROR) return sq_throwerror(rdbg->_v,_SC("error on listen(socket)")); rdbg->_endpoint = accept(rdbg->_accept,(sockaddr*)&cliaddr,&addrlen); diff --git a/external/squirrel/sqdbg/sqrdbg.h b/external/squirrel/sqdbg/sqrdbg.h index c3cc56835..71585a2fa 100755 --- a/external/squirrel/sqdbg/sqrdbg.h +++ b/external/squirrel/sqdbg/sqrdbg.h @@ -4,7 +4,9 @@ #ifdef __cplusplus extern "C" { #endif +#ifdef _WIN32 #pragma comment(lib, "WSOCK32.LIB") +#endif struct SQDbgServer; typedef SQDbgServer* HSQREMOTEDBG; @@ -18,4 +20,4 @@ SQRESULT sq_rdbg_update(HSQREMOTEDBG rdbg); } /*extern "C"*/ #endif -#endif //_SQ_RDBG_H_ \ No newline at end of file +#endif //_SQ_RDBG_H_