Compiled and tested on Windows...
This commit is contained in:
parent
27c8ae30aa
commit
80b7acea2e
11 changed files with 23 additions and 32 deletions
|
@ -20,7 +20,7 @@
|
|||
#include "socket.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define INET_ATON
|
||||
#endif
|
||||
|
||||
|
|
|
@ -87,13 +87,6 @@ static int base_open(lua_State *L) {
|
|||
/* whoever is loading the library replaced the global environment
|
||||
* with the namespace table */
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
/* make sure library is still "requirable" if initialized staticaly */
|
||||
lua_pushstring(L, "_LOADEDLIB");
|
||||
lua_gettable(L, -2);
|
||||
lua_pushstring(L, LUASOCKET_LIBNAME);
|
||||
lua_pushcfunction(L, (lua_CFunction) luaopen_socket);
|
||||
lua_settable(L, -3);
|
||||
lua_pop(L, 1);
|
||||
#ifdef LUASOCKET_DEBUG
|
||||
lua_pushstring(L, "DEBUG");
|
||||
lua_pushboolean(L, 1);
|
||||
|
|
|
@ -79,13 +79,6 @@ MIME_API int luaopen_mime(lua_State *L)
|
|||
/* whoever is loading the library replaced the global environment
|
||||
* with the namespace table */
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
/* make sure library is still "requirable" if initialized staticaly */
|
||||
lua_pushstring(L, "_LOADEDLIB");
|
||||
lua_gettable(L, -2);
|
||||
lua_pushstring(L, MIME_LIBNAME);
|
||||
lua_pushcfunction(L, (lua_CFunction) luaopen_mime);
|
||||
lua_settable(L, -3);
|
||||
lua_pop(L, 1);
|
||||
/* export functions */
|
||||
luaL_openlib(L, NULL, func, 0);
|
||||
/* initialize lookup tables */
|
||||
|
|
|
@ -71,8 +71,6 @@ static int global_select(lua_State *L) {
|
|||
lua_pushstring(L, "timeout");
|
||||
return 3;
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, "error");
|
||||
return 3;
|
||||
}
|
||||
|
@ -89,7 +87,7 @@ static int getfd(lua_State *L) {
|
|||
lua_pushvalue(L, -2);
|
||||
lua_call(L, 1, 1);
|
||||
if (lua_isnumber(L, -1))
|
||||
fd = lua_tonumber(L, -1);
|
||||
fd = (int) lua_tonumber(L, -1);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
return fd;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
/*=========================================================================*\
|
||||
* Platform specific compatibilization
|
||||
\*=========================================================================*/
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "wsocket.h"
|
||||
#else
|
||||
#include "usocket.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "auxiliar.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
|
@ -133,7 +133,7 @@ p_tm tm_markstart(p_tm tm)
|
|||
* Returns
|
||||
* time in ms.
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int tm_gettime(void)
|
||||
{
|
||||
return GetTickCount();
|
||||
|
@ -198,7 +198,7 @@ static int tm_lua_time(lua_State *L)
|
|||
int tm_lua_sleep(lua_State *L)
|
||||
{
|
||||
double n = luaL_checknumber(L, 1);
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
Sleep((int)n*1000);
|
||||
#else
|
||||
sleep((int)n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue