diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-05-25 01:54:13 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-05-25 01:54:13 +0000 |
commit | 0f6c8d50a99997ac7829864b1c93362b50f1bbf3 (patch) | |
tree | d0cefe3a05484e65b7b7e79d8cae4a1d2e6d19fb /src/luasocket.c | |
parent | c1ef3e7103cc652d2004ef1ddc9409b946207f33 (diff) | |
download | luasocket-0f6c8d50a99997ac7829864b1c93362b50f1bbf3.tar.gz luasocket-0f6c8d50a99997ac7829864b1c93362b50f1bbf3.tar.bz2 luasocket-0f6c8d50a99997ac7829864b1c93362b50f1bbf3.zip |
Porting to LUA 5.0 final
Diffstat (limited to 'src/luasocket.c')
-rw-r--r-- | src/luasocket.c | 64 |
1 files changed, 27 insertions, 37 deletions
diff --git a/src/luasocket.c b/src/luasocket.c index bcc705f..53f8c21 100644 --- a/src/luasocket.c +++ b/src/luasocket.c | |||
@@ -23,18 +23,13 @@ | |||
23 | * LuaSocket includes | 23 | * LuaSocket includes |
24 | \*=========================================================================*/ | 24 | \*=========================================================================*/ |
25 | #include "luasocket.h" | 25 | #include "luasocket.h" |
26 | #include "lspriv.h" | 26 | |
27 | #include "lsselect.h" | 27 | #include "tm.h" |
28 | #include "lscompat.h" | 28 | #include "buf.h" |
29 | #include "lsbase.h" | 29 | #include "sock.h" |
30 | #include "lstm.h" | 30 | #include "inet.h" |
31 | #include "lsbuf.h" | 31 | #include "tcp.h" |
32 | #include "lssock.h" | 32 | #include "udp.h" |
33 | #include "lsinet.h" | ||
34 | #include "lstcpc.h" | ||
35 | #include "lstcps.h" | ||
36 | #include "lstcps.h" | ||
37 | #include "lsudp.h" | ||
38 | 33 | ||
39 | /*=========================================================================*\ | 34 | /*=========================================================================*\ |
40 | * Exported functions | 35 | * Exported functions |
@@ -42,34 +37,29 @@ | |||
42 | /*-------------------------------------------------------------------------*\ | 37 | /*-------------------------------------------------------------------------*\ |
43 | * Initializes all library modules. | 38 | * Initializes all library modules. |
44 | \*-------------------------------------------------------------------------*/ | 39 | \*-------------------------------------------------------------------------*/ |
45 | LUASOCKET_API int lua_socketlibopen(lua_State *L) | 40 | LUASOCKET_API int luaopen_socketlib(lua_State *L) |
46 | { | 41 | { |
47 | compat_open(L); | 42 | /* create namespace table */ |
48 | priv_open(L); | 43 | lua_pushstring(L, LUASOCKET_LIBNAME); |
49 | select_open(L); | 44 | lua_newtable(L); |
50 | base_open(L); | 45 | #ifdef LUASOCKET_DEBUG |
51 | tm_open(L); | 46 | lua_pushstring(L, "debug"); |
52 | fd_open(L); | 47 | lua_pushnumber(L, 1); |
48 | lua_settable(L, -3); | ||
49 | #endif | ||
50 | lua_settable(L, LUA_GLOBALSINDEX); | ||
51 | /* make sure modules know what is our namespace */ | ||
52 | lua_pushstring(L, "LUASOCKET_LIBNAME"); | ||
53 | lua_pushstring(L, LUASOCKET_LIBNAME); | ||
54 | lua_settable(L, LUA_GLOBALSINDEX); | ||
55 | /* initialize all modules */ | ||
53 | sock_open(L); | 56 | sock_open(L); |
54 | inet_open(L); | 57 | tm_open(L); |
55 | tcpc_open(L); | ||
56 | buf_open(L); | 58 | buf_open(L); |
57 | tcps_open(L); | 59 | inet_open(L); |
60 | tcp_open(L); | ||
58 | udp_open(L); | 61 | udp_open(L); |
59 | #ifdef LUASOCKET_DOFILE | 62 | /* load all Lua code */ |
60 | lua_dofile(L, "concat.lua"); | 63 | lua_dofile(L, "luasocket.lua"); |
61 | lua_dofile(L, "code.lua"); | ||
62 | lua_dofile(L, "url.lua"); | ||
63 | lua_dofile(L, "http.lua"); | ||
64 | lua_dofile(L, "smtp.lua"); | ||
65 | lua_dofile(L, "ftp.lua"); | ||
66 | #else | ||
67 | #include "concat.loh" | ||
68 | #include "code.loh" | ||
69 | #include "url.loh" | ||
70 | #include "http.loh" | ||
71 | #include "smtp.loh" | ||
72 | #include "ftp.loh" | ||
73 | #endif | ||
74 | return 0; | 64 | return 0; |
75 | } | 65 | } |