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 | |
parent | 27c8ae30aaef25d537669062d5f7f929eec18032 (diff) | |
download | luasocket-80b7acea2eb19f7facddce17733b88cb50a56cea.tar.gz luasocket-80b7acea2eb19f7facddce17733b88cb50a56cea.tar.bz2 luasocket-80b7acea2eb19f7facddce17733b88cb50a56cea.zip |
Compiled and tested on Windows...
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | luasocket.sln | 8 | ||||
-rw-r--r-- | luasocket.vcproj | 9 | ||||
-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 | ||||
-rw-r--r-- | test/mimetest.lua | 2 | ||||
-rw-r--r-- | test/testclnt.lua | 6 |
11 files changed, 23 insertions, 32 deletions
@@ -1,5 +1,5 @@ | |||
1 | LuaSocket 2.0 license | 1 | LuaSocket 2.0 license |
2 | Copyright � 2003 Tecgraf, PUC-Rio. | 2 | Copyright � 1999-2004 Tecgraf, PUC-Rio. |
3 | 3 | ||
4 | Permission is hereby granted, free of charge, to any person obtaining a | 4 | Permission is hereby granted, free of charge, to any person obtaining a |
5 | copy of this software and associated documentation files (the "Software"), | 5 | copy of this software and associated documentation files (the "Software"), |
diff --git a/luasocket.sln b/luasocket.sln index 6a1d0b8..11d7824 100644 --- a/luasocket.sln +++ b/luasocket.sln | |||
@@ -7,6 +7,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mime", "mime.vcproj", "{128 | |||
7 | ProjectSection(ProjectDependencies) = postProject | 7 | ProjectSection(ProjectDependencies) = postProject |
8 | EndProjectSection | 8 | EndProjectSection |
9 | EndProject | 9 | EndProject |
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smtp", "smtp.vcproj", "{128E8BD0-174A-48F0-8771-92B1E8D18713}" | ||
11 | ProjectSection(ProjectDependencies) = postProject | ||
12 | EndProjectSection | ||
13 | EndProject | ||
10 | Global | 14 | Global |
11 | GlobalSection(SolutionConfiguration) = preSolution | 15 | GlobalSection(SolutionConfiguration) = preSolution |
12 | Debug = Debug | 16 | Debug = Debug |
@@ -21,6 +25,10 @@ Global | |||
21 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.Build.0 = Debug|Win32 | 25 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.Build.0 = Debug|Win32 |
22 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.ActiveCfg = Release|Win32 | 26 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.ActiveCfg = Release|Win32 |
23 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.Build.0 = Release|Win32 | 27 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.Build.0 = Release|Win32 |
28 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.ActiveCfg = Debug|Win32 | ||
29 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Debug.Build.0 = Debug|Win32 | ||
30 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.ActiveCfg = Release|Win32 | ||
31 | {128E8BD0-174A-48F0-8771-92B1E8D18713}.Release.Build.0 = Release|Win32 | ||
24 | EndGlobalSection | 32 | EndGlobalSection |
25 | GlobalSection(ExtensibilityGlobals) = postSolution | 33 | GlobalSection(ExtensibilityGlobals) = postSolution |
26 | EndGlobalSection | 34 | EndGlobalSection |
diff --git a/luasocket.vcproj b/luasocket.vcproj index f998a8d..6700611 100644 --- a/luasocket.vcproj +++ b/luasocket.vcproj | |||
@@ -68,7 +68,7 @@ | |||
68 | <Tool | 68 | <Tool |
69 | Name="VCCLCompilerTool" | 69 | Name="VCCLCompilerTool" |
70 | AdditionalIncludeDirectories="H:\include" | 70 | AdditionalIncludeDirectories="H:\include" |
71 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_EXPORTS;LUASOCKET_API=__declspec(dllexport); LUASOCKET_COMPILED; LUASOCKET_DEBUG" | 71 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_EXPORTS;LUASOCKET_API=__declspec(dllexport); LUASOCKET_DEBUG" |
72 | RuntimeLibrary="0" | 72 | RuntimeLibrary="0" |
73 | UsePrecompiledHeader="0" | 73 | UsePrecompiledHeader="0" |
74 | WarningLevel="3" | 74 | WarningLevel="3" |
@@ -120,10 +120,10 @@ | |||
120 | RelativePath=".\auxiliar.c"> | 120 | RelativePath=".\auxiliar.c"> |
121 | </File> | 121 | </File> |
122 | <File | 122 | <File |
123 | RelativePath=".\base.c"> | 123 | RelativePath=".\buffer.c"> |
124 | </File> | 124 | </File> |
125 | <File | 125 | <File |
126 | RelativePath=".\buffer.c"> | 126 | RelativePath=".\except.c"> |
127 | </File> | 127 | </File> |
128 | <File | 128 | <File |
129 | RelativePath=".\inet.c"> | 129 | RelativePath=".\inet.c"> |
@@ -141,9 +141,6 @@ | |||
141 | RelativePath=".\select.c"> | 141 | RelativePath=".\select.c"> |
142 | </File> | 142 | </File> |
143 | <File | 143 | <File |
144 | RelativePath=".\smtp.c"> | ||
145 | </File> | ||
146 | <File | ||
147 | RelativePath=".\tcp.c"> | 144 | RelativePath=".\tcp.c"> |
148 | </File> | 145 | </File> |
149 | <File | 146 | <File |
@@ -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); |
diff --git a/test/mimetest.lua b/test/mimetest.lua index 2d5bce6..66aeaf3 100644 --- a/test/mimetest.lua +++ b/test/mimetest.lua | |||
@@ -8,7 +8,7 @@ local qptest = "qptest.bin" | |||
8 | local eqptest = "qptest.bin2" | 8 | local eqptest = "qptest.bin2" |
9 | local dqptest = "qptest.bin3" | 9 | local dqptest = "qptest.bin3" |
10 | 10 | ||
11 | local b64test = "luasocket.dylib" | 11 | local b64test = "luasocket.dll" |
12 | local eb64test = "b64test.bin" | 12 | local eb64test = "b64test.bin" |
13 | local db64test = "b64test.bin2" | 13 | local db64test = "b64test.bin2" |
14 | 14 | ||
diff --git a/test/testclnt.lua b/test/testclnt.lua index 6735113..da6b2e8 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
@@ -339,12 +339,14 @@ end | |||
339 | ------------------------------------------------------------------------ | 339 | ------------------------------------------------------------------------ |
340 | function test_selectbugs() | 340 | function test_selectbugs() |
341 | local r, s, e = socket.select(nil, nil, 0.1) | 341 | local r, s, e = socket.select(nil, nil, 0.1) |
342 | assert(type(r) == "table" and type(s) == "table" and e == "timeout") | 342 | assert(type(r) == "table" and type(s) == "table" and |
343 | (e == "timeout" or e == "error")) | ||
343 | pass("both nil: ok") | 344 | pass("both nil: ok") |
344 | local udp = socket.udp() | 345 | local udp = socket.udp() |
345 | udp:close() | 346 | udp:close() |
346 | r, s, e = socket.select({ udp }, { udp }, 0.1) | 347 | r, s, e = socket.select({ udp }, { udp }, 0.1) |
347 | assert(type(r) == "table" and type(s) == "table" and e == "timeout") | 348 | assert(type(r) == "table" and type(s) == "table" and |
349 | (e == "timeout" or e == "error")) | ||
348 | pass("closed sockets: ok") | 350 | pass("closed sockets: ok") |
349 | e = pcall(socket.select, "wrong", 1, 0.1) | 351 | e = pcall(socket.select, "wrong", 1, 0.1) |
350 | assert(e == false) | 352 | assert(e == false) |