diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-17 00:18:48 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-17 00:18:48 +0000 |
commit | 80b7acea2eb19f7facddce17733b88cb50a56cea (patch) | |
tree | 3b2354627dd2a178e0a66f3c9ab2181405381aec /src | |
parent | 27c8ae30aaef25d537669062d5f7f929eec18032 (diff) | |
download | luasocket-80b7acea2eb19f7facddce17733b88cb50a56cea.tar.gz luasocket-80b7acea2eb19f7facddce17733b88cb50a56cea.tar.bz2 luasocket-80b7acea2eb19f7facddce17733b88cb50a56cea.zip |
Compiled and tested on Windows...
Diffstat (limited to 'src')
-rw-r--r-- | src/inet.h | 2 | ||||
-rw-r--r-- | src/luasocket.c | 7 | ||||
-rw-r--r-- | src/mime.c | 7 | ||||
-rw-r--r-- | src/select.c | 4 | ||||
-rw-r--r-- | src/socket.h | 2 | ||||
-rw-r--r-- | src/timeout.c | 6 |
6 files changed, 6 insertions, 22 deletions
@@ -20,7 +20,7 @@ | |||
20 | #include "socket.h" | 20 | #include "socket.h" |
21 | #include "timeout.h" | 21 | #include "timeout.h" |
22 | 22 | ||
23 | #ifdef WIN32 | 23 | #ifdef _WIN32 |
24 | #define INET_ATON | 24 | #define INET_ATON |
25 | #endif | 25 | #endif |
26 | 26 | ||
diff --git a/src/luasocket.c b/src/luasocket.c index 2b0a1fa..6f7debe 100644 --- a/src/luasocket.c +++ b/src/luasocket.c | |||
@@ -87,13 +87,6 @@ static int base_open(lua_State *L) { | |||
87 | /* whoever is loading the library replaced the global environment | 87 | /* whoever is loading the library replaced the global environment |
88 | * with the namespace table */ | 88 | * with the namespace table */ |
89 | lua_pushvalue(L, LUA_GLOBALSINDEX); | 89 | lua_pushvalue(L, LUA_GLOBALSINDEX); |
90 | /* make sure library is still "requirable" if initialized staticaly */ | ||
91 | lua_pushstring(L, "_LOADEDLIB"); | ||
92 | lua_gettable(L, -2); | ||
93 | lua_pushstring(L, LUASOCKET_LIBNAME); | ||
94 | lua_pushcfunction(L, (lua_CFunction) luaopen_socket); | ||
95 | lua_settable(L, -3); | ||
96 | lua_pop(L, 1); | ||
97 | #ifdef LUASOCKET_DEBUG | 90 | #ifdef LUASOCKET_DEBUG |
98 | lua_pushstring(L, "DEBUG"); | 91 | lua_pushstring(L, "DEBUG"); |
99 | lua_pushboolean(L, 1); | 92 | lua_pushboolean(L, 1); |
@@ -79,13 +79,6 @@ MIME_API int luaopen_mime(lua_State *L) | |||
79 | /* whoever is loading the library replaced the global environment | 79 | /* whoever is loading the library replaced the global environment |
80 | * with the namespace table */ | 80 | * with the namespace table */ |
81 | lua_pushvalue(L, LUA_GLOBALSINDEX); | 81 | lua_pushvalue(L, LUA_GLOBALSINDEX); |
82 | /* make sure library is still "requirable" if initialized staticaly */ | ||
83 | lua_pushstring(L, "_LOADEDLIB"); | ||
84 | lua_gettable(L, -2); | ||
85 | lua_pushstring(L, MIME_LIBNAME); | ||
86 | lua_pushcfunction(L, (lua_CFunction) luaopen_mime); | ||
87 | lua_settable(L, -3); | ||
88 | lua_pop(L, 1); | ||
89 | /* export functions */ | 82 | /* export functions */ |
90 | luaL_openlib(L, NULL, func, 0); | 83 | luaL_openlib(L, NULL, func, 0); |
91 | /* initialize lookup tables */ | 84 | /* initialize lookup tables */ |
diff --git a/src/select.c b/src/select.c index 13f9d6e..49730d1 100644 --- a/src/select.c +++ b/src/select.c | |||
@@ -71,8 +71,6 @@ static int global_select(lua_State *L) { | |||
71 | lua_pushstring(L, "timeout"); | 71 | lua_pushstring(L, "timeout"); |
72 | return 3; | 72 | return 3; |
73 | } else { | 73 | } else { |
74 | lua_pushnil(L); | ||
75 | lua_pushnil(L); | ||
76 | lua_pushstring(L, "error"); | 74 | lua_pushstring(L, "error"); |
77 | return 3; | 75 | return 3; |
78 | } | 76 | } |
@@ -89,7 +87,7 @@ static int getfd(lua_State *L) { | |||
89 | lua_pushvalue(L, -2); | 87 | lua_pushvalue(L, -2); |
90 | lua_call(L, 1, 1); | 88 | lua_call(L, 1, 1); |
91 | if (lua_isnumber(L, -1)) | 89 | if (lua_isnumber(L, -1)) |
92 | fd = lua_tonumber(L, -1); | 90 | fd = (int) lua_tonumber(L, -1); |
93 | } | 91 | } |
94 | lua_pop(L, 1); | 92 | lua_pop(L, 1); |
95 | return fd; | 93 | return fd; |
diff --git a/src/socket.h b/src/socket.h index 85e8848..3dac875 100644 --- a/src/socket.h +++ b/src/socket.h | |||
@@ -16,7 +16,7 @@ | |||
16 | /*=========================================================================*\ | 16 | /*=========================================================================*\ |
17 | * Platform specific compatibilization | 17 | * Platform specific compatibilization |
18 | \*=========================================================================*/ | 18 | \*=========================================================================*/ |
19 | #ifdef WIN32 | 19 | #ifdef _WIN32 |
20 | #include "wsocket.h" | 20 | #include "wsocket.h" |
21 | #else | 21 | #else |
22 | #include "usocket.h" | 22 | #include "usocket.h" |
diff --git a/src/timeout.c b/src/timeout.c index 4f9a315..3472ca7 100644 --- a/src/timeout.c +++ b/src/timeout.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include "auxiliar.h" | 13 | #include "auxiliar.h" |
14 | #include "timeout.h" | 14 | #include "timeout.h" |
15 | 15 | ||
16 | #ifdef WIN32 | 16 | #ifdef _WIN32 |
17 | #include <windows.h> | 17 | #include <windows.h> |
18 | #else | 18 | #else |
19 | #include <time.h> | 19 | #include <time.h> |
@@ -133,7 +133,7 @@ p_tm tm_markstart(p_tm tm) | |||
133 | * Returns | 133 | * Returns |
134 | * time in ms. | 134 | * time in ms. |
135 | \*-------------------------------------------------------------------------*/ | 135 | \*-------------------------------------------------------------------------*/ |
136 | #ifdef WIN32 | 136 | #ifdef _WIN32 |
137 | int tm_gettime(void) | 137 | int tm_gettime(void) |
138 | { | 138 | { |
139 | return GetTickCount(); | 139 | return GetTickCount(); |
@@ -198,7 +198,7 @@ static int tm_lua_time(lua_State *L) | |||
198 | int tm_lua_sleep(lua_State *L) | 198 | int tm_lua_sleep(lua_State *L) |
199 | { | 199 | { |
200 | double n = luaL_checknumber(L, 1); | 200 | double n = luaL_checknumber(L, 1); |
201 | #ifdef WIN32 | 201 | #ifdef _WIN32 |
202 | Sleep((int)n*1000); | 202 | Sleep((int)n*1000); |
203 | #else | 203 | #else |
204 | sleep((int)n); | 204 | sleep((int)n); |