Compiles with g++.

This commit is contained in:
Diego Nehab 2004-07-01 05:35:35 +00:00
parent a7d5362caf
commit 197aef23ce
5 changed files with 21 additions and 12 deletions

6
TODO
View File

@ -16,7 +16,6 @@ optmize aux_getgroupudata
use one upvalue per string name of class/group
make aux_checkgroup by upvalue (faster)
fix local domain socket kludge of name size
make sure all modules that can use it actually use socket.newtry
adicionar exemplos de expansão: pipe, local, named pipe
@ -27,4 +26,7 @@ testar os options!
- proteger get*by*.* com um mutex GLOBAL!
- proteger ou atomizar o conjunto (timedout, receive), (timedout, send)
- inet_ntoa também é uma merda.
- SSL
*fix local domain socket kludge of name size
*use TLS

View File

@ -1,6 +1,12 @@
-----------------------------------------------------------------------------
-- LPD support for the Lua language
-- LuaSocket toolkit.
-- Author: David Burgess
-- Modified by Diego Nehab, but David is in charge
-- RCS ID: $Id$
-----------------------------------------------------------------------------
--[[
if you have any questions RFC 1179
if you have any questions: RFC 1179
]]
-- make sure LuaSocket is loaded
local socket = require("socket")

View File

@ -4,8 +4,9 @@
*
* RCS ID: $Id$
\*=========================================================================*/
#include <lauxlib.h>
#include <stdio.h>
#include <lua.h>
#include <lauxlib.h>
#include "except.h"
@ -14,7 +15,7 @@
\*=========================================================================*/
static int global_protect(lua_State *L);
static int global_newtry(lua_State *L);
static int protected(lua_State *L);
static int protected_(lua_State *L);
static int finalize(lua_State *L);
static int do_nothing(lua_State *L);
@ -53,7 +54,7 @@ static int global_newtry(lua_State *L) {
/*-------------------------------------------------------------------------*\
* Protect factory
\*-------------------------------------------------------------------------*/
static int protected(lua_State *L) {
static int protected_(lua_State *L) {
lua_pushvalue(L, lua_upvalueindex(1));
lua_insert(L, 1);
if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) {
@ -64,7 +65,7 @@ static int protected(lua_State *L) {
}
static int global_protect(lua_State *L) {
lua_pushcclosure(L, protected, 1);
lua_pushcclosure(L, protected_, 1);
return 1;
}

View File

@ -117,7 +117,7 @@ static int meth_receive(lua_State *L)
\*-------------------------------------------------------------------------*/
static int meth_setoption(lua_State *L)
{
p_tcp tcp = aux_checkgroup(L, "tcp{any}", 1);
p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1);
return opt_meth_setoption(L, opt, &tcp->sock);
}
@ -158,7 +158,7 @@ static int meth_accept(lua_State *L)
const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
/* if successful, push client socket */
if (!err) {
p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp));
p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp));
aux_setclass(L, "tcp{client}", -1);
/* initialize structure fields */
sock_setnonblocking(&sock);

View File

@ -111,7 +111,7 @@ static int meth_receive(lua_State *L) {
* Just call option handler
\*-------------------------------------------------------------------------*/
static int meth_setoption(lua_State *L) {
p_unix unix = aux_checkgroup(L, "unix{any}", 1);
p_unix unix = (p_unix) aux_checkgroup(L, "unix{any}", 1);
return opt_meth_setoption(L, opt, &unix->sock);
}
@ -148,7 +148,7 @@ static int meth_accept(lua_State *L) {
const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
/* if successful, push client socket */
if (!err) {
p_unix clnt = lua_newuserdata(L, sizeof(t_unix));
p_unix clnt = (p_unix) lua_newuserdata(L, sizeof(t_unix));
aux_setclass(L, "unix{client}", -1);
/* initialize structure fields */
sock_setnonblocking(&sock);