#include <squirrel.h>\r
#include <assert.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <stdlib.h>\r
#include <sqstdblob.h>\r
#include "sqrdbg.h"\r
#include "sqdbgserver.h"\r
\r
+#ifndef _WIN32\r
+# define Sleep sleep\r
+# include <sys/types.h>\r
+# include <sys/socket.h>\r
+#endif\r
\r
#ifndef _UNICODE\r
#define scstrcpy strcpy\r
//this can be done much better/faster(do we need that?)\r
const SQChar *SQDbgServer::escape_xml(const SQChar *s)\r
{\r
- SQChar *temp=sq_getscratchpad(_v,((SQInteger)scstrlen(s)*6) + sizeof SQChar);\r
+ SQChar *temp=sq_getscratchpad(_v,((SQInteger)scstrlen(s)*6) + sizeof(SQChar));\r
SQChar *dest=temp;\r
while(*s!=_SC('\0')){\r
\r
*dest=_SC('\0');\r
return temp;\r
\r
-}
\ No newline at end of file
+}\r
#include <map>\r
#include <string>\r
#include <vector>\r
-#include <winsock.h>\r
+#ifdef _WIN32\r
+# include <winsock.h>\r
+#else\r
+# include <unistd.h>\r
+# define SOCKET int\r
+# define INVALID_SOCKET (-1)\r
+#endif\r
\r
typedef std::basic_string<SQChar> SQDBGString;\r
\r
#define sqdbg_closesocket(x) close((x))\r
#endif\r
\r
-#endif //_SQ_DBGSERVER_H_
\ No newline at end of file
+#endif //_SQ_DBGSERVER_H_ \r
#include <squirrel.h>\r
-#include <winsock.h>\r
+#ifdef _WIN32\r
+# include <winsock.h>\r
+#else\r
+# include <sys/types.h>\r
+# include <sys/socket.h>\r
+# include <arpa/inet.h>\r
+# include <sys/time.h>\r
+# define SOCKET_ERROR (-1)\r
+# define TIMEVAL struct timeval\r
+#endif\r
+#include <stdio.h>\r
+#include <string.h>\r
#include <squirrel.h>\r
#include <squirrel.h>\r
#include "sqrdbg.h"\r
\r
HSQREMOTEDBG sq_rdbg_init(HSQUIRRELVM v,unsigned short port,SQBool autoupdate)\r
{\r
- WSADATA wsadata;\r
- sockaddr_in bindaddr;\r
+ struct sockaddr_in bindaddr;\r
#ifdef _WIN32\r
+ WSADATA wsadata;\r
if (WSAStartup (MAKEWORD(2,2), &wsadata) != 0){\r
return NULL; \r
} \r
sq_pop(rdbg->_v,1);\r
\r
sockaddr_in cliaddr;\r
- int addrlen=sizeof(cliaddr);\r
+ socklen_t addrlen=sizeof(cliaddr);\r
if(listen(rdbg->_accept,0)==SOCKET_ERROR)\r
return sq_throwerror(rdbg->_v,_SC("error on listen(socket)"));\r
rdbg->_endpoint = accept(rdbg->_accept,(sockaddr*)&cliaddr,&addrlen);\r
#ifdef __cplusplus\r
extern "C" {\r
#endif\r
+#ifdef _WIN32\r
#pragma comment(lib, "WSOCK32.LIB")\r
+#endif\r
\r
struct SQDbgServer;\r
typedef SQDbgServer* HSQREMOTEDBG;\r
} /*extern "C"*/\r
#endif\r
\r
-#endif //_SQ_RDBG_H_
\ No newline at end of file
+#endif //_SQ_RDBG_H_\r