aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-01 05:35:35 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-01 05:35:35 +0000
commit197aef23ce36844e86e732f26af1df9fc5f149da (patch)
treefdc7e11c0fd653c3c25360f532d0648b0e822ad9
parenta7d5362caffb928e2947b9ef99d1165391a510da (diff)
downloadluasocket-197aef23ce36844e86e732f26af1df9fc5f149da.tar.gz
luasocket-197aef23ce36844e86e732f26af1df9fc5f149da.tar.bz2
luasocket-197aef23ce36844e86e732f26af1df9fc5f149da.zip
Compiles with g++.
-rw-r--r--TODO6
-rw-r--r--etc/lp.lua10
-rw-r--r--src/except.c9
-rw-r--r--src/tcp.c4
-rw-r--r--src/unix.c4
5 files changed, 21 insertions, 12 deletions
diff --git a/TODO b/TODO
index c74e525..9d736d0 100644
--- a/TODO
+++ b/TODO
@@ -16,7 +16,6 @@ optmize aux_getgroupudata
16 use one upvalue per string name of class/group 16 use one upvalue per string name of class/group
17 make aux_checkgroup by upvalue (faster) 17 make aux_checkgroup by upvalue (faster)
18 18
19fix local domain socket kludge of name size
20 19
21make sure all modules that can use it actually use socket.newtry 20make sure all modules that can use it actually use socket.newtry
22adicionar exemplos de expansão: pipe, local, named pipe 21adicionar exemplos de expansão: pipe, local, named pipe
@@ -27,4 +26,7 @@ testar os options!
27 - proteger get*by*.* com um mutex GLOBAL! 26 - proteger get*by*.* com um mutex GLOBAL!
28 - proteger ou atomizar o conjunto (timedout, receive), (timedout, send) 27 - proteger ou atomizar o conjunto (timedout, receive), (timedout, send)
29 - inet_ntoa também é uma merda. 28 - inet_ntoa também é uma merda.
30- SSL 29
30
31*fix local domain socket kludge of name size
32*use TLS
diff --git a/etc/lp.lua b/etc/lp.lua
index 5230957..e112ab4 100644
--- a/etc/lp.lua
+++ b/etc/lp.lua
@@ -1,6 +1,12 @@
1 1-----------------------------------------------------------------------------
2-- LPD support for the Lua language
3-- LuaSocket toolkit.
4-- Author: David Burgess
5-- Modified by Diego Nehab, but David is in charge
6-- RCS ID: $Id$
7-----------------------------------------------------------------------------
2--[[ 8--[[
3 if you have any questions RFC 1179 9 if you have any questions: RFC 1179
4]] 10]]
5-- make sure LuaSocket is loaded 11-- make sure LuaSocket is loaded
6local socket = require("socket") 12local socket = require("socket")
diff --git a/src/except.c b/src/except.c
index ad03817..80d7e5d 100644
--- a/src/except.c
+++ b/src/except.c
@@ -4,8 +4,9 @@
4* 4*
5* RCS ID: $Id$ 5* RCS ID: $Id$
6\*=========================================================================*/ 6\*=========================================================================*/
7#include <lauxlib.h>
8#include <stdio.h> 7#include <stdio.h>
8#include <lua.h>
9#include <lauxlib.h>
9 10
10#include "except.h" 11#include "except.h"
11 12
@@ -14,7 +15,7 @@
14\*=========================================================================*/ 15\*=========================================================================*/
15static int global_protect(lua_State *L); 16static int global_protect(lua_State *L);
16static int global_newtry(lua_State *L); 17static int global_newtry(lua_State *L);
17static int protected(lua_State *L); 18static int protected_(lua_State *L);
18static int finalize(lua_State *L); 19static int finalize(lua_State *L);
19static int do_nothing(lua_State *L); 20static int do_nothing(lua_State *L);
20 21
@@ -53,7 +54,7 @@ static int global_newtry(lua_State *L) {
53/*-------------------------------------------------------------------------*\ 54/*-------------------------------------------------------------------------*\
54* Protect factory 55* Protect factory
55\*-------------------------------------------------------------------------*/ 56\*-------------------------------------------------------------------------*/
56static int protected(lua_State *L) { 57static int protected_(lua_State *L) {
57 lua_pushvalue(L, lua_upvalueindex(1)); 58 lua_pushvalue(L, lua_upvalueindex(1));
58 lua_insert(L, 1); 59 lua_insert(L, 1);
59 if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) { 60 if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) {
@@ -64,7 +65,7 @@ static int protected(lua_State *L) {
64} 65}
65 66
66static int global_protect(lua_State *L) { 67static int global_protect(lua_State *L) {
67 lua_pushcclosure(L, protected, 1); 68 lua_pushcclosure(L, protected_, 1);
68 return 1; 69 return 1;
69} 70}
70 71
diff --git a/src/tcp.c b/src/tcp.c
index 8ab7d62..037a23a 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -117,7 +117,7 @@ static int meth_receive(lua_State *L)
117\*-------------------------------------------------------------------------*/ 117\*-------------------------------------------------------------------------*/
118static int meth_setoption(lua_State *L) 118static int meth_setoption(lua_State *L)
119{ 119{
120 p_tcp tcp = aux_checkgroup(L, "tcp{any}", 1); 120 p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1);
121 return opt_meth_setoption(L, opt, &tcp->sock); 121 return opt_meth_setoption(L, opt, &tcp->sock);
122} 122}
123 123
@@ -158,7 +158,7 @@ static int meth_accept(lua_State *L)
158 const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); 158 const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
159 /* if successful, push client socket */ 159 /* if successful, push client socket */
160 if (!err) { 160 if (!err) {
161 p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp)); 161 p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp));
162 aux_setclass(L, "tcp{client}", -1); 162 aux_setclass(L, "tcp{client}", -1);
163 /* initialize structure fields */ 163 /* initialize structure fields */
164 sock_setnonblocking(&sock); 164 sock_setnonblocking(&sock);
diff --git a/src/unix.c b/src/unix.c
index 34d2da1..407f85d 100644
--- a/src/unix.c
+++ b/src/unix.c
@@ -111,7 +111,7 @@ static int meth_receive(lua_State *L) {
111* Just call option handler 111* Just call option handler
112\*-------------------------------------------------------------------------*/ 112\*-------------------------------------------------------------------------*/
113static int meth_setoption(lua_State *L) { 113static int meth_setoption(lua_State *L) {
114 p_unix unix = aux_checkgroup(L, "unix{any}", 1); 114 p_unix unix = (p_unix) aux_checkgroup(L, "unix{any}", 1);
115 return opt_meth_setoption(L, opt, &unix->sock); 115 return opt_meth_setoption(L, opt, &unix->sock);
116} 116}
117 117
@@ -148,7 +148,7 @@ static int meth_accept(lua_State *L) {
148 const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); 148 const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
149 /* if successful, push client socket */ 149 /* if successful, push client socket */
150 if (!err) { 150 if (!err) {
151 p_unix clnt = lua_newuserdata(L, sizeof(t_unix)); 151 p_unix clnt = (p_unix) lua_newuserdata(L, sizeof(t_unix));
152 aux_setclass(L, "unix{client}", -1); 152 aux_setclass(L, "unix{client}", -1);
153 /* initialize structure fields */ 153 /* initialize structure fields */
154 sock_setnonblocking(&sock); 154 sock_setnonblocking(&sock);