aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@impa.br>2015-08-21 22:31:29 -0300
committerDiego Nehab <diego@impa.br>2015-08-21 22:31:29 -0300
commitb211838648c1cb092e96e3ae721932a212808d96 (patch)
treed83c909c5eaed8832743b1ce003ca8648a244121
parent9322eacefd719878ccfbc3220873a2a07af41291 (diff)
downloadluasocket-b211838648c1cb092e96e3ae721932a212808d96.tar.gz
luasocket-b211838648c1cb092e96e3ae721932a212808d96.tar.bz2
luasocket-b211838648c1cb092e96e3ae721932a212808d96.zip
Fix rockspec and serial.c module.
-rw-r--r--luasocket-scm-0.rockspec13
-rw-r--r--src/compat.c2
-rw-r--r--src/serial.c16
3 files changed, 6 insertions, 25 deletions
diff --git a/luasocket-scm-0.rockspec b/luasocket-scm-0.rockspec
index f86567b..352a497 100644
--- a/luasocket-scm-0.rockspec
+++ b/luasocket-scm-0.rockspec
@@ -50,13 +50,12 @@ local function make_plat(plat)
50 } 50 }
51 local modules = { 51 local modules = {
52 ["socket.core"] = { 52 ["socket.core"] = {
53 sources = { "src/luasocket.c", "src/timeout.c", "src/buffer.c", "src/io.c", "src/auxiliar.c", 53 sources = { "src/luasocket.c", "src/timeout.c", "src/buffer.c", "src/io.c", "src/auxiliar.c", "src/options.c", "src/inet.c", "src/except.c", "src/select.c", "src/tcp.c", "src/udp.c", "src/compat.c" },
54 "src/options.c", "src/inet.c", "src/except.c", "src/select.c", "src/tcp.c", "src/udp.c" },
55 defines = defines[plat], 54 defines = defines[plat],
56 incdir = "/src" 55 incdir = "/src"
57 }, 56 },
58 ["mime.core"] = { 57 ["mime.core"] = {
59 sources = { "src/mime.c" }, 58 sources = { "src/mime.c", "src/compat.c" },
60 defines = defines[plat], 59 defines = defines[plat],
61 incdir = "/src" 60 incdir = "/src"
62 }, 61 },
@@ -73,14 +72,12 @@ local function make_plat(plat)
73 if plat == "unix" or plat == "macosx" then 72 if plat == "unix" or plat == "macosx" then
74 modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c" 73 modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
75 modules["socket.unix"] = { 74 modules["socket.unix"] = {
76 sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", 75 sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c" },
77 "src/usocket.c", "src/unix.c" },
78 defines = defines[plat], 76 defines = defines[plat],
79 incdir = "/src" 77 incdir = "/src"
80 } 78 }
81 modules["socket.serial"] = { 79 modules["socket.serial"] = {
82 sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", 80 sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/serial.c" },
83 "src/io.c", "src/usocket.c", "src/serial.c" },
84 defines = defines[plat], 81 defines = defines[plat],
85 incdir = "/src" 82 incdir = "/src"
86 } 83 }
diff --git a/src/compat.c b/src/compat.c
index bc5cc0e..c2d99cb 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -1,6 +1,6 @@
1#include "compat.h" 1#include "compat.h"
2 2
3#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM==501 3#if LUA_VERSION_NUM==501
4/* 4/*
5** Adapted from Lua 5.2 5** Adapted from Lua 5.2
6*/ 6*/
diff --git a/src/serial.c b/src/serial.c
index dedbeb5..7bdb21c 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -54,15 +54,6 @@ static luaL_Reg serial_methods[] = {
54 {NULL, NULL} 54 {NULL, NULL}
55}; 55};
56 56
57/* our socket creation function */
58/* this is an ad-hoc module that returns a single function
59 * as such, do not include other functions in this array. */
60static luaL_Reg func[] = {
61 {"serial", global_create},
62 {NULL, NULL}
63};
64
65
66/*-------------------------------------------------------------------------*\ 57/*-------------------------------------------------------------------------*\
67* Initializes module 58* Initializes module
68\*-------------------------------------------------------------------------*/ 59\*-------------------------------------------------------------------------*/
@@ -71,14 +62,7 @@ LUASOCKET_API int luaopen_socket_serial(lua_State *L) {
71 auxiliar_newclass(L, "serial{client}", serial_methods); 62 auxiliar_newclass(L, "serial{client}", serial_methods);
72 /* create class groups */ 63 /* create class groups */
73 auxiliar_add2group(L, "serial{client}", "serial{any}"); 64 auxiliar_add2group(L, "serial{client}", "serial{any}");
74#if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE)
75 lua_pushcfunction(L, global_create);
76 (void) func;
77#else
78 /* set function into socket namespace */
79 luaL_openlib(L, "socket", func, 0);
80 lua_pushcfunction(L, global_create); 65 lua_pushcfunction(L, global_create);
81#endif
82 return 1; 66 return 1;
83} 67}
84 68